Archive for the ‘technical’ Category

Teamwork, MySQL and UTF-8

Teamwork is MySQL partner.

Teamwork is MySQL partner.

This is a technical post about Teamwork and its databases.

Many Teamwork customers use MySQL as database for their data; Teamwork as web application supports UTF-8, which means that you can insert data in practically any language; but of course to save such data you need support along the “entire trip”, so your database must support UTF-8 data too. Now unfortunately MySQL default encoding is not UTF-8, but we found a way to work around that, which will be released with version 4.2: the Hibernate schema script generator will create UTF-8 encoding tables, as UTF-8 is supported also at table level (supported by MySQL 5),  so it will work in all cases.

This is done by simply extending the Hibernate MySQL5InnoDBDialect with

@Override
public String getTableTypeString() {
return ” ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci”;
}

as suggested here.

Remember to use MySQL 5 with referential integrity on and to end you JDBC url with “?useUnicode=true&characterEncoding=UTF-8″!

This is particularly important for our future Chinese customers, now that a Chinese translation is forthcoming.

Smarter search and recent object functionality

Here we examine a technique to improve usability in complex applications by introducing smarter search and “recent objects” functionalities. As usability becomes more and more a crucial feature of applications, helping users with full-text search and recent object lists may still prove insufficient. You may need to go beyond these features, by having a way to keep track of “most used” objects, which will help to:

- guess what you are looking for

- find what you are searching for

The problem

Lets see an example.

In these weeks you are working on items A, B and C of your favorite web application. Friday, you actually briefly worked on X, Y and Z before going home, as you had these for quite a while in the bottom of your to-do list. Now, you get back to work on Monday, and what you have in your “recent objects” list? Well, X, Y,Z. Useless. But you have full-text search. You search for the name of A, which actually hundreds of other objects share, and which maybe there are far more occurrences than in A, even if nobody has been using them for quite a while, so they fill results on top of your A. Useless. There is no easy way to get back to A: something here is not working.

This is a usability problem; in order to make your application more helpful, you should somehow keep track of what is being used most often by the users. How to do that? A complete answer is not trivial: as often happens in usability problems, what looks simple from the point of view of the user, is actually complex to solve and render. In the end, all complexity should be hidden, but the solution is not trivial.

Area of focused interest
Area of focused interest in time.

What is relevant to you is not just stuff that you occasionally visited, but say projects or documents to which you recently returned to again and again: you need to keep in focus a window of attention. See it in this way: you want the projects or documents to which you are frequently linking to. You need a sort of personal page rank.

Recording hits

Well, the way to go is record what are doing; you have to record it somehow as a parallel, probably de-normalized table of “hits”, keeping it very simple, as you will probably get quickly really a lot of records there.

A sample hit collector class in Java/Hibernate
A sample hit collector class in Java/Hibernate

In the picture you see an example “hit”, when a user looks and/or works on something. Notice that as you will collect a lot of data, you will need to filter out in function also of your security model: that is why we have the “areaId” field there.

Now however you decide to collect hits, you will have to meet the problem of how to weigh them, that is, have a hit rank function defined on users, objects and time.

In our implementation, we created a function that for every Teamwork user and every entity (be it task, issue, diary entry, document, worklog action) computes the user hit rank for the entity; if the entity is relevant for the user, the hit rank will be high. Rank gets high by “hitting” i.e. visiting an entity.

As we said before, interest is assumed to fade in time, otherwise you’d end to have too many entities with high rank: so you have to define a sort of window of attention, with a degradation of relevance.

gaussian GaussianParameters

You need a way to compute degradation of relevance; we defined degradation with the rigth side of a Gaussian curve with the constants in the code.

Hit rank can be refined to group rank notion, if your application has a notion of workgroup, so that you could define the activity of the group. Another benefit of hit rank is that you can efficiently monitor your application usage, or “activity”, and could lead to introducing badges et cetera.

Example implementation

An example implementation is in Teamwork: as it includes project management, business processes and groupware, there are many objects around. Hit rank has proven useful in a number of ways to improve usability, without impoverishing the model.

“You mostly visited” is a portlet which you may have on your dashboards, and you also see search results ranked:

Your highest ranked entities.

Your highest ranked entities.

Configuration of rank portlet.

Configuration of rank portlet.

Search results ranked.

Search results ranked.

In this way you should always have “at hand” what you’re really working on: you should be able to access your most relevant objects with one click.

References

Google’ page rank paper: The Anatomy of a Large-Scale Hypertextual Web Search Engine

A discussion on badges: http://stackoverflow.com/questions/135647/how-do-badges-work-in-stackoverflow

An introduction to full text search: http://www.javaworld.com/javaworld/jw-09-2006/jw-0925-lucene.html

Hibernate full-text search: http://www.hibernate.org/410.html

Our contribution to Hibernate full-text search: http://www.hibernate.org/432.html

See hit rank in action in the demo or by installing the web app.

Upgrading from Teamwork 3 to 4: why and how

If you are a user of Teamwork 3, you may now consider upgrading from 3 to 4.

Why?

Well, simply version 4 is Nicer – Faster – Friendlier – Wider..

This does remind of the Daft hands video :-) . To get more in detail, probably the best way is to have a look at the user guide.

P.S.: Faster? Yes, it is graphically richer, but still it is faster: given the extended Ajax usage, many pages no longer need “global reloading”; and there is also caching for all the graphical pages parts.

How?

First, you must buy the upgrade license here. The cost is 35 Euro per user (the buy page will show you also the price in dollars).

The installer of version 4 contains an upgrade procedure from version 3 to 4. Upgrading means evolving the database schema, updating and inserting some data, and updating the web application. This is a complex process, which we tested extensively on different database, but it is not entirely fail-safe; there may be permissions lacking, differences of encoding, particular settings of your installation etc. .
So before any upgrade attempt we STRONGLY advise doing a complete backup: these are the required operations to preserve all your data and your configurations settings:

B1. Backup your database
B2. Backup the entire web application: e.g. TEAMWORK_HOME/webapps/ROOT
B3. Backup your repository, where files get uploaded: if you have not customized this folder you can find it in TEAMWORK_HOME/teamworkRepository.

Consider that if you have Teamwork running in a non graphical environment, you cannot directly use the installer for upgrading, and this may be a problem, as several files must get updated.

So the recommended procedure for upgrading is the following:

1.    Backup as above B1, B2, B3
2.    Create a copy of your database, accessible from a graphical environment
3.    Install version 4 on such database with the graphical installer
4.    If everything is fine, use the obtained web app as the new Teamwork

This way there should be no danger of “ruining” your current version 3 installation.

You can delegate us to do the upgrade procedure for you, if you are willing to give a temporary remote access to your web application. Before giving us access, you must have done backups B1, B2, B3, as our upgrade comes with no guarantees of data preservation in case of failure, and it is to you restoring the database and the web app in the previous state.  Buy the “remote setup” here:

http://www.twproject.com/licensing.page

In case the upgrade procedure fails, you will get a full refund of the remote setup.