Postings from 2007/02
Attack of the killer books.
This sounds like something straight out of the Hitchhikers’s Guide to the Galaxy ...
An author wants to sell his book in the local council tourist information centre. . . and they won’t let him unless he purchases something like £2 million in liability insurance at £150 (yearly, I presume).
I wonder if they’re going to sell it behind the sign that says “beware of the jaguar?”
He stole my joke.
I guess I’m not running for office. If you can’t joke about bestiality via SMS, what’s the point of politics?
A forgotten *nix gem
Alright. Forgotten by me. Sometimes the extreme coolness that is ‘nix slides right by.
Xnest allows you to “nest” X sessions and can act as both a client and server. I wanted to get remote X connections working to my OpenBSD firewall/router from my Debian workstation. GDM, XDMCP and Xnest to the rescue.
Steps
- Install GDM on the OpenBSD box.
pkg_add -i gdm
- Enable XDMCP in /etc/X11/gdm/gdm.conf. Make sure you lock down port 177! Unencrypted remote X sessions are not safe, and you don’t want the unwashed masses poking around your X server.
#stuff up here [xdmcp] #stuff. . . Enable=true
- Start gdm on the OpenBSD box, and add it to /etc/rc.local.
So we’ve got GDM running on the OpenBSD box, accepting XDMCP connections. Now we need to get the remote host ready.
- Install Xnest on the remote machine.
aptitude install xnest
- Connect!
Xnest :10 -query 10.0.0.1where ”:10” is some unused display on the host running XDMCP and “10.0.0.1” is its IP address.
You should have a GDM login screen. Huzzah! You can specify a specific height/width via the Xnest’s -geometry option, among about a billion other options. Xnest and XDMCP are both ridiculously flexible. I barely notice lagtime over wired or wireless connections. Very nice.
More Info
Creating image buttons with Ruby and RMagick
Below is a simple script that saved me some time – for various reasons I had to replace horrid image buttons used on a web site with more compliant-looking image buttons. You could get buttons that look exactly like this via CSS, but in this case swapping out the images was the easiest fix.
In comes RMagick , the ruby interface to the venerable ImageMagick graphics library.
First you create the canvas, then you create the Magick::Draw object that you draw onto the canvas. On linux/unix machines you can directly display the image, too via canvas.display.
The script:
#!/usr/bin/env ruby
require 'RMagick'
[
['add to basket','buy.gif',100],
['change','change.gif',60],
['checkout','checkout.gif',75],
['continue','continue.gif',75],
['continue shopping','continue_shopping.gif',130],
['go','go.gif',30],
['next','next.gif',45],
['place order','place_order.gif',90],
['previous','previous.gif',70],
['product list','product_list.gif',90],
['update','recalculate.gif',60],
['submit','submit.gif',60],
['update','update.gif',60],
['please wait','wait.gif',90]
].each{|button|
canvas=Magick::Image.new(button[2],25){
self.background_color='#BED8F1'
}
d=Magick::Draw.new
d.stroke('transparent')
d.fill('black')
d.font='/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/Verdana_Bold.ttf'
d.pointsize=11
d.font_weight=Magick::BoldWeight
d.text(0,0,button[0])
d.text_antialias(false)
d.font_style=Magick::NormalStyle
d.gravity=Magick::CenterGravity
d.draw(canvas)
canvas=canvas.raise(3,3)
# canvas.display
canvas.write(button[1])
}
The result:

Saved me some time, and I learned a bit out Rmagick in the process.
Get the script here
Why does RMS hate America?
If you use free software, the terrorists have won.
I don’t have a problem with Cuba adopting free software country-wide. Free software means free, for everyone that agrees to play along.
I just wonder about my technological bedfellows when they turn out to be Cuba, Venezuela and China.
Being in questionable company isn’t going to make me go proprietary, though.
