301

(8 replies, posted in General)

Hi Dmitry,


It's nice to see the addition of rtf component to MVD.

I was playing with it.

I wanted to use the following script for displaying rtf data on other forms:

form1.RichEdit1.text := sqlexecute('select rrrtttfff from employees where id =' + inttostr(form1.TableGrid1.dbitemid));

I think type is not .text or it needs different script. Any suggestion please?

302

(2 replies, posted in General)

Hi Pozidis,


Thank you very much .............
Truly appreciated .............................

303

(2 replies, posted in General)

I'm using same dictionary field on multiple instances.
Saving and editing seems to be OK, but I cannot get combobox values displayed via SQL on Form1?


Could somebody help please..............


Please see the attached sample project:

304

(13 replies, posted in General)

AD1408 wrote:

...
However, currently I get followings:


passwords           Strength
---------------------------------------
0123456789         = Medium
01234567891       = Strong
01234567891012 = Very Strong


aabbccddee       = Medium
aabbccddeeffg   = Strong
aabbccddeeffgg = Very Strong

...
Medium strength password should at least contains; numbers and characters or numbers and symbols or characters and symbols with at least one upper or lower case.


Strong strength password should at least contains; numbers, characters and symbols with at least one upper or lower case.


Very Strong strength password should at least contains; numbers, characters and symbols with at least two upper or lower case.


AD1408 wrote:

