This is my code. I have a problem with spaces. I can not get the proper generation
- if @lastday.nil? && @lastday != item.created_at.strftime("%d %b %Y")
.daily-entry
%h1.date
=h item.created_at.strftime("%d")
%span
=h item.created_at.strftime("%b, %Y")
-else
.entry
%h1
= link_to item.title, "/i...
I am attempting to parse a Wiktionary entry to retrieve all english definitions. I am able to retrive all definitions, the problem is that some definitions are in other languages. What I would like to do is somehow retrieve only the HTML block with English definitions. I have found that, in the case that there are other language entri...
I'm new to Ruby on Rails and I'm sure this question is pretty stupid, but I can't deduce the answer from the examples I've seen, perhaps I haven't seen many good ones.
A website I am working on will have 'boxes' (i.e. widgets) in one side bar that will contain dynamic content, and it will also have links on the other sidebar to sections...
Does anyone know of a library to read/write the Xcode project files .xcodeproj/.pbxproj? Any language is welcome.
Thanks in advance.
...
I seem to have a problem that I can't find the solution for myself, I hope someone can help.
I have a form defined like so:
<% form_for @leads do |f| %>
I have a resource called @leads (map.resource :leads)
But when I look in the HTML code of the page it generates, I see as a form action the following
<form action="/lead.%23%3Clea...
Hello, how to get the status (200 OK, 404 NOT FOUND etc.) of the last page fetched by an IE instance?
...
Greetings,
I've a ruby script thats opening files and inserting the data inside the file into a database. Some of the files are missing so when the script attempts to open the file it throws a file not found exception.
Can anyone tell me how I can continue the process instead of the whole thing coming to an abrupt end. Please note th...
When I open a Ruby file (*.rb) inside Visual Studio, it reads like a regular text file - with no syntax highlighting on language keywords.
Is there any way to set this up in Visual Studio?
Update: No, I don't use Visual Studio for Ruby development - I use Netbeans. But I would like to open a Ruby file in Visual Studio and see the prope...
match, text, number = *"foobar 123".match(/([A-z]*) ([0-9]*)/)
I know this is doing some kind of regular expression match but what role does the splat play here and is there a way to do this without the splat so it's less confusing?
...
i have a string with bunch of break tags.
unfortunately they are irregular.
<Br> <BR> <br/> <BR/> <br /> etc...
i am using nokogiri, but i dont know how to tell it to break up the string at each break tag....
thanks.
...
I have a client and server. I start up the server, and run the client, and the first time it works fine. The second time I run the client(without restarting the server), the client appears to hang. Can anyone see what is wrong?
I have a client:
# Code example originated from p069dtclient.rb at http://rubylearning.com/satishtalim/r...
I'm creating a ruby server which is connecting to a TCP client. My server is using a TCPServer and I'm attempting to use TCPServer::recv(), but it doesn't wait for data, so just continues in a tight loop until data is received.
What is the most efficient way to process intermittant data? I'm unable to change the data being sent in sin...
Hi,
Disclaimer: I'm not a programmer, never was, never learned algorithms, CS, etc. Just have to work with it.
My question is: I need to split a huge (over 4 GB) CSV file into smaller ones (then process it with require 'win32ole') based on the first field. In awk it's rather easy:
awk -F ',' '{myfile=$1 ; print $0 >> (myfile".csv")}' ...
I have a model:
class Topic < ActiveRecord::Base
define_index do
indexes title, :sortable => true
indexes body
indexes tags(:name), :as => :tag_name
end
has_and_belongs_to_many :tags, :join_table => 'topic_tags', :order => 'tags.name asc'
end
When I run:
rake ts:rebuild
I get:
sql_range_query: Unknown column...
I'm trying to write a little lib which generates a keypair using open4, is this the best way of dealing with system calls with multiple prompts?
require 'rubygems'
require 'open4'
Open4::popen4("sh") do |pid, stdin, stdout, stderr|
stdin.puts "openssl genrsa -des3 -out tmp_priv.pem 2048"
stdin.puts "1234"
stdin.puts "1234"
std...
fruit = ["apple","red","banana","yellow"]
=> ["apple", "red", "banana", "yellow"]
Hash[*fruit]
=> {"apple"=>"red", "banana"=>"yellow"}
Why does the splat cause the array to be so neatly parsed into the Hash?
Or, more precisely, how does the Hash "know" that "apple" is the key and "red" is its corresponding value?
Is it simply be...
Im using the gem for thinking sphinx:
sudo gem install freelancing-god-thinking-sphinx \
--source http://gems.github.com
So:
require 'vendor/plugins/thinking-sphinx/recipes/thinking_sphinx'
Which is prescribed on the website does not work.
How do I include the capistrano thinking sphinx tasks in my deploy.rb file when using th...
I keep getting a 'uninitialize GLib::Object' error from my code.
Here's the code:
class MainWindow < Gtk::Window
def initialize
title = "I'm The Title Of An Application! Yay!"
border_width = 10
set_size_request(600, 300)
signal_connect("destroy") { Gtk.main_quit }
@vbox = Gtk::VBox.new(fals...
What are some of the criticisms leveled against exposing continuations as first class objects?
I feel that it is good to have first class continuations. It allow complete control over the execution flow of instructions. Advanced programmers can develop intuitive solutions to certain kind of problems. For instance, continuations are used...
I am thinking to learn programming language with dynamic type system.
Which one should I learn first?
Criteria:
I can learn and start programming in a day or two
Easy, Concise
In few days I should be able to write small scripts for some batch jobs with file systems.
To mention, I am normally a quick learner.
...