filling a select box with a list of files


I'm looking for a perl script that can fill a "select" box (combo) from a file listing in a particular directory. Can someone direct me to a script that has already been written, or is this easy to do ...
Posted On: Monday 26th of November 2012 08:25:36 PM Total Views:  398
View Complete with Replies

RELATED TOPICS OF Perl PROGRAMMING LANGUAGE




select ethernet card for socket?

how can i select an specific ethernet card for a socket, when i have multiple ethernet-cards (lan, wireless) installed i have two cards, configured for two different subnets: wireless: 192.168.50.x lan: 2.1.1.x and want to open a socket and broadcast to 2.1.1.x but without touching the wireless-settings. currently, i do: ---------------------------------------------- my $sendsocket = new IO::Socket::INET( LocalHost => '2.1.1.1', LocalPort => '6454', PeerAddr => '2.255.255.255', PeerPort => '6454', Proto => 'udp', Broadcast => 1 ) || die "[ERROR CREATING SOCKET] $!\n"; $sendsocket->sockopt(SO_BROADCAST, 1); ---------------------------------------------- which causes the wireless-connection to collapse... i guess i can do something with 'bind' but can't figure out how to identify the correct card...
VIEWS ON THIS POST

88

Posted on:

Wednesday 7th November 2012
View Replies!

FAQ 5.38 How do I select a random line from a file?

This is an excerpt from the latest version perlfaq5.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 . -------------------------------------------------------------------- 5.38: How do I select a random line from a file Here's an algorithm from the Camel Book: srand; rand($.) < 1 && ($line = $_) while ; This has a significant advantage in space over reading the whole file in. You can find a proof of this method in *The Art of Computer Programming*, Volume 2, Section 3.4.2, by Donald E. Knuth. You can use the File::Random module which provides a function for that algorithm: use File::Random qw/random_line/; my $line = random_line($filename); Another way is to use the Tie::File module, which treats the entire file as an array. Simply access a random array element. -------------------------------------------------------------------- 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. If you'd like to help maintain the perlfaq, see the details in perlfaq.pod.
VIEWS ON THIS POST

78

Posted on:

Wednesday 7th November 2012
View Replies!

FAQ 5.38 How do I select a random line from a file?

This is an excerpt from the latest version perlfaq5.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 ...
VIEWS ON THIS POST

63

Posted on:

Saturday 10th November 2012
View Replies!

FAQ 4.50 How do I select a random element from an array?

This is an excerpt from the latest version perlfaq4.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 ...
VIEWS ON THIS POST

71

Posted on:

Saturday 10th November 2012
View Replies!

FAQ 4.34 How do I extract selected columns from a string?

This is an excerpt from the latest version perlfaq4.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 ...
VIEWS ON THIS POST

75

Posted on:

Saturday 10th November 2012
View Replies!

print a selection of a file

, I try to print (get) a specific text selection from a text file, but I don't know how to do it: What I try todo is to open a file search a string and print the follow lines from ...
VIEWS ON THIS POST

109

Posted on:

Saturday 10th November 2012
View Replies!

problem with tk and select quary when I convert program to .exe file

helloI writr this program to show answer of quary to the users and , thenusers can update information.when Run program with IDE ( for example\t: Komodo ), it workscorrectly .but when I convert program to .exe\twith cava packager ,its not working. ( select quary not working).when I change\tthe\t\t$dbh->fetchrow_array(); with WHILE loop :While(our @rec = $dbh->fetchrow_array()){\tour $name = $rec[1];\tour $adminname = $rec[2];\tour $myphone1 = $rec[3];\tour $myphone2 = $rec[4];\tour $myaddress = $rec[5];\tour $mypercent = $rec[6];}and convert program to .exe , WHILE LOOP convert to Infinite loops .-----------------------------------------------------------#!C:/strawberry/perl/bin/perl.exeuse Tk;use DBI;$mw = MainWindow->new(-background=>"gray");$mw->title("$header");$mw->maxsize(800,315);$mw->minsize(800,315);$cn = DBI->connect("DBI:mysql:telephontaxi","root","root",{mysql_enable_utf8 => 1});$dbh = $cn->prepare("select * from telephonetaxiinformation");$dbh->execute();our @rec = $dbh->fetchrow_array();\tour $name = $rec[1];\tour $adminname = $rec[2];\tour $myphone1 = $rec[3];\tour $myphone2 = $rec[4];\tour $myaddress = $rec[5];\tour $mypercent = $rec[6];$dbh->finish;$cn->disconnect;$mw->Label(-text=>"$header",-font => "Titr 23",-anchor=>'center',-width=>34,-background=>"gray")->place(-x => 0,-y=>0);$fram = $mw->Frame(-relief => 'groove',-borderwidth => 0,-width=>780,-height=>240)->place(-x => 10,-y=>64);$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief=>'groove',-textvariable => \$name)->place(-x =>410,-y=>15);$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief=>'groove',-textvariable => \$adminname)->place(-x =>410,-y=>55);$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief=>'groove',-width=>4,-textvariable => \$mypercent)->place(-x =>170,-y=>30);$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief=>'groove',-textvariable => \$myphone1)->place(-x =>410,-y=>95);$fram->Entry(-font => "Tahoma 13 normal",-justify =>'right',-relief=>'groove',-textvariable => \$myphone2)->place(-x =>50,-y=>95);$fram->Entry(-font => "Tahoma 13 normal",-width=>60,-justify=>'right',-relief =>'groove',-textvariable => \$myaddress)->place(-x=>50,-y=>145);$fram->Button(-text=>"Save",-font => "Tahoma 13 normal",-command =>[ \&saveinformation ])->place(-x =>370,-y=>190);$fram->Button(-text=>"Exit",-font => "Tahoma 13 normal",-command =>[$mw => 'destroy'])->place(-x =>320,-y=>190);MainLoop;sub saveinformation{\t$cn = DBI->connect("DBI:mysql:telephontaxi","root","root",{mysql_enable_utf8 => 1});\t$dbh = $cn->prepare("update telephonetaxiinformation setazansname='$name',azansadmin='$adminname',phone1='$myphone1',phone2='$myphone2',azansaddress='$myaddress',azanspercent='$mypercent'\t\t\t\t\t\t\t\t\twhere azansid='1'");\t$dbh->execute();\t$cn->disconnect;\t$dbh->finish;\t$cn1 = DBI->connect("DBI:mysql:telephontaxi","root","root",{mysql_enable_utf8 => 1});\t$dbh1 = $cn1->prepare("select azansid fromtelephonetaxiinformation where azansname='$name'");\t$dbh1->execute();\t\t\tmy @rec = $dbh1->fetchrow_array();\t\t\t\t\tprint $rec[0];\t\t\t\t\tif($rec[0] ne ""){\t\t\t\t\t$message = "save correctly...";\t\t\t\t\t$fram->Label(-text=>"$message",-font => "homa 15")->place(-x =>600,-y=>190);\t\t\t\t\t$mw->messageBox (\t\t\t\t\t\t\t-default => 'Ok',\t\t\t\t\t\t\t-title => "$message",\t\t\t\t\t\t\t-message => "$message",\t\t\t\t\t\t\t-type => 'Ok',\t\t\t\t\t);\t\t\t}\t$dbh1->finish;\t$cn1->disconnect;}
VIEWS ON THIS POST

72

Posted on:

Saturday 10th November 2012
View Replies!

The select() (IO::Select) function has a limit?

Hi list, i'm writing a daemon in perl for exchanging data from a big quantity of machines (over 100000) over the network and I use the select() function in order to select the correct file handler (to read or write). ...
VIEWS ON THIS POST

82

Posted on:

Sunday 11th November 2012
View Replies!

Text bind command not selecting text

I am putting together a small report editor and need some help with the following problem. I would like the user to type in some text and then later be able to select either all of it or a portion ...
VIEWS ON THIS POST

86

Posted on:

Thursday 15th November 2012
View Replies!

Populating an array from a mysql select

$select = $db->prepare( "SELECT username FROM users" ); $select->execute; my @userlist = $select->fetchrow_array; print start_form( action=>'/cgi-bin/index.pl' ); print h1( {class=>'lime'}, "\t\t\t \t \t\t\t \t \t \t\t\t\t\t => ", popup_menu( -name=>'select', -values=> \@userlist ), submit('\t\t\t\t')); print end_form; In the above code ...
VIEWS ON THIS POST

172

Posted on:

Thursday 15th November 2012
View Replies!

How to execute a SQL select???? (successfully that is!)

I have been following a "worked example" of how to retrieve a row from an SQL table in Perl and use a returned column from that row in my Perl script. Unfortunately, as soon as I get to the statement:- ...
VIEWS ON THIS POST

66

Posted on:

Thursday 15th November 2012
View Replies!

Problem selecting/tagging Unicode characters

I'm using a TextUndo widget to display/edit Korean text plus XML tags (all encoded in UTF-8) and since I've installed the latest ActiveState build (813), I get a similar problem to the one reported by Petr Pajas on 04-Jul. ...
VIEWS ON THIS POST

82

Posted on:

Thursday 15th November 2012
View Replies!

Re: selection dialog

--nextPart1690938.udWTXpWCLB Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Dne Tuesday 12 July 2005 21:04 jste napsal(a): > I need to make a dialog where it may contain 3+ values for the user to > choose from (1 choice) and then ...
VIEWS ON THIS POST

112

Posted on:

Thursday 15th November 2012
View Replies!

Another BrowseEntry question: selecting an entry

Suppose I have something like this: my $mw = tkinit; my @choices = qw(one two three); my $be = $mw->BrowseEntry( -label => 'Select', -state => 'readonly', -choices => \@choices )->pack(-side => 'top'); # I want to select one of the ...
VIEWS ON THIS POST

74

Posted on:

Monday 19th November 2012
View Replies!

Newbie question on widget selecting.

The purpose of this question is learning rather than trying to actually build real code. Up to now I have been making similar widgets with different variables, like $entrybox1, $entrybox2, etc. Works great because I know exactly which one I ...
VIEWS ON THIS POST

78

Posted on:

Sunday 25th November 2012
View Replies!

Perl DBI: Getting POST info into select query

I'm trying to use a simple form to select by which column I will display output from a MySQL database. I'd like to display based on ORDER BY and select Written, Average, etc. I know the data is getting ...
VIEWS ON THIS POST

63

Posted on:

Sunday 25th November 2012
View Replies!

dbi db2 select

Is there anyway to execute this select statement with dbi select 'grant select on ' concat substr(viewschema,1,7) concat '.' concat substr(viewname,1,18) concat ' to ' concat dbc_xid_user_id concat ';' from syscat.views, ls2user.vls_db_connection where viewschema = 'ls2user' and valid='Y' and seqno ...
VIEWS ON THIS POST

70

Posted on:

Monday 26th November 2012
View Replies!

FAQ 4.34 How do I extract selected columns from a string?

This is an excerpt from the latest version perlfaq4.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 ...
VIEWS ON THIS POST

61

Posted on:

Monday 26th November 2012
View Replies!

HList and selection

after creating a HList to build a multicolumn table, I want the focus and selection on the first row. If the path of first row is 1000 I write: $table_hlb->focus; $table_hlb->selectionSet(1000); First question: the focus is actually on first ...
VIEWS ON THIS POST

102

Posted on:

Monday 26th November 2012
View Replies!

selection dialog

I need to make a dialog where it may contain 3+ values for the user to choose from (1 choice) and then they can either click Ok or Cancel. I suppose this could be done either by radiobutton or highlighting. ...
VIEWS ON THIS POST

120

Posted on:

Monday 26th November 2012
View Replies!