Skip to content

Categories:

Using the MySQL IN expression where there are NULL values

If you try to use the MySQL IN or NOT IN expressions in your query where the list of values includes NULL, you will find MySQL ignores the null records.  For example:

Table_A      Table_B
=======      =======
ID           ID
--           --
1            1
2            2
NULL         NULL

SELECT ID
   FROM Table_A
   WHERE ID IN (SELECT ID FROM Table_B);

ID
===
1
2

You can see that the null value is missing. This is normal behaviour and complies with SQL standards, but what if you needed null values to appear? You can add an OR condition that includes nulls only if they appear in the destination table. A little inefficient, but it works. It can be achieved like this:

SELECT *
    FROM Table_a
    WHERE ID IN (SELECT ID FROM Table_B)
OR (ID IS NULL AND (SELECT COUNT(*) FROM Table_B WHERE ID IS NULL) > 0);

ID
===
1
2
NULL

Success.

Posted in Uncategorized.


Xerox WorkCentre 228 and Windows 7 64 bit

These instructions detial how to set up a Windows 7 64 bit computer to use a Xerox Workcentre 228 printer connected to the LAN.

Prerequisites:

The printer needs some settings set first.  Log into the printers UI using a web browser and set these settings:

  1. NETBIOS name 1 – Must be blank
  2. Printer class – PCL/PC Kit

Instructions:

  1. Download and install the Xerox Global Print Driver for Windows 7 x64
  2. Follow the isntructions to install the printer (eg: enter the IP address, give it a name, choose the Xerox driver, etc)
  3. Once installed, under “Devices and Printers” right click the printer and select “Printing Preferences”
  4. Under “Paper/Output” tab, change “Ouput Color” to “Black and White”
  5. Under “Advanced” tab -> “Document Options” -> “Image Options”, change the “Graphics Mode” to “Raster”
  6. Apply that change
  7. Right click the printer again in “Devices and Printers” and select “Printer Properties”
  8. Go to the “Advanced” tab
  9. Uncheck “Enable advanced printing features”
  10. Click the “Print Processor” button
  11. Select winprint -> NT EMF 1.003 (NOTE THIS MAY NOT BE REQUIRED.  TRY WITHOUT FIRST)

Posted in Uncategorized.


Migrating from Visual Source Safe (VSS) to Subversion (SVN) using VSS2SVN – Step by step

These are my notes for using the VSS2SVN tool to migrate a project from Visual Source Safe to Subversion. These notes were tested using Windows 7 32bit edition.

  1. Download and install VisualSVN Server version 1.6. It’s very important to install version 1.6 for the purposes of the migration. This version is very old but is required for the VSS2SVN application. VisualSVN luckily make all previous versions available so this is very handy.
  2. Download and install VSS2SVN.
  3. Make a copy of your SourceSafe database. This is the directory where VSS has been storing all your revision data. In this directory will be a file called “srcsafe.ini”. Don’t work with the original unless you like taking risks.
  4. Open the VisualSVN Server interface.
  5. Select “Create new user”
  6. Create a user account for yourself
  7. Right click on “Repositories” and chose “Create New Repository…”
  8. Enter a name corresponding to the name of the project you are migrating. Select “Create default structure”.
  9. I don’t get it and I don’t know why, but you must set a pre-revision property change hook. Right click your repo and choose “Properties”. Go to the “Hooks” tab, click “Pre-revision property change hook” and click “Edit”. In the textbox enter: exit /b 0
  10. Now we need to analyse your VSS repo becuase most of the time there are corruptions and VSS2SVN wont work if thats the case. From the command line enter:
    • "C:\Program Files\Microsoft Visual SourceSafe\analyze.exe" -F -V3 -D "c:\path\to\your\copy\of\the\sourcesafe\database\'data'\directory"
  11. If that step fails, your VSS database might be too corrupt to migrate (or even use)
  12. Check out a working copy of the Subversion repository you just created. From the command line enter:
    • "C:\Program Files\VisualSVN Server\bin\svn" co http://<HOSTNAME>/svn/<REPO NAME>/trunk/ c:\path\to\working\copy
  13. Now open VSS2SVN. Enter the following settings:
    1. Path to Scrsafe.ini: Enter the path to srcsafe.ini in your copy of the VSS database you made
    2. Username: The username you created in VisualSVN
    3. Password: The password you chose when creating the user in VisualSVN
    4. VSS project to use: Enter a dollar symbol ($) followed by a backslash (\) followed by the name of your VSS project as can be found using the Visual SourceSafe Explorer that comes with VSS. Eg: $\MyProject
  14. Click “Find files in source safe”. If you get an error saying a weird file like nbaaaaaa.b was not found, your VSS repo is probably corrupt and you need to run the analyse tool as mentioned above.
  15. For “Working Directory” enter the path to your Subversion working directory you created when checking out above.
  16. For “SVN path to use” enter URL of the trunk of your Subversion repositiory you created. Eg: http://<HOST NAME>/svn/repos/<REPO NAME>/trunk/
  17. Click “Migrate to subversion”
  18. Sit back; it might take a while

After you’ve migrated all your projects, it would advisable to upgrade your VisualSVN and Subversion.

Posted in Uncategorized.


Ultimate PHP error reporting wizard

Instructing PHP which errors it should report on is not straightforward. You have to understand binary and bitwise operators. I decided to make a tool that takes the hard work out of it so you can get on with your job creating your web app. Enjoy.

http://www.bx.com.au/tools/ultimate-php-error-reporting-wizard

Posted in Uncategorized.


Super Mario Bros on guitar – 80s metal style!

Super Mario Bros on guitar – 80s metal style!

Posted in Uncategorized.


Trend.bz – The top internet trends in one place

Trend.bz combines a whole heap of the top internet trends into one location.  Check out what’s hot on the internet right now including the top YouTube videos, the top Google searches, the top eBay items and more.

http://trend.bz

Posted in Uncategorized.


Stop Outlook from formatting phone numbers

In Australia, mobile numbers are formatted like this:

0499 999 999

If you out that into an Outlook contact record, it will most likely format it in another stupid way.

You can stop Microsoft Outlook from automatically formatting phone numbers in Windows 7 by:

  1. Clicking “Start” and search for “dialing rules”
  2. Select “Set up dialing rules”
  3. Edit the entry for “My location”
  4. Set the area code to 1
  5. Click ok twice

Outlook will stop formatting phone numbers.  It’s a similar procedure on Windows Vista and XP.

Posted in Uncategorized.


Create a htaccess file in Windows

Creating a .htaccess file using Windows is easy, just put double quotes around the file name when saving.

For example, if you are using Notepad:

  1. Click File -> Save As
  2. Enter the filename as: ".htaccess" (with the double quotes)

Posted in Uncategorized.

Tagged with .


Apache: Using htaccess to restrict access to a file

As well as being able to restrict access to directories, you can restrict access to specific files using htaccess files in Apache.

For example, to protect “secret.php” using basic auth:

AuthType Basic
AuthName "Authorised users only"
AuthUserFile /path/to/user/file
AuthGroupFile /path/to/group/file
<files secret.php>
Require user xxxx
</files>
 

Posted in Uncategorized.

Tagged with .


OnClientClick and ASP.NET Validator controls

If you use ASP.NET validator controls and try to use OnClientClick event, you will find that the validator wornt run. The solution is to add this to your javascript code:

if(Page_ClientValidate())

From: http://alvinzc.blogspot.com/2006/10/aspnet-requiredfieldvalidator.html

Posted in Uncategorized.

Tagged with , , .