Sunday, February 27, 2011

When smartness of the word processors overtake you.. ;)

There were two times smart completion features have overtaken me. I was unable to expose the first experience, as it would violate someone else's privacy; so here comes the second experience. But this time a pretty boring one. :D

I was trying get a description of a load balancer I created. I have all the commands written down in a file. I opened it using a word processor and copied it to the terminal.

pradeeban@pradeeban:~/pem$ elb-describe-lbs autoscalelb –headers -K KEY.pem -C CERT.pem
elb-describe-lbs:  Service error: LoadBalancer name cannot contain characters that are not
 letters, or digits or the dash.
 AWSRequestId:6634cf73-423d-11e0-97ad-fd607d01edca

I was confused, where did I use an invalid character in the name (which was indeed just "autoscalelb"). After a few minutes, I figured out, it was my smart word processor, which had replaced "--headers" with "–headers" (Smart hyphenation!). :D

Sunday, February 20, 2011

Translating is a fun kinda thingyy!!! ;)

We all may have used Google Translate or Yahoo Babel Fish to translate a block of English text to Spanish or French once in a while. I always use a loop or a workflow during the translation to make sure that I omit most of the translator errors, as you can see any of the translators hasn't reached 100% correctness yet (not even near to that).
Let's take the requirement as a translation of a block of English text into Spanish. 

