Sendmail for PHP in Bitnami with Amazon AWS

This is quite tricky but that’s how I go about it:

    • Install sendmail:
      sudo apt-get install sendmail
    • Uncomment the following line in your /opt/bitnami/php/etc/php.ini file to enable sendmail via php:
      sendmail_path = “env -i /usr/sbin/sendmail -t -i”
    • Restart Apache:
      sudo /opt/bitnami/ restart apache
    • Restart php-fpm:
      /opt/bitnami/ restart php-fpm
    • To enable sendmail to use STARTTLS, you need to add this line to /etc/mail/ and optionally to /etc/mail/
    • Add DH parametes:
      openssl dhparam -out /etc/mail/tls/sendmail-common.prm -2 1024
    • Run with sudo user:
      sudo sendmailconfig
    • Reload mail:
      service sendmail reload

    Now send a mail with PHP and see if there is any error in /var/log/mail.log
    The email is sent successfully if you see Stat=sent there.

    Additionally, you can sent a test email directly from the command line:
    echo "Subject: sendmail test" | sendmail -v

    If you don’t have MX record in your DNS then you may create one for your domain name as well.

Guild Wars 2 API Python Wrapper

I have recently finished writing a Python wrapper for Guild Wars 2 API. This wrapper fully implements all the endpoints specified by version 2 of the API. It also provides fully parallel implementation, which allows the developer to create a list of requests and get the results asynchronously. The parallel pool is fully customisable with the number of threads and a timeout.
A simple example of how the wrapper works is given below:

The above function creates a list of requests (req=[]) and calls the gw2api wrapper to add a requests to the list based on the given parameters. The parameters are similar to the example given in the wiki page of Guild Wars 2 API ( The wrapper then fetch all the request in a parallel pool of 5 threads with a given timeout. The results would look like:
python test_continent results
Try this wrapper at and feel free to leave comments here or ask questions.

UPDATE: The wrapper is now available through the official Guild Wars 2 wiki at:

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!

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:

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:

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

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):


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:


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

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

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:

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

Any question or comments is welcome.

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:


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:



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 ^_^

Edit Final Fantasy VII – Crisis Core Savegame


Lately, I was playing this awesome game on PSP, and after about 100 hours of playing missions I faced Minerva, the goddess of earth. 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 😀 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 a homebrew plugin*)
  2. SaveGame Deemer v1.1 from here
  3. Hex editor (any hex editor is fine!)

Now that you have all the preparation 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 0x00002964 to 0x00002967
    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.
    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. Now 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 gives 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!

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: Continue reading

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:

replace it with this code: Continue reading