Make your own eBooks

Use our Remix App to mix & match content. In minutes make your own course packs, training bundles, custom travel guides, you name it. Even add your own title & cover.


Slices & Articles Get by the slice or add to your own ebook

Medium 9781780490472

CHAPTER SIX. Dispelling common preconceptions

Anne Ginger Karnac Books ePub

The purpose of psychotherapy is not obviously to change the events themselves, but rather to change one’s perspective on them. It does not transform objectively either the past, or even the present, but makes a subjective “re-vision” of both possible. One then does not see the glass as being half-empty anymore, but rather half-full. (cf. “reframing” in NLP, “cognitive restructu ring” in TCC, the life scenario in TA, the “counter-enhancements” in motivational psychology, etc.).

Let us now suggest you go for a short walk, randomly, in the garden of your daily life, with a new way of looking at everything, without any a priori, in order to discover new facets of our familiar settings, or of some of our preconceptions—that are sometimes “introjected” without further questioning (S. Ginger, 2006a).

In order to look after one’s garden, one should undoubtedly uproot the weeds and get rid of the rocks and stones invading the flower-beds.

The problem is that those weeds keep on growing back up tirelessly. However hard one tries to remove the stones, there are always some left: the more we dig, the more there seem to be, the soil is chock full of them.

See All Chapters
Medium 9780596001780

5. Forms

Sean M. Burke O'Reilly Media ePub

Much of the interesting data of the Web is accessible only through HTML forms. This chapter shows you how to write programs to submit form data and get the resulting page. In covering this unavoidably complex topic, we consider packing form data into GET and POST requests, how each type of HTML form element produces form data, and how to automate the process of submitting form data and processing the responses.

The basic model for the Web is that the typical item is a "document" with a known URL, and when you want to access it (whether it's the Rhoda episode guide, or the front page of today's Boston Globe), you just get it, no questions asked. Even when there are cookies or HTTP authentication involved, these are basically just addenda to the process of requesting the known URL from the appropriate server. But some web resources require parameters beyond just their URL, parameters that are generally fed in by the user through HTML forms, and that the browser then sends either as dynamic parts of a URL (in the case of a GET request) or as content of a POST request.

See All Chapters
Medium 9781906188139

Keeping Time

Grovier, Kelly Carcanet Press Ltd. PDF
Medium 9781449393571

8. Sending HTTP Requests—The Efficient Way

Cuno Pfister Maker Media, Inc ePub

While the HttpWebRequest and HttpWebResponse classes are relatively convenient to use, they gobble up a large part of the available Flash and RAM on a Netduino Plus. Because they are built on top of the so-called Socket API, it can make sense to use the Socket API directly instead. This is more work, but it can reduce the memory footprint of an application considerably.

Moreover, the main message of this book is that HTTP is not black magic and requires neither high-powered computers nor huge, complex web frameworks. Using the Socket API makes that obvious, because you see much more of what really goes on than if you use only higher-level APIs. For this reason, I will show an alternative to SimplePutRequest called EfficientPutRequestwhich is efficient mainly in the sense that it has a small memory footprint.

To send a sample to Pachube, you can use the code in Example8-1.


This example starts in the same way as SimplePutRequest (Example7-1) from Chapter7with the two constants apiKey and feedId, which you must set to your API key and feed ID. Next, it opens a connection using the helper method Connect, and then it uses the helper method SendRequest to create the HTTP message and send it over the connection.

See All Chapters
Medium 9781491915592

7. Routing and Handlers

Michael Snoyman O'Reilly Media ePub

If we look at Yesod as a model-view-controller framework, routing and handlers make up the controller. For contrast, let’s describe two other routing approaches used in other web development environments:

Dispatch based on filename. This is how PHP and ASP work, for example.

Have a centralized routing function that parses routes based on regular expressions. Django and Rails follow this approach.

Yesod is closer in principle to the latter technique. Even so, there are significant differences. Instead of using regular expressions, Yesod matches on pieces of a route. Instead of having a one-way route-to-handler mapping, Yesod has an intermediate data type (called the route or type-safe URL data type) and creates two-way conversion functions.

Coding this more advanced system manually is tedious and error prone. Therefore, Yesod defines a domain-specific language (DSL) for specifying routes, and provides Template Haskell functions to convert this DSL to Haskell code. This chapter will explain the syntax of the routing declarations, give you a glimpse of what code is generated for you, and explain the interaction between routing and handler functions.

See All Chapters

See All Slices