Cameron Laird | 1 Dec 2006 01:05
Picon

Re: Ruby/Python/REXX as a MUCK scripting language

In article <ekel45$351$1 <at> upsn250.cri.u-psud.fr>,
Laurent Pointal  <laurent.pointal <at> limsi.fr> wrote:
>Fred Bayer a écrit :
>> 
>> Tony Belding wrote:
>>> I'm interested in using an off-the-shelf interpreted language as a
>>> user-accessible scripting language for a MUCK.  I'm just not sure if I
			.
			.
			.
>>> there's the security issue that really worries me. . .  I have to be
>>> able to limit what the interpreter can execute.  I can't have my users
>>> running scripts that access the console, access the filesystem or
>>> sockets directly, or call libraries or other binaries outside the MUCK.
>>>
>>> Is this practical?  I'm thinking of Ruby or Python for this, if they
>>> can meet the requirements.
>>>
>> 
>> Don't forget Lua: www.lua.org
>> It fulfills your requirements and is easily embedable.
>> 
>
>I Agree with F.Bayer, when reading OP post, I immediatly think about Lua.
>
>
>

Does Lua have an appropriate security model--a sandbox or such?
Fond though I am of Lua, such would be news to me.
(Continue reading)

Chris Pearl | 1 Dec 2006 01:15
Picon

What's the current standing of Rant vs. Rake?

Rake seems to be used widely and extensively. Rails uses it pretty
extensively, as do quite a few of the tools I'm currently reviewing
for the purposes of another thread [1].

So what about Rant [2]? It's certainly not dead: latest release was on
November 17, 2006. And it is claimed to be more featureful than Rake
[3].

Where is Rant being used (if at all)?  Why does Rake seem to be the
overwhelming choice?

-Chris
--
[1] http://aspn.activestate.com/ASPN/Mail/Message/ruby-talk/3321852
[2] http://rant.rubyforge.org/
[3] http://rant.rubyforge.org/files/doc/rant_vs_rake_rdoc.html

James Edward Gray II | 1 Dec 2006 01:22
Gravatar

Re: Splitting a CSV file into 40,000 line chunks

On Nov 30, 2006, at 2:45 PM, Paul Lutus wrote:

> Also, there is a hidden assumption in your position -- that  
> libraries, ipso facto, represent robust methods.

> For the newbies, however, it might matter. They might think library  
> contents differ from ordinary code.

I sure hope they think that!  I know I do.

There's no faster way to find bugs than to bundle up some code and  
turn it loose on the world.  That leads to more robust code.  This is  
the reason open source development works so well.

If one of us patches a library, everyone benefits.  It's like having  
a few hundred extra programmers on your staff.

Yes, I realize I'm over generalizing there.  There will always be  
poorly supported or weak libraries, but someone just forks or  
replaces those eventually.

>>> On the other hand, if your data does not exploit this CSV trait (few
>>> real-world CSV databases embed linefeeds)...
>>
>> Really?  How do they handle data with newlines in it?
>
> Linefeeds are escaped as though in a normal quoted string. This is  
> how I
> have always dealt with embedded linefeeds, which is why I was  
> ignorant of
(Continue reading)

James Edward Gray II | 1 Dec 2006 01:30
Gravatar

Re: Timers, scheduling and Ruby

On Nov 30, 2006, at 2:30 PM, ara.t.howard <at> noaa.gov wrote:

> On Fri, 1 Dec 2006, James Edward Gray II wrote:
>
>> My biggest request:  a sane way (read: not-cron-like) to schedule  
>> events.  ;)
>
> how bout this as the time spec?
>
>   http://runt.rubyforge.org/
>
> ??

Ah yes, I looked into Runy recently when someone use it to solve a  
Ruby Quiz.  Neat stuff.  Plus, if we want additions we can just patch  
them into Runt.  I like it.

James Edward Gray II

Paul Lutus | 1 Dec 2006 01:35

Re: Library to read/write TAR files

Michel Casabianca wrote:

> Hello,
> 
> I'm looking for a library to read/write TAR files. I've had a look on
> RubyForge and searched for one on Google but found nothing (except an
> old library that doesn't seem to be maintained anymore). Does anyone
> know such a library?

Are you willing to make system calls? I ask because if you do it in pure
Ruby, it will not be very fast. Tar does quite a lot of intensive
processing, and if you try to integrate the compression schemes it uses,
all the more so.

--

-- 
Paul Lutus
http://www.arachnoid.com

Paul Lutus | 1 Dec 2006 01:35

Re: newby question determining name of an array at run-time

Alfonso wrote:

> (Sorry for not finding a better title to my question. I'm not shure if
> this has something to do with metaprogramming... I have hear about that,
> but never had time to learn about it, so I don't know what is
> metaprogramming exactly)
> 
> Is there a way to do something like this?
> 
> arr = [ "red", "green", "yellow" ]
> 
> 
> # the following arrays should be incremented with the loop down
>  <at> red = []
>  <at> green = []
>  <at> yellow = []

Are you after named arrays? Do it this way:

hash = {}

hash[:red] = []
hash[:green] = []
hash[:blue] = []

hash.keys.each do |color|
  array = hash[color]
  #do something here
end

(Continue reading)

Paul Lutus | 1 Dec 2006 01:55

Re: HTML cleanup task

Victor "Zverok" Shepelev wrote:

/ ...

> That's all.

You project is extremely ambitious, and will outstrip all but the most
ambitious, dedicated effort. Every location -- indeed, every page -- you
visit will require different filtering.

Good luck with your project.

--

-- 
Paul Lutus
http://www.arachnoid.com

teeshift | 1 Dec 2006 02:05
Picon

floating point problem... floating indeed :(

I recently wrote a code and haven't been found the bug and start
suspecting that it was
the floating computation that causing the problem. I did a little
experiement and found the
following phenomena:

I am using

Linux source 2.6.15-27-386 #1 PREEMPT Sat Sep 16 01:51:59 UTC 2006 i686
GNU/Linux
Ubuntu is the OS.

#####################
#!/usr/bin/ruby1.9

a = 1.0

a.to_f

while(a < 15.0)
  a = a + 0.1
  print a,"\t",a * a,"\n"
end
#####################

and the output is...(as following) quite odd.  Anyone can explain it?
or a way to avoid it (while
keeping the precision)

1.1     1.21
(Continue reading)

Cyrus Ghalambor | 1 Dec 2006 02:05
Picon
Favicon

open-uril ECONNREFUSED problem

I'm working on a simple scraping tool and the open() method has suddenly
stopped working! This 2 line program fails with a ECONNREFUSED exception
in open-uri:

require "open-uri"
open("http://www.yahoo.com")

        from /usr/lib/ruby/1.8/open-uri.rb:134:in `open_uri'
        from /usr/lib/ruby/1.8/open-uri.rb:424:in `open'
        from /usr/lib/ruby/1.8/open-uri.rb:85:in `open'
        from /Users/cyrus/Desktop/test.rb:3

/usr/lib/ruby/1.8/timeout.rb:41:in `initialize'
/usr/lib/ruby/1.8/net/protocol.rb:83:in `new'
/usr/lib/ruby/1.8/net/protocol.rb:83:in `connect'
/usr/lib/ruby/1.8/net/protocol.rb:82:in `timeout'
/usr/lib/ruby/1.8/timeout.rb:55:in `timeout'
/usr/lib/ruby/1.8/net/protocol.rb:82:in `connect'
/usr/lib/ruby/1.8/net/protocol.rb:64:in `initialize'
/usr/lib/ruby/1.8/net/http.rb:430:in `open'
/usr/lib/ruby/1.8/net/http.rb:430:in `do_start'
/usr/lib/ruby/1.8/net/http.rb:419:in `start'
/usr/lib/ruby/1.8/net/http.rb:324:in `start'
/usr/lib/ruby/1.8/open-uri.rb:544:in `proxy_open'
/usr/lib/ruby/1.8/open-uri.rb:525:in `direct_open'
/usr/lib/ruby/1.8/open-uri.rb:169:in `open_loop'
/usr/lib/ruby/1.8/open-uri.rb:164:in `catch'
/usr/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
/usr/lib/ruby/1.8/open-uri.rb:134:in `open_uri'
/usr/lib/ruby/1.8/open-uri.rb:424:in `open'
(Continue reading)

ishamid | 1 Dec 2006 02:15
Favicon

Re: loops and branching

Thank you, but the following does not work properly:

================
puts 'Type initial year:'
leapi = gets.chomp.to_i
puts 'Type final year:'
leapf = gets.chomp.to_i

puts ''

while (leapi + (4 - leapi%4)) <= leapf
	leapi = (leapi + (4 - leapi%4))
	(leapi..leapf).select do |x|
	  (x % 4 == 0) && (x % 100 != 0) || (x % 400 == 0)
	  puts leapi
	end
end
================

Please advise ;-)

Best and Thnx
Idris

On Nov 30, 3:11 pm, "Christoffer Sawicki"
<christoffer.sawi... <at> gmail.com> wrote:
> > if leapi%4 == 0 && (leapi%400 == 0 || leapi%100 != 0)
> >         puts leapi
> > else
> > end
(Continue reading)


Gmane