Ubuntu on Beaglebone Black

beaglebone black

I recently recieved my beaglebone black which is an awesome piece of hardware. Checkout the specs, its an amazing board for electronic hobbyists and better in some aspects than raspberry pi since it has much more GPIOs .

Beaglebone Black comes with in built 2gb emmc card which has armstrong installed on it. But if you are like most of the linux users, you’ll prefer ubuntu mostly. So here is a step by step tutorial on how to install ubuntu on your BBB and get it up and running with LXDE desktop. Also updating internet settings if you are on a proxy.

Installing ubuntu
Go to this link : http://elinux.org/BeagleBoardUbuntu there is a very elaborate procedure to install ubuntu on your external mmc (since 2gb is a very limited space, install ubuntu on external mmc and to boot ubuntu press button on BBB near ur USB)

Once done with installing ubuntu on card, plug it into your BBB and boot it. The login name and password are both ubuntu. Log in. Now first thing you have to do is sudo apt-get update. Now for people on a proxy see below instructions rest can skip it,

So if your proxy server uses static ips then you have to set up the same in your /etc/network/interfaces file, to do so
sudo vi /etc/network/interfaces

this will open up a file, under eth0 add your ip settings

auto eth0
iface eth0 inet static
address <io address you use>
netmask <subnet mask>
gateway <gateway>

Once this is done you need to add nameserver ip in your /etc/resolv.conf
sudo vi /etc/resolv.conf

search <nameserver>
nameserver <namserver ip>
nameserver <another nameserver ip [optional]>

Once done you are good to go if  your proxy requires authentication then you have one more step to go, in your /etc/apt/apt.conf file add proxy auth details. This is a good link which explains how to do it.

Now that proxy is set up, you should try sudo apt-get update and this should run as expected

Installing ubuntu desktop
To install ubuntu desktop use sudo apt-get -y install lxde lxde-core lxde-icon-theme, this will take some while to download all the packages and ever more time to install them on BBB. Sit back for a while, if you are on a slow internet start an episode of your favourite TV series and relax. Once installed, restart your BBB and you are good to go.

Advertisements

Android UI : Fixing skipped frames

Anyone who begins developing android application sees this message on logcat “Choreographer(abc): Skipped xx frames! The application may be doing too much work on its main thread.” So what does it actually means, why should you be concerned and how to solve it.

What this means is that your code is taking long to process and frames are being skipped because of it, It maybe because of some heavy processing that you are doing at the heart of your application or DB access or any other thing which causes the thread to stop for a while. Here is a more detailed explanation –

Choreographer lets apps to connect themselves to the vsync, and properly time things to improve performance.

Android view animations internally uses Choreographer for the same purpose: to properly time the animations and possibly improve performance.

Since Choreographer is told about every vsync events, I can tell if one of the Runnables passed along by the Choreographer.post* apis doesnt finish in one frame’s time, causing frames to be skipped.

In my understanding Choreographer can only detect the frame skipping. It has no way of telling why this happens.

The message “The application may be doing too much work on its main thread.” could be misleading.

source :  http://stackoverflow.com/questions/11266535/meaning-of-choreographer-messages-in-logcat

Why you should be concerned
When this message pops up on android emulator and the number of frames skipped are fairly small (<100) then you can take a safe bet of the emulator being slow – which happens almost all the times. But if the number of frames skipped and large and in the order of 300+ then there can be some serious trouble with your code. Android devices come in a vast array of hardware unlike ios and windows devices. The RAM and CPU varies and if you want a reasonable performance and user experience on all the devices then you need to fix this thing. When frames are skipped the UI is slow and laggy, which is not a desirable user experience.

How to fix it
Fixing this requires identifying nodes where there is or possibly can happen long duration of processing. The best way is to do all the processing no matter how small or big in a thread separate from main UI thread. So be it accessing data form SQLite Database or doing some hardcore maths or simply sorting an array – Do it in a different thread

Now there is a catch here, You will create a new Thread for doing these operations and when you run your application, it will crash saying “Only the original thread that created a view hierarchy can touch its views“. You need to know this fact that UI in android can be changed by the main thread or the UI thread only. Any other thread which attempts to do so, fails and crashes with this error. What you need to do is create a new Runnable inside runOnUiThread and inside this runnable you should do all the operations involving the UI. Find an example here.

So we have Thread and Runnable for processing data out of main Thread, what else? There is AsyncTask in android which enables doing long time processes on the UI thread. This is the most useful when you applications are data driven or web api driven or use complex UI’s like those build using Canvas. The power of AsyncTask is that is allows doing things in background and once you are done doing the processing, you can simply do the required actions on UI without causing any lagging effect. This is possible because the AsyncTask derives itself from Activity’s UI thread – all the operations you do on UI via AsyncTask are done is a different thread from the main UI thread, No hindrance to user interaction.

So this is what you need to know for making smooth android applications and as far I know every beginner gets this message on his console.