Website design and marketing news, hints and tips
Code Snippets
SQL – update records in one table based on values in another
Apr 29th
After messing around for a while to figure out a way to do this, eventually I figured it out using the EXISTS clause.
Here is an example :
UPDATE tbl1
SET tbl1_field = ( SELECT tbl1_field
FROM tbl1
WHERE tbl.tbl1_id = tbl2.tbl2_id)
WHERE EXISTS
( SELECT tbl1_field
FROM tbl1
WHERE tbl.tbl1_id = tbl2.tbl2_id);
Connecting to a named instance of SQL remotely
Feb 26th
I got stuck for about a day and half with this.
A client had a server with two instances of SQL installed – the default being SQL 2000 and the named instance being SQL2005. I needed to connect through SQL Management Studio remotely.
The default configuration was that the SQL2005 instance was using dynamic ports – no good to us as their firewall restrictions were particularly strict. Read the rest of this entry »
Generating a random number (integer) in ASP.NET
Jan 16th
For one of my sites (Eeliz.com) I needed to randomly position an image either left or right. For this I used the following random number function :
Public Function RandomNum(ByVal MaxNum As Integer, _
Optional ByVal MinNum As Integer = 0) As Integer
‘initialise the number generator
Dim r As New Random(System.DateTime.Now.Millisecond)
’some validation on the values passed in
‘on exception will return 0
Read the rest of this entry »
Configuring 3D Vista – IIS7
Jan 15th
When we upgraded our servers we moved to IIS 7. For sites which incorporated 3D Vista 360 degree tours this caused a bit of an issue…To get the movie to play certain MIME types need to be configured – and this is how 3D Vista advise on their site :
1 – Go to Start / Control Panel / Administrative Tools / Internet Information Services (IIS) Manager.
2.- In the tree view to the left of the IIS Manager Window go to “Websites“. Right-button click and select “Properties”
3.- Select the “Http Headers” tab and click on “MIME types” button.
Read the rest of this entry »
Javascript replace
Dec 9th
Another quick snippet. I was using the Javascript replace method in my site when I noticed that by default it only made a singular replace. So I hunted down the solution for a global replace…
MyString.replace(/oldtext/gi, “newtext”)