I.T. Discussion Community!
-Collapse +Expand
mprestwood
Mike Prestwood
-Collapse +Expand Profile
Member Info
Member Narration

POSTS:
MB Posts (1410)
KB Posts (1805)
KB Comments (75)
Blog (4 Topics)

KBPOSTSBYTYPE:
Tech Articles
FAQ Page (118)
Tips Page◄╣
Definitions Page (96)
Code Snippets (506)
Errors Library (15)
Resource Links (73)
File Library (49)

Search mprestwood:

Advanced

   ► KBProfile: mprestwood  Print This    Tips Database  
Mike Prestwood

Mike Prestwood's Tips Page

68 Tips (knowledge gems).

These Tips are organized by our community groups then by our knowledge base sub-topics.

Group: C++


Topic: Classic C Language

1. Use ++ and --
In C and C++, it is better to only use unary operators for incrementing and decrementing variables because they produce fewer instructions and run faster.




Group: Pascal and Delphi Coding





Topic: Tool Basics

2. Insert GUID Into Source Code

To insert a GUID into code using the Delphi Editor, use Control + Shift + G.

['{BB45987C-0552-415F-A439-636A87E9F4E2}']

 

However, if you are using either the Visual Studio or Visual Basic key mapping emulation, use Control + Alt + G.






Topic: Language Details

3. Associative Arrays in Delphi/Object Pascal

Although Object Pascal doesn't have a native associative array, many developers just use a TStringList. Others have implemented a true associative array in Object Pascal. Search the Internet for TStringHash and THashedStringList classes for examples.






Group: Corel Paradox / ObjectPAL Coding





Topic: Paradox ODBC Drivers

4. To Use ODBC, Set Up a DSN

If you add an ODBC data source, you must define its DSN before you can connect to that database.






Topic: Paradox Tables

5. Deleting .Val files is sometimes okay and necessary.
Referential integrity and other settings stored in .VAL files sometimes interfere with the development of a project. This particularly is a problem when you are restructuring a child table in a referential integrity link. If this happens to you and you don't mind losing the validity checks for a table or for a set of tables, go ahead and delete or, better yet, rename them.

6. Equivalent Autoincrement Field Type
Autoincrement fields have the same type as a long integer. This is important to know when linking with detail tables.

7. Know Your Field Types!
If you are developing an application using local tables and you know you are eventually going to move the data onto a SQL server, then do yourself a favor and spend a few hours studying the field and table naming rules of your target SQL server before you create your first table. While creating your local tables, use a naming convention that uses common rules. If you use the naming rules in common between the two database types, then you will save yourself time when you move your data to the SQL server because SQL servers often have different naming rules from the naming rules in Paradox.

8. Table Lookups and Directory Paths (more than 8 characters)
Lookup tables for Paradox table level 5 or lower are limited to 8 characters. If you use lookup tables in other directories, upgrade all tables involved to the Paradox table level 7. You can do this with Table Repair or by defining a level 7 feature (for example, a descending index).




Topic: OPAL: Language Basics

9. Before You Code

Before you code in ObjectPAL, ask yourself two questions. Does Paradox already do this? Is there a better and easier way? Remember, simple solutions for simple problems.



10. Don't Leave Experiments In Your Code!

If, in experimentation, you use sleep(), doDefault, or DisableDefault to overcome some odd or misunderstood behavior, do not leave the commands in your code. If using the command didnt seem to make a difference, then take it out. Use commands only when they are called for. One great way to really learn the event model and the power of these and other commands is to experiment with adding them. Remember to take them out, however, if they do not do what you wanted.



11. Object.Method() Syntax

The syntax of object.method() is consistent throughout ObjectPAL. If an object with the name box has code on its mouseClick event, you can access that code with box.mouseClick() method from any other object. When this code executes, the UIObject method mouseClick() calls the mouseClick event.

How do you know when you can call the code in a built-in method of an object? Easy, if the run-time library has a method equivalent, then you can use itfor example, mouseClick() and pushButton().



12. ObjectPAL Level Beginner or Advanced?
Whether your ObjectPAL level is set to Beginner or Advanced, you can use all the ObjectPAL methods, procedures, properties, constants, keywords, and so on. The level panel is a help filter used just for learning purposes. However, because you could in effect "hide" code from yourself, I recommend setting this to Advanced (never use beginner).

