Afterwood
When StackOverflow sprang up way back in mid-2008 it seemed like a game changer for the industry. Even for someone like me who had already earned a few stripes as a programmer by struggling with the craft through the use of product documentation, journals, books, web sites, CIS & CiX forums, etc. I found much to like about the innovative format as it promised to raise the signal-to-noise ratio to much higher levels. At that time I was also making the switch from a career spent entirely in the native world to the managed one of .NET so felt I would be in a good position to provide help to those new to the place I was leaving behind while drawing on the expertise of those already ahead of me on the path to my new destination.
Of course I didn’t reckon on the volume of people out there who also appeared eager to help out but apparently didn’t need to either eat or sleep! I was never expecting to reach the dizzying heights of “reputation” achieved by the likes of StackOverflow’s most famous respondent – Jon Skeet – but I felt chalking up a few answers would at least give me something else to raise my profile and give any potential future employers one more reason to prefer me over someone else.
It’s funny how things work out. It’s now over 10 years since I joined and yet I’m still to even reach the 1,000 mark. Consequently it’s rare I visit the site and get a notification saying I’ve earned some more points or received a comment to one of my answers. Hence when I visited recently and found a little badge on my inbox I was expecting good news; I never for a moment expected a comment from someone suggesting that one of my answers was incredibly condescending and that I was blaming the questioner for their own predicament.
Being a programmer with a bit of mileage I probably don’t google things much less frequently than anyone else but years of skim reading articles, blog posts, and forum messages has meant that I’ve found it easy to skip over the “noise” and focus on whether or not the answer is likely to be of interest. As a consequence I’ve become ignorant of the kinds of problems that have caused a number of people to suggest that Q&A sites like StackOverflow are not as welcoming or as helpful as they purport to be. Given their reliance on contributions from the general public, such as myself, that means some portion of the blame almost certainly lays with the attitudes of us programmers who have chosen to offer our time and expertise to help others out. In more recent years I’ve made a conscious effort to try and learn more about the subtle ways that people denigrate others, so I was unprepared to discover that I might have ended up on the wrong side of the tracks.
It’s all too easy when challenged to go on the defensive and find ways to brush off the accuser as someone who’s clearly made no effort to understand what you’ve said and just needs to “get over themselves”. The somewhat passive-aggressive nature of the comment didn’t really encourage me to immediately take the issue seriously whereas the apparent “injustice” did mean I felt the need to investigate further. I followed the notification which, curiously, had taken 9 months to deliver and re-read whatever it was I said back in 2010 that had caused offence:
“You don't mention what language you're using but there is no hidden setting that hides errors per se, other than the compiler giving up after it has encountered a gazillion issues (Visual C++). It has decided that there is so much wrong with the code that it's not going to waste even more time telling you stuff that you're just going to ignore. Classic examples of this are caused by missing braces and parenthesis, or botched #include guards etc.”
My gut reaction was that “2010 me” was probably trying to be light-hearted or sarcastic but “2020 me” was somewhat appalled that I would have not spotted the obvious potential for misunderstanding. But it was just a misunderstanding, right? I want to believe there was no intention of malice on my part – that I was suggesting the tool was at fault, not the operator – but I also can’t deny that I haven’t overused sarcasm in the past and stepped over the mark once or twice. My hope is that while “2010 me” might have been better at judging the mood in person I clearly still had a lot to learn back then about the written word and personal responsibility.
Hemingway said that “the only kind of writing is rewriting” and “2020 me” is beginning to understand that more and more. While my younger self may have been satisfied to simply avoid spelling and grammatical mistakes my older self is slowly becoming more aware of the ways in which language can be used by a writer to insult certain kinds of reader. I realize it falls on my shoulders to be wise to this and ensure that if my intent is not to be misinterpreted then I should steer clear of those devices.
I toyed briefly with deleting my answer as it turned out in the end to be totally irrelevant to the question and I’m not entirely sure what I said was even correct. Instead I decided not to hide my embarrassment and so I rewrote the answer using “2020 me” to keep the gist but hopefully place the emphasis on the limitations of the tool rather than the programmer using it. I also added a short apology too to make it clear I was not hiding anything by rewriting it after the fact. This, I hope, also ensures the comment calling my answer out as inappropriate does not look out of place either. And, while a tiny part of me feels their tone was somewhat inappropriate too, “2020 me” accepts that negativity is not best handled with yet more negativity, instead I can thank them for giving me the catalyst to review my past attempt and revise it so that no one else has to feel uncomfortable in the future.
The question I now find myself asking is if this was an isolated moment of naivety or do I need to go back and check what else I’ve written in public, and if so, how far back? The answer, for me, I feel is “yes”, although I know I’m lucky enough not to have that much to look over specifically in StackOverflow. I have since found a few of my earlier blog posts use terms which my current self would never consider appropriate, not because they are in any way nasty, more that I think I’ve found better terms that I hope has made my subsequent writing more accessible.
I’m in no doubt that feedback from both friends and reviewers at ACCU over the last 10 years has had a significant impact in changing my view on the importance of the written word and this incident continues to confirm my suspicion that whether it be code or prose it always suffers when I’m left to my own devices.
References
[1] https://stackoverflow.com/a/3000064/106119
Chris Oldwood
27 July 2020
Chris is a freelance programmer who started
out as a bedroom coder in the 80’s writing assembler on 8-bit micros. These
days it's enterprise grade technology in plush corporate offices from
the lounge below his bedroom. With no Godmanchester duck race to commentate on this
year he’s been even more easily distracted by messages to<EMAIL_ADDRESS>and
@chrisoldwood.


Sit tight. We're still building this site. We should have everything up and running soon.
Green House Stereo is available for booking throughout the western South Dakota area. Additionally, feel free to contact us regarding recording or business propositions.
Please fill out the form below to request more information. Include your contact information and let us know how you would like us to reach out to you. We will quickly respond to all inquiries.
Send me a reply.
Although we are available to play anywhere in the region, we may need additional time to prepare for shows outside of the western South Dakota area. We will make every effort possible to accomodate your schedule, but please keep this in mind when booking.


External JavaScript is not supported in this browser.
WebSocket is not supported in this browser.
JSON is not supported in this browser.
FileReader is not supported in this browser. Adding local torrent or metafile will not work.
Here would show a progress bar, so...


❮ Today, Tues. April 1 ❯
Tomorrow
- UI Design Pt. 3
- MGMT 2000 Conducting
- Scaling Urban Structures
Milestones
House for Take-home exam |
|
House for UI Design Pt. 3 |
|
Hall of CS 3230 HW |
|
Pyramid of Finals |


