log4p

Peter Maas’s Weblog

Archive for February, 2007

Database to omni/graphviz

I was looking for a tool to reverse engineer a datamodel from a database in omnigraffle. I found one or two scripts to do this… but the installation wasn’t even worth the results.

I decided to give it a go myself. Using some calls to the DatabaseMetaData object from JDBC I managed to generate the following omnigraffle diagram (I reverse engineerd the file format, easy… XML) of some of the tables and references between them from my current project (the RDBMS is postgresql):

omnigraffle output
And the full database (press the ‘x’ key to close the overlay):
full database
which Omni couldn’t layout correctly anymore…

Final layouting was done by the omnigraffle automated layout command, the rest was all generated by my application, for which the code can be found at http://svn.maas-frensch.com/pmutils/JDBCMetadataToOmni/

The application is still very rough, but since it works I’ll probably try and extend it with a more comprehensive CLI or maybe even a GUI…!

I’ve updated the application to write graphviz diagrams as well:

Graphviz output

Omnigraffle is capable of rendering graphviz files, but the native renderer seems to be a bit better at writing these sorts of huge diagrams.

8 comments

Grafflebaffle

Ever since I received my Macbook Pro I’ve been thinking about which software to run for drawing diagrams (which is something I have to do quite often). I’m not talking elaborate UML diagrams, ‘conceptual’ drawings… the stuff you would typically use a whiteboard for. One of the few applications I used to use Windows (in vmware, on Linux) for was MS Visio,  a fantastic application!

Since doing the above in a legal way involves buying expensive Windows / Visio® licenses I decided to have a look at the OSX counterpart: OmniGraffle as ‘recommended’ by some other OSX developers.

After trying the demo I was sold. The use of the quartz graphics engine makes the application actually fun to work with (mind you, I’ve drawn tons of diagrams in Java based UML tools like MagicDraw and Poseidon) and to huge amount of free stencils on top of the build-in ones are just great!

Next to the above OmniGraffle Professional has some other greate features like Visio® 2002 XML import/export and a presentation mode (fullscreen with element highlighting, nice touch!)

Today I switched from demo to a professional license… and just have a look at the diagrams (from my current project) I redrew for testing the full application:

Network architecture UML test

note: I’m not in any way (I’ve checked linked in, nearest is a 3rd connection) affiliated to the omnigroup

5 comments

Passed the JBB Java tools exam

I managed to pass the Java SE Tools exam at Javablackbelt. As you can see on my score I had a bit of trouble with some of the questions:

    #Questions #Points  
  TOTAL: 15
12/
15

= 80%

    (80% required)
Correct (+1) 12 12  
Wrong (-0) 3 -0  
Unanswered (0) 0 0  

 

Part of the troubles I had are caused by the fact that I hardly EVER use Java commandline tools like java/javac/javadoc/jar (well occasionally I use the jar command to list the contents of jars, or search them…) Most (if not all) of this sort stuff is done for me by my IDE/ANT/Maven2.

Also, this is one of the exams which didn’t learn me anything useful which I didn’t know before….

BUT…

I’ve reached the magical 80 points barrier, which is equal to the black belt level! No, just waiting for the exam to actually earn it!

No comments

Passed the JBB Java regex exam

Passed the Java regex exam!

    #Questions #Points  
  TOTAL: 10 10/ 10 = 100%
    (80% required)
Correct (+1) 10 10  
Wrong (-0) 0 -0  
Unanswered (0) 0 0  
 

powered by performancing firefox

2 comments

Yahoo pipes… programming made ‘easy’?

pipes Occasionally when some non-programmer sees program builders like code generating UML tools or, in this case Yahoo's new pipes service, they start making jokes about how developers are going to unnecessary in the future.

Normally I would just forget about such nonsense, but since this one involved the incredibly hyped Yahoo service I decided to have look at it.

Pipes is a free online service that lets you remix popular feed types and create data mashups using a visual editor. You can use Pipes to run your own web projects, or publish and share your own web services without ever having to write a line of code. The DHMTL/Ajax application looks rather nice. It's one of the first DHTML interfaces I used which really manages to feel like a real application.

After playing around with it for a short while I discovered that it is really difficult to create something useful. You have to be a programmer to actually understand how to make it work. Even worse: if you are a programmer you'd probably not use this tool since coding is MUCH easier.

Consider the 'ebay pricewatch' pipe at http://pipes.yahoo.com/pipes/avkEShi32xG_EF6KZVUMqA/edit?opendesc=true

(or click at the images in this post to get an idea)
Bottom part

So much lines and complex configuration! It took me about 10 minutes to write this small Ruby example which does something very similar:

  1. require 'rubygems'
  2. require 'open-uri'
  3. require 'simple-rss'
  4.  
  5. class EbayWatcher
  6.   def search (search, lower, upper)
  7.     url = "http://rss.api.ebay.com/ws/rssapi?FeedName=SearchResults&siteId=0&language=en-US&output=RSS20&from=R8&satitle=#{search}&submitsearch=Search"
  8.     rss = SimpleRSS.parse open(url)
  9.    
  10.     found_items = rss.items.collect{|item|
  11.       prices = item.description.scan(/<strong>.*\$(\d+).*<\/strong>/) # find the price for the item
  12.       price = prices[0][0].to_i
  13.       if price>= lower && price <= upper
  14.         item
  15.       end
  16.     }
  17.    
  18.     rss.items.clear
  19.     found_items.compact.each{|item|
  20.       rss.items <<item
  21.     }
  22.    
  23.     puts rss.source
  24.   end
  25. end
  26.  
  27. EbayWatcher.new.search('wacom,intuos', 200, 350)

To me this sort of application actually strengthens my believe in the fact that coders aren't going to be outsmarted by the masses in the future.

4 comments

Maven2 plugin for Eclipse

Over a year ago I tried working with the maven2 plugin for eclipse. After trying some of the nifty features, like a search dialog for dependencies, I was totally fed up by the amount of resources needed by the plugin; every tiny move you made seemed to trigger full maven build cycles (including update checking in online repositories)... which made it impossible to work with.

I decided to stay as far away from the plugin as possible... until I recently noticed Howard Lewis Ship (author of the excellent Tapestry framework and Hivemind) using the plugin while demonstrating tapestry 5. If Howard is using the plugin (he is running it on OsX by the way), it might have improved I figured.

wrong.

After configuring the plugin on all modules of my current project misery began; the plugin is an enormous resource hog! Each time something happens which triggers rebuilding the workspace (i.e. run project > clean) the entire build cycle is executed... taking about 2 minutes to complete.

Sure, it is possible to run the plugin in offline modus... which makes it a bit faster. But this totally defeats the purpose.

I'll probably be sticking to executing maven commands using my CLI for the next comming year!

No comments

Performancing

I came across the 'performancing' plugin for Firefox, which extends  Firefox with functionality to publish items  to my blog from a nice XUL interface.

For now I'm just testing to see if it is useful or not...

More about performancing can be found here

No comments

Compass: guiding your applications through data

Recently we had to look for a solution to the ever growing problem of searching huge amounts of data.

Requirements
Initially the dataset will contain about 1.000.000 records entangled in complex ways using a lot of ternary relations.

To solve the problem of searching I had used Lucene before, but was never really satisfied with the robustness of a 'raw' Lucene installation. When used in complex situations (think heavy load and clustered environments) it is immensely complex to get configured correctly. There is also the matter of keeping the indexes synchronized to the data they are based upon.

Read more

1 comment