Open Menu

Synergex Blog


Performance troubleshooting

By Phil Bratt, Posted on May 14, 2018 at 10:22 am

In the 1984 movie classic Ghostbusters, we are introduced to Bill Murray’s character Dr. Peter Venkman, a professor of paranormal studies, testing subjects for the gift of clairvoyance—the ability to gain information about an object, person, location, or event through extrasensory perception. While it is clear Dr. Venkman does not take such things very seriously, we can see the advantage of such an ability, particularly for developers.

Stop me if you’ve heard this before: “We upgraded X and now Y is happening.” In this case, Y is usually associated with a negative behavior like slow performance, a slew of errors, or a bad user experience. Events like these may induce weariness, nausea, dry mouth, and other various side effects that are usually listed in American pharmaceutical commercials. In summary, they’re unpleasant. If only there were some means to predict these events and avoid them in the future…

Unfortunately, most developers are not gifted with the power of clairvoyance to anticipate problems with upgrades before they happen. But maybe instead of a crystal ball, there are tools that can help us avoid upgrade failure. Let’s look at some things that can help anticipate and/or prevent such issues from happening.

A relatively recent addition to the Synergy documentation is the Configuring for performance and resiliency topic in the Installation and Configuration Guide. This topic discusses things that one should take into consideration when running Synergy on any system, and it’s based on years of experience from the Synergex Development staff and the results of their testing. If you haven’t read this section yet, I highly recommend doing so. If you’ve already read it, I recommend a quick refresher the next time you’re looking at major system or software changes.

In Support, we often see issues when developers virtualize systems that run Synergy or when data is migrated and then accessed across a network rather than being stored locally. Both scenarios are discussed in this topic. And as part of Synergy’s web-based documentation set, it’s updated regularly with the latest information. Make sure you take a look before any major upgrade in case there are changes.

Other useful tools for avoiding problems are the Synergex Blog, the Synergy migration guides, KnowledgeBase articles like Guideline for debugging performance issues, and the release notes that come with each version of Synergy. Remember that even if you are just changing the operating system and/or hardware and not your version of Synergy, you should re-review these materials. Some of the considerations they outline may now be relevant, even if they didn’t affect you previously. Also, when testing, remember to take load testing or a process running over time into account. We commonly see pitfalls  when developers neglect these two factors in testing.

Taking Action

Now let’s say that despite your excellent planning, you do see a performance issue. What can you do? Here are some steps I’ve found helpful that might get overlooked. Most have to do with simply eliminating factors that affect performance.

  • Establish a baseline

If you’re going to diagnose a problem in performance, the first thing to do is isolate code or create a piece of code that demonstrates the problem. Make this your baseline test for all of the various configurations you’re going to test. This will make your tests consistent as well as eliminate code changes as a factor.

  • Use a metric

Establish a program you’re going to use to measure the difference in performance. If you’re using a traditional Synergy program as your baseline, you can use the Synergy DBL Profiler, which will count CPU time for you. Just make sure you pick the same metric for your testing—CPU time is not the same as real time. This step will enable you to get measurable results to test what is actually making a difference.

  • One by one, test all the things

I’ve found that the easiest way to plan and visualize testing is to make a tree. Each layer is one aspect you’re testing that continues to branch with every different aspect. For example, I had a situation where a production machine migrated Synergy version, operating system, and hardware and virtualized the OS, all in one move. We picked one thing to change (the virtualization of the OS) and tested it.

Virtualized Non-Virtualized

 

By doing this, we established that virtualization was a factor, because a virtualized environment was slower than a non-virtualized one. We then compared those to the old and new Windows versions, but continued with virtualized and non-virtualized environments using the same virtualization software.

Windows 8 Windows 10
Virtualized Non-Virtualized Virtualized Non-Virtualized
In previous table In previous table

 

On average, this produced the same result. (It was I/O processing, so we did an average of 10-20 runs based on how volatile the results could be.) Next, we compared the Synergy 10 runtime with the Synergy 9 one.

Windows 8 Windows 10
Virtualized Non-Virtualized Virtualized Non-Virtualized
Syn 9 Syn 10 Syn9 Syn 10 Syn 9 Syn10 Syn 9 Syn 10
In previous In previous In previous In previous

 

The tree continued growing until all of the factors were considered and tested.

Closing Thoughts

It can be tedious to test one change at a time, but without that kind of granularity, you can’t establish which change affected performance and by how much. In the example I mentioned above, we established that virtualizing the hardware was causing a problem because of the way the virtual machine software emulated separate cores. We never would have come to such a conclusion without carefully eliminating the many different changes one at a time.

After you’re able to establish exactly which changes caused the performance issue(s) and by how much, you can work on a fix or provide a solid case to whichever software support representative you need to contact to get a fix.

You might know most of this already. You might even know of some methods, tips, etc., for performance issues that I didn’t discuss. Maybe you are clairvoyant and you already knew the contents of this post before I did. Either way, I hope you find this information helpful when you look at performance in the future, in both preventative measures and problem diagnosis.


Big Code

By Richard Morris, Posted on April 13, 2018 at 7:13 am

If you have large (and I mean LARGE) blocks of code in single source files – and by large I mean 20k lines plus – then you may be having compiler issue with “SEGBIG” errors: “Segment too big”. This issue arises because your code segment is just too big for the compiler to handle and is usually the result of many man years of development to a single routine that has just grown over time.

If you encounter SEGBIG issues, as a customer I have recently worked with did, then this quick blog will give you some practical ideas of how to manage the issue and modify the code to allow for future development and expansion, without having to rewrite the world.

First off, it’s not the physical number of lines of code in the source file that’s the issue, it’s the lines of code and data definitions within each routine block: subroutine or function. Developers have encountered the problem for many years and the resolution has previously been to chop out a section of code, make it into a subroutine or function, and somehow pass all the appropriate data to it – usually by large numbers of arguments or common/global data blocks.

The “today” way is not too dissimilar but is a little more refined: turn the code block into a class. The first major advantage is class-based data. This removes the need to create subroutines or functions that accept large numbers of arguments, or to create large common or global data blocks. As an example:

subroutine BigRoutine

endparams

.include ‘AppCommonData.inc’

record localData

localRoutineData      ,a10

endrecord

proc

call doSomeLogic

call doOtherLogic

xreturn

doSomeLogic,

return

doOtherLogic,

return

end

Obviously this code will not give us a SEGBIG issue, but its an example of the structure of the code. The routine has a common data include and private data. In the routine body we make multiple local label calls. When there is too much data and too many lines of code added we will encounter a SEGBIG error.

So to address this, in the same source file, we can create a class with class-level data (the routine level data) and methods for the local call labels. So, for example:

namespace CompanyName

public class BigRoutineClass

private record localData

localRoutineData      ,a10

endrecord

public method Execute, void

endparams

proc

doSomeLogic()

doOtherLogic()

mreturn

endmethod

method doSomeLogic, void

.include ‘AppCommonData.inc’

proc

mreturn

endmethod

method doOtherLogic, void

.include ‘AppCommonData.inc’

proc

mreturn

endmethod

endclass

endnamespace

In this code, the Execute method becomes the entry point. All the existing code that made the label calls is moved into this routine and the calls changed to method invocations;

doSomeLogic()

doOtherLogic()

Then we can change the existing BigRoutine code;

subroutine BigRoutine

endparams

record

routineInstance       ,@CompanyName.BigRoutineClass

endrecord

proc

routineInstance = new BigRoutineClass()

routineInstance.Execute()

xreturn

end

Simple!

Although the code changes I’ve described here sound monumental, if you use Visual Studio to develop your Traditional Synergy code the process is actually quite simple. Once you have created the scaffolding routine and defined the base class with class level data (which really is a case of cutting and pasting the data definition code), there are a few simple regex commands we can use that will basically do the work for us.

To change all the call references to class method invocations you can use:

Find: ([\t ]+)(call )([\w\d]+)

Replace: $1$3()

 

To change the actual labels into class methods, simply use the following regex:

Find: ^([\t ]+)([a-zA-z0-9_]+)[,]

Replace: $1endmethod\n$1method $2, void\n$1proc

 

And to change the return statements to method returns, use:

Find: \breturn

Replace: mreturn

 

These simple steps will allow you to take your large code routines and make manageable classes from them which can be extended as required.

If you have any questions or would like assistance in addressing your SEGBIG issues, please let me know.


Synergy/DE Documentation Reimagined

By Matt Linder, Posted on April 9, 2018 at 11:01 am

