Saturday, May 28, 2011

How to run Chrome OS in a Virtul Machine

I was one of the few ones who got chosen by Google to test their Chrome Notebook a.k.a CR-48 since then I have been using it everyday to read news, checking my email, writing posts and almost everything I can sometimes I even use ssh to connect to my Ubuntu server and write some code.
my CR-48 :)
Also, since I got it a lot of friends keep asking me how is the experience and if there is a way to install it on a PC or running it on a Virtual Machine. Unfortunately the only way to installing is by compiling the source code and building it by yourself. All the instructions are in the Chromium OS developer page which is the open source project for Chrome. Even worse you will need a 64 bit Linux system better if it is Ubuntu 10.04 flavor in order to do it .

Searching around I found this page which provides  Chrome OS images for VMWare, Virtual Box and USB. According to author, every day around 6 pm GTM it automatically downloads the code and compiles it into images so everyone can try them. These are Canary images so for sure they are going to be very unstable and with a lot of bugs and crashes but if you wan to play around with Chrome OS, this is will fit your needs just fine.
Starting the VM :)
The performance is not the same as the real Chrome OS and mainly it is because of 2 things:
First, Chrome OS is optimized for Solid State Drives (SSD).
Second, You won't be able to have graphical acceleration since you are running on a virtual machine.

Signing into my account
Besides these 2 points the experience is pretty much the same. I am running my CR-48 on dev mode and it is also unstable and it crashes depending on the update, some are pretty stable while others are really really buggy and with a lot of crashes and sometimes applications and extensions won't work properly but that is the price if you want to test and use the latest version.
Running Chrome OS :)
Either way, Chrome OS powered notebooks are coming this June so if you have some extra bucks yo can get a brand new one pretty soon :)
Chrome OS powered NoteBooks
So as a weekend project you can download the image you like the best and play around with Chrome OS :)

Monday, May 23, 2011

Some Tips to Publish your app in the Android Market

Today is a great day, I finally published my application in the Android Market :) :) even though it is not even version 1 it is pretty stable and has some really cool things. I tried to follow all their best practices in code, UI and resources.

The Android documentation has some links on how to prepare your app for the Android Market, things like a checklist, UI tests, how the versioning works, how to design your application icons and a lot more, but I wanted to add my personal touch :)

If you have everything on those links above, you are almost done. In order to publish an application you need to sign up as a developer and pay a one time only fee of 25$ which is cheap compared to Apple Store and Amazon. Once you sign up and make the payment you can upload as many apps as you want but for each app you need to have  some mandatory images and screenshots. Believe me when I say that it took me more time getting this icons and images right than developing my application. Sadly, I am not a graphics guy, I did what I could though ;)

Once you upload your apk the developer console gives you a summary of the permissions and features your app needs to run properly; this list is based on your Manifest File, minimum API version and code.

Permissions summary
You can save a lot of time by using the aapt (Android Asset Packaging Tool)tool, you just execute this:
$ aapt dump badging <path_to_exported_.apk>
It will dump all the permissions, features, supported screen sizes and everything! really nice tool. Really useful instead of using the Developer console and find out that you missed something and start the whole process again.

Also, I would recommend paying a lot of attention to the <uses-feature> part. Spend sometime reading the documentation and you will understand why this is so important if you wan to get your application in as many devices as you can. Also you can read this blog post about hardware support and this one about future-proofing your app. This is really an important part. The first time I uploaded my app the console told me it was going to available to 13 devices! just 13! I was shocked since my app could run an any device with Froyo or more and according to this that was more than 65% of the current market. Then I did some research and I added these 3 lines to my Android Manifest:
<uses-feature android:name="android.hardware.faketouch" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<uses-feature android:name="android.hardware.telephony" android:required="false"/>

