Search Results

Search found 2363 results on 95 pages for 'sleep'.

Page 25/95 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • WPF -- Event Threading, GUI updating question

    - by LSTayon
    I'm trying to send two events to the main window so that I can show some kind of animation that will let the user know that I'm updating the data. This is an ObservableCollection object so the OnPropertyChanged is immediately picked up by the bindings on the main window. The sleep is only in there so that the user can see the animation. However, the first OnPropetyChanged is never seen. I'm assuming this is because we're in a single thread here and the timer_Tick has to finish before the GUI updates. Any suggetions? In VB6 land we would use a DoEvents or a Form.Refresh. Thanks! private void timer_Tick(object sender, EventArgs e) { Loading = "Before: " + DateTime.Now.ToString(); OnPropertyChanged("Loading"); LoadData(); Thread.Sleep(1000); //Loading = Visibility.Hidden; Loading = "After: " + DateTime.Now.ToString(); OnPropertyChanged("Loading"); }

    Read the article

  • Python's subprocess.Popen object hangs gathering child output when child process does not exit

    - by Daniel Miles
    When a process exits abnormally or not at all, I still want to be able to gather what output it may have generated up until that point. The obvious solution to this example code is to kill the child process with an os.kill, but in my real code, the child is hung waiting for NFS and does not respond to a SIGKILL. #!/usr/bin/python import subprocess import os import time import signal import sys child_script = """ #!/bin/bash i=0 while [ 1 ]; do echo "output line $i" i=$(expr $i \+ 1) sleep 1 done """ childFile = open("/tmp/childProc.sh", 'w') childFile.write(child_script) childFile.close() cmd = ["bash", "/tmp/childProc.sh"] finish = time.time() + 3 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) while p.poll() is None: time.sleep(0.05) if finish < time.time(): print "timed out and killed child, collecting what output exists so far" out, err = p.communicate() print "got it" sys.exit(0) In this case, the print statement about timing out appears and the python script never exits or progresses. Does anybody know how I can do this differently and still get output from my child processe

    Read the article

  • Is there a way to make PHP progressively output as the script executes?

    - by Iain Fraser
    So I'm writing a disposable script for my own personal single use and I want to be able see how the process is going. Basically I'm processing a couple of thousand media releases and sending them to our new CMS. So I don't hammer the CMS, I'm making the script sleep for a couple of seconds after every 5 requests. I would like - as the script is executing - to be able to see my echos telling me the script is going to sleep or that the last transaction with the webservice was successful. Is this possible in PHP? Thanks for your help! Iain

    Read the article

  • Piping input to a Java app with Perl

    - by user319479
    I need to write a Perl script that pipes input into a Java program. This is related to this, but that didn't help me. My issue is that the Java app doesn't get the print statements until I close the handle. What I found online was that $| needs to be set to something greater than 0, in which case newline characters will flush the buffer. This still doesn't work. This is the script: #! /usr/bin/perl -w use strict; use File::Basename; $|=1; open(TP, "| java -jar test.jar") or die "fail"; sleep(2); print TP "this is test 1\n"; print TP "this is test 2\n"; print "tests printed, waiting 5s\n"; sleep(5); print "wait over. closing handle...\n"; close TP; print "closed.\n"; print "sleeping for 5s...\n"; sleep(5); print "script finished!\n"; exit And here is a sample Java app: import java.util.Scanner; public class test{ public static void main( String[] args ){ Scanner sc = new Scanner( System.in ); int crashcount = 0; while( true ){ try{ String input = sc.nextLine(); System.out.println( ":: INPUT: " + input ); if( "bananas".equals(input) ){ break; } } catch( Exception e ){ System.out.println( ":: EXCEPTION: " + e.toString() ); crashcount++; if( crashcount == 5 ){ System.out.println( ":: Looks like stdin is broke" ); break; } } } System.out.println( ":: IT'S OVER!" ); return; } } The Java app should respond to receiving the test prints immediately, but it doesn't until the close statement in the Perl script. What am I doing wrong? Note: the fix can only be in the Perl script. The Java app can't be changed. Also, File::Basename is there because I'm using it in the real script.

    Read the article

  • How does the timeout work in Restlet's client class?

    - by Greg Noe
    Here's some code: Client client = new Client(Protocol.HTTP); client.setConnectTimeout(1); //milliseconds Response response = client.post(url, paramRepresentation); System.out.println("timed out"); What I would expect to happen is that it prints "timed out" before the resource has time to process. Instead, nothing happens with the timeout and it doesn't print "timed out" until after the resource returns. Even if I put a Thread.sleep(5000) at the resource that's handling the request, the entire sleep is performed, like the timeout did nothing. Anyone have experience with this? I'm using Restlet 1.1.1. Thanks.

    Read the article

  • problem with two .NET threads and hardware access

    - by mack369
    I'm creating an application which communicates with the device via FT2232H USB/RS232 converter. For communication I'm using FTD2XX_NET.dll library from FTDI website. I'm using two threads: first thread continuously reads data from the device the second thread is the main thread of the Windows Form Application I've got a problem when I'm trying to write any data to the device while the receiver's thread is running. The main thread simply hangs up on ftdiDevice.Write function. I tried to synchronize both threads so that only one thread can use Read/Write function at the same time, but it didn't help. Below code responsible for the communication. Note that following functions are methods of FtdiPort class. Receiver's thread private void receiverLoop() { if (this.DataReceivedHandler == null) { throw new BackendException("dataReceived delegate is not set"); } FTDI.FT_STATUS ftStatus = FTDI.FT_STATUS.FT_OK; byte[] readBytes = new byte[this.ReadBufferSize]; while (true) { lock (FtdiPort.threadLocker) { UInt32 numBytesRead = 0; ftStatus = ftdiDevice.Read(readBytes, this.ReadBufferSize, ref numBytesRead); if (ftStatus == FTDI.FT_STATUS.FT_OK) { this.DataReceivedHandler(readBytes, numBytesRead); } else { Trace.WriteLine(String.Format("Couldn't read data from ftdi: status {0}", ftStatus)); Thread.Sleep(10); } } Thread.Sleep(this.RXThreadDelay); } } Write function called from main thread public void Write(byte[] data, int length) { if (this.IsOpened) { uint i = 0; lock (FtdiPort.threadLocker) { this.ftdiDevice.Write(data, length, ref i); } Thread.Sleep(1); if (i != (int)length) { throw new BackendException("Couldnt send all data"); } } else { throw new BackendException("Port is closed"); } } Object used to synchronize two threads static Object threadLocker = new Object(); Method that starts the receiver's thread private void startReceiver() { if (this.DataReceivedHandler == null) { return; } if (this.IsOpened == false) { throw new BackendException("Trying to start listening for raw data while disconnected"); } this.receiverThread = new Thread(this.receiverLoop); //this.receiverThread.Name = "protocolListener"; this.receiverThread.IsBackground = true; this.receiverThread.Start(); } The ftdiDevice.Write function doesn't hang up if I comment following line: ftStatus = ftdiDevice.Read(readBytes, this.ReadBufferSize, ref numBytesRead);

    Read the article

  • slide animation skipped when using updatepanel callback

    - by superexsl
    Hey, I'm trying to use UpdatePanels and JQuery but the panels seem to cancel out the JQuery. I want the user to press the search button, have the system perform the search using AJAX and then display the search results by sliding down the div using JQuery. However, it seems that if there are any delays, (I put the thread to sleep for a second), then the results just appear instead of sliding down. If I remove the sleep thread the sliding animation is fine. I've got the code below to execute the JQuery once the AJAX is loaded: <script type="text/javascript"> var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_pageLoaded(showDiv); function showDiv(sender, args){ $("#results_bar").slideDown('slow'); } </script> Any ideas why the animation is skipped if there's a delay? Thanks

    Read the article

  • why does python.subprocess hang after proc.communicate()?

    - by ccfenix
    I've got an interactive program called my_own_exe. First, it prints out alive, then you input S\n and then it prints out alive again. Finally you input L\n. It does some processing and exits. However, when I call it from the following python script, the program seemed to hang after printing out the first 'alive'. Can anyone here tell me why this is happening? Thanks proc2 = subprocess.Popen("my_own_exe", shell=True , stdin=subprocess.PIPE, stdout=subprocess.PIPE) print proc2.communicate()[0] time.sleep(2); print "alive" # 'hang' after print this line proc2.communicate('S\n')[0] print "alive" print proc2.communicate()[0] time.sleep(6)

    Read the article

  • "TypeError: CreateText() takes exactly 8 arguments (5 given)" with default arguments

    - by Eli Nahon
    def CreateText(win, text, x, y, size, font, color, style): txtObject = Text(Point(x,y), text) if size==None: txtObject.setSize(12) else: txtObject.setSize(size) if font==None: txtObject.setFace("courier") else: txtObject.setFace(font) if color==None: txtObject.setTextColor("black") else: txtObject.setTextColor(color) if style==None: txtObject.setStyle("normal") else: txtObject.setStyle(style) return txtObject def FlashingIntro(win, numTimes): txtIntro = CreateText(win, "CELSIUS CONVERTER!", 5,5,28) for i in range(numTimes): txtIntro.draw(win) sleep(.5) txtIntro.undraw() sleep(.5) I'm trying to get the CreateText function to create a text object with my "default" values if the parameters are not used. (I've tried it with blank strings "" instead of None and no luck) I'm fairly new to Python and have little programming knowledge.

    Read the article

  • C signals and processes

    - by Gary
    Hi, so basically I want "cmd_limit" to take a number in seconds which is the maximum time we'll wait for the child process (safe to assume there's only one) to finish. If the child process does finish during the sleep, I want cmd_limit to return pass and not run the rest of the cmd_limit code. Could anyone help me do this, here's what I've got so far.. int cmd_limit( int limit, int pid ) { signal( SIGCHLD, child_died ); sleep( limit ); kill( pid, SIGKILL ); printf("killin'\n"); return PASS; } void child_died( int sig ) { int stat_loc; /* child return information */ int status; /* child return status */ waitpid( -1, &stat_loc, WNOHANG ); if( WIFEXITED(stat_loc) ) { // program exited normally status = WEXITSTATUS( stat_loc ); /* get child exit status */ } printf("child died: %s\n", signal); }

    Read the article

  • How to simulate different CPU frequency and limit RAM

    - by user351103
    Hi I have to build a simulator with C#. This simulator should be able to run a second thread with configureable CPU speed and limited RAM size, e.g. 144MHz and 50 MB. Of course I know that a simulator can never be as accurate as the real hardware. But I try to get almost similar performance. At the moment I'm thinking about creating a thread which I will stop/sleep from time to time. Depending on the desired CPU speed the simulator should adjust the sleep time of this thread and therefore simulate different cpu frequency. To measure the achieved speed I though about using PerformanceCounters. But with this approach I have the problem that I don't know how to limit the RAM size the thread could use. Do you have any ideas how to realize such a simulator? Thanks in advance!!

    Read the article

  • Mysql Real Escape String PHP Function Adding "\" to My Field Entry

    - by Jascha
    Hello, I am submitting a form to my mySql database using PHP. I am sending the form data through the mysql_real_escape_string($content); function. When the entry shows up in my database (checking in myPhpAdmin) all of my double quotes and single quotes are escaped. I'm fairly certain this is a PHP configuration issue? so: $content = 'Hi, my name is Jascha and my "favorite" thing to do is sleep'; mysql_real_escape_string($content); $query = 'INSERT INTO DB...' comes up in my database as: Hi, my name is Jascha and my \"favorite" thing to do is sleep Who do I tell what to do? (I cannot access the php.ini). -J

    Read the article

  • Returning an array of tm* structs from a function

    - by paultop6
    Hi Guys, Im trying to create an array of tm* structs, and then return them at the end of the function. This is what i have at the moment: struct tm* BusinessLogicLayer::GetNoResponceTime() { struct tm* time_v[3]; struct tm* time_save; int s = 3; time_save = LastSavedTime(); time_v[0] = time_save; sleep(5); time_save = LastSavedTime(); time_v[1] = time_save; sleep(5); time_save = LastSavedTime(); time_v[2] = time_save; return time_v; } I understand that given the code i have now it will not be possible to return the array, because it will be destroyed when the function ends. Can anyone help me with regards to how i would go about being able to access the array from the returned value after the function has ended? Regards Paul

    Read the article

  • stopping android handler loop

    - by venka reddy
    Hi, i am using a class which extends Handler class to update my activity UI. The code is as follows in side main activity, /////////////////////////////// public class RefreshHandler extends Handler { public void handleMessage(Message msg) { Homeform.this.updateUI(); } public void sleep(long delayMillis) { this.removeMessages(0); sendMessageDelayed(obtainMessage(0), delayMillis); } }; private void updateUI(){ Log.v("","== I am inside Update UUI====================="); refresh(); mRedrawHandler.sleep(5000); } /////////////////////////// And i had call this method handleMessage() on the object of RefreshHandler as follows /////////////////////////////////////////// mRedrawHandler = new RefreshHandler(); mRedrawHandler.handleMessage(new Message()); //////////////////////////////////////////////// But here i am facing one problem that is it is running after closing my application also . please solve my problem to stop this handler when close this application. ThanQ.....

    Read the article

  • ASP.NET - Display Message While Page Is Loading

    - by Chris
    I have a page that performs a long-running task (10 to 15 seconds) in the page_load method. I have client-side javascript code that will display a decent "page loading" animated gif to the user. I am able to invoke the JavaScript method from the code-behind, to display the "page loading" animated gif, however, the long-running task is hanging up the UI such that the animated gif doesn't actually display until after the long-running task is complete, which is the exact opposite of what I want. To test this out, in my page_load method I make a call to the JavaScript method to display the animated gif. Then, I use Thread.Sleep(10000). What happens is that the animated gif doesn't display until after Thread.Sleep is complete. Obviously I am doing something incorrect. Any advice would be appreciated. Thanks. Chris

    Read the article

  • kill -9 + disable messages (standart output) from kill command

    - by yael
    hi all I write the following script this script enable timeout of 20 second if grep not find the relevant string in the file the script working well but the output from the script is like that: ./test: line 11: 30039: Killed how to disable this message from the kill command? how to tell kill command to ignore if process not exist? THX Yael !/bin/ksh ( sleep 20 ; [[ ! -z ps -ef | grep "qsRw -m1" | awk '{print $2}' ]] && kill -9 2/dev/null ps -ef | grep "qsRw -m1" | awk '{print $2}' ; sleep 1 ) & RESULT=$! print "the proccess:"$RESULT grep -qsRw -m1 "monitohhhhhhhr" /var if [[ $? -ne 0 ]] then print "kill "$RESULT kill -9 $RESULT fi print "ENDED" ./test the proccess:30038 ./test: line 11: 30039: Killed kill 3003

    Read the article

  • Why does this break statement break not work?

    - by Roman
    I have the following code: public void post(String message) { final String mess = message; (new Thread() { public void run() { while (true) { try { if (status.equals("serviceResolved")) { output.println(mess); Game.log.fine("The following message was successfully sent: " + mess); break; } else { try {Thread.sleep(1000);} catch (InterruptedException ie) {} } } catch (NullPointerException e) { try {Thread.sleep(1000);} catch (InterruptedException ie) {} } } } }).start(); } In my log file I find a lot of lines like this: The following message was successfully sent: blablabla The following message was successfully sent: blablabla The following message was successfully sent: blablabla The following message was successfully sent: blablabla And my program is not responding. It seems to me that the break command does not work. What can be a possible reason for that. The interesting thing is that it happens not all the time. Sometimes my program works fine, sometimes the above described problem happens.

    Read the article

  • How to get progress bar to time Class exectution

    - by chrissygormley
    Hello, I am trying to use progress bar to show the progress of a script. I want it increase progress after every function in a class is executed. The code I have tried is below: import progressbar from time import sleep class hello(): def no(self): print 'hello!' def yes(self): print 'No!!!!!!' def pro(): bar = progressbar.ProgressBar(widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()]) for i in Yep(): bar.update(Yep.i()) sleep(0.1) bar.finish() if __name__ == "__main__": Yep = hello() pro() Does anyone know how to get this working. Thanks

    Read the article

  • C# problem with two threads and hardware access

    - by mack369
    I'm creating an application which communicates with the device via FT2232H USB/RS232 converter. For communication I'm using FTD2XX_NET.dll library from FTDI website. I'm using two threads: first thread continuously reads data from the device the second thread is the main thread of the Windows Form Application I've got a problem when I'm trying to write any data to the device while the receiver's thread is running. The main thread simply hangs up on ftdiDevice.Write function. I tried to synchronize both threads so that only one thread can use Read/Write function at the same time, but it didn't help. Below code responsible for the communication. Note that following functions are methods of FtdiPort class. Receiver's thread private void receiverLoop() { if (this.DataReceivedHandler == null) { throw new BackendException("dataReceived delegate is not set"); } FTDI.FT_STATUS ftStatus = FTDI.FT_STATUS.FT_OK; byte[] readBytes = new byte[this.ReadBufferSize]; while (true) { lock (FtdiPort.threadLocker) { UInt32 numBytesRead = 0; ftStatus = ftdiDevice.Read(readBytes, this.ReadBufferSize, ref numBytesRead); if (ftStatus == FTDI.FT_STATUS.FT_OK) { this.DataReceivedHandler(readBytes, numBytesRead); } else { Trace.WriteLine(String.Format("Couldn't read data from ftdi: status {0}", ftStatus)); Thread.Sleep(10); } } Thread.Sleep(this.RXThreadDelay); } } Write function called from main thread public void Write(byte[] data, int length) { if (this.IsOpened) { uint i = 0; lock (FtdiPort.threadLocker) { this.ftdiDevice.Write(data, length, ref i); } Thread.Sleep(1); if (i != (int)length) { throw new BackendException("Couldnt send all data"); } } else { throw new BackendException("Port is closed"); } } Object used to synchronize two threads static Object threadLocker = new Object(); Method that starts the receiver's thread private void startReceiver() { if (this.DataReceivedHandler == null) { return; } if (this.IsOpened == false) { throw new BackendException("Trying to start listening for raw data while disconnected"); } this.receiverThread = new Thread(this.receiverLoop); //this.receiverThread.Name = "protocolListener"; this.receiverThread.IsBackground = true; this.receiverThread.Start(); } The ftdiDevice.Write function doesn't hang up if I comment following line: ftStatus = ftdiDevice.Read(readBytes, this.ReadBufferSize, ref numBytesRead);

    Read the article

  • How do I get the window id and tab number of a Terminal window using AppleScript via the ScriptingBr

    - by Gavin Brock
    I can open a Terminal tab using the following AppleScript: tell application "Terminal" set myTab to do script "exec sleep 1" get myTab end tell This returns a string like: tab 1 of window id 3263 of application "Terminal". This is great, I can see the window id 3263 and tab number 1 (although I don't know how to query myTab to get only these values). In the Cocoa ScriptingBridge, I can do: SBApplication *terminal; SBObject *tab; terminal = [SBApplication applicationWithBundleIdentifier:@"com.apple.terminal"] tab = [terminal doScript:@"exec sleep 1" in:nil] How do I get the window id and tab number from the tab object?

    Read the article

  • iPhone equivalent of Application.DoEvents();

    - by BahaiResearch.com
    iPHone: We use MonoTouch, but Obj-C answers are ok. My singleton domain object takes a while to get all the data so it runs internally parts of the fetch in a thread. I need to inform the UI that the domain is done. Currently I do this. Is there a better way? In WinForms I would call Application.DoEvents() instead of Thread Sleep. PlanDomain domain = PlanDomain.Instance (); while (domain.IsLoadingData) { Thread.Sleep (100); //this is the main UI thread } TableView.Hidden = false; TableView.Source = new TableSource (this); TableView.ReloadData ();

    Read the article

  • When I really need to use [NSThread sleepForTimeInterval:1];

    - by Timbo
    Hi there, I have a program that needs to use sleep. Like really needs to. In lieu of spending ages explaining why, suffice to say that it needs it. Now I'm told to split off my code into a separate thread if it requires sleep so I don't lose interface responsiveness, so I've started learning how to use NSThread. I've created a brand new program that is conceptual so to solve the issue for this example will help me in my real program. Short story is I have a class, it has instance variables and I need a loop with a sleep to be depended on the value of that instance variable. Here's what I've put together anyway, your help is very much appreciated :) Cheers Tim /// Start Test1ViewController.h /// #import <UIKit/UIKit.h> @interface Test1ViewController : UIViewController { UILabel* label; } @property (assign) IBOutlet UILabel *label; @end /// End Test1ViewController.h /// /// Start Test1ViewController.m /// #import "Test1ViewController.h" #import "MyClass.h" @implementation Test1ViewController @synthesize label; - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; label.text = @"1"; [NSThread detachNewThreadSelector:@selector(backgroundProcess) toTarget:self withObject:nil]; } - (void)backgroundProcess { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Create an instance of a class that will eventually store a whole load of variables MyClass *aMyClassInstance = [MyClass new]; [aMyClassInstance createMyClassInstance:(@"Timbo")]; while (aMyClassInstance.myVariable--) { NSLog(@"blah = %i",aMyClassInstance.myVariable); label.text = [NSString stringWithFormat:@"blah = %d", aMyClassInstance.myVariable]; //how do I pass the new value out to the updateLabel method, or reference aMyClassInstance.myVariable? [self performSelectorOnMainThread:@selector(updateLabel) withObject:nil waitUntilDone:NO]; //the sleeping of the thread is absolutely mandatory and must be worked around. The whole point of using NSThread is so I can have sleeps [NSThread sleepForTimeInterval:1]; } [pool release]; } - (void)updateLabel {label.text = [NSString stringWithFormat:@"blah = %d", aMyClassInstance.myVariable]; // be nice if i could } - (void)didReceiveMemoryWarning {[super didReceiveMemoryWarning];} - (void)viewDidUnload {} - (void)dealloc {[super dealloc];} @end /// End Test1ViewController.m /// /// Start MyClass.h /// #import <Foundation/Foundation.h> @interface MyClass : NSObject { NSString* name; int myVariable; } @property int myVariable; @property (assign) NSString *name; - (void) createMyClassInstance: (NSString*)withName; - (int) changeVariable: (int)toAmount; @end /// End MyClass.h /// /// Start MyClass.h /// #import "MyClass.h" @implementation MyClass @synthesize name, myVariable; - (void) createMyClassInstance: (NSString*)withName{ name = withName; myVariable = 10; } - (int) changeVariable: (int)toAmount{ myVariable = toAmount; return toAmount; } @end /// End MyClass.h ///

    Read the article

  • PHP max_execution_time not timing out

    - by Joey Ezekiel
    This is not one of the regular questions if sleep is counted for timeout or stuff like that. Ok, here's the problem: I've set the max_execution_time for PHP as 15 seconds and ideally this should time out when it crosses the set limit, but it doesn't. Apache has been restarted after the change to the php.ini file and an ini_get('max_execution_time') is all fine. Sometimes the script runs for upto 200 seconds which is crazy. I have no database communication whatsoever. All the script does is looking for files on the unix filesystem and in some cases re-directing to another JSP page. There is no sleep() on the script. I calculate the total execution time of the PHP script like this: At the start of the script I set : $_mtime = microtime(); $_mtime = explode(" ",$_mtime); $_mtime = $_mtime[1] + $_mtime[0]; $_gStartTime = $_mtime; and the end time($_gEndTime) is calculated similarly. The total time is calculated in a shutdown function that I've registered: register_shutdown_function('shutdown'); ............. function shutdown() { .............. .............. $_total_time = $_gEndTime - $_gStartTime; .............. switch (connection_status ()) { case CONNECTION_NORMAL: .... break; .... case CONNECTION_TIMEOUT: .... break; ...... } } Note: I cannot use $_SERVER['REQUEST_TIME'] because my PHP version is incompatible. That sucks - I know. 1) Well, my first question obviously is is why is my PHP script executing even after the set timeout limit? 2) Apache has the Timeout directive which is 300 seconds but the PHP binary does not read the Apache config and this should not be a problem. 3) Is there a possibility that something is sending PHP into a sleep mode? 4) Am I calculating the execution time in a wrong way? Is there a better way to do this? I'm stumped at this point. PHP Wizards - please help.

    Read the article

  • SerialPort not taking input. It throws it back at me!

    - by Mashew
    When I try to write an AT command to my GSM modem, it does not seem to take the command. I have used PuTTY to check that the command words, it does. I have checked to see if the port is opening, it does. What could I possibly be doing wrong? NOTE: The "lol" part is for debugging purposes. ;3 SerialPort sp = new SerialPort("COM3"); sp.BaudRate = 9600; sp.DataBits = 8; sp.StopBits = StopBits.One; sp.Parity = Parity.None; sp.Open(); if (sp.IsOpen == false) { sp.Open(); } Thread.Sleep(1000); sp.WriteLine("AT+CMGF=1"); Thread.Sleep(1000); string lol = sp.ReadExisting(); sp.Close(); return lol;

    Read the article

  • Listing time every second as a Bash script

    - by Caleb
    Hello all, first time here as I've finally started to learn programming. Anyway, I'm just trying to print the time in nanoseconds every second here, and I have this: #!/usr/bin/env bash while true; do date=(date +%N) ; echo $date ; sleep 1 ; done Now, that simply yields a string of date's, which isn't what I want. My learning has been rather messy, so I hope you'll excuse me for this if it's really simple. Also, I did manage to fine this, that worked on the prompt: while true ; do date +%N ; sleep 1 ; done But that obviously doesn't work as a script.

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >