acrg_grid package¶
Submodules¶
acrg_grid.areagrid module¶
Created on Tue Nov 11 11:23:48 2014 @author: chxmr
-
acrg_grid.areagrid.
areagrid
(lat, lon)[source]¶ Calculates grid of areas (m2) given arrays of latitudes and longitudes
Parameters: - lat (array) – 1D array of latitudes
- lon (array) – 1D array of longitudes
Returns: 2D array of areas of of size lat x lon
Return type: area (array)
Example
import acrg_grid lat=np.arange(50., 60., 1.) lon=np.arange(0., 10., 1.) area=acrg_grid.areagrid(lat, lon)
acrg_grid.coarsen module¶
Created on Thu Aug 13 16:09:07 2015
@author: chxmr
-
acrg_grid.coarsen.
coarsen
[source]¶ Coarsen a fine grid by some integer factor. E.g. if the input array is 1000 x 500, and is coarsened by a factor of 2 the output array will be 500 x 250. By default, the output is the mean of the inputs.
Parameters: - arrayFine (array) – array of values for fine resolution grid
- latFine (array) – 1D latitudes of fine resolution grid
- lonFine (array) – 1D longitudes of fine resolution grid
- factor (int, optional) – Factor by which to coarsen array. Default is 2
- mean (bool) – True/False. True calculates the mean of the fine array values; False calculates the sum. Default is True
Returns: grid of coarsened values outLat (array): Latitudes of coarsened grid outLon (array): Longitudes of coarsened grid
Return type: out (array)
Example
out, outLat, outLon = coarsen(fineArray, fineLat, fineLon, factor = 10, mean = True)
acrg_grid.haversine module¶
Created on Thu Nov 13 16:03:08 2014
FUNCTIONS¶
distance
Calculates the distance in km between two lat/lon pairs using the haversine formula.
Example:
distance = acrg_grid.haversine.distance(origin, destination, radius=radius)
Inputs:
origin: [lat_1, lon_1] two element array containing the lat and lon of your original point destination: [lat_2, lon_2] two element array containing the lat and lon of your destination point radius: radius in km. Defaults to 6371km.
Output:
distance between the two points in km
CLASSES¶
multipledistances
Calculates the distance in km between a single lat/lon pair and a grid of lat/lons using the haversine formula. Also identifies the minimum distance and it’s location.
Example:
distances = acrg_grid.haversine.multipledistances(origin, lat, lon, radius=radius)
Inputs:
origin: [lat_1, lon_1] two element array containing the lat and lon of your original point lat: an array of latitudes of length n lon: an array of longitudes of lenth m radius: radius in km. Defaults to 6371km.
Outputs:
distances= an n by m array containing the distances from every point in the nxm grid to the origin mindist = the minimum distance mindist_index = two element array containing the index in n and m corresponding to the minium distance e.g. if the minimum distance is at the 2nd latitude and 17th longitude then mindist_index = [2,17] mindist_loc = two element array containing the lat and lon corresponding to the minimum distance
@author: as1398 Based on code I nicked off a website made by Wayne Dick
28/11/2014 MLR: Added distancelist. Given a list of lon/lat pairs, outputs a list of
distances from the “origin”
e.g. distances=distancelist((origin_lat, origin_lon), zip(lats, lons))
if lons and lats are of length N, output will also be of length N
acrg_grid.hybridcoords module¶
Created on Wed Nov 19 10:56:48 2014 ; :Purpose: ; Calculate mid-point hybrid-coordinate pressure fields. ; For the ith level: ; ; P_i=A_i*P_0 + B_i*P_surface ; ; If /half is set, it is assumed that A (and B) define the coordinate system at ; grid cell boundaries. Mid-point pressure values will the be output, using: ; ; P_i=(P_{i-1/2} + P_{i+1/2})/2 ; ; :Inputs: ; A: (input, floating, required), hybrid A values. If P0 is set, A is dimensionless. ; If A P0 is not set, A must be in Pa. ; B: (input, floating, optional), hybrid B values. Dimensionless. ; If left out, surface pressure independent (fixed) pressure levels are output.
PS: This is assumed to be of dimensions lon by lat. If you’ve got a lon by lat by time array then you’ll need to make a loop to go through each time point.
; :Keywords: ; P0: (input, optional, floating) Reference pressure to multipy the A coordinate ; Half: (input, optional, boolean) Set to True if A and B define coordinates at grid cell ; boundaries. The output will still be at grid cell centres. ; Note that if true, the output will have one fewer vertical elements than A and B. ; ; :Outputs: ; 3D pressure field (lon, lat, level) ; ; :Example:: ; ; IDL> Pressure=mr_hybrid_coords(A, PS, B=B, P0=P0, half=half) ; ; :History: ; Written by: Matt Rigby, University of Bristol, Jul 16, 2013
Hacked into Python by Ann Stavert 19th Nov 2014
@author: as13988
acrg_grid.regrid module¶
Created on Thu Nov 26 16:58:34 2015
@author: chxmr and Mark Lunt
-
acrg_grid.regrid.
regrid2d
(array_in, lat_in, lon_in, lat_out, lon_out)[source]¶ 2D mass-conservative regrid
Parameters: - array_in (arrray) – 2D field to regrid
- lat_in (array) – latitudes corresponding to array_in
- lon_in (array) – longitude corresponding to array_in
- lat_out (array) – latitude to regrid onto
- lon_out (array) – longitude to regrid onto
Returns: regridded 2D array of dimensions [lat_out, lon_out] iris ‘Cube’: regridded iris ‘Cube’ object
Return type: array
Example
new_array, newcube = regrid2d(array_in, lat_in, lon_in, lat_out, lon_out)
Todo
Only handles a 2D array at the moment. We should add time.
-
acrg_grid.regrid.
regrid3d
(array_in, lat_in, lon_in, lat_out, lon_out, time)[source]¶ 3D mass-conservative regrid using a cached regridder
Parameters: - array_in (array) – 3D field to regrid – Dimensions of [lat_in, lon_in, time_in]
- lat_in (array) – latitudes corresponding to array_in
- lon_in (array) – longitude corresponding to array_in
- lat_out (array) – latitude to regrid onto
- lon_out (array) – longitude to regrid onto
- time (array) – times to regrid onto
- Returns
- array: regridded 3D array of dimensions [lat_out, lon_out, time]
Example
array_out = regrid3d(array_in, lat_in, lon_in, lat_out, lon_out, time)


Source code for fee.visualize.pca_components
import numpy as np
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
[docs]class PCAComponents():
"""`PCAComponents` Class"""
def __init__(self, E):
"""Plot the PCA principle component bar graph for some direction
of `E` computed using a list of pairs of words.
Args:
E (WE class object): Word embeddings object
"""
self.E = E
[docs] def PlotPCA(self, pairs, title, num_components, dpi, figsize):
"""Main `PCAComponents` visualization driver function
Args:
pairs (list): A list of pair (tuple/list) of words. The
direction is computed by PCA of set of
differences of these words.
title (str): title of the plot
num_components (int): number of principal components
dpi (int): dpi of the figures
figsize (tuple): size of figures in (HxW)
"""
plt.figure(figsize=figsize, dpi=dpi)
matrix = []
for a, b in pairs:
center = (self.E.v(a) + self.E.v(b))/2
matrix.append(self.E.v(a) - center)
matrix.append(self.E.v(b) - center)
matrix = np.array(matrix)
pca = PCA(n_components = num_components)
pca.fit(matrix)
plt.bar(range(num_components), pca.explained_variance_ratio_)
if title is not None:
plt.title(title)
plt.show()
[docs] def run(self, pairs, title=None, num_components=10, dpi=300,
figsize=(8, 5)):
"""Run the `PCAComponents` visualization
Args:
pairs (list): A list of pair (tuple/list) of words. The
direction is computed by PCA of set of
differences of these words.
title (str): title of the plot
num_components (int): number of principal components
figsize (tuple): size of figures in (HxW)
dpi (int): dpi of the figures
"""
assert len(pairs) >= num_components, f"# pairs ({len(pairs)}) should be greater than the number of components ({num_components})."
self.PlotPCA(pairs, title, num_components, dpi, figsize)