and now my app is available to 355 devices! Basically this is saying that my application requires this hardware but it can work just fine with out it. For example the last line says that my app can work on any device not only cellphones. It would be better to have telephony features but it can work with out it. So pay attention to this part because it does make a huge difference.
Supported Devices
Finally, it gives you the option to advertise your app. I did not enable this, yet but I am thinking about it. My app is really simple right now and I will add more things before starting that.
Advertise using AdMob
Testing your application in the emulator and your own device is easy. Right now my app could be in 355 different devices and that is the real test. I was afraid to publish it because now it is alive so anyone can install it and use it and that scared me for a lot of time. Sometimes users are mean! and they lie, but at the end I wanted to see my end result and see if I reached that point where I can develop real applications and not just personal projects for my own use.
My App :)
So if you have time you can download my app from here and make a comment and review it :)

Friday, May 20, 2011

More on Git

I wrote about Git in my latest post and I thought I needed to add more information on why I like Git so much! and also some starting information is always good and better if they are videos.

I found these 2 videos which are a great if you want to start using Git. The first one is from O'really which gives you a fresh start on Git and GitHub, really good for starters.

The second one, comes from Google Tech Talks where Linus Torvalds explains why you should use Git. It is worth mentioning that he created Git and The Linux Kernel uses it to maintain it.

A couple of notes abut this Video:

I loved when he said "I do open source because I think is the only right way to make software, but at the same time I also use the best tool for the job" I completely agree with him on this. I also love open source but you also need the right tools to make it work and sometimes that means to use commercial tools at least until you find a open source/free replacement, which does the same work or better.

We share the same feeling about CVS and SubVersion although he really really hates them with strong passion :) he started showing WWCVSND which means "What Would CVS Not Do". He also gave an example on merging and how easy is on Git compared to CVS and SubVersion and he is right merging and branching in SubVersion is a pain. First, everyone can see your branches and second when the time comes to merge it is a master pain and sometimes you just don't do it, you just left the branch there.

These are some comments he has about a good SCM Source Code management:
  • If you are not distributed, if you perform bad, you are not worth using it is that simple.
  • Being distributed means you do not have one central place that keeps track of your data as the opposite of SubVersion ( I totally agree on this one. Having just one central place sucks!).
  • Offline, collaborative, distributed, as many branches as you want are some of the benefits you have when you use Git which are not supported in most other tools. ( Try working offline in SubVersion or CVS, it is just not possible!).
  • Bitkeeper is worth using, it is commercial, but it is also distributed.
At the of the day everyone uses what is the best for the job or what the company you work for tells you to use but sometimes we do not think outside the box. We do not look for better ways to accomplish our job and we get stuck with something old, that sucks but it "works" for us, apparently.

I love learning and trying new things but not everyone is like me. Old fashion guys prefer to stay with something they know and understand instead of exploring new horizons. Hope I never get to that point.

Enjoy the videos, listening to Linus is really fun. I like the way he thinks and expresses himself.

Branching and Merging in Git/GitHub

I little bit of introduction, I have been using Git for my personal projects for quite a bit now and I love it! I used CVS and Subversion and to be honest Git is the best for the job. I tried to implement it in my work but I guess they did not like it anyways that is another history. I also use GitHub as a repository which is really good you can set up an account and repository really fast and as long as your project is open source the storage is free, you a limit though, it is more than enough for a project that is for sure. I also used Google Code and to be honest I prefer GitHub just because Google Code uses Subversion.

You can't explain Git in one post because it is so big and there are tons of ways to do the same thing, that is why I like it so much, among others though. If you want a complete guide to learn Git, I would suggest Pro Git which is free and really really complete.

Now, to the point. I just published my first Android Application to the Android Market (more on this later) :) it is not really that big. It is something I built in my free time and to learn Android. It is nice I like it a lot and I am planning more things. Anyways, I had to create a branch to separate the stable version which is published right now, from the dev version since I am still adding more things. Branching in Git is so easy! really I wish Subversion was that easy. Although, I had to create a remote branch since I am using GitHub either way was easier than anything else so these are the steps to accomplish this:

