Another gotcha but this time in the dialect that SQL Compact Edition 3.5 uses.
Version 3.5 introduced a couple of new features to make it's SQL more compatible with that of SQL Server and one of those is TOP.
Simple you'd think but oh on - they've decided to use a different dialect for the same command.
In SQL server you write:
SELECT TOP 10 [name] FROM [people] ORDER BY [name]
In SQL CE 3.6 you write:
SELECT TOP (10) [name] FROM [people] ORDER BY [name]
How annoying as it means that the same piece of SQL can't be used without a little translation layer. Why anybody though that wrapping the number of lines in parenthesis was a good idea I'll never know!
Tuesday, May 27, 2008
Shared Folders in Virtual PC 2007
I use Virtual Machines extensively but got caught this weekend with something I've not really found documented anywhere.
I was in the middle of restoring an 18GB Oracle 9i database, and rather than muck up my dev. machine I decided a virtual machine was the obvious answer.
All went well until I tried the Oracle "imp" tool to import the database from a "Shared Folder". It got part way through and complained of a corrupted backup file.
I tried again with a different version of Oracle and the same error occurred.
It turns out that the "Shared Folders" have a limitation on file size like that of FAT which I'm guessing is a 32bit pointer as 2GB seems to be the limit.
The simple answer to the problem is to map a network drive or use UNC but I was quite surprised that the facility of the VM additions failed in such a strange way.
I was in the middle of restoring an 18GB Oracle 9i database, and rather than muck up my dev. machine I decided a virtual machine was the obvious answer.
All went well until I tried the Oracle "imp" tool to import the database from a "Shared Folder". It got part way through and complained of a corrupted backup file.
I tried again with a different version of Oracle and the same error occurred.
It turns out that the "Shared Folders" have a limitation on file size like that of FAT which I'm guessing is a 32bit pointer as 2GB seems to be the limit.
The simple answer to the problem is to map a network drive or use UNC but I was quite surprised that the facility of the VM additions failed in such a strange way.
Saturday, May 17, 2008
Immediacy <head> gotcha
I'm currently doing some Immediacy customisation work using templates developed by an Immediacy partner.
I was getting a very strange effect on one particular page when hitting a search button that did a form post... basically the CSS got lost.
I checked the templates thoroughly and couldn't see the problem but when comparing the page before and after a post I noticed that the lines in the head tag had mysteriously had their "href" attributes changed. It appears that something within the Immediacy page pipeline attempts to "play" with the contents of the head tag and on postback it makes a right mess.
I'm guessing it's to do with the themes support within Immediacy as even on a standard page there are a bunch of injected <link> elements picking up CSS from a handler and what it appeared to be doing on postback was moving the href attributes from elements in the template to the next sibling - I even ended up with <meta> tags with a href's pointing to CSS files!
The solution to the issue is to ensure that the head tag, which normally reads as:
<head runat="server">
Is attributed without viewstate and therefore reloaded from the original ASCX file each time.
<head runat="server" enableviewstate="false">
This has now solved the issue, and on further investigation I found that more than just this one page was being affected but due to the CSS in the template it wasn't quite so obvious. I've simply done a search and replace on all templates in the solution and replaced the head tag as above - problem solved.
I was getting a very strange effect on one particular page when hitting a search button that did a form post... basically the CSS got lost.
I checked the templates thoroughly and couldn't see the problem but when comparing the page before and after a post I noticed that the lines in the head tag had mysteriously had their "href" attributes changed. It appears that something within the Immediacy page pipeline attempts to "play" with the contents of the head tag and on postback it makes a right mess.
I'm guessing it's to do with the themes support within Immediacy as even on a standard page there are a bunch of injected <link> elements picking up CSS from a handler and what it appeared to be doing on postback was moving the href attributes from elements in the template to the next sibling - I even ended up with <meta> tags with a href's pointing to CSS files!
The solution to the issue is to ensure that the head tag, which normally reads as:
<head runat="server">
Is attributed without viewstate and therefore reloaded from the original ASCX file each time.
<head runat="server" enableviewstate="false">
This has now solved the issue, and on further investigation I found that more than just this one page was being affected but due to the CSS in the template it wasn't quite so obvious. I've simply done a search and replace on all templates in the solution and replaced the head tag as above - problem solved.
Tuesday, May 13, 2008
SQL Server Locks
A better alternative to sp_lock with information about the locks in the current database:
SELECT
li.req_spid As "Session ID",
o.[name] AS "Object Name",
i.[name] AS "Index Name",
v.[name] As "Lock Type",
u.[name] As "Lock Mode"
FROM
master..syslockinfo AS li
INNER JOIN master..spt_values AS v ON li.[rsc_type] = v.[number] AND v.[type] = 'LR'
INNER JOIN master..spt_values AS u ON li.[req_mode] + 1 = u.[number] AND u.[type] = 'L'
INNER JOIN sysobjects AS o ON o.[id] = li.[rsc_objid]
LEFT OUTER JOIN sysindexes AS i ON i.[id] = li.[rsc_objid] AND i.[indid] = li.[rsc_indid]
WHERE
li.rsc_dbid = db_id()
ORDER BY
o.[name],
i.[name],
v.[name] desc
Wednesday, May 07, 2008
Huawei E220 USB HSDPA Modem
Finally someone has managed to get the Huawei E220 Vista 64bit drivers working on Windows XP 64.
Hurrah!
Much kudos to you whoever you are.
Hurrah!
Much kudos to you whoever you are.
Subscribe to:
Posts (Atom)