<![CDATA[./MyRants - Home]]>Sat, 28 Nov 2015 08:59:51 -0800Weebly<![CDATA[Generate GUIDs ]]>Mon, 28 Apr 2014 03:39:00 GMThttp://raahulram.weebly.com/home/generate-guidsBy far the easiest way to generate Guids online is to simply call
1000 is a parameter. You could use as much as you want. Feel free to test the upper limit.
<![CDATA[Git Undo Last Commit ]]>Fri, 06 Dec 2013 08:47:30 GMThttp://raahulram.weebly.com/home/git-undo-last-commitIts 3:43 am in the morning and you have accidentally committed a lot more than you should. Being a victim of git stash ... more on that later. So How do I undo it 

$rahul@g3ck0:~/programs/Remodel$ git reflog
924fa76 HEAD@{0}: commit: added reflect type
adf2098 HEAD@{1}: commit: fixed topsort with respect to return sets
10f7e63 HEAD@{2}: commit: updated config_parse function to handle whitespace etc
d6044b5 HEAD@{3}: commit: added gobject store/load functions
6c7a3a5 HEAD@{4}: commit: adding store.go. Generic functions to storing various 

I had added reflect type which I dont want to be pushed to my master branch. All I need to do is 

rahul@g3ck0:~/programs/Remodel$ git reset --hard adf2098
HEAD is now at adf2098 fixed topsort with respect to return sets
rahul@g3ck0:~/programs/Remodel$ git status
# On branch master
nothing to commit (working directory clean)

<![CDATA[Generic Function for Go Encoded Object Store]]>Thu, 05 Dec 2013 08:13:18 GMThttp://raahulram.weebly.com/home/generic-function-for-go-encoded-object-store Golang is an interesting programming language. Apart from all the hype it gets due to Google backing it up, I personally feel comfortable using it instead of Scala. Srry I digress, Its just that Scala is annoying me a lot lately... (more on that later). 

So, Go-nuts guys came up with Gob (not to be confused with GObjects of GNOME) way to store data. I usually use JSON for marshaling and un-marshaling my content and have my data in JSON format. But Golang is a real pain if you need to work on json data, especially to the people who come from utopia of Python. So I decided to use Go encoded objects instead.  The following snippet will encode any type of object. 
The following snippet will decode anytype of object. Thats all. All I need to know is what type of object is I am encoding or decoding , else you will get runtime errors on decoding it. 
Its as simple as that!
<![CDATA[Flask 400 Error (Bad Post Request)]]>Fri, 25 Oct 2013 00:17:17 GMThttp://raahulram.weebly.com/home/flask-400-error-bad-post-request In case you are wondering the form post data is not being processed by server side in Flask framework, then you are definitely in the right place. Sadly, its very subtle in the flask documentation and I wasted considerable amount of time for such a trivial issue. 
Server side Flask Code is :
Simple form submission was giving me 400 Bad request and much to my chagrin, I see a simple curl call giving me the desired result .. . .
So what went wrong ?  apparently I had forgotten to set input name for my form elements and Flask uses input name instead of id which I feel is kinda weird.. anyways.. that solved the problem for me. Hope fully no more surprises in flask.
<![CDATA[Nodejs ( Express V/s Hapi) choose your poison]]>Wed, 09 Oct 2013 06:27:04 GMThttp://raahulram.weebly.com/home/nodejs-express-vs-hapi-choose-your-poison Its 2:16 am in the morning and thanks to ExpressJS to keep me awake for such a long time. So what went wrong ? I happen to install ExpressJS version 3.X and boom! and most of my code breaks.. awesome. Like, the amount of espresso I had dint suffice so ExpressJs wanted to challenge me further. Thank you guys.... x-( 

Backwards compatability is something I seek the most and thanks to you ExpressJS guys to spectaculary break that and the newer website design sucks! for love of god, its not a lingerie site. Please keep it as simple as possible. There are cogent reasons why simple text still rules (content ? duh ...) . 

Anyways I application I wanted to build was just simple POST/GET handlers with a few things. But with basic support for route handling etc. So I again scouted for frameworks and finally found something simple to use (hapijs yay ..!) . But here is the problem . I need to keep digging through their github repo all the time to see the function calls and parameters they have choosen to implement them WTf! 

Static file handling is something trivial and again for love of god guys please document it properly else it gets really hard to use it. This is the following code 
And thats how you use the handler json for directory and file. Seems trivial now ... :)
<![CDATA[Suits Season 3 (spoiler alert !)]]>Wed, 17 Jul 2013 17:17:56 GMThttp://raahulram.weebly.com/home/suits-season-3-spoiler-alertFinally saw suits season 3 episode I. Damn, I have waited for such a loooong time. This is the only episode probably after 'prison break' that has got me addicted to it.  I just hope, harvey specter sets his record straight with the case he is got. On the other hand, its nice to see characters from Games of Thrones showing up. Varys and Catelyn stark take the episode to whole new level. Adding cherry on top of it, Harvey`s mentor is back and this time he is on the other side. More importantly, Mark finds out something about Jessica which seems a decent leverage, in case Jessica sandbags him. Whuff.. there are soo many events to unfold. Only time (obviously the editor knows the story...) can tell how this goes! ]]><![CDATA[My experience with OpenMP  - I]]>Sun, 14 Jul 2013 07:45:21 GMThttp://raahulram.weebly.com/home/my-experience-with-openmp-i This is the first series of my expereince with openmp. Its been such a long time since I have used openMp (college days .. !) Now when I look at those programs everything looks alien to me. Not that I commented my code ;) But I have just lost touch with it. Time to freshen things up.

I intend to write these in series to help other programmers like me. Also eventually I would like to wrap most of my programs with Python so you can completely avoid issues of GIL and use OpenMP.

So what is OpenMP ?
http://en.wikipedia.org/wiki/OpenMP   (Read this, very helpfull )

The following is a very simple snippet on how to use OpenMP. Anything you need to parallelize goes under #pragma omp parallel. Thats it! 
Shared Memory Programming using OpenMp. This video is very informative.
Next, I will try to wrap this with Python programs and lets see how that goes...
<![CDATA[Is Ambient Noise conducive for creative cognition ?]]>Thu, 04 Jul 2013 19:33:49 GMThttp://raahulram.weebly.com/home/is-ambient-noise-conducive-for-creative-cognitionRecently I happen to see the most visited websites listed by Times. And a site named Coffitivity.com  caught my eye. First thought that comes to my mind is, are they sharing some tips on how to prepare your coffee so that you are super productive ? or how will you consume it to become one. Anyways, when I happen to enter the site, it totally awestruck me... Why ? 

It is a site which generates Ambient Noise . Wait a sec , What the hell is that ? Basically its the noise at the background. The very same irritating noise , when you are seriously coding in plane and your fellow passengers are joking on some crappy stuff. The very same commotion in the background your colleagues in your firm make in the name of stand-up discussions. On further checking the site, I found their whole concept was based on a research paper posted in here. It basically claims that a medium (50 db) ambient noise can actually enhance your creativity and will be conducive for buying innovating products. I have no freaking idea on how they came into that conclusion. 

But, this strikes a wonderful thought in my mind and i.e when we are working (assuming to be typical work guy) , are we concerned about how creative we are or how productive we are ? Everyday I clock into my office cubicle and list out the various tasks I need to accomplish by EOD and try to finish them in smartest and fastest way and by that I mean, with minimal effort and maximum results. The only way I can achieve that , is to be in the best comfortable environment I can be in( which by no means tolerates noise). And for me it is my music being played at background. Sometimes, when I m totally into something, I don't even realize, which soundtrack is being played. In such circumstances will surrounding myself with Ambient Noise help me ? I highly doubt that. ]]>
<![CDATA[Suits == MusicLesson]]>Sun, 30 Jun 2013 19:34:24 GMThttp://raahulram.weebly.com/home/suits-musiclesson
Today I finally happened to watch Season 2 finale of suits.. and Boy/Girl! it will just throw you off. Finally Harvey Specters love life is kicking off and Mike`s secret is been gorged out to Rachel. And No! I am not apologizing for spoiler alert :P 

But that just aint it. The finale episode has some excellent soundtracks, which I just cant stop listening to over and over and over again. Suits is one of those classic serials where you get to listen some amazing not-so-popular sound tracks.
The Sunset song by XX is heaven to my ears. Just amazing...  Also, Breaking The Silence by Midnight Flowers. I just to listen to a couple of songs of this band before , but never happened to listen this. 
I ll keep adding more songs from Suits as and when I find.
<![CDATA[Revisiting C++ (Boost ASIO) ]]>Tue, 18 Jun 2013 15:44:34 GMThttp://raahulram.weebly.com/home/revisiting-c-boost-asio Finally I realized the importance of blogging. (Yeah... I m a tubelight, but Hey .. tubelight is brighter than a bulb). So how come such a late realization ? After such a long time , I encountered my old friend C++, yeah and was a very nasty encounter. 

Well if you have read dilbert comic strips, you would definitely realized by now, that if you dont work on a particular programming language for more than 6 months, then you are as amateur as a school grad. Actually school grads will perform better. Anyways, the problem I came across was I needed to refactor, rather fix some part of the program which was initially written in a very sequential manner and needed to be scaled. After much hype of nodejs and similar frameworks on Async programming, I thought why not try  Boost ASIO. Mind you this is not for the feint heart.  

So here is what I do.  Here is an excellent ppt . It relatively easier if you have prior background on Async programming.  Time to test some sample programs in it. 

It compiles and executes. You will see that statement after 5 seconds. So, whats the BIG DEAL ?By calling the method async_wait() and passing the name of the handler()function as the single argument, you have actually initiated a asynchronous operation. As of now, the name of the function is passed on async_wait and function call is not yet made.  As soon as the time goes off(5 seconds in this case), the function is then executed.

The run() in io_service ensures the main program doest terminate, thus giving back control to OS. Also, you can create mutiple handlers for the same io_service or can mutiplex it ( more on that later..)