Corbin's Treehouse - Corbin Dunn, Santa Cruz, CA
Plug Bug

Archive for April, 2014

NSTableView Tips: Doing Animations with Core Data

For my “Cyr Wheel Pattern Editor” app I am using CoreData and an NSTableView. However, I’m sort of “manually” doing bindings for the array content itself to get animations in the View Based NSTableView. Here’s what my model looks like: The CDPatternSequence has a children array of CDPatternItems: @interface CDPatternSequence : NSManagedObject @property (nonatomic, retain) NSOrderedSet *children; @end Now, if you have Xcode generate the standard code you might have noticed the standard NSOrderedSet accessors aren’t implemented for you; this is a bug in CoreData, but here is a good post on stack overflow about it. The minimal implementation I... [read more]

NSTableView Tips: View Controller per row

Sometimes you may find your application has rather complex rows, and you want an NSViewController to manage each row in a “View Based” NSTableView. This is fairly easy to do, and I did it in my Cyr Wheel pattern editing application. My “Cell View” that I want for each row was designed in Xcode like: A simple NSViewController subclass: @interface CDPatternItemViewController : NSViewController // the thing we are editing @property(weak) CDPatternItem *patternItem; @end The controller code is what is interesting. I use an NSWindowController subclass, and keep an array of the view controllers: @interface CDPatternEditorWindowController () { @private NSMutableArray *_patternViewControllers;... [read more]

NSTableView Tips: Not delaying the first responder

I have a little home-brew Cocoa app for making Cyr Wheel patterns. The UI is built with an NSTableView and looks like this: Now normally when you try to directly click on one of the NSTextFields the table will first select the row. Then a second click will allow you to start editing. For most tables, this is the behavior you want. For something like what I have, I want to avoid this, and allow the first responder to go through. This can easily be done by subclassing NSTableView and overriding: - (BOOL)validateProposedFirstResponder:(NSResponder *)responder forEvent:(NSEvent *)event { return YES; //... [read more]

How to make a cyr wheel: Insert detail

Here’s some details on my cyr wheel inserts that I make (aka: roue cyr):

Implementing delete in an NSTableView

I’ve seen many ways to implement delete in an NSTableView. Many are good. Many hardcode references to something they shouldn’t, and those are bad. Here’s an easy way: Subclass NSTableView and override keyDown: - (void)keyDown:(NSEvent *)theEvent { // handle delete unichar key = [[theEvent charactersIgnoringModifiers] characterAtIndex:0]; if (key == NSDeleteCharacter && self.selectedRow != -1) { [NSApp sendAction:@selector(delete:) to:nil from:self]; } else { [super keyDown:theEvent]; } } This just lets the responder chain take care of it. Your window controller can easily handle it by just implementing delete: - (IBAction)delete:(id)sender { if (self.tableView.selectedRowIndexes.count > 0) { [_tableView beginUpdates]; [[self _patternSequence] removeChildrenAtIndexes:self.tableView.selectedRowIndexes];... [read more]

LED Cyr Wheel: compass/accelerometer

The next step for my project is to add 3d position support by determining what angle and how fast the wheel is spinning at any given moment. The chip is in the wheel; I just need to interpret the data. I initially bought the LSM303D 3D Compass and Accelerometer Carrier with Voltage Regulator from Pololu ($15). However, I learned the LSM303D is just a compass, and gyro data is needed to determine pitch and yaw. So I bought a $20 MinIMU-9 v2 Gyro, Accelerometer and Compass from Pololu (well, two, in case I screw one up — and the price... [read more]

Flower Market

India, Flower Market Kolkata

Photography: India, Fruit delivery

India, Fruit delivery This guy didn’t look too happy, but I took his picture as he was walking by on the road. India, February 2014.

LED Cyr Wheel: Longer video

Another slightly longer video from last weekend. I have about 3 or so hours on it, and it seems to be holding up well!

LED Cyr Wheel v2: Test Video

Some quick test footage from last week; I used the wheel for the first time last Friday for an event put on at the Exploratorium by Velocity Circus. It works AWESOME!   EDIT (2/24/15). Check out my longer LED Cyr Wheel video.       Some pattern tests:   Act synced to music:

How to build a Cyr wheel or roue cyr: materials needed

A lot of people email me asking what materials to use for building cyr wheels (also known as a roue cyr, rouè cyr, or simple wheel). I like “thick” wheels (also known as a “fat boy”), with 1 3/4″ to 1 7/8″ outer diameter. Your preference may vary. Length of materials may vary depending on your wheel circumference. Materials * Main tubing: 20′ of 6061 Aluminum Tubing, 1 1/2″ Outer Diameter (OD), 1/8″ sidewall thickness. I buy pieces from a local supplier, Gorilla Metals which used to be Metal Supermarkets. You can buy shorter pieces online; factor in the fact... [read more]

(c) 2008-2017 Corbin Dunn

Corbin's Treehouse is powered by WordPress. Made on a Mac.

Subscribe to RSS feeds for entries and comments.

37 queries. 0.466 seconds.