The document provides an overview of the Arbortext Command Language (ACL), which is a scripting language embedded in Arbortext Editor. It describes ACL's basic syntax, variables, functions, flow control structures, and built-in functions for working with files, documents, and document content. ACL allows users to control the Arbortext software, navigate and modify documents, and interface with other components through scripting.
This document provides tips and tricks for debugging Arbortext applications. It discusses challenges like debugging components with multiple interfaces and custom code. It recommends using messages like response() and eval to monitor state, and debugging tools like the Java console. It also suggests adding debug messages programmatically, using binary search, and getting a second set of eyes to help find bugs. Maintaining backups and good documentation are emphasized.
Lambdas and streams are key new features in Java 8. Lambdas allow blocks of code to be passed around as if they were objects. Streams provide an abstraction for processing collections of objects in a declarative way using lambdas. Optional is a new class that represents null-safe references and helps avoid null pointer exceptions. Checked exceptions can cause issues with lambdas, so helper methods are recommended to convert checked exceptions to unchecked exceptions.
The big language features for Java SE 8 are lambda expressions (a.k.a. closures) and default methods (a.k.a. virtual extension methods). Adding closures to the Java language opens up a host of new expressive opportunities for applications and libraries, but how are they implemented? You might assume that lambda expressions are simply a compact syntax for inner classes, but, in fact, the implementation of lambda expressions is substantially different and builds on the invokedynamic feature added in Java SE 7.
Adobe Flash Actionscript language basics chapter-2Nafis Ahmed
In this chapter, I have discussed about the language basics that creates the foundation of Adobe Actionscript 3. From variables, data types, comments, loops to conditionals, much of the basics are covered about flash actionscript in this chapter. In the next chapter, chapter-3, I will be discussing about creating classes and making objects out of it. So tighten your seat bealts buddies!
Visit my youtube channel Nafis's Classroom to watch the entire lesson:
https://www.youtube.com/channel/UCD1a7Kgz4m8tp-U6T8dLyMg
The document discusses Scala, a programming language designed to be scalable. It can be used for both small and large programs. Scala combines object-oriented and functional programming. It interoperates seamlessly with Java but allows developers to add new constructs like actors through libraries. The Scala community is growing, with industrial adoption starting at companies like Twitter.
PHP provides access to a great number of different database systems, many of which are relational in nature and can be interrogated using Structured Query Language (SQL).
Default methods and static methods allow interfaces to define new methods without breaking existing implementations. The lambda expressions feature introduces functional programming to Java through functional interfaces like Consumer and Function. The streams API provides a functional-style way to process and analyze collections through parallelization, optional return values, and collectors.
This document provides tips and tricks for debugging Arbortext applications. It discusses challenges like debugging components with multiple interfaces and custom code. It recommends using messages like response() and eval to monitor state, and debugging tools like the Java console. It also suggests adding debug messages programmatically, using binary search, and getting a second set of eyes to help find bugs. Maintaining backups and good documentation are emphasized.
Lambdas and streams are key new features in Java 8. Lambdas allow blocks of code to be passed around as if they were objects. Streams provide an abstraction for processing collections of objects in a declarative way using lambdas. Optional is a new class that represents null-safe references and helps avoid null pointer exceptions. Checked exceptions can cause issues with lambdas, so helper methods are recommended to convert checked exceptions to unchecked exceptions.
The big language features for Java SE 8 are lambda expressions (a.k.a. closures) and default methods (a.k.a. virtual extension methods). Adding closures to the Java language opens up a host of new expressive opportunities for applications and libraries, but how are they implemented? You might assume that lambda expressions are simply a compact syntax for inner classes, but, in fact, the implementation of lambda expressions is substantially different and builds on the invokedynamic feature added in Java SE 7.
Adobe Flash Actionscript language basics chapter-2Nafis Ahmed
In this chapter, I have discussed about the language basics that creates the foundation of Adobe Actionscript 3. From variables, data types, comments, loops to conditionals, much of the basics are covered about flash actionscript in this chapter. In the next chapter, chapter-3, I will be discussing about creating classes and making objects out of it. So tighten your seat bealts buddies!
Visit my youtube channel Nafis's Classroom to watch the entire lesson:
https://www.youtube.com/channel/UCD1a7Kgz4m8tp-U6T8dLyMg
The document discusses Scala, a programming language designed to be scalable. It can be used for both small and large programs. Scala combines object-oriented and functional programming. It interoperates seamlessly with Java but allows developers to add new constructs like actors through libraries. The Scala community is growing, with industrial adoption starting at companies like Twitter.
PHP provides access to a great number of different database systems, many of which are relational in nature and can be interrogated using Structured Query Language (SQL).
Default methods and static methods allow interfaces to define new methods without breaking existing implementations. The lambda expressions feature introduces functional programming to Java through functional interfaces like Consumer and Function. The streams API provides a functional-style way to process and analyze collections through parallelization, optional return values, and collectors.
This document provides an introduction and overview of PL/SQL. It discusses that PL/SQL is Oracle's procedural language extension for SQL and allows for transactions processing and block structuring. The document then covers various PL/SQL concepts like blocks, data types, control structures, variables and SQL operations within PL/SQL code.
This has been presented in association with Robosepians for Java concepts. Basic concepts of Java including features, conditional statements, loop statements, arrays, string, primitive datatypes, essentials of Java including oops concepts, classes, objects, polymorphism, advance topics including packages, exception handling, multihtreading and network programming have been discussed.
This document summarizes the key new features included in JDK 7. It discusses Project Coin which added features like string switching, binary literals, and the diamond operator. It also covers try-with-resources for improved exception handling, fork/join framework for parallel programming, and NIO.2 features like asynchronous I/O, watch service for monitoring file changes, and pluggable file systems.
The document discusses Java collections framework which includes core collection interfaces like Collection, List, Set, and Map. It describes what each interface represents and common implementations of each interface like ArrayList, LinkedList, HashSet, TreeSet, HashMap and TreeMap. The key benefits of using collections framework are reducing programming effort, increasing program speed and quality, allowing interoperability between APIs and reusability of code.
Scala is a programming language that combines object-oriented and functional programming. It runs on the Java Virtual Machine and is designed to grow with user demands through libraries. Play 2.0 is a web application framework written in Scala that allows for rapid development through its Model-View-Controller architecture and local development server. Cloud Foundry is an open Platform as a Service that allows developers to easily deploy and scale applications, including those written in Scala and Play 2.0.
Rapid Application Development using Ruby on RailsSimobo
This document outlines a 4 day training course on rapid application development using Ruby on Rails. Day 1 covers an overview of Ruby on Rails, setting up the development environment, and conducting live demos. Day 2 delves deeper into model-view-controller architecture, database migrations, and form helpers. Day 3 focuses on testing, Active Record optimizations, and unobtrusive JavaScript. Day 4 explores supporting gems for features like caching, file uploads, searching, and delayed jobs. Each day includes lectures, code examples, and hands-on practice building a sample Rails application.
Introduction to functional idioms in Java 8, language-extending functional libraries and short overview of reasons for adoption of such programming style.
Examples and snippets available here: https://github.com/lbialy/functionaljava8
This document provides an overview of Java data structures including arrays, collections framework, and common collection interfaces like List, Set, and Map. It discusses how to use arrays to store and access data, the key methods of common collection interfaces, and hands-on exercises to work with arrays and collections in Java.
The document discusses new features in Java 8 including lambda expressions, default methods in interfaces, streams API and functional interfaces. Lambda expressions allow representing anonymous functions and can be used to filter, map and process collections. Default methods allow adding new methods to interfaces without breaking existing implementations. Streams API provides a way to process data pipelines in a declarative way and supports parallel and sequential operations on collections.
This PPT gives information about:
Advanced Theories
Inheriting Classes
Inheriting Constructors and Destructors
Overriding Methods
Access Control
Using the Scope Resolution Operator
Creating Static Members
Abstract Classes and Methods
This document discusses Python database programming. It introduces databases and how they store data in tables connected through columns. It discusses SQL for creating, accessing, and manipulating database data. It then discusses how Python supports various databases and database operations. It covers the Python DB-API for providing a standard interface for database programming. It provides examples of connecting to a database, executing queries, and retrieving and inserting data.
The document summarizes the agenda and content of a Scala training workshop. The agenda includes functions and evaluations, higher order functions, data and abstraction, and exercises. Key points from the document include:
- Functions can be defined conditionally and with value definitions. Blocks allow grouping of definitions and expressions. Tail recursion optimizes recursion by reusing the call stack.
- Higher order functions allow functions to be passed as parameters or returned as results. Currying transforms functions that take multiple parameters into chains of functions that each take a single parameter.
- Classes define hierarchies and traits provide flexibility for code reuse like interfaces while abstract classes are used for base classes requiring constructor arguments.
- Exercises include implementing
In this Meetup Victor Perepelitsky - R&D Technical Leader at LivePerson leading the 'Real Time Event Processing Platform' team , will talk about Java 8', 'Stream API', 'Lambda', and 'Method reference'.
Victor will clarify what functional programming is and how can you use java 8 in order to create better software.
Victor will also cover some pain points that Java 8 did not solve regarding functionality and see how you can work around it.
Java 201 Intro to Test Driven Development in Javaagorolabs
This document provides an overview and agenda for a Java 201 course on test-driven development (TDD) in Java. It introduces TDD workflows and concepts like the feedback loop and test frameworks. The agenda covers setting up an IDE, writing the first unit test, test anatomy, and concludes with a hands-on exercise to build components of a card game using TDD.
Clojure - An Introduction for Java Programmerselliando dias
This document provides an introduction to the Clojure programming language. Clojure is a dynamic, functional programming language for the Java Virtual Machine (JVM). The document discusses Clojure's fundamentals including being dynamic, functional, hosted on the JVM, and supporting concurrency. It also covers Clojure's syntax, data types, Java integration, functional programming features, and concurrency model using immutable persistent data structures and software transactional memory.
This ppt gives information about:
1. OOPs Theory
2. Defining a Class
3. Creating an Object
4. The $this Attribute
5. Creating Constructors
6. Creating Destructors
This document provides a summary of modern Java features introduced between Java 1.1 and Java 8. Some key updates include lambda expressions and method references in Java 8 that allow for more concise functional-style programming. Java 8 also introduced default methods in interfaces, streams for functional-style collections operations, and Date-Time API improvements. Other additions were parallel processing support, CompletableFuture for asynchronous non-blocking code, and Nashorn JavaScript integration. Java 9 will focus on a new module system.
Introduction to the basics of Information Retrieval (IR) with an emphasis on Apache Solr/Lucene. A lecture I gave during the JOSA Data Science Bootcamp.
This document provides an agenda for a 10 hour PowerShell training course. The agenda covers PowerShell fundamentals like variables, data types, conditions, loops, cmdlets, functions, modules, and execution policy. It also covers more advanced topics like PowerShell remoting, working with Active Directory using PowerShell, and building PowerShell scripts. The document includes examples to illustrate various PowerShell concepts. The training will be delivered by Pardha Sai who works as an Automation Engineer.
This document provides an introduction and overview of PL/SQL. It discusses that PL/SQL is Oracle's procedural language extension for SQL and allows for transactions processing and block structuring. The document then covers various PL/SQL concepts like blocks, data types, control structures, variables and SQL operations within PL/SQL code.
This has been presented in association with Robosepians for Java concepts. Basic concepts of Java including features, conditional statements, loop statements, arrays, string, primitive datatypes, essentials of Java including oops concepts, classes, objects, polymorphism, advance topics including packages, exception handling, multihtreading and network programming have been discussed.
This document summarizes the key new features included in JDK 7. It discusses Project Coin which added features like string switching, binary literals, and the diamond operator. It also covers try-with-resources for improved exception handling, fork/join framework for parallel programming, and NIO.2 features like asynchronous I/O, watch service for monitoring file changes, and pluggable file systems.
The document discusses Java collections framework which includes core collection interfaces like Collection, List, Set, and Map. It describes what each interface represents and common implementations of each interface like ArrayList, LinkedList, HashSet, TreeSet, HashMap and TreeMap. The key benefits of using collections framework are reducing programming effort, increasing program speed and quality, allowing interoperability between APIs and reusability of code.
Scala is a programming language that combines object-oriented and functional programming. It runs on the Java Virtual Machine and is designed to grow with user demands through libraries. Play 2.0 is a web application framework written in Scala that allows for rapid development through its Model-View-Controller architecture and local development server. Cloud Foundry is an open Platform as a Service that allows developers to easily deploy and scale applications, including those written in Scala and Play 2.0.
Rapid Application Development using Ruby on RailsSimobo
This document outlines a 4 day training course on rapid application development using Ruby on Rails. Day 1 covers an overview of Ruby on Rails, setting up the development environment, and conducting live demos. Day 2 delves deeper into model-view-controller architecture, database migrations, and form helpers. Day 3 focuses on testing, Active Record optimizations, and unobtrusive JavaScript. Day 4 explores supporting gems for features like caching, file uploads, searching, and delayed jobs. Each day includes lectures, code examples, and hands-on practice building a sample Rails application.
Introduction to functional idioms in Java 8, language-extending functional libraries and short overview of reasons for adoption of such programming style.
Examples and snippets available here: https://github.com/lbialy/functionaljava8
This document provides an overview of Java data structures including arrays, collections framework, and common collection interfaces like List, Set, and Map. It discusses how to use arrays to store and access data, the key methods of common collection interfaces, and hands-on exercises to work with arrays and collections in Java.
The document discusses new features in Java 8 including lambda expressions, default methods in interfaces, streams API and functional interfaces. Lambda expressions allow representing anonymous functions and can be used to filter, map and process collections. Default methods allow adding new methods to interfaces without breaking existing implementations. Streams API provides a way to process data pipelines in a declarative way and supports parallel and sequential operations on collections.
This PPT gives information about:
Advanced Theories
Inheriting Classes
Inheriting Constructors and Destructors
Overriding Methods
Access Control
Using the Scope Resolution Operator
Creating Static Members
Abstract Classes and Methods
This document discusses Python database programming. It introduces databases and how they store data in tables connected through columns. It discusses SQL for creating, accessing, and manipulating database data. It then discusses how Python supports various databases and database operations. It covers the Python DB-API for providing a standard interface for database programming. It provides examples of connecting to a database, executing queries, and retrieving and inserting data.
The document summarizes the agenda and content of a Scala training workshop. The agenda includes functions and evaluations, higher order functions, data and abstraction, and exercises. Key points from the document include:
- Functions can be defined conditionally and with value definitions. Blocks allow grouping of definitions and expressions. Tail recursion optimizes recursion by reusing the call stack.
- Higher order functions allow functions to be passed as parameters or returned as results. Currying transforms functions that take multiple parameters into chains of functions that each take a single parameter.
- Classes define hierarchies and traits provide flexibility for code reuse like interfaces while abstract classes are used for base classes requiring constructor arguments.
- Exercises include implementing
In this Meetup Victor Perepelitsky - R&D Technical Leader at LivePerson leading the 'Real Time Event Processing Platform' team , will talk about Java 8', 'Stream API', 'Lambda', and 'Method reference'.
Victor will clarify what functional programming is and how can you use java 8 in order to create better software.
Victor will also cover some pain points that Java 8 did not solve regarding functionality and see how you can work around it.
Java 201 Intro to Test Driven Development in Javaagorolabs
This document provides an overview and agenda for a Java 201 course on test-driven development (TDD) in Java. It introduces TDD workflows and concepts like the feedback loop and test frameworks. The agenda covers setting up an IDE, writing the first unit test, test anatomy, and concludes with a hands-on exercise to build components of a card game using TDD.
Clojure - An Introduction for Java Programmerselliando dias
This document provides an introduction to the Clojure programming language. Clojure is a dynamic, functional programming language for the Java Virtual Machine (JVM). The document discusses Clojure's fundamentals including being dynamic, functional, hosted on the JVM, and supporting concurrency. It also covers Clojure's syntax, data types, Java integration, functional programming features, and concurrency model using immutable persistent data structures and software transactional memory.
This ppt gives information about:
1. OOPs Theory
2. Defining a Class
3. Creating an Object
4. The $this Attribute
5. Creating Constructors
6. Creating Destructors
This document provides a summary of modern Java features introduced between Java 1.1 and Java 8. Some key updates include lambda expressions and method references in Java 8 that allow for more concise functional-style programming. Java 8 also introduced default methods in interfaces, streams for functional-style collections operations, and Date-Time API improvements. Other additions were parallel processing support, CompletableFuture for asynchronous non-blocking code, and Nashorn JavaScript integration. Java 9 will focus on a new module system.
Introduction to the basics of Information Retrieval (IR) with an emphasis on Apache Solr/Lucene. A lecture I gave during the JOSA Data Science Bootcamp.
This document provides an agenda for a 10 hour PowerShell training course. The agenda covers PowerShell fundamentals like variables, data types, conditions, loops, cmdlets, functions, modules, and execution policy. It also covers more advanced topics like PowerShell remoting, working with Active Directory using PowerShell, and building PowerShell scripts. The document includes examples to illustrate various PowerShell concepts. The training will be delivered by Pardha Sai who works as an Automation Engineer.
XML and Web Data discusses XML, its characteristics, elements, and schemas. XML is used to simplify data exchange between software agents. It uses tags like HTML but is extensible and has no predefined semantics. XML documents must be well-formed with a root element and properly nested tags. Namespaces are used to avoid naming conflicts. XML schemas define rules for XML documents and can specify data types and constraints.
The document provides an overview of XML and its characteristics. It discusses how XML is used to represent semi-structured data in a machine-readable way. It describes some key components of XML, including elements, attributes, and namespaces. It also discusses XML Schema, which improves on DTDs by providing a more robust way to define the structure and constraints of XML documents.
XML and Web Data discusses XML, its characteristics, elements, and schemas. XML is used to simplify data exchange between software agents. It uses tags like HTML but is extensible and has no predefined semantics. XML documents must be well-formed with properly nested elements. Namespaces are used to avoid naming conflicts, and attributes can specify element identifiers and references. XML schemas define rules for XML documents and support data types, complex elements, and integrity constraints.
The document provides an overview of XML and its characteristics. It discusses how XML is used to represent semi-structured data in a machine-readable way. It describes some key components of XML, including elements, attributes, and namespaces. It also discusses XML Schema, which improves on DTDs by providing a more robust way to define the structure and constraints of XML documents.
XML and Web Data discusses XML, its characteristics, elements, and schemas. XML is used to simplify data exchange between software agents. It uses tags like HTML but is extensible and has no predefined semantics. XML documents must be well-formed with properly nested elements. Namespaces are used to avoid naming conflicts, and attributes can specify element identifiers and references. XML schemas define rules for XML documents and support data types, complex elements, and integrity constraints.
XML and Web Data discusses XML, its characteristics, elements, and schemas. XML is used to simplify data exchange between software agents. It uses tags like HTML but is extensible and has no predefined semantics. XML documents must be well-formed with a root element and properly nested tags. Namespaces are used to avoid naming conflicts. XML schemas define rules for XML documents and can specify data types and constraints.
The document provides an overview of XML and its characteristics. It discusses how XML is used to represent semi-structured data in a machine-readable way. It describes some key components of XML, including elements, attributes, and namespaces. It also discusses XML Schema, which improves on DTDs by providing a more robust way to define the structure and constraints of XML documents.
XML is a markup language similar to HTML but designed for carrying data rather than displaying it. It allows users to define their own elements and tags. XML documents use tags to describe and structure information and can be displayed using CSS or transformed using XSL. Key benefits of XML include its ability to describe hierarchical data, separate data from presentation, and enable data sharing across different systems.
This document discusses principles for improving modularity and maintainability through a layered data model approach. It recommends removing hard-coded dependencies and using a service manager to dynamically resolve components. Entities should represent data and focus only on their own tasks while abstracting away data storage details. A layered approach separates concerns with entities at the top holding information, tables handling storage operations, table gateways acting as the database interface, and hydrators mapping between objects and data. Together this improves reusability, flexibility and maintainability of the system.
Advanced guide to develop ajax applications using dojoFu Cheng
The document discusses developing Ajax applications using Dojo. It provides a brief history of web applications and introduces rich internet applications and Ajax. It then covers why Ajax is used, different Ajax application types, how Ajax changes web applications, and the anatomy of Ajax applications. The document also discusses semantic HTML, best practices for CSS, JavaScript concepts, DOM querying and manipulation using Dojo, efficient DOM techniques, events, and event propagation.
This document provides an overview of XML including:
- XML is a meta markup language used to define text document structures and represent textual data.
- XML examples show how it can be used to easily represent structured data for both human and machine readability.
- XML schemas are used to define the rules and structure for XML documents and provide data type definitions.
- XML documents form a tree structure with a single root element and hierarchical branching.
This document provides an introduction to XML, including an overview of its components and structure. It discusses the XML prolog, tags, attributes, entities, comments, and processing instructions that make up an XML document. It also describes the XML document type definition (DTD) that defines the allowable tags and syntax of an XML language. Key points covered include XML being extensible and separating content from presentation, as well as examples of basic XML code structure and syntax rules.
The document provides an overview of key topics in Visual Studio 2005 including application and page frameworks, GUI controls, validation controls, master pages, themes and skins, collections and lists, data binding, ADO.NET, XML, navigation, security, state management, caching, debugging, and configurations. It outlines features and capabilities within each topic at a high level.
This document provides an overview of JavaScript and the DOM (Document Object Model). It discusses JavaScript data types like numbers, strings, booleans, functions, and objects. It also covers JavaScript functions, control flow with if/else, for loops, and while loops. The document then explains JavaScript data structures like arrays and objects. It introduces the DOM and how JavaScript can interact with and modify page content by selecting elements and accessing/changing their properties.
This document provides an overview of CodeIgniter and the Model-View-Controller (MVC) framework. It discusses the key features supported by CodeIgniter including database classes, validation, security filtering, and more. It explains the basic MVC structure with models representing data, views representing presented information, and controllers serving as intermediaries. The document demonstrates how CodeIgniter handles URLs in a segment-based approach and describes the roles of controllers, views, models, helpers, libraries, and hooks within a CodeIgniter application. Code examples are provided to illustrate how each component works.
This document provides an overview of XML including:
- XML stands for Extensible Markup Language and is used to carry data, not display it. Tags are user-defined.
- An XML example shows a simple note with predefined tags.
- XML schemas define valid elements, attributes, structure and data types for XML documents.
- XML documents form a tree structure with elements nested within a root element. Syntax rules ensure documents are well-formed.
- XML parsers like SAX and DOM are used to read and build a model of an XML document programmatically.
This document provides an overview of object-oriented programming concepts in PHP including static methods and properties, constants, abstraction and interfaces, overloading, object iteration, cloning, serialization, namespaces, and autoloading classes. Key points covered include how to define static class members, constants, abstract classes and interfaces, magic methods for overloading, implementing interfaces for object iteration, cloning objects and the clone constructor, serializing and unserializing objects, using namespaces to organize code, and defining an autoload function to include class files automatically.
2. Arbortext Command Language (ACL)
• ACL is a scripting language embedded in Arbortext
Editor
• Provides ways to:
– Control the software
– Make dialogs work
– Navigate and manipulate documents
– Interface with other software components (e.g.
Publishing Engine, Dynamic Link Manager, Content
Manager, etc.)
– Interact with user
3. Arbortext Command Language (ACL)
• Basic syntax
• Variables and arrays
• Defining and using functions
• Working with files and documents
• Modifying the content of documents
• Using callbacks and hooks to handle events
• Integrating ACL scripts into your application
4. Basic Syntax
• ACL is sort of Perl-ish, sort of C-ish
– Like Perl, without the “line noise”
– Like C, without the pointer arithmetic and memory
management
• Statements are the fundamental steps in a
program
– Two types of statements: commands and functions
5. ACL Commands
• Commands use syntax like this:
commandname argument argument …
• Commands don’t return a value
• BUT May store information in system variables
about error status, etc.
• Example:
print composed current
6. ACL Functions
• Functions use syntax like this:
functionname ( argument, argument, …)
• Functions often, but not always, return a value
– Result of calculation or transformation
– Status of operation (success/failure)
• Example:
if (doc_name(doc)==“foo.xml”) …
7. ACL Functions
• Gotcha: Return value vs. updated parameter
– Example:
Global $windows[]
$return = window_list($windows);
– $return is number indicating status (number of
windows), not the list itself
– The actual list (array) of windows is stored in $windows
8. ACL Comments
• Comments start with a hash #
• Everything after the hash is ignored
# This function is really cool
function reallyCoolFunction(input) {
# do some really cool stuff here
}
• You can stick a comment at the end of a line after
some “real” code
if (oid_type($oid) == 4) { # type 4 -> equation
9. ACL Blocks
• A block is a section of a program that is a
cohesive unit
• Delimited with curly braces { }
• Examples:
– Function definitions
– The branches of if/else statements
– The guts of while and for loops
10. ACL Flow Control
• The usual flow control structures are supported
– for loops
for (i=1; i < count($arr); i++) {
doc_close($arr[i]);
}
– while loops
find “Leno”
while ($status == 0) {
delete_mark;
insert_string “O’Brien”
find “Leno”
}
11. More ACL Flow Control
– if/else branches
if ($size == “legal”) {
set stylesheet=“legal.style”
}
else {
set stylesheet=“letter.style”
}
12. Still more flow control
– switch trees:
$resp = response(“Save Changes?”,”Yes”,”No”,”Cancel”);
switch ($resp) {
case 1:
doc_save(current_doc());
break;
case 2:
set modified=off;
doc_close(current_doc());
break;
case 3:
# do nothing
}
13. ACL Packages
• Analogous to Java or Perl packages
• Similar to namespaces in XML
package log;
global $errlog = “C:tempapterr.txt”;
function error(msg) {
local $fid = open($log::errlog,a);
put($fid, “*** ERROR: $msgn”);
flush($fid);
close($fid);
}
14. Using Packages
• Use require to import a package’s code
• Use package::functionname to call a function in
another package
package custom;
require log;
function load_doc(docname) {
local $docid = doc_open(docname);
if ($docid == -1) {
log::error(“Couldn’t open $docname”);
}
}
15. ACL Variables
• Variables in ACL are dynamically typed
– Automatically assumes the required type for the value
• Name is sometimes preceded with a $ like Perl
(optional)
– But arrays are NOT preceded with an @
• You can define scope with local and global
keywords
– Default is local scope
– Local variables are only accessible in the block in which
they are declared (e.g. inside a function)
– Global variables are accessible anywhere
16. Assigning Values to Variables
• Assign values using the assignment operator =
– $mydoc = “C:tempmydocsmydoc.xml”;
• You can use expressions in assignment
– $mydoc = current_doc();
– $mypath = dirname(doc_path(current_doc()));
17. Assigning Values to Variables
• You can also use shortcut assignment operators
– $linecount += 1;
– $product *= get_multiplier();
• Use . (dot) operator for string concatenation
– $msg = “Do you want to close “ . doc_name() . “?”;
18. ACL Variable Evaluation
• Variables are evaluated
– Variable references inside double quotes are evaluated
• $docname = “foo.xml”;
• $msg = “Close $docname?”
# returns “Close foo.xml?”
– References inside single quotes are not
• $msg = ‘Close $docname?’
# returns “Close $docname?”
19. Deferred Evaluation of Variables
• Gotcha: In commands, you may need to defer
evaluation
– Ex: (wrong way – prints first doc repeatedly)
for ($i in $doclist) {
print composed $doclist[$i];
}
• Use execute or eval commands to defer
– Ex: (right way – prints each document once)
for ($i in $doclist) {
execute(“print composed $doclist[$i]”);
}
20. ACL Arrays
• ACL supports two kinds of arrays
– Normal arrays, indexed by number
$array[1] = “foo”
– Associative arrays, indexed by key
$array[“foo”] = “bar”
• Gotcha: ACL arrays are indexed from one, not
zero
21. Declaring ACL Arrays
• Both types have the same declaration syntax:
– [local | global] $arrayname[];
• Most arrays resize dynamically as necessary
– Unless declared using global and a fixed size
• global $myarray[10];
• Use square brackets [] to access array elements
– $msg = “the first element is $myarray[1]”;
– $msg = “owner of $docname is $owners[$docname]”;
22. Using ACL Arrays
• You can iterate over items in an array using
for (… in …) construction
– for ($i in $myarray) {
if ($myarray[$i]==doc_name()) {
response(doc_name() . “ is in array”);
break;
}
}
• This works for both types of arrays
• Gotcha: Loop index is the array index, not the
array value for that index
24. User-Defined Functions in ACL
• You can define your own functions
– function functionname(param1, param2) {
# do some stuff here
return result of operation;
}
• Example:
– function doc_dir(doc) {
local $docname = doc_name(doc);
return dirname($docname);
}
25. Forward Declarations
• In an ACL file, you often have multiple function
definitions
• A function can’t use another function if it hasn’t
been defined yet
26. Why You Need Forward Declarations
• This will fail:
function launch_browser(filename) {
local $url = file_to_url(filename);
system(“start $url”);
}
function file_to_url(filename) {
gsub(filename,””,”/”);
return("http://". filename);
}
• We try to use file_to_url() before it is defined
27. How to Write a Forward Declaration
• Forward declaration is an empty function definition
at the top of the file
• Lets other functions know that you're going to
define the function later
28. Forward Declaration Example
• This will work because of the forward declaration:
function file_to_url() {}; # forward decl
function launch_browser(filename) {
local $url = file_to_url(filename);
system(“start $url”);
}
function file_to_url(filename) {
gsub(filename,””,”/”);
return("http://". filename);
}
29. A Brief Tour of Built-In Functions
• Arbortext provides a ton of built-in functions for
various purposes
• We'll look at some of the most useful categories
– document and file handling
– document content manipulation
– user interaction
• For more information see the online help
– ACL reference in online help is very complete
– If you don't know what it's called, try search
– If you still can't find it, try Adepters email!
30. Working with Files and Documents
• current_doc() - gets a handle (ID number) for the
currently active document
• doc_open() - loads a document
– flags determine whether it's opened as XML or ASCII,
whether context checking happens, etc.
• doc_name() - filename of the document
• doc_path() - fully-qualified pathname of the doc
• doc_incomplete() - tells whether doc is valid
• doc_save() - saves the document
• edit_new_window() - opens document in a new
edit window
31. Working with Generic Files
• open() - open an arbitrary file for reading and/or
writing (e.g. for logging messages or importing
text content into a document)
• read() - read from a file
• getline() - read from a file one line at a time
• put() - write content to a file
• close() - close a file
32. General File System Info
• glob() - fills an array with names of files that
match the globbing expression (e.g. "*.xml")
• file_directory() - tells whether specified filename is
really a directory
• file_size() - size of the file
• file_newer() - determines if one file is newer than
another
• username() - user name string (from OS)
• system() - execute an arbitrary system command
• file_selector() - starts a standard file selection
dialog, returning the user's choice
33. Modifying Document Contents
• The OID is your friend (Object ID)
– Unique ID for each element in the document
– Can be used to find, access, change, or delete markup
• oid_root() - the root element of the doc
• oid_name() - the name of the specified element
• oid_caret() - the element containing the caret
• oid_attr() - gets the value of the specified
attribute on the specified element
• oid_content() - returns the content of the element
as a markup string
34. Moving Around with OIDs
• oid_first() - OID of first element in the doc
• oid_next() - OID of next element
• oid_prev() - OID of previous element
• oid_last() - OID of last element
• oid_parent() - OID of parent element
• oid_child() - OID of nth child element (or null OID
if no such child exists)
• goto_oid() - moves the caret to an element
• oid_xpath_nodeset() - nodes that match an XPath
expression (OIDs in an array)
35. Making Changes with OIDs
• oid_select() - selects the element
• oid_modify_attr() - changes an attribute value
• oid_delete_attr() - removes an attribute
• oid_delete - removes the element
• change_tag command - changes the element at
the caret (use with goto_oid())
• insert_tag() - inserts a new element at the caret
(use with goto_oid())
• insert() - inserts a markup string at the caret
36. OID example
• Return the title of the nearest enclosing element
based on caret location
function oid_title(oid=oid_caret()) {
# if this oid has a title, use that
oid_find_children(oid,$titles,"title");
if (count($titles) > 0) {
return oid_content($titles[1]);
}
# otherwise walk up the tree till we find one
oid = oid_parent(oid);
while (oid_valid(oid)) {
oid_find_children(oid,$titles,"title");
if (count($titles) > 0) {
return oid_content($titles[1]);
}
oid = oid_parent(oid);
}
}
37. Lots More Fun
• There are specific functions for navigating and
changing special elements
– Tables
– Graphics
– Equations
– Entities and entity references
– Document objects from repositories
– Change tracking markup
• Too much to cover here--see the online help!
38. Getting User Input
• There are several ways to get user input in ACL
– response()
– list_response()
– readvar command
– file_selector()
– XUI dialogs
39. The response() Function
• Simple message with buttons for response
$answer = response(“Continue?”,”Yes”,”No”);
returns 1 returns 2
40. Multiple Response Buttons
• You can have as many buttons as you like
$ans = response(“Error! What do you want to do?”,
“&Abort”,
“&Retry”,
“&Fail”,
“Pull out &hair”,
“&Defenestrate computer”,
“&Move to MN and open a bait shop”);
41. The list_response() Function
• Similar to response(), but uses an array to
generate a listbox
get_printers($options);
$ans = list_response($options,"Print",
"Select a printer");
response("You selected $ans");
42. The readvar Command
• Lets user type a line of text
readvar -title "Notifications"
-prompt "Enter emails to notify:"
-value "epic-admin@mycompany.com"
notify;
global $emails[];
split($notify,$emails,',;');
response("You want to notify:n" .
join($emails,"n"));
43. The file_selector() Function
• Use file_selector() to invoke the standard file
chooser for your OS
$fname = file_selector(doc_dir(),"xml",
"XML files|*.xml|All files|*.*",
"Select file to open");
response("You selected $fname");
44. Using XUI dialogs
• See Jason & Asli's slides (Tues 1:15, "Using XUI to
Manage Cross-References")
• Also dialog item callbacks are handy for this (a
few slides from now)
45. Using Callbacks and Hooks
• Use your own functions to handle events
– document callbacks
– window callbacks
– session callbacks
– dialog item callbacks
• Callbacks vs. Hooks
– Hooks are global, callbacks can have limited scope
46. Using Callbacks
• Use *_add_callback() to add a callback to the
desired item
– window_add_callback(0,"create","setupinfo");
• Use *_remove_callback() to remove a callback
– window_remove_callback(0,"create","setupinfo");
47. Document Callbacks
• Document callbacks can trigger actions when:
– User copies, cuts, pastes, deletes, inserts, or modifies
content
– The document is saved or closed
– A table operation is done
– The document is printed
– Various other things (see online help)
48. Document Callback Example
• Auto-fill an attribute value when element is
inserted
– uses insert_tag_after callback
function remark_add_user(doc,tag,oid,op) {
if ((op == 1) && (tag == "remark")) {
modify_attr("role",username());
}
}
doc_add_callback(current_doc(),'insert_tag_after',
'remark_add_user');
49. Window Callbacks
• Window callbacks can trigger actions when:
– A window is created or destroyed
– A window gains or loses focus
– The caret moves
• Some window callbacks use
window_add_callback(), others use
window_set()
50. Window Callback Example
• Reports window information when window is
created
function showinfo(win) {
response("Window ID=" . win . ", doc ID=" .
window_doc(win));
}
window_add_callback(0,"create","showinfo");
51. Session Callbacks
• Session callbacks can trigger actions when:
– drag and drop operations happen
– the session ends (quit Arbortext)
52. Session callback example
• Lets user control handling of dropped files using
SHIFT and CTRL keys
function drop_handler(path,num,count,flags) {
local $ext = tolower(substr($path,length($path)-3));
if ($ext == "xml") {
if ($flags & 0x0001) { # SHIFT-drag
# insert content inline
execute("read " . $path);
}
else if ($flags & 0x0002) { # CTRL-drag
# insert Xinclude reference
$xi = "<xi:include href='" . $path . "'/>";
insert($xi);
}
else {
execute("edit -newwindow " . path);
}
}
}
session_add_callback("drop_file",drop_handler);
53. Dialog Item Callbacks
• Used to attach behaviors to dialog items
– Button clicked
– Listbox selection changed
– Checkbox checked or unchecked
– etc.
54. Dialog Item Callback Example
• Debug message for button
function buttoncb(win,dlgitem,event) {
response("You clicked " .
dlgitem_get($win,$dlgitem,"label"));
}
dlgitem_add_callback($win,"MyButton",buttoncb);
55. Timer Callbacks
• Use a timer callback to make something happen
after a specific delay, or repeatedly
56. Timer Callback Example
• Add autosave every 5 minutes
function autosave(doc) {
doc_save(doc);
}
timer_add_callback(30000,'autosave',current_doc());
57. Hooks
• Some overlap with callbacks, but hooks can
respond to some things callbacks can’t
– Change tracking events
– Formatting stages (print composition)
– Import/Export
– Preference changes
58. Hook Example
• Return concurrent Print Composer License to
server immediately after printing
function returnlicense() {
if (license("PrintPublishing")!=0) {
license_release("PrintPublishing");
}
}
add_hook(printcompletehook,returnlicense);
59. Integrating ACL Code with Applications
• ACL code generally goes in the custom directory
– put in $EPICcustom...
OR
– set APTCUSTOM environment variable to the location
• e.g. shared configuration on a server
60. Where to Put ACL Scripts
• Where you put it determines when it runs
– custominit: runs once when Arbortext starts
– ~/.pubrc (UNIX) or file pointed at by %APTRC% (Windows):
User-specific startup script, runs once at startup
– customeditinit: runs each time you open a document for
editing
– customdoctypes{yourdoctype}{yourdoctype}.acl: runs
once when the doctype is referenced during a session
– customdoctypes{yourdoctype}instance.acl: runs each
time a document of that type is opened
– {document_directory}/{docname}.acl: document-specific,
runs when you open {document_dir}/{docname}.xml
61. Where to Put Non-startup ACL Scripts
• For scripts that don’t need to run at startup, put
them in customscripts to make them available
– use source {filename} to run from command line or
another script
– use require {packagename} to load scripts in a package
file from another context
• Gotcha: avoid circular references:
foo.acl:
package foo;
require bar;
bar.acl:
package bar;
require foo;
62. Customizing Arbortext Features
• Much of Arbortext’s functionality is implemented
as ACL scripts
• By customizing those scripts you can customize
how Arbortext works
– Make modified copies of the scripts in custom/scripts.
These will override the default scripts.
– DON’T MODIFY ORIGINAL SCRIPTS IN $EPIC/packages
or other install subdirectories
• You might want the originals back someday
• You might break something else and have to revert
• Your changes will get blown away next time you
upgrade
63. Using alias Command to Customize
• You can use the alias command to change
Arbortext’s definition of certain commands
alias FilePrint { customPrint(); }
64. Using ACL with Other Custom Code
• You can use ACL to interact with other custom
code
– Java
– JavaScript
– VBscript & COM objects
65. ACL and Java
• Access static methods using java_static()
• Create instances with java_constructor()
• Execute instance methods with java_instance()
• Exchange array data with java_array_to_acl()
and java_array_from_acl()
66. Accessing Java Fields
• No way to access java fields (properties) directly,
but you can use reflection
function getJavaField(object,fldname) {
class = java_instance(object,"getClass");
field = java_instance($class,"getField",fldname);
value = java_instance($field,"get",object);
valuestr = java_instance($value,"toString");
java_delete($class);
java_delete($field);
java_delete($value);
return valuestr;
}
67. ACL and JavaScript
• Use js_source() function to execute a JavaScript
file
• The source command can also run JavaScript files
• Use javascript() function to execute a string of
JavaScript code and return the value to ACL
# make array of day names
split("S,M,T,W,Th,F,S", $daynames, ",");
# use javascript to get today’s day of week
$dow = javascript("d = new Date(); d.getDay();") + 1;
# +1 because JS is zero-indexed but ACL is one-indexed
response("Today is $daynames[$dow]");
68. ACL and VBScript/COM
• Use source command to execute a VBS file
• com_*() functions provide access to COM objects
# start Excel
$excel = com_attach("Excel.Application");
$ex_wbs = com_prop_get($excel,"Workbooks");
# open our data file
$result = com_call($ex_wbs,"Open","C:tempdata.xls");
# get value of cell A5
$mywb = com_prop_get($excel,"ActiveWorkbook");
$mysheet = com_prop_get($mywb,"Worksheets",1);
$mycell = com_prop_get($mysheet,"Cells",5,1);
$value = com_prop_get($mycell,"value");
# clean up objects with com_release()...
69. Running ACL Code From the Command Line
• You can run Arbortext in “batch” mode by giving it
code on the command line
• Use the –c parameter to give it a string of ACL
• Use the –b parameter to suppress windows (batch
mode)
epic –b –c “print composed; quit” foo.xml
70. Q & A
• Ask now (raise your hand)
• OR Ask later:
– Clay Helberg
The Mathworks
– clay.helberg@mathworks.com