August 21, 2008

New 0.2 (SoC) release, JUICE is born – aka the longest title and the longest post in history

Posted in GSoC tagged , , , , , , , , at 2:56 am by fadinlight

Relevant links:

“Dojoizing” OsmaFrontend

Following what I’ve said before, also this last week (while doing a MAJOR blog posts updating) has been full of interest for code developing, even if not so full of new features. What I’ve been doing is “Dojoizing” OsmaFrontend, to take the most advantage from Dojo toolkit and to have a cleaner code design (separating HTML code from Javascript, using Dojo’s xhrGet). Here the last days timeline:

August 11: TagTrunk

While “Dojoizing” Osmafrontend, I’ve started to separate the trunk code from the tags (thanks to TomH and spaetz that helped me in the #osm channel, also helping me not to do tens and tons of commits πŸ™‚ !)

August 12: Widgets and blog

A long day of studying to learn how to write Dojo widgets, and to write some of the past posts for the blog

August 13: Tags, Blog, Rule tree

Finally I’ve separated the tags from the trunk, while updating the blog with the new posts. A little interesting new Osmarender Frontend feature developed: a raw tree view of the rules. This is what is going to be, after the major refactoring I want to do for CMYK library.

August 14-15: Django template in Dojo (Dojox DTL)

I’ve started to learn how to use DTL in Dojo, but even after spending the whole day on various tries, I didn’t manage to have it do what I wanted to do to separate some HTML from the code. For example, I couldn’t manage to do a {% for key,value in store %}. Really don’t know why, because with other tags everything worked smoothly.

August 16: Widgets and i18n

After doing all the refactoring to separate HTML content from Javascript, I started to refactor all the code that concerned the CSS editing part of Osmarender Frontend. Then, I’ve started to learn how to do i18n with Dojo, while learning that Dojo’s i18n have some issues with Firefox 3.

August 17: Externalising CSS editor and publish/subscribe

This day I’ve finally externalised all CSS editor code from osmarender_frontend.js file, with some tricks to keep it really separate. As Osmarender Frontend takes the styles and handles them (add, modify, delete) only with the help of CMYK library, and as I wanted to keep the CSS editing widget and CMYK library really separate, I didn’t want to pass the CMYK instance to the CSS editor, nor I wanted to let Osmarender Frontend handle the CSS section of the rule file. This is where dojo publish/subscribe came to help! In this way, the CSS editor will publish a topic, which Osmarender Frontend have to subscribe to pass the parameters to CMYK library. That’s cool!

August 18: JUICE

I’ve spent the last GSoC days to do some minor changes to the code, and to definitely keep the CSS editor widget separate from the rest of the code, with its own i18n. This is how JUICE (Javascript User Interface CSS Editor) project was born!

Three projects in one!

At the end of my GSoC adventure, and at the beginning of a new adventure, I’m very happy to say that three projects have started at the same time:

  • CMYK library: When the refactoring will come to an end, the library will be completely independent from Osmarender Frontend, thus allowing every Javascript-speaking code to handle Osmarender’s rule file smoothly.
  • Osmarender Frontend: A Dojo-powered GUI interface for WYSIWYG handling of Osmarender’s great power.
  • JUICE dojox based widget: Without even knowing or wanting, the CSS editor has now its own life, so, sooner or later (at the end, when it will have more features and handling power), it will be a separate project, perhaps with some integration with Trevor McCauley’s great CSS parser… Who knows… Fantasy is the limit…!

August 10, 2008

Refactoring and UML models

Posted in GSoC tagged , , , at 11:46 pm by fadinlight

(This post has been published after the original date)

Now that all is ready, I know that probably the time is not enough for GSoC deadline to complete all that I would like to complete (even if I’ll try to do my best), that would be:

  • Externalise data model from cmyk.js
  • Create and package a better data model for rules handling (with some GUI hacking I could let it work in few time after creating it)
  • Refactor Osmarender Frontend (the GUI section) code
  • Externalise and dynamic loading some GUI resources (like the various panels)
  • Refactor some controls (mainly those that edit CSS properties) as Dojo widgets
  • If time permits, start using Dojo templating system for some GUI resources
  • Create all packages ready for release

The hardest thing to do would be to write and get to work the refined data model for rules handling. This is because, after a quick refresh of my Osmarender rules knowledge, I’ve produced the rough sort-of-UML model shown above (thank to argouml), which represents needed classes, inheritances, attributes and types. That explains clearly how difficult will be a proper refactoring, at least to get it to work for GSoC deadline without too much loose ends. Obviously I don’t want to risk to break something now. πŸ™‚

So, what I’m doing now? I’m using a mixed “top-down/bottom-up” stategy. I’ve already refactored some data models used by cmyk.js (1st point) and I’m just starting to externalise and dynamic loading GUI resources for Osmarender Frontend (4th point). This is going to be a step by step process, refactoring the code and re-testing the GUI any time, for every bit, to see if some regression bug appears. It would be quite slow, but, IMO, too much needed to have a maintainable and more flexible code for future improvements.

In the meantime, I’ll begin to prepare Osmarender Frontend’s directory in SVN for release.

August 9, 2008

Unit testing, unit testing…

Posted in GSoC tagged , at 1:31 pm by fadinlight

(This post has been published after the original date)

As said before, I was going to use JSUnit for unit testing while refactoring CMYK library’s code. After failing many times, I’ve found that latest Firefox 3 security policies seems to break JSUnit, so I needed to download it from the JSUnit code trunk and create “security.fileuri.origin_policy=3” key in about:config.

Now it finally works smoothly, and, after some learning, I’ve started to produce some unit tests for the first refactored library modules.

A very interesting thing I’ve found is that, before this version, JSUnit Firefox’s version seemed to support a client-side functionality to browse through local files to open a test suite. This functionality no longer works for Firefox 3. I need to find if really there is no hope to get a Firefox 3 browse feature.

August 6, 2008

Refactoring, refactoring… Documenting, documenting…

Posted in GSoC tagged , , at 4:12 pm by fadinlight

(This post has been published after the original date)

During the last week, I’ve managed to learn and beginning to use Dojo packaging features. So I’ve started splitting my cmyk.js file into model and controller chunks, exporting all functions that refers to models into different Dojo class files. After some little issues with relative paths, and after learning how variable and function scope works in Dojo classes, now it works!

I was starting to get worried, because JSDoc Toolkit seemed not to work in my PC at all, founding no suitable solution in the Net. Even switching from open-jdk to sun-jdk didn’t help. But, even in an unlucky period like this, sometimes a little bit of luck comes out… yesterday JSDoc Toolkit version 2.0.2 has been released… and all begun to work very very smoothly!

I’ve had some issues to let JSDoc Toolkit document properly Dojo classes, but, in the end, I’ve managed to let it work, even if it documents some functions as statics even if they’re not, and even if I needed to create some .js mock files just to document the various namespaces of the packages. Probably there could be a way to do all better, but I think I’ve to defer this research. πŸ™‚

August 5, 2008

Mapping Elice

Posted in OSM Contributions tagged , at 3:29 pm by fadinlight

(This post has been published after the original date)

As said in my last post, Simone Cortesi came here in Montesilvano for two days. Simone thought to try to map a very little town, to see and test how much time is needed to map a whole town. After a quick look on the slippy map, we decided to map a little town nearby, which is called Elice.

An example of synchronous photo πŸ™‚ (right photo by Simone Cortesi)

We went there in the afternoon by his car, and, after a coffee and a little tour around Elice, we found that this town couldn’t be mapped by car! So we parked the car and started to discover every Elice’s street by feet πŸ™‚

Maps maps maps maps (right photo by Simone Cortesi)

We both took GPS traces and photos, while Simone took note of every street on a paper. We found to map the whole town in few more than 1 hour, with much fun, also seeing the faces of the wondering inhabitants πŸ™‚

Elice street sign

Twilight maps… (photo by Simone Cortesi)

July 30, 2008

The bus factor

Posted in GSoC tagged , , , , at 12:05 am by fadinlight

(This post has been published after the original date)

After talking with Frederik, also regarding what’s happened during the last days (and what’s happening now, and what will happen), we decided to change the scope of the project, aiming at a full refactoring and documenting of all that I’ve done. This has been chosen to reduce Osmarender frontend’s “bus factor” (in my case, the “sheep factor” ™! πŸ™‚ ). I’m agree on doing this, also because, to have a proper handling of the rule section (as it is very complicated), IMO a better data model is needed.

What’s Osmarender Frontend now

Now Osmarender Frontend is split into two JavaScript files: cmyk.js and osmarender_frontend.js. cmyk.js file is the osmarender’s rule handling library, while osmarender_frontend.js is the gui (sometimes they’re not really separate, to be honest). As I was a very newbie on using Dojo when I’ve started the project, I wasn’t using any Dojo feature at all. At the end, I was very reluctant on using it. Then, after I’ve done a total revision of the GUI, I’ve started to know Dojo better, and I see it would be a proper choice to use its features, beside for the GUI, also for the CMYK (“Customize Maps: Your Key”, or “Cmyk Maps Your Kingdom”) rules handling library itself, using only Dojo core features. Better, using Dojo’s scopeMap feature, I can distribute a fixed version of dojo with the library that doesn’t break anything if, sometimes in the future, another dojo version will be used when calling the library.

What Osmarender Frontend will be

Why Dojo is so attractive? Here I need to speak frankly: I don’t want to reinvent the wheel. If dojo can take care of browser quirks, class declaring/handling, package structuring (the thing I was missing the most!), i18n, querying the DOM, dynamic loading of panels, etc… well, why shouldn’t I use it? πŸ™‚

Beyond that, as Frederik asked, I’m going to start documenting the code, so I need to use JSDoc Toolkit. Furthermore, even if not really asked for, I want, at least, to refactor the library while using an unit test framework like JSUnit.

So, next steps:

  • Learn how to use Dojo packaging features
  • Learn JSDoc Toolkit
  • Learn how to use JSDoc Toolkit with Dojo
  • Start doing some documentation to test my knowledge of JSDoc Toolkit
  • Learn JSUnit
  • Learn how to use JSUnit
  • Start doing some unit testing to test my knowledge ofΒ  JSUnit
  • Start code refactoring

In the meantime, Simone Cortesi is coming to my summer house here in Montesilvano on August 4, while doing his sort of “Summer Italian OSM Tour“, to get in touch with the community all over Italy!

July 29, 2008

Attaching symbols

Posted in GSoC tagged , at 2:38 am by fadinlight

(This post has been published after the original date)

After the laptop breakdown, I’m experiencing a forced connection breakdown. Long story short (all details are known to Frederik, my mentor), I’ve managed to connect to the Internet in some provisional way.

I’ve added just today a little feature to Osmarender Frontend. It’s now possible to attach a simple symbol to a set of nodes. Now I’m finally starting to manipulate the rule section of the file, so it’s probably time for a refactoring to better manage the data model of the rules.

However, as you can see in the first screenshot, you need to select a key/value pair in the rules panel, then you need to go to the symbol panel, select a symbol, tweak with the controls…

Then click, for example, to “attach to railway, station”, and then you have the airport symbol near all stations!

If you tweak with height and width, obviously you can have them bigger!

July 15, 2008

State Of The Map!!!

Posted in GSoC tagged , , at 9:35 pm by fadinlight

(This post has been published after the original date)

And finally… here it is! After visiting Google offices and after a night in Zurich, on 11th I’ve taken a flight for London, and then another to Dublin (sorry for being late guys!), to go to State Of The Map 2008!

It’s really difficult to tell in a little blog post all that’s happened during this great conference of great people from all over the world! This is the real community feeling, and words are not enough to me. I’m not into the community since too much time, but I’ve really felt as being part of it long before.

It would be a long list to name all of OSM folks I’ve met and with whom I’ve talked and had a good time, so I will just link the list of participants, scheduled talks, workshops and lightning talks. I want to thank all of you!

Here just some photos of SOTM08, more on Flickr!

My lightning talk, showing Osmarender Frontend architecture (thanks to Simone Cortesi)

From left: Frederik Ramm (my mentor and mantainer of JOSM), me, Ivan Sanchez Ortega and Dair Grant @ Dublin airport

Something that only the MAJOR group above can really understand πŸ™‚

On the left: Etienne Cherldu (aka 80n, creator of Osmarender); On the right: Knut Arne BjΓΈrndal (aka Bob KΓ₯re, Osmarender hacker… thanks for all the good time!)

Simone Cortesi during his “State of Italy” talk

Me and Hiroshi Miura, wait for dancing again next time! πŸ™‚ (thanks to Simone Cortesi.. and to bobkare for the linked psychedelic photos πŸ™‚ )

July 10, 2008

Visiting Google Zurich Offices

Posted in GSoC tagged , , , at 11:59 pm by fadinlight

(This post has been published after the original date)

After my laptop failure that happened yesterday, in which I’ve lost all slides done and the poster I’ve built for this visit (which I’ve managed to create again during the night in my Eee PC, printing it at Zurich HB station πŸ™‚ ), today has been an exciting day, as I went to Zurich to visit Google offices during OSS Jam, in which I’ve given a lightning talk and a poster session to show the state of Osmarender Frontend.

Beyond other projects, which I’ve found very interesting, during the lightning talks I’ve got in touch with XQuery, which seems very interesting to me. I will definitely look forward the improvements of that project.

I would like to greet Alberto Sanz (OLAT), Giacomo Catenazzi (Debian) and Claudio Tassone: all of them supported me much, chatting and giving ideas. Definitely I had a good time.

And obviously, thanks to Michael Hanselmann for the Google Office’s tour and to all other Googlers hosting us… and, obviously, to Bram Moolenaar for this photo! πŸ™‚

July 8, 2008

Weekly Report #5: The nextGen Osmarender Frontend

Posted in GSoC tagged , , , , at 7:42 pm by fadinlight

(This post has been published after the original date)

This week I’ve been doing an hard work to better integrate Dojo library with my code, thus enhancing the very very rough and provisional GUI of the last release.

New features:

  • There is now an option to transform right after loading data and rule files
  • New button to Save the SVG file
  • New panel for global map settings (like showLicense and showBorder)
  • Some CSS classes are now linked to general Osmarender settings (i.e. map-scale-core, map-grid-line, etc)

New GUI features:

  • Osmarender Frontend is now a floating resizable window, with the rendered map in the background. This solution will improve the overall usability when modifying the maps
  • When loading data and rule file, a progress bar of the nodes parsed will be shown. This is not so immediate to achieve in Javascript, because some inner knowledge of how intervals and timeouts work is required
  • Integration with some Dojo widgets, like the filtering select box for searching CSS classes, tooltips and tabbed panes

Previous page · Next page