Archive for March, 2008

Test Web Sites

Comments off

Filters for Microsoft Desktop Search

Comments off

CSS Editor for Fonts

CSS Type Set (online GUI)

Comments off

Lightweight J2EE Blog

Pebble is a lightweight, open source, Java EE blogging tool. It’s small, fast and feature-rich with unrivalled ease of installation and use. Blog content is stored as XML files on disk and served up dynamically, so there’s no need to install a database. All maintenance and administration can be performed through your web browser, making Pebble ideal for anybody who is constantly on the move or doesn’t have direct access to their host.

Comments off

Gracefull Java application shutdown

Using Runtime.addShutdownHook I came up with the following solution.
Note that the application is kind of neverending process loop. I prevent the environment to stop the application in the middle of a process loop iteration.
There is also a timer involved in the solution (next loop iteration does not start before interval passes) – that’s why I had to use wait/notify. Without that it could be easier.

import java.util.Date;

public class SignalHandler {
    private static boolean stopGraceful;
    public static void main(String[] args) {
        final Thread t = Thread.currentThread();
        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                System.out
                        .println("Shutdown called. Will wait until main ends.");
                stopGraceful = true;
                synchronized (System.out) {
                    System.out.notifyAll();
                }
                try {
                    t.join();
                } catch (InterruptedException e) {
                }
            }
        });
        System.out.println("Hit Ctrl+C (not Ctrl+Break!)");

        long taskInterval = 40000;
        long taskStartTime;
        // start "infinite" loop (ends after ^C)
        while (!stopGraceful) {
            taskStartTime = new Date().getTime();

            System.out.println("New loop: ");
            for (int i = 0; i < 1000000000; i++) {
                if (i % 100000000 == 0) {
                    System.out.print(i);
                }
            }

            // wait or continue immediately?
            long processTime = (new Date().getTime()) - taskStartTime;
            if (taskInterval > (processTime)) {
                System.out.println("Waiting for next iteration (ms): "
                        + (taskInterval - processTime));
                    synchronized (System.out) {
                      if (!Utils.stopGraceful) {
                        try {
                            System.out.wait(taskInterval - processTime);
                        } catch (InterruptedException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                      }
                    }
//                    Thread.sleep(taskInterval - processTime);
            } else {
                System.out.println("Continue with next iteration immediately.");
            }

        }

        System.out.println("Application stopped");
    }
}

Comments off

Organize your travel

TripIt | Organize your travel
TripIt is a personal travel assistant that automatically organizes all your travel plans. TripIt is free and makes it easy to…

Quickly organize your vacation and business travel – no matter where you book
Automatically get itineraries with all your plans, weather, maps, restaurants and more
Easily access your itineraries via paper, email, personal calendar or mobile device
Share your trips and see where you overlap with friends and colleagues

Creates itinerary.

Comments off

Vše o létání

Comments off

Good Clip

Comments off