Monday, 1 November 2010

Ubuntu Server as Inexpensive Platform for J2EE

Due to the very small budget of the project I had to find a good but inexpensive platform. The development server is an old single core single CPU Pentium 4 pizza-box with 200 GB hard disk. The productive environment will be much better, but OS and middle-ware should work out-of-the-box and require a very little maintenance.

Friday, 8 October 2010

Network Management on Fedora 12

Recently I had to activate a second network interface on a Fedora 12 installation at work. The server has two interfaces (eth0 and eth1) but only one (eth0) was active and allowing connections from in-house only. The project wishes to provide a preview to the customer so I had to move the server to the DMZ. To avoid collisions between my work as system administrator and the development team I decided to activate the second interface(eth1) for the DMZ.

Sunday, 8 August 2010

Android 2.2 Froyo on the HTC Desire: first experiences

I did upgrade my HTC Desire from Android 2.1 to 2.2. It's possible to force an upgrade without waiting (settings -> about phone -> system software updates -> check now).

Friday, 23 July 2010

Holidays in Italy with Android

Last month I did spend some time searching the best rate for using my smartphone in Italy.

Thursday, 8 July 2010

Developing with the Android Emulator: the Beginning

The documentation on Android Developers is very well done, but there is a lot of informations. Often the informations I need are spread over many different pages.

A quick setup for the development environment is easy to find. There is a lot of good sources about how to setup the virtual device, how to create a new project using the IDE and so on. What I missed is a collection of practical advices.

Tuesday, 22 June 2010

How To: GIT repository on Solaris 10

Last year I did replace my SVN software repository with GIT.

Last moth I began to use GIT also at the office because I will be able to roll back the experimentations sometimes I do in my projects. The history of the Eclipse IDE isn't enough to archive the goal. GIT creates locally a full featured repository with tags and branches. Any time I may switch to a different branch, so I may work, at the same time, on the mainstream and on the experimental features.

Tuesday, 15 June 2010

Blogging with Android: Blogaway, Wordpress


Last month I decided to buy a smartphone. I'm a UNIX developer since long time: my choice the HTC Desire.

Display

The display of the smartphone is limited in space. The layout of my blog on Blogger may be squeezed and is readable even with the zoom function.

The layout I use on Wordpress isn't readable on the smartphone, but the mobile site of Wordpress is really good.

Blogging

At the beginning everything seemed unconfortable, but once I did understand how to work, what to select and in which sequence bloggging was easy.

Blog-Away

Blogaway is a Blogspot client for Android. It's everything I need to write down my ideas.

This article was written using the smartphone and Blogaway travelling by train.

Each article may be published as draft and improved later on the PC. The text may be formatted using bold, italic or a color. It is possible to add links, pictures and videos. You may scroll the text very quickly. I like this application because it is simple and efficient.

You may find more informations about Blogaway on blogspot.com or on  Twitter.

WordPress

Read my article on Wordpress

Conclusion

Bogging with the smart-phone is possible as additional way to add articles. It is suitable for short and simple text.

If a blog is readable or not depends on the theme.

Posted via Blogaway

Monday, 5 April 2010

Small J2EE Fedora Development Server On Amazon EC2.

In the last 10 years I used a LINUX server at home to develop my private applications. Twice a year I spend a weekend to update/upgrade the server. Now I should replace the old hardware with a newest one.

Instead of buying a new server I decided to search for alternative solutions. Due to the small amount of time I really use the server, the solution have to be cheap. At the same time, due to the kind of experiments I do, I need root access to the instance.

I signed up for Amazon S3 and EC2 to be able to run a LINUX AMI. The first question is: where may I find a Fedora AMI?

The best solution for me seems to be a self defined AMI built using Elastic Server. My server is based on Fedora 10 and contains the JDK 1.6.0_13, Tomcat 6.0.18, PHP 5.2.6, MySQL 5.0.67 and Apache2. Almost the same configuration I use at home.

Elastic Server build, deploys and starts the AMI automatically. I had to define a S3 bucked, something like daniele-ami where the service will copy the image of the AMI. The builder needs to access my account at Amazon to store the image and start the AMI, so I define a dedicated Access Key. As soon as the new instance works I disable the dedicated key. The key may be re-enabled each time I want to deploy a new AMI.

Elastic Server sends an email to the account owner containing all the informations to access the the running instance.

The login (cftuser) may be performed using PuTTY (Windows) or ssh (UNIX). To gain root access I have to use the command sudo su - . A quick check of the environment confirms that everything works as expected.

Add a Data Volume

Since I don't work with a reserved instance when the instance terminates all changes made after the startup are lost. To reduce the inconvenience I define a 10 GB EBS volume using the AWS console. Note: the volume have to be defined in the same zone as the EC2 instance.

The volume is attached as device sdf (/dev/sdf)

Now the procedure is the same used to add a disk to any LINUX system:

  1. Use fdisk (fdisk /dev/sdf) to delete all existing partitions (select d).
  2. Save the new (empty) partition table (select w).
  3. Add a new partition (select n).
  4. Save the new partition table (select w).
  5. Use mkfs (e.g. mkfs -t ext3 /dev/sdf1) to format the patition.
  6. Use tune2fs (e.g. tune2fs -L /data /dev/sdf1) to put a label on the patition.
  7. Create the mount point (e.g. mkdir /data).
  8. Modify the file /etc/fstab as displayed into the next section.
  9. Mount the partition (e.g. mount /data).
# /etc/fstab: static file system information.
# AMI version
#
# 'file system' 'mount point'   'type'  'options'       'dump'  'pass'
/dev/sda1       /               ext3    defaults,errors=remount-ro 1    1
/dev/sda2       /mnt            ext3    defaults        0       0
/dev/sda3       none            swap    sw              0       0
proc            /proc           proc    defaults        0       0
none            /sys            sysfs   defaults        0       0
none            /dev/shm        tmpfs   defaults        0       0
none            /dev/pts        devpts  gid=5,mode=620  0       0
LABEL=/data     /data           ext3    defaults        1       2

After a new start the last three steps of the previous list have to be done again to remount the disk. I do it using the following script:

#!/bin/bash
mkdir /data
echo "LABEL=/data     /data           ext3    defaults        1       2" >> /etc/fstab
/bin/mount /data

Execute:

  • sudo su -
  • vi setup
  • copy & paste
  • sh setup

The cost for an afternoon of programming and testing is $0.40 which is really cheap.