Portrait and Landscape Layouts

While you are developing your mobile application, you always have to think in the user side, and how your application will provide fast and quality results (those could be data, screens, services, etc) for the user. Not only think in HOW, but envision if is going to be that effectively. Now we got the point. One factor that always influences users of the way they see a game or an application is the way of the screen is disposed.

When you are developing your application, Android framework make it easy for you. You just do your application, and when the cellphone go to landscape, is a different the way you have thought. And everything could be changed of place, it would be not aligned as you designed and a headache just starts.

I will show will, a little application and the way it behaves in Portrait and Landscape. And a way to define your Landscape as you wish.

Here, we have a simple application, a Temperature Converter:

Here. The Layout is set up to Vertical. At this point no problem. But when you turn to landscape, it follows what you have done.

You could this using LinerLayout, TableLayout whichever you want is fine.

Here, I just used the LinearLayout.





See. It just followed what you have set up for the application.

However if you wish to be different in portrait, or landscape, what do you do?






Here we have all the packages that are created when you just created the project.

You see the layout/main.xml , right?

So we should add another layout, the landscape layout to have a “dedicated” layout to landscape. How do we do that? simple!!

So, just create a folder called layout-land to define

your layout and create the main.xml inside.

This main.xml, could be totally different, you could

include more features as well.

But if you want just change the layout to other way

you think is better for the user, you do it.




Here, just a new Landscape layout:

If you noticed, the TextView is different, and the way that components are disposed on the screen too.

Here, I just used other type of Layout, the TableLayout.

This means, you can do your own screens in different ways, or use different resources/components to cause a better impression and usability for the user.

Some mobile applications have better view in Portrait, while others have better view in Landscape. It means, depend of the goal of the application. What it is going to show to the user and if what is being shown is the best way to do it. Sometimes, the way the components are disposed is the key, though. Facilitate the view to the user is always welcome. As I said, it could vary from the simplest application to the most complex.


Android !

What’s up!!!

Did you know what is Android?

If you are a beginner you can start here, if you have notions about programming and android you check here out.

I would say Android is not only a Operating System for mobile devices, but with many frameworks and applications involved in it, we could call it a software stack. This Stack is composed by Frameworks, applications (e.g: Browser, Caller, games, etc),  Virtual Machine (The Dalvik),  mobile devices features (Camera, 3G, EDGE, Touch Screen, GSM or CDMA TEchnology, bluetooth, Wifi, GPS, accelerometer, etc) and in addition a development kit for developers. The SDK for developing and debugging . And the great point in all of this, it is free. An OPEN DEVELOPMENT PLATFORM.

Many companies are adhering Android in their phones like Motorola, HTC, Sony Ericsson, Samsung, etc…

IF you want to start in android world you will need 4 basic things. Eclipse IDE, where you are going to develop android apps, your own apps. Sun’s Java Development Kit, The JDK The Android Software Developer’s Kit (SDK) and the Android developer tool (ADT), the plugin for eclipse (this last one you can download and install by eclipse).

First, Download All those 3 software. Then Install the JDK (whether you do not have it installed).

Download Eclipse and the Android SDK.  If you running on Windows both are going to be zip files. Extract them separated, each one in its folder for example:  C:\eclipse and C:\android. It is just up to you.

One step for windows, you have to edit your Enviromnet Variables and add the C:\android\tools to it.  How? simple.

Right click on My Computer and go to properties. There find the System Properties and then Advanced System settings (or in WinXP just the tab Advanced). The in the second box you look for a variable called path. Click on it and edit it. In the end add the address of android tools. If you have followed my example would be C:\android\tools . This is necessary to make it easier to launch Android tools.

Ok. Time to start Eclipse. Just open it.

Go to Help -> Install New Software

Now click in Add, and then add the android address :

In the Locations you can type: https://dl-ssl.google.com/android/eclipse . Click OK.

The Developer tools will appear. check check it and click on NEXT.

You have to accept the terms of the license and then click Finish.

Restart eclipse.

If you do not get a warning about the plugins are not installed (if yes just install all) go to the Window -> Preferences and then Android as the pic bellow shows



Here you have to add the Android path to eclipse recognize the android API.

When you do that you already can start a New Android Project. But when I do a application I should see a cellphone screen and see my application running in it, right? yeah. So, is it already set up? Let’s check if everything is ok!

Go to Window -> Android SDK and AVD Manager ; Here you will see the packges and the Virtual Device (what would be the cellphone). First Check the packges. If they are not installed, check them and just click install. After that Go back to the Virtual Devices to create a new AVD (Android Virtual Device).  Click New. Then type the name of the AVD, I suggest ” my_avd”. You have to choose a target. The target is the API that you are going to use in your AVD. We could see as Android versions.

Select the version that you want and click “Create AVD”.

Ok. After you Configure the Android development environment is time to start.

Go to File -> New -> Project ; Click in Android Project

Look the image bellow:

First, you have to name your project. We could start with a HelloWorld.

Second, choose the Android API in the list Build Target. There, you will see many Android “versions” and choose any you want to start your project. I recommend you choose the same as you have chose when you configured your AVD.


Then you have 4 fields in blank.

The first one is the application Name. It has to have a name. HelloWolrd.

The name, you will see in the Android menu. The name of your application.

The Second one, the package.  Your application have to be in a package. And the name of this one has to have at least two identifiers. E.G:  android.helloworld or firstapp.android. It is just up to you what name it.

The last, that you need to fill out is the Activity.

—–  Brief explanation  —–

The Android Application is composed by four components. There components are defined by Android architecture.

Activities, Services, Broadcast and Intent Receivers and Content Providers. This post I will talk about the Activities. In the future I will talk about the others. But if you want to read about them, just check this link.

When you create an Android application, your application always have to has an activity. Even a “HelloWorld!”  has one. Activities are that chunk of code running in time. For example, Screens; Each activity shows one screen to the user. If one Activity is not being used, or not actively running the operating system can kills it, so it can conserve more memory.


So, the name of the activity is HelloWorldActivity .

Then click on Finish.

Ok. Now you just started an Android Project. You have your first application ready to run.

Before you run it. Let’s take a look at what we have.

In the src (the source) folder, we have the package that you name it as you wanted.

I just named blog.helloworld . And bellow this directory we the gen folder. It is where you will find the R.java .That is all resources from res directory in Java.

Then we can see the Android library. If you click on it, you will all jars that composes the android library that you have chose before during the project creation.

As a resource, you could have any images, bitmaps, or whatever you need for your application.

The layout tells android how dispose items, things on the screen when applications runs. You can check it out, and you will see a XML file.

Values are outside the source. You can use them anytime. What is this? Values are constants, strings, etc..

At last, we have the manifest. The manifest a XML file too. This file defines all components in your application and tell Android about all components that exists in your application.  So, it learn and know about all components in your application before build it.

Now, go to the strings.xml file. And just edit the line that you see HelloWorld. This is going to be the output. You can see in the next line. The name of your application.

Right click on the project and then click on Run As -> Android Application

Pan, Pan Pan Paaaannn!!!

Now the your application is going to run in the emulator, the AVD that you have created.

The Java is going to start too.

You will see that the emulator is like a virtual machine.  So you will see a cellphone on your screen. Just go the menu and find your application and click on it. It will start to running and congrats, you made your first Android App!!

to start Apache at Ubuntu

Always when I turn on pc pc, boot in ubuntu 10.04 all of services that I need and I use are loaded automatically…

So, some day ago this could not happen anymore… better, this it was not working anymore…

I use often apache server service to my web applications … and one day it was not working..

I will show you what I did …

I opened the Terminal and typed:


its show to you all proccess are running in yout machine and its features like pid, time, name, etc..

I did not see the apache there..

I just looked for apache and started it:

from there the apache server service start to work at your pc…

if you are using windows you hace probally xamp, amp or whatever you need to set up and do that every time you want to use it.. or set up to start when you pc is turning on….

On Ubuntu it starts automatically … so, if you miss apache in yout pc, try this…

Ubuntu, network interface and problens

I was very upset today, at the moment.
My ubuntu, more precisely the gnome, messed the whole network interface and now I can no longer get access to wired connection…
It seems any more windows viruses than a problem for gnome / ubuntu.
hooooooowever, I’ll show what I tried to do and the procedures for configuring my network interface. Hope that helps someone, because I did not help much. only in the end I hace success.
for you to view the network interfaces on your computer:
sudo = to superuser
sudo ifconfig-a
For you to edit network interfaces:
sudo gedit / etc / network / interfaces
here you will open the file interfaces .. gedit is the editor of textual, you replace it with vi, vim, etc …
in my case I put it in the file,
# The loopback network interface
auto lo

iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192 168 143 169
or to set up direct ip do this:
sudo ifconfig eth0 netmask
remembering that eth0 is my network interface is eth0,
I thought I could set up so I went on board and was like, friends here at work said I was right,
hoooooowever, to no avail ..
Then I edited the file sudo gedit / etc / network / interfaces
and left it like this:

auto lo
iface lo inet loopback
# The primary network interface
auto eth0

ready, wired connection back to work …
why have stopped working is still a mystery ..
I’m going to find out why .. but I hope it could be help…I almost lost a day trying to find out to solve it..


