Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 06/13/19 in all areas

  1. David Heffernan

    Passing back a string from an external program

    Reading the stdout of the child process is a very easy way to do this.
  2. David Heffernan

    JSON string value

    I don't buy that argument. People are using the software now. And software is never finished. There is always more to be done. So if you wait until it is done, then you never document it. My personal experience, and very strongly felt, is that writing documentation is a key part of finalising and debugging specification. So many times have I experienced this. Only when you write the documentation do you realise some of the issues that users will face. Deal with them before releasing and you don't have to spend as much time in back compat hell. My view is that writing documentation in a timely fashion actually saves time and resources in the long run.
  3. limelect

    Passing back a string from an external program

    I used on D6 ,many years ago , mdMailSlot https://torry.net/authorsmore.php?id=152 It communicated between 4 computers (programs) maid with Delphi 6. Excellent
  4. Check the linefeeds of your source file. When you have a mix-up of CR and/or LF this might happen. Also errors when compiling show on the wrong line number and other spooky stuff...
  5. Nevermind, looks like a developer in our office added this in the past.
  6. Uwe Raabe

    Passing back a string from an external program

    Named Pipes may not be the badest decision here. See François Piette blogging about that: Inter Process Communication Using Pipes
  7. While it is generally a good idea to avoid global variables there are cases where they can be useful, and your case is one of them. Do you know what a singleton object is? A singleton is a good solution for a scenario where you need to store some data internally in your application that you have to access from several different places in your code (different units, for instance). You place the class into a unit of its own. The unit is then used by all other units that need access to the singleton. There are different ways to implement a singleton object. The simplest one is to actually never create an instance of the class at all. Instead you use class variables and class properties to hold the data. That works well if all data you need available are simple or compiler-managed types (ordinal types, numeric types, strings). It works less well if you need more complex types, e.g. other objects. This can be handled now that Delphi has class constructors and class destructors, however. My preferred way to implement singletons is to only expose an interface type that has the necessary properties and methods to store and retrieve the data, and a factory method that returns an instance of the interface. The class implementing the interface is private to the unit (declared and implemented in its implementation section). The factory method creates an instance of the class on the first call to it and stores the interface obtained from it in a variable only visible in the unit implementation section. The unit gets a finallization section that sets the interface to nil to finally destroy the singleton.
  8. If you think that it's related to .NET then call dcc yourself and see if that works - as I said already the error comes from the dcc. So it can only be that msbuild is passing down different values than before causing it to behave differently. To rule that out, eliminate the suspected factor from the equation, troubleshooting 101
  9. Dmitry Arefiev

    JSON string value

    function JsonEncodeString(const AStr: string): string; var LStr: TJSONString; begin LStr := TJSONString.Create(AStr); try Result := LStr.ToJSON; Result := Result.Substring(1, Result.Length - 2); finally LStr.Free; end; end; It expects AStr without double quotes, and returns text without double quotes. You can adjust it to your own needs. There are several options, eg with/without double quotes, encode non-ASCII chars/do not encode, etc. Probably more simple to implement the above according your needs.
  10. Dmitry Arefiev

    JSON string value

    We have two problems: 1) REST, DBX, System.JSON duplicating JSON serialization classes. 2) Non complete docu for (1) classes. We want to keep only System.JSON with options for backward compatibility with REST, DBX. And only to develop System.JSON. When this will happen, then all demos, tests (internal), docu, must be updated to reflect the current RTL state. Now it is not the time for docu work ...
×