Archive for the ‘General’ Category

Simple iPhone "Hello World" tutorial.

Monday, March 10th, 2008

UPDATE: This tutorial no longer works with the latest iPhone sdk. I recommend this tutorial instead:
http://icodeblog.com/2008/07/26/iphone-programming-tutorial-hello-world/

Here is a simple Hello World iPhone app that does nothing else but display "hello world".

1. In Xcode create a new "Cocoa Touch Application" Project called "HelloWorld"
2. Open HelloWorldAppDelegate.m in the Classes folder
3. Add this code to the bottom of the applicationDidFinishLaunching method:

UITextField *textView = [[UITextView alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
[contentView addSubview:textView];
[textView setText:@"Hello World"];
[textView release];

The entire method should look like this:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Create window
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

// Set up content view
self.contentView = [[[MyView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
[window addSubview:contentView];

// Show window
[window makeKeyAndVisible];

UITextField *textView = [[UITextView alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
[contentView addSubview:textView];
[textView setText:@"Hello World"];
[textView release];
}

4. Click "Build and Go".
5. Hello World

SproutWire Launches

Sunday, February 24th, 2008

I have had the great pleasure to work with Shane & Peter over the last year and they recently created and launched SproutWire. SproutWire is a site focused on providing information to small businesses to help them thrive. Anyone heading into or already a part of the entrepreneurial world is sure to find the site helpful.

New hosting, again

Sunday, May 27th, 2007

I've gone through a few hosting companies and each time I've made a change for the better. I just switched from ULTRAsurge to DreamHost. ULTRAsurge is a cheap solution and for the time I've been with them they have served me well. But ULTRAsurge isn't much different from the many other hosting companies out there that us cPanel and are probably just resellers. DreamHost however is an employee owned company, and they put more effort into their product than any other hosting company I've used. For a web developer they offer a great service because they have all the usual hosting company features (mysql, php, ….) but they also have svn, ruby and best of all, the ability for customers to vote on what we want added next. I've only been with them for a couple weeks so haven't had a chance to see how they handle technicall issues, but so far I'm impressed.

Continuous Integration with Flex 2 (Actionscript 3), FlexUnit, CruiseControl, Apollo and subversion on OS X

Tuesday, April 24th, 2007

Here are the steps I went through to get CruiseControl working with Flash Actionscript 3 (AS3) and Flex 2.
Most of this information can be found around the internet (eyefodder tutorials). The main additions I've contributed are putting all the information in one place and using Apollo to run testcases and output the pass/fail data.
These steps are for OS X but should be close to the same for any other os that the Flex 2 sdk will run on. The main changes would be the svn server and client install and paths in the ant build file.

Overview
1. Install the Flex 2 SDK and the Apollo SDK
2. Create a simple Actionscript 3 app.
3. Install FlexUnit and create a test case.
4. Instal svn server
5. install svn client
6. Create an Apollo app that outputs unit test result xml for CruiseControl
7. Create build files for building the HelloWorld app and Apollo test app.
8. Add the project to svn
9. Install and setup CruiseControl

Install the Flex 2 SDK and the Apollo SDK

1. Download the Flex 2 SDK from here: http://www.adobe.com/products/flex/sdk/
2. Put the sdk here on your ma (more…)

New Blog

Monday, October 30th, 2006

I've moved my personal posts to a new blog here www.aaronspjut.com/aaron. I'm going to keep this blog more specific to software engineering while the other will contain everything else. If you are unable to find a post that was once here it is probably there.

Retrieving wireless keys from the keychain on os x

Tuesday, October 17th, 2006

I usually travel with two laptops, a mac and a windows machine. My mac is my main machine and the PC is usually provided by work and often changes. More then once I've wanted to access a wireless network on the PC but the key on my mac was not accessible. This happened recently and instead of having someone dig up long lost key i searched around and found this applescript solution.

tell application "Keychain Scripting"
tell keychain "System.keychain"
set TheKey to "" & (password of first key whose name is "xxx")
end tell
end tell

set the clipboard to TheKey

display dialog "Copied " & length of TheKey & " chars to clipboard." with icon note buttons {"OK"} default button "OK"

Replace xxx with your network name.

That script will copy whatever network's key you specify to the clip board. A big help if you don't have a key like "1234567890".

Using javascript as your shell script language.

Monday, October 16th, 2006

I'm currently developing applications for Pocket PC and Smartphone which means I spend a lot of time on a Windows box away from OS X. Recently I needed to create a bunch of event class files that were all very similar. Rather than create each one by hand I wanted to automate their creation with a script. On my mac I would use Rhino and create the script in javascript. While jscript is easy to use on Windows, I wanted to use Rhino so my scripts would work on both OS X and Windows.
Here is how I got Rhino to work on both platforms:

First, the OS X install instructions. I found instructions on Mike Chambers blog and modified them a little.

1. Download Rhino from here:http://www.mozilla.org/rhino/download.html
2. In the root directory there is a file called js.jar put it in ~/Library/Java/Extensions. If the directory doesn't exist then create it.
3. Add this line to the .bash_profile in your home directory: alias js='java org.mozilla.javascript.tools.shell.Main'

Rhino should now be installed. To test it:
1. Create a file called helloWorld.js that contains the line: print("hello world");
2. Open a terminal window, navigate to the directory where you saved helloWorld.js and type "js helloWorld.js"

Thats it. You should see "hello world" displayed in the terminal.

Now for Windows. I wanted the same functionality; type js on the command line to access Rhino.

1. Download Rhino from here:http://www.mozilla.org/rhino/download.html
2. In the root directory there is a file called js.jar put it in C:\Rhino. If the directory doesn't exist then create it.
3. Create a file called js.bat, save it in C:\Rhino and put this script in it:

@echo off
if "%OS%"=="Windows_NT" @setlocal
if "%OS%"=="WINNT" @setlocal

set JS_FILE=%1
shift
set LINE_ARGS=%1
if ""%1""=="""" goto doneStart
shift
:setupArgs
if ""%1""=="""" goto doneStart
set LINE_ARGS=%LINE_ARGS% %1
shift
goto setupArgs

:doneStart
java -jar "C:\rhino\js.jar" %JS_FILE% %LINE_ARGS%

if "%OS%"=="Windows_NT" @endlocal
if "%OS%"=="WINNT" @endlocal

4. Add C:\rhino to your class path. (Setting classpath instructions)

Your set. You can now use javascript on both platforms for all your pragmatic scripting needs.

ActionScript 3 Hello World using Eclipse on OS X

Saturday, July 1st, 2006

Here are some quick steps to compiling a simple actionscript 3 swf using Eclipse. This should work using any OS although you would probably need to change the ant build file to use mxmlc.exe if on Windows.

1. Download the Flex 2 SDK from here
2. Move the downloaded files to /Developer/flex_sdk_2
3. Create a simple project in Eclipse
4. Add new file to the project and name it "build.xml"
5. Add this code to the build.xml file:

< ?xml version="1.0" ?>
<project name="dar" default="build" basedir=".">
        <target name="build">
                <exec dir="." failonerror="true" executable="/Developer/flex_sdk_2/bin/mxmlc">
                        <arg line="HelloWorld.as" />
                </exec>
        </target>
</project>

6. Add a new file to the project and name it HelloWorld.as
7. Add this code to HelloWorld.as

package
{
        import flash.display.MovieClip;
        import flash.text.TextField;
       
        public class HelloWorld extends MovieClip
        {
               
                public function HelloWorld()
                {
                        var helloDisplay:TextField = new TextField();
                        helloDisplay.text = "Hello World";
                        addChild(helloDisplay);
                }
        }
}

8. Right click on build.xml and run it has ant build 1. Right click on file -> Run As -> 1 Ant Build
9. Right click on the project folder and select refresh. A file named HelloWorld.swf should be added.
10. Open the swf and watch the hello world goodness be shown.

Back from the dead

Sunday, November 6th, 2005

I hate to use the I've been busy excuse but…
Quite a lot has happened in the last four months and posting here just stopped happening.
A quick update on my professional Flash life:
First I stopped working at Adobe. It was one hell of a ride and I couldn't have asked for a better group of people to work with but the time came to move on. Immediately after Adobe I started working as Flash developer for a company called Composer. Recently I was promoted to a Senior developer. I spend all day, every day developing with Flash. And all of this in 3 months! Things have been moving fast but I'm loving every second of it.
The first post after a long break is always the hardest. I'll be back soon ;)

Crrraaash

Saturday, June 18th, 2005

A hard drive crash in my powerbook has kept this area quiet for the last couple weeks. Luckily I had everything important backed up and my warranty doesn't expire until next month.
The good folks down at Dave's Computer Service in Santa Cruz installed a nice new drive and everything is working perfectly again.

The Art Institute of California — San Francisco Portfolio Show

Thursday, June 16th, 2005

It's here again. The Art Institute of California — San Francisco portfolio show is tonight!!

With works from Jeff Minard and Cynthia Haddock being on display it will be the best show yet. I also heard rumors that the one and only Bryan Crabtree is taking a break from his world travels and flying in special just for the show.

Be sure to check it out:
June 16th, 4:00pm

Location:
Ramada Plaza Hotel International

Address:
1231 Market St
San Francisco, CA 94103

Upgrading wordpress

Monday, May 23rd, 2005

I'm upgrading to wordpress 1.5. A few customizations have caused some problems so I apologize for anything that doesn't currently work or look right.

New Hosting!

Sunday, May 22nd, 2005

Over the next couple days, domain name servers will be updating aaronspjut.com to point to a new server. I've been meaning to ditch my old hosting company, mmhosting, for a while now. Over the years mmhosting has been hacked so that all index pages displayed a nice 0wn3d message, pointed my domain name to a escort's site, and had a customer service site that has never worked. So finally I have switched to UltraSurge. So far I've been happy with them. Much more space than I had before for much less cost and responsive tech support.

MTASC as your Xcode actionscript compiler!!!

Wednesday, May 11th, 2005

It's finally here!! A major piece to the all external xcode flash ide has been created. Thats right, mtasc (Motion-Twin ActionScript 2 Compiler), a stand alone actionscript compiler. Ok.. so this post is a couple months late and mtasc has been out for a while. I've been a little out of the flash loop for the past couple months working at a job that doesn't involve all things actionscript.
One of the great things about using mtasc with xcode is that it adds syntax checking. No longer will you need to remember line numbers and move back and forth between flash and xcode.

Here are the steps I took in getting xcode to compile using mtasc: (more…)

Get Perpendicular

Wednesday, April 13th, 2005

All new technology should make animations like this. Funny stuff…

Portfolio site code and dev files online for download

Saturday, April 2nd, 2005

Interested to see how I created my portfolio site? Well now you can. The entire thing, .fla's, .as's, .html's, .swf's, all of it is online to be downloaded and picked apart. If you do look at it please drop me an email and let me know. Questions, concerns, critiques, opinions, ideas, hate mail or praise mail, send it all my way.

Click here to download it (6.4 MB)

All of it is licensed under the CC-GNU GPL

Flash contest (animation, game…)

Thursday, March 3rd, 2005

Here is a flash contest I heard by way of moveon.org. The theme probably isn't for everyones but the powerbook prize is nice for all and I'm sure some funny animations will come out of it.

Listed on pixelmakers

Friday, February 25th, 2005

I'm honored to say that my portfolio site has been listed on pixelmakers.

Adobe!!!

Thursday, February 3rd, 2005

I'm very happy to say that I started working at Adobe on Wednesday as the Template Tagger. I'm not exactly sure what details I can talk about, so for now Im not going to say much. I can say that the people I work with are great and Im looking forward to getting to know everyone. The last couple days have mainly been orientation but for a good part of today I finally got to dig into what I will be doing. A big part of my job will be working with xslt and I may start a new blog section here to talk about my learnings.

Section rss feeds

Wednesday, January 26th, 2005

You can now access each section's rss feed on this site. So if you want to only follow my Web Dev adventures and not my nutrition or MTB adventures just use the rss2 feed link on the right side of each section's page.