Search Results

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

Page 81/1194 | < Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >

  • A specific Phone Number RegEX

    - by Hellnar
    Greetings, I need to implement a jquery based validation for a text field that contains a phone number, for that I need the regular expression of these two strings, I am requesting this because I am very naive with RegEx: First One: 0(5NN) NNN NN NN Second One: 0(53N) NNN NN NN N means an integer between 0-9

    Read the article

  • Can I Number a GroupTemplate or ItemTemplate?

    - by Atomiton
    I would like to use a GroupTemplate to separate a list of items into groups. However, I need each Group to be numbered sequentially so I can link to them and implement some JS paging. I'm binding to an IEnumerable Here's some pseudo code. I would like the output to look like this: <a href="#group1">Go to Group 1<a> <a href="#group2">Go to Group 2<a> <a href="#group3">Go to Group 3<a> <ul id="group1"> <li>Item</li> <li>Item</li> <li>Item</li> </ul> <ul id="group2"> <li>Item</li> <li>Item</li> <li>Item</li> </ul> <ul id="group3"> <li>Item</li> <li>Item</li> <li>Item</li> </ul> Is this easy to do in a ListView, using GroupTemplate and ItemTemplate? <asp:ListView ID="lv" runat="server" GroupPlaceholderID="groupPlaceholder"> <LayoutTemplate> <asp:PlaceHolder ID="groupPlaceholder" runat="server"></asp:PlaceHolder> </LayoutTemplate> <GroupTemplate> <ul id="<!-- group-n goes here -->"> <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder> </ul> </GroupTemplate> <ItemTemplate> <li>Item</li> </ItemTemplate> </asp:ListView> I can get the number of groups to do the links at the top from the Datasource and basic math, but how do I get id="groupN" number into the template?

    Read the article

  • Miller-rabin exception number?

    - by nightcracker
    Hey everyone. This question is about the number 169716931325235658326303. According to http://www.alpertron.com.ar/ECM.HTM it is prime. According to my miller-rabin implementation in python with 7 repetitions is is composite. With 50 repetitions it is still composite. With 5000 repetitions it is STILL composite. I thought, this might be a problem of my implementation. So I tried GNU MP bignum library, which has a miller-rabin primality test built-in. I tested with 1000000 repetitions. Still composite. This is my implementation of the miller-rabin primality test: def isprime(n, precision=7): if n == 1 or n % 2 == 0: return False elif n < 1: raise ValueError("Out of bounds, first argument must be > 0") d = n - 1 s = 0 while d % 2 == 0: d //= 2 s += 1 for repeat in range(precision): a = random.randrange(2, n - 2) x = pow(a, d, n) if x == 1 or x == n - 1: continue for r in range(s - 1): x = pow(x, 2, n) if x == 1: return False if x == n - 1: break else: return False return True And the code for the GMP test: #include <gmp.h> #include <stdio.h> int main(int argc, char* argv[]) { mpz_t test; mpz_init_set_str(test, "169716931325235658326303", 10); printf("%d\n", mpz_probab_prime_p(test, 1000000)); mpz_clear(test); return 0; } As far as I know there are no "exceptions" (which return false positives for any amount of repetitions) to the miller-rabin primality test. Have I stumpled upon one? Is my computer broken? Is the Elliptic Curve Method wrong? What is happening here? EDIT I found the issue, which is http://www.alpertron.com.ar/ECM.HTM. I trusted this applet, I'll contact the author his applet's implementation of the ECM is faulty for this number. Thanks. EDIT2 Hah, the shame! In the end it was something that went wrong with copy/pasting on my side. NOR the applet NOR the miller-rabin algorithm NOR my implementation NOR gmp's implementation of it is wrong, the only thing that's wrong is me. I'm sorry.

    Read the article

  • Limit on number of kernel arguments in OpenCL

    - by Rakesh K
    Hi, I wanted to know if there is any limit on the number of arguments that are set to kernel function in OpenCL. I am getting the error as INVALID_ARG_INDEX while setting arguments. I am setting 9 arguments in the kernel function. Please help me in this regard. Thanks, Rakesh.

    Read the article

  • java.sql.SQLException: Parameter number X is not an OUT parameter

    - by Frederik
    Hi guys, I'm struggling with getting the result OUT variable from a MySQL stored procedure. I get the following error: java.sql.SQLException: Parameter number 3 is not an OUT parameter The stored procedure looks like this: CREATE DEFINER=`cv_admin`@`localhost` PROCEDURE `CheckGameEligibility`( IN gID INT(10), IN uID INT(10), OUT result TINYINT(1) ) BEGIN # Do lots of stuff, then eventually: SET result = 1; END My java function takes an array of strings* and creates the CallableStatement object dynamically: public static int callAndReturnResult( String sql , String[] values ) { int out = 0 ; try { // construct the SQL. Creates: CheckGameEligibility(?, ?, ?) sql += "(" ; for( int i = 0 ; i < values.length ; i++ ) { sql += "?, " ; } sql += "?)" ; System.out.println( "callAndReturnResult("+sql+"): constructed SQL: " + sql ); // Then the statement CallableStatement cstmt = DB.prepareCall( sql ); for( int i = 0 ; i < values.length ; i++ ) { System.out.println( " " + (i+1) + ": " + values[ i ] ) ; cstmt.setString(i+1, values[ i ] ); } System.out.println( " " + (values.length+1) + ": ? (OUT)" ) ; cstmt.registerOutParameter( values.length + 1 , Types.TINYINT ); cstmt.execute(); out = cstmt.getInt( values.length ); cstmt.close(); } catch( Exception e ) { System.out.println( "*** db trouble: callAndReturnResult(" + sql + " failed: " + e ); e.printStackTrace() ; } return out ; } *) I suppose I should be using an int array instead of a string array, but it doesn't seem to be what the error message was about. Anyway, here's the output it generates: callAndReturnResult(CheckGameEligibility(?, ?, ?)): constructed SQL: CheckGameEligibility(?, ?, ?) 1: 57 2: 29 3: ? (OUT) *** db trouble: callAndReturnResult(CheckGameEligibility(?, ?, ?) failed: java.sql.SQLException: Parameter number 3 is not an OUT parameter at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929) at com.mysql.jdbc.CallableStatement.checkIsOutputParam(CallableStatement.java:692) at com.mysql.jdbc.CallableStatement.registerOutParameter(CallableStatement.java:1847) at org.apache.commons.dbcp.DelegatingCallableStatement.registerOutParameter(DelegatingCallabl>eStatement.java:92) at Tools.callAndReturnResult(Tools.java:156) Any ideas what might be the problem? :) Thanks in advance!

    Read the article

  • Flash AS3 - XMLList - List items with number of times they occur

    - by Dale
    I have an XMLList 'Keywords', which consists of about 30 XML items. I want to count the number of unique keywords in the List, and how often they occur. Then display the top 3 most occuring keywords. There's probably a simple sorting/count function to carry this out, however, i'm quite new to as3 so please forgive my naivety. Cheers.

    Read the article

  • WPF/C#: Enable/Disable buttons depending on the number of clicks

    - by eibhrum
    Hi, I do have two buttons 'btnPrev' and 'btnNext' What I want to do is to be able to determine the number of clicks of the button so that I could enable and disable them. The process is almost similar to 'paging' method. Initial state: btnPrev - disabled, btnNext - enabled 1st Click (btnNext): btnPrev - enabled, btnNext - enabled 2nd Click (btnNext): btnPrev - enabled, btnNext - enabled 3rd Click (btnNext): btnPrev - enabled, btnNext - disabled the idea is almost the same vice-versa (for btnPrev) any suggestions how to do it?

    Read the article

  • jquery Infinite Scroll page number

    - by Renan Vieira
    I'm using a jQuery plugin called InfiniteScroll (https://github.com/paulirish/infinite-scroll) and I have a URL with this pattern: '/category/2/', when I paged the result I use the following pattern: "/category/2?page=2". When Infinite Scroll makes de request, he increments the wrong number, in the case above, the request is: "/category/3?page=2" in place of "/category/2?page=3". Anyone knows how workaround this?

    Read the article

  • die $template->error() produces no line number

    - by Kinopiko
    In the following short program: use Template; my $template = Template->new (INCLUDE_PATH => "."); $template->process ("non-existent-file") or die $template->error (); why does "die" not produce a line number and newline? Output looks like this: $ perl template.pl file error - non-existent-file: not found ~ 503 $

    Read the article

  • Maximum number of concurrent users connected to SQL Server 2008

    - by worlds-apart89
    Is there a limit to the maximum number of concurrent users connected to SQL Server 2008? I am guessing computer resources determine that limit (if it exists), but I am also wondering if there is a theoretical limit. I have tried googling the answer, but all the information I have found is based upon earlier versions of SQL Server. If there is a limit, does it apply to just a database or a SQL Server instance?

    Read the article

  • How to decode JSON (varying number of elements, varying keys) using Jquery

    - by Obay
    My JSON looks like this: { "[email protected]":"Person1", "[email protected]":"Person65", "[email protected]":"Person24" } It's returned in various number of elements, and various keys. How do I traverse the data if my code is like this: $.post("includes/ajax.php", { group_id : $('#group').val() }, function(data) { //how do i traverse data here? }, "json"); Any help will be appreciated :) Thanks!

    Read the article

  • Counting the number of visitors for a web page - JavaScript and Struts

    - by Dj
    Hi i am Dhananjay, I need to keep track of the number of visitors to a web page. I have planned like this: on load of the home page, I will call a javascript callCounter(); From javascript, I need then to call an action and update a record in database. Please help me with this. How do i call the action? I should be in the same home jsp after updating database. Thanks in advance, Dhananjay

    Read the article

  • Enable/Disable WPF buttons depending on the number of clicks

    - by eibhrum
    I have two buttons 'btnPrev' and 'btnNext' What I want to do is to be able to determine the number of clicks of the button so that I could enable and disable them. The process is almost similar to 'paging' method. Initial state: btnPrev - disabled, btnNext - enabled 1st Click (btnNext): btnPrev - enabled, btnNext - enabled 2nd Click (btnNext): btnPrev - enabled, btnNext - enabled 3rd Click (btnNext): btnPrev - enabled, btnNext - disabled the idea is almost the same vice-versa (for btnPrev).

    Read the article

  • Count number of arguments to Excel formula in VBA

    - by Abiel
    I need to use VBA to determine the number of arguments passed to an Excel formula. For instance, suppose a cell contains the formula =MyFunc($A$1, "xyz", SUM(1,2,COUNT(C1:C12)), IF(B12,1,0)). Then the counter function should return 4. Does VBA contain any built-in functions for this, or does someone have an example of a regular expression that could calculate this?

    Read the article

  • Converting a number to a greyscale color in Java

    - by Dave
    Hi, I'm trying to figure out how I can convert a number between 1 and 50 to a greyscale color that could be used here: g.setColor(MyGreyScaleColour); 1 would be lightest (white) and 50 would be darkest (black). e.g. Color intToCol(int colNum) { code here } Any suggestions?

    Read the article

  • Regular expression for a phone number

    - by Zerobu
    Hello, I would like a regular expression in this format. It Must match one of the following formats: * (###)###-#### * ###-###-#### * ###.###.#### * ########## Strip all whitespace. Make sure it's a valid phone number, then (if necessary) translate it to the first format listed above.

    Read the article

  • Flash Player - green box with version number

    - by Gavin
    I'm trying to get a very simple Flash video working using SWFembed, and it does work across multiple computers at this point in multiple browsers, but as soon as I pushed it live I got this: http://cl.ly/1EDS I've adjusted file permissions, but it is exactly the same code and files as in another directory on the server. I've seen this a few times (green box with version number), but have not been able to find any reference to it online. Thanks for any suggestions in advance!

    Read the article

< Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >