Windows 7 Pharo DBXTalk – “my hack”

Having just got ConfigurationOfODBC working from Pharo Smalltalk, I had some trouble determining exactly how to get at the individual data items.  So I thought I’d check out DBXTalk for comparison.  DBXTalk is a lot more comprehensive solution leaveraging OpenDBX which includes its own ODBC interface along with several other backends.  However all the ODBC connection examples I saw were for database servers with connection strings that were not of the “DSN” form that I think is required for Microsoft Access – so I ended up returning to ConfigurationOfODBC and resolving the issue above.

Yet I was most of the way through getting DBXTalk working, so I record my experience here for posterity.  It is the “hack” version since to resolve library dependencies I simply copied everything next to virtual machine executable.  I’ll look into resolving these more correctly later.  So I…

  1. Created a new folder Pharo-1.3-13315-cog2522-dbxtalk and into it:
    a. Extracted the “Contents” folder only from Pharo-1.3-13315-OneClick.zip
    b. Extracted all files from cogwin_r2522.zip
    c. Updated croquet.ini file with: ImageFile=Contents\Resources\pharo.image
    .
  2. Ran croquet.exe and then:
    World Menu > Monticello Browser.
    .
  3. From the Monticello Browser opened:

    http://www.squeaksource.com/MetacelloRepository

    and loaded:
    ConfigurationOfOpenDBXDriver-GuillermoPolito.13
    .
    then from a Workspace executed:
    (ConfigurationOfOpenDBXDriver project version: #’stable’) load.
    .

  4. From a Workspace found the required OpenDBX library to be 1.4.4 by executing:
    OpenDBX currentOpenDBXVersion
    .
  5. Extracted all nine files from http://linuxnetworks.de/opendbx/download/opendbx-1.4.4_win32.zip into folder Pharo-1.3-13315-cog2522-dbxtalk
    .
  6. From a DBXTalk developer I asked which version of PostgreSQL to try, and the prompt response came back as 8.3. I installed the current version at this time (postgresql-8.3.17-1-windows.exe) choosing all the defaults.
    .
  7. Now possibly step 3 is made redundant by the following, but this post is a record of what I actually did.
    .
    In Monticello Browser I opened repository:
    http://www.squeaksource.com/DBXTalk
    .
    then loaded:
    ConfigurationOfGlorpDBX-GuillermoPolito.70
    .
    then in a Workspace I executed:
    (ConfigurationOfGlorpDBX project version: #’stable’) load.
    .
    which left the following message in Transcript 

    IMPORTANT FOR GLORP AND OpenDBXDriver DRIVER
    In order to run sucessfully Glorp tests you should need to change the database connection settings used by them. To do this, change the following methods:
    -GlorpDatabaseLoginResource>>defaultPostgreSQLInternetLogin
    -GlorpDatabaseLoginResource>>defaultPostgreSQLLocalLogin
    -GlorpDatabaseLoginResource>>defaultPostgreSQLLoginForGlorpStore 

    After doing this all Glorps tests must be green.

    Evaluated -> GlorpOpenDBXDriver >> postLoadGlorpDriverDBXTalkPharo

    …finished 2.4

    Looking at GlorpDatabaseLoginResource>>defaultPostgreSQLLocalLogin shows:

    defaultPostgreSQLLocalLogin
    “To set the default database login to PostgreSQL, execute the following statement.”
    “self defaultPostgreSQLLocalLogin.” 

    ^DefaultLogin := (Login new)
    database: PostgreSQLPlatform new;
    username: ‘sodbxtest’;
    password: ‘sodbxtest’;
    connectString: ’127.0.0.1:5432_sodbxtest’.

    Now rather than changing these connection settings, for a first attempt I thought it might go easier the other way making the database match the tests, so…

  8. From the Windows Start Menu ran pgAdminIII.
    .
  9. From pgAdminIII created a new user sodbxtest:
    Servers > PostgreSQL 8.3 (localhost:5432) >Login Roles > New Login Role.
    with the widest privileges possible.
    .
  10. From pgAdminIII created database sodbxtest:
    Servers > PostgreSQL 8.3 (localhost:5432) > Databases >> New Database
    Name=sodbxtest
    Owner=sodbxtest
    Privileges=ALL, Role Public
    .
  11. Then for later comparison I checked that the number of tables in this new database is zero: Servers > PostgreSQL 8.3 (localhost:5432) > Databases > sodbxtest > schemas > public > Tables
    .
  12. Now “the hack” (since I was in a rush and would have needed to log out and back in as Admin to adjust the search paths.)
    .
    In Pharo I ran some Glorp Tests and got an error “could not find libpq.dll.”  After finding this file in folder PostgresSQL/8.3/libs, rather than properly resolving the lookup, the quick fix was copying everything from that folder next to the virtual machine in folder Pharo-1.3-13315-cog2522-dbxtalk.  A subsequent error “could not find ssleay32.dll” was fixed similarly by copying the contents of folder PostgresSQL/8.3/bin next to the virtual machine.
    .
  13. Then in Pharo from World Menu > Test Runner all 823 tests for GlorpTests-Models, GlorpTests-Database & GlorpTest are successful.
    .
    In addition, if I recheck the number of tables noted in Step 14 and find there are now 75 tables – full of data.
    .
    Excluded from this are GlorpTests-DatabaseTypes, GlorpTests-Extras, GlorpOpenDBXDriverTests since they seem to cycle through testing databases  that I don’t have installed – in particular OCI.dll for Oracle.

One small annoyance is that once a “missing OCI.dll” error occurs, it continues to occur even when the previously successful tests are rerun.  This remains until reset by: GlorpDatabaseLoginResource defaultPostgreSQLLocalLogin.

So this is a good result and I’ll be glad to further DBXTalk later on.  However for now, for my current requirements (a one-time one-way import from an mdb file into Pharo) I think that ConfigurationOfODBC is more suitable.

Posted in Uncategorized | Leave a comment

Pharo 1.3 ODBC working on Windows 7

Wow. Eight months since my last post.  It is now apparent the impact over that time of my 60-70 hour work week onsite at a mine expansion.

This post summarises the result of discussion on the pharo-project mailling list where I sought assistance getting ODBC working on Pharo 1.3.  Credit goes to Mariano Peck and Eliot Mirranda for assistance troubleshooting, providing a slightly older configuration that worked, and then the latest VM build.  I am happy to report that ODBC appears to be working with the Pharo 1.3 image on MS Windows 7 using CogVM version 2522.

The purpose of this is that I have a UML design an application has stored in a Microsoft Access database.  I want to use Pharo to implement that design directly into Smalltalk classes since I could not find a common export/import format.  ConfigurationOfODBC looked promising so I followed instructions at http://www.pharocasts.com/2010/12/access-database-through-odbc.html, except that rather than using SQLLite I started with a blank Microsoft Access database.  This worked well on Pharo 1.2.1 but not out of the box Pharo 1.3.

Here is the method to get ODBC working and tested with Pharo 1.3.

1. With this  TestMDB.mdb in a local folder, set up the ODBC data source using
Start > Control Panel > Administrative Tools > Data Sources (ODBC)

ODBC Data Source Administrator

Clicked <Add…> and choose the Microsoft Access Driver

and <Select…> the TestMDB.mdb file configured as Data Source Name “TestMDB”

ODBC Microsoft Access Setup

ODBC Microsoft Access Setup

which gives…

2. Unzip Pharo-1.3-13315-OneClick.zip and then delete all files from
folder “Pharo-1.3-13315-OneClick.app”, leaving just the Contents folder.

3. Extract the files from VM.r2522/cogwin.zip into folder “Pharo-1.3-13315-OneClick.app”

4. Copy the “ImageFile=Contents\Resources\pharo.image” line from the old pharo.ini into Croquet.ini and then run Croquet.exe.

5. Load the ODBC package from within Pharo.  I had some trouble accessing Squeaksource, but I found success using a mirror (you might skip the first two lines…)

Gofer new url: ‘http://dsal.cl/squeaksource/MonticelloRedirect’; package: ‘MontiRedirect’; load.

MRManager redirectFrom: ‘http://www.squeaksource.com/’ to: ‘http://dsal.cl/squeaksource/’.

Gofer new
squeaksource: ‘ODBC’;
package: ‘ConfigurationOfODBC’; load.
(Smalltalk at: #ConfigurationOfODBC) load.

6. And then finally, the successful test of ODBC…

connection := ODBCConnection dsn: ‘TestMDB’ user: ” password: ”.
table := (connection query: ‘select * from user;’) execute asTable.
connection close.
table inspect.

Inspector on ODBCResultTable

Inspector on ODBCResultTable

Thats all.  Now time to explore that UML design….

Here are some links to the full discussion and a backup cache of the files

Update 24 Dec 2011…

7. Just recording an example for the next part of actually processing the database. Following on from the previous step…

( row := table first ) inspect.
( name := row at: #name ) inspect.
( age := row at: #age ) inspect.
( allNames := table collect: [:each | each at: #name] ) inspect.

To go with the above example I have also uploaded a new file TestMDB – 2011-12-24.zip with a few additional rows of data.

Posted in Uncategorized | Tagged , , , | 3 Comments

mouse buttons and menus

My mouse is a Logitech Wireless Nano Mouse M305.  The default function of the mousewheel (button 3) is Zoom.  To be most useful for Smalltalk, the mousewheel function needed to be configured as Middle Button.  For Windows 7 this was done via
[Start > Control Panel > Mouse > SetPoint Settings] as pictured below. Continue reading

Posted in System | Leave a comment

performance testing spreadsheet

For anyone anyone so inclined to replicate the results, or update the results for subsequent releases of the Smalltalk systems, the linked spreadsheet Squeak Graphics Framework Performance Testing.ODF was used to generate the graphs in these articles:

You are able to attach graphs to your comments in those articles.

Posted in Uncategorized | Leave a comment

workspace referencing to existing morphs

Flipping through Andy Burnett’s blog Learning Smalltalk he discusses in Getting a handle on objects from the Flaps how to get programmatic reference to morphs that have been created by direct manipulation – for example by being dragged on-screen from the tool flaps.  The “textual reference to dropped morph in  Workspaces” looked like an interesting feature that would likely to be quite useful in the future – so best to find out how it works right now… Continue reading

Posted in Debugging | Leave a comment

morphic flavour performance

Previously in morphic performance I benchmarked different actions in Squeak Smalltalk for creating, hiding, showing and deleting morphs in Squeak.

On [squeak-dev] Herbert Konig wrote: “Juan Vuletich has done a great job at simplifying cleaning and speeding up his version of Morphic in Cuis.”

So lets check that out.  We should compare some other flavours of Smalltalk.  The code used to generated the graph data is the same  “V1″ code as used for morphic performance. The software versions tested here are:

Posted in Morphic | Tagged , , , , | 14 Comments

wordpress shared hosting performance

It’s the second week of running WordPress, so I’ve been trialing a few plugins…  Suddenly, about half the time I do anything I get “Apologies, but the page you requested could not be found.” The page loads fine the second time with a simple page refresh.  The site is brand new, so there shouldn’t be any traffic.  So what gives? Continue reading

Posted in Admin | Tagged , , , , , , | 6 Comments

morphic performance

For my postgrad dissertation I’ve decided to program an engineering design tool.  I’d like to focus more on the application domain rather than the programming minutiae.  Based purely on gut feel from a long-held but unproven belief, I’ve selected Smalltalk as the development platform.  Specifically I’ve selected Squeak with its Morphic graphics system, which seems to have a lot of useful “direct manipulation” functionality.  Now some validation of this choice would be useful and one place to start is performance testing.  Continue reading

Posted in Morphic | Tagged , | 3 Comments