13. Study The Experts

Paradox provides experts that generate code at the field level, in the form open, etc. It is a good idea to study the ObjectPAL generated by these experts.






Topic: Interactive Paradox: Getting Going

14. Disable Change Directory Warnings
You can disable the warning prompts that are displayed when you change working or private directories. Clear the check box for the Don't show warning prompts when changing directories option in the Preferences dialog (advanced tab). To do this, first display the Preferences dialog box by selecting Edit | Preferences. Then, select the Advanced tab and clear the check box for the Don't show warning prompts when changing directories option.




Topic: Interactive Paradox: Forms

15. Ctrl+Spacebar Displays Lookup Table
When users press CTRl-SPACEBAR to display a lookup table, remember to let them know that they can use CTRL-Q to locate a value. This is an interactive feature that can greatly enhance the user's perception of your application.

16. Design Your Apps to Look Like Windows
Design your forms using the default Windows color scheme. Your applications will look more professional and consistent with the predesigned Windows color schemes and various themes. I've seen WAY too many Paradox applications where the developer has used too many background colors on forms. Sometimes the use of a few nice colors for different areas of an application works well, most of the time it doesn't. I'm not saying don't add color, I'm just saying be tasteful. Some of the Paradox applications I've seen look HORRIBLE!

17. Objects On a Form Have Containership Hierarchy
You can alter the path of objects by moving objects around in the containership hierarchy. Move objects on the same level by selecting Format | Order | Bring to Front and Format | Order | Send to Back.

18. Paradox's Autofill Feature
Remember, autofill is a great feature that you should promote to your users. To automatically fill in a date field with today's date, for example, just press the SPACEBAR a couple of times. Make sure you add this type of help to any manuals or help files you develop for your application. Autofill works with Date, Time, Timestamp, and Logical fields and does not require a picture statement.

19. Rename Many Objects Quickly with the Object Tree
If you need to rename many objects one right after the other, use the Object Tree. By selecting and inspecting each object on the Object Tree, you can quickly rename many objects.

20. Study Apps and Build Great Forms!
The user interface is the first element of your application that a user sees. Because first impressions are important, the user interface carries more weight than any other part of your application. It deserves much planning and effort. Spend time just reviewing the applications on your computer. The more time you spend looking at various application user interfaces, the better your forms, reports, and applications will look.




Topic: OPAL: Language Details

21. Use Constants & Make Your Code Easier to Maintain
Two advantages of using constants are that they humanize your code and help make managing your code easier. They humanize your code by making your code easier to read. A constant named tax is easier to remember and understand than 8.125. Constants help you maintain your code by centralizing values. If the tax rate in your area changes from 8.125 to 8.5, you change the constant in one location.




Topic: Interactive Paradox: Using Data

22. Add Audit Fields
Add a field called ModifyTimeStamp to every table in your project and set its Default value to NOW. These types of audit fields can be very helpful in business situations and are critical in many. Other types of audit fields you can add to the end of tables include CreateTimeStamp and EmployeeID.

23. Use an Alias to Refer to Your Paradox Tables
Put your tables in a directory different from the one that contains the forms, reports, and libraries. Use an alias to refer to the tables. This makes your application instantly a network-compatible application by making the tables relocatable. When you install the application onsite, you simply have to ask where to put the data and where to put the application. The application can be local or on the network. Place the data files where they need to be, and change the alias path. If you eventually want to move your data onto a SQL server, then you will have less code to rewrite.




Topic: OPAL: Commands

24. Correct Event To Trap a Key Press
As long as a field has focus, key presses do not bubble because the key press is used up by the field. Therefore, the two best choices to trap for key presses are the form's prefilter or on the field itself.

25. Use a Dialog form with app.Hide()
If you wish to show ONLY your form and hide Paradox, use a dialog form and app.hide().

26. User ForceRefresh() to Update Calculated Fields
If you ever have a calculated field on a form not update when you think it should, then use forceRefresh() to make the calculated field display the correct values.




Topic: OPAL: Wicked Coding Tasks

