Jump to menu and information about this site.

Monday·30·January·2006

MySQL in-depth: Architecture Type Questions

  1. What is the lost update problem and how does MySQL solve it?
  2. What is a deadlock? Does it happen with a SQL approach to the lost update problem?
  3. How can you solve it without logical units of work?
  4. Discuss relation normalization and denormalization
  5. What is a primary key and for InnoDB tables discuss how the physical ordering of data relates to the primary key

Thursday·26·January·2006

Catalyst SVN

How to check out the Catalyst CPAN distro via SVN

svn co http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst

How to import sources

Browse for the directory you want then s!browser!repos/Catalyst! e.g.: svn import CatalystAdvent-Seamstress/ http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/CatalystAdvent-Seamstress maps to http://dev.catalyst.perl.org/browser/trunk/examples/CatalystAdvent-Seamstress

Perl Search Indexing Options

Plucene
A Perl port of Lucene
Lucene as a web service
Brian Cassidy has Perl bindings for it.
Xapian
might be good, but very little support

Wednesday·25·January·2006

When writing Seamstress pages, componentize your tree transforms

Working with our Mason codebase today showed me something that would have been a lot harder in Seamstress. Basically, I was told to add a vonage advertisement in another table cell everywhere that we displayed a vbase_banner.

Up to this point, all pages using the vbase_banner looked something like this:

<& 'comp/related_topics_lander_2', aconf => $aconf, query => $query &>

<& 'comp/vbase_banner', aconf => $aconf, query => $query, align => 'left' &>

% if ($query->{'brand'} eq 'tbar') {
  <& 'comp/tbar_foot', aconf => $aconf, query => $query &>
% } else {
  <& 'comp/quickfoot', aconf => $aconf, query => $query, align => 'center' &>
% }

<& 'comp/footer', aconf => $aconf, query => $query &>


So all I had to do was toss a bit of logic in vbase_banner for the vonage_ad and I was done:

<tr> <td align='<% $align %>'><iframe width=468 height=60 noresize scrolling=no \frameborder=0 marginheight=0 marginwidth=0 src='http://t.trafficmp.com/b.t/<% $\id %>/<% $rn %>/'></iframe> </td> <td> % if ($query->{pagetype} ne &#8216;KEY&#8217;) { <& vonage_ad &> % } </td> </tr>

With Seamstress, one could componentize a page by creating subroutines for processing each part, but one does not have to. This is a downfall in Seamstress in a sense. But nevertheless, with Params::Validate and HTML::Tree, one can still do the trick, but one must be disciplined about placing each tree transformation into a separate subroutine instead of having a subroutine with a series of

The end result of disciplined Seamstress usage is that you can refine subroutines and make wholesale changes across several webpages if they all point to the same place


CatalystAdvent example converted from tt to Seamstress

You can view the source here and download via

svn co http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/CatalystAdvent-Seamstress

Charting Modules

  1. Chart by the Chart Group. seems like a focused set of people :)

My first Seamstress user!

I was elated to have a user of my module HTML::Seamstress. here is the bug he filed against Seamstress - and complete with a patch!

I am glad to have co-developer.

BookDB for Catalyst is done in HTML::Seamstress

I got HTML::Seamstress up and running the bookdb example. Thanks to Andy Grundman, I can commit to the examples directory on the Catalyst svn site so BookDB-Seamstress is available right here.

Converting it from tt to Seamstress led to a few improvements in HTML::Element::Library , namely the addition of iter2(), a more flexible routine for turning arrays of data into HTML list data, such as dl, ol, or ul.

I learned a lot about Class::DBI::AsForm in the process. That is a very slick module that is underdocumented and highly magical. I have pretty much decided to stick with DBIx::Simple for all of my database processing needs.

Tuesday·24·January·2006

Humor about contract coding

[15:40:40] <StinkfooT> who&#8217;s that desperate for $20 coding jobs [15:41:12] <Kaz__> people who do 5-10 a day I guess. [15:41:35] <StinkfooT> you could make more money as a butcher [15:41:39] <StinkfooT> - frank zappa [15:41:49] <bynari-> Yikes, elance.com is BAD [15:41:50] <Kaz__> most coders probably prefer hacking code than flesh. [15:41:55] <metaperl> bynari-: why? [15:41:58] <bynari-> You&#8217;ll be working for $10/hour for idiots [15:42:18] <bynari-> You&#8217;ll get massive projects that are going for like $2-$5k [15:42:25] <q__> pastebin? [15:42:29] <q__> paste? [15:42:30] <bynari-> Ie 3-4 months work [15:42:34] <bynari-> nopaste? [15:42:38] <bynari-> knowpaced [15:42:39] <+knowpaced> I&#8217;m a pastebot! Paste stuff at http://pastebot.nd.edu/perlhelp [15:42:56] <Kaz__> for stuff like that, you want to setup milestones with the client [15:43:16] <Kaz__> like if you agree to $1000 total for a project, have (5) $200 milestones. [15:43:21] <Kaz__> so nobody gets screwed.

Monday·23·January·2006

Don’t forget about the Snap search engine

Snap has a beautiful way of rendering search results. I hope to remember that page more often.

Sunday·22·January·2006

A funny conversation about HTML::Mason

[11:26:35] <zamolxes> Shevek: so I take it you use mason with catalyst? so besides the data stashing, what would be different about using mason in a catalyst environment? (as opposed to standalone) [11:28:43] <@mst> a lot of the stuff that&#8217;d be in autohandlers and dhandlers ends up in controllers instead [11:28:54] <@mst> Mason w/Catalyst can be very clean [11:29:20] <@mst> I think my Mason allergy is largely caused by the fact that without catalyst, it tends to end up as a <a href="http://www.php.net/" class="ext"><acronym title="Programmers Hate PHP ;-)">PHP</acronym></a>-like ball of snot [11:29:57] <zamolxes> indeed [11:46:35] <drPoggs> r [11:47:01] <@mst> r [12:02:53] Cctoide_ tries to figure out&#8230; [12:45:08] <Shevek> So, is catalyst meant to create t/Foo/Bar.t or t/Foo_Bar.t ? [12:46:09] <Shevek> I get the impression that I used an old version which created the former, when what I really want is the latter&#8230; [12:49:20] <quicksilver> mst: Mason, like many tools, gives you enough rope to hang yourself, but it doesn&#8217;t force you to insert your neck&#8230; [12:50:52] <@mst> no, but the sign by the noose saying &#8220;heaven this way&#8221; seems to mislead most people who use it

Saturday·21·January·2006

Putting revision numbers inline in svn

[11:41:58] <metaperl> there&#8217;s no equivalent to $Revision$ in <a href="http://subversion.tigris.org/" class="ext">subversion</a>? [11:42:05] <metaperl> for inlining version numbers? [11:42:29] <@eh> metaperl: how about $Revision$ ? [11:43:12] <CarlFK> how come commit said &#8220;Committed revision 24.&#8221; but merge says &#8220;svn: No such revision 23&#8221; [11:43:42] <metaperl> does that work? [11:43:53] <metaperl> I dont think svn has $REvision$ as a keyword [11:44:33] <@eh> metaperl: why do you say that? [11:45:11] <mankins> i think it does? $Revision$ and also $Id$ works for me. [11:46:12] <metaperl> oh&#8230; [11:46:14] <metaperl> thanks [11:47:52] <offby1> strictly speaking, $REvision$ isn&#8217;t a keyword, but $Revision$ is :-) [11:48:07] <offby1> and in any case, you need to enable the keywords that you want expanded; it doesn&#8217;t happen by default. [11:48:42] <darix> !a metaperl keywords [11:48:42] <ayita> metaperl: http://svnbook.red-bean.com/nightly/en/svn.advanced.props.html#svn.advanced.props.special.keywords [11:48:57] <metaperl> oh I see. [11:48:58] <metaperl> thanks

Friday·20·January·2006

Garth’s test

sort

Sort these: ( [2005,6],[2005,8],[2004,2],[2002,12] ) (note: a good second question might be: what sort algorithm does Perl use and what alternatives are there)

iterator

write a sub that returns a closure, that when invoked, returns the successive elements of a passed-in array.

Artur’s test

The monk climbs the mountain from 6am to 6pm. And the next day while he is descending from 6am to 6pm, a priest climbs. The priest gets to the top at 6pm, which is the same time that the monk gets to the bottom.

Is there a time that they are ever at the same height?

I solved this equationally at shopzilla somehow. I solved it graphically at shopzilla. The next day, I realized, that the picture of someone going down the other side was a red herring: if I had only reflected the downward trip on the upward trip, I would have noticed that they would cross paths!

Sixapart is neck-deep in talent

  • Artur Bergman
  • Tatsuhiko Miyagawa
  • David Davis
  • wrote perlbal, mogilefs, memcached, gearman

My second technical test at IMDB

  1. If a SELECT is running too slowly how would you debug it?
  2. why not index a bunch of individual fields in a database
  3. Class::DBI iterators - how are they implemented? Are they efficient?
  4. how does CDBI differ from other DBIx::*
  5. least favorite Perl feature
  6. what are you going to learn next about Perl?

Thursday·19·January·2006

I cannot mount my 320gb external scsi hd

Here is the report from /var/log/syslog when I mount this drive:

Jan 19 07:50:25 localhost kernel: scsi2 : SCSI emulation for <acronym title="Universal Serial Bus; United States of Bush">USB</acronym> Mass Storage devices Jan 19 07:50:25 localhost kernel: usb-storage: device found at 14 Jan 19 07:50:25 localhost kernel: usb-storage: waiting for device to settle before scanning Jan 19 07:50:25 localhost kernel: hiddev96: <acronym title="Universal Serial Bus; United States of Bush">USB</acronym> HID v1.10 Device [Western Digital External HDD] on usb-0000:00:1d.7-1.2 Jan 19 07:50:26 localhost usb.agent[23682]: usbhid: already loaded Jan 19 07:50:26 localhost usb.agent[23701]: usb-storage: already loaded Jan 19 07:50:30 localhost kernel: Vendor: WD Model: 3200JB External Rev: 0112 Jan 19 07:50:30 localhost kernel: Type: Direct-Access ANSI SCSI revision: 00 Jan 19 07:50:30 localhost kernel: SCSI device sda: 625142448 512-byte hdwr sectors (320073 <acronym title="Megabyte">MB</acronym>) Jan 19 07:50:30 localhost kernel: sda: assuming drive cache: write through Jan 19 07:50:30 localhost kernel: SCSI device sda: 625142448 512-byte hdwr sectors (320073 <acronym title="Megabyte">MB</acronym>) Jan 19 07:50:30 localhost kernel: sda: assuming drive cache: write through Jan 19 07:50:30 localhost kernel: /dev/scsi/host2/bus0/target0/lun0: p1 Jan 19 07:50:30 localhost kernel: Attached scsi disk sda at scsi2, channel 0, id 0, lun 0 Jan 19 07:50:30 localhost kernel: usb-storage: device scan complete Jan 19 07:50:30 localhost scsi.agent[23786]: sd_mod: loaded successfully (for disk) Jan 19 07:50:30 localhost udev[23833]: run_program: exec of program &#8216;/usr/share/usbmount/usbmount&#8217; failed Jan 19 07:50:30 localhost udev[23853]: run_program: exec of program &#8216;/usr/share/usbmount/usbmount&#8217; failed I noted the usbmount issue above, but I think I should still be able to type mount /ernest based on my fstab:

/etc/fstab

Here is my /etc/fstab proc /proc proc defaults 0 0 /dev/hda2 / ext2 defaults,errors=remount-ro 0 1 /dev/hda3 none swap sw 0 0 /dev/sda2 /ernest ext3 rw,noatime 0 0 /dev/hdc /media/cdrom0 udf,iso9660 ro,user,noauto 0 0 /dev/sr0 /media/extdvd udf,iso9660 user,noauto 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0

Saturday·14·January·2006

Setting version number of a file in CVS

<a href="http://www.cvshome.org/" class="ext">cvs</a> commit -r 4.0 [ filename ]

To remove sticky tag:

cvs update -A

Friday·13·January·2006

That uri guttman is a barrel of laughs, let me tell ya

[09:26:18] <+metaperl> somebody tell me what you think you see here: http://metaperl.com/img/whatact.jpg [09:26:31] <@confound> an ink blot test [09:27:02] <+uri> a url! [09:27:11] <+metaperl> lol [09:27:15] <+uri> plain as ascii can be [09:27:16] <+metaperl> very good uri [09:27:20] <+metaperl> you win! [09:27:32] <+metaperl> what a smart-ass [09:27:47] <+uri> i am only a half of a smart-ass

Steps to refactor the Catalyst sample app BookDB

  1. First, remove DefaultEnd and write an end method that will forward to either tt or Seamstress.
  2. Reword the Actions one at a time starting with book/list

If I could interview Sebastian Riedel

  1. Where do you work and what do you do?
  2. What languages did you use widely before Perl
  3. It seems like you jsut came out ofthe Blue with catalyst… how did you manage to absorb so much Conway and Cozens for so long and not publish on CPAN and why did you just explode out of nowhere

Thursday·12·January·2006

Things I’d like to write but will never get the time to:

  1. Text::Template::Toolkit - a complete implementation of the tt mini-language in Text::Template.
  2. <acronym title="Extensible Hypertext Markup Language">XHTML</acronym>::2POD - POD DTD for XHTML, making authoring easier because XHTML indent’s nicely.

The first rule of refactoring

Do not go off and try to change everything. Get everything working in a new directory, and then starting putting in your changes, hopefully in incremental-enough fashion that you can keep a working product.

Wednesday·11·January·2006

The advanced object-oriented techniques used in Catalyst:

[15:22:01] <claco> what&#8217;s the official term for the development model used by catalyst and dbix; ya know the C3/NEXT load_components type stuff? [15:22:31] <omega> scary

Perl competency test (imdb)

I took a small but good competency test when interviewing at imdb.

The cvs module name is imdb-perl-test and it should be available via viewcvs in 3 hours.

Ah here it is

Saturday·07·January·2006

Perl SQL competency test (sdc)

I took a small but good competency test when interviewing at a small but good company here in Los Angeles :). It only had one Perl question and one SQL question and I was lucky to get the SQL question right.

The cvs module name is perl-sql-competency-test and it should be available via viewcvs in 3 hours.

Friday·06·January·2006

A conversation with Sebastian Riedel on query strings and dispatch

[23:23:21] <metaperl> can the Regex attribute match the query string part also? I suppose I could write a simple app to check&#8230; [23:23:48] <@sri> no it doesn&#8217;t [23:24:22] <rconover> mod rewrite people [23:24:26] <metaperl> hmm so only path matching can occur with attributes&#8230; you do query string dispatching within a default sub by calling $c->forward as needed [23:24:36] <metaperl> rconover: what do you mean about mod_rewrite? [23:24:45] <@sri> aye [23:24:58] <metaperl> sri: what motivated that design decision? [23:25:07] <@sri> RES [23:25:09] <@sri> REST [23:25:31] <@sri> i like to think of paths as RESTish endpoints [23:25:44] <@sri> which take arguments in different forms [23:26:45] <metaperl> oh, a lot of websites have old <acronym title="Hot Tits Transport Pr0nocol (Ulrich Schwarz)">HTTP</acronym> calling conventions. that makes it harder to rework them in Catalyst [23:26:58] <@sri> example? [23:28:23] <metaperl> well, http://perlmonks.org/?node=Recently%20Active%20Threads [23:28:54] <metaperl> instead of perlmonks.org/recentlyActiveThreads [23:29:15] <@sri> why is that hard? [23:29:24] <@sri> have a default action to redispatch [23:29:46] <@sri> thats why we added default! [23:29:48] <@sri> :) [23:29:58] <metaperl> yeah, but then you end up with a default action with a huge if-then for all the different query string possibilities [23:30:13] <@sri> why? [23:30:21] <metaperl> I think there should be a FULL_URL option [23:30:29] <@sri> cat and perl are dynamic [23:30:35] <xover> mooorrrnning all [23:30:39] <@sri> just construct a action path and try [23:30:43] <metaperl> xover: good morning [23:31:07] <@sri> metaperl: it would be very easy to ass a RawRegex action type [23:31:16] <@sri> metaperl: but i don&#8217;t see a point yet [23:31:19] <@sri> add [23:31:30] <metaperl> sri: properly default is for unrecognized requests, it is serving double-duty by grokking Query strings [23:31:42] <@sri> no [23:31:48] <@sri> default is for redispatching [23:31:56] <jdv79> i skimmed jifty and it didn&#8217;t seem too appealing. did you look into it yet sri? [23:32:08] <@sri> the foo : Path is for unrecognzed [23:32:38] <@sri> jdv79: indeed, i sent some patches already :) [23:32:40] <rconover> you know having to use bind_param for blobs in sqllite sucks [23:33:12] <metaperl> &#8220;By leaving the Path definition empty, it will match on the namespace root.&#8221; [23:33:44] <metaperl> that is not the same as unrecognized is it? www.url.com/bad/path # wont match an empty Path [23:33:44] <@sri> jdv79: i see jifty as an interesting experiment, i want to see how much convention over freedom perl people are willing to accept [23:34:28] <@sri> metaperl: it is [23:34:43] <metaperl> sri: where is that documented? [23:34:49] <@sri> metaperl: everything behind the root is an argument [23:34:56] <metaperl> oh [23:34:56] <@sri> Intro.pod? [23:35:05] <@sri> for : Path [23:35:45] <@sri> the big difference between : Path and default is that Path can be local for Controllers [23:36:09] <@sri> while default always gets the whole request path in @_ [23:36:27] <@sri> so it&#8217;s made for redispatch [23:36:39] <jdv79> sri, i thought of it in a similar light. i&#8217;m just wondering if what jifty seems to do couldn&#8217;t be another layer onto of catalyst. [23:36:55] <@sri> jdv79: very easily [23:37:13] <@sri> jdv79: obra just didn&#8217;t grok cat, so he wrote his own framework [23:37:25] <metaperl> sri: you know that? [23:37:32] <@sri> what? [23:37:44] <metaperl> you his reason for writing jifty? [23:37:56] <rconover> jifty is getting good press [23:38:13] <@sri> we talked about it&#8230; [23:38:40] <@sri> top to bottom frameworks are very in atm [23:39:15] <@sri> only thing we are missing is some features in DBIC :( [23:39:48] <metaperl> brian d foy was at our local Perl Monger&#8217;s meeting yesterday. He said that <acronym title="Common Gateway Interface; Computer Generated Imagery">CGI</acronym>::Prototype is going to match the features of Catalyst - $clients are demanding it. Randal is saying the same&#8230; although draven&#8217;s journal entry (http://use.perl.org/~draven/journal/27613) shows a Merlyn wanting to ditch CGIP :) [23:40:23] <@sri> i think he will wrap CGIP around cat [23:41:01] <bda> http://video.google.com/videoplay?docid=-1032978311268695392 # Nice. [23:41:17] <@sri> what i really want is schema support in dbic :S [23:41:37] <metaperl> you mean like Alzabo reverse-engineering? [23:41:44] <@sri> naah [23:41:46] <@sri> sane [23:42:07] <@sri> think DBIx::Migration with perl code [23:42:12] <metaperl> Alzabo is a well-done product. Query formulation is irksome but the reverse-engineering and schema design tool are nicely robust

Wednesday·04·January·2006

How to find which package a binary exists in

[02:11:39] <metaperl> what <a href="http://www.debian.org/" class="ext">Debian</a> package has <a href="http://www.gnome.org/" class="ext">gnome</a>-config in it? [02:12:11] <SWAT_work> JJK, why don&#8217;t use IP&#8217;s? :D [02:12:11] <blahdebla1> metaperl: dpkg -S `which gnome-config` [02:12:32] <blahdebla1> metaperl: For me this gives libgnome-dev: [02:12:42] <Gnea> libgnome-dev [02:12:44] <JJK> SWAT_work, DHCP. It could be that an IP is changing. And then it can give some problems [02:12:45] <metaperl> blahdebla1: thanks [02:12:48] <deadline> can somebody tell me how to build this package: <a href="http://www.kernel.org/" class="ext">linux</a>-kernel-di-i386-2.6_1.18.tar.gz ? [02:13:00] <kevix> erigf: if the mobo is old, maybe the backup battery is dead? [02:13:13] <blahdebla1> metaperl: apt-cache search gnome-config is another good one to use when the package isn&#8217;t already installed on your machine

Perl Software Design Blog

About...

This is the weblog of the Perl Software Design Group.

Who We Are

Terrence Brannon
Matthew Sisk
Brock Wilcox
Gary Aston-Jones


Calendar

 2006 →
Months
Jan
 January 
Mo Tu We Th Fr Sa Su
           
         

Search


Advanced Search


Categories

Blogroll

People I know personally




Blogging Software Blogs