July 31st, 2007
Google has extended its support for Google Bot restriction by giving us web developers a new tool to stick in our belt. It was announced today on the Google Blog that you can now control access to your non-HTML files on your website with a simple header. The header X-Robots-Tag will allow you to do everything the normal Robots Meta tag will, but now you can do it for the PDF, Word, Image, and any other document you can think of that is served via HTTP. They also announced on the same post a new type of exclusion cause that lets you set when the document will be unavailable, see below for more information on this new feature as well as currently supported ones for use with X-Robots-Tag:
- INDEX|NOINDEX - Tells whether the page may be indexed or not
- FOLLOW|NOFOLLOW - Tells whether crawlers may follow links provided on the page or not
- ALL|NONE - ALL = INDEX, FOLLOW (default), NONE = NOINDEX, NOFOLLOW
- NOODP - tells search engines not to use page titles and descriptions from the ODP on their SERPs.
- NOYDIR - tells Yahoo! search not to use page titles and descriptions from the Yahoo! directory on the SERPs.
- NOARCHIVE - Google specific, used to prevent archiving (cached page copy)
- NOSNIPPET - Prevents Google from displaying text snippets for your page on the SERPs
- UNAVAILABLE_AFTER: RFC 850 formatted timestamp - Removes an URL from Google’s search index a day after the given date/time
So how can X-Robots-Tags help you better control the content that is indexed by Google? Well you can now tell the Google Bot that you do not want specific non-HTML documents like PDF, Word, and Image documents that you don’t want them cached on the Google Server or that a paper you have released on your website in PDF format should only be good until a specific date. So now you just need to force you server to include an addition X-Robots-Tag in the header which can be done with any of the modern languages and server, the header would look something like this:
Date: Tue, 31 Jul 2007 21:41:38 GMT
Server: Apache/1.3.37 (Unix) PHP/4.4.4
X-Powered-By: PHP/4.4.4
X-Robots-Tag: index, noarchive, nosnippet
Connection: close
Transfer-Encoding: chunked
Content-Type: application/pdf
You can do this with anything that can be served over HTTP now, so this is a huge boost for any of us control freaks that like to have our content easily organized and controlled on what is searchable on Google.
Tags: Better Coding, Google, Search Engine
Posted in Programming, SEO |
|
| View blog reactions | No Comments »
July 9th, 2007
One of the things I love to learn about is the history of how things come to be. Specifically my interests have always been in the evolutions of religion and the tech world (yeah I know pretty much polar opposites, but that is what I like to learn about). I came across an interesting article in my MSDN subscription that talked about how language features of C# 3.0 came to be. The features I am talking about are:
- Lambda Expressions
- Extension Methods
- Anonymous Types
- Implicitly Typed Local Variables
- Object Initializers
- Query Expressions
- LINQ
All these features were made possible because of they wanted to add a feature that let you query collections much like how you query SQL (LINQ) and the strong convictions of the C# language maintainers to not implement hacked together solutions. Much of the same convictions that I try to promote on this blog, and because of these convictions C# developers got some very nice features out of the language.
If you have not heard of LINQ before, this is the basic C# language construct (notice the similarities to SQL):
var overdrawnQuery = from account in db.Accounts
where account.Balance < 0
select new { account.Name, account.Address };
This article, The Evolution Of LINQ And Its Impact On The Design Of C#, is well worth the read and I recommend it to anybody that wants to learn more about C# 3.0 or is just interested in how good coding practices can have great impact on projects.
Tags: .Net, Better Coding, Framework 3.0, Framework 3.5
Posted in C#, Programming, SQL |
|
| View blog reactions | No Comments »
June 1st, 2007
Recently I read an article from Jeff Atwood, where he basically claimed the brevity leads to better code. Personally I think his example he gave:
if (s == String.Empty)
if (s == "")
Is just plain wrong, and this is the comment I put on his website:
I think this is a very bad example using “” and String.Empty. Because essentially “” is a magic number of sorts, I am talking totally theoretical here, I know that “” is never going to change from representing a empty string, but what happens when developers start using “\n\r” instead of Environment.NewLine, not only does it cause a problem if you move to Mono on Linux it also requires a higher knowledge level to understand what “\n\r” means and you even have to remember what order it goes in.
It is good practice to get developers thinking that magic values such as “” and “\n\r” and any number is not the right way to code. Because if you tell them it is okay to use “” then why is it not okay to use 3.14F for PI instead of using Math.Pi?
It’s all about staying consistent and having the least amount of rules as possible, that is how you keep code simple across your organization.
Also by your same logic a developer should never use VB.NET because the language is way to verbose. I personally am a C# developer, but if a person is more productive in VB.NET and it meets the requirements for the project who am I to tell them they should use C# because it is less verbose.
Tags: .Net, Better Coding
Posted in C#, Programming |
|
| View blog reactions | 2 Comments »