Use shift+click to hold buttons/pads pressed. In encoders, use shift+click in the arrow keys to rotate with bigger increments.


Starting at Dunnet Head, where the Atlantic Ocean meets the North Sea on the north coast of Scotland
Finishing at Leathercote Point, where the Channel meets the North Sea at the south-east corner of England
Following the line of the watershed, being the drainage divide between the waters flowing towards the Atlantic Ocean (and its arms the Irish Sea and the Channel) and the waters flowing towards the North Sea


How often did you find yourself googling
While its not possible to embed a video in markdown, the best and easiest way is to extract a frame from the video, add a layer with a play icon and link the video url on the image.
Speaking HTMLese, this is what you would do:

that translates into markdown as:
[![Alternate Text]({image-url})]({video-url} "Link Title")
To speed up the process I developped this tool that will do it for you.List of supported video providers:
[GET] https://video-to-markdown.netlify.com/.netlify/functions/image-json?url={video-url}
{
"provider": "youtube",
"url": "https://youtu.be/aqz-KE-bpKQ",
"mime": "image/jpeg",
"base64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAlgCWAAD/2wBDAAYEBQYFBA..."
}
The image-json
API accept only one url
parameter.
The value {video-url}
is a video url (e.g. https://youtu.be/aqz-KE-bpKQ)
[GET] https://video-to-markdown.netlify.com/.netlify/functions/image?url={video-url}
output
: image
The image
API accept only one url
parameter.
The value {video-url}
is a video url (e.g. https://youtu.be/aqz-KE-bpKQ)


--- layout: post title: Personal freedom, smoking, nutter politicians date: 2004-06-09 00:00:00 category: personal ---
Irrespective of whether you agree with John Reids opinions (or dangerous and patronising pronouncements, depending on your pov) on smoking and the freedom to do it, isn't it inappropriate for the health secretary to make such a public statement? What next - the home secretary defending crime as a lifestyle choice that brings joy to millions?


BLAST FROM THE PAST (New Line) Starring: Brendan Fraser, Alicia Silverstone, Christopher Walken, Sissy Spacek, Dave Foley. Screenplay: Bill Kelly and Hugh Wilson. Producers: Renny Harlin and Hugh Wilson. Director: Hugh Wilson. MPAA Rating: PG-13 (profanity, adult themes) Running Time: 106 minutes. Reviewed by Scott Renshaw.
The conventional three-act film storytelling structure may not be sacrosanct, but if you're telling a conventional story, it's a really good idea to use it. Marketing sets up the audience to expect a specific conflict for the second act, and to expect that certain characters and relationships will be the focal points; familiarity with other films tells them those elements will appear before they've finished their bags of popcorn. If you give the people what they expect when they're expecting it, you're going to satisfy them nine times out of ten.
BLAST FROM THE PAST is set up as a romance and a fish-out-of-water comedy, and eventually it is both. It simply takes foooorrreeeeevvveerr to get there. The prologue begins in October 1962 in Los Angeles, where brilliant, highly paranoid scientist/inventor Calvin Webber (Christopher Walken) and his nine-months-pregnant wife Helen (Sissy Spacek) are well-prepared for the Cold War to turn hot. The Cuban Missile Crisis and a nearby plane crash conspire to convince the Webbers that nuclear war has begun, so they lock themselves into their plush multi-room fallout shelter to wait out the radiation. Thirty-five years later the door opens, and the Webbers' son Adam (Brendan Fraser) -- who has spent his whole life sealed away with Mom and Dad in 1962 -- emerges for supplies and, perhaps, to find a wife.
A sensible film-maker would have realized that the Webbers' life in the shelter was the set-up for the story, not the story itself. Director Hugh Wilson, working from his own re-write of Bill Kelly's original story, decides that those thirty-five years will take up the first thirty-five minutes of the film. He juxtaposes details of their day-to-day lives with developments in the world above -- the latter centered around an employee (Joey Slotnik) in a malt shop-turned-singles' bar-turned-punk dive -- betraying his sitcom roots by spending infinitely too much time on wacky peripheral characters.  Get Adam into the real world let him cope with it.
At long last he does get into the real world, and befriends a cynical young woman named Eve (Alicia Silverstone). Naturally he reacts strangely to new-to-him phenomena like riding on a bus and looking at the sky, and naturally other people react strangely to his anachronistic politeness and friendliness. The whole business is handled clumsily, though; like Adam himself, the film waits so long to begin doing the things it should have been doing much earlier, it appears unsure how to do them. The relationship with Eve develops with inevitability, but without making sense of her softening towards Adam. How much better spent that first half hour might have been if the real world juxtaposition had been Eve's childhood rather than the pointless Slotnik character, both for comedic social commentary potential and for plot development purposes. But no such luck -- BLAST FROM THE PAST often feels like an assembly-line product made by people who've never seen an assembly line.
BLAST FROM THE PAST does have its charms, enough not to make the experience completely frustrating. Brendan Fraser does have the naif in a strange land thing nailed -- he should, after ENCINO MAN and GEORGE OF THE JUNGLE -- with his big lug build and goofy kid grin; Dave Foley gets the already tired role of the gay best friend, but delivers his lines with zest. Wilson brings a silly energy to the second half of the film, giving it enough cute moments to make it watchable, but he never pulls it all together in a way that's completely satisfying. BLAST FROM THE PAST is a pretty lousy execution of a fairly simple idea, a textbook case of a by-the-numbers plot that just doesn't add up.
On the Renshaw scale of 0 to 10 half-lives: 5.
Visit Scott Renshaw's Screening Room http://www.inconnect.com/~renshaw/ *** Subscribe to receive new reviews directly by email! See the Screening Room for details, or reply to this message with subject "Subscribe".
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Explosive argument rips I'm A Celeb camp apart as campmates row
Tensions were at an all time high during tonight's episode
by Sophie McCoidThe I'm A Celebrity camp was rocked tonight, as an explosive argument split the campmates in half.
James and Kate brought a Jungle scroll into camp that had new campmates Andy and Cliff’s faces on as Outlaws.
Kate read the scroll out to camp: “Outlaws caught wanted for their crime of late entry. The two new campmates Andy and Cliff have been sent to Jungle Jailhouse on basic rations.
"Before entering the Jailhouse they took part in today’s Bushtucker Trial – The Frontier of Fear and they won 8 stars for camp.”
The camp cheered.
Kate continued: “So you now have the opportunity to be good, bad or downright ugly. So we can keep all the food ourselves, or we can choose to feed the outlaws with our share of food, however if we choose to feed them we will have to send two campmates to join them as outlaws in the Jailhouse.”
Andrew and James both said they were happy to go, Kate and Ian also said they were happy to go. Ian suggested they draw straws.
Talking in the BT, Roman said “We decided to draw named water bottles over who would go.”
And that's when the drama started as Jacqueline said “I think that’s scary.” (Referring to drawing names) .
Kate asked if she’d rather not go and Ian said she didn’t have to go. Jacqueline said “Yeah but it’s not very heroic.”
Andrew jumped in and said: “I think it has to be everyone in, I don’t think it’s fair to count yourself out.”
James said “If she doesn’t want to do it, don’t do it.”
Andrew hit back and said “It’s an ordeal that has to be shared.”
Andrew turned to Jacqueline and said: “It’s not back to Snake Rock, it could be anything.”
Adele jumped in and said: “I think it’s just anybody that’s up for it. If anyone wants to stay they should be allowed.”
Tensions began to rise and Jacqueline and Nadine both said they didn’t want to take part and would prefer to remain in Main Camp.
Talking in the BT, Andrew said: “Jacqueline and Nadine said they didn’t want to go and erm…that’s the end of that…”
Andrew didn’t understand why Nadine and Jacqueline wouldn’t put themselves up like everyone else.
The campmates picked out named water bottles out of a bag and the last two remaining were the two to go to the Jailhouse – they were Kate and Andrew.
Jacqueline said James didn’t mind going if Kate wanted to stay, more tension followed until the campmates all agreed to continue as discussed and Kate and Andrew would go.
Kate and Andrew left camp to join Andy and Cliff at the Jungle Jailhouse.
Caitlyn looked a t the scroll picture of Andy and Cliff and asked if anyone knew who they were.
Roman then explained who Kirk from Corrie was to Caitlyn Jenner.
*I'm A Celebrity...Get Me Out of Here continues at 9pm on ITV tomorrow


| Approve | # | Trn Date | Trn Time | Type | Name | Phone | #Tokens Withdrawn | Amount Equivalent |
|---|---|---|---|---|---|---|---|---|
| {{ clients.id }} | {{ clients.trn_date }} | {{ clients.trn_time}} | {{ clients.trn_type}} | {{ clients.name }} | {{ clients.phone }} | {{ clients.tokens_purchased }} | {{ clients.expected_amount | number}} |


MAILMAIL(1) MAILMAIL(1) NAME mailmail - Twisted sendmail compatibility script SYNOPSIS mailmail [recipient addresses] DESCRIPTION mailmail reads RFC822 message text from standard input and delivers them, using SMTP, to a Mail Transfer Agent listening at <IP_ADDRESS>:25. It accepts (but does not necessarily implement) many of the standard send‐ mail(1) options, but it is preferable to list only the recipient addresses on the command line, and include a From header within the mes‐ sage text indicating the sender. AUTHOR Written by Jp Calderone REPORTING BUGS To report a bug, visit http://twistedmatrix.com/bugs/ COPYRIGHT Copyright © 2003-2008 Twisted Matrix Laboratories. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. July 2003 MAILMAIL(1)


Last updated: 2017-11-15
Code version: 78f7cb7
Sample space is collection of possible outcomes of an experiment. For coinflip: \(S = \left\{H, T\right\}\).
In general, take sample space that cannot be divided. \(S = \left\{1,2,3,4,5,6\right\}\), better than \(S = \left\{odd, even\right\}\).
If \(A\) and \(B\) are any two events in sample space \(S\), then \[P(A \cup B) = P(A) + P(B) - P(A \cap B)\]
If \(A\), \(B\) and \(C\) are any three events in sample space \(S\), then \[P(A \cup B \cup C) = P(A) + P(B) + P(C) - P(A \cap B) - P(B \cap C) - P(B \cap C) + P(A \cap B \cap C)\]
If \(A\) and \(B\) are two events in sample space \(S\) and \(P(A) \neq 0\), then the conditional probability of \(B\) given \(A\) is: \[P(B|A) = \frac{P(A \cap B)}{P(A)}\]
Two events \(A\) and \(B\) are independent if and only if \[P(A \cap B) = P(A)*P(B)\]
Which means that \(P(B|A) = P(B)\) and \(P(A|B) = P(A)\). These two conditions are equivalent when both \(P(A) \neq 0\) and \(P(B) \neq 0\).
If the events \(B_1, B_2, ..., B_k\) constitute apartition of the sample space \(S\), with \(P(B_i) \neq 0\) for any \(i\), then for any event \(A\) in \(S\): \[P(A) = \sum_{i=1}^k{P(B_i)*P(A|B_i)}\]
\(B_i\) is a partition for \(S\) when they are mutually exclusive, and their union equals \(S\).
Given a partition \(B_i \neq 0\), \(B_1, B_2, ..., B_k\) of \(S\), and an event \(A\) with \(P(A) \neq 0\) in \(S\), that was reached via one of the \(k\) branches, then the probability that \(A\) was reached through branch \(r\) is: \[P(B_r|A) = \frac{P(B_r)*P(A|B_r)}{\sum_{i=1}^k{P(B_i)*P(A|B_i)}}\]
\(B_i\) are prior probabilities.
Conditional distribution (or density for continuous variable) \[f(x|y) = \frac{f(x,y)}{h(y)}\] Where \(h(y) \neq 0\) the marginal distribution / density at \(Y = y\)
Variables are independent if and only if
\[f(x_1,x_2,...,x_n) = f(x_1)*f(x_2)*...*f(x_n)\]
Within their range.
sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252
[3] LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.1 backports_1.1.0 magrittr_1.5 rprojroot_1.2
[5] tools_3.4.1 htmltools_0.3.6 yaml_2.1.14 Rcpp_0.12.12
[9] stringi_1.1.5 rmarkdown_1.6 knitr_1.17 git2r_0.19.0
[13] stringr_1.2.0 digest_0.6.12 evaluate_0.10.1
This R Markdown site was created with workflowr


THE FUNERAL (1996) A film review by Bryant Frazer Copyright 1996 Bryant Frazer
Directed by Abel Ferrara Written by Nicholas St. John Cinematography by Ken Kelsch Starring Christopher Walken, Chris Penn, Vincent Gallo, and Anabella Sciorra U.S.A., 1996
GRADE: A-
"Carry this with you," Ray Tempio's father tells him, handing him the empty casing of a bullet that the boy has just used to kill a man. "Nothing will cost you more." At his father's urging, young Ray executed an enemy of his family.
Ray has carried those words with him through his formative and adult years, even though they may be a reflection of the kind of philosophy that led his father to suicide. Still, it's the philosophy he knows -- part of the worldview he's locked into. The scene comes in a flashback early in Abel Ferrara's Depression-era gangster movie, The Funeral. Fans of Ferrara's earlier work -- which includes King of New York, Bad Lieutenant and last year's wacked-out vampire allegory, The Addiction -- should know what to expect, but many others may be baffled by this oddball crime drama cum murder mystery cum philosophical treatise. Ferrara's heady moral brew is an aquired taste: bitter, yet rare and satisfying.
Christopher Walken, Chris Penn, and Vincent Gallo are Ray, Chez, and Johnny Tempio. The latter brother is laid out dead in a coffin as the movie begins, three bullet holes in his chest. Ray, who presides over the funereal household with an eerie majesty, is bent on vengeance. Chez, a loose cannon, is just angry. Watch carefully -- Ferrara switches into flashback without warning, so viewers are advised to keep on their toes.
We learn more about Johnny -- he was a budding Communist whose ideals gave him keen interest in his racketeering family's influence on labor unions. He was a brash loudmouth who fed his hubris by dating the wife of rival Gaspare Spoglia (Benicio del Toro). But most of all, he was a Tempio, and that means Ray is out for blood. Ray's henchmen round up and question Gaspare, the most likely culprit. But as Ray investigates deeper, he's confronted with the possibility that Johnny may have gotten just what was coming to him. And what then?
The women have had their fill of violence and vengeance. Ray's wife Jeanette (Anabella Sciorra) confides to Johnny's fiance (Gretchen Mol) that she's lucky she won't wind up married to "one of them," and keeps a figure of Saint Agnes next to the bed, as a reminder of "what happens to you when you say no." Lancome spokesmodel Isabella Rossellini looks startlingly world weary as Chez's beleagured wife, and she has her own saint on the table -- the patroness of treatment for the insane.
Indeed, it's the very real tribulations of these women that help keep the testosterone-enhanced performances of Walken and Penn in check. The Funeral never takes the easy tack of glamorizing its gangsters, and Sciorra's strong-minded performance is a tough and unsentimental reminder of how lives are torn apart by sacred bonds turned unholy.
Ferrara gives her plenty of screen space, since she's got a pair of scenery-chewing performances to compete with. Walken is, as ever, giddily hammish. He's intense and scary and very serious about the role, but there's an element of high comedy buried underneath the facade. Walken is such a good actor than even though he's unmistakably aware of how crazy his character is, he plays it with an unwavering passion even as he tumbles over the top.
Still, the real kudos must go to Penn, who's stuck exercising mostly his aptitude for ugliness. I've had my fill of the abusive male as a character type, but Penn really helps us understand this one. Ferrara never asks us to excuse Chez's behavior toward women -- Chez treats his wife poorly and with little passion; he first rebukes, then forces himself on a young prostitute who can't comprehend his sudden moralizing -- but he does remember to show us why this man has a wife and friends in the first place. In one of the movie's best and truest scenes, Chez belts out a pop tune, surrounded by friends and associates at his bar. The exuberant magnetism Penn summons is undeniable, and a great testament to his still-underrated talents.
The Funeral isn't all so well-balanced. Ever since Bad Lieutenant, I've wished Ferrara and longtime collaborator Nicholas St. John could find a way to better weave their more didactic concerns into the fabric of the film. As it is, the film stops dead several times so that the characters can have conversations that delve into moral responsibility and the teachings of Catholicism. These are almost Godardian moments, where the audience is suddenly jerked out of the movie's fiction-world to be lectured. I also have severe reservations about the very ending of the picture, which is a big, gaudy exclamation point at the end of an otherwise well-constructed story. It may be the logical extension of Chez's tortured existence, but it's an extension that we could well have imagined without seeing it actually played out on-screen.
Ferrara got his start making deliciously nasty exploitation flicks that left nothing much to the imagination (Driller Killer, Ms. 45). He's now working in a different milieu, and it's one that he hasn't necessarily come to terms with. Still, the low-key style he has pioneered over his body of work, unpleasant and unrelenting, seems to me a more significant and consistent exploration of modern America's dark side than anything that's been tried recently. His accomplishments dwarf the much flashier series of film noir retreads we've been subjected to, films which simply fetishize their subject matter rather than exploring it. Whatever else Ferrara may be, he's an explorer, and The Funeral may be as good a point as any for a willing neophyte to join the expedition.
-- DEEP FOCUS (Movie Reviews) http://www.panix.com/~bfrazer/flicker/ "Go ahead, mum -- treat yourself."
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


| CONTENTS |
The Unix operating system was one of the first to include online documentation. It's not the best in the world most users who haven't internalized the manual set curse it once a week but it has proven surprisingly resilient. What's particularly interesting about Unix's online documentation is that, unlike other early help systems, it isn't an adjunct to another set of printed documentation that contains the "real" truth. The online manual is complete, authoritative, and usually more current than any printed documentation.
The basis for Unix's online documentation is the man command. Most simply, you use it as follows:
% man topic
where topic is usually the name of some command; but it can also be the name of a system call, a library routine, an I/O device, or an administrative file (or file type). The output from man is usually sent to a pager like more, which allows you to page through the results.
There are several command-line options for the man command that can differ based on system. For instance, to look at a command within a specific section, on a System V machine use the -s "section" option, with the following format:
% man section topic % man -s section topic
For example, if you want to read documentation about the /etc/passwd file (rather than the passwd command) on a System V machine, give the command:
% man -s 4 passwd
This is an easy way to distinguish between topics with the same name, but in different sections. For other Unix systems, such as FreeBSD, the option to search a section could be something different, such as -S.
Another useful command-line option is the -k option, which is equivalent to the apropos command. This option searches database files for matches of a given keyword, returning the results. This is particularly helpful in finding commands that contain a specific keyword if you're not quite sure what the command is.
Your system may have a configuration file for man named /etc/man.config. If it does, reading it will show you the directories in which manpages are stored, the order in which manpages are searched by default, and more. Even if you don't have an /etc/man.config file, your man command may understand the MANPATH (Section 3.21) environment variable, a list of where man should search. You can set your own MANPATH, for example, to show manpages for local versions of commands before standard versions with the same name.
Your system may also have a different manual page system: info (Section 2.9).
ML and JP
whatis is almost identical to apropos or the use of man -k (Section 2.1), but it requires a command name as an argument rather than an arbitrary string. Why is this useful? Well, let's say you forget what cat (Section 12.2) does.  You may not want to read the entire manual page. But whatis cat gives you a nice one-line summary:
% whatis cat cat (1V) - concatenate and display
The whatis command is equivalent to man -f on most systems.
Before running whatis the first time on your system particularly if you're running a standalone machine using FreeBSD, Linux, or Darwin you'll want to run the makewhatis at /usr/libexec/makewhatis, which creates the whatis database by scanning the command names from the existing manpages.
ML
The whereis command helps you to locate the executable file, source code, and manual pages for a program. I use it primarily as a sanity check; if I type cat useless.txt and get the message "cat: command not found," I immediately try whereis cat. This gives me a lot of information about what went wrong: someone may have removed cat (Section 12.2) from the system, or my PATH (Section 35.6) environment variable may be set incorrectly, etc.
Output from whereis typically looks like this:
% whereis more cat: /bin/cat /usr/share/man/man1/cat.1.gz
This says that the executable file is /bin/cat and the manual page is /usr/share/man/man1/cat.1.gz.
whereis has a few options worth mentioning:
Only report the executable name
Only report the location of the manual page
Only search for source files
Only issue a report if any of the requested information (executable, manual page, source) is missing
There are other options for modifying the list of directories through which whereis searches; if you need these, check your manual pages. In addition, the functionality and flags for whereis can differ between versions of Unix. For instance, much of the basic functionality of the command was removed in version 4.4 of FreeBSD as well as Darwin. Again, the manual pages will show you this information.
ML and SP
When the other techniques in this chapter don't find the information you want, you can try searching the online manual page (Section 2.1) files. You'll probably have to wade through a lot of stuff that you don't want to see, but this method can work when nothing else does. As an example, you remember that there's some command for chopping columns out of a file. You try man -k or apropos, but it only mentions colrm and pr, and those aren't what you want. You'll usually be able to narrow your search to one or two manual page sections (Section 2.1); here, you know that user commands are in section 1. So you go to the manual pages and do a case-insensitive search through all the files for "column" or "chop":
% cd /usr/man/man1 % egrep -i 'column|chop' * awk.1:Add up first column, print sum and average: colrm.1:colrm \- remove characters from specified columns within each line ... cut.1:.IX cut "" "\fIcut\fP \(em remove columns from file" ...
It's cut! Notice that awk also handles columns, but apropos doesn't say so.
(I cheated on that example: there were other ways to find cut using the synonym apropos field instead of apropos column, for instance. But this method does work in tougher cases.) To search the manual page files, you'll need to know where they're stored. There are lots of possibilities. If your system has an /etc/man.config file, it'll probably tell you. Otherwise, the directories /usr/man or /usr/share/man are good places to look. If the command is local, try /usr/local/man and maybe /opt (a big tree where find (Section 9.4) can help). If your system has fast find or locate (Section 9.18), try searching for man or */man*.
Your manpage files may be compressed (Section 15.6). In that case, use grep (Section 13.2) with the -Z option, grep -Z.
You'll probably find subdirectories with names like man1, man2, . . . and/or cat1, cat2, . . . Directory names like manN will have unformatted source files for section N; the catN directories have formatted source files. Or you may just find files named command.N, where N is 1 for section 1, 2 for section 2, and so on.
There are two types of manpage files: unformatted (shown in Section 3.22) and formatted. The unformatted pages are easier to search because none of the words will have embedded backspace characters. The previous example shows how. The unformatted pages have nroff commands and macros in them, though, which can make searching and reading tougher.
To search formatted pages, you'll want to strip the embedded backspace characters. Otherwise, grep might miss the word you want because it was boldfaced or underlined with backspaces in it. In the following example, a shell loop (Section 28.9) applies a series of commands to each file. First, col -b removes the overstriking. grep does a search (case insensitive, as before). Because grep is reading its standard input, it doesn't know the filename, so a little sed command adds the name to the start of every line grep outputs.
$ cd /usr/man/cat1
$ for file in * > do col -b < $file | grep -i column | sed "s/^/${file}:/" > done awk.1: Add up first column, print sum and average: ... cut.1: Use cut to cut out columns from a table or fields from each ...
If your manpage files are compressed, replace col -b < $file with:
zcat $file | col -b
In Bourne shells, you can pipe the output of the loop to a pager (like less (Section 12.3)) to see the output a screenful at a time and quit (with q) when you're done. To do that, change the last line of the for loop to:
done | less
JP
Each computer on a network needs a name. On many Unix versions, the uname -n command shows you this name. On some systems, the command hostname or uuname -l (two us, lowercase L) may be what you want. If you use more than one system, the hostname is great to use in a shell prompt or any time you forget where you're logged in.
JP
Your system may have several versions of a particular command for instance, a BSD-compatible version in one directory and a System V-compatible version somewhere else (and you might have added a private version in your own bin directory (Section 7.4)). Which command you'll get depends on your PATH (Section 35.6) environment variable. It's often essential to know which version you're using. For example:
$ type sort sort is /bin/sort
tells me exactly which version of the sort program I'm using. (On one system I've used, there were two sorts; I had also defined an alias for sort.) If I want to see all versions, bash supports a -all option:
$ type -all sort sort is aliased to `TMPDIR=/var/tmp /bin/sort' sort is /bin/sort sort is /usr/5bin/sort
A similar command is whence.
But type and whence are built into shells and are also Unix-version dependent (not all Unix systems have them), so they won't work everywhere. The which command is usually external (Section 1.9), so it works everywhere although, because it isn't built into the shells, it can't always find out about aliases defined in your current shell. For example:
% which sort /usr/bin/sort
You'll find that which comes in handy in lots of other situations. I find that I'm always using which inside of backquotes to get a precise path. (whence and type may print extra text.) For example, when I was writing these articles, I started wondering whether or not man, apropos, and whatis were really the same executable. It's a simple question, but one I had never bothered to think about. There's one good way to find out:
% ls -li `which man` `which apropos` `which whatis` 102352 -rwxr-xr-x 3 root 24576 Feb 8 2001 /usr/ucb/apropos 102352 -rwxr-xr-x 3 root 24576 Feb 8 2001 /usr/ucb/man 102352 -rwxr-xr-x 3 root 24576 Feb 8 2001 /usr/ucb/whatis
What does this tell us? Well, within this system the three commands have the same file size, which means that they're likely to be identical; furthermore, each file has three links, meaning that each file has three names. The -i option confirms it; all three files have the same i-number. So, apropos, man, and whatis are just one executable file that has three hard links.
However, running the same command in another environment, such as in Darwin, results in a different output:
117804 -r-xr-xr-x 1 root wheel 14332 sep 2 2001 /usr/bin/apropos 117807 -r-xr-xr-x 1 root wheel 19020 sep 2 2001 /usr/bin/man 117808 -r-xr-xr-x 1 root wheel 14336 sep 2 2001 /usr/bin/whatis
In Darwin, the commands are separate entities.
A few System V implementations don't have a which command.
ML, JP, MAL, and SP
Each login session has its own tty (Section 24.6) a Unix device file that handles input and output for your terminal, window, etc. Each tty has its own filename. If you're logged on more than once and other users want to write or talk (Section 1.21) to you, they need to know which tty to use. If you have processes running on several ttys, you can tell which process is where.
To do that, run the tty command at a shell prompt in the window:
% tty /dev/tty07
You can tell other users to type write your-username tty07.
Most systems have different kinds of ttys: a few dialup terminals, some network ports for rlogin and telnet, etc. (Section 1.21). A system file like /etc/ttys lists which ttys are used for what. You can use this to make your login setup more automatic. For example, most network terminals on our computers have names like /dev/ttypx or /dev/pts/x, where x is a single digit or letter. I have a test in my .logout file (Section 4.17) that clears the screen on all ttys except network:
# Clear screen non-network ttys:
` ` Section 28.14
if ("`tty`" !~ /dev/ttyp?) then clear endif
(Of course, you don't need to clear the terminal screen if you're using an xterm window that you close when you log out.)
JP
The who command lists the users logged on to the system now. Here's an example of the output on my system:
% who naylor ttyZ1 Nov 6 08:25 hal ttyp0 Oct 20 16:04 (zebra.ora.com:0.) pmui ttyp1 Nov 4 17:21 (dud.ora.com:0.0) jpeek ttyp2 Nov 5 23:08 (jpeek.com) hal ttyp3 Oct 28 15:43 (zebra.ora.com:0.) ...
Each line shows a different terminal or window. The columns show the username logged on, the tty (Section 2.7) number, the login time, and, if the user is coming in via a network (Section 1.21), you'll see their location (in parentheses). The user hal is logged on twice, for instance.
It's handy to search the output of who with grep (Section 13.1) especially on systems with a lot of users. For example:
% who | grep "^hal " ...where is hal logged on? % who | grep "Nov 6" ...who logged on today?
-v Section 13.3
% who | grep -v "Nov 6" ...who logged on before today? ...
The GNU who, on the CD-ROM [see http://examples.oreilly.com/upt3], has more features than some other versions.
JP
An information system gaining popularity on the more lightweight Unix-based systems is info. It's particularly relevant for finding information within Linux and FreeBSD.
Unlike man which displays all information on a topic at once, usually routed through some form of paging system such as cat info is based on a hypertext like linkage between topic components. You connect to each of the subtopics using character-based commands and typing part or all of the subtopic title at least enough to distinguish one subtopic from another.
To use info, you type the command info followed by the Unix command about which you're trying to find information. For instance, to find out more about info itself, you would use the following command line:
info info
This will return the main info introduction page and a menu of subtopics such as:
Getting Started Advanced Info Creating an Info File
To access the subtopic, you type the letter m for menu, and then in the prompt that opens at the bottom of the screen, type enough of the letters to distinguish the subtopic menu item from any other. You don't have to complete the command: you can just type enough of the letters followed by a TAB to fill in the rest. Once the subtopic menu item has been filled in, hitting ENTER sends you to the information.
To learn more about using info, you can type the letter h when you're in info and no command line buffer is showing. This brings up basic information about the info command, including the commands you use within info to use the application. These letters are summarized in Table 2-1.
|
Command |
Action |
|---|---|
|
h |
To get help on using info |
|
m |
To access a subtopic menu item |
|
n |
To get to next related subtopic |
|
p |
To get to the previous related subtopic |
|
space |
To move forward in the display if it exceeds page size |
|
delete |
To move backward in the display if it exceeds page size |
|
Ctrl-l |
To clean up the display if it gets mangled |
|
b |
To get to the first page of the display |
|
? |
To get a list of info commands |
|
q |
To quit info |
|
d |
To return to highest level of info topics |
|
mEmacsreturn |
To access the Emacs manual |
|
s |
To search for string within current node |
Note that the letter commands are case insensitive: U works the same as u.
Use the d command to pull up the Directory node, the menu of info major topics. In fact, this is a good way to become familiar with info and its contained subtopics type d and then use the menu commands to explore each of the major subtopic areas.
For instance, from the Directory Node, typing m followed by typing strings into the command buffer pulls up the strings info node.
When using the info command, if the information doesn't fit within a page, header and footer information will provide you some details about the subtopic, such as the info file, node, and the next nodes within the hierarchy. For instance, when accessing information about man, depending on your system the header reads as follows:
File: *manpages*, Node:man, Up: (dir)
This translates to the info file manpages and the node for man. Typing the u will move you up to the dir info page. Within Emacs, use mouse button two to click on and access a subtopic.
The footer provides a summary of the header information and also provides the number of lines for the topic if the topic page extends past the current screen. To see more information, type the space to page through the topic, just as you do with man.
Much of the help information within info is pulled over as is from manpages and hasn't been converted to the hypertext format of info. Because of this, the use of the m command won't pull up any subtopic. You'll need to use the space key to access the additional information.
To search within an info node/page, type s and then type the search string into the command buffer. The cursor is moved to the first occurance of the string.
SP
| CONTENTS |


Introduction
C++ is a cross-platform language that can be used to create high-performance applications.
C++ was developed by Bjarne Stroustrup, as an extension to the C language.
C++ gives programmers a high level of control over system resources and memory.
The language was updated 3 major times in 2011, 2014, and 2017 to C++11, C++14, and C++17.
Why Use C++
- C++ is one of the world's most popular programming languages.
- C++ can be found in today's operating systems, Graphical User Interfaces, and embedded systems.
- C++ is an object-oriented programming language which gives a clear structure to programs and allows code to be reused, lowering development costs.
- C++ is portable and can be used to develop applications that can be adapted to multiple platforms.
- As C++ is close to C# and Java, it makes it easy for programmers to switch to C++ or vice versa
Data Types
The data type specifies the size and type of information the variable will store:
- int :Stores whole numbers, without decimals
- float :Stores fractional numbers, containing one or more decimals. Sufficient for storing 7 decimal digits
- double :Stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits
- boolean :Stores true or false values
- char :Stores a single character/letter/number, or ASCII values
Comments
Comments can be used to explain C++ code, and to make it more readable. It can also be used to prevent execution when testing alternative code. Comments can be singled-lined or multi-lined. Single-line comments start with two forward slashes (//). Any text between // and the end of the line is ignored by the compiler (will not be executed).


UDEV
Section: udev (7)Updated: 07/03/2012
Index Return to Main Contents
NAME
udev - dynamic device managementDESCRIPTION
udev provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files in the /dev directory, or it renames network interfaces.
Usually udev runs as udevd(8) and receives uevents directly from the kernel if a device is added or removed from the system.
If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling.
CONFIGURATION
udev configuration files are placed in /etc/udev/ and /lib/udev/. All empty lines, or lines beginning with '#' will be ignored.
Configuration file
udev expects its main configuration file at /etc/udev/udev.conf. It consists of a set of variables allowing the user to override default udev values. The following variables can be set:
udev_root
- Specifies where to place the device nodes in the filesystem. The default value is /dev.
udev_log
- The logging priority. Valid values are the numerical syslog priorities or their textual representations: err, info and debug.
Rules files
The udev rules are read from the files located in the default rules directory /lib/udev/rules.d/, the custom rules directory /etc/udev/rules.d/ and the temporary rules directory /dev/.udev/rules.d/. All rule files are sorted and processed in lexical order, regardless in which of these directories they live.
Rule files are required to have a unique name, duplicate file names are ignored. Files in /etc/udev/rules.d/ have precedence over files with the same name in /lib/udev/rules.d/. This can be used to ignore a default rules file if needed.
Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned.
A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used.
A rule consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are:
==
- Compare for equality.
!=
- Compare for inequality.
=
- Assign a value to a key. Keys that represent a list, are reset and only this single value is assigned.
+=
- Add the value to a key that holds a list of entries.
:=
- Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules.
The following key names can be used to match against device properties. Some of the keys also match against properties of the parent devices in sysfs, not only the device that has generated the event. If multiple keys that match a parent device are specified in a single rule, all these keys must match at one and the same parent device.
ACTION
- Match the name of the event action.
DEVPATH
- Match the devpath of the event device.
KERNEL
- Match the name of the event device.
NAME
- Match the name of the node or network interface. It can be used once the NAME key has been set in one of the preceding rules.
SYMLINK
- Match the name of a symlink targeting the node. It can be used once a SYMLINK key has been set in one of the preceding rules. There may be multiple symlinks; only one needs to match.
SUBSYSTEM
- Match the subsystem of the event device.
DRIVER
- Match the driver name of the event device. Only set for devices which are bound to a driver at the time the event is generated.
ATTR{filename}
- Match sysfs attribute values of the event device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself.
KERNELS
- Search the devpath upwards for a matching device name.
SUBSYSTEMS
- Search the devpath upwards for a matching device subsystem name.
DRIVERS
- Search the devpath upwards for a matching device driver name.
ATTRS{filename}
- Search the devpath upwards for a device with matching sysfs attribute values. If multiple ATTRS matches are specified, all of them must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself.
ENV{key}
- Match against a device property value.
TEST{octal mode mask}
- Test the existence of a file. An octal mode mask can be specified if needed.
PROGRAM
- Execute a program. The key is true, if the program returns successfully. The device properties are made available to the executed program in the environment. The program's output printed to stdout, is available in the RESULT key.
RESULT
- Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call.
Most of the fields support a shell style pattern matching. The following pattern characters are supported:
*
- Matches zero, or any number of characters.
?
- Matches any single character.
[]
- Matches any single character specified within the brackets. For example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '-' character. For example, to match on the range of all digits, the pattern [0-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched.
The following keys can get values assigned:
NAME
- The name of the node to be created, or the name the network interface should be renamed to.
SYMLINK
- The name of a symlink targeting the node. Every matching rule will add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character.
OWNER, GROUP, MODE
- The permissions for the device node. Every specified value overwrites the compiled-in default value.
ATTR{key}
- The value that should be written to a sysfs attribute of the event device.
ENV{key}
- Set a device property value. Property names with a leading '.' are not stored in the database or exported to external tool or events.
RUN
-
Add a program to the list of programs to be executed for a specific device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. If the option
RUN{fail_event_on_error}
is specified, and the executed program returns non-zero, the event will be marked as failed for a possible later handling.
If the specified string starts with socket:path, all current event values will be passed to the specified socket, as a message in the same format the kernel sends an uevent. If the first character of the specified path is an @ character, an abstract namespace socket is used, instead of an existing socket file.
LABEL
- Named label where a GOTO can jump to.
GOTO
- Jumps to the next LABEL with a matching name
IMPORT{type}
-
Import a set of variables as device properties, depending on
type:
program
- Execute an external program specified as the assigned value and import its output, which must be in environment key format.
file
- Import a text file specified as the assigned value, which must be in environment key format.
db
- Import a single property specified as the assigned value from the current device database. This works only if the database is already populated by an earlier event.
cmdline
- Import a single property from the kernel commandline. For simple flags the value of the property will be set to '1'.
parent
- Import the stored keys from the parent device by reading the database entry of the parent device. The value assigned to IMPORT{parent} is used as a filter of key names to import (with the same shell-style pattern matching used for comparisons).
If no option is given, udev will choose between program and file based on the executable bit of the file permissions.
WAIT_FOR
- Wait for a file to become available.
OPTIONS
-
Rule and device options:
ignore_device
- Ignore this event completely.
ignore_remove
- Do not remove the device node when the device goes away. This may be useful as a workaround for broken device drivers.
link_priority=value
- Specify the priority of the created symlinks. Devices with higher priorities overwrite existing symlinks of other devices. The default is 0.
all_partitions
- Create the device nodes for all available partitions of a block device. This may be useful for removable media devices where media changes are not detected.
event_timeout=
- Number of seconds an event will wait for operations to finish, before it will terminate itself.
string_escape=none|replace
- Usually control and other possibly unsafe characters are replaced in strings used for device naming. The mode of replacement can be specified with this option.
watch
- Watch the device node with inotify, when closed after being opened for writing, a change uevent will be synthesised.
nowatch
- Disable the watching of a device node with inotify.
The NAME, SYMLINK, PROGRAM, OWNER, GROUP, MODE and RUN fields support simple printf-like string substitutions. The RUN format chars gets applied after all rules have been processed, right before the program is executed. It allows the use of device properties set by earlier matching rules. For all other fields, substitutions are applied while the individual rule is being processed. The available substitutions are:
$kernel, %k
- The kernel name for this device.
$number, %n
- The kernel number for this device. For example, 'sda3' has kernel number of '3'
$devpath, %p
- The devpath of the device.
$id, %b
- The name of the device matched while searching the devpath upwards for SUBSYSTEMS, KERNELS, DRIVERS and ATTRS.
$driver
- The driver name of the device matched while searching the devpath upwards for SUBSYSTEMS, KERNELS, DRIVERS and ATTRS.
$attr{file}, %s{file}
- The value of a sysfs attribute found at the device, where all keys of the rule have matched. If the matching device does not have such an attribute, follow the chain of parent devices and use the value of the first attribute that matches. If the attribute is a symlink, the last element of the symlink target is returned as the value.
$env{key}, %E{key}
- A device property value.
$major, %M
- The kernel major number for the device.
$minor, %m
- The kernel minor number for the device.
$result, %c
- The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: %c{N}. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: %c{N+}
$parent, %P
- The node name of the parent device.
$name
- The current name of the device node. If not changed by a rule, it is the name of the kernel device.
$links
- The current list of symlinks, separated by a space character. The value is only set if an earlier rule assigned a value, or during a remove events.
$root, %r
- The udev_root value.
$sys, %S
- The sysfs mount point.
$tempnode, %N
- The name of a created temporary device node to provide access to the device from a external program before the real node is created.
%%
- The '%' character itself.
$$
- The '$' character itself.
AUTHOR
Written by Greg Kroah-Hartman<EMAIL_ADDRESS>and Kay Sievers<EMAIL_ADDRESS>With much help from Dan Stekloff and many others.
SEE ALSO
Index
This document was created by man2html, using the manual pages.
Time: 05:34:16 GMT, December 24, 2015


Q-Learning Models
Models Implemented:#
- e-Greedy Q Learning (1)
- e-Greedy Q-Learning with e-decay (2)
- Deep Q-Network (DQN)(3)
Overview of Q-Learning#
All the models discussed in the coursework will use an online update policy strategy – an epsilon-greedy which intends to ensure adequate exploration of all the state space. Rummery and Niranjan (Rmmery et al., 1994) [9] provides an example of setting in which similar procedure are adopted. To exploit differences in the result of this self-driving helicopter simulation, we will compare three methods in which a different policy has been applied to select the best actions.
Q-learning uses temporal differences to estimate the value of Q(s,a). In Q-learning, the agent maintains a table of Q[S,A], where S is the set of states and A is the set of actions. Q[s,a] represents its current estimate of Q(s,a).
The Q-Learning variables are represented below:
- Q(s, a) = Q value of a given state and action
- a = Action
- s = State
- r = Reward
- R = Maximum reward for action a
Where Q-Learning can be represented by:
Q[s,a] ←Q[s,a] + α(r+ γmaxa' Q[s',a'] - Q[s,a])
Motivation for DQN#
Last year, Deep Q Networks (DQN) were brought to the attention of many researchers when Deepmind released a paper demonstrating the network's capability at playing Atari games.
The research featured in the Nature publication and showed that their implementation had overcome the issues that had typically been challenged when using a Neural Network as a function approximation for the Q values. Summarized in the table below, from the paper Playing Atari with Deep Reinforcement Learning (Deepmind, 2015) [16], the issue is discussed as well as the techniques that have been used to overcome these problems.
| Issues | Techniques |
|---|---|
| Stability Issues | Reward Clipping |
| Distribution of the data can change quickly | Error Clipping (Truncation) |
The issues outlined in the table were implemented and were shown to have a real impact on the capability of the approximation. The analysis indicated that normalizing the range of the reward to a finite range helped to support the issue of dealing with large Q-values and their respective gradients – one negative of this approach was that the model may find it harder to differentiate the difference between small and large rewards due to the normalization. The second technique that was introduced was error clipping into the model – this is a frequently used method to deal with the potential of exploding gradients. The pseudocode below is a high-level description of the methods that were implemented in the Deepmind paper and in our model.
Implementing the DQN#
The sequential nature of our problem means that it could potentially benefit from using a Recurrent Neural Network either as primary function approximator or as additional layers in the network, as in Mnih (Mnih et al., 2015) [15]. The original paper described that a Convolutional Neural Network (CNN) was used to “watch” the replays of the game. In our implementation of the Deep Q-Network, we used a CNN that outputs to a Long Short-Term Memory (LSTM) layer and then finally into a linear output layer providing the Q-Values from the model. The key distinction to the original paper was that an LSTM layer was used where it has been demonstrated in many papers previously that an RNN is accomplished at capturing temporal patterns in sequential data. Since the goal of Q-Learning is to learn good policies for sequential decision making it, therefore, seemed appropriate to include this layer type.
The implementation initially developed made use of similar/simpler architecture to that proposed in previous work. This architecture that was implemented consisted of an Embedding Layer, which mapped the integer values (state) to a one-dimensional vector which were then passed into a Convolutional layer, followed by a Max-Pooling layer and lastly into two Dense layers (one with a Relu activation and the last a Softmax function). The intention was to replace the Dense layers with Recurrent layers, however, throughout testing, it was found that stability and the time to experiment with varying factors meant that the desire to move to the potentially enhanced version could not be achieved within the time frame. One feature that was implemented was that the model could record and store instances of the transitions and experience replay. This idea was used in one the most successful use cases of Neural Networks in Reinforcement Learning; this model was called TD-Gammon.
The model was developed in Keras, a Deep Learning library for Python, the primary reason for this is that it provides a very easy layer of abstraction on top of Theano or Tensorflow.
The diagram below captures the architecture used for developing the model.
Expectations#
For both all of the Q-Learning variants it is expected that:
- the model will probably go back in forth between preferring different actions over others during the initialisation
- finding an appropriate learning rate and Gammma value for will be crucial
- ensuring that the terminal state can be reached otherwise not enough learning can be stimulated
- DQN learning models will be sufficiently more difficult to training
- tuning of both the model and q-learning parameters will be critical to ensure the model converges


233_jacnarj.py
class Solution:
def minOperations(self, target: List[int], arr: List[int]) -> int:
# answer is len(target) - len(lcs)
# keep track of: for each length, what's the shortest index you can end at [in target]
loc = {}
for i, x in enumerate(target):
loc[x] = i
# arr[i] contains the least index in target containing a subsequence of length i
lcs = [-1]
for x in arr:
if x in loc:
ind = bisect.bisect_left(lcs, loc[x])
if ind == len(lcs):
lcs.append(loc[x])
else:
lcs[ind] = loc[x]
return len(target) - len(lcs) + 1


TwilioErrorCode
public enum TwilioErrorCode: UInt
Twilio error codes. For a complete list look the Error Code Reference.
-
10001 - This account has been disabled and may not be used until it is reactivated.
Declaration
Swift
case AccountIsNotActive = 10001
-
10002 - Your account is currently in Trial mode and does not have access to this feature.
Declaration
Swift
case TrialAccountDoesNotSupportThisFeature = 10002
-
10003 - An incoming call was made to your application, but was not answered because your account was not active at the time.
Declaration
Swift
case IncomingCallRejectedDueToInactiveAccount = 10003
-
11100 - The format of the provided URL is invalid.
Declaration
Swift
case InvalidURLFormat = 11100
-
11200 - There was a failure attempting to retrieve the contents of this URL. An 11200 error is an indicator of a connection failure between Twilio and your service.
Declaration
Swift
case HTTPRetrievalFailure = 11200
-
11205 - There was a network failure attempting to connect to this URL
Declaration
Swift
case HTTPConnectionFailure = 11205
-
11206 - There was an error speaking HTTP to the target URL.
Declaration
Swift
case HTTPProtocolViolation = 11206
-
11210 - The DNS entry for the URL’s host cannot be resolved.
Declaration
Swift
case HTTPBadHostName = 11210
-
11215 - This request has been redirected too many times and may be in a loop.
Declaration
Swift
case HTTPTooManyRedirects = 11215
-
11220 - During SSL/TLS negotiation, Twilio experienced a connection reset.
Declaration
Swift
case SSL_TLSHandshakeError = 11220
-
11235 - Twilio tried to validate your SSL certificate but your certificate has a domain name that does not match the domain we requested.
Declaration
Swift
case CertificateInvalid_DomainMismatch = 11235
-
11236 - Twilio tried to validate your SSL certificate but your certificate has expired.
Declaration
Swift
case CertificateInvalid_Certificate_Expired = 11236
-
11237 - Twilio tried to validate your SSL certificate but was unable to find it in our certificate store.
Declaration
Swift
case CertificateInvalid_CouldNotFindPathToCertificate = 11237
-
11300 - The provided URL template has an invalid format. Please check to see if you have unclosed brackets.
Declaration
Swift
case InvalidTemplateURL = 11300
-
11310 - The provided URL template references a nonexistent token.
Declaration
Swift
case InvalidTemplateToken = 11310
-
20403 - The account lacks permission to access the Twilio API. Typically this means the account has been suspended or closed. For assistance, please contact a<EMAIL_ADDRESS>Declaration
Swift
case Forbidden = 20403
-
The resource was not found. Here are some examples of cases that may trigger a 404 error.
- Requesting a resource for a sid that does not exist, for example
GET /2010-04-01/Accounts/AC123/Calls/CA123
where CA123 is not a call sid that exists for your account
Trying to retrieve a resource that doesn’t exist, for example
GET /2010-04-01/Accounts/AC123/TwilioCalls/CA123
where the resource name is Calls, not TwilioCalls. Note that the API is case sensitive, so requestingcalls
instead ofCalls
will also return a 404.Missing a sid in the request path. For example, let’s say I accidentally don’t set a value for a call sid, using the PHP helper library:
$callSid = null; $client->account->calls->get($callSid);
This may turn intoGET /2010-04-01/Accounts/AC123/Calls/.json
because of the nonexistent sid, which may 404 your request or give you back a result you were not expecting. Or, you may initialize the client with an empty string for an account sid, which means the URL will get truncated in the middle (note the consecutive slashes):GET /2010-04-01/Accounts//Calls/CA123.json
Using a base URL that is not https://api.twilio.com. For example, making requests to https://twilio.com or https://www.twilio.com will not work.
Declaration
Swift
case NotFound = 20404
-
Your account is sending too many concurrent requests to the Twilio API. Please wait for a short period of time and make the request again, or alter your client’s settings to issue fewer concurrent requests to the Twilio API.
Twilio Support can provide advice for architecting your application to avoid 429 errors. For more information, contact support.
A 429 request is never processed and is always safe to retry.
Declaration
Swift
case TooManyRequests = 20429
-
The Twilio API encountered an error when processing your request. This generally indicates an error in the server handling logic or a timeout in the API. We apologize for the inconvenience.
If you are seeing a consistent pattern of 500 server errors coming from the Twilio API, check our status page for more details. If our status page has no information, contact support with details about the requests that are failing, and we will investigate.
GET and DELETE requests are always safe for you to retry as they are idempotent. Some POST requests are idempotent by nature - purchasing a specific phone number, or hanging up a call - and while these may return different HTTP status codes on each attempt, the end state of the system will be the same whether you make the request one time or ten.
Other POST requests - sending an SMS or triggering an outbound call - are not idempotent. If you get a 500 Server Error on these requests, and you retry the request, it is possible for a customer to receive multiple messages or calls from your application.
Declaration
Swift
case InternalServerError = 20500
-
Twilio will return this error code if a resource is currently unavailable. Please wait a few moments and then try the request again. We apologize for the inconvenience.
If you are seeing a consistent pattern of 503 server errors coming from the Twilio API, check our status page for more details. If our status page has no information, contact support with details about the requests that are failing, and we will investigate.
This error code indicates the request is safe to retry at a later time.
Declaration
Swift
case ServiceUnavailable = 20503


<relrow>
The <relrow>
element defines a row in the relationship table
(<reltable>
). It creates a relationship between the cells in the row,
which is expressed in output as links between the topics or resources referenced in those
cells.
Category: Basic map elements


Get the validation data.
Get the training data.
The format is simple. Distinct words are newline separated, and documents are
separated by two newlines. The validation data only has the words, but the training file
also has the true labels of 0 or 1, where 0 indicates the word is
not part of a
geo-string, and a 1 indicates the word
is part of a geo-string. Split the line on
whitespace and the right-most value will be the true label. (Example python code below.)
You need to upload a file with the same number of lines,
where each line is a number between 0 and 1 inclusive representing the probability
that word contains location information. Where the original file contains empty lines,
your uploaded file should
not contain a guess (either skip the line altogether,
or put an empty line in your uploaded file).
Below is a short example python script to load the data and make simple probability
guesses based off the number of times the word occurs in the training.txt file
as part of a location string. This is a good measure of baseline performance (~0.74 AUC),
but we can do much better (current best AUC is ~0.92). Your job is to replace this with
a real machine learning algorithm that performs better than the current best model.
with open('validation.txt', encoding='utf-8') as f:
s = f.read()
with open('training.txt', encoding='utf-8') as f:
training = f.read()
from collections import Counter
loc_words = Counter([' '.join(word.split(' ')[:-1]) for word in training.split('\n')
if word.split(' ')[-1] == '1'])
max_observed = float(max(loc_words.values()))
def guess(word):
return str(loc_words[word] / max_observed)
with open('guesses.txt', 'w') as f:
bytes_written = [f.write(guess(line) + '\n') for line in s.split('\n') if line]


QuickWiki
example-html
HTML Page!
You can also have different types of pages!
This one is made with HTML