Jump to content

Fr0sT.Brutal

Members
  • Content Count

    2268
  • Joined

  • Last visited

  • Days Won

    46

Everything posted by Fr0sT.Brutal

  1. Fr0sT.Brutal

    TCP server rejecting connections

    Check if the server rejects the very connections or just handshakes by telnet'ing to the host:port Is the server responsive when the issue occurs (i.e. if the message pump is active)? Does it listen on the port at all? Are you catching server's and clients' exceptions?
  2. Fr0sT.Brutal

    faster json library

    mORMot is usually very good in perf optimization and they have their own JSON
  3. Fr0sT.Brutal

    Anyone using an open-source ORM?

    https://github.com/Fr0sT-Brutal/awesome-pascal#database
  4. Fr0sT.Brutal

    TCP server rejecting connections

    The issue could be in dangling sockets - Windows keeps them for a while after closing. Ensure you have linger options disabled for server's client sockets https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-closesocket
  5. The only way is to get employed in Emba's compiler dev team, they have sources 🙂
  6. You can wrap two 32-bit `case`-s in one `if` if num <= High(UInt32) then case num else case num shr 32
  7. Fr0sT.Brutal

    how to flush buffers on Indy components

    If the connection doesn't break on transfer failure, you'll either have to analyze data stream for special "transfer broke" message or handle no-data-timeout. Alternatively you can wrap transfers into protocol messages so that client must be reading these messages always, then decide what's going on and what to do next - read data or request transfer again starting from some position. I'd go this way: CLI: <get filename from NNN> SRV: <data filename chunksize> [...chunksize bytes of data...] SRV: <data filename break> - failure indicator CLI: <get filename from MMM>
  8. Havent't tried with Android but debugger has such option as "Attach to process". You don't need to run your app under debugger from the very beginning, you can attach to it right when a bug happens.
  9. Fr0sT.Brutal

    Best way to store data

    The question is too broad currently. Answer depends on your operations. Linked lists are very good for adding/deleting but slower for search. Arrays are the opposite. Maybe you should consider hashmaps (dictionaries in Delphi). They simplify searching by key fields. In general, I'd try to avoid 3rd party components if native classes could satisfy your needs.
  10. Fr0sT.Brutal

    TIdHTTPProxyServer hangs when used with RemObjects

    Sure you do! I was addressing Keesver.
  11. Fr0sT.Brutal

    TIdHTTPProxyServer hangs when used with RemObjects

    Seems you misunderstood a bit, CONNECT is just a method of establishing connection via proxy. It also frequently referred to as HTTP tunnel. With this method proxy doesn't have to analyse HTTP headers, it just serves as pipe. Less actions => less bugs
  12. Fr0sT.Brutal

    TIdHTTPProxyServer hangs when used with RemObjects

    Isn't there an option to just force CONNECT method for all destinations? HTTP proxy is lazy for clients but awful for servers
  13. Fr0sT.Brutal

    Playing an MP4 animation / unsupported media file / cppbuilder

    I guess only by inspecting asm code and registers. Search for Succeeded's body (Status and HRESULT($80000000) = 0;) and see the register/memory cell it AND's with
  14. You better derive TList<TObj> from classic TList, only overriding Get/Put methods so only those slim overrides would be compiled for each type used. type TTest = class fobj: TObject; end; TTest<T: class> = class(TTest) function get: T; end; function TTest<T>.get: T; begin Result := fobj as T; end; var test_tform: TTest<TForm>;
  15. Fr0sT.Brutal

    Conditional compiling - Delphi has a bug

    That IF shouldn't be evaluated at all as it lays inside falsy outer block {$IF Declared(FPC_VERSION)}
  16. Fr0sT.Brutal

    Scrap TVirtualStringTree using Win 32 api (SendMessage)

    Try it 🙂 accessibility was implemented relatively recently but I believe TVM_GETITEM had been there much longer
  17. Fr0sT.Brutal

    Delphi CE 10.4.2 - Command Line Compilation

    So I was right finally. Emba needs to change their feature matrix table
  18. Fr0sT.Brutal

    Scrap TVirtualStringTree using Win 32 api (SendMessage)

    VST doesn't have TreeView interface but it implements accessibility API (in VirtualTrees.Accessibility) and procedure TBaseVirtualTree.TVMGetItem(var Message: TMessage); message TVM_GETITEM; // Screen reader support function. The method returns information about a particular node.
  19. Fr0sT.Brutal

    Delphi CE 10.4.2 - Command Line Compilation

    Well, feature matrix says it should be available really but I vaguely remember some issues reported with cmdline on CE...
  20. Fr0sT.Brutal

    Components4developers???

    Or Chinese ones...
  21. Fr0sT.Brutal

    Delphi CE 10.4.2 - Command Line Compilation

    AFAIK CE doesn't allow cmd line compiling. One of limitations of free version
  22. Fr0sT.Brutal

    Write image to database

    Use the proper FireDAC's BLOBStream type instead of TADOBlobStream
  23. Fr0sT.Brutal

    Write image to database

    Try this // Load JPG or PNG image from stream to picture. Format is auto detected. // Raise exception if something's wrong procedure LoadImageFromStream(Image: TImage; Stream: TStream); const JPGHeader: array[0..1] of Byte = ($FF, $D8); PNGHeader: array[0..3] of Byte = ($89, Byte('P'), Byte('N'), Byte('G')); var graphic: TGraphic; Header: array of Byte; begin graphic := nil; SetLength(Header, Max(Length(JPGHeader), Length(PNGHeader))); if Stream.Size > Length(Header) then try // Determine format by header Stream.Read(Pointer(Header)^, Length(Header)); if CompareMem(Header, @JPGHeader, Length(JPGHeader)) then graphic := TJPEGImage.Create else if CompareMem(Header, @PNGHeader, Length(PNGHeader)) then graphic := TPNGObject.Create else raise Exception.Create('Unsupported image format'); // Read the picture Stream.Position := 0; graphic.LoadFromStream(Stream); Image.Picture.Assign(graphic); finally FreeAndNil(graphic); end; end; ... if not Q.Query.FieldByName('Photo').IsNull then begin StmPhoto := TADOBlobStream.Create(Q.Query.FieldByName('Photo') as TBlobField, bmRead); try LoadImageFromStream(imgPhoto, StmPhoto); except on E: Exception do MessageDlg('Error loading photo:' + sLineBreak + E.Message, mtError, [mbOK], 0); end; StmPhoto.Free; end;
  24. Fr0sT.Brutal

    Modal dialog closes before user input

    try ... DropDownDialog.ShowModal; If mItemIndex <> -1 then FItemSelected := mItemIndex-1; else FItemSelected := -1; Result := True; finally DropDownDialog.Free; end; Side note Also there's no sense in resetting ModalResult. And what is mItemIndex? Seems like global var. I'd advise to make it a dialog's property to reduce dependencies.
  25. Best way WRT databases is generated SQL stored at client side or a change log stored in a table. But it could be tricky. Anyway the question is too broad to give concrete answers.
×