31

May

I need a bicycle

May 31st 2009 4:16 pm by Matt

I’m thinking in the $250 – $450 used range. I want a road bike so I could (in theory) keep up with Brandan, but not some hardcore ridiculous thing that I can’t go near without padded shorts. There are lots of varieties, heights, wheel sizes, pedal types, etc. etc. that I have to look into. I may head down to re-cycle in Uptown sometime this week to look into it.

I’m not sure I see myself commuting to work, but I need a good way to get out of the house every now and then

29

May

Exporting to Excel from a Query in PHP/MySQL

May 29th 2009 2:26 pm by Matt

I’m mostly posting this for my own future reference. This is the simplest example in the world for exporting from a simple SQL query to an Excel file while preserving row headers.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// assuming we got our query from an htmlspecialchars encoded, slashes added POST
$z = htmlspecialchars_decode(stripslashes($_POST['query']));
$q = mysql_query($z);
$result = '';
 
// add the row headers
$numfields = mysql_num_fields($q);
for ($i=0; $i<$numfields; $i++) {
	$result .= mysql_field_name($q, $i) . "\t";
}
 
/* cycle through the query and add each row, note the casting via &$val and the \t separators for new columns.  Using commas, semicolons, etc. will create a .csv but Excel will not interpret it correctly as an .xls download */
while ($r = mysql_fetch_assoc($q)) {
	$result .= "\n";
	foreach ($r as &$val) {
		$result .= "$val\t";
	}
 
}
 
header('Content-type: application/ms-excel');
header("Content-Disposition: attachment; filename=report.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo $result;

28

May

Restoring Checkbox Selections from a Database

May 28th 2009 5:04 pm by Matt

In a project I’m working on right now I’m making a dynamic reporting application. Basically I’m trying to take what I can do easily with a few lines of SQL and turn it into a usable interface for people who don’t know what they’re doing. It has summary reporting (group by), filters (wheres), etc. As you can imagine, this system has a plethora of fields that can be selected to be included in the report. No big deal, they’re all dynamically generated anyway. The catch is when I want to save a report, effectively restoring selections from a database.

Read the rest of this entry »

23

May

Bring Back Damn Interesting!!

May 23rd 2009 10:53 am by Matt

I used to love killing time by reading the long and damned interesting articles on Damn Interesting. Alas, I have gotten through the entire archive. At least, all of it that looks interesting. This blog is awesome, yet they haven’t posted anything new since October 2008. This is unacceptable.

Come Back, Damn Interesting.

22

May

Wooh long weekend!

May 22nd 2009 10:19 am by Matt

The weeks have been cruising by way too fast lately. It feels like the weekends go straight to Sunday evening and I’m stuck going “how the hell did that happen?”. Hopefully Memorial Day will be a nice little break. I plan to spend it shopping and killing zombies.

Jess and I signed our new lease yesterday and we have the new place on June 20th. We’ll have both apartments for the last week and a half of June which should let us be pretty relaxed about moving. So – if anyone wants to come visit that week or the last weekend in June we’ll have an extra apartment :) . The new unit is right across the street and quite a bit bigger than our last one (for $10 less a month – woooh savings). We also have real live guest parking now so you guys won’t have to search or pay for parking when you come downtown.

It still hasn’t quite sunk in that we’ll be moving yet. Time has been flying lately though so I suspect the next month will go by super fast.

21

May

I know a guy who would wear this

May 21st 2009 11:07 am by Matt

So thinkgeek had this shirt with a speaker in it as an April Fool’s joke a while back. The idea was that you could have a personal soundtrack or some such nonsense. Anyway, now it’s real! How cool is that. Sadly, at $39.99, the novelty is probably not worth the price.

Check it out at Thinkgeek

20

May

A little perspective for EU Antitrust regulators

May 20th 2009 8:00 am by Matt

As you may or may not have heard, Microsoft is due in European court in June to defend itself for bundling Internet Explorer with Windows. Opera started the suit, claiming that IE “harmed the web” and demanded that IE be unbundled. Since then Google and Mozilla have jumped on the gravy train, and who can blame them?

But it’s pure bullshit. An operating system has to come with a browser. I don’t think anybody is seriously suggesting that MS should not bundle a browser with Windows (although that would be a great “fuck you” in its own right). So what are we really saying here? They should bundle a competitors’ product?

Nevermind that Microsoft has a legitimate case about google becoming a de-facto search monopoly if virtually any other browser is bundled (Firefox, Opera, and Chrome all use Google as the default search engine). What on Earth makes the EU think they can force Microsoft to bundle a competitors’ product?

Read the rest of this entry »

18

May

McSorley’s Irish Black Lager

May 18th 2009 9:06 pm by Matt

McSorley's Irish Black Lager

McSorley's Irish Black Lager

Mmmmmmmm… This is the best new beer I’ve had in quite a while. It’s dark and caramely, I regret not pouring number 1. It’s much lighter than anticipated, not nearly as heavy as the color suggests (think Widowmaker for those of you familiar with the KBC). It’s flavorful but not overly hoppy and with no harsh aftertaste. At $7.99/six pack (at Minneapolis prices) this one is definitely going to become a staple of mine as long as they keep it around.

Atta boy, Roger

May 18th 2009 3:38 pm by Matt

So Roger Federer upended Nadal on Clay to win the Madrid Open, his first title since October. I’ve been pulling for him since the last couple of heart breaking wins Nadal has pulled out against him in major opens. For some reason Federer just falls apart against Nadal all the time, so it’s good to see him pull one through.

I sure wish the two best players in the world were a bit more evenly matched. It’s sad to see Federer kick so much ass and then just lose his cool completely against Nadal.

16

May

Really? A Hybrid?

May 16th 2009 8:19 pm by Matt

My dad’s 98 Expedition is about at the end of its useful life. He’s well into the 100ks and it’s about time for a new vehicle. My dad really felt the sting recently when gas was up over $4.00/gallon. The listed mileage for his truck is 12 city / 16 highway – and that’s before the EPA raised the standards and before he put a bill of miles on it. If you’re filling a 24 gallon tank every week, well, you do the math.

Long story short, my dad is now looking into buying a midsize SUV. He needs something capable of hauling our boat and some occasional lumber. No problem, shouldn’t be tough to find a midsize SUV that beats the Expedition for fuel economy right? Except my dad doesn’t want to stop there. He wants to buy a hybrid midsize SUV. Specifically, he wants to buy a Toyota Highlander Hybrid.

Read the rest of this entry »