Posts

Entity Framework, Let's add some power to it

Image
  Wow Entity Framework is starting to pack Power So, what do I mean by that. It was released 15 years ago on the  11 of August 2008. Back then it was part of the . NET Framework 3.5 Service Pack 1   and you could use it with Visual Studio 2008 as long as you had service pack 1. To be honest, back then it wasn't very good. It was slow and a little painful. Jump forward 15 years... Jump forward 16 years and we now have Entity Framework Core 9. You can add it to you use it .Net 9 as a set of Nuget packages.  This short blog post isn't going to teach you how to use EF Core 9, or .Net 9 it is simply going to show you how to ramp up your retrieval of data. So, why is EF 9 Core so powerful? Say we have a service Method called CreateBankCustomer that accept a complex object that includes BankCustomer and a list of BankBankAccounts? You can create all the table entries in one fail swoop.... using (var context = new BankingContext()) {     var customer = new BankCust...

Extracting Text from a Screenshot Using Tesseract

Image
Tesseract -  https://github.com/charlesw/tesseract  is an open source OCR engine written for .Net. I have been using it for several months to extract text from screenshots I have taken from an app I use for my gig work. This has allowed me to easily create orders in my database and also add tips to the orders. Anyway, this blog is about how to use Tesseract, not how I've used it. So let's get started. Firstly Tesseract isn't the only OCR Engine. I like it because it is open source and works fairly well. Probably the best known is Iron OCR -  https://ironsoftware.com/csharp/ocr . IronOCR requires a  https://ironsoftware.com/csharp/ocr/licensing/ . For enterprise applications with a decent budget I would recomment Iron OCR, but for small projects where you don't have the budget you should be OK using Tesseract. So, let's dive right in. I am going to demonstrate this using a .Net 9 Console App, in Visual Studio. Once you have you console app you need to include some Nu...

I am Me, no excuses, just Me

Image
It all started many years ago when at the age of 10 a neighbor gave me a book on computer programming. I read it and was hooked. I asked him how I could do it and he gave me a stack of punch cards and a punch and told me to go at it, so I did. Back then there were no personal computers, so I had to send my program to IBM to run it. They did and 2 weeks later I got the results, syntax error on card 28. That was when I learnt my first lesson, check your code!!! I was hooked. That was over 40 years ago. I never planned to make computer programming my job, it was my hobby. This was the 70s, I was a warden at a sports complex, ran a mobile disco and played field hockey. All the time I carried on learning to program. By the early 80s small personal computers came out and I got a Sinclair Spectrum. It saved programs and executables to cassette tape and I had 8K of memory. I wrote text-based adventure games which I shared with my friends. This was all good until one of my friend's sister ...

When Greed and Deception Destroy a Company

Image
  Have you ever worked for a company where you thought it was too true to be true? Did they give you free snacks, great coffee, lunch every now and then, send employees on trips? All under the disguise of caring. Then you see the signs that it is actually more about making money. They are unhappy when you would rather take a day off then charge the client for a day when you do no work. They complain if you work in the evening because the code you needed to test wasn't available until then. They get you to secretly test the client's site just because their developers didn't like having to use the client's components. They add more people to the project because they have hours left to use up. All while pushing the harder work down the road.  My question is when did companies become so unethical? They promise the world to their clients then deliver things that are just good enough. I am a very ethical person. I always have been. I believe in doing the work necessary to get...

Let's Geocode with Here.com

Image
 Welcome to the World of Geocodes Have you ever wanted to see if an address is real and if it is get the geocode for it? Geocode, what is that? Ok, let's start with defining what a geocode is and what it can be used for. The location of everything on Earth can be defined as a set of latitude and longitude (a sort of set of coordinates). So, a geocode is simply this set of latitude and longitude that represents a geographic entity. Now that we know this, what is it used for. Simple, if you want to store a location on a Google map, it is easiest to store the geocode for it. If you have the geocode you can use it to add a marker to the map or even center the map. Another use is when you have several geocodes, you can build a fence on a map and then check the fence to see if a point is within the boundary of the fence, but that is for another post on another day, today we simply want to get the geocode for an address.  In this post I am going to take you through an example of how ...

Templates Come in many Shapes and Sizes

Image
.Net Maui provides a set of templates to make your life easier. So, what is a template and why are they important? A template is a reusable piece of code. This is the very basic definition of a template. Really they are pieces of code that are reusable and therefore make your life easier because they contain code that is used again and again. They come in all shapes and sizes. Complex ones can be bound to data models, simple ones are self contained. Controls are really just another form of templates. In this post we will build a basic simple template.  Introduction to the Header Template So, in my app I want a common header to each page. It should have a logo, a background and have the ability to accept and display a title. The Code..... Let's start with the xaml, the UI part of the template It defines a grid that has 3 rows and 4 columns. The logo takes up all three rows and sits in the first column. An interesting thing here is that he background fills the whole of the grid. The ...

Welcome to the Wonderful Wacky World of .Net Maui

Image
What, where, how and why What springs to mind when you hear the word Maui? Palm trees and cocktails being enjoyed on amazing beeches in Hawaii? Well, that sounds like so much fun. Still hopefully .Net Maui is just as much fun. What is is is a cross-platform programming language that leverages existing skills like C# to easily build powerful apps. Currently it is not live but it is supported by Microsoft. What this means is that by the time it goes live things may change a little. With that said, you can feel comfortable using it in a production environment today!!!! What does MAUI stand for /Well, like all good acronyms .Net Maui has a real name.... .Net M ulti-platform A pp UI  .Of course, .Net Maui sounds so much cooler. I have to admit, every time I say it in my head I see palm trees swaying to calypso music in my head. To me, what  it stand for is an amazingly easy entry into the world of app development. After all I have been writing C# programs for 20+ years and have bee...