So, blogger is discontinuing support for FTP-updated blogs, which essentially means they will no longer support self-hosted blogs. You can either point your domain (or a sub-domain) over to them, or you're SoL.
So here's a bit of Windows Vista Ultimate 64-bit arcana for you... I was doing some research on the performance and efficiency of relative cluster sizes, and because of this I wanted to know how many files of certain sizes were on my disk. So I started running some searches, with various cluster sizes that I was considering, hoping to get some data points against which to run some statistical analysis. Here's what I ended up with, running Vista's file search in "non-indexed" mode, and choosing to include hidden and system files:
File Size
File Count
<64KB
72,781
<16KB
53,480
<8KB
42,696
<4KB
31,542
<2KB
15,822
<1KB
19,528
<0.5KB
10,058
Did you notice something odd? That's right, the number of files <1KB in size is greater than the number of files <2KB in size! This is mathematically impossible, of course.
Using a manual binary search algorithm, I finally arrived at the magic point: something weird happens between the 1272 and 1273 byte count, as the following two screen shots illustrate (click for larger versions, look at the upper right and lower left of each).
Logically, the second search should yield slightly fewer results, assuming there are a couple of files on the drive that are exactly 1273 bytes (in reality, there are exactly 15 1273-byte files--this should be the delta between the two searches). In fact, the second search yields more than twice as many!
I was hoping I could narrow down what was going on by searching for specific file types instead of the *.* pattern, but as soon as I did that, everything seemed to work. Interestinly, if I then went back to the *.* pattern, the 1272B search produces a correct (lower) number! However, if I then run a 1KB search I get the higher number again, and if I repeat the 1272B search I again get a higher number.
Pretty strange, huh?
In case you're wondering:
Intel E8400
8GB DDR800
Windows Vista Ultimate, 64-bit, SP1 and all "important" updates applied
Seagate 1TB SATA at default cluster size
Return a Record for Each Date Between Two Dates in SQL Server >= 2005
Blogging this so I don't forget it...
It used to require some fairly ugly, resource intensive hacks (cursors, temp tables, etc.) to emit an inclusive list between two data points when the source data might not include an entry for every point (for example, a calendar, where not every day contains an event). In SQL Server 2005 and above, this is trivially easy, with a Common Table Expression (CTE) and a Recursive Query. To emit one record for every date between 1/1/2008 and 1/31/2008, you do this:
WITH datecte(anydate) AS (SELECT CAST('1/1/2008' AS datetime) AS anydate UNION ALL SELECT anydate + 1 AS anydate FROM datecte AS datecte_1 WHERE (anydate < CAST('2/1/2008' AS datetime) - 1)) SELECT anydate FROM datecte AS datecte_2
If you need more than 100 days (the recursion limit is 100), add this to the end:
OPTION (MAXRECURSION 1000)
The fact that they stop recursion short at 100 by default would seem to indicate that this is an expensive procedure, but even if you're just using this to produce a dummy table with all the dates for several years, it's a nice shortcut.
I just tried the following query, which emits a record for every day between 1/1/2000 and 12/31/2020:
WITH datecte(anydate) AS (SELECT CAST('1/1/2000' AS datetime) AS anydate UNION ALL SELECT anydate + 1 AS anydate FROM datecte AS datecte_1 WHERE (anydate < CAST('1/1/2021' AS datetime) - 1)) SELECT anydate FROM datecte AS datecte_2 OPTION (MAXRECURSION 10000)
On my P4-641+ the script emits 7671 records in 0 (that's zero) seconds and "spikes" the processor to all of 3%. Granted this is not a complex query, but at least we know the recursion (if it really is recursion internally, which I doubt) isn't expensive by itself.
Other than a couple of virtual machine beta builds, I had managed to stay out of Vista entirely until the last month or so. Since then I've tried to install on three machines--a client's Dell Optiplex, which never was able to boot after install, and two home-built systems. This weekend I built a brand new system out of all Vista-logo components. It booted; Vista reported the hardware compatible; it even got a 5.8 experience index score. But I had continuous crashing of both IE and Windows Explorer. Also, on what should have been basically the fastest hardware available, the Vista with SP1 install took over 90 minutes.
I'm walking away. My current approach for my development machine is going to be Windows Server 2008 Standard 64-bit. Again I have certified components, but 64-bit in itself represents a struggle in terms of driver and application compatibility. We've had 64-bit CPUs in our machines for going on 5 years, and 64-bit Windows options for almost as long, and yet you still cannot run common programs and drivers in the environment--Flash, TWAIN, most VPN software, the list of things you can't do (or do well) is astoundingly comprehensive.
We're heading toward a very real wall here: 32-bit versions of Vista (as with other flavors of Windows) are limited to 4GB of RAM. Yet that is simply not enough for Vista plus any serious suite of applications. At the same time, 64-bit Windows still isn't a truly viable desktop for most users. Out of necessity, I'll compromise on many fronts--multimedia capability, peripheral compatibility, native software availability--but some of this stuff isn't easily virtualizable, so I'm looking at the possibility of having to keep 32-bit systems around (for example for scanning, connecting to client VPNs, etc.). I'm really starting to feel hemmed in.
I guess I could take a step back here and look at it from the Mac perspective. It works because it's broken; it's broken because it works. That is, by forcing a switch to 64-bit Server I'm pruning the 16- and 32-bit dead wood that's keeping me in the 4-gigabyte sandbox. Apple users long ago embraced obsolescence as a feature. Vista and 64-bit computing may (finally) force the Windows side of the PC world to wake up to this. Or maybe not. There's a downside to the Mac example: "performance" in an absolute sense is to some extent irrelevant, and scaling up doesn't necessarily have to be as smooth or cheap as we're used to, as long as the chrome is shiny and doesn't peel off too obviously.
This issue bears similarities to the current Internet Explorer 8 web standards argument--do we break the web (force IE8 standards mode, cripple billions of web pages) to move toward the Platonic ideal of standards? Do we break the PC ecosystem (Vista, 64-bit) for the hope of increased functionality and capacity in the next generation of platforms (available today, but considered unusable by the consumer)? You know it's a tough question when even Joel Spolsky can't tell you the answer. But generally, culturally, we're not long-term investors, certainly not when the benefits are nebulous and far off and the pain points are obvious and immediate. As Joel argues, for web standards under IE this is a late-bound issue--they can throw the switch any time to go back to a more relaxed mode. But the issue of Vista running out of memory and 64-bit versions not being ready for prime time is a lot harder to resolve.
Dynamically Adding Option Elements to Select Objects... The Real Story
I don't normally blog about pure code subjects, so this is going to be way too technical/boring for the general readership of this blog. However, I wasn't able to find the definitive answer to this question after searching around with Google, so I figured I'd contribute a little. This is also a wiki-style reminder to myself the next time I need to do this.
Mostly you'll be interested in this post if you're trying to programmatically add options to a select list using JavaScript. Of all the ways to do this, there are a few that work and many that don't. The catch seems to be that IE is picky about how and when the data "inside" the option tag (the visible text in the option list) is set. According to the documentation there should be any number of ways to set this--.text, .innerHTML, .innerText. Of those, the only one that seems to be broadly compatible is .text. .innerText is IE-only, so it's right out. .innerHTML is valid across platforms, but it messes with the object model in IE6 and IE7 (and IE8 beta 1, now that I look) in such a way that if you use it, you have to add the option element to the select element before setting the .innerHTML property. See below for a breakdown of the methods, plus test code. Blogger might break this, so be sure to look at the plain test page ("view source" is going to be a lot friendlier on that page as well).
In any case, here's the take-away when adding options to select elements:
Always use the .text property of the newly-created option object to set the visible text for the option.
As a precaution, add the new option object to the select object's options collection before setting other properties of the option.
create option, set .value, set .text, add to options list (generally compatible)
function createSetTextAddOption(selectEl,val,displayText) { var o = document.createElement("OPTION"); o.value = val; o.text = displayText; selectEl.options.add(o); return false; }
create option, set .value, set .innerHTML, add to options list (fails IE6, IE7, IE8-'invalid argument')
function createSetInnerHTMLAddOption(selectEl,val,displayText) { var o = document.createElement("OPTION"); o.value = val; o.innerHTML = displayText; selectEl.options.add(o); return false; }
create option, add option to list, set .value, set .innerHTML (generally compatible)
function createAddOptionSetInnerHTML(selectEl,val,displayText) { var o = document.createElement("OPTION"); o.value = val; selectEl.options.add(o); o.innerHTML = displayText; return false; }
create option, add option to list, set .value, set .text (generally compatible)
function createAddOptionSetText(selectEl,val,displayText) { var o = document.createElement("OPTION"); o.value = val; selectEl.options.add(o); o.text = displayText; return false; }
Attempt to add new options/selects inline (option 2 and select 2 fail in IE, either silently or with the "invalid argument" error)
According to the Microsoft documentation, this shouldn't work at all. Here's what they say about the option.add() method:
This method can be used to add elements only after the page loads.
If the method is applied inline, a run-time error occurs.
And yet, it mostly does work, aside from the innerHTML limitation...
// generally compatible inline adds createSetTextAddOption(document.getElementById('sel5'),'1','added value 1'); createAddOptionSetInnerHTML(document.getElementById('sel5'),'3','added value 3'); createAddOptionSetText(document.getElementById('sel5'),'4','added value 4');
addNewSelect(document.getElementById('sel5'),'1','added value 1',createSetTextAddOption); addNewSelect(document.getElementById('sel5'),'1','added value 3',createAddOptionSetInnerHTML); addNewSelect(document.getElementById('sel5'),'1','added value 4',createAddOptionSetText);
// these two fail in IE6, IE7, IE8 createSetInnerHTMLAddOption(document.getElementById('sel5'),'2','added value 2'); addNewSelect(document.getElementById('sel5'),'1','added value 2',createSetInnerHTMLAddOption);
Again, I encourage you to view the plain test page to avoid any Blogger-induced weirdness.
All of a sudden (though probably not--I'm just catching on) there's a rash of services that crunch plain text or data keys and return parsed, formatted, drilled-down usable data. For example...
Tripit will digest all your travel confirmations and produce a rich itinerary.
Google SMS will take a zip code, flight number, etc., from your cell phone, and return a rich data node.
Opencalais is a platform for doing stuff like this.
What if you're downloading a product demo, need a unique address to get the key, and never want to hear from that company again? Good luck! Actually, you don't need good luck, just mailinator.
Send to any address at mailinator.com (or one of several other domains) and then go to the site and check your email. But make it a long, complex address, because there's no password. In fact, anyone can check "your" email if they know the email address (including the person/company who sends email to you).
When You're an End Node, It Doesn't Pay to Ask Why
I think what he's saying here is that where you look for answers as a developer is heavily influenced by the domain in which you're operating. Yes, you need to consider "best practices" (groan), and sometimes it's a good idea to "think outside the box" (wretch), but most of the time you really need to concentrate on what is possible and efficient and makes sense in the current context. This is why when you want to learn about a technology you can read a book, but when you actually have to implement it you end up sorting through a lot of discussion groups and blog posts, and especially blog comments--the ultimate end nodes of the infocloud.
Just a neat blog I stumbled on in an otherwise anxious, code-heavy week of integrating things that were never meant to work together.
I recently had a desperate need for a wireless bridge device. The need has passed, but I finally figured out a way to do it without spending $60+ for a dedicated (one port) bridge. The main goal here is to provide a physical Ethernet jack somewhere out on your wireless network for a device or devices that can't connect to wireless directly. I was able to get this working just now using a $25 refurbished Netgear WGT624v3 from Fry's. I followed (and interpreted, because it's not as step-by-step as it could be) these instructions. Supplemented with information from this thread.
What's really amazing about this is that you end up using a shell session on the router, without having to hack the firmware (though you are exploiting a disabled interface and a NetGear diagnostic tool that turns it back on). It's pretty strange.
In any case, I can now put four physical Ethernet ports anywhere within range of my wireless network. The bridge is effectively dumb and invisible--DHCP, DNS, etc. all come from the access point.
The best part about this? I found the original thread, and the fact that this was all possible, using my Sprint phone while standing in Fry's staring at the blank brown box of the refurbished WGT624 wondering "WTF is this?" (iPhone? We don't need no stinking iPhone.)
Potential limitations that may reduce the usefulness of this. I don't know if these are actual limitations, but I haven't tested beyond my own setup.
Tested only bridging to NetGear access point (potential issues with other brands?)
Tested only 64-bit WEP encryption (some of the comments mentioned problems with WPA)
Tested only with published SSID at the AP
Possible wireless saturation/interference--when I tried this with the bridge a few inches from my Thinkpad, the internal Centrino wireless could no longer connect, and I've read that some BIOS versions of this router produce illegally-strong radio signals
One wonders how bad things have to get before you "need" to defragment.
Also, has anyone noticed that the Windows 2000 defragmenter is more aggressive than that supplied with Windows XP in terms of defragmenting free space?
I was all set this morning to do a long rant on why we should be using this date format:
2007/05/22 (or 2007-05-22 in situations where the "/" is inappropriate)
Looks a little weird, I know, but no matter what culture you're from, there's no doubt what date that refers to. I didn't even have to tell you that it's YYYY/MM/DD--because what else could it be? My personal reason for adopting this format over 10 years ago was that it sorts well in plain-text data--like in the file system on a computer. It continues to sort well even when followed by a similarly-standardized time (like 16:22:03).
Anyway, the reason I don't have to do a long(er) rant is that a fast Google Search reveals a lot of other people thinking about this:
ISO has a standard for it (note that ISO is a for-profit enterprise, so you can't actually see the standard unless you pay)
And perhaps the most solid recommendation in the modern era, and what got me thinking about this today: Google uses it. It's right there at the bottom of the Gmail advanced search options.
And if Google does it, it's got to be good, right?
I'm not sure how I missed this, or how long it's been available, but as the next logical step after their "storage as a service" S3 solution, Amazon has come out with with the Elastic Compute Cloud (EC2). Essentially this combines server virtualization (which if you've worked with me, or heard me talk about work, you know I'm all about lately) with the massive server farms at Amazon via an ever-expanding web service system. Basically you build or choose virtual machine images and run them on an arbitrary number of virtual servers at Amazon. It's "dedicated server" hardware co-location without the hardware. The idea is you can create an entire "data center" by interconnecting these images--for example, running several web servers, against a couple of database servers. And if you need to double the size of your data center, it's a batch copy to invoke more servers--just pay for the "instance hours" you use. This is heady, brain-baking stuff. They even have a pre-built Window 2003 Server image running under Fedora Core 6 via Qemu (itself a virtualization environment). Hey, wasn't I just talking about turtles all the way down?
So, how much does all this cost? The short answer is, you pay for the flexibility--it's more than root access co-lo for a single-server setup. The long answer is, to run a web server, it's about $100/month (1 CPU @$73 + 160GB storage @$24), plus bandwidth (where you can really get killed). Compare this to, say, the $100/month root server plan over at 1and1, which comes with two terabytes of transfer (maybe... many ISPs will throttle or boot you if it even looks like you'll approach the max on your plan). All things being equal, that transfer would cost you an extra $300 at EC2.
This is an amazing JavaScript virtual machine for 6502 assembly language. In one JavaScript file (under 50K) they managed to include a compiler, debugger, software CPU, and graphics sub-system. I use virtualization software every day, but not since reading The Diamond Age have I seen such a compelling demonstration of the fact that any computer can act like any other computer through software alone. This is exactly the kind of turtles-all-the-way-down metaphor that gets us things like The Matrix and the domino computer. It's tempting to think of the logic gates in the CPU as the bottom rung of the computing process, but in essence those silicon pathways are there to reverse-virtualize (realize) the logical rules of computing. The CPU is in fact an interface to those rules, and by extension to the brains of the engineers and mathematicians who designed the rules. And what are rules but software? The only place this breaks down is inside the human brain--we don't know the rules that govern in there--so while you can emulate a computer with your brain, we can't yet emulate our brains on a computer. But outwardly our participation is governed by rules so effectively we're part of the machine.
The best-kept secret in remote, web-based power control is the Digital Loggers LPC Ethernet Power Controller. Don't let the hilarious 70s porno background music and voice-over complete with GIANT ANOUNCER VOICE put you off. This is simply the only cost-effective multi-outlet power controller for home office use. For about $100 shipped you get a web-based, eight-outlet controller that's built like a tank: wall-mountable metal case, built-in cooling fan, "real" heavy-duty wall outlet receptacles. In a year of use I've never had it unexpectedly change the state of an attached device, and I've never had to reboot it. If you're really hard-core, it's even controllable via code (see PDF manual for example PERL script).
Though I have been completely happy with the unit, there are a couple of quirks. For one, I've sometimes been unable to log in remotely using Internet Explorer, especially over public Wi-Fi. Continued attempts will cause a temporary security lockout. The workaround is to use Firefox (before the lockout!), which has never failed. The only other complaint I've had is noise. The tiny, high-speed case fan makes this the loudest device in my office (always on, of course), except on the hottest days when the processor fan on my P4 maxes out.
One of the nice things about the big metal box school of design employed by Digital Loggers is you're somewhat encouraged to crack the case. Once my warranty is up in June I'll probably drill some holes and replace the fan with a larger, slower one. I'm also going to investigate the possibility of splitting half the outlets onto a separate power supply, thus allowing for some UPS-protected outlets and some unprotected ones. Theoretically the supply side of the relays should be independent of the switching side. I probably wouldn't even consider this kind of mod on a more expensive or injection-molded plastic unit.
For server rooms, Digital Loggers also offers an intriguing upgrade unit, the EPCR2. This ads extra outlets (though still eight circuits), dual power supplies and power cords, metering and monitoring, front-panel override switches, and backup dial-up access via serial ports--all in a 2U rack-mount chassis. I almost bought this one, but the $300 price tag was a little much for home use.
A note on customer service: Because I was working on a deadline (leaving for vacation), I ended up ordering by phone to discuss expedited shipping. Digital Loggers is a small company, and they keep it old school--hand sending email confirmations and seemingly remembering your name between calls. I had not experience that level of customer service since having a personal sales rep at CDW in the 90s (and I was spending a lot of corporate money with them to get that). Quite refreshing.
It's not that often that I come upon a truly wonderful device that I never knew existed and yet have always needed. The Vantec CB-ISATAU2 is such a device. It's a universal IDE/SATA hard drive to USB 2.0 converter.
If you're like me, you have a stack of old hard drives sitting around. And yet it's a little nerve wracking to open up the case on a perfectly good computer and plug in one of these mystery drives--will it have a virus? will it wreck my computer? will I disturb something else while I'm in there? No more. With this insane box of parts you can take any internal hard drive (and I mean any: PATA, SATA, 2.5", 3.5") and run it as a USB 2.0 external drive. Just plug in the dongle and included external power supply. It's basically an external enclosure without the enclosure.
And the best thing is, it just works. I had an old Caviar 120GB drive that had gone questionable at some point sitting on my desk. I plugged it in--dongle, power, USB--and immediately got four new drives (four partitions on the drive).
As you probably know if you have any interest in a device like this... You should disable Autoplay before doing this because Windows may try to find something to run on each partition if Autoplay is enabled. Also, like any external hard drive, you should stop the device before disconnecting it or powering it down.
Got a crazy box of parts? Then you need this crazy box of parts.
Browsrcamp comes up every so often as a tip or trick for testing web sites on Mac browsers when you don't have a Mac. The free service gives you a jpeg screenshot of what a URL looks like in Safari. For testing a homepage or template this is fine, but it breaks down in a dynamic context (for example: a site where you need to log in or where you're using DHTML behaviors or AJAX).
But there's also a paid service that lets you VNC into a Mac and actually watch how your site behaves in any browser (and they've got some weird ones). If you had a short-term project that absolutely had to look right on the Mac, this would be a cost-effective alternative to actually buying one--conceivably $20 could get you through your entire testing phase.
Given the number of times I've almost run out to Fry's and bought a Mac Mini in a panic, I'll definitely be using this down the line.
Some of you might be interested to know (okay, one of you, if "you" includes me) that Borland (as CodeGear, as turboexplorer.com) is still hanging in there with Win32 (non-.NET) development, and there's even a free version now/again. You can't find it from the real site, and it looks fake when you get there, but apparently this is legit. The product I'm referring to is Turbo Delphi 2006.
Here's an article that goes into it a little more. I agree with the assessment that Delphi/Pascal is essentially a nostalgia project at this point (although I'm sure there are eastern European hackers shareware authors who would argue). But depending on what's available out of the box (typically they've left out critical network stack interfaces in the sub-Pro versions), this is interesting to me because invoking the .NET framework (as you do automatically in Visual Studio) for a tiny helper app or test harness is computationally expensive and leads to its own version of "DLL hell." Plus, the .NET compilers are offensively slow even with up-to-date hardware.
If I try this out and it blows me away in some regard, I'll follow up.
This blogger believes that customer service, or the lack thereof, has been the deciding factor in Dell's decline. He cites "low cost and high operational efficiency" as not being enough. While I've personally considered Dell a disappointment in terms of hardware performance and reliability, I've never heard anyone complain about the service (aside from having to call them all the time because the systems keep breaking). Certainly no more than I've heard complaints about Sony or Apple (and reliability has been an issue for these manufacturers as well).
I'd like to present an alternate theory: that rather than rebel against poor customer service, what customers have really shied away from is Dell's "directness." I think that increasingly consumers have been pushed (back) toward retail computer buying. There are many reasons for this. Bundling and 0% financing options are one big one. The perceived value of a free printer or scanner at retail usually far outweighs the cost of delivering it. And it's a hell of a lot easier to wait for the "0% on all Computers until 2008" insert in the Sunday paper than it is to wade through the shady 10% coupon deals for Dell on eBay.
Proliferation of choice may also be a factor: I think consumers have become less confident in their ability to choose the right system and components online, and Dell's plethora of models and configuration options works against them in this regard. Intel vs. AMD (how many cores do I need? 32- or 64-bit? And don't even get me started on the "processor number" debacle), a half-dozen different kinds of RAM (DDR? DDR2? what's PC-3200 in Mhz? and how much do I need?!), three or four generations of hard drive technology all currently available, XP vs. Vista, CD vs. DVD.
And then there's the sales aspect--dragging people squirming and clutching their wallet that last few feet to the register. Should I wait for Vista? What if BlueRay suddenly languishes and I can get an HD-DVD drive for $50 next month? In an almost perverse reversal of the status quo, I think the geek at Best Buy and the WalMart sale flier are actually keeping the PC unit sales flowing at this point with gentle hand holding and impulse buys. Conversely, anyone confident and patient enough to shop online has been in a holding pattern for at least six months.
I wouldn't be surprised if we see Dell making some deals for retail placement this year. Given that they already have a rivalry/relationship, WalMart/Sam's Club is the obvious first step. Costco is always a possibility. But to really make a go of it, Dell is going to need to get in bed with one of the big chains: Best Buy or Circuit City. Or, if they want to really hit it out of the park, Target. This strategy helped pull Gateway out of the fire when their online business dropped off (which, ironically, did have something to do with customer service). Adjusted for the 21st century, it could work for Dell too.
As well as being the first computer-related thing in some time to make me say "cool," Microsoft's from-scratch kernel architecture skunkworks--Singularity--is a genuinely interesting project from a comp-sci perspective. Right at the end of this webcast they start talking about trying to do away with the last hundred lines of unmanaged code at the bottom of the kernel. Screw Vista, bring on the "Assembler sharp" (Ass#?).
And if you want to hear them really dig into the theory and practice for an hour, check out this other webcast. It's tempting to zone out, but there's some whiteboard stuff past the middle that bears attention. And then right at the end, in the last ten minutes, they get into the hard cross-process performance numbers. And then they run out of tape.