Re: [Boston.pm] module introspection

2011-08-09 Thread Ted Zlatanov
On Mon, 08 Aug 2011 12:48:22 -0400 Tom Metro tmetro-boston...@vl.com wrote: 

TM I have a command line utility I am developing that I'd like to be
TM extendable with additional verbs such that you can do:

TM command verb ...args...

TM And I'd like the utility to be able to support new verbs by merely
TM having a module added to a designated directory. Thus I'd like my code
TM to be able to use some form of introspection to extract the new verbs
TM (designated methods) from the modules.

Have each module define text lines that become part of a big
Parse::RecDescent grammar you evaluate at the end to generate the top
rule.  As long as your basic lexing rules are consistent you should be
OK.  This gives you the most flexibility, as long as you control all the
modules and the load order.  I also think it's the most readable
approach and it only exposes the functionality you want to expose.

Ted

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


Re: [Boston.pm] Q: giant-but-simple regex efficiency

2011-02-06 Thread Ted Zlatanov
On Sun, 06 Feb 2011 11:49:56 -0500 Charlie creit...@rcn.com wrote: 

C Given how you frame the problem, then the hash lookup isn't even an
C option!  No question, 6000+ string searches will be slow vs. a trie.
C Given the varying requirements we all encounter, day-to-day, I think
C this is an interesting exercise.  Thanks for sharing these modules,
C Ted.

Sure.  I think this is a fascinating area.  I was looking into this just
recently because a biologist asked me about microarray analysis.  There,
they have tens of thousands of expressed proteins with a score (vs. a
control) and they try to find the strongest *correlated* expressions of
certain proteins, which are basically substrings of a big text body
(there's a lot more to it, of course, including that some proteins are
known to be grouped and some have known functions).  I found
http://www.bioconductor.org/ which uses the R statistical language to
qualify these, but was investigating Perl approaches to the same.

C The OP indicated that the text can be tokenized:
KS Unfortunately, my names can be embedded in larger words of the input
KS text, as long as they are delimited by certain punctuation.

On Sun, 06 Feb 2011 10:25:43 -0500 belg4...@pthbb.org wrote: 

b Acutally I believe the OP said that there were still delimters required,
b they just weren't \s so one CAN still tokenize

I didn't parse that the same way, sorry.  Definitely, if the input can
be tokenized you'd have a good shot at the split+lookup approach.

Ted

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


Re: [Boston.pm] use Moose ?

2011-02-03 Thread Ted Zlatanov
On Wed, 2 Feb 2011 13:26:52 -0500 James Eshelman ja...@nova-sw.com wrote: 

JE Thanks Drew.  It's good to hear that there's no noticeable RT penalty after 
JE startup, and the roles feature looks especially nice, along with the 
JE compatibility with Perl 6.   -- Jim

There's a very noticeable penalty if you instantiate lots of objects.  I
couldn't use Moose for a database loader, for instance, and had to fall
back to simple hashes.  The speed difference was (for my specific case,
which had lots of small objects) between 2 and 200 times slower with
Moose, depending on other factors like hitting swap because the memory
usage spiked.  This is not surprising considering all that Moose does.

I am a big fan of Moose and use it whenever I can, but only if I expect
relatively few objects to be created and managed.  Otherwise I would at
least benchmark the performance and consider how the objects are going
to be used.

Ted

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


Re: [Boston.pm] Java for Perl programmers?

2009-06-26 Thread Ted Zlatanov
On Thu, 25 Jun 2009 21:09:05 -0400 James Eshelman ja...@nova-sw.com wrote: 

JE That time has finally come for me that all good perl hackers dread -- being 
JE forced to code in Java.  Most Java tutorials, websites, and books seem to 
JE target novice programmers.  Anyone know of a condensed, quick reference or 
JE site for Java for those with plenty of OO coding experience in perl ? 
JE I've found a few that make a glancing blow, but nothing yet that really 
hits 
JE the nail on the head.

There's a huge difference between writing server and desktop apps in
Java and further differences when you get to particular needs and
libraries.  In my experience this makes it hard to find the right Java
book, you end up with at least 2-3 plus a bunch of online docs.

