Showing posts with label Bit about Byte. Show all posts
Showing posts with label Bit about Byte. Show all posts

Tuesday, May 01, 2012

Retrieve Amazon EC2 windows password

I recently was given to work with an existing Amazon EC2 AMI without having the benefit of the previous key-pair. Additionally when the AMI was created the Set Password was not enabled. This led to the problem that even though the AMI could be used to launch a Windows EC2 instance, we could not login.

To surmount this, we need to make use of an Ubuntu linux instance launched on Amazon EC2. Following steps help in recovering the password.


  1. Launch a Windows instance from the given AMI. Use your own or newly created Key-Pair.
  2. Stop the instance and detach the volume which contains the root partition. This is usually /dev/sda1. The root partition contains the setting for Set Password. (C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml)
  3. Launch a micro Ubuntu server instance. We do not need a larger instance since it is a simple operation.
  4. Attach the volume detached in step 2 to the Ubuntu instance under /dev/xvdf.
  5. Login into the Ubuntu instance via ssh or whichever way you do.
  6. Create a mount point  sudo mkdir /opt/tempm/
  7. Use fdisk to check the correct volume to mount sudo fdisk -l This will list two volumes - /dev/xvdf1 and /dev/xvdf2. Of these xvdf1 is the boot partition, and xvdf2 is the one containing the requisite file.
  8. Mount the Windows NTFS volume onto this directory using: sudo mount -t ntfs-3g /dev/xvdf2 /opt/tempm/ Take care to include the "2" in xvdf2 otherwise you will get errors.
  9. Once mounted, navigate to the configuration windows directory. cd /opt/tempm/Program\ Files/Amazon/Ec2ConfigService/Settings/
  10. Use your favorite editor to launch the config.xml file using sudo sudo vi config.xml
  11. In this file, change the tag from "Disabled" to "Enabled". Save and exit.
  12. Unmount the volume sudo umount /opt/tempm/
  13. Detach the volume from the ubuntu instance and reattach to the Windows instance. When attaching to the Windows instance take care to use the right mount point - "/dev/sda1". Otherwise the disk will not be treated as a boot partition.
  14. Start your windows instance and use "Get Windows Admin Password" to recover the password using your new key-pair.

Note: Obviously if the "Set Password" had been set correctly while creating the AMI, this problem should not have arisen. Please let me know otherwise in the comments section.

Thursday, March 29, 2012

Cassandra with Hector - Eclipse project

I have been mucking around with Cassandra to see how big data works. I am mainly a Java programmer and needed a client to use in Eclipse to connect to Cassandra. In comes Hector. There is the Cassandra tutorial. I am essentially still on the Ant system (will learn Maven someday for sure). Now it requires that I have the correct libraries in the classpath to run the examples.


List of libraries required to run the examples using Cassandra 1.0.8 and Hector 1.0.6:

  • apache-cassandra-thrift-1.0.8
  • commons-lang-2.4
  • guava-r09
  • hector-core-1.0.3
  • libthrift-0.6
  • slf4j-api-1.6.1
  • uuid-3.2.0

This isn't exhaustive. One could possibly include all the libraries in the Hector-core. Some of the jars can be found under cassandra/lib folder. Additionally, the Hector project now tracks the Cassandra versioning system. So look for an upgrade to 1.0.8 sometime soon.

This post is intended more as a collection of sources than a tutorial. Hopefully will update this into a full blown "how to" guide.

Wednesday, July 25, 2007

Dual Monitors

Recently my organization came up with the idea to provide dual monitors at work. It seemed to bring some cheer to the developer community in my company (it was announced at a gathering). I joined in polite applause while my mind clamored to list the actual productivity gains if any. Talking to other people did not elicit much information besides the most obvious ones.

Then I did some research on the world wide web and found some interesting articles on the subject. First and foremost, dual monitors are old hack. People have already experimented with 3 or more and the debate has died down mostly. Yet since this is the first time that I may have such an experience (yes, my company is still to make it actually come true), I thought it would be interesting to find out how others use them simultaneously.

Since the topic is on usability, who better to know and design than Microsoft. While there are the hardcore developers who would differ, this article from Microsoft is good enough for us other mortal developers. After that I went ahead and find out how the developers actually position their monitors and what kind of data they keep open. Some examples:

Most of the time when I am writing code, I am referring to a certain design document or probably another piece of code with the global variable or some such stuff. With one monitor, I need to always do an ALT-Tab to go to the data, memorize the stuff, come back to the primary app and code and then again go back. Imagine with dual monitors, I will just need to keep the reference data open and probably just shift my glance or at worst move my head and I will be able to get the information needed. A better example is when you are trying to learn something new and you need to constantly refer to the tutorial and also run the application simultaneously.

Also the development environment that I use (and most others) have a lot of small panels within the main app, such as directory structure for the code, page hierarchy for the file, attribute options for UI development, compiler messages, etc., etc. With all these options, sometimes the actual code view becomes cramped and I need to shove them under. And then soon as I change to another page, I will need to pull them out. What a waste of time. With two monitors there is essentially more space on the desktop, with the full application window spread over two displays.

Another simple use is to keep your music, email, calender and such other app open in the secondary monitor. For me specially, I like to listen to music all the time when I do serious work. And sometimes I keep the playlist running just because I would need to shift the window focus to another, search for a particular song depending on the mood and then come back to the app. Having two windows just simplifies the task by letting me glance over the playlist which I have given full real estate to in the secondary monitor and select the song that I like with a simple mouse click, each time, every time.

The people who find this most useful are gamers, and more specifically those that play flight simulators and such. They can keep the different instrument panels on one, the viewfinder on another.

Well from all that I could read and gather, it is supposed to increase my productivity, ergo my company's bottomline. Studies have proven that the actual increase in productivity is an average of 30%, while ranging from anywhere between 9%-50%. And therefore it leads to me to conclude that it would also effect the dotted line on my payslip where it says net cash in hand. Cheers!!!

If you want to read more of the actual developer discussions (they are pretty old by the way), you can find them at slashdot, lifehacker , codinghorror, and many more on the web. Also there are already available wallpapers for such dual monitor setups. Wonder how they will look with the patch of the display in between.

Also reading those articles also pointed to some problems. Highest in the list was neck strain, but I think that would come from a less ergonomic arrangement than advised. Also people had problems with the setup, working as they were with different graphics cards.

Waiting in anticipation for the actual implementation of the promise.

Friday, February 23, 2007

Dr. Vinton Cerf at Hyderabad

For the uninitiated Vinton Cerf, along with Robert E. Kahn, is the person essentially elemental in allowing me to write this and you to read this. For the more technologically minded, he invented the open protocol for tcp/ip, which is essentially a set of rules which a computer must follow to "talk" to another computer, which is where it all begins. These two gave us the Internet, invented the wheel far as I could draw an analogy.

Well, this Vint Cerf is currently the Chief Internet Evangelist for Google, on whose invitation he had come down to Hyderabad to illuminate us mere mortals. Amongst the other things that he chose to enlighten us with, a couple of things caught my attention.

The Fridge and The Doctor

Imagine, star trek and the future that it portrays. So in this dream future of yours, you have this refrigerator, which is connected to the Internet. Also every piece of food item that you put into that is marked with RFID, or something similar that they use at your nearest supermarket to read the prices (oh! the devices of man to save manual labor... nobody even wants to write jot the prices of a simple list of items!!! neways...). So you have this fridge of yours knows what you have stored in it. And at the end of the day, when you come back it suggests you recipes that you can prepare based on what you have in the fridge. Kewl, ain't it??? More -- the fridge can actually send you and sms, "Don't forget the yogurt when you pick up stuff for the dinner tonight!".

Similarly, you have this weighing machine which is connected to the Internet as well as your clothes which monitor your vital signs. What happens?? All your medical data goes to your doctor, the virtual one of course (suitably encrypted, for those that are technologically minded). Then one fine day on a note of preemptive strike (as our dear Mr. Bush, Jr. would say) against such diseases such as diabetes, high blood pressure and the others, your virtual doctor wakes ups and decides "enough is enough". So it prescribes a "diet" diet. And how does he enforce it upon you?? Through your fridge of course. Did you forget the fridge?? It is intelligent and now is fed with instructions for your well being. So what does it do?? Suggest you diet recipes!!! Better still, one day it finds that you are trying to cheat it by sneaking out things that you are not supposed to take in your diet and shuts its door tight. There you go! what better than a fasting diet!!!

The other scenarios I leave to your imagination... :)

Interplanetary Internet

3min and 30sec: Time it takes light to reach from Mars to Earth
Spirit, Opportunity: 2 robotic rovers exploring the surface of Mars, since 2003

The rovers initially were programmed to relay the signals directly to Earth, but could not due to interconnectivity problems. Then the signals were relayed through the orbiting satellites. Here they introduced the concept of store and forward of the messages from the rovers to the earth base station, which is essentially the way the internet works and where Vinton Cerf figures in. But there are considerable difficulties in this approach even since the store time when we consider internet on earth is just some hundreds of milliseconds. But the same will grow to minutes in the case of communication from Mars, since the signals from the orbiting satellite is relayed when it is in direct line with earth. And add to that the delay caused by the actual astronomical interplanetary distance

Certain delay tolerant networks are also being developed. And to test such networks, scientists actually travel to places like the northernmost point on Sweden, implant networks in laptops fitted in vehicles (snowbuggies, snowcats) and run experiments. In places like these the curve of the earth becomes really low.

For those wanting more information, click on the link above.

Moot point: Even before actual interplanetary travel is discovered, the scientists will make sure that we are able to talk to our friends staying in another planet! And people say scientists are romantic! It is something like abstract algebra.