Skip to content

Instantly share code, notes, and snippets.

RuntimeError (At least one field is necessary for an index):
/usr/local/lib/ruby1.9/gems/1.9.1/gems/freelancing-god-thinking-sphinx-1.1.14/lib/thinking_sphinx/index/builder.rb:44:in `initialize'
/usr/local/lib/ruby1.9/gems/1.9.1/gems/freelancing-god-thinking-sphinx-1.1.14/lib/thinking_sphinx/index/builder.rb:27:in `new'
/usr/local/lib/ruby1.9/gems/1.9.1/gems/freelancing-god-thinking-sphinx-1.1.14/lib/thinking_sphinx/index/builder.rb:27:in `generate'
/usr/local/lib/ruby1.9/gems/1.9.1/gems/freelancing-god-thinking-sphinx-1.1.14/lib/thinking_sphinx/active_record.rb:69:in `define_index'
app/models/edition.rb:196:in `<class:Edition>'
app/models/edition.rb:72:in `<top (required)>'
app/controllers/editions_controller.rb:498:in `perform_basic_search'
app/controllers/editions_controller.rb:409:in `perform_search'
app/controllers/editions_controller.rb:10:in `index'
# problem gems on 1.9. Need to resolve these before our app
# will be happy
if RUBY_VERSION < "1.9"
config.gem "fastercsv", :version => "1.4.0"
config.gem "titlepage", :version => "0.9.6"
config.gem "rubyzip", :version => "0.9.1", :lib => "zip/zip"
config.gem "scrapi", :version => "1.2.0"
else
# FasterCSV is included in 1.9, but called CSV. Alias it to
# the FasterCSV constant so our app won't know the difference
(gdb) backtrace
#0 0xb7eba8d5 in GooString::sanitizedName (this=0x0, psmode=1) at GooString.cc:762
#1 0xb7ea32a6 in PSOutputDev::setupFont (this=0x8e6b310, font=0x8e6c2f8, parentResDict=0x8e6b9c8) at PSOutputDev.cc:1685
#2 0xb7ea38d7 in PSOutputDev::setupFonts (this=0x8e6b310, resDict=0x8e6b9c8) at PSOutputDev.cc:1600
#3 0xb7ea207b in PSOutputDev::setupResources (this=0x8e6b310, resDict=0x8e6b9c8) at PSOutputDev.cc:1485
#4 0xb7ea3c15 in PSOutputDev::writeDocSetup (this=0x8e6b310, catalog=0x8e6ad28, firstPage=1, lastPage=1, duplexA=0) at PSOutputDev.cc:1405
#5 0xb7ea401e in PSOutputDev::init (this=0x8e6b310, outputFuncA=0xb7e9b320 <outputToFile>, outputStreamA=0x8e6add8, fileTypeA=psFile, pstitle=0x0, xrefA=0x8e6acb8, catalog=0x8e6ad28, firstPage=1, lastPage=1, modeA=psModePS, imgLLXA=0, imgLLYA=0, imgURXA=0, imgURYA=0, manualCtrlA=0, paperWidthA=-1, paperHeightA=-1, duplexA=0) at PSOutputDev.cc:1181
#6 0xb7ea4617 in PSOutputDev (this=0x8e6b310, fileName=0x8e6b918 "test.ps", xrefA=0x8e6acb8, catalog=0x8
irb(main):005:0> n = "James"
=> "James"
irb(main):006:0> n.strip!
=> nil
irb(main):007:0> n
=> "James"
irb(main):005:0> n = "James"
=> "James"
irb(main):006:0> n.strip!
=> nil
irb(main):007:0> n
=> "James"
# that's just plain weird
>> n = "john "
=> "john "
# coding: utf-8
class ApplicationController < ActionController::Base
before_filter :normalise_param_encodings
# On M17N aware VMs, ensure params from the user are marked with an appropriate encoding.
#
# As of Rails 2.3, Rack returns all params with an ASCII-8BIT encoding, which causes an
# exception if a param is mixed with a UTF-8 string or ERB template. Hopefully that will be
# fixed at some point and this won't be necessary any more.
# encoding: utf-8
#
# An example of adding a text annotation to a page
#
require "#{File.dirname(__FILE__)}/../example_helper.rb"
Prawn::Document.generate "text_annotation.pdf" do |pdf|
pdf.text "Hello World", :at => [200,420], :size => 32, :rotate => 45
pdf.text_annotation([100,100,100,100], "Hi there")
end
# filesrc -> decodebin -> ffmpegcolourspace -> videoscale -> videobox -> videorate
# \
# filesrc -> decodebin -> ffmpegcolourspace -> videoscale -> videorate -> videomixer -> ffmpegcolourspace -> theoraenc -> oggmux -> filesink
# /
# filesrc -> decodebin -> queue -> audioconvert -> vorbisenc
class Blah
class << self
def pub
meth
end
def meth
puts "hello world"
end
private :meth
class Demo
METHODS = ["one","two","three","four"]
class << self
METHODS.each do |name|
define_method("method_#{name}") do |arg|
puts "this method is named method_\"#{name}\" and you gave me the arg \"#{arg}\""
end
end