#Comandos úteis do Maven
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-quickstart \
(Full description and list of commands at - https://npmjs.org/doc/index.html)
Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
| import java.awt.Color; | |
| import net.sf.jasperreports.engine.*; | |
| import net.sf.jasperreports.engine.design.*; | |
| import net.sf.jasperreports.engine.type.*; | |
| import net.sf.jasperreports.view.JasperViewer | |
| class GroovierReport { | |
| static void main(String[] args) { | |
| def builder = new ObjectGraphBuilder() |
Create an empty git repo or reinitialize an existing one
git init| @Grapes([ | |
| @Grab('org.eclipse.jetty.aggregate:jetty-all:8.1.10.v20130312'), | |
| @Grab('com.h2database:h2:1.3.171'), | |
| @Grab('javax.servlet:servlet-api:2.5'), | |
| ]) | |
| import org.eclipse.jetty.server.Server | |
| import org.eclipse.jetty.servlet.* | |
| import org.eclipse.jetty.webapp.* | |
| import javax.servlet.* | |
| import javax.servlet.http.* |
"The trick is to catch exceptions at the proper layer, where your program can either meaningfully recover from the exception and continue without causing further errors, or provide the user with specific information, including instructions on how to recover from the error. When it is not practical for a method to do either of these, simply let the exception go so it can be caught later on and handled at the appropriate level."
Advantages of Exceptions
Excellent example of separating error-handling code from program logic
Three Rules for Effective Exception Handling
Longer explanation and case study of exception use, including the basic principles of "throw early" and "catch late". Clear and thorough.
| dependencies { runtime 'org.postgresql:postgresql:9.2-1003-jdbc4' } | |
| task installPostgreSQL(type: Copy) { | |
| def postgreJar = configurations.runtime.find { it.name.contains('postgresql') } | |
| def moduleDir = "$jbossHome/modules/system/layers/base/org/postgresql/main" | |
| from postgreJar | |
| into moduleDir | |
| doLast { |
| # Goto a directory you can write to: | |
| cd ~ | |
| #get composer: | |
| curl -s https://getcomposer.org/installer | php | |
| # move composer into a bin directory you control: | |
| sudo mv composer.phar /usr/local/bin/composer | |
| # double check composer works | |
| composer about |
| import org.jboss.netty.bootstrap.ServerBootstrap | |
| import org.jboss.netty.buffer.ChannelBuffers | |
| import org.jboss.netty.channel.ChannelHandlerContext | |
| import org.jboss.netty.channel.ChannelPipeline | |
| import org.jboss.netty.channel.ChannelPipelineFactory | |
| import org.jboss.netty.channel.Channels | |
| import org.jboss.netty.channel.MessageEvent | |
| import org.jboss.netty.channel.SimpleChannelUpstreamHandler | |
| import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory | |
| import org.jboss.netty.handler.codec.http.DefaultHttpResponse |