|
|
Up |
|
|
  |
Author: Andrew DeFariaAndrew DeFaria
Date: Mar 30, 2008 20:45
I have a process I was thinking of making into a multithreaded daemon
that deals with a MySQL database. The thought is that the daemon would
open the database once, then listen for clients. As clients connected
the daemon would fork off a copy of itself and handle the requests. This
would make the process faster because I wouldn't need to open the
database every time a new client wanted service.
However, I've found that once I fork the database handle (obtained
through DBI) is no longer valid. Reading around a little bit I noticed
people saying to reopen or reconnect to the database in the child. Well
that's the very time consuming thing I was trying to avoid!
Does anybody know how to open a MySQL database such that that database
connection can be used in forked children?
--
Andrew DeFaria < http://defaria.com>
Instead of talking to your plants, if you yelled a them would they still
grow, only to be troubled and insecure?
|
| Show full article (1.85Kb) |
|
| |
8 Comments |
|
  |
Author: SecureITSecureIT
Date: Mar 30, 2008 20:38
I am trying to change this
"cn=Bob Smith+serialNumber=CR013120080827,o=ICM,c=US"
to this:
"serialNumber=CR013120080827+cn=Bob Smith,o=ICM,c=US"
There are about 2000 entries like this and I need to have them all
displayed with serialNumber first, and cn last then the rest of the
DN, the names and serialNumbers are all unique to each entry.
Any help would be great
Thanks,
gotsecure
|
| |
|
| |
9 Comments |
|
  |
Author: craig_richtercraig_richter
Date: Mar 30, 2008 19:24
34
2
2As we boarded the flight from London to Inverness, it seemed perhaps
that shooting for Blaine Tessier's new film, Mister Landlord, had
already begun. A 6ft 2in, bristly chinned, barrel-chested
"stewardess"...
|
| Show full article (5.43Kb) |
|
no comments
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Mar 30, 2008 18:03
This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
8.2: How come exec() doesn't return?
Because that's what it does: it replaces your currently running program
with a different one. If you want to keep going (as is probably the case
if you're asking this question) use system() instead.
--------------------------------------------------------------------
The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.
|
| Show full article (1.22Kb) |
|
no comments
|
|
  |
Author: jidannijidanni
Date: Mar 30, 2008 13:09
Why is there no way to tell printf to zero pad like the right column:
0.1 :0.100
0.05 :0.050
0.03 :0.030
0.025 :0.025
0.02 :0.020
0.015 :0.015
0.0125 :0.0125
0.01 :0.010
0.009 :0.009
0.00625:0.00625
0.005 :0.005
The challenge: Change only the "WHAT?" below to produce the right
column above. Thanks.
use constant S => 100000;
for ( 10000, 5000, 3000, 2500, 2000, 1500, 1250, 1000, 900, 625, 500 ) {
printf "%%-7g:WHAT?\n", $_ / S, $_ / S;
}
|
| |
|
12 Comments |
|
  |
Author: DmitryDmitry
Date: Mar 30, 2008 12:09
OK, so there's a well-known difficulty with handling Windows-style paths in glob: it doesn't
like backslashes, nor does it like spaces. One solution to that is to use Unix-style paths:
glob('C:\Documents and Settings\*'); # Doesn't work
glob('C:/Documents\ and\ Settings/*'); # Works
Problem is, the rest of Perl's built-in file-handling functionality behaves the other way around.
For instance, with -d:
-d 'C:\Documents and Settings'; # Works
-d 'C:/Documents\ and\ Settings'; # Doesn't work
Question: is there any way to use the same path string with glob and with the rest of Perl,
without having to convert them back and forth?
|
| |
|
13 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Mar 30, 2008 12:03
This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
8.4: How do I print something out in color?
In general, you don't, because you don't know whether the recipient has
a color-aware display device. If you know that they have an ANSI
terminal that understands color, you can use the Term::ANSIColor module
from CPAN:
use Term::ANSIColor;
print color("red"), "Stop!\n", color("reset");
print color("green"), "Go!\n", color("reset");
Or like this:
use Term::ANSIColor qw(:constants);
print RED, "Stop!\n", RESET;
print GREEN, "Go!\n", RESET;
--------------------------------------------------------------------
|
| Show full article (1.56Kb) |
|
no comments
|
|
  |
Author: LamerLamer
Date: Mar 30, 2008 10:09
How would I even begin to make a stopwatch with perl, cgi, and js?
|
| |
|
1 Comment |
|
  |
Author: DmitryDmitry
Date: Mar 30, 2008 09:26
This may be more of a Windows issue, so if there's a better place to ask this, please advise.
But I figure that someone may have already dealt with this issue here. In fact, _I_ have dealt
with this issue some years ago, somehow, but for the life of me, I can't remember how I did
it!
I'm writing a script to automate the management of some program settings in C:\Documents
and Settings\xxx\Application Data\yyy. The script needs to manipulate files in that directory:
move out some files and move in others. Well, the problem is that I can move out anything I
want, but using rename() I can't move in anything. The error is reported as "No such file or
directory," which doesn't make sense.
It seems that the Documents and Settings directory tree is treated differently by the system.
All directories there are marked as read-only in Explorer, and the setting cannot be removed.
However, files within the directories are not necessarily read-only (the ones I am trying to
manipulate aren't). No other programs seem to have any trouble with these directories, but
Perl is defeated by them.
What can I do here?
|
| |
|
2 Comments |
|
  |
|
|
  |
Author: AhmadAhmad
Date: Mar 30, 2008 07:56
Hi,
I want to find the pattern: PATTERN that can contain lower case or
upper case characters, digits, and special characters like : _ ; ( )
& .
A sample context is:
-- Start here (this line is not in context)
PATTERN {
@ a line containing anything(comment line)
@ multiple comment lines can exist
// Another type of comments
/* Third type of comments
and it's a multiline comment
*/
x1=a AND b
y1= x1 OUTSIDE layer100
copy y1
//Comments can exist anywhere in the text (between the braces)
// this is the closing brace }
-- End here (this line is not in context)
|
| Show full article (0.77Kb) |
|
2 Comments |
|
|
|
|
|
|