1. Introduction
This section is non-normative.
Web Applications often run in environments with unreliable networks (e.g., mobile phones) and unknown lifetimes (the browser might be killed or the user might navigate away). This makes it difficult to synchronize client data from web apps (such as photo uploads, document changes, or composed emails) with servers. If the browser closes or the user navigates away before synchronization can complete, the app must wait until the user revisits the page to try again. This specification provides a new onsync service worker event which can fire in the background so that synchronization attempts can continue despite adverse conditions when initially requested. This API is intended to reduce the time between content creation and content synchronization with the server.
As this API relies on service workers, functionality provided by this API is only available in a secure context.
function sendChatMessage(message) { return addChatMessageToOutbox(message).then(() => { // Wait for the scoped service worker registration to get a // service worker with an active state return navigator.serviceWorker.ready; }).then(reg => { return reg.sync.register('send-chats'); }).then(() => { console.log('Sync registered!'); }).catch(() => { console.log('Sync registration failed :('); }); }
In the above example addChatMessageToOutbox
is a developer-defined function.
Reacting to a sync event within a service worker:
self.addEventListener('sync', event => { if (event.tag == 'send-chats') { event.waitUntil( getMessagesFromOutbox().then(messages => { // Post the messages to the server return fetch('/send', { method: 'POST', body: JSON.stringify(messages), headers: { 'Content-Type': 'application/json' } }).then(() => { // Success! Remove them from the outbox return removeMessagesFromOutbox(messages); }); }).then(() => { // Tell pages of your success so they can update UI return clients.matchAll({ includeUncontrolled: true }); }).then(clients => { clients.forEach(client => client.postMessage('outbox-processed')) }) ); } });
In the above example getMessagesFromOutbox
and removeMessagesFromOutbox
are developer-defined functions.
2. Concepts
The sync event is considered to run in the background if no service worker clients whose frame type is top-level or auxiliary exist for the origin of the corresponding service worker registration.
The user agent is considered to be online if the user agent has established a network connection. A user agent MAY use a stricter definition of being online. Such a stricter definition MAY take into account the particular service worker or origin a sync registration is associated with.
3. Constructs
A service worker registration has an associated list of sync registrations whose element type is a sync registration.A sync registration is a tuple consisting of a tag and a state.
A sync registration has an associated tag, a DOMString.
A sync registration has an associated registration state, which is one of pending, waiting, firing, or reregisteredWhileFiring. It is initially set to pending.
A sync registration has an associated service worker registration. It is initially set to null.
Within one list of sync registrations each sync registration MUST have a unique tag.
4. Privacy Considerations
4.1. Location Tracking
Fetch requests within the onsync event while in the background may reveal the client’s IP address to the server after the user left the page. The user agent SHOULD limit tracking by capping the number of retries and duration of sync events.4.2. History Leaking
Fetch requests within the onsync event while in the background may reveal something about the client’s navigation history to passive eavesdroppers. For instance, the client might visit site https://example.com, which registers a sync event, but doesn’t fire until after the user has navigated away from the page and changed networks. Passive eavesdroppers on the new network may see the fetch requests that the onsync event makes. The fetch requests are HTTPS so the request contents will not be leaked but the domain may be (via DNS lookups and IP address of the request).5. API Description
5.1. Extensions to the ServiceWorkerRegistration
interface
partial interface ServiceWorkerRegistration { readonly attribute SyncManager sync; };
The sync
attribute exposes a SyncManager
, which has an associated service worker registration represented by the ServiceWorkerRegistration
on which the attribute is exposed.
5.2. SyncManager
interface
[Exposed=(Window,Worker)] interface SyncManager { Promise<void> register(DOMString tag); Promise<sequence<DOMString>> getTags(); };
The register(tag)
method, when invoked, MUST return a new promise promise and run the following steps in parallel:
- Let serviceWorkerRegistration be the
SyncManager
's associated service worker registration. -
If serviceWorkerRegistration’s active worker is null:
- If serviceWorkerRegistration’s installing worker is null and serviceWorkerRegistration’s waiting worker is null, reject promise with an
InvalidStateError
and abort these steps. - Wait for the installing worker or the waiting worker of serviceWorkerRegistration to become its active worker.
- If serviceWorkerRegistration fails to activate either worker, reject promise with an
InvalidStateError
and abort these steps. - Once serviceWorkerRegistration’s active worker is not null, proceed with the steps below.
- If serviceWorkerRegistration’s installing worker is null and serviceWorkerRegistration’s waiting worker is null, reject promise with an
- Let isBackground be true.
-
For each client in the service worker clients for the serviceWorkerRegistration’s origin:
- If client’s frame type is top-level or auxiliary, set isBackground to false.
- If isBackground is true, reject promise with an
InvalidAccessError
and abort these steps. - Let currentRegistration be the registration in serviceWorkerRegistration’s list of sync registrations whose tag equals tag if it exists, else null.
-
If currentRegistration is not null:
- If currentRegistration’s registration state is waiting, set currentRegistration’s registration state to pending.
- If currentRegistration’s registration state is firing, set currentRegistration’s registration state to reregisteredWhileFiring.
- Resolve promise.
- If the user agent is currently online and currentRegistration’s registration state is pending, fire a sync event for currentRegistration.
-
Else:
- Let newRegistration be a new sync registration.
- Set newRegistration’s associated tag to tag.
- Set newRegistration’s associated service worker registration to serviceWorkerRegistration.
- Add newRegistration to serviceWorkerRegistration’s list of sync registrations.
- Resolve promise.
- If the user agent is currently online, fire a sync event for newRegistration.
The getTags()
method when invoked, MUST return a new promise promise and run the following steps in parallel:
- Let serviceWorkerRegistration be the
SyncManager
's associated service worker registration. - Let currentTags be a new
sequence
. - For each registration in serviceWorkerRegistration’s list of sync registrations, add registration’s associated tag to currentTags.
- Resolve promise with currentTags.
5.3. The sync event
partial interface ServiceWorkerGlobalScope { attribute EventHandler onsync; }; [Constructor(DOMString type, SyncEventInit init), Exposed=ServiceWorker] interface SyncEvent : ExtendableEvent { readonly attribute DOMString tag; readonly attribute boolean lastChance; }; dictionary SyncEventInit : ExtendableEventInit { required DOMString tag; boolean lastChance = false; };
Note: The SyncEvent
interface represents a firing sync registration. If the page (or worker) that registered the event is running, the user agent will fire the sync event as soon as network connectivity is available. Otherwise, the user agent should run at the soonest convenience. If a sync event fails, the user agent may decide to retry it at a time of its choosing. The lastChance
attribute is true if the user agent will not make further attempts to try this sync after the current attempt.
lastChance
:
self.addEventListener('sync', event => { if (event.tag == 'important-thing') { event.waitUntil( doImportantThing().catch(err => { if (event.lastChance) { self.registration.showNotification("Important thing failed"); } throw err; }) ); } });
The above example reacts to lastChance
by showing a notification to the user. This requires the origin to have permission to show notifications.
In the above example doImportantThing
is a developer-defined function.
Whenever the user agent changes to online, the user agent SHOULD fire a sync event for each sync registration whose registration state is pending.
To fire a sync event for a sync registration registration, the user agent MUST run the following steps:
- Assert: registration’s registration state is pending.
- Let serviceWorkerRegistration be the service worker registration associated with registration.
- Assert: registration exists in the list of sync registrations associated with serviceWorkerRegistration.
- Set registration’s registration state to firing.
-
Invoke the Handle Functional Event algorithm with registration and the following substeps as arguments.
- Let globalObject be the global object these steps are called with.
- Create a trusted event e that uses the
SyncEvent
interface, with the event type sync, which does not bubble and has no default action. - Let the
tag
attribute of e be initialized to the tag associated with registration. - Let the
lastChance
attribute of e be initialized to false if the user agent will retry this sync event if it fails, or true if no further attempts will be made after the current attempt. - Dispatch e at globalObject.
- Let waitUntilPromise be the result of waiting for all of e’s extended lifetime promises.
-
Upon fulfillment of waitUntilPromise, perform the following steps atomically:
-
If registration’s state is reregisteredWhileFiring:
- Set registration’s state to pending.
- If the user agent is currently online, fire a sync event for registration.
- Abort the rest of these steps.
- Assert: registration’s registration state is firing.
- Remove registration from serviceWorkerRegistration’s list of sync registration.
-
If registration’s state is reregisteredWhileFiring:
-
Upon rejection of waitUntilPromise, or if the script has been aborted by the termination of the service worker, perform the following steps atomically:
-
If registration’s state is reregisteredWhileFiring:
- Set registration’s state to pending.
- If the user agent is currently online, fire a sync event for registration.
- Abort the rest of these steps.
-
If the
lastChance
attribute of e is false, set registration’s registration state to waiting, and perform the following steps in parallel:- Wait a user agent defined length of time.
- If registration’s registration state is not waiting, abort these substeps.
- Set registration’s registration state to pending.
- If the user agent is currently online, fire a sync event for registration.
- Else remove registration from serviceWorkerRegistration’s list of sync registrations.
-
If registration’s state is reregisteredWhileFiring:
A user agent MAY impose a time limit on the lifetime extension and execution time of a SyncEvent
which is stricter than the time limit imposed for ExtendableEvent
s in general. In particular an event for which lastChance
is true MAY have a significantly shortened time limit.
A user agent will retry a sync event based on some user agent defined heuristics.


synopsys
Businessmodel of Synopsys
Customer Segments
Synopsys provides a broad range of solutions and services to customers across the world. The Company’s electronic design automation and intellectual property services customers primarily comprise manufacturers of semiconductors and electronics systems.
The Company claims to provide services to almost all of the world’s semiconductor producers, including all of the world’s top 20 semiconductor manufacturing companies. Its other services and solutions are utilised by commercial clients operating across the financial services, energy and industrial sectors. Synopsys names among its customers high-profile companies such as Samsung, Fujitsu, Renesas, Global Foundries, AMD and Xilinx.
Geographically, Synopsys’s business is focused primarily on the US market, which accounted in 2015 for 51% of the Company’s total revenue. The Company also records sales across Europe, Japan, and Asia Pacific and Other categories.
Value Propositions
Synopsys provides value to its clients in the following ways:
- The quality and reliability of its products, comprising a full suite of effective technology and software solutions, many of which are designed specifically for semiconductor and electronics producers;
- Its intellectual property products, which assist in streamlining the manufacturing process;
- Its brand recognition and reputation, with the Company serving a number of high profile customers across the world;
- Its innovation and partnerships, with the company devoting substantial funds to research and development and collaborating with market leading entities in the development of its solutions; and
- The flexibility of its product offerings, with customers able to mix and match certain software products in order to fully cover their design flow. ### Channels
Synopsys operates a website at www.synopsys.com, through which customers are able to browse the Company’s services and solutions. The Company, however, does not appear to operate an online sales channel.
Synopsys primarily markets and sells its products and services through its own in-house direct sales teams across the US and other principal foreign markets. The Company operates sales and support centres throughout the US, as well as in Canada, multiple countries in Europe, Israel, Japan, China, Korea, Taiwan and other countries in Asia, with international headquarters in Dublin, Ireland. Typically, Synopsys distributes its software products and documentation to customers electronically, but also provides physical media when requested by the customer.
A small proportion of Synopsys’s sales are made via third-party channel partners, including resellers and independent sales agents.
Customer Relationships
While Synopsys does have an online presence, the Company does not appear to make its products and services available to customers on a self-service basis.
The majority of the Company’s sales are made via its direct sales staff, who consult with clients to provide a bespoke service tailored to their individual needs. The Company typically licenses its software to customers under non-exclusive license agreements that allow a number of individual users to access the software on a defined network, including, in some cases, regional or global networks.
Synopsys provides ongoing personal care to its customers in the form of online support, telephone assistance and online resources, as well as training and learning services. The Company also operates a Community portal, through which customers and partners can find information on events, media and user groups.
Customers are also able to interact directly with Synopsys through the Company’s social media accounts, including with Twitter, LinkedIn, Facebook and YouTube.
Key Activities
Synopsys provides technology and software products, intellectual property solutions and professional services, primarily to manufacturers of semiconductors and electronics systems. The main focus of the Company’s business, is its provision of electronic design automation software that is used by engineers use to design and test integrated circuits.
It additionally provides intellectual property products, comprising pre-designed circuits that can be used as components of larger chip designs, replacing the need for clients to design these circuits in-house. Synopsys also offers a suite of software and hardware products that are used to develop the electronic systems that incorporate chips and the software that runs on them, providing ancillary technical support services to ensure that customers utilise its products to full effect.
Synopsys is also a provider of software tools used by developers produce software code in a range of industries, including the electronics, financial services, energy, and industrial sectors.
Key Partners
Synopsys collaborates with a network of partner companies throughout the development and sale of its products and solutions. These partners can be categorised as follows:
- Foundries, including IBM Foundry, MagnaChip, Dongbu HiTek, SilTerra, and TSMC;
- Design Service Partners, including eSilicon, GUC, Brite Semiconductor, Open Silicon, and Veri Silicon;
- Library and Intellectual Property Partners, including ARM, CEVA, MIPS, Imagination, Faraday Technology, and Artisan;
- Application Specific Integrated Circuit Partners, including Epson, IBM ASIC, Renesas, Toshiba, Gigoptix, Texas Instruments, and Honeywell; and
- Field-Programmable Gate Array Partners, including Xilinx, Achronix, Microsemi, QuickLogic and Altera. Synopsys also has strategic partnerships with Companies such as Samsung, Intel Custom Foundry, Global Foundries and UMC. It also partners with a small number of resellers and independent sales agents to enhance its sales reach.
Key Resources
Synopsys’s key resources are its technology and intellectual properties, its IT infrastructure, its various partnerships across the development and sales chain, and its personnel – notably its sales, support and research and development staff.
Synopsys relies upon a combination of copyright, patent, trademark and trade secret laws to establish and protect its proprietary rights. According to its annual report, it has more than 2,500 US and foreign patents in place.
Searches of records published by the US Patent and Trademark Office identified a number of patent applications filed in the name of Synopsys, including applications entitled ‘Diagnosis and debug with truncated simulation’, ‘Determining a set of timing paths for creating a circuit abstraction’ and ‘Detecting and displaying multi-patterning fix guidance’.
Cost Structure
Synopsys incurs costs in relation to the research and development of its products and solutions, the maintenance of its IT infrastructure, the management of its partnerships, the operation of its sales and marketing activities, and the retention of its personnel.
In 2015 Synopsys’s research and development costs amounted to $776.2 million, up from $718.8 million in 2014. The Company’s general and administrative costs, comprising personnel salaries and benefits and rent and utility payments across its network of offices, are its most significant, amounting in 2015 to $165.1 million.
Revenue Streams
Synopsys generates revenue through the sale and licensing of various software and intellectual property solutions, and professional services. Revenue from the Company’s products and services is categorised as follows:
- Core Electronic Design Automation Products, comprising revenue generated by the Company’s digital and custom integrated circuit design software, verification products, and field-programmable gate array design software;
- Intellectual Properties, Systems and Software Integrity Services, including revenue generated through the sale of the Company’s solutions for wired and wireless interfaces, logic libraries and embedded memories, non-volatile memory, and configurable processor cores and application-specific instruction-set processors;
- Manufacturing Solutions, comprising revenue generated through the provision of software and technology solutions that enable semiconductor manufacturers to develop new fabrication processes; and
- Professional and Other Services, comprising revenue generated through the provisions of consulting, training and design services. In 2015 Synopsys generated $2.24 billion in total revenue, up 9% on the $2.06 billion recorded by the Company in 2014. The Company’s Core Electronic Design Automation business accounts for the majority of the Company’s revenue, amounting to 61% of total revenue in 2015. Synopsys’s Intellectual Property, Systems and Software business accounted or 28%, while Manufacturing Solutions and Professional Services accounted for 8% and 3% respectively.


A set of asynchronous RDD actions available through an implicit conversion.
A RDD that cogroups its parents.
Represents a coalesced RDD that has fewer partitions than its parent RDD This class uses the PartitionCoalescer class to find a good partitioning of the parent RDD so that each new partition has roughly the same number of parent partitions and that the preferred location of each new partition overlaps with as many preferred locations of its parent partitions
Class that captures a coalesced RDD by essentially keeping track of parent partitions
Extra functions available on RDDs of Doubles through an implicit conversion.
An RDD that is empty, i.
An RDD that provides core functionality for reading data stored in Hadoop (e.
An RDD that executes an SQL query on a JDBC connection and reads results.
An RDD that provides core functionality for reading data stored in Hadoop (e.
Extra functions available on RDDs of (key, value) pairs where the key is sortable through an implicit conversion.
Extra functions available on RDDs of (key, value) pairs through an implicit conversion.
A RDD used to prune RDD partitions/partitions so we can avoid launching tasks on all partitions.
An RDD that pipes the contents of each parent partition through an external command (printing them one per line) and returns the output as a collection of strings.
Represents a dependency between the PartitionPruningRDD and its parent.
A Resilient Distributed Dataset (RDD), the basic abstraction in Spark.
Extra functions available on RDDs of (key, value) pairs to create a Hadoop SequenceFile, through an implicit conversion.
The resulting RDD from a shuffle (e.


Welcome to Rock Point Church! We're glad you're here!
Welcome to Rock Point
We trust that you will find this web site to be useful as you learn about Rock Point Church for the first time or become involved with one of our ministries at a deeper level. We invite you to Worship Christ, Walk with Christ and Work for Christ with us!
- What do I wear?
- Clothes. Seriously. We are much more concerned about what's going on inside of a person, than the clothes they wear on the outside. If it makes you feel better, our pastors are usually wearing jeans.
- Music
- Our music is upbeat and our live band usually consists of guitars, drums, and keys. We try to sing songs that are deep in meaning, but easy to understand.
- Children
- We offer dynamic children services from birth to 5th grade during the Sunday morning gathering.
About Us
Our purpose is to lead people into a growing relationship with Jesus Christ.
Our vision is to impact lives, our community, and the world with the good news of Jesus Christ.
See our Rock Point Confession of Faith here
The ministries of Rock Point are always developing and expanding.


Haml (HTML Abstraction Markup Language)
Haml is a markup language that’s used to cleanly and simply describe the HTML of any web document, without the use of inline code. Haml functions as a replacement for inline page templating systems such as PHP, ERB, and ASP. However, Haml avoids the need for explicitly coding HTML into the template, because it is actually an abstract description of the HTML, with some code to generate dynamic content.
Features
- Whitespace active
- Well-formatted markup
- DRY
- Follows CSS conventions
- Integrates Ruby code
- Implements Rails templates with the .haml extension
Using Haml
Haml can be used in three ways:
- as a command-line tool,
- as a plugin for Ruby on Rails,
- and as a standalone Ruby module.
The first step for all of these is to install the Haml gem:
gem install haml
To run Haml from the command line, just use
haml render input.haml > output.html
Use haml --help
for full documentation.
To use Haml with Rails, add the following line to the Gemfile:
gem "haml"
Once it’s installed, all view files with the ".html.haml"
extension will be
compiled using Haml.
You can access instance variables in Haml templates the same way you do in ERB templates. Helper methods are also available in Haml templates. For example:
# file: app/controllers/movies_controller.rb
class MoviesController < ApplicationController
def index
@title = "Teen Wolf"
end
end
-# file: app/views/movies/index.html.haml
#content
.title
%h1= @title
= link_to 'Home', home_url
may be compiled to:

Teen Wolf

Home

Ruby Module
Haml can also be used completely separately from Rails and ActionView. To do this, install the gem with RubyGems:
gem install haml
You can then use it by including the haml
gem in Ruby code, and using
Haml::Template like so:
engine = Haml::Template.new { "%p Haml code!" }
engine.render #=> "
Haml code!
\n"
Options
Haml understands various configuration options that affect its performance and output.
In Rails, options can be set by using Haml::RailsTemplate.set_options
in an initializer:
ruby
# config/initializers/haml.rb
Haml::RailsTemplate.set_options(escape_html: false)
Outside Rails, you can set them by configuring them globally in Haml::Template.options
:
ruby
Haml::Template.options[:escape_html] = false
In sinatra specifically, you can set them in global config with:
ruby
set :haml, { escape_html: false }
Finally, you can also set them by passing an options hash to Haml::Engine.new
or Haml::Template.new
.
For the complete list of available options, please see Haml::Engine
.
Plain Text
A substantial portion of any HTML document is its content, which is plain old text. Any Haml line that’s not interpreted as something else is taken to be plain text, and passed through unmodified. For example:
%gee
%whiz
Wow this is cool!
is compiled to:
<gee>
<whiz>
Wow this is cool!
</whiz>
</gee>
Note that HTML tags are passed through unmodified as well. If you have some HTML you don’t want to convert to Haml, or you’re converting a file line-by-line, you can just include it as-is. For example:
%p

Blah!

is compiled to:

Blah!

Escaping: \
The backslash character escapes the first character of a line, allowing use of otherwise interpreted characters as plain text. For example:
%title
= @title
\= @title
is compiled to:
<title>
MyPage
= @title
</title>
HTML Elements
Element Name: %
The percent character is placed at the beginning of a line. It’s followed
immediately by the name of an element, then optionally by modifiers (see below),
a space, and text to be rendered inside the element. It creates an element in
the form of <element></element>
. For example:
%one
%two
%three Hey there
is compiled to:
<one>
<two>
<three>Hey there</three>
</two>
</one>
Any string is a valid element name; Haml will automatically generate opening and closing tags for any element.
Attributes: {}
or ()
Brackets represent a Ruby hash that is used for specifying the attributes of an element. It is literally evaluated as a Ruby hash, so logic will work in it and local variables may be used. Quote characters within the attribute will be replaced by appropriate escape sequences. The hash is placed after the tag is defined. For example:
%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
is compiled to:

Attribute hashes can also be stretched out over multiple lines to accommodate many attributes.
%script{
"type": text/javascript",
"src": javascripts/script_#{2 + 7}",
"data": {
"controller": "reporter",
},
}
is compiled to:

:class
and :id
Attributes
The :class
and :id
attributes can also be specified as a Ruby array whose
elements will be joined together. A :class
array is joined with " "
and an
:id
array is joined with "_"
. For example:
%div{:id =><EMAIL_ADDRESS>@item.number], :class =><EMAIL_ADDRESS>@item.urgency]}
is equivalent to:
%div{:id => "#{<EMAIL_ADDRESS>:class =><EMAIL_ADDRESS><EMAIL_ADDRESS>The array will first be flattened and any elements that do not test as true will be removed. The remaining elements will be converted to strings. For example:
%div{:class =><EMAIL_ADDRESS>@item == @sortcol && [:sort, @sortdir]] } Contents
could render as any of:

Contents

Contents

Contents

Contents

depending on whether @item.type
is "numeric"
or nil
, whether @item == @sortcol
,
and whether @sortdir
is "ascending"
or "descending"
.
If a single value is specified and it evaluates to false it is ignored; otherwise it gets converted to a string. For example:
.item{:class => @item.is_empty? && "empty"}
could render as either of:
class="item"
class="item empty"
HTML-style Attributes: ()
Haml also supports a terser, less Ruby-specific attribute syntax based on HTML’s attributes. These are used with parentheses instead of brackets, like so:
%html(xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en")
Ruby variables can be used by omitting the quotes. Local variables or instance variables can be used. For example:
%a(title=@title href=href) Stuff
This is the same as:
%a{:title => @title, :href => href} Stuff
Because there are no commas separating attributes, though, more complicated
expressions aren’t allowed. For those you’ll have to use the {}
syntax. You
can, however, use both syntaxes together:
%a(title=@title){:href => @link.href} Stuff
You can also use #{}
interpolation to insert complicated expressions in a
HTML-style attribute:
<EMAIL_ADDRESS>HTML-style attributes can be stretched across multiple lines just like hash-style attributes:
%script(type="text/javascript"
src="javascripts/script_#{2 + 7}")
Ruby 1.9-style Hashes
Haml also supports Ruby’s new hash syntax:
%a{title: @title, href: href} Stuff
Boolean Attributes
Some attributes, such as “checked” for input
tags or “selected” for option
tags, are “boolean” in the sense that their values don’t matter - it only
matters whether or not they’re present. In HTML (but not XHTML), these
attributes can be written as
<input selected>
To do this in Haml using hash-style attributes, just assign a Ruby true
value
to the attribute:
%input{:selected => true}
In XHTML, the only valid value for these attributes is the name of the attribute. Thus this will render in XHTML as
<input selected='selected'>
To set these attributes to false, simply assign them to a Ruby false value. In both XHTML and HTML,
%input{:selected => false}
will just render as:
<input>
HTML-style boolean attributes can be written just like HTML:
%input(selected)
or using true
and false
:
%input(selected=true)
This feature works only for attributes that are included in
Haml::AttributeBuilder::BOOLEAN_ATTRIBUTES
,
as well as data-
and aria-
attributes.
%input{'data-hidden' => false}
%input{'aria-hidden' => false}
%input{'xyz-hidden' => false}
will render as:
<input>
<input>
<input xyz-hidden='false'>
Prefixed Attributes
HTML5 allows for adding
custom non-visible data attributes
to elements using attribute names beginning with data-
. The
Accessible Rich Internet Applications
specification makes use of attributes beginning with aria-
. There are also
frameworks that use non-standard attributes with a common prefix.
Haml can help generate collections of attributes that share a prefix like these. Any entry in an attribute hash that has a Hash as its value is expanded into a series of attributes, one for each key/value pair in the hash, with the attribute name formed by joining the “parent” key name to the key name with a hyphen.
For example:
%a{:href=>"/posts", :data => {:author_id => 123, :category => 7}} Posts By Author
will render as:
Posts By Author
Notice that the underscore in author_id
was replaced by a hyphen. If you wish
to suppress this behavior, you can set Haml’s
:hyphenate_data_attrs
option to false
,
and the output will be rendered as:
Posts By Author
This expansion of hashes is recursive – any value of the child hash that is itself a hash will create an attribute for each entry, with the attribute name prefixed with all ancestor keys. For example:
.book-info{:data => {:book => {:id => 123, :genre => 'programming'}, :category => 7}}
will render as:

Class and ID: .
and #
The period and pound sign are borrowed from CSS. They are used as shortcuts to
specify the class
and id
attributes of an element, respectively. Multiple
class names can be specified in a similar way to CSS, by chaining the class
names together with periods. They are placed immediately after the tag and
before an attributes hash. For example:
%div#things
%span#rice Chicken Fried
%p.beans{ :food => 'true' } The magical fruit
%h1.class.otherclass#id La La La
is compiled to:

Chicken Fried

The magical fruit

La La La

And,
%div#content
%div.articles
%div.article.title Doogie Howser Comes Out
%div.article.date 2006-11-05
%div.article.entry
Neil Patrick Harris would like to dispel any rumors that he is straight
is compiled to:

Doogie Howser Comes Out

2006-11-05

Neil Patrick Harris would like to dispel any rumors that he is straight

These shortcuts can be combined with long-hand attributes; the two values will
be merged together as though they were all placed in an array (see the
documentation on :class
and :id
attributes). For
example:
%div#Article.article.entry{:id => @article.number, :class => @article.visibility}
is equivalent to
%div{:id => ['Article', @article.number], :class => ['article', 'entry', @article.visibility]} Gabba Hey
and could compile to:

Gabba Hey

Implicit Div Elements
Because divs are used so often, they’re the default elements. If you only define
a class and/or id using .
or #
, a div is automatically used. For example:
#collection
.item
.description What a cool item!
is the same as:
%div#collection
%div.item
%div.description What a cool item!
and is compiled to:

What a cool item!

Class Name Merging and Ordering
Class names are ordered in the following way:
1) Tag identifiers in order (aka, “.alert.me” => “alert me”) 2) Classes appearing in HTML-style attributes 3) Classes appearing in Hash-style attributes
For instance, this is a complicated and unintuitive test case illustrating the ordering
.foo.moo{:class => ['bar', 'alpha']}(class='baz')
The resulting HTML would be as follows:

Versions of Haml prior to 5.0 would alphabetically sort class names.
Empty (void) Tags: /
The forward slash character, when placed at the end of a tag definition, causes
Haml to treat it as being an empty (or void) element. Depending on the format,
the tag will be rendered either without a closing tag (:html4
or :html5
), or
as a self-closing tag (:xhtml
).
Taking the following as an example:
%br/
%meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/
When the format is :html4
or :html5
this is compiled to:

<meta content='text/html' http-equiv='Content-Type'>
and when the format is :xhtml
it is compiled to:

<meta content='text/html' http-equiv='Content-Type' />
Some tags are automatically treated as being empty, as long as they have no
content in the Haml source. meta
, img
, link
, br
, hr
, input
,
area
, param
, col
and base
tags are treated as empty by default. This
list can be customized by setting the :autoclose
option.
Whitespace Removal: >
and <
>
and <
give you more control over the whitespace near a tag. >
will
remove all whitespace surrounding a tag, while <
will remove all whitespace
immediately within a tag. You can think of them as alligators eating the
whitespace: >
faces out of the tag and eats the whitespace on the outside, and
<
faces into the tag and eats the whitespace on the inside. They’re placed at
the end of a tag definition, after class, id, and attribute declarations but
before /
or =
. For example:
%blockquote<
%div
Foo!
is compiled to:

Foo!

And:
%img
%img>
%img
is compiled to:

And:
%p<= "Foo\nBar"
is compiled to:

Foo
Bar

And finally:
%img
%pre><
foo
bar
%img
is compiled to:

foo
bar

Object Reference: []
Square brackets follow a tag definition and contain a Ruby object that is used
to set the class and id of that tag. The class is set to the object’s class
(transformed to use underlines rather than camel case) and the id is set to the
object’s class, followed by the value of its #to_key
or #id
method (in that
order). This is most useful for elements that represent instances of Active
Model models. Additionally, the second argument (if present) will be used as a
prefix for both the id and class attributes. For example:
# file: app/controllers/users_controller.rb
def show
@user = CrazyUser.find(15)
end
-# file: app/views/users/show.haml
%div[@user, :greeting]
%bar[290]/
Hello!
is compiled to:

<bar class='fixnum' id='fixnum_581' />
Hello!

If you require that the class be something other than the underscored object’s
class, you can implement the haml_object_ref
method on the object.
# file: app/models/crazy_user.rb
class CrazyUser < ActiveRecord::Base
def haml_object_ref
"a_crazy_user"
end
end
-# file: app/views/users/show.haml
%div[@user]
Hello!
is compiled to:

Hello!

The :class
attribute may be used in conjunction with an object
reference. The compiled element will have the union of all classes.
- user = User.find(1)
%p[user]{:class => 'alpha bravo'}

Doctype: !!!
When describing HTML documents with Haml, you can have a document type or XML
prolog generated automatically by including the characters !!!
. For example:
!!! XML
!!!
%html
%head
%title Myspace
%body
%h1 I am the international space station
%p Sign my guestbook
is compiled to:
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>Myspace</title>

I am the international space station

Sign my guestbook

You can also specify the specific doctype after the !!!
When the
:format
is set to :xhtml
. The following doctypes are
supported:
!!!
- XHTML 1.0 Transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
!!! Strict
- XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
!!! Frameset
- XHTML 1.0 Frameset
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
!!! 5
- XHTML 5
<!DOCTYPE html>
!!! 1.1
- XHTML 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
!!! Basic
- XHTML Basic 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
!!! Mobile
- XHTML Mobile 1.2
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">
!!! RDFa
- XHTML+RDFa 1.0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
When the :format
option is set to :html4
, the following
doctypes are supported:
!!!
- HTML 4.01 Transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
!!! Strict
- HTML 4.01 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
!!! Frameset
- HTML 4.01 Frameset
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
When the :format
option is set to :html5
,
!!!
is always <!DOCTYPE html>
.
If you’re not using the UTF-8 character set for your document, you can specify which encoding should appear in the XML prolog in a similar way. For example:
!!! XML iso-8859-1
is compiled to:
<?xml version='1.0' encoding='iso-8859-1' ?>
If the mime_type of the template being rendered is text/xml
then a format of
:xhtml
will be used even if the global output format is set to :html4
or
:html5
.
Comments
Haml supports two sorts of comments: those that show up in the HTML output and those that don’t.
HTML Comments: /
The forward slash character, when placed at the beginning of a line, wraps all text after it in an HTML comment. For example:
%peanutbutterjelly
/ This is the peanutbutterjelly element
I like sandwiches!
is compiled to:
<peanutbutterjelly>

I like sandwiches!
</peanutbutterjelly>
The forward slash can also wrap indented sections of code. For example:
/
%p This doesn't render...
%div
%h1 Because it's commented out!
is compiled to:

Conditional Comments: /[]
You can also use Internet Explorer conditional
comments by enclosing the condition
in square brackets after the /
. For example:
/[if IE]
%a{ :href => 'http://www.mozilla.com/en-US/firefox/' }
%h1 Get Firefox
is compiled to:

To generate “downlevel-revealed” conditional comments, where the content is
hidden from IE but not other browsers, add a !
before the brackets: /![]
.
Haml will produce valid HTML when generating this kind of conditional comment.
For example:
/![if !IE]
You are not using Internet Explorer, or are using version 10+.
is compiled to:

You are not using Internet Explorer, or are using version 10+.

Haml Comments: -#
The hyphen followed immediately by the pound sign signifies a silent comment. Any text following this isn’t rendered in the resulting document at all.
For example:
%p foo
-# This is a comment
%p bar
is compiled to:

foo

bar

You can also nest text beneath a silent comment. None of this text will be rendered. For example:
%p foo
-#
This won't be displayed
Nor will this
Nor will this.
%p bar
is compiled to:

foo

bar

Ruby Evaluation
Inserting Ruby: =
The equals character is followed by Ruby code. This code is evaluated and the output is inserted into the document. For example:
%p
= ['hi', 'there', 'reader!'].join " "
= "yo"
is compiled to:

hi there reader!
yo

If the :escape_html
option is set, =
will sanitize
any HTML-sensitive characters generated by the script. For example:
= ''
would be compiled to

=
can also be used at the end of a tag to insert Ruby code within that tag.
For example:
%p= "hello"
would be compiled to:

hello

A line of Ruby code can be stretched over multiple lines as long as each line but the last ends with a comma. For example:
= link_to_remote "Add to cart",
:url => { :action => "add", :id => product.id },
:update => { :success => "cart", :failure => "error" }
Note that it’s illegal to nest code within a tag that ends with =
.
Running Ruby: -
The hyphen character is also followed by Ruby code. This code is evaluated but not inserted into the document.
It is not recommended that you use this widely; almost all processing code and logic should be restricted to Controllers, Helpers, or partials.
For example:
- foo = "hello"
- foo << " there"
- foo << " you!"
%p= foo
is compiled to:

hello there you!

A line of Ruby code can be stretched over multiple lines as long as each line but the last ends with a comma. For example:
- links = {:home => "/",
:docs => "/docs",
:about => "/about"}
Ruby Blocks
Ruby blocks, like XHTML tags, don’t need to be explicitly closed in Haml.
Rather, they’re automatically closed, based on indentation. A block begins
whenever the indentation is increased after a Ruby evaluation command. It ends
when the indentation decreases (as long as it’s not an else
clause or
something similar). For example:
- (42...47).each do |i|
%p= i
%p See, I can count!
is compiled to:

42

43

44

45

46

See, I can count!

Another example:
%p
- case 2
- when 1
= "1!"
- when 2
= "2?"
- when 3
= "3."
is compiled to:

2?

Whitespace Preservation: ~
~
works just like =
, except that it runs Haml::Helpers.preserve
on its input. For example,
~ "Foo\n
Bar\nBaz
"
is the same as:
= find_and_preserve("Foo\n
Bar\nBaz
")
and is compiled to:
Foo

Bar
Baz

See also Whitespace Preservation.
Ruby Interpolation: #{}
Ruby code can also be interpolated within plain text using #{}
, similarly to
Ruby string interpolation. For example,
%p This is #{h quality} cake!
is the same as
%p= "This is #{h quality} cake!"
and might compile to:

This is scrumptious cake!

Backslashes can be used to escape #{}
strings, but they don’t act as escapes
anywhere else in the string. For example:
%p
Look at \\#{h word} lack of backslash: \#{foo}
And yon presence thereof: \{foo}
might compile to:

Look at \yon lack of backslash: #{foo}
And yon presence thereof: \{foo}

Interpolation can also be used within filters. For example:
:javascript
$(document).ready(function() {
alert(#{@message.to_json});
});
might compile to:

Gotchas
Haml uses an overly simplistic regular expression to identify string interpolation rather than a full-blown Ruby parser. This is fast and works for most code but you may have errors with code like the following:
%span #{'{'}
This code will generate a syntax error, complaining about unbalanced brackets. In cases like this, the recommended workaround is output the code as a Ruby string to force Haml to parse the code with Ruby.
%span= "#{'{'}"
Escaping HTML: &=
An ampersand followed by one or two equals characters evaluates Ruby code just like the equals without the ampersand, but sanitizes any HTML-sensitive characters in the result of the code. For example:
&= "I like cheese & crackers"
compiles to
I like cheese & crackers
If the :escape_html
option is set, &=
behaves
identically to =
.
&
can also be used on its own so that #{}
interpolation is escaped. For
example,
& I like #{"cheese & crackers"}
compiles to:
I like cheese & crackers
Unescaping HTML: !=
An exclamation mark followed by one or two equals characters evaluates Ruby code just like the equals would, but never sanitizes the HTML.
By default, the single equals doesn’t sanitize HTML either. However, if the
:escape_html
option is set, =
will sanitize the
HTML, but !=
still won’t. For example, if :escape_html
is set:
= "I feel !"
!= "I feel !"
compiles to
I feel !
I feel !
!
can also be used on its own so that #{}
interpolation is unescaped.
For example,
! I feel #{""}!
compiles to
I feel !
Filters
The colon character designates a filter. This allows you to pass an indented block of text as input to another filtering program and add the result to the output of Haml. The syntax is simply a colon followed by the name of the filter. For example:
%p
:markdown
# Greetings
Hello, *World*
is compiled to:

Greetings

Hello, World

Filters can have Ruby code interpolated with #{}
. For example:
- flavor = "raspberry"
#content
:textile
I *really* prefer _#{flavor}_ jam.
is compiled to

I really prefer raspberry jam.

The functionality of some filters such as Markdown can be provided by many different libraries. Usually you don’t have to worry about this - you can just load the gem of your choice and Haml will automatically use it.
However in some cases you may want to make Haml explicitly use a specific gem to be used by a filter. In these cases you can do this via Tilt, the library Haml uses to implement many of its filters:
Tilt.prefer Tilt::RedCarpetTemplate
See the Tilt documentation for more info.
Haml comes with the following filters defined:
:cdata
Surrounds the filtered text with CDATA tags.
:coffee
Compiles the filtered text to JavaScript in


You did it!
Edit end.html to create your own ending screen
Restart
- Template credits -
Code and documentation:
@ker0chanFR
Characters and background art:
@LtEmi


| PostgreSQL 9.0.10 Documentation | ||||
|---|---|---|---|---|
| Prev | Up | Chapter 3. Advanced Features | Next |
Transactions are a fundamental concept of all database systems. The essential point of a transaction is that it bundles multiple steps into a single, all-or-nothing operation. The intermediate states between the steps are not visible to other concurrent transactions, and if some failure occurs that prevents the transaction from completing, then none of the steps affect the database at all.
For example, consider a bank database that contains balances for various customer accounts, as well as total deposit balances for branches. Suppose that we want to record a payment of $100.00 from Alice's account to Bob's account. Simplifying outrageously, the SQL commands for this might look like:
UPDATE accounts SET balance = balance - 100.00 WHERE name = 'Alice'; UPDATE branches SET balance = balance - 100.00 WHERE name = (SELECT branch_name FROM accounts WHERE name = 'Alice'); UPDATE accounts SET balance = balance + 100.00 WHERE name = 'Bob'; UPDATE branches SET balance = balance + 100.00 WHERE name = (SELECT branch_name FROM accounts WHERE name = 'Bob');
The details of these commands are not important here; the important point is that there are several separate updates involved to accomplish this rather simple operation. Our bank's officers will want to be assured that either all these updates happen, or none of them happen. It would certainly not do for a system failure to result in Bob receiving $100.00 that was not debited from Alice. Nor would Alice long remain a happy customer if she was debited without Bob being credited. We need a guarantee that if something goes wrong partway through the operation, none of the steps executed so far will take effect. Grouping the updates into a transaction gives us this guarantee. A transaction is said to be atomic: from the point of view of other transactions, it either happens completely or not at all.
We also want a guarantee that once a transaction is completed and acknowledged by the database system, it has indeed been permanently recorded and won't be lost even if a crash ensues shortly thereafter. For example, if we are recording a cash withdrawal by Bob, we do not want any chance that the debit to his account will disappear in a crash just after he walks out the bank door. A transactional database guarantees that all the updates made by a transaction are logged in permanent storage (i.e., on disk) before the transaction is reported complete.
Another important property of transactional databases is closely related to the notion of atomic updates: when multiple transactions are running concurrently, each one should not be able to see the incomplete changes made by others. For example, if one transaction is busy totalling all the branch balances, it would not do for it to include the debit from Alice's branch but not the credit to Bob's branch, nor vice versa. So transactions must be all-or-nothing not only in terms of their permanent effect on the database, but also in terms of their visibility as they happen. The updates made so far by an open transaction are invisible to other transactions until the transaction completes, whereupon all the updates become visible simultaneously.
In PostgreSQL, a transaction is set up by surrounding the SQL commands of the transaction with BEGIN and COMMIT commands. So our banking transaction would actually look like:
BEGIN; UPDATE accounts SET balance = balance - 100.00 WHERE name = 'Alice'; -- etc etc COMMIT;
If, partway through the transaction, we decide we do not want to commit (perhaps we just noticed that Alice's balance went negative), we can issue the command ROLLBACK instead of COMMIT, and all our updates so far will be canceled.
PostgreSQL actually treats every SQL statement as being executed within a transaction. If you do not issue a BEGIN command, then each individual statement has an implicit BEGIN and (if successful) COMMIT wrapped around it. A group of statements surrounded by BEGIN and COMMIT is sometimes called a transaction block.
Note: Some client libraries issue BEGIN and COMMIT commands automatically, so that you might get the effect of transaction blocks without asking. Check the documentation for the interface you are using.
It's possible to control the statements in a transaction in a more granular fashion through the use of savepoints. Savepoints allow you to selectively discard parts of the transaction, while committing the rest. After defining a savepoint with SAVEPOINT, you can if needed roll back to the savepoint with ROLLBACK TO. All the transaction's database changes between defining the savepoint and rolling back to it are discarded, but changes earlier than the savepoint are kept.
After rolling back to a savepoint, it continues to be defined, so you can roll back to it several times. Conversely, if you are sure you won't need to roll back to a particular savepoint again, it can be released, so the system can free some resources. Keep in mind that either releasing or rolling back to a savepoint will automatically release all savepoints that were defined after it.
All this is happening within the transaction block, so none of it is visible to other database sessions. When and if you commit the transaction block, the committed actions become visible as a unit to other sessions, while the rolled-back actions never become visible at all.
Remembering the bank database, suppose we debit $100.00 from Alice's account, and credit Bob's account, only to find later that we should have credited Wally's account. We could do it using savepoints like this:
BEGIN; UPDATE accounts SET balance = balance - 100.00 WHERE name = 'Alice'; SAVEPOINT my_savepoint; UPDATE accounts SET balance = balance + 100.00 WHERE name = 'Bob'; -- oops ... forget that and use Wally's account ROLLBACK TO my_savepoint; UPDATE accounts SET balance = balance + 100.00 WHERE name = 'Wally'; COMMIT;
This example is, of course, oversimplified, but there's a lot of control possible in a transaction block through the use of savepoints. Moreover, ROLLBACK TO is the only way to regain control of a transaction block that was put in aborted state by the system due to an error, short of rolling it back completely and starting again.


I think the approach DBC and EDA have taken is a huge step in the right direction for a number of reasons. (one of) The huge failing of the tertiary education system iHow do you see yourself engaging with this type of culture?s the seemingly endless factory like process of changing a fortune to sit you in a room and talk at you for five years about abstract concepts relating to a field you may or may not be interested in. The use of exams to demonstrate your knowledge of a subject is an unrealistic representation of the work force for 90% of subjects as it is a memory game, not a learning experience. EDA’s approach of teaching real world examples and simulating an actual work environment is not only more practical for training future developers but is an actual leaning process where new knowledge can be demonstrated through, get this, actually developing something!
I am very impressed. I spent a number of months trying to self teach myself to code leading up to the start of phase 0. or though there are many resources available online for leaning to code, i found that every one of them seems to assume you already have a certain level of knowledge. there seemed to be no option for someone like me with zero understating of computer coding, but then, Phase 0 started and in only 3 weeks i have learned (not just memorised) more then i did in months of going it alone. so as far as i am concerned EDA is one of if not the best resources for learning to code that there is.
my whole schooling life has been based in alternative learning environments having being homeschooled for a number of years before moving on to Discovery and the Unlimited. so without talking myself up in anyway, i think i am probably better prepared for the EDA experience then the vast majority of people.
No, not really. As i’m sure you can imagine i did my research before using my embarrassingly small life saving to pay for this course. I have several friends who graduated from EDA and spoke VERY highly of it. i also followed the blog pretty closely. and of course one of my former teachers now works for Enspiral and i’m willing to assume if he recognised it as somewhere worth working, then there is a very real chance i would as well.
Yes i am and no it does not.


import Context from "./context"
import Context from "./context"
function defer (fn, data) { setTimeout(() => { fn(data) }, 0) }
test if the given operation is an instruction name
const isCommand = o => typeof o === "string" && o[0] === "@"
test if the given operation is a program
const isProgram = Array.isArray
Give unique ids to process
let procId = 1
The given instruction name is not in the commands object
const ERR_INSTR_NOT_FOUND = "Instruction not recognized."
The max loop cycles tests
const ERR_LIMIT_REACHED = "Limit reached. Probably an infinity loop."
Processes are the principal computation unit. It departures from typical processes in that it model the concept of time
export class Process {
constructor (program, context, time, rate) {
this.id = "proc-" + procId++
a stack of values
this.stack = []
the operations are stored in a stack (in reverse order)
this.operations = program ? [program] : []
the context is used to store variables with scope
this.context = new Context(context)
the current time
this.time = typeof time === "number" ? time : 0
how fast time passes
this.rate = typeof rate === "number" ? rate : 1
bind error to allow destructuring in commands
this.error = this.error.bind(this)
}
wait an amount of time
wait (time) {
this.time += this.rate * time
}
The process is agnostic about the commands to be use
step (commands) {
const { operations } = this
if (operations.length) {
const instr = operations.pop()
if (instr === null || instr === undefined) {
ignore
} else if (typeof instr === "function") {
it runs the functions but outside the loop
defer(instr, this.time)
} else if (isProgram(instr)) {
if it”s program, and since the operations are stored into an stack, we need add to the program operations in reverse order
for (let i = instr.length - 1; i >= 0; i--) {
operations.push(instr[i])
}
} else if (isCommand(instr)) {
const cmd = commands[instr]
if (typeof cmd === "function") cmd(this)
else this.error("step > ", ERR_INSTR_NOT_FOUND, instr)
} else {
if it”s a value, push it into the stack
this.stack.push(instr)
}
}
}
the resume
function run all the operations until time is reached
resume (commands, time = Infinity, limit = 10000) {
const { operations } = this
while (--limit > 0 && this.time < time && operations.length) {
this.step(commands)
}
if (limit === 0) throw Error(ERR_LIMIT_REACHED)
return operations.length > 0
}
an utility function to write errors
error (instr, msg, obj) {
console.error(instr, msg, obj, "id", this.id, "time", this.time)
}
}


(Taken from the UC Berkeley Course Guide)
Introduction to design and realization of mechatronics systems. Micro computer architectures. Basic computer IO devices. Embedded microprocessor systems and control, IO programming such as analogue to digital converters, PWM, serial and parallel outputs. Electrical components such as power supplies, operational amplifiers, transformers and filters. Shielding and grounding. Design of electric, hydraulic and pneumatic actuators. Design of sensors. Design of power transmission systems. Kinematics and dynamics of robotics devices. Basic feedback design to create robustness and performance.
E 25, E 26 (junior transfers students are exempt from this requirement), E 27, as well as EE 16A or EE 40
Introduce students to design and design techniques of mechatronics systems; provide guidelines to and experience with design of variety of sensors and actuators; design experience in programming microcomputers and various IO devices; exposure to and design experience in synthesis of mechanical power transfer components; understanding the role of dynamics and kinematics of robotic devices in design of mechatronics systems; exposure to and design experience in synthesis of feedback systems; provide experience in working in a team to design a prototype mechatronics device.
By the end of this course, students should: Know how to set up micro computers and interface them with various devices; know how to understand the microcomputers architectures, IO devices and be able to program them effectively; understand the design of actuators and sensors; know how to do shielding and grounding for various mechatronics projects, know how to create feedback systems, know the role of dynamics and kinematics of robotic devices in design and control of mechatronics systems; know how to design mechanical components such as transmissions, bearings, shafts, and fasteners.
2 hours of lecture and 3 hours of laboratory per week.


uspt prototype
Participate in personality study:
Provide authentication token:
authenticate
First name:
Last name:
Sex:
Select your gender
Male
Female
Other
Birthday:
(Format: ddmmyyyy)
Personal information (used for establishing a secure key, not saved):
Select your personal question
What was the name of your first pet?
What is the first name of the person you first kissed?
What was your mother's maiden name?
What is your father's middle name?
In what city were you born?
Institution:
Survey Key:
login
Factor1:
Factor2:
complete survey
uspt - university students personality testing


About
Coach
Hi, I am Olga Bogdan! I am a coach of Grace Gymnastics Academy.
We Have More Templates for YouLooking for more templates? Just browse through all our Free Website Templates and find what you're looking for. But if you don't find any website template you can use, you can try our Free Web Design service and tell us all about it. Maybe you're looking for something different, something special. And we love the challenge of doing something different and something special.
Be Part of Our CommunityIf you're experiencing issues and concerns about this website template, join the discussion on our forum and meet other people in the community who share the same interests with you.
Version 5
Website Template details, discussion and updates for this Yoga Website Template. Website Template design by Free Website Templates.
Please feel free to remove some or all the text and links of this page and replace it with your own About content.


3555 Farnam Street Omaha, NE 68131
Official Home PageIf you have any comments about our WEB page, you can either write us at the address shown above or e-mail us at<EMAIL_ADDRESS>However, due to the limited number of personnel in our corporate office, we are unable to provide a direct response.
Legal Disclaimer
Copyright © 1978-2015 Berkshire Hathaway Inc.


I have been using poppy seeds for approixmately nine months now. My use has ranged from every day for a few days in a row to once every two weeks. I have extensively experimented with a wide range of drugs and almost all commerically available opiates, not including heroin. Poppy seed tea is no joke. The first time I read about it, I managed to make a mess, spend 10 bucks, and get nothing out of it. I tried it again using seeds for a different store, and got a noticable but fairly insignificant buzz. After narrowing down which suppliers have the best poppies and the correct recipe, I have managed to get seriously high for approximately $2 a hit and not make a mess in the process.
To make poppy seed tea I get between 8 oz to 32 oz (.5 to 2 lbs) of poppies per person. I put the poppy seeds in a trash bag and pour water over the seeds untit it gains a soupy texture (I can feel it through the bag). The optimal mixture is just enough so the poppy seeds can freely move through the mixture but not so much that I'm forced to drink a pitcher full of tea. I massage the mixture for about one minute or two, and then get a needle or earring and a pitcher. I poke holes in the bag so that the water can escape without allowing the poppy seeds to escape. A slow drip is preferable to a fast one. If I want to accelerate the drip, I put air in the bag, seal the bag, and use the air to push the water out. T shirts are o.k but 1) the shirt absorbs some of the alkaloids, 2) you lose the t-shirt, and 3) it tends to make a mess. I don't add lime juice unless I want the taste, it has no effect on the potency of the mixture.
The two indicators of strength are color and taste. In general, the darker, the stronger, and the more bitter, the stronger. Bitterness is always 100% correlated with strength, color I would say 90% of the time. I would liken the effects of the tea of 8 oz. of strong poppy seeds to eating 20 mg of oxycontin, with the added 'trippy' effect of morphine. The effects can last a long time, up to 12 hours per dose. It calms my nerves, numbs pain, makes boring things more interesting, and allows me to socialize with more warmth. The risk of psychological/physical addiction is the same as any other opiate.
If your seeds don't work, you probably got bad ones. I would say that at least 50% of store bought seeds don't work. My experience is:
1) If they are expensive, they probably won't work.
2) If you can only buy them in 4 oz or 8 oz packs, they probably won't work
3) Co-ops and health food stores typically don't have good seeds. I have only gotten high potency seeds at farmer's markets.
4) Seeds follow a 'when it rains, it pours' pattern. Every store might have great seeds for a month, and then all of the sudden, you can't find any anywhere. I'm sure this is due to regional distribution and supply patterns.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Email or username
Password
Not a member yet ? Join us
First Name
Last Name
Mobile No
Email
Please confirm your password
Already a member ? Go and log in


BIG MOMMA'S HOUSE
Review by John Beachem
* * *
Directed by: Raja Gosnell
Written by: Darryl Quarles
Malcolm Turner (Martin Lawrence) is an FBI agent who takes his work a little too seriously. He will dress in any disguise, no matter how ridiculous or embarassing to catch a culprit. His latest assignment involves both he and his partner, John (Paul Giamatti), going down south to stake out the home of massive elderly woman Big Momma (Ella Mitchell). They're trying to catch Big Momma's grand-daughter, Sherry (Nia Long), who they think was involved in a bank robbery several years ago. Sherry worked at a bank which her boyfriend robbed, and the money was never recovered. Unfortunately Big Momma has been called away to see a sick friend, and she won't be home when Sherry arrives. Seeing his chance to catch Sherry slipping away, Malcolm decides to try his most embarassing disguise yet, playing Big Momma. This involves him dealing with such tasks as acting as the neighborhood midwife; dealing with a sadistic karate instructor (Anthony Anderson); trying to live up to the expectations of Sherry's son, Trent (Jascha Washington); and fending off the very unwelcome advances of an admiring suitor (Carl Wright).
I often hear Martin Lawrence called a poor man's Eddie Murphy. I've never agreed with this because the two actors have very different acting styles. Murphy is a bit more quiet and a lot more vulgar. Lawrence is often hilariously over the top, and he is great at playing a fish out of water type character; but he's obviously not as good an actor as Murphy. What Lawrence lacks in serious acting talent he usually makes up for in energy ("Blue Streak", "Nothing to Lose") or originality ("Life"). Such is not the case with his latest outing, "Big Momma's House", which destroys the validity of my arguments for Lawrence having a style of his own. This movie is nothing more than a blatant rip off of Murphy's similar role in "The Nutty Professor". However, all the pent up energy that usually makes Lawrence so entertaining is strangely absent. Instead, we get Lawrence looking very bored under a ton of makeup, using a scratchy, high-pitched voice that somehow sounds worse than fingernails on a chalk board. The saddest part of all this is that despite the tons of makeup they have piled on poor Martin, I could never believe he was an elderly, overweight woman.
In a movie where the star appears bored with the proceedings, it's left to the supporting cast to hold the show up. Thankfully the supporting actors in "Big Momma's House" do a fairly good job. Nia Long ("Held Up"), in particular, does an admirable job as the only straight character in a movie filled with bizarre types. Paul Giammati ("The Negotiator"), who usually plays a little weenie of a character, actually plays a fairly competent one here; even more shocking is that he does it pretty well. The most entertaining character would have to be Anthony Anderson's ("Romeo Must Die") hilariously incompetent security guard. Anderson was one of the best things about Jet Li's "Romeo Must Die", and if he keeps playing his characters like he does here, he'll have quite a comic future ahead of him. The funniest scene with Anderson involves his teaching a karate class to a group of old ladies and being taught a thing or two himself by Malcolm, as Big Momma. Unfortunately, comical scenes like this one are few and far between. The funniest scenes are Nia's initial meeting with Malcolm as Big Momma, Malcolm trying to help deliver a baby, and one where Nia goes to sleep in Big Momma's bed.
One of the worst things about "Big Momma's House" is its use of gross-out jokes. There is one scene (and you'll know it when you get there) that almost had me running out of the theater, ready to lose my lunch. Of course, I've never been a big fan of gross out gags like some people are. If you find the sight of something utterly repugnant to be amusing for some reason, maybe you'll enjoy the film for that reason. Another major fault with Darryl Quarles' script is that several things are never explained. For example, when Nia first shows up at her grandmother's house, she's convinced that Big Momma is going to be angry at her and they haven't spoken in some time, but we never find out why. Nia also carries around a cross which seems to hold some signifigance to both her and her grandmother, but this significance is never explained. The romantic subplot between Malcolm (when he's out of his Big Momma garb) and Nia feels about as rushed and tacked on as is humanly possible. Last, we have the grating soundtrack. If you don't know what kind of music is in a Martin Lawrence movie, you've been living in a cave for the past couple of years. I'm not sure if I'd recommend this movie to Martin Lawrence fans, because they might lose what little respect they have for him after seeing it (I know I did). "Big Momma's House" runs a decent 98 minutes, though most of this run time is pointless fluff. I give it three out of five stars.
Any past movies you want me to review? Send to<EMAIL_ADDRESS>Past reviews can be found at: http://www.dependentfilms.net, http://www.epinions.com/user-elerad?public3Dyes or http://us.imdb.com/ReviewsBy?John+Beachem
* * * * * - One of the best movies of the year.
* * * * - Great flick, try and catch this one.
* * * - Okay movie, hits and misses.
* * - Pretty bad, see it at your own risk.
* - See this one only if you enjoy pain.
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


The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores.
OData is released under the Microsoft Open Specification promise. This allows anyone to create OData services that implement the specification and to freely interoperate with OData implementations. Currently there are several OData service producers and server libraries including .Net Framework, Java, Rails and several client libraries across a range of platforms such as Objective-C, Javascript, PHP, and Java. The fact that an OData service can be consumed by a wide range of applications and libraries makes interoperability a key requirement.
The goal of this tool is to enable OData service authors to validate their implementation against the OData specification to ensure the service interoperates well with any OData client.
Consumers of the OData protocol can also benefit from this tool by testing OData service implementations that they are building an experience for to pinpoint potential issues.
Source code is available on Codeplex. This service is updated every two weeks with the source code on Codeplex. Contributions for rules to increase specification coverage, features and bug fixes are encouraged. If you are interested, just send an email to the OData Mailing List.


I am Assistant Professor (RTD-B) at Dipartimento di Informatica, Università di Roma, La Sapienza.
From February 2012 to March 2015, I have been PhD student at University of Naples "Federico II" working under the supervision of Prof. Aniello Murano. During my PhD, I have been visiting research scholar at Rice University under the supervision of Prof. Moshe Vardi. On April 2015, I joined University of Oxford as Postdoctoral Research Assistant, working with Prof. Michael Wooldridge on his Advanced ERC project RACE. On July 2018, I moved to University of Leicester and then, in June 2019, Chalmers / University of Gothenburg to work with Prof. Nir Piterman as Research Associate on his Consolidator ERC project dSynMA. From January 2020 to November 2021, I have been at Dipartimento di Ingegneria Informatica, Automatica e Gestionale at Università di Roma, La Sapienza as Research Associate, working with Prof. Giuseppe de Giacomo on his Advanced ERC project WhiteMech.
In November 2020, I obtained the National Scientific Qualification for Associate Professor in Computer Science (Scientic Area INF/01).
In May 2021, I obtained the National Scientific Qualification for Associate Professor in Mathematical Logic (Scientific Area MAT/01).
My research interests regard many aspects of formal methods for Artificial Intelligence. In particular, I work on verification and synthesis problems for multi-agent systems, knowledge representation, strategic reasoning, logic, games, and automata theory.
My recent focus has been on Rational Synthesis, which concerns the synthesis of equilibria for games that are used to model multi-agent interacting scenarios such as autonomous-driving cars, automated warehouse, and the like. I have contributed to the development of EVE: a formal verification tool for the automated analysis of temporal equilibrium properties of concurrent and multi-agent systems.


html/css | squarespace | mailchimp | photoshop
This was my first paid, freelance design + UX/UI project commissioned by a startup called The Cowshare. I taught myself the developer side of SquareSpace in order to manipulate & customize a template they had chosen. The project also included designing a few custom email templates using MailChimp (shown below) with a custom logo, which helped me learn the developer side of the service. The last part of the project was a Facebook cover photo which used a similar custom logo.
You can visit The Cowshare to see the site.
The project included 4 email templates.
Welcome email - when users sign up through their website.
Order Confirmation email - when users submit an order through their website.
A monthly newsletter option with the custom logo.
Another monthly newsletter option with a second custom logo.
Modified custom logos for the Facebook cover photos.


Choose how to spend your time
Rest
%
Train Body
%
Train Ki (todo)
%
Time remaining :
%
Stats
Body strength :
Body toughness :
Body speed :


This is the web site of SentryCorp, Ltd.
Our postal address is:
Reno Gould House
832 Willow Street
Reno, NV 89502
We can be reached via e-mail at<EMAIL_ADDRESS>you can reach us by telephone at<PHONE_NUMBER>.
For each visitor to our Web page, our Web server automatically recognizes no information regarding the domain or e-mail address.
We collect the e-mail addresses of those who communicate with us via e-mail. We may also aggregate information on both what pages are accessed or visited and information volunteered by the client, such as survey information and/or site registrations.
The information we collect is used for internal review and is then discarded, as well as used to improve the content of our Web page. We do not set any cookies, nor do we make our client lists available to any third-party organization.
If you supply us with your postal address online you will only receive the information for which you provided us your address.
Persons who supply us with their telephone numbers online will only receive telephone contact from us with information regarding requests they have placed online.
We do not partner with or have special relationships with any ad server companies.
From time to time, we may use client information for new, unanticipated uses not previously disclosed in our privacy notice. If our information practices change at some time in the future, we will use -- for these new purposes -- only data collected from the time of the policy change forward.
Clients may prevent their information from being used for purposes other than those for which it was originally collected by contacting us at the email or telephone number provided above.


Many times, you will want some functions to run automatically when the page loads. This example shows the activation of the constructor scripts for 2 Accordion widgets on the same page. We’ve also moved the JavaScript functions to an external file so that the script is unobtrusive.


Across: 1,21. ? (6,6,2,7) 9. Bouts of chaos - less lines (9) 10. Some boys pit empathy against enmity (5) 11. Regular strange light in New York (7) 12. Defence has a big thing about war (7) 13. Knock back oil of leaf (5) 14. see 3-Down 15. see 1-Down 17. Waiter returns fine webs (5) 20. Number of Bond's little curtain (7) 21. see 1-Across 22. Away from home in Rome: and embracing the odd local peace (5) 23. see 1-Down 24. Concocted a rent mixup - a friend's job! (2,3,9) Down: 1,15,15-Across,23-Across. ? (5,2,6,9,9) 2. Pirate sick, bringing up large bits out of gut (7) 3,14-Across. Waves "no" to me, tracing delicate air-letters (15,9) 4. Outwardly, siblings were bossy with sook (5) 5. No bet for such beasts (3) 6. I bear a "yes" - allege as wildly as you will! (6,9) 7. One craft or one game, one dismisses the east (7) 8. Figure performed once with Rook and King (6) 12. Pass time with some plumbing (5) 14. Rear of modern era is end of time (5) 15. see 1-Down 16. Plays company, plays music (7) 18. Arranged abridged instruction (7) 19.  Poplar sword is not as mighty .. (5) 23. ... as legendary bird's back, or capped head (3)


Guidance
School teachers’ pay and conditions: guidance
Guidance to help schools and governing bodies develop their approach to teachers' and school leaders' pay.
Documents
Ref:
DFE- 00187 -2016
PDF
,
511KB
,
54 pages
Ref:
DFE-00203-2016
PDF
,
580KB
,
55 pages
Details
This is for:
-
governing bodies
-
local authorities
-
school leaders
-
school teachers
It applies to local-authority-maintained schools.
It will help schools:
-
carry out changes set out in the
2016 school teachers’ pay and conditions document
-
set school leaders’ pay
-
manage performance-related pay progression
-
meet their equalities responsibilities
-
use appropriate evidence when making appraisal and pay decisions
-
manage pay decision appeals


Today I have a planned flight with Iberia airlines at 12:05 but because they oversell tickets and don't know how to manage a modification in the reservations force me to buy a new flight ticket with my own money and some anxiety increase in my body. I will use this to know how long I need to wait on airports to reach home.


The security model of WebAssembly has two important goals: (1) protect users from buggy or malicious modules, and (2) provide developers with useful primitives and mitigations for developing safe applications, within the constraints of (1).
Each WebAssembly module executes within a sandboxed environment separated from the host runtime using fault isolation techniques. This implies:
Additionally, each module is subject to the security policies of its embedding. Within a web browser, this includes restrictions on information flow through same-origin policy. On a non-web platform, this could include the POSIX security model.
The design of WebAssembly promotes safe programs by eliminating dangerous features from its execution semantics, while maintaining compatibility with programs written for C/C++.
Modules must declare all accessible functions and their associated types at load time, even when dynamic linking is used. This allows implicit enforcement of control-flow integrity (CFI) through structured control-flow. Since compiled code is immutable and not observable at runtime, WebAssembly programs are protected from control flow hijacking attacks.
Variables in C/C++ can be lowered to two different primitives in WebAssembly,
depending on their scope. Local variables
with fixed scope and global variables are
represented as fixed-type values stored by index. The former are initialized
to zero by default and are stored in the protected call stack, whereas
the latter are located in the global index space
and can be imported from external modules. Local variables with
unclear static scope (e.g. are used by the address-of
operator, or are of type struct
and returned by value) are stored in a separate
user-addressable stack in linear memory at
compile time. This is an isolated memory region with fixed maximum size that is
zero initialized by default. References to this memory are computed with
infinite precision to avoid wrapping and simplify bounds checking. In the future,
support for multiple linear memory sections and
finer-grained memory operations
(e.g. shared memory, page protection, large pages, etc.) will be implemented.
Traps are used to immediately terminate execution and signal abnormal behavior to the execution environment. In a browser, this is represented as a JavaScript exception. Support for module-defined trap handlers will be implemented in the future. Operations that can trap include:
Compared to traditional C/C++ programs, these semantics obviate certain classes of memory safety bugs in WebAssembly. Buffer overflows, which occur when data exceeds the boundaries of an object and accesses adjacent memory regions, cannot affect local or global variables stored in index space, they are fixed-size and addressed by index. Data stored in linear memory can overwrite adjacent objects, since bounds checking is performed at linear memory region granularity and is not context-sensitive. However, the presence of control-flow integrity and protected call stacks prevents direct code injection attacks. Thus, common mitigations such as data execution prevention (DEP) and stack smashing protection (SSP) are not needed by WebAssembly programs.
Another common class of memory safety errors involves unsafe pointer usage and
undefined behavior. This includes dereferencing
pointers to unallocated memory (e.g. NULL
), or freed memory allocations. In
WebAssembly, the semantics of pointers have been eliminated for function calls
and variables with fixed static scope, allowing references to invalid indexes in
any index space to trigger a validation error at load time, or at worst a trap
at runtime. Accesses to linear memory are bounds-checked at the region level,
potentially resulting in a trap at runtime. These memory region(s) are isolated
from the internal memory of the runtime, and are set to zero by default unless
otherwise initialized.
Nevertheless, other classes of bugs are not obviated by the semantics of WebAssembly. Although attackers cannot perform direct code injection attacks, it is possible to hijack the control flow of a module using code reuse attacks against indirect calls. However, conventional return-oriented programming (ROP) attacks using short sequences of instructions (“gadgets”) are not possible in WebAssembly, because control-flow integrity ensures that call targets are valid functions declared at load time. Likewise, race conditions, such as time of check to time of use (TOCTOU) vulnerabilities, are possible in WebAssembly, since no execution or scheduling guarantees are provided beyond in-order execution and post-MVP atomic memory primitives . Similarly, side channel attacks can occur, such as timing attacks against modules. In the future, additional protections may be provided by runtimes or the toolchain, such as code diversification or memory randomization (similar to address space layout randomization (ASLR)), or bounded pointers (“fat” pointers).
The effectiveness of control-flow integrity can be measured based on its completeness. Generally, there are three types of external control-flow transitions that need to be protected, because the callee may not be trusted:
Together, (1) and (2) are commonly referred to as “forward-edge”, since they correspond to forward edges in a directed control-flow graph. Likewise (3) is commonly referred to as “back-edge”, since it corresponds to back edges in a directed control-flow graph. More specialized function calls, such as tail calls, can be viewed as a combination of (1) and (3).
Typically, this is implemented using runtime instrumentation. During compilation, the compiler generates an expected control flow graph of program execution, and inserts runtime instrumentation at each call site to verify that the transition is safe. Sets of expected call targets are constructed from the set of all possible call targets in the program, unique identifiers are assigned to each set, and the instrumentation checks whether the current call target is a member of the expected call target set. If this check succeeds, then the original call is allowed to proceed, otherwise a failure handler is executed, which typically terminates the program.
In WebAssembly, the execution semantics implicitly guarantee the safety of (1) through usage of explicit function section indexes, and (3) through a protected call stack. Additionally, the type signature of indirect function calls is already checked at runtime, effectively implementing coarse-grained type-based control-flow integrity for (2). All of this is achieved without explicit runtime instrumentation in the module. However, as discussed previously, this protection does not prevent code reuse attacks with function-level granularity against indirect calls.
The Clang/LLVM compiler infrastructure includes a built-in implementation of fine-grained control flow integrity, which has been extended to support the WebAssembly target. It is available in Clang/LLVM 3.9+ with the new WebAssembly backend.
Enabling fine-grained control-flow integrity (by passing -fsanitize=cfi
to
emscripten) has a number of advantages over the default WebAssembly
configuration. Not only does this better defend against code reuse attacks that
leverage indirect function calls (2), but it also enhances the built-in function
signature checks by operating at the C/C++ type level, which is semantically
richer that the WebAssembly type level, which consists
of only four value types. Currently, enabling this feature has a small
performance cost for each indirect call, because an integer range check is
used to verify that the target index is trusted, but this will be eliminated in
the future by leveraging built-in support for
multiple indirect tables with homogeneous type
in WebAssembly.


Why choose Toolshed?
Our friendly and easy to use interface makes using ToolShed a breeze.
Our friendly and easy to use interface makes using ToolShed a breeze.
ToolShed will find tools available for you anywhere anytime.
ToolShed makes paying for tools or receiving payment easy and worryfree.
Dont believe us?
See what are users say.
Totally worth it!!
- Dany Soup
I've already made 100 bucks this week.
- Chief Bob
Needed a saw to finish my project. ToolShed found one available to rent a couple blocks down.
- Allison Grechin
I wish I knew about Toolshed sooner
- Chrissy P. Bacon


Home
Search
Library
Create Playlist
Liked Songs
Wish you were here
Mood
Home alone
Car
I hate this
Random songs
Girls night
Just before winking
Install App
50 songs


boolean
return type, which are only used in a negated context.
The quick-fix makes it possible to rename and invert the method.
Due to performance reasons some methods might not be reported during in-editor highlighting.
Example:
class C { boolean alwaysTrue() { return true; } void f() { if (!alwaysTrue()) { return; } } boolean member = !alwaysTrue(); }
After the quick-fix is applied, the result looks like this:
class C { boolean alwaysFalse() { return false; } void f() { if (alwaysFalse()) { return; } } boolean member = alwaysFalse(); }


Home
Version
Info
Nothing
Sample App
Hello, friend.
This application is serving this page and stuff.
Cat Fact
{{ caption }}
System Info
System: {{ uname.system }}
Node: {{ uname.node }}
Release: {{ uname.release }}
Version: {{ uname.version }}
Machine: {{ uname.machine }}
Processor: {{ uname.processor }}