Search Results

Search found 5192 results on 208 pages for 'random forests'.

Page 7/208 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Random problem connecting to MySQL

    - by CharlesLeaf
    Environment: RHEL 5 servers, MySQL 5.1.43, PHP 5.1.6 (using MySQLi). Currently only available within our internal VPN network. Servers ServerA: Webserver ServerB/C/D: Database server (1 master 2 slaves) The error (on ServerA) [Tue May 25 11:12:17 2010] [error] [client CLIENTIP] PHP Warning: mysqli::real_connect() [function.mysqli-real-connect]: (HY000/2003): Can't connect to MySQL server on 'ServerB' (4) in /home/**/Database.php on line 67, referer: [website] Problem description It appears that at completely random times, our website is unable to connect to one of the MySQL servers - usually the Master. Except for the forementioned error message, there is nothing to be found in any of the logs as far as I can see, and most of the times the connection is succesful and everything works as it should. It's just at completely random times, this error pops up. There's no firewall blocking any internal traffic, timeout value is 3 but it doesn't take 3 seconds before it fails to connect. With the default mysql client I can connect from ServerA to ServerB,C and D and haven't encountered a problem yet. Does anyone have a clue what I might be overlooking / could be the problem? Because I've run out of ideas myself.

    Read the article

  • Random Movement in a Fixed Container

    - by James Barracca
    I'm looking to create something that can move randomly inside of a fixed div container. I love the way the object moves in this example that I found searching this website... http://jsfiddle.net/Xw29r/15/ The code on the jsfiddle contains the following: $(document).ready(function(){ animateDiv(); }); function makeNewPosition(){ // Get viewport dimensions (remove the dimension of the div) var h = $(window).height() - 50; var w = $(window).width() - 50; var nh = Math.floor(Math.random() * h); var nw = Math.floor(Math.random() * w); return [nh,nw]; } function animateDiv(){ var newq = makeNewPosition(); var oldq = $('.a').offset(); var speed = calcSpeed([oldq.top, oldq.left], newq); $('.a').animate({ top: newq[0], left: newq[1] }, speed, function(){ animateDiv(); }); }; function calcSpeed(prev, next) { var x = Math.abs(prev[1] - next[1]); var y = Math.abs(prev[0] - next[0]); var greatest = x > y ? x : y; var speedModifier = 0.1; var speed = Math.ceil(greatest/speedModifier); return speed; }? CSS: div.a { width: 50px; height:50px; background-color:red; position:fixed; }? However, I don't believe the code above constricts that object at all. I need my object to move randomly inside of a container that is let's say for now... 1200px in width and 500px in height. Can someone steer me in the right direction? I'm super new to coding so I'm having a hard time finding an answer on my own. Thanks so much! James

    Read the article

  • Trying to grab several random videos from database, but it just shows the same one all the time.

    - by Birk
    Hi guys, I'm trying to grab several random videos from my database, and have them show on a page. However, it just keeps on grabbing the same video rather than several different ones. So I end up with 5 of the same video rather than 5 different ones. Here's the grab random PHP code file... and after it is the template output file. //===================================================== // Random | Previous | Next //===================================================== $show['random'] = $db->quick_fetch( "SELECT file_id, title, title_seo, category_id, thumb FROM files WHERE files.category_id = '".$show['main']['category_id']."' AND files.verified=1 ORDER BY RAND() LIMIT 0,1; "); Here's the template CSS html thingy code I have this pasted 5 times to show 5 random videos <td valign="top" width="53%"><? $sql="select * from files ORDER BY rand() limit 0,5"; $res=@mysql_query($sql); $data=@mysql_result($res,0,'filename'); $id=@mysql_result($res,0,'file_id'); $title=@mysql_result($res,0,'title'); $title2=str_replace(" ", "-",$title); $path="{$siteurl}/media/{$file.random.file_id}/{$file.random.title_seo}/"; $img="{$siteurl}/thumbs/{$file.random.thumb}"; echo " {$file.random.title}"

    Read the article

  • Using a random string to authenticate HMAC?

    - by mrwooster
    I am designing a simple webservice and want to use HMAC for authentication to the service. For the purpose of this question we have: a web service at example.com a secret key shared between a user and the server [K] a consumer ID which is known to the user and the server (but is not necessarily secret) [D] a message which we wish to send to the server [M] The standard HMAC implementation would involve using the secret key [K] and the message [M] to create the hash [H], but I am running into issues with this. The message [M] can be quite long and tends to be read from a file. I have found its very difficult to produce a correct hash consistently across multiple operating systems and programming languages because of hidden characters which make it into various file formats. This is of course bad implementation on the client side (100%), but I would like this webservice to be easily accessible and not have trouble with different file formats. I was thinking of an alternative, which would allow the use a short (5-10 char) random string [R] rather than the message for autentication, e.g. H = HMAC(K,R) The user then passes the random string to the server and the server checks the HMAC server side (using random string + shared secret). As far as I can see, this produces the following issues: There is no message integrity - this is ok message integrity is not important for this service A user could re-use the hash with a different message - I can see 2 ways around this Combine the random string with a timestamp so the hash is only valid for a set period of time Only allow each random string to be used once Since the client is in control of the random string, it is easier to look for collisions I should point out that the principle reason for authentication is to implement rate limiting on the API service. There is zero need for message integrity, and its not a big deal if someone can forge a single request (but it is if they can forge a very large number very quickly). I know that the correct answer is to make sure the message [M] is the same on all platforms/languages before hashing it. But, taking that out of the equation, is the above proposal an acceptable 2nd best?

    Read the article

  • Generate a random alphanumeric string in cocoa

    - by Ward
    Hey there, I know this can't be that hard. I've searched, but I can't seem to find a simple solution. I want to call a method, pass it the length and have it generate a random alphanumeric string. Any ideas? Are there any utility libraries out there that may have a bunch of these types of functions? Thanks, Howie

    Read the article

  • Random numbers from -10 to 10 in C++

    - by Chris_45
    How does one make random numbers in the interval -10 to 10 in C++ ? srand(int(time(0)));//seed for(int i = 0; i < size; i++){ myArray[i] = 1 + rand() % 20 - 10;//this will give from -9 to 10 myArray2[i] =rand() % 20 - 10;//and this will -10 to 9 }

    Read the article

  • SQL Random number not working

    - by JMSA
    declare @fieldForceCounter as int declare @SaleDate as dateTime declare @RandomNoSeed as decimal set @fieldForceCounter = 1 set @SaleDate = '1 Jan 2009' set @RandomNoSeed = 0.0 WHILE @fieldForceCounter <= 3 BEGIN while @SaleDate <= '1 Dec 2009' begin INSERT INTO MonthlySales(FFCode, SaleDate, SaleValue) VALUES(@fieldForceCounter, @SaleDate, RAND(@RandomNoSeed)) set @saleDate = @saleDate + 1 set @RandomNoSeed = Rand(@RandomNoSeed) + 1 end set @SaleDate = '1 Jan 2009' set @fieldForceCounter = @fieldForceCounter + 1 END GO This T-SQL command was supposed to insert random values in the 'SaleValue'-column in the 'MonthlySales'-table. But it is inserting '1' every time . What can be the problem?

    Read the article

  • Random loading swf files into main swf with countdown timer

    - by Plugger
    ok guys a question, can this be done or has it already been done, or can someone point me in the right direction (be aware i an a total newbie with action script) i have a main swf movie about 600px x 400 px what i want is this to run for say 30 seconds, then i want a countdown timer in the bottom corner for say 10 seconds, after this i want it to randomly load another swf file over the top of the original, and then the timer repeats for 10 seconds and repates the random loading of another swf file over the top etc, etc, etc so whats the best way around this

    Read the article

  • No Secure Random Number Generators Available in JDK

    - by rwbutler
    Hi, I am currently running JDK 6 on Windows 7 and have installed the Unlimited Strength Policy Files. I wrote a Java app some time ago which used to work but now fails, giving an error message indicating that the SHA1PRNG SecureRandom is not available. I have tried printing a list of cryptographic providers available on the platform and it would appear that there are no secure random number generators available - does anyone have any idea why this might be? Many thanks in advance for your help!

    Read the article

  • Random record in ActiveRecord

    - by astrofoo
    I'm in need of getting a random record from a table via ActiveRecord. I've followed the example from Jamis Buck from 2006. However, I've also come across another way via a Google search (can't attribute with a link due to new user restrictions): rand_id = rand(Model.count) rand_record = Model.first(:conditions => [ "id >= ?", rand_id]) I'm curious how others on here have done it or if anyone knows what way would be more efficient.

    Read the article

  • Initializing a C++ vector to random values... fast

    - by Flamewires
    Hey, id like to make this as fast as possible because it gets called A LOT in a program i'm writing, so is there any faster way to initialize a C++ vector to random values than: double range;//set to the range of a particular function i want to evaluate. std::vector<double> x(30, 0.0); for (int i=0;i<x.size();i++) { x.at(i) = (rand()/(double)RAND_MAX)*range; } EDIT:Fixed x's initializer.

    Read the article

  • SQL query, select from 2 tables random

    - by klaus
    Hello all i have a problem that i just CANT get to work like i what it.. i want to show news and reviews (2 tables) and i want to have random output and not the same output here is my query i really hope some one can explain me what i do wrong SELECT anmeldelser.billed_sti , anmeldelser.overskrift , anmeldelser.indhold , anmeldelser.id , anmeldelser.godkendt FROM anmeldelser LIMIT 0,6 UNION ALL SELECT nyheder.id , nyheder.billed_sti , nyheder.overskrift , nyheder.indhold , nyheder.godkendt FROM nyheder ORDER BY rand() LIMIT 0,6

    Read the article

  • Haskell and random numbers

    - by John D.
    Hi, I've been messing with Haskell few days and stumbled into a problem. I need a method that returns a random list of integers ( Rand [[Int]] ). So, I defined a type: type Rand a = StdGen -> (a, StdGen). I was able to produce Rand IO Integer and Rand [IO Integer] ( (returnR lst) :: StdGen -> ([IO Integer], StdGen) ) somehow. Any tips how to produce Rand [[Int]]?

    Read the article

  • SQL OUTER JOIN with NEWID to generate random data for each row

    - by CL4NCY
    Hi, I want to generate some test data so for each row in a table I want to insert 10 random rows in another, see below: INSERT INTO CarFeatures (carID, featureID) SELECT C.ID, F.ID FROM dbo.Cars AS C OUTER APPLY ( SELECT TOP 10 ID FROM dbo.Features ORDER BY NEWID() ) AS F Only trouble is this returns the same values for each row. How do I order them randomly?

    Read the article

  • Get random enum from a select group

    - by Coward
    Given a group of about 20 enums that I cannot modify. Im looking for an elegant solution to generate a random enum from a specific sample (ie, 2, 7, 18) I could put these into an arraylist, but thought I would ask if there is something else I could try.

    Read the article

  • Php random row help...

    - by Skillman
    I've created some code that will return a random row, (well, all the rows in a random order) But i'm assuming its VERY uneffiecent and is gonna be a problem in a big database... Anyone know of a better way? Here is my current code: $count3 = 1; $count4 = 1; //Civilian stuff... $query = ("SELECT * FROM `*Table Name*` ORDER BY `Id` ASC"); $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $count = $count + 1; $civilianid = $row['Id']; $arrayofids[$count] = $civilianid; //echo $arrayofids[$count]; } while($alldone != true) { $randomnum = (rand()%$count) + 1; //echo $randomnum . "<br>"; //echo $arrayofids[$randomnum] . "<br>"; $currentuserid = $arrayofids[$randomnum]; $count3 += 1; while($count4 < $count3) { $count4 += 1; $currentarrayid = $listdone[$count4]; //echo "<b>" . $currentarrayid . ":" . $currentuserid . "</b> "; if ($currentarrayid == $currentuserid){ $found = true; //echo " '" .$found. "' "; } } if ($found == true) { //Reset array/variables... $count4 = 1; $found = false; } else { $listdone[$count3] = $currentuserid; //echo "<u>" . $count3 .";". $listdone[$count3] . "</u> "; $query = ("SELECT * FROM `*Tablesname*` WHERE Id = '$currentuserid'"); $result = mysql_query($query); $row = mysql_fetch_array($result); $username = $row['Username']; echo $username . "<br>"; $count4 = 1; $amountdone += 1; if ($amountdone == $count) { //$count $alldone = true; } } } Basically it will loop until its gets an id (randomly) that hasnt been chosen yet. -So the last username could take hours :P Is this 'bad' code? :P :(

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >