Re: [MacRuby-devel] [MacRuby] #744: map on an array delivered by terminal app via scripting bridge gives an immutable error

2010-06-19 Thread MacRuby
#744: map on an array delivered by terminal app via scripting bridge gives an
immutable error
+---
 Reporter:  jazz...@…   |Owner:  lsansone...@…
 Type:  defect  |   Status:  reopened 
 Priority:  major   |Milestone:  MacRuby 0.7  
Component:  MacRuby |   Resolution:   
 Keywords:  |  
+---
Changes (by jazz...@…):

  * status:  closed => reopened
  * resolution:  invalid =>


Comment:

 Hi Thibault,

 I'm sorry, but I cannot agree! Your Obj-C example is a replacement for
 map! and not for map which should return a new Array and is not allowed to
 modify the original array!

 In the following example map works even with an immutable NSArray

 {{{
 a = NSArray.arrayWithArray [1,2,3]
 p a
 p a.map { |e| e + 10 }
 p a# a should be unchanged
 }}}

 and gives correctly

 {{{
 [1, 2, 3]
 [11, 12, 13]
 [1, 2, 3]
 }}}

 If I define my own Array#map my breaking example is working too, see this:

 {{{
 framework 'ScriptingBridge'

 class NSArray # why does Array not work here?
 def my_map &block
   res = []
   self.each { |e| res << block.call(e) }
   res
 end
 end

 term = SBApplication.applicationWithBundleIdentifier('com.apple.terminal')

 p term.windows
 p term.windows.class.ancestors
 p [term.windows.first].map { |w| w.name }
 p NSArray.arrayWithArray(term.windows).map { |w| w.name }
 p term.windows.my_map { |w| w.name }
 }}}

 And last but not least here is my working Obj-C example (although I don't
 like Obj-C very much, but hey, that's my first example with blocks)

 {{{
 #import 
 #import 

 int main (int argc, const char * argv[]) {
 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

 SBApplication *app = [SBApplication
 applicationWithBundleIdentifier:@"com.apple.terminal"];
 SBElementArray *windows = [app windows];

 //NSLog(@"%@", [windows class]);
 NSLog(@"%@", windows);

 NSMutableArray *result = [NSMutableArray arrayWithCapacity:
 [windows count]];
 [windows enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL
 *stop) {
 //NSLog(@"%@", [obj name]);
[result addObject:[obj name]];
 }];
 NSLog(@"%@", result);

 [pool drain];
 return 0;
 }
 }}}

 BTW, the original example is still working with my version of MacRuby 0.5!

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #744: map on an array delivered by terminal app via scripting bridge gives an immutable error

2010-06-19 Thread MacRuby
#744: map on an array delivered by terminal app via scripting bridge gives an
immutable error
+---
 Reporter:  jazz...@…   |Owner:  lsansone...@…
 Type:  defect  |   Status:  reopened 
 Priority:  major   |Milestone:   
Component:  MacRuby |   Resolution:   
 Keywords:  |  
+---
Changes (by lsansone...@…):

  * milestone:  MacRuby 0.7 =>


Comment:

 Indeed, I suspect this is a bug in the way we detect mutability in pure
 NSArrays. Sorry for the premature close.

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] has anyone played with audio frameworks?

2010-06-19 Thread B. Ohr
I’m thinking a long time about doing my own audio app, but the missing Obj-C 
framework stopped me every time. Somebody said, that the Obj-C method 
dispatching is too slow for real time audio.

But now, according to Gruber (Daring Fireball) there seems to be a new upcoming 
framework (AV Foundation): http://daringfireball.net/2010/06/wwdc_wrapup

Maybe it is something like this: 
http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVFoundationFramework/AVFoundationFramework.pdf

I think, I will wait for that! :-)

- Bernd


Am 29.05.2010 um 09:29 schrieb Rich Morin:

> I'm interested in playing with the OSX audio frameworks; I
> thought I should find out if anyone here has any experience
> that might be relevant.
> 
> -r
> -- 
> http://www.cfcl.com/rdmRich Morin
> http://www.cfcl.com/rdm/resume [email protected]
> http://www.cfcl.com/rdm/weblog +1 650-873-7841
> 
> Technical editing and writing, programming, system design
> ___
> 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] [MacRuby] #744: map on an array delivered by terminal app via scripting bridge gives an immutable error

2010-06-19 Thread MacRuby
#744: map on an array delivered by terminal app via scripting bridge gives an
immutable error
+---
 Reporter:  jazz...@…   |Owner:  lsansone...@…
 Type:  defect  |   Status:  closed   
 Priority:  major   |Milestone:  MacRuby 0.7  
Component:  MacRuby |   Resolution:  fixed
 Keywords:  |  
+---
Changes (by martinlagarde...@…):

  * status:  reopened => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.7


Comment:

 Ok, so the problem was actually how `#map` was implemented on `NSArray`s.
 It was using a `-mutableCopy` as the array to modify, but apparently this
 doesn't work with `SBElementArray`s. So I went and modified all the ruby
 methods on NSArray that would copy + modify an array (`#map`, `#shuffle`,
 `#uniq`, etc.) to use `[NSMutableArray arrayWithArray:rcv]` instead. This
 might be a little slower, but at least it works :-)/

 For the curious, `[[rcv class] arrayWithArray:rcv]` could have been
 better, but this doesn't work with `SBEelementArray`s either.

 Anyway, fixed with r4253 :-)

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] Building Cocoa Apps with MacRuby

2010-06-19 Thread Dave Baldwin
Hi Dan,

Good writeup.  I basically do as Michael Jackson has described, but with 
Textmate.  I would also like to dispense with XCode.  I have moved away from 
Hot Cocoa as it seems to be dead or unloved, but also found IB much easier to 
use in the end.

Looking at the rakefile in your Touchstone project has left me a bit confused.  
What do you use the Console task for?

Thanks,

Dave.

On 17 Jun 2010, at 18:32, dan sinclair wrote:

> Hello,
> 
> I wrote up some thoughts on building cocoa applications with MacRuby last 
> night and would love to hear any thoughts other people have. You can see the 
> article at 
> http://everburning.com/news/ramblings-on-programming-cocoa-with-ruby/ .
> 
> I've been trying several different methods, HotCocoa, XCode templates, 
> command line and haven't quite figured out a way that feels right and would 
> love some insight from other developers.
> 
> Thanks,
> dan
> 
> 
> ___
> 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] Building Cocoa Apps with MacRuby

2010-06-19 Thread Matt Aimonetti
Note that in Xcode 4, IB is not a separate app anymore, making this kind of
setup much harder :(

- Matt

On Sat, Jun 19, 2010 at 11:56 AM, Dave Baldwin
wrote:

> Hi Dan,
>
> Good writeup.  I basically do as Michael Jackson has described, but with
> Textmate.  I would also like to dispense with XCode.  I have moved away from
> Hot Cocoa as it seems to be dead or unloved, but also found IB much easier
> to use in the end.
>
> Looking at the rakefile in your Touchstone project has left me a bit
> confused.  What do you use the Console task for?
>
> Thanks,
>
> Dave.
>
> On 17 Jun 2010, at 18:32, dan sinclair wrote:
>
> > Hello,
> >
> > I wrote up some thoughts on building cocoa applications with MacRuby last
> night and would love to hear any thoughts other people have. You can see the
> article at
> http://everburning.com/news/ramblings-on-programming-cocoa-with-ruby/ .
> >
> > I've been trying several different methods, HotCocoa, XCode templates,
> command line and haven't quite figured out a way that feels right and would
> love some insight from other developers.
> >
> > Thanks,
> > dan
> >
> >
> > ___
> > 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


[MacRuby-devel] anyone wanna speak on MacRuby?

2010-06-19 Thread Rich Morin
I recently gave a lightning talk on MacRuby at the East Bay Ruby
Meetup Group (http://www.meetup.com/EBRuby/)  Later, Jon Seidel
(the organizer) and I agreed that it would be nice to have a full
session on MacRuby.  Problem is, I'm not qualified to give one.

If anyone here is interested in giving such a talk and will be in
the San Francisco Bay Area at some point, please get in touch.

-r
-- 
http://www.cfcl.com/rdmRich Morin
http://www.cfcl.com/rdm/resume [email protected]
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, system design
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Building Cocoa Apps with MacRuby

2010-06-19 Thread dan sinclair
The console task was just a simple way for me to run macrib and load up all the 
model files I have. Some of the stuff can work fine without a UI and this just 
gave me an easy way to test things. Similar to the Rails script/console.

dan




On Jun 19, 2010, at 2:56 PM, Dave Baldwin wrote:

> Hi Dan,
> 
> Good writeup.  I basically do as Michael Jackson has described, but with 
> Textmate.  I would also like to dispense with XCode.  I have moved away from 
> Hot Cocoa as it seems to be dead or unloved, but also found IB much easier to 
> use in the end.
> 
> Looking at the rakefile in your Touchstone project has left me a bit 
> confused.  What do you use the Console task for?
> 
> Thanks,
> 
> Dave.
> 
> On 17 Jun 2010, at 18:32, dan sinclair wrote:
> 
>> Hello,
>> 
>> I wrote up some thoughts on building cocoa applications with MacRuby last 
>> night and would love to hear any thoughts other people have. You can see the 
>> article at 
>> http://everburning.com/news/ramblings-on-programming-cocoa-with-ruby/ .
>> 
>> I've been trying several different methods, HotCocoa, XCode templates, 
>> command line and haven't quite figured out a way that feels right and would 
>> love some insight from other developers.
>> 
>> Thanks,
>> dan
>> 
>> 
>> ___
>> 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] Building Cocoa Apps with MacRuby

2010-06-19 Thread dan sinclair
As long as I can still compile the .xib to a .nib outside of XCode then I'm 
fine with that. I still use XCode for the Core Data model editor. I just don't 
like having to add my files through the project system and build/debug in 
XCode. Prefer to do that from the command line.

dan





On Jun 19, 2010, at 3:10 PM, Matt Aimonetti wrote:

> Note that in Xcode 4, IB is not a separate app anymore, making this kind of 
> setup much harder :(
> 
> - Matt
> 
> On Sat, Jun 19, 2010 at 11:56 AM, Dave Baldwin  
> wrote:
> Hi Dan,
> 
> Good writeup.  I basically do as Michael Jackson has described, but with 
> Textmate.  I would also like to dispense with XCode.  I have moved away from 
> Hot Cocoa as it seems to be dead or unloved, but also found IB much easier to 
> use in the end.
> 
> Looking at the rakefile in your Touchstone project has left me a bit 
> confused.  What do you use the Console task for?
> 
> Thanks,
> 
> Dave.
> 
> On 17 Jun 2010, at 18:32, dan sinclair wrote:
> 
> > Hello,
> >
> > I wrote up some thoughts on building cocoa applications with MacRuby last 
> > night and would love to hear any thoughts other people have. You can see 
> > the article at 
> > http://everburning.com/news/ramblings-on-programming-cocoa-with-ruby/ .
> >
> > I've been trying several different methods, HotCocoa, XCode templates, 
> > command line and haven't quite figured out a way that feels right and would 
> > love some insight from other developers.
> >
> > Thanks,
> > dan
> >
> >
> > ___
> > 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

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