C++ code into Ruby, I need it fast, no time for RTFM

On Apr 25, 2007, at 5:35 AM, Richard C. wrote:

On 4/25/07, Andrei U. [email protected] wrote:

DYOH - Do Your Own Homework

Speaking of which, I have a biology lab report due next wednesday, so
I need someone to do it for me - make sure it’s GOOD!

-------------------------------------------------------|
~ Ari
crap my sig won’t fit

On 4/26/07, Michael U. [email protected] wrote:

someone to answer. You don’t need an entire book for loops and printing

http://poignantguide.net/ruby/

Though that one’s for people of alternative brain.

On 4/25/07, Tim P. [email protected] wrote:

There are several options for you here.

  1. Transliterate into Ruby (as you imply)
  2. Leave your code as-is and wrapper it using Ruby’s C api
  3. Leave your code as-is and use the Ruby DL module to load your
    library and invoke the methods
  4. Use the RubyInline module to simply “inline” your C/C++ code into a
    Ruby program

Just tried RubyInline - amazing!
I had one GCC hiccough on my Ubuntu 6 system, I had to do this:

ln -s /usr/lib/gcc/x86_64-linux-gnu/4.0.3/cc1 /usr/bin/cc1plus

…to get GCC to recognise that G++ had been installed. Otherwise it
gave me this:
gcc: installation problem, cannot exec `cc1plus’: No such file or
directory

On 26.04.2007 09:45, Leslie V. wrote:

On 4/26/07, Michael U. [email protected] wrote:

http://poignantguide.net/ruby/

Though that one’s for people of alternative brain.

Um, what do you mean by that? I have just one brain - am I old
fashioned?

SCNR

robert

On Apr 25, 11:54 am, “Tim P.” [email protected] wrote:

Have you gotten a suitable answer yet?
You’ll need a compiler installed on your machine to handle the C++
code compilation step RubyInline performs. You can install RubyInline
via the gem command:

gem install -r rubyinline

Shoot a nice note of thanks off to Eric H. and Ryan D… They’ve
done a great job with that little gem.

Have fun learning Ruby! I’ve learned far more about programming by
using Ruby than I ever learned using C/C++ or Java.

You can´t blame C/C++ or Java or any programming language for your
learning skills.


“Minds are like parachutes, they work best when open.”
“I know nothing except the fact of my ignorance.”
Bruno Patini Furtado
Software Developer
text adventures suite: http://bpfurtado.net/tas
software development blog: http://bpfurtado.livejournal.com
Ruby related topics: sys.out("g33|<"); — LiveJournal

On Wed, 2007-25-04 at 21:12 +0900, David J. wrote:

There are still ways to ask for things.

And those ways vary by culture. Andrei is painfully obviously not a
native English speaker. Cut the guy some slack. What happened to the
whole “Matz Is Nice So…” meme that supposedly dominates this
community?

Hi Andrei…i went pretty much through the ring-a-mole my self
once…one
good link for ruby is RDoc Documentation and
Ruby | zenspider.com | by ryan davis
for quick ruby ref…atleast i found so…enjoying RUBYing…

-ciao
AG

Thanks all of you for the links and support.
It’s realy amazing and funny what you can do with Ruby.

On 4/26/07, Leslie V. [email protected] wrote:

Just tried RubyInline - amazing!
I had one GCC hiccough on my Ubuntu 6 system, I had to do this:

ln -s /usr/lib/gcc/x86_64-linux-gnu/4.0.3/cc1 /usr/bin/cc1plus

…to get GCC to recognise that G++ had been installed. Otherwise it
gave me this:
gcc: installation problem, cannot exec `cc1plus’: No such file or directory

The magic behind RubyInline is the rbconfig.rb file. This little Ruby
script contains the build environment used to compile the Ruby
interpreter for your particular platform. When RubyInline compiles
code, it uses the build environment found in rbconfig.rb.

So, the catch is that your machine environment
(compilers/libraries/etc) needs to agree with what is in rbconfig.rb.

For my Ruby/Cywin installation, rbconfig.rb can be found here …

/usr/lib/ruby/1.8/i386-cygwin/rbconfig.rb

Blessings,
TwP

On 4/26/07, Tim P. [email protected] wrote:

/usr/lib/ruby/1.8/i386-cygwin/rbconfig.rb

Blessings,
TwP

Just installed the next Ubuntu, so I’ll look at this. Thanks!

