Hello, beginners.
Sorry for offtopic.
Could you help me.
How i can decrease time demand fetching for a very simple query? (in my case i have
trouble because table is very big)
Where I can read about this?
fanx.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [E
The MySQL book by DuBois (published by New Riders) will tell you everything
you need to know about MySQL. Also, it sounds like you don't have any
indexes built for your table if a "very simple query" is taking a long time.
Indexes will decrease your time to almost nothing, unless your query is no
Hello, JOE.
You wrote 22 ìàðòà 2002 ã., 15:06:36:
1.indexes exist.
2.query like
"select count(some_table.itemID) from some_table where keywords like '%begin' or like
'end%'".
3.table ~70M.
MJA> The MySQL book by DuBois (published by New Riders) will tell you everything
MJA> you need to know a
linux environment. have o'reilly cookbook & learning perl (2nd ed.).
desire to randomly choose a filename of mp3 files in a directory
containing only mp3's.
then, write the name of this filename to a file that has
"http://myurl.org/mywebpath/..."; inserted before the filename so that i
end up w
Ya gotta write it yourself. You should look at the function glob() and
rand() for starters.
> -Original Message-
> From: K Clark [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 22, 2002 8:30 AM
> To: [EMAIL PROTECTED]
> Subject: how to randomly choose mp3 from dir, print mp3_filename for
Here's what i have, and here's the problem. and here's what i 'think' i
have to learn/do to fix it:
#/usr/bin/perl -w
use strict;
#
# script to randomly choose a song
# and embed html with a link to it
#
my @mp3 = glob("/www/mp3/*.mp3");
#
# put while statement
my $mp3 =~ s#.*/##;
srand;
print "
read up on substitution. You need to put the array through a foreach loop.
foreach my $mp3 (@mp3s){
$mp3 =~ s#/www/mp3/##;
}
Can you e-mail me that MP3 (the one you used as an example)?
> -Original Message-
> From: K Clark [mailto:[EMAIL PROTECTED]]
> Sent: Friday, Marc
Hi all
In the program below I am attempting to count the number of times that a phone
number(purely digits) occurs in a file of text.
I am not succeeding cause i end up counting all the digits of phone numbers that
occurs.
Could anyone help.
-
> In the program below I don't know when to stop the loop.
> (CTRL + d ) will just terminate the program, leaving the
> data via STDIN unattended, this is my problem.
>
> Lets define what I want to do:
> I want to print the frequency of every word at the beginning.
> and every word at the end
i have defined a sub using
sub mysubname{
code here
}
but how do i call it? i have tried just having the name but that doesn't
work.
--
Matthew Harrison
Internet/Network Services Administrator
Peanut-Butter Cheesecake Hosting Services
Genstate
www.peanutbuttercheesecake.co.uk
--
To
On Fri, Mar 22, 2002 at 09:37:05AM -0500, David Gray wrote:
> while() will create an infinite loop,
No, it won't. The "while ()" idiom will read one line at a
time and automatically terminate the loop at the end of the file.
> so you do need some sort of
> sentinel value to break out of the lo
> -Original Message-
> From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
> Subject: callin subs
>
> i have defined a sub using
>
> sub mysubname{
> code here
> }
>
> but how do i call it? i have tried just having the name but
> that doesn't
> work.
>
> --
> Matthew Harrison
m
Hello
In order to increase the time execution of a Perl script, I wonder if it is
possible to reduce the time loading of a module at the compilation step. In
particular, is the time loading reduced when just one of the symbols
exported by the module is used ? I mean, does the instruction 'use
Hello
Does it exist a CPAN module that computes the exhaustive graph of the
subroutines of a script ?
Example:
Suppose script.pl contains the following code :
sub routine_B2 { ... }
sub routine_B1 { ... }
sub routine_A2 { ... routine_B2(); ... }
sub routine_A1 { ... routine_B1(); ... }
ro
Bonjour,
Afin d'ameliorer le temps d'execution des scripts, je me demande s'il est
possible de reduire le temps de chargement des modules a la phase de
compilation. En particulier, est-ce que le temps de chargement est reduit
dans le cas ou un seul des symboles exportes par le module est utilis
I think this is a prime example of TMTOWTDI (There's More Than One Way
To Do It) - you now have two choices for how to indicate the end of
input to your while() loop:
1) pressing ^Z instead of ^D
2) breaking out of your loop when you see certain input indicating end
of input
-dave
ps - I think
Hi all,
Firstly, thanks for all your help, its really appreciated !!
I emailed [EMAIL PROTECTED] and asked about using HTML templates instead of
embedding my HTML in my perl scripts. It was suggested that I use the
following code.
- filename = sample.pl
Yes Perl is very useful for doing the work stated, but the group needs to know
from either a script you want to change or showing some code you desire to change, so
they can assist and hopefully point you in the right direction.
move,copy,rename can be handled by File::Copy
HI Rebecca --
I an still a newbie but I really learned alot from this tutorial:
http://www.netcat.co.uk/rob/perl/win32perltut.html
After you go thru this tutorial then give learning perl a try. I bet it
will be alot easier then:-)
Best of luck; perl is really good for windoze admin stuff.
Mi
I am writing a perl front-end to create dynamic queries on a mysql
database, and i'm a pretty new programmer!
I want to offer the user a date range, and the dates I want to use are
stored in records in my database:
2002-02-17
2002-02-24
2002-03-02
2002-03-09
2002-03-15
and I kow how to s
HI all --
Awhile ago I posted a question about accessing Windows Task Scheduler
from Perl. Unfortunately, I didn't get a response. Anyways, I found a
nice module and wanted to let everyone know incase someone wanted to use
Task Scheduler from perl.
http://taskscheduler.sourceforge.net
Check i
First of all, you are only matching a single digit. You want to change your
regular expression from /(\d)/ to /(\d+)/, which matches one or more digits,
and slurps up as many as it finds in a row. One issue you will have is that
a file containing addresses, you are also going to get a count on a
K Clark wrote:
>
> linux environment. have o'reilly cookbook & learning perl (2nd ed.).
>
> desire to randomly choose a filename of mp3 files in a directory
> containing only mp3's.
>
> then, write the name of this filename to a file that has
> "http://myurl.org/mywebpath/..."; inserted before
K Clark wrote:
>
> Here's what i have, and here's the problem. and here's what i 'think' i
> have to learn/do to fix it:
>
> #/usr/bin/perl -w
> use strict;
> #
> # script to randomly choose a song
> # and embed html with a link to it
> #
> my @mp3 = glob("/www/mp3/*.mp3");
> #
> # put while sta
I have a script that generates test questions and grades them . I was
asked to make them generate in a random order , can someone point me in the
right direction
They come in two files make_test.cgi and grade.cgi
#! /usr/bin/perl
#
#make test for Cram Program
#
# version 0.02
I am writing a perl script. In it, I need to call another script that
happen to be written in tcl. I need to pass arguments to that tcl script.
Also, I need to get some return values from that tcl script.
What is the best way for me to do that?
Thanks.
==
This worked for me while I was a TA.
my $numberOfStudents = scalar keys %Grade;
my @studentGrades = map { rand(100) } (1 .. $numberOfStudents);
foreach my $student (keys %Grade){
%Grade{$student} = shift @studentGrades;
}
> -Original Message-
> From: FLAHERTY, JIM-CONT
Bruce Ambraal wrote:
>
> Hi all
Hello,
> In the program below I am attempting to count the number of times that a phone
>number(purely digits) occurs in a file of text.
> I am not succeeding cause i end up counting all the digits of phone numbers that
>occurs.
>
> Could anyone help.
>
>
>
I appreciate the replies so much. I start out with a command line like
this: "backup.bat mm dd yy "
where mm is the 2-digit month, dd is the 2-digit day, yy is the 2-digit
year, and is the 4-digit year. Those are my variables, as I suppose
they would be called. (Besides some programming
Hi All, I was trying to generate variations of the 8 character string
"" by changing every character with the elements containing in
an array @aa = ('A', 'B', 'C', 'D'). The way I did it was quite naive,
using a "for" loop that changes the A character at position 1 of the
string
At 04:50 PM 3/22/02 +0100, Patrice Boisieau wrote:
>Bonjour,
>Afin d'ameliorer le temps d'execution des scripts, je me demande s'il est
>possible de reduire le temps de chargement des modules a la phase de
>compilation. En particulier, est-ce que le temps de chargement est reduit
>dans le cas o
At 04:43 PM 3/22/02 +0100, Patrice Boisieau wrote:
>Hello
>
>Does it exist a CPAN module that computes the exhaustive graph of the
>subroutines of a script ?
It is not possible in general to tell such things from a Perl program
because it could always call a subroutine that is generated at runt
At 12:01 PM 3/22/02 -0800, I wrote:
>At 04:43 PM 3/22/02 +0100, Patrice Boisieau wrote:
>>Hello
>>
>>Does it exist a CPAN module that computes the exhaustive graph of the
>>subroutines of a script ?
>
>It is not possible in general to tell such things from a Perl program
>because it could always
I'm on my day off, so I can't test this, but it should get you started.
use File::Copy;
#Get the date variables based on system time
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@months = qw(00NUL 01JAN 02FEB 03MAR 04APR 05MAY 06JUN 07
if i have a file delimited by commas and i want to make a script that will
search to see if a word, passed in a query string, is in the file, and
redirect to one url if i does and one if it doesn't (both urls are also
passed via query strings)
thanks in advance
--
Matthew Harrison
Internet/N
my random mp3 script works with strict and warnings (yeah!). now, i want
to do a second task with it, which is additionally write the data of
$inc to a file, named mp3.inc. Here's what i have. i can't find the
reference to doing this. even the correct perldoc pointer would be
wonderful.
#/usr/bi
perldoc -f print
print FILEHANDLE LIST;
In your case:
print MP3 "$inc\n"; # \n is a newline character
> -Original Message-
> From: K Clark [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 22, 2002 3:40 PM
> To: [EMAIL PROTECTED]
> Subject: write variable's contents to file :WAS: how to
Pedro A Reche Gallardo wrote:
>
> Hi All,
Hello,
> I was trying to generate variations of the 8 character string
> "" by changing every character with the elements containing in
> an array @aa = ('A', 'B', 'C', 'D'). The way I did it was quite naive,
> using a "for" loop that changes t
is there something that says a variable doesn;t get passed when calling a
sub in the same script? i am working on a web-based role-playing game and
this is the script for inside the temple:
#!/usr/bin/perl
##Modules##
use CGI qw/:standard/;
use CGI::Carp "fatalsToBrows
all sorted now, thanks to you experts. it was because I have prefixed my
variables with 'my' which restricted them.
On Friday 22 Mar 2002 3:34 pm, Matthew Harrison wrote:
> is there something that says a variable doesn;t get passed when calling a
> sub in the same script? i am working on a web-b
Thanks for the input. The only trouble I would have with that is the file
size. My files are HUGE. I don't think the admins around here would like me
doing that. What I was thinking was to generate an array with a bunch of
random numbers in numerical order. Then run through the file and print only
If the code then change if( $i = $array[$j] ) to if( $i == $array[$j] )
otherwise you end assigning $i with the value of $array[$i].
Wags ;)
-Original Message-
From: Balint, Jess [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 13:04
To: '[EMAIL PROTECTED]'
Subject: Re: R
I just typed the code in the e-mail. It was part of my program. Sorry.
-Original Message-
From: Wagner-David [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 4:16 PM
To: 'Balint, Jess'; '[EMAIL PROTECTED]'
Subject: RE: Random sampling in perl
If the code then change if( $
If you want to search line by line, use this:
while( ) {
if( /searchword/ ) {
# redirect to url
}
}
# redirect to OTHER url
This will go through the file, line by line and check for the word. If found
you will need to add code to go to the URL you want. Other wi
I know many have probably answered this but Im just going down my email
list. Here is the answer:
@asplit = split(//,$a);
That should be it.
- Jim
At 22:41 03.20.2002 -0800, Raja Gopal wrote:
>Hello Perl Experts,
>
> I want to split the string $a ="abcdef";
>as @asplit = ("a","b","c","d",
I'm trying to build a forking server which uses unix domain sockets for
communication (on solaris 7).
I've run into a problem where once a connection has been established and
serviced by a child, my domain socket won't accept any more incoming
connections.
I modified my code so it doesn't fork (h
K Clark wrote:
>
> my random mp3 script works with strict and warnings (yeah!). now, i want
> to do a second task with it, which is additionally write the data of
> $inc to a file, named mp3.inc. Here's what i have. i can't find the
> reference to doing this. even the correct perldoc pointer woul
Oops, I didn't realize this was cross-posted, and replied to the first
instance I saw (the beginner's CGI list). The Perl beginner's and Perl
beginner's CGI lists are, for the most part, mutually exclusive. (Does it or
does it not have to do with CGI?). Please don't cross post, people. I assure
yo
Try something like this:
my $string = "";
my @aa = qw(A C D E F G H I K L M N P Q R S T V W Y);
foreach(@aa){
my $i;
my @strArray = split //,$string;
for($i = 0;defined $strArray[$i];$i++){
my $j;
for($j = 0;defined $strArray[$j];$j++){
if($j == $i){
Oh, hey, didn't see this response. Ignore mine. This is better. :) I
really need to start using substr(). One question, though. Are there any
caveats or down sides to using it?
-Original Message-
From: John W. Krahn
To: [EMAIL PROTECTED]
Sent: 3/22/02 12:46 PM
Subject: Re: string qu
I've removed [EMAIL PROTECTED] from the Cc: list. I don't see how any
of this directly relates to CGI. Please avoid cross-posting unless relevant
and absolutely necessary.
On Sat, Mar 23, 2002 at 05:30:25AM +0800, Connie Chan wrote:
> 1. When I open a text file with *lines, however, I just wan
Hi,
I am currently stuck with developing an elegant solution for splitting a
long text line into an array of strings of the certain maximum length and
it should be split at online at word bounderies. So, my criterias are max
length (78 chars) and split at \b.
Is there any standard routine to
while($text =~ /(\b.{0,78}\b)/g){
push @array, $1;
}
-Original Message-
From: Oliver Andrich
To: [EMAIL PROTECTED]
Sent: 3/22/02 2:46 PM
Subject: Regex or code sample to split a text line
Hi,
I am currently stuck with developing an elegant solution for splitting a
long text line i
Check out page 219 of the Perl Cookbook...
s(^.*/)()
Chris
- Original Message -
From: "K Clark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 22, 2002 8:14 AM
Subject: RE: how to randomly choose mp3 from dir, print mp3_filename for e
mailing to a list]
> Here's what
'close $sock' in the child?
Wouldn't that kill the socket for the parent. Then no more connections for
parent.
also, why 'fork' in the client? what's the point?
On Friday, March 22, 2002, at 01:33 PM, Ross Simpson wrote:
> I'm trying to build a forking server which uses unix domain sockets
i need to join $stringa to $stringb with a coma in the middle (no
whitespaces). i have tried
$stringc = $stringa.",".$stringb
but it says there is a problem. what should it be?
--
Matthew Harrison
Internet/Network Services Administrator
Peanut-Butter Cheesecake Hosting Services
Genstate
www.
what did it say the problem was?
that line is missing a semicolon at end.
On Friday, March 22, 2002, at 03:40 PM, Matthew Harrison wrote:
> i need to join $stringa to $stringb with a coma in the middle (no
> whitespaces). i have tried
>
> $stringc = $stringa.",".$stringb
>
> but it says there i
it said scalar found where operator expected.
On Friday 22 Mar 2002 11:44 pm, bob ackerman wrote:
> what did it say the problem was?
> that line is missing a semicolon at end.
>
> On Friday, March 22, 2002, at 03:40 PM, Matthew Harrison wrote:
> > i need to join $stringa to $stringb with a coma
did it say the error was on the line you are showing below, or on the next
line?
i am getting at asking if you really end the line with semicolon or not.
On Friday, March 22, 2002, at 03:46 PM, Matthew Harrison wrote:
> it said scalar found where operator expected.
>
> On Friday 22 Mar 2002 11
the semicolon was in my script i jsut forgot to put in in my email. sorry.
On Friday 22 Mar 2002 11:51 pm, bob ackerman wrote:
> did it say the error was on the line you are showing below, or on the
> next line?
> i am getting at asking if you really end the line with semicolon or not.
>
> On Fri
This program worked for me:
#!/usr/bin/perl
$stringa = "apple";
$stringb = "banana";
$stringc = $stringa . "," . $stringb;
print "$stringc\n";
-Original Message-
From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 3:40 PM
To: [EMAIL PROTECTED]
Subject: join
What I am seeing is that you are using the double quote and it should be
single quotes
-Original Message-
From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 3:40 PM
To: [EMAIL PROTECTED]
Subject: joining 2 strings
i need to join $stringa to $stringb with a co
maybe you could show what is in $stringa and $stringb.
show a few lines before and after the line with the error.
there isn't anything wrong with the line as it is here.
On Friday, March 22, 2002, at 03:51 PM, Matthew Harrison wrote:
> the semicolon was in my script i jsut forgot to put in in m
what difference would that make? double quotes would only try and do
variable substitution.
It wouldn't do anything with a comma.
On Friday, March 22, 2002, at 03:50 PM, Jon Riddle wrote:
> What I am seeing is that you are using the double quote and it should be
> single quotes
>
> -Origin
On Fri, Mar 22, 2002 at 11:40:26PM +, Matthew Harrison wrote:
> $stringc = $stringa.",".$stringb
>
> but it says there is a problem. what should it be?
That's one way of doing it. What does it say the problem is?
Michael
--
Administrator www.shoebox.net
Programmer, S
the script is part of a web-based role-playing-game. the line in question
is in the sub called 'add':
#!/usr/bin/perl
###Vars and modules###
use CGI qw/:standard/;
use CGI::Carp "fatalsToBrowser";
use DBI;
$action = param('action');
$word = param('word');
$rd1 = param('rd1');
$rd2 = param('rd
would someone tell me whether or not the problem with what the original
post is because of $stringa.",".$stringb being unbroken? does that
matter?
as a fledgling, i always pump alot of space in my scripts, but see some
of the more advanced replies here being different...
ken
On Fri, Mar 22, 20
no. extra white space is ignored. works fine.
note the original that failed did end with a semicolon.
On Friday, March 22, 2002, at 04:01 PM, K Clark wrote:
> would someone tell me whether or not the problem with what the original
> post is because of $stringa.",".$stringb being unbroken? does
Looks like eiter $record or $word is a scalar where perl is looking for an
operand. try:
die $record;
or
die $word
to see what the data is. You can only use the "." to concatenate strings.
-Original Message-
From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 20
This may not be it but did you check the database to see what info is being
passed to $record = $results[0]; or you can check the HTML page that $word =
param("word"); gets its info from?
-Original Message-
From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 4:0
after all this, it was a simple typo, i had accidentally put a comma in the
place of the first period. I am really, really sorry for messing you guys
about like this.
On Friday 22 Mar 2002 11:59 pm, you wrote:
> On Fri, Mar 22, 2002 at 11:40:26PM +, Matthew Harrison wrote:
> > $stringc = $s
Matthew Harrison wrote:
>
> it said scalar found where operator expected.
perldoc perldiag
[snip]
%s found where operator expected
(S) The Perl lexer knows whether to expect a term or
an operator. If it sees what it knows to be a term
when it was expecti
Heh heh! That's OK. Just buy us all a round at some pub when we go across
the pond!
-Original Message-
From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 4:34 PM
To: Michael Fowler
Cc: [EMAIL PROTECTED]
Subject: Re: joining 2 strings
after all this, it was a
sure
On Saturday 23 Mar 2002 12:37 am, you wrote:
> Heh heh! That's OK. Just buy us all a round at some pub when we go across
> the pond!
>
> -Original Message-
> From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 22, 2002 4:34 PM
> To: Michael Fowler
> Cc: [EMAIL PRO
Does it have the same error if you change the line to this?
$newrec = "$record,$word";
-Original Message-
From: Matthew Harrison
To: bob ackerman
Cc: [EMAIL PROTECTED]
Sent: 3/22/02 3:59 PM
Subject: Re: joining 2 strings
the script is part of a web-based role-playing-game. the line in
Matthew Harrison wrote:
>
> i need to join $stringa to $stringb with a coma in the middle (no
> whitespaces). i have tried
$ perl -le' $one = "one"; $two = "two";
print $one . "," . $two;
print "$one,$two";
print join ",", $one, $two;
'
one,two
one,two
one,two
John
--
use Perl;
program
fulf
Dear All,
I have sort of questions, would you please give me some hint, even refering me to a
perldoc would be nice too.
1. When I open a text file with *lines, however, I just want to read the first line,
would this be a good idea ?
open (FILE, "textfile.txt"); $firstline = ; close (FILE);
w
1. It will only read the first line. The time you want to be careful with
<> is when you are assigning it to a list. For example, @myarray =
; will assign the entire contents of the file, while $myscalar =
; will assign only the first line.
2. In Windows, the endline character is interpreted
Oops! The exclamation point in number 7 was a typo.
-Original Message-
From: Timothy Johnson
To: 'Connie Chan '; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 3/22/02 1:59 PM
Subject: RE: Sort of Conceptual, Syntax, and modules related questions
1. It will only read the first line. T
79 matches
Mail list logo