THE SWEET HEREAFTER
A Film Review by James Berardinelli
RATING: **** OUT OF ****
Canada, 1997 U.S. Release Date: 12/25/97 (limited) Running Length: 1:50 MPAA Classification: R (Mature themes, sex, nudity, profanity) Theatrical Aspect Ratio: 2.35:1
Cast: Ian Holm, Sarah Polley, Bruce Greenwood, Tom McCamus, Gabrielle Rose, Arsinee Khanjian, Alberta Watson, Maury Chaykin Director: Atom Egoyan Producers: Atom Egoyan and Camelia Frieberg Screenplay: Atom Egoyan based on the novel by Russell Banks Cinematography: Paul Sarossy Music: Mychael Danna U.S. Distributor: Fine Line Features
THE SWEET HEREAFTER is film maker Atom Egoyan's most compelling movie to date. Amplifying many of the themes explored in his previous outing, EXOTICA, the Canadian director/writer/producer shows the powerful effects of grief and anger on a community devastated by an unspeakable tragedy. During the course of this 110-minute, emotionally- turbulent experience, Egoyan doesn't ask any easy questions or propose any pat answers. This is film making at its most powerful: drama capable of shaking the soul, yet free of even the slightest hint of manipulation, sentimentality, or mawkishness. The movie has an impact that extends far beyond the walls of a movie theater – a quality shared by a distressingly few of today's releases.
Egoyan began making films with 1984's NEXT OF KIN, a critical success that earned him a nomination for Canada's Best Director Genie Award. He followed NEXT OF KIN with FAMILY VIEWING, SPEAKING PARTS, THE ADJUSTER, and CALENDAR, all of which shared certain common traits, including a wildly elliptical style, themes of emotional isolation, and a degree of distance between the characters and the audience. Egoyan's early movies, although intellectually stimulating and fascinating to observe from a critical standpoint, were emotionally dissatisfying. However, the director's next effort, the much-lauded EXOTICA, broke down the character/audience barrier, and, at the time, proved to be Egoyan's most challenging effort. Yet, as forceful as EXOTICA was, it was only an appetizer for THE SWEET HEREAFTER.
As with all of the other Egoyan-directed movies, THE SWEET HEREAFTER involves more than one storyline, although the internal connections are less oblique here than in the previous features. This could easily be viewed as Egoyan's most commercial work thus far. It is certainly his most accessible. There are those who would equate words like "commercial" and "accessible" with the term "creative compromise," but nothing could be further from the truth. Although Egoyan's methods may have become more mainstream, his message is richer and more complex than ever.
The central event of THE SWEET HEREAFTER is a school bus accident that results in the death of fourteen children and the injury of many others. On a cold winter's day in the small town of Sam Dent, British Columbia, the driver loses control of the vehicle and it careens off the road onto a frozen lake which gives way beneath the weight. The scene of the bus sinking into the water – a stark, simple shot – is one of the most painfully effective and disturbing sequences in any film this year. The impact is further enhanced by presenting the fatal moment from the perspective of an impotent father.
Since Egoyan eschews linear storytelling by allowing time to be fluid rather than fixed, we don't see the actual accident until midway through the movie. The opening scene introduces us to Mitchell Stephens (Ian Holm), an ambulance-chaser who has come to Sam Dent to persuade the victims' parents to join in a class action lawsuit. He promises financial compensation for their losses, claiming that while no one can offer an outlet for their grief, he can be the voice of their anger. In fact, Mitchell knows something about those emotions. His daughter, Zoe (Caerthan Banks), is a drug addict on the road to self-destruction. All of the fury bubbling within Mitchell becomes focused into his work in Sam Dent. But there is no clear culprit to sue for the bus accident, and Mitchell is groping for a villain who doesn't exist. Parents join him in the vain hope that money will soothe the pain or bring some sort of "closure," but the greed for compensation fractures the community.
Other players in the drama include Nicole Burnell (Sarah Polley), one of the accident survivors. She's a teenage, would-be rock star who loses the use of her legs because of the experience, and who becomes the corner stone of Mitchell's case. As the victim of incest, however, she is a damaged individual. Her parents, Sam (Tom McCamus) and Mary (Brooke Johnson), are among the lawyer's most eager clients. Two others involved in the suit are Wanda and Hartley Otto (Arsinee Khanjian and Earl Pastko), who lost an adopted child in the crash. Risa and Wendell Walker (Alberta Watson and Maury Chaykin), whose only son perished beneath the cold waters, have also signed with Mitchell. But Risa's lover, Billy Ansell (Bruce Greenwood), reject's Mitchell's advances. Having recently lost his wife, Billy is acquainted with grief, and this enables him to accept the death of his twin children, rather than wallow in denial. Finally, there's Dolores Driscoll (Gabrielle Rose), the longtime bus driver who must live with the weight of responsibility for what happened.
THE SWEET HEREAFTER is based on the novel by Russell Banks, but Egoyan has infused it with his own inimitable style. One of the film maker's more successful innovations is to make explicit comparisons between the situation in Sam Dent (the loss of the children) and the one in the Robert Browning poem, "The Pied Piper of Hamelin." In the "Pied Piper," the lone crippled boy left behind by the Piper forever regretted his exclusion from a land where "everything was strange and new." It could be argued that, in THE SWEET HEREAFTER, the abandoned one is Nicole. The sweet hereafter is the strange, new land that her schoolmates reach, but which she has not yet attained.
The most intriguing character is Mitchell. The best-developed of all of THE SWEET HEREAFTER's numerous multifaceted individuals, Mitchell proves to be a sympathetic figure even though his influence is negative. The lawyer is not only after a quick buck (he gets 1/3 of the proceeds from any favorable settlement), but he believes that his own tragedy forges an emotional link between him and the residents of Sam Dent. What he can't see, however, is that his private agenda is tearing asunder the fabric of the community. Personal demons and an obsession to assuage his own guilt, not a need to see justice done, drive Mitchell.
As always, Egoyan has assembled a top-notch cast. Ian Holm paints a powerful and stirring portrait of Mitchell as a haunted, hurting figure whose inner torment touches our hearts.  The actor's shining moment is when Mitchell relates the story of how, as an infant, his daughter nearly died from a spider bite. It is during this scene, more than any other, that the audience truly connects with a character that, under other circumstances, might be worthy of disdain.
Most of the other performers are Egoyan regulars. As always, the director's wife, Arsinee Khanjian, is on hand. Bruce Greenwood, playing a role not unlike the one he essayed in EXOTICA, is again a grieving father. Sarah Polley, who was also in EXOTICA (she was a babysitter), has a more complex role here. In addition to portraying Nicole, Polley contributes the vocals to many of the songs heard throughout the film, including the one that plays over the closing credits. Other familiar faces from previous Egoyan features include Gabrielle Rose, Maury Chaykin, and David Hemblen (as Dolores the bus driver's husband). Alberta Watson, who made a strong impression as the mother in SPANKING THE MONKEY, is Risa Walker.
One of the many tangential aspects of THE SWEET HEREAFTER is to illustrate the shallowness of the numerous John Grisham movies. Compared to Egoyan's thoughtful and potent examination of the role of a lawyer in society, even THE RAINMAKER, the best adaptation of a Grisham novel to date, seems flat and unconvincing. Egoyan has given us a powerful motion picture that resonates on every level. The most amazing thing about THE SWEET HEREAFTER is not the style, the acting, or the cinematography (all of which are exceptional), but the way the film successfully juggles so many themes, persuading us to reflect upon them all before the 110 minute running time is up. This is truly a great film – easily one of 1997's best.
Copyright 1997 James Berardinelli
- James Berardinelli e-mail<EMAIL_ADDRESS>Now with more than 1300 reviews... The ReelViews web site: http://movie-reviews.colossus.net/
"For me, the cinema is not a slice of life, but a piece of cake."
- Alfred Hitchcock
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


FOLO is hiring at its Ahmedabad studio. We're lined up with some really interesting projects and would love to have you over at our studio.
If you're in your final year or looking for a summer internship in information, graphic and interaction design, write in!
INTERNSHIPS
Intern - Information + Graphic Design
You love packing information in all sizes, be it an identity for a brand or a visualised narrative. Apply→
Intern - Interface + Interaction Design
You're passionate about the mobile revolution and want to exploit its ability to solve real & complex problems.  Apply→
If you landed at this page directly, you must look at our work
In 2026, string instruments will be antique property
More →


{% extends "frame.html" %} {% block content %} {% load datetime_utils %}
{{saveError}}! Is this really what you want? Yes, I really want to submit an overlapping sleep {{ form.forceOverlap }}
Sleep entered!
Start time: {{ form.start_time }}
End time:{{ form.end_time}}
Date:{{ form.date}}
Comments{{ form.comments}}
Timezone{{ form.timezone}}


Lightning Network Resources
The Lightning Network is being developed as a means of making bitcoin payments faster, cheaper, and more private. It's still experimental and reckless to use for large amounts of money. Note that this list is open source; please suggest changes on GitHub! Toggle dark mode here:


Software Development
Endorsed by Mir Derakhshan, who is highly skilled at this
Endorsed by Trevor Randall (mutual connection)
Java
Endorsed by 5 of Mehdi’s colleagues at Goldman Sachs
Ant
Judith Hankin and 14 connections have given endorsements for this skill
Software Engineering
Agile Methodologies
Cloud Computing
Test Driven Development
Linux
JavaScript
XML
Maven
XSLT
Apache
C++
Unix
Python
Core Java
REST
Groovy
XSL-FO
Apache FOP
Pdf
PostScript
Gradle
Unix Shell Scripting
Maven2


Writing
Suggestions on Writing Instruction
Writing is an important part of learning to read. But how should you teach the learner to write? The learner should draw the letters of the alphabet when learning the letters in isolation. Once words are being read, the learner should be taught to write them in cursive script.
Cursive helps a child learn to read. With the prevalent ball-and-stick method, it is very easy for the learner to confuse b's and d's. But with cursive, a b starts like an l as in lead, and a d starts like an a. The distinction that is made in writing the letters in cursive carries over to the reading process.
In addition, in writing print script, the letters will be all over the page, sometimes written from left to right and sometimes from right to left. In cursive, where all the letters are joined, the student learns directional discipline because the letters must be joined from left to right. This helps in learning to spell, for how the letters join with one another creates habits of hand movement that automatically aid the spelling process.
Of course, the learner should also be taught to print. This can easily be done after the learner has developed a good cursive handwriting.
Cursive First
The reason a child should be taught cursive first is that learning to print first may prevent a learner from developing a good cursive handwriting. However, if you learn to write cursive first, you can always learn to print later very nicely. In other words, learning cursive first does not prevent the development of a good printing style, while print first will create fixed writing habits that will prevent the development of a good cursive script.
The Benefits of Cursive for the Left-Handed Learner
Another important benefit of learning cursive first is if the learner is left-handed. A right-handed writer tilts the paper counter-clockwise in order to give one's handwriting the proper slant. With the left-handed learner, the paper must be tilted in an extreme clockwise position so that the student can write from bottom up. If the paper is not tilted to the right, the left-handed student may want to use the hook form of writing. This usually happens when the learner is taught ball-and-stick method first with the paper in a straight up position.


--- layout: post title: "A conditional sandwich example" description: "An F# example of reducing a workflow to an impureim sandwich." date: 2022-02-14 7:44 UTC tags: [Functional Programming, F#] image: "/content/binary/flowchart-to-create-fusebit-user.png" image_alt: "Flowchart that illustrates how to provision a Fusebit user." --- {% include JB/setup %}
{{ page.description }}
The most common reaction to the impureim sandwich architecture (also known as functional core, imperative shell) is one of incredulity. How does this way of organising code generalise to arbitrary complexity?
The short answer is that it doesn't. Given sufficient complexity, you may not be able to 1. gather all data with impure queries, 2. call a pure function, and 3. apply the return value via impure actions. The question is: How much complexity is required before you have to give up on the impureim sandwich?
There's probably a fuzzy transition zone where the sandwich may still apply, but where it begins to be questionable whether it's beneficial. In my experience, this transition seems to lie further to the right than most people think.
Once you have to give up on the impureim sandwich, in functional programming you may resort to using free monads. In object-oriented programming, you may use Dependency Injection. Depending on language and paradigm, still more options may be available.
My experience is mostly with web-based systems, but in that context, I find that a surprisingly large proportion of problems can be rephrased and organised in such a way that the impureim sandwich architecture applies. Actually, I surmise that most problems can be addressed in that way.
I am, however, often looking for good examples. As I wrote in a comment to Dependency rejection:
"I'd welcome a simplified, but still concrete example where the impure/pure/impure sandwich described here isn't going to be possible."
Such examples are, unfortunately, rare. While real production code may seem like an endless supply of examples, production code often contains irrelevant details that obscure the essence of the case. Additionally, production code is often proprietary, so I can't share it.
In 2019 Christer van der Meeren kindly supplied an example problem that I could refactor. Since then, there's been a dearth of more examples. Until now.
I recently ran into another fine example of a decision flow that at first glance seemed a poor fit for the functional core, imperative shell architecture. What follows is, actually, production code, here reproduced with the kind permission of Criipto.
As I've previously touched on, I'm helping Criipto integrate with the Fusebit API. This API has a user model where you can create users in the Fusebit services. Once you've created a user, a client can log on as that user and access the resources available to her, him, or it. There's an underlying security model that controls all of that.
Criipto's users may not all be provisioned as users in the Fusebit API. If they need to use the Fusebit system, we'll provision them just in time. On the other hand, there's no reason to create the user if it already exists.
But it gets more complicated than that. To fit our requirements, the user must have an associated issuer. This is another Fusebit resource that we may have to provision if it doesn't already exist.
The desired logic may be easier to follow if visualised as a flowchart.
The user must have an issuer, but an appropriate issuer may already exist. If it doesn't, we must create the issuer before we create the user.
At first blush this seems like a workflow that doesn't fit the impureim sandwich architecture. After all, you should only check for the existence of the issuer if you find that the user doesn't exist. There's a decision between the first and second impure query.
Can we resolve this problem and implement the functionality as an impureim sandwich?
When looking for ways to apply the functional core, imperative shell architecture, it often pays to take a step back and look at a slightly larger picture. Another way to put it is that you should think less procedurally, and more declaratively. A flowchart like the above is essentially procedural. It may prevent you from seeing other opportunities.
One of the reasons I like functional programming is that it forces me to think in a more declarative way. This helps me identify better abstractions than I might otherwise be able to think of.
The above flowchart is representative of the most common counterargument I hear: The impureim sandwich doesn't work if the code has to make a decision about a secondary query based on the result of an initial query. This is also what's at stake here. The result of the user exists query determines whether the program should query about the issuer.
The assumption is that since the user is supposed to have an issuer, if the user exists, the issuer must also exist.

Perhaps you react to such a suggestion with distaste. After all, it seems wasteful. Why query a web service if you don't need the result? And what about performance?
Whether or not this is wasteful depends on what kind of waste you measure. If you measure bits transmitted over the network, then yes, you may see this measure increase.
It may not be as bad as you think, though. Perhaps the HTTP GET
request you're about to make has a cacheable result. Perhaps the result is already waiting in your proxy server's RAM.
Neither the Fusebit HTTP API's user resources nor its issuer resources, however, come with cache headers, so this last argument doesn't apply here. I still included it above because it's worth taking into account.
Another typical performance consideration is that this kind of potentially redundant traffic will degrade performance. Perhaps. As usual, if that's a concern: measure.
Querying the API whether a user exists is independent of the query to check if an issuer exists. This means that you could perform the two queries in parallel. Depending on the total load on the system, the difference between one HTTP request and two concurrent requests may be negligible. (It could still impact overall system performance if the system is already running close to capacity, so this isn't always a good strategy. Often, however, it's not really an issue.)
A third consideration is the statistical distribution of pathways through the system. If you consider the flowchart above, it indicates a cyclomatic complexity of 3; there are three distinct pathways.
If, however, it turns out that in 95 percent of cases the user doesn't exist, you're going to have to perform the second query (for issuer) anyway, then the difference between prefetching and conditional querying is minimal.
While some would consider this 'cheating', when aiming for the impureim sandwich architecture, these are all relevant questions to ponder. It often turns out that you can fetch all the data before passing them to a pure function. It may entail 'wasting' some electrons on queries that turn out to be unnecessary, but it may still be worth doing.
There's another kind of waste worth considering. This is the waste in developer hours if you write code that's harder to maintain than it has to be. As I recently described in an article titled Favor real dependencies for unit testing, the more you use functional programming, the less test maintenance you'll have.
Keep in mind that the scenario in this article is a server-to-server interaction. How much would a bit of extra bandwidth cost, versus wasted programmer hours?
If you can substantially simplify the code at the cost of a few dollars of hardware or network infrastructure, it's often a good trade-off.
The above flowchart implies a more subtle assumption that turns out to not hold in practice. The assumption is that all users in the system have been created the same: that all users are associated with an issuer. Thus, according to this assumption, if the user exists, then so must the issuer.
This turns out to be a false assumption. The Fusebit HTTP API doesn't enforce referential integrity. You can create a user with an issuer that doesn't exist. When creating a user, you supply only the issuer ID (a string), but the API doesn't check that an issuer with that ID exists.
Thus, just because a user exists you can't be sure that its associated issuer exists. To be sure, you'd have to check.
But this means that you'll have to perform two queries after all. The angst from the previous section turns out to be irrelevant. The flowchart is wrong.
Instead, you have two independent, but potentially parallelisable, processes:
You can't always be that lucky when you consider how to make requirements fit the impureim sandwich mould, but this is beginning to look really promising. Each of these two processes is near-trivial.
Really, what's actually required is an idempotent create action. As the RESTful Web Services Cookbook describes, all HTTP verbs except POST
should be regarded as idempotent in a well-designed API. Alas, creating users and issuers are (naturally) done with POST
requests, so these operations aren't naturally idempotent.
In functional programming you often decouple decisions from effects. In order to be able to do that here, I created this discriminated union:
type Idempotent<'a> = UpToDate | Update of 'a
This type is isomorphic to option, but I found it worthwhile to introduce a distinct type for this particular purpose. Usually, if a query returns, say UserData option
, you'd interpret the Some
case as indicating that the user exists, and the None
case as indicating that the user doesn't exist.
Here, I wanted the 'populated' case to indicate that an Update
action is required. If I'd used option
, then I would have had to map the user-doesn't-exist case to a Some
value, and the user-exists case to a None
value. I though that this might be confusing to other programmers, since it'd go against the usual idiomatic use of the type.
That's the reason I created a custom type.
The UpToDate
case indicates that the value exists and is up to date. The Update
case is worded in the imperative to indicate that the value (of type 'a
) should be updated.
The purpose of this entire exercise is to establish that a user (and issuer) exists. It's okay if the user already exists, but if it doesn't, we should create it.
I mulled over the terminology and liked the verb establish, to the consternation of many Twitter users.
CreateUserIfNotExists is a crude name 🤢
How about EstablishUser instead?
"Establish" can both mean to "set up on a firm or permanent basis" and "show (something) to be true or certain by determining the facts". That seems to say the same in a more succinct way 👌
Just read the comments to see how divisive that little idea is. Still, I decided to define a function called establish
to convert a Boolean and an 'a
value to an Idempotent<'a>
value.
Don't forget the purpose of this entire exercise. The benefit that the impureim sandwich architecture can bring is that it enables you to drain the impure parts of the sandwich of logic. Pure functions are intrinsically testable, so the more you define decisions and algorithms as pure functions, the more testable the code will be.
It's even better when you can make the testable functions generic, because reusable functions has the potential to reduce cognitive load. Once a reader learns and understands an abstraction, it stops being much of a cognitive load.
The functions to create and manipulate Idempotent<'a>
values should be covered by automated tests. The behaviour is quite trivial, though, so to increase coverage we can write the tests as properties. The code base in question already uses FsCheck, so I just went with that:
[<Property(QuietOnSuccess = true)>] let ``Idempotent.establish returns UpToDate`` (x : int) = let actual = Idempotent.establish x true UpToDate =! actual [<Property(QuietOnSuccess = true)>] let ``Idempotent.establish returns Update`` (x : string) = let actual = Idempotent.establish x false Update x =! actual
These two properties also use Unquote for assertions. The =!
operator means should equal, so you can read an expression like UpToDate =! actual
as UpToDate should equal actual.
This describes the entire behaviour of the establish
function, which is implemented this way:
// 'a -> bool -> Idempotent<'a> let establish x isUpToDate = if isUpToDate then UpToDate else Update x
About as trivial as it can be. Unsurprising code is good.
The establish
function affords a way to create Idempotent
values. It'll also be useful with a function to get the value out of the container, so to speak. While you can always pattern match on an Idempotent
value, that'd introduce decision logic into the code that does that.
The goal is to cover as much decision logic as possible by tests so that we can leave the overall impureim sandwich as an untested declarative composition - a Humble Object, if you will. It'd be appropriate to introduce a reusable function (covered by tests) that can fulfil that role.
We need the so-called case analysis of Idempotent<'a>
. In other terminology, this is also known as the catamorphism. Since Idempotent<'a>
is isomorphic to option
(also known as Maybe), the catamorphism is also isomorphic to the Maybe catamorphism. While we expect no surprises, we can still cover the function with automated tests:
[<Property(QuietOnSuccess = true)>] let ``Idempotent.fold when up-to-date`` (expected : DateTimeOffset) = let actual = Idempotent.fold (fun _ -> DateTimeOffset.MinValue) expected UpToDate expected =! actual [<Property(QuietOnSuccess = true)>] let ``Idempotent.fold when update required`` (x : TimeSpan) = let f (ts : TimeSpan) = ts.TotalHours + float ts.Minutes let actual = Update x |> Idempotent.fold f 1.1 f x =! actual
The most common catamorphisms are idiomatically called fold
in F#, so that's what I called it as well.
The first property states that when the Idempotent
value is already UpToDate
, fold
simply returns the 'fallback value' (here called expected
) and the function doesn't run.
When the Idempotent
is an Update
value, the function f
runs over the contained value x
.
The implementation hardly comes as a surprise:
// ('a -> 'b) -> 'b -> Idempotent<'a> -> 'b let fold f onUpToDate = function | UpToDate -> onUpToDate | Update x -> f x
Both establish
and fold
are general-purpose functions. I needed one more specialised function before I could compose a workflow to create a Fusebit user if it doesn't exist.
As I've previously mentioned, I'd already developed a set of modules to interact with the Fusebit API. One of these was a function to read an issuer. This Issuer.get
action returns a Task<Result<IssuerData, HttpResponseMessage>>
.
The Result
value will only be an Ok
value if the issuer exists, but we can't conclude that any Error
value indicates a missing resource. An Error
may also indicate a genuine HTTP error.
A function to translate a Result<IssuerData, HttpResponseMessage>
value to a Result<bool, HttpResponseMessage>
by examining the HttpResponseMessage
is just complex enough (cyclomatic complexity 3) to warrant unit test coverage. Here I just went with some parametrised tests rather than FsCheck properties.
The first test asserts that when the result is Ok
it translates to Ok true
:
[<Theory>] [<InlineData ("https://example.com", "DN", "https://example.net")>] [<InlineData ("https://example.org/id", "lga", "https://example.gov/jwks")>] [<InlineData ("https://example.com/id", null, "https://example.org/.jwks")>] let ``Issuer exists`` iid dn jwks = let issuer = { Id = Uri iid DisplayName = dn |> Option.ofObj PKA = JwksEndpoint (Uri jwks) } let result = Ok issuer let actual = Fusebit.issuerExists result Ok true =! actual
All tests here are structured according to the AAA formatting heuristic. This particular test may seem so obvious that you may wonder how there's actually any logic to test. Perhaps the next test throws a little more light on that question:
[<Fact>] let ``Issuer doesn't exist`` () = use resp = new HttpResponseMessage (HttpStatusCode.NotFound) let result = Error resp let actual = Fusebit.issuerExists result Ok false =! actual
How do we know that the requested issuer doesn't exist? It's not just any Error
result that indicates that, but a particular 404 Not Found
result. Notice that this particular Error
result translates to an Ok
result: Ok false
.
All other kinds of Error
results, on the other hand, should remain Error
values:
[<Theory>] [<InlineData (HttpStatusCode.BadRequest)>] [<InlineData (HttpStatusCode.Unauthorized)>] [<InlineData (HttpStatusCode.Forbidden)>] [<InlineData (HttpStatusCode.InternalServerError)>] let ``Issuer error`` statusCode = use resp = new HttpResponseMessage (statusCode) let expected = Error resp let actual = Fusebit.issuerExists expected expected =! actual
All together, these tests indicate an implementation like this:
// Result<'a, HttpResponseMessage> -> Result<bool, HttpResponseMessage> let issuerExists = function | Ok _ -> Ok true | Error (resp : HttpResponseMessage) -> if resp.StatusCode = HttpStatusCode.NotFound then Ok false else Error resp
Once again, I've managed to write a function more generic than its name implies. This seems to happen to me a lot.
In this context, what matters more is that this is another pure function - which also explains why it was so easy to unit test.
It turned out that I'd now managed to extract all complexity to pure, testable functions. What remained was composing them together.
First, a couple of private helper functions:
// Task<Result<'a, 'b>> -> Task<Result<unit, 'b>> let ignoreOk x = TaskResult.map (fun _ -> ()) x // ('a -> Task<Result<'b, 'c>>) -> Idempotent<'a> -> Task<Result<unit, 'c>> let whenMissing f = Idempotent.fold (f >> ignoreOk) (task { return Ok () })
These only exist to make the ensuing composition more readable. Since they both have a cyclomatic complexity of 1, I found that it was okay to skip unit testing.
The same is true for the final composition:
let! comp = taskResult { let (issuer, identity, user) = gatherData dto let! issuerExists = Issuer.get client issuer.Id |> Task.map Fusebit.issuerExists let! userExists = User.find client (IdentityCriterion identity) |> TaskResult.map (not << List.isEmpty) do! Idempotent.establish issuer issuerExists |> whenMissing (Issuer.create client) do! Idempotent.establish user userExists |> whenMissing (User.create client) }
The comp
composition starts by gathering data from an incoming dto
value. This code snippet is part of a slightly larger Controller Action that I'm not showing here. The rest of the surrounding method is irrelevant to the present example, since it only deals with translation of the input Data Transfer Object and from comp
back to an IHttpActionResult
object.
After a little pure hors d'œuvre the sandwich arrives with the first impure actions: Retrieving the issuerExists
and userExists
values from the Fusebit API. After that, the sandwich does fall apart a bit, I admit. Perhaps it's more like a piece of smørrebrød...
I could have written this composition with a more explicit sandwich structure, starting by exclusively calling Issuer.get
and User.find
. That would have been the first impure layer of the sandwich.
As the pure centre, I could then have composed a pure function from Fusebit.issuerExists
, not << List.isEmpty
and Idempotent.establish
.
Finally, I could have completed the sandwich with the second impure layer that'd call whenMissing
.
I admit that I didn't actually structure the code exactly like that. I mixed some of the pure functions (Fusebit.issuerExists
and not << List.isEmpty
) with the initial queries by adding them as continuations with Task.map
and TaskResult.map
. Likewise, I decided to immediately pipe the results of Idempotent.establish
to whenMissing
. My motivation was that this made the code more readable, since I wanted to highlight the symmetry of the two actions. That mattered more to me, as a writer, than highlighting any sandwich structure.
I'm not insisting I was right in making that choice. Perhaps I was; perhaps not. I'm only reporting what motivated me.
Could the code be further improved? I wouldn't be surprised, but at this time I felt that it was good enough to submit to a code review, which it survived.
One possible improvement, however, might be to parallelise the two actions, so that they could execute concurrently. I'm not sure it's worth the (small?) effort, though.
I'm always keen on examples that challenge the notion of the impureim sandwich architecture. Usually, I find that by taking a slightly more holistic view of what has to happen, I can make most problems fit the pattern.
The most common counterargument is that subsequent impure queries may depend on decisions taken earlier. Thus, the argument goes, you can't gather all impure data up front.
I'm sure that such situations genuinely exist, but I also think that they are rarer than most people think. In most cases I've experienced, even when I initially think that I've encountered such a situation, after a bit of reflection I find that I can structure the code to fit the functional core, imperative shell architecture. Not only that, but the code becomes simpler in the process.
This happened in the example I've covered in this article. Initially, I though that ensuring that a Fusebit user exists would involve a process as illustrated in the first of the above flowcharts. Then, after thinking it over, I realised that defining a simple discriminated union would simplify matters and make the code testable.
I thought it was worthwhile sharing that journey of discovery with others.


