Cross-origin resource sharing (CORS) is a mechanism that enables resources to be shared across domains. Typically this isn’t allowed to prevent security issues. To enable on your DataSnap REST server you can use the following code per MVP Nirav Kaku from India.
All you need to do is add a custom header in the Response before dispatching the result on the DataSnap server…
procedure TWebModule1.WebModuleBeforeDispatch(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
//allows cross domain calls
Response.SetCustomHeader('Access-Control-Allow-Origin','*');
if FServerFunctionInvokerAction <> nil then
FServerFunctionInvokerAction.Enabled := AllowServerFunctionInvoker;
end;
It is useful for DataSnap server developers who want
their REST calls to be supported via AJAX using JavaScript from a
different server.
Note: CORS is security feature of the browser so there could be some
dependency there. Tested with Firefox, Chrome and IE and it seems to
be working fine.
I hope you are all as excited about DelphiWeek as we are. On Wednesday we have CodeBattles scheduled. These are a fun way to show off your programming skills. We all use a Google, DocWiki and Stack Overflow during programming. The coding challenge isn’t a trivia competition, but an opportunity for you to show off your problem solving skills and use some of the latest features in XE7.
It will take place Wednesday 11-Feb-2015 from 8 AM to 10 AM PST. All coding will be done online during this time window via GoToWebinar.
The scoring is a combination of points based on features implemented and public voting. David I. is planning to make plaques to send the winner. I think it would be great to hang a plaque in the office with the winner’s names too.
If you want to take part in the CodeBattle, complete this short survey with your information. We are considering working with both teams and individuals, if we get enough sign ups for both. So far we already have a few individuals. It is open to all Delphi developers everywhere. Even if you are not comfortable with English, we can chat via Google Translate.
How are you Delphi programming skills? Want to visit Fortaleza, Brazil? I’m sure it is especially nice if you are in the northern hemisphere right now since Brazil is enjoying summer while we are stuck in winter.
Next week Hack’n Fortes is hosting a Delphi hackathon / programming marathon. Registration is closed, but you can always head down to watch. If Brazil is a little far away, we have an online Code Battle planned for Wednesday the 15th as part of Delphi Week 2015! #DelphiWeek
I’ve been playing with Raize Software‘s new Radiant Shapes components this week. These are the brand new primitive shape component set for FireMonkey on all platforms: Windows, OS X, iOS and Android. I’ve been a long time fan of Raize Components because of their attention to detail and high quality. Radiant Shapes continues this tradition.
Radiant Shapes is made up of 35 reusable shape controls that are all pretty flexible. If you caught Ray Konopka’s RAD In Action: Seeing is Believing on Data Visualization then you have a pretty good idea the importance of using primitive shapes like these to communicate useful information to your users, especially in mobile development.
All of the shapes include useful design time menus to make common changes quickly and easily. You can probably get away without using the Object Inspector for a lot of your common tasks. They also have various customizations that make them very flexible.
One thing that is interesting is they introduce the idea of a TRadiantDimension they allows you to specify some of the sizes as either absolute pixels, or as a scale factor. This gives great flexibility in how they behave when resized.
Ray Konopka introduced the Radiant Shapes during CodeRage 9 with a couple great sessions. You can catch the replay for both Object Pascal and C++.
I really like the TRadiantGear component, so I decided to play with it in detail. You can specify the number of cogs (teeth), their size (as a Radiant Dimension) and the size and visibility of the hole. Just like all the other shapes, they handle hit tests correctly, so at runtime, you can click between the cogs of the gear and it doesn’t produce an onClick event.
Just for fun I put down three gears and used LiveBindings to connect a TTrackBar.Value to their rotation. A little math in the OnAssigningValue event and I had all the gears rotating in unison. The fact that the gears stayed synced up, and the teeth meshed perfectly was really impressive.
procedure TForm4.RotateGearBigAssigningValue(Sender: TObject;
AssignValueRec: TBindingAssignValueRec; var Value: TValue;
var Handled: Boolean);
begin
Value := TValue.From(-1 * (Value.AsExtended / 2 + 18));
end;
procedure TForm4.RotateGearRightAssigningValue(Sender: TObject;
AssignValueRec: TBindingAssignValueRec; var Value: TValue;
var Handled: Boolean);
begin
Value := TValue.From(-1 * (Value.AsExtended + 18));
end;
18 is the offset for the gears (360° / 10 cogs / 2 (half offset) = 18) and the 2 comes from the big gear being twice as big (20 cogs), then the -1 is so they rotate the opposite direction.
Overall I am impressed with the Radiant Shapes. Something I would like to see include a polygon component where I can specify the number of sizes. You can do that with the star and gear, but a flexible polygon would be nice. Also, the shapes can be rotated with the rotation property, but it would be cool if there was a way to rotate it in the designer too. That might be a big undertaking though.
The Twitter #Code2014 ranking have become a bit of a tradition. At the end of the year everyone votes for the programming languages they used, or were their favorite for the year. Then they all get tabulated up to see how they rank. Once again Delphi did quite well, coming it at #9, just ahead of other mainstream languages like C and C++ as well as niche languages like Objective-C and Swift (developing for only one platform is so 2013). It was neck and neck with C#, ending with only 11 votes different.
Delphi finished 9th in the #Code2014 rankings on Twitter
There are actually still people voting, but the deadline was Friday, so the votes don’t count. I still appreciate the enthusiasm. Watching Delphi climb the charts was a real treat, and shows two things:
Delphi is still a very popular language
The Delphi community is amazing
I believe this second point to be the most important one. The community really came together to vote for Delphi and move it up the rankings. Makes me happy to be part of such an amazing community.
Looking at the top languages, they mostly have a web development theme. I’ve heard before that Twitter seems to have a web development bias, and this seems to reinforce that. Also since you are allowed to vote for more than one language we see SQL with a very high ranking, even though I imagine it had very few votes just for it (I may be wrong, but it seems like the kind of language you use with a general purpose language).
If you code in Delphi, then be sure to Tweet Delphi #Code2014 to have your vote counted. I’ve made it really easy for you, if you just log into Twitter and click the link you cast your vote. You can see the rankings on Code2014.com or just check the list of all the tweets for Delphi.
Vote, and tell your friends to vote. They filter to one per Twitter account.
If you still have a few people on your Christmas gift list that you just don’t know what to do for, check out the RAD Offer page. You’ll save some serious money, and they will get the best development tool for building highly connected multi-device native apps.
Get Free Bonuses with the purchase of RAD Studio XE7,
Delphi XE7 and C++Builder XE7 until December 31, 2014
Rapid SQL XE6
Rapid SQL® is the intelligent SQL IDE empowering database developers and DBAs the ability to create high-performing SQL code on all major databases from a single interface. Purchase RAD Studio, Delphi and C++Builder XE7 Enterprise or above and receive a license of Rapid SQL XE6. Redeem your license.
New Object Pascal Handbook by Marco Cantu
This brand new 300-page ebook is a complete guide to the current, modern Object Pascal programming language by best-selling Delphi books author and Delphi Senior Product Manager Marco Cantu. This new language manual for new & existing Object Pascal developers covers core language features, object-oriented programming with Object Pascal, and the latest language features like generics, anonymous methods, and reflection in todays’ Delphi compilers.
Mida Converter Basic
Mida Basic for RAD Studio XE7 is a special edition of the popular VCL to FireMonkey converter. Helps converting your VCL forms to multi-device, including data bindings and other advanced features with support for over 200 components.
Castalia for Delphi
Castalia is a premier code productivity plug-in for Delphi. With code refactoring, structural highlighting, parenthesis matching, flow control, highlighting, and live syntax checking, Castalia makes you more productive than ever. Use project statistics and code analysis to better understand your team productivity and code quality.
VCL and FireMonkey
Premium Styles
Customize the look of your VCL Windows applications with five premium styles including Coral, Diamond, Emerald, Sterling or Jet style. Customize your multi-device applications with seven premium FireMonkey styles including Jet, Sterling, Diamond, Emerald Crystal, Emerald Dark, Coral Crystal and Coral Dark styles.
FastCube VCL 2
FASTCUBE VCL is a set of OLAP Desktop components and a tool for effective data analysis. FastCube enables you to analyze data and to build summary tables (data slices) as well as create a variety of reports and graphs both easily and instantly. It’s a handy tool for the efficient analysis of data arrays.
Availability: Rapid SQL XE6 is available on Enterprise and above ESD purchases from Oct 20-December 31, 2014 (network licenses do not qualify). Other bonus pack items are available on purchases from Oct 1-December 31, 2014.See qualifying SKUs.
How to get it: After purchasing, click here to get your free bonus items. (Redeem free items within 14 days of offer expiration date). Not available with purchase of Starter edition.
Restrictions Apply. Not all products qualify for this offer.
Upgrade from any previous version and save up to 45%
Get the upgrade price on Delphi XE7, C++Builder XE7 or RAD Studio XE7 through December 31, 2014 regardless of what previous version you have. Save up to 45% off the regular new user price for the product license and stay up-to-date with automatic enrollment in the Recharge program.
Availablility: All eligible XE7 purchases from Oct 20-December 31, 2014. See qualifying SKUs.
Download and activate your trial and get Coding in Delphi by Nick Hodges for free.
By activating your trial, you will receive a free copy of Coding in Delphi. This ebook covers a variety of powerful Delphi programming features and techniques including Generics, Interfaces, Exception Handling, Anonymous Methods and more!
How to get it: After activating your trial, click here to download the ebook.
Previously I created a blog post about using Delphi and RAD Studio XE7 to develop for the Moto 360. The new FireUI Multi Device Designer (MDD) makes is a breeze to design for the new smaller UI. I’ve since updated the FireUI Devices project on GitHub to cover the Samsung Gear Live & LG-G watches in addition to the Moto 360.
I thought I would walk through the steps for developing with the Samsung Gear Live. One advantage it has over the Moto 360 is that it has a physical USB cable connection, so you don’t need to deploy via BlueTooth. This makes for a much faster deploy cycles. With a USB cable though, you need to install the ADB USB Drivers.
Put the device in USB Debugging Mode
Hold the home / side button until the settings menu appears (couple seconds)
Select About and tap Build Number until it notifies you that developer options are enabled.
Swipe left to right to go back
Select Developer Options and enable USB Debugging.
You still need to have the watch paired with a phone via the Android Wear app since the confirmation dialog is displayed there.
Run the SDK Manager / Android Tools and Make sure you have Android SDK Tools, Platform-tools and Build tools updated (this moves the ZipAlign.exe, so you need to tell the IDE where to find it.)
Gear Live should appear as an Other Device in device manager once you connect it to windows via USB.
Select Update Driver Software
Browse my computer for Driver software
Let me pick from a list of device drivers on my computer
Then select ADB Interface
Select SAMSUNG Android ADB Interface
On your phone you will see a dialog “Allow Wear Debugging” Check “Always allow .. . ” and then select OK.
Once you have done all of that, it will show up in your IDE as a target, and when you load the FireUI custom device for it, then you will have a great design surface for it too.
And you are ready to build your Gear Live app with Delphi XE7.
I’m sure I’ll have more coverage on Android Wear in the coming months too.
You can download the Samples and Components on GitHub. It covers voice recognition, text to speech and launching apps on Google glass with your voice. The examples also cover Android Wear.
Last year was my first visit to the Embarcadero Conference in São Paulo, Brazil and I loved it. So I am going back again this year. As an added treat I’m be joining Marco Canto, the Delphi product manager. We both speak together on Delphi Present and Future, then Marco does The Fun Side of Delphi and later I’ll cover Internet of Things, Bluetooth and AppTethering when I will also show some Delphi powered Brain-Computer Interface demos and a lucky volunteer will fly a quadricopter with their thoughts.
The Embarcadero Conference in Brazil is huge with a lot of great sessions. I always consider it a treat when I get to see Marco’s Fun Side of Delphi presentation. I wonder if he will show off the Elf & Wizard classes that are new in XE7?