Dolphin under Wine (Blog post and videos)

51 views
Skip to first unread message

Andy Bower

unread,
Sep 30, 2011, 1:32:42 PM9/30/11
to
Folks,

As promised I have put up a blog post on how to get Dolphin running
native under Wine (in this particular case on Mac OSX using a free
product called WineSkin). You can find the blog at:

http://object-arts.com/blog/blog.html

There are a few videos to go along with the blog and these can be found
in the OA video library at:

http://object-arts.com/support/videos.html

Best regards

Andy Bower

dmcleod

unread,
Oct 11, 2011, 9:33:05 AM10/11/11
to

All,
This does work very well on a MAC Book PRO Running Lion (OX X 10.7.1).
In addition to the Dolphin Smalltalk, I loaded the Statistical package
"R" from:

http://sunsite.univie.ac.at/rcom/

Along with StatConnect (same URL). Statconnect allows Dolphin
Smalltalk to communicate with R via COM interface. This connection is
"Rock Solid".
I have transferee 300,000+ element vectors, between Dolphin and R
without any problems with WineSkin.

In addition, I have used and tested the Imaging DLL:

http://www.smalleranimals.com/isource.htm

This works just like a "real" Windows Machine.

I have been using this quite a lot without any problems. Been a big
skeptic of Wine until now.

Dennis


Peter Kenny

unread,
Oct 11, 2011, 11:56:39 AM10/11/11
to


>In addition to the Dolphin Smalltalk, I loaded the Statistical package
>"R" from:
>
>http://sunsite.univie.ac.at/rcom/
>
>Along with StatConnect (same URL). Statconnect allows Dolphin
>Smalltalk to communicate with R via COM interface. This connection is
>"Rock Solid".

Dennis

I would be very interested in using R from Dolphin - I have been trying to
do just that using Windows Pipes as a connection, but have not yet got it
working. However, if there is a method available that works, I would like to
try it. I went to the site you mention, but I could not find 'StatConnect'.
There is a package called 'statconnDCOM' on the site; is that the one you
used? Any special problems in setting up a link?

Many thanks in advance for any hints

Peter Kenny








dmcleod

unread,
Oct 11, 2011, 3:13:14 PM10/11/11
to

Hi Peter,

Yes, statconnDCOM is the pacage: Do the following under Windows or a
Windows VM on a MAC:

1. Download and run RandFriends - select only "R" to be installed.
statconnect (i.e. statconnDCOM) will be installed.
2. If you have R already installed, simply download the statconnDCOM
and install that piece. Install the samples as well. Make sure it
works with your version of R. there is a basic test program that will
lauch R and do some testing.
3. I will post some sample code and classes calling R from Dolphin.

This interface is solid. I have been using it for a year - no problems
from Dolphin.


Thanks
Dennis

dmcleod

unread,
Oct 11, 2011, 9:50:10 PM10/11/11
to

Hi Peter,

I do not know how to import the class file into this discussion board,
so I will copy and paste the class definition.
Below the class definition is a working example. Please note that the
class definition uses the iDispatch interface so nothing
needs to be imported directly into Dolphin with any of the ActiveX
wizards. Save the class below and file it in.

Please let me know if you have any questions.

thanks
Dennis

Class Definition:

"Filed out from Dolphin Smalltalk X6.1"!

Object subclass: #StatConnect
instanceVariableNames: 'connector'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
StatConnect guid: (GUID fromString: '{39CF4F55-65B5-4885-
ADF9-82948B584C55}')!
StatConnect comment: 'This class will allow access to the statistics
package called R throught the Statconnect COM object.

USAGE:

sc := StatConnect init.
sc StatRcmd: ''nv <- rnorm(4000, mean = 0, sd = 1)''.
vec := sc StatGetArray: ''nv''.
sc StatHist: vec title: ''Sample Histogram from Dennis''.
sc StatClose.

Instance Variables:

connector <Object> Used to hold an instace of
StatConnecotr.
'!
!StatConnect categoriesForClass!Kernel-Objects! !
!StatConnect methodsFor!

initialize
"Init the class StatConnect"

"If we already have a connector then exit"
connector notNil ifTrue: [ ^self ].

"Start the StatConnector server"
connector := IDispatch createObject:
'StatConnectorSrv.StatConnector'.
connector invoke: 'init' with: 'R'.

^self.
!

StatClose
"Shutdown the class StatConnect"

"If we already have a connector then exit"
connector isNil ifTrue: [ ^self ].

"Stop the StatConnector server"
connector invoke: 'close'.

^self.
!

StatGetArray: aString
"Return a defined variable frmo R via StatConnector. For example nv
<- rnorm(3000, mean = 6, sd = 1) - www := StatGetVar: 'nv'."

"If no connector then exit"
connector isNil ifTrue: [ ^self ].

"Create a tmp Vector in R"
^(connector invoke: 'GetSymbol' with: aString) asArray.
!

StatHist: anArray title: Title acolor: acolor
"Plot a Histogram using the Stat Connector. anArray is a simple
array on integers Title: Give the Graph a title"

| cmd |
"If we already have a connector then exit"
connector isNil ifTrue: [ ^self ].

"Create a tmp Vector in R"
connector invoke: 'SetSymbol' with: 'tmp' with: anArray.

"The command"
cmd := ' plot((1:256), tmp, type="h", col=c(" ', acolor, ' "),
main=" ',Title, ' ", xlab="Color Value", ylab="Color Counts")'.

"Histogram plot"
connector invoke: 'EvaluateNoReturn' with: cmd.
!

StatRcmd: aString
"Send a command in String to StatConnector (ex: nv <- rnorm(3000,
mean = 6, sd = 1) - must be a valid R string"

"If no connector then exit"
connector isNil ifTrue: [ ^self ].

"Create a tmp Vector in R"
connector invoke: 'EvaluateNoReturn' with: aString.
! !
!StatConnect categoriesFor: #initialize!public! !
!StatConnect categoriesFor: #StatClose!public! !
!StatConnect categoriesFor: #StatGetArray:!public! !
!StatConnect categoriesFor: #StatHist:title:acolor:!public! !
!StatConnect categoriesFor: #StatRcmd:!public! !

!StatConnect class methodsFor!

init
"Initialize a newly created instance of the stat connector"

^(self new initialize)! !
!StatConnect class categoriesFor: #init!public! !

Here is the working example using the class above:

sc := StatConnect init.
sc StatRcmd: 'nv <- rnorm(4000, mean = 0, sd = 1)'.
vec := sc StatGetArray: 'nv'.
vec inspect.
sc StatRcmd: 'plot(cars)'.
sc StatClose.


Thanks
Dennis

Peter Kenny

unread,
Oct 12, 2011, 12:29:05 PM10/12/11
to
Hi Dennis

Many thanks for your help. The only problem I had was that the system did
not like my ancient version of R (2.7.2!), and I had to install the latest
version. I now have R 2.13.1 and StatConnector installed, and I have
successfully run your samples. There seems to be copious documentation, so
with that and your code I should be well away.

Thanks again

Peter


Reply all
Reply to author
Forward
0 new messages