EC Codes in PowerBASIC Forum
Below are links to all the source codes in BASIC that I have submitted to the PowerBASIC Forum. There may be something of interest to you. All links have been updated to work with the new PowerBASIC Forum structure. You will find more than 140 different codes. Good Luck.
Learning algorithms and Regression Analysis
Artificial Backpropagation Neural Network (3 EC codes)
This program illustrates how a neural network can recognize patterns after having been trained by repeated exposure to such patterns. The neural network provided is very simple and mainly serves to illustrate the method. The program includes real-time graphics to illustrate the learning process. Training can also be performed slowly to illustrate the workings of the network. You may also pause training to look closer at the status at a given stage.
The genetic algorithm at work (1 code)
Genetic algorithm demonstration (2 codes)
These programs demonstrate genetic algorithms, which are inspired by the principles operating in evolution: random mutation and selection of the fittest individuals in the population. The programs use only these principles and show that randomness (cross-over, mutation) combined with selection can increase order in a system. The first program also applies elitism and selection proportional to fitness (“roulette wheel selection”).
Simulated annealing (SA) demonstration: Traveling Salesman Problem (2 codes)
Simulated annealing (SA) is a generic probabilistic meta-algorithm for the global optimization problem, namely locating a good approximation to the global optimum of a given function in a large search space. The program applies this method to the solution of the classic Traveling Salesman Problem.
Linear regression and correlation analysis – Updated for PBwin10 (1 code)
Linear regression and correlation (updated version) (1 code)
These programs find the best fitting line (i.e. the regression line Y=a+b*X) to the sample of two-dimensional points (X, Y) and calculate the correlation coefficient. The results of the calculation will be displayed in the textbox and the scatter plot with the regression line will be displayed in the graphic label control.
Graphics
3D-Graphics Demonstration Program (2 codes)
3D-Graphics Using Enhanced Metafile (1 code)
These programs illustrate the drawing of three-dimensional objects on the screen. They include routines for not displaying surfaces and edges, which cannot be seen from the eye or viewpoint position. The programs allow you to change the eye (viewpoint) position coordinates and the degree of perspective.
Continuously Moving Curve Display (3 codes)
This small program presents a continuously moving display of curves – useful for monitoring real-time data. In the last of the three versions, the plot always adapts to the latest data point.
Histogram example with copying to clipboard (2 codes)
This simple example illustrates the distribution of a continuous variable using a histogram. The program makes a random normal distribution and displays this distribution in a histogram. However, you may display other forms of distribution. The histogram will be drawn with tick marks and values on the axes as well as label texts. Via the clipboard, the histogram can be copied into a word document and edited there.
Enhanced metafile curve drawing example with copying to clipboard (3 codes)
This simple example illustrates drawing a function curve onto the screen. You can define any continuous function and the labels for the x- and y-axis. The diagram will be drawn with tick marks and values on the axes as well as the label text. Via the clipboard, the diagram can be copied into a word document and edited there.
Cryptic graphics message (2 codes)
Rainbow (1 code)
PieChart (improved) to metafile (2 codes)
Graphics “Kaleidoscope” for PBwin 6 & 7 (3 codes)
Enhanced metafile graphics and trackbar demonstration program (1 code)
Windows Dialog Boxes
Font common dialog box demonstration with examples (2 codes)
This program demonstrates the use of windows’ font common dialog and some examples of various text formats using a label (static) control.
A color common dialog box with rainbow color examples (2 codes)
This program demonstrates the use of Windows’ color common dialog and some examples of various color combinations using a label (static) control.
Find and Replace Common Dialog Boxes in Rich Edit Control (1 code)
Find and Replace Common Dialog Boxes Demonstration Program (3 codes)
Find displays a dialog box in which the user can type the string to find. Replace displays a dialog box in which the user can type the string to find the replacement string.
Math Expression Evaluator and Statistical Tests
Spin control used for input for Chi-square test (3 codes)
This program calculates the Chi-square test for equality between two independent proportions. It includes the calculation of the p-value, and the 95% confidence interval – both for the difference and the odds ratio.
Math Expression Evaluator updated for PBWin10 (1 code)
Improved math expression evaluator for PB Windows 7.0 (2 codes)
Gafny Jacob’s math expression evaluator for Windows (1 code)
These programs are various stages of an advanced math parser or interpreter with many functions and error checking. Using extended precision, 18 digits of precision are obtained. Factorials up to 1754! can be handled without overflow. A large number of constants and conversions are available, making this math evaluator an advanced scientific calculator. You can easily add your own functions, constants, and conversions to the source code.
Grid and Listview Controls
Grid control with adjustable column and row headers and many facilities (2 codes)
This is a custom-drawn grid control with no structural limits to the number of rows and columns. Only the available memory may impose a limit in this respect. Column width and row height can be adjusted. The grid is quite versatile and can be set up for display only, to show also a cell cursor, and to edit cells and headers. You can insert and delete cells, rows, and columns and sort the rows according to your defined criteria.
Very Simple Editable Listview (2 codes)
Simple virtual listview with row header for PBWin10 (1 code)
Very Simple Virtual Listview for PBWin10 (1 code)
Virtual listview with color and font specification for each subitem (2 codes)
Very simple virtual list-view with row header (1 code)
Listview with movable vertical and horizontal splitter windows (4 codes)
Custom-drawn virtual listview grid control with full selection capability (1 code)
Virtual grid control based on header control (1 code)
Header-based virtual grid control with cell editing (1 code)
Virtual ListView With Row Header (3 codes)
DDT Virtual Listview With Row Header, Fonts, Colors, and Edit (2 codes)
Listview with checkboxes (1 code)
Listview with checkboxes – Moving of checked items and custom drawing (2 codes)
Encryption and Decryption
A simple alternative method of encryption and decryption using the RND function (2 codes)
Extremely simple encryption and decryption of a text string using the RND function (1 code)
Control of Processes on Computer
Stop and restart processes on your computer (1 code)
Ensure that a given program has just one instance (2 codes)
Which Processes Are Running On My Computer? (1 code)
Sudoku Code
Small Sudoku entering routine (1 code)
Fast Sudoku Solver – solves any solvable Sudoku puzzle (1 code)
Simple Sudoku solving code (1 code)
Sorting Code
Fast Prioritized Index Sorting Demonstration Program (1 code)
Simple and versatile prioritized index sorting (1 code)
ShakerSort – sorting without exchange of equal data (2 codes)
Index sort using PowerBasic’s ARRAY SORT with TAGARRAY option (2 codes)
Array sort using an ANSI collate string for all characters (1 code)
ARRAY SORT 2. Edit, save, and load your own unique “weights” COLLATE STRING (2 codes)
Array Sort 3. Index sort or “in-place” sort (1 code)
Array Sort 4. Index Sorting using the translation table. Load, display, sort, and save (1 code)
Probability Distribution functions
Inverse F-distribution function – best version (1 code)
Two F-distribution functions (2 codes)
Student’s t-distribution (2 codes)
Inverse F-distribution using Newton-Raphson root finding (1 code)
Inverse F-function (2 codes)
Accurate normal probability distribution (1 code)
Chi-square distribution based on the series expansion (1 code)
Random values having a normal distribution with a specified Mean and Standard Deviation (SD) (2 codes)
Tab Control and Listbox
Very simple Tab Control example with menu and controls on the main dialog (3 codes)
Virtual multicolumn listbox to simulate a listview like “grid control” (2 codes)
Simple virtual single-column listbox with row header (2 codes)
Virtual listbox with hidden listbox receiving keyboard input (2 codes)
Simple Listbox With Keyboard Select For PBwin9.4 using DDT (1 code)
Keyboard Select For List Box – “Narrow-Down” Selection (1 code)
Miscellaneous
Insert or delete columns and rows in two-dimensional arrays (2 codes)
Browse For Folder – with starting path (1 code)
Some supplementary “parse-string” functions (1 code)
Vector inner (dot) product and vector outer product using MAT (1 code)
Multiplication of a matrix by a vector using MAT (1 code)
National word-sorting according to locale setting using “lstrcmp” and “lstrcmpi” (1 code)
Accurate time interval measurement (2 codes)
Preview, Print, and Save As for embedded IE-control (Semen’s code) (1 code)
Simple displaying and printing of text and graphics using IE control (4 codes)
Varying Font Width Experiment (2 codes)
Proportional resizing maintaining integral line height (PB Win 6 & 7) (2 codes)
Decode special characters in email source code (1 code)
Setting Fonts for Menu-Item Text Strings (2 codes)
MSGBOX for beginners (like me) (1 code)
Inspect Any File Program for PB DLL 6.X (2 codes)
How to make program display independent of screen resolution (“resolution independence”) (1 code)
Transfer of dynamic string array between parent and child dialog (3 EC codes)
Set fixed font size independent of Windows’ system font size setting (1 code)
Transfer of data between parent and child dialog (1 code)
Adjusting for different Daylight Saving Time (DST) periods in the USA and Europe (1 code)
How to extract and display real-time data from websites (1 code)