|
Auxiliary Arithmetic Algorithms
|
Functions | |
| template<typename InputIterator1 , typename InputIterator2 , typename T = value_type_i<InputIterator1>> | |
| T | aaa::euclidean::dot (InputIterator1 first_left, InputIterator1 last_left, InputIterator2 first_right, T init=T{}) |
| template<typename Container1 , typename Container2 , typename T = value_type<Container1>> | |
| T | aaa::euclidean::dot (const Container1 &a, Container2 &b, T init=T{}) |
| template<typename InputIterator , typename T = value_type_i<InputIterator>> | |
| T | aaa::euclidean::squared_norm (InputIterator first, InputIterator last, T init=T{}) |
| template<typename Container , typename T = value_type<Container>> | |
| T | aaa::euclidean::squared_norm (const Container &a, T init=T{}) |
| template<typename InputIterator , typename T = value_type_i<InputIterator>> | |
| sqrt_type_t< T > | aaa::euclidean::norm (InputIterator first, InputIterator last, T init=T{}) |
| template<typename Container , typename T = value_type<Container>> | |
| sqrt_type_t< T > | aaa::euclidean::norm (const Container &a, T init=T{}) |
| template<typename InputIterator1 , typename InputIterator2 , typename T = value_type_i<InputIterator1>> | |
| T | aaa::euclidean::squared_distance (InputIterator1 first_left, InputIterator1 last_left, InputIterator2 first_right, T init=T{}) |
| template<typename Container1 , typename Container2 , typename T = value_type<Container1>> | |
| T | aaa::euclidean::squared_distance (const Container1 &left, const Container2 &right, T init=T{}) |
| template<typename InputIterator1 , typename InputIterator2 , typename T = value_type_i<InputIterator1>> | |
| sqrt_type_t< T > | aaa::euclidean::distance (InputIterator1 first_left, InputIterator1 last_left, InputIterator2 first_right, T init=T{}) |
| template<typename Container1 , typename Container2 , typename T = value_type<Container1>> | |
| sqrt_type_t< T > | aaa::euclidean::distance (const Container1 &left, const Container2 &right, T init=T{}) |
Euclidean space is also known as L-2 space. It defines the the following functions:
We represent mathematical vectors as either containers, or ranges of iterators. The functions in this module take one or two vectors as input and output a single scalar. This is sometimes refered to as a reduction or fold operation.
| sqrt_type_t<T> aaa::euclidean::distance | ( | InputIterator1 | first_left, |
| InputIterator1 | last_left, | ||
| InputIterator2 | first_right, | ||
| T | init = T{} |
||
| ) |
The Euclidean distance of two vectors. Each vector is represented by a range of iterators. Returns a value of a floating point type following the same convention as std::sqrt
.
| sqrt_type_t<T> aaa::euclidean::distance | ( | const Container1 & | left, |
| const Container2 & | right, | ||
| T | init = T{} |
||
| ) |
The Euclidean distance of two vectors. Each vector is represented by a container. The two containers should have the same size. Returns a value of a floating point type following the same convention as std::sqrt
.
| T aaa::euclidean::dot | ( | InputIterator1 | first_left, |
| InputIterator1 | last_left, | ||
| InputIterator2 | first_right, | ||
| T | init = T{} |
||
| ) |
The dot product of two vectors. Each vector is represented by a range of iterators.
| T aaa::euclidean::dot | ( | const Container1 & | a, |
| Container2 & | b, | ||
| T | init = T{} |
||
| ) |
The dot product of two vectors. Each vector is represented by a container. The two containers should have the same size.
| sqrt_type_t<T> aaa::euclidean::norm | ( | InputIterator | first, |
| InputIterator | last, | ||
| T | init = T{} |
||
| ) |
The Euclidean norm of a vector. The vector is represented by a range of iterators. Returns a value of floating point type following the same convention as std::sqrt
.
| sqrt_type_t<T> aaa::euclidean::norm | ( | const Container & | a, |
| T | init = T{} |
||
| ) |
The Euclidean norm of a vector. The vector is represented by a container. Returns a value of floating point type following the same convention as std::sqrt
.
| T aaa::euclidean::squared_distance | ( | InputIterator1 | first_left, |
| InputIterator1 | last_left, | ||
| InputIterator2 | first_right, | ||
| T | init = T{} |
||
| ) |
The squared Euclidean distance of two vectors. Each vector is represented by a range of iterators.
| T aaa::euclidean::squared_distance | ( | const Container1 & | left, |
| const Container2 & | right, | ||
| T | init = T{} |
||
| ) |
The squared Euclidean distance of two vectors. Each vector is represented by a container. The two containers should have the same size.
| T aaa::euclidean::squared_norm | ( | InputIterator | first, |
| InputIterator | last, | ||
| T | init = T{} |
||
| ) |
The squared Euclidean norm of a vector. The vector is represented by a range of iterators.
| T aaa::euclidean::squared_norm | ( | const Container & | a, |
| T | init = T{} |
||
| ) |
The squared Euclidean norm of a vector. The vector is represented by a container.


|
Bosch XDK110 Solace MQTT App
2.0.1
MQTT Reference Application for the Bosch XDK110
|
This module defines and gives access to the current version of the Solace MQTT app. More...
Files | |
| file | AppVersion.c |
| file | AppVersion.h |
Macros | |
| #define | BCDS_MODULE_ID SOLACE_APP_MODULE_ID_APP_VERSION |
Functions | |
| uint8_t | SolaceAppVersion_GetMajor (void) |
| Get the major version of the Solace App. More... | |
| uint8_t | SolaceAppVersion_GetMinor (void) |
| Get the minor version of the Solace App. More... | |
| uint8_t | SolaceAppVersion_GetPatch (void) |
| Get the patch version of the Solace App. More... | |
This module defines and gives access to the current version of the Solace MQTT app.
| #define BCDS_MODULE_ID SOLACE_APP_MODULE_ID_APP_VERSION |
< undefine any previous module id
| uint8_t SolaceAppVersion_GetMajor | ( | void | ) |
Get the major version of the Solace App.
| uint8_t SolaceAppVersion_GetMinor | ( | void | ) |
Get the minor version of the Solace App.
| uint8_t SolaceAppVersion_GetPatch | ( | void | ) |
Get the patch version of the Solace App.


- Budget Manager App -
Money limit for spending:
0
Enter Amount of money you spent:
Spent money
Total:
0


Wikipedia Page on Spatial Analysis Software
February 2, 2010
Dear Spatial Analysis community:
As a by-product of last summer's Workshop in India, the GeoDa Center for Geospatial Analysis and Computation has started a new WikiPedia page to list Spatial Analysis Software. As it is now, it is just a beginning with a small subset of it, but the goal is to end up with a comprehensive list of packages written to enable spatial analysis.
It is structured as a sortable table with the following columns: 'Package' (name), 'Free of charge' (yes/no), 'Operating Systems' (platform), 'Developer Institution/person', 'Website' (link to the projects page), 'Field of interest (if any specific)', 'Main Features', 'Language' (programming language use), 'License' (in order to know degree of freedom in the code).
To edit, just click on the tab 'edit this page' on the top of the page and edit. All the changes go live, so make sure you want to do that change before clicking on "Save changes". If you want to add a new package (row in the table), it is recommended to copy and paste the block of an existing one and edit the new one there.
We would like to invite you all to take a look at it and help improve it. The beginning of the page is like pushing a snowball from the top of the hill, what it is to come will be up to the community!


90 exploratory mining licences granted by gov't since March 2018
Mining Minister, Robert Montague, says the Ministry has granted some 90 exploratory licences for semiprecious minerals such as cobalt, copper, gold, silver and zinc, since March 2018.
“Right now, almost every square inch of Jamaica is under a prospecting licence for some kind of mineral. The beauty of it, is that most of the companies that are prospecting… are Jamaican-owned. So if [for example] gold is found… in commercial quantities, the profits will stay here,” he said.
He assured, however, that the Government is encouraging and facilitating the exploitation of minerals “in a very sustainable and structured way”.
He was speaking at a Corporate Governance Seminar at the Terra Nova All-Suite Hotel in St Andrew on Thursday.
Montague said that in a bid to encourage the mining of semiprecious minerals, the Ministry’s Mines and Geology Division hosted a series of workshops and training seminars for industry stakeholders.
These, he indicated, formed part of the three-year €13.1-million African, Caribbean and Pacific-European Union (ACP-EU) Development Minerals Programme.
This capacity-building initiative, conceptualised by the ACP Group of States, aims to enhance the profile and improve the management of development minerals.
These include industrial minerals, construction materials, and dimension and semiprecious stones.
Montague noted that the programme has benefited local jewellery makers who are now utilising semiprecious stones, “which is a huge market”.


LOVE IS THE DEVIL (1998) A Film Reivew by Ted Prigge Copyright 1998 Ted Prigge
Writer/Director: John Maybury Starring: Derek Jacobi, Daniel Craig, Anne Lambton, Tilda Swinton, Adrian Scarborough, Karl Johnson, Annabel Brooks, Richard Newbould
"Love is the Devil" is a challenging film, munundating its audience with wild imagery and a plot structure that disallows a plot, perhaps in an attempt to get us to know the artist's psyche rather than the artist's lifeline. Watching it, I was enthralled with the look of the film, the way the director shot everything like it was looking through a bizarre, personalized filter. Everything looks like it is not how life looks like but how painter Francis Bacon, the film's subject, looked at it personally.
But while I was engrossed, I stumbled upon my thoughts halfway through the film, awakened from my trance by some inner distraction, and began to try and follow what's going on. Exactly what was I looking at? Watching this film, I wasn't sure if it was the most insightful film I had ever seen or the most vacuous. Directed (and written) by John Maybury, "Love is the Devil" is stylish masterpiece for the senses. Everything looks originally bizarre and perplexing. The camera angles are ferociously askew, and the close-ups are uncomfortably too close. The editing is deft, occasionally cutting away to something bizarre every couple seconds, but other times holding on a shot for so long that you wonder if the audience is not supposed to be voyeurs, or rather, intruders to Bacon's world and psyche.
As such, there is no real story. I've not heard much about Francis Bacon that I didn't read prior to the film, but what I learned was this: he was a painter in England who reached his peak during the 60s and 70s, drawing hideously bizarre drawings of carnage and the like. He was one of the first to really come out of the closet, and in interviews, he was notoriously drunk yet incredibly witty. As played by great Shakesperean actor Derek Jacobi, he's like a foppish and self-absorbed cross between Oscar Wilde and Nero. He lives life the way he wants to live it, to the disatisfaction of those who have the privelege of being really close to him. It's as if he were taking delight in the destruction of others and maybe himself ("Champagne for my real friends, and pain for my sham friends," he says one night at the bar he frequents).
"Love is the Devil" chronicles the latter part of his life. Bacon, well-known in his mid-life, awakens one night when he hears a man tumble through his ceiling window and land on the floor. He walks in, unafraid of what he finds, and discovers a thief, George Dyer (Daniel Craig). Bacon gives him an offer: if he spends the night with him, he can take anything he wants in the morning. George agrees to this, and off to bed he goes, but ends up staying with him, for whatever reason. The film shows their lives together, at least in reference to one another.
While creating Bacon's world of friends (like "High Art," this film minors in showing a certain group of people who radiate a connection that is not shown but is understood), the film shows the relationship of Bacon and George as it remains rather stagnant. Bacon is haughty and bizarre; George is simple and doesn't understand Bacon in the least, especially not his paintings. While watching this, that's basically all I thought was there. The film has a hypnotic feel, free of any restraints of form, and is shot so uniquely that I felt my attention was almost entirely on the way this film was made rather than what it is about.
Once the film is over, it's easier to piece it together. I kept on thinking about this film, wondering what the point to all of it was. Someone doesn't merely make a film of all style and no substance at all, and if they do, they do it by accident, but still allow some substance to creep in. Thinking about it, I remembered how the two fed off of eachother. I thought about how Bacon was a masochist, in love with cruelty (in one scene, he watches a boxing match with a orgiastic delight, and lets out a squeal of pleasure when blood from the one boxer's head splashes across his face; in another scene, he masturbates to the Odessa Steps sequence of Eisenstein's "Battleship Potemkin"), and perhaps he drove George too far in his delight for pain. He drove him over the edge, and for him that was love, even if it wasn't for George. I guess that explains the title. A bit.
That's great and all, but I almost wish the film was devoid of any meaning. I wish it hadn't reduced itself to making some point about humanity, about how love is the most selfish thing in the world (and it is, if you look at it a certain way). Or maybe if it had avoided any meaning about humanity and merely drove itself into being the one film that was truly inside one man's twisted pysche. It's almost always best to obtain insights from looking at one man's uniqueness than it is forcing universality down an audience's throat. That way you don't reduce your film to something it's just not.
I can't say I totally enjoyed "Love is the Devil," though. Despite all of the things I respect about this movie, it's still rather uncomfortable to sit through. Even at a normally trite length of ninety minutes, the film still seems like an arduous task to sit through, especially after an exhausting first hour. Though hypnotic, it still almost seems gimmicky and even redundant at times, as if it were taking advantage of one man's truly bizarre nature but not doing anything deeper with it. As such, I respect the way the film looks. It's beautiful and painstakingly crafted so that, along with "What Dreams May Come" and "Dark City," it's the year's most visually stunning film. In fact, if a better script had been forged, I'd almost compare it in visual power to a Peter Greenaway film, complete with similar haunting images that stick in the mind forever. And with a dymanite performance by Derek Jacobi, it has the comic and distanced tone that it needs. I just wish it had been more than mostly style and just a hair bit of substance. Then I would have had something to hold me over even now.
MY RATING (out of 4): ***
Homepage at: http://www.geocities.com/Hollywood/Hills/8335/
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Rivaldo slams Brazil for ‘disrespecting’ number 10 shirt by assigning it to Lucas Paqueta
by HarigovindBrazil legend Rivaldo has slammed the national team for allegedly “disrespecting” the iconic number 10 shirt, by assigning to AC Milan player Lucas Paqueta ahead of the recent game against Argentina.
Rivaldo said that he was “very sad” to see the iconic jersey treated without proper respect, adding that such a young and inexperienced player like Paqueta should not have been allowed to wear the shirt so soon.
“I watched the match between Brazil v Argentina and was very sad to see what happened with the number 10 shirt,” the 2002 FIFA World Cup winner wrote on Instagram.
“They gave the shirt to Paqueta against Argentina. A shirt that is respected worldwide. This shirt is not meant to be on the bench, let alone go off at half-time, because it is the shirt the world knows and respects because it was worn and honoured by Pele, Rivelino, Zico, Rivaldo, Kaka, Ronaldinho, Neymar.
“The player is not to blame, but the coaching staff is, because they know the weight of this shirt and also that it could burn the 22-year-old, who can have a great future with the Brazilian team,” he further added, before concluding:
“We all know that Brazil and Argentina will never be a friendly match.”
It needs to be mentioned here that the ex-Brazil attacker’s words are not meant to defame 22-year-old Paqueta.
The AC Milan midfielder is an exciting prospect for the future, and Rivaldo’s words were merely aimed at the decision to hand the youngster the important shirt number – it is not Paqueta’s mistake in any manner.
Speaking about the game as such, Argentina won the hotly-contested event thanks to a goal from Lionel Messi himself.
Brazil’s next game is against South Korea on 19th November.


