I'd like to be able to grab the metadata of the currently playing file in Quicktime X using ScriptingBridge and Ruby, so far I have the following code
require 'osx/cocoa'
OSX.require_framework 'ScriptingBridge'
@app = OSX::SBApplication.applicationWithBundleIdentifier("com.apple.QuickTimePlayerX")
@app.documents.each do |movie|
# What now?!
end
But I can't find any functions in QuickTime X's applescript dictionary to get the metadata from a document object (the same data you can see in QT's 'Show Movie Inspector' HUD) — does anyone have any ideas?
Given a very simple ruby script:
child = fork do
system 'sleep 10000'
end
5.times do
sleep 1
puts "send kill to #{child}"
Process.kill("QUIT", child)
end
QUIT signal is just lost. Where does it go? Something with default handler which just ignores it?
Hi,
I am trying to make an arcade machine. The user will purchase credits, which will allow him to play for X minutes. I want to write "9:42 minutes left" at the left corner of the screen, even if he's playing a full screen game (UrbanTerror, for example).
I would really like if I could do this with Ruby, but any other language is OK. Any ideas?
Thanks in advance.
which database should I use, if my application is going to be in multiple languages (including Chinese, Japanese etc)? In other words, is MySQL better or worse than Postgres to handle unicode etc? (these are the only two databases my hosting company has)
Also, which language is better for handling unicode? PHP or Ruby/Rails?
Hi, I'm new to rails, and have taken some existing site for new enhancements. I mirrored rails application from remote server, and running locally using "ruby script/server" server.
The problem is any changes to the files are not being reflected in web browser. Is this because of caching somehwere. Can someone pls point me where should Ilook to disable this or come back to development env?
I'm writing a little client using Ruby and Savon. The interface changed significantly from version 0.7 to 0.8.x. All my calls don't work anymore :-(.
How can I pass on a local member variable.
Please see the example, @userName and @userPassword are not defined within the block.
begin
@response = @authentication_svc.request :wsdl, "AuthenticateUser" do
http.headers["SOAPAction"] = "AuthenticateUser"
soap.body = "#{@userName}#{@passwd}"
end
rescue Savon::SOAP::Fault = e
@last_soap_error = e.message
end
I'm iteration over records and want to create the toggle-options for records but I can't replace the div-id with the records:
<% for bill in @bills %
<% tmp = "test"%
<%= link_to '» now','#', :onclick = '$("#{tmp}").toggle();' %
Instead of getting:
» now
I'm getting:
» now
So he isn't evaluation the ruby variable in the string. How can I do this?
Thanks for your help and I'm new in jquerry.
I am writing a Rubyon Rails app and I want a method to be called every time the database is modified. Is it possible to do this without inserting a method call in every location where the database is modified?
Hi,
I'm running through the Rubyon Rails tutorial at http://guides.rubyonrails.org/getting_started.html (adjusting where appropriate for Google's App Engine). All is well up till section 6.3: when I try to click "New Post", I get the following error:
Internal Server Error (500)
Request Method: GET
Request URL: http://localhost:8080/500.html
access denied (java.io.FilePermission /dev/urandom read)
It works fine when I upload the application to Google's App Engine; it's just on my development machine (OS X 10.6) that it doesn't work.
Thanks in advance.
Hi,
I am trying to make a multi-dimensional array of characters in ruby, and this works, but is there a more elegant way?
def initialize(text)
@map = Array.new
i = 0
text.split("\n").each do |x|
@map[i] = x.scan(/./)
i += 1
end
#@map = text
end#constructor
Which of the following technology is easy to learn and fun for developing a website? If you could only pick one which would it be and why
Clojure/Compojure+Ring/Moustache+Ring
Groovy/Grails
Python/Django
Ruby/Rails
Turbogear
Cappuccino or Sproutcore
Javascript/jQuery
I am trying to write excel file by using ruby 1.9 spreadsheet version 0.6.4.1 on windows.
Everything is going ok,
until I get to the book.write statement
when I write book.write "c:/spreadsheet/excel-file.xls
I keep getting the following error
No such file or directory - c:/spreadsheet/excel-file.xls
Can anyone tell me what I should change in this path name?
I'm a little confused about scope of variables, in ruby I wrote a test program:
class Test
attr_reader :tester
def initialize(data)
@tester = data
end
def getData
tester
end
end
puts Test.new(11).getData
now this works fine, the attr_reader, but my confusion is that since I've define attr_reader :tester then why can't I go tester = data rather then @tester = data, because when retrieving the data in getData I only have to write tester and not @tester
Hi,
I have started learning Ruby and just tried out my first hello world program in NetBeans IDE. I have one doubt, I can see that the new project wizard created set of package structure. It had one "Rakefile" in it. What does that mean and what is the use of it?
Thanks,
Bragaadeesh.
Hi,
This is a quick question. I have the following ruby code, which works fine.
def add_zeros number, zeros
number = number.to_s
zeros_to_add = zeros - number.length
zeros_to_add.times do
number = "0#{number}"
end
number
end
But if I replace
number = "0#{number}"
With
number.insert(0, "0")
Then I get TypeError: can't modify frozen string, does anyone know why this is?
I am using gsub in Ruby to make a word within text bold. I am using a word boundary so as to not make letters within other words bold, but am finding that this ignores words that have a quote after them. For example:
text.gsub(/#{word}\b/i, "<b>#{word}</b>")
text = "I said, 'look out below'"
word = below
In this case the word below is not made bold. Is there any way to ignore certain characters along with a word boundary?
I am on Ubuntu10
sudo apt-get install ruby1.9.1-full
then download sources of rubygem 1.3.7 and install it
sudo ruby setup.rb
then, for example, install sinatra
sudo gem install sinatra
Finally open irb and type
require "rubygems"
require "sinatra"
and get error
LoadError: no such file to load -- sinatra
from (irb):2:in `require'
from (irb):2
from /usr/bin/irb:12:in `<main>'
Gem.path is the same to INSTALLATION DIRECTORY from "gem environment"
Hi,
Have you an idea about this error message when i run the rake db:migrate
command under Aptana ?
rake aborted!
NoMethodError: undefined method `ord' for 0:Fixnum: SET
SQL_AUTO_IS_NULL=0
Thanks
Here My Config :
Windows XP PRO SP2
Wamp 2.0
Aptana 2.0.4
RubyGems 1.3.5
Ruby 1.8.6
I installed rvm as root to setup an Ubuntu LTS 8.04 as a web hosting server for my rails apps.
rvm is installed in:
/usr/local/rvm
Everything works fine, gems installation included and users are able to use ruby and gem commands.
sudo gem install rails
My problem is that the gems EXECUTABLE DIRECTORY is not included in my PATH and thus I cannot use rails command.
Is there a way to dynamycally include gems executable directory in my PATH?
Can it be done directly through rvm?
Hi all,
I am looking to automate the changing of passwords across multiple services and servers. For example: I want to change the root paassword to all of my web servers at once. I am thinking of writing a ruby script, but have you guys run across anything already written?
If so, would that also give me the ability to change other system passwords like Database passwords and SVN passwords.
When I use my regular client and send email through SMTP for an IMAP account, that outbound email gets saved in the IMAP "Sent" box.
How can I have the same behavior when I send email using Rubyon Rails Actionmailer?
I'm setting up a Linux development environment. After installing Ruby and RubyGems, I quickly found out that I need to require 'rubygems' in order to use gems, whereas I do not need to do this in Windows Vista. Is there anything I can do to fix this? Should I even be worrying about it?