Thursday, August 28, 2008

Jump-starting a car using jumper cables

Yesterday, I absent-mindedly left my headlights on when I returned to work from lunch and when I went to leave for a doctor appointment at 4:15, the battery was completely dead. A friend and I tried to pop-start it, but had no luck. Then someone who works in the building came over to give a jump start.

After playing with the jumper cables for a little while, we got it started. Which led me to look into the correct way to connect the cables, which is:

Dead battery: jumper cable to positive terminal
Live battery: jumper cable to positive terminal
Live battery: jumper cable to neutral terminal
Dead battery: jumper cable to some ground on or near the engine (shiny metal)

They also recommended shutting off the engine of the car giving the jump-start to protect the alternator.

So there you go. And here you go: http://www.carbuyingtips.com/jumpstart.htm

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.

Monday, June 16, 2008

Configuring dual monitor setup in Ubuntu

So my friend was in dual monitor hell after a new installation of Kununtu (8.04). It would only do clone mode (where both monitors have the same output) or not start at all. We did some research into the xrandr . While in clone mode, we gave the command:

xrandr --output VGA-0 --right-of DVI-0

This complained about the screen not being big enough. A little more research said to edit the xorg.conf and change the Screen block to look like this:


Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
SubSection "Display"
Virtual 3200 1200
EndSubSection
EndSection


The key part is the "Virtual" line. It says that the "virtual" screen is 3200 pixels wide by 1200 pixels high. She is running a DVI and CRT monitor side-by-side, each running 1600x1200.

Restarting the X-server (ctrl-alt-backspace), then startx from the command line resulted in clone mode again. From here, we issued the command

xrandr --output VGA-0 --right-of DVI-0

again, and behold, functional multi-display.

Of course, this means that she has to issue that command every time she logs in.

Additionally, since dual monitor support is such a complex issue, your mileage may vary. I followed the following steps to find my solution.

1. Does the initial configuration after install meet your needs? No
2. From System Settings->Monitor & Display, can you get it to work? No
3. Examine the /etc/X11/xorg.conf file. Can it be tweaked to make it work? No
4. Install the drivers from your video card manufacturer. Does this work? No
5. Mess with xrandr until it works.

Friday, May 16, 2008

Recipe for Barbecued chicken strips with sauteed onions

After thawing some chicken for dinner and taking inventory of the 'fridge to weigh my options for how I would have the chicken, I devised the following recipe:

Ingredients:

Two medium sized chicken breasts, cut into 3/4 inch wide strips
4 flour burrito shells
1/3 cup of your favorite barbecue sauce
One medium sized onion
Two tbsp butter

Preheat grill on high
Marinate the chicken strips in barbecue sauce for 15 minutes while preparing onions;

Cut the onion into strips or wedges (cut from top to bottom). Place cut onions into shallow pan with butter and sautee over medium heat until tender and slightly carmelized. Browning them isn't the worst thing to do and gives more flavor.

Put the chicken on the grill and cook until done. (internal temperature is 165 degrees)

Move the chicken off of the grill and place burrito shells on the grill and lightly toast.

Place grilled chicken in burrito shell, folded like a taco and top with onions. Enjoy.

Wednesday, May 7, 2008

Configuring the gateway under Linux

I recently ran into a situation where I had to change my gateway. First, I wanted to check what my gateway was set to. The normal command 'ifconfig' only showed the following:

eth0 Link encap:Ethernet HWaddr 00:13:72:DF:1B:99
inet addr:192.9.200.37 Bcast:192.9.200.255 Mask:255.255.255.0
inet6 addr: fe80::213:72ff:fedf:1b99/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10323194 errors:0 dropped:0 overruns:0 frame:0
TX packets:5229128 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1479472650 (1.3 GiB) TX bytes:2978700320 (2.7 GiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12477530 errors:0 dropped:0 overruns:0 frame:0
TX packets:12477530 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3343381852 (3.1 GiB) TX bytes:3343381852 (3.1 GiB)


but not the gateway. Some interweb postings suggested using tracert, but I think you should use the right tool for the right job. The route command is that tool.

Running route alone will report the current gateway on the "default" line:

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.9.200.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 192.9.200.38 0.0.0.0 UG 0 0 0 eth0


The 192.9.200.38 is the configured default gateway. To change it, first add the new default gateway with the command

$ route add default gw 192.9.200.40

Next, remove the old gateway

$ route del default gw 192.9.200.38

Verify your results:

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.9.200.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 192.9.200.40 0.0.0.0 UG 0 0 0 eth0



I'll need to do some testing to determine the relationship of the route command to the /etc/network/interfaces file, but these settings seem to take priority.

But in case you need to tweak the named file...


sudo vi /etc/network/interfaces
sudo /etc/init.d/networking restart