ODBC, loadFFI and friends!

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

ODBC, loadFFI and friends!

Torsten Bergmann
>Please have a look at
>
>   http://www.squeaksource.com/PharoInbox/DolphinCompatibility-ODBC-BillSchwab.3.mcz
>
>It adds a few methods that I missed (one could argue that I should package >some of this separately) and gives access to table and field names.

Hi Bill,

I once contacted Frank Urbach (creator of the package on squeaksource),
but got no response.

However: http://www.squeaksource.com/ODBC is "Read And Write" so
you can integrate your changes easily. It's MIT and open anyway
so anything that makes life easier should be added.

Thanks
Torsten




--
GMX DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt auch mit
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl

Reply | Threaded
Open this post in threaded view
|

Re: ODBC, loadFFI and friends!

Stéphane Ducasse

On Dec 9, 2010, at 7:54 PM, Torsten Bergmann wrote:

>> Please have a look at
>>
>>  http://www.squeaksource.com/PharoInbox/DolphinCompatibility-ODBC-BillSchwab.3.mcz
>>
>> It adds a few methods that I missed (one could argue that I should package >some of this separately) and gives access to table and field names.
>
> Hi Bill,
>
> I once contacted Frank Urbach (creator of the package on squeaksource),
> but got no response.

but he replied to me and I forwarded to you.
You never got it?

>
> However: http://www.squeaksource.com/ODBC is "Read And Write" so
> you can integrate your changes easily. It's MIT and open anyway
> so anything that makes life easier should be added.

Reply | Threaded
Open this post in threaded view
|

Re: ODBC, loadFFI and friends!

Schwab,Wilhelm K
In reply to this post by Torsten Bergmann
Torsten,

I can just shove it out there, but I would feel better if someone else would try it and report on success/failure or good/bad opinions of it.  Beyond that, the question is whether anyone cares about enumerating tables and fields?  If there is interest, it is worth talking about what might be better kept on my side.  Some of the questionable methods are "redundant spellings" that are of interest to me because I have a lot of senders.   What do you think?

Bill



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Torsten Bergmann [[hidden email]]
Sent: Thursday, December 09, 2010 1:54 PM
To: [hidden email]
Subject: [Pharo-project] ODBC, loadFFI and friends!

>Please have a look at
>
>   http://www.squeaksource.com/PharoInbox/DolphinCompatibility-ODBC-BillSchwab.3.mcz
>
>It adds a few methods that I missed (one could argue that I should package >some of this separately) and gives access to table and field names.

Hi Bill,

I once contacted Frank Urbach (creator of the package on squeaksource),
but got no response.

However: http://www.squeaksource.com/ODBC is "Read And Write" so
you can integrate your changes easily. It's MIT and open anyway
so anything that makes life easier should be added.

Thanks
Torsten




--
GMX DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt auch mit
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl


Reply | Threaded
Open this post in threaded view
|

SUNit

Benoit St-Jean
Is there any way to initialize a TestCase subclass *once* and set up all the necessary stuff I need for all test cases in that subclass ? 

Let's say I want to test some socket stuff and connect only ONCE (and reuse that socket over and over, leaving it open), how should I proceed?  I don't want to open and close the socket with #setUp and #tearDown each and every time so a one-time initialization for the class (and a proper cleanup ) everytime I run the test suite is what I am looking for.  Suggestions?  Is there any Sunit version/fork/extension that would allow me to do that?

Did I miss something obvious and I have exactly what I need in front on me in my class browser right now or we can't do this with what's there now?

If it's not there, does anyone think it would be worth we add such a feature ?  I volunteer to get it done!

tia!
 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)


Reply | Threaded
Open this post in threaded view
|

Re: SUNit

Lukas Renggli
TestResource is what you look for.

Lukas

On 12 January 2011 19:13, Benoit St-Jean <[hidden email]> wrote:

> Is there any way to initialize a TestCase subclass *once* and set up all the
> necessary stuff I need for all test cases in that subclass ?
>
> Let's say I want to test some socket stuff and connect only ONCE (and reuse
> that socket over and over, leaving it open), how should I proceed?  I don't
> want to open and close the socket with #setUp and #tearDown each and every
> time so a one-time initialization for the class (and a proper cleanup )
> everytime I run the test suite is what I am looking for.  Suggestions?  Is
> there any Sunit version/fork/extension that would allow me to do that?
>
> Did I miss something obvious and I have exactly what I need in front on me
> in my class browser right now or we can't do this with what's there now?
>
> If it's not there, does anyone think it would be worth we add such a feature
> ?  I volunteer to get it done!
>
> tia!
>
> -----------------
> Benoit St-Jean
> Yahoo! Messenger: bstjean
> A standpoint is an intellectual horizon of radius zero.
> (Albert Einstein)
>
>



--
Lukas Renggli
www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: SUNit

Mariano Martinez Peck
In reply to this post by Benoit St-Jean


On Wed, Jan 12, 2011 at 7:13 PM, Benoit St-Jean <[hidden email]> wrote:
Is there any way to initialize a TestCase subclass *once* and set up all the necessary stuff I need for all test cases in that subclass ? 

Let's say I want to test some socket stuff and connect only ONCE (and reuse that socket over and over, leaving it open), how should I proceed?  I don't want to open and close the socket with #setUp and #tearDown each and every time so a one-time initialization for the class (and a proper cleanup ) everytime I run the test suite is what I am looking for.  Suggestions?  Is there any Sunit version/fork/extension that would allow me to do that?


As Lukas said, the best solution here is using TestResource. I did exaclty what you describe there for the SqueakDBX tests and the connections to the database.
 
Did I miss something obvious and I have exactly what I need in front on me in my class browser right now or we can't do this with what's there now?

If it's not there, does anyone think it would be worth we add such a feature ?  I volunteer to get it done!

tia!
 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)



Reply | Threaded
Open this post in threaded view
|

Re: SUNit

Benoit St-Jean
In reply to this post by Benoit St-Jean
That I knew but my problem is that *all* resources are initialized *at once* before running the test suite.  I would need *only* the proper resource to be initialized before running all tests in every TestCase subclass...  My problem lies in the fact that the resource I need is a singleton instance that is initialized based on specific parameters, each time different from one test case to another.  So what happens is that all tests cases end up using this singleton with the way it was last initialized before running the test suite, which ain't good!
 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)



From: Mariano Martinez Peck <[hidden email]>
To: [hidden email]
Sent: Wed, January 12, 2011 1:48:13 PM
Subject: Re: [Pharo-project] SUNit



On Wed, Jan 12, 2011 at 7:13 PM, Benoit St-Jean <[hidden email]> wrote:
Is there any way to initialize a TestCase subclass *once* and set up all the necessary stuff I need for all test cases in that subclass ? 

Let's say I want to test some socket stuff and connect only ONCE (and reuse that socket over and over, leaving it open), how should I proceed?  I don't want to open and close the socket with #setUp and #tearDown each and every time so a one-time initialization for the class (and a proper cleanup ) everytime I run the test suite is what I am looking for.  Suggestions?  Is there any Sunit version/fork/extension that would allow me to do that?


As Lukas said, the best solution here is using TestResource. I did exaclty what you describe there for the SqueakDBX tests and the connections to the database.
 
Did I miss something obvious and I have exactly what I need in front on me in my class browser right now or we can't do this with what's there now?

If it's not there, does anyone think it would be worth we add such a feature ?  I volunteer to get it done!

tia!
 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)




Reply | Threaded
Open this post in threaded view
|

Re: SUNit

Lukas Renggli
> That I knew but my problem is that *all* resources are initialized *at once*
> before running the test suite.  I would need *only* the proper resource to
> be initialized before running all tests in every TestCase subclass...  My
> problem lies in the fact that the resource I need is a singleton instance
> that is initialized based on specific parameters, each time different from
> one test case to another.  So what happens is that all tests cases end up
> using this singleton with the way it was last initialized before running the
> test suite, which ain't good!

Tests do not run in a predefined order, so you cannot make assumptions on that.

What you can do, is to let your TestResource return different
resources based on the context, i.e. the test class that requests it.

MyTestCase>>singleton
    ^ MyTestResource current singletonFor: self

MyTestResource>>singletonFor: aTestCase
    ^ singletonCache at: aTestCase class ifAbsentPut: [ aTestCase
buildSingleton ]

If you want to see an example of this pattern have a look at the tests
of PetitParser. PPCompositeParserTest (and its subclasses) and
PPParserResource do exactly follow that pattern.

Lukas

--
Lukas Renggli
www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: SUNit

Benoit St-Jean
I guess I<ve explained myself poorly.

Let's say that my singleton class, let's call it CommunicationManager must be initialized and connected to a different port each and every time.  Let's say my test cases class are MotorSensorTestCase, HumiditySensorReceiver, TemperatureSensorTestCase and WindSensorTestCase. 

Imagine, for each of those 4 classes, I define the a resource for each BUT each is using/calling the same CommunicationManager but initialize it to a different port.  Since the TestResources are *all* initialized at once before running a test suite, I end up having all test cases using a resource (my CommunicationManager sole instance) but with the last port to which it was initialized.

I don't mind the order of execution, as long as during the execution of all tests within a test case class, the singleton uses the right port.  But since the resources are not individually initialized *before* execution of the tests in a test case class, I end up with whatever executed last before running the test suite.

Am I losing you guys?!?!
 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)



From: Lukas Renggli <[hidden email]>
To: [hidden email]
Sent: Wed, January 12, 2011 3:12:16 PM
Subject: Re: [Pharo-project] SUNit

> That I knew but my problem is that *all* resources are initialized *at once*
> before running the test suite.  I would need *only* the proper resource to
> be initialized before running all tests in every TestCase subclass...  My
> problem lies in the fact that the resource I need is a singleton instance
> that is initialized based on specific parameters, each time different from
> one test case to another.  So what happens is that all tests cases end up
> using this singleton with the way it was last initialized before running the
> test suite, which ain't good!

Tests do not run in a predefined order, so you cannot make assumptions on that.

What you can do, is to let your TestResource return different
resources based on the context, i.e. the test class that requests it.

MyTestCase>>singleton
    ^ MyTestResource current singletonFor: self

MyTestResource>>singletonFor: aTestCase
    ^ singletonCache at: aTestCase class ifAbsentPut: [ aTestCase
buildSingleton ]

If you want to see an example of this pattern have a look at the tests
of PetitParser. PPCompositeParserTest (and its subclasses) and
PPParserResource do exactly follow that pattern.

Lukas

--
Lukas Renggli
www.lukas-renggli.ch


Reply | Threaded
Open this post in threaded view
|

Re: SUNit

Lukas Renggli
> I don't mind the order of execution, as long as during the execution of all
> tests within a test case class, the singleton uses the right port.  But
> since the resources are not individually initialized *before* execution of
> the tests in a test case class, I end up with whatever executed last before
> running the test suite.

Did you try and understood my code example?

Maybe you want to replace the CommunicationManager with a Mock?

Lukas

--
Lukas Renggli
www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Pharo packages and Settings/Preferences questions

Benoit St-Jean
In reply to this post by Benoit St-Jean
Two quick questions this morning :

1) If I am using a package from squeaksource.com and this package only works with Squeak now (methods have been removed from Pharo, methods only exists in Squeak, different behavior in Pharos vs Squeak, whatever the reason), what is the preferred way of committing a works-in-Pharo version to SqueakSource ?  I wouldn't want the same problem happening to Squeakers, i.e. someone loads this package in Squeak and discover that the new version only works in Pharo now!  Perhaps the answer is "Pharo needs its own SqueakSource repository" but in the meantime, what should I do and how?

2) Is there a preferred way of adding settings/preferences to the Pharo environment, if so can someone redirect me to the proper documentation/link on how-to-do-it ?  I'm a bit confused as to what I'd have to use since there seems to be some old (?!?!) Preferences stuff still present in Pharo.  In my case, I'd like to be able to specify my own parseableSourceCodeTemplate instead of the default one.
 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)

Reply | Threaded
Open this post in threaded view
|

Re: Pharo packages and Settings/Preferences questions

Stéphane Ducasse

On Jan 18, 2011, at 2:51 PM, Benoit St-Jean wrote:

> Two quick questions this morning :
>
> 1) If I am using a package from squeaksource.com and this package only works with Squeak now (methods have been removed from Pharo, methods only exists in Squeak, different behavior in Pharos vs Squeak, whatever the reason), what is the preferred way of committing a works-in-Pharo version to SqueakSource ?  I wouldn't want the same problem happening to Squeakers, i.e. someone loads this package in Squeak and discover that the new version only works in Pharo now!  Perhaps the answer is "Pharo needs its own SqueakSource repository" but in the meantime, what should I do and how?
May be postfix the package name with -Pharo


> 2) Is there a preferred way of adding settings/preferences to the Pharo environment, if so can someone redirect me to the proper documentation/link on how-to-do-it ?  I'm a bit confused as to what I'd have to use since there seems to be some old (?!?!) Preferences stuff still present in Pharo.

Probably only in the external package. Please do not use Preferences. We will remove the class probably in 1.3.

>  In my case, I'd like to be able to specify my own parseableSourceCodeTemplate instead of the default one.

Let us know if this is answering your question.
I suggest that you package your setting in a separate package.


>  
> -----------------
> Benoit St-Jean
> Yahoo! Messenger: bstjean
> A standpoint is an intellectual horizon of radius zero.
> (Albert Einstein)
>
>


Settings.pdf (425K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Pharo packages and Settings/Preferences questions

Mariano Martinez Peck
In reply to this post by Benoit St-Jean


On Tue, Jan 18, 2011 at 2:51 PM, Benoit St-Jean <[hidden email]> wrote:
Two quick questions this morning :

1) If I am using a package from squeaksource.com and this package only works with Squeak now (methods have been removed from Pharo, methods only exists in Squeak, different behavior in Pharos vs Squeak, whatever the reason), what is the preferred way of committing a works-in-Pharo version to SqueakSource ?  I wouldn't want the same problem happening to Squeakers, i.e. someone loads this package in Squeak and discover that the new version only works in Pharo now!  Perhaps the answer is "Pharo needs its own SqueakSource repository" but in the meantime, what should I do and how?

usually people use a YourApp-Dialect  YourApp-Dialect-Squeak  , YourApp-Dialect-Pharo etc.
Then you can use Grease or Sport. Finally, with Metacello you can automatically load packages depending on the OS.
 

2) Is there a preferred way of adding settings/preferences to the Pharo environment, if so can someone redirect me to the proper documentation/link on how-to-do-it ?  I'm a bit confused as to what I'd have to use since there seems to be some old (?!?!) Preferences stuff still present in Pharo.  In my case, I'd like to be able to specify my own parseableSourceCodeTemplate instead of the default one.
 
-----------------
Benoit St-Jean
Yahoo! Messenger: bstjean
A standpoint is an intellectual horizon of radius zero.
(Albert Einstein)