SEARCH YOUR SOLUTION HERE  

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:  358
View Complete with Replies




Related Messages:

select ethernet card for socket?   (77 Views)
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...
FAQ 5.38 How do I select a random line from a file?   (63 Views)
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.
FAQ 5.38 How do I select a random line from a file?   (52 Views)
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 ...
FAQ 4.50 How do I select a random element from an array?   (61 Views)
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 ...
FAQ 4.34 How do I extract selected columns from a string?   (65 Views)
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 ...
print a selection of a file   (98 Views)
, 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 ...
problem with tk and select quary when I convert program to .exe file   (61 Views)
helloI writr this program to show answer of quary to the users and , thenusers can update information.when Run program with IDE ( for example : Komodo ), it workscorrectly .but when I convert program to .exe with cava packager ,its not working. ( select quary not working).when I change the $dbh->fetchrow_array(); with WHILE loop :While(our @rec = $dbh->fetchrow_array()){ our $name = $rec[1]; our $adminname = $rec[2]; our $myphone1 = $rec[3]; our $myphone2 = $rec[4]; our $myaddress = $rec[5]; our $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(); our $name = $rec[1]; our $adminname = $rec[2]; our $myphone1 = $rec[3]; our $myphone2 = $rec[4]; our $myaddress = $rec[5]; our $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{ $cn = DBI->connect("DBI:mysql:telephontaxi","root","root",{mysql_enable_utf8 => 1}); $dbh = $cn->prepare("update telephonetaxiinformation setazansname='$name',azansadmin='$adminname',phone1='$myphone1',phone2='$myphone2',azansaddress='$myaddress',azanspercent='$mypercent' where azansid='1'"); $dbh->execute(); $cn->disconnect; $dbh->finish; $cn1 = DBI->connect("DBI:mysql:telephontaxi","root","root",{mysql_enable_utf8 => 1}); $dbh1 = $cn1->prepare("select azansid fromtelephonetaxiinformation where azansname='$name'"); $dbh1->execute(); my @rec = $dbh1->fetchrow_array(); print $rec[0]; if($rec[0] ne ""){ $message = "save correctly..."; $fram->Label(-text=>"$message",-font => "homa 15")->place(-x =>600,-y=>190); $mw->messageBox ( -default => 'Ok', -title => "$message", -message => "$message", -type => 'Ok', ); } $dbh1->finish; $cn1->disconnect;}
The select() (IO::Select) function has a limit?   (72 Views)
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). ...
Text bind command not selecting text   (74 Views)
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 ...
Populating an array from a mysql select   (122 Views)
$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'}, " => ", popup_menu( -name=>'select', -values=> \@userlist ), submit(' ')); print end_form; In the above code ...
How to execute a SQL select???? (successfully that is!)   (56 Views)
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:- ...
Problem selecting/tagging Unicode characters   (73 Views)
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. ...
Re: selection dialog   (100 Views)
--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 ...
Another BrowseEntry question: selecting an entry   (61 Views)
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 ...
Newbie question on widget selecting.   (68 Views)
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 ...
Perl DBI: Getting POST info into select query   (53 Views)
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 ...
dbi db2 select   (61 Views)
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 ...
FAQ 4.34 How do I extract selected columns from a string?   (52 Views)
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 ...
HList and selection   (92 Views)
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 ...
selection dialog   (107 Views)
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. ...