Nokia's Products Are Error (Message) Free

So I upgrade the firmware of my Nokia E71 from v200 something to v300 something.

After the upgrade, I proceed to restore my data, as one would. No errors reported, and indeed everything was restored, with the minor exception of all of my 1540 Calendar entries, which were nowhere to be seen. The same thing with restore from memory card and restore with Nokia PC Suite. Sometimes I wish something this important would just work.

Naturally, I then had little choice but to proceed to extract the vCalendar 1.0 data from the .nbu file directly, using a little PLT Scheme library that I hastily hacked together for this purpose (copy/pasted below for your convenience). I then sent the resulting file to the phone, and it indeed took some time to transfer, but then, nothing. Nothing in the Inbox, no notification of any kind.

I then tried splitting the file to five smaller chunks, and sending these individually. These smaller files did appear in Inbox, and would actually import to the calendar database. And I once again have fresh firmware and am able to see my appointments for next week.

Nokia’s customers have so many different combinations of devices, firmware versions, PC Suite versions, and so much data, that no way is everything going to always work flawlessly. Would it be such a bad idea to have descriptive error messages to help resolve any problems? Yes, I know error handling and reporting is hard work, but probably something that can be solved with sufficient manpower. Writing error-free software is considerably is harder still.

#lang scheme

#|

Example REPL use:

> (require "nbu-extract-vcal.ss")
> (vcal-extract "2009-11-07 Nokia E71.nbu")

|#

(provide vcal-extract)

;; Returns the number of entries extracted.
(define (vcal-extract nbu-fn)
  (define count 0)

  (define entry-re #px#"BEGIN:VCALENDAR.*?(BEGIN:.*?)END:VCALENDAR")

  (define (f in out)
    (let loop ()
      (let ((res (regexp-match entry-re in 0 #f)))
        (when res
          (let ((entry (second res)))
            (write-bytes entry out)
            (write-bytes #"\r\n" out)
            )
          (set! count (+ count 1))
          (loop)))))

  (let ((vcal-fn (string-append nbu-fn ".vcal")))
    (call-with-input-file
      nbu-fn
      (lambda (in)
        (call-with-output-file
          vcal-fn
          (lambda (out)
            (write-bytes #"BEGIN:VCALENDAR\r\nVERSION:1.0\r\n\r\n" out)
            (f in out)
            (write-bytes #"END:VCALENDAR\r\n" out)
            )
          #:exists 'truncate/replace))))

  count)