How to open a checking account at ING DIRECT?

ING DIRECT (Canada) was re-branded (renamed) as Tangerine as of Tuesday April 8th, 2014.

For instructions about how to open a checking account at Tangerine go to the following up-to-date article: How to open a checking account at Tangerine?

Tangerine kept most of the things from ING DIRECT. In their own words: “We’re changing our name, but we’ll never change who we are”. From the customer’s perspective, it was mainly about changes in the names of the services (products) provided and the organization itself.

Here is a summary of the name changes (old account names to the left and the new names to the right of the -> symbol):
  • THRiVE Checking Account -> Tangerine Checking Account.
  • Investment Savings Account (ISA)  -> Tangerine Savings Account.
  • unmortgage ->Tangerine Mortgage.
  • ING DIRECT Streetwise Portfolio ->Tangerine Investment Funds.
  • Streetwise Balanced Income Portfolio ->Tangerine Balanced Income Portfolio
  • Streetwise Balanced Portfolio ->Tangerine Balanced Portfolio.
  • Streetwise Balanced Growth Portfolio -> Tangerine Balanced Growth Portfolio.
  • Streetwise Equity Growth Portfolio -> Tangerine Equity Growth Portfolio.
The only real change I see as a customer, is the about the access to ATM machines. In the times of  ING DIRECT, THE EXCHANGE  Network was used for free. This will continue to be free until September 30th, 2014. After this date, you won’t be able to access ATM machines THE EXCHANGE  Network for free. This will impact some people I guess.

Instead you could use the Scotiabank ABM Network (containing nearly 4000 machines) and the Tangerine ABMs (which allow you to withdraw US dollars) for free.

Tangerine (formerly ING DIRECT) is a great banking alternative to the traditional ones (RBC, TD, Scotiabank…).

With Tangerine (formerly ING DIRECT), you don’t pay monthly fees, you get interest even on your checking account…You won’t be disappointed. My advice: switch to Tangerine. For details click the following link: How to open a checking account at Tangerine?

Enabling TLang to handle more than 17 translations: a workaround for a regression bug in Delphi XE3

I recently had to localize a FireMonkey application and for that I aimed to use the TLang component. With TLang you can define a collection of native strings to be localized and the corresponding translations to a particular language. To my surprise the component was allowing to store a maximum of 17 translations for the whole application. So, what about the other strings that need localization?

It seems there’s a regression issue from Delphi XE2 to Delphi XE3 that is preventing TLang to store more than 17 translations. You can even find an entry for this in Embarcadero Quality Central, for which no workaround or fix has been provided up to this date.

I found a programmatic workaround for this issue. Basically, the native strings and the translations could be loaded from text files in which each line will have the form:

NativeString1=Translation1
NativeString2=Translation2
NativeString3=Translation3
…………
NativeStringN=TranslationN

You will need one file containing the native strings and the translations per language. These files can contain as many lines as you which (certainly more than 17). In order to load those files into an existing TLang component you can use the function below:

procedure LoadTranslationsFromFile(aLangCode: string; aFileName: string; aLang: TLang);
var
  Translations: TStrings;
begin
  if (aLangCode <> '') and
     (FileExists(aFileName)) and
     (Assigned(aLang)) then
  begin
    Translations:= TStringList.Create;
    Translations.LoadFromFile(aFileName);
    aLang.Resources.AddObject(aLangCode, Translations);
  end;
end;


For an example of how to use such function see below:

procedure TForm1.Button1Click(Sender: TObject);
begin
  LoadTranslationsFromFile('ES', 'C:\Temp\Lang_Test_ES.txt', Lang1);
  LoadTranslationsFromFile('EN', 'C:\Temp\Lang_Test_EN.txt', Lang1);
end;


Hopefully this bug will be fixed in the near future; but meanwhile you can use this workaround to handle more than 17 translations with the TLang component.

Refactoring to patterns. Yet another TDD example coded in Delphi

Long overdue here is my second article about Test Driven Development (TDD) in Delphi. This is a continuation of TDD in Delphi: The Basics, another post that I wrote a few months earlier. 

I would like to focus in a particular step within the TDD cycle: refactoring the code. Refactoring means optimizing, cleaning, shortening, beautifying, styling (put your own word here) the code without breaking the functionality; that is, without breaking your unit tests.
 
