mikerabat
Members-
Content Count
36 -
Joined
-
Last visited
-
Days Won
1
mikerabat last won the day on December 19 2018
mikerabat had the most liked content!
Community Reputation
20 ExcellentRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Intel Simd-sort library
mikerabat replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
I'm not sure about exactly this library but some predecessors indeed were able to sort pointer list whereas the "key" is a float/int 32/64 . The key can be specified as an "offset" to the starting address -> this allows to sort pointers to records/classes.... at least that is the way they do it in "Fast quicksort Implementation using AVX Instructions" The definitions in the library for AVX512 are actually using arrays of templates so I guess that means that you can sort records right not only Double/float... ? This problem is solved by an algorithm that allows to extract the kth largest element (not only the median) -> basically it does the partitioning of quicksort but does not sort hte "unnecessary" half. That in fact allows to pick the median in O(n) (roughly) time.... And if you want to go fancy you can do a rolling median over an array of doubles. The algorithm can be found here: https://github.com/mikerabat/mrmath/blob/master/RollingMedMean.pas -
@David Heffernan That would be against the direction I develop here - first I need the working ASM đ then the tool can use the disassembly to create the db instructions....
-
Thanks for the input - I will beef up the tool to get at least the else part aligned on the right side đ that really looks nicer.
-
Jus FYI: That is intentional - the left side shall show the original assembler call the right side the DB translation -> my tool, that derrives the DB statements from the assembler code does a line by line comparison.
-
I just released an assembler optimzed (AVX2 set) Base64 encoding/decoding unit. check it out under https://github.com/mikerabat/fastbase64/ My reference implementation achieves up to 10 times speedup against the reference Indy implementation. Let me know what you think or if you encounter some errors...
-
That is actually interesting... If I use the same settings I got a different result (aka the annoying one). (sorry I cannot create such a neat little video đ ) I'll check if GExperts or DDevextension interfere here...
-
Sorry... the tab key is broken or at least behaves completly different than in Delphi 2010 (or afaik Delphi 10.4) which is ... anoying. e.g.: Consider the following code Result := Format('%s;%s;%s', [ DateToStr( fDay, Fmt), TimeToStr( fFrom, Fmt ), TimeToStr( fTo, Fmt ) ]); when you place the cursor just behind the '[' bracket and then press enter the cursor is placed just below the R of Result... so far so good. But... In previous Delphi versions - when tab is invoked - the cursor jumps to the ":" then to "F" of format. Now the tab just moves the cursor by 2 (acording to the setting) which is actually anyoing. Another case: Consider the following code (we like to have the then else block that way in case the statement is only one line aka without begin end): if fLunchLen > 0.01 then Result := Result + Format(';%s;%.1fh', [TimeToStr(fLunch, Fmt), fLunchLen], Fmt) else Result := Result + ';;'; // no free lunch... it bloody friday! When you place the cursor behind then, press enter -> press tab in previous delphi versions the cursor was placed just right below the then... now it only jumps by 2. any comments on how to get that old behaviour back is highly appreciated... kind regards Mike
-
sorry that doesn't help ... I have to hit tab quite often such that it jumps to the desired place. Anyone else that has problems with that? Or ... does anyone excatly know what changed in this version?
-
Reduce storage space for floating point range
mikerabat replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
You could do something like CBOR encoding does. Basically there they encode values based on the NEEDED space. If integer then encode it in an int8 - to int16. You can also check if the encoding would fit into a 16bit float (half a single) In addition it seems that a differential approach for each block could be feasable ... does it change much?? And of course at the end just compress the stream đ -
First: how often does the license change? Never had any case like that... Even windows update did not change it... Actually the articel that is referenced in the code has a few hints for such unique ID's.
-
Hey! We actually use the following code to get the system serial - maybe that can help: function GetSystemSerial : string; var FSWbemLocator : OLEVariant; FWMIService : OLEVariant; FWbemObjectSet: OLEVariant; FWbemObject : OLEVariant; oEnum : IEnumvariant; iValue : LongWord; begin CoInitialize(nil); try result:=''; FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); // ATT: we had a case, where on a Win2016 server, the system service failed to // execute this command. Changing the service to a local user solved the problem. // There has been 2 cases where the WMI service was corrupted or was not running. // -> to check: enter WmiMgmt.msc in the console and right click on the local wmi - control -> Properties // if an error occurs the repository seems to be corrupt // one time it helped to reset and rebuild the repository: // https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-rebuilding-the-wmi-repository/ba-p/373846 try FWMIService := FSWbemLocator.ConnectServer('localhost', 'root\CIMV2', '', ''); except on e : Exception do begin OutputDebugString(PChar('WMI service not properly running: '+e.Message+#13#10+ 'https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-rebuilding-the-wmi-repository/ba-p/373846')); raise; end; end; // todo: if we still support winxp this wmi class is not supported?!? FWbemObjectSet:= FWMIService.ExecQuery('SELECT UUID FROM Win32_ComputerSystemProduct','WQL',$00000020 {wbemFlagForwardOnly}); oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; if oEnum.Next(1, FWbemObject, iValue) = 0 then result:=String(FWbemObject.UUID); finally CoUninitialize; end; end; There is also another place where you could get some unique id: // from http://www.nextofwindows.com/the-best-way-to-uniquely-identify-a-windows-machine with OpenHKLMReadOnly('SOFTWARE\Microsoft\Cryptography', True) do begin AktMachineGuid:=ReadString('', 'MachineGuid', ''); Log('Machine guid: ' + AktMachineGuid); Free; end; hope that helps! kind regards Mike
-
I'm puzzled... Since Delphi 11 the tab key does not work as it has been the case in all the previous versions... I tried to setup the editor options the same way as my Delphi 2010 (or 10.4) installation but the tab key behaves differntly.... What I actually want is that when I press tab the cursor shall be placed after the last non whitespace from the previous line e.g. if you have var i : integer; begin |<- cursor here now when pressing tab the cursor shall jump the character after the n Also in Delphi 2010 it was standard if: if abc then begin while i < 10 do begin |<- e.g.: cursor here end; now the first tab jumps just right below the b of begin, a second tab to the end of begin That was standard for us for up until Delphi 10 ... but now in Delphi 11 I cannot get this working. it either works or it jumps the number of characters that has been defined in the TabStop field. anyone has a clue what there coudl be the problem? A also have DDevextensions and gexperts installed.... kind regards Mike
-
Error message: "'Cannot call Start on a running or suspended thread"
mikerabat replied to mikerabat's topic in Windows API
Thanks for all the input. Finally it turned out that a white listing software from https://seculution.de/ was the problem at all. They thought we did some bad stuff and their heuristics failed miserably. Please note that they also tried to just disable that software to rule them out but disabling was not enough âšī¸ -
Error message: "'Cannot call Start on a running or suspended thread"
mikerabat replied to mikerabat's topic in Windows API
Thanks Remy!! Right... the call to BeginThread actually suceeds - the callstack clearly indicates that it's the ResumeThread call that fails. So... the only thing I found online was that there is a right " THREAD_SUSPEND_RESUME " which may have some influence here... But I have absolutely no idea what could change that. Note that the code actually works on around 8k of installations but there are only a few (2 for now) that seem to make trouble in that regard. The thing is that if there are way fewer files to be loaded (e.g. 6-8) it works most of the time (aka not always)... Also the system worked for 2 years now without any problems... so I'm quite stunned that now something pops up. So... Is there any 3rd party or any configurable restrictions on Windows that disallow something like releasing many threads at once? kind regards Mike -
Error message: "'Cannot call Start on a running or suspended thread"
mikerabat posted a topic in Windows API
Hi all! In our system we load a bunch of files on startup in parallel so for each of these files we craete a thread that does that in the background. basically this is what how it is done: TEVentChannel is the data object that holds the data -> on the data object creation a thread (TEvtLoadThread = class(TThread)) is created which does the loading -> of course it is ensured that data access and loading is mutal exclusive. The snippset of code that is involved is: constructor TEventChannel.TEvtLoadThread.Create(parent: TEventChannel); begin fParent := parent; inherited Create(False); end; procedure TEventChannel.TEvtLoadThread.Execute; begin NameThreadForDebugging('Load '+AnsiString(fParent.ChanName)); // ########################################### // #### Just start loading the data try fParent.Reload; except on E : EChannelException do begin fParent.fLoadFailed := False; fParent.fDataLoaded := lsBadRecId; end; else // damaged file?? fParent.fDataLoaded := lsAll; fParent.Clear; fParent.fLoadFailed := True; end; end; My problem here is that on a system on which that code ran for over 2 years without problems now happens to fail with the error "Cannot call Start on a running or suspended thread" This error is issued in the TThread.Afterconstruction call and it seems that our system fails to create that thread... Looking at the TThread code it is most likely that the Thread could not be created so what on earth could be could interfere here? We tried to disable FSecure (or at least they claim no security system is monitoring our program) and Windows Defender without any change. Is there anything known out there that could limit an external program in such way? kind regards Mike