Categories
General

Lessig @ Edinburgh Science Festival

Larry Lessig did his “30 minute intro to Creative Commons” at the Edinburgh Science Festival this Saturday as part of a panel discussion on “who owns ideas in the digital age”. I haven’t read any of his books before, so it was nice to hear the story straight from the man himself. To be honest, the talk left me with more questions than answers – though given the complex and multifaceted topic, this probably represents a successful mindshare victory by Lessig.

Lessig stressed something which I think needs to be stated more often: breaking the law by stealing people’s copyrighted material is wrong. His argument is in favour of reform of the copyright system, not the abolition of the concept of copyright. Copyright is a fine idea. A world with a (good) copyright system is much preferable to a copyright-free world. Continually restating this might be dull, but it’s a good pre-emptive defence against the straw-man argument used by those in favour of the status-quo: “these people are anti-IP” or “there people are pirates”.

There are two arguments which Lessig puts forward in his talk, which aren’t clearly distinguished. Firstly, there is the “WHERE DID ALL OUR FREEDOM GO?” argument. Lessig tells us that the copyright laws which (in days gone by) let us legally produce derived or “remixed” works have, in the digital age, been reinterpreted in such a way to remove these rights almost entirely. Secondly, there is “LET THE PEOPLE CHOOSE TO SHARE” argument. In most countries today, whenever you produce a creative work you automatically get a heavyweight “all rights reserved” copyright on the work. Until recently, unless you were a legal whiz, your choices were limited to accepting this heavyweight copyright or putting your work in the public domain – a binary choice. The Creative Commons licenses make it easy for people to choose (woo, cartoons!) a less restrictive set of terms for their works, as suits their own preferences.

Now, I see Lessig with two hats on. With his “WHERE DID ALL OUR FREEDOM GO?” hat, he is alerting the world to this change in interpretation of copyright laws, and lobbying for a restoration of our age-old rights. Copyright has got broken, so lets fix it.

But then Lessig puts on his “LET THE PEOPLE CHOOSE TO SHARE” hat. The Creative Commons licenses allow people to easily choose to put their own works under a less restrictive license. It’s like an opt-out clause from the the brokeness of the default copyright situation.

But Creative Commons doesn’t directly address the fact that the “default” copyright has been broken by the digital era, and needs fixing.

To be fair, Rome wasn’t built in a day, and the Creative Commons MIGHT be a stepping stone towards properly fixing copyright. I am walking a similar path with my open map making project. I would like the UK government to produce map data (centrally funded) and make it freely available (like the USA does). At the moment, the Ordnance Survey receive taxpayers money, but jealously guard their “Intellectual Property” and will charge you lots of money for access to the raw data. I don’t expect that immediately lobbying my MP would lead to much movement on this issue. Instead, myself and others around the country are involved in a grassroots effort to produce our own free map data. This first step may provide extra leverage in our argument for change at the Ordnance Survey. Creative Commons and OpenStreetmap are making small ripples in their respective arenas, but always with an eye on the end goal.

However, this stepping stone notion might be flawed. Bill Thompson put forward the point that “LET THE PEOPLE CHOOSE TO SHARE” might hurt the effort to fix the “WHERE DID ALL OUR FREEDOM GO” problem. MGM and Disney will argue that today’s copyright law is working just fine (for them) and doesn’t need fixed and, hey, if you really care there’s this dandy Creative Commons thing to keep them hippies happy. Taking a local analogy, some people have observed in Scotland that devolution, far from being a stepping stone towards independence, has made independence much less likely. You hit a local maximum and stick there.

This intertwining of the two themes is my main gripe (albeit a minor one) with Lessig’s presentation. The discussion skips from one to the other and back again without much delination.

Another thing I don’t understand yet (which came up in discussion with Anthony afterwards) is why Creative Commons licenses need to be “localized” into various legal juristictions whilst the GPL doesn’t. If I was an Evil Lawyer arguing against the GPL, I’d be asking the jury to consider why the incredibly good lawyers behind Creative Commons have taken the care to localize the licenses, whilst the GPL has not been localized. Does this mean that if I use the GPL and I live in the UK it’s weaker?

Having said all that, I really enjoyed the talk, although the pace was pretty fast and it took me a while afterwards to detangle it in my head. I wish there was more time for questions and discussion afterwards (and fewer people taking up time asking weird questions). Beforehand my level of knowledge on the subject was pretty much “everything I know I learned from the slashdot summary”. Now I feel informed. Yay for living in a city where they do lectures like this. Tomorrow evening is a talk about nanotech.

Categories
General

OutOfCopyright Mapping Win

“All OS map are under Crown Copyright which expires after 50 years”. Which means I can take an OS from 1953 and use it to develop my own digital map. No restrictions whatsoever. Edinburgh has changed a fair bit in the last fifty years, but the city center has changed less than the outlying areas. This greatly reduces the amount of work required to produce a useful map. Thanks to Richard Fairhurst for the idea, and thanks to the National Library of Scotland for having a big collection of historical maps.

Who’d have thought it?

Categories
General

Edinburgh Software Companies

I finally made my oft-promised list of Edinburgh software companies. The general consensus so far is “wow, Edinburgh is smaller than I thought”. Exhaustively enumerating the companies has kind of reduced the scope for “gosh, maybe there’s a really cool company I’ve not heard about”. Still, I’m almost certainly still missing a few companies at the moment .. feedback welcome. Please tell people about this resource – it’ll help to make it exhaustive.

Predictably, soon there’ll be a (free) map of Edinburgh showing you where everyone is located. Only the “where is each postcode” information is copyrighted by the Royal Mail. Sigh.

Categories
General

Maps Revisited

I finally figured out the shearing problem with my map of Edinburgh. The GPS receiver outputs longitude/latitude coordinates, and the viewing software was defaulting to using a lon/lat projection to display them onscreen. However, if you buy a streetmap of Edinburgh it’ll probably use the “British Grid” projection, which is quite different. There’s just so many ways to project the surface of a sphere/ellipsoid onto a 2d screen. Using the raw lon/lat coordinates as your x/y pixel positions isn’t very helpful. While lines of latitude (the ones which run N/S) are all the same length, lines of longitude get shorter as you head further north. So by the time you get to Edinburgh (roughly 56 degrees north), the lines on longitude are cos(56 degrees), or roughly half as long as the equator (thank you Frink). So, near Edinburgh, 1/1000th degree of latitude near Edinburgh corresponds to 111m north/south, but 1/1000th degree of longitude corresponds to a mere 62m west/east. Hence my first attempt at mapping was stretched horizontally.

So, just switch the viewing projection to Transverse Mercator, which has the desired “up and across both use the same scale” property, and suddenly the map looks comfortingly like every other map of Edinburgh I’ve ever seen.

However, this necessitated a change of software. JUMP doesn’t support alternative viewing projections, and neither does QGIS. So for now I’m using an evaluation copy of GlobalMapper.

Now to add some depth. A few years ago, the space shuttle flew around a bit measuring the height of earths surface at a resolution of about 100m. And the Americans, being much cooler than the UK government, make all the data freely available. So you can just download a large GeoTIFF file from their website for your neighbourhood (Scotland, in my case). A GeoTIFF file is just a 16-bit greyscale with some metadata to tell you what part of the earth it corresponds to, it’s projection and stuff like that.

The results can be seen in the following images: Edinburgh where Arthurs Seat, Calton Hill and the Castle Rock can be easily seen, Scotland showing all the neaby hills, and a profile of the slope as you head up Leith Walk (cyclists will recognise the nasty steep bit at the end).

The height data isn’t terribly precise. For a start, the shuttle will have measured the height of the tallest buildings rather than the ground level! However, in practical terms it’s accurate enough to feed into a “cyclists routefinder” application, whereby you could request “find me a route from A to B avoiding steep hills”. Very important use.

I’m now working on producing semantic data about the roads. For example, “Princes St joins the Mound at coordinates x,y but cars cannot turn eastwards onto Princes St”. I’m also inquiring about the price of aerial photographs and satellite data, since that’d be a quick and easy way of making a map (although less fun than the GPS route).

Oh, turns out there’s going to be an article about free-as-in-speech map making in New Scientist in a couple of days times.

Categories
General

Apache + MySQL + PHP + not

I write this blog so that I can look back in years to come and see what I spent time thinking about. Computers have this nasty habit of sucking up time without you noticing. Recently I’ve been doing relatively low-brow stuff. But, for my own benefit, I want to record it so that I don’t redo this again from scratch next year.

I’ve recently been considering hosting my own website. Until now, I’ve paid a hosting company to do it for me, but a few things made me reconsider this. Firstly, I’ve been hosting my own email for a while now, and it has been more reliable that any commercial email provider. I can set up more sophisticated spam filtering this way, and diagnose faults without having to spend hours discussing it with a support department. The server runs on a low power fan-less mini-ITX board in my hall cupboard, and the only downtime so far has been due to me tripping off the power to the entire flat once or twice (even then it auto-reboots … I could plug it into a trickle-charged 12v motorbike battery and have a UPS).

So, hosting my own website would give me much more flexibility. I get hit by an awful lot of blog spam (to the extent where I’ve switched off comments for now). Hosting locally would give me direct access to the database which underpins my blog, which would make it easier to tidy up things. Also, I’d like to have direct access to the webserver logs, which is something my current provider doesn’t give. I’ve got a reasonably fast internet connection to my home which is idle most of the day, and so it seems a bit daft to pay data-transfer costs to a commercial web-hosting company when I’m already paying for unused data-transfer to my home. Finally, I already have a “server” in my cupboard and it could easily take the (light) load of running my website too.

I looked into running the webserver on a user-mode linux machine. It’s effectively like a linux-specific VMware. There were two reasons for this. Firstly, running the webserver on its own machine increases security a bit. If someone used an exploit against the webserver and gained root, I certainly wouldn’t want them to then have access to my email or whatever other services are running on that machine. That’s why I have a seperate server in the first place. UML makes it easy to have a seperate machine for each service you wish to expose, effectively sandboxing them, without buying more hardware. Secondly, running as a UML instance makes backup really easy. UML is really easy to run. You have an executable called “linux-2.6.9” and a second file which is the image for the root disk. You run the executable, and you see a new copy of linux booting within your existing one, mounting the root disk image and leaving you at a login prompt. It doesn’t require you to tweak your existing kernel at all – brilliant. So, to back up that virtual machine you tell it to briefly pause (or shutdown), take a copy of the kernel file and root disk file, and you’re done. My root disk for a Debian 3.0 system running Apache, MySQL and PHP compressed down to about 90Mb. I chose Debian because on a server, unlike on a developer machine where I choose Gentoo, I have no need for bleeding edge software or libraries.

Setting up Apache was easy, even though it’s been years since I last did this. Since I already needed a MySQL database for my blog, I added mod_log_sql to put all the access logs into a MySQL database. This was really overkill. I could see the module being very useful if you had a complicated multiple-VirtualHosts setup. But I was just doing it because I could .. and because I don’t really like Webalizer much. I like the idea of being able to phrase arbitary queries and do some data-mining. Plus, it gave me a chance to refresh my SQL knowledge from University.

There’s something very cute about the way you back up MySQL databases. Most applications, such as word processors, persist their data by writing a snapshot of their current state to disk. MySQL writes out a sequence of commands which, when played back, will rebuild the database. So the start of the dump file will be a “CREATE TABLE …” followed by a series of “INSERT INTO …” lines. This is quite elegant. Why invent an entirely new serialization format when you already have a language which is expressive enough to do everything you need?

Although I don’t deal with databases in my day-job, it’s quite an interesting field in some ways. It’s well accepted that separating data-storage from the rest of your application logic is a wise plan. But SQL-backed applications have a further advantage that, say, an XML-backed application doesn’t have. By making such a clean seperation in your application, you can leave the whole data-storage problem to someone else. There’s lots of really clever people who’ve figured out the best way to store and query big relational datasets – laying them out, and moving them between disk/main-memory/cache-memory in a pretty optimal way. As long as you can fit your data into the right shape, you can then magically take advantage of decades of cleverness. That’s a pretty impressive level of reuse.

On to the last part of the Linux/Apache/MySQL/PHP cluster: PHP. I spent some time looking through the source code for WordPress, my blog software. Blog software ought to be pretty simple. It’s just a glue layer which sucks data out of a database, munges it into HTML and sends it to a browser. But to my eyes, WordPress (and probably most PHP apps) are pretty dire. The code is pretty state-happy, with lots of imperative updating which wouldn’t be needed in a language with better building blocks. It’s a domain where people who think Perl is a fine language (and I mean that in a derogatory way) would be happy. But would I want these people to be writing secure e-commerce sites in this way?! I don’t want to think about that (because I know it’s true). I wasn’t impressed.

So, despite the fact that today I’m writing about setting up webservers, this brings me back to Philip Wadlers Links project. The aim of this project is to take the Good Stuff from the world of research, and apply it to make a Better Way to produce web applications. Whenever I started working with XML, I thought “Great, we have schemas which define the structure of the data .. that means we can integrate that with our language’s static type system”. Hah, no such luck in the Real World … but projects like CDuce are showing the way. Similarly, if you write a web application you need to juggle with the inside-out-ness of the programming model – you can’t just call a function to get some user input, because your code is being driven at the top level by the HTTP request/response model and you always need to return up to the top level. Continuation offer a possible solution to this, as a richer means of controlling the flow of a program, as Avi Bryant’s Seaside framework demonstrates. Today, if you are writing a web application you need to worry constantly about what happens if the user hits the “back” button, or reloads a page, or clicks “submit” twice when they’re making a payment. Perhaps in the future, with better building blocks, these things will come “for free”, and we can wave a fond farewell to a whole class of common web-app bugs.

Web-based applications have lots of advantage (and disadvantages too). I personally really like the “your customers are always using the latest version of the software” aspect. But a lot of today’s web technologies are rooted too much in a perl-hacker mindset. It may be that this is indeed a rewarding place to apply newer programming technologies. I still think the world will not be ready for the Links project for many years to come, but perhaps it will pave the way.

Oh, back to the original story. Having installed everything and got it all working, I flipped my DNS record to that www.nobugs.org went to my home box. But the next morning, I flipped it back. Why? At the end of the day, paying someone about 30UKP a year to host my site is pretty good value. I don’t really to be worrying about my website response time every time I downloading big files over the same link. And if my website ever gets cracked, I’d still rather it was on someone else’s LAN and not mine. Although it might seem like a waste of time to spend hours setting all this up and not use it, I know that I’ve learned lots of useful information and lessons. C’est la vie.