By having unit tests in place before refactoring, you guarantee that the changes to the code are safe. Refactoring can introduce bugs. To avoid those bugs you need your unit tests in place.

Refactoring can introduce something else: refactoring can introduce design patterns into your code. That means you don’t have to introduce the design patterns up-front, since your code can evolve from a “very rustic implementation” to a “pattern oriented implementation”. This is referred as “refactoring to patterns”. If you are interested on the topic, I advise you to read Refactoring To Patterns by Joshua Kerievsky.

I’ll take the chess game as the base to my example. For simplicity, I’ll just refer to a couple of pieces: the knight and the bishop. In this example, I will just focus in refactoring some code with unit tests already in place. A detailed walk-through for the TDD cycle can be found in my previous article, which is also based on the chess game.  
  
The code is easy enough to be self-explanatory: basically, there is a class hierarchy in which TPiece is the base class from which TKnight and TBishop derive. Take a quick look:

unit ChessGame;

interface

type

 TPiece = class
 private
   FX,
   FY: Byte;
 public
   constructor Create(aX, aY: Integer);
   function IsWithinBoard(aX, aY: Integer): Boolean;
 end;

 TBishop = class (TPiece)
 public
   function CanMoveTo(aX, aY: Byte): Boolean;
   function isValidMove(aX, aY: Byte): Boolean;
 end;

 TKnight = class(TPiece)
  public
    function CanMoveTo(aX, aY: Byte): Boolean;
    function isValidMove(aX, aY: Byte): Boolean;
 end;


implementation

{ TPiece }

constructor TPiece.Create(aX, aY: Integer);
begin
  inherited Create;
  // TODO: check that this assignment is valid.
  // Not now, ok? :-)
  FX:= aX;
  FY:= aY;
end;

function TPiece.IsWithinBoard(aX, aY: Integer): Boolean;
begin
  Result:= (aX > 0) and
           (aX < 9) and
           (aY > 0) and
           (aY < 9);
end;

{ TKnight }

function TKnight.isValidMove(aX, aY: Byte): Boolean;
var
  x_diff,
  y_diff: Integer;
begin
  x_diff:= abs(aX - FX) ;
  y_diff:= abs(aY - FY) ;

  Result:= ((x_diff = 2) and (y_diff = 1))
                         or
           ((y_diff = 2) and (x_diff = 1));
end;

function TKnight.CanMoveTo(aX, aY: Byte): Boolean;
begin
  Result:= IsWithinBoard(aX, aY) and
           IsValidMove(aX, aY);
end;

{ TBishop }

function TBishop.isValidMove(aX, aY: Byte): Boolean;
begin
  Result:= abs(aX - FX) = abs(aY - FY);
end;

function TBishop.CanMoveTo(aX, aY: Byte): Boolean;
begin
  Result:= IsWithinBoard(aX, aY) and
           IsValidMove(aX, aY);
end;

end. 



/////////////////////////////////////////////

 
unit TestChessGame;

interface

uses
  TestFramework, ChessGame;

type
  // Test methods for class TPiece
  TestTPiece = class(TTestCase)
  strict private
    FPiece: TPiece;
  public
    procedure SetUp; override;
    procedure TearDown; override;
  published
    procedure TestIsWithinBoard;
  end;

  // Test methods for class TBishop
  TestTBishop = class(TTestCase)
  strict private
    FBishop: TBishop;
  public
    procedure SetUp; override;
    procedure TearDown; override;
  published
    procedure TestCanMoveTo;
    procedure TestisValidMove;
  end;

  // Test methods for class TKnight
  TestTKnight = class(TTestCase)
  strict private
    FKnight: TKnight;
  public
    procedure SetUp; override;
    procedure TearDown; override;
  published
    procedure TestCanMoveTo;
    procedure TestisValidMove;
  end;

implementation

procedure TestTPiece.SetUp;
begin
  FPiece := TPiece.Create(4, 4);
end;

procedure TestTPiece.TearDown;
begin
  FPiece.Free;
  FPiece := nil;
end;

procedure TestTPiece.TestIsWithinBoard;
begin
  //Test trivial (normal) workflow
  Check(FPiece.IsWithinBoard(4, 4));

  //Tests boundaries
  Check(FPiece.IsWithinBoard(1, 1));
  Check(FPiece.IsWithinBoard(1, 8));
  Check(FPiece.IsWithinBoard(8, 1));
  Check(FPiece.IsWithinBoard(8, 8));

  //Test beyond the boundaries
  CheckFalse(FPiece.IsWithinBoard(3, 15));
  CheckFalse(FPiece.IsWithinBoard(3, -15));
  CheckFalse(FPiece.IsWithinBoard(15, 3));
  CheckFalse(FPiece.IsWithinBoard(15, 15));
  CheckFalse(FPiece.IsWithinBoard(15, -15));
  CheckFalse(FPiece.IsWithinBoard(-15, 3));
  CheckFalse(FPiece.IsWithinBoard(-15, 15));
  CheckFalse(FPiece.IsWithinBoard(-15, -15));
end;

procedure TestTBishop.SetUp;
begin
  FBishop := TBishop.Create(4, 4);
end;

procedure TestTBishop.TearDown;
begin
  FBishop.Free;
  FBishop := nil;
end;

procedure TestTBishop.TestCanMoveTo;
begin
  // Hey developer, indulge me here: believe
  // that I fully wrote the code for this
  // test already before writing anything else.
end;

procedure TestTBishop.TestisValidMove;
begin
  // Hey developer, indulge me here: believe
  // that I fully wrote the code for this
  // test already before writing anything else.
end;

procedure TestTKnight.SetUp;
begin
  FKnight := TKnight.Create(4, 4);
end;

procedure TestTKnight.TearDown;
begin
  FKnight.Free;
  FKnight := nil;
end;

procedure TestTKnight.TestCanMoveTo;
begin
  // Hey developer, indulge me here: believe
  // that I fully wrote the code for this
  // test already before writing anything else.
end;

procedure TestTKnight.TestisValidMove;
begin
  // Hey developer, indulge me here: believe
  // that I fully wrote the code for this
  // test already before writing anything else.
end;

initialization
  // Register any test cases with the test runner
  RegisterTest(TestTPiece.Suite);
  RegisterTest(TestTBishop.Suite);
  RegisterTest(TestTKnight.Suite);
end.


Note that the method CanMoveTo is duplicated in both TKnight  and TBishop; that’s not nice isn’t it? In order to fix this, we can pull-up the CanMoveTo method to the TPiece base class. Note this now: the CanMoveTo has now become a “template method”; because is a general algorithm applicable to all kind of chess pieces (TKnight ,TBishop, etc) .

This general algorithm has deferred some steps to be implemented in the subclasses; I mean, the isValidMove method is still coded in the subclasses. Isn’t this a beauty?  You have now refactored your code and when doing so, you have introduced the Template Method Design Pattern.

What’s even best, (don’t forget this because it is a key part): is that we can guarantee that our fancy refactoring didn’t break our pre-existing functionality. Why? Because we had unit tests in place written a long time ago. Writing unit test from the beginning gives a huge peace of mind to the developer :-) See the new refactored code below:

unit ChessGameRefactored;

interface

type

 TPiece = class
 private
   FX,
   FY: Byte;
 public
   constructor Create(aX, aY: Integer);
   function IsWithinBoard(aX, aY: Integer): Boolean;

   function CanMoveTo(aX, aY: Byte): Boolean;
   function isValidMove(aX, aY: Byte): Boolean; virtual; abstract;
 end;

 TBishop = class (TPiece)
 public
   function isValidMove(aX, aY: Byte): Boolean; override;
 end;

 TKnight = class(TPiece)
  public
    function isValidMove(aX, aY: Byte): Boolean; override;
 end;


implementation

{ TPiece }

constructor TPiece.Create(aX, aY: Integer);
begin
  inherited Create;
  // TODO: check that this assignment is valid.
  // Not now, ok? :-)
  FX:= aX;
  FY:= aY;
end;

function TPiece.IsWithinBoard(aX, aY: Integer): Boolean;
begin
  Result:= (aX > 0) and
           (aX < 9) and
           (aY > 0) and
           (aY < 9);
end;

function TPiece.CanMoveTo(aX, aY: Byte): Boolean;
begin
  Result:= IsWithinBoard(aX, aY) and
           IsValidMove(aX, aY);
end;

{ TKnight }

function TKnight.isValidMove(aX, aY: Byte): Boolean;
var
  x_diff,
  y_diff: Integer;
