Jump to content

cuboidgraphix

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cuboidgraphix's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, Perl is new to me and I'm trying to get my script right. For starters.. below is the text file content that I want to parse: open cper Done. SP****** ** CPER100 NOV11 14:03:00 2100 INFO CDMA Performance Snapshot BSC: 0 Projected CSS ENGCAP: 56000 CAU : 36:5 59:5 ------------------------------------- Origination Attempts: 1538 Origination Successes: 1318 %Success: 85% ------------------------------------- Page Responses: 560 Termination Successes: 546 %Success: 97% ------------------------------------- Hard Handoff Attempts: 10 Hard Handoff Successes: 10 %Success: 100% ------------------------------------- Estimated CCR (wrt CSS ENGCAP): 88% Sometimes the text file is captured with the line "open cper " and sometimes it is not. What I need to do is to have my perl script find the word "Done." and start counting lines from there. Below is my code so far. #!/usr/bin/perl use Mysql; open (MYFILE, $ARGV[0]) or die "oops: $!"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); $DATE=sprintf("%4d-%02d-%02d\n",$year+1900,$mon+1,$mday); chop($DATE); print "DATE:", $DATE, "\n"; ############## ## Get Data ## ############## while(my $line = <MYFILE>){ if($line =~ m/^Done./){ $count++; } if($count == 1){ $TIME = substr $line, 27, 8; print "TIME:", $TIME; } elsif($count == 4){ $ORIGATT = substr $line, 41, 5; print "ORIGATT:", $ORIGATT; } elsif($count == 5){ $ORIGSUCC = substr $line, 41, 5; print "ORIGSUCC:", $ORIGSUCC; } elsif($count == { $PAGERESP = substr $line, 41, 5; print "PAGERESP:", $PAGERESP; } elsif($count == 9){ $TERMSUCC = substr $line, 41, 5; print "TERMSUCC:", $TERMSUCC; } elsif($count == 12){ $HHOFFATT = substr $line, 41, 5; print "HHOFFATT:", $HHOFFATT; } elsif($count == 13){ $HHOFFSUCC = substr $line, 41, 5; print "HHOFFSUCC:", $HHOFFSUCC; } elsif($count == 16){ $ESTIMCCR = substr $line, 41, 3; print "ESTIMCCR:", $ESTIMCCR, "\n"; $count++; } else{ } } close(MYFILE);
  2. I think you might need to rename your file 'document #2.doc' to 'document_#2.doc' and <a href> it to.. <a href="#" onClick="javascript:window.open('/documents/documnet_#2.doc', '2', 'height=600, width=850,menubar=1,scrollbars=1,resizable=1');">
  3. Anyone? I've seen it done, but I can't remember if it's javascript or AJAX.
  4. Slight modification to my script above.. I had forgotten you wanted to run scripts per number.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form name="form" method="POST" action="<?=$PHP_SELF?>"> <select name="number" onchange="this.form.submit();" method="post"> <option value="">Select Number</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> </form> <?PHP $num = $_POST['number']; $number = trim($num); if(!isset($num)){ print "Please select from the menu"; } elseif($number == 1){ // Right here you will write your script 1. print "Script 1 will run here."; } elseif($number == 2){ // Right here you will write your script 2. print "Script 2 will run here."; } elseif($number == 3){ // Right here you will write your script 3. print "Script 3 will run here."; } elseif($number == 4){ // Right here you will write your script 4. print "Script 4 will run here."; } elseif($number == 5){ // Right here you will write your script 5. print "Script 5 will run here."; } elseif($number == 6){ // Right here you will write your script 6. print "Script 6 will run here."; } else{ print "Error!!!"; } ?> </body> </html> OK that's the entire code... I hope I've helped you.
  5. I've troubleshot your script and found the error. You need to make two modifications.. 1. Your onchange="f(sel)" choice menu should be this.. <select name="nationality" id="nationality" class="generalblue" onchange="f(this)" > <option value="" selected>-- Please Select --</option> <option value="american">American</option> <option value="british">British</option> </select> 2. You need to include the other two option <div>(s). So insert this above the <div id="british" style="display:none"></div> <div id="" style="display:none"></div> <div id="american" style="display:none"></div> This should solve your problem. Let me know if it works out for you.
  6. Well ... in my script only the ... 'Please choose an option' text will show under the drop down menu. All other div(s) are hidden. it's when you do an onchange that the div is replaced to the other div(s). example.. when you choose option 3 ... only the information in div id='f3' will show. But my script could easily hide all of them.. just change the first div to style="display:none" ... and none of the div(s) will show on page load. It's until you make a selection that the selected div will appear.
  7. How about trying this... <FORM> <INPUT type="button" value="New Window!" onClick="window.open('http://www.google.com','mywindow','width=600,height=400,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes')"> </FORM> So you could edit the elements in the pop up window.
  8. I think I know what you're trying to do.. It would be easier if you use <div> This is one of my scripts.. maybe it's what you're looking for. This is the javascript ... goes right before/above the </head> <!-- OnChange Script --> <script type="text/javascript"> function f(sel){ var d=document, dv; if(d.getElementById){ for(var ii=0; ii<sel.options.length; ii++){ dv=d.getElementById(sel.options[ii].value); if(dv) dv.style.display=sel.options[ii].selected?"block":"none"; } } } </script> This is my form and <div> (s). <!-- Choices --> <select onchange="f(this)"> <option name="choice" value="f1">Choices</option> <option name="choice" value="f2">BTS</option> <option name="choice" value="f3">Sector</option> <option name="choice" value="f4">Date</option> </select> <div id="f1" style="display:block"> Please choose an option. </div> <div id="f2" style="display:none"> F2 text goes in here. </div> <div id="f3" style="display:none"> F3 text goes in here. </div> <div id="f4" style="display:none"> F4 text goes in here. </div>
  9. I'm not sure what you mean. But if you want the easiest way to get a pop up ... it's by simply putting a target in the link. eg: <a href="www.google.com" target="_blank">Click here for google</a>
  10. I don't know if this is what you want, but I tried writing it for you. Try this.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form name="form" method="POST" action="<?=$PHP_SELF?>"> <select name="number" onchange="this.form.submit();" method="post"> <option value="">Select Number</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> </form> <?PHP $num = $_POST['number']; $number = trim($num); if(!isset($num)){ print "Please select from the menu"; } else{ print $number; } ?> </body> </html>
  11. Hi fj1200, I think i understand what you're asking. I had a similar problem trying to pass variables from one page to the next. Well there are two ways to do this. either pass them in a using a form with hidden elements or pass them through a $_session ... but that would require you to have a session in your page. I tried doing it via javascript but it's too complicated for me. What I did was simply create a session.. and through the same session I passed any variable I wanted from one page to the next. I hope I have helped in some way.
  12. Hi there, I'm not sure if this can be done with javascript or some other lang., but is there a script that can be used whereby when a string of text is selected or highlighted, it is then automatically pasted into an input or text field in a form? I appreciate any help you may offer. Thanks.
  13. Sorry.. My question was commented in the script... But basically I want the php script that will generate the link coming from the output in the column. (BTS No.)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.