Cocoa, Core Data, and me (VI)

We’re still working to get the country browser right, and it isn’t right yet.

The countries browser.

I don’t want the table in the browser to be editable, that is what the drawer is for. So when you doubleclick on a row in the browser, I want the drawer to slide out, if it’s not visible, and to have the focus set to the first field in the drawer. After editing is finished, I want the drawer to close again. If you click the “+” button, I also want the drawer to open so you can enter a new record. If you click the “-” button, I want the row to be deleted without any “Are you sure? Are you really sure? Are you really, really, really sure?” dialogs. After all, we have (or will have) full undo available.

Continue reading “Cocoa, Core Data, and me (VI)”

Cocoa, Core Data, and me (V)

Let’s take a closer look at the radiobuttons and how they relate to core data. Remember how the countries drawer pane looks in Interface Builder:

Detail view in IB

I want the four radiobuttons to correspond to the four possible “VAT regions” in the data model:

Data model

Maybe I need to explain what I mean by “VAT regions”, as most non-europeans will find the concept literally foreign.

Continue reading “Cocoa, Core Data, and me (V)”

Cocoa, Core Data, and me (IV)

I’m back after finally getting the tax forms mailed in. What a waste of time that is. A civilized society shouldn’t be doing these things to their citizens.

Now the time has arrived to construct the CountriesController class. This class controls the model and view for the countries data element. It is instantiated by the AppController and in turn loads and shows the Countries.nib. There’s only one single instance of the CountriesController class, so it’s a singleton.

Continue reading “Cocoa, Core Data, and me (IV)”

Cocoa, Core Data, and me (III)

I realize I skipped a step right in the beginning. I’m sure I skipped more steps, but at least I noticed this one. The step I missed is:

How does one create a new window and its associated objects and have it created when a menu option is clicked or another part of the application needs it? We don’t want everything crowded into the MainMenu.nib, so we need to modularize it somehow.

Continue reading “Cocoa, Core Data, and me (III)”

Being Joppy

So, I ventured out in the World of Warcraft after quite a bit of pressure from a friend. Downloaded the 10-day trial and fired it up. Works just fine.

I created my first character to look a bit like me. Too much like me, really. Me, first incarnation. Short legs, gray, rotund and highly ineffectual with a weapon. Damn, did I get whipped. Spent most of my time running out of graveyards looking for my dead body, which was always inconveniently far away. I did get a lot of excercise that way, but it seemed to have no influence on my rotundness, either in the game or IRL. The rest of the time I spent being confused. No weapons seemed to fit this character and even the really cool twirling gesture I had in the beginning somehow went limp and dead after a while, and I could never figure out why I didn’t have that thing anymore. Or why I had it before. So, not only was I a loser, I was a bewildered loser. A couple of times I mistakenly agreed to duels with other characters, which never took more than a few milliseconds, leaving me running from that old graveyard again. I half expected the angel to smack her forehead and exlaim “No, not you again… but she never did.

I soon learned to always decline all kinds of invitations and not to speak to strangers. Somehow, during all this suffering, I did manage to get to level 10, even though it didn’t seem to do me much good. I still got clobbered by anything larger than a rabbit. I could still whack chickens, but that’s only briefly satisfying for us non-psychopaths.

So, I left this ridiculous little doppelgänger out somewhere in the woods and created a new character, about four times as tall, looking not a bit like me, but with a little more style and character. Ran around a church or abbey for a while, murdering woodland critters to my heart’s content and actually collecting some imaginary money along the way. This guy had a lot more success than the first character, which only goes to show that if you’re a man, you should be tall and have a flat belly. Everything goes better for you.

This time, I didn’t accept any duel invitations. Actually, I only got one, which I promptly declined. I guess my more imposing persona seemed less of an easy target, even though the game engine really doesn’t care how you look, you’re dead just as quickly, anyway. It’s not like it’s a presidential election or anything. I also got only two invitations to join groups. I guess you have to select a female character to get a lot of those. Not that I want to be in groups, I’m not a team player. Interestingly, I fought along other guys a couple of times, without any kind of conversation. That’s the style I like. No talk, just action. Then just go away.

My second persona. Tall, handsome, not me.With this character, everything went better. Enemies actually died after a while. I got a handle on the spells, the firethrowing, the freezing of enemies. I could even turn them into sheep just by waving my virtual hands around.

I spent a weekend running errands for people (quests, they call them), sneaking up on unsuspecting troll-jawed minicles and young winter igloo beers, or whatever. I’m sure I’m getting the names wrong. I’ve been stealing bandannas, copper coins, emptying other people’s magic chests, but most of all I’ve been, you guessed it, running from graveyards looking for myself. The difference being that this guy has longer legs, and I’ve chosen to die closer to the nearest graveyard most of the times. If real life was that simple.

But mostly, I’ve been skinning corpses left by others, and beating the crap out of cows, deer, and the occasional boar. That’s me. Go for the small stuff, but it does add up when you sell the skins. I got to level 10 with this one as well. And I’m a pretty good skinner by now.

So?

Will I buy this game? No. And there are several reasons.

I would buy it if they sold it to me online. Actually, I can’t understand why they don’t. I already have the game, since I downloaded the 3 Gb trial file, which is almost a DVD. I’m sure the shelf unit contains the same thing. But Blizzard won’t sell me a license online, they expect me to drive into town to find a store that has it in stock. Or find a seller on the net and have it shipped. Why? I’m perfectly ok with paying the full price over the net and getting just a license code.

I would just maybe get a subscription if it cost the same over here as in the USA. Paying 50% more just because we’re in Europe is a slap in the face. I don’t mind the price itself, I mind the price difference.

Finally, the subscription is on a monthly basis. I’d love to play this game every now and then, but a monthly fee stresses me into playing too much. I’d really like a model similar to Skype’s outdial service, where you pay for use in advance. If Blizzard would let me buy 50 hours online gameplay for $25, for instance, and they’d let me use it over six months, I’d do it.

I’ll wait until Blizzard changes their terms, or until the next competitor comes along with something that suits me better.

Correction: a friend showed me that you can, in fact, buy WoW online. It’s hidden, like most treasures in WoW. Go to “manage your account” and in there somewhere, you can buy a key online for 19.95 euros.

Cocoa, Core Data, and me (II)

I promised to describe how to implement validation to ensure uniqueness in the database. Here goes.

First, you need to open the datamodel in XCode. With the datamodel on screen, select File… New… and you’ll see “Managed Object Class” under the section “Design”. Note that this choice simply isn’t there unless you first opened the data model.

Continue reading “Cocoa, Core Data, and me (II)”

Cocoa, Core Data, and me (I)

My travails as I implement my first project in Cocoa, part I.

This is, or may become, a series of blog entries about Cocoa development, as written by a complete n00b. I’m not saying it’s correct, I’m not saying I will even go on with the entries; I may stop at any time or lose interest or something. Or die, or end up in jail. Or lose my memory, or lose my website and backups. But if I don’t do any of those things, I intend to chronicle my advances into the world of OSX development. Thanks. You’re welcome. BTW, if I discover that I said something unusually stupid, I may change the text afterwards and pretend nothing happened. So if you want to prove me an idiot, you’d better take a screenshot of it before I remove the evidence. Another way of saying the same thing is: I will update the text as mistakes are discovered. Or not.

I’ll put my entries about this project into its own blog category: OSX Dev, so if you want to follow just this story, select the category in the sidepanel.

I’ve done Windows development for 20+ years and I’m sick and tired of it. I’ve been PDG (Pretty Damn Good) in a couple of languages, like compiled Basic for CP/M, Clarion for DOS, C++, and Delphi. I’ve been decently good in C#, and I’ve done my share of hating Centura. I’ve tried Java, and it left me cold.

Some languages inspire, like Clarion for DOS and to some degree Delphi. Some languages are too tedious and complex to inspire and only turn into a dreary day job, like Clarion for Windows and C#. Some languages inspire revulsion, like Centura. But that’s just me, YMMV.

Some languages are highly productive, and again, I drag up Clarion for DOS. I really love C++, but I can’t call it productive. It’s like going to the pub. You can delve into irrelevancies forever, to get everything just right, but you’re not advancing very much. There’s nothing like a perfectly tuned template to turn me on, but what’s the point? Yes, I know, there is a point, but it’s a bit too small to get actual real live and breathing software delivered.

I have a feeling that Objective-C and Cocoa may be an inspiring combination, so I started a project just to learn about it. The project is an accounting program, so it’s a database app. I’m not aiming for multiuser or anything fancy, I just want an accounting app I can change myself when I need something. I’ve done accounting apps before, so I know how they work.

Continue reading “Cocoa, Core Data, and me (I)”