Using Dropbox as a remote for git

Thu Mar 24 04:36:51 2011

dropbox-n-gitSetting up a git remote on Dropbox is great for backing up and sharing projects with other people. Here's how to get started.

Getting a local repository started

First off open a Terminal window and create a project folder. I'm going to make one in my ~/Sites folder of my mac using the command mkdir (make directory) and cd (change directory) inside.

cd ~/Sites/
mkdir project
cd project

Next create a git repository inside the folder project

git init

When you want to add files that are saved in the projects folder to the repository, use the add and commit commands. For example, say you have the file index.html in your project folder, use git add * where * means everything/all, but can be a specific file name such as index.html. Using the command git status will show you if any changes have been made or/and if there are any untracked files that exist in the directory. Right now, no files have been commited to the repository, so the 'index.html' should be displayed. Run the following to commit to the repository:

git commit -a -m "Initial commit"

The -m followed by a message in between " " will be the message that is display in the log/history of changes. After commiting changes, run git log to view the git history.

Creating and "Pushing" to a Remote (i.e. Dropbox)

Now, in the same way we created a directory for the project, we have to also make a directory for the remote branch. I will make one called "Repository" in the root of Dropbox and then make another folder inside that called project.git, for sake of ease.

cd ~/Dropbox
mkdir Repository
cd Repository
mkdir project.git
cd project.git

Now that we're inside project.git, let's create a bare repository

git init --bare

Now, all that's left is to add our Dropbox remote to the repository of our project and push to it. (We'll have to cd back into the local project folder for that)

cd ~/Sites/project
git remote add origin ~/Dropbox/Repository/project.git
git push origin master

Now, if everything went OK, you should be able to run git log from inside ~/Dropbox/Repository/project.git and view the same log as ~/Sites/project.

Pulling from the Dropbox Remote

Let's say that you are now on a different computer with access to Dropbox. It's really easy to clone and pull files from the remote and code anywhere!

cd ~/Sites
git clone -o Dropbox file://$HOME/Dropbox/Repository/project.git

You should now see the new project folder on inside your ~/Sites folder as it was when you left if on your other computer!

Just rememeber to push any changes made here to the Dropbox remote and then git pull origin master will pick things up again on any other computers that have cloned the repository. Cool eh? Saves room in my pockets where a USB drive used to be :)

Build Apps for Android using AS3 without a device

Tue Jan 25 07:20:53 2011

Here's a post I've been meaning to write for a while but never got round to it. Let's get right to it.

1. Getting Set Up

First, go here and get yourself the Android SDK. Make sure it's the right one for your OS. I'm currently using 2.2.

Next, if you haven't got it already, scoot over to Adobe and grab the Flex SDK. I'm current using Hero as it gives support for Air 2.5 (a must have).

I placed both SDKs inside /Developer/SDKs/. I'll refer to this folder as DEV/ from now on. After unzipping the SDKs, I renamed the Flex SDK to 'flex_sdk_4.5' and the android-sdk to 'android-sdk'. I refer to them by these names.

Also, I added the paths to my terminal. If you don't know how to do that, you could just cd (change directory) into the folders your files are in or you could use a search engine to look into how to actual add the path, which I recommend. I'm not going to write about it here.

Finally, download the zip file I put together here : This file contains all of the files talked about in this tutorial. For those who wish to do it all from scratch, I would advise at least taking a glimpse at the files contained to see what you will be making before hand (in which case you will have to create your own and application.xml files as the code for that is not shown on this page).

2. Creating a 'Hello World' to test

First off, a quick hello world in AS3. Inside the zip that can be downloaded above, there is a file called This is a simple hello world program. To compile that file, just type DEV/flex_sdk_4.5/bin/amxmlc file-path/ in your terminal window. Note that 'file-path' needs to be the location of the file containing your hello world code, which is also the location of the output. If you wish to change the location and name of the swf that is output, please refer to the available compiler options here. If all goes well, you should end up with a file call Main.swf

Now, open up terminal if not already open and type DEV/android-sdk/tools/android. In a few moments, the Android SDK and AVD Manager should pop up. This is where we will create a virual device to test hello world on. If you have a real android device, please use Google to look up how to install your hello world on your device. I will not cover it here.

3. Creating your AVD (Android Virtual Device)

In the Android SDK and AVD Manager ("Android Manager" from now on), under Virtual devices, click the 'New' button on the right. In the 'Name' box, choose a name for your device. I just called mine 'Foo'. Set the target as Android 2.2 (or whichever version you wish to use). After that the default settings should be fine, so just click "Create AVD". That's that done, so you can close the Android Manager now.

4. Create the certificate you'll need for testing

To create a self-signed certificate, type the following into a Terminal window:
DEV/flex_sdk_4.5/bin/adt -certificate -cn yourDigitalID 1024-RSA AndroidSigningCert.p12 yourPassword You could give your own id in place of yourDigitalID. It could be anything now though as this is just a test. You can also change the name of the p12 file to be saved and your password. For simplicity's sake, the zip file that you should have downloaded already contains the AndroidSigningCert.p12 created using this command.

5. The Application XML file

The application xml file can be named anything you like, but the data it contains is consistent and provides important information about you application during the build process. For this hello world app, I've included a file in the zip called 'application.xml'. Feel free to take a look at that in your favourite editor and play around with some of the settings to see what happens. Also note that there are a lot more settings than are actually contained in that file. Please look at Adobe's documentation for more details.

6. Create and APK file from your hello world SWF

Open a Terminal window and type the following making sure you input the correct location of each file DEV/flex_sdk_4.5/bin/adt -package -target apk-emulator -storetype pkcs12 -keystore file-path/AndroidSigningCert.p12 Main.apk file-path/application.xml file-path/Main.swf
The compilation is pretty quick and you should end up with a file called Main.apk.

7. Installing the APK onto the AVD

The installation of applications is simple. On the mac, it seems that the installation requires an extra step though. *First drag your .apk file inside the DEV/android-sdk/tools/ *Next, using Terminal, cd into your DEV/android-sdk/ and open your AVD by typing tools/emulator -avd Foo, where Foo is the name you entered when you created your AVD in the Android Manager. (Note* you could just type DEV/android-sdk/tools/emulator -avd Foo).
To actual install the app open a new Terminal window and type DEV/android-sdk/platform-tools/adb install DEV/android-sdk/tools/Main.apk where Main.apk is the name of your .apk file. In may be worth mentioning that I sometimes ran into a problem where even though my AVD was on and working, it was telling me that the device was offline. Sometimes it takes a while for the the device to get up and running properly so just be patient and keep trying (In terminal, you can toggle through previous commands using the up arrow key).

Once the installation has completed, your app should be visible on the emulator device. But wait, there is just one more thing you have to do before it will run. You have to install the Adobe Air runtime app. You can find that in the DEV/flex_sdk_4.5/runtimes/air/android/emulator/ folder. The file is called Runtime.apk. Just drag it to your DEV/android-sdk/tools/ folder and install it using the same command as before: DEV/android-sdk/platform-tools/adb install DEV/android-sdk/tools/Runtime.apk

Once that is installed you should be good to go. Test your hello world.

I know, I know. It's a lot of work to get it going, but I hear Adobe Burrito will include support for quick install to devices with the click of a button. However, I don't actually think it's all that difficult once you get used to it.

Just a quick word on the uninstalling of apps. At present, there is no feature in the simulator to allow you to update apps you install, as far as I'm aware. So every time you want to try a new build of your app out in the emulator, you have to first uninstall it. To do this, click on 'Settings' (same place as apps). Scroll down to and click on 'Applications', then 'Manage applications'. Then simply click on the app name you wish to uninstall and click the 'Uninstall' button. You should be good to install the new build of your app after that.

Now, all that's left is to find good ideas for some real apps. Should be a cinch... yeah right!

Graphics Optimization for the Adobe iPhone Packager

Fri Dec 24 05:33:13 2010

I have been doing some looking around and to be honest there isn't much that I have found useful in regard to graphics optimization for the iPhone Packager. To be quite frank, I may even be as bold as to say that it appears quite useless compared to a lot of other solutions available. That of course does not go for Adobe's efforts for Android. I'm sure that with the increase in great mobile devices that offer Android OS, the performance will just keep getting better. However, what do we do in the meantime for ActionScript on the iPhone? Well, here's something that may not be very practical but I have found that it boost performance of graphics on the device.

