Search Results

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

Page 78/1194 | < Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >

  • how to ignore ivy revision number?

    - by user315228
    Guys, I have certain jar files without revision number. But as rev is mandatory attribute for ivy dependency, i am providing the revision attribute. But i have something like (-[revision]) in url resolver. but its taking the module number instead of ignoring the revision attribute. I know it wont ignore the revision attribute as its not null. Following is the output that i get default-cache: no cached resolved revision for perltools#perltools;latest.integration [ivy:retrieve] tried [ivy:retrieve] listing all in [ivy:retrieve] using privateRepo to list all in [ivy:retrieve] ApacheURLLister found URL=[httP://myrepo/ivyRepository/perltools/jars/perltools.jar]. [ivy:retrieve] found 1 resources [ivy:retrieve] found revs: [perltools.jar] [ivy:retrieve] HTTP response status: 404 url=httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar [ivy:retrieve] CLIENT ERROR: Not Found url=httP://myrepo/ivyRepository/perltools/jars/perltools.jar/perltools-perltools.jar.jar Can somebody please explain why its taking module.ext as revision where revision i specified is latest.integration and in myrepo, i dont have revision attribute. its just has [http://myrepo/ivyRepository/perltools/jars//perltools.jar] Can somebody please help me so that i can avoid revision attribute?

    Read the article

  • [PERL Tk] printing Line number in Text widget

    - by ungalnanban
    I use the following code for printing the line number in Text widget. my $c=0; my $r=0; $txt = $mw-Text( -background ='white', -width=>400, -height=>300, -selectbackground => 'skyblue', -insertwidth => 5, -borderwidth =>3, -highlightcolor => 'blue', ### after visit -highlightbackground => 'red' , ### default before visit -xscrollcommand => sub { print"CHAT NO :",$c++; }, # Determines the callback used when the Text widget is scrolled horizontally. -yscrollcommand = sub { print"LINR NO:",$r++; }, # Determines the callback used when the Text widget is scrolled vertically. -padx = 5, -pady = 5, )- pack (); the above code is printing the line number and character no is ok. but I used in Scrolled widget that output is not printing. what is the problem in the following code how can I solve this? $txt = $mw-Scrolled('Text', -scrollbars = 'se', -background ='white', -width=>400, -height=>300, -insertwidth => 5, -borderwidth =>3, -highlightcolor => 'blue', ### after visit -highlightbackground => 'red' , ### default before visit -padx => 5, -pady => 5, -xscrollcommand => sub { print"CHAT NO :",$c++; }, # Determines the callback used when the Text widget is scrolled horizontally. -yscrollcommand => sub { print"LINR NO :",$r++; }, # Determines the callback used when the Text widget is scrolled vertically. )->pack();

    Read the article

  • Calculating a date when a date has been chosen by the number of days

    - by Andy
    I have three selection drop downs in a form comprising of day, month, year. Pretty standard. Ive omitted all the individual select options for the purposes of this question. <label for="start_date">Start Date<font class="required">*</font>:</label> <select name="place_booking[day_val]"> <select name="place_booking[month_val]"> <select name="place_booking[year_val]"> Underneath this i have a selection for the number of days the client wishes to stay at the letting. <label for="number_of_days">Number of Days<font class="required">*</font>:</label> <select name="place_booking[number_of_days]"> Underneath there is a space to display the departure date based on there two selections above. <label for="departure_date">Departure Date<font class="required">*</font>:</label> ? - this bit i would like to display the calculated date after the above is selected Any help would be grealty appreciated.

    Read the article

  • Thread-safty of boost RNG

    - by Maciej Piechotka
    I have a loop which should be nicely pararellized by insering one openmp pragma: boost::normal_distribution<double> ddist(0, pow(retention, i - 1)); boost::variate_generator<gen &, BOOST_TYPEOF(ddist)> dgen(rng, ddist); // Diamond const std::uint_fast32_t dno = 1 << i - 1; // #pragma omp parallel for for (std::uint_fast32_t x = 0; x < dno; x++) for (std::uint_fast32_t y = 0; y < dno; y++) { const std::uint_fast32_t diff = size/dno; const std::uint_fast32_t x1 = x*diff, x2 = (x + 1)*diff; const std::uint_fast32_t y1 = y*diff, y2 = (y + 1)*diff; double avg = (arr[x1][y1] + arr[x1][y2] + arr[x2][y1] + arr[x2][y2])/4; arr[(x1 + x2)/2][(y1 + y2)/2] = avg + dgen(); } (unless I make an error each execution does not depend on others at all. Sorry that not all of code is inserted). However my question is - are boost RNG thread-safe? They seems to refer to gcc code for gcc so even if gcc code is thread-safe it may not be the case for other platforms.

    Read the article

  • Perl - how to get the number of elements in a list (not a named array)

    - by NXT
    Hi Everyone, I'm trying to get a block of code down to one line. I need a way to get the number of items in a list. My code currently looks like this: # Include the lib directory several levels up from this directory my @ary = split('/', $Bin); my @ary = @ary[0 .. $#ary-4]; my $res = join '/',@ary; lib->import($res.'/lib'); That's great but I'd like to make that one line, something like this: lib->import( join('/', ((split('/', $Bin)) [0 .. $#ary-4])) ); But of course the syntax $#ary is meaningless in the above line. Is there equivalent way to get the number of elements in an anonymous list? Thanks! PS: The reason for consolidating this is that it will be in the header of a bunch of perl scripts that are ancillary to the main application, and I want this little incantation to be more cut & paste proof.

    Read the article

  • adding an uncertain number of fields using javascript

    - by user306472
    I'm new to javascript and a novice programmer, so this might be a really easy question to answer. I would like to loop over the values of x number of fields and add them up to display the sum in a final field. I can perform this function if I explicitly call each field, but I want to abstract this so I can deal with a flexible number of fields. Here's example code I've come up with (that's not working for me). Where am I going wrong? <html> <head> <script type="text/javascript"> function startAdd(){ interval = setInterval("addfields()",1); } function addfields(){ a = document.addition.total.value; b = getElementByTagName("sum").value; for (i=0; i<=b.length; i++){ a+=i; } return a; } function stopAdd(){ clearInterval(interval); } </script> </head> <body> <form name="addition"> <input type="text" name="sum" onFocus="startAdd();" onBlur="stopAdd;"> + <input type="text" name="sum" onFocus="startAdd();" onBlur="stopAdd;"> = <input type="text" name ="total"> </form> </body> </html>

    Read the article

  • Looking for interesing formula

    - by Thinker
    I'm creating a game, where players can make an alloy. To make it less predictable, and more interesting, I thought that durability and hardness of an alloy can't be calculated by simple formula, because it will be extremely easy to find extrema, where alloy have best statistics. So the questions is, is there any formula for a function, where extrema can be found only by investigating all points? Input values will be in percents: 0.0%-100.0%. I think, it should look like this: half sound wave

    Read the article

  • Using Mergesort to calculate number of inversions in C++

    - by Brown
    void MergeSort(int A[], int n, int B[], int C[]) { if(n > 1) { Copy(A,0,floor(n/2),B,0,floor(n/2)); Copy(A,floor(n/2),n-1,C,0,floor(n/2)-1); MergeSort(B,floor(n/2),B,C); MergeSort(C,floor(n/2),B,C); Merge(A,B,0,floor(n/2),C,0,floor(n/2)-1); } }; void Copy(int A[], int startIndexA, int endIndexA, int B[], int startIndexB, int endIndexB) { while(startIndexA < endIndexA && startIndexB < endIndexB) { B[startIndexB]=A[startIndexA]; startIndexA++; startIndexB++; } }; void Merge(int A[], int B[],int leftp, int rightp, int C[], int leftq, int rightq) //Here each sub array (B and C) have both left and right indices variables (B is an array with p elements and C is an element with q elements) { int i=0; int j=0; int k=0; while(i < rightp && j < rightq) { if(B[i] <=C[j]) { A[k]=B[i]; i++; } else { A[k]=C[j]; j++; inversions+=(rightp-leftp); //when placing an element from the right array, the number of inversions is the number of elements still in the left sub array. } k++; } if(i=rightp) Copy(A,k,rightp+rightq,C,j,rightq); else Copy(A,k,rightp+rightq,B,i,rightp); } I am specifically confused on the effect of the second 'B' and 'C' arguments in the MergeSort calls. I need them in there so I have access to them for Copy and and Merge, but

    Read the article

  • how to fadein LI elements randomly? (jquery)

    - by user366123
    Hi ive got a set of li with hover effect, what i want is when the page loads ALL the li fadein randomly. i don't want to shuffle them.....they should keep their ordering intact meaning 1,2,3,4,5.... just want to make them appear on the page randomly and stay there test page: http://humayunrehman.com/hovertest/

    Read the article

  • Visual Basic Express 2008 Help

    - by khalidfazeli
    I have been given a task to: Develop a program where a child will be presented with picture of a fruit (one of five possible fruit) on the screen at the click of a start button. The child will then try to recognise the fruit and write its name in a specified place on the screen. On the click of a check button the name of the fruit written by the child will be checked by your program and if correct will reward the child with a suitable message. If the name presented by the child is not correct, a suitable message should be presented on a red background with the correct name of the fruit included in the message. so far I have managed to create a form with 5 different fruit pictures and a text box below them. a button at the bottom of the form then checks the results and presents a message box to tell them if they have passed or failed. Private Sub btnResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResults.Click If txtApple.Text = "APPLE" And txtOrange.Text = "ORANGES" And txtStrawberry.Text = "STRAWBERRIES" And txtGrapes.Text = "GRAPES" And txtBanana.Text = "BANANAS" Then MsgBox("Congratulations! you got it all right!", MsgBoxStyle.OkOnly) End Else MsgBox("Incorrect, please try again", MsgBoxStyle.OkOnly) End End If End Sub but I can't get it to randomise the picture of the fruit, so it only displays one fruit at a time and checks against it. Any help is appreciated. Thanks

    Read the article

  • jquery append 'x' number images elements applying 'x' to src and class

    - by Yusaf
    I have a directory with 590 pictures and my issue is being able to pull images using jquery alone from that directory and appending them which i have found out can not be done alone using jquery/javascript. alternatively i have renamed the pictures 1.jpg,2.jpg ... 590.jpg . how using jquery can i append 590 images to a div leaving me with the number of the appended element applied to the src being 'lq'+numberofappended+'.jpg' and class being 'image-'+numberofappended as a result leaving me with the below <div class="imagecontainer"> <img src="lq/1.jpg" class="image-1"/> <img src="lq/2.jpg" class="image-2"/> <img src="lq/3.jpg" class="image-3"/> ... <img src="lq/590.jpg" class="image-590"/> </div> if what I have will be too extensive can i append 50 images at a time and apply a jquery pagination loading another 50 each time i reach the end of the page. I personally know how to use append in jquery but I don't know how to individually append an image and depending on which append number it is applying it to the src and class.

    Read the article

  • Looking for interesting formula

    - by Thinker
    I'm creating a game where players can make an alloy. To make it less predictable and more interesting, I thought that the durability and hardness of an alloy should not be calculated by a simple formula, because it will be extremely easy to find extrema, where alloy have best statistics. So the questions is, is there any formula for a function where extrema can be found only by investigating all points? Input values will be in percents: 0.0%-100.0%. I think it should look like this: half sound wave

    Read the article

  • What good open source programs exist for fuzzing popular image file types?

    - by JohnnySoftware
    I am looking for a free, open source, portable fuzzing tool for popular image file types that is written in either Java, Python, or Jython. Ideally, it would accept specifications for the fuzzable fields using some kind of declarative constraints. Non-procedural grammar for specifying constraints are greatly preferred. Otherwise, might as well write them all in Python or whatever. Just specifying ranges of valid values or expressions for them. Ideally, it would support some kind of generative programming to export the fuzzer into various programming languages to suit cases where more customization was required. If it supported a direct-manipulation GUI for controlling parameter values and ranges, that would be nice too. The file formats that should be supported are: GIF JPEG PNG So basically, it should be sort of a toolkit consisting of ready-to-run utility, a framework or library, and be capable of generating the fuzzed files directly as well as from programs it generates. It needs to be simple so that test images can be created quickly. It should have a batch capability for creating a series of images. Creating just one at a time would be too painful. I do not want a hacking tool, just a QA tool. Basically, I just want to address concerns that it is taking too long to get commonplace image rendering/parsing libraries stable and trustworthy.

    Read the article

  • Formatting numbers in loop

    - by dave9909
    I want to list all numbers from 0000-9999 however I am having trouble holding the zero places. I tried: for(int i = 0; i <= 9999; ++i) { cout << i << "\n"; } but I get: 1,2,3,4..ect How can I make it 0001,0002,0003....0010, etc

    Read the article

  • [Ruby] How can I randomly iterate through a large Range?

    - by void
    I would like to randomly iterate through a range. Each value will be visited only once and all values will eventually be visited. For example: (0..9).sort_by{rand}.map{|x| f(x)} where f(x) is some function that operates on each value. A Fisher-Yates shuffle could be used to increase efficiency, but this code is sufficient for many purposes. My problem is that sort_by will transform the range into an array, which is not cool because I am working with astronomically large numbers. Ruby will quickly consume a large amount of RAM trying to create a monstrous array. This is also why the following code will not work: tried = {} # store previous attempts bigint = 99**99 bigint.times { x = rand(bigint) redo if tried[x] tried[x] = true f(x) # some function } This code is very naive and quickly runs out of memory as tried obtains more entries. What sort of algorithm can accomplish what I am trying to do?

    Read the article

  • convert string to dict using list comprehension in python

    - by Pavel
    I have came across this problem a few times and can't seem to figure out a simple solution. Say I have a string string = "a=0 b=1 c=3" I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obviously I can do this: list = string.split() dic = {} for entry in list: key, val = entry.split('=') dic[key] = int(val) But I don't really like that for loop, It seems so simple that you should be able to convert it to some sort of list comprehension expression. And that works for slightly simpler cases where the val can be a string. dic = dict([entry.split('=') for entry in list]) However, I need to convert val to an int on the fly and doing something like this is syntactically incorrect. dic = dict([[entry[0], int(entry[1])] for entry.split('=') in list]) So my question is: is there a way to eliminate the for loop using list comprehension? If not, is there some built in python method that will do that for me?

    Read the article

  • Engineering techniques to diminish MVVM Driven Development time?

    - by Oscar Cabrero
    Hi Currently we just start releasing modules for a big project in MVVM but seems like the deliverables are starting to encounter a slowness with this model, such things as the learning curve effort and the fact that mvvm do requires a bit more code than other patterns, What Programming and software engineering techniques do you employ or thing could help us reduce the effort and speed up development? things like code generation with T4 templates, ligth MVVM frameworks, use Expression Blend, hire a designer to hanle UX. Thanks for any advice you could provide.

    Read the article

  • Is there a replacement for Paste.Template?

    - by Jorge Vargas
    I have grown tired of all the little issues with paste template, it's horrible to maintain the templates, it has no way of updating an old project and it's very hard to test. I'm wondering if someone knows of an alternative for quickstart generators as they have proven to be useful.

    Read the article

  • Where does that randomness come from ?

    - by Jules Olléon
    I'm working on a data mining research project and use code from a big svn. Apparently one of the methods I use from that svn uses randomness somewhere without asking for a seed, which makes 2 calls to my program return different results. That's annoying for what I want to do, so I'm trying to locate that "uncontrolled" randomness. Since the classes I use depend on many other, that's pretty painful to do by hand. Any idea how I could find where that randomness comes from ?

    Read the article

  • [ASP.NET] Generating images: Alternate font by User Agent (OS)

    - by sinni800
    Hello, I need to generate small images for certain parts of text. Those will have to fit into the text seamlessly. I know I can not make up for every browser font settings available, but how do I have to check for Linux, Mac and Windows users depending on the user agent? I want to use the right font (of the three "Verdana, Arial, Helvetiva") for the right user agent OS. So: How do I check for the OS? What do I have to compare to in the user agent? Where can I get the other two fonts. Does the Windows-included Verdana look the same as the one used on Linux (or, is it free anyway? I don't know much about fonts)? Where do I get Helvetica? Is it Mac OS licensed? Any code examples can be in either c# or VB.NET. I can read both. Thank you in advance.

    Read the article

  • How to get number of bytes read from QTextStream

    - by user261882
    The following code I am using to find the number of read bytes from QFile. With some files it gives the correct file size, but with some files it gives me a value that is approximatively fileCSV.size()/2. I am sending two files that have same number of characters in it, but have different file sizes link text. Should i use some other objects for reading the QFile? QFile fileCSV("someFile.txt"); if ( !fileCSV.open(QIODevice::ReadOnly | QIODevice::Text)) emit errorOccurredReadingCSV(this); QTextStream textStreamCSV( &fileCSV ); // use a text stream int fileCSVSize = fileCSV.size()); qint64 reconstructedCSVFileSize = 0; while ( !textStreamCSV.atEnd() ) { QString line = textStreamCSV.readLine(); // line of text excluding '\n' if (!line.isEmpty()) { reconstructedCSVFileSize += line.size(); //this doesn't work always reconstructedCSVFileSize += 2; } else reconstructedCSVFileSize += 2; } I know that reading the size of QString is wrong, give me some other solutions if you can. Thank you.

    Read the article

  • PHP Game weapon accuracy

    - by noko
    I'm trying to come up with a way for players to fire their weapons and only hit for a certain percentage. For example, one gun can only hit 70% of the time while another only hits 34% of the time. So far all I could come up with is weighted arrays. Attempt 1: private function weighted_random(&$weight) { $weights = array(($weight/100), (100-$weight)/100); $r = mt_rand(1,1000); $offset = 0; foreach($weights as $k => $w) { $offset += $w*1000; if($r <= $offset) return $k; } } Attempt 2: private function weapon_fired(&$weight) { $hit = array(); for($i = 0; $i < $weight; $i++) $hit[] = true; for($i = $weight; $i < 100; $i++) $hit[] = false; shuffle($hit); return $hit[mt_rand(0,100)]; } It doesn't seem that the players are hitting the correct percentages but I'm not really sure why. Any ideas or suggestions? Is anything glaringly wrong with these? Thanks

    Read the article

< Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >