MacKuba

Kuba Suder's blog on Mac & iOS development

Interface Builder tips and tricks

Categories: Cocoa, Mac 1 comment

I read Apple’s tutorial about Interface Builder this week. Most parts of it told about rather basic things and were quite boring, but I’ve learned several useful tricks from it. IB, like most of Apple’s applications, has lots of hidden features which aren’t obvious at first, and can only be found by experimenting, by accident or by reading about them somewhere. Here’s a few things that I’ve learned from the tutorial – some of them are such hidden features, some are just things that weren’t mentioned in any source I’d read before.

Read more »

Generating scaffold interfaces in Cocoa

Categories: Cocoa, Mac 0 comments

I discovered an interesting feature in Interface Builder a few days ago. It seems that it can generate a scaffolding UI for you based on a CoreData model. It works like this: first you have to design a data model in XCode model editor (which you have to do anyway if you want to use Core Data; if you don’t, it won’t make sense to draw the model only to get the scaffold UI, it will be faster to make it yourself…). Let’s say you have a model like in this picture:

XCode data model editor

Read more »

Missing controls in IB 3.1

Categories: Cocoa, Mac 0 comments

I’ve upgraded XCode and Interface Builder to version 3.1 recently (the update doesn’t appear in the system update, you have to download it manually, and it’s deceitfully hidden – you have to register at Apple’s developer portal to get it…). Today I’ve noticed that after the update some advanced controls were missing in IB. I had a vague memory of having a lot of additional categories of controls below the standard ones (some image views and Quicktime controls, for example), and I couldn’t find them there. This screenshot confirmed that I wasn’t imagining it. Not that I need them right now, but I might need them one day…

I was able to figure this out after a bit of googling, so I’m posting a solution here so that maybe I’ll save someone a little time. The thing is, for some reason IB forgot about some of its plugins; I think it has something to do with the “known issues” entry here in the release notes. Plugin files are located inside system frameworks. Anyway, to get them back, you need to go to IB’s Preferences → Plugins, and using the plus below the list add several framework bundles from /System/Library/Frameworks. The list more or less matches the list from the release notes, but you’ll have to experiment a bit (e.g. ImageKit and Quicktime plugins were hidden inside Quartz, and DiscRecording inside DiscRecordingUI). And that’s it, all advanced controls are available again.

"ls" on Mac and extended file attributes

Categories: Mac 10 comments

Yesterday while I was working in the terminal I noticed something unusual about the results of “ls -al” command:

Results from 'ls -al' command including at symbols (-rw-r--r--@)

What are those symbols? I googled for “mac ls at sign”, but most of the results told me that “@” means “symbolic link”. Well, all those files can’t be symbolic links, I’m pretty sure of that. So what are they?

Read more »

Bandwidth limiting in MacOSX

Categories: Mac 0 comments

I played a bit with bandwidth limiting tools in MacOSX recently. The reason was that I was uploading huge files to DivShare, and my Firefox took all the available upload bandwidth; and since upload bandwidth happens to be quite useful even when you’re not really uploading anything, everyone at home (including me) had serious problems with using the web at the time. So I thought I could try to force Firefox somehow to limit the maximum upload speed.

I’ve found a plugin which does exactly that, but it was only for Windows… (a plugin for a cross-platform browser which is not cross-platform? come on…). So I started looking for some system-wide solution. I found two pages that explained how to do this – it turns out it’s pretty easy, at least for someone that’s not afraid of the command line.

Everything is done using the ipfw command (IP FireWall?…). First you have to create one or more “pipes” with a constant share of bandwidth assigned:

sudo ipfw pipe <pipe_nr> config bw <amount>kbit/s

Read more »