Note the missing SPI1 on the new revision of the Windows IoT pinouts for Raspberry Pi

imageimage

It seems the SPI1 (pins11,35,38,40/GPIO 19,20,21,17) have been assigned to GPIO on the latest pin out.

Apparently there are five alternatives for the use of the pins, see:http://elinux.org/RPi_BCM2835_GPIOs

Only two SPI devices seems quite constrained when I’m used to .NET Microframework on the Netduino where such constraints are not present.

Next the sample push button application has been updated from using polling to using interrupts, get the feeling that the sand is moving under my feet with Windows IoT.

Windows IoT Core 10 & Raspberry Pi missing Gpio reference

Error CS0246 The type or namespace name 'GpioPin' could not be found (are you missing a using directive or an assembly reference?)

Problem that you don't appear to be able to have the Gpio namespace or spi namespace or I2C namespace in your project?

Started looking at the Samples for Windows IoT on the Raspberry Pi, say from the samples Github https://github.com/ms-iot/samples or perhaps from the accompanying https://microsoft.hackster.io/en-US examples?

Working with Win IoT is tricky at the moment as it’s early days for the platform, thus much of the information out there is already out of date as it originates from the previews, after which the landscape has matured. In the next blog post I will highlight how the pin-outs on the Raspberry Pi have changed, the SPI1 is not longer present on the Windows IoT Raspberry Pi API. The graphic on the FAQ has been updated, making all the links to it from forum posts and similar, where the graphic has been linked, not make sense anymore with the new graphic. This is merely one of the many examples where you have to tread carefully and have faith in your experience and knowledge. Having worked extensively with the .NET Microframework on the Netduio platform has given me valuable experience to apply to the new Win IoT world.

When following any of the examples on line, or indeed starting a new project for the first time, there is one important piece of information that is missing. The fact that a reference the “Windows IoT Extensions for the UWP” is required to get the hardware namespaces. This makes perfect sense when you stop to think for a moment. This .dll adds to the UWP the namespaces required for access to hardware features of  IoT devices like the raspberry Pi.

Windows.Devices.DevicesLowLevelContract

This includes Gpio, Adc, I2c, Pwn, Spi namespaces for Windows IoT Raspberry Pi.

Add a reference to Windows IoT Extensions for the UWP and Windows.Devices.Gpio will become available in intellisence.

 

Windows IoT Extensions for the UWP

So the references work in similar way to the .NET Microframework where for the Netduino the following references would be normally added to access the hardware, and other references used if one of the alternative platform boards was used:

 

SQL Calculate Customer Balance & On Order amount for Dynamics GP

The values in the Customer summary table RM00103 keep drifting from what they should be. This causes issues with our pick list printing service that was using them in a complex credit checking routine. Sometimes the on order amount could be minus thousands of pounds, leading to goods being despatched when they shouldn’t.

For the way we use GP, the following script is adequate to compare the values in the tables with the transactions in GP. We don’t use receivable invoices but this could easily be added in using table IVC10100.

So on freshly reconciled company the following script returns no rows, when the values go out of line a SQL job emails the row to us, in order to try and ascertain what just happened somewhere in GP.

I post the SQL here merely as a starting point for others looking at customer balances or outstanding transactions against customers in GP with SQL as I didn’t see much from web searches on that subject. I strongly urge you to test the query first on your system.

;WITH CTE_OrderSummary AS(
SELECT CUSTNMBR, SUM(REMSUBTO) ONORDAMNTCALC FROM SOP10100
WHERE (SOPTYPE=2 OR SOPTYPE=3)
AND VOIDSTTS=0
GROUP BY CUSTNMBR
),
CTE_RM_Summary AS(
SELECT
CUSTNMBR,SUM(CASE WHEN RMDTYPAL IN (0,1,3,4,5,6) THEN
CURTRXAM ELSE -1*CURTRXAM END)AS CALCBAL
FROM RM20101
WHERE
VOIDSTTS=0
GROUP BY CUSTNMBR)

SELECT RM00103.CUSTNMBR,
CUSTBLNC,
ISNULL(CALCBAL,0) AS CALCBAL,
ONORDAMT,
ISNULL(ONORDAMNTCALC,0) AS ONORDAMNTCALC,
'Summary information differs from calc value for balance or on order amount'

FROM RM00103
LEFT JOIN CTE_OrderSummary ON RM00103.CUSTNMBR=CTE_OrderSummary.CUSTNMBR
LEFT JOIN CTE_RM_Summary ON RM00103.CUSTNMBR=CTE_RM_Summary.CUSTNMBR
where
(
ISNULL(ONORDAMNTCALC,0)!=ONORDAMT
OR
ISNULL( CALCBAL,0)!=CUSTBLNC
)

test company, test database, live company in test database, test company in live database…

How times have changed. Now we have a SAN and ESX Hypervisors hosting our servers, virtualisation and new hardware platforms have made managing enterprise infrastructure so much easier. For developers this had made possible the cloning of live environments, yes webservers, databases, ERP and various integrations can all be plucked from operational service and plonked down into a test environment.

This means testing and development can take place in environments that are almost identical to production live environments. Importantly I said almost identical – users can log in and test scenarios and perform UAT, performing end to end UAT scripts without interruption. Years ago they would have had to test one section at a time and everyone would pray when it was all stitched together and launched into the production environment that it would hang together. The confidence factor from testing is increased as a consequence of the improved environments and this mostly makes for safer deployments.

As developers we have almost identical copies of the production environments to work with, whilst so helpful It introduces new hazards and risks. We noticed just how much time is spent orientating every conversation, prefacing it with what version of the various systems we are talking about for fear of misunderstanding. Much akin to the header on information packets. It is risky when production and live database are open in SQL server, oh so easy to run a script against the wrong system. I am happy to say I’ve never taken GP down by running SQL against it.. yet, but when we changed to this arrangement I became very aware of how easy it is to make a mistake now. When it was a test company we were developing in, then the connection was obvious. The problem is when both databases look the same including the name and only the server is different then it becomes all to easy to make mistakes. It becomes essential to keep an eye on the connections shown in by hovering over the tabs of the SQL pane.

I also use an add in for SQL server management studio, SSMS Boostthat has recovered many scripts from loss during system crashes or simply discarding a script I wish I hadn't.  It keeps a history of everything in SQL management studio, saved or not and lets the user go back to scripts ran days ago. It also provides search for that history too- highly recommended. Anyway I am off track, this add in also has the facility to colour the connections on the task bar at the bottom. This can be another helpful aid if orientation when working between multiple connections between live and test website and GP databases.

image

 

GP Power Tools (Support Debugging Tool)

It is also dangerous for users of GP, using the GP client and developers working between the clone environment and production. Even with explicit warnings about not entering genuine orders into the test system, it only took a day for someone to do it! Luckily it was only one order and not a whole day’s worth.

The GP power tools gives us the ability to colour windows in GP according to the company database it belongs to. This provides a visual cue to the user to instantly recognise which company the user is working in. See the screen shot for the configuration of this feature. I don’t know if the newer power tools is exactly the same, but with this version, it cannot differentiate between the database server the company is running on. Hence we cannot use this program to identify the difference between servers.

image

Visual Studio Tools

Due to the accidental use of the clone server, it became apparent we needed something to tell the difference easily, when users are logged into GP in the clone environment. We used the same idea of colouring the user interface depending upon the company, but instead used the server name as the identifier. The solution is implementing as part of the Visual Studio Tools plugin we have written. It takes advantage of the same Dexterity calls (Color_SetSystemColor) as shown in the references that follow, pay particular attention to “Colours Depending on Company.zip” in the VBA example.

We see here how the bar is coloured, this is enough to know we are in danger.

 

There is still the problems of multiple test and production GP companies, servers and databases, but at least when in GP it is clear which connection is currently in use from the user interface. Thanks to Michael on the team for developing this solution.

References

Differentiating Companies in Microsoft Dynamics GP

Hybrid – Changing Screen Colours Depending on Company Example