Latest Entries »

EC2 + RDS availability

I’ve been testing Amazon EC2 with RDS now for a few month and I’ve had time enough to make an opinion about the quality of service. So here it is : I think IT SUCKS !
So sorry let me correct this : I think it really sucks !

Why ? Let’s look a numbers, numbers don’t like. So I’ve been using another server from OVH a french server provider and I’ve had 100% uptime for many years. Yes you read well, not a single problem for years, running multiple websites, with a mysql engine on local.
So I guess I expected quality of service. Maybe. It would be fair to say so.

And what do I get with EC2 ? This month I’m having 99.42 measured by Pingdom. Yes 99.42, with 2 outages and 4h 20m 58s downtime. Why did I get that ? I have absolutely no idea the only thing I can tell you is that it can’t be the software who’s responsible since no one is using my plateform… Yes I set this plateform only for test purpeose !
And the 99,42 is costing me 200 euros per month (with a 300 euros AMI reservation upfront). Compared to OVH 50 euros per month for 100% uptime well…

Oh, ok I’m not exactly fair here since I’m renting 2 machines, one for the db and one for the webserver so what I really would have is to pay 100 euros for the equivalent at OVH. WRONG ! because for 100 euros I’d get 2 REAL servers there, oh boy why did I fall for this marketing crap !

But maybe, hopefully you won’t !

So think twice before using EC2. My experience is that it’s not worth it. Get a real server, not virtual images that get disconnected from the Internet for no reason (and they didn’t even told me the reason why my images weren’t available !!!).

So is the hard world of Internet development.

So long EC2 I’m leaving you for more reliable backends.

Again big pain to find the solution of this one. I was trying to create a MultiSelect declaratively, and the problem was I had to populate it programmatically.

Well it appears it isn’t as bad as it looks as long as you know that dojo data doesn’t apply to multiSelect. So the only thing you need is to add html options inside your widget. Mmmm

So the solution looks like that :
(removing divs because wordpress won't show them...)
div dojoType="dijit.form.MultiSelect" dojoAttachPoint="List"


And the code looks like this :

// Add each of the items
dojo.forEach(items, function(item){
var c = dojo.doc.createElement(‘option’);
c.innerHTML = item.Name;
c.value = item.Value;
}, this);

Simple no ?

I forget about this all the time… I mean I spend times and times again trying to figure out solutions of problems I already solved. Baaahhh that sucks. I really need to get organized !

Well I guess it’s the reason why I got this blog online at the first place. Well today’s a simple problem I spend another 10 minutes trying to find out how to solve: how to enable/disable a button, or an object in javascript :

Here’s the code : this.CommentMsgBox.setAttribute(‘disabled’, false);

Well if anyone has a solution for organiszing that kind of problems/solutions I’m in guys !

I recently came to use netbeans (I used zend studio before) ; I have to say it’s better than zend studio but it really lacks quick access to code snippets. At least I haven’t found out where and how to add them (sucks…).

Welcome PEM !

Hey guys, PEM is building his blog @ with great dojo stuff !

Leave him a few cool comments !!

And that’s a funny bug !

Hey sometimes I have to admit, we’re really out of our minds. I was programming a publish function for an article and, I got this bug, it’s so funny I’ve decided to make a post out of it. Here’s the code :

PublishArticle: function(){

if(this.PublishButton.get("label") == "Publish"){
this.State = "Published";
this.PublishButton.set("label", "Unpublish");
if(this.PublishButton.get("label") == "Unpublish"){
this.State = "Draft";
this.PublishButton.set("label", "Publish");

Aint’ that crazy ?

Damn sometimes… Sometimes we have bugs that seem just impossible. Well I’ve just had one, I solved I just can’t resist posting it here. Guys I have to tell you it’s the most stupid bug I’ve sold, I laugh so much when I understood what happend. Ahhh life’s funny sometimes😉

Here it is.

I’m querying a JsonRestStore that sends back this data :


Well I removed the content of the data but that’s of no importance. Note that I had about 25 records sent from the JsonRestStore that looked pretty much the same except one field : item_type was for item 1 “lunches” and for all the rest “opportunities”.

Then my code, inside a dojo widget I’m fetching the JsonRestStore and getting the items. Except I want to order items using the field item_type.

// Fetch the objects{

query: {object:"Task"},
sort: sortKeys, // Order by... date DESC
onComplete: dojo.hitch(this, function(items,request){


// Now format each element
for (var i = 0; i < items.length; i++){

var item=items[i];


lunches += '

//console.log(item.item_type +;
else if (item.item_type="opportunities"){

lunches += '


// Add titles to the elements
if(lunches !=""){

lunches = "


" + lunches ;
if(opportunities !=""){

opportunities = "


" + opportunities ;

this.TaskList.innerHTML = lunches + opportunities ;


Guess what happend… All my items went on the lunches category. But WHY WHY WHY ???
You’ll find out I’m sure, and laugh a lot, hopefully😉

Still working on my Tree, irc’s magic chamber (#dojo) gave me a solution I tend to forget from times to times related to extending some of dojo’s functions (credits dmachi, thanks man😉

Here it is :

myStore = new{target:"/objects/", labelAttribute:"Task_Action"});

myModel = new dijit.tree.ForestStoreModel({
store: myStore,
deferItemLoadingUntilExpand: true,
query: {object:'Task'},
rootLabel:'test test'


dojo.extend(dijit.Tree, {_createTreeNode: function(args){

console.log("this is cool stuff");
console.log("_createTreeNode: ", args);
return new dijit._TreeNode(args);


myTree = new dijit.Tree({
id: "myTree",
model: myModel,
persist: false,


Here’s a good idea : make a new widget that will display charts related to a page. I had a few problems building this since the template must have set some parameters like style, width and height otherwise your chart wont’ display and you’ll get a wierd error. I’ll give you a very simple example on how to start building this idea.

Here’s my template :


Note that the style=”width …” *must* be there otherwise the chart won’t display.
Let’s continue …




templatePath: dojo.moduleUrl("mywidget","templates/Stats.html"),

postMixInProperties: function(){


postCreate: function(){

var chart1 = new dojox.charting.Chart2D("test");
chart1.addPlot("default", {type: "Pie"});
chart1.addAxis("y", {vertical: true});
chart1.addSeries("Series 1", [1, 2, 2, 3, 4, 5, 5, 7]);


startup: function(){



Well nothing big here but it works😉
I’m trying actually to develop multiple statitics that I’ll probably end putting in tabs. We’ll see, maybe later if I have good results I’ll post somehting here😉

See ya guys !

I spend quiet a lot of time on this one, I posted arround here and there to find the anwser on how to make a JsonRestStore happend with Zend Framework. There are quiet a few tutorials out there but my main problem was a response from the server when POST request was made (when creating a new document).

Well here’s the solution :
->setHeader('Content-Type', 'application/json', true)
->setHeader("Location", 'http://mywebsite' . $this->_request->getRequestUri() . $id);

$params['id'] = $id;
return $params;

First : you need to send back a code 201. Second, you need to send the url of the store with the new id (ex : mysite/store/4
Then you need to send back the content of the item created + the id in order to be able to play with it with DOJO. Otherwise, no fun.

Here’s the dojo part of the code :

testStore = new{jsId:"tStore", target:"/test/", idAttribute:"id" });

// Get the content of a form with a magic dojo query
data = {};
dojo.query(" textarea, .ArticleNewFormElement > input").forEach(function(node, index, arr){
data[] = dijit.byId("value");

// Add the item to the DataStore
var newClient = clientsStore.newItem(data);

// Save it back to the server{onComplete:function(item) {

// Now you can play with the ID of the element you just created, so cool !


Note that I changed a few variables here and there for my blog without rechecking the entire stuff so re-read it if you need to use it, but it works. JsonRestStore is your friend I tell you !

I’m having so much fun with dojo.query. Here’s as simple way to send back input elements to your server using a JsonRestStore :

clientStore = new{

// Get the content of the form
data = {};
dojo.query(" textarea, .ArticleNewFormElement > input").forEach(function(node, index, arr){
data[] = dijit.byId("value");

var newClient = clientStore.newItem(data);;

When I think I use to do Title = dijit.byId(“Title”)… and then collect each of the elements and then send this through an XhrPost, wha, I’m really goind quicker now. Well I guess that’s the whole deal of beeing a beginner at things😉


Get every new post delivered to your Inbox.