Archive for March, 2012

DjDoom v0.1 Released

Version 0.1 of DjDoom has been released and can be downloaded from here.

DjDoom is a reference implementation for the original Doom game engine that I have been working on for a little while. The purpose of this project is to build a playable Doom engine from the original Linux source code with minimal changes necessary to build and run in a Windows environment. This was created as a learning tool for me and I’m publishing this so it can be a learning tool for others. It is intended that this be a base for others to build and expand on.

I deliberately chose to not use any third party libraries to handle sound, input and graphics and instead used only what is usually available on a typical Windows platform. I use DirectX 8 for graphics and input (including keyboard, mouse and joystick). The sound utilities took the most effort to write since Windows does not make it easy to play MIDI music and sound effects. Learning to use the Windows Multimedia APIs to play MIDI resulted in a few other articles on this blog.

The game engine is built on Windows using MinGW. You will also need the DirectX 8 SDK. Newer DirectX no longer includes Direct Draw and won’t work for this code. DirectX 8 SDK comes with Windows Game Programming for Dummies, Second Edition which is where I got it from. The original DooM code was released by iD Software under the GPL. The additions I made are released under a more permissive MIT license.

Further reading:

Tags: , , , , , , , , ,

Tuesday, March 6th, 2012 C, DirectX, Programming No Comments

Error creating JAXB bindings

While creating some JAXB bindings from some XSD files I have I ran into an error like the following:

$ xjc -p com.foo.data.import foo.xsd -d out
[ERROR] The package name 'com.foo.data.import' used for this schema is not a valid package name.

What is the cause of this error? That would be the keyword “import” in the package name. You just can’t use a reserved word in a package name no matter how much you really want to!

Further reading:

Tags: , , , , ,

Monday, March 5th, 2012 Java, Programming, XML No Comments

Viewtron: From the AT&T Archives

Do your shopping, banking and get messages right in your living room. You can also play games, get up to the minute stock quotes, recipes. Why waste time driving to the store or library when you could be using that for quality time with your family. School work is a breeze with instant access to books and encyclopedias at the touch of a button. In 1983, the future is here NOW!

ITworld had a great article about the Viewtron system which gave people access to information, online shopping and banking and much of what the Internet is today. This was in 1983. Cool stuff!

Tags: , , , , , , , , , , , ,

Saturday, March 3rd, 2012 Uncategorized No Comments

T-SQL Incorrect syntax near ‘ERROR_MESSAGE’

Working on Microsoft SQL Server 2005 I was trying to raise an error doing the following:

BEGIN CATCH
	...

	RAISERROR(ERROR_MESSAGE(), ERROR_SEVERITY(), ERROR_STATE());

END CATCH

Looks pretty straight forward to me. So why the Incorrect syntax near 'ERROR_MESSAGE' error? Poking around the net it seems parameters passed to RAISERROR must be a constant or a variable. You cannot pass a function return value directly as a parameter. Even though I’ve seen examples like this one that use the above syntax, they don’t actually work.

The correct way to write the above is like this:

BEGIN CATCH
	DECLARE @ErrorMessage NVARCHAR(4000);
	DECLARE @ErrorSeverity INT;
	DECLARE @ErrorState INT;
	...

	SELECT
		@ErrorMessage=ERROR_MESSAGE(),
		@ErrorSeverity=ERROR_SEVERITY(),
		@ErrorState=ERROR_STATE();

	RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
END CATCH

Further reading:

Tags: , , , ,

Friday, March 2nd, 2012 Database, SQL Server No Comments