Hi Bob,
If at all possible I'd try and avoid the conversion. If this is not feasible,
this could help:
def posix_from_hfs(hfs)
url = CFURLCreateWithFileSystemPath(nil, hfs, KCFURLHFSPathStyle, false) #
final argument is whether the path is a directory or not
url.path
end
def hfs_from_po
ut for now I just wanted to let you know that there are specs for
> Ruby 1.9's fibers in the MacRuby repo at 'spec/frozen/library/fiber'. It
> would be interesting to see how many of them pass with your implementation.
>
> Cheers,
>
> Josh
> On Thursday, Ja
uld use variable $array or @array instead of array.
>
>
> Thanks,
>
> 2012/1/13 Alan Skipp :
>> I've been continuing with my efforts to implement Fibers using GCD and in
>> the process I think I may have uncovered a Macruby bug - though perhaps it's
>>
I've been continuing with my efforts to implement Fibers using GCD and in the
process I think I may have uncovered a Macruby bug - though perhaps it's a bug
in my code? Is there anything fundamentally wrong with the code posted below?
It consistently results in a EXC_BAD_ACCESS error.
Cheers,
A
Hi everyone,
I've had a go at implementing Fibers using dispatch queues. The code can be
found here:
https://gist.github.com/1565393
Inspiration was taken from the following ruby 1.8 Fibers implementation:
https://gist.github.com/4631
The implementation of Fiber.yield currently relies upon a h
I'm glad things are now working as expected. My young cousins should be
entertained by it during the Xmas holiday – I'll have to look for some extra
disguises; Samuel L. Jackson would certainly be good, though Peppa Pig might be
more appropriate.
Thanks to Matt, Pavlos and Sean – definitely a g
On 16 Dec 2011, at 15:17, Stephen Horne wrote:
> This code works, but it takes 15+ seconds to set up the link to InDesign
> (similar stuff with safari takes about 1 second, and in applescript or
> rb-appscript it takes about a tenth of a second for either InDesign or
> safari).
>
> I also tri
The version below supports 640x480 and 1280x720 resolutions.
https://gist.github.com/1501766
I've also added support for multiple live video Santas.
I'm not keen on my use of class variables to store images, but it was the only
way I could think of to prevent repeatedly downloading the same ima
either.
>
> -m
> Sent from my iPhone
>
> On Dec 19, 2011, at 12:34, Alan Skipp wrote:
>
>> Hmm… curious.
>> The positioning code could certainly do with some refinement, but from my
>> testing it's close enough for rock 'n' roll, as they s
initialising the AVCaptureSession).
session.sessionPreset = AVCaptureSessionPreset640x480
Al
On 19 Dec 2011, at 15:58, Pavlos Vinieratos wrote:
> this is what i mean.
> http://dl.dropbox.com/u/349788/Screen%20Shot%202011-12-19%20at%2017.56.35.JPG
>
> On Mon, Dec 19, 2011 at 5:34 PM, Alan
nfused also…
Al
On 19 Dec 2011, at 14:56, Pavlos Vinieratos wrote:
> the mustache is off even in your original gist. am i right? or is this some
> kind of weird setup where its works on your mac and not on mine..
>
> On Mon, Dec 19, 2011 at 4:22 PM, Alan Skipp wrote:
> Hi,
>
mes closer to the face when i move to the left.
>
> i'm confused..
>
> On Tue, Dec 13, 2011 at 2:07 AM, Alan Skipp wrote:
> A bit late to the moustachioed party. But here is an attempt at the live
> moustachification problem. The effect is perhaps more like being pursued by
A bit late to the moustachioed party. But here is an attempt at the live
moustachification problem. The effect is perhaps more like being pursued by a
persistent tache, rather than wearing a tache. Those with more powerful
hardware (or less inclination to move around in front of the camera) may
7;? If yes, you
> may want to use NSHashTable which supports weak references.
>
> To me, this sounds like a design problem. Maybe your project can be
> re-architectured to avoid this pattern.
>
> Laurent
>
> On Feb 15, 2011, at 12:22 AM, Alan Skipp wrote:
>
>> Hi La
Hi Laurent,
Thanks for the response. In essence the problem I have is something like this:
Object 'A' is created, then to handle Key Value Observing, Object 'B' is
created which holds an instance variable to Object 'A'. 'B' is held in a hash
or array somewhere. Object 'B' only has a purpose whil
Hello everyone,
I've been doing some research into weak references in ruby and from what I've
read it seems that Ruby's WeakRef implementation is both inefficient and
unsafe. Here is the thread discussing the matter:
http://redmine.ruby-lang.org/issues/show/4168
As Macruby has a different garbag
I think you've just managed to get your variable names mixed up. You've used
'cocoaFinishTime' where you should have used 'cocoaTime'
last line should be:
puts "Cocoa Later time: #{cocoaFinishTime}, interval:
#{cocoaFinishTime.timeIntervalSinceDate(cocoaTime)} seconds"
al
On 13 Feb 2011, at 1
I think if you define an accessor for 'name' with attr_accessor as you have
done with someTextField, then this should work.
You can then remove the accessor methods you have created for the 'name'
instance var.
On 9 Feb 2011, at 08:51, Robert Payne wrote:
> Hi,
>
> I'm not sure if this is t
I've reduced the problem to the code below. Creating 1000 proxy objects in a
loop isn't a typical use case, but it does occur when benchmarking and the
crash report is pretty consistent each time.
Should I open a ticket for this issue?
Alan
--
class Proxy
def initialize(delegate)
@de
Hi everyone,
After the recent discussion about gcd and thread safety I took a look at the
Dispatch gem (proxy object in particular). I though I'd try and improve
efficiency, as all method calls are currently directed through method_missing
to the delegate object.
One attempt I made was to dyna
t..."
>>
>>
>> Today's Topics:
>>
>> 1. Re: Thread safety in apply example? (Matt Massicotte)
>> 2. Re: Thread safety in apply example? (Alan Skipp)
>> 3. Re: Thread safety in apply example? (Matt Massicotte)
>>
>>
>>
an 24, 2011, at 3:40 AM, Alan Skipp wrote:
>
>> Warning, horrible hack alert!
>> I'm sure there must be a far better implementation, but the idea is to have
>> an array subclass which diverts all method calls through a serial dispatch
>> queue, which should ensure thre
Warning, horrible hack alert!
I'm sure there must be a far better implementation, but the idea is to have an
array subclass which diverts all method calls through a serial dispatch queue,
which should ensure thread safe access.
Anyway, here's the horrible hack. By the way, it manages to break En
@selector(new:) withArguments: arg,
> NULL];
>
> Laurent
>
> On Jan 17, 2011, at 5:05 AM, Alan Skipp wrote:
>
>> Hi,
>> Is there any way to inform an Objective-C class of the existence of a ruby
>> class so that instances can be created in Objective-C code?
act is because of skipping evaling everytime,
> which iirc is the only thing that evaluateString does, or something else is
> happening... Have you also tried doing [rubyClass new] instead of alloc init?
> I thought they should do the same.
>
> On 17 jan. 2011, at 15:57, Alan Skip
urán wrote:
> After the Ruby code that defines the class has been evaled, you should be
> able to do the following:
>
> Class rubyClass = NSClassFromString(@"RubyClass");
> id rubyObject = [[rubyClass alloc] init];
>
> On Jan 17, 2011, at 2:05 PM, Alan Skipp wrote:
&
Hi,
Is there any way to inform an Objective-C class of the existence of a ruby
class so that instances can be created in Objective-C code?
Currently I am doing the following:
[[MacRuby sharedRuntime] evaluateString:[NSString
stringWithFormat:@"RubyClass.new('%@')", arg]];
If I'm adding quite a
Hi everyone,
Below is a reduction of a problem I've noticed when using
'enumerateObjectsUsingBlock' from inside a proc. The line which causes trouble
is:
[1,2,3].enumerateObjectsUsingBlock( Proc.new { |o, i, s| puts "inner
enumeration #{o}" } )
If this line is replaced with:
[1,
tions
> (such as predicateWithFormat:). Could you locate the crash report and
> copy/paste the backtrace information?
>
> Laurent
>
> On Jan 6, 2011, at 11:14 AM, Alan Skipp wrote:
>
>> Hi everyone,
>> Has anyone had any trouble with NSPredicate causing occasion
Hi everyone,
Has anyone had any trouble with NSPredicate causing occasional crashes when
used with NSArrayController? Well actually about 50% of the time.
What I have is a subclass of NSArrayController which is a data source for an
NSTableView that accepts drag and drop operations. In 'awakeFro
ity of this bug.
>
> Thanks :)
> Laurent
>
> On Dec 21, 2010, at 2:01 PM, Alan Skipp wrote:
>
>> When combining negative look-ahead with look-behind in a regexp, macruby
>> doesn't match correctly. Here's an example.
>>
>> ruby 1.9.2
>>&g
When combining negative look-ahead with look-behind in a regexp, macruby
doesn't match correctly. Here's an example.
ruby 1.9.2
>> m = "abc123abc".match /(?<=\w) (\d{3}) (?!\d)/x
=> #
>> m.to_s
=> "123"
macruby (0.9)
>> m = "abc123abc".match /(?<=\w) (\d{3}) (?!\d)/x
=> #
>> m.to_s
=> ""
iliar with ruby observer pattern myself.
On 29 Nov 2010, at 16:36, Matt Massicotte wrote:
> I'm not familiar with the Ruby observer mechanism you refer to - could you
> post a link?
>
> Matt
>
> On Nov 29, 2010, at 6:34 AM, Alan Skipp wrote:
>
>> I hope people don
I hope people don't mind me posting this bit of code to the list, but I hope it
will be of some use to others and would also be interested to hear if the
technique has any problems which I've not foreseen.
Ruby has its own means of implementing the observer pattern, but as Key Value
Observing (
Hi everyone,
This is just a quick query about using 'include' in an xcode project.
When creating an instance of a class, a 'require' statement is not needed
beforehand, but to include a module, you must first require it.
#no need to require 'Foo'
x = Foo.new
# must require 'Bar' beforehand
requ
y"})
>
> Laurent
>
> On Nov 19, 2010, at 3:25 AM, Alan Skipp wrote:
>
>> Whoops, sorry about that. I find that I can get away without assigning to
>> self in 'init' when doing a quick hack, but certainly not the recommended
>> approach, especial
or blocks, prone to crashes :-)
>
> Can you try to fix this and then tell us if it's still crashing?
>
> --
> Thibault Martin-Lagardette
>
>
>
> On Nov 19, 2010, at 10:14, Alan Skipp wrote:
>
>> I've been attempting to get an objective-c framewo
I've been attempting to get an objective-c framework to work with macruby and I
believe I've found a bug in the way ruby Proc objects are copied when used as
objective-c blocks.
The copied block doesn't seem to persist correctly beyond the scope in which it
was copied. It isn't deallocated, but
I wasn't able to reproduce the bug mentioned. I
> closed the ticket https://www.macruby.org/trac/ticket/1000#comment:2
> But feel free to investigate more and reopen it if you find something new.
>
> Thanks,
>
> - Matt
>
> On Wed, Nov 17, 2010 at 9:05 AM, Alan Skipp
Ticket #1000 has been filed.
Does the 1000th ticket get a special prize?
On 17 Nov 2010, at 14:39, Eloy Duran wrote:
> That’s no good. Can you file a ticket? (Preferably with the test framework
> attached)
>
> On Nov 17, 2010, at 3:34 PM, Alan Skipp wrote:
>
>> Thanks
ote:
> The BridgeSupport file should be in a BridgeSupport directory inside the
> framework’s Resources directory. For example, Foundation’s BridgeSupport file
> is at:
> /System/Library/Frameworks/Foundation.framework/Resources/BridgeSupport/Foundation.bridgesupport
>
&g
Aimonetti wrote:
>
>> Did you install BridgeSupport preview 1?
>> http://www.macruby.org/blog/2010/10/08/bridgesupport-preview.html
>> It is required to use C blocks.
>>
>> Thanks,
>>
>> - Matt
>>
>>
>> On Mon, Nov 15, 2010 at 2:51 AM, A
Hello everyone,
I'm attempting to call a method on an Objective-C object which takes a block as
its parameter, but I'm not having much luck. I can happily create the object
in Macruby and send the message with a Proc. The NSLog call within the
Objective-C method body succeeds, but the 'block()'
Reference/GCD_libdispatch_Ref/Reference/reference.html#//apple_ref/c/func/dispatch_once
22.
http://www.opensource.apple.com/source/libdispatch/libdispatch-84.5.1/src/once.h
23.
http://www.opensource.apple.com/source/libdispatch/libdispatch-84.5.1/src/once.c
24. http://ww
e a C API that would benefit from
> a wrapper so it can be easily used in macruby?
>
> Ruben
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
--
Alan Skipp
al_sk...@fastmail.fm
--
ht
tive-C class that wraps
> that API. How can I then use it on a Macruby script? I probably have
> to compile it somewhere...
>
> Ruben
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.
sktop/test.jpg')
NameError: uninitialized constant KCFAllocatorDefault
from core:in `const_missing:'
from (irb):2:in `'
from core:in `eval:'
from core:in `evaluate:'
--
Alan Skipp
al_sk...@fastmail.fm
--
http://www.fastmail.fm - IMAP accessi
One way of achieving this is by using rb-appscript, which you can
install as a rubygem:
http://appscript.sourceforge.net/rb-appscript/index.html
There's also the Scripting Bridge:
http://developer.apple.com/documentation/Cocoa/Conceptual/RubyPythonCocoa/Articles/UsingScriptingBridge.html#/
/ap
48 matches
Mail list logo