Search Results

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

Page 28/208 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • User Crontab + Python + Random wallpapers = Not working?

    - by Andrew Bolster
    I have a python script that correctly sets the desktop wallpaper via gconf to a random picture in a given folder. I then have the following entry in my crontab * * * * * python /home/bolster/bin/change-background.py And syslog correctly reports execution Apr 26 14:11:01 bolster-desktop CRON[9751]: (bolster) CMD (python /home/bolster/bin/change-background.py) Apr 26 14:12:01 bolster-desktop CRON[9836]: (bolster) CMD (python /home/bolster/bin/change-background.py) Apr 26 14:13:01 bolster-desktop CRON[9860]: (bolster) CMD (python /home/bolster/bin/change-background.py) Apr 26 14:14:01 bolster-desktop CRON[9905]: (bolster) CMD (python /home/bolster/bin/change-background.py) Apr 26 14:15:01 bolster-desktop CRON[9948]: (bolster) CMD (python /home/bolster/bin/change-background.py) Apr 26 14:16:01 bolster-desktop CRON[9983]: (bolster) CMD (python /home/bolster/bin/change-background.py) But no desktopy changey, Any ideas?

    Read the article

  • iPhone screen rotates at random !

    - by Baldoph
    I use a tabBar Controller as root controller. It has 4 tabs and each of its ViewControllers has - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return YES; } as long as the tabBarController itself. But when I rotate the device (real or simulator), the screen turns at random! If it doesn't turn when I open the application it would have the same behavior until I quit the app. I tried to add the 4 viewControllers one by one in IB to see if one was problematic, but I obtained the same issue. It only always works when there is no tabs at all! Please tell me if you have any ideas. Thanks!

    Read the article

  • SQL Server - Select one random record not showing duplicates

    - by Lukes123
    I have two tables, events and photos, which relate together via the 'Event_ID' column. I wish to select ONE random photo from each event and display them. How can I do this? I have the following which displays all the photos which are associated. How can I limit it to one per event? SELECT Photos.Photo_Id, Photos.Photo_Path, Photos.Event_Id, Events.Event_Title, Events.Event_StartDate, Events.Event_EndDate FROM Photos, Events WHERE Photos.Event_Id = Events.Event_Id AND Events.Event_EndDate < GETDATE() AND Events.Event_EndDate IS NOT NULL AND Events.Event_StartDate IS NOT NULL ORDER BY NEWID() Thanks Luke Stratton

    Read the article

  • Color generation based on random number

    - by Mikulas Dite
    I would like to create a color generator based on random numbers, which might differ just slightly, but I need colors to be easily recognizable from each other. I was thinking about generation then in a rgb format which would be probably easiest. I'm afraid simply multiplying given arguments wouldn't do very well. What algorithm do you suggest using? Also, second generated color should not be the same as previous one, but I don't want to store them - nor multiplying with (micro)time would do well since the scripts' parts are usually faster.

    Read the article

  • how to hack this php class for parse ZIP file in random or specific order

    - by Jesse
    My English is poor so I will make it short. Right now, I have imzip.zip which has three txt files: a.txt b.txt c.txt When I try to load imzip.zip using: http://pastebin.com/m1d974990 It loads the files alphabetically. In this case: a.txt b.txt c.txt However, I would like to be able to have the class load on different variables such as by size, date or simply random. The problem is I have no idea how I would go about modifying the class to fit my needs. I would really appreciate your help! :D

    Read the article

  • Get Python 2.7's 'json' to not throw an exception when it encounters random byte strings

    - by Chris Dutrow
    Trying to encode a a dict object into json using Python 2.7's json (ie: import json). The object has some byte strings in it that are "pickled" data using cPickle, so for json's purposes, they are basically random byte strings. I was using django.utils's simplejson and this worked fine. But I recently switched to Python 2.7 on google app engine and they don't seem to have simplejson available anymore. Now that I am using json, it throws an exception when it encounters bytes that aren't part of UTF-8. The error that I'm getting is: UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0: invalid start byte It would be nice if it printed out a string of the character codes like the debugging might do, ie: \u0002]q\u0000U\u001201. But I really don't much care how it handles this data just as long as it doesn't throw an exception and continues serializing the information that it does recognize. How can I make this happen? Thanks!

    Read the article

  • Getting a random element in Django

    - by Sarah
    I just finished the Django tutorial and started work on my own project, however, I seem to have missed something completely. I wanted to get a random slogan from this model: from django.db import models class Slogan(models.Model): slogan = models.CharField(max_length=200) And return it in this view: from django.http import HttpResponse from swarm.sloganrotator.models import Slogan def index(request): return HttpResponse(Slogan.objects.order_by('?')[:1]) However, the view just returns 'Slogan object'. Then I thought, maybe I can access the slogan string itself by simply appending .slogan to the slice, but that gives me an error indicating that the object I have is actually a QuerySet and has no attribute slogan. I've obviously misunderstood something about Django here, but it just doesn't fall into place for me. Any help?

    Read the article

  • Random Record from Recordset

    - by Tony Hanks
    I have the fillowing Query: SELECT a.*, ps4_media.filename, ps4_galleries.name as galleryname, ps4_media_iptc.description, ps4_media_iptc.title, ps4_media_iptc.headline, ps4_media.date_added, ps4_galleries.created, ps4_folders.name as foldername, ps4_galleries.gallery_count FROM ps4_media_galleries a INNER JOIN (SELECT ps4_media_galleries.gallery_id, min(ps4_media_galleries.gmedia_id) AS minID FROM ps4_media_galleries GROUP BY ps4_media_galleries.gallery_id) b ON a.gallery_id = b.gallery_id AND a.gmedia_id = b.minID INNER JOIN ps4_media ON ps4_media.media_id = a.gmedia_id INNER JOIN ps4_folders ON ps4_folders.folder_id = ps4_media.folder_id INNER JOIN ps4_galleries ON ps4_galleries.gallery_id = a.gallery_id INNER JOIN ps4_media_iptc ON ps4_media_iptc.media_id = a.gmedia_id ORDER BY ps4_galleries.created DESC How do I get ps4_media.filename to be random, everything else is fine just want the thumbnail which ps4_media.filename is to be and of the records in the found set.

    Read the article

  • AJAX Autocomplete appears at a random vertical position, not touching the textbox

    - by Tim
    Hi, I am using the AJAX Autocomplete extender for ASP.NET 2. Everything works fine...I am calling a webservice which gets me the values to fill the drop down with after 3 letters are typed into certain es. I have set the maxheight attribute and am using a scrollbar in case there are more entries than would fit that height. However, I notice that in some cases, the drop down appears at a random position on the screen, i.e. rather than connected to the relevant textbox, sometimes it appears with its entries above the textbox, not touching it at all. Sometimes it would have just one entry and it would appear in the middle of the screen vertically above the textbox it is associated to. Is there a reason why this is happening?

    Read the article

  • PHP - displaying 1 random record for each week

    - by mike
    I want to display 1 random record from a database based on the week. I need to determine if it's a new, and if it is a new week, then select the record and display the new record. I'm thinking I can just use a single day of the week to generate the new record, either way will work. I'm really having a hard time conceptualizing how I'll store the record id and not select a new one when someone visits again the same day or refreshes the page. Any ideas? Let me know if I wasn't clear enough.

    Read the article

  • Random password variable disappears

    - by snaken
    Hi, I'm using the following to generate a random password in a shell script: DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) When i run this in a file on its own like this: #!/bin/sh DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) echo $DBPASS A password is echoed. When i incorporate it into a larger script though the variable never seems to get created for some reason, so for example this doesn't work: DBPASS=</dev/urandom tr -dc A-Za-z0-9| (head -c $1 > /dev/null 2>&1 || head -c 8) sed -i s/oldpass/$DBPASS/ mysql_connect.php If i manually set the variable though everything is fine.. can anyone see why?

    Read the article

  • Is generating real random numbers this easy in C#?

    - by JL
    I found this code using Google. private int RandomNumber(int min, int max) { Random random = new Random(); return random.Next(min, max); } Is this really all there is to generating REAL random numbers in C#? I intend to generate on a small scale between values 1-10. Thanks

    Read the article

  • Generating unique N-valued key

    - by Bar
    Hi, StackOverflow! I want to generate unique random, N-valued key. This key can contain numbers and latin characters, i.e. A-Za-z0-9. The only solution I am thinking about is something like this (pseudocode): key = ""; smb = "ABC…abc…0123456789"; // allowed symbols for (i = 0; i < N; i++) { key += smb[rnd(0, smb.length() - 1)]; // select symbol at random position } Is there any better solution? What can you suggest? TIA, Michael.

    Read the article

  • Order By Rand by Time (HQL)

    - by Felipe
    Hi all, I'm developing a web application using asp.net Mvc 2 and NHibernate, and I'm paging data (products in a category) in my page, but this data are random, so, I'm using a HQL statement link this: string hql = "from Product p where p.Category.Id=:IdCategory order by rand()"; It's working fine, but when I page, sometimes the same product appears in the first, second, etc... pages because it's order by rand(). Is there any way to make a random order by fixed by period (time internal) ? Or any solution ? thanks Cheers

    Read the article

  • Linq to NHibernate, Order by Rand() ?

    - by Felipe
    Hi everybody, I'm using Linq To Nhibernate, and with a HQL statement I can do something like this: string hql = "from Entity e order by rand()"; Andi t will be ordered so random, and I'd link to know How can I do the same statement with Linq to Nhibernate ? I try this: var result = from e in Session.Linq<Entity> orderby new Random().Next(0,100) select e; but it throws a exception and doesn't work... is there any other way or solution? Thanks Cheers

    Read the article

  • How to increment counters based on a printed array

    - by Sam Liew
    I managed to developed a simple board of 5x5 using random numbers and array. Big achievement for someone like me! :) Now I have to increment the counters depending on the frequency of the numbers. If the value within 0-49 is printed..then nCounter++ If the value within 50-75 is printed..then pCounter++ something like that. The problem is that I don't know how to increase the counters based on the printed board. Here is the code: #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { //Initialize Variables int randomNumber; int rows; int columns; int hdCounter =0; int hCounter = 0; int cCounter = 0; int pCounter = 0; int nCounter = 0; //Declare board size int board[5][5]; //size of board is 5 x 5 //Create the random number generator seed srand(time(NULL)); //Assign the random numbers from 1 - 25 into variable randomNumber //Create the rows for the board for ( rows = 1; rows <= 5 ; rows++ ) { //Create the colimns for the board for ( columns = 1; columns <= 5 ; columns++ ) { //Assign variable randomNumber into variable board randomNumber = rand() %100 + 1; board[rows][columns] = randomNumber; //print the board printf("%d\t", board[rows][columns]); //calculate the frequency of numbers on the printed board if (randomNumber >= 85 && randomNumber <= 100 ) hdCounter++; else if ( randomNumber >= 75 ) hCounter++; else if ( randomNumber >= 65 ) cCounter++; else if ( randomNumber >= 50 ) pCounter++; else if ( randomNumber >= 1 ) nCounter++; else continue; } //Newline after the end of 5th column. printf("\n\n"); } printf( "N \t P \t C \t H \t HD\n\n" ); printf("%d \t %d \t %d \t %d \t %d \t", nCounter, pCounter, cCounter, hCounter, hdCounter); }//end main I tried replacing randomNumber in the if-statement with board[rows][columns] but I seem to get the same undesired results.

    Read the article

  • How to get unique numbers using randomint python?

    - by user2519572
    I am creating a 'Euromillions Lottery generator' just for fun and I keep getting the same numbers printing out. How can I make it so that I get random numbers and never get the same number popping up: from random import randint numbers = randint(1,50) stars = randint(1,11) print "Your lucky numbers are: ", numbers, numbers, numbers, numbers, numbers print "Your lucky stars are: " , stars, stars The output is just: >>> Your lucky numbers are: 41 41 41 41 41 >>> Your lucky stars are: 8 8 >>> Good bye! How can I fix this? Regards

    Read the article

  • Characteristics of an Initialization Vector

    - by Jamie Chapman
    I'm by no means a cryptography expert, I have been reading a few questions around Stack Overflow and on Wikipedia but nothing is really 'clear cut' in terms of defining an IV and it's usage. Points I have discovered: An IV is pre-pended to a plaintext message in order to strengthen the encryption The IV is truely random Each message has it's own unique IV Timestamps and cryptographic hashes are sometimes used instead of random values, but these are considered to be insecure as timestamps can be predicted One of the weaknesses of WEP (in 802.11) is the fact that the IV will reset after a specific amount of encryptions, thus repeating the IV I'm sure there are many other points to be made, what have I missed? (or misread!)

    Read the article

  • Choose item from a list with bias?

    - by ooboo
    Given a list of items x1 ... xn and associated probabilties p1 ... pn that sum up to 1 there's a well known procedure to select a random item with its associated proabability by sorting the list according to weight, choosing a random value between 1 and 0, and adding up to a culmination sum until it exceeds the value selected and return the item at this point. So if we have x1 - 0.5, x2 - 0.3, x3 - 0.2, if the randomly chosen value is less than 0.5 x1 will be chosen, if between 0.5 and 0.8, x2, and else x3. This requires sorting so it needs O(nlogn) time. Is there anything more efficient than that?

    Read the article

  • How are a session identifiers generated?

    - by Asaf R
    Most web applications depend on some kind of session with the user (for instance, to retain login status). The session id is kept as a cookie in the user's browser and sent with every request. To make it hard to guess the next user's session these session-ids need to be sparse and somewhat random. The also have to be unique. The question is - how to efficiently generate session ids that are sparse and unique? This question has a good answer for unique random numbers, but it seems not scalable for a large range of numbers, simply because the array will end up taking a lot of memory.

    Read the article

  • Mean of Sampleset and powered Sampleset

    - by Milla Well
    I am working on an ICA implementation wich is based on the assumption, that all source signals are independent. So I checked on the basic concepts of Dependence vs. Correlation and tried to show this example on sample data from numpy import * from numpy.random import * k = 1000 s = 10000 mn = 0 mnPow = 0 for i in arange(1,k): a = randn(s) a = a-mean(a) mn = mn + mean(a) mnPow = mnPow + mean(a**3) print "Mean X: ", mn/k print "Mean X^3: ", mnPow/k But I couldn't produce the last step of this example E(X^3) = 0: >> Mean X: -1.11174580826e-18 >> Mean X^3: -0.00125229267144 First value I would consider to be zero, but second value is too large, isn't it? Since I subtract the mean of a, I expected the mean of a^3 to be zero as well. Does the problem lie in the random number generator, the precision of the numerical values in my misunderstanding of the concepts of mean and expected value?

    Read the article

  • How to get some randomized concats based on 2 columns from 1 table?

    - by Nils Riedemann
    Hey folks, i have a large user Database (13k+), and for some reason i need to create random names. The users table has "first_name" and "last_name". Now i want to have 10 concats of full_name and last_name of two completely random rows. Is that even possible with SQL? My other idea was just to create a full_names and last_names table … but that would'nt be as much challenging. Oh, and it should not take up too much performance :) (so order by rand() is not an option ;))

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >