Delphi Handbooks Collection

Delphi XE Handbook

Delphi 2010 Handbook

Thursday, July 17, 2014

Apache Support in Delphi XE6

Today I'm giving a Developer Skills Sprint on Apache support in RAD Studio XE6, and I'd like to complement the session with this blog post, showing some of the code and providing the same hints and suggestions.

Today I'm giving a Developer Skill Sprint on Apache support in RAD Studio XE6 (I already gave the first session live, the recording will be replayed), and I'd like to complement the session with this blog post, showing some of the code and providing the same hints and suggestions.

First of all, the Apache support is part of WebBroker foundations, and so it can be used for direct WebBroker applications, DataSnap applications based on WebBroker, SAOP servers, and many other scenarios. In a simple WebBroker application, you now have the following options:

If you pick Apache, you'll see a second rather useless page asking for VCL or FMX compatibility (for the generated data module), while the third page has the Apache specific options:

Here you can set the version of Apache (this results in a specific unit being referenced, displayed in the third box, which you can easily change later) and the module name (which is also the project name). As you finish, you'll get a project made of a standard WebBroker data module plus a specific library project file.

Remember that depending if you have a 32 bit or 64 bit version of Apache, you'll have to compile the module as a Win32 or Win64 Delphi (or C++Builder) project.

This generated file includes, as comments, the Apache configuration. So if you go with all default, you'll have the following configuration suggestion:

 LoadModule webbroker_module modules/mod_webbroker.dll
 <Location /xyz>
    SetHandler mod_webbroker-handler
 </Location>

In the LoadModule directive the first element is the internal module name, which is the name of the exported configuration data:

var
  GModuleData: TApacheModuleData;
exports
  GModuleData name 'webbroker_module';

You can easily change that string and update the configuration accordingly. The second parameter of LoadLibrary is the DLL name.

The Location directive, instead, indicate the virtual URL the module is mapped to (/xyz in the demo) and the "handler" that is going to be processed. The module, in fact, registers a handler with Apache, and everything meant for that handler will be passed to the module. The default handler name is generated automatically form the project name, like  mod_webbroker-handler . If you want to use a custom handler name, you'll have to take the second line of the project initialization code,

  Web.ApacheApp.InitApplication(@GModuleData);

and change it by adding a second parameter to InitApplication, which is exactly the handler name. So you could change this to:

  Web.ApacheApp.InitApplication(@GModuleData, 'myhandler');

and update the configuration accordingly as:

 <Location /myurl>
    SetHandler myhandler
 </Location>
That's it. In the actual skill sprint I also discussed how to configure Apache as a proxy server to connect to a stand alone HTTP server executable. This is the relevant code snippet for reference:
  ProxyPass /another http://localhost:9099
  ProxyPassReverse /another http://localhost:9099
  ProxyPreserveHost On 
There are two more editions of the skill sprint today, and the replay will soon be available as well. I'll add a comment to this blog post when I'll have the replay URL.




Thursday, July 10, 2014

Versioning Mobile Store Applications

As you publish single source applications written in Delphi on the Apple App Store and the Google Play Store, you easily bump into an issue: each store uses a different version numbering rule.

As you publish single source applications written in Delphi on the Apple App Store and the Google Play Store, you easily bump into an issue: each store uses a different version numbering rule. This is my direct experience with the "My Minifigures" app I wrote with my son and published on both stores (see the links above).

On both stores, you have the concept of a version number (like 1.1) and a release number (like 14). In Delphi, you can enter those easily, doing manual increments or letting the system increase the release number at every build.

The way these version numbers are used, however, is totally different. On the Play Store, what matters is the internal, progressive release number. Each following release must have a higher release number (15, 16, 17 and so on -- but you can skip some). Rather simple. This implies that the version number is an additional information you can show to users, but nothing relevant for the store. Internally, the APK version is just a number:

This is the corresponding project options pane:

On the App Store the situation is exactly the opposite. While you can use build numbers as you wish, you need to use a "two elements" versions number, like 1.1, which have to be increased at each release in logical sequence (like 1.2, 1.3, 2.0, 2.1, etc). This is how the version is reported in iTunesConnect:

This is the specific project options pane:

So, how can you handle a common course with synchronous releases? basically by merging the two mechanisms and keeping them in parallel. As an example, if you have a release version 1.1.14 the next one could be 1.2.15. That is, version 15 for Android and version 1.2 on iOS. Actually if you see the Delphi project settings and the corresponding versions in the stores in the four images above, you can see the numbering schema I'm using for this app. 

Wednesday, July 9, 2014

Delphi Blogs of the Week #15

A little busy and it took a little to move the server hosting this blog, but here am I again with a other round of links.

A little busy and it took a little to move the server hosting this blog, but here am I again with another round of links.

RAD Studio and Appmethod Development 

Other Notable Blog Posts and News

 

Wednesday, June 25, 2014

RAD Studio Recharge Plan, Again

Just wanted to remind all of the existing XE5 users that they have a chance to upgrade to XE6 for a low cost, but should do that now.

 

Just wanted to remind all of the existing XE5 users that they have a chance to upgrade to XE6 for a low cost, using the recharge plan. This is automatically active for anyone who owns a license of Delphi XE5, C++Builder XE5, or RAD Studio XE5, with any edition (safe for the Starter). With recharge you can move your Professional or Enterprise license, and even higher SKUs and add-on packs, to the same edition of the last version of the product, XE6. The cost of a recharge is slightly less than half of the regular upgrade cost, so if you recharge twice in an year you end up saving, not spending more!

Notice that this is a one-time deal, that you'll be able to re-use again to move from XE6 to XE7 or so forth, but it has no implications for future upgrades. You get into the "recharge plan" anytime and get out any time: Just recharge your license to the latest, if applicable, and continue doing so for as long as you wish. No strings attached, no obliation, no upfront fee (like in the maintenance).

Of course, if you are interested you need to act now. The sooner you recharge, the more you take advantage of the value. You won't be able to recharge once we ship a new version, but waiting until the end of the release cycle will dilute the "recharge plan" value, compared to traditional upgrades.

Notice also that you can buy a "recharge" directly form us or from your favorite reseller. All of the details at:

www.embarcadero.com/products/rad-studio/recharge

 





Monday, June 23, 2014

RAD Studio 2014 Developers Survey

A new survey of Delphi and C++Builder customers is available. Your input is appreciated and will help shape the future versions of the product.

A new survey of RAD Studio, Delphi and C++Builder customers is available. Your input is appreciated and will help shape the future versions of the product.

https://www.surveymonkey.com/s/2014RADStudioSurvey

This is the "2014 RAD Studio. Delphi, and C++Builder Developer Survey", which takes roughly 20 to 30 minutes, as it has 103 questions over 16 pages. We know this takes a lot of time to complete, but we really use the input from the survey to shape the product, both in terms of overall features, and in terms of details of the implementation.

No question about a feature is a promise, but your input can help turn some ideas into new product areas, if there is consensus that something is really worth. There are many open questions, making it possible to include extra information beyond what we are considering. Feel free to use those as well, of course.

Finally, help us spread the word about the survey, tell it to your friends who use Delphi or C++Builder, blog or tweet or facebook or googleplus about it...

Delphi Blogs of the Week #14

Maybe this is the blogs of the month, but anyway, here is another edition.

Maybe this is the blogs of the month, but anyway, here is another edition of this collection of relevant blog posts. The most relevant news was the release of Update 2 for XE6 and of Appmethod.

Technical Blog Posts

Non-Tech or Non-Delphi

That's all for these few weeks. Trying to get more regular, but no promise.

 

Thursday, June 19, 2014

RAD Studio XE6 Update 1 Available

Update 1 of XE6 versions of RAD Studio, C++Builder and Delphi are available as free registered users downloads on Embarcadero web site. And today the company also officially releases the new Appmethod development environment.

Update 1 of XE6 versions of RAD Studio, C++Builder and Delphi are available today as free registered users downloads on Embarcadero web site.

