Monday, February 28, 2011

Tunning your Router for VOIP and Video

Time ago I wrote how to configure your router so you could access your home server from anywhere using ssh or VNC which is really handy if you work from home or if you want to access you server anytime from anywhere.

Days ago I read this article in PC World which talks about how to tune your router for VOIP and video. It also talks about gaming and serving websites which is also good if you are into it, bur I am not. It talks about all the possible options you have to configure your router like port forwarding,  QoZ, DMZ and so on.

When you buy a router it comes with all these options disabled for security purposes. You can always change these options in order to make it work the way it fits your needs and even if you screw it, you can always reset to factory settings :)

I use VOIP a lot especially for my work since I have to communicate with developers in India, USA and Bolivia and most of the times I work from home so little by little I am trying have a nice work environment there. I use Skype and Google Voice most of the times.
 It is a really nice article if you want to tune your router for VOIP and HD video and to learn about the basics of router configurations. Remember that every router is different but the article covers the most of them.

Sunday, February 27, 2011

Google Developer Periodic Table

I remember the hard time I had back in high school when I had to learn the chemical periodic table and all the properties they have all they classified by gases non gases, metals, noble gases, etc etc.

Anyways, Google found a similar way to present their developer products and APIs. I did not know they had that many and curiously the 2 in the top are Android and Chromium which make sense since both of them are competing among themselves right now. I do not know at what point both of them will merge but having to Operating Systems competing on each other does not make sense.

Every item in the table has a link to its description and documentation which is really handy.
Google Developer Products and APIs

Saturday, February 26, 2011

Integrating your Android Application with Google Analytics

The best way to track how your app is being used by your users is to track what are the most screens visited, which buttons and events were executed and things like that. In order to accomplish you can integrate Google Analytics SDK for android in your application.

The integration is pretty simple but the documentation is missing a couple of things. First lest install what we need. We are going to need Android developer SDK of course and Google Analytics for Mobile.  Once you have everything, you need to configure 2 things:
  • Copy the libGoogleAnalytics.jar to your project's /libs folder. If you do not have, you will need to create the folder and do not forget to add to your build path. 
  • Then you need to add the following permissions to your project's AndroidManifesr.xml manifest file:
    • <uses-permission android:name="android.permission.INTERNET" />
    • <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Once you have your environment installed and configure the next step is to set up a a new and fake website profile in Google Analytics which is not really difficult just follow the steps just remember to give some descriptive website name something like http://myapp.mywebsite.net ( I like .net, you can use what ever you want though) once the registration is done you would get your tracking code ID that should like something like UA-xxxxx-yy, you need to write it down because we will use it in our code.

The next step is to start the tracker which uses the singleton pattern and you do it by calling GoogleAnalyticsTracker.getInstance(). Then call the start method and pass the tracking code ID and the activity being tracked. I usually start the tracker in the onCreate method because you just need to call it once.
import com.google.android.apps.analytics.GoogleAnalyticsTracker;
public class NoteList extends ListActivity 
{
    private GoogleAnalyticsTracker tracker;

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
        tracker = GoogleAnalyticsTracker.getInstance();
        tracker.start("UA-YOURCODE-HERE", this);
     }
}
Once tracker is started you have 3 options to collect data and send it to Google Analytics servers: Pageviews, Events and custom variables.

Pageview
I use it this everytime the user would go to a different activity or screen, which is good since you can know where the user goes the most.
tracker.trackPageView("/Add New Note");
Event
As it name says it it tracks events. I usually add this to buttons, option menu and context menu items, basically everywhere where an event gets triggered. It is easy because it would be every where there is a listener method like clickListener, itemSelectedListener and so on.
tracker.trackEvent(
     "Clicks",  // Category
     "Button",  // Action
     "categories", // Label
     66);       // Value
Custom Variables
Think of this as meta-data that you want to send to Google Analytics in order to improve the date you send in pageviews and events. According to the documentation the best use case is to track information about full or lite versions of your app so for example you want to check how many lite version have been downloaded or just to filter between versions. For more information about Custom Variables you can head the documentation.

The custom variable has 4 methods: Index ( 1 to 5), Name, Value and Scope.  This last parameter is optional but if it null, it takes the page Scope. The other 2 scopes are Visitor Scope and Session Scope. The Visitor Scope gets executed the very first time the application is running on the device so it is perfect to register the version and type of application. Session scope lasts while the application is running and Page Scope it is just between the activity and it is called right before track event or track pageview.
tracker.setCustomVar(1, "Navigation Type", "Button click", 3);
Once you have all your data then comes the question, how do i send it? this is a little bit tricky since dispatching the data too often can affect on battery life so you need to very careful. That is why there are two ways to send the data one is manual tracker.dispatch(); and automatically which is set the moment you start the tracker you just need to pass one extra parameter to tell the tracker how often you want to send the data.
//dispatching every 300 seconds
tracker.start("UA-YOUR-ACCOUNT-HERE", 300, this);
If you are using manual, dispatch I would suggest it to call on the onDestroy() method that way you make sure the user won't notice it.
//@Override
 protected void onDestroy() 
 {
  super.onDestroy();
  tracker.stop();
 }
