Server-Side Web Programming: Java. Copyright 2017 by Robert M. Dondero, Ph.D Princeton University

Size: px
Start display at page:

Download "Server-Side Web Programming: Java. Copyright 2017 by Robert M. Dondero, Ph.D Princeton University"

Transcription

1 Server-Side Web Programming: Java Copyright 2017 by Robert M. Dondero, Ph.D Princeton University 1

2 Objectives You will learn about: Server-side web programming in Java, via Servlets The Spark web app framework The Velocity template engine 2

3 Agenda 1. Servlet Programming 2. The Spark Web Application Framework 3. The Velocity Template Engine 3

4 Java Web Programming Question: How does one do web programming in Java? 4

5 CGI with Java Answer 1: Use CGI Possible, but Very inefficient Each request forks a new child process and execs a new JVM! Java standard library provides no CGI classes No real website would use them anyway (I composed some for my own use; see me if you want) 5

6 Servlets Answer 2: Use Servlets A servlet is a Java technology-based Web component, managed by a container, that generates dynamic content. Servlet specification at: 6

7 Servlets Servlet Container Browser HTTP Server Servlet1 Servlet2 Servlet3 Servlet4 Your app Popular servlet containers: Apache Tomcat Eclipse Jetty 7

8 Servlets Tomcat or Jetty Browser Servlet1 Servlet2 Servlet3 Servlet4 Your app Tomcat or Jetty can be both HTTP server and servlet container We ll use Jetty 8

9 WSGI and Servlets Python: WSGI specification connects HTTP server and your Python app Programmers compose Python code to conform to WSGI spec Sys admins deploy Python code with HTTP server 9

10 WSGI and Servlets Java: Servlet specification connects HTTP server and your Java app Programmers compose Java code to conform to Servlet spec Sys admins deploy Java code with Servlet container and HTTP server 10

11 PennyServlet App See PennyServlet App runserver runserver.bat Book.java Database.java Common.java IndexServlet.java SearchFormServlet.java SearchResultsServlet.java Penny.java 11

12 Java Frameworks Answer 3: Use a Java web app framework 12

13 Agenda 1. Servlet Programming 2. The Spark Web Application Framework 3. The Velocity Template Engine 13

14 The Spark Web App Framework Who: Per Wendel When: 2011, rewritten for Java 8 in 2014 Descrip: A micro framework for creating web applications in Kotlin and Java 8 with minimal effort Spark website 14

15 Why Spark? Why study Spark? (Instead of some other framework) Easy to learn Simple ( micro-framework ) Good documentation and tutorial Reasonable to use for Assignments 3 & 4 Installed on CourseLab Easy to install on your personal computer Integrated with Jetty container/server Allows flat directory structure; easy to submit 15

16 PennySpark1Fund App See PennySpark1Fund App runserver, runserver.bat, Book.java, Database.java Common.java Penny.java Generalizing 16

17 PennySpark1Fund App Spark separates URL from file name (Unlike CGI) Can use pretty URLs Spark separates URL from method name Can map multiple URLs to same method Can change method name without changing URL, or vice versa 17

18 PennySpark1Fund App Spark provides utility functions Functions to fetch name=value pairs Functions to fetch/create cookies Function to implement HTTP redirect 18

19 Aside: Lambda Expressions Lambda expression A nameless function From Alonzo Church, 1930s 19

20 Aside: Python Lambda Exprs In Python: The keyword lambda (optionally) parameters separated by commas A colon A single expression that uses the parameters 20

21 Aside: Python Lambda Exprs Without using a lambda expression: Using a lambda expression: def mult(x, y): return x * y prod = mult(5, 6) print prod # prints 30 mult = lambda x, y: x * y prod = mult(5, 6) print prod # prints 30 Using a lambda expression: print (lambda x, y: x * y)(5, 6) # prints 30 21

22 Aside: Python Lambda Exprs def comparestrlengths(s1, s2): return len(s1) len(s2) strlist.sort(cmp=comparestrlengths) strlist.sort( cmp=lambda s1,s2: len(s1) len(s2) ) 22

23 Aside: Java Lambda Exprs Java lambda expressions New to Java SE 8 Examples 23

24 Aside: Java Lambda Exprs class StrLenComparator implements Comparator<String> { public int compare(string s1, String s2) { return s1.length() s2.length(); } } String[] strarray; Arrays.sort(strArray, new StrLenComparator()); String[] strarray; Arrays.sort(strArray, (String s1, String s2) -> s1.length() s2.length() ); 24

