Matt's Musings

May 18, 2006

Playing With ZoomIn

Filed under: Linux, WLUG / LinuxNZ — matt @ 12:04 am NZST

I signed up for a ZoomIn API Key (not that it seems to be needed atm…) the other week and finally got a chance to have a play this past weekend.

My test case was to build a map of all the CRCnet sites and the links between them to use as a plugin in the CRCnet Configuration System. Either as a dynamic status display (colouring links to show traffic loads and status etc) or as a network planning tool to get a feel for the relationship between existing sites and potential new locations. Obviously the lack of topographical information makes the second case far less useful than it could be, but I think even in 2D it would still be a useful tool.

Getting the points onto the map was relatively straightforward, but adding any sort of hover event to them was another matter. The GEvent class currently only supports the click event and markers are not added with any other identifying attributes (such as an ID or Name) which could be used to hook an event into them. After a quick squiz at the Terms and Conditions, I grabbed a copy of the API javascript and after unobfuscating it (basically just adding back in line breaks and running in through indent(1)) started to have a squiz at what was happening. The API code is very nice and clean and it wasn’t at all hard to work out what was going on. Mozilla’s Venkman javascript debugger absolutely rocks for this sort of work. It allows you to step through all the scripts on the page line by line and quickly get a feel for the flow of the code.

Adding support for the hover (onmouseover) event doesn’t look like it would be too hard, but the T&C didn’t explicitly mention whether I was allowed to actually modify the API code, so I choose to simply create a CRCnetMarker class (see below) that creates GMarker object and then pokes id attributes onto the internal objects of that class before returning it. Then once you’ve called addOverlay you can use the basic DOM functions to hook in an onmouseover event handler on the ID of the marker.

var CRCnetMarker = function (sitename, point, icon)
{
    var marker = new GMarker(point, icon);
    marker.icon.id = "crcnet_container_" + sitename;
    marker.icon.firstChild.id = "crcnet_icon_" + sitename;

    marker.addEventListener = function (eventname, handler) {
         b = document.getElementById(marker.icon.firstChild.id);
         b.addEventListener(eventname, handler, false);
    }
     return marker;
}
var marker = new CRCnetMarker(new GPoint(2704685.21,6367057.51), "mph");
map.addOverlay(marker);
marker.addEventListener('mouseover', hoverHandler);

That worked like a charm and I now have nice little info boxes popping up next to each node when you hover over them. I also discovered in the process of implementing this that Prototype and ZoomIn do not play nicely together. It appears to be Prototype’s fault as it messes with the Array type by adding new methods (like each for enumeration) which break the builtin for (i in array) syntax when the array contains non-numeric keys (like each). This has been reported in the prototype bug tracker as breaking Yahoo Maps but the comments don’t seem to offer much hope for Prototype’s behaviour changing anytime soon which is a pity.

The next roadblock was a lack of support for drawing lines! This put the kibosh on the whole animated network status idea. Trolling through the source again reveals a GPolyLine class that appears to be semi-implemented, so hopefully support for drawing lines is coming very soon.

The only other thing I found slightly annoying was having to supply all the co-ordinates in NZGD49 format. Most of our GPS information for CRCnet is stored in WGS84 format (as that’s what our older GPS unit puts out). NZGD49 has been deprecated in favour of NZGD2000 (which is near enough to identical to WGS84 for normal use) so I’m not really sure why ZoomIn is still using NZGD49. Maybe that’s all TerraLink can supply?

Some quick googling turned up the proj library (apt-get install proj in Debian) which provides the cs2cs utility which can convert from WGS84 (aka NZGD2000) to NZGD49 to feed to ZoomIn. The magic peice of information is the transformation parameters which LINZ helpfully provide. Punching those (I chose the 7 parameter version) into cs2cs via a command line like

echo "$lat $long" | /usr/bin/cs2cs +proj=latlong +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 +nodefs +to +proj=nzmg +datum=nzgd49 +ellps=intl +towgs84=59.47,-5.04,187.44,-0.47,0.10,-1.024,-4.5993 | awk '{print $1" "$2}'

performs the magic conversion.

The conclusion?
Overall I think ZoomIn rocks and it’s really cool to see a small NZ company filling in where Google and friends have failed miserably.

The biggest weakness at the moment is definitely the API, which doesn’t really allow you to do much more than add points at this stage. Given that ZoomIn is still relatively young the leanness off the API is understandable. Given the API a few more months to mature and fill out and I think we’ll be able to create some really cool applications on top of the ZoomIn platform.

Screenshot:

May 15, 2006

SSC OSS Legal Guide v2

Filed under: WLUG / LinuxNZ — matt @ 10:39 am NZST

The State Services Commission has released a second version of their Legal Guide to Open Source Software that fixes the complaints that NZOSS had with the original document.

I’m very pleased with this outcome and its great that we as a community could work constructively with the Government on this issue. Here’s hoping that the relationships that have been built through this exercise can continue to be built upon to further increase the mindshare the Free and Open Source Software has inside the Government.

May 4, 2006

Local Loop Unbundling

Filed under: General, WLUG / LinuxNZ — matt @ 12:35 am NZST

Wow!

It’s out. The government has finally gained the courage to force Telecom to unbundle the local loop. Possibly the most interesting part of the whole announcement is the circumstances of it. Cabinet signed off on it this morning, by midday it had been leaked to Telecom and the Government was forced to scramble to announce it to everyone to avoid regulatory problems from the Sharemarket. No doubt whoever leaked it is feeling very very worried about their job security right now! The Cabinet briefing paper and minutes that accompanied the original press release are a bad quality scan and have obviously been prepared very quickly with hand written corrections to the page
numbers in the latter half of the document. The document has now been removed from the website, which I guess means that it is being touched up. Email me if you want a copy.

[Update 1am: It's now back, but has had information redacted presumably because it is meant to be commercially sensitive!]

If you want the hard facts the following are good sources:

So, is this a good a thing?

I think it is in the long term, but the best part of today’s announcement is what goes alongside the LLU decision, not the LLU itself. More on that in a minute. The Cabinet paper (60 pages) appears to be a very thorough summary of the detailed analysis that has obviously been performed over the previous months. What I think is a fairly reasonable argument is made for why the action is needed and why the chosen course of action is the best option. I’m very impressed with David Cunliffe’s handling of the portfolio and I hope that he continues to work to the high standard that he’s set himself in the few short months since the election. He’s certainly going to face some opposition now!

One thing to keep in mind in reading the paper and analysing the information available is that the Government’s hand was forced and there is probably a lot of implementation detail that they would have planned to release with the offical announcement on the 18th. So theres not much point in nit-picking details at this stage.

The meat of the announcement is that the Government has chosen a two-stage approach to increase the regulation in the sector. The two stages are basically short and long term actions designed to be complementary. The long term action is the LLU itself and promotion of investment in alternative infrastructure. Because this will not be completed and ready to use in any shape or form until 2008 at the earliest there are also a series of measures to beef up the current wholesale offerings to tide us over and improve the market in the interim.

What we get in the short-term:

  • UBS without the 128k upstream limitation
  • UBS that can support real-time services (VoIP, Games, etc)
  • Naked DSL – no Telecom phone service required

With prices and access terms for all these services to be set by the Commerce Commision, which is directed to ensure that the pricing is applied to protect investment incentives.

There are a few juicy paragraphs that suggest the Government has considered opposition and is ready for it, such as 113 that warns that is Telecom does not invest quickly enough then full structural separation will be considered. However there are also suggestions (para 113) that Telecom is going to be thrown a bone in the form of a recalculated TSO that will provide higher levels of compensation to support the necessary network upgrades in rural areas.

Rodney Hide and no doubt other right-wing groups are already bleating about the “stolen” property rights. But as I see it thats not the case. Telecom still owns the local loop. ISPs do not get to use the copper for free! They must pay Telecom a market rent. LLU is about regulating that price and forcing Telecom to offer the service where there is no incentive for Telecom to do otherwise given their vertically integrated monopoly.

Secondly, Telecom was given a chance to avoid this scenario with the 2003 decision not to unbundle. At that point Telecom and its shareholders were warned that if they didn’t invest appropriately and provide a competitive wholesale market the situation would be reviewed. These warnings increased in frequency over the past year. Telecom cannot say that they were not warned. They may have massively misjudged the government, but they were warned. The simple fact is that over the last three years Telecom has played games and stalled as much as possible. In many ways I feel they are the authors of their own misfortune.

Overall, I’m very happy and excited. Its a great time to be involved in the Internet industry in New Zealand. The government has churned out an excellent paper that shows that they have carefully analysed the issues and decide on a course of action that I think has an excellent chance of improving the state of broadband in New Zealand. LLU is not viewed as a magic bullet, other measures have been put in place to ease its introduction and investment incentives to build the next generation of access infrastructure are mentioned and regarded as important. The big risk to watch is how the Government goes with the implementation. It is a hugely complex peice of policy to implement, with lots of potential for mistake and they are fighting against a well resourced company with lots to loose.

No doubt this will not be my last post on the issue.

[Update 8/5/2006: Fixed typo 128k vs 512k, thanks for spotting Juha]

Powered by WordPress