When my code bites me on the you know what

I released ReceiptWallet 2.0 on Tuesday and the reception has been pretty good. Unfortunately, as with any major upgrade, there are bound to be issues. I’ve been handling the support issues on a case by case basis, and I’ve been scratching my head trying to figure out what could have caused the issues. This afternoon I received a phone call from my uncle who just upgraded and now his data was empty. The good thing about the upgrade is the chances of destroying the data are slim; ReceiptWallet, in most cases, can’t find it. Having visited my uncle back in November and knowing how his system was setup, it made getting him up and running much easier. Then, this evening, it dawned on me the problem, so I tested my theory. In ReceiptWallet and DocumentWallet, I had a preference that let users move the ReceiptWallet or DocumentWallet data folder as people wanted to put it in Documents or on another hard drive. So I moved my data in ReceiptWallet 1.5.2, upgraded to ReceiptWallet 2.0 and saw that ReceiptWallet didn’t find my data. Hmmm…at least I could reproduce it.

I started poking at my code and within a few minutes, saw this:

		[[NSUserDefaults standardUserDefaults] objectForKey:kOldDataLocation];

That’s the whole line. Anyone who knows Cocoa programming knows that this does nothing. The line was supposed to be:

		dataLocation = [[NSUserDefaults standardUserDefaults] objectForKey:kOldDataLocation];

I somehow left off the assignment to the variable.

OK, simple fix. However, this doesn’t really help the people that have already upgraded and our stuck. In addition, I’m not quite ready to put out a 2.0.1 version. So, I added a menu option that says “Open Prior Version Data” which does the magic to open the data file and actually executes the problem line of code from above.

So, I’ve posted the new version as a beta, put a Knowledge Base article about it and put a ReceiptWallet News item about it. I’m hoping that I can simply point people to the beta version and their problems will disappear.

I’ll probably sleep well tonight having found the answer to one of this week’s greatest mysteries.

Writing handheld applications using the iPhone SDK

In the past week since the iPhone SDK event, there has been a lot of discussion about the limitations of the iPhone SDK. I think that the “limitations” are coming from people and developers that have kind of missed the point. The main concern with a cell phone/handheld device is stability, at least that is my take on it. Way back in 1997 when I started working on the Qualcomm pDQ phone (the first Palm OS based smartphone), my main concern was that the phone could not crash as it was a consumer electronics device. (Imagine your TV crashing because you tried to watch an episode of Lost that had some magic encoding in it.) Maybe I was a little before my time, maybe not. The biggest problem with the Palm OS (up until just a few years ago) is that it didn’t have flash based storage, so if the battery died, you’d lose everything. So not only could the phone crash, but sometimes in order to reset the device you had to pull the battery causing you to lose all your data.

I’ve just started to watch the iPhone SDK videos and will start taking a look at the SDK in the near future (I’m kind of working on 3.5 half time projects which leaves virtually no time to think or write this blog :-)).

One Mac developer has posted a list of its feature requests for the iPhone SDK. These requests are coming for a Mac developer and NOT a handheld developer or average consumer. As someone that has written handheld applications for the last 13+ years, I know that desktop development is completely different from handheld development. While the tools may be the same and it may use the same language, there are tons of differences. The primary concerns with handheld apps are stability and ease of use with limited screen real estate and input mechanisms. I hope that Apple ignores most of the requests from developers to give root access on the iPhone, allow access to the entire filesystem, and the ability to run background apps, just to name a few. These items will (not can) cause instability in the phone and provide a poor user experience that will reflect poorly on Apple. Furthermore, one app touching the entire phone could cause other applications to have problems and then people would come running to me (kind of like they do on the desktop, but more so).

Maybe I’m just jaded, but I want a stable, well functioning iPhone with good applications. I don’t want a bunch of hackers or desktop developers writing crap for the iPhone. I guess we’ll just have to wait and see how the market shakes out.

(I double checked this post and all the information above comes from public sources; I highly respect the agreements I sign, either physically or virtually, and I hope that others do the same.)

$2000 dog bone

No, we don’t feed our dog diamond studded bones or anything like that. We’ve been letting him chew on a plastic Nylabone. He loves them and goes through them periodically. Well, on Sunday we were playing with him when I noticed a tooth fragment on the ground. My wife looked in his mouth and saw the tooth with the pulp exposed. After reading that this could be serious, I took him into the vet yesterday. The vet said that it was a fractured tooth and the tooth was a major one. The only option is root canal since Marley (the dog) is only 3.5 years old (older dogs he’d recommend just giving antibiotics and depending on the tooth, extracting it) and he really needs the tooth.

