Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 09/28/20 in all areas

  1. Yet again the duck proves that it's invaluable.
  2. Lars Fosdal

    Delphi Version Numbers

    https://blog.dummzeuch.de/2014/04/17/determine-the-delphi-installation-directory-from-a-batch-file/ gives some clues. IMO, the versioning variations border on ridiculous.
  3. Fr0sT.Brutal

    Workaround for binary data in strings ...

    Well, while this example by R.Chen is good finding, it's a bit useless for Delphi. Why reinvent the wheel when Delphi already has codepage-neutral RawByteString that won't do any char conversion at all? AFAIU only "uint8" <=> "uint16" conversion is performed when assigning Rawbytes to unicode and vice versa.
  4. pyscripter

    TControl.SetParent

    The workaround for both issues is to follow a pattern such as this: Form.SetParent(Panel); Form.HandleNeeded; Form.ScaleForPPI(Panel.CurrentPPI);
  5. Hello all, when Delphi didn't know about unicode yet people would often stuff binary data into strings because strings were soooo practical and easy to manipulate. Yes that is and was bad practice and highly frowned upon, but as we all know it was done anyway and people got away with it because Delphi didn't care about code pages at the time so it just worked. It was even done in professional libraries. Code like that is very hard to port to newer Delphi versions which are unicode-enabled and codepage-aware and when you attempt a conversion, subtle errors may happen where you least expect it. If you still have precious old code libraries that do such things and which would be too costly or too complex to rewrite, you may consider trying this workaround as a quick & dirty fix: Type Binarystring= type Ansistring (437); The nice thing about code page 437 is that all 256 possible ansichar values map to valid unicode code points so you can safely assign these strings to Unicodestrings and back again without data loss and Delphi's built-in string functions won't break the binary data contained in these strings. So you just may me able to salvage some legacy code by declaring this new type and then replacing all "string" declarations in the code with "binarystring" and all (p)Char with (p)Ansichar. And yes, it's still bad practice... (The idea is originally from Raymond Chen: https://devblogs.microsoft.com/oldnewthing/20200831-00/?p=104142 )
  6. To avoid such hard-to-find mistakes, I use proper begin-end scopes ALWAYS ...... ( and I really, really mean ALWAYS, all the time ). That needs a lot of discipline over the years, that I dont always have. <cross-fingers> Since I did it that way, I never saw such failures again. </cross-fingers>
  7. Achim Kalwa

    remove ExplicitXxxx properties

    I know I am late to the party, but you might try the attached package for Delphi 10.4.1. It uses the hooking code from Andreas Hausladen's VclFixPack v1.4 to patch the TControl.DefineProperties method to a modified code, which does not write those Explicit* properties to the DFM file. Unpack the zip archive, open DControlsFix.dpk in Delphi 10.4.1, compile & install. There is nothing to customize. If this package is installed, the patch is active. If you like to get the default behaviour back, just uninstall the package. Use at your own risk ­čśë DControlsFix.zip
  8. David Heffernan

    Workaround for binary data in strings ...

    Kind of odd that you wouldn't just use a byte, TBytes.
  9. Jacek Laskowski

    livebindings without livebindings designer , code only

    I don't know the answer to the question, but it may be useful: https://github.com/malcolmgroves/FluentLiveBindings
  10. santiago

    Ctrl Tab Ide Plugin

    I was not even aware of the 'Buffer List'. But yes indeed, the 'Buffer List' provides the same functionality. But is not as convenient to use. However, if you are used to the way the Ctrl+Tab shortcut works and behaves in different development IDE's you will not be very happy with the 'Buffer List'. I would have still developed the Ctrl+Tab plugin if I had been aware of the 'Buffer List' before.
  11. Yeah, I must've expressed my point a bit unclear. I mean, if you have algo like this Recv(MsgSize, SizeOfMsgField); while MsgRecv < MsgSize do recvd := Recv(Buf[MsgRecv], MsgSize - MsgRecvd); and SizeOfMsgField > 1 there's a little probability to not have whole SizeOfMsgField of data in socket. So the reliable workflow is to read everything to buffer until you get the whole header and then start reading message body (considering the chunk you've already got). It's a universal pattern of reading with parsing. If a header is pretty big, reader could start parsing before it gets the whole header (f.ex., HTTP) but it splits data to logical parts anyway (CRLF-delimited lines). Well, I'd say "it is important to read at least some data". As TWSocket implements the read loop already internally, it's not necessary to create another loop in one's code. Sometimes it's more convenient and simple to read just as much as needed (f.ex. when parsing some message, read just one to the end and then exit OnDataAvail)
  12. Fr0sT.Brutal

    Drone control from mobile

    Fix: APPle :D
  13. I have no issues not caring about this. TCustomWSocket.TriggerDataAvailable has the loop already while Receive gets full buffer requested and TCustomWSocket.ASyncReceive loops as well unless the socket has wsoNoReceiveLoop option set. Anyway in my stream-reading classes I especially set wsoNoReceiveLoop, just making sure OnDataAvailable handler calls Receive in any condition (even 0-byte read is fine). With this setup ASyncReceive is called again and again until all data is read. Just foresee that your fixed size could arrive incomplete if it's > 1 byte. I usually read data to buffer to fill header and only then start reading the contents.
  14. var Request: string; begin Request := '{"appKey":"' + AppKey + '","secretKey":"' + SecretKey + '"}';´╗┐ Request is a local variable and the way you initialize it is perfectly correct. Each time Login() is called, you get a new variable (on the stack) which is initialized. If this doesn't work, then there is something elsewhere corrupting memory. That will be difficult to find. Especially for us which have no view on your code.
  15. Dave Nottage

    iOS libcrypto.a, libssl.a

    Sorry, I remember now that I did not obtain them from there. Trouble is: I cannot remember exactly where I obtained them, however I've now added them here: https://github.com/DelphiWorlds/Kastri/tree/master/ThirdParty/OpenSSL/1.0.2o/iOS
  16. https://community.idera.com/developer-tools/b/blog/posts/august-2019-delphi-android-beta-plans-august-roadmap-update It was planned for mid-2020. But it is late.
  17. Ouch! I stopped using form/frame inheritance a long time (ok, my code still has a few legacy instances of this) due to IDE instability. And yes @Der sch├Âne G├╝nther is correct, pay attention to your dfm's when committing changes. I prefer composition over inheritance these days, it's more work initially but in the long run it's just simpler for the IDE to deal with and results in less lost time restarting the IDE.
  18. Uwe Raabe

    TControl.SetParent

    You are not alone: Parented controls with free notifications aren't scaled Frame with Assigned PopupMenu is wrong Displayed on high DPI A scaled form gets resized to design time ClientWidth/ClientHeight when embeded in a parent form
  19. David Heffernan

    RadioGroup layout

    Imagine if you have users with names that don't begin with one of the 26 letters used in the English language? What you should do is abandon this UI approach and let the user type.
  20. santiago

    Ctrl Tab Ide Plugin

    @Mike Torrettinni Am happy the plugin is of use to you. Great suggestion ­čÖé Modified files are now marked with an asterisk. I think that works well enough.
  21. Attila Kovacs

    Button needs two clicks

    a swallowed windows message like button down / up, usually when you manipulate the focus inside events, for example
  22. There's a lot of noise in here. It seems you don't really understand where these characters are coming from and are in trial and error programming mode. The advice from the wise heads here is to understand what is going on, and then work out how to tackle it. You don't seem to want to heed that advice. That's fine, it's your choice. But we don't need a blow by blow account of your trial and error coding. That's only meaningful to you.
  23. It's not only about deleting components, it basically affects any change, like reparenting, renaming and even resizing. The best part is that you will only find out by either viewing the parent form/frame in the IDE, or at runtime. The core reason is that inherited forms/frames/data modules often (not always) have extreme redundancy. Look at their DFM files. They repeat their parents content. This is especially funny when you have a huge ImageList that gets copied again and again into dozens of subclasses. The only solution I could ever find is to always pay attention to your DFM files. At every commit in your source control system, do check out your DFM files! Undo changes that were added automatically although you didn't change anything. When I work in Delphi with things that involve the user interface, I spend roughly 30 % of my time reverting redundant changes in DFM files.
  24. microtronx

    Delphi 10.4.1 and the IDE FIx Pack

    Why we do not go another way ... and why does Embarcadero do not give Andreas free lifetime licenses or a lifetime subscription? We / Subscription owners pay a lot and sometimes we don't get anything within that subscription period + Andreas is doing / has done a lot for Delphi in the last years ... so this would be a very good roi for embarcadero IMO. I don't know if Andreas would accept this ... but if he can, it would be a big plus for delphi ...
  25. Thanks all for helping. We have now fixed the problem. Sorry If i confused you guys in the start with not be clear about the problem. I did not understand it myself. And started in wrong end. Learned a lot about unicode / utf8 last days. The problem was the Angular client app that did not handle a few control character in Json. It was correct sent from Delphi in Tjsonstring the character was #11 #3 #5 . We have lopped all fields in database and found a few places with this character, all of them did not work client site. After a data review, we have removed them with a script in db . All is working fine now. the DB is like 20 gb and there was a total of 355 fields with wrong character, not so many. all are old registration's , more that 2 years ago. We will make a check for this character when new registration occur in future. The angular team will also check why these character make the client crash. Thanks B
├Ś