An overview of technologies and best practices for the development of a full-stack web application using JavaScript. How to realize an entire Application Server with a single programming language, the use of event-driven logic and the potential of Node.js.
Con PHP Object Injection ci si riferisce ad una classe di vulnerabilità che può affliggere quelle applicazioni PHP che utilizzano la funzione "unserialize" in modo insicuro. Attraverso questo genere di vulnerabilità un potenziale attaccante potrebbe essere in grado di "iniettare" uno o più oggetti all'interno dello scope dell'applicazione. Gli attributi di tali oggetti possono essere modificati arbitrariamente dall'attaccante, e ciò potrebbe causare un comportamento inaspettato del flusso di esecuzione dell'applicazione, che potrebbe consentire all'attaccante di eseguire diverse tipologie di attacchi, o nei casi più gravi di eseguire codice PHP arbitrario.
Talk di Luca Lusso | Drupal Day Roma 2011
Snellire il carico del server per generare e restituire un json da usare per un autocompletamento. Notificare che un nodo è stato appena creato a tutti gli utenti che stanno visitando il sito in questo momento. Oppure ancora mettere a disposizione degli utenti una chat in tempo reale. Tutto questo (e molto altro) si può delegare ad un processo esterno a Drupal per aumentare velocità di interazione e diminuire il carico del server.
Durante il talk si vedrà come installare e usare node.js e come integrarlo con Drupal. Verrà mostrato il modulo nodejs presente nel repository di drupal.org
Intro a Linux tenuta all'università degli studi di Napoli Federico II. Speaker: Gabriele Previtera - https://www.linkedin.com/in/gabriele-previtera-6657648b/
DCI - Data, Context and Interaction @ Jug Genova April 2011Fabrizio Giudici
This document outlines an agenda for a presentation on Data, Context and Interaction (DCI). The agenda includes discussing two real world examples, the basic concepts of DCI, how to implement DCI, and some simple examples. DCI aims to improve the readability of object-oriented systems by giving system behavior first-class status and separating responsibilities for behavior and domain.
An overview of technologies and best practices for the development of a full-stack web application using JavaScript. How to realize an entire Application Server with a single programming language, the use of event-driven logic and the potential of Node.js.
Con PHP Object Injection ci si riferisce ad una classe di vulnerabilità che può affliggere quelle applicazioni PHP che utilizzano la funzione "unserialize" in modo insicuro. Attraverso questo genere di vulnerabilità un potenziale attaccante potrebbe essere in grado di "iniettare" uno o più oggetti all'interno dello scope dell'applicazione. Gli attributi di tali oggetti possono essere modificati arbitrariamente dall'attaccante, e ciò potrebbe causare un comportamento inaspettato del flusso di esecuzione dell'applicazione, che potrebbe consentire all'attaccante di eseguire diverse tipologie di attacchi, o nei casi più gravi di eseguire codice PHP arbitrario.
Talk di Luca Lusso | Drupal Day Roma 2011
Snellire il carico del server per generare e restituire un json da usare per un autocompletamento. Notificare che un nodo è stato appena creato a tutti gli utenti che stanno visitando il sito in questo momento. Oppure ancora mettere a disposizione degli utenti una chat in tempo reale. Tutto questo (e molto altro) si può delegare ad un processo esterno a Drupal per aumentare velocità di interazione e diminuire il carico del server.
Durante il talk si vedrà come installare e usare node.js e come integrarlo con Drupal. Verrà mostrato il modulo nodejs presente nel repository di drupal.org
Intro a Linux tenuta all'università degli studi di Napoli Federico II. Speaker: Gabriele Previtera - https://www.linkedin.com/in/gabriele-previtera-6657648b/
DCI - Data, Context and Interaction @ Jug Genova April 2011Fabrizio Giudici
This document outlines an agenda for a presentation on Data, Context and Interaction (DCI). The agenda includes discussing two real world examples, the basic concepts of DCI, how to implement DCI, and some simple examples. DCI aims to improve the readability of object-oriented systems by giving system behavior first-class status and separating responsibilities for behavior and domain.
The document discusses Parse, a backend as a service platform bought by Facebook. It is used to build the app Qoffee, which helps users find coffee and track consumption. The document outlines how to get started with Parse on Android, including setting up login screens, connecting to cloud data, using cloud code to build APIs, and scheduling tasks.
AngularJS: How to code today with tomorrow tools - Codemotion Milan 2013Carlo Bonamico
Many popular online services have demonstrated the power of javascript, html5 and mobile technologies. However, designing, implementing & maintaining a rich application for both web and mobile browsers is a challenging task given the characteristics of javascript. We will share our real-world experience with AngularJS – an open source, robust and brilliantly usable tool which will make your app mobile and designer-friendly, extremely modular and reusable (with Dependency Injection!), and even easily testable (in javascript!), in less than half the code. Expect few slides and lots of code samples and tips from our project experiences.
References:
http://mozilla.github.io/brick/docs.html
http://www.polymer-project.org/
If the hundred year language (from 2113) were available today, would we want to program in it?
Paul Graham http://paulgraham.com/hundred.html
Enter AngularJS
http://www.angularjs.org
And almost transparently upgrade as soon as they are available
http://www.2ality.com/2013/05/web-components-angular-ember.html
Play with AngularJS online
Thanks http://plnkr.co
So get your training!
Codemotion training (4-5 february and 4-5 march 2014)
http://training.codemotion.it/
To learn more
Online tutorials and video trainings:
http://www.yearofmoo.com/
http://egghead.io
All links and reference from my Codemotion Workshop
https://github.com/carlobonamico/angularjs-quickstart
https://github.com/carlobonamico/angularjs-quickstart/blob/master/references.md
Full lab from my Codemotion Workshop
https://github.com/carlobonamico/angularjs-quickstart
Web Components
http://www.w3.org/TR/components-intro
Youtube video "Web Components in Action"
http://css-tricks.com/modular-future-web-components
Books
http://www.ng-book.com
AngularJS and .NET http://henriquat.re
My current plans
integrate AngularJS with my favourite Open Source server-side dev platform
http://www.manydesigns.com/en/portofino
Thank you!
Explore these slides
https://github.com/carlobonamico/angularjs-future-web-development-slides
My presentations
http://slideshare.net/carlo.bonamico
https://twitter.com/carlobonamico
My slide at the Milan Codemotion 2015, a session called "An Adventure with ESP8266 and IOT" about using the esp8266 with NodeMCU, mosquitto, nodejs and an accelerometer. All the sourcecode will be available at http://pestohacks.blogspot.com soon
Node.js REST interface for MongoDB, we modified mongodb-rest (https://github.com/tdegrunt/mongodb-rest) to manage more operation:
counting elements
"distinct" operations
excel/csv export
list of available db collection
list of keys of a specific query
Multithreading support
It's now also possible to search by date range and are managed sort operations.
MongoDB User Group Padova - Overviews iniziale su MongoDBStefano Dindo
MongoDB è un database non relazionale, orientato ai documenti. Classificato come un database di tipo NoSQL, MongoDB si allontana dalla struttura tradizionale basata su tabelle dei database relazionali in favore di documenti in stile JSON con schema dinamico (MongoDB chiama il formato BSON), rendendo l'integrazione di dati di alcuni tipi di applicazioni più facile e veloce.
Lo scopo del MongoDB User Group Padova è quello di condividere esperienze sulla tecnologia MongoDB.
Questa presentazione, usata durante il primo evento dello User Group, è stata usata per introdurre i partecipanti sulle procedure di installazione ed i concetti di base su MongoDB.
Abstract:
* Introduzione a Seam ;
* Ciclo di vita di Seam;
* Component and context;
* Absolute Inversion of Control;
* Rapid Seam development (con esempio di start-up su eclipse o se si preferisce a linea di comando);
* Differenze sostanziali con la versione 3.0 / Ajax and Javascript remoting
Tightening the screws è lo slogan che caratterizza questo nuovo rilascio di TYPO3 CMS. La versione 8.1 introduce aggiornamenti sull'interfaccia grafica del modulo workspace, la gestione dei database con Doctrine e molti altri miglioramenti.
50 minuti per svelare la tigre, il cavallo e sapere che esiste il delfino.
La nuova versione di Java implementa caratteristiche che da tempo erano attese
nello standard del linguaggio: Metadata, Generic Types, AutoBoxing e
Unboxing dei tipi primitivi, Static import, gestione dinamica dei Loop e delle
Enumeration.
Per Java 6: gestione di SystemTray e motori di scripting.
Vediamo di cosa si tratta e di come poter utilizzare queste nuove feature all'interno dei nostri programmi
Deployment ripetibili e automatizzati con Saltitbabu
Gestisci uno o centinaia di server?
Hai intenzione di mettere in produzione il tuo primo progetto con Django?
Diventi matto ogni volta che devi fare una modifica ad un server in produzione?
Ti è stato appena assegnato il progetto di un programmatore che ha appena lasciato l'azienda, e hai appena scoperto che quello che c'è sul server di produzione è diverso da quello che c'è scritto nella wiki aziendale?
Allora... questo talk fa per te.
Il deployment è un passo fondamentale di qualsiasi progetto. Purtroppo può diventare un'operazione ripetitiva, complicata e rischiosa.
Questo talk sarà un'introduzione su come ottenere installazioni ripetibili e automatizzate di Django utilizzando Salt, un software Open Source scritto in Python
Wiki-like collaborative development for seamless customer involvementPaolo Predonzani
The document describes a wiki-like collaborative development workflow for seamless customer involvement. It shows conversations between various stakeholders discussing requirements for an event registration system. Over time, additional requirements are discovered, the system evolves and matures. Lessons learned include having one shared installation from the beginning, doing early testing with end users, and keeping requirements, documentation and help information aligned. The workflow aims to bring business analysts, users and developers into the common ground for a more fluid process from sketch to implementation.
How to put 100k lines of code into the (Google) cloud: storms and rainbowsPaolo Predonzani
This document discusses porting a 100k line Java application called Portofino to run on Google App Engine (GAE). It describes some of the main difficulties in porting to GAE including limitations of core platforms, startup time constraints, and sandbox limits. It outlines changes made such as using Cloud SQL instead of MySQL, the User API for authentication, and the Blobstore for file attachments. While some services like Datastore and Images were not used, Task Queues and Memcached could provide future benefits. Overall porting to GAE required architectural changes but gained the advantages of scalability and integration with Google services.
There are three main ways to embed Groovy in a Java application:
1) Compiling Groovy code to Java bytecode that can be referenced from Java code. This can be done with Maven or Ant.
2) Using the Bean Scripting Framework (BSF) or JSR 223 to execute Groovy scripts at runtime from Java.
3) Native embedding using the GroovyShell, GroovyClassLoader, or GroovyScriptEngine APIs to load and execute Groovy code from Java. Performance considerations include caching compiled scripts and reloading when dependencies change.
2. Logging... alla fine delle fini
Si tratta di sostituire questo:
System.out.println(“La variabile x vale: ” + x);
System.err.println(“Accesso negato: ” + filename);
...con questo:
Logger logger = LoggerFactory.getLogger(“mylogger”);
logger.debug(“La variabile x vale: ” + x);
logger.error(“Accesso negato: ” + filename);
3. Perché System.out e System.err
non sono sufficienti?
● Solo due stream non bastano per:
● Messaggi UI a carattere
● Messaggi tecnici sul funzionamento interno
● Traccia di sicurezza
● Altri...
Spesso si vogliono attivare/disattivare i messaggi
tecnici in maniera selettiva a seconda della
situazione. Esempio: i messaggi richiesti in
sviluppo possono essere molto diversi da quelli
richiesti in esercizio.
4. Il messaggio comunque è...
Fate logging (e non fate debugging)
“As personal choice, we tend not to use debuggers beyond getting a
stack trace or the value of a variable or two. One reason is that it
is easy to get lost in details of complicated data structures and
control flow; we find stepping through a program less productive
than thinking harder and adding output statements and self-checking
code at critical places. Clicking over statements takes longer than
scanning the output of judiciously-placed displays. It takes less
time to decide where to put print statements than to single-step to
the critical section of code, even assuming we know where that
is. More important, debugging statements stay with the program;
debugging sessions are transient.”
Brian W. Kernighan and Rob Pike
5. Output o così:
Nov 11, 2009 11:40:06 AM com.manydesigns.portofino.methods.PortofinoServletContextListener
createDatabaseAbstraction
INFO: Database product name: PostgreSQL
Nov 11, 2009 11:40:06 AM com.manydesigns.portofino.methods.PortofinoServletContextListener
createDatabaseAbstraction
INFO: Database product version: 8.3.5
Nov 11, 2009 11:40:06 AM com.manydesigns.portofino.methods.PortofinoServletContextListener
createDatabaseAbstraction
INFO: Database major/minor version: 8.3
Nov 11, 2009 11:40:06 AM com.manydesigns.portofino.methods.PortofinoServletContextListener
createDatabaseAbstraction
INFO: Driver name: PostgreSQL Native Driver
O così:
6. Logger (categorie di logging)
Un “logger” rappresenta una categoria di messaggi
collegati, da controllare in modo unificato.
Logger logger = LoggerFactory.getLogger(“security”);
Più spesso è semplicemente la categoria dei messaggi
prodotti da una certa classe:
Logger logger =
LoggerFactory.getLogger(“com.example.MyClass”);
O più semplicemente:
Logger logger =
LoggerFactory.getLogger(com.example.MyClass.class);
I logger formano una gerarchia: il carattere “.”
separa i padri/figli.
7. Livelli di logging
I livelli di logging indicano la gravità o importanza del
messaggio, es: trace, debug, info, warn, error.
logger.setLevel(Level.INFO);
logger.info(“Avvio programma”); // sarà stampato
int x = 2;
logger.debug(“x vale ” + x); // NON sarà stampato
I livelli di logging per ogni logger sono configurabili
programmaticamente (come in esempio) o più
frequentemente tramite file di configurazione .properties
o .xml
8. Esempio di configurazione xml
<configuration>
...
<logger name="com.example" level="info"/>
<logger name="com.example.MyClass" level="debug"/>
<logger name="org.hibernate" level="warn"/>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
9. Handler e formatter
● Uno Handler è un oggetto che si occupa della
scrittura fisica dei log su un file, su db, su
server di eventi, ecc.
● P.e.: un handler per i messaggi normali e uno per i
messaggi di sicurezza
● Più logger insististono su un handler
● Un Formatter è un oggetto che formatta in testo
una chiamata di logging e i suoi parametri
%d{HH:mm:ss.SSS} [userId=%X{userId},userName=%X{userName}]
%logger{40} [%F:%L]%n%level: %msg%n
13:09:49.026 [userId=1001,userName=predo]
c.m.p.database.JdbcConnectionProvider [ConnectionProvider.java:222]
WARN: Could not create database abstraction
10. Mapped Diagnostic Context
● Una mappa chiave-valore utile a identificare il
contesto di esecuzione, p.e.: l'utente, il client,
ecc.
11. Nested Diagnostic Context
● Uno stack per identificare il con contesto di esecuzione
● Permette di dire “siamo dentro all'applicativo X, modulo Y,
sottomodulo Z. Oppure di esprime contesti di algoritmi
ricorsivi.
12. Logging - il rovescio della medaglia:
proliferazione delle librerie
Perché tante librerie di logging?
● Java logging rilasciato tardi (JDK 1.4)
● Funzionalità distintive delle singole librerie
Problematiche:
● Più API da imparare
● Versioni diverse della stessa libreria
● Conflitti di classloading in ambienti server
13. Bisogna distinguere
● Implementazioni di base:
● Java logging (java.util.logging)
● Log4J
● Logback
● API di astrazione:
● Apache commons logging
● SLF4J
Perché astrarre?
● Per cambiare l'implementazione sottostante
● Per configurare in un solo punto
● Per formattare in modo omogeneo
14. Astrazione, implementazione
e bridging
Altra API o
framework
bridge
API
di astrazione
Adapter per Adapter per Adapter per
Java logging log4j logback
Java logging log4j logback
16. Java logging – configurazione
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
.level = ALL
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.FileHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
17. Log4J esempio di configurazione
tramite propeties
log4j.rootLogger=debug, stdout, R
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=example.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
18. Logback – configurazione xml
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg
%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>
20. Logback – esempio di output
13:09:49.026 [userId=,userName=] c.m.p.database.JdbcConnectionProvider [ConnectionProvider.java:222]
WARN: Could not create database abstraction for portofino
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the
postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:123) ~[postgresql-
8.3-606.jdbc3.jar:na]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) ~[postgresql-8.3-
606.jdbc3.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:124) ~[postgresql-8.3-
606.jdbc3.jar:na]
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) ~[postgresql-8.3-
606.jdbc3.jar:na]
at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24) ~[postgresql-8.3-606.jdbc3.jar:na]
at org.postgresql.Driver.makeConnection(Driver.java:386) ~[postgresql-8.3-606.jdbc3.jar:na]
at org.postgresql.Driver.connect(Driver.java:260) ~[postgresql-8.3-606.jdbc3.jar:na]
at java.sql.DriverManager.getConnection(DriverManager.java:525) ~[na:1.5.0]
at java.sql.DriverManager.getConnection(DriverManager.java:171) ~[na:1.5.0]
at com.manydesigns.portofino.database.JdbcConnectionProvider.acquireConnection(JdbcConnectionProvider.java:80)
~[JdbcConnectionProvider.class:na]
at com.manydesigns.portofino.database.ConnectionProvider.init(ConnectionProvider.java:165)
~[ConnectionProvider.class:na]
at
com.manydesigns.portofino.context.hibernate.HibernateContextImpl.loadConnections(HibernateContextImpl.java:137)
[HibernateContextImpl.class:na]
at com.manydesigns.portofino.servlets.PortofinoListener.createContext(PortofinoListener.java:328)
[PortofinoListener.class:na]
at com.manydesigns.portofino.servlets.PortofinoListener.contextInitialized(PortofinoListener.java:153)
[PortofinoListener.class:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135) [catalina.jar:6.0.29]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630) [catalina.jar:6.0.29]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) [catalina.jar:6.0.29]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) [catalina.jar:6.0.29]
21. Confronto implementazioni
Java logging Log4j Logback
Licenza JDK Apache EPL/LGPL
Layout personalizzabili estensione sì sì
Numero di livelli 7 6 5
Configurazione properties properties, xml, xml, API,
API groovy
Configurazione per test o no no sì
condizionata
Reload configurazione no Sì tramite thread sì senza thread
Diagnostic context no Nested/Mapped Mapped
Jar/versione negli stacktrace no no sì
Diffusione scarsa ampia in crescita
Stabilità di API/configurazione ferma stabile config cambiata
Documentazione buona ottima ottima
API minimale buona molto buona
Messaggi parametrizzati no tramite log4j- sì
extras
22. Confronto API di astrazione
Commons logging SLF4J
Licenza Apache MIT
Numero di livelli 6 6
Configurazione properties -
Configurazione programmatica no no
Diffusione ampia ampia
Bridging no sì
Binding dell'implementazione discovery statica
23. Problematiche di logging su
application server
● Presenza/assenza delle librerie di logging
nell'application server:
● Presenza → conflitti con librerie in WEB-INF/lib
● Assenza → assenza della funzionalità
● Problemi di class loader
● Memory-leak
26. Presenza delle librerie su vari
appserver
Java log4j logback JCL SLF4J
logging
Tomcat 6 JULI
Jboss 5.1 Sì Sì Sì Sì
Glassfish 3 Sì
27. Soluzioni
● Usare una libreria di logging inusuale
● Essendo improbabile che l'appserver la contenga,
includerla nella webapp è sicuro
● Usare Java logging standard
● Includere la libreria nella webapp sempre
● sperare che non vada in conflitto con l'appserver
● va bene con API stabili
● Includere o non includere la libreria nella
webapp a seconda dell'appserver