FixInsight for Rad Studio Delphi review

The FixInsight software tool assists Delphi developers in finding possible coding defects that can affect the released product and this can be caught during the development process.   You can review the warnings as well as coding conventions that are part of the release.  Baron Software highly recommends the product for Delphi developers, we found that it is quick to point out various things we did not think about as well as potential issues.  You can view the product at FixInsight.

The latest updated is available providing a few new rules and it was quick to install to allow work to continue.   The software is flexible for a few entries by simply opening FixInsight, right click on a option and you can modify what is allowed.

It is simple to understand and use, some future enhancements should be some sort of quick help on the window as well as the latest version number.   The online documentation is fine but to be able to open it within Rad Studio would be better.  Overall a highly recommended software tool for Delphi Developers.

 

FixInsight 2015.08 released!

What’s New

  • * Support for {$INCLUDE } directives
    * Support for search path
    * Introduced rule W524 (“Generic interface declared with a GUID”)
    * Introduced rule W526 (“Pointer to a nested method”)
    * Improved rules W504, W521
    * Improved parser
    * Minor fixes

FixInsight has a support website. Please feel free to post any feedback at http://fixinsight.userecho.com/

Android SQLite Essentials Book Review

SQLite Essentials

 

I recently had the pleasure of reading Android SQLite Essentials by Vikash Kumar Karn / Sunny Kumar Aditya. The book details about using SQLite with your android and some tips about accessing the database from multiple applets on your android device. The book is rather small about a little over 90 pages which I do not understand how Amazon comes up with 127 pages unless they are counting certain sections twice.  The chapters are simple concepts that anyone can understand and within an hour you can have a pretty good idea on what to expect as well as how to use SQLite.

The chapters are listed below, you can complete the book within an hour and get developing.   The source code is available from their web site and as always the publisher PACKT does a nice job putting the book together.

Chapter 1 – Enter SQLite provides the reader the ability of knowing what SQLite can do for your Android device as well as the simple steps on maintaining and overall usage.
Chapter 2 – Connecting the dots provides the reader with the simple mechanics of allowing the developer to write the necessary routines for the client to maintain their database. Simple Edit / Delete / Update / Insert instructions are discussed.
Chapter 3 – Sharing is caring discusses the important concept of content provider so that other applets on the device can retrieve the centralized data.
Chapter 4 – Thread carefully wraps up the book talking about loaders and something we tend to forget, security.

Overall the cost is low about $20 on Amazon, it is a simple quick read that provides an understanding about SQLite but is not in depth,  if you are looking for that I would suggest Using SQLite by Jay A. Kreibich which does go over the syntax and design using the SQLite database for your applications.  Still I do recommend that you give the book a try.

Stopping a Delphi application from having too many instances.

Every single developer wishes to have their client start up only a single instance of their application.   This reduces the amount of possible application issues if the code makes a database connection or does some sort of processing that takes away the machine resources.   The following code snippet will help Delphi programmers to keep the process count down to a single instance.  This was coded using Rad Studio XE8 Delphi and is used in many of my applications.

The code will be embedded in the project’s source because it has to occur prior to the application creating the main form.

Click on the menu Project / View Source or using the project manager, you can right click and upon getting the pop-up, you can select view source as well.

You will need for the most part the following uses prior to the forms you will be setting up in the project source file.


uses
Forms,
Windows,
Dialogs,
TlHelp32,
SysUtils,
System.UITypes, ..

The function CheckProcessCount will accept the application executable name so that it can locate the process (only if it is active ). Upon locating it the result will be set to one, otherwise a zero is returned.


function CheckProcessCount(const ExeName: String): Integer;
var
NextProcessLoop: BOOL;
FHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
FHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
NextProcessLoop := Process32First(FHandle, FProcessEntry32);
Result := 0;


while Integer(NextProcessLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeName)) or
(UpperCase(FProcessEntry32.szExeFile) =UpperCase(ExeName))) then Inc(Result);
NextProcessLoop := Process32Next(FHandle, FProcessEntry32);
end;
CloseHandle(FHandle);
end;

The application executable name is sent to the processcount and will return either a 0 (not found) or a 1 (found).
If the application is already running, an informational message is given to the user and then the application handle is acquired and the window is brought to the front.
If the application is not running then the application will initialize and start running.

{$R *.RES}
Var
Handle : hwnd;

begin

if CheckProcessCount(ExtractFileName(Application.ExeName)) > 1 then
begin
MessageDlg(‘Manage-It! Adminstration Application is already running!’, mtInformation, [mbOk], 0, mbOk);
Handle := FindWindow(nil, ‘Manage-It! Help Desk Suite Administrator’);
if Handle > 0 then
begin
SetForegroundWindow(Handle);
end;
end
else
begin
Application.Title := ‘Manage-It! Administrator’;
Application.CreateForm(TAdminForm, AdminForm);
Application.Run;
end;
end.

This sample code has been compiled using Rad Studio XE8 Delphi and it does work under Windows 7 Professional.   It is a Windows 32 bit application so please be aware of that.

Pretty simple but yet effective.