One thing I did not like about this implementation and that is missing in the documentation is that the information does not show up in Google Analytics in real time, for me took 24 hours update the information. So if you want to test this and the data your are sending you might have to wait a lot which sucks! I had to wait one day to realize that only my pageview tracks where working :(


Enjoy the new toy :)

Thursday, February 24, 2011

Working with Option Menus in Android

I've been working with android a lot these last days, mostly because I want to have my app in the android market before Google IO so at least I can say I have something to show :) I am developing a simple app just for starting and getting familiar with the platform.

Anyways, while doing the interface I noticed that it is really easy to create UI using xml especially menus. Android provides 3 kinds of menus: context menus, options menu and sub-menus. This post is about only Options Menu, I will cover the other 2 in later posts though.

Each activity has a single menu and it is created using the method onCreateOptionMenu, you can override this method and inflate the xml that contains the menu or you can add items manually, here is an example of both:
inflating the xml:
The menu structure is located in the noteslistmenu XML file. We are passing this file as a parameter.


adding them manually:


Basically both of them will generate the same menu but I prefer XML since it gives you the freedom to edit the file and add more items with out the need to re-compile the whole project again and it also allows you to add a lot more properties to your menu items.

This is how the menu looks like:

If you want to format the rows, you can group them or you can set the android:orderInCategory property. This property sets the order/priority of the items in the group and/or the menu.

This is another capture of this example and the XML file to generate it:
XMLmenu file

final result

Monday, February 21, 2011

Port forwarding and VNC configuration

Weeks ago I got a free computer from home, you know they are going to get new ones and they are giving away the old ones. Anyways this new computer is not really the best thing. It must a Pentium 4 with 2 GB of RAM and it came with out OS. I installed Ubuntu 10.10 on it since it seems my Linux knowledge has been failing.

It is the first desktop I have since a lot of time and right now is working like a dedicated server. It was good but one thing was missing. I couldn't access it from outside my home network which sucks like from work for example. Especially my NAS ( Network Attached Storage ) which has a lot of information, installers and pretty much everything I have.

I did some research and at the end everything worked just fine and these are the steps to do it if you want something similar. This is working just fine on Ubuntu, but it should also work with Windows or Mac.
  • Install ssh server if you want to use command line which I like :) or if you want to remote desktop, you can install tightVNC which has the server and the viewer versions. Ubuntu comes already with VINO which is its built in VNC server which is good but has some limitations.
  • Look into your routers documentation and find a way to configure port forwarding. This basically redirects traffic based on ports and IP's. You open a port and a IP that is going to receive the request. It is worth saying that opening ports in your router is a security breach and you need to be very careful when doing this, like having a good firewall, really good passwords, etc etc. Having said that let's continue. Once you know how to enable port forwarding in your router you need to open two ports: 22 for ssh and 5900 for VNC. These are the default ports these application work with, but can configure the application to work in a different port. In VINO it is a little bit difficult I do not know about tightVNC, it must easier though. This is how it should look like.
  • Once you finish the configuration you need to restart the server and router so the new configuration would work.
  • If everything is working fine, it is time to test. In oder to test it you can ssh your server using your public which you can find by using whatismyIP or any tool like that. The easiest way to test using Windows is using Putty which is a free ssh and telnet client. If it works, you should be able to log in using your Ubuntu user name and password.
  • If you want to test it using VNC, you will need to install tightVNC client in windows and connect using your public IP and again you should be able to log in using your same Ubuntu credentials.
More information about configuring port forwarding with VNC can be found here. It should be a pretty straight forward configuration, but again opening ports to the world can be really dangerous for your security so be very careful.

Friday, February 18, 2011

2-step verification on Google

Last week  Google announced a new service called 2-step verification. This service was already on Google App customers but they will be releasing this to everyone.
This will make your Google account more secure and preventing from been hacked more or less like banks do now. They do not only ask you for user name and your password, some of them have a sticky key, a question a confirmation number, site keys or something like that. Google's approach it is a little bit different. They are using your phone to accomplish this since that is something you will always have with you.

Once you set up the service you have the option to "Remember verification for this computer for 30 days" so you do not have to enter the code for one month. You can go here to learn more about this new service that according to Google everyone should use.

This new service showed up in my account almost right away and it should be rolling to everyone pretty soon. They took the registration pretty serious. It has a lot of steps to configure your phone, backup codes, backup phone and android app for your phone so you can get the codes and enter them.


At the it also asks you to set up application specific passwords. Some apps in your phone or desktop would stop working if you do not set up this first. It generates a random password that you need to use just once and you can do it for every application if you want

So start using 2-step verification so your account will be more secure.

Thursday, February 17, 2011

Computing, Connectivity and Cloud Computing

Computing, Connectivity and Cloud Computing these are the 3 technological waves Eric Schmidt talked about in his presentation in the MWC (Mobile World Congress).

Computing has incredibly evolved in the last 25 years. Before the power of computing we have used to belong to big companies with a lot of money but now we can have it in the palm or our hands.

The same way, Connectivity  is one of the key elements right now, if you have a gadget, you really want to connect it. Internet is something that has grown immensely and it is not going to stop with ip v6 coming practically we have unlimited space. Applications that do not use connectivity in any way it is not a real app these days.

Cloud Computing is starting and it is hitting really hard. Why the need to use your computer or your cellphone when you have huge powerful servers out there?. Everything is moving to the cloud now, information, processing time, everything. Google sent me a CR-48 couple of weeks ago and I've been using it a lot and believe me it is really hard to move to the cloud but the pay off is huge. For example if you loose your cellphone or your laptop, you do not have to worry about your data since everything is in the cloud and you can recover it right away. Cloud Computing is improving applications incredibly, Google translation and Google Goggles are good examples. They send the info to Google servers and they do all the work and they send you the result in seconds! that is a good way to delegate this kind of work because it wouldn't work if the application tried to use the cellphone or computer power because it is just not enough for a good user experience.

The new generation of apps need to do a lot of sharing. We do not copy anymore we replicate information a good example is chrome you do not copy your extensions, apps or themes between computers you just replicate them.

These 3 waves Computing, connectivity and Cloud computing all of them are intersecting in one place, in a cellphone. Before used to be Main Frames, owned by huge corporations that had the money to get them, then it was personal computers still expensive and not portable, but now this intersection is in mobile technology.

Some how the mobile is first now. Developers care more about mobile first, why? because it is with you all the time, it is personal, and it is yours. So the market is focusing in mobile first and makes sense there is a huge potential there. Users use their mobiles all the time, they go with them everywhere.

Anyways, the keynote was really good worth watching it and also has some demos about Google translate and Google Goggles, enjoy it :)

Monday, February 14, 2011

Block Sites from Google’s Web Search Results

Couple of days ago I wrote about how search results are becoming worse every time. This is because of all the spam around there that makes really difficult to show relevant results. The post also mentioned that human intervention is needed since sometimes an algorithm is not enough to filter real sources from spam.

It seems that Google heard that because today they released a new Chrome extension which allows users to block sites from Google's web search results. The extension is really easy to use and the information collected from the users will be sent back to Google for further analysis and might help them improving their results and gives quality search results.

The extension allows you to block and unblock sites and also edit your blocked site list by just pressing the extension icon. This is an experimental extension but it is really worth a try. We can help improving search results and stop spam and content farms.

Hard-to-Read fonds help to remember information

According to this Princeton article hard-to-read fonts make easier to remember information. They ran 2 tests to try to prove its theory. The hypothesis says that disfluency leads to deeper processing and that helps to long term memory. Small things like changing the font type, size and position can make a difference.

Although there are a couple of disadvantages, making things hard to read can also lead to frustration, disinterest and lost of attention especially in high school students. The teachers objective is to make the class easy to learn, attractive and interesting to the students so why would they try to make it harder?

I think the teachers think they have succeeded if the students learn fast and easy and they are able to get a good score but I think they are wrong I think a good teacher does a good job if the students remember what they have learned in the long term not in the short.

It is a really good article a for sure worth reading.

Saturday, February 12, 2011

How to fix cursor keys in insert mode in Vim

I've been working a lot in Vim lately especially since I miserably failed in the Linux IQ test. My objective is to remember all the things I used to do when I was using Ubuntu as my primary computer ( almost 3 years ago i think).

I started installing ssh so I could log in from work or any other computer. Obviously you only have command line there. At the beginning was difficult but then I started remembering a couple of things. One trick I really like is this one. Usually when you work in Vim you have two states: Insert mode and Command mode that is all. So when you are in insert mode by defect you start moving using the cursor keys but those do not work the same. Every time you press them it will trigger an echo character and this is just annoying. I order to fix that you just need to edit this file /etc/vim/vimrc and add set nocompatible at the beginning of it (in some cases you just need to uncomment it). And since you are already there you can also add set nu this will turn on line numbering :)

Now you should be able to use the cursor keys as usual when using insert mode. This trick works on Ubuntu, I tried on version 10.10 a.k.a Maverick Meerkat, it should work on any flavor of it though.

CR-48 Mailing List

Today I woke up and I found out that I had more than 60 emails from chrome-notebook-pilot-users group. I was surprised since it is the first time I heard about that group I did not even know the pilot program had a group.

Anyways, Reading my feeds I found out I was not the only one with this little surprised. It seems that all the CR-48 NoteBook owners were automatically subscribed to this group. Seems like a good idea even though a lot of subscribers were complaining that they started receiving these emails like crazy around 3 am EST ( that is why I do not have my cellphone in my bedroom ) .

I have not finished reading the emails, first I need to delete all the SPAM. I saw a really good ones with nice tricks and tips that I will be posting here once I finish sorting and filtering the emails.

Update.- Google just sent an email apologizing and explaining what happened. It looks like they were creating a forum for all the CR-48 owners but an user found out the group and posted an message. The group configuration wasn't ready and it sent the message to everyone and that triggered a lot of responses and more mails. They deleted the group and created a new one and if we want we can subscribe. I think I will.

Thursday, February 10, 2011

How FaceBook selects your top ten friends in your profile?


Have you ever wonder how FaceBook selects your top ten friends to display in your profile? I read an article couple days about this question and it kept me thinking. I always had the idea that it was a random thing but it is not. According to Facebook it is an algorithm that checks your account and look for the people you interact the most publicly. Like wall posts, tags in pictures were both are, notes, events, etc. I took a screen shot of my top ten friends and I tried to think what were the latest interaction I had with them and some of them seemed obvious but others not so well.

Every time I refreshed my profile the top 10 friends will change but basically just the order most of them will remain in the list, in different position though. So it seems there is also some randomness involved. It is amazing how Facebook knows who we care and who we don't. It seems scary that they know all of this but instead of feeling scary my feeling is different. I wonder how they know and how the algorithm ranks and assumes what are the things and persons I care about. Specially when there is a lot of promiscuous friendship.

People you might know for example is based on friends of your friends but how accurately is that? sometimes I see that list and some make sense but a lot of them do not. One example, how about if my friend makes friends with a complete stranger? to Facebook that means that I might know that person as well, right? but this is completely false.

So social layers are great so you can only get what you want and nothing else but it really depends on how the connections are made, promiscuous friendship can make this difficult. I do not know how other persons use Facebook but in my case I try to have it as clean as I can, no friendships from strangers or persons I have not met personally and things like that.

Tuesday, February 8, 2011

Linux IQ Test


Couple of days ago I found this link which test your Linux knowledge . There are tons of these out side but what it surprises me was that I only got 40%. I used to be good at Unix/Linux I won't say I am the best but at least I remember I could do pretty much everything I needed.

It seems that my work has something to do with this since I do not it use Linux anymore, I have one machine at home but that is just for my personal use and to test/play with it but it has been a while since I used as developer/server machine.

I really need to return to that path. I like Linux a lot and I can't allow myself to forget that.

Who wants to take the test?? ;)

Monday, February 7, 2011

Google IO Registration Open

Since today the registration for Google IO 2011 is open :) and I already registered myself. I always wanted to go to this event and I never had the opportunity, this year is different or at least that is my plan. I am hoping my work is not going to mess with this.

So, hit the link and register :) because this year it is going to be awesome s awesome that it took like one hour to register myself it seems Google servers can't hold this traffic so hurry up!!!. You can see the sessions here. The early registration ends on April 16th but I am sure It is going to be sold out way before that.

Update.- According to Vic Gundotra ( Google's VP of Engineering ) the registration sold out in 59 minutes!!!! that is insane!!!! Hope you could get your tickets on time.

Saturday, February 5, 2011

Blogger app for Android

I am testing the new blogger app for android and I was expecting more. Actually I am writing this post using it and has a lot of limitations for example you can't see your posts. You can only see the ones that you have written in the app so doesn't sync with your online blogger account which I think it is essential.
Despite the sync functionality this app some really good highlights, like :
  • You can switch between multiple accounts as long as you are the author.
  • You can obviously write and save posts as a draft if you wanna post it later.
  • You can add pictures from from camera or gallery. 
  • You can share your location in your posts if you want to.
  • And blogger is added to one of the sharing options in the sharing menu so you can share photos from your gallery.


The app still has a lot to improve but it is a good start. I wrote this post using it but only the text part since it was difficult to add pictures where I wanted, make links and format the text properly.
Anyways hit the android market and gve it a try.

Friday, February 4, 2011

Is internet getting full of spam?

Lately there has been a lot of news about Bing copying results from Google's . Each one of them published their opinions about that, from Google's part and from Bing's side. Big's basic point of view was that they have studied user's data and improved their results based on that. So for example if you use windows but you search something in Google, they will analyze the queries and improve the results.

Last night I saw this video, a discussion panel between Matt Cuts from Google, Harry Shum from Microsoft and Rich Skrenta from Blekko moderated by Vivek Wadhwa. The video is worth watching. The main point was to talk about Spam in search results and how to improve the search experience. Harry pointed out that we should see the origin of all of this and literally blamed Google specifically Google add sense. We have so much spam lately because it generates money, all those clicks are getting paid. Despite Google's efforts to improve their algorithms we still have a lot of spam and it is true it is getting really hard to get good quality results most of the results are just copied data from other pages, you can notice that.

Blekko CEO Rich, made a good point. He said that most of the times algorithms can;t solve this we need humans taking care of this. It is true that algorithms can eliminate part of the spam but most of the cases a human intervention is needed, blocking sites or add them to a black list.

For the ones who do not know how Blekko works I invite you to check it out. Its new way of searching makes some good points and it seems it has a good future if they can make it work properly.

You can watch the video here, enjoy it

Thursday, February 3, 2011

CR-48 Unboxing

Well it has been almost 3 days since I got my CR-48 courtesy of Google and I am playing with it as much as I can, It is kind of difficult when you have a job though :(
the box
some stickers

Anyways, We are going to start with the unboxing :) The package, which it has some drawings and it is really cool by the way, had these things:
  1. The instructions that were written in recycled paper which are really funny to read.
  2. Some stickers so you can personalized your notebook.
  3. A quick guide that shows you some keyboard shortcuts and tricks.
  4. A battery which is bigger than the ones I know.
  5. A power cord, really large!
  6. A card which says "if you cracked this open, you would find Intel" :) funny
  7. And of course the notebook itself
some instructions

Once you completely charge it, which takes around 2 hours, it starts loading and it asks for your information, then time to take a picture :) and finally it asks for you network connection either wifi or 3G then it starts updating the OS, that took almost one hour, it think it was downloading the entire OS which makes sense since everything is in the cloud ;). By default it comes with the beta channel which is 9, you can change to the dev channel though ( I have not done it yet ).
updating
dev channel

Once all that is completed and you log in with your Google account you can see a complete get started manual application in the browser. It is cool and guides you step by step on everything you need to know to start using Chrome OS.
get started

The process was seamless and easy no way to miss a step or do a miss-configuration, which are common when you install windows or any flavor of Linux. You do not need to worry about drivers, updates, antivirus, restoring your files or anything since everything is in the cloud.
some apps

One thing I really like it is the speed, it is really fast! from the time you turn it on to the login screen it is about 10 to 15 seconds and from sleep mode to awake it is almost instantly :)
not heavy at all :)

I will keep posting more things about Chrome OS so far I just have covered the unboxing and the first boot. I still have lots to talk about. You can check the whole set of pictures here.

Wednesday, February 2, 2011

Highlights from Android Event - HoneyComb

Today Google had an Android event to show us their improvements on HoneyComb which by the way are awesome!!! they really invested a lot of time in 2D and 3D and performance.
The couple of things I liked were:

The new android market web page is up and running. I must say it is a really huge improvement from the old one which it did not even have search! it was really bad. Anyways the new portal let's you sign in and register your devices and do over the air installations. We already saw this last year in the Google IO keynote, they should added over the air un-installations though :)

They released more ways for developers to gain more from their apps like in-app billing and currency conversations. They improved their multi touch and drag and drop functionality, a lot of new widgets which make notifications less intrusive and video chat. In fact there are a lot more things but these are the ones that took my attention. I am not really a gamer but it is worth mention that the gaming experience it is a lot better talking about speed, effects and performance.

Here is the event video for the ones who missed it, enjoy it!

Tuesday, February 1, 2011

Chrome OS NoteBook a.k.a CR-48

Yesterday I got a notification that a package arrived and since I was not home they delivered at the rental's office so this morning I went there to see what was this mysterious package because I was not excepting anything at all.

I opened it and I couldn't believe it. It was a brand new CR-48 from Google :) I was one of the few developers selected to test its new toy :)


I will post more about this, obviously, but in the mean time here are some pics.


ps. I wrote this post using my new CR-48 :)