git pull origin master                 -- to get everything from your repository
git branch <name of your branch>       -- creating the branch
git checkout <name of your branch>     -- changing to the new branch
-- make all the changes you need
git push origin <name of your branch>  -- pushing the new branch to your github repository

If you are done with your branch and all your tests have been completed it is time to merge. Merging is also really easy just one command and that is all:

git merge <name of your branch>  -- will merge <name of your branch> on top of the current branch you are working on

More useful commands are:
git status         -- to check the status and what has changed
git branch         -- will list all your branches
git add .          -- will add all the files modified to a commit ready state

There are a lot of commands and a lot of ways to accomplish the same thing so I strongly recommend to read the documentation to get familiar with all the possibilities.

Happy coding :)

Sunday, May 15, 2011

Eastern egg in Google IO T-shirt

Everyone at Google IO got a nice T-shirt and with a puzzle to solve, Google loves puzzles and this time was in Morse code. If you decode each line, you will get something like this: http://GOO.GL/A4C639

if you follow the link, you will be directed to a page where can download the official Google IO 2011 live wallpaper which is awesome and also you can download Androidify yourself which is a small application for your android device in where you can personalize the Android robot the way you like. It is really fun :)

One more thing, the code A4C639 is the RGB code for the Android green they use on every Android you see around the web. I love these puzzles :)

Friday, May 13, 2011

Google IO 2011 Summary

Google IO has been the greatest experience I've had so far :). Those were 3 days full of fun, meeting new people, learning new stuff and getting to hang out with developers who enjoy working with tools I like as well.

Lucky me I was able to get into BootCamp as well which it was sold out, do not ask me how I did it ;) :) It was great I did a couple of questions and I got to talk with Paul Irish which is one of the Chrome Developers, he was really nice and I even got to take a picture with him :)
Paul Irish and Me :)
The second day was insane, 5,000 geeks all of us in one place it was weird but at the same time amazing. I have not seen so many robots in my life! so many cool gadgets, tools, and people. I had the opportunity to talk with Tim Bray, a developer advocate for Android, He is really really cool! He encouraged me to apply for Android and believe is one of my dreams to work for Google en special in the Android team.
Tim Bray and Me :)
Working time ;)
The after party was like a dream, lights, geeks, good music, full of toys and gadgets and beer :) really the best way to finish and excellent day :) oh! I almost forgot, they gave us a limited edition Samsung Galaxy Tab 10.1 which I already added to my gadget collection :)
Toys ;)
The third and last day was another great day, the Keynote was focused on Chrome and well they told us that we are going to get a new Chrome laptop courtesy of Samsung again :) I already have a CR-48, it does not hurt having another one though ;) and I was able to take a picture with Sundar Pichai, the person in charge of Chrome :)
Sundar and Me :)
At the end I was completely tired! so many sessions, I wish I could have attended all of them, but it was impossible at least i tried and did my best. I got to play with some of Google's toys, take a lot of pictures and met really cool people who also share my passion about Google and its technologies :)

A big plus is that I had to meet Peter Vesterbacka the creator of Angry Birds :) such a nice guy always smiling.
Peter and Me :)
I must say it was a wonderful time, it is sad now it is over but at least I can say I was part of it. Now i am back into my reality and well I have to keep pushing my goal to get better and apply everything I have learned these last 3 days.

According to the official Google Code Blog, all the videos from the sessions and keynotes are already uploaded :) and can be found in the official YouTube channel :) enjoy them because they are worth every second :)

Pics, and highlights are posted here, all the videos can be found in the Google Developers Channel in YouTube.

Happy Coding and until next year Google IO :)

Monday, May 9, 2011

Google IO!!! :)

At the end I made it!!! I am in San Francisco with one of friends from university back in Bolivia. It was difficult to get the days off. I do not know why since it is my personal time off ( one of the things I hate about my job) anyways, I am here now :)

This is my first time in San Francisco and so far it has been amazing!! I wish, I could stay more time though there are so many things to do so many things to see and I am only going to stay for the conference and I do not think I will have time to walk around, I will do my best though.

I will try to post during these days but I am not sure I could. You can see the full schedule here and this year Google will stream the keynotes, android and chrome sessions online and in real time! So if you couldn't get a ticket at least you can watch these ones from anywhere.

Sunset in San Francisco :)

Friday, May 6, 2011

Solution for ORA-01033 caused by ORA-01157 and ORA-01110

Today I was asked to do some work with some data. Basically I have to import the raw data into something more usable, easy to manipulate and run queries. My first option as usual was to use Oracle.

I started my server and listener and try to connect my SQL Developer. I like this front end because is easy to use and what's more it is supported by Oracle which makes the integration easier. Anyways, I tried to connect it and I couldn't so my next try was to use command line and use sqlplus which is the default command interaction you have when you install Oracle DB Server. I executed:
sqlplus <username>/<password>
and I got an ORA-01033: ORACLE initialization or shutdown in progress. I had this issue before and I just used to wait or even re-start my computer but this time it did not work so I had to try another things. I tried running:

C:\> sqlplus / as sysdba
SQL*Plus: Release Production on Thu May 5 17:22:38 2011

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> startup;
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> alter database open;
alter database open
ERROR at line 1:
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '\PATH\TO\FILE\CMS2.DAT'

This last command gave me the real reason it seems the server was looking for a DAT file that was no longer in the system which was true, I removed some files but it seems the Oracle DB server was still looking for them. So the solution was to tell the server to stop looking for these files. In order to do that I executed:

SQL> alter database datafile '\PATH\TO\FILE\CMS2.DAT' offline drop;
Database altered.

Now that the file has been deleted we restart the server:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  778387456 bytes
Fixed Size                  1374808 bytes
Variable Size             385877416 bytes
Database Buffers          385875968 bytes
Redo Buffers                5259264 bytes
Database mounted.
Database opened.

And now everything should be working just fine. Oracle can give us errors when using it but sometimes they are not really the root cause of them this is something I hate about it. We need to be careful and find the real cause before start trying to solve the problem. In this case ORA-01033  was not the real issue, ORA-01157 and ORA-01110 were the root cause and usually because of these kind of issues we have to re-install or try crazy things when the solutions is something different, something simpler.

Hope this helps someone :)

Monday, May 2, 2011

Random Thoughts

Sometimes when I go through my feeds I see some posts that I want share but they do not usually require an entire post. Most of the times I just share them in my Google Reader and Google Buzz but I thought I would share some of them here as well.

Learn sorting algorithms dancing
There are lots of sorting algorithms out there, some of them easy to learn and some of them really difficult. I still remember the first time I implemented the Bubble one. Anyways here is video which shows you the Shell-sort algorithm using Hungarian folk dance really cool ;) you can also watch bubble and Selection

I saw a lot of editors in my life from the most basic ones to the mos complete and sophisticated IDE's. I saw guys writing code using notepad, jcreator, Eclipse, VIM and lot more, but I couldn't believe some would be able to use MS Paint to write. Technically this is not a video it is an animated GIF which shows how the developer used MS Paint to write a simple program.

Who never played this game before? Even Google had as its Doodle for this game's 30th anniversary once and it caused a lot of economical controversy although  you can still play it :) Here is the world's biggest pac-man game I have seen far. It even has a navigator so you can see the game closely AMAZING dp not blame if you waste too much time here ;)

More Games
Since we are talking about games here is a nice post from lifehacker about learning games. It has everything from simple games to improve your typing to learn new languages or even play the guitar :) or prepare for your SAT test. I like the way they adapted Mario Bross to improve your typing. I've always liked that game :)