Search Results

Search found 8942 results on 358 pages for 'print'.

Page 14/358 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Python print statement prints nothing with a carriage return

    - by Jonathan Sternberg
    I'm trying to write a simple tool that reads files from disc, does some image processing, and returns the result of the algorithm. Since the program can sometimes take awhile, I like to have a progress bar so I know where it is in the program. And since I don't like to clutter up my command line and I'm on a Unix platform, I wanted to use the '\r' character to print the progress bar on only one line. But when I have this code here, it prints nothing. # Files is a list with the filenames for i, f in enumerate(files): print '\r%d / %d' % (i, len(files)), # Code that takes a long time I have also tried: print '\r', i, '/', len(files), Now just to make sure this worked in python, I tried this: heartbeat = 1 while True: print '\rHello, world', heartbeat, heartbeat += 1 This code works perfectly. What's going on? My understanding of carriage returns on Linux was that it would just move the line feed character to the beginning and then I could overwrite old text that was written previously, as long as I don't print a newline anywhere. This doesn't seem to be happening though. Also, is there a better way to display a progress bar in a command line than what I'm current trying to do?

    Read the article

  • Having trouble with time.sleep

    - by Waterfox
    When I run, for example: print("[",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("=",end=" ") time.sleep(1) print("]",end=" ") Nothing happens for 10 seconds, then the whole [ = = = = = = = = = = ] appears. How can I prevent that so that it can act as a sort of progress bar?

    Read the article

  • Perl cron job stays running

    - by Dylan
    I'm currently using a cron job to have a Perl script that tells my Arduino to cycle my aquaponics system and all is well, except the Perl script doesn't die as intended. Here is my cron job: */15 * * * * /home/dburke/scripts/hal/bin/main.pl cycle And below is my Perl script: #!/usr/bin/perl -w # Sample Perl script to transmit number # to Arduino then listen for the Arduino # to echo it back use strict; use Device::SerialPort; use Switch; use Time::HiRes qw ( alarm ); $|++; # Set up the serial port # 19200, 81N on the USB ftdi driver my $device = '/dev/arduino0'; # Tomoc has to use a different tty for testing #$device = '/dev/ttyS0'; my $port = new Device::SerialPort ($device) or die('Unable to open connection to device');; $port->databits(8); $port->baudrate(19200); $port->parity("none"); $port->stopbits(1); my $lastChoice = ' '; my $pid = fork(); my $signalOut; my $args = shift(@ARGV); # Parent must wait for child to exit before exiting itself on CTRL+C $SIG{'INT'} = sub { waitpid($pid,0) if $pid != 0; exit(0); }; # What child process should do if($pid == 0) { # Poll to see if any data is coming in print "\nListening...\n\n"; while (1) { my $incmsg = $port->lookfor(9); # If we get data, then print it if ($incmsg) { print "\nFrom arduino: " . $incmsg . "\n\n"; } } } # What parent process should do else { if ($args eq "cycle") { my $stop = 0; sleep(1); $SIG{ALRM} = sub { print "Expecting plant bed to be full; please check.\n"; $signalOut = $port->write('2'); # Signal to set pin 3 low print "Sent cmd: 2\n"; $stop = 1; }; $signalOut = $port->write('1'); # Signal to arduino to set pin 3 High print "Sent cmd: 1\n"; print "Waiting for plant bed to fill...\n"; alarm (420); while ($stop == 0) { sleep(2); } die "Done."; } else { sleep(1); my $choice = ' '; print "Please pick an option you'd like to use:\n"; while(1) { print " [1] Cycle [2] Relay OFF [3] Relay ON [4] Config [$lastChoice]: "; chomp($choice = <STDIN>); switch ($choice) { case /1/ { $SIG{ALRM} = sub { print "Expecting plant bed to be full; please check.\n"; $signalOut = $port->write('2'); # Signal to set pin 3 low print "Sent cmd: 2\n"; }; $signalOut = $port->write('1'); # Signal to arduino to set pin 3 High print "Sent cmd: 1\n"; print "Waiting for plant bed to fill...\n"; alarm (420); $lastChoice = $choice; } case /2/ { $signalOut = $port->write('2'); # Signal to set pin 3 low print "Sent cmd: 2"; $lastChoice = $choice; } case /3/ { $signalOut = $port->write('1'); # Signal to arduino to set pin 3 High print "Sent cmd: 1"; $lastChoice = $choice; } case /4/ { print "There is no configuration available yet. Please stab the developer."; } else { print "Please select a valid option.\n\n"; } } } } } Why wouldn't it die from the statement die "Done.";? It runs fine from the command line and also interprets the 'cycle' argument fine. When it runs in cron it runs fine, however, the process never dies and while each process doesn't continue to cycle the system it does seem to be looping in some way due to the fact that it ups my system load very quickly. If you'd like more information, just ask. EDIT: I have changed to code to: #!/usr/bin/perl -w # Sample Perl script to transmit number # to Arduino then listen for the Arduino # to echo it back use strict; use Device::SerialPort; use Switch; use Time::HiRes qw ( alarm ); $|++; # Set up the serial port # 19200, 81N on the USB ftdi driver my $device = '/dev/arduino0'; # Tomoc has to use a different tty for testing #$device = '/dev/ttyS0'; my $port = new Device::SerialPort ($device) or die('Unable to open connection to device');; $port->databits(8); $port->baudrate(19200); $port->parity("none"); $port->stopbits(1); my $lastChoice = ' '; my $signalOut; my $args = shift(@ARGV); # Parent must wait for child to exit before exiting itself on CTRL+C if ($args eq "cycle") { open (LOG, '>>log.txt'); print LOG "Cycle started.\n"; my $stop = 0; sleep(2); $SIG{ALRM} = sub { print "Expecting plant bed to be full; please check.\n"; $signalOut = $port->write('2'); # Signal to set pin 3 low print "Sent cmd: 2\n"; $stop = 1; }; $signalOut = $port->write('1'); # Signal to arduino to set pin 3 High print "Sent cmd: 1\n"; print "Waiting for plant bed to fill...\n"; print LOG "Alarm is being set.\n"; alarm (420); print LOG "Alarm is set.\n"; while ($stop == 0) { print LOG "In while-sleep loop.\n"; sleep(2); } print LOG "The loop has been escaped.\n"; die "Done."; print LOG "No one should ever see this."; } else { my $pid = fork(); $SIG{'INT'} = sub { waitpid($pid,0) if $pid != 0; exit(0); }; # What child process should do if($pid == 0) { # Poll to see if any data is coming in print "\nListening...\n\n"; while (1) { my $incmsg = $port->lookfor(9); # If we get data, then print it if ($incmsg) { print "\nFrom arduino: " . $incmsg . "\n\n"; } } } # What parent process should do else { sleep(1); my $choice = ' '; print "Please pick an option you'd like to use:\n"; while(1) { print " [1] Cycle [2] Relay OFF [3] Relay ON [4] Config [$lastChoice]: "; chomp($choice = <STDIN>); switch ($choice) { case /1/ { $SIG{ALRM} = sub { print "Expecting plant bed to be full; please check.\n"; $signalOut = $port->write('2'); # Signal to set pin 3 low print "Sent cmd: 2\n"; }; $signalOut = $port->write('1'); # Signal to arduino to set pin 3 High print "Sent cmd: 1\n"; print "Waiting for plant bed to fill...\n"; alarm (420); $lastChoice = $choice; } case /2/ { $signalOut = $port->write('2'); # Signal to set pin 3 low print "Sent cmd: 2"; $lastChoice = $choice; } case /3/ { $signalOut = $port->write('1'); # Signal to arduino to set pin 3 High print "Sent cmd: 1"; $lastChoice = $choice; } case /4/ { print "There is no configuration available yet. Please stab the developer."; } else { print "Please select a valid option.\n\n"; } } } } }

    Read the article

  • Intermec PF8t printer - print output with wrong orientation

    - by Xience
    I am using an Intermec PF8t for label printing. My labels are the size of 40mm(width) and 20mm (height) and they are rendered in a crystal report from where I print them dynamically. The problem is that no matter what the page orientation I specify either in crystal report or in printer settings, the result is printed vertically(i.e. my output gets rotated by 90 degrees) whereas I want it to print horizontally (as in normal left to right printing) . Strangely, when I print the label at design time, everything prints as it should. One important thing to mention is that i print my label report programmatically using crystal reprot's PrintToPrinter() method. Any ideas... I have pretty much exhausted all the information available at intermec's portal but to no avail.

    Read the article

  • Print out PDF with javascript [closed]

    - by Daniel Abrahamsson
    I have a need to print out multiple PDFs with the help of javascript. Is this even possible without rendering each PDF in a separate window and calling window.print()? Basically, I would like to be able to do something like print('my_pdf_url'). Edit After some searching, I have come to the conclusion that there are no other methods than the one I've described above. It is a far from perfect solution, but it works in simple cases. Edit I ended up merging the PDFs to a monster PDF on the server side and then send this single PDF to the user, who can then choose to print it out.

    Read the article

  • print customized result in prolog

    - by Allan Jiang
    I am working on a simple prolog program. Here is my problem. Say I already have a fact fruit(apple). I want the program take a input like this ?- input([what,is,apple]). and output apple is a fruit and for input like ?-input([is,apple,a,fruit]) instead of default print true or false, I want the program print some better phrase like yes and no Can someone help me with this? My code part is below: input(Text) :- phrase(sentence(S), Text), perform(S). %... sentence(query(Q)) --> query(Q). query(Query) --> ['is', Thing, 'a', Category], { Query =.. [Category, Thing]}. % here it will print true/false, is there a way in prolog to have it print yes/no, %like in other language: if(q){write("yes")}else{write("no")} perform(query(Q)) :- Q.

    Read the article

  • Print Preview Blank IE8

    - by Ben
    On a Windows XP, in IE8 print preview always appears completely blank except for header information. I can open the generated temp file in firefox and print it from there. I have tried browsing without addons to no success. I have tried re-creating the "%TEMP%\low" folder as described on the web, e.g. here: http://answers.microsoft.com/en-us/ie/forum/ie8-windows_xp/ie8-printing-does-not-work-preview-empty/920588e5-ccc4-4e24-83d6-606d5e3b1c70 ... all with no success.

    Read the article

  • Print table with horizontal scroll

    - by Nicole
    Hi everyone! I have to print a table with horizontal scroll and I need to print everything. The thing is that when te code does "Window.Print()" it cuts my page and doesn't show all the info of the table. I really need your help!! I need to "cut" my table and put it below if it doesn't fit the page. Thanks!!!!

    Read the article

  • Grep all files in a directory and print matches with file name

    - by javanix
    I have a list of log files that I create as part of a video encoding script that I wrote. I would like to search all of them and print out certain statistics from the encode - how fast they were encoded, what settings were used, etc. I can search for the average framerate in one file via this 1 liner: cat ${filename} | grep average which outputs: work: average encoding speed for job is 23.211176 fps and search for the ratefactor: cat ${filename} | grep RF I would like to search all files in the directory and print off one, or prefereably both pieces of information along with the filename. Is there any way I can use find or grep to get this in a one-liner, or do I need to write a script? I would like output like this: /home/javanix/filename.log <RF line> <average line> I would like this to either work using FreeBSD 9 or Ubuntu 12.04.

    Read the article

  • Perl : localtime with print

    - by kiruthika
    Hi all, I have used the following statements to get the current time. print "$query executed successfully at ",localtime; print "$query executed successfully at ",(localtime); print "$query executed successfully at ".(localtime); Output executed successfully at 355516731103960 executed successfully at 355516731103960 executed successfully at Wed Apr 7 16:55:35 2010 The first two statements are not printing the current time in a date format. Third statement only giving the correct output in a date format. My understanding is the first one is returning a value in scalar context,so it is returning numbers. Then in the second print I used localtime in list context only,why it's also giving number output.

    Read the article

  • Fonts not found when print request comes from a child process of a Service

    - by beeglebug
    I have a strange issue on a Windows Server 2003 box which has been baffling me for days now. I have a service running on the machine which calls a specified exe every 60 seconds, the exe looks at a local database to see if it needs to print anything, and if so, it prints it to a network laser printer. The problem i'm having is that some fonts won't print out when the exe is called automatically by the service, but work fine if I double click the exe to run it. The font was installed by Administrator, but the service runs as NT Authority\System. I thought this might have something to do with it, but I tried running the service as Administrator, and that didn't solve it. Are there any issues with fonts and permissions that i'm not aware of that could be causing this behaviour?

    Read the article

  • how to provide print option to my form inC#.net

    - by karim
    in my project i have one registration form which is developed in C#.net.to this form at lost i have an print button on clicking this button i have to get print window which we usually see when we give print in our system .plz provide me this code and help me. thanks uu

    Read the article

  • Can't print graphic from Publisher to pre-printed document

    - by Michael Itzoe
    I have a client who was given a stack of 8.5x11 tri-fold (unfolded) brochures printed on standard printer paper that they need to add their bulk mail permit stamp to. They've created a Publisher document with the stamp. If they print the document to standard paper in the tray, it prints fine. When they load the brochures into the tray, the brochure feeds through the printer but the stamp doesn't print. The stamp document is also 8.5x11. The printer is a Canon MF4300-D44. I can remoted in, but obviously have no access to the hardware. Any ideas?

    Read the article

  • Internet printing : print to iOS gateway -> AirPrint / something -> Laser printers

    - by user75129
    I've done a bit of research on the Internet, and it looks like I'm on a dead end. My goal is to minimize cost, and be able to send and print documents AUTOMATICALLY (may be 10 or 20 pages per day) to a laser printer in a remote office. The preliminary method is to use: iOS 5.1.1 (JB'ed) with 3G connection, HP (or other brands) printer with AirPrint, iCloud's Documents and may be write some launchd scripts to monitor any new documents in iCloud. May be with other software. I am not sure yet. By using the cloud, I can upload new docs to the cloud anywhere in my city, and the iOS will be able to see them within a reasonable amount of time, then print it. But it seems this combo is not workable. Anyone got any advice on how to make this set up work, or propose other alternatives that requires NO PC or Mac? Currently I have a 3GS with 3G connectivity spare. Need to buy a new printer though.

    Read the article

  • How to obtain printed page count if no web-gui or driver-gui is available to show it

    - by Macgreggor at your service
    I am curious if windows print servers can keep a count of the printed pages sent to it? Can an individual PC (WinXP+)? Is there some secret command you can send it (with telnet, dos, etc)? I searched & couldn't find any questions similar to this here so lets keep this open-ended for future people who are curious. Is this more suited towards server fault? Maybe, but this is more about printers & local PC's have print servers now-a-days. Anyhow in my situation I have the following printers (yes old) I am curious on page-counts: HP Laserjet 1300 (using some kind of PC-card to LPT/Parallel adapter, then a network adapter on top of that [Netgear PS101 print server]) Canon Faxphone L80 Epson LX-300+

    Read the article

  • Python If Statement Defaults to an elif

    - by Brad Carvalho
    Not sure why my code is defaulting to this elif. But it's never getting to the else statement. Even going as far as throwing index out of bound errors in the last elif. Please disregard my non use of regex. It wasn't allowed for this homework assignment. The problem is the last elif before the else statement. Cheers, Brad if item == '': print ("%s\n" % item).rstrip('\n') elif item.startswith('MOVE') and not item.startswith('MOVEI'): print 'Found MOVE' elif item.startswith('MOVEI'): print 'Found MOVEI' elif item.startswith('BGT'): print 'Found BGT' elif item.startswith('ADD'): print 'Found ADD' elif item.startswith('INC'): print 'Found INC' elif item.startswith('SUB'): print 'Found SUB' elif item.startswith('DEC'): print 'Found DEC' elif item.startswith('MUL'): print 'Found MUL' elif item.startswith('DIV'): print 'Found DIV' elif item.startswith('BEQ'): print 'Found BEQ' elif item.startswith('BLT'): print 'Found BLT' elif item.startswith('BR'): print 'Found BR' elif item.startswith('END'): print 'Found END' elif item.find(':') and item[(item.find(':') -1)].isalpha(): print 'Mya have found a label' else: print 'Not sure what I found'

    Read the article

  • How to print through remote computer with TeamViewer

    - by senzacionale
    We are using TeamViewer and we would like to print at the remote computer. Is this possible? If yes, how? I've been reading the docs but I can't find a solution. Further Explanation: I am on my machine say machine 1. And, I am connected to Machine 2 on the internet somewhere through Teamviewer. I know that Machine 2 has printer attached to it and it is working well. What I want is to print a Word Document for example which is locally on Machine 1 to be printed on Machine 2's printer. Is this possible?

    Read the article

  • C++ print value of a pointer

    - by user69514
    I have an array of double pointers, but every time I try do print one of the values the address gets printed. How do I print the actual value? cout << arr[i] ? cout << &arr[i] ? they both print the address Does anyone know?

    Read the article

  • How to make a page print to printer just once

    - by menislici
    I have a basic html page generated through php and it prints to a printer after a link click using Ben Nadel's print plugin. However, I don't want the user to print the page again. I tried setting the 'print' link to a negative z-index using jquery after it's being clicked, but the user can refresh the page and reuse the link so it would print again. I also know that I can somehow disable the refresh feature, by modifying what F5 does, but that would't save the day since the user can refresh the page through the url bar, and I can't remove/hide, it as much as I know. It also runs on localhost so the user client and server are on the same side. Even the browser doesn't matter since I could use the one that fits this case.

    Read the article

  • Print an EObject ?

    - by tul
    I am writing some eclipse emf code and would like to print the content of an EObject (not store it to disk). Here is what I try: public static void print(EObject obj) { Resource eResource = obj.eResource(); try { eResource.save(System.out, null); } catch (IOException e) { e.printStackTrace(); } } but that gives a NullPointerException. I have tried this instead: public static void print(EObject obj) { ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap() .put("*", new XMIResourceFactoryImpl()); Resource resource = resourceSet.createResource(URI.createURI("dummyfile.xml")); resource.getContents().add(obj); try { resource.save(System.out, null); } catch (IOException ioe) { ioe.printStackTrace(); } } This works, but is it not possible to print to screen without specifying a dummy URI??

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >