Articles of Feb 2014

Projects of Feb 2014


Postmortem of HTML5 Google Map / Google Earth project

by Eric Wood, Director of Product Development at Avatar Systems, Frisco, TX.


Abstract:

Background: My background is Microsoft Visual Studio, but I needed to research a creation of a live "War Room" application using Google Map and/or Google Earth using HTML5 (HTML, Javascript, and CSS). The challenge was to map, in real-time, the locations of oil delivery trucks as they traveled from the dispatch office to the various load pickups from the wells, and the periodic drop offs at the delivery stations that would later flow into the pipeline.


Technology:

Google Map is a 2-D view of the world while Google Earth is a 3-D view of the world. Many of the functions are similar, but not identical.


Requirements:

1) Start with Google Map or Google Earth.

2) Create static way-points with configurable icons and captions to represent the delivery stations and wells on the overall map. The delivery stations and wells had known GPS coordinates.

3) Start the experience in the center of the mapped coordinates. (I had to compute the center dynamically).

4) Draw a colored line out that would track the route that the driver took his truck using data from his tablet’s GPS. (The driver's GPS was already writing to a SQL Server database table due to an earlier project.) Different drivers would be indicated by different colors.

5) The tablets would need to send their current GPS position to the dispatch office in real-time.


Code:

  1. Initialize interaction with Google Map or Google Earth.

  2. Load asynchronously 

  3. Create static waypoints with configurable icons and captions.

  4. Calculate the coordinate center.

  5. Draw colored lines on the map


Hurdle: The project was put on hold due to an inability to receive real-time feedback from the trucks from locations outside of cell phone range.

© 2014 Eric Wood


===============================================


How To Create an "Is Used" and/or "Can Delete" stored procedure in MS SQL Server

by Eric Wood, Director of Product Development at Avatar Systems, Frisco, TX.


Abstract:

Background: The challenge that every application has, is to discern whether to allow deletion of "master file"(a.k.a. "entity") data. You don't want to allow the user to delete a customer that might have been used on an invoice in the past, but you do want to allow deletion of mistakes.


Technology: MS SQL Server


Requirements:

1) Take a table name, an integer or guid id, and calculate the number of times it is used in other tables.

2) Reject incorrectly typed table names

3) Reject incorrectly entered IDs

4) Ignore Microsoft tables when calculating.


Assumptions:

1) Foreign keys exist on the tables

2) Consistently have a single column that is the ID.

3) Consistently name the ID column the same name throughout the database.

4) All the tables that need to be checked are in the same database.


Code:

1) Verify Parameter Input

2) Create a checklist of tables and columns to check (if any)

3) See if data row is used in the other table


Code Enhancement:

Improve code to potentially return a list of all tables, their columns, their number of times used and first location used.


Code Enhancement:

Deal with "bridge"/"cross reference" tables


© 2014 Eric Wood


===============================================


How To Create a WCF Web Service layer

by Eric Wood, Director of Product Development at Avatar Systems, Frisco, TX.

Abstract:

Background: Create multiple WCF service projects that retrieve data from the database, define the model of the entity or table, apply business logic rules, and provide the data to the client via a service interface. Create a supporting common service project that holds all common code. This article shows using parent classes from object oriented programming in combination with generics to provide minimal repeating method code.


Technology: WCF, C#, IIS, OOP, Generics


Requirements:

1) Business Logic must create, read, and delete.

2) Models must define the structure of the various tables

3) Service and its interface must expose the methods and the serialized data models.


Code –Parent Classes:

  1. Base Model Class

  1. Properties

  2. Copy Method


  1. Base Logic Class

  1. Abstract Properties

  2. GetCurrentRecord Method

  3. GetList Method

  4. GetListFromSP Method

  5. Copy Method

  6. Logging


  1. Base Editable Logic Class

  1. Abstract Properties

  2. Save method

  3. SaveAll method

  4. Logging


  1. Base Deletable Logic Class

  1. Abstract Properties

  2. Delete method

  3. CanDelete method

  4. Logging


Code – Sample Model Class

Code – Sample Logic Class

Code – Sample Interface Snippet

Code – Sample Service Snippet

© 2014 Eric Wood

 

Comments

Popular posts from this blog

Upgrading to .NET8 from desktop versions 4.8.X

GHL Chat Bots for Webpage

GHL > Set website so shorter URL address