botp | 1 Feb 2012 01:22
Picon

Re: Multiple assignment in conditional

On Wed, Feb 1, 2012 at 6:16 AM, Robert Klemme
<shortcutter <at> googlemail.com> wrote:
> it's a loop in which case the code often becomes more elegant, e.g.:
>
> while ( line = gets )

i dont know, Robert,  since i also find

  while ( line,x,y = get_something)

also elegant.
if ruby would support that, wouldn't it be elegant?

best regards -botp

Josh Cheek | 1 Feb 2012 01:22
Picon
Gravatar

Re: why we need heredoc

2012/1/31 Matthias Wächter <matthias <at> waechter.wiz.at>

> On 31.01.2012 15:50, Josh Cheek wrote:
>
>> It's great if you want to copy and paste some text. The text might have
>> single and double quotes in it, but with a heredoc that doesn't matter.
>> Otherwise, you'd have to go through your document, find all the quotes,
>> and
>> escape them.
>>
>
> take care of “some text” here. If the text contains your stop word, you’re
> gonna have to escape that as well. Or choose a different stop word then.
>
>
In practice, I've never had that happen, but in any situation where it was
likely, I'd probably have thrown it under __END__ and read it in, or put it
in its own file.
Josh Cheek | 1 Feb 2012 01:28
Picon
Gravatar

Re: Multiple assignment in conditional

On Tue, Jan 31, 2012 at 6:22 PM, botp <botpena <at> gmail.com> wrote:

> On Wed, Feb 1, 2012 at 6:16 AM, Robert Klemme
> <shortcutter <at> googlemail.com> wrote:
> > it's a loop in which case the code often becomes more elegant, e.g.:
> >
> > while ( line = gets )
>
> i dont know, Robert,  since i also find
>
>  while ( line,x,y = get_something)
>
> also elegant.
> if ruby would support that, wouldn't it be elegant?
>
> best regards -botp
>
>
I don't think it would be elegant, because the relationship between the
condition and the assignment is obscure. I would assume it's a shorthand
for `loop { line, x, y = get_something; ... }` but would have to look at it
for a while and then run some experiments to see.
Benedikt Huber | 1 Feb 2012 01:57
Picon
Favicon

Re: Which library to write a parser

Ryan Davis wrote in post #1043324:
> On Jan 31, 2012, at 09:30 , Bartosz Dziewoński wrote:
>
>> For heavy lifting, there's always Racc. ruby_parser uses it, and it's
>> pretty fast.
>>
>> http://i.loveruby.net/en/projects/racc/
>> http://rubygems.org/gems/racc
>> http://rubydoc.info/gems/racc/1.4.7/frames
> I did, but with all the complexity of ruby_parser, not the grammar in
> this thread.
Thanks for the numbers. I wrote a small grammar for the MiniP language
in racc, and repeated the experiments (on a different machine, ruby
1.9.3). racc's speed is ok, but it seems to be slower than rsec-ext.

parslet
53.10s
racc
2.05s
rsec-ext
0.72s

> That said, I will say that I only barely tolerate LR based parser
> generators. I would love to have a fully conformant LL-based parser for
> ruby.
I believe both racc and ANTLR won't be faster than rsec-ext, as they
generate ruby code. For many less-convoluted grammars (ruby is not a
good example ;)), a PEG-style parser library is a good and pleasant to
use alternative to a parser generator.

(Continue reading)

mark kirby | 1 Feb 2012 02:11
Picon

ruby executable on ubuntu

Hi
I just wonderd if you guys know any way to execute a .rb file by
clicking on it.
For a while now I have used the terminal to run files, even with
graphics.

user <at> computer: ruby /PATH TO FILE.rb

Any help would be great, I heard you can compile ruby with G++.

Can that be true?

It seems ridiculus to me.

;-) THANKS

--

-- 
Posted via http://www.ruby-forum.com/.

mark kirby | 1 Feb 2012 02:17
Picon

Re: Why Ruby 1.9 GUI hangs if i do any intensive computation in separate Ruby thread?

I dont know how to help you but if you are having gui troble switch API
I have been using this one called QT4 hears a tutorial

http://techbase.kde.org/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_01

It is simple and comes with a gui for desining guis so cuts out alot of 
errors also supports c and its veriations.

--

-- 
Posted via http://www.ruby-forum.com/.

Yong Li | 1 Feb 2012 02:31
Picon

Re: Microrant on Ruy's Math Skills

On Wed, Feb 1, 2012 at 12:49 AM, Chad Perrin <code <at> apotheon.net> wrote:
> On Tue, Jan 31, 2012 at 06:35:29PM +0900, Yong Li wrote:
>> On Tue, Jan 31, 2012 at 4:03 PM, Chad Perrin <code <at> apotheon.net> wrote:
>> >
>> > What exactly are you arguing here -- that there's no such thing as a
>> > solution that is easier to evaluate in one's head so that the results are
>> > not surprising a lot of the time?
>>
>> suppose we are writing a unit test method
>> def test_something() do
>>   a = pre_condition()                               # => a is a Float
>>   assert_approx_equal a, expected1  # => ok
>>   a = process a                                        # => do the real work
>>   assert_approx_equal  a, expected2  # => the assertion may fail, if
>> expected 2 is evaluated in my head
>> end
>>
>> do you consider this as a surprising result that may happen a lot?
>
> Yeah, basically.  Of course, "a lot" is relative -- but the upshot is
> that it happens enough to be a problem when offering an additional
> comparison method should yield something much easier to evaluate in one's
> head.
>
> Of course, I don't know how you get a unit test to make use of your
> brain's arithmetic capabilities. . . .
>
Sorry, my bad for confusing you. Second try:

# process(Fixnum i) is supposed to return 100.0 * i
(Continue reading)

Intransition | 1 Feb 2012 03:07
Picon
Gravatar

Re: PHP vs Ruby is it worth it?

Do you intend to use a database? That's really the first major question which dictates your direction.

Between php and ruby, php has a faster "on ramp" for web development as it is geared first and foremost for this very thing. However, as nice as php is as a language in many respects, Ruby is a better programming language and you'll be much happier in the long run working with it.

In general you need to know HTML, CSS, Javascript and then a language like PHP or Ruby.

If you plan to use a database you need to know SQL too, albeit if you use a web framework like Rails, it hides the SQL behind an ORM.

Tony Arcieri | 1 Feb 2012 03:13
Picon
Gravatar

Re: PHP vs Ruby is it worth it?

I think many of us started doing web development in PHP (I started using
PHP in 1998ish or so) and switched to Ruby. I don't think you're going to
get a lot of people specifically recommending PHP on this list.

For me Ruby is the clear choice and I never want to touch PHP again,
however for you there's many things to consider. I don't think Ruby is for
everyone so it depends on the nature of your team and the nature of your
project.

Can you tell us more about what you are doing?

On Tue, Jan 31, 2012 at 3:48 PM, Samuel Mensah <sasogeek <at> yahoo.com> wrote:

> Hi, I've been searching around for what the best language there is out
> there that is good enough to start learning if you aim to build a real
> time website. From this search, I notice in a couple of spots an
> argument between ruby and php and most of the arguments lean in favor of
> ruby. I need your opinions and directions as to what I should look at
> first, even if it is neither of the two. Please list all the other
> necessary languages I will need to know and html being most basic,
> please start from there with your list of languages i'll need, from most
> basic to the most complex ones i'll need.
>
> --
> Posted via http://www.ruby-forum.com/.
>
>

--

-- 
Tony Arcieri
transfire | 1 Feb 2012 03:39
Picon
Gravatar

[ANN] Executable v1.2.0 released

Executable 1.2.0 has been released. 

Think of Executable as a *COM*, a Commandline Object Mapper, in much the same way that ActiveRecord is an
ORM, an Object Relational Mapper. A class utilizing Executable can define a complete command line tool
using nothing more than Ruby's own method definitions. 

* home: http://rubyworks.github.com/executable
* code: http://github.com/rubyworks/executable
* bugs: http://github.com/rubyworks/executable/issues
* mail: http://groups.google.com/rubyworks-mailinglist
* chat: irc://chat.us.freenode.net#rubyworks

Version 1.2.0 is complete rewrite of Executable. Actually it was decided that the old design was too
simplistic in it design concept, so another library that was in the works, called Executioner, and
briefly CLI::Base, was ported over. And with some API changes, it is now the new Executable project. The
idea of the project is generally the same, but Executable now offers more features, such as good help
output and namespace-based subcomamnds. Of course, to accommodate all this the API had to change some
over the previous version, so be sure to read the API documentation. 

Changes: 

* Deprecate old implementation.
* Port Executioner project over to become new Executable project.
* Supports namespace-base subcommmands.
* Supports formatted help output in plain text and markdown.
* Supports manpage look-up and display.


Gmane