Sun's online Swing tutorials are very good if you're interested in Swing
programming.  Similarly there are many other tutorials of high quality
on Sun's Java resource pages.  http://mindprod.com/jgloss/jgloss.html is
also a very good resource and probably will be your favorite because it
goes pretty deep.

The Sun certification exams and study guides are good.

As far as language features: Threads, Collections, Generics, and
singleton objects are really important and you should look at them so
you don't reinvent the wheel.

Ted

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


Re: [Boston.pm] merging lists that are ordered but not sorted

2008-01-30 Thread Ted Zlatanov
On Tue, 29 Jan 2008 16:27:16 -0500 (EST) Chris Devers [EMAIL PROTECTED] 
wrote: 

CD On Tue, 29 Jan 2008, Tolkin, Steve wrote:
 I want to reconstruct the underlying list.  In other words the order of
 the elements agrees in all the lists, but there is no sort condition.
...
CD Out of curiosity, does it have to handle something like this?
...
CD That is, outliers, I guess. 
...
CD That is, loops, I guess.

CD Seems like edge cases like that could make this non-determistic.

I think the requirements are too vague, as your list of exceptions
shows.  Steve should either specify the narrow cases for which he cares
(he didn't say the 123/1435 example he posted was the only necessary
one) or should give the general behavior desired for merging of any list
A1..An with another list B1..Bm

It sounds like a fun problem, but as specified we're all only guessing
what it is.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Subroutine definition

2007-09-10 Thread Ted Zlatanov
On Mon, 10 Sep 2007 15:00:30 -0400 Ronald J Kimball [EMAIL PROTECTED] wrote: 

RJK On Mon, Sep 10, 2007 at 11:51:56AM -0700, Palit, Nilanjan wrote:
 I have to do some format conversions, so I'm defining subroutines like
 sub FormatConv_X2Y()
...

RJK Other options include:

RJK Creating a converter object, and doing
RJK C$converter-can('FormatConv_X2Y').

An even better option for the converter is to rethink the procedural
approach; store data in a neutral format and extract what you need.  You
can use an object for this, and your code would look like this:

# hint that the input data is in format X
# (but the code could try to guess!)
my $item = new Formatter($x_data, 'X');

# did we get valid input?
if (... check valid input here, maybe with (defined $item) or something
more elaborate ...)
{
 # request output in format Y
 my $y_data = $item-as_Y();
}
else
{
 ... error handling ...
}

You can always pass data structures around if you don't want to use
objects (and Perl objects are basically data structures), but the idea
is the same: instead of defining individual X-Y mappings, try to
abstract X-generic and generic-Y as appropriate to your problem.  Of
course you can use any data structure as your generic data format, but
it's simplest to use strings if possible.

This makes it easy to add new input and output formats, especially if
they are related to the ones already known.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] quick XML::Twig / variable scope problem

2007-08-25 Thread Ted Zlatanov
On Fri, 24 Aug 2007 19:32:05 -0400 Alex Brelsfoard [EMAIL PROTECTED] wrote: 

AB I would like to call a function that declares a few variables and then runs
AB some XML::Twig processes which in turn access  update said original
AB variables.
AB But I'm getting an error from my twig functions when they try to access the
AB before-defined variables.
...
AB sub main {
AB my $catalog_timestamp;
AB my $objinfo_timestamp;
AB my %fields;
... calls get_catalog_timestamp ...
AB }

AB An example of the twig functions:

AB sub get_catalog_timestamp {
AB my ($twig, $elt) = @_;

AB # get the PublishTimeStamp attribute
AB $catalog_timestamp = $elt-att('PublishTimestamp');

AB $twig-purge();
AB }

Either set up a global settings hash outside main(), which every
function accesses, or have a global function that returns a hash inside
a closure, e.g.

{
 my %settings;
 sub settings { return \%settings; }
}

settings()-{yes} = 'no';

For settings, always try to consolidate them into a single holder (hash,
object, whatever) because then you can easily track usage and refactor
it as needed.  I usually do something a little more elaborate:

use constant CATALOG_TIMESTAMP = 'catalog_timestamp';
settings()-{CATALOG_TIMESTAMP()} = 'timestamp data';

to avoid typos in the hash key, which make very annoying bugs.  I
usually use the same hash with Getopt::Long to have a single place for
all program options.

HTH
Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] [OT] DNS lookup? PLEASE REPLY OFF LIST

2007-02-01 Thread Ted Zlatanov
Sorry for posting to the list when the subject clearly said not to.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] LDAP server recommendations?

2006-11-13 Thread Ted Zlatanov
On 13 Nov 2006, [EMAIL PROTECTED] wrote:

 We have OpenLDAP @ $work. We use it for SAMBA and PAM and I am really happy
 with it.

OpenLDAP is nice.  I used it at a previous job.  The problems I found
lay with LDAP itself rather than this particular implementation.

Be careful with the BDB backend, it can have serious problems.  On our
Solaris server we had file limits (size and number of files) that
caused headaches.  I don't know if that can happen on Linux, I left
before that migration :)

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] OLE, excel, and perl

2006-10-02 Thread Ted Zlatanov
On  2 Oct 2006, [EMAIL PROTECTED] wrote:

On Oct 2, 2006, at 5:56 PM, Greg London wrote:

 I believe I was informed that OLE was the
 only way to do this. Or maybe I was drunk.

 Definitely not true.  In fact, Spreadsheet::{Read,Write}Excel run  
 just fine on Linux.

While this is true, they are limited compared to OLE into Excel
itself.  Basic data will work, but questions about more complex usage
come up all the time in comp.lang.perl.misc and in my mailbox (I wrote
a brief article on the various ways to use Excel from Perl a while
ago).  I would recommend sticking with what works.

The suggestion to copy the spreadsheet file off the network drive,
modify it, then copy it back is the cleanest solution given the
problem's constraints.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Short time in Boston

2006-09-15 Thread Ted Zlatanov
On 15 Sep 2006, [EMAIL PROTECTED] wrote:

On Thu, Sep 14, 2006 at 06:42:48PM -0400, Uri Guttman wrote:
 JA == John Abreau [EMAIL PROTECTED] writes:

 JA David H. Adler wrote:
 So. Mom and I are taking a cruise next month up the east coast and into
 Canada. We've got a day (22 Oct, if I've got this all right) in Boston.
 What should we do in the... 10 hours we're there?

 i assume that is a day stop here? what hours?

 Yep. I believe we dock at 8am and set sail (motor?) at 6pm.

This is a Sunday I think.  I think walking around Boston on a Sunday
is a wonderful experience.

If you're coming in with a cruise ship, you might be docking somewhere
near the aquarium, which is well worth a visit in my opinion.  From
there you can go to the North End in 10 minutes.

The North End has good food (Mike's Pastry is a must for sweets, and
their bread is great too).  Look around, there's plenty of inexpensive
restaurants.  Paul Revere's house is there too, and many visitors like
to see it.

From the North End you can walk across the road to the downtown area,
following the Freedom Trail basically.  If you have the energy, keep
walking to the Boston Common and you'll see plenty of nice
architecture.  You may want to avoid the Cheers bar which is on the
side of the Common.  Walk on Commonwealth Avenue or Newbury Street a
little bit, then head to Copley Square--you'll see Trinity Church, the
library, and plenty more.

You can get back through the Theater District and Chinatown, or (if
you're tired) take the Green line to the Red line (switch at Park
Street), which will drop you off at South Station, close to where you
started.

Another point of interest is the USS Constitution, Old Ironsides,
the famous ship docked in Charlestown not far from downtown.  You may
see it from the cruise ship.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] perl 6

2006-07-14 Thread Ted Zlatanov
On 14 Jul 2006, [EMAIL PROTECTED] wrote:

 What other P6 features are considered big win motivators to start
 using P6 by others?

I think the new grammar feature (to me, it's very similar to what
Parse::RecDescent does today, but P::RD has problems and it's slow as
noted by others) is going to make Perl 6 an even better tool.  I wrote
an article about it some time ago:

http://www-128.ibm.com/developerworks/library/l-cpregex.html

I would also recommend the Perl 6 Essentials book, which I reviewed
here (a new edition has come out since):

http://www-128.ibm.com/developerworks/linux/library/l-cpbooks.html?ca=dgr-perlw02PerlBooks

Function parameters are nice in Perl 6.  Also, continuations are going
to be fun.

Besides the big features, I think little things like the zip operator
make Perl 6 an even better language than Perl 5.  You really have to
use it for a little bit before you can feel how it's better than
Perl 5 (and some people may not feel that at all).

