Open Menu

Synergex Blog


Replicating Data to SQL Server – Made Easy

By Steve Ives, Posted on July 28, 2016 at 5:29 pm

For some time now we have published various examples of how to replicate ISAM data to a relational database such as SQL Server in near to real time. Until now however, all of these examples have required that the ISAM files that were to be replicated needed be modified by the addition of a new “replication key” field and the addition of a corresponding key in the file. Generally this new field and key would be populated with a timestamp value that was unique to each record in the file. While this technique guarantees that every ISAM file can be replicated, it also made it hard work to do so because the record layout and key configuration of each ISAM file needed to be changed.

However, almost all ISAM files already have at least one unique key, and when that is the case one of those existing those keys could be used to achieve replication without requiring changes to the original record layouts or files. When this technique is combined with the capabilities of I/O hooks it is now possible to achieve data replication with only minimal effort, often with no changes to the ISAM files being replicated, and with only minimal modification of the original application code.

I am pleased to announce that I have just published a new example of doing exactly that. You can find the example code on GitHub at https://github.com/SteveIves/SqlReplicationIoHooks. Of course if you are interested in implementing data replication to a relational database but need some assistance in doing so, then we’re here to help; just contact your Synergex account manager for further information.


PSG PDF API Moves to GitHub

By Steve Ives, Posted on May 28, 2016 at 11:05 am

This is just a brief update on the current status of the PDF API that I have mentioned previously on this forum. During the recent DevPartner Conference in Washington DC I received some really great feedback from several developers already using the API, and some very positive reactions from several others who hope to start working with it in the near future.

During my conference presentation about the API I mentioned that I was considering making the code a little easier to access by moving it out of the Code Exchange and on to GitHub. Well it turns out that was a popular idea too, so I am pleased to announce that I have done just that; you can now obtain the code from its new home at https://github.com/Synergex/SynPSG_PDF. And if any of you DBL developers out there want to get involved in improving and extending the API, we will be happy to consider any pull requests that you send to us.


PDF API Enhancements

By Steve Ives, Posted on March 28, 2016 at 1:38 pm

Last year I announced that we had created a new PDF API and made it available via the CodeExchange in the Synergy/DE Resource Center. Now I am pleased to announce that we have made some enhancements to the original API, namely by adding the ability to:

  • View existing PDF documents (Windows only).
  • Print existing PDF documents (Windows only).
  • Draw circles.
  • Draw pie charts.
  • Draw bar charts (with a single or multiple data series).

Here’s an example of a pie chart that was drawn with the new API:

PieChart

Here’s an example of a bar chart:

BarChart

And here’s an example of a multi-series bar chart:

MultiBarChart

It’s early days for the support of charts, and I plan to make several additional enhancements as time permits, but I wanted to make the work that has been done so far out into the wild, and hopefully get some feedback to help me decide what else needs to be done.

If you’re interested in learning how to use the PDF API then I’ll be presenting a session that will teach you all about it at our up-coming DevPartner conference in May. So if you haven’t already done so, head on over to http://conference.synergex.com to reserve your spot at the conference now.


Updated PDF API

By Steve Ives, Posted on October 16, 2015 at 11:24 am

A few weeks ago I announced that a new API called SynPSG_PDF had been added to the code exchange. Today I am pleased to announce that the API has been updated and, in addition to Windows, is now also supported on systems running Linux (32-bit and 64-bit), OpenVMS (AXP and IA64) and Synergy .NET.

Also, as a direct result of recent customer feedback, I have added a mechanism that allows a PDF file to be easily created from an existing text file with just a few lines of code. This means that existing report programs that already produce plain text output can be easily modified to produce PDF output with a small amount of code like this:

AttachFileExampleCode

If  you would like to check out the API you can download the code from https://resourcecenter.synergex.com/devres/code-exchange-details.aspx?id=245.


New Tools for Working with PDF Files

By Steve Ives, Posted on September 11, 2015 at 2:44 pm

For some time now the Synergy/DE Code Exchange has included an item called PDFKIT which essentially contains a set of DBL wrapper code that allows the open source Haru PDF Library to be used from DBL. The work done in PDFKIT was a great start and has been used successfully by several developers, but I don’t think that anyone would disagree with me if I were to suggest that it’s not exactly the most intuitive software to use, and it’s not exactly what you would call well documented either; just like the underlying Haru library!

So as time permitted for the last few weeks I have been working on what I hope is an improved solution. I certainly didn’t want to totally reinvent the wheel by starting from scratch, as I mentioned PDFKIT was a great start, but I did want to take a slightly different approach that I thought would be more useful to a wider number of developers, and I did want to make sure that complete documentation was included. What I came up with is called SynPSG.PDF, and it is available in Code Exchange now.

When you download and extract the zip file (SynPSG_PDF.zip) you will find that it contains these main elements:

  • pdfdbl.dbl
    • This is the DBL code that wraps the Haru PDF library and is taken directly from the latest version of PDFKIT.

    Haru PDF Library DLL’s

    • The same DLL’s that are distributed with PDFKIT. Refer to the documentation for instructions on where to place these DLL’s.
  • SynPSG.PDF.dbl
    • A source file containing the new API that I have created.
  • SynPDG.PDF.vpw
    • A Synergy/DE Workbench workspace that can be used to build the code, as well as build and run several sample programs that are also included (this is a Workbench 10.3.1 workspace and will not work with earlier versions of Workbench).
  • SynPSG.PDF.chm
    • A Windows help file containing documentation for the new API 

You don’t need to use the Workbench configuration that I have provided, if you prefer you can simply include the pdfdbl.dbl and SynPSG.PDF.dbl files into the build for your subroutine library. But remember that both of these files contain OO code, so you will need to prototype that code with DBLPROTO.

