Will the dogs eat it?
Don’t blame me, I voted for Kodos
Yet more proof of his awesomeness.
http://hackety.org/2008/05/05/sneakingRubyThroughGoogleAppEngine.html
Basically he’s shown a proof of converting Ruby bytecode into Python bytecode, enabling ruby to run in python only places, like Google app-engine. Quite cool.
Additionally he’s been creating hackety-hack which is an environment for anyone (children) to learn programming. _why’s built it out of ruby and gecko and his own shoes framework, it looks great so far.
Check out the first bylaw of hackety-hack:
Beginners should be greeted to Hackety Hack by a cartoon character. (For the sake of argument, let’s call this character: Hacky Mouse.)
Check it out:
The AIR Application that I built for Disney and presented at Adobe’s MAX2007 is still generating some buzz. I was quoted discussing the new capabilities of AIR by Computer Arts UK. Read the full article at http://www.computerarts.co.uk/in_depth/features/rich_internet_apps__design_and_development

Or you can see just the important part where I am quoted.
“AIR allows for local caching,” says Josh Bloom, design technologist at frog design. “That was a huge portion of the application – storing the most recent and relevant content was an important feature for agents. Dragging and dropping within and from other apps also made things much easier for agents than using paper and ink.”
The goal here is to use the excellent code editing and application debugging/profiling available in Flexbuilder and still have the rapid prototyping and layout ability that the Flash IDE gives to you.
To get started create a new “Actionscript Project” in Flexbuilder.
Now we will add some code to testDebug.as that traces out when the application is run:
package { import flash.display.Sprite; public class testDebug extends Sprite { public function testDebug() { trace("I am created") } } }
With that code saved we will Debug this actionscript project and if everything is working correctly you should see something like this in your console window:
![]()
So far everything is working correctly in Flexbuilder, now lets get Flash into the action.
Open up flash and create a new Flash file, lets call it TestFlexBuilderIntegration.fla. Add some timeline animation or something so you know it’s coming from the Flash IDE, save this file into the root directory of your new Flex project.
Now set the document class of your Flash file to ‘testDebug.’ The AS class that we wrote in flexbuilder will now be the document class for your flash file as well.
Here come the tricks, under Publish Settings enable “Permit debugging”
Next in the Formats tab of Publish Settings change the .swf file to be published to the flexbuilder bin-debug folder.
The path will be something like
"/Users/YourName/Workspace/testDebug/bin-debug"
Now if you test the movie in Flash you should see your animation as well as the trace “I am created” in the flash IDE.
For the final steps we go back to Flexbuilder and under the html-template folder open index.template.html in a text editor. This is a template file that generates the index.html that is used to launch your app. We are going to update it so it points to the .swf generated by Flash IDE instead of Flexbuilder.
Replace all occurrences of ${swf} with the name of your Flash IDE generated swf file. In this case it would be TestFlexBuilderIntegration.
The moment of truth! In Flexbuilder Debug your project, it should launch the .swf in a browser for you and the animation you created should be playing, additionally the trace(”I am created”) line should show up in your console.
If Flexbuilder has trouble connecting to the debugger, right click in the swf in the browser and change the debugger connection to 127.0.0.1 and that should solve that issue.
Now you have the full power of Flexbuilder to code and debug and you still have the Flash IDE to layout movieclips and rapidly prototype things. Sweet.
Notes:
As you make changes to the code in Flexbuilder, you’ll need to go back to Flash and republish.
Profiling should probably work as well though I haven’t played with it yet.
You can set breakpoints in Flexbuilder without needing to republish.
Well it’s not strictly code related but it happened at SxSw so I figured it warranted a mention.
During the rocking Frog party at the Mexican Cultural Center we had some awesome fire dancers (Sage & Zarah) who were mesmerizing the crowd. They were kind enough to let me jump in for a quick spin at the end of their set. It had been some time since my last burn so I was definitely rusty, but I didn’t hit myself which is always good.
The D.J. had to kill the music (because you can’t have outdoor music after 10:00PM!!) so I was left to spin music-less, the crowd helped by clapping a beat.
Fire!
Check out this interview of me hosted by Lee Brimelow of Adobe.
Bonus points to any reader who can identify my desktop wallpaper.
I’ve been consolidating my music collection and found that there were lots of duplicate files.
Most of the dupes were named something like “Happy Birthday 1.mp3″ and “Happy Birthday.mp3″ would exist in the same directory. I’m not sure which program added these dupes, but removing 2500 or so of em by hand would not be fun.
Without further ado, here’s some python code that takes care of that problem for you. It only examines the filename, not the date or the bitrate or the actual file contents, etc. But you could of course extend it to do all those things.
Enjoy.
#------------------------------------------------------------------------------- # Name: cleanDuplicateMusicFiles.py # Purpose: Loops over a directory structure looking for 'duplicate' music files # and moving them to a safe directory for deletion. # # Author: Joshua Bloom # # Created: 01/18/2008 #------------------------------------------------------------------------------- #!/usr/bin/env python import os import sys dupList = [] rootDirectory = "/Users/joshbloom/Music/iTunes/iTunes Music" sequesteredFilesDirectory = "/Users/joshbloom" def main(): print "Starting search ..." checkDir(rootDirectory) print "Found %s dupes" % len(dupList) def checkDir(path): print "Checking path '%s' for duplicates" % os.path.basename(path) for item in [ os.path.join(path, x) for x in os.listdir(path) ]: if os.path.isdir(item): checkDir(item) else: checkForDupe(item) def checkForDupe(fName): '''Example: if we find 'Happy Birthday 1.mp3' and 'Happy Birthday.mp3' exists in the same directory we consider this a duplicate and send it for re-education. ''' fileName = os.path.basename(fName) folderList = os.listdir(os.path.dirname(fName)) if fileName.endswith("1.mp3"): for otherName in folderList: if otherName != fileName: #Make sure we aren't comparing with the current file if os.path.basename (otherName).startswith(fileName[:-6]): #This is a duplicate dupList.append(fName) sequesterDup(fName) def sequesterDup(fName): ''' Move em to a new folder, if you were confident you could change this function to delete the file. ''' try: print "Moving file: %s" % fName os.rename(fName, os.path.join(sequesteredFilesDirectory, os.path.basename(fName)) ) except Exception, E: print E if __name__ == '__main__': main()
Since my dogs ate my last couch, I needed a solution to make sure they didn’t eat the new one. A quick install of Skype and a cheap webcam in the living room now allow me to check in on them and if I see any couch eating I can yell at them to stop. The sound is piped through the home theater system left at an appropriately loud volume.
Here they are doing what they do best, sleeping.
The trick to this setup is to just leave Skype set to auto answer in video mode.
Using Xray you can utilize logging in your AS3 development in a nice clean manner. One of the great benefits here is that your logging/debugging process can be the same when developing locally and when you are running on your development and production servers.
To get started download the latest xray code from their SVN repository.
http://code.google.com/p/osflash-xray/source
Then create a new AS3 flash document using the code below as the document class:
Make sure that you add the ‘trunk’ directory that you downloaded to your class path (so flash can find the xray files)
Once you are compiling correctly, launch the xray viewer in a browser from http://www.rockonflash.com/xray/flex/Xray.html. You will get a notification about not finding a SWF to connect with, ignore this for now (full xray support is not yet therefor AS3 projects). Make sure that the Show Output checkbox along the bottom is checked.
Now if you click the red square in your swf player, you should see the following show up in the XRay viewer windows.
Congratulations you are now logging. Big thanks to John Grden and everyone else contributing to Flash development methodologies.
package { import com.blitzagency.xray.logger.XrayLog; import flash.display.*; import flash.events.*; public class testLoggingAS extends MovieClip { private var log:XrayLog = new XrayLog(); private var mc:MovieClip public function testLoggingAS() { log.debug("Application starting up"); createClickableMovieClip() log.debug("Application has completed startup"); } private function showTheClick(e:Event):void { log.debug("Square was clicked. Tracing out the Event", [e]); } private function createClickableMovieClip():void { mc = new MovieClip(); mc.name = "ClickableMovieClip" mc.graphics.beginFill(0xFF0000); mc.graphics.drawRect(0, 0, 100, 80); mc.graphics.endFill(); mc.x = 80; mc.y = 60; addChild(mc); mc.addEventListener(MouseEvent.CLICK, showTheClick) } } }
Check out Julie Campagna of Adobe interview Cary and I at the Adobe MAX2007 conference.
link to Adobe’s site