Here I will mainly talk about PHP and MySQL related things since I deal with the two technologies all day long. I code for fun, and for food, so if you have PHP work that has to be done, feel free to contact me, I'm currently looking for freelance projects.
posted by kevin on May 21, 2011

Do you have experience with PHP, MySQL, HTML, Javascript and live in the St. Louis area? Send me your resume!

The company I work for is looking to hire at least one solid developer.

Things you should know:

  • Object-Oriented PHP
  • MySQL - schema design, understanding of how to optimize queries
  • Knowlege of JQuery, ext-js is a huge bonus

This is not an entry-level position, real-world expierience is a must.

Compensation and benefits are fantasitc, just send a note if you're interested or would like more information.

Thanks.

posted by kevin on October 24, 2009

Video - Installing Yii Framework (OSX)

I'm going to start doing video tutorials, I know I enjoy watching and listening to people explain things, I think I'll do some more things in this format.

posted by kevin on October 21, 2009

Microsoft Smart Quotes & PHP

It seems like I run into this issue for over half of the websites that I work on. The user wants to copy-and-paste their article, document, or whatever from MS Word, into a textarea and save it. The problem is word uses funky quotes, dashes, and other characters. Once it's submitted, PHP gets it and the characters are encoded differently and they display weird.

We've tried several different methods to try to eliminate the problem, but every time I googled for a fix, I never really found anything that worked well.

My boss mentioned that maybe we could fix it on the client-level, so I dove in and found what seems to be a promising fix. It's clean and simple. This function currently only replaces the single and double smart quotes, and then the strange dash character that MS word uses. Feel free to submit for character conversion codes and I'll add it to the function, I'll also add to this once I come across more problems.

Javascript function to replace Microsoft Smart Quotes with regular quotes.

 
function removeMSWordChars(str) {
    var myReplacements = new Array();
    var myCode, intReplacement;
    myReplacements[8216] = 39;
    myReplacements[8217] = 39;
    myReplacements[8220] = 34;
    myReplacements[8221] = 34;
    myReplacements[8212] = 45;
    for(c=0; c<str.length; c++) {
        var myCode = str.charCodeAt(c);
        if(myReplacements[myCode] != undefined) {
            intReplacement = myReplacements[myCode];
            str = str.substr(0,c) + String.fromCharCode(intReplacement) + str.substr(c+1);
        }
    }
    return str;
}
 

This is the jQuery that will run the filter on all textareas on your page when you tab away from the textarea (Assumes you have jQuery installed and running on the page.)

 
$(function(){
    $("textarea").blur(function(){
        $(this).val(removeMSWordChars(this.value));
    });
});
 

Removing smart quotes javascript example



Or if you don't use jQuery and you're a little green to javascript you can do this:

 
<textarea onBlur="this.value=removeMSWordChars(this.value);" name="a" rows=5 cols=10></textarea>