Ubuntu still ships with GHC 6.8, released 12 December 2007. Macports offers 6.10.3, which has been around for about 3 weeks.
I might be reading into this too much, but methinks there's something there.
Wednesday, June 3, 2009
Friday, May 15, 2009
On the prescience of Infinite Jest
It's not a central plot point, but DFW's near-future Infinite Jest (1996) mentions Microsoft Pink, the operating system du jour.
Wednesday, April 22, 2009
Are you sure you want to navigate away from this page?
Scenario: you've been tasked with creating a simple web-based time-sheet application, so employees can log what percentage of their time is devoted to which project. Now, this hardly qualifies as "Bioinformatics," a domain claimed by both your job title and personal aspirations, but it's a small company and they pay your rent.
So you build the little beasty, and your cube-neighbor sits down to fill out a time-sheet. She spends 7 minutes selecting options and punching in percentages, and then realizes she wants to trim one field from 15% to 10%, clicks her mouse 4 pixels too far to the right putting the page, and not the text input, into focus, and hits Backspace -- equivalent to the back button.
There go her 7 tedious minutes of form-filling -- this app isn't sophisticated enough to autosave a draft in real-time, after all.
Enter the onbeforeunload function.
I've borrowed from this guy a bit, but here's the code:
So you build the little beasty, and your cube-neighbor sits down to fill out a time-sheet. She spends 7 minutes selecting options and punching in percentages, and then realizes she wants to trim one field from 15% to 10%, clicks her mouse 4 pixels too far to the right putting the page, and not the text input, into focus, and hits Backspace -- equivalent to the back button.
There go her 7 tedious minutes of form-filling -- this app isn't sophisticated enough to autosave a draft in real-time, after all.
Enter the onbeforeunload function.
I've borrowed from this guy a bit, but here's the code:
var confirm_exit = true;Originally, I'd planned to skip the ugly global variable and simply re-bind the onbeforeunload function, but apparently you can't rebind like that.
window.onbeforeunload = function() {
if( confirm_exit )
return "";
return; };
$(document).ready( function() {
$("#id_theform").submit( function() { confirm_exit = false; } );
} );
Friday, April 10, 2009
A Beginner's Guide to Hating iMovie '08
Thank you, Apple. This is pretty much my first experience editing footage into a "movie," and with iMovie '08, you've made the process slow, painful, and constrained. What's more, I was lucky enough to get my computer weeks before the release of iMovie '09, so any of your stunning omissions fixed in the subsequent version will cost me $100. No thanks.
First off, titles. Adding chapter titles is a pretty common use for iMovie, I would think, but clips cut from one Project and pasted in another are stripped of their title. Thanks.
Oh, but wait: "chapter titles?" What's a chapter? iMovie isn't really meant to create movies for later burning onto a DVD -- who would ever want to distribute a DVD? So very 2003! The only way I've found to separate footage into chapters for iDVD is to put each chapter into its own Project. Annoying.
First off, titles. Adding chapter titles is a pretty common use for iMovie, I would think, but clips cut from one Project and pasted in another are stripped of their title. Thanks.
Oh, but wait: "chapter titles?" What's a chapter? iMovie isn't really meant to create movies for later burning onto a DVD -- who would ever want to distribute a DVD? So very 2003! The only way I've found to separate footage into chapters for iDVD is to put each chapter into its own Project. Annoying.
Thursday, April 9, 2009
The perils of laziness
I've begun cargo culting my way into Haskell, in the hopes that I'll eventually grasp such mathematical mysteries as anamorphisms. In the mean time, I'd like to write some code that actually works.
To this end, I've written a program to digest the C. elegans transcriptome in silico, then check the resulting fragments against data from a mass spectroscopy experiment (Multidimensional Protein Identification Technology --"MudPIT"--if you're curious). I use regular expressions to break up the protein sequences, store the fragments in a big Data.Map, and then test my MudPIT fragments against the Map.
I've greatly simplified my function to be a simple list-to-map conversion -- which would be stupid, since Data.Mat.fromList does this quite well -- but the real function involves plenty of off-topic complexity, so here's the svelt form:
Without that forced evaluation, ghc will simply add more thunks to the stack until the stack is blown ... hours after the run has begun. You can pretty easily imagine this as a series of substitutions, which is exactly what we're talking about:
To this end, I've written a program to digest the C. elegans transcriptome in silico, then check the resulting fragments against data from a mass spectroscopy experiment (Multidimensional Protein Identification Technology --"MudPIT"--if you're curious). I use regular expressions to break up the protein sequences, store the fragments in a big Data.Map, and then test my MudPIT fragments against the Map.
I've greatly simplified my function to be a simple list-to-map conversion -- which would be stupid, since Data.Mat.fromList does this quite well -- but the real function involves plenty of off-topic complexity, so here's the svelt form:
add_frags (i:l) m =The important part is the $!, in bold. Given some function f and parameter x, f $! x is equivalent to x `seq` f x; the seq function, meanwhile, forces the evaluation of the first thunk. So f $! x applies f to x AFTER x HAS BEEN EVALUATED.
let m' = M.insert i () m in
add_frags l$! m'
add_frags [] m = m
Without that forced evaluation, ghc will simply add more thunks to the stack until the stack is blown ... hours after the run has begun. You can pretty easily imagine this as a series of substitutions, which is exactly what we're talking about:
import qualified Data.Map as MAnd off the stack grows, until pop.
m = M.empty
add_frags ["ACDEF","GHI","KLMNO","PQRST",...] m
-> M.insert "ABCDEF" () (add_frags ["GHI","KLMNO","PQRST",...] m)
-> M.insert "ABCDEF" () (M.insert "GHI" () (add_frags ["KLMNO","PQRST",...] m))
Monday, March 30, 2009
RAID 5 on an Leopard Xserve
This seems too trivial to merit a posting, but there are other posts that might lead one to believe that Leopard doesn't support RAID-5 on an Xserve, which it does, provided you've got a RAID card installed. When booting the installation DVD, just look for "RAID utility" under the "Utilities" menu. Just be sure to create the RAID before you pick an installation disk.
Update: Jashugan's right; I've updated appropriately. Though I still like the sound of "Xserver." One last thought: why ever does the RAID 5 volume build process take something like 2 hours / 100G? I understand the time required to rebuild parity after replacing a failed disk on a live array, but the initial build should be faster than that. Unless the OS is doing a bad block scan on the disks or somesuch, but ... why do that for a RAID and not under other circumstances?
Update: Jashugan's right; I've updated appropriately. Though I still like the sound of "Xserver." One last thought: why ever does the RAID 5 volume build process take something like 2 hours / 100G? I understand the time required to rebuild parity after replacing a failed disk on a live array, but the initial build should be faster than that. Unless the OS is doing a bad block scan on the disks or somesuch, but ... why do that for a RAID and not under other circumstances?
Tuesday, March 24, 2009
Regarding encryption ...
Not encryption in general, but one very specific instance of it: Apache SSL on my Ubuntu/8.10 box.
Ubuntu ships with two SSL modules available -- the canonical, OpenSSL-based Apache mod_ssl, and the newer mod_gnults (pronounced "noodles?"). I decided to try mod_gnutls for no good reason, and it seemed to work -- I could serve content via an encrypted connection! Except for the silent redirects. I'd point my browser to /, get redirected to my SSL login page as expected ... and then wind up on the login page over vanilla HTTP.
In situations like this, HttpFox is your friend. As are netcat and OpenSSL itself, which, if you'll pardon the tangent, has it's own netcat-like behavior indispensable for debugging encrypted network services:
I can't even say this is a GNUtls bug, but it's certainly some strange behavior.
Ubuntu ships with two SSL modules available -- the canonical, OpenSSL-based Apache mod_ssl, and the newer mod_gnults (pronounced "noodles?"). I decided to try mod_gnutls for no good reason, and it seemed to work -- I could serve content via an encrypted connection! Except for the silent redirects. I'd point my browser to /, get redirected to my SSL login page as expected ... and then wind up on the login page over vanilla HTTP.
In situations like this, HttpFox is your friend. As are netcat and OpenSSL itself, which, if you'll pardon the tangent, has it's own netcat-like behavior indispensable for debugging encrypted network services:
openssl s_client -connect myserver.com:443Via openssl, here's the offending HTTP transaction:
GET /ri/account/login?next=/ri/ HTTP/1.1I ask, over HTTPS, for the login page, and it redirects me back to the unencrypted version. And I never quite figured it out, either -- I just switched to mod_ssl and the problem went away.
Host: myserver.com
HTTP/1.1 301 Moved Permanently
Date: Tue, 24 Mar 2009 15:26:47 GMT
Server: Apache/2.2.9 (Ubuntu) DAV/2 mod_gnutls/0.5.1 PHP/5.2.6-2ubuntu4 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2
Content-Type: text/html; charset=utf-8
Location: http://myserver.com/ri/account/login/?next=/ri/
Vary: Accept-Encoding
Content-Length: 0
I can't even say this is a GNUtls bug, but it's certainly some strange behavior.
Subscribe to:
Posts (Atom)