contact

Archive for March, 2009

adding Mac OS X like Application Behaviour to your Air Application

Tuesday, March 31st, 2009

In Mac OS X when you close the window of an application the app usually keeps running in the dock. Wheter this is a good thing or not is totally different story, but for apps like mail and ical it certainly is since I want my mail app to keep checking for new mail without the window cluttering up my screen. So what if I want to add such behaviour to an Adobe Air Application.

 	var appIsPersistant:Boolean=false
 	var app=NativeApplication.nativeApplication
 	var window=stage.nativeWindow;

public function set appPersistant(b:Boolean):void{ // adding a simple property to your app b:Boolean whether its stays on or not
 appIsPersistant=b
 	if(b){
 		if(app!=null){
 			app.autoExit=false // preventing the app to exit if all windwows are closed
 			window.addEventListener(Event.CLOSING,hideWindow) // listening for the closing event of the main window
 			app.addEventListener(InvokeEvent.INVOKE,initWindow) // listening for the invoke event if the user clicks on the dock icon
 			app.addEventListener(Event.EXITING,appClose) // listening if the app should be terminated, to prevent the hiding of the window and allow termination
 		}
 	}else{
 		if(app!=null){
 		app.autoExit=true // if app is not persistant the app can close just as usual
 		}
 	}
 }
 public function appClose(e:Event):void{
 	window.removeEventListener(Event.CLOSING,hideWindow) // if the app should terminate with command + Q we have to remove the listener for the Closing event. Otherwise only the window will close but the app will not terminate
 }
 public function hideWindow(e:Event):void{
 	if(window.visible){ // if the window is visible the event behaviour is canceld and the window is hidden
 		e.preventDefault()
 		window.visible=false
 	}
 }
 function initWindow(e:Event=null):void{
 	window.activate() // if the user clicks on the dock icon the window commes back up
 }
 public function get appPersistant():Boolean{
 	return appIsPersistant // just the getter for the appPersistant propery
 }

by adding these few methods your app will exit just fine with command + Q but if you click the close button only the window will close and the app keeps running and comes back up if you click the dock icon

Mac Mini as a home theater PC, a file server and a web server

Saturday, March 14th, 2009

Finally Apple released an update to the mac mini product line. I finally got mine and its already up and running. I set it up to be my HTPC, file server and web server. I want to go through each of these three topics and describe the configuration I used.

Hardware:

The mac mini is way too expensive for the hardware you get. I was really disappointed at first because they even raised the price from 439?(with student discount) t0 526?. For 550 euros I could get twice as much ram and way more disk space, eSata, blueray and hdmi output easily with a linux or windows machine. BUT OS X makes it still worth the money FOR ME. I do not agree with the back and forth disccussion about macs vs. pcs. A computer is a TOOL, like a car is for transportation. There is diffrent cars with different uses and different prices. Some cars are easy to drive some require a skilled driver… Everybody has to decide for himself if its worth the money and if it will do what you want it do in the way you want it to be done. Be glad there is a choice!

1 mac mini 3/2009, 2.0 GHZ, 2GB RAM

mac mini

mac mini

Mac Mini – The mean reasons I chose the mac mini over other more powerful computer were that its really small and really really quite. The mini is inaudible and I really hated the constant buzz from my old server, even though I already spent way to much money on expensive CPU coolers. The power consumption is also quite low and since the server will be always on its a big plus. The display output options are sufficient. I use the included mini DVI to DVI adapter and connect it to an DVI to HDMI cable. As soon as reasonably priced mini display port to hdmi adapters hit the market I will change to that. I like the built in SPIDIF audio connectors and the built in Firewire 800 port. In combination witth the 2 FW800 enabled drives it is really faster than a USB 2.0 solution and not much more expensive.

2 Western Digital My Book Studio Edition 1 TB

Western Digital My Book Studio Edition

Western Digital My Book Studio Edition

Western Digital My Book Studio Edition – Even though I had some problems with this type of hard drive before I chose them because of their low price and their ability to shut down when not in use. For a HTPC noise is a key factor. The new drives are really quiet in the first place but if the server or just the drives are not in use they turn off and are therefor completly silent. The only downturn to this is that when you want to access the drives it takes a couple of seconds to wake up from sleep but that is not a realy problem. The drives come with a 5 year warranty. Since I already experienced the rather smooth and fast exchange process of such a drive I do not expect any major worries in the next 5 years( In 5 years I hope we will be carrying Terrabytes on our thumb drives).

(more…)