How to sort a character-type field, numerically

2002-09-25 Thread John Almberg

I'm trying to sort a SQL table that contains a character-type field that
contains mostly numbers. This field always contains either a number or a
number followed by a character. Like '57' or '57a'.

I'd like to sort the table *numerically* on this field, not *alphabetically*
on this field. That is, I'd like the table to be sorted like:

1 ...
2a ...
3 ...
4d ...

NOT like:

1 ...
11 ...
111a ...
2a ...
22 ...

See what I mean? This is a common problem, I think, when you sort an
character type field that contains numbers. The sort comes out all wrong.

It would be great if I could get rid of the characters, then I could make
the field a pure integer and the sort would work great, but that's not
possible (or easily possible.)

A pseudo-code solution would be SELECT * FROM table ORDER BY
INT(char-field), but unfortunately even MySql doesn't have such an INT()
cast funtion.

I'm asking this perl group, because I suspect that my only solution is to
sort the result set in perl. Am I right about this???

Thanks.

-- John



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How to sort a character-type field, numerically

2002-09-25 Thread John Almberg

Well, right now I'm doing the sort in SQL. That's the problem. Since its a
character-type field, I can't get MySQL to sort properly.

I guess I could use DBI::fetchall_arrayref to fetch all the data at once,
then sort the array of records the way I need them. However, what I'm hoping
for is some SQL expert to tell me this would be a silly approach!

-- John

 -Original Message-
 From: Wagner, David --- Senior Programmer Analyst --- WGO
 [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 25, 2002 4:48 PM
 To: 'John Almberg'; Beginners
 Subject: RE: How to sort a character-type field, numerically



   You should be able to sort it numerically if I understand where the
 data is coming from.  Could you provide a snippet of the code and
 from there
 it should not be that hard to provide code to sort numerically.

 Wags ;)

 -Original Message-
 From: John Almberg [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 25, 2002 13:18
 To: Beginners
 Subject: How to sort a character-type field, numerically


 I'm trying to sort a SQL table that contains a character-type field that
 contains mostly numbers. This field always contains either a number or a
 number followed by a character. Like '57' or '57a'.

 I'd like to sort the table *numerically* on this field, not
 *alphabetically*
 on this field. That is, I'd like the table to be sorted like:

 1 ...
 2a ...
 3 ...
 4d ...

 NOT like:

 1 ...
 11 ...
 111a ...
 2a ...
 22 ...

 See what I mean? This is a common problem, I think, when you sort an
 character type field that contains numbers. The sort comes out all wrong.

 It would be great if I could get rid of the characters, then I could make
 the field a pure integer and the sort would work great, but that's not
 possible (or easily possible.)

 A pseudo-code solution would be SELECT * FROM table ORDER BY
 INT(char-field), but unfortunately even MySql doesn't have such an INT()
 cast funtion.

 I'm asking this perl group, because I suspect that my only solution is to
 sort the result set in perl. Am I right about this???

 Thanks.

 -- John



 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 **
 This message contains information that is confidential
 and proprietary to FedEx Freight or its affiliates.
 It is intended only for the recipient named and for
 the express purpose(s) described therein.
 Any other use is prohibited.
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: file upload to MySql

2002-09-21 Thread John Almberg

You can do the upload with a form. Read any HTML reference and check out the
input type=file tag. The web server will store the uploaded file as a
temporary file. Your form handler will have to store it someplace permanent.
This is pretty simple using the CGI module. Check out the CGI module
documentation for complete details.

Once you've got the file on your machine, you can either save the whole file
in the database as a BLOB, though I've never done that. I just leave the
file in a directory and store the name of the file in the database. A lot
simpler, really, though you have to remember to delete the file when you
delete the record.

Hope this helps . . .

-- John

 -Original Message-
 From: Mariusz [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 20, 2002 8:35 PM
 To: perl
 Subject: file upload to MySql


 I need to upload a file to a database. Could someone tell me how
 to do it? I know how to insert values into a table and upload
 files to a directory but how to combine the two correctly so the
 file gets uploaded to my MySql DB and I don't get any errors. A
 part of a script that does that would be a great help...

 thank you,
 M



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Internationalization/Globalization

2002-09-17 Thread John Almberg

I'm looking to Internationalize/Globalize a web site . . . can anyone point
me to Perl-related resources on this topic? Lists? White Papers? Modules?
Web Sites?

I've got tons of general info on this topic . . . looking for Perl-specific
info.

Thanks in advance for any help . . .

-- John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How To Build A Perl Message Board From Scratch

2002-09-17 Thread John Almberg

Simple . . .

1. Get a CS degree at the technical university of your choice.
2. While you're there, do some web programming for fun and to put some of
the things you learn to practical use.
3. After graduation, get a job -- preferably in a UNIX/LINUX shop -- so you
can hone your practical skills and learn the tricks of the trade from your
more experienced colleagues. Do some more web programming ... just for fun.
4. Then, if NT is still around (it's a foregone conclusion that Unix will be
there, but NT, no), it should be a reasonably simple (if painful) exercise
to build your message board (from scratch) in perl, on NT 2010 (or whatever
the then-current version is.)

Where do I collect my $400?

-- John

 -Original Message-
 From: Baruti Kamau [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 17, 2002 3:27 PM
 To: [EMAIL PROTECTED]
 Subject: How To Build A Perl Message Board From Scratch


 We are offering $400 in cash and 10,000 shares of restricted
 stock to the first programmer who can teach us how to build a
 simple perl based message board from scratch.  Participants are
 expected to respond to questions on our forum Message Board
 Scripts.  The perl code should be able to work perfectly within
 the Windows NT environment.  Also we have a preference for UBB
 style message boards.

 As a novice programmers we feel this is the best way for our team
 and others to learn perl, while building interest in CombatZone101.com.

 There is no need to contact us directly.  All correspondence will
 take place at our web site CombatZone101.com via instant
 messaging and message board posts.  Registration is free just
 provide a user name and email address.  Don't forget to check
 your email for your password.

 Click on
 http://www.combatzone101.com/cgi-bin/webapp/index.cgi?action=forum
 board=boardscripts

 Sincerely,
 [EMAIL PROTECTED]

 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Finding modules . . .

2002-08-15 Thread John Almberg

Luckily this is a beginning perl list, because I'm sure this is a real
beginners question . . .

I believe I have the Mail::Mailer module installed on my system because when
I run 'perldoc Mail::Mailer' I get the documentation. However, when I try to
'use' the module, I get the following error message:

[Thu Aug 15 12:08:27 2002] Mailer.pm: Can't locate Mail/Mailer.pm in @INC
(@INC contains: /usr/lib/perl5/i686-linux/5.00401 /usr/lib/perl5
/usr/lib/perl5/site_perl/i686-linux /usr/lib/perl5/site_perl .) at
support.cgi line 6. BEGIN failed--compilation aborted at support.cgi line 6.

I know how to change the @INC search path, but I'll be darned if I can find
the path to the Mailer module. I've tried using find as follows:

find `perl -e 'print @INC'` -name '*.pm' -print |grep 'Mailer'

but believe this is just looking in the same @INC path, so no surprise that
it can't find it, either. Any other ideas???

Thanks!

-- John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Finding modules . . .

2002-08-15 Thread John Almberg

Thanks, that worked. The path is:

/usr/lib/perl5.6/site-perl/5.6.1/Mail/Mailer.pm

Now here's the funny part . . .

running 'perl5 test.cgi' works, but running 'perl test.cgi' yields the
error. I'm guessing that these two different versions of perl search
different @INC paths and Mailer.PM isn't on the 'perl' include path.

The problem is, the web server seems to use the earlier version (5.004_01)
of perl to interpret CGI scripts. Any way to coax Apache into using perl5 to
interpret MY CGI scripts? (I'm on a shared server and don't have root
permission.)

-- John
  -Original Message-
  From: John Pitchko [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, August 15, 2002 3:48 PM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: Finding modules . . .


  Try find / -name Mailer.pm

  It should tell you where it is.




RE: Finding modules . . .

2002-08-15 Thread John Almberg

# Any way to coax Apache into using perl5 to interpret my CGI scripts?

Duh! Talk about beginner questions. I figured this one out on my own. All
works fine, now! Thanks for all the quick and valuable feedback.

-- John

# -Original Message-
# From: John Almberg [mailto:[EMAIL PROTECTED]]
# Sent: Thursday, August 15, 2002 4:02 PM
# To: [EMAIL PROTECTED]
# Subject: RE: Finding modules . . .
#
#
# Thanks, that worked. The path is:
#
# /usr/lib/perl5.6/site-perl/5.6.1/Mail/Mailer.pm
#
# Now here's the funny part . . .
#
# running 'perl5 test.cgi' works, but running 'perl test.cgi' yields the
# error. I'm guessing that these two different versions of perl search
# different @INC paths and Mailer.PM isn't on the 'perl' include path.
#
# The problem is, the web server seems to use the earlier version (5.004_01)
# of perl to interpret CGI scripts. Any way to coax Apache into
# using perl5 to
# interpret MY CGI scripts? (I'm on a shared server and don't have root
# permission.)
#
# -- John
#   -Original Message-
#   From: John Pitchko [mailto:[EMAIL PROTECTED]]
#   Sent: Thursday, August 15, 2002 3:48 PM
#   To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
#   Subject: Re: Finding modules . . .
#
#
#   Try find / -name Mailer.pm
#
#   It should tell you where it is.
#
#


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Probably impossible

2002-07-08 Thread John Almberg


Why not use crontab to schedule the email?

-- John

# -Original Message-
# From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
# Sent: Monday, July 08, 2002 2:36 PM
# To: 'Yasen Petrov'; [EMAIL PROTECTED]
# Subject: RE: Probably impossible
# 
# 
# Okay... I looked a little more indepth.
# 
# It seems that you are trying to get a CGI script to send you an e-mail.
# Most webservers have a processor timeout set so that you won't 
# have runaway
# processes. Perhaps check the webserver's docs for more info on that.
# 
#  -Original Message-
#  From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
#  Sent: Monday, July 08, 2002 2:32 PM
#  To: Nikola Janceski; 'Yasen Petrov'; [EMAIL PROTECTED]
#  Subject: RE: Probably impossible
#  
#  
#  DOH! Didn't see the close before. what exactly happens again?
#  
#   -Original Message-
#   From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
#   Sent: Monday, July 08, 2002 2:29 PM
#   To: 'Yasen Petrov'; [EMAIL PROTECTED]
#   Subject: RE: Probably impossible
#   
#   
#   you never closed MAIL.
#   
#   close MAIL;
#   
#   
#-Original Message-
#From: Yasen Petrov [mailto:[EMAIL PROTECTED]]
#Sent: Monday, July 08, 2002 2:29 PM
#To: [EMAIL PROTECTED]
#Subject: Probably impossible
#
#
#Hi all,
#my problem is that I want to send an e-mail every day, but 
#when I try to
#iterate, the unix perl wants to see all the iterations and 
#then execute them
#at once, while this isn't the same on windows. This means I 
#can't send an
#e-mail every day this way below:
#
##!usr/bin/perl
#use warnings;
#use CGI::Carp qw(fatalsToBrowser);
#
#my $mailprogram = /usr/lib/sendmail;
#my $rec = '[EMAIL PROTECTED]';
#my $i = 0;
#
#
#while ($i  300)
#
# open (MAIL,|$mailprogram -t);
# print MAIL To: $rec\n;
# print MAIL From: Yasen_Petrov\n;
# print MAIL Subject: Ads\n;
# print MAIL Some text\n;
# sleep 60*60*24; # 24 hours
# close MAIL;
# $i++;
# print Content-type: text/html\n\n;
# print You have just send an e-mail to $rec\n;
#}
#
#If anyone can help, I'll be very grateful. Thanks.
#
#
#
#-- 
#To unsubscribe, e-mail: [EMAIL PROTECTED]
#For additional commands, e-mail: [EMAIL PROTECTED]
#
#   
#   --
#   --
#   
#   The views and opinions expressed in this email message are 
#   the sender's
#   own, and do not necessarily represent the views and 
#  opinions of Summit
#   Systems Inc.
#   
#   
#   -- 
#   To unsubscribe, e-mail: [EMAIL PROTECTED]
#   For additional commands, e-mail: [EMAIL PROTECTED]
#   
#  
#  --
#  --
#  
#  The views and opinions expressed in this email message are 
#  the sender's
#  own, and do not necessarily represent the views and opinions of Summit
#  Systems Inc.
#  
#  
#  -- 
#  To unsubscribe, e-mail: [EMAIL PROTECTED]
#  For additional commands, e-mail: [EMAIL PROTECTED]
#  
# 
# --
# --
# 
# The views and opinions expressed in this email message are the sender's
# own, and do not necessarily represent the views and opinions of Summit
# Systems Inc.
# 
# 
# -- 
# To unsubscribe, e-mail: [EMAIL PROTECTED]
# For additional commands, e-mail: [EMAIL PROTECTED]
# 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: real beginner's question

2002-07-07 Thread John Almberg

This does sound like an ideal job for Perl, but I think you need to give us
more info on what you want to do. For instance, translate all 'i's inside
the braces to 'x's, or substitute one sequence of characters for another. An
example or scenario would be helpful here.

-- John

# -Original Message-
# From: David Carpenter [mailto:[EMAIL PROTECTED]]
# Sent: Sunday, July 07, 2002 10:45 PM
# To: [EMAIL PROTECTED]
# Subject: real beginner's question
#
#
# This is a list for beginners, right?  So perhaps no one will be
# too annoyed
# if I ask what is probably a really stupid question . . .
#
# I have a text file with occasional strings enclosed in braces:
# kdkdkiwiwdkdkdk {iwidkwidkw} kdkdkdwiwiwkdkdk . . .
#
# I would like to use tr/// to modify the characters within the
# braces, while
# leaving the rest of the file unchanged.  Whlie I'm sure this is a staight
# forward procedure, I've tried a number of loops and can't get it to work.
# If anyone could point a beginner in the right direction, he'd
# appreciate it.
#
# Thanks in advance,
#
# David
#
#
#
# --
# To unsubscribe, e-mail: [EMAIL PROTECTED]
# For additional commands, e-mail: [EMAIL PROTECTED]
#


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Modules

2002-07-06 Thread John Almberg

Now that is a handy little script. Thanks!

I have a related question . . . where does @INC come from? I guess there is
a configuration file somewhere?

-- John

# -Original Message-
# From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
# zentara
# Sent: Saturday, July 06, 2002 12:10 PM
# To: [EMAIL PROTECTED]
# Subject: Re: Modules
#
#
# On Sat, 6 Jul 2002 00:17:04 -0400, [EMAIL PROTECTED] (John Almberg)
# wrote:
#
# What's an easy way to tell if a particular module is installed
# on my server?
# I'm sure I read this somewhere, but can't find it. Thanks!
#
# I'm guessing you mean remote server , and you want it via a
# browser.
#
# 
# #!/usr/bin/perl
#
# print Content-type: text/html\n\npre;
# for (@INC){
# opendir(LIB, $_) || die Can't open $_\n$!;
# my @modules = grep { /\.pm$|\.pl$/ } readdir(LIB);
# closedir LIB;
# print \n$_\n;
#  for (@modules)   {
#   print $_\n;
# }
# }
# #
#
#
#
#
#
# --
# To unsubscribe, e-mail: [EMAIL PROTECTED]
# For additional commands, e-mail: [EMAIL PROTECTED]
#


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Embperl

2002-07-06 Thread John Almberg

I think I'm going to have to give up on installing Embperl. Making no
progress at all. Can anyone recommend a *good* hosting service that includes
Embperl as part of their package. By good I mean fast downloads (all day)
and excellent customer service.

If so, please let me know off-list at [EMAIL PROTECTED]

Thanks,

-- John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Installing Embperl without root privilages

2002-07-05 Thread John Almberg

Has anyone tried to install Embperl without root privilages? I have used
embperl on other servers, but am now trying to install it on a shared
server. All I really need is embpexec.pl to work off-line.

Unfortunatly, when I try to run it, I get the following error message:

orange:~/src/Embperl-2.0b6$ embpexec.pl
Can't find loadable object for module Embperl in @INC (/home/kemptech/src
/home/kemptech/src/Embperl-2.0b6 /usr/lib/perl5/i686-linux/5.00401
/usr/lib/perl5 /usr/lib/perl5/site_perl/i686-linux /usr/lib/perl5/site_perl
..) at ./embpexec.pl line 23
BEGIN failed--compilation aborted at ./embpexec.pl line 23.


As you can see, I've set up my environment so @INC includes the path to the
install directory (/home/kemptech/src/Embperl-2.0b6). I can't figure out
what 'loadable object' it can't find.

Any ideas greatly appreciated.

-- John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Modules

2002-07-05 Thread John Almberg

What's an easy way to tell if a particular module is installed on my server?
I'm sure I read this somewhere, but can't find it. Thanks!

-- John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




FW: Modules

2002-07-05 Thread John Almberg

Excellent. Thanks. I've been trying to install Embperl all day 
and my brain was too worn out to figure this out. I'm suspecting 
that I don't have some crucial modules installed . . . had list 
of dependant modules, but no easy way to discover if they are 
there. Thanks again!

-- John

# # -Original Message-
# # From: Andy Lester [mailto:[EMAIL PROTECTED]]
# # Sent: Saturday, July 06, 2002 12:24 AM
# # To: John Almberg
# # Subject: Re: Modules
# # 
# # 
# #  What's an easy way to tell if a particular module is installed 
# # on my server?
# #  I'm sure I read this somewhere, but can't find it. Thanks!
# # 
# # Basically, try to use it:
# # 
# # #!/usr/bin/perl
# # 
# # use HTML::Lint;
# # 
# # print It must be there.\n;
# # 
# # The shorter, command-line way is:
# # 
# # perl -MHTML::Lint -e1
# # 
# # Finally, you can try running perldoc for it:
# # 
# # perldoc HTML::Lint
# # 
# # or get the filename for it
# # 
# # perldoc -l HTML::Lint
# # 
# # The problem with this is that your module might not have docs with it,
# # in which case perldoc will seem like the module's not there. :-(
# # 
# # xoxo,
# # Andy
# # 
# # -- 
# # 'Andy Lester[EMAIL PROTECTED]
# #  Programmer/author  petdance.com
# #  Daddy  parsley.org/quinn   Jk'=~/.+/s;print((split//,$)
# # [unpack'C*',n2]3%+\34.'%.'^%4+!o.'])
# # 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Exporting variables from a module

2002-07-03 Thread John Almberg

#  package Config;
#
# You might want another Name here - since there is a Config.pm
# already out there how about
#
#   package Almberg::WebConfig;

Duh! That was it. I should have realized I was conflicting with another
module when I read the error message.

Thanks loads. My head was getting sore!

-- John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]