Monday, March 29, 2010


After searching for the best (free) UML tool. I've finally found it! It's called UMLet and can be downloaded here.

UMLet can be downloaded as an Eclipse plugin or standalone application. I currently use it as a plugin within Eclipse. There are no limitations in use, in contrary to other so called "community" editions of payed tools.

It features the following:
- snap to grid of elements
- export formats: PNG, GIF, JPEG, SVG, EPS, PDF, and BMP.
- customizable diagrams
- drag-and-drop interface

UMLet supports a variety of UML diagram types: class diagrams, use case diagrams, sequence diagrams, state diagrams, deployment diagrams, activity diagrams, and custom diagrams.

For screenshots, click here.

Wednesday, March 24, 2010

Daily remote sync Oracle refresh group

One way to integrate Oracle systems is to share data between databases. In this example we will create a group of materialized views, which is then daily synced with a remote database.

In this scenario we have a couple of remote tables on an external Oracle database. The tables can be accessed using a database link we create.

create public database link <link_name>  connect to <schema>  using '<tns_service_name>';

The <link_name> variable is the name you want to use for the database link. The <schema> variable is the schema name of the remote database. The <tns_service_name> variable is the TNS-name of the remote database.

We fill in these variables with example data.

create public database link MY_DB_LINK;  connect to REMOTE_SCHEMA  using 'remote_database';

Now we create two materialized views of the two remote tables using the database link we just created.

SELECT col1, col2 FROM table1@remote_database;
SELECT col1, col2 FROM table2@remote_database;

Finally, we create the refresh group using the PL/SQL code below. The materialized views are refreshed every day at 6:00 in the morning.

name => 'mviews',
list => 'm_table1,
next_date => to_date('06:00:00', 'hh24:mi:ss'),
interval => 'sysdate+1'

To check if everything works, the following internal tables of Oracle can be queried to see if everything we created registered successfully by Oracle.

  • dba_mviews
  • dba_refresh
  • dba_refresh_children
  • dba_jobs
Sometimes the job just doesn't want to start. Maybe, the database is configured not allowed to start database jobs. Use the following query to check the number of jobs allowed to run on the database.

select t.value from v$parameter t
where name='job_queue_processes';
The number must be greater than 0. The standard value is 4. You can alter the value using:
alter system set job_queue_processes = 4;

Monday, March 22, 2010

Migrating Oracle database content

There are many times that I have to migrate data from one Oracle database to another.

Depending on the situation, I can choose between two different methods. The first method is to use SQL*Plus to copy data from one remote table to a local table.

copy from <schema>/<password>@<host>INSERT <new_table>Using select * from <old_table>

Instead of INSERT, you can also use: APPEND, CREATE or REPLACE. For more information about the differences, please follow the link at the end of this post.

When multiple tables and/or triggers are involved, I use the second method. The second method uses the exp/imp tools provided by Oracle. First, an export file is created using exp. In this example, I migrate only two tables (table1 and tabl2). You can add more tables if you want.

exp <schema>/<password>@<host>  file=export.dmp log=export.log tables=(table1, table2) rows=yes indexes=no

Finally, we load the export file into the new database. All the new tables and triggers are created automatically. We use imp to do the import.

imp <schema>/<password>@<host> file=export.dmp full=yes

Make sure the exp/imp tools are the same version as the database, or it won't work.

More info can be found here:

Friday, March 19, 2010

Must-have Firefox plugins


This is probably the best plugin for web developers. It allows you to edit, debug, and monitor CSS, HTML, and JavaScript LIVE in any web page. You can hover with your mouse over the page and click any element on the page for inspection. The corresponding HTML-code will be displayed.

Web Developer

This is also a great plugin for web developers. Almost just as useful as Firebug. It adds a toolbar to your browser to access various web development tools. The tools include tools to manage: redirection, cookies, CSS, Forms, Image, and more... Great to be used together with Firebug.

Fasterfox Lite

This addon allows you to easily tweak many network and rendering settings to improve the browsing speed of your browser. When installed, a little timer is displayed on the bottom of the browser to measure page load time, which is very useful to get a sense of the performance of the site.

HTML Validator

This addons adds HTML validation capabilities to your browser. The number of errors will be displayed in the status bar of the browser as an clickable icon. Click to icon to view the source of the page. The errors will be high-lighted.


This addon is great for monitoring or debugging the traffic between the web server and browser. It can show: request and response headers, cookies, querystring GET/POST parameters, and response body.

IE Tab 2

This addon can be used to use the IE rendering engine in a Firefox tab. Useful for testing IE-browser compatibility.


This addon makes it much easier to view the source code of external JavaScript of CSS files linked from the web page. You can access them from the context menu, from the toolbar, from the view menu, or from the status bar.

Vacuum Places Improved

This addon defragments the Firefox URL database, which reduces the lag while typing an URL in the address bar. It also reduces start-up time of the browser.

Adblock Plus

Tired of advertisements in web sites? This addon can help you block commercial banners and even video commercials that preceed the actual video you want to see.

Easy Youtube Video Downloader

This addon adds additional direct download buttons to YouTube, which makes it possible to download the video in: FLV, 3GP, MP3, MP4, 720p HD and 1080 Full-HD formats. Perfect for saving the video locally.

Wednesday, March 17, 2010

Google Maps API

As a joke, I used Google Maps on the company's intranet to show where I was in real-time. This blog post will show you how it's done with the Google Maps API V3. The complete documentation of the API can be found here.

With Google Maps API you can create custom Google Maps applications that can include:

  • Custom overlays
  • Geocoding (translating place names to world coordinates and plot them or other way around)
  • Showing user photos
  • Street view
  • Plotting directions to a coordinate

First, create or use an existing HTML-page to include the following lines of code in the HTML-header:

<meta name="viewport"
user-scalable=no" />
<script type=\"text/javascript\"

This will enable us to use the Google Map API. The first line specifies that the map should be displayed full-screen and that the user is not allowed to be resize the map. The second line loads the API. The sensor parameter is set to false, because we don't have a sensor to track the user's current location.

Second we create the initialization code in JavaScript. This fragment will load and draw the map. You can put the code in the HTML-header or in a separate file. The code is explained as comments.

<script type="text/javascript">

function initialize() {
// Our location.
var latlng = new google.maps.LatLng(51.999018,4.374168);

// Map display options.
var myOptions = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP

// The map object, which has to displayed in the div with
// id="map_canvas".
var map = new google.maps.Map(

// This is the URL to a small picture of me, which is used
// as marker on the map.
var myPicture = 'me.jpg';

// Create the Marker object to be drawn on the map.
// Use the coordinates and picture defined earlier.
var chengMarker = new google.maps.Marker({
position: latlng,
map: map,
icon: myPicture

// Only display the whole map during office hours
// to increase realism.
var d = new Date();
if (d.getHours() < 10 || d.getHours() > 18) {
var m = document.getElementById('map_canvas');
// = 'none';


Finally, we create a <div> with id="map_canvas" that will contain the map. Don't forget to put the initialization function in the onload-attribute, so the browser will initialize and draw the map when the page is fully loaded.

<body onload="initialize()">
<div id="map_canvas" style="width: 600px; height: 250px"></div>

Tuesday, March 16, 2010

Online HTML escape tool

Does anyone know if there's a way to escape HTML-characters automatically when blogging on Blogspot?

I am currently using to escape code before posting on this blog.

Monday, March 15, 2010

Output in MS Excel-format for browser in PL/SQL

This example will show how to output Tab-Separated-Values with Oracle PL/SQL for Microsoft Excel in a browser. This is not exactly JEE, but the main idea can also be applied in Java.

Create a public accessible procedure that outputs Tab-Separated-Values. Make sure the execute rights are granted on user 'PUBLIC' for the procedure, otherwise the procedure is not allowed to be called by public users.

procedure example is
cursor c_cursor is
select col1, col2
from table;

r_row c_cursor%rowtype;
-- Print TSV header.

htp.print('COL1' || CHR(9) ||
'COL2' || CHR(9) ||

open c_cursor;
fetch c_cursor into r_row;
exit when c_cursor%NOTFOUND;

-- Print TSV row.
htp.print(r_row.col1 || CHR(9) ||
r_row.col2 || CHR(9) ||
end loop;
close c_cursor;
end example;

The main point in this procedure is to let the browser know we are dealing with output intended for Microsoft Excel. We use this procedure to set the MIME-type in the HTTP-header of the response:


The browser will then forward the output to MS Excel for processing.

In the procedure we output the values separated by tabs, which are generated with the PL/SQL function CHR(9). The line is then closed with a new-line using CHR(13).

The output is accessible using the URL structure:


Friday, March 12, 2010

Lorem ipsum generators

If you're a web developer and often have to create lay-outs for web sites, the following sites will probably be useful to you.

This site allows you to create dummy text for your web site, so you can have a better impression of how your site will finally look. There is also a FireFox plugin, which can do the same in your browser:

This site creates dummy images. Just link to it directly in your HTML pages. The image size can be dynamically specified in the URL. I used 300x200 as an example.

Sun Certified Enterprice Architect 5 (SCEA 5) Notes

The notes I have made while preparing for the SCEA 5 exam can be found at Compared to the other more technical exams like SCJP, SCWCD, and SCBCD, this exam is really a mile wide, an inch deep. I had more fun preparing for it than other exams. Most of the time the answer of an exam question is not technical incorrect, but only not the best anwer in the specific context compared to other answers.

First blog entry

I started this blog to store little things in software development I think it's important. In a way, it's like an online cheat sheet.

A list of other sites I have: