Passing arguments to a script started through Ubuntu Upstart

Writing by on Thursday, 9 of October , 2014 at 5:54 pm

If you’re trying to use the –exec option and need to pass in arguments, then you would need to use — to let –exec know that these are arguments to the script that needs to be executed.

# No arguments passed to test.py
exec start-stop-daemon –start –exec python test.py

# Arguments (-i $PARAM) passed to test.py
exec start-stop-daemon –start –exec python test.py — -i $PARAM

Leave a comment

Category: Linux,Python

Find out modules installed by pip

Writing by on Wednesday, 1 of October , 2014 at 3:52 am

We have a bunch of Python (2.7) virtual environments and I needed a way to figure out a way to list modules installed by pip within the context of that venv and then grep for a particular one. I’m not a super Python expert at this time, but wrote up a small script to list this.

Here’s a python script:

# pip_installed_modules.py 
import pip

def main():
	modules = pip.get_installed_distributions()
	for m in modules:
		print m


if __name__ == "__main__":
    main()

Here’s my alias:

alias pipmodules=’python ~/bin/pip_installed_modules.py’

Now I can simply grep for specific modules or just see the installed modules.

Leave a comment

Category: Python

Permission denied error for logged in user for Apache Pig

Writing by on Thursday, 25 of September , 2014 at 2:37 pm

When I was starting pig using pig -x local, I was getting the following error.

Exception in thread “main” java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1006)
at java.io.File.createTempFile(File.java:1989)
at org.apache.hadoop.util.RunJar.main(RunJar.java:119)

Luckily after some searching stackoverflow had the the solution which was that ${hadoop.tmp.dir} didn’t have permissions.

I was trying to run pig as a different user, than the hadoop user.

sudo chown -R user:group /app/hadoop/tmp

Leave a comment

Category: Hadoop,Pig

Virtual Box Running Ubuntu

Writing by on Friday, 19 of September , 2014 at 3:54 pm

While using VirtualBox running a Ubuntu Image, I found some helpful topics to:

Leave a comment

Category: Linux

Emulate Middle Mouse Button on Windows 7 with Synaptics Touchpad Drivers

Writing by on Saturday, 13 of September , 2014 at 6:30 pm

Even after installing multiple version of the Synaptics Touchpad Drivers I wasn’t able to emulate the Middle Mouse Button by pressing Left/Right Buttons on my HP Laptop’s Touchpad and finally after some searching on the web I found a solution from sinairv. Note: You will have to mess with “regedit”.

# Open up regedit for changes to Windows Registry
Step 1: Start –> Run –> regedit

# Look for where you need to make the changes
Step 2: Edit –> Find –> 2FingerTapAction

# For me the path was
# HKEY_CURRENT_USER\Software\Synaptics\SynTP\TouchpadPS2_2
Step 3: Notice that there are several Mouse actions

# Create a new entry to add
Step 4: Right Click –> New –> DWORD

# New value HasBothButtonFeature = 1
Step 5: Enter HasBothButtonFeature with value 1

# Let changes take effect
Step 6: Log off and Log in

# Test emulation of middle click
Step 7: Open a browser and a new tab and press both buttons to close the tab

That should make your browsing experience a bit faster now.

Leave a comment

Category: Tips and Tricks

Passed the CCDH Exam CCD-410 Cloudera Certified Developer for Apache Hadoop

Writing by on Tuesday, 5 of August , 2014 at 4:53 am

So today I passed the Cloudera Certified Developer for Apache Hadoop (CCDH) Exam in my first attempt! YAY! If you’re curious, here’s my certificate and here’s the verification link.

For sure, it is NOT a trivial exam to pass without studying and requires at least a few weeks of preparation/practice.

Recommended Study Material in the order that worked for me:

  • Mock/Practice Tests : You will know what types of problems to expect
  • Hadoop Videos on YouTube! : Gives you a head start if you’re new or need a refresher
  • Hadoop In Action by Chuck Lam : Very interesting/stimulating read, though its based on the old API
  • Hadoop : The Definitive Guide by Tom White : Comprehensive and gives you an understanding of Hadoop in theory (not a fast read)
  • Hadoop in Practice by Alex Holmes : A little more advanced (I didn’t have time to read more than the first few chapters)

I felt the programming questions on my test were pretty hard and time consuming and I had only about 10 minutes left at the end. Problem for me was that, you are graded for 50 questions, but you need to answer 55 questions because you don’t know which ones are those 5 experimental (beta) ones and you have to solve them regardless.

So, how much should you prepare to pass the CCDH? I was always curiously interested in Hadoop and knew the general concepts already, but the CCDH really tests your fluency in all the areas listed on the Study Guide. So a good 3-4 weeks (few hours after work) did it for me. In a typical work environment, you have Google or several other sources to refer to or try out and of course in the comfort of your IDE, but this is a test and all of it needs to be in your head! Nevertheless, it was a good experience and I really learned a lot from the preparation and in the end I’m glad I passed it.

I would definitely recommend shelling out the $295, because that will really force you to prepare seriously. Good Luck!

Leave a comment

Category: Hadoop

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.