Re: Prevayler

2003-08-22 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* Chris Devers cdevers at pobox.com [2003-08-22 11:38]:
 (Can ZODB [Zope Object DataBase] even work outside of Zope?)

Absolultely.  For example, take a look at Chandler, at
www.osafoundation.org, an open source PIM that uses the ZODB as a
backend.

(darren)

- -- 
Help!  I'm a rock!
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: This message is digitally signed and can be verified for authenticity.

iD8DBQE/RjwfzsinjrVhZaoRAngQAJsF52ibSGCR3EtsHigupTcYT4YjQgCfQmGC
GHgfdQPpPp5qNdyEx4l+ksY=
=KrW8
-END PGP SIGNATURE-



Re: [RFC] arbitary maths evaluation

2003-08-15 Thread darren chamberlain
* Shevek shevek at anarres.org [2003-08-15 12:39]:
 The effective halfway house, which does produce a good but fast
 sandbox, is to parse the thing properly, generate a parse tree, then
 emit guaranteed clean Perl code from the parse tree, and eval that.

This is how the Template Toolkit does it too, using a grammar generated
using Parse::Yapp rather than Parse::RecDescent, with a custom parser.
The nice thing about this approach is that you don't need Parse::* to
run the code, which makes it more easily distributable.

(darren)

-- 
I look for what needs to be done After all, that's how the
universe designs itself.
-- R. Buckminster Fuller


pgp0.pgp
Description: PGP signature


Re: mod_rewrite

2003-07-17 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* Ian Malpass ian at indecorous.com [2003-07-17 08:43]:
 Only it seems that I can't use variables in the regexp of a RewriteCond.
 Any ideas on how I can do this? Or am I stuck adding users into the
 .htaccess as and when they arrive? It's not a big problem, but it would be
 nice to avoid manual intervention.

You can reference previously matched RewriteCond stuff as %1, %2, %3,
etc.  (See
http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteCond, under
RewriteCond Backreferences.)  So maybe you could do something like
(untested):

  RewriteEngine On

  # Checks for non-false REMOTE_USER entry
  RewriteCond %{REMOTE_USER} (.+)

  RewriteRule ^(.*)$ %1/$1 [L]

(darren)

- -- 
Sigmund Freud is alleged to have said that in the last analysis the
entire field of psychology may reduce to biological electrochemistry.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: This message is digitally signed and can be verified for authenticity.

iD8DBQE/FqYizsinjrVhZaoRAuv2AJ0YDMIGGm966IIsZFoBg3m3fUONiQCgieT2
t0/YmeDI+xU3TuZlf6WOQFU=
=VmxD
-END PGP SIGNATURE-



Re: Database Connection Conversions

2003-07-16 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* Dominic Mitchell dom at semantico.com [2003-07-15 16:37]:
 On Tue, 15 Jul 2003 11:40:15 -0400, darren chamberlain [EMAIL PROTECTED] wrote:
Take the incoming INSERT statements and proxy them to the Oracle
database.  A variation on DBD::Proxy might do a bunch of what you
want.
 
 You might also find the stuff at http://sqlfairy.sf.net/ useful.

Heh.  Since sqlfairy is one of my own side projects, I certainly do find
it useful. ;)

But, I think the problem here (at least with the (potential) solution I
presented, in which Dave might have no interest at all) isn't one of SQL
- -- it's of presenting an ODBC-like interface.  I would imagine that once
the connection has been made, and the housekeeping aspects taken care
of, the SQL comes over as strings, which can be probably be passed
intact to the proxied database.

Plus, sqlfairy doesn't handle INSERT statements yet, only CREATEs and
some ALTERs.  :(

(darren)

- -- 
There is not enough love in the world to squander it on anything by
human beings.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: This message is digitally signed and can be verified for authenticity.

iD8DBQE/FHASzsinjrVhZaoRAoGKAJ9AmPYDAfwZA756vCCD5e+Qu7u5+wCgkOGU
vwEHiu9dE+4U02EadkkrcGw=
=s5jq
-END PGP SIGNATURE-



Re: Database Connection Conversions

2003-07-15 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* Dave Cross dave at dave.org.uk [2003-07-15 08:37]:
 So what we're looking for is an application that can sit between the
 VB app and the Oracle database, translating the ODBC/SQL Server calls
 to Oracle API calls. It needs to look like an SQL Server to the VB app
 and then actually put the data into Oracle.

It might be interesting to write a small ODBC listener that can respond
to ODBC calls and Do Stuff with the strings that come in.
http://search.cpan.org/dist/UnixODBC/ seems to contain a bunch of useful
information about the ODBC interface, and might be a good place to
start.

(darren)

- -- 
Lackland's Laws:
  (1) Never be first.
  (2) Never be last.
  (3) Never volunteer for anything
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: This message is digitally signed and can be verified for authenticity.

iD8DBQE/FB38zsinjrVhZaoRAgTZAKCIb5RhxrEm6YQOczwVVUQeGmeXYACfeHyc
5gKuG65eLGB2SKJo7xiHfss=
=itsh
-END PGP SIGNATURE-



Re: Database Connection Conversions

2003-07-15 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* Darren Chamberlain darren at boston.com [2003-07-15 11:34]:
 * Dave Cross dave at dave.org.uk [2003-07-15 08:37]:
  So what we're looking for is an application that can sit between the
  VB app and the Oracle database, translating the ODBC/SQL Server calls
  to Oracle API calls. It needs to look like an SQL Server to the VB app
  and then actually put the data into Oracle.
 
 It might be interesting to write a small ODBC listener that can respond
 to ODBC calls and Do Stuff with the strings that come in.

Er, I just realized that was only half of a thought.  The rest looks
something like:

  Take the incoming INSERT statements and proxy them to the Oracle
  database.  A variation on DBD::Proxy might do a bunch of what you
  want.

(darren)

- -- 
History doesn't always repeat itself. Sometimes it just yells 'can't
you remember anything I told you?' and lets fly with a club.
-- John W. Campbell Jr.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: This message is digitally signed and can be verified for authenticity.

iD8DBQE/FCBfzsinjrVhZaoRAqaNAJ9DGZIEh809MhICP0BrEAsKe7T+rwCghy3S
0R202fu5Wf4jR8hmh2A87DE=
=N2zo
-END PGP SIGNATURE-



Re: Neural nets

2003-07-07 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* Luis Campos de Carvalho lechamps at terra.com.br [2003-07-07 14:59]:
 Andy Wardley wrote:
 Toby Corkindale wrote:
 
 I'm not convinced Perl is the best language to implement such things.
 
 Why not?  Performance concerns or something else?
 
 That's a serious question by the way, not just me being provocative.
 
   I think that Perl is not that good on number crunshing.
   Maybe you should look at fortran (old and good!) or some 
 number-crunshing-specialist tool.

You mean like PDL (pdl.perl.org)?

(darren)

- -- 
Reisner's Rule of Conceptual Inertia:
If you think big enough, you'll never have to do it.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/CcWHzsinjrVhZaoRAk42AJsFZke2Nql8V9iPRC4nnZ9J0eHrawCeOmZN
W1ZLRYrp0z0F1x30DSRPp7Q=
=QBGD
-END PGP SIGNATURE-



Re: OSCON

2003-07-03 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* Leon Brocard acme at astray.com [2003-07-03 12:22]:
 Andy Wardley sent the following bits through the ether:
  Prolly see some of you at the airport... or on a bus... or sharing a
  taxi... or in the bar... or in the orange paint shop...
 
 It'll be great! We sit by the bar, plan new versions of the Template
 Toolkit and Perl, and hack the planet!

You can get started on porting TT to parrot...

(darren)

- -- 
There is nothing like returning to a place that remains unchanged to
find the ways in which you yourself have altered.
-- Nelson Mandela
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/BFqRzsinjrVhZaoRAklHAKCPIDJHPvNiy1S+9cbc7KBU/TrgcwCghbDE
KD8cAZkLN9HIJ85cP/D4/xg=
=dAty
-END PGP SIGNATURE-



Re: Golf: word wrap and quote stdin

2003-04-03 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* TSchutzerWeissmann at uk.imshealth.com [2003-04-03 10:10]:
 I'd like to pipe text in (either with just linebreaks, or dos-style
 carriage return + linebreak's) and get out word-wrapped lines of not
 more than 80 characters prefixed with  .

  use Text::Wrap;

  sub mywrap {
  my $data = shift;
  local $Text::Wrap::columns = 80;

  return wrap(' ', ' ', $data);
  }

  print mywrap(join '' = STDIN);

(darren)

- -- 
Now imagine a Moebius vortex inside a spherical constant, and you've
got my cosmology.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (SunOS)

iD8DBQE+jE/+zsinjrVhZaoRAuMnAJ4rCWCcBuxpuRcFqTgsM285emtXeQCfa2Dd
acbH2NczuURsy5hLnqxAlig=
=XoOT
-END PGP SIGNATURE-



Re: Golf: word wrap and quote stdin

2003-04-03 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* TSchutzerWeissmann at uk.imshealth.com [2003-04-03 10:49]:
 Whichever of Text::Wrap and Text::Autoformat is the smallest, I guess.
 In fact since this is all happening to clipboard data I can use
 Win32::Clipboard and dispense with the stdin part.

Also, Text::Wrap is in the core, at least as far back as 5.00503.

(darren)

- -- 
The language Unix is vastly more inconsistent than the language Perl.
And guaranteed to remain that way, forever and ever, amen.
-- Larry Wall
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (SunOS)

iD8DBQE+jFhazsinjrVhZaoRAnoyAJ9Qe0Gy0IorlRoLQSciUdvP0rOWkwCgkq5P
ApnbtETpI0oMTOfOo99s5VI=
=tAEC
-END PGP SIGNATURE-



Re: crackfuelled idea / nntp / message boards / bl*gs / mailing lists

2003-03-28 Thread darren chamberlain
* Simon Wistow simon at thegestalt.org [2003-03-27 20:34]:
 Write a NNTP plugin for Siesta. Posting mail to Usenet would be easy.

Attached.  (The preferences stuff isn't in there, though it's obvious
where to put it.)

(darren)

-- 
All journalists have a novel in them, which is where it belongs.


NNTP.pm
Description: Perl program


pgp0.pgp
Description: PGP signature


Re: crackfuelled idea / nntp / message boards / bl*gs / mailing lists

2003-03-28 Thread darren chamberlain
* Richard Clamp richardc at unixbeard.net [2003-03-28 16:25]:
 On Fri, Mar 28, 2003 at 11:35:31AM -0500, darren chamberlain wrote:
  * Simon Wistow simon at thegestalt.org [2003-03-27 20:34]:
   Write a NNTP plugin for Siesta. Posting mail to Usenet would be
   easy.
  
  Attached.  (The preferences stuff isn't in there, though it's
  obvious where to put it.)
 
 Nifty, applied as revision 546

Hey, if you like that, I've got a bunch of ideas about siesta-related
stuff.  I was a little confused when the CVS server told me that
everything I'd just updated last night was no longer relevant when I
tried to update today, though...

(darren)

-- 
People who make peaceful change impossible make violent change
inevitable.


pgp0.pgp
Description: PGP signature


Re: message board software

2003-03-27 Thread darren chamberlain
* Toby|Wintrmute tjc at wintrmute.net [2003-03-27 10:40]:
 On Thu, Mar 27, 2003 at 03:34:01PM +, Roger Burton West wrote:
  So write one with an interface usable over NNTP?
 
 You've lost me there. Why?

Because all the problems associated with message board software
(threading, redistribution / synchronization, categorization,
subscriptions, killfiles, and so on) are problems that have been solved
by NNTP and/or NNTP clients years ago, and there is no sense in
repeating all those mistakes.

(darren)

-- 
Responsible behavior is the result of a socialization process.


pgp0.pgp
Description: PGP signature


Re: message board software

2003-03-27 Thread darren chamberlain
* Chris Devers [EMAIL PROTECTED] [2003-03-27 13:29]:
 On Thu, 27 Mar 2003, Toby|Wintrmute wrote:
 
  I need to setup a message board / forum thing, and I want something
  that runs on Perl/DBI(::Pg) or Perl/Pg .. (or just a simple
  dirs+textfiles backend)
 
 I haven't heard of it being applied this way, but Request Tracker
 would probably actually be pretty good at this.

I think the mismatch between intention and use would end up being pretty
limiting with RT.  I think RT is too, well, request-oriented for a
general purpose message board.

 Playing into the web vs. nntp comments from later in the thread, one
 of the aspects of RT that I like the most is that people can interact
 with it via posts to the web interface, via email to the system, or
 through a CLI.  You get to choose your poison.

I've actually wanted to implement an NNTP interface to RT for a while.
Someday when I have some free time...

(darren)

-- 
OCCAM'S ERASER:
The philosophical principle that even the simplest
solution is bound to have something wrong with it.


pgp0.pgp
Description: PGP signature


Re: How do you change colour of text output?

2003-03-21 Thread darren chamberlain
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

* Phil Pereira freeserver at wintellect.co.uk [2003-03-21 15:20]:
 The default output of my Perl scripts is to the screen, however, what
 I want to do is change the output colour of the text as often /
 necessary as I require.
 
 So - what command???

Take a look at Term::ANSIColor.

(darren)

- -- 
Words are also deeds.
-- Lugwig Wittgenstein
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (SunOS)

iD8DBQE+e3nozsinjrVhZaoRAnkTAJ9928EzlLdNA3LENK+h1Vl+0n/8DwCeNOu+
b/6gBAxny23RTqsgUfMwLr4=
=0q0O
-END PGP SIGNATURE-



Re: Capturing local machine's IP address in bash

2003-03-18 Thread darren chamberlain
* Jon Reades jreades at fulcrumanalytics.com [2003-03-18 12:15]:
 Does anyone have suggestions for where/how I could obtain this
 information?

It's not bash, but it will work:

  perl -MSys::Hostname -MSocket -e 'print inet_ntoa inet_aton hostname'

(darren)

-- 
Whatever is done for love is beyond good and evil.
-- Friedrich Neitzsche



Re: XML::Parser - using object methods as handlers

2003-03-07 Thread darren chamberlain
* Rhys Hopkins rhysh at aerotech-eu.net [2003-03-07 12:00]:
 In my reference book (Perl  XML by Ray  McIntosh) it clearly states
 that one can use object methods as handlers to avoid this global
 variable scenario. However, the book and the XML::Parser manpage fail
 to give specific examples as to how this is accomplished, and when I
 try I encounter problems.

You can pass anonymous subroutines that contain references to your
object as the handlers.  For example:

  package My::XML::Thing;

  ...

  sub parse {
  my $self = shift;
  my $parser = XML::Parser-new(Handlers = {
  Start = sub { $self-parse_start_field(@_) },
  Char  = sub { $self-parse_char_field(@_) },
  });

  ...

The handlers for Start and Char are closures, and contain a reference to
your object (in $self).

(darren)

-- 
A good magician never reveals his secret; the unbelievable trick
becomes simple and obvious once it is explained. So too with UNIX.



Re: TT type question (well maybe not)

2003-03-06 Thread darren chamberlain
* Andy Williams (IMAP HILLWAY) andy.williams at hillway.com [2003-03-06 09:05]:
 I've got a text file that contains a whole load of TT tags.
 What I need to do is get all of these tags into an array.

[-- snip --]

 I have read the file into a scalar variable (hey, I can so the easy
 bit :), but for the life of me I can't work out a nice simple(ish) way
 of getting the tags into an array.

You could use Template::Parser directly:

  use Template::Parser;

  $f = my_file_as_a_string();
  $p = Template::Parser-new;
  my @array = map { $_-[0] } grep { ref eq ARRAY } @{ $p-split_text($f) }

Kind of hackish, but it works.

(darren)

-- 
I don't want to achieve immortality through my work...
I want to achieve it through not dying.
-- Woody Allen



Re: TT type question (well maybe not)

2003-03-06 Thread darren chamberlain
* Andy Williams (IMAP HILLWAY) andy.williams at hillway.com [2003-03-06 10:12]:
 Actually went for a combination of all the above so as not to offend
 anyone
 :)
 
 my @array = map { $_ =~ m/\[\%\s+(\S+)\s+\%\]/g } $copy;
 
 Which seems to work.

...Until you do something like:

  [% IF foo;
  foo;
 END %]

Which your regex will miss; maybe a regex like 

  /\[\%\s+(.+?)\s+\%\]/gs

would be a little better.

(darren)

-- 
What is truth, on the experiential level, but truthfulness?
-- Raimundo Panikkar



Re: Microptomisation games

2003-02-28 Thread darren chamberlain
* Mark Fowler mark at twoshortplanks.com [2003-02-28 06:49]:
 I tend to use this style, maily because it allows me to write comments
 next to each of the things I'm shifting off:
 
 sub add
 {
   my $left  = shift;  # this/self
   my $right = shift;  # the other obeject
   my $rev   = shift;  # have the args been reversed by perl?

But you can do that anyway:

  sub add
  {
my ($left   # this/self
$right  # the other obeject
$rev) = @_; # have the args been reversed by perl?
...

(darren)

-- 
The best book on programming for the layman is Alice in Wonderland;
but that's because it's the best book on anything for the layman.
-- Alan Perlis



Re: spamassassin

2003-02-28 Thread darren chamberlain
* David Cantrell david at cantrell.org.uk [2003-02-28 13:27]:
 Better would be to have the procmail recipe that fires off spamc first
 check that spamd is running and start it if necessary, methinks.
 Urgh, shell programming is nasty enough at the best of times, but mix
 it with procmail and shudder.

Instead of piping to spamc, pipe to a script that starts spamd if
necessary, then passes stdin to spamc.

(darren)

-- 
What is truth, on the experiential level, but truthfulness?
-- Raimundo Panikkar



Re: Infinity?

2003-02-28 Thread darren chamberlain
* Chris Devers cdevers at boston.com [2003-02-28 13:05]:
 Hence, something like:
 
 while (1) {
 # code here
 sleep;
 }
 
 Or more idiomatic equivalent.

Uh...

  $ perldoc -f sleep
   sleep EXPR
   sleep   Causes the script to sleep for EXPR seconds, or
   forever if no EXPR. [...]

Almost right. :)

(darren)

-- 
To do nothing is to be nothing.



Re: Frontier::RPC2 and german!

2003-02-20 Thread darren chamberlain
* Toby|Wintrmute tjc at wintrmute.net [2003-02-20 12:17]:
 Just looking for advice - what is the best way to insert accent
 characters when you don't have a european keyboard?  (ie. assuming i'm
 just using vim with a standard US or UK keyboard)

Try:

  help digraphs

(darren)

-- 
My one regret in life is that I am not someone else.
-- Woody Allen




Re: [OT ish] Piping to a file.

2002-12-13 Thread darren chamberlain
* Simon Wilcox [EMAIL PROTECTED] [2002-12-13 08:53]:
 What unix command can I use that will take it's input and write it out
 to a file.

tee.

  $result = open SENDMAIL, | tee myfile | $command;

(darren)

-- 
How is it possible to find meaning in a finite world, given my waist
and shirt size?
-- Woody Allen




Re: Collapsing paths

2002-12-13 Thread darren chamberlain
* Simon Wilcox [EMAIL PROTECTED] [2002-12-12 15:02]:
 Seems to work on the test cases I can think of and it should be
 portable too. Not sure if the die is too harsh, maybe it should return
 undef.

My File::Spec version (I wrote this about a year ago, and it seems to
work acceptably) looks like:

  use File::Spec::Functions qw(splitdir catfile curdir updir);

  my $curdir = quotemeta curdir; $curdir = qr($curdir);
  my $updir = quotemeta updir; $updir = qr($updir);

  sub squash($) {
  catfile grep { !/^$updir$/ }
  grep { defined }
  map { /^$curdir$/ ? undef : $_ } splitdir shift;
  }

Attached is a little script that tests it.  Probably needs some more
rigorous test cases, but, like I said, it's worked for me.

(darren)

-- 
Unix was not designed to stop you from doing stupid things, because
that would also stop you from doing clever things.
-- Doug Gwyn



squash.pl
Description: Perl program


Re: central installation of Perl

2002-12-10 Thread darren chamberlain
* Gabor Szabo [EMAIL PROTECTED] [2002-12-10 06:43]:
 Then of course we found out that we have machines with older glibc
 that won't run our compiled perl. Upgrading linux is out of question,
 these have to have the old glibc.
 
 What is your suggestion ?

Have you considered creating a build script or Makefile that builds Perl
locally, with all the appropriate modules, and distribute that among the
various machines?  Setting a vendor_perl path that points to your NFS
mounted directory for globally installed modules can solve the module
distribution problem.

(darren)

-- 
I look for what needs to be done After all, that's how the
universe designs itself.
-- R. Buckminster Fuller




Re: applying patterns

2002-10-09 Thread darren chamberlain

* Adam Spiers [EMAIL PROTECTED] [2002-10-09 17:47]:
 Simon Wistow ([EMAIL PROTECTED]) wrote:
  Some examples. You want to remove the duplicates from a list. I
  always use :
  
  @nodups = keys %{{ map { $_ = 1 } @dups }};
 
 IIRC the cookbook one is:
 
   @nodups = grep ! $h{$_}++, @dups;

I use the one from lib.pm:

  @nodups = grep { ++$h{$_} == 1 } @dups;

(darren)

-- 
What a strange illusion it is to suppose that beauty is goodness.
-- Leo Tolstoy