Archive for 2010

“this operation has been canceled due to restrictions in effect on this computer”

Wednesday, September 15th, 2010

If you get the following message when clicking links on Outlook (2003, 2007, 2010):

“This operation has been canceled due to restrictions in effect on this computer. Please contact your system administrator”

It is most likely that your browser’s association has become corrupt in some way.

I found the easiest way to cure this was to ensure the htmlfile registry key was correctly set up:
You will need to open regedit.exe and go to HKEY_Local_Machine\Software\Classes\htmlfile\shell\open\command

There should be a string value inside there called (Default) – in most cases it seems the following should work:
“C:\Program Files\Internet Explorer\iexplore.exe” -nohome

Make sure this is correct, close everything down and restart Outlook.

NB. make sure Outlook is completely closed – ie. OUTLOOK.EXE is no longer in task manager.

Microsoft support issue on the matter.

Usual disclaimer applies. Do this at your own risk. No warranty, etc. etc.

What does “afronding” mean on Dutch receipts?

Monday, August 16th, 2010

Dutch shops tend to round to the nearest 5 eurocents, so a bill coming to €4.89 would be rounded to €4.90. This is shown as afronding – literally, “rounding” – a correction of up to two cents either way.

The net result is that 1 and 2 eurocent coins in the Netherlands are rare (although they are still in circulation).

I’m not sure quite when the decision was made to do this; I’ve been aware of it for a few years now and, frankly it’s a great way to cut down on coppers.

If the price was, say, €4.87 then it would be rounded down to €4.85 – ie. the customer “gains” two cents. This should balance out but I suppose it depends on the use of psychological prices (the whole 99 cent pricing strategy clearly works in the shop’s favour) and how many items you buy (three items at 99 cents each would benefit the customer).

Somebody, somewhere has earned a PhD from this I’m sure!

I would be curious to know if there have been other effects of this. Are charity pots (not that I’ve seen any) less full as a result?

“This site is running TeamViewer”

Monday, August 16th, 2010

Beware if you decide to use TeamViewer, a remote control app. It appears to launch a webserver on port 80 I think for some kind of NAT/firewall detection. In any case, if your computer is also used as a webserver this will cause a few issues :-)

The solution I have found (for Teamviewer 5 Windows) is to close the program (right click and exit; make sure it’s completely closed). Then open the registry editor (Start menu > Run > regedit) and find your way to the following registry entry:
HKEY_LOCAL_MACHINE\Software\Teamviewer\Version 5\
and change ListenHttp from 1 to 0.

You must close Teamviewer first, I found that if you change it while Teamviewer is still running, the setting will be reset (back to 1) when the program is next closed.

Copy Database in SQL Server 2008

Friday, July 23rd, 2010

You want to copy a database, maybe for development purposes? Try this: It is based on this code by Michael Schwarz, but updated for SQL Server 2008:

USE master
GO

-- the original database (use 'SET @DB = NULL' to disable backup)
DECLARE @DB varchar(200)
SET @DB = ''

-- the backup filename
DECLARE @BackupFile varchar(2000)
SET @BackupFile = 'c:\temp\backup.dat'

-- the new database name
DECLARE @TestDB varchar(200)
SET @TestDB = 'MydatabaseDevelopment'

-- the new database files without .mdf/.ldf
DECLARE @RestoreFile varchar(2000)
SET @RestoreFile = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\MydatabaseDevelopment'

-- ****************************************************************
-- no change below this line
-- ****************************************************************

DECLARE @query varchar(2000)

DECLARE @DataFile varchar(2000)
SET @DataFile = @RestoreFile + '.mdf'

DECLARE @LogFile varchar(2000)
SET @LogFile = @RestoreFile + '.ldf'

IF @DB IS NOT NULL
BEGIN
SET @query = 'BACKUP DATABASE ' + @DB + ' TO DISK = ' + QUOTENAME(@BackupFile, '''')
EXEC (@query)
END

-- RESTORE FILELISTONLY FROM DISK = 'C:\temp\backup.dat'
-- RESTORE HEADERONLY FROM DISK = 'C:\temp\backup.dat'
-- RESTORE LABELONLY FROM DISK = 'C:\temp\backup.dat'
-- RESTORE VERIFYONLY FROM DISK = 'C:\temp\backup.dat'

IF EXISTS(SELECT * FROM sysdatabases WHERE name = @TestDB)
BEGIN
SET @query = 'DROP DATABASE ' + @TestDB
-- EXEC (@query)
END

RESTORE HEADERONLY FROM DISK = @BackupFile
DECLARE @File int
SET @File = @@ROWCOUNT

DECLARE @Data varchar(500)
DECLARE @Log varchar(500)

SET @query = 'RESTORE FILELISTONLY FROM DISK = ' + QUOTENAME(@BackupFile , '''')

CREATE TABLE #restoretemp
(
LogicalName varchar(500),
PhysicalName varchar(500),
type varchar(10),
FilegroupName varchar(200),
size int,
maxsize bigint,
x1 nvarchar(1),
x2 nvarchar(1),
x3 nvarchar(1),
x4 uniqueidentifier,
x5 int,
x6 int,
x7 bigint,
x8 int,
x9 int,
x10 nvarchar(1),
x11 bigint,
x12 uniqueidentifier,
x13 int,
x14 int,
x15 nvarchar(1)

)
INSERT #restoretemp EXEC (@query)

SELECT @Data = LogicalName FROM #restoretemp WHERE type = 'D'
SELECT @Log = LogicalName FROM #restoretemp WHERE type = 'L'

PRINT @Data
PRINT @Log

TRUNCATE TABLE #restoretemp
DROP TABLE #restoretemp

IF @File > 0
BEGIN
SET @query = 'RESTORE DATABASE ' + @TestDB + ' FROM DISK = ' + QUOTENAME(@BackupFile, '''') +
' WITH MOVE ' + QUOTENAME(@Data, '''') + ' TO ' + QUOTENAME(@DataFile, '''') + ', MOVE ' +
QUOTENAME(@Log, '''') + ' TO ' + QUOTENAME(@LogFile, '''') + ', FILE = ' + CONVERT(varchar, @File)
EXEC (@query)
END
GO

Usual caveats apply, backup before running, etc.

SQL Server Notes

Friday, May 28th, 2010

For fans (or reluctant users) of SQL Server – here is a quick and easy way to get approximate table sizes for a database:


USE [dbname]
GO
CREATE TABLE #temp (
table_name sysname ,
row_count INT,
reserved_size VARCHAR(50),
data_size VARCHAR(50),
index_size VARCHAR(50),
unused_size VARCHAR(50))
SET NOCOUNT ON
INSERT #temp
EXEC sp_msforeachtable 'sp_spaceused ''?'''
SELECT a.table_name,
a.row_count,
COUNT(*) AS col_count,
a.data_size
FROM #temp a
INNER JOIN information_schema.columns b
ON a.table_name collate database_default
= b.table_name collate database_default
GROUP BY a.table_name, a.row_count, a.data_size
ORDER BY CAST(REPLACE(a.data_size, ' KB', '') AS integer) DESC
DROP TABLE #temp

…and a way to list all column specs…

USE [dbname]
GO
CREATE TABLE #temp (
table_name sysname ,
row_count INT,
reserved_size VARCHAR(50),
data_size VARCHAR(50),
index_size VARCHAR(50),
unused_size VARCHAR(50))
SET NOCOUNT ON
INSERT #temp
EXEC sp_msforeachtable 'sp_spaceused ''?'''
SELECT a.table_name,
b.COLUMN_NAME, b.COLUMN_DEFAULT, b.IS_NULLABLE, b.DATA_TYPE, b.CHARACTER_MAXIMUM_LENGTH
FROM #temp a
INNER JOIN information_schema.columns b
ON a.table_name collate database_default
= b.table_name collate database_default
--GROUP BY a.table_name, a.row_count, a.data_size
ORDER BY CAST(REPLACE(a.data_size, ' KB', '') AS integer) DESC
DROP TABLE #temp

For this you could also SELECT * FROM information_schema.columns

Original code from http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/

Coastline Features in Google Maps

Sunday, February 28th, 2010

harboursGoogle Maps appears to be promoting coastline features and bodies of water above major cities in its terrain view. Far enough out, you will see harbours and banks; further in the usual littering of cities takes over.

Interesting for the fact somebody has clearly decided this is a better way to help people navigate in this view – maps and satellite views both continue to show cities at all zoom levels.

Separately, while coverage of Street View in the UK continues to grow (large chunk of north-west Scotland, and more motorways), I’m wondering when they’ll get round to adding the photos presumably taken while the cars were in Fareham and Petersfield summer last year…

Freecom Hard Drive Protection

Thursday, February 25th, 2010

I recently bought a Freecom ‘ToughDrive’ hard disk from eBuyer. It came with some virtual CD drive that automatically installed a Password utility.

Whenever I used other USB drives, the computer locked up. Not sure whether the Freecom software was to blame (it became unresponsive when I tried to reset), but still – I’m a bit of a tidy freak for startup processes, so anything that installs automatically is not likely to make me happier!

Anyway, this website appears to offer a CD removal tool, which should do the trick – just make sure you pay attention to the model number.