Sunday, July 29, 2012

Installing Oracle JDK 6 in Ubuntu 12.04

My Ubuntu customization continues this time with Java. Everyone should know that Ubuntu does not come with Oracle-Sun JDK anymore instead it comes with open-jdk which I like but the projects I am working on does need Oracle-Sun jdk and version 5 or 6 so I did not have an option to install it.

You can download the version you want for the architecture you need from Oracles web site. by the time of this post the version I used was jdk-6u33 but it should apply to any version.

JDK Download
The next step is to unpack the bin file. You do it by executing these 2 lines:
chmod +x jdk-6u33-linux-i586.bin
./jdk-6u33-linux-i586.bin

You will see a jdk-6u33-linux-i586 folder as result of the last

Third step is to move the folder to a safe and standard place. To do that we use the next command
sudo mv jdk-6u33-linux-i586 /usr/lib/jvm/
Next we create a symbolic link, you know so you do not have to type jdk-6u33-linux-i586 all the time. We do that by typing
cd /usr/lib/jvm/
sudo ln -s  jdk-6u33-linux-i586 java
Finally, you need to set the environment variables. In my case update them since I already had openjdk installed but it will work either you have or not another version installed before. You need to do it for both java and javac
sudo update-alternatives --config javac
sudo update-alternatives --config java
Default jdk
You will need to choose the the option to the Oracle-Sun jdk you want and press enter.

To test this out you just type
java -version
javac -version

checking versions
and you should see the version you installed.

There is an easy way to this which is adding an extra repository. There are tons of PPAs that come with Oracle-SUN JDK these days, but as you know I like to have control of these things. The easy way is like this
sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java6-installer

More information and nice guides can be found here, here and here.

Let me know if you have any questions.

Happy coding!

Wednesday, July 25, 2012

How to recover MS Windows 2003 Server admin password

From time to time I have to deal with Windows servers, you know the usual stuff, updates, configurations, slowness ;), etc. This time I got the server but I did not get the credentials to use it. I talk to the administrator and he couldn't remember and the ones he gave me did not work and it did not help that he was sitting in other country with 10 hours difference ( it was 2 am for me ).

Anyways, I had to use another approach. Usually when I have this problem I use an Ubuntu CD I have with me all the time, boot the machine and install chntpw and change/reset the admin's account password to blank to some other password, easy right?

This time though, it did not work because the server has a RAID 0 configuration and it was a domain controller secondary server. I am not an expert on this area but since it was a domain controller its credentials were store in the active directory configuration not really in the local machine and chntpw could not save the changes. As usual, I had to do it the long way.

I did some research I found that I was not alone and also found some articles explaining how to recover/reset your password some good links are this and this ( this last one needed access to the local admin account which I did not have either, might help some one though).

Finally, I found this thread where the author explains pretty much every situation related to my specific situation which was Windows 2003 server with AD configured.

The solution was to download and burn this tool, which is basically the next chntpw evolution. Just boot the computer using the CD (you can also get the USB version if you want) and you get a command line tool which has chntpw tool already. You mount the drive where windows is installed  and locate the SAM file usually in windows is in windows/system32/config/ folder. Once you are there you execute chnptw -h which will show you the version and all the options you have.
chntpw in action :)

I tried resetting the admin password but that did not work :( so I had to enable the guest account and increase its rights to admin level.  Once that was done I boot the machine normally logged in using the guest account and change the admin account, reset the password and created my own account with admin rights :)

You can use the next commands to do the same:
This will ist all users
chnptw -l SAM

To launch the interactive mode which is really helpful
chnptw -i SAM

One more thing, once you do all the changes do not forget to save the SAM file otherwise nothing will happen and also to safely umount the drive. This is very important I made the mistake very times and I had to it all over again and again.

Happy hacking and remember to use it for good reasons :)

Sunday, July 22, 2012

Installing and configuring Synergy on Ubuntu 12.04

I started using Ubuntu 12.04 and since I did a clean installation I had to re-install and configure a lot of my tools. One of them was Synergy. Synergy let's you share one mouse and keyboard among multiple computers, more or less like a KVM but with out the hardware.

I was using Mouse with out borders from Microsoft before, but as every tool that comes from them it only works with Windows and I needed something that could work on Windows and Linux and Synergy was the best option. What's more Synergy also works with Mac so If one day I get one, I know I would be able to use it there as well ;)

Anyways, the first thing I tried was to do a

sudo apt-get install synergy

It did work, but It installed an old stable version which seems to have some problems connecting to Windows 7. Like anything in life I had to do it the long way:


Download the beta version from its web site. Here it is the linkDownload the same version for each platform you wanna install it. by the time of this post 1.4.9 was the latest version.


Installing Synergy

Just double click on it and it will automatically open the Ubuntu Software Center. Click on install, you might need to enter your administrator password. Also, you will get a "The package is of bad quality" alert but you can press "Ignore and Install" to continue.


Alert window

Once it is installed you just execute it.

The configuration window will show up and you either configure the server interactively or use an specific configuration file. I chose the second option since I like writing my own configurations. Press Stop and just create a new document .synergy.conf and save it in your home directory then add these lines:

 
section: screens

        Venus:

        Marcelo:

end



section: aliases

        Venus:

                192.168.1.125

        Marcelo:

                192.168.1.131

end



section: links

        Venus:

               right = Marcelo

        Marcelo:

               left = Venus

end


If you notice there are 3 sections:
screens, where you define the number of screens you are going to use
aliases, here you need to assign each screen its IP address
links, is where you define the position of these screens. Which on is on the left, right, up, down, etc

