November 28, 2011

Put your credit card to work for you – a novel way to generate revenue

Filed under: Small Business — Tags: , — Darrin Maidlow @ 5:04 pm

I’m a huge fan of my    It’s one of those random things that get me excited.   Every year I deposit a significant amount of money into my retirement savings (RRSP) thanks to my credit card.  I thought I would share this technique with you.  These principles should work with any card that gives points that you can redeem for gift certificates or cash back, though this post focuses on the RBC Avion.   With you can get gift certificates for RRSPs, RESPs, or put towards loans or mortgages.

I’m in no way endorsing any particular bank or program here.  RBC’s Avion visa is the program I’m familiar with and I’ve been using for the past six years.  Please feel free to leave a comment describing your experiences with other banks and rewards programs.

Interest kills the entire thing

The very first thing you need to know is that you can NOT carry a balance on your card.  Ever.  These “premium” cards that give points always have a very high interest rate – 19% and up.  Carrying even a tiny balance will eat any potential benefits in no time.  Though I never encourage spending more than you can afford, if one month you over extend yourself, paying off your balance with a lower interest credit  might be your best option.  It’s important to note that if used properly, a credit card is a free loan.  Depending on the timing of your purchase(s) you can get up to a 45 day, interest free loan.  

Use Your Visa for EVERYTHING

The next key step to this process is to use your Visa card for EVERYTHING.  Even if you have cash in your wallet get used to using your Visa exclusively.  Save your cash to pay off your next Visa statement!  Setup as many of your automatic monthly expenses as possible to automatically deduct from your Visa:

  • Cell Phone
  • Home Phone
  • Satellite / Cable TV
  • Internet
  • etc.

This also has the added benefit of making bills a little easier to pay each month as instead of having to pay them individually.   There are several other benefits to this including no debit card fees, better exchange rates than cash when travelling abroad, and you also get all the various benefits of the premium card like insurance and what not.  Sadly my power and gas companies refuse to accept Visa so I have to waste time each month to manually transfer money to each one of these accounts.  (Come on Epcor and Altagas.  Get with the times).

Big ticket items rack up the points quickly.  If you’re planning on buying a new TV or other large items– put it on the card.  We renovated our new home this year and I managed to get 75% of the expenses on my visa.  This significantly increased the points earned for the year.   A lot of times car dealerships will let you make a down payment on a new vehicle using your Visa.  It is unlikely they will let you buy the entire vehicle using your card, as there are costs to vendors when accepting credit cards.  

Let’s consider the new car scenario.  Assume for a minute you have negotiated a price of $10K for a new vehicle.  You have $10K in cash in the bank to pay for your new vehicle.   The dealership will allow you to pay for up to $5000 of your new vehicle using your credit card.   Instead of giving the dealership $10K in cash, you make one payment of $5000 with your Visa, and one payment of $5000 with your cash.  At the end of the month you use the other $5000 to pay off your credit card.  So at this point you’ve spend the same amount of money BUT you gained 5000 points.

Using a credit card this was does take some personal responsibility and care.  Spending on credit as opposed to spending cash can result in EASILY over spending.  Be mindful of this if you’re new to credit cards.   Learn your payment due dates and set calendar reminders for the day before as well as the week before to make sure you pay it on time!

Leverage your business

Companies spend a lot of money.  Especially technology companies!  Software, hardware, books, meals, travel etc – it all adds up.  Ask your bank if you can setup a corporate business card and have the points transfer into your personal card.  RBC let me setup a company Avion card and each month the points are transferred.  I run my business almost exclusively using this card.  With the exception of payroll and the odd strange expense that requires checks – 99% of my company spending happens through my corporate card.  This also makes my accounting significantly simpler and saves me money on bookkeeping and accounting come year end.

Profit from your employer

Years ago when I worked for a company where I was the head of IT in addition to being a software developer.  My boss was really cool back in the day when it came to expenses for the company.  He would let me make purchases (including very significant ones) for the company using my personal card and expense them back to the company.  Not only did this help me build up points – but it also helped me build up a great credit rating.  When I moved on to start my own business I had a personal credit card with a huge limit (tens of thousands) that I paid off every month.  This really helped my personal credit at a critical time in my life.

So if you can spend on behalf of your employer and be reimbursed each month go for it.  Free points == free money!

45 day interest free loan

What the heck I’ll share this little tidbit too.  Find your credit card cutoff date.  This is the date that charges for the current month are stopped and will start to count against the next month.  For example, both my cards (personal and corporate) are synchronized.  The cutoff is the 10th of each month.  So any charges made up to and including the 10th will need to be paid on the 27th of that month.  Anything charged on the 11th or later will need to be paid on the 27th of the following month.  This is significant.  There are not many other ways to get a 45 day interest free loan.

Redeem early.  Redeem often!

This is especially important for rewards going into investment accounts or that go towards paying down mortgages.  I used to wait until the end of the year to cash out my points and do one large deposit into my investment account.  I realized that this was silly.  Now I strive for quarterly deposits.  This lets me try and capitalize on market downturns – buying low!  Also if you’re going for other rewards like mortgage payments – why pay the extra interest with a single deposit?  Instead of depositing say 1000$ once a year, do 250$ quarterly.  This decreases the principle of your loan and in turn the interest paid.

With the it costs 3000 points to redeem 25$ worth of credit.  There is a minimum purchase requirement of 12000 points  which results in a 100$ gift cert.  After that the amount increases in 3000 point increments.  Redeem 60K points, get 500$ gift certificate.

One last benefit to an RRSP contribution is that in addition to the 25$ going into your account – you SHOULD get a ~5$ tax refund on that amount at the end of the year.  This makes the 3000 points actually worth a little bit more.  The same can be said about paying down mortgage principle – you should save money in interest.

Nifty huh? 

So by changing the way you spend money you already spend in life you can gain a number of benefits – free 45 day loans, save money on accounting, save time paying bills and finally – free money!  I’d love to hear about other creative ways to use your credit card to earn reward points.  I’d also love to hear about other banks and credit card programs.  Please feel free to contact me by e-mail, Google+ or leave a comment here!

Technorati Tags: ,,,

November 8, 2011

OracleCommand and parameterized update statements

Filed under: Development,Oracle,RADE — Tags: , , , , — Darrin Maidlow @ 4:07 pm

This week I encountered an irritating situation with Oracle while working on code in the application logic.  In a nutshell I am building dynamically created parameterized insert and update statements based on the RADE metadata and the values entered by the user.  The first call InsertNewRecord works perfectly.  The next call UpdateExistingRecord however was not.  The parameterized SQL was being created.  The parameters were being created and assigned to the .  The ExecuteNonQuery() call was executing without returning an error.  Oracle just would not update.   Even more frustrating – this “just worked” in SQL server.

What were the differences?

The basic logic for insert was this (parts omitted because you probably just don’t care):

  1. Get table metadata
  2. Loop through fields in table
  3. for each field retrieve the value from the UI
  4. Add field to parameterized SQL statement with placeholder
  5. Create new parameter with appropriate name and value.   Add parameter to collection
  6. Loop through parameters in the collection and add to the DbCommand
  7. Finally execute the parameterized SQL statement

As I mentioned this worked great.  Fields were inserted and there was much rejoicing.

The logic for an update was similar but there was one big difference:

  1. Get Table
  2. Loop through fields in table
  3. for each field retrieve the value from the UI
  4. If the field is a key add the placeholder to the where condition, otherwise add the field name and value to the update fields part of the SQL
  5. Create new parameter with appropriate name and value.  Add parameter to collection
  6. Loop through parameters in the collection and add to the DbCommand
  7. Finally execute the parameterized SQL statement.

The branch in step 4 and the if statement ended up causing the problem.

The Problem

defaults to “bind by order” – making the order in which the parameters exist in the SQL statement match the order in which the parameters are added to the OracleCommand. This was happening during the insert because of the structure of an insert statement being so linear. However in the update statement I was building the SQL in a more dynamic way. I was maintaining a list field=value conditions and a separate where condition. In the ended up merging them :

   1: String parameterizedSQL = "UPDATE " + table.Name + " SET " + updateStatement + " WHERE " + whereStatement;

So unless my key field( s) all lined up at the end of the table metadata definitions,  appending that where condition at the end my parameter order got all out of whack in the DbCommand.  So my where condition was actually being set to the wrong value – which could have resulted in the wrong records being updated. Nasty.   Fortunately this can be resolved.

The Fix – BindByName=true

To correct this I had to set the Oracle specific BindByName property to true.  (btw this being the default behavior is just silly.  All the other big data providers default to bind by name and Oracle should too.  That’s a rant for another day though.)   My initial solution was to check if the command is an OracleCommand and if found do a little casting to set the BindByName property then recast it back to DbCommand before executing the query.  Constructive feedback is always welcome!

   1: /// <summary>
   2: /// Execute the parameterized query
   3: /// </summary>
   4: /// <param name="conn">open and active DbConnection</param>
   5: /// <param name="trans">Active DbTransaction</param>
   6: /// <param name="parameterizedSQL">the parameterized SQL</param>
   7: /// <param name="paramList">List of OledDbParameter</param>
   8: /// <returns>DataTable containing the results</returns>
   9: public static void RunParameterizedInsertUpdate(DbConnection conn, DbTransaction trans, String parameterizedSQL, List<DbParameter> paramList)
  10: {
  11:     //create the db command and set the parameterized SQL as a property
  12:     DbCommand command = conn.CreateCommand();
  13:     if(trans != null)
  14:     {
  15:         command.Transaction = trans;
  16:     }
  17:     //hack attack!  By default, Oracle requires its parameters to be placed into the command
  18:     //in the order the parameters appear in the parameterized SQL.  Little hackery here
  19:     //to set the Oracle Command to bind by name
  20:     if (command is Oracle.DataAccess.Client.OracleCommand)
  21:     {
  22:         OracleCommand oraCmd = (OracleCommand) command;
  23:         oraCmd.BindByName = true;
  24:         command = oraCmd;
  25:     }
  26:     command.CommandText = parameterizedSQL;
  27:     command.CommandType = CommandType.Text;
  28:  
  29:     //loop through the params and add them to the command
  30:     foreach (DbParameter parameter in paramList)
  31:     {
  32:         command.Parameters.Add(parameter);
  33:     }
  34:     try
  35:     {
  36:         command.Prepare();
  37:         command.ExecuteNonQuery();
  38:     }
  39:     catch (Exception ex)
  40:     {
  41:         command.Dispose();
  42:         throw;
  43:     }
  44: }

November 4, 2011

Introducing Question of the Week for ObjectARX.NET and Mapguide

Filed under: AutoCAD,Development,Mapguide — Tags: , , , — Darrin Maidlow @ 11:32 pm

Every good developer is constantly evolving and learning new technologies.  This can be a challenge when you’re hard at work in maintenance mode on familiar technology or when your every day needs don’t go as deeply into topics as you would like. 

If you take a step back and look at AutoCAD and – its a huge body of work and it is a challenge to get experience in all the various parts of it.  The recent request I received on how to or the command line and the subsequent research, code and blog post I wrote made me think,  what if I solicited small problems from the AutoCAD community that could make fun little 4 hour research projects.  These would allow me to dig into various portions of ObjectARX.NET once a week, write some fun code, and give me things to write about.  Everybody wins!

I’m looking to spend about 4-6 hours on each question.  I’m hoping to do one question per week, assuming I get enough requests.  I’ll provide the full source and project with each post.  All code will be written in c#.  Some examples of valid requests would be:

  • Submit a Visual Lisp routine to convert to ObjectARX.NET.
  • Request a particular routine that does some sort of drawing clean up or modifies something.
  • Identify some functionality that is missing in AutoCAD.
  • Request a piece of sample code explaining how to use API x of ObjectARX.NET or Mapguide Enterprise/Open Source.

The Do’s

  • Please keep your request realistic.   I’ve only got 4 to 6 hours and you’re not paying me =)
  • Please submit specific functionality along with sample data.
  • Please be available to answer any questions  I might have via e-mail, phone/skype or possibly gotomeeting.
  • Please keep the underlying technology somewhat current.  Don’ t request AutoCAD/Mapguide 2007.
  • Please review my code and comment if you see something wrong or that I could do more efficiently.  This is about me learning and I’m gonna make mistakes.

The Don’ts

  • Don’t expect days worth of work, I just don’t have that much spare time.
  • Don’t ask me to work on your project (unless of course you want to hire my team via ).
  • Please don’t get upset if I don’t pick your question.
  • I did my ten odd years in the trenches writing Visual Lisp – I don’t really want to write any more, so please don’t ask for lisp code.
  • Don’t be a ass.  I don’t have time for asses.

Let’s See What Happens

So I have no idea how this will play out.  I don’t know if 4-6 hours is a reasonable amount of time to allocate each week to do this right.   I don’t know if I will be able to make the time every week.  Maybe I’ll change it from “Question of the Week” to “Question of the Every Second Week”.  I’m going to put this out there and see what happens.   I reserve the right to change anything and everything! s  E-mail your requests to contact ~@~ geospecialling dot com.

November 2, 2011

Remotesoft Protector Runtime Error – yet to handle multiple .NET framework runtime

Filed under: Development — Tags: , , — Darrin Maidlow @ 9:07 pm

Remotesoft protector is one of the out there.  In fact, its pretty much the only one that really works.  Since I moved to .NET 4.0 I’ve been getting an annoying error when attempting to protect my binaries using the 4.0 suite of tools (with the ).  Everything still runs – it just pops up nasty alert boxes on load which is no good :)

Remotesoft Protector Runtime Error – yet to handle multiple .NET framework runtime

One other symptom of this was that .exe files would just blow chunks.  I’ve finally figured out what was causing this!  Most of our products are protected during the nightly builds.  This error however is specific to assemblies protected using the the Remotesoft .NET Explorer UI.  When using this application for the protect or obfuscate functionality it is really just a front end around the protector.exe/obfuscator.exe.  The UI is building the following command line string and tonight it finally dawned on me:Remotesoft .NET Explorer

Command: C:\Program Files (x86)\Remotesoft\Protector\bin\protector.exe -neutral -resource -string -cctor -clrversion v2.0.50727 "C:\temp\SmartInk for Kahua\SmartInk.UI.exe"

The UI was forcing the clr version to .NET 2.0 – when my assemblies are all built against .NET 4.0.  Oops…

After a bit of digging I found that you can set the CLR version in .NET Explorer from the Action / CLR Version menu item.  Unfortunately it has not been updated to support .NET 4.0 – and so has been rendered pretty much useless as a front end for protector.

The Fix

The only solution is to use the command line to execute your protection.   The updated command line ended up looking pretty similar:

"C:\Program Files (x86)\Remotesoft\Protector\bin\protector.exe" -neutral -resource -string  -clrversion v4.0.30319 "C:\temp\SmartInk for Kahua\SmartInk.UI.exe"

There you have it – I can’t believe I missed that…

Powered by WordPress

Switch to our mobile site