Re: [Pharo-project] Pharocast ContactManager using SandstoneDb
On Tue, May 3, 2011 at 10:09 PM, Doug Edmunds <dougedmunds@gmail.com> wrote:
Hello,
I took the ContactManager code from your Pharocast at http://www.pharocasts.com/2011/02/pharo-gui-with-polymorph.html and modified it to run with SandstoneDb, using the ideas from
http://www.pharocasts.com/2010/04/sandstonedb-simple-activerecord-style.html
Go ahead and use it for a future Pharocast if you want, or figure out some place to put it.
Because Contact is an SDActiveRecord, the database is constructed from the SandstoneDb records:
Contacts class >>database |db| db := Contact findAll asOrderedCollection. ^ db
and so it is portable, so long as the Contacts records are put in the correctly named Pharo subdirectory.
Opening the ContactListEditor uses an initialization which is supposed to avoid the need to close/reopen Pharo after creating the Contacts class.
Tested on Pharo 1.3 using SandstoneDb-RamonLeon.135.mcz
Thanks a lot Doug. May be the next step would be to create a ConfigurationOfContactManager :) Laurent
-- Doug Edmunds
Kind of on topic as you're talking about sandstone....Since all records are loaded at start up, is there an advantage of using sandstonedb for persistence over just saving the image? -- View this message in context: http://forum.world.st/Re-Pharocast-ContactManager-using-SandstoneDb-tp349344... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
The difference is that saving the whole image is a longer operation that just saving a couple records when they are directed to do so. In a image with little activity this difference can be almost null but in a heavy accessed image with a lot of data being created, the difference in times is notorious. Also, the image save is blocking AFAIK and during image saving the responsiveness is greatly diminished. Cheers El mié, 04-05-2011 a las 04:36 -0700, Jeff Gray escribió:
Kind of on topic as you're talking about sandstone....Since all records are loaded at start up, is there an advantage of using sandstonedb for persistence over just saving the image?
-- View this message in context: http://forum.world.st/Re-Pharocast-ContactManager-using-SandstoneDb-tp349344... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Miguel Cobá http://twitter.com/MiguelCobaMtz http://miguel.leugim.com.mx
Also, images can get corrupted, crash, etc. 2011/5/4 Miguel Cobá <miguel.coba@gmail.com>
The difference is that saving the whole image is a longer operation that just saving a couple records when they are directed to do so. In a image with little activity this difference can be almost null but in a heavy accessed image with a lot of data being created, the difference in times is notorious. Also, the image save is blocking AFAIK and during image saving the responsiveness is greatly diminished.
Cheers
El mié, 04-05-2011 a las 04:36 -0700, Jeff Gray escribió:
Kind of on topic as you're talking about sandstone....Since all records are loaded at start up, is there an advantage of using sandstonedb for persistence over just saving the image?
-- View this message in context: http://forum.world.st/Re-Pharocast-ContactManager-using-SandstoneDb-tp349344... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Miguel Cobá http://twitter.com/MiguelCobaMtz http://miguel.leugim.com.mx
participants (4)
-
Bernat Romagosa -
Jeff Gray -
laurent laffont -
Miguel Cobá