|
Get better at what you do, make your applications more powerful
Register today for the 2012 Synergy DevPartner Conference
The annual Synergy DevPartner Conference (formerly “SPC”) provides a plethora of relevant information and effective training to make you more productive and your applications more powerful. Attending the conference each year enables you to keep your skills sharp, keeps you up-to-date on current and emerging technologies, and gives you new ideas to improve your applications.
Join us May 22-24 in Chicago, Illinois, or June 12-14 in York, England, for three action-packed days of informative sessions and extensive workshops. After the conference, you’ll be ready to immediately apply your new skills to extend your applications. And you’ll know where Synergy/DE and the industry are headed, so you can keep your applications on a solid course forward.
Register before April 20 to get special early bird pricing. For more information about the conference and to register, visit http://conference.synergex.com.
Now That's a Good Cup of Joe
Synergy/DE 9.5.3 Includes Hot Java Features for xfNetLink Deployments
By Mark Cooper, Senior Systems Software Engineer, Synergy/DE
In version 9.5.3, we introduced a number of new features for xfNetLink Java. One of these is support for enumeration data types, which can be passed as parameters, method return values, and as fields within a structure parameter. With the enumeration feature, you can now share your Synergy enumerations defined in the repository with the Java client. When you create an enumeration type in your repository and define it in the Synergy Method Catalog (SMC), a class named with the enumeration name will be generated for use by the Java client. In the repository, you can use default values or assign values to each enumeration member. These same values will be used by the Java client in the generated classes.
For example, say you create an enumeration named DayOfWeek in the repository, with a member for each day, from Sunday with a value of 1 through Saturday with a value of 7. When you generate classes, you’ll get a Java enum class named DayOfWeek consisting of the enumerators DayOfWeek.Sunday, DayOfWeek.Monday, DayOfWeek.Tuesday, and so on. In order to pass these values between your Synergy and Java code, you just need to declare method return types or parameters as enumeration types in the Method Definition Utility. Once you choose the enumeration data type, you will be able to select the enumeration from a list of enumerations declared in your repository. (If you are attributing your code, the enumerations must be included from your repository.)
When using parameters defined as “out” or “in/out” in the SMC, you need to use holder types in your client code, as Java does not directly support output parameters. For enumerated types, though, Java does not support a holder class. As a workaround, we have provided methods that will enable you to pass an enumeration value as an output parameter. The following Java code snippet demonstrates this.
// xfTest is the generated Java class wrapper
xfTest xft = new xfTest();
xft.setxfHost(“MyHost”);
xft.setxfPort(2356);
xft.connect();
DayOfWeek aday1 = DayOfWeek.Tuesday;
IntHolder outParm1 = aday1.getIntHolderValue();
// Call the output parameter method
DayOfWeek rtnDay1 = xft.OutputDayMethod(outParm1);
DayOfWeek aday2 = DayOfWeek.setEnumeration(outParm1);
// input parameters can just be passed
DayOfWeek rtnDay2 = xft.InputDayMethod(aday2);
Another new feature in xfNetLink Java 9.5.3 is type coercion, which enables you to change the Java data type that genjava creates in the generated classes. With version 9.5.1a, we changed some of the default sizes for Java type mappings to improve the conversion of data between Synergy and Java. With 9.5.3, you can specify your own type mappings for integer, decimal, and implied-decimal data types when defining parameters and return values in the MDU or when you attribute your code. This gives you more flexibility when creating your Java classes, by allowing you to choose the Java type that will best fit your needs. Below is a table that shows the Synergy to Java coercions available. Coerced types can also be used in the repository with structure fields. For complete information on type mapping and coercion in xfNetLink Java, see Appendix B in the 9.5.3 Developing Distributed Synergy Applications manual.
Synergy Type |
Java Coerced Types Available |
Integer |
Byte
Short
Integer
Long
Boolean
|
Decimal |
Byte
Short
Integer
Long
Boolean
DateTime (coerced to Calendar)
Decimal (coerced to BigDecimal)
|
Implied-Decimal
|
Decimal (coerced to BigDecimal)
Double
Float
|
Version 9.5.3 also adds support for some new data types in repository structures passed as parameters. Both Boolean and binary fields are now supported. When you add these types of fields to your repository structures, they will generate the equivalent Java types in the generated Java structure classes. The Boolean field will create a true Boolean Java type class member that can hold a true or false value. The binary field will create a Java class member that is a byte array. In addition, we added support for user-defined date and time fields in repository structures. A User field with a class of Date and ^CLASS^=YYYYMMDDHHMISS or ^CLASS^=YYYYMMDDHHMISSUUUUUU in the User data field will be converted to a Calendar class in Java. Note that these two datetime formats, along with six other formats, are also available when coercing parameters and return values of decimal data type to the Calendar class.
One last addition to version 9.5.3 is the use of generics when passing parameters of ArrayLists. When you declare a parameter that uses an ArrayList, a generic ArrayList of that type will be created in the generated class. For example, if you pass an ArrayList of integers, you will get an ArrayList<Integer>, and an ArrayList of Customer structure classes will create an ArrayList<Customer> type. This will ensure that the ArrayList can only contain the correct types for that ArrayList instance.
These 9.5.3 xfNetLink Java enhancements, in conjunction with those introduced in 9.5.1a, give you many new capabilities when accessing Java applications from Synergy.
See the 9.5.3 release notes (REL_XFNJ.TXT) for a complete list of new Java features.
For more information about Synergy/DE 9.5.3, click here.
Free Code for Synergy Developers
Did you know you can use Google Maps APIs in Synergy applications?
The GoogleGeocoding CodeExchange submission shows how you can use two Google Maps APIs to enable users to search for a location and view a map or satellite image of the location. It uses the Google Geocoding API to search, and it uses the Google Static Maps API to display one of the following views of the returned location: roadmap, satellite image, terrain (topographic), or hybrid (combined roadmap and satellite image). If a search returns more than one result, you can use arrow buttons to move to the different locations. To build and run the GoogleGeocoding application, you'll need Synergy/DE 9.5.3 and Visual Studio 2010.
For more information and the code, see CodeExchange, which is available in the Synergy/DE Resource Center to supported Synergy/DE customers. Be sure to take advantage of this great resource, and don't forget to submit your own CodeExchange entries so that other Synergy developers can benefit from your cool code.
Unexpected xfServerPlus connection error
Question:
The error "unexpected error 176 from acknowledgement. Initialize location=xfnlnet errNo=176" is occurring on an xfServerPlus connection. What could be causing this?
Answer:
This error means that a named pipe cannot be opened on the server from the client. When a license client cannot access a License Manager server, it is most likely one of these problems:
1) The client is not configured to point to the correct server.
2) License Manager is not running.
3) There is a connectivity issue between the client and the server. Troubleshoot this by mapping a drive to the server from the client that is returning the error. You should be able to map a drive without error and without a login dialog displaying. If you do see a login dialog, there is an issue or problem with the connectivity of these two machines on the network.
|
What is the output of the following program?
import System.Collections
main
record
players ,@ArrayList
lover ,string
beloved ,string
spin ,int
literal
max ,int, 4
valentines ,[max]a12, "Customers", "Synergy/DE", "Applications", & "Synergex"
February ,int, 2
.define is_plural(a) (a(trim(a):1) == 's')
proc
open(1,o,"TT:")
players = new ArrayList()
for spin from 1 thru max
begin
lover = valentines[spin]
if (is_plural(lover)) then
players.insert(0, (string)atrim(lover))
else
players.add((string)atrim(lover))
end
spin = February & 14 & 2012
lover = (string)players[spin]
if (spin < 2) then
beloved = (string)players[spin + 2]
else
beloved = (string)players[spin - 2]
if (is_plural(lover)) then
writes(1, lover + " love " + beloved)
else
writes(1, lover + " loves " + beloved)
end
a. "Customers love Synergex"
b. "Synergex loves Customers"
c. "Synergy/DE loves Applications"
d. "Applications love Synergy/DE"
e. "Customers love Synergy/DE"
Click to find the answer
Synergex Holiday Reminder
We will be closed Monday, February 20, in honor of Presidents’ Day
If you anticipate needing our assistance on this day, please let us know.
|
|
|