Could anybody help with the above (my previous post #7) please?


Script is in Derek's post#6 ( PSM 2b.zip)



Hi Dmitry,


It seems nobody else around or can help.
Could you please help?


If you could just do the;
Very Strong strength password should at least contains; numbers, characters and symbols with at least two upper or lower case.
then I'll try to apply it strong and medium.


Here is the full script:

function StrengthMeter(sPassword: string): string;
var
LowerCase, UpperCase, Numbers, Symbols, Repeating, Pattern: boolean;
iLength, i: integer;

begin
LowerCase := False;
UpperCase := False;
Numbers   := False;
Symbols   := False;
Repeating := False;
Pattern   := False;

iLength := Length(sPassword);

for i := 1 to iLength do     // looks for the same character being repeated more than twice
   if ((ord(sPassword[i])) = (ord(sPassword[i+1]))) and ((ord(sPassword[i])) = (ord(sPassword[i+2]))) then Repeating := true;

for i := 1 to iLength do     // looks for a 2 digit recurring pattern (ie 121212 or ababab etc)
   if ((ord(sPassword[i])) = (ord(sPassword[i+2]))) and ((ord(sPassword[i+1])) = (ord(sPassword[i+3]))) then Pattern := true;

for i := 1 to iLength do
   if (ord(sPassword[i]) >= 97) and (ord(sPassword[i]) <= 122) then LowerCase := True;

for i := 1 to iLength do
   if (ord(sPassword[i]) >= 65) and (ord(sPassword[i]) <= 90) then UpperCase := True;

for i := 1 to iLength do
   if (ord(sPassword[i]) >= 48) and (ord(sPassword[i]) <= 57) then Numbers := True;

for i := 1 to iLength do
   if not((ord(sPassword[i]) >= 97) and (ord(sPassword[i]) <= 122)) and
      not((ord(sPassword[i]) >= 65) and (ord(sPassword[i]) <= 90)) and
      not((ord(sPassword[i]) >= 48) and (ord(sPassword[i]) <= 57)) then Symbols := True;

   if iLength <= 4 then result := 'Very weak';
   if (iLength >=5) and (iLength <=6) then
      begin
      if LowerCase and UpperCase and Numbers and Symbols then result := 'Medium'
      else if LowerCase and UpperCase and Numbers then result := 'Weak'
      else if LowerCase and UpperCase then result := 'Weak'
      else result := 'Very weak';
      if Repeating or Pattern then result := 'Very weak';
      end;

   if (iLength >=7) and (iLength <=8) then
      begin
      if LowerCase and UpperCase and Numbers and Symbols then result := 'Strong'
      else if LowerCase and UpperCase and Numbers then result := 'Medium'
      else if LowerCase and UpperCase then result := 'Weak'
      else result := 'Weak';
      if Repeating or Pattern then result := 'Weak';
      end;

    if (iLength >=9) and (iLength <=10) then
       begin
       if LowerCase and UpperCase and Numbers and Symbols then result := 'Very Strong'
       else if LowerCase and UpperCase and Numbers then result := 'Strong'
       else if LowerCase and UpperCase then result := 'Medium'
       else result := 'Medium';
       if Repeating or Pattern then result := 'Weak';
       end;

    if (iLength >=11) and (iLength <=13) then
       begin
       if LowerCase and UpperCase and Numbers and Symbols then result := 'Very Strong'
       else if LowerCase and UpperCase and Numbers then result := 'Very Strong'
       else if LowerCase and UpperCase then result := 'Strong'
       else result := 'Strong';
       if Repeating or Pattern then result := 'Weak';
       end;

    if (iLength >=14) then
       begin
       if Repeating or Pattern then result := 'Medium'
       else result := 'Very Strong';
       end;
 end;



procedure Form1_Edit1_OnChange (Sender: string; vdup: string);
begin
Form1.Label1.Caption := StrengthMeter(Form1.Edit1.Text);

//Clearing strengt panel when password field is empty
if not (Form1.Edit1.text = '') then
   begin
   Form1.pnStrength.Visible := true;
   end else
   begin
   Form1.pnStrength.Visible := false;
   end;

// Coloring the strengt panel according the strength label text
if Form1.Label1.Caption = 'Very weak' then
   begin
   Form1.pnStrength.Color := clRed; // Very weak
   end;

if Form1.Label1.Caption = 'Weak' then
   begin
   Form1.pnStrength.Color := $0000009F; // Weak
   end;

if Form1.Label1.Caption = 'Medium' then
   begin
   Form1.pnStrength.Color := $000074DD; // Medium
   end;

if Form1.Label1.Caption = 'Strong' then
   begin
   Form1.pnStrength.Color := $00C08000; // Strong
   end;

if Form1.Label1.Caption = 'Very Strong' then
   begin
   Form1.pnStrength.Color := $0000A800; // Very Strong
   end;
end;


begin

end. 

Dmitry,
anything?

305

(13 replies, posted in General)

Hi domebil,


Thank you very much for the password generator example......
I already have a good password generator coded by EHW.
I'm trying to get a script that measures entered password strength properly. Your example same as what's posted here inrespect of password strength measurement.

It still says very strong for just typing numbers without any other type of characters. i.e. 12345678908754098654321235678899654 is classified as very strong which is not. Counting length is needed but it's not enough.


For me password classified as very strong should contains at least; 2 different uppercase, 2 different lowercase characters, 2 different numbers and 2 different symbols. If these are missing then it shouldn't classify the password as very strong regardless how many hundredths of numbers or alphabet characters it includes.


Unfortunately, script is beyond my understanding atm.

....
All I can understand from the above script is; look for the length and if length is as specified lowerCase is true. What happens if there is no lowerCase, which is not defined? Is ord stands for order?

306

(13 replies, posted in General)

Hi Derek,


Thank you very much for the latest update............
Your kind help always appreciated...........


However, it still is not there.
It still says very strong for just typing numbers without any other type of characters. i.e. 12345678908754098654321235678899654 is classified as very strong which is not. Counting length is needed but it's not enough.


For me password classified as very strong should contains at least; 2 different uppercase, 2 different lowercase characters, 2 different numbers and 2 different symbols. If these are missing then it shouldn't classify the password as very strong regardless how many hundredths of numbers or alphabet characters it includes.


Unfortunately, script is beyond my understanding atm.

for i := 1 to iLength do     // looks for lower case
        if (ord(sPassword[i]) >= 97) and (ord(sPassword[i]) <= 122) then LowerCase := True;

All I can understand from the above script is; look for the length and if length is as specified lowerCase is true. What happens if there is no lowerCase, which is not defined? Is ord stands for order?

307

(13 replies, posted in General)

...
However, currently I get followings:


passwords           Strength
---------------------------------------
0123456789         = Medium
01234567891       = Strong
01234567891012 = Very Strong


aabbccddee       = Medium
aabbccddeeffg   = Strong
aabbccddeeffgg = Very Strong

...
Medium strength password should at least contains; numbers and characters or numbers and symbols or characters and symbols with at least one upper or lower case.


Strong strength password should at least contains; numbers, characters and symbols with at least one upper or lower case.


Very Strong strength password should at least contains; numbers, characters and symbols with at least two upper or lower case.


AD1408 wrote:

Could anybody help with the above (my previous post #7) please?


Script is in Derek's post#6 ( PSM 2b.zip)



Hi Dmitry,


It seems nobody else around or can help.
Could you please help?


If you could just do the;
Very Strong strength password should at least contains; numbers, characters and symbols with at least two upper or lower case.
then I'll try to apply it strong and medium.


Here is the full script:

function StrengthMeter(sPassword: string): string;
var
LowerCase, UpperCase, Numbers, Symbols, Repeating, Pattern: boolean;
iLength, i: integer;

begin
LowerCase := False;
UpperCase := False;
Numbers   := False;
Symbols   := False;
Repeating := False;
Pattern   := False;

iLength := Length(sPassword);

for i := 1 to iLength do     // looks for the same character being repeated more than twice
   if ((ord(sPassword[i])) = (ord(sPassword[i+1]))) and ((ord(sPassword[i])) = (ord(sPassword[i+2]))) then Repeating := true;

for i := 1 to iLength do     // looks for a 2 digit recurring pattern (ie 121212 or ababab etc)
   if ((ord(sPassword[i])) = (ord(sPassword[i+2]))) and ((ord(sPassword[i+1])) = (ord(sPassword[i+3]))) then Pattern := true;

for i := 1 to iLength do
   if (ord(sPassword[i]) >= 97) and (ord(sPassword[i]) <= 122) then LowerCase := True;

for i := 1 to iLength do
   if (ord(sPassword[i]) >= 65) and (ord(sPassword[i]) <= 90) then UpperCase := True;

for i := 1 to iLength do
   if (ord(sPassword[i]) >= 48) and (ord(sPassword[i]) <= 57) then Numbers := True;

for i := 1 to iLength do
   if not((ord(sPassword[i]) >= 97) and (ord(sPassword[i]) <= 122)) and
      not((ord(sPassword[i]) >= 65) and (ord(sPassword[i]) <= 90)) and
      not((ord(sPassword[i]) >= 48) and (ord(sPassword[i]) <= 57)) then Symbols := True;

   if iLength <= 4 then result := 'Very weak';
   if (iLength >=5) and (iLength <=6) then
      begin
      if LowerCase and UpperCase and Numbers and Symbols then result := 'Medium'
      else if LowerCase and UpperCase and Numbers then result := 'Weak'
      else if LowerCase and UpperCase then result := 'Weak'
      else result := 'Very weak';
      if Repeating or Pattern then result := 'Very weak';
      end;

   if (iLength >=7) and (iLength <=8) then
      begin
      if LowerCase and UpperCase and Numbers and Symbols then result := 'Strong'
      else if LowerCase and UpperCase and Numbers then result := 'Medium'
      else if LowerCase and UpperCase then result := 'Weak'
      else result := 'Weak';
      if Repeating or Pattern then result := 'Weak';
      end;

    if (iLength >=9) and (iLength <=10) then
       begin
       if LowerCase and UpperCase and Numbers and Symbols then result := 'Very Strong'
       else if LowerCase and UpperCase and Numbers then result := 'Strong'
       else if LowerCase and UpperCase then result := 'Medium'
       else result := 'Medium';
       if Repeating or Pattern then result := 'Weak';
       end;

    if (iLength >=11) and (iLength <=13) then
       begin
       if LowerCase and UpperCase and Numbers and Symbols then result := 'Very Strong'
       else if LowerCase and UpperCase and Numbers then result := 'Very Strong'
       else if LowerCase and UpperCase then result := 'Strong'
       else result := 'Strong';
       if Repeating or Pattern then result := 'Weak';
       end;

    if (iLength >=14) then
       begin
       if Repeating or Pattern then result := 'Medium'
       else result := 'Very Strong';
       end;
 end;



procedure Form1_Edit1_OnChange (Sender: string; vdup: string);
begin
Form1.Label1.Caption := StrengthMeter(Form1.Edit1.Text);

//Clearing strengt panel when password field is empty
if not (Form1.Edit1.text = '') then
   begin
   Form1.pnStrength.Visible := true;
   end else
   begin
   Form1.pnStrength.Visible := false;
   end;

// Coloring the strengt panel according the strength label text
if Form1.Label1.Caption = 'Very weak' then
   begin
   Form1.pnStrength.Color := clRed; // Very weak
   end;

if Form1.Label1.Caption = 'Weak' then
   begin
   Form1.pnStrength.Color := $0000009F; // Weak
   end;

if Form1.Label1.Caption = 'Medium' then
   begin
   Form1.pnStrength.Color := $000074DD; // Medium
   end;

if Form1.Label1.Caption = 'Strong' then
   begin
   Form1.pnStrength.Color := $00C08000; // Strong
   end;

if Form1.Label1.Caption = 'Very Strong' then
   begin
   Form1.pnStrength.Color := $0000A800; // Very Strong
   end;
end;



begin

end. 

308

(13 replies, posted in General)

Could anybody help with the above (my previous post #7) please?


Script is in Derek's post#6 ( PSM 2b.zip)

309

(13 replies, posted in General)

Hi Derek,


Thank you very much for the latest update..................


For example, Dmitry takes a password that has a length of 9 and grades it 'very strong' if it has instances of 'lowercase', 'uppercase', 'numbers' and 'special characters', downgrades it to 'strong' if it doesn't use 'special characters, downgrades it further to 'medium' if it doesn't use 'numbers' etc etc.

That's what I thought at first. I could see there were code for all those but when I entered 22222222222222 it rated as very strong? As you can see there are no instances of LowerCase, UpperCase and Symbols. Only numbers.


Your added lines stops it at Medium on repeating and patterns characters use.
However, currently I get followings:


passwords           Strength
---------------------------------------
0123456789         = Medium
01234567891       = Strong
01234567891012 = Very Strong


aabbccddee       = Medium
aabbccddeeffg   = Strong
aabbccddeeffgg = Very Strong


As you can see one contains only number and other is alphabet characters. IMHO, beside measuring the password length, repeating characters, numbers and patterns (patterns at certain degree; basic ones would be sufficient for me as you already have added in):
Medium strength password should at least contains; numbers and characters or numbers and symbols or characters and symbols with at least one upper or lower case.


Strong strength password should at least contains; numbers, characters and symbols with at least one upper or lower case.


Very Strong strength password should at least contains; numbers, characters and symbols with at least two upper or lower case.

310

(13 replies, posted in General)

Hi Derek,


Thank you very much for the sample project........


However, I imagine it would be easy enough to take what I've done and translate it into the 'weak', 'medium' or 'strong' categories.

Tried but couldn't do it.


As far as I can see currently (sample project I've attached on post#1) it checks only the length. How can we incorporate LowerCase, UpperCase, Numbers and Symbols beside repeating characters and pattern into each category?

311

(13 replies, posted in General)

Hi nrmuduli,


Thank you for the sample project.
However, it's still the same though. Pass strength algorithm includes only characters count, rest that I mention on my post #1 is missing... So pw 22222222222222 is still classified as a very strong password while it should be classified as very weak.
Nice reporting of tested password anatomy though.

312

(13 replies, posted in General)

Attached sample project code is provided kindly by Dmitry.


As far as I can understand it measures password strength by character count.
As a result it classifies password 22222222222222 as very strong which is not.
https://s17.postimg.org/oz74nau5r/psm2.png


Beside character count it needs to include;
♦ Lower and uppercase usage
♦ Numbers usage
♦ Special characters usage
♦ Same characters usage
in it's algorithm.


Adding above features are beyond me. Could somebody help please?

How can I get Hard Disk Serial number on button click on PC please?

314

(2 replies, posted in General)

Hi EHW,


Glad to see you around............
Thank you very much............................
Truly appreciated.......................................

315

(2 replies, posted in General)

I couldn't get reports to do the followings:
1. Print all from grid. Each record (invoice) needs to start on a new page, not starting on same page when there is an available space on the page.
2. Print a selected single invoice from grid.
3. Print invoices within specified date range.


Please see the attached sample project.

316

(0 replies, posted in General)

I have tried to populate table grid with SQL from other DB tables but no success....


What I wanted to do is, to get sale invoice(SI) and sale invoice items fields values on Sale Invoice Refunds(SIR) and Sale invoice refund items forms and save these values as sale inv refund after editing where needed.


Please see the attached sample project.

Thanks for the sample project Dmitry.............

In that case, is it possible to delete a record with delete button only and disabling delete key press on editable grid?

319

(3 replies, posted in General)

Hi EHW,


Thank you very much..........................


I also noticed that at later stage but forgot to update it here.


After correcting, it still didn't work, most likely I must be still doing something wrong. Then I decided to use Mathias approach with combination of some SQLExecute for browsing records. It's seems fine for save, edit and delete buttons atm. However, I couldn't get it working on form1Show selecting first records on relevant grids as switching tab pages automatically..

Editable grid lets user delete a grid record without the need of delete button it seems.
I cannot catch 'FOREIGN KEY constraint failed' message to replace it with custom one when using editable grid.
How can I do it please?

321

(3 replies, posted in General)

https://s17.postimg.org/a64loh67z/tempz002.png


As illustrated above, I was trying to use Derek's myScroll script to achieve;
♦ Form1 onShow
    - select first available record from upper pageControl
    - Selected record details displayed on the lower pageControl.


The following script for customers tab works but I couldn't get Suppliers and Product tabs work?

var  vrowid: integer;
// Customer
procedure MyScrollCUSTOMER;
begin
if Form1.PageControl1.ActivePageIndex = 0 then
   begin
   if Form1.tgMainCustomers.selectedrow < 0 then Form1.tgMainCustomers.selectedrow := 0;
      vrowid := Form1.tgMainCustomers.selectedrow;
      Form1.tgMainCustomers.selectedrow := vrowid;
      Form1.tgMainCustomers.setfocus;
   end;
end;

// Supplier
procedure MyScrollSUPPLIER;
begin
if Form1.PageControl1.ActivePageIndex = 1 then
   begin
   if Form1.tgMainSupplier.selectedrow < 0 then Form1.tgMainSupplier.selectedrow := 0;
      vrowid := Form1.tgMainProducts.selectedrow;
      Form1.tgMainSupplier.selectedrow := vrowid;
      Form1.tgMainSupplier.setfocus;
   end;
end;

// Product
procedure MyScrollPRODUCT;
begin
if Form1.PageControl1.ActivePageIndex = 2 then
   begin
   if Form1.tgMainProducts.selectedrow < 0 then Form1.tgMainProducts.selectedrow := 0;
      vrowid := Form1.tgMainProducts.selectedrow;
      Form1.tgMainProducts.selectedrow := vrowid;
      Form1.tgMainProducts.setfocus;
   end;
end;

Hi Derek,


Thank you very much.......................


I know about currency grid column formatting. I was trying to avoid using that method as it requires more lines of script depending on how many different grids used. Additionally, when grid column order is changed we need to go back to script, locate it and change column numbers too.
I was looking for solution of make it once and use it in many places approach. Perhaps that's not possible with current MVD.


If and when Dmitry updates older and not supported NextGrid in current MVD to current NextGrid there may be solution to currency decimals display in respect of calc fields and few other bugs/glitches exist.


Once again, thank you very much for your kind help and guidance Derek.........................

Hi Derek,


Thanks a lot....
On formatting, just standard currency formatting.. right justified with two decimal places.

Hi Derek,


Great stuff.................
Thank you very much for your kind and prompt help...............
Truly appreciated............................


'doonchange' and use of  'vname: string' in procedure are new for me. I've put them in my reference library.


Ps/. Is it possible to convert the following calculated field to form script?

(
SELECT sum(PurchInvitem.unitprice * purchinvitem.qty) 
FROM PurchInvitem
WHERE PurchInvitem.id_Product=Product.id
) 

something like (which doesn't work)

procedure frmProduct_OnShow (Sender: TObject; Action: string);
begin
frmProduct.edPurchTotal := frmPurchInvItem.edPurchInvQty * frmPurchInvItem.edPurchInvUnitPrice.Value;
end;

I like to use script instead of calculated field in order to avoid decimals formatting script for grid display.
I've done the invTotal but couldn't do purchTotal.

Hi Derek,


Thank you very much...............
Truly appreciated............................


I used older sample project where all inv fields were on same table. My mistake, I forgot to delete qty and unit price fields from PurchInv table after creating PurchInvItem table.


... I'd consider using some sort of relational lookup on the purchinvitem form otherwise you can easily be selecting products that haven't been set up for the supplier that you're invoicing - with all of the knock-on problems that will cause.

You are absolutely right. That's definitely needed.


I have added disabled supplier combo on PurchInvItem form and copied combo value from PurchInv supplier combo:

procedure frmPurchInvItem_OnShow (Sender: TObject; Action: string);
begin
frmPurchInvItem.cbPurchInvItemSupplier.dbItemID := frmPurchInv.cbPurchInvSupplier.dbItemID;
end;

I was thinking adding on change event for PurchInvItem supplier combo onChange event to get product combo on PurchInvItem lists only the products belonging supplier showing on supplier combo:

procedure frmPurchInvItem_cbPurchInvItemSupplier_OnChange (Sender: TObject);
begin
frmPurchInvItem.cbPurchInvProduct.dbItemID := SQLExecute('SELECT name FROM product WHERE id = '+frmPurchInvItem.cbPurchInvItemSupplier.sqlValue);
end;

However, it didn't work. My one cell brain couldn't make the correct connection here.