-
Content Count
1406 -
Joined
-
Last visited
-
Days Won
22
Everything posted by programmerdelphi2k
-
Finding duplicate properties in classes
programmerdelphi2k replied to egroups's topic in Algorithms, Data Structures and Class Design
maybe my sample can help you to start... implementation {$R *.dfm} uses System.Rtti, Unit2; procedure TForm1.Button1Click(Sender: TObject); var LCtx : TRttiContext; LType : TRttiType; LProp : TRttiProperty; LPropParent: string; begin LCtx := TRttiContext.Create; for LType in LCtx.GetTypes do begin if (LType.TypeKind = tkClass) { TRttiInstanceType } and { } (LType.IsInstance) and { } (LType.AsInstance.MetaclassType.InheritsFrom(TMyClassXXXX { myClass } ) or { } LType.AsInstance.MetaclassType.InheritsFrom(TForm { myClass } )) then begin Memo1.Lines.Add(slinebreak + { } LType.Name + ', ' + { } LType.AsInstance.MetaclassType.UnitName + ', ' + { } LType.AsInstance.MetaclassType.UnitScope); // for LProp in LType.GetProperties do if (LProp.Name = 'Width' { myPropetyName } ) then begin LPropParent := 'Parent=nil'; // if (LProp.Parent <> nil) then LPropParent := 'Parent=' + LProp.Parent.ToString; // Memo1.Lines.Add('..... property: ' + LProp.Name + ', ' + LPropParent); end; end; end; end; -
you can specify "CHARSET and COLLATE": in you "connection string" for all usage (CHARSET/COLLATE ) or in "select, insert, update" on fields (CHARSET/COLLATE) on in your index creation or in "order by" (CHARSET/COLLATE) ex.: select myfield COLLATE <<your collation>> from table where myfieldx COLLATE <<your collation>> = 'ABC' order by myfieldY COLLATE <<your collation>> etc... you see?
-
How to detect if a Dialog is open/running?
programmerdelphi2k replied to Ian Branch's topic in General Help
if using "if YourForm.SHOWING then = "opened" in your screen" not? -
implementation {$R *.fmx} var LImComingOrGoing: boolean = true; procedure TForm1.FormCreate(Sender: TObject); begin FloatAnimation1.StartValue := Rectangle2.Position.Y; FloatAnimation1.StopValue := (Rectangle2.Position.Y - 100); // FloatAnimation1.Trigger := 'IsMouseOver=True'; FloatAnimation1.TriggerInverse := 'IsMouseOver=False'; FloatAnimation1.PropertyName := 'Position.Y'; // FloatAnimation1.Duration := 0.5; FloatAnimation1.AutoReverse := false; // FloatAnimation1.StartValue := Rectangle2.Position.Y; FloatAnimation1.StopValue := (FloatAnimation1.StartValue - 100); end; procedure TForm1.FloatAnimation1Finish(Sender: TObject); begin FloatAnimation1.Stop; // if LImComingOrGoing then begin FloatAnimation1.StartValue := Rectangle2.Position.Y; FloatAnimation1.StopValue := (FloatAnimation1.StartValue - 100); end else begin FloatAnimation1.StartValue := Rectangle2.Position.Y; FloatAnimation1.StopValue := (FloatAnimation1.StartValue + 100); end; // LImComingOrGoing := not LImComingOrGoing; end;
-
Destroy or clean TSaveDialog after save
programmerdelphi2k replied to Zazhir's topic in Algorithms, Data Structures and Class Design
this code it's not mine! I just say "where" put it... on "try-finally" as I said on first post, "CODE CONFUSED"!!! -
@stacker_liew if any "AV" is been raised, when you: trying to access an object that was never created in memory; trying to access an object that no longer exists in memory;
-
using any specific Charset or Collate on field?
-
Destroy or clean TSaveDialog after save
programmerdelphi2k replied to Zazhir's topic in Algorithms, Data Structures and Class Design
try some like this: -
Destroy or clean TSaveDialog after save
programmerdelphi2k replied to Zazhir's topic in Algorithms, Data Structures and Class Design
confused code! try create your "Excel" just one time... out any procedure! for example, before any use in your unit. Then, when all end, just free it! -
Unable to use installed package with RAD Studio 11.1 and later
programmerdelphi2k replied to fellafoo's topic in Delphi IDE and APIs
try this: download last version from https://www.o2c.de/en/download/o2c-download.html install it for register all Ocx on "MSRegistry! in IDE "Import Component - Type Library -> new package installation! RAD 11.2 Alexandria test! -
Unable to use installed package with RAD Studio 11.1 and later
programmerdelphi2k replied to fellafoo's topic in Delphi IDE and APIs
does this plugin require "Internet Explorer" by default or any browser? -
Delete substring from a string
programmerdelphi2k replied to Henry Olive's topic in RTL and Delphi Object Pascal
try this sample: function MyFindAndReplace2(const AStr: string; const ASubStr: string; const ADelimiter: Char): string; var LArr : TArray<string>; LNewArr: TArray<string>; begin result := AStr.Replace(' ', '', [rfReplaceAll]); // removing blank-spaces... // if (result.Trim = '') or (ASubStr.Trim = '') or (ADelimiter = #32) then exit(''); // LArr := result.Split([ADelimiter], TStringSplitOptions.ExcludeEmpty); // for var i: integer := 0 to high(LArr) do // only if not found! if (LArr[i] <> ASubStr) then LNewArr := LNewArr + [LArr[i]]; // result := ''.join(ADelimiter, LNewArr); end; procedure TForm1.Button3Click(Sender: TObject); var LText : string; LSubText: string; begin LText := ' 100,1000, 10, 1001, 101,102,100,,,,103,104, 100,100'; // ' '; // ' ,,'; // ' 1, ,'; LSubText := '100'; // Memo1.Text := LText; // Memo1.Lines.Add('Result=[' + MyFindAndReplace2(LText, LSubText, ',') + ']'); end; -
Isn't there any "proportionality" in the printer options (before printing...), between screen and printer? Does this also happen if I set the font to all of MS Windows (on config from MS) and want to print... say the current screen on my monitor from any other software? What if I print from MSWord with a huge font on the screen, and send this print-screen or document to the printer? What happens in this case on your system? Is it comparable to your report about your RAD Studio IDE, or is the IDE case an exception (Bug)? sorry, I have a 4K to test it!
-
Delete substring from a string
programmerdelphi2k replied to Henry Olive's topic in RTL and Delphi Object Pascal
you try this: '100,' or ',100' or ',100,' --> comma as determinant on expression if "comma" dont exists, dont worry! nothing will be changed! [rfReplaceAll] or [ ] for just 1 LText will have always a valid value, same that empty! -
From Delphi+PostgresDAC (PostgresSQL) To Delphi+FireDAC (PostgresSQL)
programmerdelphi2k replied to Squamis's topic in Databases
Well, then the "Array DML technique" would allow multiple "DML commands" with parameters to be automated! so if using: "insert ....; "delete ...." we could produce a "multiple executions to 2 commands" ... with each execution of the array! -
From Delphi+PostgresDAC (PostgresSQL) To Delphi+FireDAC (PostgresSQL)
programmerdelphi2k replied to Squamis's topic in Databases
I dont know if help you, but do you try use "Arrays DML"? https://docwiki.embarcadero.com/RADStudio/Sydney/en/Array_DML_(FireDAC)#:~:text=The Array DML execution technique,for each row in arrays. -
"Ai Caramba!" It's good to see when someone takes their own poison... 😋
-
on code you can try this: procedure TForm1.Button1Click(Sender: TObject); var LArr : TArray<string>; LArrMask: TArray<integer>; LText : string; LCounter: integer; LZeros : integer; begin Memo1.Lines.Clear; Memo2.Lines.Clear; // // NOT normalized LArr := ['1', '1.1', '1.1.1', '1.1.1.1', '1.1.1.2', '1.1.1.3', '1.1.1.4', '1.1.1.5', '1.1.1.6', '1.1.1.7', '1.1.2', { } '1.1.2.1', '1.1.2.2', '1.1.3', '1.1.3.1', '1.1.4', '1.1.4.1', '1.1.4.2', '1.1.5', '1.1.5.1', '1.1.6', '1.1.6.1', { } '1.1.6.2 ', '1.2', '1.2.1', '1.2.1.1', '1.2.1.10', '1.2.1.11', '1.2.1.2', '1.2.1.3', '1.2.1.4', '1.2.1.5', { } '1.2.1.6', '1.2.1.7', '1.2.1.8', '1.2.1.9']; // TArray.Sort<string>(LArr); Memo1.Lines.AddStrings(LArr); // LArrMask := [1, 4, 2, 3]; // your mask! -> try LArrMask := [0, 2, 0, 3]; // for var i: integer := 0 to high(LArr) do begin LText := ''; LCounter := 0; // for var A in LArr[i].Trim.Split(['.']) do // Trim or "replace all space-chars" like in '1.1.6.2 ' begin LZeros := (LArrMask[LCounter] - A.Length); // better without "Abs()" // if (LZeros > 0) then LText := LText + '.' + ''.Create('0', LZeros) + A else LText := LText + '.' + A; // LCounter := LCounter + 1; end; // LArr[i] := LText.Remove(0, 1); end; // TArray.Sort<string>(LArr); Memo2.Lines.AddStrings(LArr); end; LArrMask := [0, 2, 0, 3]; NOTE: you can find the "mask values" scanning all items array, and with "Split()" function + Length = deteminated what the values for your mask! x = max value between 1 and length(text)
-
hi @mofareh Pay attention: your data in your table it's stored like : 1.1, 1.2 ..... 1.2.1, 1.2.2.... let's say that you used this mask: n.n.nnn ( n = digits ) then, you'll need update your table values to: 1.1.001, 1.1.002 .... 1.2.001, 1.2.002 .... for this, you'll need just "edit the values already stored", and your index will be uptadted! NOTE IMPORTANT: if "this values is used in some relationship between tables, then, you'll need another approach, or some maneuvers to change the size of the fields involved, for example! Now, if you don't use these fields to create relationships between tables, then it will be easier to update: for example: Create a new field in the table with the desired size to accommodate the new values now, read each record and get the old value, make the necessary changes to have the new format, and then save this new value in the new field; if all goes well, then now you can decide whether or not you want to delete the old column (field) from your table, and use the new field by default!
-
for reading: https://www.sqlshack.com/top-five-considerations-for-sql-server-index-design/
-
You need add "Uses clause" before; // What's your RAD Studio?
-
ok, but see as used on index: space =char(32) "0" = char(48) "1" = char(49) "9" =char(57) "." = char(58)
-
if using "strings" (in your case), I think that you need fill left-side with "0..." when save your data, or replacing when necessary on code! // you can "before store it on table... using Before Insert/Post event or a stored-procedure", apply some mask? procedure TForm1.Button1Click(Sender: TObject); var LArr: TArray<string>; begin LArr := ['1.2.10', '1.1.10', '1.2.9', '1.2.10', '1.1.9', '1.2.1']; TArray.Sort<string>(LArr); Memo1.Lines.AddStrings(LArr); // // normalized Memo1.Lines.Add('---- Normalized ----'); LArr := ['1.2.10', '1.1.10', '1.2.09', '1.2.10', '1.1.09', '1.2.01']; TArray.Sort<string>(LArr); Memo1.Lines.AddStrings(LArr); end;
-
procedure TForm1.Button1Click(Sender: TObject); var LText: string; begin LText := 'old value'; // ... while if not LText.Contains('new value') then LText := LText + ',' + 'new value'; // ... end while ShowMessage( LText.Remove(0,1) ); // remove first comma end; or just
-
MSBuild - set library paths without touching IDE options
programmerdelphi2k replied to Fr0sT.Brutal's topic in General Help
you can look the "detailed log" created by MSBuild using " /distributedFileLogger" = create a msbuild1.log file on project folder!