Dtrace on OpenSolaris

I’ll talk a bit about …. Dtrace
That it?
A wonderful tool that has the OpenSolaris to monitor your entire system ..
How so?
DTrace is intended to monitor everything, when he said, is all the same, on your computer, what programs open (that’s already doing it or other OS software), network status, hardware, file behavior, attendance, monitor what’s Threads system are running, are in the queue, which will still be called (I want to see an OS or proprietary software to do this !!!), see what is happening in the kernel, you can see EVERYTHING in detail, as called processes, modules, functions,DWI!!
According to wikipedia “… The kernel of an operating system is understood as the core of it, or a literal translation, core. He represents the software layer closest to the hardware and is responsible for managing the resources of the computer system as a whole ….. “So if you can see what the kernel is doing through the Dtrace, you really can correct mistakes and so walk to an ideal operating system (Theoretically )!!!!
To get a better idea, the Dtrace group explains that “… DTrace is a framework created by Sun Microsystems for Solaris 10 that gives the system administrator a way understandable to monitor and track all internal operations of each process or Routine system, becoming a powerful tool for advanced diagnosis of problems or enhancements ….”
The cool thing is you monitor what they do, such as what processes you use when you start x software. What about this all you have on hand and see that performance, see problems or failures that can be repaired even by yourself.
In this link (Click Here) Sun you find a book about DTrace and a good detailed explanation of what he is and does!

To make a script to run dtrace you have to write in Language D. Yeah, that’s right, D. Language But that is not a big deal not, is quiet.
A small example from the terminal Opensolaris …
Open terminal and type

cat hello.d
#! / Usr / sbin / dtrace-s
trace (“Hello World \ n”);

Ready program is done in the / usr / sbin / dtrace-s command is to create the script
and to run the command type
dtrace-s hello.d

Here is the output!!

It is a simple example, but you can see that is not as difficult goes like only a matter of habit with the language.

So with this example and encouragement that Dtrace is the best tool for monitoring and optimization of the Solaris and OpenSolaris, just start playing!
I hope it helped and have any questions just email or post comments!

Here you can find a “How to” DTrace is a very good material for those just starting out and want to understand more about this powerful tool!
Click here to download!
And here the Potal BigAdim Sun has plenty of tips and materials!

How to install VirtualBox 3.0 on OpenSolaris

The difficult is…have more than 1 file to install…..
We, frequently see one file to install, but now we have two files.
one for interfaces like usb, boot order, cd image, it is kernel interface package…
and another only VirtualBox.
Here is the snapshot, step by step to install it. Then here we have the pkg..we are extracting it to some directory ( what you want).

We can see 4 files.
2 is .pkg, so we need it.

After you extracted you can open the terminal and go to the directory which you extrated the files.

As we can see. we have 2 files.
WE must “execute” first the VirtualBox.Kern….

pfexec pkgadd -G -d VirtualBoxKern-3.0.2-SunOS-r49928.pkg
You say “all”, to install all of it.

Now you install the second pkg,

pfexec pkgadd -G -d VirtualBox-3.0.2-SunOS-r49928.pkg

The first file is VirtualBox kernel interface package, you must install it first!!!
After you install the main VirtualBox package:
VirtualBox working!!!

This installation I did because I had no internet connection… I have a cd wich has many software to install on OpenSolaris…. but if you have internet connection I will post later how to do that in a repository from Sun… (you be registered )…

How to install OpenOffice on OpenSolaris


After we have installed the OpenSolaris Operating System, now we will install the OpenOffice…

The easier way to do this, i think… 😀

So, lets go!!!

You can download the OpenOffice clicking HERE!!!!

After you downloaded the OpenOffice, the instalation package you can open it or put in some directory in your pc …

In this tutorial that i made, i copy from cd to desktop…

I ‘ve copied to desktop and after to /export/home/renato/download… this was my preference..

You put the file where you wants…. anyway will install it… After copied you can open it the file.tar.gz and copy the directory which is inside that .tar.gz and paste where you wants.. thats directory which contains the source… you, basicly, are unzinping the file.tar.gz and taking hte directory…

Now, you can open the Terminal, wrtite su, write your root password and star to install.

Now look what i did…I entered in the directory which the is the file…
cd local of package
and now i wrote :
pkgadd -d. (dont forget the dot)

now, you will see the packages and after the question if you wants all packages..
I said “all”, to install all packages of OpenOffice ….

After this it will question you about the instalation and you say “yes” to all….
Ready.. the OpenOffice was installed….

P.S. If you download it by manager packages, it does all of it only using clicking!!
In the list of packges you search for openoffice and click to download. Automatically it is been installed…
No complications!!