Saturday, January 31, 2015

Infor Engine User Guide node Windchill PTC

Info*Engine tasks are always stored as text documents within the Info*Engine task
root. There are several ways to execute tasks, including the following:
An external Simple Object Access Protocol (SOAP) request.

Some of the Info*Engine tags can execute webjects that extract data
from enterprise systems through an adapter

When a task is contained in its own document, it is called a standalone task.

Queuing a task for execution. After you queue a task, you can disconnect
from your application. Any results are queued for later retrieval either by
you or others. By queuing a task, you can also guarantee that the task is
completed, even if it is interrupted due to a system problem.

In addition, requests can come from
SOAP requests that come from third-party applications through the Info*Engine
SOAP servlets.

Adapters provide a connection between the Info*Engine server and information
systems. One side of the adapter communicates with the Info*Engine server and
the other side communicates with the information system. The adapter translates
Info*Engine server requests into information system requests.

Info*Engine standalone tasks are XML-based documents that provide you with a
way to control the retrieval and manipulation of data outside of your JSP pages or
application.

Query webjects search external databases for objects that match specified
criteria. Each adapter supports a unique set of query webjects because the
adapter must handle queries differently due to the nature of the underlying
data repositories.
When Info*Engine encounters a query webject, it passes the webject to the
appropriate adapter. The adapter then performs the specified query. The group
of objects returned by a successful query is stored by Info*Engine. Thus,
making the results available to other webjects. For more information, see
Task Webject Reference on page 355.

For advanced users, Info*Engine also provides methods such as setOutputStream,
setInputStream, and sendContent that can manipulate BLOBs and the Java
language provides classes such as java.io.ByteArrayInputStream and
java.io.ByteArrayOutputStream to read or write BLOBs to or from
memory.

<h2>Upload File to Oracle BLOB Column</h2>
<form method="POST" action="/Windchill/servlet/IE/tasks/com/company/UploadBlob.xml"
enctype="multipart/form-data">

The UploadBlob.xml task identified in the action attribute of the form element
is the task that the Info*Engine server executes. This task (which is described in
the next section) uses the form variables to identify the adapter instance and specify
the name that corresponds to the BLOB in the table row where the BLOB is stored.

<form method="POST" action="/Windchill/servlet/IE/tasks/com/company/DownloadBlob.xml" enctype="multipart/form-data">

The following actions are allowed in this example application:
• Query—Search a given repository for parts.
• Fetch—Fetch a single part from a given repository.
• Download—Download the primary content of a part.
This example can be located in your Windchill installation at:
This example can be located in your Windchill installation at:
<Windchill>/prog_examples/federation/search_portal

Info*Engine provides a directory structure under which you should save your
task files.
Windchill is configured to look for Info*Engine tasks within the
<Windchill>/tasks directory.

Entering a task URL in the web browser is an easy way to execute the task without
providing the additional coding required to execute the task through an application
or JSP page.
Therefore, to execute the com/company/CreateGroup.xml task using
the myServer host name and the Windchill application URL, specify the
following URL:
http://myServer/Windchill/servlet/IE/tasks/com/company/CreateGroup.xml

The following rules apply to credentials mapping:
• If the author of a task or JSP page explicitly specifies DBUSER and PASSWD
parameters on a webject, those parameters take precedence over any other
authentication information that might be available.
• If DBUSER and PASSWD parameters are not explicitly specified, Info*Engine
attempts to provide values for them from the credentials mapping information.

Windchill is pre-configured to include a credentials mapping task.
This task is configured through the Windchill adapter using the
wt.federation.task.mapCredentials property value, which is set
to /wt/federation/MapCredentials.xml. The contents of this task
are dynamically generated, starting with the following file:
<Windchill>/tasks/wt/federation/
MapCredentials.xml.template
using the property values found in site.xconf.
Windchill’s LDAP access for user and group information relies on this
credentials mapping task, and can provide credentials to adapters based on
whether the current user is an administrator or a regular user. If you would like
to modify mapped credentials, you can set properties in site.xconf

If you need to customize this task you should do so by modifying the
MapCredentials.xml.template file. You should also keep a
backup copy, because patch or maintenance release installation may
overwrite your customization.

