jBallerina 1.2.0 is the first major release of 2020 and it includes a new set of features and significant improvements to the compiler, runtime, standard library, and developer tooling. It is based on the 2020R1 version of the Language Specification.
The language implementation is based on the stable language specification version 2020R1. This implementation introduces a new set of features aimed at making integration further easier for the user. In addition to that, the XML and Lock implementations are out of their preview/experimental status.
In addition to new features, this release also includes critical bug fixes and fixes done to align the implementation with the language specification. Some of these changes are backward incompatible. For a complete list of changes done since 1.1.0, see the Language changes since jBallerina 1.1.0
section.
This release introduces a revamped XML support along with XPath-like query syntax allowing easy and safe manipulation of XML data.
XML step expressions allow to query the children of an XML element or children of members of an XML sequence.
xml x = xml `<root>
<person>
<name>
<fname>William</fname>
<lname>Martin</lname>
</name>
</person>
<person>
<name>
<fname>David</fname>
<lname>Taylor</lname>
</name>
</person>
<person>
<name>
<fname>Daniel</fname>
<lname>Wilson</lname>
</name>
</person>
</root>`;
// Select all children items, which are XML elements.
xml allElementChildren = x/<*>;
// Match first-level children with element name `person`.
// Then, match the second level with element name `name`
// and the third level with element name `fname`.
xml fnameItems = x/<person>/<name>/<fname>;
// Select all descendants, which match element name `fname`.
xml fnameDescendents = x/**/<fname>;
// Select all children items of `x`.
xml allChildren = x/*;
XML filter expression allows filtering an XML sequence by an element name.
xml x = xml `<root>
<rectangle length="5" width="10"/>
<rectangle length="5" width="5"/>
<circle radius="2"/>
<square side="6"/>
</root>`;
xml rectangles = x/*.<rectangle>;
xmlns "www.ballerina.io/ns" as ns;
xml val = xml `<element type="fixed" ns:count="2></element>`;
string|error 'type = val.'type;
string|error count = val.ns:count;
XML attribute access is now lax typed. This means that compile-time type checking is relaxed and moved to runtime. Accessing a non-existent attribute or using field access expression on a non-XML element item will result in an error being returned. If optional field access syntax is used, then nil will be returned instead of an error when the field is not available. Attributes with namespace prefix are accessed using the value.prefix:attrName
syntax where the XML prefix must be declared in the scope.
xml val = xml `<element type="fixed"></element>`;
string|error nonEx = val.nonExsistent; // result in error
string|error? nonExOptional = val?.nonExsistent; // result in nil
A query expression provides a language-integrated query feature using SQL-like syntax.
In its most basic form, a query expression consists of four kinds of clauses: from
, let
, where
, and select
. The first clause must be a from
clause and the last clause must be a select
clause. The result of the query expression is a list. In this basic form, a query expression is just a list comprehension.
The from
clause works similarly to a foreach statement. It creates an iterator from an iterable value and then binds variables to each value returned by the iterator. The where
clause is a boolean
expression, which can refer to variables bound by the from
clause; when the where
expression evaluates to false
, the iteration skips following clauses. The let
clause binds variables. The select
clause is evaluated for each iteration; the result of the query expression is a list whose members are the result of the select
clause.
Person[] outputPersonList =
from var person in personList
let string depName = "WSO2", string replaceName = "Alexander"
where person.deptAccess == "A" && person.firstName == "Alex"
select {
firstName: replaceName,
lastName: person.lastName,
deptAccess: depName
};
As of now, query expressions are supported by lists and streams.
The clauses in the query pipeline of a query action are executed in the same way as the clauses in the query pipeline of a query expression. The query action is executed as follows. For each input frame f
emitted by the query pipeline, execute the block-statement with f
in the scope.
error? result = from var student in studentList
where student.score > 1.0
do {
FullName fullName = {
firstName: student.firstName,
lastName: student.lastName
};
nameList.push(fullName);
};
A stream is an object-like value that can generate a sequence of values. There is also a value associated with the completion of the generation of the sequence, which is either nil, indication of the generation of the sequence being completed successfully, or an error.
A stream supports two primitive operations: a next operation and a close operation. The next operation has the same semantics as the next method on the Iterator
abstract object type. The close operation informs the stream that there will be no more next operations and thus allows the stream to release resources used by the stream.
A stream is iterable. A stream of type stream<T, C>
has value type T
and completion type C
. Calling the next method on the iterator created for an iteration has the same effect as performing the next operation on the stream. The stream does not keep a copy of the sequence of values returned by the next operation. Any subsequent iteration operation on the same stream will not generate further values so the iteration sequence for iterations other than the first will be the empty sequence.
The stream type provides methods (more precisely functions in the lang.stream
library) similar to list:
- map
- foreach
- filter
- reduce
- iterator
The map()
and filter()
methods return streams and work lazily. Iterable basic types would have a toStream()
method to convert to a stream; these should handle mutation similarly to iterators; as of now, it supports only for arrays.
stream<Person, error> personStream = getPersonStream();
stream<Person, error> filteredPersonStream = personStream.filter(function (Person person) returns boolean {
return person.age > 100 && person.name != "James";
});
This release introduces expression-bodied functions whose body is a single expression. The expression function body takes the form => E;
, where E
is any expression. It is equivalent to the block function body, { return E; }
. The following is an example where a Person
record is mapped to an Employee
record using an expression-bodied function.
function toEmployee(Person p, string pos) returns Employee => {
name: p.fname + " " + p.lname,
designation: pos
};
This release introduces let expression. It takes the form let T B = E1 in E2
, where E1
is evaluated resulting in a value v
. The typed binding pattern T B
is matched to v
, causing assignments to the variables occurring in B
. Then E2
is evaluated with those variables in scope; the resulting value is the result of the let expression.
const int globalVar = 2;
public function main() {
int b = let int x = 4, int y = 3 in x * y * globalVar; // b = 4 * 3 * 2 = 24
}
A mapping constructor expression can now have a spread field. A spread field can be used with another mapping value V
to include all of the fields in V
when creating the new mapping value.
type Foo record {|
string s;
decimal d;
|};
type Bar record {|
string s;
int i;
decimal...;
|};
public function main() {
Foo f = {s: "test str", d: 1.0};
// Spread field `...f` spreads the fields of `f`
// when creating the `Bar` value `b`. The required
// field `s` is provided via `f`.
// `b` will contain 3 fields; `s`, `i`, and `d`.
Bar b = {i: 1, ...f};
}
A mapping constructor expression can also contain just a variable name (foo
) as a field. This is equivalent to the key-value pair field foo: foo
. The name of the variable is considered the key while the variable reference is considered the expression.
type Employee record {|
string name;
string department;
|};
public function main() {
string department = "Finance";
// The variable-name `department` is
// used as a field here.
Employee e = {name: "Jo", department};
}
You can now mark type definitions, functions, object methods, and constants as deprecated using the @deprecated
annotation. The compiler will generate warnings if a you use a deprecated construct. If the deprecated construct contains documentation, you need to add some additional bit of documentation called Deprecated
documentation. The Deprecated
documentation should ideally include details on why the construct was deprecated and suitable alternate options, which should be used instead.
# Creates and returns a `Baz` object.
#
# # Deprecated
# This function is deprecated due to undesired side effects since it relies on module level
# variables. Use the new and improved `newFoo()` function instead.
@deprecated
public function foo() returns Baz {
// some logic which has side effects
}
Metadata (documentation and annotations) are now allowed on record and object fields.
// An annotation allowed on record fields.
annotation foo on record field;
// An annotation allowed on object fields.
annotation bar on object field;
// An annotation allowed on record and object fields.
annotation baz on field;
# Docs for this record.
public type Rec record {
# Docs for this field.
@foo
@baz
string s;
};
# Docs for this object.
public type Obj object {
# Docs for this field.
@bar
@baz
int i = 0;
};
Lang Library modules provide a new set of built-in types. Each such built-in type that is a sub type of a basic type B
is provided by the lang.B
module. The following are the built-in types provided by the lang library modules.
Module ballerina/lang.int
Unsigned8
Signed8
Unsigned16
Signed16
Unsigned32
Signed32
Module ballerina/lang.string
Char
Module ballerina/lang.xml
Element
ProcessingInstruction
Comment
Text
import ballerina/lang.'int;
import ballerina/lang.'string;
public function main() {
'int:Unsigned8 number = 200;
'string:Char char = "A";
}
lang.xml
moduleThe XML lang module has been revamped to work with the Element
, Comment
, ProcessingInstructions
and Text
XML built-in types. Previously, functions such as getChildren()
and getElementName()
, which are specific to an XML element type were allowed to be called on the xml
type and if they were called on non-element items, it used to result in runtime errors. With xml
built-in sub type improvements, these functions are statically type checked and only allowed on the built-in sub type Element
. The same applies to other built-in sub types and functions.
import ballerina/lang.'xml as xmllib;
public function main() {
xmllib:Element element = <xmllib:Element> xml `<elem> hello </elem>`;
xml children = element.getChildren();
}
The functions isElement()
, isProcessingInstruction()
, isComment()
and isText()
have been removed. The same functionality can be achieved using type testing as follows.
import ballerina/lang.'xml;
public function main() {
xml cmnt = xml `<!-- hello from comment -->`;
boolean isComment = cmnt is 'xml:Comment;
}
The functions appendChildren()
and removeChildren()
have been removed.
lang.boolean
moduleThe newly-added lang library module for the boolean
basic type contains a function for parsing string
values to boolean
values. It accepts ”true”
or ”false”
in any combination of lower/upper case as well as ”1”
and ”0”
, which evaluates to true
and false
respectively. An error is returned for any other string
value.
import ballerina/lang.'boolean;
public function main() {
boolean|error b = 'boolean:fromString("true");
}
lang.int
, lang.string
, lang.array
, and lang.map
modulesThe above-mentioned lang library modules have been enhanced by adding new API elements (e.g., constants and functions).
lang.int
module - Constants added: for max/min values of the int
type lang.string
module - New functions added: lastIndexOf()
, equalsIgnoreCaseAscii()
, toCodePointInt()
, fromCodePointInt()
lang.array
module - New functions added: lastIndexOf()
, toStream()
lang.map
module - New functions added: toArray()
, removeIfHasKey()
\u[CodePoint]
to \u{CodePoint}
so as to align with ECMAScript. Although this is an incompatible change, the previous syntax was not implemented.lock
statement has been changed. Now, it acquires a single, program-wide, recursive mutex before executing a lock statement and releases the mutex after completing the execution of the lock statement.x@
syntax for accessing the attributes of an XML element has been removed.xml
sequences result in empty sequences rather than a panic. Using the xml:get()
langlib method with an out of range index results in a panic.The compiler backend, which generates the Java bytecode for Ballerina programs was rewritten to reduce the time taken for Java bytecode generation. This resulted in a significant reduction in overall compilation time.
@strand
annotationAs per the Ballerina language specification, new strands should belong to the same thread as the currently executing strand. Strands, which belong to the same thread share the following characteristics.
In some situations, it would be desirable to assign strands to different threads. You can change this behavior with an annotation but such an annotation was not available in Ballerina releases prior to 1.2.0. This has been a major spec deviation.
A major revamp of our strand scheduler was done in this release to address the spec deviation.
A new cookie API has been introduced for easily handling HTTP cookies. It provides the following features: - Enable the server to read cookies from the request and write cookies to the response (in “Set-Cookie” header). - Enable configuring the client to enable/disable cookies, enable/disable persistent cookies, and whether to block/unblock third-party cookies. - Add persistent cookies support and add support to plug custom persistent storages.
Add support to create, read, update, and delete trailing headers in the response message. All existing header functions are changed to accept a finite-typed variable. The default value is set as leading
, which means by default, those functions apply to leading headers. In order to apply trailer headers, you need to set the position as trailing as shown below.
string trailerHeader = response.getHeader("foo", position = "trailing");
AbstractCache
object, which can be used to implement custom caches and the AbstractEvictionPolicy
object, which can be used to implement custom eviction algorithms. By default, this provides a Cache
object and LruEvictionPolicy
object, which is an implementation of the LRU eviction algorithm.Oneof
field supportThe Oneof
fields in the protobuf definition are now mapped to optional fields in Ballerina. When you generate the code, the Ballerina record is generated with a new setter function for each field to restrict you from setting more than one of those fields and a valid function.
For example,
message Person {
oneof identity {
string passportId = 1;
string nic = 2;
}
}
public type Person record {|
string passportId?;
string nic?;
|};
function isValidPerson(Person a) returns boolean {
...
}
function setPerson_PassportId(Person a, string passportId) {
...
}
function setPerson_Nic(Person a, string nic) {
...
}
Note: The previous
Oneof
design will not work from this release. If you are currently using it, you need to regenerate the code from the proto definition and change your code accordingly.
The map fields in the protobuf definition are now mapped to nested records in Ballerina.
For example,
message HelloRequest {
map<int32, string> tags = 4;
}
public type HelloRequest record {|
record {| int key; string value; |}[] tags = [];
|};
Client retry is only supported in unary blocking calls. This will be supported in other messaging patterns in the future. Retry functionality can be enabled using the following retry configuration.
grpc:ClientConfiguration clientConfiguration = {
retryConfiguration: {
retryCount: 5,
intervalInMillis: 2000,
maxIntervalInMillis: 10000,
backoffFactor: 2,
errorTypes: [grpc:INTERNAL_ERROR, grpc:UNAVAILABLE_ERROR]
}
};
name
field in the ServiceConfig
annotation is now used to set the Service name. This is to support dynamic service registration.Ballerina Kafka is redesigned and version 2.0.0 is released. This has breaking changes hence older code may not work.
kafka:ConsumerConfig
and kafka:ProducerConfig
records are renamed to kafka:ConsumerConfiguration
and kafka:ProducerConfiguration
respectively to comply with the Ballerina naming conventions.send()
function of the kafka:Producer
now accepts anydata?
as the key
and anydata
as the value
types as opposed to the existing byte[]?
and byte[]
respectively.bootstrapServers
configuration is now a required parameter for both the kafka:ConsumerConfiguration
and kafka:ProducerConfiguration
records.The Kafka module now supports a set of serializers and deserializers in contrast to the existing byte[]
data. The introduced serializers / deserializers are:
byte[]
string
int
float
avro
custom
The Kafka module now supports Avro serialization/deserialization. This only supports Kafka values yet. Key serialization support will be added later. For more information, go to The Standard Library.
The Ballerina Task module is enhanced with multiple attachment support.
Named arguments for task attachments will not work now. For example, the following code will no longer compile.
task:Scheduler timer = new({ intervalInMillis: 1000 });
Person person = { name: "Sam", age: 29 };
var attachResult = timer.attach(TimerService, attachment = p);
To make it work, change it as follows.
task:Scheduler timer = new({ intervalInMillis: 1000 });
Person person = { name: "Sam", age: 29 };
var attachResult = timer.attach(TimerService, person);
Now, you can pass any number of attachments to the attach()
function. For example,
task:Scheduler timer = new({ intervalInMillis: 1000 });
Person person = { name: "Sam", age: 29 };
Account account = { number: 188008, balance: 1233.02 };
var attachResult = timer.attach(TimerService, person, account);
A new experimental JDBC2 module is introduced in the Ballerina 1.2 release and it will be fully supported by the 1.3 release. The existing JDBC module will be removed later in the 1.3 release.
Now, Publishers and Subscribers of all messaging connectors(Kafka, RabbitMQ, and JMS) support observability.
| Connector/Module | Old Org | New Org |
|---|---|---|
| JIRA | wso2/jira7 | ballerina/jira7 |
| GoogleSpreadSheet | wso2/gsheets4 | ballerinax/googleapis.sheets4 |
| Twilio | wso2/twilio | ballerinax/twilio |
| FTP | wso2/ftp | ballerina/ftp |
| Redis | wso2/redis | ballerina/redis |
| JMS | wso2/jms | ballerina/java.jms |
| MongoDB | wso2/mongodb | ballerina/mongodb |
| GitHub | wso2/github4 | ballerinax/github4 |
| Salesforce | wso2/sfdc46 | ballerinax/sfdc46 |
| SOAP | wso2/soap | ballerina/soap |
| Gmail | wso2/gmail | ballerinax/googleapis.gmail |
| AmazonSQS | wso2/amazonsqs | ballerinax/aws.sqs |
| AmazonS3 | wso2/amazons3 | ballerinax/aws.s3 |
| Java | ballerinax/java | ballerina/java |
| Java Arrays | ballerinax/java.arrays | ballerina/java.arrays |
The following connectors are newly added in this release.
The following connectors are revamped in this release.
Support for setting environment variables to the Docker image.
@docker:Config {
env:{
testVar1: "value1",
testVar2: "value2"
}
}
The default base image for the generated Docker images have changed to ballerina/jre8:v1
. Also, now, Docker images can be generated for main()
functions.
@docker:Config {}
public function main() {
io:println("Hello, World!");
}
Ability to generate Docker images by only adding the import as import ballerina/docker as _
. This will generate the Docker images with minimum configurations for services, listeners, and main functions.
import ballerina/http;
import ballerina/docker as _;
listener http:Listener helloWorldEP = new(9090);
@http:ServiceConfig {
basePath: "/helloWorld"
}
service helloWorld on helloWorldEP {
resource function sayHello (http:Caller outboundEP, http:Request request) {
…
}
}
@kubernetes:Service {
nodePort: 31100,
serviceType: "NodePort"
}
ballerina.conf
file as a Kubernetes Secret is provided.@kubernetes:Secret {
conf: "./conf/ballerina.conf"
}
@kubernetes:Deployment {
updateStrategy: {
strategyType: kubernetes:STRATEGY_ROLLING_UPDATE,
maxUnavailable: 3,
maxSurge: "45%"
}
}
import ballerina/docker as _
is provided. This will generate the Kubernetes artifacts with minimum configurations for services, listeners, and main functions.import ballerina/http;
import ballerina/kubernetes as _;
listener http:Listener helloWorldEP = new(9090);
@http:ServiceConfig {
basePath: "/helloWorld"
}
service helloWorld on helloWorldEP {
resource function sayHello (http:Caller outboundEP, http:Request request) {
...
}
}
A new @knative:Service
annotation is introduced. It allows you to generate Knative Service artifacts for Knative.
import ballerina/http;
import ballerina/knative;
@knative:Service {}
@http:ServiceConfig {
basePath: "/helloWorld"
}
service helloWorld on new http:Listener(8080) {
resource function sayHello(http:Caller outboundEP, http:Request request) {
...
}
}
A CLI tool for generating Ballerina bridge code for Java APIs.
Note: The bindgen tool is still experimental.
This CLI tool could be used to generate Ballerina bridge code for Java APIs. Here, Ballerina objects and the relevant Java interoperability mappings for specified Java classes will be auto-generated with the aim of providing a seamless coding experience to call existing Java code from Ballerina. These Ballerina bindings could be generated for Java classes residing inside Java libraries (for which the classpaths needs to be provided) or for standard Java classes.
Command:
ballerina bindgen [(-cp|--classpath) <classpath>...]
[(-o|--output) <output>]
(<class-name>...)
Options:
1. (-cp|--classpath) <classpath>...
: One or more comma-delimited classpaths for obtaining the JAR files required for generating the Ballerina bindings. This is not needed if the Ballerina bridge code is to be generated for standard Java classes.
2. (-o|--output) <output>
: Location for the generated Ballerina bridge code. If this path is not specified, the output will be written to the same directory from where the command is run.
3, <class-name>...
: One or more space-separated fully-qualified Java class names for which the bridge code is to be generated.
The Ballerina test framework provides the capability to mock a function. By using the mocking feature, you can easily mock a function in a module that you are testing or a function of an imported module. This feature will help you to test your Ballerina code independently from other modules and functions. Function mocking is only supported for project-based execution in v1.2.0.
The function specified with the @test:Mock {}
annotation will be considered as a mock function, which gets triggered every time the original function is called. The original function that will be mocked should be defined using the annotation parameters.
The ballerina build
and ballerina test
commands now generate an HTML report at the end of test execution. This would contain the total test cases executed, passes, failures, and skipped tests with project-level, module-level, and individual test details. The link to the test report can be found at the end of the test execution.
Introduced the --code-coverage
flag for ballerina build
and ballerina test
commands. When the flag is provided, an additional section with code coverage details will be displayed in the test report. This would contain coverage details at project-level, module-level, and of individual files.
Note: This is only supported with project-based execution in v1.2.0.
You can go to The Standard library content such as functions, action invocations, types, etc. by executing the Go to Definition
action.
Now, you do not need to restart the IDE make the user configurations effective.
A complete list of issues fixed for 1.2.0 can be found here.


Tools
New seed from camera
New seed from dice
Calculate 12th/24th word
The "New seed" flows proceed as usual. When the new seed is generated, route to review the 24 words:
continue to seed word display


Questions 1-3 pertain to the following program, which takes an integer
n on the command line.
main(int argc, char **argv) { int n, i, k; int total; if (argc != 2) exit(1); n = atoi(argv[1]); if (n < 0) exit(1); total = -20; for (i = 0; i <= n; i++) { total++; for (k = n; k > 1; k = k / 2) { total++; } } printf("%d\n", total); } |
Question 1 (2 points)What does the program print out when n is 4? Write your answer on the answer sheet.
Question 2 (4 points)Exactly what does the program print out as a function of n? (e.g. it prints out 2n, or 5n*n - 40). If you want, you may assume that n is a power of two. |
Question 3 (9 points)Look at the table on the answer sheet.Let the output of the program be f(n). Each column of the table is a different function g(n). There are four rows, one each for O(g(n)), Omega(g(n)), Theta(g(n)), and o(g(n)). Your job is to put an X in the each entry of the table where g(n) is has the proper relationship to f(n). For example, consider the first column, where g(n) = 1.
|


ICS 331 will no longer be offered in Spring 2017.
You must receive a passing grade in ICS 311 to get credit for the course.
Your Spring 2018 workload exceeds recommended workload amounts.
ICS 331 will no longer be offered in Spring 2017.
You must receive a passing grade in ICS 311 to get credit for the course.
Your Spring 2018 workload exceeds recommended workload amounts.
Participate in the AT&T Hackathon on March 11 to earn more Innovation points.
You need to receive at least a 3.0 this semester to earn more Competency points.
See your ICS adviser to upload STAR data from Fall 2015.


jigsaw init- Initialize a project using a starter template:
jigsaw init template_name- Build the site for development:
jigsaw build- Preview the site from the "build_local" directory:
jigsaw serve- Build the site for production:
jigsaw build production- Preview the site from the "build_production" directory:
jigsaw serve build_production


A self-professed geek and map addict, I've worked in the mapping and location space for over 25 years through a combination of luck and occasional good judgement. I'm currently CTO with Kamma, a growing #geotech, #proptech and #regtech company based in London's legal district.
When I'm not in an office, I work from anywhere with the magic combination of good coffee, free Wi-Fi and somewhere to charge my MacBook Pro.
Previously I've been CTO of what3words, Head of APIs for the Ordnance Survey, the United Kingdom's national mapping agency, the Geotechnologist-in-residence for Lokku, was Director of Places and Director of Global Community Programs for Nokia Maps and HERE Maps. Before joining Nokia I led Yahoo’s UK Geo Technologies group, launching GeoPlanet, Placemaker, helping Flickr and Fire Eagle do location based services and have even worked at the European Space Agency, a job which really was rocket science.
I'm based in London, where I live with my family in Teddington. A commited Italophile, I'm also a science fiction fan who thinks that removing Deckard's noir voiceover from Blade Runner was utterly the right thing to do. Our house runs on Macs and macOS (because it's basically UNIX with a lovely user interface) and Raspberry Pi's; although an X-Box and Windows laptop have managed to creep in.
I've been tweeting about maps as @vicchi since 2007, writing about maps at www.vicchi.org since 2001 and also make the occasional map at maps.geotastic.org.
A Fellow of the Royal Geographical Society, I'm a RedHat Certified Engineer, I've sat on the Executive for the AGI, the United Kingdom’s Association for Geographic Information, I'm a founder of the Location Forum, the co-founder of WhereCamp EU and conference chair of W3G.
Despite prevailing wisdom, it's a firm belief of mine that espresso, rare steak, red wine and chocolate really should be considered food groups.


#Goal
The main goal of developer.li is to offer an open & free space for devs to build their projects and ideas.
For that goal we provide free subdomains registrations for everyone and provide free resources for all.
This page is open to all type of contributions on GitHub, for improving the page or provide more resources.
#Subdomains
Check for available subdomains:
{{subdomain}}.developer.li is not available
{{subdomain}}.developer.li is available!
{{subdomainCount}} subdomains registered and counting!
Powered by FreeDNS: freedns.afraid.org
Check out more available domains in their registry!
Instructions:
- 1 - Signup in FreeDNS with a valid email
- 2 - Confirm your account from the email received
- 3 - Go and register your first subdomain here!
- Extra: find extra domains to register in the main registry!
#Projects
ntfy: ntfy lets you send push notifications to your phone or desktop via scripts from any computer, using simple HTTP PUT or POST requests.
Nostr relay: a general purpose public relay ("wss://nostr.developer.li") for Nostr.
NIP-05 ID registration service: free NIP-05 ID registration vía GitHub just editing this file and submitting a PR.
JWT decoder: a little tool to decode JWT tokens with some useful insights.
Want to contribute with other project? Get your subdomain and open a PR to this repo including your project here!!
#Contributions
Check me out in Github!
Feel free to fork the project, open issues and PRs to improve the page!
Made using the NES-style CSS Framework and Angular.


To build upon my present knowledge and to contribute towards the growth of professionally managed organization with my skills and experience, leading towards my growth and development.


Welcome to your L2Bank account. Complete the achievements below to learn to successfully online bank!
Add an account
Make a deposit
Transfer money
Purchase an item


--- layout: hackathon ---
In short: Don’t be obnoxious, play fair, and we’ll all have a good time.
By participating in the UQCS Hackathon, you agree to the following code of conduct, and at all times will:
Be respectful
Be mindful and respectful of everyone in the competition. Do not abuse or harass anyone, or attempt to disrupt the event.
 Behave in a way that is suitable for anyone to view, including young children.
Keep clean
Make sure the venue and equipment remains clean and tidy once you’re finished with it. Clean up your mess and make sure the area you’re working in is at least as clean as it was when you got there.
Follow the rules
Don’t cheat, attempt to cheat, try and bend the competition rules, etc.
Remember that the organisers are in charge
Respect decisions of the Hackathon committee, and don’t violate the code of conduct. If you have any issues, you will let the organisers know. The organisers may take any action deemed appropriate, from warnings to expulsion. If removed from the event you understand that you will be ineligible to compete for any further Hackathon prizes.


{{ partial "head.html" }}
{{partial "navbar.html" . }}
404 file not found
{{partial "footer.html" .}}


This site is a way to show case my artwork and give prospective clients a way of contacting me about commissions. I also have included links to all of my social media. Below you will see my most recent work, and find the rest of my art work on the "Portfolio" page. Towards the bottom of this page you can hit the "Collaborate" button for business inqueries.
Please feel free to look through my portfolio and see if you would like to collaborate or order a commission from me. The button below will take you to the "Contact" where you can send me a message.
Go check out my social medias and show me some love if you would like. I love hearing from people and sharing art a lot. I hope you enjoy my website and if you are a fellow artist I would love to see your work! Don't be shy!!


Registration a new student
Please enter your data:
First Name
Last Name
Department
Login
Password
Submit
Back


In JDK 1.5, calling new Short() causes memory allocation. Short.valueOf() is more memory friendly. Example :
public class Foo { private Short i = new Short(0); // change to Short i = Short.valueOf(0); }


Class Options
Options for configuring the command system
Inheritance
Implements
Inherited Members
Namespace: AzureFromTheTrenches.Commanding
Assembly: AzureFromTheTrenches.Commanding.dll
Syntax
public class Options : IOptions
Constructors
| Improve this Doc View SourceOptions()
Sets defaults
Declaration
public Options()
Properties
| Improve this Doc View SourceAuditItemEnricherFactoryFunc
By default audit item enrichers are created through the dependency resolver but if a function is assigned to the AuditItemEnricherFactoryFunc property then that function will be used to instantiate an enricher
Declaration
public Func<Type, IAuditItemEnricher> AuditItemEnricherFactoryFunc { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Func<System.Type, IAuditItemEnricher> |
CommandExecutionExceptionHandler
Can be used to register a type that implements the ICommandExecutionExceptionHandler interface that will be invoked in the event of an execution error
Declaration
public Type CommandExecutionExceptionHandler { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Type |
CommandHandlerContainerRegistration
Unless an alternative implementation of ICommandHandlerFactory is supplied or the CommandHandlerFactoryFunc in this options class is set then actors are created through the dependency resolver but not all IoC containers can resolve unregistered concrete types (for example the built in ASP.Net Core IServiceCollection and IServiceProvider IoC cannot). Where this is the case supply an implementation for the CommandHandlerContainerRegistration action that registers the actors in the container. For example using an IServiceCollection instance of serviceCollection: var options = new Options() { CommandHandlerContainerRegistration = type => services.AddTransient(type, type) };
Declaration
public Action<Type> CommandHandlerContainerRegistration { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Action<System.Type> |
CommandHandlerFactoryFunc
By default actors are created through the dependency resolver but if a function is assigned to the CommandHandlerFactoryFunc property then that function will be called to instantiate an handler.
Declaration
public Func<Type, object> CommandHandlerFactoryFunc { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Func<System.Type, System.Object> |
DisableCorrelationIds
Setting this to true will disable all correlatin ID generation which can give a small performance boost in super-low latency situations.
Declaration
public bool DisableCorrelationIds { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Enrichers
It can be useful to include additional properties in the command context, for example the Application Insights Operation ID. This can be done by setting this property to a set of enrichment objects - these are called in sequence and are passed the current state of the command contexts enriched properties and can return a dictionary of properties to insert. If the returned dictionary contains a property that already exists it will be replaced in the command context property bag.
Declaration
public IEnumerable<ICommandDispatchContextEnricher> Enrichers { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<ICommandDispatchContextEnricher> |
MetricCollectionEnabled
Set to true to gather timing metrics around command dispatch and execution. Note this has a minor performance implication in high throughput environments.
Declaration
public bool MetricCollectionEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Reset
The commanding system maintains command registrations, command context enrichers, and auditors between calls to UseCommanding to enable sub-modules to extend the system without any awareness / tight coupling between them. If you want to force a reset of the shared state then set this property to true (generally this is only useful in sample apps where you might repeatedly recreate and reconfigure an IoC container as the included samples do.
Declaration
public bool Reset { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
UseLocallyUniqueCorrelationIds
By default correlation IDs will be generated as GUIDs so that they are unique across as distributed system however if performance is key a local;y unique (incrementing long, thread safe) correlation ID can be used by setting this to true
Declaration
public bool UseLocallyUniqueCorrelationIds { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |


Galaxy S11e Design Leaks Out; Same Galaxy S11 Rear Camera Hump but With Three Sensors Shown in Latest Renders
by Omar SohailJust a few hours after you checked out the Galaxy S11 renders and its 360-degree video, here we are with another image gallery and short clip revealing that the Galaxy S11e design could take inspiration from its larger and certainly more expensive brother. The Galaxy S11e camera arrangement can also be viewed in the latest renders, so let us not waste any more time and jump into the details right away.
There’s Virtually No Difference Between the Galaxy S11e Design When Compared to Galaxy S11; Display Size Said to Be Smaller
This time, Onleaks have PriceBaba have collaborated in bringing you the latest Galaxy S11e renders. While the following information isn’t mentioned anywhere in the images, the Galaxy S11e is said to feature a display size in the range 6.2-6.3 inches when measured diagonally. While it should be a large device in terms of display size, the significant reduction of the bezels should reduce the overall footprint of the smartphone. Additionally, if you thought the Galaxy S10e was a capable, yet affordable flagship, the Galaxy S11e should be even better in several categories.
Unfortunately, those specifications aren’t going to be accompanied by a 3.5mm audio jack, so users will have to take advantage of the Galaxy S11e’s Type-C USB port for taking advantage of both listening to audio and charging the smartphone. In terms of button placement, Samsung may have taken an absurd decision with the Galaxy S11e design. According to the renders, the left side doesn’t show any physical buttons, but the right side shows both the power button as well as the volume rockers. There’s a single front-facing camera present at the top middle of the smartphone, much like the Galaxy Note 10 and Galaxy Note 10 Plus.
Now another aspect of the Galaxy S11e design that’s similar to the Galaxy S11 is the rear camera hump. The only difference here is that instead of a penta-lens setup, the renders show a triple camera array. Customers who want such a device at a lower cost should have no trouble complaining about the camera setup, though the large hump might be a sight for sore eyes for some.
The Galaxy S11 dimensions reportedly measure 151.7 x 69.1 x 7.9mm. If we take the camera hump into account, the thickness will increase from 7.9mm to 9.1mm. In a lot of ways, the Galaxy S11e design change, camera upgrades, and the obvious spec bump will make it a worthy successor to the Galaxy S10e. As for how much it’ll cost, well that little bit of information should be available when we reach Samsung’s rumored Galaxy S11 launch event, which is expected to be held on an unknown date in February 2020.
Source: PriceBaba
Products mentioned in this post
The links above are affiliate links. As an Amazon Associate, Wccftech.com may earn from qualifying purchases.


interface SimpleStoryStep : StoryStep<StoryHandlerDefinition>
(source)
StoryStep without custom StoryHandlerDefinition.
open val baseIntent: IntentAware
Returns intent or the StoryDefinition.mainIntent if intent is null. |
|
open val children: Set<StoryStep<T>>
The optional children of the step. |
|
open val intent: IntentAware?
The main intent of the step. If not null and if the current intent is equals to intent, this step will be automatically selected to be the current step. |
|
abstract val name: String
The name of the step. usually automatically defined by the enum field. |
|
open val otherStarterIntents: Set<IntentAware>
Same behaviour than intent in the rare case when the step handle more than one intent. |
|
open val secondaryIntents: Set<IntentAware>
The secondary intents of this step. If detected and if the current step is this step, the current step remains this step. |
open fun answer(): T.() -> Any?
The custom answer for this step. When returning a null value, it means that the step is not able to answer to the current request. |
|
open fun supportIntent(i: Intent): Boolean
Does this step support this intent? |
|
open fun supportStarterIntent(i: Intent): Boolean
Does this step support this intent as starter intent? |


These three visualizations provide insight into the language skills of users on GitHub. The three distinct techniques are displayed below. Want to know more? Read more here on how I built this!
Mouse over (or tap) each language relation to see more statistics on the relation.
Search for a specific user to see his/her language skills.
Click to select languages to search for. Users returned will know these languages.
WATCH OUT! Depending on your language selection this process may take some time. The first 10 users are loaded, if you want to see more, please click the button :).
This project was built using a number of projects:
My name is Daniel van der Ende. I'm an MSc Computer Science student at Delft University of Technology. I love building cool visualizations to give different perspectives of data. Any feedback about this project is more than welcome! You can find me on Twitter, or contact me through my website (note! This site is far from complete, so forgive me for some strangeness :) ).


Monitoring and Controlling Networks of IoT Devices with Flink Stateful Functions
August 18, 2020 - Igal Shilman (@IgalShilman)In this blog post, we’ll take a look at a class of use cases that is a natural fit for Flink Stateful Functions: monitoring and controlling networks of connected devices (often called the “Internet of Things” (IoT)).
IoT networks are composed of many individual, but interconnected components, which makes getting some kind of high-level insight into the status, problems, or optimization opportunities in these networks not trivial. Each individual device “sees” only its own state, which means that the status of groups of devices, or even the network as a whole, is often a complex aggregation of the individual devices’ state. Diagnosing, controlling, or optimizing these groups of devices thus requires distributed logic that analyzes the “bigger picture” and then acts upon it.
A powerful approach to implement this is using digital twins: each device has a corresponding virtual entity (i.e. the digital twin), which also captures their relationships and interactions. The digital twins track the status of their corresponding devices and send updates to other twins, representing groups (such as geographical regions) of devices. Those, in turn, handle the logic to obtain the network’s aggregated view, or this “bigger picture” we mentioned before.
Our Scenario: Datacenter Monitoring and Alerting #
There are many examples of the digital twins approach in the real world, such as smart grids of batteries, smart cities, or monitoring infrastructure software clusters. In this blogpost, we’ll use the example of data center monitoring and alert correlation implemented with Stateful Functions.
Consider a very simplified view of a data center, consisting of many thousands of commodity servers arranged in server racks. Each server rack typically contains up to 40 servers, with a ToR (Top of the Rack) network switch connected to each server. The switches from all the racks connect through a larger switch (Fig. 1).
In this datacenter, many things can go wrong: a disk in a server can stop working, network cards can start dropping packets, or ToR switches might cease to function. The entire data center might also be affected by power supply degradation, causing servers to operate at reduced capacity. On-site engineers must be able to identify these incidents quickly and fix them promptly.
Diagnosing individual server failures is rather straightforward: take a recent history of metric reports from that particular server, analyse it and pinpoint the anomaly. On the other hand, other incidents only make sense “together”, because they share a common root cause. Diagnosing or predicting causes of networking degradation at a rack or datacenter level requires an aggregate view of metrics (such as package drop rates) from the individual machines and racks, and possibly some prediction model or diagnosis code that runs under certain conditions.
Monitoring a Virtual Datacenter via Digital Twins #
For the sake of this blog post, our oversimplified data center has some servers and racks, each with a unique ID. Each server has a metrics-collecting daemon that publishes metrics to a message queue, and there is a provisioning service that operators will use to ask for server commission- and decommissioning.
Our application will consume these server metrics and commission/decommission events, and produce server/rack/datacenter alerts. There will also be an operator consuming any alerts triggered by the monitoring system. In the next section, we’ll show how this use case can be naturally modeled with Stateful Functions (StateFun).
Implementing the use case with Flink StateFun #
The basic building block for modeling a StateFun application is a stateful function, which has the following properties:
-
It has a logical unique address; and persisted, fault tolerant state, scoped to that address.
-
It can react to messages, both internal (or, sent from other stateful functions) and external (e.g. a message from Kafka).
-
Invocations of a specific function are serializable, so messages sent to a specific address are not executed concurrently.
-
There can be many billions of function instances in a single StateFun cluster.
To model our use case, we’ll define three functions: ServerFun, RackFun and DataCenterFun.
ServerFun
Each physical server is represented with its digital twin stateful function. This function is responsible for:
-
Maintaining a sliding window of incoming metrics.
-
Applying a model that decides whether or not to trigger an alert.
-
Alerting if metrics are missing for too long.
-
Notifying its containing RackFun about any open incidents.
RackFun
While the ServerFun is responsible for identifying server-local incidents, we need a function that correlates incidents happening on the different servers deployed in the same rack and:
-
Collects open incidents reported by the ServerFun functions.
-
Maintains an histogram of currently opened incidents on this rack.
-
Applies a correlation model to the individual incidents sent by the ServerFun, and reports high-level, related incidents as a single incident to the DataCenterFun.
DataCenterFun
This function maintains a view of incidents across different racks in our datacenter.
To summarize our plan:
-
Leaf functions ingest raw metric data (blue lines), and apply localized logic to trigger an alert.
-
Intermediate functions operate on already summarized events (orange lines) and correlate them into high-level events.
-
A root function correlates the high-level events across the intermediate functions and into a single healthy/not healthy value.
How does it really look? #
ServerFun #
- This section associates a behaviour for every message that the function expects to be invoked with.
- The
metricsHistory
buffer is our sliding window of the last 15 minutes worth ofServerMetricReports
. Note that this buffer is configured to expire entries 15 minutes after they were written. serverHealthState
represents the current physical server state, open incidents and so on.
Let’s take a look at what happens when a ServerMetricReport
message arrives:
- Retrieve the previously computed
serverHealthState
that is kept in state. - Evaluate a model on the sliding window of the previous metric reports + the current metric reported + the previously computed server state to obtain an assessment of the current server health.
- If the server is not believed to be healthy, emit an alert via an alerts topic, and also send a message to our containing rack with all the open incidents that this server currently has.
RackFun #
- This function keeps a mapping between a
ServerId
and a set of open incidents on that server. - When new alerts are received, this function tries to correlate the alert with any other open alerts on that rack. If a correlated rack alert is present, this function notifies the DataCenterFun about it.
DataCenterFun #
- A persisted mapping between a
RackId
and the latest alert that rack reported. - Throughout the usage of ingress/egress pairs, this function can report back its current view of the world of what racks are currently known to be unhealthy.
- An operator (via a front-end) can send a
GetUnhealthyRacks
message addressed to that DataCenterFun, and wait for the corresponding responsemessage(UnhealthyRacks)
. Whenever a rack reports OK, it’ll be removed from the unhealthy racks map.
Conclusion #
This pattern — where each layer of functions performs a stateful aggregation of events sent from the previous layer (or the input) — is useful for a whole class of problems. And, although we used connected devices to motivate this use case, it’s not limited to the IoT domain.
Stateful Functions provides the building blocks necessary for building complex distributed applications (here the digital twins that support analysis and interactions of the physical entities), while removing common complexities of distributed systems like service discovery, retires, circuit breakers, state management, scalability and similar challenges. If you’d like to learn more about Stateful Functions, head over to the official documentation, where you can also find more hands-on tutorials to try out yourself!


Manage job status
You have no print jobs in queue.
Create new print job
Job ID
job_id
Submitted
job_date_time
Status
job_status
Choose printer above
×
ERROR


ABS-CBN increases profit 53% to P2.26B
by Darwin G. AmojelarABS-CBN Corp. on Wednesday said net income rose 53 percent in the first nine months of the year on higher advertising revenues.
The media and entertainment company owned by the Lopez Group said net income amounted to P2.26 billion in the first nine months of the year from P1.48 billion year-on-year.
ABS-CBN generated consolidated revenues of P32 billion from advertising and consumer sales, up 8.6 percent on year.
Advertising revenues increased 15 percent, attributable to both political placements and growth in regular advertising. Excluding political placements, regular advertising rose by 5.6 percent on year.
Consumer sales increased P302 million mainly resulting from higher TVPlus Boxes sold and higher subscription revenues from Sky Cable.


HTML collection to be converted to standard array
The @param list represented as a native array of elements
delay execution of a method
invoked after @param wait milliseconds
true to invoke @param func before waiting
shallow copies b into a, preserving any existing values in a
target
values to copy into target if they are not already present
Only execute callback when @param v is truthy
passing a non-trivial value will invoke the callback with this as the sole argument
callback to execute when the value is non-trivial (not null, not undefined)
Returns individual query string value from a url
Extract parameter of this name from the query string
Search this url
parameter value
Replaces the options elements with the actual query string parameter values (e.g. {a: 0, "?a=10"} becomes {a: 10})
Attributes on this object with be assigned the value of the matching parameter in the query string
The url to scan
poor $(html) substitute due to being unable to create
shallow copies b into a, replacing any existing values in a
target
values to shallow copy into target
returns all combinations of a1 with a2 (a1 X a2 pairs)
1xN matrix of first elements
1xN matrix of second elements
2xN^2 matrix of a1 x a2 combinations
Converts a string representation of a value to it's desired type (e.g. parse("1", 0) returns 1)
string representation of desired return value
desired type
@param v converted to a @param type
Returns an array [0..n)
number of elements
in-place shuffling of an array
array to randomize
ie11 compatible version of e.classList.toggle if class exists then remove it and return false, if not, then add it and return true.
true to add specified class value, false to remove it.
true if className exists.
Generate a UUID
UUID
Adapted from http://stackoverflow.com/a/2117523/526860
Generated using TypeDoc
Converts a GetElementsBy* to a classic array


fmc
Businessmodel of FMC
Customer Segments
FMC develops and markets a broad range of products that are utilised by commercial entities across multiple business sectors. The Company’s main target markets include:
- Agriculture, including commercial crop producers, growers, and farming businesses;
- Food Production, including producers of various food products, such as confectioners, grocery producers, beverage producers, and meat and seafood companies;
- Pharmaceutical and Personal Care, including pharmaceutical companies, health supplement producers, and cosmetic and personal care item manufacturers;
- Household Care, including producers of various household care items, such as laundry tablets and detergent;
- Energy Storage, including sustainable energy, transport, and electronics companies;
- Industrial Chemicals, including manufacturers of various industrial chemicals, greases, and lubricants; and
- Construction, including commercial property developers, contracting firms, and construction companies. FMC serves a global customer base, with operations across North America, Latin America, Asia Pacific, and Europe, Middle East and Africa. FMC does not name its customers on its website or in its annual report.
Value Propositions
FMC provides value to its customers in the following ways:
- Its industry standing and reputation, with the Company established as one of the leading companies in its field, with a track record for delivering high-quality products and reliable solutions;
- Its international reach, with the Company serving a global client base, which spans North America, Latin America, Asia Pacific, and Europe, Middle East, and Africa;
- Its broad portfolio of products, with the Company producing and marketing a wide range of products – including insecticides, herbicides, natural colourants, and specialty lithium products – which are utilised across a broad spectrum of target industries;
- Its technology-backed processes, with the Company committed to to developing process technology improvements and innovative application solutions to drive the highest value for its customers; and
- Its network of production facilities, with the Company operating an international network of production facilities across all of its geographic operating regions, enabling it to provide products quickly and efficiently. ### Channels
FMC operates a website at www.fmc.com, through which it provides information on its general activities and product range. The Company also operates websites dedicated to its health and nutrition and lithium operations at www.fmcbiopolymer.com and www.fmclithium.com respectively. FMC does not operate an online sales channel, nor does it appear to provide an online customer portal.
FMC principally markets and sells its products through its own direct sales force, which its organised by operating segment and geographic region. The Company’s direct sales personnel operate primarily out of the Company’s network of international offices across the Americas, Asia Pacific, Europe, Africa, and the Middle East, including in Charlotte, North Carolina; Bangalore, India; Shanghai, China; Tokyo, Japan; Taipei, Taiwan; and Bromborough, UK.
FMC accesses certain markets across Latin America and Asia through local independent distributors and marketing alliances. The Company also utilises the services of several major national and regional distributors across North America. Much of FMC’s sales in Europe are made through Cheminova, which the Company acquired in 2015.
FMC operates its own manufacturing and distribution infrastructure across each of its operation regions. This includes a network of production facilities and distribution centres.
Customer Relationships
FMC does not offer products and services to its customers on a self-service basis. Instead the Company provides tailored services to customers. It direct sales personnel consult closely with clients in order to establish their individual needs, and the unique terms of each sales and distribution contract. The Company seeks to establish longstanding relationship with its customers, with many of its contracts spanning multiple years.
FMC provides ongoing support to its customers, with many of its larger clients having dedicated account management teams that are available to address concerns and client needs. Customers are also able to contact members of the Company’s support and relations teams over the phone, via email, and through an online contact form, in order to receive personalised responses to queries and enquiries.
FMC additionally provides a range of online resources to its clients. This includes information on its various products, tax information, safety and security reporting, and information regarding suppliers. Customers are also able to follow the operations of FMC, and interact directly with the Company, through its social media accounts, including with Facebook, Twitter, LinkedIn, Google+, and YouTube.
Key Activities
FMC is a diversified chemical company. It manufactures, markets and sells a wide range of products for use across multiple industries, including the agricultural, consumer and industrial markets.
The Company aligns its operations into three reportable business segments: FMC Agricultural Solutions, which develops, markets and sells insecticides, herbicides and fungicides; FMC Health and Nutrition, which develops and sells nutritional ingredients, health excipients and functional health ingredients, including microcrystalline cellulose, carrageenan, alginates, natural colorants, pectin and omega-3; and FMC Lithium, which manufactures lithium for use in a range of lithium products, which are used in energy storage, specialty polymers and chemical synthesis application. FMC serves a global client base, with operations across the Americas, Europe, Asia Pacific, the Middle East, and Africa.
Key Partners
- Supplier and Vendor Partners, comprising suppliers of materials, equipment, and tools – notably types of seaweed, specialty pulps, natural colourant raw materials, and fish oils – that are used in the Company’s manufacturing processes, as well as suppliers of services and technologies that are utilised more broadly across the enterprise;
- Channel and Distribution Partners, including local, national and regional distributors, and independent sales agents, which support and supplement the capabilities of the Company’s in-house sales and marketing force;
- Joint Venture Partners, including various chemicals and manufacturing companies, with which the Company jointly develops and markets products through mutually owned entities;
- Community and Social Partners, comprising various non-profits and charitable organisations with which the Company collaborates on social and community projects around the world; and
- Strategic and Alliance Partners, comprising market-leading companies across multiple industries, with which the Company shares resources and works on joint projects. ### Key Resources
FMC’s key resources are its intellectual properties and technologies, its materials and supply chain, its network of production facilities, its IT and communication infrastructure, its sales and distribution channels, its partnerships, and its personnel.
FMC owns a number of US and foreign patents, trademarks and licenses that are cumulatively important to the Company’s business. Searches of records published by the US Patent and Trademark Office identified a number of patent applications filed in FMC’s name, including applications entitled ‘Liquid-fertilizer ready formulations of bifenthrin’, ‘Insecticidal compositions and method for insect control’ and ‘Self-gelling alginate systems and uses thereof’.
FMC also owns and or leases a number of physical properties around the world that are key to its operations. This notably includes its network of 32 facilities spread across its three operating segments and various operating regions.
Cost Structure
FMC incurs costs in relation to the development of its technologies and solutions, the procurement of supplies, the operation of its production facilities, the maintenance of its IT and communications infrastructure, the operation of its sales and distribution channels, the management of its partnerships, and the retention of its personnel.
In 2015 FMC recorded total cost of sales and services in the amount of $2.20 billion, selling, general and administrative expenses totalling $737.90 million, and research and development costs of $143.7 million.
Revenue Streams
FMC generates revenue through the production, marketing, and sale of various chemicals and related products. The Company organises its products by operating segment:
- FMC Agricultural Solutions, which derives revenue from the sale of insecticides, pesticides, and herbicides;
- FMC Health and Nutrition, which derives revenue from the sales of carrageenan, alginates, natural colourants, and Omega-3; and
- FMC Lithium, which derives revenue from the sale of lithium. In 2015 FMC generated annual revenue of $3.28 billion, up marginally on the $3.26 billion recorded by the Company in 2014. The vast majority of the Company’s revenue was derived from its FMC Agricultural Solutions segment, which alone generated $2.25 billion for the year.


Exchange Rate Changed Successfully!
Own Currency
Missing
Destination Currency
Missing
New Rate
Missing


Mental health resources
Your mental health is so important to us. We can help you find help. If you are experiencing a mental health-related emergency please call 911.
Click here for additional mental health resources.
National Suicide Prevention Lifeline
The crisis line is available 24/7 and you will be connected with a trained counselor who can provide free, confidential support.
(800) 272-8255
Substance Abuse and Mental Health Services Administration National Helpline
The crisis line is available 24/7 and you will be connected with a trained counselor who can provide free, confidential support.
(800) 662-4357
Crisis Text Line
Text HOME to 741741 to receive free, confidential help.
The Trevor Project
The crisis line is available 24/7 for LGBTQ+ youth and you will be connected with a trained counselor who can provide free, confidential support.
(866) 488-7386
The University of Michigan is not affiliated with the Flint Justice Partnership. By using this website, you agree that the Flint Justice Partnership will not be liable for any harm relating to your use.
Copyright © 2019 - Flint Justice Partnership. All Rights Reserved.


There will be 5 questions provided with multiple choice.
Once you start the test, the timer would start automatically.
You can surf through questions forward and backward.
At the last question, you will see the 'Submit Answers' button
...
All the best


---
layout: page
title: Visualizing Calmer Intersections #centered title at top of page
subtitle: Thomson Avenue, Van Dam Street, and Queens Boulevard
#use-site-title: true
---
AutoCAD, GIS, Illustrator
Over thirty pedestrians and cyclists have been injured in crashes at this complex juncture since January 2013. In this project I envisioned small, pragmatic adjustments and calming measures to mitigate the severe safety issues and pedestrian unfriendliness of the intersection. I referenced NACTO design guides and was careful to ensure that the number of travel lanes was not reduced. To make the graphics I exported DoITT planimetric road geometries to CAD and drafted missing pedestrian islands and road markings using measurements that I took on-site.


Provides interfaces and default implementations for classes that provide the ability to generate free text from Semcor files.


Click here to adjust the map settings
Google Maps is unavailable right now. Please try again later.
Source: wikipedia


|
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
Deploy three (in my case) web applications under three different virtual hosts, making the default vhost respond to any name and to the bare IP address.
Note: download the jdk, not just the jre!
make a symlink named java to j2sdk1.4.1_01/ so that you can easily switch back and forth between different jvms. We will use the same trick for apache and tomcat afterwards. Now tell your bash shell where to find java binaries: create a file named java.sh in /etc/profile.d with the following content:
do a chmod:
You should get the answer given above. If not chek your environment and make sure that java.sh is executed when opening a new shell. Try to run a java program or the following: java -version. If you don't like this way of installing java please ignore it. Make sure everything is ok and then jump to the next step.
Download the latest release, uncompress it, cd into the newly created directory and run the following:
Of course you can customize the installation specifying other modules to enable or whatever you like. Just don't forget to ENABLE-SO, because that's what you need to load the apache-tomcat connector. Run make and make install. Create the log directories and others (you can skip this if you know how to configure where apache puts its log files -> edit httpd.conf):
Create the symlink /usr/local/apache to /usr/local/apache2.0.43 and test your installation by executing:
Open a browser and point it to the linux box: you should get a page telling you that the apache installation was successful. If that doesn't happen check the logs and troubleshoot: common errors in this configuration are that some directory holding log or configuration files is missing or maybe you have another web server listening on port 80.
Uncompress the tomcat binaries in a directory of your choice. In this howto we will use /opt. Create a symlink named jakarta to the newly created directory so that you have something like the following:
After a few seconds point your browser at the IP of the linux box on port 8080 and you should see the tomcat welcome page. If not check the catalina.out log file in /opt/jakarta/logs and fix all errors until Tomcat comes up.
Here is a sample server.xml file. Please note that the location of directories and log files is absolutely arbitrary and you have to edit it to make it suit your needs. <!-- Umberto Server Configuration File --> <Server port="8005" shutdown="SHUTDOWN" debug="0"> <!-- Define an Apache-Connector Service --> <Service name="Tomcat-Apache"> <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 --> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="20000" useURIValidationHack="false" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/> <Engine name="Apache" defaultHost="www.home.net" debug="0"> <Logger className="org.apache.catalina.logger.FileLogger" prefix="apache_log." suffix=".txt" timestamp="true"/> <!-- Access log processes all requests for this virtual host. --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> <Host name="www.home.net" debug="0" appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example" unpackWARs="true" autoDeploy="true"> <Alias>localhost</Alias> <Alias>www</Alias> <Alias><IP_ADDRESS></Alias> <Context path="" docBase="" debug="1"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="home_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> </Host> <Host name="www.customer1.it" debug="0" appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-blank" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="" debug="1"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="cust1_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> </Host> <Host name="www.customer2.net" debug="0" appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/root" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="" debug="1"/> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="cust2_log." suffix=".txt" pattern="common" resolveHosts="false"/> </Host> </Engine> </Service> </Server>This is a very minimalistic conf file, because we have taken away the HTTP1.1 connector that allows us to talk directly to Tomcat. It might not be good for development, but it should be good for production. If you feel like you need also the Tomcat Standalone service then copy and paste it from your original server.xml file (you did back it up, didn't you?). Try to start tomcat again and check catalina.out to see if everything is up and running. If it complains about missing apr stuff try to edit /opt/jakarta/conf/jk2.properties and make it look so: # list of needed handlers. handler.list=channelSocket,request # Override the default port for the channelSocket channelSocket.port=8009If everything is ok move on to next section.
rtfm at http://httpd.apache.org/docs-2.0/vhosts/ In the appendix you can find the httpd.conf file I used to write and test this HOWTO.
Download the jk2 shared library for you version of apache and copy it in /usr/local/apache/modules (create the directory if necessary). If you can't find a suitable version of jk2 ask it to the tomcat-user mailing list or download the source and build it yourself (this is another HOWTO). Create, if you haven't already, the /usr/local/apache/conf directory and create a file named workers2.properties with this content in it: # only at beginnin. In production uncomment it out [logger.apache2] level=DEBUG [shm] file=/usr/local/apache/logs/shm.file size=1048576 # Example socket channel, override port and host. [channel.socket:localhost:8009] port=8009 host=<IP_ADDRESS> # define the worker [ajp13:localhost:8009] channel=channel.socket:localhost:8009 # Uri mapping [uri:<IP_ADDRESS>/*.jsp] worker=ajp13:localhost:8009 [uri:www.home.net/*.jsp] worker=ajp13:localhost:8009 [uri:www.customer1.it/*.jsp] worker=ajp13:localhost:8009 [uri:www.customer2.net/*.jsp] worker=ajp13:localhost:8009Edit the file, change ip addresses and names to suit your needs and save it. Edit http.conf and add the following line in the Modules section: LoadModule jk2_module modules/mod_jk2.soSave http.conf and try to start apache. It should now load the jk2 connector and the configuration from workers2.properties. Check the error log to make sure everything is ok.
Start tomcat and try to load a HTML page in your browser: apache should return
the page
without problems.
Now try with a jsp page: it should display after a little.
If everything works go to next section.
Now ask your network administrator to set up an alias for your brand new server (use jspsrc if you like to stick to this howto). If you don't have easy access to dns try to edit your hosts file (on the client where you open the browser) and add a line as follows: <IP_ADDRESS> jspsrcwhere <IP_ADDRESS> is the ip of your server. Open your browser and type this in your location bar: http://jspsrcand navigate to a jsp page. You should get the source of the jsp page into your browser! This is clearly a security problem, if not a major annoyance. What's wrong with the setup we came up so far? The problem is (or should be) that the ajp13 connector can't find a virtual host that matches the jspsrc uri. What we need to do is set up the default virtual host so that ALL *.jsp requests get handled by tomcat. How do we do it? Read on if you want to know how.
In addition to the workers2.properties you can put Jk diretives directly into the httpd.conf file (just as you did with jk and webapp). Edit the default virtual host section in httpd.conf and add the following lines in the end, before </VirtualHost>: <Location "/*.jsp"> JkUriSet worker ajp13:localhost:8009 </Location>Restart Apache and test the jspsrc url again. The jsp source should not be displayed anymore.
I think a better approach would be to remove all uri directives from workers2.properties and to put them in http.conf as we did in the previous section for the defualt virtual host. Experiment and let me know.
# # Umberto Nicoletti, 18/10/2002 # ### Section 1: Global Environment ServerRoot "/usr/local/apache" ErrorLog logs/error_log <IfModule !mpm_winnt.c> <IfModule !mpm_netware.c> #LockFile logs/accept.lock </IfModule> </IfModule> # ScoreBoardFile: File used to store internal server process information. <IfModule !mpm_netware.c> <IfModule !perchild.c> #ScoreBoardFile logs/apache_runtime_status </IfModule> </IfModule> <IfModule !mpm_netware.c> PidFile logs/httpd.pid </IfModule> Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 <IfModule prefork.c> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 </IfModule> <IfModule worker.c> StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule> <IfModule perchild.c> NumServers 5 StartThreads 5 MinSpareThreads 5 MaxSpareThreads 10 MaxThreadsPerChild 20 MaxRequestsPerChild 0 </IfModule> # listen on all ports Listen 80 # # Dynamic Shared Object (DSO) Support # LoadModule jk2_module modules/mod_jk2.so ### Section 2: 'Main' server configuration <IfModule !mpm_winnt.c> <IfModule !mpm_netware.c> # # If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # . On SCO (ODT 3) use "User nouser" and "Group nogroup". # . On HPUX you may not be able to use shared memory as nobody, and the # suggested workaround is to create a user www and use that user. # NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET) # when the value of (unsigned)Group is above 60000; # don't use Group #-1 on these systems! # User nobody Group #-1 </IfModule> </IfModule> ServerAdmin<EMAIL_ADDRESS>ServerName www.home.net UseCanonicalName Off # # The following directives define some format nicknames for use with # a CustomLog directive (see below). # LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent LogLevel debug CustomLog logs/access.log common DocumentRoot "/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example" <Directory /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example> Options None AllowOverride None </Directory> DirectoryIndex index.html index.jsp <Directory /> Options None AllowOverride None </Directory> <Files ~ "^\.ht"> Order allow,deny Deny from all </Files> <Location /WEB-INF/> Order Allow,Deny </Location> NameVirtualHost * <VirtualHost *> ServerName www.home.net ServerAlias www ServerAlias localhost ServerAdmin<EMAIL_ADDRESS>DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example ErrorLog logs/home.net-errorlog CustomLog logs/home.net-access.log common <Location "/*.jsp"> JkUriSet worker ajp13:localhost:8009 </Location> </VirtualHost> <VirtualHost *> ServerName www.customer1.it ServerAdmin<EMAIL_ADDRESS>DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-blank ErrorLog logs/cust1-errorlog </VirtualHost> <VirtualHost *> ServerName www.customer2.net ServerAdmin<EMAIL_ADDRESS>DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/root ErrorLog logs/cust2-errorlog </VirtualHost> |


Use these tools built by the community for the community to assist in solving some of the more complicated steps in Call of Duty Zombies easter eggs.
We built these tools in our own time and there is probably going to be a few bugs here and there.


My name is Maria M. Morrison and I'm a full stack web developer. I decided to get into web development after being in transportation for 13 years when my sister, who is a front end developer, pointed out to me that I would be good at it because I love logic and strategy games, and like most people have an idea for mobile apps. But I wasn’t going to be content with dreaming up mobile apps so I decided to do tutorials but after while came to the conclusion that I wanted and needed formal training. So I decided to drop everything and move from Ohio to Colorado to attend Galvanize to study web development. I'm a fan of Archer, Rick and Morty, movies and interesting UI/UX.
Portfolio
In Progress
I am working on learning the following:


Dr Mahathir says he is healthy, 'blood pressure is good at 120/70'
by Nazuin Zulaikha KamarulzamanKUALA LUMPUR (Nov 19): Finance Minister Lim Guan Eng said today Prime Minister Tun Dr Mahathir Mohamad indicated he is in good health and wants to continue working in his office.
In a tweet, Lim said he met Dr Mahathir today to discuss about Malaysia's current issues.
"Tun said not to worry, [his] blood pressure is good (at) 120/70," Lim said.
Earlier today, Bernama, quoting a message by the Prime Minister's Office, reported that Dr Mahathir suffered a slight nose bleed during a press conference here at Malaysian Palm Oil Board International Palm Oil Congress and Exhibition (PIPOC) 2019.
It was reported that he is in good health. "News that he was rushed for medical attention is not true, said a message which the Prime Minister's Office shared with the media," Bernama reported.


Upload your Google Location History
You can download your Google Location History here:
https://takeout.google.com/settings/takeout
You can download your Google Location History here:
https://takeout.google.com/settings/takeout
You don't have your data ready, but just want to play around with the portal? Use your example data!


Having determined our operations, we next need to think about how to represent a Vec
.
The easiest implementation decision is that we need to define a template class. We
want to allow users to use Vec
s to hold a variety of types. The template facility that we
described in §8.1.1/140 for functions also applies to classes. That facility let us write one
definition of a template function, and use that template to create versions that could be
run on a variety of types. Similarly, we can define a template class, and then use that class to create
a family of types that differ only with respect to the types used in the template
parameter list. We've already used such types, including vector
, list
, and map
.
As with template functions, when we define a template class, we have to signal that the class is a template, and list the type parameters that will be used in the class definition:
template <class T> class Vec { public: // interface private: // implementation };
This code says that Vec
is a template class, with one type parameter named T
. As with
other class types, we can assume that there will be public
and private
parts that define
the interface and implementation respectively.
The next question we must resolve is what data we will store. Presumably we'll need
some storage to hold the elements in the Vec
, and we'll want to keep track of the number
of elements that the Vec
contains. The most obvious choice is to hold the elements in a
dynamically allocated array.
What information about the array do we need to store? We intend to implement the
begin
, end
, and size
functions. This intention suggests that we might store the address
of the initial element, one past the address of the last element, and the number of elements.
However, we do not need to store all three of these items, because we can compute
any of them from the other two. Therefore, we'll make the arbitrary decision to store
only pointers to the first and (one past) the last element of the array, and to compute the
size
as needed. We envision a data structure that looks like this:
With these implementation decisions made, we can update our Vec
class:
template <class T> class Vec { public: // interface private: T* data; // first element in the Vec T* limit; // one past the last element in the Vec };
This class definition says that Vec
is a template type, and that it takes a single type parameter.
In the body of the class definition, we'll call that type T
. Whenever we use T
, the
compiler will replace it with whatever type the user names when creating a Vec
. So for
example, if we write
Vec<int> v;
this definition will cause the compiler to instantiate (§8.1.2/142) a version of the Vec
class
in which it replaces each reference to T
by int
. The code that the compiler generates for
that class will resolve expressions that involve T
as if they had been written using int
.
Thus, because we used the type parameter T
in the declaration of data
and limit
, the
type of these pointers depends on the type of the objects that the Vec
will hold.
This type is not known until the definition of a Vec
is instantiated. Once we say that
we want a Vec<int>
, the types of data
and limit
are known: They will be int*
for
this instance of Vec
. Similarly, if we also used Vec<string>
, then the compiler would
generate a second, different instantiation of Vec
that bound T
to string
, thereby giving
data
and limit
the type string*
in that instantiation.
Because our class will allocate its array dynamically (§10.6.2/184), we might expect that
we should allocate space for our Vec
by using new T[n]
, where n
is the number of elements
we want to allocate. However, remember that not only does new T[n]
allocate
space, but it also initializes the elements by running the default constructor for T
. If we
were to use new T[n]
, then we would be imposing a requirement on T
: Users could create
a Vec<T>
only if T
has a default constructor. The standard vector
class imposes no
such restriction. Because we want to emulate standard vector
s, we don't want to
impose this restriction either.
It turns out that the library provides a memory allocation class that offers more
detailed control over memory allocation. This class will suit our needs exactly, if we use it
instead of new
and delete
. The class lets us allocate raw memory, and then—in a separate
step—build objects in that memory. Rather than diving right into the details of that
class, we will assume that eventually we shall have to write some utility functions that
will manage the memory for us. For now, we'll assume that these functions exist, and
we'll use them in completing the Vec
class. As we use them, we'll get a better picture of
just what we would like them to do, so that when it's time to implement them, We will
know just what it is that we need to implement.
These new utility members will be part of the private
implementation of our class.
They will be responsible for allocating and deallocating the memory that we need, and for
initializing and destroying the elements stored in the Vec
. Thus, these functions will
manage our pointers—data
and limit
. Only these memory management functions will
give new values to these data members. The public
members of Vec
will read data
and
1imit
, but will not change them.
When the public
members need to do something, such as constructing a new Vec
that needs to change the value of data
or limit
, they will call an appropriate memory-
management function to do so. This strategy will let us partition our work: One set of
members will provide the interface to our user, and another set will deal with the implementation
details.
We'll come back to fill in the details of these utility functions in §11.5/203.
We know that we must define two constructors:
Vec<Student_info> vs; // the default constructor Vec<double> vs(100); // constructor taking a size
The standard vector
also provides a closely related third constructor, which takes a size
and an initial value to use to initialize the elements of the vector
, and initializes all the
elements to copies of that value. This constructor is similar to the one that takes a size
alone, so we may as well implement this third constructor too.
The role of any constructor is to ensure that the object is correctly initialized. For Vec
objects, we need to initialize data
and limit
. Doing so involves allocating space to hold
the elements of the Vec
and initializing those elements to an appropriate value. In the
case of the default constructor, we want to create an empty Vec
, so we need not allocate
any space. For the constructors that take a size, we will allocate the given amount of storage.
If the user gives us an initial value as well as a size, we'll use that value to initialize
all the elements that we allocated. If the user gives us just a size, then we'll use the default
constructor for T
to obtain a value to use in initializing the elements. For now, we'll forward
to our as yet unwritten memory-management functions the job of initializing data
and limit
, and the related work of allocating and initializing the elements:
template <class T> class Vec { public: Vec() { create(); } explicit Vec(size_type n, const T& val = T()) { create(n, val); } // remaining interface private: T* data; T* limit; };
The default constructor, which is the one that takes no arguments, needs to indicate that
the Vec
is empty (i.e., that it has no elements). It does so by calling a member called
create
, that we'll have to write. When we return from create
, we intend for both
data
and limit
to be set to zero.
Our second constructor uses a keyword that we have not yet seen, explicit, which
we will explain shortly. First, let's understand what the constructor does. Note that it
uses a default argument (§7.3/127) for the second parameter. Thus, the constructor effectively
defines two constructors: One takes a single argument of type size_type
; the
other takes a size_type
and a const T&
. In both cases we call a version of create
that takes a size and a value. We'll assume that this function, which we'll write in §11.5/203,
will allocate enough memory to hold n
objects of type T
, and will give those elements the
initial value specified by val
. Our users will have supplied that value explicitly, or else
the default constructor for T
will have generated it using the rules outlined in §9.5/164 for
value-initialization.
Now let's understand a bit about the use of explicit
. This keyword makes sense
only in the definition of a constructor that takes a single argument. When we say that a
constructor is explicit, we're saying that the compiler will use the constructor only in
contexts in which the user expressly invokes the constructor, and not otherwise:
Vec<int> vi(100); // ok, explicitly construct the Vec from an int Vec<int> vi = 100; // error: implicitly construct the Vec (§11.3.3/199) and copy it to vi
Use of explicit
can be crucial in other contexts in which a constructor might be used, so
we will discuss it further in §12.2/213. For consistency with the standard vector
class,
we have made this constructor explicit even though none of our subsequent examples
in this chapter relies on this fact.
Following the convention used by the standard template classes, we want to provide type
names that our users can use, and that will hide the implementation details of how we
implement our class. Specifically, we need to provide typedef
s for the const
and
nonconst
iterator types, and for the type that we use to denote the size of a Vec
.
It turns out that the library containers also define another type, named value_type
,
that is a synonym for type of the objects that the container stores. Looking ahead, we will
want to add push_back
to class Vec
, so that users can dynamically grow their Vec
objects. If we also define value_type
, then users will be able to use back_inserter
(which depends on both push_back
and value_type
) to generate an output iterator
that can grow the Vec
.
The only hard part of defining these types is deciding what types to choose. As we've
seen, iterators are objects that navigate among the objects in a container and let us examine
their values. Often iterators are themselves of class type. For example, consider a
class that implements a linked list. A logical strategy for such a class would be to model a
list as a set of nodes, where each node contains a value and a pointer to the next node in
the list. The iterator for such a class would contain a pointer to one of these nodes and
would implement the ++
operator to follow the pointer to the next node in the list. Such
an iterator would have to be implemented as a class type.
Because we used an array to hold the elements of a Vec
, we can use plain pointers
as our Vec
iterator type. Each such pointer will point into the underlying data
array. As
we learned in §10.1/169, pointers support all the random-access-iterator operations. By
using a pointer as our underlying iterator type, we will provide full random-access properties,
which is consistent with the standard vector
class.
What about the other types? The type of value_type
is obvious: It must be T
. But,
what about the type that represents the size? We know that size_t
is big enough to hold
the number of elements in any array. Because we are storing Vec
s in an array, we can use
size_t
as the underlying type for Vec::size_type
. These decisions give us a class
that now looks like
template <class T> class Vec { public: typedef T* iterator; // added typedef const T* const_iterator; // added typedef size_t size_type; // added typedef T value_type; // added Vec() { create(); } explicit Vec(size_type n, const T& val = T()) { create(n, val); } // remaining interface private: iterator data; // changed iterator limit; // changed };
In addition to adding the appropriate typedef
s, we've also updated the class to use our
new types. By using the same names inside the class that we defined with our typedef
declarations, we make our code more readable and ensure the code will not get out of
sync if we subsequently change one of these types.
We said that our users should be able to call size
to find out how many elements are in the Vec
and
to use the index operator to access the elements in the Vec
. For example,
for (i = 0; i != vs.size(); ++i) cout << vs[i].name();
From this usage we can see that the size
function should be a member of class Vec
, and
that we'll need to define what it means to use the subscript operator, []
, on a Vec
. The
size
function is easiest: It takes no argument and should return the number of elements
in the Vec
as a Vec::size_type
. Before we define the index operation, we need to
know a bit more about how overloaded operators work.
We define an overloaded operator much as we define any other function: It has a name, takes arguments, and specifies a return type.
We form the name of an overloaded operator by appending the operator symbol to the
word operator. Thus, the function we need to define will be called operator[]
.
The kind of operator—whether it is a unary or binary operator—is part of what determines how many parameters the corresponding function has. It the operator is a function that is not a member, then the function has as many arguments as the operator has operands. The first argument is bound to the left operand; the second is bound to the right operand. If the operator is defined as a member function, then its left operand is implicitly bound to the object on which the operator is invoked. Member operator functions, therefore, take one less argument than the operator indicates.
In general, operator functions may be member or nonmember functions. However, the
index operator is one of a handful of operations that must be member functions. When
our user writes an expression such as vs[i]
, that expression will call the member named
operator[]
of vs
, passing i
as its argument.
We know that the operand must be an integral type large enough to denote the last
element in the largest possible Vec
, and that this type is Vec::size_type
. What
remains is to decide what type the index operator should return.
If we give it a bit of thought, we'll conclude that we should return a reference to the
element stored in the Vec
. Doing so will allow users to write through the index as well as
read from it. Although our sample program uses the index only to read a value from vs
,
it is reasonable to expect that users will also want write access to the elements. With this
analysis complete, we can update our class appropriately:
template <class T> class Vec { public: typedef T* iterator; typedef const T* const_iterator; typedef size_t size_type; typedef T value_type; Vec() { create(); } explicit Vec(size_type n, const T& val = T()) { create(n, val); } // new operations: size and index size_type size() const { return limit - data; } T& operator[](size_type i) { return data[i]; } const T& operator[](size_type i) const { return data[i]; } private: iterator data; iterator limit; };
The size
function calculates the number of elements in the Vec
by subtracting the pointers
that delimit the array that holds our values. Remember from §10.1.4/175 that subtracting
two pointers yields the number of elements apart the locations are to which the
pointers refer (a value of type ptrdiff_t
). Returning that value from the size
function
converts it to size_type
, the function's return type, which is a synonym for size_t
(§10.1.3/174). Taking the size
of a Vec
doesn't change the Vec
, so we declare size
as a
const
member function. Doing so lets us take the size
of a const Vec
.
The index operator finds the corresponding position in the underlying array and
returns a reference to the element. By returning a reference, we allow the user to use the
index operation to change the values that are stored in the Vec
. This ability to write to
the element implies that we need two versions: one for const Vec
objects, the other for
nonconst
objects of type Vec
. Note that the const
version returns a reference to
const
. Doing so ensures that users may use the index only to read the Vec
, not to write
to it. It is worth noting that we still return a reference, rather than returning a value, for
consistency with the standard vector
. The reason to return a reference is that if the
objects stored in the container are large, it is more efficient to avoid copying them.
It may be surprising that we can overload the index operator, because it appears that
both argument lists are the same; each appears to take a single parameter of type
size_type
. However, every member function, including each of these operators, takes
an implicit parameter, which is the object on which it operates. Because the operations
differ regarding whether that object is const
, we can overload the operation.
Next, we need to consider the functions that return iterators. Our specification called for
us to implement the begin
and end
operations, which return an iterator positioned at
the beginning and one past the end of the Vec
respectively:
template <class T> class Vec { public: typedef T* iterator; typedef const T* const_iterator; typedef size_t size_type; typedef T value_type; Vec() { create(); } explicit Vec(size_type n, const T& val = T()) { create(n, val); } T& operator[](size_type i) { return data[i]; } const T& operator[](size_type i) const { return data[i]; } size_type size() const { return limit - data; } // new functions to return iterators iterator begin() { return data; } // added const_iterator begin() const { return data; } // added iterator end() { return limit; } // added const_iterator end() const { return limit; } // added private: iterator data; iterator limit; };
We offer two versions of the begin
and end
operations, which are overloaded based on
whether the Vec
is const
. The const
versions return const_iterator
s, so our users
will be able to read but not modify the Vec
elements through the iterator.
At this point, our Vec
class is still pretty basic, but the essentials are in place. In fact, if
we add only a few more operations, such as push_back
and clear
, we could use this
class instead of the standard vector
for all the examples in this book. Unfortunately,
though, our Vec
class fails to meet the vector
specification in some critically important
ways, which we must now address.