Re: [MacRuby-devel] Cocoa Binding to NSArrayController

2010-01-12 Thread steve ross
On Jan 11, 2010, at 11:13 AM, isaac kearse wrote:
> Looks like you're bypassing the to_i conversion of @number by calling 
> instance_variable_set directly, but I'd guess that the problem is somewhere 
> else in the app.
> Any chance you could put the whole thing up on github?
> 
> Cheers,
> Isaac

I put together an Objective-C version of this same thing and checked it into 
the github project for comparison. It works. I'm sure there's something 
different in how I'm using it, but I can't see what. The project is at:

[email protected]:sxross/MacRuby-Array-Cocoa-Array-Binding.git

That's both MacRuby and Objective-C. Any pointers to my blind spot are 
appreciated :)

Steve

> On Tue, Jan 12, 2010 at 6:41 AM, steve ross  wrote:
> I wrote a simple controller that binds to an NSTableView. In the tableview, a 
> column has an NSNumberFormatter (in IB), but the column is what's bound. It's 
> bound to LightboxController.managedObjects:number. The managedObjects 
> collection contains a collection of Lightbox objects, that have a number 
> (Fixnum, when examined) and a title (string). The title displays fine, but 
> the number always displays as 1. Changing the number field to a string and 
> removing the NSNumberFormatter produces the correct display, but of course, 
> the sort order is string ordering rather than numeric.
> 
> Here is the code. Can anyone tell me what I'm missing here?
> 
> https://gist.github.com/5d490492a814eccd26b2
> 
> Thx,
> 
> Steve


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Cocoa Binding to NSArrayController

2010-01-12 Thread steve ross
On Jan 11, 2010, at 11:13 AM, isaac kearse wrote:
> Looks like you're bypassing the to_i conversion of @number by calling 
> instance_variable_set directly, but I'd guess that the problem is somewhere 
> else in the app.
> Any chance you could put the whole thing up on github?
> 
> Cheers,
> Isaac

I put together an Objective-C version of this same thing and checked it into 
the github project for comparison. It works. I'm sure there's something 
different in how I'm using it, but I can't see what. The project is at:

[email protected]:sxross/MacRuby-Array-Cocoa-Array-Binding.git

That's both MacRuby and Objective-C. Any pointers to my blind spot are 
appreciated :)

Steve

> On Tue, Jan 12, 2010 at 6:41 AM, steve ross  wrote:
> I wrote a simple controller that binds to an NSTableView. In the tableview, a 
> column has an NSNumberFormatter (in IB), but the column is what's bound. It's 
> bound to LightboxController.managedObjects:number. The managedObjects 
> collection contains a collection of Lightbox objects, that have a number 
> (Fixnum, when examined) and a title (string). The title displays fine, but 
> the number always displays as 1. Changing the number field to a string and 
> removing the NSNumberFormatter produces the correct display, but of course, 
> the sort order is string ordering rather than numeric.
> 
> Here is the code. Can anyone tell me what I'm missing here?
> 
> https://gist.github.com/5d490492a814eccd26b2
> 
> Thx,
> 
> Steve


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #552: NSOperationQueue segfaults when more than one operation is being added

2010-01-12 Thread MacRuby
#552: NSOperationQueue segfaults when more than one operation is being added
-+--
 Reporter:  mattaimone...@…  |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  blocker  |   Milestone:  MacRuby 0.5  
Component:  MacRuby  |Keywords:   
-+--

Comment(by ernest.prabha...@…):

 Not directly relevant to your question, but you can also use GCD directly
 via the Dispatch module.  The basic Queue and Group functionality should
 be solid in the latest top-of-tree, which I think would address your
 needs.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #552: NSOperationQueue segfaults when more than one operation is being added

2010-01-12 Thread MacRuby
#552: NSOperationQueue segfaults when more than one operation is being added
-+--
 Reporter:  mattaimone...@…  |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  blocker  |   Milestone:  MacRuby 0.5  
Component:  MacRuby  |Keywords:   
-+--

Comment(by mattaimone...@…):

 Thanks Ernie. However, I'm writing a section on some common Foundation
 classes and a chapter on concurrency programming with MacRuby so, even
 though GCD will be mentioned as the best option, I still need to cover the
 other existing solutions ;)

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #553: Fixnum Does Not Appear to Map to NSNumber

2010-01-12 Thread MacRuby
#553: Fixnum Does Not Appear to Map to NSNumber
---+
 Reporter:  cwdi...@…  |   Owner:  lsansone...@…
 Type:  enhancement|  Status:  new  
 Priority:  blocker|   Milestone:   
Component:  MacRuby|Keywords:   
---+
 In the context of Cocoa Bindings, Fixnum should "magically" convert to
 NSNumber much as String becomes NSString. Example:

 {{{
 irb(main):001:0> i = 123.to_i
 => 123
 irb(main):002:0> i.class
 => Fixnum
 irb(main):003:0> n = NSNumber.numberWithInt(i)
 => 123
 irb(main):004:0> n.class
 => Fixnum
 }}}

 See project: http://github.com/sxross/MacRuby-Array-Cocoa-Array-Binding/

 for a more concrete example of why this is important.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #554: Please implement IO#read_nonblock and IO#write_nonblock

2010-01-12 Thread MacRuby
#554: Please implement IO#read_nonblock and IO#write_nonblock
+---
 Reporter:  ernest.prabha...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  blocker |   Milestone:  MacRuby 0.5  
Component:  MacRuby |Keywords:   
+---
 http://ruby-doc.org/core/classes/IO.html#M002267

 http://ruby-doc.org/core/classes/IO.html#M002268

 These are extremely useful for doing non-blocking async IO via
 Dispatch::Source

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #554: Please implement IO#read_nonblock and IO#write_nonblock

2010-01-12 Thread MacRuby
#554: Please implement IO#read_nonblock and IO#write_nonblock
+---
 Reporter:  ernest.prabha...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  blocker |   Milestone:  MacRuby 0.5  
Component:  MacRuby |Keywords:   
+---

Comment(by ernest.prabha...@…):

 Why just manually setting it ourselves isn't ideal:

 http://cr.yp.to/unix/nonblock.html

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] NSAssert equivalent in MacRuby?

2010-01-12 Thread Laurent Sansonetti

def NSAssert(condition); abort unless condition; end # ? :-)

Laurent

On Jan 11, 2010, at 10:42 PM, Michael Johnston wrote:


Hi,

Is there an equivalent of the NSAssert macro in MacRuby?

Thanks,

Michael Johnston
[email protected]




___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Cocoa Binding to NSArrayController

2010-01-12 Thread John Shea
Perhaps it is this bug here: https://www.macruby.org/trac/ticket/473

In my case with the current 0.5 beta2 no float or integer binding to nscontrol 
works (I get all 1's) unless the float or integer is converted to an 
NSDecimalNumber using a ValueTransformer.
This is what i use for each float binding as a work around:

class ToDecimalTransformer < NSValueTransformer 
def self.transformedValueClass; NSDecimalNumber.class; end

def self.allowsReverseTransformation; true; end 

def transformedValue(value)
NSDecimalNumber.decimalNumberWithString(value.to_s)
 end
  
def reverseTransformedValue(value)
new_val = value.to_f
end
end

HTH,
John

On Jan 12, 2010, at 7:33 PM, steve ross wrote:

> On Jan 11, 2010, at 11:13 AM, isaac kearse wrote:
>> Looks like you're bypassing the to_i conversion of @number by calling 
>> instance_variable_set directly, but I'd guess that the problem is somewhere 
>> else in the app.
>> Any chance you could put the whole thing up on github?
>> 
>> Cheers,
>> Isaac
> 
> I put together an Objective-C version of this same thing and checked it into 
> the github project for comparison. It works. I'm sure there's something 
> different in how I'm using it, but I can't see what. The project is at:
> 
> [email protected]:sxross/MacRuby-Array-Cocoa-Array-Binding.git
> 
> That's both MacRuby and Objective-C. Any pointers to my blind spot are 
> appreciated :)
> 
> Steve
> 
>> On Tue, Jan 12, 2010 at 6:41 AM, steve ross  wrote:
>> I wrote a simple controller that binds to an NSTableView. In the tableview, 
>> a column has an NSNumberFormatter (in IB), but the column is what's bound. 
>> It's bound to LightboxController.managedObjects:number. The managedObjects 
>> collection contains a collection of Lightbox objects, that have a number 
>> (Fixnum, when examined) and a title (string). The title displays fine, but 
>> the number always displays as 1. Changing the number field to a string and 
>> removing the NSNumberFormatter produces the correct display, but of course, 
>> the sort order is string ordering rather than numeric.
>> 
>> Here is the code. Can anyone tell me what I'm missing here?
>> 
>> https://gist.github.com/5d490492a814eccd26b2
>> 
>> Thx,
>> 
>> Steve
> 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Cocoa Binding to NSArrayController

2010-01-12 Thread steve ross
Yes, this appears to be the bug, and yes, this is an absolutely great (!!!) 
temporary fix. Thanks very much for this.

Steve

On Jan 12, 2010, at 5:48 PM, John Shea wrote:
> Perhaps it is this bug here: https://www.macruby.org/trac/ticket/473
> 
> In my case with the current 0.5 beta2 no float or integer binding to 
> nscontrol works (I get all 1's) unless the float or integer is converted to 
> an NSDecimalNumber using a ValueTransformer.
> This is what i use for each float binding as a work around:
> 
> class ToDecimalTransformer < NSValueTransformer 
>   def self.transformedValueClass; NSDecimalNumber.class; end
>   
>   def self.allowsReverseTransformation; true; end 
>   
>   def transformedValue(value)
>   NSDecimalNumber.decimalNumberWithString(value.to_s)
>end
>   
>   def reverseTransformedValue(value)
>   new_val = value.to_f
>   end
> end
> 
> HTH,
> John
> 
> On Jan 12, 2010, at 7:33 PM, steve ross wrote:
> 
>> On Jan 11, 2010, at 11:13 AM, isaac kearse wrote:
>>> Looks like you're bypassing the to_i conversion of @number by calling 
>>> instance_variable_set directly, but I'd guess that the problem is somewhere 
>>> else in the app.
>>> Any chance you could put the whole thing up on github?
>>> 
>>> Cheers,
>>> Isaac
>> 
>> I put together an Objective-C version of this same thing and checked it into 
>> the github project for comparison. It works. I'm sure there's something 
>> different in how I'm using it, but I can't see what. The project is at:
>> 
>> [email protected]:sxross/MacRuby-Array-Cocoa-Array-Binding.git
>> 
>> That's both MacRuby and Objective-C. Any pointers to my blind spot are 
>> appreciated :)
>> 
>> Steve
>> 
>>> On Tue, Jan 12, 2010 at 6:41 AM, steve ross  wrote:
>>> I wrote a simple controller that binds to an NSTableView. In the tableview, 
>>> a column has an NSNumberFormatter (in IB), but the column is what's bound. 
>>> It's bound to LightboxController.managedObjects:number. The managedObjects 
>>> collection contains a collection of Lightbox objects, that have a number 
>>> (Fixnum, when examined) and a title (string). The title displays fine, but 
>>> the number always displays as 1. Changing the number field to a string and 
>>> removing the NSNumberFormatter produces the correct display, but of course, 
>>> the sort order is string ordering rather than numeric.
>>> 
>>> Here is the code. Can anyone tell me what I'm missing here?
>>> 
>>> https://gist.github.com/5d490492a814eccd26b2
>>> 
>>> Thx,
>>> 
>>> Steve


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel