ProTechs-Online

Programming and Software Development

 
 

Programmers are not made but born. For people that don't desire to program it is the most boring of work.

I will have to keep my commentary to a minimum regarding my programming examples. If you have questions about them please ask on my forums. These examples will contain some open source code that I found on the internet as well.

 

BASIC and PASCAL

 

I first learned to program BASIC and PASCAL early on in High School using Apple II and Commodore 64 computers.

Remember the classic code:

10 PRINT "Hello"
20 GOTO 10       

This code would lockup a computer and display "Hello" over and over again at a break neck speed.

Modern Visual Basic is quite a bit different and has become the preferred business programming language.

 

Visual Basic for Microsoft Access

 

VBA is a tailored version of Microsoft Visual Basic. It is designed to work with Microsoft Office products mainly Access, Excel and Word. I have used VBA in Excel, Access and Word for database dashboards, database custom reports, sales information tracking, project tracking and scheduling.

 

Visual Basic 6.0

 

Chadusr.exe

 

This program was designed to work with USB magnetic card readers and SERIAL barcode scanners. The idea was to capture information from trade shows and add more sales lead information without having to use the trade show rental equipment. The salesman would then export the leads to an Excel workbook. This proved to be unrealistic because you never knew what hardware was going to be used from trade show to trade show. None the less it is the basis for USB and SERIAL software communication.

 
Modules:


Start program choose magnetic card reader or barcode scanner
 
     
Forms:




Project:


Read mag strip or barcode and added sales rep, call back, product and notes
 
 

GasifierServer.exe

 

I wrote this software to monitor a prototype biomass gasifier. The gasifier had a Modicon PLC with a RS232 Modbus card which I connected to a computer's serial port. To connect the software to the PLC the computer serial port number is entered into "Com#"; then click "Connect to PLC". For development there are five Modbus tests and an event log. To retrieve temperatures, system air pressure, flue gas oxygen percentage, blowers air flow rates and biomass fuel feed rates click "Start Polling". The GasifierClients that connect to the GasifierServer are listed in the connections status listing.

 
Sorry due to legalities I can't post more of this project.
 

GasifierClient.exe

 

To connect GasifierClient.exe to a GasifierServer.exe server an IP address or DNS URL (example: http://machine.somedomain.com) is entered into the Remote IP textbox; then click "Connect". The connection status is displayed in "Connection" and "Rec" displays the number of received bytes. The "Rec" should be increasing continuously. If it isn't, then something is wrong and you are not receiving updated information. Alarm events are listed in the "Alarms" section. When GasifierClient is receiving data it can be logged. In the "Data Logging" section click "Start". A "File Save As" dialog window will appear. Browse to the location to store your data file and name it. The data log file is a comma separated file (CSV) because this file type can be easily imported into analysis software. Data is written to the file every minute.

 
Sorry due to legalities I can't post more of this project.
 

For more information on Modbus go to Modbus Explained

 

Visual C++ 6.0

Chadscr.scr

 

This is a 3-D screensaver that you can easily customize by changing the program resource bitmaps with your pics and logos.

Moving the mouse doesn't deactivate the screensaver; you have to click a mouse button or press a key on the keyboard.

Chadscr.scr is a Microsoft Foundation Classes (MFC) program. I used the OpenGL libraries that come with all versions of Windows to accomplish the 3-D animation.

 
Headers:




Sources:




Project:


3d screensaver pic1

3d screensaver pic2

3d screensaver pic3

3d screensaver pic4

3d screensaver pic5

3d screensaver pic6
 
 

Visual Studio 2008

 

This is what I use for programming now and I like it very much. The "IBM Database Add-Ins for Visual Studio" has allowed me to write apps that interface with IBM's DB2 Database. Using the "Rebex" library my apps are sending files by FTPS.

With Visual Studio 2008 I have created an ASP.NET Website that pulls information from an ERP on the IBM DB2 Database. It uses Microsoft SQL Server 2008 and Application Services for SQL Server to manage website user security. Database information tracked by the app is store in its own database on the MS SQL server.

 

ASP.NET Example for PCI Compliance

 

This ASP.NET application takes into account all the core security principals for PCI compliance. You can find out how to do session management, async encryption and html output filtering. This example include scripts to create addition tables in your MS SQL Server and it also leverages the ASP.NET Membership provider.

 
You will need to do a few things before this project will work.
 
  1. Install Asp.net Membership Provider on your SQL Server (aspnet_regsql.exe)
  2. Make UserName column in aspnet_Users a unique index (Foreign Key Delete Cascade won't work without it)
  3. Run included SQL scripts to create application additional tables (Order: sessions, items, cards, carts)
  4. Run included SQL scripts to create application additional store procedures
  5. Use Asp.Net Configuration in Visual Studio and add roles "admin" and "users"
  6. Use Asp.Net Configuration in Visual Studio and create and add a user to role "admin"

When you run aspnet_regsql.exe to install the Asp.net database and services you may want to call the new database “sans” for quick setup.

Also you will need to change the main “web.config” line:

<add name="TestConnectionString" connectionString="Data Source=TEST2;Initial Catalog=sans;Integrated Security=True"

Replace the “Data Source=TEST2” to your SQL Server instance.

I know I left out a try\catch here or there.

 
Sources:




Project:


Picture of session hidden content


asp.net login screen pic


catalog and user modification screen on website
 
 

Javascript Graphics Animation

 

I needed to create a website that would run on all operating systems and browsers with total mediation and graphic animation. This is what I came up with. Its a nice visual benchmark test for mobile devices. The graphics are speed up with load caching.

 
Sources:




Project:


Javascript bouncing ball
 
 

EDI AS2 Communication and SFTP File Uploads

 

This program does enterprise EDI and SFTP communications with a large retail chain. It has been in production use for a years. I personally don't like to use 3rd VAN's if possible. Instead I opted to purchase the IP Works EDI V8 from NSoftware. The IP Works .Net components allowed me to do direct to customer AS2 EDI communication. For SFTP communications I chose the Rebex FTP/SSL for .NET Framework 2.0 components. I highly recommend both of these software companies.

EDI purchase orders are received on an ASP.NET website and the data stored in a Microsoft SQL database. This Forms application Purchase Orders tab displays the purchase order tables. When staff click the ACK check box for an EDI PO an EDI acknowledgement is sent via AS2 communication to the customer's servers. Once staff create a sales order in the ERP they check off the QDB column for the PO. This causes the application to pull sales order information from the ERP database and put it in the EDI database with initial shipping information. I wrote a console application that runs as a scheduled task on a server to package the shipping formation and send it as a file SFTP update to the customer's GIS shipping system. Double clicking on a line item in the Purchase Order tab opens the PO in Excel for sales order entry into the ERP or printing.

I will only be able to display snippets of code since this is a production software package.

 
Sources:


Picture of EDI purchase orders
 
 

The Invoices tab display the EDI database invoices tables. On the same day a sales order is shipped in the ERP staff add the ERP invoice number. This causes the application to pull final ERP sales order, shipping and shipping barcode scanning label information (another one of my app's) to be added to the EDI database for SFTP transmission to the customer's GIS system.

When staff check off the SENT column for an EDI invoice the invoice is sent AS2 to the customer for payment.

This whole process is a major money and time saver for both customer and vendor.

 
picture of edi invoices
 

Visual Studio 2010 C# Outlook Add-in Code Examples

 

I wrote an Outlook 2010 add-in to copy email communications to our Syteline ERP's Customer Interactions.

This first version was a Outlook Form Region that would be display when emails were previewed from specific Outlook mail item folders. Emails were saved into a *.msg file and a DocTrak record created linking the message file to the customer interaction. The user would need to choose which system to search for a contact and the contact type. Once found a contact or company record could be added to the export list. All entries in the export list would get a DocTrak link and a copy of the email text in a Syteline customer interaction.

After using this for a while I decide this process was too complicated and cumbersome which led to a rewrite.

Outlook Form Region Code Examples:

Picture of the Outlook Add-in Form Region
  1. Outlook Add-in Form Region code
Picture of the Outlook 2010 Add-in Option dialog
  1. Outlook Add-in Options dialog code
  2. Outlook Add-in adding the Options Page and registry keys
 

For the rewrite I decided to make the Outlook Add-in a button in the Ribbon and in the main Message Tab. The picture of the Outlook Ribbon below shows the button circled in red. The button would only appear when you open a mail item. Clicking the Export button open a Windows Form that has a real time search as you type feature that populates the list below. To copy the email to Syteline customer interactions or service order incidents all the user has to do is double click the line in the search results datagrid.

Outlook Add-in Ribbon Code Examples:

Ribbon Message Tab

Picture of the Outlook 2010 Add-in Export Button
  1. Outlook Add-in place button in main Message Tab
  2. Outlook Add-in Export Button code
  3. Outlook Add-in ThisAddIn_Startup code
  4. Outlook Add-in Ribbon code

Windows Form

Picture of the Outlook 2010 Add-in Window Form
  1. Outlook Add-in Window Forms code
 

GNU C++

 

One of the projects I worked on required me to source computer hardware for an outdoor environment. I decided to recommend Eurotech PC104 Embedded Computers. PC104 boards are stackable small square form factor that easily mount into enclosures. To add more IO capabilities you purchase boards that simply stack onto the PC104 bus connector one on top of the other. Another reason I went with Eurotech was they offered an Embedded Linux toolchain ready to go.

Zeus Embedded PC Linux C++ code example:

Zeus Embedded PC

Zeus Embedded PC
  1. Compile command: arm-linux-g++ -lssl -lcrypto -lrt ./example.cpp -o example
  2. Linux C++ code example of accessing the Zeus GPIO

The nice thing about the Zeus's GPIO is that there is a lot of it and its 5 volts which works nicely with relays.

Viper Embedded PC Linux C++ with Viper IO Board code example:

Viper Embedded PC

Viper Embedded PC

Viper IO Board

Viper IO Board
  1. Compile command: arm-linux-g++ -lssl -lcrypto -lrt ./example.cpp -o example
  2. Linux C++ code example of accessing the Viper GPIO using the Viper IO Board

The bad thing about the Viper's GPIO is that its 3 volts. Eurotech had the Viper IO Board available which saved me from having to develop with transistor based relays.

Titan Embedded PC Linux C++ with AIM104-Relay8/IN8 code example:

Titan Embedded PC

Titan Embedded PC

AIM104-Relay8/IN8

AIM104-Relay8/IN8
  1. Compile command: arm-linux-g++ -lssl -lcrypto -L/opt/openssl/usr/lib -I/opt/openssl/usr/include/openssl -lrt -Wall -L/opt/arcom/arm-linux/lib -laim104 ./example.cpp -o example
  2. Linux C++ code example of accessing the Titan AIM104 Relay8/IN8 Board.

The bad thing about the Titan's GPIO is that its 3 volts. Eurotech has the AIM104-Relay8/IN8 available which saved me from having to develop with transistor based relays.

Linux C++ C-56 Thermal Printer code example:

Hengstler C-56 Thermal Printer

Hengstler C-56 Thermal Printer
  1. Linux C++ code example of RS232 serial printing to C-56 Thermal Printer

The C-56 Thermal Printer is very reliable in outdoor environments.

Linux C++ Fork a program into a Daemon service code example:

  1. Call the daemon() function below first thing in the main subroutine of your program.
  2. Linux C++ code example of forking a program into a Daemon service.
 
The best way to contact Chad is by email at info@protechs-online.com.
 
Back to Home page

Copyright © 2013 ProTechs-Online.com; All rights reserved.