A simple excursion on jQuery’s promises

Using Kriskoval‘s q version of promise I was in trouble when I required promises for a browser application based on jQuery (+more). After a while I found it exists promise in jQuery too, and is not so different in use. (ok, Kriskoval would arguments on this, and of course he is right, but it is not so different […]

Read More…

a tricky tip on indending php&javascript mixed code

What I mean is the autoindent function of some editor that do not understand mixed code language. PHP and Javascript couple is special:   <script> var myJson = /*<?php if($THIS && $that) { ?>*/ <?php echo json_encode($that); ?> /*<?php } else { ?>*/ <?php echo json_encode($those); ?> /*<?php } ?>*/ var isOk = false; /*<?php […]

Read More…

How to use model in a React Application

D: “Model has to be some where, where do I put the model?” E: “At the top, the model is always at the top most. But I do not like react” This conversation with https://twitter.com/emanuele_r (https://github.com/lele85 Emanuele Rampichini) take place in late novemberduring a code retreat, but it was off topic, because I does not […]

Read More…

10 consigli per un programmatore web. Php, mysql, modificare o iniziare un nuovo progetto

Arriva una richiesta, un nuovo lavoro da affrontare, spesso c’è un prodotto di partenza da modificare, a volte il prodotto è vecchio, a volte inizi qualcosa di nuovo ed hai tutto il massimo delle libertà. Per chi sono questi consigli Ti trovi spesso nella situazione di dover mettere mano su codice altrui, o stai iniziando […]

Read More…

small PHP check before upload or test

In a world where Bash shell is under attack I attach a short shell script that make me waste less time in upload/commit/test loop: #! /bin/sh LIST=`find . -name ‘*.php’` for x in $LIST; do OUTPUT=`php -l $x` A=$? if [ $A -ne 0 ]; then echo “ERROR ON ” $x “with ” $OUTPUT; fi […]

Read More…

Formati di scambio dei dati. 24-9-2014

24 Settembre 2014 I formati per lo scambio dei dati sono semantici? Certamente: esprimono dei concetti e le relazioni tra questi concetti. Principali formati: XML e JSON. Significato La semantica di un XML è data, in qualche misura, dalla posizione nell’albero sintattico  di una entità, dal nome di questa entità, dai suoi attributi, e a […]

Read More…

TDD or not TDD? This isn’t the question.

Instead of reply to these reasons: http://www.phpclasses.org/blog/post/237-7-Reasons-Why-TDD-Failed-to-become-Mainstream.html I prefer to find what make testing hard: mock object, the missing part! All these arguments seems to fail to understand that TDD is not just testing, it is to guarantee SOLID principle of object oriented design Liskov substitution, Interface segretation, Dependency inversion, and also single responsibility and open/close […]

Read More…

Use Grunt. Always

The worst could happen, but use grunt. Always. A little lesson from wasted time. Code could be wrong, thus it has to be tested, and tested, and tested. Automate that test. Do not wait to waste any more time. A note on grunt is that shell can do the most, for example lftp is very […]

Read More…