News and Updates for Synergy/DE Developers
SYNERGY-E-NEWS
News and Updates for Synergy/DE Developers

June 9, 2011

 
Synergy/DE 9.5.1 patch is now available
Includes important fixes and enhancements to Synergy/DE

Synergy/DE 9.5.1a is now available on all supported platforms. This first patch release of version 9.5 includes many important fixes throughout the Synergy/DE product set. It also includes enhancements, such as encryption support for
xfServerPlus customers developing Java clients.


Keeping Current and Taking the Lead
See how one of the UK's leading software services organizations is using the latest features in Synergy/DE to advance its application

At the SPC in Oxford next week, one of the UK’s leading software companies will show how it’s keeping its main UI Toolkit-based application current with embedded .NET and Web services, and how it’s exposing existing business logic to Web sites, CRM, workflow, and more.

Click to read the rest of the article

Constraints on generic types
By Bob Studer, Synergy/DE Senior Systems Software Engineer

The previous issue of Synergy-e-News includes an article about generic types in Synergy .NET. This article expands on that article with a discussion of contraints on generic types.


Synergy/DE Tech Tip

I am trying to set up xfServerPlus to use either a generic or port-specific synrc file, but the environment variables I have set are being ignored. I have checked the xfpl.ini file and the variables are not being set there. Where are they being set?


Quiz
Synergy/DE pros, see if you can answer this question!

In the following UI Toolkit example on Windows, what color is the window?

SPC Chicago attendees describe the conference as a "must attend" event
If you missed the Chicago SPC, attend in Oxford, UK June 14-16

The first stop of the annual Synergex Partner Conference (SPC) took place in Chicago May 24-26. Here’s what attendees are saying about it: “a must attend event,” “the best conference ever,” and “you will be blown away by what 9.5 can do.”  (Read all of the testimonials at http://spc.synergex.com/testimonials.aspx.)

Especially popular were the hands-on tutorials, where attendees got to choose from a wide range of new technologies that can be used to advance Synergy/DE-based applications.


And the winner is...
Rural Computer Consultants awarded Minnesota Small Business Persons of the Year

Rural Computer Consultants (RCC) specializes in developing Synergy/DE-based applications for propane retailers and mutual insurance companies. RCC’s owners were recently named the Minnesota Small Business Persons of the Year by the U.S. Small Business Administration.


Free code!
CodeExchange’s ISAMUtils provides a handy GUI wrapper to several ISAM utilities

CodeExchange submission ISAMUtils enables you to run isutl, ipar, and fconvert, with all of their options, in a familiar Windows interface


Platform News
Read a selection of recent articles from around the web
 


Synergy/DE 9.5.1 patch is now available
Includes important fixes and enhancements to Synergy/DE

Synergy/DE 9.5.1a is now available on all supported platforms. This first patch release of version 9.5 includes many important fixes throughout the Synergy/DE product set. It also includes enhancements, such as encryption support, for xfServerPlus customers developing Java clients. All customers using version 9.5, especially those using Synergy .NET, should upgrade to this new version immediately.
Download 9.5.1a.
See list of changes in 9.5.1a.
Go to the Synergy/DE 9.5 site.



SPC Chicago attendees describe the conference as a "must attend event"
If you missed the Chicago SPC, attend in Oxford, UK June 14-16

register=

The first stop of the annual Synergex Partner Conference (SPC) took place in Chicago May 24-26. Here’s what attendees are saying about it: “a must attend event,” “the best conference ever,” and “you will be blown away by what 9.5 can do.”  (Read all of the testimonials at http://spc.synergex.com/testimonials.aspx.) Especially popular were the hands-on tutorials, where attendees got to choose from a wide range of new technologies that can be used to advance Synergy/DE-based applications. Attendees also raved about the new features available in Synergy/DE 9.5.1, as well as all of the opportunities at the conference for networking with other Synergy/DE developers and Synergex staff.

If you missed the Chicago conference, make sure you are signed up for the Oxford SPC June 14-16.  As Chicago attendee Hal Chernoff stated, “The SPC is the best way to stay current with Synergy/DE, offering an invaluable opportunity to see and understand both what is available today and what is coming around the corner.” Register today at http://spc.synergex.com.



Keeping current and taking the lead
See how one of the UK's leading software services organizations is using the latest features in Synergy/DE to advance its application

At the SPC in Oxford next week, one of the UK’s leading software companies will show how it’s keeping its main UI Toolkit-based application current with embedded .NET and Web services, and how it’s exposing existing business logic to Web sites, CRM, workflow, and more. Register at spc.synergex.com.

Register


And the winner is...
Rural Computer Consultants awarded Minnesota Small Business Persons of the Year

Rural Computer Consultants (RCC) specializes in developing Synergy/DE-based applications for propane retailers and mutual insurance companies. RCC’s Fuel Distribution System includes all fuel and accounts receivable functionality to enable customers to effectively control customer scheduling, sales, service, cash receipts, accounts receivable, and equipment assets.

RCC’s owners were recently named the Minnesota Small Business Persons of the Year by the U.S. Small Business Administration. The Small Business Person of the Year is selected annually based on growth in sales or unit volume, increase in the number of employees, financial strength, innovativeness of product or service, and evidence of contributions to community-oriented projects.

Liz Struve, Director of the Southwest Small Business Development Center at Southwest Minnesota State University, explains why RCC was chosen to receive this honor: “RCC is an ideal business model demonstrating what can be accomplished by a small business in outstate Minnesota. RCC offers great opportunity and optimism for rural populations, by offering and bringing technologies to anywhere in the world.”

Read the entire press release at http://www.rccbi.com/download/sba2011.pdf.


Constraints on generic types
By Bob Studer, Synergy/DE Senior Systems Software Engineer

 

The previous issue of Synergy-e-News includes an article about generic types in Synergy .NET. The article below expands on that article with a discussion of contraints on generic types.

Say that you have written a class that can contain another class from which certain functionality is expected. How do you prevent the container class from being used with classes that don't provide the required features? Constraints are the answer.

Constraints are limitations placed on the type parameters, and they can prevent errors by allowing the compiler to know what members to expect. The constraints can specify one or more of the following:

  • Classes or interfaces that the type parameter must extend or implement (a derivation constraint)
  • Whether the type parameter class is required to implement a default public constructor (a constructor constraint)
  • Whether a value type or reference type is required (a value/reference constraint)

Let's implement a list class that is a list of values that can be incremented. We will include a method to increment every member of the list or a particular member by index. We will require the type parameter to implement an interface that requires a method to increment itself. We also need a default constructor method. The default constructor will allow us to create the list and populate it given only the number of members the caller requests in the constructor for the list.

First, here is the interface:

public interface IIncrementer
    public method increment,	void
    endmethod
endinterface

And here is the list class:

public class IncrList<T (class, new, IIncrementer)> extends System.Collections.Generic.List<T>
    public method IncrList
        len,	int
        parent(len)
    record
        idx,	int
    proc
        for idx from 1 thru len
            Add(new T())
    end

    public method IncrList
        parent()
    proc
    end

    public method Increment,        void
        idx,	int
    proc
        this[idx].Increment()
    end

    public method IncrementAll,     void
    record
        idx,	int
    proc
        for idx from 0 thru Count - 1
            this[idx].Increment()
    end
endclass

Note that the constraints for the type parameter, which are enclosed in parentheses following the type parameter in the class declaration statement, indicate that the type parameter

  • is limited to reference types (class).
  • is required to have a public default constructor (new).
  • must implement the IIncrementer interface.

If you attempt to use a class that doesn't meet these constraints, a TYPCONS error will be reported.

The constructor of the IncrList class that takes a length as a parameter allocates the number of elements that the caller requests and calls the default constructor inside the FOR loop the requested number of times. The constructor can do this because it can depend on the fact that the default constructor is available.

Because the class can assume that the element class provides the Increment method, the list class provides methods to increment single elements of the list and also every item in the list. Given that IncrList extends System.Collections.Generic.List<T>, it could implement the IncrementAll method differently using the ForEach method, but that is beyond the scope of this article.

With these constraints, the compiler can make some assumptions about the class being used as the type parameter. The compiler can emit calls to methods and reference fields with the assurance that they are there to be referenced.

Now we can implement the class we will use for an element of this list:

public class ListElem implements IIncrementer
    private member,		int
    public property Val,	int
        public method get
        proc
            mreturn member
        end

        public method set
        proc
            member = value
        end
    endproperty

    public method ListElem
    proc
        member = 0
    end

    public method Increment,	void
    proc
        member = member + 1
    end
endclass

Note that the class explicitly implements the required interface and the Increment method it includes. It also provides a public default (parameterless) constructor.

We can now implement the main routine and create an instance of the desired list class using the element class we have created:

record
    theList,        @IncrList<ListElem>
    elem,           @ListElem
proc
    theList = new IncrList<ListElem>(10)
    elem = theList[5]
    elem.Val = 10
    theList.Increment(5)
    theList.IncrementAll()
    Console.WriteLine(theList[5].Val)
end

This will create an instance of the IncrList class, using the ListElem class as the type parameter representing the element type for the list. It creates the list with 10 elements, sets the value of the fifth element to 10, increments the fifth element explicitly, and then increments every element in the list. Finally, it prints out the fifth element, which we can see is now 12 due to both increment operations.

Using constraints to enforce requirements for generic classes, as shown in this article, can help you prevent errors that might be difficult to debug. For more information about constraints, see chapter 8 in the Synergy Language Reference Manual.

Here is the example program in its entirety:

import System.Collections.Generic

namespace myList
public interface IIncrementer
    method Increment,		void
    endmethod
endinterface

public class ListElem implements IIncrementer
    private member, int
    public property Val,	int
        public method get
        proc
            mreturn member
        end

        public method set
        proc
            member = value
        end
    endproperty

    public method ListElem
    proc
        member = 0
    end

    public method Increment,	void
    proc
        member = member + 1
    end
endclass

public class IncrList<T (new, class, IIncrementer)> extends System.Collections.Generic.List<T>
    public method IncrList
        len,	int
        parent(len)
    record
        idx,	int
    proc
        for idx from 1 thru len
            Add(new T())
    end

    public method IncrList
        parent()
    proc
    end

    public method Increment,		void
        idx,	int
    proc
        this[idx].Increment()
    end

    public method IncrementAll,	void
    record
        idx,	int
    proc
        for idx from 0 thru Count - 1
            this[idx].Increment()
    end
endclass
endnamespace

record
    theList,	@IncrList<ListElem>
    elem,	@ListElem
proc
    theList = new IncrList<ListElem>(10)
    elem = theList[5]
    elem.Val = 10
    theList.Increment(5)
    theList.IncrementAll()
    Console.WriteLine(theList[5].Val)
end

Free code!
CodeExchange’s ISAMUtils provides a handy GUI wrapper to several ISAM utilities

Before Synergy/DE 9.5.1 was released, the Synergy/DE Developer Support department wanted to gain some solid experience with the new technologies — so they wrote a new Synergy .NET application as a learning exercise.

The result is ISAMUtils, a handy GUI wrapper to several of the ISAM utilities. ISAMUtils enables you to run isutl, ipar, and fconvert, with all of their options, in a familiar Windows interface, as shown below.

ISAMUtils

Depending on what options you select, isutl verifies, recovers, or optimizes ISAM files (Revision 4 and higher) or patches an existing ISAM file to a higher or lower revision. Ipar generates parameter file descriptions of existing ISAM files, which can then serve as input to bldism to rebuild the same files. Fconvert transfers, modifies, and converts Synergy database files to other file types.

In addition to the convenience of running these frequently used tools from a GUI, ISAMUtils also provides a complete example of an application written in Synergy .NET, so you can use it as a code sample, too. The ISAMUtils routines demonstrate the use of namespaces and generic types, extending a parent class, implementing an interface, and more.

Note: You must have Synergy/DE and Synergy Language Integration for Visual Studio 9.5.1a or higher to run ISAMUtils.

You can find ISAMUtils, along with many other useful programs, in the Synergy CodeExchange.



Synergy/DE Tech Tip
xfServerPlus environment variable confusion on UNIX

Question:

I am trying to set up xfServerPlus to use either a generic or port-specific synrc file, but the environment variables I have set are being ignored. I have checked the xfpl.ini file and the variables are not being set there. Where are they being set?

Answer:

UNIX employs a hierarchy of synrc files, which can cause confusion when you are setting up your environment. These are the three synrc files:

/etc/synrc

generic synrc

/etc/synrc.####

port specific synrc

/usr/username/.synrc

user specific synrc





 

 

 

Environment variables that are set in the environment will be overridden by the generic synrc. Variables set in the port-specific synrc will override those set in the generic synrc, and variables set in the user-specific synrc file will override all of the others. So, if you’ve set an environment variable in the port-specific synrc file and it is not being used, check the .synrc for the user to see if it is also set there.



Quiz
Synergy/DE pros, see if you can answer this question!

In the following UI Toolkit example on Windows, what color is the window?

                    main 
                    .include "DBLDIR:windows.def"
                    .include "WND:tools.def"
                    record
                          wndid ,int
                    proc
                          u_start
                          u_wincolor(D_SETCOLOR,  3, ^x(00FF00))
                          u_wincolor(D_SETCOLOR,  4, ^x(0000FF))
                          u_wincolor(D_SETCOLOR,  5, ^x(FF0000))
                          u_rend(D_LOAD,  D_PALETTE, 3, 4, 5)
                          u_rend(D_LOAD,  D_PALETTE, 4, 5, 3)
                          u_rend(D_LOAD,  D_PALETTE, 5, 3, 4)
                          w_proc(WP_CREATE,  wndid, "", 10, 40)
                          w_area(wndid,  WA_COLOR, 4)
                          ...
                    end

a. red
b. green
c. blue
d. It depends on the [COLORS] section of synergy.ini/synuser.ini