Re: [MacRuby-devel] [MacRuby] #193: exec() does not work on MacRuby
#193: exec() does not work on MacRuby
+---
Reporter: vincent.isamb...@… | Owner: lsansone...@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby |Keywords:
+---
Comment(by kou...@…):
Interestingly, the backtick syntax works:
{{{
~$ macirb
>> `ls Applications`
=> "CrossOver¥n"
>>
}}}
--
Ticket URL:
MacRuby
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] [MacRuby] #241: NSMutableSet#merge fails
#241: NSMutableSet#merge fails
--+-
Reporter: kou...@… | Owner: lsansone...@…
Type: defect| Status: new
Priority: major | Milestone: MacRuby 0.4
Component: MacRuby |Keywords:
--+-
NSMutableSet#merge succeeds if called with another NSMutableSet, but it
fails when passed an Enumerable, such as NSMutableArray.
{{{
~ kourge$ irb
>> s = Set[1, 2]
NameError: uninitialized constant Set
from (irb):1
>> require 'set'
=> true
>> s = Set[1, 2]
=> #
>> s.merge [3, 4]
=> #
>> quit
~ kourge$ macirb
>> s = Set[1, 2]
=> #
>> s.merge [3, 4]
2009-03-30 23:54:03.319 macruby[233:10b] *** -[NSCFArray
_applyValues:context:]: unrecognized selector sent to instance 0x80047cd80
2009-03-30 23:54:03.365 macruby[233:10b] *** Terminating app due to
uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray
_applyValues:context:]: unrecognized selector sent to instance
0x80047cd80'
2009-03-30 23:54:03.366 macruby[233:10b] Stack: (
140735351352508,
140735358957775,
140735351379451,
140735351372932,
140735351373272,
4295759037,
4296060391,
4296017807,
4296038178,
4296040810,
4296042845,
4296060391,
4296017807,
4296038178,
4296074114,
4295152255,
4295972133,
4296060391,
4296017807,
4296038178,
4296066197,
4296060391,
4296017807,
4296038178,
4296066197,
4296060391,
4296017807,
4296038178,
4296038828,
4295151426,
4295164679,
4294971167,
4294971044
)
terminate called after throwing an instance of 'NSException'
Abort trap
~ kourge$
}}}
--
Ticket URL:
MacRuby
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Can any kind macruby experts help me get sqlite3 gem working with macruby--please?
Can any kind macruby experts help me get sqlite3 gem working with macruby?
sqlite3-ruby-1.2.4 ruby gem works in ruby 1.9.0. So I think it should work
in macruby also...
>From macirb I added the path to the gem:
$: << "path/to/the/sqlite3-ruby-1.2.4/lib"
require 'sqlite3.rb' # => true
$db = SQLite3::Database.new("/path/to/x.db.rsd")
RuntimeError: *no driver for sqlite3 found*
the error comes from the load_driver method near line 621 of the
sqlite3/database.rb file.
def load_driver( driver )
case driver
when Class
# do nothing--use what was given
when Symbol, String
require "sqlite3/driver/#{driver.to_s.downcase}/driver"
driver = SQLite3::Driver.const_get( driver )::Driver
else
[ "Native", "DL" ].each do |d|
begin
require "sqlite3/driver/#{d.downcase}/driver"
driver = SQLite3::Driver.const_get( d )::Driver
break
rescue SyntaxError
raise
rescue ScriptError, Exception, NameError
end
end
raise "no driver for sqlite3 found" unless driver
end
@driver = driver.new
end
private :load_driver
Macruby enters the method with driver set to NSNull, and the driver fails to
load. In ruby (1.9.0) the driver loads via the Native driver.
irb19 session:
>> db = SQLite3::Database.new("/Users/Tim/Desktop/newdb")
=> #,
@statement_factory=SQLite3::Statement,
@handle=#, @closed=false,
@results_as_hash=false, @type_translation=false, @translator=nil,
@transaction_active=false>
Can anyone offer an idea about how they might try to patch this to work with
macruby? I know an alternative would be CoreData--but it is too cumbersome
for me.
Thanks,
Tim
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Can any kind macruby experts help me get sqlite3 gem working with macruby--please?
the sqlite3 gem uses a native C extension which needs to compiled for your
system. (usually done when installed via rubygems)
The installation will fail if you use macgem, probably due to some IO issues
and the lack of support of C extension.
Someone should look into writing a wrapper for macruby using an obj-c
driver. That can't be that hard and that would be very useful. I've been
thinking about porting the DataObject and the DO SQlite3 driver to MacRuby
but I didn't have time yet (and I didn't really need it either). DataObject
is the uniform API used by DataMapper to talk to its drivers.
If someone is interested in working on that, I can put him/her in contact
with the DM team.
- Matt
2009/3/31 Tim Rand
> Can any kind macruby experts help me get sqlite3 gem working with macruby?
>
> sqlite3-ruby-1.2.4 ruby gem works in ruby 1.9.0. So I think it should work
> in macruby also...
> From macirb I added the path to the gem:
>
> $: << "path/to/the/sqlite3-ruby-1.2.4/lib"
>
> require 'sqlite3.rb' # => true
>
> $db = SQLite3::Database.new("/path/to/x.db.rsd")
>
> RuntimeError: *no driver for sqlite3 found*
> the error comes from the load_driver method near line 621 of the
> sqlite3/database.rb file.
>
>def load_driver( driver )
> case driver
> when Class
> # do nothing--use what was given
> when Symbol, String
> require "sqlite3/driver/#{driver.to_s.downcase}/driver"
> driver = SQLite3::Driver.const_get( driver )::Driver
> else
> [ "Native", "DL" ].each do |d|
> begin
> require "sqlite3/driver/#{d.downcase}/driver"
> driver = SQLite3::Driver.const_get( d )::Driver
> break
> rescue SyntaxError
> raise
> rescue ScriptError, Exception, NameError
> end
> end
> raise "no driver for sqlite3 found" unless driver
> end
>
> @driver = driver.new
> end
> private :load_driver
>
> Macruby enters the method with driver set to NSNull, and the driver fails
> to load. In ruby (1.9.0) the driver loads via the Native driver.
>
> irb19 session:
> >> db = SQLite3::Database.new("/Users/Tim/Desktop/newdb")
> => # @driver=# @authorizer={}, @busy_handler={}, @trace={}>,
> @statement_factory=SQLite3::Statement,
> @handle=#, @closed=false,
> @results_as_hash=false, @type_translation=false, @translator=nil,
> @transaction_active=false>
>
> Can anyone offer an idea about how they might try to patch this to work
> with macruby? I know an alternative would be CoreData--but it is too
> cumbersome for me.
> Thanks,
> Tim
>
> ___
> 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] macruby and sqlite3 gem
> Macruby enters the method with driver set to NSNull, and the driver fails
>> to load. In ruby (1.9.0) the driver loads via the Native driver.
>>
>> irb19 session:
>> >> db = SQLite3::Database.new("/Users/Tim/Desktop/newdb")
>> => #> @driver=#> @authorizer={}, @busy_handler={}, @trace={}>,
>> @statement_factory=SQLite3::Statement,
>> @handle=#, @closed=false,
>> @results_as_hash=false, @type_translation=false, @translator=nil,
>> @transaction_active=false>
>>
>> Can anyone offer an idea about how they might try to patch this to work
>> with macruby? I know an alternative would be CoreData--but it is too
>> cumbersome for me.
>> Thanks,
>> Tim
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
> -- next part --
> An HTML attachment was scrubbed...
> URL:
> <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090331/83530eaa/attachment-0001.html>
>
> --
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
> End of MacRuby-devel Digest, Vol 13, Issue 47
> *
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] macruby and sqlite3 gem
ll, and the
driver fails
to load. In ruby (1.9.0) the driver loads via the Native driver.
irb19 session:
db = SQLite3::Database.new("/Users/Tim/Desktop/newdb")
=> #@driver=#@callback_data={},
@authorizer={}, @busy_handler={}, @trace={}>,
@statement_factory=SQLite3::Statement,
@handle=#, @closed=false,
@results_as_hash=false, @type_translation=false, @translator=nil,
@transaction_active=false>
Can anyone offer an idea about how they might try to patch this to
work
with macruby? I know an alternative would be CoreData--but it is
too
cumbersome for me.
Thanks,
Tim
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-- next part --
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090331/83530eaa/attachment-0001.html
>
--
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
End of MacRuby-devel Digest, Vol 13, Issue 47
*
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
smime.p7s
Description: S/MIME cryptographic signature
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Macruby.framwork into Bundle
Hello List, I used the tutorial and tried to put the Macruby.framework into my Bundle. The executable already contains the right "path" to the framework and I copied the Run Script from "Embeded Mac Ruby Target" to my regular target, so the framework is in the bundle. (Why is this an extra target at all ? No criticism, just curiosity :-) ) If I do this thing with a virgin application, the application starts on a mac without macruby installed, but if I use my learnig project "http://github.com/polarix/iterm-auto-bookmark/tree/master ", the applications starts and quit immediately, without any error. BTW If somthing went wrong, on a call to a method (ruby or object-c object) you alway get a "NoMethodError" even if the method exists. The same thing applies to RubyCocoa. See http://discussions.apple.com/thread.jspa? threadID=1957372&tstart=60 if you like. :-D with kind regards Markus smime.p7s Description: S/MIME cryptographic signature ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] [hotcocoa] http wrapper, what do you think?
Here is the file: http://github.com/mattetti/macruby-httpwrapper/tree/master I noticed I gave you some wrong info, currently the delegator doesn't receive all delegated messages. Instead it gets called with a custom method and the response gets passed to it. This currently only happens when the download is successful http://github.com/mattetti/macruby-httpwrapper/blob/93230af840d1cdc5124f36397c289a993d6dd164/macruby_http.rb#L222 That's something we probably should fix. I tried to make the delegation process easier than what obj-c does but maybe we need to support a more advanced mode. Anyways, I added Brian to the repo and I hope to a see a fully finished version when I come back from vacation ;) - Matt p.s: adding tests would be totally awesome, I'm just not sure how to address that yet. On Mon, Mar 30, 2009 at 4:36 PM, Brian Chapados wrote: > 2009/3/30 Matt Aimonetti : > >> Does the delegate object also receive messages that would be sent to an > >> NSURLDownload? > > > > I'm actually using NSURLConnection and not NSURLDownload which seemed a > bit > > too simple when I looked at it. If the delegator is a proc, then it > > currently only gets called once the request finished properly. (I still > need > > to write the error handling etc...) > > If your delegator is an object or a class, all messages should be passed > > directly. > > Right... NSURLConnection is more flexible. > > >> Also, regarding multi-threading, couldn't you just use NSURLDownload > >> (which you're probably already using underneath) + > >> NSOperation/NSOperationQueue. > > > > I need to look into NSOperation/NSOperationQueue to see how it works, I'm > > still pretty new to Cocoa and I don't know all the tricks cool kids use > ;) > > The libraries are vast, and the NSOperation stuff is new in 10.5, so > there aren't as many examples floating around the net. > Just throwing it out there as a possibility. I'm not sure how hard it > would be to implement. I've only used NSOperation for really simple > stuff. > > > I'll do what Ernie and put what I have so far on GitHub and let people > hack > > on it until we have something nice that could be used in most use cases. > > Since I'm going on vacation, I'll add you (Brian) to my repo so you can > deal > > with pull requests and push your own stuff there ;) > > So, you are assigning me as the delegate? ;-) > > > Reharding using the class outside of HotCocoa, I agree, but you should be > > able to only require the file and include the module. What do you think? > > Yes, that makes sense. It sounds like you've got a good start. I > agree with your goal of just making the standard use cases easy. It is > nice to have a block right next to the download call, as it is easy to > understand the logic. If something requires more complicated > handling, then delegate option is always available. Anyway, I'll see > if I can make any progress on NSOperation and error-handling. > > Brian > > > > > On Mon, Mar 30, 2009 at 2:46 PM, Brian Chapados > wrote: > >> > >> Seems like a good idea that would be useful even outside of HotCocoa. > >> Especially for simple cases, I think if Obj-C had blocks, this would > >> be a good place to use them. For more control, the delegate pattern > >> actually works really well. It's good that you have a way to do both. > >> Does the delegate object also receive messages that would be sent to > >> an NSURLDownload? That might be a nice way to allow easy integration > >> in cases where an object that responds to the delegate methods is > >> defined in Obj-C. > >> > >> Also, regarding multi-threading, couldn't you just use NSURLDownload > >> (which you're probably already using underneath) + > >> NSOperation/NSOperationQueue. Since your #download method already > >> wraps the underlying process, you could should able to generate > >> NSOperations to perform the downloads and add them to a queue. Those > >> classes handle creating threads (which have their own runloops) and > >> performing a task on the thread. That said, maybe this approach would > >> not work with the current IO implementation? > >> > >> Brian > >> > >> 2009/3/30 Matt Aimonetti : > >> > In my free time, I've been working on a http://lighthouseapp.comclient > >> > app > >> > which mixes API calls with webkit views (I'll release the source code > >> > later > >> > on). > >> > The app is 100% HotCocoa (meaning that I didn't use any nib/xibs). > >> > For people who are not used to work with delegation, having to deal > with > >> > file download, URL queries can be a bit challenging if you want to > start > >> > using the underlying obj-c methods. > >> > > >> > That's why I wrote a small HTTP wrapper to clean up my code and make > >> > download/queries easier. > >> > The library is divided in 2 major parts, a helper and the > Query/Response > >> > classes. > >> > > >> > Here is how the helper looks like so far: > >> > > >> > Download helper making file download trivial > >> > Pass an url, and a bloc
Re: [MacRuby-devel] Accessing bytes within NSData
On 25/03/2009, at 6:03 AM, Brian Chapados wrote:
Since you have an NSData object, you should be able to convert it to a
String (NSString) and then use unpack. For example:
socket_port = NSSocketPort.alloc.initWithTCPPort(1)
addr = socket_port.address
addr_str = NSString.alloc.initWithData(addr,
encoding:NSString.defaultCStringEncoding)
port = addr_str.unpack("nn")[1] # seems to work - not sure what
this should be
Thanks, Brian. That was just the ticket. Not sure why I didn't think
of it!
- Pete
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] macruby and sqlite3 gem
Hi Jordon, Thanks for the idea. I tried it (arch -arch i386 macirb), but get the same error. Tim Jordon suggested: "does not contain a version for the current architecture" sounds like a 32-bit vs. 64-bit problem to me. MacRuby 0.4 has both i386 and x86_64 archs for macruby and macirb, on a capable system it will pick the x86_64 arch first, which means any frameworks you load while running that arch need to have x86_64 in their Framework/library/bundle as well. What happens if you try running with something like `arch -arch i386 macruby` or `arch -arch i386 macirb` instead? ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
