Re: [MacRuby-devel] Would a macruby-newbie List Be Worthwhile?

2009-12-15 Thread steve ross
Thanks for your feedback...

On Dec 15, 2009, at 4:19 PM, Ernest N. Prabhakar, Ph.D. wrote:
> 
> Hi "S",

Point taken :)

>> Would a newbie list be worth creating?
> 
> I would encourage you to just go ahead and ask on this list, for several 
> reasons:
> 
> a) The people who would answer are here, so they may as well answer

That's what someone says every time somebody else suggests forking a list. I 
hope it's the right answer because a lot of my questions would be off topic 
both on this list and the Cocoa Developers list.

> b) It could be a bug, in which case it belongs here

Yeah, but at this point, I think many of us can tell when it's our own fault :)

> c) It helps us understand usage issues, which may inform features and 
> documentation

Again, point taken.

> The more interesting question to me is when do we create a macruby-users list 
> for those using the "stable" version -- or move development OF macruby to a 
> "macruby-core"?
> 
> I guess it depends on when MacRuby is stable enough and popular enough.  At 
> any rate, it isn't yet.
> 
> -enp
> 
> 
> On Dec 15, 2009, at 11:21 AM, s.ross wrote:
> 
>> There are a number of questions I know I have coming from a Ruby/Rails and 
>> not a Cocoa background. These questions can be difficult to answer in the 
>> context of Objective-C (and heck, Ruby makes a lot of the Objective-C 
>> syntactic vinegar just go away). They are also not specifically about 
>> MacRuby, but rather about how it interacts with the framework.
>> 
>> Because MacRuby can open up Cocoa to developers who really didn't want to 
>> mess around with [[obj alloc] init] and all that stuff. Many of you on this 
>> list did go through that learning experience but have already answered these 
>> same questions before in a different context but shouldn't be imposed upon 
>> to answer them again. Would a newbie list be worth creating? I find myself 
>> coming up with seemingly stupid questions that I simply don't want to 
>> trouble the list with but that take hours to dig out of the documentation. 
>> That would be the proposed purpose. Post some code, expected results, and 
>> what's actually happening.
>> 
>> Maybe an example: I want a single pane Core Data application but I forgot to 
>> select the template that creates an appDelegate. How do I get a 
>> managedObject context and how do I add some seed data to that collection 
>> once it's bound to an NSTableView. See? Complicated n00b question that 
>> requires IB steps and Ruby steps. Takes quite a bit of trekking around in 
>> the documentation to figure out. But someone who's walked the same path 
>> before could answer it right away.
>> 
>> Comments?
>> ___
>> 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


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


Re: [MacRuby-devel] Would a macruby-newbie List Be Worthwhile?

2009-12-16 Thread steve ross
On Dec 16, 2009, at 1:07 AM, John Shea wrote:
> 
> The second part, filling with data (presumably you will only need to do this 
> once, because then the data can be saved with the app).
> There are many ways to add data.
> 
> The easiest I reckon, is to add a method to the AppDelegate - called 
> applicationDidFinishLaunching(notification) (delegated from the application 
> singleton) and in that method you can do something like: 
> new_student = NSEntityDescription.insertNewObjectForEntityForName("Student", 
> inManagedObjectContext:self.managedObjectContext). 
> Then set the attributes for that obj, eg student.name = "Bill".

Let me be more specific about *why* this is important to me. My app goes out to 
a Web Service for data, so I have to fill some of it in programmatically, then 
it refreshes only occasionally. I decided this would be best in the controller, 
so it could be triggered by the user. To emulate that, I wanted to prepopulate 
the managedObject collection, and that I did in awakeFromNib. Warning: Make 
sure to call super! So what it boiled down to what this method in the 
controller:

  def new_image(image = {})
object = NSEntityDescription.insertNewObjectForEntityForName("Image",
  inManagedObjectContext:managedObjectContext)
object.setValue image[:fileid], forKey: 'fileid'
object.setValue image[:title], forKey: 'title'
puts "#{object} #{object.fileid} : #{object.title}"
  end

I used the setters explicitly when I was confused about why the bound tableview 
was blank. I'm beginning to get this a bit more under control, but the 
IB/CoreData/Cocoa Bindings is even magical to a Ruby person :)

See? I told you it was a dumb question.

Thanks,

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


[MacRuby-devel] Cocoa Binding to NSArrayController

2010-01-11 Thread steve ross
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-11 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
> 
> 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


Thanks for the reply and sorry for the delay. I created a simple Xcode project 
and it must be something I'm doing...

http://github.com/sxross/MacRuby-Array-Cocoa-Array-Binding/fast_forward___
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] 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
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


Re: [MacRuby-devel] GCD and NSURLConnection

2010-01-17 Thread steve ross
But... both examples show multiple threads accessing a single instance variable 
without taking any precautions to make the access atomic. Could it be that kind 
of concurrency issue?

Steve

On Jan 17, 2010, at 6:01 PM, Joshua Ballanco wrote:
> 
> Hey Darin,
> 
> Looks like you're hitting https://www.macruby.org/trac/ticket/511
> 
> Cheers,
> 
> Josh
> 
> 
> On Jan 17, 2010, at 4:52 PM, Darrin Eden wrote:
> 
>> Hi,
>> I have yet to wrap my head around GCD, but that's not stopped me from 
>> breaking things anyway.
>> I'd like to use an asynchronous queue with NSURLConnection. However, 
>>  results in a segmentation fault.
>> Thoughts?
>> 
>> Thanks,
>>   -- Darrin
>> ___

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


Re: [MacRuby-devel] GCD and NSURLConnection

2010-01-18 Thread steve ross
You're right, no ivars are being written in concurrent threads in the bug 
report code. However, in the NSURLConnection example, two ivars are used. The 
is the code to execute (the block). The second is the data buffer that will be 
changed as the HTTP response data returns.

In either case, there are potential problems. If there is a context switch 
while @block is being reassigned, the code in the block may be incomplete at 
the time of the switch. I don't know. In the case of the buffer, it is very 
likely to be stepped on in a context switch as the whole point of executing 
HTTP GETs in parallel is to switch context while blocked on network response.

I only know this because I'm in the middle of (not yet successfully) trying to 
solve the same problem with native threads.

Steve


On Jan 17, 2010, at 10:34 PM, Joshua Ballanco wrote:
> 
> I'd have to look at the NSURLConnection example again, but in the code from 
> the bug report, there's no unsafe variable access in the Ruby code. Each Bar 
> holds a reference to its own Foo in @foo, and we're dispatching to multiple 
> Bars in turn. If you run that sample (you might need to tweak some of the 
> parameters, depending on your machine) I think you'll find a fun error 
> message that indicates this is definitely a MacRuby bug. :-)
> 
> Cheers,
> 
> Josh
> 
> 
> On Jan 17, 2010, at 10:25 PM, steve ross wrote:
> 
>> But... both examples show multiple threads accessing a single instance 
>> variable without taking any precautions to make the access atomic. Could it 
>> be that kind of concurrency issue?
>> 
>> Steve
>> 
>> On Jan 17, 2010, at 6:01 PM, Joshua Ballanco wrote:
>>> 
>>> Hey Darin,
>>> 
>>> Looks like you're hitting https://www.macruby.org/trac/ticket/511
>>> 
>>> Cheers,
>>> 
>>> Josh
>> 


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


[MacRuby-devel] My class's initialize not called

2010-01-21 Thread steve ross
I'm sure this is an elementary question, but I have the class below. In IB, I 
set several NSTextField controls to this class. Everything works in the blah, 
blah, blah part, but strangely enough the 

puts "initialize dctf"

never seems to be called. Any thoughts as to why?

require 'strings'

class DuplicateCounterTextField < NSTextField
  include Strings
  
  attr_accessor :splitter, :completions
  attr_accessor :wordCount, :duplicateCount
  
  def initialize
puts "initialize dctf"
@splitter = /\W+/
@wordCount = 0
@cachedWordCount = 0
@duplicateCount = 0
  end
  
  # blah, blah, blah working code

  def textDidChange(notification)
words = stringValue.split(@splitter)
@wordCount = words.length
@duplicateCount = @wordCount - words.uniq.length

if delegate.respond_to?('controlCountDidChange:wordCount:duplicateCount:')
  delegate.controlCountDidChange(self, 
   wordCount:@wordCount, 
  duplicateCount:@duplicateCount) 
end
  end

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


Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread steve ross
So, this class doesn't reopen a Cocoa class, it subclasses it. Same anyhow? The 
real problem is that the class is instantiated as a side effect of nib loading, 
and the only place I've been able to successfully set initial state is 
awakeFromNib. I either can't, or don't know how to make the nib load process 
call a DuplicateCounterTextField.initWithSomeCoolState method. My impression is 
that awakeFromNib is a poor place for setting initial state because the order 
in which awakeFromNib's are called is undefined (or is it?). Not to 
overcomplicate things, but the controller needs to be able to tweak the state 
of the control -- for example, to change the splitter regex.

Thanks for helping out here.

Steve

On Jan 21, 2010, at 3:25 PM, Matt Aimonetti wrote:
> When reopening a Cocoa class, you should not overwrite initialize and if you 
> were to do it anyway, don't forget to call super and to return self.
> The Cocoa way is to create your own initializer to end up with something like 
> DuplicateCounterTextField.alloc.initWithDuplicate
> 
> Also, remember that when initializing a Cocoa class, you need to do 
> DuplicateCounterTextField.alloc.init
> 
> - Matt
> 
> 
> On Thu, Jan 21, 2010 at 3:20 PM, steve ross  wrote:
> I'm sure this is an elementary question, but I have the class below. In IB, I 
> set several NSTextField controls to this class. Everything works in the blah, 
> blah, blah part, but strangely enough the
> 
> puts "initialize dctf"
> 
> never seems to be called. Any thoughts as to why?
> 
> require 'strings'
> 
> class DuplicateCounterTextField < NSTextField
>  include Strings
> 
>  attr_accessor :splitter, :completions
>  attr_accessor :wordCount, :duplicateCount
> 
>  def initialize
>puts "initialize dctf"
>@splitter = /\W+/
>@wordCount = 0
>@cachedWordCount = 0
>@duplicateCount = 0
>  end
> 
>  # blah, blah, blah working code
> 
>  def textDidChange(notification)
>words = stringValue.split(@splitter)
>@wordCount = words.length
>@duplicateCount = @wordCount - words.uniq.length
> 
>if delegate.respond_to?('controlCountDidChange:wordCount:duplicateCount:')
>  delegate.controlCountDidChange(self,
>   wordCount:@wordCount,
>  duplicateCount:@duplicateCount)
>end
>  end
> 
>  # etc.
> end
> ___
> 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


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


Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread steve ross
So that confirms my suspicion. It's not so much a MacRuby thing as a Cocoa 
thing. I just don't see how to set an initial state in a class that's 
instantiated when a nib is loaded. I don't do the alloc.initWithWhatever. On 
the previous subject though, adding super/self does not cause the initialize 
method to be called. Hmm...

On Jan 21, 2010, at 4:20 PM, Matt Aimonetti wrote:
> Overwriting the init method of a Cocoa class subclass is not recommended. 
> Here is an example of what I was suggesting:
> 
> http://github.com/mattetti/phileas_frog/blob/master/image_layer.rb#L44
> 
> Which then get called there: 
> http://github.com/mattetti/phileas_frog/blob/master/game_controller.rb#L57
> 
> In any cases, you still need to call init (or super if you overwrite 
> initialize) and you need to return self.


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


Re: [MacRuby-devel] My class's initialize not called

2010-01-21 Thread steve ross
Brian--

Thanks for the great explanation. I'm going to have to rethink how my object 
achieves a known initial state.

Steve


On Jan 21, 2010, at 6:41 PM, Brian Chapados wrote:
> 
> Hi Steve (et al),
> 
> So, there are a couple things going on here.  Cocoa classes use the
> concept of a "designated initializer" method, which is a name for the
> instance method that calls the initializer method of the superclass.
> This chain continues until you hit [NSObject#init]. To figure this out
> from the documentation:
> 
> - If a class does not document an initializer method, check the
> superclass, and continue up the chain until you find it.
> - If there are multiple initializer methods, the documentation for
> Cocoa classes will always tell you which method is the designated
> initializer.
> 
> In ObjC/Cocoa:
> If you have a subclass that requires input during initialization, you
> should create a new designated initializer.  That method should call
> the designated initializer of the superclass and you should override
> -init to call your new designated initializer.
> 
> All of this stuff is explained pretty well in Apple's Objective-C guide.
> 
> In Matt's example, he creates a few initialization helper methods, but
> -init is still the designated initializer.
> 
> In your case, NSTextField is a subclass of NSControl, and the
> designated initializer is (from NSControl):
> 
> -initWithFrame:(NSRect)frameRect
> 
> I think your subclass of NSTextField should have an -initWithFrame:
> method or another init method that calls super.initWithFrame:
> Although, if you're not supposed to call super.init in MacRuby, then
> I'm not sure how this is supposed to work.
> 
> Last point: The one odd exception case to the initialization chain is
> the one you hit: NIB files!
> 
> nib/xib files are basically freeze-dried collections of objects that
> are archived into a file.  When they are restored, this is done by
> unarchiving the file, which uses the NSCoder methods. Most of the time
> if you need to do custom configuration on an object instantiated from
> a nib file, you should probably do that in -awakeFromNib.  However, if
> for some reason you really need to do something during object
> initialization, you need to do that in initWithCoder:, since this
> method will be called for objects in a nib file.
> 
> Brian
> 
> On Thu, Jan 21, 2010 at 4:33 PM, steve ross  wrote:
>> So that confirms my suspicion. It's not so much a MacRuby thing as a Cocoa
>> thing. I just don't see how to set an initial state in a class that's
>> instantiated when a nib is loaded. I don't do the alloc.initWithWhatever. On
>> the previous subject though, adding super/self does not cause the initialize
>> method to be called. Hmm...
>> On Jan 21, 2010, at 4:20 PM, Matt Aimonetti wrote:
>> 
>> Overwriting the init method of a Cocoa class subclass is not recommended.
>> Here is an example of what I was suggesting:
>> 
>> http://github.com/mattetti/phileas_frog/blob/master/image_layer.rb#L44
>> 
>> Which then get called
>> there: 
>> http://github.com/mattetti/phileas_frog/blob/master/game_controller.rb#L57
>> 
>> In any cases, you still need to call init (or super if you overwrite
>> initialize) and you need to return self.
>> 

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


[MacRuby-devel] EXC_BAD_ACCESS When Reopening NSDate

2010-02-06 Thread steve ross
This code creates an EXC_BAD_ACCESS error:

class NSDate
  def to_s
NSLog "#{__LINE__} NSDate#to_s %@", self
'hello'
  end
end

NSDate.date.to_s


If I change the NSLog statement to:

NSLog "#{__LINE__} NSDate#to_s hello"

Then I get the log entry and no EXC_BAD_ACCESS. Any idea what's causing this?

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


Re: [MacRuby-devel] political rumination

2010-04-09 Thread steve ross
I don't know whether anyone will provide a rationale for the contract language, 
but here's an interesting analysis of it:

http://daringfireball.net/2010/04/why_apple_changed_section_331

Apple makes a lot of smart calls that seem stupid or selfish at first. A number 
of folks on Twitter have jumped on this contract language as a stupid and/or 
selfish call. I just don't know.

Steve Ross


On Apr 9, 2010, at 10:23 PM, Matthew Winter wrote:
> 
> Hi,
> 
> I asked the same question via Twitter, however I do not expect to get an 
> answer at this stage.
> 
> If my understanding is correct about why Apple has done this, in that it is 
> more due to "the need to support the new multitasking APIs in iPhone 4.0. The 
> system will now be evaluating apps as they run in order to implement smart 
> multitasking. It can't do this if apps are running within a runtime or are 
> cross compiled with a foreign structure that doesn't behave identically to a 
> native C/C++/Obj-C app."
> 
> Then based on this, I see no reason why they should not let MacRuby be 
> blessed as this essentially is making use of the same Objective-C runtime and 
> API's.
> 
> There are now quite a few ways to develop apps for the iPhone & iPad that do 
> not involve Obj-C. I wonder if it is just the case of recompiling the base 
> libraries or making the base libraries aware of Apple's multitasking needs, 
> and then for each to be blessed by Apple, or am I being way to optimistic 
> that this will happen.
> 
> Regards
> Matthew Winter
> 
> 
> On 10/04/2010, at 11:37 AM, Rich Morin wrote:
> 
>> I suspect that no Apple employee will be able to comment on
>> this, but I _really_ hope MacRuby will be among the blessed
>> languages for the iPad, etc.
>> 
>> -r
>> -- 

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


Re: [MacRuby-devel] political rumination

2010-04-10 Thread steve ross
On Apr 10, 2010, at 1:20 AM, Laurent Sansonetti wrote:
> 
> Guys, this isn't the right place to discuss this, I'm afraid. I recommend 
> using an official channel such as the Apple Developer Relations.
> 
> Thanks :-)
> 
> Laurent

I understand and respect your perspective, but when a developer makes an 
investment in learning a tool -- particularly an evolving one with a ton of 
promise -- it doesn't seem off-topic to discuss its future. Especially when 
there is news that might affect its applicability to one of the more promising 
platforms it could target.

Just my $.02

> On Apr 9, 2010, at 11:16 PM, steve ross wrote:
> 
>> I don't know whether anyone will provide a rationale for the contract 
>> language, but here's an interesting analysis of it:
>> 
>> http://daringfireball.net/2010/04/why_apple_changed_section_331
>> 
>> Apple makes a lot of smart calls that seem stupid or selfish at first. A 
>> number of folks on Twitter have jumped on this contract language as a stupid 
>> and/or selfish call. I just don't know.
>> 
>> Steve Ross
>> 
>> 
>> On Apr 9, 2010, at 10:23 PM, Matthew Winter wrote:
>>> 
>>> Hi,
>>> 
>>> I asked the same question via Twitter, however I do not expect to get an 
>>> answer at this stage.
>>> 
>>> If my understanding is correct about why Apple has done this, in that it is 
>>> more due to "the need to support the new multitasking APIs in iPhone 4.0. 
>>> The system will now be evaluating apps as they run in order to implement 
>>> smart multitasking. It can't do this if apps are running within a runtime 
>>> or are cross compiled with a foreign structure that doesn't behave 
>>> identically to a native C/C++/Obj-C app."
>>> 
>>> Then based on this, I see no reason why they should not let MacRuby be 
>>> blessed as this essentially is making use of the same Objective-C runtime 
>>> and API's.
>>> 
>>> There are now quite a few ways to develop apps for the iPhone & iPad that 
>>> do not involve Obj-C. I wonder if it is just the case of recompiling the 
>>> base libraries or making the base libraries aware of Apple's multitasking 
>>> needs, and then for each to be blessed by Apple, or am I being way to 
>>> optimistic that this will happen.
>>> 
>>> Regards
>>> Matthew Winter
>>> 
>>> 
>>> On 10/04/2010, at 11:37 AM, Rich Morin wrote:
>>> 
>>>> I suspect that no Apple employee will be able to comment on
>>>> this, but I _really_ hope MacRuby will be among the blessed
>>>> languages for the iPad, etc.
>>>> 
>>>> -r

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


[MacRuby-devel] Mapping of Objective-C Blocks to MacRuby

2010-05-12 Thread steve ross
I was thinking syntax like:

open_panel = NSOpenPanel.openPanel
open_panel.beginSheetModalForWindow(@main_window,
  completionHandler:lambda{|arg| "Yo, open file and user arg is #{arg}")

would be pretty sensible. But it seems not to be. Any hints?
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] testing?

2010-07-09 Thread steve ross
iCuke seems promising, but it is for iPhone dev 
[http://github.com/unboxed/icuke]. Probably could be repurposed for general 
Cocoa development. Bacon works, but I've found it more helpful for unit tests 
-- headless testing. In an automated sense, like 'rake test', there just isn't 
an analogous build step AFAIK. This is very uncomfortable for me. It's what's 
holding me up in getting going fully with MacRuby.

You're right. It just seems sensible that the Rubyists would bring an elegant 
testing solution to MacRuby -- and preferably as a build step in the xcode 
template.

Just my $.02


On Jul 9, 2010, at 12:05 PM, Ryan Davis wrote:

> So are you guys not testing your macruby code? I was hoping that the ruby 
> community would bring the testing culture to the cocoa world and make it a 
> better place. Having gotten no feedback/suggestions whatsoever on my testing 
> setup has me a bit wary.
> 
> ___
> 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


[MacRuby-devel] XCode 4 -- I Must Be Missing Something

2011-04-04 Thread steve ross
I was using XCode 3 and everything was a breeze, but a new MacRuby project in 
XCode 4 seems like pulling teeth. I'm sure someone has run across this, so I'll 
ask. I read Matt's chapter on XCode 4, read the redwoodapp.posterous.com 
article on setting the targets, and can get the thing to run and the main 
window to display. So here's the proble:

I have a Ruby class, ApplicationController, and I've hooked one button, one 
label, and one slider to it using IB. I declared the outlets as attr_writer and 
the method signature for the action is on_randomize(sender).

I created an awakeFromNib method. In this method, I put:

puts "hello, world"

It never prints to the console. Main window displays fine. No puts. I changed 
the File's Owner to ApplicationController (although it shouldn't matter, 
because it's not document-oriented). Still nothing.

I added puts statements to app_delegate.rb and nothing there is being executed.

I added puts statements to rb_main.rb and it is being loaded, and the Ruby 
files are being required.

The only build error is as follows:

2011-04-04 16:08:53.742 Random Password Generator[79326:903] loaded rb_main
2011-04-04 16:08:53.751 Random Password Generator[79326:903] requiring 
AppDelegate
2011-04-04 16:08:53.756 Random Password Generator[79326:903] requiring 
ApplicationController
2011-04-04 16:08:53.805 Random Password Generator[79326:903] Could not connect 
the action on_randomize: to target of class ApplicationController

The first 3 lines are my debug statements in rb_main.rb. The third one, "Could 
not connect..." is the one I'm having trouble interpreting.

Any pointers as to why my code simply doesn't hook up?___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] Xcode 4.2/IB and MacRuby: Works!

2011-10-19 Thread steve ross
In case nobody was watching…

So, today I downloaded Xcode 4.2, hoping IB would recognize outlets and actions 
in MacRuby classes. I also downloaded the newest version of MacRuby (0.12) from 
the nightly builds.

Now, my outlets and actions (as defined in my Ruby classes) are recognized in 
IB. Hurrah!!!
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel