Hi! how to hide a property in object inspector? i have my custom components …

For my link archive: [WayBack] How to hide a property in object inspector? i have my custom components … [WayBack] delphi – Custom component and tab order – Stack Overflow Some quotes Jeroen Wiert Pluimers You cannot undo things that are inherited. What you can do is not make that property published but overwrite the streaming mechanism […] … Read More

Read More

Delphi: ^TNodeData incompatible with PNodeData – {$T+} versus {$T-}

In my Turbo Pascal days, I was fan of the {$T+} directive (now a.k.a TypedAddress on) as it would make the @ operator return typed pointers and the compiler would be more strict in forcing checks on pointer types to be compatible. Not so much in Delphi any more, see the below comment on in a G+ […] … Read More

Read More

CodeRage XII session files – Directly Using The Android API

My CodeRage XII session on Directly Using the Android API has been aired on the Internet. If you saw it I hope it came across reasonably well (interruptions notwithstanding) and might prove useful to you in your endeavours with Android.As promised, the slides and samples are now available at this link. Do enjoy, now ˚◡˚   [ Update: the broken link has been fixed ]Apologies for the interrupted video transmission during the conference. Rest assured that as soon as Jim can manage it, pretty much all the CodeRage videos will be made available for replay. As soon as mine is available I shall be updating this post with the link and also linking to it on my Conference Talks web page.
Read More

CodeRage XII session

A whole 5 years ago (!) I did a session for CodeRage 7 on accessing the Android API. This was not long after RAD Studio XE5 introduced support for developing Android applications, and Delphi’s Android support was in its first stage.5 years on and CodeRage XII is starting today. I’ll be doing an updated talk on the same subject covering all that’s new in RAD Studio 10.2 at 3pm CST today, Tuesday 7th November 2017. I hope you can join me!A full timetable of sessions is available in this PDF download in case you’re having trouble working out which sessions to attend.Sad for me (due to working on-site meaning I won’t be able to catch them – alas they won’t be made available as replays!) but hopefully fabulous for many of you (if you can attend the sessions) is the inclusion in the list of speakers of a couple of legends in their areas:Robert Martin (aka Uncle Bob Martin), author of Clean Code, 7am-9am 7th November 2017.Steve McConnell, author of the classic Code Complete (among others), 12pm-1pm 8th November 2017.These are well respected industry luminaries and Malcolm Groves, among others, has a lot to say about them.Enjoy CodeRage XII!
Read More

CodeRage XII is Next Week

Next week will see the 12th edition of Embarcadero’s yearly online conference. Three days full of sessions covering Delphi, C++Builder, InterBase, and all of the company products (including also Sencha’s ExtJS), but also general software development topics and third party tools. I’ll be giving a couple of sessions. Don’t miss it! … Read More

Read More

‘What if?’ scenario analysis in the CPU window

