Jump to content

Clément

Members
  • Content Count

    24
  • Joined

  • Last visited

  • Days Won

    1

Clément last won the day on December 27 2018

Clément had the most liked content!

Community Reputation

11 Good

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I always used Indy and ICS. Both are great, but both requires extra DLL (OpenSSL) if you need to use https. Each version might required a different OpenSSL DLL version, so mixing both (indy and ICS) will lead to a bucket of inconsistent smelly stuff. In my latest project I was asked to implement a REST client that must access HTTPS URL. I used TNetHTTPClient very successfully. It is very fast and works https without extra DLL. All I had to do was to assign the proper header and voilá! POST, GET, PUT et al with https support. A single component to the rescue.! I tried the TRestClient component family but they seemed to be over complicated ( I just ruled them out )
  2. If I may..... Can you use an Interface instead? For example: type IHasSQLSupport = Interface ['{E38C927E-019E-423C-A0C3-5C65A836D0C7}'] procedure AssignSQL( const aSQL : string ); End; TOracleDataset = class (...., IHasSQLSupport) // implements IHasSQLSupport procedure AssignSQL( const aSQL : string ); end; TPgQuery = class ( ..., IHasSQLSupport ) // implements IHasSQLSupport procedure AssignSQL( const aSQL : string ); end; TForm72 = class(TForm) private { Private declarations } procedure Myfunc( aQry : IHasSQLSupport ); public { Public declarations } end; implementation procedure TForm72.Myfunc(aQry: IHasSQLSupport; const aSQL : string); begin aQry.AssignSQL(aSQL); end; As long as SomeDataset is TOracleDataset or TpgQuery, you can call it as MyFunc( SomeDataset, aSQL ); SomeDataset.Open; This way you could also implement transaction support, autoinc support etc...
  3. Clément

    10.3.1 has been released

    Yeap. It's happening also here.
  4. Clément

    Hands-On Design Patterns with Delphi

    Got mine too! Nice
  5. Clément

    Dragging a control with $F012

    Hi, $F012 is undocumented constant for SC_DRAG.
  6. Clément

    Dragging a control with $F012

    Thanks Peter, I'll try to use SetWindowsHookEx.
  7. Clément

    Dragging a control with $F012

    Hello, I just hit a wall in my "Delphi Rio .1" project. I'm placing a few objects (TImage) on a Surface (TPaintBox) and when the mouse is over a TImage I wrote a routine to create a panel, move the TImage to this panel, send a Perform(WM_SYS_COMMAND, $F012, 0 ) and all is working beautifully! But I need to place Guidlines, similar to those in paint applications where an horizontal line and vertical line meet at the cursor position. Those guidelines will help the user align the controls in the surface. Once the perform message is sent ($F012), I no longer found a way to track the mouse position to display my guidelines. The lines just vanish for the duration of the drag and reappear when the drag is done. To illustrate I attached 3 images. The first one is the arrival, the second is just before dragging and the third is dragging. Is there anyway to solve this issue using $F012, or should I find another way to drag without any flicker TIA
  8. Clément

    ICS V8.60 adds several new components

    Great news!! ICS is amazing Clément Brazil
  9. Clément

    Improve speed in IDE

    If you still haven't installed IDE FixPack, do it! Highly recommended! http://www.delphifeeds.com/go/s/146660
  10. Clément

    10.3.1 has been released

    Hi, I installed 10.3.1 without any problems. My machine is old and I still have Delphi XE, Berlin, Tokyo and Rio installed. I mostly use Tokyo, but I'm confident and I'm migrating my projects to Rio Update 1. I use the migration tool to export my settings from 10.3 to a file. (Very important step!!!) Used the feature install ( Tools -> Manage platform is present ). Emb. should change the way to distinguish between one and another. Messing up a delphi installation by using the wrong installer would cost at day or two to reinstall everything. Selected "NO" since I WANT TO KEEP MY REGISTRY settings. Please consider change this too. Instead of YES or NO, please use something like: "Keep your settings" / "New installation". Selected all the features I want installed Waited for an hour Clicked "Start working" and voilá(*) *I was almost ready. Some components where there, but other no. Especially my Library path. This is why you need the migration tool. Import the file and you're done! The 10.3.1 IDE is more stable than 10.3. This week I will migrate more projects and I will be able to compare against 10.2, but it seems 10.3.1 is a LOT better than 10.2 I'm working on a Win64 project (Multithreaded TCP/UDP communication with InterThread messaging). With 10.3 I had 4 or 5 crashes a day. With 10.3.1 NONE ( so far ). With 10.2 I had to use IDE Fix pack (No crashes at all for days). So far I'm not using IDE fix pack in 10.3.1 and I don't feel like I need it.
  11. Hi, I wrote this code using XE. It might help you. type TMyRecord = Record item1: string; item2: Integer; Item3: Currency End; TForm68 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } function GetProperties( aTypeInfo : PTypeInfo; var aRec ) : String; end; implementation {$R *.dfm} procedure TForm68.FormCreate(Sender: TObject); var R : TMyRecord; begin Caption := GetProperties( TypeInfo(TMyRecord), R ); end; function TForm68.GetProperties(aTypeInfo: PTypeInfo; var aRec): String; var rtc : TRttiContext; lTyp: TRttiType; lFld : TRttiField; begin rtc := TRttiContext.Create; lTyp := rtc.GetType(aTypeInfo); for lFld in lTyp.GetFields do Result := Result + ' '+ lFld.Name; end; As you can see, all you need is Typeinfo. You can pass aRec as pointer if you need an instance to assign values. The result is obviously: Item1 item2 item3 Hope this helps,
  12. Clément

    Delphi, be better!

    I couldn't disagree more. When releasing Rio, Marco have a very difficult decision to make and had to post-pone Managed-records and IOS 64. They disabled both features. They were testing and certifiying the quality up to the last minute. Unfortunately they couldn't made it. Quality IS very important for them. But even so, the all mighty M$ have infinite resource and released buggy patches and even buggy major releases. Embarcadero must improve their testing scenarios and some bugs are harder to get then others and they are not using the power of this community as they should.
  13. Hi, The fastest way to delete the last character is to not add it. Compare the two following routines: procedure TForm61.Button1Click(Sender: TObject); var i : integer; lList : TStringlist; lResult : String; begin lList := TStringList.Create; lList.Add('Item1'); lList.Add('Item2'); lList.Add('Item3'); lList.Add('Item4'); try lResult := ''; for i := 0 to lList.Count-1 do lResult := lResult+ lList[i]+','; SetLength(lResult, Length(lResult) - 1 ); // Here I must delete the last char finally lList.Free; end; end; procedure TForm61.Button2Click(Sender: TObject); var i : integer; lList : TStringlist; lResult : String; begin lList := TStringList.Create; lList.Add('Item1'); lList.Add('Item2'); lList.Add('Item3'); lList.Add('Item4'); try if lList.Count>0 then begin lResult := lList[0]; for i := 1 to lList.Count-1 do lResult := lResult+','+ lList[i]; end; finally lList.Free; end; end; Every time I get the chance I use the second routine. It's faster and requires less memory reallocation.
  14. Clément

    Pointers are dangerous

    Let's say you receive a string with null chars in several places separating information. For instance: delphipraxis#0pointers are dangerous#0but worth the risk#0000#000#000000#0 How can you quickly process the information, check if they are valid and answer to that request. You have to return a modified string to the client. In that example you have to answer: delphipraxis#0pointers are dangerous#0but worth the risk#0101#022#014995#0 Of course the trick here is to avoid copying string over and over. Allocating and deallocating classes or complex structures to process the input information. With a simple array of pointers I can use this very same memory spot pointing to the beginning of each string without allocating or copying information. The alternative would be to create a class (TStringList for example), set some properties, use "DelimitedText", have a copy of each string , allocate another "Answer string" and at the end deallocating everything ->defragmentation nightmare. (The input string length varies!) Just picture this example in a network with hundred (or thousands) of devices sending requests of 10k bytes ( strings just like the above one but with 10k null separated values), and you get your performance example. Fragmentation is kept to a minimum and a service running for months without any problem. Is it even possible to improve the compiler as much?
  15. Clément

    Pointers are dangerous

    Pointers are part of the package. I use them for performance and low memory footprint especially when dealing with low level code (bytes, records or low level TCP communication). The gain pointers bring to the table is worth the risk.
×