Archive for the ‘Programming’ Category

Reading the registry via Win32API

Thursday, September 25th, 2008

Ugh.

I had no idea just how badly my knowledge of C programming was until I attempted to read a single value from the registry.

In the end I found that the majority of my problems were because of UNICODE being defined for Windows XP and Windows Vista. For all I know it’s probably defined for Windows 2000 and newer.

I “cheated” in a way and used the ANSI versions of the functions due to my inexperience. Hopefully I’ll be able to revisit the project in the future and fix it the way it should have been to begin with.

Sweet sweet success

Wednesday, September 17th, 2008

Today was an interesting sort of day. I fixed the last remaining issue from the implementation yesterday of a Python script to configure printer settings and demoed a project to regulate volume levels for public access systems.

I almost couldn’t believe that I finally got the project working; albeit the code is ugly and error checking is scarce but I’m impressed that I finally managed to build something useful with C++. You can only get so far with Hello World. It was also great to see people nod in appreciation when I demonstrated it.

It’s nice to feel useful every now and then. ;)

Oh yeah, I also ruined a batch of Cream of Wheat. It turns out I didn’t burn it – I just didn’t add enough Cream of Wheat. When it failed to thicken after 2.5 minutes I chalked it up to the lack of salt (a bonehead conclusion on my part). I didn’t realize that I grabbed a 1/4 cup instead of 3/4 cup. Oh well.

I also received a very thought provoking email reply from my brother. I’ll have to mention that again when I feel like writing more.

Fall feeling in the air

Tuesday, September 16th, 2008

I rushed outside this morning (running behind) to find the air crisp and feeling very much like my favorite season on the way.

Work was “work” and progress seemed to crawl along. I managed to complete (let’s hope) a Python script to inject binary values into two registry keys depending on what system it runs on. The keys represent “mail boxes” for locked printer jobs.

The hex encoded binary string is 8176 characters long (only stating it because I’m sort of amazed at the length) and contains all settings for that printer. I wonder if the devs realized that breaking individual settings out into subkeys would be a good thing?

Oh well.

I’m also making good progress on an audio volume limiter (governor). It’ll run every X seconds and make sure that the various mixer volume levels are within a set threshold. If not the volume controls will be lowered to the maximum allowed.

The concept and pseudocode is pretty simple, but dealing with the WinAPIs is another story.

Thankfully I found an article showing how to set the master volume and I managed to get the waveOut code from there. I had no idea just how ugly working with ALL CAPS TYPEDEFS CAN BE. IT’S NOT LIKE IT MAKES IT HARD TO READ OR ANYTHING. I’m sure I’ll get used to it.

Hexen and Heretic Source code

Sunday, September 14th, 2008

Heretic and Hexen released as Free Software!

Woohoo!

Now if only I knew more about C Programming. :|

The good news though is that someone out there does and is into Heretic and HeXen too. It’s only a matter of time before a full functional build is produced.

More news mentions:

Additional/Related info:

I have to say I’m a bit shocked at the low numbers for the petition (doesn’t matter now). The Diablo III art style petition garnered thousands of signatures (over 50k as of this writing) but this one didn’t even top out at 1k. Even so, I suppose that is a fair amount of interest in games that are over a decade old.

An hour for this!?

Sunday, September 7th, 2008

I was working on my wiki and trying to figure out a way to make the footnotes more readable and get them to stand out more. I adjusted all of the footnote font sizes from 80% to 100% which helped quite a bit. I also made sure none of them were placed inside italicized text.

Last but not least I wanted them to stand out more. I recalled seeing a nice effect on the Subversion FAQ page where the selected FAQ had a red border. After attempting to read through the CSS and find the property (got hung up looking for a rules) I decided to Google it.

Found a bunch of neat sites such as this one: CSS Design: Taming Lists. Neat, but not quite what I was looking for.

It finally turned out to be this:

:target {
  border: 2px solid red; 
}

Figures.

C++ Standard update

Thursday, September 4th, 2008

Overview: C++ Gets an Overhaul

As I’m new, most of that is right over my head. What I do get out of it is they’re going to be adopting a lot of the Boost libraries. Little surprise there as I read a lot about the Boost libraries.

Here is one part that show how new I am to C++:

C++0x also removes some embarrassments from the language. For example, C++03 has at least three different forms of initialization:

1
2
3
int x=0;
int x(0);
int y[2]={1,2};

C++0x defines a unified initialization notation which can even be used in the declaration of dynamically allocated arrays:

1
2
3
4
5
6
7
8
int* a = new int[4] {1, 10, 20,95 };
vector<string> vs={"ab","cd","ef"};
 
class S {
 int arr[3];
public:
  S() : arr{ 1, 2, 3 } {}
};

I knew about the syntax for the first two in the list but had not seen the third or had seen it described differently. The last code block looks a little alien to me. Perhaps that’s just because my exposure to C++ classes is so limited.

Either way, this is definitely a month for change in the C++ world:

The vast number of new features forces the committee to work at an incredible speed. A clear statement of intent was made to complete work on the new standard at the San Francisco meeting of September 2008 in order to achieve publication in 2009.

Moving along

Monday, September 1st, 2008

Today I’ve fleshed out the Wiki a bit more and verified that it’s now accessible to the world. I had locked it down during setup and forgot this until I attempted to validate the feed to find out why the RSS widget wasn’t working. Nothing quite like looking at the problem from the outside. Literally. ;)

I’m going to concentrate on the C++ portion first as I’m attempting to learn that language now. I’m hoping by the end of the year to be able to do something useful with it. If nothing else I’d like to have a solid understanding of References, Pointers and Classes. I plan on adding my notes on the first two pretty soon.