Posted on Leave a comment

Restoring a SQL server database

I was trying to move a database from the client’s existing live site to our testing database on another server.

(I actually have three databases atm, one is the existing db used for the site (old server), the second is one that I used to test before I initially put the site live (new server), and the third is one that is for the new site about to replace the current one (new server))

After much frustration, this is how I managed to move the database over and then transfer the information I needed:

1. Create the new db (or skip this step if you are going to restore to a testing database).
2. Backup the current db from the old server and transfer to the new server
3. Through EM on the new server right click the created db>All Tasks>restore database
4. Browse to the backup of the db by selecting a new device
5. Under options choose restore over existing db and be sure to have the path and names of the mdf and ldf match what is on your server for your other databases. It will be listed with the path and names from the old server.
6. You may receive an error saying it can not import over existing files. If so then specify a directory under your current data and log directories (such as one named imported).
7. Be sure to remove the old users from the other db and add the user your cp created for the db. If objects are owned by a user on the old server you will need to change ownership over to dbo before removing the old user. If this is needed there are queries through google that will change the ownership of tables and sps through query analyizer.

How to change the database owner:
Exec sp_changeobjectowner ‘dbo12323.my_table’,’dbo’

dbo12323 = make this whatever the table currently has as the db owner
dbo = the new db owner

Now I can go ahead and move the information over to my new database.
INSERT INTO myDatabase.dbo.tbl_myTable
(field1, field2, field3)
SELECT
source1, source2, source3
FROM oldDatabase.dbo.tbl_oldTable

Posted on Leave a comment

CSS : Expanding frame using css with graphics

View the example here

This example is originally based off of the ‘Flexible CSS Teaser Box’ by 456 Bereastreet.

I have modified it to use four different corner images and four expandable side images.

The site’s frame can stretch indefinitely vertically and horizontally whereas the original had width restrictions of 1600 pixels. I do agree, however, that most cases 1600 pixels wide would be overkill.

Posted on Leave a comment

Validating script elements in XHTML

I’ve found that multiple errors will come from within any [script] tags that I have. To solve this, use
CDATA as so:

[script]
< ! [ CDATA [

** Please note that you should not have your
characters spaced as I've done above, this is
because my blogger editor doesn't
like angle brackets!!

function thisDoesntMatter(a,b)
{
if (a < b && a < 0) then { return 1 } } ]]>

Above is the closing tag for your CDATA

[/script]

On another note, if you are having issues with chacters within links being validated, make sure your & signs are using the ASCII code and not just the & symbol.

Posted on 1 Comment

CSS : Stretch sidebar full height of the page

One of the first things I needed to figure out is how to have the sidebar colour or pattern stretch to line up with the length of the content. I’ve found the best way to do this is to initially create a background image showing a segment of the width of your site like this:
(This image would repeat vertically, with the white bit as my content area and the coloured bit on the right as my sidebar)

Then set up your sidebar and content area within the y-axis repeating background div. This way, the content will stretch down and cause the background to repeat, forcing the sidebar colour to also extend.

See below for a quick code example:

First, the CSS to show the bg image and the content areas:

#full_content {
background-image:url(../images/framework/page_bg_tile.jpg);
background-repeat:repeat-y;
margin: 0 auto;
width: 708px;
}

#side_bar {
float:right;
text-align:left;
width: 210px;
}

#main_area {
float:left;
margin: 10px auto;
text-align:left;
width: 670px;
}

Now the div’s to organise your content

<div class=”full_content”>

<div class=”side_bar”>
Sidebar content in here
</div>

<div class=”main_area”>
Main area text
</div>

</div>