I really love the “name spaces” you can create with records and constants.
type
mime = record
public const
ApplicationJson = string(‘application/json’);
TextHTML = string(‘text/html’);
end;
…
Response.ContentType := mime.TextHTML;
I really love the “name spaces” you can create with records and constants.
type
mime = record
public const
ApplicationJson = string(‘application/json’);
TextHTML = string(‘text/html’);
end;
…
Response.ContentType := mime.TextHTML;
Tip: Use Ctrl+W to select content in the IDE code editor.
Place your cursor some random piece of code, preferably deep in code that have nested blocks. Press Ctrl+W. Repeat, and repeat while watching the goodness progress.
This tidbit was shared by Jim Mack in a comment in the FB Delphi group.
Edit: The feature was introduced in Berlin 10.1
The feature struggles with Unicode characters in code and strings.
Those of you that use national characters in your strings or code (such as Cyrillic, Greek, or Chinese) that also misbehaves, should add a comment / example to the QP issue and vote on it.
Summary page showing supported platforms and OS versions for XE4 and upwards, as well as links to known issues for specific versions.
http://docwiki.embarcadero.com/PlatformStatus/en/Main_Page
Understanding ARC (Automatic Reference Counting)
Marco Cantù dives into the details.
Originally shared by Iwan Cahyadi Sugeng
Hi guys, kami dari Komunitas Penggemar Pemrograman Delphi (KPPDI) mau adakan workshop gratis di jakarta untuk memperkenalkan pemanfaatan IoT dengan Delphi. Delphi yang kita gunakan adalah Delphi Starter Edition yang dapat diunduh dan digunakan secara gratis.
Info lebih lanjut silahkan liat brosur di bawah
Segera daftarkan diri anda, karena tempat sangat terbatas
Some very good observations and commentaries in this post by Gunny.
Originally shared by Michael Thuma
Accessing Linux APIs and Command-line interface from Delphi
Record helpers can do wonders for code clarity.
// Never mind the silly example
TResult = (CompletedOK, PartiallyPerformed, NothingHappened, HorriblyWrong);
function DoSomething:TResult;
begin
Result := PartiallyPerformed;
end;
How do we determine failure vs success?
if not DoSomething = CompletedOK then …?
What about Partially performed and nothing happened?
Enter the helper:
TResultHelper = record helper for TResult
function Failed:Boolean;
function Success:Boolean;
end;
function TResultHelper.Failed: Boolean;
begin
Result := (Self = HorriblyWrong);
end;
function TResultHelper.Success:Boolean;
begin
Result := not Failed;
end;
Now we can write
if DoSomething.Failed then …
Note that you also can enter the murky waters of obfuscation through helpers, but at least the murkiness will be consistent 😛
Originally shared by David I’s News Bits
Sixty Plus Embarcadero FireDAC Sample Apps (Delphi and C++) with Source to Make Accessing Databases Easy
You must be logged in to post a comment.