Using the xconfmanager utility, you can commands similar to the following to set
these properties:
xconfmanager -p -s "mapcredentials.admin.adapters=<adapter name>^
<privileged User>^<privileged
To set credentials for a Windchill administrator, use the following command:
mapcredentials.admin.adapters=<unique name of the adapter>^<username>^<password>
To set credentials for a user without Windchill administration privileges, use the
following command:
mapcredentials.nonprivileged.adapters=<unique name of the adapter>^<username>^<password>

Windchill offers a toolset that facilitates deployment of the same Info*Engine-based
web service that leverages JAX-WS (Java API for XML Web Services) in order
to handle the SOAP/XML and security-related web service details. This toolset
is available in addition to the Info*Engine-based web services that are supplied
by the SimpleTaskDispatcher servlet.

Aside from leveraging JAX-WS for the SOAP-related details, a major advantage
to using this framework is the addition of configurable and efficient security.

Legacy Info*Engine web services rely solely upon web server authentication
for security. This means that SOAP clients must have complete access to
user credentials, and must supply those credentials to the web server per its
authentication requirements (typically HTTP Basic Authentication). However, this
presents a fairly significant roadblock to developing applications that implement
SSO (Single Sign On).

With web service security support in Windchill, you can establish a trust
relationship between an application (such as a portal server) and an Info*Engine
web service by exchanging public key information, requiring that SOAP message
exchanges be properly signed and encrypted, and requiring that they contain a
valid username token that the web service should trust. As long as the incoming
SOAP message meets the security requirements and can be decrypted using a
public key found in the server’s truststore, the web service then executes a request
that has been authenticated with the username.

The supplied tooling is enabled using Apache Ant, located in:
<Windchill>/ant
(where <Windchill> is the Info*Engine installation directory).
The tooling is intended to be run from a windchill shell, in which case the ant
command is already in your path.

The directory that contains the Apache Ant build tools for deploying a web service
is located in <Windchill>/bin/adminTools/WebServices and contains
the following:
• build.xml
The primary Apache Ant build script used to deploy web services and associate
those services with security policies.
• security.properties
A properties file containing the security-related configuration information
used when deploying a web service. This file contains the security policy to
use, the server-side truststore and keystore configurations, and any additional
policy-specific configuration (if necessary) that is to be used at deployment
time.

This shared, symmetric key is generated at runtime and
encrypted using the service’s certificate. The client must specify the alias in the
truststore by identifying the server’s certificate alias.

The server security.properties file is found at:
<Windchill>/bin/adminTools/WebServices/security.properties

If you want to undeploy your web service from your installation, simply run the
undeploy target for the src/build.xml script of your project. For example:
% cd <Windchill>/prog_examples/MyProject/src
% ant undeploy
The undeploy target completes the following actions:
• Removes the servlet configuration from web.xml
• Removes the web service configuration from sun-jaxws.xml
• Removes the security policy configuration file
• Removes the JAR file supporting your web service
• Uninstalls the Info*Engine tasks (if your service is based on Info*Engine tasks)

Using Security Policies
When securing a web service with one of the supported security policies (other
than web server authentication), a Java client needs access to its own keystore and
truststore. Paths to these files (keystore and truststore) are configured for use by
the build framework in the following:
<Windchill>/bin/adminTools/WebServices/client/security.properties

Wednesday, January 21, 2015

Hibernate 4.2.6 note

Hibernate 4.2.6 note
1.
The main Hibernate ORM artifact is named hibernate-core. If you wish to use JPA support, you would instead name hibernate-entitymanager.
To use Hibernate ORM in your own project you just need to name a dependency on it in your project.
From Maven
<dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-core</artifactId>
   <version>4.3.8.Final</version>
</dependency>

hibernate-core
The main artifact, needed to build applications using the native Hibernate APIs including defining metadata in both annotations as well as Hibernate's own hbm.xml format.
hibernate-entitymanager
Represents Hibernate's implementation of JPA
hibernate-c3p0
Provides integration between Hibernate and the C3P0 connection pool library.

2.
The resource file hibernate.cfg.xml defines Hibernate configuration information.
The resource attribute of the mapping element causes Hibernate to attempt to locate that mapping as a classpath resource, using a java.lang.ClassLoader lookup.
Hibernate needs to create objects for you, using Java Reflection. The constructor can be private. However, package or public visibility is required for runtime
proxy generation and efficient data retrieval without bytecode instrumentation.

