Search Results

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

Page 72/1194 | < Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >

  • Flex DataGrid reads a field from lastResult.node as number

    - by Nemi
    Why Flex 3 DataGrid reads a string from XML lastResult.node as number? A field is saved as var_char in mysql, php reads it as string and pass it OK. If there are more then 16 charaters it gets rounded.... For example: this in database cell: 12345678901234567 gets read in DataGrid as nubmer as 12345678901234568 this is in database cell: 5555544444222223333377777 php reads it same and puts it in XML flex reads XML into arrayCollection and DataGrid reads it as: 5.55554444422222e+24 So it reads it as number, why? And how to make it read as String? I tried with labelFunction, no help.

    Read the article

  • Split number and put each digit to separate html element

    - by Seven
    The problem is that I do not know how to break the loop for the first number and start again for the next one. Currently, one span.nNumber has a total digits of the two numbers (123456) and the next span.nNumber contains digits only from another number (456). Goal is to create sequence 123 and 456: <span class='nNumber'> <span>1</span> <span>2</span> <span>3</span> </span> and <span class='nNumber'> <span>4</span> <span>5</span> <span>6</span> </span> Example script: http://jsfiddle.net/PZ8Pt/2/

    Read the article

  • getting number of hours until the next event

    - by Andrew Heath
    I've got a table with this data: [ID] [event_name] [last_event] 1 stats 2011-01-01 01:47:32 last_event is a timestamp. The event occurs every 48 hours (it's a cron job). I'd like to show my users the number of hours until the event executes again. So far I've got: SELECT (lastFinish + INTERVAL 48 HOUR) FROM `cron_status` which gives me the exact time and date of the next occurence: 2011-01-03 01:47:32. So I figured if I subtracted the current datetime... SELECT ((lastFinish + INTERVAL 48 HOUR) - SYSDATE()) FROM `cron_status` which (I think?) gives me the difference in unix time: 1980015. But if I divide that by 3600 to convert the seconds to hours... SELECT (((lastFinish + INTERVAL 48 HOUR) - SYSDATE())/3600) FROM `cron_status` I get numbers an order of magnitude too high: 549.99. Where am I going wrong? The target is returning the number of hours until the next execution. Thank you!

    Read the article

  • BigInteger.Parse() on hexadecimal number gives negative numbers.

    - by brickner
    I've started using .NET 4 System.Numerics.BigInteger Structure and I've encountered a problem. I'm trying to parse a string that contains a hexadecimal number with no sign (positive). I'm getting a negative number. For example, I do the following two asserts: Assert.IsTrue(System.Int64.Parse("8", NumberStyles.HexNumber, CultureInfo.InvariantCulture) > 0, "Int64"); Assert.IsTrue(System.Numerics.BigInteger.Parse("8", NumberStyles.HexNumber, CultureInfo.InvariantCulture) > 0, "BigInteger"); The first assert succeeds, the second assert fails. I actually get -8 instead of 8 in the BigInteger. The problem seems to be when I'm the hexadecimal starts with 1 bit and not 0 bit (a digit between 8 and F inclusive). If I add a leading 0, everything works perfectly. Is that a bad usage on my part? Is it a bug in BigInteger?

    Read the article

  • php, get an end date based on start date and number of months

    - by mike
    Hi! I need to calculate an end date based on todays date and a number of months. For example, todays date 04/01/2010 and the number of months is 6. Are there any functions I can use to do some math that would return "10/01/2010"? Also, I think it's important to note that I am storing the result in MySQL as a "DATETIME" so I guess I would have to do something with the time as well... ??? Thanks!

    Read the article

  • How to reduce the number of points in (x,y) data

    - by Gowtham
    I have a set of data points: (x1, y1) (x2, y2) (x3, y3) ... (xn, yn) The number of sample points can be thousands. I want to represent the same curve as accurately as possible with minimal (lets suppose 30) set of points. I want to capture as many inflection points as possible. However, I have a hard limit on the number of allowed points to represent the data. What is the best algorithm to achieve the same? Is there any free software library that can help? PS: I have tried to implement relative slope difference based point elimination, but this does not always result in the best possible data representation. Thanks for your time. -Gowtham

    Read the article

  • Runtime error on UVa Online Judge on Erdos Number

    - by 2012 - End of the World
    I am solving the Erdos number problem from the programming challenges in JAVA. The code runs perfectly in my machine. However on the online judge it results in a runtime error. Could anyone point out the mistake i made? http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=985 Here is the code import java.util.*; import java.io.*; class Main { private String inputLines[]; private String namesToBeFound[]; private String namesInEachBook[][]; private String searchItem; private boolean solnfound=false; private static final BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); static String read() throws IOException { String line; while(true) { line=br.readLine(); if(line==null) break; //eof else if(line.length()==0) continue; //blank line else { line=line.trim().replaceAll("\\s+"," "); return line; } } return null; } public static void main(String args[]) throws IOException { Main ob=new Main(); int totalPapers,calcAuthors,totalScenarios; //First input number of scenarios totalScenarios=Integer.parseInt(read()); //Now start a loop for reading total number of scenarios for(int scenario=1;scenario<=totalScenarios;scenario++) { //Now read the line containing the number of papers and authors StringTokenizer line=new StringTokenizer(read()," "); totalPapers=Integer.parseInt(line.nextToken()); calcAuthors=Integer.parseInt(line.nextToken()); //Read a line containing author names along with book names ob.inputLines=new String[totalPapers]; for(int i=0;i<totalPapers;i++) ob.inputLines[i]=read(); //Read a line containing the names to be searched ob.namesToBeFound=new String[calcAuthors]; for(int i=0;i<calcAuthors;i++) ob.namesToBeFound[i]=read(); //Now generate the array ob.buildArray(); //Now search System.out.println("Scenario "+scenario); for(int i=0;i<calcAuthors;i++) { ob.searchItem=ob.namesToBeFound[i]; if(ob.searchItem.equals("Erdos, P.")) { System.out.println("Erdos, P. 0"); continue; } ob.search(ob.namesToBeFound[i],1,new ArrayList()); if(ob.solnfound==false) System.out.println(ob.searchItem+" infinity"); ob.solnfound=false; } } } private void buildArray() { String str; namesInEachBook=new String[inputLines.length][]; for(int i=0;i<inputLines.length;i++) { str=inputLines[i]; str=str.substring(0,str.indexOf(':')); str+=","; namesInEachBook[i]=new String[(countCommas(str)+1)>>1]; for(int j=0;j<namesInEachBook[i].length;j++) { str=str.trim(); namesInEachBook[i][j]=""; namesInEachBook[i][j]+=str.substring(0,str.indexOf(','))+","; str=str.substring(str.indexOf(',')+1); namesInEachBook[i][j]+=str.substring(0,str.indexOf(',')); str=str.substring(str.indexOf(',')+1); } } } private int countCommas(String s) { int num=0; for(int i=0;i<s.length();i++) if(s.charAt(i)==',') num++; return num; } private void search(String searchElem,int ernosDepth,ArrayList searchedElem) { ArrayList searchSpace=new ArrayList(); searchedElem.add(searchElem); for(int i=0;i<namesInEachBook.length;i++) for(int j=0;j<namesInEachBook[i].length;j++) { if(namesInEachBook[i][j].equals(searchElem)) //Add all authors name in this group { for(int k=0;k<namesInEachBook[i].length;k++) { if(namesInEachBook[i][k].equals("Erdos, P.")) //Found { solnfound=true; System.out.println(searchItem+" "+ernosDepth); return; } else if(searchedElem.contains(namesInEachBook[i][k]) || searchSpace.contains(namesInEachBook[i][k])) continue; searchSpace.add(namesInEachBook[i][k]); } break; } } Iterator i=searchSpace.iterator(); while(i.hasNext()) { String cSearchElem=(String)i.next(); search(cSearchElem,ernosDepth+1,searchedElem); } } }

    Read the article

  • Help with concept - filters and number of items

    - by dreamer
    Please check http://www.alibaba.com/catalogs/cid/702/Laptops.html they have nice filter here with number of items for each. Note one detail - they have locations here. Same thing on olx.com - location and number of items for each category. Now imagine I have tables: [products] (Id, Name, CategoryId, LocationId) [Categories] (Id,Name) [Location] (Id, Name) My question how can I do the same, cause count things even with caching looks expensive? And they give results pretty fast... Please advice with possible ways to do that in ASP.NET, C#, MVC, MS SQL, but avoice simple answers like "count and change" Thank you in advance.

    Read the article

  • Excel plugin: Finding a Chart's Source Data Number Format String

    - by Jack
    I'm currently working on a plugin for excel (using VB.net--not VBA) that will attempt (among other things) to recognize the format of the source data of a chart and configure the chart's series' number format strings appropriately. That is, yearly data should always be two numbers, monthly data should always be a 3-letter month followed by a 2-digit year, etc. The goal is to have a uniform representation across all charts for monthly data, annual data, daily data, etc. My question is this: how do I find the number format string for the cells (or any cell that is part of that series, as I will be assuming all cells that make up a particular series have the same format) that represent the source data for the chart? Note: I can assume that the chart will always point to a range of cells (not, for example, an array of data).

    Read the article

  • Given a number N, find the number of ways to write it as a sum of two or more consecutive integers

    - by hilal
    Here is the problem (Given a number N, find the number of ways to write it as a sum of two or more consecutive integers) and example 15 = 7+8, 1+2+3+4+5, 4+5+6 I solved with math like that : a + (a + 1) + (a + 2) + (a + 3) + ... + (a + k) = N (k + 1)*a + (1 + 2 + 3 + ... + k) = N (k + 1)a + k(k+1)/2 = N (k + 1)*(2*a + k)/2 = N Then check that if N divisible by (k+1) and (2*a+k) then I can find answer in O(N) time Here is my question how can you solve this by dynamic-programming ? and what is the complexity (O) ? P.S : excuse me, if it is a duplicate question. I searched but I can find

    Read the article

  • iPhone UIImage number recognition

    - by Skeep
    Hi All, I have a small UIImage (jpg) with a single typed number. I want to be able to read the number with some kind of pattern recognition. I'm really not sure where to start, so any help would be appreciated. my initial idea was to compare this image with other images. For instance compare the image with that of a 1,2,3, etc until a match was found. That just seems slow and cumbersome and wondered if there was a better way to do it? Thanks

    Read the article

  • Find maximum number of logged on users in SQL

    - by lleto
    Hi, I want to keep tabs on the number of concurrent users of my application. I therefore log a time_start and a time_stop. If I now want to query the database for the maximum number of logged on users and return the start date, how would I do that. The table looks like this: id | time_start | time_stop ----+---------------------+--------------------- 1 | 2010-03-07 05:40:59 | 2010-03-07 05:41:33 2 | 2010-03-07 06:50:51 | 2010-03-07 10:50:51 3 | 2010-02-21 05:20:00 | 2010-03-07 12:23:44 4 | 2010-02-19 08:21:12 | 2010-03-07 12:37:28 5 | 2010-02-13 05:52:13 | Where time_stop is empty the user is still logged on. In this case I would expect to see 2010-03-07 returned, since all users (5) were logged on at that moment. However if I would run the query with 'where time_start BETWEEN '2010-02-17' AND '2010-02-23' I would expect to see 2010-02-21 with a maximum of 2. Is this possible direct in SQL (using postgres) or do I need to parse the results in PHP? Thanks, lleto

    Read the article

  • Validate decimal number in (known) national format

    - by Álvaro G. Vicario
    PHP has many built-in functions to validate numbers but they all expect input in computer format: 1234.56. I need to validate stuff like 1,234.56 (English) or 1.234,56 (Spanish), together with some typical attributes (accepted range, max number of decimals, etc.). I started writing my own function but I soon got lost. It's easy to read the user input into a float variable but I want to be able to detect numbers with invalid formats like 1,23456.7 or 1..25. Do you have any recommendation on the subject? (Decimal and thousand characters are known beforehand and it's okay to hard-code digit groups as three, there's no need to cover Indian number format.)

    Read the article

  • Why is the code adding 7 if the number is not >= 0

    - by Hugo Dozois
    I've got this program in MIPS assembly which comes from a C code that does the simple average of the eigth arguments of the function. average8: addu $4,$4,$5 addu $4,$4,$6 addu $4,$4,$7 lw $2,16($sp) #nop addu $4,$4,$2 lw $2,20($sp) #nop addu $4,$4,$2 lw $2,24($sp) #nop addu $4,$4,$2 lw $2,28($sp) #nop addu $2,$4,$2 bgez $2,$L2 addu $2,$2,7 $L2: sra $2,$2,3 j $31 When the number is positve, we directly divided by 8 (shift by 3 bits), but when the number is negative, we first addu 7 then do the division. My question is why do we add 7 to $2 when $2 is not >= 0 ? EDIT : Here is the C code : int average8(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8) { return (x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8) / 8; } note : the possible loss in the division since we are using ints instead of floats or doubles is not important in this case.

    Read the article

  • How to use SQL trigger to record the affected column's row number

    - by Freeman
    I want to have an 'updateinfo' table in order to record every update/insert/delete operations on another table. In oracle I've written this: CREATE TABLE updateinfo ( rnumber NUMBER(10), tablename VARCHAR2(100 BYTE), action VARCHAR2(100 BYTE), UPDATE_DATE date ) DROP TRIGGER TRI_TABLE; CREATE OR REPLACE TRIGGER TRI_TABLE AFTER DELETE OR INSERT OR UPDATE ON demo REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW BEGIN if inserting then insert into updateinfo(rnumber,tablename,action,update_date ) values(rownum,'demo', 'insert',sysdate); elsif updating then insert into updateinfo(rnumber,tablename,action,update_date ) values(rownum,'demo', 'update',sysdate); elsif deleting then insert into updateinfo(rnumber,tablename,action,update_date ) values(rownum,'demo', 'delete',sysdate); end if; -- EXCEPTION -- WHEN OTHERS THEN -- Consider logging the error and then re-raise -- RAISE; END TRI_TABLE; but when checking updateinfo, all rnumber column is zero. is there anyway to retrieve the correct row number?

    Read the article

< Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >