Quantcast
Channel: Planet Object Pascal
Viewing all 1725 articles
Browse latest View live

Delphi Haven: Native Android controls for XE5


Behind the connection: FireMonkey, Android, Windows and PostMessage

$
0
0
FireMonkey framework (FMX for short) is definitely able to use custom [Windows] messages much like we have always done with the VCL. And this is also true when using FireMonkey to build Android applications. Both Windows and Android support a messaging system. It is well known by Windows developers who use it with PostMessage, GetMessage, PeekMessage and similar Windows API call. It is much less

DelphiTools.info: MapFileStats v1.5 – Improved DCU Statistics

$
0
0
My small utility that gives binary size statistics from the Map file just got updated to version 1.5 This updates improves statistics gathered and reported for DCU file sizes, and introduces a small speedup. Here are the highlights: Auto-detect Delphi DCUs directory, DCU ratio statistics are now provided for Delphi units Prioritize DCUs from the…

The Podcast at Delphi.org: A Tale of Two Grids

$
0
0

If you buy RAD Studio XE5, Delphi XE5 or C++Builder XE5 between now and the end of the year, then you get both the InfoPower XE5 VCL Grid and components, as well as the InfoPower XE4 FireMonkey grid! The InfoPower grid by Woll2Woll is one of the best grids for VCL application development, and has been for years. It is great to see the InfoPower grid now on FireMonkey. With these two grids your apps can have the best grid ever, on any platform we support: Windows, OS X, iOS and Android.

I made a little video showing some of the features. Also you can download the InfoPower grid demo for Android from the Google Play store. Install it on your Android device today and check out the potential.

Firebird News: Ștefan Suciu’s patch to implement support for Firebird in Sqitch is merged

$
0
0
His patch to implement support for Firebird in Sqitch (a database change management application) has reached a milestone – is merged.

Firebird News: Debian: 7.3 stable is released with Firebird security fixes

$
0
0
The Debian project is pleased to announce the third update of its stable distribution Debian 7 (codename wheezy). This update mainly adds corrections for security problems to the stable release, along with a few adjustments for serious problems. This version is released with Firebird security fixes and includes the latest Firebird 2.5 update . Please […]

DelphiTools.info: Setting up SSL for DWScript Web Server

$
0
0
Setting up an SSL with DWScript Web Server (and other http.sys services like mORMot) is simple, and it’s cheap, free even thanks to StartCOM. Encryption is also pretty darn fast on recent Windows server versions. Here is a quick guide to get you started. Getting a Certificate You can get a certificate from various certification…

Behind the connection: Coding in Delphi ebook

$
0
0
Coding in Delphi ebook by Nick Hodges. Available to registered users of Delphi XE5, RAD Studio XE5, and Embarcadero All-Access XE. This promotional item is available as a special promotion through December 31, 2013. There is also a Google+ community: https://plus.google.com/communities/110978417023349293804 You can download it from http://cc.embarcadero.com/Item/29670

Dr.Bob's Delphi Notes: X-Mas Wish List: Delphi XE5 Enterprise Upgrade + Subscription

$
0
0
My recommended X-mas Shopping List would contain one main item: a Delphi XE5 Enterprise Upgrade + Subscription. Clarification: right now, you can upgrade from any old version of Delphi to the latest edition, XE5.

Firebird News: New German translation for Firebird Cache document

$
0
0
Martin Köditz completed the German translation of the Firebird Cache document. For everybody interested in it, please visit the HTML version. The PDF can be found here.

Behind the connection: Mandelbrot Explorer for Android and Windows

$
0
0
Using Delphi XE5, I rewrote my Mandelbrot fractal explorer with the FireMonkey component framework. The result is a working application for Android and Windows. To generate Windows or Android version, it is enough to just change the target operating system. Nice cross-platform application!   On the picture below, you see the Windows version running on my desktop and the Android version running

The Wiert Corner - irregular stream of stuff: jpluimers

$
0
0