If you’re a Porsche enthusiast, you probably know about the Nürburgring record set a few months back by a 911 GT2 RS, the latest iteration of the Porsche 911 (see the Wikipedia article). Like many, I find it interesting that the best* production sports car in the world isn’t a new design, but the result of continuous improvement and development since its introduction over 50 years ago. One company, Singer Vehicle Design, takes old 911s and resurrects them as carbon fiber kinetic sculptures in the aesthetic of the older 911s, but with performance that matches some of the fastest new 911s from the factory. They describe these as “Reimagined,” and you can see a video about a Singer 911 or visit the Singer website for more information.

Here in the Documentation department at Synergex, we’ve been doing some reimagining of our own. The Synergy/DE documentation has been continually improved over the years, but since 10.3.3c, we’ve published the Synergy/DE documentation with a new format, a new look, and a new set of underlying technologies and practices. The goal: documentation that is quickly updated to reflect product changes and user input, that is increasingly optimized for online viewing, and that is increasingly integrated with other Synergy/DE content. (And soon it will be better integrated with Visual Studio as well; see a recent Ideas post for details.) You can access the doc just about anywhere (even without internet access), it offers better viewing on a range of screen sizes, and it’s poised for further improvements. If you haven’t seen our new “reimagined” doc, check it out at docs.synergyde.com.

Here are some of the highlights:

  • A better, more responsive UI for an improved experience when viewing documentation from a desktop system, a laptop, or a tablet.
  • Technologies that facilitate more frequent updates and allow us to increasingly optimize content for online use.
  • Improved navigation features. The Contents tab and search field adapt to small screens, the UI includes buttons that enable you to browse through topics, and a Synergy Errors tab makes it easy to locate error documentation.
  • Quick access to URLs for subheadings. To get the URL for a topic or subheading (so you can share it or save it for later), just right-click the chain-link icon next to a heading and copy the link address.
  • The ability to print the current topic (without printing the Contents tab, search field, etc.) and to remove highlighting that’s added to topics when you use the search feature.
  • Local (offline) access. If you’re going somewhere where internet access is limited, download and install the Local Synergy/DE Product Documentation, which is available on the Windows downloads page for 10.3.3.

See the Quick Tips YouTube video for a brief visual tour of the documentation, and let us know what you think. In the footer for every documentation topic, there is a “Comment on this page” link you can use to send us your input. We look forward to hearing from you!

*Just an opinion!


A Winning Formula

By Richard Morris, Posted on February 15, 2018 at 3:28 am

For a recent project I’ve worked with a customer who wished to provide their users with an engaging desktop application that would allow management of product formulations.  They had a Synergy UI Toolkit version and also elements of the required application in a third-party system, but neither met the needs of the users.  After a review and discussions about their requirements we agreed on a Synergy .NET Windows Presentation Foundation based application using Infragistics tooling for the User Experience.

The basic requirements of the application where to allow the creation and maintenance of formulations.  A formulation contains the components required to make a finished product.  For this customer the final product is an aerosol. 

The basic interface is built using the Infragistics control to handle navigation (Ribbon menu control), listing and selection of data (powerful DataGrid), hierarchical representation of the formulation components (TreeView) and management of finished product details (Property Grid);

Of course, using the Infragistics DockManager allows the user to drag and reposition all the available windows to their liking.

There are powerful searching facilities, or QBE (Query By Example) controls.  These allow the user to provide snippets of information and the application will query the Synergy DBMS database using Symphony Harmony and the Synergex.SynergyDE.Select class;

The top line of the QBE controls allow the user to enter the data in the columns they wish to search for and so only select the data they require and not have to filter through a list of thousands of formulations.

Because the application is written in Synergy, the existing printing capabilities from the original UI Toolkit application have been retained without change;

The whole application is written in Synergy .NET and utilises the Symphony Framework for controlling the data access and presentation.  If you would like more details, or would like to know how you can build modern applications with Synergy .NET please drop me an email.


What a Cracking Idea

By Richard Morris, Posted on February 9, 2018 at 5:52 am

The Synergex Resource Center Community site has a number of great features including the Answers and Ideas portals.  Ideas is the place to post your ideas for improving Synergy and related products.  You can vote for ideas and provide comment and feedback to help the whole community be more successful. There was a recent idea posted on the Synergex community site

You can read the full idea at the Synergex Resource Center.

Synergy DBMS Manager

The Synergy DBMS Manager allows you to query and manage data in your Synergy data files using Symphony Data Objects.

Code generating Symphony Data Objects for your files is a simple process.  Ensure you have your Synergy Repository configured. You need to define the structure and associated file definition for each file you wish to be able to manage using the utility.  There are full instructions at the Symphony Framework page which walk you through the few simple steps to building your data object assembly in Synergy .Net.  Not sure how to build Synergy .Net assemblies – then send me your repository and I’ll do it for you!

To query data you simply issue the required select command and define the response data object;

Simple, and you can scroll through the results.  The idea posted was to be able to then export the selected data to Microsoft Excel so that further review and analysis can be performed.

A new toolbar button has been added and the GemBox Spread assembly used to easily create the Excel document.  Now you can export all the selected rows to an Excel document:

If you’d like more details, please visit the Symphony Framework page or contact me directly.

 

 

 


Protecting Data

By Richard Morris, Posted on February 7, 2018 at 5:06 am

Whenever I work with customers code there is almost always a need to “run” their applications.  That means I need data.  To ensure that Synergex protects our customers data and that we conform to the various data security requirements of todays world there is usually a need to cleanse the data before I get access to it.  This cleansing process is like redacting words or phrases in a document – to prevent the consumer (in this case me) from seeing the real data.

With Synergy today there are basically two ways to do this;  write a program to clear or set the data fields within the records in the file to a specific value or configure Synergy xfODBC and use a database management tool.  If you don’t want to write code, or license and configure xfODBC you can use the Synergy DBMS Manager.

The Synergy DBMS Manager is a simple utility that can be used to redact data in your Synergy DBMS files.  Your can download and install the Synergy DBMS Manager utility by visiting the downloads page.  The utility uses Symphony Data Objects to describe the data in your files – these are easy to code generate.

Code generating Symphony Data Objects for your files is a simple process.  Ensure you have your Synergy Repository configured. You need to define the structure and associated file definition for each file you wish to be able to manage using the utility.  There are full instructions which walk you through the few simple steps to building your data object assembly in Synergy .Net.  Not sure how to build Synergy .Net assemblies – then send me your repository and I’ll do it for you!

Synergy DBMS Manager

Once you have the data object library built, you simple run the utility:

You’ll need to locate the “Data object assembly” that you have just built, and following that select the “Table mapping method”.  Enter the password and you’ll be in the utility and ready to manage your Synergy DBMS data.

You can perform simple queries to locate and review the data in a file;

Now you can easily redact the data in the file – remember you are affecting the ACTUAL data in the file, so make sure this is a copy of the data file and NOT your LIVE data, there is no rollback functionality!

Simply issue an update command;

Notice the result count () at the bottom of the screen.  Because we didn’t specify a where clause then all records in the file were affected by the requested update.  Now you can perform a simple query and see the results;

This data is now cleaned.  If you need to send data to Synergex Support to assist then to resolve an issue you have, this is a great way to redact and protect that data before sending it.

If you’d like more details, please visit the Symphony Framework page or contact me directly.


CodeGen 5.2.3 Released

By Steve Ives, Posted on December 1, 2017 at 11:18 pm

We are pleased to announce the release of a new version of CodeGen. The new release includes new features, addresses some issues found with previous releases, and also paves the way for once again being able to use CodeGen on non-Windows platforms through experimental support for the .NET Core environment.

As always, you can download the latest version of CodeGen from here.

CodeGen Release Notes

  • We added a new experimental utility to the distribution. The Code Converter utility can be used to automate bulk searches within and bulk edits to an applications code. This utility is in a usable form but is still a work in progress and is likely to undergo substantial changes as it evolves.
  • We added two new utility routines (IsDate.dbl and IsTime.dbl) that are referenced by some of the supplied sample template files.
  • We corrected a regression that was introduced in the previous release which caused the field loop expansion token <FIELD_SQL_ALTNAME> not to default to using the actual field name if no alternate name was present.
  • We performed an extensive code review and cleanup, updating the code in several areas to take advantage of new features available in the Synergy compiler, and also improving efficiency.
  • We fixed an issue that was causing the CreateFile utility -r (replace file) option to fail, an existing file would not be replaced even if the -r option was specified.
  • We fixed an issue in the CreateFile utility that would result in an unhanded exception in the event that invalid key information was passed to XCALL ISAMC.
  • We made some minor code changes to allow CodeGen to be built in a .NET Core environment and we hope to be able to leverage .NET Core to once again support the use of CodeGen on non-Windows systems (starting with Linux) in the near future.
  • This version of CodeGen was built with Synergy/DE 10.3.3d and requires a minimum Synergy version of 10.1.1 to operate.

