Thursday, August 28, 2008
Monday, August 4, 2008
Docile!
From Paul Graham's What You'll Wish You'd Known:
Your teachers are always telling you to behave like adults. I wonder if they'd like it if you did. You may be loud and disorganized, but you're very docile compared to adults. If you actually started acting like adults, it would be just as if a bunch of adults had been transposed into your bodies. Imagine the reaction of an FBI agent or taxi driver or reporter to being told they had to ask permission to go the bathroom, and only one person could go at a time. To say nothing of the things you're taught. If a bunch of actual adults suddenly found themselves trapped in high school, the first thing they'd do is form a union and renegotiate all the rules with the administration.I got a few yuks out of the quote, and the article.
Friday, July 18, 2008
Monday, July 14, 2008
MySQL stored procedure to generate "safe noise"
I'm playing around with stored procedures, and thought I'd try my hand at creating a function used in various capacities at work. Here it is.
Aside: I'm really surprised that blogger.com can't handle verbatim text excerpts. There's more to life than chin music, people! God forbid I should post some Python...
USE test;
DROP FUNCTION IF EXISTS safe_noise;
DELIMITER $$
CREATE FUNCTION safe_noise (n INT UNSIGNED)
RETURNS VARCHAR(100) NOT DETERMINISTIC
BEGIN
DECLARE x CHAR(100) DEFAULT
"bcdfghkmnpqrstvwxzBCDFGHKMNPQRSTVWXZ23456789";
DECLARE y CHAR(100) DEFAULT "";
DECLARE i INT;
WHILE n > 0 DO
SET n = n - 1;
SET i = 1 + FLOOR(44 * RAND());
SET y = CONCAT(y, SUBSTR(x, i, 1));
END WHILE;
RETURN y;
END
$$
DELIMITER ;
-- Sample output:
-- mysql> select safe_noise(50);
-- +----------------------------------------------------+
-- | safe_noise(50) |
-- +----------------------------------------------------+
-- | 96Pw5CKDPW4g5pv984DSdp4VfpXvtK3KpDR6KfSp9tHVkFbKXp |
-- +----------------------------------------------------+
-- 1 row in set (0.01 sec)
Aside: I'm really surprised that blogger.com can't handle verbatim text excerpts. There's more to life than chin music, people! God forbid I should post some Python...
Tuesday, July 8, 2008
Compiling DBD::SQLite 1.14 on cygwin
When trying to build DBD::SQLite for Cygwin I ran into test suite errors:
Solution Part 1: USE_LOCAL_SQLITE
Delving into Makefile.PL prompted me to try this command:
Solution Part 2: The patch
Looking at the other bugs on rt.cpan.org I came across http://rt.cpan.org/Public/Bug/Display.html?id=29519, which contained a patch that made the t/70schemachange.t test pass:
Failed Test Stat Wstat Total Fail Failed List of FailedHere's how I fixed or worked around them.
-------------------------------------------------------------------------------
t/06error.t 0 139 2 2 100.00% 2
t/07busy.t 0 139 8 8 100.00% 5-8
t/08create_function.t 0 139 18 26 144.44% 6-18
t/70schemachange.t 9 1 11.11% 8
Failed 4/29 test scripts, 86.21% okay. 19/463 subtests failed, 95.90% okay.
Solution Part 1: USE_LOCAL_SQLITE
Delving into Makefile.PL prompted me to try this command:
make clean; perl Makefile.PL USE_LOCAL_SQLITE=1This didn't take care of all the errors, but it was a start:
Failed Test Stat Wstat Total Fail Failed List of FailedThis doesn't really make sense to me, since I have a local SQLite installed in /usr/lib/, and this command appears to rebuild the SQLite library from the source included in the DBD::SQLite distro.
-------------------------------------------------------------------------------
t/70schemachange.t 9 1 11.11% 8
Failed 1/29 test scripts, 96.55% okay. 1/463 subtests failed, 99.78% okay.
Solution Part 2: The patch
Looking at the other bugs on rt.cpan.org I came across http://rt.cpan.org/Public/Bug/Display.html?id=29519, which contained a patch that made the t/70schemachange.t test pass:
% patch t/70schemachange.t sqlite.patchAnd that is all. I'll follow up here or on use.perl should I learn more.
patching file t/70schemachange.t
% make test
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00basic...............ok
t/01logon...............ok
t/02cr_table............ok
t/03insert..............ok
t/04select..............ok
t/05tran................ok
t/06error...............ok
t/07busy................ok
t/08create_function.....ok
t/09create_aggregate....ok
t/10dsnlist.............ok
t/11unicode.............ok
t/20createdrop..........ok
t/30insertfetch.........ok
t/40bindparam...........ok
t/40blobs...............ok
t/40blobtext............ok
t/40listfields..........ok
t/40nulls...............ok
t/40numrows.............ok
t/40prepcached..........ok
t/50chopblanks..........ok
t/50commit..............ok
t/60metadata............ok
t/70schemachange........ok
t/90cppcomments.........ok
t/99cleanup.............ok
t/ak-dbd................ok
t/dbdadmin..............ok
All tests successful.
Files=29, Tests=465, 25 wallclock secs ( 5.80 cusr + 4.18 csys = 9.98 CPU)
Tuesday, June 17, 2008
Delicious camping!
Here's a link to my del.icio.us links related to camping: http://del.icio.us/jtrammell/camping
Hopefully I won't forget anything too important as I pack...
Hopefully I won't forget anything too important as I pack...
Subscribe to:
Posts (Atom)

