From rkleeman at energoncube.net Mon Mar 6 17:24:02 2006 From: rkleeman at energoncube.net (Bob Kleemann) Date: Mon, 6 Mar 2006 17:24:02 -0800 Subject: [San-Diego-pm] Meeting next Monday Message-ID: <20060307012402.GA16129@energoncube.net> Just a reminder fellow Perl Mongers, There is a meeting next Monday, March 13. We'll be meeting at the same time and place we have been, the Panera Bread on Mira Mesa Boulevard at 7PM. Come and bring your questions, comments, concerns, thoughts, or ideas and we'll discuss. From tkil at scrye.com Mon Mar 13 00:54:32 2006 From: tkil at scrye.com (Tony Foiani) Date: Mon, 13 Mar 2006 01:54:32 -0700 Subject: [San-Diego-pm] Meeting today (Monday, March 13th, 2006) Message-ID: [Since our fearless lizard is off on a "womantic jouwney" to celebrate his 1st wedding anniversary, your slightly more fearful lizard is filling in...] Just a reminder that we have a meeting this evening at the usual place and the usual time: Panera Breads (in the Edwards Cenema shopping center, SW corner of Mira Mesa and I-15. don't forget they have free wi-fi!) 7:00p (Although many of us have been showing up at 6:30 to grab a bite to eat before the meeting.) If nobody else has any other topics, I've run across two things that might make for interesting conversation: 1. Sudoku solving in Perl http://kw.pm.org/talks/2006-01-sudoku/ http://www.ecclestoad.co.uk/blog/2005/05/25/sudoku_solver_in_four_lines.html And the spring 2006 edition of "The Perl Review". Which I didn't even know existed, although at least one big name (brian d foy) is writing for it. Huh. Reading about those solutions also got me sidetracked into the world of dancing links, algorithm x, and "exact cover" problems. Eeek. http://en.wikipedia.org/wiki/Dancing_Links http://en.wikipedia.org/wiki/Algorithm_X http://en.wikipedia.org/wiki/Exact_cover 2. "inside-out" objects http://www.stonehenge.com/merlyn/UnixReview/col63.html (no content until apr 1st, although I first noticed this based on a seminar that he gave for my company, so...) http://www.samag.com/documents/s=9979/sam0603g/0603g.htm Hm. Appears to be that article. :-/ http://www.cpanforum.com/posts/1316 Any other topics? Questions always welcome. See you this evening! t. From merlyn at stonehenge.com Mon Mar 13 06:21:32 2006 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: 13 Mar 2006 06:21:32 -0800 Subject: [San-Diego-pm] Meeting today (Monday, March 13th, 2006) In-Reply-To: References: Message-ID: <8664miifwz.fsf@blue.stonehenge.com> >>>>> "Tony" == Tony Foiani writes: Tony> And the spring 2006 edition of "The Perl Review". Which I didn't Tony> even know existed, although at least one big name (brian d foy) Tony> is writing for it. Huh. Yeah, we try to keep that one a secret. Wouldn't want too many people reading it... the ink would get faint. :) Tony> 2. "inside-out" objects Tony> http://www.stonehenge.com/merlyn/UnixReview/col63.html Tony> (no content until apr 1st, although I first noticed this based on Tony> a seminar that he gave for my company, so...) Tony> http://www.samag.com/documents/s=9979/sam0603g/0603g.htm Tony> Hm. Appears to be that article. :-/ Yes, odd how that is... the magazine that *pays* for the article actually gets to publish it first. :) But that's the purpose of the embargo... I'm allowed to publish the article but only after some number of days after it appears in the original publication (varying with the deal). Tony> See you this evening! I'm actually in LA this week. I'm tempted to drive down, but I'm afraid the evening-commute traffic would mean I'd have to start mid-day to make it by 7pm. Someone needs to hire me in San Diego so I can go to a meeting! :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From tkil at scrye.com Mon Mar 13 10:18:32 2006 From: tkil at scrye.com (Tkil) Date: Mon, 13 Mar 2006 11:18:32 -0700 Subject: [San-Diego-pm] Meeting today (Monday, March 13th, 2006) In-Reply-To: <8664miifwz.fsf@blue.stonehenge.com> (Randal L. Schwartz's message of "13 Mar 2006 06:21:32 -0800") References: <8664miifwz.fsf@blue.stonehenge.com> Message-ID: >>>>> "Randal" == Randal L Schwartz writes: Randal> Yeah, we try to keep that [The Perl Review] a secret. Randal> Wouldn't want too many people reading it... the ink would get Randal> faint. :) Well, it's like conserving blinker fluid for the troops. That's why I've stopped signalling turns and lane changes -- I'm being patriotic! Randal> Yes, odd how that is... the magazine that *pays* for the Randal> article actually gets to publish it first. :) Yeah, realized that after I posted. Mostly I was tired enough that when the names didn't match directly, I lacked the brain to follow up the chain of ownership. Randal> I'm actually in LA this week. I'm tempted to drive down, but Randal> I'm afraid the evening-commute traffic would mean I'd have to Randal> start mid-day to make it by 7pm. Hm. I've made it from Rancho Bernardo and I-15 to Santa Ana in less than 2 hours, starting at 4:30. Depending where in L.A., it might be possible for you to catch the train and avoid driving -- but that's sadly not likely to be all that much faster (especially as you'd probably have to transfer.) Yeah, looks like 3:30 union station puts you at Sorrento Valley at 6p. And thats with a really tight connection. And difficult to get back north at night. Randal> Someone needs to hire me in San Diego so I can go to a Randal> meeting! :) Either that, or convince the purple and yellow company to send you down this way for something on a convenient date... t. From tkil at scrye.com Tue Mar 14 02:26:10 2006 From: tkil at scrye.com (Tkil) Date: Tue, 14 Mar 2006 03:26:10 -0700 Subject: [San-Diego-pm] Meeting today (Monday, March 13th, 2006) In-Reply-To: (Tony Foiani's message of "Mon, 13 Mar 2006 01:54:32 -0700") References: Message-ID: In attendance were: Joel, Emile, David, Menolly, and me. Notes from memory: * Joel and I discussed GPS geodes and datums (that's /got/ to be wrong!), especially w.r.t. his experience of not having google maps grids mesh with what he was observing in the field with his GPS unit. No conclusions were made, but I did link to this pic, made from a bike ride I did last weekend and www.gpsvisualizer.com http://scrye.com/~tkil/misc-pics/med/med-bike-ride-2006-03-04.html Further readings: http://en.wikipedia.org/wiki/Geodesy http://en.wikipedia.org/wiki/Datum http://www.dbartlett.com/index.htm#setup http://www.nb.net/~resteele/newsites/gpsdatum.htm FWIW, my GPS unit (Garmin eTrex Vista) has a setting for which datum to use (Main Menu -> Setup -> Units -> Map Datum) with... a *lot* of options. J reports that his GPS unit and his survey maps (mostly NAD'27 datum) seem to coincide, so good for him -- but it's something to watch out for. (In this particular case, he's looking for a particular location; it sounds like he needs to ascertain which datum that location was surveyed against, and either set his GPS for that datum, or translate the given location to the datum used by his current GPS settings and maps.) * We discussed some aspects of the inside-out object pattern, and I tried to come up with an example on the spot. Sadly, between having little creativity and having spent *WAY* too much time with java lately, it took me a while, but I eventually had a primitive example that demonstrated the three advantages of i-o objects: - compile-time field name checking - lexical hashes to hide data within a package - subclass field names can't collide with superclass field names The example can be found at: http://scrye.com/~tkil/perl/sdpm-20060313/ Note that this does *not* implement the necessary DESTROY functions, so it will leak memory. Presumably with a leg raised. I actually have lingering questions over the proper way to implement DESTROY; the way described in his internal presentation and in the article seem to want to call grandparent class destructors too many times, but I need to stare at it some more before I'm sure. * Emile had an interesting problem where he was trying to factor presentation away from business / processing logic when the subject is a highly recursive structure (in his case, physical locations, mount points, nfs shares, filenames, oh my!). I suggested the "Visitor" pattern from the "gang of four" book: http://en.wikipedia.org/wiki/Visitor_pattern And there is indeed a Simple::Tree::Visitor class (Emile is using S::T in his current work.) I was also a sick little monkey and recommended XSLT, but I'm a bastard like that. We look forward to hearing the results of his experimentation. (Hint hint.) Odds and sods: * Joel mused about upgrading his hiking GPS. I'm happy with my Garmin eTrex Vista, although I lust after the eTrex Vista C and the new Cx model (the latter having an expandable memory slot). Or their one-notch-higher GPSMAP 76Cx. Mmm. Unfortunately, entry into those clubs is in the 300$ range; J was looking more at lightly used models in the 50$ range. Fair enough. * J also mentioned my editing environment on my [work related! honest!] windows laptop. I've managed to get 95% of my unixy environment on this box, mostly through: http://www.chiark.greenend.org.uk/~sgtatham/putty/ A free SSH client + VTxxx/xterm emulator for windows (also pagaent, an ssh-agent) http://www.gnu.org/software/emacs/windows/ntemacs.html GNU Emacs ported to win32 http://www.cvsnt.org/ CVS for nt http://www.cygwin.com/ A port of many common unix utils (i use mostly grep and perl) to windows, as well as a bash shell. I also installed a bunch of Java utils (JDK, Tomcat, NetBeans) to c:\java; it's probably best to avoid paths with any spaces for that stuff. Anyway, if anyone else is an emacs fan that would like a comfortable light-on-dark editing experience, my current _emacs file is available at: http://scrye.com/~tkil/perl/sdpm-20060313/_emacs Lots of cruft has accumulated there, but the font-lock and faces bits are releavant for the editing experience I was "showing off" at the meeting. * J further related some issues he was having sending mail to Juno e-mail subscribers. Indications pointed to him being on the Spamhaus.org RBL, but that hadn't been fruitful. The best we could suggest was for him to get a juno account himself, and see what it took for him to receive mail from his external accounts. Did I miss anything? Updates and corrections welcome. Happy hacking, t. From joel at fentin.com Tue Mar 14 08:05:03 2006 From: joel at fentin.com (Joel Fentin) Date: Tue, 14 Mar 2006 08:05:03 -0800 Subject: [San-Diego-pm] Meeting today (Monday, March 13th, 2006) In-Reply-To: References: Message-ID: <4416E9AF.9000704@fentin.com> Tkil wrote: > Did I miss anything? Updates and corrections welcome. You forgot to mention what each of us ordered while there. -- Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 Email me: http://fentin.com/me/ContactMe.html Biz Website: http://fentin.com Personal Website: http://fentin.com/me From tkil at scrye.com Tue Mar 14 15:50:52 2006 From: tkil at scrye.com (Tkil) Date: Tue, 14 Mar 2006 16:50:52 -0700 Subject: [San-Diego-pm] Meeting today (Monday, March 13th, 2006) In-Reply-To: <20060314192313.92639.qmail@web32907.mail.mud.yahoo.com> References: <20060314192313.92639.qmail@web32907.mail.mud.yahoo.com> Message-ID: <17431.22236.741869.67110@brand.scrye.com> >>>>> "Todd" == Todd Rockhold writes: Todd> Just some idle speculation which may well be completely wrong Todd> because I don't know details of Google Maps, GPS computations, Todd> or Joel's observed discrepancies. Todd> I have heard that for accuracy GPS equipment does incorporate an Todd> oblate spheroid model of the earth. Haven't heard one way or Todd> the other about Google Maps, but if it incorporates a shpherical Todd> model of the earth that could account for discrepancies. But Todd> would those match Joel's observations? The concept of a "datum" in this sense is exactly what you're talking about: what model for the earth's surface is in use, and what are its reference point(s). The Wikipedia link explains it pretty well: http://en.wikipedia.org/wiki/Datum To quote: The difference in co-ordinates between data is commonly referred to as datum shift. The datum shift between two particular datums can vary from one place to another within one country or region, and can be anything from zero to hundreds of metres (or several kilo- metres for some remote islands). The North Pole, South Pole and Equator may be assumed to be in different positions on different datums, so True North may be very slightly different. Different datums use different estimates for the precise shape and size of the Earth (reference ellipsoids). The difference between WGS84 and OSGB36 is up to 140 metres / 450 feet, which for some navigational purposes is an insignificant error. For most applications, such as surveying and dive site location for SCUBA divers, 140 metres is an unacceptably large error. The main reason that there are a number of datums is that before the advent of GPS positioning, national map making organisations did not have a common surveying reference point and only produced maps for their locality. (The word "datums" sends chills up my spine, really.) Most of the maps from the USGS for years have been based off the North American Datum from 1927 ("NAD27"). GPS is based off the World Geodetic System 1984 ("WGS84"). More Wikipedia goodness: The WGS 84 orignally used the GRS 80 reference ellipsoid, but has undergone some minor refinements in later editions since its initial publication. Most of these refinements are important for high-precision orbital calculations for satellites, and have little practical effect on typical topographical uses. The following table lists the primary ellispoid parameters. [chart omitted; the only difference is the inverse flattening, which for GRS80 is 298.257 222 101, while for WGS84 it is 298.257 223 563] For the very small difference in the flattening results a -- very theoretical -- difference of 0.1 millimetre in the polar axis. Longitudes on WGS84 The longitude positions on WGS84 agree with those on the older North American Datum 1927 at roughly 85 longitude west, in the east-central USA. By contrast, the zero meridian of WGS84 is about 100 metres east of the "traditional" Prime Meridian at Greenwich, UK. -- http://en.wikipedia.org/wiki/WGS_84 So the difference between NAD27 (USGS topo maps) and WGS84 (GPS) could easily be in the dozens of meters out this way. The simplest way to do this is probably to take GPS readings at obvious map features (peaks, road intersections, etc) and compare that to what you get by reading the map for the same features. If you do the feature observations in an small area (within a 50mi radius, say) surrounding your intended target, you should be able to come up with a simple lat+long translation that you can use to convert map readings to gps settings or v-v. (What's interesting is that Joel indicated that his GPS matched his topo maps, which means that his GPS is likely already set to read NAD27; to see what Google is using, he can either just ask, or perform the map-vs-secondary-source experiment above while sitting at home: find features on the topos in the area of his intended target, find those same features on google maps, and see if there's a consistent pattern. I have noticed that google's satellite photos, at least, tend to be less-accurately aligned with geopolitical / man-made features (such as roads) when you get out into the sticks.) Adding to the confusion, it looks like UTM *used to be* based on the European Datum 1950 ("ED50"). Wikipedia takes it once more: The Universal Transverse Mercator coordinate system was developed by the United States Army in 1947. The system was based on an ellipsoidal model of the Earth. For areas within the conterminous United States, the Clarke 1866 ellipsoid was used. For the remaining areas of the Earth, including Hawaii, the International Ellipsoid was used. Currently, the WGS84 ellipsoid is used as the underlying model of the Earth in the UTM coordinate system. -- http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system So to be clear, and depending on the era in which the maps were generated (and possibly what area of the earth it was generated for), you have to specify UTM as well as the datum in use, so: "UTM ED50", "UTM WGS84". The latter is what the US is trying to get all their maps onto, but it takes time to get there. Linky goodness: http://search.cpan.org/~grahamc/Geo-Coordinates-UTM-0.05/ http://www.ngs.noaa.gov/TOOLS/utm.shtml http://erg.usgs.gov/isb/pubs/factsheets/fs07701.html http://www.jeeep.com/details/coord/ http://www.vterrain.org/Projections/ http://www.vterrain.org/Projections/UTM.html And for the really juicy bits: http://earth-info.nga.mil/GandG/publications/ http://earth-info.nga.mil/GandG/geotrans/index.html Why yes, I am a map geek, why do you ask? t. From joel at fentin.com Tue Mar 14 21:12:25 2006 From: joel at fentin.com (Joel Fentin) Date: Tue, 14 Mar 2006 21:12:25 -0800 Subject: [San-Diego-pm] Meeting today (Monday, March 13th, 2006) In-Reply-To: <17431.22236.741869.67110@brand.scrye.com> References: <20060314192313.92639.qmail@web32907.mail.mud.yahoo.com> <17431.22236.741869.67110@brand.scrye.com> Message-ID: <4417A239.90600@fentin.com> Tkil wrote: > Most of the maps from the USGS for years have been based off the North > American Datum from 1927 ("NAD27"). GPS is based off the World > Geodetic System 1984 ("WGS84"). My GPS is the same one the Wright Brothers used at Kittyhawk. 1. Because the local USGS topo maps are NAD27, that's what I have my GPS set to. More specifically NAD27 CONUS. (There are lots of NAD27s.) 2. Because UTMs are handier to use than Lat-Lon, that too is what I use. 3. Google Earth uses Lat-Lon. And perhaps they use WGS84. The error I saw was in the neighborhood of a long block or two. A football field or two. 4. Next time I'm at a location with a faster connection that 24K dialup, I'll switch my GPS to Lat-Lon and WGS84 and see if that cleans off the error. If so, I will have gotten an eduction and I can then continue with what I set out to do in the first place. Tony: And speaking of education, thanks for the doctorate by email. I'll save your email for future reference. I have two USGS maps of the desert that are more than 100 years old. You can see the railroad lines running through what is now the Salton Sea, and the spellings have changed. Is this something that would interest you? Considering what those poor bastards had to endure back then, I think they did a stupendous job surveying. ===== So much for Perl. -- Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 Email me: http://fentin.com/me/ContactMe.html Biz Website: http://fentin.com Personal Website: http://fentin.com/me From tkil at scrye.com Wed Mar 15 14:50:20 2006 From: tkil at scrye.com (Tkil) Date: Wed, 15 Mar 2006 15:50:20 -0700 Subject: [San-Diego-pm] Meeting today (Monday, March 13th, 2006) In-Reply-To: <4417A239.90600@fentin.com> (Joel Fentin's message of "Tue, 14 Mar 2006 21:12:25 -0800") References: <20060314192313.92639.qmail@web32907.mail.mud.yahoo.com> <17431.22236.741869.67110@brand.scrye.com> <4417A239.90600@fentin.com> Message-ID: >>>>> "Joel" == Joel Fentin writes: Joel> I'll switch my GPS to Lat-Lon and WGS84 and see if that cleans Joel> off the error. If so, I will have gotten an eduction and I can Joel> then continue with what I set out to do in the first place. I ran a quick experiment last night. Well, this morning. Something. 1. Set GPS unit outside to acquire a fix. It's in the default WGS84 mode, and came up with: WGS84: 32?44.416' N 117?15.245' W 2. Switched GPS to NAD27 CONUS, and it came back with this fix: NAD27-CONUS: 32?44.413' N 117?15.195' W Using the very rough approximation that a minute is a mile, that's a difference of .05mi, or about 250ft, or some 80m. Huh. That's a better approximation than I thought! I thought that it was a mile-per-minute at the equator, but if we do: length of equator * cos( 33? ) / ( 360 * 60 ) = ( semi-major axis * 2 * pi ) * cos( 33? ) / ( 360 * 60 ) = 6_378_137m * 2 * 3.14159 * 0.83867 / 21600 = 1_556.0m So 0.05minute error is really close to 80m. To get miles: 1556.0m / ( 1609.344 m/mi ) = 0.96686mi = 5105ft 3. Browsed to my porch on Google Maps, did a "link this page", and read off these coords: ll=32.740232,-117.254006 Google Maps: 32?44.414' N 117?15.240' W For comparison: WGS84: 32?44.416' N 117?15.245' W NAD27-CONUS: 32?44.413' N 117?15.195' W Google Maps: 32?44.414' N 117?15.240' W So I'd say that google maps probably uses WGS84, or something close to it. By the same rough estimation above, the delta between WGS84 and GM is an order of magnitude less than between WGS84 and NAD27-CONUS. So GM vs. WGS84 at my house is only a 25ft / 8m difference, and that was about the radius of uncertainty on my GPS at the time I took the fix. Mapping the NAD27-CONUS fix onto the GM datum puts me around the block: http://tinyurl.com/prbyo Joel> So much for Perl. Well, I *did* have a link in there for a perl coordinate translator. :) t. From david.romano at gmail.com Wed Mar 15 22:04:26 2006 From: david.romano at gmail.com (David Romano) Date: Wed, 15 Mar 2006 22:04:26 -0800 Subject: [San-Diego-pm] Recurse through trees Message-ID: <441079bd0603152204h1caa3fefj7249e4831967b0e4@mail.gmail.com> Emile brought up a problem where he had to recurse through a tree-like structure. I just skimmed an article by chromatic on the XML::XPathEngine module, and thought Emile *might* find it useful: http://xrl.us/kf3b (Link to www.oreillynet.com) David From emileaben at gmail.com Fri Mar 17 06:56:23 2006 From: emileaben at gmail.com (Emile Aben) Date: Fri, 17 Mar 2006 06:56:23 -0800 Subject: [San-Diego-pm] Recurse through trees In-Reply-To: <441079bd0603152204h1caa3fefj7249e4831967b0e4@mail.gmail.com> References: <441079bd0603152204h1caa3fefj7249e4831967b0e4@mail.gmail.com> Message-ID: <28e00a750603170656k683729acp4efb5c207fd4eae3@mail.gmail.com> Hi, My main concern was for a better/nicer way of separating logic and presentation for a Tree::Simple [1] tree object (that in my case represents the relationship between some filesystems) that I was passing into template toolkit [2], and where i needed a perl-codeblock to get the presentation right. For now I ended up using the same perl-codeblock in my template-toolkit as I had before (pasted below, for the curious). I Looked into the Tree::Simple visitor [3] pattern, but that didn't allow me to improve separation between logic and presentation, it would only move both logic an presention to the 'visitor' I'd write. XSLT might allow me to, but AFAICS I'd have to convert my tree to XML first, then process it. Having 2 separate templating technologie-thingies (TT and XSLT) together in 1 application doesn't give me a warm fuzzy feeling. For myself I've started justifying having code in my template by calling it 'display logic' (as opposed to 'controller logic'), and that makes me a lot less unhappy about the way i solved this as I initially was. Hope some of this makes sense, I'd be happy to elaborate on a next PM meeting. emile [1] http://search.cpan.org/dist/Tree-Simple/lib/Tree/Simple.pm [2] http://www.template-toolkit.org/ [3] http://search.cpan.org/dist/Tree-Simple/lib/Tree/Simple/Visitor.pm On 3/15/06, David Romano wrote: > Emile brought up a problem where he had to recurse through a tree-like > structure. I just skimmed an article by chromatic on the > XML::XPathEngine module, and thought Emile *might* find it useful: > http://xrl.us/kf3b (Link to www.oreillynet.com) > > David > _______________________________________________ > San-Diego-pm mailing list > San-Diego-pm at pm.org > http://mail.pm.org/mailman/listinfo/san-diego-pm > ---code--- [% tree = filelocation.logical_tree('string') %] [% PERL %] my $tree = $stash->get('tree'); html_node( $tree, '   '); $tree->traverse(sub{ my($node)=@_; html_node( $node, '   '); }); sub html_node { my ($node,$spacer) = @_; if ($node->isLeaf) { print '
'; } else { print "
"; } print $spacer x ($node->getDepth()); print '' if ($node->getDepth > -1); print $node->getNodeValue(); print '
'; print '
'; } [% END %] ---end code--- From merlyn at stonehenge.com Fri Mar 17 07:21:23 2006 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: 17 Mar 2006 07:21:23 -0800 Subject: [San-Diego-pm] Recurse through trees In-Reply-To: <28e00a750603170656k683729acp4efb5c207fd4eae3@mail.gmail.com> References: <441079bd0603152204h1caa3fefj7249e4831967b0e4@mail.gmail.com> <28e00a750603170656k683729acp4efb5c207fd4eae3@mail.gmail.com> Message-ID: <86wtetyu4s.fsf@blue.stonehenge.com> >>>>> "Emile" == Emile Aben writes: Emile> ---code--- Emile> [% tree = filelocation.logical_tree('string') %] Emile> [% PERL %] Emile> my $tree = $stash->get('tree'); Emile> html_node( $tree, '   '); Emile> $tree->traverse(sub{ Emile> my($node)=@_; Emile> html_node( $node, '   '); Emile> }); Emile> sub html_node { Emile> my ($node,$spacer) = @_; Emile> if ($node->isLeaf) { Emile> print '
'; Emile> } else { Emile> print "
"; Emile> } Emile> print $spacer x ($node->getDepth()); Emile> print '' if Emile> ($node->getDepth > -1); Emile> print $node->getNodeValue(); Emile> print '
'; Emile> print '
'; Emile> } Emile> [% END %] [% spacer = "  " %] [% MACRO html_node_visitor(node) BLOCK %] [% IF node.isLeaf %] ... etc etc [% ELSE %] ... etc etc [% END %] [% GET spacer FOR 1..node.getDepth %] [% node.getNodeValue %] etc etc [% END %] [% tree.traverse(html_node_visitor) %] A "MACRO" is a code block! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From emileaben at gmail.com Fri Mar 17 15:30:01 2006 From: emileaben at gmail.com (Emile Aben) Date: Fri, 17 Mar 2006 15:30:01 -0800 Subject: [San-Diego-pm] Recurse through trees In-Reply-To: <86wtetyu4s.fsf@blue.stonehenge.com> References: <441079bd0603152204h1caa3fefj7249e4831967b0e4@mail.gmail.com> <28e00a750603170656k683729acp4efb5c207fd4eae3@mail.gmail.com> <86wtetyu4s.fsf@blue.stonehenge.com> Message-ID: <28e00a750603171530x2488a5d8hda993cb0c663ef7c@mail.gmail.com> > [% spacer = "  " %] > [% MACRO html_node_visitor(node) BLOCK %] > [% IF node.isLeaf %] > ... etc etc > [% ELSE %] > ... etc etc > [% END %] > [% GET spacer FOR 1..node.getDepth %] > [% node.getNodeValue %] etc etc > [% END %] > [% tree.traverse(html_node_visitor) %] > > A "MACRO" is a code block! Thanks, that looks a lot better then the code I had, I now have this code: [% tree = filelocation.logical_tree('string') %] [% spacer = '   ' %] [% MACRO html_node_visitor(node) BLOCK %] [% IF node.isLeaf %]
[% ELSE %]
[% END %] [% spacer.repeat(node.getDepth) %] [% IF node.getDepth > -1 %][% END %] [% node.getNodeValue %]
[% END %] [% html_node_visitor(tree) %] [% tree.traverse( html_node_visitor ) %] Unfortunately I still have a little problem in that the template toolkit 'stash' (both the regular, and the experimental Template::Stash::Context) apparently does some stuff to the code block, so Tree::Simple doesn't recognize 'html_node_visitor' as a code block, after defining the macro it works fine like this: [% html_node_visitor(tree) %] but dies pm me on: [% tree.traverse( html_node_visitor ) %] (die msg: undef error - Incorrect Object Type : traversal function is not a function at /usr/local/lib/perl5/site_perl/5.8.7/Tree/Simple.pm line 471. ) Doing a [% html_node_visitor.ref %] prints 'CODE' (which is what I expected). but datadumping $stash->get('html_node_visitor') finds this is an 'undef'? Looked a little at the guts of Template::Toolkit, but can't seem to wrap my brain around the problem right now. [% html_node_visitor(tree) %] is translated to: print $stash->get(['html_node_visitor', [ $stash->get('tree') ]]); while the nonworking: [% tree.traverse( html_node_visitor ) %] is translated to: print $stash->get(['tree', 0, 'traverse', [ $stash->get('html_node_visitor') ]]); Before I dig deeper into the guts of Template::Toolkit I'd like to know if anybody has any idea what I'm doing wrong (or template toolkit is doing wrong, although that is less likely)? emile From merlyn at stonehenge.com Fri Mar 17 15:33:08 2006 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: 17 Mar 2006 15:33:08 -0800 Subject: [San-Diego-pm] Recurse through trees In-Reply-To: <28e00a750603171530x2488a5d8hda993cb0c663ef7c@mail.gmail.com> References: <441079bd0603152204h1caa3fefj7249e4831967b0e4@mail.gmail.com> <28e00a750603170656k683729acp4efb5c207fd4eae3@mail.gmail.com> <86wtetyu4s.fsf@blue.stonehenge.com> <28e00a750603171530x2488a5d8hda993cb0c663ef7c@mail.gmail.com> Message-ID: <8664mcy7d7.fsf@blue.stonehenge.com> >>>>> "Emile" == Emile Aben writes: Emile> but datadumping $stash->get('html_node_visitor') finds this is an 'undef'? Ahh, that's an invocation. Try adding a backslash in front of html_node_visitor as in: [% tree.traverse(\html_node_visitor) %] And when I say "try", I mean "I have no frigging idea if this works but I saw it once in the docs and maybe it'll help here". :-) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From emileaben at gmail.com Fri Mar 17 15:52:50 2006 From: emileaben at gmail.com (Emile Aben) Date: Fri, 17 Mar 2006 15:52:50 -0800 Subject: [San-Diego-pm] Recurse through trees In-Reply-To: <8664mcy7d7.fsf@blue.stonehenge.com> References: <441079bd0603152204h1caa3fefj7249e4831967b0e4@mail.gmail.com> <28e00a750603170656k683729acp4efb5c207fd4eae3@mail.gmail.com> <86wtetyu4s.fsf@blue.stonehenge.com> <28e00a750603171530x2488a5d8hda993cb0c663ef7c@mail.gmail.com> <8664mcy7d7.fsf@blue.stonehenge.com> Message-ID: <28e00a750603171552q474c38a7jd736c39ba0234d53@mail.gmail.com> > Emile> but datadumping $stash->get('html_node_visitor') finds this is an 'undef'? > > Ahh, that's an invocation. Try adding a backslash in front of > html_node_visitor as in: > > [% tree.traverse(\html_node_visitor) %] That's slightly better in that it doesn't produce an error message, doesn't produce html either :p > And when I say "try", I mean "I have no frigging idea if this works but > I saw it once in the docs and maybe it'll help here". > > :-) Reread the Template Toolkit basics some more and have become more and more convinced that this goes wrong because the html_node_visitor MACRO/CODEref gets invoked/evaluated before it gets passed to the tree to traverse. Bummer, so looks like either I go back to my old code or write an alternative template-stash that let's me delay code execution. Hmmm, which one would my boss like more ... emile From rkleeman at energoncube.net Mon Mar 20 15:49:52 2006 From: rkleeman at energoncube.net (Bob Kleemann) Date: Mon, 20 Mar 2006 15:49:52 -0800 Subject: [San-Diego-pm] The March Mingle IS Two Days Away! (fwd) Message-ID: <20060320234952.GJ26520@energoncube.net> I'm planning on going, as this could be a good way to mingle with much of the rest of San Diego tech community. ----- Forwarded message from Cameron Childress ----- The March Mingle's right around the corner! 150 people have already sent in an RSVP! If you haven't recently done so, I'd appreciate it if you would send out a reminder email to SD PERL Mongers today! When: Wed, March 22nd, 5:30PM - 9:00PM Where: Dave and Busters (map @ marchmingle.com) Cost: Free Finger Food (Cash Bar) RSVP/Info: http://www.marchmingle.com Sponsors: Adobe (adobe.com) Microsoft (microsoft.com) Robert-Half (rht.com) GroundWork Open Source (groundworkopensource.com) Last year, SD PERL Mongers was among the 20 different San Diego User Groups which participated in the second annual March Mingle. About 200 people attended the event and it was a great success, largely due to strong support from the participating User and Technology Interest Groups. Consider this an official invitation for the SD PERL Mongers to join us again at the Third Annual March Mingle. Just like last year, the March Mingle is a technology agnostic event that brings together developers of all kinds, a sort of annual "Technology Woodstock" or "Ultimate Geek Happy Hour" for San Diego. No sales or technical presentations, just talking shop and munching on finger food while relaxing and enjoying the games and atmosphere. Thanks to our sponsors, we will have a buffet of finger food and plenty of door prizes, including software and books. If you have any questions or comments, please call my cell, AIM or Email me! Hope to see your group there! -Cameron President, San Diego ColdFusion User Group --- cell: 678.637.5072 aim: cameroncf email: cameronc at mindspring.com ----- End forwarded message ----- From david.romano at gmail.com Mon Mar 20 22:17:25 2006 From: david.romano at gmail.com (David Romano) Date: Mon, 20 Mar 2006 22:17:25 -0800 Subject: [San-Diego-pm] The March Mingle IS Two Days Away! (fwd) In-Reply-To: <20060320234952.GJ26520@energoncube.net> References: <20060320234952.GJ26520@energoncube.net> Message-ID: <441079bd0603202217k453e918dw657836a8abee5c3@mail.gmail.com> On 3/20/06, Bob Kleemann wrote: > I'm planning on going, as this could be a good way to mingle with much > of the rest of San Diego tech community. I'm planning on going too. Anyone else up for it? David From emileaben at gmail.com Thu Mar 23 13:06:29 2006 From: emileaben at gmail.com (Emile Aben) Date: Thu, 23 Mar 2006 13:06:29 -0800 Subject: [San-Diego-pm] Larry Wall in SD Message-ID: <28e00a750603231306r518dee5am9b53d6b305da58f6@mail.gmail.com> Hi, somebody pasted this blurp of info to me: Come hear Larry Wall speak about Perl and language development on Saturday, April 8, 2006. The event will be at Point Loma Nazarene University here in San Diego. This is part of a CS/IS Conference being co-sponsored by the SDACM. To get further information about the conference and to register go to http://www.mics.ptloma.edu/UCISC06/index.php emile