Presentations and code samples from DAPUG 2014 workshop are now available online.
Big thanks to organizers (and especially Jens) – we had great time in Denmark! Hope to see you again some time!
Presentations and code samples from DAPUG 2014 workshop are now available online.
Big thanks to organizers (and especially Jens) – we had great time in Denmark! Hope to see you again some time!
If you install RAD Studio XE7 and then upgrade Android SDK to version 23, you won’t be able to deploy applications to Android devices anymore.
The reason for that is that ZipAlign.exe was moved out of sdk\tools folder in SDK 23 and XE7’s deployment process cannot find it anymore. Now it is located in sdk\build-tools\20.0.0, but only is Android SDK Build-tools rev. 20 are installed, which doesn’t happen automatically.
To fix my Delphi I first had to install Build tools rev. 20. Then I copied sdk\build-tools\20.0.0\zipalign.exe to sdk\tools\zipalign.exe. That fixed the deployment problem.
I’m hoping Embarcadero will fix this in the next update, but for now you can use this workaround.
[Android sdk folder can be found in c:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk]
This is a job offer for a full time programming job in Ljubljana.
Iščemo Delphi programerja za dolgotrajno razmerje; človeka, ki se ne ustraši stare kode in z veseljem programira s sodobnimi orodji. [XE2, prehod na sodobno različico je že v teku in ga bo pomagal zaključiti prav programer ali programerka, ki ga iščemo.] Delo se opravlja v pisarni v Ljubljani.
Več o podjetju: www.fab-online.com. Kontakt: primoz (pri) fab-online.com.
A snapshot from the XE7 presentation in Ljubljana.
Highlights of the presentation were FireUI, System.Threading, dynamic arrays, and OmniXML.
‘Twas a very nice crowd, asking LOTS of questions. It was also good to see some young(er) people and some Delphi [insert a prehistoric version here] users who finally decided that they should upgrade.
If you want to see all the great new stuff in XE7, join me on Wednesday, 17th in Ljubljana. We’ll cover the new VCL stuff, multithreading support, improvements for multi-device development, business mobile services and more.
As usual, presentation will be in Slovenian language.
This is one of rare posts on my blog that doesn’t cover pascal programming. Proceed on your own risk ;)
For the last half a year, I’ve been a happy owner of a Chromecast device. Great stuff, especially as it allows me (with a small hack) to watch Netflix on my TV and listen to Pandora. At the beginning, it was a bit unstable, but through regular updates it stabilized quite a bit – until build 17977 got installed.
Since that time I got random crashes while playing any media (video or audio) from any source (in-house or external provider). It would load the player app, start playing, then crash after a few seconds. It would work fine for days, even weeks, but then it would start crashing and I would not be able to use for for half a day, after which it would start working again.
I’ve decided that the hardware is broken, maybe overheating, and I bought another one. (Did I mention it’s cheap?) But no luck – it started behaving the same as soon as it has upgraded to build 17977.
Few days ago I found a network forum thread where someone (sorry, no link, it got lost) mentioned a possibility of a bad power source. (My Chromecast is plugged into TV’s USB port.) And when the device started playing tricks on me today, I plugged it into an external USB power supply. And – surprise, surprise – it started working!
Something weird is still going on. When I start playing in a new player (i.e. when I switch apps), media is played for few seconds, then the TV goes blank and its power light starts blinking, then the picture reappears and media continues to play.
My current guess is that Chromecast does something weird which basically quick-resets the TV. When Chromecast was plugged into TV’s USB port, that also reset the Chromecast, but now that it’s plugged into an external power source, Chromecast continues playing while the TV does its yoyo trick.
I’m not completely satisfied with this solution as I would rather see my Chromecast to turn off together with the TV, but it is a “good enough” workaround. I still love that device, though. It’s the best stuff Google made in a long long time.
I’m posting this blog in hope that it will help other Chromecast users who may run into the same problem.
If you are still deciding whether to attend my workshop, you should hurry up. The organizers have notified me that there are only few places left as there are some physical constraints they have to observe, namely how many people fit in the conference room ;)
BTW, if you are interested in the parallel part of the workshop, you’ll be glad to know that I’ll also be covering the new cross-platform multithreading support in XE7.
DAPUG, the Database Application Programmers Users Group (aka Danish Embarcadero User Group) is one of Delphi user groups which organizes great events twice a year. I’m very proud that they have invited me to speak in October, even though I’ll miss ITDevCon because of that :(
(A note to ITDevCon organizers – DAPUG’s autumn workshop is traditionally organized near the end of October.)
First day will be completely dedicated to multithreading. We’ll start with basics – why and how – and proceed with TThread-based multithreading on all supported platforms. After lunch we’ll focus more on high-level multithreading with the open-sourced OmniThreadLibrary.
A note to participants: I’ll be presenting multiple small problems for you to solve during the workshop. At least you should have Delphi installed on the computer (for best experience it should be one of the latest versions). If you really want to come prepared, you can also preload OmniThreadLibrary and if you are trying for the best in class award ;) you can read all about high-level multithreading in advance on the OmniThreadLibrary wiki.
The second day will be organized around three topics – attributes, regular expressions and continuous integration. The common point is productivity – in the first two sessions I’ll be showing you how to use some of the incredible power of Delphi to simplify your programming life and in the latter I’ll be focusing on the last stage of any application – building and deploying the release version.
Workshop will be held on October 21st and 22nd in Hotel Hesselet in Nyborg.
More information and registration form can be found here.
If you need to write software for phones/browsers/node.js/microcontrollers, you should check out the new Smart Mobile Studio 2.1 (beta 1). The list of new and fixed features is much too long to list here so I’ll just focus on the most important additions.
A deceptively simple question – how do you update a progress bar from a ForEach loop – popped up on the Google+ OmniThreadLibrary community. The implementation turned out to be quite tricky so I created an example (55_ForEachProgress) which is now part of the OmniThreadLibrary SVN repository.
The starting point was a simple Parallel.ForEach loop which I further simplified in the demo.
Parallel
.ForEach(1, CNumLoop)
.Execute(
procedure (const task: IOmniTask; const i: integer)
begin
// do some work
Sleep(1);
// update the progress bar - how?
end
);
We cannot simply update the progress bar from the ForEach executor as that code executes in a background thread and one must never ever access VCL GUI from a background thread! It is also no good to send “please update” Windows messages to main thread as Parallel.ForEach is by default blocking – it waits for all workers to stop working – and messages won’t be processed during ForEach execution.
Yesterday I had to write a mapping from a set of radio buttons to an integer (and back). I couldn’t use TRadioGroup and so I had to iterate over controls to find out which one is checked. To do that, I used an enumeration helper which I wrote long time ago.
function TfrmColorRemappingDlg.GetMapping: integer;
var
ctrl: TControl;
begin
Result := 0;
for ctrl in EnumControls(Self, TRadioButton) do
if TRadioButton(ctrl).Checked then
Exit(ctrl.Tag);
end;
At that point I decided that this old-way enumeration is not good enough for the modern times. What I particularly dislike about it is that I know the type of objects enumerator will return (TRadioButton in this example) but I still have to cast the enumeration variable to that type. The solution is simple – use generics!
Besides being a programmer, I like taking pretty pictures (and working with wood, but that’s another story). And from time to time I like to print some pictures and hang them on a wall.
Because framing pictures is expensive and, frankly, most of them don’t deserve it, I like to print a “virtual frame” – a thin black border followed by a wide white border – around each photo. Until recently, I was adding them in some stupid program I found on the Internet (it doesn’t deserve to be named), but I was always having problems because you had to specify border width in pixels – and if I wanted to set the same border (for example, a 1,5 mm black border followed by a 20 mm white border) for a set of pictures in a different resolutions, I had to calculate pixel sizes for each photo, which was a pain.
So I sat down and wrote a border-adding program. It allows you to specify border sizes in “real” measures, it can process one picture or a folder full of them and it can add a suffix to processed pictures (plus it will skip files containing this suffix if they are found in the source folder) and that’s about it. It is small, simple, solves a real problem and – what I found the most impressing – I wrote it in a single working day. Truth to be told, I needed about a month of work – an hour here, 15 minutes there – but all together I needed less than eight hours. That is the power of Delphi!
If you have a need for such tool, go ahead and download it from my Dropbox. You can also get the source, which is released to a public domain (i.e., do with it whatever you want). It depends on few external libraries, which are all released with an open source license: JCL, JVCL, GpDelphiUnits, OmniXML. At the moment the GUI is written in VCL, because I really didn’t want to spend too much time on this project and I know VCL by heart, but if somebody wants to go ahead and rewrite it in FireMonkey, I certainly won’t stand in his/her way.
Join me in Ljubljana on May 15th when I’ll be showing all the goodies that came with recently released RAD Studio XE6.
You cannot safe-cast a pointer. This will fail:
ptr as TProject
You can only cast pointers the unsafe way:
TProject(ptr)
That is, unless you use this neat trick:
TObject(ptr) as TProject
This will also catch programming errors, specifically a pointer that doesn’t point to an object.
If you have problems processing PNG images because you are using DevExpress components, add this to the beginning of your program’s uses list:
dxGDIPlusClasses,
Vcl.Imaging.PNGImage,
DevExpress registers PNG handler with doesn’t behave exactly the same as Delphi’s built-in TGraphics descendants. With this addition, PNGImage.RegisterFileFormat will be called after dxGDIPlusClasses.RegisterFileFormat and will overwrite DevExpress’ PNG handler.
There was a nasty race condition in the IOmniPipeline termination code which could result in access violations. It has been fixed in the SVN so please update to the latest version if you are using Parallel.Pipeline, Parallel.BackgroundWorker, or Parallel.ForkJoin.
Great thanks go to Dean from DeNovo Software who narrowed down the problem and make sure I can repeat it on my machine.
This Tuesday (March 4th) Embarcadero and Marand are organizing a RAD Studio XE5 presentation in Ljubljana. We’ll be showing great features that were implemented in RAD Studio in the past few years – from 64-bit Windows compilation, Unicode support and styling to multiplatform development, LiveBindings and FireDAC. For the first time in Slovenia we’ll be presenting the new REST library and C++ support for iOS.
Presentation will be given in Slovenian language. Register here.
As seen on Blogger:
I have just written a reply and clicked “Sign out”. For the third time since the Google changed the Blogger UI!
I don’t care that the “Publish” button is highlighted. “Sign out” is just placed in perfect position to click on when you are typing a response.
Fix this, Google!