LinuxSoftware

Coding and tramping in Aotearoa / New Zealand


Oct 31

Fun with Javascript

, , david, Saturday, 3:24 pm

The RenoufTxt Algorithm: Tim came up with the idea of using an automatic txt compression on fixed length fields, where the input being entered is just a little bit too long for the field size. It’d be better to increase the size of the field, but maybe there might be some situation where that is not possible. This was back when I had more free time, so I coded it up. It was a good excuse to write some Javascript (I should say ECMAscript) code anyway. Javascript is a very interesting language, the way objects are just dictionaries with member functions just values being stored by function name. Python is similar, but has a few more restrictions.

Here’s an example of an input field with RenoufTxt enabled on it.

Updated: It seems later versions of Firefox wisely block bits of Javascript sitting inside blog posts. You’ll have to go to this page to see the script in action.

And, here is the source code: renouftxt.js.

My implementation tries four different methods [toNumber, abbrev, innerAbbrev, removeVowels] to compress each word and tries to choose the words and methods which give the most compression for the best readability. That’s probably way over-engineered, but this was “just for fun”. A simpler implementation might just remove vowels.


Oct 30

Auckland Sprawl

, , david, Friday, 7:05 pm

aucklandsprawlOver drinks on Friday the subject of Auckland’s sprawl came up, and it was stated that Auckland is one of the largest cities in size. I questioned that, and have tried to find what the actual facts are. Auckland does sprawl, and needs careful management of future growth. But is is really as large as the London, L.A., New York and Tokyo urban areas?

Urban areas, as opposed to City or Regional local government areas, are fuzzy and hard to measure (how far apart do houses need to be before they are rural). Different countries have different definitions of what an urban area is. Auckland’s urban area as documented in Wikipedia from (citation needed!) Statistics New Zealand is 1,806 km2. That is large.

I haven’t been able to find a world wide list of urban areas, but compared to urban areas of the USA, Auckland would be 19th after San Diego’s urban area of 2,026km2.


Some of the large urban areas, around the world:

New York-Newark 8,683km2
Greater Tokyo 7,800km2
Chicago 5,498km2
Los Angeles 4,319km2
Auckland 1,806km2

*I’d really like to add a figure for London’s urban area which I believe is much bigger than the GLA.


Oct 26

The Parau-Nihotupu loop tramp

, , david, Monday, 10:13 pm

At 10am I was just finishing the bottling of my latest batch of home brew when Michelle and Brian arrived as previously planned. “So where are we tramping?” I asked, quickly packing my gear. Dome valley was suggested, but it is a long long way away, we didn’t have an early start, and on the way back we’d probably hit heavy traffic returning from the long weekend. We wanted a tramp we hadn’t done before, nearby, and preferably in a loop. The top part of Parau track, joining on to Nihotupu Ridge track and with a return via Sumitt-Hamilton tracks and the Lower Nihotupu Dam Rd met these requirements. Parau carpark is 24mins drive from my place. We’d done the lower part of the Parau track from near Cornwalis, but not this top part.

The tramp passes through some splendid mature forest with some largish kauri trees, nikau and punga ferns, some views, and an optional shortcut on top of one of Auckland’s water supply pipes.

tui1
p1010211
p1010227
p1010222

Not sure if it is really permitted to return via Lower Nihotupu Dam Rd. On the map it is marked “Private Road pedestrian access only” which seemed fine, but where we came out was signposted “Do not enter”. (That’s ok because we were exiting not entering) Looking at the map closer, it may just be the portion of the road from Hamilton track to Pipeline track which is open for walking. There is another note on the map “No public access” after that. Though we didn’t see any signs there.

The National Party proposal to nationalize Auckland’s Waitakere Ranges Regional Park into a National Park seems to have been quietly dropped. It’s hard to see DoC being given the resources the ARC puts towards maintaining this jewel of Auckland. Good thing it’s not a National Park (speaking of jewels) as they are under a threat of being ripped up for mining under the current government.

Moore photos


Oct 25

Lucky I didn’t burn the house down

, david, Sunday, 4:32 pm

Making pancakes. Stupidly I had the spatula sitting on the stove top, and then even more stupidly I turned on the element where it was rather than the one under the frying pan. All caught on the web-cam.

Making pancakes Fire! Fire!! Oh sh!t

Not sure I can be trusted to operate kitchen appliances on a Sunday morning.


Oct 16

Spikey Plant Flowers

, , david, Friday, 6:14 pm

spikeplantflowers


Next Page »