Last Tuesday, 24th October I did some sessions at EKON 21, one of which was on Creative Debugging Techniques. During the session there was a section where I was trying to demonstrate an idea or technique that happened to fully involve the CPU window. Unfortunately a series of finger fumbles on my part meant I couldn’t show what I wanted to show, albeit I think the point was made.Anyway, I mentioned that maybe I’d write up that little snippet into a blog post, just to prove that it really does work as I suggested it does, and so here it is. Oh, apologies up front for all the animated GIFs below-  it seemed the most expeditious way to make sure I could really convey some of the points.So the context was ‘What if?’ situations and testing out such scenarios during a debug session.Clearly the primary tool for testing out ‘What if?’ scenarios is the Run, Evaluate/Modify… (Ctrl+F7) dialog. This dialog’s Modify button allows you to alter the value of the expression you have evaluated to find out how code behaves when the expression has a value other than what it actually had.That’s a good and very valuable tool. But the case in point in the EKON 21 session was a bit different.Consider a scenario where you are in the midst of a lengthy debug session, one that you’d really rather not reset and start again. Also consider that from some observations made in the debug session you have realised that a certain function B that is called from function A ought in fact not to be called. You want to test how well things pan out with B not being called.In an entirely fabricated ultra-academic example, let’s use this code here, where A is TMainForm.WhatIfButtonClick and B is CommonRoutine.procedure TMainForm.WhatIfButtonClick(Sender: TObject);{$REGION '"What if?" scenarios'}var   S: string;begin   S := 'Hello world';   Caption := S;   CommonRoutine;   Color := Random($1000000);{$ENDREGION}end;One solution to this is to move the instruction pointer to skip the call to B just as B is about to be called. This can be done in a number of ways in Delphi. Set a breakpoint on the call to B and when it hits do one of the following four options to achieve this:1) Set next statement menu itemRight-click on the statement that follows the call to B and select Debug, Set Next Statement, a menu item added in Delphi 2006 and described by Chris Hesik in this old 2007 blog post (from the Internet Archive WayBack Machine).2) Drag the instruction pointer editor gutter iconDrag the instruction pointer icon in the editor gutter to point at the following statement. This drag and drop support for the instruction pointer symbol was added in Delphi 2010.3) Change the instruction pointer in the CPU windowInvoke the CPU window (View, Debug Windows, CPU Windows, Entire CPU or Ctrl+Alt+C), or at the very least the Disassembly pane (View, Debug Windows, CPU Windows, Disassembly or Ctrl+Alt+D). Right click on the next statement and choose New EIP (or Ctrl+N).4) Update the EIP register in the CPU windowInvoke the CPU window (View, Debug Windows, CPU Windows, Entire CPU or Ctrl+Alt+C). Note the address of the instruction you want to execute next. Right-click the EIP register in the Registers pane and choose Change Register… (Ctrl+H) and enter the new value as a hexadecimal number, i.e. with a $ prefix. An alternative to Change Register… is to choose Increment Register (Ctrl+I) a sufficient number of times to get the value to match the target address.OK, so all of those achieve the goal on that single invocation of routine A, but what about the case where A is called lots of times – lots and lots of times? This idea falls down in that situation and so we might seek out an alternative option.Maybe we can get rid of the call to B entirely for this run of the executable. Yes, maybe we can and indeed that was just the very technique I tried to show, but made a couple of silly mistakes by not paying attention to what exactly was on the screen. Mea culpa.There are a couple of approaches to getting rid of the call to B from the code present in A. One is to replace the first few bytes of that statement with an instruction that jumps to the next statement. The other is to replace the entire statement with opcodes corresponding to ‘no operation’, i.e. the no-op opcode NOP. Let’s look at both approaches.Both these approaches involve changing existing machine instructions in memory. With that end goal comes a rule, and the rule is that you can’t successfully change a machine instruction that your program is currently stopped at in the debugger or that the debugger has a breakpoint on. In other words, if you want to change the call to CommonRoutine to be something else this must be done when the program is stopped at a different instruction in the debugger and there must be no breakpoint on that instruction.This is simply a side effect of the way debuggers implement breakpoints and statement stepping - they replace the first byte of the instruction to break at with $CC, the byte value, or opcode, for the assembly instruction INT 3. When execution continues the $CC is swapped back for the original value.So if you change the instruction at the current EIP when the execution has stopped in the debugger, when you ask it to move on your first byte will get replaced, just by the mechanics of your debugger doing its day job. This will most likely cause a very much unwanted opcode combination leading quickly to an application crash. [ One of my EKON fumbles was to instantly forget this previously well known (by me) fact and promptly get a crashed debuggee. ]Your best bet is to put a breakpoint on the preceding instruction, and then modify/replace your target instruction. Make sure there is no breakpoint on the target instruction.When you look in the CPU window you can see the assembly instructions that correspond to the Pascal statement above it.In the case of the call to CommonRoutine the assembly code is:mov eax,[ebp-$04]call TMainForm.CommonRoutineThe machine code bytes (opcodes) that represent those 2 instructions are $8B, $45, $FC and $E8, $11, $F8, $FF, $FF respectively. The 3 bytes for the first instruction are stored at locations starting at $5D1287 and the 5 bytes for the second instruction start at $5D128A.The statement following the call to CommonRoutine starts at address $5D128F, 8 bytes on from $5D1287.1) Overwriting an instruction with a jump instructionThe goal is to write some opcodes into memory starting at address $5D1287 that represent an assembly instruction to jump 8 bytes forward. If we look at the documentation for the x86 JMP instruction, a small jump is 2 bytes of instructions encoded as $EB coupled with the jump distance from the end of the jump instruction. So 8 bytes minus the 2 byte instruction is 6, so $EB $06. [ One of my fumbles in the EKON session was to misread the $EB as $E8, which is a CALL opcode. ]So, to change the current code for new instructions we have to move our attention away from the Disassembly pane to the Memory pane. You can either use the one embedded into the Entire CPU view or open up one of four standalone memory panes using an item from the submenu View, Debug Windows, CPU Windows:Memory 1 (Ctrl+Alt+E)Memory 2 (Ctrl+Alt+2)Memory 3 (Ctrl+Alt+3)Memory 4 (Ctrl+Alt+4)By default the memory pane will be settled on address $401000, the start of the application’s Code segment (according to first piece of information in a detailed .map file, as generated by the linker).You should reposition to the target instruction by using Go to Address… (Ctrl+G) from the context menu and entering (in this examples case) $5D1287. You’ll see the ‘familiar’ 8 bytes we saw for the instructions right there on the first line: To change these 6 bytes to be bytes representing our jump instruction you can select Change (Ctrl+H) from the context menu and enter the values: $EB $06.You can also simply start typing those values directly into the Memory pane and the Enter New Value dialog will pop up.This changes the first 2 bytes of that instruction and the Disassembly pane echoes this by showing the JMP instruction.As you’ll note, however, there is a bit of “noise” after this for the remaining 6 opcodes: some junk that is jumped over.[ Update 30/10/2017 – thanks to The Arioch for welcome interjections. It should be noted that in this case after trampling over the first 2 opcodes the remainder of the previous set of opcodes still “make sense” to the disassembler. So much so that the very next Delphi statement is still shown and is still translated directly into its constituent opcodes.It is, however, often the case that having bulldozed over a couple of essentially arbitrary opcodes, what’s left is a bit of a mess, and puts things “out of kilter”, leaving subsequent Delphi statements not showing in the disassembly pane thanks to what opcodes have come before.As a simple example, not necessarily demonstrating the ultimate confusion that can be caused, here’s some code:If we wish to skip the ShowMessage call we need to workout the JMP opcodes.Run a copy of Windows Calculator, go into programmer mode (Alt+3), and calculate $5D1686 – $5D167C to get the gap from ShowMessage to the following statement. Then subtract 2 to take off the size of the small JMP instruction. This gives a final result of 8, so we enter new opcodes of $EB $08 and what’s then showing in the disassembly pane is this:The disassembly of the call to CommonRoutine has gone rather up the spout, even though the opcodes for it are actually still quite intact.End of update ]To clean this up we could fill in the remaining 6 bytes with opcode $90, which corresponds to NOP, the assembly no-op instruction:This shows as:[ Another of my EKON fumbles was to enter too many $90 bytes having miscounted the required bytes, or perhaps forgetting that I need to subtracted the size of the jump instruction. This rather messed up the following instruction, which should have been left intact. This got another crash. ]Or you could fill with data byte $FF – just data:2) Overwriting an instruction with NOP opcodesThis is just an extension of the last points in the option above. In a memory pane that has been located on the start of the target instruction, just change all the bytes of the instruction to the NOP opcode, $90. We have 8 bytes here, so use the Change submenu item (Ctrl+H):There we go, that’s what I meant to show in that 5 minute section of the session – apologies for the poor demonstration but hopefully this makes up for it ¯\_(ツ)_/¯
Read More

Delphi Blogs of the Month #56

While clearly difficult to have a weekly summary, Iv'e fully retitled this installment, although the URL stays as part of the original weekly sequence. Let's get started. Embarcadero News A Busy Summer at https://community.embarcadero.com/article/16572-a-busy-summer Embarcadero Academy Debuts with Online Courses for Developers of All Levels press release at http://www.businesswire.com/news/home/20170918005798/en/Embarcadero-Academy-Debuts-Online-Courses-Developers-Levels New in 10.2.1: Debug visualisers for Delphi generics at https://community.embarcadero.com/blogs/entry/new-in-10-2-1-debug-visualisers-for-delphi-generics Build iOS 11 ready apps with RAD Studio 10.2.1 at https://community.embarcadero.com/blogs/entry/build-ios-11-ready-apps-with-rad-studio-10-2-1 Updating IDE Subversion DLLs to address security issues at https://community.embarcadero.com/blogs/entry/updating-ide-subversion-dlls-to-address-security-issues Blog Posts Working with big data databases in Delphi - Cassandra, Couchbase and MongoDB (Part 3 of 3) at https://blog.grijjy.com/2017/09/21/working-with-big-data-databases-in-delphi-cassandra-couchbase-and-mongodb-part-3-of-3/ Debugging RTL/VCL Code with CodeSite at http://www.davidghoyle.co.uk/WordPress/?p=1754 and the follow up ,Notify Me of Everything - Part 2, at http://www.davidghoyle.co.uk/WordPress/?p=1761 5 Minute Snack: Reading floats with StrToFloat and TFormatSettings independent of system region settings at https://flixengineering.com/archives/612 Easily Make Asynchronous REST Calls In Delphi 10.2.1 Tokyo On Android, iOS, macOS, and Windows 10 at https://community.embarcadero.com/blogs/entry/easily-make-asynchronous-rest-calls-in-delphi-10-2-1-tokyo-on-android-ios-macos-and-windows-10 Face Detection on Android and iOS at https://blog.grijjy.com/2017/09/11/face-detection-on-android-and-ios/ Experimenting with Neural Networks - Part 1 (and following in subsequent posts) - http://chapmanworld.com/2017/09/20/experimenting-with-neural-networks-part-1/ Adding a Custom Icon to a FireMonkey Button at https://community.embarcadero.com/blogs/entry/adding-a-custom-icon-to-a-firemonkey-button RAD Studio 10.2: Windows 10 VCL UWP/WinRT Support at https://community.embarcadero.com/blogs/entry/rad-studio-10-2-windows-10-vcl-uwp-winrt-support Amazon DynamoDB with Delphi (video) at https://community.embarcadero.com/blogs/entry/amazon-dynamodb-with-delphi 5 Minute Snack: Is a package installed? The Package Manager icons tell you! https://flixengineering.com/archives/618 Third Party Libraries TLanguage localization tool: https://delphitipsandtrick.blogspot.it/2017/10/delphi-tlanguage-localizaton-tool.html Not new but fairly interesting.... Python for Delphi at https://github.com/pyscripter/python4delphi and you can read about it at http://www.atug.com/andypatterns/pythonDelphiTalk.htm Delphi RNL ("Realtime Network Library") at https://github.com/BeRo1985/rnl Use this RFID library in Delphi at https://github.com/islog/liblogicalaccess/wiki/Use-this-RFID-library-in-Delphi Built with Delphi Roselt Color Picker in Windows Store: https://www.microsoft.com/en-za/store/p/roselt-color-picker/9nq8c70flp0r?rtc=1 Smart IDE for OpenSCAD at https://github.com/senCille/senCilleSCAD/wiki   That's all for this month.
Read More

