Scott Hanselman

WPF Sample in IronRuby talking via C# to Wesabe

July 23, '07 Comments [12] Posted in eFinance | Programming | Ruby | Web Services | XML | XmlSerializer
Sponsored By

wesabeironrubymoney John Lam and team have released their first drop the IronRubySource code. It's super-pre-alpha so don't hate, but it's looking pretty sweet, if you're a burgeoning Ruby-head like myself. There's incomplete support for some of the cooler Ruby syntax things, but I have full confidence that it's only going to get better. All the underpinnings are there.

John also announce that the team will host IronRuby source on Rubyforge (which is quite the coup, actually) and that they'll be taking external contributions very soon (this being the open part of open source.) 

Not every sample (initially) will look and feel and smell good like Ruby, and this one is no exception. You might remember that last week I did a quicky Wesabe client in C# and put it up on Google Code. We've got four folks up there improving the code, which is cool.

Today, Shady the intern and I decided to do a sample in IronRuby that would call the C# Wesabe client API and display some account data via WPF. This is part of my new plan to take over Money and Quicken's business and you can tell from the hours of intense UI design that Shady and I did, that my plan is inevitable.

We started from ScottGu's HelloWorld sample, and slogged creatively coded our way forward. Here's how it went.

imageFirst, get the IronRuby source and upzip. Open on Visual Studio 2005 command prompt and compile the DLR and IronRuby by running build.cmd.

All the interesting stuff will show up in bin/release, including the IronRuby equivalent of IRB, the interactive Ruby Interpreter.  You can run this from the command line and try things out interactively if you like.

We used Notepad2 with Ruby Support for our editor, although I'm deeply digging "e" the TextMate for Windows and will likely move over to it for my text editor of choice when I start at Microsoft in September.

Next, we tried to add a require statement to bring in the Wesabe library. You run a IronRuby app (today, in this build) by running rbx.exe YourApp.rb. We put our .rb text file in one folder and had rbx.exe in another, so when we added our wesabelib.dll we had to add it to the same folder that rbx.exe was in, otherwise the Assembly load would fail. You can also put things in the GAC and get to them there. Just remember that Fusion will load from the same folder rbx.exe is in, not the folder that your program is in.

For debugging, we used the classic "got here" debugging of old, via the standard MessageBox, so we added a requre for Windows Forms also and a constant as a alias for the MessageBox class:

require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
require 'wesabelib, Version=1.0.0.0'
MessageBox = System::Windows::Forms::MessageBox

As this build is a pre-Alpha, likely created in the dark of the night just hours ago, there's all sorts of weirdness and stuff that didn't "just work."

The naming integration with .NET is persnickety at best. The C# Wesabe client had a lowercase class called "wesaberest" that IronRuby just couldn't see, so I changed it to uppercase and aliased it with a constant.

#this build of IronRuby doesn't like Class Names that are lowercase,
# so I made mine Uppercase
Wesabe = Wesaberest

As I said, The Wesabe client API that we created is written in C#, and returns a array of Account objects. In the click event of a button, we pass in the username and password from our TextBox and PasswordBox respectively and store our Account object.

Our goal is to spin through the list of Account objects in the Array, but there's a few gotchas, again because of the pre-alphaness. First, we can't use for because in Ruby for is a sugar syntax on top of "each" that assumes an each method exists. Each isn't implemented yet, but the plan is to have for syntax just work over IEnumerable things.

Second, we can't index into arrays because the [] operator isn't implemented yet, but we can call GetValue(), which is the same thing.

#in the future we'll be able to index into CLR arrays...
#oneAccount = myAccounts[i]
oneAccount = myAccounts.GetValue(i)

Thirdly, in IronRuby there's FixNum, which is a DLR extension of Integer and there's MutableStrings, that have private StringBuilder. A lot of this will be hidden in the future, but in this build I had to be aware of some of the impedance mismatches as I tried to coerce my numbers into strings for output.

For example, none of these worked, but I expect they will one day.

Lastly, currentBalance is a float (System.Single) and IronRuby wouldn't respect it's ToString method, so I changed the value to a System.Double and all was fine.

