Entries Tagged 'Software' ↓
June 21st, 2008 — Cocoa, Goodbye Helicopter, Mac Rumors, Programming, Rails, Ruby, Software, XCode
If you think you are ready to sink your teeth into Core Data, you should definitely start with Scott Stevenson’s tutorial.
Granted, you may want to use XCode 2.x for the tutorial, since that is what the tutorial is in. The differences between Interface Builder with XCode 2.x and XCode 3.x are pretty huge. The workflow is very different. (not to mention the interface, no pun intended)
I myself am still getting acquainted with XCode 3.x and my new Intel-based MacBook is in the shop, so I’m on the reliable old G4 iBook today, so it is an exercise I can work on in the interim.
Although you don’t need to be an expert at Cocoa Bindings, and there’s a strong chance you’re not. (not many people are) You will want to at least have covered the frustration of trying to work with bindings a little bit before sticking your nose into Core Data. And, as always, I will say if you’ve worked with Ruby on Rails and Active Record before, you will find Cocoa, Cocoa Bindings and Core Data a little less frustrating, but don’t expect it to be the same thing. It does still work like ORM (object relational mapping) so having a basic understanding how CRUD (create, retrieve, update, destroy) applications work with databases will help you a lot.
June 8th, 2008 — Beginning Programming, CSS, Cocoa, Goodbye Helicopter, Mac Rumors, OS X, Programming, Software, UNIX, XCode
I’m now diving into XCode 3, thanks in no small part to my new black MacBook! One thing I had been looking forward to is the syntax highlighting that shows you the scope of the function or method or code block. Beautiful stuff. I had envisioned it myself several years ago, when I first learned CSS. (I’m sure I’m not the first and obviously not the only…)
Now that XCode 3 finally has code folding, though not as slick as TextMate’s code folding, it will flash the scope depth highlighting colors. But it goes away quickly. Here is how to turn it on to stay (it isn’t obvious or self-apparent).
View>Code Folding>Focus Follows Selection
Or a picture …