3.
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
In the absence of a column attribute, Hibernate uses the property name as the column name.
The title mapping also lacks a type attribute. The types declared and used in the mapping files are neither Java data types nor SQL database types. Instead, they
are Hibernate mapping types.
Hibernate mapping types are converters which translate between Java and SQL data types.
Hibernate attempts to determine the correct conversion and mapping type autonomously if the type attribute is not present in the mapping, by using Java
reflection to determine the Java type of the declared property and using a default mapping type for that Java type.

Monday, January 19, 2015

The Swift Programming Language Note 3 (From Inheritance to Advanced Operators) Completed

The Swift Programming Language Note 3 (From Inheritance to Advanced Operators) Completed
1. Inheritance
Any class that does not inherit from another class is known as a base class.
Swift classes do not inherit from a universal base class.
You can prevent a method, property, or subscript from being overridden by marking it as final.
Do this by writing the final modifier before the method, property, or subscript’s introducer keyword

2. Initialization
an initializer is like an instance method with no parameters, written using the init keyword
If you do not want to use an external name for an initializer parameter, write an underscore (_) instead
of an explicit external name for that parameter to override the default behavior.

3. Deinitialization
A deinitializer is called immediately before a class instance is deallocated. You write deinitializers
with the deinit keyword, similar to how intializers are written with the init keyword. Deinitializers are only available on class types.

4. Automatic Reference Counting
Swift uses Automatic Reference Counting (ARC) to track and manage your app’s memory usage. In most cases, this means that memory management
“just works” in Swift, and you do not need to think about memory management yourself. ARC automatically frees up the memory used by class
instances when those instances are no longer needed.

5. Optional Chaining
Optional chaining is a process for querying and calling properties, methods, and subscripts on an optional that might currently be nil. If
the optional contains a value, the property, method, or subscript call succeeds; if the optional is nil, the property, method, or subscript
call returns nil. Multiple queries can be chained together, and the entire chain fails gracefully if any link in the chain is nil.

6. Access Control
n addition to offering various levels of access control, Swift reduces the need to specify explicit access control levels by providing default
 access levels for typical scenarios. Indeed, if you are writing a single-target app, you may not need to specify explicit access control levels at all.
 Swift provides three different access levels for entities within your code. These access levels are relative to the source file in which an entity is defined, and also relative to the module that source file belongs to.

Public access enables entities to be used within any source file from their defining module, and also in a source file from another module that
imports the defining module. You typically use public access when specifying the public interface to a framework.
Internal access enables entities to be used within any source file from their defining module, but not in any source file outside of that module.
You typically use internal access when defining an app’s or a framework’s internal structure.
Private access restricts the use of an entity to its own defining source file. Use private access to hide the implementation details of a
specific piece of functionality.

7. Advanced Operators

The Swift Programming Language Note 2 (From Closures to Subscripts)

The Swift Programming Language Note 2 (From Closures to Subscripts)
1. Closures
reversed = sorted(names, { (s1: String, s2: String) -> Bool in return s1 > s2 } )
reversed = sorted(names, { s1, s2 in return s1 > s2 } )
reversed = sorted(names, { $0 > $1 } )
reversed = sorted(names) { $0 > $1 } -- as a trailing closure
reversed = sorted(names, >)

func makeIncrementor(forIncrement amount: Int) -> () -> Int {
    var runningTotal = 0
    func incrementor() -> Int {
        runningTotal += amount
        return runningTotal
    }
    return incrementor
}
The return type of makeIncrementor is () -> Int. This means that it returns a function, rather than a simple value.
The function it returns has no parameters, and returns an Int value each time it is called.
let incrementByTen = makeIncrementor(forIncrement: 10)

functions and closures are reference types.
Whenever you assign a function or a closure to a constant or a variable, you are actually setting that constant or variable
to be a reference to the function or closure.

2. Enumerations
enum CompassPoint {
    case North
    case South
    case East
    case West
}
enum Planet {
    case Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune
}
Unlike C and Objective-C, Swift enumeration members are not assigned a default integer value when they are created.

enum Barcode {
    case UPCA(Int, Int, Int, Int)
    case QRCode(String)
}

enum ASCIIControlCharacter: Character {
    case Tab = "\t"
    case LineFeed = "\n"
    case CarriageReturn = "\r"
}
Here, the raw values for an enumeration called ASCIIControlCharacter are defined to be of type Character

num Planet: Int {
    case Mercury = 1, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune
}
Auto-incrementation means that Planet.Venus has a raw value of 2, and so on.

3. Classes and Structures
Classes have additional capabilities that structures do not:
Inheritance enables one class to inherit the characteristics of another.
Type casting enables you to check and interpret the type of a class instance at runtime.
Deinitializers enable an instance of a class to free up any resources it has assigned.
Reference counting allows more than one reference to a class instance.
Structures are always copied when they are passed around in your code, and do not use reference counting
Structures and Enumerations Are Value Types
A value type is a type whose value is copied when it is assigned to a variable or constant, or when it is passed to a function.
Classes Are Reference Types
Unlike value types, reference types are not copied when they are assigned to a variable or constant, or when they are passed to a function.
Rather than a copy, a reference to the same existing instance is used instead.
=== “Identical to” means that two constants or variables of class type refer to exactly the same class instance.
== “Equal to” means that two instances are considered “equal” or “equivalent” in value, for some appropriate meaning
of “equal”, as defined by the type’s designer

The structure’s primary purpose is to encapsulate a few relatively simple data values.
The structure does not need to inherit properties or behavior from another existing type.
Swift’s String, Array, and Dictionary types are implemented as structures. This means that strings, arrays, and dictionaries are
copied when they are assigned to a new constant or variable, or when they are passed to a function or method.
If a computed property’s setter does not define a name for the new value to be set, a default name of newValue is used.

4. Properties
Property observers observe and respond to changes in a property’s value. Property observers are called every time a property’s value is set,
even if the new value is the same as the property’s current value.
You have the option to define either or both of these observers on a property:
willSet is called just before the value is stored.
didSet is called immediately after the new value is stored.
You define type properties for value types with the static keyword, and type properties for class types with the class keyword.

5. Methods
Methods are functions that are associated with a particular type. Classes, structures, and enumerations can all define instance methods
Instance methods are functions that belong to instances of a particular class, structure, or enumeration.
Specifically, Swift gives the first parameter name in a method a local parameter name by default, and gives the second and subsequent
parameter names both local and external parameter names by default.
class Counter {
    var count: Int = 0
    func incrementBy(amount: Int, numberOfTimes: Int) {
        count += amount * numberOfTimes
    }
}
This incrementBy method has two parameters—amount and numberOfTimes. By default, Swift treats amount as a local name only, but treats
numberOfTimes as both a local and an external name. You call the method as follows:
let counter = Counter()
counter.incrementBy(5, numberOfTimes: 3)

Every instance of a type has an implicit property called self, which is exactly equivalent to the instance itself. You use the self
property to refer to the current instance within its own instance methods.

if you need to modify the properties of your structure or enumeration within a particular method, you can opt in to mutating behavior for that method.

6. Subscripts
Classes, structures, and enumerations can define subscripts, which are shortcuts for accessing the member elements of a collection, list, or sequence.
struct TimesTable {
    let multiplier: Int
    subscript(index: Int) -> Int {
        return multiplier * index
    }
}
let threeTimesTable = TimesTable(multiplier: 3)
println("six times three is \(threeTimesTable[6])")
// prints "six times three is 18"

Monday, January 12, 2015

The Swift Programming Language Note 1 (From the Basics to Functions)

The Swift Programming Language Note 1 (From the Basics to Functions)
1. variable
declare constants with the let keyword and variables with the var keyword.
let maximumNumberOfLoginAttempts = 10
var currentLoginAttempt = 0
You can declare multiple constants or multiple variables on a single line, separated by commas:
var x = 0.0, y = 0.0, z = 0.0
You can provide a type annotation when you declare a constant or variable.
Write a type annotation by placing a colon after the constant or variable name, followed by a space, followed by the name of the type to use.
var welcomeMessage: String
var red, green, blue: Double
It is rare that you need to write type annotations in practice.
You can print the current value of a constant or variable with the println function:
println(friendlyWelcome)
println("The current value of friendlyWelcome is \(friendlyWelcome)")

Swift provides signed and unsigned integers in 8, 16, 32, and 64 bit forms.
In most cases, you don’t need to pick a specific size of integer to use in your code. Swift provides an additional integer type, Int, which
has the same size as the current platform’s native word size:
On a 32-bit platform, Int is the same size as Int32.
On a 64-bit platform, Int is the same size as Int64.

Double represents a 64-bit floating-point number. Use it when floating-point values must be very large or particularly precise.
Float represents a 32-bit floating-point number. Use it when floating-point values do not require 64-bit precision.
Double has a precision of at least 15 decimal digits, whereas the precision of Float can be as little as 6 decimal digits. The appropriate floating-point
type to use depends on the nature and range of values you need to work with in your code.
Swift always chooses Double (rather than Float) when inferring the type of floating-point numbers.

Numeric literals can contain extra formatting to make them easier to read. Both integers and floats can be padded with extra
zeroes and can contain underscores to help with readability.
let justOverOneMillion = 1_000_000.000_000_1

Tuples group multiple values into a single compound value.
let http404Error = (404, "Not Found")
// http404Error is of type (Int, String), and equals (404, "Not Found")
let (statusCode, statusMessage) = http404Error
println("The status code is \(statusCode)")
// prints "The status code is 404"
println("The status message is \(statusMessage)")
// prints "The status message is Not Found"
If you only need some of the tuple’s values, ignore parts of the tuple with an underscore (_) when you decompose the tuple:
let (justTheStatusCode, _) = http404Error
Alternatively, access the individual element values in a tuple using index numbers starting at zero:
println("The status code is \(http404Error.0)")
// prints "The status code is 404"
Tuples are useful for temporary groups of related values. They are not suited to the creation of complex data structures. If your data structure
is likely to persist beyond a temporary scope, model it as a class or structure, rather than as a tuple.

You use optionals in situations where a value may be absent.
let possibleNumber = "123"
let convertedNumber = possibleNumber.toInt()
// convertedNumber is inferred to be of type "Int?", or "optional Int"
You set an optional variable to a valueless state by assigning it the special value nil:
var serverResponseCode: Int? = 404
// serverResponseCode contains an actual Int value of 404
serverResponseCode = nil
// serverResponseCode now contains no value
nil cannot be used with nonoptional constants and variables. If a constant or variable in your code needs to work with the
absence of a value under certain conditions, always declare it as an optional value of the appropriate type.
If you define an optional constant or variable without providing a default value, the constant or variable is automatically set to nil for you:
var surveyAnswer: String?
// surveyAnswer is automatically set to nil
Once you’re sure that the optional does contain a value, you can access its underlying value by adding an exclamation mark (!) to the end of the
optional’s name. The exclamation mark effectively says, “I know that this optional definitely has a value; please use it.” This is known as forced
unwrapping of the optional’s value:
if convertedNumber != nil {
    println("convertedNumber has an integer value of \(convertedNumber!).")
}
// prints "convertedNumber has an integer value of 123."
Trying to use ! to access a non-existent optional value triggers a runtime error. Always make sure that an optional contains a non-nil value
before using ! to force-unwrap its value.

if let actualNumber = possibleNumber.toInt() {
    println("\'\(possibleNumber)\' has an integer value of \(actualNumber)")
} else {
    println("\'\(possibleNumber)\' could not be converted to an integer")
}
// prints "'123' has an integer value of 123"


2. Semicolons
Unlike many other languages, Swift does not require you to write a semicolon (;) after each statement in your code, although you can do so if you wish.
Semicolons are required, however, if you want to write multiple separate statements on a single line:
let cat = "🐱"; println(cat)

3. Assertions
If the condition evaluates to true, code execution continues as usual; if the condition evaluates to false, code execution ends, and your app is terminated.
let age = -3
assert(age >= 0, "A person's age cannot be less than zero")
Use an assertion whenever a condition has the potential to be false, but must definitely be true in order for your code to continue execution.

4. Basic Operators
let (x, y) = (1, 2)
// x is equal to 1, and y is equal to 2

Swift’s remainder operator can also operate on floating-point numbers:
8 % 2.5   // equals 0.5

The nil coalescing operator (a ?? b) unwraps an optional a if it contains a value, or returns a default value b if a is nil. The expression a is
always of an optional type. The expression b must match the type that is stored inside a.
The nil coalescing operator is shorthand for the code below:
a != nil ? a! : b

The closed range operator (a...b) defines a range that runs from a to b, and includes the values a and b. The value of a must not be greater than b.
for index in 1...5 {
    println("\(index) times 5 is \(index * 5)")
}
The half-open range operator (a..<b) defines a range that runs from a to b, but does not include b.
let names = ["Anna", "Alex", "Brian", "Jack"]
let count = names.count
for i in 0..<count {
    println("Person \(i + 1) is called \(names[i])")
}

