ruby

Ruby Kirbybase Server/Client Mode Problem

I'm trying to use the KirbyBase (in Ruby) in server/client mode and having some problems... Here's the setup (I'm working with a speacilized embedded linux system (explained at the bottom of post) but; I'll call those PC for the arguments sake) 2 PCs using an NFS mounted NAS drive on network (mounted on /mnt/sharedSpace), one will be s...

How can I detect faces using Ruby?

Can anyone tell me how to detect faces in a static picture using Ruby or Javascript? ...

HTML Entity problems using Nokogiri::XML.fragment

Hi everybody, it seems that all entities are killed using tags = "<p>test umlauts &ouml;</p>" Nokogiri::XML.fragment(tags) Result: <p>test umlauts </p> The above method calls Nokogiri::XML::DocumentFragment.parse(tags) and that methods calls Nokogiri::XML::DocumentFragment.new(XML::Document.new, tags). In relation to the nokogir...

ruby object array... or hash

I have an object now: class Items attr_accessor :item_id, :name, :description, :rating def initialize(options = {}) options.each { |k,v| self.send( "#{k.to_s}=".intern, v) } end end I have it being assigned as individual objects into an array... @result = [] some loop>> @result << Items.new(opt...

Is there an Xcode syntax colouring for Rails, Ruby, Erb? If not, how can I write one myself?

Xcode's syntax colouring is poor at best and textmate's looks great, but I like Xcode, since I program in C++, too. I'd like to keep everything in one place and take advantage of other Xcode features. Has anyone already done this or is there an easy way to do it? ...

Rails Datetime split setter method

I have a datetime column in a model and I want to display the form for this as separate text_fields for the time instead of the datetime_select helper drop down menus. I know I will somehow have to validate and recreate the date to go back to the DB, but I am not sure how. Should I use virtual attributes getter and setter methods? EG.....

Why is Gosu hiding my mouse pointer?

I'm doing some graphics programming using the Gosu gem. The thing is, when I create a Window my mouse pointer is hidden. I can guess where the mouse is at a certain moment, and I can intuitively click, but my users may not. Is there a way to show the pointer? ...

How can I quote strings in SASS?

I'm using SASS to generate a @font-face mixin, however this: =remotefont(!name, !url) @font-face font-family = !name src = url(!url + ".eot") src = local(!name), url(!url + ".ttf") format("truetype") +remotefont("My font", "/myfont.ttf") becomes this: @font-face { font-family: My font; src: url(/myfont.ttf.eot); ...

Connecting to MS SQL Server 2005 from Mac using Ruby, ODBC and FreeTDS

I'm having trouble connecting to a SQL Server 2005 install from this very simple Ruby app: #!/usr/bin/env ruby require 'rubygems' require 'sequel' Sequel.odbc('dev04')['select top 1 * from users'].all The dev04 DSN points to my odbc.ini file entry: [dev04] Driver = FreeTDS Description = ODBC connection via FreeTDS Trace =...

How to use rake to insert/replace html section in each file?

I'm using rake to create a Table of contents from a bunch of static HTML files. The question is how do I insert it into all files from within rake? I have a <ul id="toc"> in each file to aim for. The entire content of that I want to replace. I was thinking about using Nokogiri or similar to parse the document and replace the DOM node...

What is Ruby's default GUI framework?

If I remember correctly Python ships with Tk as it's standard framework. What's Ruby's default? ...

Is it possible to download a Ruby gem without installing it automatically?

When I download something using gem I'd like to be able to just download the gem, and then choose whether or not I want to install it. I'm asking this because I'd like to install a particular gem on more than one computers ( without installing from the internet on each one ). ...

Ruby Enterprise Edition vs Ruby 1.9

Hi, I'm planning to build a website that will be a simple CMS where users submit and view postings with videos, photos and text. One decision I want to make is choosing between Ruby Enterprise Edition and Ruby 1.9. Think I care about in order: 1- Performance & Scalability 2- Compatibility with existing gems/plugins/open source project...

Rails I18n in verification.rb verify method does not work?

Hi, I am using I18n internationnalization plugin, but it's not translating 1 piece of information : In one of my controller, I have a verify method like this : # Verify user is authenticated verify :only => [ :destroy, :create, :update, :new, :comment ], :session => :user_id, :add_flash => { :error => I18n.t(:'Exceptions....

How to break out from a ruby block?

class Bar def do_things Foo.some_method(x) do |x| y = x.do_somethign return y_is_bad if y.bad? # how do i tell it to stop and return do_things? y.do_something_else end keep_doing_more_things end end here is Foo#some_method. class Foo def self.some_method(targets, &bloc...

Ruby wont recognize Haml under ubuntu64 while using jekyll static blog generator.

I have been trying, quite unsuccessfully, to run henrik's fork of the jekyll static blog generator on ubuntu 64 bit. I just can't seem to figure this out and I've tried a bunch of different things. Thanks!! The base stats of my machine: Ubuntu 9.04, 64 bit, ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux], rubygems 1.3.1. When I ...

Sort an array in Ruby ignoring articles ("the", "a", "an")

In my application I need to show a list of songs. Right now I'm doing this: Song.all.sort {|x,y| x.artist.name <=> y.artist.name } Unfortunately, this means that "The Notorious B.I.G" will sort with the T's while I want him to sort with the N's (i.e., I want to ignore articles -- "the", "a", and "an" -- for the purposes of sorting. M...

how do i compare 2 html pages, and output only the different bits in ruby or PHP ?

how can i get 2 pages, and output the difference between those. getting the pages not a problem, but stuck on how to get the difference....i need a library for ruby OR php thank you. ...

How to silence the call to a rails controller's action all together

I've figured out how to silence the contents of an action by wrapping everything inside the action's method in a logger.silence block. However, I still get the call to the action showing up in the log file. I.E: Processing DashboardController#update (for 66.201.17.166 at 2009-09-09 19:03:27) [GET] Parameters: {"todos"=>{"user"=>"25"...

HAML Inheritance

I am new to haml and want to do some inheritance, but I don't know whether it is possible with haml or not. I have 2 separate haml files as below === file1.haml %p This is haml1 === file2.haml %h1 This is haml2 *** I want to have a file.haml which inherit from file1.haml and file2.haml. Is it possible to do it with haml? ...