Javascript

Revue de presse JS

P..... ! Mais c'est bien sûr ! Variables privées et héritage en javascript

Pour une lecture plus confortable : 2011-04-29-PRIVATE_VARS_JS.md sur GitHub

Annotations for JavaScript / Code snippet

For my own needs, I needed an annotation system for javascript functions. This is my (ugly) code and how to use it. If a "regex king" reads this, any kind of help is appreciated :)
the syntax is like that :

@@-MyAnnotation-
defaultValue:HELLO,
type:TEXT,
id:2345
@@

Code of Annotations function :

Demo :

Have a nice day. @+P

7 little things (in javascript)

Still no blog post (no time, no idea, but it will come), but this weekend I found this :

7 petites choses en javascript ...

Toujours pas d'articles (pas le temps, pas d'idée, ça va revenir), mais ce we j'ai trouvé ceci :

mu(inheritance) : smal(lest?) inheritance javascript framework

µ(inheritance) allows :

  • inheritance between function (class)
  • multi-inheritance (but not recommended ;-))
  • to declare and use a constructor otherwise, you have an abstract class (unable to instantiate)
  • calling parent constructor (constructor name = function (class) name)
  • to test type of an object
  • using private variables without side effects with inheritance

This source code (<30 lines of code) is largely inspired by those books :

  • Javascript patterns - Stoyan Stefanov
  • JavaScript : the Good Parts - Douglas Crockford
  • Javascript cookbook - Shelley Powers
  • Pragmatic Guide to JavaScript - Christophe Porteneuve

I was guided by three rules :

  • module pattern
  • functional inheritance pattern
  • no prototype

and a "desire" : each class has a constructor (and be able to call her parent's constructor).

Explanation :

µ(inheritance) source code :

1ère WebApp pour iPad & iPhone - No Objective-C


Cela fait un moment que je n'ai rien "pondu", beaucoup de travail, beaucoup de R&D, dont pas mal de lectures à propos des technologies web sur nos jouets mobiles (j'entends par là : iPhone, iPad, mobiles Android, etc. ...

Du coup après plus d'un mois, je viens de passer un moment pour vous concocter un nouveau tuto.

Aujourd'hui, je vais vous parler des "webapps" (comment les réaliser). Une webapp est une application construite à l'aide d'HTML (5), CSS (3) et javascript. Elles ont la particularité d'être "installables" et de se comporter comme une véritable application sur un terminal mobile, ainsi que de pouvoir fonctionner en mode "offline".

  • Vous n'êtes pas obligés de passer par l'Appstore pour les distribuer.
  • Vous n'êtes pas obligés d'avoir un MAC pour coder.
  • Vous n'êtes pas obligés de connaître Objective-C

Au final vous pouvez construire une application qui n'a rien à envier à certaines applications natives.

Voyons donc voir comment faire, le document est par ici : 1ère WebApp.

Bonne lecture et bon dimanche.
@+ Philippe

Tutoriaux JavaScript


Warning: INSERT command denied to user 'kgkyojmt001'@'10.0.115.61' for table 'drp_watchdog' query: INSERT INTO drp_watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:373:\"INSERT command denied to user &#039;kgkyojmt001&#039;@&#039;10.0.115.61&#039; for table &#039;drp_accesslog&#039;\nquery: INSERT INTO drp_accesslog (title, path, url, hostname, uid, sid, timer, timestamp) values(&#039;Javascript&#039;, &#039;taxonomy/term/72&#039;, &#039;&#039;, &#039;107.22.156.205&#039;, 0, &#039;fe02f1a1044e62e52115793b3ca4786b&#039;, 2568, 1369437632)\";s:5:\"%file\";s:60:\"/homez.312/kgkyojmt/www/modules/statistics/statistics.module\";s:5:\"%line\";i:64;}', 3, ' in /homez.312/kgkyojmt/www/includes/database.mysql.inc on line 128

Warning: INSERT command denied to user 'kgkyojmt001'@'10.0.115.61' for table 'drp_watchdog' query: INSERT INTO drp_watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:904:\"UPDATE command denied to user &#039;kgkyojmt001&#039;@&#039;10.0.115.61&#039; for table &#039;drp_sessions&#039;\nquery: UPDATE drp_sessions SET uid = 0, cache = 0, hostname = &#039;107.22.156.205&#039;, session = &#039;messages|a:1:{s:5:\\&quot;error\\&quot;;a:1:{i:0;s:463:\\&quot;user warning: INSERT command denied to user &amp;#039;kgkyojmt001&amp;#039;@&amp;#039;10.0.115.61&amp;#039; for table &amp;#039;drp_accesslog&amp;#039;\\nquery: INSERT INTO drp_accesslog (title, path, url, hostname, uid, sid, timer, timestamp in /homez.312/kgkyojmt/www/includes/database.mysql.inc on line 128