[#390730] break from a loop which is run on a xml — "mythpills P." <pillay.mithun@...>
how do i loop through a xml and break when i find the node with a
[#390738] Is it useful to run GC.start periodically? — Iñaki Baz Castillo <ibc@...>
Hi, I've a server based on Ruby EventMachine. I'm wondering if it
[#390740] GC.malloc_allocated_size and GC.malloc_allocations not available (#if CALC_EXACT_MALLOC_SIZE) — Iñaki Baz Castillo <ibc@...>
Hi, using Ruby 1.9.3 I cannot use methods GC.malloc_allocated_size and
I単aki Baz Castillo <ibc@aliax.net> wrote:
2011/12/1 Eric Wong <normalperson@yhbt.net>:
[#390745] yaml.h is missing / Failed to configure psych. — Fearless Fool <r@...>
I'm doing a fresh sandboxed install of Ruby 'n Rails 'n such. The
[#390746] RTensor v0.0.1 Released — Admin Tensor <admin@...>
Hi,
[#390748] embedded ruby event hooks — Steve Hart <steve@...>
Hi
[#390749] Why are there so many similar/identical methods in core classes — Kassym Dorsel <k.dorsel@...>
Let's look at the Array class and start with method aliases.
Ah. The reason why I wrote "minimalistic syntax" is because I do agree
[#390752] net/sftp hangs — "Peyman O." <peymano@...>
Hi all,
[#390755] Inverse Operation of Module#include — Su Zhang <su.comp.lang.ruby@...>
Hi list,
I would suggest an Adapter pattern use here. IF there is something that has
Abstract base classes are silly in Ruby; why bother with that
On Fri, Dec 2, 2011 at 1:49 PM, Steve Klabnik <steve@steveklabnik.com>wrote:
On Fri, Dec 2, 2011 at 7:28 PM, Peter Vandenabeele
[#390763] Using OpenSSL for making a network TLS server — Iñaki Baz Castillo <ibc@...>
Hi, Ruby EventMachine has some issues in its TLS implementation (coded
Ruby's OpenSSL library has an SSLServer class that will do exactly what
2011/12/2 John Downey <jdowney@gmail.com>:
2011/12/2 I=C3=B1aki Baz Castillo <ibc@aliax.net>:
Any suggestion about this please? Maybe the only response is that
[#390768] Native extension: arguments as a hash — "Darryl L. Pierce" <mcpierce@...>
I'm working on a native extension in C for Ruby 1.8.7. The method I'm
[#390777] rake --dry-run: how to see what sh commands will be run? — La Wi <lw2011@...>
I am trying to set up some rules to build files with locally installed
[#390788] How to write a sorting program — Samuel Mensah <sasogeek@...>
I'm supposed to write my own sorting method for a list of words entered
[#390795] Is there a better way to check this array? — Wayne Brissette <wbrisett@...>
I have an array which contains items that need to be renamed. =
Wayne Brissette wrote in post #1034881:
Thanks. Both of these have given me more food for thought. I knew grep =
On Sat, Dec 3, 2011 at 2:06 PM, Wayne Brissette <wbrisett@att.net> wrote:
[#390804] Dynamic instances of a class. — "Andres M." <andres.mrad@...>
Hi everyone, i'm really new to ruby and i'm trying to solve the next
OK, hate to multi-post, but wanted to let you know that i made it, is =
[#390808] help with recursive method def'n using eval — Chuck Remes <cremes.devlist@...>
I would like to solve a problem where a writer of a class can provide an array of fields and those fields are turned into two things.
On Saturday, December 3, 2011 4:44:58 PM UTC-5, Chuck Remes wrote:
On Dec 3, 2011, at 8:49 PM, Intransition wrote:
On Sun, Dec 4, 2011 at 9:57 AM, Chuck Remes <cremes.devlist@mac.com> wrote:
[#390833] 'open().each' doesn't close file — Mc Ben <viertelvor12@...>
On Ruby 1.9.3 (win7(64))
On Sun, Dec 4, 2011 at 1:47 PM, Mc Ben <viertelvor12@gmx.net> wrote:
On Sun, Dec 4, 2011 at 08:19, Michael Fellinger <m.fellinger@gmail.com> wro=
On 12/04/2011 06:27 PM, Dave Aronson wrote:
On Sun, Dec 4, 2011 at 21:47, Joel VanderWerf <joelvanderwerf@gmail.com> wrote:
[#390841] Using DATA_PTR in multiple methods — "Matthew S." <mattbastard@...>
I'm writing a Ruby extension in C to utilize a library (tsk3, aka. The
[#390876] black magical hash element vivification — Chad Perrin <code@...>
Ruby (1.9.3p0 to be precise, installed with RVM) is not behaving as I
On Mon, Dec 5, 2011 at 16:28, Chad Perrin <code@apotheon.net> wrote:
On Mon, Dec 5, 2011 at 5:28 PM, Chad Perrin <code@apotheon.net> wrote:
On Tue, Dec 06, 2011 at 01:40:17AM +0900, Jes俍 Gabriel y Gal疣 wrote:
[#390918] WEB SURVEY about Ruby Community — Intransition <transfire@...>
Did any one else get this survey request?
On Wed, Dec 7, 2011 at 12:23 AM, Intransition <transfire@gmail.com> wrote:
On Wed, Dec 7, 2011 at 14:02, Josh Cheek <josh.cheek@gmail.com> wrote:
[#390923] binman 2.0.0 — "Suraj N. Kurapati" <sunaku@...>
[#390942] Truncation using Pixels — "Dhanuja B." <thanuja_16@...>
Is there any method available to truncate string based on Pixels in
[#390951] terrible_timeout 0.1.0 - an alternative to timeout — Eric Wong <normalperson@...>
This module still sucks, don't use it without knowing its caveats. Read
[#390961] Using any trick to omit () in constant lookup? — Marc Heiler <shevegen@...>
Hi.
[#390971] Removing a multiple array layer — "Sébastien M." <stkfdt@...>
Hi,
[#390972] Which is the best online document conversion site? — "Maria M." <mariamoore952@...>
Can anyone tell me that which is the best online document conversion
[#390976] Confusing results from string multiplication — Rob Marshall <robmarshall@...>
Hi,
On 08.12.2011 17:16, Rob Marshall wrote:
Hi Robert,
[#391003] how to view the structure of a hash — eggman2001 <sodani@...>
I keep finding myself trying to decipher the structure of hash objects
Syntax from memory, so please forgive errors...
[#391006] What is a good ruby tutorial / book for a beginner? — Samuel Mensah <sasogeek@...>
I have been reading Chris Pine's book for a while now and I'm stuck at
[#391019] How can I do h["foo"] += "bar" if h["foo"] does not exist? — "Andrew S." <andrewinfosec@...>
Hi there,
On Fri, Dec 9, 2011 at 11:28 AM, Andrew S. <andrewinfosec@gmail.com> wrote:
On Fri, Dec 9, 2011 at 8:38 AM, Ryan Davis <ryand-ruby@zenspider.com> wrote:
[#391027] reading from file without end-of-lines — Janko Muzykant <umrzykus@...>
hi,
> i'm trying to read a few text values from single file:
On Fri, Dec 9, 2011 at 9:58 AM, Gavin Sinclair <gsinclair@gmail.com> wrote:
On Fri, Dec 9, 2011 at 8:18 PM, Robert Klemme
On Fri, Dec 9, 2011 at 7:28 AM, Gavin Sinclair <gsinclair@gmail.com> wrote:
On Sat, Dec 10, 2011 at 1:38 AM, Josh Cheek <josh.cheek@gmail.com> wrote:
> What isn't elegant about the `&'?
On Sat, Dec 10, 2011 at 2:18 PM, Marc Heiler <shevegen@linuxmail.org> wrote:
[#391029] Learn To Program (Chris Pine) - Building and Sorting Array — Emeka Patrick <emekapatrick@...>
Hi,
On Fri, Dec 9, 2011 at 9:58 AM, Emeka Patrick <emekapatrick@gmail.com> wrot=
Hi Robert,
[#391040] CONCEPT OF INSTANCE VARIABLE IN RUBY — Manav Gupta <manavkbgupta@...>
@x = 'Hello world'
[#391058] gem build options -- how to make them persist? — Joel VanderWerf <joelvanderwerf@...>
[#391061] REST CLient Example — rubythemystery ruby <rubythemystery@...>
Hi all,
[#391074] Building a method - Learn to Program Section 9.5 — Emeka Patrick <emekapatrick@...>
In this program
[#391097] How to call a method from a different class — "Darren H." <dhulem1@...>
Hi all,
[#391101] HELP: i need to programm a traffic light an it doesn't work — "Akvile K." <akviliukasledinukas@...>
Hello Everabody,
[#391105] Scope and Instance Variable Question — Cleverlemming <cleverlemming@...>
Hail Caesars!
[#391111] How can i make this procedure into a function? — "Akvile K." <akviliukasledinukas@...>
Hello _everybody in the Ruy Community,
[#391124] enforcing module contract with self.included? — Grary Stimon <grary.stimon@...>
Hey,
[#391129] How to access Hash containing Array of Hashes ? — rubythemystery ruby <rubythemystery@...>
Can anyone give me an example of getting each individual elements of
[#391135] I need advice on what to do next. — Nathan Kossaeth <system_freak_2004@...>
I am new to programming. I read the ebook "Learn to Program" by Chris
I would like to do web programming, integration, and coding mainly. I
So basically what you're saying Marc is write a simple program that
OOP is Object Oriented Programming, Ruby is an Object Oriented Programming
[#391137] Send rtf files to printer — Glenn <glenn_ritz@...>
Hi,=0A=0AI have a hundred or so rtf files and I need to print them.=A0 I'd =
[#391151] jobQueue 1.0.1 - Running stuff with a user defined number of threads — Ralf Mueller <ralf.mueller@...>
Hi!
On Mon, Dec 12, 2011 at 11:25 AM, Ralf Mueller <ralf.mueller@zmaw.de> wrote:
On 12/12/2011 01:23 PM, Robert Klemme wrote:
[#391158] WIN32OLE taking 100% CPU utilisation — "Shareef J." <shareef@...>
Hi there,
[#391159] How to call method of one class in another class — rubythemystery ruby <rubythemystery@...>
Hi all,
[#391183] Searching an array for a pattern derived from another array — Chaim Keren-Tzion <chaim@...>
Hi,
[#391191] Fixing Net::TFTP — Reid Wightman <reid.ruby-forum@...>
Hi all -
[#391216] perf optimization using profile results — Chuck Remes <cremes.devlist@...>
I need some help with optimizing a set of libraries that I use. They are ffi-rzmq, zmqmachine and rzmq_brokers (all up on github).
On Dec 13, 2011, at 9:57 AM, Chuck Remes wrote:
A couple quick observations.
On Dec 13, 2011, at 7:03 PM, Charles Oliver Nutter wrote:
On Tue, Dec 13, 2011 at 8:03 PM, Chuck Remes <cremes.devlist@mac.com> wrote=
For those of you following along, I was able to shave off another 50 microseconds per client. I learned a few things along the way.
[#391224] Servers, Threads, and the Ruby Way -- Architecture Question — EP PG <epasquali@...>
Hi there, I'm a TOTAL Ruby newbie, but not new to programming.
EP PG wrote in post #1036583:
[#391227] how to generate a pdf calendar? — Dan Quach <danbus@...>
I want to generate a pdf calendar, and I have incoming calendar data
[#391237] How to pass a list of conditions as parameters — Thescholar Thescholar <thescholar@...>
I=E2=80=99m unsure how to explain this one so I'll do my best.
On 14/12/11 14:28, Thescholar Thescholar wrote:
On Wed, Dec 14, 2011 at 3:05 AM, Sam Duncan <sduncan@wetafx.co.nz> wrote:
[#391268] round float to integer if whole number — Ronnie Aa <liquid98@...>
Hi,
Possible tests:
Gunther Diemant wrote in post #1036785:
[#391279] Encoding woes with command promt output — Chris Lervag <chris.lervag@...>
Im working on a script which is going to be printing some non-ascii
[#391296] Writing My Own Sorting Method (New to Ruby) — Emeka Patrick <emekapatrick@...>
Hi,
[#391305] Rounding error? — Jan Hendrickx <jan@...>
Hi there,
Hi,
[#391324] ruby 1.9 threading performance goes non-linear — Joel VanderWerf <joelvanderwerf@...>
Joel VanderWerf <joelvanderwerf@gmail.com> wrote:
Eric Wong писал 17.12.2011 02:27:
Peter Zotov <whitequark@whitequark.org> wrote:
[#391337] Writing ruby to [LANGUAGE] "compiler" — Marc Heiler <shevegen@...>
Hi.
[#391338] ruby multithread — rubix Rubix <aggouni2002@...>
Hi,
[#391339] def initialize — Junayeed Ahnaf Nirjhor <zombiegenerator@...>
Hello,
[#391345] Single quoted string to become double quoted - is it possible? — "ANDREW BIZYAEV (GMAIL)" <andrew.bizyaev@...>
Hello, Ruby experts.
On Sun, Dec 18, 2011 at 05:20:19AM +0900, ANDREW BIZYAEV (GMAIL) wrote:
[#391359] Ruby, SAFE, method interception, and plugins — Garthy D <garthy_lmkltybr@...>
[#391361] Scheduling jobs on PCs after work hours — Mohit Sindhwani <mo_mail@...>
Hi All,
[#391364] Encoding problem, YARD and JSON — Intransition <transfire@...>
I have a Hash object I am trying to convert to JSON using the `json` gem.
[#391383] gtk2 TreeView question — Michel Demazure <michel@...>
Does anyone knows how to decrease the default (vertical) spacing between
[#391388] Windows, CreateFile and IO objects — Alex Young <alex@...>
I'm porting some code from Linux to Windows which relies on direct
[#391410] I am too noob to embed an interpreter in my MSVC project. Plz denoob me. — Khat Harr <myphatproxy@...>
I'm trying to embed an interpreter in a DirectX project, so I'm using
[#391420] Accessing class instance variables from an instance? — "Shareef J." <shareef@...>
Hi there,
Actually, now that I'm thinking about it the existing behavior sort of
On Tue, Dec 20, 2011 at 9:42 PM, Khat Harr <myphatproxy@hotmail.com> wrote:
On Wed, Dec 21, 2011 at 5:34 AM, Josh Cheek <josh.cheek@gmail.com> wrote:
On Wed, Dec 21, 2011 at 2:50 AM, Robert Klemme
On Wed, Dec 21, 2011 at 3:08 PM, Josh Cheek <josh.cheek@gmail.com> wrote:
On Thu, Dec 22, 2011 at 2:09 AM, Garthy D
>> In my case, I ended up solving it by adding an "abar" method that just
Concerning an attr for civ's, would it really be detrimental, though?
[#391421] "System" command — "Leo M." <leo.mmcm@...>
Hello!
[#391449] return_bang 1.0 Released — Eric Hodel <drbrain@...7.net>
return_bang version 1.0 has been released!
[#391491] vlad 2.2.4 Released — Ryan Davis <ryand-ruby@...>
vlad version 2.2.4 has been released!
On Thu, Dec 22, 2011 at 09:56:13AM +0900, Ryan Davis wrote:
[#391497] Free an Object — Tridib Bandopadhyay <tridib04@...>
Hello
[#391525] new curse in spanish for beginning ruby on rails — Curso Ruby on Rails <cursorubyonrails@...>
Hello guys!
[#391545] Kernel#exit raises an exception? — Khat Harr <myphatproxy@...>
While I was working on embedding an interpreter I wrote a function to
[#391556] How to Combo — Intransition <transfire@...>
Easiest implementation of "some_method" in Ruby?
[#391559] LoadError: cannot load such file -- feedtools — mapreferee ruby <support@...>
This problem is found when typing the following code into irb after
[#391568] Scan - variable as pattern — "Sashi K." <sashidkr@...>
I want to define a variable, like:
[#391569] make error: symbol lookup error: undefined symbol — Steve Johnston <steve.r.johnston@...>
Any help on this would be greatly appreciated. I am trying to install
[#391572] Mixin for Mixins — Intransition <transfire@...>
Going through some old code snippets and came across this clever bit. Back
[#391592] Simple CSV and Excel problem. — cristian cristian <currambero@...>
Hello all!
[#391594] JRuby 1.6.5.1 Released — Thomas E Enebo <tom.enebo@...>
The JRuby community is pleased to announce the release of JRuby 1.6.5.1.
For whatever reason the CERT link is not quite live yet. It will be
[#391603] Segmentation fault - Ruby 1.8.7 and Rails 3.1.3 — Rodrigo Emygdio <rodrigo.emygdio@...>
HI,
[#391606] ruby 1.8.7 patchlevel 357 released — Urabe Shyouhei <shyouhei@...>
Hello all.
[#391618] rvmsh: An easy installer for RVM — Bryan Dunsmore <dunsmoreb@...>
I have recently begun work on a project called [rvmsh]
On Thu, Dec 29, 2011 at 11:28:16AM +0900, Bryan Dunsmore wrote:
[#391783] Mailspam — Gunther Diemant <g.diemant@...>
Is there a way to stop this mailspam of Luca (Mail)?
Due to this Spam, I unsubscribed :(
unsubscribe...
I'm still trying to figure out how to UNSUBSCRIBE.
On Sat, Dec 31, 2011 at 5:25 PM, Cathy Alomari <cathy1428@gmail.com> wrote:
Also if you look at you mail headers you will find a header that is
[#391790] What’s the standard way of implementing #hash for value objects in Ruby? — Nikolai Weibull <now@...>
Hi!
I think you can't access instance variables from a class method, so
On Thu, Dec 29, 2011 at 15:52, Gunther Diemant <g.diemant@gmx.net> wrote:
On Thu, Dec 29, 2011 at 4:06 PM, Nikolai Weibull <now@bitwi.se> wrote:
On Fri, Dec 30, 2011 at 00:26, Robert Klemme <shortcutter@googlemail.com> w=
On Thu, Dec 29, 2011 at 5:47 PM, Nikolai Weibull <now@bitwi.se> wrote:
On Fri, Dec 30, 2011 at 06:25, Josh Cheek <josh.cheek@gmail.com> wrote:
On Fri, Dec 30, 2011 at 3:09 AM, Nikolai Weibull <now@bitwi.se> wrote:
On Fri, Dec 30, 2011 at 12:47 AM, Nikolai Weibull <now@bitwi.se> wrote:
I found this recent discussion interesting in a somewhat related
On Fri, Dec 30, 2011 at 15:02, Robert Klemme <shortcutter@googlemail.com> w=
On Fri, Dec 30, 2011 at 3:43 PM, Nikolai Weibull <now@bitwi.se> wrote:
[#391804] Making questionable headway with erubis... — Xeno Campanoli <xeno.campanoli@...>
I am using the example here:
[#391817] Hash access — Josh Cheek <josh.cheek@...>
Hi, was playing around with an idea after reading the thread about defining
[#391831] How to report a bug in ruby-1.9.3-p0 that is not present in ruby-1.9.3-head (ruby-1.9.3-p6) — Peter Vandenabeele <peter@...>
Hi,
Peter Vandenabeele wrote in post #1038848:
On Fri, Dec 30, 2011 at 6:36 PM, Luis Lavena <luislavena@gmail.com> wrote:
[#391839] If else not working — sathish babu <sathish.babu@...>
I'm getting error like comparison of string with 50 failed
[#391849] output file from variable — Alex Sweps <alexszepes@...>
Hello Everyone
[#391876] Check my terminology and understanding please — "Nate Lindstrom" <nathan@...>
Am I understanding this correctly, and are my terms correct? Thanks in
A 'receiver' is also an object, and your 'object' is also a receiver,
I'm afraid I don't follow. What's the different message you speak of, if
Re: Accessing class instance variables from an instance?
Hi Robert and Josh, On 22/12/11 00:49, Robert Klemme wrote: > On Wed, Dec 21, 2011 at 3:08 PM, Josh Cheek<josh.cheek@gmail.com> wrote: > >> Yeah, sorry, it was late. The need I actually come across isn't state >> based, but functionality based. For example, HTTParty's get method. From >> outside it's nice to be able to say `HTTParty.get(...)` but from inside >> they don't want to have to say `self.class.get(...)` so that is an example > > You can also say HTTParty.get(...) inside instance methods. > >> of a class level method that should be available to instances without >> having to go find the class. I find that need occasionally. Or sometimes >> I'm looking at some method and realizing it really could be a class method, >> and that no one can use it without instantiating, but it's pretty obnoxious >> to have to instantiate a class just to call some method that doesn't depend >> on instances. > > Well, then make it a class method. That has the added advantage that > you make the call explicit in instance methods which use it and it is > immediately clear that this method does not manipulate instance state. > > I think this make-a-class-method-be-callable-as-instance-method looks > convenient on first sight but on second sight it may just be > obfuscation. > > Kind regards > > robert > I've run into this kind of thing before, and it does impact me regularly. Having said that, I know my C++ background (which allows this) biases me somewhat on the issue. ;) I tend to steer away from "Foo.bar" style calls inside class Foo for the following reason- it complicates refactoring. If you determine that a class would benefit from being split (perhaps because another class has common functionality and you want it to share a common base), then you have to selectively rename all of the calls you have made to point to the correct class. Sure, it's not hard, and doesn't take too long, but when you're refactoring something for the sake of something else you have developed, not having to deal with additional chores to make it work makes it less likely that you'll stuff something up in the process. A similar problem arises with renaming the class, but admittedly the solution tends to be far easier. For that reason, I'd instead use "class.bar" calls, if it were possible, which it is not, which brings us to "self.class.bar". I do this as you can't always tell ahead of time when you'll need to refactor something to pull out a base class, and so I'll assume that (almost) all of the classes I work on could be subject to such changes later in its lifetime. If you could tell beforehand, you would have designed it that way in the first place. :) Now, if you have a class method that is used both inside and out, but mostly inside (and regularly), it's a pain to have to write "self.class.bar" each time you want to call "bar". Incidentally, for "bar", I have a specific method in mind for something I have been working on (ie. a real-world problem), that makes the most sense as a class method, since it works entirely off the arguments and carries no state. The call in question has very specific structured input requirements, and is called extremely frequently inside the class, and occasionally outside. In my case, I ended up solving it by adding an "abar" method that just called "self.class.bar", although using it that way does feel a bit silly, and makes the code less readable (an observer might ask what the difference between "bar" and "abar" is, for example). Anyway, I just thought I'd share my particular experience. It's not hard to work around, but there are definitely good reasons to want to make it work that way. It falls under the area of a "quirk" for me, but that is of course just my personal experience based on my personal experience. > That has the added advantage that > you make the call explicit in instance methods which use it and it is > immediately clear that this method does not manipulate instance state. There are definitely cases where this could be advantageous, but there are also cases where this is not necessary or desirable. In general, I would personally say that if a particular mechanism is sometimes beneficial, but sometimes not, it is better to leave it up to the person writing the code to emphasise the mechanism where it is appropriate, and de-emphasise where it is not. For example, sometimes it is beneficial to be specific about the particular class of an object (or its capabilities), but would that justify requiring every method call to be prefixed by the class name, every time? I would say not. There are times where being specific about it would be beneficial, but in the remaining cases it would clutter up the code unnecessarily. I think in the situation I outlined above, and possibly also in Josh's case, it falls in the realm of clutter. This does not, of course, take away from the fact that in some situations it would be important, or absolutely essential, to explicitly convey that the instance state will not be manipulated. I know that I have certainly run into this case as well- I won't bother with a personal anecdote as I suspect you also already know of many cases where it is extremely beneficial already. :) I guess what I am saying is that if something is sometimes beneficial, and sometimes detrimental, that enforcing it is not always the best idea, but providing an optional means to make it explicit is beneficial. I do not believe that is a good idea in general to either force a mechanism that is only sometimes useful, or argue that as the mechanism is sometimes important, that having a means to conveniently avoid the mechanism when it is detrimental is not justified. There are of course always all sorts of tradeoffs when designing a language- perhaps the particular feature Josh and I would find beneficial is not readily possible for some technical reason. All IMHO. Garth PS. Wow, that message was a bit longer than I had planned. ;)