Prestwood Code Snippet Database

Member-driven Prestwood Code Snippet Database. Your participation is requested!
Browse by category...
Each list is compiled from the cooresponding community group.
New CodeSnippets:
| |
KB Article |
|
Bryan Valencia
|
1. Easy SQL Server Backup Script
Learn how to make an easy SQL Server Script that will automatically back up all your databases in a simple way.
|
 Code |
 KB Post |
 162 Hits
|
 DBA, Databases, & Data
|
Ahmed.A
|
2. BDE Paradox Robust table openning
This is a rough draft version of a procedure that provides a robust way to open paradox tables in a delphi program
|
 Code
 2138 Hits
|
 Pascal and Delphi Coding
|
Mike Prestwood
|
3. PHP Constants (define)
In PHP, you declare constants using the define keyword: define("CONST_NAME", "Value");
Constants in PHP are case sensitive. A common standard in PHP is to use all-uppercase letters, with underscores to separate words within the name.
|
 Code
 2620 Hits
|
 PHP & Delphi for PHP
|
Mike Prestwood
|
4. Perl Constants (use constant)
In PHP, you declare constants using the define keyword: define("CONST_NAME", "Value");
Constants in PHP are case sensitive. A common standard in PHP is to use all-uppercase letters, with underscores to separate words within the name.
|
 Code
 3055 Hits
|
 Perl
|
Mike Prestwood
|
5. ASP Classic Yes/No Function
The following function demonstrates one technique for coding a Yes/No dropdown. It uses a for loop which can be expanded to handle more than the 3 states (Y, N, and blank).
Example of calling the function: Do you fish? <%=YesNoDropDown("ynFish", "")%>
|
 Code
 2313 Hits
|
 ASP Classic Coding
|
Bryan Valencia
|
6. Consuming an RSS feed in ASP.NET
Using this quickie code snippet, you can attach an ASP:Gridview to an external RSS Feed.
All you need to accomplish this is the URL of a usable feed.
|
 Code
 6418 Hits
|
 C# (Visual C# & VS.Net)
|
Mike Prestwood
|
7. Delphi Array (x=Array[0..3] of string;)
Delphi supports both static and dynamic arrays.
(1 Comments
, last by rdkram )
|
 Code |
 KB Post |
5808 Hits
|
 Pascal and Delphi Coding
|
Mike Prestwood
|
8. ObjectPAL Array (Array[] type)
Arrays in ObjectPAL use a 1-based indice. Use size() to get the number of elements. size() returns 0 if the array has no elements.
|
 Code |
 KB Post |
4855 Hits
|
 Corel Paradox / ObjectPAL Coding
|
Mike Prestwood
|
9. VB Classic Array (x = Array())
Arrays in VB Classic use a 0-based indice. UBound returns -1 if the array has no elements, 0 if it has 1, 1 if it has 2, etc.
|
 Code
3964 Hits
|
 Visual Basic Classic
|
Mike Prestwood
|
10. ASP Classic Array (x = Array())
Arrays in ASP Classic use a 0-based indice.
Use UBound to get the number of elements. UBound returns -1 if the array has no elements, 0 if it has 1, 1 if it has 2, etc.
39 months ago, and updated 27 months ago
|
 Code |
 KB Post |
4815 Hits
|
 ASP Classic Coding
|
Updated CodeSnippets:
| |
KB Article |
|
Mike Prestwood
|
1. ASP Classic Array (x = Array())
Arrays in ASP Classic use a 0-based indice.
Use UBound to get the number of elements. UBound returns -1 if the array has no elements, 0 if it has 1, 1 if it has 2, etc.
39 months ago, and updated 27 months ago
|
 Code |
 KB Post |
4815 Hits
|
 ASP Classic Coding
|
Mike Prestwood
|
2. Delphi Abstraction (abstract, override)
Delphi for Win32 supports abstract class members using the abstract keyword. You can even instantiate instances of a class that contains abstract members. Then you override each abstract member in a descendant class with Override. Delphi does not support setting an entire class as abstract. You can create an abstract class (a class with one or more abstract methods), but there is no way to tell the compiler to not allow the instantiation of the abstract class. Delphi does not support abstract member properties directly. To implement an abstract properity, make use of abstract methods. That is, you can read a GetPropertyX abstract function and write to a SetPropertyX abstract procedure. In effect, creating an abstract property.
56 months ago, and updated 29 months ago
(3 Comments
, last by Anonymous )
|
 Code |
 Article |
 5581 Hits
