Friday, 10 May 2013

An unexpected error occurred: "$ANDROID_BIN"




A picture is worth a thousand words, this meme correctly depects how I am feeling right now.
While creating a new project via phonegap ( cordova they call it these days, silly name if you ask me )
, this error message would pop up, and its been like that for more than a day.

./create foo foo foo
An unexpected error occurred: "$ANDROID_BIN" create project --target $TARGET --path "$PROJECT_PATH" --package $PACKAGE --activity $ACTIVITY &>/dev/null exited with 1
Deleting project...


And I was under the impression that there was something wrong with the path variable that I added in my .bashrc .And i edited it like a thousand times.
 But just 5 minutes ago I found out the real problem.
Apparently package name should be prefixed accordingly with 3 namespace, so foo is not a valid package name. A valid package name looks like this

com.something.something

Now

./create foo com.android.foo foo

works just fine.

If doing this doesn't solve your error then there must be some problem with the path variable you set up, here is what mine looks like

export PATH=${PATH}:$HOME/android-sdk-linux/platform-tools:$HOME/android-sdk-linux/tools

or even this will do fine


export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools



Monday, 15 April 2013

I've become eh Dumb



I guess half two third of this picture correctly describes what has been going in my life.

When I was younger, I was curious to everything that happened around me. When I would go for long walks , I would look at the clouds and think of how they are formed, or imagine an animation I saw on discovery depecting how they are formed.
I wasn't one of those who asked a lot of question, asking a lot of question doesn't make you curious , the will to find the answer does, which might include asking a lot of questions, but the measuring stick here is not asking lots of questions, but trying to find the answers. Rather I used to stay absorber in my world, finding answers to all of the questions on my own. Discovery chanell was the holy mecca of knowledge.(and still is)

I always wondered how the grownups could stay immune to all the fascinating things around them, like the reflection of light, or glass being transparent, or the rainbow, surface tension of a fluid etc.

I made a theory back then, that as humans our ultimate goal of life should be to contribute actively to science.The fact that less than 1% of the human population was actively devoting their time to core science was very disturbing to me.
Because finding stuff out was a subset of exploring, and exploring made total sense, by scientific method or otherwise. And I thought that whoever wasn't doing it was probably dumb.
But little did I know I was wrong.

I used to love mathematics, LOVE IT. I wanted to be become a mathematician when I grew up. and still do.

But now that I have transformed into so called adult, ( turning 19 this week ), I didn't knew when that transition happened to . And how I transformed from a curious inquisitive boy to a dumb human.

I don't engage in those interactive mental exercises I used to when I was a kid, my perception of the world has changed. In short words I 've become dumb.

Nows the time to change it.

I realised all this when I was attending a lecture on cryptography by Dr P.K Saxena, Director SAG DRDO, at my college. I knew very litle of cryptography before that lecture, so it was an interactive session for me. Something very rare these days for me.

I think learning cryptography from scratch could be my chance to regain the spirit of exploring I once inhibited.

Sunday, 14 April 2013

Procastination

Never mind I will write it later ....

Monday, 8 April 2013

On Programming languages


This is the talk I prepared to present in my humanities class. I am supposed topresent this tomorrow, oh its 2 am already, I need to present this 7 hours later.

Hi class, in the next 5 minutes or so I am going to be talking about programming languages from a little different point of view.
So in case you are wondering, why would anyone choose Programming Languages as a topic to speak about in a Humanities Lecture, well my curious friend, the reason I choose this topic is because I wanted to choose something which was interesting and geeky enough to motivate me to write 5 pages about it, only very few topics qualified for that spot one of them was programming languages.
Even though the topic is quite technical, I have tried my best to keep it dilute enough so that everyone can understand. How well have I succeeded in this attempt of min, the next few minutes shall reveal.

Begin:

Programming Languages

So what the hell are programming languages ?

As I see it, a programming language is a means to communicate with the computer and give shape to your ideas.It is precise set of instructions which you pass into the computer which then gets converted to machine code in the form of 0s and 1s which the computer then executes. Examples include

It consists of 3 main components, syntax semantics and documentation/community.
I have an interesting analogy to explain these terms,

Semantics is the very soul of a language, it refers to the meaning of the language.

Syntax is the surface for of a language , much like the skeleton in a mammal.

Documentation and community defines the appearance of the language and how it is perceived by the public in general.Open source languages tend to have excellent documentation and a helpful community ready to help you getting started with it.

Programming languages are classified into 5 generations and 3 categories, namely procedural , structured and object oriented programming languages.But I would be skipping those details features like encapsulation , polymorphism , parallelism, because howsoever exciting they may sound, by all means it is after all a humanities class.



Why you should learn to program ?

It gives you wings
Programming gives you incredible power, everyone of you owns a computing device, which has has a processor of the order of GHz, this means that it runs around 1,000,000,000 cycles per second, that is enormous, learning to program gives you the ability to execute instructions on the scale of 1 billion per second.

It will help you understand the world around you. You can understand how the apps in your smart phone work and start making your own ones.How cool would that be.

Learning to program will get you a job
Given the current state of thing and the rate at which the IT industry is growing, it is very likely that most of us will be working in a computer related field in the near future.

Learning to program will get you a girlfriend
No, I just made that up. No learning to program is not likely to get you a date, not if you spend you evenings in front of a computer coding the night away rather that having fun with your so-called friends, the only dates you are likely to get would be virtual which may be human or an a bot. But if getting a date is your priority then you may as well go do something else like , i don't know, maybe sing songs and post then on you tube maybe.


Now we come to the most important sections of all, oh how long have I been waiting for this.

Myths regarding Programming languages ?

There are many many myths surrounding languages, which programming newbies are confused with,These are things which I have explained to a lot of my noob friends I will bust a these myths here.

1. HTML is not a programming language, the M in HTML stands for Markup.Generally, a programming language allows you to describe some sort of process of doing something, whereas HTML is a way of adding context and structure to text.

2.One of the most popular confusion that people have is that they assume that Javascript has something to do with java since they happen to sound similar.Java and Javascript are similar like Car and Carpet  or HAM and HAMSTER are similar .JavaScript was named this way by Netscape to confuse the unwary into thinking it had something to do with Java, the buzzword of the day,a clever marketing technique and it succeeded.

3.Another common confusion is that of people counting Jquery as a language,  JQuery is not a programming language, it is a library for javascript programming language.


Conclusion
This brings me to the end of my talk, Hope you liked it, in that case you might wanna re-read it on my blog, rootof3.blogspot.com , and totally make my day by posting a comment or two.

Thanks.

Thursday, 14 March 2013

Python - Shorten a URL Using Google's Shortening Service (goo.gl)


python shurl.py {url to shorten} 

Example usage:

python shurl.py http://iwastesomuchtime.com 
>>>http://goo.gl/PevgB

Loading ....

Saturday, 9 March 2013

Playing with cronJobs in ubuntu

This post is about cron jobs and how to set them.

Blabbering the current time every hour


First up, make a executable bash file on the desktop (say time.sh)

#! /bin/bash
espeak 'the time is' && date +%I:%M | espeak --stdin

espeak is a built in text to speech utility of ubuntu.Here I have piped the string 'the time is' and current time (in hours and minutes) into espeak.

Add it to crontab

Fire up the terminal and type

EDITOR='vim' crontab -e

And add the following line to it

*/20 * * * * /home/user/path/to/time.sh

mine looks like

* */1 * * * /home/stom/Desktop/time.sh

And we are done, this will run the script.sh every hour. for more info on how to specify commands in cron tab , visit CronHowto

Changing Desktop background every 20 minutes


I use xubuntu ,so this works on mine. add this to the crontab

*/20 * * * * xfdesktop --reload

xubuntu uses xfce ,if you have a gnome based distro then try this

gsettings set org.gnome.desktop.background picture-uri 'file:///path/to/image'


Cronning up yugdom.py


@yugdom is a twitter bot, which tweets relevant stuff, using tweepy.Here is how it works, a bash file runs the virtual environment necessary for yugdom (containing bs4 and tweepy) and the yugdom_cron.py

#! /bin/bash
source /home/stom/Desktop/apps/twitter_bot/twitter-bot-env/bin/activate;
python /home/stom/Desktop/apps/twitter_bot/yugdom_cron.py;
echo 'Done'

And this bash file is made to rum every 17th minute with the following line in the crontab

*/17 * * * * /home/stom/Desktop/yugdom.sh


playing with espeak

espeak is a lovely utility to play around. Check this out

espeak -p 300 -s 200 "hahahahhahahaha"

-p is used to control the pitch and -s for words per minute.
This generates a funny evil flavoured laughter, I love it. I love it so much that I attached this command to the insert key on the key board, so that I can hear it again and again. To know more check out the man pages of date and espeak.

Anomalies in cron tab

Crontab is weird. So weird, while working on it I ran into some anomalies in it, here is a few of them.

This doesn't work

*/20 * * * * ./home/stom/Desktop/script.sh 

while this does

*/20 * * * * /home/stom/Desktop/script.sh



Crontab is unable to run two commands in the same line like this

*/1 * * * * espeak 'foo' ; espeak 'bar'

or

*/1 * * * * espeak 'foo' && espeak 'bar'

Tuesday, 5 March 2013

Solution to python challenge 1

You will find solution to python challenge 1 in the following blogpost.
This is the challenge  http://www.pythonchallenge.com/pc/def/map.html .

If you havent solved the puzzle it is highly advised NOT TO READ FURTHER.Otherwise you would spoil a perfectly nice puzzle, and nothing is worse than that.




Here is my solution

Loading ....