Leaderboard
Popular Content
Showing content with the highest reputation on 10/22/21 in Posts
-
Not sure which of the subforums to post, but here it goes: With great sadness, I just got word from both Julian Bucknall on Twitter and Lino Tadros on Facebook that my dear friend Danny Thorpe passed away on October 22nd, just a few hours ago. Still limited in energy, still recovering from many treatments, I will need to keep it short and hope to gain some more energy and blog a small obituary later. For now, I'm devastated. Loosing a friend and one of the instrumental Delph R&D team members from the days brings so many mixed emotions. I wish his wife Cindy and their loved ones all the best. Rest in peace dear Danny. The world will be different without you. --jeroen Referencs: - https://twitter.com/JMBucknall/status/1451674438097854464, https://twitter.com/jpluimers/status/1451677770552123399 - https://www.facebook.com/lino.tadros/posts/10158270097971179, https://www.facebook.com/cindy.f.thorpe/posts/10224108253026657
-
Any good replacement for Indy email?
David Heffernan replied to PiedSoftware's topic in General Help
It's plausible that Indy isn't the problem here and that a wholesale library replacement will leave you with the same problems. -
Can't you be a little more specific which problems you'r having with Indy ?
-
Which implementation of this is easier to understand?
Stefan Glienke replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
I leave that as an exercise to anyone who needs it - I would not want to have it run through the virtual Get and GetObject functions for every iteration. As for "All that hacking"- it's only that one private field access. And even that could be done a little cleaner by using the helper with Self trick. I always use records for enumerators except when I don't 😉 -
Which implementation of this is easier to understand?
Stefan Glienke replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
Wrong, string and object are in the same entry - the internal storage of a TStringList has an array of TStringItem which is a record which contains a string and an object. You simply find it like this: function findSomething( const aStringArg : string ) : TObject; var i: Integer; begin i := sl.IndexOf(aStringArg); if i >= 0 then Result := sl.Objects[i] else Result := nil; end; Make this a method in your own TStringListHelper and there you go. If you want easy and fast lookup of objects by string key, then use a dictionary. -
update indy to use tls 1.2 in c++builder 6?
Remy Lebeau replied to JeanCremers's topic in General Help
Not like it used to be. A few members are still lingering around the various forums. Several members have transitioned into MVPs, though some members (like me) haven't but are still recognized by a few Embarcadero employees to keep getting old TeamB perks (free versions, beta access, etc). Thanks, fixed. -
I find the Ctrl+F MRU handling hideous (rant + question)
Uwe Raabe replied to a topic in Delphi IDE and APIs
There have been almost 8 weeks between the report (Priority: Major) and the release. Just sayin... -
Tried Peganza Analyzer Lite and that is what I need 🙂
-
Found and remove unused uses units
David Schwartz replied to shineworld's topic in Delphi IDE and APIs
ahh, well then use the Peganza Analyzer Lite. (It used to be called Icarus.) That's what it's for. -
That's only true for the uses-clause entries that the form designer manages. (Which is a tiny fraction in my development.)
-
Here the same, only for O365 i have build a "proxy" in C#, we use EWS for that now. (Exchange Web Services (EWS) Managed API reference | Microsoft Docs)
-
CnPack
-
update indy to use tls 1.2 in c++builder 6?
Remy Lebeau replied to JeanCremers's topic in General Help
<sigh> Fine, then let's go the long way around, using a full wrapper class, forget TMethod (even though it will technically work at runtime, despite the compiler warnings): // SOURCE #define BUILDING_DLL #include "mydll.h" class eventHandlers { public: OnWorkBeginFunc onWorkBegin; OnWorkEndFunc onWorkEnd; OnWorkFunc onWork; void __fastcall OnWorkBeginHandler(TObject *ASender, TWorkMode AWorkMode, __int64 AWorkCountMax) { if (onWorkBegin) onWorkBegin((OnWorkMode)AWorkMode, AWorkCountMax); } void __fastcall OnWorkEndHandler(TObject *ASender, TWorkMode AWorkMode) { if (onWorkEnd) onWorkEnd((OnWorkMode)AWorkMode); } void __fastcall OnWorkHandler(TObject *ASender, TWorkMode AWorkMode, __int64 AWorkCount) { if (onWork) onWork((OnWorkMode)AWorkMode, AWorkCount); } }; static bool sslPathSet = false; char* getdata(const char *url, OnWorkBeginFunc onWorkBegin, OnWorkEndFunc onWorkEnd, OnWorkFunc onWork) { char *result = NULL; try { if (!sslPathSet) { sslPathSet = true; IdOpenSSLSetLibPath(ExtractFilePath(ParamStr(0))); } TIdHTTP *http = new TIdHTTP; try { eventHandlers events; events.onWorkBegin = onWorkBegin; events.onWorkEnd = onWorkEnd; events.onWork = onWork; http->OnWorkBegin = &events.OnWorkBeginHandler; http->OnWorkEnd = &events.OnWorkEndHandler; http->OnWork = &events.OnWorkHandler; TIdSSLIOHandlerSocketOpenSSL *SSL = new TIdSSLIOHandlerSocketOpenSSL(http); SSL->SSLOptions->SSLVersions = TIdSSLVersions() << sslvTLSv1 << sslvTLSv1_1 << sslvTLSv1_2; http->IOHandler = SSL; http->ReadTimeout = 10000; UTF8String s = http->Get(url); result = new char[s.Length()+1]; memcpy(result, s.c_str(), s.Length()+1); } __finally { delete http; } } catch (...) { return NULL; } return result; } void freedata(char *data) { delete[] data; } Odd, they should be. Especially since OnWorkEnd can't be called if OnWorkBegin is not called first. No. Correct, because the event is expecting a class method, not a standalone procedure. Using TMethod is the way to get around that. -
Which implementation of this is easier to understand?
dummzeuch replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
Not sure I understand what you mean here. Which pointer are you talking about? And why do you think it's being reset? Depending on how the reader is implemented Seek would read a record from a file (already with a buffered stream) or from an internal data structure. In this particular case it just accesses data already read into an array. It is serious in this case. The data in that file (and those associated with it) would be unusable and processing it should be stopped. -
Which implementation of this is easier to understand?
David Heffernan replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
@Stefan Glienke You could readily tweak this to work with TStrings rather than TStringList and avoid all that hacking at the internals. But it's nice to see you using records for enumerators! -
Which implementation of this is easier to understand?
Stefan Glienke replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
program StringListHelper; {$APPTYPE CONSOLE} uses Classes, System.SysUtils; type TStringListItem = record str: string; obj: TObject; end; TStringListPairs = record private List: TStringList; type TEnumerator = record private List: TStringList; Index: Integer; function GetCurrent: TStringListItem; public function MoveNext: Boolean; property Current: TStringListItem read GetCurrent; end; TStringListAccess = class(TStrings) private FList: TStringItemList; end; public function GetEnumerator: TEnumerator; end; TStringListHelper = class helper for TStringList public function Pairs: TStringListPairs; inline; end; { TStringListPairs.TEnumerator } function TStringListPairs.TEnumerator.GetCurrent: TStringListItem; begin Result := TStringListItem(TStringListAccess(List).FList[Index]); end; function TStringListPairs.TEnumerator.MoveNext: Boolean; begin Inc(Index); Result := Index < List.Count; end; { TStringListHelper } function TStringListHelper.Pairs: TStringListPairs; begin Result.List := Self; end; { TStringListPairs } function TStringListPairs.GetEnumerator: TEnumerator; begin Result.List := List; Result.Index := -1; end; var sl: TStringList; begin sl := TStringList.Create; for var p in sl.Pairs do if p.str = 'foo' then Writeln(p.obj.ClassName); end. -
The problem with beta testing new releases of Delphi is that the components we use in our applications are normally not available at that time, so it is a pointless exercise. I have given up participating.
-
But you have to sometimes, in case of you have to use Android / iOS. Anyway, I find D11 quite stable so far, but I'm still in the process of porting and testing. At least I can say that I have no show-stoppers yet 🙏
-
Which implementation of this is easier to understand?
Lars Fosdal replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
I'd go for the second alternative, but I'd do it as a function returning a boolean for found/not found and an optional boolean flag on whether to raise an exception or not.