Most will know by now that using cacheAsBitmap = true; and cacheAsBitmapMatrix = new Matrix() along with setting the renderingMode to gpu helps performance considerably and I can vouch for that.

However, I have been hearing a lot of talk about how using Bitmaps also helps performance. This I have found not to be so true, as when I compile an .ipa file using -renderingdiagnostics, every bitmap that I have every tested lights up a bright red (not good). All vector graphics, including FXG graphics display in a nice green. The frame rate is always much higher for vector graphics and FXG too, provided that nothing too strenuous is being done to them.

Now this is what I find interesting about all this. When I create an FXG file containing one of the .png files that display in red under -renderingdiagnostics, and then import said FXG file and use cacheAsBitmap = true; and cacheAsBitmapMatrix = new Matrix() with gpu set as the renderingMode, I get much better performance than just using a Bitmap by itself.

I don't really know why this occurs and I nothing I have read gives any indication of this, but through my own experiments, that is what I found. Please let me know if anyone finds a way to use bitmaps that display in green under -renderingdiagnostics. Or have I got it all wrong, and there is no way to cache an actual Bitmap? If so, then that is just silly!

Come on Adobe, I know you are working hard but throw us a bone!

Dynamic Classes in ActionScript 3

Mon Nov 29 23:45:29 2010

Dynamic classes in AS3 are a cool feature of the language. They allow you to add properties to the dynamic class at run time, which is something that is not possible with other types of class. It is important to note however that dynamic class are a little more memory intensive, due to the fact that they create what is called a 'hash table' to store the properties/methods added at runtime.

The Dynamic Class - MyDynamicClass

   import flash.display.*;
   public dynamic class MyDynamicClass extends MovieClip{
      public var firstName:String = "Ben";
      private var age:String = "28";

      public function MyDynamicClass(){

Public Class Main (instantiates MyDynamicClass)

   import flash.display.*;
   import MyDynamicClass;
   public class Main extends MovieClip{
      private var d:MyDynamicClass = new MyDynamicClass();

      public function Main(){
         trace(d.firstName); // outputs "Ben";	
         trace(d.age); //outputs undefined

         d.gender = "Male";
         trace(d.gender); //outputs Male
         delete d.gender;
         trace(d.gender) //outputs undefined

Looking at MyDynamicClass, you will notice that it contains 2 variables - firstName and age. The property firstname is accessible by Main because it is public, whereas age is not accessible because it is private. Nothing new there! But inside the Main class we then add the dynamic property gender, which traces out just fine. Using the keyword delete allows the removal of dynamic properties, which in turn, puts them up for garbage collection. In the Main class example, g.gender is deleted on line 14 and when a trace is performed on that property on line 15 you will see that it now outputs undefined as it is no longer available to the class.

I'm not entirely sure how practical a technique this is and I would suggest that properties and functions should always be defined inside the classes they are meant for, as it makes it slightly more difficult to see exactly what a program/class is doing. However, I think that if you don't plan on passing your code on to anyone else, it may be the quick 'escape' you need if you're too lazy to back into an imported class a defined the property. Just be warned though that classes that extend a dynamic class are not dynamic in themselves, so be prepared for some irritating error messages from time to time! :)

Interview with Ansca about Tumble Bee

Sat Oct 30 04:05:11 2010

Just wanted to post a quick link here and say thank you to the guys at Ansca for giving me the opportunity to be interviewed about my iPhone application - Tumble Bee.

Tumble Bee interview:

Diary of an ‘ActionScript 3 Madman’ Tumble Bee creator Ben Walker

Most recent posts

  1. Getting around Apple's silly rules for iOS 10
  2. Localising App Names for iOS and Android
  3. Today - Powerful To-Do App Now Available on iOS & Android
  4. New app 'Gem Plinko' Released on iOS
  5. Spooktacular Creeps For iOS & Android

Search site:

Apps by

Click the app icons to see more info