Search Results

Search found 19539 results on 782 pages for 'pretty print'.

Page 37/782 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • Selective emboldeing of text in a webpage

    - by Eknath Iyer
    while printing out utf-8 characters onto a webpage, if encapsulate them with they get emboldened, but anything else, the page turns blank. Why? def main(): print "Content-type: text/html\r\n\r\n"; print '<html>' print '<head>' print '<style type="text/css">' print '.highlight { background-color: yellow }' print '.color1 { color: green; }' print '.color2 { color: blue; }' print '.color3 { color: purple; }' print '.color4 { color: red; }' print '.color5 { color: teal; }' print '.color6 { color: yellow; }' print '.color7 { color: orange; }' print '.color8 { color: violet; }' print '</style></head>' print '<body>' form = cgi.FieldStorage() ch = form.getvalue('choice') if ch == 'English': in_sent = form.getvalue('f1') in_sent = in_sent.lower() cho=0 elif ch == 'Hindi': in_sent = trans_he(form.getvalue('transl1').decode("utf-8")).strip() cho=1 #cho = 0 for english #cho = 1 for hindi adict=[] print '<center><u> User Input Sentence ==> <b>', in_sent,'</b></u></center><br>' in_sent=in_sent.strip().split(' ') colordict={} counter=1 for word in in_sent: colordict[word]=counter counter = counter + 1 f = open('bidirectional.alignment.txt','rb').read() records=f.strip().split('\n\n\n') for record in records: el=[] el2 = [] #basic file processing is done here. record = record.strip().split('\n') source = record[cho] target = record[(cho+1)%2] source_sent = source.split(' # ')[1] target_sent = target.split(' # ')[1] source_words = source_sent.strip().split(' ') target_words = target_sent.strip().split(' ') trans_index = source.split(' # ')[2].strip().split(' ') for word in in_sent: if word in source_words: if int(trans_index[source_words.index(word)]) > 0: tword=target_words[(int(trans_index[source_words.index(word)])-1)] target_sent = target_sent.replace(tword+' ','<b>'+tword+' </b>') # When the <b> tag is used here(for the 'target_sent = ...' statement). it is fine. But when <b> is replaced by something like in the next line or even <i> or <u>, it doesn't show an output at all source_sent = source_sent.replace(word+' ','<span class="color1">'+word+' </span>') el2.append(source_sent) el2.append(target_sent) el.append(target_sent.count('<b>')) el.append(el2) if target_sent.count('<b>') > 0: adict.append(el) print '<table><tr><td><center><h1>SOURCE LANGUAGE</h1></center></td><td><center> <h1>TARGET LANGUAGE</h1></center></td></tr>' for entry in adict: print '<tr><td>',entry[1][0],'</td><td>',trans_eh(entry[1][1]).encode("utf-8"),'</td> </tr>' print '</table></body>' print '</html>' main()

    Read the article

  • How to print a html-table with a lot of columns.

    - by bruno
    Hello all, I'm trying to print a table with a lot of columns, so that the width of the table doesn't fit a single page. I'm using jqprint to print that table. But it prints only the left part of the table, and the right part it won't print. Is there a way to print the table on multiple pages? Kind regards, Bruno

    Read the article

  • How can you print a string using raw_unicode_escape encoding in python 3?

    - by Sorin Sbarnea
    The following code with fail in Python 3.x with TypeError: must be str, not bytes because now encode() returns bytes and print() expects only str. #!/usr/bin/python from __future__ import print_function str2 = "some unicode text" print(str2.encode('raw_unicode_escape')) How can you print a Unicode string escaped representation using print()? I'm looking for a solution that will work with Python 2.6 or newer, including 3.x

    Read the article

  • I'm making a simulated tv

    - by Jam
    I need to make a tv that shows the user the channel and the volume, and shows whether or not the television is on. I have the majority of the code made, but for some reason the channels won't switch. I'm fairly unfamiliar with how properties work, and I think that's what my problem here is. Help please. class Television(object): def __init__(self, __channel=1, volume=1, is_on=0): self.__channel=__channel self.volume=volume self.is_on=is_on def __str__(self): if self.is_on==1: print "The tv is on" print self.__channel print self.volume else: print "The television is off." def toggle_power(self): if self.is_on==1: self.is_on=0 return self.is_on if self.is_on==0: self.is_on=1 return self.is_on def get_channel(self): return channel def set_channel(self, choice): if self.is_on==1: if choice>=0 and choice<=499: channel=self.__channel else: print "Invalid channel!" else: print "The television isn't on!" channel=property(get_channel, set_channel) def raise_volume(self, up=1): if self.is_on==1: self.volume+=up if self.volume>=10: self.volume=10 print "Max volume!" else: print "The television isn't on!" def lower_volume(self, down=1): if self.is_on==1: self.volume-=down if self.volume<=0: self.volume=0 print "Muted!" else: print "The television isn't on!" def main(): tv=Television() choice=None while choice!="0": print \ """ Television 0 - Exit 1 - Toggle Power 2 - Change Channel 3 - Raise Volume 4 - Lower Volume """ choice=raw_input("Choice: ") print if choice=="0": print "Good-bye." elif choice=="1": tv.toggle_power() tv.__str__() elif choice=="2": change=raw_input("What would you like to change the channel to?") tv.set_channel(change) tv.__str__() elif choice=="3": tv.raise_volume() tv.__str__() elif choice=="4": tv.lower_volume() tv.__str__() else: print "\nSorry, but", choice, "isn't a valid choice." main() raw_input("Press enter to exit.")

    Read the article

  • Testing variable types in Python

    - by Jasper
    Hello, I'm creating an initialising function for the class 'Room', and found that the program wouldn't accept the tests I was doing on the input variables. Why is this? def __init__(self, code, name, type, size, description, objects, exits): self.code = code self.name = name self.type = type self.size = size self.description = description self.objects = objects self.exits = exits #Check for input errors: if type(self.code) != type(str()): print 'Error found in module rooms.py!' print 'Error number: 110' elif type(self.name) != type(str()): print 'Error found in module rooms.py!' print 'Error number: 111' elif type(self.type) != type(str()): print 'Error found in module rooms.py!' print 'Error number: 112' elif type(self.size) != type(int()): print 'Error found in module rooms.py!' print 'Error number: 113' elif type(self.description) != type(str()): print 'Error found in module rooms.py!' print 'Error number: 114' elif type(self.objects) != type(list()): print 'Error found in module rooms.py!' print 'Error number: 115' elif type(self.exits) != type(tuple()): print 'Error found in module rooms.py!' print 'Error number: 116' When I run this I get this error: Traceback (most recent call last): File "/Users/Jasper/Development/Programming/MyProjects/Game Making Challenge/Europa I/rooms.py", line 148, in <module> myRoom = Room(101, 'myRoom', 'Basic Room', 5, '<insert description>', myObjects, myExits) File "/Users/Jasper/Development/Programming/MyProjects/Game Making Challenge/Europa I/rooms.py", line 29, in __init__ if type(self.code) != type(str()): TypeError: 'str' object is not callable

    Read the article

  • XMLReader mysteriously fails when parsing document

    - by Valrus
    I have a php script that takes in some XML data and parses it, displaying various bits of information I pull out of it. This has been working fine for over 6 months, until recently it now fails mysteriously on a certain tag. The XML is generated from an outside source(a conferencing bridge), so I have no control over how it is built. I have put the xml through an online validator and it returned no errors. The code also works fine when I connect to another conferencing bridge and get the same output. I have been using XMLReader class so far and tried switching to SmipleXML, but it fails when I create the SimpleXML object using the data. Here is the snippet of where it fails while parsing: <CDR_SUMMARY> <FILE_VERSION>1001</FILE_VERSION> <NAME>Conference Title Hidden</NAME> <ID>10227</ID> <STATUS_STR>Auto_termination,_everybody_quit</STATUS_STR> <STATUS>4</STATUS> <GMT_OFFSET>-4</GMT_OFFSET> <START_TIME>2010-04-14T15:00:33</START_TIME> <DURATION> <HOUR>0</HOUR> <MINUTE>39</MINUTE> <SECOND>37</SECOND> </DURATION> <RESERVE_START_TIME>2010-04-14T15:00:33</RESERVE_START_TIME> <RESERVE_DURATION> <HOUR>12</HOUR> <MINUTE>0</MINUTE> <SECOND>0</SECOND> </RESERVE_DURATION> <MCU_FILE_NAME>c11</MCU_FILE_NAME> <FILE_SAVED>0</FILE_SAVED> <GMT_OFFSET_MINUTE>0</GMT_OFFSET_MINUTE> </CDR_SUMMARY> The <SOUND> opening tag is the last one read before failing. And this is my code: `public function processResponse($xml) { print "Processing List..."; $reader = new XMLReader($xml); try { $reader->setSchema("./schemas/response_trans_cdr_list.xsd"); } catch(Exception $e) { print "Exception:".$e->getMessage(); } //verify xml if($reader->xml($xml)) { while($reader->read()) { //$currentstring = $reader->readstring(); if($reader->name === "ACTION") { //into meat of resposnse while($reader->read()) { //print "Looping..."; //$currentstring = $reader->readInnerXML(); //print $currentstring; if($reader->nodeType == XMLReader::ELEMENT) { if($reader->name === "ID") { $this->conferenceIDs[$this->counter] = $reader->readString(); print "<BR>Conf ID found: ".$this->counter." ID: ".$this->conferenceIDs[$this->counter]; $this->counter += 1; } else if($reader->name === "START_TIME") { //conference start time. print "<BR>Start Time Found! "; $this->conferenceStarts[$this->counter-1] = $reader->readString(); } else if($reader->name === "NAME") { print "<BR> Name Found!"; $this->conferenceNames[$this->counter] = $reader->readString(); } else if($reader->name === "MCU_FILE_NAME") { print "<BR> MCU_FILE_NAME Found!"; //print $this->counter." File Name: ".$reader->readstring()."<BR>"; } else if($reader->name === "RESERVE_START_TIME") { print "<BR> RESERVE_START_TIME Found!"; } else if($reader->name === "FILE_VERSION") { print "<BR> FILE_VERSION Found!"; } else if($reader->name === "STATUS_STR") { print "<BR> STATUS_STR Found!"; } else if($reader->name === "STATUS") { print "<BR> STATUS Found!"; } else if($reader->name === "GMT_OFFSET") { print "<BR> GMT_OFFSET Found!"; } else if($reader->name === "DURATION") { print "<BR> DURATION Found!"; } else if($reader->name === "RESERVE_START_TIME") { print "<BR> RESERVE_START_TIME Found!"; } else if($reader->name === "RESERVE_DURATION") { print "<BR> RESERVE_DURATION Found!"; } else if($reader->name === "FILE_SAVED") { print "<BR> FILE_SAVED Found!"; } else if($reader->name === "GMT_OFFSET_MINUTE") { print "<BR> GMT_OFFSET_MINUTE Found!"; } else if($reader->name === "HOUR") { print "<BR> HOUR Found!"; } else if($reader->name === "MINUTE") { print "<BR> MINUTE Found!"; } else if($reader->name === "SECOND") { print "<BR> SECOND Found!"; } }else if($reader->nodeType == XMLReader::END_ELEMENT) { print "Close Element".$reader->name; } } print "End Action Loop"; } } } else { print "Error reading response: Bad XML returned"; } }` Anyone have any ideas what could be causing this failure? the code exits gracefully and I see the "End Action Loop" message in my output. It's like it just spontaneously exits the loop.

    Read the article

  • interactive login on cgi script

    - by raindrop18
    I am new for perl-cgi script. and my objective is to create user/pass interactive script to log and get information from multiple device at once. instead of add the user/pass credential on the script itself. since i am new if some one show me how to write the interactive part of the script. thanks much!!! here is the current code usr/local/bin/perl -wl use CGI ':standard'; use Net::Telnet::Cisco; ### set the error fields to nulls $selerror = ""; ### Input from the screen - make sure data was input if (param() and param('Switches') ne "" and (param('Mac') ne "" or param('Interface Description') ne "" or param('VLAN') ne "" )) { ### Put the input devices into an array. @devices = param('Switches'); ### format the header data print header(); print start_html(-title=>"ShowSwitches",-BGCOLOR=>'aqua'); print "\n",h1("<CENTER>Show Switches</CENTER>"); print "\n",hr(),"\n"; ### Go thru the device array. foreach(@devices) { $error_msg = ""; $TAC_login_error = ""; $open_error = ""; $retry_open_error = ""; $prompt_error = ""; $password_error = ""; ### Take input host and use to send to Telnet $host = $_; $session = Net::Telnet::Cisco->new(Errmode => 'return', Timeout => 30); ### Connect to the host $session->open(Host =>"$host", Timeout => 15); $open_error = $session->errmsg; ### Login with TACACS if host can be connected to if ($open_error eq "") { $session->login('USER', 'PASS'); $TAC_login_error = $session->errmsg; ### Login with TACACS failed - try standard login if ($TAC_login_error ne "") { ### Connect to host $session->open(Host =>"$host", Timeout => 15); $retry_open_error = $session->errmsg; ### Wait for password prompt - multiple matches - devices may have different device prompts. if ($retry_open_error eq "") { $session->waitfor(Match => '/Password:.*$/', Match => '/Enter password:.*$/', Timeout => 20); $prompt_error = $session->errmsg; if ($prompt_error eq "") { ### Input password $session->print('getmeout'); $password_error = $session->errmsg; $session->waitfor('/.*>$/'); $password_error = $session->errmsg; } } } } ### No errors, then issue "show commands". if ($open_error eq "" and ($TAC_login_error eq "" or $retry_open_error eq "") and $prompt_error eq "" and $password_error eq "") { ### Show Mac if (param('Mac')) { $cmd = 'sh mac'; @output = $session->cmd("$cmd"); $show_error = ""; $show_error = $session->errmsg; print "\n",h2($host . ' - ' . $cmd); if ($show_error ne "") { $error_msg = 'Error for show mac - ' . $show_error; print b($error_msg),(br); print hr(),"\n"; $error_msg = ''; } else { print pre(@output); print hr(),"\n"; } } ### Show Interface Description if (param('Interface Description')) { $cmd = 'sh interface description'; @output = $session->cmd("$cmd"); $show_error = ""; $show_error = $session->errmsg; print "\n",h2($host . ' - ' . $cmd); if ($show_error ne "") { $error_msg = 'Error for show mac - ' . $show_error; print b($error_msg),(br); print hr(),"\n"; $error_msg = ''; } else { print pre(@output); print hr(),"\n"; } } ### Show VLAN if (param('VLAN')) { $cmd = 'sh vlan'; @output = $session->cmd("$cmd"); $show_error = ""; $show_error = $session->errmsg; print "\n",h2($host . ' - ' . $cmd); if ($show_error ne "") { $error_msg = 'Error for show vlan - ' . $show_error; print b($error_msg),(br); print hr(),"\n"; $error_msg = ''; } else { print pre(@output); print hr(),"\n"; } } } elsif ($TAC_login_error ne "" and $password_error ne "") { $error_msg = "Error - $host " . $TAC_login_error . ' - possible incorrect TACACS or standard password parameters on device.'; } elsif ($open_error ne "") { $error_msg = "Error - $host " . $open_error . ' - cannot connect to host - is it down??'; } elsif ($prompt_error ne "") { $error_msg = "Error - $host " . $prompt_error . ' - password prompt not recognized - invalid TACACS (or user) password.'; } elsif ($password_error ne "") { $error_msg = "Error - $host " . $password_error . ' - possible incorrect user/password parameters on device.'; } if ($error_msg ne "" ) { print b($error_msg),(br); print hr(),"\n"; } print hr(),"\n"; print end_html(),"\n"; } } else { ### No Show command was selected. if (param('Submit') and param('Mac') eq "" and param('Interface Description') eq "" and param('VLAN') eq "" ) { $selerror = 'No Show Displays were selected. Try again please!!'; } elsif ### No switch was selected. (param('Submit') and param('Switches') eq "") { $selerror = 'No devices were selected. Try again please!!'; } ### This formats the initial Show Web page. print header(-Pragma='no-cache'), start_html(-title=>"Show Displays",-BGCOLOR=>'aqua'), h1("<CENTER>Show Switches</CENTER>"),hr(), start_form(), b("Select Show Commands:"), br(), br(), checkbox(-name=>'Mac'), checkbox(-name=>'Interface Description'), checkbox(-name=>'VLAN'), br(),br(),hr(),br(), b("Select One or More Devices:"), br(), br(), scrolling_list (-name => 'Switches', -default=> "NONE", -values => ['cs6a', 'cs7a', 'cs7b', 'cs8b', 'cs9a', 'c9b', 'csa' ], -multiple => 'true', -size => 7, ), p(submit('Submit'),reset('Reset')), b($selerror), end_form(),hr(), end_html(); } #

    Read the article

  • interactive login on perl cgi script- updated question [closed]

    - by raindrop18
    I am new for perl-cgi script. and my objective is to create user/pass interactive script to log and get information from multiple device at once. instead of add the user/pass credential on the script itself. since i am new if some one show me how to write the interactive part of the script. thanks much!!! here is the current code usr/local/bin/perl -wl use CGI ':standard'; use Net::Telnet::Cisco; # ### set the error fields to nulls $selerror = ""; # ### Input from the screen - make sure data was input if (param() and param('Switches') ne "" and (param('Mac') ne "" or param('Interface Description') ne "" or param('VLAN') ne "" )) { # ### Put the input devices into an array. @devices = param('Switches'); # ### format the header data print header(); print start_html(-title=>"ShowSwitches",-BGCOLOR=>'aqua'); print "\n",h1("<CENTER>Show Switches</CENTER>"); print "\n",hr(),"\n"; # ### Go thru the device array. foreach(@devices) { $error_msg = ""; $TAC_login_error = ""; $open_error = ""; $retry_open_error = ""; $prompt_error = ""; $password_error = ""; # ### Take input host and use to send to Telnet $host = $_; $session = Net::Telnet::Cisco->new(Errmode => 'return', Timeout => 30); # ### Connect to the host $session->open(Host =>"$host", Timeout => 15); $open_error = $session->errmsg; # ### Login with TACACS if host can be connected to if ($open_error eq "") { $session->login('USER', 'PASS'); $TAC_login_error = $session->errmsg; # ### Login with TACACS failed - try standard login if ($TAC_login_error ne "") { # ### Connect to host $session->open(Host =>"$host", Timeout => 15); $retry_open_error = $session->errmsg; # ### Wait for password prompt - multiple matches - devices may have different device prompts. if ($retry_open_error eq "") { $session->waitfor(Match => '/Password:.*$/', Match => '/Enter password:.*$/', Timeout => 20); $prompt_error = $session->errmsg; if ($prompt_error eq "") { # ### Input password $session->print('getmeout'); $password_error = $session->errmsg; $session->waitfor('/.*>$/'); $password_error = $session->errmsg; } } } } # ### No errors, then issue "show commands". if ($open_error eq "" and ($TAC_login_error eq "" or $retry_open_error eq "") and $prompt_error eq "" and $password_error eq "") { # ### Show Mac if (param('Mac')) { $cmd = 'sh mac'; @output = $session->cmd("$cmd"); $show_error = ""; $show_error = $session->errmsg; print "\n",h2($host . ' - ' . $cmd); if ($show_error ne "") { $error_msg = 'Error for show mac - ' . $show_error; print b($error_msg),(br); print hr(),"\n"; $error_msg = ''; } else { print pre(@output); print hr(),"\n"; } } # ### Show Interface Description if (param('Interface Description')) { $cmd = 'sh interface description'; @output = $session->cmd("$cmd"); $show_error = ""; $show_error = $session->errmsg; print "\n",h2($host . ' - ' . $cmd); if ($show_error ne "") { $error_msg = 'Error for show mac - ' . $show_error; print b($error_msg),(br); print hr(),"\n"; $error_msg = ''; } else { print pre(@output); print hr(),"\n"; } } # ### Show VLAN if (param('VLAN')) { $cmd = 'sh vlan'; @output = $session->cmd("$cmd"); $show_error = ""; $show_error = $session->errmsg; print "\n",h2($host . ' - ' . $cmd); if ($show_error ne "") { $error_msg = 'Error for show vlan - ' . $show_error; print b($error_msg),(br); print hr(),"\n"; $error_msg = ''; } else { print pre(@output); print hr(),"\n"; } } } elsif ($TAC_login_error ne "" and $password_error ne "") { $error_msg = "Error - $host " . $TAC_login_error . ' - possible incorrect TACACS or standard password parameters on device.'; } elsif ($open_error ne "") { $error_msg = "Error - $host " . $open_error . ' - cannot connect to host - is it down??'; } elsif ($prompt_error ne "") { $error_msg = "Error - $host " . $prompt_error . ' - password prompt not recognized - invalid TACACS (or user) password.'; } elsif ($password_error ne "") { $error_msg = "Error - $host " . $password_error . ' - possible incorrect user/password parameters on device.'; } if ($error_msg ne "" ) { print b($error_msg),(br); print hr(),"\n"; } print hr(),"\n"; print end_html(),"\n"; } } else { # ### No Show command was selected. if (param('Submit') and param('Mac') eq "" and param('Interface Description') eq "" and param('VLAN') eq "" ) { $selerror = 'No Show Displays were selected. Try again please!!'; } elsif # ### No switch was selected. (param('Submit') and param('Switches') eq "") { $selerror = 'No devices were selected. Try again please!!'; } # ### This formats the initial Show Web page. print header(-Pragma=>'no-cache'), start_html(-title=>"Show Displays",-BGCOLOR=>'aqua'), h1("<CENTER>Show Switches</CENTER>"),hr(), start_form(), b("Select Show Commands:"), br(), br(), checkbox(-name=>'Mac'), checkbox(-name=>'Interface Description'), checkbox(-name=>'VLAN'), br(),br(),hr(),br(), b("Select One or More Devices:"), br(), br(), scrolling_list (-name => 'Switches', -default=> "NONE", -values => ['cs6a', 'cs7a', 'cs7b', 'cs8b', 'cs9a', 'c9b', 'csa' ], -multiple => 'true', -size => 7, ), p(submit('Submit'),reset('Reset')), b($selerror), end_form(),hr(), end_html(); } #

    Read the article

  • PROBLEM WITH FPDF

    - by user297801
    Hello i'm trying to create a report using FPDF from a website using php, see i need to put a signature line at the en of the report, but I don't know how, can you help me??

    Read the article

  • printing to Postscript from vim

    - by Milan Leszkow
    Hi, I have problem with printing to postscript from Vim. I'm, using utf-8 encoding with czech characters like 'šcrž' but in the output I get upside question mark instead of the correct characters. vim --version VIM - Vi IMproved 7.2 +iconv +multi_byte +postscript printer settings: set printoptions=paper:A4,duplex:off,collate:n,syntax:n printer font: courier

    Read the article

  • Printing double variable contents

    - by Adil
    I tried following code snippet and output is surprising me: #include <stdio.h> #include <math.h> int main() { double num; unsigned char ch; ch = 19; num = 1.0E+20 ; num += ch * 1.0E+18; printf("E18 = %lf \n",num); printf("E18 = %e \n",num); num = 11.0E+21 ; num += ch * 1.0E+19; printf("E19 = %lf <------\n",num); printf("E19 = %e <------\n",num); num = 11.0E+22 ; num += ch * 1.0E+20; printf("E20 = %lf\n",num); printf("E20 = %e\n",num); num = 11.0E+23 ; num += ch * 1.0E+21; printf("E21 = %lf\n",num); printf("E21 = %e\n",num); num = 11.0E+24 ; num += ch * 1.0E+22; printf("E22 = %lf <------\n",num); printf("E22 = %e <------\n",num); return 0; } The output of the program: E18 = 119000000000000000000.000000 E18 = 1.190000e+20 E19 = 11190000000000000524288.000000 <------ E19 = 1.119000e+22 <------ E20 = 111900000000000001048576.000000 E20 = 1.119000e+23 E21 = 1119000000000000044040192.000000 E21 = 1.119000e+24 E22 = 11189999999999999366660096.000000 <------ E22 = 1.119000e+25 <------ Why the data corrupted when printed while in exponent form its OK

    Read the article

  • Create a string with the result of an expression and the expression that originated the value. Is it

    - by Oscar Reyes
    Like String r = SomeThing.toExecString("new Object().toString()"); And when executed the value of r would be: "new Object().toString() = java.lang.Object@c5e3974" Is this even possible at all? Would it need a bunch of reflection? A built in compiler maybe? AFAIK, this is not possible with regular Java. The closest thing I could get is IDE support like in IDEA with the "macro" soutv+tab that prints: Hit taband type the expression The IDE types the rest for you. But that's quite another completely thing.

    Read the article

  • JQuery printfunction: no content, no view

    - by Joris
    I got a JQuery printfunction: function doPrintPage() { myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=800,height=600'); myWindow.document.open(); myWindow.document.write(document.getElementById("studentnummer").value); myWindow.document.write(document.getElementById("Voornaam").value + " " + document.getElementById("Tussenvoegsel").value + " " + document.getElementById("Achternaam").value); myWindow.document.write("</br>"); myWindow.document.write("Result"); myWindow.document.write(document.getElementById('tab1').innerHTML); myWindow.document.write("</br>"); myWindow.document.write("Tree"); myWindow.document.write(document.getElementById('tab2').innerHTML); myWindow.document.write("</br>"); myWindow.document.write("Open"); myWindow.document.write(document.getElementById('tab3').innerHTML); myWindow.document.write("</br>"); myWindow.document.write("Free"); myWindow.document.write(document.getElementById('tab4').innerHTML); myWindow.document.close(); myWindow.focus(); } There are 3 gridviews (elements in "tab#"), and on the page that is generated by this script, eacht gridview gets a header (Results, Tree, Open, Free). It is possible that there is no gridview for "Tree". It would be nice if the "tree" header wouldn't be shown either. EDIT: I tried this: if ($('tab4')[0]) {myWindow.document.write("Free"); myWindow.document.write(document.getElementById('tab4').innerHTML); but it seems not to work either... Anyone knows the solution?

    Read the article

  • How do you save rows to an array and print out in PHP using ODBC?

    - by johnny
    I have the following: while($myRow = odbc_fetch_array( $result )){ <--lots of rows $thisResult['name'] = $myRow["name"] ; $thisResult['race'] = $myRow["race"] ; $thisResult['sex'] = $myRow["sex"]; $thisResult['dob'] = $myRow["dob"]; } I can't figure out how to print this back out. I want to get each row and iterate through each row in the array like a datareader. I'm not sure what to do. I do not want to do the echo in the while. I need to be able to print it out elsewhere. But I don't think I've done it right here to be able to print it later. I also tried, this, however: while($myRow = odbc_fetch_array( $result )){ <--lots of rows print($thisResult[$myRow["name"]] = $myRow); } I then tried: while($myRow = odbc_fetch_array( $result )){ <--lots of rows print (odbc_result($myRow,"name")); } but got an error. Thank you for any help.

    Read the article

  • PHP equivalent to Perl format function

    - by Dustin Hansen
    Is there an equivalent to Perl's format function in PHP? I have a client that has an old-ass okidata dotmatrix printer, and need a good way to format receipts and bills with this arcane beast. I remember easily doing this in perl with something like: format BILLFORMAT = Name: @>>>>>>>>>>>>>>>>>>>>>> Age: @### $name, $age . write; Any ideas would be much appreciated, banging my head on the wall with this one. O.o

    Read the article

  • Best practise question

    - by sid_com
    Hello! With version would you prefer? #!/usr/bin/env perl use warnings; use strict; use 5.010; my $p = 7; # 33 my $prompt = ' : '; my $key = 'very important text'; my $value = 'Hello, World!'; my $length = length $key . $prompt; $p -= $length; Option 1: $key = $key . ' ' x $p . $prompt; Option 2: if ( $p > 0 ) { $key = $key . ' ' x $p . $prompt; } else { $key = $key . $prompt; } say "$key$value"

    Read the article

  • Customising the .NET PrintPreviewDialog?

    - by Gary Willoughby
    Currently i'm using the PrintPreviewDialog to open a window to preview the printed pages before they are sent to a printer. The problem is though that it first appears very small, at the top left of the screen and the buttons are too small. Is there anyway i can set a starting size for this dialog or start position or even make the little buttons a little bigger? Or do i need to implement my own?

    Read the article

  • threading.Event wait function not signaled when subclassing Process class

    - by user1313404
    For following code never gets past the wait function in run. I'm certain I'm doing something ridiculously stupid, but since I'm not smart enough to figure out what, I'm asking. Any help is appreciated. Here is the code: import threading import multiprocessing from multiprocessing import Process class SomeClass(Process): def __init__(self): Process.__init__(self) self.event = threading.Event() self.event.clear() def continueExec(self): print multiprocessing.current_process().name print self print "Set:" + str(self.event.is_set()) self.event.set() print "Set:" + str(self.event.is_set()) def run(self): print "I'm running with it" print multiprocessing.current_process().name self.event.wait() print "I'm further than I was" print multiprocessing.current_process().name self.event.clear() def main(): s_list = [] for t in range(3): s = SomeClass() print "s:" + str(s) s_list.append(s) s.start() raw_input("Press enter to send signal") for t in range(3): print "s_list["+str(t)+"]:" + str(s_list[t]) s_list[t].continueExec() raw_input("Press enter to send signal") for t in range(3): s_list[t].join() print "All Done" if __name__ == "__main__": main()

    Read the article

  • How can I wait for the image to load in my new window before printing via child.print()?

    - by libertas
    $("#print").on('click', function () { var child = window.open("image.jpg", "_blank", "location=0,toolbar=0,scrollbars=1,fullscreen=1,menubar=0"); //any way to know/wait for image to load? child.print(); }); Any way for my parent window to know that the child window has completed loading the image prior to calling .print()? If they were trigger happy they would end up printing a blank page. I've tried both: child.attachEvent("onload", function () { child.print(); }); and child.attachEvent("DOMContentLoaded", function () { child.print(); }); //(found this online, apparently it's Firefox only, still didn't work)

    Read the article

  • Best practice question

    - by sid_com
    Hello! Which version would you prefer? #!/usr/bin/env perl use warnings; use strict; use 5.010; my $p = 7; # 33 my $prompt = ' : '; my $key = 'very important text'; my $value = 'Hello, World!'; my $length = length $key . $prompt; $p -= $length; Option 1: $key = $key . ' ' x $p . $prompt; Option 2: if ( $p > 0 ) { $key = $key . ' ' x $p . $prompt; } else { $key = $key . $prompt; } say "$key$value"

    Read the article

  • Does PrinterSettings.GetHdevmode() have a bug?

    - by Brandi
    I would like to be able to change the printer properties without bringing up the printer properties window... Using the DocumentProperties (imported from winspool.drv) function has so far failed, because while it is easy to suppress the dialog from showing up, it seems that the value returned by PrinterSettings.GetHdevmode() is not reflecting the PrinterSettings that is calling it, but instead the value from the previous printer properties returning OK. For example, this gives me the previous (wrong) values from the last call to the properties, instead of the values it should have from the PrinterSettings object: IntPtr hdevmode = PrinterSettings.GetHdevmode(PrinterSettings.DefaultPageSettings); PrinterSettings.SetHdevmode(hdevmode); PrinterSettings.DefaultPageSettings.SetHdevmode(hdevmode); So does GetHdevmode have a bug or is this what its supposed to do? Is there a C# work around for this or does anyone even have any information about it? I have been hard pressed even to find info on the topic. Thanks in advance for any insight.

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >