Re: [Arsperl-users] Performance problems
Brought to you by:
jeffmurphy
|
From: Paizo <pai...@gm...> - 2007-08-03 07:31:38
|
Thank you all, very helpfull :)
by now it take 5 minuts instead of 60, an impressive improvement!
2007/8/2, Priddy, Tim <tim...@in...>:
>
> my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =3D
> localtime ( $entry{$field_id[3]} );
>
> my $timestamp_a =3D sprintf "%02d/%02d/%04d %02d.%02d.%02d", $mday, $mon =
+
> 1, $year + 1900, $hour, $min, $sec;
>
>
>
> I'd recommend that you also start using:
>
>
>
> use warnings;
>
> use strict;
>
>
>
> -----Original Message-----
> From: ars...@ar... [mailto:
> ars...@ar...] On Behalf Of Thilo Stapff
> Sent: Thursday, August 02, 2007 8:50 AM
> To: ARSperl User Discussion
> Subject: Re: [Arsperl-users] Performance problems
>
>
>
> $field_ids[3] contains just the field id itself.
>
>
>
> The value of the field is in $entry{$field_id[3]}}.
>
>
>
> You should also note that gmtime returns the month as numbers 0..11
>
> instead of 1..12.
>
> Anyway, an easier (and problably more reliable) method for date
>
> formatting would be to use a module from CPAN (e.g. Date::Format).
>
>
>
>
>
> Regards,
>
> Thilo
>
>
>
>
>
> Paizo wrote:
>
> > i tried the following:
>
> >
>
> >
>
> > foreach my $entry_id (sort keys %entries) {
>
> > my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id, @field_ids)=
;
>
> >
>
> > print "$field_ids[3]\n";# test: print number 3 the first clicle the=
n
>
>
> > nothing
>
> >
>
> > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =3D
>
> > gmtime($field_ids[3]);
>
> >
>
> > $year +=3D 1900;
>
> > $mon +=3D 1;
>
> >
>
> > if ($mday < 10) {
>
> > $timestamp_a =3D "0".$mday.q{/};
>
> > } else {
>
> > $timestamp_a =3D $mday.q{/};
>
> > }
>
> >
>
> > if ($mon < 10) {
>
> > $timestamp_a .=3D "0".$mon.q{/}.$year." ";
>
> > } else {
>
> > $timestamp_a .=3D $mon.q{/}.$year." ";
>
> > }
>
> >
>
> > if ($hour < 10) {
>
> > $timestamp_a .=3D "0".$hour.".";
>
> > } else {
>
> > $timestamp_a .=3D $hour.".";
>
> > }
>
> >
>
> > if ($min < 10) {
>
> > $timestamp_a .=3D "0".$min.".";
>
> > } else {
>
> > $timestamp_a .=3D $min.".";
>
> > }
>
> >
>
> > if ($sec < 10) {
>
> > $timestamp_a .=3D "0".$sec;
>
> > } else {
>
> > $timestamp_a .=3D $sec;
>
> > }
>
> >
>
> > print "$timestamp_a\n\n"; #test: print 01/01/1970 00.00.03 in the
>
> > first cile then always 01/01/1970 00.00.00
>
> >
>
> > $field_ids[3] =3D $timestamp_a;
>
> > print datafile join("|", @entry{@field_ids} ) . "\n";
>
> >
>
> > }
>
> >
>
> >
>
> > hope its more clear.
>
> >
>
> >
>
> >
>
> > 2007/8/2, Clayton Scott <cla...@gm...
>
> > <mailto:cla...@gm...>>:
>
> >
>
> > On 8/2/07, Paizo <pai...@gm...
>
> > <mailto:pai...@gm...>> wrote:
>
> > > i have another ( stupid question, still new to perl :| ) , if
>
> > inside the the
>
> > > loop:
>
> > > [ loop snipped ]
>
> > > i want to convert some dates that are in seconds since 1970 to
>
> > something
>
> > > like dd/mm/yyyy hh.mm.ss
>
> > > if i try to read $field_ids[3] and always get "3" instead of the
> real
>
> > > content :/
>
> > > what i miss?
>
> >
>
> > Without more code, and data I really can't tell.
>
> >
>
> > If you want the value for a field in the form you more likely want
> to
>
> > use the entry hash:
>
> >
>
> > $entry{'field_id'}
>
> >
>
> > If you want to inspect these data structures you can use the
>
> > Data::Dumper module.
>
> >
>
> > use Data::Dumper;
>
> > ....
>
> >
>
> > print Dumper \@field_ids;
>
> >
>
> > foreach my $entry_id (sort keys %entries) {
>
> > my %entry =3D ars_GetEntry($ctrl, $ARSschema, $entry_id,
> @field_ids);
>
> > print Dumper \%entry;
>
> > print datafile join("|", @entry{@field_ids} ) . "\n";
>
> > }
>
> >
>
> > --
>
> >
>
> > Clayton Scott
>
> > cla...@gm... <mailto:cla...@gm...>
>
> >
>
> >
> -------------------------------------------------------------------------
>
> > This SF.net email is sponsored by: Splunk Inc.
>
> > Still grepping through log files to find problems? Stop.
>
> > Now Search log events and configuration files using AJAX and a
> browser.
>
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
>
> > _______________________________________________
>
> > Arsperl-users mailing list
>
> > Ars...@ar... <mailto:Ars...@ar...>
>
> > https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
> >
>
> >
>
> >
>
> >
>
> > --
>
> > --------------------
>
> > A me cugin na volta xe nd=E0 dal geataro e el ga domand=E0 na coppetta
>
> > trigusto co i gusti seegheta, sarexe e schie co na fettina de poenta.
>
> > El geataro pena sentio che=E0 goduriosa scelta, el se ga messo subito e=
l
>
> > pigiama de banane e el ghe ga messo in testa a corona de poegge medie e
>
> > lo ga fatto diventare Re dei Gelati Biricchini.
>
> > -----------------------
>
> > Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e
>
> > fete de poenta, stile estat=E8 o quea dea ciocoeata
>
> > Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da
>
> > tociare o erbagatta/straciatella/calsina co coe de sorxe da tociare
>
> > ------------
>
> > Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli
>
> > col el gusto crema al diserbo e parafl=F9 ricoperta da una soffice cros=
ta
>
> > de pus co al posto del bacheto un termometro anale pratico pa misurarse
>
> > a freve dopo aver magn=E0 el geato (chi xe che no lo fa al giorno
>
> > d'oggi?!?!). Garantite scorese bitonali e solfeggi anali.
>
> >
>
> >
>
> > -----------------------------------------------------------------------=
-
>
> >
>
> >
> -------------------------------------------------------------------------
>
> > This SF.net email is sponsored by: Splunk Inc.
>
> > Still grepping through log files to find problems? Stop.
>
> > Now Search log events and configuration files using AJAX and a browser.
>
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
>
> >
>
> >
>
> > -----------------------------------------------------------------------=
-
>
> >
>
> > _______________________________________________
>
> > Arsperl-users mailing list
>
> > Ars...@ar...
>
> > https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
>
>
>
>
> -------------------------------------------------------------------------
>
> This SF.net email is sponsored by: Splunk Inc.
>
> Still grepping through log files to find problems? Stop.
>
> Now Search log events and configuration files using AJAX and a browser.
>
> Download your FREE copy of Splunk now >> http://get.splunk.com/
>
> _______________________________________________
>
> Arsperl-users mailing list
>
> Ars...@ar...
>
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
>
--=20
--------------------
A me cugin na volta xe nd=E0 dal geataro e el ga domand=E0 na coppetta trig=
usto
co i gusti seegheta, sarexe e schie co na fettina de poenta.
El geataro pena sentio che=E0 goduriosa scelta, el se ga messo subito el
pigiama de banane e el ghe ga messo in testa a corona de poegge medie e lo
ga fatto diventare Re dei Gelati Biricchini.
-----------------------
Confezione trigusto seegheta/sarexe/chie co pratico contenitore par e fete
de poenta, stile estat=E8 o quea dea ciocoeata
Altri gusti poe essere bigadini/kiwi/lasonil co socoi de vacca da tociare o
erbagatta/straciatella/calsina co coe de sorxe da tociare
------------
Rileggendo a firma diria che se poe puntare al mercato dei ghiaccioli col e=
l
gusto crema al diserbo e parafl=F9 ricoperta da una soffice crosta de pus c=
o
al posto del bacheto un termometro anale pratico pa misurarse a freve dopo
aver magn=E0 el geato (chi xe che no lo fa al giorno d'oggi?!?!). Garantite
scorese bitonali e solfeggi anali.
|