Here's another review of Perl 6 Essentials by Piers Cawley that
talks about why Perl 6 is nice too:

http://www.bofh.org.uk/articles/read/11

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Parser for C-like language?

2006-06-26 Thread Ted Zlatanov
On 23 Jun 2006, [EMAIL PROTECTED] wrote:

On Fri, Jun 23, 2006 at 09:23:09AM -0400, Ted Zlatanov wrote:  On 23 Jun 2006, 
[EMAIL PROTECTED] wrote:
 Wasn't there a C grammer for Parse::RecDescent ?
 Not that worked.  Damian has acknowledged elsewhere that it shouldn't
 have been included.
 It works for simple cases, and may be adequate for the OP's needs.  I
 would recommend P::RD, because its grammar definitions are pretty
 similar to the Perl 6 grammar definitions (it will matter, some day),
 and because it's pretty good in general.  About the only thing that's
 hard about it is parsing the error messages, which takes practice.

 I've tried P::RD.  I didn't like it at all.  It seemed to take an awful
 lot of work to define a very simple language ...

That hasn't been my experience.

 ... and I was not impressed by the documentation.
 Next time I need a parser I'll try Parse::Yapp.

I actually found Parse::Yapp's documentation much worse.  P::RD has a
lot of good docs and a FAQ.  While it has shortcomings (speed is a
problem for a lot of people, though for me it hasn't been too bad)
documentation is not one of them.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Perl Curses clarification

2006-06-02 Thread Ted Zlatanov
On  1 Jun 2006, [EMAIL PROTECTED] wrote:

 Let me clarify a bit more what I need to do.  We want to use $USER
 to verify a valid user before running the program, so this is very
 unlikely go on the web or have a web interface.  

You can tie web-based authentication to an external user database
(e.g. LDAP/Active Directory/the PAM stack).  It can have its own
authentication database.  This is as secure as relying on the Unix
login process, if configured properly.  Just run over HTTPS to prevent
snooping.

The Unix login process can be subverted by sudo (not to mention that
$USER can be set to anything, as others pointed out).  You should
always request a password if security is a concern.  Don't trust the
UID or environment.  In a web environment, a lot of this security is
readily available in pre-packaged applications.

Of course, you could consider something like MARS.  I know Merrimack
College and a few others use it and it works well.

It sounds like you're set on writing this in text mode, but I hope the
suggestions help, especially that you should always ask for a password.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Perl Curses clarification

2006-06-02 Thread Ted Zlatanov
On  2 Jun 2006, [EMAIL PROTECTED] wrote:

 The key is to let somebody else do as much of the authentication
 implementation as possible, as it's tricky and time-consuming to get
 right.

  The Unix login process can be subverted by sudo (not to mention that
  $USER can be set to anything, as others pointed out).  You should
  always request a password if security is a concern.  Don't trust the
  UID or environment . . .

 I don't understand.  The environment is certainly untrustworthy, but how
 (in the absence of an OS bug) would an attacker change the effective UID
 without login credentials?

There are many more ways to attack a system from the inside than from
the outside.  For example, you know the exact OS version, library
versions, file locations, etc.  If an attacker has sudo, forget it,
effective UID can be anything.

 But what are you going to do with that password?  Compare it to some
 database and then die if it fails?  That is sound for CGI, but not for a
 perl script that is run from the shell.  What if an attacker edits the
 script and changes the die to warn?

Of course, if the user can edit the script, he can do anything with
it, but I would hope the script is not setuid root (or accessible via
sudo).  If that's not the case, the user can only make the script do
the things he could do from the command line anyway.

 But this turns out to be academic in this case.  

Well, it's an interesting discussion even if it's not directly useful
to the OP.  I hope someone else finds it useful.

 Which brings to mind another useful thing:  If the old versions of
 the grades file (call it grades.csv) were kept in numbered backups
 (e.g. grades.csv.1, grades.csv.2, etc.), it might help in case of
 bugs, or if a TA ever says, I really screwed it up . . .

Better yet, put it under a VCS (CVS, Subversion, etc.) and your
history is ready.

 Which in turn points out one of the drawbacks of using a shared
 account:  If somebody else finds a problem, you won't know who to
 contact about what went wrong.  Even worse, IMHO, is the fact that
 people are much more casual with shared accounts, particularly about
 guarding the password.  To be honest, I've set up a few of those at our
 site, but only for very low-privilege purposes.  And, since we were
 discussing security, I felt I should bring it up.

Agreed.  In fact, after hearing more about the problem, it sounds like
a wiki may be useful.  With per-user passwords and built-in versioning
(with knowledge of who edited when), it may be sufficient.  Table
editing in wikis is pretty simple, see for example
http://meta.wikimedia.org/wiki/Help:Table

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm



Re: [Boston.pm] Perl Curses?

2006-06-01 Thread Ted Zlatanov
On  1 Jun 2006, [EMAIL PROTECTED] wrote:

 I'm writing a command-line program to manage student grading for a
 course, which will run on the school's Unix boxes (it can't be put on the
 web for security reasons), and was debating what the best choice is to
 handle the user interface.  Has anyone got some experience with Curses.PM
 and/or could point me toward any examples or documentation (in addition to
 CPAN)?  Or is there something better to do command-line interfaces?  The
 user will need to be able to select tasks from a menu and then perform
 them.

