Jump to content

bobD

Members
  • Content Count

    32
  • Joined

  • Last visited

Everything posted by bobD

  1. Basically, program needs to act differently if at home or away--so how do I know? I've looked at using Winsock and HostEnt := gethostbyaddr(@SocketAddr.sin_addr.S_addr, 4, AF_INET); and although that tells me if my home interbase server is available, in a dynamic DHCP environment that IP address isn't necessarily constant. And a call to addr 192.168.1.1 (home router and default DNS gateway) returns nil: the peer computers respond, but the router doesn't. Is there another way to get the name of the local network LAN that works both wired (desktop machines) and wifi? I'd like to try using winsock's gethostbyname but I haven't found a good use example. Or is there a better way? bobD
  2. bobD

    Strange IB connection issue

    I have a licensed IB server on my home network, accessed both hardwired (desktop machines) and over the network wifi On my laptop the connection is rock solid On my wife's laptop my Delphi program will connect when the computer is first booted up, but then consistently fails after a couple of minutes Same Delphi program, same build, same connection parameters. And as stated, it works on startup--just not later. This only started about a week or so ago, and since everything else is pretty much identical, I'm suspecting the latest Windows update: my laptop is Win11 and hers is Win10. Since my laptop always connects, I'm tending to rule out the server or connection settings...what else could it be? I did set up a new rule in the Windows firewall to allow outbound connection from my Delphi program, but that had no effect. I even tried turning the firewall off: again, no effect. I'm perplexed. Anyone seen anything like this--connecting on a fresh boot, but then consistently failing? bobD
  3. bobD

    Strange IB connection issue

    Definitely a name resolution problem, and I'm still blaming the OS updates. I did originally (years ago--like D7 era) start with calling the server 192.168.~ rather than by name in the connection parameters, but the router at that time (w/ dynamic DHCP services) would periodically reassign IPs, so that proved less stable than the name approach. Tentative solution for now: I turned on network sharing and discovery and redefined the network as private. Then I put incoming traffic rules on the server firewall for interbase as a program, and to open port 3050 specifically. My wife's laptop now appears to have a stable connection. Things I'm unhappy about; i don't like discovery and sharing on. Seems like an obvious security hole to me, and since my own laptop had a stable db connection without it, it's obviously not the root issue. It still bothers me that her machine could contact the database on start=up, but then lost it. That's just weird. bobD
  4. bobD

    Strange IB connection issue

    I'll have to add some debugging code to the program to surface that. It's a straight db access program, so if it can't connect it simply tells the user that it can't find the database. It's my password manager, so not designed to be real helpful to an unauthorized user. I'm still loooking at something external as the most likely issue, though. Both laptops are running the same build of my code ("UTC build date: Sat, 27 May 2023, 8:26 PM") and this is a very recent issue. Interestingly enough, if I try to log in to the network server using the Emb. IBConsole program on her machine, I get a failure dialog message of: Unable to complete network request to host "<NAME>". Failed to locate host machine. The specified name was not found in the hosts file or Domain Name Services. while doing so from my laptop works fine. I have no idea why it suddenly can't find a database server it's been using for several years. bobD
  5. bobD

    IB server port requirements

    Suddenly today my home network IB 2020 server is getting blocked by the Windows Defender Firewall. If I turn off the firewall for the local area network everything works, so I know it's definitely a firewall configuration issue The server has been solid for some time and I haven't changed anything other than applying Windows updates as they come out. I'm suspicious that a Windows Defender update might have wiped some of my settings. Context: home local area network; all connections should be coming from 192.168.4.* IB server is on an up-to date Win10 Pro box Anyone have a current firewall requirements link or cheatsheet for an IB 2020 server on a Win10 Pro machine? TIA, bobD
  6. bobD

    IB server port requirements

    The machine identifies its connection as 'public'. It's a hardwire (not WiFi) connection to my router. Additional details in response to tgbs. It could be that that changed with a router reboot--I'm not sure of the basis on which the db server or router decides how to characterize the connection as public or private. The firewall rules do segregate the local connections (I assume by seeing the calling IP address as 192.168.*). I'd like the Interbase3050 rule to only accept calls from this side of the router, but it wasn't at all obvious to me how to configure that.
  7. bobD

    IB server port requirements

    I ended up adding both: an allow inbound program rule for ibserver.exe, an the same rule for port 3050 tcp. I have no idea how the previous Interbase exceptions got dropped, though the firewall control panel looks nothing like it once did, so I have to assume it's bee evolving with Windows updates. Anyway, all the db clients now connect again with the Win Defender Firewall monitoring local area connection calls What I don't know is whether that's overkill: If I disable the ibserver program rule and just leave the port open everything still works, including connecting to the server with IBConsole from my Delphi development machine, but ISTM that I remember something Interbase needing a UDP connection. Am I misremembering? I don't know if Embarcadero removed that dependency, or I just didn't test enough to catch what's missing... bobD
  8. bobD

    embedded IB project sample?

    Currently running IB 2020 server, using Delphi 11 Arch, via FireDac Everything fine with that, but want to add offline capability. Is there a simple embedded-IB sample project available anywhere. I need to know what dlls to use and include with application. Intent is to have the application request a connection, then the connection unit --return a server connection if on the local network, or --if not return the local imbedded connection Alternative might be to always open local, then handle network synch if on the network Database is low volatility (read often, write seldom) thanks, bobD
  9. bobD

    embedded IB project sample?

    Sounds like a reasonable hypothesis, because this has been my main development machine for a few years now, and has seen multiple IB versions. Also the results are the same whether I try the sample app, or connecting to a local copy of my actual intended target db. I'll try to see what I can find this week after looking at cleaning up the installation. Thanks, bobD
  10. bobD

    embedded IB project sample?

    Thanks for response. I also looked at and followed along with the set-up demo at but no joy. At the end the project could not connect. Still trying to figure out what's wrong with the installation. May try uninstalling and reinstalling PAServer next. I have similar outcome with the FireIBLite.dproj sample. If the local IBServer is running, I get a user name and password not defined error, If I check the Lite option and stop the local server, then I get database unavailable. Very frustrating... bobD
  11. Absolutely. The inclusion of Free in the instance method is essentially a side-effect of the method and constitutes a violation of the SRP. What if I want to call DoSomething twice? Also, as a matter of consistency I personally always call the inherited constructor--even when descending from TObject directly. I have no guarantee that TObject.Create will always be an empty method.
  12. "I need to know if any lists are the same as my list." This implies an 'active record' where the question is really "does list <x> (my list) already exist in set of lists <y>" "if any two rooms have exactly the same booking schedules." This implies a much more complex question: "given set of lists <y>, are any two [or more] lists the same?" (basically, an iteration of the first question where x = 0 to number of lists -1.) which is it? Suppose a user changes a date-item for a room. One of four things happen: --the list, previously distinct, is now a duplicate of another --the list, previously a duplicate of another, is now distinct --the list was and remains distinct --the list was and remains a duplicate Can we rule out any of these cases as impossible? Does anything have to happen as a result of any of these cases? (For example, the change not being allowed) Is there any persistence aspect to the question? What's being stored? My initial design thought is to maintain a sorted list of list hashes, so that the question "does list <x> (my list) already exist in set of lists <y>" is a simple look-up on the list hash (which can itself be calculated and stored with the list whenever it changes). however, the statement "The dates change frequently, the comparison gets run infrequently" makes the whole idea of pre-calculation a case of swimming upstream. You don't generally make a frequent operation slower in order to speed up a relatively infrequent operation. So I agree with Joseph Mitzen's response that cautioned that some instrumentation is called for.
  13. four questions: 1. Where do the datetimes come from and how/when do they change? For example, if you're comparing file datetimes, then maintaining a status when the data changes might be better than checking when you need to know. They might change a lot less often than you check for a difference. 2. What is it you really need to know: whether any particular pair is different? or whether any difference exists anywhere in the list? 3. Is that always simply a 'difference exists' boolean? Or would knowing [greater than | equal to | less than] also needed? 4. Is there a guarantee that for every element[x] in list one, the same element exists at position[x] in list two? How is that guarantee enforced or checked? All of these affect your potential solution options. For the first example, if the list changes much less often than the need to check, then you might create a tracking object with two boolean values: FUpdated and FDifferent. Set FUpdated to true when any list element changes. When checking, if FUpdated is false, then simply return the FDifferent boolean, or if true recheck the list, store and return the comparison operation result, and reset FUpdated to false. This can save you thousands of list comparisons if the lists are much less volatile than the need to know whether they're the same. Answers to the other questions could modify the structure of this tracking object.
  14. bobD

    Rest in peace dear Danny Thorpe

    My sincere condolences to his family and all who knew him. Many of us continue to live by choice largely in the mental universe he architected. bobD
  15. Environment is current Delphi 10.4.2 FIreDac working against up-to-date 2021 Interbase What's the best tutorial or book for developing a Delphi-Interbase change-view based app? Looking for some simple procedure tips like a. develop for server first, then add local when design stable? b. develop for local first, then add network database when design stable? c develop using change views from the start? Also, does using change-views carry any db design implications? My normal practice in C/S development has been using a key-cache or Hi/Lo approach with integer keys (https://en.wikipedia.org/wiki/Hi/Lo_algorithm), but wondering if I need to switch to GUIDS... Thanks for any help/tips/references bobD
  16. bobD

    memory usage of TJPGImage

    I'm working on a quick photo browsing app, using a TObjectDictionary<string, TJPEGImage> as a cache device. Images are requested for display using the path to the jpg file like this: procedure TJpgStore.LoadPicture(aPicture: TPicture; const aSource: string); var img : TJPEGImage; begin if not FDict.TryGetValue(aSource, img) then begin img := TJPEGImage.Create; img.Scale := jsEighth; img.Performance := jpBestSpeed; img.LoadFromFile(aSource); FDict.Add(aSource, img); end; aPicture.Assign(img); end; This all seems to work fine, but two questions (since I'm not really a graphics guy): Am using Scale and Performance correctly? IOW, does it make any difference being here or after the LoadFromFile call? How much memory does a loaded TJPGImage take up? ('m thinking about a least-recently-used cache size governor. The jpgs are commonly 15-25MB each, and a source directory might contain 1-5,000 picture, so caching them all doesn't seem realistic...) Those are specific questions, but glad to entertain other comments/suggestions/alternative approaches. Thanks, bobD
  17. bobD

    memory usage of TJPGImage

    That encourages me that I'm on the right track with bitmaps. I'll report back with some further testing.
  18. bobD

    memory usage of TJPGImage

    In what regard? What I know so far is this: the lines img.Scale := jsEighth; img.Performance := jpBestSpeed; speed up the load/display of the jpg file as advertised Using the following code, bmp := TBitMap.Create(img.Width, img.Height); bmp.Assign(img); bmp.SaveToFile('C:\Users\bobd\Desktop\TestBMP.bmp'); and starting with a jpg file of 15.4 MB results in a bmp file of about 1.14 MB if Scale and Performance are so specified, or with the lines commented out 73MB (!). That suggests to me that there's no direct calculation of the JPGImage size from the bitmap it produces. You can see either a > 10x reduction, or a 4-5x expansion. Interestingly though, the TJPGImage object saving itself to file after the scale and performance are reduced for load results in a file the same size as the original. So we can't assume that the TJPGImage so loaded is any smaller in memory that one loaded without the jsEighth reduction. That's interesting. It appears to me that the most memory efficient cache (and thus the one with the largest practical capacity) for this app is going to be loading at jsEighth, then creating and caching the bitmap. Since the original image can be 6192 x 4192, I don't really need all that resolution anyway. Unfortunately, this presumes something not in evidence: that the size of the TBitmap in memory has a direct relationship to its file size. As with the source TJPGImage, it doesn't have an accessible size-in-memory property.
  19. bobD

    memory usage of TJPGImage

    I can do that. Is that suggested for performance or memory footprint? It bugs me that I can't see what I'm doing. InstanceSize returns 100 bytes for the img, 24 bytes for the stream. Obviously neither really accounts for the data. bobD
  20. Environment is current Delphi 10.4.2 FIreDac working against up-to-date network IB server. I have an app that opens the database on startup. However, while calling Connected := True is fine if it works, it can take seeming-forever to fail if the server can't be reached. Is there a faster call in FD/IB to make sure that a network server can be reached? My standing practice has been to call FileExists(<db or marker file>) as a simple precheck on a connection, but that doesn't work in this case because the server does not publish its existence. FB can connect, but the server doesn't show up in standard network browsing. So if you type in a server location in FileExplorer it will request connection credentials, but FileExists simply fails. I haven't found an access-credentialed version of DirectoryExists or FileExists that I can use. Thanks for any help/pointers, bobD
  21. For whatever reason I've never used cached updates. Fuller context is that I have an app on my local home network that uses an IB server. There are two main failure conditions: (1) the laptop's Wifi connection to the server is wonky, or (2) I'm off traveling and not on the home network at all. I'm currently considering three different architectural approaches as I go from simple C/S design to briefcase (or more generally a 'network-optional' design). 1. Use IB's built-in change views--this would be preferred if I could find a decent tutorial for getting started. Major documentation shortfall here. 2. Use a server first approach (app tries to connect to IB server, failing that it opens local IB database). Obviously that requires I write a server<-->local reconciliation routine. 3. Use a local-first approach. That removes the need for solving the network slow-fail issue, because all server communication would be confined to the background reconciliation thread.
  22. Thanks for suggestion. I've actually isolated the problem at this point to the WiFi connection being flaky, since the app works fine on the wired-in network machines even as the laptop fails to connect, and stopping/starting the laptop wifi service always fixes the problem. The DB machine and DB are solid as a rock. One of the things I'm thinking about doing as the app evolves is making it briefcase-enabled by running an local DB, and having the app run locally if the server isn't available. That creates an obvious synchronization requirement of course, and hence my interest in learning about change views. But that might be way more complicated than I actually need--the data at this point is pretty stable.
  23. I'll probably go with that for the moment. And I'll admit that 'seeming forever' is a very subjective complaint. The app normally opens with a fully populated dataset w/i a second or 2, so waiting is just waiting for inevitable exception handler. bobD
  24. Thanks Fr0st-- See my reply to Anders--Given the type of connection fails I get, I'm not actually looking for a 100% solution. Unreliable might be fine depending on why the test fails. For example, I wonder whether I can ask the router if the sever is available rather than even trying to even talk to it. The server itself doesn't publish for network browsing, nor does it even respond to pings--effectively it's stealth except for the database connection (on the standard 3050 port).
  25. Thanks Anders-- Home network, so the connection itself is 99.9+% reliable. The only time it can change is if I do it. What normally happens is that the laptop for whatever reason loses its wifi connection to the server. Turning wifi off and on always fixes things. And I simply don't see any failures on the wired-in desktops. So I'm perfectly fine with a file check not actually testing the connection validity, just whether the server is reachable.
×