5. Strings and Characters
var emptyString = ""               // empty string literal
var anotherEmptyString = String()  // initializer syntax
// these two strings are both empty, and are equivalent to each other

Swift’s String type is a value type. If you create a new String value, that String value is copied when it is passed to a function or method,
or when it is assigned to a constant or variable. In each case, a new copy of the existing String value is created, and the new copy is passed
or assigned, not the original version.
wift’s String and Character types are fully Unicode-compliant

.isEmpty
.hasPrefix
.hasSuffix

6. Collection Types
If you create an array or a dictionary and assign it to a variable, the collection that is created will be mutable. This means
that you can change (or mutate) the collection after it is created by adding, removing, or changing items in the collection.
Conversely, if you assign an array or a dictionary to a constant, that array or dictionary is immutable, and its size and contents cannot be changed.
It is good practice to create immutable collections in all cases where the collection does not need to change.

The type of a Swift array is written in full as Array<SomeType>, where SomeType is the type that the array is allowed to store. You can also write
the type of an array in shorthand form as [SomeType].
var shoppingList: [String] = ["Eggs", "Milk"]
shoppingList.append("Flour")
shoppingList += ["Baking Powder"]
shoppingList += ["Chocolate Spread", "Cheese", "Butter"]
shoppingList[4...6] = ["Bananas", "Apples"]
shoppingList.insert("Maple Syrup", atIndex: 0)
let mapleSyrup = shoppingList.removeAtIndex(0)
let apples = shoppingList.removeLast()
for item in shoppingList {
    println(item)
}
for (index, value) in enumerate(shoppingList) {
    println("Item \(index + 1): \(value)")
}

var someInts = [Int]()
println("someInts is of type [Int] with \(someInts.count) items.")
// prints "someInts is of type [Int] with 0 items."
var threeDoubles = [Double](count: 3, repeatedValue: 0.0)

Unlike items in an array, items in a dictionary do not have a specified order.
The type of a Swift dictionary is written in full as Dictionary<Key, Value> and shorthand form as [Key: Value]
var airports: [String: String] = ["YYZ": "Toronto Pearson", "DUB": "Dublin"]
if let oldValue = airports.updateValue("Dublin Airport", forKey: "DUB") {
    println("The old value for DUB was \(oldValue).")
}
remove a key-value pair from a dictionary with the removeValueForKey method.
if let removedValue = airports.removeValueForKey("DUB") {
    println("The removed airport's name is \(removedValue).")
} else {
    println("The airports dictionary does not contain a value for DUB.")
}
// prints "The removed airport's name is Dublin Airport."

for (airportCode, airportName) in airports {
    println("\(airportCode): \(airportName)")
}

for airportCode in airports.keys {
    println("Airport code: \(airportCode)")
}

for airportName in airports.values {
    println("Airport name: \(airportName)")
}

let airportCodes = [String](airports.keys)
// airportCodes is ["YYZ", "LHR"]

7. Functions
func sayHello(personName: String) -> String {
    let greeting = "Hello, " + personName + "!"
    return greeting
}
Functions Without Return Values:
func sayGoodbye(personName: String) {
    println("Goodbye, \(personName)!")
}
sayGoodbye("Dave")
// prints "Goodbye, Dave!"

If you want a function to modify a parameter’s value,
and you want those changes to persist after the function call has ended, define that parameter as an in-out parameter instead.

func swapTwoInts(inout a: Int, inout b: Int) {
    let temporaryA = a
    a = b
    b = temporaryA
}
var someInt = 3
var anotherInt = 107
swapTwoInts(&someInt, &anotherInt)

func addTwoInts(a: Int, b: Int) -> Int {
    return a + b
}
var mathFunction: (Int, Int) -> Int = addTwoInts
You can now call the assigned function with the name mathFunction:
println("Result: \(mathFunction(2, 3))")

func printMathResult(mathFunction: (Int, Int) -> Int, a: Int, b: Int) {
    println("Result: \(mathFunction(a, b))")
}
printMathResult(addTwoInts, 3, 5)

TODO Closures

Friday, January 9, 2015

My dictation on IELTS 7, TEST1, part 1

