Search Results

Search found 1903 results on 77 pages for 'james mccvoy'.

Page 39/77 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • String comparison in Objective-C

    - by james.ingham
    Hey, I've currently got a webserver set up which I communicate over SOAP with my iPhone app. I am returning a string containing a GUID and when I attempt to compare this with another string I get some strange results: Why would this not fire? Surely the two strings are a match? Thanks

    Read the article

  • Connecting to a self hosted WCF service from a Flex application - policy issues

    - by James S
    Hello, I am trying to accomplish the following: I wrote a Flex application that is trying to connect to a WCF service hosted on the clients computer. I also wrote a windows forms application for the client to run. This application exposes a self-hosted WCF service that the Flex application is supposed to connect to. This works fine if I'm loading the Flex application from my local IIS. The problem starts when the Flex application is hosted on a different domain. When this occurs, the flash player requires a crossdomain.xml policy file on the clients computer. I also managed to expose the crossdomain.xml on the clients computer using another WCF self-hosted service and WebHttpBinding on the clients computer. This also works fine. My problem is that the flash player requires that the crossdomain.xml or a meta policy file will be in the root directory of the domain. If I used my WCF service to expose something on the root directory of the clients computer I will run over any existing web server capabilities the client has on the computer (such as IIS). I know it's a bit complicated scenario, but any help would be appreciated. Thanks!

    Read the article

  • Error Handling without Exceptions

    - by James
    While searching SO for approaches to error handling related to business rule validation , all I encounter are examples of structured exception handling. MSDN and many other reputable development resources are very clear that exceptions are not to be used to handle routine error cases. They are only to be used for exceptional circumstances and unexpected errors that may occur from improper use by the programmer (but not the user.) In many cases, user errors such as fields that are left blank are common, and things which our program should expect, and therefore are not exceptional and not candidates for use of exceptions. QUOTE: Remember that the use of the term exception in programming has to do with the thinking that an exception should represent an exceptional condition. Exceptional conditions, by their very nature, do not normally occur; so your code should not throw exceptions as part of its everyday operations. Do not throw exceptions to signal commonly occurring events. Consider using alternate methods to communicate to a caller the occurrence of those events and leave the exception throwing for when something truly out of the ordinary happens. For example, proper use: private void DoSomething(string requiredParameter) { if (requiredParameter == null) throw new ArgumentExpcetion("requiredParameter cannot be null"); // Remainder of method body... } Improper use: // Renames item to a name supplied by the user. Name must begin with an "F". public void RenameItem(string newName) { // Items must have names that begin with "F" if (!newName.StartsWith("F")) throw new RenameException("New name must begin with /"F/""); // Remainder of method body... } In the above case, according to best practices, it would have been better to pass the error up to the UI without involving/requiring .NET's exception handling mechanisms. Using the same example above, suppose one were to need to enforce a set of naming rules against items. What approach would be best? Having the method return a enumerated result? RenameResult.Success, RenameResult.TooShort, RenameResult.TooLong, RenameResult.InvalidCharacters, etc. Using an event in a controller class to report to the UI class? The UI calls the controller's RenameItem method, and then handles an AfterRename event that the controller raises and that has rename status as part of the event args? The controlling class directly references and calls a method from the UI class that handles the error, e.g. ReportError(string text). Something else... ? Essentially, I want to know how to perform complex validation in classes that may not be the Form class itself, and pass the errors back to the Form class for display -- but I do not want to involve exception handling where it should not be used (even though it seems much easier!) Based on responses to the question, I feel that I'll have to state the problem in terms that are more concrete: UI = User Interface, BLL = Business Logic Layer (in this case, just a different class) User enters value within UI. UI reports value to BLL. BLL performs routine validation of the value. BLL discovers rule violation. BLL returns rule violation to UI. UI recieves return from BLL and reports error to user. Since it is routine for a user to enter invalid values, exceptions should not be used. What is the right way to do this without exceptions?

    Read the article

  • How to make Flash 'play well with others'?

    - by Sensei James
    What up fam. So this isn't a question asking about memory management schemes; for those of you who may not know, the Flash Virtual Machine relies on garbage collection by using reference counting and mark and sweep (for good coverage of these topics, check out Grant Skinner's article and presentation). And yes, Flash also provides the "delete" operator, which can (unfortunately only) be used to remove the properties of dynamic objects. What I want to know is how to make it so that Flash programs don't continue to consume CPU and memory while running in the background (save loading content or communicating remotely, for example). The motivation for this question comes in part from Apple's ban on cross compiled applications (in its SDK 4) on the grounds that they do not behave as predicted with the multitasking feature central to iPhone OS 4. My intention is not only to make Flash programs that will 'pass muster' as far as multitasking in iPhone OS 4, but also to simply make better (behaving) Flash programs. Put another way, how might a Flash application mimic the multitasking feature of iPhone OS 4? Does the Flash API provide the means for a developer to put their applications to 'sleep' while other programs run, and then to 'awaken' them just as quickly? In our own program, we might do something as crude as detecting when the user has been idle (no mouse motion or key press) for (say) four seconds: var idle_id:uint = setInterval(4000, pause_program); var current_movie_clip:MovieClip; var current_frame:uint; ... // on Mouse move or key press... clearInterval(idle_id); idle_id = setInterval(4000, pause_program); ... function pause_program():void { current_movie_clip = event.target as MovieClip; current_frame = current_movie_clip.currentFrame; MovieClip(root).gotoAndStop("program_pause_screen"); } (on the program pause screen) resume_button.addEventListener(MouseEvent.CLICK, resume_program); function resume_program(event:MouseEvent) { current_movie_clip.gotoAndPlay(current_frame); } If that's the right idea, what's the best way to detect that an application should be shelved? And, more importantly, is it possible for Flash Player to detect that some of its running programs are idle, and to similarly shelve them until the user performs an action to resume them? (Please feel free to answer as much or as little of the many questions I've posed.)

    Read the article

  • Modifying UINavigation Bar Buttons in SubViews

    - by james
    I'm having trouble trying to modify the navigation bar in the subview portion of my application. self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(add_Clicked:)] autorelease]; I have no issues modifying the navigation bar in any of my UIViewControllers classes. The simplified application class outline is as such: AppDelegate - UIViewControllerA (has a left and a right navigationBarButton) - Subview is displayed when a SegmentControl is selected. (Within the subview, I'm trying to modify the right NavigationBarButton that is displayed) [self.view addSubview:newControllerName.view]; Methods I have attempted: Trying to set self.navigationItem.rightBarButtonItem within my subview to a new UIBarButtonItem. Creating a pointer to UIViewControllerA within my AppDelegate. The UIViewControllerA contains a function setNavButton I wrote to set the rightBarButtonItem to a button. Then I am referencing the AppDelegate's reference to UIViewControllerA and attempting to call setNavButton. I included a NSLog call to see if that function is being called and it is executing but the NavigationBar isn't being modified. I'm trying to avoid having to push a UIViewController after the SegmentControl is clicked in UIViewControllerA so that I can simulate the SegmentControl as tabs. I'm not getting any errors during compile or run time. Anyone have any ideas?

    Read the article

  • How do I use Python's itertools.groupby()?

    - by James Sulak
    I haven't been able to find an understandable explanation of how to actually use Python's itertools.groupby() function. What I'm trying to do is this: take a list - in this case, the children of an objectified lxml element - divide it into groups based on some criteria, and then later iterate over each of these groups separately. I've reviewed the documentation (http://docs.python.org/lib/itertools-functions.html), and the examples, (http://docs.python.org/lib/itertools-example.html), but I've had trouble trying to apply them beyond a simple list of numbers. So, how do I use of itertools.groupby()? Is there another technique I should be using? Pointers to good "prerequisite" reading would also be appreciated.

    Read the article

  • Finding the string length of a integer in .NET

    - by James Newton-King
    In .NET what is the best way to find the length of an integer in characters if it was represented as a string? e.g. 1 = 1 character 10 = 2 characters 99 = 2 characters 100 = 3 characters 1000 = 4 characters The obvious answer is to convert the int to a string and get its length but I want the best performance possible without the overhead of creating a new string.

    Read the article

  • Synchronizing ASP.NET MVC action methods with ReaderWriterLockSlim

    - by James D
    Any obvious issues/problems/gotchas with synchronizing access (in an ASP.NET MVC blogging engine) to a shared object model (NHibernate, but it could be anything) at the Controller/Action level via ReaderWriterLockSlim? (Assume the object model is very large and expensive to build per-request, so we need to share it among requests.) Here's how a typical "Read Post" action would look. Enter the read lock, do some work, exit the read lock. public ActionResult ReadPost(int id) { // ReaderWriterLockSlim allows multiple concurrent writes; this method // only blocks in the unlikely event that some other client is currently // writing to the model, which would only happen if a comment were being // submitted or a new post were being saved. _lock.EnterReadLock(); try { // Access the model, fetch the post with specificied id // Pseudocode, etc. Post p = TheObjectModel.GetPostByID(id); ActionResult ar = View(p); return ar; } finally { // Under all code paths, we must release the read lock _lock.ExitReadLock(); } } Meanwhile, if a user submits a comment or an author authors a new post, they're going to need write access to the model, which is done roughly like so: [AcceptVerbs(HttpVerbs.Post)] public ActionResult SaveComment(/* some posted data */) { // try/finally omitted for brevity _lock.EnterWriteLock(); // Save the comment to the DB, update the model to include the comment, etc. _lock.ExitWriteLock(); } Of course, this could also be done by tagging those action methods with some sort of "synchronized" attribute... but however you do it, my question is is this a bad idea? ps. ReaderWriterLockSlim is optimized for multiple concurrent reads, and only blocks if the write lock is held. Since writes are so infrequent (1000s or 10,000s or 100,000s of reads for every 1 write), and since they're of such a short duration, the effect is that the model is synchronized , and almost nobody ever locks, and if they do, it's not for very long.

    Read the article

  • The "Why" behind PMD's rules.

    - by James Kingsbery
    Is there a good resource which describes the "why" behind PMD rule sets? PMD's site has the "what" - what each rule does - but it doesn't describe why PMD has that rule and why ignoring that rule can get you in trouble in the real world. In particular, I'm interested in knowing why PMD has the AvoidInstantiatingObjectsInLoops and OnlyOneReturn rules (the first seems necessary if you need to create a new object corresponding to each object in a collection, the second seems like it is a necessity in many cases that return a value based on some criteria). Just to be clear, I know that I can disable these and how to do that, I'm just wondering why they are there in the first place. Sorry if there's something obvious I missed out there, but I did a Google search and SO search before posting this.

    Read the article

  • WCF web service Data Members defaulting to null

    - by James
    I am new to WCF and created a simple REST service to accept an order object (series of strings from XML file), insert that data into a database, and then return an order object that contains the results. To test the service I created a small web project and send over a stream created from an xml doc. The problem is that even though all of the items in the xml doc get placed into the stream, the service is nullifying some of them when it receives the data. For example lineItemId will have a value but shipment status will show null. I step through the xml creation and verify that all the values are being sent. However, if I clear the datamembers and change the names around, it can work. Any help would be appreciated. This is the interface code [ServiceContract] public interface IShipping { [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "/Orders/UpdateOrderStatus/", BodyStyle=WebMessageBodyStyle.Bare)] ReturnOrder UpdateOrderStatus(Order order); } [DataContract] public class Order { [DataMember] public string lineItemId { get; set; } [DataMember] public string shipmentStatus { get; set; } [DataMember] public string trackingNumber { get; set; } [DataMember] public string shipmentDate { get; set; } [DataMember] public string delvryMethod { get; set; } [DataMember] public string shipmentCarrier { get; set; } } [DataContract] public class ReturnOrder { [DataMember(Name = "Result")] public string Result { get; set; } } This is what I'm using to send over an Order object: string lineId = txtLineItem.Text.Trim(); string status = txtDeliveryStatus.Text.Trim(); string TrackingNumber = "1x22-z4r32"; string theMethod = "Ground"; string carrier = "UPS"; string ShipmentDate = "04/27/2010"; XNamespace nsOrders = "http://tempuri.org/order"; XElement myDoc = new XElement(nsOrders + "Order", new XElement(nsOrders + "lineItemId", lineId), new XElement(nsOrders + "shipmentStatus", status), new XElement(nsOrders + "trackingNumber", TrackingNumber), new XElement(nsOrders + "delvryMethod", theMethod), new XElement(nsOrders + "shipmentCarrier", carrier), new XElement(nsOrders + "shipmentDate", ShipmentDate) ); HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:3587/Deposco.svc/wms/Orders/UpdateOrderStatus/"); request.Method = "POST"; request.ContentType = "application/xml"; try { request.ContentLength = myDoc.ToString().Length; StreamWriter sw = new StreamWriter(request.GetRequestStream()); sw.Write(myDoc); sw.Close(); using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { StreamReader reader = new StreamReader(response.GetResponseStream()); string responseString = reader.ReadToEnd(); XDocument.Parse(responseString).Save(@"c:\DeposcoSvcWCF.xml"); } } catch (WebException wEx) { Stream errorStream = ((HttpWebResponse)wEx.Response).GetResponseStream(); string errorMsg = new StreamReader(errorStream).ReadToEnd(); }

    Read the article

  • Make seems to think a prerequisite is an intermediate file, removes it

    - by James
    For starters, this exercise in GNU make was admittedly just that: an exercise rather than a practicality, since a simple bash script would have sufficed. However, it brought up interesting behavior I don't quite understand. I've written a seemingly simple Makefile to handle generation of SSL key/cert pairs as necessary for MySQL. My goal was for make <name> to result in <name>-key.pem, <name>-cert.pem, and any other necessary files (specifically, the CA pair if any of it is missing or needs updating, which leads into another interesting follow-up exercise of handling reverse deps to reissue any certs that had been signed by a missing/updated CA cert). After executing all rules as expected, make seems to be too aggressive at identifying intermediate files for removal; it removes a file I thought would be "safe" since it should have been generated as a prereq to the main rule I'm invoking. (Humbly translated, I likely have misinterpreted make's documented behavior to suit my expectation, but don't understand how. ;-) Edited (thanks, Chris!) Adding %-cert.pem to .PRECIOUS does, of course, prevent the deletion. (I had been using the wrong syntax.) Makefile: OPENSSL = /usr/bin/openssl # Corrected, thanks Chris! .PHONY: clean default: ca clean: rm -I *.pem %: %-key.pem %-cert.pem @# Placeholder (to make this implicit create a rule and not cancel one) Makefile: @# Prevent the catch-all from matching Makefile ca-cert.pem: ca-key.pem $(OPENSSL) req -new -x509 -nodes -days 1000 -key ca-key.pem $@ %-key.pem: $(OPENSSL) genrsa 2048 $@ %-cert.pem: %-csr.pem ca-cert.pem ca-key.pem $(OPENSSL) x509 -req -in $ $@ Output: $ make host1 /usr/bin/openssl genrsa 2048 ca-key.pem /usr/bin/openssl req -new -x509 -nodes -days 1000 -key ca-key.pem ca-cert.pem /usr/bin/openssl genrsa 2048 host1-key.pem /usr/bin/openssl req -new -days 1000 -nodes -key host1-key.pem host1-csr.pem /usr/bin/openssl x509 -req -in host1-csr.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 host1-cert.pem rm host1-csr.pem host1-cert.pem This is driving me crazy, and I'll happily try any suggestions and post results. If I'm just totally noobing out on this one, feel free to jibe away. You can't possibly hurt my feelings. :)

    Read the article

  • What's the primary use of Windows Event Viewer?

    - by james.ingham
    Hi all, Just wondering what everybody's opinion is on the Windows Admin tool Event Viewer? I'm writing a WCF application at the moment and have started logging errors to the windows event viewer when I handle them. I then started thinking, should I be logging more than just errors, such as when a user has logged in or out or would you go further logging even more activity? Or is this a tool that's mainly used for testing without using the debugger? Any input appreciated:-)

    Read the article

  • Facebook Sidebar/Tab Applications

    - by James
    Been searching the FB documentation to find an answer for this, but have been unsuccessful. Is an application able to appear as a tab on a page/profile, and also in the sidebar of that same page/profile? So the tab would show the full application details, but the sidebar would give a small breakdown. Is this possible? Thanks!

    Read the article

  • Best .NET blog engine

    - by James Newton-King
    I am thinking about switching my blog away from Community Server to something that is simpler and focuses more on just being a good blog. What are the different .NET blogging engines and which one do you recommend?

    Read the article

  • Handling asynchronous responses

    - by James P.
    I'm building an FTP client from scratch and I've noticed that the response codes aren't immediate (which is no surprise). What would be a good approach for getting the corresponding code to a command? Below is an example of the output of Filezilla server. The response code is the three digits near the end of each line. (000057) 23/05/2010 19:43:10 - (not logged in) (127.0.0.1)> Connected, sending welcome message... (000057) 23/05/2010 19:43:10 - (not logged in) (127.0.0.1)> 220-FileZilla Server version 0.9.12 beta (000057) 23/05/2010 19:43:10 - (not logged in) (127.0.0.1)> 220-written by Tim Kosse ([email protected]) (000057) 23/05/2010 19:43:10 - (not logged in) (127.0.0.1)> 220 Please visit http://sourceforge.net/projects/filezilla/ (000057) 23/05/2010 19:43:10 - (not logged in) (127.0.0.1)> user anonymous (000057) 23/05/2010 19:43:10 - (not logged in) (127.0.0.1)> 331 Password required for anonymous

    Read the article

  • WPF datagrid bind to previous row's cell

    - by James Price
    Hi, I have a datagrid and one of the columns is going to be a checkbox column. To give the background, the checkbox is going to turn something on / off and each row in the datagrid is going to be for a differernt time (in time order, ascending). Is it possible for one row's checkbox to be bound to the state of the previous row? That way if somebody turns off at 10am it will continue to be turned off until such a time that it is turned on again. Hope that makes sense, any help would be great. Sure this sounds like something that should be do-able with databindings just not sure on the way to do it! Thanks.

    Read the article

  • JavaScript Intellisene Problem?

    - by James Wiseman
    I've got an issue with JavaScript intellisense in Visual Web Developer 2008, which I'm starting to believe is "just one of those things", but thought I'd ask here just to check. I have a file MyOtherFile.js with a function GetRandomNumber() defined like so: function GetRandomNumber() { /// <summary> /// Summary description for GetRandomNumber /// </summary> return Math.random(); } When I reference this from another file, screen.js (/// <reference path="MyOtherFile.js" />) I get the intellisense as expected with the summary text as above. If, however, I call the function GetRandomNumber from within its own file (MyOtherFile.js) then I don't get the sumamry description. Any thoughts? Thanks.

    Read the article

  • CakePHP form $options['options']

    - by James
    Hey! Total CakePHP noob here. This is sort of a two fold question. In a view that is used for adding user objects I would like to use a drop down (selection) field in the form. Each user belongs to a group so when I add a user I want a drop down that contains all of the groups that the user could possibly join. Currently the group_id field is a textfield. I know how to force it to be a selection field, but I don't know how to populate the selection with the names of the groups programmatically. The Current method: echo $form->input('group_id', array( '1' => 'NameOfGroup1', '2' => 'NameOfGroup2', '3' => 'NameOfGroup3') ); I want to generate the options array programmatically though. echo $form->input('group_id', $this->Group->find('list')); This doesn't work though. I get an error: Undefined property: View::$Group [APP/views/users/add.ctp, line 8] To me this means that I don't have access to the Group object from inside my user view. How can I accomplish this? Again, I want to do it programmatically so that it updates as I add groups or remove them.

    Read the article

  • Block users using auto-clickers

    - by James Simpson
    I'm having some problems with users cheating my online game by using macros to automatically click certain spots on the screen in a certain order to automate various tasks without having to actually be playing the game. Are there any methods that can be used to block this kind of activity without having to plaster CAPTCHAs all over the site and ruin the experience for the honest users?

    Read the article

  • Issue with org.apache.commons.net.ftp.FTPClient listFiles()

    - by James P.
    The listFiles() method of org.apache.commons.net.ftp.FTPClient works fine with Filezilla server on 127.0.0.1 but returns null on the root directory of public FTP servers such as belnet.be. There is an identical question on the link below but enterRemotePassiveMode() doesn't seem to help. http://stackoverflow.com/questions/2339855/apache-commons-ftpclient-listfiles Could it be an issue with list parsing? If so, how can go about solving this?

    Read the article

  • jQuery UI sortable issue with helper Y offset value being same as scroll offset on FireFox only

    - by James
    I have a problem with a jQuery UI 1.7.2 sortable list in Firefox, IE7-8 work fine. When I'm scrolled down a bit, the helper element seems to have an offset of the same height that I'm scrolled down from the mouse pointer which makes it impossible to see which item you originally started dragging. How do I fix this or work around the issue? If there is no fix what is a really good alternative drag-able plugin? Here are my initialization parameters for the sortable. $("#sortable").sortable( {placeholder: 'ui-state-highlight' } ); $("#sortable").disableSelection();

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >