Search Results

Search found 23 results on 1 pages for 'macruby'.

Page 1/1 | 1 

  • Using ASIHTTPRequest to download a file with Cocoa/MacRuby

    - by arbales
    I'm still trying to get a handle on Cocoa (both in Obj-C and MacRuby), and I'd really appreciate seeing how to download a file with ASIHTTPRequest (or without it) and MacRuby. Ideally, I'd like to be able show the progress inside a progress bar too. Must use a cocoa method for downloading, since open-uri in MacRuby is borken. Thanks for your help.

    Read the article

  • Learn MacRuby or Objective-C?

    - by MaxD
    Well, my fisrt question was a bit too general so i ll try again and hope this one is better. The way i see it is: Ruby-MacRuby or IronRuby or Rails Obj-c-Mac Development So Ruby has clearly more potential in desktop and web platforms and now with MacRuby, OSX native (and commercial) apps are on the way. If i get it wrong please correct me. For me that i will do a fresh start should i go with the modern Ruby or start learning c+obj-c? Will a newcomer benefit much (in learning & coding time, frustration, complexity) by learning/using macruby for osx apps rather objective-c? Or its pretty much the same? I hope some day to hang around here and help others.

    Read the article

  • How to use Obj-C classes in MacRuby

    - by beno1604
    I am trying to use an external Obj-C class in my MacRuby project, but I can't figure out how to import it. Specifically, I want to use ObjectiveResource inside a MacRuby 0.5 project (since ActiveResource doesn't work - yet). I have gotten as far as the 'framework' command in MacRuby, but it only seems to apply to actual frameworks. Questions: where should I install the objective-resource directory? how do I pull these classes inside my ruby code? Thanks for any help!

    Read the article

  • MacRuby - CLLocation Properties Not Accessible

    - by Craig Williams
    Anyone know why this works in Objective-C but not in MacRuby? Objective-C Version: CLLocation *loc = [[CLLocation alloc] initWithLatitude:38.0 longitude:-122.0]; NSLog(@"Lat: %.2f", loc.coordinate.latitude); NSLog(@"Long: %.2f", loc.coordinate.longitude); [loc release]; // Results: // 2010-04-30 16:48:55.568 OCCoreLocationTest[70030:a0f] Lat: 38.00 // 2010-04-30 16:48:55.570 OCCoreLocationTest[70030:a0f] Long: -122.00 Here is the MacRuby version with results: loc = CLLocation.alloc.initWithLatitude(38.0, longitude:-122.0) puts loc.class # => CLLocation puts loc.description # => <+38.00000000, -122.00000000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 2010-04-30 16:37:47 -0600 puts loc.respond_to?(:coordinate) # => true puts loc.coordinate.latitude # => Error: unrecognized runtime type `{?=dd}' (TypeError)

    Read the article

  • How to install Nokogiri as a Macruby gem?

    - by Jakub Hampl
    The latest MacRuby release notes (v0.6) state that the authors have managed to get this release working with the SQLite and Nokogiri gems. However when I run sudo macgem install nokogiri I get the following errors: ERROR: Error installing nokogiri: extconf failed: and then a bunch of paths followed by: libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/nokogiri-1.4.1/ext/nokogiri/extconf.rb:1:in `<main>': libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' (SystemExit) Anyone knows how to get this working? My platform is Mac OS X 10.6.3. Nokogiri normally (meaining on plain old ruby 1.8.7) installs without a problem.

    Read the article

  • How to debug macruby?

    - by Dan
    Hi, I've encountered an inconsistent bug with MacRuby and have no idea how to go about debugging this. If anyone could help would be great. I don't know if this is due to my own code or is it a bug in the MacRuby framework. I have a feeling it's my own code, something about over-retaining a piece of memory and hence the garbage collection failed. This is the error from Xcode. Thanks. CSV Wizard(30245,0x7fff704f7ca0) malloc: resurrection error for object 0x20199da20 while assigning {conservative-block}[196608](0x302360060)[117616] = Array[64](0x20199da20) garbage pointer stored into reachable memory, break on auto_zone_resurrection_error to debug CSV Wizard(30245,0x103781000) malloc: garbage block 0x20199da20(Array[64]) was over-retained during finalization, refcount = 1 This could be an unbalanced CFRetain(), or CFRetain() balanced with -release. Break on auto_zone_resurrection_error() to debug. CSV Wizard(30245,0x103781000) malloc: fatal resurrection error for garbage block 0x20199da20(Array[64]): over-retained during finalization, refcount = 1

    Read the article

  • Binding the textDidChange event on a NSTextField to a MacRuby delegate

    - by kolrie
    I have a NSTextField within a Window and I created a very simple MacRuby delegate: class ServerInputDelegate attr_accessor :parent def textDidChange(notification) NSLog notification.inspect parent.filter end end And I have tried setting the control's delegate: I have tried setting the Window and every other object I could think of to this delegate. I have also tried setting it to other delegates (application for instance) and events like applicationDidFinishLaunching are being properly triggered. Is there any trick I am missing in order for this event to be triggered every time the contents of this NSTextField changes?

    Read the article

  • Using Gems with MacRuby

    - by Craig Williams
    How do you use gems from a MacRuby .5 application on Snow Leopard? Do I need to specify the gem path? If so, how do I do this? Best scenario is to package the gems inside the application so the user would not have to install them when the app is distributed.

    Read the article

  • MacRuby + Interface Builder: How to display, then close, then display a window again

    - by Derick Bailey
    I'm a complete n00b with MacRuby and Cocoa, though I've got more than a year of Ruby experience, so keep that in mind when answering - I need lots of details and explanation. :) I've set up a simple project that has 2 windows in it, both of which are built with Interface Builder. The first window is a simple list of accounts using a table view. It has a "+" button below the table. When I click the + button, I want to show an "Add New Account" window. I also have an AccountsController < NSWindowController and a AddNewAccountController class, set up as the delegates for these windows, with the appropriate button click methods wired up, and outlets to reference the needed windows. When I click the "+" button in the Accounts window, I have this code fire: @add_account.center @add_account.display @add_account.makeKeyAndOrderFront(nil) @add_account.orderFrontRegardless this works great the first time I click the + button. Everything shows up, I'm able to enter my data and have it bind to my model. however, when I close the add new account form, things start going bad. if I set the add new account window to release on close, then the second time I click the + button, the window will still pop up but it's frozen. i can't click any buttons, enter any data, or even close the form. i assume this is because the form's code has been released, so there is no message loop processing the form... but i'm not entirely sure about this. if i set the add new account window to not release on close, then the second time i click the + button, the window shows up fine and it is usable - but it still has all the data that i had previously entered... it's still bound to my previous Account class instance. what am I doing wrong? what's the correct way to create a new instance of the Add New Account form, create a new Account model, bind that model to the form and show the form, when I click the + button on the Accounts form? ... this is all being done on OSX 10.6.6, 64bit, with XCode 3.2.4

    Read the article

  • Could MacRuby / HotCocoa supplant the need to know Objective-C?

    - by frou
    I just discovered MacRuby / HotCocoa and really like the sound of what they're doing. I had essentially discounted the prospect of making Cocoa GUI applications myself because I have an aversion to spending time & effort learning yet another C-based language, Objective-C. I'm not saying it's bad, just not for me. Is it the case now, or in the probable future, that one will be able to make Cocoa GUI applications of substantial and first-class nature with MacRuby / HotCocoa alone while ignoring Objective-C completely?

    Read the article

  • Cocoa/MacRuby: How to write a toolbar which accepts custom items?

    - by Joseph Melettukunnel
    I'm doing my first steps in MacRuby. Does anyone know how I can add a custom Toolbar to my Cocoa/MacRuby application, which will accept "regular" items for e.g. switching the view (see http://www.stevestreeting.com/wp-content/uploads/2011/06/SelectableToolbarDemo001.png). I've read some tutorials and I guess I have to create a custom delegate for the Toolbar and then connect it via the Outlets window, but how does the myCustomDelegate.rb have to look like? Thanks a lot! Cheers

    Read the article

  • Poorly rendered text (NSFont) in MacRuby/Cocoa. Any advice?

    - by gnzlz
    I have a small MacRuby app that displays some text inside a NSTextView. I have a method called make_label() that builds an NSTextView with some text and returns it, which I use to add to another NSView via addSubview() make_label() looks like this: def make_label( x, y, width, height, color, font_size, text ) label = NSTextView.alloc.initWithFrame( NSMakeRect( x, y, width, height) ) font = NSFont.systemFontOfSize(font_size) label.setFont( font ) label.insertText( text ) label.setTextColor( color ) label.setDrawsBackground(false) label.setRichText(true) label.setEditable(false) label.setSelectable(false) label end My question is, how come my text looks so poorly rendered? It looks very pixelated and not antialiased at all (from what I can see). Click here for screenshot This screenshot shows 2 different sizes of the font, with the same phenomenon.

    Read the article

  • Error when using --static option with macrubyc

    - by Jakub Hampl
    I want to create a binary executable for a relatively simple script that would not require people to install macruby or HotCocoa. The script is here. I've understood that I want to use the --static option for the compiler and I'm using the following command: macrubyc -o postprocessor --static postprocessor.rb I get the following error: ld: library not found for -lLLVMBitWriter collect2: ld returned 1 exit status Error when executing `/usr/bin/g++ -o "postprocessor" -arch x86_64 -L/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib -lmacruby-static -L/usr/local/lib -lpthread -lffi -lm -lLLVMBitWriter -lLLVMX86CodeGen -lLLVMX86Info -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMJIT -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem -lpthread -ldl -lxml2 -lobjc -lauto -licucore -framework Foundation "/var/folders/wU/wUGgoG1JGeKBgwalWLPMAU+++TI/-Tmp-/main-72203.o" "./postprocessor.o"' What should I do to get this running?

    Read the article

  • Can gems be used by ruby code compiled with macrubyc

    - by sal
    MacRuby 0.5 includes a ruby compiler built on LLVM called macrubyc. Does anyone know if it would be possible to dynamically load gems from compiled code? Or compile the gems and link them in? Is this planned? Or how compiled code will be able to make use of gems in general.

    Read the article

  • Webdav -- GET on a directory

    - by Joe Cannatti
    I am beginning to build a tool that uses WebDAV. I am having trouble wrapping my head around something here. I think I am missing something conceptual. I can use PUT's to add files to the server. I can use GET's to read files from the server, but when I try to use GET on a directory I get a 403:Forbidden. I am using basic authentication. My code in MacRuby is as follows Net::HTTP.start('localhost') do |http| res = Net::HTTP::Get.new('http://localhost/webdav/') res.basic_auth 'jcannatti', 'webdav' http.request res end this returns <Net::HTTPForbidden 403 Forbidden readbody=true> however this Net::HTTP.start('localhost') do |http| res = Net::HTTP::Put.new('http://localhost/webdav/gorilla.txt') res.body = "testetsetest" res.basic_auth 'jcannatti', 'webdav' http.request res end returns <Net::HTTPCreated 201 Created readbody=true> What should happen when calling a GET on a WebDAV directory when everything is working correctly? thanks

    Read the article

  • How to create an image from canvas data?

    - by Jakub Hampl
    In my application I am trying to save an arbitrary part of a rendered HTML canvas to an image file. In my Javascript I call ctx.getImageData(x, y, w, h) and pass the resulting object to my macruby code (though if you know a solution in objc I am also very interested). There I'm trying to create a NSBitmapImageRep object so that I can then save to an image format the user desires. This is my code so far (the function gets a WebScriptObject as it's argument): def setimagedata(d) w = d.valueForKey("width").to_i h = d.valueForKey("height").to_i data = Pointer.new(:char, d.valueForKey("data").valueForKey("length").to_i) d.valueForKey("data").valueForKey("length").to_i.times do |i| data[i] = d.valueForKey("data").webScriptValueAtIndex(i).to_i end puts "data complete" # get's called @exported_image = NSBitmapImageRep.alloc.initWithBitmapDataPlanes(data, pixelsWide: w, pixelsHigh:h, bitsPerSample: 32, samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: NSCalibratedRGBColorSpace, bitmapFormat: NSAlphaNonpremultipliedBitmapFormat, bytesPerRow: 0, bitsPerPixel: 0) puts "done" # doesn't get called end The code doesn't seem to get through the initWithBitmapDataPlanes function but gives no error. My question is: what am I doing wrong? Is this approach reasonable (if not, what would be better?).

    Read the article

  • Learning frameworks without learning languages

    - by Tom Morris
    I've been reading up on GUI frameworks including WPF, GTK and Cocoa (UIKit). I don't really do anything related to Windows (I'm a Mac and Linux guy) or .NET, but I'd like to be able to throw together GUIs for various operating systems. We are in the enviable position now of having high level scripting languages that work with all of the major GUI toolkits. If you are doing Linux GUI programming, you could use GTK in C, but why not just use PyGTK (or PyQt). Similarly, for Java, one can use JRuby. For Mac, there's MacRuby. And on .NET, there's IronRuby. This is all fine and good, and if you are building a serious project, there are tradeoffs that you might encounter when deciding whether to, say, build a WPF app in C# or in IronRuby, or whether you are going to use PyGTK or not. The subjective question I have is: what about learning those frameworks? Are there strong reasons why one should or should not learn something like WPF or Cocoa in a language one is familiar with rather than having to learn a new language as well? I'm not saying you should never learn the language. If you are building Windows applications and you don't know C#, that might be a bit of a problem. But do you think it is okay to learn the framework first? This is both a general question and a specific question. I've used some Cocoa classes from Ruby and Python using things like PyObjC and there always seems to be an impedance mismatch because of the way Objective C libraries get built. Experiences and strong opinions welcome!

    Read the article

  • 'Relaunching tuncfg' keeps showing up in my console

    - by Andy
    I was scanning my Mac OS X with sophos antivirus and opened the console. I see this over and over again. How do I tell whatever it is to stop trying to launch tuncfg? I recently reinstalled my operating system because I accidentally messed up some key library for using the terminal when trying to install macruby. 3/13/11 11:27:32 PM com.hamachix.tuncfgd[856] /usr/sbin/tuncfgrelaunch: line 8: tuncfg:: command not found 3/13/11 11:28:32 PM com.hamachix.tuncfgd[865] Relaunching tuncfg 3/13/11 11:28:32 PM com.hamachix.tuncfgd[865] /usr/sbin/tuncfgrelaunch: line 8: tuncfg:: command not found 3/13/11 11:29:32 PM com.hamachix.tuncfgd[875] Relaunching tuncfg 3/13/11 11:29:32 PM com.hamachix.tuncfgd[875] /usr/sbin/tuncfgrelaunch: line 8: tuncfg:: command not found

    Read the article

  • DRY Authenticated Tasks in Cocoa (with distributed objects)

    - by arbales
    I'm kind of surprise/infuriated that the only way for me to run an authenticated task, like perhaps sudo gem install shi*t, is to make a tool with pre-written code. I'm writing a MacRuby application, which doesn't seem to expose the KAuthorization* constants/methods. So.. I learned Cocoa and Objective-C. My application creates a object, serves it and calls the a tool that elevates itself and then performs a selector on a distributed object (in the tool's thread). I hoped that the distributed object's methods would evaluated inside the tool, so I could use delegation to create "privileged" tasks. If this won't work, don't try to save it, I just want a DRY/cocoa solution. AuthHelper.m //AuthorizationExecuteWithPrivileges of this. AuthResponder* my_responder = [AuthResponder sharedResponder]; // Gets the proxy object (and it's delegate) NSString *selector = [NSString stringWithUTF8String:argv[3]]; NSLog(@"Performing selector: %@", selector); setuid(0); if ([[my_responder delegate] respondsToSelector:NSSelectorFromString(selector)]){ [[my_responder delegate] performSelectorOnMainThread:NSSelectorFromString(selector) withObject:nil waitUntilDone:YES]; } RandomController.m - (void)awakeFromNib { helperToolPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/AuthHelper"]; delegatePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/ABExtensions.rb"]; AuthResponder* my_responder = [AuthResponder initAsService]; [my_responder setDelegate:self]; } -(oneway void)install_gems{ NSArray *args = [NSArray arrayWithObjects: @"gem", @"install", @"sinatra", nil]; [NSTask launchedTaskWithLaunchPath:@"/usr/bin/sudo" arguments:args]; NSLog(@"Ran AuthResponder.delegate.install_gems"); // This prints. } ... other privileges tasks. "sudo gem update --system" for one. I'm guessing the proxy object is performing the selector in it's own thread, but I want the current (privileged thread) to do it so I can use sudo. Can I force the distributed object to evaluate the selector on the tool's thread? How else can I accomplish this dryly/cocoaly?

    Read the article

  • Advantages/disadvantages of Python and Ruby

    - by Seburdis
    I know this is going to seem a little like all the other python vs ruby question out there, but I'm not looking specifically to pick one over the other all the time. My question is, essentially, why would you use one language over the other when you are starting a new project? What features does ruby have that python doesn't that would make you decide on it for a given project? What about python over ruby? I was just recently thinking about the differentiation between the two languages because of Jamis Buck's "There is no magic, only awesome" series of articles (4 parts, available here) when I realized I really don't know enough about the two languages to know when to choose one over the other. I'm hoping to get objective answers from people who have experience with both languages, rather than just "python is better, ruby sucks" kind of responses. If you know of a feature in one language that doesn't exist in the other and is great in a certain situation, feel free to chime in and say why you think it's awesome. If you have another language comparable to these that you'd like to suggest pros/cons for, like groovy for example, that would be appreciated too. Some thing I know each language has going for it: Ruby: Awesome metaprogramming Great community Wide selection of Gems Rails Great code readability, usually MacRuby is great for native development on Mac without objc Amazing testing tools (cucumber, rspec, shoulda, autotest, etc.) Python: Whitespace indentation List comprehensions Better functional programming support? Lots of support on linux Easy_install isn't far from gems Great variety of libraries available

    Read the article

1