Fear of Silverlight?

Since the announcement of Microsoft Silverlight I continue to read posts of flashers (being subscribed to mxna feed) attacking silverlight in various manner.. (here some links to these posts)
I must admit I don’t know silverlight at all. I just watched some online demos and downloaded some examples.
For what I’ve seen I don’t like it too (but just for personal feeling), but I also have to consider it’s the first (and beta) version….
Otherwise I think the vector rendering engine is more powerful than the flash one.

But why people fear of it? Does it because it’s a Microsoft stuff? Or just because it’s a possible Flash competitor?
Usually when someone attacks something, this means that you fear or it. But I don’t agree, I hope MS will continue the development of silverlight because competition can only be a benefit in a global market.
Don’t you agree with this?

Google Talk Gadget

Google team just announced a new gadget available for google personal homepage: Google Talk Gadget.
Basically it’s a flash version of the Gtalkr application. It has a lot of features such as share YouTube videos or Picasa WebAlbum pictures…

Does this mean that the google crew has started to look at flash more that in the past? Maybe a new way to remove the “beta” to all its AJAX apps?
Probably also thanks to the linux flash player 9 recent release?

Read the full post here: http://googletalk.blogspot.com/…/google-talk-gadget.html

Say happy new year!!

Here we are, like every year, at the end.
Unfortunately this year I can’t be abroad for holidays like in the past (taking pictures of other countries’ beauties :)). I will be on holidays later, in February, in the United States for 2 weeks.
So, I hope everybody will have an unforgettable new year’s eve.

Ok, I finish this useless post with a video I just discovered on YouTube, a video of 1999 (when internet was still a mystery for me), and this is more a gift for me and for my friends who spent that night together with me 🙂

httpv://www.youtube.com/watch?v=MEru-Ux0OEU

Merry Christmas

Ok, everyone is sending all kind of wishes by mail in these days and now it’s my turn!
So, Merry Christmas to everyone!
I hope you will spend beautiful days during your holidays and come back extremely happy
Rõõmsaid Jõulupühi ja Head uut aastat
Wesolych Swiat i Szczesliwego Nowego Roku
Feliz Navidad y Próspero Año Nuevo
Joyeux Noël et Bonne Année!
Fröhliche Weihnachten und ein glückliches Neues Jahr!
 

P.S. I hope you like the new site style I’m still modifying (the header photo is a pic I’ve taken near Perugia, where I lived for 4 years…)

An experience with antlr, java and python

I just wanted to share a little experience with generating an AS3 parser using antlr and python.
I was trying first to create the parser using GNU Flex and Bison in C, probably the best way for a very performancing parser.
Yeah, that’s right.. but looking at the antlr syntax I realized that’s easier and easier.
Moreover I start using this very useful eclipse plugin for antlr debugging which made my life easier!

The grammar file I created is a compromise between the asdt grammar file and the ECMA-262 grammar specification.

Once finished working on my eclipse project I’ve managed to parse succesfully all the adobe corelibs files using this java test file:
package org.sepy.core.parsers.as3;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import antlr.CommonAST;
import antlr.RecognitionException;
import antlr.TokenStreamException;
public class Application {
public static void main(String argv[])
{
if(argv.length > 0)
{
File file = new File(argv[0]);
if(file.exists())
{
FileInputStream is = null;
try {
is = new FileInputStream(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
AS3Lexer L = new AS3Lexer(is);
AS3Parser P = new AS3Parser(L);
try {
P.compilationUnit();
} catch (RecognitionException e) {
// TODO Auto-generated catch block
System.out.println(" line=" + e.line + ", column="+ e.column);
System.out.println(e.getMessage());
e.printStackTrace(System.err);
} catch (TokenStreamException e) {
// TODO Auto-generated catch block
System.out.println(" line=" + L.getLine() + ", column="+ L.getColumn());
System.out.println(L.getGuessInfo());
System.out.println(e.getMessage());
e.printStackTrace(System.err);
}
CommonAST.setVerboseStringConversion(false, P.getTokenNames());
CommonAST ast = (CommonAST) P.getAST();
System.out.println("Tree:");
System.out.println(ast.toStringTree());
}
}
}
}

Ok, done that I decided to export the grammar file for python (thanks to antrl python export feature).
Everything works fine also for python, but I realized that the python script were so much slower than the java one!
import sys
import antlr
import AS3Parser
import AS3Lexer
L = AS3Lexer.Lexer(filename);
P = AS3Parser.Parser(L);
P.setFilename(filename)
try:
P.compilationUnit();
ast = P.getAST();
except:
pass

On a 75Kb actionscript file the python script took about 7 seconds to run, while the java application only 2 seconds. I know python interpreter caould be slower than many other languages, but I never thought so much slower.
So I run the python hotshot profiler to see which could be the bottleneck in the python script and I found most of the problems were due to unuseless antlr (the python module) method’s calls.
After making corrections to the antlr.py file the same script took exactly half of the time. Now 3 seconds. Wow 🙂
But not fast enough.
So I enabled for the antlr python script psyco module and this time the same script took only 1.6 seconds.
Now the python script is fast enough, even if I’m sure I can make more optimizations in the antlr module…

Find programming documentation

I found two very useful reference sites which aggregate various documentation within an ajax suggestion search textbox (like google suggest).

QuickRef.org [view]
Very fast an easy, includes C, C++, CSS, HTML, HTML DOM, Java, JavaScript, MySQL, Perl, PHP, Python, and Ruby references. Unfortunely it does not include ActionScript reference. It has also a “add to google” button, to add a widget in your google homepage.

Fast API Search [view]
This includes ActionScript reference too! It allows to select which references to be used in the live search (such as  HTML, CSS, CSS2, Javascript, Google code, XML, XSL, XPath, XSD, PHP, Ruby, Perl, AS, ColdFusion, C, C++, MySQL, PostgreSQL, Oracle, Java…). Unfortunately this one does not include Python and it seems to be slower than quickref.org

Anyway, I think a couple of useful bookmark links.