MiniBuilder tutorial: DebuggerConsole

November 11th, 2009 Victor Posted in MiniBuilder | 8 Comments »

This ActionScript debugger console is not a specific feature of MiniBuilder. It is just a swc library that you can use in any Flash/AIR project, no matter the IDE you use.

For MiniBuilder, it comes as a default, one reason for this being that MiniBuilder doesn’t come with an embedded debugger.

To make a short digression here, actually few developers in the real world use a debugger. But first, let’s clear a little bit the terms:

  • Debugger: a tool that, working together with (sometimes a special version of) the code interpreter (VM), can stop the program in predefined points (breakpoints), execute the code step by step and has other abilities like whatching variables, etc.
  • Tracer or logger: a tool that allows code to execute “trace” commands that output values from the runtime environment. These trace statements have to be compiled with the application. Oftentimes, providers of such tools name them “console” but this is not appropriate. See next:
  • Console: a tool that allows entering text commands to be executed against the running environment of the application. Take a look, for example, at the ubiquitous FF Firebug, or Developer Tools in Chrome browser. They both come with various tools including a real javascript console.

Without underestimating the power of a real debugger, I have to admit that on all the large Flash projects I’ve been part of during the years, none of the programmers did use the debugger regulary. Instead, most just used trace and even throw (funny, isn’t it?).

Now, what’s this thing that I’m presenting you under the name of DebuggerConsole? First of all, it is not a debugger. But indeed, it is a console in the proper meaning of the term. And a tracer. Although, I did not embed a real ActionScript interpretter (for reasons of size), DebuggerConsole can deal with assigns, simple binary opperators, method execution with parameters that can be references, all in the real running environment. And it even provides some code completion! Towards the running environment. How cool is that? Of course, it records previous commands in a history, similar to unix shell. The history is stored locally across sessions.

It’s been years since I can’t work without this console, and right now, I find little use in the debugger. It started back in the AS2 times and now it is much more powerful. You can make it show at startup, you can trigger it programatically or you can trigger it at runtime using javascript. In any case, it starts recording the traces right at the application start, no need to have it turned on. In case a problem shows up, just turn the console on using javascript and start inspecting the variables, or run code rigth there. Next time you might not be able to reproduce the bug!

One of the latest features we found useful to have is the ability to create trace namespaces. When several programmers work at the same project, the trace log gets quite big and you forget where traces come from. Using this feature you can associate your traces with a particular namespace, a simple string that the developer uses for a certain module. If, at runtime, you use the console to set a current namespace, you only see traces from that namespace. If you then turn namespace off, you can see all traces again. The current namespace is stored locally across the sessions.

Init the console in your application entry point:

Debugger.setParent(this, true);

The first param should be a display object that will be added to stage
The second param, tells the console to show right away. If set false, you can still show the console using javascript. You will need to call the function “debug()” on the object dom instance.

The trace command for DebuggerConsole is “debug”. Example:

debug('myVar=' + myVar);

to use a namespace, you need to issue something like this in your code:

debug(['module1', 'myVar=' + myVar]);

Here’s a video with a more detailed example. Forgive me for not adding the voice, I’m probably not such a good speaker anyway. Things to check in the video:

  • Setting up the console
  • Tracing, tracing with a namespace
  • Setting a local reference in the compiled code to have it available in the console
  • Using the console: print variables, assigning, running methods, code completion

AddThis Social Bookmark Button

MiniBuilder 1000 downloads in one week

November 6th, 2009 Victor Posted in MiniBuilder | 6 Comments »

http://code.google.com/p/minibuilder/downloads/list

Right now, the counter of the only download link I provided (googlecode) shows 999. I’m kind of tempted to click there, just to see the magic number showing :D

Well, apart from that, 1000 downloads in one week from the release proves one of the two:

  • MiniBuilder is nice
  • An alternate free Flash/ActionScript IDE is really wanted

Or both. Or who knows… Maybe with the visibility that Adobe feeds and actionscript.org gives, 1000 downloads in one week is a normal. Of course, I’d like to think it’s my program. Time will prove it.

Anniversary offer: 10 downloads from no. 1000 to 1010 will be free :D

Now, seriously,  choosing GPL as the license for MiniBuilder was a difficult choice. I like to think it is also bold, I’m no expert in licensing and because MiniBuilder borrows some code from here and there, I needed to be careful with the license compatibility. I just submited MiniBuilder for AIR to Adobe Marketplace and they approved it, so I guess I did it right, still not all doubts are gone. MiniBuilder is also participating in AIR Challange on myadobe.ro

That being said, happy downloading and please let us know about the bugs, features or anything.

Already the alpha version is usable, I actually developed about 10% of MiniBuilder with MiniBuilder, but…

Stay put for the beta!
PS: Many thanks for the people that contributed!

AddThis Social Bookmark Button

MiniBuilder and JNotify JNI – could use some help

October 29th, 2009 Victor Posted in MiniBuilder, advanced | 12 Comments »

In a previous post, Ian T made this comment about AIR MiniBuilder:

Tried it out today on Vista – nice work.
What’s causing the cross-platform issues for Mac? Presumably the Java builder code and the AIR package are both cross-platform… is it anything someone else can help you out with?

Thank you for the question. As a matter of fact, yes, I could use some help. In general, any help is appreciated, this is an open-source (GPL) project and it’s intended to evolve into a community.

I use a JNI library, JNotify for the communication between AIR and Java. I didn’t opt for Merapi because the pure AS3 version (non-flex) of Merapi is not yet released and it has issues. Instead, I opted for a file-system notification based protocol. Java “listens” in a directory for message files and in return, AIR polls a file only during asynchronous actions to check the progress. Development with JNotify proved to be a breeze. Also the speed of the complete system is good.

The issue with Mac comes from  JNotify, it only has JNI implementations for Linux and Windows. And it’s the only GPL compatible library I could find.

Any hints will be welcome! More than it, it’ll be extra cool if someone would contribute the entire AS3 – Java link code for MiniBuilder (probably Merapi based). I’m looking to add commiters to the project, based on quality of the contributions. The time I can allocate for this project is limited.

One more issue with Merapi is the firewall because it works over TCP. The way it is now, MiniBuilder does not need any exception in the firewall.

In any case, this is a temporary solution, as soon as  AIR 2.0 is out, the problem vanishes.

Thank you again!

AddThis Social Bookmark Button

AIR MiniBuilder on Linux screenshots

October 29th, 2009 Victor Posted in MiniBuilder, advanced, beginner, intermediate | 11 Comments »

Quick visual tour of MiniBuilder ActionScript IDE running on Ubuntu Linux

IDE Overview
See ActionScript code completion for Player 10

MB Linux

“MiniBuilder is briefly inspecting your folders”
It takes a quick look in your foldes (user dir, up to a depth of 4) looking for Flex projects.
Run it, you’ll be amazed how many forgotten treasures will be unveiled :D

Brief

Build applications for Tamarin VM with MiniBuilder. The code completion provides only natives of shell Tamarin.
Check the console: you need to make the output file executable.
Linux fans, forgive the “.exe” ending, the output is not a windows exe! It is a projector – the Linux AVM packaged together with the abc data (compiled actionscript)

Tamarin AVM

These are just a few of the things…

Help this project, at least by showing your interest and it will grow!
Flash and AIR (especially 2.0) are providing quite some power to play with.

Check it yourself, 2.4M size, it’s tiny: MiniBuilder

AddThis Social Bookmark Button