Tue 17 Oct 2006
Luca & PostgreSQL - It Works
Category : Technology/LucaPostgreSQLWorks.txt
And I'm stunned :-) This is Luca pulling data from a PostgreSQL 8.1.4 (on i686-apple-darwin8.7.1) database : Of course, I've still got a lot of testing to do. But so far, all the reports - like Chart of Accounts, Trial Balance, etc - work. And I can update, modify and delete data. Even the blob data type, which I used to store CurrencyFormatter objects, works (though it's called a bytea field in Postgres). In the larger scheme of things, this is significant. Blob fields can be used to store any media types - pictures, sound files, documents, etc. So I now have the means to move these data types across any of the three SQL databases - SQLite, PostgreSQL, and MySQL - that are free and popularly used. PostgreSQL is a "buzzword-compliant" database system - ACID, views, triggers, stored procedures, transaction locking, concurrency control, etc. I'm like a kid in a toy store. Or a more apt metaphor, like a Samurai who's just found the Master's sword. If you've ever worked on Oracle in a corporate environment, where you have to beg a database administrator to condescend to give you access your own data, you'll know how liberating it is to have this kind of tool, this kind of power, available on tap, and so easily wielded. Forgive me while I go into hyperbole. This is the Mac in all its protean majesty. Some people use it to listen to music, organise photos, make movies. Others will wield it like the Universal Turing Machine to simulate all other machines imaginable - cash registers, accounts ledgers, etc. The database, in making it possible to make intentional and retrievable associations between pieces of data - is the bridge that carries us from data to information to knowledge and, hopefully, to wisdom. Suddenly, the two thousand odd dollars we paid to lug this little white beauty of a machine around? Isn't it such a bargain?
Posted at 12:07PM UTC | permalink
Mon 16 Oct 2006
PostgreSQL and Luca
Category : Technology/Luca_PostgreSQL.txt
I've built a database connector framework, over the last few days, to allow Luca to store its data into a PostgreSQL database. I've been able to populate a Postgres database with data needed by Luca, and that was rather satisfying - that our framework's structure works across four database types now. But I've hit a curious snag. I've named my database columns using mixed case because "currencyCode" is much easier to read than "currencycode". But PostgreSQL "folds" all column and table names to lower case, by default. So my column is named "currencycode" in Postgres. When the data is read back into Luca, they're packed into dictionaries so that it's easier to access each field value using Objective-Cs "valueForKey" construct. But C, on which Objective-C is based, is of course case-sensitive and so 'valueForKey:@"currencyCode"' which I use all over the code does not work now that the key, that is returned from Postgres, is called "currencycode". There are various ways of solving this, with a variety of trade-offs. So I'm mulling it over. But, if you're management, how do you assess this situation? Should you allocate resources to explore the options and produce a solution? First question, "why bother?". Well, PostgreSQL is free, and there are no contraints on its use, whether for commercial or open source development. It's easy to install, or at least the Mac OS X installation went like a breeze (use Marc Liyanage's installer). And PostgreSQL has been known to break new grounds that later became standard features on other databases. So this is a great tool to have in your toolset. There are some questions whether MySQL's licensing will allow its C API to be embedded inside a commercial application, with no restrictions. Sometimes, I read, yes; sometimes I'm not too sure. But there are no such ambiguities with SQLite and, I think, also with PostgreSQL. And so, with SQLite forming the core of a light-weight embedded database that is shrinkwrapped into Luca, and PostgreSQL for people who need multi-user, concurrent, client-server access with transaction locking, that should cover all the bases.
Posted at 3:43AM UTC | permalink
Sun 15 Oct 2006
Why Bother?
Category : Commentary/whybother.txt
Coming back to a question I posed last week : Is it possible to understand and thereby manage the software development process (and make decisions on what platforms to standardise on, what directions to take, technologies to adopt, etc.), if you're not yourself a competent programmer? Sometimes I think the answer is, yes. After all, we drive our cars without knowing how they actually work. And we use our computers without knowing anything about the physics that govern the workings of semi-conductors. There is a level of abstraction we can take that will allow us to understand things conceptually without knowing the details, and that is enough to allow us to make comparisons and decide on what car to buy, etc, or what computer systems to use. But then look at this piece from a week ago : "Macs - Why bother?" I'm highlighting this because the author's argument is so typical of that used to justify PCs and (not inconsequentially) marginalise Macs in organisations : The author is trying is establish that he has truth on his side. "Everybody" thinks one way and therefore that way must be true. But must it? This argument is so typical. Yet it is also so wrong. Macs are not more expensive, are actually more relevant to the world the students will find themselves in - a world where the arts meld seamlessly with science - and Macs are not only good for digital entertainment but also trump everything else in productivty applications, and all these can be demonstrated, not just argued. But the fact is that the PC-biased argument works, and continues to work, is proof enough that it's not so easy to make good decisions on technology in organisations. And we need to ask why. I think there's a way to understand technology from a conceptual viewpoint, even if it's not possible to know all the details like a programmer. But we've got to care enough to see that things can go wrong with the technological choices in organisations, and be able to see through the motives or agendas that led to those choices. We need to be curious enough to work out what questions one needs to ask in order to be wiser the next time, and be constantly motivated to improve this skill (at questioning) because the stakes are so high, as far as technology management is concerned.
Posted at 1:47PM UTC | permalink
Tue 10 Oct 2006
Luca in French
Category : Technology/Luca2dot3dot1.txt
I've updated Luca to 2.3.1 to include a new French localisation by Joselyne Rochaud and Corentin Cras-Méneur. Thanks, as always, Josy and Corentin.
Posted at 2:36PM UTC | permalink
Mon 09 Oct 2006
Late for the Sky
Category : Commentary/LateForTheSky.txt
I thought I was going to do my usual evening jog but the haze from the on-going forest fires in Indonesia looked rather bleak and menacing, and so I veered left into the "jungle" to get some respite. I live next to this huge body of water, the MacRitchie Reservoir, and its luxuriant canopy of raintrees acts as a sort of filter, providing somewhat more breathable air for me and my fellow-joggers. And I was thinking about those Jackson Browne songs : I ran and ran, in defiance of the haze, and was somewhat surprised, when I reached the end of the trail, to have done 10 km. But with that fog, the sky will be dark way before sunset, and who knows what darkness brings in the jungle, and so I doubled back, double-quick. That made it 20 km today and I hardly ever do 4 km, let alone 10. Whenever I'm wracked by tiredness and wished to stop, I only have to think, "if I stop, my company will die" and that superstition will be enough to push me on again. Morbid? But I've kept going for more than 12 years now. One does need will-power whenever belief goes AWOL. (And I guess that's the Loneliness of the Long Distance Runner as a metaphor for life...) So, talking about loneliness and fear, belief and self-doubt, this is the music of my lost youth - Jackson Browne and Late For The Sky. It's amazing that this is 30 years old now, but listen to "Fountain of Sorrow" again - it could have formed the perfect music accompaniment to an Apple iPhoto advert. Funny how past and present collide. And all triggered by a run in the fog.
If there's a technology or an opportunity that can transport me back to any one day in my life, I would take it.
Posted at 5:56PM UTC | permalink
Sat 07 Oct 2006
Make Work. And Real Work.
Category : Commentary/MakeWorkRealWork.txt
In Cocoa, if you want to know when the contents of a text field has changed, you assign the job of listening to changes being made to the field to the object that is managing your window (the window controller). This is called "making the Window Controller the Delegate of the Text Field". And this is how you do it - by linking the text field to the controller using Interface Builder: This works OK in a beginner's class, but in a real application with many windows and many fields, it becomes a pain to link each field one at a time. What if you forget? It gets ugly with all these connections cropping up all over the place. It's complicated, cluttered and laboured - a sure sign that there ought to be a better way. I wanted to see if I can avoid doing all these linking in Interface Builder and still be able to tell when data has changed sufficiently that it needs to be saved. And from preferably just one place in the code. I spent days figuring out if that's possible. I tried everything. I sub-classed NSTextField, NSControl, NSText. I wrote my own categories. I traced the calls up and down the class hierarchy. I just refused to make those links in Interface Builder. In part, it's because I'm lazy. Part of it is because it's really too messy if you want to build things fast and yet want things to be precisely under control. And part of it is because I have faith in Cocoa's designers. It can't be that stupid. I went round in circles but I couldn't give up. Especially in an application like Luca, I needed a mechanism to tell precisely when it's the right time to enable the Save button, if I want to protect the user from saving inconsistent data and upsetting the balance of the accounts. And I need this mechanism to be simple, small, elegant, and easily implemented. I plan to build other business applications after Luca. If I can find a better way, I'll be able to build all these other applications faster. Then one day, I saw it. Just one line of code. And I'm off. Now, Cocoa is just like that - one line of code here, and another line of code there, and you get significant amount of work done. That's its beauty. But the reason I'm bringing this up is to highlight something else, using this experience as an example. And that is, how can you tell make-work from real-work, if you're overseeing software development? How do you tell when someone is working, when days go without measurable progress? And this is a double-edged sword. How can you tell that some programmer is not actually working, when he does in fact produce measurable lines of code? I can give you one example. Say, a programmer has to write a Unix batch job to process many thousands of records. It takes hours to process those records. So he writes his code, hits Run, and he stares at the screen and his mind is elsewhere for the next three hours, after which he finds bugs in his code, makes changes, hits Run, and in another two iterations, it's time for him to go home. If you're smart, you'll ask him why he can't just test his logic against a representative sample of records that gets run in a mere few seconds. And when he's done getting the logic right, do a test run against the whole thousands of records to see if the solution scales OK. That'll get the job done in a day, and let him know you know. And keep him on his toes forever more. But is it possible to understand and thereby manage the software development process (and make decisions on what platforms to standardise on, what directions to take, technologies to adopt, etc.), if you're not yourself a competent programmer? I'll leave this question hanging for today. It's the weekend after all. :-)
Posted at 3:00PM UTC | permalink
Fri 06 Oct 2006
Luca 2.3 Relesed
Category : Technology/Luca2dot3.txt
I've released Luca 2.3 to run on OS X 10.4.8. All the Preference Settings and Utility windows are now consolidated into one single Luca Preferences window, below : Currency display formats and decimal number precision can now be set for individual currencies (e.g., the Japanese yen has no decimal places and you can now set this, as shown below, by setting Max fraction digits to 0) : Instead of having its own Utility window, you can now check the status of the accounting period (e.g., whether you had closed the accounts for a certain month) in the Periods pane in the Preferences : Certain accounts play important roles in the accounting system, e.g., you need to have an account to post Foreign Exchange Gain/Loss amounts to, and you need an account to post the year's Retained Earnings to, and you need to set up Checking Accounts that are linked to your bank accounts. This is now made clearer in the following Preference pane, which you can also use to assign a different account to play the selected role instead (if you had not yet made any postings to that special account) : Finally, some changes have been made to Luca's database structure. You can use the following Preference Pane to upgrade an older Luca database : To update an older MySQL database, re-import it into LucaDB (the built-in SQLite database), using the second button shown above. And then Export it back into MySQL. That should effect the database change. The third button, shown above, is to allow the user to re-use an older SQLite-based Luca database. Just click on the button and show Luca where that previous SQLite LucaDB database is stored. Of course, the whole point of this 2.3 release is to take advantage of Cocoa's NSDecimalNumber class to improve the numeric accuracy of Luca's data handling, and MySQL's ability to store these data objects as an equivalent Decimal data type. With this release I've eliminated the rounding errors associated with the use of floating point numbers, though some of this remains if we use the SQLite database since SQLite does not yet support the Decimal number format. But at least we've made some significant progress in business computing. And on the Mac, no less.
Posted at 2:52PM UTC | permalink
Wed 04 Oct 2006
About Luca, and Tomorrow's Money, and Truth
Category : Commentary/tomorrowsmoney.txt
I've finished (finally!) version 2.3 of Luca. I've made so many changes to the code that I'll need to do another few days of testing before I can release it. So, for the people who're looking to run Luca on 10.4.8, please wait - I'll have a version ready for you to run, hopefully, by the end of the week. I've made changes to Luca's data structure and so I've devised a way for people to update their database to the latest structure with maybe a couple of clicks. Most of the changes centre around making Luca handle multiple currencies more gracefully, so that it'll be able to handle differences in display formats and numerical precision and allow a user to specify these for individual currencies. So I was reading the following passage in the latest book by Alvin and Heidi Toffler - "Revolutionary Wealth" - with more than the usual interest : Am I only solving yesterday's problem with Luca? Like a good sailor, we've got to keep one eye on the horizon no matter what else we're doing, lest we end up broken like the Titanic. Coming back to the Tofflers' book, it had somewhat mixed reviews on Amazon but I enjoyed it. Some books merely provide you with more of the same information, a few will deepen your understanding of a subject, but fewer still actually introduce new dimensions to think with. I enjoyed the book because I found new ways of looking at things. For example, what is truth? How do we know that something is true? Because a majority of people believe it to be so? Because we've always believed it to be so? Because a person in authority tells us it's so? Because it feels right metaphorically? Or because it can be proven right logically? It's interesting to do what the Tofflers did - list out the many ways in which we are led to believe that something is true. And see what remains valid now that we have so much information on tap, available so quickly, and that is so easily filtered and compared, debated and corroborated. As a boy from a Catholic family brought up by Protestant aunts and educated in Catholic schools, I used to wonder why nobody else I knew asked this question - who decided what books went into the Bible, as it was obvious (at least to me) that the Protestant and Catholic bibles were somewhat different? Now I have Elaine Pagels' "The Gnostic Gospels" on my bookshelf, and I've read as much about the Dead Sea Scrolls as I could find in the Libary, and I've just finished "The Lost Gospel of Judas". And I only have to search Google to know I'm not alone in wondering what really happened around the Sea of Galilee two thousand years ago and about the subsequent events that led to the founding of the Christian church. It's about deciding, after all is done and dusted, what's probably true and what's really a matter of faith - not nearly enough to justify a crusade or whatever names that has been known by - but Faith is about sincerity and I believe that's what really matters to God, if you believe He or She exists. So, to return to that constant theme of this weblog, "Man shapes his tools and in turn his tools shape Man". Technology is not neutral. So many chains of events are set off with the introduction of a really life-changing, life-defining technology. And we're living in such an age. It remains to be seen whether we're cursed or blessed to be living in these interesting times.
Posted at 4:05AM UTC | permalink
Tue 03 Oct 2006
OS X 10.4.8
Category : Technology/10dot4dot8.txt
I've updated our own live server to OS X 10.4.8. The good news is that DNS, POP, IMAP, Fetchmail and Postfix services all continue to work OK in 10.4.8. However the "WorkAround-Bonjour" stall that Apple introduced with 10.4.7 is still there, unfixed. But the important thing is that all the services continue to work properly once you get past that (less than) one minute stall (when you enable a system service via a call to launchd - the "recommended way" that all applications are supposed to use when launching system services).
Posted at 2:46PM UTC | permalink
Sun 24 Sep 2006
Perfection and Simplicity
Category : Commentary/perfection.txt
If you had watched Stuart Cheshire's talk about Zero Configuration Networking with Bonjour on Google Video, you may have the caught the part where he talked about the importance of simplicity : And he followed that with a reference to a quote by Antoine de Saint-Exupéry: I've had that quote playing on my mind the last two months working on Luca. It just so happened that I discovered an excellent book called "Let My People Go Surfing - The Education of a Reluctant Businessman - by Yvon Chouinard, founder of Patagonia, and what did I find but that quote again from Saint-Exupéry leaping off the 25th page : There you have it - art, science, sex, poetry, engineering, and simplicity. It all adds up to perfection.
Posted at 5:14PM UTC | permalink
The Journey
Category : Technology/journey.txt
It started with the question - do currencies always round to two significant digits, like US$9.99? The answer is no. There is at least one case, the Japanese Yen, e.g., ¥1,280 for a pack of Pampers, where they have no decimal places. So how do we make Luca work universally across all currencies without hard-coding all these things? The question started me on a journey of discovery where I learnt about NSDecimalNumbers, creating a custom NSNumberFormatter class in Cocoa together with its own Interface Builder palette, and also about storing blob values in SQL databases so I can stash these number formats that the user has created. And I'm now almost done. I have an interface in Luca that now allows a user to create custom number formats for any individual currency, and he can apply these formats wherever he's entering currency values in any voucher. If he chooses the Japanese yen as the base currency for the accounting system in Luca, then all calculations where rounding has to be applied (e.g., in exchange rate or tax calculations) are done to zero decimal places. That's triggered in just one place in the code and there's no hard-coding. So, to answer my own question : it can be done. Along the way, I think, I can now really articulate why Cocoa and, especially, Objective-C are such good software development tools. It's all about design. You've got to take a Janus-like stance and look both inwards and outwards at the same time. You've got to look inwards into the code and be aware that the world you're modelling is as complicated as only life can be. And so, you've got to simplify, simplify, and simplify yet again wherever you can in the coding, to get everything neat, clean, crisp and small. Because if you don't don't, then you're going to get drowned in all the possible permutations when things come together in combination, when you meet a real user in the real world. It's from this perspective that we should value the simplicity of the Mac. And the wonderful pragmatism of the Objective-C language. And so I continue to simplify Luca. I'm pulling all Luca application settings into one single Preferences window, and I hope I can organise its presentation into a narrative to help the user understand what he has to do to set up an accounting system. If I can get this Prefs window done, then Luca will be reduced to just two menu items - an Accounts menu and a menu for Journal, and that would be about it.
Posted at 4:08PM UTC | permalink
Sat 09 Sep 2006
Subversion
Category : Technology/subversion.txt
I've made massive changes to, at least, the internals of Luca. I couldn't have done it without using Subversion, a version control system that I used to store my evolving Luca project files. There is a one-click install of Subversion for Mac OS X that you can get from Martin Ott's web site. I access my Subversion repository using this GUI front-end called svnX : This combination of Subversion and svnX, together with FileMerge, below, which comes with Xcode, provides me with some sort of a Time Machine (no need to wait for Leopard). I'm able to compare across different versions of every file in my project, thus making it possible to do the kind of multiple changes that I was doing to a rather complicated project, in the last three weeks, in a very systematic way : I'm highlighting this because I'm always puzzled why enterprises don't use Macs more. If they're worried about being locked in, a case can be easily made that they're even worse off, as far as being locked in is concerned, using Microsoft as their development platform. The tools I've mentioned, Subversion and svnX, are both free, open source projects. They're fast and work remarkably well. And they allow multiple programmers, spread out geographically, to work togther and synchronise their work with fine-grained precision. The databases I've been using, MySQL and SQLite, are also free and open source. In fact, in the last four years, I've totally turned over the things I know how to do. Prior to that, my main development platform was 4D (4th Dimension) and Oracle, and I used to pay $10,000 at least every two years for the privilege of using them. It slowly dawned on me, after OS X was released, that the economics of software development, at least on the Mac, was changing. I don't have to do those enterprise-scale systems I was doing anymore, to keep me in my fix, since I do enjoy building systems. But I was building systems for Windows users (although I stubbornly clung on to our PowerBooks) and that wasn't what turned me on each day. I wondered, then, if I could be doing the things I am doing now - selling the software I build over the Internet to Mac users, doing things on a smaller scale with, say, no more than three people, and spending more time with my kid. If this is any inspiration to others, I mean to say that if you can visualise something you want to achieve, you can often make it come true. But coming back to the topic, the tools we have at our disposal today are stupendous, absolutely first class. And most of them are free. Why is the enterprise not picking up on this opportunity? Systems are the life-blood any enterprise, whether you are a passion-driven company like Patagonia or a staid old company like (fill in the blanks). You need to be able to get at the data and shape your systems to meet your company's needs and its beliefs. Tools are the key. The best tools you can find. The simplest, easiest, strongest tools. Because building a company is hard. Why complicate things by using clumsy, overly elaborate, unfathomable systems like Windows? I like to think that the thing I'm doing now is subversive - to the current entrenched corporate wisdom. I'm using the best possible software development tool I can find, to build systems at the cheapest possible price, on a platform that nobody else had believed had a relevance to business, except for the Mac users, and to help make these Mac users successful in business. If I could ever be successful at it, that would be like proving a point.
Posted at 3:55PM UTC | permalink Read more ...
|