During September I’ll be visiting Perth, Canberra and Adelaide in conjunction with the ADUG to present the new version of Delphi. Details are up for Perth already, I’ll update this post with links for the others as they become available. We’re also looking at how we can slot some New Zealand sessions in as well.
Archive for the ‘Misc’ Category
Company Alignment, or why developers should be rewarded based on sales revenue
Over the years I’ve been involved in dozens of meetings, workshops and conference calls aimed at trying to achieve “alignment” between groups in a company. Piles of books have been written, conference sessions presented, seminars held at airport hotels, all aimed at helping companies get aligned.
Generally what this means is trying to get two or more groups that are dependent on each other to all pull in the same direction. When I was running development teams, it was often between sales and product development. Later it was sales and marketing alignment. Like a meditation practitioner seeking enlightenment, alignment is often spoken about as if it were some higher state of consciousness where multiple groups within an organisation move together in harmony like a school of fish avoiding predators.
Upgrading, hopefully I’ll be back real soon.
The recent influx of comments has made me realise I really need threaded comments, which is finally pushing me to upgrade WordPress. Everything tells me it should upgrade smoothly, except experience :-). Hopefully I’ll be back online shortly.
No good deed goes unpunished: Nokia and Inbox management.
Awhile back I got converted. Not to a religious group (although, at times I wonder…) but I reached a point where my email and task management habits would no longer scale, and I was drowning in my inbox. I read a book and a couple of articles, made a few changes to my behaviour and since then have been very good at keeping my inbox down to zero at the end of each day. Travelling has been a test, but I’ve stuck at it and seen the benefit.
Also awhile back, my phone started playing up. I have a Nokia E71, and the feelings I have for this phone verge on the unnatural. It’s easily the best, most useful phone I’ve ever owned. Suddenly, it started rebooting itself every few minutes. This would happen for 5minutes or so every few hours, and then would go away. I uninstalled apps that I’d recently installed, searched for other people with the same issue, all to no avail.
Eventually I realised the two things were connected. Seems there is a bug in Mail for Exchange on Symbian. Whenever my inbox gets down to zero, this issue starts occurring. The fix is to send myself an email. As soon as that email hits my inbox, the phone goes back to being rock solid.
I guess there has to be some upside to bad email management.
Casting an Interface Reference to the Implementing Class in Delphi 2010
Not all the new features in Delphi 2010 are big. In fact, the team have spent a lot of time implementing many small features, fixes and tweaks. Some of these may not seem to amount to much individually, but they not only add up to significant impact, but greatly add to the polish of the product. I expect this will be one of those releases that keeps serving up little delights and surprises for a long time.
One of the features in Delphi 2010 that I expect will spawn much debate is the ability to cast an interface reference back to the type of class that implements it.
Aussie Delphi 2010 Sneak Peeks in Sydney and Melbourne
I’ll be presenting the RAD Studio 2010 Sneak Peeks in Sydney and Melbourne next week. There are more details here, but if you are in town I’d encourage you to come along. There’s some very cool stuff in this release.
And before you ask, yes, we’re working on other cities. Stay tuned.
IOUtils.pas – OO File System Access in Delphi 2010
Delphi has long had various functions to let you work with the file system, but one of the new features of Delphi 2010 are some nice wrappers for working with files, paths and directories.
IOUtils.pas is the file in question, and it’s definitely worth a look. Each time I’ve had a look in there during the Field Test I’ve found more interesting stuff to play with. While I’m still exploring it, I thought I’d post a few examples to show you the kind of things you can get up to.
Firstly, something easy:
procedure TForm2.Button2Click(Sender: TObject);
var
Path : string;
begin
if not TDirectory.Exists(edtPath.Text) then
Caption := 'Invalid Path'
else
Caption := edtPath.Text;
ListBox1.Clear;
for Path in TDirectory.GetFiles(edtPath.Text, edtFilter.Text) do
Listbox1.Items.Add(Format('Name = %s', [Path]));
end;
First we check if the path provided in the edtPath edit box exists. Assuming it does, we then use a for..in statement to get back each file in that directory that matches the filter passed in as the second parameter.
If you look a little further in IOUtils.pas, you’ll see TDirectory has a type declared in it called a TFilterPredicate:
TFilterPredicate = reference to function(const Path: string; const SearchRec: TSearchRec): Boolean;
One of the places it is used is in an overloaded version of GetFiles, like so:
procedure TForm2.Button1Click(Sender: TObject);
var
Path : string;
FilterPredicate : TDirectory.TFilterPredicate;
begin
if not TDirectory.Exists(edtPath.Text) then
Caption := 'Invalid Path'
else
Caption := edtPath.Text;
ListBox1.Clear;
FilterPredicate := function(const Path: string; const SearchRec: TSearchRec): Boolean
begin
Result := (TPath.MatchesPattern(SearchRec.Name, edtFilter.Text, False)) AND
(SearchRec.Attr = faArchive);
end;
for Path in TDirectory.GetFiles(edtPath.Text, FilterPredicate) do
Listbox1.Items.Add(Format('Name = %s', [Path]));
end;
We implement the TFilterPredicate anonymous method to check that each file matches a wildcard pattern and that it also has its Archive flag set. We can then pass it into our call to TDirectory.GetFiles and our code in the for..in statement will only be called for files that match our criteria.
This is all fine for a single directory, but what if we want to walk over the full tree of directories? Easy, just alter our code to look like this:
procedure TForm2.Button3Click(Sender: TObject);
var
Path, Directory : string;
FilterPredicate : TDirectory.TFilterPredicate;
begin
if not TDirectory.Exists(edtPath.Text) then
Caption := 'Invalid Path'
else
Caption := edtPath.Text;
ListBox1.Clear;
FilterPredicate := function(const Path: string; const SearchRec: TSearchRec): Boolean
begin
Result := (TPath.MatchesPattern(SearchRec.Name, edtFilter.Text, False)) AND
(SearchRec.Attr = faArchive);
end;
for Directory in TDirectory.GetDirectories(edtPath.Text, TSearchOption.soAllDirectories, nil) do
for Path in TDirectory.GetFiles(Directory, FilterPredicate) do
Listbox1.Items.Add(Format('Name = %s', [Path]));
end;
We add another for..in statement before the existing one. This one for each Directory in TDirectory.GetDirectories. The second parameter indicates whether we only want to get the top level directories in the path we specify, or whether we want to do all directories , all the way down. In this case I’m specifying the latter. The Third parameter is actually another TDirectory.TFilterPredicate, so we could do further filtering of the directories that match, however I’m passing in nil so all directories will match. Just keep your wits about you while testing, and don’t test it with c:\ as I did
One thing to note, TDirectory.GetDirectories returns child directories of the path we’ve specified (and their child directories, etc if you’ve specified TSearchOption.soAllDirectories), but obviously not the path we pass in itself. That probably sounds obvious, but in this example we’ve subtly altered the behaviour a little, because the files in the directory we specify are not checked anymore. Now you’re aware of this, I’m sure you can figure out how to deal.
There’s a whole bunch more that can be done, such as encrypt files, move directories, etc. IOUtils looks to be a really powerful unit, and is well worth a little playing to get familiar with it.
Tokyo makes a lot more sense on no sleep
I’m back in Tokyo for a few days. Arrived this morning after an overnight flight from Sydney and somewhere along the line my hotel booking got screwed up, so I couldn’t check in until this afternoon. Dull headache from no sleep, 30+ degrees celsius and humid, wandering around Ochanomizu and Shinjuku. Strangely, Tokyo makes a lot more sense in this fuzzy, dislocated state.
License choices and a sense of entitlement.
I’ve been enjoying reading some of the responses to Zed Shaw’s Why I (A/L)GPL post.
Leaving all the back-story aside, the decision he’s reached for his future releases seems quite reasonable to me. If you respect the license and give back to the community, you can have it for free. If you don’t, you can pay for it. Ultimately however, it doesn’t matter whether I think it’s reasonable. He’s doing the creating, so he gets to make the call.
Which license you use for a project is a decision that needs to be thought about in a very clinical, mature way. Does your license choice line up with your expectations of what you want in return? Assume all you’ll get in return from the users of your project is the bare minimum required by the license. If that’s it, will you be happy? If so, great, go forth and release. If not, be honest with yourself about what it is you do want in return and choose a license that articulates those wants.
For people who use other people’s work, either free or commercial, in your projects, it’s ok to ask for something for free. After all, if you don’t ask you don’t get. It’s also OK to tell someone you disagree with their choice of license or business model. However, It’s not ok to feel entitled to something for free or to feel they have to listen to your opinion. If you want to make those kind of decisions for a project, then go create something yourself.
Wish more people did write-ups like this. @KentBeck deadpools JUnit Max http://bit.ly/16qQv3
Kent Beck has just announced he is . It’s a sad day when you have to give up on an idea you’ve really believed in. A few things to admire about this though. First, most people give up on the idea long before they get to implementation, and those that actually get past first release often can’t let go even after they know it’s doomed. Second, he wrote up a little post-mortem so we could all learn from what he found. Also, love the quote “If you aren’t embarrassed, you waited too long to release”.
