[28350] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9714 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 11 18:10:17 2006

Date: Mon, 11 Sep 2006 15:10:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 11 Sep 2006     Volume: 10 Number: 9714

Today's topics:
        How do you compress a url for ascii output? <blaine@worldweb.com>
    Re: How do you compress a url for ascii output? (Randal L. Schwartz)
    Re: How do you compress a url for ascii output? <blaine@worldweb.com>
    Re: How do you compress a url for ascii output? <sbryce@scottbryce.com>
    Re: How do you compress a url for ascii output? <tzz@lifelogs.com>
    Re: How do you compress a url for ascii output? <sbryce@scottbryce.com>
    Re: How to extract all link from web page (loaded in va <afdmail@gmail.com>
        I want to output all of my STDOUT to a single line....d seancsnyder@gmail.com
    Re: I want to output all of my STDOUT to a single line. seancsnyder@gmail.com
    Re: I want to output all of my STDOUT to a single line. <David.Squire@no.spam.from.here.au>
    Re: I want to output all of my STDOUT to a single line. <David.Squire@no.spam.from.here.au>
    Re: need to clear cookies in IE using perl Win 32 IE au <mgarrish@gmail.com>
    Re: regular expression help <tadmc@augustmail.com>
    Re: scalar to method name <ced@blv-sam-01.ca.boeing.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 11 Sep 2006 09:11:18 -0700
From: "blaine@worldweb.com" <blaine@worldweb.com>
Subject: How do you compress a url for ascii output?
Message-Id: <1157991078.529335.29110@h48g2000cwc.googlegroups.com>

Hello,

I've been trying to come up with a way to compress part of a url to
make it shorter.

Below I have an example of a variable for my url and want it smaller
sized ascii. I've been trying the Compress:Zlib, however this doesn't
output ascii.. Any ideas?

use Compress::Zlib;

#------ deflate -------
my ($out, $out1, $status, $nout);
my $x = deflateInit() or die "this text has been deflated/inflated";

my $testStream =
"CIAQEDEUDVvVEwEEChDtDaAVCHAhBFANADBeAlEqCvDrCgDHDeDyClBREgBSCFEdBIBbDeCYACBLEWAwEaEECMBjBvCEBiEbCCCgABEAElBNCsEYDFCODEEoECDaDgADCtEhBpAOCACGDECsCfBsCPAaBhAaDeDTECERBdEIBuEiEjDqCgEQBPDjBQAEEjDtDFCMDaDfAuCwEfChCmEmDtDRDlBdBYACBkDYEpEnDoCMAJETEcDxEC";
($out,$status) = $x->deflate($testStream);

$status == Z_OK or die "deflation failed\n";
($out1, $status) = $x->flush();

$out .= $out1;


$status == Z_OK or die "deflation failed\n";
print "deflated output: [$out]\n";



------------------------------

Date: 11 Sep 2006 09:31:14 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How do you compress a url for ascii output?
Message-Id: <86ac56bc19.fsf@blue.stonehenge.com>

>>>>> "blaine@worldweb" == blaine@worldweb com <blaine@worldweb.com> writes:

blaine@worldweb> I've been trying to come up with a way to compress part of a url to
blaine@worldweb> make it shorter.

Learn to use server-side sessions.  You don't need a 256-char URL.  Ever.
That's more possibilitities than countable atoms in the universe.  You clearly
don't have *that* much state to distinguish. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
Posted via a free Usenet account from http://www.teranews.com
Warning: Do not use Ultimate-Anonymity
They are worthless spammers that are running a scam.



------------------------------

Date: 11 Sep 2006 10:15:01 -0700
From: "blaine@worldweb.com" <blaine@worldweb.com>
Subject: Re: How do you compress a url for ascii output?
Message-Id: <1157994900.830770.222620@p79g2000cwp.googlegroups.com>

Sorry, maybe I was not clear.

My url is actually not 256 char's. It's actually very short, however
there is encrytped variable data that I would like to shorten.

ie.
www.testurl.com/script.html?encryptedString=CIAQEDEUDVvVEwEEChDtDaAVCHAhBFANADBeAlEqCvDrCgDHDeDyClBREgBSCFEdBIBbDeCYACBLEWAwEaEECMBjBvCEBiEbCCCgABEAElBNCsEYDFCODEEoECDaDgADCtEhBpAOCACGDECsCfBsCPAaBhAaDeDTECERBdEIBuEiEjDqCgEQBPDjBQAEEjDtDFCMDaDfAuCwEfChCmEmDtDRDlBdBYACBkDYEpEnDoCMAJETEcDxEC


So I would like a much shorter encryptedString part

ie
www.testurl.com/script.html?encryptedString=<40 - 60% shorter then the
original>




Randal L. Schwartz wrote:
> >>>>> "blaine@worldweb" == blaine@worldweb com <blaine@worldweb.com> writes:
>
> blaine@worldweb> I've been trying to come up with a way to compress part of a url to
> blaine@worldweb> make it shorter.
>
> Learn to use server-side sessions.  You don't need a 256-char URL.  Ever.
> That's more possibilitities than countable atoms in the universe.  You clearly
> don't have *that* much state to distinguish. :)
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
>
> --
> Posted via a free Usenet account from http://www.teranews.com
> Warning: Do not use Ultimate-Anonymity
> They are worthless spammers that are running a scam.



------------------------------

Date: Mon, 11 Sep 2006 11:32:12 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: How do you compress a url for ascii output?
Message-Id: <vPudnZgSRZUBAJjYnZ2dnUVZ_uudnZ2d@comcast.com>

blaine@worldweb.com wrote:

> Sorry, maybe I was not clear.
> 
> My url is actually not 256 char's. It's actually very short, however
> there is encrytped variable data that I would like to shorten.

Randal's comments still apply. You don't need to keep 256 characters 
worth of state.

If we know what you were really trying to accomplish, perhaps we could 
help you find a better way to do it, or refer you to another newsgroup 
where this would be on-topic.

What is the purpose of the variable data? Why are you passing it in as 
part of the URL? Why does it need to be so long?


------------------------------

Date: Mon, 11 Sep 2006 14:03:08 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: How do you compress a url for ascii output?
Message-Id: <g69ejuiffhf.fsf@CN1374059D0130.kendall.corp.akamai.com>

On 11 Sep 2006, blaine@worldweb.com wrote:

> I've been trying to come up with a way to compress part of a url to
> make it shorter.
>
> Below I have an example of a variable for my url and want it smaller
> sized ascii. I've been trying the Compress:Zlib, however this doesn't
> output ascii.. Any ideas?

Use a web service like http://makeashorterlink.com/

Otherwise you just can't compress a URL to a valid URL equivalent to
the original (unless I misunderstand your question).

Ted


------------------------------

Date: Mon, 11 Sep 2006 12:19:46 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: How do you compress a url for ascii output?
Message-Id: <Faednd0V-eReNZjYnZ2dnUVZ_sydnZ2d@comcast.com>

blaine@worldweb.com wrote:

> Below I have an example of a variable for my url and want it smaller 
> sized ascii. I've been trying the Compress:Zlib, however this doesn't
> output ascii.. Any ideas?


Do a Zlib compression, then Base64 the result. It will grow when you 
Base64 it, but hopefully not back to its original size.


------------------------------

Date: Mon, 11 Sep 2006 20:14:34 +0300
From: Vasiliy Litovchenko <afdmail@gmail.com>
Subject: Re: How to extract all link from web page (loaded in variable $content) to scalar @links?
Message-Id: <ee45sp$1npd$1@relay.career.usart.ru>

maran@homewares.ro wrote:
> How to extract all link from web page (loaded in variable $content) to
> scalar @links?
> 
> 

smth. like this?

use HTML::LinkExtor;
my $parser = HTML::LinkExtor->new;
$parser->parse($content);
foreach my $link($parser->links){
	print "$link \n";
}


------------------------------

Date: 11 Sep 2006 12:37:43 -0700
From: seancsnyder@gmail.com
Subject: I want to output all of my STDOUT to a single line....dont want to scroll
Message-Id: <1158003463.395457.272570@q16g2000cwq.googlegroups.com>

   I want my program to simply output to a single line in STDOUT.  In
other words i want to print a line, then 'backspace' that line and
print somethign new on the same line.  I do not want the terminal
window to scroll.  

   Any ideas?  CAn this be done?



------------------------------

Date: 11 Sep 2006 13:17:01 -0700
From: seancsnyder@gmail.com
Subject: Re: I want to output all of my STDOUT to a single line....dont want to scroll
Message-Id: <1158005821.244567.204180@b28g2000cwb.googlegroups.com>

what does this do?

   $| = 1; # output autoflush mode

thanks
-sean


David Squire wrote:
> seancsnyder@gmail.com wrote:
> >    I want my program to simply output to a single line in STDOUT.  In
> > other words i want to print a line, then 'backspace' that line and
> > print somethign new on the same line.  I do not want the terminal
> > window to scroll.
> >
> >    Any ideas?  CAn this be done?
> >
>
> You could do something like this:
>
> ----
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> $| = 1; # output autoflush mode
> my $last_message_length = 0;
> while (my $message = <DATA>) {
> 	chomp $message;
> 	print "\r";
> 	print ' ' x $last_message_length;
> 	print "\r";
> 	print $message; # must not contain \n or \r
> 	sleep(1); # for example
> 	$last_message_length = length $message;
> }
>
> __DATA__
> First message
> Second message
> The third message is really very much longer. In fact, it is more than
> 80 characters
> The fourth message is shorter
>
> ----
>
> But as you will most likely see if you run this, there are problems if
> the message is longer than your terminal width. You could also look into
> more robust solutions using, for example, the Curses module from cpan.
> 
> 
> DS



------------------------------

Date: Mon, 11 Sep 2006 21:10:19 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: I want to output all of my STDOUT to a single line....dont want to scroll
Message-Id: <ee4frb$n44$1@gemini.csx.cam.ac.uk>

seancsnyder@gmail.com wrote:
>    I want my program to simply output to a single line in STDOUT.  In
> other words i want to print a line, then 'backspace' that line and
> print somethign new on the same line.  I do not want the terminal
> window to scroll.  
> 
>    Any ideas?  CAn this be done?
> 

You could do something like this:

----

#!/usr/bin/perl

use strict;
use warnings;

$| = 1; # output autoflush mode
my $last_message_length = 0;
while (my $message = <DATA>) {
	chomp $message;
	print "\r";
	print ' ' x $last_message_length;
	print "\r";
	print $message; # must not contain \n or \r
	sleep(1); # for example
	$last_message_length = length $message;
}

__DATA__
First message
Second message
The third message is really very much longer. In fact, it is more than 
80 characters
The fourth message is shorter

----

But as you will most likely see if you run this, there are problems if 
the message is longer than your terminal width. You could also look into 
more robust solutions using, for example, the Curses module from cpan.


DS


------------------------------

Date: Mon, 11 Sep 2006 21:30:46 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: I want to output all of my STDOUT to a single line....dont want to scroll
Message-Id: <ee4h1m$p3h$1@gemini.csx.cam.ac.uk>

seancsnyder@gmail.com wrote:

[top-posting corrected. Please don't do that.]

> David Squire wrote:
>> seancsnyder@gmail.com wrote:
>>>    I want my program to simply output to a single line in STDOUT.  In
>>> other words i want to print a line, then 'backspace' that line and
>>> print somethign new on the same line.  I do not want the terminal
>>> window to scroll.
>>>
>>>    Any ideas?  CAn this be done?
>>>
>> You could do something like this:
>>
>> ----
>>
>> #!/usr/bin/perl
>>
>> use strict;
>> use warnings;
>>
>> $| = 1; # output autoflush mode

[snip]

 > what does this do?
 >
 >    $| = 1; # output autoflush mode
 >

What the comment says! See:

perldoc perlvar


DS


------------------------------

Date: 11 Sep 2006 14:52:16 -0700
From: "Matt Garrish" <mgarrish@gmail.com>
Subject: Re: need to clear cookies in IE using perl Win 32 IE automation
Message-Id: <1158011530.952245.322400@p79g2000cwp.googlegroups.com>


vish.chitnis@gmail.com wrote:

> Matt Garrish wrote:
> > vish.chitnis@gmail.com wrote:
> >
> > > hi there,
> > >
> > > i am beginer in perl and i need to clear IE cookies and temporary
> > > internet files before i call goto URl to access my application url. how
> > > can i clear cookies and temp internet files?
> > >
> >
> > I have no idea what calling goto URI is, but the fastest way I can
> > think of to clear the cache would be to just delete everything in
> >
> > C:\Documents and Settings\<<current user>>\Local Settings\Temporary
> > Internet Files
> >

[TOFU corrected]

> thanks matt...i tried doing this..and the way i tried is using the
> system commands in DOS to clease browser cookies..
>
> system ('del /q /s /f "C:\Documents and Settings\user\Local
> Settings\Temporary Internet Files\*.*"');
> but i saw only few of the cache is getting deleted and not all the
> files..any idea how do i clear the entire cache folder..

Try using the /a modifier to get rid of the hidden files, etc. You
shouldn't have IE open when you do this, though, because it may keep
some files locked, but it should do the job as a quick and dirty hack.

Matt



------------------------------

Date: Mon, 11 Sep 2006 10:02:49 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: regular expression help
Message-Id: <slrnegaukp.meq.tadmc@magna.augustmail.com>

Aaron Sherman <AaronJSherman@gmail.com> wrote:
> 
> eagle_speaks wrote:
>>
>> 2.3.6 or 1.3.10  and nothing else.
> 
>  (2\.\3\.6|1\.3\.10)
       ^^
       ^^

There is no 3rd capture buffer to backref to...

 ... and (after fixing that) it would match 2.3.1.3.10.

so you probably meant:

   /(2\.3\.6)|(1\.3\.10)/


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Mon, 11 Sep 2006 16:31:24 GMT
From: Charles DeRykus <ced@blv-sam-01.ca.boeing.com>
Subject: Re: scalar to method name
Message-Id: <J5FsKC.5D9@news.boeing.com>

Christian Winter wrote:
> Charles DeRykus wrote:
>> I see an URL (unfortunately 404) in a recent SOAP::Lite version:
>>
>>   # check to avoid security vulnerability:
>>   Protected->Unprotected::method(@parameters)
>>   # see for more details: http://www.phrack.org/phrack/58/p58-0x09   <--
> 
> You can find an archive at http://artofhacking.com/files/phrack/

I"m getting 404's on archive articles too, sigh. Randal's latest post 
provides the gist of what occurs though.

Thanks,
-- 
Charles DeRykus


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 9714
***************************************


home help back first fref pref prev next nref lref last post