|
 Pascal and Delphi Coding
|
Mike Prestwood
|
3. ObjectPAL setTitle()
This code sets the title of your Paradox application in the application's title bar.
6 years ago, and updated 32 months ago
(1 Comments
)
|
 Code
 3870 Hits
|
 Corel Paradox / ObjectPAL Coding
|
Mike Prestwood
|
4. ASP Classic Empty String Check (Len(s&vbNullString))
In ASP Classic, you have to add an empty string to the value being compared in order to get consistent results. For example, add &"" to your string varilable or it's code equivalent &vbNullString. Then compare to an empty string or verify it's length to 0 with Len.
45 months ago, and updated 33 months ago
(3 Comments
, last by Anonymous )
|
 Code |
 Article |
10043 Hits
|
 ASP Classic Coding
|
Mike Prestwood
|
5. Perl Variables ($x = 0;)
Perl is a loosely typed language with only three types of variables: scalars, arrays, and hashes. Use $ for a scalar variable, @ for an array, or % for a hash (an associative array). The scalar variable type is used for anytype of simple data such as strings, integers, and numbers. In Perl, you identify and use a variable with a $ even within strings
55 months ago, and updated 35 months ago
|
 Code |
 KB Post |
 3287 Hits
|
 Perl
|
Mike Prestwood
|
6. Delphi Prism Member Property (property..read..write)
Like Delphi, Delphi Prism uses a special property keyword to both get and set the values of properties. The read and write keywords are used to get and set the value of the property directly or through an accessor method. For a read-only property, leave out the write portion of the declaration.
You can give properties any visibility you wish (private, protected, etc). It is common in Delphi and Delphi Prism to start member fields with "F" ("FName" in our example) and drop the "F" with properties that manage member fields ("Name" in our example).
54 months ago, and updated 35 months ago
(2 Comments
, last by mprestwood )
|
 Code
 3913 Hits
|
 Delphi Prism
|
Mike Prestwood
|
7. ASP Classic Edit Record (AddNew, Update, Delete)
In ASP, using ADO, you use RecordSet.AddNew to add a new record, Recordset.Update to post the record, and RecordSet.Delete to delete it. To edit a record, you open the RecordSet using an editable cursor.
|
 Code
 5861 Hits
|
 ASP Classic Coding
|
Mike Prestwood
|
8. Delphi Overriding (virtual, override)
In Delphi, you specify a virtual method with the virtual keyword in a parent class and replace it in a descendant class using the override keyword. Call Inherited in the descendant method to execute the code in the parent method.
51 months ago, and updated 39 months ago
(1 Comments
, last by Anonymous )
|
 Code |
 Article |
 6776 Hits
|
 Pascal and Delphi Coding
|
Mike Prestwood
|
9. ObjectPAL Variables (var x SmallInt endVar)
Declaring variables is optional unless you click Program | Compiler Warnings while in the ObjectPAL editor for every form, script, and library you create. Using Compiler Warnings is strongly recommended to avoid incorrectly typing an existing variable and to avoid any confusion about variable scope. Also recommended is turning on Compile with Debug for every form, script, and library too for tighter, cleaner code.
Undeclared variables are AnyType variables. Common data types include Currency, Date, Datetime, Logical, LongInt, Number, SmallInt, String, and Time.
Declare local variables within a method. If you want a local static variable (retains it's value because it is not destroyed), declare the varialbes above the method. Variables declared in an object's Var window are visible to all methods attached to that object, and objects that it contains.
55 months ago, and updated 39 months ago
(1 Comments
, last by marianchovan )
|
 Code
3975 Hits
|
 Corel Paradox / ObjectPAL Coding
|
Mike Prestwood
|
10. Delphi Class Helpers (class helper for)
Delphi allows you to extend an existing class without using inheritance. Buggy in 2005 and not officially supported but stable and usable in 2006 and above. You declare a class helper similiar to how you declare a class but use the keywords class helper for.
- You can name a helper anything.
- Helpers have access only to public members of the class.
- You cannot create an object instance directly from a class helper.
- self refers to the class being helped.
52 months ago, and updated 39 months ago
|
 Code |
 Article |
7335 Hits
|
 Pascal and Delphi Coding
|
|
|