Category: Software

  • javascript Promise chaining: augmenting the unique argument

    There are two things that, IMHO, make code cleaner when using Promises Idioma: use an unique object argument (and its attributes as you would use argument legacy) return resolve with the object given as argument augmented by attribute of the action executed by the function i.e., say I want to ask db for data about…

  • Cifratura simmetrica, un discorso campato in aria

    E quando poi si parla di algoritmi di cifratura simmetrici, si dice che c’è bisogno dello scambio sicurodella chiave di decodifica, e, i più, a questo punto si tacciono. E tra i più c’ero anch’io. Di fatto lo scambio sicuro della chiave può essere fatto su di un canale differe, ad esempio tramite un database, ad…

  • wordpress where tinymce is the default editor

    wordpress where tinymce is the default editor

    Interacting with tinymce in wp is possible: because tinymce is a default editor (plugin I developed for downloading offers from shoppydoo, a price comparator service: http://www.shoppydoo.it/ ) The extension generate a tag that will be parsed and recognized by the backend plugin, replacing it with a parsed xml coming from price comparator service. Revenues are accredited…

  • SQL order by grouping children of the same parent (one generation)

    I am assuming there is only a generation, so I want to order the result from a db table with (id,parent_id) structure implementing the parent-child internal relationship, ie:   Table name: catogories id parent_id name int int varchar(100)       So, I found some hint here, and here, but actually I did wrote my solution…

  • 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…

  • 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…

  • 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…

  • 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…

  • 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…

  • What is ELPA? and some hint on editing PHP with emacs

    Emacs Lisp Package Archiver, simply a way to install emacs lisp script on emacs without wasting time on download, put where it could be loaded, load it … It just install the package and let you use it. Command is M-x package-install RET [and choose the package]. It will install the package in the ~/.emacs.d/ELPA folder.…