Search Results

Search found 380 results on 16 pages for 'emil mp'.

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

  • Virtual methods as Comp function to sort

    - by wilsongoncalo.mp
    Hello everyone! I'm new to C++ and i'm trying to use std::sort function to sort a vector of Solutions. The code is something like this (solution list is a *vector): void SolutionSet::sort(Comparator &comparator) { std::sort(solutionsList_->begin(), solutionsList_->end(), &comparator::compare); } The comparator param is a Comparator´s child class instance , and the compare method is virtual at Comparator class and implemented by all Comparator's child classes. And i want to use that function as a comparator function at std:sort(). Is this possible? If it is, can someone tell me how? Because with the previous code, it doesn't work. If i've not made myself clear, please just ask! Thank you guys!

    Read the article

  • Why is memory management so visible in Java?

    - by Emil
    I'm playing around with writing some simple Spring-based web apps and deploying them to Tomcat. Almost immediately, I run into the need to customize the Tomcat's JVM settings with -XX:MaxPermSize (and -Xmx and -Xms); without this, the server easily runs out of PermGen space. Why is this such an issue for Java compared to other garbage collected languages? Comparing counts of "tune X memory usage" for X in Java, Ruby, Perl and Python, shows that Java has easily an order of magnitude more hits in Google than the other languages combined.

    Read the article

  • UITableView - Loading data from internet

    - by Emil
    Hey. I have seen many apps that load data to UITableViews from the internet, and they usually load smoothly. Now it's my turn to load in that kind of data. I am getting different data at the same time, separating categories with ~ and pieces of categories with #. This works great, and I have managed to separate the data in obj-c perfectly. Everything in my app works, it's just that the loading takes a lot of time. So, I guess the real question is, how can you load in data for a tableView in the background, showing a label/UIActivityView or something while it is loading? Thank you.

    Read the article

  • How to check if *number* is in a array

    - by Emil
    Pretty basic programming question, I know PHP have a function for it, but does the iPhone OS have one? I want to check if the current indexPath is a value in an array. PHP Example: <?php $indexPath = 3; $array = array("0", "1", "2", "3", "4"); if (in_array($indexPath, $array)) { // Do something } ?> Does anybody know how to do the same thing inthe iPhone OS?

    Read the article

  • What is the best way to automated (integration) test with java with OpenId4Java against real OpenIdP

    - by mP
    I would like to do a bit more than manually test my openid glue code which happens to use the openid4java library. My goals would be to be able to run it within my IDE with a bunch of tests using Junit or similar. Selenium & tomcat I was thinking of using selenium and a tomcat but thats not exactly a nice approach as this is a bit heavy and not really lightweight. httpunit A solution with http-unit is incomplete because it doesnt really fit with the redirect to my openid provider, authenticate and redirect back. Perhaps i am wrong but this looks like it could get quite involved just to make sure this works. Mocks My last solution is to mock everything and assume thats its accurate and works. If google or yahoo ever change in some way, then ill have to verify manually. The approach is simple but with a major flaw.

    Read the article

  • How to I get raw 'mouse' events with touch screens on Windows Vista/7?

    - by Emil
    Does anyone have a clue how to completely disable the touch/tablet 'magic' introduced in Windows Vista? When I follow the steps on http://msdn.microsoft.com/en-us/library/bb969148(VS.85).aspx (both SetProp disable and WM_TABLET_QUERYSYSTEMGESTURESTATUS override) I succeed in stopping windows from treating press-and-hold as a right-click (it correctly gives me a WM_LBUTTONDOWN), but it also gives me a premature WM_LBUTTONUP (before I really let go of the screen). And there is also another problem: a click followed by a drag (down, up, down, move) is treated as a double-click (down, up, down, up, move). These issues occur with two very different touch screens (so it is not a hardware problem), and it never used to happen with Windows XP. This really bugs me. I would much rather have the raw input events like you have for normal mouse clicks. Any ideas?

    Read the article

  • Problems using the Razor model when creating my knockout ViewModel

    - by Emil Kantis
    I'm having problems with using the Model in a javascript call when setting up my knockout VM.. @model List<AdminGui.Models.Domain> <script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js" type="text/javascript"></script> <script type="text/javascript"> function ViewModel() { var self = this; self.domains = ko.observableArray( ko.utils.arrayMap(@Model, function(item) { return new Domain(item.guid, item.description, item.namespaces); })); } I get a syntax error on @Model in the ko.utils.arrayMap call. I suspect it might be my Razor-fu that is lacking... :)

    Read the article

  • Dynamically creating/inserting into an associative array in PHP

    - by emil.mp
    I'm trying to build an associative array in PHP dynamically, and not quite getting my strategy right. Basically, I want to insert a value at a certain depth in the array structure, for instance: $array['first']['second']['third'] = $val; Now, the thing is, I'm not sure if that depth is available, and if it isn't, I want to create the keys (and arrays) for each level, and finally insert the value at the correct level. Since I'm doing this quite a lot in my code, I grew tired of doing a whole bunch of "array_key_exists", so I wanted to do a function that builds the array for me, given a list of the level keys. Any help on a good strategy for this is appreciated. I'm sure there is a pretty simple way, I'm just not getting it...

    Read the article

  • What is the fastest / best Base64 en/decoder for Java ?

    - by mP
    Just found the MIG Base 64 utility but its over 6 years old since its last release. It would appear to be quicker than the Apache commons equivalent but I have yet to confirm by writing up an actual test. Has anyone verified its correctness which is always a worry. If someone takes a look at the methods, please note i a referring to the non fast methods which make assumptions trading possible correctness for pure speed.

    Read the article

  • Can you append a NSMutableArray to a file?

    - by Emil
    Hi. I am trying to write some data from an NSMutableArray to a plist, while keep the old plists content. The function writeToFile:atomically: overwrites the old contents with the new, I want to append the objects in the new array to the plist. How can this be done? Thank you.

    Read the article

  • Find out when all processes in (void) is done?

    - by Emil
    Hey. I need to know how you can find out when all processes (loaded) from a - (void) are done, if it's possible. Why? I'm loading in data for a UITableView, and I need to know when a Loading... view can be replaced with the UITableView, and when I can start creating the cells. This is my code: - (void) reloadData { NSAutoreleasePool *releasePool = [[NSAutoreleasePool alloc] init]; NSLog(@"Reloading data."); NSURL *urlPosts = [NSURL URLWithString:[NSString stringWithFormat:@"%@", URL]]; NSError *lookupError = nil; NSString *data = [[NSString alloc] initWithContentsOfURL:urlPosts encoding:NSUTF8StringEncoding error:&lookupError]; postsData = [data componentsSeparatedByString:@"~"]; [data release], data = nil; urlPosts = nil; self.numberOfPosts = [[postsData objectAtIndex:0] intValue]; self.postsArrayID = [[postsData objectAtIndex:1] componentsSeparatedByString:@"#"]; self.postsArrayDate = [[postsData objectAtIndex:2] componentsSeparatedByString:@"#"]; self.postsArrayTitle = [[postsData objectAtIndex:3] componentsSeparatedByString:@"#"]; self.postsArrayComments = [[postsData objectAtIndex:4] componentsSeparatedByString:@"#"]; self.postsArrayImgSrc = [[postsData objectAtIndex:5] componentsSeparatedByString:@"#"]; NSMutableArray *writeToPlist = [NSMutableArray array]; NSMutableArray *writeToNoImagePlist = [NSMutableArray array]; NSMutableArray *imagesStored = [NSMutableArray arrayWithContentsOfFile:[rootPath stringByAppendingPathComponent:@"imagesStored.plist"]]; int loop = 0; for (NSString *postID in postsArrayID) { if ([imagesStored containsObject:[NSString stringWithFormat:@"%@.png", postID]]){ NSLog(@"Allready stored, jump to next. ID: %@", postID); continue; } NSLog(@"%@.png", postID); NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[postsArrayImgSrc objectAtIndex:loop]]]; // If image contains anything, set cellImage to image. If image is empty, try one more time or use noImage.png, set in IB if (imageData == nil){ NSLog(@"imageData is empty before trying .jpeg"); // If image == nil, try to replace .jpg with .jpeg, and if that worked, set cellImage to that image. If that is also nil, use noImage.png, set in IB. imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[[postsArrayImgSrc objectAtIndex:loop] stringByReplacingOccurrencesOfString:@".jpg" withString:@".jpeg"]]]; } if (imageData != nil){ NSLog(@"imageData is NOT empty when creating file"); [fileManager createFileAtPath:[rootPath stringByAppendingPathComponent:[NSString stringWithFormat:@"images/%@.png", postID]] contents:imageData attributes:nil]; [writeToPlist addObject:[NSString stringWithFormat:@"%@.png", postID]]; } else { [writeToNoImagePlist addObject:[NSString stringWithFormat:@"%@", postID]]; } imageData = nil; loop++; NSLog(@"imagePlist: %@\nnoImagePlist: %@", writeToPlist, writeToNoImagePlist); } NSMutableArray *writeToAllPlist = [NSMutableArray arrayWithArray:writeToPlist]; [writeToPlist addObjectsFromArray:[NSArray arrayWithContentsOfFile:nowPlist]]; [writeToAllPlist addObjectsFromArray:[NSArray arrayWithContentsOfFile:[rootPath stringByAppendingPathComponent:@"imagesStored.plist"]]]; [writeToNoImagePlist addObjectsFromArray:[NSArray arrayWithContentsOfFile:[rootPath stringByAppendingPathComponent:@"noImage.plist"]]]; [writeToPlist writeToFile:nowPlist atomically:YES]; [writeToAllPlist writeToFile:[rootPath stringByAppendingPathComponent:@"imagesStored.plist"] atomically:YES]; [writeToNoImagePlist writeToFile:[rootPath stringByAppendingPathComponent:@"noImage.plist"] atomically:YES]; [releasePool release]; }

    Read the article

  • Is Android (read typical devices) fast enough for a game that requires plotting pixel by pixel rather than blitting

    - by mP
    i have an idea for an Android game which is a little different from the typical game that usually moves sprites(bitmaps) around the screen. Id want to plot lots of little pixels to create my visuals. PROS no bitmaps required pixel plotting of stuff like "fire" can react to wind. no need to scale bitmaps, works w/ any screen res (lets pretend device can handle more drawing because its got a bigger screen). CONS slower to plot pixels than blit bitmaps need lot of animation frames. WISHES id like to update my game in real time, more is better 30fps is good but not essential, 15fps is enough. PERFORMANCE Q... Is the typical Android device fast enough to plot say half a screenful of pixels w/ a default background ? if full screen is not practical what window size should be able to handle such refreshes

    Read the article

  • In C# ,how do I terminate a thread that has had its call stack corrupted?

    - by Emil D
    I have a thread in my application that is running code that can potentially cause call stack corruption ( my application is a testing tool for dlls ). Assuming that I have a method of detecting if the child thread is misbehaving, how would I terminate it? From what I read, calling Thread.Abort() on the misbehaving thread would be equivalent to raising an exception inside it.I fear that that not be a good idea, provided the call stack of the thread might be corrupted.Any suggestions?

    Read the article

  • Why doesen't the number 2 work in this for-loop?

    - by Emil
    Hello. I have a function that runs trough each element in an array. It's hard to explain, so I'll just paste in the code here: NSLog(@"%@", arraySub); for (NSString *string in arrayFav){ int favoriteLoop = [string intValue] + favCount; NSLog(@"%d", favoriteLoop); id arrayFavObject = [array objectAtIndex:favoriteLoop]; [arrayFavObject retain]; [array removeObjectAtIndex:favoriteLoop]; [array insertObject:arrayFavObject atIndex:0]; [arrayFavObject release]; id arraySubFavObject = [arraySub objectAtIndex:favoriteLoop]; [arraySubFavObject retain]; [arraySub removeObjectAtIndex:favoriteLoop]; [arraySub insertObject:arraySubFavObject atIndex:0]; [arraySubFavObject release]; id arrayLengthFavObject = [arrayLength objectAtIndex:favoriteLoop]; [arrayLengthFavObject retain]; [arrayLength removeObjectAtIndex:favoriteLoop]; [arrayLength insertObject:arrayLengthFavObject atIndex:0]; [arrayLengthFavObject release]; } NSLog(@"%@", arraySub); The array arrayFav contains these strings: "3", "8", "2", "10", "40". Array array contains 92 strings with a name. Array arraySub contains numbers 0 to 91, representing a filename with a title from the array array. Array arrayLength contains 92 strings representing the size of each file from array arraySub. Now, the first NSLog shows, as expected, the numbers 0 to 91. The NSLog-s in the loop shows the numbers 3, 8, 2, 10, 40, also as expected. But here's the odd part: the last NSLog shows these numbers: 40, 10, 0, 8, 3, 1, 2, 4, 5, 6, 7, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91 that is 40, 10, 0, 8, 3, and so on. It was not supposed to be a zero in there, it was supposed to be a 2.. Do you have any idea at why this is happening or a way to fix it? Thank you.

    Read the article

  • Java Servlet framework that does things like rencoding images to preferred format etc.

    - by mP
    Are there any frameworks/libraries that provide servlets/filters etc that handle reencoding on the fly of images. interpret the accept headers and output the file, reencoding into the new format if necessary by checking the actual format of the original image file. provide a low and high quality version of an image. re encode an image into new dimensions. width and height parameters might query string parameters. I could create versions of the file in all the formats, at upload time but the seems overkill. I would rather lazily create the rencoded file and stick it in a cache if it gets served again etc.

    Read the article

  • Dynamic added elements double effect after page transition

    - by Emil Moe
    I have added dynamic from jQuery in my code, but when I go back one page and return to the page where the 's are added and you press them, they somehow click twice now. I have tried with an alert('something'); when I click: $(document).on('click', '#products a', function() { alert('something'); } And it's shown twice when you return to the page. I have tried $('#products a').remove(); When you click the 'Back' button, because I thought all elements where added twice, but that made no difference. I don't have anything around these lines, maybe I need $(document).ready(); or something with pageinit?

    Read the article

  • I'd want a method to be called only by objects of a specific class

    - by mp
    Suppose you have this class: public class A { private int number; public setNumber(int n){ number = n; } } I'd like the method setNumber could be called only by objects of a specific class. Does it make sense? I know it is not possible, is it? Which are the design alternatives? Some well known design pattern? Sorry for the silly question, but I'm a bit rusty in OO design.

    Read the article

  • Why does this crash: stringByAppendingFormat

    - by Emil
    Hey. My code crashes at this function (at the stringByAppendingFormat: with error objc_msgSend() selector name: stringByAppendingFormat). This is that line: // imagesPath = ...iPhone Simulator/4.0/Applications/NUMBERS/Documents/images UIImage *image = [[UIImage alloc] initWithContentsOfFile:[imagesPath stringByAppendingFormat:@"/%d.png", [[self.postsArrayID objectAtIndex:row] intValue]]]; Could it have something to do with the retaining of objects? Thanks :)

    Read the article

  • Robust Way of Selecting All Text in Textbox

    - by Emil
    I'm trying to have the content of the an HTML textbox be selected fully onFocus. I know the simple solution of putting a onfocus="this.select()" on the component but this is not a good solution because if a user double clicks into the area the selection is lost and in browsers like chrome it is rarely working like it should and just reverts into input form. I have searched on Google for a little while and can't find a good solution, most suggestions are of this simple solution. What I would like it is that the selection inside the textbox not change once selected and if possible the user should not be able to edit the content of the textbox, for example if you have used AdSense when you grab code from AdSense the selection never changes and your unable to alter the code in the textbox. Any solutions would be appreciated.

    Read the article

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