Search Results

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

Page 69/1194 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Linq Return node level of hierarchical xml

    - by Ryan
    In a treeview you can retrieve the level of an item. I am trying to accomplish the same thing with the given input being an object. The XML data I will use for this example would be something like the following <?xml version="1.0" encoding="utf-8" ?> <Testing> <Numbers> <Number val="1"> <Number val="1.1"> <Number val="1.1.1"> <Number val="1.1.2" /> <Number val="1.1.3" /> <Number val="1.1.4" /> </Number> </Number> <Number val="1.2" /> <Number val="1.3" /> <Number val="1.4" /> </Number> <Number val="2" /> <Number val="3" /> <Number val="4" /> </Numbers> <Numbers> <Number val="5" /> <Number val="6" /> <Number val="7" /> <Number val="8" /> </Numbers> </Testing> This one is kicking my butt!

    Read the article

  • Return node level of hierarchical xml

    - by Ryan
    In a treeview you can retrieve the level of an item. I am trying to accomplish the same thing with the given input being an object. The XML data I will use for this example would be something like the following <?xml version="1.0" encoding="utf-8" ?> <Testing> <Numbers> <Number val="1"> <Number val="1.1"> <Number val="1.1.1"> <Number val="1.1.2" /> <Number val="1.1.3" /> <Number val="1.1.4" /> </Number> </Number> <Number val="1.2" /> <Number val="1.3" /> <Number val="1.4" /> </Number> <Number val="2" /> <Number val="3" /> <Number val="4" /> </Numbers> <Numbers> <Number val="5" /> <Number val="6" /> <Number val="7" /> <Number val="8" /> </Numbers> </Testing> This one is kicking my butt!

    Read the article

  • Finding an odd perfect number

    - by Coin Bird
    I wrote these two methods to determine if a number is perfect. My prof wants me to combine them to find out if there is an odd perfect number. I know there isn't one(that is known), but I need to actually write the code to prove that. The issue is with my main method. I tested the two test methods. I tried debugging and it gets stuck on the number 5, though I can't figure out why. Here is my code: public class Lab6 { public static void main (String[]args) { int testNum = 3; while (testNum != sum_of_divisors(testNum) && testNum%2 != 0) testNum++; } public static int sum_of_divisors(int numDiv) { int count = 1; int totalDivisors = 0; while (count < numDiv) if (numDiv%count == 0) { totalDivisors = totalDivisors + count; count++; } else count++; return totalDivisors; } public static boolean is_perfect(int numPerfect) { int count = 1; int totalPerfect = 0; while (totalPerfect < numPerfect) { totalPerfect = totalPerfect + count; count++; } if (numPerfect == totalPerfect) return true; else return false; } }

    Read the article

  • Biztalk Schema generator in Visual Studio -- How to enable 'Well-Formed XML' ? [migrated]

    - by user28747
    I have installed Visual Studio 2010 and Biztalk. I create a new Biztalk-project in Visual STudio 2010. I choose 'Add new item' and then 'New generated schema'. Here I can choose 'Document type'. I choose 'Well-Formed XML (Not loaded)' and choose an input file. Now I get the message 'XFW to XSD schema generation module is not installed. Execute 'C:\Program files (X86)\Microsoft Biztalk Server 2010\SDK\Utilities\Schema Generator\InstallWFX.vbs to install the WFX to XSD schema generation module. I try to execute that file and some text hastily appear on the console. I restart Visual Studio 2010, but it still doesn't work. Apparently the execution of the shell script didn't work. I try to restart the computer, but it still doesn't work. Could anyone tell me what to do?

    Read the article

  • Identifying the version of ATI Catalyst drivers

    - by Snark
    I have bought a new video card based on the ATI Radeon HD 5670 chipset. I couldn't make it work with the latest ATI Catalyst drivers found on their website, only the drivers found on the CD delivered with the card worked. How can I know the version of Catalyst that is installed on my PC (running Windows 7 64-bits)? The ATI Catalyst Control Center returns the following information: Driver Packaging Version 8.673-091110a-092263C Provider ATI Technologies Inc. 2D Driver Version 8.01.01.973 2D Driver File Path /REGISTRY/MACHINE/SYSTEM/ControlSet001/Control/CLASS/{4D36E968-E325-11CE-BFC1-08002BE10318}/0000 Direct3D Version 8.14.10.0708 OpenGL Version 6.14.10.9120 Catalyst™ Control Center Version 2009.1110.2225.40230 I do not recognize anything pointing to a "marketing version". The website says the current version of Catalyst is 10.2.

    Read the article

  • how to make a javascript number keypad popup

    - by user2434653
    i have a website with 3 pages. each page has a form with two input fields. i am trying to make a popup number-keypad that will populate what ever input field called it. below is that base code i keep coming back to. <html> <head><title>test</title></head> <body> <script> function num(id) { return document.getElementById(id); } </script> <form action="/unitPage" method="POST" style=" text-align:center;"> Prefix: <input id="num" name"prefix" type="text" onfocus="num('keypad').style.display='inline-block';"/> Number: <input id="num" name"number" type="text" pattern="[0-9]{6}" onfocus="num('keypad').style.display='inline-block';"/> </form> <div id="keypad" style="display:none; background:#AAA; vertical-align:top;"> <input type="button" value="7" onclick="num('num').value+=7;"/> <input type="button" value="8" onclick="num('num').value+=8;"/> <input type="button" value="9" onclick="num('num').value+=9;"/><br/> <input type="button" value="4" onclick="num('num').value+=4;"/> <input type="button" value="5" onclick="num('num').value+=5;"/> <input type="button" value="6" onclick="num('num').value+=6;"/><br/> <input type="button" value="1" onclick="num('num').value+=1;"/> <input type="button" value="2" onclick="num('num').value+=2;"/> <input type="button" value="3" onclick="num('num').value+=3;"/><br/> <input type="button" value="X" onclick="num('keypad').style.display='none'"/> <input type="button" value="0" onclick="num('num').value+=0;"/> <input type="button" value="&larr;" onclick="num('num').value=num('num').value.substr(0,num('num').value.length-1);"/> </div> </body> </html> is there a way of making one number key pad that i call from any page or do i need to make the above for each input? thanks

    Read the article

  • Reversing a number in c++

    - by Marcel Bujnowski
    I created a program to show the sum and show the reversed number a person has typed. The sum function works but the revers function is not. Can anyone give me any tips on how to fix it. I created a program to show the sum and show the reversed number a person has typed. The sum function works but the revers function is not. Can anyone give me any tips on how to fix it. #include<iostream> #include<iomanip> using namespace std; void printSum(int n, bool reverse); int sm(int n); int reverseInt(int n); void printAddTable(int n); int main() { int reverse; int sum=0; int n; cout<<"Enter N value:"<<endl; cin>>n; if(n>0) { reverse = true; printSum( n, reverse); // calls the printSum Method } else { //cout<<"enter positive Number only:"<<endl; } sum = sm(n); //err // calls the sum Method reverse = reverseInt(n); // calls the reverseInt Method cout<<"The reverse value is:"<<reverse; printAddTable(n); // calls the printAddTable Method //getch() } //end of main() void printSum(int n, bool reverse) { int sum=0; // print sum of reverse numbers for(int i=n; i>=1; i--) { sum=sum+i; cout<<i<< " "<<"+"<<" "; } cout<<sum; } int sm(int n) {int sum =0; for(int i=1; i<=n; i++) { sum = sum + i ; cout << endl; cout<<i<<" "<<"+"<<" "<<endl; // print n positive integers cout << endl; } cout<< "Are " <<n<< " positive integers"<<endl; cout<< "Sum is "<<sum <<endl; return sum; } int reverseInt(int n) { int reminder=0; int sum =0; while(n<=0) { reminder = n/10; sum = (sum * 10) + reminder; // it returns the reverse number n = n % 10; } return sum; } void printAddTable(int n) { for(int i=1; i<=n; i++) { cout<<i<<endl; for(int j=1; j<=n; j++) // print n X n add table { cout<<i+j<<endl; } } } {

    Read the article

  • weighted RNG speed problem in C++

    - by supert
    I have a (fast) bit of C++ code that samples cards from a 52 card deck: void sample_allcards(int table[5], int holes[], int players) { int temp[5 + 2 * players]; bool try_again; int c, n, i; for (i = 0; i < 5 + 2 * players; i++) { try_again = true; while (try_again == true) { try_again = false; c = fast_rand52(); // reject collisions for (n = 0; n < i + 1; n++) { try_again = (temp[n] == c) || try_again; } temp[i] = c; } } copy_cards(table, temp, 5); copy_cards(holes, temp + 5, 2 * players); } I am implementing code to sample the hole cards according to a known distribution (stored as a 2d table). My code for this looks like: void sample_allcards_weighted(double weights[][HOLE_CARDS], int table[5], int holes[], int players) { // weights are distribution over hole cards int temp[5 + 2 * players]; int n, i; // table cards for (i = 0; i < 5; i++) { bool try_again = true; while (try_again == true) { try_again = false; int c = fast_rand52(); // reject collisions for (n = 0; n < i + 1; n++) { try_again = (temp[n] == c) || try_again; } temp[i] = c; } } for (int player = 0; player < players; player++) { // hole cards according to distribution i = 5 + 2 * player; bool try_again = true; while (try_again == true) { try_again = false; // weighted-sample c1 and c2 at once double w[1326]; memcpy(w, weights[player], sizeof(w)); // h is a number < 1325 int h = weighted_randi(w, HOLE_CARDS); // i2h uses h and sets temp[i] to the 2 cards implied by h i2h(&temp[i], h); // reject collisions for (n = 0; n < i; n++) { try_again = (temp[n] == temp[i]) || (temp[n] == temp[i+1]) || try_again; } } } copy_cards(table, temp, 5); copy_cards(holes, temp + 5, 2 * players); } My problem? The weighted sampling algorithm is a factor of 10 slower. Speed is very important for my application. Is there a way to improve the speed of my algorithm to something more reasonable? Am I doing something wrong in my implementation? Thanks.

    Read the article

  • Can first descendent be selected directly?

    - by Ben Huh
    I am currently using find() and first() method to select the first descendent element from each of the <div> elements that contains the parent class. But I find this quite cumbersome since find() method would produce a set of matched elements before the first element is being picked. The following is the skeleton of my code: HTML <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=non-parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> // .....the list continues Javascript $('.parent').each(function() { $(this).find('ul li').first().css('color', 'red'); // do other stuff within each loop }); I have seen people using $(".parent li:first") selector. But, because I am doing it in a loop, I am not sure how or whether if this could be done and would like some advice. Thanks.

    Read the article

  • How to know the number of pins on my laptop's ram?

    - by Rajat Saxena
    I am thinking about upgrading my laptop's ram.How can I get to know the number of pins on my ram without opening my laptop? I ran this command sudo dmidecode --type memory and got following info: Handle 0x0019, DMI type 17, 27 bytes Memory Device Array Handle: 0x0017 Error Information Handle: 0x001A Total Width: 64 bits Data Width: 64 bits Size: 1024 MB Form Factor: SODIMM Set: None Locator: DIMM0 Bank Locator: BANK 0 Type: DDR2 Type Detail: Synchronous Speed: 667 MHz Manufacturer: AD00000000000000 Serial Number: 04008104 Asset Tag: Unknown Part Number: 040404040404040404040404040404040404 Can anyone help?

    Read the article

  • SEO: Firefox addon/plugin to see Google results with a position number?

    - by Marco Demaio
    Do you know a Firefox addon that adds postion number to Google/Yahoo results. When I do SEO report for www.some-site.com by keyphrase "some-keyphrase" I usually show results in blocks of 100 results per page. Then uisng browser find box I search for "some-site.com", if found in page I see its position, but I have to count by hand the number of results before (or after) it to know the exact position number. It would be handful a simple addon that adds a number positioning before each result like: 1. Result blah blah Snippet... url 2. Result blah blah Snippet... url etc.

    Read the article

  • Analytics - Total events divided by number of unique pages?

    - by GeekyAndUnique
    I am using Google Analytics events to track keywords on my articles - not necessarily the best system I know but there are too many for variables I can't easily change it right now - and I would like to be able to see how popular each keyword is by dividing the number of page views with a keyword by the number of unique pages. Is there a/what is the best way of doing this? EDIT FOR CLARITY I currently have a system set up where every time somebody loads an article an event is fired for each of the tags/keywords used, with the keyword being the label. I can currently view my view count for each of the keywords by looking at the total events for each label, however I would like to be able to see which keywords are the most popular by dividing the number of times the event has been fired by the the number of different pages it has been fired from.

    Read the article

  • A python code to convert a number from any base to the base of 10 giving errors . What is wrong with this code?

    - by mekasperasky
    import math def baseencode(number, base): ##Converting a number of any base to base10 if number == 0: return '0' for i in range(0,len(number)): if number[i]!= [A-Z]: num = num + number[i]*pow(i,base) else : num = num + (9 + ord(number[i])) *pow(i,base) return num a = baseencode('20',5) print a Errors I get are Traceback (most recent call last): File "doubtrob.py", line 19, in <module> a = baseencode('20',5) File "doubtrob.py", line 13, in baseencode if number[i]!= [A-Z]: NameError: global name 'A' is not defined

    Read the article

  • Python: divisors of a number [closed]

    - by kame
    Possible Duplicate: What is the best way to get all the divisors of a number? The most part of this code was written by an other programmer, but I cant run his code. Please show me where the mistake is. I was searching a long time. I get the error 'NoneType' object is not iterable (in divisorGen(n)). from __future__ import division #calculate the divisors #this is fast-working-code from: #http://stackoverflow.com/questions/171765/what-is-the-best-way-to-get-all-the-divisors-of-a-number def factorGenerator(n): for x in range(1,n): n = n * 1.0 r = n / x if r % 1 == 0: yield x # edited def divisorGen(n): factors = list(factorGenerator(n)) nfactors = len(factors) f = [0] * nfactors while True: yield reduce(lambda x, y: x*y, [factors[x][0]**f[x] for x in range(nfactors)], 1) i = 0 while True: f[i] += 1 if f[i] <= factors[i][1]: break f[i] = 0 i += 1 if i >= nfactors: return for n in range(100): for i in divisorGen(n): print i

    Read the article

  • Boost Regex unknown number of var

    - by Katrin Thielmann
    I got a Problem with a regex expression and need help. I have some expressions like these in mein .txt File: 19 = NAND (1, 19) regex expression : http://rubular.com/r/U8rO09bvTO With this regex expression i got seperated matches for the numbers. But now I need a regex expression with a unknown size of numbers in the bracket . For example: 19 = NAND (1, 23, 13, 24) match1: 19 match2: 1 match3: 23 match4: 13 match5: 24 I don't know the number of the numbers. So i need a main expression for min 2 numbers in the bracket till a unknow number. I hope somebody can help me.

    Read the article

  • Show number of results in each "filter item"

    - by Roberto
    Hi ! How can i get the number of each filter item in a seach? Example... im doing a job/resumes portal... i seach a job title and i have some filters items like City, State , area and etc... How can i show the number of each filter in the select box example Contry: Brazil(22 results), USA(61 results) Here a url with a sample: http://www.manager.com.br/resumes/resumes_result.php?&search_table=resumes&tipo_local=0&keyword=program& Tkz Roberto

    Read the article

  • 2D colliding n-body simulation (fast Collision Detection for large number of balls)

    - by osgx
    Hello I want to write a program for simulating a motion of high number (N = 1000 - 10^5 and more) of bodies (circles) on 2D plane. All bodies have equal size and the only force between them is elastic collision. I want to get something like but in larger scale, with more balls and more dense filling of the plane (not a gas model as here, but smth like boiling water model). So I want a fast method of detection that ball number i does have any other ball on its path within 2*radius+V*delta_t distance. I don't want to do a full search of collision with N balls for each of i ball. (This search will be N^2.) PS Sorry for loop-animated GIF. Just press Esc to stop it. (Will not work in Chrome).

    Read the article

  • fastest calculation of largest prime factor of 512 bit number in python

    - by miraclesoul
    dear all, i am simulating my crypto scheme in python, i am a new user to it. p = 512 bit number and i need to calculate largest prime factor for it, i am looking for two things: Fastest code to process this large prime factorization Code that can take 512 bit of number as input and can handle it. I have seen different implementations in other languages, my whole code is in python and this is last point where i am stuck. So let me know if there is any implementation in python. Kindly explain in simple as i am new user to python sorry for bad english.

    Read the article

  • Customizing Number of Page Links Rendered With will_paginate?

    - by Moe
    I'm using the will_paginate gem for my Rails project and it's working beautifully. Unfortunately, on paginated result sets with a larger number of pages, the link section is too wide. Instead of: « Previous 1 2 … 5 6 7 8 9 10 11 12 13 … 18 19 Next » I would like to show: « Previous 1 2 … 5 6 7 8 9 … 18 19 Next » How can I reduce the number of page links being rendered? I looked at the will_paginate docs on github but couldn't find a solution. Thanks! Moe

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >