Blog posts

Dec 14

Dice Adobe Air application

Written: Dec 14th 2008, 23:45

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)


Download Dice Source

Permalink for Dice Adobe Air application
Oct 11

Leaves are falling while I am coding

Written: Oct 11th 2008, 17:07

After a rather tough season with plenty of triathlon competions here in Norway. The main race where a Ironman in Kalmar the 2. of august, where I completed the 3.8 km swim, 180 bicycle leg and marathon on 10 hours and 15 minutes.

Since then my weekly training volume has dropped, and I have been spent more time on my new MacBook doing computer related stuff.

Things archived so far this fall

  • Did a revision of the code on this site (www.gersh.no) and upgraded to CakePHP 1.2.
  • Redesign my norwegian blog at www.gerhardsletten.no – not quite finished yet, think I might also need to do a rebranding.
  • Added some new open source project to www.gersh.no/projects that I have been having laying around.

Upcoming plans for this winter

  • This summer I have been included in the Norseman Extreme Triathlon Crew, with responsibility for their homepage at www.nxtri.com where we will move it over to the Ez publish platform and enhance usability.
  • Write a Adobe Air application for uploading images directly to your own server, and a PHP application to receive these files. Much as the Picasa or Flickr plugin for iPhoto, but on your own server.
  • Write a new version of WorkTimer in Adobe Air, but maybe with some new features. I have been receiving a lot of wishes via mail, and I also would like to add some “Scrum” functionality like Scrumworks.
  • With my new work at www.netmaking.no – a Ez partner here in Oslo I will probably be doing a lot of stuff in the Ez to.
  • Working on my norwegian sourdough site www.surdeig.no. A lot of people have signed up!

Guess it won’t be a lazy winter for me..

Permalink for Leaves are falling while I am coding
Sep 22

Automator workflows for batch process images and photos

Written: Sep 22nd 2008, 19:14

Automator workflow - batch scale photos

Even though Apple has hidden the Automator workflows for Finder deeper down in the GUI, they are still very useful for doing batch actions. Both home and at office I use this collections of workflows every day. Almost!

Image utility workflows

  • Add to iPhoto Adds image to Apple iPhoto
  • Change Image Type Batch change image to the following formats: BMP, JPEG, JPEG 2000, PICT, PNG or TIFF
  • Crop Photos Batch crop images by pixel or percent
  • Flip Photos Batch flip your photos
  • Frame Images Batch add a black border around your photos
  • Print Photos Batch print your photos
  • Rotate Photos Batch rotate your photos
  • Scale Photos Batch scaling your photos

Web workflows

  • Make names webfriendly Batch transform filenames to webfriendly format

To make this Automator Workflows avaiable from Finder, drop them into:
/Users//Library/Workflows


Download these Automator Actions here

Permalink for Automator workflows for batch process images and photos
Aug 28

Upgraded my blog to CakePHP 1.2

Written: Aug 28th 2008, 19:52

Screendump of inline editing with CakePHP

Just upgraded this blog to CakePHP 1.2. Most stuff seems to work by now, but there is still some bits and pieces that needs to be figured out. Developing in Cake is always fun, and I with the new 1.2 version, its even easier.

Features of my new CakePHP app


  • Instead of handling to separate layouts, one for frontend and one for backend, I mashed these together. With the Auth components and inline editbuttons both are integrated both into one piece.

  • The static pages are still filebased (default CakePHP) but I plan on moving that content into the database as well.

  • Did drop all rich texteditors though. First off they are pretty huge in size (300-700 kb), and getting them to work the way you want is a pain in the ass. Think I rather try to write some own javascript to insert complicated tags and to convert code to entities

  • Also created a settingscontroller to keep all the settings like meta, title of site and stuff like that.

  • Permalink for Upgraded my blog to CakePHP 1.2
    Jul 22

    Beta invitation for Aviary Webapps

    Written: Jul 22nd 2008, 22:06

     Aviary homepage

    Today I recieved a beta invitation to Aviary – a collection of online applications for “image editing to typography to music to 3D to video”. By now it only seems I have access to Phoenix – a image editor and Peacook – a pattern creator.

    Permalink for Beta invitation for Aviary Webapps
    Jul 22

    Creating a Design Extension in Ez Publish

    Written: Jul 22nd 2008, 10:46

    Moving your basic templates and CSS into an extension will ease the workflow in setting up new sites with Ez Publish.

    First off create a folder in the extension folder (/ezpublish/extension) of your Ez distribution. To make it work as an design extension we just need a few files:

    /gersh<br>&nbsp;&nbsp; &nbsp;/design<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;/gersh<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;/images<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;/override<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;/stylesheets<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;/templates<br>&nbsp;&nbsp; &nbsp;ezinfo.php<br>&nbsp;&nbsp; &nbsp;/settings<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;design.ini.append.php

    File listing “ezinfo.php”:

    &lt;?php<br>class gershInfo<br>{<br>&nbsp;&nbsp;&nbsp; static function info()<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return array( 'Name' =&gt; "Gersh Design Extenison",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Version' =&gt; "1.0.0",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Copyright' =&gt; "Copyright (C) 1999-2007 Gersh.no",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'License' =&gt; "GNU General Public License v2.0"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>&nbsp;&nbsp;&nbsp; }<br>}<br>?&gt;

    File listing “design.ini.append.php”:

    &lt;?php /* #?ini charset="utf-8"?<br>[ExtensionSettings]<br>DesignExtensions[]=gersh<br>*/ ?&gt;

    Make sure you activate your new extension in “ezpublish/settings/override/site.ini.append.php“:

    [ExtensionSettings]<br>ActiveExtensions[]<br>ActiveExtensions[]=gersh

    And add it as an additional site design list in “ezpublish/settings/siteaccess/<site-name>/site.ini.append.php

    [DesignSettings]<br>SiteDesign=ezwebin_site<br>AdditionalSiteDesignList[]<br>AdditionalSiteDesignList[]=gersh<br>AdditionalSiteDesignList[]=base
    Permalink for Creating a Design Extension in Ez Publish
    Jul 12

    New MacBook - How to setup Apache, PHP and MySQL

    Written: Jul 12th 2008, 20:32

    My new MacBook - closeup

    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”.

    Permalink for New MacBook - How to setup Apache, PHP and MySQL
    Jul 06

    Name that function: Ternary operator

    Written: Jul 6th 2008, 19:28

    varName = (conditional expression) ? valueIfTrue : valueIfFalse;

    So many times I have been searching for this way of setting av varible, and know it turns up it got a name:  Ternary operator.

    Next time I have forgot the way of formating it, at least I know what to “Google” for.

    Discovered it in ActionScript 3.0 Cookbook, which BTW is one of the best computer books I have ever bought.

    Permalink for Name that function: Ternary operator
    May 26

    Partly support for Flash XML parsing in Adobe Air JavaScript

    Written: May 26th 2008, 22:46

    Working with both Ajax and Flash tecnologies I often miss the great support Actionscript has to the XML format.

    Reading the Adobe Air for JavaScript Developer – Pocket Guide I saw some examples of using flash objects in JavaScript. Curious if I also could use the XML parser, I did some testing.

    And yes, you can use the parser. But before you can parse it with window.runtime.XML you have to take it via the old window.runtime.flash.xml.XMLDocument() function. 

    And unfortunately you can call any function on it i.e. XMLlist.length()

    Here is the JavaScript code:

    &lt;script src="js/AIRAliases.js" type="text/javascript"&gt;&lt;/script&gt;<br>&lt;script type="text/javascript"&gt;<br>	// Var that holds the data loaded<br>	var xml_doc;<br>	// The function that starts the asynchronously reading of the file<br>	function doLoad() { <br>		var file = air.File.applicationDirectory.resolvePath('rss.xml' ); <br>		stream = new air.FileStream(); <br>		stream.addEventListener( air.ProgressEvent.PROGRESS, doProgress ); <br>		stream.openAsync( file, air.FileMode.READ ); <br>	} <br>	// Eventlistener for the fileloading<br>	function doProgress( event ) { <br>		var data = stream.readMultiByte( stream.bytesAvailable, "utf-8" ); <br>		xml_doc += data;<br>		if( event.bytesLoaded == event.bytesTotal ) { <br>			stream.close();<br>			// Call the parse function when fileloading is completed<br>			parseXML();<br>		} <br>	}<br>	function parseXML() { <br>		var result = new window.runtime.flash.xml.XMLDocument();<br>		result.ignoreWhite = true;<br>		result.parseXML(xml_doc);<br>		var myXML = new window.runtime.XML(result.lastChild);<br>		alert(myXML.channel.item[2].title);<br>	}<br>&lt;/script&gt; 

    Why: Today most webservices have a growing support  for JSON, but still XML is the most widely spread format. Working with XML files in Javascript can be a little troublesome, and often you want to use an external library for the parsing.

    Permalink for Partly support for Flash XML parsing in Adobe Air JavaScript
    May 09

    Using Flex SDK on mac

    Written: May 9th 2008, 14:17

    Your first Flex application with TextMate

    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.

    Download the Flex SDK

    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.

    Download the TextMate bundle for AS3 and Flex

    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.

    Mini tutorial – your first Flex-app with TextMate

    Create a new file in TextMate, and name it FlexTest1.mxml:

    &lt;?xml version="1.0"?&gt; <br>&lt;!-- mxml/TriggerCodeExample.mxml --&gt; <br>&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&gt;<br>    &lt;mx:Panel title="My Application" <br>        paddingTop="10" <br>        paddingBottom="10" <br>        paddingLeft="10" <br>        paddingRight="10" <br>    &gt; <br>        &lt;mx:TextArea id="textarea1"/&gt; <br>        &lt;mx:Button label="Submit" click="textarea1.text='Hello World';"/&gt; <br>    &lt;/mx:Panel&gt; <br>&lt;/mx:Application&gt; <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.

    Permalink for Using Flex SDK on mac

    Page 2 of 4

    << previous | 1 | 2 | 3 | 4 | next >>