It's very hard to automate curses-based applications (and, in my
experience, they are just not easy to write), so I would suggest at
least that the options sufficient to run the program without
interaction should be available.  In other words, if the menu has
three modes for example,

1) exams
2) quizzes
3) homeworks

then I would also provide a -mode [e|exams|q|quizzes|h|homeworks]
switch.  That way, when this application needs to be integrated with
others, you can keep it instead of redesigning it.

Also, you can run a web browser like links, lynx, or w3m from the
command line and fill out forms, follow menu links, etc.  The web
server can be limited to only accept local connections if security is
a concern.  You get a text-mode application with ready-made widgets,
menus, etc. so you can concentrate on the content and backend.  When,
inevitably, someone demands a web interface, you'll have one ready :)

At the moment, it's also easier to find support and expertise for
web-based than curses-based interfaces.  This will probably remain the
case in the near future.  So from a business standpoint, it may make
sense to try to use a web-based solution.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Put similarities in code and differences in data

2006-04-05 Thread Ted Zlatanov
Logically you can extend data-driven programming to storing opcodes
with parameters in a database, and writing an interpreter in any
language.  That's a valid approach under some circumstances, in fact
(see my article on this topic at
http://www-128.ibm.com/developerworks/linux/library/l-cpdata.html).

The trick with data-driven programming, just like OOP or any other
paradigm, is knowing how much is enough to get the job done.  My
overriding maxim has always been if you have to do it more than
twice, it's worth abstracting.  So for example, if you have this kind
of code:

retrieve user A
modify user A
store user A

retrieve user B
delete user B

I wouldn't abstract things yet because a) it's too much hassle in
terms of code and documentation, and b) it's more readable this way.
But when you add

retrieve user C
modify user C
store user C

I immediately abstract it into

do_user(USER[], OPERATIONS[][])

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] GUI builders, support tools

2005-03-01 Thread Ted Zlatanov
On Mon, 28 Feb 2005, [EMAIL PROTECTED] wrote:

 Sean, old boy, I'm astounded.  Are you not aware that I've been doing
 exactly this using emacs?  Daily?  For more than 20 years now?  It's
 called find-tag . . .

For the less Emacs-savvy, the speedbar package may be ideal.  It shows
the functions in a side window (speedbar) and you can jump to them
with the mouse.  Comes with Emacs.  Very handy together with
cperl-mode.

Ted
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] (also) Perl

2005-02-28 Thread Ted Zlatanov
On Fri, 25 Feb 2005, [EMAIL PROTECTED] wrote:

 i still have my cert that i bought from them for my $2! it is all the
 perl cert i need.

At the very least there should be a Perl hacker test (I haven't seen one).

Here's a start...  I'll be glad to maintain this (if there's been
others, please let me know)

Ted

Give yourself 1 point for every true answer.

 Have you ever written a Perl script?
0001 ...over 1000 lines?
0002 ...over 1 lines?
0003 ...over 10 lines?
0004 ...without newlines?
0005 Do you know the difference between Perl and perl?
0006 Have you met Larry?
0007 Damian?
0008 Jarkko?
0009 Dan?
000A Randal?
000B Do you know anyone who's written a book on Perl?
000C Have you written a book on Perl?
000D ...for O'Reilly?
000E Is your name in the Perl 5 source code?
000F ...as a curse word?
0010 Is your name in the Perl 6 source code?
0011 ...will it be out soon?
0012 ...do you promise?
0013 Do you know any Perl jokes?
0014 Have you tried to tell them to non-programmers?
0015 ...at a party?
0016 ...as a pickup line?
0017 ...did it work?
0018 Have you ever read clpm?
0019 ...posted on clpm?
001A ...a FAQ reference?
001B ...a FAQ correction?
001C ...started a flame war on clpm?
001D ...trolled on clpm?
001E ...argued with Abigail?
001F Have you read all the Apocalypses?
0020 ...and get them?
0021 Have you read the Exegeses?
0022 ...and forwarded them to someone?
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] reading in a directory

2004-12-08 Thread Ted Zlatanov
On Tue, 7 Dec 2004, [EMAIL PROTECTED] wrote:

 Wow, well it's good to see we're all on the same page.  Three replies all
 suggesting the same option.. zipped files.  Yeah here's the trick.
  I'm trying to make this process easier for my mother, not myself.  So in
 the end, this is adding another layer...  So, if I don't want to do the
 zipped files idea (which is a kinda snazzy idea btw)  then I have only two
 other options: 1) do the list of sinlge file selections as suggested, or
 2)use another programming language (javascrip or java I would imagine) to
 connect to the local machine, browse, select the folder, find the files,
 and submit them in the form as hidden fields (somehow).

The newer XForms (http://www.w3.org/TR/xforms/) also don't specify a
way to browse a directory, so I suspect filenames will be the state of
things for a while.  I think it is considered insecure to allow
server-side code to browse an entire directory.

I don't know if it's difficult to hit Ctrl-A in the file selection box
and thus select all the files in the directory - that would be the
easiest solution without subfolders and no zip files would be
required.

You should think about what you're really trying to achieve.  If the
goal is to upload the contents of a folder including subfolders
wherever it may be, that's another thing and zip files are the best
solution.  If the goal is JUST to send images or do other client-side
processing, provide a Perl script that creates the archive and uploads
it to a target server location (optionally, signal the server to
analyze the upload afterwards).  Make the source location static and
your mom will not have to enter command-line arguments but instead she
can just double-click on an executable that will do everything; your
script can empty the source location upon completion.

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] OT: Courier IMAP

2004-12-07 Thread Ted Zlatanov
On Fri, 03 Dec 2004, [EMAIL PROTECTED] wrote:

Ted Zlatanov wrote:
 Courier IMAP is very reliable and standards-compliant.
 
 The problem with Courier IMAP is the support community. When I 
 researched it I found several people complaining about how the lead 
 developer(s) ran the project. So I avoided it.
 
 I ended up using maildrop, which is a component of Courier, and after
 contributing documentation and attempting to open a discussion of how a 
 certain feature worked, I found the lead developer to be very closed to 
 new ideas.

I agree, but I find the quality of Sam's answers and software to be
proportional to their directness (the djb effect).  I am certain
Courier IMAP is the best IMAP server I've tried.  My tests were
extensive.  To stay sort of on topic, the programmatic tests were in
Perl, using the Mail::IMAPClient CPAN module.  The UI tests were done
with Mozilla, Emacs Gnus, and Pine.

 Dovecot is the complete opposite. It may not be the most polished 
 solution, but the lead developer is competent and very open to new ideas
 and contributors.

I tried it and it had too many problems a year ago.  Perhaps I'll give
it another try...  It would have to be awfully good to replace
Courier, though.

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] OT: Recommendation for mail server?

2004-12-03 Thread Ted Zlatanov
From experience (2000+ users, lots of research) I would recommend
either qmail-ldap or Postfix for mail delivery (MTA) and Courier IMAP
for IMAP and POP service.

LDAP is essential if you plan to run a serious mail server.  There's
very few alternatives to a well-managed LDAP server for your user
user directory.  qmail-ldap is very good for this.

If you just want a mail server for yourself without LDAP, Postfix is
great.  I like it a lot for small setups (less than 100 users) but
Qmail is better for large setups based on my experience.

You should deliver mail in the Maildir format.  mbox format is easy to
understand but terrible in almost every other way.  A huge plus to
Maildirs is that you can NFS-share them safely.

Courier IMAP is very reliable and standards-compliant.  People also
like Cyrus and Binc, but stay away from UW IMAP.  It's s-l-o-w (at
least partly because of the mbox storage).

I can go into details on any of these if needed.

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Tech Meeting Followup

2004-08-06 Thread Ted Zlatanov
On Fri, 6 Aug 2004, [EMAIL PROTECTED] wrote:

 Have you ever noticed a google resultset entry that didn't have a
 cache link? I don't know if it is something that a publisher can set
 programatically or if it is a business arrangement.

Pages are cached by default.  To get removed you have to request it.

http://www.google.com/help/features.html#cached

 Advertising based news sites will probably be even less appreciative
 of mirroring and caching as more and more of them turn into
 registration based sites.

You misunderstand.  If registration is required, a crawler will fail
anyway, and I don't mean anything but crawler-like behavior with depth
1.  I'm talking about common sense caching, not how can we defeat
this site so all their content is mirrored.  You could even have a
redirect link that sends you to the cached version iff the original
site is unresponsive, so normal users never know what happened.

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Tech Meeting Followup

2004-08-06 Thread Ted Zlatanov
On Fri, 6 Aug 2004, [EMAIL PROTECTED] wrote:

On Aug 6, 2004, at 6:14 AM, Ted Zlatanov wrote:

 You misunderstand.  If registration is required, a crawler will fail
 anyway,
 
 Unless the crawler is itself registered.  If I wrote a crawler, I'd
 keep a database of usernames and passwords for this purpose.

That's not a typical web crawler, and obviously not what I meant.
Such databases already exist (e.g. bugmenot) but using them to rip a
page is definitely abusive.  Think Google, not rip-off.

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Tech Meeting Followup

2004-08-06 Thread Ted Zlatanov
On Fri, 6 Aug 2004, [EMAIL PROTECTED] wrote:

 That's not a typical web crawler, and obviously not what I meant.
Such databases already exist (e.g. bugmenot) but using them to rip a
page is definitely abusive.
 
 Not abusive at all.  It's a public service.

It's abusive to the content provider who pays the network connectivity
bills and expects ad revenue, regardless of how you or anyone else
feels.  Note the context is on a major site's ripping of a page so
visitors never see the original site, NOT general web visitors.  I'm
not interested in discussing the latter's attitude towards web
registrations because that's completely irrelevant to Slashdot
caching.

 Think Google, not rip-off.
 
 Go to news.google.com and you will see many results that say things like
 
 Kansas City Star (subscription)
 
 So the Google crawler does indeed subscribe to some
 registration-required sites and crawl them.

I'm not sure how that matters.  We're talking about Google's HTTP
caching of ANY page, not their news items; furthermore the focus is on
*intent* and not on *mechanism*.  Google's intent with cached HTTP
crawling is clearly not to rip off advertisers.

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Tech Meeting Followup

2004-08-05 Thread Ted Zlatanov
On Thu, 5 Aug 2004, [EMAIL PROTECTED] wrote:

On Thursday, August 5, 2004, at 05:56 PM, Ted Zlatanov wrote:
 
 ...or they should provide a mirrored version of the page at least :)
 
 I'm sure my employer would be thrilled about mirrored versions of the
 pages. It would cause them to lose ad revenue.
 
 I guess if they were willing to ask can we post about your site? it
 could be a multiple choice yes, no, yes if you mirror the 
 content, but since they don't ask at all, option three is irrelevant.

I meant it in the sense of the Google cache, where you have an
alternative in case the main one goes down, but the main link is
prominent and obviously the one to follow.

You can't make everybody happy all the time, obviously.

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Linux cluster and configuration management

2004-06-23 Thread Ted Zlatanov
On Wed, 23 Jun 2004, [EMAIL PROTECTED] wrote:

 Then we switched to net-booting over NFS, and it's even easier 
 faster. There's no longer any need to configure each machine, beyond
 going into the bios and making sure that PXE boot over the network is
 enabled. Everything else can be managed on the NFS server, and if a
 machine goes bad, we can just move the user over to a new one or
 rebuild the old one, but either way it's a trivial matter.

That sounds useful, is Perl involved with the machine setups in any
way?  Did you follow any particular tutorial for setting this up?  Do
you only use Debian?

 What's Radmind like? I looked at it briefly, but not in depth. What
 sorts of things are you doing with it?

Just to jump in, I looked at Radmind and it struck me as a
combination of Tripwire and rsync.  I like cfengine much better
because it can do so much more than just file installs (though it does
those too).

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Komodo vs. emacs

2003-07-01 Thread Ted Zlatanov
On Mon, 30 Jun 2003, [EMAIL PROTECTED] wrote:
 Komodo's code-folding is cool.  I installed a code-folding script in
 emacs (http://mah.everybody.org/docs/emacs/folding-cperl-mode), but
 it wasn't as flexible as Komodo's code-folding; it only folded
 top-level subroutines, whereas Komodo allows folding of any regions
 enclosed in curly braces.  Can anyone recommend a better
 code-folding script for emacs?

Try folding.el at http://user.it.uu.se/~andersl/emacs.shtml - it does
exactly what you need.

Ted
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Help with very sluggish perl process?

2003-06-18 Thread Ted Zlatanov
Have you tested the subroutine without any data
assignments, just:

 open(CXIBIO,+$ARGV[0]) or die Could NOT open $ARGV[0]\n;
 print CXIBIO $ARGV[1]\015;
 EP: while (1) 
 { 
  $REC=CXIBIO;
  if ( $REC =~ m/[EMAIL PROTECTED]/) { next EP; }
  if ( $REC =~ m/^0999/)  { last EP; }
 }
 close(CXIBIO);

If this is slow, your problem may be elsewhere, not in the Perl code.

Ted

p.s. you don't really need the EP label, but I left it in in case
there's more next/last usage in inner loops inside the main while(1)
loop.
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Looking for an elegant solution.

2003-02-02 Thread Ted Zlatanov
On Sat, 1 Feb 2003, [EMAIL PROTECTED] wrote:
 $_ = 'use_name,mat_id,use_id,use_fname,mat_name,use_lname';
 
 
 How could I elegantly split/loop this into the following structure?
 %hash = (
   use = [use_name,use_id,use_fname,use_lname],
   mat = [mat_id,mat_name]
 };
 
 I started something like
 
 foreach (split(/,/)) {
   /(\w+)_\w+/;
   $group{$1}++;
 }

I would make sure the match worked...  The following should work.

#!/usr/bin/perl -w

use strict;
use Data::Dumper;

my $words = 'use_name,mat_id,use_id,use_fname,mat_name,use_lname';
my %hash = ();

foreach my $item (split(',', $words)) 
{
next unless $item =~ /(\w+)_\w+/;
push @{$hash{$1}}, $item;
}

print Dumper \%hash;

___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm



Re: [Boston.pm] mimes!

2003-01-15 Thread Ted Zlatanov
On Wed, 15 Jan 2003, [EMAIL PROTECTED] wrote:
 When I want to forward the email, I do this:
 
[...]
 print MAIL $$r{body};
[...]

 and this, of course, screws up html emails and mime-types.  What's
 the easiest way to forward the email with all the mime types intact?
 If I can get away with it, I'd rather store the entire body in one
 field, and deal with attachments, etc. later, rather than having a
 separate table for attachments.

Use something like MIME::Lite or MIME::Tools to create a message
attachment.

From the MIME::Lite docs:

 Create a multipart message

   ### Create the multipart container:
   $msg = MIME::Lite-new(
From='[EMAIL PROTECTED]',
To  ='[EMAIL PROTECTED]',
Cc  ='[EMAIL PROTECTED], [EMAIL PROTECTED]',
Subject ='A message with 2 parts...',
Type='multipart/mixed'
);

   ### Add the text message part:
   ### (Note that attach has same arguments as new):
   $msg-attach(Type ='TEXT',
Data =Here's the GIF file you wanted
);

For a message you would use something like the 'message/rfc822' type
instead of TEXT as you see above, but otherwise the idea is the same.

All attachments of the original message will be in the attachment.
The MIME standard provides for that nicely with multipart boundaries.

Ted

___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm