Coffee Coder

Shubham Jain's Weblog

Why Desktop Apps Still Make Sense

| Comments

So you think desktop apps will die a slow death? The sentiment of demise of desktop apps has been professed by many people, Jeff Atwood, Patrick McKenzie to name a few. With colossal jump in our web technologies, both performance and capability wise, something that couldn’t have been possible few years back, the idea is getting even more traction. When you see demos like this, you are tempted to think if web browsers would be able to address the performance issue, what would withhold for web to be used for everything from games to essential business software?

So why do I think desktop apps still make sense?

  • Passiveness of income: While it may be true, web apps fare great when it comes to potential revenue, cross-platform comparability, and reach, it is indispensable to avoid working actively on it. Have you ever heard of someone who was pulling off revenue his age old SaSS app without putting in any work? On the other side, I still get sales from one of my stupid script that I made a long time ago and never even marketed. May be a generalized scenario; it might be possible someone earns a passive income from his web app without adding anything but it is hard to think that the developer can avoid tasks like marketing, server monitoring, dealing with quirky consumer issues, or scaling.

Stop Using Captchas That Can Be Broken With Two Lines of Code

| Comments

The de-facto bot prevention technique sprawls everywhere on the web but I am surprised how people overestimate the difficulty of breaking a captcha. Here are some of them which I encountered.

It won’t take rocket science to convert them to text. In fact, the only two free tools needed for this purpose are: tesseract and Imagemagick.

Convert command
convert captcha.jpg -threshold 5% a.jpg

Adjust the threshold value to get a binary image with no noise.

tesseract -l eng a.jpg text

This will create a “text.txt” file with the captcha text in it.

I ran a test on effectiveness of these commands and the success rate was nearly 9 / 10, clearly implying how weak or better say, made-from-scratch captcha implementations are as good as having none at all.

Making Earphone Presses Useful With PyAudio and VLC HTTP API

| Comments

Note: I am not an audio expert or even close to one. This post may pose amateur attempts to do something very trivial. Link to the Github repository.

Ever had one of those moments, when you are super excited about accomplishing a challenge, having put something useful on the table, only to realize it is not even close to the greatness you imagined; to be bitter, futile? This weekend I build something to detect earphone button presses and control VLC media player with it but it was not so useful afterall.

Earphone Presses

"Samsung Earphones"

(Link to original image)

I own a pair of Samsung earphones, intrigued how the buttons used to switch / pause tracks in smartphones work, I plugged in the pieces in my combo jack, used audacity, pressed a button and the result was:

Wave form for button press

“Great! Awesome find!” exclaimed my mind. So how can we make this into something useful?

Reading MP3 ID3 Tags in Native PHP

| Comments

This week I went crazy about file formats. I tried to understand specifications of many popular formats like MP3, FLV, PDF. Its amazing to see that no matter how complex these technologies are or the algorithms they use to store media efficiently, at the lower level it is just a clever arrangement of bits that makes sense and with a bit of experimentation and hacking around MP3 format (a Hex Editor is a invaluable tool in this), I was able to read them in PHP without using any extension. The source has been put on GitHub.

Binary File Reader

The native method for reading a binary file is unpack(). The problem with it was that it can’t handle variable length chunks, and I found it tough to understand the format of packing codes. Unluckily, I realized it quite late (damn!), that I can create the reader more efficiently by using unpack() function. (Gist)

Why You Should Never Freelance on Freelancing Sites.

| Comments

Back in the days, I used to be the crazy money minded programmer writing kLOCs of crap with no code quality concern, for projects I often found on freelancing sites., oDesk and likes which seem to be quite popular among employers looking for cheap third world country coders but honestly, if you think about being a better programmer, never log in to them. Why?