Icon

T-SQL Only return date in a date time.

Every once in a great while I need to just return the date of a date time and forget about the time part of it.

SELECT CAST(FLOOR(CAST(getDate() AS FLOAT)) AS DATETIME) as MyDate

Obviously you can replace getDate() with a column.

Play Freecol from SVN

Want to run the latest version of the excellent open source game freecol?

Here’s how on windows:

1. Make sure you have Java SE/ jdk installed, http://java.sun.com/new2java/downloads/index.jsp

2. Download and install ANT. http://ant.apache.org/bindownload.cgi

3. Make a directory for freecol source to reside.

Now, whenever I want to run freecol, I made this little .bat file to ensure I have the latest version:

cd “C:\Documents and Settings\justin\freecol_svn”
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_13
set ANT_HOME=C:\ant\bin
svn co https://freecol.svn.sourceforge.net/svnroot/freecol/freecol/trunk trunk
cd trunk
C:\ant\bin\ant clean
C:\ant\bin\ant
java -Xmx128M -jar FreeCol.jar –windowed

cd “C:\freecol_svn”

set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_13

set ANT_HOME=C:\ant\bin

svn co https://freecol.svn.sourceforge.net/svnroot/freecol/freecol/trunk trunk

cd trunk

C:\ant\bin\ant clean

C:\ant\bin\ant

java -Xmx256M -jar FreeCol.jar –windowed

enjoy!

First Days of AnkhSVN

Where I’ve worked we’ve been long time Visual Source Safe users. Everytime a new version of Visual Studio would come out, we’d quickly grab it from Microsoft, cross our fingers, and pray for a new version of Visual Source Safe.

It never came. Rarely did they even slap some lipstick on it.

So, we’re moving out of the slums. This week a Ubuntu 8.04 virtual machine was created (that’s a story for another day) and we installed the latest copy of SVN.

We toyed with the idea of running SVN and Apache on a Windows Server, but if you’re going to do something, you might as well do it right. Cue Mike Holmes.

Anyhow, for those few VSS users out there, so far we like AnkhSVN. I’ve got a copy of TortoiseSVN, but right not that’s just too far away from what I’m used too.

It’s nice to not have to ask someone to check in a file to make a quick chance. It’s nice to know we can FINALLY do some branching. We’re excited, but a little timid. I’ve had no luck getting our webservices into SVN, since the solution file exists seperate of the webservice itself. Right now I’m going to sit on this issue till I know a little more, but this will have to be solved.

I did run into one issue, when I moved my project from VSS to SVN and then to AnkhSVN, everytime I tried to save in Visual studio I kept getting a cannot save this file is write-protected. And it didn’t look like an IDE message, it looked like it was from Ankh. The internet was no help, nor were their forums. Finally, I wondered, maybe these files are still set read-only from their fiefdom under VSS. They were. I went through each of my local files, removed the read only flag, and I’m back in SVN bliss.

It wasn’t an easy journey with getting the SVN server up on a virtual machine, but things are looking up.

Oh, by the way! I tested both AnkhSVN and TortoiseSVN for the dreaded Empty Click Once bug, neither caused any trouble so far.

Database Mail not responding…

Yesterday we had a freak outage of database mail. Our SQL Server 2005 on our Server 2008 machine decided to just queue up all the mail, and not send anything out for several hours.

There were a few errors in the database mail log, like Mail Server not responding, but I verified at the time the mail server was fine. Plus the errors ended hours prior but no mail was going out.

Here’s my simple fix. Using query anaylizer I checked the items in the mail queue by running the following on the MSDB database:

exec sysmail_help_queue_sp @queue_type = ‘Mail’ ;

To double check the actual items, I ran the following query:

SELECT top 500 * FROM sysmail_allitems where sent_date > DATEADD(day, -1, getDate()) order by sent_date DESC

Once I was satisified that it was the database mail’s failure and not my application or the webservice, I did the scary task of hitting CTRL-ALT-DEL on the server, and killing “DatabaseMail90.exe”. It instantly restarted itself and proceeded to send out all items in the queue. It’s been fine ever since.

I did the end process because no matter what restart command I could find it would not respond, it was just hang there. So, this seemed to work quite well.

Make Images Look Like They Do In The WordPress Editor!

I love how images look in the new wordpress editor found in v2.6+. But when I hit publish, they looked pretty weak. Here, I thought it was just how the theme I used wanted images to look very minimal. Turns out it’s something you’ll need to add to the majority of your theme’s stylesheets. Glad I looked it up before I went messing around with my theme.

Further reading: Floating Images within the post in WordPress 2.6 (wprocks.com) Thanks Sadish!