Installing Udpate 1

Specifically, the Delphi web install is at downloads.embarcadero.com/item/29895, the RAD Studio install is at downloads.embarcadero.com/item/29896 and the C++Builder update is at downloads.embarcadero.com/item/29894

Notice that Update 1 requires a full uninstall/reinstall. Why it this the case? Microsoft Installer technology, officially required on the Windows platform, makes applying patches extremely slow. If you have to many files to replace (as we do), applying a patch will take hours... much longer than a full uninstall and reinstall. What you can do is uninstall keeping your registry settings, and your reinstalled product will keep the same settings, including third party components you might have added to the IDE:

Other install options (like full DVD download) will be available soon. Update: The IOS for registered users is at  cc.embarcadero.com/item/29820

More On the Update... and XE6

The list of bugs fixed by this update is available at http://edn.embarcadero.com/article/43893. As you can see there are over 30 QC bugs fixed (the actual bug numbers are listed) and another 90 bugs found internally (some of which might be duplicate of other QC entries, as well).

The areas covered encompass the entire product with bugs in REST client and BaaS support, several C++ and Object Pascal compilers, data access libraries (IBX, dbx, FireDAC, DataSnap), quite a few in the debuggers for the various platforms, demos, FireMonkey and VCL component, the IDE, RTL, the new App Tethering, and even SOAP.

In other words, this update makes a quality product even better. If you still don't own XE6, what are you waiting? There are great offers, discounted updates, and extra free components available only until the end of June. Info at http://www.embarcadero.com/radoffer.

A New Toolbar in the XE6 IDE

Beside bug fixes there is also a new feature in the IDE, namely a new toolbar we added to Appmethod for new developers (see below), but that can also come handy to existing RAD Studio users, the reason why it is in both products. The new toolbar has a target platform selector and a target device selector for the given platform, making those options easier to reach than in the project manager:

Appmethod is Here

Today the company also officially released the new Appmethod development environment (based on the RAD Studio XE6 Update 1 bits). Appmethod is not meant for existing Delphi or RAD Studio customers, but you are more than welcome to try it out and recommend it to your friends who are in mobile development. The only caveat is you should not install it on the same physical machine or virtual machine where XE6 is installed, as the two don't coexist (they are installed in the same folder).

Why does Appmethod matter to Delphi developers? Not that you really want to use it, but it is the tool to send to your friends looking for a mobile-centric, subscription-based solution. The key difference is the way the product is sold, because in Appmethod you buy the platforms you want, and code in either C++ or Object Pascal.

One special thing in Appmethod is that the C++ Android phone version is free to use and deploy apps to the Play Store. All of the information is on the specific appmethod.com web site.

 

Wednesday, June 11, 2014

Swift Development for iOS... and Android with C++ and Object Pascal

Swift is the name of the new programming language by Apple... but I think RAD Studio offers faster development and for more platforms, and adopt two equally powerful languages, C++ and modern Object Pascal.

Swift is the name of the new programming language by Apple, announced last week at the company developers conference. I'm pretty sure you've heard about it.

Swift Roundup

Here are some interesting links and blogs, with widely different opinions:

Language Considerations (C++ and Object Pascal)

I think that RAD Studio, with C++ and modern Object Pascal, offers faster development and for more platforms. Development is based on an equally powerful language, but it is more visual, offers component previews and live data at design time. This is due to the libraries, but there is a clear language influence. Anyway with RAD Studio a single source code will work both on iOS and Android, not to mention Windows and Mac.

By comparison, Swift can be used only for Mac and iOS development, and given it is a proprietary language, it might remain limited to those two platform. Not that the scenario was very different in ObjectiveC, and certainly Swift seems a better and more modern language from what I've read so far.

What does this new language mean for the languages used by RAD Studio?

  • C++ remains a more open and flexible option. With C++Builder and Appmethod you use the same LLVM engine Apple leverages and embrace the same ARC memory management on mobile, you have a similar features set... but a more standard language and many common C++ libraries to use.
     
  • Object Pascal is very similar to Swift features-wise, again uses the same underlying architecture and can gain the same speed of compiled code. Given iOS developers will have to learn a new language, why not learn one that will give them support for more platforms (Android included)?

Swift vs. Object Pascal

How can we compare Swift to Object Pascal on mobile language-wise? Both languages can compile via LLVM, use ARC memory management, are strongly typed, have full support for object-oriented programming with single inheritance and multiple interfaces, both support generics, both have closures. The languages even share some keywords like self and override. And AnyValue looks a lot like TValue.

One more thing. From Tim Anderson article: "There is an interesting feature called Extensions which lets you add methods to any existing type. For example, you could extend Int with a prettyprint method and then call 3.prettyprint." Object Pascal has the same exact feature, it is called helpers and can be applies to classes, records, and native data types. You can write "3.ToString" in Delphi XE6 on all platforms.

Where Swift has more flexibility is in the use of implicit types, tuples, and distinction between nullable and non-nullable types. What seems missing is exception handling, which I personally find quite odd. What I like more in Object Pascal is the use of properties, published, and streaming; named and virtual constructors and destructors, plus class references and class operations, along with rich reflection and attributes. I also prefer the way closures capture the execution context. But this could lead a lengthly debate on languages features, which I really don't want to get into.

Temporary Conclusion

Personally, it is very interesting to see a new programming language coming, and I'm sure Swift will have a good following, because it seems nicer than ObjectiveC and many iOS and Mac developer will move to it. It might also be easier for C# developers to adopt it. Again, it is nice to see some ideas from Object Pascal in Swift, but I'm quite sure there are a couple of nice ideas in Swift that Object Pascal could borrow in the future.

One final question: With more (new) languages gettign wider adoption, will the language barriers reduce and will developer be more willing to be fluent in multiple languages?





Monday, June 2, 2014

Delphi Developer Days 2014 in Europe

Cary Jensen and Bob Swart are coming along with another two stops of their popular 2-days Delphi class in Amsterdam and London.

Cary Jensen and Bob Swart are coming along with another two stops of their popular 2-days Delphi class in Amsterdam (June 12th) and London (june 18th), after the stop in Frankfurt and the two in the US.

This is the event I was involved with Cary before joining Embarcadero, and he and Bob have been pushing along, providing Delphi developers with solid foundations and tips about the latest features for VCL and FireMonkey, desktop and mobile.

For all information, visit www.delphideveloperdays.com. For a special extra discount see the special page they set up for those coming from my blog, Marco 10% Discount

The event is very valuable, and it has my recommendation.

 

Thursday, May 29, 2014

Developer Skill Sprints by Embarcadero

Today JT kicked off the new Embarcadero webinar series called "Developer Skill Sprints". This event will run twice a week, until the end of June.

Today JT kicked off the new Embarcadero webinar series called "Developer Skill Sprints". This event will run twice a week, until the end of June, on Tuesdays and Thursdays. It runs 3 times a day (more of less the standard webinar times) and it is a short and focused how-to session (taking 20 to 30 minutes plus questions and answers).

More information on the schedule and the sign up for are available at  forms.embarcadero.com/DeveloperSkillSprintsWebinarSeries.

Topics for the month include:

  • Use C++ Packages in your 64bit Windows Applications
  • Remote Control a Windows App from a Mobile Device
  • Add Taskbar Controls to Modernize your Windows Applications
  • Modernize your Windows Look and Feel with TMS Modern UI Bonus Pack
  • Add Ads to Monetize your Mobile App
  • Create and Consume a Custom REST API
  • Push a Notification from your Windows App to your Mobile Apps with Kinvey BaaS
  • Manage User Accounts and Storage with Parse BaaS
  • Create a Tablet-specific VCL Windows App
  • Talk to GPS and Accelerometer on your Windows Tablet with VCL

I'll be doing some of the sessions, I'm likely going to tweet about my actual session one of two days before each (so follow me on Twitter or Facebook for specific session updates, if you don't do this already). I'm going to do one or two next week, for example.