From grant at mclean.net.nz Sun Mar 5 14:16:10 2006 From: grant at mclean.net.nz (Grant McLean) Date: Mon, 06 Mar 2006 11:16:10 +1300 Subject: [Wellington-pm] Meeting next Tuesday Message-ID: <1141596970.16631.16.camel@localhost.localdomain> Hi Mongers OK, after due consideration (did someone say bribery?), I've decided we might as well give this Tuesday suggestion a go. So next week's meeting will now be on Tuesday (the 14th) and not Monday. Venue and time are unchanged: 6:00pm Tuesday 14 March 2006 Level 2, Eagle Technology House 150 Willis Street Wellington I hope the late notice doesn't cause too much disruption to people's social schedules. We have two talks lined up: Finlay Thompson will be talking about higher order programming and why it's all too hard in Perl. Grant McLean will be running through a real-world data munging exercise. This talk is aimed at the beginner to intermediate level and will contain practical examples and advice. Regards Grant From enkidu at cliffp.com Sat Mar 11 00:58:12 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Sat, 11 Mar 2006 21:58:12 +1300 Subject: [Wellington-pm] Creating an array of objects Message-ID: <44129124.9080300@cliffp.com> I'm not very good at the OO stuff, so bear with me, please! What I want to do is create an array of objects. Or is that an array of object references. I'm not sure. I can, I believe, instantiate an object as follows (please correct me if I'm wrong) my $foo = MyPackage->new('bar') ; Is $foo an object or an object reference? I basically want to create an array of objects or object refs, so can I do : my @foo; $foo[0] = MyPackage->new('tut') ; $foo[1] = MyPackage->new('ankh') ; $foo[2] = MyPackage->new('amun') ; Obviously this could be done using a loop, but what if I needed an array of a hundred of them? Is there a clever way to instantiate a hundred objects of a particular class? Am I making sense? The experienced OO programmers are probably laughing themselves silly by now.... Cheers, Cliff -- http://barzoomian.blogspot.com From grant at mclean.net.nz Sat Mar 11 02:02:39 2006 From: grant at mclean.net.nz (Grant McLean) Date: Sat, 11 Mar 2006 23:02:39 +1300 Subject: [Wellington-pm] Creating an array of objects In-Reply-To: <44129124.9080300@cliffp.com> References: <44129124.9080300@cliffp.com> Message-ID: <1142071359.8267.13.camel@localhost.localdomain> On Sat, 2006-03-11 at 21:58 +1300, Cliff Pratt wrote: > I can, I believe, instantiate an object as follows (please correct me if > I'm wrong) > > my $foo = MyPackage->new('bar') ; > > Is $foo an object or an object reference? Strictly speaking, it is a reference to an object, but the distinction is seldom important. For all intents and purposes, $foo is an object. You can call methods on it and Perl can locate those methods via the package name that was associated with the reference using 'bless'. > I basically want to create an array of objects or object refs, so can I do : > > my @foo; > $foo[0] = MyPackage->new('tut') ; > $foo[1] = MyPackage->new('ankh') ; > $foo[2] = MyPackage->new('amun') ; > > Obviously this could be done using a loop, but what if I needed an array > of a hundred of them? Is there a clever way to instantiate a hundred > objects of a particular class? Using a loop might be a perfectly reasonable way to create lots of objects. There are other possibilities. For example, Class::DBI provides an object wrapper around relational database entities. For example, you might use it to create a 'Product' class that maps to the 'product' table in your database. Then you might use the search method from that class to create an array of Product objects representing rows from the product table which met some constraint, eg: my @red_prods = Product->search(colour => 'red'); Under the covers, a SQL query will be constructed and executed. Then a loop will be used to iterate through the query result set and create an object for each row. > Am I making sense? The experienced OO programmers are probably laughing > themselves silly by now.... You seem to be making sense, but may be trying to think about things in too abstract a way. Bring it back to something more concrete by looking at what would be the unique identifying features of each object you create. Where would the data come from? Cheers Grant From ewen at naos.co.nz Sat Mar 11 10:33:51 2006 From: ewen at naos.co.nz (Ewen McNeill) Date: Sun, 12 Mar 2006 07:33:51 +1300 Subject: [Wellington-pm] Creating an array of objects In-Reply-To: Message from Cliff Pratt of "Sat, 11 Mar 2006 21:58:12 +1300." <44129124.9080300@cliffp.com> Message-ID: <20060311183351.6807B869F87@wat.la.naos.co.nz> In message <44129124.9080300 at cliffp.com>, Cliff Pratt writes: >What I want to do is create an array of objects. Or is that an array of >object references. I'm not sure. [...] >my $foo = MyPackage->new('bar') ; For the special case (one init parameter, or perhaps one varying init parameter) you could do something like this: my @init = qw(tut ankh amun); my @foo = map { MyPackage->new($_) } @init; If you need more parameters you could perhaps index a hash or set of arrays with those values. Generally if you need lots of objects then the source information for them comes from somewhere else (eg, a database, a document, etc) and you can create them (or have them created for you) as you process that thing. So the structure of what you're processing naturally suggests the way to create the objects. And FWIW in perl what you get is an object reference pretty much all the time. (In theory you could get a copy of the underlying scalar/array/hash that is blessed to be the object, but in practice that's not very useful in perl.) Other OO languages handle this differently in some situations. Ewen From jarich at perltraining.com.au Sat Mar 11 12:07:09 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sun, 12 Mar 2006 07:07:09 +1100 Subject: [Wellington-pm] Creating an array of objects In-Reply-To: <44129124.9080300@cliffp.com> References: <44129124.9080300@cliffp.com> Message-ID: <44132DED.4070905@perltraining.com.au> Cliff Pratt wrote: > I basically want to create an array of objects or object refs, so can I do : > > my @foo; > $foo[0] = MyPackage->new('tut') ; > $foo[1] = MyPackage->new('ankh') ; > $foo[2] = MyPackage->new('amun') ; > > Obviously this could be done using a loop, but what if I needed an array > of a hundred of them? Is there a clever way to instantiate a hundred > objects of a particular class? my @foo; foreach my $name (qw/tut ankh amun/) { push @foo, MyPackage->new($name); } or my @setup = ( { name => "tut", ... => ..., }, { name => "ankh", ... => ..., }, { name => "amun", ... => ..., }, ); # data probably generated in some useful form elsewhere. my @foo; foreach my $details (@setup) { push @foo, MyPackage->new(%$details); # assuming named parameters } If you need an array of 100, or 50, or even 4, this is as good a method as any. Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From grant at mclean.net.nz Sat Mar 11 13:04:08 2006 From: grant at mclean.net.nz (Grant McLean) Date: Sun, 12 Mar 2006 10:04:08 +1300 Subject: [Wellington-pm] Creating an array of objects In-Reply-To: <1142071359.8267.13.camel@localhost.localdomain> References: <44129124.9080300@cliffp.com> <1142071359.8267.13.camel@localhost.localdomain> Message-ID: <1142111048.8393.5.camel@localhost.localdomain> On Sat, 2006-03-11 at 23:02 +1300, Grant McLean wrote: > On Sat, 2006-03-11 at 21:58 +1300, Cliff Pratt wrote: > > my $foo = MyPackage->new('bar') ; > > > > Is $foo an object or an object reference? > > the distinction is seldom important Actually just to contradict myself ... It is important to realise that if you assign $foo to $bar, then you end up with two references to the same object. Change a property on one and you'll see it's changed on the other as well. Cheers Grant From enkidu at cliffp.com Sat Mar 11 14:06:52 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Sun, 12 Mar 2006 11:06:52 +1300 Subject: [Wellington-pm] Creating an array of objects In-Reply-To: <44132DED.4070905@perltraining.com.au> References: <44129124.9080300@cliffp.com> <44132DED.4070905@perltraining.com.au> Message-ID: <441349FC.6040800@cliffp.com> Jacinta Richardson wrote: > Cliff Pratt wrote: > > >>I basically want to create an array of objects or object refs, so can I do : >> >>my @foo; >>$foo[0] = MyPackage->new('tut') ; >>$foo[1] = MyPackage->new('ankh') ; >>$foo[2] = MyPackage->new('amun') ; >> >>Obviously this could be done using a loop, but what if I needed an array >>of a hundred of them? Is there a clever way to instantiate a hundred >>objects of a particular class? > > > my @foo; > foreach my $name (qw/tut ankh amun/) { > push @foo, MyPackage->new($name); > } > > > or > > my @setup = ( > { > name => "tut", > ... => ..., > }, > { > name => "ankh", > ... => ..., > }, > { > name => "amun", > ... => ..., > }, > ); # data probably generated in some useful form elsewhere. > > my @foo; > foreach my $details (@setup) { > push @foo, MyPackage->new(%$details); # assuming named parameters > } > > > If you need an array of 100, or 50, or even 4, this is as good a method as any. > Thanks all, this is for a gameboard situation where the array, is the array of cells on the gameboard. Like a calculator app has lots of button objects, the gameboard has a lot of cell objects which I plan to hold references to in an array. Grant says that the constructor returns a reference, and that makes it easier. I might just build the array on the fly, when needed. Thanks again everyone. I'm off to read 'perltoot' again to see if it now makes more sense to me! Cheers, Cliff -- http://barzoomian.blogspot.com From grant at mclean.net.nz Sun Mar 12 12:45:16 2006 From: grant at mclean.net.nz (Grant McLean) Date: Mon, 13 Mar 2006 09:45:16 +1300 Subject: [Wellington-pm] Meeting tomorrow night Message-ID: <1142196316.15988.3.camel@localhost.localdomain> Hi Mongers As announced last week, the Wellington Perl Mongers schedule has changed to Tuesday. So this month's meeting is tomorrow night (not tonight): 6:00pm Tuesday 14 March 2006 Level 2, Eagle Technology House 150 Willis Street Wellington We have two talks lined up: Finlay Thompson will be talking about higher order programming and why it's all too hard in Perl. Grant McLean will be running through a real-world data munging exercise. This talk is aimed at the beginner to intermediate level and will contain practical examples and advice. Regards Grant From enkidu at cliffp.com Tue Mar 14 11:51:44 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Wed, 15 Mar 2006 08:51:44 +1300 Subject: [Wellington-pm] GTK2 - labels on buttons Message-ID: <44171ED0.2010403@cliffp.com> Researching some GTK2 stuff I came across an article by one Grant McLean about GTK2-Perl/GladeXML: http://live.gnome.org/GTK2-Perl/GladeXML/Tutorial Well done Grant and thanks! But, there's always a but, I want to change the labels on an existing GTK2 button. Any ideas on that one, anyone? Say it says "Click Here". I want it to basically toggle to say something like "Clicked" (and possibly change the style.....) Cheers. Cliff -- http://barzoomian.blogspot.com From grant at mclean.net.nz Tue Mar 14 12:37:37 2006 From: grant at mclean.net.nz (Grant McLean) Date: Wed, 15 Mar 2006 09:37:37 +1300 Subject: [Wellington-pm] GTK2 - labels on buttons In-Reply-To: <44171ED0.2010403@cliffp.com> References: <44171ED0.2010403@cliffp.com> Message-ID: <1142368657.6689.12.camel@localhost.localdomain> On Wed, 2006-03-15 at 08:51 +1300, Cliff Pratt wrote: > Researching some GTK2 stuff I came across an article by one Grant McLean > about GTK2-Perl/GladeXML: > > http://live.gnome.org/GTK2-Perl/GladeXML/Tutorial > > Well done Grant and thanks! You're welcome. > But, there's always a but, I want to change the labels on an existing > GTK2 button. Any ideas on that one, anyone? The documentation for all the widgets is here: http://gtk2-perl.sourceforge.net/doc/pod/ For the Gtk2::Button widget specifically, it's here: http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/Button.html The set_label method is the one you're after. You can either pass it a plain string, or a widget object (typically a label) that you want displayed on the button. > Say it says "Click Here". I want it to basically toggle to say something > like "Clicked" (and possibly change the style.....) You might want to look at using a Gtk2::ToggleButton instead, when pressed, it stays in until pressed again. http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/ToggleButton.html Changing style is a little more complicated. Pango is a markup language (a bit like HTML) for styling text on Gtk labels. To use Pango you need to call set_markup rather than set_label and you need to call the method on the label object contained in the button rather than on the button itself. You can get the label object from a button using the get_child method (which Gtk2::Button inherits from Gtk2::Bin). That was a very dense paragraph, so an example might help clarify things: #!/usr/bin/perl use strict; use warnings; use Gtk2 -init; use Glib qw(TRUE FALSE); my($count1, $count2) = (0, 0); my $app_win = Gtk2::Window->new; $app_win->signal_connect(destroy => sub { Gtk2->main_quit; }); my $table = Gtk2::Table->new(2, 2, TRUE); my $button1 = Gtk2::Button->new_with_label('Left'); $button1->signal_connect(clicked => \&button1_on_click); $table->attach($button1, 0, 1, 0, 1, ['expand', 'fill'], ['fill'], 4, 2); my $button2 = Gtk2::Button->new_with_label('Right'); $button2->signal_connect(clicked => \&button2_on_click); $table->attach($button2, 1, 2, 0, 1, ['expand', 'fill'], ['fill'], 4, 2); my $label = Gtk2::Label->new('Click a button'); $table->attach($label, 0, 2, 1, 2, ['expand', 'fill'], ['fill'], 4, 2); $app_win->add($table); $app_win->show_all; Gtk2->main; exit; sub button1_on_click { my($button) = @_; $label->set_label("Left button clicked"); $button->set_label(sprintf("Left (%d)", ++$count1)); } sub button2_on_click { my($button) = @_; $label->set_label("Right button clicked"); my $button_label = $button->get_child; if($count2 % 2) { # Odd or even? $button_label->set_markup( sprintf("Right (%d)", ++$count2) ); } else { $button_label->set_markup( sprintf( 'Right' . ' (%d)', ++$count2 ) ); } } Cheers Grant From grant at mclean.net.nz Tue Mar 14 12:39:59 2006 From: grant at mclean.net.nz (Grant McLean) Date: Wed, 15 Mar 2006 09:39:59 +1300 Subject: [Wellington-pm] GTK2 - labels on buttons In-Reply-To: <1142368657.6689.12.camel@localhost.localdomain> References: <44171ED0.2010403@cliffp.com> <1142368657.6689.12.camel@localhost.localdomain> Message-ID: <1142368799.6689.15.camel@localhost.localdomain> On Wed, 2006-03-15 at 09:37 +1300, Grant McLean wrote: > On Wed, 2006-03-15 at 08:51 +1300, Cliff Pratt wrote: > > Say it says "Click Here". I want it to basically toggle to say something > > like "Clicked" (and possibly change the style.....) ... > Pango is a markup language (a bit like HTML) for styling text on Gtk labels. Sorry, forgot to include the link ... http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html It's always hard to find when I need it. Grant From grant at mclean.net.nz Tue Mar 14 13:23:57 2006 From: grant at mclean.net.nz (Grant McLean) Date: Wed, 15 Mar 2006 10:23:57 +1300 Subject: [Wellington-pm] Roundup of last night's meeting Message-ID: <1142371437.6689.27.camel@localhost.localdomain> Hi Mongers Thanks to everyone for showing up and making it a lively and fun meeting. The speakers' slides are up on the web site: http://wellington.pm.org/archive/ Anyone who was interested in the XPath usage might like to check out the XPath tutorial and examples at zvon.org: http://www.zvon.org/xxl/XPathTutorial/General/examples.html In the examples, you can click on the 'Open the example in XLab' links to get an interactive screen for typing in XPath expressions and seeing what they match. The next meeting will be on Tuesday April 11th. It's great to have two speakers lined up already (thanks Sam and Andrew) and I'm sure we're all looking forward to hearing what Srdjan is going to talk about at the May meeting. Cheers Grant From sam at vilain.net Tue Mar 14 15:24:51 2006 From: sam at vilain.net (Sam Vilain) Date: Wed, 15 Mar 2006 12:24:51 +1300 Subject: [Wellington-pm] Parrot "Faster than C" Message-ID: <441750C3.5040105@vilain.net> It was briefly mentioned last night that there is a benchmark for which the parrot implementation outperforms the C implementation. Here is the original post from Leo: http://www.nntp.perl.org/group/perl.perl6.internals/32924 This is apparently the "ackermann benchmark" In Python: http://svn.perl.org/parrot/trunk/examples/shootout/ack.py This followup clarifies it a little: http://www.nntp.perl.org/group/perl.perl6.internals/32958 The "unoptimised version" of the PIR that he refers to in the e-mail is at: http://svn.perl.org/parrot/trunk/examples/shootout/ack.pir Sam. From dave at thinktank.co.nz Tue Mar 14 16:43:44 2006 From: dave at thinktank.co.nz (Dave Moskovitz) Date: Wed, 15 Mar 2006 13:43:44 +1300 Subject: [Wellington-pm] Parrot "Faster than C" In-Reply-To: <441750C3.5040105@vilain.net> References: <441750C3.5040105@vilain.net> Message-ID: <200603151343.44388.dave@thinktank.co.nz> Forgive me a quick trip down memory lane here ... As a CS student in the late 1970's, I was devastated when code generated by the PL/I optimising complier beat my assembler language implementation of a prime number generator. Nice to know that these things work the way they're supposed to! On Wednesday 15 Mar 2006 12:24, Sam Vilain wrote: > It was briefly mentioned last night that there is a benchmark for which > the parrot implementation outperforms the C implementation. > -- Dave Moskovitz Director, Thinktank Consulting Limited dave at thinktank.co.nz / Tel +64 27 220 2202 From michael at diaspora.gen.nz Tue Mar 14 17:19:09 2006 From: michael at diaspora.gen.nz (michael@diaspora.gen.nz) Date: Wed, 15 Mar 2006 14:19:09 +1300 (NZDT) Subject: [Wellington-pm] Parrot "Faster than C" In-Reply-To: <441750C3.5040105@vilain.net> References: <441750C3.5040105@vilain.net> Message-ID: <53908.202.37.32.2.1142385549.squirrel@israel.diaspora.gen.nz> > It was briefly mentioned last night that there is a benchmark for which > the parrot implementation outperforms the C implementation. >From the looks of the code posted, this comes more down to 'gcc doesn't do tail call optimization' than any real statement about the Parrot VM. -- michael. From douglas at paradise.net.nz Tue Mar 14 18:21:44 2006 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Wed, 15 Mar 2006 15:21:44 +1300 Subject: [Wellington-pm] Perl 5 faster than C In-Reply-To: <441750C3.5040105@vilain.net> References: <441750C3.5040105@vilain.net> Message-ID: <44177A38.1070600@paradise.net.nz> ... with Memoize Just to pick up on something else Grant mentioned last night. -------- #!/usr/bin/perl use Memoize; #cut, paste, search, replace from C version -- no perlish optimisation sub ack { my ($m, $n) = @_; return ($m ? (ack($m - 1, $n ? ack($m, ($n - 1)) : 1)) : $n + 1); } memoize('ack'); print ack(3, 11); -------- $ time perl ack.pl 16381 real 0m0.810s user 0m0.736s sys 0m0.024s $ time ./ack34 11 #the C version, compiled with gcc-3.4 Ack(3,11): 16381 real 0m1.802s user 0m1.752s sys 0m0.004s $ time perl ack-no-memoize.pl # (cup of tea time) # arrive back to sound of swapping # ^C^C real 8m31.296s user 6m37.961s sys 0m4.268s douglas From sam at vilain.net Tue Mar 14 18:28:58 2006 From: sam at vilain.net (Sam Vilain) Date: Wed, 15 Mar 2006 15:28:58 +1300 Subject: [Wellington-pm] Perl 5 faster than C In-Reply-To: <44177A38.1070600@paradise.net.nz> References: <441750C3.5040105@vilain.net> <44177A38.1070600@paradise.net.nz> Message-ID: <44177BEA.5050001@vilain.net> Douglas Bagnall wrote: >... with Memoize > >Just to pick up on something else Grant mentioned last night. > > > Hey, According to http://www.xgc.com/benchmarks/benchmarks.htm, The Ackermann benchmark program focuses on function calls. Using a clever yet simple formula, the Ackermann benchmark is able to execute millions of non-redundant calls, while using a modest amount of stack space. We always time a call of 'ackermann (3,6)'. Years ago this would execute in a time we could measure with a stopwatch. Modern computers are much faster, and in most cases the time will be much less than one second. For comparison, a VAX 780 (circa 1980) programmed in VAX Pascal, scores 6 seconds. The source is here . If Memoize helps that much, I guess the "non-redundant calls" bit is inaccurate... Of course the parrot implementation does not 'cheat' in this way :-). Those are real function calls. Sam. From douglas at paradise.net.nz Tue Mar 14 19:27:51 2006 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Wed, 15 Mar 2006 16:27:51 +1300 Subject: [Wellington-pm] Perl 5 faster than C In-Reply-To: <44177BEA.5050001@vilain.net> References: <441750C3.5040105@vilain.net> <44177A38.1070600@paradise.net.nz> <44177BEA.5050001@vilain.net> Message-ID: <441789B7.5020203@paradise.net.nz> Sam Vilain wrote: > Douglas Bagnall wrote: >>... with Memoize > > According to http://www.xgc.com/benchmarks/benchmarks.htm, I found the idea here: http://en.wikipedia.org/wiki/Ackermann_function#Use_as_benchmark For example, a compiler which, in analyzing the computation of A(3, 30), is able to save intermediate values like the A(3, n) and A(2, n) in that calculation rather than recomputing them, can speed up computation of A(3, 30) by a factor of hundreds of thousands. btw, Wikipedia has a link to http://shootout.alioth.debian.org/benchmark.php?test=ackermann&lang=all&sort=fullcpu and from there a little program that memoises by poking results into an array with '||=': http://shootout.alioth.debian.org/benchmark.php?test=ackermann&lang=perl&id=3 ------------ sub Ack { $_[0] ? ($Ack[$_[0]][$_[1]] ||= $_[1] ? Ack($_[0]-1, Ack($_[0], $_[1]-1)) : Ack($_[0]-1, 1)) : $_[1]+1; } ------------ $ time perl ack-array.pl 11 Ack(3,11): 16381 real 0m0.202s user 0m0.080s sys 0m0.000s (vs 0.8/0.8 for the Memoize version). For people without built in perl parsers, $_[0] ? checks whether the first parameter is zero or not. If it isn't, it looks at $Ack[$_[0]][$_[1]], which implicitly declares and indexes into a 2 dimensional array (@Ack). ||= tests whether the indexed value is there, and if not, fills it from the appropriate call to Ack. If $_[0] was zero, it evaluates the $_[1]+1. In either case, the answer found falls out the bottom as a return value. Of course this is cheating, but that's what perl is for. douglas From enkidu at cliffp.com Mon Mar 20 13:22:12 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Tue, 21 Mar 2006 09:22:12 +1200 Subject: [Wellington-pm] A question about scopes Message-ID: <441F1D04.3090608@cliffp.com> Say I have a Package and a PERL script. If the package uses a variable $foo, and so does the script, I should be able to access the script's version of $foo by $main::foo in the package. Am I correct? If $bar is defined in a sub in the package (eg my $bar), its scope is just the sub, isn't it? How do I make the scope "global" to the package so that any sub can find it? (I know "global" is not technically correct here) Define it outside any subs in the package? Does code outside a sub in a package ever get executed? If I make $bar "global" to the package, is there a clever way of avoiding qualifying it all the time to distinguish it from the script's version of $bar? Cheers, Cliff -- http://barzoomian.blogspot.com From grant at mclean.net.nz Mon Mar 20 14:02:20 2006 From: grant at mclean.net.nz (Grant McLean) Date: Tue, 21 Mar 2006 10:02:20 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <441F1D04.3090608@cliffp.com> References: <441F1D04.3090608@cliffp.com> Message-ID: <1142892140.20773.20.camel@localhost.localdomain> On Tue, 2006-03-21 at 09:22 +1200, Cliff Pratt wrote: > Say I have a Package and a PERL script. If the package uses a variable > $foo, and so does the script, I should be able to access the script's > version of $foo by $main::foo in the package. Am I correct? Yes (assuming the script didn't declare a package name) but that would be a bit dodgy. If your package needs some data from your script then your script should pass it in as an argument to a subroutine. > If $bar is defined in a sub in the package (eg my $bar), its scope is > just the sub, isn't it? Yes, it can only be accessed from that sub or anything that has been passed a reference to it (eg: if the sub returned a reference). > How do I make the scope "global" to the package > so that any sub can find it? (I know "global" is not technically correct > here) Define it outside any subs in the package? Yes, a 'my' variable declared (by convention) at the start of a package will be visible to all code in the file (including other packages defined in the same file). A 'my' variable will not be visible from outside it's scope. Fully qualified names like $Package::var are for global variables, not lexically scoped 'my' variables. > Does code outside a sub in a package ever get executed? Yes. When the package is first 'use'd or 'require'd, all code in the file will be compiled and then the bare lines (typically variable initialisation) will be executed. > If I make $bar "global" to the package, is there a clever way of > avoiding qualifying it all the time to distinguish it from the script's > version of $bar? I'm not sure what you're asking here. Perl has all sorts of clever tricks for aliasing variables (or subs) and importing them from one package into another. But you should almost never do that. Perhaps if we saw some of your real code, we might understand your intent more clearly. Regards Grant From grant at mclean.net.nz Mon Mar 20 15:25:11 2006 From: grant at mclean.net.nz (Grant McLean) Date: Tue, 21 Mar 2006 11:25:11 +1200 Subject: [Wellington-pm] Books Received Today Message-ID: <1142897111.20773.28.camel@localhost.localdomain> Hi Mongers The kind folks at O'Reilly have just sent us a couple of books. If you want to borrow one, drop me a line ... Mastering Regular Expressions, Second Edition By Jeffrey E. F. Friedl http://www.oreilly.com/catalog/regex2/ Wicked Cool Perl Scripts By Steve Oualline http://www.oreilly.com/catalog/1593270623/ The latter book may win a prize for the most off-putting title but it does include a script for downloading the latest Dilbert cartoon. Cheers Grant From srdjan at catalyst.net.nz Mon Mar 20 15:32:54 2006 From: srdjan at catalyst.net.nz (Srdjan) Date: Tue, 21 Mar 2006 11:32:54 +1200 Subject: [Wellington-pm] Books Received Today In-Reply-To: <1142897111.20773.28.camel@localhost.localdomain> References: <1142897111.20773.28.camel@localhost.localdomain> Message-ID: <441F3BA6.9040005@catalyst.net.nz> > Wicked Cool Perl Scripts > By Steve Oualline > http://www.oreilly.com/catalog/1593270623/ > > The latter book may win a prize for the most off-putting title but it > does include a script for downloading the latest Dilbert cartoon. Wicked! I guess it's OK as long as we keep it real. S. > > Cheers > Grant > > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm > > From enkidu at cliffp.com Tue Mar 21 01:39:40 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Tue, 21 Mar 2006 21:39:40 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <1142892140.20773.20.camel@localhost.localdomain> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> Message-ID: <441FC9DC.3000206@cliffp.com> Grant McLean wrote: > >>If I make $bar "global" to the package, is there a clever way of >>avoiding qualifying it all the time to distinguish it from the script's >>version of $bar? > > I'm not sure what you're asking here. > > Perl has all sorts of clever tricks for aliasing variables (or subs) and > importing them from one package into another. But you should almost > never do that. > > Perhaps if we saw some of your real code, we might understand your > intent more clearly. > Sorry, I didn't mean to be obscure! I've actually solved the problem. I have a little game/puzzle thing written in perl, outputting to the command line. I decided to update it and change it to use GTK2. I keep the game information in a list of 'elements' which I called @grid. When I started to write the GTK2 stuff I used the same name, @grid. To save rewriting I decided to make the old program into a package and 'use' it in the GTK2 script. So now I'm learning GTK2 *and* how to write packages.... Erm, anyway, say the main script is like this: use MyGame ; . my @grid ; . . # Recent change - I now pass the grid to the packaged sub and # return it when modified. @grid = MyGame::sub1(@grid) ; . . The package is like this: . package MyGame; # Recent change - This now outside any sub. my @grid ; sub sub1 { # @grid, but which one? @grid = @_ ; . return @grid ; } And it compiles fine. The problem was that the @grid list was defined inside a sub, so was local to the sub. Duh! I should've spotted that! Now to see if it works.... Cheers, Cliff -- http://barzoomian.blogspot.com From grant at mclean.net.nz Tue Mar 21 02:48:48 2006 From: grant at mclean.net.nz (Grant McLean) Date: Tue, 21 Mar 2006 22:48:48 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <441FC9DC.3000206@cliffp.com> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> Message-ID: <1142938128.8058.9.camel@localhost.localdomain> On Tue, 2006-03-21 at 21:39 +1200, Cliff Pratt wrote: > Erm, anyway, say the main script is like this: > > use MyGame ; > . > my @grid ; > . > . > # Recent change - I now pass the grid to the packaged sub and > # return it when modified. > @grid = MyGame::sub1(@grid) ; To save all the copying back and forth, you could pass a reference to @grid which would allow the module to modify the array back in the script: MyGame::sub1(\@grid); Then you could learn Gtk2, packages *AND* references. > . > . > > The package is like this: > . > package MyGame; > > # Recent change - This now outside any sub. > my @grid ; > > sub sub1 { > # @grid, but which one? > @grid = @_ ; You could grab the reference like this: ($grid) = @_; And then refer to an element in the referenced array: print $grid->[0]; Or loop over all the elements: foreach my $item (@$grid) { > . > return @grid ; > } But it does sound like your module would benefit from being turned into an object. That way you wouldn't need the global for @grid - you'd store the reference in the object where it would be available to all methods. And if you instantiated two objects, they'd each have their own grid. As you know from my Glade article, I like to arrange for Gtk GUI events to call methods on my object(s). That way all the necessary state information is available in the object without having to use globals. That would have the added advantage that you could learn Gtk2, packages *AND* references *AND* objects *AND* closures :-) Cheers Grant From andrew.boag at catalyst.net.nz Tue Mar 21 13:48:02 2006 From: andrew.boag at catalyst.net.nz (Andrew Boag) Date: Wed, 22 Mar 2006 09:48:02 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <1142938128.8058.9.camel@localhost.localdomain> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <1142938128.8058.9.camel@localhost.localdomain> Message-ID: <1142977683.2320.9.camel@192.168.2.18> So does this mean Cliff is up for throwing together an "Authoring Perl Packages" talk ??? That would be a great topic for a future meeting. On Tue, 2006-03-21 at 22:48 +1200, Grant McLean wrote: > On Tue, 2006-03-21 at 21:39 +1200, Cliff Pratt wrote: > > Erm, anyway, say the main script is like this: > > > > use MyGame ; > > . > > my @grid ; > > . > > . > > # Recent change - I now pass the grid to the packaged sub and > > # return it when modified. > > @grid = MyGame::sub1(@grid) ; > > To save all the copying back and forth, you could pass a reference to > @grid which would allow the module to modify the array back in the > script: > > MyGame::sub1(\@grid); > > Then you could learn Gtk2, packages *AND* references. > > > . > > . > > > > The package is like this: > > . > > package MyGame; > > > > # Recent change - This now outside any sub. > > my @grid ; > > > > sub sub1 { > > # @grid, but which one? > > @grid = @_ ; > > You could grab the reference like this: > > ($grid) = @_; > > And then refer to an element in the referenced array: > > print $grid->[0]; > > Or loop over all the elements: > > foreach my $item (@$grid) { > > > . > > return @grid ; > > } > > But it does sound like your module would benefit from being turned into > an object. That way you wouldn't need the global for @grid - you'd > store the reference in the object where it would be available to all > methods. And if you instantiated two objects, they'd each have their > own grid. > > As you know from my Glade article, I like to arrange for Gtk GUI events > to call methods on my object(s). That way all the necessary state > information is available in the object without having to use globals. > > That would have the added advantage that you could learn Gtk2, packages > *AND* references *AND* objects *AND* closures :-) > > Cheers > Grant > > > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm > From dave at thinktank.co.nz Thu Mar 23 19:26:37 2006 From: dave at thinktank.co.nz (Dave Moskovitz) Date: Fri, 24 Mar 2006 15:26:37 +1200 Subject: [Wellington-pm] Is Perl being overtaken by Ruby? Message-ID: <200603241526.37934.dave@thinktank.co.nz> Lies, damn lies, and statistics. http://www.alexa.com/data/details/traffic_details?&range=3m&size=large&compare_sites=ruby-lang.org&y=r&url=perl.org OK, you don't trust Big Brother Alexa. On del.icio.us, the top three sites with 'perl' as their first tag have been saved by 751, 659, and 411 people. Compare that to Ruby, and you get 3946, 3423, and 3260. Or are the type of people who use a service like del.icio.us less likely to be Perl hackers for some reason? Are we witnessing the tipping point? -- Dave Moskovitz Director, Thinktank Consulting Limited dave at thinktank.co.nz / Tel +64 27 220 2202 From grant at mclean.net.nz Thu Mar 23 20:10:39 2006 From: grant at mclean.net.nz (Grant McLean) Date: Fri, 24 Mar 2006 16:10:39 +1200 Subject: [Wellington-pm] Is Perl being overtaken by Ruby? In-Reply-To: <200603241526.37934.dave@thinktank.co.nz> References: <200603241526.37934.dave@thinktank.co.nz> Message-ID: <1143173439.8255.20.camel@localhost.localdomain> On Fri, 2006-03-24 at 15:26 +1200, Dave Moskovitz wrote: > Lies, damn lies, and statistics. > > http://www.alexa.com/data/details/traffic_details?&range=3m&size=large&compare_sites=ruby-lang.org&y=r&url=perl.org > > OK, you don't trust Big Brother Alexa. > > On del.icio.us, the top three sites with 'perl' as their first tag have been > saved by 751, 659, and 411 people. Compare that to Ruby, and you get 3946, > 3423, and 3260. Or are the type of people who use a service like del.icio.us > less likely to be Perl hackers for some reason? > > Are we witnessing the tipping point? Without trying to answer those questions specifically, here are some related thoughts: Ruby is a very nice language. I enjoy coding in Ruby. I don't enjoy not having CPAN available. There are lots of Ruby class libraries available but they're harder to locate and install than the CPAN equivalents. Unfortunately, the Ruby Gem packaging system has been deemed incompatible with packaging systems like deb and rpm, which leads to even less convenience. The huge hype around Ruby in the last 12 months or so has been fuelled by a couple of big things: * Ruby on Rails - it is good, and combined with Ajax it can produce very polished web apps * A number of influential Java developers have 'discovered' Ruby and found that it really is easier to develop web applications using a dynamic language than it is using J2EE, Spring etc. Well duh! These Java guys would never ever admit that almost all of the good things they like about Ruby are also available in Perl and have been for many years. Perl is not even on their radar because it is "ugly", "unmaintainable" and suitable only for "quick little hacks". Oh well, that's their loss. James Gosling (inventor of Java) doesn't see Ruby as a threat to Java though because Java is a general purpose programming language whereas Ruby is "only for generating web pages": http://java.sys-con.com/read/193146.htm Cheers Grant From enkidu at cliffp.com Sun Mar 26 01:50:35 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Sun, 26 Mar 2006 21:50:35 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <1142938128.8058.9.camel@localhost.localdomain> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <1142938128.8058.9.camel@localhost.localdomain> Message-ID: <442663EB.6030108@cliffp.com> Grant McLean wrote: [snipped stuff that is no longer relevant] > > But it does sound like your module would benefit from being turned > into an object. That way you wouldn't need the global for @grid - > you'd store the reference in the object where it would be available > to all methods. And if you instantiated two objects, they'd each > have their own grid. > > As you know from my Glade article, I like to arrange for Gtk GUI > events to call methods on my object(s). That way all the necessary > state information is available in the object without having to use > globals. > > That would have the added advantage that you could learn Gtk2, > packages *AND* references *AND* objects *AND* closures :-) > I think my brain just exploded..... Well, I'm objectifying my programs/packages and I've got to the point where the program can call a couple of methods (including a constructor) on an object. I've hit a snag, though when trying to write what might be called 'internal' or 'private' subs in the package. In the snippets below sub calc_move is a method of foo. It calls check_element which is not called from outside of Package foo. What's the best way of getting access to the object data from within check_element, which is not an object method call. Or maybe it is. I feel that I'm missing something obvious... Package foo; . . sub new { # Current object is a hash to a list of elements: # $hash = { GRID => @grid } ; # my $class = shift ; my $self = {} ; $self->{GRID} = [] ; for ($i = 0 ; $i < 81 ; $i++) { $self->{GRID}[$i] = 'aaa' ; } bless $self, $class ; } sub grid { # This method gives access to the @grid array. my $self = shift ; if (@_) { @{$self->{GRID}} = @_ } return @{$self->{GRID}} ; } sub calc_move { # Calculate next move my $self = shift ; my $i ; for ($i = 0; $i < 81 ; $i++) { check_element($i) ; } } sub check_element { my $element = shift ; . . } Cheers, Cliff -- http://barzoomian.blogspot.com From jarich at perltraining.com.au Sun Mar 26 03:09:34 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sun, 26 Mar 2006 21:09:34 +1000 Subject: [Wellington-pm] A question about scopes In-Reply-To: <442663EB.6030108@cliffp.com> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <1142938128.8058.9.camel@localhost.localdomain> <442663EB.6030108@cliffp.com> Message-ID: <4426766E.3020402@perltraining.com.au> Cliff Pratt wrote: > Well, I'm objectifying my programs/packages and I've got to the point > where the program can call a couple of methods (including a constructor) > on an object. I've hit a snag, though when trying to write what might be > called 'internal' or 'private' subs in the package. In the snippets > below sub calc_move is a method of foo. It calls check_element which is > not called from outside of Package foo. What's the best way of getting > access to the object data from within check_element, which is not an > object method call. Or maybe it is. I feel that I'm missing something > obvious... private methods are usually preceded by an underscore: _check_element. They're still methods and are called and act the same way, but they're not typically documented as part of the API. > sub calc_move { > # Calculate next move > my $self = shift ; > my $i ; > for ($i = 0; $i < 81 ; $i++) { > # check_element($i) ; $self->_check_element($i); > } > } > > sub _check_element { my $self = shift; > my $element = shift ; > . > . > } Of course, if _check_element doesn't *need* to know anything about the object, (that is, it's not a method) then it's just a regular subroutine and you'd call and define it as such (which is what you had done). private methods rely on programmers behaving because it's polite, not because you force them to do so. There's some quote here about a shot-gun, but I can't remember it off the top of my head. This would apply too to private subs. After all, the programmer usually has access to your source code when they "use" your module, so they can break any strictures you set up anyway. All the best, Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From jarich at perltraining.com.au Sun Mar 26 04:23:20 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sun, 26 Mar 2006 22:23:20 +1000 Subject: [Wellington-pm] A question about scopes In-Reply-To: <441F1D04.3090608@cliffp.com> References: <441F1D04.3090608@cliffp.com> Message-ID: <442687B8.6020403@perltraining.com.au> G'day Cliff, I don't know how useful you'd find it, but we cover scoping and scopes in our Introduction and Intermediate Perl course notes, available at http://perltraining.com.au/notes.html Scope itself is covered in the Intro Conditionals chapter, with further coverage when we get to Modules and Packages in the Intermediate course. Cliff Pratt wrote: > Say I have a Package and a PERL script. It's "Perl" typically. ;) > If the package uses a variable > $foo, and so does the script, I should be able to access the script's > version of $foo by $main::foo in the package. Am I correct? Consider the following case: --------------------------------------------------- #!/usr/bin/perl -w use strict; my $foo = 4; # $foo in the main package my $bar = 10; # $bar in the main package print "$foo\n"; # prints "4". if(1) { my $foo = 1; # $foo in the main package, but over-shadows previous $foo++; print "$foo\n"; # prints "2" } print "$foo\n"; # still prints "4" package bar; my $foo = 7; # $foo in the bar package (generates warning if in same file as above code) print "$foo\n"; # prints "7". print $main::foo; # undefined! print $main::bar; # undefined! print "$bar\n"; # prints "10" but only if this is all in the same file --------------------------------------------------- $main::foo is undefined because $foo was declared with "my". Declaring a variable with "my" means that it lasts from that location to the end of the enclosing block ( } or end of tile ). "my" variables are not "package" variables, but are rather lexical variables. If we separate the above code into two files we can see this more clearly. --------------------------------------------------- ### main.pl #!/usr/bin/perl -w use strict; require 'bar.pl'; # for example... usually "use bar;" my $foo = 4; # $foo in the main package my $bar = 10; # $bar in the main package print "$foo\n"; # prints "4". if(1) { my $foo = 1; # $foo in the main package, but over-shadows previous # This is *not* the same variable as $foo above. $foo++; print "$foo\n"; # prints "2" } print "$foo\n"; # still prints "4" --------------------------------------------------- ### bar.pl package bar; my $foo = 7; # $foo in the bar package print "$foo\n"; # prints "7". print $main::foo; # undefined! print $main::bar; # undefined! #print "$bar\n"; # no $bar defined in this scope --------------------------------------------------- In the above example, there is no way that the code in package bar can access the $bar declared in main.pl. Likewise, there is no way for the main package to access the $foo declared in bar.pl. > If $bar is defined in a sub in the package (eg my $bar), its scope is > just the sub, isn't it? Yes. > How do I make the scope "global" to the package > so that any sub can find it? (I know "global" is not technically correct > here) Define it outside any subs in the package? Yes. Although you may not actually need to do this. > Does code outside a sub > in a package ever get executed? Yes, it gets compiled and executed as soon as Perl sees it either "use"d or "require"d. "use bar;" is essentially the same as: BEGIN { require "bar.pl"; bar::import(); } so that it goes off before all other code compilation and execution. > If I make $bar "global" to the package, is there a clever way of > avoiding qualifying it all the time to distinguish it from the script's > version of $bar? If you declare $bar in the top level scope, within a package, then you can refer to it as $bar within that package where-ever you need to refer to it -- Just as I did with $foo in the two examples. This is regardless of whether you declared it as a lexical variable or as a shared (global) variable. All the best, Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From jarich at perltraining.com.au Sun Mar 26 04:34:06 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sun, 26 Mar 2006 22:34:06 +1000 Subject: [Wellington-pm] A question about scopes In-Reply-To: <441FC9DC.3000206@cliffp.com> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> Message-ID: <44268A3E.4020204@perltraining.com.au> Cliff Pratt wrote: ------------------------------------- > use MyGame ; > . > my @grid ; > . > . > # Recent change - I now pass the grid to the packaged sub and > # return it when modified. > @grid = MyGame::sub1(@grid) ; ------------------------------------- > package MyGame; > > # Recent change - This now outside any sub. > my @grid ; > > sub sub1 { > # @grid, but which one? > @grid = @_ ; > . > return @grid ; > } ------------------------------------- In this particular case, I'd rewrite your code as follows: ------------------------------------- #!/usr/bin/perl -w # main.pl use strict; ... my @grid = MyGame::sub1(@grid) ; ... ------------------------------------- package MyGame; sub sub1 { my @grid = @_; # See below ... return @grid; } ------------------------------------- In this code, @grid is lexically scoped to sub1. This means that it only exists inside sub1. You could change its name to be @game_grid throughout that subroutine and the outside code should not be affected. Now having said that, if you need sub1 to set up the grid and then have that set-up grid be available to other functions in the package, then I'd recommend considering closures: ------------------------------------- package MyGame; { my @game_grid; sub sub1 { my @grid = @_; ... @game_grid = @grid; # explicit copy return @grid; } sub sub2_which_uses_game_grid { ... ... @game_grid ... ... } } sub sub3_which_doesnt_use_game_grid { ... } ------------------------------------- A closure works by limiting the scope of a lexical variable. In my example above, only sub1 and sub2_which_uses_game_grid can see the @game_grid variable. This makes the variable more "private" and hopefully reduces the chance that it gets changed unexpectedly. You'll notice that I still use lexical variables inside sub1 and then explicitly copy into @game_grid. This helps later programmers find where @game_grid gets set, and prevents them from either cutting and pasting your code and thus accidently over-writing the grid variable, or alternately assuming that you've made an error by not using "my" and breaking your code that way. I hope this helps. Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From michael at diaspora.gen.nz Sun Mar 26 15:16:48 2006 From: michael at diaspora.gen.nz (michael@diaspora.gen.nz) Date: Mon, 27 Mar 2006 11:16:48 +1200 (NZST) Subject: [Wellington-pm] Is Perl being overtaken by Ruby? In-Reply-To: <200603241526.37934.dave@thinktank.co.nz> References: <200603241526.37934.dave@thinktank.co.nz> Message-ID: <47875.202.37.32.2.1143415008.squirrel@israel.diaspora.gen.nz> > Lies, damn lies, and statistics. > On del.icio.us, the top three sites with 'perl' as their first tag have > been > saved by 751, 659, and 411 people. Compare that to Ruby, and you get > 3946, > 3423, and 3260. Or are the type of people who use a service like > del.icio.us > less likely to be Perl hackers for some reason? You're assuming a correlation between people using Perl, and people tagging Perl sites on del.icio.us. I'd assume that people tagging sites are interested in reading about or learning about the subject; I don't quite see how this correlates with people using Perl. As a different example, witness the amount of COBOL and REXX code still being created, and the lack of exciting sites about them :). Having said that, there's probably a derivative relationship; if the new language being learnt is preferentially Ruby, then presumably over time the Ruby using community will grow in size relative to the Perl using community, with a (presumably) equivalent growth in the amount of deployed code in Ruby vs Perl. -- michael. From grant at mclean.net.nz Mon Mar 27 13:16:57 2006 From: grant at mclean.net.nz (Grant McLean) Date: Tue, 28 Mar 2006 09:16:57 +1200 Subject: [Wellington-pm] [Fwd: Newsletter from O'Reilly UG Program, March 27] Message-ID: <1143494217.16286.0.camel@localhost.localdomain> -------- Forwarded Message -------- > From: Marsee Henon > Subject: Newsletter from O'Reilly UG Program, March 27 > Date: Mon, 27 Mar 2006 11:40:30 -0800 > ================================================================ > O'Reilly News for User Group Members > March 27, 2006 > ================================================================ > ---------------------------------------------------------------- > Book News > ---------------------------------------------------------------- > -Ajax Hacks > -Ableton Live 5 Tips and Tricks > -The Art of SQL > -Best of Ruby Quiz > -Don't Get Burned on eBay > -The eBay Price Guide > -Fixing Windows XP Annoyances > -Flash 8: Projects for Learning Animation and Interactivity > -Flash 8: The Missing Manual > -Google: The Missing Manual, Second Edition > -Head Rush Ajax > -How to Cheat at Managing Microsoft Operations Manager 2005 > -Intermediate Perl > -iPhoto 6: The Missing Manual > -iPod & iTunes: The Missing Manual > -ISS X-Force: Next Generation Threat Analysis and Prevention > -The JavaScript Anthology > -Mapping and Modding Half-Life 2 Complete > -Mind Performance Hacks > -Music Projects with Propellerhead Reason > -MySQL Stored Procedure Programming > -Photoshop CS2 RAW > -Practical VoIP Security > -Practices of an Agile Developer > -UML 2.0 Pocket Reference > -Visual Basic 2005 Express > -Visual C# 2005 Black Book > -Window Seat > -Write Great Code, Volume 2 > -XAML in a Nutshell > ---------------------------------------------------------------- > Upcoming Events > ---------------------------------------------------------------- > -Sebastian Bergmann("PHPUnit Pocket Guide"), PHP Usergroup Wurzburg, > Wurzburg, Bayern--Mar 30 > -Dan Gillmor ("We the Media"), Commonwealth Club, San Jose, CA--Mar 30 > -Digital Portfolios with Stephen Johnson ("Stephen Johnson on Digital > Photography"), Pacifica, CA--Apr 1 > -Visit O'Reilly at LinuxWorld--Boston, MA--Apr 4-6 > -Dan Gillmor ("We the Media"), Institute for Applied and Professional > Ethics, Athens, Ohio--Apr 7 > -Julieanne Kost ("Window Seat"), Wedding and Portrait Photographers, > International Convention, Las Vegas, NV--Apr 9 > -Robbie Allen ("Windows Server 2003 Security Cookbook"), the 58th Annual > Conference on World Affairs, Boulder, CO--Apr 10 > -O'Reilly authors at Exchange Connections 2006, Orlando, FL--Apr 10 > -Peter Krogh ("The DAM Book"), ASMP PixelCash Seminar, > Minneapolis, MN--Apr 11 > -Maker Faire, San Mateo, CA--Apr 22-23 > -Tony Bove ("Just Say No To Microsoft"), Cody's Books, > San Francisco, CA--April 12 > ---------------------------------------------------------------- > Conference News > ---------------------------------------------------------------- > -Where 2.0 Registration is Open > -MySQL Registration is Open > ---------------------------------------------------------------- > News > ---------------------------------------------------------------- > -Tim O'Reilly Quizzes Bill Gates at MIX06 > -O'Reilly Authors Get Jolted > -New Rough Cuts Title: Atlas > -Secure Your Linux Server > -Autofilled PHP Forms > -What Corporate Projects Should Learn from Open Source > -Digital Bookmark Mods > -Getting Started with Quartz Composer > -Using the MultiView and Wizard Controls in ASP.NET 2.0 > -Directions in Windows Scripting > -Profiting Without Frequently Updated Content > -Google Page Creator: When It Gets Too Hard > -Zero Configuration Networking: Using the Java APIs, Part 1 > -What Is Java? > -The Internet of Things > -The Future of Telephony, Going Digital, and Open Formats > -Managing Digital Images: Applying Ratings and Keywords > -Inside Animusic's Astonishing Computer Music Videos > -Screencast: Photoshop Starburst Effect > -Maker Faire, San Mateo Fairgrounds, San Mateo, CA--April 22-23 > ================================================ > Book News > ================================================ > Did you know you can request a free book to review for your > group? Ask your group leader for more information. > > For book review writing tips and suggestions, go to: > > > Don't forget, you can receive 30% off a single title or 35% off two or > more O'Reilly, No Starch, Paraglyph, PC Publishing, Pragmatic Bookshelf, > SitePoint, or Syngress books you purchase directly from O'Reilly. > Just use code DSUG when ordering online or by phone 800-998-9938. > > > ***Free ground shipping is available for online orders of at > least $29.95 that go to a single address. This offer > applies to US delivery addresses in the fifty states and Puerto Rico. > For more details, go to: > > > ---------------------------------------------------------------- > New Releases > ---------------------------------------------------------------- > ***Ajax Hacks > Publisher: O'Reilly > ISBN: 0596101694 > Want to build next-generation web applications today? This book can show > you how. A smart collection of 100 insider tips and tricks, "Ajax Hacks" > covers the finer points of Asynchronous JavaScript and XML, or Ajax as > it's known. Learn leading-edge web development tasks like how to display > Weather.com data, scrape stock quotes, fetch postal codes and much, much > more > > > > ***Ableton Live 5 Tips and Tricks > Publisher: PC Publishing > ISBN: 1870775090 > This book enables you to create your ideal Live 5 template; get the most > from Live's MIDI features; find audio editing workrounds within Live; > prepare a Live set for performance; use Live with other music software; > and includes interviews with high-profile Live users. > > > > ***The Art of SQL > Publisher: O'Reilly > ISBN: 0596008945 > Enterprises throughout the world are confronted with exploding volumes > of data, and many IT departments are looking for quick solutions. This > insightful book demonstrates that since SQL code may run for 5 to 10 > years, and run on different hardware, it must be fast and sound from the > start. Expert Stephane Faroult offers SQL best practices and relational > theory that force you to focus on strategy rather than specifics. > > > > ***Best of Ruby Quiz > Publisher: Pragmatic Bookshelf > ISBN: 0976694077 > Sharpen your Ruby programming skills with twenty-five challenging > problems from Ruby Quiz. Whether you have faithfully followed the weekly > online Ruby Quiz challenges or are just looking for some practical tests > of your Ruby skills, this book delivers. Read the problems, work out a > solution, and compare your solution with others. Read about the > interesting issues of each problem. Writing code and reading code are > still the only ways to truly gain skill with a programming language, and > within these pages you can do both quickly and easily. > > > > ***Don't Get Burned on eBay > Publisher: O'Reilly > ISBN: 0596101783 > Don't Get Burned on eBay offers relevant lessons based on real-life > stories posted on eBay's Answer Center. With sharp, witty rhetoric, > veteran eBay user Shauna Wright shows eBay veterans and newcomers alike > how to avoid those nasty scenarios, and how to pull themselves out of > the muck if they've already fallen in. > > > > ***The eBay Price Guide > Publisher: No Starch > ISBN: 1593270550 > A one-stop shop for pricing information and tips for successful buying > and selling on eBay. Sellers learn how to price their items > competitively to attract more customers, while buyers learn which > categories tend to be overpriced and where they can find the best > bargains. Fun stories, statistics, lists, and eBay trivia round out the > book. A must-have for the serious eBayer. > > > > ***Fixing Windows XP Annoyances > Publisher: O'Reilly > ISBN: 0596100531 > Inspired by author David Karp's "Windows XP Annoyances for Geeks," this > all-new tome pulls together tips, tricks, insider workarounds, and fixes > for PC novices and pros, in a handy, accessible Q&A format that lets you > find the solutions in a flash. "Fixing Windows XP Annoyances" will not > only increase your productivity, but lower your blood pressure. > > > > ***Flash 8: Projects for Learning Animation and Interactivity > Publisher: O'Reilly > ISBN: 0596102232 > This book teaches Flash design rather than simply Flash itself. With a > standalone series of walkthroughs and tutorials for Flash beginners > coming from a graphics field, Flash is covered in the context of > real-world projects. Rather than simply learn a Flash tool, > you learn which areas of Flash are important, and which are less so, > by seeing how typical content is actually created. And rather > than a text-heavy approach, this graphically rich book leads you through > hands-on examples by illustration. > > > > ***Flash 8: The Missing Manual > Publisher: O'Reilly > ISBN: 0596101376 > Macromedia's Flash 8 is the world's premier program for adding animation > to web sites. But Flash isn't intuitive. And it doesn't come with a > manual. This hands-on guide to today's hottest web design tool is aimed > at non-developers, and it teaches you how to translate your ideas into > great Web content. Whether you want to learn the basics or unleash the > program's true power, "Flash 8: The Missing Manual" is the ideal > instructor. > > > > ***Google: The Missing Manual, Second Edition > Publisher: O'Reilly > ISBN: 0596100191 > Sure, you know how to "Google it" when you're searching for something on > the Web. But did you know how much more you could achieve by clicking > beyond the "Google Search" button? Our fully updated and expanded > edition to "Google: The Missing Manual" covers everything you need to know > to become a Google guru--including all the new, cool, and often > overlooked features that make Google the world's best search engine. > > > > ***Head Rush Ajax > Publisher: O'Reilly > ISBN: 0596102259 > "Head Rush Ajax" takes the reader beyond basic web development with > DHTML and JavaScript and explains how asynchronous data requests and > more powerful event models can be used in the Ajax methodology > > > > ***How to Cheat at Managing Microsoft Operations Manager 2005 > Publisher: Syngress > ISBN: 1597492515 > Microsoft Operations Manager (MOM) is a network monitoring tool that > provides enterprise-class event and performance management for Windows > Server System technologies. MOM's event and performance management tools > discover problems before system administrators would ever find them, > thereby enabling administrators to lower their costs of operations and > simplify management of their Windows Server System infrastructure. MOM > can notify system administrators of overloaded processors, depleted > memory, or failed network connections affecting their Windows servers > long before these problems bother users. > > > > ***Intermediate Perl > Publisher: O'Reilly > ISBN: 0596102062 > Perl programmers need a clear roadmap for improving their skills. > "Intermediate Perl" teaches a working knowledge of Perl's objects, > references, and modules--all of which make the language so versatile > and effective. Written by the authors of the bestselling Llama book, > "Learning Perl," this guide offers a gentle but thorough introduction to > intermediate programming in Perl. Topics include packages and > namespaces, references and scoping, manipulating complex data > structures, writing and using modules, package implementation, and using > CPAN. > > > > ***iPhoto 6: The Missing Manual > Publisher: O'Reilly > ISBN: 059652725X > Along with its host of new features, iPhoto 6 can handle as many as > 250,000 images. It's incredible, and Apple makes it sound so easy. But > you can still get lost, especially if you're new to iPhoto. Not to > worry. The latest edition of this popular book gives you plenty of > undocumented tips & tricks for taking advantage of the new version and > every feature packed into it. > > > > ***iPod & iTunes: The Missing Manual > Publisher: O'Reilly > ISBN: 059652675X > An iPod is many things to many people, but it can be much more than most > people realize. That's where this new edition comes in. Like the iPod > itself, this book is a long-running bestseller with a wealth of useful > information for any iPod user. This edition features the new Video iPod, > iTunes 6, ways to use an iPod as an external drive or personal > organizer, and much more. > > > > ***ISS X-Force: Next Generation Threat Analysis and Prevention > Publisher: Syngress > ISBN: 1597490563 > Over the last seven years, Internet Security Systems (ISS) elite X-Force > has discovered more high-risk vulnerabilities than all other research > groups and vendors combined, including the vulnerability that led to the > recent, widespread Zotob worm. For the first time ever, follow the > X-Force team as they analyze potential vulnerabilities and security > solutions for cutting edge technologies and emerging attack > methodologies. > > > > ***The JavaScript Anthology > Publisher:SitePoint > ISBN: 0975240269 > The "JavaScript Anthology: 101 Essential Tips, Tricks, and Hacks" is a > compilation of customizable solutions to the most common JavaScript > questions and problems, including solutions using AJAX. All the code in > the book is thoroughly tested, best practice, and standards-compliant to > ensure that will work across different browsers and platforms. > > > > ***Mapping and Modding Half-Life 2 Complete > Publisher: Paraglyph > ISBN: 1933097132 > Modding is the new craze that has taken the gaming world by storm. And > Half-Life 2 provides the premier game engine that modders all around the > world are using to enhance the highly popular Half-Life game and create > exciting new custom game features. As many modders like to say, "The > possibilities are endless." This unique book shows all Half-Life 2 fans > everything they need to know to work with the powerful game engine and > customize their own games using clever mapping, modding, and modeling > techniques. With "Mapping and Modding Half-Life 2 Complete," game fans > will get a chance to progressively expand their skills at mapping and > modding. This is a one-of-a-kind book, jam-packed with insider tips and > techniques by a leading Half-Life 2 modding expert. > > > > ***Mind Performance Hacks > Publisher: O'Reilly > ISBN: 0596101538 > "Mind Performance Hacks" provides real-life tips and tools for > overclocking your brain and becoming a better thinker. In the > increasingly frenetic pace of today's information economy, managing your > life requires hacking your brain. With this book, you'll cut through the > clutter and tune up your brain intentionally, safely, and productively. > > > > ***Music Projects with Propellerhead Reason > Publisher: PC Publishing > ISBN: 1870775147 > Ideal for everyone from beginners to experienced users, the book covers > essentials like choosing a computer, setting it up for audio work and > optimizing Reason for maximum performance. It contains detailed > workshops on eight major musical genres--Hip Hop, Drum & Bass, Dub, > House, Techno, Trip Hop, Trance, and Club. > > > > ***MySQL Stored Procedure Programming > Publisher: O'Reilly > ISBN: 0596100892 > MySQL Stored Procedure Programming covers a lot of ground. The book > starts with a thorough introduction to stored procedures programming and > functions, covering the fundamentals of data types, operators, and using > SQL in stored procedures. You'll learn how to build and maintain stored > programs--covering transactions, stored functions, and triggers--and > how to call and use MySQL-based stored procedures in a variety of > languages, including PHP, Perl, Python, .NET, and Java. This book, > destined to be the bible of stored procedure development, is a resource > that no real MySQL programmer can afford to do without. > > > > ***Photoshop CS2 RAW > Publisher: O'Reilly > ISBN: 0596008511 > The RAW file format is the uncompressed data file captured by a digital > camera's electronic sensor. Because RAW files remain virtually untouched > by in-camera processing, working with them brings greater flexibility > and control to the editing process-if you know how to use them. Adobe > Photoshop CS2 has emerged as the best way to edit RAW images, and > Photoshop CS2 RAW is dedicated to working with RAW in Photoshop. This > comprehensive guide explores the entire RAW process, focusing > extensively on Photoshop editing techniques targeted to professionals > and photo hobbyists alike. > > > > ***Practical VoIP Security > Publisher: Syngress > ISBN: 1597490601 > After struggling for years, you finally think you've got your network > secured from malicious hackers and obnoxious spammers. Just when you > think it's safe to go back into the water, VoIP finally catches on. Now > your newly converged network is vulnerable to DoS attacks, hacked > gateways leading to unauthorized free calls, call eavesdropping, > malicious call redirection, and spam over Internet Telephony (SPIT). > This book details both VoIP attacks and defense techniques and tools. > > > > ***Practices of an Agile Developer > Publisher: Pragmatic Bookshelf > ISBN: 097451408X > These are the proven, effective agile practices that will make you a > better developer. You'll learn pragmatic ways of approaching the > development process and your personal coding techniques. You'll learn > about your own attitudes, issues with working on a team, and how to best > manage your learning, all in an iterative, incremental, agile style. > You'll see how to apply each practice, and what benefits you can expect. > Bottom line: this book will make you a better developer. > > > > ***UML 2.0 Pocket Reference > Publisher: O'Reilly > ISBN: 0596102089 > Globe-trotting travelers have long resorted to handy, pocket-size > dictionaries as an aid to communicating across the language barrier. Dan > Pilone's "UML 2.0 Pocket Reference" is just such an aid for on-the-go > developers who need to converse in the Unified Modeling Language (UML). > Use this book to decipher the many UML diagrams you'll encounter on the > path to delivering a modern software system. > > > > ***Visual Basic 2005 Express > Publisher: No Starch > ISBN: 1593270593 > A true guide for beginners, "Visual Basic 2005 Express" starts off with > a short primer on how programming works, regardless of the programming > language used. Once readers understand the general principles behind > computer programming, the book then teaches readers how to use the > Visual Basic Express program itself and how to write programs using the > Visual Basic language. > > > > ***Visual C# 2005 Black Book > Publisher: Paraglyph > ISBN: 1933097167 > "Visual C# 2005 Black Book" is one of the first books that presents in > detail the new specifications of the language at length. The book takes > the reader through the key changes to Visual Studio and the critical new > programming features of Visual C# 2005. Black Books provide a two-tiered > approach--the In-Depth sections provide full explanation of all aspects > of the technology and the Immediate Solutions section feature hands-on > information and troubleshooting techniques. > > > > ***Window Seat > Publisher: O'Reilly > ISBN: 0596100833 > "Window Seat: The Art of Digital Photography and Creative Thinking" is > a complete view of a creative project from the artist's perspective. > Julieanne Kost, a Photoshop and creative thinking guru, has taken her > own experience shooting images out of airplane windows to create a > unique seminar in three parts: a manifesto of ways to stay creatively > alive; a portfolio of stunning photographs, with commentaries describing > her experiences and thought process; and a technical appendix that > includes the details of the images were shot, manipulated, and prepared > for printing. > > > > ***Write Great Code, Volume 2 > Publisher: No Starch > ISBN: 1593270658 > The second volume in the "Write Great Code" series supplies critical > information that today's computer science students don't often get in > class: How to carefully choose their high-level language statements to > produce efficient code. The book teaches software engineers how > compilers translate high-level language statements and data structures > into machine code, so they can make informed choices and produce better > code without giving up any productivity and portability benefits. > > > > ***XAML in a Nutshell > Publisher: O'Reilly > ISBN: 0596526733 > The Windows Vista operating system will support applications that employ > clear, stunning and active graphics now used by computer games. The > cornerstone for building these user interfaces is XAML, the XML-based > markup language that works with Windows Presentation Foundation, Vista's > new graphics subsystem. This book teaches you everything necessary to > design the new generation of user interfaces and .NET applications, with > plenty of examples to get you started. > > > > ***MAKE Magazine Subscriptions Available > The annual subscription price for four issues is $34.95. When you > subscribe with this link, you'll get a free issue--the first one plus > four more for $34.95. So subscribe for yourself or friends with this > great offer for charter subscribers: five volumes for the cost of four. > Subscribe at: > > > ================================================ > Upcoming Events > ================================================ > ***For more events, please see: > http://events.oreilly.com/ > > ***Sebastian Bergmann ("PHPUnit Pocket Guide"), PHP Usergroup Wurzburg, > Wurzburg, Bayern, Germany--Mar 30 > Author Sebastian Bergmann gives a presentation on PHPUnit. > > > > ***Dan Gillmor ("We the Media"), Commonwealth Club, San Jose, CA--Mar 30 > Author Dan Gillmor discusses "Who Needs Ink?" at the Commonwealth Club. > > > > ***Digital Portfolios with Stephen Johnson ("Stephen Johnson on Digital > Photography"), Pacifica, CA--Apr 1 > Photographer and author Stephen Johnson presents this one-day seminar. > > > > ***Visit O'Reilly at LinuxWorld--Boston, MA--Apr 4-6 > Be sure to visit our booth (#412) to peruse our new and classic Linux > titles and more. > > > > ***Dan Gillmor ("We the Media"), Institute for Applied and Professional > Ethics, Athens, Ohio--Apr 7 > Author Dan Gillmor is presenting the opening keynote address on "We the > Media." > > > > ***Julieanne Kost ("Window Seat"), Wedding and Portrait Photographers, > International Convention, Las Vegas, NV--Apr 9 > Author Julieanne Kost presents "Adobe Photoshop CS2 Welcome Aboard." > > > > ***Robbie Allen ("Windows Server 2003 Security Cookbook"), the 58th > Annual Conference on World Affairs, Boulder, CO--Apr 10 > Author Robbie Allen is one of the speakers at this conference. > > > > ***O'Reilly authors at Exchange Connections 2006, Orlando, FL--Apr 10 > Meet authors Devin Ganger, Missy Koslosky, and Paul Robichaux (Exchange > Server Cookbook) at 3:30PM in the conference bookstore, hosted by > Digital Guru. > > > > ***Peter Krogh ("The DAM Book"), ASMP PixelCash Seminar, > Minneapolis,MN--Apr 11 > Author Peter Krogh ("The DAM Book") gives a three-hour comprehensive > overview of Digital Asset Management techniques for the professional > photographer. > > > > ***Tony Bove ("Just Say No To Microsoft"), Cody's Books, > San Francisco, CA--April 12 > Join No Starch Author Tony Bove to discuss his latest book. > > > > ***Maker Faire, San Mateo, CA--Apr 22-23 > Join us for MAKE magazine's first ever Maker Faire???a hands-on event > featuring Makers whose science and technology projects will amaze you > and ignite your imagination. Meet expert Makers and MAKE contributors, > hear from O'Reilly's Hacks author, attend DIY Tutorials, explore DIY > projects and demonstrations, and see the Ultimate Workshop. This event > takes place at San Mateo County Fairgrounds. > > > > ================================================ > Conference News > ================================================ > ***Where 2.0 Early Registration is Open > The Where 2.0 Conference brings together the people, projects, and > issues leading the charge into the location-based technology frontier. > Join the developers, innovators, and business people behind the new era > of geospatial technology as they come together--because everything > happens somewhere, and it's all happening here. > > Where 2.0 Conference, June 13-14, 2006 > Fairmont Hotel, San Jose, CA > > > User Group members who register before April 24, 2006 get a double > discount. Use code "whr06dsug" when you register, and receive 15% off > the early registration price. > > To register for the conference, go to: > > > > ***MySQL Users Conference > Join us at the 2006 edition of the MySQL Users Conference, the largest > gathering of MySQL developers, users, and DBAs. It's the only event > where you'll be able to join the core MySQL development team and over > 1000 users, open source innovators, and technology partners under one > roof. > > MySQL Users Conference, April 24-27, 2006 > Santa Clara Convention Center, Santa Clara, CA > > > User Group members who register before March 6, 2006 get a double > discount. Use code "mys06dusg" when you register, and receive 15% off > the early registration price. > > To register for the conference, go to: > > > ================================================ > News From O'Reilly & Beyond > ================================================ > --------------------- > General News > --------------------- > ***Tim O'Reilly Quizzes Bill Gates at MIX06 > Watch the screencast here: > > > > ***O'Reilly Authors Get Jolted > O'Reilly authors won three of four Jolt Product Excellence Awards. > The winners are: > *"Prefactoring," by Ken Pugh > > *"The Art of Project Management," by Scott Berkun > > *"Producing Open Source Software," by Karl Fogel > > > > ***Latest Title Available on Rough Cuts: "Atlas" > "Atlas Rough Cuts" provides experienced web developers with an exciting > hands-on tour of Atlas--the new development environment that uses both > Ajax and ASP.NET. Beginning with an introduction to the technologies > behind it all, including JavaScript, XMLHttpRequest, DHTML and related > topics, author Christian Wenz shows readers how to create Ajax-style > applications with the Atlas framework, including data binding and XML > Web Services. The book imparts important fundamental knowledge in a > concise reference-like way, making the concepts of this new framework > accessible to developers of various technical levels. > > > For more information, go to: > > > --------------------- > Open Source > --------------------- > ***Secure Your Linux Server > Linux is a powerful and popular operating system kernel. That popularity > means you might be running it even if you're not a dedicated Unix > administrator or high-powered programmer. That doesn't mean that > rock-solid security is out of your reach, though. Aaron Brazell shows > how to make Red Hat 9 (and other Linux distributions) much more secure > in a few easy steps. > > > > ***Autofilled PHP Forms > PHP makes handling interactive web pages easy--but when you have large > forms to fill out, errors to handle, and lots of data to pass back and > forth, you can make your life easier by making PHP fill in all the form > values for you. Gavin Andresen shows how to make forms autopopulate from > PHP arrays. > > > > ***What Corporate Projects Should Learn from Open Source > Many corporate projects fail to produce quality software, yet many > large-scale open source projects succeed, and under much more difficult > conditions: no budget, a geographically distributed team, and a > volunteer workforce, to name a few. So how do open source project teams > ensure success? Andrew Stellman and Jennifer Greene introduce five basic > principles in their new book, "Applied Software Project Management," that > will help any project succeed, open source or proprietary. The authors > detail these principles in this article. > > > --------------------- > Mac > --------------------- > ***Digital Bookmark Mods > Matthew Russell shows you how to add better bookmarks to your audio > books, add slideshows to your music files, create enhanced podcasts, and > share your favorite mods with others--even if they're on protected > audio. > > > > ***Getting Started with Quartz Composer > Apple's free developer tool collection contains many overlooked gems. > These aren't limited to programming-specific utilities. Take Quartz > Composer, for example. It's a free utility that can bring new life and > interest to your iMovie projects. In this article, you'll learn how to > use your own pictures to create simple, but flashy animation. > > > --------------------- > Windows/.NET > --------------------- > ***Using the MultiView and Wizard Controls in ASP.NET 2.0 > Need to collect data from Web pages? ASP.NET 2.0 makes it easy, with the > use of MultiView and Wizard controls. Wei-Meng Lee, author of "ASP.NET > 2.0: A Developer's Notebook" shows you how to take advantage of them. > > > > ***Directions in Windows Scripting > Administering Windows platforms using scripts can be a big productivity > booster or a headache. Mitch Tulloch, author of "Windows Server Hacks," > sits down with Don Jones, a Microsoft MVP and the creator of > ScriptingAnswers.com, for a no-holds barred interview about the future > of scripting. > > > --------------------- > Web > --------------------- > ***Profiting Without Frequently Updated Content > Do you think you need to constantly update content to have a successful > Website that generates AdSense revenue month after month? Think again. > > > > ***Google Page Creator: When It Gets Too Hard > Tired of building quick-and-dirty sites for your family and friends just > so they won't produce their own FrontPage monstrosity? Tell them to try > Google Page Creator instead. > > > --------------------- > Java > --------------------- > ***Zero Configuration Networking: Using the Java APIs, Part 1 > Zeroconf, also known as Bonjour and previously known as Rendezvous, > offers a robust system for self-networking that has been adopted by many > applications. With a provided Java API, now it's easy to make "Zeroconf > applications hop platforms. In this excerpt from Zero Configuration > Networking: The Definitive Guide," Stuart Cheshire and Daniel H. > Steinberg show how to register a service with Zeroconf. > > > > ***What Is Java > Everyone knows what Java is, right? Interpreted code, applets, > proprietary, and slow. Wrong, wrong, wrong, and wrong. In its second > decade, it's time to re-evaluate Java: the language and the virtual > machine are going their own ways, its open source sub-community is > vibrant and independent, and developers are taking the best ideas from > other languages and frameworks and bringing them to Java. In this > article, ONJava editor Chris Adamson tries to reset old assumptions > about Java to fit modern realities. > > > --------------------- > Podcasts > --------------------- > ***The Internet of Things > This week, Bruce Sterling's Emerging Technology keynote on "The Internet > of Things" is the sole segment in our program. (DTF 03-20-2006: 30 > minutes 13 seconds) > > > > ***The Future of Telephony, Going Digital, and Open Formats > Peter Cochrane looks at the future of telephony and handheld devices, > James Duncan Davidson talks about his switch from film to digital > photography, and Simon Phipps explains the importance of open formats > backed up by open source software. (DTF 03-13-2006: 26 minutes 30 > seconds) > > > --------------------- > Digital Media > --------------------- > ***Managing Digital Images: Applying Ratings and Keywords > The explosion of digital imaging has left professional and serious > amateur photographers drowning in photographs, with little guidance on > how to store, sort and organize them. In this excerpt from "The DAM Book," > Peter Krogh shows you expert techniques for applying ratings and > keywords so you can begin to take control of your digital photo library. > > > > ***Inside Animusic's Astonishing Computer Music Videos > Composer Wayne Lytle's custom software transforms musical notes into > jaw-dropping 3D animations. The resulting DVDs have sold tens of > thousands of copies. Watch excerpts here and learn how Lytle turned his > digital pipe dream into a thriving business. > > > > ***Screencast: Photoshop Starburst Effect > SitePoint's first-ever video tutorial shows you step-by-step how to > create starburst effects in Photoshop. > > > --------------------- > MAKE > --------------------- > ***Maker Faire, San Mateo Fairgrounds, San Mateo, CA--April 22-23 > Join the creators of MAKE magazine, the MythBusters, and thousands of > tech DIY enthusiasts, crafters, educators, tinkerers, hobbyists, science > clubs, students, and authors at MAKE's first ever Maker Faire! > > Meet all kinds of people who make amazing things in garages, basements, > and backyards for inspiration, know-how, and spirited mischief-making. > An incredible learning experience for the entire family, students of all > ages and their teachers are welcome. > > > > ***Try a Sample Project from MAKE: > > > > Until next time-- > > Marsee Henon > > > ================================================================ > O'Reilly > 1005 Gravenstein Highway North > Sebastopol, CA 95472 > http://ug.oreilly.com/ http://www.oreilly.com > ================================================================ From enkidu at cliffp.com Tue Mar 28 02:35:52 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Tue, 28 Mar 2006 22:35:52 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <4426766E.3020402@perltraining.com.au> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <1142938128.8058.9.camel@localhost.localdomain> <442663EB.6030108@cliffp.com> <4426766E.3020402@perltraining.com.au> Message-ID: <44291188.5090008@cliffp.com> Jacinta Richardson wrote: > >> sub calc_move { # Calculate next move my $self = shift ; my $i ; >> for ($i = 0; $i < 81 ; $i++) { # check_element($i) ; > > $self->_check_element($i); > >> } } >> Ah, I see! I 'solved' it by calling check_element with an extra parameter: check_element($self, $i) ; Your way is much more elegant! I 'faked' the method call as I was thinking of it as a sub.... > >> sub _check_element { > > my $self = shift; > >> my $element = shift ; . . } > > > > Of course, if _check_element doesn't *need* to know anything about > the object, (that is, it's not a method) then it's just a regular > subroutine and you'd call and define it as such (which is what you > had done). > > private methods rely on programmers behaving because it's polite, not > because you force them to do so. There's some quote here about a > shot-gun, but I can't remember it off the top of my head. This would > apply too to private subs. After all, the programmer usually has > access to your source code when they "use" your module, so they can > break any strictures you set up anyway. > True. Even with a compiled program it can be decompiled. Politeness is fine, but to some extent you might want to hide some of the workings of your object. An object is *supposed* to be opaque, isn't it. Cheers, Cliff -- http://barzoomian.blogspot.com From jarich at perltraining.com.au Tue Mar 28 02:56:17 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Tue, 28 Mar 2006 21:56:17 +1100 Subject: [Wellington-pm] A question about scopes In-Reply-To: <44291188.5090008@cliffp.com> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <1142938128.8058.9.camel@localhost.localdomain> <442663EB.6030108@cliffp.com> <4426766E.3020402@perltraining.com.au> <44291188.5090008@cliffp.com> Message-ID: <44291651.7050002@perltraining.com.au> Cliff Pratt wrote: >>private methods rely on programmers behaving because it's polite, not >>because you force them to do so. There's some quote here about a >>shot-gun, but I can't remember it off the top of my head. This would >>apply too to private subs. After all, the programmer usually has >>access to your source code when they "use" your module, so they can >>break any strictures you set up anyway. >> > > True. Even with a compiled program it can be decompiled. Politeness is > fine, but to some extent you might want to hide some of the workings of > your object. An object is *supposed* to be opaque, isn't it. In theory yes, in practice; less so. Consider a database handle from DBI or a UserAgent from LWP or a WWW::Mechanize object. Most people use these every day without ever reading more than the documentation of the API. For these uses these object could be built on the traditional hash structure, or with a rarer array base. They could even be built as an inside out object; the programmer doesn't and shouldn't have to care. They could have bazillions of "helper" private functions, or none, the users probably won't even open the source code to see. However, sometimes people want to do unusual things - like debug strange behaviour. Perhaps someone wants to subclass DBI in order to ensure certain triggers are called before any execute. This might involve a lot of looking at the code, and of writing their own methods to supplant the ones you wanted to be private. In a case for me today, I wanted WWW::Mechanize to let me "tick" every checkbox of a given name. The standard API didn't work in the way I needed, so I Data::Dumped the object, played around with a few ideas and found a cheaty way of doing it. Personally I think either the documentation is wrong, or it's a bug that I couldn't do it the only obvious way, but regardless that didn't solve the problem *now*. Should the object have remained opaque? Theoretically yes, in practice that wouldn't have been useful to me. If I didn't have access to the details of the object I would have had to parse the HTML to get what I wanted. Is this code likely to break horribly on me sometime in the future when the data structure changes? Absolutely! Will that be a problem? Probably not by that time. Good programmers should be able to weigh up the pros and cons of abusing the internals of your classes. They should understand that side-stepping the API means they deserve all they get. Yet akin to that, if you're hiding *useful* stuff in your class which is not documented in your API then you should expect people to use it all the same and blame you when it changes. All the best, Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From enkidu at cliffp.com Tue Mar 28 13:01:18 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Wed, 29 Mar 2006 09:01:18 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <442687B8.6020403@perltraining.com.au> References: <441F1D04.3090608@cliffp.com> <442687B8.6020403@perltraining.com.au> Message-ID: <4429A41E.7080505@cliffp.com> Jacinta Richardson wrote: > G'day Cliff, > > I don't know how useful you'd find it, but we cover scoping and scopes in our > Introduction and Intermediate Perl course notes, available at > http://perltraining.com.au/notes.html > > Scope itself is covered in the Intro Conditionals chapter, with further coverage > when we get to Modules and Packages in the Intermediate course. > > Cliff Pratt wrote: > >>Say I have a Package and a PERL script. > > > It's "Perl" typically. ;) > > >>If the package uses a variable >>$foo, and so does the script, I should be able to access the script's >>version of $foo by $main::foo in the package. Am I correct? > > > Consider the following case: > --------------------------------------------------- > #!/usr/bin/perl -w > use strict; > > my $foo = 4; # $foo in the main package > my $bar = 10; # $bar in the main package > > print "$foo\n"; # prints "4". > > if(1) { > my $foo = 1; # $foo in the main package, but over-shadows previous > > $foo++; > > print "$foo\n"; # prints "2" > } > > print "$foo\n"; # still prints "4" > > > package bar; > > my $foo = 7; # $foo in the bar package (generates warning if in > same file as above code) > > print "$foo\n"; # prints "7". > > print $main::foo; # undefined! > print $main::bar; # undefined! > > print "$bar\n"; # prints "10" but only if this is all in the same file > --------------------------------------------------- > > > $main::foo is undefined because $foo was declared with "my". Declaring a > variable with "my" means that it lasts from that location to the end of the > enclosing block ( } or end of tile ). "my" variables are not "package" > variables, but are rather lexical variables. > I understand this and I don't understand this! Yes, I see what you are saying, but doesn't $main:: say to look in $main's Symbol Table and hence know the location of foo even though it is out of scope? Or is scope not just matter of knowing where to look? Cheers, Cliff -- http://barzoomian.blogspot.com From enkidu at cliffp.com Tue Mar 28 13:05:10 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Wed, 29 Mar 2006 09:05:10 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <44268A3E.4020204@perltraining.com.au> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <44268A3E.4020204@perltraining.com.au> Message-ID: <4429A506.7020804@cliffp.com> Jacinta Richardson wrote: > Cliff Pratt wrote: > ------------------------------------- > >>use MyGame ; >>. >>my @grid ; >>. >>. >># Recent change - I now pass the grid to the packaged sub and >># return it when modified. >>@grid = MyGame::sub1(@grid) ; > > ------------------------------------- > > >>package MyGame; >> >># Recent change - This now outside any sub. >>my @grid ; >> >>sub sub1 { >> # @grid, but which one? >> @grid = @_ ; >> . >> return @grid ; >>} > > ------------------------------------- > > In this particular case, I'd rewrite your code as follows: > > ------------------------------------- > #!/usr/bin/perl -w > # main.pl > use strict; > > ... > my @grid = MyGame::sub1(@grid) ; > ... > ------------------------------------- > package MyGame; > > sub sub1 { > my @grid = @_; # See below > ... > return @grid; > } > ------------------------------------- > > In this code, @grid is lexically scoped to sub1. This means that it only exists > inside sub1. You could change its name to be @game_grid throughout that > subroutine and the outside code should not be affected. Now having said that, > if you need sub1 to set up the grid and then have that set-up grid be available > to other functions in the package, then I'd recommend considering closures: > > ------------------------------------- > package MyGame; > > { > my @game_grid; > sub sub1 { > my @grid = @_; > ... > @game_grid = @grid; # explicit copy > return @grid; > } > > sub sub2_which_uses_game_grid { > ... > ... @game_grid ... > ... > } > > } > > sub sub3_which_doesnt_use_game_grid { > ... > } > ------------------------------------- > > A closure works by limiting the scope of a lexical variable. In my example > above, only sub1 and sub2_which_uses_game_grid can see the @game_grid variable. > This makes the variable more "private" and hopefully reduces the chance that it > gets changed unexpectedly. > > You'll notice that I still use lexical variables inside sub1 and then explicitly > copy into @game_grid. This helps later programmers find where @game_grid gets > set, and prevents them from either cutting and pasting your code and thus > accidently over-writing the grid variable, or alternately assuming that you've > made an error by not using "my" and breaking your code that way. > > I hope this helps. > > Jacinta > Yes, it does. Thanks Jacinta. I've yet to get my mind around closures, though, so I'll steer clear of them for now. I've actually solved most of the problems with my program one way or another, with the help of yours and other people's hint. It's much appreciated! Cheers, Cliff -- http://barzoomian.blogspot.com From jarich at perltraining.com.au Tue Mar 28 13:33:16 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Wed, 29 Mar 2006 08:33:16 +1100 Subject: [Wellington-pm] A question about scopes In-Reply-To: <4429A41E.7080505@cliffp.com> References: <441F1D04.3090608@cliffp.com> <442687B8.6020403@perltraining.com.au> <4429A41E.7080505@cliffp.com> Message-ID: <4429AB9C.4090902@perltraining.com.au> Cliff Pratt wrote: >>package bar; >> >>my $foo = 7; # $foo in the bar package (generates warning if in >> same file as above code) >> >>print "$foo\n"; # prints "7". >> >>print $main::foo; # undefined! >>print $main::bar; # undefined! >> >>print "$bar\n"; # prints "10" but only if this is all in the same file >>--------------------------------------------------- >> >> >>$main::foo is undefined because $foo was declared with "my". Declaring a >>variable with "my" means that it lasts from that location to the end of the >>enclosing block ( } or end of tile ). "my" variables are not "package" >>variables, but are rather lexical variables. >> > > I understand this and I don't understand this! Yes, I see what you are > saying, but doesn't $main:: say to look in $main's Symbol Table and > hence know the location of foo even though it is out of scope? Or is > scope not just matter of knowing where to look? $main:: does say to look in main's symbol table, *but* this only finds package variables. Variables declared with "my" are *lexical* variables and are only available in the scope they are declared. Thus (assuming we're in the main package): my $foo = 4; print $main::foo; # undefined will always discover $main::foo is undefined. On the other hand: our $foo = 10; print $main::foo; # prints "10" works. The use of "our" sets the variable as a package variable; that is one which can be accessed by other packages and outside the scope in which it was declared. It's a global.... sort of. An older way of achieving the same effect is: use vars $foo; $foo = 10; print $main::foo; # prints "10" but that's more rare to see now that most of the world has finally gotten around to upgrading to Perl 5.6 or later. Note that if I"m in the main package, and I have declared $foo already, then I can just call it $foo without needing to fully qualify it. Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From grant at mclean.net.nz Tue Mar 28 14:02:38 2006 From: grant at mclean.net.nz (Grant McLean) Date: Wed, 29 Mar 2006 10:02:38 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <44291651.7050002@perltraining.com.au> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <1142938128.8058.9.camel@localhost.localdomain> <442663EB.6030108@cliffp.com> <4426766E.3020402@perltraining.com.au> <44291188.5090008@cliffp.com> <44291651.7050002@perltraining.com.au> Message-ID: <1143583358.1352.3.camel@localhost.localdomain> On Tue, 2006-03-28 at 21:56 +1100, Jacinta Richardson wrote: > In a case for me today, I wanted WWW::Mechanize to let me "tick" every checkbox > of a given name. The standard API didn't work in the way I needed, so I > Data::Dumped the object, played around with a few ideas and found a cheaty way > of doing it. Personally I think either the documentation is wrong, or it's a > bug that I couldn't do it the only obvious way, but regardless that didn't solve > the problem *now*. I had to do something similar but got away with sticking to published APIs like this: my($form) = $mech->forms; foreach my $input ($form->inputs) { my $name = $input->name || next; next unless $input->type eq 'checkbox'; next unless $name =~ /some_pattern/; $input->check; } $mech->submit; Was your requirement more esoteric? Cheers Grant From jarich at perltraining.com.au Tue Mar 28 14:34:31 2006 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Wed, 29 Mar 2006 09:34:31 +1100 Subject: [Wellington-pm] A question about scopes In-Reply-To: <1143583358.1352.3.camel@localhost.localdomain> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <1142938128.8058.9.camel@localhost.localdomain> <442663EB.6030108@cliffp.com> <4426766E.3020402@perltraining.com.au> <44291188.5090008@cliffp.com> <44291651.7050002@perltraining.com.au> <1143583358.1352.3.camel@localhost.localdomain> Message-ID: <4429B9F7.5010208@perltraining.com.au> Grant McLean wrote: > I had to do something similar but got away with sticking to published > APIs like this: > > my($form) = $mech->forms; > > foreach my $input ($form->inputs) { > my $name = $input->name || next; > next unless $input->type eq 'checkbox'; > next unless $name =~ /some_pattern/; > $input->check; > } > > $mech->submit; > > Was your requirement more esoteric? Probably not. I couldn't find a check method (I presume it belongs to HTML::Form) and the way that *seemed* obvious from the mech documentation was this: foreach ( 1 .. 100 ) { # I know in advance that there will be 100 my $value = $mech->value( $name, $_ ); $mech->tick( $name, $value ); } Except that value() returns undef when the element is not ticked, rather than the value set in the checkbox, and even if I knew, or could get the values, tick() doesn't actually work with multiple checkboxes anyway. But I like your solution. I guess I should have looked at HTML::Form. It's inspired me to submit a patch, documentation or code I haven't yet decided. Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From grant at mclean.net.nz Tue Mar 28 15:14:44 2006 From: grant at mclean.net.nz (Grant McLean) Date: Wed, 29 Mar 2006 11:14:44 +1200 Subject: [Wellington-pm] A question about scopes In-Reply-To: <4429B9F7.5010208@perltraining.com.au> References: <441F1D04.3090608@cliffp.com> <1142892140.20773.20.camel@localhost.localdomain> <441FC9DC.3000206@cliffp.com> <1142938128.8058.9.camel@localhost.localdomain> <442663EB.6030108@cliffp.com> <4426766E.3020402@perltraining.com.au> <44291188.5090008@cliffp.com> <44291651.7050002@perltraining.com.au> <1143583358.1352.3.camel@localhost.localdomain> <4429B9F7.5010208@perltraining.com.au> Message-ID: <1143587684.1352.12.camel@localhost.localdomain> On Wed, 2006-03-29 at 09:34 +1100, Jacinta Richardson wrote: > Grant McLean wrote: > > > I had to do something similar but got away with sticking to published > > APIs like this: > > > > my($form) = $mech->forms; > > > > foreach my $input ($form->inputs) { > > my $name = $input->name || next; > > next unless $input->type eq 'checkbox'; > > next unless $name =~ /some_pattern/; > > $input->check; > > } > > > > $mech->submit; > > > > Was your requirement more esoteric? > > Probably not. I couldn't find a check method (I presume it belongs to > HTML::Form) Well it's documented in the HTML::Form POD, but strictly speaking the method belongs to HTML::Form::Input or one of its descendants. > and the way that *seemed* obvious from the mech documentation was this: > > foreach ( 1 .. 100 ) { # I know in advance that there will be 100 > my $value = $mech->value( $name, $_ ); > $mech->tick( $name, $value ); > } > > Except that value() returns undef when the element is not ticked, Yes, the HTML::Form::ListInput (used for checkboxes) has the same problem - the 'value' method returns undef if the input is not checked. However there is also a 'possible_values' method which, for a checkbox, returns a list of two values: undef or the value you're after. So you could do something like this: my($value) = grep { defined } $input->possible_values; and then look in $value. Regards Grant From grant at mclean.net.nz Thu Mar 30 00:00:47 2006 From: grant at mclean.net.nz (Grant McLean) Date: Thu, 30 Mar 2006 20:00:47 +1200 Subject: [Wellington-pm] [Fwd: [pm_groups] Fwd: YAPC::Europe::2006 - The Dates] Message-ID: <1143705647.8320.1.camel@localhost.localdomain> ----- Forwarded message from Barbie ----- > > From: Barbie > Subject: YAPC::Europe::2006 - The Dates > Date: Tue, 28 Mar 2006 21:22:54 +0100 > To: "YAPC::Europe Conferences List" > Cc: YEF Board List , > "YAPC::Europe::2006 Organisers List" > > === Announcement #2 === > > Hello, and welcome to our long anticipated second official bulletin > regarding the 2006 YAPC::Europe Perl Conference from the Birmingham 2006 > Organisers. > > When signing up to host a YAPC::Europe we never expected, despite the > words of warnings from previous organisers (see Cog's final speech in > Braga), just how traumatic it could be. > > It has been unfortunate that negotiations with venues didn't go as > planned and have taken considerably longer than we had anticipated. > However, we have found a venue, so we hope this crazy mule of a > conference is finally coming under control, so please be prepared for a > plethora of announcements and updates in the coming months. It's time to > uncage the beast... > > ==== The Dates ==== > > After many many requests, we can now reveal the official dates for the > conference. The conference will be held from ... > > Wednesday 30th August to Friday 1st September 2006. > > In the UK this follows the bank holiday weekend, and is the calm before > the storm when all the students return during September. > > We are planning meetup events in a local pub in the evening for Tuesday > 29th August and Saturday 2nd September, to extend the conference > experience, for anyone arriving early and/or leaving later. Details of > these will be announced nearer the time. > > ==== About Birmingham ==== > > For those wondering where Birmingham is, and why they should come and > visit us, please read on. > > Birmingham is the UK's second city, located in the heart of England. > Technically speaking the village of Meriden is the centre of England, > which is located 10 miles south of Birmingham city centre, but > Birmingham has always been the commercial centre. > > Birmingham grew from humble beginnings of a group of small villages, > through the industrial focal point it became in the 1800s, to the > commercial city it is today. As a result of this Birmingham has become a > hub for road, rail and canal networks. > > There is a rich history both in Birmingham and in the West Midlands, > with towns and cities in the surrounding area providing many attractions > to keep visitors entertained. Stratford-upon-Avon, Leamington Spa, > Warwick and Ironbridge are all within easy reach of Birmingham, should > you wish to extend your stay. > > ==== Contact ==== > > Should you wish to contact us, there is now an email address available > for direct contact, where you can mail us with your questions and > suggestions. The address is: > > organisers at birmingham2006.com > > There is also the regular YAPC::Europe conference mailing list, open to > all. See http://lists.yapceurope.org/mailman/listinfo/conferences. for > more details. > > That's all for this release. Look out for more news and announcements > coming soon. > > Thanks, > The Birmingham 2006 Organisers > > > ----- End forwarded message ----- From enkidu at cliffp.com Thu Mar 30 23:45:49 2006 From: enkidu at cliffp.com (Cliff Pratt) Date: Fri, 31 Mar 2006 19:45:49 +1200 Subject: [Wellington-pm] Side effects Message-ID: <442CDE2D.4040403@cliffp.com> Hi Perlmongers! I don't know if this qualifies as a tip or a question! my $v = "123456789ABC" ; my $v1 = "7" ; print "|" . eval { $v =~ s/$v1// ; return $v } . "|\n" ; Now, orginally, I had the following: print "|" . $v =~ s/$v1// . "|\n" ; which prints "1", since "$v =~ s/$v1//" returns '1'. I wanted to print the side-effect ($v with "7" removed). After trying various things I got the line of code I printed at the beginning. Is this the best way of doing it? It seems pretty OK to me! Cheers, Cliff -- http://barzoomian.blogspot.com From michael at diaspora.gen.nz Fri Mar 31 02:22:40 2006 From: michael at diaspora.gen.nz (michael@diaspora.gen.nz) Date: Fri, 31 Mar 2006 22:22:40 +1200 Subject: [Wellington-pm] Side effects In-Reply-To: Your message of "Fri, 31 Mar 2006 19:45:49 +1200." <442CDE2D.4040403@cliffp.com> Message-ID: Cliff Pratt writes: >my $v = "123456789ABC" ; >my $v1 = "7" ; > >print "|" . eval { $v =~ s/$v1// ; return $v } . "|\n" ; >After trying various things I got the line of code I printed at the >beginning. Is this the best way of doing it? It seems pretty OK to me! What's wrong with two separate statements? $v =~ s/$v1//; print "|$v|\n"; I'd get confused as a maintenance programmer as to why the substitution had to be done in the middle of the print statement. -- michael. From grant at mclean.net.nz Fri Mar 31 02:26:54 2006 From: grant at mclean.net.nz (Grant McLean) Date: Fri, 31 Mar 2006 22:26:54 +1200 Subject: [Wellington-pm] Side effects In-Reply-To: <442CDE2D.4040403@cliffp.com> References: <442CDE2D.4040403@cliffp.com> Message-ID: <1143800815.8303.1.camel@localhost.localdomain> On Fri, 2006-03-31 at 19:45 +1200, Cliff Pratt wrote: > Hi Perlmongers! > > I don't know if this qualifies as a tip or a question! > > my $v = "123456789ABC" ; > my $v1 = "7" ; > > print "|" . eval { $v =~ s/$v1// ; return $v } . "|\n" ; > > Now, orginally, I had the following: > > print "|" . $v =~ s/$v1// . "|\n" ; > > which prints "1", since "$v =~ s/$v1//" returns '1'. > > I wanted to print the side-effect ($v with "7" removed). > > After trying various things I got the line of code I printed at the > beginning. Is this the best way of doing it? Here's a way that might be clearer: $v =~ s/$v1//; print "|$v|\n"; :-) Grant