25 Aside: Java Lambda Exprs class StrLenComparator implements Comparator<String> { public int compare(string s1, String s2) { return s1.length() s2.length(); } } String[] array; Arrays.sort(strArray, new StrLenComparator()); String[] strarray; Arrays.sort(strArray, (s1, s2) -> s1.length() s2.length() ); Can omit param types if compiler can infer them 25

26 Aside: Java Lambda Exprs class StrLenComparator implements Comparator<String> { public int compare(string s1, String s2) { if (s1.length() < s2.length()) return -1; if (s1.length() > s2.length()) return 1; return 0; } } String[] strarray; Arrays.sort(strArray, new StrLenComparator()); 26

27 Aside: Java Lambda Exprs String[] strarray; Arrays.sort(strArray, (String s1, String s2) -> { if (s1.length() < s2.length()) return -1; if (s1.length() > s2.length()) return 1; return 0; } ); Consequent need not be a single expr Can surround consequent with braces Consequent must evaluate to (return) something 27

28 Aside: Java Lambda Exprs Generalizing Functional interface An interface with a single method Can use a lambda expression in lieu of an instance of a class that implements a functional interface 28

29 Java Lambda Expr Commentary It s best to think of a lambda expression as a function, not an object, and to accept that it can be passed to a functional interface. -- Horstmann Function pointers in a language that doesn t have functions! Handy! Inelegant? 29

30 PennySpark1Fund App Spark uses Java lambda expressions Using a lambda expression: class Penny { private static String index(request req, Response res) {} public static void main(string[] args) { Spark.get("/index", (req, res) -> index(req, res) ); } } 30

31 PennySpark1Fund App Same code without using a lambda expr: class IndexRoute implements Route { public Object handle(request req, Response res) { return Penny.index(req, res); } } class Penny { public static String index(request req, Response res) {} public static void main(string[] args) { Spark.get("/index", new IndexRoute()); } } 31

32 Agenda 1. Servlet Programming 2. The Spark Web Application Framework 3. The Velocity Template Engine 32

33 Toward PennySpark2Templates Problem: Code contains many assignment statements to compose HTML code Bulky; awkward; error prone Solution: Templates In this case via The Apache Velocity template engine 33

34 PennySpark2Templates App See PennySpark2Templates App runserver, runserver.bat, Book.java, Database.java header.vtl footer.vtl index.vtl searchform.vtl searchresults.vtl Penny.java Generalizing 34

35 PennySpark2Templates App Template (informally) HTML doc with placeholders Each placeholder is identified by a key hello.vtl Hello <strong>${username}</strong> and welcome 35

36 PennySpark2Templates App To instantiate a template: Map<String, Object> map = new HashMap<>(); map.put("key1", value1); ModelAndView mv = new ModelAndView(map, "somefile.vtl"); return new VelocityTemplateEngine().render(mv); 36

37 PennySpark2Templates App Template can contain: Inline expressions ${expr} expr usually is a key in the provided map ${prevauthor} expr can be any expression that evaluates to a String or has a String representation ${book.getauthor()} 37

38 PennySpark2Templates App Includes of other templates #parse("other.vtl") #parse("header.vtl") 38

39 PennySpark2Templates App Template cannot contain embedded Java code! Instead use a special purpose (Apache Velocity) language Examples 39

40 PennySpark2Templates App #if (${errormsg}) <strong>${errormsg}</strong> #end #if (${books.size()} == 0) (None) #else #foreach (${book} in ${books}) ${book.getauthor()}, ${book.gettitle()}, ($${book.getprice()})<br> #end #end 40

41 MVC Architecture Notes: Bottle encourages use of MVC Bottle encourages separation of concerns But Python code can appear in Bottle views Notes: Spark/Velocity more strongly encourages use of MVC Spark/Velocity more strongly encourages separation of concerns Java code cannot appear in Velocity views 41

42 More Spark and Velocity! There is much more to Spark and Velocity Spark website: Spark documentation: Velocity documentation: Don t confuse Spark (sometimes called SparkJava) with Apache Spark (an open-source cluster-computing framework) 42

43 Summary We have covered: Server-side web programming in Java, via Servlets The Spark web app framework The Velocity template engine 43

Server-Side Web Programming: Python (Part 2) Copyright 2017 by Robert M. Dondero, Ph.D Princeton University

Server-Side Web Programming: Python (Part 2) Copyright 2017 by Robert M. Dondero, Ph.D Princeton University Server-Side Web Programming: Python (Part 2) Copyright 2017 by Robert M. Dondero, Ph.D Princeton University 1 Objectives You will learn about: Python WSGI programming Web app frameworks in general (briefly)

More information

