[#370825] Syntax error — Anthony Ob <vidgametester@...>

ERROR

17 messages 2010/10/01
[#370828] Re: Syntax error — Alex Stahl <astahl@...5.com> 2010/10/01

What are you expecting the "x:y" statement to do? I ask because I'm not

[#370844] how can we make a ruby compiler — Robin <r@...1.net>

how can we make a thing that compiles ruby into c++ source code?

50 messages 2010/10/01
[#370896] Re: how can we make a ruby compiler — Ryan Davis <ryand-ruby@...> 2010/10/02

[#371096] Re: how can we make a ruby compiler — Tony Arcieri <tony.arcieri@...> 2010/10/05

On Fri, Oct 1, 2010 at 7:52 PM, Ryan Davis <ryand-ruby@zenspider.com> wrote:

[#371120] Re: how can we make a ruby compiler — Clifford Heath <no@...> 2010/10/05

Tony Arcieri wrote:

[#371127] Re: how can we make a ruby compiler — Michal Suchanek <hramrach@...> 2010/10/05

On 5 October 2010 07:10, Clifford Heath <no@spam.please.net> wrote:

[#371129] Re: how can we make a ruby compiler — Samuel Williams <space.ship.traveller@...> 2010/10/05

[#371130] Re: how can we make a ruby compiler — Ryan Davis <ryand-ruby@...> 2010/10/05

[#370878] New to Ruby, Looking for Help With Basic Program — Mica Koizumi <monkeymica@...>

I am teaching myself Ruby and am trying to figure out why this program

12 messages 2010/10/01

[#370897] Ruby String: How do I strip anything between two parenthesis — Frank Guerino <frank.guerino@...>

Hi,

9 messages 2010/10/02

[#370912] The Third Ruby - Ever Comes Out at Night? — Mike Stephens <rubfor@...>

Often you see that Ruby can be object-oriented, functional or

19 messages 2010/10/02
[#370915] Re: The Third Ruby - Ever Comes Out at Night? — elise huard <huard.elise@...> 2010/10/02

I guess you could work only with modules and class methods, and avoid

[#370916] Re: The Third Ruby - Ever Comes Out at Night? — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/10/02

On Sat, Oct 2, 2010 at 11:27 AM, elise huard <huard.elise@gmail.com> wrote:

[#370918] Re: The Third Ruby - Ever Comes Out at Night? — elise huard <huard.elise@...> 2010/10/02

2010/10/2 Jes=FAs Gabriel y Gal=E1n <jgabrielygalan@gmail.com>:

[#370919] Re: The Third Ruby - Ever Comes Out at Night? — Mike Stephens <rubfor@...> 2010/10/02

[#370952] Pass by reference and copy on write — Ralph Shnelvar <ralphs@...32.com>

I see

24 messages 2010/10/02
[#370955] Re: Pass by reference and copy on write — Josh Cheek <josh.cheek@...> 2010/10/03

On Sat, Oct 2, 2010 at 6:41 PM, Ralph Shnelvar <ralphs@dos32.com> wrote:

[#370958] Re: Pass by reference and copy on write — Caleb Clausen <vikkous@...> 2010/10/03

On 10/2/10, Josh Cheek <josh.cheek@gmail.com> wrote:

[#370964] ODBC app in Ruby - I don't believe it. — Ed Reed <joebananas10@...>

I'm trying to figure out what's so cool about Ruby. I need to create a

49 messages 2010/10/03
[#370982] Re: ODBC app in Ruby - I don't believe it. — Luis Lavena <luislavena@...> 2010/10/03

On Oct 3, 4:26=A0am, Ed Reed <joebanana...@gmail.com> wrote:

[#370996] Re: ODBC app in Ruby - I don't believe it. — Ed Reed <joebananas10@...> 2010/10/03

WOW! Thanks for all the responses and please accept my apologies for

[#371079] Re: ODBC app in Ruby - I don't believe it. — Ed Reed <joebananas10@...> 2010/10/04

Okay I've decided to start from scratch,... again. It's the start of a

[#371082] Re: ODBC app in Ruby - I don't believe it. — Jeremy Bopp <jeremy@...> 2010/10/04

On 10/4/2010 1:30 PM, Ed Reed wrote:

[#371087] Re: ODBC app in Ruby - I don't believe it. — Ed Reed <joebananas10@...> 2010/10/04

My mistake on the gem commands. I did use the correct ones with dbd

[#371102] Re: ODBC app in Ruby - I don't believe it. — Jeremy Bopp <jeremy@...> 2010/10/05

On 10/04/2010 04:29 PM, Ed Reed wrote:

[#371195] Re: ODBC app in Ruby - I don't believe it. — Ed Reed <joebananas10@...> 2010/10/05

The history.txt file for the mysql gem says

[#371209] Re: ODBC app in Ruby - I don't believe it. — Dave Howell <groups.2009a@...> 2010/10/06

[#371275] Re: ODBC app in Ruby - I don't believe it. — Ed Reed <joebananas10@...> 2010/10/06

Thanks for the extensive reply Dave. I certainly appreciate it.

[#371330] Re: ODBC app in Ruby - I don't believe it. — Brian Candler <b.candler@...> 2010/10/07

Ed Reed wrote:

[#371455] Re: ODBC app in Ruby - I don't believe it. — Ed Reed <joebananas10@...> 2010/10/08

Brian Candler wrote:

[#371413] Re: ODBC app in Ruby - I don't believe it. — David Masover <ninja@...> 2010/10/08

On Wednesday, October 06, 2010 02:40:38 am Dave Howell wrote:

[#371690] Re: ODBC app in Ruby - I don't believe it. — Dave Howell <groups.2009a@...> 2010/10/13

[#370991] install ruby on the mac — Basi Lambanog <basi.lambanog.tuba@...>

hello,

14 messages 2010/10/03

[#371020] save only first line from string? — Terry Michaels <spare@...>

Hi. What's the most simple and elegant way to remove all the contents of

21 messages 2010/10/04

[#371023] How to suppress display of specific code in irb?? — Don Norcott <dnorcott@...>

I am very new to ruby (but a retired experienced C programmer) and am

14 messages 2010/10/04

[#371049] how do i delete files in particular directoryin ruby ??? — Amit Tomar <amittomer25@...>

Hii all,

23 messages 2010/10/04
[#371052] Re: how do i delete files in particular directoryin ruby ??? — Stefano Crocco <stefano.crocco@...> 2010/10/04

On Monday 04 October 2010, Amit Tomar wrote:

[#371069] Re: how do i delete files in particular directoryin ruby ??? — Robert Klemme <shortcutter@...> 2010/10/04

On Mon, Oct 4, 2010 at 2:27 PM, Stefano Crocco <stefano.crocco@alice.it> wr=

[#371181] How can I count number of elements in an HTML page — Paul <tester.paul@...>

Hi there, I'm using net/http to retrieve some html pages and now I

11 messages 2010/10/05

[#371221] setting local variables in a binding — Martin DeMello <martindemello@...>

Why does this not work?

15 messages 2010/10/06

[#371226] XML-RPC WEBrick problem (error during method invocation) — Nikita Kuznetsov <moog_master@...>

I have a university assignement, and i am stuck. I am supposed to create

10 messages 2010/10/06

[#371239] "map" a deeply nested structure: Object#deep_map — Guido De Rosa <guidoderosa@...>

Hi,

11 messages 2010/10/06
[#371241] Re: "map" a deeply nested structure: Object#deep_map — Robert Klemme <shortcutter@...> 2010/10/06

On Wed, Oct 6, 2010 at 4:43 PM, Guido De Rosa <guidoderosa@gmail.com> wrote=

[#371250] A Real World example for Ruby to "compiled" version discussion — Philip Rhoades <phil@...>

People,

10 messages 2010/10/06

[#371286] Why does Module#include exclude the module's metaclass? — John Mair <jrmair@...>

When classes are inherited in Ruby the singleton classes are also

11 messages 2010/10/06

[#371533] Why does a lot of code not include parenthesis? — egervari <ken.egervari@...>

I just started playing around with ruby and rails, and one thing I've

32 messages 2010/10/11
[#371534] Re: Why does a lot of code not include parenthesis? — egervari <ken.egervari@...> 2010/10/11

On Oct 10, 8:21=A0pm, egervari <ken.egerv...@gmail.com> wrote:

[#371610] Re: Why does a lot of code not include parenthesis? — "ara.t.howard" <ara.t.howard@...> 2010/10/12

vim completion works with, or without, the '(' and ')'. same with

[#371570] Can DRbUndumped be disabled for certain return types? — Josh Mcdade <josh.ncsu@...>

I have server model classes that definitely need DRbUndumped. Except

11 messages 2010/10/11

[#371580] more idiomatic way to avoid errors when calling method on variable that may be nil? — Charles Calvert <cbciv@...>

I'm using Ruby 1.8.7 patchlevel 249

34 messages 2010/10/11

[#371702] sort_by: multiple fields with reverse sort — Rahul Kumar <sentinel1879@...>

I need to use *sort_by* to sort a table, since the user could select

16 messages 2010/10/13

[#371704] Excel and Ruby — "Dan Sr." <djonavarro@...>

Hello all,

17 messages 2010/10/13

[#371878] Is it possible to find out if an identifier is a method alias? — Ammar Ali <ammarabuali@...>

>> def method; end

11 messages 2010/10/14
[#371880] Re: Is it possible to find out if an identifier is a method alias? — Daniel Berger <djberg96@...> 2010/10/14

On 10/14/10 4:48 PM, Ammar Ali wrote:

[#371896] Re: Is it possible to find out if an identifier is a method alias? — Ammar Ali <ammarabuali@...> 2010/10/15

On Fri, Oct 15, 2010 at 2:17 AM, Daniel Berger <djberg96@gmail.com> wrote:

[#371978] mechanize - extract href — Corey Watts <cwatts@...>

Hey there everyone. I'm having a slight problem using Mechanize. I'm

12 messages 2010/10/16

[#372016] unable to preload "rbconfig" in my irb session — "Sandeep K." <uniqueembassy@...>

I'm using Ruby 1.9.2 with Windows XP as host, I ran the command

11 messages 2010/10/17

[#372070] su {block of code.} — Guido De Rosa <guidoderosa@...>

Hi!

13 messages 2010/10/18

[#372181] Help missing something BASIC — Don Norcott <dnorcott@...>

This code is conceptually what I want to do with the nokogiri code below

11 messages 2010/10/20

[#372232] about handling args in block — salamond <jarodzz@...>

Hi, guys.

11 messages 2010/10/20

[#372234] Long conditional statements — Courtland Allen <courtlandallen@...>

Some parts of my code call for really long conditional statements of the

16 messages 2010/10/20

[#372289] generating random argument lists — Melody Class <rmiddlehouse@...>

Hi,

10 messages 2010/10/21

[#372361] Why is top-level an object rather than just Object? — John Mair <jrmair@...>

Why is it that top-level isn't just the Object class itself? what's the

14 messages 2010/10/22

[#372493] Utilizing data from a csv file — Paul Roche <prpaulroche@...>

Hi I basically want to create a function that takes in data that has

20 messages 2010/10/24

[#372568] Can't get ruby serial port to work — Dd Dd <dd25@...>

I recently installed Ruby Version 1.9.2 on my PC. I am trying to get

14 messages 2010/10/25

[#372572] Extraction of single subarrays from multidimensional array — Maurizio Cirilli <mauricirl@...>

Hi there,

25 messages 2010/10/25

[#372704] rsruby install trouble — Guybrush Threepwood <deadpool93@...>

Hello, trying for no particular reason to create a K constant calculator

15 messages 2010/10/27

[#372760] undefined method `find' for.:Module — John Hammink <john@...>

Hello,

10 messages 2010/10/28

[#372820] Is this an effective loop — Ted Flethuseo <flethuseo@...>

I was wondering if a loop of this sort would be

13 messages 2010/10/29

[#372835] Dynamically reference instance vars — Greg Willits <lists@...>

If I need to dynamically reference instance vars, is this the only way

11 messages 2010/10/30

[#372886] the dark side of inherited methods — timr <timrandg@...>

Let's say I want to make a new class, Vector (that will function,

38 messages 2010/10/31
[#372893] Re: the dark side of inherited methods — James Edward Gray II <james@...> 2010/10/31

On Oct 31, 2010, at 5:30 PM, timr wrote:

[#372951] Re: the dark side of inherited methods — Tony Arcieri <tony.arcieri@...> 2010/11/02

On Sun, Oct 31, 2010 at 5:49 PM, James Edward Gray II <james@graysoftinc.com

[#372964] Re: the dark side of inherited methods — Robert Klemme <shortcutter@...> 2010/11/02

On Tue, Nov 2, 2010 at 4:29 AM, Tony Arcieri <tony.arcieri@medioh.com> wrote:

Re: ODBC app in Ruby - I don't believe it.

From: Dave Howell <groups.2009a@...>
Date: 2010-10-17 01:17:07 UTC
List: ruby-talk #371995
The other paradigm that I've tripped over is that I want my models to =
know how to present themselves. Tango did this to a limited extent, and =
I really liked it.  I was expecting a beautiful world of =
self-constructing data when I started working with Rails. Something like =
this:


>> blog.author
=3D> "Huffy Angelaton"
>> puts blog.author
=3D> "<span class=3D'author'>Huffy Angelaton</span>"
>> puts Form.new(:action=3D>"/savepost"){
    blog.author
}
=3D> "<form action=3D\"/savepost"><input type=3D'text' length=3D'50' =
value=3D'Huffy Angelaton' name=3D'blog.author'></form>"

I found *nothing* that even remotely approached that. So I wrote my own.=20=


There was a pretty long discussion on the Ramaze list about this, =
because I'm well aware that this is a big-time violation of the =
Model-View-Controller idea. Unfortunately, MVC just can't handle this =
without a huge amount of extra lumps of code. Well, it can handle the =
*previous* example. But it really can't handle the following one. Or (to =
inject at least a smidge of humility), I was quite unable to find a way =
to do it.=20

This is a slightly modified example from my working code. A "Batch" is a =
particular batch of manufactured product, specifically an herbal =
medicine. I've obfuscated the UUIDs.=20

>>  b =3D Batch['3705bf0e-4264-6654-ff6c-00065b3f562c']
=3D>#<Batch @values=3D{:wv=3D>"1:1.7", :notes=3D>nil, :active=3D>true, =
:herbpercent=3D>#<BigDecimal:101f28328,'0.0',4(12)>, :pressed=3D>nil, =
:batchcode=3D>"06082030.1", :herbweight=3D>3741, =
:lot_id=3D>"e62b56d2-a741-xxxx-xxxx-xxxxxxxxxxxx", :initvol=3D>6360, =
:created=3D>Fri Aug 04 00:00:00 -0700 2006, :finalvol=3D>8812, =
:extract_id=3D>"f2580cc8-2354-xxxx-xxxx-xxxxxxxxxxxx", =
:batch_id=3D>"3451a2a6-5fc1-xxxx-xxxx-xxxxxxxxxxxx", :id=3D>1534, =
:decocted=3D>false, =
:cultivation_id=3D>"3705ff6c-2355-xxxx-xxxx-xxxxxxxxxxxx"}>

However, a batch also contains multiple non-active ingredients, called =
components.

>> b.components
=3D> [
	#<Component =
@values=3D{:percentage=3D>#<BigDecimal:101f220b8,'0.1E2',4(8)>,=20
		:batch_id=3D>"3705ff6c-5fc1-xxxx-xxxx-xxxxxxxxxxxx",=20
		=
:componentcategory_id=3D>"4ace3c04-2357-xxxx-xxxx-xxxxxxxxxxxx"}>,=20
	#<Component =
@values=3D{:percentage=3D>#<BigDecimal:101f21a50,'0.5E2',4(8)>,=20
		:batch_id=3D>"3705ff6c-5fc1-xxxx-xxxx-xxxxxxxxxxxx",=20
		=
:componentcategory_id=3D>"4ace3f92-2357-xxxx-xxxx-xxxxxxxxxxxx"}>,=20
	#<Component =
@values=3D{:percentage=3D>#<BigDecimal:101f21410,'0.4E2',4(8)>,=20
		:batch_id=3D>"3705ff6c-5fc1-xxxx-xxxx-xxxxxxxxxxxx",=20
		=
:componentcategory_id=3D>"4ace430c-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}>]

And each component, in turn, is linked to a category:

>> b.components[0].componentcategory
=3D> #<Componentcategory @values=3D{:name=3D>"Glycerine", :sequence=3D>3, =
:componentcategory_id=3D>"4ace3c04-2357-xxxx-xxxx-xxxxxxxxxxxx"}>


If I want to create a form for a user to edit the batch data, what I put =
in my code is this:

	e.editform.to_form

and what I get is this:

> 	<input name=3D'batch_id' =
value=3D'3705ff6c-xxxx-xxxx-xxxx-xxxxxxxxxxxx' type=3D'hidden'/>
> 	<select name=3D'cultivation_id' id=3D'Cultivation'>
> 		<option =
value=3D'345183ca-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Other</option>	=09
> 		<option selected=3D'true' =
value=3D'3451a2a6-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Organically =
Grown</option>
> 		<option =
value=3D'3451a68e-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Wildcrafted</option>
> 		<option =
value=3D'3451a9b8-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>[unknown]</option>
> 		<option =
value=3D'3451acd8-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Cultivated</option>
> 		<option =
value=3D'3451b08e-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Grown Without =
Chemicals</option>
> 		<option =
value=3D'77cc2f7a-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Forest Grown</option>
> 		<option =
value=3D'c7406e90-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Wild Simulated</option>
> 	</select>
> 	<input name=3D'Component:8313022463:batch_id' =
value=3D'3705ff6c-xxxx-xxxx-xxxx-xxxxxxxxxxxx' type=3D'hidden'/>
> 	<input name=3D'Component:8313022463:componentcategory_id' =
value=3D'4ace3c04-xxxx-xxxx-xxxx-xxxxxxxxxxxx' type=3D'hidden'/>
> 	<select name=3D'Component:8313022463:componentcategory_id' =
id=3D'Componentcategory'>
> 		<option =
value=3D'4acb07a0-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Olive Oil</option>
> 		<option =
value=3D'4ace354c-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Other</option>
> 		<option selected=3D'true' =
value=3D'4ace3c04-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Glycerine</option>
> 		<option =
value=3D'4ace3f92-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Ethanol</option>
> 		<option =
value=3D'4ace430c-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Water</option></select>
> 	<input name=3D'Component:8313022463:percentage' size=3D'6' =
value=3D'10' type=3D'text'/>
> 	<input name=3D'Component:-7531801290:batch_id' =
value=3D'3705ff6c-xxxx-xxxx-xxxx-xxxxxxxxxxxx' type=3D'hidden'/>
> 	<input name=3D'Component:-7531801290:componentcategory_id' =
value=3D'4ace3f92-xxxx-xxxx-xxxx-xxxxxxxxxxxx' type=3D'hidden'/>
> 	<select name=3D'Component:-7531801290:componentcategory_id' =
id=3D'Componentcategory'>
> 		<option =
value=3D'4acb07a0-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Olive Oil</option>
> 		<option =
value=3D'4ace354c-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Other</option>
> 		<option =
value=3D'4ace3c04-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Glycerine</option>
> 		<option selected=3D'true' =
value=3D'4ace3f92-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Ethanol</option>
> 		<option =
value=3D'4ace430c-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Water</option></select>
> 	<input name=3D'Component:-7531801290:percentage' size=3D'6' =
value=3D'50' type=3D'text'/>
> 	<input name=3D'Component:-6831266729:batch_id' =
value=3D'3705ff6c-xxxx-xxxx-xxxx-xxxxxxxxxxxx' type=3D'hidden'/>
> 	<input name=3D'Component:-6831266729:componentcategory_id' =
value=3D'4ace430c-xxxx-xxxx-xxxx-xxxxxxxxxxxx' type=3D'hidden'/>
> 	<select name=3D'Component:-6831266729:componentcategory_id' =
id=3D'Componentcategory'>
> 		<option =
value=3D'4acb07a0-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Olive Oil</option>
> 		<option =
value=3D'4ace354c-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Other</option>
> 		<option =
value=3D'4ace3c04-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Glycerine</option>
> 		<option =
value=3D'4ace3f92-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Ethanol</option>
> 		<option selected=3D'true' =
value=3D'4ace430c-xxxx-xxxx-xxxx-xxxxxxxxxxxx'>Water</option></select>
> 	<input name=3D'Component:-6831266729:percentage' size=3D'6' =
value=3D'40' type=3D'text'/>
> 	<input name=3D'created' size=3D'12' value=3D'2006 Aug 04' =
type=3D'text'/>
> 	<input name=3D'wv' size=3D'40' value=3D'1:1.7' type=3D'text'/>
> 	<input name=3D'herbpercent' size=3D'6' value=3D'0' type=3D'text'/>=

> 	<input name=3D'batchcode' size=3D'40' value=3D'55436476' =
type=3D'text'/>
> 	<input name=3D'herbweight' size=3D'7' value=3D'3741' =
type=3D'text'/>
> 	<input name=3D'initvol' size=3D'7' value=3D'6360' type=3D'text'/>
> 	<input name=3D'finalvol' size=3D'7' value=3D'8812' type=3D'text'/>=

> 	<input name=3D'decocted' type=3D'checkbox'/><textarea =
name=3D'notes' rows=3D'8' cols=3D'80'> </textarea>
> 	<input checked=3D'' name=3D'active' type=3D'checkbox'/>
> 	<input name=3D'pressed' size=3D'12' value=3D'' type=3D'text'/>"

A batch has more than one component, and each component can be a =
particular substance. In order to present that HTML code, my batch =
object had to know to take its own fields, like "batchcode" and turn =
them in to text input fields. The size of the field is based on how much =
space is reserved in the database itself for that data. Each Component =
of a Batch has to do the same thing. "Percentage" is a text input field =
long enough for the custom data type (a numeric(5,2) that only accepts =
numbers in the range 0.00 to 100.00). But since there are multiple =
components, and HTML forms don't have support for nesting, each form =
field has to get a unique name so that when the data comes back, it's =
possible to figure out which percentage belongs to which component.=20
	Finally, each component is linked to a 'Componentcategory." In =
order to allow the user to select a different category, the form has to =
know what EVERY row in the table is, in order to create the list of =
<options>.=20

This last bit is really critical. If you just ask the object itself, it =
cannot tell you what you need to know to create the form.=20

	>> b.components[0].componentcategory
	=3D> #<Componentcategory @values=3D{:name=3D>"Glycerine", =
:sequence=3D>3, =
:componentcategory_id=3D>"4ace3c04-2357-xxxx-xxxx-xxxxxxxxxxxx"}>

To find out what other categories this component *could* be, you have to =
back up from this component category to the class, then query for all =
members of the class, then use that information to construct one form =
field, using the identity of the current active *instance* of the class =
to figure out which <option> is marked as "selected".=20

I tried to get to this point with templating, but pretty soon my =
templates were hardly more than <body><@htmlfromcontroller></body>, so =
what's the point?=20

I must admit, I'm still not too sure what paradigm IS behind the current =
flock of templating tools, except that it isn't like this, and doing it =
this way is totally rocking, so I have no incentive to change.=20


In This Thread