Friday, May 20, 2011

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 11.2.0.1.0 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 11.2.0.1.0 - 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


Editors
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.


Pac-Man
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 :)