Defining global/contact values?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Defining global/contact values?

talios@gmail.com
Now that my projects taking shape I'm finding I'm having an increasing
number of "magic numbers" in my code, such as:

[^((aProfileRootKey subKeys at: '13dbb0c8aa05101a9bb000aa002fc45a')
valueAt: '0003661b')
        = #[58 28 0 0]]
            on: NotFoundError
            do: [:x | ^false]

I found that if I enter a name in my class definition for an unknown
dictionary I get an "abort retry ignore" error dialog that creates an
empty dictionary ( found by selecting the name and invoking browse ) but
I don't see it under the Globals listing.

Also, when I click "new" to add an item to said new PoolDictionary I get
prompted for a 'key expression', however nothing I entered seems to
work, i.e. FOO=foo, FOO := 'foo', whats going on?


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

Sean Malloy-6
> I found that if I enter a name in my class definition for an unknown
> dictionary I get an "abort retry ignore" error dialog that creates an
> empty dictionary ( found by selecting the name and invoking browse ) but
> I don't see it under the Globals listing.

Smalltalk at: #MDConstants put: (PoolDictionary new).

or something like that. whatever you want to name your pool.

you should be able to add key->value entries to the pool.

> Also, when I click "new" to add an item to said new PoolDictionary I get
> prompted for a 'key expression', however nothing I entered seems to
> work, i.e. FOO=foo, FOO := 'foo', whats going on?

Key Expression is badly worded. its the key value, and it expects a string,
so type in:

'Id'

Next it will prompt you for the value.

Its a hacky way to do it. Probably easier to just type it through a
workspace. Or maybe change the environment to prompt for the key and value
at the same time


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

Mark Derricutt-2
"Sean Malloy" <[hidden email]> wrote in message news:<[hidden email]>...

> Key Expression is badly worded. its the key value, and it expects a string,
> so type in:
>
> 'Id'
>
> Next it will prompt you for the value.

Cool, now to rid my code of hideous magic numbers :)

What would be cool ( not sure how easy it would be to implement )
would be highlight a string, right click and select "Refactor->Extract
String to pool". mmmm


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

talios@gmail.com
In reply to this post by Sean Malloy-6
Sean Malloy wrote:

>Smalltalk at: #MDConstants put: (PoolDictionary new).
>or something like that. whatever you want to name your pool.
>  
>
Right - at the office now and trying this, its created fine, but its
"unpackaged" somewhere, and when I add a value I get an error:

See this short flash anim I recorded:

  http://stumpy.talios.com/~amrk/pooldictionary.htm

Mmmm


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

Stefan Schmiedl
On Thu, 25 Nov 2004 08:40:38 +1300,
Mark Derricutt <[hidden email]> wrote:
>
> See this short flash anim I recorded:

nice ... what did you use to record it?

Try entering
  'TestValue' instead of TestValue

s.


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

Udo Schneider
Stefan Schmiedl wrote:
> nice ... what did you use to record it?
I don't what Mark is using. I'm using "Wink". It's freeware, has enough
features (balloons, buttons ...) and does it's job quit well.

http://www.debugmode.com/wink/

Regards,

Udo


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

talios@gmail.com
In reply to this post by Stefan Schmiedl
Stefan Schmiedl wrote:

>nice ... what did you use to record it?
>
>  
>
OpenSource app called Wish I found awhile ago:

  http://www.debugmode.com/wink/

>Try entering
>  'TestValue' instead of TestValue
>  
>

aha!


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

talios@gmail.com
In reply to this post by Udo Schneider
Udo Schneider wrote:

> http://www.debugmode.com/wink/
>
Same tool :)


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

Stefan Schmiedl
On Thu, 25 Nov 2004 11:38:01 +1300,
Mark Derricutt <[hidden email]> wrote:
> Udo Schneider wrote:
>
>> http://www.debugmode.com/wink/
>>
> Same tool :)

Smalltalkers have taste!

s.


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

talios@gmail.com
In reply to this post by talios@gmail.com
Mark Derricutt wrote:

>>  'TestValue' instead of TestValue
>>  
>
> Try entering

Right, so now I can enter these, I noticed the pool still wasn't showing
up anywhere in my package browser, running the following in a workspace
solved that:

    (PackageManager current packageNamed: 'SMSComposer')
        addGlobalNamed: 'SMSComposerConstants'

However, the moment I edit one my class definitions to use said global,
I can no longer save the package due it failing dependencies on a
"shared global". Hmmmm.


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

talios@gmail.com
In reply to this post by Stefan Schmiedl
Stefan Schmiedl wrote:

>Smalltalkers have taste!
>  
>
yegads - the world is now over, I'm being refered to as a Smalltalker now ;p


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

Sean Malloy-6
In reply to this post by talios@gmail.com
>     (PackageManager current packageNamed: 'SMSComposer')
>         addGlobalNamed: 'SMSComposerConstants'
>
> However, the moment I edit one my class definitions to use said global,
> I can no longer save the package due it failing dependencies on a
> "shared global". Hmmmm.

Go to your package in package browser.

Click on globals, and select "Add Uncommitted..."

Your SMSConstants pool should be there, select it.

I think that should solve the problem


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

talios@gmail.com
Sean Malloy wrote:

>I think that should solve the problem
>  
>
No joy - that gives me "Not found: ...." - yet I can double click it and
see the contants I've added.  arg.


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

Sean Malloy-6
> No joy - that gives me "Not found: ...." - yet I can double click it and
> see the contants I've added.  arg.

weird. I just created a dummy package, added a new pool dictionary to it,
saved out the package, pulled it back in...

"it works for me"

heh


Reply | Threaded
Open this post in threaded view
|

Re: Defining global/contact values?

talios@gmail.com
Sean Malloy wrote:

>weird. I just created a dummy package, added a new pool dictionary to it,
>saved out the package, pulled it back in...
>  
>
Mmmm, gah.  I'm probably (once again, common thing here) missing one
minor (yet important) step, or doing something slightly differnet :(