-
Content Count
1977 -
Joined
-
Last visited
-
Days Won
26
Everything posted by Attila Kovacs
-
IDE hangs for a few seconds every couple of minutes
Attila Kovacs replied to RaelB's topic in MMX Code Explorer
How do you do that? Using it in blurry mode? Because MMX forms are broken in DPI Aware App mode. -
IDE hangs for a few seconds every couple of minutes
Attila Kovacs replied to RaelB's topic in MMX Code Explorer
How long does this "IDE hang" takes? Can you attach the hanging IDE process to a debugger like OllyDbg and step through until user code and track it down what part of the IDE / Module it causes? -
just write sl:=StrArray(TDirectory.GetFiles(SourceDir)); and drop "Dir"
-
Micro optimization: String starts with substring
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
@David Heffernan I admire your patience. -
Micro optimization: String starts with substring
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
https://stackoverflow.com/questions/1282015/the-fastest-way-to-compare-a-partial-string answered by "mat" -
Holy cow.
-
As François suggested, set up a resource in the domain which you check against, then you can manage the permissions from the background. And for your customers, -as many of us suggested-, create a separate dll. If you are concerned about leaking the internal dll to the customers, load the data in the internal dll from the internal resource.
-
Micro optimization: use Pos before StringReplace
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I think adding an "in my case" on the bottom of the second page of the thread is a little unfair. -
Micro optimization: use Pos before StringReplace
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
"percent" is not a unit neither "lot" is If you are already patching files from your customers, it would have been a little effort to test it yourself on your use case with realtime data and post the results. I don't think that this test which comparing Pos() with SubString() and giving a result of 0,00006 milliseconds difference, makes any sense. -
Micro optimization: use Pos before StringReplace
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I see now what you mean, you are right about optimization part (just as 5 years ago). I had only this thread in my mind. -
Micro optimization: use Pos before StringReplace
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
He isn't using that code at all. At least not in the tests. -
Micro optimization: use Pos before StringReplace
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
StringReplace iterates only once over the string, there is nothing to solve. It's his tests where he is ignoring the fact that StringReplace not only replacing (or not) parts of the string, but also assigns the result to a new string. Those test are failing and by fixing it the differences are not that big any more. A couple of milliseconds on a loop with 10 million iterations. -
Micro optimization: use Pos before StringReplace
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Why don't you fix your tests first? You misled yourself with faulty tests. -
to answer your original question: They are in different units, one in System.AnsiStrings the other in System.SysUtils, and either you are using them mixed or they are declared in random order in the uses list.
-
Micro optimization: use Pos before StringReplace
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Ok, well Yes, it doesn't use Pos to check if it needs replacing at all. System.SysUtils.StringReplace: "FoundPos := Pos(xOldPattern, Str, FoundPos);" Fail. Aha, I just noticed StrigReplace has rfIgnoreCase flag. 6th line in System.SysUtils.StringReplace: "if rfIgnoreCase in Flags then" Fail. Your test case: vNewStr := 'Fail.'; if Pos(cNoFind, cLongStr) > 0 then vNewStr := StringReplace(cLongStr, cNoFind, cReplace, [rfReplaceAll]); Writeln(vNewStr); Fail. -
Micro optimization: use Pos before StringReplace
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Maybe you have a special, dedicated RTL shipped with Delphi. Was it in a golden envelope? -
New Explicit Properties Filter expert in GExperts
Attila Kovacs replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
It comes handy for my form designer zoom as the IDE shat full the dfm with explicit values after a forced DPI change on the designed form. thx -
A class that returns different types of components
Attila Kovacs replied to Stano's topic in Algorithms, Data Structures and Class Design
Brrrr, the oldschool way is to use DB Aware controls, like TDBSpinEdit and set its datasource to point to the dataset you want. Then you can write: procedure OnClick(Sender: TObeject); begin if Sender is TDBSpinEdit then TDBSpinEdit(Sender).Datasource.Dataset.CheckBrowseMode; // for example end; But, depending on what you are trying to achieve in OnClick it's possible that you have to move that code into the dataset's or its fields' events. (If we are talking about VCL and I understand your issue correctly) -
1 error + 1 error = 3 errors? where is the extra one?
Attila Kovacs replied to c0d3r's topic in Delphi IDE and APIs
what? no hug? brrrr -
1 error + 1 error = 3 errors? where is the extra one?
Attila Kovacs replied to c0d3r's topic in Delphi IDE and APIs
@emailx45 what are you talking about? Do you have to flood every thread with some irrelevant google translated sh*t? -
1 error + 1 error = 3 errors? where is the extra one?
Attila Kovacs replied to c0d3r's topic in Delphi IDE and APIs
Be positive. You can kill two birds with one stone. -
Wow, that was an unexpected twist. I hope it's already on the wish list or a bug report was filed as unsatisfactory mimicking of .net.
-
Is it really that bad to Use boolean parameters to make your functions do two things?
Attila Kovacs replied to Mike Torrettinni's topic in General Help
SetWindow'sVisibleFlagTo( clChequered ); -
Is it really that bad to Use boolean parameters to make your functions do two things?
Attila Kovacs replied to Mike Torrettinni's topic in General Help
EnableDisableWindow( Agree: boolean ) -
Sorry I don't know what you mean and how to test serialization with an example of deserialization. There should be an option for nullables if "null" values should be serialized or not at all, but you will find this out by yourself one day if you start using this lib with php API's. Anyway, I tried to compile the lib with Berlin and there are couple of things which are only Tokyo+. (Very far from "perhaps XE7"). (Edit: even in Tokyo, System.JSON.Serializers is so buggy that it needs several workarounds) But System.JSON.Serializers.pas compiles fine under Berlin, thanks for bringing this unit to my attention.