Almost a year ago, a thread on “premature Delphi optimization” came by on G+ about this code:

procedure ExchangeInteger(var AValue1, AValue2: Integer);
begin
  AValue1 := AValue1 xor AValue2;
  AValue2 := AValue1 xor AValue2;
  AValue1 := AValue1 xor AValue2;
end;

I don’t think that was premature optimization, just some code from an old fart that had already been programming in the era where processors had reasons to use it:

Back then, the only efficient way to exchange two variables of the same data type was using the XOR swap algorithm.

Nowadays you have more options, and this is where the fun in that thread began, which I will show in a minute.

First a bit of history

The XOR swap algorithm was widely known in the 80s of last century and before, especially because the 6502 processor (oh the days of LISA Assembler) was vastly popular, as was the Z80. Together, they powered the majority of the home computers in the 70s and 80s.

Popular 6502 powered computers were Acorn Atom and BBC, Apple II series, Commodore PET and VIC-20 (the Commodore 64 ran on a 6510),  Atari 400/800/XL/XE.

Popular Z80 powered computers were Amstrad CPC, MSX, Exidy Sorcerer,  TRS-80, P2000, Sinclair ZX80ZX81 and ZX Spectrum, KayproOsborne 1 and the Z-80 SoftCard for Apple II.

So back-then you needed the XOR algorighm to do the exchange.

Now the fun part: more choice

Two more variations for the method were proposed.

The first one was to use the XCHG instruction, which has been there since the 8086.

There is even an XCHG EAX, EAX instruction with opcode $90, which is the same as NOP.

Stefan Glienke proposed it, as Delphi compiler adds a MOV with every XOR.

procedure ExchangeInteger(var AValue1, AValue2: Integer);
asm
  xchg ecx, [eax]
  xchg ecx, [edx]
  xchg [eax], ecx
end;

You’d think this is fast: assembler + tiny XCHG instruction. Well, don’t think, but measure: this one is slower, even on modern systems.

Eric Grange did notice the speed difference and came up with this one:

procedure ExchangeInteger(var AValue1, AValue2: Integer);
var
  tmp: Integer;
begin
  tmp := AValue1;
  aValue1 := AVAlue2;
  aValue2 := tmp;
end;

Stefan Glienke concluded: The xor version is faster than the xchg thing. And the version with tmp var is faster (with optimization on ofc).

Real conclusion

The real conclusion however was made by Kenneth Cochran:

I’d leave this one up to the compiler to optimize.

–jeroen

via: Stefan Meisner – Google+ – if premature optimization is the root of all evil then….


Filed under: Borland Pascal, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Development, History, Pascal, Software Development, Turbo Pascal, UCSD Pascal

The Wiert Corner - irregular stream of stuff: jpluimers

$
0
0

Another episode in the Missed Schedule series that was originally scheduled for 20131201:

Until I read the comments at Monitoring the Monitor, I only knew the early days of Matt Pietrek‘s work at NuMega and as co-author of one of the first Undocumented Windows books (another one appeared about the same time).

Now I know Matt was one of the people interviewing Allen Bauer for his first position at Borland.

A bit more search revealed Matt worked at Borland from 1988 until 1992, roughly the era from Turbo Pascal 5 until Borland Pascal 7 (when Borland already had started researching Delphi), but more importantly with Turbo Debugger versions 1-3 that were indispensable when programming using Turbo C / Turbo C++ and Borland C++.

When Borland was working in Delphi 95, and Microsoft on Windows 95, he moved to Nu-Mega (later Acquired by Compuware) doing lots of work in debuggers.

Some interesting links from or involving Matt:

–jeroen


Filed under: Borland Pascal, Debugging, Delphi, Delphi 1, Development, Pascal, Software Development, Turbo Pascal

Firebird News: TurboBird 0.9.12 is released with new version for win64

$
0
0
TurboBird 0.9.12 is released Changelog Add auto completion in Query window. Releasing Windows 64-bit version of Turbo Bird.

The Wiert Corner - irregular stream of stuff: jpluimers

$
0
0

Even when not using Visual Live Binding, Delphi generates empty .VLB files in both Delphi XE3 (virtually always) and Delphi XE4 (most of the time).

Visual Live Binding is one way of binding data to UI in FireMonkey and can also be used in VCL, but does not have to (Alister Christie made a nice video ▶ Delphi Training Tutorial #77 – Visual Live Bindings – YouTube about it).

Empty VLB files, and a batch file to delete them

The “empty” VLB files are almost empty, as they are exactly 3 bytes long and contain the byte sequence EF BB BF which is the Unicode BOM (byte order mark) for the UTF-8 encoding.

So technically they are not empty, but practically they are as there is no content.

The “empty” VLB files clutter your disk and version control information, so I have written a small batch file that – together with an empty VLB file– can clean up a directory tree of those empty VLB files.

You can get those files from the Delphi Scripts directory in my BeSharp.net open source repository.

Usage is a snap: just specify the target root directory.

C:\Users\developer\Versioned\BeSharpNet\Native\Delphi>Scripts\delete-empty-VLB-files.bat .
emptyVLB=C:\Users\developer\Versioned\BeSharpNet\Native\Delphi\Scripts\Empty.vlb
delete "C:\Users\developer\Versioned\BeSharpNet\Native\Delphi\Apps\TicTacToe\TicTacToeFireMonkeyMobile\TicTacToe_FireMonkeyMobileFormUnit.vlb"

–jeroen

PS: So far it looks like Delphi XE5 doesn’t generate empty VLB files any more (:

Speaking of which: Embarcadero recently Delphi XE5 Update 2 with C++Builder for iOS and lots of bugfixes.

They also run an end-of-year special: http://www.embarcadero.com/radoffer

I will detail more on that later, but one of the nice parts is that it includes a free PDF copy of the current CodingInDelphi book by Nick Hodges.

It is the finest recent Delphi book and complements all the Delphi books released so far. So be sure to get the book now by upgrading to Delphi XE5, otherwise you have to wait for the LeanPub version of CodingInDelphi.


Filed under: Delphi, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development Tagged: Delphi, VLB

Firebird News: Devart XMas Promotion

$
0
0
Devart Team is glad to announce the beginning of Christmas season. All products are now available at the discounted rate. Be ready to receive up to 35% off on all products. We wish you a Merry Christmas and all the best in the New Year! May the Holidays bring you plenty of cheer and joy! […]

The Wiert Corner - irregular stream of stuff: jpluimers

$
0
0

Just around the start of the Delphi XE5 end-of-year special offer (more details below), Delphi XE5 Update 2 was released. It adds C++ Builder for iOS support, and fixes many bugs.

What I like most is that the majority of XE2 Update 2 bugfixes are not FireMonkey related.

It indicates the Delphi team puts a lot of effort in the classic Delphi stuff, where still a lot of Delphi users earn their money.

Since Delphi XE5 Update 2 is a re-install, the best is to download the ISO image which – like the updates for PAServer for Mac (ftpd) and PAServer for Windows (ftpd) – is on both the altd and ftpd server.

XE5 promotion offers

Best of all: you get RAD Studio XE5, Delphi XE5, or C++Builder XE5  (:

The offer is at http://www.embarcadero.com/radoffer

Compared to before the offer, you get these for free when you buy before the end of the month and redeem before the 15th of January 2014:

  • InfoPower XE5 VCL Grid and Components (Embarcadero Edition)
    I like they added this to cover the VCL user base.
  • Powerful Tools to Boost Your Coding
  • There are some restrictions on the order date, and time frame to redeem new items. And the offer does not apply to support and maintenance subscriptions. Read the fine print http://www.embarcadero.com/radoffer carefully.

    –jeroen


    Filed under: Delphi, Delphi XE5, Development, Software Development Tagged: Delphi, Delphi book

    Delphi Code Monkey: Five Code Upgrade Snares and How to Avoid Them

    $
    0
    0
    Here are five upgrade snares that have slowed progress or even stalled attempts by well meaning competent developers who have tried to migrate large code-bases up to new Delphi versions.  

    1. The "I must not rewrite anything" snare.


    The person who can not decide that something needs to be fixed will never upgrade anything. The person who values the patch he made 10 years ago to an ancient version of TMainMenu will never upgrade.  This is the first snare, it's a bear trap, and it's got your leg.

    To avoid it, remember that your goal is to arrive at code that builds in both Delphi 6/7/2007 and XE5.
    Don't panic.  Be calm.   Now continue.

    2. The "I must rewrite everything" snare.


    Having escaped the first snare, the hapless code-upgrader stumbles a little further along, is heartened by having survived the first trap, and decides to rewrite almost everything.   He was last seen stumbling into the Mojave desert.  His current whereabouts are unknown.

    To avoid this snare, just as the point above, concentrate on making the code build, and pour your new code efforts into increasing unit test coverage.

    3.  The "Failure to Recognize that We are in Boston, rather than Chicago" snare.


    In Delphi 6, or Delphi 3 or Delphi 7, there were some features that are no longer current recommended Delphi features.  The BDE is one of them. If you think you can upgrade from Delphi 6 to Delphi XE5, and continue to use the BDE for another 10 years you're going to have a bad time.  Not just the BDE, but a whole host of things have gone to "should not use" status.  Also there are new VCL framework features including TForm.PopupParent which should be used to replace a lot of your Z-Order hacks that you invested huge time in in Delphi 6.  You can stage your changes, and you should stage them. Stage 1 might be "it compiles and passes unit tests, but uses BDE". Stage 2 might be "goodbye BDE". Stage 3 might be "it properly reads and writes the unicode data formats I want it to read, such as XML".

    The second half of this trap is you assume that porting means a series of mechanical changes that you don't quite understand.  Don't make a change you do not precisely understand. Unicode porting usually leads to a lot of naieve things being done in your early days. For example, on your first day of porting, if you decide you'll change "All my Strings will be AnsiStrings" you're going to have a bad time. There is no "100% always do this" law, you must know what you're doing. But you should always choose AnsiString when you need a single byte string, and you should always use String (UnicodeString) everywhere else.  Read the excellent Unicode porting materials provided by Marco Cantu and Nick Hodges.  To avoid this trap, read these guides, and follow them.

    4.  The "Hacks and Customizations" snare.


    One day in 2001 you decided to modify TButton. Then in 2002, you decided to modify TForm, and in 2003, you decided to modify TDataset.   You had to, at the time there was no other sane choice.   But you will now have extra work to port your not-quite-VCL-or-RTL-based codebase up to your new Delphi version.  My suggestion is to make the code BUILD without VCL or RTL customizations, and function well enough to pass unit tests.  Then investigate new fixes for your previously required workarounds that are possible with the new framework.

    I have also been trapped by this one, in the form of heavily customized Developer Express commercial third-party components that I then had to port changes from the 2004 version to a modern version.   Due to the nature and extent of my changes, this took me months.  I would have perhaps attempted to do more with subclassing, rather than modifying the component itself in the future.  However, the problem is that you can only do so much with subclassing. Sometimes you're really stuck and you do have to modify the original code.

    Other than not getting into this trap in the first place, the way out is with care, with unit testing, and with proper version control tagging.  Attempts to remove customizations should be accompanied by tests, automated or manual.  Preferably both.

    5.   The "Wandering in the Darkness, Surrounded by Grues" snare.


    If you do not have unit tests, you will not know if you broke things.

    When the code compiles and passes unit tests, you are on the path.

    When the code compiles but passes no unit tests, you may still be on the path. But you don't know. The light is dim.

    When you have spent several days in the dark, and continue making changes to code that does not compile, you are certainly not making progress.

    You have been eaten by a grue. You have died.



    Avoiding this one deserves more detail in a future blog post.  But it is mostly about unit tests, live use of your app after each change so you know if you broke the app's ability to run and do fundamental things, and the same sort of education and preparation steps as the previous point.  I have some more specific ideas on this one, that will be explored in a part 2 post.


    If you've got another snare that we can all learn about then avoid, please post it in the comments!


    Delphi Code Monkey: Book Review: "Coding in Delphi" : A new Delphi book by Nick Hodges

    $
    0
    0
    Right now you can only get it by buying Delphi XE5.  I just finished reading it, and I love it.  I think that the title needs to be understood with the word "Modern" put in there somewhere. Maybe "Coding in a Modern Delphi Style" would fit the content well.  The title is fine, but I'm just putting that out there so you know what you're in for.

    Did you want to know more about the proper use of Generics, not just the consumption of a Generic type (making containers using TList<TMyObject> ) but also enough to start really building your own Generics?  Do you want to learn how to dive into Spring4D (Spring for Delphi) and use its powerful capabilities?  Do you want to learn to use fakes (stubs and mocks) to isolate classes so they can be truly unit tested? Do you understand the real difference between unit testing and integration?  If you're not using isolation frameworks, or you don't know how to use them, or isolate your classes, is it possible that there's a whole new and better  level of test coverage?

    Do you feel that you were late to the party, and nobody ever explained all the things that the cool up to speed delphi developers know?   This book is conversational, friendly, approachable,  code-centered, and although I already understand 90% of what is in the book, I still found there were some parts that really made my head bulge a little.

    The book focuses on the raw coding aspects, and low level coding concerns, not on high level issues like user interface, or even architectural concerns like MVC.   The well known and beloved core Object-Oriented principles in the S.O.L.I.D. family, as preached by Uncle Bob Martin, are mentioned and given brief homage, but not expanded upon.  This is well and good, or Nick would still be writing this book and it would be eight times its current length.

    Having finished reading the book, I'm going to go download all the add-ons and frameworks and libraries that Nick has gone over, and spend some time playing with them, and then I'll go read the book again.   I think that if you try to absorb everything in the book at once, you might get a bit of a headache. Instead I took it in over a couple days, let it wash over me and then I'll go back over it again in more detail.

    I believe so strongly in the KISS and YAGNI principles, that I still don't think I'll be using all the shiny things that Nick talks about in this book, unless I can clearly see how using them benefits both the developers and the users of the code.  But I'm so clearly sold on the benefits of isolation, and testability, and design for quality and testability, that you don't have to sell me any further. It's just a matter of using these technologies in a way that can be done without substantially degrading debug capabilities.  (That is the secret down side of interfaces, and isolation, and dependency injection.  Your code can turn into a mysterious pile of mysterious semi-readable angle-bracket soup.)  

    I am hopeful that there is a way to pacify both the desire in me to build testable, quality systems, and the desire to build readable simple systems that don't go down the Hammer-Factory-Factory road to hell.

    If you want a copy, go buy XE5, or wait until some time next year when the book will have a wider release.  It's great though. You really should get it.  Nick joins my other favorite Delphi authors, like Marco Cantu, Bob Swart, Xavier Pacheco, and Ray Konopka on the virtual Delphi book authors shelf in my coding book collection, and it's a fine addition to the canon of Delphi books.

      

    Delphi Haven: If you write database applications in Delphi

    $
    0
    0

    … you may want to contribute to the following thread on the Embarcadero forums:

    https://forums.embarcadero.com/thread.jspa?messageID=620961&tstart=0#620961

    Quote:

    Hello All

    At moment the DB RTL team is working on Data.DB.pas improvements. This is a good moment to bring our attention to the DB related issues registered in QC, which are important / valuable / annoying from your point of view. Please post your replies to this message with QC numbers and optional comments describing the importance of the issues. Thank you.


    With best regards,
    Dmitry Arefiev / FireDAC Architect


    Viewing all 1725 articles
    Browse latest View live


    Latest Images