Tag Archives: delphi

CodeRage C++

Tomorrow is the start of CodeRage 8 C++, which is a lot like regular CodeRage, but with an emphasis on C++Builder. This time there is a lot of coverage on the new iOS support, as well as the new REST Components and FireDAC data access.

It all starts with JT’s opening keynote at 6:00 AM Pacific Time, which may also be of interest to Delphi developers who want to get some glimmers of future plans, roadmaps and announcements. Actually most of the sessions will have content of interest to Delphi developers, especially if you’ve missed some of the more recent CodeRage conferences. But if you are a C++ developers, then be sure to make time for all the sessions!

CodeRage C++ - February 25-26, 2014

The Delphi Object Pascal Language

What’s in a name? That which we call a rose
By any other name would smell as sweet;

The other day I noticed Github has a language choice for Pascal, but not Delphi. It turns out originally they had Delphi listed as a language, but some of the Delphi clones were getting marked as Delphi, so they renamed it to the more generic Pascal. Which immediately resulted in people requesting they rolled it back.

This brings up a good question though, “What is Delphi and what is Object Pascal?” Interestingly there were three implementations of Object Pascal that evolved from the original Pascal. The one we are all familiar with was designed at Borland as part of Turbo Pascal. Apple also designed one consulting with Nicholas Wirth. And there was the Think Pascal IDE with it’s own flavor.

The Borland flavor of Object Pascal evolved into the language we see in Delphi today, while the other two faded away. There actually exists a few other variations of Object Pascal, most all of which were inspired by the language that still lives in Delphi today.

Personally I think it is exciting to see so many other tools and languages in the Object Pascal and Pascal space. That is part of what made C & C++ so vibrant: All the other languages wanted to copy them (Java, JavaScript, C#, etc.)

So back to the question, “What is Delphi and what is Object Pascal.” Object Pascal is the language that powers Delphi. Object Pascal can exist without Delphi, but part of what defines Delphi is it’s Object Pascal language. Just in the same way C++Builder isn’t the only implementation of C++, but part of C++Builder is the C++ language. So Delphi and C++Builder are each the whole package: Language + IDE + Compiler + Debugger + Libraries + Tools. You could say they are the definitive implementation of those languages.

Could we see Delphi with a different language? That would be interesting. At one end of the spectrum there was Delphi for PHP (which evolved into HTML5 Builder.) It was Delphi’s Rapid Application Development concept combined with the PHP language. And then Delphi Prism which used the Oxygene language variant of Object Pascal combined with Visual Studio and .NET.

In my opinion, Delphi is a specific version of Object Pascal, if for no other reason than because it has a fabulous runtime library and framework. Using Object Pascal without TStringList and all the other useful types, function and libraries that Delphi comes with wouldn’t be much fun.

Hidden features in the Delphi Object Pascal language

A list of hidden features in Delphi Object Pascal that are great, obscure, best avoided or remarkable.

This was copied from Stack Overflow’s question of the same name which is closed and flagged for deletion. Licensed under cc by-sa 3.0 with attribution required. I’ve made a few changes, updates and some copy editing. Original question by Johan and others on May 19 2011 at 18:34. Post inspired by Jeroen W. Pluimers’ post.

Read more »

Oh Yeah, the Ouya!

The Ouya is an Android powered game console / set-top box that you can pick up for $99. Not only is it a cheap game console, but it is also an affordable Android platform designed to drive big screen TVs. Easily turn a TV into a wall mounted dashboard or living picture frame.

Once the ADB driver is installed, You can develop for and deploy to it with Delphi XE5 just like any other Android device.

This video is from our Making the Connection: Programming Devices and Gadgets with RAD Studio webinar. Check out the on-demand replay and download the full source code too.

The Ouya has an SDK that goes beyond what I showed above. I’ll be revisiting it with more updates in the future.

Connecting Delphi to my Brain with the Emotiv EPOC

Emotiv EPOC NeuroheadsetThe Emotiv EPOC might seem more Sci-Fi than practical technology. It is designed to pick up on brain waves through its 14 brain wave sensors (plus 2 reference receivers) and convert them into a usable signal for your computer. For head tracking it also includes a head mounted gyroscope.

The sensor input comes in 4 different categories:

  • Head rotation: The gyroscope returns acceleration information about the movement of your head.
  • Facial Expressions: Referred to as the Expressiv Suite, it processes the signals to detect facial expressions in real time. This includes winks, smiles, and eye movement.
  • Emotions: The Affectiv Suite provides real time emotional feedback including frustration, distraction, etc.
  • Direct Thought Control: The Cognitiv Suite lets you define trained brain patterns that you associate with different outcomes. When you repeat the brain pattern the system responds appropriately.

If you want to play with the Emotiv EPOC it is $500 for the developer set. The normal consumer set only works with official licensed software. It comes with a nice control panel that lets you play with the different inputs.

Thanks to the work of Simon J. Stuart (aka LaKraven) the SDK has a full Delphi translation. I have a short demo using the gyroscope. The brain access systems were giving me a handshake error, but that may be a commentary on my brain power.

My next objective is to unlock the brain interface and combine that with the Parrot AR.Drone api so I can fly the quadricopter with my mind.

That was part of the 11 demos in our Devices and Gadgets webinar. You can access the full replay on demand, which includes access to most all the drivers, wrappers, apis and source code. The only missing source code is to Allen Bauer‘s bluetooth infrared velocity screen system. He’ll have a blog post about that one.

Connecting to the Parrot AR.Drone 2.0 from Delphi XE5

My first thought when I see cool technology is to figure out how to connect to it with Delphi. So the day I got the Parrot AR.Drone 2.0 quadricopter I started working on Delphi interface. By the time evening rolled around the batteries were dead (after a couple recharges), but I had a basic interface working. The official developer guide seemed to be a little out of date, or I was reading it wrong, but once I got my facts staight, connecting was really easy. http://www.youtube.com/watch?v=aaGe2aERwgI The Parrot AR.Drone has it’s own access point. Once you’ve connected to it, then it is simply a matter of sending UDP packets for the basic controls. To accomplish that I simply used the Indy UDP Client: TIdUDPClient. Each command is sent with an increasing sequence number, so I initialize my interface as follows:

  udp := TIdUDPClient.Create(nil);
  udp.Host := '';
  udp.Port := 5556;
  seq := 1;

The AR.Drone is always at since it is the access point, and the port for communication is 5556 (one of a few ports, but the one we need for now.) It is worth pointing out that if you’ve previously flown your AR.Drone with the FreeFlight mobile app then you may need to reset your drone to unpair it. Otherwise it is paired to only that device. The commands are formatted with an AT* prefix, and a series of arguments. For example, to take off, the command is AT*REF=1,290718208 where AT*REF is the command, 1 is the sequence number (always the first argument) and 290718208 is a bitmask that means take off. I created a SendCommand routine that looks like:

procedure TARDrone.SendCommand(cmd, arg: string);
  full: string;
  if not udp.Active then Connect;

  full := Format('%s=%d,%s' + Chr(13), [Cmd, Seq, arg]);
  Seq := Seq + 1;

Notice the command is terminated with a carriage return (#13). The documentation says line-feed (#10), it is wrong. Supposedly you can send multiple commands in the same message, if they are separated by the carriage return. I haven’t tested that. Then I can send the some common commands like this:

  SendCommand('AT*REF','290718208'); // Takeoff
  SendCommand('AT*REF','290717696'); // Land
  SendCommand('AT*CONFIG', '"control:altitude_max","10000"'); // unlimited altitude
  SendCommand('AT*CONFIG', '"control:altitude_max","5000"'); // restrituded altitude - unsure what units 500-5000.
  SendCommand('AT*PCMD','1,0,0,0,0'); // Hover (stop movement)

PCMD is the move command. It takes 5 arguments (after the sequence number.) The first is the controller type, which we are leaving 1 for now. The next 4 are phi, theta, gaz, yaw and they are floating point numbers in an integer representation. This is where it gets interesting. The documentation says:

The number -0.8 is stored in memory as a 32-bit word whose value is BF4CCCCD(base 16), according to the IEEE-754 format. This 32-bit word can be considered as holding the 32-bit integer value -1085485875(base 10).

The first way I thought of to access the same memory as two different types is a variant record. So I came up with the following helper routine:

function IEEEFloat(const aFloat: Single): Integer;
  TIEEEFloat = record
    case Boolean of
      True: (Float: Single);
      False: (Int: Integer);
  Convert: TIEEEFloat;
  Convert.Float := aFloat;
  Result := Convert.Int;

Using that I built a move routine that takes 4 singles (32-bit floats) and sends them as integers:

procedure TARDrone.Move(const phi, theta, gaz, yaw: Single);
    [IEEEFloat(phi), IEEEFloat(theta), IEEEFloat(gaz), IEEEFloat(yaw)]));

Now if I want the drone to go up I can call:

  Move(0,0,5.6,0); // positive gaz is upward acceleration

Now it is just a matter of figuring out how to the rest of the movements map to the physical worked and building a user interface on Android, iOS, Windows or Mac. Maybe all 4! Once I build up the API a little bit more I’ll share some full working apps and libraries. Let me know if you are interested in collaborating on such.

51 – Nick Hodges

Talking with Nick Hodges, former Delphi product manager, Spirit of Delphi award winner, development manager at Gateway Ticketing, and all around great guy. This was originally going to be part of a series of pre-release podcasts highlighting XE3, but that didn’t work out. Before talking with Nick I did a little coverage on XE3 and Oxygene 5.2, including the new Nougat flavor. I’ll have more coverage on XE3 and Oxygene 5.2 in future podcasts.

Nick and I discuss unit testing, development methodology, the Spring Framework and other interesting topics on Delphi development.

[Fixed the audio!]

Delphi Tage 2010

Recorded live and in person at Delphi Tage in Berlin (I’m still here for 2 more weeks for EKON too). The Delphi Tage (“Delphi Days”) was a short (3-day) conference organized by the German Delphi PRAXiS community forums, alongside Embacrdero and Developer Experts.  It provided two days of preconference workshops, and a day with 3 tracks of conference-style talks on various topics surrounding Delphi and Delphi Prism . Our podcast is basically a roundtable discussion with a bunch of people involved in the conference, including the organizers (Daniel Wolf and Daniel Magin), some RemObjects folks, David I from Embarcadero and Uwe Schuster (the guy behind the SVN integration in Delphi/Win32 XE) and Arvid Winkelsdorf of Indy fame.

Since this was so much fun, we decided to share this episode between here and RemObjects Radio.

Update: The organizers of the Delphi-Tage is the German Delphi community represented through Delphi-Praxis, Delphi-Treff and Entwickler-Ecke supported by Embarcadero Germany and Developer Experts.  – Thanks to Martin for clarifying that for me.

42 – David I

Today we talk with David I, chief Developer Evangelist and VP of Developer Relations from Embarcadero Technologies.

We talk about

41 – Primoz Gabrijelcic – OmniThreadLibrary

Primoz is a long time Delphi developer as well as writer for The Delphi Magazine, Monitor and Blaise Pascal magazines.  You may know him from his blog TheDelphiGeek.com or his OmniThreadLibrary for threading in Delphi.  You can also find his articles at 17th Elephant and he is on Stack Overflow.

  • We discuss Delphi Mac support
  • Delphi Garbage Collection
  • 64-Bit Delphi
  • The OmniThreadLibrary
  • and more!