List methods from a source file

Sometimes source files can become quite large. This is common mostly in C. But this may happen in other languages too. It makes working with these files particularly hard. Off-course there are IDEs which lists method and properties and what not. But there is a fun way to do the same stuff using python. The regex for the signature of Java methods is, (public|protected|private|static|\s) +[\w\\[\]]+\s+(\w+) *\([^\)]*\) *(\{?|[^;]) You can use this regex in python and have some fun summarizing your Java source files. Here is the script: on Github and via Gist, Cheers!


CLI package installation on Cygwin

Cygwin officially gives a vague answer about where there is a command-line installer for it or not. A quick search gave two options: cyg-apt (last updated in 2009) and apt-cyg (currently maintained). I’d try apt-cyg.

lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

And you are all set.
If you do not have wget, install it.

apt-cyg install wget

Cheers!


(Failed attempt to) Set up Flow (Static typechecker for JS) on Windows 8.1

Flow is not officially supported on Windows. So I’m trying to set it up on my machine.

Flow uses OCaml; it is easy to get OCaml on Windows with Cygwin. Even the Cygwin setup has option to select OCaml.

First git clone flow from their source: https://github.com/facebook/flow using

git clone https://github.com/facebook/flow.git

Failed with error: ‘i686-w64-mingw32-gcc’ is not recognized as an internal or external command,
operable program or batch file.

Let us try by installing it

apt-cyg install mingw64-i686-gcc-g++

Retried make and got error: fatal error: gelf.h: No such file or directory
#include

Try installing libelf

apt-cyg install libelf-devel

no luck yet.

apt-cyg install ELFIO

Yet after not getting any success, I tried installing the sources for lib-elf as well.
Not working.

Uninstall OCaml and try using Cygwin’s OCaml

make

looks better, but still getting err: can’t find sys/syscall.h
hack (part of hhvm/hphp) is system dependent. probably it’ll take more time getting it done.

Update: Right now there is an unanswered question on Quora about it; if you find a solution, please post.

Setting up NODE_PATH for using global packages via require(…)

Node.js intends global install for applications only. If you want to use some package in your project via require('...') the recommended way is to put them in projects root. However, you may want some packages to install globally via npm install -g package and use them on your node projects. Then, you have to make sure you have the %NODE_PATH% system variable set up to point global node_modules directory, e.g.: %USERPROFILE%\AppData\Roaming\npm\node_modules for Windows 8.

git push heroku master; server sent publickey

Recently I have been having some trouble with heroku git push from my Windows PC. Whenever I run,

> git push heroku master

I an stung with this message:

PuTTY Fatal Error
No supported authentication methods available (server sent: publickey)

I have tried several things like adding keys with heroku keys:add etc.
Finally, following helped:

> heroku git:remote -a appname

Apparently, meta about remote was corrupted, and executing this command fixed it.

Oh Facebook! plz serve me with better ad

There is an ongoing wave of discussion about Facebook privacy policy update. Apparently, people are more concerned about Facebook policies than Google’s policies while they should be more worried about Google’s.
Now, a lot of so called privacy advocates tell that corporations are selling “you” to make money. Now what is the premise here? Facebook, Google, Twitter etc tech companies are giving you services, quality services and you are not paying a penny. So how do you think they would pay for the cost to run those services?Advertisement is a good source of money for services like Facebook. They provide you with quality service without a charge but in a condition that you’d let them serve you ad. Now, do you want to see your Facebook home covered with tremendous amount of ads? I prefer to see much less but useful sweet ads.

How would they know which ad will be useful to you? They somehow have to infer what you like and what you might be interested in. That is why, they want to analyze your data and usage pattern. They are not going to a different company and giving up your private information to them. Rather, they curate from millions of ads to serve a few that might be of your interest.

Still, they are not super awesome at serving personalized ads. If you searched for a product ten days ago and already bought one, they still serve ads about same type of products. That is totally bad. I am not interested about those; and yet they are charging the seller for those ad impressions. I would rather, see a different product. If I bought a Nikon camera, don’t serve me with ad about a Sony; rather tell me about a tablet may be. Or about lenses at best.
So Facebook, if you can infer what I am buying next, please serve me with best deals out there.