2012-03-31

Tweets of the month

30 Mar
IEEE RFID TA 2012 will be held in France http://lcis.grenoble-inp.fr/le-laboratoire/ieee-rfid-ta-2012-453132.kjsp ... Paper deadline: June 18th

29 Mar
SS: embodied curiosity

28 Mar
"Welcome home" :)

19 Mar
Congratulations Dr. B!

19 Mar
Decisive week ahead!

17 Mar
@pedrocustodio Great news Pedro. Happy for you!

16 Mar
@UltraEdit @idmcomp Good job on UltraEdit 18! But have you checked Sublime Text 2's minimap? It's so cool...

15 Mar
RT @VeryFieldsRFID A Conversation With Sanjay Sarma, cofounder of the Auto-ID Center - http://bit.ly/ymp56s - #RFID via RFID Journal

14 Mar
Dear Internet savvy friends - What is my best option for registering a domain name (probably .net)? I have a tight budget :)

13 Mar
Combo IV - Gravity - John Mayer http://youtu.be/GkVNDHuu8oI - drums! drums! ;) If you like the song, you can vote for it on YouTube. Thanks!

13 Mar
Combo IV - Gravity - John Mayer http://youtu.be/GkVNDHuu8oI - drums! drums! ;)

13 Mar
Preparing a talk and a poster for the upcoming IEEE RFID 2012

12 Mar
Facebook and Google Plus - see you next weekend! I've got work to do! :)

9 Mar
RT @josetribolet A nova edição do POSI-E3 vai iniciar-se em Abril. Aproveita e vem construir o futuro no meio da crise. http://posi.ist.utl.pt/

9 Mar
@nfma Olá Nuno. Os teus tweets gourmet são um achado! :)

8 Mar
Re-reading papers and it feels like I'm reading something else - it's amazing how perception plays tricks on you!

6 Mar
Drafting a new paper

6 Mar
@filcab De facto, é preciso paciência para a ignorância. E só nos deixarmos chatear com aquilo que queremos e não com o que outros querem...

6 Mar
@filcab Why so angry?

2012-03-29

STEP back

Recently I was asked to do a small demo of the STEP Framework.
I picked the last version I worked on: STEP Tough, instrumented for performance monitoring.

1. I checked out the source code from SourceForge:

svn co https://stepframework.svn.sourceforge.net/svnroot/stepframework/branches/1_4_toughstep_maintenance toughstep

2. I installed stepcat 1.4-6.0.14, meaning that it contains the libraries for STEP 1.4 and runs Apache Tomcat 6.0.14

Here is stepcat's readme:
"

*********************
*** Tomcat for STEP ***
*********************

This file summarizes the installation procedure and describes the
configuration changes made to prepare the package.

The package version number refers to the supported STEP Framework version and
to the Apache Tomcat version.

Please refer to webapps/ROOT/index.html for the listing of other included and
recommended software versions.

--

Installation guide:

1 - Install recommended JDK

2 - Install recommended database

3 - Unzip package

4 - Define environment variables

JAVA_HOME C:\java\jdk\1.6.0_18
CATALINA_HOME C:\temp\stepcat-1.x-6.0.14
ANT_HOME C:\temp\stepcat-1.x-6.0.14\apache-ant
STEP_HOME C:\temp\stepcat-1.x-6.0.14

5 - Extend PATH environment variable to include:
%JAVA_HOME%\bin;%ANT_HOME%\bin;%CATALINA_HOME%\bin;

6 - Open new console and test command line tools:

java -version
javac -version
wsimport -version
xjc -version

ant -version
catalina version

7 - The server comes configured to run in C:\temp\stepcat-1.x-6.0.14.
To change configuration to a different location
execute 'ant -f bin\relocate.xml' in the new location.

8 - Start server

catalina start
browse http://localhost:8080

--

This is a replicable server version.

To change the server ports, replace all occurrences of the following numbers:
8080 - HTTP Port
8005 - Admin Port
8443 - HTTPS Port

The most important changes to make are in the conf folder.

These changes can be automated using Ant.
Refer to 'bin\replicate-server.xml' for more information.


--

Package preparation steps:

Unzipped apache-tomcat-6.0.14.zip to stepcat-1.x-6.0.14

Unzipped apache-ant-1.7.1.zip to stepcat-1.x-6.0.14/apache-ant

Copied tail.exe (win32 binary) to stepcat-1.x-6.0.14/bin

Copied servlet-api.jar and jsp-api.jar to STEP lib

Copied all stepframework/lib jar files to stepcat-1.x-6.0.14/lib

stepframework/src/lib/stepframework.jar is NOT included.
(Applications will have to include this JAR themselves.
The rationale is to give developers more visibility of the framework's source code
and to allow easier modification and experimentation.)

Copied junit-4.5 to stepcat-1.x-6.0.14/apache-ant/lib/junit.jar and
to stepcat-1.x-6.0.14/lib/junit.jar

Deleted all stepcat-1.x-6.0.14/webapps except ROOT and manager.

Renamed stepcat-1.x-6.0.14/webapps/ROOT/index.html to
stepcat-1.x-6.0.14/webapps/ROOT/index-tomcat.html
Added new index.html to stepcat-1.x-6.0.14/webapps/ROOT
(added STEP logo, quick link to manager)

Added new user with the role manager to
stepcat-1.x-6.0.14/conf/tomcat-users.xml:



Documentations were moved to stepcat-1.x-6.0.14_docs
Added index.html to stepcat-1.x-6.0.14_docs.

created Eclipse User Library named 'STEP dependencies' including all
STEP framework dependency libraries, but not STEP itself.

Saved user library export file in 'eclipse/stepdeps.userlibraries'.

--

Acknowledgements:

Apache Software Foundation and
all other authors of used open-source software packages.

--

"

3. Next I installed/started MySQL 5.1

I created the databases 'flight' and 'mediator' and the user 'step' without password.
I then granted all rights for these databases to the user.


4. Next I compiled and deployed the Trip Planner demo application

I did everything except the test.

Here is stepframework\src readme:
"

STEP Framework Demo: Trip Planner

Table of contents
==============================

1. Introduction
2. Structure
3. Compiling
4. Installing
5. Deploying
6. Running
7. Testing
8. Extensions


1. Introduction
==============================

The Trip Planner is a system for selling trip packages via a web interface.
It is composed by several distributed systems, which act together through a
mediator that interacts with the clients.

This demonstration version of the Trip Planner supports booking a flight
and uses 3 demonstration Framework Extensions:
- hello - just says hi when it intercepts the services or web services
- trace - prints tracing data
- errors - allows creating test errors

Extensions enable the programmer to add code around the services layer
and around the Web Services layer, orthogonally to the application code.
Each extension can be enabled or disabled simply by editing the
extensions.properties configuration file.



2. Structure
==============================

The Trip Planner system is composed by 2 separate domains: flight and
mediator. The flight domain manages flight reservations. The mediator domain
mediates the interaction between client and the other reservation domains
(only the flight in this demonstration).

Conceptually, each application consists of 4 layers:

+--------------+
| Presentation |
+--------------+
| Services |
+--------------+
| Domain model |
+--------------+
| Data access |
+--------------+

These layers are developed in sub-sub-projects of the flight and the mediator
sub-projects. The entire project' structure is as follows:

