Install ANDROID Development Tools (ADT) on Ubuntu 10.04 (and Eclipse)

I recently installed eclipse 3.6 and Android Development Tools (ADT) on my fresh Ubuntu 10.04 install. I followed the excellent and simple Installation tutorial here. Installing Eclipse is as easy as downloading it from the official Download page (http://www.eclipse.org/downloads/) and extracting it to a desired folder. I chose the Classic Eclipse 3.6 download and I created a folder in my home, called /home/thierry/Applications.

To install the ADT in Eclipse 3.6, the official instructions can be found here, go to HELP > INSTALL NEW SOFTWARE. Enter the address  to WORK WITH:

https://dl-ssl.google.com/android/eclipse/

Click OK. Then Select ‘Developer Tools’ to install Android DDMS and ADT. Then click NEXT followed by FINISH. At that point I am now sure if I had to restart Eclipse, but as it is suggested, do restart Eclipse.

Install ADT in Eclipse

Start a new Android project under FILE > NEW > Other > Android. The Project Name would be HelloWorld, as Build Target I choose Android 2.2. Scroll down to find the Application Name: Hello Android and the package Name: com.yourexample.helloandroid. A first Hello World program is as follows

package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
tv.setTag("Hi freaks, look at me");
tv.setText("Mama");
tv.s
setContentView(tv);
}
}

To run the code and test the application, you don’t need to have an android device, but you can use the android emulator. Use RUN > RUN AS > ANDROID APPLICATION and the emulator should show up, it might take 1 minute to boot!

Android Emulator

Of course this is not what you have done in your HelloWorld, but to test your Android application you need to boot Android first. Play around with Android and go to Applications to find your Application called Hello Android. Click it to launch your Hello World.

P.S.: I have a problem that auto-complete in Eclipse with ADT freezes as soon as for example “tv.s” is written in the editor. Apparently this bug is related to xulrunner, but not for sure. This bug is however very annoying making development impossible. For a Java file the auto-complete is however working fine.

Where to go after the HelloWorld? Go to the official documentation site for Android project, the page with sample code,

welcome to luxembourg

i am back to my native land, after 3587 days in switzerland and chad, after studies and work. no job, no (own) place, no social security, but yet motivated to find a job in this small piece of europe.

right now i got one denial after a phone interview from chad with luxembourg based amazon (which costed me 150 €). they asked me the usual java questions, like what is the difference between an interface and an abstract class, how would you implement this and that? i have another job interview at a research center in luxembourg, apparently it is going to last 5 hours.

luxembourg skyline in a sunset

there are many job opportunities for IT, software developers here in luxembourg, but most of them are for consulting or banking companies, which are not yet in my field of interest. a good place to look for jobs here is online at monster and jobs.lu. many companies are based in luxembourg, like ebay, skype, amazon, paypal…to name a few. but they mainly are based here in luxembourg to (not) pay their taxes. as it seems however some of them are starting some projects at their luxembourg based sites.

Adding Flattr

Flattr is a new micro-financing system allowing to easily give a small amount of money (they call it love) to things you like on the net. i really appreciate every effort to move away from an ad driven world, so i added their button to my site. with wordpress it is really easy to integrate flattr buttons to sidebar, posts and pages using the flattr wordpress plugins.

still in beta status, there are not many things to give love to, and even though money can easily be shared it will be very hard for flattr to gain a ground in the internet world. only users of flattr can give their love, which is only available for invited people. i guess i will use my 2€ per month and honestly i am not hoping to receive a cent.

i still prefer other ways to give love to online media publishers, i still appreciate the old fashion way of leaving a simple comments. to give me love, just read my stuff and leave a comment

Getting started with VALA

While browsing and looking for news in the open source world, I came to find about VALA.  A ‘new’ programming language created to design and implement applications for GNOME. VALA has built-in features GObject, GLib,… VALA is translated into C code and apparently it is very efficient C code (benchmarks) So I wanted to dive into VALA and find out more about it…Documentation and blog posts about VALA are rare, except for the official language description page, and even though the people seems to be very active on the project (Version 0.8.0 released in March 2010) the information on it is limited. The standard documentation is rather good online and on the site of VALA may information can be found, however as soon as something goes wrong no information is available. So I want to describe here my experience setting up the environment to compile and run my first VALA program.
I prepared my Ubuntu environment with the following packages
user@computer:$ sudo apt-get install flex lex bison yacc glib gobject-introspection libglib2.0-dev
You could install the version of VALA from the Ubuntu repositories, but the version for Karmic is 0.7.6 and apparently this version contains some bugs.
Rather download the latest version of VALA from here, the version I have been using is version 0.8.0. To install VALA you need to use the standard method, extract the files to a folder, open terminal in that folder and then use first,
user@computer:$ ./configure
, second,
user@computer:$ make
and last,
user@computer:$ make install.
So I tried the Hello World example (from here):
using GLib;

