Daily Archives

Articles indexed Sunday June 13 2010

Page 12/73 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • java + increasing performance and scalability

    - by varun
    Hi, below is the a code snippet, which returns the object of a class. now the object is basially comparing to some parameter in loop. my concern is what if there are thousands of objects in loop, in that case performance and scalability can be an issue. please suggest how to improve this code for performance part public Widget get(String name,int major,int minor,boolean exact) { Widget widgetToReturn = null; if(exact) { Widget w = new Widget(name, major, minor); // for loop using JDK 1.5 version for(Widget wid : set) { if((w.getName().equals(wid.getName())) && (wid.getVersion()).equals(w.getVersion())) { widgetToReturn = w; break; } } } else { Widget w = new Widget(name, major, minor); WidgetVersion widgetVersion = new WidgetVersion(major, minor); // for loop using JDK 1.5 version for(Widget wid : set) { WidgetVersion wv = wid.getVersion(); if((w.getName().equals(wid.getName())) && major == wv.getMajor() && WidgetVersion.isCompatibleAndNewer(wv, widgetVersion)) { widgetToReturn = wid; } else if((w.getName().equals(wid.getName())) && wv.equals(widgetVersion.getMajor(), widgetVersion.getMinor())) { widgetToReturn = w; } } } return widgetToReturn; }

    Read the article

  • iAds on landscape

    - by Carlos Vargas
    Hey guys Im having trouble with iAds in landscape mode This is part of my code: banner = [[ADBannerView alloc]init] ; banner.currentContentSizeIdentifier = ADBannerContentSizeIdentifier480x32; [self.view addSubview:banner]; [banner release]; But is not working for me, it gives me error, gives me a SIGABRT error in the second line of the code. I am not having problems with the portrait mode... please help. Best Regards Carlos Vargas

    Read the article

  • Grails: JSONP callback without id and class in JSON file

    - by Klaas
    Hi, I am working on a REST based interface where people get a json file. The client needs to access the file from another Domain. I use jsonp which works so far. My problem is the rendering in Grails. At the moment I use the 'as JSON' to marshalling the object: render "${params.jsoncallback}(${user as JSON})" The Json file getting to the client inclused all attributes, incluing the id and class, which I do not want to have in there. In case it is not jsonp, I do it this way, which works great: render(contentType:'text/json'){ userName user.userName userImage user.userImage : : } So how do I get the id and class attributes out of the json when rendering "user as JSON"? Any idea? best regards, Klaas

    Read the article

  • how to use asadmin deploy for Sun Application Server Plaform Edition 9.1?

    - by dfdfd
    I try to use the command so that i can schedule the deployment using cron trigger. But however i been encountering this error. java.io.IOException: Remote host closed connection during handshake What could be the reason and how do i resolve it? Is it something to do with the port i define? I defined the port used in the admin-server system. As for secure i set to true.

    Read the article

  • Content Provider

    - by niya
    Created a profile using content provider. After running it correctly, added 3 fields to the table. But now its not working corrrectly.It shows an error like "android.content.res.Resources$NotFoundException: String resource ID #0x4d2".Any solution?

    Read the article

  • Frontend Intertag Communication

    - by Matt
    Hey all, I've had a question that I've been wondering for a while. I'm making a templating system for front-ends where tags are interpretted (like Smarty). I was wondering if there is value in having the tags be able to communicate with the HTML document and other "Smartyish" tags. I was hoping that the community would have some thoughts on this situation. Benefits: More power (tags can tell other tags how to look) Better structure (smartyish tags behave and look just like html tags) Tags can manipulate any element on the page Drawbacks: Tags can manipulate any element on the page Tags can interfere with other tags Code time will increase

    Read the article

  • Any clever way to fix 'string or binary data would be truncated' warning with LINQ

    - by Simon_Weaver
    Is there a clever way to determine which field is causing 'string or binary data would be truncated' with LINQ. I've always ended up doing it manually by stepping through a debugger, but with a batch using 'SubmitChanges' I have to change my code to inserting a single row to find the culprit in a batch of rows. Am I missing something or in this day and age do I really have to still use a brute force method to find the problem. Please dont give me advice on avoiding this error in future (unless its something much cleverer than 'validate your data'). The source data is coming from a different system where I dont have full control anyway - plus I want to be lazy. PS. Does SQL Server 2008 actually tell me the field name. Please tell me it does! I'll upgrade!

    Read the article

  • How to remove contrast from recaptcha?

    - by carl-lopez
    I know the idea is to make the text somehow hard to read for the users but still they complain and I've seen how the control used here in stackoverflow doesn't have the dark circles contrasting with the text in recaptcha. How can I replicate this? Thanks.

    Read the article

  • Jquery video tutorial resources

    - by Perpetualcoder
    Is there any place where I can find JQuery video tutorials from novice level to master level? The books I saw mostly assume you are very familiar with CSS syntax. If there is any video tutorial resource for CSS, that would be awesome too.

    Read the article

  • gcc compiling invalid C code

    - by aks
    Some of my C programs are not working as expected. For example, pass by reference is not possible in C, but when I write a C program which uses that and compile it with gcc it works fine. Is gcc a C++ compiler? How do I make it behave like a C compiler?

    Read the article

  • Interesting interview question. .Net

    - by rahul
    Coding Problem NumTrans There is an integer K. You are allowed to add to K any of its divisors not equal to 1and K. The same operation can be applied to the resulting number and so on. Notice that starting from the number 4, we can reach any composite number by applying several such operations. For example, the number 24 can be reached starting from 4 using 5 operations: 468121824 You will solve a more general problem. Given integers n and m, return the minimal number of the described operations necessary to transform n into m. Return -1 if m can't be obtained from n. Definition Method signature: int GetLeastCount (int n, int m) Constraints N will be between 4 and 100000, inclusive. M will be between N and 100000, inclusive. Examples 1) 4 576 Returns: 14 The shortest order of operations is: 468121827365481108162243324432576 2) 8748 83462 Returns: 10 The shortest order of operations is: 874813122196832624439366590497873283106834488346083462 3) 4 99991 Returns: -1 The number 99991 can't be obtained because it’s prime!

    Read the article

  • Testing a Generic Class

    - by Jonas Gorauskas
    More than a question, per se, this is an attempt to compare notes with other people. I wrote a generic History class that emulates the functionality of a browser's history. I am trying to wrap my head around how far to go when writing unit tests for it. I am using NUnit. Please share your testing approaches below. The full code for the History class is here (http://pastebin.com/ZGKK2V84).

    Read the article

  • Simple Database normalization question...

    - by user365531
    Hi all, I have a quick question regarding a database that I am designing and making sure it is normalized... I have a customer table, with a primary key of customerId. It has a StatusCode column that has a code which reflects the customers account status ie. 1 = Open, 2 = Closed, 3 = Suspended etc... Now I would like to have another field in the customer table that flags whether the account is allowed to be suspended or not... certain customers will be automatically suspended if they break there trading terms... others not... so the relevant table fields will be as so: Customers (CustomerId(PK):StatusCode:IsSuspensionAllowed) Now both fields are dependent on the primary key as you can not determine the status or whether suspensions are allowed on a particular customer unless you know the specific customer, except of course when the IsSuspensionAllowed field is set to YES, the the customer should never have a StatusCode of 3 (Suspended). It seems from the above table design it is possible for this to happen unless a check contraint is added to my table. I can't see how another table could be added to the relational design to enforce this though as it's only in the case where IsSuspensionAllowed is set to YES and StatusCode is set to 3 when the two have a dependence on each other. So after my long winded explanation my question is this: Is this a normalization problem and I'm not seeing a relational design that will enforce this... or is it actually just a business rule that should be enforced with a check contraint and the table is in fact still normalized. Cheers, Steve

    Read the article

  • How do I watch a file for changes using Python?

    - by Jon Cage
    I have a log file being written by another process which I want to watch for changes. Each time a change occurrs I'd like to read the new data in to do some processing on it. What's the best way to do this? I was hoping there'd be some sort of hook from the PyWin32 library. I've found the win32file.FindNextChangeNotification function but have no idea how to ask it to watch a specific file. If anyone's done anything like this I'd be really grateful to hear how... [Edit] I should have mentioned that I was after a solution that doesn't require polling. [Edit] Curses! It seems this doesn't work over a mapped network drive. I'm guessing windows doesn't 'hear' any updates to the file the way it does on a local disk.

    Read the article

  • PHP Modify the return of a loop over and over.

    - by Joshua Anderson
    Basically I want to do a php loop that base64_encodes its self 5 times. //For example i want to encode "test" which is "dGVzdA==" then we encode "dGVzdA==" which is "ZEdWemRBPT0=" then encode "ZEdWemRBPT0=" which is "WkVkV2VtUkJQVDA9" I can't figure out how to create a loop that modifies its self each time it runs. // this is what i had function enloop($dowork){ for ($i=1; $i&lt;=5; $i++) { returns base64_encode($dowork); } } enloop($code); //THIS SCRIPT DOES THIS Repeats the encode 5 times, lets say your encodign the word test for example the output would be dGVzdA==dGVzdA==dGVzdA==dGVzdA==dGVzdA==

    Read the article

  • Authentication on odata service

    - by Toad
    I want to add some authentication to my odata service. Depending on the user calling i want to: filter rows and/or remove columns. I read in scott hanselmans fine blogpost on odata ( http://www.hanselman.com/blog/CreatingAnODataAPIForStackOverflowIncludingXMLAndJSONIn30Minutes.aspx )that it is possible to intercept the incoming queries. If this works i could add some extra filtering. How would this intercepting and altering queries work exactly? I can not find any examples of where and how to do this. (i'm using entitie framework and wcf dataservices (just like scotts example blog)

    Read the article

  • Are there any tools to speed up Cocoa development?

    - by user262325
    I noticed that there is much repeated work to do when creating Cocoa source code. For example, if I set an instance for an object: NSMutableArray *infoArray; I need add code: @property (retain,nonatomic) NSMutableArray *infoArray; @synthesize infoArray; in - (void)dealloc { I also need add: [infoArray release]; Is there any tool that can automate this, perhaps by automatically paste or copy the source code and add the repeated code at right place?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >