> Will you guys be posting slides/notes somewhere soon?

As the warm-up while folks were filtering in, I  walked through a bruteforce
Obfu soduko that I found linked in the YAPC:Japan proceedings.
 http://www.ecclestoad.co.uk/blog/2005/05/

I had no slides. Just code and examples.  And the code ... it's so garbage,
I'm embarrassed I haven't finished refactoring, I was only showing the key
lines to answer the open GD quesitons.  You'd have recognized the code
layout, I used the same tidy/css combo as for the Advent.

Extra lines/text on GD:Chart - The key item from my presentation was on the
mailing list in February -- to draw lines and letters on top of a GD::Chart,
request an Image Map before plotting and dump it after, request the GD
object, and knock yourself out.
Example (different than shown) -
  http://ema.arrl.org/fd/ducting/Fc_e_etam2718.png

Data-on-map --  Prime example is
  http://ema.arrl.org/fd/ ,
see the About page for credit on maps. Browse around the History section for
lines on maps. Key is to encapsulate Lat-Lon <-> XY mapping for your
base-map.
Numeric data on map -
  http://ema.arrl.org/fd/ducting/prog28_00.png
Lines on Map -
  http://ema.arrl.org/fd/history/tour2005.html
and alternate maps.

I also did a quick review of using XML::Twig
  http://search.cpan.org/~mirod/XML-Twig-3.23/Twig.pm
to extract the flagged items from my feed-reader's cache to generate a
cheesy, private RSS file for a couple friends to see my latest science news
-- different but not so very different from what we did for Advent. Code
attached.


--
Bill
[EMAIL PROTECTED] [EMAIL PROTECTED]

=============================
Sorry, no comments ... it's just a hack ...

#! /bin/perl

use POSIX qw(strftime);
use XML::Twig;

my $time  = POSIX::strftime( "%a, %d %b %Y %X %Z GMT", gmtime());
my $copyyy= POSIX::strftime("%Y",gmtime());
my $home_url="http://tropo.harvee.org/~wdr/news.html";;

my $header = <<EOF;
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="./rss.css" ?>

<rss version="2.0">
    <channel>
        <title>Bill's Interesting News Items</title>
        <link>$home_url</link>
        <description>Personal digest of science and technology RSS feeds that
were interesting today.</description>
        <language>en-us</language>
        <category>news</category>
        <copyright>Compilation Copyright $copyy only -- fair use compilation
of copyright items. </copyright>
        <ttl>720</ttl> <!-- time to live [ 12 hours = 720 min ] -->

EOF

my $image=<<EOF;
        <image>
                <title>Bill's Science News</title>
                <width>150</width>
                <height>60</height>
                <link>http://$home_url</link>
                <url>http://$home_root/images/logo.gif</url>
        </image>
EOF

my $footer=<<EOF;

    </channel>
</rss>
EOF

print "$header \n";
# print $image,"\n";

while (@ARGV) {
   #  my $LIFEREA; ## File Handle
    my $fn = shift @ARGV;
    # open $LIFEREA, $fn or die "Can't open input file $fn: $!";

    my $t= XML::Twig->new(
                           # the twig will include just the root and selected 
titles
                           twig_roots   => {
                                'item' => \&print_n_purge,
                                             'feedTitle' => \&channel_title,
                                             'feedSource' =>  \&channel_link,
                                        
                                             # 'annex/title'   => 
\&print_n_purge
                                         },
                           pretty_print => 'indented',
                      );

  $t->parsefile( $fn);



}
print $footer,"\n";

{
my ($channel_title, $channel_link);

sub channel_title
{
    my( $t, $elt)= @_;
    $channel_title=$elt->text;
};

sub channel_link
{
        my( $t, $elt)= @_;
        $channel_link=$elt->text;
}

 sub print_n_purge
    {
        my( $t, $elt)= @_;
        # $elt->print;
        my $mark=$elt->first_child('mark');
        unless ($mark && $mark->text eq '1') { $t->purge; return};
                
        my $src =$elt->first_child('source');
        
        if ($src) {
            $elt->insert_new_elt (link=>{},$src->text);
        
        }
        else {warn "source missing for item...";
          }
        my $desc=$elt->first_child('description');
        if ($desc) {
            my $text=$desc->text;
            if ($text && $text =~ /[<>]|&lt;/){
                # warn "DESC with <>";
                my $tt=XML::Twig->new() or die "Can't make second Twig?";
                $tt->parse_html($text);
                my $text2=$tt->root->text;
                if (length $text2 > 1024) { substr($text2,1020)=" ..."; }
                # warn "Setting to $text2";
                $desc->set_content($text2);
            }
            $desc->prefix("From $channel_title: \"");
            $desc->suffix('" --  .');
        }
        else {
            $elt->insert_new_elt(description=>{},"From $channel_title");
        }

        $elt->cut_children( qr{ (?: new | read | update) Status | mark | time
| attributes | id | source |nr }x );
        $elt->print; # print $elt ->text;    # print the text (including
sub-element texts)
        $t->purge;           # frees the memory
    }

}
 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to