This post lists the code for creating a high resolution timer for the Microsoft Windows platform. High resolution timers are often used in multimedia and entertainment applications for timing events up to the microsecond.
This is a heavily modified re-post of the article that used to be on the Scriptionary.com website before the change to the blog, read the source code for details.
As an OpenGL junkie I just have to dedicate at least one post to this topic.
By now you’ve undoubtedly heard of OpenGL ES, the OpenGL based library used on embedded devices such as cell phones and gaming consoles. OpenGL ES is what gives many Android based phones and iPhones their 3D gaming capabilities that rival the desktop machines of only a few years ago in terms of power. It seems like these days we’re all carrying a little computer in our pocket.
Here’s a little snippet I’d like to share with you since there really isn’t a good example online that shows you how to count the processor cores and threads on Microsoft Windows using the Windows API through C++.
Intel demoed Larrabee for the first time to the public at the IDF (Intel Developer Forum), according to PC Pro.
The attached screenshot is a bit underwhelming but maybe we’ll see some impressive examples soon. In any case, if the demo is at the IDF now, the public release couldn’t be far off.
Edit (2010)
In case you haven’t heard — it seems like Larrabee was cancelled for good.
Apparently, the DirectX team has had a blog since late April of this year it’s just not very popular I guess.
They’ve posted a shipload of information over the last couple of months, so if you’re like me and had no idea this existed, you’ll have quite some reading to catch up to. It’s mostly about Windows 7 and the new graphics APIs (Direct2D, DirectWrite, etc.) but it’s interesting nonetheless.
Today the August 2009 DirectX SDK was released on MSDN, strangely enough the August SDK was released in September.
This release contains the first official release of Direct3D 11 (RTM), which was previously only a technical preview. According to the release notes, this version of Direct3D 11 will only work on the RTM version of Windows 7, not on the RC and Beta versions. So I guess only vendors and MSDN subscribers will be able to develop software until Windows 7 hits the retail market.
There’s also the issue of pure Direct3D 11 hardware not being sold yet but that should be right around the corner if the SDK is here.
Neil McAllister of InfoWorld recently made his case against web-based applications. He gives five reasons for companies not to use web based technologies.
Having developed for both platforms (desktop and web) professionally, I can say with all certainty that Neil McAllister is wrong in his assertions.
Edit: FYI, by Hungarian notation, I mean Systems Hungarian such as bIsSucky.
It seems I’m in some kind of pickle. For some reason, two of the programmers at the company I work for still use Hungarian notation.
In case you don’t know what that is, in short: Hungarian notation prefixes an abbreviation of either the data type or purpose of the variable to its name. For example, Microsoft’s WINAPI still uses it, hence we have things such as hInstance, nShow, szCompany, etc. So it’s quite ugly and confusing to the programmer.
Yet these two programmers still cling to their old ways and refuse to give up on this ancient method. Even in VB.NET. One of these programmers happens to be Joe the Programmer mentioned before, go figure.
I was asked by one of them “Why not use Hungarian notation?” In case you dind’t know, dear reader, the name of the variable should give away the data type, use UpperCamelCase and logic for your naming conventions. Turns out, UpperCamelCase is a programming convention in this company, so why we were arguing, I don’t know. Now if only logic were a convention, we’d be set.
But it was like pissing against the wind as neither them nor I were persuaded in the end. How would you persuade a person to switch to a different methodology? By them using Hungarian notation, people who will eventually take over their source code will want to shoot themselves.
I’m not known as a person who particularly likes the .NET framework but I still have to use it. The .NET Framework is basically a massive library of general purpose functions, much like the Standard Library is to C or the Standard Template Library is to C++.
But what if it all would be discontinued?
It’s not an impossibility and rather likely considering Microsoft’s track-record. The millions of applications, libraries and websites created with .NET would be useless.
I’ve been fortunate enough to be part of a VB6 (CGI) to ASP.NET (VB) conversion team and, trust me when I say this, you don’t want to be part of such an effort. These conversions require truckloads of time and money, and if you work for a mid-sized to large corporation, this could easily lead into the millions of dollars.
Now imagine all of your code obsolete. Everything you’ve coded since .NET 1.0. What would you do? Let’s take FoxPro as an example. Microsoft bought FoxPro in 1992 and released a couple of versions under the “Visual”-family of products. The last version was released in 2007 and a statement of Microsoft suggests that this is the last version.
No migration tools to any other language are being provided.
Another product would be J#, which will be retired in 2015. Keep in mind that J# is a fairly recent product and was only released with Visual Studio.NET.
How far will .NET go before a turning point is reached? Consider that .NET was first released publicly in 2002 and will be a decade old in less than four years. Knowing Microsoft, the end is quite possibly much nearer than you think.
Here’s another little snippet that might come in handy in your programmatic travels. I’ll show you an example of usage below, which might also be of interest to you. The code presented is in C, not C++. First, the code to count the amount of digits in an integer: