Core LocationはiPhoneでしか使えないのかと思っていたのですが、Snow Leopardでも使えるんですね。おかげでMacRubyで簡単に位置情報を取得することができます。 #!/usr/local/bin/macruby # -*- coding: utf-8 -*- framework "Cocoa" framework "CoreLocation" class AppController def initialize() @app = NSApplication.sharedApplication delegate = Location.new @app.delegate = delegate @app.run end end class Location def initialize() @manager = CLLocationManager.alloc.init
OpenCLネタが最近続いてネタもないので、MacRubyを使ってiSightで遊んでみました。iSightで画像をキャプチャーしてJPEGファイルに保存するだけの質素な機能です。 #!/usr/local/bin/macruby # -*- coding: utf-8 -*- framework "Cocoa" framework "QTKit" class AppController def initialize(filename=nil) options = {} options[:output] = filename options[:output] ||= "#{Time.now.strftime('%Y-%m-%d-%H%M%S')}.jpg" @app = NSApplication.sharedApplication delegate = Capture.new deleg
前回に引き続き、またOpenCL。 前回、OpenCLで遊べるようになったので、もう少しお手軽に使えるようにクラスを作ったりしてます。自分が使いやすいように、まったりと更新してます。 #!/usr/local/bin/macruby # -*- coding: utf-8 -*- require "opencl" require "benchmark" opencl = OpenCL.new # When true is set in use_cpu, the program is executed on CPU. opencl.use_cpu = true opencl.program <<EOF __kernel sum(__global float *in, __global float *out, int total) { int i = get_global_id(0); if
Quick post to let you know about my latest hack: basic support for OpenCL on MacRuby and Snow Leopard. it is my first Ruby C extension ever it is my first OpenCL approach ever it is my first MacRuby hack (ever) With this in mind, don’t expect real world usage from this code, nor that it will get merged into upstream: it was just written for fun! The MacRuby branch with the changes is located here
As I’m working on my upcoming O’Reilly MacRuby book, I’m writing quite a lot of example code. I have spent the last few weeks digging through most of the Foundation framework classes to hopefully make Cocoa more accessible to Ruby developers. In some instances things might look quite weird to someone new to Cocoa in some cases, things seem almost too easy. Here is an example implementing a undo/re
Over the weekend, MacRuby’s trunk became version 0.6 and the bug fixing is currently done in both the 0.5 branch and trunk. Based on MacRuby’s usual release cycle I would expect a 0.5 beta3 or 0.5 final to be released soon so most of the work can be focused on trunk. I’ll let you check on the TODO list to see what was done in 0.5 and what is in the plan for 0.6. However, there is one feature in 0.
MacRuby is a version of Ruby 1.9, ported to run directly on top of Mac OS X core technologies such as the Objective-C common runtime and garbage collector, the CoreFoundation framework and the LLVM compiler infrastructure. 1月31日(米国時間)、MacRubyの最新版となるMacRuby 0.5が公開された。MacRubyはRuby 1.9に対応したプラットフォーム。Mac OS Xのコア技術であるObjective-Cランタイムおよびガベージコレクタ、CoreFoundationフレームワーク、LLVMなどを使って開発されており、Mac OS Xの性能を発揮しやすいと
Check out the tutorial, resources and examples that are available for MacRuby. 19-21 Nov 2009 » RubyConf San Francisco, CA Laurent Sansonetti presents MacRuby 19-21 Nov 2009 » RubyConf San Francisco, CA Matt Aimonetti talks about writing 2D video games with MacRuby We are pleased to announce the final release of MacRuby 0.5. After months of hard work and two successful beta releases, we believ
After going through two betas, MacRuby 0.5 final is now released and can be downloaded by clicking on the icon below: MacRuby 0.5 Don’t worry about having MacRuby and Ruby 1.8.x or 1.9 installed, MacRuby is namespaced and won’t affect your current Ruby installations, just download and launch the installer. (Note: The build was compiled for SnowLeopard only) You can read all the details of the rele
MacRubyのsvnリポジトリを眺めていて気づいたのですが、この間MacRuby NightliesをインストールしたはずなのにHotcocoaのソースが異なり、ファイル構成も違う・・・。 2週間ほど前からHotcocoaがsvnのtrunkからはずれ、ブランチにしかない! MacRuby NightliesからダウンロードしたパッケージにはHotcocoaが入ってない!!!そのため、最新のNightlyを上書きインストールしたのでHotcocoaだけMacRuby 0.5 b2の状態でした。MacRubyでrequire "hotcocoa/graphics"を実行するとエラーが発生するので直してみたでやったことは、あまり意味がなかったのかも orz 以下の手順で、インストールし直しました。 1. インストール済みのMacRubyを削除。 $ sudo rm -rf /Library/
RubyとWebKitを使ってWebサイトをキャプチャーするにはどうするのかと調べてみたら、RubyCocoaとMacRubyそれぞれにサンプルがありました。 RubyCocoa : http://rubycocoa.svn.sourceforge.net/viewvc/rubycocoa/trunk/src/sample/Scripts/darkroom.rb?view=markup MacRuby : http://www.macruby.org/trac/browser/MacRuby/trunk/sample-macruby/Scripts/darkroom.rb MacRubyのサンプルは、RubyCocoaのがベースっぽい。コマンドオプション用にoptparseというライブラリがあることを初めて知りました(^ ^;
Creativity is a characteristic that we possess all, to values more or less high. And as with everything, the more you stimulate it, the more it evolves. Be and to become creative is not a question of the genome. In effect, we can consider creativity like a sense in it even though we must stimulate on a daily basis to be as effective as possible. The profession of advertising, more than in others f
MacRubyでrequire "hotcocoa/graphics"を実行するとエラーが発生するので直してみたの対処でhotcocoa/graphicsが使えるようになったので、いろいろと遊んでいます。で、とりあえず画像をリサイズするものを作ってみました。 #!/usr/local/bin/macruby # -*- coding: utf-8 -*- # USAGE : ./resize.rb -i input.png -resize 300x300 -o oputput.png require 'rubygems' require 'hotcocoa/graphics' include HotCocoa include Graphics FILE_FORMAT = { "png" => NSPNGFileType, "gif" => NSGIFFileType, "jpg" => N
先日は MacRuby 0.5 をビルドして、AOT(ネイテイブバイナリへのコンパイル)を試してみました。簡単なサンプルはうまくいったけど NSSound を使うスクリプトをコンパイルしてみたら思ったように動作しなかったのでした。 まず、メーリングリストのこちらの投稿が参考になりました。 http://lists.macosforge.org/pipermail/macruby-devel/2009-July/002062.html この中で明示はされていませんけど、いろいろ試したところ require を使うとそこで LoadError 例外が発生してしまっていたようです。その原因はロードパス($: または $LOAD_PATH)が空っぽになっていたためでした。何も表示せずに終了してしまっていたのは、捕捉されない例外がトップレベルまで遡ってしまった時に通常の ruby や macruby
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く