How to make google only look at lower case url for sites hosted on windows IIS Server, fixes duplicate title tags in Webmaster Tools error

by Shawn Hyde 17. May 2012 03:52

This method can be used to fix duplicate content errors and make it so google only indexes one version of your urls, which will prevent you from getting a negative modifiers.

In order to do this you have two options.

  1. Use the proper canonical tags, for example place the following code at the top of your website:
  2. Use the following script to automate the process and only allow lower case urls to be viewed on your site, create a global.asax file and place it in your site's main directory. 

If you plan to use both methods be sure to use only lower case for your canonical tags or you will end up with problems.

How to fix google qps rate exceeeded error when using google jsapi

by Shawn Hyde 29. February 2012 02:29

Update the if error section to retry after waiting for 1000ms, then attempt the request again, for example replace:

with

 

Tags: , , , ,

Code | How To Guides | Quick Tips

How to target Safari only using CSS and Javascript while keeping your page W3 compliant and completely valid

by Shawn Hyde 29. February 2012 00:17

Here is a neat little trick you can use to target Safari and make it behave while fixing cross browser layouts. This method will allow you to keep a page valid and it will allow you to only target Safari.

First thing you want to do is use javascript to inject a css file for all browsers that support webkit with this code: 

Now, like I stated above this will target all browsers that currently support webkit and add support for it in the future so you cannot rely on only this. So now you need to create the css file and add some code that is Safari specific by using the double # method. Some people will ask, why not just include the double # to begin with? And the simple answer is that it will cause your CSS not to validate.

Here is the example css code that will target only Safari

Enjoy!

Tags: , , , ,

Code | Design | How To Guides | Quick Tips

getElementById delay function

by Shawn Hyde 1. August 2010 16:40

 

Tags: , ,

Code | Quick Tips

Moving database from MS SQL 2000 to 2005 or 2008 | Error / User / Roles / Delete

by Shawn Hyde 30. September 2009 16:47

In order to fix this bug you can simply run this command on the effected database after you have used the backup (sql2000) / restore sql2005/2008) or detach attach methods.

command to run:

 

Replace "dbusername" with the problem user account. both should be the same.

This will remove the ghost user from the sql 2000 server and replace it with the new user on your sql 2005 / 2008 server. Be sure to have the user created before running this command.

Errors associated with this are as follows:

"login name must be specified Database user"

"The database principal owns a schema in the database, and cannot be dropped"

"user group or role already exists in the current database"

"can't delete sql user in database"

Tags: , ,

Code | How To Guides | Quick Tips

Quick fix for "PHP Notice: Undefined variable" errors PHP 5.0 / 5.1 / 5.2 / 5.3 / 5.4

by Shawn Hyde 13. September 2009 16:48

After taking over an account from another firm, the customers site was getting errors like this? Generally I would rewrite the code into asp.net however I was in a hurry to find a quick solution.

Example of the errors:

