Monday, 24 September 2012

An iPod mini Adventure

Remember the old black and white iPod generations? Well, yesterday I retreived my long-lost first-generation iPod mini and it thrilled me to bits!

The iPod mini was the shortest-lived iPod and somewhat derided on introduction as being over-priced and kinda girly. It turned out to be so stunningly popular Apple had difficulty meeting demand. I ordered mine just two hours after they became available in the UK Apple Store in June 2005.

You'd think their internal 1.4" spinning hard disk would make them pretty delicate, but in fact that they could take real abuse and my iPod mini's no exception:


It's a battered little critter, mostly from being driven over for a few hours in a Stockport car park where I once accidently dropped it. Chunky isn't it - they made electronics that way then ;-)

Yet two years ago I managed to leave it on holiday at Dove farm cottages in Ellestone with my fiancée and some friends. I'd kept trying to make an effort to track it down since then, but after a little autumn camping trip at the wonderful, good-value and basic Pudding Room campsite with a couple of friends this weekend:

I thought I'd have make a real effort to find it. So I headed off back to Dove Farm and had to knock a couple of times before a lady opened the door (they weren't expecting me, 'natch). So I cautiously asked whether they remembered seeing an old iPod mini left here back in 2010.

“That’s a long time ago”, she said.

I understand, I said as I described it, It’s a bit of a long-shot, enough of one to have made a personal point of giving it back to God a few minutes before.

“But if it's there, I think I know where it'll be.” and she headed off back into the house. I thought she was going to head off to the dining hall where we'd actually played iPod music during the holiday, but actually she returned just a minute later with it exactly as I'd left it. Rather than chucking it all, they have a bit of a stash of things guests have left behind, which is impressive considering how often people are likely to do that.

Speaks volumes about Dove farm, thank you.

I charged it up last night and I've been listening happily to its contents this morning, batteries are still good after all these years :-D

Thursday, 13 September 2012

SIA Later!

Or rather we won't as in a few years it'll all be gone!

This is a little blog about current Arctic Sea Ice Area as we near the 2012 record-breaking summer minimum.

Take a look at the image:

It's a section of the Arctic SIA as of yesterday.

We can see that the whole of the top-right hand edge, is the Northern Sea Route. You can see it's open-water and there's a lot of it. It first opened in 2009, but right now it's so wide you could pretty much sail the UK straight through; and within 3 years!

The opening of the Northern Sea Route means that ocean currents can sweep more easily round the eastern edge of the North Pole; bringing warmer waters from the Gulf Stream (not to be confused with the Jet Stream); and thus accelerating the collapse of the Arctic Sea Ice. We can see the effect quite clearly; the eastern edge continues to melt significantly, just days away from the supposed end of the melting season.

By contrast the Western edge of the Arctic Sea Ice is pinned by an extensive set of islands as well as the all-important Greenland land mass. This is why the Sea Ice is clinging to that edge, the frozen land keeps it cooler and protects it from ocean currents.

The last thing to note is the colour scheme. Red means '60%' ice, pink means '80%' ice; purple is near 100%. This means that the white dot in the middle, which is the North Pole itself, is only 80% Sea Ice at best and has a large amount of 60% (i.e. rotten) Sea Ice relatively close by. Given that the Eastern edge of the ice is about half-way to the North Pole, I'd guess it'll be gone within 3 years.

SIA Later, in a week or so for my post on the Arctic minimum!

Friday, 3 August 2012

Horses That Run...

...are the ones that aren't starved.

The BBC recently linked to an article on PowerPoint's 25th anniversary. I'd always thought it was a Windows app until now, but actually it was Mac about 6 years before it made it to Windows. Suddenly that made Powerpoint about 10x more interesting than I'd ever considered so I did a bit of searching and found a book called Sweating Bullets.

The free google book edition leaves out quite a bit, but I was mostly interested in the history up until the first release: the kind of development difficulties Forethought had working on early Macs (they targetted the 512Kb Mac) and the online book covers that quite nicely.

Actually most of the book is about the marketing of Powerpoint: why the concept was such a hard sell and Robert Gaskins, the project manager, deserves a lot of credit for his persistence. But the thing I found most interesting was their whole perspective on the development platform.

This is how it goes. They started work on Powerpoint in late 1984 / early 1985 after spending 18 wasted months working on a PC-based graphical predecessor that included an operating system (because graphics OSs weren't really available by then). Now, Windows 1.0 had kinda just been released, but the Mac had been around for 18 months. However, Gaskins initially discounted the Mac version and planned all the design and development for Windows. It was only when he found out that the current state of Windows in 1985 was:
  1. Unusable, and
  2. Years away from being useful (in fact, about 6 years, but they didn't know that then); and
  3. Not even Microsoft were planning to release practical graphical apps for Windows until years after their Mac versions of e.g. Word and Excel.
That they decided (grudgingly) to go with the Mac version first. When they did, they found that with the exception of having to run the development tools on Lisa its predecessor, not only was the Mac wonderful to use even in 1985, but that its design gave it ample performance and software components to complete both the first plus second versions of Powerpoint with less than 1/3 of the effort it took to merely port it to Windows when that day finally came.

What this really shows is how mindshare affects business decisions; in this case Windows had already won in the minds of software developers even though it was a complete train crash at the time - the quality and capability of an existing competitor wasn't even a consideration until the alternative was known to be infeasible.. and even then the Mac version (that saved their company) was really only developed in order to springboard their way to Windows.

It's not the way I think, I'd sooner plug quality and good ideas even if they're not going to be the obvious winners - after all, any horse can win if you starve the rest - it's just not something to be proud of. So it's not surprising then that Apple found it so hard to make headway for the first 20 years and being caught out by the Windows mindshare effect in this case was a real surprise for me!

Friday, 6 July 2012

Are They Human, or Are They Bankers?

Tony Robinson raised that question on Question Time last week. Although he gets a couple of facts wrong (e.g. bailouts were billions, not millions) his stinging litany of Bankers' greed leading up to 2008 and the aftermath makes for sober listening.

However, the latest scandal involving Barclays Libor rates appears to have the previous Labour Government possibly implicated. Based on the evidence I can muster though I don't think that really makes sense. Here's why:

Banks make short-term (daily-ish) loans to each other to cover short-falls in each others' reserves. The largest 8 banks publish the rates they have to pay when they take a loan of this kind and the middle 6 are used to derive what is called the Libor rate. The scandal is that Barclays' fiddled their published Libor rate after late October 2008 to, 2010 (or was it 2009)?

However, Barclays now claim that they only manipulated it because they'd heard that senior Whitehall figures were concerned about their Libor rate being in the top quartile or decile. This is how the history pans out:

Before October 8, 2008

This Guardian article gives the sequence of events, but you'll need to start at the bottom. HBOS crashes 34% on Sep 15 as Lehman Brothers employees are turfed out of Canary Wharf. Barclays seals deal Lehman assets on Sep 16 while HBOS shares crash to 88p. Sep 17, Libor hits a 7-year high; Lloyd takes over HBOS for £12.2bn while Morgan Stanley crashes 30% (and turns into a non-investment bank 5 days later). Sep 25: Bradford & Bingley let go of 350 staff (later bought by Santander) and HBSC axes 500 a day later. By Sep 29, RBS are down 20% Barclays another 9% and Libor goes 'through the roof'. Just before October 8, Icesave goes into default and then the UK government announce their rescue package.

Barclays Libor During The Rescue Package

The UK Government's bank rescue package provided £500bn for a number of major banks and of the major ones, only Barclays declined to get involved, despite them having shrunk pretty much as much as Lloyds.


 Barclays needed a cash injection of 6.5bn, but they chose to get it privately. Now, if we switch to looking at their Libor graph over the period:
 To my mind the first oddity is that their Libor had been rising in Mid-september, but goes lower at the point where they decide to buy Lehman Bros assets before shooting back up by about the 20th. I'm not sure if that makes complete sense. The Libor rate reflects the insecurity of the bank - why would it go down if they buy the assets of a bankrupt company?


Their Libor then climbs sharply (along with other banks) through to the bailout on October 8; drops briefly and then continues to rise to the end of October. Now, I would be pretty sure that there would be civil servants in Whitehall who would be monitoring the Libor of particular banks - because given their prior financing behaviour, it would not be unexpected for them to engage in financial cover-ups. Barclays figured it needed a small fraction of other major banks (6.5bn), but would finance it privately so it was claiming it's finances were secure. However, their increasing Libor implies they aren't.


The question is, does it make sense for Labour to push Barclays into artificially lowering its Libor rate given that it was willing to bailout Barclays a month before (Barclays 6.5bn would have been 1.2% of the overall bailout)? My thinking is it wouldn't make sense: it'd make more sense for Labour to push Barclays into joining the bailout.


On the other hand, would it make sense for Barclays to not want the UK government (and by that token the UK tax-payer) to part-own Barclays? Yes, that would make sense.


Would it make sense for Whitehall to be concerned about Barclays Libor figures? Yes, given the financial situation at the time, yes it'd make sense.


One further thing to note; by artificially lowering Barclays Libor rate to a negative one, doesn't that mean that Barclays would be effectively gaining money on inter-bank lending? Money that had come from the UK government bailout? At the time, note that Barclays justified its financial security by arguing that it would raise £7.3bn via its Middle East investments (Guardian, October 31, 2008), but its Libor rate had started falling 2 days before.


Friday, 1 June 2012

Global Crunch Twin Pack

Most of my blogs are techie, but occasionally I stray into politics. It looks like the global economy is about to take a second bite at the same, un-nutritious Global Crunch candy bar, I don't think it has to happen.

In 2008 I wrote a post about the Global Economy Crunch. In it I compared it with previous major economic collapses. My assessment at the time meant I connected those crashes with an unsustainable boom due to market deregulation and the following depressions due to protectionist (i.e. austerity) measures and only overcome due to practical implementations of Keynsian economic theory. I predicted that this crash would last at least as long as the worst of the previous ones.

Since then, although we managed to avoid a meltdown by the courageous step of major bailouts for banks and global financial institutions, governments have followed the predictably damaging path of Austerity to the point where it looks to me like we're heading for another, worse crunch than in 2008. Here's why.

Austerity measures in the UK mean that we're back in recession (as Labour predicted in 2010), whereas the US is not (though their crash was worse). The conservative government have been championing manufacturing, yet manufacturing is shrinking in the UK today (at its fastest pace for 3 years). So, there's no fall-back in the public sector (which has been downsized) and no pick-up from the service sector either.

Manufacturing in Spain and Greece is shrinking; there are major issues with the funding of banks in Spain and unemployment there is at a record 24% plus; Italy's bond yields are virtually unsustainable, Greece is about to vote on whether they exit the Euro (it'll be awful for them either way); Ireland's just voted for a heavier austerity package.

More disturbingly though is what's happening in East Asia as everywhere you look there the economy is slowing down. China's growth is down and even internal growth is slowing. India's growth is similarly slowing (an article just one hour before I've linked this argues whether India's growth is over) and it's manufacturing sector recently even shrank. South Korea is suffering a slow-down. In my opinion this is all relevant, because a major reason why we survived the original Crunch in 2008 was because the far East was doing so well and could basic bail-out the West; and doing so well to the point where it was understood that even if the West went under they'd continue pretty well.

The other concerning aspect is the way right-wing think tanks are continually arguing for business deregulation; eliminating workers rights through, for example no fault dismissals, which are supported by the PM, and more flexible working. Similarly in Europe, right-wing economists are arguing for more Austerity.

I don't believe that Austerity works at a macro-economic level, though it can work at a personal level. The reason is that at a personal level if you're frugal, everyone else can cope with you spending less - they only lose a fraction of a % of their income; but if everyone cuts back to suddenly make ends meet then the result is a self-inflicted vicious circle of deprivation. For example, tying the Greek bail-out to austerity meant that Greece becomes deprived of the engine (i.e. the workforce) they need to get out of their debt crisis. In that sense it's better to tie European a mandatory trade boost with Greece to internal cut-backs; which would be analogous to personal frugality, with the Greeks making do with an average lower standard of living, but gaining full employment (by virtue of the trade agreement) and thereby the means to overcome debts. Europe here would be taking up the economic strain, but we're in a better position to do so.

On the other hand, I think there's a better way: cooperative economics. Rather than penalising the very people who lost the most in the initial Crunch we would be better off by Enfranchising The Workforce; making it ludicrously easy for people to form cooperative micoenterprises and for working people to have a greater stake in their companies in lieu of the pay-rises they're not going to get for the foreseeable future. The thing is, we already have the resources with us; we don't need to Crunch twice on the same disastrous candy bar.

Tuesday, 15 May 2012

More Xubuntu-based Emulation: xz81

My experience with getting a ZX Spectrum emulator to run on my iBook 600 led me to wonder how easy it would be to get a ZX81 emulator to run. The tricky part was finding a suitable X11-based emulator. There wasn't an obvious port like FUSE or Xspectemu, but after a while I found one, the z81 emulator by Russell Marks.

This emulator can be compiled for svgalib or plain X11, which is the version I chose. It's easy to compile, you just unpack it and type: make xz81 then sudo make install xz81 . You also need to download a ZX81 ROM - I used the Shoulders of Giants ROM.

xz81 was only about 300Kb unpacked and 100Kb of that was a directory of ZX81 games. It compiled in about 1 minute on my iBook. What I'm most impressed by is the fact that not only didn't I require the involved .configure step, but that the compile was so quick and it worked despite it being last updated about 7 years ago. XZ81 is really quite nice and quirky:

  quirky mostly because the keyboard help screen is rendered as a ZX81 bitmapped image and the file-selector option is managed as a ZX81 program (though it's really written in C as part of the emulator).

xz81 is pretty crude though - it needs to be recompiled to run in a different scale (the normal scale is 2x) and although it supports some typical ZX81 hardware (like the printer, by producing .pbm files)
It doesn't support proper high-resolution ZX81 graphics, so some programs don't work so well.

Since I'd had a comment from a previous user about a ZX81 Forth ROM I thought I'd try it, but the h4th.rom is quite hard to track down and in the process I found an alternative, a recently written (2011) ZX81 version of Forth called Toddy Forth.

It's also quite nice and simple, though as standard it doesn't include ZX81 features, such as INKEY, PLOT or AT. It's based on Camel Forth and since it's a DTC Forth it's actually pretty fast. I benchmarked it using the same benchmarks I used for FIGnition:

 Benchmark
 Jupiter-Ace (fast mode)
 Toddy Forth (slow mode)
 FIGnition  Ratio  FIGnition KIPS
 BM1  0.16  0.21  0.02  8  50
 BM2  0.54  0.54  0.088  6.14  56.82
 BM3  7.66  7.87  0.41  18.5  36.23
 BM4  6.46  7.94  0.47  13.69  31.78
 BM5  6.52  8.22  0.51  12.78  33.33
 BM6  7.38  9.78  0.64  11.53  39.06
 BM7  12.98  15.12  1.27 10.22  25.98
 BM3L  1.0  1.58  0.05  20  200
Mean Ratio (ZX81:Ace) 0.82  Mean 12.61


 (w/o BM3L)  11.55

 Although Toddy Forth in slow mode is merely 82% of the speed of the Jupiter Ace we must remember that in ZX81 slow mode, the computer spends about 75% of its time just generating a display: in fast mode the ZX81 should be about 3 or 4 times faster; easily beating the Jupiter Ace.

Toddy Forth's download includes some extra definitions in a library. I added its plot command so that I could time plot operations.

 Benchmark
 Jupiter-Ace (fast mode)
 Toddy Forth (slow mode)
 ZX81/Ace Ratio  FIGnition  Ratio  FIGnition KIPS
 Plot Full Screen  3.02 (2816 pixels)  4.66 (3072 pixels)  0.65  0.10 (2400 pixels)  29.61  94.1

Here, Toddy Forth is significantly slower, though not outrageously so.

Here are the benchmarks themselves (in Toddy Forth):

: bm1
  cr ." S"
  1000 0 do loop
  ." E" ;

: bm2
  cr ." S"
  0 begin
    1+ dup 999 >
  until
  ." E" drop ;



: bm3
  cr ." S"
  0 begin
    1+ dup dup / over
    * over + over -
    drop dup 999 >
  until ." E"
  drop ;
 : bm4
  cr ." S"
  0 begin
    1+ dup 2 / 3
    * 4 + 5 - drop dup
  999 > until
  ." E" drop ;

: bm5sub ;
: bm5
  cr ." S" 0 begin
    1+ dup 2 / 3
    * 4 + 5 - drop bm5sub
  dup 999 > until
  ." E" drop ;


 : bm6
  cr ." S" 0 begin
   1+ dup 2 / 3 * 4 + 5 -
   drop bm5sub
   5 0 do loop
  dup 999 > until
  ." E" drop ;

: array
  create 2 * allot
  does> over + + ;

5 array m

: bm7
  cr ." S" 0 begin
   1+ dup 2 / 3 * 4 + 5 -
   drop bm5sub
   5 0 do dup i m ! loop
  dup 999 > until
  ." E" drop ;
 : bm3l 0 10000 0 do i +
  minus i and i or i xor
  loop drop ;


 : bm1g
  48 0 do i
    50 0 do
      i over 3 plot
    loop drop
  loop
;



16436 constant clock

: time-bm
  find
  clock @ swap execute
  clock @ swap - . ;



Tuesday, 8 May 2012

Should Have Gone To Xspect Savers!

I'm an old-time ZX Spectrum owner from 1982 and since it was the machine's 30th birthday just last week I figured it's mandatory to run an emulator on every Mac of mine, including my cranky, old, 600MHz Xubuntu-running G3 iBook. I had no idea how much effort would be involved!

For lots of more modern systems it's just pretty easy to install FUSE, the Free Unix Spectrum Emulator; but it's not readily available as a package for my iBook, so I had to recompile it, and when I did: for the SDL library and then just for plain X I found it would crash with an 'illegal instruction' message before doing anything.

My overall impression of compiling FUSE though was of the immensity of the work involved, and the size of the code, the download expands to 10.3Mb and then I needed SDL at a whopping 29.8Mb - you can't get much more simple than that eh!?

And of course, in the end it didn't work.

However, I managed to find an alternative: Spectemu-X11, which wonderfully I could download as a package for my machine. Unfortunately, that too didn't quite work - on my iBook I found that I couldn't generate a Symbol Shift since the keyboard didn't support the Right-Shift key-code. So, then I downloaded the source (which when expanded and compiled uses 1.7Mb, almost small!) plus the diff for the 0.94a-9 version; and then had to learn how to apply the diff to a folder: place the diff file in the root directory of the package (in my case just inside my spectemu-0.94 folder) and then type patch -p1 < theNameOfThePatchFile.diff 

And it did it!

Then I compiled SpectEmu, which it duly did and left me with the same problem, no Symbol Shift. So I did some tracking on why that's the case. It's entirely due to the key codes defined in spkey_p.h. The definition for Symbol Shift is derived from SK_Shift_R which is:

#define SK_Shift_R        0xFFE2    /* Right shift */

With a bit of debugging I found out that the command key on my Mac generated 0xFFEB, so all I had to do was replace the above line with:

#define SK_Shift_R        0xFFEB    /* Right shift */

touch all the files that #include spkey_p.h and then make it again. Easy, and now I have a Spectrum Emulator on my lowly (but lovely) iBook!

Next, back to working on my own project, the FIGnition DIY 8-bit computer!