As you will see when you refer to the documentation, most things in the API revolve around a class called PdfFile. This class lets you basically do four things:

  1. Create a PDF file.
  2. Save the PDF file to disk.
  3. View the PDF file by launching it in a PDF viewer application.
  4. Print the PDF file to a printer.

I’m not going to go into a huge amount of detail about creating PDF documents or using the API here because these topics are discussed in the documentation, but I will mention a couple of basic things.

PDF documents inherently use an X,Y coordinates system that is based on a unit called a device independent pixel. These pixels are square and are 1/72 of an inch in each direction. The coordinates system that is used within pages of a PDF document is rooted in the lower left corner of the page which is assigned the X,Y coordinate 0,0. The width and height of the page in pixels depends on the page type as well as the orientation. So for example a standard US Letter page in a portrait orientation is 8.5 x 11 inches, so in device independent pixels it has the dimensions 612 x 792.

With most PDF API’s you work directly with this coordinates system, and you can do so with this API also, but doing so can require a lot of complex calculations, and hence can be a slow process. But often times when we’re writing software it is convenient for us to work in simple “rows and columns” of characters, using a fixed-pitch font. The new API makes it very easy to do just that, meaning that results can be produced very quickly, and also meaning that existing report programs (that already work in terms of rows and columns) can be easily modified to produce PDF output.

Here is an example of a simple row / column based report that took only a few minutes to create:

image 

Of course there are times when you need to produce more complex output, and the new API lets you do that too. To give you an idea of what it is capable of, here’s a screen shot of a mock up of a delivery ticket document that I created while working on a recent customer project:

image

As you can see this second example is considerably more complex; it uses multiple fonts and font sizes, line drawing, box drawing, custom line and stroke colors, etc. And although not shown on these examples, there is of course support for including images also.

The new API is currently available on Windows under traditional Synergy. It should be possible to make the code portable to other platforms in the near future, and .NET compatibility is definitely in the pipeline. The software requires the latest version of Synergy which at the time of writing is V10.3.1b. You can download the code from here:

https://resourcecenter.synergex.com/devres/code-exchange-details.aspx?id=245

It is early days for this new API and I have many ideas for how it can be extended and enhanced. I am looking forward to working on it some more soon, and also to receiving any feedback or suggestions that you may have.


Build your own CLR

By Richard Morris, Posted on March 26, 2015 at 1:54 pm

Open source code is all the rage these days, everyone is doing it, even Synergex.  For some years now CodeGen and Symphony Framework have been open source.  They are both available on www.codeplex.com.  What this gives you is the ability to see inside the classes and programs to see, if you are interested, exactly how they are doing what they do. Even Microsoft are joining the open source band wagon – the .NET Framework is open source and the CLR is following!  Where PSG lead, others will follow (LOL – I think that means laugh out loud, so my kids tell me).

Does this mean you are going to grab all the code, build your own CLR and tweak it to make the blue windows green? No, not at all.  What it does mean is that people can now see what’s happening inside the ocne “black box” and move this code to other platforms.  And this obviously helps us Synergy .NET developers.  We can already take advantage of other platforms because of the availability of the .NET framework and CLR components on non-windows platforms.  It’s how we can deploy your next application to that fancy new Android or iOS phone.  It’s how you can take your good received code you wrote 10 years ago, bundle it up into a tablet application with signature capture and have real time “proof of delivery” built into your systems.

Aside from the conference topics there was an interesting question on the Synergy-l list last night.  The request was to display multiple coloured boxes on the screen.  Sounds simple – and using Synergy.Net inside Visual Studio it was!  20 minute later….

boxes

 

 

 

 

 

 

All the UI elements (colour, values, images) come from a data bound repository based structure so you could load the contents directly from your ISAM files.  The actual colours and images are selected through switches inside the XAML code based on the values of your synergy data.  I don’t think I’ll be demonstrating this simple example at the DevPartner 2015 conference, but there will be lots of great examples to see, and of course tutorials to step you through how it’s done.  It’s the last day of DevWeek tomorrow which means I’ll be driving my car around the M25 car park trying to get out of central London for hours.  So I’ll make this my last blog from the conference.  As always the conference has been enlightening.

 


New Code Exchange Items

By Steve Ives, Posted on September 23, 2014 at 7:59 pm

Just a quick post to let you know about a couple of new items that will be added to the Code Exchange in the next day or so. I’m working with one of our customers in Montreal, Canada this week. We’re in the process of moving their extensive suite of Synergy applications from a cluster of OpenVMS Integrity servers to a Windows environment. We migrated most of the code during a previous visit, and now we’re in the process of working through some of the more challenging issues such as how we replace things like background processing runs and various other things that get scheduled on OpenVMS batch queues or run as detached jobs. Most of these will ultimately be implemented as either scheduled tasks or Windows Services, so we started to develop some tools to help us achieve that, and we thought we’d share 🙂

The first is a new submission named ScheduledTask. It’s essentially a class that can be used to submit Traditional Synergy applications (dbr’s) for execution as Windows Scheduled Tasks. These tasks can be scheduled then kicked off manually as required, or scheduled to run every few minutes, hours, days, months, etc. You also get to control the user account that is used to schedule the tasks, as well as run the tasks. The zip file also contains two sample programs, one that can be run as a scheduled task, and another that creates a scheduled task to run the program.

The second submission is called Clipboard, and you can probably guess it contains a simple class that gives you the ability to programmatically interact with the Windows Clipboard; you can write code to put text onto the clipboard, or retrieve text from the clipboard. Again the submission includes a small sample program to get you up and running.

Hopefully someone else will find a use for some of this code.


RSS

Subscribe to the RSS Feed!

Recent Posts Categories Tag Cloud Archives