I have soundcloud open in one of my tabs while in the other one I am reading an interesting article. The currently paying track ends and a new one starts and this sucks. I want to skip this and move to the next track. How I wish pressing some key while remaining in the same tab would take me to the next track. Some wishes do come true
and in the past few days I bought this idea to life. I wrote a chrome plugin which exactly does this and some more. Below are the keybindings currently supported:
1. <alt> + k – Jump to the next track.
2. <alt> + j – Jump to the previous track.
3. <alt> + p – Pause the currently playing track or resume the paused track. If no track is playing, play the first track in the page.
4. <alt> + m – If logged in, favorite the currently playing track.
Some improvements which I have in mind:
1. Making the keyboard bindings configurable.
2. Removing jQuery dependency from the code.
Give it a spin and let me know how it works for you.
After taking two Coursera classes(db and algo), I wanted a simpler way to download the lecture assets(video files, pdf, ppt etc) from the site.
The features that I was looking for in the downloader:
1. Bulk download from the command prompt.
2. The downloader should recreate the structure present in the video listings page i.e it should create directories corresponding to each weekly topic and their sub topics and download the files into the appropriate directories.
3. The downloader should be smart as in when it is run each time from the command prompt, it should know the assets previously downloaded and download only the newly updated assets. Speaking in programmer terms, it should diff between all the previous downloads and the assets in the current page and download only the newly added ones.
Hence, my free time during the last few days were dedicated to scripting this. The Python script that I wrote for this can be downloaded from my bitbucket repo. Extract the contents of the zipped file to the directory where you want the assets to be downloaded and run the python script. More info is present in the readme.txt file accompanying the script. The script recreates the structure present in the video listings page and downloads the assets to the appropriate directories.
The image below shows the directories created and some of the files downloaded for automata course.

Compare the above with the course structure present in the video listings page of automata course:

Whenever new lessons are posted, just run the script and the script takes care of downloading the updated contents. It keeps track of already downloaded files and hence only downloads the newly updated contents.
Give it a spin and let me know how it works for you.
Consider the below php code:
$foo = <value from an HTTP param>;
if ($foo) {//make sure this parameter is set
//do your operations
}
You are in for a rude shock if your HTTP parameter has a value 0. PHP evaluates a string 0 as boolean false.
A python script that recursively processes png and jpeg images present in the passed in directory and losslessly compresses them using deflopt, optipng, pngcrush, pngoptimizer and jpegtran. This script assumes that you have these binaries in your windows path. Grab the script from the bitbucket repo.
Example:
python mash.py C:\foo
PS:If this interests you, take a look at the command line client that I wrote for yahoo!’s smush.it service.
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.
#
#HTTPD=/usr/sbin/httpd.worker
#
# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.
#
OPTIONS=-X
#
# 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.
#
#HTTPD_LANG=C
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.
Here is a script to delete all non versioned files
svn status | grep ^? | awk '{print $2;}' | xargs rm
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.
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.
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.