Valid reasons for having Delphi AnsiString on Mobile platform…not only for Internet but for Shaders also. //…

It’s too bad that you need workarounds to get ByteStrings working on mobile devices as there are APIs there (like shaders) that work best with them. There was a nice discussion on this last year at [WayBack] I miss AnsiString on Mobile…not only for Internet but for Shaders also.// FMX.Context.GLES.pasconstGLESHeaderHigh: array [0..24] of byte =(Byte(‘p), […] … Read More

Read More

Cool App Winner for November: InfoTrain

I’m always pleasantly surprised by the variety of projects people come up with using Embarcadero tools, and our October Cool App winner is no exception. InfoTrain — developed by Damian Skrzek using Delphi — is an application that helps railway enthusiasts locate and discuss interesting trains.

When users notice interesting trains, they can add detailed information in the app that can be sorted and filtered by various details. “Railfans,” or “trainspotters,” can filter by the type of traction, region, railway line and many other features. Users can comment or update listings by adding photos or timely information about the current location of a train.

InfoTrain connects to a remote MySQL database via a PHP API to synchronize data between users. The app is currently available on all Android devices, with an iPhone version in the works.

InfoTrain is a perfect example of an enthusiast who was able to develop an app that scratches his own specific itch. The great thing is that Damian could then make that app available to all the other people who share his interest. Using a PHP API to connect to a MySQL backend is a creative solution to data sharing and shows the flexibility of Delphi.

When asked about his choice of languages, Damian said “Delphi is a friendly environment for beginners, powerful at the same time for advanced users. Great for creating cross-platform applications. Generally, Delphi is my favorite language.”

This video provides a nice overview of InfoTrain.

[YoutubeButton url=’https://www.youtube.com/watch?v=RZQMRV7hwMI’]

 

Interested in submitting for the Embarcadero’s Cool App contest? It’s open to any business or consumer application built with RAD Studio, Delphi or C++Builder. Embarcadero awards Cool App contest winners a $500 Amazon gift card and winning submissions are also highlighted on the company’s YouTube channel. For more information on the contest and a link to the submission form, click here.

Read More

Read More

Holiday Delphi To-Dos

After another year of record CodeRage participation, I’ve been talking to other developers about what they do to promote Delphi. It was immediately obvious that they are “way too busy writing code!” This is a huge improvement, as only a few years back the standard response was “well, Delphi is no longer cool.” However, we still have a challenge. We need to make it easier for our customers to champion us within their organizations. We want people to be proud to say that they “do Delphi.”

 

Here are a few Delphi holiday To-Dos if you are looking for a way to spread the merriment…

 

  1. Check out 10.2.2 with the new dark theme and a whole lot more. It will give you some good hints on where we are going with UX and it is just the beginning. Also, the Enterprise and Architect editions of RAD Studio now gets a RAD Server site license for FREE! A huge benefit! Don’t hesitate to provide feedback – we love it!

 

  1. Share Delphi @ 22 Magazine with your colleagues and managers to highlight the latest developments with Delphi and our ecosystem… there has been a lot of activity that has been missed. And yes there was some healthy debate on one forum around the number of countries in existence (we counted a huge number in one of our Delphi Boot Camps), but aside from classifications, the point is that we are seeing a resurgence and we like it!

 

  1. Build a Simple Mobile App with FMX. There is no better way to wow your customers, peers or supervisors than to see Delphi in action. There are plenty of samples and more coming your way. Write once and compile for Android and iOS, not to mention Windows and mac OS X.

 

  1. Check out the new Enterprise connectors. So simple to display your feed from Twitter and/or Facebook and show how fast you can build an app around it. More complex ideas may want to leverage the free InterBase for embedded mobile use. There are plenty of “disconnected” use cases that are difficult to do with other technologies.

 

  1. Watch a CodeRage replay on Embarcadero Academy.  Go catch a replay for a session you missed from CodeRage XII. They are all available on Embarcadero Academy. Share your favorite session with your friends. While you are there sign up for a course from the expert trainers on Embarcadero Academy. Also, make sure that if anyone doubts that there are good materials to learn Delphi, they know that this is no longer the case.

 

  1. Learn about the Ext JS framework. Sencha is new to our developer tools family, but already making a huge impact. There is a lot of tooling in existence to connect Delphi with Ext JS development. They share a lot in their completeness and focus on huge productivity improvements. There is a learning curve, but if you are looking for fast development across platforms with really nice UX, this is the way to go. Delphi and the associated VCL & FMX frameworks share a lot in common with Ext JS in the way they maintain compatibility for the long-run and provide unmatched performance. This sample app provides a great example that speaks both to FMX and Ext JS.

 

  1. Browse the GetIt Package Manager. Install a new style, sample project, library, or IDE Plugin. GetIt continues to expand: over 250 at last count. Look for new ways to solve the problems you face and make yourself even more productive.

 

  1. Blog about your favorite Delphi features, components or libraries and share it on social media. Delphi has an amazing 3rd party ecosystem. Check out the top 10 Delphi projects on GitHub or this huge collection of resources.

 

What’s on your holiday to-do list? Do you have any Delphi goals for the new year?

Read More

Read More

Delphi Blogs of the Month #57

As usual, this is a collection of links to relevant blog post and other newws you might heve missed over the recent perios of time, and that relate with Delphi one way or another. Embarcadero News There is a new Sencha MVP program, similar to the RAD Studio one: https://www.sencha.com/blog/sencha-mvp-program/ Healthcare App Prototype Built In Delphi Wins First Place In Startup Weekend Competition! Read more at https://community.embarcadero.com/blogs/entry/healthcare-app-prototype-built-in-delphi-wins-first-place-in-startup-weekend-competition Blog Posts Top 10 Most Popular Open Source Delphi Projects On GitHub By Star Rating by Eli at https://community.embarcadero.com/blogs/entry/top-10-most-popular-open-source-delphi-projects-on-github-by-star-rating RAD Studio Custom Editor Sub-views by David Hoyle at http://www.davidghoyle.co.uk/WordPress/?p=1831 (this is an extremely detailed example of writing editor views, which is a fairly complex extension to the RAD Studio IDE) Persisting enumeration and sets to JSON by Chee Wee Chua at http://chuacw.ath.cx/blogs/chuacw/archive/2017/12/11/persisting-enumeration-and-sets-to-json.aspx (a small and handy tip) Microsoft has a very interesting blog post by Matteo Pagani covering the Desktop Bridge, a technology we support in Delphi, and while not everything is directly applicable, it is a very interesting read: https://blogs.msdn.microsoft.com/appconsult/2017/11/06/desktop-bridge-best-practices-and-common-issues/ Supporting iPhone X display with Delphi by Dave Nottage at http://delphiworlds.com/2017/11/supporting-iphone-x-display-with-delphi/ (some related improvements will be made available in RAD Studio 10.2.2) Delphi + Enterprise Connectors + RAD Server = SAP native client for iOS and Android by Fernando Rizzato at https://community.embarcadero.com/blogs/entry/delphi-enterprise-connectors-rad-server-sap-native-client-for-ios-and-android (given the Enterprise Connectors cannot be used directly on mobile, you need a middle tier architecture to leverage them on your phone -- which also opens us to using push notifications) Experimenting with Neural Networks – Part 6 by Craig Chapman at http://chapmanworld.com/2017/11/19/experimenting-with-neural-networks-part-6/ (read the previous 5 parts as well, of course) Massive Collection Of Design Patterns, Frameworks, Components, And Language Features For Delphi at https://community.embarcadero.com/blogs/entry/massive-collection-of-design-patterns-frameworks-components-and-language-features-for-delphi Older but Great Posts I missed this, but worth highlighting: A Delphi Primer with RAD Studio 10.2 by T Theobald at http://borkedcode.com/wp/?p=1470 (a nice, long, and detailed "first look" to Delphi) Roll your own lightweight, scalable backend using ZeroMQ at https://blog.grijjy.com/2017/05/02/roll-your-own-lightweight-scalable-backend-using-zeromq/ Projects and Libraries Pyscripter is a feature-rich but lightweight Python IDE (written in Delphi): https://github.com/pyscripter/pyscripter. There is also a related Python Delphi integration package at https://github.com/pyscripter/python4delphi and this classic page http://www.atug.com/andypatterns/pythonDelphiTalk.htm ​    
Read More

RAD Android is Our Cool App Winner for October

I hope everyone had a nice Thanksgiving, and survived the Black Friday/Cyber Monday marketing deluge. I was so busy catching up with family and eating too much that I’m just now announcing Embarcadero’s October Cool App contest winner is RAD Android, an app that makes it easy for people to develop mobile programs.

RAD Android, created by talented developer Abdalkader, is a tiny programming language for the Android operating system that allows anyone to write simple programs for Android devices from an Android device. These apps leverage wireless capabilities such as Bluetooth, SMS and Wi-Fi so people can create a wide variety of useful smartphone tools. They can also communicate with the Arduino open source electronics platform to enable makers and tinkerers of all levels to develop an array of imaginative tools and projects such as digital scientific instruments or home tools like an automatic guitar tuner.

Using Delphi to create an application development solution, even a tiny one, is a significant undertaking. RAD Android is an amazing example of how native development can unlock the power of the Android platform, given a dedicated and talented developer with the right skills and tools for the job.

 

This video shows RAD Android in action:

[YoutubeButton url=’https://www.youtube.com/watch?v=9s8L3IMu9pY’]
 
 
Or visit the Google Play store and install this free app for yourself!
 
Interested in submitting for the Embarcadero’s Cool App contest? It’s open to any business or consumer application built with RAD Studio, Delphi or C++Builder. Embarcadero awards Cool App contest winners a $500 Amazon gift card and winning submissions are also highlighted on the company’s YouTube channel. For more information on the contest and a link to the submission form, click here.

 

Read More

Read More

tiOPF discussion thread

Sometimes the title of a G+ entry looks not so interesting, but then you read the comments. In this cast it’s about the mediator pattern support in the tiOPF object persistence framework, how it works very well from Free Pascal and both classic and  modern Delphi compilers and why developers dislike ARC. It’s cool as it […] … Read More

Read More

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. You can see it at your leisure now here at Embarcadero Academy.
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