Search Results

Search found 14236 results on 570 pages for 'times square'.

Page 58/570 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • Ruby SerialPorts

    - by Seth Archer
    I'm using the ruby serial port gem. After I open up the port I send the data I want like this. sp.write [200.chr, 30.chr, 7.chr, 5.chr, 1.chr, 2.chr, 0.chr, 245.chr].to_s It doesn't work, but if I put it in a loop of around 200 times: 200.times do sp.write [200.chr, 30.chr, 7.chr, 5.chr, 1.chr, 2.chr, 0.chr, 245.chr].to_s end It works. Any ideas on why this is happening?

    Read the article

  • Knight movement.... " how to output all possible moves. "

    - by josh kant
    The following is the code i wrote.. I have to write it for nXn but for easyness i tried to test it for 5X5. It does not display my output... could anybody tell me whats wrong with the following code: { #include <iostream> #include <iomanip> using namespace std; void knight ( int startx, int starty, int n, int p[][5], int used [][5], int &count); int main ( ) { const int n = 5; // no. of cloumns and rows int startx = 0; int starty = 0; int p[5][5]; int used[5][5]; int count = 1; int i= 0; int j = 0; //initializing the array for ( i = 0; i < 5; i++) { for ( j = 0; j < 5; j++) { p[i][j] = 0; used [i][j] = 0; } } //outputting the initialized array.. i=0; while ( i< 5) { for ( j = 0; j < 5; j++) { cout << setw(3) << p[i][j]; } i++; cout << endl; } knight (startx,starty,n,p,used,count); return 0; } void knight ( int x, int y, int n, int p[][5], int used [][5], int &count) { int i = 0; //knight (x,y,n,p,used,count) for ( i = 0; i < n*n; i++) { if ( used [x][y] == 0 ) { used[x][y] = 1; // mark it used; p[x][y] += count; //inserting step no. into the solution //go for the next possible steps; //move 1 //2 squares up and 1 to the left if (x-1 < 0 && y+2 < n && p[x-1][y+2] == 0) { used[x-1][y+2] = 1; p[x-1][y+2] += count; knight (x-1,y+2,n,p,used,count); used[x-1][y+2] = 0; } //move 2 //2 squares up and 1 to the right if ( x+1 < n && y+2 < n && p[x+1][y+2] == 0 ) { used[x+1][y+2] = 1; p[x+1][y+2] += count; knight (x+1,y+2,n,p,used,count); used[x+1][y+2] = 0; } //move 3 //1 square up and 2 to the right if ( x+2 < n && y+1 < n && p[x+2][y+1] == 0 ) { used[x+2][y+1] = 1; p[x+2][y+1] += count; knight (x+2,y+1,n,p,used,count); used[x+2][y+1] = 0; } //move 4 //1 square down and 2 to the right if ( x+2 < n && y-1 < n && p[x+2][y-1] == 0 ) { used[x+2][y-1] = 1; p[x+2][y-1] += count; knight (x+2,y-1,n,p,used,count); used[x+2][y-1] = 0; } //move 5 //2 squares down and 1 to the right if ( x+1 < n && y-2 < n && p[x+1][y-2] == 0 ) { used[x+1][y-2] = 1; p[x+1][y-2] += count; knight (x+1,y-2,n,p,used,count); used[x+1][y-2] = 0; } //move 6 //2 squares down and 1 to the left if ( x-1 < n && y-2 < n && p[x-1][y-2] == 0 ) { used[x-1][y-2] = 1; p[x-1][y-2] += count; knight (x-1,y-2,n,p,used,count); used[x-1][y-2] = 0; } //move 7 //1 square down and 2 to the left if ( x-2 < n && y-1 < n && p[x-2][y-1] == 0 ) { used[x-2][y-1] = 1; p[x-2][y-1] += count; knight (x-2,y-1,n,p,used,count); used[x-2][y-1] = 0; } //move 8 //one square up and 2 to the left if ( x-2 < n && y+1< n && p[x-2][y+1] == 0 ) { used[x-2][y+1] = 1; p[x-2][y+1] += count; knight (x-2,y+1,n,p,used,count); used[x-2][y+1] = 0; } } } if ( x == n-1 && y == n-1) { while ( i != n) { for ( int j = 0; j < n; j++) cout << setw(3) << p[i][j]; i++; } } } Thank you!!

    Read the article

  • Reading RSS feeds --> not consistent

    - by DEE
    Hi There, i am trying to read the RSS feed by loading it to xmldocument some thing like xmlTextReader = new XmlTextReader(url); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlTextReader); some times the loading to xml document succeeds and some times it fails . the url i am using is http://rss.nzherald.co.nz/rss/xml/nzhrsscid%5F000000004.xml what could be the probelm, is it like the RSS is not updated properly..? any suggestions/comments Regards DEE

    Read the article

  • Apple AppStore approval - post iPad?

    - by BahaiResearch.com
    Has the appStore changed it's approval times? Before the iPad announcement we were getting approved in 2-3 days. After the announcement we're over a week and no sign of any approval on the horizon. Are there any changes in the xml plist for the app needed to improve approval times?

    Read the article

  • Automatic bookkeeping for exception retries

    - by pilcrow
    Do any languages that support retry constructs in exception handling track and expose the number of times their catch/rescue (and/or try/begin) blocks have been executed in a particular run? I find myself counting (and limiting) the number of times a code block is re-executed after an exception often enough that this would be a handy language built-in.

    Read the article

  • Contains performs MUCH slower with variable vs constant string SQL Server

    - by Greg R
    For some unknown reason I'm running into a problem when passing a variable to a full text search stored procedure performs many times slower than executing the same statement with a constant value. Any idea why and how can that be avoided? This executes very fast: SELECT * FROM table WHERE CONTAINS (comments, '123') This executes very slowly and times out: DECLARE @SearchTerm nvarchar(30) SET @SearchTerm = '123' SET @SearchTerm = '"' + @SearchTerm + '"' SELECT * FROM table WHERE CONTAINS (comments, @SearchTerm) Does this make any sense???

    Read the article

  • I want to scramble an array in PHP

    - by BRUL
    I want PHP to randomly create a multi-dimensional array by picking a vast amount of items out of predefined lists for n times, but never with 2 times the same. Let me put that to human words in a real-life example: i want to write a list of vegetables and meat and i want php to make a menu for me, with every day something else then yesterday. I tried and all i got was the scrambling but there were always doubles :s

    Read the article

  • Python run command line (time)

    - by pns
    Hi, I want to run the 'time' unix command from a Python script, to time the execution of a non Python app. I would use the os.system method. Is there any way to save the output of this in Python? My goal is to run the app several times, save their execution times and then do some statistics on them. Thank You

    Read the article

  • What is your favorite pastime to engage in while your project is buidling?

    - by ondesertverge
    As my average project grows in size the sum of build times throughout the day (and night) adds up to a substantial amount of time. Some of the things I or others do in this time include: Reading the news Thinking of ways to advance the project Looking at other projects Throwing darts Checking the unanswered list on stackoverflow.com Build times aren't constant making it hard to plan constructive use of them. I would like to hear of a method in use to make beneficial use of those few minutes that can add up to a few hours.

    Read the article

  • Repeating procedure for every item in class

    - by Hendriksen123
    Data.XX.NewValue := Data.XX.SavedValue; Data.XX.OldValue := Data.XX.SavedValue; I need to do the above a large number of times, where XX represents the value in the class. Pretending there were 3 items in the list: Tim, Bob, Steve. Is there any way to do the above for all three people without typing out the above code three times? (Data is a class containing a number of Objects, each type TList, which contain OldValue, NewValue and SavedValue)

    Read the article

  • Java - How to avoid loss of precision during divide and cast to int?

    - by David Buckley
    I have a situation where I need to find out how many times an int goes into a decimal, but in certain cases, I'm losing precision. Here is the method: public int test(double decimalAmount, int divisor) { return (int) (decimalAmount/ (1d / divisor)); } The problem with this is if I pass in 1.2 as the decimal amount and 5 as the divisor, I get 5 instead of 6. How can I restrusture this so I know how many times 5 goes into the decimal amount as an int?

    Read the article

  • Sort a python dict

    - by ensnare
    I have a list of dictionaries: [{'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}, {'title':'Apple News','title_url':'Apple_News','id':2}] I'd like to sort it by the title, so elements with A go before Z: [{'title':'Apple News','title_url':'Apple_News','id':2}, {'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}] What's the best way to do this? Also, is there a way to ensure the order of each dictionary key stays constant, e.g., always title, title_url, then id? Thank you.

    Read the article

  • Version of STL optimized for compile time?

    - by anon
    Hi! I'm looking for a variant of the STL (it's okay if it doesn't have all the functionality) that's optimized for short compile times -- I get bothered by long compile times that delay my compile-debug-edit cycle. I'm mainly interested in the containers of the STL: vector/map, and not so much the algorithms. Thanks!

    Read the article

  • Which Is The Best Way Of Creating Random Value ???

    - by Meko
    I am triying to create random value for my game to show enemies on screen. BUt it some times shows 2 together some times 3 ...I want to ask that which is the best formul for creating random value.. This is my so far random value random = 1 * (int) (Math.random() * 100);

    Read the article

  • Date range intersection in SQL

    - by Will
    I have a table where each row has a start and stop date-time. These can be arbitrarily short or long spans. I want to query the sum duration of the intersection of all rows with two start and stop date-times. How can you do this in MySQL? Or do you have to select the rows that intersect the query start and stop times, then calculate the actual overlap of each row and sum it client-side?

    Read the article

  • Contains performs MUCH slower with variable vs constant string MS SQL Server

    - by Greg R
    For some unknown reason I'm running into a problem when passing a variable to a full text search stored procedure performs many times slower than executing the same statement with a constant value. Any idea why and how can that be avoided? This executes very fast: SELECT * FROM table WHERE CONTAINS (comments, '123') This executes very slowly and times out: DECLARE @SearchTerm nvarchar(30) SET @SearchTerm = '123' SET @SearchTerm = '"' + @SearchTerm + '"' SELECT * FROM table WHERE CONTAINS (comments, @SearchTerm) Does this make any sense???

    Read the article

  • Qt mac : How does the layout differs from the other OSes

    - by dzen
    Qt is a nice framework which allows people to develop something once and it will works for the 3 main OSes. But from times to times, there is some differences in the layout: placing some widgets does not have the same behavior as in windows or linux. Did you observe weird behavior ? on which Widgets ? how did you corrected this ? Thanks for sharing

    Read the article

  • DOM - More than 5 'window' objects on one page

    - by Sid
    Hi, I'm trying to extract data from one of my websites using Greasemonkey. Problem is, the script runs 6 times because apparently the page loads content from 6 different servers. So if I put in an alert ("Hey"); the code runs 6 times and I get 6 alerts. How can I wait for the entire page to load and then start playing with the DOM. Also, I'm using jQuery. Thanks

    Read the article

  • Sort a list of dicts by dict values

    - by ensnare
    I have a list of dictionaries: [{'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}, {'title':'Apple News','title_url':'Apple_News','id':2}] I'd like to sort it by the title, so elements with A go before Z: [{'title':'Apple News','title_url':'Apple_News','id':2}, {'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}] What's the best way to do this? Also, is there a way to ensure the order of each dictionary key stays constant, e.g., always title, title_url, then id? Thank you.

    Read the article

  • Using jquery to prevent resubmitting form

    - by Tony
    I use jquery's .submit() to intercept user's submit event, however I found a problem. When the user single click the submit button, the form is submitted normally, but if a user deliberately fast click it multiple times, it will submit multiple times, which will cause duplicated data in the database. What's the solution for this kind of problem ?

    Read the article

  • Display date _and_ time in user locale

    - by Sverre Rabbelier
    I know I can use android.text.format.DateFormat.getDateFormat() to format my dates, and android.text.format.DateFormat.getTimeFormat to format my times, but how do I format a datetime? Similar to the getDateTimeInstance method from java.text.DateFormat. I'm currently just concatenating the result of both the getDateFormat and getTimeFormat's formatters, but I don't know which way around the user prefers to have their dates and times shown.

    Read the article

  • HttpWebRequest ReadWriteTimeout ignored in .NET; works in Mono

    - by jimvfr
    When writing data to a web server, my tests show HttpWebRequest.ReadWriteTimeout is ignored, contrary to the MSDN spec. For example if I set ReadWriteTimeout to 1 (=1 msec), call myRequestStream.Write() passing in a buffer that takes 10 seconds to transfer, it transfers successfully and never times out using .NET 3.5 SP1. The same test running on Mono 2.6 times out immediately as expected. What could be wrong?

    Read the article

  • Qt mac : How does the layout differs from other OSes

    - by dzen
    Qt is a nice framework which allows people to develop something once and it will works for the 3 main OSes. But from times to times, there is some differences in the layout: placing some widgets does not have the same behavior as in windows or linux. Did you observe weird behavior ? on which Widgets ? how did you corrected this ? Thanks for sharing

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >