Java books

Learning of a computer programming language is a slow process, so don’t rush through it.

Computer programming books are usually thick and boring to read. And they can’t be read like fiction books. It takes time to cover these books cover to cover.

Here are some points which I follow when reading a book on computer programming language for the purpose of learning a new programming language, and I thought I should share it here if it could benefit others as well:

You Don’t Need To Read All Of It

One thing which I have observed in almost all the computer programming books is that they cover advance topics which a new learner doesn’t need to learn. They are simply impossible to understand at a beginner level. This advanced info is only needed when you have already practiced your computer language skills on real programs.

This means, you don’t need to read all of the book. I would say reading first half of these books is more than enough, and rest half can be ignored for a later time

Practice As You Go

A computer programming book can’t be read like a fiction book. These books come with examples and exercises. It is important that you take your time to actually code them and understand how they work. This will slow down your reading, but there is no fast way to learn a computer programming language, so take your time and practice as the author wants you to.

Sleep When Feel Sleepy

Computer programming books will make you sleepy very often. At such occasions don’t force yourself to keep reading and practicing. Give your brain a break. Take a nap, do something else, and then come back to where you had left. If you’ll force yourself to continue when your brain is asking for a break, you won’t learn it properly.

It Takes Time To Learn Programming

Computer programming is not quick to learn, it takes time. While practicing along with the book, there will be many things which won’t be clear to you and sometime it’ll be frustrating. Just know that you are not alone in your frustration and this is normal, whether learning the programming language or whether practicing it as a professional with many years of experience. Take your time, don’t rush. If something is not clear, revise it and try to understand why it is not working. If it makes you sleepy or dizzy, take a break.

Don’t Continue Unless You Understand

One of the biggest mistakes many people make, they keep flipping pages without understanding the concepts they have just read, or exercises they have just completed. There is a mental rush to complete the book. This however doesn’t help with learning of the language, and wastes more time, since reader has to come back to these sections of the book later anyways to clear these concepts. So if you are stuck at some point, stop and try to get it cleared. Maybe ask someone, or search online. Just don’t move ahead unless you are clear on what you have just read or practiced.



Those who don’t appreciate technology, in the end fail both themselves and you. Try not to work for them.


ver last few years I have learned something as a technology professional which I thought I should write about here, as it might help many readers.

What I have learned is that those clients who don’t understand and/or appreciate technology, are not only extremely hard to impossible to work with, but they also fail themselves and you in the end.

Recently I was exploring background of the successful people in the technology industry, and I noticed that all of them had some sort of background in the technology industry itself, which explains why it is important to have true understanding of the technology industry itself to be successful in it.

Technology is hard to develop, its not an easy task. It takes countless hours of R&D, development, testing, calibration, re-testing, more R&D, more development, before a product is finally ready for production.

And software engineering and development is no exception.

A good piece of software takes a very long time in development, whether its a website, a mobile app, a desktop application or an embedded system. For example, a good website programmed from scratch can take up to three months to complete, with a team consisting of developers, designers, experts of database, networking and server systems. This adds up to the cost. So a good website can easily cost in tens of thousands of dollars.

But, for a lot of clients, who want to build a great website and be on top of search lists, they expect this practice to be something not more than $9.99 per month and they fail to understand why would it cost e.g. $20,000 in initial development plus $300 per month in monthly running costs, and further $1,000 monthly in advertisement.

And I am not referring to free plug-n-play type one-size-fit-all solutions based on WordPress, Joomla, Drupal, etc. Though they also incur some serious cost if properly and beautifully customized to suit a client’s requirement.

Many clients also refer to online freelance websites where developers from certain third world countries offer their services for peanuts, while promising to accomplish tasks which they don’t even understand what they mean.

Developing good technology is time consuming and hard work, and it costs money. 

This all makes it very difficult for a genuine developer to put forward his/her case for a genuine and good quality original work.

My observation for this problem is as follows:

  • From a client’s point of view, a website is just a website. He doesn’t know that it is a default set of web pages or plugins which come standard after signing up with a hosting company. Client doesn’t know that it is based on WordPress or something similar, which in turn is a software evolved over many years. So when he/she wants to hire a developer for a custom solution who asks for a few months and tens of thousands of dollars of development cost, client fails to understand why.
  • Native and non-native apps is another culprit in the mobile app development industry. Non-native apps are basically web pages which present themselves as an app. Majority of the so called app developers, who promise to make apps for cheap, basically just make do this non-native development work. So when a native app developer proposed a bigger cost and time, client fails to understand why.

So now it becomes some extra and hard work for a developer to educate the client why custom and good quality software development actually costs good money too.

The result is, client keeps wasting money in small quantities while not achieving his/her goal, and getting frustrated on it, and not understanding where the problem is. Problem is there in not understanding how the technology works.



[Don’t know the source, found via StumbleUpon]



I thought to put down some of my thoughts about PhoneGap as it might help somebody to save his/her time.

In last one year I have tried a few times to learn PhoneGap, to no avail. I have been doing web and Android development for a few years, and not new to these tools, but somehow this PhoneGap thing never worked for me.

The biggest problem I have faced is the obsolete and outdated documentation, examples and tutorials. Old examples and old code which just wastes your time and gets you nowhere. I wonder how they even roll out any new change without documenting it first.

The very first problem starts with the terms ‘phonegap’ and ‘cordova’. As of writing of this post, which is 30th of April 2013, for a beginner there is no clear mention of what is the difference between cordova and phonegap. It has been almost 2 years that Adobe acquired PhoeGap and renamed it to Cordova (why, I would ask) but they failed to mention it anywhere in the documentations.

in early 2012 I downloaded phonegap and it was cordova version 2.4 even back then. Yet even today when I find tutorials, they refer to it as phonegap and not cordova. This shows how old these tutorials are, and keep you wondering if cordova and phonegap the same thing.

I also found 4 books, two of them published in 2012, and still no mention of the term Cordova except in one of them, and only at a few places because for the rest it is still calling phonegap-x.x.js.

Also, in the latest code as of today, i.e. cordova-2.6.0, the app is initialized using some app.initialize() method in the example which comes with it. However I failed to find anywhere this method documented. All the books and examples are still starting the apps with old <body onLoad=”init()”> way.

Not only this, I also copied pasted codes to my test projects, and they didn’t work. Also trying to switch from app.initialize() to <body onLoad=”init()”> caused the example to fail to do anything.which according to its brief online mention says it should do the same thing.

Now the books, when they say to unzip the file, you wonder where this file exists, because it simply doesn’t exist any more. Makes you wonder how to learn this thing at all. A careful look also shows that in the books or documentation it is looking for this file in folder iOS, notice capital letters, however in the download the folder is ios with small letters. This means somebody updated the downloadable files, removing the ios related installer, but didn’t mention anywhere how to go about with it now.

Given all the frustration and waste of time due to above, I have decided not to waste time on PhoneGap and go with Objective C. Take a longer learning path but do it the right way. As for Android, I can program it native anyways. And as for BB, will simply outsource it to do it in its own C++.

As an end note, for quality and performance oriented app, using PhoneGap, AppMobi, App Maker, Appcelarator and any similar tools for non-native development will only disappoint you in the end. For real work, you have no choice but to go native.

Linux Distros

Linux Distros

Here is some collection of Linux reference items, useful for Linux server admins. I personally refer to them often so decided to put in this blog.

Clear Memory Cache on Linux Server

  1. Connect via shell using a program such as Putty
  2. At the shell prompt type crontab -e <enter> as this will allow you to edit cron jobs for the root user.
    • If you are not familiar with vi (linux editor) you press “i” to insert text and once done hit “esc” and type “:wq” to save the file.
  3. Scroll to the bottom of the cron file using the arrows key and enter the following line:
    0 * * * * /root/
  4. Create a file in '/root' called '' with the following content:
    sync; echo 3 > /proc/sys/vm/drop_caches
  5. Once you have saved this file, the job is complete!

 Find Big Directories

du -smh $(find $1 -type d -maxdepth 1 -xdev) | sort -g

Get the Number of Registered SIP Users on Asterisk

asterisk -rx ‘sip show peers’ | grep -a ‘OK’ 2> /dev/null | awk ‘END {print NR}’

OR if grep gives problems