27. Speed Up TCursors with setBatchOn()
You can speed up a TCursor in by using update(), setBatchOn(), or copyToArray(). If you use setBatchOn(), make sure to follow it with setBatchOff() every time you use it.




Topic: Runtime, PDE, Package-It!

28. Add ObjectPAL to a delivered form
You cannot directly add code to a delivered form. For example, methodSet does not work on delivered files. However, you can use executeString() to execute ObjectPAL code even on a delivered form.

29. Paradox Looks for Non-Delivered, Then Delivered

Whenever you open a form, report, library, or script using the open() method and do not specify a file extension, Paradox always looks first for the nondelivered .?SL file and then for the delivered .?DL file.






Group: Visual Basic Classic





Topic: Tool Basics

30. Mimic Short-Circuit Evalution in VB

Short-circuit evaluation is a feature of most languages where once an evaluation evaluates to False, the compiler evaluates the whole expression to False, exits and moves on to the next code execution line. In VB Classic, the if statement does not support short-circuit evaluation but you can mimic it. Use either an if..else if..else if statement or nested if statements. You will find that your code that makes use of this technique will be clearer and easier to maintain than the short-circuit equivalent and faster than ingnoring the issue.






Group: ASP Classic Coding





Topic: ASP Classic

31. ASP Constant Naming Convention
When naming constants, Microsoft suggests you prefix each constant with "con" as in conYourConstant. Although, they also say the older all caps with words separated by an underscore is still acceptable (i.e. YOUR_CONSTANT).




Topic: Language Basics

32. If Statement: No Short Circuit

Short-circuit evaluation is a feature of most languages where once an evaluation evaluates to False, the compiler evaluates the whole expression to False, exits and moves on to the next code execution line. The ASP Classic if statement does not support short-circuit evaluation but you can mimic it. Use either an if..else if..else if statement or nested if statements. ASP code that makes use of this technique is frequenlty clearer and easier to maintain than the short-circuit equivalent.






Topic: Language Details

33. ASP Application.Lock Method

Call Application.Lock to freeze ASP code while you set IIS application variables the Application.Unlock to unfreeze. No actions take place on the server while locked. 

Application.Lock

Application(YourAppVar) = AValue
Application.Unlock
 


34. Using Request.QueryString
Although you can use the generic request collection, as in Request("SomeValue"), for either Request.Form("SomeValue") or Request.QueryString("SomeValue"), it's best to avoid the generic request collection until it's really needed. Use a For Each loop to loop through elements.




Group: Website Design & Hosting





Topic: Artistic (design, layout, etc.)

35. Avoid
Avoid the usage of "Click Here" as a text link. You should make better use of the text.

36. Don't Use Size=1 or Font-Size=xx-small
Do not use the smallest standard font size of "1" and "xx-small" for any text you actually want a visitor to read. The smallest font size should be reserved for text you don't care if the visitor reads like the copyright notice at the bottom of the page.




Topic: Graphics

37. Resize Transparent Image, Increase Colors First

Before you resize a transparent GIF or PNG larger or smaller, make sure you first increase the number of colors to the maximum number of colors allowed. In essence, unleash the full power of your graphics program. After you resize your image, you will have to reapply transparency.






Topic: HTML Language Reference

38. Don't Make TD Tags Links
Although Internet Explorer supports putting an "a" link tag around a table TD cell, do not do it because other browsers don't support it.




Topic: Logos

39. Logos Should Use 1 Symbol Max

Each logo you create should have at most one symbol. You can mess with the text is "textual" ways such as font, color, and minor tweaks, but if you include a "symbol", you should include only one symbol.






Group: Coding & OO





Topic: General Coding Concepts

40. Branching: Frequent Conditions First

Most languages support a branching mechanism like if a..elseif b..elseif c. If a evaluates to true, b and c will not execute. The tip is to sort your branching conditions by most to lease used for faster code.



41. Round Floating Point Numbers

When comparing floating point numbers, make sure you round to an acceptable level of rounding for the type of application you are using.






Group: DBA, Databases, & Data





Topic: DBA & Data

42. Learn the Three Normal Forms in One Sentence
The three normal forms can be summed up in the following phrase: All the fields of a table should relate to the key, the whole key, and nothing but the key.

43. Naming Fields: Choose a Context Name
When naming fields/columns in a table, use ONE name for the data in the field. For example, although states are called provinces and other names in other coutries, use one or the other in the database but not both. Use CompanyState, avoid CompanyStateProvince. Use labels in your website or program to switch context.




Group: Windows Users





Topic: Windows Users

44. Find Driver Tip

If you know the correct driver is installed on your computer some place but don't remember where or know it's part of Windows, use the browse  for local driver option and specifiy a path of C:\ and check the include subfolders checkbox.

For example, in Vista, if there are no bluetooth devices on you computer when Vista is installed, the bluetooth stack isn't loaded. To load it, simply put your USB bluetooth dongle in an available USB port and use the tip above to load the Vista bluetooth driver.



45. Show Not Present Hidden Drivers in Device Manager

Right click on My Computer and select the Properties menu option then select the Advanced tab (in Vista, select the Advanced system settings then the Advanced tab). Click the Environment Variables button then the New button and add the following:

  • name = devmgr_show_nonpresent_devices
  • value = 1

Select Ok twice to close the Environment Variables dialog. In Device Manager on the Hardware tab, select View | Show Hidden Devices. Now both hidden devices and non-present devices will be listed. The non-present devices are grayed out.






Topic: Windows XP

46. Uninstall in Safe Mode

By default, you cannot uninstall programs in Safe Mode. Whatever issue you are handling, your first choice is to resolve it using more acceptable solutions such as using System Restore or MSConfig. For MSConfig, try disabling all startup programs then see if you can use Add/Remove Programs. If you wish to enable the Windows Installer Service while in Safe Mode, add the following registry entry:

HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\MSIServer\VE\TREG_SZ\F\D %Service%






Group: Computer Tech





Topic: DHCP

47. MS DHCP Preferred Over SOHO Devices

It is better to install a Microsoft DHCP server in your business network over the more limited DHCP servers provided by SOHO devices such as those found in wireless routers, firewalls, the Comcast router, etc. Installing a Microsoft DHCP server allows you to take advantage of more advanced features.






Topic: DNS

48. Fast, Free DNS Servers

The best free and fast DNS server service provider is OpenDNS. At least that's who we are currently using and recommending.

OpenDNS free dns server list:

  • 208.67.222.222
  • 208.67.220.220

If you wish to try others, search for free fast Public DNS Servers List.






Topic: Wireless Networking

49. Weak Wireless Signal

If you have a USB wireless device such as a wireless NIC, mouse controller, etc. that has a weak signal because of location, try adding a USB extension cable and placing the device in a more open location.

USB cables from stores such as Radio Shack, Best Buy, etc. are over priced 5 or 6 times what you can get on the internet.

For wireless network cards, you can also buy a range-extending antenna for the computer's WiFi card or router, or a wireless range extender.






Group: Testing, QA, QC





Topic: Beginner's Corner

50. Have someone else test your program!
If you are a single developer, try to find someone else to exercise your program. As the programmer, you have certain ideas of how a user will use your application. These ideas probably apply to about half the users.

51. Test Every Feature Three Times
Test each feature three times. Sometimes errors in logic dont show up until the second or even the third time through a sequence of events.




Topic: Testing Websites

52. Test Using Common Browsers
Test each website with various common browsers. As of early 2008, we test each website we build with Internet Explorer, FireFox, and Safari. Sometimes we also include Opera as part of our standard test suite. The minimum resolution we test for "regular" websites is 1024x768 (and higher). We no longer support 800x600.




Group: Computer Industry





Topic: Power User Info

53. Reset Your Notebook Battery

To extend the life of your battery, drain it completely and then charge it for 14 hours.






Group: Technical Writing





Topic: Grammar

54. a versus an

a
not any particular or certain one; a certain; another; one;

"He is a Delphi programmer."
 

an
the form of "a" before an initial vowel

"He is an ObjectPAL programmer."

 



55. Hung versus Hanged

Use "hung" for things and longer durations. Use "hanged" for people and shorter durations.

Examples:

"I hung a picture on the wall."

"He hung a deer on a tree for butchering."

"Felicia and Ashley hung out last night."

"Horse theives were hanged in the 19th century."

"The terrorist was hanged and his corpse was hung on the tree."



56. then versus than

then
adverb - at that time; adjective - being; noun - that time

"Create the database, then start the prototype."

than
in relation to; by comparison with

"Delphi 6 is a better product than Visual Basic 6."



57. who versus whom
"him" is for "whom" and "he" is for "who" Who is coding that requirement? (He is coding it.) To whom do we ask about this requirement? (We ask him.)




Topic: Spelling Pitfalls

58. "a lot" and "allot"

a lot, not alot
to a very great degree or extent

"John is a lot better programmer than Dave."
 

allot
to divide or distribute by share or portion

"I am going to allot you half the analysis."



59. Quit, Quiet, Quite
  • Quit: to stop, cease, or discontinue
  • Quiet: making no noise
  • Quite: completely, wholly, or entirely





Group: PM, Process, and PSDP





Topic: PSDP & Process

60. Have Client Sign Requirements
When youre finishing an application for a client, nothing is more frustrating than the client telling you that the application is all wrong. Do yourself a favor: During or shortly after the planning stage, be sure to echo to the client what you heard him or her say. Also consider putting your general plan in writing and have both you and your client sign it. This approach makes you a more professional consultant.




Topic: PSDP Artifacts

61. Apply PSDP Artifacts to Existing Applications
You can apply PSDP Artifacts to an existing system that has ongoing development and/or maintenance. For desktop applications, start with one PSDP Artifact per form and report. For websites, start with one PSDP Artifact per page. If you have a utility that imports and/or exports data, start with one PSDP Artifact per import/outport combination. Perhaps add each artifact as you go forward in your development.

62. Artifact Assignment
If you are a single developer, assign the artifact to that single developer and use it to track the completion of both the documentation of the artifact (requirement, design, and test script) as well as the building and testing of it. If you are part of a development team, assign the artifact to the resource gathering requirements and create additional tasks.

63. Use Artifacts to Manage Client Expectations
Use PSDP Artifacts to track and document what the client wants. Create one artifact per main requirement, expectation, and/or critical success factor. A nagging problem we always face is documenting what the client wants then design, build, and test it while maintaining a link back to the original requirement. PSDP Artifacts aid in your effort to make sure you fulfill each and every requirement. For doucmentation purposes, you can add as many additional requirement and design items as you wish. You can also add additional test scripts as needed.




Topic: PSDP Categories

64. Use Categories
Categories allow you to organize your project logically. For example, you may wish to organize your application by source code (All, Client, Server, Database, Installation, Help File, Other), by major features, or by some other criteria. These categories allow you to organize requirements, builds, test scripts, defects, etc.




Group: PrestwoodBoards





Topic: PrestwoodBoards

65. Rich Editor: Spell checking

Spell checking is available in our rich editor for IE and Gecko based browsers such as Firefox and Safari. We use our rich editor in many areas of our community such as message boards, knowledge base, job postings, resumes, etc. For IE, there is an icon on the editor's toolbar. For Gecko based browsers such as Firefox and Safari, browser enabled spell checking is active. Spell checking is not available for Google Chrome. Currently Chrome's spell checking is not compatible with IFrames so you have spell checking OUTSIDE our editor.



66. Website Menu Keyboard Shortcuts
You can use the Control key, arrow keys, and enter key to use our website main menu.




Group: American I.T. Workforce





Topic: American I.T. workforce

67. Employer Must Have an LCA
If you are on a H-1B Visa, and you are moving to a new work location in a different state, make sure your new employer has got an LCA for you, to work in the new location.




Group: Microsoft Access





Topic: Language Basics

68. Watch Your Access Evaluations!

Execute more common evaluations first! Short-circuit evaluation is a feature of most languages where once an evaluation evaluates to False, the compiler evaluates the whole expression to False, exits and moves on to the next code execution line. In Access VBA, the if statement does not support short-circuit evaluation but you can mimic it. Use either an if..else if..else if statement or nested if statements. You will find that your code that makes use of this technique will be clearer and easier to maintain than the short-circuit equivalent and will execute faster than ignoring this issue.



Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech