# 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. Good Luck.

### Learning algorithms and Regression Analysis

**Artificial Backpropagation Neural Network**

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.

**Genetic algorithm at work**

** Genetic algorithm demonstration**

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 shows 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 (“roulettewheel selection”).

** Simulated annealing (SA) demonstration: Traveling Salesman Problem**

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 **

**Linear regression and correlation (updated version)**

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**

**3D-Graphics Using Enhanced Metafile**

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**

This small program presents a continuously moving display of curves – useful for monitoring real time data. In the last of three versions the plot always adapts to the latest data point.

**Histogram example with copying to clipboard**

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 distributions. The histogram will be drawn with tic 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 **

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 tic 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**

**Rainbow**

**PieChart (improved) to metafile**

**Graphics “Kaleidoscope” for PBwin 6 & 7**

**Enhanced metafile graphics and trackbar demonstration program**

### Windows Dialog Boxes

**Font common dialog box demonstration with examples**

This program demonstrates the use of windows’ font common dialog and some examples of various text formats using a label (static) control.

**Color common dialog box with rainbow color examples**

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**

** Find and Replace Common Dialog Boxes Demonstration Program**

*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 and the replacement string.

### Math Expression Evaluator and Statistical Tests

**Spin control used for input for Chi-square test**

This programs calculates the Chi-square test for equality between two independent proportions. It includes calculation of the p-value, and the 95% confidence interval – both for the difference and the odds ratio.

**Math Expression Evaluator updated for PBWin10 **

**Improved math expression evaluator for PB Windows 7.0**

** Gafny Jacob’s math expression evaluator for Windows**

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 **

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**

**Simple virtual listview with row header for PBWin10**

** Very Simple Virtual Listview for PBWin10**

**Virtual listview with color and font specification for each subitem**

** Very simple virtual list-view with row header**

**Listview with movable vertical and horizontal splitter windows**

** Custom drawn virtual listview grid control with full selection capability**

**Virtual grid control based on header control**

**Header based virtual grid control with cell editing**

** Virtual ListView With Row Header**

**DDT Virtual Listview With Row Header, Fonts, Colors and Edit**

**Listview with checkboxes**

**Listview with checkboxes – Moving of checked items and custom drawing**

### Encryption and Decryption

**A simple alternative method of encryption and decryption using the RND function **

** Extremely simple encryption and decryption of a text string using the RND function**

### Control of Processes on Computer

**Stop and restart processes on your computer**

** Ensure that a given program has just one instance**

** Which Processes Are Running On My Computer?**

### Sudoku Code

**Small Sudoku entering routine**

** Fast Sudoku Solver – solves any solvable Sudoku puzzle**

** Simple Sudoku solving code**

### Sorting Code

**Fast Prioritized Index Sorting Demonstration Program**

**Simple and versatile prioritized index sorting**

**ShakerSort – sorting without exchange of equal data**

**Index sort using PowerBasic’s ARRAY SORT with TAGARRAY option**

**Array sort using an ANSI collate string for all characters**

**ARRAY SORT 2. Edit, save, and load your own unique “weights” COLLATE STRING**

** Array Sort 3. Index sort or “in-place” sort**

**Array Sort 4. Index Sorting using translation table. Load, display, sort, and save**

### Probability Distribution functions

**Inverse F-distribution function – best version**

** Two F-distribution functions**

** Student’s t-distribution**

**Inverse F-distribution using Newton-Raphson root finding**

** Inverse F-function**

** Accurate normal probability distribution**

** Chi-square distribution based on series expansion**

**Random values having a normal distribution with a specified Mean and Standard Deviation (SD)**

### Tab Control and Listbox

**Very simple Tab Control example with menu and controls on main dialog**

**Virtual multicolumn listbox to simulate a listview like “grid control”**

** Simple virtual single column listbox with row header**

** Virtual listbox with hidden listbox receiving keyboard input**

**Simple Listbox With Keybord Select For PBwin9.4 using DDT**

**Keyboard Select For List Box – “Narrow-Down” Selection**

### Miscellaneous

**Insert or delete columns and rows in two-dimensional arrays**

** Browse For Folder – with starting path**

**Some supplementary “parse-string” functions**

**Vector inner (dot) product and vector outer product using MAT**

**Multiplication of matrix by vector using MAT**

** National word-sorting according to locale setting using “lstrcmp” and “lstrcmpi”**

**Accurate time interval measurement**

** Preview, Print and Save As for embedded IE-control (Semen’s code)**

** Simple displaying and printing of text and graphics using IE-control**

** Varying Font Width Experiment**

**Proportional resizing maintaining integral line height (PB Win 6 & 7)**

**Decode special characters in email source code**

** Setting Fonts for Menu-Item Text Strings**

**MSGBOX for beginners (like me)**

**Inspect Any File Program for PB DLL 6.X**

**How to make program display independent of screen resolution (“resolution indepence”)**

** Transfer of dynamic string array between parent and child dialog**

** Set fixed font size independent of Windows’ system font size setting**

** Transfer of data between parent and child dialog**

**Adjusting for different Daylight Saving Time (DST) periods in USA and Europe**

**How to extract and display real time data from websites**