Jump to content

A.M. Hoornweg

Members
  • Content Count

    473
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by A.M. Hoornweg

  1. A.M. Hoornweg

    Why can't I install this monospaced font in Delphi ?

    Currently "Consolas" and "Source Code Pro" are my favorites.
  2. Hello all, I think I've discovered an anomaly in Delphi string behavior. Consider the following code: procedure TForm1.Test(const Defaultvalue: string; out Resultvalue: string); begin Resultvalue:=AnsiUpperCase(Defaultvalue); ShowMessage(Defaultvalue+'.'+Resultvalue); end; procedure TForm1.Button1Click(Sender: TObject); var s:string; begin s:='default'; Test(s,s); end; The output produces just a dot, which makes no sense to me.
  3. A.M. Hoornweg

    What's the best common folder for...

    Hi Stefan, do you know if that folder is only for domain users? Or are there other scenarios in which that folder is synced between machines?
  4. A.M. Hoornweg

    Bug in Delphi string behavior?

    Strange, when I first noticed the problem it went away 100% after I replaced string with widestring. But somehow I can't reproduce that anymore. Weird!
  5. A.M. Hoornweg

    Memory leak in UnicodeString to string conversion

    Library, as in DLL? You really can't pass a "string" from a DLL to an application, except when both projects are configured to use a shared memory manager ("uses sharemem").
  6. A.M. Hoornweg

    Bug in Delphi string behavior?

    I meant, the allocated memory in a widestring isn't managed by the Delphi heap but by Windows.
  7. A.M. Hoornweg

    Bug in Delphi string behavior?

    There is one thing I don't understand though. In the example below, shouldn't the string which is held by variable S have a reference count of at least 2 when procedure Test is called? One held by S itself, one by Defaultvalue? Normally the compiler should perform a Uniquestring whenever something is written to a string with refcount >1, or? procedure TForm1.Test(Defaultvalue: string; out Resultvalue: string); begin Resultvalue:=AnsiUpperCase(Defaultvalue); ShowMessage(Defaultvalue+'.'+Resultvalue); end; procedure TForm1.Button1Click(Sender: TObject); var s:string; begin s:='default'; Test(s,s); end;
  8. A.M. Hoornweg

    Bug in Delphi string behavior?

    Besides, the problem is not consistent, it only occurs with managed types. For example, it does not occur with WideString.
  9. A.M. Hoornweg

    Bug in Delphi string behavior?

    IMHO the compiler should throw an error if the same parameter is passed multiple times to the method and one of them is an OUT parameter.
  10. A.M. Hoornweg

    Bug in Delphi string behavior?

    Omitting the "const" changes nothing though. Delphi still passes it by reference even though it looks like a value parameter.
  11. A.M. Hoornweg

    Bug in Delphi string behavior?

    I suspect that it may do so. The "const" makes no difference. Using "VAR" instead of "OUT" also fixes the issue. I am quite alarmed by this issue because recently, whilst refactoring, I started replacing a lot of "VAR" parameters by "OUT" in order to make it more concise to a reader how the parameters are affected. But now it appears that "OUT" is dangerous if you pass the same parameter multiple times.
  12. A.M. Hoornweg

    can you reference unit name in code?

    Is the sequence of the units in the map file identical to the sequence in which the initialization sections are processed?
  13. Hello all, I'm trying to port an older (Delphi XE) SOAP client application to Delphi Rio. I'm stumbling upon a breaking change in THTTPReqResp, which is used by tHTTPRio. The signature of the event THTTPReqResp.OnBeforePost has changed completely. Formerly the signature was: TBeforePostEvent = procedure (CONST HTTPReqResp: THTTPReqResp; Data: Pointer); My routine does some manipulation of the http headers, for example it calls wininet.HTTPAddRequestHeaders(Data, ...) to allow gzip encoding and wininet.InternetSetOption(Data,....) to accept an invalid/self-signed SSL certificate. The new signature of the event has become: TBeforePostEvent = procedure(const HTTPReqResp: THTTPReqResp; Client: THTTPClient) of object; and now I'm stumped. How can I achieve the same as before? I want to accept gzip encoded data and I want to accept self signed SSL certificates. Kind regards, Arthur
  14. A.M. Hoornweg

    THTTPReqResp.OnBeforePost breaking change

    Thank you, I'll try this!
  15. A.M. Hoornweg

    THTTPReqResp.OnBeforePost breaking change

    <bump> any news here? I still haven't got a clue how to achieve this in Delphi Rio.
  16. A.M. Hoornweg

    Patch a private virtual method

    What I meant specifically is, how do I find out the index of a method in the VMT?
  17. A.M. Hoornweg

    Patch a private virtual method

    That's very interesting, could you show a small example?
  18. Does this support copying to the clipboard? In Delphi XE it doesn't.
  19. A.M. Hoornweg

    Android in VMWare

    Has any of you tried using Bluestacks instead? It's an all-in-one Android emulator which emulates an ARM processor. I'm not using it for development but rather for running some Android apps that aren't available on Windows.
  20. Hello all, Are there any FB experts here? I could use a little help ... I need to enlarge the size of a Varchar primary key column in a small but populated Firebird table from 25 to 40 characters. Much to my surprise, that isn't trivial at all. There are no foreign keys in other tables pointing to this primary key so really, it should be straightforward, shouldn't it? The table name is "channels" and the primary key column is "paramname", it was originally declared as "varchar(25) character set iso8859_1 not null primary key". So far my trial steps were: (note that I did a commit after each statement) //1-Create a temporary column to hold the original data ALTER TABLE channels add temp_paramname VARCHAR(40) CHARACTER SET ISO8859_1 //2-Copy the data UPDATE channels set temp_paramname=paramname //3-Delete the old column ALTER TABLE channels DROP paramname // 4-Re-create column "paramname". The table has records, so I cannot declare it "not null" or "primary key" at this point ALTER TABLE channels add paramname VARCHAR(40) CHARACTER SET ISO8859_1 //5-Populate it with the original data UPDATE channels set paramname=temp_paramname //6-Now make it primary key - this step fails! alter table channels add primary key (paramname) //7-delete the temp column now... I'd be grateful for any help.
  21. A.M. Hoornweg

    Firebird, change length of Varchar Primary key column?

    Thanks a lot Remy, this works indeed! But I needed to perform a commit after each step, else it threw an error.
  22. A.M. Hoornweg

    Firebird, change length of Varchar Primary key column?

    Thanks Remy, I'll give it a try and keey you updated!
  23. A.M. Hoornweg

    Firebird, change length of Varchar Primary key column?

    Hi Dany, the error message said that FB couldn't create the primary key because the column wasn't declared as "not null". Which I couldn't do, because the new column contains nulls right after creation in step 4. I did the steps one by one in FlameRobin, but when everything works I must re-code it either in Delphi or in InnoSetup (because I have to distribute it as part of a software update).
  24. A.M. Hoornweg

    The Embarcadero GetIt server could not be reached...

    Downloading Android SDK through Getit seems to work now!
  25. Hello all, Delphi supports 64-bit development since XE2. But somehow it is still not possible to list and import 64-bit type libraries ???? Kind regards, Arthur
×