chiaro scuro | 1 May 2006 01:11
Picon

Re: how to use curly brackets vs. 'end' in Ruby

I certainly cannot disagree with that!

:-)

bad-hungarian is when you prefix a variable name with type information
eg:

  fWidth = fSize

the 'f' simply means float.  you can see you have type compatibilty on both
sides, but it doesn't say anything about semantic compatibility. fWidth
could be used as a measure in metres, whereas fSize is expressed in feet!

good-hungarian is when you prefix a variable name with semantic information

   metric_width = feet_size

you can see immediately that there is a problem there.  both variables are
of the same type (Float), yet they have a different meaning.

I would argue that in ruby -using duck typing- we use good hungarian quite a
lot.

On 5/1/06, Stuart Stegall <stuart <at> footworkmedia.com> wrote:
>
> So Hungarian Notation = Bad, Hungarian Women = Good.  Did I get that
> right?
> chiaro scuro wrote:
> > ah! but not may know that there are both bad-hungarian and
> > good-hungarian !
(Continue reading)

bostonmacosx | 1 May 2006 01:16
Picon
Favicon

So I got a binary file...

Sorry for being such a NEWB. I'm a pretty prolific PHP writer however 
I'm new to RUBY and want to expand my horizons.

I have a big-endian binary file and want to convert it to ascii so I see 
what's in it.
Is there an easy way to accomplish this?

Thanks
Robert

--

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

Bill Kelly | 1 May 2006 01:22
Picon

Re: So I got a binary file...

From: "bostonmacosx" <tcdevlin <at> bc.edu>
>
> Sorry for being such a NEWB. I'm a pretty prolific PHP writer however 
> I'm new to RUBY and want to expand my horizons.
> 
> I have a big-endian binary file and want to convert it to ascii so I see 
> what's in it.
> Is there an easy way to accomplish this?

Not sure what you mean.  Do you want an ASCII hex dump of the
file?  (like `od -x`)  Or just strip the binary characters, and print any
ASCII sequences found (like `strings`) ?

Regards,

Bill

Phil Jackson | 1 May 2006 01:25
Picon
Gravatar

Re: Ruby based editor

On Mon, May 01, 2006 at 07:38:40AM +0900, Randy Kramer wrote:
> On Sunday 30 April 2006 11:00 am, Phil Jackson wrote:
> > Let me know your thoughts (which aren't allowed to include "do we really
> > need another editor" :)).
> 
> Ok, I won't ask that in quite that way, but:

I think you may have mis-understood my question (or I didn't explain
properly), what I was asking was more a design question than a general "I'm
building yet another editor what do you think" question. As you took the
time to write a response I'll answer you though (check bottom where I
re-phase my query):

>    * What is your goal for this editor--is it a learning project or intended 
> to eventually be a "product" in some sense?  

Both, I'm very interested in editors and find myself downloading new ones as
they arrive and playing with them (though I'm an avid Vim user).

>    * Is it to be as full-featured as Emacs or more like Notepad?  

Well, the idea is to write the base of the editor in C and have the API
almost completely available to Ruby. So, theoretically, it could be as
full-featured as Emacs or as simple as Notepad. ;)

> If I was going to expend effort on an editor, I'd work on nedit.  It is 
> written in C, is very featureful and fast, etc.  It includes a C-style/based 
> macro language, keystroke recording to start macros, syntax highlighting, 
> autoindent, etc., etc., etc.  

(Continue reading)

Ross Bamford | 1 May 2006 01:43
Picon

Re: how to use curly brackets vs. 'end' in Ruby

On Mon, 2006-05-01 at 06:28 +0900, dblack <at> wobblini.net wrote:
> I've always found it's much easier, when you're writing Ruby code, to
> "come from" Ruby.  That way, you don't have to fight the language, or
> convince yourself to be disappointed because it doesn't have the same
> syntax as other languages.  You free yourself to enjoy it a lot more.
> 

Amen to that.

--

-- 
Ross Bamford - rosco <at> roscopeco.REMOVE.co.uk

Hal Fulton | 1 May 2006 02:45

What's "new" in drb?

What's "new" in distributed Ruby? And by "new" I mean
less than five years old.   ;)

Hal

zdennis | 1 May 2006 03:40

Re: MySQL with windows


Jon Dean wrote:
> I am new to both ruby and am trying to install the API for mysql using 
> the link http://raa.ruby-lang.org/project/mysql-ruby/. I am using 
> version 1.8.4 for ruby and 5.0.19-nt for mysql. Following the 
> readme-winpkg I entered ruby install.rb -n and got
> install
> mingw32/mysql.so => c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
> I then ran the simple.rb
> # simple.rb - simple MySQL script using Ruby MySQL module
> 
> require "mysql"
> 
> begin
> # connect to the MySQL server
> dbh = Mysql.real_connect("localhost", "testuser", "testpass", "test")
> # get server version string and display it
> puts "Server version: " + dbh.get_server_info
> rescue MysqlError => e
> print "Error code: ", e.errno, "\n"
> print "Error message: ", e.error, "\n"
> ensure
> # disconnect from server
> dbh.close
> end
> from http://www.kitebird.com/articles/ruby-mysql.html and got:
> Error code:1251
> Error message: Client does not support authentication protocol requested 
> by server; consider upgrading mysql client
> simple.rb:13: undefined method 'close' for nil:NilClass <NoMethodError>
(Continue reading)

zdennis | 1 May 2006 04:14

Possible Bug in mysql-ruby 2.7


I am trying to store very small gzipped files in my mysql database. The storage works great, but when I
retreive the data some
fields are interpolated.

  Examples:
      \010  becomes \007
      \012  becomes \032

There may be others, but those are what I have noticed thus far. I am using the Mysql.quote method to store my
data. I am runnng:
  ruby 1.8.4 (2005-12-24) [i486-linux]
  mysql 5.0.20-1
  mysql-ruby 2.7

Thanks,

Zach
zdennis | 1 May 2006 05:09

Re: Possible Bug in mysql-ruby 2.7


zdennis wrote:
> I am trying to store very small gzipped files in my mysql database. The storage works great, but when I
retreive the data some
> fields are interpolated.
> 
>   Examples:
>       \010  becomes \007
>       \012  becomes \032
> 
> There may be others, but those are what I have noticed thus far. I am using the Mysql.quote method to store my
data. I am runnng:
>   ruby 1.8.4 (2005-12-24) [i486-linux]
>   mysql 5.0.20-1
>   mysql-ruby 2.7
> 

This does not appear to be a bug in mysql-ruby... appears to be some of my code...

Zach
M. Edward (Ed) Borasky | 1 May 2006 05:30
Favicon

Re: Ruby for command line applications


Alan M wrote:
> Hi,
>
> I am a Linux administrator and I use Perl for scripting.
> I do not develop any web applications. My programs are command line
> tools.
>
> At this phase I am thinking to upgrade my programming language to either
> Python or Ruby.
>
> Considering the fact that I won’t develop any web application, Which one
> would be a better choice for me Perl or Ruby?
>   
Well, I don't know anything about Python and not a whole heck of a lot
about Ruby. I've been using Perl for fairly complex "scripts" for almost
ten years now. Like another poster on this thread, I got tired of trying
to manage large "awk" scripts and wanted a language that made it at
least possible to write structured readable programs. That turned out to
be Perl 4.

If I were starting this project or set of projects today, I'd use Ruby.
It's much better designed for objects than what's been tacked on to
Perl. I don't have any pressing need to rewrite my few thousand lines of
Perl into Ruby (or Python), and what I don't do in Perl is usually
number crunching that I do in R.

So questions for you:

1. Do you just want to learn a new language, or is there something
(Continue reading)


Gmane