* Get the Spanish translation from the translator (English -> Spanish).
* Swap the mode of translator (to Spanish -> English), and get the English translation of the Spanish translation.
* If the English translation and the original text are similar (obviously they won't be identical), we are good to go. Let's use the Spanish translated text.
* If not, just extract the correctly translated block, and change the incorrectly translated one a bit and put it back to English -> Spanish translator and continue the loop till they become the same.

Some tips..
* It's better to use simple and complete English in translation to get it translated correct.
* Avoid, 'Will do', and use 'I will do' instead. Most probably 'Will do' will be translated wrong, though it is pretty obvious in English that 'Will do' is similar to 'I will do'.
* Avoid idioms, confusing phrases/words, and peacock words those have no value. Give it simple and straight.

Anyway technology and tools can never replace a cute and adorable human translator. After all, you know.. translating is a fun! :D

Thursday, February 17, 2011

[Pidgin] Error Reading blist.xml

Pidgin 2.7.10 (libpurple 2.7.10) in one of my computers (Ubuntu 10.04) stopped loading my accounts, with the error "Error Reading blist.xml - An error was encountered reading your buddy list.  The file has not been loaded, and the old file has been renamed to /home/pradeeban/.purple/blist.xml~." Basically it is unable to find the account, hence asking to configure new user accounts. I found both blist.xml and accounts.xml being corrupted in the .purple folder. The backup files themselves (accounts.xml~ and blist.xml~) were corrupted. 

I easily fixed the issue by replacing the corrupted account.xml and blist.xml with the same files from my other computer. This solved the issue. Obviously a smart and stupid fix at the same time! Can't bother fixing it in a professional manner, finding the root cause blah blah blah. During this fix, I also noticed that passwords are saved as plain text in the above two files (oops!). On a side note, I always am fond of reading my previous chat logs from .purple.. haha.. ;)

Tuesday, February 15, 2011

8 Crazy Twitter Rules!

I am not a rule maker or a big-guy to create rules for Twitter. But the following are a collection of my random tweets tagged as 'Twitter rules', which I tweeted from 6th of May, 2010 till late 2011. It doesn't mean, I complete with these 8. I will create more rules later.. :P

Twitter Rule #8: If you want your tweet to be retweeted, avoid ending it with #fb

Twitter Rule #7: Keep ur acc. open, unless u have a valid reason to keep it as a closed acc. #Twitter is supposed to be open unlike facebook

Twitter Rule #6: Use @ and # often and wisely. # (#hashtag) gets u wider audience through #search. @ helps u reach the correct @audience.

Twitter Rule #5 I often search for your pic for a tweet. So better do RT@ instead of retweeting.. ;) <- Profile picture as online identity.

Twitter Rule #4: Don't make your followers to search your profile for the Twitter Rule #3 you tweeted a looong time ago..

Twitter Rule #3: hu sed tweets or its rules shud b in proper Engliz? sometimes RULES r like thizz too. twitter zn't an offize item! jajaja..

Twitter Rule #2: Take a break between two tweets to make sure your tweets are read. Replies & RTs are exceptions.

Twitter Rule #1: Do NOT follow stars and politicians. Their tweets won't be useful to u, and they will never follow u or listen to ur tweets

[Rule8's explanation: Tweets those end with #fb tag will become a Facebook status for the "selective tweet (ST)" users. so those who use ST, can't retweet freely.]

Pls tolerate the sms-style-English. The rules are copied directly from my own twitter account, hence the 140 characters limit.

Snapbird is a great tool to search the tweets.

http://www.idfromuser.com/ is a service that lets you find the user id from the twitter user name. Twitter ID might be useful in many cases, like getting the feed url.

Tuesday, February 8, 2011

Auto Scaling With Amazon EC2 - II

We created an Amazon ELB as discussed here. Let's see more of it now.

Appserver
The load balancer we have created listens on the port 80 and 443 and forwards requests to 9763 and 9443. Say now we need to delete the listeners.

elb-delete-lb-listeners autoscalelb --lb-ports 80 443 -K KEY.pem -C CERT.pem  
    Warning: Deleting a LoadBalancer listener can lead to service disruption to
    any customers connected to the LoadBalancer listener. Are you sure you want
    to delete this LoadBalancer listener? [Ny]N
elb-delete-lb-listeners:  User stopped the execution of elb-delete-lb-listeners.
(Providing 'N' stops the action. You can proceed deleting the listener, by giving 'y' as the response.)

You can also create more listeners
elb-create-lb-listeners autoscalelb --headers --listener "lb-port=8280,instance-port=9763,protocol=http" --listener "lb-port=8243,instance-port=9443,protocol=tcp" -K KEY.pem -C CERT.pem
OK-Creating LoadBalancer Listener

The load balancer now listens on the port 8280 and 8243 and forwards requests to 9763 and 9443.

Now what will happen if you forcefully try to kill the instances initiated by the ELB? It will create one more identical instance immediately, handling the failover case.


Fail over
pradeeban@pradeeban:~/pem$ as-describe-auto-scaling-groups autoscleasg -K KEY.pem -C CERT.pem

Initially,
AUTO-SCALING-GROUP  autoscleasg  autoscalelc  us-east-1c  autoscalelb  1  10  1
INSTANCE  i-xxxxxxxx  us-east-1c  InService  Healthy  autoscalelc

When we killed the instance.
AUTO-SCALING-GROUP  autoscleasg  autoscalelc  us-east-1c  autoscalelb  1  10  1
INSTANCE  i-xxxxxxxx  us-east-1c  Terminating  Unhealthy  autoscalelc
INSTANCE  i-yyyyyyyy  us-east-1c  Pending      Healthy    autoscalelc

After a few seconds,
AUTO-SCALING-GROUP  autoscleasg  autoscalelc  us-east-1c  autoscalelb  1  10  1
INSTANCE  i-yyyyyyyy  us-east-1c  InService  Healthy  autoscalelc

Sounds cool.. So how to terminate the instances that ELB creates?


Shall we try deleting?
pradeeban@pradeeban:~/pem$ as-delete-auto-scaling-group autoscleasg -K KEY.pem -C CERT.pem

    Are you sure you want to delete this AutoScalingGroup? [Ny]y
as-delete-auto-scaling-group:  Service error: You cannot delete an AutoScalingGroup while there are instances
 still in the group.  AWSRequestId:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa


Min = Max = 0
ok! So let's stop auto-scaling process by setting the minimum and maximum to zero.

pradeeban@pradeeban:~/pem$ as-update-auto-scaling-group autoscleasg --min-size 0 --max-size 0 -K KEY.pem -C CERT.pem
OK-Updated AutoScalingGroup
pradeeban@pradeeban:~/pem$ as-describe-auto-scaling-groups autoscleasg -K KEY.pem -C CERT.pem
AUTO-SCALING-GROUP  autoscleasg  autoscalelc  us-east-1c  autoscalelb  0  0  0
INSTANCE  i-yyyyyyyy  us-east-1c  InService  Healthy  autoscalelc


Delete
Now let's try to delete the auto-scaling group once more -- yes, as we have set it to zero, it should be possible now.
pradeeban@pradeeban:~/pem$ as-delete-auto-scaling-group autoscleasg -K KEY.pem -C CERT.pem
  
    Are you sure you want to delete this AutoScalingGroup? [Ny]y
as-delete-auto-scaling-group:  Service error: You cannot delete an AutoScalingGroup while there are scaling activities in progress for that group.
 AWSRequestId:bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbb

oh.. Let's wait a minute for that scaling down activity to finish!
Again!
pradeeban@pradeeban:~/pem$ as-delete-auto-scaling-group autoscleasg -K KEY.pem -C CERT.pem
          
    Are you sure you want to delete this AutoScalingGroup? [Ny]y
OK-Deleted AutoScalingGroup



Done!
Now, let's check once more whether we have deleted it properly.. ;)
pradeeban@pradeeban:~/pem$ as-describe-auto-scaling-groups autoscleasg -K KEY.pem -C CERT.pem
No AutoScalingGroups found

Yes, we have deleted the Amazon ELB along with the scaling group of nodes it created.  (We are sinners! ;))