Check whether text is UPPER case in T-SQL

I have prepared small snippet which will help you check whether some text is UPPER case in T-SQL. I have not found any good example while Googling. You can easily update to code to check whether the text is lower case by replacing UPPER with LOWER in the snippet.

DECLARE @Name AS NVARCHAR(64)
SET @Name = 'NAME'

IF BINARY_CHECKSUM(@Name) = BINARY_CHECKSUM(UPPER(@Name))
SELECT 1;
ELSE
SELECT 0;

Remove old folders on Windows using batch script

I have found nice batch script which will remove all folders inside specific folder. This is good when you have some directory with automatic builds and want to remove old scripts from time to time.

ForFiles /P "BASE_FOLDER_PATH" /D -14 /C "CMD /C if @ISDIR==TRUE echo RD /Q /S @FILE &RD /Q /S @FILE"

Replace BASE_FOLDER_PATH with folder containing automatic builds and 14 with maximum number of days. Older folder will be removed.

MSSQL’s ISNULL in MySQL

I am unable to remember this and have to find it each time I need it. In MSSQL there is a great function called ISNULL. It has two parameters. If the first one is NULL it takes the second one. In MySQL ISNULL takes only one parameter and checks whether it is NULL or not. The real replacement for MSSQL‘s ISNULL in MySQL is IFNULL.

Change UUID of harddisk image file using VirtualBox

You may get the following error when importing existing image to the VirtualBox:
A hard disk with UUID {e9758c99-e50c-41c7-877f-f03c1454d136} or with the same properties (‘image.vhd’) is already registered.
This happens when you make copy of a virtual image and want to add it to VirtualBox, but the original image is also registered. To change the UUID use the VBoxManage utility installed with VirtualBox.

VBoxManage.exe internalcommands sethduuid image.vhd

Integrating Redmine with SVN

We are using Redmine in our company for issue tracking and SVN as a source control. As a client I use AnkhSVN primarily, because I am working inside Visual Studio most of the time. In this post I would like to show you plugins for AnkhSVN and TortoiseSVN which will help you assign your commits to specific issues in Redmine.
TortoiseSVN
I will start with plugin for TortoiseSVN. Download the correct version 32bit or 64bit and install it. After that go to the TortoiseSVN Settings > Issue Tracker Integration. Specify working path of your source codes and Atom URL from Redmine. To get Atom URL go to the project page and click on the Issues tab. You can define a view which will select the correct issues for example only those which are open and assigned to you. On the bottom of the page there is a Atom link, copy the address and paste it to the Issue Tracker Configuration Window.

After the Issue Tracker Integration is configured go to the folder with your source codes and try to commit some changes. You will see new button in the Commit window called Redmine Issues. Clicking on it will display window with all issues which can be selected and added to the Commit Message.

AnkhSVN
There is a plugin for AnkhSVN available too. After you install it open some project in Visual Studio. Right click the solution in the Solution Explorer and open Issue Tracker Setup. On the dialog select the new installed connector. After that fill in your credentials. Issue Repository URL is the base URL of Redmine. Click Update button and select your default project. Also make sure that the REST API is enabled in the Redmine Administration.

That’s it! You are now able to click on the Issues button in the Pending Changes window and select active issues.

How to download torrents anonymously

Your ISP may track your communication with tracker to see what your are downloading or block communication with tracker at all. The approach described uses an anonymisation proxy (JonDo) which will transfer all communication with tracker throw this proxy making you untrackable.

Prerequisites

Configuration
After you download both programs run them and go through the initial configuration. After you are finished open Vuze Options and switch to Advanced mode on the first page. Then type proxy in the bottom box. Click on the dimmed Proxy tab and configure it as displayed on the print-screen.

Save the changes and restart Vuze. If no error is displayed on start you should be fine and can start downloading anonymously ๐Ÿ™‚

How to rescue damaged harddisk

For the past three days I was trying to rescue a damaged disk of my colleague. I already knew about a great disk cloning tool called ddrescue in Linux. So this was the first step I did. After 20 hours of work the clone has been created, but with some errors during read. I was hoping that I will be able to boot from it after I put it back to the PC, but in this case there was some problem with the partition table, so Windows has not been even be able to recognize it as NTFS, even though Linux did!
I didn’t want to reinstall the system after so much hours spend on this, so I was looking for some other tools which could help me save the disk. There was a lot of suggestions on using some paid software, but I don’t have good experience with them.
Finally I found another great open source software called TestDisk. It is a command line tool, but I don’t care much if it helps ๐Ÿ™‚ Using this software I was able to recreate the partition table, after it found the lost NTFS partition and as soon as I restarted PC, Windows finally fixed the NTFS using chkdsk.

Running wuala in background with no gui

I have finally found a solution for my problem described in older post. Today I have found out that you can run Wuala without GUI. To do this you have to call wuala with the following parameter.

wuala -nogui

But only this is not enough. You have to also login to your account, because Wuala won’t auto login in this case. I have created a bash script which runs Wuala and as soon as it is initialized it logs you in.

#!/bin/sh

# Run Wuala with no GUI
wuala -nogui &

# Give Wuala some time to initialize
sleep 30

# Login
wuala login USERNAME PASSWORD

Change USERNAME and PASSWORD with your credentials and save this piece of code to /usr/bin/start-wuala.sh. Make it executable by calling sudo a+x /usr/bin/start-wuala.sh. After that you can put it to Startup Applications. But before you do that, you should setup your synchronization, because when Wuala starts in background you are not able to start another instance. To shutdown existing instance go to terminal and execute wuala shutdown.
You can also check status of the background process on the following address: http://127.0.0.1:33333/.

How to disable Cron e-mails in Webmin

Today I have setup some Cron job. The command is running under user nobody. After some minutes while this job has been running and executed I received e-mail with result of the job. This job was setup to run every 3 minutes, so I was getting those e-mails quite often.
After I have logged into Webmin to disable those e-mails I have noticed that there is no option to disable those e-mail notifications. Looks like it depends on the user under which the job is executed if he has some e-mail or not.
Anyway you can disable those e-mails by going to Scheduled Cron Jobs. On the page click on Create a new environment variable button. Select the same user as the one under which the job is running. As Variable name use MAILTO and do not fill anything into the Value field. Also make sure you leave Before all Cron jobs for user selected.
Finally you should not get any new e-mails ๐Ÿ™‚