| Methods' Summary |
| getTag |
returns an additional string stored in the data pilot table.
|
| setTag |
sets an additional string stored in the data pilot table.
|
| getSourceRange |
returns the cell range containing the data for the data pilot table.
|
| setSourceRange |
sets the cell range containing the data for the data pilot table.
|
| getFilterDescriptor |
returns the filter descriptor specifying which data from the
source cell range are used for the data pilot table.
|
| getDataPilotFields |
returns the collection of all the data pilot fields.
|
| getColumnFields |
returns the collection of the data pilot fields used as column fields.
|
| getRowFields |
returns the collection of the data pilot fields used as row fields.
|
| getPageFields |
returns the collection of the data pilot fields used as page fields.
|
| getDataFields |
returns the collection of the data pilot fields used as data fields.
|
| getHiddenFields |
returns the collection of the data pilot fields not used as
column, row, page, or data fields.
|
| Methods' Details |
getTag
- Description
- returns an additional string stored in the data pilot table.
|
|
setTag
| void |
| setTag( |
[in] string |
aTag ); |
- Description
- sets an additional string stored in the data pilot table.
|
|
getSourceRange
- Description
- returns the cell range containing the data for the data pilot table.
|
|
setSourceRange
- Description
- sets the cell range containing the data for the data pilot table.
|
|
getFilterDescriptor
- Description
- returns the filter descriptor specifying which data from the
source cell range are used for the data pilot table.
|
|
getDataPilotFields
- Description
- returns the collection of all the data pilot fields.
|
|
getColumnFields
- Description
- returns the collection of the data pilot fields used as column fields.
- See also
- DataPilotFields
|
|
getRowFields
- Description
- returns the collection of the data pilot fields used as row fields.
- See also
- DataPilotFields
|
|
getPageFields
- Description
- returns the collection of the data pilot fields used as page fields.
- See also
- DataPilotFields
|
|
getDataFields
- Description
- returns the collection of the data pilot fields used as data fields.
- See also
- DataPilotFields
|
|
getHiddenFields
- Description
- returns the collection of the data pilot fields not used as
column, row, page, or data fields.
- See also
- DataPilotFields
|
|
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


Chart properties
Render as Canvas
Exporting options
File name
Mode
Server side
Client side
Angle
0
90
-90
180
Orientation
Portrait
Landscape
Export chart as
Print the chart


Inclusive, open platform between China and US needed for technology fluidity
by Global TimesPhoto:Xinhua
China and the US, as two responsible nations, should work together to build an inclusive and open platform supporting innovation and global economic development, Huai Jinpeng, executive vice president of the China Association for Science and Technology, said at the New Economy Forum held in Beijing on Friday.
The world's science community should call for borderless innovation and limitless exchanges, he said.
"Faced with asymmetrical information and various other problems, we need both scientific governance and technological development. In this regard, all countries should work together, be open and cooperative to increase the fluidity of technologies," Huai said.
"It's believed that technological innovation will boost economic growth as well as the advancement of society," he said, noting that technological innovation is needed to tackle challenges like disease, poverty and environment issues.
Global Times
RELATED ARTICLES:


Tacos de Azada $9.50
Two grilled corn tortillas filled with
grilled meat, onions, and cilantro.
Enchiladas blancas $8.50
One chicken enchilada and one beef
enchilada topped with our cheese sauce, lettuce, sour cream,
tomatoes, and rice
|
Tacos Cero $10
Two grilled flour tortilla filled with
grilled meat, fresh Pico de Gallo, avocado, and creamy chipotle
sauce.
 Held together by a pepper ring and topped with
our homemade creamy cheese sauce.
Chimichanga $10.50
Two fried rolled up flour tortillas
filled with chicken. Topped with cheese sauce, lettuce, tomato,
sour cream and guacamole
Flautas $11
Three fried and rolled corn tortillas
filled with chicken, topped with Chipotle cream sauce, lettuce,
shredded cheese, Pico de Gallo, and rice
Huevos Con Chorizo $9.50
Three eggs scrambled with chorizo
(Homemade Mexican Sausage). Comes with flour tortillas.
|
Nachos noches $10
Chips topped with ground beef, shredded
chicken, beans, cheese, lettuce, tomatoes, and sour cream.
Heuco Mundo Acp $10
Grilled chicken, steak strips, shrimp,
onions, bell peppers, and tomatoes over rice covered with
cheese sauce. Comes with flour tortillas.
|
Desserts
Flan $3.50
Mexican Custard with whipped cream and
cherry on top
Churros $4
Three flour dough sticks deep fried.
Covered with cinnamon, sugar, chocolate syrup, whipped cream
and cherry on top
Chimi Cheesecake $5
A rolled-up deep fried flour tortilla
filled with cheesecake. Cover with sugar cinnamon, chocolate
syrup, whipped cream and cherry on top
Fried Ice Cream $4.50
A fried flour tortilla bowl filled with
a vanilla ice cream ball covered with cereal that’s deep
fried. Covered with honey, cinnamon, whipped cream, chocolate
syrup and cherry on top.
|
|


| 1 | /* | |
| 2 | * Copyright 2005-2014 the original author or authors. | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | ||
| 17 | package org.springframework.ws.test.client; | |
| 18 | ||
| 19 | import java.io.IOException; | |
| 20 | import java.net.URI; | |
| 21 | ||
| 22 | import org.springframework.ws.WebServiceMessage; | |
| 23 | import org.springframework.ws.WebServiceMessageFactory; | |
| 24 | ||
| 25 | /** | |
| 26 | * Implementation of {@link ResponseCreator} that holds an error message. | |
| 27 | * | |
| 28 | * @author Arjen Poutsma | |
| 29 | * @author Lukas Krecan | |
| 30 | * @since 2.0 | |
| 31 | */ | |
| 32 | class ErrorResponseCreator implements ResponseCreator { | |
| 33 | ||
| 34 | private final String errorMessage; | |
| 35 | ||
| 36 | ErrorResponseCreator(String errorMessage) { | |
| 37 |
1
1. |
this.errorMessage = errorMessage; |
| 38 | } | |
| 39 | ||
| 40 | @Override | |
| 41 | public WebServiceMessage createResponse(URI uri, | |
| 42 | WebServiceMessage request, | |
| 43 | WebServiceMessageFactory factory) throws IOException { | |
| 44 | // Do nothing | |
| 45 |
1
1. createResponse : mutated return of Object value for org/springframework/ws/test/client/ErrorResponseCreator::createResponse to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return null; |
| 46 | } | |
| 47 | ||
| 48 | String getErrorMessage() { | |
| 49 |
2
1. getErrorMessage : replaced return value with "" for org/springframework/ws/test/client/ErrorResponseCreator::getErrorMessage → KILLED 2. getErrorMessage : mutated return of Object value for org/springframework/ws/test/client/ErrorResponseCreator::getErrorMessage to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return errorMessage; |
| 50 | } | |
| 51 | } | |
Mutations | ||
| 37 |
1.1 |
|
| 45 |
1.1 |
|
| 49 |
1.1 2.2 |


--- layout: default ---
We are Our Revolution Alaska, an all-volunteer group of Alaskans working to elect candidates who will strive to achieve the goals which inspired so many of us in 2016.
We are organizing on a local level for putting salmon first, rapid 100% renewable energy targets, and single-payer health care. Respect and equal protection under the law for all people really means for ALL people, and not just the privileged. It means respect for indigenous peoples. It means protection from the surveillance, violence, and draconian immigration procedures of those tasked with governance. It means freedom from the clutches of poverty and inadequate medical care. It means a future for all of us and for our children.
Will you help us build a movement for progressive politics in Alaska?


Dashboard
Speaking
Your Proposals
| Title | Session type | Status | Actions |
|---|---|---|---|
| The Learning Process | 25 minute talk | Accepted | Edit Manage Additional Speakers |
Sponsorship
If you or your organization would be interested in sponsorship opportunities, use our online form to apply to be a sponsor.
As staff, you can directly add a sponsor if the organization isn't applying themselves.
Reviews
Reviews by Section
- All
- Reviewed by you
- Not Reviewed by you
- All
- Reviewed by you
- Not Reviewed by you


CENTRAL GOVERNMENT OF INDIA
CENTRAL GOVERNMENT OF INDIA
The National Social Assistance Programme (NSAP) is a Centrally Sponsored Scheme of the Government of India that provides financial assistance to the elderly, widows and persons with disabilities in the form of social pensions.
The National Assistance Program consists of five sub-schemes:


CAPS LOCK PIZZA PARLOUR!

MAKE ME A PIZZA!!!
YOUR
PIZZA!
WILL BE CUT INTO:
SLICES!


Ferry Loading II
问题描述 :
Before bridges were common, ferries were used to transport cars across rivers. River ferries, unlike their larger cousins, run on a guide line and are powered by the river’s current. Cars drive onto the ferry from one end, the ferry crosses the river, and the cars exit from the other end of the ferry.
There is a ferry across the river that can take n cars across the river in t minutes and return in t minutes. m cars arrive at the ferry terminal by a given schedule. What is the earliest time that all the cars can be transported across the river? What is the minimum number of trips that the operator must make to deliver all cars by that time?
There is a ferry across the river that can take n cars across the river in t minutes and return in t minutes. m cars arrive at the ferry terminal by a given schedule. What is the earliest time that all the cars can be transported across the river? What is the minimum number of trips that the operator must make to deliver all cars by that time?
输入:
The first line of input contains c, the number of test cases. Each test case begins with n, t, m. m lines follow, each giving the arrival time for a car (in minutes since the beginning of the day). The operator can run the ferry whenever he or she wishes, but can take only the cars that have arrived up to that time.
输出:
For each test case, output a single line with two integers: the time, in minutes since the beginning of the day, when the last car is delivered to the other side of the river, and the minimum number of trips made by the ferry to carry the cars within that time.
You may assume that 0 < n, t, m < 1440. The arrival times for each test case are in non-decreasing order.
样例输入:
2 2 10 10 0 10 20 30 40 50 60 70 80 90 2 10 3 10 30 40
样例输出:
100 5 50 2
解题代码:
//* @author<EMAIL_ADDRESS>import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int num = in.nextInt(); for(int i = 0; i< num; i++) { int n = in.nextInt(); int t = in.nextInt(); int m = in.nextInt(); int[] time = new int[m]; int starttime = 0; for(int j = 0; j< m; j++) { time[j] = in.nextInt(); } if(m % n == 0) { starttime = time[n-1]; for(int k = 1; k< m/n; k++) { if(time[n*(k+1)-1] > starttime + 2*t) starttime = time[n*(k+1)-1]; else starttime += 2*t; } } else { starttime = time[m%n -1]; int p = m/n; int index = m%n -1; for(int k = 0; k< p; k++) { if(time[n*(k+1)+ index] > starttime + 2*t) starttime = time[n*(k+1)+ index]; else starttime += 2*t; } } int result = (int)Math.ceil(1.0*m/n); System.out.println(starttime+t+" "+ result); } } }
(adsbygoogle = window.adsbygoogle || []).push({});
和编译器有关吧，我用的g++正常。头文件可能还需要一个<string.h>
网站不错
约瑟夫也用说这么长……很成熟的一个问题了，分治的方法解起来o(n)就可以了，有兴趣可以看看具体数学的第一章，关于约瑟夫问题推导出了一系列的结论，很漂亮
已更正。
能不能说下这个是用的什么算法策略？
在方法1里面：
//遍历所有的边，计算入度
for(int i=0; i<V; i++)
{
degree = 0;
for (j = adj .begin(); j != adj .end(); ++j)
{
degree[*j]++;
}
}
为什么每遍历一条链表，要首先将每个链表头的顶点的入度置为0呢？
比如顶点5，若在顶点1、2、3、4的链表中出现过顶点5，那么要增加顶点5的入度，但是在遍历顶点5的链表时，又将顶点5的入度置为0了，那之前的从顶点1234到顶点5的边不是都没了吗？
补充：此算法求出的不一定是最优解，之前理解错了
还是有些难度的！
学算法中的数据结构学到一定程度会乐此不疲的，比如其中的2－3树，类似的红黑树，我甚至可以自己写个逻辑文件系统结构来。
#include <cstdio>
int main() {
//answer must be odd
int n, u, d;
while(scanf("%d%d%d",&n,&u,&d)==3 && n>0) {
if(n<=u) { puts("1"); continue; }
n-=u; u-=d; n+=u-1; n/=u;
n<<=1, ++n;
printf("%dn",n);
}
return 0;
}
正解，我的方法占用的内存更多些
感谢分享 学习了`(*∩_∩*)′
L（X [0 .. M-1]，Y [0 .. N-1]）= 1 + L（X [0 .. M-2]，Y [0 .. N-1]）这个地方也也有笔误
应改为L（X [0 .. M-1]，Y [0 .. N-1]）= 1 + L（X [0 .. M-2]，Y [0 .. N-2]）
理解错了。。。。。谢谢楼主~~


"Ally McBeal " has
lots of critics these days. Lets evaluate the charges. Some say the show is unrealistic. Its true
that it is not a mirror image of any existing law firm, but art
always gives a heightened image of everyday reality; otherwise we wouldnt watch.
Just as there is no quartet of friends in Manhattan like Jerry, Elaine, George, and
Kramer, there is not "real" counterpart to the firm of Cage and Fish, but it is
because of its excesses that "Ally" is able to provide us us with a biting
satire of modern corporate culture, a social system which includes but goes well beyond
the practice of law. It points out that lots of talented people work extremely hard for no
goals more lofty than professional prestige and financial success. For them the job too
often substitutes for a satisfying personal life both in terms of meaningful relationships
and just plain fun. "Ally" hints at an alternative "reality" where
people end every work day with drinks and dancing with friends. And Ally reminds us of the
importance of "silly." Is it appropriate for a young lawyer to sing back-up to
Tina Turner? Sure-- if shes got the moves. So I would vote "thumbs down"
on the "realist" critique.
But Ally is so neurotic.
Whats so unrealistic about that? One of the most deep seated neuroses in modern
corporate culture is the repression of anxiety and depression. People work so hard to be
"positive" and "upbeat." Yet often its not very convincing. I
think they would benefit from more a little more anxiety, worrying whether the time
commitments necessary to professional success rob them of the opportunity for a satisfying
emotional life. Ally always puts the personal first. Isnt this a "healthy"
neurosis?
But then critics say there
isnt any law in "Ally." Actually almost every episode involves a lawsuit
of some sort. And the legal dispute always has political content, raising the issue of the
connection between law and justice. Its true that "Ally" creator David
Kelley has not given Ally McBeal herself much of a role in these issues. Kelley usually
assigns the "justice brief" to Allys friend and alter ego, John Cage. Who
is Cage? Well, first of all, hes even more neurotic than Ally. I guess mere
mention of his tree frog fetish is sufficient documentation of this fact. Secondly,
hes a very talented lawyer. Lastly, his clients usually tend to be
"outsiders" like himself who are trying find a way to fit into an intolerant
corporate culture. Cages courtroom strategy is always the same. Ignore the law and
speak to the heart.
In a recent episode, his
clients were an African-American transvestite and a man who suffered from Turetts
syndrome which caused him to whistle and clap at inappropriate times. These two had been
fired by a design firm, not because their design work was not up to par, but because their
appearance presented the wrong image for the business. This is the quintessential Ally
McBeal case: a lawsuit for wrongful termination where the plaintiff is someone who is
being fired because of some "weirdness" not directly related to his or her
ability to do the job.
Cage is a brilliant
courtroom lawyer whose arguments always sound in equity rather than law. He gives the jury
a beautiful little homily about how it feels to be a "weirdo" persecuted by your
high school peers, but that the reward is that as an adult your eccentricities will be
accepted if you are productive. Cage is clearly speaking about himself as much as his
clients. He is telling us that weirdness is wonderful, a social asset to be protected.
Its essential to a democracy that citizens be allowed to define themselves rather
than be forced to accept the majority cultures definition. Isnt this a message
which is important that we all hear? In a neat counterpoint, Kelley also shows how
difficult a virtue tolerance is to practice as opposed to preach. Ally has to confess that
she turned down three otherwise attractive suitors because they didnt fit her
cultural prejudices; one because he was "homeless, another because she he had a
horse-like laugh, and a third because he was bi-sexual.
So I think that most of the
criticisms of "Ally" are simply wrong, but there is another criticism which I
think is right on point. Ally herself is never shown as a competent professional.
Its always Cage making the eloquent jury summation while Ally makes small talk back
at the office. Even worse, shes often engaging in inappropriate behavior in court.
In one recent episode, while listening to gripping testimony of a murder, she continually
emitted oohs and aahs as if she were listening to a ghost story around a camp fire instead
of assisting at a trial. It would be one thing if Ally were shown to be an great lawyer
who has a zany side, but zany seems Allys only side. Shes portrayed as a
yuppie Lucy Ricardo. Since young female lawyers are always battling to be taken seriously
as professionals, I wonder why Kelley indulges this stereotype.
Here the contrast with
Lindsey Dole on Kelleys "The Practice" seems especially striking.
Lindseys neurotic too, but shes also helluva lawyer. In a recent episode, she
faced down a prejudiced judge by staging a walkout of the entire defense team. The judge
threatened contempt, but she quickly replied shed rather go to jail for contempt
than accept second class treatment. He caved in. Good, tough lawyering is not
gender-specific. Of course, Lindsay has her neuroses too. She appears to have adopted the
"warrior" model of lawyering to an extreme. Its hard to imagine her
discussing much other than trial tactics with her boyfriend Bobby Donal.
Maybe Kelley believes that
the quirkiness of Ally and the competence of Lindsay cant be combined. If so, he
might rewatch "Adams Rib", paying especial attention to the Katherine
Hepburn character. There we see a woman lawyer who is smart, tough, passionate, and
sexy attributes all lawyers should aim for.


ANACONDA
A Film Review by Brian Takeshita
Rating: *1/2 out of ****
Well, what are you going to expect? It's a movie about a big snake that eats people. That's what I should have been thinking when I viewed this film, because maybe then I would have enjoyed myself more.
ANACONDA is about a documentary film crew sailing down a South American river. Led by anthropologists Dr. Steven Cale (Eric Stolz) and Terri Flores (Jennifer Lopez), the crew is attempting to locate a lost tribe of natives. Along the way, they find poacher Paul Sarone (Jon Voight), and become unwillingly embroiled in his quest to capture the elusive anaconda. To simply say that this is the world's largest snake wouldn't be doing it justice, since the anaconda in this movie is at least two feet wide. If this isn't a good reason to avoid picking up hitchhikers, I don't know what is.
At the beginning of ANACONDA, we find that Flores and Cale have had some kind of relationship in the past, but that seems to be more or less over now. I expected that fact to play a key part somewhere down the line, but it ended up being a set-up for nothing. Cale chokes on a deadly wasp (don't ask me how that happens - I don't know) and is put out of action, relegated to being the person whom the rest of the film crew must get back to civilization for medical help. This minimally helps to add a sense of urgency for the plot, since this goal now comes in direct conflict with Sarone's plan to capture the snake. However, this is negated by the fact that Cale seems to get better by himself about halfway through the film, and in any event still results in zero payoff from the relationship angle.
 In this movie, they're both. Since this description applies to all the characters except Sarone, it's hard to find someone to root for. You're supposed to back the good guys, but you really end up cheering for Sarone because he's smarter than everyone else.  At times, I almost found myself rooting for the snake.
There are no standout performances here. Everyone seems to be reciting lines written for stock characters. Even Voight appears to be doing his best impression of Christopher Walken for some reason.
No matter, as in most monster movies, the snake is supposed to be the real star anyway. In most of the scenes, the snake is computer generated, and the effects crew did a decent job of making it look real. However, the realism is thrown off by some pretty unrealistic occurrences. Sometimes, for example, the snake just moves too fast. It catches a guy jumping off of a waterfall, for crying out loud. Then there's another scene where the snake eats one of the characters, and we see the snake's skin drawn so tightly over its prey that we can see the victim's pained expression from within the snake's belly.
A testimony to the film's bad direction is the inclusion of a scene early on the in the film, where we get to see just how dangerous the mighty anaconda is. In a scene totally unrelated to anything else, we are witness to the big snake winning a showdown with a panther. The anaconda wraps itself around the powerful feline as if it were a stuffed animal and squeezes it so hard, one of the panther's eyeballs pops out. Eeeewwwww. Above and beyond the sick factor, however, this scene surprised me because it actually showed the face of the snake before a quarter of the movie had even passed. In films like these, a sense of mystery surrounding the monster must be maintained. If the characters are reacting to something they fear more than see, we as an audience must experience that feeling along with them. To show us the monster early on is to let us in on something the characters don't know about, and therefore allow us to get used to the danger before the pivotal moment when man and beast have their climactic showdown. In a case like that, the showdown just ends up being a letdown. When I saw the snake for the first time, I decided to give the film the benefit of the doubt and assume that the snake I saw wasn't the REAL danger. This one was just a decoy, and there was actually a BIGGER snake waiting to make its appearance just when everyone thought they were safe. No such luck. Okay, maybe ANACONDA is actually a decoy, and there's really a BETTER movie waiting to make its debut.
Review posted June 12, 1998
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Calldwr [ad7o], city, in Mandor Mountains [ap23], in Mandoria
Last updated Turn #144
Calldwr [ad7o], city, in Mandor Mountains [ap23], in Mandoria
------------------------------------------------------------------------
Routes leaving Calldwr:
Out, mountain, to Mandor Mountains [ap23], 1 day
Garrison [es0b], garrison, uncontrolled, with ten workers
Cities rumored to be nearby:
Mandor City [aa0b], in Great Forest [aq26]
Newbald [ad6k], in Mandor Mountains [ao22]
Darkwind [ad6o], in Great Forest [ao27]
Cedon [ad7v], in Plain of Tears [ap30]
Market report (tax of 25%):
trade who price qty wt/ea item
----- --- ----- --- ----- ----
buy ad7o 40 14 1 nazgul tail [319]
buy ad7o 30 10 2 gorgon livers [332]
buy ad7o 4 15 1 woven baskets [94]
sell ad7o 29 2 10 iron [79]
sell ad7o 700 1 5 Manual of Gatecraft [ek1k]
sell ad7o 925 1 5 Manual of Ranger [ir1a]
Inner locations:
Magic Tower [e34], tower, defense 20, "School of Magic"
Wimpish Construction HQ [p89], Construction Guild, defense 20
Sabo's Sanctuary [w38], tower, defense 20
Public tower [x23], Mining Guild, defense 20
Paladin Mfg Center 1 [w32], Combat Guild, defense 20
Fireball & Firkin [v74], inn, 13% damaged
A Slightly Leaning Tower [t07], Stealth Guild, defense 20
Hamlet's Tower [f25], Trading Guild, defense 20
Othello's Tower [v24], tower, defense 20
Shylock's Tower [n08], tower, defense 20
Calldwr Academy [a66], tower, defense 20
It is raining.


crbug819314: scrollIntoView from iframe.
This is a subframe of https://codepen.io/mustaqahmed/full/ZErBbqX
You should not be auto scrolled to me.


Introduction
LPegLabel is an extension of the LPeg library that provides an implementation of Parsing Expression Grammars (PEGs) with labeled failures. Labels can be used to signal different kinds of erros and to specify which alternative in a labeled ordered choice should handle a given label. Labels can also be combined with the standard patterns of LPeg.
This document describes the new functions available
in LpegLabel and presents some examples of usage.
In LPegLabel, the result of an unsuccessful matching
is a triple nil, lab, sfail
, where lab
is the label associated with the failure, and
sfail
is the suffix input where
the label was thrown.
Below there is a brief summary of the new functions provided by LpegLabel:
| Function | Description |
lpeglabel.T (l) |
Throws label l |
lpeglabel.Lc (p1, p2, l1, ..., ln) |
Matches p1 and tries to match p2
if the matching of p1 gives one of l1, ..., ln
|
%{l} |
Syntax of relabel module. Equivalent to lpeg.T(l)
|
p1 /{l1, ..., ln} p2 |
Syntax of relabel module. Equivalent to lpeg.Lc(p1, p2, l1, ..., ln)
|
relabel.setlabels (tlabel) |
Allows to specicify a table with mnemonic labels. |
For a more detailed and formal discussion about PEGs with labels please see Exception Handling for Error Reporting in Parsing Expression Grammars, Error Reporting in Parsing Expression Grammars, and A parsing machine for parsing expression grammars with labeled failures.
Functions
lpeglabel.T(l)
Returns a pattern that throws the label l
.
A label must be an integer between 0
and 63
.
The label 0
is equivalent to the regular failure of PEGs.
lpeglabel.Lc(p1, p2, l1, ..., ln)
Returns a pattern equivalent to a labeled ordered choice.
If the matching of p1
gives one of the labels l1, ..., ln
,
then the matching of p2
is tried from the same position. Otherwise,
the result of the matching of p1
is the pattern's result.
The labeled ordered choice lpeg.Lc(p1, p2, 0)
is equivalent to the
regular ordered choice p1 / p2
.
Although PEG's ordered choice is associative, the labeled ordered choice is not. When using this function, the user should take care to build a left-associative labeled ordered choice pattern.
%{l}
Syntax of relabel module. Equivalent to lpeg.T(l)
.
p1 /{l1, ..., ln} p2
Syntax of relabel module. Equivalent to lpeg.Lc(p1, p2, l1, ..., ln)
.
The /{}
operator is left-associative.
A grammar can use both choice operators (/
and /{}
),
but a single choice can not mix them. That is, the parser
of relabel
module will not recognize a pattern as
p1 / p2 /{l1} p3
.
relabel.setlabels (tlabel)
Allows to specicify a table with labels. They keys of
tlabel
must be integers between 0
and 63
,
and the associated values should be strings.
Some Examples
Throwing a label
The following example defines a grammar that matches a list of identifiers separated by commas. A label is thrown when there is an error matching an identifier or a comma:
local m = require'lpeglabel' local g = m.P{ "S", S = m.V"Id" * m.V"List", List = -m.P(1) + ("," + m.T(2)) * m.V"Id" * m.V"List", Id = m.R'az'^1 + m.T(1), } function mymatch (g, s) local r, e = g:match(s) if not r then if e == 1 then return "Error: expecting an identifier" elseif e == 2 then return "Error: expecting ','" else return "Error" end end return r end print(mymatch(g, "a,b")) print(mymatch(g, "a b")) print(mymatch(g, ", b"))
In this example we could think about writing rule List as follows:
List = m.P(("," + m.T(2)) * m.V"Id")^0but this would give us an expression that when matching the end of input would result in a failure whose associated label would be 2.
In the previous example we could have also created a table with the error messages to improve the readbility of the PEG. Below we rewrite the grammar following this approach:
local m = require'lpeglabel' local errUndef = 0 local errId = 1 local errComma = 2 local terror = { [errUndef] = "Error", [errId] = "Error: expecting an identifier", [errComma] = "Error: expecting ','", } local g = m.P{ "S", S = m.V"Id" * m.V"List", List = -m.P(1) + ("," + m.T(errComma)) * m.V"Id" * m.V"List", Id = m.R'az'^1 + m.T(errId), } function mymatch (g, s) local r, e = g:match(s) if not r then return terror[e] end return r end print(mymatch(g, "a,b")) print(mymatch(g, "a b")) print(mymatch(g, ", b"))
Throwing a label using the relabel module
We can also rewrite the previous example using the relabel module as follows:
local re = require 'relabel' local g = re.compile[[ S <- Id List List <- !. / (',' / %{2}) Id List Id <- [a-z] / %{1} ]] function mymatch (g, s) local r, e = g:match(s) if not r then if e == 1 then return "Error: expecting an identifier" elseif e == 2 then return "Error: expecting ','" else return "Error" end end return r end print(mymatch(g, "a,b")) print(mymatch(g, "a b")) print(mymatch(g, ", b"))
Another way to describe the previous example using the relabel module is by using a table with the description of the errors (terror) and another table that associates a name to a given label (tlabels):
local re = require 'relabel' local errUndef, errId, errComma = 0, 1, 2 local terror = { [errUndef] = "Error", [errId] = "Error: expecting an identifier", [errComma] = "Error: expecting ','", } local tlabels = { ["errUndef"] = errUndef, ["errId"] = errId, ["errComma"] = errComma } re.setlabels(tlabels) local g = re.compile[[ S <- Id List List <- !. / (',' / %{errComma}) Id List Id <- [a-z] / %{errId} ]] function mymatch (g, s) local r, e = g:match(s) if not r then return terror[e] end return r end print(mymatch(g, "a,b")) print(mymatch(g, "a b")) print(mymatch(g, ", b"))
Throwing and catching a label
When a label is thrown, the grammar itself can handle this label by using the labeled ordered choice. Below we rewrite the example of the list of identifiers to show this feature:
local m = require'lpeglabel' local errUndef, errId, errComma = 0, 1, 2 local terror = { [errUndef] = "Error", [errId] = "Error: expecting an identifier", [errComma] = "Error: expecting ','", } g = m.P{ "S", S = m.Lc(m.Lc(m.V"Id" * m.V"List", m.V"ErrId", errId), m.V"ErrComma", errComma), List = -m.P(1) + m.V"Comma" * m.V"Id" * m.V"List", Id = m.R'az'^1 + m.T(errId), Comma = "," + m.T(errComma), ErrId = m.Cc(errId) / terror, ErrComma = m.Cc(errComma) / terror } print(g:match("a,b")) print(g:match("a b")) print(g:match(",b"))
As was pointed out before, the labeled ordered
choice is not associative, so we should impose a left-associative
order when using function Lc
.
Below we use the re module to throw and catch labels.
As was pointed out before, the /{}
operator is left-associative, so we do not need to manually impose
a left-associative order as we did in the previous example that
used Lc
:
local re = require'relabel' local terror = {} local function newError(l, msg) table.insert(terror, { l = l, msg = msg } ) end newError("errId", "Error: expecting an identifier") newError("errComma", "Error: expecting ','") local labelCode = {} local labelMsg = {} for k, v in ipairs(terror) do labelCode[v.l] = k labelMsg[v.l] = v.msg end re.setlabels(labelCode) local p = re.compile([[ S <- Id List /{errId} ErrId /{errComma} ErrComma List <- !. / Comma Id List Id <- [a-z]+ / %{errId} Comma <- ',' / %{errComma} ErrId <- '' -> errId ErrComma <- '' -> errComma ]], labelMsg) print(p:match("a,b")) print(p:match("a b")) print(p:match(",b"))
Tiny Language
As a more complex example, below we have the grammar for the Tiny language, as described in this paper. The example below can also show the line where the syntactic error probably happened.
local re = require 'relabel' local terror = {} local function newError(l, msg) table.insert(terror, { l = l, msg = msg} ) end newError("errSemi", "Error: missing ';'") newError("errExpIf", "Error: expected expression after 'if'") newError("errThen", "Error: expected 'then' keyword") newError("errCmdSeq1", "Error: expected at least a command after 'then'") newError("errCmdSeq2", "Error: expected at least a command after 'else'") newError("errEnd", "Error: expected 'end' keyword") newError("errCmdSeqRep", "Error: expected at least a command after 'repeat'") newError("errUntil", "Error: expected 'until' keyword") newError("errExpRep", "Error: expected expression after 'until'") newError("errAssignOp", "Error: expected ':=' in assigment") newError("errExpAssign", "Error: expected expression after ':='") newError("errReadName", "Error: expected an identifier after 'read'") newError("errWriteExp", "Error: expected expression after 'write'") newError("errSimpExp", "Error: expected '(', ID, or number after '<' or '='") newError("errTerm", "Error: expected '(', ID, or number after '+' or '-'") newError("errFactor", "Error: expected '(', ID, or number after '*' or '/'") newError("errExpFac", "Error: expected expression after '('") newError("errClosePar", "Error: expected ')' after expression") local line local function incLine() line = line + 1 return true end local function countLine(s, i) line = 1 local p = re.compile([[ S <- (%nl -> incLine / .)* ]], { incLine = incLine}) p:match(s:sub(1, i)) return true end local labelCode = {} for k, v in ipairs(terror) do labelCode[v.l] = k end re.setlabels(labelCode) local g = re.compile([[ Tiny <- CmdSeq CmdSeq <- (Cmd (SEMICOLON / ErrSemi)) (Cmd (SEMICOLON / ErrSemi))* Cmd <- IfCmd / RepeatCmd / ReadCmd / WriteCmd / AssignCmd IfCmd <- IF (Exp / ErrExpIf) (THEN / ErrThen) (CmdSeq / ErrCmdSeq1) (ELSE (CmdSeq / ErrCmdSeq2) / '') (END / ErrEnd) RepeatCmd <- REPEAT (CmdSeq / ErrCmdSeqRep) (UNTIL / ErrUntil) (Exp / ErrExpRep) AssignCmd <- NAME (ASSIGNMENT / ErrAssignOp) (Exp / ErrExpAssign) ReadCmd <- READ (NAME / ErrReadName) WriteCmd <- WRITE (Exp / ErrWriteExp) Exp <- SimpleExp ((LESS / EQUAL) (SimpleExp / ErrSimpExp) / '') SimpleExp <- Term ((ADD / SUB) (Term / ErrTerm))* Term <- Factor ((MUL / DIV) (Factor / ErrFactor))* Factor <- OPENPAR (Exp / ErrExpFac) (CLOSEPAR / ErrClosePar) / NUMBER / NAME ErrSemi <- ErrCount %{errSemi} ErrExpIf <- ErrCount %{errExpIf} ErrThen <- ErrCount %{errThen} ErrCmdSeq1 <- ErrCount %{errCmdSeq1} ErrCmdSeq2 <- ErrCount %{errCmdSeq2} ErrEnd <- ErrCount %{errEnd} ErrCmdSeqRep <- ErrCount %{errCmdSeqRep} ErrUntil <- ErrCount %{errUntil} ErrExpRep <- ErrCount %{errExpRep} ErrAssignOp <- ErrCount %{errAssignOp} ErrExpAssign <- ErrCount %{errExpAssign} ErrReadName <- ErrCount %{errReadName} ErrWriteExp <- ErrCount %{errWriteExp} ErrSimpExp <- ErrCount %{errSimpExp} ErrTerm <- ErrCount %{errTerm} ErrFactor <- ErrCount %{errFactor} ErrExpFac <- ErrCount %{errExpFac} ErrClosePar <- ErrCount %{errClosePar} ErrCount <- '' => countLine ADD <- Sp '+' ASSIGNMENT <- Sp ':=' CLOSEPAR <- Sp ')' DIV <- Sp '/' IF <- Sp 'if' ELSE <- Sp 'else' END <- Sp 'end' EQUAL <- Sp '=' LESS <- Sp '<' MUL <- Sp '*' NAME <- Sp !RESERVED [a-z]+ NUMBER <- Sp [0-9]+ OPENPAR <- Sp '(' READ <- Sp 'read' REPEAT <- Sp 'repeat' SEMICOLON <- Sp ';' SUB <- Sp '-' THEN <- Sp 'then' UNTIL <- Sp 'until' WRITE <- Sp 'write' RESERVED <- (IF / ELSE / END / READ / REPEAT / THEN / UNTIL / WRITE) ![a-z]+ Sp <- %s* ]], { countLine = countLine })
Download
LPegLabel source code.
License
The MIT License (MIT)
Copyright (c) 2014-2015 Sérgio Medeiros
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Bride-to-be wakes from surgery to find legs amputated, wishes to walk down aisle at wedding
by Alexandria HeinA 37-year-old bride-to-be has put her wedding dreams on hold after she went in for a procedure to correct the narrowing of the veins in her legs only to wake up with both limbs amputated.
Tina McCue, who has diabetes, is in kidney failure and is dealing with vascular disease, said she first thought she was living through a bad dream.
“At first I thought it was just a bad dream, that something had gone wrong and I was in a coma, but that I would wake up and still have my legs,” McCue, a mother of four, told The Sun. “That’s how I started thinking. Then reality kicked in.”
COMEDIAN WITH CEREBRAL PALSY SHARES HOW SHE FINALLY GOT HOLLYWOOD TO NOTICE HER
According to McCue, when her surgeons went to operate, they found serious infections, leaving them no choice but to amputate. Peripheral arterial disease (PAD) commonly occurs in patients with diabetes or those who have high cholesterol and heart disease, according to HealthLine.com.
About 1 in 3 people who have diabetes over the age of 50 go on to develop PAD, making them at high risk of heart attack and stroke. The condition causes plaque buildup on the blood vessel walls, restricting blood flow and oxygen to the legs and feet.
Symptoms include pain in the calves when walking or exercises, numbness or tingling in the lower legs or feet, and cuts or sores on the legs and feet that don’t heal in a timely manner. While medication and lifestyle changes can help manage PAD, severe cases may require surgery, according to HealthLine.com.
WOMAN DROPS 500 POUNDS AFTER LOSING TONGUE TO CANCER: 'I'M ALIVE FOR THE VERY FIRST TIME IN MY LIFE'
She remains in the hospital and said she is trying to remain positive with the goal of heading home at the end of the month.
“I have a few bad days, but I don’t want to let anyone down,” she said, according to The Sun.
Relatives and friends have hosted fundraisers for McCue at local pubs near her Baddeley Green home and said her partner Martyn has been her rock, as well as her children.
CLICK HERE TO GET THE FOX NEWS APP
“What I would like to do is walk down the aisle when me and Martyn get married,” she said, according to The Sun.


I don't know what to write here but I want to write something here. The longer I am able to write, the better because I will be able to see it clearly. Hue hue hue. K, bye!
Pushitu, Coming soon!
To get updates from us, follow our WordPress blog
Have Suggestions? Write it here!
Just send an email to ubeflavoredemail@gmail.com


TABLE OF INTERACTIONS WITH
CRIZOTINIB
See also: bradycardia inducing drugs
See also: metabolilzed tyrosine-kinase inhibitors
From the French ANSM drug interactions document of September, 2016, p. 64
CRIZOTINIB RxNorm: 1148495 ATC: L01XE16 |
SUBSTRATES AT RISK OF CYP3A4 CLASS CODE: L01N01 |
Risk of increase of the toxicity of these molecules due to decrease of their metabolism and/or increase of their bioavailability by the crizotinib |
Not recommended |


Dimension-Order Topology Types
Overview
The dimension-order topology is a topology where the arrangement of the routers are described by their location in a dimensional space. The topology has a hierarchical structure where dimension n is composed of structures from dimension n-1. One or more endpoint nodes are connected to a router.
k-ary n-cube
A k-ary n-cube topology consists of kn routers arranged in an n-dimensional cube with k routers along each dimension. Each router is assigned an n-digit radix-k address {an−1, ..., a0} and is connected to all routers with addresses that differ by ±1(mod k) in exactly one address digit. Each dimension is constructed using k k-ary (n-1)-cubes. The channels between the routers can be unidirectional or bidirectional. In practice, the channels are bidirectional.
Ring Topology
Figure Ring_4ary_1cube_example. A ring topology with four routers, also known as a 4-ary 1-cube topology.
The ring topology is a special instance of the k-ary n-cube, where n is equal to one. Figure Ring_4ary_1cube_example shows a ring topology with four routers, also known as a 4-ary 1-cube topology. The dotted lines show the connectivity between routers 0 and k-1 for a dimension.
Symmetric Torus Topology
Figure Symmetic_Torus_4ary_2cube_example. A symmetric torus topology with four routers along each dimension, also known as a 4-ary 2-cube topology.
The symmetric torus topology is a special instance of the k-ary n-cube, where n is equal to two. Figure Symmetic_Torus_4ary_2cube_example shows a symmetric torus topology with four routers along each dimension, also known as a 4-ary 2-cube topology. Router (3,0) has address 3 in a dimension and 0 in the other dimension. The dotted lines show the connectivity between routers 0 and k-1 for a dimension.
Figure 4ary_2cube_construction_example. The construction of a symmetric torus (4-ary 2-cube) topology using 4-ary 1-cubes.
Figure 4ary_2cube_construction_example shows the construction of a symmetric torus (4-ary 2-cube) topology using 4-ary 1-cubes (ring topologies).
multi-radix n-cube
A multi-radix n-cube is a generalized form of a k-ary n-cube topology where the radix (number of router nodes) for each dimension is explicitly stated. Each router is assigned an n-digit where the digit at index i has the radix of dimension i. A 2,3-ary 2-cube describes a grid-like topology with a radix of 2 in one dimension and radix of 3 in the other dimension.
Figure 2,3-ary_2cube_example. A 2,3-ary 2-cube topology example.
Figure 2,3-ary_2cube_example shows a 2,3-ary 2-cube topology example. The dotted lines show the connectivity between router 0 and router radixi - 1 for each dimension.
k-ary n-mesh
A k-ary n-mesh is a k-ary n-cube topology with the connection from address ak−1 to address a0 omitted in each dimension.
Line
Figure Line_4ary_1mesh_example. A line topology with four routers, also known as a 4-ary 1-mesh topology.
The line topology is a special instance of the k-ary n-mesh, where n is equal to one. Figure Line_4ary_1mesh_example shows a line topology with four routers, also known as a 4-ary 1-mesh topology. Compared to the ring topology in Figure Ring_4ary_1cube_example, the connection from router 0 to router 3 is omitted.
Symmetric Mesh
Figure Symmetic_Mesh_4ary_2mesh_example. A symmetric mesh topology with four routers along each dimension, also known as a 4-ary 2-mesh topology.
The symmetric torus mesh is a special instance of the k-ary n-mesh, where n is equal to two. Figure Symmetic_Mesh_4ary_2mesh_example shows a symmetric mesh topology with four routers along each dimension, also known as a 4-ary 2-mesh topology. Router (1,2) has address 1 in a dimension and 2 in the other dimension. Compared to the torus topology in Figure Symmetic_Torus_4ary_2cube_example, the connections between the pair of routers [(0,0), (0,3)], [(1,0), (1,3)], [(2,0), (2,3)], [(3,0), (3,3)], [(0,0), (3,0)], [(0,1), (3,1)], [(0,2), (3,2)], and [(0,3), (3,3)] are omitted.
multi-radix n-mesh
Similar to the multi-radix n-cube, a multi-radix n-mesh is a generalized form of a k-ary n-mesh topology where the radix (number of router nodes) for each dimension is explicitly stated. Each router is assigned an n-digit where the digit at index i has the radix of dimension i. A 2,3-ary 2-mesh describes a grid-like topology with a radix of 2 in one dimension and radix of 3 in the other dimension.
Figure 2,3-ary_2mesh_example. A 2,3-ary 2-mesh topology example.
Figure 2,3-ary_2mesh_example shows a 2,3-ary 2-mesh topology example. Compared to the multi-radix n-cube topology in Figure 2,3-ary_2cube_example, the connections from the pair of routers [(0,0), (0,2)], [(1,0), (1,2)], [(0,0), (1,0)], [(0,1), (1,1)] and [(0,2), (1,2)] are omitted.
Cheat Sheet
- A k-ary n-cube topology consists of kn routers arranged in an n-dimensional cube with k router nodes along each dimension. Each router is assigned an n-digit radix-k address {an−1, ..., a0} and is connected to all routers with addresses that differ by ±1 (mod k) in exactly one address digit. Each dimension is constructed using k k-ary (n-1)-cubes where there are k routers in the first dimension.
- A multi-radix n-cube is a generalized form of a k-ary n-cube topology where the radix (number of routers) for each dimension is explicitly stated. Each router is assigned an n-digit where the digit at index i has the radix of dimension i.
- A k-ary n-mesh is a k-ary n-cube topology with the connection from address ak−1 to address a0 omitted in each dimension.
- Similar to the multi-radix n-cube, a multi-radix n-mesh is a generalized form of a k-ary n-mesh topology where the radix (number of routers) for each dimension is explicitly stated. Each router is assigned an n-digit where the digit at index i has the radix of dimension i.
- Channel direction can be unidirectional or bidirectional.
- Ring: k-ary 1-cube
- Symmetric Torus: k-ary 2-cube
- Line: k-ary 1-mesh
- Symmetric Mesh: k-ary 2-mesh
References
William James Dally and Brian Patrick Towles. 2004. Principles and Practices of Interconnection Networks. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA.