Browsing articles in "Articles"
Mar
30

Handling javascript errors on production websites

Handling javascript errors as always been sort of a problem for me. Testing every combination possible in a big application is hard, and there is always a chance you will miss something.

Of course, we should always strive to make an application as bug free as possible, but users seems to always find a way to break it. You can always expect them to do something you never have think of, and this is one of the reason I created this plugin.

When a javascript error is detected, this plugin will do an ajax request to your server and then sends an email, of course you could also log it in a database. It’s certainly not a revolutionary idea, but still, I was finding the idea cool…


Mar
28

Going to war, web developer style

There is bad customer services everywhere, but nothing quite compares to The Brick for me. Here in Quebec we get raped by Telecom companies on cellphone plans and internet, we pay much more for less, and yet, today I am really more pissed off at The Brick.

I am going to spare you the details of my adventure with them, you can find all the details here. Let’s just say that I bought some furniture and I am really not happy with it.

War, guerrilla style!

I was so pissed off about my discussion with their customer support that I decided to create a website to tell everyone about how shitty The Brick is, and I did it in little more than 4 hours. First thing first, I…


Mar
23

Introducing hooks in the jQuery form validation engine plugin

Hooks are a new feature just introduced into the engine recently. This makes it very easy to add extra behaviors on top of the current error prompts.

The hooks make the use of the jQuery custom event feature. A good example of use would be to add a mention that there is a problem at the form beginning when an error is found.

See the Demo
Download Plugin

There are currently 3 hooks implemented in the engine. One that is triggered before the validation, one after each field validation, and one, finally, with the form result.

* jqv.form.validating : Triggers when the form is submitted and before it starts the validation process
* jqv.field.result(event, field, errorFound, prompText) : Triggers when a field is validated with the result.
* jqv.form.result(event, errorFound) : Trigger when a…


Mar
21

Using form ajax validation with the jQuery Validation Engine plugin

Since 2.0 a lot of people wondered how was working the new ajax validation. Doing ajax validation and controlling the submit form event has always been an headache, and while the validation engine aspire to make it as easy as possible, it is probably never going to be simple for junior developers.

To be fair, the ajax feature has been rewritten and was not as mature as in the 1.7 version. However the 2.x base code is starting to be pretty good with the recent updates. If no other bugs popup, I will start tagging the 2.x releases on github and this version will be considered stable for a while.

There is 2 demos added to the repository, one with only the inline validation and another with…


Jan
24

The iframe cross-domain policy problem

I wrote a small post on Cakemail blog about using iframes, here an excerpt and a link to the full article.

If you are a front-end developer that need to use a cross-domain iframe, you know pain. You could write a nice bit of code and get it working on firefox but it would crash on ie. You would think that would be easy – facebook, twitter and all the others cool kids are doing it! Well, not quite.

Here at Cakemail we are currently building a platform that will enable our users to create forms and embed them in their website directly (think an email list subscription form). So basically, we needed to have javascript control in the parent and in the child.

We had 2 problems…


Jan
18

A front-end developer journey into symfony..

I love doing HTML/CSS/Javacscript, but what happens when you want to create a project that Wordpress can’t handle? Beside finding someone who can do it I mean.. Well you have to learn new stuff and this is how I immersed myself in more complex back-end work.

Making a framework choice

Where do I start? like anyone I guess, I check for the best framework to learn. Obviously I am not going to create my own MVC framework, some of the best php guys are already doing that (And also I suck at doing php). And I am not going to use a CMS, not enough barebone to do an app, less extensible and also more security problems (plus I hate Joomla and Drupal). So I browse the web, django,…


Jan
3

Printing web pages & a new jQuery print plugin

Printing is becoming more and more obsolete these days, however most websites still do offer a print stylesheet . Print stylesheets are rarely perfect, when you start disabling some parts of your website you’re bound to forget to disable a div and your layout will probably give you an headache.

Making a site print friendly

There is generally 2 way used for making a website print friendly. Your first option is to use the technique I’ve talked before and make a print stylesheet directly in your website, and you disable everything that is not relevant content.

Generally it becomes rapidly a mess, unfortunately disabling every parts of your website can be tedious, and you are at the mercy of odd IE behaviors because of divs multiplication, css float…


Dec
3

stackJS, a javascript module loader and dependencies handler

Writing good and maintainable javascript is hard, especially when your first javascript framework was jQuery. Couples of years ago, you could be ok using document.ready for implementing your minimal features. Now not so much, web application use more and more javascript, and there comes a time where using anonymous functions with a ton of events is just not enough. jQuery is pretty good at handling everything cross-browser, but is does nothing to help you implement a clean architecture and rectifying that is the basic idea behind stackJS.

Most of you guys are probably aware that some frameworks have popped up to fill this blank, like the excellent javascriptMVC (a jQuery MVC framework), another good example would be backbone.js. I really like what javascriptMVC has to offer, it’s…


Nov
11

Managing string localization in javascript files

One thing that is really frustrating to deal with is localization. There is nothing funny about localizing text from your application. But this is a necessary step when you want to go for very a broad market in multiple languages. So while your there, why not having a localization infrastructure in all your front-end.

Most PHP frameworks and JS widget libraries can now be easily customized as far as localization is concerned. However your bound to have some string messages in your javascript modules. Not thinking about the localization of these little pesky messages leads to painful hours of looking through every files to find some strings that have not been localized.

Consolidating your localization architecture

Okay your widget has 2 or 3 files, each for one…


Nov
1

Managing undefined properties on multiple level in objects in javascript

When you’re working with objects you often need to know if a properties already exists in an object, for doing that there is 2 solutions that are already working fairly well. But when you look for undefined properties on multiple levels, it rapidly becomes a mess.

An example

  1. if(typeof object.props1.props2 == "undefined"){
  2. // do stuff
  3. }

If props1 is undefined, unfortunately your browser is going to throw you that object.props1 is undefined.

Rewinding a bit

First, let’s take a look at your options if your only working on one level, let’s say you want to know if prop1 exists in an object

First solution:

  1. if(object.hasOwnProperty("props1") ){
  2.  // Do stuff
  3. }

It is pretty self exploratory, it looks in the object if it’s got the property props1, however it is not going to…


RSSSome Tweets