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

April 12, 2013

Manage Synergy data, enhance your existing UI, call Web services from traditional Synergy, and more...

Try out the latest technologies for yourself at the Synergy DevPartner Conference in June

Read More


Paradise by the dashboard light

Check out this fully functional interactive dashboard totally written in Synergy .NET

Read More


Synergy/DE Tech Tip

Printing a PDF file in Synergy

Read More


Quiz

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

Take Quiz

 

Asynchronous programming: What you’ve been AWAITing for

Improve the responsiveness of your application without increasing the complexity of your code in Synergy/DE 10.1

Read More


“One of the best European airports” selects Synergy/DE-based ALDIS airport software

Humberside International Airport replaces flight information and airport billing systems with AIS’s software

Read More


Platform News

Read a selection of recent articles

Read More


twitter.com/synergyde

 

Synergy DevPartner Conference
Manage Synergy data, enhance your existing UI, call Web services from traditional Synergy, and more…

Try out the latest technologies for yourself at the Synergy DevPartner Conference in June

Join us in Providence, Rhode Island, or Bristol, UK, this June to hear from the experts how you can use the latest Synergy/DE 10.1 features to add new value to your Synergy solutions and be more productive while doing so. Then, choose from 18 hands-on tutorials to try out the new technologies for yourself!

  • Learn about Synergy DBMS features, such as change tracking and Select classes, that will help you manage your Synergy data.
  • Find out how you can use open source tools Symphony Framework and CodeGen to rapidly advance your Synergy applications.
  • Learn how to interact with popular Web services from your traditional Synergy applications.
  • And more!

Visit the Synergy DevPartner Web site for details and to register.

**Early bird pricing ends May 1!**


Asynchronous programming: What you’ve been AWAITing for

Improve the responsiveness of your application without increasing the complexity of your code in Synergy/DE 10.1

By Jim Sahaj, Sr. System Software Engineer

Sometimes with large applications, we have sections of code that are not as responsive as we’d like them to be, such as code that retrieves information from the web. As a result, an application can appear to hang, and so we resort to adding a graphic, such as progress bar, to indicate that work is actually being done. This is a nice way to prevent the user from aborting, but what if the application could make the web request and continue on with other work, going back to get the results only after the retrieval was complete?

That’s the goal of asynchronous programming. Traditional techniques for doing this type of programming can be painful, in that they require a lot of development work to maintain the state of the request within the application. In Synergy .NET version 10.1, however, we’ve greatly simplified asynchronous programming by adding support for two new keywords: ASYNC and AWAIT.

Adding an ASYNC modifier to a method indicates that it is an asynchronous method, which is a non-blocking operation. Within an asynchronous method, we can then use the AWAIT statement on asynchronous tasks that need to be waited for within the method. These AWAIT statements denote suspension points within the ASYNC method; if the task is not done, the method is exited immediately so other application work can continue. When the awaited task is complete, the application returns to that spot and continues the application logic within the ASYNC method until it either reaches another AWAIT suspension point or the method completes.

Using ASYNC requires .NET Framework 4.5. The return type for the ASYNC method must be Task or Task<T> (which are .NET Framework classes that contain information to indicate when a task is complete) or void. Also, the expression following AWAIT must give a Task-based result.

In the code below, the clickit() method is marked ASYNC and has three awaited tasks that get the titles of unique web pages. This program can be compiled using Synergy .NET 10.1 with the following command line:

dblnet -ref=System.Windows.Forms.dll,System.Drawing.dll  <myprogram.dbl>

import System
import System.Windows.Forms
import System.Net
import System.Text.RegularExpressions

namespace WindowsFormsApplication1

    class Form1 extends Form

        public method Form1
        proc
                InitializeComponent()
        end

        private method InitializeComponent, void
        proc
            this.listBox1 = new System.Windows.Forms.ListBox()
            this.button1 = new System.Windows.Forms.Button()
            this.SuspendLayout()

            this.listBox1.FormattingEnabled = true
            this.listBox1.Location = new System.Drawing.Point(51, 82)
            this.listBox1.Name = "listBox1"
            this.listBox1.Size = new System.Drawing.Size(200, 147)
            this.listBox1.TabIndex = 0

            this.button1.Location = new System.Drawing.Point(100, 26)
            this.button1.Name = "button1"
            this.button1.Size = new System.Drawing.Size(75, 23)
            this.button1.TabIndex = 1
            this.button1.Text = "Get Titles"
            this.button1.UseVisualStyleBackColor = true
            this.button1.Click += new System.EventHandler(this.button1_Click)

            this.Controls.Add(this.button1)
            this.Controls.Add(this.listBox1)
            this.Name = "Form1"
            this.Text = "URI Titles"
            this.ResumeLayout(false)
        end
        private listBox1, @System.Windows.Forms.ListBox
        private button1, @System.Windows.Forms.Button

        private method button1_Click, void
                sender, @*
                e, @EventArgs
        proc
            listBox1.Items.Add("work before")
            clickit()
            listBox1.Items.Add("work after")
        end

        public async method clickit, void
        proc
            data wc1, @WebClient, new WebClient()
            WriteLinePageTitle(await wc1.DownloadStringTaskAsync(new Uri("http://www.weather.gov")))
            WriteLinePageTitle(await wc1.DownloadStringTaskAsync(new Uri("http://www.synergex.com")))
            WriteLinePageTitle(await wc1.DownloadStringTaskAsync(new Uri("http://www.microsoft.com")))
        end

        public method WriteLinePageTitle, void
                page, string
        proc
            listBox1.Items.Add(GetPageTitle(page))
        end

        public method GetPageTitle, string
                page, string
        proc
            data titleRegex, @Regex, new Regex("\<title\>(?<title>.*)\<\/title\>", RegexOptions.IgnoreCase)
            data match = titleRegex.Match(page)
            if (match.Success) then
            begin
                mreturn "Page title: " + match.Groups["title"].Value
            end
            else
            begin
                mreturn "Page has no title"
            end
        end

endclass
endnamespace

main
proc
            Application.EnableVisualStyles()
            Application.SetCompatibleTextRenderingDefault(false)
            Application.Run(new Form1())
end

When running this program, clicking on the “Get Titles” button causes button1_click() to execute. This causes “work before” to be output, followed by a call to clickit(). Because clickit() is designated ASYNC, the routine executes all the way up to the first AWAIT statement. Since the task for that first AWAIT is not complete, clickit() is exited, and execution within button1_click() continues, causing “work after” to be displayed. Once the first AWAIT statement in clickit() is complete, the execution of clickit() displays the first page title. Then execution continues up to the next AWAIT statement. After the second task is complete, the second title is displayed, and execution continues up to the next AWAIT. After the third AWAIT task is complete, the third title is displayed. To accomplish all of this, the compiler generates a lot of code to maintain state — code that you would have had to write manually before the introduction of these two very helpful keywords.

In short, AWAIT and ASYNC can be used to improve the responsiveness of your application without increasing the complexity of your code. If you would like more background on asynchronous programming, check out this article on Microsoft’s web site.

For more information about ASYNC and AWAIT, see the version 10 Synergy DBL Language Reference Manual.
For more information about Synergy/DE 10.1, see the 10.1 web site.


 

Paradise by the dashboard light

Check out this fully functional interactive dashboard totally written in Synergy .NET

Using the Symphony Framework and building my Synergy Repository based Data Objects using CodeGen I was able to quickly build the core components used in this Dashboard... all this functionality is available in the latest V10.1 release of Synergy.

Read more in the PSG Blog.


Synergy/DE tech tip

Printing a PDF file in Synergy

Question

How can I print a PDF file in Synergy?

Answer

One way to print a PDF file in Synergy is by using the SPAWN command to spawn Acrobat Reader. Here's an example:

    spawn("AcroRd32.exe /p test.pdf")

The "/p" command will print with the Print dialog. If you want the document to print silently to your default printer, use the following syntax:

    spawn("AcroRd32.exe /N /T test.pdf PrinterName [PrinterDriver [PrinterPort ]]")

Need to add PDF capabilities to your Synergy applications?
Use our new and improved PDF API, available for download in the Synergy CodeExchange! Since we added the API to CodeExchange last year, we updated the API to enable you to build on one little-endian (Windows or Unix) platform and run on the other. For example, you can build on 32-bit Windows and run on 32-bit Linux, or build on 64-bit Linux and run on 64-bit Windows.

Quiz

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

Synergy .NET supports classes that implement interfaces, which provides a mechanism for a form of multiple inheritance. Consider the following scenario:

- An interface named Motion contains a property named "sprung".
- A class named Season also contains a property named "sprung".
- A second class, named Spring, extends Season and implements Motion. It does not override "sprung."

Which property implementation gets accessed for an instance of Spring?

a. Season.sprung
b. Motion.sprung
c. neither
d. both

 Click to read the answer


“One of the best European airports” selects Synergy/DE-based ALDIS airport software

Humberside International Airport replaces flight information and airport billing systems with AIS’s software

With over 270,000 passengers a year, Humberside International Airport has been named by the Airports Council International as one of the best European airports. The bulk of their flights are conducted by helicopters flying to North Sea oil rigs, and they host three of the biggest helicopter operators in the UK.

Humberside recently selected Airport International System’s (AIS) Synergy/DE-based Flight Information Display System, with the capability of reading web boarding passes on paper or mobile phone, to replace its existing flight information display system, and AIS’s Airport Management System to replace its current airport billing system. AIS’s software will now manage all of the airport’s check-in desks, landside and airside departure information, gates, carousels, landside arrival information, and aeronautical and fuel credit and cash invoicing. It will also upload all arrival and departure information to the airport’s Web site and display staff information via the airport LAN on any desktop PC.

AIS’s products represent the very latest in airport management software and fully cater to any airport’s operational and data management needs. The application uses xfServerPlus and xfNetLink Synergy Edition to handle client communications with their back-end Windows server, and xfODBC to enable third-party reporting capabilities by programs such as Crystal Reports.


Platform News

Read a selection of recent articles

Windows

Microsoft will reportedly merge Windows 8 and Windows Phone 8 into Windows Blue
http://www.extremetech.com/computing/152816-microsoft-will-reportedly-merge-windows-8-and-windows-phone-8-into-windows-blue

Windows users are singing the 'Blues'
http://www.infoworld.com/t/microsoft-windows/windows-users-are-singing-the-blues-215417

Windows Blue and Microsoft's continuous upgrade strategy
http://www.computerworld.com/s/article/9237931/Windows_Blue_and_Microsoft_s_continuous_upgrade_strategy?taxonomyId=89

Five reasons why the Windows desktop isn't going away
http://www.zdnet.com/five-reasons-why-the-windows-desktop-isnt-going-away-7000013185/

Windows APIs: Microsoft's hidden guide to architecture
http://www.zdnet.com/windows-apis-microsofts-hidden-guide-to-architecture-7000013763/

Microsoft starts auto-installing Windows 7 SP1 on consumer PCs Tuesday
http://www.computerworld.com/s/article/9237687/Microsoft_starts_auto_installing_Windows_7_SP1_on_consumer_PCs_Tuesday?taxonomyId=89

Microsoft's latest patches squash potential USB hijack
http://www.computerworld.com/s/article/9237536/Microsoft_s_latest_patches_squash_potential_USB_hijack?taxonomyId=89

Unix/Linux

Red Hat CEO optimistic about OpenStack
http://www.internetnews.com/ent-news/red-hat-ceo-optimistic-about-openstack.html

Linux adoption continues to grow
http://www.serverwatch.com/server-news/linux-adoption-continues-to-grow.html

5 new features coming in OpenSUSE Linux 12.3
http://www.computerworld.com/s/article/9237485/5_new_features_coming_in_OpenSUSE_Linux_12.3?taxonomyId=122

Linux foundation training prepares the International Space Station for Linux migration
http://www.linux.com/news/featured-blogs/191-linux-training/711318-linux-foundation-training-prepares-the-international-space-station-for-linux-migration

Red Hat taps former Microsoft exec as new server virtualization chief
http://www.serverwatch.com/server-news/red-hat-taps-former-microsoft-exec-as-new-server-virtualization-chief.html

HP launches new class of server for social, mobile, cloud and big data
http://www8.hp.com/us/en/hp-news/press-release.html?id=1389585#.UWXdQDePT58

OpenVMS

OpenVMS Webinar Series – 2013: DCL - Tips and Tricks
http://www.openvms.org/stories.php?story=13/04/10/7027729