PHP Notice: Undefined variable: city in path\dbconnect.PHP on line 3 PHP Notice: Undefined variable: state in path\dbconnect.PHP on line 4 PHP Notice: Undefined variable: ownership in path\dbconnect.PHP on line 5 PHP Notice: Undefined variable: priceMin in path\dbconnect.PHP on line 6 PHP Notice: Undefined variable: priceMax in path\dbconnect.PHP on line 7 PHP Notice: Undefined variable: bedMin in path\dbconnect.PHP on line 8 PHP Notice: Undefined variable: bedMax in path\dbconnect.PHP on line 9 PHP Notice: Undefined variable: bathMin in path\dbconnect.PHP on line 10 PHP Notice: Undefined variable: bathMax in path\dbconnect.PHP on line 11 PHP Notice: Undefined variable: sqftMin in path\dbconnect.PHP on line 12 PHP Notice: Undefined variable: sqftMax in path\dbconnect.PHP on line 13 PHP Notice: Undefined variable: acreMin in path\dbconnect.PHP on line 14 PHP Notice: Undefined variable: acreMax in path\dbconnect.PHP on line 15 PHP Notice: Undefined variable: yearMin in path\dbconnect.PHP on line 16 PHP Notice: Undefined variable: yearMax in path\dbconnect.PHP on line 17 PHP Notice: Undefined variable: garageMin in path\dbconnect.PHP on line 18 PHP Notice: Undefined variable: garageMax in path\dbconnect.PHP on line 19 PHP Notice: Undefined variable: listingID in path\dbconnect.PHP on line 20 PHP Notice: Undefined variable: ADDLISTING in path\dbconnect.PHP on line 21 PHP Notice: Undefined variable: UPDATELISTING in path\dbconnect.PHP on line 22 PHP Notice: Undefined variable: deletePhoto in path\dbconnect.PHP on line 23 PHP Notice: Undefined variable: deleteDisclosure in path\dbconnect.PHP on line 24 PHP Notice: Undefined index: priceMin in path\basic.PHP on line 4 PHP Notice: Undefined index: priceMax in path\basic.PHP on line 5 PHP Notice: Undefined index: state in path\basic.PHP on line 6 PHP Notice: Undefined index: city in path\basic.PHP on line 7 PHP Notice: Undefined index: ownership in path\basic.PHP on line 8

Obviously the site is using invalid code and the newer php5.x is more than happy to tell you about it.

You can fix your code or you can simply disable the error reporting:

 

Be sure to place the code inside your php tags:

 

Tags:

Code | How To Guides

How to create a basic asp.net contact form in vb.net

by Shawn Hyde 12. June 2009 16:48

First thing you will need to do is specify the scripting language, content type and endcoding type in a page element. Language will be visual Basic, content Type will be text/html and ecoding will be UTF-8

Next you will want to specify the doctype, this will tell the browser exactly what type of HTML you are using in the page. We'll be using the following DTD HTML doc type.

Now we need to import the System.Web.Mail asp.net namespace for use with our basic contact form

Now that the page basics are setup we need to write some script that will handle the information browsers will provide when visiting your page. First you need to write the server side script call. Then include a runat="server" verable which will tell the server to run it locally on the server side so the browser cannot view the information. This is done to prevent souce view bots from gaining email address information in your contact form.

Server side code

then you need to end the runat=server code

 

add standard HTML elements

Now the form, form fields and content

 

 

You may want to add some validation to the above code in order to prevent bots from filling out your contact form.

Finally closing of page HTML elements

Tags: , , , ,

Code | How To Guides

How to redirect and handle mobile clients with JavaScript using cookies

by Shawn Hyde 5. May 2009 02:48

Create a file called mobile.js and add the following code to it, be sure to replace shawnhyde.com with your own domain name.

 

You will need to create a link back to your full version site for people with large display smart phones that do not want to use the mobile site. In order to do this you just need to add the following code somewhere on your mobile site.

 

You can also add a floating link back to your mobile site in case they have problems by adding the following code to your main site.

You will need to add a file named desktop.css with something like the following code.

You will need to add a file named mobile.css with something like the following code.

Also, be sure you update the code to reflect the correct folders for files.  For example, "css" folder, "js" folder. 

Edit / Updated the code to support newer mobile clients.

Tags: , , , ,

Code | How To Guides | JavaScript

Asp.net C# script for Permanent 301 Redirect

by Shawn Hyde 27. March 2009 16:51

Here is the code, add this to your global.asax file:

 

Tags: , ,

Code | Quick Tips

How to add ads to Telligent Community Server 2007, 2008, 2008.5

by Shawn Hyde 13. March 2009 17:22

add this code to the top of the master page or template you wish to include ads on:

Now add this code to the area of the page you want your ads to be displayed:

Tags: , , , ,

Code | Design | How To Guides | Quick Tips

Tag cloud

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar