I have the following XML structure:
<charsets>
<charset>
<name>ANSI_X3.4-1968</name>
<aliases>
<alias>iso-ir-6</alias>
<alias>ANSI_X3.4-1986</alias>
<alias>ISO_646.irv:1991</alias>
<alias>ASCII</alias>
<alias>ISO646-US</alias>
<alias>US-ASCII</alias>
<alias>us</alias>
<alias>IBM3...
How do I go from this:
"01","35004","AL","ACMAR",86.51557,33.584132,6055,0.001499
to this:
ACMAR, AL
...
I am attempting to split the ORDER BY statement of a SQL query into an array. First inclination is:
order_by.split(',')
but that does not work for order by statements like the following:
SUBSTRING('test',1,3) ASC, SUBSTRING('test2', 2,2 ) DESC
The desired output for the above statement would be:
["SUBSTRING('test',1,3) ASC", "SUB...
This looks like code in the C language, but I am not completely sure ...
# define v putchar
# define print(x) main(){v(4+v(v(52)-4));return 0;}/*
#>+++++++4+[>++++++<-]>++++.----.++++.*/
print(202*2);exit();
#define/*>.@*/exit()
...
I'm rather new to Ruby, and so far, figuring out how to use "binding" objects is one of the biggest pain points for me. If I'm reading the documentation correctly, they're almost entirely opaque. To access the scope inside the binding object, you have to have a string of Ruby code and eval it using the binding.
Maybe I'm just a purist...
I am trying to create a stream that includes Twitter data + my app's but I'm having trouble with this because Twitter's data isn't properly coming out as an array. This is my code:
answers = Answer.find(:all, :conditions => {:user_id => @user_id }, :limit => 20)
tweets = Twitter::Search.new(params[:username])
@feed = (answers + tweets)...
I'm developing an application using rails 2.3.5, gitorious and deploy with vlad, the OS is Linux Mint 9 Isadora.
vlad:setup and vlad:update are ok.
But when I vlad:migrate and have the same error than if I ssh on the server and try a rake gems:install
rake aborted!
no such file to load -- ya2yaml
/var/www/path/to/releases/2010062...
i have the value of targetfilename =/mnt/usb/mpeg4Encoded.mpeg4
how this pattren matching
if (targetfilename.match(/^\//))
puts "amit"
else
puts "ramit"
the o/p is ramit but how cud anybody help me in figuring out ......
Is there any easy way to toggle "do/end" and "{}" in ruby in Vim?
(TextMate does this with ^{.)
...
I'm a newbie to ruby, I want to know if I can use just one line to do the job.
Take the 'search' of this site for example. When user typed [ruby] regex, I can use following code to get the tag and keyword
'[ruby] regex' =~ /\[(.*?)\](.*)/
tag, keyword = $1, $2
Can we write it just in one line?
UPDATE
Thank you so much! May I make...
I'm trying to install Cucumber with ironruby. I followed instructions from http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net . It downloads version 0.8.3 of cucumber and version 2.0.2 of gherkin. When i run cucumber i get the following error:
c:/ironruby/lib/ironruby/gems/1.8/gems/gherkin-2.0.2-universal-dotnet/lib/gherki
...
Which are the similar features and differences between ASP MVC and RubyonRails?
...
I am trying to find a simple poll plugin/gem (the type of single question poll that's usually found in site's sidebar). All plugins that I've found are either too complex (like having their own DSL) or they are out of date (i.e. older than couple years).
Does anyone knows a Rails plugin/gem that handles simple polls?
...
Hi,
I am trying to run a rails application in Netbeans with JRuby as the underlying Ruby. When I try to run the server, I got an error like this,
Missing these required gems:
libxml-ruby
So I tried installing the libxml-ruby gem, but I cannot install it because its a native version and jruby would not support it. Thats fine.
(in...
I've been using Notepad++ for a while; in fact, I've even started using Launchy for that "load this resource into the editor right now" functionality that many fuller IDE's like Eclipse has. It has syntax highlighting, split window view, code collapsing, parentheses (and other delimiter) paring, automatic indent, block commenting.
Howe...
I am trying to create a gem with a generator for Rails 3 (beta 4). I followed these instructions, and but I couldn't get it running. The problem is that when I am defining a module in the generator file, the generator gets listed with 'rails generate', but can't get executed because the generator isn't found.
From the instructions (does...
Embedded vs link
I'm looking for the fastest way to search a Newsletter document for a connected Email. So far I have used MongoMapper with one document for Newsletter and another for Email. This is getting really slow with +100k Emails.
I was thinking maybe its faster to embed the emails in an array inside Newsletter
since I'm really ...
I need a function that checks the namespace of the argument, and returns the class type
for example:
checkType(id)
if id starts with "p:"
return <Class Type>
end
I do not have an instance to use when checking the type of the id
...
ruby: symbol lookup error: /usr/local/lib/ruby/gems/1.9.1/gems/tmail-1.2.7.1/ext/tmailscanner/tmail/tmailscanner.so: undefined symbol: rb_get_kcode
strange error that crash app.
ruby 1.9.1
rails 2.3.8
tmail 1.2.7
...
Hi,
I have updated my searching fields records with thinking_sphinx gem and I have configured it. It is working fine but the problem, It is only displaying 20 records which is default. How to change those thing to make more records visible on view..
...