Sep 27

Rotate iphone video – lossless

I was in CP 2010 conference in St Andrews, where I took a video of a nice dinner we had. It turned out that the video was rotated :( I just couldn’t get any way to fix it without re-encoding it. Until today that I suddenly noticed that if you add the movie to Google Picasa on a Mac you can rotate it just as if you rotate a picture and once rotated to make it permanent you just have to export the clip using the export clip button in Picasa. The exported video is simply rotated and is lossless and play well in any video player like VLC, MPC, quicktime,…etc
Enjoy rotating videos!

GD Star Rating
loading...
GD Star Rating
loading...

Sep 09

IBM ILOG CPLEX and Python, Nightmare on a Mac!!

Lately, I was playing with CPLEX studio 12, and I found it a nightmare to set it up and running on a Mac OS X with Python. If you like to know how to get rid of the headache, then this topic is for you :)

Here is what we do:

1. Get the academic version by applying here:

https://www.ibm.com/developerworks/university/membership/

2. Login to the account and  download CPLEX for Mac from here:

IBM Academic Initiative
More precisely, I had to search for CPLEX in catalog to find it:
IBM Academic Initiative Software Downloads

3. Download the academic license from here:

http://www.ibm.com/developerworks/university/support/ilog.html

4. Install CPLEX binary by running the script from terminal.

./cplex_studio122.acad.macos.bin

5. Rename the license from access.ilm.rdp to access.ilm and copy it into the following folder (create the folder if it doesn’t exists):

/usr/ilog/ilm/

NOTE: Make sure to rename it at this point, CPLEX won’t recognize the downloaded version of the file.

6. Now we can verify to see if CPLEX can run by going to its folder and run  ./cplex.

7. If we have the python installed in Mac (which is usually the case by default), then we can completely import CPLEX libraries and use it in a python program. To do that we go to the following folder:

~/ILOG/CPLEX_Studio_AcademicResearch122/cplex/python/x86_darwin9_gcc4.0

now we need to run the following command to setup the libraries:

python setup.py install --home ./

8. Once the libraries are setup, we need to add the path to the PYTHONPATH by running the following:

export PYTHONPATH=$PYTHONPATH:~/ILOG/CPLEX_Studio_AcademicResearch122/cplex/python/x86_darwin9_gcc4.0

NOTE: you can add the above to your ~/.MacOSX/environment.plist to make it permanent.

9. Not done yet! since the CPLEX python only supports x86 architecture (even though CPLEX itself supports both x86 and x64), and Apple python by defaults run only in x64 mode in snow leopard, so we need to force python to run in x86 mode, and that can be done by:

export VERSIONER_PYTHON_PREFER_32_BIT=yes

10. Finally!!! That’s it, now we can run CPLEX code using python and enjoy.

Any question or comments is welcome.

GD Star Rating
loading...
GD Star Rating
loading...

Aug 15

what’s the point…

Goodness, Why some people open a blog and put just nothing there, like me :roll:  Well I hope more to come here soon, I be dedicating some time and see if I be doomed with blogging or not. Stay tuned…

GD Star Rating
loading...
GD Star Rating
loading...

Mar 10

Comet Syntax highlighting and Auto-completion

Long time no post here :) well i was working on my master thesis, and it’s about Air Traffic Management using constraint based local search. Comet language provides a high level solver for constraint based local search problems. it’s one of the best available, and considering the new version 1.1 we can expect much more including global search.

Unfortunately, Comet doesn’t come with any source code editor, except the old emacs mode available from the wiki page which is very simple. since I’m using Notepad++ for many of my source editing I thought maybe it can be a good idea to try and make a syntax highlighter plugin for Notepad++ that supports Comet language. Also it turns out that i could even make an Auto-completion feature for Comet under Notepad++.

So here is the result:

cometsyntax

I also made another code to read the help documents from Comet and generate an xml API so that it can be used as the Auto-completion plugin for Notepad++. Here’s how it looks like:

cometautocomp1

cometautocomp2

All in all, it’s not still the best since Notepad++ has some shortcomings, as it can’t provide a list of parameters for overloaded functions that i hope will be added in later releases.

Here is the link to download the plugin: comet_api

*Remember to turn on Auto-completion option in Notepad++ Settings->Preference…
The installation process is fully described in the package readme file. let me know what you think ^_^

GD Star Rating
loading...
GD Star Rating
loading...

Aug 04

Edit Final Fantasy VII – Crisis Core Savegame

FFV-CC

Lately I was playing this awesome game on PSP , and after about 100 hours of playing missions i faced Minerva, the goddess of earth. well facing her was easy especially with the trick of stealing 99x Phoenix Downs(read ultimate guide from GameFaq). as you may know if you keep stealing this Item from her, you can actually make infinite Gil and SP and therefor you can max all Materia stats.
okay now the problem reside in stealing ^_^ meaning if you need 99million Gil then you have to keep stealing around 200 times and this is such a frustrating task, specially with the intro video that keep reminding you of her mightiness =P
I suddenly thought of how about editing the Savegame for good :D and yeah this makes life much easier without actually cheating on the game since getting infinite SP and Gil was already accomplished by reaching Minerva.
Okay enough of chit chat,  here is what you need to edit the Savegame and Add maximum allowed Gil and SP:

  1. PSP with CFW 3.xx or higher (of course this is needed since we gonna use homebrew plugin*)
  2. SaveGame Deemer v1.1 from here
  3. hex editor (any hex editor is fine!)

now that you have all the preperation ready, let’s do it! here are the steps:

  1. install the save game deemer plugin, just follow the instruction in the packet you downloaded.
  2. now that you have the plugin installed, run the game and load your last savegame. and save it in a new slot. that is where the plugin comes in and saves the unencrypted version of your savegame.
  3. now exit the game and connect your psp to pc and go to your psp memory stick. browse to this folder: PSP/SAVEPLAIN/ULUS10336
    remember that “ULUS10336″ may be different for you, but you can still recognize it by looking into SAVEDATA folder and look for any savegame with FFV icon inside. generally for US version of the game you should see “ULUS10336″
  4. well this folder contain the unencrypted save game, so that means you can edit the save game and then load it! to edit your Gil and SP open the folder and open the file called “SDDATA.BIN” with your hex editor. this file includes all your save game settings. so know you want to know which address point to Gil and SP. here it is:
    Gil address: from 0x00002A08 to 0x00002A0B
    SP address: from 0×00002964 to 0×00002967
    as you can see in the following image:
  5. you can’t simply replace these hex values with all FF to get the maximum, that’s because the game doesn’t support such a high value. so you just have to replace them with maximum supported Gil and SP in game which is 999,999,999
  6. converting this number to hex will give us: 3B9AC9FF
    this part is a little tricky, you have to know that saving a number in a Hex file is in reverse order so that means if you want to put this number in offset 0x2A08 then you have to put in the following order:
    offset 0x2A08: FF
    offset 0x2A09: C9
    offset 0x2A0A: 9A
    offset 0x2A0B: 3B
    here is how the edited values looks like in hex editor:

    as you see this is in reverse order and it applies to all numbers. so you have to do the same for SP. now you just edit the file as you please and save it.

  7. go to PSP/SAVEDATA
    look for a folder that starts with “ULUS10336DATA” and ends to a number, the number indicates how many times you saved your game so if you have a folder called “ULUS10336DATA34″ then it means this folder holds the save data for the 34th savegame. since in step 2 you saved your game you should look for the greatest number that starts with “ULUS10336DATA”. you can easily find it by sorting the view by name and look for the last folder with greatest number. now keep the number in mind, let’s assume you found 46 as the last savegame number.
  8. no go back to PSP/SAVEPLAIN
    make a new folder called “ULUS10336DATA46″ make sure you replace “46″ in the name with the number you found in step7.
  9. copy  everything from PSP/SAVEPLAIN/ULUS10336 to PSP/SAVEPLAIN/ULUS10336DATA46
    this step means you are making a new savegame exactly the same as the encrypted version but when you try to load this save game the plugin will load the unencrypted version which was edited by you <3
  10. now just remove the psp from pc and start the game and load your last savegame, you should be able to see your changes.
  11. finally when you finished with all the editing disable the plugin from recovery menu of your psp.

i hope this post give you an idea of how editing a savegame works ^_^ please let me know if there is anything unclear by leaving comments.

* of course having a CFW PSP brings tons of new features to your psp but that doesn’t mean you stop buying these priceless games, ya know right!

GD Star Rating
loading...
GD Star Rating
loading...

Jul 28

Converting PMF to AVI Video -lossless

well, lately i was struggling a lot to find out a working solution for converting or at least being able to watch the pmf video file format from psp on my laptop. but it turn out to be a big hassle and after searching for many hours i just found one solution that didn’t work for my file.

Okay now what’s the deal with pmf!
pmf is a psp video file format that being used in many games for psp. so many games cut scene and movies are actually stored on the UMD with pmf format and all the game is doing is calling the psp AVC(H264) module to play it. so in case you copy one of those pmf file from your psp UMD to pc then you need a method to convert it to a proper format to be able to watch it.

here is what you need to convert pmf to avi: Read the rest of this entry »

GD Star Rating
loading...
GD Star Rating
loading...

Jul 20

Blocking Hostname in IPB 2.3.x

Here is how to block someone host name in IPb, first open /sources/action_public/register.php

and find this code around line 1881:

if ( is_array( $banfilters['name'] ) and count( $banfilters['name'] ) )
		{
			foreach ( $banfilters['name'] as $n )
			{
				$n = str_replace( '\*', '.*' ,  preg_quote($n, "/") );
 
				if ( $n AND preg_match( "/^{$n}$/i", $in_username ) )
				{
					$form_errors['username'][] = $this->ipsclass->lang['reg_error_username_taken'];
					break;
				}
			}
		}

replace it with this code: Read the rest of this entry »

GD Star Rating
loading...
GD Star Rating
loading...