Leaderboard
Popular Content
Showing content with the highest reputation on 10/05/23 in all areas
-
I haven't seen any blogs or public news about Rad 12 Beta (Yukon) yet (except directly from Embarcadero). This is the link where Dave reports some important news: https://delphiworlds.com/2023/09/yukon-is-coming/
-
Setting the drop down width of a Combobox in Delphi
dummzeuch posted a topic in Tips / Blogs / Tutorials / Videos
By default, the width of the drop down list of a TComboBox is the same as the width of the control itself, and even in the latest Delphi version there apparently is no property to set it. Why is that so? Good question. There are probably many third party controls that offer this because it is rather simple to implement. But on the other hand, if it is that simple, why isn’t it a feature of the default control? It can really be a pain in the lower back that some entries are just not displayed correctly as seen in the picture above. Setting the drop down width is as simple as sending the CB_SETDROPPEDWIDTH message to the control’s handle: 1 SendMessage(TheCombobox.Handle, CB_SETDROPPEDWIDTH, MinimumWidthInPixels, 0); It does not allow to shrink the width of the drop down list though, because it sets the minimum width, not the actual width. There is this answer on StackOverflow for that particular problem. The result isn’t very visually appealing though, because the list is left aligned rather than right. Read on in my blog post https://blog.dummzeuch.de/2019/06/22/setting-the-drop-down-width-of-a-combobox-in-delphi/ -
I have added a demo to the HowTo repo that demonstrates how to achieve this. Please read the readme for instructions. Note that there is no special folder - it's a case of configuration in order to share files from the documents folder.
-
Getting RDSEED with Delphi
Kas Ob. replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
Also want to point to OP, about this retries recommendation 5.2.1 Retry Recommendations It is recommended that applications attempt 10 retries in a tight loop in the unlikely event that the RDRAND instruction does not return a random number. This number is based on a binomial probability argument: given the design margins of the DRNG, the odds of ten failures in a row are astronomically small and would in fact be an indication of a larger CPU issue. So 10 should be enough. -
Getting RDSEED with Delphi
Kas Ob. replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
And the x86 is even shorter function RDSEED32(aRetryCount: UInt32 = 0): UInt32; asm inc edx @LOOP: dec edx js @Exit DB $0F, $C7, $F8 // RDSEED EAX jnc @LOOP @EXIT: end; function RDRAND32(aRetryCount: UInt32 = 0): UInt32; asm inc edx @LOOP: dec edx js @Exit DB $48, $0F, $C7, $F0 // RDRAND EAX jnc @LOOP @EXIT: end; My CPU doesn't support these instructions, so i wrote them on XDBG64 then pasted them on the IDE, any way this code should be checked for support on CPU side. -
Getting RDSEED with Delphi
DelphiUdIT replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
RDSEED and RDRAND are available since (https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html) : RDRAND = 3rd Generation Intel Core processors, Intel Xeon processor E3-1200 v2 product family, Intel Xeon processor E5 v2 and E7 v2 families, Intel Atom processor based on Silvermont microarchitecture; RDSEED = Intel Core M processor family, 5th Generation Intel Core processor family, Intel Atom processor based on Goldmont microarchitecture; Like you told, the functions may fail and you must check the carry flag (CF=1) and loop until that. I don't check the opcode but i think you are able to use mnemonic notation to write asm code like this: {$IFDEF WIN64} function GetRandom: UInt64; register; asm @here: rdseed, RAX //RAX return value 64 bit (WIN64) jnc @here end; {$ELSE} function GetRandom: UInt32; register; asm @here: rdseed, EAX //EAX return value 32 bit (WIN32) jnc @here end; {$ENDIF} You can use also UInt64 with full random ( 😉 ) on 32 bit program like this: //ONLY ON WIN32 function GetRandom: UInt64; register; asm @here1: rdseed, EAX //EAX return value low 32 bit (WIN32) jnc @here1 @here2: rdseed, EDX //EDX return value high 32 bit (WIN32) jnc @here2 // UInt64 value on 32bit = EDX:EAX end; Bye -
Setting the drop down width of a Combobox in Delphi
Stompie replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
In Delphi 11.2 (maybe also in earlier versions), I have noticed that there now is the property "AutoDropDownWidth" on "TComboBox" to do this. -
TSslHttpRest and multipart/form-data
FPiette replied to ogalonzo's topic in ICS - Internet Component Suite
Thanks for your feedback. It's important for the community to have the final resolution. -
An interesting read on implementing some data structures
Stefan Glienke replied to Tommi Prami's topic in Algorithms, Data Structures and Class Design
Anyone serious about implementing any data structures that require heap allocation should consider some sort of suballocation pattern to avoid or mitigate memory fragmentation. Also, there is a reason why things like rebuilding indexes exist in databases. -
TSslHttpRest and multipart/form-data
ogalonzo replied to ogalonzo's topic in ICS - Internet Component Suite
Finally managed to solve it. I was wrong about the image, I had to send it but in binary form. Final code is this, unnecesary parts removed: {msCont = TMemoryStream bwCont = TBinaryWriter fs = TFileStream} s:='capture.jpg'; strMIMEBoundary:=IntToHex(Random(MaxInt), 8); { Note: my device requires digest authentication, change or delete next three lines if yours does not } HttpCli1.ServerAuth:=httpAuthDigest; HttpCli1.Username:='xxxx'; HttpCli1.Password:='xxxx'; HttpCli1.ExtraHeaders.Add('Connection=keep-alive'); HttpCli1.ContentTypePost:= 'multipart/form-data; boundary=' + strMIMEBoundary; strMIMEBoundary:='--' + strMIMEBoundary; slBuf.LoadFromFile(ExtractFilePath(Application.ExeName) + 'data.json', TEncoding.UTF8); msCont:=TMemoryStream.Create(); bwCont:=TBinaryWriter.Create(msCont); bwCont.Write(TEncoding.UTF8.GetBytes(strMIMEBoundary + sLineBreak + 'Content-Disposition: form-data; name="data"' + sLinebreak + sLinebreak)); bwCont.Write(TEncoding.UTF8.GetBytes(slBuf.Text)); bwCont.Write(TEncoding.UTF8.GetBytes(strMIMEBoundary + sLineBreak)); bwCont.Write(TEncoding.UTF8.GetBytes('Content-Disposition: form-data; name="image"; filename="capture.jpg"' + sLineBreak)); bwCont.Write(TEncoding.UTF8.GetBytes('Content-Type: image/jpeg' + sLineBreak + sLinebreak)); { Create stream from image } fs:=TFileStream.Create(s, fmOpenRead); fs.Position:=0; { Dump entire image to content } msCont.CopyFrom(fs, fs.Size); fs.Free(); { Write MIME end marker } bwCont.Write(TEncoding.UTF8.GetBytes(sLineBreak + strMIMEBoundary + '--' + sLineBreak)); bwCont.Free(); ss:=TStringStream.Create(); msCont.Position:=0; HttpCli1.SendStream:=msCont; HttpCli1.SendStream.Position:=0; HttpCli1.RcvdStream:=ss; ss.Position:=0; HttpCli1.URL:='http://' + STR_HOST + '/ISAPI/Intelligent/FDLib/FaceDataRecord?format=json'; HttpCli1.Post(); ss.Free() end; End Thanks to everyone for your time. -
I also had issues with iOS platform in the past and solution was to install MacOS platform too.
-
Many thanks! I tried uninstall and reinstall RAD Studio but it still did not work until I checked to install Delphi MacOS platform support.
-
However,
-
https://delphiworlds.com/2023/09/yukon-is-coming/ https://dalijap.blogspot.com/2023/09/coming-in-delphi-12-disabled-floating.html https://blog.marcocantu.com/blog/2023-09-yukonbeta-stringliterals.html MVPs were given permission to start blogging just a few days ago, but they have to be approved by Embarcadero before they're published. so I'm sure there will be more blog posts coming soon.
-
Are TCompressionStream and TDecompressionStream thread safe?
Dalija Prasnikar replied to c0d3r's topic in Algorithms, Data Structures and Class Design
Generally any kind of stream should be suitable for using in background threads, but also they cannot be simultaneously accessed and shared between threads. Just look at it logically - how can you use stream that holds a state (if nothing else than current position that changes as you read and write) be thread-safe? While you could in theory protect simultaneous access with locks and share stream across threads, you wouldn't gain much from that as stream would have to be locked and accessible to one thread at the time. If you think you could speed some operation by sharing stream and using is in parallel, you will only slow the whole process down, not speed it up. When using TCompressionStream and TDecompressionStream in background thread, OpProgress event handler will run in the context of background thread and you need to take that into account if you want to show progress in the UI and synchronize code. -
Embarcadero's DPI handling is still quite broken. They have taken several major releases to work on it, and it still has problems. You are probably best off simply disabling DPI awareness at the project level, and then scale your UI in your own code as needed.
-
Setting the drop down width of a Combobox in Delphi
Daniel replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
hm. No. .. ? Why should it be? -
Setting the drop down width of a Combobox in Delphi
Uwe Raabe replied to dummzeuch's topic in Tips / Blogs / Tutorials / Videos
In most cases the widened list is of only limited benefit when the selected item doesn't fit into the edit field either. -
Hey guys! I wanted to share my matrix library with you basically it contains tons of function for matrix manipulation (add, sub, mult, inverse) and higher order functions (SVD, CCA, PLS and tons more) The library is highly optimized (handoptimized assembler, AVX, SSE, FMA support) and can be multithreaded. Check out the repository on https://github.com/mikerabat/mrmath and check some tiny examples on: http://www.mrsoft.org/home/downloads.html hope you have fun with that ;) kind regards Mike