"(My) Best Pratices in Symfony" è una parte delle slides utilizzate durante un Train to Symfony2 organizzato in una web agency nel Giugno 2014.
Non è un elenco di best practices in senso stretto, sono semplicemente spunti dai quali partire per affrontare alcune problematiche pratiche.
Scopri su http://traintosymfony.com cos'è Train to Symfony, e quanto possa essere utile alla tua azienda.
"(My) Best Pratices in Symfony" è una parte delle slides utilizzate durante un Train to Symfony2 organizzato in una web agency nel Giugno 2014.
Non è un elenco di best practices in senso stretto, sono semplicemente spunti dai quali partire per affrontare alcune problematiche pratiche.
Scopri su http://traintosymfony.com cos'è Train to Symfony, e quanto possa essere utile alla tua azienda.
Dispense sulle Espressioni Lambda usate in Java 8 realizzate dall'Ing. Roberto Musa per il Corso di Programmazione ad Oggetti presso la SDSS del Politecnico di Torino di Scano di Montiferro.
Algoritmi e Programmazione Avanzata - Ordinamento e ricorsioneSergio Porcu
Argomenti trattati:
- calcolo di una potenza (di sistema, iterativo e ricorsivo)
- heapsort
- insertion sort
- merge sort
- quicksort
- otto regine
- dama cinese
- torre di Hanoi
- tour del cavaliere
- anagrammmi
- MCD secondo Euclide
Algoritmi e Programmazione Avanzata - Esercizi propedeuticiSergio Porcu
Argomenti trattati:
- inserimento di un elemento in un vettore
- visualizzazione di un numero binario di n bit
- inserzione in lista ordinata
- fusione di array
- simulazione del gioco della vita
Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017Codemotion
Meetup del PHP User Group Milano con presentazione delle attività del gruppo e dell'associazione GrUSP per la diffusione delle buone pratiche nel mondo dello sviluppo web. Durante il meetup ci sarà anche un intervento di Enrico Zimuel sulle novità del PHP 7.1 (e 7.2), con la presentazione del suo nuovo libro "Sviluppare in PHP 7. Realizzare applicazioni web e API professionali" edito da Tecniche Nuove.
Videocorso in italiano su Udemy!
https://www.udemy.com/corso-linux-per-sviluppatori-web-lamp-apache-php-mysql/?couponCode=SLIDES10
- Installare un server linux
- Lavorare con la linea di comando
- Gestione gruppi, utenti e permessi
- Bash scripting
- Espressioni regolari
- Apache, NGnix &Https
- Installare PHP & MySql
- Cron e crontab
Con un approccio pratico, e ricco di esempi semplici per illustrare bene i concetti, impara le basi del linguaggio di scripting Bash, ormai divenuto uno standard de facto in termini di scripting di shell (Shell Scripting).
La presentazione si compone di 12 lezioni / capitoli:
1 - Introduzione
2 - Primi passi
3 - Variabili
4 - Array
5 - Aritmetica
6 - Test
7 - Costrutti condizionali
8 - Cicli iterativi
9 - Funzioni
10 - Quoting
11 - Terminare uno script
12 - Debugging
Per un totale di 98 diapositive
A simple introduction to the Python programming language. In Italian. OLD: superseeded by Pycrashcourse 3.1.
Originally presented during the Networking class of the Computer Science course at the University of Parma
Dispense sulle Espressioni Lambda usate in Java 8 realizzate dall'Ing. Roberto Musa per il Corso di Programmazione ad Oggetti presso la SDSS del Politecnico di Torino di Scano di Montiferro.
Algoritmi e Programmazione Avanzata - Ordinamento e ricorsioneSergio Porcu
Argomenti trattati:
- calcolo di una potenza (di sistema, iterativo e ricorsivo)
- heapsort
- insertion sort
- merge sort
- quicksort
- otto regine
- dama cinese
- torre di Hanoi
- tour del cavaliere
- anagrammmi
- MCD secondo Euclide
Algoritmi e Programmazione Avanzata - Esercizi propedeuticiSergio Porcu
Argomenti trattati:
- inserimento di un elemento in un vettore
- visualizzazione di un numero binario di n bit
- inserzione in lista ordinata
- fusione di array
- simulazione del gioco della vita
Enrico Zimuel - PUG Milano meetup - Codemotion Milan 2017Codemotion
Meetup del PHP User Group Milano con presentazione delle attività del gruppo e dell'associazione GrUSP per la diffusione delle buone pratiche nel mondo dello sviluppo web. Durante il meetup ci sarà anche un intervento di Enrico Zimuel sulle novità del PHP 7.1 (e 7.2), con la presentazione del suo nuovo libro "Sviluppare in PHP 7. Realizzare applicazioni web e API professionali" edito da Tecniche Nuove.
Videocorso in italiano su Udemy!
https://www.udemy.com/corso-linux-per-sviluppatori-web-lamp-apache-php-mysql/?couponCode=SLIDES10
- Installare un server linux
- Lavorare con la linea di comando
- Gestione gruppi, utenti e permessi
- Bash scripting
- Espressioni regolari
- Apache, NGnix &Https
- Installare PHP & MySql
- Cron e crontab
Con un approccio pratico, e ricco di esempi semplici per illustrare bene i concetti, impara le basi del linguaggio di scripting Bash, ormai divenuto uno standard de facto in termini di scripting di shell (Shell Scripting).
La presentazione si compone di 12 lezioni / capitoli:
1 - Introduzione
2 - Primi passi
3 - Variabili
4 - Array
5 - Aritmetica
6 - Test
7 - Costrutti condizionali
8 - Cicli iterativi
9 - Funzioni
10 - Quoting
11 - Terminare uno script
12 - Debugging
Per un totale di 98 diapositive
A simple introduction to the Python programming language. In Italian. OLD: superseeded by Pycrashcourse 3.1.
Originally presented during the Networking class of the Computer Science course at the University of Parma
Ecco giunti all'ultima tappa del percorso introduttivo su HTML, PHP e gestione di dati su MySQL:
L'accesso ai dati e la visualizzazione delle informazioni contenute nel database tramite pagine dinamiche scritte in PHP.
Sviluppare un plugin WordPress da zero - WordCamp Bologna 2018Marco Chiesi
Se sei un programmatore interessato a WordPress ma non hai mai sviluppato un plugin, il WordCamp Bologna è l’occasione giusta per iniziare. Seguendo questo talk introduttivo avrai modo di scoprire i concetti di base, le convenzioni, le buone pratiche, le misure di sicurezza, l’architettura e le principali funzionalità messe a disposizione dalla piattaforma. In questo modo potrai riuscire a muovere i primi passi nel mondo dello sviluppo WordPress e a orientarti meglio in mezzo all’enorme mole di materiale informativo disponibile in rete.
Come portare il profiler di symfony2 in drupal8Luca Lusso
Molti progetti PHP open source hanno adottato Symfony2 come base per la loro prossima versione, tra questi c'è anche il CMS Drupal (http://drupal.org). In questo talk vedremo come scrivere un modulo per Drupal8 in modo da sfruttare il più possibile il suo nuovo motore Symfony2, dall'integrazione con il service container alla gestione degli eventi, dal routing a Twig. Verrà usato come esempio il modulo webprofiler (http://drupal.org/project/webprofiler) per dimostrare come un bundle per Symfony2 possa essere trasformato in un modulo per Drupal8 e integrato facilmente nel sistema.
TypeScript ha cambiato il modo di scrivere JavaScript ed in questo talk andiamo a scoprirne le principali caratteristiche per scrivere "JavaScript che non si rompe!"
N.B. Le slides sono aggiornate sino a TS 3.
With Visual Studio 2017, we have a new C # language update. After a brief review of Update 6.0, we'll see what's new. The themes of Update 7 are: Working with Data, Improved Perfomances, and Code Simplification.
In this talk from Codemotion 2018 In this talk, we will show how to design and build microservices in PHP. We will use Expressive (https://getexpressive.org/), an open source framework based on PSR-7 and PSR-15 standards, to build the services and Swoole (https://www.swoole.co.uk/), a PECL extension for async programming in PHP. We will demonstrate how to build web APIs in PHP using a middleware approach and how to execute as microservices using Swoole, without the usage of a web server like Apache or Nginx.
Two of the most important topics on everyone’s mind when developing PHP applications are performance and security.
Rogue Wave Software and RIPS Technologies are teaming up to show you how you can utilize our solutions to help make your PHP applications safe and fast. We will use a typical Magento implementation as an example to speak about finding and eliminating bottlenecks and debugging your code. We will also demonstrate how you can detect security vulnerabilities using cutting edge static code analysis.
PHP is the top platform for building and modernizing IBM i applications. In this webinar, Erwin discusses how features of the application server can be leveraged to streamline the development process as well as fast-tracking the management of the PHP environment.
How to develop web APIs in PHP using the popular Zend Expressive framework. This webinar focuses on the REST API using the HAL-JSON format, the Problem Details format for error handling, and authentication using OAuth2.
PHP continues to make a large and diverse impact on our world today as a key technology enabler for the modern web. In this webinar, Zeev Suraski focuses on the performance evolution of PHP and where we’re heading for the future of web development.
In this talk we will present a middleware async architecture based on Expressive and Swoole to speed up web API development and runtime in PHP. Using this approach, you will be able to achieve great performance improvement, up to 4x faster than nginx or Apache (benchmark).
The Sodium crypto library (libsodium) is a modern, easy-to-use software library for encryption, decryption, signatures, password hashing and more. Sodium has been added to PHP 7.2 as core extension. In this talk we will show how to use Sodium in PHP projects to solve common problems, like how to store the users’ password, how to encrypt/decrypt sensitive information, how to authenticate user’s data, etc. We’ll also present some of the advanced features of libsodium like authenticated encryption, anonymous public-key encryption, and elliptic curve cryptography.
We'll show how to design web APIs in PHP using a middleware architecture. We will use Expressive 3 open source framework to implement the API, leveraging the PSR-7 standard. We will demonstrate building both simple RPC and fully RESTful API endpoints. We will focus also on features like authentication and authorization, validation and filtering of user’s input, and more.
The middleware approach makes it easy for software developers to implement Web APIs that manage HTTP input / output. This presentation will show how to develop a middleware web API in PHP 7 with Expressive, the Zend Framework open source project. In this context, it is also possible to make clear the huge increase in performance of PHP 7.1 and the impact on API development. And if you've always wondered what Diactoros and Stratigility are all about, you should not miss this presentation.
Whether you’re considering migrating to PHP 7 or are already there, you need to know the specifics of how to keep your application running smoothly, efficiently, and with minimum downtime. Take these techniques proven by our customers to make your PHP 7 application shine.
Learn the techniques for web development in PHP API 7 using the new middleware architecture of the open source project Expressive. The advantages of the middleware development in PHP are great: the simplicity of the code, solidity and development safety, ease f testing, excellent running performance, etc.
Everybody is using Docker. Pull an image in minutes and start multiple containers in seconds. Great! Unfortunately the public containers are normally not ready for an immediate use as a custom development system: Maybe the debugger is missing, the vhost is not configured correctly, or something app-specific has to be installed first. This presentations shows how to build your own custom system based on a Docker-compose template. This includes also the automatic setup of connections to other systems like DB servers or a load balancer to start a scalable cluster. And the best: The whole system configuration can be simply stored in a version control system, so that the Docker development template is available for all developers on the team.
PHP 7.1 contains new exciting features and improvements that can facilitate the life of many PHP developers. During the talk I will show some of these new features like nullable types, catching of multiple exceptions, the curl HTTP/2 server push support, void return types, Class constant visibility, authenticated encryption in OpenSSL with GCM and CCM modes, and more.
This presentation gives you the evidence as to why unit testing works and a process for how to bring it your team as soon as possible. There's a reason why the growth of unit testing, and automated unit testing in particular, has exploded over the past few years. It not only improves your code, it's faster than releasing code without tests. You'll learn: What, exactly, is a unit test?; The 7 reasons why managers love unit testing; and how to change mindset and processes to start unit testing now.
Presented at Codemotion 2016. Discusses the beginner-level dynamics of the performance-improved PHP 7. Gain expanded knowledge of the spaceship and null coalescing operators, anonymous classes, the new error exception, and the security features of PHP 7.
Deploying PHP applications on the cloud can be a tricky task, especially when it comes to automation and clustered environments that scale up and down. If you’re looking for ways to improve or automate your code deployment methods and use continuous integration and delivery, this session is for you.
This is episode 4 of the building the perfect PHP app for the enterprise webinar series. Nothing is faster than a frustrated user clicking away from your site or abandoning your service. Avoid attrition by learning how to tune your applications towards lightning-fast page loads and response times. Learn: the basic principles behind enterprise PHP performance management; How to optimize workloads through background jobs and caching; How to measure performance and make data-driven decisions.
This is episode 3 of the building the perfect PHP app for the enterprise webinar series. Your application is your reputation – how do you ensure it's always available and meets demand without breaking the bank? Learn techniques and tools to quickly pinpoint and fix bugs, crashes, and stability issues in production.
This is episode 2 of the building the perfect PHP app for the enterprise webinar series. You will learn: How to dig deep into application behavior and performance at runtime; How to maximize existing continuous delivery (CD) principles and tools;
When to take advantage of existing frameworks and extensions and when to do it yourself; and how to avoid reinventing the wheel each time you deploy, upgrade, or rollback.
3. Lambda Da “lambda calcolo” I nomi delle funzioni sono di pura “convenienza” e perciò tutte le funzioni sono considerate anonime A meno che si stia utilizzando un vero linguaggio di programmazione funzionale con funzioni di prima classe, generalmente si usano funzioni anonime o espressionilambda 3 Funzioni anonime in PHP 5.3
4. Closure (o chiusure) Una funzione che contiene un ambiente a riferimento Ciascuna funzione ha il suo scope Permette lo stato nascosto Un fattore di differenziazione è che le closure permettono i riferimenti collegati che esistono all’atto della creazione, da utilizzare quando sono chiamate 4 Funzioni anonime in PHP 5.3
5. Funzioni anonime Ciascuna funzione definita e/o chiamata senza essere collegata a un identificatore Si può assegnare la funzione a una variabile, ma non si dà il nome proprio 5 Funzioni anonime in PHP 5.3
7. Funtori Ciascun oggetto che definisce un metodo __invoke() Le istanze oggetto possono ora essere chiamate come se fossero funzioni class Command { public function __invoke($name) { echo "Ciao, $name"; } } $c = new Command(); $c(’Elena’); // "Ciao, Elena" 7 Funzioni anonime in PHP 5.3
8. Funzioni anonime Nuova classe Closure che definisce __invoke() Il corpo __invoke() è “sostituito” con la funzione definita Possibilità di collegare le variabili tramite importazioni, permettendo la creazione di closure 8 Funzioni anonime in PHP 5.3
9. Importante da sapere: Proprio come le normali funzioni PHP, le funzioni anonime esistono nel loro scope Non è possibile importare $this Non è possibile l’alias delle variabili importate 9 Funzioni anonime in PHP 5.3
11. Concetti di base Semplicemente, come una normale dichiarazione di funzione, tranne per fatto che non c’è il nome: function($value1[, $value2[, ... $valueN]]) { }; 11 Funzioni anonime in PHP 5.3
12. Assegnamento di variabile Assegnamento di funzioni a variabili; non dimenticare il punto e virgola alla fine ! $greet = function($name) { echo "Ciao, $name"; }; $greet(’Elena’); // "Ciao, Elena " 12 Funzioni anonime in PHP 5.3
13. Passaggio come argomento ad altri chiamabili Permette un’altra funzionalità per chiamare la funzione function say($value, $callback) { echo $callback($value); } say(’Elena’, function($name) { return "Ciao, $name"; }); // "Ciao, Elena" 13 Funzioni anonime in PHP 5.3
14. Creazione di closure Collegare le variabili alla creazione e usarle all’atto della chiamata $log = Zend_Log::factory($config); $logger = function() use($log) { $args = func_get_args(); $log->info(json_encode($args)); }; $logger(’foo’, ’bar’); // ["foo", "bar"] 14 Funzioni anonime in PHP 5.3
18. Scansione • La scansione permette di cambiare i valori di un array • Se non si utilizzano oggetti, allora è necessario passare per riferimento per poter modificare i valori $stuff = array(’apple’, ’Anise’, ’Applesauce’, ’appleseed’); array_walk($stuff, function(&$value) { $value = strtoupper($value); }); // ’APPLE’, ’ANISE’, ’APPLESAUCE’, ’APPLESEED’ 18 Funzioni anonime in PHP 5.3
19. Mappatura La mappatura esegue un lavoro su ciascun elemento dell’array, il risultato sarà un nuovo array che contiene i valori restituiti $stuff = array(’apple’, ’Anise’, ’Applesauce’, ’appleseed’); $mapped = array_map(function($value) { $value = strtoupper($value); return $value; }, $stuff); // $stuff: array(’apple’, ’Anise’, ’Applesauce’, ’appleseed’) // $mapped: array(’APPLE’, ’ANISE’, ’APPLESAUCE’, ’APPLESEED’) 19 Funzioni anonime in PHP 5.3
20. Riduzione “Combina” gli elementi e restituisce un valore o un dataset Il valore restituito è passato come primo argomento della chiamata successiva Effettua il seeding sul valore restituito passando un terzo argomento ad array_reduce() $stuff = array(’apple’, ’Anise’, ’Applesauce’, ’appleseed’); $reduce = array_reduce($stuff, function($count, $input) { $count += substr_count($input, ’a’); return $count; }, 0); // $stuff: array(’apple’, ’Anise’, ’Applesauce’, ’appleseed’) // $reduce: 3 20 Funzioni anonime in PHP 5.3
21. Filtraggio Restituisce solo gli elementi che sono riconosciuti come true Spesso questa è considerata una forma di mappatura ed è utilizzata per rifilare un dataste, solo su quegli elementi che sono di interesse primario per la riduzione $stuff = array(’apple’, ’Anise’, ’Applesauce’, ’appleseed’); $reduce = array_reduce($stuff, function($count, $input) { $count += substr_count($input, ’a’); return $count; }, 0); // $stuff: array(’apple’, ’Anise’, ’Applesauce’, ’appleseed’) // $reduce: 3 21 Funzioni anonime in PHP 5.3
22. Operazioni su stringa Espressioni regolari (preg_replace_callback) Applicazione parziale (currying) degli argomenti 22 Funzioni anonime in PHP 5.3
23. preg_replace_callback() Permette di trasformare le corrispondenze estratte $string = "Today’s date next month is " . date(’Y-m-d’); $fixed = preg_replace_callback(’/({4}-{2}-{2})/’, function($matches) { $date = new DateTime($matches[1]); $date->add(new DateInterval(’P1M’)); return $date->format(’Y-m-d’); }, $string); // "Today’s date next month is 2011-05-26" 23 Funzioni anonime in PHP 5.3
24. Applicazione parziale (currying) degli argomenti In alcuni casi si possono fornire argomenti predefiniti: Per ridurre il numero di argomenti di cui si ha bisogno Per fornire valori ad argomenti opzionali Per fornire una signature unificata per le callback $hs = function ($value) { return htmlspecialchars($value, ENT_QUOTES, "UTF-8", false); }; $filtered = $hs("<span>Matthew Weier O’Phinney</span>"); // "<span>Matthew Weier O'Phinney</span>" 24 Funzioni anonime in PHP 5.3
26. Riferimenti Le variabili passate alle callback, come argomenti o come importazioni, non sono passate per riferimento Utilizzare oggetti, oppure Passare per riferimento $count = 0; $counter = function (&$value) use (&$count) { if (is_int($value)) { $count += $value; $value = 0; } }; $stuff = array(’foo’, 1, 3, ’bar’); array_walk($stuff, $counter); // $stuff: array(’foo’, 0, 0, ’bar’) // $count: 4 26 Funzioni anonime in PHP 5.3
27. La combinazione con altri chiamabili Problemi e considerazioni: Closure è un “dettaglio di implementazione”; il typehinting (suggerimento di tipo) esclude gli altri tipi callback is_callable()dice solo che può essere chiamato, ma non in che modo is_callable() && is_object()dice che abbiamo un funtore, ma omette altri tipi callback 27 Funzioni anonime in PHP 5.3
28. La combinazione con altri chiamabili Tre modi per la chiamata (1/3): $o($arg1, $arg2) Vantaggi: velocità Problemi: non funzionerà a meno che si abbiano un funtore, una closure o una chiamata a metodo statico 28 Funzioni anonime in PHP 5.3
29. La combinazione con altri chiamabili Tre modi per la chiamata (2/3): call_user_func($o, $arg1, $arg2) Vantaggi: velocità, funziona con tutti i chiamabili Problemi: se il numero di argomenti è sconosciuto fino al runtime, diventa difficile la gestione 29 Funzioni anonime in PHP 5.3
30. La combinazione con altri chiamabili Tre modi per la chiamata (3/3): call_user_func_array($o, $argv) Vantaggi: funziona con tutti i chiamabili, funziona con un numero di argomenti variabile Problemi: lentezza (impiega fino a 6 volte di più di una chiamata diretta) 30 Funzioni anonime in PHP 5.3
31. Non si può importare $this Gli sviluppatori creativi vorrebbero usare le closure per il monkey-patch degli oggetti (Nota: Monkey patching è un modo per ampliare o modificare il runtime codice di linguaggi dinamicisenza alterare la fonte originale codice) 31 Funzioni anonime in PHP 5.3
32. Non si può importare $this Gli sviluppatori creativi vorrebbero usare le closure per il monkey-patch degli oggetti È possibile. Solo che non si può usare $this, ciò significa che si presentano dei limiti ai metodi pubblici 32 Funzioni anonime in PHP 5.3
33. Non si può importare $this Gli sviluppatori creativi vorrebbero usare le closure per il monkey-patch degli oggetti È possibile. Solo non si può usare $this, il che significa che si presentano dei limiti ai metodi pubblici Inoltre non è possibile auto-dereferenziare le closure assegnate alle proprietà 33 Funzioni anonime in PHP 5.3
34. Esempio: Monkey-Patching class Foo { public function __construct() { $self = $this; $this->bar = function () use ($self) { return get_object_vars($self); }; } public function addMethod($name, Closure $c) { $this->$name = $c; } public function __call($method, $args) { if (property_exists($this, $method) && is_callable($this->$method)) { return call_user_func_array($this->$method, $args); } } } 34 Funzioni anonime in PHP 5.3
37. Aspect Oriented Programming Il codice definisce “aspetti,” oppure codice che taglia attraverso i limiti di più componenti AOP formalizza un modo per congiungere gli aspetti ad altro codice. Spesso, si potrebbe aver bisogno di effettuare il curry su argomenti per mantenere le signature. 37 Funzioni anonime in PHP 5.3
38. Esempio Gestione Eventi $front->events()->attach(’dispatch.router.post’, function($e) use ($cache) { $request = $e->getParam(’request’); if (!$request instanceof Zendttpequest || !$request->isGet()) { return; } $metadata = json_encode($request->getMetadata()); $key = hash(’md5’, $metadata); $backend = $cache->getCache(’default’); if (false !== ($content = $backend->load($key))) { $response = $e->getParam(’response’); $response->setContent($content); return $response; } return; }); 38 Funzioni anonime in PHP 5.3