Jump to content

Brian Evans

Members
  • Content Count

    312
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by Brian Evans


  1. I think you would benefit from taking a break and acquiring some Delphi custom component development and debugging skills. Impatience to do something when you have not yet acquired the necessary skills and knowledge usually leads to frustration. The basics of component development and debugging have not changed much so even older books/guides are still useful.  Ray Konopka wrote some early books on Delphi component development any which would be a good resource if you can get your hands on one. 

    • Like 1

  2. You can compress floating values in a small range into an integer evenly.

     

    AnInteger = N - RangeStart * (IntegerRange / (RangeEnd - RangeStart))

     

    N = (AnInteger /  (IntegerRange / (RangeEnd - RangeStart))) + RangeStart

     

    For two byte unsigned integers this only gives ~344 divisions between the whole numbers in your 30-220 range so not quite 3 decimal places.

     


  3. Your problem.  Exception objects are not thread safe so accessing them from two different threads when one is about to destroy it anyway is never going to end well.

     

    Also it is totally pointless - any threading so writes don't block should be done in the logging library itself not every place that logs something. 

     

     


  4. The error message shows a colon at the start of the path\file. 

     

    ":C:\Prog2\employee.fdb"

     

    Your code shows signs of leftovers from trying different things. Make a NEW project and get a connection working with as little as possible. Once done clean up the old code to match. 

     


  5. Type the constant by replacing 1 with UInt64(1) in your bit() function. Works in 32 and 64 bit targets.

     Result := ((Uint64(1) shl idx) and value) <> 0;

    The reason is bit shifts are modulo the size of the type of the arguments. So no error and you get short shifted when one argument is 32 bits which is the default for integer constants.  


  6. 1 hour ago, Incus J said:

    Any tips for using the FileManager API directly?  Never tried to call macOS/Cocoa directly from Delphi.  Does the RTL include functions to help with that?  I'm guessing converting parameter types from Cocoa to Delphi and back again might be tricky.

    There is some code / interfaces in Macapi.foundation including one for NSFileManager, at least in Delphi 11.1.  Used by TPath.InternalGetMACOSPath in System.IOUtils when {$IFDEF MACOS} which you can look at to get some ideas at least.

    • Thanks 1

  7. 22 hours ago, Attila Kovacs said:

    I don't believe you. There was no bookmark in Delphi 1. Just tested with Devart's UniQuery, I can close the dataset and open it again, the bookmark is still valid.

    Maybe you are referring to some old BDE component or some other 3rd party which is for some reason saves an instance pointer/memory address too, instead of just key-field values. But I have never seen that before.

     

     

    There certainly was GetBookmark/GotoBookMark()/FreeBookMark() in Delphi 1. Attached is an image of the Delphi 1 help topic for GetBookmark, notice what the "Note:" at the bottom says:

     

    CaptureDelphi1GetBookmarkHelp.PNG


  8. 14 hours ago, Piotr0603 said:

    I did read and have no idea what I did wrong

    Did you notice the target shown as assets\internal in the help section linked? Try it with just what the help suggests to start with. Usually prefer .\ vs an empty directory string as well. 


  9. Microsoft has in the past put large amounts of resources into the 'next big thing' followed by it being abandoned. Chasing them is a path to ruin for any smaller companies. Even good products get poor support when they decide to chase something else. Windows Phone 7, 8 and 10, and Windows RT all on ARM and all now deprecated dead ends for example. Or the whole UWP / UWA mess where it seems to be on the way out then comes back. Not a very stable base for third party support. 

     

    Not sure it is worth chasing ARM64 yet. 


  10. Gave up on this decades ago and used FlashFiler then NexusDB instead.  Mainly for the ease of going from single user embedded to multi-user client/server without licensing issues. 

     

    Note for single user applications higher editions of Delphi come with redistribution rights for IBLite and IBToGo. It's only multiuser that needs server licensing that can cause issues for some sales models like yours. 


  11. I would not have PAServer accessible on a public IP. 

     

    Since you are already connecting by SSH I would suggest a SSH tunnel which redirects a local port to a remote port over a SSH connection. 


  12. There is no built-in query editor in Delphi for TDataSet descendants. Some third party components provide them and some include being able to run the query. One example is FireDac where it accessed by double left clicking or right clicking the component. The dbGo components provide no such editor.  


  13. Likely the reconnect failed and latter on after the error dialog is closed the connection gets opened again and the application continues on.

     

    A FDConnection has some events to give you a chance to handle exceptions or log what is happening: OnError, OnLogin, OnLost, OnRecover and OnRestored.  If you add some logging to OnLost with a timestamp you should be able to tell what is going on and when. 


  14. A quick look at the file (searched Bing for the 2022VAERSDATA.csv) and it looks like double quotes within a string field are escaped with a double quote.  As well only string fields that contain commas or double quotes appear to be enclosed in double quotes. Will take a more detailed look when I get a chance. 

    LOAD DATA local INFILE 'c:/programdata/mysql/mysql server 8.0/uploads/2022VAERSDATA.csv'
    INTO TABLE data
    CHARACTER SET latin1  FIELDS TERMINATED BY ','  OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"'
    IGNORE 1 LINES

  15. The MySQL LOAD DATA statement can certainly handle all of that not sure why you think otherwise? 

     

    MySQL :: MySQL 5.7 Reference Manual :: 13.2.6 LOAD DATA Statement

     

    The [{FIELDS | COLUMNS} [TERMINATED BY 'string'] [[OPTIONALLY] ENCLOSED BY 'char'] [ESCAPED BY 'char'can handle double quotes. 

    The SET col_name={expr | DEFAULT}  section can be used for date, Boolean or other field conversions as needed.

     

×