SlideShare a Scribd company logo
JSUGA Tech Tips
Christoph Pickl, 2008-06-16
Compiler API
Compiler API
 “Compiling with the Java Compiler API”
   http://java.sun.com/mailers/techtips/corejava/2007/tt0307.html
 Standardized with Java6 (JSR-199)
   before com.sun.tools.javac.Main
     not standard, public programming interface
 Also compiles dependent classes
 Two possibilities: simple and advanced
   both will be covered in next slides
Compiler API - Simple - Roadmap


 Create    sourcecode
 (programatically created)
 Retrieve JavaCompiler
    via ToolProvider


 Invoke run      method
 Check    return code
    0 == successfull


 Get   class via reflection
    create instance, invoke

    methods, get/set fields, ...

Recommended for you

O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010

The document discusses the architecture and advantages of Rails 3. It describes how Rails 3 applications are organized as Rack applications and are more modular than previous versions. Key advantages mentioned include improved performance, being more framework-agnostic, and increased modularity.

Modern PHP
Modern PHPModern PHP
Modern PHP

This document summarizes the evolution of PHP from issues with early versions like inconsistent naming and unpredictable releases to recent improvements like namespaces, anonymous functions, and a standardized release cycle. It discusses tools for PHP development like Composer and FIG as well as educational resources. Key points covered include PHP's move to namespaces in 5.3, anonymous functions in 5.4, and built-in password hashing in 5.5. FIG standards like PSR-0 help code sharing while Composer eases dependency management.

php
PHP 5.3
PHP 5.3PHP 5.3
PHP 5.3

Presentation on major features of PHP 5.3 for the July 2009 Baltimore/Washington DC PHP Meetup. It touches on major features and changes that were made in the PHP 5.3 series

phpmeetupfeatures
Compiler API - Simple - The Source
 First of all: Create desired sourcecode
    Could be created dynamically
 Save it in right location
    Be aware of Eclipse’ standard src folder



package at.sitsolutions.techtips.s4666;

public class Hello {
  public static void sayHello() {
    System.out.println(“Hello TechTips!”);
  }
}
Compiler API - Simple - Compile it
package at.sitsolutions.techtips.s4666;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;

public class CompilerApi {
  public static void main(String[] args) {
    String path = “src/at/sitsolutions/techtips”
                  + “/s4666/Hello.java”;
    JavaCompiler compiler =
        ToolProvider.getSystemJavaCompiler();
    if(compiler.run(null, null, null, path) == 0) {
      // do something with fresh compiled class
    } else {
      System.err.println(“Ups, something went wrong!”);
    }
  }
}
Compiler API - Simple - Use it
 After compiling sourcecode...
    ... access class reflectively
    ... invoke static method

// assume we have compiled our sourcecode successfully

String className = “at.sitsolutions.techtips.s4666.Hello”;

try {
  Class<?> c = Class.forName(className);
  Method m = c.getDeclaredMethod(“sayHello”, new Class[] {});
  m.invoke(null, new Object[] {}); // prints “Hello TechTips”
} catch(Exception e) {
  e.printStackTrace();
}
Compiler API - Simple - Core Method

 The JavaCompiler.run method in detail:
   (actually inherited from javax.tools.Tool)
int run(
                      ... use null for System.in
 InputSream in,
                      ... use null for System.out
 OutputStream out,
                      ... use null for System.err
 OutputStream err,
                      ... files to compile
 String... args
);

Recommended for you

Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directives

1) Verilog allows parameters and localparams to define constants in modules. Parameters can alter module behavior when their values change, while localparam values cannot change. 2) System tasks like $display and $monitor are used for outputting values and monitoring signals. $stop and $finish control simulation execution. 3) Compiler directives like `define, `include, `ifdef and `timescale are used to define macros, include files, and make conditional compilations in Verilog.

fpgaverilogsystem tasks
soscon2018 - Tracing for fun and profit
soscon2018 - Tracing for fun and profitsoscon2018 - Tracing for fun and profit
soscon2018 - Tracing for fun and profit

The document discusses uftrace, a function tracer for user-space programs. It explains that compiling a C program with the -pg option inserts calls to mcount, which records call positions. This allows uftrace to log function calls and returns. Function arguments are passed between calls through defined conventions. Tracing function flow helps with reverse engineering programs by logging minimum required logic.