April 22nd, 2008 — Beginning Programming, Cocoa, Goodbye Helicopter, Mac Rumors, OS X, Programming, Software
What’s the secret to getting good results from Icon Composer?
That’s actually very easy to answer. Most of all, a good design that follows the ideals set forth in Apples HIG (Human Interface Guidlines). But aside from that, you need to use Photoshop for the final image. Regardless of how you design the initial image, in Photoshop, create two layers. One for the image, one for a black shape that is the same outline as the image. Make sure you’ve got a square canvass in Photoshop also. Then, Save As… select TIFF as the format, with no compression and preserve layers.
Now drop that tiff file onto icon composer. You’ll get as good as possible at this point.
April 6th, 2008 — Cocoa, Mac Rumors, OS X, Programming, Safari 3 beta, Software, Vista
Back in the days before OS X came out, there was Yellow Box. If it were available today, it could easily be described as XCode and Cocoa for Windows. There was also Red Box back then, essentially the same as what we’ve got now: OS X on Intel processors. To make things interesting, it is well-known that iTunes exists for Windows, and (somewhat infamously) also known that Safari exists for Windows. Apple even makes a utility for Windows to manage AirPort base stations.
“So, what!?”, right?
No. It’s bigger than that. What Apple is tinkering with more and more in their skunkworks is the development environment formerly known as Yellow Box. That technology never went away. It may have languished with time somewhat, but thanks to Microsoft’s determined support for backwards compatibility, most of what was ever in Yellow Box still works. Sure, some of it is crufty and all that, but the recent developments with Safari and on-going development of iTunes for Windows is indicative enough that they’re definitely toying with the idea of releasing Yellow Box once again.
This makes perfect sense. Macs run on Intel. Windows runs on Intel. Mac users can install Windows on a Mac. Why not develop the same application on a Mac, in Mac OS X, in XCode, then compile it for both operating systems at once!? That’s right. That’s exactly one of the things you will see coming out of Cupertino in the next year or two. If they don’t announce it at this year’s WWDC, you can expect it at the following year’s WWDC.
April 6th, 2008 — Beginning Programming, Books, Cocoa, OS X, Programming, Software
NSNotification and NSNotificationCenter are two super useful classes in Cocoa. Like so many things in Cocoa, they are well thought out. But notifications can be a source of hard to track down bugs. You will find them, because often they prevent your application from doing things that should be seen visually in the interface. The question is, how quickly will you find them…?
This code (from the Hillegass book, Cocoa Programming For Mac OS X, 2nd ed.) shows an NSDocument subclass implemented and registering each instance of itself as an observer of particular notifications:
@implementation MyDocument
- (id)init
{
self = [super init];
if (self) {
employees = [[NSMutableArray alloc] init];
NSNotificationCenter *nc;
nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(handleColorChange:)
name:@"JJColorChange"
object:nil];
}
return self;
}
…
And here we have another object’s method that sends the notification our document class is interested in observing and acting on:
...
- (IBAction)changeBackgroundColor:(id)sender
{
NSColor *color = [sender color];
NSData *colorAsData;
colorAsData = [NSKeyedArchiver archivedDataWithRootObject:color];
NSUserDefaults *defaults;
defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:colorAsData
forKey:JJTableBgColorKey];
NSNotificationCenter *nc;
nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName:@"JJColorChanged" object:self];
}
…
I did take out all NSLog lines to make it a bit easier to follow the code itself. There is nothing special or spectacular or unusual about any of it. This is just an example of where naming things can be a big deal. NSNotifications can also indeed be a bit like the infamous GOTO statements. Let’s face it, eventually object orientation can lead to its own brand of spaghetti code, too. As convenient and useful as they are, they are a bit fragile, since the names are important, generally hard-coded, and I haven’t yet seen or come across a nice category/protocol style way of simply declaring an object to be an observer of some set of notifications. Even with it, you still need to act explicitly on a notification, so it does require some care to make sure things are spelled right.
Did you find it yet? I hope so. With a lot more code surrounding things, it can be a bit tougher to locate, but the difference is between:
@"JJColorChange"
and:
@"JJColorChanged"
Only one letter. Conceptually, they’re also very close. Observing both the action (noun) and the completed action (regular past tense verb). Either one could be a valid, short announcement! Both could be part of a larger English sentence respectively, and still express the same thing.
Perhaps this is why Cocoa engineers seem to use “Did” instead. A lot easier to spot the difference between:
@"JJColorDidChange"
and:
@"JJColorChange"
Why? It is a subtle effect of the way the human brain actually reads and recognizes words. We do not read each letter. Our brain scans text for the general shape of whole words and phrases. That’s the developmental difference between somebody who can read, and somebody who is
still
learning
to
read
and
reads
like
this.
Thus, if you have a choice you want to choose the added word in the middle that changes the shape of the whole thing. This same effect occurs with CamelCase or the_underscores_in_ruby. But look at these examples as well:
@"CamelCase"
@"CamelCased"
@"CamelCase"
@"CamelDidCase"
@"CamelWillCase"
@"CamelByCase"
Notice now, how the last bunch make a lot more sense and are easier to distinguish visually. What some people initially believe is verbose and hard to read is made with some thought in mind. So now you see classic Steve Jobs/Apple thinking in the design even of Cocoa. (ok, ok, NeXT, but even then, same bunch of brilliant people and same culture)
March 24th, 2008 — Blogs, Software, Uncategorized
Well, well. We have a new firestorm brewing in the online world of companies overly obsessed with SEO and other acronyms: Google’s Search-Within-A-Search ! I can only say that this is the time when site owners who are particularly worried about it just need to do one thing, and that is start promoting other search sites. The biggest problem they face with the B.S. they call SEO is that there are today only 3 or 4 real contenders for web search. If they want to really, truly have a fair shake, they simply need to invest in and promote other search sites. Everything is concentrated in Google. It’s like trying to get TV ads out, but the only purveyors are the major networks or the local cable company. Remember the days of the yellow pages? Particularly before the breakup of Bell Telephone? There was ONE BOOK. And that is exactly where we are today with Google.That’s not all bad, because Google generally tries to do good things for everyone online. I really believe they try their damnedest to be as egalitarian as possible. The flaky wankers who really don’t like this are the companies who would be happy if they could BUY the rights to be the exclusive result returned for search words!!! Funny how this works, isn’t it?So, there it is. All you retailers and e-commerce giants and people who don’t pay for AdWords ads… …go out and build a better search! Or even just better market a so-so search engine. Microsoft didn’t get where they are today by always building a better mouse trap! Marketing. Google did get where they are by building a better mouse trap, but that was in the wild and wooly 90’s dot-com bubble era.
March 22nd, 2008 — Beginning Programming, Mac Rumors, OS X, Programming, Software
Working on the RaiseMan application in Cocoa Programming For Mac OS X 2nd Ed, I kept getting ” ‘ClassName’ may not respond to ‘-methodName’ “warning messages on successful builds. The warnings were obviously stupid compiler warnings. Trouble is this: Objective-C (and thus Cocoa) does not care what order you implement methods in your .m file, BUT the compiler is just not clever enough to realize this and wait until later to generate warnings like this.Annoying. Especially so, when you consider, I knew this long ago, but had forgotten it. But to be sure, even though you can put methods in any order, when you get such erroneous warnings, check to see if the method flagged in the warning does not call a method that is defined later in the .m file. If you find this to be true, simply reorder your methods so you can build without warnings. Ideally, you should build successfully with few or no warnings. No warnings is always ideal. Compilers are clever tools but not perfect. The upside of this annoying defiance of the language? When you do get your methods in an order that generates no warnings, your code will be more readable and maintainable because no method will call another method that does not come before it!Finally, I don’t know if this has changed in XCode3. I doubt it, but I have not taken the plunge into Leopard, because I can’t afford to buy a new Mac capable of smoothly running Leopard. (and because I still don’t really like Leopard as much as Tiger and Panther, even though I use it at work every day… maybe another dot-update or two will bring me into the fold…)
March 1st, 2008 — Beginning Programming, Blogs, Linux, Mac Rumors, OS X, Programming, Review, Software, UNIX, Vista
Duh?! Physical access to any machine makes it highly vulnerable to accessing the contents of its storage media. Apple knows that. Any IT manager worth spitting on knows that. Steve Ballmer probably knows that. George Bush might even know that! These guys who developed the cold memory dumper are butt stupid because it’s a waste of time and effort. This is no big secret or mystery. If you have an OS X install disk that is not older than that particular Mac, you can simply put the disk in, force power down, restart booting from the install disk, from the Utilities menu launch Reset Password Utility. This allows you to change the password for any account on any connected bootable volume as well as enable the Root account! That’s a hell of a lot easier than this bullshit attack.Apple’s not stupid and this is no secret.If you really, really need more security, you simply do not allow physical access to the computer. Need more? Do not allow network connectivity. Need more? Enable a firmware password on the drive. Need more? Get custom firmware that disables startup keys normally available on the Mac OS. Need more? Be a Luddite.Security is always a trade-off with any connectivity. The old phrase Boot Access IS Root Access exists for a reason.
February 20th, 2008 — Linux, Mac Rumors, OS X, PHP, Perl, Programming, Rails, Ruby, Software, UNIX
You may have tried unsuccessfully to install the Ruby Gem ultraviolet or the gem it depends on, textpow, and if you did, it likely failed mysteriously. Well, you first need to download and install the Oniguruma regex library. These instructions should work on almost any *nix with GCC, as well as OS X 10.4 and 10.5 !First, go to http://www.geocities.jp/kosako3/oniguruma/ and download the latest version of Oniguruma. (as of this writing, 5.9.1) In terminal, cd to the directory you downloaded the tarball to.Un-tar it: tar zxf onig-5.9.1.tar.gz Change to the directory of the un-tarred stuff:cd onig-5.9.1 Configure it, in most cases, just add the PATH you use, normally, /usr/local ./configure --prefix=/usr/local After that’s finished, sudo make and then,sudo make install
Now, you can install that oniguruma gem with no trouble! Same goes for textpow and ultra edit.
February 16th, 2008 — Mac Rumors, OS X, Programming, Ruby, Software
With the recent update to OS X Leopard, 10.5.2, RubyCocoa has been updated (0.13.2) as part of the update as well! This shows that Ruby is being taken somewhat seriously at Apple. (I say somewhat because there is not a bigger effort afoot… but it’s good and getting better.)Now, I just encourage more people to try it and use it, so that it gains more momentum and attention. This in turn will convince Apple management to put more into it!