Apache as a service and config parameters

If you are using apache as a service, the file to put httpd start up switches is in /etc/sysconfig/httpd. For example, if you want to run apache in a single process mode for debugging, then your sysconfig/httpd file would look like this

# Configuration file for the httpd service.

# The default processing model (MPM) is the process-based
# 'prefork' model. A thread-based model, 'worker', is also
# available, but does not work with some modules (such as PHP).
# The service must be stopped before changing this variable.

# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.

# By default, the httpd process is started in the C locale; to
# change the locale in which the server runs, the HTTPD_LANG
# variable can be set.

Ps:This was done on a cent os box.



Recently in office a mail was circulated saying that some methods in php are faster than their equivalent, for example isset/array_key_exists is much faster than in_array and array_search. I distilled this into a script, which parses all out going svn changes and checks whether some(in_array, array_search, array_merge) methods are present in the out going changes and if it finds them, prints the file names where these methods are present. The best place to run this script is from the root of your repo as it will check you entire repo for out going changes and warn you about the suspect methods. You can check out the script here.

Deleting all non versioned files

Here is a script to delete all non versioned files

svn status | grep ^? | awk '{print $2;}' | xargs rm

The Three Musketeers, Super 8 and The Last Air Bender

The Three Musketeers follows the tale of the three musketeers(who else ;)) as they try to save the young queen of France from a diabolical back stabbing cardinal and his sexy hot female double agent assassin played by Mila Jovoich(throughout the movie I kept thinking it was Liv Taylor). The story has all the usual elements of a cocky action pot boiler, disgruntled men who have lost their honor in the last mission, a hot female back stabbing assassin, an over confident young boy and his romance with the queen’s assistant, inane humor, a lot of swash buckling sword fights, flying contraptions, gigantic explosions, phew I am done :). I did not repent the money I spent on the movie and if you are into action movies you too will not.

I had big expectations from Super 8, but I found it to be super boring. I guess the intermingling of kids and an alien was supposed to make the movie unique, but I felt it did not save it from the dull boring plot. The initial train accident was awesome, simply realistic and excellent. Apart from that, I did not find anything special in the movie, except for the part along with the credits, where the short film made by the kids is showcased. That was the only saving grace.

The Last Air Bender, I watched it on tv, it was plying in HBO late Sunday night. I like the concept behind the movie, but the movie was super crappy. Maybe I will try to catch the animated series, as I am sort of taken by the bending concept. The kid’s acting in the movie borders on terrible, the action is bad, 90’s Indo Overseas movies had better Kung Fu sequences. I do not know what Shymalan was thinking while making the movie. The movie ends with a huge opening for a sequel, but I highly doubt it ever coming out due to the drubbing received by this one at the audience’s hands.

Perils of static initilization

1. If things go wrong, you get a cryptic exception in initializer(or something similar, I do not remember exactly) exception which does not give away much.
2. Prevents the class from being loaded, which prevents other classes which rely on this from being loaded, leading to a chain effect.

Take the example below:

class Foo {
  private static int bar = Moo.intValue(); 

class Moo {
  public static int intValue() {
    //parses data from an xml and returns it

In the above, due to some reason let us assume that the xml is not present and this gets thrown as a run time exception from intValue. If this happens, it prevents the Foo class from being loaded by the JVM. If this code is running within a server and the server init code accesses this class, then the whole app is prevented from being loaded due to this. So, before using static initialization that depends on some other class, make sure you have assessed the possibility of your class not being loaded and how it affects your app.

Girls by Nick Kelman

After reading a couple of non fiction books, I wanted a book that was easy to read and I picked up Girls by Nick Kelman. It for sure did not meet my criteria of an easy to read fiction book, but I did not like the book in general. I felt it was just pornography packaged in a sophisticated manner with some trivia and classic literature thrown in.

The story basically follows the pursuits of men and their twisted world of sex especially of the Lolita kind, power, lust, greed etc etc. It has graphic descriptions of sex in all forms, threesomes, blow jobs, analingus, cunnilingus, etc etc. Maybe I am too much of a commoner to “APPRECIATE” the book, but I was not able to figure out the connections between the random facts thrown in like the origin of the word Cunt and it’s relation to the flow of the story. It was like the author had a couple of random sex related trivia and he just picked up some page number from a lot to put it in. Also, the story shifts randomly between different protagonists of which I was not able to keep track of. I was not able to decipher the relation to the story of the Greek literature thrown in in almost every two pages other than that, in most of the cases, both of them talked about men and their pursuit of primal pleasures. I felt the book is an excuse for people to relish pornography and not feel guilty about it, as it gives them the illusion of reading some fine classic literature.

Real Steel

There are some movies whose trailer’s make you look forward to their release and for me “Real Steel” was one of them. I have been bitten badly by this in the past in case of movies like “The Priest” or “Ultraviolet”, but who can resist the story of bots grinding against each other :)? So, we watched the movie last Friday night and I loved every bit of it.

The story happens in the not so distant future where the world of boxing has seen a belly up by the introduction of fighting bots which have made the humans obsolete in this sport. Hugh Jackman plays the role of the disgruntled boxing giant who has lost it all in his life, his career, his girl friend, kid etc and is neck deep in debt. Fate puts his son with him for a few weeks on his bot boxing road trips and the rest of the story is about how the father son duo stage a come back in the bot boxing arena.

Apart from the geeky bot boxing scenes, other enjoyable aspects of the movie are the father son bonding shots, their friendly banter, the camaraderie between the kid and his bot Atom. All in all a good enjoyable watch especially if you are smitten by robots like me :).