Server-Side Web Programming: Python (Part 1) Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Server-Side Web Programming: Python (Part 1) Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University Server-Side Web Programming: Python (Part 1) Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University 1 Objectives You will learn about Server-side web programming in Python Common Gateway Interface

More information

COS 333: Advanced Programming Techniques. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

COS 333: Advanced Programming Techniques. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University COS 333: Advanced Programming Techniques Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University 1 Agenda Introductions Course Overview Resources Topics Assignments Project (briefly) Schedule (briefly)

More information

Web Architecture and Development

Web Architecture and Development Web Architecture and Development SWEN-261 Introduction to Software Engineering Department of Software Engineering Rochester Institute of Technology Here's the agenda for this lecture. 1. Fundamentals of

More information

Chapter Two Bonus Lesson: JavaDoc

Chapter Two Bonus Lesson: JavaDoc We ve already talked about adding simple comments to your source code. The JDK actually supports more meaningful comments as well. If you add specially-formatted comments, you can then use a tool called

More information

Introduction to Computer Science I

Introduction to Computer Science I Introduction to Computer Science I Classes Janyl Jumadinova 5-7 March, 2018 Classes Most of our previous programs all just had a main() method in one file. 2/13 Classes Most of our previous programs all

More information

Setting Up the Development Environment

Setting Up the Development Environment CHAPTER 5 Setting Up the Development Environment This chapter tells you how to prepare your development environment for building a ZK Ajax web application. You should follow these steps to set up an environment

More information

Concurrent Programming. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

Concurrent Programming. Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University Concurrent Programming Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University 1 Objectives You will learn/review: What a process is How to fork and wait for processes What a thread is How to spawn

More information

Web Architecture and Development

Web Architecture and Development Web Architecture and Development SWEN-261 Introduction to Software Engineering Department of Software Engineering Rochester Institute of Technology HTTP is the protocol of the world-wide-web. The Hypertext

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming

More information

web.py Tutorial Tom Kelliher, CS 317 This tutorial is the tutorial from the web.py web site, with a few revisions for our local environment.

web.py Tutorial Tom Kelliher, CS 317 This tutorial is the tutorial from the web.py web site, with a few revisions for our local environment. web.py Tutorial Tom Kelliher, CS 317 1 Acknowledgment This tutorial is the tutorial from the web.py web site, with a few revisions for our local environment. 2 Starting So you know Python and want to make

More information

COS 333: Advanced Programming Techniques

COS 333: Advanced Programming Techniques COS 333: Advanced Programming Techniques Robert M. Dondero, Ph.D. Princeton University Please pick up handouts at the back of the room 1 COS 333: Course Overview Copyright 2018 by Robert M. Dondero, Ph.D.

More information

Certified Core Java Developer VS-1036

Certified Core Java Developer VS-1036 VS-1036 1. LANGUAGE FUNDAMENTALS The Java language's programming paradigm is implementation and improvement of Object Oriented Programming (OOP) concepts. The Java language has its own rules, syntax, structure

More information

29-27 May 2013 CERN WEB FRAMEWORKS. Adrian Mönnich

29-27 May 2013 CERN WEB FRAMEWORKS. Adrian Mönnich First Indico Workshop 29-27 May 2013 CERN WEB FRAMEWORKS Adrian Mönnich Framework? What? Do we have one? Do we need one? A web application framework is a software framework that is designed to support

More information

class objects instances Fields Constructors Methods static

class objects instances Fields Constructors Methods static Class Structure Classes A class describes a set of objects The objects are called instances of the class A class describes: Fields (instance variables)that hold the data for each object Constructors that

More information

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable? Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable

More information

SSC - Web applications and development Introduction and Java Servlet (I)

SSC - Web applications and development Introduction and Java Servlet (I) SSC - Web applications and development Introduction and Java Servlet (I) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics What will we learn

More information

Java: Classes. An instance of a class is an object based on the class. Creation of an instance from a class is called instantiation.

Java: Classes. An instance of a class is an object based on the class. Creation of an instance from a class is called instantiation. Java: Classes Introduction A class defines the abstract characteristics of a thing (object), including its attributes and what it can do. Every Java program is composed of at least one class. From a programming

More information

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java Chapter 1 Introduction to Computers, Programs, and Java 1 Programs Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Without programs,

More information

CSE 142 Su 04 Computer Programming 1 - Java. Objects

CSE 142 Su 04 Computer Programming 1 - Java. Objects Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request

More information

Lecture 02, Fall 2018 Friday September 7

Lecture 02, Fall 2018 Friday September 7 Anatomy of a class Oliver W. Layton CS231: Data Structures and Algorithms Lecture 02, Fall 2018 Friday September 7 Follow-up Python is also cross-platform. What s the advantage of Java? It s true: Python

More information

A Long Time Ago 2 / 64

A Long Time Ago 2 / 64 ndertow 1 / 64 A Long Time Ago 2 / 64 A Long Time Ago 3 / 64 A Long Time Ago 4 / 64 Undertow 5 / 64 Features HTTP/HTTPS HTTP/2 WebSockets 6 / 64 Hello, World! Undertow.builder().addHttpListener(8080, "localhost")

More information

UIMA Simple Server User Guide

UIMA Simple Server User Guide UIMA Simple Server User Guide Written and maintained by the Apache UIMA Development Community Version 2.3.1 Copyright 2006, 2011 The Apache Software Foundation License and Disclaimer. The ASF licenses

More information

Igniting QuantLib on a Zeppelin

Igniting QuantLib on a Zeppelin Igniting QuantLib on a Zeppelin Andreas Pfadler, d-fine GmbH QuantLib UserMeeting, Düsseldorf, 7.12.2016 d-fine d-fine All rights All rights reserved reserved 0 Welcome Back!» An early stage of this work

More information

How to make a "hello world" program in Java with Eclipse *

How to make a hello world program in Java with Eclipse * OpenStax-CNX module: m43473 1 How to make a "hello world" program in Java with Eclipse * Hannes Hirzel Based on How to make a "hello world" program in Java. by Rodrigo Rodriguez This work is produced by

More information

Chapter 1 Introduction to Java

Chapter 1 Introduction to Java Chapter 1 Introduction to Java 1 Why Java? The answer is that Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. The future

More information

HOW TO FLASK. And a very short intro to web development and databases

HOW TO FLASK. And a very short intro to web development and databases HOW TO FLASK And a very short intro to web development and databases FLASK Flask is a web application framework written in Python. Created by an international Python community called Pocco. Based on 2

More information

Dialects of ML. CMSC 330: Organization of Programming Languages. Dialects of ML (cont.) Features of ML. Functional Languages. Features of ML (cont.

Dialects of ML. CMSC 330: Organization of Programming Languages. Dialects of ML (cont.) Features of ML. Functional Languages. Features of ML (cont. CMSC 330: Organization of Programming Languages OCaml 1 Functional Programming Dialects of ML ML (Meta Language) Univ. of Edinburgh,1973 Part of a theorem proving system LCF The Logic of Computable Functions

More information

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 1 1. Please obtain a copy of Introduction to Java Programming, 11th (or 10th) Edition, Brief

More information

Pemrograman Jaringan Web Client Access PTIIK

Pemrograman Jaringan Web Client Access PTIIK Pemrograman Jaringan Web Client Access PTIIK - 2012 In This Chapter You'll learn how to : Download web pages Authenticate to a remote HTTP server Submit form data Handle errors Communicate with protocols

More information

Session 13. RESTful Services Part 2. Lecture Objectives

Session 13. RESTful Services Part 2. Lecture Objectives Session 13 RESTful Services Part 2 1 Lecture Objectives Understand how to pass parameters to a Web services Understand how to return values from a Web service 2 10/31/2018 1 Reading Tutorials Reading &

More information

CS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java

CS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 FALL 2017 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 CMS VideoNote.com, PPT slides, DrJava 2 CMS. Visit course webpage, click Links, then CMS for 2110.

More information

Project 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with

Project 1. Java Control Structures 1/17/2014. Project 1 and Java Intro. Project 1 (2) To familiarize with Project 1 and Java Intro Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The University of Texas at Arlington, Arlington, TX 76019 Email: sharma@cse.uta.edu

More information

Ch04 JavaServer Pages (JSP)

Ch04 JavaServer Pages (JSP) Ch04 JavaServer Pages (JSP) Introduce concepts of JSP Web components Compare JSP with Servlets Discuss JSP syntax, EL (expression language) Discuss the integrations with JSP Discuss the Standard Tag Library,

More information

Eng. Mohammed S. Abdualal

Eng. Mohammed S. Abdualal Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2124) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 1 Introduction

More information

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul CIS192 Python Programming Web Frameworks and Web APIs Harry Smith University of Pennsylvania March 29, 2016 Harry Smith (University of Pennsylvania) CIS 192 March 29, 2016 1 / 25 Quick housekeeping Last

More information

1.00 Lecture 8. Using An Existing Class, cont.

1.00 Lecture 8. Using An Existing Class, cont. .00 Lecture 8 Classes, continued Reading for next time: Big Java: sections 7.9 Using An Existing Class, cont. From last time: is a Java class used by the BusTransfer class BusTransfer uses objects: First

More information

Unifer Documentation. Release V1.0. Matthew S

Unifer Documentation. Release V1.0. Matthew S Unifer Documentation Release V1.0 Matthew S July 28, 2014 Contents 1 Unifer Tutorial - Notes Web App 3 1.1 Setting up................................................. 3 1.2 Getting the Template...........................................

More information

Welcome to CSSE 220. We are excited that you are here:

Welcome to CSSE 220. We are excited that you are here: Welcome to CSSE 220 We are excited that you are here: Start your computer Do NOT start Eclipse Follow the instructions in the email, if you haven t already Pick up a quiz from the back table Answer the

More information

IBM LOT-985. Developing IBM Lotus Notes and Domino(R) 8.5 Applications.

IBM LOT-985. Developing IBM Lotus Notes and Domino(R) 8.5 Applications. IBM LOT-985 Developing IBM Lotus Notes and Domino(R) 8.5 Applications http://killexams.com/exam-detail/lot-985 QUESTION: 182 Robert is adding an editable field called CountryLocation to the Member form

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

IBM Rational Software

IBM Rational Software IBM Rational Software Development Conference 2008 Introduction to the Jazz Technology Platform: Architecture Overview and Extensibility Scott Rich Distinguished Engineer, Jazz Architect IBM Rational SDP21

More information

Every language has its own scoping rules. For example, what is the scope of variable j in this Java program?

Every language has its own scoping rules. For example, what is the scope of variable j in this Java program? Lexical Binding There are two ways a variable can be used in a program: As a declaration As a "reference" or use of the variable Scheme has two kinds of variable "declarations" -- the bindings of a let-expression

More information

Using IDLE for

Using IDLE for Using IDLE for 15-110 Step 1: Installing Python Download and install Python using the Resources page of the 15-110 website. Be sure to install version 3.3.2 and the correct version depending on whether

More information

MEAP Edition Manning Early Access Program Get Programming with Java Version 1

MEAP Edition Manning Early Access Program Get Programming with Java Version 1 MEAP Edition Manning Early Access Program Get Programming with Java Version 1 Copyright 2018 Manning Publications For more information on this and other Manning titles go to www.manning.com welcome First,

More information

Java Server Page (JSP)

Java Server Page (JSP) Java Server Page (JSP) CS 4640 Programming Languages for Web Applications [Based in part on SWE432 and SWE632 materials by Jeff Offutt] [Robert W. Sebesta, Programming the World Wide Web] 1 Web Applications

More information

IQTIDAR ALI Lecturer IBMS Agriculture University Peshawar

IQTIDAR ALI Lecturer IBMS Agriculture University Peshawar IQTIDAR ALI Lecturer IBMS Agriculture University Peshawar Upon completing the course, you will understand Create, compile, and run Java programs Primitive data types Java control flow Operator Methods

More information

EPL660: Information Retrieval and Search Engines Lab 3

EPL660: Information Retrieval and Search Engines Lab 3 EPL660: Information Retrieval and Search Engines Lab 3 Παύλος Αντωνίου Γραφείο: B109, ΘΕΕ01 University of Cyprus Department of Computer Science Apache Solr Popular, fast, open-source search platform built

More information

Type Declarations. [... <id> τ... ] <id> : τ. Γ <num> : number. Γ true : boolean. Γ false : boolean. Γ e 1 : number.

Type Declarations. [... <id> τ... ] <id> : τ. Γ <num> : number. Γ true : boolean. Γ false : boolean. Γ e 1 : number. Type Inference 1 Type Declarations Γ : number Γ true : boolean Γ e 1 : number [... τ... ] : τ Γ false : boolean Γ e 2 : number Γ {+ e 1 e 2 } : number Γ e 1 : boolean Γ e 2 : τ 0 Γ e 3

More information

Web Application Architecture (based J2EE 1.4 Tutorial)

Web Application Architecture (based J2EE 1.4 Tutorial) Web Application Architecture (based J2EE 1.4 Tutorial) Dr. Kanda Runapongsa (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda Web application, components and container

More information

Python 1: Intro! Max Dougherty Andrew Schmitt

Python 1: Intro! Max Dougherty Andrew Schmitt Python 1: Intro! Max Dougherty Andrew Schmitt Computational Thinking Two factors of programming: The conceptual solution to a problem. Solution syntax in a programming language BJC tries to isolate and

More information

Appendix C WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

Appendix C WORKSHOP. SYS-ED/ Computer Education Techniques, Inc. Appendix C WORKSHOP SYS-ED/ Computer Education Techniques, Inc. 1 Preliminary Assessment Specify key components of WSAD. Questions 1. tools are used for reorganizing Java classes. 2. tools are used to

More information

CS 11 java track: lecture 1

CS 11 java track: lecture 1 CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml

More information

Networks Programming Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000)

Networks Programming Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) Networks Programming Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) armahmood786@yahoo.com alphasecure@gmail.com alphapeeler.sf.net/pubkeys/pkey.htm http://alphapeeler.sourceforge.net pk.linkedin.com/in/armahmood

More information

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started Application Development in JAVA Duration Lecture: Specialization x Hours Core Java (J2SE) & Advance Java (J2EE) Detailed Module Part I: Core Java (J2SE) Getting Started What is Java all about? Features

More information

A- Core Java Audience Prerequisites Approach Objectives 1. Introduction

A- Core Java Audience Prerequisites Approach Objectives 1. Introduction OGIES 6/7 A- Core Java The Core Java segment deals with the basics of Java. It is designed keeping in mind the basics of Java Programming Language that will help new students to understand the Java language,

More information

Abstract Classes Interfaces CSCI 201 Principles of Software Development

Abstract Classes Interfaces CSCI 201 Principles of Software Development Abstract Classes Interfaces CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. jeffrey.miller@usc.edu Abstract Classes Outline USC CSCI 201L Abstract Classes An abstract class is a way for

More information

Abstract Classes Interfaces CSCI 201 Principles of Software Development

Abstract Classes Interfaces CSCI 201 Principles of Software Development Abstract Classes Interfaces CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. jeffrey.miller@usc.edu Abstract Classes Outline USC CSCI 201L Abstract Classes An abstract class is a way for

More information

Free your Lambdas Java SE 8

Free your Lambdas Java SE 8 Free your Lambdas Java SE 8 Agenda Tutorial session: we will start at the very beginning! and explore how to build functional interfaces to design new APIs This is about lambdas and functional interfaces

More information

Experiment No: Group B_2

Experiment No: Group B_2 Experiment No: Group B_2 R (2) N (5) Oral (3) Total (10) Dated Sign Problem Definition: A Web application for Concurrent implementation of ODD-EVEN SORT is to be designed using Real time Object Oriented

More information

Java Applets, etc. Instructor: Dmitri A. Gusev. Fall Lecture 25, December 5, CS 502: Computers and Communications Technology

Java Applets, etc. Instructor: Dmitri A. Gusev. Fall Lecture 25, December 5, CS 502: Computers and Communications Technology Java Applets, etc. Instructor: Dmitri A. Gusev Fall 2007 CS 502: Computers and Communications Technology Lecture 25, December 5, 2007 CGI (Common Gateway Interface) CGI is a standard for handling forms'

More information

Servlets by Example. Joe Howse 7 June 2011

Servlets by Example. Joe Howse 7 June 2011 Servlets by Example Joe Howse 7 June 2011 What is a servlet? A servlet is a Java application that receives HTTP requests as input and generates HTTP responses as output. As the name implies, it runs on

More information

Write for your audience

Write for your audience Comments Write for your audience Program documentation is for programmers, not end users There are two groups of programmers, and they need different kinds of documentation Some programmers need to use

More information

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.)

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.) Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.) David Haraburda January 30, 2013 1 Introduction Scala is a multi-paradigm language that runs on the JVM (is totally

More information

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 SPRING 2014 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 Java OO (Object Orientation) 2 Python and Matlab have objects and classes. Strong-typing nature of

More information

CompSci 125 Lecture 02

CompSci 125 Lecture 02 Assignments CompSci 125 Lecture 02 Java and Java Programming with Eclipse! Homework:! http://coen.boisestate.edu/jconrad/compsci-125-homework! hw1 due Jan 28 (MW), 29 (TuTh)! Programming:! http://coen.boisestate.edu/jconrad/cs125-programming-assignments!

More information

16.410: Jump Starting With Java

16.410: Jump Starting With Java 16.410: Jump Starting With Java by Robert Effinger and Shannon Dong Introduction This jumpstart shows you the basics of getting Java started, running simple programs, and simple editing and debugging.

More information

Learning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java

Learning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java Learning objectives The Java Environment Understand the basic features of Java What are portability and robustness? Understand the concepts of bytecode and interpreter What is the JVM? Learn few coding

More information

CSE332: Data Abstrac0ons Sec%on 1. Hye In Kim Winter 2014

CSE332: Data Abstrac0ons Sec%on 1. Hye In Kim Winter 2014 CSE332: Data Abstrac0ons Sec%on 1 Hye In Kim Winter 2014 Sec0on Agenda Recurrence Relations HW1 Tips Generics Project 1 Eclipse Tutorial Recurrence Rela0ons Recurrence Rela0ons Recursively defines a Sequence

More information

JDK-WildFly-NetBeans Setup Local

JDK-WildFly-NetBeans Setup Local @author R.L. Martinez, Ph.D. Table of Contents Overview... 1 Security Notice... 2 Download and Install Latest Stable JDK... 2 Download and Install Latest Stable WildFly... 6 Download and Install Latest

More information

I hate money. Release 1.0

I hate money. Release 1.0 I hate money Release 1.0 Nov 01, 2017 Contents 1 Table of content 3 2 Indices and tables 15 i ii «I hate money» is a web application made to ease shared budget management. It keeps track of who bought

More information

CS 251 Intermediate Programming Java Basics

CS 251 Intermediate Programming Java Basics CS 251 Intermediate Programming Java Basics Brooke Chenoweth University of New Mexico Spring 2018 Prerequisites These are the topics that I assume that you have already seen: Variables Boolean expressions

More information

Section 2.2 Your First Program in Java: Printing a Line of Text

Section 2.2 Your First Program in Java: Printing a Line of Text Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two

More information

Lecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8

Lecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8 Today... Java basics S. Bowers 1 of 8 Java main method (cont.) In Java, main looks like this: public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); Q: How

More information

public Twix() { calories = 285; ingredients = "chocolate, sugar, cookie, caramel"; }

public Twix() { calories = 285; ingredients = chocolate, sugar, cookie, caramel; } Additional inheritance example As another example of inheritance, perhaps we would like to build an application about candy. For starters, let s say we want to do something with Twix bars and something

More information

Java Program Structure and Eclipse. Overview. Eclipse Projects and Project Structure. COMP 210: Object-Oriented Programming Lecture Notes 1

Java Program Structure and Eclipse. Overview. Eclipse Projects and Project Structure. COMP 210: Object-Oriented Programming Lecture Notes 1 COMP 210: Object-Oriented Programming Lecture Notes 1 Java Program Structure and Eclipse Robert Utterback In these notes we talk about the basic structure of Java-based OOP programs and how to setup and

More information

REGEX HELPER USER MANUAL CONTENTS

REGEX HELPER USER MANUAL CONTENTS REGEX HELPER USER MANUAL CONTENTS 1. ABOUT REGEX HELPER 2. SYSTEM REQUIREMENTS 3. DEPLOYING REGEX HELPER 4. MAIN USER INTERFACE 5. USAGE AND FUNCTIONALITY 6. SAMPLE USE CASE (With Screenshots) ABOUT REGEX

More information

CS 61B Discussion 5: Inheritance II Fall 2014

CS 61B Discussion 5: Inheritance II Fall 2014 CS 61B Discussion 5: Inheritance II Fall 2014 1 WeirdList Below is a partial solution to the WeirdList problem from homework 3 showing only the most important lines. Part A. Complete the implementation

More information

Groovy and Grails in Google App Engine

Groovy and Grails in Google App Engine Groovy and Grails in Google App Engine Benefit from a Java-like dynamic language to be more productive on App Engine Guillaume Laforge Head of Groovy Development Guillaume Laforge Groovy Project Manager

More information

Session 24. Spring Framework Introduction. Reading & Reference. dev.to/lechatthecat/how-to-use-spring-boot-java-web-framework-withintellij-idea-202p

Session 24. Spring Framework Introduction. Reading & Reference. dev.to/lechatthecat/how-to-use-spring-boot-java-web-framework-withintellij-idea-202p Session 24 Spring Framework Introduction 1 Reading & Reference Reading dev.to/lechatthecat/how-to-use-spring-boot-java-web-framework-withintellij-idea-202p http://engineering.pivotal.io/post/must-know-spring-boot-annotationscontrollers/

More information

Exceptions and Libraries

Exceptions and Libraries Exceptions and Libraries RS 9.3, 6.4 Some slides created by Marty Stepp http://www.cs.washington.edu/143/ Edited by Sarah Heckman 1 Exceptions exception: An object representing an error or unusual condition.

More information

Object Model Comparisons

Object Model Comparisons Object Model Comparisons 1 Languages are designed, just like programs Someone decides what the language is for Someone decides what features it's going to have Can't really understand a language until

More information

QUIZ Friends class Y;

QUIZ Friends class Y; QUIZ Friends class Y; Is a forward declaration neeed here? QUIZ Friends QUIZ Friends - CONCLUSION Forward (a.k.a. incomplete) declarations are needed only when we declare member functions as friends. They

More information

Kickstart Intro to Java Part I

