Catching up!

A lot has changed since the last blog post (more than three years). I was happily running a successful business around Videocache till Google decided to push HTTPS really hard and enforced SSL even for video content. That rendered Videocache completely useless as YouTube video caching was the unique selling point. Though people are still using it for other websites (whatever supported and not HTTPS yet), I personally didn’t find it good enough for selling. To add to the trouble, Mozilla and friends announced that there will be free certs for everyone. Now, that took away whatever motivation was left to keep working on Videocache. I decided to open source Videocache and the source is now available on GitHub. If you have better ideas or you are looking forward to make things work by forging certs etc, fork it and give it a shot.

After all that mess with Videocache, I am left with a contract job which is not working out well. So, the learning hat is back and I am trying to catch up with the tech world. I didn’t really want to get into the whole JavaScript framework mess because there is no clear winner and there are too many of them but it looks rather unavoidable or Unflushable (if you remember Jeff from Coupling). I have been trying to make simple apps with Angularjs. There is little documentation and you have to dig really deep at times but still you can make things work if you persist. Once you spend some quality time with it, you may actually start liking Angularjs. So, I did give it some time and implemented angular fronted for Pixomatix-Api (another learning project I am working on) and I think I sort of like it now.

In 2015, if you are web developer, you must know how APIs work and you should be able to consume them. So, to learn to expose APIs and version them properly, I fired a small project Pixomatix. Being a Rails developer, you really get obsessed with it and try to implement everything using Rails. Even when you want an API with 2-3 endpoints, you tend to make the horrible mistake of doing it in Rails. This kept bugging me and a few weeks later, I decided to freshen up my Sinatra memories. But working with Sinatra is not all that easy especially if you are used to all the niceties of Rails. Dug up my attempt of implementing Videocache in Ruby, and extracted few tasks and configurations I had automated long time ago. Ended up working a lot more on it and packages into a template app with almost all the essential stuff. Though I need to document it a little more, the app has got everything needed to expose a versioned API via Sinatra.

On the other hand, I tried to use devise gem to authentication for Pixomatix. It was all good for integration with standard web apps and APIs but it sort of failed me when I tried to make the API versioned. Devise turned out to be black-hole when I tried to dig deeper to make things work. I tried a few other gems which supported token authentication but they were also no good for versioning. Generally, you may not need to version the authentication part of your API, but what if you do! Since, this was just a learning exercise, I was hell bent on implementing this. So, I just reinvented the wheel and coded basic authentication (including token authentication) for the API.

That’s it for this post. I am looking forward to post regularly on the new stuff I learn.


Getting Started With Git

I have been using Git for years now and I am still a novice user. Actually, if you are an individual developer or work in a really small team, you don’t really need to go beyond using the basic stuff like cloning a repo, committing code, branching and pushing back to the origin repo. And that’s exactly what happened with me. Working alone most of the times and working in my own repos. I never felt the need to explore advanced usage.

Last week, we didn’t have internet at home for like four days. So, I thought I’ll read a book. I downloaded ProGit : The Free Git Book and started reading. It’s an awesomely written book. I learned a lot of new things about Git. A few more concept about using branches efficiently. If you are a Git beginner or looking forward to getting started with Git and you don’t like reading too much, I’ll suggest that you read at least first three chapters thoroughly. That along with a free GitHub account should be enough to get you going if you are not going to be a heavy Git user soon.


News : Memepress (Yahoo! Meme) WordPress Plugin Version 0.3 is available

Memepress is a wordpress plugin which provides wordpress widgets for displaying public posts from Yahoo! Meme. Memepress is SEO ready and provides options to noindex/nofollow your Meme posts. New version fixes a few bugs and provides enhanced style control for the widget.

You can download memepress version 0.3 from wordpress plugin page.

For details on usage/installation instructions, please check plugin homepage.


Memepress Ready to be Translated (Supports Turkish now)

Thanks for an awesome response to the Memepress (Yahoo! Meme) WordPress plugin. A lot of people have blogged about it and contacted me via email for enhancements. New version also fixes the bug regarding image size in posts. I have also updated the plugin to support internationalization(i18n). Now you can translate about 20 strings in your local language and you’ll have Memepress in your own language.

Turkish Translation

Huge thanks to Yalçın Erdemir for translating the plugin to Turkish 🙂

How To Translate

If you are interested in translating Memepress plugin in your language, then download the memepress.pot (POT file) and open it in your favourite text editor. Now for every string against msgid should be translated to your language and populated in quotes against msgstr. See the example below.

Before translation

#: memepress.php:37
msgid "Title"
msgstr ""

After translation

#: memepress.php:37
msgid "Title"

Once you are done with translating all the strings, save the file and mail me at kulbirsaini25 [AT] .


How To: Install and Use Twython (Python Wrapper for Twitter API)

As promised in my previous post, here is a brief howto on getting started with twython. The main advantage of Twython over several other python (or any other language) wrappers for Twitter API is that it works even when you are behind your organizations proxy.

Download Twython

You can download latest version of twython from twython page on github. You can either clone using git (if you have git installed) or can click the download button.

Install Twython

Once you are done with extracting the downloaded tar file. Change directory to twython and run these command as root.

[root@fedora ~]$ git clone git://
[root@fedora ~]$ cd twython/dist
[root@fedora dist]$ tar -xvzf twython-0.8.tar.gz
[root@fedora dist]$ cd twython-0.8/
[root@fedora dist]$ python build
[root@fedora dist]$ python install

Use Twython from Python Interpreter

Below is a direct copy paste lines from my interpreter. See how things are working (learning by doing).

[saini@bordeaux ~]$ python
Python 2.6 (r26:66714, Mar 17 2009, 11:44:21) 
[GCC 4.4.0 20090313 (Red Hat 4.4.0-0.26)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> # first of all, import twython module
>>> import twython
>>> # Authenticate your twitter account with your twitter username
... # and password with twitter.setup method.
>>> client = twython.setup('Basic','myusername','mypassword')
>>> client.authenticated
>>> #Lets update our current status on twitter with some cool message.
>>> client.updateStatus('Testing #twython. The coolest #TwitterAPI :)')
>>> # Now go and check your current status on twitter. Surprised!!!
>>> # Get your or anyone's followers
>>> client.getFollowersIDs(screen_name='gofedora')
>>> # Output truncated.
>>> # Get help for any function.
>>> print client.createFriendship.__doc__
createFriendship(id = None, user_id = None, screen_name = None, follow = "false")
	Allows the authenticating users to follow the user specified in the ID parameter.
	Returns the befriended user in the requested format when successful. Returns a
	string describing the failure condition when unsuccessful. If you are already
	friends with the user an HTTP 403 will be returned.
		** Note: One of the following is required. (id, user_id, screen_name)
		id - Required. The ID or screen name of the user to befriend.
		user_id - Required. Specfies the ID of the user to befriend. Helpful for disambiguating when a valid user ID is also a valid screen name. 
		screen_name - Required. Specfies the screen name of the user to befriend. Helpful for disambiguating when a valid screen name is also a user ID. 
		follow - Optional. Enable notifications for the target user in addition to becoming friends. 

So now you are ready to do wonders with twython. Write your own code and blog/brag about it 🙂