Posts

Getting started with Tesseract optical character recognition (OCR) library in Visual Studio

Image
This post is a how-to guide on how to get up and running with using the tesseract optical character recognition (OCR) library in a Microsoft Visual Studio environment. The original link can be found at the following github location: https://tesseract-ocr.github.io/tessdoc/Compiling.html#windows Step 1: Build the latest library (using Software Network client) Download and extract the latest SW (Software Network https://software-network.org/) client from the following location: https://software-network.org/client/sw-master-windows-client.zip Open a DOS command prompt and run the following commands: [code language="xml"] sw setup sw build org.sw.demo.google.tesseract.tesseract-master [/code] As shown in the following screenshot: Step 2: Install git if you have not already done so You will need git to download the libraries needed for this project. Download link for obtaining the git for Windows executables etc here: https://git-scm.com/download/win...

Google search engine cheat sheet

Image
Some tips and tricks for using the Google search engine effectively.  Instructions on how to make your internet searches more powerful by utilising various search techniques that Google provides. 1. Searching a single website only Prefix "site:" before the beginning of your chosen site plus any keywords you wish to add [code language="text"] site:technical-recipes.com google [/code] [caption id="attachment_9428" align="alignnone" width="763"] Google search engine cheat[/caption] 2. Excluding a website Add a minus sign right before the "site:" expression that represents the site you wish to exclude. For example, if you wish to search the term "GCHQ" while excluding results from the Guardian newspaper, just use: [code language="text"] gchq -site:theguardian.* [/code] 3. Including and excluding words Use the minus sign (-) to exclude search words; otherwise plus (+) or no sign to inc...

How to change the Wordpress database table prefix

Image
A simple guide, to explain how to change the Wordpress database table prefix of your WordPress installation from its 'wp_' into something else . It is recommended that you change this because all your login details are stored in this database, making it a popular target for hackers. Changing the prefix will make it harder for them to break in. Step 1: Change the table prefix in wp-config.php This is done via the CPanel > File Manager: In file manager, navigate to the root folder and identify the wp-config.php file. Right-click on and select edit or select Edit in the menu bar at the top of your screen. Locate the following entry: [code language="text"] $table_prefix = 'wp_'; [/code] Replace 'wp_' with something else; in this case, we replaced it with 'xyz_': [code language="text"] $table_prefix = 'xyz_'; [/code] Step 2: Change the table prefix in the database Open your database in PhpMyAdmin: Se...

Getting started with Chocolatey packages

Image
Simple example Taken from chocolatey.org documentation that shows you how to create a basic package to install Notepad++. Open a command prompt and navigate to a preferred location and enter 'choco new notepadplusplus' to create the package files etc: This will create the basic structure as shown: notepadplusplus.nuspec Edit the notepadplusplus.nuspec file as follows (modify the version number according to what Notepad++ version yuo are installing) [code lang="xml"] <?xml version="1.0" encoding="utf-8"?> <package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> <metadata> <id>notepadplusplus</id> <title>Notepad++ (Install)</title> <version>7.0</version> <authors>Don Ho</authors> <owners>my company</owners> <!-- also known as package mantainers --> <description>Notepad++ is a free (as ...

Using Regex to find and replace text in Notepad++

Image
A quick cheat sheet for using Notepad++ to find and replace text in Notepad++. In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set. [caption id="attachment_9278" align="alignnone" width="573"] Using Regex to find and replace text[/caption]

Using flex to layout items in css

Image
Some recipes for using flex to reliably align items in your html files. The collection of recipes can also be found as a collection my CodePen site . 1. Make a div box occupy available height, fixed footer HTML [code language="html"] <div class="outer"> <div class="inner_remaining"> I take up the remaining height </div> <div class="footer"> Fixed footer </div> </div> [/code] CSS [code language="css"] html, body { height: 100%; width: 100%; margin: 0; } .outer { display: flex; flex-flow: column; height: 100%; } .footer { height: 100px; background-color: grey; } .inner_remaining { background-color: #DDDDDD; flex-grow : 1; } [/code] 2. Fixed / sticky footer example HTML [code language="html"] <div class="box"> <h2>Fixed/Sticky Footer</h2> <p>The footer is placed at the bottom of the page.<...

Dragging shapes with the mouse in WPF / MVVM

Image
In a recent project I was interested in Dragging shapes with the mouse in a WPF / MVVM Visual Studio project. This post contains an example on how to drag a rectangle from from one canvas location to another using the WPF / MVVM architecture. This project uses Microsoft Visual Studio Community 2019. Step 1: Create a new WPF project: [caption id="attachment_9221" align="alignnone" width="900"] Dragging shapes with the mouse[/caption] Step 2: Add event-handling and event-raising infrastructure Just add the following classes to your project: EventArgs.cs [code language="csharp"] using System; namespace Canvas1 { public class EventArgs<T> : EventArgs { public EventArgs(T value) { Value = value; } public T Value { get; private set; } } } [/code] EventRaiser.cs [code language="csharp"] using System; namespace Canvas1 { public static class EventRaise...