You can subscribe to this list here.
2002 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(3) |
Nov
|
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(1) |
Feb
(11) |
Mar
(9) |
Apr
(1) |
May
(5) |
Jun
(5) |
Jul
(4) |
Aug
(3) |
Sep
(15) |
Oct
(8) |
Nov
(9) |
Dec
(11) |
2004 |
Jan
(5) |
Feb
(2) |
Mar
(1) |
Apr
(3) |
May
(6) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
(3) |
2005 |
Jan
(1) |
Feb
(7) |
Mar
(6) |
Apr
(36) |
May
(20) |
Jun
(42) |
Jul
(21) |
Aug
(12) |
Sep
(56) |
Oct
(5) |
Nov
(55) |
Dec
(53) |
2006 |
Jan
(43) |
Feb
(83) |
Mar
(98) |
Apr
(42) |
May
(68) |
Jun
(55) |
Jul
(50) |
Aug
(104) |
Sep
(13) |
Oct
(70) |
Nov
(37) |
Dec
(42) |
2007 |
Jan
(56) |
Feb
(18) |
Mar
(43) |
Apr
(80) |
May
(65) |
Jun
(149) |
Jul
(103) |
Aug
(71) |
Sep
(62) |
Oct
(67) |
Nov
(72) |
Dec
(63) |
2008 |
Jan
(64) |
Feb
(63) |
Mar
(31) |
Apr
(42) |
May
(71) |
Jun
(62) |
Jul
(37) |
Aug
(25) |
Sep
(5) |
Oct
(2) |
Nov
(7) |
Dec
(14) |
2009 |
Jan
(20) |
Feb
(15) |
Mar
(19) |
Apr
(8) |
May
(7) |
Jun
|
Jul
(37) |
Aug
(12) |
Sep
(19) |
Oct
(5) |
Nov
(1) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(24) |
Mar
(16) |
Apr
(9) |
May
(4) |
Jun
|
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(7) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(6) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
(5) |
Dec
|
2016 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Yvon T. <tho...@fr...> - 2006-02-24 18:48:25
|
Le 23 f=E9vr. 06 =E0 10:23, Jonathan Paisley a =E9crit : > Hi, > > I looked at the package which seems to be working properly, with =20 > dependencies. The ruby runtime is linked into the RubyCocoa =20 > framework so it should be completely independent of any ruby on the =20= > host system. > >> he is using this RubyCocoa beta app over standard Apple Ruby, i'm =20 >> using the latest build by my own. > > Could you explain what you mean here a bit more? Is he attempting =20 > to run the same version you provided a link to? If he's using a =20 > standalone version that you've provided, even though he has only =20 > the standard Apple ruby, it will be using the latest build that you =20= > used to make the application. > > > For more debugging information, you could add 'p $LOAD_PATH' to =20 > rb_main.rb before the first 'require'. Another useful thing is to =20 > run the app from the terminal using 'ktrace': > > ktrace ./BookmarksMerge.app/Contents/MacOS/BookmarksMerge > kdump | grep NAMI > files.log > > 'files.log' will show any file accesses made by the application, =20 > which should help to track down where it's looking for 'nkf.bundle'. > on one computer a "G5 mono 1.8" it seems the prob comes from the =20 computer itself see "The Buggiest Macintosh. Ever?(TM)" <http://www.g5freeze.com/index.html> on the other the bugg gad nothing to do with nkf nor standalonify.rb. thanks for your help ! Yvon= |
From: Jonathan P. <jp...@dc...> - 2006-02-24 13:26:25
|
> hmm, as I never code in objective-c before, I don't > know exactly what NSApplication.sharedApplication.run > should do, but I'll read the documentation and > feedback you. According to this page: http://www.cocoadev.com/index.pl?IOBluetooth the bluetooth APIs are not well documented. I think it may be best to try to make an objective C sample program that works before trying it in RubyCocoa, just to eliminate any interference from the RubyCocoa bridge. The best place to get advice is probably one of the Cocoa development lists, rather than ruby-related lists. Good luck, Jonathan |
From: Davide V. <var...@ya...> - 2006-02-24 12:35:59
|
Hi Jonathan --- Jonathan Paisley <jp...@dc...> wrote: > On 23 Feb 2006, at 22:35, Davide Varvello wrote: > > > I know the channel id for ftp on my device is 9, > puts > > connectResult > > displays 0, but puts sendResult shows -21875 (i.e > > busy) and of course, > > no picture is sent to the device. > > Do you understand this behavior? > > That error number is kOBEXSessionBusyError (see > /System/Library/ > Frameworks/IOBluetooth.framework/Headers/OBEX.h). yep > I think the problem is that the the OBEX methods are > asynchronous - > you have to set them going then wait for the > callback method on the > delegate. See the documentation for > [OBEXFileTransferServices > setDelegate:]. right > The reason progress is not made even though you have > 'sleep' in your > code is that the Cocoa event loop doesn't get a > chance to run. Try > setting up a delegate object and initiating the > session, then kick > off the event loop with > NSApplication.sharedApplication.run. hmm, as I never code in objective-c before, I don't know exactly what NSApplication.sharedApplication.run should do, but I'll read the documentation and feedback you. Thanks Davide __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Tim B. <tim...@gm...> - 2006-02-24 11:05:23
|
Jonathan, yes, that suggestion sounds great, especially since it would make things symmetric. Tim On Feb 23, 2006, at 12:48 AM, Jonathan Paisley wrote: > > On 22 Feb 2006, at 23:56, Tim Burks wrote: > >> I'd prefer to have the bridge automatically convert "object=" into >> "setObject" calls, perhaps as an option. > > There are two directions to consider here: > > ObjC calling to Ruby for 'setFoo' to call 'foo='. This is handled > by kvc_accessor. > > Ruby calling 'foo=' on an ObjC object to call 'setFoo'. This > isn't handled yet. > > The latter could be fixed by extending the 'analyze_missing' method > in oc_wrapper.rb. Do you think that would be sufficient? > > |
From: Jonathan P. <jp...@dc...> - 2006-02-23 23:16:39
|
On 23 Feb 2006, at 22:35, Davide Varvello wrote: > I know the channel id for ftp on my device is 9, puts > connectResult > displays 0, but puts sendResult shows -21875 (i.e > busy) and of course, > no picture is sent to the device. > Do you understand this behavior? That error number is kOBEXSessionBusyError (see /System/Library/ Frameworks/IOBluetooth.framework/Headers/OBEX.h). I think the problem is that the the OBEX methods are asynchronous - you have to set them going then wait for the callback method on the delegate. See the documentation for [OBEXFileTransferServices setDelegate:]. The reason progress is not made even though you have 'sleep' in your code is that the Cocoa event loop doesn't get a chance to run. Try setting up a delegate object and initiating the session, then kick off the event loop with NSApplication.sharedApplication.run. |
From: Davide V. <var...@ya...> - 2006-02-23 22:35:52
|
Hi, I've already post this message to the ruby group, but no one replied me, I hope for your help. So... I'm trying to connect, over bluetooth, to a mobile device and send apicure. That's my code: require 'osx/cocoa' OSX::NSBundle.bundleWithPath("/System/Library/Frameworks/IOBluetoothUI.framework").load OSX.ns_import :IOBluetoothDeviceSelectorController bluedevices = OSX::IOBluetoothDeviceSelectorController.deviceSelector bluedevices.runModal; result = bluedevices.getResults; bluetoothDevice = result.objectAtIndex(0); OSX::NSBundle.bundleWithPath("/System/Library/Frameworks/IOBluetooth.framework").load; OSX.ns_import :IOBluetoothOBEXSession; obexSession = OSX::IOBluetoothOBEXSession.withDevice_channelID(bluetoothDevice, 9); OSX.ns_import :OBEXFileTransferServices; service = OSX::OBEXFileTransferServices.withOBEXSession(obexSession); connectResult = service.connectToFTPService; puts connectResult; sleep 3; sendResult=service.sendFile("/Users/davide/myPicture.jpeg"); puts sendResult; sleep 3; service.disconnect; I know the channel id for ftp on my device is 9, puts connectResult displays 0, but puts sendResult shows -21875 (i.e busy) and of course, no picture is sent to the device. Do you understand this behavior? TIA Davide __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Yvon T. <tho...@fr...> - 2006-02-23 15:41:01
|
Le 23 f=E9vr. 06 =E0 10:23, Jonathan Paisley a =E9crit : > I looked at the package which seems to be working properly, with =20 > dependencies. The ruby runtime is linked into the RubyCocoa =20 > framework so it should be completely independent of any ruby on the =20= > host system. it's what i was assuming ))) > >> he is using this RubyCocoa beta app over standard Apple Ruby, i'm =20 >> using the latest build by my own. > > Could you explain what you mean here a bit more? Is he attempting =20 > to run the same version you provided a link to? If he's using a =20 > standalone version that you've provided, even though he has only =20 > the standard Apple ruby, it will be using the latest build that you =20= > used to make the application. yes he used the standalone version, he had been using another app =20 (also standalonified by your script) with success. > > > For more debugging information, you could add 'p $LOAD_PATH' to =20 > rb_main.rb before the first 'require'. Another useful thing is to =20 > run the app from the terminal using 'ktrace': > ok, i see what you mean, before using your script, i've been using =20 one of mine, but really less efficient (the app got around 14 MO, =20 with your script saying 4 MO !) > ktrace ./BookmarksMerge.app/Contents/MacOS/BookmarksMerge > kdump | grep NAMI > files.log > > 'files.log' will show any file accesses made by the application, =20 > which should help to track down where it's looking for 'nkf.bundle'. ok, fine, i'll ask him to do that. it seems the prob is computer dependant because on one computer he =20 had the message previously given and on another the application =20 starts up attempts to convert safari and|or firebox bookmarks to xml =20 and crash when sending the results to NSOutlineView. the latest bugg is more clearer to me (the safari and firefox =20 bookmarks files aren't very well structured then...) best, and thanks a lot ! Yvon |
From: Jonathan P. <jp...@dc...> - 2006-02-23 09:23:56
|
Hi, I looked at the package which seems to be working properly, with dependencies. The ruby runtime is linked into the RubyCocoa framework so it should be completely independent of any ruby on the host system. > he is using this RubyCocoa beta app over standard Apple Ruby, i'm > using the latest build by my own. Could you explain what you mean here a bit more? Is he attempting to run the same version you provided a link to? If he's using a standalone version that you've provided, even though he has only the standard Apple ruby, it will be using the latest build that you used to make the application. For more debugging information, you could add 'p $LOAD_PATH' to rb_main.rb before the first 'require'. Another useful thing is to run the app from the terminal using 'ktrace': ktrace ./BookmarksMerge.app/Contents/MacOS/BookmarksMerge kdump | grep NAMI > files.log 'files.log' will show any file accesses made by the application, which should help to track down where it's looking for 'nkf.bundle'. |
From: Jonathan P. <jp...@dc...> - 2006-02-23 08:49:49
|
On 22 Feb 2006, at 23:56, Tim Burks wrote: > I'd prefer to have the bridge automatically convert "object=" into > "setObject" calls, perhaps as an option. There are two directions to consider here: ObjC calling to Ruby for 'setFoo' to call 'foo='. This is handled by kvc_accessor. Ruby calling 'foo=' on an ObjC object to call 'setFoo'. This isn't handled yet. The latter could be fixed by extending the 'analyze_missing' method in oc_wrapper.rb. Do you think that would be sufficient? |
From: Yvon T. <tho...@fr...> - 2006-02-23 06:54:09
|
Le 23 f=E9vr. 06 =E0 00:19, Jonathan Paisley a =E9crit : > It's strange that 'nkf' fails to load even though it's been =20 > included. Probably a bug in standaloneify. Can you send me a zip of =20= > the original and 'standaloneified' app to investigate? > > here it is : > <http://81.57.96.20/BookmarksMerge-200602221356.dmg.bz2> beware that' supposed to read Safari bookmarks and firefox too, if =20 not would crash after loading for other reasons, but works on my =20 computer. i could package the latest if you want. best, Yvon= |
From: Tim B. <tim...@gm...> - 2006-02-22 23:56:26
|
On Feb 22, 2006, at 12:41 PM, Jonathan Paisley wrote: > On 22 Feb 2006, at 18:16, Tim Burks wrote: > >> * Something needs to be done to resolve the different calling >> conventions used by Ruby attribute setters ("object =") and Cocoa >> KVC setters ("setObject"). > > Have you any ideas for how best to resolve this? I used the hack below to replace "attr_accessor" with "cocoa_accessor". cocoa_accessor creates a "setObject" method instead of "object=". I'd prefer to have the bridge automatically convert "object=" into "setObject" calls, perhaps as an option. Tim module CocoaAccessor module ClassMethods def cocoa_accessor(value_id) iv_name = "@#{value_id}".to_sym define_method(value_id) { self.instance_variable_get (iv_name ) } define_method("set#{value_id.to_s.capitalize}".to_sym) {| x| self.instance_variable_set(iv_name, x) } end end def self.append_features(klass) super klass.extend(ClassMethods) end end class RubySprite include CocoaAccessor cocoa_accessor :position cocoa_accessor :direction cocoa_accessor :velocity cocoa_accessor :radius cocoa_accessor :color |
From: Jonathan P. <jp...@dc...> - 2006-02-22 23:20:09
|
On 22 Feb 2006, at 18:32, Yvon Thoraval wrote: >> /Applications/BookmarksMerge.app/Contents/Frameworks/ >> RubyCocoa.framework/ >> Versions/A/Resources/ruby/osx/objc/cocoa_macros.rb:13:in >> `require': no >> such file to load -- nkf (LoadError) >> from /Applications/BookmarksMerge.app/Contents/Frameworks/ >> RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/ >> cocoa_macros.rb:13 >> from /Applications/BookmarksMerge.app/Contents/Frameworks/ >> RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/cocoa.rb:13 >> from /Applications/BookmarksMerge.app/Contents/Frameworks/ >> RubyCocoa.framework/Versions/A/Resources/ruby/osx/cocoa.rb:11 >> from /Applications/BookmarksMerge.app/Contents/Resources/ >> rb_main.rb:25 > > i've carefully inspected the Contents folder of each app and catch > for any difference : found no differences at all ( apart from what > is specific to the app). > > even i've found the "nkf.bundle" : > -rwx------ 1 yvon yvon 222304 Feb 22 13:56 nkf.bundle It's strange that 'nkf' fails to load even though it's been included. Probably a bug in standaloneify. Can you send me a zip of the original and 'standaloneified' app to investigate? |
From: Neil S. <ne...@ha...> - 2006-02-22 20:53:07
|
Yvon Thoraval wrote: > Hey all, >=20 > i'm using "standaloneify.rb" from Jonathan Paisley >=20 > and, for the last app i'm working on, a user said to the app crashes > with the following message at Cosole log : >=20 >=20 >> /Applications/BookmarksMerge.app/Contents/Frameworks/RubyCocoa.framewo= rk/ >> Versions/A/Resources/ruby/osx/objc/cocoa_macros.rb:13:in `require': no= >> such file to load -- nkf (LoadError) >> from /Applications/BookmarksMerge.app/Contents/Frameworks/ >> RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/cocoa_macros.rb= :13 >> from /Applications/BookmarksMerge.app/Contents/Frameworks/ >> RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/cocoa.rb:13 >> from /Applications/BookmarksMerge.app/Contents/Frameworks/ >> RubyCocoa.framework/Versions/A/Resources/ruby/osx/cocoa.rb:11 >> from >> /Applications/BookmarksMerge.app/Contents/Resources/rb_main.rb:25 If you run into something that standaloneify doesn't pick up on its own, because of runtime-added requires or whatnot, use the -l option to add th= em. So here you want to add -l nkf to your standaloneify call and you should be fine. --=20 Neil Stevens - ne...@ha... "There is nothing patriotic about hating your country, or pretending that you can love your country but despise your government." -- William Jefferson Clinton |
From: Jonathan P. <jp...@dc...> - 2006-02-22 20:41:27
|
On 22 Feb 2006, at 18:16, Tim Burks wrote: > One possible optimization is to replace the Sprite class with a > version written in Objective-C. Ideally, we could just swap in a > new parent class with no changes to its subclasses. But in > practice, I had several problems: > > * The Ruby versions of Sprite and its subclasses must already be > using Objective-C alloc/init construction instead of new. > > * Methods in Ruby subclasses that will be replaced by Objective-C > classes must map to Objective-C message names. This is true - but in RubyCocoa you never need the trailing underscore in method names. You do need it, however, when calling ns_overrides. > * Something needs to be done to resolve the different calling > conventions used by Ruby attribute setters ("object =") and Cocoa > KVC setters ("setObject"). Have you any ideas for how best to resolve this? > * When a Ruby subclass overrides an Objective-C class method, an > "ns_overrides" declaration seems to be necessary. But if the > parent class is switched back to Ruby (for debugging or testing), > that "ns_overrides" is a fatal error. Good point. I'm hoping it might be possible to do away with ns_overrides altogether... > Surprisingly, I found that replacing the Ruby Sprite class with an > Objective-C version didn't speed up my game; in fact it seemed to > slow it down a bit. The reason for this was that the new version > was making more calls across the bridge, and calls across the > bridge are much more expensive than code implemented in Ruby or > calls to standard Ruby C extensions. I made some crude > measurements and estimated that the best I could hope for was a few > thousand bridge crossings per second. That's plenty for a typical > Cocoa app, but not enough for an arcade game that uses RubyCocoa to > draw and manage objects. So I switched back to my Ruby Sprite > class and rewrote my object drawing functions as standard Ruby C > extensions. After that I had only 2-3 bridge crossings per frame > and the game was snappy again, even with the brute-force Ruby > collision detection that I had worried about initially. I think the drawing is probably one of the slowest things. Have you tried getting a profile using Shark? I looked briefly and noticed that NSWindow clears the window as well as the draw method in Game. Together these took up about 20% of CPU time. Turning off anti- aliasing would speed things up too. Or using OpenGL! :) I would hope that using plain ruby Sprite objects and trying to keep as much as possible in Ruby-land (e.g., only calling ObjC for the drawing) should give reasonable performance. I agree that bridge crossings are expensive. Cheers, Jonathan |
From: Yvon T. <tho...@fr...> - 2006-02-22 18:52:06
|
Hey all, i'm using "standaloneify.rb" from Jonathan Paisley and, for the last app i'm working on, a user said to the app crashes with the following message at Cosole log : > /Applications/BookmarksMerge.app/Contents/Frameworks/ > RubyCocoa.framework/ > Versions/A/Resources/ruby/osx/objc/cocoa_macros.rb:13:in `require': no > such file to load -- nkf (LoadError) > from /Applications/BookmarksMerge.app/Contents/Frameworks/ > RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/ > cocoa_macros.rb:13 > from /Applications/BookmarksMerge.app/Contents/Frameworks/ > RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/cocoa.rb:13 > from /Applications/BookmarksMerge.app/Contents/Frameworks/ > RubyCocoa.framework/Versions/A/Resources/ruby/osx/cocoa.rb:11 > from /Applications/BookmarksMerge.app/Contents/Resources/ > rb_main.rb:25 he is using this RubyCocoa beta app over standard Apple Ruby, i'm using the latest build by my own. the dependencies are : require 'osx/cocoa' require 'osx/aeosa' require 'iconv' require 'date' require 'yaml' require 'xml/xslt' require 'rexml/document' written directly into "rb_main.rb" it's surprising to me because i've used "standaloneify.rb" for another RubyCocoa app having the same dependencies as listed above. i've carefully inspected the Contents folder of each app and catch for any difference : found no differences at all ( apart from what is specific to the app). even i've found the "nkf.bundle" : ./lib: total 2592 drwxr-xr-x 10 yvon yvon 340 Feb 22 13:56 . drwxr-xr-x 9 yvon yvon 306 Feb 22 13:56 .. -rwx------ 1 yvon yvon 9992 Feb 22 13:56 fcntl.bundle -rwx------ 1 yvon yvon 33204 Feb 22 13:56 iconv.bundle -rwx------ 1 yvon yvon 222304 Feb 22 13:56 nkf.bundle -rwx------ 1 yvon yvon 681728 Feb 22 13:56 openssl.bundle -rwx------ 1 yvon yvon 50484 Feb 22 13:56 osx_aeosa.bundle -rwx------ 1 yvon yvon 37904 Feb 22 13:56 stringio.bundle -rwx------ 1 yvon yvon 272464 Feb 22 13:56 syck.bundle drwxr-xr-x 3 yvon yvon 102 Feb 22 13:56 xml ./lib/xml: total 152 drwxr-xr-x 3 yvon yvon 102 Feb 22 13:56 . drwxr-xr-x 10 yvon yvon 340 Feb 22 13:56 .. -rwx------ 1 yvon yvon 76972 Feb 22 13:56 xslt.bundle same perms, same sizes in each case. The only major difference in my code it's in that i'm using a proxy class (advice from onathan Paisley). what could i ask to the user in order to go ahead ? obviously, my app is working as standalone on my computer. here is my ruby setup : > ruby --version ruby 1.8.4 (2005-12-24) [powerpc-darwin8.4.0] being in : > which ruby /usr/local/bin/ruby best, Yvon |
From: Jonathan P. <jp...@dc...> - 2006-02-22 18:29:57
|
On 22 Feb 2006, at 18:16, Tim Burks wrote: > p.s. You suggested the following procedure for setting the Document > class: > > > Rather than editing the pbxproj file manually: > > Targets inspector -> rubyrocks -> Info.plist Entries -> > Document Types -> Document Class > > Have you verified this? If you can do this for the rubyrocks > project, would you please send me a screenshot? I may be missing > something obvious; it's not working for me. I know that it's > possible for Cocoa Document-based apps, but the RubyCocoa project > template seems to be different. When I look at the rubyrocks > target with the inspector, I only see two tabs: "General" and > "Comments". I don't see how I could use either to modify the > Info.plist file. I'm using Xcode 2.2.1. Thanks! I used the method while working through the beginning of the tutorial, since I refused to edit the project file :) I've included a screenshot of the target inspector I have below. Don't inspect the target - double click on it (I've no idea how to get to this otherwise). The RubyCocoa template projects are old-style Xcode projects. If you do 'Project -> Upgrade to Native Target' you can then edit the document class in the Properties tab of the inspector. Cheers, Jonathan |
From: Tim B. <tim...@gm...> - 2006-02-22 18:16:16
|
Jonathan, Thanks for your comments. My example was extracted from a more complex game project that I've been using to investigate RubyCocoa. I like using the document-based architecture because it lets me log game events and easily save and restore them for game replays, which are great for demos, debugging, and performance analysis. My "advanced" version of the game supports two players and subdivides rocks (large rocks break into two medium-sized rocks, medium-sized rocks break into two small rocks, which then can be destroyed). The result is that there are a lot more objects flying around, which starts to slow down the game (even when I disable collision detection, which is an obvious potential bottleneck). One possible optimization is to replace the Sprite class with a version written in Objective-C. Ideally, we could just swap in a new parent class with no changes to its subclasses. But in practice, I had several problems: * The Ruby versions of Sprite and its subclasses must already be using Objective-C alloc/init construction instead of new. * Methods in Ruby subclasses that will be replaced by Objective-C classes must map to Objective-C message names. * Something needs to be done to resolve the different calling conventions used by Ruby attribute setters ("object =") and Cocoa KVC setters ("setObject"). * When a Ruby subclass overrides an Objective-C class method, an "ns_overrides" declaration seems to be necessary. But if the parent class is switched back to Ruby (for debugging or testing), that "ns_overrides" is a fatal error. Surprisingly, I found that replacing the Ruby Sprite class with an Objective-C version didn't speed up my game; in fact it seemed to slow it down a bit. The reason for this was that the new version was making more calls across the bridge, and calls across the bridge are much more expensive than code implemented in Ruby or calls to standard Ruby C extensions. I made some crude measurements and estimated that the best I could hope for was a few thousand bridge crossings per second. That's plenty for a typical Cocoa app, but not enough for an arcade game that uses RubyCocoa to draw and manage objects. So I switched back to my Ruby Sprite class and rewrote my object drawing functions as standard Ruby C extensions. After that I had only 2-3 bridge crossings per frame and the game was snappy again, even with the brute-force Ruby collision detection that I had worried about initially. So to conclude, I found RubyCocoa to be great for prototyping, designing, and testing. I used code that I had written in Ruby to guide C and Objective-C rewrites. If I take this project further, I expect that I will rewrite more of the game objects and their management in Objective-C and use Ruby for testing, top-level game control, and user input handling. Tim p.s. You suggested the following procedure for setting the Document class: > Rather than editing the pbxproj file manually: > Targets inspector -> rubyrocks -> Info.plist Entries -> Document Types -> Document Class Have you verified this? If you can do this for the rubyrocks project, would you please send me a screenshot? I may be missing something obvious; it's not working for me. I know that it's possible for Cocoa Document-based apps, but the RubyCocoa project template seems to be different. When I look at the rubyrocks target with the inspector, I only see two tabs: "General" and "Comments". I don't see how I could use either to modify the Info.plist file. I'm using Xcode 2.2.1. Thanks! On Feb 22, 2006, at 2:36 AM, Jonathan Paisley wrote: > > On 22 Feb 2006, at 7:23, Tim Burks wrote: > >> This evening I spoke to the San Francisco Ruby Meetup group about >> RubyCocoa. I thought it would be fun to describe RubyCocoa with >> an example, so I presented a simple arcade-style game written in >> Ruby that uses RubyCocoa to draw and handle user events. I also >> wrote it up as a tutorial and put it online here: http:// >> www.rubycocoa.com/ruby-rocks. > > Great stuff! > > A few comments on the tutorial: > > Probably worth mentioning up front that a game wouldn't normally be > a document-based application (and say at the end what would be > different to use a non-document application template). > > Rather than editing the pbxproj file manually: > Targets inspector -> rubyrocks -> Info.plist Entries -> Document > Types -> Document Class > > I couldn't see any instructions for binding GameView.game to the > Game instance (File's Owner) in Interface Builder. > > The instructions for adding the 'game' outlet aren't as detailed as > the result of the instructions in Interface Builder. > > You can just use [a,b,c,d] instead of OSX::NSRect.new(a,b,c,d) > (similarly for NSPoint), unless you want to hang on to the object > and use .x, .y etc. > > The moveWithBounds_ and initWithPosition_ methods etc don't need a > trailing underscore. > > The model objects (Sprite and descendents) can be plain Ruby > objects rather than NSObject descendents. This means you can use a > normal ruby initialize method (instead of .alloc.initWith...). > > Cheers, > Jonathan > > > |
From: Tim B. <tim...@gm...> - 2006-02-22 18:13:55
|
Hi Phil, I'm using a slightly customized version of Tobias L=FCtke's hieraki-0.5. (hieraki-0.5 is available here: http://dist.leetsoft.com/pkg) I added a sitemap and permalinks but haven't released my changes, =20 because the hieraki project has gone through some significant =20 revisions since 0.5. More recent versions contain a lot of =20 improvements for authors, but I felt that 0.5's simpler interface was =20= more intuitive for my readers. Tim On Feb 22, 2006, at 12:24 AM, Phil Tomson wrote: > > > On Tue, 21 Feb 2006, Tim Burks wrote: > >> >> This evening I spoke to the San Francisco Ruby Meetup group about >> RubyCocoa. I thought it would be fun to describe RubyCocoa with an >> example, so I presented a simple arcade-style game written in Ruby >> that uses RubyCocoa to draw and handle user events. I also wrote it >> up as a tutorial and put it online here: http://www.rubycocoa.com/ >> ruby-rocks. >> >> Tim >> > > This is cool! thanks for putting it together. > > BTW: how did you generate the webpages? Did you use hieraki? > > Phil > |
From: Yvon T. <tho...@fr...> - 2006-02-22 15:16:31
|
Le 22 f=E9vr. 06 =E0 14:02, kimura wataru a =E9crit : > I think it is an easy way to use thread. i've tried that, however this doesn't correspond to my needs, =20 because, with thread, we might launch asynchronously any action from =20 each other, which is not what i want. best, Yvon= |
From: Yvon T. <tho...@fr...> - 2006-02-22 13:16:45
|
Le 22 f=E9vr. 06 =E0 13:52, Jonathan Paisley a =E9crit : > > Hehe - it's calling the ruby method 'display'. Try 'oc_display' =20 > instead. This bypasses any ruby methods defined. #oc_display works fine. however, something surprising to me is when a button is disabled, it =20 still memorizes click on it, only the view is changing. that's Cocoa design :[ (i never had such behaviour with Java-Swing...) > >> then i went to "discardEventsMatchingMask:beforeEvent:" and =20 >> applied to a NSWindow as a receiver : >> >> @mainWindow.discardEventsMatchingMask_beforeEvent=20 >> (OSX::NSAnyEventMask, OSX::NSKeyUpMask) > > Ah, I realise now that discartEvents... won't work here. > > Instead look at "- (NSEvent *)nextEventMatchingMask:(unsigned int)=20 > mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:=20= > (BOOL)flag" and call it repeatedly with dequeue:YES and try =20 > different values for untilDate: NSDate.date, NSDate.distantFuture =20 > or NSData.distantPast. Stop calling it when it returns no events. > ok, i need to investigate further on that point. Yvon |
From: kimura wataru<ki...@us...> - 2006-02-22 13:02:55
|
Hi, I think it is an easy way to use thread. But we have a bug report ruby's thread on RubyCocoa sometimes crashes. def loadDroite(sender) disableAllButtons ####### here i disable all buttons Thread.new { loadXmlDroite("firefox.xml", "Barre personnelle") @xmlDroite="firefox.xml" @labelDroite.setStringValue "Firefox" enableAllButtons ####### here i re-enable all buttons } end Wed, Feb 22, 2006 11:58:41 AM, Yvon Thoraval wrote: > def loadDroite(sender) > disableAllButtons ####### here i disable all >buttons > loadXmlDroite("firefox.xml", "Barre personnelle") > @xmlDroite="firefox.xml" > @labelDroite.setStringValue "Firefox" > enableAllButtons ####### here i re-enable >all buttons > end > >i do the "same" (isableAllButtons [...] enableAllButtons) for all the >actions corresponding to all the buttons. > -- kimura wataru |
From: Jonathan P. <jp...@dc...> - 2006-02-22 12:52:36
|
> with #display i get only that in the XCode's Run log : > > [Session started at 2006-02-22 13:13:49 +0100.] > <NSButton: 0x69d0f0><NSButton: 0x4b3210><NSButton: > 0x4bba30><NSButton: 0x6dfc70><NSButton: 0x689400><NSButton: > 0x4b47a0><NSButton: 0x6899e0><NSButton: 0x6e5080> > BookmarksMerge has exited with status 0. Hehe - it's calling the ruby method 'display'. Try 'oc_display' instead. This bypasses any ruby methods defined. > then i went to "discardEventsMatchingMask:beforeEvent:" and applied > to a NSWindow as a receiver : > > @mainWindow.discardEventsMatchingMask_beforeEvent > (OSX::NSAnyEventMask, OSX::NSKeyUpMask) Ah, I realise now that discartEvents... won't work here. Instead look at "- (NSEvent *)nextEventMatchingMask:(unsigned int) mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue: (BOOL)flag" and call it repeatedly with dequeue:YES and try different values for untilDate: NSDate.date, NSDate.distantFuture or NSData.distantPast. Stop calling it when it returns no events. |
From: Yvon T. <tho...@fr...> - 2006-02-22 12:20:16
|
Le 22 f=E9vr. 06 =E0 12:17, Jonathan Paisley a =E9crit : > I think the problem is that the visible 'disabled' state only =20 > updates when the event loop runs again. During your long-running =20 > method, the Cocoa event loop never gets a chance to run. Therefore, =20= > any clicks are queued and get processed later -- by which point the =20= > buttons have been enabled again. > ok, i understand. > You could try disabling the buttons, explicitly redrawing them by =20 > calling 'display'. You could clear any button clicks from the event =20= > queue with 'discardEventsMatchingMask:beforeEvent:'. > display (eventually after a "setNeedsDisplay true" ) doesn't change =20 anything : def disableAllButtons @buttons.each { |b| b.setEnabled(false) #b.setNeedsDisplay true b.display } sleep 1 end sleep 1 doesn't help too with #display i get only that in the XCode's Run log : [Session started at 2006-02-22 13:13:49 +0100.] <NSButton: 0x69d0f0><NSButton: 0x4b3210><NSButton: =20 0x4bba30><NSButton: 0x6dfc70><NSButton: 0x689400><NSButton: =20 0x4b47a0><NSButton: 0x6899e0><NSButton: 0x6e5080> BookmarksMerge has exited with status 0. may be one drastic solution coud be using #setHidden true gaves no =20 change too... then i went to "discardEventsMatchingMask:beforeEvent:" and applied =20 to a NSWindow as a receiver : @mainWindow.discardEventsMatchingMask_beforeEvent=20 (OSX::NSAnyEventMask, OSX::NSKeyUpMask) here i got this error in the XCode's Run log : [Session started at 2006-02-22 13:13:18 +0100.] 2006-02-22 13:13:24.417 BookmarksMerge[22686] *** -[NSDecimalNumber =20 _cgsEventTime]: selector not recognized [self =3D 0x4bb0af0] /Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/=20= objc/oc_wrapper.rb:17:in `NSApplicationMain': NSApplicationMain - =20 NSInvalidArgumentException - *** -[NSDecimalNumber _cgsEventTime]: =20 selector not recognized [self =3D 0x4bb0af0] (OSX::OCException) from = /Users/yvon/work/RubyCocoa/BookmarksMerge/build/Development/=20 BookmarksMerge.app/Contents/Resources/rb_main.rb:46 BookmarksMerge has exited with status 1. i've followed what's written in the Cocoa browser... ? Yvon |
From: Jonathan P. <jp...@dc...> - 2006-02-22 11:17:37
|
On 22 Feb 2006, at 10:58, Yvon Thoraval wrote: > the appearance of the buttons doesn't change and also if, when an > action isn't terminated (that's to say between disableAllButtons > and enableAllButtons) the click is memorized and, when the action > is finished the process enters a new action corresponding to the > new button pressed. > > if, in between disableAllButtons and enableAllButtons, i press two > times a button and another one afterwards, all the click on all the > different buttons and the corresponding actions are undertaken each > after each... > > i'd like to avoid that : no memorization when an action is undertaken. > I think the problem is that the visible 'disabled' state only updates when the event loop runs again. During your long-running method, the Cocoa event loop never gets a chance to run. Therefore, any clicks are queued and get processed later -- by which point the buttons have been enabled again. You could try disabling the buttons, explicitly redrawing them by calling 'display'. You could clear any button clicks from the event queue with 'discardEventsMatchingMask:beforeEvent:'. |
From: Yvon T. <tho...@fr...> - 2006-02-22 10:59:51
|
Le 22 f=E9vr. 06 =E0 11:37, Jonathan Paisley a =E9crit : > > I'm afraid I'm not sure what's going on here. More complete code =20 > would be helpful to understand how things are put together. > ok, in Interface Builder all the NSButtons enabled ckeckboxes are set =20= to false. then in Controller.rb i do : def awakeFromNib loadXmlGauche("safari.xml", "BookmarksBar") loadXmlDroite("firefox.xml", "Barre personnelle") @xmlGauche=3D"safari.xml" @xmlDroite=3D"firefox.xml" @labelGauche.setStringValue "Safari" @labelDroite.setStringValue "Firefox" @buttons =3D [@nonVideButtonGauche, @uniqueButtonGauche, =20 @fusionButtonGauche, @loadButtonGauche, @nonVideButtonDroite, =20 @uniqueButtonDroite, @fusionButtonDroite, @loadButtonDroite] enableAllButtons ####### here i enable all =20 buttons end =09 def windowDidBecomeMain(sender) p "windowDidBecomeMain(sender)" end def enableAllButtons #@nonVideButtonGauche.setHidden true #@nonVideButtonGauche.setNeedsDisplay true @buttons.each { |b| b.setEnabled(true)} end def disableAllButtons #@nonVideButtonGauche.setNeedsDisplay true @buttons.each { |b| b.setEnabled(false)} end after awakeFromNib all the NSButtons are enabled, that' right. when someone press one of the buttons, saying =20 "Load" (@loadButtonDroite) i do : def loadDroite(sender) disableAllButtons ####### here i disable all =20= buttons loadXmlDroite("firefox.xml", "Barre personnelle") @xmlDroite=3D"firefox.xml" @labelDroite.setStringValue "Firefox" enableAllButtons ####### here i re-enable =20 all buttons end i do the "same" (isableAllButtons [...] enableAllButtons) for all the =20= actions corresponding to all the buttons. the appearance of the buttons doesn't change and also if, when an =20 action isn't terminated (that's to say between disableAllButtons and =20 enableAllButtons) the click is memorized and, when the action is =20 finished the process enters a new action corresponding to the new =20 button pressed. if, in between disableAllButtons and enableAllButtons, i press two =20 times a button and another one afterwards, all the click on all the =20 different buttons and the corresponding actions are undertaken each =20 after each... i'd like to avoid that : no memorization when an action is undertaken. best, Yvon= |