Tweet using bash!

July 18, 2009 at 10:32 am (bash, linux, twitter) (, , , , )

#!/bin/bash
# Store this file with whatever the name in /usr/local/bin/
# SYNTAX: twit Your_message_here
###### You cannot twit nothing! ####################
if [ -z "$1" ]
then
echo “Dude, enter some message, it can’t be blank! Come on!”
exit
fi
message=”$@”
####### Check the length to stop the request from failing #######
max_length=”140″
length=”${#message}”
echo “Message: ” $message
#echo $length
if [ $length -gt $max_length ]
then
echo “Dude, bada lamba message hai, only 140 chars allowed at a time…..It is a microblogging website, yes they are having shortage of space”
exit
fi
########## Enter your username password ##############
username=”username”
password=”password”
url=”http://twitter.com/statuses/update.xml”
curl –basic –user $username:$password –data status=”$message” $url

I wrote this small script which lets you twit through your terminal
Yes $HTTP_PROXY needs to be set

Enter your username and password in the file
and your are done!

PS: Yeah I know many such scripts exist! I never said this is new, its just new for me :)

Permalink Leave a Comment

Ubuntu fun stuff!

June 10, 2009 at 9:49 am (ubuntu) (, , , , )

Some stuff I stumbled upon in the past few days. It may seem lame but anyway try it out! :D

  1. Xjokes: These are some graphic jokes as the name is quite clear.
    sudo apt-get install xjokes
    After installation, type the following one by one at the terminal!
    blackhole
    yasiti
    mori1
    mori2
  2. Free the fish: Hit ALT + F2. This will open the run dialog box. type: free the fishLook at the cute thing on your screen. Well its good for sometime but after a while it really annoys! “Unfreeing” the free fish is not so obvious or may be i don’t know how to! Type this at the terminal ->
    killall gnome-panel
  3. gegls from outer space Same thing run this in run box.
    gegls from outer space
    and play the game. Also please comment back iof you ever complete the level 1. :P I don’t think anyone can finish the game.

Permalink Leave a Comment

FLash AMD64 ubuntu! phew!

June 9, 2009 at 11:37 am (ubuntu) (, , )

After solving the graphic card problem I had (did not quite solve it! it just worked…go by the book and restart :P ) I thought of making flash work in ubuntu. All the standard ones u’d probably apt-get wont make youtube videos work. Finally, I do what all ubuntu users would hate to do…yeah get the .deb and make install it. But adobe.com does not provide flash support for AMD 64 systems which was really sad. So the only way out was using nspluginwrapper on the flash core packages –>
http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.tar.gz

I found a web-page which has a script written to do it all. But as it says you will need getlibs before you get lucky –> http://meandubuntu.wordpress.com/2008/08/20/flash-10-rc-on-ubuntu-amd64/

Awesome script :) Videos and flash works! Things are good.

Permalink Leave a Comment

mysql #1064

March 2, 2009 at 9:55 pm (mysql) (, , , , )

Today evening I was as usual coding something and the code which I had written had ->
$q1="INSERT into table_name(name,time,desc) VALUES('$name','$time','$desc')";

The code just refused to do what it was supposed to. Yeah you might have figured that out.
Some learnings from this were – First thing you should do when things don’t work in mysql is echo the query and try running it in phpmyadmin or at the prompt!
I have been using mysql for like 1.1/2 years now and I come across this outlandish error. Almost eccentric and I tried looking at he code again and again to check if i misspelt something or missed a comma, whatever….Good that there weren’t any mistakes there, bad it took too much time. I slept for 2 hours very frustrated !! Then I went to phpmyadmin. and there I see the “ERROR” – #1064

