

Kas Ob.
Members-
Content Count
489 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Kas Ob.
-
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.
-
Use of dynamic control names
Kas Ob. replied to Bart Verbakel's topic in Algorithms, Data Structures and Class Design
I do use lists, i create a list lets, say i want a bunch of controls to be enabled or disabled when a specific value is right/wrong in an edit, register these controls once and use helper function or any other method you like, to enable or disable them, lists are great for grouping. you can hide and show also. -
The missed image from above
-
Dear, you already did all the right things and implemented contributors, i think you are overthinking it, your implementation is great and you are missing just few things to point you right, all these papers are talking about the weight of the neighbors and reduce them to specific formulas represented mathematically, in this case like here https://en.wikipedia.org/wiki/Mitchell–Netravali_filters , P(d) is referenced by P0, P1, P2, P3 the points in 4 direction from p the point you are calculating, while k(x) is a function calculating the weight, which you are already implemented and using with Lanczos, this implementation is almost universal for all filters as it is the best. now re-read these links, with that in mind and you don't need any source as reference, specially you are going to like this but it is not so clear as and Now you can use the same filter to generate blur and antialiasing or force ringing (halo's and ripple), and can't remember what was the blocking . I browsed your code in "View file" in WinRar , i saw MakeContributors and AntiNLanczos and i confident you can just duplicate AntiNLanczos for all the above in the table with B and C or replace them with the calculated value like mine for faster calculation, while MakeContributors most likely doesn't need any change or a may be a little, i am sure you can solve this as it is way easier than how it sound and look. In AntiNLanczos const sqrt3 = 1.7320508075688; b = -27 * sqrt3 / 2 / Pi; d = -1.4 * 0.8933976645E-1; e = 1.0 * 0.1650337606E-1; a = 0.5 - e - d; function AntiNLanczos(x: double): double; var s: integer; begin s := 1; if x < 0 then begin x := -x; s := -1; end; if x < 1 / 3 then Result := (3 + (-162 + 3 / 2 * b + 270 * a + (648 - 9 * b - 1215 * a + (-729 + 27 / 2 * b + 1458 * a) * x) * x) * sqr(x)) * x else if x < 2 / 3 then Result := 1 / 2 * b - 31 * d + a + (-16 / 3 * b + 360 * d + (177 / 8 * b - 1620 * d + (-357 / 8 * b + 3510 * d + (351 / 8 * b - 3645 * d + (-135 / 8 * b + 1458 * d) * x) * x) * x) * x) * x else if x < 1 then Result := -3 / 2 * b - 512 * e + a + d + (9 * b + 3240 * e + (-171 / 8 * b - 8100 * e + (201 / 8 * b + 9990 * e + (-117 / 8 * b - 6075 * e + (27 / 8 * b + 1458 * e) * x) * x) * x) * x) * x else Result := 0.5; Result := s * Result; end; You need these constants a, b, d and e, with Mitchell–Netravali filters you will need only B and C, result is the weigth (w) and x is param , simple like that, only the difference is you are scaling first to do the clamping with shr 22 later , you can drop it or keep it, just adjust the values accordingly. and good luck, waiting to see your result images, as your sample and demos also not working on older Delphi, and please don't waste your time on compatibility now, i will nag you for that later.
-
There is this, irrelevant to the above pT.rgbBlue := Min((max(Total.b, 0) + $1FFFFF) shr 22, 255); pT.rgbGreen := Min((max(Total.g, 0) + $1FFFFF) shr 22, 255); pT.rgbRed := Min((max(Total.r, 0) + $1FFFFF) shr 22, 255); pT.rgbReserved := Min((max(Total.a, 0) + $1FFFFF) shr 22, 255); That is easier to read and understand as simple clamping, but Min and Max are not inlined functions and will waste hell of time just jumping and retunting for simple IF, i suggest to get rid of them with either inlined if possible or just old fashion IF's, these in assembly will be few instructions without any jumping, and in SIMD will be will be one pass for the four colors, but that for later talk.
-
Yet, you didn't mention how the import happen, here an imaginary scenario that will generate that behavior (more or less), if your application grabbing these imported data from internet and using event based network, then the data will come as message and will interfere with other messages, causing a growing delay, this will accumulate till the message queue is full or just the delay getting greater for the OS to detect it right away but after a while the respond from the application the OS decide it is frozen. as a solution in all cases switch to background operation, and don't use Application.ProcessMessage, it will save you great headache later and most likely should be removee it eventually.
-
It is intimidating at first glance, i offered them because you are using contributors, things for me fall in place when i looked at how imagemagick implemented. Yes these are BiCubic filter, here are the raw formula https://en.wikipedia.org/wiki/Mitchell–Netravali_filters Though you don't need that formula in particular, as the implementation will calculate the contributors, so you need B and C which are mentioned in wikipedia for Mitchell and in https://www.imagemagick.org/Usage/filter/#cubics My code for calculate the contributors are very simple procedure Calc(B, C: Single); begin Memo1.Lines.Add(FloatToStr((1 / 6) * (12 - 9 * B - 6 * C)) + ' * Sqr(Param) * Param + ' + FloatToStr((1 / 6) * (-18 + 12 * B + 6 * C)) + ' * Sqr(Param) + ' + FloatToStr((1 / 6) * (6 - 2 * B))); Memo1.Lines.Add(FloatToStr((1 / 6) * (-B - 6 * C)) + ' * Sqr(Param) * Param + ' + FloatToStr((1 / 6) * (6 * B + 30 * C)) + ' * Sqr(Param) + ' + FloatToStr((1 / 6) * (- 12 * B - 48 * C)) + ' * Param + ' + FloatToStr((1 / 6) * (8 * B + 24 * C))); Memo1.Lines.Add(''); end; var B, C, X: Single; begin Calc(0.3782, 0.3109); Calc(0.262, 0.3690); Calc(0.6796, 0.1602); Calc(1, 0); // for comparison end; the result 1.12180000543594 * Sqr(Param) * Param + -1.93270000815392 * Sqr(Param) + 0.873933335145315 -0.373933335145315 * Sqr(Param) * Param + 1.93270000815392 * Sqr(Param) + -3.24360001087189 * Param + 1.74786667029063 1.23800002038479 * Sqr(Param) * Param + -2.1070000231266 * Sqr(Param) + 0.912666668494542 -0.412666653593381 * Sqr(Param) * Param + 2.10699993371964 * Sqr(Param) + -3.47599989175797 * Param + 1.82533327738444 0.82039999961853 * Sqr(Param) * Param + -1.4805999994278 * Sqr(Param) + 0.77346666653951 -0.27346666653951 * Sqr(Param) * Param + 1.4805999994278 * Sqr(Param) + -2.64079999923706 * Param + 1.54693333307902 0.5 * Sqr(Param) * Param + -1 * Sqr(Param) + 0.666666666666667 -0.166666666666667 * Sqr(Param) * Param + 1 * Sqr(Param) + -2 * Param + 1.33333333333333 These are w (weight) and where param is delta x, i added them on AlphaSkin as i mention and the implementation here doesn't scale by $800 like yours, yet i see no problem in doing so. I suggested to have have a look at ImageMagick, yet i don't see you need to, did nice job with cylindrical filter (Lanczos), and switching to bicubic will be minimum, i think your adjustments will touch only the contributors.
-
It will detect frozen GUI, aka not responding, which is clearly visible, so its report as frozen is useless in this case, also will not report rouge while loop going for full 32 bit or 31 bit integer, or just failed code to increase or .... only human can detect broken algorithm.
-
Register COM Object for create process/Fightiing AntiVirus
Kas Ob. replied to RTollison's topic in General Help
Yes and thank for expansion on that. Just an idea to entertain, how about QEmu as emulator running old Windows or may be just a local Hyper-V hosting the compiling process, or even ship the need-to-be-compiled files to another server/PC compile then return the result. A question on the side doesn't the compiler have batch mode ? also what type of the harddrive are you using (HDD/SSD)? -
You did not mention if there is background thread, also more details will help, like importing from files on local disk, network disk, internet .... When running with debugger how much time does it take ? so many details may be you are missing, and we are gonna just guess. Brain answer is right on point, and i want to add one more situation where i saw more or less similar behavior, you most likely have loops and checks processing these data, and one critical variable is not initialized, like, a situation where inside the debugger the value by default is X (may be 0 or just something) and without the debugger it is not X, so the fast way to check is after running and application and it went white (froze), attach the debugger and try to make sense from the stack, step and run and follow the main thread running. or generate a detailed log for your loops, every loop or just log the import and process in few checkpoints and follow which one is the faulty then expand on that section with more logging, you can use DebugOutputString or any other logging method, all will do.
-
I faced this problem many time and almost always, converted the view into table, So i would suggest ,to make the file name and line number as they are, move the result to right and up, hence the first line in each section (result) will have the file name and the first result and line number while the result form the same file will only result under the first one, hope that is clear, also make the result switch background color for the same file, between two or more color, something easy on the eyes but yet will show the result grouping. Well Windows Paint is not Photoshop, yet i am happy with my Paint talent 😎
-
Tracking down exception in initialization section ? (RaiseExceptObject)
Kas Ob. replied to Eric Grange's topic in RTL and Delphi Object Pascal
I have this theory, The call stack is clearly shows this sequence calls SysInit -> System -> SysUtils, but based on my observation and my lack to trust the map file, which me be unfounded, anyway, SysUtils called few times before Initialization for class constructor for TLanguages, TEncoding, Exception.Create, TOSVersion.Create then Initialization So the question here, do you overload (define) an Exception and use it in some Initialization section for some unit, or any of the rest mentioned above ? This might confused the compiler and Exception is not initialized yet and its value is just arbitrary, this might explain the first success and a failure on the second. -
It would be nice if share with us your final result for best solution, and thank you in advance.
-
Tracking down exception in initialization section ? (RaiseExceptObject)
Kas Ob. replied to Eric Grange's topic in RTL and Delphi Object Pascal
Away from the first two it looks accurate, never looked into it, thank you.