Symphony Framework Components

  • We no longer ship the Symphony Framework sample templates with CodeGen. You can obtain the latest Symphony Framework templates from the Symphony Framework web site (http://www.symphonyframework.net).
  • There were no Symphony Orchestrator changes in this release.
  • There were no Symphony Framework CodeGen Extensions changes in this release.

CodeGen 5.2.2 Released

By Steve Ives, Posted on October 25, 2017 at 3:00 pm

We are delighted to announce the availability of a new CodeGen release that includes the following enhancements and changes:

  • We added a new field loop expansion token <FIELD_FORMATSTRING> which can be used to access a fields format string value.
  • We added a new command-line option -utpp which instructs CodeGen to treat user-defined tokens as pre-processor tokens. This means that user-defined tokens are expanded much earlier during the initial tokenization phase, which in turn means that other expansion tokens may be embedded within the values of user-defined tokens.
  • We removed the RpsBrowser utility from the distribution; it was an experimental project that was never completed.

This version of CodeGen was built with Synergy/DE 10.3.3d and requires a minimum Synergy version of 10.1.1 in order to operate.


“D” is for Developer

By Richard Morris, Posted on September 20, 2017 at 6:55 am

Development of your traditional Synergy code in Microsoft’s Visual Studio was introduced at the DevPartner conference back in 2016. Using an integrated development environment (IDE) like Visual Studio not only promotes better code development practices and team development but shows prospective new hires that your tooling is the latest and greatest.

The next release of Synergy—10.3.3d—includes all the capabilities now required to fully develop and build your traditional Synergy–based applications in Visual Studio. During a recent engagement I worked with a team of developers to migrate their existing Synergy Workbench development to Visual Studio with great results. Although there are a few steps to complete, the results of developing in Visual Studio more than outweigh the effort taken to get there. And if you think developing in Synergy Workbench is great and productive, just wait until you are using Visual Studio—there will be no turning back! Here are the high-level steps you can take to get your traditional Synergy development to Visual Studio.

First place to start is the Synergy Repository. We all have (or should have) one. Synergy now provides a Repository project that will allow you to build your repository files from one or multiple schema files. If you have multiple schema files you can use the new pre-build capability to run your existing command scripts to create the single, ordered schema file or load the repository your way—simple. So why have the Repository project? Because you can load all your individual schema files into it, and if any change, your repository will be rebuilt automatically.

Next create your library projects. These are either executable (recommended) or object libraries. Ensure you reference the Repository project using “Add Reference…”. You no longer define the Repository environment variables “RPSMFIL” and “RPSTFIL”. This step ensures that if your Repository project is rebuilt, any projects referencing it will be as well. Next add the source files for the routines that make up your library, and build. You may have a few build issues to resolve—the 10.3.3d compiler is a little stricter, and unresolved references will need to be resolved. Any environment variables required to build your software should be set in the project common properties page or if they are library specific in the project environment page.

Finally, your main line programs. Create the required project with single or multiple main line programs. The multiple main line project allows you to have all the programs in one place, and you can easily specify the program to run.

Now you can build and run your traditional Synergy code from Visual studio—and even better, you can debug through the code using the powerful Visual Studio debugger.

Using UI Toolkit? Keep a look out for a future blog post showing how to easily incorporate window script file builds into your development process.

Building for UNIX? Not a problem. A future post will show the simple steps to target the UNIX platform from within Visual Studio.

We are here to help! Synergex can help with every aspect of getting your traditional Synergy development environment inside Visual Studio. Just ask your account manager or contact me directly.


CodeGen 5.2.1 Released

By Steve Ives, Posted on August 24, 2017 at 2:10 pm

We are pleased to announce the release of CodeGen 5.2.1 which includes several new features that significantly extend the possibilities for what can be generated. The core goal for this release was to introduce new features that make it possible to sub-divide the processing of large loops into smaller units of code, and by doing so make it possible to achieve new things, especially when working with very large structures.

For example, the reference code that demonstrates how to implement the replication of ISAM data to a relational database (https://github.com/SteveIves/SqlReplicationIoHooks) previously had a restriction that it could only deal with files (tables) with up to 252 fields (columns). The underlying reason for this related to the maximum number of arguments that can be passed to an external routine, %SSC_BIND in this case. The restriction of 252 available data parameters to %SSC_BIND meant that bad code would be produced for any structure with more than that number of fields. Now however, using some of the new features in CodeGen 5.2.1, the template has been re-structured so that %SSC_BIND will be called multiple times if necessary, removing the previous restriction.

But that’s just one example, there are doubtless many more. Here are the release notes for the new version:

  • We added several a new generic expression token <IF COUNTER_n_op_value> that allows you to write conditional template code based on testing the current value of the two internal template counters against a simple numeric expression. Here is an example of using this new expression:
<IF CODEGEN_COUNTER_1_EQ_10>
Code to include for every 10th item
</IF>
<IF TOTAL_ITEMS_LT_50>
Code for a small number of items.
<ELSE>
Code for a larger number of items.
</IF>
<REQUIRES_CODEGEN_VERSION>5.2.1</REQUIRES_CODEGEN_VERSION>
  • We made a minor correction to the documentation of the -f l command line option. The documentation previously stated that this option caused fields marked as “Excluded by Language” to be EXCLUDED from field loop processing, but actually such fields are excluded by default. The -f l command line option actually suppresses this behavior, causing such fields to be INCLUDED in field loop processing.
  • This version of CodeGen was built with Synergy/DE 10.3.3c and requires a minimum Synergy run-time version of 10.1.1.

The latest version of CodeGen can always be downloaded here.


Developing in Visual Studio

By Steve Ives, Posted on June 30, 2017 at 7:56 pm

Most Synergy developers would love to use the very latest and greatest development tools to develop and maintain their Synergy applications, but how do you get started? At the recent DevPartner conference in Atlanta product manager Marty Lewis not only discussed the concepts of how to get started, but actually demonstrated the entire process with a real Synergy application. Check out his presentation entitled Developing Synergy Code in Visual Studio:

By the way, this video is just one of many from the 2017 DevPartner Conference.


How “easy” can easy be – Google it!

By Richard Morris, Posted on May 24, 2017 at 4:45 am

The post conference workshop developed from the ground up a vinyl record collection catalogue system that allowed the management of your favourite records. The workshop stepped through the various aspects of the system including a desktop WPF maintenance program and remote management of your cloud based catalogue using the Synergy DBMS manager.

Having all your vinyl discs catalogued is great – but when I’m in the record shop browsing through all the latest available titles I often wonder – have I got this one? I’ve got a lot of vinyl’s and many more CD’s so remembering all the one’s I have can be difficult, and there is nothing worse than buying a duplicate.

So our OnVinyl app we built at the conference allows us to scan the barcode of the album in the store and check it against our catalogue – if we have it then the details are displayed and we don’t go and buy it again.

Getting all the album information into our catalogue would have been a long and rather boring job – especially having to trawl the web looking for the artwork to associate with each album we have. We need an easier solution – and so to Google we turn.

We all know how good Google is at searching for basically anything you can think of really, but did you know you can use this powerful searching capability from within your Synergy programs? Google provide a search API that allows you to simply and very easily perform any search you require. This is the facility we added into our OnVinyl Album Maintenance program – enter (or scan if you have a barcode scanner to hand) the barcode on the album and pass this through to the Google search API. Our implementation retrieved the album name, artist, cost and artwork so we are able to populate all the fields in the maintenance form – without any typing!

The Google search API provides a REST API that you can call directly from within your Synergy program. For full details visit https://developers.google.com/custom-search/json-api/v1/using_rest. To use the API you need a Google account. The first step is to create an “API key” which allows you access to various Google API’s and identifies you to those API’s. Visit the Google API Manager console to create an API Key. Once you have an API key then you can set up a custom “search engine” that allow you to customize how your searching is performed. You can limit the results to certain web sites for example. This is all configured using the Google control panel (https://cse.google.com/all). To begin you create a new “search engine” and name it. Once created it will be assigned a unique search engine ID – you’ll need this!

In your Synergy code define some constants;

The API is a REST implementation that has a defined URI;

And then make the required REST call to retrieve the search results;

And that’s the call to your custom search engine complete. The response from Google will be in the form of a JSON string which you need to parse and out and extract the individual elements you require. The code for that is available in the OnVinyl project.

And the results in your application;

Easy really is easy with Synergy and Google searching!

On a side note – I’ve been wondering where Jodah had got to, and then this appeared in my inbox;

I’m sure I recognise those eyes…. Have you seen or got a picture of Jodah’s identifying name tag?

 

 

 


Code Gremlins?

By Richard Morris, Posted on May 17, 2017 at 8:27 am

This year’s DevPartner conference was held in Atlanta, Georgia and was a blast. I guess I say “the best ever”” each year, so I won’t this time – but it was. The whole conference ran flawlessly, although throughout the week I did see a few strange things in the corner of my eye – but you know how it is. You think you are seeing things… But maybe not.

We had lots of new faces in the audience seeing what Synergy has to offer which is always great, and they got to see a few new faces presenting at the DevPartner conference for the first time.

Although Phil could be considered a veteran now – his third conference – he was joined on stage by first-timer Tate, a fellow support engineer. They presented a cool session on BOTS – not those things you sit on, the automated robots that answer whatever questions you have. There are loads of bots around and the duo showed us what it’s all about and how to build you own!

Another new face was Jacklin who presented all the ways to get fully up to speed with Synergy today including all the various media feeds and the cool YouTube channel we have that’s being loaded with great training videos – and of course you can always re-watch all the conference sessions.

At the beginning of March I blogged about “Physio My Way” which is an app to monitor a patients compliance to perform their prescribed upper limb exercises. Ashley presented the full Physio My Way story and received great feedback – if you get the time check out the Synergex YouTube channel in the coming days to see the full video! It’s a complete mobile solution written end to end in Synergy.

And so to my post-conference workshop. The goal was to write, from scratch, a complete application called “On Vinyl”. “On Vinyl” is a vinyl collection management and inquiry system. The system is written entirely in Synergy .Net and uses the Symphony Framework.

We started off by code generating the base data objects – the classes that expose the Synergy Repository structures as classes with full get/set properties for the fields. We also code generated classes to provide complete data management using Symphony Harmony.

Next we built a simple maintenance program to allow us to manage our collection of vinyl albums. To save typing we also implemented the ability to perform a Google search passing in the album barcode and returning/displaying all the album information, including the cover artwork. I’ll blog about just how easy it was to implement Google searching soon.

Next we hosted all the server logic on a remote cloud server behind Symphony Bridge and showed how to manage the data remotely using the Synergy DBMS Manager (available on the download page at www.symphonyframework.net).

Next we moved to the client portion of the project – to build and deploy an app on the Android and iOS platforms to enable us to check if we have a particular vinyl in our collection. We built up the technology stack. First layer was the client data layer – code generated data objects built into a portable class library. Next we created the connection library which used commands to search for vinyl details using the barcode:

If we didn’t have the album in our collection we could call our stored procedure to perform the required Google search:

And if we chose to buy the album we could insert it into our collection directly from the device:

Our final portable library was the common UI code – using Xamarin Forms. This provides the ability to write the UI once and deploy to different target devices such as Android and iOS.

Up to this point, although there were a couple of “what was that…” moment’s things all built and ran just fine.

The final piece of the puzzle was to write the device specific code – and our first target was Android. We created the project, added the required resource (images, etc.) and after a couple of minor typo’s the project built. But something was not quite right and we could not get the program to successful deploy and run.

We’d hit the end of the day so aborted the attempt and regrouped to try to find out what had gone wrong.  Once we have the solution I’ll post the entire project to GitHub and blog about it!

Now I don’t really believe in code gremlins, ghosts or phantoms, but throughout the week there were some strange goings-on, and to be honest I was having flash-backs to conference time 2009! Surely he was not back to try to mess up my workshop again?

And where did Jodah get to……?


CodeGen 5.1.9 Released

By Steve Ives, Posted on May 12, 2017 at 8:45 am

I am pleased to announce that we have just released a new version of CodeGen (5.1.9) that contains some new features that were requested by customers. The changes in this release are as follows:

  • We added two new structure expansion tokens <FILE_ODBC_NAME> and <FILE_RPS_NAME> that expands to the repository ODBC table name or structure name of the first file definition that is assigned to the structure being processed.
  • We made a slight change to the way that the multiple structures command line option (-ms) is processed, allowing it to be used when only one repository structure is specified. This allows for templates that use the <STRUCTURE_LOOP> construct to be used when only one structure is being processed.
  • We also fixed an issue that was causing the <FIELD_SPEC> token to produce incorrect values for auto-sequence and auto-timestamp fields. Previously the value 8 would be inserted, now the correct value i8 is inserted.

This version of CodeGen was built with Synergy/DE 10.3.3c and requires a minimum Synergy runtime version of 10.1.1. You can download the new version directly from the CodeGen Github Repository.


I didn’t know you could do that!

By Richard Morris, Posted on March 23, 2017 at 2:34 pm

Working with the many customers we have is a great opportunity to advance the software we write. Some time ago I blogged about Symphony Bridge – a server based utility that allows you to expose Synergy data and logic through Symphony Harmony using an SQL-like syntax. In essence you can write queries on the client like “select * from part” and the bridge server will return a collection of part objects that are based on a structure you have created in your repository. You can then bind these to grids or input controls on you windows or mobile applications or display them in web pages. In fact you can use the data in any Synergy .Net or non-Synergy application.

Another aspect of Symphony Harmony/Symphony Bridge is the ability to call a remote procedure using the syntax “exec @MyNameSpace.MyClass.MyMethod”. You can pass in arguments and again a data object or a collection of data objects are returned.

During a recent visit with one of our customers who is currently utilizing symphony Harmony and Symphony Bridge to provide third-party access to their systems to allow enquiries on orders, etc. I was asked about “providing the ability to return a standard object that contains the call status AND the response data”. Simple, no problem: Create an RPS structure that defines your response details – call status, error codes, and error message for example. Code generate the required data object and then customize it by exposing a collection of <DataObjectBase> (the base class of all data objects!) As I said – simple.

But the customer was not overly impressed – and they had an idea! Oh dear me thinks – these are seasoned C# developers and I’m not convinced I’ll be able to implement their ideas in Synergy .Net! But how wrong I was…. and without any changes to the Symphony Framework. The basic requirement is to have a “response” class that they can extend with any serializable “type” – be that a single instance or a collection of “type” – without any restrictions.

The starting point was the same – create the required response structure in the repository and code-generate the “response” class. This is the resulting class definition;

public partial class Server_response_Data extends Symphony.Conductor.Model.DataObjectBase

The code generation process creates all the required properties and the logic to serialize the data into JSON or BSON.

The next step was to create a second class with the same name as the response class but this time it will accept a generic – generics are quite cool and allow you to defer the specification of a type until that type is instantiated. So our generic response class definition looks like this;

public class Server_response_Data<T(new)> extends Server_response_Data

By extending the base code-generated class we get all the required Symphony capabilities. The “T” denotes the generic “type”. The (new) ensures that any type you provide must have a parameter-less constructor which ensures that this class can creates an instance of it. We can expose the property so it’s serializable;

{JsonProperty}
public property Result, T
       method get
       endmethod
       method set
       endmethod
endproperty

And in the constructor we can ensure there is an instance (to prevent null object exceptions);

public method Server_response_Data
       endparams
proc
       Result = new T()
endmethod

And that is about it. You can then write your server methods to create an instance of your response class, populate the generic “response.Result” with the required “type” and set the response properties accordingly. For example;

data response = new Server_response_Data<Part_Data>()

Will create a response class with the “Result” as a type of Part_Data data object. If you need to return a collection of Part_Data objects;

data response = new Server_response_Data<List<Part_Data>>()

It’s really as easy as that. On the client you simply make the remote EXEC call through Symphony Harmony;

result = DataExecute.RunDataExecute(connector,
       &      "exec @MyNameSpace.MyClass.MyMethod",
       &      new Server_response_Data<List<Part_Data>>()).Result

You can also await the call on a separate thread.

Big shout-out to Gareth for the idea and his persistence to make me get it working!

I’ll be using these techniques in my DevPartner 2017 post conference workshop as we build a mobile app from start to finish using Symphony Harmony/Symphony Bridge to access remote data and logic.


Page 1 of 1312345...10...Last »
Don't miss a post!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Recent Posts Tag Cloud Archives