Friday, May 23, 2008

Unicode and Large Data Types in SQL Server

Use nvarchar as a datatype in SQL Server 2005 to preserve unicode characters. Compare the following strings,
nvarchar: “hello” éЀЙẅç
varchar: “hello” é???ç

Varchar gets most but not all. Use nvarchar to be safe when working with international symbols.

Here's some good stuff I found on using unicode with SQL Server 2005, pay special attention to the Large-Value Data Types section:

Unicode Basics
The easiest way to manage character data in international databases is to always use the Unicode nchar, nvarchar, and nvarchar(max) data types, instead of their non-Unicode equivalents, char, varchar, and text.

Pasted from http://msdn.microsoft.com/en-us/library/ms187828.aspx


Using Unicode Data
Use of nchar, nvarchar, and ntext is the same as char, varchar, and text, respectively, except that:
· Unicode supports a wider range of characters.
· More space is needed to store Unicode characters.
· The maximum size of nchar columns is 4,000 characters, not 8,000 characters like char and varchar.
· The maximum size for nvarchar columns, using the max specifier, is 2^31-1 bytes. For more information about nvarchar(max), see Using Large-Value Data Types.

Pasted from http://msdn.microsoft.com/en-us/library/ms191200.aspx

Using Large-Value Data Types
Use varchar(max), nvarchar(max), and varbinary(max) data types instead of text, ntext, and image data types.

Pasted from http://msdn.microsoft.com/en-us/library/ms178158.aspx

Storage and Performance Effects of Unicode

Pasted from http://msdn.microsoft.com/en-us/library/ms189617.aspx

Monday, May 12, 2008

Remove the Blogger Navigation Bar

Posting this so I don't forget it again. If you want to hide the navigation bar on your blogspot blog, go into the Layout settings, click 'Edit HTML' and paste the following code right above the CSS definition for the body tag, probably right below where it says /* ---( page defaults )--- */ or /* Primary layout */.

#navbar-iframe {
height: 0px;
visibility: hidden;
display: none;
}


A solution to the problem of ColdFusion caching the table structure

After changing the structure of a table in the database, I'll sometimes get the following error:

[Macromedia][SQLServer JDBC Driver]Value can not be converted to requested type.

Or, I'll add a field to the table, but ColdFusion won't recognize the change.

After googling, I found this post: Odd Issue w/ CFQueryParam from Ray Camden, which puts to rest a lot of the mysterious behavior of ColdFusion query caching that has been haunting me for so long. Turns out it's triggerred by the presence of the CFQUERYPARAM tag. Here's the solution I found (thanks Eric!):

The solution: due to caching of the odbc driver, you do NOT have to restart CF.

1. Go in the settings of the current datasource an UNCHECK 'Maintain Connections' --> submit the change

2. Rerun the page with the changed view/table/sp and make sure it's running fine.

3. Go back into the odbc settings an re-enable the 'Maintain Connections' --> submit the change

4. done!

Now everything should be working fine without restarting CF where a lot more i cached, like templates etc.


To get to the Maintain Connections option, I had to click on 'Advanced Settings' in the datasource properties in CFAdmin.

I can finally stop adding random spaces or tabs in my queries to stop ColdFusion from using the cached copy!

Friday, January 18, 2008

Friday, December 21, 2007

Technology Flops

Here's an old article in Computerworld I ran across today. Some of my favorites:

 
 

Smart appliances

Your refrigerator knows when you are low on milk and automatically orders more over the Internet. The cow juice and your other groceries are delivered to your front door. How has our species survived so long without this?

 
 

And the IBM PCjr. We actually owned one of those when I was a kid. It's amazing to hear how short a product lifetime it actually had.