https://github.com/gcarreno/teststar
A directory of all my Object Pascal Test repositories
https://github.com/gcarreno/teststar
demo demos fpc free-pascal freepascal lazarus
Last synced: 7 months ago
JSON representation
A directory of all my Object Pascal Test repositories
- Host: GitHub
- URL: https://github.com/gcarreno/teststar
- Owner: gcarreno
- License: unlicense
- Created: 2023-09-14T16:32:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-15T22:00:53.000Z (over 1 year ago)
- Last Synced: 2024-09-15T23:58:59.387Z (over 1 year ago)
- Topics: demo, demos, fpc, free-pascal, freepascal, lazarus
- Language: PHP
- Homepage:
- Size: 47.9 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

I hope this will help someone with my captured knowledge on the below subjects.
## ✨ Test Application Demo
> [GitHub Repository](https://github.com/gcarreno/TestApplicationDemo)
A boiler plate on how to do Application config the "Lazarus Way (tm)".
It includes:
- Setting up what properties to save on `TForm.SessionProperties`
- `TINIPropStorage` for `TForm.SessionProperties` property storage
- `TFileExit` action with different shortcuts for Windows and Linux
- The use of `GetAppConfigFile()` to get the app's default file customised for Linux/Windows
- A way to have different short cuts for exit in Linux(CTRL+Q) and Windows(ALT+X)
## ✨ Test Download with Progress Bar
> [GitHub Repository](https://github.com/gcarreno/TestDownloadProgressBar)
Example of `fphttpclient` with a progress bar.
## ✨ Test GNU DB Manager
> [GitHub Repository](https://github.com/gcarreno/TestGNUDBM)
[](https://github.com/gcarreno/TestGNUDBM/actions)
[](https://github.com/gcarreno/TestGNUDBM/releases/latest)
[](https://github.com/gcarreno/TestGNUDBM/blob/master/LICENSE)
[](https://github.com/gcarreno/TestGNUDBM/releases/latest)
[](https://github.com/gcarreno/TestGNUDBM/releases)
A simple test using the `libgdbm` library.
### To do
- [ ] Report the error generated when `gdbm_netkey` gets the last key
- [ ] Compile `libgdbm` statically
## ✨ Test Google Translate
> [GitHub Repository](https://github.com/gcarreno/TestGoogleTranslate)
[](https://github.com/gcarreno/TestGoogleTranslate/actions)
[](https://github.com/gcarreno/TestGoogleTranslate/releases/latest)
[](https://github.com/gcarreno/TestGoogleTranslate/releases/latest)
[](https://github.com/gcarreno/TestGoogleTranslate/releases/latest)
[](https://github.com/gcarreno/TestGoogleTranslate/blob/master/LICENSE)
[](https://github.com/gcarreno/TestGoogleTranslate/releases/latest)
[](https://github.com/gcarreno/TestGoogleTranslate/releases)
Testing Google Translate with Lazarus/FPC.
## ✨ Test HTML Viewers
> [GitHub Repository](https://github.com/gcarreno/TestHTML)
[](https://github.com/gcarreno/TestHTML/releases/latest)
[](https://github.com/gcarreno/TestHTML/releases/latest)
[](https://github.com/gcarreno/TestHTML/blob/master/LICENSE)
Program to test HTML Viewers.
I'm using the latest version available on the GitHub repository of [Bernd Gabriel](https://github.com/BerndGabriel/HtmlViewer) and have it included in this repository.
But you can install the needed components from the Online Package Manager(OPM).
## ✨ Test Hook To OS Signals
> [GitHub Repository](https://github.com/gcarreno/TestHookToOSSignals)
[](https://github.com/gcarreno/TestHookToOSSignals/actions)
[](https://github.com/gcarreno/TestHookToOSSignals/releases/latest)
[](https://github.com/gcarreno/TestHookToOSSignals/releases/latest)
[](https://github.com/gcarreno/TestHookToOSSignals/releases/latest)
[](https://github.com/gcarreno/TestHookToOSSignals/blob/main/LICENSE)
[](https://github.com/gcarreno/TestHookToOSSignals/releases/latest)
[](https://github.com/gcarreno/TestHookToOSSignals/releases)
This is an example on how to hook to some of the Operating System's signal like `Interrupt` and/or `Kill`.
It's done in a `CLI` format, since it kinda only makes sense in said format.
## ✨ Test IP Scanner
> [GitHub Repository](https://github.com/gcarreno/TestIPScanner)
[](https://github.com/gcarreno/TestIPScanner/actions)
[](https://github.com/gcarreno/TestIPScanner/releases/latest)
[](https://github.com/gcarreno/TestIPScanner/releases/latest)
[](https://github.com/gcarreno/TestIPScanner/releases/latest)
[](https://github.com/gcarreno/TestIPScanner/blob/master/LICENSE)
[](https://github.com/gcarreno/TestIPScanner/releases/latest)
[](https://github.com/gcarreno/TestIPScanner/releases)
An attempt to do a graphical application to scan a range of IPs and some other tools.
This entry on the [Test 🌟](https://github.com/gcarreno/TestStar) list is inspired by this repository: [IPAvailabilityScanner](https://github.com/vrwallace/IPAvailabilityScanner).
It implements:
1. Retrieving the machine's Public IP address from one of these providers:
- http://ifconfig.me
- http://ifconfig.co
- http://ipecho.net/plain
- http://checkip.amazonaws.com
2. Performing an IP scan on a range of IPs ( Not Implemented yet ).
3. Performing a Ping ( Not Implemented yet ).
4. Performing a Trace Route ( Not Implemented yet ).
This application is also using the Property Storage on an `INI` file. It stores the size of the Window and some values like the last selected tab and the last inputs on several edits.
### Important Details
#### Linux
In order to perform a Ping the packet needs to be in raw mode. This implies it needs super user permissions.
If you want Ping and TraceRoute to work you must run the program with `sudo`:
```console
$ sudo bin/TestIPScanner
```
#### Windows
This has been tested under Windows 11 and it is working on both non and "Run as User".
Many thanks to [ikel](https://github.com/ikelaiah) for doing the tests.
#### macOS
I'm unable to test under macOS so I'll need some help here.
### Known bugs
- The IP Edit component needs to be focused in order to refresh internal fields right after starting up the application.
For some reason, when the `TINIPropStorage` fills in the `TIPEdit.Text` property, the component does not refresh the internal fields.
## ✨ Test Lazarus Logging
> [GitHub Repository](https://github.com/gcarreno/TestLazarusLogging)
Repository to test and learn how to use the many logging choices in Lazarus
### List of options
Tested:
- LazLogger: https://wiki.freepascal.org/LazLogger (Comes with Lazarus)
- TEventLogger: https://wiki.lazarus.freepascal.org/TEventLog (Comes with `fcl-base` package)
Work in Progress:
- MultiLog: https://wiki.freepascal.org/MultiLog (OPM)
- GitHub: https://github.com/blikblum/multilog
Next:
- QuickLogger: https://github.com/exilon/QuickLogger
- Depends on QuickLib: https://github.com/exilon/QuickLib
Maybe:
- ExceptionLogger: https://github.com/r3code/lazarus-exception-logger (OPM)
- Log4Delphi: https://wiki.freepascal.org/Log4Delphi
- Author: http://log4delphi.sourceforge.net/index.html
- Port for `FPC`: http://sourceforge.net/projects/lazarus-ccr/files/Log4Delphi
- Log4L: https://github.com/CynicRus/Log4L
- Renegade Logger: https://github.com/hiraethbbs/Renegade.Logger
- ooLog: https://github.com/VencejoSoftware/ooLog
- datalogger: https://github.com/dliocode/datalogger
### LazLogger
pros:
- Part of the FCL
- Command line params
- User defined log groups
cons:
- Does not have multiple log providers
For more information on this option: [LazLogger README](LazLogger/README.md)
### TEventLog
pros:
- Part of the LCL
- Windows: Uses the system log
cons:
- Does not have multiple log providers
todo:
- Linux: Need to see if there is some difference geared towards a Linux system log
For more information on this option: [TEventLog README](TEventLog/README.md)
## ✨ Test Linux Distribution Information
> [GitHub Repository](https://github.com/gcarreno/TestLinuxDistInfo)
[](https://github.com/gcarreno/TestLinuxDistInfo/actions)
[](https://github.com/gcarreno/TestLinuxDistInfo/releases/latest)
[](https://github.com/gcarreno/TestLinuxDistInfo/blob/master/LICENSE)
[](https://github.com/gcarreno/TestLinuxDistInfo/releases/latest)
[](https://github.com/gcarreno/TestLinuxDistInfo/releases)
Searches for the various methods to obtain information about the current installed distro.
Presents the options found and allows to query each one individually.
### Screenshot

## ✨ Test Markdown
> [GitHub Repository](https://github.com/gcarreno/TestMarkdown)
[](https://github.com/gcarreno/TestMarkdown/actions)
[](https://github.com/gcarreno/TestMarkdown/releases/latest)
[](https://github.com/gcarreno/TestMarkdown/releases/latest)
[](https://github.com/gcarreno/TestMarkdown/blob/master/LICENSE)
[](https://github.com/gcarreno/TestMarkdown/releases/latest)
[](https://github.com/gcarreno/TestMarkdown/releases)
Program to test 2 Markdown libraries:
- [pasHTMLdown](https://github.com/BeRo1985/pashtmldown)
- [delphi-markdown](https://github.com/grahamegrieve/delphi-markdown)
## ✨ Test Memory Dataset
> [GitHub Repository](https://github.com/gcarreno/TestMemoryDataset)
[](https://github.com/gcarreno/TestMemoryDataset/actions)
[](https://github.com/gcarreno/TestMemoryDataset/releases/latest)
[](https://github.com/gcarreno/TestMemoryDataset/releases/latest)
[](https://github.com/gcarreno/TestMemoryDataset/releases/latest)
[](https://github.com/gcarreno/TestMemoryDataset/blob/main/LICENSE)
[](https://github.com/gcarreno/TestMemoryDataset/releases/latest)
[](https://github.com/gcarreno/TestMemoryDataset/releases)
An application to demonstrate how to use `TMemDataset`.
This particular component does not have a feature to sort the data.
It does, however, have a feature to filter the data.
## ✨ Test Peer-to-Peer
> [GitHub Repository](https://github.com/gcarreno/TestPeer-to-Peer)
> **Disclaimer**
>
> In the spirit of full disclosure and due to my utter laziness in coming up with the bulk of the boilerplate code, I turned to `ChatGPT`.\
> You can see the series of prompts and answers I've got in the [research](research) folder.
This is an attempt at a very basic peer class that can participate on a Peer-to-Peer( `P2P` ) network.
It will not have peer discovery via `UDP` broadcast, nor will it have any `DHT` features.
Just a simple message exchange protocol in a `P2P` context.
### Todo
- The `TPeer` class, at the moment, does not need to be a thread
- Hook up event for data received from connection thread to the internal peer method
- Add a property to allow hooking to data received from outside of the peer
- Hook up event for connection removal from connection thread to peer
- Understand if a connection needs to be disconnected when being removed
- Implement command line switch `--connect-to`
- Ponder having a Ping/Pong immediately before a connection is about to timeout
## ✨ Test QR Code
> [GitHub Repository](https://github.com/gcarreno/TestQRCode)
Program to test two Lazarus QR Code generation libs, available on OPM:
* LazBarcodes
* QRCodeGenLib
## ✨ Test Random Generation
> [GitHub Repository](https://github.com/gcarreno/TestRandomGeneration)
[](https://github.com/gcarreno/TestRandomGeneration/actions)
[](https://github.com/gcarreno/TestRandomGeneration/releases/latest)
[](https://github.com/gcarreno/TestRandomGeneration/releases/latest)
[](https://github.com/gcarreno/TestRandomGeneration/releases/latest)
[](https://github.com/gcarreno/TestRandomGeneration/blob/master/LICENSE)
[](https://github.com/gcarreno/TestRandomGeneration/releases/latest)
[](https://github.com/gcarreno/TestRandomGeneration/releases)
The objective of this repository is to have a personal copy of the Random Generation functions from Prof. Marsaglia.
The code is taken from Thaddy de Koning's entry on the [Free Pascal Wiki](https://wiki.freepascal.org/Marsaglia%27s_pseudo_random_number_generators).
I'm using an MIT License for the time being. Need to have a talk with Thaddy to sort that out.
## ✨ Test Read Firefox Cookies
> [GitHub Repository](https://github.com/gcarreno/TestReadFirefoxCookies)
[](https://github.com/gcarreno/TestReadFirefoxCookies/actions)
[](https://github.com/gcarreno/TestReadFirefoxCookies/releases/latest)
[](https://github.com/gcarreno/TestReadFirefoxCookies/releases/latest)
[](https://github.com/gcarreno/TestReadFirefoxCookies/releases/latest)
[](https://github.com/gcarreno/TestReadFirefoxCookies/blob/main/LICENSE)
[](https://github.com/gcarreno/TestReadFirefoxCookies/releases/latest)
[](https://github.com/gcarreno/TestReadFirefoxCookies/releases)
This is an example on how to locate and read Firefox cookies `SQLite` database.
Thanks to [paweld](https://github.com/paweld), it can now read the cookies from all the Firefox profiles.
Also thanks to him, we now have a good example on how to better visualize some of the columns.
## ✨ Test Regular Expressions
> [GitHub Repository](https://github.com/gcarreno/TestRegularExpressions)
[](https://github.com/gcarreno/TestRegularExpressions/actions)
[](https://github.com/gcarreno/TestRegularExpressions/releases/latest)
[](https://github.com/gcarreno/TestRegularExpressions/releases/latest)
[](https://github.com/gcarreno/TestRegularExpressions/releases/latest)
[](https://github.com/gcarreno/TestRegularExpressions/blob/main/LICENSE)
[](https://github.com/gcarreno/TestRegularExpressions/releases/latest)
[](https://github.com/gcarreno/TestRegularExpressions/releases)
This is an example on how to use regular expressions.
For simplicity's sake, I'm only demonstrating the `Exec`/`ExecNext` functionality. There's more to it than just these two, like the `Substitute` and `Split` functionalities.
I've also decided to use the `RegExpr` package that is provided in the packages that come by default with Free Pascal's compiler installation.
You can have a better picture of other options in this entry of the Wiki: [Regular Expression Packages](https://wiki.freepascal.org/RegEx_packages)
You can find some documentation about `TRegExpr` here: [TRegExpr Class](https://regex.sorokin.engineer/tregexpr).
## ✨ Test Resource Loading
> [GitHub Repository](https://github.com/gcarreno/TestResourceLoading)
[](https://github.com/gcarreno/TestResourceLoading/actions)
[](https://github.com/gcarreno/TestResourceLoading/releases/latest)
[](https://github.com/gcarreno/TestResourceLoading/releases/latest)
[](https://github.com/gcarreno/TestResourceLoading/blob/master/LICENSE)
[](https://github.com/gcarreno/TestResourceLoading/releases/latest)
[](https://github.com/gcarreno/TestResourceLoading/releases)
A simple example on how to load a file from the binary resources onto a `TMemo`
## ✨ Test Restart Application
> [GitHub Repository](https://github.com/gcarreno/TestRestartApplication)
[](https://github.com/gcarreno/TestRestartApplication/actions)
[](https://github.com/gcarreno/TestRestartApplication/releases/latest)
[](https://github.com/gcarreno/TestRestartApplication/releases/latest)
[](https://github.com/gcarreno/TestRestartApplication/blob/master/LICENSE)
[](https://github.com/gcarreno/TestRestartApplication/releases/latest)
[](https://github.com/gcarreno/TestRestartApplication/releases)
Program to test a cross platform way of doing application restarting itself.
## ✨ Test RxMemoryData
> [GitHub Repository](https://github.com/gcarreno/TestRxMemoryData)
[](https://github.com/gcarreno/TestRXMemoryDataset/actions)
[](https://github.com/gcarreno/TestRXMemoryDataset/releases/latest)
[](https://github.com/gcarreno/TestRXMemoryDataset/releases/latest)
[](https://github.com/gcarreno/TestRXMemoryDataset/releases/latest)
[](https://github.com/gcarreno/TestRXMemoryDataset/blob/main/LICENSE)
[](https://github.com/gcarreno/TestRXMemoryDataset/releases/latest)
[](https://github.com/gcarreno/TestRXMemoryDataset/releases)
An application to demonstrate how to use `TRxMemoryData`.
This particular component does not have a feature to sort the data.
It does, however, have a feature to filter the data.
Also using the `TRxDBGrid` for the visualization of the data, since I'm already using the RX package.
## ✨ Test Thread Pool
> [GitHub Repository](https://github.com/gcarreno/TestThreadPool)
[](https://github.com/gcarreno/TestThreadPool/releases/latest)
[](https://github.com/gcarreno/TestThreadPool/releases/latest)
[](https://github.com/gcarreno/TestThreadPool/releases/latest)
[](https://github.com/gcarreno/TestThreadPool/blob/master/LICENSE)
[](https://github.com/gcarreno/TestThreadPool/releases/latest)
[](https://github.com/gcarreno/TestThreadPool/releases)
Example of how to use the Class `TThread` with a pool manager.
### Credits
Original Code: Andrew Thomas Brunner (http://www.aurawin.com)
Correcting Critical Section Lock: paweld (https://github.com/paweld)
## ✨ Test Threading
> [GitHub Repository](https://github.com/gcarreno/TestThreading)
[](https://github.com/gcarreno/TestThreading/actions)
[](https://github.com/gcarreno/TestThreading/releases/latest)
[](https://github.com/gcarreno/TestThreading/releases/latest)
[](https://github.com/gcarreno/TestThreading/releases/latest)
[](https://github.com/gcarreno/TestThreading/blob/master/LICENSE)
[](https://github.com/gcarreno/TestThreading/releases/latest)
[](https://github.com/gcarreno/TestThreading/releases)
Example of how to use the Class `TThread` and all of the threading tools available with Free Pascal.
### Single Thread, Single Instance
This exemplifies the most basic use of a thread.
It declares an event to hook into the main form.
This is a single shot use because we set the thread's `FreeOnTerminate` property to True.
### Single Thread, Many Instances
The example above isn't of much use if we just run a single instance.
In this example we create multiple instances of the same thread and we start them concurrently.
This is, **also**, a single shot use because we set the thread's `FreeOnTerminate` property to True.
