Happy Thanksgiving!
From all of us at Prestwood we wish all of you a safe and happy Thanksgiving.
This issue includes a variety of topics from tips to manage your IT department ... down to code to manage your string conversions. To add some levity, we include a recipe for Delphi cooking - just in time for Thanksgiving.
Be sure to check out our message boards if you have a problem to post, or just want to read about what your fellow developers are up to. I learn something new each time I visit the boards. Visit Message Boards
Until next month,
Vicki Nelson Sr. Editor Prestwood Software |
|
Feature Articles:
Four Ways to Make Information Technology More Effective by Randy McClendon
Several recent economic reports indicate that productivity in America is at an all-time high. In large part, this is due to more investment in information technology to help streamline tasks at work and promote better communications within organizations.
However, some organizations continue to invest in information technology without realizing any meaningful improvement in their overall efficiency. It has been my experience that organizations make some fairly common mistakes that drag down the overall effectiveness of their IT departments. Here is a quick checklist to see if your IT Operations has fallen into some of these all too common mistakes.
1. Diffused Administration 2. Standardize Software 3. Build vs. Buy 4. Customers' Needs Come First
Microsoft Visual FoxPro
Win-32 API: Determining the Unique Network Interface Card (NIC) ID by Fred Stevens
In this series of articles, we will examine specific techniques and provide code samples for the Visual FoxPro programmer to use to access the Windows API to accomplish important tasks. This month we present article 1 of 4.
Windows Win-32 API contains many methods to glean information about the computer currently running the Windows operating system. Although Microsoft’s Visual FoxPro (VFP) has the capability of using these methods to access system information, most of the published routines to accomplish these tasks are for other languages (such as C++) and require conversion by someone literate in both languages to be useful to the VFP programmer.
A sample need for system information is a requirement to uniquely identify a specific computer, for example to create a license “key†that will only work on a specific known system to allow use of a software product. This can be accomplished by reading the ID information on the system’s network interface card (NIC). Since every NIC in the world has a different unique ID number, this ID can be used to uniquely identify a specific machine. The NIC ID is also referred to as the “physical address†or the Media Access Control (MAC) address of the network card.
Borland Delphi
How to Cook Your Turkey in Delphi by Scott Wehrly and Al Troxell
Take a break from the technical information in these articles to plan how you are going to prepare for your big feast on Thanksgiving day. We have two recipes: one for a traditional turkey dinner in America, and one for an innovative turkey dinner in ... Delphi?
Standard American Turkey Dinner by Al Troxell
1. Turkey--roasted slowly in the oven and 2. stuffed with a nice bread or wild rice stuffing--Don't forget the giblets from the bird! 3. GOT TO have mashed potatoes--these are required. No exceptions. 4. Sweet Yams--probably topped with some nice, calorie filled marshmallows and soaked in a beautiful brown sugar glaze. 5. Cranberry sauce--You can choose whether you want actual whole cranberries in it or just go with the jellied stuff. I like the jellied type more. 6. Gravy--gotta smother stuffing, turkey and mashed potatoes with this. 7. Many people include a green bean vegetable in some manner. My mother (and now myself) makes a great green bean/bacon combo.
Cooking with Delphi by Scott Wehrly
Since I'm a talented Delphi programmer and a talented cook, I'm combining the two to show you how to cook a turkey dinner in Delphi:
Here are the global variables:
var Kitchen : TKitchen; StoveOven : TStoveOven; TurkeyStuffing : TStuffing; Turkey : TTurkey; SideDish1 : TSweetPotatoes; SideDish2 : TCranberrySauce; SideDish3 : TButterRolls; SideDish4 : TGreenVegatable; Dressing1 : TThickBrownGravy; Dressing2 : TMeltedButter; Dessert1 : TPumpkinPie; BottleOfMerlotInCupboard : TGoodWine; BottleOfWhiteZinfandel : TCaliforniaWine; Helper : THusband; Helper_Motivator : TPintOfGuinness; Cook : TWifeWhoWillKindlySlaveAwayForFourHoursOnThisMeal;
From the Message Boards
Delphi, Delphi.Net, C# eConvertError on StrtoDate won't recover
Quote from a poster: "We have this simple code that seemed to work fine for years. The behavior is that it works fine until someone enters a date that fails the conversion. Then no matter what the user enters StrToDate will fail and raise the EConvertError. The app will have to be restarted to recover."
--------------------------------------- function IsValidMDYDate(DateText: String): Boolean; var SaveState: String; begin SaveState:=ShortDateFormat;// user default is d/m/yyyy Result:=True;
try try ShortDateFormat:='mm/dd/yyyy'; StrToDate(DateText); except on EConvertError do Result:=False; end; finally ShortDateFormat:=SaveState; // restore ShortDateFormat end; end; ------------------------------------
"The ShortDateFormat presented to the users is d/m/yyyy. I have watched(flyover) the changing values of ShortDateFormat come in correctly, change correctly (for the database), then change back correctly. The string value from the user is what I expect too."
quote:
Originally posted by William Pantoja: The StrToDate function actually works well. However, the way you are using it presents some problems. In your situation, you should use it as below:
code:
function IsValidMDYDate(DateText: String): Boolean;
var
FormatStrings : TFormatStrings;
begin
FormatStrings.DateSeparator := '/';
FormatStrings.ShortDateFormat := 'd/m/yyyy';
FormatStrings.TwoDigitYearCenturyWindow := 50;
try
DateToStr(DateText,FormatStrings);
Result := True;
except
Result := False;
end;
end;
There are two advantages: 1. by explicitly specifying the format strings, we are using a thread-safe version of the function and 2. by not explicitly looking for EConvertError we will only succeed if the conversion succeeds.
I use a similar version of this function in Delphi 6 and 7 and have had no issues. | | | |
Microsoft Visual Basic
Visual Studio Users Group - Meeting Announcement by Brian Prestwood
December Meeting Tuesday, December 14, 2004 at 6:30 PM Title: Converting VB6 Clipboard Inheritance to VB7 True Inheritance Speaker: Brian Prestwood (www.prestwood.com)
Some VB6 software systems are made up of many copies of a relatively small set of templates. For example, a system might have a template for editing a single record. Each of the single record edit functions is based on a copy of the template. Of course each copy will have to be tailored for the object it represents. A Point of Sale system might have one copy for the customer, one for the invoice header, one for the invoice detail, etc.
VB6 template based designs are superior to non-template designs because developers need only understand the template to create and maintain all the edit dialogs. However, if there are many copies then propagating even a simple change to the template throughout the system can be time consuming. This is where inheritance shines.
In a way, software designs that use inheritance are like office floor plans. Each layer of an office floor plan contains a single type of object. One layer might have the cube walls, one might have the furniture that attaches to the cube walls, another might have the free standing furniture, etc. Print these layers out on foils, overlay them and you get the complete picture. The complete picture is what the compiler sees when it compiles source code that uses inheritance.
The process of converting clipboard inheritance to true inheritance involves identifying the code that is common to all the copies, in other words the template, and pushing it to the lowest layer. Large systems frequently include code that is common to a large subset of the copies. That stacks up on top of the lowest layer to form a subclass. Code that is specific to a single copy of the template goes in the top layer. The tricky part is when the layers have to interact.
Using MustInherit and MustOverride correctly is the key and the focus of this presentation.
Visit www.sacvsug.org for info.
Pre-Pay Developer Hours @ a Discount Pre-pay for developer hours at a discount. Our pre-paid rates are as low as $75 per hour! Our regular (not pre-paid) rate ranges from $110 to $116 per hour (depending on the agreement terms). NEW AND EXISTING clients can pre-pay for developer hours at a discount in our online store!
DotNet, VB, VB.Net, C#, Delphi, Paradox, Access, and ASP!
The Fine Print: To take advantage of this offer, you MUST use our online store to purchase pre-paid hours. The pre-paid hours apply to any work done on or after the date of purchase. Sorry, pre-paid hours do NOT apply to past work.
Open a Support Account Open a support account with us instantly online. If your business doesn't have a computer department or your computer department is over extended, Prestwood can help. Use your Prestwood support account for code audits, to get developer help, complete projects and for maintenance type work.
Wanted - Paradox 9 Power Prg Books! We still have a high demand for my book titled, "Paradox 9 Power Programming" by Mike Prestwood.
So we're still doing our book buy back. If you've got one sitting on your shelf, please consider selling it to us.
Visit Official Home Page
We'll pay you...
- $24 - New, never used
- $20 - Used, no marks
- $16 - Used, with marks, but very useable
|
|
You must pay for your own shipping to us, so your net profit within the U.S. will be around $15 to $20 (unless you have multiple copies).
Title: Corel Paradox 9 Power Programming Author: Michael A. Prestwood Publisher: Osborne/McGraw-Hill ISBN: 0-07-211936-5 EAN: 9780072119367 UPC: 783254030534
How to proceed Send your book to Attention Mike Prestwood, Prestwood Software, 7525 Auburn Blvd. #8, Citrus Heights, CA 95610. If we can sell the book as new, we'll send you a check for $24 (for each book). Otherwise, we'll send you a check for either $20 or $16 (depending on condition). |