Archive for the ‘Development’ Category

Delphi Blog

Wednesday, December 5th, 2012

I have created a new blog called Delphi Bar, this relates just to Delphi software development. The intention is to use this blog to publish useful code and information on the Delphi programming language.

PLSQL replacement for IIF

Tuesday, January 17th, 2012

Currently I am using a Oracle database and have been writing queries and can across a problem the other day, I wanted to use a IIF statement which I have used in other SQL based databases like Sybase Advantage. However PLSQL does not support IIF statements, but the workaround I found was to use the DECODE function instead, for example:

Decode(:param1, -1, dothis, dothat)

Not sure how fast this executes compared with IIF, but the query executed very fast.

iOS 5 retain and release gone!

Friday, September 9th, 2011

With the next release of iOS development of apps has changed and there is no need to use retain or release, the new ARC (Automatic Reference Counting) memory management takes care of it all. This will reduce crashes and memory leaks and saving time in the development process. At compile time it understands the objects and releases the objects when it knows  they are no longer required, this is very similar to other development languages. This does however mean a lot of work to get existing apps to run, but new apps will be quicker and more reliable when developing.

iPhone application development with Delphi Prism

Friday, June 10th, 2011

I have just watch a very interesting video (Link) which demostrates how to develop iPhone/iPad applications using Delphi Prism. The video is a overview of how to develop a simple application, it uses xCodes interface builder for the xib files. I am interested in how this will work with xCode 4, seeing as the interface builder is integrated into the main IDE.

Xcode 4 released

Thursday, March 24th, 2011

I have recently been on an xcode course and we used version 3, I found that compared to Delphi and Visual Studio, xcode was behind the times by quite some way. To do interface design you had to use interface designer which is a separate application, so you have to keep remembering to save the interface. Also unlike Delphi there is no background complication so errors in code are not reported until you manually compile the application. The code completion is weak and no way as good as Delphi.

However, while on the course xcode 4 was release and we got to have a quick look, Apple has made a massive leap forward with the IDE and now the interface builder is part of xcode, also the compiler is new, this means background compilation is possible so errors are reported instantly and the code completion works much better.

I am looking forward to moving onto xcode 4 when I get a moment, it looks much better and now is up to date with Delphi and Visual Studio.

SQL Query – How to group by a memo field

Saturday, February 26th, 2011

This week I was writing some SQL queries for a Sybase Advantage database and came across a problem of grouping a memo field. At first I thought the way around this was to SubString() the field with a large limit, I noticed that this worked OK with a range of 1-1000 but caused problems with a range of 1-1500. The best solution I found was to convert the memo to a varchar, here is the snippet of SQL.

Convert(MemoField, SQL_VARCHAR) as ConvertedMemo

This then allows you to group by that field and the query still ran very fast.

How to use triggers to keep a table history

Monday, February 21st, 2011

I have recently written an article on how to use triggers in a Sybase Advantage database to keep a history of inserts, updates and deletes. The example in the article includes how to store the user who makes the change, this is useful when trying to keep a trail of changes made to a table.

HTML5 page on RicRac site

Monday, December 6th, 2010

I have now published the first HTML 5 page on the RicRac web site. The page I amended to HTML 5 is the page on how to report software bugs and errors. This page now contains the following HTML 5 elements.

  • Header – Tag used to define an introduction to the document.
  • Nav – Tag for defining a navigation section of a document.
  • Article – Defines external content, this is content that could be independent from the rest of the document.  
  • Footer – Contains document information like the author, date it was written, copyright and contact information.

I hope that adding these tags will improve the search engine ranking of the page.

Delphi Array vs C# Array

Thursday, November 25th, 2010

I have a function I wrote in Delphi which I would like to use in a C# application, the problem I have is with the following bit of Delphi code which simply sets a constant array of chars.

