Archive for August, 2005

Jon Udell: The riddle of asynchrony

Wednesday, August 31st, 2005

Jon Udell points out a couple of audio recordings on the topic of asynchrony and its difficulties.

wordpress: Printable versions from kubrick

Tuesday, August 30th, 2005

If you’re using the default theme, the simplest way to the hide comment form and sidebar when people print from your wordpress blog, add the following to wp-content/themes/default/header.php

<style type="text/css" media="print"> 
#commentform {display: none} 
#sidebar {display: none} 
</style> 

If you’ve a 3 column view, it’s even more important that you suppress the left-column as it’ll probably come out on paper first above the actual post content.

Obviously you can take this a lot further. There’s a fair bit of discussion about how to do this at the wordpress support forum: Creating a print.css file. There are some tips there applicable to other publishing solutions.

If someone else’s site has such crap on it and you need to print, you could use the squarefree webdevel bookmarklets to edit the applied styles on the fly, make a custom bookmarklet to do the same, or find/work up a greasemonkey script. I never had much luck with firefox’s “nuke everything”, which should allow you just to click on stuff to have it removed.

Ruby require gotcha (case-sensitivity) for windows/cygwin

Tuesday, August 30th, 2005

Here’s a windows (or cygwin) ruby gotcha concerning the the “require” method: The case of the filename given to require is important. Mix it up in various calls to require, and you’ll get the same resource being reloaded multiple times.

The “require” method will find resources case-insensitively on windows, but will first look in its cache case-senstively, and will fail. The resource will be loaded twice (actually will be loaded one time for each variant capitalization).

Here’s an example, from my problem context, with FileUtils.

If you’re seeing "warning: already initialized constant OPT_TABLE" or

FileUtils.rb:89: warning: discarding old getwd
FileUtils.rb:108: warning: discarding old chdir
FileUtils.rb:120: warning: method redefined; discarding old uptodate?

it may be because you’ve loaded the FileUtils file twice. But if you’re using require, it should only load each once. What’s happening? In my case, I was requiring FileUtils in various files, but with varying capitalization. I had require ‘fileutils’ as well as require ‘FileUtils’ in various files.

On *nix, the latter wouldn’t be permitted - the require method would have bailed with No such file to load -- FileUtils (LoadError). On windows, it sneaks through.

Both were being resolved to successful find fileutils.rb, but they’re of course not folded down before the cache lookup, which fails to note that the two represent the same resource. Hence a bunch of warnings if you’re running in ruby -w, one warning if not, or much worse, if it’s not FileUtils you’re accidentally reloading.

This is all a long way of saying don’t work on windows.

Note the similar non-windows-specific gotcha which the documentation for Kernel:require warns about: “A feature will not be loaded if it’s name already appears in $”. However, the file name is not converted to an absolute path, so that “require ‘a’;require ’./a’’’ will load a.rb twice.”

Mueve la cintura

Tuesday, August 30th, 2005

Nice clip: Mueve La Cintura from this Salsa Cubana Styling DVD. (It’s in spanish with english subtitles.)

Various good-looking cultural and dance instructional DVDs from Boogalu productions.

codefetch - find matching example code from books

Tuesday, August 30th, 2005

codefetch searches for matching code from book code examples whose tarballs are available on the net. (The Ruby Way, Pickaxe, Making Use of Ruby, in ruby’s case)

In lieu of a cookbook, or the java almanac, i suppose. Via O’Reilly Radar.

mt to wordpress permalink redirects - regexp problem resolved

Tuesday, August 30th, 2005

on 34sp.com, I had a problem with the recommended redirectrule to redirect moveabletype permalinks to be handled by wordpress. (migration guide).

What finally worked:

RewriteRule mt-archives/0*([0-9]+).html /blog/index.php?p=$1

The following and variations did not work:

RewriteRule mt-archives/0*(\d+).html /blog/index.php?p=$1

Pandora: music recommendation based on the music’s elements

Tuesday, August 30th, 2005

Music taste prediction down to a science? | Metafilter

“when you ask it, “Why is this song playing?” It answers, ‘Based on what you’ve told us so far, we’re playing this track because it features electronica influences, mild rhythmic syncopation, surreal lyrics, use of call-and-response vocals, and string section beds.’”

Direct link to Pandora (formerly “Savage Beast”).

“Free for 10 hours. $36 a year.”

AJAX Debugging with Greasemonkey

Monday, August 29th, 2005

XMLHttpRequest tracing and debugging greasemonkey script. As well as showing the details of responses and requests, the gui provides “options to edit and replay the request or replay the response callback”.

see also troubleshooting ajax responses post at slash7.

Mum vs RIAA - court transcript

Sunday, August 28th, 2005

Elektra v. Santangelo May 6th court conference.

via recording industry vs the people

Self-reconfigurable modular robot

Friday, August 26th, 2005

Self-reconfigurable modular robot. docs and videos. via notio.

activemq 3.1 - with Ruby support

Friday, August 26th, 2005

ActiveMQ 3.1 Released: the fastest and most scalable open source JMS provider now has Ruby and Perl support

Google 20% time - Developers and personal projects

Friday, August 26th, 2005

“The Google model of development is more than just information sharing and the ability to switch projects. Here are the important points as I’ve seen…”

via notio.com science & technology, which has some great stuff.

UrbanGiraffe: dissection of a wordpress theme

Friday, August 26th, 2005

Dissection of a wordpress theme. Lots of detail here.

FLPR: FreeBSD + Lighttpd + PostgreSQL + Rails

Thursday, August 25th, 2005

FLPR: FreeBSD + Lighttpd + PostgreSQL + Rails. Configuration notes on, and advocacy for, that environment.

Suppressing activerecord’s warnings

Thursday, August 25th, 2005

Running ruby scripts with ruby -w is a good idea because this will allow warnings, telling you when your code does potentially stupid things.

In my apps, I want to use the ActiveRecord library. ActiveRecord uses ActiveSupport, which, on being loaded, will spraff out a page of warnings.

Try it with the simplest possible app (assumes you have rubygems installed):

>  gem install activesupport activerecord

> ruby -w
require_gem 'activerecord'
require 'rubygems'
ctrl-D

Suppressing warnings is a bad, bad idea. Don’t do it. Those days you’re ripping your hair out because the system is failing silently? - those are because you’ve silenced warnings.

Ok, now, here’s how to do it. Don’t come crying to me. Only during load of active_record.

old_verbose=$VERBOSE
$VERBOSE=false
require 'active_record'
$VERBOSE=old_verbose

I grabbed the “remember previous verbose setting” from breakpoint.rb. Here’s how they do the same thing in another context:

old_verbose, $VERBOSE = $VERBOSE, nil
IRB.setup(ap_path)
$VERBOSE = old_verbose

Rather than prevent their production, another solution might be to stream the warnings elsewhere during only this noisy period. I haven’t done this but it would mean you could, for example, run a scheduled grep to see if any new warnings had cropped up. See HowtoConfigureLogging on the rails howto wiki.

A better solution would be for activesupport and activerecord not to give warnings. It seems that development effect this is underway.

successfully compiling ruby oci8 on cygwin

Thursday, August 25th, 2005

When compiling ruby-oci8 on cygwin, i had only one problem (other than my being of very little brain):

“Permission denied - conftest.exe”

It seemed that conftest.exe was not stopping, so could not be deleted by mkmf.rb’s try_run().

Workaround: The only thing calling tryrun was checklp64 (in etc/oraconf.rb), so I just substituted the call with a hardcoded value. That was the only problem I had.

Version? oci8 version 0.1.12 (and tried getting the oraconf.rb from HEAD, too. hasn’t changed).

It is probable that the error really occurred because of a bad setup. I haven’t much experience with these compile tools and cygwin.

I’ve reported it, anyhow.

I have had no problems with the distributed windows binary of ruby-oci8. Do you really need to be in cygwin?

ocwhat?? Ruby - Oracle Call Interface is an interface to let you talk to Oracle from ruby. So now I can have our testers leverage activerecord’s simplicity while making assertions about the contents of our oracle dbs after each automated test.

Update. The developer, KUBO Takehiro, says the same thing:

“I guess that it needs a bit time to release the execution lock. I have experiences that deleting a file just after closing the file descriptor sometimes fails on Windows.”

and suggests solving the tryrun more generally by adding a wait to tryrun before the rmf “conftest*”: sleep 1 if /mswin32|cygwin|mingw32|bccwin32/ =~ RUBYPLATFORM

Xiluva week

Thursday, August 25th, 2005


Xiluva week

Magazine Cover Maker - Flickr

Thursday, August 25th, 2005

Magazine Cover Maker. “Oh, this is so adorable. Ever had a Flickr image that you thought would look great as a magazine cover? Let the ol’ imagination run wild with Magazine Cover Maker” via researchbuzz

There’s a set of flickr toys at that site, and in general, there’s the great flickr tools collection.

mixed bag

Wednesday, August 24th, 2005

Alex Bosworth’s Weblog: Ajax Mistakes

google talk FAQ

google talk - developer FAQ

client choice

Google Talk Released -o’reilly radar

Beastie Boys A Capellas for download

Wednesday, August 24th, 2005

Official Beastie Boys A Capellas mp3s for download and chop-up.

“These A Capellas are for your own personal use to make your own remixes. We’ll be adding a new one every Friday for the next little while.”

via digg via sma.