Wednesday, July 30, 2008

Date tricks in Firebird

Stolen from: http://www.firebirdsql.org/rlsnotesh/rlsnotes210.html

Tricks for Firebird dates.


A Useful Trick with Date Literals
H. Borrie

In days gone by, before the advent of context variables like CURRENT_DATE, CURRENT_TIMESTAMP, et al., we had predefined date literals, such as 'NOW', 'TODAY', 'YESTERDAY' and so on. These predefined date literals survive in Firebird's SQL language set and are still useful.

In InterBase 5.x and lower, the following statement was “legal” and returned a DATE value ( remembering that the DATE type then was what is now TIMESTAMP):

select 'NOW' from rdb$database /* returns system date and time */


In a database of ODS 10 or higher, that statement returns the string 'NOW'. We have had to learn to cast the date literal to get the result we want:

select cast('NOW' as TIMESTAMP) from rdb$database


For a long time—probably since IB 6— there has been an undocumented “short expression syntax” for casting not just the predefined date/time literals but any date literals. Actually, it is defined in the standard. Most of us were just not aware that it was available. It takes the form . Taking the CAST example above, the short syntax would be as follows:

select TIMESTAMP 'NOW'


This short syntax can participate in other expressions. The following example illustrates a date/time arithmetic operation on a predefined literal:

update mytable
set OVERDUE = 'T'
where DATE 'YESTERDAY' - DATE_DUE > 10

Tuesday, July 15, 2008

Firefox 3 and Java 6 (Java 1.6) on Kubuntu 7.04

Was having trouble getting a certain applet to run in Firefox 3 so I started digging into the problem. Through a little Firefox configuration and installation/configuration of the latest Java from Sun, it's all working now. Here are the steps I used.

If all goes for you as it did for me, you can now go to this URL to verify that Java is working: http://www.cyberdyne-systems.co.uk/bz/bzsplash.html

Friday, July 11, 2008

More on remote desktop using x11vnc

On January 8, 2008, I posted about remote desktop. I've since found two nice features of x11vnc that I wanted to share.

The first is scaling. My work desktop is 1680x1024 and 1600x1280. My home desktop is 1280x1024 and 1280x1024 (both lcd native resolutions). I wanted my entire work desktop to fit on my home desktop. The solution was using scaling.

x11vnc -scale 5/8

This scales the desktop by the named fraction. The fraction can be less than one (reduction) or greater than one (zoom). It does seem to slow down the display.

Another nice feature is sharing a single window rather than the entire desktop. My naming a window id to share, x11vnc will only share that window, not the entire desktop. To get the window ID, connect to the remote Linux host and run

xwininfo -display [display] -name [name]

Where [display] is the display on which the window is being shown on. I use localhost:0 as my display, which maps to my left monitor at work.

And where [name] is a substring of the window title. I use 'Eclipse'. This will return a hex window id (and other information). Note this id.

Now, run x11vnc with the -id parameter:

x11vnc -id 0x12345678

Then on your local host, run your vnc viewer.