There are basically 2 veterinary dentists in Southern California; one here in San Diego (there are less than 100 board certified veterinary dentists in the world). The vet called later in the day after talking to the dentist and gave me the bad news; it was going to be close to $2000 for the root canal plus $250 for X-rays prior to the procedure. Ouch. So, the dog is scheduled for his root canal next Friday. While we have pet health insurance, I think we’ll be lucky if it covers half. (Yes, we have insurance for our dog; while it may seem frivolous to some, the costs as seen here, for some procedures are extremely high.)

I hate that this is going to cost a chunk of change (and will likely delay the purchase of some stuff), when do you say stop paying for your pet? Isn’t your pet family? I know that Marley is a big part of our lives and I can’t imagine life without him. I know that his time will come, but until that happens, we’re going to do all that we can do for him.

ReceiptWallet 2.0 Released!

I am pleased to announce that ReceiptWallet 2.0 has been released along with a completely redesigned website! Thanks goto Julie Bender for the new website design, my beta testers for finding all the bugs that I couldn’t have found on my own, Eric Ullman for my press release, and of course, my wife, for putting up with me while I got this release out the door!

I’m very excited not just about the software release, but about the website as it now looks professional and all 5 components of my site are themed the same (the main site, the knowledge base, the store, the news area, a WordPress install, and the contact area). A lot of work went into getting this site to work smoothly and I think it looks great! I’m biased, but I’ve seen few “indie” developer sites that have the same look on all pieces of their sites; some get close, but leave out a piece here or there. I figured that while I was getting my site redone, I might as well go all out and make it all be consistent (as much as possible). My site looked like crap before and I should have made the leap earlier to get a professional to do it, but that’s now 20/20 hindsight.

Oh, and this ReceiptWallet upgrade is FREE to all ReceiptWallet and DocumentWallet users!

Important lesson in using NSLocalizedString

In ReceiptWallet 2.0, I use an ellipses in a number of places for menu items, window titles, etc. I switched all my source files to UTF-8 and started using ellipses in the NSLocalizedString macros to make localization easier whenever I get to that point. Well, despite using UTF-8 for the file encoding, something went horribly wrong that I didn’t notice until today. The ellipses caused a bunch of my menu items to take on names of other things, like Scan Receipt became Combining Documents…. Huh, I thought. So after a bunch of research, I found the solution. 1) Replace … with \\U2026 and 2) In my script phase where I run genstrings to generate the Localizable.strings file, add a -u flag. While that seems like an easy fix, I almost went bonkers today as I’m nearing the ReceiptWallet 2.0 release and this would have been bad.

Package Based Documents

There have been a number of postings about having a Cocoa document based application where the documents are packages. None of the posts seemed to nail exactly what I wanted, so I managed to piece together a bunch of posts and came up with some sample code to demonstrate it. I used this as a basis for ReceiptWallet 2.0, but have made a bunch of changes since then. Feel free to use this code in any way you see fit, but I make no promises of how well it will work for anyone besides me.

Grab the source

On the verge of releasing ReceiptWallet

As I’ve promised on my website, ReceiptWallet 2.0 is going to be released by mid March. I’ve been busy putting together all the pieces and am quite pleased how things are shaping up. I had a web designer completely redo my website and managed to “skin” all the pieces of my site (store, support and main site) so that the same theme is carried throughout.

I’m quite excited about this release as I think that the software is very sound and appeals more to a wider audience with ReceiptWallet and DocumentWallet combined. In addition, the new website will give the software a more professional look. While I’m not going to reveal exactly when I’m going to push everything out the door before I do, time is running out to hit mid March, so it will be soon 🙂

iPhone SDK: the good, the bad, and the ugly

Apple announced the iPhone SDK the other day and there is a lot of discussion about it among those that I know. Overall, I’m quite happy with Apple’s offering; while I don’t have a huge interest in writing handheld applications anymore (I wrote Newton and Palm software for way too long), it might be fun to dabble in some stuff. In addition, I have some clients interested in apps.

The Good

  • Xcode is the development environment.
  • There is a simulator.
  • Apple is charging money to get a certificate and release applications; this might keep out some of the weekend developers that don’t have good development practices.
  • The SDK looks very complete.
  • Background applications can’t be written. Yeah, hopefully this will make the platform more robust.

The Bad

  • Apple won’t take my money to become a developer, yet. I applied, but who knows if I’ll be accepted.
  • The $99 fee is too low. Yes, I said it. The barrier to entry is so minor, that every Tom, Dick, and Harry will sign up. I don’t want my iPhone to crash and have people write crap. I’ve been through that with the Palm; there is so much crap that people just throw out there. I want quality and people that are serious about development. I have nothing against hobby developers (except they drag the value of software down by releasing stuff for next to nothing), but the entire iPhone platform will get a bad reputation if people download software and have their iPhone crash. Maybe Apple will yank the apps that crash.
  • No Interface Builder support, yet (I’m impatient).
  • Enterprise developers are charged more than commercial developers; I’m not sure what this is about, but maybe it has to do with a different distribution mechanism. I have a client that wants to sign up and doesn’t have a problem with the fee, but it seems to me that Apple should just have one fee.
  • Why were some companies chosen to get early access and others weren’t? I’ve been developing handheld applications for over a decade and no one contacted me. I guess they were just looking for the wow factor; one of the companies that was selected has written garbage in the past on other platforms, but the company name means something…I guess quality doesn’t.

The Ugly

  • Apple underestimated the demand. It took hours for me to grab the SDK; to top it off, someone brilliant put a link to the SDK on Apple’s homepage to drive even more traffic to it.

I’ve only poked around in the SDK as I’m trying to get ReceiptWallet 2.0 out the door, but will take a closer look in the upcoming weeks.

PDFKit is borked

I love that Apple has lots of frameworks for me to use in my apps and gives me things for free such as PDF viewing and manipulation. This is with PDFKit. The problem with PDFKit is that it isn’t very tolerant of PDFs created from various other applications. I reported a bug with this back in the 10.4 era and it got fixed; I simply added a keyword to a PDF using Preview and it crashed (this is the same thing I do in ReceiptWallet). Now, I was pointed to another PDF that has the same behavior. The steps to reproduce this are quite simple:

  1. Download the IRS W-9 form
  2. Open it in Preview (on 10.5.2)
  3. Choose Tools->Inspector
  4. Click on the keywords tab
  5. Click the + button
  6. Add a keyword
  7. Do a Save As and give it a name
  8. Watch Preview crash
Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000dce481a4
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib             	0x952773af szone_free + 2101
1   com.apple.CoreFoundation      	0x9155c826 _CFRelease + 342
2   ...ple.ApplicationServices.ATS	0x906240d4 FindNameAsCFString + 1432
3   ...ple.ApplicationServices.ATS	0x90623acc ATSFontGetPostScriptName + 76
4   libCGATS.A.dylib              	0x9364e8e5 get_name_with_name_code_nl + 250
5   libCGATS.A.dylib              	0x9364ea67 ats_name_handler_get_postscript_name + 23
6   libCGATS.A.dylib              	0x9364fd48 get_postscript_name + 49
7   com.apple.CoreGraphics        	0x924f0cd3 CGFontNameTableCreate + 322
8   com.apple.CoreGraphics        	0x924f0b73 CGFontGetPostScriptName + 29
9   libPDFRIP.A.dylib             	0x18bd81a9 PDFFontType1EmitDefinition + 57
10  libPDFRIP.A.dylib             	0x18bd6674 write_definition + 55
11  libPDFRIP.A.dylib             	0x18bd4c38 PDFFontEmitDefinitions + 22
12  libPDFRIP.A.dylib             	0x18bd6197 emitFontDefinition + 17
13  com.apple.CoreFoundation      	0x9155f1fc CFSetApplyFunction + 140
14  libPDFRIP.A.dylib             	0x18bd61db PDFFontSetEmitDefinitions + 60
15  libPDFRIP.A.dylib             	0x18bd2f8b PDFDocumentFinalize + 385
16  libPDFRIP.A.dylib             	0x18bd1c0e pdf_Finalize + 28
17  com.apple.CoreGraphics        	0x925567bf CGContextDelegateFinalize + 55
18  com.apple.CoreFoundation      	0x9155c786 _CFRelease + 182
19  com.apple.CoreGraphics        	0x925567ac CGContextDelegateFinalize + 36
20  com.apple.PDFKit              	0x902a418a -[PDFDocument(PDFDocumentInternal) writeToConsumer:withOptions:] + 1491

Filed as Radar (Apple’s Bug Reporter) bug # 5784122. I don’t even enough a way around this. I could try to re-write the PDF, but if the PDF has filled in information, it will become toast. Do I have to write my own PDF code to handle this? Apple has so many technologies that some of the most useful (at least to me) get neglected; there is so much focus on the glitzy stuff that the basics get ignored.

Am I out of touch with my users?

I received 2 pieces of email today about the new ReceiptWallet 2.0 beta basically saying that they wanted their receipts and documents in one window since ReceiptWallet and DocumentWallet were now one. When they were separate applications, receipts and documents had to be in separate windows as they were separate programs. With the combined program, that is basically still the case. Furthermore, with multiple libraries users can now separate out information more, like for multiple years, multiple companies, multiple projects, etc. If everything was in one window, this wouldn’t be possible. Am I missing the point of these users? It has me very confused and almost questioning the major decisions I’ve made about the products (making them handle multiple libraries and combining them). However, most of the feedback I’ve received has been quite positive; one user even bought a second copy that he didn’t need just because he liked the new version so much.I take what my users say to heart and spend a lot of time thinking about what to implement and how to implement. I don’t just discard feedback; I always think about it and wonder how many other users are thinking the same thing. Unfortunately most users don’t contact me, so I have no idea what they think of what I’ve done.