Older blog entries for nutella (starting at number 242)

No Pi for you!
I am using commercial program that is well-known in the field in which I work. It has a scripting language for building models in a flexible manner but most of the code I have written has been quite straightforward. More recently I had to come up with something a little more elaborate and it was only then I realised that the language is hanging firmly to its Fortran underpinnings. The two main clues were; 1) no definition of Pi, and 2) trigonometric functions limited to SIN, COS and ATN. This took me back more than 30 years to when I was programming in BASIC for an ICL 2900 machine. For my current script I needed arccosine and my maths teachers will not be surprised to know that I had forgotten the half-angle equivalence that allows you to calculate ACOS using ATN (thanks Wikipedia). For Pi, since I was already wimping out, I eschewed the usual 355/113, or even something like 833719/265381, and instead used Machin's approximation (as that also uses ATN).

This weekend I decided to watch O Lucky Man! for the first time in ages - it takes a good while to gird oneself up to deal with that one scene (you know which one). It was only while watching it this time that I noticed the strange resemblance between Alan Price and Steve Jobs. For those of you not familiar with Mr. Price, try the image here. Maybe I am imagining things as as putting "Steve Jobs" and "Alan Price" in The Google doesn't result in any "separated at birth?" theories. Maybe it's the Tyneside accent that puts people off...

