Subscribe to
Posts
Comments

Technology

Elin at Tanybwlch Beach This Week - Taken on my iPhone
Yesterday I downloaded the iPhone application for WordPress. I discovered that I needed to upgrade the software on my site too but after doing that it all seems to work perfectly.

So this is the first post that was born on my iPhone. Maybe with this in hand I may start blogging again more often.

Kudos to the team who brought this open source app to the iPhone. My next task will be to find and look at the source to see how iPhone apps are built.

They kill trees - but at least Amazon can't steal them back
If anyone was ever tempted to buy the ugly Amazon Kindle, then they might like to think again. Among other sources, The Guardian Reports that in a move laced with unintended irony, Amazon deleted copies of George Orwell’s 1984 from customer’s devices! Clearly the books had become doubleplusungood.

So how was it that Amazon broke into people’s private property and censored a book that is itself about the evils of such things?

It seems that Amazon had distributed books for which the producer of the book did not have appropriate permission in the United States of America, where (like Europe) copyright law is several degrees beyond sensible. Whereas many people in many countries have freedom to read 1984 for free, as it has entered the public domain, in the USA many more years will pass before the book will be deemed to be in the public domain.

The upshot of this is that even though you can download a copy of 1984 from sites in such enlightened countries as Australia, you may not make that work available in the USA. Or rather, you may not *sell* that work in the USA. As Amazon only sells their ugly e-reader in the USA to date (leaving the rest of the world with the much better offerings from Bookeen, Irex and others), all books downloaded to the Kindle were deemed to be sold into the USA and thus the work was not in the public domain.

Thus there was a clear legal issue. Amazon were liable for selling works to customers over which they had not secured the rights. This book and others were produced by third parties who merely used Amazon as a distributor.

Amazon on discovering they had sold these books in contravention of the law then went into people’s private property and deleted the items – sometimes when customers were in the middle of reading them. They provided a refund, but that is really not the point!

Suppose someone did this with a paper book. I can upload a copy of 1984 and self publish through a service such as lulu.com, who will distribute to Amazon and thus I can sell the book through Amazon. Suppose I do this, and people buy the book, and then the evil deed is discovered. What should Amazon do? Do they send in thugs to break into your home and destroy every last copy of the book?

Of course not! Copyright theft is only theft inasmuch as it deprives someone of legitimate income from their work. The estate of George Orwell, assuming we accept their continued income is completely legitimate, is deprived of money if I do this, because buyers of my book would presumably have paid for the legitimate work instead.

Thus I would clearly be liable to the estate for damages. I can be prosecuted for my criminal actions and sued for damages. I should, of course, pay reparations for the loss by the legitimate rights holder. Amazon likewise have some liability here, and should make reparation. But the books that were sold were sold. No one will attempt to recover them – after all, what is the point? Once reparation is made, there is now no loss and thus the theft is rectified.

So why would Amazon think they can break into someone’s private property and delete their digital books? Oh – because they are digital! And that means people have signed their rights away when they clicked “I agree” on their setup screens. They gave Amazon the right to invade their property at any time and to remove anything that is doubleplusungood.

So if you are tempted to buy an Amazon kindle, think in this carefully. Do you want to buy a device that is not really your own, and that is forever at the mercy of a company who could delete all your books without even asking you? Amazon are late into this game anyway. There are plenty of book readers that have no such restrictions. Or you can use dead trees. But I for one don’t now want anything to do with the Kindle. And not *just* because it is so terribly ugly.

Fuel Cell. Photo: Eston BondWhen confronted with the issue of diminishing reserves of oil and our car dependent culture that consumes more and more of these reserves, I often here the retort:

>Electric fuelcell operated vehicles, in my opinion, are the answer.

Wrong.

A fuel cell vehicle is powered by hydrogen gas, which is turned into
water as a byproduct of the process. It is nice and clean on a local
level, but think for a minute: where are the hydrogen mines?

We obtain hydrogen in a copule of ways. We can use hydrocarbon fuels and catalytic cracking – but then we are still using fossil fuels. The other method is through a form of electrolysis of water. This
splits the hydrogen from the oxygen in the water, which can then be
used in a fuel cell (the same process is used to create rocket fuel,
where both hydrogen and oxygen are gathered).

But the law of conservation of energy says this: if you turn water
into hydrogen and then back into water, then at maximum efficiency,
the energy used to create the hydrogen is equal to the energy you gain
from that hydrogen later.

Fuel cells are not 100% efficient, but even if they were, they would
be nothing but batteries. They store the input of energy for later
use.

Electrolysis requires electrical energy, but wher does that energy
come from? Well some of it can come from renewable sources, some of it
from nuclear power, but most of it comes from burning fossil fuels,
and certainly if our requirement increases significantly then we will be forced to
meet those requirements by burning more fossil fuels.

Okay, so we can burn coal and gas as well as oil, but we are still
back where we started – using capital reserves of energy as if they
were income.

Fuel cells are not the answer – they are merely an enabling
technology.

Apple LogoSince Apple moved to OS X and built a solid Unix core at the heart of their products, I have been in love with their systems. I currently have three Macs with a fourth due sometime in the spring.

I have an iPod video too, and believe that Apple’s attention to detail, aesthetics and technology are a great boon to the IT industry.

I have been a long time Linux user, and before that I have used other Unix systems since the 1980s, but Apple computers are the first Unix machines I have been able to recommend to non technical friends and family (and with great success. I am slowly converting everyone I know to Macs).

So it was with joy that I saw the iPhone announced the other day. This phone (running OS X) is the future of telephony in my opinion.

But my joy turned to dismay at the news that Apple had once again decided that rather than settle a trademark dispute, they would try to continue to use someone else’s trademark and railroad them into submission. This time it is Cisco’s iPhone trademark that Apple are ignoring.

This is not a new departure for Apple, who have already succesfully beaten off Apple Corps, the Beatles label, in violation of an earlier agreement to share the trademark, where Apple Corps had the rights to the name in the field of music.

There have been some less obvious claimants that Apple has defeated over trademarks. The fact of the matter is that, for all their better products, their cool hardware, their open source operating system and their attention to detail – Apple is still an old fashioned company in the mould of Microsoft.

I still love Apple kit, and I’ll still recommend it. But each time Apple acts like a big corporate monstrosity, I become a little less enthusiastic.

And in the meantime, Ubuntu Linux is almost as good as Apple for usability. Mix that with a range of hardware that really works, and Apple computers will not be the only Unix boxes I would recommend to my mother.

Windows Vista

Broken Window near Seattle. Photo: Steve McCoyIn his “Joel on Software” blog, Joel Spolsky writes a good article on why bloggers should not accept gifts from companies trying to get their products advertised. Buried in the midst of the article is his review of Windows Vista, based on his own tests:

1. Do not, under any circumstances, consider upgrading an XP system to Vista… even if it’s fairly new and even if it’s Vista Supremo Premium Ultra-Capable.

2. When you get a new computer, if it comes with Vista pre-installed, that’s when you’ll upgrade.

3. Don’t buy a new computer now just to get Vista. If your current system meets your needs, stick with it until you really need a new system. Vista is not reason enough for a new PC.

4. Need more details? Read Paul Thurrott’s review.

He doesn’t mention the treacherous computing issue, which ought to cause everyone to turn down Vista (but let’s face it, it won’t, because most people have no idea what rights they are signing away each time they upgrade their Windoze eye candy). But from someone who has no anti-microsoft agenda, Joel Spolsky’s comments are very reasonable. If you want to use your computer to do real stuff, don’t upgrade to Vista.

Apple Releases New iPhone

iPhoneWell the much anticipated iPhone has just been announced by Steve Jobs. There are no surprises here really – the merger between iPod and phone has been widely expected and the multi gesture touch screen interface was patented last year.

But as usual, the Apple technology just looks so slick. No chance of the dreadful Zune product taking over from the iPod any time soon. And despite the fact that I really don’t go in for buying clever phones, I can see myself buying this product as and when it is available in the UK.
iPhone

TomTom
The other day I wrote about how I had attached my TomTom One to my Mac via bluetooth to extract the GPS data. I hooked this all up to Mac stumbler and took a drive around Aberystwyth to see what wireless access points were advertsing themsleves. I used no special aerials, nor did I try and look for access points that were not advertising themselves – if a beacon fram made it to my Mac sitting on the passenger seat, it was counted – otherwise the access point was ignored.

The results of my drive are displayed in this Google map of some Aberystwyth Wireless Access Points. I haven’t put all captured fields of data into this map, because it is just for demonstration purposes. It is also not a complete map of Aberystwyth access points for the same reason. The third disclaimer is that the markers show the locations where I first saw a beacon frame and not the position of the strongest signal from the access point.

But the question is: how do we get the data from Mac stumbler to Google maps?

Mac stumbler saves its data in a “plist” XML format. This is a slightly odd format that looks like this:

<plist version="1.0">
<array>
	<dict>
		<key>channel</key>
		<integer>1</integer>
		<key>comments</key>
		<string></string>
		<key>date</key>
		<date>2006-11-08T17:26:57Z</date>
		<key>latitude</key>
		<string>W 5224.795410</string>
		<key>longitude</key>
		<string>N 404.561493</string>
		<key>mac</key>
		<string>00:12:17:DD:99:0E</string>
…
</dict></array></plist>


and so on.

What would make more sense would be:

<node>
  <channel>1</channel>
  <comments />
  <date>2006-11-10T17:57:11Z</date>
  <latitude>W 5224.771484</latitude>
  <longitude>N 404.355896</longitude>
  <mac>00:12:17:DD:99:0E</mac>
…
</node>

So I wrote an XSL style sheet which would do this translation, and ran the plist file through xalan to apply the stylesheet. The stylesheet is here: 

<?xml version="1.0" ?>
<xsl :stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    </xsl><xsl :template match="array">
        <nodelist>
            <xsl :apply-templates select="dict"/>
        </nodelist>
    </xsl>

    <xsl :template match="dict">
        <node>
            <xsl :apply-templates select="key"/>
        </node>
    </xsl>

    <xsl :template match="key">
        </xsl><xsl :element name="{translate(text(), ' ', '_')}">
            <xsl :value-of select="following-sibling::*"/>
        </xsl>
  </xsl:template>
</xsl:stylesheet>

At this point, I could have just written a google maps page to read my data, but there is a complication. NMEA format presents data in degrees and minutes, whereas google maps and many other applications want to use decimal degrees. I wrote another stylesheet that translates the NMEA data to decimal degrees and then throws out the results in someting that I could copy and paste into an existing google maps page. This is not pretty (and the XML code is not as neat as I would like), but I wanted something running quickly, so here is the code I used:

< ?xml version="1.0" ?>
<xsl :stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl&:output method="html" omit-xml-declaration="no"
     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
     doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />

  </xsl><xsl :template match="node">
    </xsl><xsl :variable name="lat1">
      <xsl :value-of select="substring(latitude,3) div 100" />
    </xsl>
    <xsl :variable name="lon1">
      <xsl :value-of select="substring(longitude,3) div 100" />
    </xsl>
    <xsl :variable name="lat2">
      <xsl :value-of select="floor($lat1)" />
    </xsl>
    <xsl :variable name="lon2">
      <xsl :value-of select="floor($lon1)" />
    </xsl>
    <xsl :variable name="lat">
      <xsl :value-of select="(($lat1 - $lat2) div 0.6) + $lat2" />
    </xsl>
    <xsl :variable name="lon">
      <xsl :value-of select="(($lon1 - $lon2) div 0.6) + $lon2" />
    </xsl>

    var marker = createMarker(new GPoint(-<xsl :value-of select="$lon"         />,  <xsl :value-of select="$lat"  />), 0<xsl :if test="wep='Yes'"         >1</xsl>,”<xsl :value-of select="ssid" /><xsl :value-of select="mac" />“);
    map.addOverlay(marker);
  </xsl:template>

</xsl:stylesheet>

Having run the plist through xalan again, I coped and pasted the results into the web page example above.

TomTom One and Mac GPS

TomTomOkay, I have successfully connected my new TomTom One with my Mac laptop via bluetooth, such that the GPS data can be read by applications. It was not quite the way I wanted to do it, but it works well enough. Here then are instructions if you want to do the same (complete with how to get Macstumbler to read the GPS data).

Safety first: Do not follow these instructions until you have backed up your SD card safely, and have tested the restore process. Restore to a new SD Card and keep your original SD card safe. The details on this web page do not constitute a recommendation that you should follow them. You do so entirely at your own risk.

Okay, with those disclaimers over, and if you want to proceed, then you need to do the following:

1) Install the rfcomm executable onto your SD card
2) Install a startup script that will create the rfcomm bluetooth connection(s)
3) Tell your Mac to listen for the connections
4) Tell Macstumbler and other applications where to find the GPS data feed

There is an easy method and a hard method to do this. I’ll detail the easy method first.

You can install the missing rfcomm executable and some pre-built scripts by downloading the Wildtom package (tt-bt-net2.zip from Roberto Piola’s site). If you want to connect to a Linux box with bluetooth, this is all you need. Just follow the instructions in the package.

However, if you have a Mac, then you have some more work to do. Copy the files in the Wildtom package onto your SD card, and then edit the gpsproxylistener file in the wildtom folder on the card. You are going to alter this so that it no longer listens for incoming connections, but tries to open a connection to your Apple mac.

Why?

Unfortunately the Mac does not provide the tools for creating a direct RFCOMM connection to the TomTom one. It tries to do everything through the GUI interface. This would be great, except that the RFCOMM serial ports on the TomTom are not discoverable, and it resists pairing. If you could pair to the TomTom one from a Mac (using the Pairing key of 0000) you could theoretically just connect up the serial ports, but I couldn’t make this work unfortunately.

Right, so we have to get the TomTom to initiate the bluetooth serial connection to your Mac. How do we do that? Well, the first step is to discover the MAC (Media Access Control) address of your Mac’s bluetooth adaptor. click the “Apple” menu, choose “About This Mac” and click the “More Info” button. Under “hardware”, click “Bluetooth” and your Bluetooth Mac address is listed in the address field. It is a six byte number that looks something like this: 00-14-51-00-01-02. Note this down.

Okay, so we have the MAC address. Now plug in your TomTom One to your Mac and let it connect to the computer so that you can access the SD Card. Navigate into the “wildtom” folder on the SD card and edit the file called “gpsproxylistener”. Change the “rfcomm listen … ” line to read:


/mnt/sdcard/wildtom/rfcomm connect 1 00:14:51:00:01:02 3 &

Substituting your bluetooth MAC address for the one above of course. Technically, this is no longer a gpsproxylistener, but don’t worry about that detail!

And that is it. You are ready now to connect your TomTom. Disconnect from your computer, and click your way through te menus to find the newly installed “start BT services” button. Click this and click Okay to the following question, and your TomTom should now try to connect with your Macintosh. The gps data feed should appear on rfcomm channel 3, which should be your Bluetooth-PDA-Sync serial port (if you use a PDA, you may wish to modify the rfcomm cahnnel from 3 to 1 and add in a new incoming serial port).

Try it out. Fire up Macstumbler, or some other GPS aware application. In Macstumbler, choose preferences and choose to enable GPS support, and select /dev/tty.Bluetooth-PDA-Sync as the GPS device.

Make sure the TomTom One is not in your house (if your car is out the front, lock the TomTom in the car and go inside. Because we are using Bluetooth you don’t need to be right next to the GPS when testing). Once you get a GPS lock, “Show GPS status” in Macstumbler will give you your GPS location in NMEA format.

You are now ready to go for a drive and collect some test data!

This article is long enough now. Watch out for the next installment: How to convert NMEA data and Macstumbler output into something you can use on Google maps.

The problem is this: You want to connect to your Macintosh using bluetooth from a device that has a very basic bluetooth API, and which needs your bluetooth device MAC (hardware) address. What is the MAC address of your Macintosh bluetooth device?

There is a handy Unix utility for looking at your network interfaces that the Mac implements – this is the ifconfig utility. You can use ifconfig to find the hardware address of your other network interfaces – Ethernet, WiFi and Firewire. Unfortunately the bluetooth device is not listed.

The MAC address does not show up with ifconfig, nor in the system log files. So I ended up using my Mac Mini, and installing iStumbler , which can browse for nearby bluetooth devices and display information such as their Mac address, as in the example below:

iStumbler screenshot

I could have achieved the same results with the lightblue bluetooth python API or rfcomm on another Linux box with bluetooth. It turns out, however, that there is a much easier way. In one of those classic “smack your head with a wet fish” moments, I thought to click the Apple menu and choose “about this Mac”. There under the “bluetooth” heading I found this:

About My Mac

Oh well. iStumbler is an interesting application, and now I know the hardware addresses of bluetooth on all of our Macs and every other bluetooth device too.

TomTom One and GNU Linux

I bought a TomTom One this week. We finally relented and decided to purchase a SatNav after years of resistence, because we got lost last week on a trip to the Cutty Sark. Actually, we got to the Cutty Sark fairly well. It is not too hard to find Greenwich, because you just drive to the river Thames and turn right or left depending on which side of Greenwich you arrived at :)

But it was going home that caused the problem. I followed signs as best I could, but suddenly the only signpost (in the middle of London) was for Sevenoaks (which is in Kent). Weird!

I forget which road I took, but we ended up in Bromley – which is perhaps slightly preferable to Croydon, but not where we intended to be.

So SatNav it is. From now on, some computer can guide us (the wrong way up one way streets probably).

Maybe SatNav will be a good thing, although I have always felt that I am fairly good at following my nose. (Just as well, really, as I recently borrowed a SatNav to get me out of Birmingham – only the stupid thing could not lock onto its position, and I was on the M6 heading home before it finally started to play).

However, the other gadget I have wanted for a very long time is a GPS that will integrate with applications on my computer. So a bit of research showed me that TomTom produce systems that: (a) store the GPS data in a standard NMEA data format and (b) run on a version of GNU linux, with all the hackable possibilities that entails – including a neat little gpsdata device node. (Okay, at this point I am getting too technical. Linux and Unix systems treat everything like files that you can read and write to like any other file. The GPS data can be read like any other file in the filesystem by opening the “/dev/gpsdata” file. Only the file is constantly updated by the GPS).

The choice was a no brainer. Linux and a well respected SatNav. I bought myself the reasonably priced TomTom One, and so far I am very impressed. It does everything a SatNav does, and I have already found out how to run a few extra startup scripts that get it creating RFCOMM ports to dump the GPS data feed over bluetooth.

(Getting technical again… trust me though, it’s great fun!)

My only problem comes in accessing this feed. It works fine on my Ubuntu Linux desktop box, but my Mac laptop is trickier. I cannot find how to create RFCOMM outgoing ports on OS X Tiger, unless I am paired with the device. But the device does not need to be paired (and refuses to do so).

So I compiled some Python extensions, and that all works. But what I really want is the gpsdata as an RFCOMM serial port, so that my applications think of it as a directly attached gps unit. Maybe If I initiate the connection from the unit, and use incoming ports that would work… but I would prefer outgoing ports.

Anyone know how to do that?

(If / when I get it all working, I’ll write a howto followup article).

Next »