-
Content Count
1406 -
Joined
-
Last visited
-
Days Won
22
Everything posted by programmerdelphi2k
-
@toufik then, you would can try some like this: no pagination, in fact, but just increase the param used in "LIMIT" in your select ex.: 1 ... 20 = 20 records on LV 1... 40 = 20 + 20 records on LV 1... 60 = 20 + 20 + 20 .... etc... YourQUERY.Text := SELECT ... from TableXXX LIMIT "n" --> n= 20, n=40, n=60, etc... you can try use "params" in your select to change the value in "n" YourQUERY.Last ---> go to last record on screen or any other way to show last 20 records in your LV LiveBinding use o "BindSourceDB" then you try this: "BindSourceDB1.DataSet.Last"
-
Vonoroi / Fortunes algorithm
programmerdelphi2k replied to cwangdk's topic in Algorithms, Data Structures and Class Design
NOTE: I think that using "ARRAYS" will be better than "TLIST and TDictionary!" !!! in my i7 16GB in can create a array with +/-90.000.000 (integers) before "out of memory" of course, you can find a better value using some technic to avoid "local var" usage! maybe it can be more quickly using Arrays to store the values! or better, a array with all values (coordenates, color, points, etc...) ... more confused, of course! Is the math simple? 😁 type TMyArrays = TArray<integer>; // or any other type TMyArraysOnArray = TArray<TMyArrays>; // TMyDic = TArray<TMyArrays>; // TMyDic2 = TArray<TMyArraysOnArray>; procedure TForm1.Button1Click(Sender: TObject); var LMyList: TMyArrays; LMyDict: TMyDic; // LMyDic2: TMyDic2; begin LMyList := LMyList + [1]; LMyList := LMyList + [2]; // ... // LMyDict := LMyDict + [LMyList]; // Memo1.Lines.Add(LMyList[0].ToString + ' --- ' + LMyDict[0][1].ToString); // LMyDic2 := LMyDic2 + [[[1], [2]]]; // Memo1.Lines.Add(LMyDic2[0][0][0].ToString + ' ---- ' + LMyDic2[0][1][0].ToString); // // Voronoi; end; -
Vonoroi / Fortunes algorithm
programmerdelphi2k replied to cwangdk's topic in Algorithms, Data Structures and Class Design
@cwangdk this dont help you? Demonstrate how to generate and display a Voroni diagram. ... translated to many languages, including Delphi! https://rosettagit.org/tasks/voronoi-diagram/ https://rosettagit.org/tasks/voronoi-diagram/#delphi here im using a PaintBox as target: using a main thread! now you needs use "maybe" a parallelism to better performance! this code (from site) can raise some "bug"... fix it! THIS CODE IS NOT MINE, IS FROM SITE!!! {$R *.dfm} uses System.Generics.Collections; procedure Voronoi; const p = 3; cells = 100; size = 1000; var aCanvas : TCanvas; px, py : array of integer; color : array of Tcolor; Img : TBitmap; lastColor : integer; auxList : TList<TPoint>; poligonlist: TDictionary<integer, TList<TPoint>>; pointarray : array of TPoint; n, i, x, y, k, j: integer; d1, d2 : double; function distance(x1, x2, y1, y2: integer): double; begin result := sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); /// Euclidian // result := abs(x1 - x2) + abs(y1 - y2); // Manhattan // result := power(power(abs(x1 - x2), p) + power(abs(y1 - y2), p), (1 / p)); // Minkovski end; begin poligonlist := TDictionary < integer, TList < TPoint >>.create; n := 0; Randomize; Img := TBitmap.create; Img.Width := 1000; Img.Height := 1000; setlength(px, cells); setlength(py, cells); setlength(color, cells); for i := 0 to cells - 1 do begin px[i] := Random(size); py[i] := Random(size); color[i] := Random(16777215); auxList := TList<TPoint>.create; poligonlist.Add(i, auxList); end; for x := 0 to size - 1 do begin lastColor := 0; for y := 0 to size - 1 do begin n := 0; for i := 0 to cells - 1 do begin d1 := distance(px[i], x, py[i], y); d2 := distance(px[n], x, py[n], y); if d1 < d2 then begin n := i; end; end; if n <> lastColor then begin poligonlist[n].Add(Point(x, y)); poligonlist[lastColor].Add(Point(x, y)); lastColor := n; end; end; //poligonlist[n].Add(Point(x, y)); // why this 2x??? //poligonlist[lastColor].Add(Point(x, y)); //lastColor := n; end; for j := 0 to cells - 1 do begin setlength(pointarray, poligonlist[j].Count); for i := 0 to poligonlist[j].Count - 1 do begin //if Odd(i) then /// why this? and... // pointarray[i] := poligonlist[j].Items[i]; //end; //for i := 0 to poligonlist[j].Count - 1 do //begin //if not Odd(i) then // why this? pointarray[i] := poligonlist[j].Items[i]; end; Img.Canvas.Pen.color := color[j]; Img.Canvas.Brush.color := color[j]; Img.Canvas.Polygon(pointarray); Img.Canvas.Pen.color := clBlack; Img.Canvas.Brush.color := clBlack; Img.Canvas.Rectangle(px[j] - 2, py[j] - 2, px[j] + 2, py[j] + 2); end; // Form1.PaintBox1.Canvas.Draw(0, 0, Img); end; procedure TForm1.Button1Click(Sender: TObject); begin Voronoi; end; -
Getting Unknown storage format [BIN] even with the JSON storage
programmerdelphi2k replied to Magno's topic in Network, Cloud and Web
as explained in Mathew's post, you can manipulate the response to whatever you want. You don't necessarily need to return a JSON format, in fact you can manipulate the response to whatever format you want. In the end, everything will be a text (string). You are the one who determines the result, not the DataSnap! For convenience and usage, JSON is the default returned format! But you are the one who determines what will be returned! See the event used for this in your project! -
D11.2 + FireDAC + MySQL 64 bit not working
programmerdelphi2k replied to Sonjli's topic in Databases
if "it" in your mouth, then it should be! ha ha ha ha... (you lost the line of good-sense...) it's over for me! PERIOD! -
D11.2 + FireDAC + MySQL 64 bit not working
programmerdelphi2k replied to Sonjli's topic in Databases
remove ur glasses and see color-life 😚 -
Restore Delphi File Associations?
programmerdelphi2k replied to Incus J's topic in Delphi IDE and APIs
I had this one time, was necessary just this: run IDE as Admin go to Tool options, and uncheck and check again "associations files" it's ready! (im use just one IDE... i dont have any other) -
D11.2 + FireDAC + MySQL 64 bit not working
programmerdelphi2k replied to Sonjli's topic in Databases
remove the options from "menu", or define "just one option to choice" (no color, no size, no nothing...), it's done! is it really necessary all this? -
Getting Unknown storage format [BIN] even with the JSON storage
programmerdelphi2k replied to Magno's topic in Network, Cloud and Web
I dont know your code, then, the basic idea will be some like this: uses FireDAC.Comp.Client, Data.FireDACJSONReflect; // FD reflection var // just for show "how will be..." - NOT REAL CASE!!! just for show the main idea here! fdsjListOfDatasetsFromServer: TFDJSONDataSets; fdDS_Server_With_Data : TFDMemTable; // any FD-dataset class in your app!!! fdDS_Client_To_Receive_Data : TFDMemTable; var LjsDS: TFDJSONDataSets; // //............// /// ========= on server software LjsDS := TFDJSONDataSets.Create; // on server... // // serialization on server TFDJSONDataSetsWriter.ListAdd(LjsDS, 'a name for your dataset, just for control', fdDS_Server_With_Data); // // ----------------------------// // /// ========= on client software // deserialization on client fdDS_Client_To_Receive_Data.AppendData(TFDJSONDataSetsReader.GetListValue(fdsjListOfDatasetsFromServer, 0 { what dataset on list? } )); -
if Im not wrong, since D2005 (period, comma brakr5 NOT , just text) typo fault you can use TAB key to jump between text. you use Allows (moving)for dont delete text while typing new text. attached a pdf with more info Delphi2005Refactoring.pdf I love Ctrl+D and Ctrl+Shift+J all day recorded in RAD 11.2 ALexandria = Ctrl+Shift+J and regular text replacement...
-
Getting Unknown storage format [BIN] even with the JSON storage
programmerdelphi2k replied to Magno's topic in Network, Cloud and Web
try remove "{result:[ ... ]}", then you'll have a another vetorS from your matrix! xx[0] = [.. real values used ..] here a brief explanation about "result:[" in JSON response: FormatResult Event for REST Responses https://mathewdelong.wordpress.com/2011/09/15/delphilive-2011-recap/ NOTE: you can defined "Handled = true" to get some similar! -
I always use it, it's very usable to "rename / replace" any text on selection! ... (period, comma, braket not just text)
-
D11.2 + FireDAC + MySQL 64 bit not working
programmerdelphi2k replied to Sonjli's topic in Databases
NOTE: I CANNOT DELETE OLD COMMENT BECAUSE IT'S NOT POSSIBLE DELETE OLDER POST! Dont stalk me! please! -
D11.2 + FireDAC + MySQL 64 bit not working
programmerdelphi2k replied to Sonjli's topic in Databases
this is on HELP from RAD Studio, it's not mine comment! That's why "Ian Barker" (Embarcadero MVP) is even embarrassed to say that Embarcadero got it wrong once again!!! -
@Zazhir this is the "Ctrl+Shift+J" that I said above!
-
hi @xorpas well, if you ok for you, then, it's ok! try my new sample: uMyFrameWithRectangle with your Frame and your rectangles or any others the "Rectangle2" is just of show "green color", not needs it!!! type TMyFrameRectangle = class(TFrame) MyRectangleToMove: TRectangle; FloatAnimation1: TFloatAnimation; Rectangle2: TRectangle; private { Private declarations } public constructor Create(AOwner: TComponent); override; end; implementation {$R *.fmx} constructor TMyFrameRectangle.Create(AOwner: TComponent); begin inherited; // FloatAnimation1.Enabled := false; FloatAnimation1.AutoReverse := false; FloatAnimation1.PropertyName := 'Height'; FloatAnimation1.Duration := 0.5; FloatAnimation1.Trigger := 'IsMouseOver=true'; FloatAnimation1.TriggerInverse := 'IsMouseOver=false'; // FloatAnimation1.StartValue := MyRectangleToMove.Height; FloatAnimation1.StopValue := FloatAnimation1.StartValue + (FloatAnimation1.StartValue * 1.4); // +140% end; var Form1: TForm1; implementation {$R *.fmx} uses uMyFrameWithRectangle; procedure TForm1.Button1Click(Sender: TObject); var MyFrameRectangle: TMyFrameRectangle; begin for var i: integer := 1 to 5 do begin MyFrameRectangle := TMyFrameRectangle.Create(nil); // VertScrollBox1.AddObject(MyFrameRectangle); end; end; initialization ReportMemoryLeaksOnShutdown := true; end.
-
Multi Caret like this... I think that RAD IDE does not do it, then you needs a external plugin as I said above in Lazarus you have it, in Delphi not! https://wiki.freepascal.org/New_IDE_features_since#Multi_Caret
-
"PUT a cursor n wich line selected" --> not "edit all lines" try o CnPack or GExpert plugins!
-
understood now! (if said on first post... 🙂 Ctrl+Shift+J is just for "similar TEXTs" (not "." "( )" etc...)
-
is not the same than "Ctrl+Shift+J" ? here you can edit all similar text into our selection, in the same time! ex. if exist many world "hello" in your selection, then, change any one, will change all others in the same time!
-
in Delphi, you can use "Ctrl+A" = select all, or just select your text or lines, "Ctrl+Shift+J" to browse into this selection (you can replace your text like a "refactoring") ... Shift+Click = cursor in any line selected just clicking with mouse undo the "selection" On Tools options, you can use VS Studio emulation keyboard mapping
-
Rectangle2.ClipChildren := True; --> for dont show any control into Rect2 in area > rect2.height ------ RectangleXXX.OnMoveEnter = myOnMoveEnter; RectangleXXX.OnMoveLeave = myOnMoveLeave; note: any other control-on-focus into "Rectangle2" do the rectangle2-lost-focus = OnMouseLeave!!! xx.HitTest = False = dont receive the focus mouse!
-
Rectangle2 into Rectangle1 or any other.... Rectangle2.Align = BOTTOM! LStart = Height or any other value! {$R *.fmx} var LStart : single; LStop : single; LImInUp: boolean = false; // note: moving the mouse very fast, you will get a kind of "flicker" procedure TForm1.FormCreate(Sender: TObject); begin FloatAnimation1.PropertyName := 'Height'; FloatAnimation1.Duration := 0.3; FloatAnimation1.AutoReverse := false; // LStart := Rectangle2.Height; LStop := LStart + 100; // Rectangle2.ClipChildren := true; end; procedure TForm1.Rectangle2MouseEnter(Sender: TObject); begin if not LImInUp then begin FloatAnimation1.Stop; FloatAnimation1.StartValue := LStart; FloatAnimation1.StopValue := LStop; FloatAnimation1.Start; LImInUp := true; end; end; procedure TForm1.Rectangle2MouseLeave(Sender: TObject); begin if LImInUp then begin FloatAnimation1.Stop; FloatAnimation1.StartValue := LStop; FloatAnimation1.StopValue := LStart; FloatAnimation1.Start; LImInUp := false; caption := 'leavin...' + timetostr(now) end; end;
-
D11.2 + FireDAC + MySQL 64 bit not working
programmerdelphi2k replied to Sonjli's topic in Databases
YOU CAN definitely connect "MySQL 64Bits" and "RAD Studio IDE" by Ian Barker <--- this comment is on video from Ian Barker, it's not mine! -
for test: have you cleared the "compiled output folder" ?