A post a week

This is hopefully what would be first in a series of posts. I am planning to write at least a post every week. Not that I have much to share but just to get some rust out of my writing bones. 

The Road and the Radio

Since the last few weeks, I have removed the USB drive from my car which contained music and have started listening to the local FM stations instead. While it is refreshing to listen to newer songs and get some news and gossip as I travel, the one thing that started troubling me are the advertisements that I heard on the radio. Don’t get me wrong, I am not against ads, after all that is the entire revenue model of radio. What I found strange was that almost every second advert on every radio station was an ad about what all good Delhi government had done in the last two years. It seemed like they had tried to get it past their lawyers in such a way that they did not really speak the name of the political party but the overall tone was very much of praise for AAP (Aam Aadmi Party). What had me wondering was just one question… who pays for these ads?

As I could imagine and I am sure you could too, the ads are paid for by none other than we, the people. The tax payers’ money going on to publicize a political party which is in power. I understand that there is a thin line between creating awareness about what the government has done and advertising the political party which is the government, but that thin line seems to have been crossed in this case. The ads are far too many, the obviousness of the narrative too much in favor of one party (at one place, they say – “aam aadmi ki sarkaar”). The sad part is that this is being done openly. And this is being done by people who publicly abhor corruption and misuse of funds. If this is not misappropriation, then what is?

I feel helpless. I feel sad. After every war or revolution in history, a new class of society gets created which gets called the “middle class”. This is the class of people who are the common men. The people who lift the society back up with their hard work and contributions in various areas. In today’s times, this is the class which gets screwed up. The poor are so poor they don’t have any further down to go. The rich are so rich that they bend the people and politics to their will. So in this society, what role does the middle class play? The role of being screwed by everyone!

 

 

How Analytics should be done in IoT

An article I wrote, appeared here.

http://www.cxotoday.com/story/what-iot-means-to-analytics/

DQ Channels Rapid Fire

DQ Channels published a rapid fire question/answer session with me. For posterity, here it is.

http://www.dqchannels.com/i-love-to-read-and-talk-a-lot/

Enabling mod_rewrite on Debian/Ubuntu

Recently, I installed Debian 8 on my laptop. Being a developer for the web, it was obvious that I needed a few customizations. One of the first ones being installation of apache server and then enabling mod_rewrite. Here go the steps for posterity:

  • Login as root (basically do an “su” for Debian or “sudo su” for Ubuntu.
  • apt-get install apache2

This shall install apache server. Now about mod_rewrite.

  • a2enmod rewrite
  • service apache2 restart

And we are done!

Spreading Firefox :)

Firefox

I have been using Firefox as my browser of choice ever since Firefox 1.0 was released 10 years ago. Time to spread the love 🙂

Why I don’t agree to AAP

The Aam Aadmi Party (AAP) is a political party in India. It is a relative new comer as compared to other well established national parties such as the Congress (I) and the Bhartiaya Janata Party. The party has formed a government in the nation’s capital and seems to be eyeing the central elections this year to make a national level impact. This has created quite a stir amongst the people of India. The youth, particularly, seems very well impressed with the party and its charismatic leader, Arvind Kejrival.

I, however, do not support or even like the AAP. While I agree with much of what they aim to achieve and make the country a better place to live in. I do not agree with their methods. I do not agree with their hypothesis of what all they think is wrong with the country. Their vision page states this.” And this seems like the mainstay of their entire operation. Bringing the common man at the fore front and bringing the corrupt politicians down. The whole system is supposedly corrupt and they aim to bring the common man back to power as the countries forefathers envisaged. They even refer to Mahatma Gandhi and Swaraj on their website. Below are some of the reasons, why I believe this is not going to work:

  • The basic assumption is that the common man is not corrupt. I totally disagree with this. I believe that the common man is someone who didn’t get a chance to get corrupt. Give him the power and you would find him taking bribes and looting the country with the same gusto as the current politicians do.
  • To me, it seems like the AAP is fighting against nepotism and not corruption. They are trying to replace the current set of politicians with new ones who perhaps do not belong to wealthy families and have no political backing and support (as yet). My argument is that while such people may do something good in the short run, ultimately this is just creating a wave of new political families which would rule India for the next set of years. Nothing new or radical is going to happen to the common man.
  • The AAP started election campaigns talking about how they will bring in austerity to the government. The ministers will no longer live in bungalows or have limousines to drive them around. the Ministers will be common men who just happen to work for the government. There is nothing inherently wrong with this. But this seems just like over promising. It just adds to the scrutiny which the people will place on the choices that the AAP government makes. There is nothing wrong with the minister getting a decent house and a decent car from tax payer money. The problem is the definition of decent. If there are no laws to curb misuse, there would always be ministers who would end up eating more than they should, driving more than they need to and living more lavishly than they were supposed to.

By penning down these points I am not announcing I am against AAP. Neither am I saying they are wrong. I just want to make a point that there are more things that are wrong with this country than corrupt politicians. We, Indians, are morally corrupt. That is the reason crime rates are increasing, that is the reason corruption is on the rise and that is the reason we fight with each other and cause riots everywhere. All the heritage and culture that we talk about in the books is just there, in the books. There is no one practising it and there is no one thinking about it. While parties like AAP might help by doing something in the right direction, they can’t and shouldn’t be treated as the saviour. What we need is a younger generation that is better than us. We need to improve upon the morality of the next generation. If we keep getting better each generation, things might turn out right in a couple of hundred years. As far as I can think with my small imagination, there is no revolution that can help us in the short run. May be I seem pessimistic, but to me, I seem correct as well.

 

 

Compiling a C file to a shared library

While most of us create and use makefiles to make a shared library, sometimes you just need to create a library from one or two files and test something out. The quick and easy way to do so from the command line is given here.

Lets say we want to use all the C source files in the current directory and we want to make libfoo.so.

gcc -Wall -fPIC -c *.c
gcc -shared -o libfoo.so *.o

Easy enough?

ISCSI Help

ISCSI is a quick and easy way to access remote storage over IP. Here is a cheat sheet for iscsiadm (The iscsi administration utility) commands which can be helpful in the future.

Discovering Targets

iscsiadm -m discovery -t sendtargets -p ipaddress

Display the discovery database

iscsiadm -m discovery -o show

Display portals for automatic login

iscsiadm -m node -o show

Log into a specific target

iscsiadm -m node -T targetname -p ipaddress -l

Log into all configured targets

iscsiadm -m node -l

Log out of a specific target

iscsiadm -m node -T targetname -p ipaddress -u

Log out of all logged into targets

iscsiadm -m node -u

Display list of current sessions

iscsiadm -m session

Display details about a target

iscsiadm -m node -T targetname -p ipaddress

Display statistics about a target

iscsiadm -m node -s -T targetname -p ipaddress

To delete a discovery entry for the database

iscsiadm -m discoverydb -t sendtargets -p ipaddress -o delete

To delete a node from discovery db

iscsiadm -m node -o delete -T -p ipaddress

That is all I think. If I get to know more commands, I would keep on adding them here.

 

Bash Scripts

Scripting in bash offers one of the simplest and most powerful ways to do tasks in Linux/Unix based environments. While it is usually simple to write scripts and fix them, sometimes it so happens, that you create a long script (or edit some one else’s long script) and it starts spewing out random errors and random places. Now debugging these errors could be very time consuming if not done properly. So here are three bash switches which can make your life much much easier if you ever get into such a situation.

set -x

This option prints command traces before executing command.

set -v

Prints shell input lines as they are read

set -f

Disable file name generation using metacharacters (globbing)

While the first two are self explanatory, globbing can sound tedious to some one who has not heard it yet. Globbing, in simple terms, means filename expansion in bash. It is the bash practice of expanding filename patterns or templates containing special characters. For example, when you do

[omega@home tmp]$ ls *.tar
perf.tar
[omega@home tmp]

Here, bash expanded the *.tar to show the correct file. This is globbing.

So for debugging purposes, just do a “set -xfv” in the beginning of the part which you feel might be responsible for the error and “set +fxv” at the end. These would work like start of debug and end of debug tags and help you fix things up quickly. If all the three switched together seem like generating too much of output, you could try using one of them or two of them independently.

Happy Debugging!

Further reading : The Linux Documentation Project