0xBAADF00D

Where good things happen to bad code…

 
 
Jan 10
3
2010

Recently I starting having problems burning DVDs, specifically DVD-Rs at my burner’s max speed in Nero Buring ROM 6.6. The exact error I was getting was:

“Power calibration error”

I didn’t change my buring process, or the type of stuff I was backing up, and I didn’t change the media I normally use. So I just thought my burner was dirty, or was failing. It was going on somewhere near 5 years and I use it a lot. Having it fail was a distinct possibility. So I started searching around the net and reading in forums to try to understand what could be causing the problem. It was looking more and more like hardware failure.

Then by chance I used ImgBurn, and I saw the following warning in the log:

“SPTD can have a detrimental effect on drive performance.”

So I decided to do some more digging and found out that SPTD stands for SCSI Pass-Through Direct. Which is a device driver developed by Duplex Secure Ltd which provides a new method of access to storage devices. It is something used by Daemon Tools, which I had installed not to long ago to do some work with ISO images, and then promptly forgot about.

So I uninstalled Daemon Tools and tried to burn another disc. I was surprised to find that the burn failed again with the same error. I took a look in my registry, in the drivers section to see that SPTD was still installed and there was no clear way to remove it.

So it was back to searching through forums. I found a few posts that described messy manual ways of removing the driver from the system. The best way I found was to download the driver installer from: www.duplexsecure.com and then when prompted, click the ‘uninstall’ button.

After a reboot, no more problems burning DVDs at any speed or media format. What a long and painful road…

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter
Nov 09
12
2009

So I pretty much live on the command line in windows ( cmd.exe ), call me old fashioned, but I like the power and flexibility. One thing that irritated me is that, by default, my input prompt keeps shifting right with the length of my directory tree and I have less and less room to enter my commands. What I really want is something that looks like this:

[9:46]::[C:\temp]
:

Where the colon ‘:’ is my input prompt and takes up very little room.

This can easily be accomplished with the PROMPT command in the command shell:

PROMPT [$T$H$H$H$H$H$H]:$M:[$P]$_:

What the above example says is create a prompt with the time which looks like this:

11:19:15.24

Then use $H which is backspace to delete the last 6 characters, so we are left with:

11:19

the $M is just a nice to have feature that lists the name of the remote drive you are on, if that is the case, and the $P lists the current drive and path.

The last thing is the $_ which adds a carriage return and line feed, which gives you the clean line to type your input on.

That’s all there is to it, you can use this page to add your own tweaks..

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter
Nov 09
4
2009

While cleaning up my command line tools package DSToolBox I ran across a bug while upgrading to the latest release of TCLAP. Which is a header only template library for command line parsing.

One of the cooler aspects of the library is that it can handle all kinds of type conversions for you so you don’t have to worry about casting them yourself.

This feature is what caused the problem when compiling with the Zc:wchar_t- compiler switch in VC8.

The switch sets the ‘Treat wchar_t as Built-In type’ option to ‘No’.

This is all well and good until we have two templates that resemble the example below:

template<>
struct ArgTraits<wchar_t> {
typedef ValueLike ValueCategory;
};
 
template<>
struct ArgTraits<unsigned short> {
typedef ValueLike ValueCategory;
};

Since wchar_t is no longer treated as a built in type by the compiler, it falls back ( basically ) to:

typedef unsigned short wchar_t;

This causes the compiler to complain with:

error C2766: explicit specialization; ArgTraits<unsigned short>' has already been defined

Since we want to have the library support both types if wchar_t is a real type we can use built in defines to #ifdef it out:

#ifdef _MSC_VER
    #ifndef _NATIVE_WCHAR_T_DEFINED
        #define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
    #endif
#endif
 
#ifndef TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
 
template<>
struct ArgTraits<wchar_t> {
typedef ValueLike ValueCategory;
};
 
#endif

This way if wchar_t is a built in type we get both template specializations, but if it isn’t we only get one.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter
Nov 09
3
2009

A few years ago I did some work adding text-to-speech capabilities to the WinFrotz2002  inform interpreter by David Kinder called, simply enough, WinFrotzTTS  2002. The visually impaired gaming community took an interested and I was suddenly in the position of doing support. So I thought the best thing to do was quickly put together a web site to manage all the support stuff. So people could share information and I could advertise a bit about the project.

Back then PHP-Nuke was the CMS to use so that is what I installed, along  with Gallery for screenshots  and phpBB for forums.

Time passed and activity on the site dropped way off, to the point where the only thing really being used was the downloads.

I pretty much forgot about it, until the bots found the site and defeated the captcha. All of the sudden there were hundreds of new accounts along with thousands or comments and posts.

So I shut down registration and began my clean up.

Cleaning up the bogus accounts and forum posts was easy. It was a simple SQL statement in phpMyAdmin, and poof, they were all gone.

But the Gallery was a completely different story, and this is where the fun starts..

Gallery stores album info in flat files in your albums directory. In my case the file I was interested in was photos.dat. This contained all the comments for the 7 images I had posted. I could have deleted them with the admin interface, but there were close to 25k comments. Unfortunately the file was just an output of a php object serialization. I suppose I could take the time to do this elegantly with php. But I had about an hour to get it done and didn’t want to invest much to save a gallery with 7 images, I wanted a quick fix.

So here is what I did.

I brought the photos.dat file into the editplus editor and added new lines before and after every ‘{‘ and every ‘}’, otherwise it is next to impossible to read.

Next I looked for the start of a comments block:

s:8:"comments";

Then it is followed by the comments array:

a:1:{i:0;O:7:"Comment":5:{s:11:"commentText";s:31:"Just testing the comment system";s:10:"datePosted";i:1257276467;s:8:"IPNumber";s:14:"179.42.278.176";s:4:"name";s:9:" (user)";s:3:"UID";s:14:"none";}}

the a:1 says that the comment block is an array with one element, if there were 50 comments it would say a:50.

So the next thing I did was remove every thing in the array and set the size to 0:

a:0{}

Then I went to the next comment block in the file and did the same exact thing.

I then went back and removed the new lines from before and after the ‘{‘ and the ‘}’ so the text was all in one long line.

I copied the file back up to the server and presto, no more comments.

Hope that helps anyone in a similar situation.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter

Search

DreamCycle

Categories

Recent Posts

Recent Comments

    Archives

    Actions