Checking if a service is running in C#

Surprisingly easy. I’m doing some bluetooth stuff and needed a way to see if the bluetooth support service (BthServ) was running before attempting bluetooth related system queries and socket IO.

try
{
ServiceProcess.
ServiceController sc = new ServiceProcess.ServiceController("BthServ");
if (sc.Status != ServiceProcess.ServiceControllerStatus.Running)
{
// service not running
}
}
catch (Exception)
{
// service name not recognized
}


Before the big bang…

there may have been another universe!

LQC [Loop Quantum Cosmology] has been tantalising physicists since 2003 with the idea that our universe could conceivably have emerged from the collapse of a previous universe. Now the theory is poised to make predictions we can actually test. If they are verified, the big bang will give way to a big bounce and we will finally know the quantum structure of space-time. Instead of a universe that emerged from a point of infinite density, we will have one that recycles, possibly through an eternal series of expansions and contractions, with no beginning and no end.

big bounce


Magellan was a badass

No. 2 and my favorite from the 7 Historical Figures Who Were Absurdly Hard To Kill:

Magellan agreed to kill a man named Lapu-Lapu, an enemy of two different Philippine kings that he was friendly with… Magellan and his crew landed on Lapu’s home island of Mactan. However, Lapu apparently knew they were coming, because he had an army waiting.

Magellan was hit with a poison dart almost immediately, but he trucked onward into the mass of native warriors, possibly shouting the Portuguese equivalent of “MOTHERFUCKERS!” as he did so.

He was stabbed in the face with a bamboo spear, to which he responded by burying his lance in the attacker. Magellan tried to draw his sword to keep fighting, but his arm was slashed and soon his leg as well, and he fell to the ground more or less mortally wounded.

The natives then surrounded him and began stabbing and clubbing him as he lay defenseless. He kept looking up to see if his crew had made it safely back to their boats and, upon seeing that they finally had, Magellan allowed himself to die.


WARP

I recently read about the Windows Advanced Rasterization Platform (WARP), which is a software rasterizer that will ship as part of Windows 7. WARP is targeted at:

Casual Games: Games have simple rendering requirements but also want the ability to use impressive visual effects that can be hardware accelerated. The majority of the best selling game titles for Windows are either simulations or casual games, neither of which requires high performance graphics, but both styles of games greatly benefit from modern shader based graphics and the ability to scale on hardware if present.

Existing Non-Gaming Applications: There is a large gamut of graphical applications that want to minimize the number of code paths in their rendering layer. WARP10 enables these applications to implement a single Direct3D 10, 10.1, or 11 code-path that can target a very large number of machine configurations.

Advanced Rendering Games: Game developers that want to isolate graphics card or driver specific rendering errors. We believe that all games, even extremely graphically demanding games would benefit from being able to render their content using WARP to validate that any visual artifacts they might experience are due to rendering errors or problems with hardware or drivers.

Using WARP as a tool for isolating rendering errors is understandable, but as a fallback for DirectX 10 casual games or non-gaming applications attempting to run on a PC w/o a DX10 GPU, a few things pop into my mind.

  • As a fallback mechanism, it goes back too far. We’re talking about going from DX10 -> software rasterization. There’s still lots of graphics hardware out there that targeted previous versions of DirectX, at the very least DX7, DX8, and DX9. Why not allow for seamless fallback to these earlier classes of graphics hardware, instead of a making a gigantic leap backwards to software rasterization? From a developer’s perspective, there would be a real benefit here in writing a DX10 codepath and having it run on older hardware.
  • DX10 adoption is slow to non-existent due to the slow adoption rate of Windows Vista. Unless Microsoft is able to generate massive demand for Windows 7, WARP will have little impact due to the little impact of DX10.
  • A project like WARP seems to be based around the mentality that a GPU is something special for a PC instead of a requirement. Versus software rasterization, GPU rasterization is orders of magnitude faster and the price of a decent card is under $50. Why is setting a GPU requirement such an endeavor, for Microsoft of all companies?!
  • On performance, WARP beats Intel integrated graphics. This really isn’t a surprise or any sort of accomplishment. Intel is really just selling overpriced garbage here.
  • Perhaps Microsoft working on a project like WARP instead of setting stricter graphics hardware requirements for Windows 7 is due to another shady deal with Intel. Remember the one with Vista.


Spam, spam, spam!

Remembering why I stuck with blogger for so long,

wordpress spam


Icons and labels

I was reading Ars Technica’s first look at Windows 7’s UI and one thing in particular stood out for me, the fact that text descriptions for buttons on the taskbar will be going away.

windows 7 taskbar

Text descriptions on the buttons are gone, in favor of big icons.

There are still text descriptions, but they appear over thumbnails that show up when you mouse over one of the taskbar icons.

windows 7 taskbar thumbnails

