Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 03/14/20 in all areas

  1. Dave Nottage

    Android crashes in formula

    On iOS, the first location change has values of 0 for OldLocation.Latitude and OldLocation.Longitude. On Android, they're both NaN, so your code will fail in that case. You should do this check (at least): if not IsNan(Latitude1) and not IsNan(Longitude1) then
  2. Angus Robertson

    Web sockets server and client

    I've updated the ICS distribution with the Websocket server implementation (HIXIE and HYBIE protocols) ported from phpws project, written by Stan Korotky <stasson@orc.ru> (eight years ago). This demo may be tested against the web page websocketclient.html which should be accessed from a server using the same IP address as this application, such as the ICS demo web server. The web page uses the WebSocket API with Javascript to send data to the server which is echoed back to the page. Ideally, websockets should be integrated into the ICS web server so they can be used on the same ports, the request that starts them up is HTTP, and I'll do that is anyone needs it. Please note this is an experimental server websocket implementation, that needs a lot more testing in case the protocol has changed in the last eight years. But it works with the latest version of Firefox as a client. A websockets client component is more work, but using most of the same code as the server since it's a duplex protocol. Angus
  3. Dave Nottage

    Squint and read: CreateFormFromStings

    More a case of: a major release is the best time to do it, since it can be interface breaking. If, after the change, a users code does not compile, I doubt they're going to say: "I want it back with the incorrect spelling". They're more likely to say: "I'm upset that you spelled it wrong in the first place, but fixing it is way better".
  4. Vandrovnik

    Squint and read: CreateFormFromStings

    They could create method with correct name and for some time keep the bad one in place too, just marked as deprecated... Just if there were a will to fix things.
  5. stijnsanders

    Web sockets server and client

    I have an alternative implementation here, it is build with the larger xxm project, which is primarily designed to be a 'generic' layer between IIS, Apache https, CGI or SCGI, and provides a way to use the very same binary with any of these. Regretfully, not all environments (and their xxm handler) support websockets. xxm has a bare-bones HTTP service as well which till now offers the best performance (but no TLS, compression or even logging...) if you specifically want to work with websockets, see the example project here also.
  6. Angus Robertson

    Web sockets server and client

    I will do a quick evaluation of building that old code with the latest ICS over the next few days, but I won't do anything further unless someone else sets up a websockets test environment to test it all, that often takes as long as the coding, a server and client that the ICS components can be separately tested against. Angus
  7. The point of making a second class was to enable one of the features that Mike was looking for, i.e. hiding implementation details. The single set field was a single property of the single example Mike initially gave. He later pointed out there are at least four different methods of operation, even adding three-way comparison/merges, meaning you need a third file parameter. You can put these classes in separate units and have a factory method or class that instantiate the specific inner classes, and completely isolate the inner workings from the outer use, offering f.x. two compare methods. function Compare(const aFileName1, aFileName2: string; const aMerge: Boolean = False):TResultType; overload; function Compare(const aFileName1, aFileName2, aFileName3: string; const aMerge: Boolean = False):TResultType; overload; Again, just a simple example based on the limited insight into all the possible variations of parameterization. There is more than one way to solve such a challenge. I chose to use polymorphism and encapsulation.
  8. I don't know if I qualify as an "expert", but I find that as my knowledge grows I also come up with new solutions that work much better for the intended (and sometimes changing!) goals. For example, recently, I have come up with a solution to reuse as much UI code as possible between FMX and VCL. While it still requires you to use different components (for the two libraries are much too different) there is still a lot you can do to minimise impact. Thus, I would say that as I gain experience, I find new ways to address new or existing problems which work much better for the goals at hand. This also means I find myself refactoring a lot more than I otherwise would.
  9. I like my constructors to construct No loading, no process, no fancy stuff inside the constructor other than parameter assignment, variable initialization or other class creation.
  10. Rollo62

    Preventing iOS to lock screen

    In Fmx this would look somewhat like this: function DoLocked(const ALock : Boolean) : Boolean; var UIApp : UIApplication; begin UIApp := TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication); if ALock then begin UIApp.setIdleTimerDisabled(True); // aquire wakelock Result := True; end else begin UIApp.setIdleTimerDisabled(False); // release wakelock Result := False; end; end; I put some more functionality around that basic one, to make it workable on all platforms, and to avoid double-enabling, but I removed that from the code above.
  11. Sherlock

    Preventing iOS to lock screen

    This SO topic should point you in the right direction: https://stackoverflow.com/questions/28329185/how-to-prevent-screen-lock-on-my-application-with-swift-on-ios
×