Home Steve Waring's Journal

Archives for November 2002


change Email enabled

I went a long way towards solving my "email enabled" problem this weekend ... and had some fun doing it.

I started by looking at what 3rd party options I could use:

I downloaded the first two, but none of the options appealed to me. Most were out of my price range; $500US is not value for money for what I need. Chilkat was reasonable at $39 or so, but would have required distributing 1mb of DLLs. Lastly the thought of debugging network operations through a COM component left me feeling slightly queasy.

So I got out my YANGNI (You are not gonna need it) pencil and listed what I did need. The requirements split cleanly into two; 1 ) A way to create the content of the email and 2 ) A way to send it.

Create the content

I had not read the MHTML spec before, but I had done some work with MIME. Last year I ported some of Squeak's MIME and POP/SMTP code to Dolphin to use to play around with SOAP via email transport. At the time, I was able to send a base64 encoded SOAP envelope and decode a quoted-printable SOAP response. My memory of the code was not good; I had only worked on it to the point of getting it to work, and being stream/socket/eol code, subtle bugs were no doubt introduced in the port.

I dug out that code and had a quick look, but once again said to myself, YANGNI.

All I needed to do was to write the stuff out, I didnt need to decode, I dont need to interoperate ... I only need to write out one valid representation. I ended up with two simple classes each of which has a handful of methods. I make use of the base64 encoder, and use 7bit encoding elsewhere.

I can now write out multi-part MHTML ... Its 100% Smalltalk, I can fix bugs not work around them, a couple of hours work saved $500, and I dont have to stuff around with distributing a 3rd party DLL.

The fun started once I had a basic test case working, and I could play around with the code. I dumped the MHTML contents to disk and used the Shell to open it. On my system, the ".eml" extension is registered to open an MHTML file in OutlookExpress, while the ".mht" extension is registered to open it in InternetExplorer.

I started making use of the fact that I had full control over the construction of the content, and was able to add some interesting features (and some interesting looks :) ... rather than just seeing this functionality (ie "email enabled") as a convenience, I started seeing the potential for value-added.

Send it

Before I started working on the MIME classes, I figured I had three options i) Somehow open my content in the users default email program ii) Use Dolphin's CDO wrapping (w2k) iii) Use my own SMTP class.

The major problem I have with ii) and iii) is imagining the look on my users face when I pop-up the dialog asking; "Please enter your SMTP server address". CDO has a way to access the user's Outlook mail settings, but on my system it got it wrong which didnt inspire much confidence. (It found a stopped IIS service and dumped the mails into its out folder ).

... Anyway, at this stage once again I said to myself, (maybe) YANGNI. Maybe other email clients recognize ".eml" and "mht" as MHTML files. If not, maybe it is simply a matter of finding out what extensions they do recognize as MHTML. If you use a default email program other than Outlook, or a default browser other than Internet Explorer, I would be interested in hearing what happens if you download mhtml.eml , mhtml.mht and then double click the downloaded files.

Thanks!

Link 6:33:18 PM, Monday, 25 November 2002 Email

change Top Ten

Link 1:36:31 PM, Monday, 25 November 2002 Email

change A wrapping of the Animation Control

Uploaded a new article A wrapping of the Animation Control.

Overview

The Windows Animation Control is a simple control that displays AVI clips. This article contains a wrapper for the control and a sample ToGo application that contains a toolbar animation.

animationControl

earthrot

The above screenshot uses an AVI that was converted by Animation Shop from a GIF animation obtained from http://www.webdeveloper.com/animations/

Link 7:23:59 AM, Saturday, 23 November 2002 Email

change SOAP Question, REST answer

In comp.lang.smalltalk, Mark Watson asked about using VW7 SOAP to access Google.

10 days later he found the RESTFul answer.

Link 7:14:41 AM, Saturday, 23 November 2002 Email

change Powered by Smalltalk

I have just added one of Mathilde's Powered by Smalltalk logos to this page and the front page of dolphinharbor.

I linked both back to Why Smalltalk.

I would personally like to see Why Smalltalk and the STIC web site ("The Future of Programming") as one and two on Google.

As I understand it (or more accurately as I understand what other people guess), Google distributes a page's rank over its links. Therefore a page that has 1) a high rank and 2) has only a couple of links to external pages, will have a very positive effect on the external page's ranks.

While dolphinharbor is only a drop in the ocean, the Why Smalltalk link is the only external site link (aside from this site) on its front page.

These pages; UIUC and Squeak have high rank and few external links. They would be very effective in raising another pages rank.

Link 9:19:45 PM, Friday, 22 November 2002 Email

change Dolphin Tip - Splitting a FramingLayout

Uploaded my first tip article; Splitting a FramingLayout.

Overview

A Splitter is normally used with a Proportional LayoutManager, however it can be used with a FramingLayout which allows greater control when the view changes size.

frameSplitter

Link 7:11:17 PM, Wednesday, 20 November 2002 Email

change Scriptable Shell Objects

Uploaded a new article Scriptable Shell Objects.

Overview

Using Dolphin's Active-X Component wizard to generate COMInterfaces classes for the Scriptable Shell Objects, enables a Dolphin program to easily make use of services from the Windows Shell.

scriptableShell

Update

I wrote most of this article last weekend, but ended up getting frustrated because I still have not found "the" way to enable my application to send email. My requirements are:

  • While I dislike receiving them, I want my application to be able to send html formatted emails.
  • If Outlook is the default client, I would like there to be a good chance it will work. However, it is a convenience function, so it doesnt matter if it fails.
  • I want to my application to open its content in the user's default email program, and let them address the email. I dont want to ask the user for mail server/account settings.
  • My application is targeted at Win98/2000/XP with IE5 installed.

My problem is not that I cant find a way to do this, but that I have found too many ways. Each method seems to have its own potholes, or is only available on certain versions of windows, or requires XY and Z to have been installed. I still have and no idea of what the best approach is.

Link 11:10:00 AM, Saturday, 16 November 2002 Email

change AIBO ... Dolphin6 and the WebBrowser control

Congratulations to Andy, Blair and Timo from Object-Arts for what sounds like a great OOPSLA demo. The trip report is interesting reading, and the PDF is worth a look. I hope they are able to make a video for those of us who have not seen the presentation.

I think I am going to have to put an AIBO dog on the wish list once Dolphin 6 is released.

A taste of Dolphin 6

timoCHB

I found the above screenshot in the PDF. What piqued my curiosity was the right-hand pane ... what is it? ... a new Richedit control wrapping, or is it based on the WebBrowser control, or possibly a wrapping of MFC's CHtmlView?

WebBrowser

My interest in using the WebBrowser for a UI started after using Groove. I also found a demo on codeguru which contained some interesting effects. (beware, this demo changes your internet explorer global settings).

The WebBrowser UI model works. I have watched windows users, with 2-5 yrs experience, who still have major double click/single click confusion, who never think to right-click, but they have mastered the interface verbs of the WebBrowser. They know how to click on links and they know what the back button is.

In one of my applications, I have three use cases for the WebBrowser control (wbControl). The main UI functionality is still implemented using conventional MVP, the wbControl use cases are all targeted at providing the user with information and help in using the program. Since they provide secondary functionality, it is giving me the freedom to explore different ways to implement this as I go along.

The application can still be fully navigated and controlled by this secondary UI. There is a simple toolbar at the top of the screen with "back", "home" and "stop" buttons. Rather than "back" moving back to a previous page in the wbControl, it moves back to the previous state of the UI. The links in the wbControl dont cause a navigation to a new page in that wbControl, but rather navigate to a new arrangement of the primary UI. The bottom line is that it doesnt behave like a conventional browser, but I think that the familiarity with browsing will translate well.

I have been doing alot more work and thinking about UI issues the past couple of months than I have done in the past. Last year I concentrated on Spray and Swazoo etc which didnt require much in the way of a UI, however I am under no illusion that for my current applications, the look and feel and useability of the UI will make or break them.

Duplication

Code duplication is bad, UI duplication is good. Dolphin's command framework makes it easy to duplicate UI elements without needing to duplicate any code. I can use the same menu/commands in the main menubar, as a context popup menu, and in my latest application, I am even dropping the same menu down from a toolbar button.

By duplicating the UI, I increase the chance that a user will discover more of my application's functionality, and once they find it, they will be able to find it again. It is frustrating for a user to know that a program can do something, to have a memory of the program doing something, but not remember where/how to do it again.

WebBrowser control use-cases

As mentioned above, I have three use cases for the wbControl in one application. The first two use cases share the same control.

  • The first use-case is for when the user first starts the program. The WebBrowser is used to provide an introduction to the program.
  • The second use-case is more dynamic. It duplicates what is typically found in a "properties" menu of an item in a list. By moving this information out of a right-click menu, and automatically putting it in front of the user, I am hoping they will gain a deeper understanding of the program. The goal of this view is to (hopefully!) teach the user to not need it.
  • The third case is more conventional in that it does display html retrieved from a web-page, however this is still a secondary function of the programs UI.

Mechanics

I have a presenter for the wbControl. This can be configured (via the IAxWinAmbientDispatch Interface) to block pop-up menus and dialogs. I have also implemented IDocHostUIHandler for greater control. I would like to be able to implement my host's IDispatch but I have not been able to do this (and I think that Dolphin's use of AtlAxWin window means that I cant. The "Timo" screenshot above gives me hope that I will be able to in Dolphin6 ). The presenter contains a flag instanceVariable to allow navigation. To load the control with html, this flag is set to true, the html is written to a file, and the file:// url is navigated to. At all other times, the flag is set to false, any attempted navigation is cancelled and handled programmatically. (FWIW: The wbControl only triggers an event (and therefore allows you to cancel) the navigation to a resource, it does not trigger events for the embedded media it retrieves (ie img/object etc).

I am using the scheme dolphincommand:// to identify links that should be interpreted as commands. I had a play around with using external commands, but I dont see any advantages to the added complexity. At this stage I have only needed monadic commands, but I guess this could be extended to include arguments ... etc dolphincommand://doSomething/5/abc

One nice thing about Dolphin's command framework is that a presenter implements a method (queryCommand:) which is used to dynamically control the state of commands. At this stage I have not needed to update the wbControl to reflect the state of commands, however with dhtml, this would be easy enough to do.

Intermingling

I like the word "Intermingle", it switches easily between good and evil depending on the context.

Implementing the second use case was the most interesting. I am used to having the solid foundation of MVP under my feet, and all of a sudden I felt I was at sea. I had objects, that would have been MVP models answering html strings, presenters implementing commands, and trying to aggregate bits of html from the "models" into a coherent whole. eeeck.

I think that the reason the WebBrowser UI is effective is because it intermingles, but if that UI intermingling maps directly to code, and results in intermingling between model and view code, it is a bad thing. Enough of this intermingling ...

A Dolphin CommandDescription contains a message/selector, image, and description. This command description maps easily to an html link command, but what about the rest of this paragraph?

My current solution is as follows

  • My model can be asked for a UIState object which can be one of 5-6 subclasses.
  • A UIState object can be asked for markup strings, however they do not contain formating markup, instead I use div classes that describes what the strings are.
  • An html builder class can ask a UIState object for a number of markup strings; "information" "detailedInformation" "actions" "tips" and "help". This builder class is then responsible for arranging the markup and a stylesheet gives it the required look.
  • The presenter routes commands back to the UIState object.

It is not very dynamic nor general, but it is doing what I need. That said, I am keeping my fingers crossed that Object-Arts have been working on this, and that html/wbControls will be more tightly integrated into the MVP framework in Dolphin6.

Link 8:44:38 PM, Friday, 15 November 2002 Email

change Blog Update - archives

I have added monthly archives, which will replace the single item archive system I have been temporarily using. This has allowed me to reduce the size of the main index.html file, while still making the old content readable. I am not a big fan of lots of small pages of content, it may have something to do with my round-trip times, but I find the page loading delay annoying. I still see sites that have articles, spread over 8 pages, with two paragraphs per page. If they are doing that to force me to look at more banners, fair enough, but if they think that people still dont know how to scroll down a page, and it makes their site more useable, they are dead wrong for this user.

I have been thinking about ways to organize the old content more effectively. I can see a number of themes running through my items that could be somehow collected together. Maybe I should take a leaf out of wiki's book and refactor/merge the content of the items in the same theme.

The "Link" href at the bottom of each item is now a relative href to the item's permanent (... well planned permanent) location in the archives.

Link 2:32:22 PM, Friday, 15 November 2002 Email

change Menu Article Update

A quick update for the Menu Addons article. I also added some backlinks and metadata to the other articles.

Link 1:35:13 PM, Friday, 15 November 2002 Email

change Cache

I sent out an http request with the header "Accept-Encoding: ". According to RFC2616 the server should interpret this as I will only accept the identity encoding. From one server, I got back a response with gzip encoding ... the strange thing was that this server normally responds with the identity encoding. I dug into the response headers, and what do you know ... there was a "Via: some rude cache" header in there. Arggg.

I use two dial-up ISP's, one of them uses a cache. As far as I am concerned, the way they have it configured is what can give caches a bad name. The above bug is fairly obscure, but I have recently noticed other strange behavior. It seems the trigger for it to validate the freshness of a cached resource depends on content-type. When I upload the index.html and rss.xml for this site, the new index.html is returned immediately, but it takes a couple of refreshes to see the new rss.xml file. I am not sure why it is configured to treat xml as less likely to change than html, and for the rss.xml, I can only guess that the cache detects multiple (po-ed) refreshes and decides then to check. IMO if a cache has an e-tag for a resource, it should use it.

I downloaded Davorin Rusevljan's CgInfoZip wrapper, and was able to get that up and running without problems, however it is for zip files only, and I could not see how to get the active-x control to work with gzip. I then downloaded Nico de Boer and Bill Schwab's wrapper for the ZLib compression library. This will do what I need nicely, while the library has functions to read gzip files, it looks easiest to read header bytes myself, and then use the library functions to inflate the content in memory. Thanks to Bill, Nico and Rush!

Link 8:22:23 AM, Monday, 11 November 2002 Email

change Favorites

The way I use favorites has changed. I still add to my favorites list, but only to use them as a backup in the case that I cant find the same site again via Google.

I have become very dependent on Google, more so since I came across Dave's Quick Search Taskbar Toolbar Deskbar I find it a great way to quickly open a new browser on a Google search, it is how I "use" Google.

Link 6:40:12 AM, Monday, 11 November 2002 Email

change Croquet

I was sent a couple of excited emails this week; an early version of Croquet (aka teatime) was out.

I spent the day yesterday playing around with it and I am very impressed. My machine is 2-3 years old; a dual Celeron 500Mhz with a Matrox Dual head 400 video card and two 1024*768 monitors. I found the performance in the 3D world fairly smooth, but not being a 3D game player, I had no expectations of what the 3D performance should be.

Exploring the world was fun, I had a good laugh when I saw myself in the mirror, and (like I always seem to do accidently in Squeak) I was able to rip part of a 2D project UI out into the 3D world :)

The pdf documentation was very helpful, and the code itself contains good comments. The classes in the teatime category are well commented and also contain a Test class that can be played around with. I ended up spending most of the day reading up on matrices, complex numbers and quaternions, trying to dredge up 10 year old memories. I have a steep learning curve* ahead of me if I am to understand how Croquet works, but I have always wanted a better understand of 3D graphics. Croquet is the perfect opportunity, can there be a better way to learn than to select an object and be able to open a browser or inspector on it?! (more fun than shooting something for the gazillionth time)

You dont need to know any Smalltalk to give the demo a try, but be aware that it is pre-release code. Here is a screen-shot from my system:

croquet

*Steep learning curve; I remember well my first trip to Whistler/Blackcomb, BC Canada. Australia has its Snowy Mountains, a large and beautiful Alpine area, but they are old, you would get a better mental picture if you think "Snowy (slushy?) hills" I was part of of a group of about 20. We arrived late at night, and headed out to Blackcomb early the next day. Visibility was low, excitement was high. I remember being amazed on the chairlift, at how fast it was going and how high it was going. It just kept going and going and going. It was like nothing I had experienced before, I couldnt believe that a mountain could be so steep and so high. Finally we got to the top ... but there was nothing there ... except for the bottom station of another chair lift (at first sight I wondered if it was a chair going down the other side of the mountain) The next chairlift went up again, just as far and just as fast as the first. At the top of that chair the visibility had improved, and surprise surprise, down to the left was yet another chair and as I found out later, there was one further t-bar lift to the top. It was definitely a steep learning curve that day, and it is this shape of learning curve I like being on :)

Link 6:29:10 AM, Monday, 11 November 2002 Email

change Building an IE Favorites Menu

Uploaded a new article Building an IE Favorites Menu.

Overview

Dynamically build a menu from Internet Explorer's favorites, and convert a favorite file into a url.

menu screenshot

(Can you see what I have been up to this week :)

Link 10:27:29 PM, Friday, 8 November 2002 Email

change BottomFeeder 2.1

I had an hour to play before the whirlwind woke up this morning, and I upgraded to the new BottomFeeder version. Wow, the changes to check for not modified responses make a huge difference ... BottomFeeder is now motoring through my feed list. Nice work James and David!

I also noticed the option to display the feeds that I am subscribed to in a browser. I was thinking I would rewrite the html that it produces into a "Blog roll" but alas, it doesnt output the rss url. I was half way through the html rewriter to do this, when I noticed that the url was the site url, not the rss url, and thought I would push on anyway.

I have been working on a "Virtual" XPath class implementation. It works similarly to Dolphin's VirtualTreeModel, in that you can set various blocks that it uses to access other objects like a tree structure, and perform the tests that XPath needs. At this stage I can only setup the XPath expression using Smalltalk, but when I get some spare time, I want to try and use the SmaCC parser generator to parse XPath expressions directly. Anyway, I was able to use this to extract from BottomFeeder's rssViewerFeeds.xml conf file the nodes I needed to produce the Blog Roll (which should show up with this update).

It turned out to be very quick and easy to do ... +1 for xml!

Link 8:15:57 AM, Saturday, 2 November 2002 Email

change New Month

As you may have noticed, I have been busy cleaning up and posting a couple of new articles. I still have a couple of half written articles; one on how to restore the position/size of a window, one on a new Image subclass I am using which supports PNG format. I was hoping to get them finished up today, but they will have to wait.

I am looking after my 2yr niece this weekend (starting in about 3hrs), she is great fun, but it will remove any ability to code, and probably take me 72 hours to recover :)

Next week is going to be a different one for me; my goal is to learn about PaintShop pro, DHTML and Javascript. I have reached the stage where I need to start producing some bitmaps; toolbar buttons, splash screens etc etc for my applications. The DHTML/Javascript is not so I can make an annoying website, but to use in an integrated help system that uses the WebBrowser control. Should be fun, but a Smalltalk image will never be too far away.

Link 2:49:03 PM, Friday, 1 November 2002 Email

change Reusing a Toolbar's ToolTip control article

Uploaded a new article; Reusing a Toolbar's ToolTip control.

Overview

Most of the support code for displaying tooltips for controls other than just the toolbar, is present in the base image. It just needs a bit of tweaking to make it happen.

tooltip

Link 2:14:09 PM, Friday, 1 November 2002 Email

My Links

Back to current Journal

Dolphinharbor home of the open source software I have written for Dolphin Smalltalk.
About me.

Powered By

Dolphin SmalltalkDolphin Smalltalk
YAXO and SIXX
Get the BottomFeeder RSS ViewerBottomFeeder RSS Viewer
Apache
FutureQuest


Copyright 2002 Steve Waring