DAPUG event in Denmark

Today and tomorrow I’ll be the speaker at the DAPUG event in Denmark. The title of the event is “DELPHI IN THE ENTERPRISE”. What is an enterprise application? Obviously there isn’t a measure to know if an application is enterprise or not, but the following needs usually require and enterprise level application. Critical functionality Large … Read moreRead More

Read More

CodeRage XII

CodeRage XII is coming! Tuesday, Nov 7th to Thursday the 9th

Register Now!


Out of the 76 sessions and 58 speakers scheduled for CodeRage XII for 2017, a few notable standouts:

  • Robert C. “Uncle Bob” Martin, author of “Clean Code: A Handbook of Agile Software Craftsmanship”, is speaking on “The Clean Coder – An Introduction to Software Professionalism”
  • Steven McConnell, author of “Code Complete”, is speaking on “Managing Technical Debt”. 
  • Marco Cantu, author of the Mastering Delphi series, is speaking on “Introduction to ExtJS for Delphi Developers “
  • Ray Konopka, author of “Developing Custom Delphi Components”, shares his “IDE Productivity Tips & Tricks”
  • Cary Jensen, author of “Delphi in Depth: FireDAC”, speaks on “FireDAC in Depth: Creating and Using Indexes”

Which sessions are you looking forward to the most?

  • [Watch] On-Demand – Working with TlistView – raouf rahiche
  • [Watch] On-Demand – Some code to start building C++ applications – Francisco Muro A.
  • [Watch] On-Demand – Using templates in IntraWeb – Alexandre Machado
  • [Watch] On-Demand – OpenAPI/Swagger: Document and Test your REST API Server – Wagner Landgraf
  • [Watch] On-Demand – Deep Dive: Hospitality Survey App Template Developer Guide – Eli M
  • [Watch] On-Demand – How to develop a simple recommender system – Daniele Spinetti
  • [Watch] On-Demand – All you need know to developer for Windows 10 – Ricardo Boaro
  • [Watch] On-Demand – CAD with RAD, master your OOP skills for multi-plat development – Vsevolod Leonov (Seva)
  • [Watch] On-Demand – Free SSL certificates with Let’s Encrypt – Wagner Landgraf
  • [Watch] On-Demand – Customising DataSnap Method Output – Bob Swart
  • [Watch] Tue Nov 7th at 6:00 AM CT – Integrating with Amazon DynamoDB using Delphi Enterprise CDATA Connector – Paweł Głowacki
  • [Watch] Tue Nov 7th at 7:00 AM CT – The Clean Coder – Robert C. “Uncle Bob” Martin
  • [Watch] Tue Nov 7th at 9:00 AM CT – InterBase 2017 ToGo Cross-Platform Development and Deployment – Al Mannarino
  • [Watch] Tue Nov 7th at 9:00 AM CT – Product Address – Sarina DuPont
  • [Watch] Tue Nov 7th at 10:00 AM CT – Storing Data in Amazon S3 with Delphi – Paweł Głowacki
  • [Watch] Tue Nov 7th at 10:00 AM CT – Zen and the Art of Software Extensibility – Bob Calco
  • [Watch] Tue Nov 7th at 11:00 AM CT – Introduction to Ext JS for Delphi Developers – Marco Cantu
  • [Watch] Tue Nov 7th at 12:00 PM CT – VCL Layout Techniques – Ray Konopka
  • [Watch] Tue Nov 7th at 12:00 PM CT – Migrating your C++Builder Projects to Unicode – Al Mannarino
  • [Watch] Tue Nov 7th at 1:00 PM CT – IDE Productivity Tips and Tricks – Ray Konopka
  • [Watch] Tue Nov 7th at 1:00 PM CT – Accessing AWS S3 platform from C++ Builder – Luca Zoller
  • [Watch] Tue Nov 7th at 2:00 PM CT – FMX Animations – Ray Konopka
  • [Watch] Tue Nov 7th at 2:00 PM CT – C++ Builder as a REST server, easy way to comunicate with Apps and SCB’s – Dion Mai
  • [Watch] Tue Nov 7th at 3:00 PM CT – Directly Using the Android API – Brian Long
  • [Watch] Tue Nov 7th at 3:00 PM CT – InterBase 2017 Update – Sriram Balasubramanian
  • [Watch] Tue Nov 7th at 4:00 PM CT – FireDAC in Depth: Creating and Using Indexes – Cary Jensen
  • [Watch] Tue Nov 7th at 4:00 PM CT – Docker 101: Introduction to Docker – Jenny Fong, Docker
  • [Watch] Tue Nov 7th at 5:00 PM CT – Preventing and Fixing Coupled Code – Cary Jensen
  • [Watch] Tue Nov 7th at 5:00 PM CT – Matlab/Scilab scripting engine – Janez Makovsek
  • [Watch] Wed Nov 8th at 6:00 AM CT – FmxLinux – FireMonkey for Linux – Eugene Kryukov and Vsevolod Leonov (Seva)
  • [Watch] Wed Nov 8th at 6:00 AM CT – Simplify and speed-up application development with ORM for Delphi – Devart
  • [Watch] Wed Nov 8th at 7:00 AM CT – Creating JSON Wrapper Classes in Delphi – Andrew Sovtsov
  • [Watch] Wed Nov 8th at 7:00 AM CT – Programming Mazes in C++ and Delphi – David Millington
  • [Watch] Wed Nov 8th at 8:00 AM CT – CrossVcl (VCL for Linux and osX) Review – Eugene Kryukov and Vsevolod Leonov (Seva)
  • [Watch] Wed Nov 8th at 8:00 AM CT – Introducing FMXRTL-bringing Right To Left to FireMonkey – Ruhollah Akbarzadeh
  • [Watch] Wed Nov 8th at 9:00 AM CT – TMS Business Showcase: REST Server and ORM (XData and Aurelius) – Wagner Landgraf
  • [Watch] Wed Nov 8th at 9:00 AM CT – Getting Started with Linux using Ubuntu 16.10 , Installing Packages, and Connecting to Servers – Tom Lawrence, Lawrence Systems / PC Pickup
  • [Watch] Wed Nov 8th at 10:00 AM CT – Using PDF Forms as Data Entry User Interfaces in your Delphi Applications – Girish Patil
  • [Watch] Wed Nov 8th at 10:00 AM CT – Bash on Ubuntu on Windows – Kevin Remde
  • [Watch] Wed Nov 8th at 11:00 AM CT – Building mobile apps that connects to Salesforce and SAP/R3 – Fernando Rizzato
  • [Watch] Wed Nov 8th at 11:00 AM CT – Panel: Artificial Intelligence (Davos) – Moderated by Robert F. Smith
  • [Watch] Wed Nov 8th at 12:00 PM CT – Introduction to Sencha Products – Ext JS, Tools, Test, ExtReact, GXT – Sandeep Adwankar
  • [Watch] Wed Nov 8th at 12:00 PM CT – Managing Technical Debt – Steve McConnell
  • [Watch] Wed Nov 8th at 1:00 PM CT – Introduction to Linux Command Line – Steven Gordon
  • [Watch] Wed Nov 8th at 2:00 PM CT – Create SCADA Modbus Industrial Control applications, and Devices with ControlLab, and Visuino Pro – Boian Mitov
  • [Watch] Wed Nov 8th at 3:00 PM CT – Developing Your Own Visuino Components with Delphi – Boian Mitov
  • [Watch] Wed Nov 8th at 4:00 PM CT – Embedding a Chromium browser in a Delphi application – Alex Ruiz
  • [Watch] Wed Nov 8th at 4:00 PM CT – Learning Linux multitasking at the command-line – Tutorials and Training
  • [Watch] Wed Nov 8th at 5:00 PM CT – Integrating the Google Places API into a Delphi application – Alex Ruiz
  • [Watch] Wed Nov 8th at 5:00 PM CT – Create a Business Intelligence (BI) Web Site RAD Style with FireDAC, IntraWeb and UniGUI – Miguel Angel Moreno
  • [Watch] Thu Nov 9th at 6:00 AM CT – Delphi Application Migration  – Al Mannarino
  • [Watch] Thu Nov 9th at 7:00 AM CT – Modernizing your VCL application – Danny Wind
  • [Watch] Thu Nov 9th at 7:00 AM CT – IntraWeb 17 – The Webolution Begins – Chad Hower
  • [Watch] Thu Nov 9th at 8:00 AM CT – CrossTalk – Connecting Delphi and C++ to .NET – Chad Hower
  • [Watch] Thu Nov 9th at 8:00 AM CT – Implementing 2-Step Authentication – Nirav Kaku
  • [Watch] Thu Nov 9th at 9:00 AM CT – Demystifying OOP with RAD Studio and ORMBr – Juliomar Marchetti
  • [Watch] Thu Nov 9th at 9:00 AM CT – Unit Testing and User Interface – Ruhollah Akbarzadeh
  • [Watch] Thu Nov 9th at 10:00 AM CT – FixInsight: Finding Bugs with Static Code Analysis – Roman Yankovsky
  • [Watch] Thu Nov 9th at 10:00 AM CT – GitHub and Git Foundations – GitHub
  • [Watch] Thu Nov 9th at 11:00 AM CT – The Delphi Parser – Automatic Migration Tool – Oren Aviram
  • [Watch] Thu Nov 9th at 11:00 AM CT – Docker for Windows and Windows Containers – Michael Friis and Elton Stoneman, Docker
  • [Watch] Thu Nov 9th at 12:00 PM CT – New feature of Delphi’s reporting with FastReport VCL 6 – Denis
  • [Watch] Thu Nov 9th at 12:00 PM CT – Panel: The Internet of Things Is Here (Davos) – Moderated by Robert F. Smith
  • [Watch] Thu Nov 9th at 1:00 PM CT – Single Sign-On and Two-Factor Authentication with Facebook and Google Authenticator – Olaf Monien
  • [Watch] Thu Nov 9th at 1:00 PM CT – Multi-thread CFD example in C++ Builder – Yilmaz Yoru
  • [Watch] Thu Nov 9th at 2:00 PM CT – Plurals, Genders and Abbreviated Numbers with Delphi – Jaakko Salmenius
  • [Watch] Thu Nov 9th at 2:00 PM CT – Microservices with RAD Server – Andrew Sovtsov
  • [Watch] Thu Nov 9th at 3:00 PM CT – C++ and Physics – Mary Kelly
  • [Watch] Thu Nov 9th at 3:00 PM CT – Design Consideration for Multi-Platform Applications – Sarina DuPont
  • [Watch] Thu Nov 9th at 4:00 PM CT – Fast and Furious IDE Tips and Tricks – Alister Christie
  • [Watch] Thu Nov 9th at 4:00 PM CT – InterBase Tips and Tricks – Mary Kelly
  • [Watch] Thu Nov 9th at 5:00 PM CT – Working with Linux Libraries in Delphi – Craig Chapman
  • [Watch] Thu Nov 9th at 5:00 PM CT – Understanding the BlockChain – Jim McKeeth
  • [Watch] Thu Nov 9th at 6:00 PM CT – OpenGL on Linux – Craig Chapman


Replay from last year’s CodeRage XI



Read More

Read More

Delphi build/install/launch Android app from the command-line

Quite some while back I answered a question on Stack Overflow, which explained how to build a Delphi project from the command line and also how to deploy it. The context of the question was Andriod developmentIn the case of an Android application deploying it has absolutely nothing to do with installing the resultant .apk file onto your Android device, despite what your personal interpretation of the word may be. Oh no, most definitely not.Instead, deployment is about packaging up all your various files - your compiled Android library (a .so file), all the images, splash screens, icons, custom files, databases, application manifest file and so forth – all into an .apk file. In other words as far as the Delphi IDE is concerned, deploying a Delphi project means going from a .so native ARM library to an installable .apk file.Clearly when you press F9 or Ctrl+Shift+F9 to run your application the IDE works out how to install your .apk on the currently connected and selected device, but that is subsequent to the IDE’s notion of the deployment step.So, installation notwithstanding, that SO answer shows how to make/build and deploy a Delphi project, such as an Android project, from a RAD Studio command prompt:To recap on it this does a build:msbuild Foo.dproj /p:Config=Debug /p:Platform=Android /t:BuildThis does a make, which only compiles files that have changed:msbuild Foo.dproj /p:Config=Debug /p:Platform=Android /t:MakeThis step, assuming you have done a deployment at least once in the IDE and thereby have had a Foo.deployproj file generated, will do the deployment:msbuild Foo.dproj /p:Config=Debug /p:Platform=Android /t:DeployIf you have the .deployproj file you can combine the two steps in this one command (excuse any line wrapping this blog theme applies):msbuild Foo.dproj /p:Config=Debug /p:Platform=Android /t:Make;Deploy[Update – 16/10/2-17:I also bumped into the property that controls the Target Configuration, which can be Development or Application Store for Android. The BT_BuildType can either be Debug or AppStore for Android (for iOS there is also AdHoc. So if you want to build a signed app ready for upload to the Google Play store you could run:msbuild Foo.dproj /p:Config=Release /p:Platform=Android /t:Make;Deploy /p:BT_BuildType=AppStoreEnd Update ]So anyway, history to one side, I was wondering if there was another MSBuild target that did the installation, or if this was some custom code in the IDE, not exposed through MSBuild. My investigation suggests the latter to be the case, but I wanted a convenient command-line way to make, deploy and install the Android application (and even possibly launch it!).The best option I could rustle up at short notice was a batch file (or command script, if you prefer). Save the file below as BuildAndInstall.bat or BuildAndInstall.cmd, set up any of the paths etc. that need personalising to your system.Again, please excuse unsolicited line wrapping…. There is probably a nifty way to get this code into a horizontally scrollable div or similar, but I don’t have the time to do the research just now….@echo offrem Syntaxrem  Arg 1 = project namerem  Arg 2 (optional) = build configurationrem  Arg 3 (optional) = package nameset ANDROID_SDK=%PUBLIC%\Documents\Embarcadero\Studio\19.0\PlatformSDKs\android-sdk-windowsset ADB=%ANDROID_SDK%\platform-tools\adb.exeset FQ_PROJECT=%~f1set PROJECT_DIR=%~p1set PROJECT_NAME=%~n1set PACKAGE_NAME=com.embarcadero.%PROJECT_NAME%set CONFIG=Debugif X%1 == X goto syntaxif not exist %1 (  echo Cannot locate project %FQ_PROJECT%  goto :EOF)if not X%2 == X (  if "%2" == "Release" set CONFIG=Release)if not X%3 == X (  set PACKAGE_NAME=%3)pushd %PROJECT_DIR%echo.&echo Building %1&echo.msbuild %PROJECT_NAME%.dproj /p:Config=%CONFIG% /p:Platform=Android /t:Make || goto build_errorecho.&echo Deploying %1&echo.msbuild %PROJECT_NAME%.dproj /p:Config=%CONFIG% /p:Platform=Android /t:Deploy || goto deploy_errorecho.&echo Installing Android package&echo.%ADB% install -r Android\%CONFIG%\%PROJECT_NAME%\bin\%PROJECT_NAME%.apk || goto install_errorecho.&echo Launching Android app&echo.%ADB% -d shell am start -a android.intent.action.MAIN -n %PACKAGE_NAME%/com.embarcadero.firemonkey.FMXNativeActivity || goto launch_errorpopdecho.&echo Done!goto :EOF:syntaxecho BuildAndInstall syntax:echo.echo   BuildAndInstall ^<DelphiProjectFile^> [^<Configuration^> [^<AndroidPackageName^>]]echo.echo where:echo.echo ^<DelphiprojectFile^> is a Delphi project.dproj fileecho ^<Configuration^> is the required build configuration, Release or Debug, which defaults to Debugecho ^<AndroidPackageName^> is the Android package name for the project, in case it is different from com.embarcadero.projectgoto :EOF:build_errorecho Problem encountered while build the Android lib%PROJECT_NAME%.so native librarygoto :EOF:deploy_errorecho Problem encountered while creating the %PROJECT_NAME%.apk Android packagegoto :EOF:install_errorecho Problem encountered while installing %PROJECT_NAME%.apkgoto :EOF:launch_errorecho Problem encountered while launching %PROJECT_NAME%.apkgoto :EOFIf you young pups reading this are all into relatively modern PowerShell scripting or traditional Windows scripting, then this throwback to the world of DOS may fall uneasily on the eye, but it works and there is a lot of power available in DOS scripting commands.[ Update – 16/10/2017: I initially forgot to mention that you’d be wise to run this from a RAD Studio Command Prompt for the version of RAD Studio that you want to build your project. This ensures that the Windows search path is set up to find the correct compilers etc. Alternatively, at the top of my batch file you can do the equivalent of running a RAD Studio Command Prompt by inserting:CALL C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\rsvars.batIf you choose this latter option then you can use any old command prompt you like.End Update ]Now you can install and run an Android project with a command-line of:BuildAndInstall Foo.dprojif you want the release build, use:BuildAndInstall Foo.dproj ReleaseIf you’ve changed the package name (specified as package in the project options Version Info page) from the default com.embarcadero.Foo then to launch the app you’ll need to pass the package name on the command line:BuildAndInstall Foo.dproj Debug com.blong.FooDon’t forget that you will have to choose Project, Deploy libProjectname.so in the IDE menus once before this will work.I hope this is of use to someone….
Read More


I’m delighted to say that later this month I’ll be over in Cologne speaking at EKON 21, which runs from 23rd to 25th October, 2017 and is being held in Cologne in Germany.  I’m doing three Delphi-related talks on some of my favourite subjects: creative debugging, Android API usage and IDE tips/techniques.Unfortunately, though, being as all three talks are in the same day, Tuesday 24th October, I’m not sure I’ll get to see much of the other great talks on offer, which is a shame for me.It’s great to be heading back to EKON – I haven’t been over to Germany for a conference since long ago in 2004 at the joint BorCon Europe 2004 / EKON 8 conference in Frankfurt.In 2004 I was into interoperability between unmanaged code (Win32 and COM) and .NET code, as well as building .NET profiling tools. This year my Android talk is not a million miles from those old interoperability talks, looking at how to reach out from unmanaged Delphi Android ARM code to managed Java code, for various purposes and reasons.The debugging talk continues my efforts to help Delphi developers get better value for money from their debugger and debugging tools. This is a mission I’ve been on since the start of this century after having been inspired after watching Danny Thorpe do an excellent session at a BorCon in the late 90s, showing how to really utilise the CPU window and not see it simply as a source of horror.The IDE tips talk is also an evolution of a session I’ve done on and off over the course of this century, trying to share knowledge of the IDE, code editor and so on that will help you do your job just that bit faster.These talks are all based around Delphi although the concepts (and in some cases the specifics) are equally as applicable to C++Builder. I spend a lot of my working day working with C++Builder with a few regular clients and it is still a goal of mine to start getting more C++Builder information onto this blog.If any readers are going to EKON 21, I hope to see you there and look forward to a great conference![ As seems to usually be the case, it’s been a much longer gap than I would like since I last put pen finger to paper keyboard for this blog. Mea culpa – I will endeavour to allot more time for this sort of thing, or more particularly for posts of general practical value ]
Read More