January 30, 2009
I’ve came across a strange problem when trying to parse date parts (2009 01 21) as integers in a form validation script. Somehow my month being parsed as 0 (zero) and not as 1 (one) as supposed to be. Strange. I’ve googled around and discovered that JavaScript’s parseInt support different (not so many) number bases and by default it “guesses” the base you are trying to work.
Sure, he found the “01″ and thought “Oh yeah babe, it’s an octal number!” — wrong my friend, it’s just a zero-padded number, sorry disappointing.
So, I had to supply the second argument called radix as 10 (decimal) that is indeed the base you are going to use. Setting this makes parseInt to respect you instead of having his free-will.
So I ‘ve got:
var _orderDateMonth = parseInt($('#survey_order_date_month').val(),10); // decimal base!
NOTE: The dollar sign ($) and .val() are specific JQuery functions.
NOTE: I personally hate when people break up the date parts into different inputs. If you are already going to use JavaScript, implement a damn date-picker!
January 29, 2009
Sites with loads of pages can be hard to manage. Includes were the gold pot in the end of the rainbow times ago so people could put repeated content (like headers, footers and menus) under a single file and thus including into the page/template.
But have you ever wondered that you keep having the same include occurrences at the pages? The layout concept (that I first saw under CakePHP [but it may have come from Rails actually]) brings you more flexibility and DRYness on working with templates.
Read the full article
January 28, 2009
Once again with my VIM swapfiles problems, I’ve left too much of them around my app dirs on my pre-screen era. Every power-down or connection loss was the birth of a new swap. Well, they all appeared when I had to sync with the production server.
Read the full article
January 24, 2009
One of the most common problems of working with email communication between the companies and its clients is that there isn’t a way of proving that user has received the email without making him click on a link to the company site thus confirming the read.
As most webmail and mail applications can read HTML emails (and most companies sends HTML emails anyway), we can take advantage of this to help transparently track the view.
Read the full article
January 23, 2009
Hello friends.
Sorry for the lack of posting these days. I’ve been working hard on the finishings of the WebTodo project (in Brazillian Portuguese).
This project was a kickstart for my own MVC Framework. As cited in previous article, I was not confortable with the idea of using one of the existing MVC Frameworks because I’m a little paranoid of not having exact (and full) control of my code. The only way to assure quality was from coding every piece.
Read the full article