1.
My dictation on IELTS 7, TEST1, part 1
Man: Hello this is the land transport information at Toronto air port how may I help you?
Woman: Oh good morning I'm flying to Toronto airport next week and I need to get to a town called Milton. Could you tell me how I can get there?
Man: Milton did you say. let me see I think that's about 150 miles south west here. In fact, it's 147 miles to be exact so it will take you say at least 3 to 4 hours by road.
Woman: Wow, it is as far as that.
Man: Yes I'm afraid so but you have a number of options to get you there and you can always rent a car right here at the air port of cause
Woman: Wow I don't really want to drive by myself so I like to know more information about public transport?
Man: OK in that case the quickest and most comfortable is a cab and of cause there are always plenty available but it will cost you. You can also take a gray hound
bus or there's air port shuttle bus service to Milton.
Woman: Oh, thanks for that kind of distance of the cab is a way beyond my budget but the bus sounds OK can you tell me how much that would cost?
Man: Sure let's see that would be 15 dollars one way or 27.50 return and that is the gray hound service.
Woman: Oh, that is much cheap right. Where does it stop at Milton?
Man: It goest directly from the airport here to the city center and it's pretty fast. But you have to bear in mind that there's only one departure a day so it depends on what time
your flight gets there.
Woman: Ah, of cause hang on I'm due to get there at 11:30 AM.
Man: Too bad, the bus leaves at 3:45 you'll have to quite wait more than 4 hours
Woman: Well what about the shuttle you mentioned?
Man: OK that is the air port shuttle that will take you from the airport right to your hotel a private drive it's a door to door service and it would be much better as it's
every two hours
Woman: So how much does that cost?
Man: Let's see yeah that's 35 dollars one 65 dollars return so I guess it's a bit more expensive than than the gray hound.
Woman: Oh that doesn't sound too bad, especially it will take you straight to the hotel
Man: but do you need to reserve a seat
Woman: OK, is it possible to book right now from you?
Man: Sure.

The difference:
it is as far as that -> is it as far as that
drive by myself -> drive myself
I like -> I'd like
there's air port shuttle bus -> there's an air port shuttle bus
thanks for that kind of distance of the cab is a way beyond my budget -> I think for that kind of distance a cab would be a way beyond my budget
that is the gray hound service. -> that's on the Greyhound service.
that is much cheap right -> that is much cheap great
Where does it stop at Milton? -> but whereabouts does it stop at Milton?
your flight gets there. -> your flight gets in.
I'm due to get there at 11:30 AM. -> We're due to get there at 11:30 AM
you'll have to quite wait more than 4 hours -> so you would have quite a wait - more than 4 hours
that is the air port shuttle that will take you from the airport right to your hotel a private drive -> That's the Airport Shuttle that will take you
from the airport right to your hotel or private address.
it would suit you much better because there's one every two hours.
book right now from you? -> make a booking right now? Through you?

windchill tomcat

The Tomcat servlet engine comes bundled with Windchill and is embedded in the method server. The servlet engine is responsible for processing servlet and JSP
requests for Windchill. It has a direct relationship with the web server and filters specific requests from the web server into the application
server for processing.

no WCCADData, WCBaseline, WCAssoc WCProperty in WindchillJavadoc or InfoEngineJavadoc

Tuesday, January 6, 2015

windchill

question:
1. allow multi user to access the system at the system or not?
Say, user peter connected to the system already (not disconnected yet), is it OK this user connect again from this computer or other computer
2. from the sample code, the download size should be no greater than 1048575, do not set limitation from server side?
3. GetCADDataById() return object WCCADData?
4. GetAssociationByBaseline() return the array of WCAssoc objects
5. CreatePdfFile()

steps:
1. deploy a helloworld web service within WindChill server
2. deploy a download web service within WindChill server
3. deploy a web service with connect and disconnect
4. deploy the web service with the required method (not implemented well yet)
5. develop the C# web service client and use it to call the web service server
6. implement the require method and refractor with exception, message, soap fault
7. integration and test

Monday, January 5, 2015

五红水

5粒红枣、20颗枸杞、2勺红糖、20颗红豆、20颗红花生组合而成,用一个两杯水大的陶罐,加盖,放入水中煮,
开后小火20分钟,即可。从锅里拿出陶罐后把陶罐里的五红水倒入杯中既可饮用。
早晨加点姜放在你喝水的杯子里,冲着五红喝
晚上加蜂蜜喝也许效果更好