delphi-2010

How to split string by a multi-character delimiter?

人盡茶涼 提交于 2019-11-27 16:00:13
Is there a Delphi function to split string by a multi-character delimiter rather than a single character ? For instance when I'd use that function this way: SplitString('Whale<->Mammal<->Ocean', '<->') I would get a result of these 3 strings: 'Whale', 'Mammal', 'Ocean' Is there such function in Delphi for this ? There is another quite simple solution using TStringList. Change the LineBreak: procedure TForm208.Button1Click(Sender: TObject); var lst: TStringList; begin lst := TStringList.Create; try lst.LineBreak := '<->'; lst.Text := 'Whale<->Mammal<->Ocean'; Memo1.Lines := lst; finally lst

Why are TGeneric<Base> and TGeneric<Descendant> incompatible types?

孤街醉人 提交于 2019-11-27 14:43:11
I have started using of generics in Delphi 2010 but I have a problem when compiling this piece of code: TThreadBase = class( TThread ) ... end; TThreadBaseList<T: TThreadBase> = class( TObjectList<T> ) ... end; TDataProviderThread = class( TThreadBase ) ... end; TDataCore = class( TInterfacedObject, IDataCore ) private FProviders: TThreadBaseList<TDataProviderThread>; ... end; Then I have some nested procedure: procedure MakeAllThreadsActive(aThreads: TThreadBaseList<TThreadBase>); begin ... end; And finally I want to call this nested procedure in the code of TDataCore class:

Register custom form so I can inherit from it from multiple projects, without copying the form to the Object Repository folder

允我心安 提交于 2019-11-27 14:08:15
问题 I've got a custom frame I need to inherit from in multiple projects. This frame includes some code and some components, and it resides somewhere on disk, in it's own project directory. I don't want to COPY it to the Object Repository folder, that doesn't seem right to me: I'd end up having two copies of the form, one in my Mercurial-backed repository, one in Delphi's Object Repository. Absolutely not a good idea. What I want is to have my frame in a Package and have the Package do all that's

Resuming suspended thread in Delphi 2010?

对着背影说爱祢 提交于 2019-11-27 14:00:03
问题 TThread's resume method is deprecated in D2010. So, I thought it should now work like this: TMyThread = class (TThread) protected Execute; override; public constructor Create; end; ... TMyThread.Create; begin inherited Create (True); ... Start; end; Unfortunately I get an exception "Cannot call start on a running or supsended thread"...which seems weird to me considering the fact that the documentation tells me that I should call Start on a thread created in suspended mode. What am I missing

TThread.resume is deprecated in Delphi-2010 what should be used in place?

断了今生、忘了曾经 提交于 2019-11-27 12:03:24
In my multithread application I use TThread.suspend and TThread.resume Since moving my application to Delphi 2010 I get the following warring message [DCC Warning] xxx.pas(277): W1000 Symbol ‘Resume’ is deprecated If Resume is deprecated what should be used in place? EDIT 1: I use the Resume command to start the thread - as it is Created with 'CreateSuspended' set to True and Suspend before I terminate the thread. EDIT 2: Here is a link the delphi 2010 manual Charles if do you read the code of TThread class , do you find the answer. TThread = class private type .. .. .. public constructor

What is the compiler version for Delphi 2010?

别来无恙 提交于 2019-11-27 11:50:26
In Delphi 2010, if I want to do this: {$IFDEF VER999} //some delphi 2010-specific code here {$ENDIF} What version # do I need to use in place of "999"? {$IFDEF VER210} JosephStyons Here's the list of compiler versions : {$IFDEF VER40} - Turbo pascal 4 {$IFDEF VER50} - Turbo pascal 5 {$IFDEF VER55} - Turbo pascal 5.5 {$IFDEF VER60} - Turbo pascal 6 {$IFDEF VER70} - Borland pascal 7 (And turbo pascal 1.5 for windows) {$IFDEF VER80} - Delphi 1 {$IFDEF VER90} - Delphi 2 {$IFDEF VER100} - Delphi 3 {$IFDEF VER120} - Delphi 4 {$IFDEF VER130} - Delphi 5 {$IFDEF VER140} - Delphi 6 {$IFDEF VER150} -

Is the compiler treatment of implicit interface variables documented?

一个人想着一个人 提交于 2019-11-27 11:50:22
问题 I asked a similar question about implicit interface variables not so long ago. The source of this question was a bug in my code due to me not being aware of the existence of an implicit interface variable created by the compiler. This variable was finalized when the procedure that owned it finished. This in turn caused a bug due to the lifetime of the variable being longer than I had anticipated. Now, I have a simple project to illustrate some interesting behaviour from the compiler: program

Convert Record to Serialized Form Data for sending via HTTP

风流意气都作罢 提交于 2019-11-27 09:36:08
Is there a way to convert this Record TError = record code: Word; message: String; end; TState = record caption: String; address: Cardinal; counters: TArray<Word>; errors: TArray<TError>; end; to serialized Form Data string ( Content-Type: application/x-www-form-urlencoded ) like caption=Foo& address=175896& counters[]=2& counters[]=2& errors[0][code]=52& errors[0][message]=ERR_NOT_AVAILABLE for sending via HTTP? Maybe there is some function similar to JQuery.param() ? LU RD Ok, here is a boilerplate solution which can be adapted for your specific serialization or other use as well. A record,

FTP Over SSH (SFTP) In delphi 2010

拜拜、爱过 提交于 2019-11-27 08:09:25
I'm writing a simple Delphi App to upload a few files to a SFTP Server. i thought i would be able to use a TIdFTP indy client but it seams as tho their is not an option for FTP Over SSH (SFTP) does anyone know of any Free / Open source Components for Delphi 2010 that would support FTP over SSH (SFTP). Due to security reasons im unable to use Active X controls so please do not respond with Active X solutions. Thanks for the help, Kyle SFTP and "FTP over SSH" are two separate things, and neither involves SSL (as someone else has suggested). SFTP is a sub-protocol of SSH while "FTP over SSH" is

Free Encryption library for Delphi [closed]

廉价感情. 提交于 2019-11-27 06:54:32
I'm looking for a free and up to date encryption library for Delphi 2010 that implements RSA and AES (Rijndael). I want a free library because I plan to write and publish some sample code that will use it. A Delphi 2010 version of TurboPower LockBox has been posted to the SongBeamer site, that implements both of these, but I'm concerned that it's getting a little old. For example, small RSA key sizes and no new security features for many years. Update: Is the perception that LockBox is out of date or lacks important features incorrect? Is it still relevant for production development?