There’s a big dependence on iconography here. There was a very small bit of this in Vista, as the Start button was replaced with the Windows logo, but these changes are a much greater shift towards favoring icons over icons+text in the UI. Unfortunately, a potential issue I see here is that unless a user recognizes an application’s icon instantly, they’re now forced to mouse over all the taskbar icons unknown to them in order to find the app or window they’re looking for. This may, however, be a non-issue as the taskbar may typically just be filled with application icons familiar to the user, so cases of scanning over unknown icons in the taskbar will be rare. Whether this is a success or not remains to be seen, but the reason this caught my attention was because of something I read a long time ago on the importance of labels, written by a program manager on the MS Office User Experience team,

One of the problems noticed again and again among non-expert users was that people didn’t use the toolbar at all! … people used the menus to reply, forward, and to create new messages.

… one change caused a total turnaround: labeling the important toolbar buttons. Almost immediately, the toolbars were a big hit and everyone at all skill levels starting using them.

It’s not that icons can’t work by themselves, but that most people have a fairly limited vocabulary. Floppy disk = save. Printer = print. …

… considering that I already know how to speak English; it’s a lot of work to learn how to speak “Iconese” on top of that.

What’s particularly interesting is that the icons being talked about aren’t particularly exotic (reply, forward, send, etc. in Outlook), and toolbar icons are perhaps as common as taskbar icons.

Finally, developers will understand this, what happens if you have 2 applications with the same icon? I don’t expect this to be a major concern, but still, I have a bunch of apps I’ve written with just the default application icon, these changes to the taskbar will certainly make switching between them more difficult.


Non-installation

I came across this post today about the mess that is application installation on the modern operating system and why going back to the installation procedures (or lack thereof) of old systems are favorable.

While it’s useful to perform some kind of unpacking or decompression step as part of app setup (unzip), the idea of scattering application files into all sorts of mysterious places just makes things harder for everyone, developers and users included.

The nice thing about “non-installing” is that your entire app is in one place — pretty much just a copy of the distribution itself sitting right there. And, wouldn’t that be handy in itself, both in terms of backup and also for ease of app removal?

I couldn’t agree more and wrote something in a similar vein a while back (see here).


Why Google won

I firmly believe that Google rose and dominated the search engine market not necessarily because it provided better search results, but because it was the search engine that provided the simplest, cleanest, and most accessible user interface. I bring this up because I caught this image on reddit (my new addiction) the other day. Here’s a cropped piece of the image,

google vs. yahoo

Oddly enough, while many search engines have now adopted a Google-esque simplicity to their interfaces (Live Search, AltaVista, Ask.com, etc.), Yahoo seems to have taken the opposite approach, saturating their homepage with more content – news, top searches, weather, links to other Yahoo services, and a sickening amount of ads. I highly doubt this “everything and the kitchen sink” strategy will put Yahoo back on top.


The Milky Way… from a cave in the Utah desert

The spiral galaxy, which cannot be seen with the naked eye, was captured by photographer Wally Pacholka using a 35mm camera and 50mm lens on a tripod with a 30-second exposure – long enough to collect the light but not to see the stars moving.

milky way

Link to article


Windows Cloud

A few days ago I came across Microsoft’s announcement (or pre-announcement, as the launch is actually in 4 weeks) of Windows Cloud – an “operating system” for the “cloud.” (Note: there are certain things Ballmer says which seem vague or just don’t seem to make technical sense; I’m not sure what Ballmer means by .NET model or “operating system” in the given context. My overall assumption is that this is software for distributed computing of a web app)

There’s been a lot of hype surrounding cloud technologies in recent months with many looking forward to a future where most, perhaps all, of our data and software services are provided via. web servers. The hype is interesting as cloud computing already exists in many forms (facebook, internet email, Amazon S3, Amazon EC2, etc.) and it’s pretty much inevitable that we will continue to see similar technologies – so predicting we’ll see cloud technologies in the future is like predicting it’ll rain at some point in the future. As for whether this will completely supplant desktop software, I’m doubtful, there are a lot of issues that come with having your data and services on a vendor’s web server, not the least of which is that you don’t have access to them if your internet service goes down. That being said, I’m sure many companies are salivating at the thought of subscription-based SaaS applications and getting customers to pay a continual service fee to use their software. If that happens, we’re in for a pretty bleak future.

What’s interesting about Microsoft in all this is that while MS boasts a new “operating system for the cloud” and launches yet another web technology (they already have like a million “Live” services), it’s latest desktop operating system has encountered a slow and painful adoption due to issues which it seems to be totally ignored. Why is Microsoft ignoring its base and trying to jump on every new technology trend that hits the web? It doesn’t make sense, this does not seem to be how a company in Microsoft’s position should be acting. Microsoft built the bulk of its reputation through its operating system, even through all the growing pains of Windows 95 and Windows ME, why squander that now? Especially after hitting a high-note with Windows XP. With the way things are going Microsoft’s reputation will be one of a impotent juggernaut with a mediocre presence in every segment of the IT market. Microsoft seems to be a company that’s lost focus and direction. Perhaps it’s just gotten too big for its own good.

A great writeup I found after the announcement is here (I think I just stumbled upon this by googling “Windows Cloud”). I particularly like the closing paragraph,

This is not a company that knows what it’s doing. Ballmer and Gates were once masters of their universe. But nothing lasts forever. Ask Lehman Brothers.