public class Sample : Object {
public Sample () {
}

public void run () {
stdout.printf ("Hello, world!\n");
std
}

static int main (string[] args) {
var sample = new Sample ();
sample.run ();
return 0;
}
}
However trying to compile it, I get the following error message
user@computer:$ valac -o hello hello.c
valac: error while loading shared libraries: libvala.so.0: cannot open shared object file: No such file or directory
Clearly the compiler could not find the libraries, however they were exactly where they were supposed to be, namely in the directory /usr/local/lib. To correct the error at compiling time, I had to run the command
user@computer:$ sudo ldconfig
to update the linkers to dynamic libraries.
I use gEdit together with Valencia plugin to write VALA code and I also want to try out the Vala Toys for gEdit. However with the latest version of VALA (0.8.0) the current version of Valencia 0.2.1 is not compatible with version 0.8.0. You need to check out the latest version from the development trunk of valencia via Subversion, where additional information on the plugin is available.
After that the hello world compiled just fine. I am curious to see where VALA is taking me. Many bindings exists for GTK+, Cairo, Clutter, GNOME,….

Valencia AutoComplete

Go To Definition of a Method or Class

Arte+7 Downer (Download and Streamer) for Python and Linux

Note:
The following application might not be legal, and ARTE did not respond to my messages to ask if it is legal to download their videos on Arte+7. The following application was created as an educational project, and will not receive further features or other development from my side (at least until the legal issue is clearly solved).

Download Python Script

The Arte+7 Downer got inspired from the arte+7 Recorder. However this excellent application is missing some desired features, like saving the description of the downloaded video and the corresponding screenshot. Further to preview a video it is necessary to start the download of the video.
The idea was born to create this small script because I wanted to create something other than a ‘Hello World’ in Python and I wanted to be able to stream Arte+7 videos in fullscreen mode in my favorite video player. Arte+7 have interesting shows which are available for streaming online for  7 days. However it is only possible to view the shows in the browser on their website. The code is a mess and it definitely is not very beautiful, but it works. I will try to clean up the code some day.
The usage is pretty simple, first download the script and you need to have the Python modules html2text, urllib2, StringIO and it uses the mimms package to record the video stream. To run the script simply type python arte7.py in your terminal. Or to make the file executable Right-Click the file and enable “Properties > Permissions > Allowing Executing File as Program”. After that simply double-click the file to start Arte+7 Downer. The application does only work if there is an available internet connection (or if the arte+7 page is available).
The main window contains just a list of the online shows with the date they came online and the date they will be removed. To select an item double-click on it.

Main Window

A window with details on the selected item opens and you can either select to view the video or to save it (default folder $home/Videos/Arte+7/). The ‘Save Info’ Button saves the description into a text file and the image as a jpeg file into the same folder as the video file under the same name (with different extensions).

Detailled View with Control Buttons

That’s it, the code is a mess, as it is quite difficult to extract the mms URL from the Arte+7 site. Have fun looking through the code and watching Arte+7 in a real video player.

On Software vs Architecture

Software contains bugs! And we are used to it, but we shouldn’t accept it as a truth!
I am currently working on my PhD thesis (to finish it at last) which is on the subject of the underlying automata of model checking. Model checking is a formal verification technique used to proof that a system is correct, meaning that the system is satisfying given properties. This technique is already used much for software verification in some fields like flight engineering. The software of the Airbus A380 was verified using formal verification methods.
The understanding of formal verification methods is pretty advanced in Science, however the practicability of formal methods to the average programmer is close to zero. A verification of a random program would require like 10-20 times the time it took to write the original code. It took more than a year to a team of specialists to verify part of the A380 software. It will take years before formal methods are build into compilers that will help the programmer with its job to provide a correct program.
Bugs are mistakes, coding errors or design errors, made at some point during the development of the code. We have grown from a point were complaining about bugs in the OS was a daily routine(Windows 95) to a point where we actually are online long enough to notice bugs in software or hardware. Small devices are growing to complete computers (iPhones, GPS,…), and the number of processor is increasing per machine. Asynchronous processes and other requirements of clients make the situation worse, before we can make it any better.
In architecture, an architect designs the plan of a building, the architect has a diploma and he was trained to design plans. After the architect has finished his job, the plan goes to an engineer who is responsible for verifying the plan. He does some calculations about stability, controls the materials used and either gives a go or gives it back to the architect to redesign the plan. But only after the engineer gives his OK, the plan gets reworked to get a plan for the workers, with millimetre precise plans. After those plans are done, the real construction starts, getting on the place where the final building should be standing. During the whole process the architect controls the execution of the work, discusses issues with the workers on fields, try to discover problems before they are in stone…Finally the architect has all the responsibility of the final result.
Sometimes before the final construction, the architect creates some prototypes of the whole house or of some parts, and even the engineer for some special constructions creates prototypes of some parts to verify their properties.
I don’t want to analyse the process of software design, but as a programmer ask yourself if you want to live in your code. Software should be created more like buildings, get a plan first, you are allowed to use prototypes during the plan making phase. However give the plan and not the prototype to an engineer would verifies it. Then start the programming, but as soon as issues arise, stop the process and choose a solution before it’s too late to go back (and the walls around are too high).
Of course for software the comparison with buildings is not true for most of the software, that’s why most software engineers or programmers don’t respect the process. If the program in contrast to a building contains bugs, in general no lives are at risk or only a limited amount of money.
Some famous ‘BUGS’ from Software and other Space:
  • Russian Venus Lander (VENERA from wikipedia): The Venera 9 and 10 landers had two cameras each. Only one functioned because the lens covers failed to separate from the second camera on each lander. The design was changed for Venera 11 and 12, but this made the problem worse and all cameras failed on those missions.
and even better:
  • Venera 13 and 14 were the only landers on which all cameras worked properly; although unfortunately, the lens cap on Venera 14 landed exactly in the way of the soil compression probe.
  • NASA Mars Lander: NASA lost a $125 million Mars orbiter because one engineering team used metric units while another used English units for a key spacecraft operation,  ~ cnn.com
  • Pentium Bug: The Pentium FDIV bug was a bug in Intel’s original Pentium floating point unit (FPU). Certain floating point division operations performed with these processors would produce incorrect results. According to Intel, there were a few missing entries in the lookup table used by the divide operation algorithm. ~wikipedia.org

Spreading the Word (Create a Ubuntu based Linux-Distro from Local Repositories)

In Chad since January 2009, I was desperately looking for a way to get people to consider Linux as an operating system. 99% of the people still use Windows XP SP2 as primary operating system, mainly because getting hacked versions of Vista is kind of difficult. People use an operating system which is basically 9 years old, with an update SP2 from ????. Every computer in the city and I guess in the country as well are infected by viruses or other malicious code. And some viruses recently are starting to make USB sticks unusable by setting them to write protected and erasing the partition table. I can recover the documents, but yet the stick remains unusable. A computer in Sarh generally gets reinstalled every 3 to 4 months and with the malicious code, most of the users documents get erased.

The main reason why people should use a Linux version is that they can focus on working instead of getting rid of the viruses. Many attempts from last year failed, because the only distribution I had on my was a simple Ubuntu installation CD. However the users want to listen to MP3, want to watch movie, want to convert video and music to put it on their phones… And Ubuntu by default has not much to offer for the users here. Of course everyone can add packages, however evaluating the costs for the Internet connection, this means like an investment of hundreds of euro to get the necessary packages. To note that copying music and videos from a device to another is actually a huge business here, so the necessity of those packages is not just for fun. After my 2 months stay in Europe for November and December 2009, my first idea was to bring down the repositories on a local HD , however when I was down in Sarh again, a much better idea came up. Instead of teaching everyone how to install new packages and that everyone has to buy 8 DVD (quite expensive here), I though, just add packages to the install disc and get rid of those packages which are not useful here, like translations. This means I decided to create my own distribution disc based upon Ubuntu 9.10.

After a quick study on Bing I noticed that the existing tools to help you create your distro, require a decent Internet connection to download the additional packages.(UCK, Reconstructor,…) So none of them was of any use to me. However I came across this excellent tutorial on the ubuntu wiki, showing step-by-step how to proceed to end up with a working Ubuntu based distro. And here it was possible to change the sources such that I could use my local repositories to install additional packages.

The installation DVD holds now 1.4 GB of packages, and after an installation you are ready to go, no additional work is necessary. Ubuntu brings back sound to computers, where audio drivers were missing, Ubuntu brings a nice working OS without troubles with viruses (with viruses running around here) and even people with few computer knowledge are able to install Ubuntu, where right now some people ask like 50 euros to install a hacked version of Windows XP. I started with 2 of my projects, two one-man businesses on the local market copying music to phones, memory cards or MP3 players, before their computers had massive virus problems and the viruses caused many problems as their clients hardware was infected too.

For 1 month both startups are using Ubuntu, which gives them more working hours per week then before with Windows XP, as often the computers had to be reinstalled. And then from there the word is spreading by itself, right now after one months the installation of Ubuntu in town has ‘exploded’ and right now there are more then 10 computers of which I know running fully on Ubuntu. People recognise no more virus problems and no more driver issues, and people can decide!!