Jump to content

programmerdelphi2k

Members
  • Content Count

    1406
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by programmerdelphi2k

  1. all time (paranoic): Ctrl+S (save of course), Ctrl+D (formatter my code...), for code tests: Ctrl+F9 (compiling...), Shift+F9 (bulding...) when all is wrong: Alt+F4 (bye bye)
  2. programmerdelphi2k

    Must have multiple var sections

    not for that... call myself "Bond"... (... suspense music in the air...) ...James Bond πŸ˜‚πŸ˜
  3. programmerdelphi2k

    Must have multiple var sections

    @PenelopeSkye if you necessity is just read and show the records, then, you dont needs so much... just use your SQL to find the record, and using a "While not xxxxx.EOF do..." it's enough! But you need read and store this values in some place (object, var, array, etc...) then, it's not more complicated too! look // defining my record-body... type TMyRecordToMyData = record ID: integer; // my EmpNo field FirstName: string; // my FirstName field // ... end; TMyArrOfMyDatas = TArray<TMyRecordToMyData>; // my dictionary for my datas procedure TForm1.Button1Click(Sender: TObject); var MyDatas : TMyRecordToMyData; // for each record readed in my table... MyArrOfMyDatas: TMyArrOfMyDatas; // like a dictionary off-line... LText : string; // just for tmp usage... begin // example: Employee (Interbase) from Embarcadero DB demo! // // Clearing and defining new "SQL" command... // 1ΒΊ "empno" = field in the table // 2ΒΊ "empno" = the "param name" that im using for indicating my Employee number... FDQuery1.Close; // always closing before any action... // // your select with your params, where, filter, etc... your SQL command!!! // the param-name can be any name, not used in reserved-word SQL!!! // // ex.: "select id, name from mytable where empno = :MyParamNameForEmpno" // FDQuery1.SQL.Text := 'select * from employee where empno = :empno'; // param-name = "empno" // FDQuery1.Params.ParamByName('empno').AsInteger := 2; // always using same param-name above! // FDQuery1.Open; // you can use "FDQuery1.Open( ' your SQL command here ' );" in some situations.... ok? // // simple way to catch all fields (if it can be casting to "string") for example!!! // no needs any "var, array, etc..." just read and write in your memo or any other target... while not FDQuery1.Eof do begin LText := ''; // for var i: integer := 0 to (FDQuery1.Fields.Count - 1) do // field name + field value LText := LText + FDQuery1.FieldDefs[i].Name + ' = ' + FDQuery1.Fields[i].AsString + slinebreak; // Memo1.Lines.Add(LText); // FDQuery1.Next; // to avoid "infinity looping" and catch next values... end; // // // another way, if you need store you values in a "array" or another type (class, record, etc...) // FDQuery1.First; // while not FDQuery1.Eof do begin // another ways: // FDQuery1.Fields.FieldByName('...').AsInteger; // FDQuery1.Fields[0].AsInteger; // FDQuery1.FieldByName('...').AsInteger; // etc... MyDatas.ID := FDQuery1['empno']; // FireDAC accept this way too! MyDatas.FirstName := FDQuery1['firstname']; // // building my list of datas MyArrOfMyDatas := MyArrOfMyDatas + [MyDatas]; // FDQuery1.Next; end; // for var MyData in MyArrOfMyDatas do Memo1.Lines.Add('ID=' + MyData.ID.ToString + ', Name=' + MyData.FirstName); // // you can delete an item in your array, dont worry, nothing will be delete from your table!!! // // let's say that exists 10 items, and you want delete the 2nd item just... no more! Delete(MyArrOfMyDatas, 2, 1); // deleting from 2ΒΊ item, and only 1 item ... if exists, of course! // end;
  4. programmerdelphi2k

    Must have multiple var sections

    I think that "a class" for this would help better than works with "variants", because you will need always "trusth" in each "variant value" when in use! using a class you can do it with more trusth (or same using a record type with all types-for-your-fields! some like this... // using a record for example type TMyRecordToManyTypes = record id: integer; name: string; birthday: TDate; active: boolean; end; procedure TForm1.procedureXXXXX(Sender: TObject); var MyDatas : TMyRecordToManyTypes; MyArrDatas: TArray<TMyRecordToManyTypes>; // same that: array of TMyRecordToManyTypes begin // where needs stored in your array of values while FDMemTable1.Eof do begin MyDatas.id := FDMemTable1.FieldByName('xxxx').AsInteger; // ... another fields... // MyArrDatas := MyArrDatas + [MyDatas]; // like a dictionary usage! end; // // if needs arbitrary values... // // MyDatas.id := 1; // MyDatas.name := 'hello world'; // MyDatas.birthday := now; // MyDatas.active := false; // // MyArrDatas := MyArrDatas + [MyDatas]; // // // when needs read it for var MyData in MyArrDatas do ShowMessage(MyData.name); end;
  5. programmerdelphi2k

    The software industry has moved to the Web, why?

    to @Sherlock not about you, no no... it was about my msg to David. it was not a offense, was just about msg size and details. I didnt know about dicease sorry πŸ˜ͺ
  6. programmerdelphi2k

    Must have multiple var sections

    when using: you can understand like this: like into a "BLOCK" = SCOPE
  7. programmerdelphi2k

    The software industry has moved to the Web, why?

    to @David Schwartz sorry about your personal problem, we all have one. I'm not different. However, I think a book would be a healthy thing to write and cast out our ghosts. but if it makes you happy, keep going. King-WareZ πŸ˜‹
  8. programmerdelphi2k

    The software industry has moved to the Web, why?

    more and more I am sure that David, after retiring from commercial life, urgently needs a new occupation to unload all that accumulation and the need to get out so many things that were imprisoned and, who knows, suffocated in his mind. This can be seen in the length of her texts and the need to lay out his view of things in such detail... I try to imagine how troubled his mind is. maybe it's time to write a book, no? 😁
  9. programmerdelphi2k

    The software industry has moved to the Web, why?

    well, the web app is stateless... then each requirement is the only one... no exists "before"... exists "now" and only this. for sure, it's not appreciated but is this... I hate Youtube reload it each time when im in my screen with 100...200th item aaaaahhhhhhh 🀬
  10. programmerdelphi2k

    client pc database connection problem with interbase server

    basically, Interbase (as Firebird < 4.0) try found gds32.dll on path environment, on "system" folder, on exe folder... but Win 7...10 has problem with gds32.dll (conflicts) then sometimes was necessary rename it or have it only EXE folder. (this started on Win7) on XP it's ok https://github.com/FirebirdSQL/firebird/issues/1351
  11. programmerdelphi2k

    The software industry has moved to the Web, why?

    who m$ove the world? indu$try or endu$er? I think there is a pact here... one says: "I want this!" the other responds, "I have this..."
  12. programmerdelphi2k

    The software industry has moved to the Web, why?

    before.... Microsoft hated Linux! Today they are in love. (not necessary Linus)
  13. programmerdelphi2k

    The software industry has moved to the Web, why?

    each epoch has a new approach! this is the life. in this epoch, web is consolidated and for each season, a new approach! It's the cycle of life. For this time, the market says this is the way things should be. The web is more mature in technology. The human being may still need more time to get used to it, but it will. When industry seniors asked: "Who wants to have a computer at home, on the table?" ... time answered, decades later: "Everybody, and at the same time, nobody..." because, the era of "mobile" had arrived. So "Better" is just a momentary concept until nothing else replaces it. As Einstein said: this is relative... So, it's "better" for some, and not so much for others. But certainly, it is the market that has always dictated the rules for the middle-man.
  14. programmerdelphi2k

    VCL - DevExpress

    I would like to hear Google-BARD AI's opinion on the above debate, would you please give your opinion? Of course, let me just refer to the MS ChatGPT... ok, ChatGPT, I think they waste their time by being too idle in time. So I hand the word back to MS. (sorry, my fault ... to BARD) Okay, BARD... as my colleagues confirm... we are looping over opinions of a character closely linked to the cultural aspect of each member involved in the debate. Which, indeed, will end as it began... in nothing! thanks for watching
  15. programmerdelphi2k

    VCL - DevExpress

    Indeed, DevExpress is a great collection of components that pretty much meets almost every VCL project need. But like everything big, it is expensive for small projects or individual programmer. On the other hand, RAD Studio provides a good option for any project that doesn't need to be more beautiful than useful. Now, if you want to prioritize "beauty" to the detriment of useful things, then you will need to look for third-party suites, or invest in internal labor to produce them. As this does not seem to be your option, then, the replacement of DevExpress by TMS (currently in great prominence) can be a great acquisition. Especially in the range of VCL and FMX (multiplatform) components they have, unlike DevExpress (VCL-oriented)
  16. as the problem can be a "user" in question, then, I'll try the following: uninstall completly the RAD detele all REGISTRY keys about Embarcadero (HCU, HLM) delete all files/folders residual (including on c:\ProgramData -> 3 folders GUID-names) and c:\users\...Local/Roamming Embarcadero) restart MSWindows and re-install it again!
  17. programmerdelphi2k

    Puzzled by StrToDate

    for each edition you can have your StrToDate function or any other similar for the edition, for this u can use "compiler directives" {$IFDEF xxxx } .... {$ELSE / $ELSEIF }...{$ENDIF} for arrays, you can have yourself functions, like IndexOF(); NOTE: you can have the same approach to Dates/Times types!!! as have yourself "StrToDate(...)' for this types not matters the edition!!! type TMyArrayStrings = TArray<string>; TMyHelperToArray = record helper for TMyArrayStrings function MyIndexOf(const AValue: string): integer; end; function TMyHelperToArray.MyIndexOf(const AValue: string): integer; begin result := -1; // for var i: integer := 0 to high(Self) do if (Self[i] = AValue) then exit(i); end; //... var LMyArrStrings : TArray<string>; // array of string i: integer; begin i := LMyArrStrings.MyIndexOf('hello'); // if (i > -1) then Delete(LMyDateTimeValue, i, 1); end;
  18. programmerdelphi2k

    Can't install JEDI into Delphi 10.4

    did you try look at your REGISTRY to find JEDI key on Embarcadero software? if exists, try delete it ... and your Catalogue repository references... now, try re-install it by GetIT
  19. programmerdelphi2k

    Puzzled by StrToDate

    hi @Incus J in fact, the Delphi give to you System.Date.utils and others with many functions/procedures to do many tasks, then, why not use it? note: isn't it overkill to use a TStringList to store so little data? I think it would be suitable to use Arrays uses System.DateUtils; procedure TForm1.Button1Click(Sender: TObject); const LArrOfXX: array [1 .. 31] of string = { } ('st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', { } 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th', 'th'); var FS : TFormatSettings; LMyDateTimeValue : string; LMyDateTimeResult: TDateTime; begin LMyDateTimeValue := 'Feb/16/2023'; // FS := TFormatSettings.Create('en-GB'); FS.ShortDateFormat := 'MMM/dd/yyyy'; try // first test using Delphi function, of course! LMyDateTimeResult := StrToDateTime(LMyDateTimeValue, FS); // is valid? not... then do it another way! // Memo1.Lines.Add( { your format... } FS.ShortMonthNames[LMyDateTimeResult.Month] + ' ' + { } LMyDateTimeResult.Day.ToString + LArrOfXX[LMyDateTimeResult.Day] + ' ' + { } LMyDateTimeResult.Year.ToString); // Memo1.Lines.Add(LMyDateTimeResult.ToISO8601); // // NOTE: dont use letters used on format function, like this... or use! you decide! Memo1.Lines.Add(LMyDateTimeResult.Format('Hello World: MMMM, dd, yyyy', FS)); // dd/mm/yyyy, MMM/dd/yyyy ... all valid format! // // etc ... except // what to do? Memo1.Lines.Add('Invalid datetime format...'); end; end; try some like this:
  20. programmerdelphi2k

    Curious TRESTRequest behavior

    have you try use "RESTClient1.Params.ClearAndResetID" ?
  21. programmerdelphi2k

    Curious TRESTRequest behavior

    Your code in the first post is very minimalist, so, I ask? Is there any possibility that, in your parameter change, there is a loss of some property that connects the components to each other? (i mean, some property is getting blank = nil)
  22. programmerdelphi2k

    Change behaviour of DateTimePicker

    this a default behaviour, else you need implement yourself class for this, or entry manually by code your date, like : dtPicker.date := nn/nn/nnnn
  23. programmerdelphi2k

    BDE + 10.3 and error $210C

    good
  24. programmerdelphi2k

    Move objects to a second Data Module

    on code it's more easy find it... just rename your "data module unit" and try re-compile it... you'll see many errors on compiling... on components you need open each "form/datamodule" to see what component (ex. Datasets) use it! or open the form/datamodule as TEXT and find the name
Γ—