begin
  x_diff:= abs(aX - FX) ;
  y_diff:= abs(aY - FY) ;

  Result:= ((x_diff = 2) and (y_diff = 1))
                         or
           ((y_diff = 2) and (x_diff = 1));
end;

{ TBishop }

function TBishop.isValidMove(aX, aY: Byte): Boolean;
begin
  Result:= abs(aX - FX) = abs(aY - FY);
end;

end.

Conclusion, in addition to all the cool things of TDD there’s the possibility of refining your design not up-front, but when refactoring your code. Design patterns can be introduced at any time and we know that such introduction, if late, is not going to break our logic, because we have unit tests in place to prevent that from happening.

Some related reading below:

Check your Brick Platinum Card balance online

Note from the blog owner: This article might be outdated. I no longer have a Brick Platinum Card and I don’t know if what’s written in this article is still applicable today.

If you want to check your Brick Platinum Card balance over the Internet, the first thing you need to do is to register with the HSBC Online Customer Care.  For that just click here: Enrollment form

You will be redirected to a registration form in which you will have to type in some information like: 
  • Account Number: The Brick Card number preceded with a zero to the left. For instance, if your Brick Card number is 0000 1234 5678 999, then you should type 0000 0123 4567 8999.
  • Date of Birth: The Brick Platinum cardholder’s date of birth.
  • Postal Code: The Brick Platinum cardholder’s postal code
  • Loing ID and Password: A login and password for accessing the Online Customer Care.
  • Two security questions: Just in case you forget your credentials in the future (login ID and password)
  • Email Address: The Brick Platinum cardholder’s email address.
  • Statement Delivery Preference: Whether you prefer to receive paper statements over regular mail or electronic statements over email. I particularly prefer the electronic statements.
  • Email Alerts: Check this out if you want to receive email alerts when a payment has been received, when your payment is past due and when a new statement becomes available.
Finally, just click the Submit button at the end of the form. With that you'll have completed the registration process. Shortly after, you will receive an email from HSBC Retail Services welcoming you to the Online Customer Care.

If you want to check your Brick Platinum Card balance just login with your Login ID and Password in the Online Customer Care web portal.

Important: you cannot make online payments from within the Online Customer Care portal. You can only review your statements and balance. If you want to make online contributions to your Brick Platinum Card refer to the following article:

Make payments to your Brick Platinum Card from the RBC Online Banking

Note from the blog owner: This article might be outdated. I no longer have a Brick Platinum Card and I don’t know if what’s written in this article is still applicable today.

If you financed some new furniture at The Brick by getting a Brick Platinum Card, then you can arrange your payments thought the RBC online banking.  I prefer to do the contributions from the comfort of my home as opposed to physically paying at the store.  

Your Brick Platinum Card should look like this:

Brick Platinum Card - The Brick
This is a comprehensive step by step guideline that will allow you to contribute to your Brick Platinum Card balance from the RBC Online Baking:
  1. Sign-in to RBC online baking. Once you sign-in, you’ll see the Accounts Summary page.
  2. Find and click the Pay Bills & Transfer Funds link. You will be redirected to the Pay Bills & Transfer Funds page.
  3. Find and click the Add Payee link. You will be redirected to the Add Payee page.
  4. In the Payee name text box type HSBC RETAIL SERVICES and click the Search button. You will be redirected to a page containing a list of possible payee matches.  Select the radio button labeled HSBC RETAIL SERVICES and click the Continue button. You will be redirected to the Payee Information page.
  5. Type in your Brick Platinum Card number in the edit box. When doing so, add a leading zero to the 15 digit card number.   For example, if your Brick Card number is 0000 1234 5678 999, then you should type 0000 0123 4567 8999. Once you do this, click the Continue button. You will be redirected to the Add Payee Confirmation page. 
  6. Click the Confirm button. You will be redirected to the Add Payee Completed page. At this point you have successfully added your Brick Platinum Card to your list of payees.
  7. To make a payment go to the Accounts Summary page and use the Quick Payments & Transfers dialog. It’s as easy as specifying the source from which you want to take your funds (checking account, saving account, etc.), selecting Brick Platinum HSBC as the receiver of the payment and entering the amount of money that you would like to transfer.
The online transfer should be done 7 days in advance to the payment due date to guarantee it comes in time for processing.

That’s all folks :-) If you find this tutorial helpful, would you mind sharing it by clicking the Google Plus (G+) button at the beginning of this post? Thanks!