Wednesday, July 19, 2023

Part 2 of how to create Laravel project : Installing PHP on Windows

 Basic of programming : Tools needed to code in php programming language 

This is Part 2 of how to create Laravel project : Installing PHP on Windows


From WeeProgramming.com

WhatsApp : +60129537993

TikTok : https://www.tiktok.com/@weeprogramming

YouTube : https://www.youtube.com/@weeprogramming410

Instagram : https://www.instagram.com/weesoftwareprogramming/



Tags : 

#Basic, #programming, #Tools, #code #php #programminglanguage,

#Laravel, #project, #install,#php,#WeeProgramming.com





Part 1 of how to create Laravel project : Download PHP

Basic of programming : Tools needed to code in php programming language 

This is Part 1 of how to create Laravel project : Download PHP


1) Download PHP 8.2 from official site 

2) Select windows version


From WeeProgramming.com

WhatsApp : +60129537993

TikTok : https://www.tiktok.com/@weeprogramming

YouTube : https://www.youtube.com/@weeprogramming410

Instagram : https://www.instagram.com/weesoftwareprogramming/


Tags : 

#programming101, #tutorial, #programmingtutorial, #Basic, #programming, #Tools, #code #php #programminglanguage,#Laravel, #project, #download,#php,#official_site,#WeeProgramming.com





Saturday, September 5, 2015

Researching on OCR (Optical Character Recognition) library

Recently I got a project request to do an auto web form submission program that will submit auto submit data as follow :



I want to build a desktop program so that it's easier for the user to run and do the auto submission. I choose the Dot Net framework as the platform to work on.

As you can see from the above image, there is a captcha image generated every time this page is accessed. So naturally the solution is to go to OCR library. From my experience, Tesseract is one of the best solution out there. However, it will be difficult to use it directly as it is developed in C / C++ language.

So is there any convenient wrapper that provide a more direct usage of the library? The answer is yes, there are several of them. But I am not going to go through all of them, rather, just the one that I tested working, it's :
https://github.com/charlesw/tesseract/tree/release/2.4.0

The github project mentioned these :

1. Add the Tesseract NuGet Package by running Install-Package Tesseract from the Package Manager Console.
2. Ensure you have Visual Studio 2012 x86 & x64 runtimes installed (see note above).
3. Download language data files for tesseract 3.02 from tesseract-ocr and add them to your project, ensure 'Copy to output directory' is set to Always.
4. Check out the Samples solution ~/Samples/Tesseract.Samples.sln for a working example

Of course they are correct on the above instructions and I did all of them, and I really appreciate their contributions. I open the solution file in SharpDevelop 4.4 and tried on the Tesseract.ConsoleDemo project, which is a console program. Seems like there is "something" missing when I tried to build the console program, the reference to "Tesseract.dll" is missing !!

Why? I asked myself, there must be something I missed out. Well, indeed I missed out a big chunk, and I blamed myself for that, Tesseract is a C / C++ library, and I am stucked at the DotNet mode at that moment, I can't expect it to be cross platforms like DotNet or Java, C / C++ is platform dependent !! I have to compile my own dll, stupid me :D

Knowing what's missing is a major help, it's not difficult to find that the "build.bat" is right there at the beginning. So I launch my favourite command prompt gnuwin32 to start running the "build.bat" file. Then come another difficulty, it failed to compile with the following message, as you can see below :

Text Output 

Project "C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\build.proj" on node 1 (default targets).
PrepareBuild:
  Copying file from "C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\src\AssemblyVersionInfo.template.cs" to "C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\src\AssemblyVersionInfo.cs".
  copy /y "C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\src\AssemblyVersionInfo.template.cs" "C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\src\AssemblyVersionInfo.cs"
C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\build.proj(55,9): error MSB4062: The "MSBuild.ExtensionPack.FileSystem.File" task could not be loaded from the assembly C:\Projects\Temp\Http_Submit%28OCR%29\tesseract-release-2.4.0\tesseract-release-2.4.0\tools\MSBuild.ExtensionPack\MSBuild.ExtensionPack.dll. Could not load file or assembly 'file:///C:\Projects\Temp\Http_Submit%28OCR%29\tesseract-release-2.4.0\tesseract-release-2.4.0\tools\MSBuild.ExtensionPack\M
SBuild.ExtensionPack.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Done Building Project "C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\build.proj" (default targets) -- FAILED.


Build FAILED.