.
|-- flight
| |-- core
| `-- view
`-- mediator
|-- core
|-- view
`-- web

Both 'core' sub-sub-projects implement all the layers from the bottom up to
the services layer. The 'view' sub-sub-projects implement the classes that
can be returned from the services to the presentation layer; this also
includes any exceptions that can be thrown. The 'web' sub-sub-project
implements the presentation layer of the mediator. There are no presentation
layers implemented for the flight domain.


3. Compiling
==============================

The project uses Apache Ant and the ImportAnt library. At each level there is
a build file that takes care of building the project at that specific level.
Thus, the entire project can be built simply by invoking at the top level:

$ ant

Note that Ant and JWSDP should be properly installed for this command to work.


4. Installing
==============================

Two databases must be configured before running the distributed applications.
By default these are:

- For flight:

database.host=localhost
database.name=flight
database.username=step
database.password=

- For mediator:

database.host=localhost
database.name=mediator
database.username=step
database.password=

Therefore, either:

- create the default databases on the localhost's mysql server with the
configured username and password access, or;

- change in the hibernate.cfg.xml and dbunit.properties files the database information
(flight-ws/src/hibernate.cfg.xml, flight-ws/tests/dbunit.properties, and
mediator-web/src/hibernate.cfg.xml, mediator-web/src/dbunit.properties).

Note: after making changes to the configuration propertied you should rebuild
you applications to ensure that the new values have been correctly propagated
to the packed jars. ("ant clean build" at the top level ensures that)

After the database locations are configured, we need to create the databases.

To create the tables execute at the top level:

$ ant hibernatetool

When executing creating the tables for the first time, some errors like the
following may appear:

"[hibernatetool] Error #1: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table mediator.Client' doesn't exist"

They should all be ignored.

Then check that the tables have been correctly created in each database.


5. Deploying
==============================

It is now possible to deploy the flight and mediator applications. Each
application can be deployed by its own build.xml file, but for convenience
there is a top level ant target to do that. Execute:

$ ant deploy

If any of these application is already deployed use the corresponding
"redeploy" target instead.


6. Running
==============================

Point your favourite web browser to http://localhost:8080/mediator-web to start
using the application. Try booking a flight from Lisbon to New York!



7. Testing
==============================

Running tests in a distributed system requires all the tables to be stored
in the same database.
This is necessary because of the way that DBUnit populates data before each
test method.

The data populated for the tests can then be used for user testing the application.

To run tests for the distributed application, edit flight-ws/tests/dbunit.properties and
mediator-web/tests/dbunit.properties and set the same database in both.

Then, at the top level rebuild the applications and create the tables.

$ ant clean build hibernatetool

Then, redeploy the flight web service and mediator web application

$ ant redeploy


To run tests for one domain at a time:

$ ant run-tests-flight
$ ant run-tests-mediator

To run all tests:

$ ant run-tests


8. Extensions
==============================

To see output from the extension engine and from the extensions themselves,
look at the application server's log file.

Feel free to experiment with the extensions configuration files and source code.

The flight extensions configuration is located in flight-ws/src.
The mediator extensions configuration is located in mediator-web/src.

The logging produced by the extensions engine can be adjusted in the
log4j.properties files, for each component and application.

"

5. I used flight-perf's DomainDataGenerator to populate the database


6. Then I tested the application.

http://localhost:8080/mediator-web/

Before:

After:

--

It had been a long time since I had seen these screens.
There a lot of loose ends in the code and documentation, but they are mostly small things.
Most of all, I think you can still learn a lot from the source code.

Who knows what the future holds for the STEP Framework? :)

2012-03-21

English Dictionary and Thesaurus

TheSage English Dictionary and Thesaurus is a free software application that, through a multi-tool interface, integrates a complete dictionary and a multifaceted thesaurus of the English language together into a unique language reference system.

It works off-line and you can install it in 'portable' mode, so it's a very handy tool, so that you don't have to rely on the web all the time.

Download: TheSage's English Dictionary and Thesaurus

2012-03-17

Life Browser

A Microsoft Builds prototype software called Lifebrowser uses artificial intelligence to help you revisit important events, photos, and e-mails from your own life.

Source: Technology Review

2012-03-09

Data compression and archiving

An archive file is a file containing several files and directories.

bzip2 -d filename
decompress archive file

tar -xvf filename
extract

tar -cvf filename dir ...
create

tar -zcvf filename dir ...
create a zipped tar file

2012-03-08

Disk Usage (du)

du -h
human readable option - displaying output in kilobytes (K), megabytes (M) and gigabytes (G) rather than just in the default kilobytes

du -sh
summary option - report only the total disk space occupied by a directory tree and to suppress individual reports for its subdirectories

The China Price

Once the contract is signed, the manufacturers look for ways to reduce costs and turn a profit. Typically, this results in short-cutting processes, reducing size or volume of the product and using cheaper ingredients or materials.

Over time, Western buyers expect the learning curve to improve production quality. But this is not the way a typical Chinese manufacturer would think. Instead of continuous process improvement and learning curve efficiencies, emphasis is placed on cutting costs.

The China Price - Article from Supply Chain Management Review

2012-03-07

Arduino

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.


I am following a work that will use Arduino for building a small robot. I look forward to sharing some of the experiences here on the blog.

2012-03-05

REST in Java

Most of my work with Web Services has been with SOAP-based Web Services. However, there is an alternative, called REST.

There is Java library for RESTful Web Services, called JAX-RS.

JAX-RS RESTful principles are:
- assign everything an ID
- link things together
- use common set of methods
- allow multiple representations
- stateless communications

Classes and methods are annotated to generate REST service.
Here is an example:

@Path("/atm")
public class AtmService {

    @GET @PATH("/balance")
    @Produces("text/plain")
    public String balance(@QueryParam("card") String card,
                          @QueryParam("pin") String pin) {

        ...
    }

...

There also annotations for using HTTP POST (@POST) and specifying the data type that is consumes (@Consumes).

This example was taken from a Java ONE presentation.

2012-03-02

Groovy properties

Groovy generates getters and setters for the public fields of a class.
These default methods can be overridden as usual.
If a field is final, then Groovy generates only the getter method.

Groovy provides a special operator, called the field operator .@, that bypasses the generated accessor methods.

2012-03-01

Groovy DSL

One of the selling points for Groovy is writing Domain Specific Languages (DSL).
I have to admit that I am not fully convinced. There are many limitations to the syntax.
The basic idea is that Nouns in the DSL are implemented as Objects and Verbs in the DSL as Functions.

Someday I would like to read the following books on DSLs:
Martin Fowler, 2010
Debasish Ghosh, 2010