The “OTL book” has just been extended with a chapter on synchronization (22 pages). Basic understanding of synchronization issues and critical section usage is required as this chapter only deals with OmniThreadLibrary-specific support for locking.
Saturday, December 22, 2012
Tuesday, December 18, 2012
Due to a strong language barrier we don’t hear from Turkish programmers much even though the programming (and Delphi) community in this big country is quite strong. That’s why I was pleasantly surprised when I received a proposal from that country to translate the OmniThreadLibrary book. We quickly set up a workflow (as the OTL book is still being written this is not a trivial task) and the book is now being translated.
Although I didn’t see more than a few translated paragraphs yet, I have great hopes that the initial Turkish release will join the ever growing family of the OTL books (English, Russian, Spanish) early next year. Until then, you can express the interest in the book here.
Great thanks go to Tugrul Helvaci for initiating the project and to Ramazan Gülbahar for translating the book!
* Parallel Programming with OmniThreadLibrary
Friday, November 23, 2012
On Thursday, 29th I’ll be leading a workshop about LiveBindings and Visual LiveBindings in Ljubljana. The workshop will cover both XE2 and XE3 and will also cover differences between the VCL and FireMonkey implementation.
Predavanje bo v slovenskem jeziku. Prijavite se tu.
Sunday, November 11, 2012
Last week I spoke at FireMonkey2 workshop in Ljubljana. Attendance was low (compared to other “Embarcadero Academy” sessions) but very attentive and interested in the FireMonkey development.
Next session will be dedicated to LiveBinding (visual and nonvisual – both XE2 and XE3 will be covered) and is planned for 29. November. I’ll put a notice on my blog when a registration page is up.
Wednesday, November 07, 2012
Christian has finished the housekeeping tasks (days ago but I was busy and forgot to put a notice on the blog, sorry), so the repository is stable again.
Changes, with his own words:
- introduced lib path (now all lowercase) to receive all DCU files separated by compiler, platform and configuration. The tests compile really quick now, without "polluting" the source directory with .dcu files
- changed fastmm4 to fastmm, which is now an svn:external
- added main icon for all tests (linked via MainIcon.rc resource script)
- this still might cause linking issues on Delphi 2007, if compiled for the first time, but I will investigate this in the next days.
- removed unused files and directories from the svn repository
Tuesday, October 30, 2012
Monday, October 29, 2012
Christian W. Budde has kindly offered to do a long-neglected housekeeping on the OmniThreadLibrary SVN tree. He now has committing rights and is already busy fixing .dproj files, SVN external references and other small things that I never have time to work upon.
The current state of the SVN tree may be as of this moment described as a ‘slightly unstable’ so checkout/update at your own risk. I’ll let you know when the rearrangements will have finished.
Sunday, October 28, 2012
While working on an internal project I came into a situation where a user (that is, a fellow programmer) would have to create a hierarchy of classes. As it turned out, this hierarchy would contain almost no implementation, just the class declarations, with one exceptions – every class would still have to be responsible for creating its children objects. Then I had a thought. Maybe I could use attributes and RTTI to do that in one central place instead of in every object.
Saturday, October 27, 2012
The ITDevCon 2012 is over and I’m back at home, resting and gathering impressions.
The conference was even better organized than previous years and everything was running as smooth as possible (with the small exception of the projector in the main hall, which somehow was not capable of giving out a completely sharp picture). In addition to the multinational group of speakers, the visitors also came from variety of countries – I noticed four Germans, two Russians and a Lituanian – which plays well with the intentions of making the ITDevCon the biggest European conference.
As usual, the conference took two full days, with five session timeslots on the first and six on the second day. At every time there were three parallel talks going on, some in Italian and some in English.
I’ve given three presentations – general tutorial on regular expressions and two “hands-on” sessions in problem/solution format – one on Windows + OS X development and another on OmniThreadLibrary. Slides and sample code are available on my blog.
I also listened to few sessions – both talks by Jeroen Pluimers were full of information and very useful; Ray Konopka’s session on user interfaces was incredible as always, Paweł Głowacki showed us what can be done with FireMonkey 3D components and Jørn E. Angeltveit gave interesting (WAT!) talk about the Smart Mobile Studio. I’m just too sory that I couldn’t follow Ray’s talk on creating custom controls for FireMonkey … Still, every session was recorded and participants will be able to get recordings of sessions they have missed. (By the way, recordings of last year conference are available on line.) I was also happy to finally meet Detlef Overbeek, the main guy behind the Blaise Pascal Magazine.
A quick shout to people that I haven’t yet mentioned – it was great to talk to you!
I would like to thank the organizer for inviting me again to the beautiful Verona and for all the great food we were able to taste in the two conference days (and at the pre-conference dinner). See you next year, guys!
Friday, October 26, 2012
Thursday, October 25, 2012
Tuesday, October 23, 2012
Long time ago, in August, JimVern asked on the OmniThreadLibrary forum:
I am creating a Windows Service to handle report requests for our clients. Each client has multiple users who may run a report. I want to serialize the report requests for one client so that only one report will run for a client at a time (FIFO), but reports can run simultaneously for different clients.
Since users can submit report requests anytime, I need to be able to append a new request to the end of an existing client FIFO queue without interrupting the execution of the current report. Or, if the client doesn't have a queue yet (e.g., it's the first report request), then I need to be able to add a client queue without disrupting any reports running for other clients. Once a client queue is empty, I want to destroy the client queue.
I am new to OTL, but it looks like it will easily do what I need. I'm just not sure where to focus my attention. Is there a way to create named task groups that can execute the top task of each group simultaneously, where tasks can be appended to an existing group, and where groups can auto-terminate when the tasks are all executed? Perhaps there an example project or a similar post that I can look at to get started? I'm still somewhat of a novice when it comes to threads, so any advise is also welcome.
My answer at that time was just a pointer in the correct direction:
Instead of running multiple tasks for one client, why don't you consider running one task per client and sending workload requests to that task?
You could then schedule each such task into a thread pool. The task would run in a loop and process requests. When it runs out of requests, it would shut down. The main program would be responsible for starting a new task if not already running. [There's a small race condition here - you would have to maintain a shared structure enumerating live tasks that would be modified from the task code and from the main program and it would have to be locked-accessed.]
I promised Jim a working solution but then I got lost in all sorts of other, more important projects and it was only few days ago that I was able to finish the job. Sorry, Jim :(
Monday, October 22, 2012
Apparently Delphi (at least XE2, didn’t test with others) allows you to write a comma-separated attribute list inside square brackets when annotating types and type members.
IOW, following two code fragments are identical.
[Name(CNameModule2Sub1)] [Description('Submodule 2.1)] TModule2Sub1Info = class end;
[Name(CNameModule2Sub1), Description('Submodule 2.1')] TModule2Sub1Info = class end;
I am not able to find if this is a documented behavior.
Tuesday, October 16, 2012
.. and I’m busy preparing my presentations. Come join me in Verona and listen to following talks:
Regular expressions - friend or foe?
Regular expressions are one of the most underused features of the Delphi RTL. While in the past we could attribute this to the lack of built-in support, Delphi XE introduced the RegularExpressions unit which greatly simplifies the use of the regular expressions engine. This session will present basic ideas behind the regular expressions, examine the RegularExpressions unit and in particular the main workhorse - the TRegEx class - and continue with practical examples which will show how and when to use regular expressions - and particularly when to stay away from them.
"Hands On": Parallel programming with OmniThreadLibrary
In the past few years, OmniThreadLibrary has become "de facto" standard for Delphi multithreaded programming. Still, the main stumbling block for programmers to "go multithreaded" is the grasp of patterns and practices for multithreaded development. This "hands on" session will take different practical examples, deconstruct them into basic operations and then show how to build simple parallel solutions based on the initial analysis.
"Hands-On": Developing for Windows and OS X
Multiplatform development is slowly taking hold in the Delphi world. While we can argue that the tools for the mobile platform are still in the infancy stage, the situation on the desktop is quite different. Delphi is a valid development tool for the OS X-based computers. The main topic of this session will be hassle-free multiplaftorm development - how to write your code that it "simply works" on both platforms and what to do when this is not possible.
(That is, if you’ll not be listening to other great presentations running at the same time!)
Friday, October 12, 2012
Big thanks to jachguate who translated the book.
Finalmente, ¡aquí está la primera entrega del libro!.
- Actualizada a la versión en Inglés publicada el 8 de octubre de 2012.
- Adaptado a la versión 3.02 de OTL.
2. Introducción a MultiThreadLibraryAl comprar el libro, recibirás todas las actualizaciones futuras completamente gratis.
3. Multi-hilos de alto nivel
Gracias por el interés mostrado en adquirir el libro.
Juan Antonio Castillo y Primož Gabrijelčič
Monday, October 08, 2012
- Adapted to the OmniThreadLibrary 3.02 release.
- Documented background worker initializers and finalizers.
- Documented Async/Await abstraction.
- Fixed minor problems found by [jachguate].
Update [2012-10-12]: Spanish translation has been released.
Wednesday, October 03, 2012
It’s official – Parallel Programming with OmniThreadLibrary is being translated into Spanish!
The translator, Embarcadero MVP Juan Antonio Castillo Hernández a.k.a. jachguate, is already working on the book. I hope we’ll have first (partial) translation ready soon.
Until then you can express the interest in the book on the LeanPub site.
Get it as a zip or from the svn.
Monday, October 01, 2012
I have just published an update (63 new pages!) to A Smart Book. New topics cover important parts of the RTL libraries – graphics (HTML5 canvas), regular expressions, browser storage, accelerometer, touch and gesture, layout manager and networking (HttpRequest and JSONP). Also added was a new section on running code on application shutdown (in the Programming with Smart chapter).
Wednesday, September 26, 2012
And not forget the Russian book owners. There are only 17 of them at the moment but their contribution is appreciated nonetheless. (And, again, thanks to Alex Egorov who is translating the book into Russian.)
Tuesday, September 25, 2012
Sunday, September 23, 2012
Today I wanted to check whether the OmniThreadLibrary plays nice with XE3 (yes, I know, I’ve should have done this weeks ago, but there was simply not enough time) and I was completely surprised when OtlSync unit couldn’t be compiled due to an internal error G9413.
One hour later I have reduced the problem to a simple test case (below) and to a simple fix. So the OmniThreadLibrary will be supported in the XE3 (as we all hoped for).
For other poor souls that may have run into this problem, here’s a small test case and a workaround.
TTest<T> = class
if Length(aMethCreate.GetParameters) = 0 then
a := nil; // F2084 Internal Error: G9413
The problem here is that the G9413 internal error is not reported on the line which causes the problem. The real culprit here is the ‘if Length(aMethCreate.GetParameters)’ call in the ‘TTest<T>.Test’ method.
To fix the problem it is enough to introduce a temporary variable that stores the result of the GetParameters call.
TTest<T> = class
params : TArray<TRttiParameter>;
params := aMethCreate.GetParameters;
if Length(params) = 0 then
a := nil;
The problem is reported as QC #108942.
Tuesday, September 18, 2012
Friday, September 14, 2012
Only four days are left until the XE3 event in Ljubljana! I’ll be showing all that is new in RAD Studio XE3 including (but not limited to) FireMonkey2, Visual LiveBindings, Windows 8 development and HTML5 Builder.
A special notice for all friends – reserve some time for a beer or two after the presentation ;)
Wednesday, September 12, 2012
Thursday, August 23, 2012
Following topics are covered:
- Background File Scanning
Scanning folders and files in a background thread.
How to write 'blocking' multithreaded code with a mechanism similar to .NET's `async`/`await`.
- Web Download and Database Storage
Multiple workers downloading data and storing it in a single database.
- Parallel For with Synchronized Output
Redirecting output from a parallel for loop into a structure that doesn't support multithreaded access.
- Background Worker and List Partitioning
Writing server-like background processing.
- Parallel Data Production
Multiple workers generating data and writing it into a single file.
- Building a Connection Pool
Using OmniThreadLibrary to create a pool of database connections.
- QuickSort and Parallel Max
How to sort an array and how to process an array using multiple threads.
- Parallel Search in a Tree
Finding data in a tree.
- Multiple Workers with Multiple Frames
Graphical user interface containing multiple frames where each frame is working as a frontend for a background task.
- OmniThreadLibrary and Databases
Using databases from OmniThreadLibrary.
- OmniThreadLibrary and COM/OLE
Using COM/OLE from OmniThreadLibrary.
Other changes and additions:
- Added Release Notes section.
- Fixed image sizes and line breaks in the High-level Multithreading chapter.
I will now spend few weeks finishing the Smart RTL chapter of the A Smart Book and then I’ll return to the Parallel Programming with OmniThreadLibrary. In the meantime you can express your interest in missing chapters in the poll on the right side of this blog.
Tuesday, August 21, 2012
Tuesday, July 31, 2012
procedure TForm125.Button1Click(Sender: TObject); var button: TButton; begin button := Sender as TButton; button.Caption := 'Working ...'; button.Enabled := false; Sleep(5000); button.Enabled := true; button.Caption := 'Done!'; end;
Now, your boss says, you have to make it parallel so the user can start three copies of it. (You also have to add two new buttons to the form to start those instances but that’s easy to do.)
Tuesday, July 17, 2012
Monday, July 16, 2012
Today I have published a new chapter in A Smart Book – Programming with Smart. Inside you’ll find:
- My First Smart Program
- File Management
- Application Architecture
- Forms and Navigation
- Message Dialogs
- Themes and Styles
- Command-line Applications
- Writing Games
Tuesday, July 10, 2012
[* Translation: Parallel Programming with OmniThreadLibrary]
Fellow programmer Егоров Александр (Alex Egorov) has offered to translate the OmniThreadLibrary book into Russian.
As the original book, it will be published on the LeanPub. Current plan is to make it available after the High-level multithreading chapter is translated. At the moment, you can download the first draft which contains translated Introduction.
You can express your interest in the book here.
Sunday, July 08, 2012
The Introduction to OmniThreadLibrary chapter is completed. New version of the book has already been published and all buyers have been notified by the email.
Wiki will be updated soon.
Please remember – the best way to support the OmniThreadLibrary project is to buy the book!
The next chapter will be either Synchronisation or How-to. I’ll give you few more days of voting time to decide the matter.
Friday, July 06, 2012
Thursday, July 05, 2012
Chapter five of my book Parallel Programming with OmniThreadLibrary is now completed. New version of the book has already been published and all buyers have been notified by the email.
Wiki will be updated soon.
The next chapter on the list is Introduction to OmniThreadLibrary which won the public poll by a very small margin (34 votes against the 31 votes for the Synchronisation chapter).
Today I have published new version of the A Smart Book.
Newly added chapter Smart Control on 54 pages covers all built-in controls, from TW3Panel to TW3Header. Additional sections include tips on writing custom controls and description of the TW3ScrollControl control.
Sample book was also extended. In addition to Smart Pascal and Regular Expressions chapters it now contains selected parts from the Smart Controls chapter, including full text on TW3EditBox and TW3Toolbar.
Wednesday, July 04, 2012
Tuesday, July 03, 2012
Pop quiz! What’s wrong with this code?
FPipeline1 := Parallel.Pipeline
procedure (const input: TOmniValue; var output: TOmniValue)
procedure (const input: TOmniValue; var output: TOmniValue)
Caption := 'All done';
FPipeline1 := nil;
Thursday, June 21, 2012
Monday, June 18, 2012
Last week I started solving weird ‘out of memory’ crash in one of our services. First reports of problems came in from a client but with some experimenting I managed to repeat it on the test configuration. The program works nicely for few hours and then something weird happens and it starts using the memory, few megs per minute, until it crashes.
Repeating the problem on the test configuration usually means half the victory won but this time it wasn’t so :( I was fighting the most terrible of memory leaks – a live leak. Memory was allocated, stored away in some management structure and properly disposed off when the program terminated. FastMM have shown no problems at all. Such problems are always hard to find.
Saturday, June 16, 2012
Chris Rolliston has published his monumental[*] work “Delphi XE2 Foundations” in Kindle format (paper version to follow). The book is split in three parts (TOC is provided in the book home page), each priced at £7.99/€8.99/US$9.99 (which of course translates to $13.79 for people not living in USA, UK, DE, FR, ES or IT – damn Amazon!). As the book is excellent, the price is more than fair – if you doubt my words, download the sample from the Amazon.
As the book site is called “delphifoundations.com” and not “delphixe2foundations.com” I can’t but assume that Chris will update the book to following Delphi releases, which would indeed be a great thing.
[*] It is hard to tell book size from the Amazon’s download size but I have read Chapter 15 (Multithreading) in advance and I can attest to the fact that it is a) very long and detailed, b) very exhaustive and c) very well written.
Tuesday, June 12, 2012
I have finally pushed the Publish button and “The Book” is now available on LeanPub.
To get the current book status, click here or on the book cover image right to this post.
If you want to affect the order in which the book is written, participate in poll on the right (below the book cover image). I will complete the “High-level Multithreading” chapter regardless of your votes but then I’ll follow the majority.
Monday, June 11, 2012
Thursday, June 07, 2012
In accordance with the Lean Publishing Manifesto, Parallel Programming with OmniThreadLibrary is published as it is written. When I’m happy with a chapter (or even with a section, if it is important enough), I click the Publish button on the LeanPub site and new, updated book is available to all the readers.
Such a book would be of a little use if you would not be able do buy and read it before it is finished. Therefore, you can buy the book in the current state of completion and you’ll get all future versions for free. That way, you will get the information as soon as it is ready and I get feedback from my readers before the book is completed (which also means I am able to react immediately, fixing the errors and updating the already written parts). You’ll be informed by the email when an update is ready. Alternatively, you can follow this blog or my Twitter feed.
The picture on the right shows the structure of the book. Chapters marked green are already finished. Blue color marks the chapter I’m currently working on. Orange color indicates chapters that are available in the free sample book. Brown color marks the content that is only partially included in the sample book.
To get a better idea about the way the book is written, check the sample PDF.
Tuesday, June 05, 2012
Do you know that feeling when you can’t put together a simple piece of code? You turn it around and around and there’s always “one last” problem. Even after you’ll happy with it, the first user that tries it out will find a problem. And then you correct that and you’ll happy with it again and the first user that tries it now will find a new problem. :(
It looks like I’m playing this game with Parallel.Join. I can’t make the @#$%^ thing to work correctly. That’s why I have just issued another hotfix. If you are following the SVN head, just do the Update. Otherwise, please download the updated OtlParallel unit.
Thanks go to [meishier] for reporting the problem!
Sunday, June 03, 2012
I have decided to start up a new blog, dedicated to programming with Smart – www.smartprogrammer.org. If you are using the Smart Mobile Studio or if you think that programming mobile applications with Pascal is an interesting idea, make sure to bookmark it.
I will however not move all my Smart-related posts there, most important stuff will also be published here.
My book about the Smart is now available – read more in my post on the new blog. [But feel free to comment here, if you want.]
And the last but not least – I have created a Twitter account. (Took me a long time, I know.). Follow me @thedelphigeek and you’ll get notifications about the OmniThreadLibrary, A Smart Book and more.
There was a nasty bug in Parallel.Join which (sometimes) raised its ugly head when number of tasks submitted to the Join abstraction was larger than the number of parallel execution units (threads). Big thanks go to [Passella] for reporting the problem together with a reproducible test case.
Tuesday, May 22, 2012
Sunday, May 20, 2012
Yes, there will be a book about the Smart Mobile Studio. I don’t know yet how it will be published – as a printed manual that you’ll get together with the software, as an on-demand printed book, as an e-book or combination of those options – but there definitely will be a book about Smart.
For starters, you can download test chapter (not yet completely finished) about using regular expressions in Smart: PDF, Mobi, ePub (rename it to .epub after download). If you like what you see, you can express your interest in the book at the Leanpub site.
On a slightly unrelated topic – I’m thinking about moving all my writing about Smart to another, yet unnamed blog. However, I’m of two minds about this so I would appreciate a feedback. What do you think – should I create a new blog or should I write about Smart here (after all, it uses almost the same language as the Delphi)?
Saturday, May 19, 2012
Last time you’ve seen how to make different layouts for portrait and layout orientations. This time I’ll show you how to dynamically set layout parameters in Resize.
Friday, May 18, 2012
The third layout manager demo shows how to set different layouts for portrait and landscape display orientation.
Thursday, May 17, 2012
I spoke to Slovenian Delphi developers about multithreading today and you probably know that this is a topic I love to speak about. The room was packed (I took this photo five minutes before the beginning, more people arrived after that) but still listeners managed to stay attentive through the four-hour session (including a short break). Lots of interesting questions too – it is good to see many developers actively interested in multithreading.
We’ll probably repeat this session in the autumn as again there was much more interest for the speech than this room can handle.
The second layout manager demo builds on the first one.
There’s an edit box and two small buttons right to it. A large button lies under all three of them. At the bottom of the screen is a status bar and all the rest is taken by a memo control.
Wednesday, May 16, 2012
Smart Mobile Studio was released today. To celebrate this – in my opinion – very important step for the Object Pascal language, I have prepared a series of articles on the Layout Manager – a feature of the Smart RTL that I wrote.
Smart is an excellent tool, but in some areas it clearly shows that there was only so much time allowed for the development. I’m sure Lennart will polish the rough edges in next releases but for now we have to do with what we have.
One of those rough edges is component placement. You can drop components on the designer and set their size but there’s no mechanism for dynamic size adjustments. In other words – there is no Align, no Anchors, no Margins and no layouts (as TFlowPanel and TGridPanel in Delphi). We have to resize components in code, in the overloaded Resize method.
I quickly got sick of writing resizing code and decided to alleviate the problem by writing a layout manager. It does not work in the designer, you have to declare and use it in code, but still it is a big simplification over the default “just call SetBounds from Resize” approach. I donated layout manager to the Smart project and it is included in the 1.0 release as the w3layout unit.
This article starts a short series which will explain layout manager on simple examples. All of those examples are also included with the Smart installations (look in Demos, LayoutManagerDemo).
Thursday, May 10, 2012
The Smart Mobile Studio is nearing its release date (no, can’t tell you when, but it will be soon, really soon) and it’s time to revisit my demos. You test them all from my website (just click on the images) and access the source code. If you don’t (yet) have Smart, you can browse OPP file with my primitive OPP Browser.
Accelerometer-handling demo (iOS only). Move the square by tilting the device.
Game of Life
Conway’s Game of Life. Works on desktop and on tablets. Click in the gray rectangle on the left to open a library of building blocks then drag and drop a block on the game surface.
Gesture-handling demo (iOS only). Handles move, zoom and rotate.
Mandelbrot explorer. Works on device (at least on iPad) and on desktop.
Multi Finger Paint
Paint with multiple fingers (iOS only; single finger may work on Android). Also handles mouse on desktop.
No IDE is mature until it has a TSmiley component. Supports desktop and mobile. Click/touch to change TSmiley’s mood.
Tuesday, May 08, 2012
Sunday, May 06, 2012
This is an announcement for the next “Embarcadero Academy” session. This time I will be talking about my favourite topic – multithreading. As the previous two sessions (Unicode, FireMonkey), this one is intended for the Slovenian Delphi programmers. The rest of my post is directed to potential participants and is therefore written in the Slovenian language.
Monday, April 23, 2012
- Implemented DSiSetFileTime and DSiSetFileTimes.
- Implemented DSiDateTimeToFileTime.
- TDSiRegistry.ReadBinary, WriteBinary now use RawByteString for data buffer.
- Added logging to TGpHugeFile[Stream].
- Added function CopyStreamEx accepting a TStreamProgressEvent.
- TGpStringObjectHash.Find returns 'nil' in 'value' parameter if key is not found.
- Implemented TGpTextMemoryStream, a TGpTextStream wrapped around a TMemoryStream.
Saturday, April 21, 2012
Friday, April 20, 2012
A long chapter on Parallel.Join has been added to the wiki.
All book material is now also available in the Markdown format in the SVN.
I have started putting together “the book”. The plan is to release early – most probably when all high-level stuff is covered – and then to regularly publish updates. Updates will always be free for all customers. At the moment you can’t preorder the book but you can express your interest at the link above.
Sunday, March 25, 2012
Delphi uses FPC 2.6.0 to do the iOS compilation.
I have Xcode 4.3.1 installed (no idea why the version is not displayed in the list).
FPC 2.6.0 doesn’t recognize it. Apparently it only works with Xcode up to 4.2.
Apple only offers XCode 4.3.1 for Lion.
So I’m asking you – can I really use Lion to compile FireMonkey iOS applications? Doesn’t seem so.
Friday, March 23, 2012
I have big problems with FireMonkey applications not running on my new Mac Mini. Does anybody have any information about any possible incompatibilities between XE 2 Update 4 and OS X 10.7.3?
Full problem description is on StackOverflow.
This problem is connected to the Thread Status window. If you have this window visible in the Debug desktop, Delphi will lock when you try to run an OS X application in the debugger. Removing Thread Status window from the Debug desktop solves the problem.
Interestingly, some installations of XE2 Update 4 are working just fine even when Thread Status window is visible.
Wednesday, March 14, 2012
This is an announcement for the second “Embarcadero Academy” session. As the previous one, it is intended for the Slovenian Delphi programmers. The rest of my post is directed to potential participants and is therefore written in the Slovenian language.
Thursday, March 08, 2012
The first “Embarcadero Academy” session was a huge success. More than 40 people were present (we had to cap the participants as the venue don’t allow for larger audience) and as far as I could tell from all the direct and indirect feedback they were very satisfied with the three-hour Unicode presentation.
The topic of the next workshop will be FireMonkey. See you on March the 29th!
Sunday, February 26, 2012
Friday, February 24, 2012
Pop quiz time! What would the user see if this code is executed in your application?
raise Exception.Create('Exception in Async'); end);
The answer may surprise you: Nothing! At least if you’re not using the latest SVN version.
Wednesday, February 22, 2012
Tuesday, February 21, 2012
I wrote about handling accelerometer in iOS from the browser before (Detecting Device Movement, Accelerometer Demo) but I wasn’t happy enough with my code and I promised to return with the third part. Today I returned to the topic with advanced features – handling data smoothing and calibration.
Monday, February 20, 2012
In the last week I’ve republished all the articles about multithreading I’ve written for the Blaise Pascal Magazine. To simplify linking from other sites, I’m listing them all in this post.
Sunday, February 19, 2012
This article was originally written for the Blaise Pascal Magazine and was published in Issue #18.
Relevant Delphi code is available at http://17slon.com/blogs/gabr/BPM/HighLevel.zip.
Saturday, February 18, 2012
Friday, February 17, 2012
- Make sure you have a backup!
- And by that I mean a fresh backup, made just now, not an idea that there may exist a person who knows where a backup is stored!
- Make sure you can restore from the backup!
- And by that I mean that you have tested the restore procedure. On the backup that you have just created. And that you have tried accessing restored backup with the program that usually operates on it!
- Don’t type any SQL commands. Use only scripts/programs that were previously tested on a development/test database.
- And by that I mean tested by yourself, not by a fictitious somebody who may have tested a script three years before on a database used by a completely different program!
- Don’t modify production database!
- And by that I mean DON’T MODIFY PRODUCTION DATABASE!
Thursday, February 16, 2012
This article was originally written for the Blaise Pascal Magazine and was published in Issue #12.
Relevant Delphi code is available at http://17slon.com/blogs/gabr/BPM/Communication.zip.
Tuesday, February 14, 2012
This article was originally written for the Blaise Pascal Magazine and was published in Issue #11.
Relevant Delphi code is available at http://17slon.com/blogs/gabr/BPM/Synchronisation.zip.
Monday, February 13, 2012
Relevant Delphi code is available at http://17slon.com/blogs/gabr/BPM/FourWaysToCreateAThread.zip.
Friday, February 10, 2012
My accelerometer blog ended rather abruptly, without a demo program so today I’m returning to the topic.
To test the accelerometer control I wrote a very simple program in which you can move a rectangle around the screen by tilting your iOS device. You can test it here.
This program builds heavily upon the source code I found on Alberto Sarullo’s blog. Thanks!
Wednesday, February 08, 2012
Tuesday, February 07, 2012
For my next quest I decided to find out how accelerometer works in web applications. IOW, I wanted to control an object on my HTML page just by moving my iPad around.
Thursday, February 02, 2012
Do you have any recommendation? I'm sick of using Notepad2 for these purposes.
In case there's no such tool available - is there a young programmer that needs a pet project? Put together a TSynEdit (to bring in highlighting and printing) and a toolbar/ribbon and you'll be half done...
Tuesday, January 31, 2012
Saturday, January 28, 2012
No IDE is mature until it has a TSmiley component.
This week I got a sudden urge to write TSmiley component for Smart Mobile Studio IDE. After all, what is a development environment without a smiley?
My TSmiley is not an enterprise-y solution like latest Nick’s revisit of the old theme ;), oh no, it is a lean and mean component without any special bells and whistles. You can select the smiley’s emotion and it will change the look. And that’s it.
I thought that a story about TSmiley for Smart would be instructive for you, dear reader, as this is almost the simplest component one can write. Read on to see how writing a component for Smart is very similar to writing a component for Delphi and how it is also utterly different.
Friday, January 20, 2012
I mainly started playing with the Smart Mobile Studio because I wanted to write some stuff for my iPad. OK, there’s a small issue of possibly producing client applications for my job and maybe for some freeware/shareware stuff I’m thinking about, but this is not on the horizon yet. Therefore, iPad. (And I don’t have iPhone and I don’t care about writing stuff for my wife’s Android, so – iPad.) And writing for iPad means supporting touch gestures.
[Yes, I know I could use Objective-C but – bleuch, really? – and I could use FireMonkey but I don’t have a Mac and don’t want to buy one just for playing around and I can’t make Platform Assistant run in a Hackintosh, Therefore, Smart.]
Touch is natively supported in Smart. Gestures are not (but that may change before the release). What’s the difference, you ask? Touch subsystem will give you information about separate fingers like – finger has touched – another finger has touched – first finger was moved – both fingers were moved – while gesture subsystem will give you a simple – zoom gesture in progress. But hey, let’s start with touch. Lots and lots of stuff can be written with just the information about the fingers touching the screen.
Tuesday, January 17, 2012
Part of the Zarko’s requirements (see the original post for full text) was a cancellation support.
At any time the "master" thread could be signaled to terminate (from the app's main thread) all child threads (and itself).
When I was originally implementing this using the Parallel.Pipeline abstraction I had to put some work into the cancellation support. The main reason for this was inappropriate abstraction – Parallel.Pipeline is designed around the data flow processing and supports only a basic cancellation of the “stop everything” type. To be fair, that would comply with the Zarko’s requirements, but I wanted nicer solution where you can stop processing and then continue with a new work item without rebuilding the background thread mechanism. [Pipeline solution inherently supports cancellation but you cannot recover from it – to continue processing one would have to destroy the pipeline and build a new one.]
Tuesday, January 10, 2012
When I wrote OmniThreadLibrary in Practice –Background Worker and List Partitioning in November, I noticed that OmniThreadLibrary needed another high-level abstraction, a background worker. I published some ideas on how the background worker interface could look. Those ideas were later developed in a full-fledged high-level solution.
Background worker is designed around the concept of a work unit. You create a worker, which spawns one or more background threads, and then schedule work units to it. When they are processed, background worker notifies you so you can process the result. Work items are queued so you can schedule many work items at once and background thread will then process them one by one. [Actually, Parallel.Pipeline is used as a base for the implementation.]
After I finished my very first Smart program, I wanted to enhance it with some interactivity. I wanted the user to be able to navigate through the Mandelbrot set by using mouse and touch. For now, I have only implemented the mouse part, touch events will be handled later (soon, I hope).
I wanted to achieve few different ways of navigation:
- Click & drag with the left mouse button shows a rectangle on the screen. When the mouse button is released, program zooms in to display the selected rectangle.
- Double-clicking zooms in around the point of click.
- Right-clicking zooms out around the center of the image.
- Right-click & drag shows a line on the screen. When the mouse button is released, program moves the current view (point of first click is moved to the point of release).
- If a drag operation is in progress, user can click and release the other mouse button (left if right-drag is in progress, right if left-drag is in progress) to cancel the drag operation.
You can see the navigation in action in this (very low quality, sorry) YouTube video.
Saturday, January 07, 2012
Wednesday, January 04, 2012
[original author unknown]