Class ShapeFactory
Factory used to create shapes.
Inheritance
Implements
Namespace: Core2D.Editor.Factories
Assembly: Core2D.dll
Syntax
public sealed class ShapeFactory : object, IShapeFactory
Constructors
| Improve this Doc View SourceShapeFactory(IServiceProvider)
Initializes a new instance of the ShapeFactory class.
Declaration
public ShapeFactory(IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | serviceProvider | The service provider. |
Explicit Interface Implementations
| Improve this Doc View SourceIShapeFactory.Arc(IPointShape, IPointShape, IPointShape, IPointShape, Boolean, Boolean)
Creates a new instance of the IArcShape.
Declaration
IArcShape IShapeFactory.Arc(IPointShape point1, IPointShape point2, IPointShape point3, IPointShape point4, bool isStroked, bool isFilled)
Parameters
| Type | Name | Description |
|---|---|---|
| IPointShape | point1 | The Point1 point. |
| IPointShape | point2 | The Point2 point. |
| IPointShape | point3 | The Point3 point. |
| IPointShape | point4 | The Point4 point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
Returns
| Type | Description |
|---|---|
| IArcShape | The new instance of the IArcShape. |
IShapeFactory.Arc(Double, Double, Double, Double, Double, Double, Double, Double, Boolean, Boolean)
Creates a new instance of the IArcShape.
Declaration
IArcShape IShapeFactory.Arc(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, bool isStroked, bool isFilled)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x1 | The X coordinate of Point1 point. |
| System.Double | y1 | The Y coordinate of Point1 point. |
| System.Double | x2 | The X coordinate of Point2 point. |
| System.Double | y2 | The Y coordinate of Point2 point. |
| System.Double | x3 | The X coordinate of Point3 point. |
| System.Double | y3 | The Y coordinate of Point3 point. |
| System.Double | x4 | The X coordinate of Point4 point. |
| System.Double | y4 | The Y coordinate of Point4 point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
Returns
| Type | Description |
|---|---|
| IArcShape | The new instance of the IArcShape. |
IShapeFactory.CubicBezier(IPointShape, IPointShape, IPointShape, IPointShape, Boolean, Boolean)
Creates a new instance of the ICubicBezierShape.
Declaration
ICubicBezierShape IShapeFactory.CubicBezier(IPointShape point1, IPointShape point2, IPointShape point3, IPointShape point4, bool isStroked, bool isFilled)
Parameters
| Type | Name | Description |
|---|---|---|
| IPointShape | point1 | The Point1 point. |
| IPointShape | point2 | The Point2 point. |
| IPointShape | point3 | The Point3 point. |
| IPointShape | point4 | The Point4 point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
Returns
| Type | Description |
|---|---|
| ICubicBezierShape | The new instance of the ICubicBezierShape. |
IShapeFactory.CubicBezier(Double, Double, Double, Double, Double, Double, Double, Double, Boolean, Boolean)
Creates a new instance of the ICubicBezierShape.
Declaration
ICubicBezierShape IShapeFactory.CubicBezier(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, bool isStroked, bool isFilled)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x1 | The X coordinate of Point1 point. |
| System.Double | y1 | The Y coordinate of Point1 point. |
| System.Double | x2 | The X coordinate of Point2 point. |
| System.Double | y2 | The Y coordinate of Point2 point. |
| System.Double | x3 | The X coordinate of Point3 point. |
| System.Double | y3 | The Y coordinate of Point3 point. |
| System.Double | x4 | The X coordinate of Point4 point. |
| System.Double | y4 | The Y coordinate of Point4 point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
Returns
| Type | Description |
|---|---|
| ICubicBezierShape | The new instance of the ICubicBezierShape. |
IShapeFactory.Ellipse(IPointShape, IPointShape, Boolean, Boolean, String)
Creates a new instance of the IEllipseShape.
Declaration
IEllipseShape IShapeFactory.Ellipse(IPointShape topLeft, IPointShape bottomRight, bool isStroked, bool isFilled, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| IPointShape | topLeft | The TopLeft corner point. |
| IPointShape | bottomRight | The BottomRight corner point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
| System.String | text | The shape text string. |
Returns
| Type | Description |
|---|---|
| IEllipseShape | The new instance of the IEllipseShape. |
IShapeFactory.Ellipse(Double, Double, Double, Double, Boolean, Boolean, String)
Creates a new instance of the IEllipseShape.
Declaration
IEllipseShape IShapeFactory.Ellipse(double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x1 | The X coordinate of TopLeft corner point. |
| System.Double | y1 | The Y coordinate of TopLeft corner point. |
| System.Double | x2 | The X coordinate of BottomRight corner point. |
| System.Double | y2 | The Y coordinate of BottomRight corner point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
| System.String | text | The shape text string. |
Returns
| Type | Description |
|---|---|
| IEllipseShape | The new instance of the IEllipseShape. |
IShapeFactory.Geometry(FillRule)
Creates a new instance of the IPathGeometry.
Declaration
IPathGeometry IShapeFactory.Geometry(FillRule fillRule)
Parameters
| Type | Name | Description |
|---|---|---|
| FillRule | fillRule | The path geometry fill rule. |
Returns
| Type | Description |
|---|---|
| IPathGeometry | The new instance of the IPathGeometry. |
IShapeFactory.Image(String, IPointShape, IPointShape, Boolean, Boolean, String)
Creates a new instance of the IImageShape.
Declaration
IImageShape IShapeFactory.Image(string path, IPointShape topLeft, IPointShape bottomRight, bool isStroked, bool isFilled, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | path | The image file path. |
| IPointShape | topLeft | The TopLeft corner point. |
| IPointShape | bottomRight | The BottomRight corner point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
| System.String | text | The shape text string. |
Returns
| Type | Description |
|---|---|
| IImageShape | The new instance of the IImageShape. |
IShapeFactory.Image(String, Double, Double, Double, Double, Boolean, Boolean, String)
Creates a new instance of the IImageShape.
Declaration
IImageShape IShapeFactory.Image(string path, double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | path | The image file path. |
| System.Double | x1 | The X coordinate of TopLeft corner point. |
| System.Double | y1 | The Y coordinate of TopLeft corner point. |
| System.Double | x2 | The X coordinate of BottomRight corner point. |
| System.Double | y2 | The Y coordinate of BottomRight corner point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
| System.String | text | The shape text string. |
Returns
| Type | Description |
|---|---|
| IImageShape | The new instance of the IImageShape. |
IShapeFactory.Line(IPointShape, IPointShape, Boolean)
Creates a new instance of the ILineShape.
Declaration
ILineShape IShapeFactory.Line(IPointShape start, IPointShape end, bool isStroked)
Parameters
| Type | Name | Description |
|---|---|---|
| IPointShape | start | The Start point. |
| IPointShape | end | The End point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
Returns
| Type | Description |
|---|---|
| ILineShape | The new instance of the ILineShape. |
IShapeFactory.Line(Double, Double, Double, Double, Boolean)
Creates a new instance of the ILineShape.
Declaration
ILineShape IShapeFactory.Line(double x1, double y1, double x2, double y2, bool isStroked)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x1 | The X coordinate of Start point. |
| System.Double | y1 | The Y coordinate of Start point. |
| System.Double | x2 | The X coordinate of End point. |
| System.Double | y2 | The Y coordinate of End point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
Returns
| Type | Description |
|---|---|
| ILineShape | The new instance of the ILineShape. |
IShapeFactory.Path(IPathGeometry, Boolean, Boolean)
Creates a new instance of the IPathShape.
Declaration
IPathShape IShapeFactory.Path(IPathGeometry geometry, bool isStroked, bool isFilled)
Parameters
| Type | Name | Description |
|---|---|---|
| IPathGeometry | geometry | The path geometry. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
Returns
| Type | Description |
|---|---|
| IPathShape | The new instance of the IPathShape. |
IShapeFactory.Point(Double, Double, Boolean)
Creates a new instance of the IPointShape.
Declaration
IPointShape IShapeFactory.Point(double x, double y, bool isStandalone)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x | The X coordinate of point. |
| System.Double | y | The Y coordinate of point. |
| System.Boolean | isStandalone | The flag indicating whether point is stand-alone shape. |
Returns
| Type | Description |
|---|---|
| IPointShape | The new instance of the IPointShape. |
IShapeFactory.QuadraticBezier(IPointShape, IPointShape, IPointShape, Boolean, Boolean)
Creates a new instance of the IQuadraticBezierShape.
Declaration
IQuadraticBezierShape IShapeFactory.QuadraticBezier(IPointShape point1, IPointShape point2, IPointShape point3, bool isStroked, bool isFilled)
Parameters
| Type | Name | Description |
|---|---|---|
| IPointShape | point1 | The Point1 point. |
| IPointShape | point2 | The Point2 point. |
| IPointShape | point3 | The Point3 point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
Returns
| Type | Description |
|---|---|
| IQuadraticBezierShape | The new instance of the IQuadraticBezierShape. |
IShapeFactory.QuadraticBezier(Double, Double, Double, Double, Double, Double, Boolean, Boolean)
Creates a new instance of the IQuadraticBezierShape.
Declaration
IQuadraticBezierShape IShapeFactory.QuadraticBezier(double x1, double y1, double x2, double y2, double x3, double y3, bool isStroked, bool isFilled)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x1 | The X coordinate of Point1 point. |
| System.Double | y1 | The Y coordinate of Point1 point. |
| System.Double | x2 | The X coordinate of Point2 point. |
| System.Double | y2 | The Y coordinate of Point2 point. |
| System.Double | x3 | The X coordinate of Point3 point. |
| System.Double | y3 | The Y coordinate of Point3 point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
Returns
| Type | Description |
|---|---|
| IQuadraticBezierShape | The new instance of the IQuadraticBezierShape. |
IShapeFactory.Rectangle(IPointShape, IPointShape, Boolean, Boolean, String)
Creates a new instance of the IRectangleShape.
Declaration
IRectangleShape IShapeFactory.Rectangle(IPointShape topLeft, IPointShape bottomRight, bool isStroked, bool isFilled, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| IPointShape | topLeft | The TopLeft corner point. |
| IPointShape | bottomRight | The BottomRight corner point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
| System.String | text | The shape text string. |
Returns
| Type | Description |
|---|---|
| IRectangleShape | The new instance of the IRectangleShape. |
IShapeFactory.Rectangle(Double, Double, Double, Double, Boolean, Boolean, String)
Creates a new instance of the IRectangleShape.
Declaration
IRectangleShape IShapeFactory.Rectangle(double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x1 | The X coordinate of TopLeft corner point. |
| System.Double | y1 | The Y coordinate of TopLeft corner point. |
| System.Double | x2 | The X coordinate of BottomRight corner point. |
| System.Double | y2 | The Y coordinate of BottomRight corner point. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
| System.Boolean | isFilled | The flag indicating whether shape is filled. |
| System.String | text | The shape text string. |
Returns
| Type | Description |
|---|---|
| IRectangleShape | The new instance of the IRectangleShape. |
IShapeFactory.Text(IPointShape, IPointShape, String, Boolean)
Creates a new instance of the ITextShape.
Declaration
ITextShape IShapeFactory.Text(IPointShape topLeft, IPointShape bottomRight, string text, bool isStroked)
Parameters
| Type | Name | Description |
|---|---|---|
| IPointShape | topLeft | The TopLeft corner point. |
| IPointShape | bottomRight | The BottomRight corner point. |
| System.String | text | The shape text string. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
Returns
| Type | Description |
|---|---|
| ITextShape | The new instance of the ITextShape. |
IShapeFactory.Text(Double, Double, Double, Double, String, Boolean)
Creates a new instance of the ITextShape.
Declaration
ITextShape IShapeFactory.Text(double x1, double y1, double x2, double y2, string text, bool isStroked)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x1 | The X coordinate of TopLeft corner point. |
| System.Double | y1 | The Y coordinate of TopLeft corner point. |
| System.Double | x2 | The X coordinate of BottomRight corner point. |
| System.Double | y2 | The Y coordinate of BottomRight corner point. |
| System.String | text | The shape text string. |
| System.Boolean | isStroked | The flag indicating whether shape is stroked. |
Returns
| Type | Description |
|---|---|
| ITextShape | The new instance of the ITextShape. |


Course Management System
Account Verify
Congratulations...
Account now is activated successfully, Please now and
Login
.


This is something that I just saw in one of the build. So if you activate expertise, this raises your AC and lowers your attack AB, but you can cast without any withdraws?
Kinda kool though...
thx CA.. _________________ DLA I was baptized with the Holy Spirit when I took Him by simple faith in the Word of God....
You can if the switch that prevents this isn't enabled in the module. _________________ The world is grey, the mountain's old The forge's fire is ashen and cold No harp is wrung, no hammer falls The darkness dwells in Druin's halls...
~ Summoning - Khazad-Dúm
Yeah, it's basically free AC (and is considered by many to be an exploit - myself included). If your character stops casting or moves (other than to finish casting a spell), Expertise will switch off. You also cannot activate Expertise with Defensive Casting Mode (and I don't think you can Counterspell with Expertise on either).  The ship is... drafty and damp; I complain but... nobody listens.


Notice: blueimp Gallery is a completely rewritten, much improved image gallery, replacing this version.
jQuery Image Gallery Demo
jQuery Image Gallery is an extension to the Dialog component of jQuery UI, to ease navigation between a set of gallery images.
It features mouse and keyboard navigation, transition effects, fullscreen mode and slideshow functionality.


Inherited by StatusCodes.
A class for defining an enumeration. Since the __get()
method is overridden by this class, you can access the description of a particular value using property access on an instantiated instance of this class (e.g., $enumObj->0
).
Constructor.
- Parameters
-
| array | $items | An associative array of integer values to string descriptions of each value. For example, an enumeration of colors might be defined with this associative array: |
array(0 => "Red",
1 => "Green",
2 => "Blue",
3 => "White",
4 => "Black")
| add |
( |
|
$value, |
|
|
|
$description |
|
) |
| |
Adds the specified value to this enumeration.
- Parameters
-
| integer | $value | The value to be added to this enumeration. |
| string | $description | The string description to associate with this value. |
Returns all of the integer values of this enumeration.
- Returns
- array The values of this enumeration.
The documentation for this class was generated from the following file:


I am experienced in leveraging agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Determined to finish projects, always looking for new projects, I like to keep busy.
I am an experienced web developer with very well-crafted skills and have designed websites / templates / pages for many different clients over the years, such as non-profit organizations, engineering firms and even local politicians. I am also skilled in working with databases and I have even created my own CMS (Content Management System) in order to make it easier for administrators to manage and modify the contents of their website. I am also experienced with web hosting software such as Apache, and the back end, such as DNS and other architecture.
Mastering the skills of the Mechanical, Electrial and Plumbing Engineering Trade. Working with other apprentices and employees both in the office and out in the field to advance my skills in the trade.
Worked with customers in the Home Theater, Connected Car, and Appliances departments to ‘complete the solution’ for what they need and show them what is possible.
Maintain and repair electronics boards for railroad cars, oil/maintain train motors and gears, fundraising for and assisting with the restoration of Steam Engine 39, work with Apache and various hosting services to maintain a reliable website, designed Content Management System (CMS) for easy and dynamic updates of various pages throughout the website, also worked with various social media sites to promote the museum's public relations.
Assist school staff with technical Issues including: Diagnosing and repairing 3D printers, fixing technical issues with school equipment including: SMART Boards, Sound Board, Lighting Board, Speaker Systems and A/V Controls, Internet Connectivity Support, Robotics Technical Support, Media Equipment troubleshooting (Microphones, Video Production Streaming, Encoding & Rendering).
Mentored students aged 7 to 17 years old on programming concepts and issues/errors, using languages including Java, Python, JavaScript, Rust, Go and HTML/CSS.
Developed an Android Application with other students working with Google Maps APIs to make a map of the rooms in all of the Computer Science buildings throughout the campus
Starting in Fall of 2020
Graduating in ? of 2020


SHOW
Filter
Please enter the master secret to show services.
Iterations:
–
+
ADD NEW SERVICE
EXPORT ENCRYPTED CONFIG
RE-DERIVE


I had a bit of a throw-away line in Functional Wish Fulfillment:
Kind of like map, but kind of different.
And I tossed a call to map
, unexplained, in the middle of the parsing code. I
got a little ahead of myself there. Sorry about that. Cocoa has no map
. Maybe
not everyone coming to Swift has a long history with this amazing little
function. In a field where monads get all the press, it’s time to step back and
talk about the humble map.
After years of begging for a map
function in Cocoa, here comes Swift with
three different versions built-in:
/// Haskell's fmap for Optionals.
func map<T, U>(x: T?, f: (T) -> U) -> U?
/// Return an `Array` containing the results of mapping `transform` over `source`.
func map<C : CollectionType, T>(source: C, transform: (C.Generator.Element) -> T) -> [T]
/// Return an `Array` containing the results of mapping `transform` over `source`.
func map<S : SequenceType, T>(source: S, transform: (S.Generator.Element) -> T) -> [T]
Plus it has map
methods on Array
, Dictionary
, Optional
, Range
,
Slice
, and a bunch of other classes.
Now I know that the very first comment in the Swift header mentions both
“Haskell” and a non-word “fmap,” but trust me, most uses of map
aren’t complex
at all. Most of the time, it’s just the world’s simplest for-loop.
Let’s take a really common pattern you’ve probably written dozens of times (if not in Swift, than in every language you’ve ever worked in):
let domains = ["apple.com", "google.com", "robnapier.net"]
var urls = [NSURL]()
for domain in domains {
urls.append(NSURL(scheme: "http", host: domain, path: "/"))
}
// urls => [http://apple.com/, http://google.com/, http://robnapier.net/]
In a generic language like Swift, “pattern” means there’s a probably a function
hiding in there, so let’s pull out the part that doesn’t change and call it
map
:
// Let's replace String with T and NSURL with U
// and let's pull out the NSURL(...) and call it transform()
func map<T, U>(source: [T], transform: T -> U) -> [U] {
var result = [U]()
for element in source {
result.append(transform(element))
}
return result
}
// And here's our loop:
let urls = map(domains, { NSURL(scheme: "http", host: $0, path: "/") })
// Or we can use Array's method (implementation not shown)
let urls = domains.map{ NSURL(scheme: "http", host: $0, path: "/") }
// urls => [http://apple.com/, http://google.com/, http://robnapier.net/]
So map
replaces the for-loop when you have data in one form and want it in
some other form.
Keeping what you want
Let’s think about another really common for-loop. You have a bunch of items, but
you only want some of them. For example, maybe you want to filter out
NSNotFound
.
let values = [1, 1, 2, NSNotFound, 3]
var found = [Int]()
for value in values {
if value != NSNotFound {
found.append(value)
}
}
// found => [1, 1, 2, 3]
Again, we wind up with this really generic for-loop. Let’s factor out the common part.
// Replace Int with T, and instead of hard-coding the test, pass a function
// that takes an element and returns whether to include it.
func filter<T>(source: [T], includeElement: T -> Bool) -> [T] {
var found = [T]()
for value in source {
if includeElement(value) {
found.append(value)
}
}
return found
}
// Filter it with a function
let found = filter(values, { $0 != NSNotFound })
// or with Array's method (implementation not shown)
let found = values.filter{ $0 != NSNotFound }
// found => [1, 1, 2, 3]
And again we replace our cut-and-paste for-loop with a reusable function that captures the goal. We save some code, but it’s more than that. We can compose filters and maps to create more interesting things in highly readable ways. For example, to extract simple http URLs from text:
func embeddedURLs(text: String) -> [NSURL] {
return text
.componentsSeparatedByString(" ")
.filter{ $0.hasPrefix("http://") }
.map{ NSURL(string: $0) }
}
embeddedURLs("This text contains a link to http://www.apple.com and other stuff.")
// => ["http://www.apple.com"]
Or see this downcasting example from StackOverflow.
The goal of using map
and filter
this way is to make your code easier to
read, understand, and debug. It gets the boilerplate out of the way and leaves
you with the key parts of what you’re trying to do.
Map is what for does
Even though I’ve discussed map
in terms of for
, they’re quite different.
map
is. for
does. Remember the first example:
var urls = [NSURL]()
for domain in domains {
urls.append(NSURL(scheme: "http", host: domain, path: "/"))
}
In this code, urls
is mutated by a series of append
calls until it contains
the values we want. This code says how to construct urls
. On the other hand:
let urls = domains.map{ NSURL(scheme: "http", host: $0, path: "/") }
In this code, urls
is the mapping of domains
to NSURL
constructors. This
code doesn’t require any specific implementation of map
. In principle, urls
could be constructed lazily the first time it’s read, or each element could be
lazily constructed when requested. The mapping could be performed in parallel or
in reverse order. It could be performed once and cached, or recomputed every
time it’s accessed. In principle, we don’t care. As long as the mapping only
depends on its inputs, and as long as there are no side effects, we will always
get the same result. This is the heart of good functional programming. We
define urls
and let the system worry about how to compute it.
In practice, life is seldom quite that simple, and the implementation does
matter for performance. Still, a functional approach makes it much easier to
change our mind about the implementation. For example, in Swift today, we can
switch from immediate mapping to lazy mapping by just adding lazy()
like this:
let urls = lazy(domains).map{ NSURL(scheme: "http", host: $0, path: "/") })
Compare that to the changes you’d have to make to your for
code to make this a
lazy computation. One can easily imagine the implementation of a parallel()
modifier. By focusing our code on what things are, rather than how we construct
them, swapping out one implementation for another is much simpler.
It’s all about the types
In Wish Driven Development, our wish generally takes the form of a function
signature. So it’s very important that you learn to read and think about
function signatures, especially signatures that include functions as parameters.
Let’s look at map
again:
func map<T, U>(source: [T], transform: T -> U) -> [U]
Let’s strip away some syntax noise to get to the heart of what’s going on:
map([T], T -> U) -> [U]
Or maybe you’d rather read it this way:
map([From], From -> To) -> [To]
This takes an array of “something,” and a function that can convert one “something” into a “something else,” and returns an array of “something else.” So you should use this function when you have an array of some type, and you want an equal-sized array of some other type, and you know how to convert a single element of the first type into the second type.
Let’s look at filter
in the same way:
filter([T], T -> Bool) -> [T]
So this takes an array of something, and a function that returns true or false based on one of them, and returns an array of the same kind of things.
Even if I took away the names map
and filter
, you should have some guess
what these functions do, just based on what they take and what they return.1
Let’s go back to the Swift header for moment. By this time, the map<C:
CollectionType, T>
function and the map<S: SequenceType, T>
function should
make some sense. They’re just more generic versions of our array-only map
. But
there’s one more version that seems different than the others:
func map<T, U>(x: T?, f: (T) -> U) -> U?
What does that mean? It takes an optional of something, and a function that can convert “something” into “something else” and returns an optional of “something else.” That sounds a lot like our array version of map, if you just replace the word “array” with “optional.” Can we do that? Does that even make sense?
Let’s strip away some extra syntax and sugar so we can get a clearer view of these signatures:
map(Array<T>, T -> U) -> Array<U>
map(Optional<T>, T -> U) -> Optional<U>
That’s really, really interesting (at least to me), but if we go any deeper down this rabbit hole, I’m going to have to start using mathy words.2 You came here to learn practical applications. So let’s crawl back up a step.
So what does it mean to “map” over an optional? Well, mapping over an array
meant generating one element for every element in the array. Why not the same
for optionals? If there’s something inside (Some
), map it, if not, return
None
. Let’s write that:
func map<T, U>(x: T?, f: T -> U) -> U? {
switch x {
case .Some(let value): return .Some(f(value))
case .None: return .None
}
}
If that sounds a little like optional-chaining (?.
), then you’re getting it.
Optional-chaining is just a more method-friendly version of map
.
So if we can map over an array, and we can map over an optional, can we map over
anything else? How about the Result
type we built in
Functional Wish Fulfillment?3
func map<T, U>(x: Result<T>, f: T -> U) -> Result<U> {
switch x {
case .Success(let box): return .Success(Box(f(box.unbox)))
case .Failure(let err): return .Failure(err)
}
}
Again, focus on learning to read the types:
map(Result<T>, T -> U) -> Result<U>
Given a Result
of one type (T
), and function that can convert that type into
another type (U
), I can get a Result
of that second type.
Given an F<>
that contains T
and a function that maps a T
to a U
, I can
use map
to convert F<T>
into F<U>
.
That’s starting to sound like math, so maybe we’ll leave it there before we go too far.
Thoughts till next time
We dug pretty deep in map
here, breezed through filter
, and started to think
about the power of functions to separate intent from implementation. We touched
on the importance of types in understanding functions. And then we stumbled
across some interesting similarities in Array
and Optional
and Result
that
expanded our mappable world.
If you’re like I was the first time I walked down this road, your head is
spinning just a little bit right now, but maybe a few things are starting to
make sense. It’s worth playing with these things in a playground. Look in your
code for some for-loops and see if you could convert them to map
or filter
instead. Don’t force it. The goal isn’t to use fancy library functions, and the
goal isn’t to make your code short. The goal is to make your code clear. Play
with formatting and see what makes your point most obvious. Try creating helper
functions. Refactor. Try again.
Soon we’ll explore some more of these transforming functions and see what they can do for us. Until then, stop mutating. Evolve.
-
In Haskell, which has a pretty consistent syntax, you can actually search the documentation for functions that transform the types you want. That turns out to be harder in Swift because of parameter names and syntactic sugar, but the idea of reading types is just as important. ↩
-
That word is “functor” if you’re curious. A functor is a structure you can map over. It’d probably be clearer if we called it “mappable.” ↩
-
Remember that “box” and “unbox” are just because of a compiler limitation in Beta6. ↩


{{ define "main" }} {{ if ne .Params.type "simple" }}
This is an archived post which was originally published at {{ index (findRE "^(?:https?:\\/\\/)?(?:[^@\\/\\n]+@)?(?:www\\.)?([^:\\/?\\n]+)" .Params.canonical) 0 }} .
{{ end }} {{ end }} {{ end }}I love hearing feedback on my posts. You should head over to Twitter and let me know what you think!
Spotted a mistake? Why not suggest an edit!
{{ if index .Params "comments" | default false }} {{ template "_internal/disqus.html" . }} {{ end }} {{ end }} {{ end }} {{ end }}


I am currently reading—or peering at, with my iffy eyes—The Book Of Lost Books by Stuart Kelly (2005). Among other things I have learned is that we have lost a work by the ancient polymath Callimachus (c.320—c.340 BCE) entitled On The Changes Of The Names Of Fish. I, for one, would love to read it, and I suspect it inspired a dream I had, where I came upon a copy of On The Stiffness Or Otherwise Of Bolts Of Cloth by Rotting Engineering Equipment Jr.


Version 0.01 Beta
MEL is a C++11, header-only library, being developed with the goal of creating a light weight and robust framework for building parallel applications on top of MPI. MEL is designed to introduce no (or minimal) overheads while drastically reducing code complexity. It allows for a greater range of common MPI errors to be caught at compile-time rather than during program execution where it can be far more difficult to debug what is going wrong.
A good example of this is type safety in the MPI standard. The standard does not dictate how many of the object types should be implemented leaving these details to the implementation vendor. For instance, in Intel MPI 5.1 MPI_Comm
objects and many other simple types are implemented as indexes, typedef int MPI_Comm
, leaving the implementation to use these indexes to manage the real objects internally. A drawback with this approach is it causes compile time type-checking of function parameters to not flag erroneous combinations of variables. The common signature MPI_Send(void*, int, MPI_Datatype, int, int, MPI_Comm)
is actually seen by the compiler as MPI_Send(void*, int, int, int, int, int)
, allowing any ordering of the last five variables to be compiled as valid MPI code, while causing catastrophic failure at run-time. In contrast, OpenMPI 1.10.2 implements these types as structs which are inherently type-safe.
With MEL we aim to provide a consistent and unified function syntax that allows all MPI distributions to behave in a common and predictable way; while also providing some higher-level functionality that is not available from the MPI standard such as deep-copy, mutexes, RMA shared memory synchronization, and more.
We plan to keep MEL in active development and hope that the research community will join us as we continue to grow the features and capabilities encompassed within the project. MEL is Open-Source and available on Github under the MIT license at: https://github.com/CS-Swansea/MEL .
Todo
- Add Distributed Graph Topology functions.
- Add overloads for p2p/collective communications for transmitting std::array/std::vector by start/end iterators.
- Improve error handler implementation. A rough version is currently in place.
- Implement ranged-mutexes.


Summary
Complicated explanations aside, this is everything we added to make the holy grail layout using flexboxes:
html {
height: 100%;
}
body {
display: flex;
flex-direction: column;
min-height: 100%;
}
main {
flex-grow: 1;
display: flex;
}
article {
flex-grow: 1;
}
nav, aside {
flex-grow: 0;
flex-basis: 25rem;
flex-shrink: 0;
}
nav {
order: -1;
}
Holy Grail Layout
The Holy Grail Layout is a classic CSS problem with various solutions presented over time. If you’re unfamiliar with the history of the Holy Grail layout, this A List Apart article offers a pretty good summary and links to a few of the more well-known solutions.
At its core, the Holy Grail Layout is a page with a header, footer, and three columns. The center column contains the main content, and the left and right columns contain supplemental content like ads or navigation.
Most CSS solutions to this problem aim to meet a few goals:
- They should have a fluid center with fixed-width sidebars.
- The center column (main content) should appear first in the HTML source.
- All columns should be the same height, regardless of which column is actually the tallest.
- They should require minimal markup.
- The footer should "stick" to the bottom of the page when content is sparse.
- Unfortunately, because of the nature of these goals and the original limitations of CSS, none of the classic solutions to this problem were ever able to satisfy all of them.


{{< layout}} {{$pageTitle}}Compare your old and new photos{{/pageTitle}} {{$header}}
We'll compare your photo with the one in your old passport.
You'll need to get your photo signed by somebody else to confirm that it's you. To do this, you'll need to renew your passport a different way.


"Yet Britain won her proudest bays in good Queen Bess's glorious days!". |
| The Lord Chancellor | Mr. George Grossmith |
| Earl of Mountararat | Mr. Rutland Barrington |
| Earl Tolloller | Mr. Durward Lely |
| Private Willis, of the Grenadier Guards | Mr. Manners |
| Strephon, An Arcadian Shephard | Mr. R. Temple |
| Queen of the Fairies | Miss Alice Barnett |
| Iolanthe, A Fairy, Strephon's Mother | Miss Jessie Bond |
| Celia, a Fairy | Miss Fortescue |
| Leila, a Fairy | Miss Julia Gwynne |
| Fleta, a Fairy | Miss Sybil Grey |
| Phyllis, An Arcadian Shepherdess and Ward in Chancery |
Miss Leonora Braham |
Chorus of Dukes, Marquises, Earls, Viscounts, Barons, and Fairies |
| Original Costumes |
| Jessie Bond as Iolanthe | George Grossmith as the Lord Chancellor |
| Alice Barnett as the Queen of the Fairies | Durward Lely and Rutland Barrington as Earls Tolloller and Mountararat |
| Return to the Iolanthe main page |
| Check out the history of Iolanthe in Australia. |
| Check out these other historic photos: |


This form will add you to our mailing list so you will receive updates for meetings and events! Remember to also join our discord!
Join our Discord server!
Reminder: Change your server nickname to your first name and last initial after joining.
We participate in the American Computer Science League!
ACSL is a yearly contest that consists of a set of 4 contests covering both computer science theory and problem solving skills. Each contest has a written portion and a programming portion, and the latter can be solved in any language you want. You can participate in the Junior, Intermediate, or Senior leagues.
Practice for the contests can be found
here
Contest Dates:
Contest #1: Friday, December 21, 2018
Contest #2: Friday, February 1, 2019
Contest #3: Friday, March 8, 2019
Contest #4: Friday, April 19, 2019
All-Star Contest: Saturday, May 25, 2018 (Memorial day weekend)
We participate in CyberPatriot
CyberPatriot is a systems administration competition involving cybersecurity and networking. People of all experience levels are welcome to participate.
We will practice a lot and we reccomend that everyone shows up for the practice. Additionally, We have our first cyberpatriot competition on October 25th in
Mr. Larson's room. If you have signed up and cannot attend, please provide a valid excuse. Join and check the discord server for any last minute updates.
Sign up
here, ASAP. Spots go fast!
Contest Dates
GET STARTED BY CREATING AN ACCOUNT HERE
USACO is a set of contests split into Bronze, Silver, Gold, and Platinum divisions, where you start at Bronze and automatically get promoted up as you solve problems. These problems get VERY hard, and focus on performance. You also get a strict time limit to solve them. USACO is also free to participate in, and you only need to create an account online to start.
The first contest is from December 15-18, 2018.
Visit their website here
Knowledge worth sharing.
Want to share what you know with others? Contact us
We love helping others!
For example, we helped to add functionalities to the website of Optimistic Club
If you, non-profit individual or orgnization, would like some help, check out the contact information
How to use Comuper Science in the real world.
Learn how we can use Computer Science in everyday life and prepare ourselves for the future


Some of the classes in TRSL need random numbers. If a class needs only one random number (e.g. trsl::is_picked_systematic), it is generally possible to provide it directly. It's then up to the user to take care of the random generator.
Another possibility is to use TRSL-internal random capabilities, implemented using system random number generators. By default, the std::rand
function is used.
The std::rand
generator that comes with BSD systems (including MacOS X) has slight issues — e.g. some bits of the returned numbers are not usable. However, BSD systems provide a second, better random number generator through a function named ::random
. This function will be used instead of std::rand
if TRSL_USE_BSD_BETTER_RANDOM_GENERATOR is defined. In that case, seeding should be done through ::srandom
. Note that in GNU/Linux systems, both std::rand
and ::random
use the same generator.
When relying on TRSL-internal std::rand/::random
calls, the user is still responsible for seeding the random number generator.


You can contact Developer through following medium:
Email at<EMAIL_ADDRESS>Contact number:<PHONE_NUMBER>21


JavaScript is disabled on your browser.
Skip navigation links
Overview
Package
Class
Tree
Deprecated
Index
Help
Prev Letter
Next Letter
Frames
No Frames
All Classes
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
O
ObjectFile
<
T
> - Class in
com.ltsllc.miranda.server
Created by Clark on 2/18/2017.
ObjectFile()
- Constructor for class com.ltsllc.miranda.server.
ObjectFile
ONE_DAY
- Static variable in class com.ltsllc.miranda.property.
MirandaProperties
ONE_HOUR
- Static variable in class com.ltsllc.miranda.property.
MirandaProperties
ONE_MINUTE
- Static variable in class com.ltsllc.miranda.property.
MirandaProperties
ONE_MONTH
- Static variable in class com.ltsllc.miranda.property.
MirandaProperties
ONE_WEEK
- Static variable in class com.ltsllc.miranda.property.
MirandaProperties
ONE_YEAR
- Static variable in class com.ltsllc.miranda.property.
MirandaProperties
openFile(String)
- Method in class com.ltsllc.miranda.writer.
TestWriter
Operation
- Class in
com.ltsllc.miranda.operations
Created by Clark on 4/16/2017.
Operation(String, BlockingQueue<Message>, Session)
- Constructor for class com.ltsllc.miranda.operations.
Operation
operationComplete(ConnectFuture)
- Method in class com.ltsllc.miranda.mina.
FutureListener
OperationReadyState
- Class in
com.ltsllc.miranda.operations
Created by Clark on 4/16/2017.
OperationReadyState(Consumer)
- Constructor for class com.ltsllc.miranda.operations.
OperationReadyState
OperationState
- Class in
com.ltsllc.miranda.operations.events
Created by Clark on 6/11/2017.
OperationState(Operation)
- Constructor for class com.ltsllc.miranda.operations.events.
OperationState
OPTION_DEBUGGING_MODE_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_DEBUGGING_MODE_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_KEYSTORE_FILE_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_KEYSTORE_FILE_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_KEYSTORE_PASSWORD_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_KEYSTORE_PASSWORD_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_LOG4J_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_LOG4J_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_LOGGING_LEVEL_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_LOGGING_LEVEL_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_MODE_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_MODE_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_PROPERTIES_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_PROPERTIES_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_TRUSTORE_FILE_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_TRUSTORE_FILE_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_TRUSTORE_PASSWORD_LONG
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OPTION_TRUSTORE_PASSWORD_SHORT
- Static variable in class com.ltsllc.miranda.commadline.
MirandaCommandLine
OTHER_CONTENTS
- Static variable in class com.ltsllc.miranda.property.
TestMirandaProperties
OTHER_VALUE
- Static variable in class com.ltsllc.miranda.property.
TestMirandaProperties
OwnerQueryMessage
- Class in
com.ltsllc.miranda.subsciptions.messages
Created by Clark on 4/12/2017.
OwnerQueryMessage(BlockingQueue<Message>, Object, String)
- Constructor for class com.ltsllc.miranda.subsciptions.messages.
OwnerQueryMessage
OwnerQueryResponseMessage
- Class in
com.ltsllc.miranda.subsciptions.messages
Created by Clark on 4/12/2017.
OwnerQueryResponseMessage(BlockingQueue<Message>, Object, String, List<String>, String)
- Constructor for class com.ltsllc.miranda.subsciptions.messages.
OwnerQueryResponseMessage
ownsTopic(Topic)
- Method in class com.ltsllc.miranda.operations.events.
NewEventOperationVerifyingTopic
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
Skip navigation links
Overview
Package
Class
Tree
Deprecated
Index
Help
Prev Letter
Next Letter
Frames
No Frames
All Classes


TEST METHOD: Soil Sampling for contamination studies
Updated: 25 February 2003
RISK ASSESSMENT
Assess the Quality, Safety and Environmental risks of each step.
OVERVIEW
When land use is to be changed, the soil is tested for contamination as part of the process of determining its end use. The following guidelines shall be adhered to when sampling soils as part of a contaminant survey.
TASK SAFETY REQUIREMENTS
Safety boots are mandatory
Observe the requirements of the Chemical Hygiene Plan
Use appropriate PPE for the contaminant suspected. This may include disposable overalls, gloves, overshoes and respirators.
SPECIFIC JOB STEPS |
RISK ASSESSMENT |
RISK CONTROL |
| Select appropriate sample containers and transportation materials. | Don’t know what type of bottle is appropriate, or transport temperature and holding time requirements? | Refer to Sample collecting, handling and transporting |
| Samples should be collected in such a manner so as to best characterize the extent of contamination of the soil in question. There is no specific number or type of samples which will apply to all situations and best judgment will have to be used in conjunction with guidance from the literature. | What literature? | Refer to the field method bibliography. |
| The type of sample, grab or composite, will vary depending upon the constituent being identified. While grab samples come from one location, composites come from several locations and are joined to form one sample. When sampling for non-volatiles or semi-volatiles, several composite samples are preferred, with confirmatory grab samples. | Possible loss of volatiles in composite samples. | When volatiles are in question, care must be taken when collecting composite samples to minimize the loss of volatiles during handling. In order to minimize handling of volatiles, several grab samples are preferred, with confirmatory composite samples. |
| A. Tank PitIf there is a question as to the extent of residual contamination, or if comprehensive documentation is necessary, a tank pit may be sampled for laboratory analysis. A total of five samples should be taken from the excavation. One composite sample from each of the side walls at a distance approximately one third up from the bottom of the pit. Several samples should also be collected to form one composite sample from the bottom of the pit. Any remaining samples should be grab samples from areas with greater potential for contamination such as stained soils, adjacent to a corrosion hole, opposite a manway, or opposite a tank opening. | From how deep should the samples be taken? | All samples shall be taken no less than 15 centimeters below the exposed surface being sampled. Samples for compositing should be taken from random locations on the floor and walls of the tank pit. |
| B. Soil PileThe number of samples required for an excavated pile will be related to the quantity of soil stockpiled. The table at the end of this instruction can be used as a guide in determining the appropriate number of samples. Samples shall be collected in accordance with proper sample collection techniques. All samples must be collected in glass containers with air-tight sealable tops. | Where in the pile should be sampled? | Best judgment is needed to determine the most appropriate sampling locations. The objective of the sampling is to characterize the extent of contamination of the pile. Consideration should be given to how the soil was stockpiled. Is the most contaminated soil toward the top? Are areas visibly contaminated? How high and how long is the pile? It may be preferable to divide the pile into manageable segments. Samples should be taken from within the pile. Surface soil should not be used as sampling material. |
| C. Non-Excavated (Broadacre) Soils Treatment of non-excavated soil is similar to soil piles except that the contamination may spread over a wide area. It differs, however, in that the depths of the contaminated zone are varied. The sampling locations and depths are best laid out in a replicable grid. | How many samples are required? | For small areas (less that 10 hectares) use 16 sampling locations per hectare. For larger sites refer to the NEPM for Assessment of Contaminated Sites, see field method bibliography. |
| Sample collection.Determine sample locations by tape or GPS and record on a sample location plan.Use earthmoving equipment, drills, augurs or hand equipment as appropriate to excavate the area of investigation. Then use stainless steel equipment (spade, trowel etc) to obtain a clean sample. | ||
| Place sample either directly into a sampling bottle if testing for volatiles, or into a mixing tray if sampling for metals. Place into transportation container. Record sample details on a chain of custody form, as specified in SFM2-159 Collecting, Preparing, Storing &Transporting Samples. Include a unique sample identifier, location, container type and requested analysis. | Some metals such as mercury may be present in particulate or droplet form, not evenly distributed in the sample. The laboratory receiving them may sample a ‘clean’ part of the sample, missing the contaminant or getting unrepresentative readings. | Mix sample in tray well, to distribte the contaminant evenly, so that the laboratory may analyse a representative sample. Transfer to sample bottle. |
| Wash all equipment between sampling locations. Dry on clean paper towels. Earthmoving equipment only needs the loose dirt removing from it as smaller sampling holes are made in the exposed soil surface by the smaller stainless steel equipment. | Cross-contamination | Wash equipment using three buckets. One with phosphate-free laboratory detergent, one with tap water and one with distilled water. Use plastic scrubbing brushes in the first two buckets. The brushes MUST STAY IN THEIR RESPECTIVE BUCKETS so as not to transfer contaminants. |
| After sampling, return any excess soil to the excavation. Washing water, waste paper towels and any disposable PPE shall be returned to the laboratory for disposal as contaminated waste |
Recommended Number of Soil Pile Samples
CONTAMINANT: |
SEMI-VOLATILES |
VOLATILES |
||
SAMPLE TYPE: |
Grab |
Composite |
Grab |
Composite |
SOIL QUANTITY (m 3): |
||||
0-50 |
1 |
1 |
1 |
1 |
50-100 |
1 |
2 |
2 |
1 |
100-200 |
1 |
3 |
3 |
1 |
200-300 |
1 |
4 |
4 |
1 |
300-400 |
2 |
4 |
4 |
2 |
400-500 |
2 |
5 |
5 |
2 |
500-800 |
2 |
6 |
6 |
2 |
800-1000 |
2 |
7 |
7 |
2 |
>1000 |
Proposed sampling plan shall be submitted for approval on site specific basis |


---
layout: en/default
class: partners
title: Partners
permalink: /partners
redirect_from: /partners/
theme: dark
---
{% assign ValueAddedPartners = "" | split: "" %}
{% assign TechnoPartners = "" | split: "" %}
{% assign HostingPartners = "" | split: "" %}
{% assign InstitutionalPartners = "" | split: "" %}
{% for partner in site.data.partners %}
{% if partner.type == 'value added' %}
{% assign ValueAddedPartners = ValueAddedPartners | push: partner %}
{% elsif partner.type == 'technology' %}
{% assign TechnoPartners = TechnoPartners | push: partner %}
{% elsif partner.type == 'hosting' %}
{% assign HostingPartners = HostingPartners | push: partner %}
{% elsif partner.type == 'institutional' %}
{% assign InstitutionalPartners = InstitutionalPartners | push: partner %}
{% endif %}
{% endfor %}
Our ecosystem of hosting, technology and value added partners helps us ensure that Rocket.Chat is the best match for your organizationOfficial Global Partners
View Partners
Become a Partner
Our partners
From installation and configuration to the development of features, bots and integrations, Technology Partners develop Rocket.Chat's code and come up with new features to upgrade your platform
Our partners
These partners resell Rocket.Chat in addition to other services or tools such as technical support, consultation and training services
Our partners
Rocket.Chat offers affordable, scalable and secure Cloudas well as self-hosting; in addition we have also partnered with various alternative providers to give you more freedom and choice
Our partners
Become a partner
Become a Partner or download our Partnership brochure to find out how you could become an approved Rocket.Chat partner
Become a Partner Download Brochure


{% extends "base.html" %} {% block css_imports %} {% endblock %} {% block title %} Change solution price: {{ current_problem.display_name }} {% endblock %} {% block content %}
What should be the new price of the solution to {{ (current_problem.display_name).lower() }}? To change the price, a charge of {{ market_fee }} points will be incurred.


Swimming velocity in time and against the size of the droplets. a The velocity of a chiral droplet doped with CB15 evolves in time. Here, the initial diameter of the droplet was ca. 19 μm (data shown for one individual droplet). b Velocity of motile droplets as a function of their diameter. These data correspond to a collection of drops, and was acquired during their motion


Welcome to Chapter 4 of the "Implementing a language with LLVM" tutorial. Chapters 1-3 described the implementation of a simple language and added support for generating LLVM IR. This chapter describes two new techniques: adding optimizer support to your language, and adding JIT compiler support. These additions will demonstrate how to get nice, efficient code for the Kaleidoscope language.
Our demonstration for Chapter 3 is elegant and easy to extend. Unfortunately, it does not produce wonderful code. The LLVM Builder, however, does give us obvious optimizations when compiling simple code:
ready> def test(x) 1+2+x Read function definition: define double @test(double %x) { entry: %addtmp = fadd double 3.000000e+00, %x ret double %addtmp }
This code is not a literal transcription of the AST built by parsing the input. That would be:
ready> def test(x) 1+2+x Read function definition: define double @test(double %x) { entry: %addtmp = fadd double 2.000000e+00, 1.000000e+00 %addtmp1 = fadd double %addtmp, %x ret double %addtmp1 }
Constant folding, as seen above, in particular, is a very common and very important optimization: so much so that many language implementors implement constant folding support in their AST representation.
With LLVM, you don't need this support in the AST. Since all calls to build LLVM IR go through the LLVM IR builder, the builder itself checked to see if there was a constant folding opportunity when you call it. If so, it just does the constant fold and return the constant instead of creating an instruction.
Well, that was easy :). In practice, we recommend always using llvm.core.Builder when generating code like this. It has no "syntactic overhead" for its use (you don't have to uglify your compiler with constant checks everywhere) and it can dramatically reduce the amount of LLVM IR that is generated in some cases (particular for languages with a macro preprocessor or that use a lot of constants).
On the other hand, the Builder is limited by the fact that it does all of its analysis inline with the code as it is built. If you take a slightly more complex example:
ready> def test(x) (1+2+x)*(x+(1+2)) Read a function definition: define double @test(double %x) { entry: %addtmp = fadd double 3.000000e+00, %x ; <double> [#uses=1] %addtmp1 = fadd double %x, 3.000000e+00 ; <double> [#uses=1] %multmp = fmul double %addtmp, %addtmp1 ; <double> [#uses=1] ret double %multmp }
In this case, the LHS and RHS of the multiplication are the same value. We'd really like to see this generate "tmp = x+3; result = tmp*tmp;" instead of computing "x+3" twice.
Unfortunately, no amount of local analysis will be able to detect and correct this. This requires two transformations: reassociation of expressions (to make the add's lexically identical) and Common Subexpression Elimination (CSE) to delete the redundant add instruction. Fortunately, LLVM provides a broad range of optimizations that you can use, in the form of "passes".
LLVM provides many optimization passes, which do many different sorts of things and have different tradeoffs. Unlike other systems, LLVM doesn't hold to the mistaken notion that one set of optimizations is right for all languages and for all situations. LLVM allows a compiler implementor to make complete decisions about what optimizations to use, in which order, and in what situation.
As a concrete example, LLVM supports both "whole module" passes, which look across as large of body of code as they can (often a whole file, but if run at link time, this can be a substantial portion of the whole program). It also supports and includes "per-function" passes which just operate on a single function at a time, without looking at other functions. For more information on passes and how they are run, see the How to Write a Pass document and the List of LLVM Passes.
For Kaleidoscope, we are currently generating functions on the fly, one at a time, as the user types them in. We aren't shooting for the ultimate optimization experience in this setting, but we also want to catch the easy and quick stuff where possible. As such, we will choose to run a few per-function optimizations as the user types the function in. If we wanted to make a "static Kaleidoscope compiler", we would use exactly the code we have now, except that we would defer running the optimizer until the entire file has been parsed.
In order to get per-function optimizations going, we need to set up a FunctionPassManager to hold and organize the LLVM optimizations that we want to run. Once we have that, we can add a set of optimizations to run. The code looks like this:
# The function optimization passes manager. g_llvm_pass_manager = FunctionPassManager.new(g_llvm_module) # The LLVM execution engine. g_llvm_executor = ExecutionEngine.new(g_llvm_module) ... def main(): # Set up the optimizer pipeline. Start with registering info about how the # target lays out data structures. g_llvm_pass_manager.add(g_llvm_executor.target_data) # Do simple "peephole" optimizations and bit-twiddling optzns. g_llvm_pass_manager.add(PASS_INSTRUCTION_COMBINING) # Reassociate expressions. g_llvm_pass_manager.add(PASS_REASSOCIATE) # Eliminate Common SubExpressions. g_llvm_pass_manager.add(PASS_GVN) # Simplify the control flow graph (deleting unreachable blocks, etc). g_llvm_pass_manager.add(PASS_CFG_SIMPLIFICATION) g_llvm_pass_manager.initialize()
This code defines a FunctionPassManager, g_llvm_pass_manager. Once it is set up, we use a series of "add" calls to add a bunch of LLVM passes. The first pass is basically boilerplate, it adds a pass so that later optimizations know how the data structures in the program are laid out. (The "g_llvm_executor" variable is related to the JIT, which we will get to in the next section.) In this case, we choose to add 4 optimization passes. The passes we chose here are a pretty standard set of "cleanup" optimizations that are useful for a wide variety of code. I won't delve into what they do but, believe me, they are a good starting place :).
Once the pass manager is set up, we need to make use of it. We do this by running it after our newly created function is constructed (in FunctionNode.CodeGen), but before it is returned to the client:
return_value = self.body.CodeGen() g_llvm_builder.ret(return_value) # Validate the generated code, checking for consistency. function.verify() # Optimize the function. g_llvm_pass_manager.run(function)
As you can see, this is pretty straightforward. The FunctionPassManager optimizes and updates the LLVM Function in place, improving (hopefully) its body. With this in place, we can try our test above again:
ready> def test(x) (1+2+x)*(x+(1+2)) Read a function definition: define double @test(double %x) { entry: %addtmp = fadd double %x, 3.000000e+00 ; <double> [#uses=2] %multmp = fmul double %addtmp, %addtmp ; <double> [#uses=1] ret double %multmp }
As expected, we now get our nicely optimized code, saving a floating point add instruction from every execution of this function.
LLVM provides a wide variety of optimizations that can be used in certain circumstances. Some documentation about the various passes is available, but it isn't very complete. Another good source of ideas can come from looking at the passes that llvm-gcc or llvm-ld run to get started. The "opt" tool allows you to experiment with passes from the command line, so you can see if they do anything.
Now that we have reasonable code coming out of our front-end, lets talk about executing it!
Code that is available in LLVM IR can have a wide variety of tools applied to it. For example, you can run optimizations on it (as we did above), you can dump it out in textual or binary forms, you can compile the code to an assembly file (.s) for some target, or you can JIT compile it. The nice thing about the LLVM IR representation is that it is the "common currency" between many different parts of the compiler.
In this section, we'll add JIT compiler support to our interpreter. The basic idea that we want for Kaleidoscope is to have the user enter function bodies as they do now, but immediately evaluate the top-level expressions they type in. For example, if they type in "1 + 2", we should evaluate and print out 3. If they define a function, they should be able to call it from the command line.
In order to do this, we first declare and initialize the JIT. This is done by adding and initializing a global variable:
# The LLVM execution engine. g_llvm_executor = ExecutionEngine.new(g_llvm_module)
This creates an abstract "Execution Engine" which can be either a JIT compiler or the LLVM interpreter. LLVM will automatically pick a JIT compiler for you if one is available for your platform, otherwise it will fall back to the interpreter.
Once the ExecutionEngine is created, the JIT is ready to be used. We can use the run_function method of the execution engine to execute a compiled function and get its return value. In our case, this means that we can change the code that parses a top-level expression to look like this:
def HandleTopLevelExpression(self): try: function = self.ParseTopLevelExpr().CodeGen() result = g_llvm_executor.run_function(function, []) print 'Evaluated to:', result.as_real(Type.double()) except Exception, e: print 'Error:', e try: self.Next() # Skip for error recovery. except: pass
Recall that we compile top-level expressions into a self-contained LLVM function that takes no arguments and returns the computed double.
With just these two changes, lets see how Kaleidoscope works now!
ready> 4+5 Read a top level expression: define double @0() { entry: ret double 9.000000e+00 } Evaluated to: 9.0
Well this looks like it is basically working. The dump of the function shows the "no argument function that always returns double" that we synthesize for each top-level expression that is typed in. This demonstrates very basic functionality, but can we do more?
ready> def testfunc(x y) x + y*2 Read a function definition: define double @testfunc(double %x, double %y) { entry: %multmp = fmul double %y, 2.000000e+00 ; <double> [#uses=1] %addtmp = fadd double %multmp, %x ; <double> [#uses=1] ret double %addtmp } ready> testfunc(4, 10) Read a top level expression: define double @0() { entry: %calltmp = call double @testfunc(double 4.000000e+00, double 1.000000e+01) ; <double> [#uses=1] ret double %calltmp } Evaluated to: 24.0
This illustrates that we can now call user code, but there is something a bit subtle going on here. Note that we only invoke the JIT on the anonymous functions that call testfunc, but we never invoked it on testfunc itself. What actually happened here is that the JIT scanned for all non-JIT'd functions transitively called from the anonymous function and compiled all of them before returning from run_function().
The JIT provides a number of other more advanced interfaces for things like freeing allocated machine code, rejit'ing functions to update them, etc. However, even with this simple code, we get some surprisingly powerful capabilities - check this out (I removed the dump of the anonymous functions, you should get the idea by now :) :
ready> extern sin(x) Read an extern: declare double @sin(double) ready> extern cos(x) Read an extern: declare double @cos(double) ready> sin(1.0) Evaluated to: 0.841470984808 ready> def foo(x) sin(x)*sin(x) + cos(x)*cos(x) Read a function definition: define double @foo(double %x) { entry: %calltmp = call double @sin(double %x) ; <double> [#uses=1] %calltmp1 = call double @sin(double %x) ; <double> [#uses=1] %multmp = fmul double %calltmp, %calltmp1 ; <double> [#uses=1] %calltmp2 = call double @cos(double %x) ; <double> [#uses=1] %calltmp3 = call double @cos(double %x) ; <double> [#uses=1] %multmp4 = fmul double %calltmp2, %calltmp3 ; <double> [#uses=1] %addtmp = fadd double %multmp, %multmp4 ; <double> [#uses=1] ret double %addtmp } ready> foo(4.0) Evaluated to: 1.000000
Whoa, how does the JIT know about sin and cos? The answer is surprisingly simple: in this example, the JIT started execution of a function and got to a function call. It realized that the function was not yet JIT compiled and invoked the standard set of routines to resolve the function. In this case, there is no body defined for the function, so the JIT ended up calling "dlsym("sin")" on the Python process that is hosting our Kaleidoscope prompt. Since "sin" is defined within the JIT's address space, it simply patches up calls in the module to call the libm version of sin directly.
One interesting application of this is that we can now extend the language by writing arbitrary C++ code to implement operations. For example, we can create a C file with the following simple function:
#include <stdio.h> double putchard(double x) { putchar((char)x); return 0; }
We can then compile this into a shared library with GCC:
gcc -shared -fPIC -o putchard.so putchard.c
Now we can load this library into the Python process using llvm.core.load_library_permanently and access it from Kaleidoscope to produce simple output to the console:
>>> import llvm.core >>> llvm.core.load_library_permanently('/home/max/llvm-py-tutorial/putchard.so') >>> import kaleidoscope >>> kaleidoscope.main() ready> extern putchard(x) Read an extern: declare double @putchard(double) ready> putchard(65) + putchard(66) + putchard(67) + putchard(10) ABC Evaluated to: 0.0
Similar code could be used to implement file I/O, console input, and many other capabilities in Kaleidoscope.
This completes the JIT and optimizer chapter of the Kaleidoscope tutorial. At this point, we can compile a non-Turing-complete programming language, optimize and JIT compile it in a user-driven way. Next up we'll look into extending the language with control flow constructs, tackling some interesting LLVM IR issues along the way.
Here is the complete code listing for our running example, enhanced with the LLVM JIT and optimizer:
#!/usr/bin/env python import re from llvm.core import Module, Constant, Type, Function, Builder, FCMP_ULT from llvm.ee import ExecutionEngine, TargetData from llvm.passes import FunctionPassManager from llvm.passes import (PASS_INSTRUCTION_COMBINING, PASS_REASSOCIATE, PASS_GVN, PASS_CFG_SIMPLIFICATION) ################################################################################ ## Globals ################################################################################ # The LLVM module, which holds all the IR code. g_llvm_module = Module.new('my cool jit') # The LLVM instruction builder. Created whenever a new function is entered. g_llvm_builder = None # A dictionary that keeps track of which values are defined in the current scope # and what their LLVM representation is. g_named_values = {} # The function optimization passes manager. g_llvm_pass_manager = FunctionPassManager.new(g_llvm_module) # The LLVM execution engine. g_llvm_executor = ExecutionEngine.new(g_llvm_module) ################################################################################ ## Lexer ################################################################################ # The lexer yields one of these types for each token. class EOFToken(object): pass class DefToken(object): pass class ExternToken(object): pass class IdentifierToken(object): def __init__(self, name): self.name = name class NumberToken(object): def __init__(self, value): self.value = value class CharacterToken(object): def __init__(self, char): self.char = char def __eq__(self, other): return isinstance(other, CharacterToken) and self.char == other.char def __ne__(self, other): return not self == other # Regular expressions that tokens and comments of our language. REGEX_NUMBER = re.compile('[0-9]+(?:\.[0-9]+)?') REGEX_IDENTIFIER = re.compile('[a-zA-Z][a-zA-Z0-9]*') REGEX_COMMENT = re.compile('#.*') def Tokenize(string): while string: # Skip whitespace. if string[0].isspace(): string = string[1:] continue # Run regexes. comment_match = REGEX_COMMENT.match(string) number_match = REGEX_NUMBER.match(string) identifier_match = REGEX_IDENTIFIER.match(string) # Check if any of the regexes matched and yield the appropriate result. if comment_match: comment = comment_match.group(0) string = string[len(comment):] elif number_match: number = number_match.group(0) yield NumberToken(float(number)) string = string[len(number):] elif identifier_match: identifier = identifier_match.group(0) # Check if we matched a keyword. if identifier == 'def': yield DefToken() elif identifier == 'extern': yield ExternToken() else: yield IdentifierToken(identifier) string = string[len(identifier):] else: # Yield the ASCII value of the unknown character. yield CharacterToken(string[0]) string = string[1:] yield EOFToken() ################################################################################ ## Abstract Syntax Tree (aka Parse Tree) ################################################################################ # Base class for all expression nodes. class ExpressionNode(object): pass # Expression class for numeric literals like "1.0". class NumberExpressionNode(ExpressionNode): def __init__(self, value): self.value = value def CodeGen(self): return Constant.real(Type.double(), self.value) # Expression class for referencing a variable, like "a". class VariableExpressionNode(ExpressionNode): def __init__(self, name): self.name = name def CodeGen(self): if self.name in g_named_values: return g_named_values[self.name] else: raise RuntimeError('Unknown variable name: ' + self.name) # Expression class for a binary operator. class BinaryOperatorExpressionNode(ExpressionNode): def __init__(self, operator, left, right): self.operator = operator self.left = left self.right = right def CodeGen(self): left = self.left.CodeGen() right = self.right.CodeGen() if self.operator == '+': return g_llvm_builder.fadd(left, right, 'addtmp') elif self.operator == '-': return g_llvm_builder.fsub(left, right, 'subtmp') elif self.operator == '*': return g_llvm_builder.fmul(left, right, 'multmp') elif self.operator == '<': result = g_llvm_builder.fcmp(FCMP_ULT, left, right, 'cmptmp') # Convert bool 0 or 1 to double 0.0 or 1.0. return g_llvm_builder.uitofp(result, Type.double(), 'booltmp') else: raise RuntimeError('Unknown binary operator.') # Expression class for function calls. class CallExpressionNode(ExpressionNode): def __init__(self, callee, args): self.callee = callee self.args = args def CodeGen(self): # Look up the name in the global module table. callee = g_llvm_module.get_function_named(self.callee) # Check for argument mismatch error. if len(callee.args) != len(self.args): raise RuntimeError('Incorrect number of arguments passed.') arg_values = [i.CodeGen() for i in self.args] return g_llvm_builder.call(callee, arg_values, 'calltmp') # This class represents the "prototype" for a function, which captures its name, # and its argument names (thus implicitly the number of arguments the function # takes). class PrototypeNode(object): def __init__(self, name, args): self.name = name self.args = args def CodeGen(self): # Make the function type, eg. double(double,double). funct_type = Type.function( Type.double(), [Type.double()] * len(self.args), False) function = Function.new(g_llvm_module, funct_type, self.name) # If the name conflicted, there was already something with the same name. # If it has a body, don't allow redefinition or reextern. if function.name != self.name: function.delete() function = g_llvm_module.get_function_named(self.name) # If the function already has a body, reject this. if not function.is_declaration: raise RuntimeError('Redefinition of function.') # If F took a different number of args, reject. if len(callee.args) != len(self.args): raise RuntimeError('Redeclaration of a function with different number ' 'of args.') # Set names for all arguments and add them to the variables symbol table. for arg, arg_name in zip(function.args, self.args): arg.name = arg_name # Add arguments to variable symbol table. g_named_values[arg_name] = arg return function # This class represents a function definition itself. class FunctionNode(object): def __init__(self, prototype, body): self.prototype = prototype self.body = body def CodeGen(self): # Clear scope. g_named_values.clear() # Create a function object. function = self.prototype.CodeGen() # Create a new basic block to start insertion into. block = function.append_basic_block('entry') global g_llvm_builder g_llvm_builder = Builder.new(block) # Finish off the function. try: return_value = self.body.CodeGen() g_llvm_builder.ret(return_value) # Validate the generated code, checking for consistency. function.verify() # Optimize the function. g_llvm_pass_manager.run(function) except: function.delete() raise return function ################################################################################ ## Parser ################################################################################ class Parser(object): def __init__(self, tokens, binop_precedence): self.tokens = tokens self.binop_precedence = binop_precedence self.Next() # Provide a simple token buffer. Parser.current is the current token the # parser is looking at. Parser.Next() reads another token from the lexer and # updates Parser.current with its results. def Next(self): self.current = self.tokens.next() # Gets the precedence of the current token, or -1 if the token is not a binary # operator. def GetCurrentTokenPrecedence(self): if isinstance(self.current, CharacterToken): return self.binop_precedence.get(self.current.char, -1) else: return -1 # identifierexpr ::= identifier | identifier '(' expression* ')' def ParseIdentifierExpr(self): identifier_name = self.current.name self.Next() # eat identifier. if self.current != CharacterToken('('): # Simple variable reference. return VariableExpressionNode(identifier_name) # Call. self.Next() # eat '('. args = [] if self.current != CharacterToken(')'): while True: args.append(self.ParseExpression()) if self.current == CharacterToken(')'): break elif self.current != CharacterToken(','): raise RuntimeError('Expected ")" or "," in argument list.') self.Next() self.Next() # eat ')'. return CallExpressionNode(identifier_name, args) # numberexpr ::= number def ParseNumberExpr(self): result = NumberExpressionNode(self.current.value) self.Next() # consume the number. return result # parenexpr ::= '(' expression ')' def ParseParenExpr(self): self.Next() # eat '('. contents = self.ParseExpression() if self.current != CharacterToken(')'): raise RuntimeError('Expected ")".') self.Next() # eat ')'. return contents # primary ::= identifierexpr | numberexpr | parenexpr def ParsePrimary(self): if isinstance(self.current, IdentifierToken): return self.ParseIdentifierExpr() elif isinstance(self.current, NumberToken): return self.ParseNumberExpr() elif self.current == CharacterToken('('): return self.ParseParenExpr() else: raise RuntimeError('Unknown token when expecting an expression.') # binoprhs ::= (operator primary)* def ParseBinOpRHS(self, left, left_precedence): # If this is a binary operator, find its precedence. while True: precedence = self.GetCurrentTokenPrecedence() # If this is a binary operator that binds at least as tightly as the # current one, consume it; otherwise we are done. if precedence < left_precedence: return left binary_operator = self.current.char self.Next() # eat the operator. # Parse the primary expression after the binary operator. right = self.ParsePrimary() # If binary_operator binds less tightly with right than the operator after # right, let the pending operator take right as its left. next_precedence = self.GetCurrentTokenPrecedence() if precedence < next_precedence: right = self.ParseBinOpRHS(right, precedence + 1) # Merge left/right. left = BinaryOperatorExpressionNode(binary_operator, left, right) # expression ::= primary binoprhs def ParseExpression(self): left = self.ParsePrimary() return self.ParseBinOpRHS(left, 0) # prototype ::= id '(' id* ')' def ParsePrototype(self): if not isinstance(self.current, IdentifierToken): raise RuntimeError('Expected function name in prototype.') function_name = self.current.name self.Next() # eat function name. if self.current != CharacterToken('('): raise RuntimeError('Expected "(" in prototype.') self.Next() # eat '('. arg_names = [] while isinstance(self.current, IdentifierToken): arg_names.append(self.current.name) self.Next() if self.current != CharacterToken(')'): raise RuntimeError('Expected ")" in prototype.') # Success. self.Next() # eat ')'. return PrototypeNode(function_name, arg_names) # definition ::= 'def' prototype expression def ParseDefinition(self): self.Next() # eat def. proto = self.ParsePrototype() body = self.ParseExpression() return FunctionNode(proto, body) # toplevelexpr ::= expression def ParseTopLevelExpr(self): proto = PrototypeNode('', []) return FunctionNode(proto, self.ParseExpression()) # external ::= 'extern' prototype def ParseExtern(self): self.Next() # eat extern. return self.ParsePrototype() # Top-Level parsing def HandleDefinition(self): self.Handle(self.ParseDefinition, 'Read a function definition:') def HandleExtern(self): self.Handle(self.ParseExtern, 'Read an extern:') def HandleTopLevelExpression(self): try: function = self.ParseTopLevelExpr().CodeGen() result = g_llvm_executor.run_function(function, []) print 'Evaluated to:', result.as_real(Type.double()) except Exception, e: print 'Error:', e try: self.Next() # Skip for error recovery. except: pass def Handle(self, function, message): try: print message, function().CodeGen() except Exception, e: print 'Error:', e try: self.Next() # Skip for error recovery. except: pass ################################################################################ ## Main driver code. ################################################################################ def main(): # Set up the optimizer pipeline. Start with registering info about how the # target lays out data structures. g_llvm_pass_manager.add(g_llvm_executor.target_data) # Do simple "peephole" optimizations and bit-twiddling optzns. g_llvm_pass_manager.add(PASS_INSTRUCTION_COMBINING) # Reassociate expressions. g_llvm_pass_manager.add(PASS_REASSOCIATE) # Eliminate Common SubExpressions. g_llvm_pass_manager.add(PASS_GVN) # Simplify the control flow graph (deleting unreachable blocks, etc). g_llvm_pass_manager.add(PASS_CFG_SIMPLIFICATION) g_llvm_pass_manager.initialize() # Install standard binary operators. # 1 is lowest possible precedence. 40 is the highest. operator_precedence = { '<': 10, '+': 20, '-': 20, '*': 40 } # Run the main "interpreter loop". while True: print 'ready>', try: raw = raw_input() except KeyboardInterrupt: break parser = Parser(Tokenize(raw), operator_precedence) while True: # top ::= definition | external | expression | EOF if isinstance(parser.current, EOFToken): break if isinstance(parser.current, DefToken): parser.HandleDefinition() elif isinstance(parser.current, ExternToken): parser.HandleExtern() else: parser.HandleTopLevelExpression() # Print out all of the generated code. print '\n', g_llvm_module if __name__ == '__main__': main()


Hackathon: Build a Version Controlled Knowledge Graph of All of Human History
Hackathon call:
Work with TerminusDB and TerminusHub to Build a Version Controlled Knowledge Graph of All of Human History
Sponsored by the DBpedia Association
Sign up to participate in TerminusDB’s track to transform the The Global History Databank by enriching it with data drawn from the DBpedia, thus becoming a knowledge engineer.
Unlike most other knowledge graph databases and knowledge graph based software, TerminusDB is open source (GPLv3). We believe in the ideals of the open source, open data and open science movements. By participating in this Hackathon, you will contribute to making the world more open.
It is easy to get started with TerminusDB and TerminusHub - just download the analytic engine, clone all of DBpedia from Hub and you will be up and running inside 3 minutes. Check out this video to see how quick it really is.
TerminusHub is the future for collaborative data integration. With TerminusHub You can share, build and integrate databases with your team and the wider world. Your project can keep data synchronized with TerminusHub and make the latest data accessible to your team no matter where they are:
- Full versioning so you can roll back and travel through time Create data projects, build automated data pipelines or just access your databases easily through the cloud
- Private or public collaboration - depends on what you need
- Built for agile teams who’d rather spend time exploring and building than managing databases
This is your chance to join the pioneers at the forefront of the data-centric revolution!
A cash prize of EU 500 will be awarded to the best hacker, and a swag bag, including a hoodie, an ancient history toob and other items will be awarded to all participants.
The Hackathon Instructions
Attending the hackathon is at no cost. Registration is required: sign up here. You could also email<EMAIL_ADDRESS>DM me (luke feeney) in the DBpedia slack, or join our Discord. If you join the Discord server and send a message in the DBpedia channel, you will get a special role in the server. Hackathon coordination will be in the Discord server. You can also just register for the webinar below and I will put it all together.
If you want a different challenge, choose a public dataset from somewhere else and do something cool with TerminusDB and TerminusHub. All entries, no matter how unusual, will be considered (thou you will want to choose one that will be interesting to explore and analyze by creating a knowledge graph).
We will be hosting a public working session to kick off the hackathon. The team from TerminusDB will be joined by Peter Peregrine to introduce the Seshat conflict data. We will then work to integrate that data with DBpedia and set goals and questions for the DBpedia hackathon.
This hackathon will provide a very practical demonstration of the value of the rich semantic information accessible through DBpedia. It is at the cutting edge of digital humanities and long scale historical research.
Timeline
- Introduction Working Session Webinar: Sep 22, 2020 04:00 PM London Time. Register Now
- Hackathon begins directly after session: September 22st, 2020
- TerminusDB will host regular stand-ups to engage with participants and to help with any issues.
- Hackathon submission deadline (3 min video and 2-3 paragraph summary with links): October 1st, 23:59 London Time
- Hackathon final event (recap of the track and prize announcements):October 5th, 16:00 CEST, 2020
What will earn you the prize?
A cash prize of EUR 500 will be awarded for the best use-case, and a swag bag, including a hoodie, an ancient history toob and other cool items will be awarded to all participants that submit an entry.
If at any stage you require assistance with the platform, we will be glad to assist you. We are always available on Discord.
Building the database of the future.


All Adivasis urged to attend Chalo Delhi meeting
MP asks aboriginal tribals to put up a united front irrespective of party affiliations
by Special CorrespondentMember of Parliament Adilabad (ST) Soyam Bapu Rao of Bharatiya Janata Party on Sunday gave a call to Adivasis to attend the proposed Chalo Delhi public meeting at New Delhi on December 9 irrespective of party affiliations.
The call came during a preparatory meeting for the Delhi event which was attended by aboriginal people from Adilabad, Kumram Bheem Asifabad and Nirmal districts under the banner of Adivasi Hakkula Porata Samithi, better known as Tudum Debba.
The main objective of the Delhi event is to demand expulsion of Lambada tribe from the list of Scheduled Tribes. The MP vowed to meet his political rival from Telangana Rashtra Samithi and former Adilabad MP G. Nagesh to request him to attend the meeting as a measure of making it a united affair of aboriginal tribes in Telangana.
Notable, however, was the absence of Asifabad MLA Athram Sakku and KB Asifabad Zilla Parishad chairperson Kova Laxmi at the meeting. Many had expected them to attend the preparatory meeting as they too were supporters of the main demand of the Adivasis.
Mr. Bapu Rao demanded a white paper on land assigned to ethnic people in erstwhile undivided Adilabad district. He also accused the government of giving Local Scheduled Tribe certificates to ineligible Lambadas.


[Gecode] bug: equal and the empty set
Grégoire Dooms
dooms at info.ucl.ac.be
Mon May 23 18:09:31 CEST 2005
Grégoire Dooms wrote:
>
> I also attach a patch against set/reified/propagators.cc 1.25
> (this is a CVS version Christian sent me a few weeks ago - I have no
> CVS access).
>
Should read twice before posting.
The previous patch does not fix it in other cases (two sets not equal
but neither being empty).
This one should be better;
--
Grégoire
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_equal.diff
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20050523/ed7130d3/attachment.txt>
More information about the gecode-users
mailing list


| Request | Data | Endpoint |
|---|---|---|
| GET | All Users | /users |
| POST | New User | /users/new |
| POST | Return Single User | /users/:email |
| POST | Log in User | /users |
| PUT | Update User Password | /users/update-pw |
| PUT | Update User's Name and Email | /users/update |
| Request | Data | Endpoint |
|---|---|---|
| GET | All Artists | /artists |
| GET | Return Single Artist (by artist ID) | /artist/:id |
| POST | New Artist | /artists/new |
| POST | Return Artist by User ID | /artists/:user_id |
| PUT | Update Artist (by artist ID) | /artists/:id |


Home
Archive
About
Cultural Blog Ia: Reflections on the Fireside Chat
Cultural Blog Ib: Time Management, Focus and Reasons Why
Cultural Blog II: Emotional Intelligence
Cultural Blog III: Meditation Process
Cultural Blog IV: Mindfulness in Practice
Cultural Blog V: Self Confidence
Cultural Blog VI: Control
Cultural Blog VII: Motivation
Cultural Blog VIII: Connecting
Cultural Blog IX: Leadership
Technical Blog I: Web Structure and Wishlist
Technical Blog II: Frameworks and Responsive Design
Technical Blog III: Design to Build Process
Technical Blog IV: Javascript Basics
Technical Blog V: Problem Solving
Technical Blog VI: Brackets in Javascript
Technical Blog VII: Scope


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractList | +--java.util.ArrayList | +--org.apache.commons.collections.ArrayStack
An implementation of the Stack
API that is based on an
ArrayList
instead of a Vector
, so it is not
synchronized to protect against multi-threaded access. The implementation
is therefore operates faster in environments where you do not need to
worry about multiple thread contention.
The removal order of an ArrayStack
is based on insertion
order: The most recently added element is removed first. The iteration
order is not the same as the removal order. The iterator returns
elements from the bottom up, whereas the remove()
method removes
them from the top down.
Unlike Stack
, ArrayStack
accepts null entries.
Note: this class should be bytecode-identical to the version in commons collections. This is required to allow backwards compability with both previous versions of BeanUtils and also allow coexistance with both collections 2.1 and 3.0.
Stack
,
Serialized Form| Field Summary | |
private static long |
serialVersionUID
Ensure serialization compatibility |
| Fields inherited from class java.util.ArrayList |
|
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
ArrayStack()
Constructs a new empty ArrayStack . |
|
ArrayStack(int initialSize)
Constructs a new empty ArrayStack with an initial size. |
| Method Summary | |
boolean |
empty()
Return true if this stack is currently empty. |
java.lang.Object |
get()
Returns the element on the top of the stack. |
java.lang.Object |
peek()
Returns the top item off of this stack without removing it. |
java.lang.Object |
peek(int n)
Returns the n'th item down (zero-relative) from the top of this stack without removing it. |
java.lang.Object |
pop()
Pops the top item off of this stack and return it. |
java.lang.Object |
push(java.lang.Object item)
Pushes a new item onto the top of this stack. |
java.lang.Object |
remove()
Removes the element on the top of the stack. |
int |
search(java.lang.Object object)
Returns the one-based position of the distance from the top that the specified object exists on this stack, where the top-most element is considered to be at distance 1 . |
| Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
| Field Detail |
private static final long serialVersionUID
| Constructor Detail |
public ArrayStack()
ArrayStack
. The initial size
is controlled by ArrayList
and is currently 10.
public ArrayStack(int initialSize)
ArrayStack
with an initial size.
initialSize
- the initial size to use
java.lang.IllegalArgumentException
- if the specified initial size
is negative| Method Detail |
public boolean empty()
true
if this stack is currently empty.
This method exists for compatibility with java.util.Stack
.
New users of this class should use isEmpty
instead.
public java.lang.Object peek() throws java.util.EmptyStackException
java.util.EmptyStackException
- if the stack is emptypublic java.lang.Object peek(int n) throws java.util.EmptyStackException
n
- the number of items down to go
java.util.EmptyStackException
- if there are not enough items on the
stack to satisfy this requestpublic java.lang.Object pop() throws java.util.EmptyStackException
java.util.EmptyStackException
- if the stack is emptypublic java.lang.Object push(java.lang.Object item)
add
.
item
- the item to be added
public int search(java.lang.Object object)
1
. If the object is not
present on the stack, return -1
instead. The
equals()
method is used to compare to the items
in this stack.
object
- the object to be searched for
public java.lang.Object get()
get
in interface Buffer
BufferUnderflowException
- if the stack is emptypublic java.lang.Object remove()
remove
in interface Buffer
BufferUnderflowException
- if the stack is empty
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Die Weisse Massai / The White Massai
Die weiße Massai is a movie starring Nina Hoss, Jacky Ido, and Katja Flint. A girl, Carola, whose vacation in Kenya takes an interesting turn when she becomes infatuated with a Masai. Carola decides to leave her boyfriend to stay...


Samurai Shodown’s next DLC character Kazuki Kazama out next week
by Aran SuddiThe next DLC character for Samurai Shodown, Kazuki Kazama, has been confirmed and he will be available to download starting next week on November 14th. This is earlier than the original December release window. Kazuki Kazama has fire-based attacks also allows for some fancy looking attacks as well as attacks that shows he can dash around the stage quite quickly dealing a lot of damage. If you were lucky enough you may have been able to grab the season pass when it was free.
In our review for Samurai Shodown Nick wrote:
Samurai Shodown is a strong entry into the sea of fighters, showing a lot of love for the original series, while also being able to appeal to newcomers. A few niggles aside, people are going to be playing Sam Show for a long time. EVO just got more exciting to watch!
Source: YouTube


|
Name
|
Type
|
Description
|
| end | HostDiskDimensionsLba |
The end block address of the disk range. The block numbers start
from zero. The range is inclusive of the end address.
|
| partition | xsd:int |
Partition number. This number is a hint from the server indicating
what the partition number for this block range is if the range
corresponds to a partition. The partition number should correlate to
the one in the partition specification. If sent back to the server,
this property is ignored.
|
| start | HostDiskDimensionsLba |
The starting block address of the disk range. The block numbers start
from zero. The range is inclusive of the end address.
|
| type | xsd:string |
The type of data in the partition. See type
|
|
Properties inherited from DynamicData |
| None |


| Id | Track Name | Artist | Album |
|---|---|---|---|
| Copyright2009, Yahoo.com,Inc. All Rights Reserved. | |||
| 1 | Hide You | Kosheen | Resist |
| 2 | .38.45 | Thievery Corporation | Sounds From the Thievery Hi-Fi |
| 3 | Fix You | Cold Play | & |
| 4 | Hide You | Kosheen | Resist |
| 5 | .38.45 | Thievery Corporation | Sounds From the Thievery Hi-Fi |
| 6 | Fix You | Cold Play | & |


Veganism 101
What does it mean to be vegan?
- No meat
- No dairy
- No animal products
What does it NOT mean?
- Eating leaves...
- Sad food
- Being hungry
What it sometimes means
- Snobby co-vegans
- Snobby anti-vegans
- Confused grandmothers
- Zero airplane food
Where do you get your protein?
- Legumes! Beans and lentils
- Leafy greens
- Soy
- Nuts, Nut Butters, Seeds
What about going out to eat?
What about it?
- Vegan-specific: Native Foods Cafe, Chicago Diner
- Chipotle <3
- Become a substitution master; e.g. veggie burger no cheese.
Why would you do this?
Benefits!
- +20 ENVIRONMENT
- +10 Energy
- +10 Bank account
- +30 Nutrients


From this page, users can submit questions, problems, or general feedback to the GenoCAD Administrators. You can expect a response within 24 to 48 hours for most queries. We ask that you enter an email where you can be reached for responses or follow up questions, a brief subject, then the body of your message. An email address entered in the Contact Us form is subject to the same terms as outlined in the Privacy Policy.


Signature validation
The validation of a PKCS#1 signature starts with the decryption of the signature with the public key. The resulting data should be structured as described here.
In the next step the data block is extracted.
This can be done in a correct and in an incorrect way. Until the discovery of the possible attack (2006) the extraction was implemented in an incorrect way in many implementations of the validation algorithm.
-
flawed implementation
In the flawed implementation the algorithm reads in the padding string and the data block of the decrypted signature, but it ignores the 'garbage' data that follows after the data block, thus making it possible to fake a signature without knowing the private key.
-
correct implementation
In a correct implementation the data after the data block and the length of the padding string are taken into account.
The used hash algorithm and the hash value can be extracted from the data block. Now the hash algorithm is applied to the data whose validity the signature guarantees, and the result is compared to the hash value in the data block. If they are equal, the signature is regarded as valid.


Projects values in a forecast period, based on the average value of the variable over a specific number of preceding periods.
If this function is not available, you must install the Analysis ToolPak add-in.
Syntax
MOVEAVG(inprng, outrng, interval, stderrs, chart, labels)
MOVEAVG?(inprng, outrng, interval, stderrs, chart, labels)
Inprng is the input range.
Outrng is the first cell (the upper-left cell) in the output table or the name, as text, of a new sheet to contain the output table. If FALSE, blank, or omitted, places the output table in a new workbook.
Interval is the number of values to include in the moving average. If omitted, interval is 3.
Stderrs is a logical value.
If stderrs is TRUE, standard error values are included in the output table.
If stderrs is FALSE or omitted, standard errors are not included in the output table.
Chart is a logical value.
If chart is TRUE, then MOVEAVG generates a chart for the actual and forecast values.
If chart is FALSE or omitted, the chart is not generated.
Labels is a logical value.
If labels is TRUE, then the first row or column of inprng contains labels.
If labels is FALSE or omitted, all cells in inprng are considered data. Microsoft Excel generates appropriate data labels for the output table.
Return to index