Browser Redirection – Yahoo Answers

I am having problems getting mozilla firefox to display my website correctly. It works fine on Internet Explorer. So I was thinking of making a mirror of the website that is made specifically for firefox browsers. Is it possible to code a website so that it detects what browser a visitor is using and them sends them to the correct mirror ?(i.e. index_firefox.html or index_ie.html)

Background Information
At the root of this question, there lies a huge problem that really never would have occured if browser creators followed the w3c recommendations. Microsoft and Netscape fought the original browser wars in the 1990s and throughout this time both created proprietary nonstandard tags and didn’t always follow the w3c recommendations. Eventually, Microsoft’s Internet Explorer won the war and Netscape disappeared into the oblivion to eventually become the Mozilla Project.

Mozilla Firefox, Opera, Safari and Chrome basically render almost exactly (99% of the time) the current w3c recommendations for css,html, and javscript and most of the draft recommendations are followed in the current builds of these browsers. Internet Explorer on the other hand, barely follows any of the w3c recommendations from even the year 2000. IE’s terrible rendering results in us having to perform significant testing and spend significant amounts of time doing IE6, IE7, and probably now IE8 hacks.

Problems With Potential Solution
I believe that redirecting based on a browser is a terrible idea, and should be avoided at all costs because of the potential doubling or trippling of work with regards to content.

Also, what happens if the browser doesn’t have javascript support of a user has turned it off? Chrome, Firefox,Opera, and Safari users would continue to be dished out a crap website that only works on some version of IE.

My Solution
Avoid the use of redirections for different browsers and instead developing a website that is 100% standards compliant and than start to add IE hacks as necessary.

Open Source Week 2009

I am so excited to say that I finally booked everything I need to attend the Toronto Open Source Week. In a couple of weeks time, I will be spending a couple of days in Toronto while attending the many conferences, workshops and presentations on open source software (GNU Linux, PHP, etc.)

I am hoping to do some serious networking for my consulting business, along with getting more experience with web programming and the rest of the LAMP stack which seem to be creating an IT revolution.

I hope to see you at some of the events!

Difference between HTTP Methods (Get & Post)

It has been quite a while since I have used Yahoo! Answers. I often find many of the answers to questions are blatantly wrong or that the person answering doesn’t really provide a link to additional information. This blog post is designed to include additional information on the Get & Post methods of HTTP and what should be one of the simplest topics, but isn’t because some people insist on using large words like idempotent.

