Pygene howto

PyGene is a genetic algorithm framework in Python. It is a very simple framework with support for multiple classes of algorithms. The examples are very straightforward to understand and one can start off with writing implementations very fast. I suggest looking at the file in the distribution. This has a very simple GA implementation to construct a string out of random characters. Even though one can understand from the code, there might be some places where a little more explanation would help.Here is the test client with the appropriate comments (hosted on my site, till I find out how to upload text files on

Travelguru vs. Makemytrip

Makemytrip, travelguru review

The recent rise of both travelguru and makemytrip as the sites for finding the best prices for air travel is rather strange. I say strange because neither of the sites provide for a good user experience. I had to recently travel to Hyderabad on a short notice, and had to book a ticket. Earilier whenever I had to fly, I used to book tickets from the respective airlines’ site. This time I wanted to check the claim that these sites and their advertisements make regarding the cheapest rate available for travel. Makemytrip makes the claim that they will refund twice the amount if their ticket is more expensive than any other site (which btw, happened to me. Of course, I didn’t bother to get the details of how to get the refund amount, so I am not going to write about that). The short of the post – I prefer, Makemytrip over Travelguru. I did get my ticket booked via Makemytrip. Its not to say that Makemytrip is awesome or anything – it just is the lesser of both the evils. Here is a list of gripes I have with both the sites. Considering this list, I am very much tempted to directly use the site of the airline that I fly frequently, rather than relying on these third party websites. Here is the list:

  • makemytrip doesn’t show the time of the flight in the payment tab
  • travelguru shows the same screen twice (for the ticket booking
  • In travelguru, there are lots of aspx errors on refresh
  • travelguru – login status not displayed properly
  • makemytrip should clearly mention that the credit card name etc are required for the completion of payment. Their error messages are useless. It took me a while to find out that *all* the details are needed
  • Why bother with asking the delivery address when you want the passenger to submit a printout of the ticket at the airport. I was flying Air Sahara, and according to the details on Makemytrip, they were supposed to send me the ticket. When the ticket didn’t arrive, and I check with their customer care, they mention that I need to bring the printout of the ticket to the airport; gee thanks
  • Don’t fall for the fare on makemytrip. They conveniently add INR 975 to the ticket after you select the particular flight ! Travelguru atleast is better there – no surprises
  • The killer of all, travelguru doesn’t support HTTPS for credit card number submission
    • The last one needs a special mention. If I change the protocol on the credit card number submission page of travelguru, I am presented with this message Server Error in '/' Application. Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format. Source Error: Line 441: Line 442: 'totalcharges =cdbl( cdbl(charges )*cdbl(totalpassenger)) Line 443: totalcharges = cdbl(charges) Line 444: Line 445: %> Source File: c:\inetpub\wwwroot\asp\display_shop_cart.aspx Line: 443 Stack Trace: [FormatException: Input string was not in a correct format.] Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat) +195 Microsoft.VisualBasic.CompilerServices.DoubleType.FromString(String Value, NumberFormatInfo NumberFormat) +82 [InvalidCastException: Cast from string "" to type 'Double' is not valid.] Microsoft.VisualBasic.CompilerServices.DoubleType.FromString(String Value, NumberFormatInfo NumberFormat) +170 Microsoft.VisualBasic.CompilerServices.DoubleType.FromObject(Object Value, NumberFormatInfo NumberFormat) +728 Microsoft.VisualBasic.CompilerServices.DoubleType.FromObject(Object Value) +7 ASP.payment_details_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in c:\inetpub\wwwroot\asp\display_shop_cart.aspx:443 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +241 System.Web.UI.Page.ProcessRequestMain() +1909
      Hmm..lets see, you are using ASPX, and the backend was written in VB.Net. And where on earth was a cast from string to double happening ? And whatever happened to exception handling ? And equally better DoubleType.FromString ! Wow, isn’t that great. The good folks who have created the engine and the UI controls should consider having some exception handling to be in place for the code. And the beauty of this all, this happened when I changed the protocol from http to https in the credit card number submission page. Nowhere in the user login, nor the flight selection page was https used. I definitely don’t appreciate anyone passing my credit cardnumber in the clear – no thanks. That was the only reason I prefered makemytrip. I think both these sites should concentrate on improving the user experience rather than having imbecile ads with people gloating over the price others pay for their tickets.

Windows2003 locked during shutdown

On Windows 2003, what happens when you try to shutdown, and the explorer.exe is trying to terminate a (say) a runaway process ? Windows will show you the Ending Process….window and after a bunch of futile attempts, will display the dialog, do you wish to end the process now. Now, what if you have the screensaver turned for 5 minutes, with the option to lock the machine after that timeout, and leave the computer idle at this screen ? Well, anybody’s guess will be that the machine will be locked. Which is right too. But what happens after that is what surprised me. You are not allowed to login. Even if the machine locked window is displayed, the text entry fields are not editable. So, you can’t login and continue the shutdown process, nor will the shutdown continue because the machine is locked. A deadlock between Windows’ processes. Any ideas how one can get around this ? I tried this on a Windows2003 machine. I am not sure how this will behave on a Windows 2000 machine. But, worth a try I guess.

Another thing to check for is, will the machine respond to TCP/UDP requests at this point. I didn’t have another machine at the time from where I could try this. The idea being to check if the kernel has closed the network connections and is actively refusing network connections. If not, then I think this situation is the best one to actively exploit the machine. Of course, this is not a major exploit or anything, given the timing needed to run your exploit only when the machine is locked during shutdown and before the admin decides to hit the power button. Surprisingly a google query didn’t yield any useful results.

Alternate fuel gold rush

Looks like the developed world is now in a gold rush behind organic fuels. The ethanol gold rush as an alternate fuel seems to be on the rise. The increase in the number of distillers that are to produce Ethanol seems to be on the rise in the United States. This, keeping aside the critics’ arguments (which I think shouldn’t be many), is a good thing for the environment. The adoption of ethanol as an alternate fuel will reduce the reliance of many a country on fossil fuels, and thereby reduce their contribution to the greenhouse effect. As I wrote earlier, , what needs to be seen is if India is going to take up the cause of alternate fuels. I think there is enough interest atleast in the academia about alternate fuels. I was interacting with a college student (may be in the final year of his BTech) in Bangalore, who mentioned to me his work on bio-diesel. Apparently, he and his professor were able to create a variant of bio-diesel, that can be used in the traditional engines, without any change to the engine. He also mentioned that his version of diesel would cost around 20 INR per litre. The fuel economy rate would be the same as the fossil fuel it seems. I definitely was impressed at the claim. Even if the percentages move to the higher side due to mass production, I still think it is a viable option to consider. After the telecommunication boom that seems to have the country in grip, I think, it will be the fuel sector. But what needs to be seen is if indeed the traditional fuel lobby will let entrepreneurial firms in this new sector to survive.