QuotedStringChars = [#0..#255] – [‘”‘, #13, ‘\’];

Letters = [‘A’..’Z’, ‘a’..’z’];

I have spent some time trying to find out how this should be done in C#. I ideally do not want to set each element of the array, but if this is the case and then I think Delphi has another advantage over C#.

iPad Point of Sale

Thursday, October 21st, 2010

Currently the company I work for is developing an iPad application for point of sale. I have noticed various other companies developing such apps but how good is an iPad as a POS solution? I can see quite a few pros and cons. To read my full article click here.

Delphi fix for Windows 7 issue

Friday, October 15th, 2010

Recently had a problem with an application written in Delphi running on Windows 7. I noticed the problem when running a query which was returning an invalid timestamp error. The software worked fine on XP it was just on Windows 7. The regional settings for the date and time on the PC’s where correct and I could not understand why the problem was occuring. However the fix I found was to put the following bit of code in the project dpr.

SetThreadLocale(LOCALE_USER_DEFAULT);
GetFormatSettings;

This will require SysUtils to be added into the uses clause.

Changing Delphi SpeedButton Glyph

Thursday, October 14th, 2010

While developing I wanted to change the glyph on a TSpeedButton to another image. My first attempt was to has 2 different actions in an actionlist, then at run time I would change the action on the button depending on what was required. This did not work, the only solution I have found, which is not very elegant is to put 2 non visible buttons on the form each with a different glyph, then in code when I want to chanage the image I do the following:

VisibleBtn.Glyph.Assign(Image1Btn.Glyph);

This does the trick but it would have been nice if when changing the action of a button it does not just change the caption but also the related image.

Pivotal Tracker Project Management

Friday, October 8th, 2010

I recently started using a great web site called Pivotal Tracker which is a free agile project management site that lets you setup projects to manage. I’ve only just started using it with only some knowledge of agile project management and I am finding it very useful. At the moment I have setup various projects including web site projects for RicRac and BarMirror. I believe this tool will also be useful for software development allowing other users to access the project from anywhere in the world.

jQuery Innerfade

Thursday, September 16th, 2010

I have recently been working with jQuery (search google for jQuery it is the top result), which is a Javascript library that allows you to easily produce cool effects on your web site. I spent sometime playing around with the effects and found a cool plugin that does innerfade. You can see this on the BarMirror home page, what is cool about this is that it fades between images of wine which looks good, but also if you click on the bottle it takes you to the relevant review for that wine. I am continuing to look at what is possible with jQuery and have been happy with the results so far.

There’s no place like 127.0.0.1

Friday, July 30th, 2010

I have recently been working developing an application that accesses a third party web service. The application has been developed in Delphi 5 so there is no WSDL importer, to view the XML communication I use the Microsoft SOAP trace utility. I thought this would work great, I installed the utility on the server which was running Windows 2008 Server and set it up how I thought it should run. When I made requests to the web service it did not trace anything, after various conversions with the supplier of the web service we found that even though the default server for the trace to listen to is ‘Localhost’ Windows 2008 does not recognise this and you must always use ‘127.0.0.1’ instead of ‘Localhost’.

Delphi Internal Error L721

Thursday, June 17th, 2010

Recently I have been using Delphi 5 on Windows XP and now and again get the error ‘Internal Error L721’ when I try to compile my application. After looking on the net to try to resolve the issue, I thought it might be a lack of memory and there was insufficient memory to compile the application. I tried closing other programs down to release some memory but the problem still occured. I best solution I have found for the compiler error is to either restart Delphi, or do a complete rebuild of the project.

XCode now requires Snow Leopard

Wednesday, May 19th, 2010

I have a MacBook which is about 6 months old and have had XCode on the Mac for about the same time. I noticed that my iPhone requires development to be produced in a newer version of XCode, so I thought I would update to the latest version of XCode. Looking on Apple’s site they only do XCode now for Snow Leopard OS, this means I need to update my MacBook at a cost of $25. Is this another clever way Apple thought of getting money from their customers? After spending £1500 on a MacBook to find I need to spend more money 6 months later to update the OS it a bit annoying.

Firebird VS Advantage

Friday, March 12th, 2010

Over the past decade I have mainly been using 2 different Client-Server databases. Firebird is based on the Interbase server and is Free, and the other database I’ve used is Sybase Advantage. I have been thinking recently which one is better. I think with all software it is up to how you intend to use it and how it is intended to be used in the future. Firebird advantages are that it is free, easy to use and deploy and one really nice feature is you can make it client embedded so for smaller database applications you can ship it without having the user install the server. Sybase advantage seems to run quicker on large queries and more users, it is also possible to replicate Advantage. Firebird cannot be replicated although I know companies which have tried and the replication time can be over 40 minutes. Firebird does not seem as stable as Advantage, having to restart the server can become a regular task.

Overall I think if I had to choose between the two I would choose Firebird for smaller client-server applications with a small amount of traffic and Sysbase Advantage if I wanted something more stable and scalable.

I am sure there are other pros and cons of each database which I will continue to come across.