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.


Summer Hacking

Summer has already started and we (a small group of current and ex-IIITians in Hyderabad) are planning to have some fun digging into Ruby on Rails and related technologies. If you are also interested in utilizing your summer in a productive and fun way, you can join us and share your knowledge while learning from the rest of the members at the same time.

Assuming that all of us know at least one programming language (C/C++/Python), below is the list of things we are planning to learn.

  1. Ruby
    • If you already know a programming language, it’ll not be difficult for you to pick up Ruby.
    • In case you happen to know Python, you’ll feel at home.
    • Spend a good half an hour on Ruby In Twenty Minutes and you’ll know how simple and beautiful Ruby is.
    • Once you are done with Ruby quick-starter, you can try ruby in your browser and have some fun.
    • Please go through Ruby Style Guide to see how to write beautiful and easy to understand Ruby code.
  2. Rails
    • If you have worked with any MVC framework in past, you’ll pickup rails quite easily.
    • If you have worked with Web2py, then go through this Rails vc Web2py presentation which tries to show similarities among both frameworks.
    • RailsGuides is one of best and complete documentation for getting started with Ruby on Rails. It may look like a lot of content to beginners. If that’s the case with you, you can skip the guides in Digging Deeper section.
    • RailsCasts is  like a sea of quality Ruby on Rails screencasts. Watch a few on topics where you may have doubts.
  3. jQuery
    • We’ll be learning jQuery assuming that all of us are already familiar with JavaScript.
    • We’ll learn only basics initially and explore more as we start using it in a Rails project.
  4. CoffeeScript
    • CoffeeScript is a language that compiles to JavaScript but it’s way more beautiful to look at and easier to read and understand.
    • We’ll not write JavaScript code for our Rails app. Instead, we’ll be writing CoffeeScript!
  5. SCSS
    • SCSS is an extension of CSS3. It’s fun to write stylesheets using SCSS as it brings in additional features like variables, nested rules etc.
    • SCSS will ultimately be compiled to CSS.
    • Again, there is not much to do here. Half an hour to familiarize yourself with the syntax and you are ready to roll.
  6. Twitter Bootstrap
    • Bootstrap is a super simple and crazy awesome CSS and JavaScript toolkit developed by twitter.
    • We’ll be using bootstrap to power our Rails apps which we’ll build at a later stage.
    • Nothing much to learn here. It’s more about getting familiar with commonly used classes.
  7. Git and GitHub
    • We’ll be using Git for tracking code while building our apps.
    • We’ll learn about basic Git functions like cloning a repository, committing code, pushing code to a remote repository, working in different branches etc.
    • Go through Git Basics and we can learn more as we start using it full time.
    • We’ll be using GitHub to host all our code. If you don’t have an account already, get one.

We’ll learn these technologies while working regularly at our work places. Once in a while, we’ll meet and share our experiences and knowledge. The plan is to spend one or two weeks to go through basic stuff in all the topics. After that we can start a dummy rails project and learn more as we go.

If you are not in Hyderabad and still want to join, just start exploring and we can connect online! Happy Hacking!!!


TIP: Simple Regular Expression for Email Validation

I was playing around with Ruby on Rails and needed an email field for some application. I thought of validating the email address before actually saving it. Googled for same and got tons of results, but none of them was perfect. Few were somewhat exhaustive but horribly difficult to understand and those which were simple were  not exhaustive enough for practical use. I thought I’ll just write the regex myself and came up with the following. I have tested it for few weird cases like an email hosted on (a subdomain deep down the hierarchy) etc.


I hope it’ll be of help. And don’t forget to pen down your suggestions via comments.