parallel::forkmanager queue implentation in perl

2010-08-06 Thread Ramprasad Prasad
Hello , I have process that picks up multiple files from a directory forks child processes and each child process works on a batch of files and finishes the task I am thinking of this Parent process finds all files in jobs directory , divide tasks into $MAXCHILD processes but not exceeding $MAXBAT

Digital signatures using MIME::Lite

2010-08-09 Thread Ramprasad Prasad
Hi, I have a custome MIME::Lite / MIME::Parser script that picks up data from a DB and sends a mail. Now I need to digitally sign this mail Can I get some pointers , I dont know much about SSL -- Thanks Ram n

Re: Digital signatures using MIME::Lite

2010-08-09 Thread Ramprasad Prasad
On Mon, Aug 9, 2010 at 2:47 PM, Jeff Pang wrote: > 2010/8/9 Ramprasad Prasad : > > Hi, > > > > I have a custome MIME::Lite / MIME::Parser script that picks up data > from a > > DB and sends a mail. > > Now I need to digitally sign this mail > > > &

Best way of tailing a file

2010-08-10 Thread Ramprasad Prasad
On a linux server I need to "tail -f" a file continuosly in perl and whenever there is a new entry I insert into a DB If I use File::Tail::FAM I get this error Your vendor has not defined SGI::FAM macro FAM_DEBUG_OFF at /usr/lib/perl5/site_perl/5.8.8/File/Tail/FAM.pm line 16 I wanted to use FAM

Re: Imp

2010-08-30 Thread Ramprasad Prasad
On Mon, Aug 30, 2010 at 3:04 PM, Jyoti wrote: > Hello everyone, > > Can anyone please guide me with specific CPAN perl libraries/modules, to > send queries and get responses. I tried looking in CPAN,but I am still a > learner, so not able to get properly. > Can anyone reply me for the same please

How do I recognize request from a mobile phone

2010-09-28 Thread Ramprasad Prasad
I need to display WAP version of pages when accessed from mobile, else WEB version What is the best of doing this -- Thanks Ram n

CGI::Session persist session

2010-09-28 Thread Ramprasad Prasad
I am using CGI::Session for session management of a wap page. Even if I don't delete the cookie I have seen that from nokia browsers the cookie does not persist , but persistance works fine with a web browser like firefox Is there anything special needed for nokia browsers -- Sent from my mobile

Template Toolkit for HTML Table with variable number of columns

2010-12-04 Thread Ramprasad Prasad
I have to show report from a database of a daily report of ids. I have simplified the code here Pasted at http://pastebin.com/v0XmMuZP #!/usr/bin/perl use strict; use Template; use CGI; # Everyday report from DB for each id # my %report = ( '2010-12-01' => { 1 => 'OK' , 2 => 'FAIL' , 4 => 'F

Re: advangtes of Perl on various languages

2011-01-05 Thread Ramprasad Prasad
On Tue, Jan 4, 2011 at 12:42 PM, Sunita Rani Pradhan < sunita.prad...@altair.com> wrote: > Hi All > > > >I would like to know answers of following questions : > > > > - What all advantages Perl has on top of other scripting languages like > Python , shell , Java ? > > > > - What is th

Auto correction of typos

2011-03-04 Thread Ramprasad Prasad
I have a web form where people sign up for updates by filling in their email address A lot of users end up not receiving the confirmation mailer because of typos in the email id Like yhaoo.com or hotmaill.com I would like to prompt the user for a possible typo , like the google "Did you mean this

Re: Auto correction of typos

2011-03-07 Thread Ramprasad Prasad
Now, the other part is the psychology on your end. What the hell is the > point of maintaining an email database that you're afraid people have > entered spam bot triggering emails into? You're either going to end up > sending to it eventually or you're asking your users (and us) to give you > inf

How do I get the content-disposition of a MIME::Entity part

2011-03-11 Thread Ramprasad Prasad
I have a simple code that gets all image parts of a message foreach my $part($entity->parts){ next if ($part->effective_type !~ m{image}); push(@images,$part); ... } But I want to get only the inline images and not the attached images How can I achieve this ? $part->content_disposition(

Re: parsing a delimited file

2011-04-01 Thread Ramprasad Prasad
See Inline comments use strict; > use warnings; > my $fname = $ARGV[0]; > open my $RFH,'<',$fname; > > while (<$RFH>) { >next unless /:/ and my %field = /(.*?):(.*?)/mg; # Wrong > # I would prefer doing this chomp; if(/^(.+?)\:(.+?)/){ $field{$1}=$2;} } >

Is CDB_File good for CDB in readonly

2011-04-03 Thread Ramprasad Prasad
I have a CDB database with 1 Million to 10 Million records .. This is just a key where the app needs to lookup if an entry exists or not. I dont need the value. My app will be looking up the key_exists() almost 100 times a second What is the fastest way of implementin this I have a few question

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Ramprasad Prasad
On 13 April 2011 11:40, Shlomit Afgin wrote: > > > > > Hi > > > I need to write regular expression that will capitalize the first letter of > each word in the string. > Word should be string with length that is greater or equal to 3 letters > exclude the words 'and' and 'the'. > > > I tried: > $

Extremely fast template processor

2011-05-27 Thread Ramprasad Prasad
I have a requirement of generating large number (> 100 thousand ) files from a single template by replacing the placeholders with respective values Currently I use Template-Toolkit, but is there a faster way ? Since my template is just dumb template ( no IF , no FOR etc ) .. I just need a simple

Convert HTML to PDF

2011-06-14 Thread Ramprasad Prasad
I am trying to use PDF::FromHTML on my linux ( Fedora 12 ) machine I have just copied the man page example but I cant get it to run --- #!/usr/bin/perl use PDF::FromHTML; my $pdf = PDF::FromHTML->new( encoding => 'utf-8' ); $pdf->load_file('source.html'); $pdf->convert( Fon

Re: Convert HTML to PDF

2011-06-15 Thread Ramprasad Prasad
On 14 June 2011 20:39, Dr.Ruud wrote: > On 2011-06-14 10:54, Ramprasad Prasad wrote: > > I am trying to use PDF::FromHTML on my linux ( Fedora 12 ) machine >> [...] >> >> Is there a better way of creating PDF from HTML .. I believe this >> particular >>

Creating a detached process in perl cgi

2011-07-13 Thread Ramprasad Prasad
I am trying a http API that would fork a background script and immediately return I tried using fork() and setsid() or using Proc::Background But the problem is my API hangs until the background script is complete Is there a way I can avoid this My code is here ( uses both fork and background

Re: Creating a detached process in perl cgi

2011-07-13 Thread Ramprasad Prasad
Ok I did get that working but not in pure perl. I put a system("nohup $process > /dev/null 2>&1 &"); instead of all the fork and setsid On 13 July 2011 20:07, Shlomi Fish wrote: > Hi Ram, > > On Wed, 13 Jul 2011 19:02:46 +0530 > Ramprasad Prasad wrot

Sorting an extremely LARGE file

2011-08-07 Thread Ramprasad Prasad
I have a file that contains records of customer interaction The first column of the file is the batch number(INT) , and other columns are date time , close time etc etc I have to sort the entire file in order of the first column .. but the problem is that the file is extremely huge. For the large

Re: Sorting an extremely LARGE file

2011-08-07 Thread Ramprasad Prasad
On 7 August 2011 21:24, Shawn H Corey wrote: > On 11-08-07 11:46 AM, Ramprasad Prasad wrote: > >> I used a mysql database , but the order by clause used to hang the >> process indefinitely >> If I sort files in smaller chunks how can I merge them back ?? >> &g

Re: Sorting an extremely LARGE file

2011-08-07 Thread Ramprasad Prasad
Using the system linux sort ... Does not help. On my dual quad core machine , (8 gb ram) sort -n file takes 10 minutes and in the end produces no output. when I put this data in mysql , there is an index on the order by field ... But I guess keys don't help when you are selecting the entire table.

regex negative looking up a backtrace

2011-08-24 Thread Ramprasad Prasad
Assume I have to find the first unique character in a string $string = "abtable"; # t is the first unique string I tried using a negative backtrace lookup to get the answer in a single regex ... But something is missing. /(.).(?!\1)/ && print $1; it seems fine ... But doesn't work -- Sent fr

Re: regex negative looking up a backtrace

2011-08-24 Thread Ramprasad Prasad
still does not work $_ = "zzabtable"; /(.)(?!.*\1)/ && print "$1\n"; Output is z On 8/24/11, Chris Charley wrote: >>Assume I have to find the first unique character in a string >> >>$string = "abtable"; >> >># t is the first unique string >> >>I tried using a negative backtrace lookup to get the

OT: Apache vulnerability

2011-08-25 Thread Ramprasad Prasad
Will the apache DOS vulnerability affect servers just running CGI scripts , no php , tomcat etc( usually those are the ones causing all security concerns ) http://www.networkworld.com/news/2011/082411-apache-warns-web-server-admins-250075.html Are there any mitigation scripts

Cannot write to fifo

2011-08-29 Thread Ramprasad Prasad
How can I open multiple FIFO files in perl and print to them simultaneously I tried a simple script does not work #!/usr/bin/perl use strict; use IO::File; $|=1; system("rm -f /tmp/fifo1;mkfifo /tmp/fifo1"); open (OUT,"> /tmp/fifo1") || die; for (0 .. 10){ print "Hi $_\n"; print OUT "H

Determine http or https in CGI perl

2011-10-03 Thread Ramprasad Prasad
In my cgi program .. I want to know if the user is accessing via HTTP or HTTPS. How can I do this ? -- Thanks Ram n

Re: Stop the mail to me

2011-10-07 Thread Ramprasad Prasad
> > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > Read the footer of the mail

How Do I insert a password into a PDF

2011-11-25 Thread Ramprasad Prasad
I am generating pdf files with http://code.google.com/p/wkhtmltopdf/ I want to password protect the PDF's .. How can I do this ?

How do I implement a cyclic array in perl

2011-11-28 Thread Ramprasad Prasad
I have an array of scalars. I want to run a loop like this my @workers = qw ( a b c ); my $MAXCHILD = 20; foreach my $i( 0 .. $MAXCHILD){ run_job($i,$workers[$i++]); } Can I do this ?

base64 to hex conversion

2012-01-16 Thread Ramprasad Prasad
Hello what is the best way to convert base64 to hex I am currently using use NetSDS::Util::Convert qw ( conv_base64_str conv_str_hex); ... my $hex = conv_str_hex(conv_base64_str($b64)); But the NetSDS::Util module seems not so popular , I dont find it installed on most machines, Getting it i