Wednesday, 28 October 2015

Reopen all your old tabs after restarting chrome

If you just closed a tab in Chrome, you can re-open it using Ctl+Shift+T
And if you just closed the Chrome window and restarted it, you can re-open all the old tabs using the same Ctl+Shift+T

Saturday, 1 August 2015

Get Apache Spark running without hadoop

Summary: If you want to play around with spark without messing with a hadoop installation/cluster etc, download a spark package which is built with a version of hadoop - so pick packages like "Pre-built for Hadoop 2.6 and later", not the one which says "Pre-built with user provided Hadoop...".

Details
I downloaded Apache Spark from here, unzipped and tried to run it like so:
.\bin\spark-shell --master local
And here's what I got (edited exception):
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FSDataInputStream
...
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FSDataInputStream        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
...

Googling gave me suggestions like installing hadoop - and I was pretty sure that I should be able to run spark without the whole hadoop infrastructure. Finally realised that I had downloaded "spark without hadoop" and that works only if you point it to a hadoop installation that you already have. The reason is that though spark doesn't need a hadoop cluster to work, it does need some hadoop libraries (which is what the ClassLoader is complaining about in the stack trace above).
So I downloaded a spark distribution with hadoop and voila!


Thursday, 11 June 2015

Using lighttpd on Windows to host your own webserver

Lighttpd is a quick to setup web server which works on windows as well.
Download, install, setup a small conf file and ready to go.

Get sample conf file from here

one thing to remember on windows the paths are written like this:

server.document-root = "d:/some/windows/path/"
Else you get something like this error when you try to validate the config file:

(configfile.c.960) source: lighttpd.conf line: 1 pos: 137 parser failed somehow near here

WIndows: Finding out what's listening on a port

use netstat -a | find "LISTENING"

or
use TCPView by www.sysinternals.com from here

Friday, 6 February 2015

Windows: List only file names of a certain kind in a directory and its subdirectories.

dir /B /S *.sln

/S – search subdirectories as well
/B – bare – don’t display header information – this will give just the filename with the path so that you can use it for scripts.