asterisk -rx ‘sip show peers’ | awk ‘OK’ 2> /dev/null | awk ‘END {print NR}’


asterisk -rx ‘sip show peers’ &> /dev/null | awk ‘OK’ | awk ‘END {print NR}’

Convert MP3 Files to 8KHz Wave

$ lame –decode soundfile1.mp3 soundfile1.wav
$ sox -V soundfile1.wav -r 8000 -c 1 -w soundfile1.raw

To convert a whole clutch o’ files, stick them all in the same directory and do this:

$ for i in *.mp3; do lame –decode $i `basename $i .mp3`.wav; done
$ for i in *.wav; do echo $i; sox $i ${i%%.wav}.raw ; echo ${i%%.wav}.raw; done

Check Number of Files and Folders

ls -l | grep ^- | wc -l
ls -l | grep ^d | wc -l
ls -l | grep ^l | wc -l

echo $(($(ls -l | grep -v ^d | wc -l)-1))

ls *.txt | wc

Using find command with -type switch:

-type c
File is of type c:

b block (buffered) special

c character (unbuffered) special

d directory

p named pipe (FIFO)

f regular file

l symbolic link

s socket

for t in files links directories; do echo `find . -type ${t:0:1} | wc -l` $t; done 2> /dev/null

for t in files links directories; do echo `find . -maxdepth 1 -type ${t:0:1} | wc -l` $t; done 2> /dev/null

ls -l |perl -e ‘while(<>){$h{substr($_,0,1)}+=1;} END {foreach(keys %h){print “$_ $h{$_}\n”;}}’

du -a | cut -d/ -f2 | sort | uniq -c | sort -nr

Backup the Whole Linux System Using Tar

tar -zcvpf /archive/full-backup-`date ‘+%d-%B-%Y’`.tar.gz –directory / –exclude=mnt –exclude=proc .

The above command specifies the options “z” (compress; the backup data will be compressed with “gzip”), “c” (create; an archive file is begin created), “v” (verbose; display a list of files as they get backed up), “p” (preserve permissions; file protection information will be “remembered” so they can be restored). The “f” (file) option states that the very next argument will be the name of the archive file (or device) being written. Notice how a filename which contains the current date is derived, simply by enclosing the “date” command between two back-quote characters. A common naming convention is to add a “tar” suffix for non-compressed archives, and a “tar.gz” suffix for compressed ones.

The “–directory” option tells tar to first switch to the following directory path (the “/” directory in this example) prior to starting the backup. The “–exclude” options tell tar not to bother backing up the specified directories or files. Finally, the “.” character tells tar that it should back up everything in the current directory.

Truncate a File

cat /dev/null > <filename>

Find All Files in a Directory and its Subdirectories

find . -type f | wc -l
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr
ls | wc -l

ls -l | grep ^d | wc -l
ls -l | grep ^l | wc -l

Find All Files in a Directory Only

ls -l | grep ^- | wc -l
echo $(($(ls -l | grep -v ^d | wc -l)-1))

Find All Subdirectories in a Directory

ls -l | grep ^- | wc -l
echo $(($(ls -l | grep -v ^d | wc -l)-1))
find . -maxdepth 1 -type d | wc -l

Find All Softlinks in a Directory

ls -l | grep ^l | wc -l

Find All Subdirectories in a Directory and its Subdirectories

find . -type d | wc -l

Mirror a Website

wget -m <URL>

Remove All Leading and Trailing Spaces in a File

sed ‘s/^[[:space:]]*\(.*\)[[:space:]]*$/\1/’

Add Colors to Grep Outout

export GREP_OPTIONS=’–color=auto’

Mass Renaming of the Files, e.g. js?P to js

find . -name ‘*.js?P’ -exec sh -c ‘mv “$0” “${0%.js?P}.js”‘ {} \;

Mass Renaming Uppercase to Lowercase

for f in `find`; do mv -v $f `echo $f | tr ‘[A-Z]’ ‘[a-z]’`; done

Mass Renaming Convert Spaces to Underscores

rename ‘ ‘ ‘_’ *

Insert A Character, e.g. ‘;’ At the End of Each Line in Vi


