Blog
- An article on JavaScript Closures 147 days ago
-
Stacktrace has just published one article of mine about JavaScript Closures. Italian only :)
Comment - Me, at Florence Barcamp / Wavecamp 298 days ago
-
Thanks to robin good, this is me talking about a “home made, poor man” YouTube prototype. I’m speaking italian, and there’s no slides support… I’ve uploaded the slides on slideshare
Comment [3] - An introduction to the JavaScript Object Model - Part One In WebTech, 307 days ago
-
JavaScript has no “Class” concept in the mainstream OOP point of view. You don’t define a “class” and instance objects that are a “phisical” representation of that. Technically, JavaScript is a “prototype based” language. This brings some nice things but also makes all the “object programming” experience in JavaScript full of traps, misunderstandings and weirdness…
This little series of articles (2 or 3) is my personal attempt to clear this mess a little. A lot of other “JavaScript object programming tutorial” yet exist, and surely many of them are more technically accurate then mine. I only hope to put this problem into a more “human friendly” point of view.
- JavaScript and associative arrays don’t mix In WebTech, 311 days ago
-
The concept of “associative arrays” is an alien, in the JavaScript world.
I hear you “No, I’ve used them and they work”. My answer is “No, you have MISused something that looks like an associative array”.
Let me explain. When you write something like…
var friend = []; friend['name']='Claudio'; friend['age']='40';
…you’re creating an empty array (friend), and then you’re extending the friend object adding two properties (“name” and “surname”) to it. You were telling JavaScript that you’ll going to use an object with an indexed access (the array…), but then you use it as a simple object. Not fair.
You’d probably want to create something like this:
var friend = {}; // or new Object(); friend['name']='Claudio'; friend['age']='40';Your “associative array” is now a semantically correct JavaScript object.
Let’s look at a final example:
var friend = {}; // or new Object(); friend['name']='Claudio'; friend['age']='40'; // Properties can also be accessed with the dot notation friend.name='Claudio'; friend.age='40'; // When using arrays, you're using something that is numerically indexed var friend = []; // *or new Array();* friend[0]='Claudio'; friend[1]='40'; // See? :)HTH
- A script to query SVN logs by SQL 313 days ago
-
Quite often I find myself lost trying to do things that should be simply but they are not: try to answer this question “Being in a SVN working directory, how do you find all the log messages for the revisions that has been committed by someusername in the last month?”
Not so simple.
For this and other reasons, I’d like to have the power of SQL under my fingers, while inspecting SVN logs. So, in an hour, I hacked up this script that will permit you to query the (local) SVN logs with a (very) sql like interface.
It uses Ruby and Sqlite3, via gem. Basically it loads the log (in memory) as XML, then parses it and store revision informations in a (in memory) sqlite database. It then offers you a prompt from which you’ll be able to run queries.
Some example queries are:
- revision (lists all the revisions)
- revision where author=’claudioc’ (lists all the revisions by claudioc)
- count(*) where author=’claudioc’ (how many commits by claudioc?)
- message where date between ‘2007-01-01’ and ‘2007-02-01’ order by revision desc’ (list the log messages in a 2 months window, and order the list by revision number)
You can download the script here
Some extra notes:
The script is released under a creative commons license and you’re then welcome to change or patch the program as you like (you may want to report back patches).
The program works in memory, so the bigger the log file, the bigger the memory usage. It could be much better if the temporary table would be filled WHILE reading the XML (and not after).
The program use the current directory of the working copy a the starting point to inspect log. If you want to query the WHOLE application log, then move yourself in the root directory of your wc.
Due to the lack of real data types in Sqllite, date range checks could fail… a better approach (using the Ruby extensibily of the Sqlite gem) should be applied.
As usual, HTH
→ 61648624
→

