[26044] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8252 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 15 03:05:26 2005

Date: Fri, 15 Jul 2005 00:05:05 -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           Fri, 15 Jul 2005     Volume: 10 Number: 8252

Today's topics:
        Apache::Session shared between user <""alexjaquet\"@[no spam]msn.com">
    Re: Earthquake Forecasting Program  July 11, 2005 <edgrsprj@ix.netcom.com>
    Re: filter characters from libcurses. <sisyphus1@nomail.afraid.org>
    Re: In basic I say Dim var$(50,50), how to make 2 dimen <abigail@abigail.nl>
    Re: stat/mtime on Windows changes with daylight saving <sisyphus1@nomail.afraid.org>
    Re: stat/mtime on Windows changes with daylight saving <obetz@despammed.com>
    Re: Tk: Text works with TIE, Scrolled doesn't <lusol@iMac-C.CC.lehigh.EDU>
    Re: Writing directly to system memory <sisyphus1@nomail.afraid.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 15 Jul 2005 08:31:04 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Apache::Session shared between user
Message-Id: <42d7582f$0$1152$5402220f@news.sunrise.ch>

Hi,

I could not find why I got the following trouble,
my session is shared between user

for example if I'm loged into my account foreign user
access my site trough my account


I use session like the following :

local our %session;
local our  $query = CGI->new ;

my $action = $query->param('action');
$action =~ s/\W//g; ;

if ($action eq "login") {
     login();
}

sub login {
     my $username = $query->param('user_name') ;
     $username=~ s/\W//g; ;
     my $userpassword = $query->param('user_password');
     $userpassword =~ s/\W//g; ;

      # sql query ..
     if ($user_name && $user_password) {
	
	    #$CGI::Session::MySQL::TABLE_NAME = 'sessions';
	
	      tie %session, 'Apache::Session::MySQL', undef, {
			DataSource => 'dbi:mysql:recordz:localhost:sessions',
			UserName => 'alexj',
			Password => 'xx',
			LockDataSource => 'dbi:mysql:recordz:localhost:sessions',
			LockUserName => 'alexj',
			LockPassword => 'x'
		    };
	
	
     $session {username} = "$username";
     $session {level} = "$level";
 ...
}

another action :

sub manageVinyl {
     my $statut = $query->param('statut');
     $statut =~ s/\W//g; ;
     my $username  = $session{username};
     print "Content-type: text/html\n\n";
     print "username : $username";
}

without login another user could access it !!!!

I try to purge sessions table in the database but user is still loged
any idea ?

I'm using Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/4.3.11 
mod_perl/2.0.1 Perl/v5.8.7


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

Date: Fri, 15 Jul 2005 04:42:12 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Earthquake Forecasting Program  July 11, 2005
Message-Id: <E8HBe.10764$aY6.7328@newsread1.news.atl.earthlink.net>

"Hank Oredson" <horedson@earthlink.net> wrote in message
news:6DhBe.3077$dU3.691@newsread2.news.pas.earthlink.net...

> >> >> > "edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
> >> >> > news:D7qAe.21003$eM6.9503@newsread3.news.atl.earthlink.net...
> >> >> >> PROPOSED EARTHQUAKE FORECASTING
> >> >> >> COMPUTER PROGRAM DEVELOPMENT EFFORT

> I am looking for the SOURCE of the data, that is, where did
> YOU get the data from, so that I may obtain my own datasets.

> In particular I am interested in the EM dataset.


July 14, 2005

Hi Hank,

       I have another important project that I need to focus on at the
moment and unfortunately cannot yet spend too much time on this one.  The
purpose of the original post was simply to determine if there were any
people interested in this proposed project.  And your responses and others
indicate that there are.

       Detailed information regarding the forecasting program can be found
on the following Web page:

http://www.freewebz.com/eq-forecasting/301.html

       Demonstration versions of the data files you are interested in plus
an early, fully operational version of the Perl language data processing
program itself can be found in the following files:

http://www.freewebz.com/eq-forecasting/311.zip
http://www.freewebz.com/eq-forecasting/312.zip
http://www.freewebz.com/eq-forecasting/313.zip

       That program contains the following equations which do most of the
important work:

$londiff = 2**(1 + (abs($dblonval - $testlonval)/3.9));
$probvalue = $testsigstren*$testweight*(10 - $londiff);

       If you download all of the files and follow the ReadMe.txt
instructions for how to organize a directory where the files can be stored
and run, then if you have Perl running on your computer the ETDPROG.pl
program should run okay under Windows XP and fairly well under Windows 98.
Other operating systems probably need to have some adjustments made to the
ETDPROG.pl file.

       The files that I myself actually use are too large to store at that
Web site.  As far as obtaining the original data, each file is a composite
of a number of different types of data.  For instance, the main earthquake
data file contains actual earthquake data (mostly NEIS) and specially
processed sun, moon, ocean tide, and Solid Earth Tide data.  At the moment,
the complete files including the EM signal data file have to be obtained by
e-mail from me (no charge).  An important goal of this project is to have
all of them stored at a Web site for downloads.  Also, I collect the
EM signal data myself.  But if this project ever gets off the ground
those types of data will hopefully become available for free from
many sources around the world.

       Finally, remember as I said earlier, I have been working on this
project for 15 years.  And it covers a lot of territory.  A detailed
discussion of it would fill a small book!




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

Date: Fri, 15 Jul 2005 16:01:24 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: filter characters from libcurses.
Message-Id: <42d75158$0$12611$afc38c87@news.optusnet.com.au>


"Shea Martin" <sheam@hb-studios.com> wrote in message
news:vZzBe.61177$Ph4.1832749@ursa-nb00s0.nbnet.nb.ca...
> Not sure if I have the terminoly right, but basically, I have a handfully
of
> command line executables that use various sorts of progress bars.  In *nix
> one would use libcurses to generate such things, but I am in WIn32 now, so
> not sure what they used.
>
> Anyway, I am piping the output of these commands to a file with perl, and
I
> would like to strip out these characters.  Is there a simple way to do
this,
> or do I have to manually strip out one bad char at a time?
>

If the progress bars are being written to STDERR, then it's just a matter of
having the files grab anything that goes to STDOUT, and ignoring the rest.
'perldoc -q STDERR' has some helpful information regarding that. Note that
the Win32 equivalent of "/dev/null" is simply "nul".

Cheers,
Rob




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

Date: 15 Jul 2005 00:34:25 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: In basic I say Dim var$(50,50), how to make 2 dimensional aray in Perl?
Message-Id: <slrndde14g.1cc.abigail@alexandra.abigail.nl>

RedGrittyBrick (RedGrittyBrick@SpamWeary.foo) wrote on MMMMCCCXXXV
September MCMXCIII in <URL:news:db6fn6$j50$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com>:
%%  Abigail wrote:
%% >     my @power;
%% > 
%% >     for (my $x = 0; $x < 3; $x ++) {
%% >         for (my $y = 0; $y < 5; $y ++) {
%% >             $power [$x] [$y] = $x ** $y;
%% >         }
%% >     }
%% > 
%%  
%%  I much prefer ...
%%  
%%       for my $x (0..2) {
%%           for my $y (0..4) {
%%               $power [$x] [$y] = $x ** $y;
%%           }
%%       }
%%  
%%  ... perhaps because I'm not a C programmer.


I prefer not having to remember when Perl optimizes the range, and
when it creates a list. Perl programmer lazyness, I guess.



Abigail
-- 
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail


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

Date: Fri, 15 Jul 2005 11:05:24 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: stat/mtime on Windows changes with daylight saving
Message-Id: <42d70bf8$0$10191$afc38c87@news.optusnet.com.au>


"Oliver Betz" <obetz@despammed.com>

>
> I wonder why ActiveState doesn't solve this.
>

You would think that the corrections offered by Win32-UTCFileTime could be
incorporated into the perl source. Why that hasn't happened is a question
that should probably be raised with the perl porters (p5p) rather than
ActiveState.

Cheers,
Rob




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

Date: Fri, 15 Jul 2005 08:50:24 +0200
From: Oliver Betz <obetz@despammed.com>
Subject: Re: stat/mtime on Windows changes with daylight saving
Message-Id: <aijed1p2d9j5vgfe53ub6u916mq182jp3r@z1.oliverbetz.de>

"Sisyphus" <sisyphus1@nomail.afraid.org> wrote:

>> I wonder why ActiveState doesn't solve this.
>
>You would think that the corrections offered by Win32-UTCFileTime could be
>incorporated into the perl source. Why that hasn't happened is a question

One could also use a C compiler without the stat() bug as far as I
understand.

>that should probably be raised with the perl porters (p5p) rather than
>ActiveState.

Maybe. I thought it is an ActiveState issue because Cygwin's Perl
works as expected here.

What is ActiveState's contribution?

Oliver
-- 
Oliver Betz, Munich


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

Date: Thu, 14 Jul 2005 22:13:24 +0000 (UTC)
From: lusol <lusol@iMac-C.CC.lehigh.EDU>
Subject: Re: Tk: Text works with TIE, Scrolled doesn't
Message-Id: <db6o24$3paq$1@ws2.cc.lehigh.edu>

Stefan H. <stfhostf@kartos.de> wrote:
> the following code works properly, printing on Text all I print to
> STDOUT
> 
> my $text = $mw->Text->pack();
> tie *STDOUT, ref $text, $text;
> print "prova";

Yes, because the Text widget (more accurately, the class Tk::Text)
implements TIE methods.

> 
> but I want scrollbars, so I change to
> 
> my  $text = $mw->Scrolled("Text")->pack();
> 
> at running time Perl output the following error. What's wrong??
> 
> Tk::Error: Failed to AUTOLOAD 'Tk::Frame::TIEHANDLE' at C:\Documents and
> Setting
> s\manfry\Desktop\perl\prova.pl line 163

The Tk Scrolled() method does its magic by creating an outer Frame
widget and placing the Text widget and Scrollbar widgets inside the
Frame - and Scrolled() returns the Tk::Frame reference, not the
Tk::Text reference. Thus, the "tie *STDOUT, ref $text" statement TIEs
to the wrong class.  And since Tk::Frame provides no TIE methods, you
see your error.

The trick is to use the Subwidget() method to fetch the Tk::Text
widget reference and tie() to that:

my $frog = $text->Subwidget( 'scrolled' );
tie *STDOUT, ref $frog, $text;

Steve
-- 
@_=map{eval"100${_}"}split/!/,'/5!*2!+$]!/10+$]';use Tk;$m=tkinit;$t='just an'.
'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
z(@_[2,3],-te,$t,-fi,'gray50');$c->$z($_[2]-$],$_[3]-$],-te,$t);$m->bind('<En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;


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

Date: Fri, 15 Jul 2005 15:44:20 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Writing directly to system memory
Message-Id: <42d74d56$0$17310$afc38c87@news.optusnet.com.au>


"Rob" <rm@nospam.popeslane.clara.co.uk> wrote in message
news:BbKdnTkl4oPWTUvfRVnyvg@pipex.net...
> If I have an SV that contains a real (valid) memory address I can read
> bytes from that memory address using:
>
>    unpack("I", unpack("P4", pack("L", $address)));

I use the same to unpack an integer value from a perl object. Given that an
integer consists of a number of bytes, I guess it's correct to say that
"bytes from that memory address" are being read. In the simple little
(Inline::C) demo that I have, the integer value is being set by an xsub
(Inline::C function), and I have another xsub (Inline::C function) that can
assign a new value.

>
> Is there a similar perl mechanism that would allow me to write bytes
> back at that memory address?
>

I really don't know - but I'm damned if I can do it by any means other than
calling the afore-mentioned xsub. (I hope someone will answer that
question.)

>
> Background:
>
> Using Win32::GUI a number of callback functions for windows GUI events
> pass the a win32api lParam value to the callback.  For some events the
> lParam value is a pointer to windows memory, and for some of those
> events it is necessary to change parts of the structure pointed to in
> order to get specific behaviour.
>
> I am currently using Win32::API and the win32api RtlMoveMemory function
> to achieve what I need, but I would like to remove the Win32::API
> dependency.
>
> Perhaps the best solution is to deal with this XS-side in the Win32::GUI
> source?
>

In general, the simplest way to get away from Win32::API is to use
Inline::C - which writes the xs code (from the C code that you've inlined),
then compiles that code and executes your script. In terms of functionality,
it's essentially the same as xs, but saves you the trouble of writing the xs
file, the Makefile.PL, etc.

If you're interests are mainly based around Win32::GUI then it might be
easier for you to hack at the Win32::GUI source than mess with Inline::C.
It's difficult to tell from here :-)

Inline::C does work nicely with the Windows API. For a simple example, see
'perldoc Inline::C-Cookbook' and search the document for  "windows" (minus
the quotes).

Cheers,
Rob





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

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 8252
***************************************


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