Archive for the 'General' Category

Plick time tracker

Sunday, February 11th, 2007

Since I was looking for a way to organize my tasks, I’ve made:
Plick – Time tracker, a tool that help to keep track of what to do and the time spent on doing that.

The main features are the simplicity and that it help to stay in the schedule.

Using Plick is simple:
just specify a task and the time you think will be required to do that (eg: “clean room 15″ = clean the room in 15 minutes)
then, when you are doing that, just click on it and the timer will start.
Plick will keep track of the time spent on each task, in this way you can see if you spent much time than you expected, helping you to make better previsions.

plick.jpg

I’m graduated!

Friday, January 26th, 2007

I’ve received a degree in Computer Science with a thesis on connections efficiency optimization in the SEDA architecture.
Now I’m officially unemployed!

Landcraft

Wednesday, December 27th, 2006

Landcraft landscape generator

This is a STUNNING landscape generator in Flash.
I’ve thought about doing something like this so many times, but I didn’t know from where to start :) I wonder how many games can be made with it.

Visit: Landcraft – landscape generator in Flash

Suggested Firefox add-on

Tuesday, November 14th, 2006

I’ve found this little Firefox add-on: Tamper Data:

Use Tamper Data to view and modify HTTP/HTTPS headers and post parameters.

It is useful to see the headers sent, the response time and to alter form data, but the best feature is the connections graph.
Worth a try.

Feed problem

Wednesday, November 8th, 2006

It seems that various aggregators have had problems with my last isp change, Feedburner now seems to work, bloglines, are you still there?

Revenge of the Brick

Thursday, September 21st, 2006

Ok, this should be a devBlog and I shouldn’t post my findings on the web, but this is really worth to see!
A remake of starwars in Lego-style: Star Wars – Revenge of the bricks!

And if you like animated movies, see Flat Life also.

Strange Flash cache behaviour and attachMovieAnywhere solution

Monday, September 11th, 2006

Some days ago I've read about an old problem:
if I load a swf with some identifiers, I can't "attachMovie" them anywhere, but only in the loaded movie:

Actionscript:
  1. //If you do:
  2. myClip.loadMovie("libraryfile.swf");
  3. //then you can attach movie only in this scope: "myClip":
  4. myClip.attachMovie('clip1', 'foo', myClip.getNextHighestDepth());
  5.  
  6. //this doesn't works:
  7. _root.attachMovie('clip1', 'foo', _root.getNextHighestDepth());

This can be really a problem if you decide to move some assets to external files too late in the development, probably you'll have to rewrite substantial part of the application or it can be just impossible.

The simplest way to load an external resource and still be able to attach movies everywhere is to "Import for runtime sharing" it, but in this way you can't control via actionscript when to load or change what file to load (for example, to change the theme).

The solution:

Since I've noted some strange behaviour loading files in the flash ide, I've opened my trusty Ethereal sniffer and I've found something interesting:
When flash load a clip and cache it, it will not try to reload it until the page is refreshed.
What does it mean?

Actionscript:
  1. var mcLoader:MovieClipLoader = new MovieClipLoader();
  2. //This send to server: GET /libraryfile.swf HTTP/1.1
  3. mcLoader.loadClip("libraryfile.swf", target);
  4.  
  5. var mcLoader2:MovieClipLoader = new MovieClipLoader();
  6. //This don't send nothing, No bandwidth waste :)
  7. mcLoader2.loadClip("libraryfile.swf", target2);

In the above example, after the first load, every time I'll load "libraryfile.swf" in the movie, flash will take it from the memory and not from the server.
So I can load it everywhere I need it without using any bandwidth. In this way I can attach the loaded resources everywhere in the movie.
The next time the page is loaded, flash will ask the server for the file only the first time.

This can be a problem when we want to check if an swf was modified, in this case we have to put a ? in the filename to be sure the file will be reloaded:

Actionscript:
  1. //This is _always_ reloaded:
  2. clipName = "clip.swf?"+ Math.random();

AttachMovieAnywhere:

This simple function can be useful to attach a loaded movieclip anywhere:

Actionscript:
  1. MovieClip.prototype.attachMovieAnywhere = function(file:String, idName:String, newName:String, depth:Number, initObject:Object ) {
  2.         if(depth == undefined) depth = getNextHighestDepth();
  3.     var parent:MovieClip = this;
  4.     var container:MovieClip = this.createEmptyMovieClip(newName, depth);
  5.     var mcLoader:MovieClipLoader = new MovieClipLoader();
  6.     var listener:Object = new Object();
  7.     listener.onLoadInit = function (mc) {
  8.         mc.attachMovie(idName, newName, mc.getNextHighestDepth());
  9.         parent[newName] = parent[newName][newName];
  10.     }
  11.     mcLoader.addListener(listener);
  12.     mcLoader.loadClip(file, container);
  13. }

The usage is simple:

Actionscript:
  1. var container:MovieClip = this.createEmptyMovieClip("container", getNextHighestDepth());
  2. container.attachMovieAnywhere('foo.swf', 'clip', 'foo');
  3. //One frame later:
  4. container.foo._x = 100;

The main difference from attachMovie is that the attached movieclip will not be avaible until the next frame.

Conclusions:

It is a bug? I don't think, this isn't much different form how a browser works: after the first occurrence of <img src="img.jpg"/>, it will not try to reload "img.jpg" if another <img src="img.jpg"/> is found.

So why I haven't found it before? :)
Maybe because I have always thought that "loadClip" would have loaded file, maybe receiving a "HTTP1/1 304 Not Modified" reply, instead of silently take the cached one, who knows!

I'm sure there are plenty of experienced flash developers out there that already know this, but I've found many questions about this problem and I hope this can be useful to someone :)

 

To be sure that this stuff works I've made a test for it, it was useful to me to better understand how the flash cache mechanism works and to test it on many platform.
Feel free to leave a comment if something doesn't works.
(It is sufficient to view this post to participate, the results will be stored for statistic purpose only)

Some useful Javascript tools

Friday, August 25th, 2006

Because I've come back from my holidays and I have some spare time, I'm wondering if I can do some nice stuff before the next exam session (olny 2 left!).
First, I've start looking for some html/javascript tool, and I've found something interesting:


A Mouseover DOM Inspector (try it now clicking here!)
You can save it as a bookmark and start exploring every web site you visit.

There is also a similar tool packed as a Firefox extension: Aardvark, but it has less features.


Then an image crop tool in JS: 12ImageCrop. It work nice with CakePhp (copy it in the webroot/12cropimage folder and add the js where you need it). See the Demo

I've found also this one based on Scriptaculous & Prototype, it seems better but I haven't try it yet: JavaScript Image Cropper UI, see the Demo

Now something on CSS: I've found this comparison between css optimizers, and Icey’s CSS Compressor seems to have won the challenge. It can be really useful.

Must-read for AS3 developer

Tuesday, July 11th, 2006

André Michelle in his blog point to a great article about AS3 internals by Gary Grossman, the creator of Action Script.

Already on funny videos

Saturday, July 8th, 2006

Ok, this should be a dev blog about flash, javascript and some projects I'm working on, but since I'm busy studying for the last 4 exam I haven't do nothing interesting to show yet. So, just to keep you busy in the meantime, here two video worth to see:

Watch: Video 1
Watch: Video 2