Monday, December 12, 2011

iAutoCalc 1.3.1 Released!

Version 1.3.1 of iAutoCalc was approved by Apple and released this morning.

For the next few days iAutoCalc will be offered at the sale price of 99c.

Change list:

  • Fixed total interest paid calculation bug.
  • iOS 5 tested
  • Code cleanup

Wednesday, December 7, 2011

iAutoCalc Bug and Fix

Version 1.3.1 of iAutoCalc has been submitted to the app store for review.  It should be available again in a few days.

I want to say thanks to the kind reviewer who suggested I learn how to add.  In fact the bug subtracted the down payment from the price twice so adding isn't really my problem ;-)

I'll make sure to let my QA department know they missed a bug and to work harder next time!

Joking aside, the bug is fixed and a new version will be sent to Apple for review and included into the app store shortly.  I have recently cleaned up some other parts of the code and want to do some additional testing before the next release.

Tuesday, December 6, 2011

Emacs Org-Mode

As a vi and vim user I had never come across emacs org-mode until yesterday.  I've spent the last couple days fitting it into my project and task workflow and must say that I am really impressed.  Traditionally whenever I have tried to use project management or task tracking software it would always get in the way of how I wanted to do things.  This inevitably would lead me back to a text file list on my desktop, a piece of paper with notes, and recently a google doc that looks a lot like my desktop text file.  Org-mode has opened my eyes to how project management should be done.

First off, since I'm not an emacs user yet, some of the key binding issues have slowed me down.  Out of the gate I have set up my projects in a simple, and I think, logical fashion.  I've read about other people maintaining a single .org file with their entire life in it, but that seems a bit too unwieldy to me.  Perhaps that's my lack of emacs skills showing through though.

In my initial setup, I have a .org file for each project.  Projects that are work related are simply named in addition to a catchall project called  The general project is a place to put quick TODOs that popup out of meetings or conversations that are not really projects.  Overall, it's a nice easy way to keep everything work related together and grouped by project.  Now, this does mean I have to add each .org file to my .emacs to have it show up in my global TODO list, but that's actually a good thing since I want my global TODO list to only show work items.

For my non-work life I have a file.  I keep this file out of the global TODO list and use it stand alone for everything from what needs to be done from things with the house to buying gifts to whatever ("TODO cancel XBOX live subscription" is on there).

Finally, personal projects have their own file,

The beauty of org-mode is that it's just text files.  At any point and time while taking notes on a project I can type "TODO" and the line becomes part of the global TODO list.  The list lets me jump right to the TODO line and see the context of the notes that caused the TODO to come about.  Something so simple, yet at the same time completely awesome.

This is the first time in a long time I've been excited about something like project management.  I'm not really surprised that emacs contained org-mode (isn't emacs it's own self hosting OS by now?), but at the same time I never thought to look.  The org-mode website mentions converting vi users to emacs.  I can't say that will happen, but hopefully learning both vi and emacs to a sufficient level will not be like crossing the streams.

Resting and Working

People who write software are using their creativity to solve problems.  I compare it to writing using a very precise language and grammar to express a story to the user.  I came across this video over at the 99%.  In it Tony Schwartz, author of "The Way We're Working Isn't Working", relates athletic performance to creative performance.  One thing athletes have known for years is that the rest between workouts is just as important as the workout itself.  While it seems intuitive that it would work the same way with mental work, many creative professionals skip the rest part in order to squeeze in more work.  This additional work is usually lower quality and eventually the lack of rest becomes detrimental to creativity.
(It's a flash player, so if you have flash block on click the whitespace below to make it load.)

Friday, December 2, 2011

UITextField Format For Currency Revisited

Since my first post on formatting a UITextField with proper currency symbols and separators I think I have learned a lot more about objective-c and more importantly the UI components provided by Apple.  In this article I will revisit how to format a UITextField with the correct currency symbol and grouping separators.

The original goal was to create a text field that would update in real time both with the currency symbol and grouping separators as numbers were typed in.  The first working solution can be found here, but it had some short comings particularly in code complexity.  The main problem was that I was trying to keep the string formatting correct so that I could decode the string to an NSNumber using a currency formatter and then encode the string again to an NSString.  This was needless complicating the code when dealing with inputting characters. The original code:

Instead it was much easier to just strip out the currency symbol and group separators and then use a basic number formatter to turn the string into a NSNumber.  I was able to remove an entire section of code:

Finally, take the newly formed NSNumber and run it through the currency formatter to create the desired output.  The entire new method is below:

First thing to notice is the cleanup of the code between lines 19 and 21. There is no more special case, and thus reduced complexity. Line 32 is what allowed the removal of the special case. Instead of trying to work with symbols and groupings they are now ignored completely and removed before being added back in. The variable clean_string will end up a string with only numbers and will be easily parsed into an NSNumber by a basic NSNumberFormatter.

There are a few class instance variables that need to be set. The init and associated dealloc is below even though they are not necessarily related to the optimizations above.

Formatters is a custom class that contains various class methods to return ready to use formatters. In the next article I will show how it is setup. In the meantime two new NSNumberFormatters could have just been declared inline. See the Apple reference documentation for NSNumberFormatter.
The above improvement cut out some code that was not needed, but most of all made the logic easier to follow.  Instead of having to worry about special cases with currency symbols when inserting new characters, they can now just be ignored.  The formatters do all of the heavy lifting as they should.