How to change database primary key field with a foreign key constraint

Today I needed to increase a varchar database from 2 position to 50 positions. At first I thought this would be easy, just make a change script like this: 1: ALTER TABLE tb_Categories ALTER COLUMN Code varchar(50) not null After running in SSMS I got two error messages back: Msg 5074, Level 16, State 1, Line 1 The object 'FK_CategoryCode' is dependent on column 'Code'. Msg 4922, Level 16, State 9, Line 1 ALTER TABLE ALTER COLUMN Code failed because on... [More]

Windows 8 keyboard combinations

The new version of Windows has some new keyboard combinations for the new features. Of course there are a lot of sites that have complete downloadable cheat sheets for these kind of things. I just create a simple list to start with to keep the learning curve acceptable   New key combinations for Windows 8 WinKey = Start screen or previously opened application WinKey + C = Open charms WinKey +. = Moves opened application to left or right side WinKey + Tab = Open application overview o... [More]

Installing Windows 8 CP with Virtual Box

Today I took some time to install Windows 8 Consumer Preview and run it within Virtual Box. During installation I wrote down some notes of what I encountered during setup. Here is my simplified list of steps to achieve a working Windows 8. You can download the Win8 Consumer Preview from the Microsoft site as a ISO image. 1. Install Virtual Box + Extension Pack. 2. Create new virtual machine with OS Windows 8. 3. Choose 2048 MB internal memory for 64 bit version (You can use 1024 for 32 b... [More]

Easy way to clear your SQL server database

Sometimes you want to make a clean start with your SQL server database since it’s filled up with old demo data. We all now that you can delete or truncate your tables easily by executing some T-SQL statements. When you only have a couple of tables and no complex foreign key dependencies you can do it by hand. When you database is larger and for more complex it can be a time consuming task and it’s different for each database schema. The following script makes it really easy (beware:... [More]

Session keep alive in jQuery style

When you want to keep the session alive when a user is visiting a page without refreshes, there is a technique to make this happen. This is for example useful when you have a survey page with a long list of questions that will take a while to answer completely. The technique is simple (best solutions mostly are simple). You need to notify the server that the client PC is still browsing the page. All you need is a client side script that sends a Ping message behind the scenes and a server side p... [More]

Add IntelliSense for custom jQuery libraries

When you have worked with Visual Studio, you know the power of IntelliSense which helps you speed up coding. It works well with VB/C# languages, but it can also be useful for writing JavaScript / jQuery. When writing JavaScript only basic suggestions are shown: As you can see, only ajax.js, dhtml.js and ecma.js are mentioned. I have my own lib scene.dataservice.js in the VS project, but that doesn’t show up here. There is a simple trick to make this work. Just add <reference path=&r... [More]

Developing with DevNullSmtp mailserver

When you are developing a .NET website with e-mail functionality you often want to test the mails your code is sending. Often you can use a SMTP mail server within the domain, but you’re always have to worry about not sending test e-mail to the outside world. Alternatively you could setup your own mail server somewhere, but getting everything in place and configured is not always easy. Lately I started using DevNullSmtp mailserver for developing mail applications. It’s purpose is si... [More]

SSD performance loss

Recently my laptop is getting slower and slower. The startup is pretty fast, but when using Visual Studio and compiling code it slowwww. First I thought that I needed to clean up Windows and check VS extensions, but after a while my SSD drive was my main suspect. After running some tests on my SSD with HD Tune my feeling got confirmed: It’s fine when reading data (roughly 190 MB/s average). So that’s what I see when booting up Windows. Writing data is a different story. It tries t... [More]

Fun extension for Visual Studio: achievements

Since a few days I have installed the really fun extension: Visual Studio Achievements. It brings the game element of achievements to you IDE. Like earn 5 points for ‘Save a tree’ achievements: 5 points - Print source code. My boss told me to. I swear! See the complete achievement list on the channel 9 site. You can install it via the extension manager: After installing you have to enter your channel9 credentials for keeping track of the score. Directly after some coding you’re notifie... [More]