My Own Twitter Client

Posted by Mike Haller on Sunday, May 17. 2009 at 22:01 in Java
Using twitter4j, it's pretty easy to hack together a new Twitter desktop client. What I wanted to do is to have search capabilities and have all the tweets in a local database, so I could have a look and work with the messages people write even when i'm offline (which never happens anyway, but just in case).

So, taking Eclipse RCP, munching it with twitter4j, adding a bit of Apache Derby and other stuff, I ended up with the following prototype in a couple of hours:



It has a virtual table, so it loads tweets on-demand from the local database when you scroll down. It only reloads the latest 20 tweets from Twitter.com in online mode. There is an offline-mode to decrease the amount of network bandwidth and service utilization. Twitter is already pretty slow. The client caches all the profile images for faster loading. It displays the time of the tweet and highlights URLs. I had a feature in it which resolves shortened URLs and displays the real ones on hover, but i disabled it as I've got problems displaying a nice hover. Hover's in Eclipse RCP/SWT/JFace just don't look very nice, compared to all the new Web 2.0 or Mac designs found in modern apps today.

What other features could be put into yet-another-twitter-client? Tag clouds? URL clouds? Charts? Google Maps? Automatic translations like Babelfish?

In-Memory Databases

Posted by Mike Haller on Tuesday, May 5. 2009 at 21:58 in Java
For testing and demo installation purposes, or for in-memory data aggregation operations, it may be suitable to use a "nearly full-blown" database. They're called in-memory databases and there are some implementation for the Java platform which are used since years:

hsqldb
One of the first 100% Java implementations of a SQL relational database management system. Like all the others, it can be run from a persistent file system or run in-memory. It's fast, it has a very low footprint and it can be embedded in any Java application. Hsqldb was my favourite for years to use in unit tests and integration tests. It can also read and write CSV files.

H2Database
The successor of hsqldb is H2. It's better documented, performs even better and has more options. There's even a web console where you can work with the data in the in-memory database like you can do with phpMyAdmin. Great thing. I'm currently using H2 at home and at work.

Derby
Derby, the Java database, now also supports the in-memory protocol. That's great to hear and an additional argument for switching to Derby as the default implementation for databases in embedded versions or for demo installations.

Monitoring code quality

Posted by Mike Haller on Sunday, April 26. 2009 at 13:35 in Java
I've been looking for tools to measure and visualize code quality for some time now. Every once in a while, there's some tool which aggregates results from quality measurements and monitoring tools like PMD, Findbugs, Checkstyle etc. but I haven't yet found something which attracted my interest.

Read on to find out about Codehaus' Sonar.

Codehaus Sonar for code quality showing Hotspots
Codehaus Sonar for code quality

Java Class Popularity

Posted by Mike Haller on Friday, April 17. 2009 at 08:00 in Java
Taken from a heap dump of a JBoss Application Server with some applications deployed, i've look at the number of objects in the heap and compiled a 'popularity list' accordingly:

java.util
1. ArrayList
2. HashMap
3. TreeMap
4. Vector
5. Hashtable
6. LinkedList
7. HashSet
8. WeakHashMap
9. TreeSet

Read on to see the full list. I've marked some classes which I find interesting enough to have a second look on them. Know your library.

Date ranges in Lucene

Posted by Mike Haller on Saturday, April 4. 2009 at 13:23 in Java
Lucene is a very efficient and fast Java search engine. Once indexed, any object can be found by looking for attribute matches. An object in Lucene is called Document and its attributes are called Fields. Lucene uses Query and Filter objects to narrow down the search to what the user wants to find. A Query makes the amount of data to be searched smaller while a Filter is used for more fine-grained control over what a search result shall include. Queries are more memory-hungry than filters, but for the usual use cases, both are very good.

In this post, I'd like to show how you can search for Date and Time ranges, for example modification dates of files. I'd like to find all files on my local file system which were modified in April 2009.

About

My name is Mike Haller and I'm a software developer and architect at Bosch Software Innovations in Germany. I love programming, playing games and reading books. I like good food, making photos and learning and mentoring about the craftsmanship of commercial software development. Stack Overflow profile for mhaller

Quicksearch

Archives