Login to participate
  
Register   Lost ID/password?

Louis Kessler’s Behold Blog

Got a Little Carried Away - Sun, 27 Dec 2009

I was working on fixing the exception reporting. And working. And working… Every little alley took another twist and turn.

First I had to figure out how EurekaLog was calling up your email program. Two complaints about it was more than I wanted to hear:

Your debug routine fails to send the file, as it tries to start windows mail for some reason known to it’s self rather than using the default mail client (in my case thunderbird)

I tried to fill up the exception report but gave up when it asked for this server, that server! I then got really annoyed because it launched Outlook - I never, ever use it or want to use it.

So I found out that it was using Messaging Application Programming Interface (or MAPI). The problem is MAPI is not included with every email program, and will in such situations bring up a different program than the one you have as default. I also checked out the INDY (a Delphi package that provides Web services), and it has the same problem.

But there was a solution. The “mailto” command you find on websites brings up your default email program. It also has parameters that allow you to specify who it is going to, the subject, the body of the message and others. On a windows machine, that same function can be called by passing the mailto line to ShellExecute.

I thought I’d try it. It didn’t take too much to get a test going. And I was quite pleased to see that the web limitation of 256 characters was not there.

I had to figure out how to disconnected EurekaLog’s report and set up my own Exception Dialog form. Then I had to figure out how to pull all the info out of EurekaLog’s debug information for inclusion into my form. That went fairly smoothly until I got to the Operating System information. That was only in their log file, so I had to work out how to parse their log to find that information.

Wonderful. It was all set up and ready to go. I saw EurekaLog was attaching its log as a zip file. Hmmm. I don’t need to do that, since all the relevant error information was now in the body of the email message. But wouldn’t it be great if I could also (at the user’s option) automatically attach the GEDCOM and/or the Behold file and the future Log file?

Then I discovered (and this took over a day to realize it) that mailto did not support attachments with most email programs. I found a lot of people asking how to do this via Google searches, and there were several answers given. I tried them all and they didn’t work for me. Then I found that it only worked for certain email program such as Outlook, so that was no good.

But I was rolling. I knew there must be a some simple way to get the attachments to the email program. I posted a question on StackOverflow: How can a Delphi Program send an Email with Attachments via the DEFAULT E-mail Client?. The answers were coming in, but they were all telling me to go MAPI or INDY.

So I continued to do some research and I discovered some code that was not too complicated on Dragging and Dropping files from my application to Windows Explorer. Doing so would also allow me to list the files and allow the user to (relatively) easily drag them over to the email message that I’d create for them. It’s not the perfect solution, but it seemed like the best I could do if I wanted to ensure I properly accessed the user’s default email program.

I set up a Filelistbox on my Exception form, and got it all working. It was old code and required a few changes to work with Unicode strings. But it worked.

Next was setting up the Filelistbox to list the GEDCOM files and … oh oh. It required all the files be in the same directory because it was designed for an explorer-like directory listing. That didn’t work. After some thinking, I copied my ElTree from Behold’s FindFiles window and adapted that.

Once I had the file list box, then I discovered the GetFileListDataObject routine from the code I adapted also assumed everything was in the same directory. I had to convert that to figure out the data objects of each file no matter what directory they were in. This was code that I really didn’t understand. But I took a shot at it. I was extremely surprised when this worked the very first time - a rare event for me and for programmers in general.

I had to add “Select All” and “Select None” buttons to easily allow you to pick the files to drag. The selection of individual files had an interaction with the dragging, so that was a glitch that is still outstanding as I write this.

Then the cruncher came. My final tests and I get an exception while doing the mailto. It turns out that there is a limitation of 2048 characters that I can pass via mailto. Could I live with that? I don’t know. I was hoping to append the log file once I recreate it next version to the exception email, but that would now not be possible.

I was just about ready to take my lumps and maybe even back out of this whole thing, when surprise of surprises - another answer on my StackOverflow question appeared.

Instead of using “mailto”, mjustin pointed me to a way to used the Windows “sendto” command to send the attached files to the default email program and set up a new message with the files attached. This method will not require the user to do the extra step and drag and drop the files to the message and apparently it also has no limit in size of message either.

So just a bit more work to implement this now.

Yes. I did get carried away. This was a lot of work for something not part of the core functionality of Behold. But I’m not one to let something go half way. Best to finish it off while its in the moment.

And how was your holiday weekend?

Exception-ally Bad - Sun, 20 Dec 2009

I’m almost completed all the bug fixes. There is one more that involves TRichView and scrolling up with the arrow key. When you reach that horizontal line in the Everything Report, it gives an exception.

There’s really only about 8 lines that are needed to get this working. I’ve just been trying hard to find those 8 lines, because they involve saving the selection and then restoring it. It’s easy in most of TRichView, but that horizontal line is a RichView Table, and I just haven’t been able to get that working. So I’ve got a question into Sergey on his Support Forums but I’ll have to wait until he gets back from holidays (Dec 27) before he can help me solve this.

Speaking of exceptions, a couple of people have complained about the exception handling that I added into the current beta. It causes problems interacting with their email system trying to set up an email to post back to me with the error.

That information has been tremendously beneficial to me. In about 4 bug reports, it led me directly to the source of the bug and saved me many hours of work. But I do admit that it is very intrusive and I don’t think I would like having a software product that tries to start my email program. So I’m going to work to simplify it considerably, and make it friendly and useful.

Basically, I’m going to have the box come up and just tell you the error that occurred (e.g. “Division by zero”) and the routine and line number where it thinks it happened. Then it will ask you to email that info to me to help me improve Behold.

I may decide to store that error in your Behold registry info, so that it can differentiate between the new errors and the ones that you’ve had before, and it can give you a count and ask you to email the info if it hasn’t happened before. When you upgrade to a new version, it will wipe out that registry info, because presumably those problems will have been fixed in Behold.

Then on my Future Plans page, I’ll list the errors, routines and lines where these exceptions have been reported. And I’ll mark them off as I get through them.

That’s what I’d call going from Exception-ally Bad to Exception-al.

The Name Game - Wed, 16 Dec 2009

A GEDCOM file contains a person’s name on the NAME tag. It normally looks like this:

1 NAME first middle /surname/ suffix

e.g. 1 NAME John Jacob Jingleheimer /Schmidt/ II

The name parts should be shown in the order given, but without the two slashes that surround the person’s surname.

To make this trickier, some East Indian names are in the form:

1 NAME /surname/ middle first

and should be displayed in that order.

I had Behold handling the East Indian names correctly, and I’ve now got it to handle the suffix automatically and correctly as well.

Behold is fairly unique in its ability to take the wife’s surname at birth and add the surnames of all the men she is matched to, ending with her final spouse, e.g. Mary Jane [Watson Osborn] Parker.

Now there are times you’ll want to override that. One example was a file that had under the marriage record a date of “NOT MARRIED”. So I check for that and do not add the husband’s surname in that case. I don’t know of any other instances where that sort of an indication is in the GEDCOM, but if I find any, I’ll add them. Once I get to Version 2.0 and editing, Behold itself will store this “override” into the file, so you’ll have complete control.

Some people have asked for the ability to turn off the generation of married names in Behold. While fixing the names, this turned out to be a very simple thing to do. So I’ve now added a Report option for this. Then Behold will give you less information than you’ll want just like other programs do.