Wednesday, December 24, 2008

Happy Holidays to All !!

Wishing you a very Merry Christmas and a prosperous New Year!

For the geek in you : TgC_Navidad_184
01010111 01101001 01110011 01101000 01101001 01101110 01100111 00100000 01111001 01101111 01110101 00100000 01100001 00100000 01110110 01100101 01110010 01111001 00100000 01001101 01100101 01110010 01110010 01111001 00100000 01000011 01101000 01110010 01101001 01110011 01110100 01101101 01100001 01110011 00100000 01100001 01101110 01100100 00100000 01100001 00100000 01110000 01110010 01101111 01110011 01110000 01100101 01110010 01101111 01110101 01110011 00100000 01001110 01100101 01110111 00100000 01011001 01100101 01100001 01110010 00100001 00001101 00001010

Will see you all in the new year.  Happy programming …
Dave

Thursday, December 11, 2008

Design Patterns in Delphi – Resources

As I mentioned in a previous post, I’m studying Design Patterns using the Head First Design Patterns book from O’Reilly.   As part of this learning process I’m working through the existing examples written in Java and recreating them in Delphi.  This is the first of many posts, hopefully, that are the result of that learning process. This first post in the series is simply a list of known [ones I’ve found] resources on Design Patterns in Delphi.

I don’t plan on teaching you design patterns as that would be quite presumptuous of me, considering I’m just a student of them myself.  I do intend on providing you with an overview of what I’ve learned and any/all the resources I’ve used to learn the pattern at hand.  As indicated, the primary resource will be the Head First Design Patterns book mentioned above.  There are numerous other books available on the topic but this is the one I have and will be using. 

I would like to point out that there are a number of resource out there, readily available, defining these patterns in Delphi.  I’ve listed all the ones I have found so far below.  In future posts I plan on providing an Additional Resources section at the end of each post –but- it’ll be just the resources I used to learn that particular pattern.

If you’re a guru at Design Patterns, please feel free to leave additional suggested titles and other applicable comments in the area provided below.  Any links to additional resources dealing with Design Patterns in Delphi, that I’ve missed, will be thoroughly appreciated and of significant assistance.

What I’ve Found:

 

What Others Have Added:

 

Looking forward to getting into Design Patterns in Delphi.

Thanks for stopping by …
Dave

Friday, December 5, 2008

The Answer To [almost] Every Question

This is priceless and I’ve got to share it:

It’s definitely one of those … Doh!  Why didn’t I think of that items.  It’s an absolutely obvious solutions to a situation that every-one that has ever been in a newsgroup or forum has run into at one point or another.  Best of all … you know you’re thinking of exactly this when you’re the one that ends up at Google getting the information required to answer the question.  Well, you don’t have to spell it out anymore – let “Let me Google That for You.com get the message across for you.

The link you post, will go to the site, type in the information – it even clicks the Google Search button for them.

Hilarious

 

Seriously though:
Please, be nice to the newbies [and even more importantly … the hobbyists] – only use this as a joke amongst your peers who really should know better than to ask you a question in the fist place.  :)

 

Thanks or stopping by …
Dave

Friday, November 28, 2008

Busy, Busy, Busy … But I’m Back

Wow!  I can’t believe that I haven’t posted anything in more than two months – where did the time go?  It’s not like I don’t have fodder for new posts, the news items are many and varied over the last couple of months and that’s the stuff happening outside my world.  I won’t bother even touching any of that though,  it’s all been more than adequately covered buy the bloggers you can track over at DelphiFeeds.com 

There’s so much on the go, I don’t really know where to begin …

I finally made it over the hump with tiOPF !  Woohoo for me!  I’m standing there with this [had to be – at least] 1,000 watt bulb lit up over my head, looking down the slope wondering, “what exactly was the issue, moron?” and I’m coming up with an entire series of articles that just have to be written.  They’re coming up … soon as I find the time.

image

For my birthday I got a copy of  Head First Design Patterns by O’Reilly.  This is a bit of a “just like me” story … I read the bit in the intro where if you don’t write Java you’re a little on the clueless side and will never really understand this book so maybe you ought to leave it on the shelf for the big boys to buy and I’m ready to heave it in the bin.  OK, I’ve taken a bit of license with the actual text.  But then … yea, I start thinking maybe writing too much Java made them a little soft in the noodle.  Either that -or- Delphi code was a little too complex for them.  So anyway, I start reading the book, the first chapter at least, and re-creating the examples in Delphi.  Now, if I can do it – they’re way, way off the mark.  So the point of this is that I’ve got these articles planned as well – stay tooned.  Like I said, I’ve only finished the fist section of it but so far I think it’s a pretty good book.  A couple of caveats though;
- the teaching “method” seems pretty good but can be a bit annoying and
- don’t buy a new copy, pick up a used one … they really don’t deserve money from outside the Java community.

Work is extremely busy.  This is the second trip in a row where I’ve gone out and never managed to even open the lap-top to work on any of the numerous projects I’ve got on the go.  When you consider that when I go out on the ship, I live there 24/7 for 28 days, you’ve got to be pretty tired at the end of a [12 hour] day not to want to fire up Delphi and do a bit of coding.

image Finally, a bit of a chuckle, I get home from sea and a late birthday present from the out-laws [my wife's folks] is there waiting … Head First Object-Oriented Analysis and Design … go figure :)

Yea, it’s got the same “if you don’t know Java you’d better put the book back because you’ll never really get it” bit.  Never having had much of a head for marketing [far too logically inclined] I just don’t get why you’d shoot yourself in both feet.

A thousand things on the go – all the time, ain’t life grand :)

Thanks for stopping by … hope to get back to regular posts soon
--
Dave

 

Wednesday, August 27, 2008

SmartInspect 3 ... Test Drive

The other day I listened to Episode 2 - Nick Hodges, a "podcast" from Delphi.org by Jim McKeeth. One of the event sponsors was Gurock Software who donated a copy of their product Smart Inspect 3, a tracing and debugging application, "... going to one lucky listener". Well, sort of, bit of a trick to pick a lucky listener of a podcast, wouldn't you think? Guess it's one of those "honour bar" sort of things. Well, "I listened to the Episode 2 - Nick Hodges podcast" [there, I'm in] which, I happened to have really enjoyed - it was great. If you haven't listened in yet, it's highly recommended.

I decided, while I was listening to Jim and Nick, to wander over to the Gurock site and have a look at SmartInspect 3, just to see what this product was all about. This wasn't the first time I'd heard of the product, but it was the first time I'd actually gone to the site with "having anything more than a cursory look" in mind -so- the advertising part of both the event and the product web site worked, at least with me. OK, the give-a-way didn't hurt either ... there, I admitted it. The more I read about however, the more intrigued I became, so I decided to download it and have a real good look.

The plan here is to have a look at it from a newbie/hobbyist perspective, that pretty much being the theme of this blog. Of note, I'm currently using Delphi 2007 Pro.

Don't know about you, but it's usual for me to go to the site, read the pitch and then hit the pricing page before I decide if any further reading is worth while, budgetary restraints considered. This time, I decided the pricing page would wait until last.

The pitch from the web site:

SmartInspect
... is an advanced logging tool for debugging and monitoring .NET, Java and Delphi applications. It helps you identify bugs, find solutions to user-reported issues and gives you a precise picture of how your software performs in different environments. Whether you need logging in the development phase, on production systems or at customer sites, SmartInspect is the perfect choice.

Going by what I saw on the web tutorial I won't even come close to exercising the limits or even all of the features of this product. This is one sweet piece of kit ...

  • the download and installation went smoothly. I was offered a full set of options to put the product, it's start menus and short-cuts exactly where I wanted them - brilliant!
  • the fact that you can run it right away, with only having seen the web tutorial, is a testament to it's ease of use.
  • the included PDF manual was an easy read, covered the product well and included a getting started tutorial. FWIW, the PDF file is the same as the help file [which works excellently] with the API reference sections removed.
  • it comes with it's own set of well developed code templates.
  • the IDE plug-in for Delphi ... a thing of beauty!
  • you can "Log" virtually anything ... the list is huge and varied.
  • you can "Watch" any numeric value in your program.
  • there is "Filtering", various "Log Level" settings and custom "Configuration Files".
  • ... the list of things you can do and ways you can configure this program to log/debug your programs is immense.
  • there's a redistributable console which can be shipped together with your software applications to end-users. This makes it possible to offer a way for your customers to inspect log files and to monitor your applications.
  • it comes with a configuration tool to help you to create and edit a SmartInspect configuration file.

This product is a newbies [programmers at any skill level for that matter] dream. Applied correctly, there should be no reason to code another ShowMessage() or set another break/watch point again. If you need to know what's going on in your program, simply have a look at what SmartInspect has been recording for you. It's right there and ready to run in the Delphi IDE or in the Notification area depending on the "Options" you've set up. Got a problem in the field ... have a look at the log file. Heck, if I'm reading this correctly [and you've set it up to do so] you can open the console and monitor the program remotely, on a LAN/WAN -or- at least have the file sent to you by email. If you've set it up properly, it'll tell you everything you need to know about what's going on in your program.

Just considering the time spent coding, cancelling, and then deleting code for the multitude of ShowMessage(); dialogues that get written [and you will write them], setting/checking break/watch points and stepping line by line through code looking for specific values, this product will save you tons of frustration and time. I'm just scratching the surface ... based on what I'm able to do with it at this point, what more do you need. This program could be used for troubleshooting existing code or just to figure out what other peoples code is doing - I know I plan on using it for just that.

Nothing you will read here or anywhere else can do this piece of software justice - you have to take it for a test drive and see what you can make it do. If you haven't downloaded a 30 day trial yet, what could you possibly be waiting for? The more I play with this program the more I wonder how could you possibly manage without it -and- I haven't played with much more than the basics. If you're in a hurry, an experienced developer will have this program installed and have mastered the basics in about 30 minutes or less ... certainly less than an hour.

A single user license is $299US [€199] a fair chunk of change for my category of developer. When you think of what it does for you, and how well it does it, even a budget minded hobbyist needs to work this one in there somewhere ... hey, [sigh ... Foot.Shoot(Self);] there's a chance you could Win a Free Copy -but- I wouldn't bother with that if I was you :)

Although I'm nowhere near where I'd need to be to make suggested improvements to the program itself, I do have a few comments on the documentation:

  • Put section 2.2 What's New at the end of the manual - I can get to the meat ~8 pages earlier.
  • Put section 2.6 General Business and Licensing Conditions at the end of the manual [see above].
  • A Watches Demo/Tutorial would be great addition - although reading the manual makes it all pretty simple.

Test drive it yourself.

 

FYI: The other podcast sponsor was Scooter Software and their product Beyond Compare - I visited that site and had a look at their product too. So should you.

Gotta go, only 27 days left on my trial.
Thanks for stopping by ... 
Dave

Tuesday, August 19, 2008

A "Random Thought" Not To Be Missed!

I seldom pass up a chance to read the Random Thoughts posts by Nick Hodges whenever they happen to pop up on Delphi Feeds.

Random Thoughts on Passing Scene No. 77 was a beauty! In there is an innocuous looking link to an eWeek article "Nice article on Delphi 2009 and C++Builder 2009 in eWeek" ... don't pass up on following through to the article. It's an article [according to Michael Swindell in the article] that up to, possibly more than, 2M people would find exciting - OK, maybe not all of them :)

"Embarcadero Technologies plans to release the next generation of its CodeGear—formerly Borland—rapid application development tools for Windows, Delphi 2009 and C++Builder 2009, on Aug. 25."

Read the whole article there is a lot of interesting stuff in there. Typically the big question is left until last ...

"Delphi 2009 and C++Builder 2009 will be available on Aug. 25 with North American pricing beginning at $399 per license for Professional editions, $1,299 for Enterprise editions and $2,299 for Architect editions."

It's what we've all been waiting for ... looking at the price list, even I may upgrade :)

Thanks for stopping by,
Dave

Thursday, August 14, 2008

Add a bit of Face to XanaNews

C'mon take a little break from all that Tiburon chatter and [possibly] learn something totally irrelevant, unquestionably frivolous and undeniably trivial.

My XFaceMost people are aware of X-Face, a black-and-white 48x48 image, compressed into readable text and sent along with the headers of an e-mail message or a Usenet post. The utility I've been using for this is WinFace. You could also use the Online X-Face Converter or simply select the X-Face you want to use at A bunch of X-Faces.
There's the one I've been using off to the right there.

Taz Oh, before I forget ... if you're still a bit saving purist, in this day of age - go figure, please ... go away!  You're only going to get angry and frustrated here. I'll be promoting adding up to 750 bytes to every NG post that gets sent/downloaded. Most people over-quote more than that ... sheesh.

Marine EngineeringThere is a seemingly not so well known equivalent of X-Face, referred to simply as Face, that you can add instead. The advantage of Face is that you can add a splash of colour to the image and be a little more creative - although some would argue that perfecting an X-Face, having only black and white to work with, takes a bit more talent. You be the judge, me ... I'm a bit ambivalent toward the entire argument.  I've shown the latest "Face" I'm using to the right. It's supposed to bring my trade, Marine Engineering to mind ... it does for me.

Elmer FuddI'm only going to cover one News Reader here, but having tried quite a few of them, AFAIK there is only one ... XanaNews by Delphi guru Colin Wilson - visit Colin's Delphi Site for a lot more in excellent Delphi Utilities, Components and Applications. While Colin is on sabbatical from XN development we've been fortunate to have Leonel Togniolli [another Delphi guru] keep us up to speed with continuous releases from his site - Unofficial XanaNews NewsReader. So if you do decide to upgrade to XN that'd be the place to go. If you use another News Reader, for some odd reason, you'll have to figure how to get the Face you'll use into that program on your own.

ER Telegraph What were we talking about ... oh yea, how to create a Face for your NG posts. That's pretty easy actually although there are a few rules you need to abide by. For the tool we're going to use, it must be in PNG format. In addition, the image cannot be greater in dimension than 48x48 and not greater in size than 725 bytes. There's all you'll need to know on The Face Header site - a must read. I use IrfanView personally, to meet these requirements but there's several other programs that can do the same. Of note, you're going to need to reduce the colour palette depth down to at least 16 in my experience -but- see what you can get away with.

toothbrush Once you've acquired your 725 byte [or less] 48x48 PNG image download the PNG-To-Face utility [notice the Pascal code - all the best tools and utilities use it], extract it to the folder of choice and run it. Browse to the folder holding your file and select it ... PNG-To-Face will do the rest. If your image meets the criterion you will be presented with what looks like a lot of hieroglyphics in the right hand pane - that's your image "compressed into readable text". Copy it to the clipboard.

Ship Wheel Now you're going to need to fire up XanaNews and decide where you're going to use your Face images. They can be added to an Account, a Group or simply to any specific message by adding to the Additional Header Data. Right-click on the Account or Newsgroup you want in the tree-view and select either Account or Newsgroup Properties from the drop-down menu. In the dialogue that comes up select Posted Message Headers in the tree. You will see an Extra Headers text-box [which, as it turns out can't be edited] there and a Modify button. Click the Modify button and on an new line [if required] in the Advanced Headers dialogue type in "Face:" [without the quotes] followed by the "compressed readable text" you copied to the clip-board from the PNG-To-Face utility. If you just want to apply the Face: to a single message, click on the Advanced button in the message dialogue and add the new Face: information on a new line in the Advanced Header dialogue.

Face:iVBORw0KGgo [... clipped a bunch ...] RU5ErkJggg==

Nothing to it, it's the telling that takes the time :)

Thanks for stopping by ...
Dave

Tuesday, July 1, 2008

Out With The Old ...

Embarcadero Technologies Closes Acquisition of CodeGear

Embarcadero Technologies is the new owner of CodeGear. No fireworks, no fanfare, at least nothing I've been invited to, just business as usual. There are, on the other hand, a lot of customers and employees expecting to see new and exciting things happen to their IDE of choice. Actually, it would probably be more accurate to say "psyched, pumped, stoked, jazzed, revved, enthused, hyped [insert your favourite here]" ... somehow "new and exciting things", just doesn't cut it with what I've seen so far.

So what's everyone cranked [bugger, forgot to include "cranked"] about ... the future of an outstanding programming environment! To be factual, many programming environments. You see, Embarcadero didn't just wander in to town and buy up one of the home teams - they bought them all.  And, much like when your favourite professional sports team changes owners, it's a time for great expectations for the upcoming season. Of course, Embarcadero has it pretty easy with my IDE of choice, Delphi - it's already the premier Win32 development environment on the market.

The sweet part of all this ... it's all about the fans. The existing fans, new fans and the fans that need just a bit of a nudge, back in the right direction. After all, everyone will want the stadium packed with screaming fans [happy ones] on game day.

Congratulations Embarcadero, congratulations CodeGear. Most importantly, congratulations to the steadfast and loyal fans of all the CodeGear products that are headed to new and exciting places.

Thanks for stopping by ...
Dave

Saturday, June 28, 2008

Code Template - Property with Getter & Setter

I was fiddling with a code template I'd written [or more likely, "borrowed" from somewhere] which I've been using for completing Read-Write and Read-Only properties. Originally it was set up with two points ... one for the property variable ["ident"] and one for it's type ["type"].

When setting the "ident" variable point, the template was automatically filling in the Getter and Setter following the "F" for me and prior to using Code Completion [Ctrl-Shift-C] I would have to make sure I replaced the "F" with either Get or Set if I wanted actual Getter or Setter methods.

This original CDATA:
<![CDATA[property |ident|: |type| read F|ident|;|end|]]>
produces this code:
property Test: Integer read FTest write FTest;

I didn't know if sticking two point variable side-by-side would work. I can't imagine why it wouldn't, but you never know. So, I experimented and sure enough adding a couple of "setter" and "getter" points and having them that close to another point in the CData - wasn't a problem at all.

Now after setting [or leaving the default] property type, it's either Tab to leave the default "Get" or "Set" -or- replace the appropriate one [or both] with "F".

Now, it's as simple as:

"proprw [tab/space] Test [tab][tab][tab[tab]" to get:
property Test: Integer read GetTest write SetTest;

- or -

"proprw [tab/space] Test [tab][tab] F [tab] F [tab] to get:
property Test: Integer read FTest write FTest;

Code templates simply rock! A little front end work, to accomplish a lot of back end work ... much, much faster.

Here's the modified version that I use for a read-write property ... enjoy. Note that I've changed the point names to something meaningful ... "ident" wasn't really all that descriptive.

<?xml version="1.0" encoding="utf-8" ?> 
<codetemplate    xmlns="http://schemas.borland.com/Delphi/2005/codetemplates" version="1.0.0"> 
    <template name="proprw" invoke="auto"> 
        <description>Property with Getter and Setter.</description> 
        <author>tdh</author> 
        <point name="Name"> 
            <text>Name</text> 
            <hint>the Name for the property</hint> 
        </point> 
        <point name="Type"> 
            <text>Integer</text> 
            <hint>the Type for the property</hint> 
        </point> 
        <point name="Getter"> 
            <text>Get</text> 
            <hint>the property Getter</hint> 
        </point> 
        <point name="Setter"> 
            <text>Set</text> 
            <hint>the property Setter</hint> 
        </point> 
        <code language="Delphi" delimiter="|"> 
        <![CDATA[property |Name|: |Type| read |Getter||Name| write |Setter||Name|;|end|]]> 
        </code> 
    </template> 
</codetemplate>

Copy the code above into a text file, and save it as:
C:\My Documents\RAD Studio\code_templates\PropertyGetSet.xml
I'll leave creating the Read-Only derivative to you.

Note: I had a look at the Delphi Wiki and did find one where the author was "twm". It's probable that's where I got the original that I was working with so apologies to "twm" if it appears that I'm taking credit for your work - last thing I want to do, honestly.

Thanks for stopping by ...
Dave

Friday, June 13, 2008

Essential Reading ... Essential Pascal

Back from a extremely busy [which fortunately, has the advantageous effect of making it seemingly short] 28 day stint at sea, I was pleased to see that my copy of Essential Pascal by Marco Cantù had arrived. In the fog of work, which had virtually hidden the real world from memory, I had actually forgotten all about having ordered it.

Although I had downloaded, printed and read one of the earlier PDF versions a few years back, I found it a pleasure to have an official dead tree version, in hand, to have another look at. The book is a very easy read and, in my opinion, simply a must have for anyone from newbies to masters of other languages, who is new to writing Pascal code. Although speaking to the needs of masters is admittedly, quite a bit beyond my skill level.

For the programming newbie, there are a couple of areas where I feel it will be a bit of a grunt to get your head around the concepts. Fortunately, the fact that you don't fully understand them isn't likely to impede you in getting up and running with Pascal code. The two specific areas that I thought that it may be a bit of a struggle for the newbie to get a handle on, are Pointers and Parameters.

Although you could probably write Delphi code forever without even thinking about pointers, you would be doing yourself a serious injustice if you did. They're sitting there staring you in the face and you should at least understand how they work. The concept of pointers, to put it simply, is initially a bit of a bugger - it certainly was for me. Once you "get it" you do look back and wonder what all the fuss was about though. To get over the Pointers hump, in addition to what Marco has presented in the book, have a look at:

As far as the understanding of parameters is concerned, Marco has thankfully explained the concepts in order of complexity. Take it a bit at a time, read the text, then have a look at Movie #34 - Parameters by Alister Christie at CodeGearGuru.com to get the basics [there's some revealing info on pointers in that movie as well]. Understanding that, by default, you're passing parameters by value and what happens when these values get changed, is an essential concept. Knowing that you can, and why you would want to, pass them either by reference or as constant is very important. Finally, although you may never contemplate writing a routine that passes either a "Open Array" or a "Type Variant Open Array" parameter, it is very likely that some where down the line, you will use one. Understanding what you're feeding in, will make it quite a bit easier to understand the results you get. Parameters can be very confusing, specifically when you start passing objects. I'm still trying to figure it out fully - maybe once I do, I'll share that information here. It'll all boil down to a few basic rules that are easy to follow and remember - like pointers, once you get it, you're good.

Essential Pascal by Marco Cantù is a book you simply need to read and have at hand in one form or another. As a newbie, thinking that you can just read the help file and figure out how to write Pascal code [fodder for another post - at another time] will just lead to frustration. Believe me, I looked at this as an option from a "Why not just ... " perspective before writing this post and it is certainly not the way I would want to have to do it.

Thanks for stopping by ...
Dave