One quick note here, you can try pinging the computer by its name and if that does not work you will have to add the computer and its ip to your hosts file. This in order to make Synergy work properly.
Windows:
C:/Windows/System32/etc/drivers/etc/hosts

Ubuntu:
etc/hosts


Finally, press Start again and make sure the option "Use existing configuration" is selected and then browse to the .synergy.conf file.


Config Window


The installation on Windows is so much simpler since we configured Ubuntu as server that means that the Keyboard and Mouse are plugged to the Ubuntu machine and it is sharing them with Windows.

I have been using this configuration for a week right now and I noticed some lag on the windows machine. I am not sure if it is because it is a beta version and it is not fully compatible with Windows 7 or because the server is on the Ubuntu or what, but sometimes the synergy process consumes more CPU than it should. I will monitoring and update this post if I find something else.

Please, let me know if you have any questions.

Now, I just wish there was a way to share mouse and keyboard with Chrome OS :)

Wednesday, July 18, 2012

How to Re-Create the Show desktop Icon on Windows

One of those useful tricks that is good to know. To be honest you can the same functionality by pressing and holding the Windows key the the letter D. Anyways I like having 3 buttons in the quick launch toolbar in windows, Chrome, Windows Commander and Show Desktop.

There are 2 ways to fix this:
The first one and easy is to download this tool and follow the steps.

The second one which I call the funny one need these steps:
Open any editor and paste this code:
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop

Save the file to your desktop as "Show desktop.scf"
Drag the icon to your quick launch toolbar and test it.


In reality the quick launch button uses the files in this folder:
For windows XP, 2003
%userprofile%\Application Data\Microsoft\Internet Explorer\Quick Launch

For windows vista, 7 and server 2008%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch


Hope it helps Some one. Happy hacking :)

Saturday, July 14, 2012

Thimble

Online editors and IDE's are becoming more popular every year which makes sense since we are moving from a desktop era to a cloud era. Having everything in the cloud and taking it with you everywhere is the dream. You just need internet connection and you all your stuff.

Mozilla is also trying to get into the cloud editor game they released Thimble which is a online HTML/CSS editor. Once you launch the application you can see 2 divisions, one for coding and the other one to see the preview in the real time. The editor lacks from auto-completion but it give you hints if you place the mouse over a tag.

Thimble in action

Once you are done you can even publish your work so every once can see it. It is a perfect online editor your goal is to learn the basics of HTML/CSS or if you need to edit something quick.

Happy coding!!!

Friday, July 13, 2012

Precise Pangolin first impressions

As you may know Ubuntu 12.0.4 a.k.a Precise Pangolin has been out for about 3 months maybe more, but just now I had the opportunity to really install and test it.  I tried to do a RAID 0 installation but for some reason it did not like it and the boot loader couldn't be installed. It seems the installer did not recognize the RAID configuration. My research did not help and I couldn't spend too much time on it so I decided to just remove the RAID configuration from the Bios and do a normal installation.



The installation was pretty straight forward. You just insert the CD and choose "Install Ubuntu" once you see this screen.

Install option
I do not remember if previous versions did this step but this time I got a verification test in order to see if my computers meets the required hardware, luckily it did.
hardware verification
Then comes the classic option to install it in the whole disc or choose a different partition. I checked all disk since this machine is going to be 100% Ubuntu :)

installation selection
This part was supposed to install it in the RAID configuration but it never worked.
disk selection
Then installation starts copying and downloading files.
installing
The installer makes some stops, one of them is to choose time zone.
time zone
The next stop is for language selection to be used in the keyboard.
keyboard language
Another stop is to configure computer name, user name password.
user configuration
Then comes more installing and downloading.


The whole process takes about an hour and it depends on you internet connection. After that comes the painful process of installing, configuration and customization like installing ssh server, vnc server, development tools and lots of things that I will explaining in the next posts.

This is my last result, pretty good isn't it? :) This Ubuntu version it is really amazing, I am still getting used to the new UI though. Unity tries to simulate Apple's universal search so can find applications, files, etc really fast. Unfortunately you do really need graphics drivers properly installed otherwise the experience is really poor and slow. It really requires a lot of memory i am sure that is why it checks for minimum amount of RAM. I will post more as I write about installing some more tools but so far I am really happy with this version :)

Would have been better if the RAID configuration had worked though.

Ubuntu 12.04 :)
 
Happy coding :)

Tuesday, July 10, 2012

Google IO 2012 recap

Google IO 2012 is gone right now and even though this year sold out in less than 30 minutes I was able to get a ticket by participating the last call Google Code Jam :) which made me realize that i need more practice solving algorithms. The contest was relatively easy but still I struggled a lot in things I should not.

Anyways, the same as last year Google IO was full of surprises and tons of give aways :)  This year we got the complete Nexus family and a ChromeBox and some of us got the ADK so we can built android accessories ( I can accept any ides here ).

This year was a little bit different since I had the chance to be part of the GDG summit Google holds every year in its main campus. This event is special for GDG organizers and this year thanks to some friends I am the new organizer for GDG La Paz and GDG Cochabamba :) we are small but we have a strong enthusiasm to grow and organize more events. If you do not know what a GDG is, I encourage you to follow this link :) for sure there is not near you.

Van Riper and me in front of the Building 44 a.k.a Android
Besides all the free gadgets Google IO is a great place to be if you like Google technologies. This year I focused on Google Apps Script, Google Drive and of course Android. Most of the videos are already on the Google Developers YouTube channel and you can watch them and learn the new functionalities they have. There are sessions from level 101 to most advanced ones.

Now I am back to reality and for sure I will try to post more.

Happy coding!