The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,854 other subscribers

Archive for the ‘Delphi’ Category

ISO 8601 Date, Time and DateTime in Delphi (was: Simple example to show DateTime.Now in ISO 8601 format on ideone.com | Online C# Compiler & Debugging Tool)

Posted by jpluimers on 2011/08/18

In the past I wrote about a Simple example to show DateTime.Now in ISO 8601 format on ideone.com | Online C# Compiler & Debugging Tool , using ISO 8601 in batch-files, and how ISO 8601 is used in Google Calendar URLs.

Time to write something about ISO 8601 Date, Time and DateTime and Delphi.

First of all the DateUtils unit contains a bunch of routines (for instance DecodeDateWeek) that understand ISO 8601 week numbers, where:

  • Weeks start at Monday
  • The first week of a year contains (these are equivalent):
    • The first thursday in that year
    • Has at least 4 days in that year
    • Contains the 4th of January

Otherwise the week containing January 1st is week 52 or 53 of the previous year

ISO 8601 also specifies how to format Dates, Times,  DateTimes and durations according to some basic principles.

XML uses ISO 8601 to format Date, Time and DateTime and some other formats as text too.

So it is no wonder that since Delphi 6, it contains a XSBuiltIns unit covering (among other things) ISO 8601 formatting.

Given the many Delphi ISO 8601 relates questions on StackOverflow of which I answered two, and my need for ISO 8601 DateTime conversion for exporting Excel XML, here is are some samples to get started in the unit below (and in this codeplex changeset).

The unit covers Date, Time and DateTime.
You can write similar code for Duration.

Oops, I covered it already in ISO 8601: Delphi way to convert XML date and time to TDateTime and back (via: Stack Overflow)

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, ISO 8601, Power User, Software Development | 4 Comments »

some reflections on #Delphi #FireMonkey support for #iOS based on the #FPC compiler that caused quite a surprise

Posted by jpluimers on 2011/08/17

When looking over a few forums, it seems that the way Delphi XE2 will support FireMonkey on iOS (by using FPC aka the FreePascal Compiler) was very surprising, even for the FPC dev team.

Actually, Embarcadero’s Michael Swindell posted some very interesting reactions on the Lazarus forum and his series of comments on Jon Lennart Aasenden blog entry discussing Delphi XE2 and iOS.

Recommended reading!

A lot of pieces of the puzzle fall into place now: Embarcadero aquiring KSDev (that made DXScene/VXScene), and the support in FPC 2.5.1 for a more Delphi Language compatible syntax, and Objective Pascal binding to Objective C as indicated by Phil Hess. VGScene already supported iOS using FPC in Delphi Mode, as this thread on the embarcadero forums also indicates, so it is logical that FireMonkey does too.

Embarcadero, FreePascal and RemObjects are in parallel (and sometimes cooperation) working on cross platform compiler development.
For the Mobile world, ARM (for iOS) and Java (Android, BlackBerry) are very important.

Clearly, Borland was far ahead of its time when they demonstrated their dcc32j Delphi to Java bytecode compiler proof of concept at BorCon conferences back when their opening evenents had great videos (I think it was both at BorCon 1998 and BorCon 1997), and not so great shifts (the Inprise identity crisis).

The same holds for the Sun’s slogan “the network is the computer” (actually by John Gage): basically that was about predecessors of Cloud computing.

Things from the past come back, sometimes presented as “new”, a few (partially from this Evolution of Pascal programmers.stackexchange.com thread):

All of those are (partial repetitions) of technologies that help you build systems. The trick is how to be able to quickly learn and apply those technologies (as opposed to add a bunch of TLAs or FLABs wich are about the only thing that most modern “recruiters” use to match résumés/CVs to positions).

Some of the things above have died, or are not in wide use any more.
That is OK: Life can’t have ups without having downs, and without some form of long wavelength repetitions: that’s what makes the journey so interesting (just think about the financial markets, there will be good times…).

Using FPC for iOS opens the road to develop applications using a very productive environment consisting of the Delphi IDE and the FPC compiler in a short while from now.

–jeroen

PS: two more events that I will be attending and/or speaking:

PS2: Now it probably is more clear why I bought and installed my Mac Mini Server last year :)

Posted in .NET, C#, Delphi, Development, Java, Software Development | 6 Comments »

Back to the 80s: Apple Pascal on the Lisa Machine

Posted by jpluimers on 2011/08/15

Talking about Pascal history: Index of /pdf/apple/lisa/pascal_monitor.

That was then, soon it will become easy to write Pascal apps for Apple iOS using Delphi XE2 :)

–jeroen

Posted in BitSavers.org, Delphi, Development, History, Software Development | 2 Comments »

Tomazy’s Software Development Blog: Testing modal windows in Delphi

Posted by jpluimers on 2011/08/14

Tomazy’s Software Development Blog: Testing modal windows in Delphi.

Recommended reading!

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Windows authorization: Adding/Removing users from local groups

Posted by jpluimers on 2011/08/10

Though there are API ways to add users to local groups in Delphi, you need the JwaLmAccess unit from the JEDI API library project to import those.

Sometimes that is not feasible, and sometimes you want to just script things.

For those, you can use the Windows net localgroup command (if you have sufficient privileges, you can even apply it to the local groups on your domain controller by appending it with the /domain parameter, or use the net group /domain command to execute on global domain groups instead of local groups).

Sample of using this in a cmd script:

net localgroup Guests Me Myself I ACME\BugsBunny /delete

It will remove the local users Me, MySelf and I, and remove the domain user ACME\BugsBunny from the local group Guests.

Sample source of using this in Delphi: Read the rest of this entry »

Posted in CommandLine, Delphi, Development, Software Development | 1 Comment »

Speaking at DelphiLive! 2011 in San Jose, CA, USA from September 12th to 14th 2011

Posted by jpluimers on 2011/08/04

I’ll be speaking at a few conferences this fall.

The furthest for me will be DelphiLive! 2011 in San Jose, CA, which will be held from September 12th to 14th (slightly more than a month from now).

Note that if you want to come, the early bird discount is until augusts 15!

Part of the sessions and speakers lists are already published, but it will be extended shortly (some nice Delphi XE2 sessions are in the pipeline), followed by a workshop tutorials list, and agenda.

My sessions are going to be these:

Not everything for those sessions is set in stone yet, so if you have ideas for things I should include, exclude, emphasize or understate, please let me know.

I’m looking forward to meet (often again!) a lot of attendees and speakers.

The social part of conferences is very important too.
Last year, after the conference, a few speakers, attendees and other people had a marvelous steak dinner. Great fun!

Hope to see a few of my blog readers at one conference or the other.

–jeroen

PS: Like last year, the conference will be held at Crowne Plaza Hotel San Jose Downtown, 282 Almaden Boulevard, San Jose, CA 95113, USA (it has a special room rate of USD 139 per night for conference attendees).

PS2: Some more events will follow shortly.

Posted in Conferences, Delphi, DelphiLive, Development, Event, Software Development | 1 Comment »

Text displayed in some core fonts appears blurred in Internet Explorer 9 on a computer that is running Windows Vista, Windows Server 2008, Windows 7, or Windows Server 2008 R2

Posted by jpluimers on 2011/08/02

Right now there are so many ways to display text, that – depending on your physical display (CRT, LCD, etc) – all behave differently.

Even Microsoft has released a patch (see the below quote from KB 2545698 that got released last month).

This issue occurs because of a design change to how Internet Explorer 9 renders text. By default, Internet Explorer 9 uses sub-pixel positioned ClearType to render text by using DirectWrite, whereas Internet Explorer 8 uses whole-pixel positioned ClearType to render text by using the Microsoft Windows graphics device interface (GDI).

I’m wondering if there is a way to make it work ‘right’ on every type of display combination.

Do you know any?

–jeroen

via Text displayed in some core fonts appears blurred in Internet Explorer 9 on a computer that is running Windows Vista, Windows Server 2008, Windows 7, or Windows Server 2008 R2.

Posted in .NET, Delphi, Development, Font, Power User, Software Development | 5 Comments »

Marco Cantu’s Delphi XE Handbook Available in print and electronically

Posted by jpluimers on 2011/07/27

Having proofread, I’m really glad that Marco Cantu recently announced that Delphi XE Handbook to be Available in both print and electronic forms.

Note that since the announcement, you can also get the Handbooks Collection in PDF form for something like EUR 55.

His books are always a pleasure to read, so: Great work Marco!

–jeroen

Posted in Delphi, Development, Software Development | 2 Comments »

WebSphere MQ and Delphi

Posted by jpluimers on 2011/07/21

On my research list: WebSphere MQ and Delphi.

The funny thing is that this Delphi MQ Series question on StackOverflow that I answered actually helped me to get going :)

A few interesting links:

The research actually is focussed to replace a APPC/CPI-C session based solution that runs on top of SNA using LU 6.2 endpoints and has round-trip response times between 50 and 150 milliseconds with a WebSphere MQ based solution having similar performance characteristics. It binds multiple client applications to multiple function entries on the AS/400 systems at the client.

The current APPC/CPI-C part is written either both a DLL and EXE in Delphi (depending on how it is used), hence the Delphi part of the research.

In many organizations, WebSphere MQ (aka MQSeries) is part of their Enterprise Service Bus. In that regard, the SNA solution was far a ahead of its time.

BTW: Back then (almost 15 years ago), the SNA solution started out as solution using AS/400 Data Queues. Even after months of trying, that didn’t work well because the mixed environment of NetSoft Router, AS/400, SNA Server and Windows NT 4 in a pretty big WAN had huge problems.
Somehow, one of the layers forced sessions to always use 2 connections at a time, which was causing huge problems when those were routed through different SNA servers. That routing was unpredictable (and it was not possible to disable/force it to use stick to one SNA server). In addition, it was memory and CPU hungry on the PC side (when you were glad to have a Pentium MMX based CPU with 32 MB RAM, it ate 20+% of the CPU power, and 25+% of the memory per session, peaking to 100% CPU and 50% of RAM per session).
Specialists from all involved parties weren’t able to pinpoint the actual cause, so we went a few steps down on the OSI layer to the APPC leve.

–jeroen

Posted in .NET, Delphi, Development, Software Development | 5 Comments »

File extension parameters do include a dot

Posted by jpluimers on 2011/07/20

This is from a long time ago, but still fun:

Sometimes simple things in life are hard do remember.

For instance, I always forgot if a file extension parameter should have a dot in it or not.

Normally it should!

But for clearing an extension, you should use a blank string.

Be aware though that empty extensions look differently depending where in the process you look at them:

C# example:

using System;
using System.IO;
public class Test
{
        public static void Main()
        {
                string extensionLess = Path.ChangeExtension(@"C:\mydir\myfile.com.extension", "");
                Console.WriteLine(extensionLess);
                string extension = Path.GetExtension(extensionLess);
                Console.WriteLine(extension);
        }
}

Outputs:

C:\mydir\myfile.com.

Delphi example:

program Demo;
{$APPTYPE CONSOLE}
uses
  SysUtils;
var
  extensionLess: string;
  extension: string;
begin
  extensionLess := ChangeFileExt('C:\mydir\myfile.com.extension', '');
  Writeln(extensionLess);
  extension := ExtractFileExt(extensionLess);
  Writeln(extension);
end.

Outputs:

C:\mydir\myfile.com
.com

Don’t you love differences in your platforms :)

–jeroen

Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Delphi, Development, Software Development | 4 Comments »