web developing
4 Mar
As Firefox has declared it will play only open formats within the HTML5 video tag support. But however is there any way to play video with the mp4 h.264 codec under FF with no plugin support?
That is the question.
2 Mar
Almost for everybody the JavaScript way of implementing inheritance is odd. For a typical programmer it should look more C or Java like, but is not. However to give you a breve example, I’d like to make two objects, and to make the second one to inherit from the first. Thus I’d like to show how neither parent or child objects interact once they have been instanciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | var parent = function() {}; parent.prototype = { name : 'parent', m : 1, a : function() { console.log(this.name + ': ' + this.m); }, setM : function( value ) { this.m = value; } }; var child = function() {}; child.prototype = new parent; child.prototype.name = 'child'; var parentObj = new parent(); var childObj = new child(); parentObj.a(); parentObj.setM(12); childObj.a(); childObj.setM(3); parentObj.a(); childObj.a(); |
However this describes the ability to make complex JavaScript inheritance patterns. The complete source’s here.
2 Mar
As you may know the Arabic language is written from right to left in reverse of Latin and Cyrillic languages and in the web that means you must change the look of the page for that subset of users coming to your site.
One of the main problems are with web forms. Usually we use something like label:input pairs:
label: <input type="text" />
but when it comes to Arabic version it should be turned into:
<input type="text" /> : label
and that’s quite tricky!
Well I simply wrap that chunk of code into a table. That helps me manage the direction with the CSS direction:rtl like so:
1 2 3 4 5 6 | <table> <tr> <td>Label:</td> <td><input type="text" /></td> </tr> </table> |
When it comes to the Arabic version it can be translated with the simple:
1 2 3 4 5 6 | <table style="direction:rtl;"> <tr> <td>Label:</td> <td><input type="text" /></td> </tr> </table> |
27 Feb
In the mood of JavaScript quiz, let me ask you what’s the result of:
console.log(this === window);
27 Feb
var a = function() { alert(arguments[0]) } (1,2,3);
What’s the alerted value and how that works?