Welcome to Deadbeef.com
Articles and tips on software from authored by Jeremy Bettis.

Search

XML Feed RSS

What is RSS?

Who's Online?

  • Guest Users: 13

Archives for: 2008

12/02/08

Permalink 10:11:35 am, by Jeremy Email , 168 words, 466 views   English (US)
Categories: Money

The economy entered a recession, so what should I do?

The NEBR Business Cycle Dating Committee determined that December 2007 was the peak of the last expansion, and a recession began following that. So now what?

That seems to be a question I keep hearing, for example on the WSJ morning radio show, they keep asking people how they are changing their behavior as a result of the recession. Why? The recession is an average of the economy as a whole. Asking how individuals how they are going to change in response would be like asking students how they are going to react to average test scores going down. Oooo average test scores are down in my school, should I study more or less? That would be stupid to even talk about.

Likewise how will I change my behavior? Not at all! I have been very frugal for the last 3 years, and I will continue to save money just the same. Will that pull down the average spending? Perhaps, perhaps not. Do I care? Nope. It's just an average.

08/08/08

Permalink 02:03:45 pm, by Jeremy Email , 152 words, 862 views   English (US)
Categories: Programming, C++

Using MPC to generate CxxTest test cases

There are a few tools that I love for C++ development, and one of them is CxxTest. One of my other favorite tools is the Make Project Creator or MPC. It allows you to generate makefiles or visual studio projects from some simple configuration files.

MPC lets you create templates for various projects that can be used again and again.

Here is my template for CxxTest projects:

project {
  Header_Files {
    *.h
    *.hpp
    ^Test*.hpp
    CxxTest {
      ../cxxtest/cxxtest/*.h
    }
  }
  Define_Custom(CxxTest) {
    automatic = 1
    command = $(PERL_BIN)/perl ../cxxtest/cxxtestgen.pl
    output_option = -o
    inputext = .hpp
    source_outputext = .cpp
    commandflags = --abort-on-fail --have-eh --have-std --part
  }
  CxxTest_Files {
    Test*.hpp
  }
  includes += ../cxxtest ..
}

Then in the folder where your test cases live:

project : CxxTest {
  exename=*
  Source_Files {
    main.cpp
  }
  specific(vc71,vc8) {
    postbuild = $(TargetPath) $(CXX_RUNNER_ARGS)
  }
}

You will have to create the main.cpp file manually, normally it is created with perl ../cxxtest/cxxtestgen.pl --root.

07/03/08

Permalink 11:42:12 am, by Jeremy Email , 72 words, 841 views   English (US)
Categories: Programming, C++

Boost::regex tip of the day

If you use boost::regex, don't do what I just did.

  1. Calling boost::regex_match(std::string&,match_results&,basic_regex&)

  2. Changing the std::string that was passed to regex_match.

  3. Trying to look at the sub-matches in the match_results object.

I didn't realize that match_results kept references to the string, and so you can't edit the string.

Perhaps that will save someone from hitting an assert().

06/24/08

Permalink 11:50:56 am, by Jeremy Email , 62 words, 621 views   English (US)
Categories: General, Personal

Thank goodness for WiFi

It seems like wireless networking has been around forever, but it was not so long ago really. I had a laptop with no wireless:

Working on the couch with wired network

Now, what is that strange posture, and why am I holding the Ethernet cable with my foot?

Oh yes, here is the reason:

Brianna playing with the Ethernet cable

Now, she doesn't do that anymore, but there aren't wires stretched across the room either.

06/05/08

Permalink 04:22:50 pm, by Jeremy Email , 143 words, 831 views   English (US)
Categories: Money

One year of debt freedom

So it has now been one year since we became debt free!

How has life changed? I must say as good as it felt to be debt free, it felt much better when we had 3 months of expenses saved as an emergency fund.

In the last year we have:

  • Saved $16,000 as an emergency fund
  • Saved $3000 for new furniture (and spent it on the new furniture.)
  • Bought a cheap car and gave it away as a gift
  • Saved $3300 for our vacation fund.
  • Paid down the mortgage by $2311.24
  • I was laid off from my job, and had enough money saved for 7 months
  • Started a new job, just two weeks later, making slightly more than the old job.
  • Opened a Roth IRA: $3935.35 contributed so far.
  • Starting funding College Funds: $2576.82 so far.
  • Our net worth has increased by $29,046.38 (despite the stock market doing so badly)

Thanks Dave

Permalink 04:04:02 pm, by Jeremy Email , 139 words, 4328 views   English (US)
Categories: Programming, C++

Converting RGB to HSV in C++

I don't know why this is so hard to find, but it is. I ended up following the suggestion of a google answers question and converting the javascript formula at http://www.csgnetwork.com/csgcolorsel4.html to C++. (Ok, it is just plain C).

// RGB are from 0..1, H is from 0..360, SV from 0..1
double maxC = b;
if (maxC < g) maxC = g;
if (maxC < r) maxC = r;
double minC = b;
if (minC > g) minC = g;
if (minC > r) minC = r;

double delta = maxC - minC;

double V = maxC;
double S = 0;
double H = 0;

if (delta == 0)
{
	H = 0;
	S = 0;
}
else
{
	S = delta / maxC;
	double dR = 60*(maxC - r)/delta + 180;
	double dG = 60*(maxC - g)/delta + 180;
	double dB = 60*(maxC - b)/delta + 180;
	if (r == maxC)
		H = dB - dG;
	else if (g == maxC)
		H = 120 + dR - dB;
	else
		H = 240 + dG - dR;
}

if (H<0)
	H+=360;
if (H>=360)
	H-=360;

04/08/08

Permalink 01:50:58 pm, by Jeremy Email , 64 words, 657 views   English (US)
Categories: Money

Followup to replacement cost insurance

Thanks to an article on Kiplinger.com I found a few companies that do offer full replacement cost insurance.

About a year ago I wrote about how I could not find anyone who would pay for a full replacement on your house.

So here are two companies I am going to ask for a quote from.

http://www.chubb.com/

http://www.firemansfund.com/

03/26/08

Permalink 10:00:52 pm, by Jeremy Email , 302 words, 536 views   English (US)
Categories: Money

How do I compare a Roth IRA to a Traditional IRA

I am about to open a Roth IRA for myself and my wife, and at first there won't be much diversification, since I won't have enough to meet the minimums on several funds at once. But that is ok, because you don't need to be diversified in every account, as long as the total of all of your investments matches your asset allocation right?

So I was calculating what my asset allocation would be after opening the Roth IRAs and I had a problem. It's not really fair to compare $3000 in a Roth to $3000 in a traditional IRA, since I will owe taxes on the traditional when I withdraw the money, but I will not on the Roth.

Here is what I did. I assumed that my average tax rate on the IRA withdraws would be 20%. I have no idea if that is correct or not, but here is my thinking. I probably will have a marginal tax rate of 25%. (2007 25% bracket is 63,700 - 128,500) I probably won't have enough earned income + social security (only partly taxed) for all of my IRA withdraws to be taxed at 25%, so I took off 5% and came up with 20%.

So for my asset allocation I took the present value of my IRA - 20% and then added the full present value of my Roth IRA.

Then I am trying to hit an allocation of 10% Vanguard Total Bond Mkt Index, 67.5% Vanguard Total Stock Mkt Index, 22.5% Vanguard Total Int'l Stock Index.

So if I had $2250 in international in my Roth, and $8437.50 in Total Stock Market ($8437.50 - 20% = $6750) and $1250 in bonds ($1250 - 20% = $1000) both in a Traditional IRA; then if you combined the after-tax values of both accounts then I have achieved my desired asset allocation.

I hope that 20% is a good assumption for a retirement tax rate, or else everything else is wrong.

Permalink 12:01:27 pm, by Jeremy Email , 157 words, 461 views   English (US)
Categories: General

"Upped" is evil and must die

Ok, perhaps I should just calm down, but I have heard more and more people using "upped" as a verb. Even in newspaper stories!

Now, I don't know about you, but I always thought that prices were "raised" not "upped". Up is a preposition, not a verb. Prices can go up, they can follow an upward trend, they rise, but they do not "up".

I looked on m-w.com and they do have an entry for up as a verb, but I still think it is wrong and should be struck from the English language.

Let's take this sentence and play with it a little: "The builder upped the price for the house." Very much like something you have heard before. Now let's change one word. "The builder upped the walls for the house." Sounds stupid doesn't it. You don't "up" walls, you raise them. Well, you don't "up" prices either.

See also "as per is evil".

2008
 << Current>>
Jan Feb Mar Apr
May Jun Jul Aug
Sep Oct Nov Dec

Categories

powered by
b2evolution