W3Fools – A W3Schools Intervention

A very interesting resource I came across last night,

We hope we can illuminate why W3Schools is a troublesome resource, why their faulty information is a detriment to the web, and what you (and they) can do about it.

http://w3fools.com/

I admit that I have used W3Schools a lot as a resource for JavaScript, but I also know that the info is a bit dated and plain wrong in many cases. But someone just starting out may not know that. This site along with Promote JS is designed to dislodge sites like W3Schools from their rankings in Google and promote more up to date and accurate resources.

One tip…

To filter out w3schools from your searches, add -w3schools. Meanwhile, to get results from the Mozilla Docs Center, just prepend mdc.

Google might even take notice of behavior like that and demote these sites in the rankings.

Firefox Proposes Releasing Every Six Weeks

Read the proposal here.

I predicted this here.

This is obviously a response to Google Chrome releasing a new version every six weeks. Chrome is eating Firefox’s lunch. Maybe not in overall marketshare, but Chrome is definitely faster. In the browser market, faster is better. People are noticing this.

Also, developers are shifting to Chrome, and I would argue that developers were a big force in pushing adoption of Firefox. Chrome is helping itself in this area by having native dev tools and focusing on improving those tools.

Firefox 4 was in development for over a year with the release date slipping multiple times. Firefox could simply not continue on it’s current path and stay relevant in the current market.

Firefox 4 is set to be released on March 22, 2011. Versions 5, 6 and 7 are also currently planned for release in 2011.

Browser Support

I recently put together a timeline of release dates for the major browser versions because I needed a quick reference to help with browser support. The goal of this is to show how long each browser version has been around to help us make more informed decisions when deciding which browser versions to support.

Modern Browser Development Timeline

Sync Comment Number in IntenseDebate with WordPress

I have been handling a lot of WordPress development at work recently. At my job, all of the blogs are using IntenseDebate to handle blog comments. This presented a problem to me recently with launch of a new theme I was working on.

The problem is that on a post, IntenseDebate would show one number of comments while the post detail info would show a different number. I tried several different methods of fixing this to no avail. IntenseDebate does not have much in the way of documentation, and the system itself leaves a lot to be desired.

It turns out that, IntenseDebate doesn’t automatically sync comments with WordPress, and instead uses a JavaScript method to sync the comment numbers on page load. Go figure! The reason why it wasn’t working for me is that I was using a custom function to get the number of comments on a post.

To get your comment numbers to sync, you need to use the WordPress provided template tags, comments_number() or comments_popup_link(). This fixed the problem for me.

I hope that this helps someone else, as there is not much info on this out there that I could find. And avoid IntenseDebate if you can.

Apache, PHP and MySQL on Snow Leopard

I have enjoyed using MacPorts for a number of reasons, and I have written about it several times. Recently, I have had to rely on it more, and I have grown frustrated with it to the point that I had to abandon it altogether.

I upgraded to Snow Leopard (10.6) last week. It broke my install of MacPorts, but they actually tell you to reinstall after an OS upgrade like this. So I did that, but I could not get Apache 2 and PHP running again to save my life, not to mention MySQL.

So I instead relied on the factory installs of Apache and PHP. It turns out they have gotten a lot better with Snow Leopard. All I had to do was reinstall MySQL which meant I lost my databases but I was prepared for that to happen by then anyway.

Here are the instructions to get Apache, PHP and MySQL running in Snow Leopard.

Install Apache/PHP/MySQL on Snow Leopard

It worked perfectly for me except for one thing. PHP short tags are off by default. So make sure to turn them on or check your code to make sure you are not using PHP short tags, or your PHP code will not work.

I may continue to use MacPorts for other things, but for now I am no longer using it for my dev environment. Maybe one day I will give it another shot if I need it.

Install Apache, PHP and MySQL on Leopard with MacPorts

Running selfupdate on MacPorts is a good way to keep your MacPorts software up to date. The problem is when I did this, all my settings were overwritten. I should also mention that running selfupdate on my MacPorts install caused all my virtual hosts to get overwritten as well. I wrote a post last year on how to install Apache and PHP on Mac OS 10.5 with MacPorts, but following that post didn’t help me get up and running again. So I figured I would write a new one that would actually have the right information.

Here are the install instructions you need for installing Apache, PHP and MySQL with MacPorts. I had already installed Apache and PHP, but MySQL wasn’t working. I have MySQL server already installed and running, but PHP wasn’t finding it. I already had multiple databases set up, so I did not want to reinstall MySQL. All I had to do was follow the instructions in step 4. It fixed the problem, but there were a couple of settings that needed to be changed first.

After you install PHP, it gives you a 2 part message. Part 1,

Your php.ini contains a line that will prevent php5-mysql
and other PHP extensions from working. To fix this,
edit /opt/local/etc/php5/php.ini and delete this line:

extension_dir = "./"

is correct. Deleting that line is how you find the right extensions. Part 2,

To use mysqlnd with a local MySQL server, edit /opt/local/etc/php5/php.ini and set
mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket
to /opt/local/var/run/mysql5/mysqld.sock

did not work for me. For my MySQL server, that socket does not work. Instead, I found this article that tells you the correct socket on Leopard to set:

mysql.default_socket = /private/tmp/mysql.sock

That fixed everything for me, except for my virtual hosts. Again, your mileage may very. These instructions worked for me on my machine with the software I have.

MacPorts Commands

I use MacPorts to handle my installs of apache, php, etc. on my Mac. If you are using MacPorts on your Mac like I am, you may want to remember these handy codes to manage your MacPorts packages.

sudo port selfupdate

Update MacPorts to the latest version

port installed

List installed packages

sudo port upgrade outdated

Automatically upgrade outdated packages

With MacPorts, it really is that simple to install and then make sure you have the most current version. I love it, and I highly recommend it to everyone else.

Delete Blank Lines in TextMate

I use TextMate for coding on the Mac. At work, I use Dreamweaver. I’ve noticed if I switch between the 2, Dreamweaver throws an extra line break in for every line. Some text editors have a command to handle reformatting like deleting blank lines. TextMate by default does not.

You can customize TextMate though and add this command. Here is how you do it.

To add a new command to TextMate simply open the Bundle editor (bundles menu, Bundle Editor, Show Bundle Editor) and press the add button (+) and select “New Command”. This command will appear under the user’s bundle, you can move this later.

The command edtor window has several options these are:

1. Save: This allows you to configure whether to save the file or the current project before running the command
2. Command(s): This is where you enter your commands
3. Input: The text that becomes the standard input to the command. This can either be a selection or the entire document (and selection)
4. Output: This option is how the ouput from the command is handled. This can either be discarded, replace the selection, replace the document, insert as text, insert as snippet, Show as HTML, show as tooltip create a new document.
5. Activation: How the command is triggerred, in each case I’ll leave this up to you.
6. Scope: the scope of documents this should effect, e.g all js files etc.

For this example, we are going to use the sed command to remove all of the blank lines from a document.

Here’s the command configuration:

Save: Nothing
Command: sed /^$/d
Input: Entire document
Output: Replace Document
Activation: I’d recommend using a keystroke of your choice
Scope: Leave this blank

Sed processes a file line by line and carries out substitution based on regular expressions. In this example “/” is the delimiter. The regex part “^$” matches the beginning of a line and the end of a line (i.e a blank line) and lastly the “d” deletes the match.

One note, you may want to make a back up of any files in case something goes wrong.

via Muffin Research Labs.