At once googled and there I see the answer to my problems – reserved words.
Mysql has reserved words ! Some words cannot be used as identifiers directly and to use them all we need to do is quote them.
i.e.
Query: INSERT into table_name(name,`time`) VALUES('abcd','23443545')
The identifier quote character is the backtick (“`”). TIME is a reserved word. Check out Schema object names

huh…another life’s problem solved!

Permalink Leave a Comment

Digg uprising for dummies

January 1, 2009 at 9:23 pm (digg) (, , , , )

So here, we come across another internet or rather digg revolution/uprising whatever! This is I think happening for the 3rd or 4th time (not sure) and infact the only so called internet revolutions or so to say “Symphony of the crowds” I have seen were on Digg. Never on any other portal have i seen such integrity.
So whats the whole revolt about? Its about the existence of power users. Power users are the one who are known for bartering diggs. They be your fan like that of thousand others and then choose some articles either from the internet or some which weren’t lucky enough to get even 2-3 diggs! and submit them to digg and then ask all friends, their network or barter it to get it dugg to get it on the front page, which a normal user can only dream of! These power users are known to digg like 300 articles/hour(all bartered!) and for sure they are all fake; can u read 300 articles/hour!! I bet you cannot even 10.
Haha!
Definitely, these power users have no love for content. They don’t care. So why do they do all this? Well, fame and maybe they are running online marketing portals and probably excelling at it, who knows!
So its only the power users who mostly get content on the first page which is mostly the only page viewed by thousands. Hence, the top content that we read is not exactly what needs to be at the top but some manipulated article put there by dirty means. After getting the initial kick by friends and bartering, the rest work is done by the very normal users who digg most decent articles they come across. And thats it, job done! bingo!
Most digg users now feel a need to reinvent the wheel, tweak the way digg works for it to follow democracy and not any other model which it has turned into. No matter, Digg is a wonderful website very well managed, things are now getting serious. I hope some measures are taken by the Digg staff!

Permalink 2 Comments

Subqueries

December 29, 2008 at 9:36 am (mysql) ()

Today was the first time I came across the need for SELECT’s within SELECT in mysql. Actually never done much of non-trivial coding in mysql! Also i came up with the most-probable syntax of such a thing if it existed. Then I immediately asked a friend and he said it exists and very much the same syntax(kind of obvious) He said its called nested queries rather subqueries and then i discovered that the early need for such nested loops was to make the language more intuitive and less confusing and hence the name “Structured Query Language” (SQL). Just imagine if you have 10 tables and u have one single connector in two consecutive tables, and suppose you need information from tb10 using tb1 info; it would be a really bad way of coding by writing 10 separate queries and pipe the outputs at ecery single stage but instead use a lot more better way by writing just one query and go ahead..Smart and obvious!

Permalink Leave a Comment

Ubuntu lost password!

November 28, 2008 at 12:20 pm (ubuntu) (, , , , , )

This is one sad thing you come across after may be realising that you badly need linux for some work which is impossible in windows(believe me there are some such things…) So you realise that you do have linux installed(you were feeling all geeky some time in your past) At once you restart your computer and switch to linux. Then they ask you for the username and password! Most probably your username is your name but as i said you were feeling geeky when installing it long ago you have definitely kept some not-to-be-known-super-nerdy-password huh..!

Now you don’t remember it! Unlike other OS, no hint questions, but only an adamant screen asking the same question and wont let you proceed. Realize that passwords should be always from some of your standard known ones (or rather md5() of your name or md5 of “your_name;” – quite geeky and no need to remember;)

Steps to do:

  1. Restart your computer
  2. When you reach your grub press ‘ESC’ then press ‘e’ to enter the edit mode
  3. Go to your ubuntu kernel line and press ‘e’
  4. go to the end of line and add -> rw init=/bin/bash
  5. Press enter
  6. press ‘b’ to boot
  7. Now as it boots it will lead you to the full access root terminal, obviously as root
  8. at the prompt type passwd username and it will ask for a new unix password, set it and done
  9. Suppose you do not know the username, then type -> passwd -a -S which will list all the users and from there you can check it out!
  10. Restart your computer and login with new password

Now that you have done so much to get into linux again, please do something productive there and stay there for some time…it isnt for geeks but for work!

PS: rm -rf  – whoever you are, whatever you do, please please do not try this at home or at workplace!

PPS: An easier way out – http://www.psychocats.net/ubuntu/resetpassword courtesy – A.Y. Siu, see comments

Permalink 1 Comment

Error! Could not find an XML setup file in the package.(Joomla)

September 29, 2008 at 9:09 am (joomla) (, , )

Surely, most beginners of Joomla face this error atleast once in their life time and many keep facing them and going to forums for all the components and/or modules and/or plugins etc.. they install. This majorly results from different ways of archiving the package.

Many developers write all the code and make files and just archive the entire lot with documentation etc..and zip all that again making it a “double zipped” archive. This is probably not someone’s mistake but convention error. People just directly upload these files and try to install the package. And hence the error  shows up.

Here is what you do! Just open the archive once and check if it contains other archive named com_…. or mod_… etc. Most of the times with this error this is the case. Just need to upload only that archive and you’re done. So just peep into the files once.

Other case would be that there are no XML files actually. Mostly this doesn’t happen because we do not expect someone to make packages without setup. But if this happens only thing you can do is actually write an XML setup file, validate it and then put it in the appropriate folder.

Permalink Leave a Comment

WordPress sticky notes!

September 14, 2008 at 10:52 pm (wordpress) (, )

WordPress recently introduced the wordpress sticky notes. We had always seen sticky notes in case of forums where some discussions were pinned at the top but was never seen in any other environment.

Many a times its only the first post in the blog that is read or mebbe the posts on the first page. But sometimes you just want to convey some stuff always/for a given period of time. Sticky notes will serve you this./

Enjoy..

Permalink Leave a Comment

timtowtdi

July 5, 2008 at 1:42 am (perl) (, , , )

timtowtdi - the perl motto

This t-shirt is meant for all people who know what the thing written on the tshirt means :D
I could have done it in many ways or by using different fonts and colors as there is more than one way to do it !

Permalink 2 Comments

Next page »