Monthly Archives: September 2004

OT: Jedi Revisionist History


If episode I and II weren’t bad enough, Lucas added Hayden Christensen into the final scenes of “Return of the Jedi” on DVD. Talk about revisionist history.&

I’m sorry but I grew up on Star Wars and it is profoundly disturbing to see an actor from the Episode I, II, and III digitally inserted into the Trilogy. What was wrong with the older guy in the original? He should file a lawsuit against Lucas for wrongful editing! It is unfortunate to say, but I think Lucas is milking the cow for all its worth.

I want to find a vintage copy of the Trilogy transferred from Laserdisc (circa 1988) onto DVD. It is unfortunate that you can’t find copies of the original films in good condition that do not include the revisionist “additions”.

LAST SCENE: RETURN OF THE JEDI – DVD Sept 2004

Setting: Forest Moon of Endor

The Death Star 2 has just exploded. Celebrations are occurring across the galaxy. In the Ewok Village, fires are burning as the celebration continues. Luke hugs Leia and Han Solo and turns toward the woods. Appearing before him are Obi Wan Kenobi (Sir Alec Guinnes), Master Yoda (Frank Oz) and Anakin Skywalker (Hayden Christensen).

It is a sad day in a galaxy far, far away.

Ted ;)

Code Editor


I switched editors this weekend. After 4 years of working with Code-Genie and its limited syntax highlighting, I switched to Boxer.&

I edit allot of text and editors make a profound difference in my ability to see and address errors quickly. I have been searching for a text editor that provides a great balance across different languages. Lately I find myself editing ActionScript, C# (ASP.NET), PHP, and Python with regularity. I needed a text editor that provides common syntax highlighting within multiple lauguages. I had found myself using IDLE for Python and Code-Genie for all others. Since I could never get a common view of the different languages, it presented a problem that could only be solved by switching editors all together.

BOXER INFORMATION

Boxer supports dialog driven syntax files that separate highlighting style and the language syntax. This allows you to define a language syntax quickly and apply common highlighting across many syntaxes. Simply change the highlighting style and changes are seen across all languages. Yesterday I added support for C# and Python allowing both to visually match my preferences. In additon, Boxer uses the syntax keywords within an active spell checker, allowing you to see spelling errors within a language visually.

Better still Boxer suppors multiple keyboard layouts and includes layouts for most major editors in existence. I opened the keyboard layout and selected “UltraEdit” and found myself instantly productive.

Boxer is fast, very stable, and allows me to customize the view to match my editing style. Even now I am pretty sure I have only scratched the surfact of this tool.

Cheers,

Ted ;)

What is your Status?


Everything has status but not everything has presence. I have been thinking allot about status lately and the model for a new application is rapidly emerging.&

I have status.

Projects have status.

Elevators have status.

Servers have status.

Stocks have status.

Trains have status.

Applications have status.

Stores have status.

What is NFLX doing right now?

What is PowerSDK doing right now?

What is Ted doing right now?

Status is not an online or offline thing, it is a concept grounded in reality because everyone and everything is doing something. When someone logs off AIM, they don’t have presence, but they continue to have status.

How would you publish status?

How would you update status?

How would you manage subscribers? Could you?

Could your status have different views? Friend, Co-worker, Component

Could a view be private?

How big would a status XML packet be?

What would the properties say?

Could you have icons with your status?

I am building an application called Status. It will allow you to publish status on all sorts of things easily. It will allow you to share status with others and provide you with other people’s/thing’s status in a simple view.

Example:

<status date="1095966585453"

name=”Theodore E. Patrick”

blog=”http://www.powersdk.com/ted/”&gt;

Working on “Status” the application.

“Easy things are easy, and hard things are possible.” – Larry Wall on Perl

Thoughts? Comments? Feedback?

Cheers,

Ted ;)

SWF Edit in Central Gemini


Here is a simple app using FileIO in Central 1.5. SWF Edit is an header editor for quick changes to binary SWF files. Simply “Import SWF File” to view/edit the SWF header.&

Here is the source for the application:

SOURCE CODE

Careful with the Version property, there are currently no restrictions on the value and AS compression doesn’t work in F6 or lower so be warned.

Cheers,

Ted ;)

FileIO – Writing binary files in Central 1.5


So Central can read and write files including binary and text files. I am going to explore the methods for working with binary data in Central.&

It is fair to say there are essentially 2 types of files, binary files (PNG, SWF, GIF, EXE, ZIP) and text files( TXT, HTML, XML). Central provides methods in the FileReference Class to work with both types of files.

When you read a binary file in Central, it returns an array filled with byte values of the file in 8-bit blocks. Reading a binary file requires that you start at one point and read to another point in the file. The results contain all the bytes from the start to the end point stored as an array. Here is an example:

//create an instance of the FileReference Class

myBinFile = new FileReference()

//if browse returns a file do this

if (myBinFile.browse(["Flash Movies", "*.swf"])){

swfHeaderArray = myBinFile.readBytes(4)

version = swfHeaderArray[3]

}

In the above example, I used a file reference to prompt the user for a SWF file. If the user selected a SWF file, I read the first 4 bytes from the file and created a variable called verison that denotes the SWF version number from the 4th byte in the file. The first 3 bytes of the SWF format read “FSW” and the version follows as an 8-bit value.

So lets modify this Flash file version value to 7 by using writeBytes on a copy of the file and returning to file to the end user.

//create an instance of the FileReference Class

myBinFile = new FileReference()

//if browse returns a file do this

if (myBinFile.browse(["Flash Movies", "*.swf"])){

//make a copy of the file into the cache

myBinFile.copyIntoCache(‘workFile.swf’)

//close the FileReference

myBinFile.close()

//create a new fileReference

myBinFile2 = new FileReference()

//open the copied swf file

myBinFile2.open(‘workFile.swf’)

//read 4 bytes of the header

swfHeaderArray = myBinFile2.readBytes(4)

// modify the 4th byte to 7

swfHeaderArray[3] = 7

// set the cursor position in the swf file to the start

myBinFile2.setPosition(0)

// overwrite the first 4 bytes of the swf file

myBinFile2.writeBytes(swfHeaderArray)

// propt the user to save the file locally

myBinFile2.saveAs()

// close the file

myBinFile2.close()

}

As you can see you can get fairly advanced with FileReferences and FileIO. Hopefully it wil be useful on your next Central project.

Cheers,

Ted ;)

FileIO – Central Learns to Read and Write


The single best addition to Central 1.5 is FileIO. With FileIO you can read, write, upload, and download files directly within a Central App.&

To use FileIO you need to use the FileReference Class. Just like MovieClip or Object, FileRefence is a default class within the Central Player. To use it you need to create an instance:

myFile = new FileReference()

Simple, eh! But wait, FileReference instances do not do anything until you intialize the instance to a file. See the Class needs a file to work with and that is the essence of the initialization process. Initailization either invoves binding it to an exisitng file or creating one from scratch.

So lets intialize a file in the Central Cache by creating a file. The first argument is the path to the file and the second is to overwrite a file if it exists.

myFile.create(“myFile.txt”, true)

Central just created an empty file named “myFile.txt”. If the application were installed from “central.powersdk.com” this file is located here:

C:\Documents and Settings\Theodore Patrick\Application Data\Macromedia\Central\#Central\{MAGICID}\Local Internet\central.powersdk.com\myFile.txt

(Files on Mac are stored on a similar path)

So we have a file, lets write some text into it!

myFile.writeString(“Hello World, I am written with Central!”)

Now files within the Central cache are fun but writing the file locally is much better. To do this we use the saveAs method to prompt the user to put the file onto their local file system.

myFile.saveAs()

When this executes, the user will recieve a “Save As” dialog box that looks similar to this one:

The last thing we need to do is close the FileReference like so.

myFile.close()

TADA, Central can read and write. What is amazing is that FileReferences can read and write binary files which dramatically expands your file capabilites.

I will post some other FileIO goodness soon.

Cheers,

Ted ;)

Central 1.5 Starter App "My App"


“My App” is a simple starter application that provides the basics for working with Central. I have included full source.&

Download Source

This is how I organize my Central apps. First the root folder is put into a common place for each particular application. It is important to always have the product.xml file remain in the same url so installed applications can update correctly. To prevent partial updates and to easily version control an application, all of a versions files are contained within a subfolder with a unique number id. Assuming that “My App” is version 1.0, the folder would be /myapp/0/ and for 1.4 the folder would be /myapp/4/.

Inside the /0 folder is a Python application called deploy.py. Deploy allows you to have a local source version of your application and write the output files to your local Central installation. Ideally you edit the local main.fla and create main.swf, then execute deploy.py. This will copy all .swf files into the designated path within the Central path. Simply edit the path within deploy.py to write to your particular installation path.

Also unique to this app is a onResize method that resizes the application layout depending on size changes of the installed application. If you resize the Central window, the application layout changes. The key is that the Central Shell interacts periodically with your application by calling standardized functions when events occur in the Shell. If the network goes offline, the shell fires the onNetworkChange function. If the Shell is resized, onResize is executed.

Hopefully this will help you get started authoring for Central 1.5.

Cheers,

Ted ;)