- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Self taught and learning more every day. I started with Perl working for an ISP called Internet Direct, Inc in 1995. I've recently (sept 10 2010) started learning C#It reminds me a lot of LSL with the IntelliSense functions, makes it easy to pick up…
- Interests
- Perl C# PostgreSQL
- PC Specs
- Wow need to update more often:AMD Athlon(tm) II X2 235e Processor 2.70 Ghz6gb Ram, 750gb HD, Nvidia…
16 Posted Topics
Re: Try this snippet: [code] private void Form1_MouseDown(object sender, MouseEventArgs e) { label1.Text = "Local position is " + e.X + ", " + e.Y + "."; label2.Text = "Global position is " + Cursor.Position.X + ", " + Cursor.Position.Y + "."; } [/code] | |
Re: Since I just answered another question similar to this, I'd suggest using fork() depending on if it works on your OS or not (works fine on Linux/Unix and for me just now on Win7) Change: if ($time_difference > 180) { system("perl create_cache.pl"); } to: if ($time_difference > 180) { my … | |
Re: If you've named your table phonelist and your columns name and number, insert this at line 23: my $sth = $dbh->prepare("SELECT name,number from phonelist where name=?"); $sth->execute($name); my @row; At line 33, insert this: while (@row = $sth->fetchrow_array) {print "Found: Name=$row[0] Phone Number=$row[1]<br>\n"; | |
Re: The child process gets a pid of 0, the parent process gets a new pid that is not equal to zero. You'll probably only want to run the exec once, in either the child process from fork, or in the parent. All the code after fork() runs in each process, … | |
Re: I like this bit from the Time::HiRes manpage [CODE] # Arm an interval timer to go off first at 10 seconds and # after that every 2.5 seconds, in process virtual time use Time::HiRes qw ( setitimer ITIMER_VIRTUAL time ); $SIG{VTALRM} = sub { print time, "\n" }; setitimer(ITIMER_VIRTUAL, 10, … | |
Re: Attach your checkbox's CheckChanged event to the method below. [CODE] private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (checkBox1.Checked) { this.Text = string.Empty; this.ControlBox = false; } else { this.Text = "Title On"; this.ControlBox = true; } } [/CODE] Kordaff | |
Re: You can try this bit of code to get the output and errors into a scrollable Tk::Text window: [CODE] #!d:\perl\bin\perl.exe -w use strict; use Tk; use IPC::Open3; my $filename="perl myfile.pl"; # change me for a different file my $mw=Tk::MainWindow->new(); # makes a new Tk window my $button=$mw->Button(-text => "Run $filename", … | |
Re: Net::Ping defaults to a tcp connection to the echo port (7 according to my /etc/services file). Use this (from the Net::Ping man page) example to do a regular ICMP ping like the command line: [CODE] use Net::Ping; my $p = Net::Ping->new('icmp'); print "$host is "; print "NOT " unless $p->ping($host, … | |
Re: I've put screenshots showing how i run a script called getmap.pl on my win98 machine: [url]http://plh.org/getmap.jpg[/url] for start/run window [url]http://plh.org/msdos.jpg[/url] for msdos window I added the die here line to stop all the debugging info from scrolling the command line off the screen =) | |
Re: I see a couple problems with this script (besides it grabbing over 1025MB of memory when i ran it under linux, which it didn't do under windows) First, you should always use this line at the top of your perl program: [CODE]use strict;[/CODE] Fix all the warnings this will produce. … | |
Re: Myself, I'd use perltk. The Tk module comes with activestate's version, so portability to windows, if required, is less of an issue. The usenet group comp.lang.perl.tk is helpful. The O'Reilly book 'Mastering Perl/Tk' also has a great deal of helpful information. The man pages are what I usually refer to … | |
Re: In perl, this works for non-numeric scalar variables too: [CODE] #!/usr/bin/perl $a="abcd"; $b="yyyyyy"; $a ^= $b; $b ^= $a; $a ^= $b; print "$a $b\n"; [/CODE] To swap arrays, I cannot think of a way off hand without using a counter variable to iterate through the larger array... Kordaff | |
Re: I tried it on my win98 machine. The MSI version kept hanging at the making html step. Extracted the AS version to D:\ActivePerl-5.8.7-813-MSWin32-x86-148120\ActivePerl-5.8.7-813-MSWin32-x86-148120\ using winrar (like that better as it does rar, zip, tar, gz, etc) I would have been happy with D:\Perl but oh well lol. Cd'd into that … | |
Re: I believe the installer.bat file (a perl script) does a lot of file path renaming in various scripts in the perl installation. Using perl without running installer.bat is problematic. You also may need to specify the full path for myfile.pl unless it is in your current directory (while in a … | |
Re: Here's a bit of code that prints the multi-line error message from that log sample: [code] #!/usr/bin/perl -w use strict; my $log="log"; my $partial=""; my $state=1; if ( $ARGV[0] ) { $log=$ARGV[0] } open ( FILE,$log ) or die "Failed to open $log:$!\n"; while ( <FILE> ) { if ( … | |
Re: Not that it's necessary to change something that works (believing this may be a perl sin, so i'll say a perl prayer later...) but you can change those two lines into one and eliminate the extra variable: $FORM{'story'} =~ s/\n/<BR>/gi; Kordaff |
The End.