Kickstart Intro to Java Part I Kickstart Intro to Java Part I COMP346/5461 - Operating Systems Revision 1.6 February 9, 2004 1 Topics Me, Myself, and I Why Java 1.2.*? Setting Up the Environment Buzz about Java Java vs. C++ Basic Java

More information

Managing State. Chapter 13

Managing State. Chapter 13 Managing State Chapter 13 Textbook to be published by Pearson Ed 2015 in early Pearson 2014 Fundamentals of Web http://www.funwebdev.com Development Section 1 of 8 THE PROBLEM OF STATE IN WEB APPLICATIONS

More information

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 SPRING 2017 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 CMS VideoNote.com, PPT slides, DrJava, Book 2 CMS available. Visit course webpage, click Links, then

More information

Introduction. Introduction to OOP with Java. Lecture 01: Introduction to OOP with Java - AKF Sep AbuKhleiF -

Introduction. Introduction to OOP with Java. Lecture 01: Introduction to OOP with Java - AKF Sep AbuKhleiF - Introduction to OOP with Java Instructor: AbuKhleif, Mohammad Noor Sep 2017 www.abukhleif.com Lecture 01: Introduction Instructor: AbuKhleif, Mohammad Noor Sep 2017 www.abukhleif.com AbuKhleiF - www.abukhleif.com

More information

REST in a Nutshell: A Mini Guide for Python Developers

REST in a Nutshell: A Mini Guide for Python Developers REST in a Nutshell: A Mini Guide for Python Developers REST is essentially a set of useful conventions for structuring a web API. By "web API", I mean an API that you interact with over HTTP - making requests

More information

COMP110 Jump Around. Go ahead and get today s code in Eclipse as shown on next few slides. Kris Jordan

COMP110 Jump Around. Go ahead and get today s code in Eclipse as shown on next few slides. Kris Jordan Go ahead and get today s code in Eclipse as shown on next few slides COMP110 Jump Around Fall 2015 Sections 2 & 3 Sitterson 014 November 19th, 2015 Kris Jordan kris@cs.unc.edu Sitterson 238 Classroom Materials

More information

CSCI 201 Lab 1 Environment Setup

CSCI 201 Lab 1 Environment Setup CSCI 201 Lab 1 Environment Setup "The journey of a thousand miles begins with one step." - Lao Tzu Introduction This lab document will go over the steps to install and set up Eclipse, which is a Java integrated

More information

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,

More information

Review: Array Initializer Lists

Review: Array Initializer Lists More on Arrays Review of Arrays of ints, doubles, chars Arrays of objects Command line arguments The ArrayList class Javadoc Review Lecture 8 notes and L&L 7.1 7.2 Reading for this lecture: L&L 7.3 7.7,

More information

Week 2: The Clojure Language. Background Basic structure A few of the most useful facilities. A modernized Lisp. An insider's opinion

Week 2: The Clojure Language. Background Basic structure A few of the most useful facilities. A modernized Lisp. An insider's opinion Week 2: The Clojure Language Background Basic structure A few of the most useful facilities A modernized Lisp Review of Lisp's origins and development Why did Lisp need to be modernized? Relationship to

More information

Summer Assignment for the School Year

Summer Assignment for the School Year Summer Assignment for the 2018-2019 School Year Course: AP Computer Science A Instructor: Mr. Rivera Welcome to AP Computer Science A. I am looking forward to an exciting school year of teaching Computer

More information

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016 COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016 Learn about cutting-edge research over lunch with cool profs January 18-22, 2015 11:30

More information

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started

More information

Java with Eclipse: Setup & Getting Started

Java with Eclipse: Setup & Getting Started Java with Eclipse: Setup & Getting Started Originals of slides and source code for examples: http://courses.coreservlets.com/course-materials/java.html Also see Java 8 tutorial: http://www.coreservlets.com/java-8-tutorial/

More information

Preview from Notesale.co.uk Page 3 of 36

Preview from Notesale.co.uk Page 3 of 36 all people who know the language. Similarly, programming languages also have a vocabulary, which is referred to as the set of keywords of that language, and a grammar, which is referred to as the syntax.

More information

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017 Introduction to OOP with Java Instructor: AbuKhleif, Mohammad Noor Sep 2017 Lecture 01: Introduction Instructor: AbuKhleif, Mohammad Noor Sep 2017 Instructor AbuKhleif, Mohammad Noor Studied Computer Engineer

More information

Introduction to Java. Handout-1d. cs402 - Spring

Introduction to Java. Handout-1d. cs402 - Spring Introduction to Java Handout-1d cs402 - Spring 2003 1 Methods (i) Method is the OOP name for function Must be declared always within a class optaccessqualifier returntype methodname ( optargumentlist )

More information