"C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\build.proj" (default target) (1) ->
(PrepareBuild target) ->
  C:\Projects\Temp\Http_Submit(OCR)\tesseract-release-2.4.0\tesseract-release-2.4.0\build.proj(55,9): error MSB4062: The "MSBuild.ExtensionPack.FileSystem.File" task could not be loaded from the assembly C:\Projects\Temp\Http_Submit%28OCR%29\tesseract-release-2.4.0\tesseract-release-2.4.0\tools\MSBuild.ExtensionPack\MSBuild.ExtensionPack.dll. Could not load file or assembly 'file:///C:\Projects\Temp\Http_Submit%28OCR%29\tesseract-release-2.4.0\tesseract-release-2.4.0\tools\MSBuild.ExtensionPack
\MSBuild.ExtensionPack.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

    0 Warning(s)
    1 Error(s)

Image Screenshot

I tried to find out the reason of failure, and failed countless times, and when it seems to be too big of a problem for me to be solve, then thanks to this person, I found the answer here, the parentheses escape problem, ahhh ... finally it make sense. Changing my project folder name from "Http_Submit(OCR)" to "Http_Submit_OCR" solved all compile error. Now it compile smoothly like below :


If you read until here and still reading, I bet you are either a programmer or you a lot of free time :) . So next step is the correct reference to the correct "Tesseract.dll".

After the configurations, this is my first attempt with the captcha orignal images (250 width X 30 height)



Not bad for first attempt, but there are still many errors in recognition.

Then in second attempt I added :

engine.SetVariable("tessedit_char_whitelist", "?.0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); 
and have the following results :



Yeah, have some improvements with the special characters eliminated. Finally to increase accuracy, I added code to enlarge the image to bigger size and have better results :


Better improvements, but there are still some errors, so there are still rooms for improvements, any suggestions for further improvements are most welcome :)


PS: I am running on Windows 7 when doing my research.

You can always contact me at via my website : www.weeprogramming.com

Monday, August 31, 2015

Recent experience on free upgrade to Windows 10

Recently, I applied the Windows free upgrade from Windows 7 to Windows 10.

Overall, the transition was smooth, I do not need to do anything during the upgrade process, just sit there and wait for the download and the installation run by itself, here is one of the screen shot I took during the upgrade.


After the upgrade, I faced the following issues :

1) Sound card is not working, driver shows it's working ok with no issue, but there is no sounds coming out of speaker, somehow it works again after I tried to download the Lenovo tools for the Windows 10 and/or play video with VideoLan. Not even sure how I solve it but the important thing is, it is working now.

2) Laptop freeze in the middle of usage, nothing responding, keyboard, mouse, even power button also not responding, but it get recovered automatically (it took quite a long time to do that , I suspect it is doing the hardisk index scan for corruption just like all previous Windows, only different is, now it is doing it all in the background) after the power off and power it on again.

Update on September 4, 2015
Windows 10 freezed again on while I am using Chrome to browse websites, same symtoms as previous experience, cannot respond to keyboard, power button, reset button and etc. Have to power off and turn it back on. After turn the power on, it display these 2 screens :




Laptop spec : Lenovo G470
RAM : Original is 2GB, upgraded to 6 GB
Processor : Intel Core i5-2410M 2.30GHz
64 bit

Checked on the Windows Event Logs, nothing suspecious, anyone have the same experience before? Want to share your opinions?

You can always contact me at via my website : www.weeprogramming.com



Saturday, August 29, 2015

Batu Cave Trip after Hua Yang AGM

I went to Hua Yang AGM on August 26, 2015. The AGM was kind of boring with only 1 person asking question, so I have plenty of time left on my allocated schedule, I decided to drive to the nearby tourist spot Batu Cave. Here are some photos :










Thursday, July 30, 2015

Introduction to software programming

Programming Tutorial Series 1
Introduction to software programming

Q) What is software programming?
A) In short , software programming is a process that turns human understandable programming language code / instructions into something that is understand by machine.

Q) What are the requirements to be a programmer ?
A) Short answer : Based on my personal experience, passion, patience, dedication and skills.
Long answer : Passion is the driving force for anyone to do anything, if you are passionate about something, you will certainly do your best.

One need to be patience in order to learn the programming skills, have to be patience to think about the programming flows, have to be patience to do debugging (a terms used to describe the process of finding errors in programming code), and also most importantly, be patience and do not attempt to bang your head against the desk when you cannot found the bugs you are looking for :)

Dedication is a must to complete anything, if you are dedicated, it's almost certain you will complete your jobs.

Skill is the last requirements because with passion, patient and dedication, you will almost certainly acquire the skills needed.