From the Xcode-Users list...

How do you pronounce XIB?

I’d say it as ZIB. You know, like xylophone?

Testing Modified ecto-Twitter addon.

As the man says…

Creating a new Avatar.

Can you tell I’m procrastinating?

I’ve spent the last little while using Acorn to create a new Avatar. Here are some ideas.

manga_matt_dot.png

manga_matt.png

manga_matt_pont.png

Matt_vectorized_pont2.png

Matt_vectorized_dot.png

Turn of the Century. Again.

Back sometime before the year 2000, I happened across a book called “Turn of the Century”, but Kurt Andersen. I remember absolutely loving it, but the coolest thing was that one of my longest friends, who had not too long previously moved interstate, had started reading it at exactly the same time. It was like our own private Oprah’s Book Club, but without Oprah. So, better.

Today, I happened across a blog by Buzz Anderson, and for some reason, this reminded me of Kurt Andersen. I dunno why, you figure it out.

So, I decided I’d read the “Turn of the Century” again. Which is cool, as I can’t really remember what happens in it anyway. I just remember that I loved it. But I already said that, didn’t I?

#1 Fix for Twitterific

It annoys me that when I click off the Twitterrific window, it doesn’t auto-hide. There doesn’t seem to be a setting to make this happen.

Luckily, you can fix this with a quick edit to the MainMenu.nib file.

(This requires you have InterfaceBuilder, and therefore the developer tools installed.)

View the contents of the Twitterrific.app package, and navigate to the Resources/English.lproj directory, and open up MainMenu.nib. Find the Tweet Window, and change it’s properties to “Hide on Deactivate”.

Save the nib, and restart Twitterrific. Bingo, clicking off the window auto-hides.

Twitter

I registered for Twitter ages ago, but only recently started actually using it all of the time.

http://twitter.com/schinckel

Xcode 3.1

I finally got around to updating Xcode to 3.1 yesterday.

There’s some great stuff in there. At last, the autocomplete of method names puts in tokens for the arguments, so you can just click on the token and then overtype - or just delete it in one go with (forward) delete.

Another cool thing is something that I’ve seen in NetBeans, but the default settings there for it are just annoying. Previous instances of the currently selected variable are highlighted. In Xcode it is a much subtler underline, much better than bright yellow.

This is better than NetBeans in another way - you can click on the item, and access a special contextual menu that allows you to edit every instance of the variable name in your current scope. Thus, refactoring is made much easier.

I’m sure there was something else I really liked too, but I can’t recall what it was.

NSScrollView copiesOnScoll Slowdown

I have a custom class, called MultiMatrix, which is basically an NSMatrix that has header rows and columns. Selecting a header row or column will select the whole row/column, and selecting the top-left cell will select the whole table. These header cells will also automatically select themselves if their whole row/column/table is selected.

Because I dynamically update the size of the matrix according to some data elsewhere in my program, I needed to embed it into an NSScrollView, so that when the size exceeds the normal size, then users can scroll to select cells.

I did this, and I was having huge slowdowns. I could select cells alright, but selecting a header cell meant about a one second delay.

Solution: turn off the NSScrollView’s copiesOnScroll.

Even though I wasn’t scrolling, for some reason this was causing big performance issues.

I suspect it’s making my custom matrix class do something lots of times, or perhaps it’s related to the controller and the bindings I have set up. Regardless, unchecking the Copies On Scroll box in IB fixed it.

Boolean and Integer values in C

    Tags:
  • c

I got tripped up by how C represents Boolean values today.

To save space, but more to make comparisons easy, I was storing a series of bits (representing hours in a day) as integers. I had built up some structure so that my sub-classed NSMatrix could use Cocoa Bindings and be connected to a Controller, so that changing the values in an NSArray of Integers in that controller would change the selected cells in the matrix, and changing the cell selection similarly affects the values stored in the array.

But, and it took me a while to figure this out, I was having problems getting the data back from the array properly. For some reason, numbers greater than 255 were not displaying properly. Basically, I seemed to be losing bits off the top. So I spent ages rewriting the code using longs, long longs, and unsigned long longs, but nothing seemed to work.

Eventually, I pinpointed the error to this: in C an integer with the lower 8 bits all set to 0 evaluates to FALSE.

It doesn’t seem to matter if the integer is a long, or whatever.

Thus, when I checked, using a bitwise AND (& operator), the stored value against a value representing the cell value, and stored it directly in a BOOL, and then used said BOOL to set the selection of that cell, it was evaluating to False for all values greater than 255.

All I needed was to change one line of code:

BOOL highlight = (value & bin);

becomes:

BOOL highlight = (value & bin) > 0;

All fixed.

XCode 3.1 and "Availability"

You can’t have a class with the name “Availability” in a project built with XCode 3.1.

You can with XCode 3.0, but CFNetwork, and I assume a heap of other classes use a class called “Availability” to define if objects are available in a particular version of the OS.