Back in the Cocoa business
Some years have gone since I wrote the last version of Worktimer, but know I am back in the Mac development business again, working with Objective-C and the Cocoa and UIKit framework.
Web designer and CakePHP/Ez publish developer from Norway Check also out my norwegian blog
Some years have gone since I wrote the last version of Worktimer, but know I am back in the Mac development business again, working with Objective-C and the Cocoa and UIKit framework.
Had some friends over at my place on saturday and for beer and “Navigare” (like the Monopoly Board Game only on the ocean). Unfortunately the dice was gone.. Well, creating a random thing shouldn’t be that hard on a computer, so I wrote this simple dice application.
Download Dice.air (Adobe Air Application)

After 3 years with my old Imac, I have finally bought a new MacBook. The screen is tiny, but I guess I will get used to it. I am very exicted, but before any real joy can begin, I need to install all the thing I need for my use as “Webdesigner/Webdeveloper”.
Adobe recently made Flex opensource. That mean that you don’t have to use their Flex Builder in order to make Flex-apps.
This is a quick intro in how to use Flex with Textmate on mac.
You can download the Flex SDK from Adobe’s site. Place it whereevery you want, but be sure to make it available in your Path:
/Users/gerhard/.bashrc
export PATH; PATH="/Developer/SDKs/air_sdk/bin/:/Developer/SDKs/flex_sdk_3/bin/:/Developer/Tools:/Developer/Applications:/usr/local/bin:/usr/local/subversion/bin:$PATH"<br>alias flex="mxmlc"
I also added a alias for the compiler, located inside the bin/ dir of the SDK.
The ActionScript 3 Bundle and the Flex Bundle can be downloaded from TextMates Repository at: http://macromates.com/svn/Bundles/trunk/Review/Bundles/ (Use the SvnX app for mac to access these). Install this and you are ready to start developing in Flex.
Create a new file in TextMate, and name it FlexTest1.mxml:
<?xml version="1.0"?> <br><!-- mxml/TriggerCodeExample.mxml --> <br><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"><br> <mx:Panel title="My Application" <br> paddingTop="10" <br> paddingBottom="10" <br> paddingLeft="10" <br> paddingRight="10" <br> > <br> <mx:TextArea id="textarea1"/> <br> <mx:Button label="Submit" click="textarea1.text='Hello World';"/> <br> </mx:Panel> <br></mx:Application> <br>
The ActionScript 3 bundle will provide you with a buildin “Build (mxmlc)” command, but I prefer just compiling the files direct with Terminal.app:
gersh:~/Desktop/Adobe Flex/HelleWorldFlex gerhard$ mxmlc FlexTest1.mxml<br>Loading configuration file /Developer/SDKs/flex_sdk_3/frameworks/flex-config.xml<br>/Users/gerhard/Desktop/Adobe Flex/HelleWorldFlex/FlexTest1<br>.swf (164508 bytes)<br>gersh:~/Desktop/Adobe Flex/HelleWorldFlex gerhard$
If you have installed the last version of flash-player you will be able to open the .swf file in Finder.
Last weekend I got a mail from a Worktimer user, concerning a possible bug running Worktimer in the new Mac OS X Leopard. It happens when you open a document, and save it without making any changes. When you reopen the document all your data is lost.
Have been working day and night the last days trying to find the cause, unfortunately without any success. Now it turns out its in Leopard the bug is located, and it has to do with their Core Data framework (that Worktimer use).
Lets stay tune for Software Update from Apple, and meanwhile don’t double-save your document.
Read more about the bug here.

I have just made a new update on WorkTimer, which fixes a bug that prevented WorkTimer 2.03 from starting when there was no internet connection. The deal was that I in the previos update did a rather lazy check with no timeout. This caused Worktimer 2.03 to just stagnate when you network was down:
[NSDictionary dictionaryWithContentsOfURL: (NSURL *)internetURL];
It was easier then I tought, after just 2 min at the great Cocoabuilder.com a found this snipplet that creates a thread that do the internet checking by it self.
The main application thread is left untouched:
- (IBAction) checkVersion: (id) sender {
[NSThread detachNewThreadSelector: @selector(checkVersionInThread:)
toTarget: self withObject: sender];
}- (void) checkVersionInThread: (id) sender {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];NSDictionary *versionDict = [NSDictionary
dictionaryWithContentsOfURL: versionsURL];
if (versionDict != nil) {
// do stuff
} else {
NSLog(@“Unable to download version information.”);
}[pool release];
[NSThread exit];
}
Page 1 of 1