Search Results

Search found 3 results on 1 pages for 'metju'.

Page 1/1 | 1 

  • Regex: Comma delimited integers

    - by Metju
    Hi Guys, I'm trying to create a regex that accept: An empty string, a single integer or multiple integers separated by a comma but can have no starting and ending comma. I managed to find this, but I cannot undertsand how to remove the digit limit ^\d{1,10}([,]\d{10})*$

    Read the article

  • Calling jquery function from ascx not working

    - by Metju
    Hi Guys, I'm having a problem with the following situation. I have an ascx which contains a submit button for a search criteria and I am trying to call a validation function in a js file I've used throughout the site (this is the first time I'm using it in an ascx). Now I've just tried this: <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript" src="js/jsAdmin_Generic_SystemValidation.js"></script> <script type="text/javascript"> $(document).ready(function () { $(".submitBtn").click(function (e) { alert("test"); alert($.Validate()); alert("test 2"); }); }); </script> The file is being referenced correctly as I am already seeing posts in Firebug that are done by it. This is the function: jQuery.extend({ Validate: function () { does validation... }); Now at first I was getting "Validate() is not a function" in firebug. Since I did that alert testing, I am getting the first alert, then nothing with no errors. Can anyone shed some light? Thanks

    Read the article

  • Nested loops break out unexpectedly

    - by Metju
    Hi guys, I'm trying to create a sudoku game, for those that do not know what it is. You have a 9x9 box that needs to be filled with numbers from 1-9, every number must be unique in its row and column, and also in the 3x3 box it is found. I ended up doing loads of looping within a 2 dimensional array. But at some point it just stops, with no exceptions whatsoever, just breaks out and nothing happens, and it's not always at the same position, but always goes past half way. I was expecting a stack overflow exception at least. Here's my code: public class Engine { public int[,] Create() { int[,] outer = new int[9, 9]; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { outer[i, j] = GetRandom(GetUsed(outer, i, j)); } } return outer; } List<int> GetUsed(int[,] arr, int x, int y) { List<int> usedNums = new List<int>(); for (int i = 0; i < 9; i++) { if (arr[x, i] != 0 && i != y) { if(!usedNums.Contains(arr[x, i])) usedNums.Add(arr[x, i]); } } for (int i = 0; i < 9; i++) { if (arr[i, y] != 0 && i != x) { if (!usedNums.Contains(arr[i, y])) usedNums.Add(arr[i, y]); } } int x2 = 9 - (x + 1); int y2 = 9 - (y + 1); if (x2 <= 3) x2 = 2; else if (x2 > 3 && x2 <= 6) x2 = 5; else x2 = 8; if (y2 <= 3) y2 = 2; else if (y2 > 3 && y2 <= 6) y2 = 5; else y2 = 8; for (int i = x2 - 2; i < x2; i++) { for (int j = y2 - 2; j < y2; j++) { if (arr[i, j] != 0 && i != x && j != y) { if (!usedNums.Contains(arr[i, j])) usedNums.Add(arr[i, j]); } } } return usedNums; } int GetRandom(List<int> numbers) { Random r; int newNum; do { r = new Random(); newNum = r.Next(1, 10); } while (numbers.Contains(newNum)); return newNum; } }

    Read the article

1