HTTP uses two methods of getting and receiving data from a webserver, generally these two methods can be split into two simple phrases:

  • Get = operations that can be safely repeated because there’s no side effects. Never use get for sensitive operations, or when uploading files.
  • Post = operations that might have side effects. I always use post for any operation, I don’t want repeated again; usually this is any operation that involve database manipulation like creates, updates, or deletes.
  • The default for form submission, or even just simple website browsing is a get request. Basically, every time you click a link this a get request and most of the time you submit a form this is a post request. When using a get request to pass information, you will often see what variables after a question mark, called parameters in the url.

    Get Method
    This blog post’s web address ( http://brcline.com/blog/?p=98 ) makes use of a parameter in it’s url. The parameter or variable is simply the letter p which we can easily see is equal to 98 and because of the parameters being in URL.

    Unfortunately as a result of the parameters being in the url there is a limit of how much data can be submitted (256 bytes is the limit in some browsers.) Obviously, using get requests is not a secure operation as the user can clearly see what is being passed along and what each value is equal to. One of my favourite uses of the Get request is to use it for anything, I would want the user to be able to link or bookmark as this page should always work.

    Post Method
    Post is the slightly more secure of the two methods but should never be the only technique used for operations involving Credit Cards, Identification Card Numbers (Social Insurance Number, Driver’s License Number,etc ).

    Post relies on data being sent back to the server in a content message that contains the parameters and their respective values. The content messages do not have a defined maximum length, so this is the prefered method of submitting anything with lenghty text or many answers.

    Questions to Ask In An Interview

    I’ve been involved in interviewing people, and like everyone I have also been interviewed. I believe that when you are interviewing for a company, it is a time for both parties to determine if you will fit into the corporate culture so everyone should ask questions. I strongly believe that if something really bothers you in an interview that you should walk away if you have any doubts.

    I usually ask at least these four questions, although sometimes I will ask more to clarify something I’m concerned with or to show that I don’t quite understand but would like to understand.

    Do programmers have quiet working conditions?
    This question really determines if I will be able to get into a really productive mind set or if I will struggle most of my day getting in and out of the zone. I believe that there’s no harm with a programmer sharing an office with someone else, but it wouldn’t be very logical to put a programmer beside someone else that is always on the phone.

    On average, how long does an employee remain with your company?
    You should never suggest or use the phrase “turnover” because you will probably just receive a simple response like “low.” Obviously, if the company is younger or a startup this question might be completely meaningless. Ideally, you will hear that there are some programmers that have been with the company for several years.

    Could you explain to me how the development process works here?
    I don’t usually expect much of a response to this question if the person works in Human Resources, but hopefully you will hear about processes being documented.

    How do you track/follow bugs/issues?
    This question is used to probe how organized the development and maitenance processes are. Ideally, the team will be highly organized which should make your time used effectively and software released with fewer bugs.

    Books I’ve Read

    Sometimes, when I have applied for full time employment in the past I have seen job ads or received responses from companies asking what books I’ve read. Nearly every time, I have heard this question I was so shocked because I didn’t ever keep track of what I had read or where I had gleamed those little bits of valuable information.

    This list will be updated at least monthly, although when I have an abundance of extra time I might be able to read an additonal book or two. Please note that this list only contains books I am interested in professionally and in no specific order.

    Books Finished:

    • ASP.NET 2.0 Unleashed
    • Beginning Ubuntu Linux
    • C# How to Program
    • Code Craft: The Practice of Writing Excellent Code
    • Don’t Make Me Think: A Common Sense Approach to Web Usability
    • jQuery In Action
    • Network+ Guide to Networks
    • Learn to Program With C++
    • Practical Web 2.0 Applications with PHP
    • Systems Analysis and Design in a Changing World
    • Teach Yourself HTML 4 in 24 Hours
    • Visual Basic 6 Complete
    • Web Style Guide: Basic Design Principles for Creating Web Sites

    Currently Reading:

    • Operating System Concepts

    Although the list is getting pretty extensive, please understand that these are books I can verify as of September 7th 2009. The title suggests this is only books, so please remember that I definitely have visited many websites along the way.

    Read a Whole Textfile Into a String

    At work, I’ve been working on an auto html emailer.   I’ve been receiving files from our Latin American office that are completely in spanish and trying to sift through the HTML and recreate the email taking into account size and the fact that Outlook 2007 still doesn’t accept background images and most CSS.

    Anyway, one of the files they sent originally that the old software produced didn’t work. And to prove this, I had to somehow figure out how to loop through this text file they’ve been sending and prove this to my boss. I eventually found a function, that would let me avoid the looping, the steam writer and just do it.

    System.IO.File.ReadAllText(String fileName)

    Open Web Tools Directory

    Not too long ago, Mozilla launched an extreme pleasent and fairly easy to use Web Tools directory which includes many easy to use and sometimes hard to remember names of frameworks, debugging tools, and et cetera.Open Web Tools Directory

    Mouse Overs For ASP.NET

    Have you ever wanted to have the ability for the colour of a row to change when your user moves the mouse over top of a particular row, and then change the colour back whenever the cursor is moved back off?

    Well, this process isn’t very difficult in fact using some knowledge of JavaScript & the Document Object Model (DOM) we can dynamically change the background colour.

    We need to override the Render class and then add some attributes to each GridViewRow before the page is finally output to the browser.

    In this example, I have called the gridview we are adding the mouseovers and mouseouts “gvClients” because it displays a list of my fictional company’s clients. Wherever you see gvClients you need to make sure that you change this to your respective gridview’s name.

    protected override void Render(System.Web.UI.HtmlTextWriter writer)
    {
       /*Using a simple foreach we iterate through the Rows and use the row.Attributes.Add() and pass in the javascript property we want to output as    html, along with the function we will use and then because asp.net usually dynmically creates the names for each item we need to use    the row.ClientID as this will exist only on the client side.
    */
    foreach (GridViewRow row in gvClients.Rows)
    {
      row.Attributes.Add(“onmouseout”, “ColorGridForMouseOut(‘” + row.ClientID + “‘);”);
      row.Attributes.Add(“onmouseover”, “ColorGridForMouseOver(‘” + row.ClientID + “‘);”);
    }

    //We finally just pass in the html that’s now been created.
    base.Render(writer);
    }

    — Sample javascript

    //Change Color of Gridview on MouseOut
    function ColorGridForMouseOver(id) {
    var el = document.getElementById(id);

    if(el.currentStyle) // for msie
    {
    if (el.style.backgroundColor !=’orange’)
    {
    el.style.backgroundColor=’lightblue’;
    el.style.cursor=’hand’;
    }
    }
    else // for real browsers 😉
    {
    if (el.style.backgroundColor != ‘Orange’)
    {
    el.style.backgroundColor = ‘lightblue’;
    el.style.cursor = ‘pointer’;
    }
    }
    }

    function ColorGridForMouseOut(id)
    {
    var el = document.getElementById(id);

    if(el.currentStyle) // for msie
    {
    if (el.style.backgroundColor !=’orange’)
    {
    el.style.backgroundColor=’White’;
    el.style.textDecoration=’none’;
    }
    }
    else // for real browsers 😉
    {
    if (el.style.backgroundColor != ‘Orange’)
    {
    el.style.backgroundColor = ‘White’;
    el.style.textDecoration=’none’;
    }
    }
    }

    Thank you for taking the time to visit.

    Creating a Simple RSS Feed

    RSS is an acronym for Really Simple Syndication and is an XML specification published by the W3C. RSS became a standardized specification around June 2000. This is meant to be a very simple primer on developing an RSS feed. Please note that this is not meant to replace a detailed book or the specification created by W3C. When I first created an RSS feed for a client the specification was the only way to learn RSS.

    There are required elements to meet the specification as well as some optional. Some of the elements that are option really should be included logically.

    Each RSS feed begins with a tag describing what XML specification the document meets. For example:

    <?xml version=”1.0″?>

    After the XML Version, we need to know which version of the RSS specification this document will meet. The rss document will also have a closing </rss> tag at the end.

    So far, we have:
    <?xml version=”1.0″?>
    <rss version=”2.0″>
    </rss>

    The next tag we have is for a channel. A channel is a reverse-chronological list of links to stories that includes a title, and some sort of description.

    The channel has a couple of required elements that are mostly self explanatory. The first one is a title (the name of the channel, usually just the website name), a link (to the website) and a description of the service.

    So, we now have:
    <?xml version=”1.0″?>
    <rss version=”2.0″>
    <channel>
    <title>Brian R. Cline’s News Feed</title>
    <link>http://www.brcline.com</link>

    <description>Programming Blog for a Programmer Analyst in Niagara Falls, Ontario, Canada.</description>
    </channel>
    </rss>

    There’s many optional elements to include within the channel, but I don’t feel that most are needed to produce a great and strictly valid RSS feed.

    For example, there’s image which lets you specify a GIF,JPEG, or PNG to associate with the channel but not all RSS aggregators can show it.

    The bulk of the RSS feed is created by using “items” which represent the story and usually include a title, link, and description. All elements of an item are actually optional, but you should include at least a title and description.

    An item is fairly simple, here is an example:

    <item>
    <title>New Blog Post</title>
    <link>http://www.brcline.com/blog/page?=13</link>

    <description>Brian R. Cline posted about how to create an RSS feed.</description>
    </item>

    RSS channel’s usually include more than one item and are updated fairly regularly. I’ve included a couple of different items in the final example.

    <?xml version=”1.0″?>
    <rss version=”2.0″>
    <channel>
    <title>Brian R. Cline’s News Feed</title>
    <link>http://www.brcline.com</link>

    <description>Programming Blog for a Programmer Analyst in Niagara Falls, Ontario, Canada.</description>

    <item>

    <title>New Blog Post</title>

    <link>http://www.brcline.com/blog/page?=13</link>

    <description>Brian R. Cline posted about how to create an RSS feed.</description>

    </item>

    <item>

    <title>New Blog Post – Welcome</title>

    <link>http://www.brcline.com/blog/page?=1</link>

    <description>Brian R. Cline posted a new blog welcoming users to the blog.</description>

    </item>

    <item>

    <title>Blog Created</title>

    <link>http://www.brcline.com/blog/ </link>

    <description>Brian R. Cline adds wordpress to his website.</description>

    </item>
    </channel>
    </rss>

    Welcome

    Greetings Visitor!

     

    Wow, that sounded like a corny greeting from a science fiction movie. And, wow that totally wasn’t funny either!

     

    This blog will serve as an interesting location for computer programming tutorials and articles as I learn and discover many new things on my journey to provide excellent software on schedule and on budget.

     

    What might be included:

    •    Tips
    •   Tutorials
    •   Maybe a couple of technical book reports
    •    Critiques of new software and updates

    I also want to hear back from you about new techniques and technologies you are trying in your project and having success with.

     

    Brian R. Cline