February 14, 2014
In This Issue:
 
Register for the 2014 Synergy DevPartner Conference
Bit Shifting Operators Come to Synergy .NET
Quiz - Is Love in the Air?
Platform News
Synergex Holiday Reminder
 
Register for the 2014 Synergy DevPartner Conference
 
Synergy/DE Conference 2014

Register Today for the 2014 Synergy DevPartner Conference

This is the must-attend annual event for companies developing with Synergy/DE

The 2014 Synergy DevPartner Conference takes place June 10-12 in Birmingham, UK, and June 24-26 in Chicago, IL. Join Synergy/DE developers from all over the world for three information-packed days of comprehensive technical sessions, focused hands-on tutorials, enlightening customer demos, and invaluable networking opportunities.

Described as “a three-day graduate degree in all things Synergy/DE” by 2013 attendee Patricia Silvia, the conference is the most effective, efficient way for you to learn about the possibilities available to you now for your Synergy/DE-based applications. When designing the content, we looked at the most common requests we received from customers over the past year and incorporated that information into the agenda. Sessions cover everything from how to incorporate relational databases to how to build an Android app with Synergy .NET.

“This is an excellent forum to meet others in the industry, to see what they are doing and how they are doing it. “ (Steve Sarapata, Instantwhip Foods)

“The material covered in the conference could be a game changer.” (James Fox, Health Business Systems)

“Wonderful presentations and absolutely new ways to complete tasks using new technology.” (Teresa Uhrich, AgTrax)

These are just a sampling of the customer testimonials from last year’s conference. For more testimonials and information, visit the conference web site.

 
Just for Developers
 
Bit Shifting Operators Come to Synergy .NET
By Bob Studer, Senior System Software Engineer
 

Synergy DBL 10.1 on .NET adds two new operators for expressions: right bit shift ( >> ) and left bit shift
( << ). In combination with the other bitwise operators (|, &, etc.), shifting can access parts of fields that can be used to store flag data or to combine and extract small pieces of data. Bit shifts can be applied to Synergy decimal and integer types and some classes. They work by shifting, in bucket brigade fashion, the bits in the value on the left of the operator either to the left or the right by the number of bits specified by the value on the right of the operator. For example:

     data x, i1,       3
     data y, i1
     y = x << 2

In this example the binary value of x is 00000011. Shifting that left by two bits changes the binary value to 00001100, which is 12 decimal. In effect, x was multiplied by 22, or 4. If a 1 bit is shifted into the high bit of a signed field, the value will be negative, and if a 0 is shifted into the high bit, the value will be positive. Any bits shifted out of the high end of the field will be lost; 0 bits are shifted into the low end of the field.

On the other hand, if x is shifted 1 bit to the right, as follows:

    y = x >> 1

y will be set to 1. Thus, 00000011 becomes 00000001, in effect dividing x by 21, or 2. Any bits shifted out of the low end of the field will be lost, and bits that match the sign bit (the high-end bit) will be shifted in from the high end, so a negative value will stay negative, and a positive value will remain positive. This is called a sign-extending right shift.

Bit shifting is limited to integer types (i1, i2, i4, i8, int, short, long, and sbyte), Synergy decimal types (for example, d4), and classes that implement the op_RightShift or op_LeftShift operator methods. Synergy decimal types are first converted into integers before the shift is performed. The following example shows a class that implements the right shift operator:

namespace ns1
class fred     public method fred         arg,   int     proc         val = arg     end
    public property val, int
           method get
           endmethod
           method set
           endmethod
    endproperty
    public static method op_RightShift,    @fred
           arg1,   @fred
           arg2,   int
    proc
           arg1.val = arg1.val >> arg2       ;Right shifts the val property
           mreturn arg1
           end
           private myval,        int
endclass
endnamespace
proc
       data h, @fred,  new fred(125)
       h = h >> 3              ;Calls the op_RightShift method
       console.writeline(h.val)
end


In combination with the other bitwise operators, shifting can be used to set and access groups of bits within a single field. These bits can represent groups of flags or small values.

    data combi,   sbyte
data b1,      sbyte
data b2,      sbyte
b1 = 3
b2 = 6
console.writeline(b1) console.writeline(b2) combi = ((b1 & 7) << 3) | (b2 & 7) b2 = (combi >> 3) & 7 b1 = combi & 7 console.writeline(b1) console.writeline(b2)

The above code swaps the values contained in b1 and b2. Swapping values this way demonstrates that you can access the two three-bit “subfields” of the combi field separately. ANDing b1 and b2 with 7 ensures that the incoming values won’t exceed the three bits allocated to the subfields. The value of b1 is shifted to the left 3 bits, and then the value of b2 is ORed into the lower three bits of combi. The next statements then extract the two three-bit fields, storing them in opposite fields to demonstrate that the values have been correctly retrieved.

You can see how bit shifts give you more control over individual bits within integer types. We think you’ll find them extremely useful. See the “Expressions” chapter in the Synergy DBL Language Reference Manual for more information.


 
Quiz
 
Is Love in the Air?
Take the Synergy/DE quiz to find out...

A tech-savvy cherub is helping Cupid this year and has written a program that asks a few simple questions about each suitor. Assuming the guy in question has done everything that’s required to be a “true romantic,” the software then locates the love interest, tells Cupid when to fire, and relieves an arrow from inventory.

Here’s the code from the main program:

    enum LoveMeter
         SheLovesHimNot  ,0 
         SentFlowers     ,1 
         MadeReservation ,2 
         GaveHerACard    ,4 
         SheLovesHim     ,7 
     endenum 
main 
record 
       suitorName      ,string 
       suitorStatus    ,LoveMeter
proc 
       open(1,o,'tt:')
       repeat
       begin 
        suitorName = GetSuitorName()  ; Returns next suitor name as string 
        suitorStatus = LoveMeter.SheLovesHimNot
        ; Ask function returns 0 for No, and 1 for Yes 
        if (Ask("Did suitor send flowers?"))
               suitorStatus = suitorStatus | LoveMeter.SentFlowers
        if (Ask("Did suitor make a reservation at a good restaurant?"))
               suitorStatus = suitorStatus | LoveMeter.MadeReservation
        if (Ask("Did suitor give her a nice card?"))
               suitorStatus = suitorStatus | LoveMeter.GaveHerACard
        ; If flowers were sent, make sure she received them! 
        if (suitorStatus & LoveMeter.SentFlowers)
        if !(Ask("Were the flowers delivered correctly?"))
               suitorStatus = suitorStatus .bxor. LoveMeter.SentFlowers
                   if (suitorStatus & LoveMeter.SheLovesHim) != LoveMeter.SheLovesHim             nextloop
        AcquireTarget(suitorName)
        NockArrowAndLetFly()
        ReduceArrowInventory(1)
    end end

Given the above program, and assuming that all functions and subroutines operate correctly, what is the result?

                  a) This program fails to compile.

                  b) It’s a bad year for love; Cupid might as well take the day off because no one is
                  going to be targeted, no matter how the questions are answered.

                  c) It’s a great year for love; Cupid nearly runs out of arrows because everyone is
                  getting targeted – even if the guy didn’t do a thing to deserve it.

                  d) Incorrect delivery of the flowers causes a runtime error.

Click here for the answer.

 

 
Platform News
 
Adobe issues emergency Flash update for Windows and Mac
Windows
Performance tuning guidelines for previous versions of Windows Server
Microsoft names Satya Nadella new CEO
Getting to know John Thompson, Microsoft's new chairman
Windows 8.1 update may be delayed until April
Microsoft to +1 its OS, move to Windows 9 in 2015
Microsoft starts testing Visual Studio 2013 Update 2
Windows XP: What to expect once Microsoft shuts down support
 
Linux
Linux 3.13 released
 
OpenVMS
OpenVMS Roadmap updated
 
Synergex Holiday Reminder

We will be closed Monday, February 17, in honor of Presidents' Day

If you anticipate needing our assistance on this day, please let us know.

 
Synergy/DE Links:
Product Documentation
Current Release (10.1)
Latest Patches (& changes per version)
Product Videos
Resource Center Login
Contact Us
 
 
hr1
  Synergex