Search Results

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

Page 138/208 | < Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >

  • strategy to allocate/free lots of small objects

    - by aaa
    hello I am toying with certain caching algorithm, which is challenging somewhat. Basically, it needs to allocate lots of small objects (double arrays, < 256 elements), with objects accessible through mapped value, map[key] = array. time to initialized array may be quite large, generally more than 10 thousand cpu cycles. By lots I mean around gigabyte in total. objects may need to be popped/pushed as needed, generally in random places, one object at a time. lifetime of an object is generally long, minutes or more, however, object may be subject to allocation/deallocation several times during duration of program. What would be good strategy to avoid memory fragmentation, while still maintaining reasonable allocate deallocate speed? I am using C++, so I can use new and malloc. Thanks. I know there a similar questions on website, http://stackoverflow.com/questions/2156745/efficiently-allocating-many-short-lived-small-objects, are somewhat different, thread safety is not immediate issue for me.

    Read the article

  • Changing the way widgets are rendered/displayed in a form on the template

    - by user334017
    I have a form with a few other embedded forms and some various widgets. The widgets are all saved in an array $form['elements'] and for some of them, I want to display labels and things, but for others I only want to display the basic rendering. foreach($form['elements'] as $elem) echo $elem->render(); this displays everything about the widget. The way it is right now, I couldn't for example call $elem['..'] because the different subforms appear in a random order and have different variable names. I assume I could still put some checks in the template, but it seems easier to fix this in the widget class, like override one of the render functions or something. How would I go about doing this or do you have any links that could help me understand how do do this? on a side note, one of my widgets is the sfWidgetFormChoice and I have no clue where it actually renders or how renderer_classes work

    Read the article

  • Layout of popup components changes while moving

    - by Le_Coeur
    I have designed some popup moving menu with JQuery, it looks perfekt in webkit browsers, but i have one problem in mozilla, when i move my popup window, layout of some components in this window changes! For example button add changes from: to: or to: , and it's absolutly random. What can it be? This image is in span: <span class="sw_link_add"></span> .sw_link_add { background:url("/img/confirm_new.png") no-repeat scroll right center transparent; cursor:pointer; padding-right:30px; padding-top:2px; }

    Read the article

  • Having trouble getting GET variables from url.

    - by mchl
    Hey everyone, I'm having trouble with this algorithm to extract the get variables from a url and print them each on a new line like: x=y z=hello etc. but instead it prints a seemingly random section of the url with no newlines to the file. There must be a logic error of some kind but i just can't spot it. for(i_m=0;i_m<len_m;i_m++) { if(var_m[i_m]=='&') { fwrite(var_m+offset_m, 1, amp_m, echo_out); fputc('\n',echo_out); offset_m+=amp_m; amp_m=0; } amp_m++; } any help appreciated.

    Read the article

  • How to distribute the chance to display each SWF evenly among banner collection?

    - by Michael Mao
    Hi all: I am working on The ausdcf.org to try adding several banner ads in swf format to the top. Everything starts to work, but I've got several questions that need your help: The client chose not to go with Google AdManager, but prefer a "minimal approach" to do this task. What I am trying to do is sort of "mimicking" the way Google AdManager does for banners, that is, to split the chance of each particular swf to be shown to the visitor evenly among the banner collection. Definitely I can add some jQuery code to do this from client-side, a random number generator and if-else statement would work - just $.load() it! However, what if I'd like to make sure those disabled Javascript (is there any now btw?) still be able to see different swfs in each visit. Any suggestion on how to approach this? Many thanks in advance.

    Read the article

  • Prevent Apache from answering invalid requests

    - by nickdnk
    I have an Apache web-server that acts as a web front-end for iPhone and iPad applications that communicate by POST and JSON only. Is there any way to prevent Apache from answering requests that are invalid? I can see my error log is filled with attempts to open files such as /admin.php /index.php etc - files that don't exist on my server. I believe this is possible with IIS, but can you do the same thing with Apache? Basically I want the request to appear timed out unless you post exactly the right content to the right file - or at least if you do not request an existing file. This would make the server appear non-existing to everyone but my iPhone users as all communication is SSL and directories are not really guess-able. I did disable the ServerTokens and all that, but I still get File not found etc. when I access the server requesting a random file, which is what these bots do constantly.

    Read the article

  • Generating a perfectly distributed grid from array

    - by zath
    I'm looking for a formula or rule that will allow me to distribute n characters into a n*n grid with as perfect of a distribution as possible. Let's say we have an array of 5 characters, A through E. Here's an example of how it definitely shouldn't turn out: A B C D E B C D E A C D E A B D E A B C E A B C D The pattern is very clear here, it doesn't look "random". It would look better this way: A B C D E D E A B C B C D E A E A B C D C D E A B What I basically did here was place the A B C D E on the first row, then shift it by 2 on the second row, by 4 on the third row, 1 on the fourth row and 3 on the fifth row. Compared to the very bad example, this one shows no clear pattern. Though I'm certainly hoping there is a pattern, so I can use it to calculate not only small arrays such as this one, but arrays of any size. Any ideas as to how this can be accomplished?

    Read the article

  • Community based translating system

    - by mike
    Since we don't funds to hire translators for getting multiple languages translated we want the community to do the translation for us. Its a social network. I can't find any good open souce framework to auto do this. Thinking something like: User selects a language, system displays random sentences and user will translate it. Then other users can vote on how good it is. If it's 100 votes + with 95% yes then it becomes official. Site is in PHP. Any ideas?

    Read the article

  • Need help with a sub query/group/order (get latest comment for each ordered topic)

    - by Scarface
    Hey guys I have a query that currently finds the latest comment for each of a user's topics and then orders topics by that comment's timestamp. What I want to do is expand on this query's use and print the latest comment for each topic. The problem with this query is that while it orders the topics correctly, it prints seemingly random comments for each topic. I am trying to implement a sub query but I am not quite sure how to approach it. I was thinking that I just had to somehow use this query to get the comments. If anyone has any ideas I would really appreciate it. Here is what I think I need to add SELECT * FROM comments where topic_id='$topic_id' ORDER BY timestamp DESC LIMIT 1 Here is the query I need to modify SELECT topic.topic_title, topic.content_type, topic.subject_id, topic.creator, topic.description, topic.topic_id,comments.message,comments.user FROM comments JOIN topic ON topic.topic_id = comments.topic_id WHERE topic.creator = '$user' AND comments.timestamp > $week GROUP BY topic_id ORDER BY MAX(comments.timestamp) DESC

    Read the article

  • jquery - appended element not draggable

    - by kikkoman90
    Hello, So i have one div element that i append on my DOM with a click of a link. The problem is that i should be able to move that element around, but if i append it to my DOM i can't drag it at all. So is the live()-function solution? If it is, how should i use it? I kinda don't know how. Here's the minimalistic code: element to be appended (data.html): <div id="menu"> <p>random stuff here</p> </div> jquery: $("#menu").draggable(); $("#button").click(function(){ //custom function for exists() if ($("#menu").exists()){ $("#menu").remove(); } else { $.get("data.html", function(data){ $("body").append(data); }); } });

    Read the article

  • jquery animate() problem

    - by meo
    $('#somediv').stop(false, true).animate({marginLeft: '-=' + e.width() + 'px'}, options.speed, function(){ options.onNewSlide() }) e.with() returns 640 opctions.speed contains 800 options.onNewSlide() contains a a custom callback function It works fine in firefox. But i debugged it with jquery.lint because it was throwing some random error in IE. lint tells me: When I called animate(...) with your args, an error was thrown! TypeError: c.speed is not a function { message="c.speed is not a function", more...} You passed: [Object { marginLeft="-=640px"}, 800, function()] and it indicates me the line i have posted. I have checked the jquery doc, but my syntax seams ok. Do you know what i am doing wrong?

    Read the article

  • PHP: Remove blank line before text

    - by Bailey
    Occasionally, my email-to-support-ticket system catches an extra line break before the message itself, thus my messages look like this: " Hello. I have been wondering if y..." What can I use to get rid of that line before the text? It is on random occasion due to email providers and the way they format their emails using mime. I have already tried the trim functions but no luck. (Yes, I also tried ltrim) Once processed it should look like: "Hello. I have been wondering if y..."

    Read the article

  • Adding Content to a Randomized Background

    - by user2903815
    On refresh my background image changes. I need to add a header to change with each background. How would I add an h1 tag to the php. I am unfamiliar with php but I feel like this should be an easy fix. Here's my script: <script type="text/javascript"> var bgcount = 3; function changebg() { var num = Math.ceil( Math.random() * bgcount ); document.body.background = 'bgs/'+num+'.jpg'; document.body.style.backgroundRepeat = "no-repeat"; document.body.style.backgroundAttachment = "fixed"; document.body.style.backgroundSize = "cover"; } </script> Thanks!

    Read the article

  • Loop through different sets of unique permutations

    - by user558610
    Hi I'm having a hard time getting started to layout code for this problem. I have a fixed amount of random numbers, in this case 8 numbers. R[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; That are going to be placed in 3 sets of numbers, with the only constraint that each set contain minimum one value, and each value can only be used once. For example: R1[] = { 1, 4 } R2[] = { 2, 8, 5, 6 } R3[] = { 7, 4 } I need to loop through all possible combinations of a set R1, R2, R3. Order is not important, so if the above example happened, I don't need R1[] = { 4, 1 } R2[] = { 2, 8, 5, 6 } R3[] = { 7, 4 } NOR R1[] = { 2, 8, 5, 6 } R2[] = { 7, 4 } R3[] = { 1, 4 } What is a good method?

    Read the article

  • Multiple uses of "this" keyword in Java

    - by frodosamoa
    So, I have this. It compares two card decks and if they are the same the result is true. public boolean equals ( Object obj ) { boolean result = true; for (int i = 0; i < 52; i++) { if (this.cardAt(i) = this2.cardlist(i)) { result = true; } else { result = false; } } } I would like to be able to compare two random card decks, if you will. But I don't know how to compare two different ones using "this . I simply wrote "this2" to replace another instance of "this". What could I do to replace this "this2" to still be able to compare two card decks?

    Read the article

  • How does one find a '.' in a string object in Object-C

    - by NaZer
    I am working on getting a simple calculator working as part of my adventure to learning Object-C and iOS development. In Object-C using NSString, how does one look for a period in a string? Based on the comments this is what I got so far. NSString * tmp = [display text]; NSLog(@"%@", tmp); // Shows the number on the display correctly int x = [tmp rangeOfString:@"."].location; NSLog(@"%i", x); // Shows some random signed number if (x < 0) { [display setText:[[display text] stringByAppendingFormat:@"."]]; } It is still not working :(

    Read the article

  • VB to c++ or c#?

    - by hilzmas
    I am trying to translate this code but I don't understand how to use the GET / PUT part of the code in another language like c++ or c#. This is the code : Private Sub cmd_Click() Dim i As Integer, a As Integer a = 10 For i = 1 To a Dim file As String Open "txt" For Binary As #1 file = Space(LOF(1)) Get #1, , file Close #1 Randomize Open "txtpath" & "\" & i & "txtname" For Binary As #1 Put #1, , file Put #1, , Rnd Close #1 Next i End Sub The code could have bug because I replaced variables with plain text. What I understand is that the code get a file and then save it with some random data added to make it look different than the original. I don't use vb since years and I don't remember anything about it. Can someone help me porting this snippet to c++ or c#?

    Read the article

  • Downloading image from server without file extension (NSData to UIImage)

    - by Msencenb
    From my server I'm pulling down a url that is supposed to simply be a profile image. The relevant code for pulling down the image from the urls is this: NSString *urlString = [NSString stringWithFormat:@"%@%@",kBaseURL,profile_image_url]; profilePic = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]]]; My url is in the format (note no file extension on the end since its dynamically rendered) localhost:8000/people/1/profile_image If I load the url in my browser the image displays; however the code above for pulling down the UIImage does not work. I've verified that the code does pull an image from a random site on the interwebs. Any thoughts on why this is happening?

    Read the article

  • Where can I find a compact programming keyboard with logical key placement?

    - by Lefler
    I recently, at the order of my chiropractor, bought a laptop stand to elevate my screen. A result of this is that I need a standalone keyboard. Normal keyboards have numeric keypads on the right side, which moves my mouse further to the right... not an optimal position chiropractically speaking. I don't use the numeric keypad, but all the compact keyboards I can find use some random placement algorithm on the arrow, page up/down, and most importantly -- the insert,delete,home and end keys. Those misplaced keys are crippling my code entry. Does anyone know of a keyboard that is minus the keypad, but places those VERY IMPORTANT keys in a more standard position?

    Read the article

  • When open-sourcing a live Rails app, is it dangerous to leave the session key secret in source contr

    - by rspeicher
    I've got a Rails app that's been running live for some time, and I'm planning to open source it in the near future. I'm wondering how dangerous it is to leave the session key store secret in source control while the app is live. If it's dangerous, how do people usually handle this problem? I'd guess that it's easiest to just move the string to a text file that's ignored by the SCM, and read it in later. Just for clarity, I'm talking about this: # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. ActionController::Base.session = { :key => '_application_session', :secret => '(long, unique string)' } And while we're on the subject, is there anything else in a default Rails app that should be protected when open sourcing a live app?

    Read the article

  • What causes session/forms authentication timeouts in MVC3

    - by SimpleUser
    Can somebody please let me know what are the reasons for your authentication to die suddenly, even when you are working on an application without any idle time? Both with and without AJAX calls. And what are the different reasons for getting a 302 redirect from an MVC3 application to the Logon page. Been struggling with an issue with timeouts that happen at random. Sometimes within a few minutes of login to the application and sometimes you can go for hours (with/without idle time) without being thrown out. Thank You

    Read the article

  • How can I make a table move in JavaScript?

    - by Michal Skrzypek
    My problem is that I was creating a simple website the other day and I needed the content to move according to the button pressed. I managed to do so in CSS3, but the solution did not work for IE whatsoever. Therefore I would like to ask if there is a simple solution for that in js? I don't know js at all but I heard what I need is much easier in js than in css. Details: http://i42.tinypic.com/6yl4ia.png I need the table in the picture to move according to the buttons (which are labels to be exact). The visible area is a div. Here's the relevant code (without animation as I was not satisfied with it): body { background-color: #fff; color: #fff; padding:0px; } #bodywrapperfixed { width: 1248px; margin: 0px auto; position: relative; overflow: hidden; height: 730px; } #bodywrapper { display:block; background-color: #fff; width: 1248px; color: #59595B; padding-top:50px; font-family: 'Roboto', sans-serif; position: absolute; top:0px; left:0px; z-index:1; font-size: 60px; height:730px; } #bodywrapper img { width:400px; padding:15px 0px 20px 0px; } #texten { font-family: 'Roboto', sans-serif; font-size: 35px; padding:5px; } #textpl { font-family: 'Roboto', sans-serif; font-size: 25px; padding:5px; } table#linki { width: 110px; border: none; margin-top:15px; } label { display: block; height: 54px; width: 54px; color:#fff; font-family: 'Roboto', sans-serif; font-weight: 300; font-size: 35px; background-color: #117D10; text-align: center; padding:23px; } label:hover { background-color: #004F00; cursor: pointer; } input#pl { position: absolute; top: -9999px; left: -9999px; } input#en { position: absolute; top: -9999px; left: -9999px; } and the relevant HTML: <div id="bodywrapperfixed"> <div id="bodywrapperfloat"> <table id="ramka"> <tr> <td>random text</td> <td><div id="bodywrapper"> <center> <div id="texten"><div style="font-weight:300; display:inline-block;">Introducing the all-in-one entertainment system.</div><div style="font-weight:500; display:inline-block;">&nbsp;For everyone.</div></div> <div id="textpl"><div style="font-weight:300; display:inline-block;">Przedstawiamy zintegrowany system rozrywki.</div><div style="font-weight:500; display:inline-block;">&nbsp;&nbsp;Dla wszystkich.</div></div> <img src="imgs/xboxone.png"> <div id="texten"><div style="font-weight:300; display:inline-block;">Choose your version of the story:</div></div> <div id="textpl"><div style="font-weight:300; display:inline-block;">Wybierz swoja wersja opowiesci:</div></div> <table id="linki"> <tr> <td><label for="en">en</label><input id="en" type="checkbox"></td> <td><label for="pl">pl</label><input id="pl" type="checkbox"></td> </tr></table> </center> </div></td> <td>random text</td> </tr> </table> </div> </div> Here's what it looks like: http://ingame.lh.pl/thinkone/ Please help me.

    Read the article

  • How to achieve jQuery scrolling/overlay effect (video in description)

    - by waffl
    I have two columns. The left column contains text of dynamic lengths. The right column is of fixed height and will contain a set of images selected at random per page load. I am trying to create an effect where while the user scrolls, the Image 2 scrolls above Image 1. When it reaches the top, the Image 1 begins to scroll up until it disappears, then Image 3 comes in and repeats the process. As this is rather confusing, I made a short video describing the desired effect. Video - MP4 I have begun trying to get it working in this jsbin but am at a loss for when the user scrolls back down and also when more images are required. I am thinking my current path is not the right direction. I'm thinking that employing something like jQuery waypoints is more the direction I should be pursuing?

    Read the article

  • document.getElementByIdContains?

    - by johnshaddad
    Hello Is there, by any chance, a way to solve this problem: I have elements that have IDs such as "x_y_z". The unique part is "x_y", thus there is no two items that have the same combination of x and y.. However, using getElementById won't work because when I do it I only have the "x" and "y" part and not the Z (think of Z as a random incremental counter). Is there a way around this? So that when I have the "x" and "y" I say something like getElementByIdContains("x_y")? Thanks!

    Read the article

  • Reading line by line from a file in C

    - by mh234
    What I am trying to do is print out the contents of a file line by line. I run the program in terminal by doing: ./test testText.txt. When I do this, random characters are printed out but not what is in the file. The text file is located in the same folder as the makefile. What's wrong? #include <stdio.h> FILE *fp; int main(int argc, char *argv[]) { char line[15]; fp = fopen(*argv, "r"); while((fgets(line, 15, fp)) != NULL) { printf(line); printf("\n"); } }

    Read the article

< Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >