You are currently browsing the category archive for the ‘magritte’ category.
James Foster posted several videos covering the development of iBizLog presented by José F. Bretti M. and Esteban Lorenzano at Smalltalks 2009. James has added subtitles to overcome the poor sound quality and embedded the slides from the presentation in the video …. nice job, James:
- Presentation slides (pdf)
- iBizLog Presentation at Smalltalks 2009 (part 1) (video)
- iBizLog Presentation at Smalltalks 2009 (part 2) (video)
- iBizLog Presentation at Smalltalks 2009 (part 3) (video)
- iBizLog Presentation at Smalltalks 2009 (part 4) (video)
What Gerhard has done is used Magritte to model a domain, GemStone to save the objects, and Seaside to display them. In addition, Gerhard has created a web-based UI to interact with the Magritte data. Thus, after loading his package into GemStone, everything else is handled through a web browser. The tools build a basic “CRUD” user interface (that handles Create/Retrieve/Update/Delete for the domain data).
James created a 7-1/2 minute screencast showing off Scaffolding for GemStone. As James says:
Over the last week I didn’t have a lot of time to do very much with the Pier installation other than set things up so that Seaside would be safe on the open internet:
- Remove all of the default Seaside apps, except the object log.
- Add authorization to the object log. The object log is too useful to remove, but since you can get easy access to the inspector via the object log, it has to be sealed off.
- Using the config editor for the object log, add WAAuthConfiguration as an Ancestor, then set the Login and Password.
- Set deploymentMode to true for pier, config and object log.
- Change all of the passwords (pier, config and object log).
My wife enjoyed herself writing articles and uploading pictures. We don’t have a domain name yet and we turn off lighttpd when we’re not actively using the site.
Today I finally found some time to play with Pier and take a chunk out of my todo list:
- Update to the latest GLASS package (GLASS.230-dkh.176 – still waiting for feedback from Dario, but I thought I’d go ahead and load it on my wife’s site)
- Fix a bug my wife found in the Pier-Blog package.
- Do a bit of repository cleanup.
- Convert the instances of MAMemoryFileModel to MAExternalFileModel,
The first thing I want to mention is that with a production site, it is a real good idea to have a sandbox where you can do development without worrying about impacting production users. Our web site won’t have a lot of traffic, but my wife puts in a fair amount of effort working on content and I don’t want to lose her work, so I take a couple of simple precautions:
- Before making any significant changes, I make a backup of the extent file (/opt/gemstone/product/seaside/data/extent0.dbf). I shut down the stone before copying the file, but you can also use the runBackup script, which safely copies the extent file while the system is running.
- Using scp, I copy the extent to my sandbox system (a 64 bit laptop running a copy of the appliance).
- After shutting down the stone on my sandbox, I copy the extent file to the data directory and restart the stone. The copy is useful in case you do something regrettable.
- After validating the upgrade/update steps using the sandbox, I perform them on the production system.
When all was said and done, I ended up committing a new version of the GLASS package (GLASS.230-dkh.177) and creating two web-site specific packages (Pier-Model-dkh.241 and Pier-Seaside) that I saved in a directory-based repository.
Looking at the object log, I had seen that the repository had grown from 100M to 160M since we’d started, and I was interested in seeing what I could do to reduce the amount of space used:
- There were a couple of continuations stored in the object log that I could get rid of now that the bug that my wife ran into was fixed.
- I knew that the all of the Monticello packages are saved in the repository in the Monticello cache, so I was interested to see what could be gained by flushing the cache.
- While working out the details of converting from MAMemoryFileModel to MAExternalFileModel I noticed that we had some 500 entries in the PRHistoryPersistency. Each one of history entries hangs onto a WASession along with other things, so I figured that cutting the size of the history list to 250 (from 1024) wouldn’t hurt.
In the sandbox, I gained about 20M by doing the above cleanup steps, but some of the Monticello operations took noticeably longer (the cache had to be refilled), so I don’t think that flushing the Monticello cache is worth it.
Convert from MAMemoryFileModel to MAExternalFileModel
GemStone/S extent files get moved around a lot between the time that the Seaside extent is created on one of our build machines and the time an appliance is fired up or GLASS is installed on a Linux or MAC machine. This movement makes it extremely impractical to do anything that depends upon a fixed directory path and lead to my decision to make MAMemoryFileModel the default mechanism used by Magritte and Pier to manage it’s files for GLASS.
Once a system is installed in a production environment it is desirable to start using MAExternalFileModel, because you can arrange for your web server to serve up the files.
In our case, my wife had already uploaded a number of images as instances of MAMemoryFileModel, so I needed to convert the existing instances as well as change Pier to start using MAExternalFileModel.
The first thing to do is to edit PRFile class>>descriptionFile to replace MAMemoryFileModel with MAExternalFileModel.
Then you need to decide where you want the files to be stored. If you are using the appliance, then Apache serves files out of ‘/opt/gemstone/apache/htdocs’. If you are using lighttpd as set up by
The script below, illustrates the choices made for an appliance. The rest of the script grabs all PRFile instances and swaps in an equivalent instance of MAExternalFileModel. The final statement in the script flushes the MADescriptBuilder cache, otherwise you’ll continue using MAMemoryFileModel:
| pf fm xfm | MAExternalFileModel baseDirectory: (ServerFileDirectory on: '/opt/gemstone/apache/htdocs/files'). MAExternalFileModel baseUrl: '/files'. System commitTransaction ifFalse: [ nil error: 'Commit failed' ]. (PRFile allInstances select: [:each | each file isKindOf: MAMemoryFileModel ]) do: [:pf | fm := pf file. xfm := MAExternalFileModel new filename: fm filename; mimetype: fm mimetype; contents: fm contents asByteArray; yourself. pf file: xfm]. MADescriptionBuilder default flush.
This pretty much takes care of the major items on the todo list for my wife’s website.
I am playing with some code that generates real clean URLs for Pier (unfortunately, there are some gotchas for the moment). My wife has seen some java script effects on other sites that she’d like to be able to do on her site so I’ll there’s some java script in my future. When my wife is happy with the way things look, we’ll get that domain name we’ve had our eyes on:) and set up the google analytics.
I have to say that I’m real pleased with the Pier is working out for both me and my wife.
Last week Dario Trussardi submitted a bug report to the GLASS Beta mailing list (subscription required, but feel free to subscribe if you’re interested). The bug involved Magritte auto accessors – a feature whereby new instance variables (and accessor methods) are dynamically added to a class on demand. Dario was triggering the new instance variable creation during the rendering phase of a Seaside component and getting an Internal Server Error from Seaside:
InterpreterError 2403: Cannot commit, <‘a previous commit attempt failed with an error, this transaction must be aborted’>
This error doesn’t have the most intuitive explanantion and the stack dumped into the object log was rooted in the standard commit that occurs right before the HTTP response is returned to the browser – not much help.
I had tangled with the auto accessors before, in the Magritte unit tests, but Dario’s scenario wasn’t covered there. Dario provided a simple test case and I was off to the races. In the end I was able to fix the problem in Dario’s test case (at this writing I’m waiting for confirmation from Dario – when I get it I’ll publish a Beta Update), but I thought that it would be instructive to cover the issues involved in case anyone else wanders into this territory.
If you’re using Magritte auto accessors or are seeing 2403 errors or want to geek out on GemStone for a bit or have already settled down with a cup of coffee to “read another long post of mine” (yes I’m talking about you, Gera:), then by all means read on.
- #readUsing: and #writeObject:using:
- Magritte auto accessor and Seaside