Insert A Character, e.g. ‘;’ At the Start of Each Line in Vi


Extracting an APK from Android phone

adb shell pm list packages

Then you may select an app, for instance twitter

adb backup -apk

An important thing here is to not set up a password for encrypt your backup

This is going to create a file named as backup.ap, but you still can’t open it. For this you got to extract it again but using the dd command.

dd if=backup.ab bs=24 skip=1| openssl zlib -d > backup.tar

Now extract the tar contents and that’s it.y select an ap

Change a word in multiple files

grep -rl 'windows' ./ | xargs sed -i 's/windows/linux/g'
Facebook Ads are Fraud with 80% Fake Clicks

Facebook Ads are Fraud with 80% Fake Clicks

I started using Facebook ads in 2009, and always noticed that Facebook Ads stats showed very large number of clicks, both in their CPC and CPM model, whereas actual clicks recorded on my websites were significantly lower.

My first point of catching incoming traffic was my own script, which I had developed in PHP. However, for more detailed info I always used Piwik as my main Analytics software, and also used Google Analytics for some of my websites.

Results on the above three were always almost the same, and much lower than what FB stats would show.

Recently in 2012 BBC published an interesting article, where they investigated the truth behind Facebook clicks and ‘Likes’ and how Facebook has been cheating in order to grab money out of pockets of its advertisers. What they (and many other investigators too) have found is that Facebook has automated bots setup to click on your ads.

Here is the link to BBC investigation

If you search the Internet for Facebook Ad Fraud, you’ll see tons of information on this fraud. I found another good link here.

However, it remains a mystery why Facebook hasn’t been sued for this cheating. Seems like this cheating is still legal. Apparently if you setup bots to click on your user’s ads, then it is not considered fraud. After all advertisers are paying for the clicks. Who clicks their ads, is irrelevant.

Monetize your app

Monetize your app

This is the question everybody is asking these days, and truth is there is no easy answer to this question.

In fact, there is no real way to make money of your apps in today’s market. There was a time when mobile apps was a new idea and those who made some decent apps in those years, made some good money. However, now there exist so many apps that doesn’t matter how good app yours is, there is a better one out there for free.

So why do people still make apps then?

The answer is simple, why do people buy lottery tickets?

Its a hope that it’ll make them rich.

However from a practical stand point of view, these days mobile apps represent part of a bigger picture for most of the organizations. If there is an organization which already has its presence in the form of a website, tangible items, a service, an online product, or in any other form, and it wants to reach its customers via mobile apps as well, then it’ll pay to get such an app developed.

The most common way for an app to make ‘some’ money on its own is via in app purchases, which are mostly useful in games only. As you all know, that nobody wants to pay that $0.99 for any app, however if there are some useful items to be purchased within an app, then people are more likely to pay for them. The average cost estimate which people are willing to pay for in-app purchase is $20.

With a growing number of apps everyday, even that is becoming very difficult. First of all, people need to know that there exists your wonderful app. This in return requires a lot of advertisement, which requires a lot of money. So it becomes a catch 22 situation.

However, if somehow your app gets mentioned in the news, then you have a slight window of opportunity since this will result in a decent amount of downloads of your app. And that is basically the moment you should be ready for.

Bad Client

Bad clients are dangerous for your business, beware of them.

A bad client is who doesn’t pay you for your service or product, and/or gives you a lot of headache.

So beware of them.

Also note that a business is a money making activity. Don’t do it like a charity work. Keep your business and charity work completely separate.

Also, keep your emotions, relations, religion, beliefs, personal issues and thing like that aside when doing business. However you should also know that statistics show that most of the businesses fail, and while failing, also ruin life long relationships. So it is better to not do business with people with whom your relationships are dear to you.

Almost all businesses, small, big, or medium size, face bad clients, one time or another. However newer and smaller businesses face them more often because of their lack of experience in identifying them. So here I’ll try to explain how to identity bad clients based on my many years of my personal experience and experience of many of my successful and unsuccessful friends and relatives in terms of their business related activities. Read carefully and save yourself time, headache, and most importantly money and human resources.

My focus here is on technology development related businesses, primarily software development.

So here we go…

When a new business starts, it is desperate to find clients. This is very natural.  Without clients, a business cannot run. So in the beginning all clients look good.

However, don’t expect to get good clients so easily and so soon, since there are very few of them.

How a Software Development Business Works

First you should know how a software development business works. You do a few sittings with a potential client who explains you what he/she wants get developed. You give your technical input about what is possible and what is not, how you would do it, how long will it take for delivery and for testing, and then the most important thing how much will it cost. The client negotiates with you on the cost. You might remove some features from the final product or modify certain things. Once you both agree on a product, till its minutest details, you write an agreement with milestones and final delivery date, and payment schedule. Then you get at least 33% paid in advance to be able to start the work. Rest you get paid as you deliver your milestones. And then you get the final payment at the time of final delivery.

However, it is tough to get good clients with whom things would work like mentioned above. In real life, most of the clients you get are bogus clients.

Here I have categorized types of clients to make it easier for you to identify them and decide how to deal with them:

Types of Clients Simplified

NO NO Very Bad
YES NO Bad and Dangerous


1. Clients with no money, no business plan

This is the most common type of clients you will deal with, doesn’t matter where on the globe you are located. These are the worst type of clients. They want something but don’t know what they want. They usually have a vague idea what they want as their business product, but they have neither money nor a business plan. They waste your time, explain their vague idea and expect you to fill in the blanks, and based on it make a product for them. Since they don’t have money, they can’t pay you for your work and want you to agree on one of the following terms:

  1. Money will be paid when the work is finished.
  2. Money will be paid when they’ll start making money of the product you will develop.
  3. You do a partnership with them, and you make money and give it to them, and then they’ll give you your share.
For point 1, they will never pay you because they don’t have the money and will never have.
For point 2, will angels descent on them with money once they have product in hand? No, they won’t. Since their is no business plan, so there will come no money.
For point 3, its basically asking you to do business for them and feed them.
Don’t waste time with such clients. Say them good bye and hang up. If they keep buggin you, give them a really high quote and ask for 33% advance, and they’ll will never bug you again. Your time is too valuable to waste on these clients.

2. Clients with no money, but a business plan

Then there is the second type of clients who have done some homework on the business aspect of their dream, but still, they don’t have money to pay you. So they are equally useless and will act the same way as clients mentioned above.

3. Clients with some money, no business plan

These clients are very dangerous. A small or new business will find them attractive because they can pay some money, which is better than nothing, but they don’t realize that they’ll end up doing client’s business and administrative work too. And client will keep bugging them because he would think that by paying a little money, he/she now owns you. He/she would expect you to sell the product, add extra features in it, do its marketing and advertisement, provide on going service and so on.

Stay away from such clients as well.

4. Clients with some money, some business plan

These clients can be just ok clients if you deal with them really carefully. Make sure they write down their business plan properly, and stay realistic on how detailed their product will be. Since they are paying only some money, so the product will also be pretty basic and simple.

5. Clients with money, no business plan

These clients are also not good. You should always be cautious of any client who has no business plan since such a client will have unrealistic expectations from the product you would develop for them. They might seem attractive because they can pay you money which you desperately need, but it’ll come with a lot of headache as well which will not worth it. As mentioned earlier, such a client will expect you to do his business work too.

6. Clients with money and a business plan

Now these are the right clients which you are really looking for. Do anything to keep them happy, even if you have to do some extra work for them. They know what they want, they’ll provide you with the details to the best of their ability, probably by a team of technical people. Then you’ll be able to guide them on how to make their idea a reality. They’ll pay you advance as any genuine client would do, and things will go smoothly from there as long as you do your work right too. In this scenario both the client is serious and hopefully you are also serious.

7. Clients with a lot of money, no business plan

These clients again have no business plan and can put you in real trouble because the product you developed for them will obviously make no money. They’ll blame you for that. So if you want to deal with them anyways due to monetary benefit, get a well thought out agreement signed by them with proper disclaimer.

8. Clients with a lot of money and a business plan

Now these are the best clients which you get only once or twice. You really don’t need to get them very often. When you get one such client, leave all other work and just focus on their work, and do it to the best of your ability, deliver them the best possible product even if you have to hire people from outside and/or get into partnership with another technology development companies.