Representational state transfer (REST) and Simple Object Access Protocol (SOAP)

Question: Can somebody explain what is REST and what is SOAP in plain english? And how Web Services work?
Comment: You must read this [PDF](http://www.jopera.org/files/soa-amsterdam-restws-pautasso-talk.pdf) for understanding REST and SOAP web services.
Comment: You can check this blog http://javapapers.com/web-service/rest-vs-soap/
Comment: Can I recommend reading Fielding's Dissertation on the subject of REST: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Comment: @PhilipCouling I wouldn't call any PhD dissertation plain English...
Comment: possible duplicate of [SOAP or REST for Web Services?](http://stackoverflow.com/questions/76595/soap-or-rest-for-web-services)
Comment: you can use these tow links:    https://stackoverflow.com/questions/30581530/what-is-the-difference-between-soap-and-rest-webservices-can-soap-be-restful AND
  https://www.dotnettricks.com/learn/webapi/difference-between-soap-and-rest-apis
Answer: Simple explanation about SOAP and REST
SOAP - "Simple Object Access Protocol"
SOAP is a method of transferring messages, or small amounts of information, over the Internet. SOAP messages are formatted in XML and are typically sent using HTTP (hypertext transfer protocol).

Rest - Representational state transfer
Rest is a simple way of sending and receiving data between client and server and it doesn't have very many standards defined. You can send and receive data as JSON, XML or even plain text. It's light weighted compared to SOAP.
Comment: SOAP is much more than sending data in an envelope. However, it's mostly used to send a BLOB to the server, ignoring whatever features SOAP also provides. So basically, most people use SOAP like REST with a standard envelope. (SOAP is a good example of over-engineering)
Comment: For every complex problem there is an answer that is clear, simple, and wrong.  --H. L. Mencken
Comment: KEEP READING. While this answer is entertaining @Pavel's answer below is much more complete.
Comment: SOAP does in NO WAY force one to use HTTP or XML. HTTP and XML are the things defined in WS-I for interoperability, but one can also send POJOs over JMS. The thing is, that the programmer does not need to care: The service bus manages the transport and the encoding.
Comment: The example was epic!
Comment: To be fair the guy did ask for an anser in "in plain english". This is about as plain as one can get. Good entertaining answer.
Comment: @Morten - Just visited techexplainedwithmartinlawrence.com. It is now a camping site. For some reason I find that fantastic. +1 internets to you.
Answer: Both methods are used by many of the large players.  It's a matter of preference.  My preference is REST because it's simpler to use and understand.
Simple Object Access Protocol (SOAP):

SOAP builds an XML protocol on top of HTTP or sometimes TCP/IP.
SOAP describes functions, and types of data.
SOAP is a successor of XML-RPC and is very similar, but describes a standard way to communicate.
Several programming languages have native support for SOAP, you typically feed it a web service URL and you can call its web service functions without the need of specific code.
Binary data that is sent must be encoded first into a format such as base64 encoded.
Has several protocols and technologies relating to it: WSDL, XSDs, SOAP, WS-Addressing

Representational state transfer (REST):

REST need not be over HTTP but most of my points below will have an HTTP bias.
REST is very lightweight, it says wait a minute, we don't need all of this complexity that SOAP created.
Typically uses normal HTTP methods instead of a big XML format describing everything.  For example to obtain a resource you use HTTP GET, to put a resource on the server you use HTTP PUT.  To delete a resource on the server you use HTTP DELETE.
REST is a very simple in that it uses HTTP GET, POST and PUT methods to update resources on the server.
REST typically is best used with Resource Oriented Architecture (ROA).  In this mode of thinking everything is a resource, and you would operate on these resources.
As long as your programming language has an HTTP library, and most do, you can consume a REST HTTP protocol very easily.
Binary data or binary resources can simply be delivered upon their request.

There are endless debates on REST vs SOAP on google.
My favorite is this one.
Update 27 Nov 2013: Paul Prescod's site appears to have gone offline and this article is no longer available, copies though can be found on the Wayback Machine or as a PDF at CiteSeerX.
Comment: REST has nothing to do with HTTP (it is protocol independent), and XML is fine to use within a RESTful architecture. GET/POST/PUT/DELETE is simply using HTTP correctly - necessary for REST but not sufficient.
Comment: REST simply says 'use a uniform interface'. Since the HTTP Interface [GET, POST, PUT, DELETE, (UPDATE, HEAD)] became the 'uniform interface' of the web, REST (on the web) is somehow dependent on HTTP in my opinion!
Comment: How can REST client know what methods and types he may use? In SOAP there is WSDL from which many tools can generate classes and methods.
Comment: @jlp: It is up to the REST client developer to properly use the exposed REST interface.
Comment: @aehlke REST is VERY MUCH dependent on HTTP. To say otherwise is insane. The REST approach is solidly defined via the HTTP RFC (by the W3C TAG). There is no other specification of it other than a doctoral dissertation by Roy Fielding of UC Irvine. See: http://en.wikipedia.org/wiki/Representational_state_transfer
Comment: Hi @Brenden, thanks for your comment. You're responding to something I wrote 4 years ago though - I agree with its dependency on HTTP.
Comment: http://zacstewart.com/2012/04/14/http-options-method.html - the OPTIONS header can be used to help define which verbs a specific resource url supports.
Comment: SOAP does not need to be over HTTP and XML, but mostly it uses that for interoperability. For instance, see http://www.w3.org/TR/soapjms/#introduction-outofscope
Comment: > How can REST client know what methods and types he may use?

You're supposed to return a certain map of available action urls from your request handler, which client may use to look as "where to go next from there". I'm not sure if there's anything but convention for the types.
Comment: types are defined by... content-type headers! They're part of the HTTP interface along with the standard verbs.
Comment: @jlp - The methods a REST developer can use over HTTP are simply GET, PUT, POST and DELETE (and maybe HEAD); simple as that. That is a benefit, not a limitation is and one of the things that makes REST so powerful when compared to an RPC protocol like SOAP.
Comment: https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS#Preflighted_requests - also useful reading about preflighted requests
Comment: REST only works over HTTP and HTTPS. WS/SOAP works over HTTP, HTTPS, SMTP, XMPP, etc.
Answer: REST
I understand the main idea of REST is extremely simple. We have used web browsers for years and we have seen how easy, flexible, performing, etc web sites are. HTML sites use hyperlinks and forms as the primary means of user interaction. Their main goal is to allow us, clients, to know only those links that we can use in the current state. And REST simply says 'why not use the same principles to drive computer rather than human clients through our application?' Combine this with the power of the WWW infrastructure and you'll get a killer tool for building great distributed applications.
Another possible explanation is for mathematically thinking people. Each application is basically a state machine with business logic actions being state transitions. The idea of REST is to map each transition onto some request to a resource and provide clients with links representing transitions available in the current state. Thus it models the state machine via representations and links. This is why it's called REpresentational State Transfer.
It's quite surprising that all answers seem to focus either on message format, or on HTTP verbs usage. In fact, the message format doesn't matter at all, REST can use any one provided that the service developer documents it. HTTP verbs only make a service a CRUD service, but not yet RESTful. What really turns a service into a REST service are hyperlinks (aka hypermedia controls) embedded into server responses together with data, and their amount must be enough for any client to choose the next action from those links.
Unfortunately, it's rather difficult to find correct info on REST on the Web, except for the Roy Fielding's thesis. (He's the one who derived REST). I would recommend the 'REST in Practice' book as it gives a comprehensive step-by-step tutorial on how to evolve from SOAP to REST.
SOAP
This is one of the possible forms of RPC (remote procedure call) architecture style. In essence, it's just a technology that allows clients call methods of server via service boundaries (network, processes, etc) as if they were calling local methods. Of course, it actually differs from calling local methods in speed, reliability and so on, but the idea is that simple.
Compared
The details like transport protocols, message formats, xsd, wsdl, etc. don't matter when comparing any form of RPC to REST. The main difference is that an RPC service reinvents bicycle by designing it's own application protocol in the RPC API with the semantics that only it knows. Therefore, all clients have to understand this protocol prior to using the service, and no generic infrastructure like caches can be built because of proprietary semantics of all requests. Furthermore, RPC APIs do not suggest what actions are allowed in the current state, this has to be derived from additional documentation. REST on the other hand implies using uniform interfaces to allow various clients to have some understanding of API semantics, and hypermedia controls (links) to highlight available options in each state. Thus, it allows for caching responses to scale services and making correct API usage easily discoverable without additional documentation.
In a way, SOAP (as any other RPC) is an attempt to tunnel through a service boundary treating the connecting media as a black box capable of transmitting messages only. REST is a decision to acknowledge that the Web is a huge distributed information system, to accept the world as is and learn to master it instead of fighting against it.
SOAP seems to be great for internal network APIs, when you control both the server and the clients, and while the interactions are not too complex. It's more natural for developers to use it. However, for a public API that is used by many independent parties, is complex and big, REST should fit better. But this last comparison is very fuzzy.
Update
My experience has unexpectedly shown REST development to be more difficult than SOAP. At least for .NET. While there are great frameworks like ASP.NET Web API, there's no tooling that would automatically generate client-side proxy. Nothing like 'Add Web Service Reference' or 'Add WCF Service Reference'. One has to write all serialization and service querying code by hand. And man, that's lots of boilerplate code. I think REST development needs something similar to WSDL and tooling implementation for each development platform. In fact, there seems to be a good ground: WADL or WSDL 2.0, but neither of the standards seems to be well-supported.
Update (Jan 2016)
Turns out there is now a wide variety of tools for REST API definition. My personal preference is currently RAML.
How Web Services work
Well, this is a too broad question, because it depends on the architecture and technology used in the specific web service. But in general, a web service is simply some application in the Web that can accept requests from clients and return responses. It's exposed to the Web, thus it's a web service, and it's typically available 24/7, that's why it's a service. Of course, it solves some problem (otherwise why would someone ever use a web service) for its clients.
Comment: This should be the most upvoted answer by far! I have a sense of humour, but it's depressing when comedy answers on StackOverflow trump well considered ones.
Comment: @TomHall I guess this situation is a bit specific to REST - RPC discussion, not only on SO. I guess that is the reason we don't have reasonable tooling for REST clients. At least on .NET, implementing a REST service client has proved to be way more difficult than generating a SOAP service reference. One has to write the proxy classes by hand. For some reason people think about REST as if there were no rules at all, while the original idea on the contrary puts much more restrictions on the architecture. I wish the community understood REST - then we could expect better tooling and adoption.
Comment: @PavelGatilov This answer is great.  I had read other REST explanations and never "got it" that the driving principle is that possible state transitions are part of the response. The fact that you took the time to reflect back on your experience and acknowlede the difficulties is also of great value to everyone of us.
Comment: Excellent answer. I wonder how long it will take for REST-I to develop now with it starting to look more and more SOAP like with RAML , Swagger  and WADL slogging it out for the de-facto standard of being REST.  I found the lack of tooling on REST compared to SOAP a major pain when developing some rather sensitive and complex financial systems. Both REST and SOAP are awesome when used correctly. My grandfather always said you can use a screwdriver to hammer in a nail but it aint going to work that well. Same applies here. Right tool for the job mentality not my way is the only way.\
Comment: Oh I also favor RAML and I prefer top down development, the one thing I found most disturbing about REST was the lack of a structured top down approach. I like to think before I act .
Comment: I don't know for how long but there are currently multiple ways to consume Rest-Apis as .Net Developer. There is Add ->REST API Client on same level as Add-> Service Reference and the classic add Service Reference help got reworked so it can add OpenAPI and others too. I know this is a Old Post but it still appears on top of Searches
Comment: @Pavlov - Thanks for the great answer. Would you mind explaining the difference between REST API and HTTP API?
Comment: @AwsAnurag, I am not sure I know what exactly HTTP API is. I suspect different people might be implying different things by this term.  Therefore, I don't think there is a generic answer. I would recommend you to post a separate question and explain the context where you encounter the term better - to get a meaningful answer.
Answer: This is the simplest explanation you will ever find.
This article takes a husband to wife narrative, where the husband explains to his wife about REST, in pure layman terms. Must read!
how-i-explained-rest-to-my-wife (original link)
how-i-explained-rest-to-my-wife (2013-07-19 working link)
Comment: The part about polymorphism is beautiful.
Answer: SOAP - Simple Object Access Protocol is a protocol!
REST - REpresentational State Transfer is an architectural style!
SOAP is an XML protocol used to transfer messages, typically over HTTP
REST and SOAP are arguably not mutually exclusive. A RESTful architecture might use HTTP or SOAP or some other communication protocol. REST is optimized for the web and thus HTTP is a perfect choice. HTTP is also the only protocol discussed in Roy Fielding's paper.
Although REST and SOAP are clearly very different, the question does illuminate the fact that REST and HTTP are often used in tandem. This is primarily due to the simplicity of HTTP and its very natural mapping to RESTful principles.
Fundamental REST Principles
Client-Server Communication
Client-server architectures have a very distinct separation of concerns. All applications built in the RESTful style must also be client-server in princple.
Stateless
Each each client request to the server requires that its state be fully represented. The server must be able to completely understand the client request without using any server context or server session state. It follows that all state must be kept on the client. We will discuss stateless representation in more detail later.
Cacheable
Cache constraints may be used, thus enabling response data to to be marked as cacheable or not-cachable. Any data marked as cacheable may be reused as the response to the same subsequent request.
Uniform Interface
All components must interact through a single uniform interface. Because all component interaction occurs via this interface, interaction with different services is very simple. The interface is the same! This also means that implementation changes can be made in isolation. Such changes, will not affect fundamental component interaction because the uniform interface is always unchanged. One disadvantage is that you are stuck with the interface. If an optimization could be provided to a specific service by changing the interface, you are out of luck as REST prohibits this. On the bright side, however, REST is optimized for the web, hence incredible popularity of REST over HTTP!
The above concepts represent defining characteristics of REST and differentiate the REST architecture from other architectures like web services. It is useful to note that a REST service is a web service, but a web service is not necessarily a REST service.
See this blog post on REST Design Principals for more details on REST and the above stated bullets.
Comment: This is the best answer for reflecting that it is not either/or with REST and SOAP. +1 for noting that REST is a *style*.
Comment: Just thinking it would be totally HATEOAS to request a RESTful resource and receive a response which includes a link to WSDL describing what operations are available on that resource in its current state. Although I guess that a RESTful SOAP web service would be a bit like skipping over RMM level 3 and going straight to level 4. :)
Answer: I like Brian R. Bondy's answer. I just wanted to add that Wikipedia provides a clear description of REST. The article distinguishes it from SOAP.
REST is an exchange of state information, done as simply as possible.
SOAP is a message protocol that uses XML.
One of the main reasons that many people have moved from SOAP to REST is that the WS-* (called WS splat) standards associated with SOAP based web services are EXTREMELY complicated. See wikipedia for a list of the specifications. Each of these specifications is very complicated.
EDIT: for some reason the links are not displaying correctly. REST = http://en.wikipedia.org/wiki/REST
WS-* = http://en.wikipedia.org/wiki/WS-*
Comment: @koppor You mean other than the fact that it stands for "Simple Object Access Protocol"? Also, do you know what a protocol is? A protocol is basically a set of rules over how two or more things should communicate, which is exactly what SOAP is for, a standard way to communicate.
Comment: It's still a messaging protocol.
Comment: @Demizey Do you refer to the most recent version of SOAP, which is 1.2? http://www.w3.org/TR/soap12-part1/ "SOAP" now stands in its own as in practice it is NOT used as protocol. "SOAP 1.2 will not spell out the acronym." (http://www.w3.org/TR/2007/REC-soap12-part0-20070427/#L4697) Are you aware of the layers of the Web Service stack as (e.g.) described in the Book "Web Services Platform Architecture: Soap, Wsdl, Ws-Policy, Ws-Addressing, Ws-Bpel, Ws-Reliable Messaging, and More"? Transport-layer communication is done via HTTP, SMTP, RMI/IIOP, JMS or others. SOAP is used in the messaging layer
Comment: SOAP is NOT a protocol. SOAP is about encoding. SOAP is used over many protocols: JMS, http, ...
Comment: Along the line of a SOAP connection, many intermediaries may sit inbetween. This is enabled by the SOAP processing model, which distinguished between the ultimate SOAP receiver and zero or more SOAP intermediaries. The transport protocol may change inbetween. The SOAP message path also enables transparent implementation of the EAI patterns (http://www.eaipatterns.com/)
Comment: SOAP uses XML infoset, which allows, for instance, to use CSV or JSON to transfer data. http://msdn.microsoft.com/en-us/library/aa302293.aspx / http://cxf.apache.org/docs/json-support.html. Even though, it's not widely used in practice.
Comment: Still SOAP is not used as protocol in Service-Oriented Architecture. Note that "Access Protocol" occurs only once in the SOAP 1.2 specification. At the point where SOAP 1.1 appears at the "Informative Reference" section.
Answer: Both SOAP webservices and REST webservices can use the HTTP protocol and other protocols as well (just to mention SOAP can be the underlying protocol of REST). I will talk only about the HTTP protocol related SOAP and REST, because this is the most frequent usage of them.
SOAP
SOAP ("simple" object access protocol) is a protocol (and a W3C standard). It defines how to create, send and process SOAP messages.

SOAP messages are XML documents with a specific structure: they contain an envelope which contains the header and the body section. The body contains the actual data - we want to send - in an XML format. There are two encoding styles, but we usually choose literal, which means that our application or its SOAP driver does the XML serialization and unserialization of the data.

SOAP messages travel as HTTP messages with SOAP+XML MIME subtype. These HTTP messages can be multipart, so optionally we can attach files to SOAP messages.

Obviously we use a client-server architecture, so the SOAP clients send requests to the SOAP webserices and the services send back responses to the clients. Most of the webservices use a WSDL file to describe the service. The WSDL file contains the XML Schema (XSD hereafter) of the data we want to send and the WSDL binding which defines how the webservice is bound to the HTTP protocol. There are two binding styles: RPC and document. By the RPC style binding the SOAP body contains the representation of an operation call with the parameters (HTTP requests) or the return values (HTTP response). The parameters and return values are validated against the XSD. By the document style binding the SOAP body contains an XML document which is validated against the XSD. I think the document binding style is better suited to event based systems, but I never used that binding style. The RPC binding style is more prevalent, so most people use SOAP for XML/RPC purposes by distributed applications. The webservices usually find each other by asking an UDDI server. UDDI servers are registries which store the location of the webservices.

SOAP RPC
So the - in my opinion - most prevalent SOAP webservice uses RPC binding style and literal encoding style and it has the following properties:

It maps URLs to operations.
It sends messages with SOAP+XML MIME subtype.
It can have a server side session store, there are no constraints about that.
The SOAP client drivers use the WSDL file of the service to convert the RPC operations into methods. The client side application communicates with the SOAP webservice by calling these methods. So most of the SOAP clients break by interface changes (resulting method names and/or parameter changes).
It is possible to write SOAP clients which won't break by interface changes using RDF and find operations by semantics, but semantic webservice are very rare and they don't necessarily have a non breaking client (I guess).

REST
REST (representational state transfer) is an architecture style which is described in the dissertation of Roy Fielding. It does not concern about protocols like SOAP does. It starts with a null architecture style having no constraints and defines the constraints of the REST architecture one by one. People use the term RESTful for webservices which fulfill all of the REST constraints, but according to Roy Fielding, there are no such things as REST levels. When a webservice does not meet with every single REST constraint, then it is not a REST webservice.
REST constraints

Client - server architecture - I think this part is familiar to everyone. The REST clients communicate with the REST webservices, the webservices maintain the common data - resource state hereafter - and serve it to the clients.
Stateless - The "state transfer" part of the abbreviation: REST. The clients maintain the client state (session/application state), so the services must not have a session storage. The clients transfer the relevant part of the client state by every request to the services which respond with the relevant part of the resource state (maintained by them). So requests don't have context, they always contain the necessary information to process them. For example by HTTP basic auth the username and the password is stored by the client, and it sends them with every request, so authentication happens by every request. This is very different from regular webapplications where authentication happens only by login. We can use any client side data storage mechanism like in-memory(javascript), cookies, localStorage, and so on... to persist some parts of the client state if we want. The reason of the statelessness constraint, that the server scales well - even by very high load (millions of users) - when it does not have to maintain the session of every single client.
Cache - The response must contain information about it can be cached by the client or not. This improves scalability further.
Uniform interface

Identification of resources - REST resource is the same as RDF resource. According to Fielding if you can name something, then it can be a resource, for example: "the current local weather" can be a resource, or "your mobile phone" can be a resource, or "a specific web document" can be a resource. To identify a resource you can use resource identifiers: URLs and URNs (for example ISBN number by books). A single identifier should belong only to a specific resource, but a single resource can have many identifiers, which we frequently exploit for example by pagination with URLs like https://example.com/api/v1/users?offset=50&count=25. URLs have some specifications, for example URLs with the same pathes but different queries are not identical, or the path part should contain the hierarhical data of the URL and the query part should contain the non-hierarchical data. These are the basics of how to create URLs by REST. Btw. the URL structure does matter only for the service developers, a real REST client does not concern with it. Another frequently asked question is API versioning, which is an easy one, because according to Fielding the only constant thing by resource is semantics. If the semantics change, then you can add a new version number. You can use classical 3 number versioning and add only the major number to the URLs (https://example.com/api/v1/). So by backward compatible changes nothing happens, by non-backward compatible changes you will have a non-backward compatible semantics with a new API root https://example.com/api/v2/. So the old clients won't break, because they can use the https://example.com/api/v1/ with the old semantics.

Manipulation of resources through representations - You can manipulate the data related to resources (resource state) by sending the intended representation of the resources - along with the HTTP method and the resource identifier - to the REST service. For example if you want to rename a user after marriage, you can send a PATCH https://example.com/api/v1/users/1 {name: "Mrs Smith"} request where the {name: "Mrs Smith"} is a JSON representation of the intended resource state, in other words: the new name. This happens vica-versa, the service sends representations of resources to the clients in order to change their states. For example if we want to read the new name, we can send a GET https://example.com/api/v1/users/1?fields="name" retrieval request, which results in a 200 ok, {name: "Mrs Smith"} response. So we can use this representation to change the client state, for example we can display a "Welcome to our page Mrs Smith!" message. A resource can have many representations depending on the resource identifier (URL) or the accept header we sent with the request. For example we can send an image of Mrs Smith (probably not nude) if image/jpeg is requested.

Self-descriptive messages - Messages must contain information about how to process them. For example URI and HTTP method, content-type header, cache headers, RDF which describes the meaning of the data, etc... It is important to use standard methods. It is important to know the specification of the HTTP methods. For example GET means retrieving information identified by the request URL, DELETE means asking the server to delete the resource identified by the given URL, and so on... HTTP status codes have a specification as well, for example 200 means success, 201 means the a new resource has been created, 404 means that the requested resource was not found on the server, etc... Using existing standards is an important part of REST.

Hypermedia as the engine of application state (HATEOAS hereafter) - Hypermedia is a media type which can contain hyperlinks. By the web we follow links - described by a hypermedia format (usually HTML) - to achieve a goal, instead of typing the URLs into the addres bar. REST follows the same concept, the representations sent by the service can contain hyperlinks. We use these hyperlinks to send requests to the service. With the response we get data (and probably more links) which we can use to build the new client state, and so on... So that's why hypermedia is the engine of application state (client state). You probably wonder how do clients recognize and follow the hyperlinks? By humans it is pretty simple, we read the title of the link, maybe fill input fields, and after that just a single click. By machines we have to add semantics to the links with RDF (by JSON-LD with Hydra) or with hypermedia specific solutions (for example IANA link relations and vendor specific MIME types by HAL+JSON). There are many machine readable XML and JSON hypermedia formats, just a short list of them:

XHTML
ATOM+XML
RDF+XML
HAL+XML
HAL+JSON
JSON-LD
RDF+JSON
Siren
Collection+JSON

Sometimes it is hard to choose...

Layered system - We can use multiple layers between the clients and the services. None of them should know about all of these additonal layers, just of layer right next to it. These layers can improve scalability by applying caches and load balancing or they can enforce security policies.
Code on demand - We can send back code which extends the functionality of the client, for example javascript code to a browser. This is the only optional constraint of REST.

REST webservice - SOAP RPC webservice differences
So a REST webservice is very different from a SOAP webservice (with RPC binding style and literal encoding style)

It defines an uniform interface (intead of a protocol).
It maps URLs to resources (and not operations).
It sends messages with any MIME types (instead of just SOAP+XML).
It has a stateless communication, and so it cannot have a server side session storage. (SOAP has no constraint about this)
It serves hypermedia and the clients use links contained by that hypermedia to request the service. (SOAP RPC uses operation bindings described in the WSDL file)
It does not break by URL changes only by semantics changes. (SOAP RPC clients without using RDF semantics break by WSDL file changes.)
It scales better than a SOAP webservice because of its stateless behavior.

and so on...
A SOAP RPC webservice does not meet all of the REST constraints:

client-server architecture - always
stateless - possible
cache - possible
uniform interface - never
layered system - never
code on demand (optional) - possible
Answer: Well I'll begin with the second question: What are Web Services? , for obvious reasons.
WebServices are essentially pieces of logic(which you may vaguely refer to as a method) that expose certain functionality or data. The client implementing(technically speaking, consuming is the word) just needs to know what are the parameter(s) the method is going to accept and the type of data it is going to return(if at all it does).
The following Link says it all about REST & SOAP in an extremely lucid manner.
REST vs SOAP
If you also want to know when to choose what (REST or SOAP), all the more reason to go through it!
Answer: SOAP and REST both refer to ways for different systems to talk to each other.
REST does this using techniques that resemble the communication that your browser has with web servers: using GET to request a web page, POSTing in form fields, etc.
SOAP provides for something similar but does everything through sending blocks of XML back and forth. Another key component of SOAP is WSDL which is an XML document that describes what functions and data elements are supported. WSDLs can be used to programmatically "discover" what functions are supported as well as to generate programming code stubs.
Comment: That has nothing to do with REST, that's just 'correct usage of HTTP'
Comment: @pbreitenbach No, HTTP is not, it basically has no notion of hypermedia. But HTML with its hyperlinks and forms is a RESTful system. Actually, it was the prototype of the REST 'specification'
Comment: HTTP itself is the best example of a RESTful system.
Comment: SOAP does NOT force you to use XML encoding. XML encoding is only used if a service offers interoperability. Internally, POJOs may be sent with no encoding in XML.
Answer: The problem with SOAP is that it is in conflict with the ideals behind the HTTP stack. Any middleware should be able to work with HTTP requests without understanding the content of the request or response, but for example a regular HTTP caching server won't work with SOAP requests without knowing only which parts of the SOAP content matter for caching. SOAP just uses HTTP as a wrapper for its own communications protocol, like a proxy.
Comment: It's against the ideals, and we've only just noticed that. It's been around since 1998 or so, and we're only just picking up on it. Damn, we're stupif!
Comment: No John, "we" as the informed web developer community, have known all along. It's only the slow ones and the ones that are coming out of CS school without a proper education that have just cottoned on.
Comment: "We" are not all web developers. Some of us are just trying to get things done the best way possible and don't _care_ if we're "not using the full potential of the web".
Answer: I think that this is as easy as I can explain it. Please, anyone is welcome to correct me or add to this.
SOAP is a message format used by disconnected systems (like across the internet) to exchange information / data. It does with XML messages going back and forth.
Web services transmit or receive SOAP messages. They work differently depending on what language they are written in.
Comment: Elaborate on what you mean by "they work differently".  SOAP is typically employed as a way for different systems written in different or unknown technologies to talk using a common comprehensible language with clearly defined parameters.
Comment: Web services work differently depending on what language they are written in. Just an unimportant extra detail.
Comment: Ok, I wasn't sure if you were implying there was something inhibiting interoperability.
Answer: REST is an architecture style for designing networked applications. The idea is that, rather than using complex mechanisms such as CORBA, RPC or SOAP to connect between machines, simple HTTP is used to make calls between machines.
Answer: SOAP – "Simple Object Access Protocol"
SOAP is a slight of transferring messages, or little amounts of information over the Internet. SOAP messages are formatted in XML and are typically sent controlling HTTP.
REST – "REpresentational State Transfer"
REST is a rudimentary proceed of eventuality and receiving information between fan and server and it doesn't have unequivocally many standards defined. You can send and accept information as JSON, XML or even plain text. It's light weighted compared to SOAP.
Answer: SOAPbased Web Services
In short, the SOAPbased  Services model views the world as an ecosystem of coequal peers that cannot control each other, but have to work together by honoring published contracts. It's a valid
model of the messy real world, and the metadata based contracts form the SOAP Service Interface.
we can still associate SOAP with XMLbased Remote Procedure Calls, but SOAPbased Web Services technology has emerged into a flexible and powerful messaging model.
SOAP assumes all systems are independent and no system has any knowledge of the internals of another and internal functionality.
The most such systems can do is send messages to one another and hope they will be acted upon. Systems publish contracts that they undertake to honor, and other systems rely upon these contracts to exchange messages with them.
Contracts between systems are collectively called metadata, and comprise service descriptions, the message exchange patterns supported and the policies governing qualities of service (a service may
need to be encrypted, reliably delivered, etc.) A service description, in turn, is a detailed specification of the data (message documents) that will be sent and received by the system. The documents are
described using an XML description language like XML Schema Definition. As long as all systems honor their published contracts, they can inter operate, and changes to the internals of systems never affect any other. Every system is responsible for translating its own internal implementations to and from its contracts
REST - REpresentational State Transfer. The physical
protocol is HTTP. Basically, REST is that all distinct resources on the web that are uniquely identifiable by a URL. All operations that can be performed on these resources can be described by a limited set of verbs (the "CRUD" verbs) which in turn map to HTTP verbs.
REST's is much less "heavyweight" than SOAP.
Working of web service
Comment: -1 Almost everything you say is incorrect. SOAP does not contain a description. The WSDL does. WSDL is an XML format - it doesn't "run" on any protocol. SOAP does not require middleware. REST is not "the second generation of web services". WADL is _not_ a standard. See http://en.wikipedia.org/wiki/Web_Application_Description_Language.


Gfci not working

Question: So my GFCI recently stopped working. I bought an outlet tester and fixed some outlets that were incorrectly wired. My old GFCI had power but wouldn't reset and test button couldn't be pressed. When I did press reset, it would automatically trip but power was still there. I replaced the gfci thinking it was faulty. I wired it one wire at a time, making sure it was correct. Now I have no power to GFCI but all outlets downstream work. The only outlet that doesn't work is the gfci. I tried switching wires and still not power. Any suggestions? Thanks in advance
Comment: My suggestion is to explain how the outlets were "incorrectly wired" and how your GFCI outlet is wired. Don't leave us to guess at it all.
Comment: It sounds like you connected the new GFCI to LOAD instead of LINE. But that is just a guess. Can you post pictures of the new GFCI and all the wires connecting to it?
Comment: This outlet had 3 set of wires. I figured out  2 of them were hot. I believe the problem was because one pair was wired on the load side and one pair was wired to line side causing the trip. Problem is that even though the GFCI was tripped and off, the other outlets had power down stream. I ended up just capping other wires and GFCI doesn't have the problem anymore
Comment: Thanks for the update, but that's alarming.  If power is coming into a GFCI box from two directions at once (or any box), that needs very careful handling.  I would investigate further.  Which breakers turn the power off?  More than one breaker, a double breaker or a single?
Comment: Very alarming. I'm pretty sure it's been like this since house was built. One breaker only
Answer: The GFCI isn't broken. It is correctly detecting a ground fault or wiring problem, and tripping instantly.  That's its job.  The test button can't be pressed because it's tripped.
It's easy to get misguided by 2 nasty forces:

"Doing this makes it work" --  There are lots of setups that work that will kill you.  "Trying things" will only lead to one of those.  Stop and find out what to do. We're here to help.
"3-light testers" -- I call those a "magic 8-ball tester".  The lights are fine, but the written legends tend to be misleading in old work. They are for pass-fail testing brand new construction, not bona-fide troubleshooting.  Also, it's an easy tester that makes a novice think the electrical world is full of easy problems.  Nope; the last guy had a 3-light tester also.  The problems he leaves you tend to be hard and complicated.  So doing easy fixes because the tester told you to is probably counterproductive.

I think the GFCI you removed was telling you the truth -- that one of your fixes created a ground fault.  I would put the old GFCI back in, very carefully exactly as you found it. It was correctly wired; this new one is miswired, I think.
"Carefully moving wire over 1 wire at a time" fails because you are relying on physical position on the device.  Different models put things in different physical positions (especially 3-way switches!). Instead, rely on screw color,  markings,  or other evidence.

Green, green/yellow or bare are reserved for safety ground.  Always and only.  Worldwide, so even on Euro or Chinese stuff, these are ground.
Grounds are always joined together.
Ground always go on a screw.  A ground in a backstab is always wrong.
On a socket, the taller slot is neutral.  Receptacles have silver screws for the neutral side.  Neutral is always the white wire (white isn't always neutral).
Neutral is not ground.  The two are never tied together for any reason.
Neutrals are NOT all joined to each other.  If there are 2 circuits present, there should be 2 groups of neutral separated.
Hot is the brass screws. Hots can be any color but green.  Receptacles need neutral, so usually the white is neutral and hot is the other color.

Anything that deviates from the above is wrong.
It will be a step in the right direction if the
Comment: The old GFCI was tripped but was still working, that is why I changed it. When  reset button was pressed it would reset but still power on When I switched over the new GFCI I did it one wire at a time, not relying on position but looking at what wires came from line/load from old GFCI and connecting accordingly to new GFCI. Either way GFCI seems to be working now after I capped one set of hot wires and using only one.
Answer: I believe you have mis wired the GFCI. The hot and neutral from your panel go to the line terminals the neutral your white wire on the silver or white screw, the hot black goes on the brass screw marked line. The downstream outlets you want to protect go on the load terminals with the same color coding. Each outlet should be wired the same way with respect to the colors on the correct screws. If any ground wires usually a bare copper make sure they are all connected and also attach to the green screw on the outlet.

Gfci not working


How to get a full-screen preview of a cropped area in RawTherapee?

Question: I've used the crop tool in RawTheraee to crop a raw image:

Is there a way to full-screen preview the cropped section prior to exporting?
Answer: I just discovered a way to do this. I'm using RawTherapee 4.2, but from your screenshot, I think this feature is in the version you used, too. It's in the toolbar just to the top right of the image. From my system:

The blue, green, red, and gray squares let you preview individual color or luminosity channels — they're toggles you can click on. To the left of that, there are three horizontal bars. The tooltop is "Background color of the preview", and they are, in order from top top bottom, Theme-based, Black, and White.
When set to Theme Based, I get the behavior shown in your preview: the cropped-out area is darkened but still visible. If I, instead, change to either black or white (default keyboard shortcut seems to be 9, by the way), only the selected ("cropped in", if you will) part is shown.
This doesn't automatically make it full screen, and the zoom buttons at the bottom still zoom to the original border, but you can use the + / - magnifying buttons to get it approximately right without too much hassle.
(Darktable, as matt.nguyen mentions, behaves differently — the cropped-away portion is only shown while the crop tool itself is highlighted. That kind of modal behavior is common in the Darktable UI, but Rawtherapee doesn't generally have a corresponding concept of "active module".)
Answer: Now (version 5.8), you can tick "Automatically zoom to fit the crop" option in the tab Preferences>Image Processing>Crop Editing
Answer: Doesn't look like. The closest I got to achieving the effect you are looking for was to hit m to hide all side panels, F11 to go full screen, and then play with the scrolling wheel until the crop area filled the screen. Not perfect, but kinda works.
As an alternative, darktable will behave differently with regards to the cropping. Once you selected your crop area, it will take the whole screen for you to work on.
Comment: The current version has the `alt`-`f` shortcut, which zooms into the area for you!


Lotus notes workflow migration to SharePoint

Question: I am new to lotus notes, so need help and suggestions.
Is there any way to access workflows from lotus notes?
Can we write any automated tool to migrate general lotus workflow to SharePoint directly?
Answer: Caveat: I worked on Lotus Notes->Oracle Portal migration for a large customer, and then worked on building an intranet site using Sharepoint 2007 for the same customer.
There are plenty of commercial tools assisting you on migrating from Lotus to Sharepoint (this seems to be an almost inevitable process, unless you prefer to go for Liferay/Alfresco)... these tend to concentrate on migrating documents instead of workflow, though, and I we never found anything "free" that could really help in the migration.
What I can say is that rolling out your own converter is probably too much of a problem. If you have a few dozens workflows you would probably be better served by converting "by hand". If you are making a complete migration (including documents) I suggest you to look for commercial solutions.
Answer: Workflow itself is not a part of built-in Notes functionality, so there's nothing that can be called "General Notes workflow". It is always built using third-party solutions or add-on like Lotus Workflow which is not part of Lotus Notes/Domino. But anyhow it doesn't seem to be possible for placing SharePoint list item or document in the middle of the flow as you want it. Let all running flows finish on Notes and migrate the historical data.


Maximum Distance using Ultrasonic sensor Arduino

Question: What is the maximum distance (of say , a car ) you could measure using an ultrasonic sensor that would be compatible with arduino? Is there any sensor(ultrasonic or not) that could measure the distance of a car , say upto 50 meters that can be used with arduino?
Comment: "compatible with arduino" describes almost every rangefinding sensor on the market.  The low-level ones use a digital signal to indicate send/receive times, and the more high-level ones give output (ascii or binary) on a serial port.
Comment: A quick search hasn't shown me any ultrasonic sensors capable of more than a few meters, certainly nowhere near 50m. At those distances laser would be a viable solution if you are after a simple sensor. Beyond that I guess you are into camera based recognition, but that's probably more than an Arduino can handle.
Answer: Your question is multiple questions inside of one. As answered in comments, your question should probably be limited to the sensor and/or technology for longer range detection of large (moving?) objects. The use of an arduino is mostly irrelevant.
As per comment by @Ian, ultrasonic sensors will probably not be useful at 50 meters, I think due to physics of sound. See the article below on choosing an ultrasonic sensor.
One option might be to use a laser rangefinder (such as you can find in hardware stores).  Another option might be to use radar, such as in old police radar guns. However, both of these options are limited in capability and highly dependent on environmental factors.
Perhaps the best option would be a LIDAR system. They tend to be expensive, but there is an upcoming product called "LIDAR-Lite" by PulseLight that is lower cost and might be of interest. They are advertising a 40 meter range capability.
Additional reading:

Low Cost LIDAR and Laser Range Finders: Where Are They?
LIDAR-Lite by PulseLight
SF02 Laser Rangefinder from Parallax
Choosing an Ultrasonic Sensor for Proximity or Distance Measurement
Beam patterns of various MaxBotix ultrasonic sensors
Radar Gun
Comment: Kaliatech is right in regards to the physics of sound waves preventing you from being able to use an ultrasonic sensor at 50 meters. As sound waves move forward away from the sensor, they also spread out drastically in a cone shape. This means that your ultrasonic sensor could receive an echo from anything 50 meters out and tens of meters sideways, which isn't the type of resolution you're looking for I'd assume.
Answer: Let's take a look at the physics side of things. Ultrasonic (acoustic) and lidar (laser) rangefinder sensors calculate the distance based on time-of-flight (tof). The time taken for a burst of sound waves to hit an obstacle and reflect back to the source indicates how far away the obstacle is from the source. The propagation speed of sound is $340$ m/s whereas for light it is $3 \times 10^8$ m/s. In other words, the time it takes for an ultrasound wave to travel $1$ m is approximately $3$ ms, as opposed to $3.3$ ns for light and radio waves.
The equation to calculate the tof duration is: $$ Duration (s) = Distance (m) \times \frac{2}{Propagation Speed (m/s)}$$
and the directivity pattern of $40$ kHz sound waves looks like this:

with this kind of directivity pattern, if the sensor is mounted on a car, there will be a lot of reflection from the ground, which will cancel out the original signal.

The good news is as the frequency increases the directivity pattern shrinks, increasing the range. But this is no way going to give you $50$ m. Even if you could do that, due to the relatively slow propagation speed of sound, you had to take the car velocity into account while calculating the distance.
This is why autonomous vehicles use ultrasonic sensor for park assistance and lidar sensors for collision avoidance / pedestrian detection and long-range radar for adaptive cruise control.
Answer: There is a cheap LIDAR I saw on hackaday earlier this year that can connect to an Arduino over I2C (or any other micro). The sensor can detect up to 40m, and it's called LIDAR-LITE. They start shipping next month and can be ordered from here for $72 US.
As the previous comments/answers have indicated, you will get nowhere near 50m with any ultrasonic sensor, most hobbyist ones are only a meter or 2.


Pre-WW2 location of Skalat

Question: Was Skalat on the border between Poland and USSR before WW2?  Is there a pre-WW2 map with Skalat? I am trying to confirm information from a 90-year old who reportedly crossed the former border between Poland and USSR during WW2 (July, 1941) at Skalat.
Comment: I would upvote this question if it included references/links to existing maps that would help me to understand the question.
Comment: @TylerDurden If you look at the map at [wikipedia](http://de.wikipedia.org/wiki/Skalat) Skalat is in Ukraine. It changed the last centuries between Poland, Austria, Russia, again Austria and Poland, then USSR (Ukraine) and since 1991 Ukraine. The question could be better, but in my opinion it is not the question where Skalat is located, but how the borders changed around Skalat - so for me it is historical.
Comment: This is a geography question, not a history question. ... and a trivial geography question at that, double whammy.
Answer: You could check Wikipedia

In the immediate post-World War One period, Skalat was seized by local Ukrainian activists, who declared that the town was part of West Ukrainian People's Republic. Polish - Ukrainian tension escalated, and climaxed in the Polish–Ukrainian War. On April 23, 1919, Ukrainian activists murdered a popular Roman Catholic parish priest from Skalat, Rev. Walerian Raba, and on July 16, 1919, the town was captured by the Polish Army.
In 1923 Skalat became the seat of a county in the Tarnopol Voivodeship.

Tarnopol Voivodeship was an administrative region of interwar Poland (1918–1939)
There is also a Map in wikipedia where you can see, that Skalat is near the border to USSR (Ucraine).

Another source, outside Wikipedia:

SKALAT (Pol. Skałat), town in *Tarnopol district, Ukraine. Formerly within Poland[...]reverting to Poland between the two world wars.[...]As a result of Skalat's proximity to the Russian border,[...]
When the town passed to Soviet rule (1939–41),[...]

You see, the town is near the border and changed the ruler.

Pre-WW2 location of Skalat


Cygwin does not see Windows share as folder - no "d" attribute?

Question: I migrated this question from StackOverflow as it really fell outside the scope of programming questions they generally prefer, so hopefully I'll find a more suitable audience here...
I've installed Cygwin 1.7 on a Windows Server 2008/64 box in support of an automated file transfer setup. While the basic install is generally working as expected, I have one curious problem that must be solved.
After logging into the server from a Windows command prompt via ssh, I perform an "ls -l" against the UNC path of the server, eg:
<code>$ ls //servername
</code>
That returns the list of shares on that server; however, some of the shares are listed without the "d" (directory) attribute set - Cygwin is seeing them only as regular files. As a result, attempts to cd to the share path fail with "Not a directory" errors. However, ls against that share name works.
In some instances, the name of the share and its underlying folder each contain a space, so that was my first suspect, but there are other shares on the same machine with no spaces in the share or folder name that exhibit the same behavior.
Here is a representative albeit condensed listing of the ls command, with actual share/server/owner names replaced with ShareNameN, servername, or UserName as appropriate. UserName is that of the ssh user session.
<code>$ ls -l //servername
total 33636078380235
drwxrwxrwx+ 1 Administrators Domain Users                 0 Nov 26 10:35 ShareName1
-rw-r--r--  1 UserName       Domain Users 18193726281664696 Apr 22  2009 ShareName2
-rw-r--r--  1 UserName       Domain users 18189229448232975 Aug  4  1909 Share Name3

$ ls -l //servername/ShareName2
//servername/ShareName2

$ cd //servername/ShareName2
-bash: cd: //servername/ShareName2: Not a directory

$ ls //servername/"Share Name3"
//servername/Share Name3

$ cd //servername/"Share Name3"
-bash: cd: //servername/Share Name3: Not a directory
</code>
I've tried some other permutations of the quoted UNC pathname, verified the permissions on the share and the underlying folder, but so far, no luck. The user is authenticating via an actual password, not via certificates.
I'm likely missing something obvious, so if someone can see the error of my ways, I'd be most appreciative!
EDIT: I have just observed an interesting pattern that may be a factor in this problem
I just observed that those shares indicating a creation date other than the last few months - the ones in which the time of day is listed rather than the year - also do not have the directory attribute set through the "ls" command. All shares listing a time of day do have the directory attribute set, and work normally through the cd command...
Answer: I have determined the cause of this problem, thanks to good ol' ProcMon.  As the shares were being enumerated, ProcMon was revealing an "ACCESS DENIED" on the attempt to open/query the shares that were failing, but "SUCCESS" on those that worked.
The account used to ssh into the subject server did not have read permissions to the shares in question. Granting the account read permissions to the share(s) resolved the subject behavior.

Cygwin does not see Windows share as folder - no “d” attribute?


Unable to change display resolution

Question: I have a Dell laptop with a resolution of 1600 x 900 and I have a second monitor as Dell 24".  The resolution that Ubuntu is configured in a virtual box is 1024 * 800.  How can I fix the resolution on the Dell monitor to get a higher resolution?
Answer: It's most likely a limitation of your virtual machine's drivers, or at least the default installed ones. Check your video settings for the virtual machine. You may be able to try a different "video card." Also, make sure "Enable 3D acceleration" is enabled in the virtual machine settings. Make sure to restart your virtual machine after any settings changes.
Additionally, you can try checking for drivers from within Ubuntu. Simply make sure apt-get is up to date, and check the "Additional Drivers" application to see if either have detected video drivers.

Unable to change display resolution


Mac OS X in VirtualBox

Question: I want to buy the MAC OS X operating system from Amazon and wanted to know if it can be install in VirtualBox with Linux as the host machine?
Comment: possible duplicate of [Mac OS X for VirtualBox](http://superuser.com/questions/56564/mac-os-x-for-virtualbox)
Answer: Installed: yes.
Legal (according to the Apple EULA): No.
Comment: I'm pretty sure he wants to know **how** to install it, if possible.
Answer: Lifehacker has an article describing how to install Mac OS X in Virtualbox.
Answer: It's not allowed due to the EULA restricting the use of OS X to "Apple branded" Machines. It's possible, but not with the retail version of OS X. You need a modified (illegal?) version of OS X.
Answer: This article over on Lifehacker shows that it can be done with virtualbox on windows. I don't see why virtualbox on Linux should be any different.
Answer: You don't need the hacked DVD discussed on lifehacker.
http://www.sysprobs.com/mac-os-guest-virtualbox-326-snow-leopard-1064-windows-7-32-bit is for VirtualBox 3 something, works on VBox 4.x as well.  The only thing you'll need to do, is get the boot CD, which is discussed in the article.
When installing, it will not find a disk--use disk utility from the installer to create a partition, then it will see the disk.
As for sound, note that the links provided are for the AC97 driver--VBox's default sound is Intel, so you have the change the default setting.
Also, do note that as mentioned, probably not legal according to the EULA, but most EULAs are of questionable legality if taken to court.
So, you do not need a modified install DVD anymore, but you will have to download the bootloader.

Mac OS X in VirtualBox


Weather App where icon shows current temperature and weather on iPhone?

Question: It's not always sunny and 73° where I live. Is there any Weather forecasting app for iOS which will change its icon to show current conditions? Or even a way to make the standard Weather.app behave like this?
Comment: Once you start this running, will you complain about short battery life?
Answer: There are two apps, Celsius and Fahrenheit, that I know of that will add badges to their icons to attempt to give you an up-to-date temperature at a glance. I say attempt because the badge approach doesn't support negative numbers so if your temperature dips below zero for either of those two scales you won't know.
But without jailbreaking your phone that's as good as it gets. The App guidelines from Apple don't let third party apps change their icons.
Answer: Official 3rd party apps are not authorized to change the icon in iOS see this question.
So there is no solution there. The only feature you could get from an official app would be a badge displaying the temperature.
You could look at the cydia store if you have or want to jailbreak your phone.
Answer: You're looking for Pocket Weather World or Pocket Weather World HD by awesome Australian developers Shifty Jelly. It will display the current temperature (for your most recently-viewed location) as a badge on the icon.
If you're in Australia look for the local versions (i.e. Pocket Weather AU HD which offer better integration with the Bureau of Meteorology's radar services etc.
(iOS icons can't change dynamically, the badge is the best they can do so far)


How do CGA emulators for Hercules graphics work?

Question: HGC cards on IBM PCs used to be able to run CGA software by using a CGA emulator. How exactly did those programs work? What were the limitations?
Answer:
How exactly did those programs work?

They were based on the ability of the Hercules card use the CGA's memory space.
The original MDPA (*1) had (only) 4 KiB of memory mapped at B0000h, while the CGA had 16 KiB of Memory at B8000h. The Hercules card in contrast had 64 KiB of memory (*2), starting at B0000h. To avoid conflicts with a CGA in the same system the upper 32 KiB were by default disabled. By default the Hercules was 100% compatible. In fact, so compatible that the PCs BIOS did recognize and use it as MDA (with 4 KiB Memory). Unlike the MDA, the Hercules card did offer a full graphics mode of 720x348 (*3,4), which occupied 32 KiB Memory, thus offering up to two pages.
CGA emulations used the fact that the second 32 KiB were not only free (when only the first graphics page was used) but also that memory could be located where the CGA's 16 KiB are, at B8000h..BBFFFh. Programs assuming a CGA (and direct screen access) would go ahead and paint their output into this memory instead. A timer controlled interrupt would now read the virtual CGA buffer at B8000h and transform its content into the real Hercules buffer at B0000h. On fast machines that could happen for every frame.
This was also supported by the fact that while many programs did direct screen updates, configuration was mostly done via BIOS calls, which could also be intercepted by the emulation and handled accordingly. For games with direct control of the CGA's registers, patches were sometimes available.
In fact, some games even skipped programming a Hercules mode by using a built-in (third party) CGA emulation. Accolade's well known Test Drive for example.

What were the limitations?

Most are related to the fact that the conversion of colour and resolution was done in software. To make it happen, the emulator had to steal the cycles to do so from the game. While not an issue with later PCs, it was a deal breaker early on.

Most notable Speed - Games got slowed down. While not much of an issue for round based or adventure games, it was real hurdle for real time/action games.
As well as Lag - One way to reduce the impact on the game performance was to skip frames. Doing the conversion only every second, third or fourth frame, reducing the effective frame rate. Again sometimes to an unplayable low when it came to (re)action games.
Weird Screen Format - Again due to the complexity of conversion, some emulators offered modes where less complex calculations were used by restricting the display area and colour resolution. As a result, only a part of the screen was used (or parts of the picture cropped) and colour information was dropped.

The other big drawbacks were ugly pictures due to the fact that converting a colour picture to monochrome always loses information. Unlike on a TV, there was no grayscale. Depending on the software this was compensated by replacing the colours by fixed patterns. This worked fine on pictures with sharp contrasts (i.e. always black lines in between) but usually only gave a rough impression of different coloured areas. With graphics based on colours (like with 160x200 mode) and fine details the result was awful. Keep in mind, these were just replacement patterns and nothing like real dithering.
And last, programs that manipulated the CGA's (6845) registers directly did not work at all. There weren't many and some emulators even had patches for common ones, still another hurdle to take.

*1 - Monochrome Display and Printer Adapter as the original IBM MDPA also offered a parallel interface. Obviously IBM assumed that an office user would need a printer interface anyway, thus creating the eventual first Multi-Function-Card :))
*2 - The large memory was meant to support loadable character sets and full graphics, as its developer wanted to use Thai characters.
*3 - Descriptions often mention 350 lines, but the last two weren't visible.
*4 - 720x350 at 50 Hz is, BTW, what can be done with a standard CRT when tweaking within the (European) boundaries.
Comment: "720x350 at 50 Hz is, BTW, PAL resolution." — No, it isn't. First, vertical resolution of PAL is 576 lines (interlaced). That's way more than 350. Second, PAL has no pixels; the horizontal resolution is determined by the input signal and the frequency the display can handle. The 720 pixels were standardized much later in the DV format, which as digital format had to decide on a pixel size.
Comment: @celtschk, note that PAL visible resolution of 576 scanlines is at the 25 Hz frame rate.  But Hercules has a 50 Hz refresh rate, so it would be more accurate to compare to the PAL field rate of 50 Hz with 288 visible scanlines out of 312.  So it is Hercules with the higher vertical resolution, not PAL.  I'm not aware of converting Hercules (or CGA) output to PAL/NTSC for display on a TV being a normal thing.  I suspect Raffzhan means a PAL TV tube had the specs to be made into a computer display, not an actual PAL TV could be used.
Comment: @TrentP: The claim (now replaced by a correct statement) was that 720x350 *is* the resolution of PAL, which is wrong whether you count full frame or half frame resolution.
Comment: The emulator did not necessarily slow down the game if it was not a TSR copying each second line of the triplet to the third line. One of the biggest limitations though was that many CGA applications used to wait for the vertical retrace to avoid snow and that would freeze with an hercules card because it used the 3BA port instead of 3DA. Oh man, was I happy the day I found out I could replace with an hex editor the string BA DA 03 with BA BA 03 to make also these games work!
Comment: Did Test Drive use the second-page trick on the Hercules to avoid having to copy data around? (Admittedly, it could change its base framebuffer address to 0xB000...)
Comment: Don't ask me anymore. It's been ages ago. In fact I wonder I even remember it did. I think I was researching their handleing of vectors.
Comment: Well, @celtschk, if your nitpicking you should be correct. official digital resolution for European TV (vulgo PAL) is 702x574. But that's, as you said, a later definition. Analogue picture is defined as up to 390 lines - thats vertical seperable lines within a scan line. Digital that would equal 780 pixel. 720 therefore can easy be displayed without any change of CRT or electronics. Similar it's 625 lines per picture or 312 per half. 350 scan lines per full is as well within the analogue capabilities. That's why 720x350@50Hz has been choosen for Hercules.
Answer: The basic idea is to exploit the fact that both CGA and Hercules use the 6845.
I have the source code of an emulator at hand, so I can say what it does:

it handles the mode-setting function of interrupt 0x10; for all non-Hercules modes, it includes tables of register settings to use to program the Hercules for the appropriate resolution and framebuffer layout;
it piggy-backs on the timer interrupt to copy the framebuffers when an emulated mode is active (from 0xB800, which is where programs would write when using CGA, to 0xB000, the monochrome buffer).

There are quite a number of different emulators with different levels of success with various programs, so there are no doubt different ways of implementing the emulation.
The limitations are mostly related to hardware handling. Any program writing to the CGA registers won't work, and any program relying on the Hercules vertical blank interval won't behave quite right (CGA refreshes at 60Hz, Hercules at 50Hz). The status registers are different too, so polling CGA-style won't work on Hercules at all. As mentioned by tofro, copying the framebuffers took a noticeable amount of time too (especially on CGA/Hercules-era systems), which would affect the system's performance.
Comment: Obviously, moving the framebuffer contents around is not exactly speeding up screen output, especially in graphics modes ...
Comment: @supercat I wrote a CGA emulator for Hercules at the time, and I used something like this (my memory is hazy) - plus a special TSR that copied the third line, so you could have either (fast) mode where every 3rd line was blank, or a (slower) mode where the 3rd line has been copied from the 2nd one, but this lead to some graphical tearing in moving objects. Still, I was using the TSR even for fast paced games.
Comment: Great explanation, I guess I should more often wait for you to save me work :))
Comment: If I correctly remember how the Hercules works, I would think that it should be possible to program the Hercules graphics card to use a "character row" height of 3 rather than 4, and output 80 bytes per line rather than 90.  If one did that, set the screen base address to 0xB8000, and erased memory from 0xBC000 to 0xBDFFF, that would yield a 640x300 display mode in which the first two lines of each triplet would match a pair of lines from CGA.  The biggest thing I'm unsure about is whether stuff would show up in the right order.
Comment: @RadovanGarabík: I wonder how much it would have cost to change the hardware so that the third scan line in each group could use the same address as the second?  I think it could be done with three NAND gates and an mode-select bit, or perhaps with even less hardware.
Answer: Just as a correction to a bit of the above: Hercules cards use regular MDA monitors. Their 350-line, nominal 50Hz mode (actually a bit below) isn't anything to do with regular broadcast monitors. They scan at 18.4kHz, which is a good way above that of typical TVs and low-rez monitors at 15.5~15.9kHz (and has the nice side effect of being effectively ultrasonic for most users - no more tube whistle... but a much worse one if you're high frequency sensitive). If you try feeding MDA/Herc syncs into a PAL TV, it could well blow up - and vice versa. Otherwise, there'd be no need for emulation - you could just throw regular CGA signals at it, and it'd work fine. The biggest difference between 50 and 60Hz broadcast monitors is the line count, and plenty of "15kHz" computer monitors can not only vary between those two standards without issue, but also other oddball settings like 45, 56, or 72Hz (with their own greater/intermediate/lesser number of scanlines - the latter having the bare minimum amount of blanking for a 200-line display).
It was, essentially, about as far as IBM were able to custom-tweak the circuitry of a common monochrome video monitor, with a long persistence phosphor on the tube to reduce the flickering effect, without having to go to the expense of a fully re-engineered high frequency item as later used for EGA (which retained much of the scan structure of MDA, but increased the line frequency closer to 22kHz, thus fully ultrasonic, and the Vsync back to 60Hz).
The monitors were somewhat adaptable to different setups, though; there's mention in some manuals for old ATI Wonder graphics cards about their Herc emulation also including the "special" / "little used" custom mode (Herc had NO ROM BIOS, all their modes were setup in software, so the "normal" ones were pretty much just matters of convention, and due to different clock crystals and slightly wonky maths weren't exact matches for the IBM standard anyway) of 640x400. Which was apparently used by some "eastern software" (presumably to better display Japanese/Chinese/Korean script) and wasn't guaranteed to work on all monitors. That mode, of course, would be just dandy for producing a better emulation of CGA, especially the hi-rez monochrome setting, as well as the highest resolution of certain 400-line / 25kHz "super CGA" machines... Unfortunately I have absolutely no idea of its setup, register values etc. The closest I've ever seen is a 90 column by 45 row (720x360 pixel, 8x8 font) textmode, emulated in graphics, which pushes the boundaries of both the available memory and what's displayable on a relatively inflexible MDA.


Extract pixels from NDVI in ArcMap

Question: I have a NDVI that I created from a Landsat 5 image. Is there a way to extract all the pixels above a certain threshold and save it as a shapefile? I am trying to create a vegetation mask of sorts to filter out areas in a city that have vegetation, leaving only the structures.
Answer: The simplest option would be the use of Raster Calculator with a conditional statement.
Your statement may look something like the following with 'threshold' replaced with whatever value you like.  The resulting raster will give you pixels with value=1 where values are greater than threshold, and NoData where values are less than threshold.
Con("NDVI_img" >= threshold, 1, "")

You could also do something like the following, which will result in all values greater than threshold retaining original values, where cells less than threshold have NoData.
Con("NDVI_img" >= threshold, "NDVI_img", "")

Comment: then you use "feature to raster" and you have your shapefile
Answer: By adding more conditions in the syntax of conditional statement as @Barbarossa nicely explained the answer of what your requirement is, a more evaluation threshold can be added by adding a multiple conditions in this statement. I was to assign the some constant values like 0.99 where NDVI < 0.20, 0.97 where NDVI > 0.5 and between this threshold i had to give another derivative formula in it and I had accomplished it with multiple conditional statement conditional evaluation with Con in ArcGIS raster calculator in ArcGIS raster calculator, a very nice tool.

Con(NDVI < 0.20, 0.97, Con( (NDVI >= 0.2)  & (NDVI <= 0.50), 0.004*((NDVI -
   0.20)/(0.50-0.20)) ^ 2 + 0.986, 0.99 ) )

If anyone knows about the free tool like in QGIS, or GRASS using map calculator tool. share it how to do it.

Extract pixels from NDVI in ArcMap


Not sitting in the Sukkah on Shemini Atzeres

Question: Shouldn't the obligation to sit in the Sukkah also fall into the category of Sefeika D'yoma? If so why do some not eat in the Sukkah on Shemini Atzeres?
Comment: Yes, we should. The gemara is Sukkah says this explicitly, and the Rishonim and Shulchan Aruch poskin this way.
Comment: @S-B You are certainly right about the explicit gemara, rov rishonim, and shulchan aruch (although some sources would be nice), but that doesn't mean that this is the practice in all communities. This question was looking for the reasons behind those communities who practice otherwise, not judging which way is better.
Comment: see [here](http://ohr.edu/this_week/insights_into_halacha/5269) for an excellent article on topic: [make sure to read the footnotes].
Comment: Rav Tzadok HaCohen of Lublin wrote an over 60 page pamphlet defending the practice of not eating in the Sukkah on Shmini Atzeres, called ["Meishiv Tzedek"](http://hebrewbooks.org/14379).
Answer: To answer the first question: yes. Because of 'sfeika deyoma', one should sit in the sukkah even on Shemini Atzeres just as one would on the other days of Sukkos. The Gemara Sukkah 47a (as we have it) concludes this way, and says that we should sit in the Sukkah, but not make a bracha. (The reasons for this, as I understand it, is either because it might be a bracha levatalah, see Rosh 4:5, or because we need to differentiate it from Sukkos proper, to avoid bal tosif, which I believe is the opinion of the Raavya).
However, as your second question notes, this is not - and was not - always the prevailing practice. There are two reasons for this al pi halakha (as opposed to kabbalah):

Some of the Rishonim may have had a different version in their text of the Gemara, which lacks the conclusion that we should sit in the sukkah on Shemini Atzeres. See Sefer Yechusei Tanaim Ve'amoraim, printed here, who writes that according to the usual rules of how to pasken from the Gemara, we should not sit in the sukkah on the 8th day, especially because we already begin to ask for rain on Shemini Atzeres (see Taanis 4b). Thus, he reasons, the Gemara paskens that sitting in the Sukkah when it isn't actually sukkos would be 'adding on to the mitzvah' inappropriately; since a person will be declaring in kiddush that the day is "hashmini", he's implying that there's an obligation to sit in the sukkah on the 8th day. (This is the gist of R. Tzadok's justification as well, besides for many others)
The Aruch Hashulchan (O.C. 668:4, probably based on the Korban Nesanel to the Rosh 4:5) justifies the custom, despite believing that the Gemara actually states that one is obligated to sit in the sukkah on shemini atzeres. He writes that the Gemara was referring only to places where the weather is nice enough that people would be sitting outside anyways, as Tosfos (there, Sukkah 47a) write, "the sukkah is pleasant to him", and so sitting in the sukka isn't an obvious slight to the Yom Tov of Shemini Atzeres. However, in the European countries, the weather is so cold that one might argue that we are always exempt from living in the sukkah, though we sit there anyway because our desire to fulfill the mitzvah overcomes this discomfort. However, doing something specifically for a mitzvah of sukkos should not be done on Shmini Atzeres because of zilzul yom tov (disgracing the holiday, by indicating that it might be chol hamoed) and since sitting in a sukkah would obviously be for the purposes of a mitzvah, we shouldn't do so on yom tov, just like we don't shake the lulav. Many poskim give similar reasons (such as Minchas Elazar 4:31)
Comment: +1 The Minchas Elazar argues that it is an issur min hatorah of baal toseph to sit on shmini atzeres in the cold, IIRC.
Comment: +1 The second reason eo ipso wouldn't apply in newer warmer locations. You can't just say that's how my great-grandfather did it in Poland. So it doesn't help for most places in the US and Israel.
Comment: @Yishai yes, he combines both of the reasons above but I felt like the answer was long enough already. so does the Eretz Tzvi and others
Comment: @Yishai What would he say if we had real Sefeika deYoma?
Comment: @DoubleAA the teshuvah is linked. he would say that שב ועל תעשה עדיף and don't sit in a sukkah in Europe where it's obvious that it's being done for a mitzvah
Comment: (Can you clarify that you mean north-eastern Europe? The French Riviera is probably pretty nice nowadays.)
Comment: @Matt Why not shev val taaseh and dont say kiddush for shmini atzeret?
Comment: @DoubleAA zilzul yom tov. and so is Greece; I thought it was clear that I just meant 'European areas where these particular poskim happen to have been living', but I can edit for accuracy
Comment: @Matt Pet peeve of mine. People saying "back in Europe everyone did X" when Sefardim and Romaniotes lived in Europe too...
Comment: @DoubleAA it's become a colloquialism I think, though admittedly perhaps an insensitive one
Answer: The simple answer would be that we avoid any behavior that slaps the new yomtov of Shmini Atzeres in the face (such as shaking lulav).  To eat in the sukkah is no big deal, as plenty of people eat on porches or gazebos or what-have-you when the weather's nice, no religious ritual required.  So in places where it was ridiculously cold on Shmini Atzeres, they didn't!
There are Hassidic thinkers who have answers that give the practice more significance (often based on Hassidic or kabbalistic thought), but that would be the simplest answer.
Comment: This reasoning no long applies in much of the US or Israel, so in those places everyone should eat outside, independent of average temperatures where their ancestors lived.


What's the difference between system testing and release testing?

Question: I was going through the types of software testing...Can anyone tell me what exactly are the differences between system testing and release testing?
Comment: Where did you encounter those terms?
Comment: Software Engineering - Ian Somerville
Answer: I see this in Ian Somerville's book (9th edition, section 8.3):

There are two important distinctions between release testing and
  system testing during the development process:

A separate team that has not been involved in the system development should be responsible for release testing.
System testing by the development team should focus on discovering bugs in the system (defect testing). The objective of release testing
  is to check that the system meets its requirements and is good enough
  for external use (validation testing).
Answer: System Testing
System testing of software or hardware is testing conducted on a
complete, integrated system to evaluate the system's compliance with its particular needs.
System testing falls within the scope of black-box testing, and as such should require no idea of the inner design of the code or logic.

Release Testing
Each release undergoes a series of automated and manual testing to ensure the quality of the finished product. In order to maximize our ability to find bugs before users do, we conduct a battery of tests designed to exercise as much functionality as possible.
These tests emphasize variety over raw quantity, however, with each feature release requiring approximately a week of round-the-clock testing.
Answer: Regardless of Ian Somerville's definition there's a more obvious difference, "system" and "release" refers to different things.
System refers to the content of the activity, you can test a unit and then call it unit test, modules or subsystems then call it integration tests, or a whole system and then call it system test.
Release refers to the timing of the activity, towards a release. A release test can be either at the unit level, module or system and still be called release test.


If I bought a present for a child, gave it to the parents and later they have a birthday party, do I get them another gift?

Question: If I bought a present for a child and gave it to the parents before the child's birthday because my family and I were going to be out of town, then later the parents have a birthday party, do I get the child another gift?
Comment: No. A card might be a good idea.
Answer: Only if you want to.  Both the parents and the child will know the gift has been given.  The only difference between giving it before and during the party is who knows.  If in your area of the planet everyone knowing is important, then make it known; otherwise, it is already known by those who matter, so party on!
Answer: No, the family knows that you have already given the child a gift. If you feel more comfortable showing up with something for your own satisfaction, or so others won't think you showed up/didn't give Jr. a gift at all, there are a few options. Take a card, slip $5 in it if you'd like, get a small/inexpensive accessory or coordinating piece to be used with the original gift: say you bought a racetrack for those little cars (sorry, I have a girl!)....get a couple more little cars to go with...bought a DVD of Spider-Man..get a little SM action figure or cool SM reusable tumbler. That way, should they open the gifts at the party, you can just say something like 'I wanted to get you something to use with the 'real' (laugh) gift I gave you a few weeks ago' or 'I'm so happy to hear you're enjoying the Batman car I gave you a bit early, so when I saw this 'xyz', I couldn't resist adding to my original gift.' On the other hand, nobody should fault you for not bringing another gift, and probably won't even notice.


Can photographs from a client shoot, but not accepted by them, be used for stock photography?

Question: I have a number of photographs from a recent client shoot that they don't wish to use. Could these be sold by myself as stock photography? For that matter, would it be considered to be ethical to do so?
Comment: Ask a lawyer. It will depend on your local laws, the contract with your client and subjects in your photos (ex: if they required model releases, etc). I do not think you can get a straight answer here.
Answer: Check your contract. If ambiguous, talk to the client. If uncertain, ask a lawyer (or just forget about it, as that lawyer will likely cost you more than you'd ever get from selling the shots).
That's the most definite advise you can ever get here, as we haven't seen you contract, don't know the law where you live, where the client lives, and where the shots were taken (all of which might be of influence), and we wouldn't want to become legally liable if we told you something that made you do something in breach of the law or your contracts.
Comment: All of the above would fall under US contract law, but I don't have enough reputation to create the [tag:united-states] tag in the system yet for the question.
Answer: In the very least, you'd need a model release from the client, if they appeared in the photo. Possibly also a location release.
If the client is important to you, consider whether you would do harm to the relationship by attempting to sell the images through another channel. While some clients would not mind - after all they understand that you need to have an income - others might feel that you're double dipping.
Definitely ask the client, not a lawyer. In otherwords, the lawyer can say it is legal, but it does not make it ethical, or appropriate.
For future, you might want to add this to your initial contract, as an optional clause that the client can ok, if you sense that a stock opportunity might present itself during the shoot.
Answer: As for the legal issues, the crux of the matter is the model release. All of the reputable micro-stock websites that I've looked into (Shutter Stock, iStockPhoto, Fotolia, etc.) are going to require a model release if your client is in any way recognizable. Traditional stock agencies will have similar requirements. Even if your existing contract includes a line regarding re-use of images (i.e. in your portfolio, on your website), I doubt that a stock company would accept this kind of document as a "release." If the client does sign a model release, then they have explicitly given you permission to use the photos and you should have no legal problems in re-using the photos.
One potential legal issue, though, could come up with respect to the definition of "consideration received." This is a standard phrased used in the beginning of most model releases, because for the contract to be valid the "model" (in this case your client) must receive something of value from you in return for your rights to re-sell the images.  If the client is paying you to take his/her pictures, then you may have a tough time selling to a court that the client received anything of value. Usually this would be something like money (if you pay a model) or photographic services (if you do a trade for shoot with a model).
Ethically, I agree with most of the other answers that you should pass it by the client or at least mention the fact that you'll be re-using images for stock photography.  Just because a client isn't going to use the photo doesn't mean it's a bad photo or represents the person in a bad light. As long as you sell "reject" photos that aren't embarrassing, compromising, or the like, then I wouldn't have any ethical problems with it.
Comment: Selected as this answer gives the best overall view on things, although @ishmaiel raises a good point about modifying future contracts.
Answer: NO! it would be unethical if not illegal. Your clients would certainly not want picture, which they thought were bad, to end up on a billboard or milk carton or a powerpoint presentation. Even if you have a sound contract, make sure that you tell your client where the pictures could end up.. you don't really want bad publicity.
Check out http://www.theblaze.com/stories/mother-outraged-after-her-daughters-image-appears-on-pro-life-billboard/ to see the full extent of the worse that could happen..
Comment: This answer makes a lot of assumptions that may or may not be true. Plenty of paid photo shoots don't even include the clients in the photos. Maybe it is a product shoot for a boat manufacturer at an exotic location and you got some great shots of the scenery that don't even contain the boat. Maybe you got some great shots of a city from a rooftop shooting location owned by your client. The key in such situations is to always negotiate the rights to use such images with the client *before* using them for other purposes.
Answer: Yes, you can, if your client has agreed to it upfront. Since you're asking, I assume your current contract is vague about that. Bringing it up afterwards is probably not worth the hassle and selling them without client's consent is subject to ethical and legal mess that could cost you more (in time, reputation or money) than potential earnings.
So, my advice would be to include the option in your future contracts and spend time making new photos instead of trying to crank out more from your old shoots.
Answer: Do you own the copyright to these images?  Were you commissioned to do the work or not?  That's the real question.  If they commissioned and paid you to do the work upfront, then they may own the copyright.  Just because they choose not to use them doesn't change that.
Even if you do own the copyright, if the images are clearly identifiable with the client (their products or logos for instance) then you could be on thin ice as well.
Comment: +1 This is hardly a complete answer, but it brings up critical points that seem to be missing from the other answers.


iptables entry to log ip address on one side of bridge

Question: I was wondering if anyone knew of an easy way to capture only the ip addresses on one side of a connection.  I have a transparent Linux bridge with iptables enabled so that I can do network accounting with iptables for traffic passing across the bridge.  However, I am doing this with an ipaddress for each host in the rules.  I want to script a way to make sure I have a rule for each host on one side of the bridge.  I know you can log ip data, but I was wondering if there was something available to just get a list of ip addresses, or maybe I am missing a way to do it in iptables.
Thank you for any ideas.
TonyZ
Answer: Um, you mean iptables rules that will match the physical interfaces instead of the bridge interface?
<code>iptables -A $CHAIN -m physdev --physdev-in $IN_IFACE -j $TARGET
</code>
Will that do?