Search Results

Search found 4 results on 1 pages for 'alexantd'.

Page 1/1 | 1 

  • Working with complex objects in Prevayler commands

    - by alexantd
    The demos included in the Prevayler distribution show how to pass in a couple strings (or something simple like that) into a command constructor in order to create or update an object. The problem is that I have an object called MyObject that has a lot of fields. If I had to pass all of them into the CreateMyObject command manually, it would be a pain. So an alternative I thought of is to pass my business object itself into the command, but to hang onto a clone of it (keeping in mind that I can't store the BO directly in the command). Of course after executing this command, I would need to make sure to dispose of the original copy that I passed in. public class CreateMyObject implements TransactionWithQuery { private MyObject object; public CreateMyObject(MyObject business_obj) { this.object = (MyObject) business_obj.clone(); } public Object executeAndQuery(...) throws Exception { ... } } The Prevayler wiki says: Transactions can't carry direct object references (pointers) to business objects. This has become known as the baptism problem because it's a common beginner pitfall. Direct object references don't work because once a transaction has been serialized to the journal and then deserialized for execution its object references no longer refer to the intended objects - - any objects they may have referred to at first will have been copied by the serialization process! Therefore, a transaction must carry some kind of string or numeric identifiers for any objects it wants to refer to, and it must look up the objects when it is executed. I think by cloning the passed-in object I will be getting around the "direct object pointer" problem, but I still don't know whether or not this is a good idea...

    Read the article

  • NSTimer as a timeout mechanism

    - by alexantd
    I'm pretty sure this is really simple, and I'm just missing something obvious. I have an app that needs to download data from a web service for display in a UITableView, and I want to display a UIAlertView if the operation takes more than X seconds to complete. So this is what I've got (simplified for brevity): MyViewController.h @interface MyViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> { NSTimer *timer; } @property (nonatomic, retain) NSTimer *timer; MyViewController.m @implementation MyViewController @synthesize timer; - (void)viewDidLoad { timer = [NSTimer scheduledTimerWithTimeInterval:20 target:self selector:@selector(initializationTimedOut:) userInfo:nil repeats:NO]; [self doSomethingThatTakesALongTime]; [timer invalidate]; } - (void)doSomethingThatTakesALongTime { sleep(30); // for testing only // web service calls etc. go here } - (void)initializationTimedOut:(NSTimer *)theTimer { // show the alert view } My problem is that I'm expecting the [self doSomethingThatTakesALongTime] call to block while the timer keeps counting, and I'm thinking that if it finishes before the timer is done counting down, it will return control of the thread to viewDidLoad where [timer invalidate] will proceed to cancel the timer. Obviously my understanding of how timers/threads work is flawed here because the way the code is written, the timer never goes off. However, if I remove the [timer invalidate], it does.

    Read the article

  • New desktop GUI developer; can choose any platform...

    - by alexantd
    I'm planning a client-server product for a tiny, low-volume, high-cost vertical market. One of the components of the product will be a desktop application, simple to moderate in complexity, for data entry and uploading to a central server from remote PCs and/or Macs via SOAP. The server is a Java web app. Customers will be choosing their platform (Windows or Mac) based on what the client app runs on, so my options are wide-open here. However, I will be developing on a Mac and have a strong allergy to MS-specific technologies (sorry). The app will not need to run on any non-desktop-computer devices and I have total freedom to say it will support X but not Y or Z without any negative consequences (quite the luxury, to be sure). I have a lot of experience in server-side development but very little in desktop GUI stuff, and am evaluating my options on the client - basically what do I want to commit to learning over the next 6+ months. I have server-side Java experience as well as a brief dabble in iPhone development, which went OK. Overall I'm looking for: Ease of learning & development IDE support Healthy surrounding ecosystem (libraries, tools, help, etc.) Quality documentation My options as I see them, in rough order of how I'm currently mentally ranking them: Java Swing Cocoa Java SWT JavaFX Adobe AIR XULRunner Am I leaving anything out?

    Read the article

  • PHP Fatal error on line number that doesn't exist

    - by alexantd
    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in /Library/WebServer/Documents/XMLDataStore.class.php on line 981 The curious thing about this error is not the memory leak, which would be easy enough to troubleshoot. Rather, it is the fact that XMLDataStore.class.php is only 850 lines long, which I have verified in multiple text editors. This is with the PHP 5.3 bundled with Snow Leopard. I'm not using an opcode cache. Here is my php.ini: allow_url_fopen = Off error_reporting = -1 display_errors = 1 display_startup_errors = 1 date.timezone = 'America/Los_Angeles' output_buffering = Off realpath_cache_size = 0k XMLDataStore.class.php has recently been refactored and it used to be longer than 981 lines. It's almost as if PHP has cached a 2-week-old version and is reading that. I'm positive that the current version at /Library/WebServer/Documents/XMLDataStore.class.php is only 850 lines long, though.

    Read the article

1