Joe White’s Blog

Life, .NET, and Cats


Archive for August, 2008

What does it mean when CodeGear “announces” Delphi 2009?

Monday, August 25th, 2008

Just wondering. What exactly is CodeGear “announcing” today? And how is it different from what they’ve been doing for months now?

They’re not announcing what the product will be; they’ve already done that. Sure, they’re filling in a few details, but you can’t really announce something that everybody already knows about. (Mind you, I’m not complaining about the early blogging — I love transparency. But it doesn’t leave much for the marketing droids to, you know, announce.)

And they’re not announcing that the product is feature-complete, or ready to ship, or anything. It isn’t yet. They’re only taking pre-orders. No mention is made of when electronic downloads will begin… or of how much longer after that it’s going to take before they start shipping physical product… or of how much longer after that it’s going to take for customers to start actually getting their copies.

So what, pray tell, is all the fuss about?

Goal: Pay off the credit cards by year-end

Monday, August 11th, 2008

Jennie and I have been in debt since before we were married — progressively more debt as time went on.

Back in 2000, we had our first wake-up call, when my primary income dried up for several months and we didn’t know how to make our payments. We signed up with Consumer Credit of Des Moines, and they negotiated lower rates and payments with all of our creditors and put us on a single-monthly-payment debt-snowball plan.

Then we went out and borrowed more money. Clearly, we didn’t get it yet.

Or rather, we didn’t have an emergency fund yet. So when emergencies came up, borrowing more money seemed like our only option. “Just this one time,” we’d tell ourselves, “and then everything will be back on track.” With yet another plan that left no room to breathe.

And then, three years ago, another wake-up call: I added it all up and found that our minimum payments were more than my take-home pay. Back to the drawing board. Called Consumer Credit and bumped our payment back down to then-current minimums. Rolled new debt into the plan. Cut deals with other creditors. And started making a budget.

There have been other bruises along the way, and a few miracles. And we’re finally seeing the light at the end of the tunnel. Consumer Credit called us a few months ago and said we’d have all the credit cards paid off by the end of next February.

(That’s not all the debt — just the credit cards. We have a few other debts, like the car loan and student loans and mortgage, that we’re just not even worrying about right now. Paying off the credit cards is going to be a huge milestone for us.)

Well, I just got a raise, and it’s going to kick in on my August 15th paycheck. And a few days ago, I was thinking about that, and wondering. By all rights, I should take that money and start putting it into a 401(k) — that 100% return on investment, from the employer match, is tough to beat. But… what if I took that money and started paying extra on our debts? That, plus a little more we could find somewhere, might be enough to accelerate things… we might be able to pay off the credit cards by year-end.

So I spent all weekend crunching numbers, and I found out that Consumer Credit was wrong. They just estimate our current balances, and don’t contact our creditors for up-to-date balances until the month they think something’s ready to be paid off. They don’t get the actual statements; so when an interest rate goes up, or their payment cycle doesn’t match up with the credit card’s billing cycle and we get late fees tacked on, they don’t know about it. The reality is that, at the current rate, we won’t be paid off until April.

That really let the wind out of my sails.

But Jennie and I talked about it yesterday. And she got out the budget. What if we took this money here, and this, and this, and put them toward debt instead? What about this? What if we did that? Put this off a little longer. Stretch this.

We wrangled for about twenty minutes, and something magical happened. We found the money.

Our payment to Consumer Credit is our second-largest expenditure every month, after the mortgage. We’ve got a plan to make it the biggest expenditure every month, by a fair margin. And we will be paid off by the end of the year.

And somehow, we did it without cutting groceries, or gas. We’ll still have some wiggle room every month. We’ve still got the emergency fund if we need it, and some money in savings for things like car repairs. The money was there. We just had to look for it.

Lately, our progress has seemed so slow. I was getting discouraged. I had no idea how far we’d come; how much freedom we’ve gained; how much money was there in the budget, just waiting to be found. It’s good to be reminded of these things. The money is there. The budget will provide.

And once the credit cards are gone for good?

Don’t know yet. Jennie’s got a few ideas, and I’ve got a few ideas. But the one thing we know for sure is, we are going to throw a party.

T minus eight credit cards, and counting.

WEBrick: Web-browser GUI for Ruby apps

Thursday, August 7th, 2008

I do a fair bit of Ruby hacking. Usually I’m either writing a one-off app, or automating some process I do all the time, and in both cases, I don’t need any fancier GUI than STDOUT (via SciTE’s output pane, of course). But occasionally, I’ll want a script I’ll use more than once — say, to sift through another app’s output, and slice and dice the results different ways. And for those sorts of things, sometimes I’d rather have a nice GUI.

Rather than learn any of the GUI libraries for Ruby, any of which would probably be a lot of work if I wanted to do anything fancy, I decided to try my luck with WEBrick, a lightweight Web server that ships with Ruby. I can still write my little one-off apps, but now they can show their output in HTML.

With WEBrick, you write a Ruby script, and when you run your script, it starts listening for HTTP connections. Stop the script (Ctrl+Break or close the console window), the server stops with it. No Apache to configure. It’s easy. I like easy.

The “it’s all one script” thing also means it’s trivial to load data and cache it in memory. I’m planning to use that to write a really fast grep through our source code, with a Web GUI. (I’ve long since lost count of how many times I’ve written a better grep. I’ve written grep more times than all other programs put together.)

Here’s what I think is a good starting point for WEBrick. It consists of two files: startup and servlet. The startup just starts the Web server. You put the actual logic in the servlet file. The separation is so that the servlet file can get automatically reloaded from disk every time you refresh the page in the browser (idea swiped from here).

startup.rb:

require 'servlet'
require 'webrick'
include WEBrick

server = HTTPServer.new(:Port => 80, :BindAddress => 'localhost')
server.mount '/', Servlet
trap('INT') { server.shutdown }
server.start

servlet.rb:

require 'webrick'
include WEBrick

class Servlet < HTTPServlet::AbstractServlet
  def self.get_instance config, *options
    load __FILE__
    new config, *options
  end
  def do_GET(req, resp)
    resp['Content-Type'] = "text/html"
    resp.body = "Hello, world!"
  end
end

This will run on port 80 (edit the :Port to change this, e.g. if you already have a Web server running), and it will only be accessible on the local machine (remove the :BindAddress => 'localhost' to make it accessible from the network).

Put those files in the same directory, run startup.rb, and browse to http://localhost/. Hello, world! Then just change the code in do_GET, save the source file, and reload the browser — and there’s your new page.

But it’s still the same process, still the same script. So you can save global state in a @@class_variable or a $global_variable or some such, and it’ll still be there the next time you reload the page — even if you’ve changed the source code in the meantime. I like static languages for some things, but try doing that in Delphi or C#.


Joe White's Blog copyright © 2004-2011. Portions of the site layout use Yahoo! YUI Reset, Fonts, and Grids.
Proudly powered by WordPress. Entries (RSS) and Comments (RSS). Privacy policy