Daily Archives

Articles indexed Tuesday April 27 2010

Page 24/121 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Whats faster in Javascript a bunch of small setInterval loops, or one big one?

    - by RobertWHurst
    Just wondering if its worth it to make a monolithic loop function or just add loops were they're needed. The big loop option would just be a loop of callbacks that are added dynamically with an add function. adding a function would look like this setLoop(function(){ alert('hahaha! I\'m a really annoying loop that bugs you every tenth of a second'); }); setLoop would add the function to the monolithic loop. so is the is worth anything in performance or should I just stick to lots of little loops using setInterval?

    Read the article

  • Best Way to Include Debug Code?

    - by stormin986
    I am programming Android applications, and the best way here may or may not be the same as Java in general. I simply want to be able to set a debug flag that will only execute certain portions of code when it's set to true––equiv to C++ setting a preprocessor #define DEBUG and using #ifdef DEBUG. Is there an accepted or best way to accomplish this in Java? Right now I'm just going to set a variable in my Application object, but I don't imagine this is the best way.

    Read the article

  • Get http status in Qt WebKit

    - by RR
    Hello all: What I would like to implement is 1 Using Qt's WebView(part of QtWebKit) to access some page. 2 Show specified html page if got HTTP 4xx, 5xx status (Ex HTTP 404, 500). 3 Also shows specified page when network connection is unavailable. For now, I had only done job 1... In job 2, how did I get http status from WebView ? In job 3, I'm looking about QUrl APIs now. Anyone have idea or expreience yet ?

    Read the article

  • C check if file exists, including on PATH

    - by Gary
    Hi, Given a filename in C, I want to determine whether this file exists and has execute permission on it. All I've got currently is: if( access( filename, X_OK) != 0 ) { But this wont search the PATH for files and will also match directories (which I don't want). Could anyone please help?

    Read the article

  • setting up 301 redirects: dynamic urls to static urls

    - by MS
    We are currently using a template-based website and are hoping to move to a site with static urls. Our domain will stay the same. I understand that using 301 redirects in a .htaccess file is the preferred method -- and the one that has the highest chance of preserving our google rankings. I am still new at all this and am having a hard time figuring out the proper way to code it all. Over a hundred of our pages are indexed. They all have a similar URL but with different pageIDs: http://www.realestate-bigbear.com/Nav.aspx/Page=%2fPageManager%2fDefault.aspx%2fPageID%3d2020765 Some link out to provided content, ex. /RealEstateNews/Default.aspx Then there are many that flow from the main featured listings page: /ListNow/Default.aspx Down to all the specific properties.. where the PropertyId changes /ListNow/Property.aspx?PropertyID=2048098 would a simple set of codes work... like the following.... redirect 301 /Nav.aspx/Page=%2fPageManager%2fDefault.aspx%2fPageID%3d2020765 www.realestate.bigbear.com/SearchBigBearMLS.htm or do I need to do something entirely different?

    Read the article

  • Web Service URL change is not recognized

    - by ila
    I deployed in a production environment a .net solution that consumes a web service added as "Service reference" in visual studio. Today the endpoint URL has changed, and I modified that URL in web.config. But when I run the solution I get the error: System.ServiceModel.FaultException: Server did not recognize the value of HTTP Header SOAPAction: http://93.62.150.200/LogEvent. Now that sound strange to me. As you can see, the IP is 93.62.... but the new value is different. The web.config entry (with the new value or the URL) is: <client> <endpoint address="http://213.92.50.215/sawfc/WS_SAWFC_Int.asmx" binding="basicHttpBinding" bindingConfiguration="wsSAWFCInterfaceSoap" contract="it.datasphere.ws.wsSAWFCInterfaceSoap" name="wsSAWFCInterfaceSoap" /> </client> I cannot reach the new web service from dev environment, so I cannot modify the Service reference there. Any idea? Thanks a lot!

    Read the article

  • Why aren't variables declared in "try" in scope in "catch" or "finally"?

    - by Jon Schneider
    In C# and in Java (and possibly other languages as well), variables declared in a "try" block are not in scope in the corresponding "catch" or "finally" blocks. For example, the following code does not compile: try { String s = "test"; // (more code...) } catch { Console.Out.WriteLine(s); //Java fans: think "System.out.println" here instead } In this code, a compile-time error occurs on the reference to s in the catch block, because s is only in scope in the try block. (In Java, the compile error is "s cannot be resolved"; in C#, it's "The name 's' does not exist in the current context".) The general solution to this issue seems to be to instead declare variables just before the try block, instead of within the try block: String s; try { s = "test"; // (more code...) } catch { Console.Out.WriteLine(s); //Java fans: think "System.out.println" here instead } However, at least to me, (1) this feels like a clunky solution, and (2) it results in the variables having a larger scope than the programmer intended (the entire remainder of the method, instead of only in the context of the try-catch-finally). My question is, what were/are the rationale(s) behind this language design decision (in Java, in C#, and/or in any other applicable languages)?

    Read the article

  • facebook application testing

    - by Jacksta
    I am goign to start mucking around with a facebook app. You are spposed to be able to test code here http://developers.facebook.com/tools.php but that url is a 404. Does anyone know if the Test Console still exists?

    Read the article

  • IIS6 Wildcard Mapping to ASP.NET - no file extension results in IIS 404

    - by Ian Robinson
    I'm trying to perform what I understand to be a relatively simple task. I'd like to remove the extensions from the URLs on my website. I have the proper set up in my application to handle and rewrite the URLs - the trouble is I can't get past IIS to actually get to my application without the extensions. The details: I'm running IIS6 on Windows Server 2003. I've gone into the web site for my application, gone to the home directory tab, clicked "Configuration" and added a wildcard map to the following file: c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll Which I verified is the same as what is used above in the application extensions portion by .ascx, etc. If I navigate to http://mywebsite.com/Blogs the result is as follows: HTTP/1.1 404 Not Found Content-Length: 1635 Content-Type: text/html Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Date: Thu, 14 Jan 2010 15:04:49 GMT Which seems to be a standard IIS 404 message. If I navigate to http://mywebsite.com/Blogs.aspx I get my ASP.NET app.... How can I troubleshoot this? I feel like I've double checked everything a dozen times but to no avail. I must be missing something obvious. Update: Here are the exact instructions given by the asp.net url rewriter that I'm using: IIS 6.0 - Windows 2003 Server open property page for website / virtual directory. click the 'home directory' tab click the 'configuration' button, select the 'mappings' tab click 'insert' next to the 'Wildcard application maps' section browse to the aspnet_isapi.dll (normally at c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll) Ensure that 'check that file exists' is unchecked Click OK, OK, OK to close and apply changes Update 2: I have yet to find a resolution for this. The application does not seem to be receiving the request from IIS, any further ideas?

    Read the article

  • Extract attributes from NSManagedObject array.

    - by Pavel Peroutka
    NSFetchRequest *req = [NSFetchRequest init]; NSEntityDescription *descr = [NSEntityDescription entityForName:@"City" inManagedObjectContext:context]; [req setEntity:descr]; NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"streetName" ascending:YES]; [req setSortDescriptors:[NSArray arrayWithObject:sort]]; [sort release]; //fetch NSError *error; NSArray *result = [context executeFetchRequest:req error:&error]; //extract names NSMutableArray *streets = [[NSMutableArray alloc] init]; for () { ??? = [array objectAtIndex:i]; [streets addObject:name]; } I expected Core Data to be little more intuitive. I am new in it and I could use some help. I fetched all objects(rows) from the entity (table) City. Now I have an array of objects. From the array I need to extract the attribute “streetName” to an array which will feed the picker. I figured I need to do it in the loop but I could not figure out the way to do it. Please help. I have a background with SQL but Core Data is still a big mystery to me. Is there any publication which would take a SQL statement and show comparable Core Data syntax? Thanks.

    Read the article

  • Passing data with Rails' link_to helper

    - by mathee
    I am implementing a question-and-answer application with Ruby on Rails. I have MVCs for Questions and Answers. In the home view (index.haml), I list the Questions like this: - @questions.each do |q| %tr %td =link_to q.title, q Next to each of those, I want to add a link that will create a new Answer and pass the id of the Question in that row (continued from the above Haml code) : %td #{link_to 'answer me!', new_answer_path, pass q.id here somehow?} I don't know how to properly pass it and then access it in AnswersController. I tried #{link_to 'answer me!', new_answer_path, :question_id => q.id}, but that was just a guess, and I don't know how to access that in AnswersController. I read the Rails API docs, and I know you can add query, too, but I still don't know how to access the value in AnswersController.

    Read the article

  • When saving to a model, created and modified aren't automatically populated by CakePHP. Using SQL Se

    - by bakerjr
    Hi when saving to a model, my created and modified fields aren't automatically populated by CakePHP. It was automatically populated when I was using MySQL but now it isn't. I'm not using NOW() back when I was still using MySQL. Why is it? Also when a field's value is not set 'NULL' (with quotes) is inserted causing errors because SQL Server says I can't insert a string to a field of type smallint/date etc. How do I fix this? Thanks in advance!

    Read the article

  • Can't access annotation property of subclassed uibutton

    - by Tzur Gazit
    I have a mapView to which I add annotations. The pin's callout have a button (rightCalloutAccessoryView). In order to be able to display various information when the button is pushed, i've subclassed uibutton and added a class called "Annotation". @interface CustomButton : UIButton { NSIndexPath *indexPath; Annotation *mAnnotation; } @property (nonatomic, retain) NSIndexPath *indexPath; @property (nonatomic, copy) Annotation *mAnnotation; - (id) setAnnotation2:(Annotation *)annotation; @end Here is "Annotation": @interface Annotation : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString *mPhotoID; NSString *mPhotoUrl; NSString *mPhotoName; NSString *mOwner; NSString *mAddress; } @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, copy) NSString *mPhotoID; @property (nonatomic, copy) NSString *mPhotoUrl; @property (nonatomic, copy) NSString *mPhotoName; @property (nonatomic, copy) NSString *mOwner; @property (nonatomic, copy) NSString *mAddress; - (id) initWithCoordinates:(CLLocationCoordinate2D)coordinate; - (id) setPhotoId:(NSString *)id url:(NSString *)url owner:(NSString *)owner address:(NSString *)address andName:(NSString *)name; @end I want to set the annotation property of the uibutton at - (MKAnnotationView *)mapView:(MKMapView *)pMapView viewForAnnotation:(id )annotation, in order to refer to it at the button push handler (-(IBAction) showDetails:(id)sender). The problem is that I can't set the annotation property of the button. I get the following message at run time: 2010-04-27 08:15:11.781 HotLocations[487:207] *** -[UIButton setMAnnotation:]: unrecognized selector sent to instance 0x5063400 2010-04-27 08:15:11.781 HotLocations[487:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIButton setMAnnotation:]: unrecognized selector sent to instance 0x5063400' 2010-04-27 08:15:11.781 HotLocations[487:207] Stack: ( 32080987, 2472563977, 32462907, 32032374, 31884994, 55885, 30695992, 30679095, 30662137, 30514190, 30553882, 30481385, 30479684, 30496027, 30588515, 63333386, 31865536, 31861832, 40171029, 40171226, 2846639 ) I appreciate the help. Tzur.

    Read the article

  • JavaScript: Keeping track of eventListeners on DOM elements

    - by bobthabuilda
    What is the best way to keep track of eventListener functions on DOM elements? Should I add a property to the element which references the function like this: var elem = document.getElementsByTagName( 'p' )[0]; function clickFn(){}; elem.listeners = { click: [clickFn, function(){}] }; elem.addEventListener( 'click', function(e){ clickFn(e); }, false ); Or should I store it in my own variable in my code like below: var elem = document.getElementsByTagName( 'p' )[0]; function clickFn(){}; // Using window for the sake of brevity, otherwise I wouldn't =D // DOM elements and their listeners are referenced here in a paired array window.listeners = [elem, { click: [clickFn, function(){}] }]; elem.addEventListener( 'click', function(e){ clickFn(e); }, false ); Obviously the second method would be less obtrusive, but it seems it could get intensive iterating through all those possibilities. Which is the best way and why? Is there a better way?

    Read the article

  • "Verbose Dictionary" in C#, 'override new' this[] or implement IDictionary

    - by Benjol
    All I want is a dictionary which tells me which key it couldn't find, rather than just saying The given key was not present in the dictionary. I briefly considered doing a subclass with override new this[TKey key], but felt it was a bit hacky, so I've gone with implementing the IDictionary interface, and passing everything through directly to an inner Dictionary, with the only additional logic being in the indexer: public TValue this[TKey key] { get { ThrowIfKeyNotFound(key); return _dic[key]; } set { ThrowIfKeyNotFound(key); _dic[key] = value; } } private void ThrowIfKeyNotFound(TKey key) { if(!_dic.ContainsKey(key)) throw new ArgumentOutOfRangeException("Can't find key [" + key + "] in dictionary"); } Is this the right/only way to go? Would newing over the this[] really be that bad?

    Read the article

  • WCF Streaming not working at server

    - by Radhi
    hi, i have used WCF service to transfer large files in chunks to the server for that i have reference this article http://kjellsj.blogspot.com/2007/02/wcf-streaming-upload-files-over-http.html i have configured my application on IIS on my machine. its work fine here. it allows upto 64mb file upload but when we have published the site. it allows only maximum 30Mb file if i try to upload more than that i got error 404 - resource not found. here is the binding config i have used. <basicHttpBinding> <!-- buffer: 64KB; max size: 64MB --> <binding name="FileTransferServicesBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Streamed" messageEncoding="Mtom" maxBufferSize="65536" maxReceivedMessageSize="67108864"> <security mode="None"> <transport clientCredentialType="None"/> </security> </binding> </basicHttpBinding> please suggest me where i am missing anything. and if required more code please let me know -thanks in advance

    Read the article

  • 'if' block in IL

    - by Luke Schafer
    I think I might be missing something important, but I can't seem to figure out how to construct a conditional statement in IL with dynamic method. I've only dabbled lightly in it before, but I need to extend some code now. Is there some documentation somewhere that I haven't found (apart from the CLI documentation), or does someone have some sample code? That would be fantastic. Cheers,

    Read the article

  • Serializing data using IEnumerable<T> with WebGet

    - by Jim
    possible duplicate: Cannot serialize parameter of type ‘System.Linq.Enumerable… ’ when using WCF, LINQ, JSON Hi, If my method signiature looks like this, it works fine. [WebGet] MyClass[] WebMethod() If the signiature looks like this [WebGet] IEnumerable<T> WebMethod() I get the following error: Cannot serialize parameter of type 'X.Y.Z.T+<WebMethod>d__2c' (for operation 'WebMethod', contract 'IService') because it is not the exact type 'System.Collections.Generic.IEnumerable`1[X.Y.Z.T]' in the method signature and is not in the known types collection. In order to serialize the parameter, add the type to the known types collection for the operation using ServiceKnownTypeAttribute. I have tried adding. ServiceKnownType(typeof(IEnumerable)) Same error. Is this a bug in 2010 beta 2, or is this likely to be correct going forward? Thanks

    Read the article

  • Where to store 3rd party libraries?

    - by zerkms
    I have asp.net mvc 2 application. Now I'm reimplementing it for working with Ninject. All is fine except one thing: where should I store Ninject.dll?? I've created lib directory inside my appdir and made reference to lib/Ninject.dll. But may be there are some general conventions on how to act in such cases?

    Read the article

  • Can you make a PHP function recursive without repeating it's name?

    - by alex
    It's always bugged me a recursive function needs to name itself, when a instantiated class can use $this and a static method can use self etc. Is there a similar way to do this in a recursive function without naming it again (just to cut down on maintenance)? Obviously I could use call_user_func or the __FUNCTION__ constant but I would prefer something less ugly. Update Thanks for your answers. I might stick to including the function name for simple functions, and make take the other approaches for anything more complicated.

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >