[#35036] Intentional Programming — "John" <nojgoalbyspam@...>
Hi all
Noone here interested in Intentional Programming? Anybody have an idea of
[#35057] Re: Ruby Regular Expression problem — "Olonichev Sergei" <olonichev@...>
[#35058] here documents as method parameter problem — mrp@...
in the following code, the first 2 "puts" work, but the last produces:
[#35060] Just noticed: 1.6.7 — Dave Thomas <Dave@...>
[#35112] RDoc question — Michael Davis <mdavis@...>
I have a question about RDoc. I would like to reference an external
Dave Thomas wrote:
Michael Davis <mdavis@sevainc.com> writes:
On Sun, Mar 03, 2002 at 08:07:52AM +0900, Dave Thomas wrote:
[#35118] TestUnit 0.1.4 — <nathaniel@...>
From the README:
[#35162] string to array and back — Ron Jeffries <ronjeffries@...>
I am needing to convert strings to arrays of bytes and back. I see pack and
Javier Fontan wrote:
[#35175] Readline loses stdin? — Massimiliano Mirra <list@...>
When I run the following code...
[#35182] RubyStudio UI Question — Chris Gehlker <gehlker@...>
I've been noodling all day about how the editing window in RubyStudio should
[#35186] ruby-dev summary 16040-16125 — Minero Aoki <aamine@...>
Hi all,
[#35200] Ruby and Parrot in The Perl Review — "Paul E.C. Melis" <melis@...>
Hi all,
[#35244] require 'file path' ? — Audun Tonnesen <aut@...2i.net>
This is a stupid question from a newbie. I have installed the windows version, and I wanted to try a graphic example from the 'pragmatic' using tk.
[#35276] Please help me!!!!!!!!!!!!! — rahmanian mohsen <rahmanian60@...>
where I can ask a question?
[#35322] How Ruby differs from Other Languages? — S Sridevi <shridevi@...>
Hi,
[#35341] Ruby Serial Ports under Windows — David Wende <DWende@...>
I've started using Ruby a week ago as my first OOP
[#35364] file reading impossibly slow? — Ron Jeffries <ronjeffries@...>
So I'm doing this benchmark to work with my set program. Part of the problem is
On Thu, 07 Mar 2002 13:52:41 GMT, nobu.nokada@softhome.net wrote:
I'm jumping into this thread late, so apologies if I'm repeating well-known
[#35378] RDoc now generates .chm files — Dave Thomas <Dave@...>
[#35386] What are the Ruby 1.8 plans? — Matt Armstrong <matt@...>
There have been two recent threads about slow Ruby IO under Win32
[#35388] Re: file reading impossibly slow? 1.6.6 vs. 1.6.2 numbers — Pete McBreen <pete@...>
Matt Armstrong wrote
[#35393] net/http; 302 — Tobias Reif <tobiasreif@...>
Hi,
[#35409] Talking Trash About Ruby — Lyle Johnson <lyle@...>
All,
[#35429] Interesting link on static/dynamic typing... — Robert Feldt <feldt@...>
...relevant to Ruby compared to other languages discussion:
On Fri, Mar 08, 2002 at 05:34:43PM +0900, Robert Feldt wrote:
On 3/8/02 7:56 AM, "Paul Brannan" <paul@atdesk.com> wrote:
Robert Feldt <feldt@ce.chalmers.se> writes:
[#35430] Spooky backtick bug w/large file support — jonathan@... (Jonathan Baker)
Discovered that the patch for large files caused a nasty side effect:
[#35439] Opinions wanted (long) — Massimiliano Mirra <list@...>
These are some embryonic ideas that generated after a discussion with
[#35443] RE: Text stuff and appending to a file — Wyss Clemens <WYS@...>
By heart I would guess:
[#35460] Spam, ruby-talk, and me — Dave Thomas <Dave@...>
Dave Thomas <Dave@PragmaticProgrammer.com> writes:
On Sat, Mar 09, 2002 at 07:12:56AM +0900, Yohanes Santoso wrote:
[#35477] is there any way ... — Ron Jeffries <ronjeffries@...>
is there any way we could fix the bug whereby a..b is /longer/ than a...b ?
[#35478] file closing — Ron Jeffries <ronjeffries@...>
So I'm going to create an object that wraps a file and gives it some new kind of
[#35519] Open Watcom — Massimiliano Mirra <list@...>
I'm not directly interested in this since I run Linux, but I stumbled
[#35537] Confusion — David Corbin <dcorbin@...>
The following is from my debugging through xmlc.rb
David Corbin wrote:
[#35553] Fiddling with ruby/tk canvas — Thomas Sondergaard <tsondergaard@...>
I've got a TkCanvas with a number of TkcImage items on it. I've set it
[#35557] Issue with trapping errors in instance_eval — Michael Davis <mdavis@...>
I need to be able to trap error during a call to instance_eval. Here is
[#35579] RE: WIN32OLE and LDAP — "Morris, Chris" <chris.morris@...>
> The new version 0.4.2 of Win32OLE has WIN32OLE.bind method.
ehlo.
[#35580] packages (jar-alike) — Vladimir Dozen <Vladimir.Dozen@...>
ehlo.
[#35608] Using 'uniq' question — edjbaker@... (Ed Baker)
If I have an array of data, where each record looks like the example
[#35609] Config::CONFIG['build_alias'] ? — Massimiliano Mirra <list@...>
Which are the build aliases of the platforms ruby runs on?
[#35636] gzip again... — Massimiliano Mirra <list@...>
I can't seem to process from within Ruby with gzip files that exceed a
On Tue, Mar 12, 2002 at 12:34:29PM +0900, Massimiliano Mirra wrote:
[#35639] Controlling Mouse/Keyboard — "Norman Makoto Su" <normsu@...>
Hi,
[#35653] Some potential RCRs — "Bob Alexander" <bobalex@...>
Here are a few thing I am considering submitting as RCRs. I'm looking =
Following are summarized responses to the passle of RCR candidates I posted
Hi,
On Wed, Mar 13, 2002 at 03:58:01AM +0900, Yukihiro Matsumoto wrote:
Hello --
"Bob Alexander" <balexander@rsv.ricoh.com> wrote in message
[#35692] Module Syntax — "Sean O'Dell" <sean@...>
Being primarily a C++ programmer, I'm happy with Ruby's Module concept
[#35694] rpkg 0.3 — Massimiliano Mirra <list@...>
>
james@rubyxml.com writes:
Dave Thomas <Dave@PragmaticProgrammer.com> writes:
On Wed, Mar 13, 2002 at 08:48:03PM +0900, Piers Cawley wrote:
[#35718] RE: testunit, was RE: [ANN] rpkg 0.3 — Thomas Sdergaard <tsondergaard@...>
> I believe the reason is because your standard Ruby
It is the merging of Lapidary and RubyUnit (backward compatibility APIs for
Rich Kilmer [mailto:rich@infoether.com] wrote:
On Wed, Mar 13, 2002 at 11:48:15PM +0900, nathaniel@talbott.ws wrote:
[#35742] how do i: add_observer( { small bit of code } ) — mrp@...
observing an object, i want to run a small bit of code when update is
[#35757] process two arrays pairwise? — Ron Jeffries <ronjeffries@...>
Is there somewhere in Ruby a way to process the elements of two arrays (of equal
[#35766] Ruby/zlib 0.5.0 — UENO Katsuhiro <unnie@...>
Hello,
[#35776] Anyone using the WASTE editing library with Ruby? — ptkwt@...1.aracnet.com (Phil Tomson)
[#35787] testunit - setup -> set_up ? — "Morris, Chris" <chris.morris@...>
I'm just starting to use testunit instead of rubyunit ... I noticed with an
Morris, Chris [mailto:chris.morris@snelling.com] wrote:
"Nathaniel Talbott" <nathaniel@talbott.ws> writes:
dave@thomases.com [mailto:dave@thomases.com] wrote:
"Nathaniel Talbott" <nathaniel@talbott.ws> writes:
Hi,
On Fri, 15 Mar 2002 02:10:16 GMT, "Nathaniel Talbott" <nathaniel@talbott.ws>
[#35790] RE: Some potential RCRs — "Morris, Chris" <chris.morris@...>
> > - - A much better solution would be added support for file "type"
[#35825] Test::Unit — "Steve Merrick" <Steve.Merrick@...>
Can someone explain to me the *details* of how to use Test::Unit,
[#35845] Debugger problem — "Nathaniel Talbott" <nathaniel@...>
Perhaps this is a known issue, but given the following program:
[#35866] new user confused by multidimensional Ruby hashes — Ian Macdonald <ian@...>
Hi all,
[#35898] camelCase and underscore_style — "Morris, Chris" <chris.morris@...>
First, a question. If underscore_style is the Ruby norm for methods and the
Phil Tomson wrote:
Guy N. Hurst [mailto:gnhurst@hurstlinks.com] wrote:
On Sat, Mar 16, 2002 at 09:14:30AM +0900, Nathaniel Talbott wrote:
[#35900] Re: camelCase and underscore_style — Andrew Hunt <andy@...>
>I noticed code samples in the pickaxe book used camelCase. Dave/Andy, was
[#35929] Reading from a string — David Corbin <dcorbin@...>
Is there a class that provides the IO interface from a String? It seems
Hi,
On Sat, 2002-03-16 at 07:33, nobu.nokada@softhome.net wrote:
On Sat, Mar 16, 2002 at 05:28:27PM +0900, Thomas Sondergaard wrote:
[#35937] rpkg 0.3.1 — Massimiliano Mirra <list@...>
rpkg is a system for quick installation, removal, and browsing of Ruby
On 3/15/02 6:00 PM, "Massimiliano Mirra" <list@chromatic-harp.com> wrote:
[#35947] Newbie problem — Liorean <Liorean@...>
In a small program I wrote at school, using mswin32, I used $stdin to get
Hi,
At 15:43 2002-03-16 +0900, nobu.nokada@softhome.net wrote:
Hi,
At 17:23 2002-03-16 +0900, nobu.nokada@softhome.net wrote:
Hi,
At 16:26 2002-03-17 +0900, nobu.nokada@softhome.net wrote:
[#35973] how does gtk curve work? — Massimiliano Mirra <list@...>
I'm trying to initialize the curve in the Gtk::Curve widget.
[#35986] Good example Ruby program? — jennyw <jennyw@...>
I was hoping someone could suggest a good example Ruby program for me to
I haven't read it yet (planning on buying it), but I understand that
I totally agree with Dennis. I own "The Ruby Way" by Hal Fulton.
[#35989] ANN: Locana GUI and GUI Builder version 0.81 — Michael Davis <mdavis@...>
I am pleased to announce release 0.81 of Locana. Locana is a GUI
[#35992] XPath — Michael Schuerig <schuerig@...>
Tobias Reif wrote:
[#36004] Rubicon -> Test::Unit — Bil Kleb <W.L.Kleb@...>
Are there plans a foot for Rubicon to use Test::Unit?
[#36034] Mini Rant: Indenting — Thomas Hurst <tom.hurst@...>
Why is it that I see *so* much code like:
Thomas Hurst <tom.hurst@clara.net> writes:
[#36042] instance_respond_to? — Thomas Sondergaard <tsondergaard@...>
Shouldn't module have an instance_respond_to? method?
[#36049] web templating for static sites? — Massimiliano Mirra <list@...>
I'm using the Template Toolkit for generating static web sites and I
> I am fascinated by the approach of tools like Iowa or Walrus, and how
Massimiliano Mirra <list@chromatic-harp.com> wrote in message news:<20020317204303.C5717@prism.localnet>...
On Mon, Mar 18, 2002 at 04:23:46PM +0900, Patrick May wrote:
Massimiliano Mirra <list@chromatic-harp.com> wrote in message news:<20020319153126.B3694@prism.localnet>...
How do you Ruby/HTML guys deal with the different versions of
Albert Wagner wrote:
> People who don't care about current standards or nice
Jason Voegele wrote:
> > I apologize for continuing an off-topic thread, but I've heard several
* Carl Parrish (cparrish@cox.net) wrote:
[#36052] Xml Serialization for Ruby — "Chris Morris" <chrismo@...>
=Xml Serialization for Ruby
On Mon, Mar 18, 2002 at 05:20:56AM +0900, Chris Morris wrote:
> </MyClass>
On Mon, Mar 18, 2002 at 12:51:14PM +0900, Chris Morris wrote:
> These two are mostly equivalent. The main reasons I prefer the first
> I agree that that smells ... the inconsistency of "root element is class
Hi Chris,
[#36067] eval/Module question — David Corbin <dcorbin@...>
If I have a String src that is similar to the following:
Let me try again.
[#36093] Test::Unit GTk GUI — Bil Kleb <W.L.Kleb@...>
While trying to get a "green bar" with Test::Unit using the GTk
Bil Kleb wrote:
Bil Kleb [mailto:W.L.Kleb@LaRC.NASA.Gov] wrote:
[#36107] Extconf.rb: how to add specific include/lib dirs? — "Paul E.C. Melis" <melis@...>
Is it possible to specify a complete include or lib directory that is needed
[#36142] Why is Ruby so slow? — Venherm.Borchers@... (Venherm Borchers)
WHY IS RUBY SO SLOW?
Venherm Borchers wrote:
Kent Dahl wrote:
[#36157] Development of Windows version of Ruby — ptkwt@...1.aracnet.com (Phil Tomson)
Now that we've dumped the cygwin requirement for the Windows version of
Something like all the PC programs in the world are written for Windows.
On Tue, 19 Mar 2002 14:05:27 GMT, "Albert L. Wagner" <alwagner@uark.edu> wrote:
Dennis Newbold <dennisn@pe.net> wrote in message news:<Pine.GSO.3.96.1020320113603.22242B-100000@shell2>...
Some thoughts on the 2 first Windows issues, plus a 4th one...
"Christian Boos" <cboos@bct-technology.com> writes:
Hi,
nobu.nokada@softhome.net writes:
Hi,
A couple of times I've posted questions to this list,
[#36171] Weekly RCR Summary — RubyGarden@...
This is an automatically generated list of Ruby Change Requests.
[#36175] Wanted: slick rubyesqe algorithm — David Corbin <dcorbin@...>
Say I've got a list of Objects
On Tue, Mar 19, 2002 at 09:36:59AM +0900, David Corbin wrote:
[#36211] dots in Dir.entries — matz@... (Yukihiro Matsumoto)
Hi,
At 4:22 PM +0900 3/19/02, Yukihiro Matsumoto wrote:
[#36231] style choice — Ron Jeffries <ronjeffries@...>
A style question for the community ... which of the following do you prefer, and
[#36294] RE: Development of Windows version of Ruby — "Morris, Chris" <chris.morris@...>
Here's an overview of fork on Windows with Perl. (Google rocks):
[#36298] Other than fork, what is vc++ ruby win missing? — "Morris, Chris" <chris.morris@...>
Is there anything other than fork (remember popen works) that Ruby on
On Tue, 19 Mar 2002 18:27, Morris, Chris wrote:
[#36301] another Test::Unit question — Pat Eyler <pate@...>
Okay, so I'm moving along doing unit testing to build a small application
[#36310] Re: Why is Ruby so slow? - Solution — Venherm.Borchers@... (Venherm Borchers)
Dear colleagues,
[#36318] Increased traffic? — Massimiliano Mirra <list@...>
Is it just my impression or has the traffic on the list increased
[#36322] Why no String#bin? — ptkwt@...1.aracnet.com (Phil Tomson)
We've got:
[#36345] ANN: REXML 2.0 — Sean Russell <ser@...>
I have a feeling there will only be three major revisions of REXML. Version
[#36367] Newsfeed dropping messages? — Bil Kleb <W.L.Kleb@...>
I read via the newsgroup gateway, i.e., news://comp.lang.ruby
[#36396] Archives — Massimiliano Mirra <list@...>
Those interested in archive-like containers like Tar and Zip but also
[#36401] building latest cvs ruby on win — "Morris, Chris" <chris.morris@...>
I'm trying to build the latest cvs on Windows with msvc ... I found the
[#36402] Ruby/Tk on OSX — jack_d_herrington@... (Jack Herrington)
Has anyone had any success running Ruby/Tk on OSX.
[#36423] Linux Journal Ruby article — mike@... (Mike Stok)
I just noticed this ... http://www.linuxjournal.com//article.php?sid=5915
Mike Stok wrote:
[#36448] Ruby speak — Carl Parrish <cparrish@...>
[#36491] erb: how to include(import,load) another erb file? — Norbert Gawor <ngawor@...>
Sorry for not being able to find this by myself,
[#36580] www.selfruby.de — "Jonas Hoffmann" <ruby@...>
Hallo !
[#36597] RE: Hello! Can you help me? — "Morris, Chris" <chris.morris@...>
> -Can you tel me that ,is a way for convert Ruby source to .EXE file?
[#36608] Unicode in Regexp followup — ser@... (Sean Russell)
In fact, the unicode regular expressions have problems with the
[#36610] Re: Windows version of Ruby (proposals) — Ron Jeffries <ronjeffries@...>
On Thu, 21 Mar 2002 14:11:55 GMT, Dave Thomas <Dave@PragmaticProgrammer.com> wrote:
Another dumb question about syntax, but I haven't been
> I think Ruby is great, and I think that like it or not, Windows has
[#36613] Unicode in Regexp (a question) — ser@... (Sean Russell)
Does anybody know how to specify UTF-8 characters in regular
[#36617] Etiquette of RCRs — Chris Gehlker <gehlker@...>
I have a specific addition I would like to see in mkmf. I also have some
Hi,
On 3/22/02 8:30 PM, "nobu.nokada@softhome.net" <nobu.nokada@softhome.net>
[#36642] extracting multi-line <a> tags? — Tobias DiPasquale <anany@...>
Hi all,
[#36644] ruby-gtk fatal error — Patrik Sundberg <ps@...>
hi,
[#36645] Ruby for Mac OS 10.1 — Jim Freeze <jim@...>
Hi:
Chris Gehlker <gehlker@fastq.com> wrote:
On 3/25/02 1:19 PM, "Jayce Piel" <jayce@mosx.net> wrote:
On Tue, Mar 26, 2002 at 10:25:57AM +0900, Chris Gehlker wrote:
In article <1f9nwp5.1k8346q140f6ocN%jayce@mosx.net>,
[#36670] sendmail undisclosed-recipients — "Chris Morris" <chrismo@...>
Have the following code:
[#36690] CGI testing — "Norman Makoto Su" <normsu@...>
Hi,
[#36691] ruby-dev summary 16301-16500 — Minero Aoki <aamine@...>
Hi all,
[#36712] ruby -n -e doesn't find things ... — Ron Jeffries <ronjeffries@...>
I'm confused. This line
[#36721] How to split an Array efficiently? + non-inplace Delete_if —
Hi,
[#36726] A mode-ruby.el for xemacs ? — jayce@... (Jayce Piel)
[#36733] dbm/gdbm/sdbm — Urban Hafner <ruby-lists@...>
Hey hey,
[#36768] Re: Difference between 'do' and 'begin' — Clemens Hintze <c.hintze@...>
In <slrna9ulvi.f2h.mwg@fluffy.isd.dp.ua> Wladimir Mutel <mwg@fluffy.isd.dp.ua> writes:
james@rubyxml.com wrote:
On Tue, 2002-03-26 at 11:27, Kent Dahl wrote:
Hi,
> Using direct translation, we use "block" for the former (do), "statement
[#36771] yield in iterator's body - — Wladimir Mutel <mwg@...>
Can we write in Ruby something like this :
[#36808] Error calling Tk in a loop — <james@...>
I'm trying to write some code that pops up a Tk window when for certain
Hi,
[#36829] Experience with larger web-projects in Ruby? — "Jonas Delfs" <jonas@...>
Hi -
[#36841] RE: Windows version of Ruby (proposals) — "Andres Hidalgo" <sol123@...>
I believe that Ruby has a place in windows (Office), I happened to have
I looked in the FAQ and didn't see this, but can someone give me their opinion
[#36863] Hash.new(Hash.new) doesn't use Hash.new as default value — "Jonas Delfs" <jonas@...>
Hi -
>>>>> "J" == Jonas Delfs <jonas@NOSPAMdelfs.dk> writes:
"Yukihiro Matsumoto" <matz@ruby-lang.org> skrev i en meddelelse
"Jonas Delfs" <jonas@NOSPAMdelfs.dk> writes:
Hi,
[#36871] RE: File change notification? — Dale Martenson <dmartenson@...>
Hello,
[#36879] Ruby SWIG problems — "James Adam" <james@...>
Hi
[#36882] Webrick book ?? — Markus Jais <mjais@...>
hello
[#36910] Variable variables in Ruby? — "Jonas Delfs" <jonas@...>
Hi -
[#36934] parsing strings into numbers — "Chris Morris" <chrismo@...>
Ruby knows that:
[#36944] Anyone in or around Bergen want to talk Ruby? — Dave Thomas <Dave@...>
[#36977] Dir.glob => Enumerable.glob? — Thomas Sdergaard <thomass@...>
Why not?
[#36990] rubydbi in debian? — Tom Robinson <tom@...>
It would be nice to have this as a package in debian. Any ruby debian
On Fri, 29 Mar 2002 12:00:22 GMT, Massimiliano Mirra
[#37005] Matz's book ?? — Markus Jais <info@...>
hello
[#37009] optimization questions — George Moschovitis <gmosx@...>
Hi there,
[#37010] Now that's surprising. — Chris Gehlker <gehlker@...>
Does anyone else think that the following little program is an instance of
[#37036] My sprintf methods and props for FXRuby — Jonathan Gillette <jonathan@...>
I've had a blast with Ruby over the past seven or so months and thought I'd pass on a bit of favorite code. I always find myself laying out my strings with sprintf and found it handy to add sprintf methods to arrays, hashes, and the REXML::Element class. I thought someone else might find this useful or might clue me in on some optimizations.
[#37038] RUNIT: mixin instead of inheriting? — ptkwt@...1.aracnet.com (Phil Tomson)
[#37043] Creating an instance of a class without calling initialize() — harryo@... (Harry Ohlsen)
For reasons that I'll go into if someone's interested,
[#37060] Re: Creating an instance of a class without calling initialize() — "Joseph Girgis" <jbgirgis@...>
Why don't you want the initialize() method?
"Joseph Girgis" <jbgirgis@msn.com> wrote in message news:<OE74EzcT1ePyu91wCJW00002df4@hotmail.com>...
[#37080] Why isn't Math object-oriented? — Bil Kleb <W.L.Kleb@...>
So I'm reading along in the Pixaxe book (yet again), and I am told
On Sun, 31 Mar 2002 15:44:46 GMT, matz@ruby-lang.org (Yukihiro Matsumoto) wrote:
Hi,
[#37093] Timezone name -> UTC hour offset? — Sean Chittenden <sean@...>
Is there any way of going from -0800 to (PST|PDT) ? Is there a module
Sean Chittenden wrote:
[#37115] rbot - ruby IRC bot — Tom Gilbert <tom@...>
Hi,
i've not used ruby for that long, but i've found the need to do the
[#37119] Detecting class variables.... — Sean Chittenden <sean@...>
I have a class that will have many objects and each object has a
Hello --
> > I have a class that will have many objects and each object has a
Hi --
[#37121] String#begins?(s) — timsuth@... (Tim Sutherland)
class String
Hi,
Re: ruby-gtk fatal error
On Sun, Mar 24, 2002 at 11:23:35AM +0900, Neil Conway wrote:
> On Sat, 2002-03-23 at 17:24, Patrik Sundberg wrote:
> > I can't seem to come up with a small script exhibiting this behaviour.. My
> > application uses libglade and is about 600 lines of code. I tried adding the
> > code which seems to make my app break to helloworld.rb but it doesn't behave
> > similair.. Would you like to see the code which do show the problem even
> > though it is a bit larger?
>
> Yes, please.
ok. here it goes, but I don't think it is very easy to follow.
as you can see this isn't very easy to debug. I have a server listening on a
remote computer which gives outside access to a Samba network and a gui which
uses this gateway to get files from the samba network. it is an application to
search for files on a student network when not on this network (since i live
in a non-student apartment). perhaps it can also have something to do with the
module mp3list which handles searches to a BIG list of files (the file is
around 25Mb) which mmaps the indexfile in a c-module for performance reasons.
[outsider.rb]:
#!/usr/local/bin/ruby
require 'gtk'
require 'lglade'
require 'gdk_imlib'
require 'gnome'
require 'zip'
require 'mp3list'
require 'smbgw/client'
# constants
GLADEFILE='/usr/local/share/examples/ruby/outsider'
LISTFILENAME = 'SUBnets MP3Lista - MP3Get'
LISTFILEMIRRORS = ['//Perry/MP3 Listan/',
'//Proffe/MP3Listan/',
'//n243/MP3Lista',
'//area26/mp3listan/']
UPDATE_INTERVAL = 60*60*24*3
BLOCKSIZE = 1024*400
class Download
NATIVE = 0
SAMBA = 1
def initialize(opened_file, type, local_path)
@remote_file, @type = opened_file, type
@local_file = File.new(local_path, "w")
@cancelled = false
end
def start(blocksize=8192)
end
def cancel
@cancelled = true
end
def cancelled?
@cancelled
end
end
class SearchResultMenu
def initialize(selected_files)
@selected_files = selected_files
@glade = GladeXML.new($OUTSIDERGLADEFILE, "searchresult_menu") {|h|
method(h)
}
@menu = @glade.getWidget('searchresult_menu')
@menu.popup(nil,nil,nil,3,Time.now.to_i)
end
private
def download
print "download\n"
if $global_config.use_smb_gw and $global_config.gw_type = 'UNIX'
smb_url = "smb:"+(@selected_files[0].path+@selected_files[0].filename).gsub(/\\/, '/')
$pending_downloads << smb_url
elsif $global_config.use_smb_gw and $global_config.gw_type = 'WIN32'
$stdout.print "Not yet implemented!\n"
elsif not $global_config.use_smb_gw and $global_config.gw_type = 'UNIX'
$stdout.print "Not yet implemented!\n"
elsif not $global_config.use_smb_gw and $global_config.gw_type = 'WIN32'
$stdout.print "Not yet implemented!\n"
end
end
def download_one_of
print "download_one_of\n"
end
def list_directory
print "list_directory\n"
end
def download_directory
print "download_directory\n"
end
def resume_incomplete_download
print "resume_incomplete\n"
end
end
class DownloadMenu
def initialize(downloads)
p downloads
end
end
class MainWindow
def initialize
@glade = GladeXML.new($OUTSIDERGLADEFILE, "main_window") {|h|
method(h)
}
@main_window = @glade.getWidget('main_window')
@search_e = @glade.getWidget('search_e')
@g = @glade.getWidget('maxresults_sb')
@maxdownloads_sb = @glade.getWidget('maxdownloads_sb')
@re_exact_match_cb = @glade.getWidget('re_exact_match_cb')
@re_case_sensitive_cb = @glade.getWidget('re_case_sensitive_cb')
@filetype_e = @glade.getWidget('filetype_e')
@files_searchtype_rb = @glade.getWidget('files')
@dirs_searchtype_rb = @glade.getWidget('dirs')
@both_searchtype_rb = @glade.getWidget('both')
@search_results = @glade.getWidget('search_results')
@downloads = @glade.getWidget('downloads')
@statusbar = @glade.getWidget('statusbar')
@sb_context = @statusbar.get_context_id('MainWin')
update_gui
end
def update_gui
@g.set_value($global_config.maxresults)
@maxdownloads_sb.set_value($global_config.maxdownloads)
@re_exact_match_cb.active = $global_config.re_exact_match
@re_case_sensitive_cb.active = $global_config.re_case_sensitive
end
def show
filename = ENV['HOME']+'/.outsider/'+LISTFILENAME+'.txt'
if not test(?e, filename)
update_mp3list
end
@list = Mp3List::List.new(filename)
if Time.now - File.stat(filename).mtime > UPDATE_INTERVAL
update_mp3list
end
@main_window.show
end
def update_downloadlist
print "update_downloadlist\n"
end
protected
def update_config
$global_config.re_exact_match = @re_exact_match_cb.active
$global_config.re_case_sensitive = @re_case_sensitive_cb.active
$global_config.maxresults = @g.get_value_as_int()
$global_config.maxdownloads = @maxdownloads_sb.get_value_as_int()
end
def quit
exit(0)
#Gtk.main_quit
end
def resume_incomplete_downloads
print "resume_incomplete\n"
end
def config
update_config
config_window = ConfigWindow.new
config_window.show
end
def searchresult_clicked(widget, event, data)
return unless event.button == 3
print "searchresult_clicked\n"
selected_files = Array.new
@search_results.each_selection {|row|
result = @search_results.get_row_data(row)
selected_files << result
}
if selected_files.size == 0
return
end
SearchResultMenu.new(selected_files)
@search_results.unselect_all
end
def download_clicked
print "download_clicked\n"
downloads = Array.new
@downloads.each_selection {|row|
download = @downloads.get_row_data(row)
downloads << download
}
if downloads.size == 0
return
end
DownloadMenu.new(downloads)
end
def about
print "about\n"
end
def search
@statusbar.push(@sb_context, "Searching..")
@search_results.clear
@timeout_id = Gtk.timeout_add(100) { real_search }
end
def real_search
Gtk.timeout_remove(@timeout_id)
update_config
if $global_config.re_exact_match
expression = @search_e.get_text()
else
#InfoBox.new('Non-exact regular expression searches aren\' supported yet.')
$stderr.print 'Non-exact regular expression searches aren\' supported yet.\n'
return
end
if @files_searchtype_rb.active
search_type = Mp3List::SEARCH_FILES
elsif @dirs_searchtype_rb.active
search_type = Mp3List::SEARCH_DIRS
else
search_type = Mp3List::SEARCH_BOTH
end
results = Mp3List::Search.new(@list,
expression,
$global_config.re_case_sensitive,
search_type,
Mp3List::TYPE_ANY,
0,
$global_config.maxresults)
i = 0
results.each {|result|
@search_results.append([result.filename, result.size.to_s, result.path])
@search_results.set_row_data(i, result)
i += 1
}
@statusbar.pop(@sb_context)
@statusbar.push(@sb_context, "Found #{results.size} results.")
end
def re_exact_match_toggle
print "re_exact_match_toggle\n"
end
def re_case_sensitive_toggle
print "re_case_sensitive_toggle\n"
end
def update_mp3list
print "update_mp3list\n"
glade = GladeXML.new($OUTSIDERGLADEFILE, "update_window") {|h|
method(h)
}
@update_window = glade.getWidget('update_window')
@progressbar = glade.getWidget('progressbar')
@progressbar.set_percentage(0.0)
@update_window.show
@timeout_id = Gtk.timeout_add(100) { real_update_mp3list }
end
def real_update_mp3list
Gtk.timeout_remove(@timeout_id)
Thread.new {
filename = ENV['HOME']+'/.outsider/'+LISTFILENAME+'.zip'
gw = SMBGw::Gateway.new($global_config.gw_host,
$global_config.gw_user,
$global_config.gw_password)
remote = nil
LISTFILEMIRRORS.each {|dir|
begin
remote = SMBGw::File.new(gw,'smb:'+dir+LISTFILENAME+'.zip',"r")
break
rescue Exception => e
next
end
}
if remote.nil?
print "Couldn't update list!\n"
return
end
@list.destroy
=begin
local = File.new(filename, "w")
lsize = 0
rsize = remote.size
until remote.eof?
written = local.write(remote.read(BLOCKSIZE))
lsize += written
@progressbar.set_percentage(lsize.to_f/rsize.to_f)
$stdout.flush
end
=end
remote.close
# local.close
p 'innan zip'
p "/usr/local/bin/unzip -o #{filename}"
p 'efter zip'
p filename[0..-4]+'txt'
@list = Mp3List::List.new(filename[0..-4]+'txt')
p 'ny lista..'
}
end
end
class Config
attr_accessor :dlpath, :incompletepath, :maxresults, :maxdownloads, :re_exact_match, :re_case_sensitive
attr_accessor :use_smb_gw, :gw_host, :gw_port, :gw_user, :gw_password, :gw_type
def initialize
@dlpath = ENV['HOME']+'/mp3/dl'
@incompletepath = ENV['HOME']+'/mp3/dl/incomplete'
@maxresults = 300
@maxdownloads = 1
@re_exact_match = true
@re_case_sensitive = false
@use_smb_gw = true
@gw_host = 'smbgw.ryd.student.liu.se'
@gw_port = 31337
@gw_type = 'UNIX'
@gw_user = 'yourUsername'
@gw_password = 'secretPassword'
end
def gw_object
SMBGw::Gateway.new(@gw_host, @gw_user, @gw_password, @gw_port)
end
end
class PathDialog
def initialize(parent, msg, current_file)
@glade = GladeXML.new($OUTSIDERGLADEFILE, "path_dialog") {|h|
method(h)
}
@parent, @msg, @current_file = parent, msg, current_file
@dialog = @glade.getWidget("path_dialog")
@dialog.set_filename(@current_file)
end
def show
@dialog.show
end
def close_window
@dialog.destroy
end
protected
def ok
@parent.send @msg, @dialog.get_filename
close_window
end
def cancel
@parent.send @msg, @current_file
close_window
end
end
class ConfigWindow
def initialize
# created from FirstTimeWindow or setupGUI() ?
if defined? $global_config
@first_time = false
else
@first_time = true
$global_config = Config.new
end
# get widgets
@glade = GladeXML.new($OUTSIDERGLADEFILE, "config_window") {|h|
method(h)
}
@config_window = @glade.getWidget('config_window')
@dlpath_e = @glade.getWidget('dlpath_e')
@incompletepath_e = @glade.getWidget('incompletepath_e')
@maxresults_sb = @glade.getWidget('maxresults_sb')
@maxdownloads_sb = @glade.getWidget('maxdownloads_sb')
@re_exact_match_cb = @glade.getWidget('re_exact_match_cb')
@re_case_sensitive_cb = @glade.getWidget('re_case_sensitive_cb')
@use_smb_gw_cb = @glade.getWidget('use_smb_gw_cb')
@gw_host_e = @glade.getWidget('gw_host_e')
@gw_port_e = @glade.getWidget('gw_port_e')
@gw_type_e = @glade.getWidget('gw_type_e')
@gw_user_e = @glade.getWidget('gw_user_e')
@gw_password_e = @glade.getWidget('gw_password_e')
# update with relevant configuration
@dlpath_e.set_text($global_config.dlpath)
@incompletepath_e.set_text($global_config.incompletepath)
@maxresults_sb.set_value($global_config.maxresults)
@maxdownloads_sb.set_value($global_config.maxdownloads)
@re_exact_match_cb.active = $global_config.re_exact_match
@re_case_sensitive_cb.active = $global_config.re_case_sensitive
@use_smb_gw_cb.active = $global_config.use_smb_gw
@gw_host_e.set_text($global_config.gw_host)
@gw_port_e.set_text($global_config.gw_port.to_s)
@gw_type_e.set_text($global_config.gw_type)
@gw_user_e.set_text($global_config.gw_user)
@gw_password_e.set_text($global_config.gw_password)
end
def show
@config_window.show
end
def update_downloadpath(path)
@dlpath_e.set_text(File.dirname(path))
end
def update_incompletepath(path)
@incompletepath_e.set_text(File.dirname(path))
end
protected
def ok
$global_config.dlpath = @dlpath_e.get_text()
$global_config.incompletepath = @incompletepath_e.get_text()
$global_config.maxresults = @maxresults_sb.get_value_as_int()
$global_config.maxdownloads = @maxdownloads_sb.get_value_as_int()
$global_config.re_exact_match = @re_exact_match_cb.active
$global_config.re_case_sensitive = @re_case_sensitive_cb.active
$global_config.use_smb_gw = @use_smb_gw_cb.active
$global_config.gw_host = @gw_host_e.get_text()
$global_config.gw_port = @gw_port_e.get_text()
$global_config.gw_type = @gw_type_e.get_text()
$global_config.gw_user = @gw_user_e.get_text()
$global_config.gw_password = @gw_password_e.get_text()
save_config()
if @first_time
$main_window = MainWindow.new
$main_window.show
else
$main_window.update_gui
end
@config_window.destroy
end
def cancel
Gtk.main_quit if @first_time
@config_window.destroy
end
def get_downloadpath
PathDialog.new(self, :update_downloadpath, $global_config.dlpath).show
end
def get_incompletepath
PathDialog.new(self, :update_incompletepath, $global_config.incompletepath).show
end
end
class FirstTimeWindow
def initialize
@glade = GladeXML.new($OUTSIDERGLADEFILE, "first_time_window") {|h|
method(h)
}
@first_time_window = @glade.getWidget('first_time_window')
$config_window = ConfigWindow.new
@first_time_window.show
end
def show_config_window
$config_window.show
@first_time_window.destroy
end
def close
Gtk.main_quit
end
end
def save_config()
if not test(?e, ENV['HOME']+'/.outsider')
Dir.mkdir(ENV['HOME']+'/.outsider')
end
File.open(ENV['HOME']+'/.outsider/conf', "w") {|f|
f.puts("# Automatically generated config file - do not edit!")
f.puts("dlpath = #{$global_config.dlpath}")
f.puts("incompletepath = #{$global_config.incompletepath}")
f.puts("maxresults = #{$global_config.maxresults}")
f.puts("maxdownloads = #{$global_config.maxdownloads}")
f.puts("re_exact_match = #{$global_config.re_exact_match}")
f.puts("re_case_sensitive = #{$global_config.re_case_sensitive}")
f.puts("use_smb_gw = #{$global_config.use_smb_gw}")
f.puts("gw_host = #{$global_config.gw_host}")
f.puts("gw_port = #{$global_config.gw_port}")
f.puts("gw_type = #{$global_config.gw_type}")
f.puts("gw_user = #{$global_config.gw_user}")
f.puts("gw_password = #{$global_config.gw_password}")
f.puts("# End of configuration file")
}
end
def parse_config(file)
while file.gets
case $_
when /dlpath\s*=\s*(.*)/
dlpath = $1
when /incompletepath\s*=\s*(.*)/
incompletepath = $1
when /maxresults\s*=\s*(.*)/
maxresults = $1.to_i
when /maxdownloads\s*=\s*(.*)/
maxdownloads = $1.to_i
when /re_exact_match\s*=\s*(.*)/
re_exact_match = ($1 == 'true')
when /re_case_sensitive\s*=\s*(.*)/
re_case_sensitive = ($1 == 'true')
when /use_smb_gw\s*=\s*(.*)/
use_smb_gw = ($1 == 'true')
when /gw_host\s*=\s*(.*)/
gw_host = $1
when /gw_port\s*=\s*(.*)/
gw_port = $1.to_i
when /gw_type\s*=\s*(.*)/
gw_type = $1
when /gw_user\s*=\s*(.*)/
gw_user = $1
when /gw_password\s*=\s*(.*)/
gw_password = $1
when /^\s+|^\#/
next
else
$stderr.print "Syntax error in con/figuration file at line "+
"#{$.}:\n==> #{$_}\nPlease correct manually or remove configfile.\n"
exit(1)
end
end
begin
$global_config = Config.new
$global_config.dlpath = dlpath
$global_config.incompletepath = incompletepath
$global_config.maxresults = maxresults
$global_config.maxdownloads = maxdownloads
$global_config.re_exact_match = re_exact_match
$global_config.re_case_sensitive = re_case_sensitive
$global_config.use_smb_gw = use_smb_gw
$global_config.gw_host = gw_host
$global_config.gw_port = gw_port
$global_config.gw_user = gw_user
$global_config.gw_password = gw_password
rescue
$stderr.print "Configuration item missing! Either fix by hand or delete ~/.outsider/conf"
exit(1)
end
end
# EXECUTION STARTS HERE!
if test(?e, GLADEFILE)
$OUTSIDERGLADEFILE = GLADEFILE
elsif test(?e, "./outsider.glade")
$OUTSIDERGLADEFILE = "./outsider.glade"
elsif test(?e, "../../share/outsider/outsider.glade")
$OUTSIDERGLADEFILE = "../../share/outsider/outsider.glade"
end
if $OUTSIDERGLADEFILE.nil?
raise "Couldn't find outsider.glade file. This should be located at #{GLADEFILE} or ./outsider.glade"
end
configfile_path = ENV['HOME']+'/.outsider/conf'
if test(?e, configfile_path)
configfile = File.open(configfile_path, "r")
parse_config(configfile)
configfile.close
$main_window = MainWindow.new
$main_window.show
else
FirstTimeWindow.new
end
$download_threads = Hash.new
$pending_downloads = []
# the download queu-handler thread
Thread.new {
loop {
if $pending_downloads.size > 0
$pending_downloads.each {|url|
# Create download thread
$download_threads[url] = Thread.new(url) {|url|
$pending_downloads.delete(url)
gw = SMBGw::Gateway.new($global_config.gw_host,
$global_config.gw_user,
$global_config.gw_password)
remote = SMBGw::File.new(gw, url, "r")
local = File.new(url.split('/')[-1], "w")
until remote.eof?
local.write(remote.read(BLOCKSIZE))
print "#"
$stdout.flush
Thread.pass
end
remote.close
local.close
$download_threads.delete(url)
}
}
end
sleep(1)
}
}
Gtk.main
[end of outsider.rb]
the utility-file used which contains the socket operations:
[smbgw/client.rb]
#-
# Copyright (c) 2001 Patrik Sundberg, Raditex AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id: client.rb,v 1.2 2002/03/24 00:05:09 ps Exp $
require 'socket'
module SMBGw
class Gateway
attr_accessor :host, :username, :password, :port
def initialize(host, username, password, port=31337)
@host, @username, @password, @port = host, username, password, port
end
end
class File
def initialize(gw, url, mode)
@socket = TCPSocket.new(gw.host, gw.port)
@socket.puts("auth #{gw.username} #{gw.password}")
res = @socket.gets.chomp
if res != 'OK'
raise "Failed to authenticate user with gateway!"
end
@socket.puts("open_file #{mode} #{url}")
error_check(@socket.gets.chomp)
end
def read(blocksize=1024)
@socket.puts("read #{blocksize.to_s}")
res = @socket.gets.chomp
unless error_check(res)
size = @socket.gets.chomp.split[1].to_i
return @socket.read(size)
end
end
def write(data)
end
def eof?
@socket.puts('eof?')
res = @socket.gets.chomp
res == 'TRUE' unless error_check(res)
end
def pos
@socket.puts('pos')
res = @socket.gets.chomp
res unless error_check(res)
end
def pos=(position)
@socket.puts("pos= #{position.to_s}")
res = @socket.gets.chomp
true unless error_check(res)
end
def close
@socket.puts('close')
res = @socket.gets.chomp
@socket.close
true unless error_check(res)
end
def size
@socket.puts('size')
res = @socket.gets.chomp
res.to_i unless error_check(res)
end
private
def error_check(msg)
if msg =~ /ERROR\s+(.*)/
raise "SMBGw::File error: #{$1}"
else
return false
end
end
end
class Dir
end
end
[end of client.rb]
--
---------------------------------------------------------------------------.
Patrik Sundberg Address: Rydsv臠en 100C, 584 31 Linking, Sweden |
Email: ps@raditex.se || ps@radiac.mine.nu |
Phone: +46 13 178567 || +46 707 602240 |
.---> Applied Physics and Electrical Engineering student |
|-----> Master of Science in Business Administration and Economics student |
|-------> UNIX/Programming consultant |
`--------------------------------------------------------------------------'