I'm a novice with dictionaries and collections. I have a problem that
I'm sure they can solve, but the cryptic RB documentation, or my
inability to read it, has left me confused.
I have a set of structures that may have one or several blobs
associated with each. Each structure has a name and each blob has a
unique number. I start with a list of name-blob number pairs. Names
may or may not be unique. I want to end with a list where each name
is present once and is associated with all of its blob numbers.
My idea was to associate each name with an integer array.
Because the number of structures is undetermined, I think I have to
wrap the integer array into a class, so they can be created as needed.
I want to process a series of name-number pairs. If the name is
unique, I want to add the pair as a new entry, with the number being
entered into an integer array with one entry. If the name is already
there, I want to append the number to the array associated with the
name. After the dictionary/collection is constructed, I want to use
the name to retrieve the associated blob number or set of blob numbers.
I think I could do this with a collection, where the key-value syntax
is fairly clear. But the RB documentation emphasizes the speed
advantage of dictionaries. Could anyone please:
1. comment about whether my problem is appropriately addressed with a
dictionary or a collection.
2. give the rough syntax of the solution.
Thanks in advance,
John Kubie
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
From Wed 31 May 2006 16:29:22 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
id 1D824562E3E; Wed, 31 May 2006 15:29:41 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
www.realsoftware.com
X-Spam-Level:
X-Spam-Status: No, score=-1.1 required=4.5 tests=AWL,BAYES_00,NO_REAL_NAME
autolearn=no version=3.1.1
Received: from lists.realsoftware.com (lists.realsoftware.com [209.198.132.125])
by xmail.realsoftware.com (Postfix) with ESMTP id 1E582562E38;
Wed, 31 May 2006 15:29:40 -0700 (PDT)
Received: from lists.realsoftware.com (localhost [127.0.0.1])
by lists.realsoftware.com (Postfix) with ESMTP
id DFB6D12BA509; Wed, 31 May 2006 17:29:27 -0500 (CDT)
X-Original-To: realbasic-nug at lists dot realsoftware dot com
Delivered-To: realbasic-nug at lists dot realsoftware dot com
Received: from swarthymail-a3.dreamhost.com (mailbigip.dreamhost.com
[208.97.132.5])
by lists.realsoftware.com (Postfix) with ESMTP id 9A66212BA4FA
for <realbasic-nug at lists dot realsoftware dot com>;
Wed, 31 May 2006 17:29:22 -0500 (CDT)
Received: from [10.0.1.2] (c-67-174-105-26.hsd1.co.comcast.net [67.174.105.26])
by swarthymail-a3.dreamhost.com (Postfix) with ESMTP id 436B67F01F
for <realbasic-nug at lists dot realsoftware dot com>;
Wed, 31 May 2006 15:29:22 -0700 (PDT)
Date: Wed, 31 May 2006 16:29:22 -0600
From: joe at strout dot net
To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
In-Reply-To: <FA897333-124C-4032-84B1-ADC33740AC2A at mac dot com>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060531222922 dot 436B67F01F at swarthymail-a3 dot dreamhost dot
com>
Subject: Re: difficulty with dictionaries/collections
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com
On May 31, 2006, at 22:21 UTC, John Kubie wrote:
I have a set of structures that may have one or several blobs
associated with each. Each structure has a name and each blob has a
unique number. I start with a list of name-blob number pairs. Names
may or may not be unique. I want to end with a list where each name
is present once and is associated with all of its blob numbers.
OK, sounds like you need a dictionary where the key is a name, and the value is
a set of blob numbers.
Unfortunately, you can't directly store an array as a dictionary value, because
arrays are not objects. So you'd have to use an array wrapper, or use
something other than an array (like another dictionary or a string).
Here's a simple solution that builds a comma-delimited list of blob numbers as
a string associated with each name -- assume 'name' and 'blobNumber' are the
pair that we want to add, and 'dict' is the dictionary holding all this data:
if dict.HasKey( name ) then
dict.Value( name ) = dict.Value( name ) + "," + str(blobNumber)
else
dict.Value( name ) = str(blobNumber)
end if
It's simple, but it works.
Best,
- Joe
--
Joe Strout -- joe at strout dot net
Verified Express, LLC "Making the Internet a Better Place"
http://www.verex.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
From Wed 31 May 2006 16:36:24 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
id 991A7562FF0; Wed, 31 May 2006 15:36:38 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
www.realsoftware.com
X-Spam-Level:
X-Spam-Status: No, score=-1.2 required=4.5 tests=AWL,BAYES_00,NO_REAL_NAME
autolearn=no version=3.1.1
Received: from lists.realsoftware.com (lists.realsoftware.com [209.198.132.125])
by xmail.realsoftware.com (Postfix) with ESMTP id 02D19562FEA;
Wed, 31 May 2006 15:36:38 -0700 (PDT)
Received: from lists.realsoftware.com (localhost [127.0.0.1])
by lists.realsoftware.com (Postfix) with ESMTP
id A41F912BA579; Wed, 31 May 2006 17:36:29 -0500 (CDT)
X-Original-To: realbasic-nug at lists dot realsoftware dot com
Delivered-To: realbasic-nug at lists dot realsoftware dot com
Received: from swarthymail-a1.dreamhost.com (mailbigip.dreamhost.com
[208.97.132.5])
by lists.realsoftware.com (Postfix) with ESMTP id 280F812BA56B
for <realbasic-nug at lists dot realsoftware dot com>;
Wed, 31 May 2006 17:36:24 -0500 (CDT)
Received: from [10.0.1.2] (c-67-174-105-26.hsd1.co.comcast.net [67.174.105.26])
by swarthymail-a1.dreamhost.com (Postfix) with ESMTP id BC5AA90DCC
for <realbasic-nug at lists dot realsoftware dot com>;
Wed, 31 May 2006 15:36:23 -0700 (PDT)
Date: Wed, 31 May 2006 16:36:24 -0600
From: joe at strout dot net
To: realbasic-nug at lists dot realsoftware dot com
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060531223623 dot BC5AA90DCC at swarthymail-a1 dot dreamhost dot
com>
Subject: parenthesis matching can cause parenthesis deletion
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com
Sometimes, when quickly typing an expression involving parentheses, the opening
parenthesis gets replaced with another character, apparently because it happens
to be highlighted (by the paren-matching feature) when I type something else. I
then have to go back and fix it, which is a real time-waster.
<http://www.realsoftware.com/feedback/viewreport.php?reportid=ttkktjev>
Best,
- Joe
--
Joe Strout -- joe at strout dot net
Verified Express, LLC "Making the Internet a Better Place"
http://www.verex.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
From Wed 31 May 2006 16:56:39 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
id 7B67A563430; Wed, 31 May 2006 15:57:02 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
www.realsoftware.com
X-Spam-Level:
X-Spam-Status: No, score=-1.2 required=4.5 tests=AWL,BAYES_00,NO_REAL_NAME
autolearn=no version=3.1.1
Received: from lists.realsoftware.com (lists.realsoftware.com [209.198.132.125])
by xmail.realsoftware.com (Postfix) with ESMTP id A2C8F563429;
Wed, 31 May 2006 15:56:57 -0700 (PDT)
Received: from lists.realsoftware.com (localhost [127.0.0.1])
by lists.realsoftware.com (Postfix) with ESMTP
id D20A412BA6DC; Wed, 31 May 2006 17:56:44 -0500 (CDT)
X-Original-To: realbasic-nug at lists dot realsoftware dot com
Delivered-To: realbasic-nug at lists dot realsoftware dot com
Received: from swarthymail-a2.dreamhost.com (mailbigip.dreamhost.com
[208.97.132.5])
by lists.realsoftware.com (Postfix) with ESMTP id 45EEB12BA6CE
for <realbasic-nug at lists dot realsoftware dot com>;
Wed, 31 May 2006 17:56:39 -0500 (CDT)
Received: from [10.0.1.2] (c-67-174-105-26.hsd1.co.comcast.net [67.174.105.26])
by swarthymail-a2.dreamhost.com (Postfix) with ESMTP id EB3F5EB2C0
for <realbasic-nug at lists dot realsoftware dot com>;
Wed, 31 May 2006 15:56:38 -0700 (PDT)
Date: Wed, 31 May 2006 16:56:39 -0600
From: joe at strout dot net
To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
In-Reply-To: <67d56c8b2baa844d6a218ddd713c06fa at wanadoo dot es>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060531225638 dot EB3F5EB2C0 at swarthymail-a2 dot dreamhost dot
com>
Subject: Re: Aliased CurveShapes
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com
On May 29, 2006, at 20:44 UTC, Juan Salvatierra wrote:
when I finally render the completed FigureShape
(g.DrawObject(figureshape)), its curved parts appear aliased! And the
straight ones (if any) do not!
Surely this is something already known (except for me), but I find it
strange. The UseOldRenderer of my canvas is set to false.
It's certainly not known to me. Please post a simple example.
Best,
- Joe
--
Joe Strout -- joe at strout dot net
Verified Express, LLC "Making the Internet a Better Place"
http://www.verex.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|