How to open a checking account at ING DIRECT

Everything at ING DIRECT is done online… opening a checking account is no different: you can do it in 10 minutes (at the most) from the comfort of your home computer while you are in your pyjamas. What I have found so far about ING DIRECT is that all procedures can be done with an extreme simplicity and from the comfort of your home.

ING DIRECT calls its checking account: THRiVE Chequing Account. Why THRiVE? I guess because this THRiVE Chequing allows your money to thrive, to develop, to grow…

Most checking accounts in Canadian banking institutions charge you a monthly fee. This is ridiculous if you ask me: banks are profiting from our own money, but that’s not enough for them: they still charge us a monthly fee for having our own money within their grasp, money from which they are profiting already.

This is what THRiVE Chequing at ING DIRECT has to offer:
  • NO MONTHLY FEES. Ask yourself if your current bank charges you a monthly fee and ask yourself if you should be paying for it?
  • Unlimited transitions: once again, you can perform unlimited transitions at ING DIRECT for free.
  • Earn interest on the money you put on your THRiVE Chequing Account (yes, you heard well: this is a checking account that pays interest, just as saving accounts do).
I am not going to load you with more details…if you want to know more about the benefits of opening a THRiVE Chequing Account with ING DIRECT come here: http://www.ingdirect.ca/en/chequing/

Now, in order to open a THRiVE Chequing Account with ING DIRECT you have to do only TWO things:
  1. Complete an online form that won’t take you more than 10 minutes. I am not exaggerating: this form won’t take you more than 10 minutes to fill. In order to fill the form click here: Open new THRiVE Chequing Account at ING DIRECT.
  2. Write your initial deposit cheque (payable to yourself) for at least $100, and mail it to ING DIRECT, 111 Gordon Baker Road, Toronto, Ontario, M2H 3R1. Note: all new clients of ING DIRECT opening accounts for at least $100 box get a $50 bonus. What does this means? It means that you open your account with $100, but you are credited with $150; so ING DIRECT welcomes you with $50 box.
That’s all: by completing the two steps above you will open a THRiVE Chequing Account at ING DIRECT, that will treat you with unlimited transactions, no monthly fees, fair saving interests and a $50 box welcome gift.

If you have any questions, drop a line in the comments section below. I’ll do my best to answer.

If you think this post might be useful to someone else, don’t hesitate in recommending by clicking the Google Plus (G+) button at the beginning of the post. Thanks!

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:

What types of mobile phones are used in Cuba?

All mobile phones in Cuba are linked together by a GSM cellular network, operating in the 900MHz band throughout the island.

The 850MHz band is also operational in selected locations, namely: Havana City, Varadero, Cayo Coco and Cayo Guillermo.

If you were to buy a cell phone for a person living in Cuba: I would recommend acquiring an unlocked quad-band phone (GPRS compatible).

It is important for the cellular phone to be unlocked; otherwise it won’t work with the Cuban mobile operator: Cubacell. Of course, a locked phone could be unlocked, but why to bother? You can buy a brand new unlocked phone and you will save the money and the time for unlocking it after.

Quad -band phones operate in the four major GSM bands: 850, 900, 1800 y 1900 MHz. With this kind of phone you will be able to get mobile coverage in the whole island. Technically speaking you don’t need the 1800 and 1900 MHz bands in Cuba, but it does not hurt to have them as well.

One final tip: the MMS service is available in Cuba. Most people don’t know this. This service allows you to send multimedia messages containing text, images, audio y video to a Cuban cell phone. Now, in order to use this service, your cell should support GPRS technology. Note that not all GSM mobile phones support GPRS technology. It depends on the model, brand and year of production.

The MMS service is not activated by default. In order to use it, you should activate the service following these steps (in Spanish).

I have listed below a selection of phones that you can buy trough Amazon. All these phones are unlocked, quad –band (GSM) and GPRS compatible. These phones will work in Cuba. Amazon is a trustable online retailer, probably the largest and better known in the world. So buying through Amazon is safe and painless.

Motorola (More cells from Motorola...)



Sony Ericsson (More cells from Sony Ericsson...)



Nokia More cells from Nokia...



If you cannot find the cell phone you are looking for in the list above, then you might try the search box just below: 


Since you are reading this article you might be interested in knowing how to recharge the cell phone of a person living in Cuba over the internet. Check it out!

Make payments to your Brick Platinum Card from TD EasyWeb

You can use TD EasyWeb, the online banking system of TD Canada Trust, in order to make payments or contributions to your Brick Platinum card. For that, you need to add your Brick Platinum Card as a new payee in your EasyWeb account. 

A Brick Platinum Card looks like this:

Brick Platinum Card - The Brick
Follow the steps below in order to make online contributions to your Brick Platinum Card from TD EasyWeb:
  1. Login to TD Easy Web and you will land in the View Accounts page.
  2. Find and click the Payments & Transfers link. You will see now the Payments and Transfers page.
  3. Find and click the Add a New Payee button.  In the new page, type in HSBC RETAIL SERVICES in the Enter Payee Name text box and click the Search button.
  4. In the new page, write down your Brick Platinum Card number within the Payee Account text 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. After this click, the Next>> button.
  5. In the next page click the Finish button.
  6. Now you can click the Pay this Payee button in order to make a contribution to the Brick Platinum card right away.
The online payment should be sent 7 days prior to the payment due date to make sure it arrives in time for processing.

This is all for this tutorial. You could also accomplish the same from within the RBC online banking. For details take a look at: Make payments to your Brick Platinum Card from the RBC Online Banking.

If you think this info is useful, then share it with your fiends in Google Plus (G+). For that just click the Google Plus (G+) button close to the title of this post.

Check your Brick Platinum Card balance online

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 articles:

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

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.

If you bank with TD Canada Trust you might want to check this out: Make payments to your Brick Platinum Card from TD EasyWeb.
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!