So, the motherboard replacement, I mentioned in my previous entry, worked out just fine. A modest outlay has given me a completely working box again, and no leftover parts (well, okay, maybe a few screws). The CMOS battery was DoA (but that's not surprising for a five year old board) so the only real gotcha was that the behaviour of the audio ports didn't match the documentation in the manual. Thankfully I didn't have too much to lose, so trying my headphone jack in the "microphone" socket wasn't that risky. Actually, the problem may lie with the autodetection function of the Realtek driver. I'm not that fussed now that I have sound. I didn't realise that you could buy replacement latex mounting grommets for Antec fans, so mine are now held in place with wire ties and Blu-Tack.

"Are you from the past?"
I have been introducing my S.O. to The IT Crowd. When watching one of the shows from an early series she was puzzled when I pointed out the show was dated now because there was a LOLCat poster on the wall - but NOT because they had an Altair, a PET and a ZX81 on display.

Speaking of things becoming dated, I am wondering if Rich Lam's Vancouver couple photo will be the modern equivalent of Alfred Eisenstaedt's Times Square V-J Day picture. We'll see.

[Hah, it looks as if someone has broken the front page of Advogato with a misplaced HTML bold tag. Just like old times.]

With my S.O. abroad it didn't take me too long to revert to my old habits. I now have a disemboweled computer spread all over the bedroom rug. It's not as if she would disapprove if she were here, it's more that we've been busy doing things like measuring for curtains so that farting around with misbehaving hardware has been a low priority. Anyway, she gets to stay over there on a well-earned vacation and enjoy delicious XLB whenever she likes, while I get to fix a misbehaving box. This was one I built about five years ago with the main aim of being something for playing media (DVDs, CDs, photos, files etc.). It has a SmartPower power supply, smart fans and a silent (fanless) but fast video card. Recently it refused to boot and so after gutting it to a bare minimum I found that the motherboard (Asus A8N-E) wouldn't hold its CMOS settings. I fitted a new BIOS battery and reflashed the BIOS but still it forgets everything, even during a warm reboot. I don't see any damage to the motherboard but it seems likely that the NVRAM is dead, and that's beyond my fixit-fu. The board is about five years old, which means several generations have passed at computer evolution speed. It would be a shame to simply ditch it, as everything else works, so I looked around and found somewhere local that specialises in new end of life parts. They didn't have an A8N-E but they did have one of its cousins, an A8N-SLI SE, at a good price. So now I am reassembling the box and at first look it seems to work. Actually, I was surprised that it booted to the OS as the motherboard is not identical. Now I'll have to take care of some of the minor incompatibilities. The main one at the moment is that it doesn't have sound. I'll try and fix that or wimp out and drop in an old X-Fi card I have in the garage. When I popped the case I had forgotten how messy I had made it inside. The hard drives are some old SCSI disks so there's a long ribbon for them as well as the regular ones for the ATAPI DVD drives (I had two lying around). The reason it has survived is that the case is an Antec Sonata II which uses the magic of ducts[TM] to keep the airflow where it needs to go. That's essential as it does look like something that Harry Tuttle would delight in dealing with. I am glad that my life has changed so much that there's a time limit on how long I can scatter parts hither and yon, as the sane half of my life will be back soon and would treat my efforts with the dreaded raised eyebrow and half-smile.

24 May 2011 (updated 24 May 2011 at 01:16 UTC) »
Yay! Advogato is back (it was inaccessible to me for a few days). I'm back too, from a quick trip to Shanghai (my first). Wow! If Ridley Scott was to direct Blade Runner today, it would almost certainly be set there. I was very impressed by the Shanghai Metro - fast, clean and cheap.
Can't get any sympathy 'round here...

Me: My girlfriend says I am too nerdy because at the moment I keep my whiteboard in the living room.

Colleague: You have a whiteboard?

Miscellanea...

Now that the rain is declining I am trying to walk to work as often as I can. Until lately I have usually tried to make use of the time by spending it planning out my day. However I finally caved and entered the 21st century with a portable audio player. I now have a Sandisk Fuze and after some experimentation it runs Rockbox (3.7.1), mainly because the original firmware will not allow you to add compatible files, other than MP3 format, unless you register at the Sandisk site and install some Windows software. Rockbox works very well (and does waaay too many things) so that I only have to activate the legacy firmware for USB transfers. Beaujolais to the Rockbox developers! The only gotcha was that I don't have easy access to a computer with both an internet connection and administrative privileges. To reduce the chance of bricking Rockbox wants to download the appropriate files for you but I can't install Rock box on the internet machine and can't access the internet from the machine with the Rockbox installation. I didn't know how to get the files directly but then found I had overlooked download.rockbox.org. Doh!

So, I finally deleted my bookmark for Slashdawt. I realise I am probably the last person to do this but I had clung to some positive memories from years gone by (1990s) when postings there were occasionally funny (as well as being duplicates, poorly-spelled, poorly-worded and totally lacking in facts). Alas, the version of the site introduced at the beginning of the year seems to have eliminated humour as well as pumping up the space devoted to adverts. The main symptom is that all article tags have to be in corporate suitspeak. I miss the days of andnothingofvaluewaslost, noshitsherlock, zomgponies and goodluckwiththat. It is also very telling that the recent polls have all been thinly veiled market surveys ("will you be using cloud computing in the future?", "what storage devices do you purchase?"). These days there are better things I can do with a few minutes free time. ANDNOTHINGOFVALUEWASLOST

Another recent goodbye was my local Borders store. I will miss them much more. Unfortunately they decided to play nasty at the end as I received a message that "everything will be 20% - 40% off" and that I could still use my Borders card. I turned up at the store and looked around and could see the prominent "20% Off" labels. After some exploration I gave up and asked one of the staff to point me in the direction of something that was 40% Off. They were unable to do so and argued that "20% - 40% Off" didn't actually oblige them to have anything available with a greater discount than 20%. At the counter I also found the Borders Card was a waste as the person at the register pointed out that they were "not actually Borders any more" but were a liquidation company so they didn't have to honour Borders' offers. (Can you say "Bait and Switch"?) I'm still not awarding them an ANDNOTHINGOFVALUEWASLOST as they've been a source of much happiness over the years. However, I'm less likely to be venturing to any of the remaining stores. Time to make more use of the local independent stores.

One other oddity I noticed recently. Like many of the people I know my Gmail account has lately been bombarded by Tea Party spam ("the sky is falling!"). The weird thing is that Gmail will not allow me to classify it as spam (it always appears in the Inbox). Maybe the crazies have all the Google juice.

Too kind, people. Too kind.

You shouldn't have.

Spam in mailbox has gone down but non-useful new accounts at Advogato seem to be on the rise. I don't know if this is due to their appreciation of Google-juice or due to most real people posting indirectly through syndication, so that they don't see it happening. Having said that, the system for flagging annoyances is a big help.

I realised that I don't read language descriptions for fun any more. This occurred to me when I was writing a little script for my TI-89 Titanium and the syntax for statistical functions was a little bit unexpected. I didn't know this ahead of time because I didn't RTFM in advance. In contrast I have warm and fuzzy memories of a younger me going to the library checking out programming manuals for Fortran, ALGOL and PL/I even though I had no real access to any kind of computing resources to try them out. The nearest I could do at the time was to fill out programming forms with BASIC code and hand them in at school to be mailed off to be typed in to an ICL 2900 Series machine, that we were never able to see. I liked reading those old manuals and in my untutored way I could see the strengths and weaknesses of the languages. I continued reading with Jensen & Wirth's Pascal book (and Wirth's Programming in Modula-2), Leo Brodie's Forth books and Clocksin & Mellish on Prolog. Naturally K&R was easy and compulsory reading.

Now I realise that I don't read manuals for fun any more. I think that this is due to a mixture of recent languages being *big* (there are way too many ways to do things), the availability of electronic help (contextual or through the internet) and because I am older, impatient and more pragmatic. With small languages like C differences in code implementation are more at the algorithmic level (flamewars on brace style notwithstanding) whereas bigger languages have many options to write essentially the same code. This makes bigger languages more for lone coders as they are somewhat write-only (unless institutions force you to use a particular style or your coding partner is your conjoined twin).

This lack of pre-reading was probably exacerbated by my target for today being my TI-89 Titanium. No context-sensitive help there. Graphical calculators are also somewhat schizophrenic as they are simultaneously trying to be a fully fledged computer you can hold in your hand, but also a simple little calculator where functionality is intuitive and you never have to look at a book. Some people think that these calculators will go the way of the sliderule as they are replaced by netbooks and smartphones but I like the challenge of optimising my code so that it takes less than a minute to run. I'm not so much of a junkie that I'm programming with TIGCC or M68k assembler but I have fun. I also don't know whether the designer of this calculator should be shot or praised as the key labeling is illegible under dim or fluorescent light (GAR!) but this means my muscle memory has been forced to improve so now I almost never have to look for the [2ND] or [DIAMOND] functions. Anyway, I should have realised that a calculator with a built-in algebra system would be happiest being told that ranges can stretch to +/-infinity. Instead I watched my mis-implemented code fail when it crossed a particular boundary. It doesn't help that the TISTATLE functions seem to be happiest when called from the List Editor rather than used in a program and the documentation for them is fairly sparse. But it is available...

The human brain is a very weird device, and I can't tell how many background processes I have running at any one time. I will spend some time learning the boundaries of a particular problem and trying some basic solutions. Then I'll forget about it for a long time. Then I'll wake up with a hunch that I have to try. This happened this morning and netted me a somewhat obscure victory.

I have a quick script on my TI-89Ti to run linear regression on a pair of lists, spit out some statistics and then plot the data and the regression line. It can be a nice thing to have on a portable device. The one glitch that was keeping me from nirvana was that I couldn't easily limit the regression line so as to be plotted in the region encompassed by the data. In "TI-BASIC" (cough cough) the lists for a data plot have to be stored (not program-local) variables, so it makes sense to call the program with pointers to those lists as the arguments:

progName("arg1","arg2")

(putting the quote marks around a variable name turns it into a pointer) and you can then dereference the pointers when you need to in the program code:

LinReg #list1, #list2

where e.g. list1 is the variable name of the first argument defined in the program prototype. You can create a function graph of the resulting regression line with:

Define y1(x)=regeq(x)

but this will give you a line that stretches through +/- infinity (or at least crosses the entire graphics window). So you can constrain the domain of that function using "WITH" limitations, e.g.:

Define y1(x)=regeq(x) | x>0

which will limit the display of the line to the region with the dependent variable greater than zero. I wanted to limit the upper end of the line to the data and you can calculate that as max(#list1) so you *should* be able to use:

Define y1(x)=regeq(x) | x>0 and x<max(#list1)

but the interpreter does not parse that before passing it to the Y= Editor to set it up for function graph display. The ugly method I had been using was to save the x limit as a non-local variable and then referring to it for the limit in the definition. This morning I woke up with the idea of packing the graph definition into an expression that could be interpreted prior to it being delivered to the Y= Editor. So this ended up being:

expr("Define y1(x)=regeq(x) | x>0 and x<max(" & list1 & ")")

Nirvana! The bizarre thing is that I hadn't known that my mind was working on this. I'm now worried that part of my brain's capacity is occupied working on optimising some difficult Lego building exercise from when I was 5. People who say that we only use a fraction of our brain's capacity should probably be forced to qualify the statement to indicate that we're only using a fraction of the brain's capacity "for what we are working on consciously at this moment in time".

Yikes, is it nearly a year since my last post? I have been reading and enjoying Advogato on an almost daily basis but haven't had the time or inclination to write. My personal life has been way more interesting than it has been for a long time, so I'll see how it all works out.

This post was partly provoked by a previous entry by someone talking about R, which I have now been using regularly for over six months. I'm still using MATLAB and Mathematica, but R has all that Free Software goodness, which means I can just send the scripts to my colleagues and let them play. The other person's post was about graphics, and I believe that they were using the lattice/trellis form. That's overkill for my needs. However, one glitch I have encountered is with split.screen() as multiple runs of the script with different row and column values causes problems and I can't find where the persistent value is stored. Things I don't particularly like about R are the sparse documentation and poor examples (better than nothing) and that the language is big and doesn't follow the principle of Least Surprises (I am reduced to web searches for capabilities). One thing I do like is the Tinn-R editor.

The other provocation for this post was this XKCD gem.

Calculator frenzy!
I mentioned before that I have a Ti89 at work and this was recently spotted by an HP-phile colleague. To show off to me I now have their HP 50g on extended loan and I have to say that I am quite jealous. I love that Forth-like goodness of the RPL option and some of the more weird (but useful) functions. I miss the spreadsheet-like Table Editor of the Ti89, but I should be able to mimic that with vector manipulations on the HP - and there are also some third party apps for the HP. I'll play with it some more. I'm hoping that someone else has an NSpire CAS for further comparisons, but I hear that one is a bit of a disappointment.

233 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!