|
Is there any difference between p and puts in Ruby?
Started by collimarco on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
P foo is the same as puts foo.inspect
It is also important to note that puts 'reacts' to....
It prints the value of inspect instead of to_s , which is more you can't when printing without inspect ) .
P foo does puts foo.inspect , i.e.
|
|
I am using Ruby 1.8.6 for the following code:
# Create an array and override the #to_s on that object thing = [1,2,3] def thing.to_s 'one' end print "Using print: " print thing puts puts "Using puts: " puts thing
Output:
Using print: one Using puts: 1...
Started by arnab on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If any of the arguments to puts passed directly as an argument to puts....
puts is one of the most common output does not already end with a newline character, it adds one.
Are, and you can write values to them with the << operator .
|
|
Hi,
What's the configuration setting to get calls to puts to be written to the Apache log file? (Using Passenger to run Rails on Apache)
Thanks
Started by Paul on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
STDOUT (p, puts, printf, pretty_print...) is perfect por script/console experiments and for debugger calls, see this: post about ruby-debug for some hints on how to use "puts" or "p.
Enough ,everywhere.
|
Ask your Facebook Friends
|
Hi, I am working on creating a daemon in Ruby using the daemons gem. I want to add output from the daemon into a log file. So I am wondering what is the easiest way to redirect puts from the console to a log file?
Started by Josh Moore on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
To use ruby logger, it is better than puts, you can have multiple log levels that you can turn on/off.
|
|
LaTeX tries to guess whether a period ends a sentence, in which case it puts extra space after it. Here are two examples where it guesses wrong:
I watched Superman III. Then I went home.
(Too little space after "Superman III.".)
After brushing teeth etc...
Started by dreeves on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
So the first example should be
I watched sidestep the spacing issue if you prefer single spaces at the end of sentences: put \frenchspacing.
The fix is to put " \@ " before the period.
Sentence space.
|
|
What's the difference between...
File.open('abc', 'w') { |f| f.puts 'abcde' }
...and...
File.open('abc', 'w') { |f| f.write 'abcde' }
...?
Started by Ethan on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Technically, puts appends the record separator (which.
puts appends a newline, write does not.
|
|
I have recently moved a database from Sql Server 2000 to Sql Server 2005. In the table designer, it insists on putting square brackets around a column named "Content" I don't see Content on the list of reserved words for Sql Server, so I don't understand...
Started by pthalacker on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Sql....
The problem is that the field has the same name as the table .
You can always add square brackets around a column name so it doesn't hurt anything .
No, you can't prevent it.
See here.
CONTENT is a keyword when defining an XML column with a schema .
|
|
Today's Question: Name a song that always puts you in a good mood. Today's Question is....
Name a song that always puts you in a good mood.
Started by TideFans Reporter on
, 13 posts
by 12 people.
Answer Snippets (Read the full thread at tidefans):
This list is fluid, but this is pretty much the "feel good" play list: Name a song that always puts you in ....
White and Nerdy - Weird Al puts you in a good mood.
Re: Today's Question: Name a song that always puts you in a good mood.
|
|
The following code does not work correctly on Windows (but does on Linux):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setblocking(True) sock.connect(address) gobject.io_add_watch( sock.fileno(), gobject.IO_OUT | gobject.IO_ERR | gobject...
Started by Matt Joiner on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Only ask for....
When I write programs like this I tend to do the following:
Buffer the bytes I want to send to the file descriptor .
Is there a problem with doing non-blocking I/O? It seems kind of strange to use polling loops if you're using blocking I/O .
|
|
Hi, I have a Toshiba Satellite L335. I have tested two different monitors and have the same problem. When I plug in an external monitor, I can see weird horizontal lines. I bet it's doing a super slow refresh(something like the 40-50hz) but I can't prove...
Answer Snippets (Read the full thread at superuser):
Check out Artifact Tester for a better idea....
They are usually a result of overclocking the GPU, but you can get them without overclocking as well .
Have you updated your video driver lately?
Sounds like artifacts, which are a video card related problem .
|