Here's some failed attempts at String Concatenation. Notice the "secret" call to to_clr_string. Those should all go away and the Ruby types should marshal cleanly in most cases. Note that I'm assuming a lot, and in some cases basing these assumptions on my chats with John, but also as educated guesses as to how it ought to work.

#Ruby string concatenation works fine...
my_message.content = "scott" + " hanselman"

#Attempt0
my_message.content = oneAccount.name + oneAccount.currentBalance.to_string("C").to_clr_string

#Attempt1
my_message.content = oneAccount.name + "$" + oneAccount.currentBalance.to_s.to_clr_string

#Attempt2
my_message.content = System::String.Concat("$" + oneAccount.currentBalance.to_s.to_clr_string)

#Attempt3
#There's a name conflict when trying to use the StringBuilder:
# System.MemberAccessException: uninitialized constant ScriptModule::Text
s = System::Text::StringBuilder.new
s.Append(oneAccount.name)
s.Append("$")
s.Append(oneAccount.currentBalance.to_s.to_clr_string)
my_message.content = s.to_string

At this point, I just added a new property called "DisplayString" in the Wesabe Account class and moved on. As for the loop we used a while. It's not clean, but it's clean enough:

my_button.click do |sender, args|
   a = Wesabe.getAccounts(text_user.text,text_password.password)
   myAccounts = a.Items
   i = 0
   accounts_listbox.items.clear
   while (i < a.Items.Length)
      oneAccount = myAccounts.GetValue(i) #GetValue is on System.Array

      i+=1 #needed for the while
      
      # Create new label
      my_message = Label.new
      my_message.font_size = 36
      my_message.content = oneAccount.DisplayString

      #Add the Label to the ListBox
      accounts_listbox.items.add(my_message)
   end
end 

There's a couple of ways to make this even more clean, and those ways will come. I'll update this sample as the new features roll into IronRuby.

I think it'd be nice to add some charts and graphs, make the whole thing a ClickOnce app, etc. Probably, for now, it'll be easier in C#, but it was fun to hack it together in today's drop of IronRuby and the interns learned something.

You can get my source for this Ruby App, along with a custom build of the Wesabe client (with my changes) here. Remember to get the IronRuby source, compile it, then copy the Wesabe client to the bin\release folder (or move the .rb files into there along with the Wesabe dll). I've left all the comments in the source for fun.

Technorati Tags: , , , ,

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Wesabe makes Financial Data available programmatically

July 13, '07 Comments [20] Posted in eFinance | Programming
Sponsored By

imageWesabe has just done what I've been trying to convince banks to do for years. They're making financial data available via a simple POX (Plain Old XML) API. A year ago I did a POX API for Corillian products that Patrick and I presented at TechEd 2006, but it only for whatever single financial institutions chose to install it.

How does Wesabe do it? Your bank probably uses a funky SGML format (that I've talked about before; I was the OFX Vendor Committee Chair for a bit) called OFX that is not only obscure, but difficult and no fun.

Microsoft Money and Quicken, as well as some others, download OFX from your bank into their local storage. Unfortunately, neither Money nor Quicken makes the downloaded data available programmatically, which is one of the reasons I've stopped using both of them them.

You can upload your transaction details to Wesabe on your own, but you can also install their Account Uploader. It's Wesabe's small OFX Client of their own that runs in the background on your computer. It downloads OFX and uploads to their servers. Then they make the aggregated data available (as of today) via a POX (they say REST) XML API. Kind of like the quickie diagram at right (Thanks Paint.NET!)

So, over lunch I did a quick C# library (with my two high-school interns, Eric and Shady) to access their API. It's up here at Google Code if you want start expanding it. If anyone wants to take over, be a member, whatever, put your Google Code username in the comments and I'll add you. What I added just does the account download and is separated into a lib and a command line client.

I did add a couple of things like a check to make sure that when you talk to them via SSL that you are actually talking to them and not a man in the middle:

public class wesabe_rest
{
    static wesabe_rest()
    {
        ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
    }

    // The following method is invoked by the RemoteCertificateValidationDelegate.
    public static bool ValidateServerCertificate(
          object sender,
          X509Certificate certificate,
          X509Chain chain,
          SslPolicyErrors sslPolicyErrors)
    {
        if (sslPolicyErrors == SslPolicyErrors.None &&
            certificate.Subject == 
@"CN=www.wesabe.com, OU=Thawte SSL123 certificate,
OU=Go to https://www.thawte.com/repository/index.html,
OU=Domain Validated, O=www.wesabe.com"
) return true; Console.WriteLine("Certificate error: {0}", sslPolicyErrors); // Do not allow this client to communicate with unauthenticated servers. return false; }

I also did the XML work via XmlSerializer, because I'm still a fan. The Wesabe guys didn't include a schema, but I suggested it strongly. You can too over in the Wesabe API Developer's Group (Free Wesabe login needed, with no obligation to upload anything financial).

For those of you who commented on my post on Quicken and Money, I noticed that a lot of you use Excel and other tools to get at your data. The Wesabe API will let you get transaction data in 5 formats, one of which being XLS. For example:

This resource is also available in OFX, OFX2, QIF, CSV, and XLS formats:

GET /accounts/show/<account id>.ofx
GET /accounts/show/<account id>.ofx2
GET /accounts/show/<account id>.qif
GET /accounts/show/<account id>.csv
GET /accounts/show/<account id>.xls

By changing the extension you get a different file. Apparently all this Wesabeness works in 30 countries, so it's not specific to US Dollars or US institutions.

It's early, sure, but it's a slick idea and it can potentially help you unlock your financial lock and allow you do any number of cool things with it. One of the things that has impressed me so far with Wesabe is their openness to feedback. You can even call their CEO directly. He's got phone hours and a number published on their site and you can call and talk to him personally, seven days a week. That's so cool. I like it when people dig their jobs.

Technorati Tags: , , , , ,

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Why I don't use Intuit's Quicken or Microsoft Money

July 3, '07 Comments [61] Posted in eFinance
Sponsored By

compuserveI've been banking online as long as I've been online. I've always avoided checks, preferring to do as much as I can electronically.

I used QuickBooks under DOS, and ComputerServe Finance under OS/2. Even though I took "Home Economics" in school - we were all required to learn how to balance a checkbook - it never made sense to me why I should have to reconcile how much I THINK I have with how much the Bank knows I have.

I used QuickBooks, then OFX (Open Financial eXchange - arguably the first public "Web Service," even though it's SGML and bailing-wire - and moved forward as new, better personal finance managers (PFM) came out.

I diligently have exported and imported, massaged and cajoled over 20 years (yes, twenty) of financial data from my first sole-proprietorship at 15 until today moving accounts and account data from bank to bank and from PFM to PFM.

To this day, I'm convinced that Microsoft Money 95 was brilliant, wonderful and before its time. It had a forward/backward browser like metaphor and was unapologetic about it. It wasn't trying to be like the MDI (Multiple Document Interface) "peer applications" of time. It focused on one thing and one thing only - to be a local register for all your money.

Then came the fancy stuff, and the advertising and upselling. I upgraded like clockwork. Oh! A new version of money! It must be 365 days better! I paid my $49.95, then got the Deluxe the next year for $79.95, then the super Deluxe Business Edition. It got slower and slower. Remember I've got Money files with data going back decades, plural. I tried culling the data, to include just the last 10, then 5, then 2 years. Still slow. Painting slow.

Accounts open and closed, banks changed account numbers, banks changed OFX servers, things broke. I got downloaded transaction data like "JITB#45,21312323423,$%@#$@ - $4.95" and wondered why my bank was swearing at me, rather than telling me I spent $4.95 at Jack In the Box on the corner of Walker and Jenkins then plotting it on a map.

redrocker@200665111650 Of course, this isn't all Money's fault, it's the banks, it's the data consortiums like OFX and IFX (disclosure, I was the OFX Vendor Committee Chairman for 2 years and I suck too. I could have done a LOT more.) and it's the back end systems.

Data's not pretty, and Money and Quicken are forced to create local rules to parse out the data they get from bank and the bill payment clearing house and built lists of rules of regular expressions to convert JITB#45 into "Jack In The Box."

Plus, if you don't log into your Money or Quicken for a few months, just try catching up and reconciling, especially if your bank only holds 90 days or less of account history.

I switched this year from Money 2006 to Quicken. Sadly, it's even worse. It paints unspeakably slowly, and in the 5 months I've been using it, it's updated itself at least three times, presumably in order to play well with Vista. Regardless, it's the same old story. Chasing data feeds in order to get my small mind around my smaller money. Even more, these OFX feeds that bring this data into Microsoft Money and Quicken may starting costing extra.

So, I stopped. I log into my bank's websites directly. I use their online tools, and they continue to get better, adding Ajaxy goodness, some powered by Corillian/CheckFree (my employer).

wachoviasample(By the way that's not a screenshot of my account...whoever that is did a lousy blurring job.)

I never thought I'd say it and I know Chris "Mr. Desktop App" Sells will disagree vehemently, but if I can get an application online, I'm more likely to use it, and use it often.

Sure, a lot, if not all, of the cool features of a site like Wesabe could be had via a connected local desktop application, but then there's all the updating and what not.

Maybe there's a space in the world for a Personal Finance Manager - a MoneyKiller or QuickenKiller - written in Adobe Apollo, Flash or Silverlight. Maybe online apps that manage money will get smarter with new Browser Plugins like Google Gears (once there's a security story). Either way, I don't think the future of my money involves a 350 megabyte CD-based installer.

Do you use Quicken, QuickBooks or Microsoft Money? Do you connect to your bank from inside those apps?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Are you Banking Online? Why not?

March 5, '07 Comments [60] Posted in Corillian | eFinance
Sponsored By

Banking analyst house Celent has published a new Retail Banking report called "Retail Internet Banking Vendors: Luring the Laggards."

I thought it was funny they didn't say "Luring the Luddites." I bet there was a meeting about that.

The company I work for, Corillian, is the big maroon dot in the upper right corner of the chart at right. Our arch nemesis (nemesi? Just kidding, they're lovely people), Digital Insight, is the smaller dot nipping at our dot. This is a multi-dimensional chart, with the size of the dot representing the size of our customer base, although I'm unclear if it's number of users, number of banks, or dollars the bank manages.

Across all four categories, Corillian stands out as the clear leader, followed by Digital Insight. Metavante, a low performer in Celent’s 2005 report, has significantly revamped its retail platform and has performed exceedingly well registering third overall. Online Resources, Fiserv, and S1 Personal Banking also received relatively strong grades.

As we often ask ourselves around here at Cori, who is not banking online and why?

Do you, Dear Reader, access your banking information online? If not, why not? (Especially considering that you're reading this blog!) Is it a hassle? Concerns about security? Where do you bank online and why? If you don't bank online, what would it take to get you banking and paying bills online? Do you want to pay bills from your phone? Discuss...

Follow up question: I personally haven't written a paper check in at least 5 years, possibly 10. If I could turn off checking all together (like ING Direct's Electric Checking) I'd do it. Who are these older ladies with their checkbooks slowing me down at the Grocery Store, and are you one of these ladies? ;) Seriously, do you write checks, and why?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Webinar: Online Banking 2.0

March 1, '07 Comments [7] Posted in Corillian | eFinance
Sponsored By

UPDATE: A recorded REPLAY of this Webcast is available now.

If you're interested in what Corillian does, or just in Banking and eFinance in general, there's a free Web Seminar tomorrow on Online Banking 2.0, March 1st, at 11AM PT/2PM ET.

It's presented by one of Corillian's Product Managers, Max Janasik, and it's going to be pretty interesting. I worked a little on the PPT deck, but what's really interesting is the influence of Social Networking and the general "Common Sense and Good Feelings" around Web 2.0 that we're trying to start spreading around the Banking Community. Starting conversations with your customers, gaining their trust and general business transparency are more and more an issue in the emerging web.

Also, if you're interested because of Corillian's recent announcement about being acquired by CheckFree, you'll see some interesting UI things that both Corillian and CheckFree are working on, and maybe get a glimpse of what a Next Generation Banking experience might look like.

Be sure to register ahead of time.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Page 1 of 3 in the eFinance category Next Page

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.