Flask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuthFlask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuth

Python CodeLabs - Introduction to Flask-RESTful & Flask-HTTPAuth http://eueung.github.io/python/flask-restful

programmingflaskapi
Compiler API - Advanced
 Benefit of advanced version:
    Access to error messages
    More options (usefull if developing an IDE)
 Additionally involved classes:
    DiagnosticCollector, JavaFileObject,
     StandardJavaFileManager, CompilationTask

package at.sitsolutions.techtips.s4666;

public class Hello2 {
  public static void sayHello() {
    System.out.printnl(“Hello TechTips!”);
  }
}
Compiler API - Advanced - Compile it
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics =
    new DiagnosticCollector<JavaFileObject>();

StandardJavaFileManager manager =
    compiler.getStandardFileManager(diagnostics,
      Locale.ENGLISH, new ISO_8859_11());

String file=“src/at/sitsolutions/techtips/s4666/Hello2.java”;
Iterable<? extends JavaFileObject> compilationUnits =
    manager.getJavaFileObjects(new String[] {file});

CompilationTask task = compiler.getTask(null, manager,
                   diagnostics, null, null, compilationUnits);
if(task.call() == false) {
  // put error handling in here
}
manager.close();
Compiler API - Advanced - Error Handling
// error handling

for (Diagnostic d : diagnostics.getDiagnostics())
  System.out.printf(
    “Code: %s%nKind: %s%n” +
    “Position: %s (%s/%s)%n” +
    “Source: %s%nMessage: %s%n”, d.getCode(), d.getKind(),
    d.getPosition(), d.getStartPosition(), d.getEndPosition(),
    d.getSource(), d.getMessage(null));
}
/*
Code: compiler.err.cant.resolve.location
Kind: ERROR
Position: 123 (113/131)
Source: srcatsitsolutionstechtipss4666Hello2.java
Message: srcatsitsolutionstechtipss4666Hello2.java:5: ↵
   cannot find symbol
*/
Compiler API - Advanced - Core Method

  JavaCompiler.getTask method in detail:

CompilationTask getTask(
                        ... use null for System.err
   Writer out,
   JavaFileManager mgr, ... use null for compiler’s standard mgr
   DiagnosticListener lst, ... somehow mandatory
   Iterable<String> options, ... options to compiler
   Iterable<String> classes, ... used for annotation processing
   Iterable<? extends JavaFileObject>
                             ... files to compile
      compilationUnits
);

Recommended for you

エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyoエラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo

2019-05-22 開催の「Laravel Meetup Tokyo Vol.12」におけるLT資料です https://laravel-meetup-tokyo.connpass.com/event/124314

phplaravel
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet

- Java applets allow Java programs to run within web browsers. All applets extend the Applet class and override lifecycle methods like init(), start(), stop(), and destroy(). - To create an applet, you define its structure using these lifecycle methods and draw to the screen using the Graphics object's drawing methods. Applets are compiled and run within HTML using the <applet> tag. - Applets differ from standalone Java applications in that they have security restrictions and run within a web browser rather than having their own execution environment. The Graphics class provides methods for drawing various shapes, text, and images to the applet display area.

How to fake_properly
How to fake_properlyHow to fake_properly
How to fake_properly

Aiming at complete code coverage by unit tests tends to be cumbersome, especially for cases where external API calls a part of the code base. For these reasons, Python comes with the unittest.mock library, appearing to be a powerful companion in replacing parts of the system under test.

python unit tests mock
Compiler API - What for?


 Be     more dynamic
   Create classes on-the-fly
 
  Let application gain
   “experience”
 Build    your own IDE
   Provide meaningfull error
 
   messages
  Highlight specific error in
   sourcecode
 It’s   fun
Using printf
Using printf
 “Using printf with Customized Formattable Classes”
   http://blogs.sun.com/CoreJavaTechTips/entry/using_printf_with_customized_formattable

 Format output available since Java5
   well known from C language (%5.2f%n)
 Formattable interface
   formatTo(Formatter, int, int, int):void
   use locales, flags, width, precision
 Flags available:
   ALTERNATE (#), LEFT_JUSTIFY (-), UPPERCASE (^)
 Usage just as known from C language
Using printf - The Formattable Object
public class Alfa implements Formattable {
  private final String stamp12 =
    “ABCDEF123456”; // alternate
  private final String stamp24 =
    “ABCDEF123456GHIJKL123456”; // default

    public void formatTo(
     Formatter formatter, int flags, int width, int precision) {
      StringBuilder sb = new StringBuilder();

        //   1.   check flags (alternate)
        //   2.   set precision (cut off length)
        //   3.   check locale
        //   4.   setup output justification

        formatter.format(sb.toString());
    }
}

Recommended for you

C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)

The document is a presentation on C++ for Java developers. It introduces C++ concepts like classes, references, pointers, memory management and standard libraries. It emphasizes using modern C++ features like the stack instead of heap for memory, values instead of pointers, and standard libraries. It summarizes that developers should use modern C++ practices like values, references, const, and libraries, but most importantly not use raw pointers like "Banana * b = new Banana();".

c++javaprogramming
Applet
AppletApplet
Applet

An applet is a Java program that runs in a web browser. It extends the Applet class and does not define a main method. Applets are embedded in HTML pages and have a lifecycle of init(), start(), stop(), and destroy() methods. They can use the Graphics class to draw shapes, text, and images. Parameters can be passed to applets from the HTML code.

applet and its life cycle methodapplet
Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2

This document discusses exception handling in C++. It provides an overview of how compilers manage exceptional control flow and how functions are instrumented to handle exceptions. It discusses normal vs exceptional function call flows, and the items involved in stack frames like context, finalization, and unwinding. It also summarizes Meyers' guidelines for exception safety, including using destructors to prevent leaks, handling exceptions in constructors, and preventing exceptions from leaving destructors.

Using printf - formatTo Implementation 1/2
// 1. check flags (alternate)
boolean alternate = (flags & FormattableFlags.ALTERNATE)
                          == FormattableFlags.ALTERNATE;
alternate |= (precision >= 0 && precision <= 12);
String stamp = (alternate ? stamp12 : stamp24);

// 2. set precision (cut off length)
if (precision == -1 || stamp.length() <= precision)
  sb.append(stamp);
else
  sb.append(stamp.substring(0, precision - 1)).append(‘*’);

// 3. check locale
if (formatter.locale().equals(Locale.CHINESE))
  sb.reverse();

// 4. setup output justification
...
Using printf - formatTo Implementation 2/2
// 4. setup output justification

int n = sb.length();
if (n < width) {
  boolean left = (flags & FormattableFlags.LEFT_JUSTIFY)
                       == FormattableFlags.LEFT_JUSTIFY;
  for (int i = 0; i < (width - n); i++) {
    if (left) {
      sb.append(‘ ’);
    } else {
      sb.insert(0, ‘ ‘);
    }
  }
}
Using printf - Examples
final Alfa alfa = new Alfa();

