

Kas Ob.
Members-
Content Count
578 -
Joined
-
Last visited
-
Days Won
10
Everything posted by Kas Ob.
-
Look at the bright side, Embarcadero Mail server is working, which is nice.
-
Your obj files are compiled with VS C RTL, aka Microsoft Visual C++ Run Time, remove that dependency then rebuild it, and you will get rid of that error.
-
Delphi CE application accesses unknown IPs
Kas Ob. replied to everybyte's topic in Network, Cloud and Web
The UDP one is most likely secured DNS connection, the others are some shitty AV/Security software you have installed, check its settings and you will find that you are allowing to send samples from your PC, and that shit is literally sending everything to its server, every single new EXE that is not in their DB. And please share with us the name of this great tool. -
Locking an Object
Kas Ob. replied to fastbike's topic in Algorithms, Data Structures and Class Design
Well, many many things and questions went into my head after seeing your snippets code. Why are you complicating things ? 1) As one you can just create a new and initialize it then replace it without locking at all, that is possible because your thread are running without explicit control like just use this one, so create new one and replace it, simple like that. 2) From your first post, i got the idea that the create and reload will be one time and one time only, but it seems you will create it once and reload many times. 3) in "TFHIROperationFactory.GetOperation" there is no comment showing were the result is filled . 4) in that same function your log saying "Waiting for Operations to be loaded" while it should say "try to load or wait" 5) You are accessing some IO operation i think, deducing that from the name "Settings.ReadInteger", most likely some IniFile, File, DB operation... irrelevant per se, but why doing it from locked section, halting all your threads, such operation can be done by one background thread on interval that satisfy your application need, again this valid operation and valid point due the way your threads are running, because from what i see you are letting the threads handling what every there, in different situation, all the threads are waiting on signal to start processing, but here you are just changing lanes for them, so reading the settings and apply with touching or blocking threads is valid point. 6) I don't like the following at all What the point of it if "TFHIROperationFactory.GetOperation" is using the same TMonitor.Enter(Self) ?!! These are the obvious points but i see few others, anyway,,, Don't complicate things for your self when it is absolutely not needed, redesign that in very simple way, your threads are consuming whatever they are fed, great and perfect for lock-free design, create and initialize another (temp) then perform all the operation you need like load and reload, then just swap it, to be on safe side you can use atomic operation to signal for you self that this line is thread critical line, now for the old, free it when its ref count is 0, if you are using refCounted Interfaces then this should happen automatically for you, if not then just add RefCount field for it, lets consumer threads add and dec it, then make sure the code will check if this is new and there is an old, (here the temp mentioned above will be not temp but temp field), if it has assigned value there this means the thread that will reach 0 by decreasing and the value is not null will signal a timer or a back ground thread to free it after some time. Hope that helps. -
Locking an Object
Kas Ob. replied to fastbike's topic in Algorithms, Data Structures and Class Design
My aim was the most readable code for OP to make sure he get the idea and enhance on it as he see fit. -
Locking an Object
Kas Ob. replied to fastbike's topic in Algorithms, Data Structures and Class Design
Remove all an be done in few ways, the easiest and simplest one is to centralize the access to that object and don't access it directly, use a getter, that getter can be function in singleton or global one, or just a property with getter, this getter will have CriticalSection instead of TMonitor, i just hate TMonitor, it is up to you after all, both will do fine. In that getter the locked section will active only if the field or the object is assigned meaning it will not cause locking once it is created, but if it is not yet assigned, the lock will be holding all threads except one, the creator, once it created and assigned the new callers will not enter locked section, and the waiting ones will be released, but the first check in the locked section will be to see if the object is assigned and created then exit. Just make sure the creating of that object doesn't fail or wait indefinitely. Something like this , more or less function TForm10.GetMyObject: TMyObject; var TempMyObject: TMyObject; begin Result := FMyObject; if Assigned(Result) then Exit; FCriticalSection.Enter; try Result := FMyObject; if Assigned(Result) then Exit; // Create MyObject in TempMyObject , DON'T CREATE FMyObject directly FMyObject := TempMyObject; Result := FMyObject; finally FCriticalSection.Release; end; end; -
fgxnative FGX Native - crossplatform mobile native development
Kas Ob. replied to Yaroslav Brovin's topic in Delphi Third-Party
Thank you ! I am in Ukraine and using the biggest ISP here, but didn't notice and didn't expect changing the language will change prices without changing the items listing themselves (names and prices). -
fgxnative FGX Native - crossplatform mobile native development
Kas Ob. replied to Yaroslav Brovin's topic in Delphi Third-Party
Clicking from here https://fgx-native.com/ru/buy.html also redirect this link to the English one https://forum.fgx-native.com/store/product/1-подписка-на-3-месяца-только-для-рф-и-снг/ -
fgxnative FGX Native - crossplatform mobile native development
Kas Ob. replied to Yaroslav Brovin's topic in Delphi Third-Party
Clicked on that link, here what i see One year for CIS is higher than the rest of the world with the discount. -
GTX SpeedStar F1, code name "Dawn", will make great name. As for the patches, numbers are something from different millennia, better something like AfterDawn or Breakfast, BroLaunch, "MorningCoffee The First of its Name"...
-
fgxnative FGX Native - crossplatform mobile native development
Kas Ob. replied to Yaroslav Brovin's topic in Delphi Third-Party
I can't reach a page with such prices from Ukraine ? -
Do local variables have a cost?
Kas Ob. replied to Nigel Thomas's topic in Algorithms, Data Structures and Class Design
Hard to tell, it depends on many things and the context around it. May be, again no way to tell. I suggest to prefer the readability always, when the efficiency is needed only then you have to test and benchmark different code/algorithms/approaches... , you can profile the code and make sure that there is wasted speed, or even better is to look at the generated assembly, but this is not everyone cup of tea. -
Why does Delphi 12 marginally bloat EXE file size compared to 11.1?
Kas Ob. replied to PaulM117's topic in RTL and Delphi Object Pascal
@Stefan Glienke Right on point there. I want to add one thing about inc/dec vs add/sub 1, they are not faster nor slower, but there is side effect which might sometimes yield a difference and speed boost, the effect is from the competition between two CPU enhancement Out-of-Order-Execution and Speculative Execution, older CPUs have OoOE mostly and little of SE, through generations CPUs are depending on SE more as it enhance and gain more than OoOE, the thing is both share in part (or all i have no idea) of the OoOE window, which is a buffer that handle the Re-Order buffer ROB also, while SE has an extra window/buffer to handle all branches/variations of executions, here these branches are not only branching form jumps only but from calculations, like adc the result might be two variants and that depend on the carry C flag, and this is the real difference, while as you know inc/dec change C flag, add/sub 1 will not, the difference is inc/dec will save bytes to fit in OoOE to execute more instruction, while SE will branching the whole block of following instruction due the change of C flag, thus shorten its overall can-be-executed. This effect can be witness if C flag is used in a loop to detect or checked, also can be observed when the loop is bigger than the OoOE window, on my SandyBridge that window size is 168 byte, and SE is not playing any role, on more modern CPU that windows is more than 224 bytes, i couldn't find a table or a list of comparison for many CPUs, but observed this on big loops running on modern XEONs, against the test on my SandyBridge where the loop is big more than ~180 byte of instructions and add/sub where faster by ~%5, and on mine add/sub was slower by ~%1. -
Memory leak with anonymous methods.
Kas Ob. replied to pyscripter's topic in RTL and Delphi Object Pascal
No leak on XE8 and Seattle.- 4 replies
-
- anonymousmethods
- threads
-
(and 1 more)
Tagged with:
-
I have to point that they are not installed by default for good reason, so i recommend to install them only on project bases instead of keep them installed and laoded on the IDE. These components will bring huge overhead from Windows GUI shell, background threads, hooks, etc... they will affect the IDE stability and responsiveness and bring Windows Defender hooks in your IDE, so nice to have them on specific projects but not all the time loaded with the IDE, you can install them and disable them from loading and enable them only when needed in a project.
-
class EOleSysError with message 'Class not registered'
Kas Ob. replied to SneakyPeaky99's topic in Delphi IDE and APIs
Here is a better example than the above, you can see the implementation in full. -
class EOleSysError with message 'Class not registered'
Kas Ob. replied to SneakyPeaky99's topic in Delphi IDE and APIs
Drop the DLLs one by one in EXE Explorer, then in Resource tab check the Registry also you might find the TypeLib there, And because you have a working version use Jon method above is more concise for finding the working DLL than searching the DLLs for the needed class. -
class EOleSysError with message 'Class not registered'
Kas Ob. replied to SneakyPeaky99's topic in Delphi IDE and APIs
Also try the super duper EXE Explorer from Mitec https://mitec.cz/exe.html you should be able to find your library and class in a DLL. -
class EOleSysError with message 'Class not registered'
Kas Ob. replied to SneakyPeaky99's topic in Delphi IDE and APIs
Then try to register them all, no harm from that. -
class EOleSysError with message 'Class not registered'
Kas Ob. replied to SneakyPeaky99's topic in Delphi IDE and APIs
Did you register that DLL with that specific class ? You listed what you did but did not mention if it is registered for fact, loading a DLL doesn't mean the COM component is registered or known for the system. as for search the internet, you should search for the error message first then try the GUID for that specific class, try "windows register com dll class" or something else and find how hard complex it is to register one. -
Prevent Multiple Instance from running at the same time
Kas Ob. replied to new_x's topic in Windows API
Your code is closing the handle, so how the next instance will get ERROR_ALREADY_EXISTS ?! Redesign that. -
Suggestion of naming convention for enumerators
Kas Ob. replied to JohnLM's topic in Algorithms, Data Structures and Class Design
I agree with Peter, but on other hand there a scenario where i did similar thing, i needed to serialize many data in compact structure on disk, big data and they needed to be loaded and saved fast, so yes, sometimes it is needed, where the data will have first byte as the index of the encoder then the 4 bytes for the length then the data itself, even if this not case, as process of experimenting and learning it is good to do it once at least in life. now to the OP question Here i have few thing to point 1) SetLength is useless. 2) both function should have their parameters as const, both String and TBytes are managed types, it is better to tell the compiler that they are constant. 3) you are building your own library which is good thing in the long run, here i suggest to use distinctive functions for your own, prefix their names with something you will use and recognize, something like JmStr2Bytes, JmBytes2Str do this for all your code and you will have good time with autocomplete. 4) refrain if possible from using underscore _ , it is ugly, and later you will start to hate it, also the lowercase is something personal but why not give Camel a chance and see if it will click with you. Really i am not sure about the question, is it about the functions/procedures names, the enums or both? but .... my opinion is one for all use prefixes, Jm Jl jL Jm Lm Ml ML mL Mj , just pick any two letters, because it is nice and almost never conflict with other libraries you will use. -
I would suggest logarithmic graph for such data, give them a chance or at least research them.
-
-
Thank you !, and as you asked for, it still refuse to compile on XE8 or Seattle, the problem is with this part, so i worked around to make it work at minimum. Well, you missed my point of test, in my opinion when testing for artefacts or ringing or color bleeding should start at the simplest and smallest details, your TextAndLines doesn't follow my test, my lines were at 1 pixel every 5, i wanted to see text and their readability in this one, and it did in fact showed me a lot. So here my Lines and text procedure LinesAndTextBitmap(const bmp: TBitmap; w: integer); var X, Y: Integer; begin bmp.PixelFormat := pf32bit; bmp.SetSize(w,w); bmp.Canvas.Font.Size := 24; bmp.Canvas.Font.Color := clRed; bmp.Canvas.TextOut(10, 10, 'Test'); bmp.Canvas.Font.Size := 48; bmp.Canvas.Font.Color := clGreen; bmp.Canvas.TextOut(50, 50, 'Test'); bmp.Canvas.Font.Size := 32; bmp.Canvas.Font.Color := clBlue; bmp.Canvas.TextOut(150, 150, 'Test'); X := 5; while X < w do begin bmp.Canvas.MoveTo(X, 5); bmp.Canvas.LineTo(X, bmp.Height - 5); Inc(X, 5); end; Y := 5; while Y < w do begin bmp.Canvas.MoveTo(5, Y); bmp.Canvas.LineTo(bmp.Width - 5, Y); Inc(Y, 5); end; end; You can adjust the 5 also to make it target the little details, there is the devil. Now to the result and you gonna love it As for speed, it is waayyyy slow and very eligible for optimization, a lot of tweaking and definitely assembly will give it a great push, so i will find time and more important than time, wait until my OCD kick and will dig into it, heck i have many of those functions already somewhere written in fast SIMD, no promises though, just i have too many dark days, unlike your The long Dark, i am in a dark place for many years now, coding sometimes helps to see some light in a tunnel. If you would please, just skip using anonymous methods, this will push the compatibility many Delphi versions back, as for short code, well not worth it for open source and great library. Also as you already did it and got it, why not add all these mentioned filters (in Wikipedia and the ImageMagick links) it is merely copy and paste, right ?, so you will have a filter like Adobe and What every the hell is Paint Net, and so fourth, cost nothing performance like.