Archive for February, 2013


Just some quick notes.
Firstly, don’t give your customers all those buttons! They will end up breaking something!
Secondly, although they bang on about a jQuery version, I just could not get it to work!
Probably the most important factor here is adding images etc. Without buying some $50 plugin, its actually one line of code!
Anyway, here’s a typical setup from one of my sites:

<script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">

$(document).ready(function() {
tinyMCE.init({
plugins : '-example', // - tells TinyMCE to skip the loading of the plugin
    mode : "textareas",
    theme : "advanced",
    theme_advanced_blockformats : "p,div,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp",
    theme_advanced_buttons1 : "image, bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink,formatselect,code",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
 editor_encoding: "raw",
    remove_linebreaks : false,
    convert_newlines_to_brs : true

// Example content CSS (should be your site CSS)
content_css : "css/style.css",

});

//adding your images ionto the tinmce window
$('#click').click(function(){
img = '<img src="http://your/url/to/image.jpg" />';
tinyMCE.execCommand('mceInsertContent',false,img);
});
});
</script>

Testing for Internet Explorer on Mac OS X

As you know, people are idiots. Really. I mean, the fact people use Internet Explorer proves it. The fact we still develop and cater for Internet Explorer makes us idiots too. In other words everyone is an idiot.

Rant aside, if you are a professional, no doubt you develop on a mac (not dissing PC owners, Ive used PCs for 22 years!). Of course, testing IE is a pain on both!

Actually, it’s worse on the pc, as MS wont allow several different IE’s running along side. Either platform, the answer is Virtual Box! http://virtualbox.org
Install it and then you can install official microsoft virtual machines! http://www.microsoft.com/en-gb/download/details.aspx?id=11575

Better yet, (and below is blatantly copied and pasted from elsewhere) you can auto install all the vm’s from one comman by following this stuff! It also includes the windows 8 developer preview with IE10!

Run Internet Explorer 7, 8, and 9 in Mac OS X the Easy & Free Way

We’re going to walk you through how to install Internet Explorer 7, 8, or 9 in a virtual machine running Windows, directly in Mac OS X – for free. This is achieved by using the freely available VirtualBox software from Oracle, and combining that with free Internet Explorer testing virtual machines from Microsoft, the trick is converting these free IE vm’s so that they work flawlessly under OS X (or Linux, technically), and that is all handled automatically with this method.

Notes: the admin password for all of the IE VMs is “Password1″ without the quotes. This has been tested and confirmed to work with Mac OS X 10.7 Lion and Mac OS X 10.6 Snow Leopard.

    1. Download & Install VirtualBox – Download Now (direct .dmg download link) – visit VirtualBox Downloads page
    2. Launch the Terminal (located in /Applications/Utilities/)
    3. Decide which versions of Internet Explorer you want to download and install – each version of Internet Explorer is contained within a separate virtual machine that runs within VirtualBox. In other words, if you want to run Internet Explorer 7, 8, and 9, you will need to download three separate VM’s, which may take a while so keep that in mind. Select the text below and copy it:
      • Install ALL versions of Internet Explorer: IE7, IE 8, and IE 9

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | bash

      • Install Internet Explorer 7 Only

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="7" bash

      • Install Internet Explorer 8 Only

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="8" bash

      • Install Internet Explorer 9 Only

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="9" bash

  1. Copy and paste the selected command from above into the Terminal and hit return, this will start the download and conversion process. How long this takes depends on your internetconnection and how many versions of Internet Explorer you chose to install
  2. Launch VirtualBox and boot Windows & Internet Explorer – select the virtual machine corresponding to the version of Internet Explorer you intend to use: IE7, IE8, IE9, then click on the “Start” button to boot that Windows machine with that version of Internet Explorer.

Remember that the default Windows admin password is “Password1″, it’s also the password hint within the VM should you forget it.

AKA more utf-8 vs latin pain and woe.

Ok. Some of you may have read my earlier post where I thought zend form was screwing up, when in actuality is the IDE. Well the fun didn’t stop there. So to spare you the pain and anguish etc, here’s what you do.

Make sure your database is UTF-8, and any fields have utf8_general_ci
In your application.ini - resources.db.params.charset = utf8
In your application.ini - resources.view.encoding = "UTF-8"
In your layout phtml head - <meta charset='utf-8'>

We should all be smiling happy now!

Subversion – Add all new files

Git rocks.

But sometimes we must use Subversion, or worse still CVS!

Anyway, with git I would usually:

git status
git add .
git commit -a
git push (if necessary)

subversion won’t let you just ‘add .’, which really sucks! As always though, you can geek it up in the command line and type this:

svn status | grep ‘?’ | sed ‘s/^.* /svn add /’ | bash

which filters through the status, greps for the new files starting with ‘?’ and then adds them, outputting to the terminal window. A bit long winded, but it works!

Remotely connecting MySQL

I’ve looked this up LOADS of times as its something you’ll want to do no doubt, much as you love PHPMyAdmin (ha!)

GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

Now you can use SequelPro, MySQLWorkbench, Navicat, or whatever thing you like to use

 

Microsoft FAIL

If you are a web developer or designer, you need to grow a pair and learn to just say NO to IE optimisation. The only way we can kill IE is to stop developing for it.

Take this happy horse sh*t for example:

Outlook 2000 rendering fine

Outlook 2000 rendering fine

Outlook 2013 - Things are seriously improving over at Microsoft

Outlook 2013 – Things are seriously improving over at Microsoft

Here’s a poser for you. Open up a controller and its view and try this:

Controller:

$this->view->utf8 = 'Si Señor!';
 $this->view->html = 'Le Cr&eacute;pe';
$btn1 = new Zend_Form_Element_Button('btn1');
 $btn1->setLabel($this->view->utf8);
$btn2 = new Zend_Form_Element_Button('btn2');
 $btn2->setLabel($this->view->html);
$this->view->btn1 = $btn1;
 $this->view->btn2 = $btn2;

View:

<?php echo 'utf-8: '.$this->utf8.'<br />'
 'html: '.$this->html.'<br />'
 'btn1: '.$this->btn1.'<br />'
 'btn2: '.$this->btn2; ?>

Output:

utf8: Si Se�or!
html: Le Crépe
btn1: ()
btn2: (Le Cr&eacute;pe)

the (buttons) render, but:
the first one is blank (kind of expected as the utf8 variable doesn’t display either)
the 2nd one displays a label, and the html variable worked as we knew it would, however the &acute; entity is displaying in the label.

what does this mean?
does it mean that! the Zend_Form_Element_Button has doubly encoded it?
it must have sent Cr&amp;eacute;pe to the browser!

This is busting my chops! Send it unencoded and it fails to render the label, and send it encoded and it gets encoded twice 😐

Screen Shot 2013-02-06 at 22.02.22

UPDATE: You’ve checked character encoding in your code, mac textedit, the db, the templates, the form decorators,  the form filters, the forums, irc, but guess what? you forgot the IDE.