System.out.printf(“>%s<%n”, alfa);
// >ABCDEF123456GHIJKL123456<
System.out.printf(“>%#s<%n”, alfa);
// >ABCDEF123456<
System.out.printf(“>%.5s<%n”, alfa);
// >ABCD*<
System.out.printf(“>%.8s<%n”, alfa);
// >ABCDEF1*<
System.out.printf(“>%-25s<%n”, alfa);
// >ABCDEF123456GHIJKL123456 <
System.out.printf(“>%15.10s<%n”, alfa);
// >     ABCDEF123*<
System.out.printf(Locale.CHINESE, “>%15.10s<%n”, alfa);
// >     *321FEDCBA<
Using printf - What for?


 Much more powerfull
 than simple toString
 Unified use of printf
  (even on own objects)
 Usefull in CLI apps
 Again: It’s fun

Recommended for you

Laravel 5
Laravel 5Laravel 5
Laravel 5

Laravel is a PHP web framework used for building web applications. This document provides an overview of Laravel's installation process, directory structure, routing, controllers, views, and request handling. It explains how to install Laravel using Composer, set up the application key, define routes, create controllers, build and extend views using Blade templates, access request data, and perform validation. The document gives developers a high-level understanding of Laravel's core functionality and features.

Unlock The Mystery Of PHPUnit (Wave PHP 2018)
Unlock The Mystery Of PHPUnit (Wave PHP 2018)Unlock The Mystery Of PHPUnit (Wave PHP 2018)
Unlock The Mystery Of PHPUnit (Wave PHP 2018)

You know you're supposed to write unit tests, but you're not quite sure where to start. This session is for you. We will start from ground zero and go from zero unit test writing experience to functional test-driven developed code. Using the current version of PHPUnit we will cover: * writing basic test cases * simple assertions and constraints * mocking and data providers * testing exceptions and errors * and more! You will leave this session fully ready to write tests for your own code.

Design patterns as power of programing
Design patterns as power of programingDesign patterns as power of programing
Design patterns as power of programing

This document discusses design patterns in programming and provides examples of common patterns like singleton, registry, dependency injection, factory, and decorator. It explains what each pattern is used for and provides PHP code samples to illustrate how each pattern can be implemented. The document also discusses programming frameworks and languages like PHP, Java, and others. It aims to explain the power and usefulness of design patterns in programming.

design patternsphpjandbeyond
JSUGA Tech Tips




 !at’s a
folks

More Related Content

What's hot

Last train to php 7
Last train to php 7Last train to php 7
Last train to php 7
Damien Seguy
 
How to write maintainable code without tests
How to write maintainable code without testsHow to write maintainable code without tests
How to write maintainable code without tests
Juti Noppornpitak
 
Architecture for Massively Parallel HDL Simulations
Architecture for Massively Parallel HDL Simulations Architecture for Massively Parallel HDL Simulations
Architecture for Massively Parallel HDL Simulations
DVClub
 
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
Plataformatec
 
Modern PHP
Modern PHPModern PHP
Modern PHP
Simon Jones
 
PHP 5.3
PHP 5.3PHP 5.3
PHP 5.3
Chris Stone
 
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directives
Malik Tauqir Hasan
 
soscon2018 - Tracing for fun and profit
soscon2018 - Tracing for fun and profitsoscon2018 - Tracing for fun and profit
soscon2018 - Tracing for fun and profit
hanbeom Park
 
Flask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuthFlask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuth
Eueung Mulyana
 
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyoエラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
Shohei Okada
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
backdoor
 
How to fake_properly
How to fake_properlyHow to fake_properly
How to fake_properly
Rainer Schuettengruber
 
C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)
Patricia Aas
 
Applet
AppletApplet
Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2
ppd1961
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
Sudip Simkhada
 
Unlock The Mystery Of PHPUnit (Wave PHP 2018)
Unlock The Mystery Of PHPUnit (Wave PHP 2018)Unlock The Mystery Of PHPUnit (Wave PHP 2018)
Unlock The Mystery Of PHPUnit (Wave PHP 2018)
ENDelt260
 
Design patterns as power of programing
Design patterns as power of programingDesign patterns as power of programing
Design patterns as power of programing
Lukas Lesniewski
 
Applet life cycle
Applet life cycleApplet life cycle
Old Oracle Versions
Old Oracle VersionsOld Oracle Versions
Old Oracle Versions
Jeffrey Kemp
 

What's hot (20)

Last train to php 7
Last train to php 7Last train to php 7
Last train to php 7
 
How to write maintainable code without tests
How to write maintainable code without testsHow to write maintainable code without tests
How to write maintainable code without tests
 
Architecture for Massively Parallel HDL Simulations
Architecture for Massively Parallel HDL Simulations Architecture for Massively Parallel HDL Simulations
Architecture for Massively Parallel HDL Simulations
 
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
 
Modern PHP
Modern PHPModern PHP
Modern PHP
 
PHP 5.3
PHP 5.3PHP 5.3
PHP 5.3
 
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directives
 
soscon2018 - Tracing for fun and profit
soscon2018 - Tracing for fun and profitsoscon2018 - Tracing for fun and profit
soscon2018 - Tracing for fun and profit
 
Flask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuthFlask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuth
 
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyoエラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
 
How to fake_properly
How to fake_properlyHow to fake_properly
How to fake_properly
 
C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)C++ for Java Developers (JavaZone 2017)
C++ for Java Developers (JavaZone 2017)
 
Applet
AppletApplet
Applet
 
Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2
 
Laravel 5
Laravel 5Laravel 5
Laravel 5
 
Unlock The Mystery Of PHPUnit (Wave PHP 2018)
Unlock The Mystery Of PHPUnit (Wave PHP 2018)Unlock The Mystery Of PHPUnit (Wave PHP 2018)
Unlock The Mystery Of PHPUnit (Wave PHP 2018)
 
Design patterns as power of programing
Design patterns as power of programingDesign patterns as power of programing
Design patterns as power of programing
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
 
Old Oracle Versions
Old Oracle VersionsOld Oracle Versions
Old Oracle Versions
 

Viewers also liked

Qué es Delibera
Qué es DeliberaQué es Delibera
Qué es Delibera
milcapm
 
Unit 1, Chapter 2
Unit 1, Chapter 2Unit 1, Chapter 2
Unit 1, Chapter 2
Mr. Benson
 
Podcasts
PodcastsPodcasts
Podcasts
markward20
 
Trucosdelmovil
TrucosdelmovilTrucosdelmovil
Trucosdelmovil
guest8ba598
 
Agua Premium
Agua PremiumAgua Premium
Agua Premium
guestcd1653
 
NNUG Certification Presentation
NNUG Certification PresentationNNUG Certification Presentation
NNUG Certification Presentation
Niall Merrigan
 
Qué es Delibera
Qué es DeliberaQué es Delibera
Qué es Delibera
guest56d6c8
 
Website Fuzziness
Website FuzzinessWebsite Fuzziness
Website Fuzziness
Niall Merrigan
 

Viewers also liked (8)

Qué es Delibera
Qué es DeliberaQué es Delibera
Qué es Delibera
 
Unit 1, Chapter 2
Unit 1, Chapter 2Unit 1, Chapter 2
Unit 1, Chapter 2
 
Podcasts
PodcastsPodcasts
Podcasts
 
Trucosdelmovil
TrucosdelmovilTrucosdelmovil
Trucosdelmovil
 
Agua Premium
Agua PremiumAgua Premium
Agua Premium
 
NNUG Certification Presentation
NNUG Certification PresentationNNUG Certification Presentation
NNUG Certification Presentation
 
Qué es Delibera
Qué es DeliberaQué es Delibera
Qué es Delibera
 
Website Fuzziness
Website FuzzinessWebsite Fuzziness
Website Fuzziness
 

Similar to JSUG - Tech Tips1 by Christoph Pickl

Java 5 and 6 New Features
Java 5 and 6 New FeaturesJava 5 and 6 New Features
Java 5 and 6 New Features
Jussi Pohjolainen
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
yinonavraham
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
Siarhei Barysiuk
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
ciklum_ods
 
ES2015 workflows
ES2015 workflowsES2015 workflows
ES2015 workflows
Jarrod Overson
 
Ecmascript 2015 – best of new features()
Ecmascript 2015 – best of new features()Ecmascript 2015 – best of new features()
Ecmascript 2015 – best of new features()
Miłosz Sobczak
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
chartjes
 
Unit Testing from Setup to Deployment
Unit Testing from Setup to DeploymentUnit Testing from Setup to Deployment
Unit Testing from Setup to Deployment
Mark Niebergall
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
patter
 
A few good JavaScript development tools
A few good JavaScript development toolsA few good JavaScript development tools
A few good JavaScript development tools
Simon Kim
 
Cappuccino @ JSConf 2009
Cappuccino @ JSConf 2009Cappuccino @ JSConf 2009
Cappuccino @ JSConf 2009
tolmasky
 
On Processors, Compilers and @Configurations
On Processors, Compilers and @ConfigurationsOn Processors, Compilers and @Configurations
On Processors, Compilers and @Configurations
Netcetera
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web Framework
Ben Scofield
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
Alan Pinstein
 
Java 7 New Features
Java 7 New FeaturesJava 7 New Features
Java 7 New Features
Jussi Pohjolainen
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
François Sarradin
 
10 Catalyst Tips
10 Catalyst Tips10 Catalyst Tips
10 Catalyst Tips
Jay Shirley
 
Ch ch-changes cake php2
Ch ch-changes cake php2Ch ch-changes cake php2
Ch ch-changes cake php2
markstory
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
Gil Fink
 

Similar to JSUG - Tech Tips1 by Christoph Pickl (20)

Java 5 and 6 New Features
Java 5 and 6 New FeaturesJava 5 and 6 New Features
Java 5 and 6 New Features
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
JavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best PracticesJavaScript and UI Architecture Best Practices
JavaScript and UI Architecture Best Practices
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
ES2015 workflows
ES2015 workflowsES2015 workflows
ES2015 workflows
 
Ecmascript 2015 – best of new features()
Ecmascript 2015 – best of new features()Ecmascript 2015 – best of new features()
Ecmascript 2015 – best of new features()
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
Unit Testing from Setup to Deployment
Unit Testing from Setup to DeploymentUnit Testing from Setup to Deployment
Unit Testing from Setup to Deployment
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
 
A few good JavaScript development tools
A few good JavaScript development toolsA few good JavaScript development tools
A few good JavaScript development tools
 
Cappuccino @ JSConf 2009
Cappuccino @ JSConf 2009Cappuccino @ JSConf 2009
Cappuccino @ JSConf 2009
 
On Processors, Compilers and @Configurations
On Processors, Compilers and @ConfigurationsOn Processors, Compilers and @Configurations
On Processors, Compilers and @Configurations
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web Framework
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Java 7 New Features
Java 7 New FeaturesJava 7 New Features
Java 7 New Features
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
10 Catalyst Tips
10 Catalyst Tips10 Catalyst Tips
10 Catalyst Tips
 
Ch ch-changes cake php2
Ch ch-changes cake php2Ch ch-changes cake php2
Ch ch-changes cake php2
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
 

More from Christoph Pickl

JSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph PicklJSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph Pickl
Christoph Pickl
 
JSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir classJSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir class
Christoph Pickl
 
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven DolgJSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
Christoph Pickl
 
JSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph PicklJSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph Pickl
Christoph Pickl
 
JSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert PreiningJSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert Preining
Christoph Pickl
 
JSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklJSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph Pickl
Christoph Pickl
 
JSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph PicklJSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph Pickl
Christoph Pickl
 
JSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin SchuerrerJSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin Schuerrer
Christoph Pickl
 
JSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas HubmerJSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas Hubmer
Christoph Pickl
 
JSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar PetrovJSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar Petrov
Christoph Pickl
 
JSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans SowaJSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans Sowa
Christoph Pickl
 
JSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas PieberJSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas Pieber
Christoph Pickl
 
JSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangJSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas Lang
Christoph Pickl
 
JSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph PicklJSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph Pickl
Christoph Pickl
 
JSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael GreifenederJSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael Greifeneder
Christoph Pickl
 
JSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklJSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph Pickl
Christoph Pickl
 
JSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikJSUG - Seam by Florian Motlik
JSUG - Seam by Florian Motlik
Christoph Pickl
 
JSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan ZarnikovJSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan Zarnikov
Christoph Pickl
 
JSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph PicklJSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph Pickl
Christoph Pickl
 
JSUG - Inversion Of Control by Florian Motlik
JSUG - Inversion Of Control by Florian MotlikJSUG - Inversion Of Control by Florian Motlik
JSUG - Inversion Of Control by Florian Motlik
Christoph Pickl
 

More from Christoph Pickl (20)

JSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph PicklJSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph Pickl
 
JSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir classJSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir class
 
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven DolgJSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
 
JSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph PicklJSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph Pickl
 
JSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert PreiningJSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert Preining
 
JSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklJSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph Pickl
 
JSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph PicklJSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph Pickl
 
JSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin SchuerrerJSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin Schuerrer
 
JSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas HubmerJSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas Hubmer
 
JSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar PetrovJSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar Petrov
 
JSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans SowaJSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans Sowa
 
JSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas PieberJSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas Pieber
 
JSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangJSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas Lang
 
JSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph PicklJSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph Pickl
 
JSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael GreifenederJSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael Greifeneder
 
JSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklJSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph Pickl
 
JSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikJSUG - Seam by Florian Motlik
JSUG - Seam by Florian Motlik
 
JSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan ZarnikovJSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan Zarnikov
 
JSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph PicklJSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph Pickl
 
JSUG - Inversion Of Control by Florian Motlik
JSUG - Inversion Of Control by Florian MotlikJSUG - Inversion Of Control by Florian Motlik
JSUG - Inversion Of Control by Florian Motlik
 

Recently uploaded

Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
Andrey Yasko
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
Liveplex
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
RaminGhanbari2
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
Toru Tamaki
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Bert Blevins
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
ScyllaDB
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
Awais Yaseen
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
Safe Software
 

Recently uploaded (20)

Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
 
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALLBLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
BLOCKCHAIN FOR DUMMIES: GUIDEBOOK FOR ALL
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
Coordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar SlidesCoordinate Systems in FME 101 - Webinar Slides
Coordinate Systems in FME 101 - Webinar Slides
 

JSUG - Tech Tips1 by Christoph Pickl

  • 1. JSUGA Tech Tips Christoph Pickl, 2008-06-16
  • 3. Compiler API  “Compiling with the Java Compiler API”  http://java.sun.com/mailers/techtips/corejava/2007/tt0307.html  Standardized with Java6 (JSR-199)  before com.sun.tools.javac.Main  not standard, public programming interface  Also compiles dependent classes  Two possibilities: simple and advanced  both will be covered in next slides
  • 4. Compiler API - Simple - Roadmap  Create sourcecode (programatically created)  Retrieve JavaCompiler via ToolProvider   Invoke run method  Check return code 0 == successfull   Get class via reflection create instance, invoke  methods, get/set fields, ...
  • 5. Compiler API - Simple - The Source  First of all: Create desired sourcecode  Could be created dynamically  Save it in right location  Be aware of Eclipse’ standard src folder package at.sitsolutions.techtips.s4666; public class Hello { public static void sayHello() { System.out.println(“Hello TechTips!”); } }
  • 6. Compiler API - Simple - Compile it package at.sitsolutions.techtips.s4666; import javax.tools.JavaCompiler; import javax.tools.ToolProvider; public class CompilerApi { public static void main(String[] args) { String path = “src/at/sitsolutions/techtips” + “/s4666/Hello.java”; JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if(compiler.run(null, null, null, path) == 0) { // do something with fresh compiled class } else { System.err.println(“Ups, something went wrong!”); } } }
  • 7. Compiler API - Simple - Use it  After compiling sourcecode...  ... access class reflectively  ... invoke static method // assume we have compiled our sourcecode successfully String className = “at.sitsolutions.techtips.s4666.Hello”; try { Class<?> c = Class.forName(className); Method m = c.getDeclaredMethod(“sayHello”, new Class[] {}); m.invoke(null, new Object[] {}); // prints “Hello TechTips” } catch(Exception e) { e.printStackTrace(); }
  • 8. Compiler API - Simple - Core Method  The JavaCompiler.run method in detail:  (actually inherited from javax.tools.Tool) int run( ... use null for System.in InputSream in, ... use null for System.out OutputStream out, ... use null for System.err OutputStream err, ... files to compile String... args );
  • 9. Compiler API - Advanced  Benefit of advanced version:  Access to error messages  More options (usefull if developing an IDE)  Additionally involved classes:  DiagnosticCollector, JavaFileObject, StandardJavaFileManager, CompilationTask package at.sitsolutions.techtips.s4666; public class Hello2 { public static void sayHello() { System.out.printnl(“Hello TechTips!”); } }
  • 10. Compiler API - Advanced - Compile it JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>(); StandardJavaFileManager manager = compiler.getStandardFileManager(diagnostics, Locale.ENGLISH, new ISO_8859_11()); String file=“src/at/sitsolutions/techtips/s4666/Hello2.java”; Iterable<? extends JavaFileObject> compilationUnits = manager.getJavaFileObjects(new String[] {file}); CompilationTask task = compiler.getTask(null, manager, diagnostics, null, null, compilationUnits); if(task.call() == false) { // put error handling in here } manager.close();
  • 11. Compiler API - Advanced - Error Handling // error handling for (Diagnostic d : diagnostics.getDiagnostics()) System.out.printf( “Code: %s%nKind: %s%n” + “Position: %s (%s/%s)%n” + “Source: %s%nMessage: %s%n”, d.getCode(), d.getKind(), d.getPosition(), d.getStartPosition(), d.getEndPosition(), d.getSource(), d.getMessage(null)); } /* Code: compiler.err.cant.resolve.location Kind: ERROR Position: 123 (113/131) Source: srcatsitsolutionstechtipss4666Hello2.java Message: srcatsitsolutionstechtipss4666Hello2.java:5: ↵ cannot find symbol */
  • 12. Compiler API - Advanced - Core Method  JavaCompiler.getTask method in detail: CompilationTask getTask( ... use null for System.err Writer out, JavaFileManager mgr, ... use null for compiler’s standard mgr DiagnosticListener lst, ... somehow mandatory Iterable<String> options, ... options to compiler Iterable<String> classes, ... used for annotation processing Iterable<? extends JavaFileObject> ... files to compile compilationUnits );
  • 13. Compiler API - What for?  Be more dynamic Create classes on-the-fly   Let application gain “experience”  Build your own IDE Provide meaningfull error  messages  Highlight specific error in sourcecode  It’s fun
  • 15. Using printf  “Using printf with Customized Formattable Classes”  http://blogs.sun.com/CoreJavaTechTips/entry/using_printf_with_customized_formattable  Format output available since Java5  well known from C language (%5.2f%n)  Formattable interface  formatTo(Formatter, int, int, int):void  use locales, flags, width, precision  Flags available:  ALTERNATE (#), LEFT_JUSTIFY (-), UPPERCASE (^)  Usage just as known from C language
  • 16. Using printf - The Formattable Object public class Alfa implements Formattable { private final String stamp12 = “ABCDEF123456”; // alternate private final String stamp24 = “ABCDEF123456GHIJKL123456”; // default public void formatTo( Formatter formatter, int flags, int width, int precision) { StringBuilder sb = new StringBuilder(); // 1. check flags (alternate) // 2. set precision (cut off length) // 3. check locale // 4. setup output justification formatter.format(sb.toString()); } }
  • 17. Using printf - formatTo Implementation 1/2 // 1. check flags (alternate) boolean alternate = (flags & FormattableFlags.ALTERNATE) == FormattableFlags.ALTERNATE; alternate |= (precision >= 0 && precision <= 12); String stamp = (alternate ? stamp12 : stamp24); // 2. set precision (cut off length) if (precision == -1 || stamp.length() <= precision) sb.append(stamp); else sb.append(stamp.substring(0, precision - 1)).append(‘*’); // 3. check locale if (formatter.locale().equals(Locale.CHINESE)) sb.reverse(); // 4. setup output justification ...
  • 18. Using printf - formatTo Implementation 2/2 // 4. setup output justification int n = sb.length(); if (n < width) { boolean left = (flags & FormattableFlags.LEFT_JUSTIFY) == FormattableFlags.LEFT_JUSTIFY; for (int i = 0; i < (width - n); i++) { if (left) { sb.append(‘ ’); } else { sb.insert(0, ‘ ‘); } } }
  • 19. Using printf - Examples final Alfa alfa = new Alfa(); System.out.printf(“>%s<%n”, alfa); // >ABCDEF123456GHIJKL123456< System.out.printf(“>%#s<%n”, alfa); // >ABCDEF123456< System.out.printf(“>%.5s<%n”, alfa); // >ABCD*< System.out.printf(“>%.8s<%n”, alfa); // >ABCDEF1*< System.out.printf(“>%-25s<%n”, alfa); // >ABCDEF123456GHIJKL123456 < System.out.printf(“>%15.10s<%n”, alfa); // > ABCDEF123*< System.out.printf(Locale.CHINESE, “>%15.10s<%n”, alfa); // > *321FEDCBA<
  • 20. Using printf - What for?  Much more powerfull than simple toString  Unified use of printf (even on own objects)  Usefull in CLI apps  Again: It’s fun
  • 21. JSUGA Tech Tips !at’s a
  • 22. folks