On 4/26/07, Robert K. [email protected] wrote:

On 26.04.2007 09:45, Leslie V. wrote:

On 4/26/07, Michael U. [email protected] wrote:

http://poignantguide.net/ruby/

Though that one’s for people of alternative brain.

Um, what do you mean by that? I have just one brain - am I old fashioned?
It seems that one is above average :wink: (at least if you take YHS as
sample)

SCNR

    robert

idem

On 4/26/07, Leslie V. [email protected] wrote:

gcc: installation problem, cannot exec `cc1plus’: No such file or directory
For my Ruby/Cywin installation, rbconfig.rb can be found here …

/usr/lib/ruby/1.8/i386-cygwin/rbconfig.rb

Blessings,
TwP

Just installed the next Ubuntu, so I’ll look at this. Thanks!

It just worked on Feisty, so they must have fixed the GCC installation.
Looked at rbconfig though. Thanks for the tip.

Les

On 4/26/07, Robert K. [email protected] wrote:

On 26.04.2007 09:45, Leslie V. wrote:

On 4/26/07, Michael U. [email protected] wrote:

http://poignantguide.net/ruby/

Though that one’s for people of alternative brain.

Um, what do you mean by that? I have just one brain - am I old fashioned?

Alternative as in abnormal. I just mean that the book is highly
strange, for people who appreciate strange. I really enjoyed it
myself.

Ah the scarf eaters… so wistful.

On 4/26/07, Michael T. Richter [email protected] wrote:


Michael T. Richter [email protected] (GoogleTalk:
[email protected])
A well-designed and humane interface does not need to be split into
beginner and expert subsystems. (Jef Raskin)

I agree, this mailing list seems to be getting a lot more hostile
towards
people new to ruby. Posting a link to google or how to ask questions,
or
making a snide remark about how they format their messages is not going
to
get people into ruby. I know if someone just posted a link to google
with
nothing else if I asked a question about a new language, I would be
turned
off from it, even if I could have asked it better.

Leslie V. wrote:

I probably would have loved _why’s book, except I was so impatient to
learn ruby that I skipped over all the non-technical parts. It was
pretty informative, but its strange beauty was lost on a student that
pretty much wanted to learn Ruby in one night.

On 4/26/07, Chris C. [email protected] wrote:

get people into ruby. I know if someone just posted a link to google with
nothing else if I asked a question about a new language, I would be turned
off from it, even if I could have asked it better.
Hmm are you not exaggerating a bit?
I was very amused that OP got answers at all!
Personally I feel that this is still a great community and that this
community should not stretch to be more popular at any cost.
I had pretty much preferred to ignore that post but others decided,
very honorably, to tell OP to change his attitude if he wants to
obtain something.
I think that your statement “could have asked it better” is the
euphemism of the month ;).
Cheers
Robert

On Apr 27, 2007, at 5:05 PM, Robert D. wrote:

native English speaker. Cut the guy some slack. What happened

be turned
Cheers
Robert


You see things; and you say Why?
But I dream things that never were; and I say Why not?
– George Bernard Shaw

Not to harp on the issue, but had the same post gone to C or C++
mailing-list, it would’ve been flamed only with no solutions. The
beauty of the Ruby world is that (in the words of Masayoshi
Takahashi, of Ruby Kaigi) “Ruby is for lazy people” “java and c++ are
for diligent people”. It means Ruby is fun and not painful like many
languages, so people actually enjoy responding to the list and trying
to make nice code!
The culture of those other languages tends to be the anal-retentive,
I’m-smarter-than-you, RTFM attitude.
In Ruby, RTFM is RTWFM, where W = wonderful. Unlike those other
languages, this stuff isn’t terse and most of the books are good
ones. (Nothing is more annoying to me than being referred to K&R2,
one of the least accessible texts I’ve ever read, even though it does
have a wealth of good information in it.)

I’m a long time ruby user, but I just joined this list tonight. It’s
disappointing to see drama already. I hope this is not the norm.

  • Philip

On 4/27/07, Philip G. [email protected] wrote:

I’m a long time ruby user, but I just joined this list tonight. It’s
disappointing to see drama already. I hope this is not the norm.

  • Philip

Everywhere where there are people together there will be conflict. On
the whole ruby-talk is the greatest forum I have been a part of.
“Drama” is extremely rare, mostly it’s just a hundred questions a day
being answered with a thousand answers.

Also, some really great programmers regularly post here.

NOT the norm!