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:

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

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