Sunday, July 31, 2011

Application Framework

While I am still working on the application and have a long way to go to completely convert my old app, I do have the first form working. It did and not take long to get the basics up and working and that is a testimonial to the application framework provided with the SIMPOL Developers Kit. Among the sample code provided, there is a fully functioning sample application for a single record form, including add, save, delete functions.  To get my first form up and running, the docs explained to merely copy that project, rename a few things, and point it to my form.

The first time I did that, it seemed like a lot of work, but that was mostly because everything was new.  I still had the form up in a working window on the first day I tried it.  Now that I have more experience with the app framework, I anticipate that I can use this technique much more rapidly to create a single form app.

Another thing that helps get to a working app quickly are the conversion tools, and designer tools.  There are conversion tools (from Superbase to SIMPOL) for just about everything but the code, forms, reports, files.  After converting files and forms to the new format, I popped the form into the forms designer to tweak it  and then into the application framework to produce a working window app.  Pretty neat, really, especially if you are already familiar with the tools.  I have not used the report conversion and designer tools yet, but I suspect they will be as easy to use also.

Another feature of the forms designer, and I suspect the reports designer also, is the ability to generate a working program from the form. I can save the form as a program and then use the program or pieces of it in the application.  On several occasions I used the feature to inspect the form creation code and determine the correct syntax for accessing partucular objects.  I even copied a section of code for creating a detail block and used it in my project. I did this because I wanted to use a volatile file (in memory file) in the detail block, and such files are not available in SIMPOL Personal, the component for creating and maintaining file, forms and reports.

There is more code to write in the new environment, but the application framework and the supplied tools help you generate or copy most of that code.

-djinks         Apps and Services:

Thursday, July 28, 2011

Form Control Part 1

A lot has happened and I should have gotten to the blog sooner, but the heat of development overcame me.  Sometimes when developing software I cannot make myself stop.  I just must keep going, either to resolve a problem I am having or because I'm making so much progress  that I do not want to stop.  Both situations have been dominant that last few weeks.

I started converting this form, partically because I saw it as harder than the other forms I had in the project.  It uses detail blocks to show multiple rows (of my notes) data from one file, while linked to a single master record (at the top of the form).  Detail blocks are a cool feature and I wanted to see how well they worked in the new development environment.  I looked at  a datagrid control, but with datagrids, the whole row is the same height.  Detail blocks give me more control over field size and placement on the form.  I think the result looks better.  The option buttons on the right side are used to filter the multiple rows of data to just those that match the selected category.

With the old system, Superbase, I could just add a where clause to the detail block definition to filter the data, but in the new system, SIMPOL, I did not yet have that ability.  I therefore wrote a filter routine to check the records before adding them to the subset file, which linked to the form.

I ran into a few problems along the way.  First the detail block were not sorting the data properly (descending by date and time) and the form was crashing when I attempted to load it after adding the sort information.  I sent a sample app to the developers, demonstrating the problem and they responded in a day or two with changes to their code to rectify the issues.

Next, I tried to use a volatile file for the filtered notes subset data.  Volatile files are files created only in memory and the are distroyed when the program closes.  I wanted to use one for the filtered data for several reasons.  First they should be fast (no disk I/O).  Second, they are single user, and more efficient for an individual scratchpad type file.  I did not want users to share a file for this purpose.

I encountered an error that prevented me from copying the subset records to the volatile file, so I made up another demo program and shipped it off to the developers.  The vendor responded the next day with new libraries to fix the problem and I kept on going.

That approach to issue resolution is one I find most effective, creating a sample app to demonstrate the problem.  Takes a bit of time, mostly to develop the sample data files to send with the project and to write detailed, step-by-step, instructions how to recreate the error, but the issues seem to be resolved more quickly, when the developer can easily find/see the issue.

I was really pleased once I had the volatile file working.  There was still plenty of work to do, but you can read about that in my next blog post.  Hopefully I can do that tomorrow.  Right now, it's 3am and I'm gonna need some sleep.

-djinks         Apps and Services:

Sunday, July 10, 2011

Conversion of Existing Programs

Yesterday I converted my files to use the new PPCS (Peer-to-Peer Client-Server) server program.  I was originally goint to wait and do this last, but the main technical contact at SIMPOL convincedme that file performance was at least twice as fast with the new database engine.  Performance boosts always get my interest. In order to convert the files, I had to remove any virtual (non-stored) fields and replace them with physical fields.  Usually these were just calculated fields I used for concatonated index keys.  I used virtual fields to save disk space, but that argument hasn't been valid for many years now. The conversion was not as complex as I had imagined.  In the new database environment calculated fields are not allowed.  I will need to write code to calculate any such fields when saving a record.  This approach is safer than letting the database engine do it for you.  I have seen cases where because of an error, child records were linked to the wrong parent.  Since I now must write that code, I can place extra checks that parent and child records belong together before changes are saved.  

The new database server approach uses one program to serve the files to multiple users of the LAN or WAN connections.  The client programs need a minor change to the OPEN FILE statements.  I was pleased to see that I had already made this change a few years ago, when we had a user accessing and changing database records from a remote location, over relatively slow DSL.  It worked well then and now we are using this approach again with a new, faster server program.  Once the files were converted, the server configured and turned on, I tested connectivity with the SIMPOL Personal, the file maintenance utility that came with the development system.  Actually it also contains the Form and Report Designer utilities.

Once I could read the files from the server and scroll back and forth through the data, I started today to configure them for use with my existing Superbase code.  It took an hour or two, but the results have been pleasing so far.  I had one file with a calculated index and kept giving me problems.  In the end, I decided the file could just be read locally and did not need to be served.  Changes to it would be very infrequent as it is just a lookup table.  With that decided, I confirmed that all buttons still worked.  I also noticed I had a few menu items that were obsolete, so I wrote a few lines to disable them and tested that.  Bam! I'm done and look forward to making my converted forms into a real program.

Tomorrow, or rather later today, I will look at finishing the new form redesign and hook up a new menu and toolbar.

-djinks         Apps and Services:

Thursday, July 7, 2011

First steps

Well, it has taken far too long to get started.  Things always seem more urgent than developing the next version, which no one is willing to pay for.  Maybe when I have something to show, clients will be more enthusiastic.  One thing that has come up:  clients do not like to run programs in a virtual machine.  That is too complex an environment for them.  I must concur.  There are enough quirks with virtual machines, that a more skilled technical resource (me) is needed a bit too often.

I made my first steps at program conversion this week.  First I looked at database conversion.  The current system uses a desktop database system, Superbase.  I have been using the Superbase development environment for over ten years now.  When I started, it was the best, including a forms designer, report designer, program editor, and an integrated database engine.  It was fast and did not require a powerful machine.

I thought I would need to convert my files straight off.  However Superbase includes a Peer-to-Peer Client Server (PPCS) module that allows me to serve the files via UDP/IP protocals, over local LAN or even WAN connections.  I tested that the new software, SIMPOL, can read these files and was pleased to find it can.  There are some minor limitations, mostly I cannot use fields that have defined calculations.  I had used these fields to generate compound index fields, based on other fields in the record.  The main benefit of them was that I did not need to write code to populate each field.  That was done for me by the system, when a record was saved.  In SIMPOL, I must write the code to populate each such field during the save record function.  Not a biggie, but something to remember when I start to write code.

 The exciting part is, with PPCS, I can continue to use the old system, with minor changes to the OPEN FILE statements, while I use the same files with the SIMPOL programs and forms as I implement them with my client's systems.  Thus I will be able to incrementally convert them to the new system.

I spent the last few weeks reading the SIMPOL documentation and thinking how to procede.  There are a number of conversion tools available, including one for converting files to the new format (I'm passing that up for now), one for converting forms, and one for each report type (graphical or text).

After testing out the provided PPCS sample programs, I established a server for my files on one machine and tested I can access them with the SIMPOL file and form access tools and programs.  Finally I converted my main form and tested the data access with the converted form.  Pretty impressive to get it working in less than two days. I still do not have a working program, but the included SIMPOL Personal utility can use the converted form to read my files and make changes.  Tomorrow, I will try to build and compile a program to do the same thing.

The form conversion went fairly smoothly, but I needed to clean up things with the new forms designer, mostly color and font attributes that work differently in SIMPOL.  I miss my nice 3D controls, that Superbase's forms designer provided.  The new cross-platform widgets don't look quite as nice.  I acclimated to most differences quickly enough, but the buttons look sub-par.  I hope we get new, more professional looking widgets in the next SIMPOL release.  My main problem is I cannot control the background color around the buttons.  I can control the button background and the button text color, but the edges of the button's rectangle are the same as the button face, where I am used to a transparent color, so that the underlying form's color shows through, giving a rounded button, without the grey rectangle.  Maybe I'm too used to none-grey forms.  Maybe it will grow on me, but I always though my Superbase forms looked better than those developed with that ubiquitous grey background color.
[edit] I looked at a sample SIMPOL form and decided the raised rectangle in my old form was causing the problem.  I removed the rectangle (was only there for the raised edge effect) from the converted form and things started looking better.  I don't think I will need bitmap buttons, but I have that option if I don't like the standard ones..[/edit]

Here is an example of the current form  
Here is an example of the new form

That is all for now.  Tomorrow I will try to get the form to work within it's own program.  That involves adding a menu and a toolbar and writing a shell to load the files and the form.  After that is tested, I must make all those buttons do something.

-djinks         Apps and Services: