Search Results

Search found 29841 results on 1194 pages for 'random number generator'.

Page 112/1194 | < Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >

  • C# Check for missing number in sequence

    - by Jon
    I have an List<int> which contains 1,2,4,7,9 for example. I have a range from 0 to 10. Is there a way to determine what numbers are missing in that sequence? I thought LINQ might provide an option but I can't see one In the real world my List could contain 100,000 items so performance is key

    Read the article

  • SQL ENQUIRY In how to Get defined number of records

    - by ramadan2050
    I have a select statement, retrieve about 1000 record I want to modify it to return only some records defined by @startIndex and @count e.g. : If I said @startIndex=20 and @count=20 the result will be : from the 21th record to 40th I try to make it, but it take the same time as if I retrieve the 1000 record what is the best way to do that

    Read the article

  • Get number of apps in TaskBar

    - by j-t-s
    Hi All I've been wondering how to do this for ages. I'm creating a little app, and I need to figure out how many apps or windows are displayed in the TaskBar. I've yet to find any info on this at all, I'd appreciate any help at all. Thank you :)

    Read the article

  • A comprehensive regex for phone number validation

    - by Nicholas Trandem
    I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: 1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901 I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.

    Read the article

  • Find the clicked li number

    - by fire
    I have a standard list... <ul> <li><a href="#">blah 1</a></li> <li><a href="#">blah 2</a></li> <li><a href="#">blah 3</a></li> <li><a href="#">blah 4</a></li> </ul> And my jQuery: $('ul li a').live('click', function() { var parent = $(this).parent('li'); }); What I want to find out is the parent li's position in the list of the clicked link e.g. clicking on blah 3 would give me 2, blah 4 would give 3 etc. Any ideas?

    Read the article

  • NUmber of rows in Oracle SQL Select?

    - by twelshesgi
    I need to nkw how many records were returned in a select in oracle. Currently, I do two queries: SELECT COUNT(ITEM_ID) FROM MY_ITEMS; SELECT * FROM MY_ITEMS; I need to know the COUNT but I hate doing two queries. Is there a way to do: SELECT * FROM MY_ITEMS and then find out how many records are in there?

    Read the article

  • How to prevent negative number in Mysql

    - by Jerry
    Hello guys.. I have data which is starting from 0 in my database. My php will add 1 or -1 to the data depending on the user's input. My problem is that if data is 0 and a user try to subtract 1. The data become 4294967295 which is the maximum value of INT data type. Are there anyways to make the data stays in 0 even when the user asks for -1? Thanks for the reply.. my sql command is like below update board set score=score-1 where team='TeamA' //this would generate 4294967295 if the score is 0.....

    Read the article

  • Handling dynamic number of columns

    - by Whistle
    I'm developing a CMS of sorts, and I want to give my users the possibility of customizing the display. More precisely, I want to give them the ability to choose to display or hide the left column, the right column and/or the top div. The middle column cannot be hidden since this is where the actual content will show, whereas the other columns are for navigation or side menus. I've been looking for a way to make this as smart and flexible as possible. For now I'm using a MasterPage, but that seems to be too constraining. For instance, with MasterPage you need to add a ContentPlaceHolder control in every of your ASPX pages. What are the best practices in this area? I guess a simpler way of saying this would be "I want to create a template system over which I have complete control".

    Read the article

  • Print the next X number of lines in Scala

    - by soulesschild
    Trying to learn Scala using the Programming in Scala book and they have a very basic example for reading lines from a file. I'm trying to expand on it and read a file line by line, look for a certain phrase, then print the next 6 lines following that line if it finds the line. I can write the script easily enough in something like java or Perl but I have no idea how to do it in Scala (probably because I'm not very familiar with the language yet...) Here's the semi adapted sample code from the Programming in Scala book, import scala.io.Source if(args.length>0) { val lines = Source.fromFile(args(0)).getLines().toList for(line<-lines) { if(line.contains("secretPhrase")) { println(line) //How to get the next lines here? } } } else Console.err.println("Pleaseenterfilename")

    Read the article

  • sql select from a large number of IDs

    - by Claudiu
    I have a table, Foo. I run a query on Foo to get the ids from a subset of Foo. I then want to run a more complicated set of queries, but only on those IDs. Is there an efficient way to do this? The best I can think of is creating a query such as: SELECT ... --complicated stuff WHERE ... --more stuff AND id IN (1, 2, 3, 9, 413, 4324, ..., 939393) That is, I construct a huge "IN" clause. Is this efficient? Is there a more efficient way of doing this, or is the only way to JOIN with the inital query that gets the IDs? If it helps, I'm using SQLObject to connect to a PostgreSQL database, and I have access to the cursor that executed the query to get all the IDs.

    Read the article

  • Count number of results in a View

    - by Jukebox
    I need to count how many people belong in pre-defined groups (this is easy to do in SQL using the SELECT COUNT statement). My Views query runs fine and displays the actual data in my table, but I simply need to know how many results it found. However there doesn't seem to be a COUNT option in views. I am guessing I am going to have to use some sort of views hook, and then stick the result in the table. Here's a quick example of what i'm trying to achieve: My Table ---------------------- Group A | 20 people Group B | 63 people and so on. (I've tried using the Views_Calc module, but I get errors because it is not quite stable yet.) Anybody know of an easy way to count results in Views?

    Read the article

  • Doubling a number - shift left vs. multiplication

    - by ToxicAvenger
    What are the differences between int size = (int)((length * 200L) / 100L); // (1) and int size = length << 1; // (2) (length is int in both cases) I assume both code snippets want to double the length parameter. I'd be tempted to use (2) ... so are there any advantages for using (1)? I looked at the edge cases when overflow occurs, and both versions seem to have the same behavior. Please tell me what am I missing.

    Read the article

  • Performance implications of using a variable versus a magic number

    - by Nathan
    I'm often confused by this. I've always been taught to name numbers I use often using variables or constants, but if it reduces the efficiency of the program, should I still do it? Heres an example: private int CenterText(Font font, PrintPageEventArgs e, string text) { int recieptCenter = 125; int stringLength = Convert.ToInt32(e.Graphics.MeasureString(text, font)); return recieptCenter - stringLength / 2; } The above code is using named variables, but runs slower then this code: private int CenterText(Font font, PrintPageEventArgs e, string text) { return 125 - Convert.ToInt32(e.Graphics.MeasureString(text, font) / 2); } In this example, the difference in execution time is minimal, but what about in larger blocks of code?

    Read the article

  • How to let the UITable sorted by number?

    - by Tattat
    I loaded a plist from the UITable, but there is something wrong. my plist file is some data like that: 3 3uyyhuhu34 ..... 5 5uyyhuhu34 ..... 11 11uyyhuhu34 ..... I found that the list is sorted from 11, then 3, after that is 5. But I want to sorted from 3, 5 to 11. What can I do to change the behaviors? thx

    Read the article

  • Getting number of days between [NSDate date] and string @"2010-11-12"

    - by grobald
    Hello i have a question. in short: i need a function which receives [NSDate date] and string @"2010-11-12" and returns the amount of days between those two dates. more explanation: I need to store a date from a server in the format @"2010-11-12" in my NSUserdefaults. The meaning of this date is the expireDate of a feature in an iPhone App. Everytime i press on a button for this feature i need to check if the difference in days between the current time-[NSDate date] and @"2010-11-12" is greater than 0. That means tahat the feature is disabled. its making me crazy mabey its to dead simple.

    Read the article

  • selecting number of rows from resultset

    - by sap
    Suppose a query "select * from employee" returns 80 rows. I need to display middle rows that is from 20th row to 50th row. I know, like to display first 20 rows we have option like "select top 20 * from employee" but if we need middle rows how to get it in MS SQL specifically. I m new to this SQL queries...Can anybody answer to this question.

    Read the article

  • Remove dash from a phone number

    - by zoom_pat277
    What regular expression using java could be used to filter out dashes '-' and open close round brackets from a string representing phone numbers... so that (234) 887-9999 should give 2348879999 and similarly 234-887-9999 should give 2348879999. Thanks,

    Read the article

< Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >