<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5088282793500653080</id><updated>2012-01-27T14:01:16.469+01:00</updated><category term='mobile'/><category term='url'/><category term='mail'/><category term='Fedora'/><category term='MacOSX'/><category term='development'/><category term='zattoo'/><category term='maven'/><category term='manager'/><category term='service'/><category term='prepaid'/><category term='inexpensive'/><category term='GIT'/><category term='configuration'/><category term='italy'/><category term='PuTTY'/><category term='spring'/><category term='rss'/><category term='Solaris'/><category term='tv'/><category term='EC2'/><category term='ricarica'/><category term='repository'/><category term='backup'/><category term='shortening'/><category term='hspa'/><category term='flash 10.1'/><category term='edge'/><category term='tim'/><category term='gsm'/><category term='ssh'/><category term='ElasticServer'/><category term='toscana'/><category term='wordpress'/><category term='archetype'/><category term='mvc'/><category term='application engine'/><category term='android'/><category term='PostgreSQL'/><category term='mime4j'/><category term='software'/><category term='Linux'/><category term='blogaway'/><category term='server'/><category term='shorturl'/><category term='network'/><category term='Ubuntu'/><category term='iptables'/><category term='blogging'/><category term='Fedora-10'/><category term='J2EE'/><category term='froyo'/><title type='text'>Daniele's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-6527383477709521338</id><published>2012-01-22T16:00:00.000+01:00</published><updated>2012-01-22T16:08:54.057+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='service'/><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='inexpensive'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='mail'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>Inexpensive Development E-Mail Server</title><content type='html'>A common issue using the company e-mail server for development is SPAM which, sooner or later, will reach the customer or a third party. To avoid the problem I did use a very good dummy e-mail server the  &lt;a href="http://sourceforge.net/projects/dumbster/"&gt;Dumbster&lt;/a&gt;. In May, last year, I had to send HTML formatted mails from my application and test the result on the most common E-Mail clients.&lt;br /&gt;&lt;br /&gt;The Dumbster wasn't enough anymore, but I didn't want to install/configure a true e-mail server and maintain it. My new choice is Apache James because it is quite simple to setup and use. It supports MSOutlook and Thunderbird (and many other which I didn't really check).&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm hosting the the code I'm describing here &lt;a href="https://github.com/shortfastgood/toolbox"&gt;@github&lt;/a&gt;. To run the script successfully you have to place the files &lt;a href="https://github.com/shortfastgood/toolbox/tree/master/apache-james-v2/configure.sh" target="_blank"&gt;configure.sh&lt;/a&gt;, &lt;a href="https://github.com/shortfastgood/toolbox/tree/master/apache-james-v2/apache-james" target="_blank"&gt;apache-james&lt;/a&gt; and &lt;a href="https://github.com/shortfastgood/toolbox/tree/master/script-commons/conflib" target="_blank"&gt;conflib&lt;/a&gt; into the same folder.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Customization &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The core of the implementation is the procedure &lt;i&gt;apache_james_v2&lt;/i&gt; (see &lt;i&gt;conflib&lt;/i&gt;).&amp;nbsp; The script check if the SUN JDK is already installed, if not try to install it. To skip this step comment out the line containing &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;sun_java&lt;/span&gt; at the beginning of the procedure.&lt;br /&gt;&lt;br /&gt;The server will be started using the newly created account of the user james. The user james doesn't have the permission to bind a listener to a port less than 1024 so I have to increase the port numbers as follow:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter:false;"&gt;. . . &lt;br /&gt;sed -i s/'&amp;lt;port&amp;gt;110&amp;lt;\/port&amp;gt;'/'&amp;lt;port&amp;gt;4110&amp;lt;\/port&amp;gt;'/g SAR-INF/config.xml&lt;br /&gt;sed -i s/'&amp;lt;port&amp;gt;25&amp;lt;\/port&amp;gt;'/'&amp;lt;port&amp;gt;2525&amp;lt;\/port&amp;gt;'/g SAR-INF/config.xml&lt;br /&gt;sed -i s/'&amp;lt;port&amp;gt;119&amp;lt;\/port&amp;gt;'/'&amp;lt;port&amp;gt;4119&amp;lt;\/port&amp;gt;'/g SAR-INF/config.xml&lt;br /&gt;. . .&lt;/pre&gt;&lt;br /&gt;The next step is to authorize the IP segment of the development workstations:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter:false;"&gt;. . . &lt;br /&gt;sed -i s/'&lt;br /&gt;  &amp;lt;authorizedAddresses&amp;gt;&lt;br /&gt;  127.0.0.0\/8&lt;br /&gt;  &amp;lt;\/authorizedAddresses&amp;gt;'/'&amp;lt;authorizedAddresses&amp;gt;&lt;br /&gt;  127.0.0.0\/8,192.168.1.0\/24&lt;br /&gt;  &amp;lt;\/authorizedAddresses&amp;gt;&lt;br /&gt;  '/g SAR-INF/config.xml &lt;br /&gt;. . .&lt;/pre&gt;&lt;br /&gt;The next step adds the mail domains which should be considered as local&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter:false;"&gt;. . .&lt;br /&gt;  fgrep mail.canistracci.oil SAR-INF/config.xml &amp;gt;/dev/null&lt;br /&gt;  if [ "$?" != "0" ]; then&lt;br /&gt;    sed -i '/&amp;lt;servername&amp;gt;localhost&amp;lt;\/servername&amp;gt;/ a\&lt;br /&gt;      &amp;lt;servername&amp;gt;mail.canistracci.oil&amp;lt;\/servername&amp;gt;' SAR-INF/config.xml&lt;br /&gt;  fi&lt;br /&gt;. . .&lt;/pre&gt;&lt;br /&gt;This code snippet may be repeated for each mail domain which should be handled by James using the syntax &lt;i&gt;mail.&amp;lt;my domain&amp;gt;&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Operations&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Using the command &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;sudo service apache-james start&lt;/span&gt; James starts-up all configured sections. With &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;stop&lt;/span&gt; at the end James terminates the operations and &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;status&lt;/span&gt; help you to find out if James is running or not.&lt;br /&gt;&lt;br /&gt;Now I have to set up the mail box for my user. First I log in using a telnet client connected on the IP port 4555 as user &lt;i&gt;root&lt;/i&gt; with the password &lt;i&gt;root&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Typing &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;adduser petrol petrol&lt;/span&gt;, I add the user petrol with the password petrol.&lt;br /&gt;&lt;br /&gt;Now I may connect MSOutlook or Thunderbird (new account: POP port 4110, SMTP port 2525) to the POP account petrol/petrol.&lt;br /&gt;&lt;br /&gt;As soon as my application sends a mail addressed to petrol@canistracci.oil to the port 2525 my mail client will be able to display it. &lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-6527383477709521338?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/6527383477709521338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2012/01/e-mail-server-for-development.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/6527383477709521338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/6527383477709521338'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2012/01/e-mail-server-for-development.html' title='Inexpensive Development E-Mail Server'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-2426942835701793567</id><published>2011-04-22T21:38:00.000+02:00</published><updated>2011-04-22T21:38:34.572+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='inexpensive'/><category scheme='http://www.blogger.com/atom/ns#' term='PostgreSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='backup'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>Backup of the PostgreSQL Database</title><content type='html'>At the end of the project I had to set up a simple but reliable backup for the PostgreSQL database. If you have some interest, I did describe the environment in a previous article "&lt;a href="http://shortfastgood.blogspot.com/2010/11/ubuntu-server-as-inexpensive-platform.html"&gt;Ubuntu Server as Inexpensive Platform for J2EE&lt;/a&gt;". Here I describe the backup on that platform. With less changes the scripts works also on other UNIXes. The principle may be also used on MS Windows, but the implementation will be different. &lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm working on a server called &lt;i style="color: blue;"&gt;canistracci.oil&lt;/i&gt; with the account &lt;i style="color: blue;"&gt;petrol&lt;/i&gt;. I did create a database called &lt;i style="color: blue;"&gt;drilling&lt;/i&gt; with the user &lt;i style="color: blue;"&gt;offshore&lt;/i&gt; and the user &lt;i style="color: blue;"&gt;backup&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The users&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: sql; gutter:true;"&gt;---&lt;br /&gt;--- file name: 01_create_user.sql&lt;br /&gt;---&lt;br /&gt;--- please execute as postgres only, &lt;br /&gt;--- and be sure to be connected to the postgres database&lt;br /&gt;---&lt;br /&gt;--- The database owner&lt;br /&gt;---&lt;br /&gt;CREATE ROLE offshore LOGIN ENCRYPTED PASSWORD '99!cents'&lt;br /&gt;   VALID UNTIL 'infinity';&lt;br /&gt;COMMENT ON ROLE offshore IS 'drilling read / write user';&lt;br /&gt;---&lt;br /&gt;--- The backup user&lt;br /&gt;---&lt;br /&gt;CREATE ROLE backup LOGIN ENCRYPTED PASSWORD '50!cents'&lt;br /&gt;   VALID UNTIL 'infinity';&lt;br /&gt;COMMENT ON ROLE drilling IS 'drilling backup user';&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;The Tablespace&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The folder &lt;code&gt;/data/postgresql/drilling&lt;/code&gt; have to be created in advance using the commands: &lt;code&gt;mkdir&amp;nbsp;-p&amp;nbsp;/data/postgresql/drilling&lt;/code&gt; and &lt;code&gt;chown&amp;nbsp;postgres:postgres&lt;/code&gt; as &lt;i style="color: blue;"&gt;root&lt;/i&gt; at the UNIX console (or shell).&lt;br /&gt;&lt;pre class="brush: sql; gutter:true;"&gt;---&lt;br /&gt;--- file name: 02_create_tablespace.sql&lt;br /&gt;---&lt;br /&gt;--- please execute as postgres only, &lt;br /&gt;--- and be sure to be connected to the postgres database&lt;br /&gt;---&lt;br /&gt;CREATE TABLESPACE drilling OWNER drilling LOCATION '/data/postgresql/drilling';&lt;br /&gt;&lt;br /&gt;COMMENT ON TABLESPACE drilling IS 'drilling database tablespace';&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;The Database&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: sql; gutter:true;"&gt;---&lt;br /&gt;--- file name: 03_create_database.sql&lt;br /&gt;---&lt;br /&gt;--- please execute as postgres only, &lt;br /&gt;--- and be sure to be connected to the postgres database&lt;br /&gt;---&lt;br /&gt;CREATE DATABASE drilling&lt;br /&gt;  WITH ENCODING='UTF8'&lt;br /&gt;       OWNER=offshore&lt;br /&gt;       TEMPLATE=template1&lt;br /&gt;       LC_COLLATE='en_US.UTF-8'&lt;br /&gt;       LC_CTYPE='en_US.UTF-8'&lt;br /&gt;       CONNECTION LIMIT=-1&lt;br /&gt;       TABLESPACE=drilling;&lt;br /&gt;COMMENT ON DATABASE drilling IS 'drilling database';&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;The Tables&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The tables of the database drilling are: &lt;code&gt;equipment&lt;/code&gt;, &lt;code&gt;location&lt;/code&gt;, &lt;code&gt;tenant&lt;/code&gt;. The details are out of scope.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Grants&lt;/b&gt;&lt;br /&gt;The user offshore is the owner of the database and doesn't need special grantsbut backup is a read-only technical user which needs at least the SELECT grant on every object we wants to backup.&lt;br /&gt;&lt;pre class="brush: sql; gutter:true;"&gt;---&lt;br /&gt;--- file name: 05_grants.sql&lt;br /&gt;---&lt;br /&gt;--- please execute as postgres only, &lt;br /&gt;--- and be sure to be connected to the drilling database&lt;br /&gt;---&lt;br /&gt;GRANT CONNECT ON DATABASE drilling TO backup;&lt;br /&gt;GRANT USAGE ON SCHEMA public TO backup;&lt;br /&gt;---&lt;br /&gt;--- PostgreSQL &amp;lt; 9&lt;br /&gt;---&lt;br /&gt;--- GRANTS ON TABLES generated with&lt;br /&gt;---&lt;br /&gt;--- SELECT 'GRANT SELECT ON ' || tablename || ' TO backup;' FROM pg_tables WHERE schemaname = 'public';&lt;br /&gt;--- psql -qAt -c "select 'GRANT SELECT ON ' || tablename || ' TO backup;' FROM pg_tables WHERE schemaname = 'public'" | psql&lt;br /&gt;---&lt;br /&gt;GRANT SELECT ON equipment TO backup;&lt;br /&gt;GRANT SELECT ON location TO backup;&lt;br /&gt;GRANT SELECT ON tenant TO backup;&lt;br /&gt;---&lt;br /&gt;--- Introduced by PostgreSQL 9&lt;br /&gt;---&lt;br /&gt;--- GRANT SELECT ON ALL TABLES IN SCHEMA public TO backup;&lt;br /&gt;--- ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO backup;&lt;br /&gt;---&lt;br /&gt;--- GRANTS ON SEQUENCES generated with&lt;br /&gt;---&lt;br /&gt;--- SELECT 'GRANT SELECT ON ' || relname || ' TO backup;' FROM pg_statio_user_sequences WHERE schemaname = 'public';&lt;br /&gt;---&lt;br /&gt;GRANT SELECT ON equipment_id_seq TO backup;&lt;br /&gt;GRANT SELECT ON location_id_seq TO backup;&lt;br /&gt;GRANT SELECT ON tenant_id_seq TO backup;&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Trusting Backup&lt;/b&gt;&lt;br /&gt;I add a local trust to the database configuration for the user backup editing the file &lt;code&gt;/etc/postgresql/8.4/main/pg_hba.conf&lt;/code&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter:true;"&gt;petrol@canistracci.oil $ sudo nano /etc/postgresql/8.4/main/pg_hba.conf&lt;br /&gt;. . .&lt;br /&gt;local   all         postgres                          md5&lt;br /&gt;local   drilling    backup                            trust&lt;br /&gt;. . .&lt;br /&gt;petrol@canistracci.oil $ sudo /etc/init.d/postgresql restart&lt;br /&gt;&lt;/pre&gt;Now, using &lt;code&gt;pg_dump&lt;/code&gt; I may dump the content of the database. The command line is the following: &lt;code&gt;sudo pg_dump -E UTF-8 -U backup -w drilling&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Backup Script&lt;/b&gt;&lt;br /&gt;The script exports the database as very long PG-SQL script which may be used torestore the database. After the export the PG-SQL script is compressed to thebinary ZIP format using the best possible compression.&lt;br /&gt;&lt;pre class="brush: plain; gutter:true;"&gt;#!/bin/sh&lt;br /&gt;# backup.sh    This script stores all valuable parts of the database.&lt;br /&gt;#&lt;br /&gt;# description : 1) Performs the backup of the drilling database&lt;br /&gt;# process name: backup.sh&lt;br /&gt;#&lt;br /&gt;# Version 1.0 Daniele Denti&lt;br /&gt;&lt;br /&gt;LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH&lt;br /&gt;export LD_LIBRARY_PATH&lt;br /&gt;&lt;br /&gt;BACKUP_DIR=/data/backup/drilling&lt;br /&gt;&lt;br /&gt;NOW=`date +'%Y_%m_%d'`&lt;br /&gt;TIMESTAMP=${1:-$NOW}&lt;br /&gt;&lt;br /&gt;BACKUP_LOG=/var/tmp/drilling.backup.$TIMESTAMP.log&lt;br /&gt;DB_DUMP=${BACKUP_DIR}/drilling.$TIMESTAMP.sql&lt;br /&gt;PG_ZIP_FILE=$BACKUP_DIR/drilling_$TIMESTAMP.zip&lt;br /&gt;&lt;br /&gt;CURDIR=`pwd`&lt;br /&gt;&lt;br /&gt;echo [`date +'%d.%m.%Y %T'` INFO $0 ] started backup.sh on `uname -n`, executed by `id`, process id = $$ &amp;gt;$BACKUP_LOG&lt;br /&gt;&lt;br /&gt;pg_dump --column-inserts -E UTF-8 -f ${DB_DUMP} -U backup -v -w drilling &amp;gt;&amp;gt;$BACKUP_LOG 2&amp;gt;&amp;amp;1&lt;br /&gt;&lt;br /&gt;cd ${BACKUP_DIR}&lt;br /&gt;zip -9rv $PG_ZIP_FILE ${DB_DUMP} &amp;gt;&amp;gt;$BACKUP_LOG 2&amp;gt;&amp;amp;1&lt;br /&gt;&lt;br /&gt;echo [`date +'%d.%m.%Y %T'` INFO $0 ] backup.sh completed &amp;gt;&amp;gt;$BACKUP_LOG&lt;br /&gt;&lt;br /&gt;cd $CURDIR&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;The Clean Up Script&lt;/b&gt;&lt;br /&gt;The backup produces new files every day, so it is necessary to regularly delete the older ones.&lt;br /&gt;&lt;pre class="brush: plain; gutter:true;"&gt;#!/bin/sh&lt;br /&gt;# cleanup.sh   This is the daily script for cleaning the drilling environment&lt;br /&gt;#&lt;br /&gt;# description : - Performs the removal of old (at least 14 days) SQL and ZIP files.&lt;br /&gt;#               - Performs the removal of old (at leas 7 days) log files.&lt;br /&gt;# process name: cleanup.sh&lt;br /&gt;#&lt;br /&gt;# Version 1.0 Daniele Denti&lt;br /&gt;&lt;br /&gt;BACKUP_DIR=/data/backup/drilling&lt;br /&gt;&lt;br /&gt;FILE_LIST="*.log *.sql *.zip"&lt;br /&gt;for FILE_TYPE in ${FILE_LIST}; do&lt;br /&gt;  find ${BACKUP_DIR} -name ${FILE_TYPE} -atime +14 -exec rm {} \; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;find /var/tmp -atime +7 -exec rm -f {} \; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;The Cron Table&lt;/b&gt;&lt;br /&gt;On a freshly installed Ubuntu server execute as &lt;i style="color: blue;"&gt;root&lt;/i&gt; &lt;code&gt;echo ALL &amp;gt;&amp;gt;/etc/cron.deny&lt;/code&gt; and &lt;code&gt;echo petrol &amp;gt;&amp;gt;/etc/cron.allow&lt;/code&gt;.&lt;br /&gt;In order to edit the cron table execute &lt;code&gt;export EDITOR=vi; crontab -l&lt;/code&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter:true;"&gt;# m h  dom mon dow   command&lt;br /&gt;0 22 * * * /home/petrol/bin/backup.sh 2&amp;gt;&amp;amp;1&lt;br /&gt;0  5 * * * /home/petrol/bin/cleanup.sh 2&amp;gt;&amp;amp;1&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;The Remote Script&lt;/b&gt;&lt;br /&gt;Now the backup works but the server is into the DMZ and the backup files are confined on the data disk. If something goes wrong the data may be lost. So I copy the data into the Intranet on a second Ubuntu Server named &lt;i style="color: blue;"&gt;pipeline.oil&lt;/i&gt; using the account &lt;i style="color: blue;"&gt;grease&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;The authorization of grease@pipeline.oil on petrol@canistracci.oil is described in the previous article "&lt;a href="http://shortfastgood.blogspot.com/2011/02/key-based-ssh-logins.html"&gt;Key-Based SSH Logins&lt;/a&gt;".&lt;br /&gt;&lt;pre class="brush: plain; gutter:true;"&gt;#!/bin/sh&lt;br /&gt;# remote.sh    This is the daily script to get the drilling backup on the&lt;br /&gt;#              Intranet central backup server.&lt;br /&gt;#&lt;br /&gt;# description : Gets the last backup from remote.&lt;br /&gt;# process name: remote.sh&lt;br /&gt;&lt;br /&gt;# Version 1.0 Daniele Denti&lt;br /&gt;&lt;br /&gt;BACKUP_DIR=/data/backup/drilling&lt;br /&gt;BACKUP_REMOTE=/data/backup/drilling&lt;br /&gt;&lt;br /&gt;NOW=`date +'%Y_%m_%d'`&lt;br /&gt;TIMESTAMP=${1:-$NOW}&lt;br /&gt;&lt;br /&gt;PG_ZIP_FILE=drilling_$TIMESTAMP.zip&lt;br /&gt;REMOTE_LOG=/var/tmp/drilling.remote.$TIMESTAMP.log&lt;br /&gt;&lt;br /&gt;OIL_USER=petrol&lt;br /&gt;OIL_SERVER=canistracci.oil&lt;br /&gt;&lt;br /&gt;echo [`date +'%d.%m.%Y %T'` INFO $0 ] started remote.sh on `uname -n`, executed by `id`, process id = $$ &amp;gt;$REMOTE_LOG&lt;br /&gt;&lt;br /&gt;if [ -f ${BACKUP_REMOTE}/${PG_ZIP_FILE} ]; then&lt;br /&gt;        rm -f ${BACKUP_REMOTE}/${PG_ZIP_FILE}&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;scp ${OIL_USER}@${OIL_SERVER}:${BACKUP_REMOTE}/${PG_ZIP_FILE} ${BACKUP_DIR}/${PG_ZIP_FILE} &amp;gt;&amp;gt; $REMOTE_LOG 2&amp;gt;&amp;amp;1&lt;br /&gt;&lt;br /&gt;echo [`date +'%d.%m.%Y %T'` INFO $0 ] remote.sh completed &amp;gt;&amp;gt;$REMOTE_LOG&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-2426942835701793567?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/2426942835701793567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2011/04/backup-of-postgresql-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/2426942835701793567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/2426942835701793567'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2011/04/backup-of-postgresql-database.html' title='Backup of the PostgreSQL Database'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-4164554291729952658</id><published>2011-02-26T18:30:00.105+01:00</published><updated>2011-02-27T11:38:57.063+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='inexpensive'/><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='GIT'/><title type='text'>Inexpensive Development Platform for J2EE</title><content type='html'>Once the server is ready (see my previous &lt;a href="http://shortfastgood.blogspot.com/2010/11/ubuntu-server-as-inexpensive-platform.html"&gt;article&lt;/a&gt;) I need a similar inexpensive development environment. Inexpensive it's OK but uncomfortable would be bad. I have two different choices: the first is to create a small development corner on my office workstation. The second would be to buy a a net-book and use it as dedicated appliance.&lt;br /&gt;&lt;br /&gt;The first option has the advantage of a powerful hardware and a large screen. The net-book is small and may be used everywhere. I decided to investigate both environments because the first is suitable for developing a new project or a major release and the second seems to be suitable for support and small changes.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;The components I did choose for my environment works and are available for Windows, MacOSX and Linux. I'm really working with this environment on Windows/Linux clients. I don't use a MacOSX but some of my colleagues at work uses all this pieces of software without any problems on different Macs.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Installed Software&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Java Development Kit (JDK), the last one, currently 1.6.0_24. (all systems)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html"&gt;PuTTY&lt;/a&gt; (ssh connectivity, Windows only).&lt;/li&gt;&lt;li&gt;&lt;a href="http://git-scm.com/"&gt;GIT&lt;/a&gt; (all systems).&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/tortoisegit/"&gt;Tortoise GIT&lt;/a&gt; (Windows only).&lt;/li&gt;&lt;/ul&gt;These software packages are installed on each client for better integration into the environment. To avoid additional documentation I&amp;nbsp;always&amp;nbsp;perform a standard installation. For GIT on Windows I prefer the integration into the windows CMD-Box, with PuTTY and no integration with the Windows explorer (this integration is done by Totoise GIT). I describe my SSH setup &lt;a href="http://shortfastgood.blogspot.com/2011/02/key-based-ssh-logins.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Portable Software&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://winscp.net/eng/download.php"&gt;WinSCP&lt;/a&gt; ( ssh connectivity, Windows only). &lt;/li&gt;&lt;li&gt;&lt;a href="http://maven.apache.org/"&gt;Apache Maven&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.springsource.com/downloads/sts"&gt;Eclipse STS&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;I did copy this software on a memory stick (2GB). The performance is acceptable also on the net-book. For project which don't rely on security at all, the stick may be replaced by a service like &lt;a href="https://www.dropbox.com/home"&gt;Dropbox&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Configurations&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Windows Environment&lt;/i&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter:true;"&gt;SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_24&lt;br /&gt;SET M2_HOME=E:\java\apache-maven-3.0.2&lt;br /&gt;SET PATH=%PATH%;%JAVA_HOME%\bin;%M2_HOME%\bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;i&gt;UNIX Environment&lt;/i&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter:true;"&gt;JAVA_HOME=/usr/local/java/jdk1.6.0_24&lt;br /&gt;M2_HOME=/usb-mnt/java/apache-maven-3.0.2&lt;br /&gt;PATH=${PATH}:${JAVA_HOME}/bin;${M2_HOME}/bin&lt;br /&gt;export JAVA_HOME M2_HOME PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;i&gt;Maven Settings&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The file &lt;code&gt;settings.xml&lt;/code&gt; have to be placed into the folder &lt;code&gt;.m2&lt;/code&gt; which was created into the home directory of the user on both Windows and UNIX.&lt;br /&gt;&lt;pre class="brush: xml; gutter:true;"&gt;&lt;settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xsi:schemalocation="http://maven.apache.org/SETTINGS/1.0.0&lt;br /&gt;                      http://maven.apache.org/xsd/settings-1.0.0.xsd"&gt;&lt;br /&gt;  &lt;localrepository&gt;[usb-mnt]/java/m2/repository&lt;/localrepository&gt;&lt;br /&gt;  &lt;profiles&gt;&lt;br /&gt;    &lt;profile&gt;&lt;br /&gt;      &lt;id&gt;default&lt;/id&gt;&lt;br /&gt;      &lt;repositories&gt;&lt;br /&gt;        &lt;repository&gt;&lt;br /&gt;          &lt;id&gt;org-matheclipse-repository&lt;/id&gt;&lt;br /&gt;          &lt;url&gt;http://symja.googlecode.com/svn/maven-repository/&lt;/url&gt;&lt;br /&gt;          &lt;releases&gt;&lt;br /&gt;            &lt;enabled&gt;true&lt;/enabled&gt;&lt;br /&gt;          &lt;/releases&gt;&lt;br /&gt;          &lt;snapshots&gt;&lt;br /&gt;            &lt;enabled&gt;false&lt;/enabled&gt;&lt;br /&gt;          &lt;/snapshots&gt;&lt;br /&gt;        &lt;/repository&gt;&lt;br /&gt;      &lt;/repositories&gt;&lt;br /&gt;    &lt;/profile&gt;&lt;br /&gt;  &lt;/profiles&gt;&lt;br /&gt;  &lt;activeprofiles&gt;&lt;br /&gt;    &lt;activeprofile&gt;default&lt;/activeprofile&gt;&lt;br /&gt;  &lt;/activeprofiles&gt;&lt;br /&gt;&lt;/settings&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;The Source Code&lt;/b&gt;&lt;br /&gt;The source code was checked out under &lt;code&gt;[/usb-mnt]/gitroot/[maven-project]&lt;/code&gt; using GIT. I did open a CMD-Box/Terminal-Window into this folder and I did execute &lt;code&gt;mvn clean install&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The IDE&lt;/b&gt;&lt;br /&gt;I did start the Eclipse STS from the memory stick, after setting my preferences I noticed that the Maven configuration was already OK. After importing the Maven project I could start working as usual.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;The environment is quite simple but efficient and enough to program and maintain any J2EE application. The development corner on the strong office workstation doesn't collide in any way with the main purpose of the workstation.&lt;br /&gt;&lt;br /&gt;The net-book environment is better than expected. I had to be patient during the installation and the first start of the IDE, but, once started, also the IDE is usable and the small screen doesn't affect my productivity.&lt;br /&gt;&lt;br /&gt;I did work a while with the net-book only and without any additional device like an external screen or a mouse. Using the tethering function of my smartphone I was able to connect to my servers from everywhere and travelling by train.&lt;br /&gt;&lt;br /&gt;The net-book is light and wakes up fast and did cost 170€ including the USB stick.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Net-Book&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I did work with two net-books the first an ASUS Eee 1001PX and the second a Samsung NP-N150 Plus, both with Intel Atom 450 CPU, 1GB memory, 250 GB HD and Windows 7 Starter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-4164554291729952658?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/4164554291729952658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2011/02/inexpensive-development-platform-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/4164554291729952658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/4164554291729952658'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2011/02/inexpensive-development-platform-for.html' title='Inexpensive Development Platform for J2EE'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-2880587574129445614</id><published>2011-02-05T20:10:00.010+01:00</published><updated>2011-02-26T17:38:08.364+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='MacOSX'/><category scheme='http://www.blogger.com/atom/ns#' term='PuTTY'/><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='configuration'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='repository'/><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><category scheme='http://www.blogger.com/atom/ns#' term='GIT'/><title type='text'>Key-Based SSH Logins</title><content type='html'>I did found a lot of pages with good explanation of the theory and / or how to setup client and server and I don't want to write another one. The motivation of this article is only to have a concise check list to use with "copy &amp;amp; paste" when I have to set up a such login.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;b&gt;The Ecosystem&lt;/b&gt;&lt;br /&gt;&lt;span style="background-color: white;"&gt;&lt;/span&gt;&lt;br /&gt;I have a UNIX server called &lt;b&gt;&lt;i style="color: blue;"&gt;canistracci.oil&lt;/i&gt;&lt;/b&gt; holding a bare GIT repository, accessible through the account &lt;b style="color: blue;"&gt;&lt;i&gt;petrol&lt;/i&gt;&lt;/b&gt;. Another UNIX server called &lt;i style="color: blue;"&gt;&lt;b&gt;pipeline.oil&lt;/b&gt;&lt;/i&gt; (account &lt;b style="color: blue;"&gt;&lt;i&gt;grease&lt;/i&gt;&lt;/b&gt;) should access the repository of &lt;i&gt;canistracci.oil&lt;/i&gt; for continuous integration. The development workstation (&lt;i style="color: blue;"&gt;&lt;b&gt;gas-station.oil&lt;/b&gt;&lt;/i&gt;) is a modern Windows 7 PC and should also access the GIT repository on &lt;i&gt;canistracci.oil&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Software&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;On Solaris 10, Linux and MacOSX the SSH package is ready to use. Windows doesn't provide SSH connectivity. I use the excellent &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;PuTTY&lt;/a&gt; terminal by Simon Tatham. I did download the Windows installer and I did a standard installation. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Authorize Grease&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;First connect to pipeline.oil. From MacOSX, Linux or Solaris execute &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;ssh grease@pipeline.oil&lt;/span&gt;, on Windows use PuTTY and then execute the following commands.&lt;br /&gt;&lt;pre class="brush: plain"&gt;grease@pipeline.oil $ ssh-keygen -b 2048 -t rsa&lt;br /&gt;&lt;br /&gt;Generating public/private rsa key pair.&lt;br /&gt;Enter file in which to save the key (/home/grease/.ssh/id_rsa):&lt;br /&gt;Enter passphrase (empty for no passphrase):&lt;br /&gt;Enter same passphrase again:&lt;br /&gt;Your identification has been saved in /home/grease/.ssh/id_rsa.&lt;br /&gt;Your public key has been saved in /home/grease/.ssh/id_rsa.pub.&lt;br /&gt;The key fingerprint is:&lt;br /&gt;x6:68:xx:93:98:8x:87:95:7x:2x:4x:x9:81:xx:56:94 grease@pipeline.oil&lt;br /&gt;&lt;br /&gt;grease@pipeline.oil $ scp ~/.ssh/id_rsa.pub petrol@canistracci.oil:&lt;br /&gt;grease@pipeline.oil $ ssh petrol@canistracci.oil&lt;br /&gt;petrol@canistracci.oil's password:&lt;br /&gt;&lt;br /&gt;petrol@canistracci.oil $ mkdir ~/.ssh&lt;br /&gt;petrol@canistracci.oil $ chmod 700 ~/.ssh&lt;br /&gt;petrol@canistracci.oil $ cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys&lt;br /&gt;petrol@canistracci.oil $ rm ~/id_rsa.pub&lt;br /&gt;petrol@canistracci.oil $ chmod 600 ~/.ssh/authorized_keys&lt;br /&gt;&lt;/pre&gt;The next login of &lt;i&gt;grease&lt;/i&gt; on &lt;i&gt;canistracci.oil&lt;/i&gt; doesn't require a password anymore.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Notice&lt;/b&gt;: On Solaris 10 the name of the file &lt;i&gt;authorized_keys&lt;/i&gt; is &lt;i&gt;authorized_keys2&lt;/i&gt;. The last Ubuntu server I did install (10.10) authorizes a MacOSX using &lt;i&gt;authorized_keys2&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Authorize Gas-Station.oil&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_2mDcGx6imSA/TU2ZPk35UzI/AAAAAAAAAgo/W_f-EKynKU8/s1600/PuTTY-gen.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="387" src="http://4.bp.blogspot.com/_2mDcGx6imSA/TU2ZPk35UzI/AAAAAAAAAgo/W_f-EKynKU8/s400/PuTTY-gen.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Start the program PuTTYgen.exe.&lt;/li&gt;&lt;li&gt;Generate the key-pair.&lt;/li&gt;&lt;li&gt;Save both keys on the hard-disk.&lt;/li&gt;&lt;li&gt;Start the program PuTTY.exe and connect to &lt;i&gt;canistracci.oil.&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;Execute the following commands:&lt;br /&gt;&lt;pre class="brush: plain"&gt;petrol@canistracci.oil $ vi ~/id_rsa.pub&lt;/pre&gt;Copy the public key (in blue on the picture above) to the clipboard, activate the PuTTY window, type i and paste the key. Type the sequence ESC + : + wq!&lt;br /&gt;&lt;pre class="brush: plain"&gt;petrol@canistracci.oil $ chmod 700 ~/.ssh&lt;br /&gt;petrol@canistracci.oil $ cat ~/id_rsa.pub &amp;gt;&amp;gt; ~/.ssh/authorized_keys&lt;br /&gt;petrol@canistracci.oil $ rm ~/id_rsa.pub&lt;br /&gt;petrol@canistracci.oil $ mkdir ~/.ssh&lt;br /&gt;petrol@canistracci.oil $ chmod 600 ~/.ssh/authorized_keys&lt;/pre&gt;The next login of &lt;i&gt;grease&lt;/i&gt; on &lt;i&gt;canistracci.oil&lt;/i&gt; doesn't require a password anymore.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Notice&lt;/b&gt;: on Solaris 10 the name of the file &lt;i&gt;authorized_keys&lt;/i&gt; is &lt;i&gt;authorized_keys2&lt;/i&gt;. The last Ubuntu server I did install (10.10) authorizes a MacOSX using &lt;i&gt;authorized_keys2&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Notice&lt;/b&gt;: on Windows before the first connection a double click on the PuTTY private key is necessary to activate the program Pageant.exe and to load the key.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-2880587574129445614?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/2880587574129445614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2011/02/key-based-ssh-logins.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/2880587574129445614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/2880587574129445614'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2011/02/key-based-ssh-logins.html' title='Key-Based SSH Logins'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_2mDcGx6imSA/TU2ZPk35UzI/AAAAAAAAAgo/W_f-EKynKU8/s72-c/PuTTY-gen.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-2832900336312035360</id><published>2010-11-01T10:41:00.120+01:00</published><updated>2011-02-26T17:39:36.899+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='inexpensive'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>Ubuntu Server as Inexpensive Platform for J2EE</title><content type='html'>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.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;I decided to try with Ubuntu 10.10 Server because I was impressed by the essential and very good on-line &lt;a href="https://help.ubuntu.com/10.10/index.html"&gt;documentation&lt;/a&gt;. The productive environment will be (later) installed with Ubuntu 10.04 LTS.&lt;br /&gt;&lt;br /&gt;The installation is quite simple: download the ISO image, burn the CD-ROM and boot the server from the CD. There is no special task to do, but be sure the server has a working internet connection and, if you work in a LAN, the DHCP server have to be reachable. I did choose to install OpenSSH and PostgreSQL as additional services.&lt;br /&gt;&lt;br /&gt;At the end of the installation I performed an update of the packages (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sudo apt-get update/upgrade&lt;/span&gt;). After reboot (due to new kernel) Tomcat (6.0.28) and PostgreSQL are up and running. Low memory usage and no unwanted services.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Second Hard-disk&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Since the installer takes care of the first disk only I have to prepare and mount the second disk:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Using &lt;i&gt;fdisk&lt;/i&gt; (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;fdisk /dev/sdb&lt;/span&gt;) delete all existing partitions (if any).&lt;/li&gt;&lt;li&gt;Save new (empty) partition table (using &lt;b&gt;w&lt;/b&gt;).&lt;/li&gt;&lt;li&gt;Add new partition(s) (using &lt;b&gt;n&lt;/b&gt;).&lt;/li&gt;&lt;li&gt;Using &lt;i&gt;mkfs&lt;/i&gt; (e.g. &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;mkfs -t ext4 /dev/sdb1&lt;/span&gt;) format the partition(s).&lt;/li&gt;&lt;li&gt;Using &lt;i&gt;tune2fs&lt;/i&gt; (e.g.&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; tune2fs -L /data /dev/sdb1&lt;/span&gt;) label the partition(s).&lt;/li&gt;&lt;li&gt;Create the mount point(s) (e.g. &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;mkdir /data&lt;/span&gt;).&lt;/li&gt;&lt;li&gt;Modify the file /etc/fstab adding one line per partition (e.g.)&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; /dev/sdb1 /data ext4 defaults 1 2&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Mount the partition(s) (e.g. &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;mount /data&lt;/span&gt;).&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;b&gt;Tomcat&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;First add the &lt;i&gt;admin&lt;/i&gt; and the &lt;i&gt;manager&lt;/i&gt; roles to the file &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/etc/tomcat6/tomcat-users.xml&lt;/span&gt; and add the role to the &lt;i&gt;tomcat&lt;/i&gt; user.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br /&gt;&amp;lt;tomcat-users&amp;gt;&lt;br /&gt;...&lt;br /&gt;  &amp;lt;role rolename="admin"/&amp;gt;&lt;br /&gt;  &amp;lt;role rolename="manager"/&amp;gt;&lt;br /&gt;  &amp;lt;user username="tomcat" password="tomcat" roles="admin,manager"/&amp;gt;&lt;br /&gt;&amp;lt;/tomcat-users&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Restart Tomcat (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/etc/init.d/tomcat6 restart&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;Using this configuration I may access the manager (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;http://myserver:8080/manager/html)&lt;/span&gt; to quickly (re)deploy my application(s).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PostgreSQL&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Perform the following setup (copied from the Ubuntu official documentation):&lt;br /&gt;&lt;blockquote&gt;"Now that we can connect to our &lt;span class="application"&gt;&lt;b&gt;PostgreSQL&lt;/b&gt;&lt;/span&gt; server, the next step is to      set a password for the &lt;span class="emphasis"&gt;&lt;i&gt;postgres&lt;/i&gt;&lt;/span&gt; user.  Run the following command at a terminal      prompt to connect to the default PostgreSQL template database:"      &lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sudo -u postgres psql template1&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;&lt;blockquote&gt;"The above command connects to PostgreSQL database &lt;span class="emphasis"&gt;&lt;i&gt;template1&lt;/i&gt;&lt;/span&gt; as user            &lt;span class="emphasis"&gt;&lt;i&gt;postgres&lt;/i&gt;&lt;/span&gt;. Once you connect to the PostgreSQL server, you will be      at a SQL prompt. You can run the following SQL command at the &lt;span class="application"&gt;&lt;b&gt;psql&lt;/b&gt;&lt;/span&gt;      prompt to configure the password for the user &lt;span class="italics"&gt;postgres&lt;/span&gt;."     &lt;/blockquote&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ALTER USER postgres with encrypted password 'your_password';&lt;/blockquote&gt;&lt;blockquote&gt;"After configuring the password, edit the file            &lt;code class="filename"&gt;/etc/postgresql/8.4/main/pg_hba.conf&lt;/code&gt; to use            &lt;span class="emphasis"&gt;&lt;i&gt;MD5&lt;/i&gt;&lt;/span&gt; authentication with the &lt;span class="emphasis"&gt;&lt;i&gt;postgres&lt;/i&gt;&lt;/span&gt; user":            &lt;/blockquote&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;local   all         postgres                          md5&lt;/blockquote&gt;&lt;blockquote&gt;"Finally, you should restart the &lt;span class="application"&gt;&lt;b&gt;PostgreSQL&lt;/b&gt;&lt;/span&gt; service to             initialize the new configuration.  From a terminal prompt enter the following to      restart &lt;span class="application"&gt;&lt;b&gt;PostgreSQL&lt;/b&gt;&lt;/span&gt;":            &lt;/blockquote&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;sudo /etc/init.d/postgresql-8.4 restart&lt;/blockquote&gt;&lt;br /&gt;&lt;b&gt;Apache2&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The Apache WEB server wasn't installed by default (maybe I omitted to include it during the installation). Anyway with&lt;br /&gt;&lt;pre class="brush: plain"&gt;sudo apt-get install apache2&lt;br /&gt;&lt;/pre&gt;the service was installed and started.&lt;br /&gt;&lt;br /&gt;In order to use it as reverse-proxy there is some configuration work to do. The first step is to enable the proxy module:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain"&gt;user@myserver: cd /etc/apache2/mods-enabled&lt;br /&gt;user@myserver: sudo ln -s ../mods-available/proxy.conf proxy.conf&lt;br /&gt;user@myserver: sudo ln -s ../mods-available/proxy_http.load proxy_http.load&lt;br /&gt;user@myserver: sudo ln -s ../mods-available/proxy.load proxy.load&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The second step is to edit the proxy configuration (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;proxy.conf&lt;/span&gt;) as shown above:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml; gutter: true;"&gt;&amp;lt;IfModule mod_proxy.c&amp;gt;&lt;br /&gt;&lt;br /&gt;# If you want to use apache2 as a forward proxy, uncomment the&lt;br /&gt;# 'ProxyRequests On' line and the &amp;lt;Proxy *&amp;gt; block below.&lt;br /&gt;# WARNING: Be careful to restrict access inside the &amp;lt;Proxy *&amp;gt; block.&lt;br /&gt;# Open proxy servers are dangerous both to your network and to the&lt;br /&gt;# Internet at large.&lt;br /&gt;#&lt;br /&gt;# If you only want to use apache2 as a reverse proxy/gateway in&lt;br /&gt;# front of some web application server, you DON'T need&lt;br /&gt;# 'ProxyRequests On'.&lt;br /&gt;&lt;br /&gt;ProxyRequests Off&lt;br /&gt;&amp;lt;Proxy *&amp;gt;&lt;br /&gt;  AddDefaultCharset off&lt;br /&gt;  Order deny,allow&lt;br /&gt;  Allow from all&lt;br /&gt;&amp;lt;/Proxy&amp;gt;&lt;br /&gt;&lt;br /&gt;# Enable/disable the handling of HTTP/1.1 "Via:" headers.&lt;br /&gt;# ("Full" adds the server version; "Block" removes all outgoing Via: headers)&lt;br /&gt;# Set to one of: Off | On | Full | Block&lt;br /&gt;#ProxyVia Off&lt;br /&gt;&lt;br /&gt;&amp;lt;/IfModule&amp;gt;&lt;/pre&gt;&lt;br /&gt;The third step is to edit the configuration of the default site (/etc/apache2/sites-available/default) as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml; gutter: true;"&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;  ServerAdmin me@work&lt;br /&gt;&lt;br /&gt;  ProxyPreserveHost On&lt;br /&gt;  ProxyPass /manager/html !&lt;br /&gt;  ProxyPass host-manager/html !&lt;br /&gt;  ProxyPass / http://localhost:8080/&lt;br /&gt;  ProxyPassReverse / http://localhost:8080/&lt;br /&gt;  ServerName myserver&lt;br /&gt;&lt;br /&gt;  ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;&lt;br /&gt;  # Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;  # alert, emerg.&lt;br /&gt;  LogLevel warn&lt;br /&gt;&lt;br /&gt;  CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;At the end check the configuration and restart the apache2:&lt;br /&gt;&lt;pre class="brush: plain"&gt;user@myserver: apachectl configtest&lt;br /&gt;user@myserver: sudo /etc/init.d/apache2 restart&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Static IP&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The last task I had to do was to move the server from DHCP to a static address. Be aware: if you follows this instructions you have to be logged-in at the console of the server.&lt;br /&gt;&lt;br /&gt;I did stop the network interface (sudo ifdown eth0) and start to edit the file /etc/resolv.conf as follow:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter: true;"&gt;nameserver 192.168.1.11&lt;br /&gt;domain mydomain&lt;br /&gt;search mydomain&lt;/pre&gt;&lt;br /&gt;The next file to edit is /etc/network/interfaces:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter: true;"&gt;# This file describes the network interfaces available on your system&lt;br /&gt;# and how to activate them. For more information, see interfaces(5).&lt;br /&gt;&lt;br /&gt;# The loopback network interface&lt;br /&gt;auto lo&lt;br /&gt;iface lo inet loopback&lt;br /&gt;&lt;br /&gt;# The primary network interface&lt;br /&gt;# auto eth0&lt;br /&gt;# iface eth0 inet dhcp&lt;br /&gt;auto eth0&lt;br /&gt;iface eth0 inet static&lt;br /&gt;address 192.168.1.2&lt;br /&gt;netmask 255.255.255.0&lt;br /&gt;gateway 192.168.1.1&lt;br /&gt;#&lt;br /&gt;# The secondary network interface&lt;br /&gt;#&lt;br /&gt;# auto eth1&lt;br /&gt;# iface eth1 inet dhcp&lt;/pre&gt;&lt;br /&gt;I did restart the network interface (sudo ifup eth0) and the server was reachable through the static address.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;After an hour I was able to start deploying my application on this recycled server. It is essential but enough for many small and mid sized applications. The same work may be done on an Amazon EC2 instance or inside VMWare.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-2832900336312035360?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/2832900336312035360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/11/ubuntu-server-as-inexpensive-platform.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/2832900336312035360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/2832900336312035360'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/11/ubuntu-server-as-inexpensive-platform.html' title='Ubuntu Server as Inexpensive Platform for J2EE'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-9161896439589724994</id><published>2010-10-08T16:12:00.003+02:00</published><updated>2011-02-26T17:41:09.112+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='configuration'/><category scheme='http://www.blogger.com/atom/ns#' term='Fedora'/><category scheme='http://www.blogger.com/atom/ns#' term='manager'/><category scheme='http://www.blogger.com/atom/ns#' term='iptables'/><title type='text'>Network Management on Fedora 12</title><content type='html'>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.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;The last time I did this task was on Fedora 8 or 9; after adding the second interface as usual, nothing did happen. Using the command &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;ifconfig -a&lt;/span&gt; I noticed that the adapter was NOT configured at all.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Network Subsystem&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The network subsystem I know is disabled (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;chkconfig --list | grep network&lt;/span&gt;) and down. So every network configuration and tool related to this subsystem doesn't change the network behaviour of Fedora anymore.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Network Manager&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The network manager replaces the network subsystem (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;chkconfig --list | grep NetworkManager&lt;/span&gt;). The network manager is great if you have direct access to the system console (Notebook, Workstation) and you know what you do. I'm accessing the server using an old fashioned TTY connection and I cannot use the Gnome applet.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The ncftool&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The ncftool is a part of &lt;a href="https://fedorahosted.org/netcf/"&gt;Netcf&lt;/a&gt; a cross platform&amp;nbsp; configuration library. It wasn't installed on the server but as soon as I did type the command Fedora asked me if I wish install the package.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to add the adapter&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;First of all I had to put together all information I needed to configure the adapter:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; The static IP address of the server&lt;/li&gt;&lt;li&gt;The network mask of the IP segment&lt;/li&gt;&lt;li&gt;The IP address of the gateway&lt;/li&gt;&lt;li&gt;The MAC address of the adapter (optional, but recommended)&lt;/li&gt;&lt;li&gt;The IP adresses of the DNS servers. &lt;/li&gt;&lt;/ul&gt;The next step was to put all the informations in a XML file which was used by the ncftool to configure the new adapter.&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br /&gt;&amp;lt;interface type="ethernet" name="eth1"&amp;gt;&lt;br /&gt;  &amp;lt;start mode="onboot"/&amp;gt;&lt;br /&gt;  &amp;lt;mac address="00:22:19:83:77:1B"/&amp;gt;&lt;br /&gt;  &amp;lt;protocol family="ipv4"&amp;gt;&lt;br /&gt;    &amp;lt;ip address="192.168.1.111" prefix="24"/&amp;gt;&lt;br /&gt;    &amp;lt;route gateway="192.168.1.1"/&amp;gt;&lt;br /&gt;  &amp;lt;/protocol&amp;gt;&lt;br /&gt;&amp;lt;/interface&amp;gt;&lt;/pre&gt;The example should be self-explanatory; the prefix is the network mask (24-bit or 255.255.255.0). The MAC address is delivered by the command &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;ifconfig -a&lt;/span&gt; (HWaddr). I did store this XML structure into the file &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/tmp/eth1.xml&lt;/span&gt;. Some more interesting samples configurations are available at &lt;a href="http://git.fedorahosted.org/git/?p=netcf.git;a=tree;f=tests/interface"&gt;netcf.git&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;At this point I did configure the network interface:&lt;br /&gt;&lt;pre class="brush: plain"&gt;[root@myserver] # ncftool&lt;br /&gt;ncftool &amp;gt; define /tmp/eth1.xml&lt;br /&gt;ncftool &amp;gt; ifup eth1&lt;br /&gt;ncftool &amp;gt; quit&lt;br /&gt;&lt;/pre&gt;The interface did work but it couldn't resolve the domain names. I didn't find a way to configure the DNS servers using the ncftool so I had to edit the file &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/etc/sysconfig/network-scripts/ifcfg-eth1&lt;/span&gt;:&lt;br /&gt;&lt;pre class="brush: plain; gutter: true;"&gt;DEVICE=eth1&lt;br /&gt;ONBOOT=yes&lt;br /&gt;BOOTPROTO=none&lt;br /&gt;IPADDR=192.168.1.111&lt;br /&gt;NETMASK=255.255.255.0&lt;br /&gt;GATEWAY=192.168.1.1&lt;br /&gt;TYPE=Ethernet&lt;br /&gt;PREFIX=24&lt;br /&gt;DEFROUTE=yes&lt;br /&gt;IPV4_FAILURE_FATAL=yes&lt;br /&gt;NAME="System eth1"&lt;br /&gt;UUID=9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04&lt;br /&gt;HWADDR=00:22:19:83:77:1B&lt;br /&gt;DNS1=192.168.1.11&lt;/pre&gt;The last line was manually added. The syntax for a DNS entry is &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;DNS(n)=xxx.xxx.xxx.xxx&lt;/span&gt;. Here it is necessary to restart the network mananger (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/etc/init.d/NetworkManager restart&lt;/span&gt;). From remote I had to boot the entire server.&lt;br /&gt;&lt;br /&gt;The new adapter started to work properly for outgoing connections, but some incoming connections were refused. The reason was the missing IP-tables configuration. I had to edit the file&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; /etc/sysconfig/iptables&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain; gutter: true;"&gt;# Firewall configuration written by system-config-firewall&lt;br /&gt;# Manual customization of this file is not recommended.&lt;br /&gt;*filter&lt;br /&gt;:INPUT ACCEPT [0:0]&lt;br /&gt;:FORWARD ACCEPT [0:0]&lt;br /&gt;:OUTPUT ACCEPT [0:0]&lt;br /&gt;-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;-A INPUT -p icmp -j ACCEPT&lt;br /&gt;-A INPUT -i lo -j ACCEPT&lt;br /&gt;-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT&lt;br /&gt;-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT&lt;br /&gt;-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT&lt;br /&gt;-A INPUT -i eth0 -m state --state NEW -m tcp -p tcp 7001 -j ACCEPT&lt;br /&gt;-A INPUT -j REJECT --reject-with icmp-host-prohibited&lt;br /&gt;-A FORWARD -j REJECT --reject-with icmp-host-prohibited&lt;br /&gt;COMMIT&lt;/pre&gt;I added the lines 11,12 and 13 which enables connections on the ports 80 and 443 from everywhere to any interface and connections on the port 7001 from everywhere to the interface eth0. Since eth0 is reachable from in-house only, nobody can connect to the port 7001 from the Internet. After changing the rules it is necessary to restart the sub system (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/etc/init.d/iptables restart&lt;/span&gt;).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-9161896439589724994?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/9161896439589724994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/10/network-management-on-fedora-12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/9161896439589724994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/9161896439589724994'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/10/network-management-on-fedora-12.html' title='Network Management on Fedora 12'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-5486536552264788578</id><published>2010-08-08T17:48:00.028+02:00</published><updated>2011-02-27T11:39:36.506+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='flash 10.1'/><category scheme='http://www.blogger.com/atom/ns#' term='zattoo'/><category scheme='http://www.blogger.com/atom/ns#' term='froyo'/><category scheme='http://www.blogger.com/atom/ns#' term='tv'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Android 2.2 Froyo on the HTC Desire: first experiences</title><content type='html'>I did upgrade my HTC Desire from Android 2.1 to 2.2. It's possible to force an upgrade without waiting (settings -&amp;gt; about phone -&amp;gt; system software updates -&amp;gt; check now).&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;Before you start the upgrade be sure your Desire have at least 25MB free memory or the update will fail. The entire procedure lasts about 10 minutes.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Software Informations&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Android version&lt;/b&gt;: 2.2&lt;/li&gt;&lt;li&gt;&lt;b&gt;Baseband version&lt;/b&gt;: 32.43.00.32U_5.09.00.20&lt;/li&gt;&lt;li&gt;&lt;b&gt;Kernel version&lt;/b&gt;: 2.6.32.15-gf9c0527 - htc-kernel@and18-2#1&lt;/li&gt;&lt;li&gt;&lt;b&gt;Build number&lt;/b&gt;: 2.09.405.8 CL218634 release-keys&lt;/li&gt;&lt;li&gt;&lt;b&gt;Software number&lt;/b&gt;: 2.09.405.8&lt;/li&gt;&lt;li&gt;&lt;b&gt;Browser version&lt;/b&gt;: Webkit 3.1&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Apps&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I did found 5 new applications:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;&lt;b&gt;App Sharing&lt;/b&gt;&lt;/i&gt; : it makes possible to share an application using mail or social network.&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;b&gt;Flashlight&lt;/b&gt;&lt;/i&gt; : uses the flash to convert the phone in a flashlight.&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;b&gt;News and Weather&lt;/b&gt;&lt;/i&gt;: app based on the Google News service.&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;b&gt;Voice Search&lt;/b&gt;&lt;/i&gt; : it searches the words you speak using the Google Search.&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;b&gt;Wi-Fi Hotspot&lt;/b&gt;&lt;/i&gt; : it converts the phone in a Wi-Fi&amp;nbsp; hotspot. One or more notebooks may use, wireless, the 3G connection of the Desire to connect to the Internet.&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Features&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;&lt;b&gt;Support for Flash 10.1&lt;/b&gt;:&amp;nbsp; it makes possible to watch television and to play streaming videos embedded into WEB pages. E.g &lt;a href="http://www.zattoo.com/"&gt;Zattoo&lt;/a&gt; works fine with&amp;nbsp; Wi-Fi and with 3G (default browser or Dolphin HD), but be aware: if you don't have a flat rate 3G may become really expensive. My Desire doesn't start to play the videos automatically, at the beginning a green down arrow appears. The video starts after I push the arrow avoiding unwanted costs for embedded videos I don't want to see.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Resources Management&lt;/b&gt;: now it is possible to move the applications to the SD chip, but, currently, only a&amp;nbsp; minor part of the applications I use may really be moved to the SD. Anyway I could double the available space on the internal phone storage. The TaskKiller displays also twice so much available memory as before.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Performance&lt;/b&gt;: I didn't notice the performance improvement, but I don't use anything which requires a lot of power. Yesterday, during my last getaway, the battery did last remarkably longer as before. &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-5486536552264788578?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/5486536552264788578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/08/android-22-froyo-on-htc-desire-first.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/5486536552264788578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/5486536552264788578'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/08/android-22-froyo-on-htc-desire-first.html' title='Android 2.2 Froyo on the HTC Desire: first experiences'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-1717206353796175890</id><published>2010-07-23T16:32:00.007+02:00</published><updated>2011-02-26T17:44:19.075+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gsm'/><category scheme='http://www.blogger.com/atom/ns#' term='tim'/><category scheme='http://www.blogger.com/atom/ns#' term='prepaid'/><category scheme='http://www.blogger.com/atom/ns#' term='edge'/><category scheme='http://www.blogger.com/atom/ns#' term='toscana'/><category scheme='http://www.blogger.com/atom/ns#' term='ricarica'/><category scheme='http://www.blogger.com/atom/ns#' term='italy'/><category scheme='http://www.blogger.com/atom/ns#' term='hspa'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Holidays in Italy with Android</title><content type='html'>Last month I did spend some time searching the best rate for using my smartphone in Italy.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;It is not only a question of money, the kind of connection is important too.&lt;br /&gt;&lt;br /&gt;Using a swiss prepaid card roaming and data roaming are offered at unfair rates (1.10/1.70 Sfr each minute and 15.40 Sfr each MB) without any advice about the availabilty of the signal.&lt;br /&gt;&lt;br /&gt;My investigation is based on the homepages of TIM, WIND and Vodafone. I decided to use the prepaid card offered by TIM.&lt;br /&gt;&lt;br /&gt;The reasons are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The offer was easy to find.&lt;/li&gt;&lt;li&gt;The description is clear, easy to understand and up-to-date.&lt;/li&gt;&lt;li&gt;I did easily find a page with the technical informations about my target area.&lt;/li&gt;&lt;li&gt;The tariff (2 Euro for 250MB weekly) is fair.&lt;/li&gt;&lt;li&gt;The additional costs (50 cts per MB) are tolerable.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Buy the Prepaid Card&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You need to know the system: not every reseller may sell the card and activate it. You need to find a "centro TIM". Don't expect a huge store, it is mostly&amp;nbsp; a small shop with the required license.&lt;br /&gt;&lt;br /&gt;I was lucky and could buy the card on Saturday, late afternoon.&lt;br /&gt;&lt;br /&gt;The card has a minimal amount of money preloaded. So you need a "ricarica". The additional credit is sold by small shops called "tabaccheria" and, sometimes, by supermarkets.&lt;br /&gt;&lt;br /&gt;You may ask the official reseller, but, normally the answer is: "I'm sorry but we just sold the last one".&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Card Setup&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I had to wait 4 hours for the activation of the number. The service is good, the only problem was the "ricarica": the number to call did change, but I was informed about the change by TIM.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Eperiences&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I was on the hills of the region Toscana, near Volterra.&amp;nbsp; Later I did travel, by car, until Piombino (on the coast).&lt;br /&gt;&lt;br /&gt;Sometimes the data channel disappeeared, but, at every turistic spot, I was able to send or receive data at least using the EDGE protocol.&amp;nbsp; Near the most important places the speed rises at 3G.&lt;br /&gt;&lt;br /&gt;I did experiment the teetering with a notebook. It works but, even if you disable really every unnecessary connection,&amp;nbsp; 250MB is not enough.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Apps&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Due to the connection limitations on lonely, but wonderful places and the limit of 250MB the app has to be suitable.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Browser&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;I'm using the Dolphin HD. It works everywhere, but I limit myself to WEB pages done for mobile devices:&amp;nbsp; less traffic and better readability.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Google Navigator&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Useful for short distances or in a city. It suggests always the shortest way to the target. &lt;br /&gt;&lt;br /&gt;For long distances is better to check the route with Google Maps. Once, the navigator told me to leave the highway, go through a small town and go back to the highway simply because it was the shorter way.&amp;nbsp; This was wrong because the route on the highway is longer but much faster.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Social Network&lt;/i&gt;s&lt;br /&gt;&lt;br /&gt;Facebook, Twitter, Foursquare, Gowalla work fine everywhere, but don't forget that your smartphone may take large pictures and videos. If you load everything you may exceed the weekly limit of the account.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;MapDroyd&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;This is a very useful app, because the maps may be preloaded on the SD-chip. You may locate yourself even if the connection with the carrier is lost.&lt;br /&gt;&lt;br /&gt;It is fast, much faster as Google Maps, and with enough details.&lt;br /&gt;&lt;br /&gt;Posted via Blogaway&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-1717206353796175890?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/1717206353796175890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/07/holidays-in-italy-with-android.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/1717206353796175890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/1717206353796175890'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/07/holidays-in-italy-with-android.html' title='Holidays in Italy with Android'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-6744368698478281044</id><published>2010-07-08T21:59:00.001+02:00</published><updated>2011-02-26T17:47:10.553+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Developing with the Android Emulator: the Beginning</title><content type='html'>The documentation on &lt;a href="http://developer.android.com/"&gt;Android Developers&lt;/a&gt; is very well done, but there is a lot of informations. Often the informations I need are spread over many different pages.&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;b&gt;Don't Restart&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The first mistake I did was to stop the emulator after every test of the App. Since the emulator takes very long to restart my productivity was really low. Using Eclipse and the ADT plug-in, it is sufficient to re-run the configuration: the ADT prepares the new version of the App and installs it on the emulated device. This way testing and debugging is easy and efficient.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Play with the Emulator&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The my second mistake was to start with the development before I did really understand the environment.&lt;br /&gt;&lt;br /&gt;The state of the emulation may be changed using predefined &lt;a href="http://developer.android.com/guide/developing/tools/emulator.html#controlling"&gt;keyboard shortcuts&lt;/a&gt;. This is really useful. &lt;br /&gt;&lt;br /&gt;The application will support a wide range of devices if you test it with 2 or 3 different profiles.&lt;br /&gt;&lt;br /&gt;I defined three profiles: small, medium, and large.&amp;nbsp; Small is a device without touch, without SD card and with less memory. Medium is a device with a 320x480 touch screen, 1GB SD card and 512MB memory. Large is a device with a 480x800 touch screen, 4GB SD card and 576MB memory.&lt;br /&gt;&lt;br /&gt;First &lt;a href="http://developer.android.com/guide/developing/tools/othertools.html#mksdcard"&gt;create the SD card&lt;/a&gt; (100 MB should be enough) and than fill the profile form. I use dimensions and not a predefined screen type.&amp;nbsp; Additionally I set up the screen resolution and the device memory. Both are properties to add at the end if the profile form.&lt;br /&gt;&lt;br /&gt;Name: &lt;i style="color: #999999;"&gt;Small&lt;/i&gt;; Target: &lt;i style="color: #999999;"&gt;Android 1.5 - API Level 3&lt;/i&gt;; Resolution: &lt;i style="color: #999999;"&gt;240x320&lt;/i&gt;; Properties: &lt;i&gt;&lt;span style="color: #999999;"&gt;Abstracted LCD Density = 120&lt;/span&gt;,&lt;span style="color: #999999;"&gt; Device ram size = 96&lt;/span&gt;&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Name: &lt;i style="color: #999999;"&gt;Medium&lt;/i&gt;; Target: &lt;i style="color: #999999;"&gt;Android 1.5 - API Level 3&lt;/i&gt;; Resolution: &lt;i style="color: #999999;"&gt;320x480&lt;/i&gt;; Properties: &lt;i&gt;&lt;span style="color: #999999;"&gt;Abstracted LCD Density = 160&lt;/span&gt;,&lt;span style="color: #999999;"&gt; Device ram size = 512&lt;/span&gt;&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;Name: &lt;i style="color: #999999;"&gt;Large&lt;/i&gt;; Target: &lt;i style="color: #999999;"&gt;Android 2.1 - API Level 7&lt;/i&gt;; Resolution: &lt;i style="color: #999999;"&gt;480x800&lt;/i&gt;; Properties: &lt;i&gt;&lt;span style="color: #999999;"&gt;Abstracted LCD Density = 240&lt;/span&gt;,&lt;span style="color: #999999;"&gt; Device ram size = 576&lt;/span&gt;&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;The Note Pad sample may be used to play with the emulator and to discover the development environment. At the beginning don't try to understand the code. Place two or three break points and start to debug the application. This way you will quickly familiarize with Android.&lt;br /&gt;&lt;br /&gt;Keep in mind that the emulator does many things but doesn't replace a true device. For example: the emulator cannot vibrate.&lt;br /&gt;&lt;br /&gt;Posted via Blogaway&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-6744368698478281044?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/6744368698478281044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/07/developing-with-android-emulator.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/6744368698478281044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/6744368698478281044'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/07/developing-with-android-emulator.html' title='Developing with the Android Emulator: the Beginning'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-7434673380728052585</id><published>2010-06-22T13:34:00.002+02:00</published><updated>2011-02-26T17:48:17.449+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='repository'/><category scheme='http://www.blogger.com/atom/ns#' term='Solaris'/><category scheme='http://www.blogger.com/atom/ns#' term='GIT'/><title type='text'>How To: GIT repository on Solaris 10</title><content type='html'>Last year I did replace my SVN software repository with GIT.&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;Now I wish to improve the environment because I have to work on different workplaces and I need some help from other employees to deliver the software on time.&lt;br /&gt;&lt;br /&gt;Since there is no free LINUX installation which I may use to place the "bare" instance of the repository I have to install the software and the data on a SUN Solaris 10 server. &lt;a href="http://www.sunfreeware.com/indexsparc10.html"&gt;sunfreeware&lt;/a&gt; provides the GIT software with instructions and requirements. I was able to install and use GIT on our two year old Solaris 10 instance without any problem.&lt;br /&gt;&lt;br /&gt;GIT doesn't require a lot of space: I did place the repository on a 30 GB partition, which holds also our daily backups. I like simple environments, so I did define a single UNIX user (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;git:git&lt;/span&gt;) to access and administrate the repository. GIT keeps anyway track of the user which commits a change, so I don't need to define different access permissions for each developer. Anyway it would be easy to authorize an observer: I would only need to create the user &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;observer:git&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The following section summarizes the steps necessary to create the bare instance. If you don't have &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;root &lt;/span&gt;permission on the Solaris server you need to ask your administrator to create the user &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;git:git&lt;/span&gt; and the root folder for your repositories (e.g &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/data/gitroot&lt;/span&gt;). Login as git and execute:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: plain"&gt;mkdir my_project.git&lt;br /&gt;chmod 775 my_project.git&lt;br /&gt;chmod g+s my_project.git&lt;br /&gt;cd my_project.git&lt;br /&gt;git init --shared=group --bare&lt;br /&gt;cd hooks&lt;br /&gt;mv post-update.sample post-update&lt;/pre&gt;To initialize the local repository (on UNIX or on Windows) I use the command &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;clone git@myserver:/data/gitroot/my_project.git&lt;/span&gt;. In my environment the different GIT instances communicates using a secure shell (SSH) connection with public/private key authorization.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update (28.10.2010) &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Today I tried to clone a GIT repository from a new Solaris 10 server. The GIT client fails and displays the error "&lt;i&gt;bash: git-upload-pack: command not found&lt;/i&gt;". The reason is that the default PATH environment variable doesn't contain the path &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/usr/local/bin&lt;/span&gt;. The solution of the problem is to add the missing path changing the file &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;/etc/defaults/login&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-7434673380728052585?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/7434673380728052585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/06/how-to-git-repository-on-solaris-10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/7434673380728052585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/7434673380728052585'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/06/how-to-git-repository-on-solaris-10.html' title='How To: GIT repository on Solaris 10'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-1352805954922771323</id><published>2010-06-15T23:23:00.009+02:00</published><updated>2010-06-20T23:32:49.189+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wordpress'/><category scheme='http://www.blogger.com/atom/ns#' term='blogaway'/><category scheme='http://www.blogger.com/atom/ns#' term='blogging'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Blogging with Android: Blogaway, Wordpress</title><content type='html'>&lt;br&gt;Last month I decided to buy a smartphone. I'm a UNIX developer since long time: my choice the HTC Desire.&lt;br /&gt;&lt;br&gt;&lt;b&gt;Display&lt;/b&gt;&lt;br /&gt;&lt;br&gt;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.&lt;br /&gt;&lt;br&gt;The layout I use on Wordpress isn't readable on the smartphone, but the mobile site of Wordpress is really good.&lt;br /&gt;&lt;br&gt;&lt;b&gt;Blogging&lt;/b&gt;&lt;br /&gt;&lt;br&gt;At the beginning everything seemed unconfortable, but once I did understand how to work, what to select and in which sequence bloggging was easy.&lt;br /&gt;&lt;br&gt;&lt;b&gt;Blog-Away&lt;/b&gt;&lt;br /&gt;&lt;br&gt;Blogaway is a Blogspot client for Android. It's everything I need to write down my ideas.&lt;br /&gt;&lt;br&gt;This article was written using the smartphone and Blogaway travelling by train.&lt;br /&gt;&lt;br&gt;Each article may be published as draft and improved later on the PC. The text may be formatted using &lt;b&gt;bold&lt;/b&gt;, &lt;i&gt;italic&lt;/i&gt; 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.&lt;br /&gt;&lt;br&gt;You may find more informations about Blogaway on&amp;#160;&lt;a href="http://blog-and-away.blogspot.com/"&gt;blogspot.com&lt;/a&gt;&amp;#160;or on &amp;#160;&lt;a href="http://twitter.com/blogaway"&gt;Twitter&lt;/a&gt;.&lt;br /&gt;&lt;br&gt;&lt;b&gt;WordPress&lt;/b&gt;&lt;br /&gt;&lt;br&gt;Read my &lt;a href="http://wp.me/pC0f6-2s"&gt;article&lt;/a&gt; on Wordpress&lt;br /&gt;&lt;br&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;&lt;br&gt;Bogging with the smart-phone is possible as additional way to add articles. It is suitable for short and simple text.&lt;br /&gt;&lt;br&gt;If a blog is readable or not depends on the theme.&lt;br /&gt;&lt;br&gt;Posted via Blogaway&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-1352805954922771323?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/1352805954922771323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/06/blogging-with-android-blogaway_15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/1352805954922771323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/1352805954922771323'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/06/blogging-with-android-blogaway_15.html' title='Blogging with Android: Blogaway, Wordpress'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-6065561305370759578</id><published>2010-04-05T20:09:00.001+02:00</published><updated>2010-04-05T20:14:10.105+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Fedora-10'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='ElasticServer'/><category scheme='http://www.blogger.com/atom/ns#' term='EC2'/><title type='text'>Small J2EE Fedora Development Server On Amazon EC2.</title><content type='html'>&lt;p&gt;                        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.                      &lt;/p&gt;                      &lt;p&gt;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.                      &lt;/p&gt;                      &lt;p&gt;                        I signed up for Amazon S3 and EC2 to be able to run a                        LINUX AMI. The first question is:                        &lt;i&gt;where may I find a Fedora AMI?&lt;/i&gt;                      &lt;/p&gt;                      &lt;p&gt;                        The best solution for me seems to be a self defined AMI                        built using                        &lt;a href="https://elasticserver.com/"&gt;Elastic Server&lt;/a&gt;.                        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.                      &lt;/p&gt;                      &lt;p&gt;                         Elastic Server build, deploys and starts the AMI                         automatically. I had to define a S3 bucked, something like                         &lt;i&gt;                          daniele-ami                        &lt;/i&gt;                         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 &lt;strong&gt;Access Key&lt;/strong&gt;. 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.                      &lt;/p&gt;                      &lt;p&gt;                        Elastic Server sends an email to the account owner                        containing all the informations to access the the                        running instance.                      &lt;/p&gt;                      &lt;p&gt;                        The login (&lt;i&gt;cftuser&lt;/i&gt;) may be performed using                        &lt;a                          href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html"&gt;PuTTY&lt;/a&gt;                        (Windows) or ssh (UNIX). To gain                        &lt;i&gt;                          root                        &lt;/i&gt;                        access I have to use the command                        &lt;i&gt;                          sudo su -                        &lt;/i&gt;                        . A quick check of the environment confirms that everything works as expected.                      &lt;/p&gt;                      &lt;h4&gt;Add a Data Volume&lt;/h4&gt;                      &lt;p&gt;                         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                         &lt;a href="https://console.aws.amazon.com/ec2/home"&gt;AWS                          console&lt;/a&gt;. &lt;strong&gt;Note&lt;/strong&gt;: the volume have to be defined in                           the same zone as the EC2 instance.                      &lt;/p&gt;                      &lt;p&gt;The volume is attached as device &lt;i&gt;sdf&lt;/i&gt; (&lt;i&gt;/dev/sdf&lt;/i&gt;)&lt;/p&gt;                      &lt;p&gt;Now the procedure is the same used to add a disk to any LINUX system:&lt;/p&gt;                      &lt;ol&gt;                        &lt;li&gt;                            Use fdisk (fdisk /dev/sdf) to delete all existing partitions (select d).                          &lt;/li&gt;                        &lt;li&gt;                           Save the new (empty) partition table (select w).                         &lt;/li&gt;                        &lt;li&gt;                            Add a new partition (select n).                          &lt;/li&gt;                        &lt;li&gt;                           Save the new partition table (select w).                        &lt;/li&gt;                        &lt;li&gt;                            Use mkfs (e.g. mkfs -t ext3 /dev/sdf1) to format the patition.                         &lt;/li&gt;                        &lt;li&gt;                            Use tune2fs (e.g. tune2fs -L /data /dev/sdf1) to put a label on the patition.                         &lt;/li&gt;                        &lt;li&gt;                           Create the mount point (e.g. mkdir /data).                        &lt;/li&gt;                        &lt;li&gt;                           Modify the file /etc/fstab as displayed into the next section.                        &lt;/li&gt;                        &lt;li&gt;                            Mount the partition (e.g. mount /data).                         &lt;/li&gt;                      &lt;/ol&gt;                      &lt;pre class="brush: plain"&gt;# /etc/fstab: static file system information.&lt;br /&gt;# AMI version&lt;br /&gt;#&lt;br /&gt;# 'file system' 'mount point'   'type'  'options'       'dump'  'pass'&lt;br /&gt;/dev/sda1       /               ext3    defaults,errors=remount-ro 1    1&lt;br /&gt;/dev/sda2       /mnt            ext3    defaults        0       0&lt;br /&gt;/dev/sda3       none            swap    sw              0       0&lt;br /&gt;proc            /proc           proc    defaults        0       0&lt;br /&gt;none            /sys            sysfs   defaults        0       0&lt;br /&gt;none            /dev/shm        tmpfs   defaults        0       0&lt;br /&gt;none            /dev/pts        devpts  gid=5,mode=620  0       0&lt;br /&gt;LABEL=/data     /data           ext3    defaults        1       2&lt;/pre&gt;                      &lt;p&gt;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:                      &lt;/p&gt;                      &lt;pre class="brush: plain"&gt;#!/bin/bash&lt;br /&gt;mkdir /data&lt;br /&gt;echo "LABEL=/data     /data           ext3    defaults        1       2" &gt;&gt; /etc/fstab&lt;br /&gt;/bin/mount /data&lt;/pre&gt;                      &lt;p&gt;Execute:&lt;/p&gt;                      &lt;ul&gt;                        &lt;li&gt;sudo su -&lt;/li&gt;                        &lt;li&gt;vi setup&lt;/li&gt;                        &lt;li&gt;copy &amp;amp; paste&lt;br /&gt;&lt;/li&gt;                        &lt;li&gt;sh setup&lt;/li&gt;                      &lt;/ul&gt;&lt;p&gt;The cost for an afternoon of programming and testing is $0.40 which is really cheap.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-6065561305370759578?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/6065561305370759578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/04/small-j2ee-fedora-development-server-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/6065561305370759578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/6065561305370759578'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/04/small-j2ee-fedora-development-server-on.html' title='Small J2EE Fedora Development Server On Amazon EC2.'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-1867044117235122171</id><published>2010-01-27T13:11:00.004+01:00</published><updated>2010-08-05T18:07:27.130+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mvc'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='application engine'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><category scheme='http://www.blogger.com/atom/ns#' term='archetype'/><title type='text'>MVC on the Google App Engine with Spring 3.0</title><content type='html'>&lt;p&gt;                         On the Google App Engine (GAE) I can deploy and test                         applications very quickly. What I need now is a                         programming &amp;quot;toolkit&amp;quot; wich is essential and                         efficient.                       &lt;/p&gt;                      &lt;p&gt;                        I thought about using                        &lt;a href="http://grails.org/" target="_blank"                          title="Grails Home"&gt;Grails&lt;/a&gt;                        but there is a lot of dependencies I don't want.                      &lt;/p&gt;                      &lt;p&gt;                        An implementaion based solely on the Servlet API wolud                        be essential but time consuming.                      &lt;/p&gt;                      &lt;p&gt;                         I decide to use the last release of the Springframework                         to see if it is possible to set up a project template                         for the GAE.                       &lt;/p&gt;                      &lt;h4&gt;The Application Template&lt;/h4&gt;                      &lt;p&gt;                         At this time I need two modules:                       &lt;/p&gt;                      &lt;ul&gt;                        &lt;li&gt;                           &lt;strong&gt;home&lt;/strong&gt; with the pages &lt;em&gt;&amp;quot;home&amp;quot;&lt;/em&gt;,                           &amp;quot;&lt;em&gt;about&lt;/em&gt;&amp;quot; and &lt;em&gt;&amp;quot;description&amp;quot;&lt;/em&gt;.                         &lt;/li&gt;                        &lt;li&gt;                           &lt;strong&gt;stage&lt;/strong&gt; with some different controllers service each a page called                             &lt;em&gt;&amp;quot;list&amp;quot;&lt;/em&gt; and                            a page called &lt;em&gt;&amp;quot;details&amp;quot;&lt;/em&gt;.                        &lt;/li&gt;                      &lt;/ul&gt;                      &lt;p&gt;&lt;strong&gt;Home&lt;/strong&gt;&lt;/p&gt;                      &lt;p&gt;                        This section is display-only and supports the GET method                        only. &amp;quot;Welcome&amp;quot; contains the list of the                        &lt;a href="http://cyber.law.harvard.edu/rss/rss.html"                          target="_blank" title="RSS 2.0 Specifications"&gt;RSS&lt;/a&gt;                        feeds into the HEADER, but if something goes wrong the                        feed are simply missing. No error message is displayed.                      &lt;/p&gt;                      &lt;p&gt;                          &lt;strong&gt;Stage&lt;/strong&gt;                      &lt;/p&gt;                      &lt;p&gt;                        The stage is a restricted area containing lists and                        forms.                      &lt;/p&gt;                      &lt;p&gt;                        This section implements the feed registration where                        &lt;em&gt;&amp;quot;list&amp;quot;&lt;/em&gt; contains a short summary of                         all the available feeds. From this page I may add or                         delete a feed.                       &lt;/p&gt;                      &lt;p&gt;                        The &amp;quot;details&amp;quot; page is a form containing all                        the fields. The feed may be modified or deleted.                      &lt;/p&gt;                      &lt;h4&gt;The Project Layout&lt;/h4&gt;                      &lt;p&gt;                        The different parts of the application have to be easily                        identified on the filesystem. By convention the path of                        the java packages is build on a prefix (application.web)                        and using the name of the section:                      &lt;/p&gt;                      &lt;pre class="brush: plain"&gt;application.web.home &lt;br /&gt;application.web.stage&lt;/pre&gt;                      &lt;p&gt;                        Each section has at least one controller. The name is                        composed by the section name and the word controller.                      &lt;/p&gt;                      &lt;pre class="brush: plain"&gt;application.web.home.HomeController &lt;br /&gt;application.web.stage.StageController&lt;/pre&gt;                      &lt;p&gt;                        The stage sections contains more controllers one for                        each editor with restricted access. At this time I have                        the only the &amp;quot;feed&amp;quot; editor.                      &lt;/p&gt;                      &lt;pre class="brush: plain"&gt;application.web.stage.FeedController&lt;/pre&gt;                      &lt;p&gt;                        I use a similar convention for the views (JSP pages).                        The views are placed under WEB-INF/views:                      &lt;/p&gt;                      &lt;pre class="brush: plain"&gt;WEB-INF/views/home/about.jsp &lt;br /&gt;WEB-INF/views/home/description.jsp &lt;br /&gt;WEB-INF/views/home/home.jsp &lt;br /&gt; &lt;br /&gt;WEB-INF/views/stage/stage.jsp &lt;br /&gt;WEB-INF/views/stage/feed.jsp &lt;br /&gt;WEB-INF/views/stage/feedDetails.jsp&lt;/pre&gt;                      &lt;p&gt;                        The whole layout was created using                        &lt;a href="http://maven.apache.org/" target="_blank"                          title="Maven Home"&gt;Maven&lt;/a&gt; (                        &lt;code&gt;                          mvn archetype:generate                        &lt;/code&gt;                        ). I did merge &amp;quot;maven-archetype-quickstart&amp;quot;                        and &amp;quot;maven-archetype-webapp&amp;quot;.                      &lt;/p&gt;                      &lt;h4&gt;The Controllers&lt;/h4&gt;                      &lt;p&gt;The home controller is quite simple:&lt;/p&gt;                      &lt;pre class="brush: java;"&gt;package ch.clx.application.web.home;&lt;br /&gt;...&lt;br /&gt;@Controller&lt;br /&gt;@RequestMapping("/home")&lt;br /&gt;public class HomeController {&lt;br /&gt;    &lt;br /&gt;  @RequestMapping(method = RequestMethod.GET)&lt;br /&gt;  public String get(final ModelMap model) {&lt;br /&gt;    ...&lt;br /&gt;    model.addAttribute("version", Version.version);&lt;br /&gt;    return "home";&lt;br /&gt;  }&lt;br /&gt;    &lt;br /&gt;  @RequestMapping(value="/about", method = RequestMethod.GET)&lt;br /&gt;  public String about(final ModelMap model) {&lt;br /&gt;    model.addAttribute("version", Version.version);&lt;br /&gt;    return "about";&lt;br /&gt;  }&lt;br /&gt;    &lt;br /&gt;  @RequestMapping(value="/description", method = RequestMethod.GET)&lt;br /&gt;  public String description(final ModelMap model) {&lt;br /&gt;    model.addAttribute("version", Version.version);&lt;br /&gt;    return "description";&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;                      &lt;p&gt;                        The feed controller is a simple                        &lt;a                          href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete"                          target="_blank"                          title="Definition of CRUD"                        &gt;CRUD&lt;/a&gt; editor. The GET method returns the list of the                        feeds (the feed view).                      &lt;/p&gt;                      &lt;ul&gt;                        &lt;li&gt;                          &lt;em&gt;Add&lt;/em&gt; (C) creates a new entry and displays the form                           with all the fields (detail view).                         &lt;/li&gt;                        &lt;li&gt;                          &lt;em&gt;Delete&lt;/em&gt; (D) removes an existing entry.                        &lt;/li&gt;                        &lt;li&gt;                          &lt;em&gt;Edit&lt;/em&gt; (R) displays an existing entry (detail view).                        &lt;/li&gt;                        &lt;li&gt;                          &lt;em&gt;Store&lt;/em&gt; (U) updates an existing entry.                        &lt;/li&gt;                      &lt;/ul&gt;                      &lt;pre class="brush: java;"&gt;package ch.clx.application.web.stage;  &lt;br /&gt;...  &lt;br /&gt;@Controller  &lt;br /&gt;@RequestMapping(&amp;quot;/stage/feed&amp;quot;)  &lt;br /&gt;public class FeedController {  &lt;br /&gt;      &lt;br /&gt;  @RequestMapping(method = RequestMethod.GET)  &lt;br /&gt;  public String get(final ModelMap model) {  &lt;br /&gt;    ...  &lt;br /&gt;    model.addAttribute(&amp;quot;version&amp;quot;, Version.version);  &lt;br /&gt;    return &amp;quot;feed&amp;quot;;  &lt;br /&gt;  }  &lt;br /&gt;      &lt;br /&gt;  @RequestMapping(value = &amp;quot;/add&amp;quot;, method = RequestMethod.POST)  &lt;br /&gt;  public String add(  &lt;br /&gt;    @RequestParam(&amp;quot;id&amp;quot;) final String id,   &lt;br /&gt;    final ModelMap model) {  &lt;br /&gt;    ...  &lt;br /&gt;    model.addAttribute(&amp;quot;version&amp;quot;, Version.version);  &lt;br /&gt;    return &amp;quot;feedDetails&amp;quot;;  &lt;br /&gt;  }  &lt;br /&gt;      &lt;br /&gt;  @RequestMapping(value = &amp;quot;/delete&amp;quot;, method = RequestMethod.POST)  &lt;br /&gt;  public String add(  &lt;br /&gt;    @RequestParam(&amp;quot;id&amp;quot;) final String id,   &lt;br /&gt;    final ModelMap model) {  &lt;br /&gt;    ...  &lt;br /&gt;    model.addAttribute(&amp;quot;version&amp;quot;, Version.version);  &lt;br /&gt;    return &amp;quot;feed&amp;quot;;  &lt;br /&gt;  }  &lt;br /&gt;      &lt;br /&gt;  @RequestMapping(value=&amp;quot;/edit&amp;quot;, method = RequestMethod.GET)  &lt;br /&gt;  public String edit(  &lt;br /&gt;    @RequestParam(&amp;quot;id&amp;quot;) final String id,   &lt;br /&gt;    final ModelMap model) {  &lt;br /&gt;    ... &lt;br /&gt;    model.addAttribute(&amp;quot;version&amp;quot;, Version.version);  &lt;br /&gt;    return &amp;quot;feedDetails&amp;quot;;  &lt;br /&gt;  }  &lt;br /&gt;      &lt;br /&gt;  @RequestMapping(value=&amp;quot;/store&amp;quot;, method = RequestMethod.GET)  &lt;br /&gt;  public String store(  &lt;br /&gt;    @RequestParam(&amp;quot;id&amp;quot;) final String id, &lt;br /&gt;    ..., &lt;br /&gt;    final ModelMap model) {  &lt;br /&gt;    ... &lt;br /&gt;    model.addAttribute(&amp;quot;version&amp;quot;, Version.version);  &lt;br /&gt;    return &amp;quot;feed&amp;quot;;  &lt;br /&gt;  }  &lt;br /&gt;}&lt;/pre&gt;                      &lt;h4&gt;The Context File&lt;/h4&gt;                      &lt;p&gt;                        The context file is very simple because components and                        URL routing are automatically discovered through                        annotations.                        &lt;br /&gt;                      &lt;/p&gt;                      &lt;pre class="brush: xml"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; &lt;br /&gt;&amp;lt;beans &lt;br /&gt;  xmlns=&amp;quot;http://www.springframework.org/schema/beans&amp;quot; &lt;br /&gt;  xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; &lt;br /&gt;  xmlns:p=&amp;quot;http://www.springframework.org/schema/p&amp;quot; &lt;br /&gt;  xmlns:context=&amp;quot;http://www.springframework.org/schema/context&amp;quot; &lt;br /&gt;  xsi:schemaLocation=&amp;quot; &lt;br /&gt;    http://www.springframework.org/schema/beans  &lt;br /&gt;    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  &lt;br /&gt;    http://www.springframework.org/schema/context &lt;br /&gt;    http://www.springframework.org/schema/context/spring-context-3.0.xsd&amp;quot; &lt;br /&gt;&amp;gt; &lt;br /&gt;&amp;lt;bean &lt;br /&gt;  class=&amp;quot;org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping&amp;quot;/&amp;gt; &lt;br /&gt;&amp;lt;bean &lt;br /&gt;  class=&amp;quot;org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter&amp;quot;/&amp;gt; &lt;br /&gt; &lt;br /&gt;&amp;lt;context:component-scan base-package=&amp;quot;gae.application&amp;quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;bean &lt;br /&gt;  id=&amp;quot;viewResolver&amp;quot; &lt;br /&gt;  class=&amp;quot;org.springframework.web.servlet.view.ResourceBundleViewResolver&amp;quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/beans&amp;gt;&lt;/pre&gt;                      &lt;h4&gt;                        The Deployment Descriptor                      &lt;/h4&gt;                      &lt;p&gt;web.xml&lt;/p&gt;                      &lt;pre class="brush: xml"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; &lt;br /&gt;&amp;lt;web-app &lt;br /&gt;  id=2gae-application&amp;quot; &lt;br /&gt;  version=&amp;quot;2.4&amp;quot; &lt;br /&gt;  xmlns=&amp;quot;http://java.sun.com/xml/ns/j2ee&amp;quot; &lt;br /&gt;  xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; &lt;br /&gt;  xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/j2ee  &lt;br /&gt;      http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd&amp;quot;/&amp;gt; &lt;br /&gt;  &amp;lt;display-name&amp;gt;gae-application&amp;lt;/display-name&amp;gt; &lt;br /&gt;  &amp;lt;servlet&amp;gt; &lt;br /&gt;    &amp;lt;display-name&amp;gt;Dispatcher Servlet&amp;lt;/display-name&amp;gt; &lt;br /&gt;    &amp;lt;servlet-name&amp;gt;Dispatcher-Servlet&amp;lt;/servlet-name&amp;gt; &lt;br /&gt;    &amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt; &lt;br /&gt;    &amp;lt;init-param&amp;gt;&lt;br /&gt;      &amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;&lt;br /&gt;      &amp;lt;param-value&amp;gt;/WEB-INF/WebCtx.xml&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/init-param&amp;gt;&lt;br /&gt;    &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;  &amp;lt;/servlet&amp;gt;&lt;br /&gt;  &amp;lt;servlet-mapping&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;Dispatcher-Servlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;url-pattern&amp;gt;/bo/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;  &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;  &amp;lt;welcome-file-list&amp;gt;&lt;br /&gt;    &amp;lt;welcome-file&amp;gt;index.jsp&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;  &amp;lt;/welcome-file-list&amp;gt;&lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;/pre&gt;                      &lt;h4&gt;                        The GAE Deployment Descriptor                      &lt;/h4&gt;                      &lt;p&gt;                        appengine-web.xml                      &lt;/p&gt;                      &lt;pre class="brush: xml"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; &lt;br /&gt;&amp;lt;appengine-web-app xmlns=&amp;quot;http://appengine.google.com/ns/1.0&amp;quot;&amp;gt; &lt;br /&gt;&amp;lt;application&amp;gt;gae-application&amp;lt;/application&amp;gt; &lt;br /&gt;&amp;lt;version&amp;gt;beta-1&amp;lt;/version&amp;gt; &lt;br /&gt;&amp;lt;system-properties&amp;gt; &lt;br /&gt;&amp;lt;property &lt;br /&gt;  name=&amp;quot;java.util.logging.config.file&amp;quot; &lt;br /&gt;  value=&amp;quot;WEB-INF/classes/logging.properties&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;/system-properties&amp;gt; &lt;br /&gt;&amp;lt;/appengine-web-app&amp;gt;&lt;/pre&gt;                      &lt;h4&gt;                        The Maven Archetype                      &lt;/h4&gt;                      &lt;p&gt;                        At the end of my experiment I pack my template                        application in a Maven archetype. I is enough to add the                        following pom.xml file to the project:                      &lt;/p&gt;                      &lt;pre class="brush: xml"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;project&lt;br /&gt;  xmlns=&amp;quot;http://maven.apache.org/POM/4.0.0&amp;quot;&lt;br /&gt;  xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;  xsi:schemaLocation=&amp;quot;http://maven.apache.org/POM/4.0.0 &lt;br /&gt;    http://maven.apache.org/maven-v4_0_0.xsd&amp;quot;&amp;gt;&lt;br /&gt;  &amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;&lt;br /&gt;  &amp;lt;groupId&amp;gt;cloud.gae.application&amp;lt;/groupId&amp;gt;&lt;br /&gt;  &amp;lt;artifactId&amp;gt;gae-application&amp;lt;/artifactId&amp;gt;&lt;br /&gt;  &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;&lt;br /&gt;  &amp;lt;packaging&amp;gt;war&amp;lt;/packaging&amp;gt;&lt;br /&gt;  ...&lt;br /&gt;  &amp;lt;build&amp;gt;&lt;br /&gt;    &amp;lt;finalName&amp;gt;${artifactId}&amp;lt;/finalName&amp;gt;&lt;br /&gt;    ...&lt;br /&gt;  &amp;lt;/build&amp;gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;/pre&gt;                      &lt;p&gt;                        Now type                        &lt;code&gt;                          mvn archetype:create-from-project                        &lt;/code&gt;                        to generate the archetype. Change the directory (                        &lt;code&gt;                          cd target/generated-sources/archetype                        &lt;/code&gt;                        ) and execute                        &lt;code&gt;                          mvn install                        &lt;/code&gt;                        .                      &lt;/p&gt;                      &lt;p&gt;                        Using                        &lt;code&gt;                          mvn archetype:generate                        &lt;/code&gt;                        now I may generate a GAE application ready to use. It                        does nothing but as starter kit for GAE applications is                        not bad.                      &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-1867044117235122171?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/1867044117235122171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/01/mvc-on-google-app-engine-with-spring-30.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/1867044117235122171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/1867044117235122171'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/01/mvc-on-google-app-engine-with-spring-30.html' title='MVC on the Google App Engine with Spring 3.0'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-7955399181847543813</id><published>2010-01-16T21:41:00.006+01:00</published><updated>2010-08-05T18:01:44.565+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='service'/><category scheme='http://www.blogger.com/atom/ns#' term='url'/><category scheme='http://www.blogger.com/atom/ns#' term='shortening'/><category scheme='http://www.blogger.com/atom/ns#' term='shorturl'/><title type='text'>URL Shortening Service</title><content type='html'>&lt;p&gt;                        A URL shortening service is not essential for the most                        part of the applications in the WEB and may be dangerous                        because the surfer doesn't see what lies behind the                        short URL. But if I would like to publish something on a                        short messaging system like Twitter I need a very short                        URL.                      &lt;/p&gt;                      &lt;p&gt;                        The solution would be to register a very short domain                        like                        &lt;b&gt;&lt;span style="color: blue;"&gt;goo.gl&lt;/span&gt; &lt;/b&gt; and to                        run my own shortener, but for my application the                        additional effort is out of scope. So I need to connect                        to an existing URL shortening service.                      &lt;/p&gt;                      &lt;p&gt;                        The beginner has a first obstacle: where to find an                        inexpensive reliable URL shortening service. Using a                        search engine I did found a lot of service which are                        also free of charge, but no way to proof if the are also                        reliable.                      &lt;/p&gt;                      &lt;h4&gt;                        Service Requirements                      &lt;/h4&gt;                      &lt;p&gt;                        Since I want to generate the short URL into the                        background I need a service with API support.                        Additionally stating from the short URL I want to obtain                        the original (long) URL.                      &lt;/p&gt;                      &lt;h4&gt;                        The candidates                      &lt;/h4&gt;                      &lt;ul&gt;                        &lt;li&gt;                          &lt;a href="http://bit.ly/"&gt;http://bit.ly&lt;/a&gt;                        &lt;/li&gt;                        &lt;li&gt;                          &lt;a href="http://budurl.com/"&gt;http://budurl.com/&lt;/a&gt;                        &lt;/li&gt;                        &lt;li&gt;                          &lt;a href="http://cli.gs/"&gt;http://cli.gs&lt;/a&gt;                        &lt;/li&gt;                        &lt;li&gt;                          &lt;a href="http://is.gd/"&gt;http://is.gd&lt;/a&gt;                        &lt;/li&gt;                        &lt;li&gt;                          &lt;a href="http://snipurl.com/"&gt;http://snipurl.com&lt;/a&gt;                        &lt;/li&gt;                        &lt;li&gt;                          &lt;a href="http://tinyurl.com/"&gt;http://tinyurl.com&lt;/a&gt;                        &lt;/li&gt;                        &lt;li&gt;                          &lt;a href="http://zi.ma/"&gt;http://zi.ma&lt;/a&gt;                        &lt;/li&gt;                      &lt;/ul&gt;                      &lt;p&gt;                        I didn't want to check all the services, for instance                        four of them are enough.                      &lt;/p&gt;                      &lt;h4&gt;                        bit.ly                      &lt;/h4&gt;                      &lt;p&gt;                        The service is free of charge, but&amp;nbsp; requires a                        registration and checks each request using an API key.                      &lt;/p&gt;                      &lt;ul&gt;                        &lt;li&gt;                          Homepage with a clear description of the service.                        &lt;/li&gt;                        &lt;li&gt;                          Simple well documented API.                        &lt;/li&gt;                        &lt;li&gt;                          Shorten and expand functions.                        &lt;/li&gt;                        &lt;li&gt;                          JSON and XML formatted response.                          &lt;br /&gt;                        &lt;/li&gt;                        &lt;li&gt;                          Simple but nice statistics summary.                        &lt;/li&gt;                        &lt;li&gt;                          Blog                        &lt;/li&gt;                      &lt;/ul&gt;                      &lt;p&gt;                        I like bit.ly and is currently my first choice.                      &lt;/p&gt;                      &lt;h4&gt;                        is.gd                      &lt;/h4&gt;                      &lt;p&gt;                        The service is free of charge and doesn't require a                        registration.                      &lt;/p&gt;                      &lt;ul&gt;                        &lt;li&gt;                          Homepage with a clear description of the service.                        &lt;/li&gt;                        &lt;li&gt;                          Very simple API with documentation.                        &lt;/li&gt;                        &lt;li&gt;                          Shorten only function.                        &lt;/li&gt;                        &lt;li&gt;                          Plain text (URL only) response.                        &lt;/li&gt;                      &lt;/ul&gt;                      &lt;p&gt;                        This service is very spartan; I noticed that after two                        or three days the short URL was different. If a very                        short URL is required id.gd may be a good choice.&amp;nbsp;                      &lt;/p&gt;                      &lt;h4&gt;                        snipurl.com                      &lt;/h4&gt;                      &lt;p&gt;                        The service is free of charge, but requires a                        registration and checks each request using an API key.                      &lt;/p&gt;                      &lt;ul&gt;                        &lt;li&gt;                          Homepage with a clear description of the service.                        &lt;/li&gt;                        &lt;li&gt;                          Simple well documented API (Firefox doesn't display                          the page and with the MSIE there are some curious side                          effects, try with                          &lt;a                            href="http://groups.google.com/group/Snipurl/web/is-there-a-snipr-snipurl-api"&gt;is-there-a-snipr-snipurl-api&lt;/a&gt;).                        &lt;/li&gt;                        &lt;li&gt;                          Shorten and expand functions.                        &lt;/li&gt;                        &lt;li&gt;                          XML and plain text (URL only) formatted response.                        &lt;/li&gt;                        &lt;li&gt;                          Simple statistics but searchable statistics.                        &lt;/li&gt;                        &lt;li&gt;                          Help                        &lt;/li&gt;                      &lt;/ul&gt;                      &lt;p&gt;&lt;/p&gt;                      SnipURL exists since the year 2000, which is a sign of                      reliability. I miss the JSON formatted response, but the                      service is good.                      &lt;/p&gt;                      &lt;h4&gt;                        tinyurl.com                      &lt;/h4&gt;                      &lt;p&gt;&lt;/p&gt;                      The service is free of charge and doesn't require a                      registration.                      &lt;/p&gt;                      &lt;ul&gt;                        &lt;li&gt;                          Homepage with a clear description of the service.                        &lt;/li&gt;                        &lt;li&gt;                          Very simple API.                        &lt;/li&gt;                        &lt;li&gt;                          Shorten only function.                        &lt;/li&gt;                        &lt;li&gt;                          Plain text (URL only) response.                        &lt;/li&gt;                      &lt;/ul&gt;                      &lt;p&gt;&lt;/p&gt;                      The service is very spartan, but the short URL is the same                      over the time.                      &lt;/p&gt;                      &lt;h4&gt;                        Test the services                      &lt;/h4&gt;                      &lt;p&gt;                        I did test this services for a while using a very simple                        HTTP client.                      &lt;/p&gt;                      &lt;h4&gt;                        Client Requirements                      &lt;/h4&gt;                      &lt;p&gt;                        The client have to be essential, but should be able to:                      &lt;/p&gt;                      &lt;ul&gt;                        &lt;li&gt;                          retry the connection three times before to give up.                        &lt;/li&gt;                        &lt;li&gt;                          follow the redirects (max three levels of                          indirection).                        &lt;/li&gt;                        &lt;li&gt;                          support GET &amp;amp; POST.                        &lt;/li&gt;                        &lt;li&gt;                          support the secure socket layer (SSL, nice to have).                        &lt;/li&gt;                      &lt;/ul&gt;                      &lt;h4&gt;                        Implementation                      &lt;/h4&gt;                      &lt;p&gt;                        I use a very simple implementation done in Java and                        based on the HttpURLConnection, the following snippet                        shows the essential part of the code:                      &lt;/p&gt;                      &lt;pre class="brush: java; gutter: true;"&gt;...&lt;br /&gt;URL url = URL("http://myserver.com");&lt;br /&gt;HttpURLConnection conn = (HttpURLConnection)url.openConnection();&lt;br /&gt;conn.setRequestMethod("GET");&lt;br /&gt;conn.addRequestProperty("User-Agent","FastShortGood/1.0 Java/6");&lt;br /&gt;...&lt;br /&gt;// Extract the character set from the "Content-Type"&lt;br /&gt;// header using a regular expression. If none available&lt;br /&gt;// assume "UTF-8"&lt;br /&gt;...&lt;br /&gt;StringBuilder buf = new StringBuilder();&lt;br /&gt;InputStream is = conn.getInputStream();&lt;br /&gt;BufferedReader br = new BufferedReader(new InputStreamReader(is, charset));&lt;br /&gt;String line;&lt;br /&gt;while (null != (line = br.readLine())) {&lt;br /&gt;  buf.append(line).append("\n");&lt;br /&gt;}&lt;br /&gt;String body = buf.toString();&lt;br /&gt;&lt;br /&gt;// Extract the short URL from response body using a&lt;br /&gt;// regular expression.&lt;br /&gt;&lt;/pre&gt;                      &lt;p&gt;                        For the complete implementation I need about 300 lines                        of code. The most of them handles exceptions and HTTP                        respose codes. The lightweight client works well with                        all of the shortener services.                      &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-7955399181847543813?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/7955399181847543813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/01/url-shortening-service.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/7955399181847543813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/7955399181847543813'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/01/url-shortening-service.html' title='URL Shortening Service'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-4451380002044541102</id><published>2010-01-03T12:45:00.006+01:00</published><updated>2010-08-05T17:56:35.813+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mime4j'/><category scheme='http://www.blogger.com/atom/ns#' term='application engine'/><category scheme='http://www.blogger.com/atom/ns#' term='mail'/><title type='text'>Receiving Emails with the Google App Engine</title><content type='html'>Last year, in November, I did explore for the first time the Google App Engine for Java (GAE/J). One of the feature my application provides is to accept an email and translate it to an RSS 2.0 item.&lt;br /&gt;The first version of the receiver was done using JavaMail. I did experiment some troubles with the "&lt;i&gt;Quoted-Transfer-Encoding&lt;/i&gt;", sometimes the content was broken.&lt;br /&gt;Using the current version of the GAE/J (1.3.0) the emails content received from Gmail or from Thunderbird is correct and the channel seems to be reliable.&lt;br /&gt;&lt;h4&gt;Mime4J&lt;/h4&gt;An alternative for receiving email is the &lt;a href="http://james.apache.org/mime4j/index.html"&gt;James Mime4J&lt;/a&gt; project.&lt;br /&gt;The library doesn't have dependencies and works on the GAE/J. It is quite simple to use; instead of:&lt;br /&gt;&lt;pre class="brush: java; gutter: true; highlight: [7,8,9]"&gt;import java.io.InputStream;&lt;br /&gt;import java.util.Properties;&lt;br /&gt;import javax.mail.Session;&lt;br /&gt;import javax.mail.internet.MimeMessage;&lt;br /&gt;...&lt;br /&gt;InputStream input = request.getInputStream(); // ServletRequest&lt;br /&gt;Properties props = new Properties();&lt;br /&gt;Session session = Session.getDefaultInstance(props, null);&lt;br /&gt;MimeMessage message = new MimeMessage(session, input); // MessagingException&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;you have to use:&lt;br /&gt;&lt;pre class="brush: java; gutter: true; highlight: [9,10,11,12,13]"&gt;import java.io.InputStream;&lt;br /&gt;import org.apache.james.mime4j.message.Message;&lt;br /&gt;import org.apache.james.mime4j.message.MessageBuilder;&lt;br /&gt;import org.apache.james.mime4j.parser.ContentHandler;&lt;br /&gt;import org.apache.james.mime4j.parser.MimeStreamParser;&lt;br /&gt;import org.apache.james.mime4j.storage.MemoryStorageProvider;&lt;br /&gt;...&lt;br /&gt;InputStream input = request.getInputStream(); // ServletRequest&lt;br /&gt;Message message = new Message();&lt;br /&gt;ContentHandler handler = new MessageBuilder(message, new MemoryStorageProvider());&lt;br /&gt;MimeStreamParser parser = new MimeStreamParser();&lt;br /&gt;parser.setContentHandler(handler);&lt;br /&gt;parser.parse(input); // MimeException&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;The result seems to be better than the one which uses JavaMail. The mails received from the MS Outlook are readable. It remains a small problem with the encoding which I will investigate later this year.&lt;br /&gt;&lt;h4&gt;Incoming Mail Syntax&lt;/h4&gt;The syntax of the incoming mail was changed:&lt;br /&gt;&lt;pre class="brush: plain"&gt;description&lt;br /&gt;line 1&lt;br /&gt;line 2&lt;br /&gt;...&lt;br /&gt;line n&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;link&lt;br /&gt;http://myserver/mylink&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;categories&lt;br /&gt;category 1&lt;br /&gt;category 2&lt;br /&gt;...&lt;br /&gt;category n&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;Each command block starts with a keyword and ends with &lt;i&gt;end&lt;/i&gt;&lt;br /&gt;&lt;h4&gt;Informations&lt;/h4&gt;The email address of the Mime4J service is &lt;a href="mailto:mime4j@example-rest.appspot.com"&gt;mime4j@example-rest.appspotmail.com&lt;/a&gt;, the JavaMail based receiver still works with &lt;a href="mailto:rss2@example-rest.appspot.com"&gt;rss2@example-rest.appspotmail.com&lt;/a&gt;&lt;br /&gt;The application URL is &lt;a href="http://example-rest.appspot.com/" target="_blank"&gt;example-rest.appspot.com&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-4451380002044541102?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/4451380002044541102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2010/01/receiving-email-with-google-application.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/4451380002044541102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/4451380002044541102'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2010/01/receiving-email-with-google-application.html' title='Receiving Emails with the Google App Engine'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-522710638512223980</id><published>2009-11-19T13:20:00.017+01:00</published><updated>2010-01-21T15:37:37.461+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='application engine'/><category scheme='http://www.blogger.com/atom/ns#' term='mail'/><category scheme='http://www.blogger.com/atom/ns#' term='rss'/><title type='text'>First Application on the Google App Engine</title><content type='html'>&lt;p&gt;My first application on the Google App Engine for Java generates a dynamic RSS 2.0 feed.&lt;p&gt;    &lt;h4&gt;Motivation&lt;/h4&gt;&lt;p&gt;Since I like to investigate the behaviour of some different RSS 2.0 feed consumers; I need a tool which allows the quick publication over the Internet.&lt;/p&gt;&lt;h4&gt;Description&lt;/h4&gt;&lt;p&gt;Using an E-Mail client I send a message to the application. The message is persisted into the data store and will be used to build the RSS feed as soon as a consumer requests it.&lt;/p&gt;&lt;h4&gt;Additional Libraries&lt;/h4&gt;&lt;p&gt;Just the &lt;a href="http://www.springsource.org/"&gt;Springframework&lt;/a&gt; (2.5.6), but core and MVC only.&lt;/p&gt;&lt;h4&gt;Components&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;A small &lt;span style="color: #993399; font-style: italic;"&gt;RSS domain model&lt;/span&gt;: the class &lt;span style="color: #993399; font-style: italic;"&gt;RSS2Channel&lt;/span&gt;&lt;span style="color: #993399;"&gt; &lt;/span&gt;and &lt;span style="color: #993399; font-style: italic;"&gt;RSS2Item&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;A &lt;span style="color: #993399; font-style: italic;"&gt;Mail2RSS2&lt;/span&gt;&lt;span style="color: #993399;"&gt; controller&lt;/span&gt; (the infrastructure is provided by Spring).&lt;/li&gt;&lt;li&gt;A &lt;span style="color: #993399; font-style: italic;"&gt;RSS2 controller&lt;/span&gt; (the infrastructure is provided by Spring).&lt;/li&gt;&lt;li&gt;A&lt;span style="font-style: italic;"&gt; &lt;span style="color: #993399;"&gt;DAO layer&lt;/span&gt;&lt;/span&gt; (access to the data store using low level API).&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;Environment&lt;/h4&gt;&lt;p&gt;I did start with &lt;a href="http://eclipse.org/"&gt;Eclipse&lt;/a&gt; and the GAE/J plug-in, but I feel comfortable with &lt;a href="http://maven.apache.org/"&gt;Maven&lt;/a&gt; and batch processing. I work with Maven 2.2.1, SUN JDK 1.6_16 and GAE SDK 1.2.6. I downloaded the GAE SDK for Java and placed the &lt;span style="font-family: courier new;"&gt;bin&lt;/span&gt; directory in my PATH.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Add the files &lt;span style="font-family: courier new;"&gt;appengine-api-1.0-sdk-1.2.6.jar&lt;/span&gt; and &lt;span style="font-family: courier new;"&gt;appengine-api-labs-1.2.6.jar&lt;/span&gt; to the Maven repository. The files are into the &lt;span style="font-family: courier new;"&gt;lib/user&lt;/span&gt; folder.&lt;/li&gt;&lt;li&gt;Add the same files as dependency in the POM file. The scope is compile.&lt;/li&gt;&lt;li&gt;Add the files &lt;span style="font-family: courier new;"&gt;appengine-api-stubs.jar&lt;/span&gt; and &lt;span style="font-family: courier new;"&gt;appengine-local-runtime.jar&lt;/span&gt; to the Maven repository. The files are into the &lt;span style="font-family: courier new;"&gt;lib/impl&lt;/span&gt; folder.&lt;/li&gt;&lt;li&gt;Add the same files as dependency in the POM file. The scope is test.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;With this environment Maven works. The classes can be compiled and the unit tests are successful.&lt;/p&gt;&lt;h4&gt;Debugging&lt;/h4&gt;&lt;p&gt;The command line environment doesn't provide a debugging version out of the box. I did install Eclipse and I added the m2eclipse pug in. The next step was to import the Maven project.&lt;/p&gt;&lt;p&gt;On Windows I start the engine using:&lt;/p&gt;&lt;pre class="brush: plain"&gt;@%JAVA_HOME%\bin\java -cp "%INST_DIR%\lib\appengine-tools-api.jar" -Dlog4j.configuration="%INST_DIR%\config\user\llog4j.properties" -javaagent:%INST_DIR%\lib\agent\appengine-agent.jar -agentlib:jdwp=transport=dt_socket,server=y,address=5300 com.google.appengine.tools.development.DevAppServerMain %*&lt;/pre&gt;On UNIX I start the engine using:&lt;pre class="brush: bash"&gt;$JAVA_HOME/bin/java -ea -cp "$INST_DIR/lib/appengine-tools-api.jar" -Dlog4j.configuration="$INST_DIR/config/user/llog4j.properties" -javaagent:$INST_DIR/lib/agent/appengine-agent.jar -agentlib:jdwp=transport=dt_socket,server=y,address=5300 com.google.appengine.tools.development.DevAppServerMain $*&lt;/pre&gt;&lt;p&gt;The JVM stops an wait on IP port 5300 for the debugger. I switch to Eclipse and open the debug configuration dialog. I define a new remote java application configuration (localhost, port 5300) for the project and start debugging. Now I'm ready for debugging.&lt;/p&gt;&lt;h4&gt;Start up&lt;/h4&gt;&lt;p&gt;The first attempt to start the application was not successful because I did use the Resource annotation which is not into the white list.&lt;/p&gt;&lt;p&gt;Note: &lt;span style="color: #993399; font-style: italic;"&gt;it is impossible to keep in mind which class is allowed and which is not&lt;/span&gt;.The developer, sometimes, must have imagination to find a good alternative and avoid the restriction. The good news is that the environment told me about the error using a clear statement.&lt;/p&gt;&lt;p&gt;Looking at the logs I discovered that the application is stopped after a short idle and restarted by the subsequent request. This is an additional requirement for the application: it will be an advantage to have an implementation which doesn't loose time with long initializations.&lt;/p&gt;&lt;h4&gt;Receiving Mails&lt;/h4&gt;&lt;p&gt;I did define some rules to be able to convert the incoming mail to an RSS item:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The subject of the mail is the title of the item.&lt;/li&gt;&lt;li&gt;The description has to be marked with the [Description] TAG.&lt;/li&gt;&lt;li&gt;The link has to be marked with the [LinkTo] TAG.&lt;/li&gt;&lt;li&gt;The categories have to be marked using the [Categories] TAG.&lt;/li&gt;&lt;li&gt;The separator char for the categories is #.&lt;/li&gt;&lt;li&gt;The mail has to contain a plain text part.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Example:&lt;/p&gt;&lt;pre class="brush: plain"&gt;[Description]Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.[Description]&lt;br /&gt;[LinkTo]http://en.lipsum.com/[LinkTo]&lt;br /&gt;[Categories]lorem ipsum#specimen[Categories]&lt;/pre&gt;&lt;p&gt;At the beginning the local environment posted a ByteArrayInputStream as content of the MimeMessage and not a Multipart object. After adding javax.mail (1.4) to my POM the local GAE returns a Multipart object and behaves as expected.&lt;/p&gt;&lt;p&gt;The run time environment works but if I send a mail using the MS Outlook 2007 there are some troubles. If there is a line which is longer than 78 characters, the mail seems to be incomplete.I suspect that is a problem with the content type encoding "quoted-printable". I will investigate, but not right now.&lt;/p&gt;&lt;h4&gt;Data Store&lt;/h4&gt;&lt;p&gt;Accessing the data store using the low level API is simple and doesn't cause any problem. I did define a simple data access layer (DAO) so I may move a part of the code tested with the GAEto other projects.&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Note&lt;/span&gt;: due to a bug I inserted a non printable char into the data store (key name), the Data Viewer became unusable (application error) until deleted the entity with the application.&lt;/p&gt;&lt;h4&gt;Summary&lt;/h4&gt;&lt;p&gt;The environment is very simple and efficient. The GAE console is a good tool to monitor the behaviour of the application. For small sized applications and tools which use anyway Google services may be a good alternative to a conventional application service provider.&lt;/p&gt;&lt;p&gt;My application is hosted at &lt;a href="http://example-rest.appspot.com/" target="_blank"&gt;example-rest.appspot.com&lt;/a&gt; and the email address is &lt;a href="mailto:rss2@example-rest.appspot.com"&gt;rss2@example-rest.appspotmail.com&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-522710638512223980?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shortfastgood.blogspot.com/feeds/522710638512223980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shortfastgood.blogspot.com/2009/11/first-application-on-gaej.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/522710638512223980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/522710638512223980'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2009/11/first-application-on-gaej.html' title='First Application on the Google App Engine'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5088282793500653080.post-7567107005343536636</id><published>2009-08-15T12:52:00.015+02:00</published><updated>2010-08-05T17:46:43.705+02:00</updated><title type='text'>Test Title To Setup The Formatting</title><content type='html'>Test Paragraph&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Title&lt;/h4&gt;&lt;br /&gt;Test Paragraph&lt;br /&gt;&lt;br /&gt;&lt;pre title="code snippet" class="brush: plain; gutter: true"&gt;code line 1&lt;br /&gt;code line 2&lt;br /&gt;code line 3&lt;/pre&gt;&lt;br /&gt;Test Paragraph&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Title&lt;/h4&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;List item 1&lt;/li&gt;&lt;li&gt;List item 2&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;a href="http://www.blogger.com/" target="_blank"&gt;Blogger&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5088282793500653080-7567107005343536636?l=shortfastgood.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/7567107005343536636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5088282793500653080/posts/default/7567107005343536636'/><link rel='alternate' type='text/html' href='http://shortfastgood.blogspot.com/2009/08/test-title-to-setup-formatting.html' title='Test Title To Setup The Formatting'/><author><name>Daniele Denti</name><uri>http://www.blogger.com/profile/11819357601636623017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_2mDcGx6imSA/S2XhHlN2nFI/AAAAAAAAATs/H7gN1Wd6S24/S220/myface.jpg'/></author></entry></feed>
