Archive for the ‘Programmation’ Category

Everyone in the web industry has one common enemy when building websites : Internet Explorer.
As new versions came out, most problems were solved but there are still many compatibility issues with previous versions of IE. We’re not here to bury our heads in the sand and ignore a vast user base coming from Microsoft’s official browser, the browser is installed by default with Windows and most people won’t bother upgrading/installing other browsers. We all know it’s a pain to test our websites on IE, since every single version isn’t acting like the others and they all have their particularities,. I hereby present you this guide that give you tips, ticks and tools to help you face that beast.

1. Testing in IE
First of all, if you have Internet Explorer installed on your computer, you should know that you can only have one version installed at once (must unsinstall 8 to use 7, or use a virtual machine). Fortunately I found out today one useful tool in Internet Explorer 8 (and newer versions) that you can use to switch the browser rendering to a IE7 one. This can be reached at Tools->Developping Tools (F12). In the toolbar, you can either switch the document mode or browser mode.

  • Browser mode:
    Renders the page as if a user would visit your website with the selected browser (IE7 for example).
  • Document mode: 
    Renders the pages with the default behavior of the selected browser of the current doctype of your page (IE7 not supporting HTML5 for example). Shortcuts for switching to another document mode are Alt + IE version (Alt+8 for IE8).
  • note: I’m using IE8 and in Browser mode I have “IE8 Compatibility view”, that means it will render the page with IE7 in browser mode and in document mode but will send a token to the browser that tells you’re still using IE8 (so it will ignore “if IE8” css conditions).

If you try to use a different browser and document, you might get awkward results, as it is not natural for a browser to do so, you may move along. It might also be the reason why people get different results on the same browser, my IE8 was set to a IE7 document mode by default, for some reason, I had to revert it back.

Source :  Microsoft’s official website

2. Testing in Firefox or Chrome

As a personal preference, I prefer using Firefox for developing websites because I have all these plug-ins and tools to help debugging. Chrome has also grown big in those plug-ins over time and has become pretty efficient. I want to introduce you to a plug-in called “IE Tab”, available for both Firefox and Google Chrome. The plug-in itself allows you to make a tab in your browser that will emulate IE’s page renderer so you can test whenever you want, with any IE version, directly inside your favorite browser (assuming it’s either FF/GC).

Download links:
IE Tab V2 for Firefox 3.5+
IE Tab for older versions of Firefox 
IE Tab for Google Chrome (seems like it doesn’t work on Some Linux-based systems though)

That’s it for now, I hope this little guide taught you something new and will help you to get a smaller headache when debugging for IE!

Share, comment, like, hug me if you think this was useful! Thanks for spreading the word! 

Edit : Typos, etc. 

Advertisements

INK plug-in

Posted: March 11, 2011 by yanenrogne in Programmation

INK logoSo it’s today that the INK plug-in was released by somebody from Montréal (Stephane Caron). The functionality of INK is mainly to give credit when somebody tries to copy and paste something from your website. People share a lot of knowledge nowaday with Twitter, Facebook and forums but they sometimes forget to give credit to people who actually said clever things. It might not be intentional but giving back credit to the person could be helpful to him/her to raise the popularity of his/her website! So this little open-source plug-in will give basic information about the source website where the paste comes from.

Here’s an example:

“On a site with INK installed, every time a user copies content, INK automatically adds credit back to your site. INK is totally seamless to the end user and that’s what makes it so powerful. It’s incredibly easy to install and requires no setup, you’ll be ready to use it in less than 5 minutes.”
Read more about INK – Own your content | Stéphane Caron – No Margin For Errors on:http://www.no-margin-for-errors.com/projects/ink-own-your-content/?utm_source=website&utm_medium=share&utm_campaign=copy&

This was directly copied from the author’s website (ohh it saves time for me, I don’t even have to link his website!)

The plug-in is available for a regular website and WordPress! I’m gonna install it in the next days on my own blog to try it out.

Thank you Stephane Caron!

Programming habits

Posted: March 8, 2011 by yanenrogne in Programmation

Broken Keyboard

I’ve had some people sending me this link over the past few days and I thought it would be good if I shared it. This article is pointing the bad habits that most of programmers have or important stuff that they forget to do or ignore (like commenting) and becomes really irritating when somebody else tries to edit or work in your stuff.

Read those guidelines even if you’re a veteran of programming, nobody’s perfect!

Source : http://net.tutsplus.com/tutorials/php/why-youre-a-bad-php-programmer/

What’s my age again?

Posted: March 8, 2011 by yanenrogne in PHP & MySQL, Programmation

Here’s a first “code snippet” that I will be sharing. It is only a quick math to guess the age of a person with his/her birth date. I was working on PHP with a MySQL database.

The format used for the birth date was in a form with three inputs, one for year, month and day

<?php
$age = (date("Y") - (int)$_POST['year']);

if(date("m") < (int)$_POST['month'] )
$age--;
else if( date("d") < (int)$_POST['day'] )
$age--;
?>

The first part will get current year and subtract the birth date’s year so we get the age.

But this will only work if the person had his birthday already this year, that’s what the other parts are for, they will subtract one year if it haven’t happened yet!