Re: [Boston.pm] Rakudo.org malware?

2017-01-31 Thread Gyepi SAM

g@d:~$ whois rakudo.org
Domain Name: RAKUDO.ORG
Registrant Name: Andy Lester
Registrant Email: a...@petdance.com

-Gyepi

On Tue, Jan 31, 2017 at 02:38:48PM +, Morse, Richard E.,MGH wrote:
> Hi! When I tried to go to rakudo.org, I got the following warning:
> 
> > This Page Cannot Be Displayed
> > 
> > Based on your organization's access policies, this web site ( 
> > http://rakudo.org/2017/01/30/announce-rakudo-star-release-2017-01/ ) has 
> > been blocked because it has been determined by Web Reputation Filters to be 
> > a security threat to your computer or the organization's network. This web 
> > site has been associated with malware/spyware.
> > 
> > If you have questions, please contact your organization's network 
> > administrator and provide the codes shown below.
> > 
> > Date: Tue, 31 Jan 2017 09:22:09 EST
> > Username: 
> > Source IP: XXX.XXX.XXX.XXX
> > URL: GET http://rakudo.org/2017/01/30/announce-rakudo-star-release-2017-01/
> > Category: Computers and Internet
> > Reason: BLOCK-MALWARE
> > Threat Type: othermalware 
> > Threat Reason: Domain reported and verified as serving malware. 
> > Notification: WBRS
> 
> Does anyone know who I should notify about this, and have contact information 
> for them?
> 
> Thanks,
> Ricky
> 
> 
> The information in this e-mail is intended only for the person to whom it is
> addressed. If you believe this e-mail was sent to you in error and the e-mail
> contains patient information, please contact the Partners Compliance HelpLine 
> at
> http://www.partners.org/complianceline . If the e-mail was sent to you in 
> error
> but does not contain patient information, please contact the sender and 
> properly
> dispose of the e-mail.
> 
> ___
> Boston-pm mailing list
> Boston-pm@mail.pm.org
> http://mail.pm.org/mailman/listinfo/boston-pm

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


Re: [Boston.pm] website problem

2015-06-28 Thread Gyepi SAM
On Sun, Jun 28, 2015 at 05:44:11PM -0400, dan moylan wrote:
 1st: in my code:
   $fll = /home/moylan/www/cgi-bin/stuff/moyts6.log;
   $fhl = new FileHandle ();
   $fhl-open ($fll, w) or die couldn't open $fll;
   $fhl-printf (# MOYTS6\n\n);
 
 it was apache trying to write to stuff with permissions
 755 owned by moylan.moylan.  i added moylan to apache groups
 and set stuff permissions to 775 and that got fixed.
 
 2nd: selinux permissive mode was required.
 
 when those two things were done the script worked just fine.
 
 now, do you have any suggestions as to how i might adjust
 selinux for my particular problem without putting it in the
 permissive mode?

Is there a special reason why the cgi directory is writable
by the web server?  It's a more usual practice to place log files in
a separate directory from code and make sure that the code directory
is NOT writable by the web server.

One of the benefits of a separate logging directory is that this problem goes 
away
and your system is more secure.

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


Re: [Boston.pm] boost::format to sprintf, or how do I get a substitution with a substitution in it?

2015-04-04 Thread Gyepi SAM
On Fri, Apr 03, 2015 at 09:48:22PM -0500, Greg London wrote:
 Cool!  15 years of perl and I never used /e
 
 I got the regexp to convert the first file
 and discovered that sprintf is way more inconvenient
 than I remember. It doesn't return the string,
 it returns pass/fail. And it operates on char* ?
 
 This may have been why I used boost::format.
 
 Anyone know of a c++ self contained function that takes
 a format string and returns the result string
 rather than using char*'s and returning the value in
 a char*?

I ran into this problem with C code some time ago.

sprintf and friends do not return the string because that would require
them to allocate the memory for the string, which raises difficult
questions of ownership and memory management.

Instead, you are expected to pre-allocate the memory and pass it in as
a char * argument so sprintf can write to it.

But how do you know how big to make the string? The basic idea is to
call snprintf with a zero length value and it will tell you how big the
string should be so you can make a second call with the correct length.
It works, but is annoying. I suspect most programmers write utility code
to abstract this stuff away.

Here's the code I wrote back then to solve the problem, it's extracted from
my util library so there are references to other util or application
functions but they are pretty obvious. Note that you are expected to
deallocate the string after use.

char *
xvstrfmt (const char *fmt, va_list args)
{
  int size = 0;

  char *str = NULL;

  int n;

  for (;;) {

n = vsnprintf (str, size, fmt, args);

if (n == -1) {
  fatal_sys (vsnprintf);
}
else if (n  size) {
  return str;
}
else {
  size = n + 1;
  str = xrealloc (str, size);
}
  }

  return NULL;
}

char *
xstrfmt (const char *fmt, ...)
{
  va_list args;

  char *str;

  va_start (args, fmt);
  str = xvstrfmt (fmt, args);
  va_end (args);

  return str;
}

-Gyepi

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


Re: [Boston.pm] [Discuss] Facebook backups?

2014-04-28 Thread Gyepi SAM
On Mon, Apr 28, 2014 at 10:29:39AM -0400, Bill Ricker wrote:
 And if that doesn't work, then there's Selenium or perl modules to script a
 Firefox session.

Or phantomjs, the headless browser.

-Gyepi

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


Re: [Boston.pm] GO vs Perl runtime.

2014-03-15 Thread Gyepi SAM
On Fri, Mar 14, 2014 at 07:42:53PM -0400, Andrew Feren wrote:
 I've never seen GO before this thread,  but after a glance at the GO web 
 site, I suspect the difference may have more to do with concurrency than 
 compiling.  Perl is written in C and natively pretty good at file and string 
 manipulation. My gut says a 2x win for this problem just by using GO compiled 
 to a static binary is much too big a difference. 

No, that's not it. The difference really is due to the compilation.
Any interpreter will have overhead that a compiled program will not.
In perl's case, there's even more overhead for providing dynamic memory
management, relaxed typing, etc. 2x is actually not bad, all things
considered. I bet a C version would be even faster; but at the cost of
managing memory and implementing your own hash, string and array data
structures. However, you can tune all of that to the problem set so it
really is a trade-off.
The piper must be paid, you just get to choose when and how.

 Is the code for the GO program being compared to the posted perl script also 
 available?

It is now. As you can see, it's a straightforward translation of the original 
into idiomatic Go.
Even without comments it should be readable to anyone who has programmed any 
Algol derived language.

I've been using Go for about 2 years now and I really like it.
It fits Alan Kay's maxim: simple things are simple and complex things are 
possible.
To which I would add also that impossible things are imaginable.
More prosaic, but equally important, deployment is just a file copy.
Dependency management is pushed to development time where, I think, it rightly 
belongs.

-Gyepi

__DATA__

package main

import (
bufio
fmt
log
os
strings
)

type Counter map[string]int

func main() {

input := /dev/stdin

if len(os.Args)  1 {
input = os.Args[1]
}

in, err := os.Open(input)
if err != nil {
log.Fatalf(open: %s. %s, input, err)
}

scanner := bufio.NewScanner(in)

var (
lines []Counter
maxCols, numlines int
firstline string
)

splitChar := ,

scanner.Split(bufio.ScanLines)
for scanner.Scan() {

words := strings.Split(scanner.Text(), splitChar)

cols := len(words)

if numlines == 0 {
lines = make([]Counter, cols)
for i := range words {
lines[i] = make(Counter)
}
firstline = scanner.Text()
maxCols = cols //cap column count to first column count
}

numlines++

if cols  maxCols {
cols = maxCols
}

for i := 0; i  cols; i++ {
lines[i][words[i]]++
}
}

fmt.Printf(filename: %s\n, input)

if numlines  0 {
fmt.Printf(firstline: %s\n, firstline)
}

for i, counter := range lines {
fmt.Printf(field#: %d distinct: %d\n, i, len(counter))
}
}

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


Re: [Boston.pm] GO vs Perl runtime.

2014-03-15 Thread Gyepi SAM
On Fri, Mar 14, 2014 at 12:42:39PM -0400, ja...@nova-sw.com wrote:
 From what I can see GO is purely compiled down to object code and linked into 
 static binaries.  IMHO Perl, as an interpreted language, is doing *super* to 
 be *only* twice the runtime of Go!   Maybe others have a better handle on 
 this.  

Yes, 2x is not bad. Generally, comparing language speed doesn't get you far
unless you can use any language. If you're not doing green field programming,
there's generally enough of an investment in a particular language (or set of 
languages)
that the mountain is hard to move.

In most cases (web services), a slower language just means more servers.
Hardware will get you surprisingly far before you are forced to really think 
about scalability.
When that happens, you need more from your language than mere speed.

-Gyepi

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


Re: [Boston.pm] perl program to count distinct values - can it be made faster

2014-03-08 Thread Gyepi SAM
On Sat, Mar 08, 2014 at 10:59:22AM -0500, Steve Tolkin wrote:
 # return code: 0 == success; 1 == some warnings; 2 == some errors
 my $rc = 0;

This value never changes. I assume the larger program could change it.

 my $split_char=',';  # CHANGE ME IF NEEDED (later use getopts)
 
 my @aoh; # array of hashes: key is the field value; value is the count
 my $numlines = 0;
 my $firstline;
 while ()
 {
 chomp;
 $firstline = $_ if $numlines == 0; 

More idiomatically written as:

 $firstline ||= $_;

 $numlines++;
 my @data;
 
 # Seemingly extra code below is for compatibility with older perl
 versions
 # But this might not be needed anymore.
 if ( $split_char ne '' )
 { @data = split(/$split_char/,$_); }
 else
 { @data = split; }
If you're really looking for optimizations, this test can be moved outside
the loop. Since no arg split splits on spaces, your check can be something
like:
$split_char = ' ' unless $split_char;

Then the test and two split options can be replaced with 

@data = split /$split_char/, $_;

There may also be some benefit to hoisting the regular expression outside the 
loop:

my $re = qr/$split_char/o;
...
@data = split $re, $_;

If there's any, it will be tiny, but may be appreciable given your input size.

 # Populate array of hashes.  (This uses perl autovivification
 feature.)
 for (my $i = 0; $i  scalar @data; $i++) {
 $aoh[$i]{$data[$i]}++;
 }
 }

Nit: scalar @data can be replaced with @data.

 # print output
 print filename: $ARGV\n; # This writes a - if data is piped in
 if ($numlines 0) {
 print firstline: $firstline\n;
 }
 print numlines: $numlines\n;
 for (my $i = 0; $i  scalar @aoh; $i++) {
 # The number of keys in a hash is the count distinct number
 print field#: , $i, , distinct: , scalar keys %{$aoh[$i]}, \n;
Nit: This reads better as a printf, I think.

printf field#: %d, distinct: %d\n, $i, scalar keys %{$aoh[$i]};

 }

 exit $rc;

This is always 0, as noted above. 

My initial thought at improvement was to avoid the split and walk through each
line looking for a $split_char or a \n, but that just duplicates split in
perl instead of C. I think you've got just about the fastest program in perl.

For fun, I wrote a version in Go and it's twice as fast as the perl
version. I imagine a C version would be faster yet, but I get paid for that
kind of fun. I'd be happy to send you the Go version if you're interested.

-Gyepi

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


Re: [Boston.pm] perl program to count distinct values - can it be made faster

2014-03-08 Thread Gyepi SAM
On Sat, Mar 08, 2014 at 02:12:50PM -0500, David Larochelle wrote:
 On Sat, Mar 8, 2014 at 1:40 PM, Gyepi SAM gy...@praxis-sw.com wrote:
 
  For fun, I wrote a version in Go and it's twice as fast as the perl
  version. I imagine a C version would be faster yet, but I get paid for that
  kind of fun. I'd be happy to send you the Go version if you're interested.
 
 
 
 I'm curious how you account for disk caches when your bench marking. I
 fully expect that the CPU version of the code will be faster in GO than
 Perl. But I wonder how much this matters if the file isn't already in the
 disk cache.
 
 An interesting test would be to run the GO version first on a file that's
 you can be sure is not in the disk cache, then to run the Perl version on
 that file. I.e. let Perl benefit from the disk cache and see if GO is still
 faster.

I have an SSD drive on my linux laptop so disk caching plays less of a role in
my tests. I clear the cache with:

echo 3 | sudo tee /proc/sys/vm/drop_caches

I repeated the tests after clearing the disk cache each time and also ran each
test multiple times without clearing cache. The cached versions are a few
seconds faster, but the overall results are the same; the Go version is about 
twice as fast.

-Gyepi

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


Re: [Boston.pm] Inline::Java

2013-05-29 Thread Gyepi SAM
On Wed, May 29, 2013 at 01:41:56PM -0400, David Larochelle wrote:
 My biggest concern with Inline::Java is why it isn't more widely known and 
 used.

I would not read too much into the fact that a particular solution is not
popular. I have used, and continue to use, such tools when appropriate.

Having said that, most environments and programmers tend to be monolingual
and tend to prefer solutions that don't cross languages. It's an easy and safe
decision to make whereas the other requires careful thought and good reasons.

-Gyepi

-- 
Kites rise highest against the wind---not with it.
--Winston Churchill  

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


Re: [Boston.pm] Test code generation (was C++ books)

2013-04-16 Thread Gyepi SAM
On Mon, Apr 15, 2013 at 11:35:22AM -0700, Ben Tilly wrote:
 On Mon, Apr 15, 2013 at 11:09 AM, Greg London em...@greglondon.com wrote:
 For unit testing I've been emitting TAP
 protocol and testing it with prove, but are there better approaches?
 
 I get a test file with a lot of code that looks like this:
 
   printf(
 %s %d: Some useful description and maybe a number %d\n,
 (expected_value == test_value) ? ok : not ok, ++tests,
 some_useful_debugging_info
   );

This method is usually tolerable for a while but gets old as soon as
I realize I'm doing the computer's job much slower and less accurately.
Instead, I generate the test file from a simpler data file that only
contains the relevant test data.

I've successfully used three different approaches for this:

1. Extract the relevant data into a text file
   and use it as input to a program that produces the test file.
   This works well when the input has a lot of variety or could change in
   unexpected ways, but then you also have a code generator to maintain.

2. Extract the relevant data into XML and use gsl 
(https://github.com/imatix/gsl)
   to generate the test file. Works well when the test data varies in ways
   that can be relatively easily expressed by xml. While this approach works
   well, I don't particularly like editing xml so I actually write my data in a
   hierarchical text format and use, shameless plug, txt2xml 
(https://github.com/gyepisam/txt2xml)
   to convert it to xml. 

3. I have some similar things with autogen (apt-get install autogen) and it
   works pretty well too.

The various conversions from txt to xml to c and h, do produce long pipelines,
but I use make so I just define implicit rules and let make resolve the
dependency chain for me. Then I can kick it off with.

make test

It works quite well and the pieces are modular enough that the next guy is 
likely
to understand it. However, understanding is not required for effective use,
which is usually the primary goal.

-Gyepi

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


Re: [Boston.pm] Test code generation

2013-04-16 Thread Gyepi SAM
On Tue, Apr 16, 2013 at 11:35:55AM -0700, Ben Tilly wrote:
 On Tue, Apr 16, 2013 at 6:51 AM, Gyepi SAM gy...@praxis-sw.com wrote:
  On Mon, Apr 15, 2013 at 11:35:22AM -0700, Ben Tilly wrote:
  On Mon, Apr 15, 2013 at 11:09 AM, Greg London em...@greglondon.com wrote:
  For unit testing I've been emitting TAP
  protocol and testing it with prove, but are there better approaches?
 
  I get a test file with a lot of code that looks like this:
 
printf(
  %s %d: Some useful description and maybe a number %d\n,
  (expected_value == test_value) ? ok : not ok, ++tests,
  some_useful_debugging_info
);
 
  Instead, I generate the test file from a simpler data file that only
  contains the relevant test data.

 I think you're visualizing something different than my actual problem.
  There are indeed a lot of lines in my test file resembling the
 pattern that I showed.  But I do not primarily have values in/out.
 Instead I set up method calls, make them, then go poking around the
 innards of data structures and verify that they have what I expect
 them to have.  This requires intimate knowledge of the class that I'm
 testing, which is not so automatable.

Yeah, I'd have been quite surprised if my response solved your problem directly.

In general, I use code generation as a mechanism to give myself a little
more room between the various stages of program construction (edit, compile, 
run)
so I can insert a translation step which allows me to introduce new
modes of expression that more closely model the particular sub-problem
I'm trying to solve. Also, I'd rather write a program that writes programs.
Particularly when the resulting program is tedious.

I was not suggesting that data files should only contain in/out values.
Sometimes that is the case, but sometimes you need something more complicated.
In most cases, my data files actually specify some kind of a little language 
close
to the problem domain and my translator converts it back into the host language.
Actually, that reminds me you could also follow the old embedded SQL path and 
use a
tool like cog to simplify some of your tests.

Obviously, if the validity of the test depends on eyeballing the results
there's not much to say in the way of automation. Until you get tired of
eyeballing ;)

-Gyepi


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


Re: [Boston.pm] Perl and recursion

2013-04-10 Thread Gyepi SAM
On Tue, Apr 09, 2013 at 10:24:45PM -0400, Bob Rogers wrote:
map should produce better code and does reads better but it also
iterates the entire list and you can't break out of it . . .
 
 Not quite true, as you can goto a label outside of the block:
 
 sub find_odd {
   # Return the first odd argument.
   my (@values) = @_;
 
   my $result;
   map { $result = $_ and goto LAST
 if $_  1;
   } @values;
   LAST:
   return $result;
 }

Indeed, you are correct. However, when you break out of a map in this way,
the map returns an empty list, regardless of how many results had been 
previously
collected. 

Because your example handles a single result, it is not clear that, in fact,
any return values MUST be collected similarly. Unless, of course, map is used
simply for side effects.
 
 It's hard to think of a case where this would be better than a simple
 loop, which is both smaller and more readable.  However, this technique
 also gives you an early exit when mapping over a tree recursively.

Even then, the need to handle collected values manually would seem to obviate
any advantage in doing so.

This discussion has confirmed, for me, that writing code is, in many ways,
similar to writing prose. Though there may initially, appear to be many ways
to communicate, thoughtfulness, good taste and circumstance quickly show that
there are only a few good ways to do so.

-Gyepi 

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


Re: [Boston.pm] Perl and recursion

2013-04-06 Thread Gyepi SAM
On Sat, Apr 06, 2013 at 09:11:55AM -0400, David Larochelle wrote:
 Are languages that have mark and sweep garbage collection better about
 returning memory to the system than languages like Perl that use reference
 count garbage collection.

Not usually.  On Unix systems, at least, memory is acquired from (and released
to) the system using sbrk. malloc(3) and free(3) are actually front ends to
sbrk. free marks memory as available to be reallocated, but only returns 
memory when there is enough of it at the high end of the heap. Depending
on usage patterns this is unlikely to happen naturally unless memory is first
compacted.

This is an additional step to the garbage collection and not many languages do 
it AFAIK.
I know Lisp can do this, but only to avoid fragmentation and does not return 
the memory.

It is generally not necessary to return memory to the system because
most modern operating systems provide a virtual view of memory so every
program appears to have access to the entire memory space. Most of the time
this works fine. Programs that allocate too much get swapped out when
necessary. If you don't want that for your program, you can always use
mlock(3) and friends.

-Gyepi

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


[Boston.pm] Tone: was (Passing large complex data structures between process)

2013-04-05 Thread Gyepi SAM
John, I don't know you, and it's quite possible that I am misinterpreting
your normal modes of communication, but your responses seem quite heated,
intemperate, and rather personal. There are certainly places for that on the 
internet,
but the collegiality of this list is one of the reasons I, for one, remain 
subscribed.
I think we can discuss the merits of the suggested solutions without the 
aspersions.

Regards

-Gyepi


On Fri, Apr 05, 2013 at 06:35:58PM -0400, John Redford wrote:
 Ben Tilly expands:
  On Fri, Apr 5, 2013 at 12:04 PM, John Redford eire...@hotmail.com wrote:
   Your writing is FUD.
  
  Are you reading something into what I wrote that wasn't there?
  Because I'm pretty sure that what I wrote isn't FUD.
 
 It was. Ask anyone. I'm not your English tutor.
 
  A pull-based system relies on having the job that does the work ask for
 work
  when it's ready.  A push-based system relies on pushing to a worker.
 
 So, let's get this straight, pro.


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


Re: [Boston.pm] Perl and recursion

2013-04-05 Thread Gyepi SAM
On Fri, Apr 05, 2013 at 09:03:13PM -0400, Conor Walsh wrote:
 why is this that much faster than actual recursion?  That speaks
 poorly of lowercase-p perl.

This is not a perl specific issue (for the most part).

Most languages that support function calls need to maintain an activation
record for every call in order to keep track of, at the very least,
parameters, return values, next action, etc [1]. A recursive function creates
a chain of these records.

So, Uri's suggestion is faster because replacing recursion with iteration and
stack operations uses fewer resources than the runtime does in maintaining a 
call stack.
More to the point though, one avoids the built in limits, or rather, exchanges 
that limit
for memory limits.

I don't think this speaks poorly of perl at all.
Every operation has a cost, after all, and function calls are relatively 
expensive.
Certainly more so than iteration or array operations.

[1] There are a couple of ways to avoid this problem while still maintaining the
benefits of recursion. One is to use threaded code, as in Forth, or more 
commonly,
to use tail recursion (or tail call elimination), which re-uses the current 
activation
record for the recursive call, iff the recursive call occurs at the end of the 
function
since that means that the only state we need store are the return values.
Since those are on the stack, they can, with a bit of pointer twiddling or 
copying,
become the parameters to the next call.

A number of languages do this, to great advantage.
Perl does not have tail call elimination. However, it is mentioned in 
Porting/todo.pod

-Gyepi

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


Re: [Boston.pm] Passing large complex data structures between process

2013-04-04 Thread Gyepi SAM
On Thu, Apr 04, 2013 at 04:21:54PM -0400, David Larochelle wrote:
 My hope is to split the engine process into two pieces that ran in
 parallel: one to query the database and another to send downloads to
 fetchers. This way it won't matter how long the db query takes as long as
 we can get URLs from the database faster than we can download them.

If this is, indeed the bottle neck, then I would think that splitting them
into two communicating processes would solve the problem.

Using files, as I mentioned in my previous email, is probably considered
old school but is probably the simplest communication method.
Unfortunately, it won't work once your system scales to multiple machines.
As described, it sounds like the current system runs on a single machine,
so this may not be an immediate problem. If you are planning to scale across
machines, then I'd second the recommendation to use a message queue instead.

-Gyepi

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


Re: [Boston.pm] Passing large complex data structures between process

2013-04-03 Thread Gyepi SAM

On Wed, Apr 03, 2013 at 10:34:17AM -0400, David Larochelle wrote:
 I'm trying to optimize a database driven web crawler and I was wondering if
 anyone could offer any recommendations for interprocess communications.
 
 Currently, the driver process periodically  queries a database to get a
 list of URLs to crawler. It then stores these url's to be downloaded in a
 complex in memory and pipes them to separate processes that do the actual
 downloading. The problem is that the database queries are slow and block
 the driver process.
 
 I'd like to rearchitect the system so that the database queries occur in
 the background. However, I'm unsure what mechanism to use. In theory,
 threads would be ideally suited for this case but I'm not sure how stable
 they are (I'm running Perl 5.14.1 with 200+ cpan modules).
 
 Does anyone have any recommendations?

Here's my 5 cents worth [1].

I would imagine that the database query, though slow, produces results
faster than the crawlers consume them.
So the problem sounds like one about maintaining a minimum queue size. 

An actual queue would be the obvious solution, but that brings in Threads,
which you want to avoid.

I can think of a couple of other other solutions:

Since you need parallelism, both depend on moving the database querying to
another process.

The database transfer from the db (producer) process to the driver (consumer)
process could use files or a socketpair between parent and child.

File solution:

The producer program reads the database and writes the data
into files in chunks of size N. The consumer program, when it runs
low, reads one of the files and renames it.

To simplify access, I would use the maildir model and use the three directories

.../tmp
.../ready
.../done

The producer writes each file into tmp and uses rename to move the file
from tmp to ready. Luckily, perl's rename is a wrapper around rename(2)[2]
so you gain the critical benefit of atomicity here.

Similarly, the consumer reads a file in ready and
renames it into done. Periodically, you'll want to clean out done.

SocketPair:

Make the producer a parent process of the
consumer. The producer creates a socketpair and forks the consumer. The
producer prefetches the data and writes it to the socket when the consumer
signals a need for more data. Both would need to use select otherwise one
or the other could block, defeating the goal of the exercise.

I should point out that technically, the processes don't have to be related
and you really only need sockets. The producer only needs to prefetch and
buffer data and provide it as soon as possible.
A simple server can do that in a tight loop all day long (I don't recommend it
though unless you have a feedback mechanism into the database to ensure that
it always gets the correct results even in the face of an earlier error).

[1] Inflation.
[2] I am making the big assumption that you are on a unixish system here.
If that's true, then you can also add notifications as well, if you care.

-Gyepi

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


Re: [Boston.pm] New Xkcd feaaturing Perl

2013-02-15 Thread Gyepi SAM
Hmm, I also spot allusions to a Jay Z song and a JWZ quote.
Maybe Randall had /J.+Z/ on the mind.

-Gyepi

On Thu, Feb 14, 2013 at 12:57:44PM -0500, Federico Lucifredi wrote:
 http://www.xkcd.org/1171/

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


Re: [Boston.pm] The second P

2012-01-26 Thread Gyepi SAM

I have found the hard way (of going through the documentation) to be quite
effective.

First, I read the tutorial, then skimmed the language reference, then I jumped 
into the library reference with the
occasional return to the language reference when I needed to convince myself
that python's syntax did not allow for whatever construct I had my heart set
on.

It's a bit slow initially but the language is simple enough that the pace picks 
up
pretty quickly.

Regards

-Gyepi

On Thu, Jan 26, 2012 at 08:12:45PM -0500, Federico Lucifredi wrote:
 Okay guys,
   I haven't gotten a definite answer on this when I asked a couple of years 
 back, so I'l ask again - flog me as you may :)
 
   I have a need to properly learn a certain other P language, and I do not 
 mean PHP either.  For Perl, my favorite concise summary is the first 
 chapter of Damian's OO Perl book.  What about the other, unnamed, language? 
 Guido has written up a short language on the book, but what else has proven 
 popular with people who already knew Perl to expand their range of dynamic 
 languages - without reading hundred of pages?
 
  Thanks -Federico
 
 PS: I promise to flog myself if you guys actually come up with a good 
 suggestion!
 
 _
 -- 'Problem' is a bleak word for challenge - Richard Fish
 (Federico L. Lucifredi) - flucifredi at acm.org - GnuPG 0x4A73884C

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


[Boston.pm] looking for MaxMind contact

2011-10-02 Thread Gyepi SAM
Hi - 

A friend is looking for a contact at MaxMind and I wonder if I could pass on
an intro through anyone on this list. Please respond off-list.

Thanks!


-Gyepi

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


Re: [Boston.pm] arriving tonight - emergency social meet monday or tuesday?

2011-05-15 Thread Gyepi SAM

On Sun, May 15, 2011 at 12:12:47PM -0400, Uri Guttman wrote:
  RLS == Randal L Schwartz mer...@stonehenge.com writes:
   RLS Was there any consensus on a date (tuesday or monday) and/or a place
   RLS for my emergency social meet?
 
 that is on me. i say we meet on tuesday night at 7pm. i haven't figured
 out a place yet but i will. any suggestions are welcome from the list so
 send them in.
 
 the harborside inn is near faneuil hall which is full of tourist traps
 and expensive parking so i say not around there. our usual place cbc is
 possible. so is redbones or even the flatbread pizza place we met at
 recently.

I'll be in the Boston area Tuesday and would be most happy to
join in this social meeting wherever it ends up.
So I vote for Tuesday!

Regards

-Gyepi


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


Re: [Boston.pm] $#{$Queue}

2010-09-28 Thread Gyepi SAM
On Tue, Sep 28, 2010 at 07:07:38PM -0400, Greg London wrote:
 Ive used $arr[-2] to get the second to last element of an array.
 But anyone using $[ to change the first index of an array to be
 negative should be beaten severely.

I had initially thought this too; though I imagined something
worse than a beating. However, upon further thought, I think it
can be occasionally useful to change the first index of an array.

Unfortunately, the most useful example I can come up with is from another
language.

In Lua, the equivalent of $ARGV[0] contains the script name while lower
indices reference earlier parts of the invocation. So

  lua -i script.lua 24

creates the equivalent of

  $ARGV[-2] = 'lua'
  $ARGV[-1] = '-i'
  $ARGV[0] = 'script.lua'
  $ARGV[1] = '24'


The point here being that the useful data starts at $ARGV[0] while,
perhaps less useful, data exist at earlier indices. Of course this is
a contrived example and Lua arrays are different enough from Perl arrays
to make this simple.

I think '$[' would more useful if it could be scoped to individual arrays.
Though it does seem to be of dubious utility to begin with.

-Gyepi

___
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-29 Thread Gyepi SAM
On Tue, Jan 29, 2008 at 12:11:56PM -0500, Tolkin, Steve wrote:
 I am looking for a perl program that will solve the following problem.
 Suppose I have 2 or more lists that are (conceptually) sublists of the
 same underlying list.
 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.
 
 Example:
 List 1: dog, cat, mouse
 List 2: dog, shark, mouse, elephant
 
 There are 2 possible outputs, and I do not care which one I get.


Sounds like a problem begging for tsort.
'man tsort' or 'info coreutils tsort'.
Should be on most unixoid systems.

You'd need to pre-process your data into pairs of strings
and feed that to tsort, which will produce one of the possible
totally ordered outputs.

$ tsort EOS
dog cat
cat mouse
dog shark
shark mouse
mouse elephant
EOS

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


Re: [Boston.pm] Send Setup commands to Brother HL5250 printer?

2007-11-07 Thread Gyepi SAM
Hi Bob,

CUPS would definitely not expect PCL input. Not sure if it's possible to tell
it otherwise.

A couple of suggestions:

If you're generating PCL from your program, you may want to consider filtering
it through GhostPCL which converts PCL into Postscript.

If you're not averse to python, labelnation 
http://www.red-bean.com/labelnation/
prints labels quite well. I doubt it will have support for your
particular labels,  but it's quite easy to add new labels. I've had very good
luck with it. It used to be a perl program, BTW.

postscript does not have the concept of margins. by default, printing starts
on the edge of the paper (or nearly so). However, CUPS does have margin 
settings:
see the ppd file for your printer. I suspect you'll need to modify the 
'ImageableArea' values.

Here's how you set a font a postscript:

%Set font to 12 point Helvetica
/Helvetica findfont 12 scalefont setfont

HTH

-Gyepi

On Tue, Nov 06, 2007 at 12:10:45PM -0500, R. Mariotti wrote:
 Fellow luggers;
 
 I have a short perl program that prints labels n-up on standard letter 
 sized pages (actually Panduit Labels).
 
 This originally printed to an HP2600 printer which has since been 
 retired and replaced with a Brother HL5250DN printer.
 
 This printer is connected via CUPS on Linux so I am not sure if cups is 
 converting the output to postscript or sending pcl.  The printer 
 emulation is set to pcl (but I know it can change dynamically).
 
 I have been trying to send pcl commands from my perl program to modify 
 the offsets, margins, typeface, etc with NO success.
 
 Therefore, has anyone printed such commands before and especially to 
 this printer?
 
 My method is really simple such as:
 
 print OFH \x1B\a0L;# Set Left Margin to Zero columns
 
 When run the esc (x1B) is being eaten but the a0L prints as text 
 indicating that the printer is NOT recognizing it as a command.
 
 That would indicate to me that cups is sending the output as postscript 
 which switches the printer to PS mode so it would not intercept the pcl 
 commands.
 
 If that is true, can anyone PLEASE provide some equiv PS commands to set 
   some of the parameters?  I've search the PS docs with no clear examples.
 
 Thanks in advance for any assistance.
 
 Bob
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Reading a variable CSV file with embeded newlines

2007-06-08 Thread Gyepi SAM
On Fri, Jun 08, 2007 at 03:26:56PM -0400, Alex Brelsfoard wrote:
 I have a CSV file where each line may NOT have the same number of fields.
 One item per line.

xSV is line oriented: as long as each line is well formed it should be parsed
correctly. Making sense of the data may be more difficult though.

 But occasionally a field in an item will have one or more newlines in it.
 How can I break this up correctly?

Embedded newlines are OK as long as the field is quoted. However, not all
tools will parse the field correctly. Last time I checked, Text::CSV and
Text::CSV_XS do not. I suspect Text::xSV will be better behaved. There are
other, non Perl, tools that should work fine as well.

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


Re: [Boston.pm] Calling a function that will return to where the grandparent called the parent

2007-05-31 Thread Gyepi SAM
Hi Alex,

What you're asking is possible, especially since you only asked for quick and 
easy
and said nothing about elegant ;)

The situation you describe is known as a 'condition' in Lisp, which allows
you to define the catch and handle exceptional conditions in your program,
including *restarting* the offending piece of code (presumably after
changing program state to prevent looping). Most other languages use a
catch-throw construct, which is spelled die-eval in Perl.

Basically, you need to place an eval in Plort and die in Error with a
specific error string (or other unique value) that Plort can use to
distinguish your particular situation from some other error. As you can see,
both routines have to cooperate to make this work: one to throw the error and
the other to catch it.

Here's an example.

#!/usr/bin/env perl

use strict;

$\ = \n;


#note the all important newline, which prevents perl from helpfully appending
#more text to our error string.
our $ERROR_CONDITION = Error-Condition\n;

sub Plort {
  print in Plort, calling Foo();

  eval {
Foo();
  };

  if ($@){
if ($@ eq $ERROR_CONDITION) {
  print caught error condition. All is well;
}
else {
  #some other error
  die;
}
  }

  print in Plort, back from Foo();
}

sub Foo {
  print in Foo, calling Error();
  Error();
  print in Foo, back from Error, but you'll never see this line;
}

sub Error {
  print in Error;
  die $ERROR_CONDITION;
}

__END__

Plort();
On Thu, May 31, 2007 at 02:11:44PM -0400, Alex Brelsfoard wrote:
 Hi All,
 
 I'm looking for a quick and easy way to have this situation happen:
 
 sub Plort {
 ...
 ...
Foo();
 ...
 }
 
 sub Foo {
 ...
 ...
 Error();
 ...
 }
 
 
 I want it to happen that when Error() is called, when Error() finishes doing
 what it does it returns you to it's parent's parent (Plort() in this case).
 I don't want to have to specify anything.
 I want it to always return you to where Error()'s grandparent called it's
 parent.
 
 Any ideas of how to do this?
 
 Thanks.
 --Alex
 
___
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Calling a function that will return to where the grandparent called the parent

2007-05-31 Thread Gyepi SAM
On Thu, May 31, 2007 at 03:22:32PM -0400, Gyepi SAM wrote:
 Here's an example.

Small editing error with my example: the '__END__' should be after the call to
Plort().

-Gyepi

+ Plort();
+ 
+ __END__

instead of

- __END__
- 
- Plort();


 
___
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 Gyepi SAM
On Mon, Nov 13, 2006 at 04:14:32PM -0500, R. Mariotti wrote:
 I have been searching for a good all-around ldap server to support my project.

I've set up OpenLDAP servers, mostly for samba authentication and it works 
great!

The last installation was 2 or 3 months ago in a 24/7 environment with 
replicated servers,
and it's still humming along. A bit of a pain to setup, mostly because of the
Samba requirements, but works great once you get it. Banged my head against a
wall or two trying to figure out why I could not authenticate until I rebuilt
and reinstalled the rpms (on a FC4 system) server from latest sources at which
point, it worked beautifully.

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


Re: [Boston.pm] Combinatorics (Permutations)

2005-11-30 Thread Gyepi SAM
On Wed, Nov 30, 2005 at 12:34:58PM -0500, Andrew Medico wrote:
 The anwser is that there is no such thing as a list of lists in Perl -

Don't forget the footnotes:

my @lol = map { [ $_ ] } (0 .. 7);
my $lol = [map { [ $_ ] } (0 .. 7)];

The former is a list of list refs and the latter is a list ref of
list refs and is generally called a list of lists though it's
technically neither.

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


Re: [Boston.pm] how to safely access syslog from CGI

2005-10-03 Thread Gyepi SAM
On Mon, Oct 03, 2005 at 05:14:44PM -0700, Ranga Nathan wrote:
 I need to scan the /var/log/messages to provide some tracing info through 
 a CGI. The catch is /var/log/messages is readable only by root and 
 rightfully so. But I do need 'nobody' to be able to scan it.
 I run apache2.
 What is the best way to preserve the security and yet make this happen?
 Thanks

Here are some options, not necessarily recommendations;

1. Change the permissions on the file so it is world readable
2. If #1 is too permissive, change the group owner and put nobody in that group.
3. Modify /etc/syslog.conf so syslog writes to an alternate/additional file 
that is readable by nobody.
4. Write or find an suid program/daemon/server to provide read access to the 
log file.
5. Write a cron driven script that will scan the log file and write the
   results to another file that nobody can read.

And many more in a similar vein.

-Gyepi

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


Re: [Boston.pm] possible bug in File::Copy?

2005-07-07 Thread Gyepi SAM
On Thu, Jul 07, 2005 at 12:56:52PM -0400, Alex Aminoff wrote:
 I havent seen any response to my post... I suppose I will take the deafening 
 silence as evidence that there is nothing so flawed about my reasoning as to 
 leap out at the casual observer...

Hi Alex,

perl hasn't changed, File::Copy.pm has changed. Between v2.06 and v2.07,
corresponding to perl v5.8.2 and perl v5.8.3, respectively,

Note the following deletions in the diff:

-no warnings 'io'; # don't warn if -l on filehandle
-if ((-e $from  -l $from) || (-e $to  -l $to)) {

...

 }

--- perl-5.8.2-lib-File-Copy.pm 2003-09-30 13:10:50.0 -0400
+++ perl-5.8.3-lib-File-Copy.pm 2003-12-04 08:11:49.0 -0500
@@ -24,7 +24,7 @@
 # package has not yet been updated to work with Perl 5.004, and so it
 # would be a Bad Thing for the CPAN module to grab it and replace this
 # module.  Therefore, we set this module's version higher than 2.0.
-$VERSION = '2.06';
+$VERSION = '2.07';
 
 require Exporter;
 @ISA = qw(Exporter);
@@ -77,13 +77,12 @@
croak('$from' and '$to' are identical (not copied));
 }
 
-if ($Config{d_symlink}  $Config{d_readlink} 
-   !($^O eq 'Win32' || $^O eq 'os2' || $^O eq 'vms')) {
-   no warnings 'io'; # don't warn if -l on filehandle
-   if ((-e $from  -l $from) || (-e $to  -l $to)) {
+if ((($Config{d_symlink}  $Config{d_readlink}) || $Config{d_link}) 
+   !($^O eq 'MSWin32' || $^O eq 'os2' || $^O eq 'vms')) {
my @fs = stat($from);
+   if (@fs) {
my @ts = stat($to);
-   if (@fs  @ts  $fs[0] == $ts[0]  $fs[1] == $ts[1]) {
+   if (@ts  $fs[0] == $ts[0]  $fs[1] == $ts[1]) {
croak('$from' and '$to' are identical (not copied));
}
}


 
  - Alex Aminoff
BaseSpace.net
 
 - Original Message - 
 From: Alex Aminoff [EMAIL PROTECTED]
 To: boston-pm@mail.pm.org
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, June 23, 2005 8:28 AM
 Subject: [Boston.pm] possible bug in File::Copy?
 
 
 
  Hi folks. I use File::Copy in a backup system to copy to and from things
  that are sometimes filenames and sometimes IO::Gzip filehandles.
  Everything was OK until sometime in the past year or so when I started
  seeing a lot of messages like
 
  stat() on unopened filehandle GEN0 at /usr/lib/perl5/5.8.5/File/Copy.pm
  line 84.
 
  I did some investigation and found that my files were being copied just
  fine. Some more investigation and I concluded that File::Copy was
  calling stat() on something, which might be a file name or a filehandle
  object, but ignoring the result unless it happened to be a file name, so
  operating correctly. I surmise that an upgrade to perl 5.8.5 or so added a
  check for stat() on an unopened filehandle as a helpful warning, and that
  upgrading perl started these messages.
 
  The warnings, while harmless, were landing in folks' email inboxes and
  they were being annoyed, so I ended up putting a SIG{__WARN__} = sub{...}
  and SIG{__WARN__} = undef around the copy command, just to suppress the
  warning messages. This seems inelegant.
 
  Could I have found a bug, or rather a formerly acceptable but now less so
  formulation, that I found in File::Copy? I dove in and modified
  File::Copy, replacing lines 82-84 with the following:
 
  my @fs = $from_a_handle ? () : stat($from); # TEST BY ALEX
  if (@fs) {
  my @ts = $to_a_handle ? () : stat($to); # TEST BY ALEX
 
  and in fact the warnings were gone.
 
  So my question is, am I correct? And if so, can I submit a patch or
  something to the maintainers of File::Copy? I wanted to ask here first,
  fairly confident that if my reasoning was flawed you would spot it.
 
  Thanks,
 
   - Alex Aminoff
 BaseSpace.net
 
  ___
  Boston-pm mailing list
  Boston-pm@mail.pm.org
  http://mail.pm.org/mailman/listinfo/boston-pm
  
 
  
 ___
 Boston-pm mailing list
 Boston-pm@mail.pm.org
 http://mail.pm.org/mailman/listinfo/boston-pm

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


Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Gyepi SAM
On Mon, May 09, 2005 at 07:48:09AM -0700, Palit, Nilanjan wrote:
 I want to redirect print output to both stdout  a file at the same
 time: I can think of writing a sub that executes 2 print statements (one
 each to stdout  the filehandle), but I was hoping someone has a more
 elegant solution.

Your solution is basically correct. The devil, however, is always in the
details and IO::Tee should take care of those for you.

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


Re: [Boston.pm] HTML Renderer

2005-03-08 Thread Gyepi SAM
On Tue, Mar 08, 2005 at 12:06:26PM -0600, Alex Brelsfoard wrote:
 You might also want to lookin into Image::Magick.  It does some pretty
 impressive things and I could have sworn I read somehwere that it could do
 just that.  I have used Image:Magick before and it's very fun and easy.  I
 would definitely suggest looking into it.  I will too if I get some time
 later.

Ah yes, a clue!

It turns out that there is an html to postscript converter
  
  http://user.it.uu.se/~jan/html2ps.html

and, of course, ImageMagick can convert from postscript to other image
formats...

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


Re: [Boston.pm] HTML Renderer

2005-03-08 Thread Gyepi SAM
On Tue, Mar 08, 2005 at 02:02:47PM -0500, Chris Devers wrote:
 On Tue, 8 Mar 2005, Gyepi SAM wrote:
 
  On Tue, Mar 08, 2005 at 12:06:26PM -0600, Alex Brelsfoard wrote:
   You might also want to lookin into Image::Magick.  
  Ah yes, a clue!
  
  It turns out that there is an html to postscript converter

http://user.it.uu.se/~jan/html2ps.html
 
 Is it aware of CSS and Javascript? The documentation --
 
   http://user.it.uu.se/~jan/html2psug.html

I don't know. I only glanced briefly at the documentation.

 -- implies that it's aware of CSS (in fact, the config file syntax looks 
 like it's just CSS), but I see no mention of Javascript, which can be at 
 least as important in controlling what ends up on a page.
 It may be attacking a small nut with an enormous hammer, but wouldn't 
 the best approach to this be some kind of scriptable wrapper around the 
 Gecko or KHTML rendering engine? That way you're starting out with the 
 way the represented in a standard client side browser's engine.

You raise good points, and I think that would be the most general approach
if the intent is to convert arbitrary web pages to images. However I don't
know what the original poster had in mind.

 Similarly -- and this way lies madness, I admit up front -- just run the 
 script on a system that can use AppleScript or COM (or WSH or whatever 
 it is, I'm not a Windows programmer) to just automate interacting with a 
 regular browser like Firefox or Safari, and save the result that way. If 
 you run it on OSX, you can go straight from this to a PDF file for free.

That would work too. The simplest solution though, may be to simply feed a url
to the browser and ask it to print the page as a postscript file, which would
then be handed off to ImageMagick. Mozilla and Firefox (at least on Unix) have
the (mozilla|firefox)-remote program but it appears that the
'saveAs(postscript)' command is not implemented, according to this file.

  
http://lxr.mozilla.org/seamonkey/source/xpfe/components/xremote/src/XRemoteService.cpp

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


Re: [Boston.pm] Were to start ?

2005-03-05 Thread Gyepi SAM
On Sat, Mar 05, 2005 at 07:29:31PM -0800, Arthur Perkins wrote:
 I am very new perl user,

Welcome, very new perl user.

 and I am interested in
 starting a project with a product called ModBus. It is
 an embedded application for industrial controllers. I
 am not quite clear on how to start.

At such times, I have found Alice in Wonderland to be quite instructive.

To wit:

  `Begin at the beginning,' the King said gravely, `and go on
  till you come to the end:  then stop.'

Or this exchange:

  `Would you tell me, please, which way I
  ought to go from here?'

`That depends a good deal on where you want to get to,' said
  the Cat.

`I don't much care where--' said Alice.

`Then it doesn't matter which way you go,' said the Cat.

`--so long as I get SOMEWHERE,' Alice added as an explanation.

`Oh, you're sure to do that,' said the Cat, `if you only walk long enough.'


If, however, you really want to get work done, google seems like a good place
to start.

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


Re: [Boston.pm] regex in RHS of s/// spotted

2005-03-03 Thread Gyepi SAM
On Thu, Mar 03, 2005 at 10:45:28AM -0500, Kripa Sundar wrote:
 An unnamed White House source today stated that regexes are
 beginning to infiltrate the RHS of substitutions, and thus
 threaten our national security.
 
 This was corroborated by the following sighting:
 
  s/Perl/(Bike Riding|Gardening|Cooking|Painting|Teaching|Filmmaking)/;

Oddly enough, the the syntactically correct code does not quite have the same
meaning or elegance. Note that I modified the list slightly to avoid manual
quoting:

s/Perl/$z=sub { $_[rand(@_)] }; $z(qw(Biking Gardening Cooking Painting 
Teaching Filmmaking))/e;

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


Re: [Boston.pm] RPM building (was: Bottom Up)

2005-03-01 Thread Gyepi SAM
On Tue, Mar 01, 2005 at 03:16:06PM -0500, Duane Bronson wrote:
 Is there a CPAN distribution just as there are Linux distributions?  
 In other words, a collection of CPAN modules that one can install as a 
 bundle rather than having to use the perl -MCPAN install 
 module_that_wont_compile?  ActiveState provides PPM which take a lot 
 of pain out of CPAN since so much stuff just doesn't compile on Windows, 
 but modules that don't compile are simply excluded from the PPM 
 database.  Also, some Linux distributions have packages that bundle a 
 bunch of perl modules together, unfortunately, they only work with that 
 Linux distro.  I would prefer a standard distribution of modules for all 
 platforms beyond the limited stuff that comes with the perl install.

I don't know of any CPAN distributions. However, if you are on an RPM based
system, you might try my ovid program

 http://search.cpan.org/~gyepi/Ovid-0.06/ovid

which recursively converts CPAN modules into rpms by following dependencies.
It makes a normally painful and tedious task very easy.
It's rpm specific because that's what I usually use, but that needn't be.

-Gyepi

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


Re: [Boston.pm] perl6/pugs

2005-02-28 Thread Gyepi SAM
On Mon, Feb 28, 2005 at 01:40:35PM -0500, Kenneth A Graves wrote:
 I haven't gotten around to playing with Pugs yet, but I did build
 Haskell this weekend.  It's a functional-programming conspiracy.

It must be: I am using LISP, after a long hiatus, and really liking it. I
simply did not appreciate its power upon introduction six years ago.

As I recall, there are quite a few cross language programmers on this
list...

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


Re: [Boston.pm] more on hosting and email suggestions, any experience with VPS?

2004-12-08 Thread Gyepi SAM
On Wed, Dec 08, 2004 at 11:55:40AM -0500, Andrew Langmead wrote:
 On Dec 5, 2004, at 2:26 PM, Gyepi SAM wrote:
 
 The main disadvantage I have found is that you cannot run commands 
 which
 require real root privileges. For instance: iptables does not work and 
 init
 is really a fake init which cannot be controlled.
 
 Thank you for pointing that out. I assumed that I would be able to use 
 iptables on the virtual interface (to do things like prevent the 
 machine from initiating network connections.)
 
 Maybe I need to do more experimenting with user-mode so I'm not making 
 assumptions on what it can or can't do.

As I mentioned in a follow-up message, my provider actually uses Virtuozzo
and not UML as I originally stated. According to John West, in a private
email, neither of those limitations exist on his UML based VPS. Further
investigation has also revealed that the iptables limitation, at
least, is merely a provider policy: they don't include iptables support
in the VPS kernels.

I guess the lesson here is: don't use my provider if you really want full
control of your environment!

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


Re: [Boston.pm] reading in a directory

2004-12-08 Thread Gyepi SAM
On Wed, Dec 08, 2004 at 12:20:38PM -0500, Uri Guttman wrote:
 browsers were never designed to do much and they are overloaded to the max
 now. classic marketplace beating out quality (in terms of the
 http/browser platform for all things).

Amen! Truer words were never spoken. You would not believe the number of
times, I have determined the best solution to be a client based GUI app using
tk or WxWidgets (formerly WxWindows) then been forced,  instead, to use a
browser because everybody knows how to use a browser!

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


Re: [Boston.pm] more on hosting and email suggestions, any experience with VPS?

2004-12-07 Thread Gyepi SAM
On Sun, Dec 05, 2004 at 01:11:00AM -0500, Andrew Langmead wrote:
Does anyone have any  experience with any companies providing Virtual Private 
Server (also 
 called Virtual Dedicated Hosting)?

After years of using shared hosting services, I switched about a year ago to a
UML based VPS with tektonic.com and am quite happy with it.

For $35/month, I get 4GB of space and two IP addresses with root access to a
virtual server on which I run smtp,dns, and http services.

I really like the fact that I can control almost everything and can run any
services I want and am not completely at the mercy of the administrator's
paranoia, ignorance or schedule.

The main disadvantage I have found is that you cannot run commands which
require real root privileges. For instance: iptables does not work and init
is really a fake init which cannot be controlled.

The providers have been very responsive to my needs. They initially had some
growing pains when I first started with them, but have since become quite
reliable.

I am also interested in other people's experiences with similar services.

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


Re: [Boston.pm] more on hosting and email suggestions, any experi ence with VPS?

2004-12-07 Thread Gyepi SAM
On Tue, Dec 07, 2004 at 03:14:13PM -0500, Philipp Hanes wrote:
 
  -Original Message-
  From: Peter Wood [mailto:[EMAIL PROTECTED]
  I just visited www.tektonic.com, and they appear to be an
  acquisitions/holding company... do you have a direct link to
  information on their services?

 looks like it ought to be www.tektonic.net

Indeed! Thanks for the correction Philipp.

Upon further investigation, it turns out that my provider switched sometime
ago to Virtuozzo, which probably explains the reliability improvement.

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


Re: [Boston.pm] OT: RPMS (was: Recommendation for mail server)

2004-12-02 Thread Gyepi SAM
On Thu, Dec 02, 2004 at 09:17:10PM -0500, Bob Rogers wrote:
(Though I may do so eventually, if I ever
 finish building RPMs for the qmail suite.)

All the djbware required to run qmail is now available as rpms.
See: http://untroubled.org/rpms/

To keep this on topic, but only marginally: I have released a perl program,
Ovid, which builds rpms for CPAN modules. Unlike other similar tools, follows
most dependencies and builds them too!

-Gyepi

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


Re: [Boston.pm] OT: pgp migrate question?

2004-11-16 Thread Gyepi SAM
On Tue, Nov 16, 2004 at 09:22:17AM -0500, Bob Mariotti wrote:
 root directory on the DR machine.  However, while when we display our 
 keyring (i.e.: pgp -kv) we can SEE the keys but the documented 
 passphrase will not work.
 Any ideas, thoughts, suggestions greatly appreciated!

You may want to trace the program execution in both environments to verify your
assumptions. Apparently the strace/truss equivalent on AIX is called sctrace.
You may also find it useful to enable any options that limit tracing to file 
related activities.

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


Re: [Boston.pm] Old algorithms

2004-11-11 Thread Gyepi SAM
On Thu, Nov 11, 2004 at 08:48:16PM -0500, William Ricker wrote:
 
  When I first read Knuth's TAOCP books, in ...
   I have since realized that we also have more data *and* those algorithms do
  contain some very nice gems that are still useful. If 
 Definitely.
 
 The bible for actually building space-limited sorting tools is Hal Lorin's 
 book /Sorting and Sort Systems/, (ISBN:0201144530) Lorin, Harold; in the A-W 
 seies, the old white-and-gold ones done by IBM researchers. 

Thanks for the recommendation, Bill. I have located and ordered a copy. I look
forward to reading it.

 If someone buys a beer, I'll explain how I came to study this tome so hard, 
 so long ago. It involved several write-only languages and Perl-67 as MJD 
 refers to PL1.

I'll buy you two beers if the story is interesting and educational, but it may
be a while before I head to Boston: I now live in Westhampton, MA.

-Gyepi

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


Re: [Boston.pm] OT - A SpamAssassin question

2004-11-04 Thread Gyepi SAM
On Wed, Nov 03, 2004 at 09:29:02PM -0800, Ranga Nathan wrote:
 I want to filter my mail from sendmail through SpamAssassin but redirect 
 to my cox.net address.

 I understand that SpamAssassin requires filtering via procmail.

SpamAssassin does *not* require procmail. You are using procmail here as a
Mail Delivery Agent (MDA).

 So I set 
 up /etc/.procmailrc to say:
 DROPPRIVS=yes 
 :0fw
 *  256000 
 | /usr/bin/spamc 

Now you need to forward

:0
! [EMAIL PROTECTED]

 and then brought up the /usr/bin/spamc daemon.
 
 What do I have to tell Sendmail to filter this 28MB of mail through 
 procmail, and then forward only non-SPAM mail to my cox.net address?

This depends on where the mail is stored.

If it is still in the sendmail mail queue (doubtful), you invoke sendmail to deliver 
it,
I stopped using sendmail years ago, so I can't help there.

If it has already been delivered, then you have to invoke procmail
manually. Note that in that instance, it may be wise to rename the mail file first.

formail -s procmail  /mail/file

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


Re: [Boston.pm] OT - A SpamAssassin question

2004-11-04 Thread Gyepi SAM
 If you already have all of this mail rattling around, then use
 'formail' to cause it to be re-delivered.

Technically, using formail for mail that's already rattling around is
just processing, not delivery. Only the MTA can deliver mail, perhaps
by using an external MDA. The distinction becomes very important if you re-inject
previously delivered messages back to the MTA: many will balk and bounce them.

Pedantry makes few friends, but the point must be made nonetheless ;)

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


Re: [Boston.pm] OT: setting up site for private file exchange and discussion

2004-10-14 Thread Gyepi SAM
On Thu, Oct 14, 2004 at 05:54:27PM -0400, Greg London wrote:
 a possible option might be to set up a secure
 FTP area on my website, but I have no clue how
 to do that. Is there a simple way to tell FTP
 who can and cannot view a particular directory
 and keep track of usernames/passwords, etc?

You can do this very nicely using a chrooted sftp-server subsystem under ssh.
The result is a very secure FTP area with great user management and access control.
Best of all, it works great with Windows and Mac clients since most decent FTP clients
support SFTP now.

Assuming your server is Linux or BSD, you can even mount common or shared
directories (yep, directories) into the chrooted area so clients gain limited
access to files outside their chroot. I have used this very effectively for
stuff like read-only outgoing and write-only incoming directories.

It does require a little bit of expertise to setup though. I have written a
bunch of tools for setting up sftp jails on Linux, but never got around to packaging
and releasing it. Let me know if you're interested.

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


Code generation [was Re: Cameras Re: [Boston.pm] Tech/Social Meeting w/ Randal Schwartz]

2004-10-05 Thread Gyepi SAM
On Mon, Oct 04, 2004 at 10:32:51PM -0400, Mitchell N Charity wrote:
 Obligatory perl comment - TIMTOWTDI, and sometimes, a good way,
 regards both clarity and speed, is having perl read a BNF and write a
 parser in prolog, which does the parsing, and writes an AST in perl,
 which is then eval()ed.  Really.
 ___

 I think that about covers it.
 An example application is parsing _un_preprocessed C code - macros,
 #ifdef's, type/identifier ambiguities and all.

Along a similar vein, I frequently generate sh code from perl rather than
simply make 'system()/qx/``' calls from perl. Though there are several benefits to
this approach, the most compelling, for me, is the ability to embed 'undo'
statements in the generated code so the shell code can, given an 'undo'
invocation, rollback the previous run. In a sense, it allows me to impose
transaction semantics on batch processes. Of course, this only works if you
can be prevent or avoid external agents from modifying the system during or
between batch runs.

In general, I have found code and text generation to be a powerful technique
since one can apply abstraction, indirection. and other useful language
concepts to the task.

-Gyepi

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


Re: [Boston.pm] Re: Code generation

2004-10-05 Thread Gyepi SAM
On Tue, Oct 05, 2004 at 08:48:28PM -0400, Kripa Sundar wrote:
 Thanks for the example.  This is certainly an interesting
 technique.  But I still fail to see why going from perl to sh(1)
 makes it easier to undo something.

As it turns out, I have also implemented 'atomic' operations
on groups of files solely in perl. In this case, each undoable action stores an
undo coderef in a global array after the 'do' action has completed. Then
if/when an error occurs, the error handler code iterates through the array and fires 
off
each coderef. Note that since the undo stack is stored in memory, it is lost
when the script ends so I cannot easily undo actions anymore. Furthermore,
the undo can only occur for software detectable errors, which means that the
script could run successfully and still produce bad output.  Of course one
*could* write the script to undo its own, previous, actions but that becomes
more complicated since you have have to figure out what the previous run
actually did.

The generated shell script, OTOH, contains all the state information it needs to
'do' or 'undo' *and* retains that state after execution. That may not sound
like much until you find an error and decide that you need to rollback.

 Moreover, I would guess that such undo-able scripts are
 possible only in specialised domains.

That's part of the point of program and text generation: some problems are
easier solved by the tools that apply in that domain. And yes, there are many
areas where the technique should not be used. 

 If I do a chgrp(1) or chmod(1), there is no straightforward
 to undo it, unless I save the previous file properties some
 place.

Absolutely, but only if you are modifying existing files. And if I were doing
that, remember that the perl script can stat() the file and write out that
information as part of the undo process.

  Even worse for rm(1) and rmdir(1).

Of course, but I assume we are all adults here and understand the effects of
our actions.

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


Re: [Boston.pm] OT: look up a host for a URL

2004-09-22 Thread Gyepi SAM
On Wed, Sep 22, 2004 at 11:57:35AM +0100, David Cantrell wrote:
 On Tue, Sep 21, 2004 at 05:56:47PM -0400, Gyepi SAM wrote:
 
  Indeed! The as_check script references to routeviews.org and the Merit Routing 
  database,
  are particularly useful for me since I have recently developed an interest in 
  routing databases.
 
 Just remember that the AS number returned by that script may not be
 *entirely* accurate.  It'll tell you who is announcing a particular
 netblock to routeviews.org, but not who the *real* owner is.  For that
 you need to look at the AS path.  It's on my ever-growing to-do list.

Thanks for the info.`

 Out of interest, what project do you have in mind that'll be using this
 sort of information?

I am working on a mirror database program that finds the best n mirrors for a
given client IP address. The current selection methods are geographically biased:
they prefer mirrors within the client's country, then the closest mirrors in
other countries based on, very rough, geographic distance calculations.
Most results are surprisingly accurate, but edge cases fail pretty badly since
it's working at country granularity: Vancouver, CA is closer to Seattle, US than to 
Alberta, CA
but the latter is selected first. A similar problem occurs for large countries as well.

I am thinking that some knowledge of possible routes from the client to the mirror may 
help here.
My initial approach was to write a client utility that can traceroute and ping a list 
of mirrors to find the
closest/fastest ones, but I'd like to precompute some of that information on the
server, if possible, using routing tables.

-Gyepi

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


Re: [Boston.pm] Guess what is wrong with this logic

2004-09-09 Thread Gyepi SAM
On Thu, Sep 09, 2004 at 04:03:33PM -0400, Kripa Sundar wrote:

   20: warn blah blah\n if (glob(~$arg) !~ m{^ (/\w+)+ /$arg $}x);

   globIn list context, returns a (possibly empty) list of filename
   expansions on the value of EXPR such as the standard Unix shell
   /bin/csh would do. In scalar context, glob iterates through
   such filename expansions, returning undef when the list is
   exhausted.

Funny, I never noticed that behaviour before.  AFAIK it's the only perl
function that behaves that way. Definitely a gotcha!

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


Re: [Boston.pm] Help using LWP to change password Q's?

2004-08-24 Thread Gyepi SAM
On Tue, Aug 24, 2004 at 10:42:32AM -0400, Bob Mariotti wrote:
 Q: How does the submit button interrelate with the next URL?
 
 Example:
 
 Initial https connect to specified page : 
 https://xxx.yyy.com/ssp/jsp/blah.jsp

The submit button causes your browser to submit the contents of the form
using the specified method (post or get). to the specified action URL.
Since the action URL in this case is not qualified, a smart browser will
prepend the base URL (in this case https://xxx.yyy.com/ssp/jsp)
to the value of the action attribute and send the response, in this case, to
https://xxx.yyy.com/ssp/jsp/ABC123. Note that since
the action tag should either be fully qualified (begin with http or https) or
be relative (begin with '/'). Neither is true in this case, so the browser has
to figure out what to do. 

 Assuming the response is true... must the programmer alter the URL for 
 the POST operation at all?  Or will LWP and/or HTTP take care of 
 manipulating the URL in combination with the ACTION value?

Since you're writing the browser, you may need to append the value of the
action attribute to the base URL and post the response there.

-Gyepi

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


Re: [Boston.pm] Help using LWP to change password Q's?

2004-08-24 Thread Gyepi SAM
On Tue, Aug 24, 2004 at 12:02:26PM -0400, Dan Boger wrote:
 On Tue, Aug 24, 2004 at 12:25:43PM -0400, Gyepi SAM wrote:
  Note that since the action tag should either be fully qualified (begin
  with http or https) or be relative (begin with '/'). Neither is true
  in this case, so the browser has to figure out what to do.
 
 Aren't paths that begin with a '/' considered 'absolute'?  And relative
 is anything else?  An ACTION of ../form.cgi is a valid relative URI,
 isn't it?

A URI that does not begin with a scheme and net location (hostname) is considered
relative. A string that begins with '/' is a relative URI but an absolute path.

I should have been clearer and said fully qualified *URL* or absolute *path*.

The point of the original statement was that sing a relative path as the
target of an ACTION attribute is technically correct, but bad practice.

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


Re: [Boston.pm] Wiki

2004-08-06 Thread Gyepi SAM
On Fri, Aug 06, 2004 at 10:43:20AM -0400, Uri Guttman wrote:
   JS why not just run it up the flagpole and see who salutes!
 
 i won't touch that with a 10 foot flagpole!

A 3 foot flagczech might be easier to manage, I'd say.

-Gyepi




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


Re: [Boston.pm] OT - Keyboards

2004-08-04 Thread Gyepi SAM
On Wed, Aug 04, 2004 at 08:49:52PM -0400, Mike Burns wrote:
 If I'm not mistaken, Linux has an option where the SysReq key becomes a 
 special key that works when the kernel freezes. I seem to remember Linux 
 developers using it.

You are not mistaken. This is a compile time kernel option which, when
enabled, allows you to do all sorts of funky stuff with your machine if it
hangs. The sysreq key is used in combination with the ALT key and other,
mappable, keys. I have not used the feature in a long time but I still compile
it into every kernel I build. You never know when you'll need it!

 (I also seem to remember someone getting flamed for 
 suggesting that FreeBSD use it.)

Shrug. Dunno.

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


Re: [Boston.pm] Embedding Perl

2004-07-12 Thread Gyepi SAM
On Sun, Jul 11, 2004 at 10:47:26PM -0400, Federico Lucifredi wrote:
 What kind of access will the scripts have to the proper C++ variables?
 Can these be objects or have to be static ? Or is it simply madness to poke
 at data that way (my take) and the best approach is to pass a data block to
 a Perl function from C++, then retrieve the results from that same memory
 area (or another one, but still allocated by C++).

You'd have to convert any variables from C++ representations to Perl. This
could be messy. Have you tried SWIG?
 
 The person badgering me with this problem seems to think it is possible
 to poke at the memory space of an executable from another one (the
 standalone perl interpreter) and live happily everafter. Now, I know Perl is
 full of wonderous surprises, but unless it bends even standard Unix Kernel
 memory protection, it seems to me the best way to go is embedding.

Poking at the memory space of an executable is not a good idea (tm).

 Should I check out other spell books other than perlembed? As far as I know,
 that's the only way to go, but perhaps there are *other* ways to embed Perl

SWIG.

 (No Dan, don't get started on Parrot jst yet ;-)

-Gyepi

-- 
Notice the difference between what happens when a man says to himself, 
I have failed three times, and what happens when he says, I am a failure.
--S. I. Hayakawa  
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Embedding Perl

2004-07-12 Thread Gyepi SAM
On Sun, Jul 11, 2004 at 10:47:26PM -0400, Federico Lucifredi wrote:
 I have been asked to provide scripting capability into a Qt application
 (essentially, the reverse of what I have shown you in my talk a couple of
 years ago), and was thinking of embedding Perl into their program as a
 solution. I have two questions in the matter, as I have never tried this
 particular magic Perl spell:

On second thought, SWIG is not the answer to this problem. I misunderstood the
problem (or the embedding direction).

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


Re: [Boston.pm] flock() on Solaris

2004-06-22 Thread Gyepi SAM
On Mon, Jun 21, 2004 at 10:10:02PM -0400, Ian Langworth wrote:
 --
 use Test::More 'no_plan';
 use Fcntl ':flock';
 
 open ONE, foo or die $!;
 flock ONE, LOCK_EX or die Can't lock;
 print ONE line 1\n;
 
 fork and do {

The test on this line is incorrect. The parent continues to run inside this block.
At the very least you should use 'fork or do { ...'


-Gyepi

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


Re: [Boston.pm] OT - Any experience with ODBC to MySQL?

2004-06-04 Thread Gyepi SAM
On Fri, Jun 04, 2004 at 05:47:11PM -0700, Ranga Nathan wrote:
 I am trying to set up ODBC access from Access 2000 to MySQL running on 
 Linux. Whenever I test the connection in the set-up dialogue, I get MySQL 
 ODBC [3.5..] Access Denied for [EMAIL PROTECTED] 
 Password Required (yes)
 The message is not verbatim but essentially the same.
 
 If anyone can throw some light on it, I would appreciate it.

Since you didn't mention it, I would guess that you did not 'FLUSH PRIVILEGES'
after changing the grant tables. If you did, then you may find this page
helpful: http://dev.mysql.com/doc/mysql/en/Access_denied.html.

FWIW, I have setup this ODBC combination several times and it works fine.

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


Re: [Boston.pm] Looking for a web-based ftp client

2004-05-12 Thread Gyepi SAM
On Wed, May 12, 2004 at 03:42:09PM -0400, John Saylor wrote:
 most web browsers 'speak' FTP [like they do HTML].

s/HTML/HTTP/

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


Re: [Boston.pm] Compression without temp file

2004-02-12 Thread Gyepi SAM
 On Thu, 2004-02-12 at 19:37, Chris Devers wrote:
  I assume you tried CPAN?=20
  First hit is PerlIO::gzip, which looks promising...
 
 Yes, I skimmed over that one. However I'm trying to find a way to do it
 without using files, which PerlIO::gzip seems to be doing.

Yes, it does use files, but newish perls support the concept of in-memory
files. So the PerlIO::gzip example becomes:

  use PerlIO::gzip;
  my $string;
  open FOO, :gzip, \$string or die $!;
  print FOO 'blah blah blah';
  close FOO;
  print $string; #careful, this may mess up your terminal!


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


Re: [Boston.pm] Compression without temp file

2004-02-12 Thread Gyepi SAM
On Thu, Feb 12, 2004 at 08:51:43PM -0500, Sean Quinlan wrote:
 On Thu, 2004-02-12 at 20:18, Gyepi SAM wrote:
 Thanks Gyepi! Unfortunately, while this did not throw any errors, it
 also did not produce any output?

I just installed PerlIO::gzip so I could test the example and it works for me,
so it must be you or your system ;) Was your perl built with perlio?

  perl -V|grep io

should  produce at this something like this:
  
  useperlio=define d_sfio=undef

btw, if you save the example to a file and pipe the script
output to 'gunzip -c', you get back the original string,
which serves as a nice test of the whole process.

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


Re: [Boston.pm] Bug/Limitation in DBD::mysql?

2004-01-15 Thread Gyepi SAM
On Thu, Jan 15, 2004 at 09:59:38AM -0500, Chris Braiotta wrote:
 Hi, all. I've discovered some odd behavior in a script I've written 
 that uses DBD::mysql, and I think it's related to the large number of 

 2) Simply adding a LIMIT 500 to the end of the SQL query, or using a 
 more restrictive set of dates than the script is meant to use, 
 eliminates the error.

Perhaps the shell or process running the script is running into a resource
limit. What does ulimit tell you?  I am assuming, obviously, that you are
running a very recent DBD::mysql.

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


Re: [Boston.pm] Re: Slightly off topic from Hartford PM Group

2003-02-27 Thread Gyepi SAM
On Thu, Feb 27, 2003 at 10:16:50AM -0500, Richard Morse wrote:
 
 On Thursday, February 27, 2003, at 08:03  AM, Bob Mariotti wrote:
 
 1) no dialog box appears and the file is automatically downloaded and 
 stored in some obscure directory somewhere where the user cannot find 
 it; ow 2) a dialog box will appear but the directory setting is 
 obscure and the filename is the name of the perl cgi program.

 For issue 2, I've been having problems with this recently as well.  It 
 used to be that it was sufficient to make sure that the URL ended with 
 the filename -- I would often write scripts that included a pointless 
 redirect to the exact same place with '/filename.ext' appended to the 
 end of the query string.  It may still work for some browsers.
 
 But if you do find a solution for setting the filename, I'd like to 
 know...

I used the 'Content-Disposition' header [1] for a long time, but eventually gave
up and simply appended the filename to the url because some versions of IE ignore the
the headers altogether. I think it was a workaround to fix the IE content-disposition 
insecurity
problem, but I don't really know why.

Appending the filename to the url works with all browsers, AFAIK.

I never tried using both, but that may also work.

[1] ftp://ftp.rfc-editor.org/in-notes/rfc1806.txt

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


Re: [Boston.pm] open a gz file

2003-02-27 Thread Gyepi SAM
On Thu, Feb 27, 2003 at 01:43:13PM -0500, Carlton Lo wrote:
   I'm new to perl, I'm trying to write a pl script that would open a gzipped txt 
 file. Is there any functions where I can call for this. I've tried the followings:
 
 method #1 open(IN, gunzip -c data.gz) || die cannot open input data file;

open(IN, gunzip -c data.gz|) || die cannot open input data file. $!;



 method #2 pass the filename as ARGV and execute the script as $perl test.pl 
 'gunzip -c data.gz'

cat  test.pl
open(F, $ARGV[0]|) or die Cannot open $ARGV[0]. $!\n;
^D

Note the pipe (|) at the end of the second argument to open.

perldoc -f open

Either method will suffice, though #2 is rather strange.

-Gyepi

-- 
Science is organized knowledge. Wisdom is organized life.
--Immanuel Kant  
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Re: Slightly off topic from Hartford PM Group

2003-02-27 Thread Gyepi SAM
On Thu, Feb 27, 2003 at 01:38:23PM -0500, Richard Morse wrote:
 
 On Thursday, February 27, 2003, at 01:10  PM, Gyepi SAM wrote:
 
 That url won't do what you want. This one should:
 
  http://.../my_script.cgi/filename.ext?null=null

 I think that I tried this a while ago, but it didn't work.  The reason 
 was that IIS, for some reason unbeknownst to me, refused to realize 
 that my_script.cgi in the URL was a script

Hmm. That seems like a pretty standard thing to be able to do.
In any case, I don't use Microsoft products and have never used IIS so I can't help 
with that.

If you have to lie to your software to make it do the right thing, I'd say you're 
using the wrong software.
But one has work somehow...

-Gyepi

-- 
All the world's a stage, and all the men and women merely players.
They have their exits and their entrances, and one man in his time plays many parts, 
his acts being seven ages.
--Shakespeare, As You Like It  
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Re: [Boston.pm] Re: quot;Slightlyquot; off topic from Hartford PM Group

2003-02-27 Thread Gyepi SAM
On Thu, Feb 27, 2003 at 03:45:51PM -0500, [EMAIL PROTECTED] wrote:
  If you have to lie to your software to make it do the right thing, I'd
  say you're using the wrong software. But one has work somehow...

 Your observation is correct.  However, when one provides/supports web
 software that MUST serve information to the masses, the masses are most
 likely using a micro$oft product.  Therefore, whether its correct or not,
 whether we like it or not, we've GOT to make it work.  I swear, we spend
 considerably more time breaking things to work with MS than we do
 developing it in the first place.

I agree with most of what you're saying and never implied that the masses
should use anything else, though many do. I serve hundreds of thousands of
those masses who use Microsoft clients, but I don't need or want to use
Microsoft products to do the serving. The masses chose their software,
and I choose mine. We are, after all, talking about the web. ;)

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


Re: [Boston.pm] list of possible words

2003-02-12 Thread Gyepi SAM
On Wed, Feb 12, 2003 at 01:01:43AM +0700, Komtanoo Pinpimai wrote:
Do anyone know perl module that can give list of possible words of 
 an incorrect spelling word? For example,

Well,

http://search.cpan.org/search?query=spellmode=all

returns more hits than I care to browse through. Perhaps you might.

or good strategies to find possible words, or is there any research 
 on this topic?

I am sure those exist too. Google perhaps?

-Gyepi

-- 
Examinations are formidable even to the best prepared, for the greatest 
fool may ask more than the wisest man can answer.
--Charles Caleb Colton  
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm



Re: [Boston.pm] Email filtering...

2003-02-11 Thread Gyepi SAM
On Tue, Feb 11, 2003 at 11:10:51AM -0500, Wizard wrote:
 Here's an example that I just sent to the NMS list:
 
 I want it to be universal. For instance, how would you parse this:
 *@*.aol.*
 
 into:
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 and
 [EMAIL PROTECTED]
 
 It should match the first two, but not the last, because the DOMAIN in the
 last is 'parliment', not 'aol'.

I don't see how '*@*.aol.*' can match '[EMAIL PROTECTED]'.
How do you account for the first '.' in the match expression?

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



Re: [Boston.pm] local perl modules

2002-09-28 Thread Gyepi SAM

On Sat, Sep 28, 2002 at 08:04:30PM -0400, Joel Gwynn wrote:
 Hello all.  If anyone else is squandering their Saturday evening coding,
 maybe you could answer a quick question.  I want to install some modules in
 my local pair.com account using the CPAN module.  How do I do this?

To build

perl Makefile.PL PREFIX=/home/joelman/usr

To use:

perl -I/home/joelman/usr script.pl

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