import { reduceRight } from './array';
These functions faciliate building up new functions from smaller functions.
import { reduceRight } from './array';
partial
works by taking a function, “prefilling” the values of some number
of parameters, and returning a new function with those parameter values
filled. The returned function then takes in any remaining arguments when
invoked.
partial
is very easy to implement in ES2015 with rest parameters via the
spread operator. The newly created function is a closure that will remember
the args
that were intially supplied. It can then take in otherArgs
and
call the original function with the partially applied args
and newly
supplied otherArgs
via the spread operator.
const add = (x, y) => x + y;
const add1 = partial(add, 1);
add1(2); // 3
function partial(fn, ...args) {
return (...otherArgs) => fn(...args, ...otherArgs);
}
curry
offers a way to inject partial
functionality directly into a
function. A curried function will apply its argument when invoked until all
arguments have been supplied. If not all arguments are supplied, then the
curried function will return a new function with the previous arguments
“prefilled”.
Any number of arguments can be taken with each call. If a call happens to satisfy all formal parameters, then the function will actually be invoked.
const add = curry((x, y, z) => x + y + z);
// Call one argument at a time
add(1)(2)(3); // 3 calls to yield 6
// Same as:
const add1 = add(1);
const add3 = add1(2);
add3(3); // 6
// Other combinations:
add(1, 2)(3); // 2 calls to yield 6
add(1)(2, 3); // 2 calls to yield 6
add(1, 2, 3); // 1 call to yield 6
function curry(fn, len = fn.length) {
return (...args) => {
if (args.length >= len) {
return fn(...args);
}
return curry(
partial(fn, ...args),
len - args.length
);
};
}
Function composition allows functions to be combined to form new functions. Composition works by passing the output of one function as the input to the next function in a chain of functions.
The order of function calls is important. The last function supplied to a
compose
function will be the first function called when the new function
is actually invoked. Therefore, the function calls flow from right to left.
compose2
is the simple case where we take two functions to produce a new
function.
const double = (x) => x + x;
const square = (x) => x * x;
const doubleAndSquare = compose2(square, double);
doubleAndSquare(4); // 64
function compose2(f, g) {
return (...args) => f(g(...args));
}
The more general compose
function takes any number of functions to produce
a new composed function. We can treat the variadic number of function
parameters as an array and utilize the reduceRight
function to
successively call each original function.
Remember reduceRight
“reduces” or “folds over” an array to produce a new
value. In this case, we want to reduce to the final output and in a
right-to-left direction, so we call each function and use its return value
as the new memo
value.
The initial memo will be the arguments supplied to the composed function.
We capture those arguments in an array via the spread operator, so we make
sure to keep memo
as an array with each call inside reduceRight
. With
subsequent calls, memo
will only contain one element because a function
can only return one value. Therefore, we index into the result array with
index 0
for our final value.
function compose(...fns) {
return (...args) => {
const result = reduceRight((memo, fn) => {
return [fn(...memo)];
}, args, fns);
return result[0];
};
}
export { partial, curry, compose2, compose };


Call by address and type
Address
Address type
IP Address
Phone Number
Originating address and call properties
Setup audio only
Setup no video-out


Bachelor of Technology in Civil Engineering
National Institute of Technology, Srinagar
Automatic Traffic Volume Analysis and Classification System
Bachelor of Technology in Civil Engineering
National Institute of Technology, Srinagar
Impact of Road Surface Conditions on the PCU of vehicle categories
[Udemy]
[Udemy]
{{ repos.length }} repositories


- data - Variable in class org.sunflow.core.ParameterList.FloatParameter
-
- decode(short, Vector3) - Static method in class org.sunflow.math.Vector3
-
- decode(short) - Static method in class org.sunflow.math.Vector3
-
- DEFAULT_OPTIONS - Static variable in class org.sunflow.SunflowAPI
-
- determinant() - Method in class org.sunflow.math.Matrix4
-
Compute the matrix determinant.
- DiagonalBucketOrder - Class in org.sunflow.core.bucket
-
- DiagonalBucketOrder() - Constructor for class org.sunflow.core.bucket.DiagonalBucketOrder
-
- diffuse(Color) - Method in class org.sunflow.core.ShadingState
-
Computes a plain diffuse response to the current light samples and global
illumination.
- DiffuseShader - Class in org.sunflow.core.shader
-
- DiffuseShader() - Constructor for class org.sunflow.core.shader.DiffuseShader
-
- DirectionalSpotlight - Class in org.sunflow.core.light
-
- DirectionalSpotlight() - Constructor for class org.sunflow.core.light.DirectionalSpotlight
-
- Display - Interface in org.sunflow.core
-
Represents an image output device.
- distanceTo(Point3) - Method in class org.sunflow.math.Point3
-
- distanceTo(float, float, float) - Method in class org.sunflow.math.Point3
-
- distanceToSquared(Point3) - Method in class org.sunflow.math.Point3
-
- distanceToSquared(float, float, float) - Method in class org.sunflow.math.Point3
-
- div(Color) - Method in class org.sunflow.image.Color
-
- div(Color, Color) - Static method in class org.sunflow.image.Color
-
- div(Color, Color, Color) - Static method in class org.sunflow.image.Color
-
- div(float) - Method in class org.sunflow.math.Vector3
-
- div(float, Vector3) - Method in class org.sunflow.math.Vector3
-
- dot(Vector3) - Method in class org.sunflow.core.LightSample
-
Compute a dot product between the current shadow ray direction and the
specified vector.
- dot(Vector3) - Method in class org.sunflow.core.Ray
-
Computes the dot product of an arbitrary vector with the direction of the
ray.
- dot(float, float, float) - Method in class org.sunflow.core.Ray
-
Computes the dot product of an arbitrary vector with the direction of the
ray.
- dot(float, float, float) - Method in class org.sunflow.math.Vector3
-
- dot(Vector3, Vector3) - Static method in class org.sunflow.math.Vector3
-
- dx - Variable in class org.sunflow.core.Ray
-
- dy - Variable in class org.sunflow.core.Ray
-
- dz - Variable in class org.sunflow.core.Ray
-


The emails generated and still pending to be sent out populates the list of this page. This page contains all the emails that are awaiting to be sent out by the system. Once the emails are sent out, the particular email is no longer available on this page. At the end of each row, a user may see a checkbox which is ticked mark. This means that the emails will be sent out automatically on the stipulated date. However, do note that Microsite Reminder email are not ticked mark by default. A user needs to tick mark the checkbox if he wants the microsite reminder email to be sent. This module is also facilitated by Calendar function, meaning that a user can filter the Queued emails by date. Click on the Calendar button at the top right and select the desired month to filter the queued email according to the month. Also, take further note that each email that were generated can be edited individually only. * Click to enlarge
This page lists all the Queued emails that is created for the system.
The major columns that appear in the List Queued Emails page are
Email Send Date - Lists the date for the emails to be sent
Email Type - Lists the types of emails generated
Projects - Lists the Projects for which the email were generated
Offers - Lists the Offers for which the Emails were generated
Recipient's Email - Lists the Recipient's email addresses
CC Emails - Lists the CC emails if entered
Action - List the various actions available to the user. Each icon has been elaborated below
The eye icon is used to view the details of the Emails created. It gives a brief overview of the data(s) entered into the email.
The edit button is used to edit the Email individually. Same validation rules are applied while editing Email as that used while Adding Email Templates.
The delete button is used to delete an Email. Any Email can be deleted irrespective of the fact that they are being used in other modules. A user can also see a checkbox which is ticked mark by default except for that of Microsite Reminder email. This means that the email is going to be sent out on the specific date.
* Click to enlarge
Access Rights for particular user and their types for this module has been discussed below
An admin user can view/edit and delete all the Queued email generated in the system
A General User can only see the Queued email lists for the Projects that he/she is assigned to and for which the email is generated.
A Viewer does not have access to the above mentioned features.


--- status: "ready" title: "Table unstyled" text: "modifier ds-table--unstyled" ---
ds-table--unstyled


THIS IS NOT YET AN OFFICIAL MOCHIKIT COMPONENT
MochiKit.Text-ext - various text processing algorithms
TODO: ...
Various algorithms dealing with text/strings
Extends the existing MochiKit.Text namespace
TODO: ...
levenshteinDistance(s, t, allowTransposition=false):
Computes the Levenshtein distance [1] between two strings.
returns "distance" between the two strings. The larger the number, the bigger the difference.
Human friendly string comparator. Makes 'abc9' be sorted before 'abc123'. Not case sensitive (todo: add optional flag for this?).
Based on Michael Herf's strcmp4humans [2]
returns -1, 0, +1 (comparator)
| [1] | Levenshtein distance: http://en.wikipedia.org/wiki/Levenshtein_distance |
| [2] | Michael Herf's strcmp4humans: http://stereopsis.com/strcmp4humans.html |
Copyright 2005-2010 Bob Ippolito<EMAIL_ADDRESS>This program is dual-licensed free software; you can redistribute it and/or modify it under the terms of the MIT License or the Academic Free License v2.1.


Noisemaker
Wave
Sine
Saw
Square
Triangle
Tangent
Whistle
Breaker
White noise
Attack time
Decay time
Sustain time
Release time
Frequency
Limit
Tremolo frequency
Tremolo depth
Pitch
Jump 1 onset
Jump 1 amount
Jump 2 onset
Jump 2 amount
Bitcrush
Bitcrush sweep
Paste this in your resource loader:


--- title: Building this blog author: Luke McGuinness date: '2021-02-15' slug: building-this-blog categories: - css - html - R tags: [] excerpt: Put excerpt here math: no meta: yes draft: true ---
To being with, an admission - I really really love side-notes. The idea of having the relevant information right there, without the user having to jump up and down from footnotes makes so much sense to me.
For this reason, I was keen that my blog had
FOrtunately, a lot of the heavy lifting had been don
tuftesque
themeBuilt by Nick Strayer
Really awesome
See his introduction to the


Welcome to my Bootstrap 4 website tutorial! Bootstrap is a free and open source front-end library with HTML and CSS based designs.
Build the latest version of HTML, HTML5.
Build the latest version of Bootstrap, Bootstrap 4.
Build the latest version of CSS, CSS3.
The coloumns will automatically stack on the top of each other when the screen is less than 576px wide.
It can also display the web page differently depending on the screen size or viewing device.
Our Bootstrap institute was founded in 2014 with a mission to create skilled Web Developers for our country and the world. We are here to bridge the gap between the quality of skills demanded by industry and the quality of skills imparted by conventional institutes. We strive to increase student interest by providing hands on practical training on every concept taught in the classroom.


WONDER BOYS
Reviewed by Harvey Karten Paramount Pictures Director: Curtis Hanson Writer: Steven Kloves from Michael Chabon's novel Cast: Michael Douglas, Robert Downey Jr., Katie Holmes, Tobey Maguire, Frances McDormand
I'm a lifelong New Yorker, but only by the force of circumstance.  But I had other things in mind, at least from the time I began college studies in a small Massachusetts town. The campus looked exquisite in the winter, and just outside, the sidewalks featured traffic lights that pedestrians could actually control by pushing a button. Many of the teachers lived on a long, winding street called Professors' Row: this is where I would spend my career, pipe in mouth, leather patches on my sleeve, a golden Labrador Retriever to put me through my paces when I wasn't counseling students or grading papers or attending the many parties thrown by the deans and by colleagues. This was not to be, however, but now, decades later as I observe Grady Tripp (Michael Douglas) on the screen in virtually every scene for nearly two hours I realize that the pleasures and sorrows of life are not geographical but within. As sketched in a shaggy-dog novel by Michael Chabon, adapted for the screen by Steve Kloves and directed by Curtis Hanson ("L.A. Confidential"), Tripp is the college instructor who (for all we know) I could have become. Not the guy who is absolutely at ease with himself and his calling but one who gets himself into situations that evoke both humor and pathos, Tripp is a 50-ish guide to students in his advanced writing seminar whose mid-life crisis comes to a head on one agitated, winter weekend in Pittsburgh.
Tripp is observed in Chabon's reasonably short novel with dry humor and sly wit as a man who--like so many other writers (Tennessee Williams, Edward Albee, Arthur Miller, Norman Mailer)--is going downhill, though in his case his decline is not only a professional one. Having scored an award from PEN just seven years earlier, he has not published another work. As he is on the 2,000th-odd page of a humongous piece of fiction, another scribe on campus nicknamed Q (Rip Torn) has knocked out yet another book, as he has been doing regularly every 18 months. Why the writer's block? Something is happening psychologically to trip him up. He has regular fits, sometimes even falling on the floor in a faint. Marijuana is his crutch and when he pops codeine pills after being bitten around the ankle by a big blind dog, we suspect he uses them for other than medicinal purposes as well.
Hanson's film is not about the profession of writing, however, but about the relationships of a wonder boy, a guy who will prove that you're never too old to grow up. His epiphanies occur during a week that publishers are on campus to look at and perhaps buy some of the output of both faculty and students and, in fact, Tripp's own publisher, Terry Crabtree (Robert Downey Jr.) has joined him and has also met with a suicidal, compulsive liar who is in Tripp's class. The depressive student, James Teer, is played with awesome veracity by the highly talented Tobey Maguire ("The Cider House Rules"), this time as a young man who is the professor's most promising student and as the publisher's promising sexual attachment for the weekend.
"Wonder Boys," takes place during the time that its principal character is in a funk because his wife had just left him, a student with a crush (Hannah, played by Katie Holmes) is coming on to him, and he is looking to strengthen his bond with his mistress, Sara (Frances McDormand), who is the chancellor and the wife of the English chairman. Events which are to shake him out of his long-term funk occur in just a few days: 1) Young James has shot the English chairman's blind dog, allegedly to defend the professor who has been attacked by the big hound; 2) Sara has announced that she is pregnant from Tripp and is determined to make a decision about the baby within her; 3) James has stolen Marilyn Monroe's coat, which she had worn to her wedding with Joe D.
Some incidents are wacky, some are serious. The movie's most notable attribute is its pacing. Curtis Hanson, known for his ability to move around a multiplicity of characters in his "L.A. Confidential," refuses to appeal to a potentially broad audience. He keeps the plot moving along at his own lingering velocity, thereby avoiding making a Buston-Keaton style picture out of the zaniness. He hints at a possible affair between student Hannah and Tripp but keeps the two apart throughout. He has us wondering how Tripp's affiliation with Sara will turn out, given the humorlessness of Sara's husband who is Tripp's overseer.
All this is commendable. Unfortunately what should have been a story well told to an appreciative audience of indie- lovers who also adore their indies to be framed with a commercial-sized budget is simply murky, torpid, and confused. The chemistry between the chancellor and the professor is missing: we miss any feeling that something is at stake. Tripp's life has been on hold for so long that he appears to have lost real desire to make changes, to do something for himself that could alter his listlessness. Yet the film is cast with awe-inspiring faculty. Douglas, wonderful as the overly calm executive in "The Game" who is challenged by life-threatening risk; super as a the high- powered broker in "Wall Street" who knows that greed is good; is simply majestic this time in his first role with real comedic undertones. With long hair, scruffy beard, and overbearing glasses, he meanders through his role with absolute sincerity. He is a man with whom many others his age could identify. Tobey Maguire is the metaphoric young and bright depressive whose stories might make others in his class want to kill themselves and he too engages in activities on that fateful weekend that might make genuine corrections in his life. Robert Downey Jr. saves an otherwise lackadaisical film with his unique brand of wily, comic acting in a film that looks more like an notion than a well thought-out comedy-drama.
Rated R. Running Time: 112 minutes. (C) 2000 Harvey Karten<EMAIL_ADDRESS>The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


The Office of Innovation welcomes your input and participation. Please email<EMAIL_ADDRESS>to let us know your thoughts on how we can improve business districts throughout Jersey City. You can also sign up to receive periodic email updates here.
If you have any further questions, please reach out to the Office of Innovation Director, Brian Platt, at BPlatt@jcnj.org.


Several nuns have stories of abuse: Sister Lucy
Nun’s memoir, Karthavinte Namathil launched in Kochi
by Staff ReporterSeveral nuns harbour stories of abuse within them but for such instances to see the light of day, Kerala's society must be able to accept rather than punish or ostracise women who speak about such experiences, said Sr. Lucy Kalapura.
“When women speak about instances of abuse, society turns against them. They are asked to leave the nunnery and punished. They are even denied basic rights,” Sr. Lucy said, at the launch of her memoir, Karthavinte Namathil, in the city on Monday.
Sections of the book that point to the sexual abuse of and cruelty towards nuns sparked a severe backlash recently, with protesters demanding the book's ban.
‘Mental torture’ at the hands of authorities at a convent where she worked as a superior between 2000 and 2003 spurred her to write. The memoir stemmed from the records of her experience at the convent, Sr. Lucy said.
Accusations
The reaction to accusations of rape against Bishop Franco Mulakkal and the church’s backlash against the nuns who protested against him also provoked her to work on the memoir.
“The book is a contribution towards the message that no woman should have to face such experiences,” she said.
“It is not directed against a single person but against the suppression and male dominance that women are forced to endure in Kerala. We need a society that values and respects women, and our freedom and strength,” Sr. Lucy added.
She was expelled from the Franciscan Clarist Congregation earlier this year for protesting against Bishop Franco Mulakkal.
Writer Benyamin, who participated in the launch, wondered why an institution that is as powerful as the church was worried about a book.
“The fear comes from the fact that they have done wrong,” he said.
Besides the cruelty, the book traces Sr. Lucy's transformation into a nun, Mr. Benyamin said.


We have users!
- enhance front-end experiences
- incentivize dynamic convergence
- enhance virtual initiatives
- expedite customized methodologies
- exploit user-centric portals
- e-enable next-generation channels
- incubate innovative technologies
- monetize e-business infrastructures
- monetize enterprise deliverables
- grow frictionless users
- integrate best-of-breed e-markets
- reinvent back-end relationships
- implement world-class supply-chains


Include bootstrap.revolve.min.js in your document after bootstrap.
image-#.jpg
,frames
option is required.Activate Revolve without writing JavaScript. Set data-toggle="revolve"
on a controller element, like an anchor, along with a data-frames="#"
and href="[image-sequence-path]"
to open a specific revolve sequence in modal.
...
Attach bootstrap revolve to an elements with class .product with a single line of JavaScript:
$('.product').revolve(options);
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-frame=""
.
| Name | type | default | description |
|---|---|---|---|
| frames | int | 24 | Defines number of images in sequence. |
| template | string | - | Contains default bootstrap modal markup without modal-header and modal-footer . |
.revolve(options)
Activates your content with bootstrap revolve actions. Accepts an optional options object.
$('.product').revolve({ frames: 30 });
.revolve('show')
Manually opens a revolve modal.
$('.product').revolve('show');
All revolve events are fired at the anchor with bootstrap revolve attached (i.e. at the
).
| Event Type | Description |
|---|---|
| loaded.bs.revolve | This event is fired when revolve has pre-loaded all the images in sequence. |


Last summer I traveled to Berlin, Prague, and Budapest. I spent most of my time in hostels and meeting up with other travelers, but I spent two weeks staying with friends I knew from the US who were living abroad. I stayed with one friend in Berlin and also with a friend in Budapest who was doing her Masters at CEU.
This cartoonish building seems like a piece of experimental architecture from the 20th century, but it is in fact a hydraulics research center!
This incredible example of Gothic Architecture sits imposingly atop a hill within the Prague Castle complex, and is over a thousand years old
In person, the Parliament building of Budapest is an incredibly impressive sight. It sits on the bank of the Danube river, across from the old Castle. Tragically, it was the site of a bloody massacre in 1956 at an anti-communist demonstration.
| City | Favorite Things | Least Favorite Things |
|---|---|---|
| Berlin | Doner Kebab; Wild Nightclubs; Excellent Museums | Expensive Public Transit; Right Turns at Stoplights are Illegal |
| Prague | Abundant Music; Unique Architecture | Terrible Street Signage |
| Budapest | Impressive Architecture; Ruin Pubs | Scammers |


| Total Mined: AE | Total Hashrate: ~ M Sols/s (Hashrate trend) |
|---|
Last 20 Blocks mined
View All>>
| Block # | Miner | Min:Sec Ago | Status |
|---|
Top miners in last 24 hours
View All>>
blocks mined
| Pool | Hashrate | Reward | Update(UTC) |
|---|
| # | Miner | Blocks | Percentage |
|---|
Lastest 20 Transactions
View All>>
| TxHash | Amount | Sender | Receiver | TxType | Time(UTC) |
|---|
Top 20 miners in total
View All>>
| # | Miner | Blocks | Percentage | Reward |
|---|


{% extends "baselayout.html" %} {% load bootstrap3 %} {% block content %}
The personal information that you give for this questionnaire will only be used for the purposes of building, improving and doing research on BSL SignBank and will not be transferred to an organisation outside of UCL. The information will be treated as strictly confidential and handled in accordance with the provisions of GDPR and the UCL Records Retention Schedule (UCL Data Protection Registration Number Z6364106/2016/05/12). You can withdraw your account at any time by contacting us at bslsignbank@ucl.ac.uk.


Tags: nan
Style: Muralism
Artist: Rivera Diego
Title: Man at the Crossroads/Man, Controller of the Univers
Year: 1934
Genre: allegorical painting
Categories: picket_fence (13.5%); paintbrush (9.1%); butcher_shop (8.5%); totem_pole (8.5%); chime (5.2%)


Supreme Court upholds disqualification of Karnataka MLAs, but allows them to recontest
The then Speaker KR Ramesh Kumar had disqualified them ahead of a trust vote in July
The Supreme Court of India on November 13, upheld the disqualification of the Karnataka's 17 Members of Legislative Assembly (MLAs).
However, the apex court has cleared the way for the MLAs to recontest in the bypolls scheduled for December.
A three-judge bench comprising of Justices NV Ramana, Sanjiv Khanna and Krishna Murari had, on October 25, reserved its verdict on the petitions filed by 17 disqualified Karnataka MLAs.
These disqualified MLAs belong to the Indian National Congress (INC) and the Janata Dal (Secular). They had challenged the orders of the then Legislative Assembly Speaker KR Ramesh Kumar to disqualify them.
The then Speaker had disqualified them ahead of a trust vote in July. The coalition government led by then chief minister HD Kumaraswamy had resigned after losing the trust vote. This had paved the way for BS Yediyurappa-led Bharatiya Janata Party (BJP) to form the government.
The then Speaker had disqualified the MLAs till the end of the term of the Assembly, which is till 2023. This had meant that they would not have been able to contest the bypolls.
As many as 15 of the 17 seats that had fallen vacant after the MLAs were disqualified, will head for bypolls on December 5. The nomination papers for these bypolls are to be filed between November 11 and November 18. Many of these MLAs are hoping to recontest in the bypolls on a BJP ticket.
(This story will be updated when more details are available) Get access to India's fastest growing financial subscriptions service Moneycontrol Pro for as little as Rs 599 for first year. Use the code "GETPRO". Moneycontrol Pro offers you all the information you need for wealth creation including actionable investment ideas, independent research and insights & analysis For more information, check out the Moneycontrol website or mobile app.


Group actors into a prefab asset in the content browser. Drop them on to the scene and work on it as a single unit
Modify a prefab to have the changes automatically reflect on all the existing prefabs in the scene
Combine existing prefabs to build more complex prefabs
Extends the Unreal Editor to select the prefab as a single unit and allows smart selection of the items inside the prefabs (including nested prefabs)
Group similar prefabs together into a weighted Prefab Collection. This allows you to randomly select a prefab and add variation to your levels
Build complex Prefab randomizations with simpler prefab collections
Use Seed Linkers to enforce same random selection across multiple prefab instance (e.g. have all the fence prefabs in the scene select the same random fence from the collection)
Blueprint functions to randomize all the prefabs in the level
Spawn and randomize prefabs in standalone runtime builds using blueprints
Avoid framerate drops while spawning large nested prefabs or randomizing entire levels by building them asynchronously over multiple frames
Prefabricator is free and Open Source. It uses a permissive license (MIT) which allows you to use the code in your commerical projects
Prefabricator is actively supported on the Unreal Engine Forums and Discord chat channel


{% load i18n %} {% for review in suggested_reviews %}
{% trans 'Question' %}: {{quality_question.description}}


With the number of wildfires on the rise, it is becoming increasingly important to take measures to eliminate the man-made causes of wildfires. If we do not take these measures in a timely manner, the impacts of wildfires on our ecosystems could be devastating.


Uses of Class
org.apache.sysds.runtime.controlprogram.federated.FederationMap
-
-
Uses of FederationMap in org.apache.sysds.runtime.controlprogram.caching
Methods in org.apache.sysds.runtime.controlprogram.caching that return FederationMap Modifier and Type Method Description FederationMap
CacheableData. getFedMapping()
Gets the mapping of indices ranges to federated objects.Methods in org.apache.sysds.runtime.controlprogram.caching with parameters of type FederationMap Modifier and Type Method Description void
CacheableData. setFedMapping(FederationMap fedMapping)
Sets the mapping of indices ranges to federated objects. -
Uses of FederationMap in org.apache.sysds.runtime.controlprogram.federated
Methods in org.apache.sysds.runtime.controlprogram.federated that return FederationMap Modifier and Type Method Description FederationMap
FederationMap. bind(long rOffset, long cOffset, FederationMap that)
FederationMap
FederationMap. clone()
FederationMap
FederationMap. copyWithNewID()
Copy the federation map with the next available federated ID as reference to the federated data.FederationMap
FederationMap. copyWithNewID(long id)
Copy the federation map with the given ID as reference to the federated data.FederationMap
FederationMap. copyWithNewID(long id, long clen)
Copy the federation map with the given ID as reference to the federated data and with given clen as end dimension for the columns in the range.FederationMap
FederationMap. copyWithNewIDAndRange(int[][] ix, long outputID, FTypes.FType type)
FederationMap
FederationMap. copyWithNewIDAndRange(long rowRangeEnd, long colRangeEnd, long outputID)
Copy federated mapping while giving the federated data new IDs and setting the ranges from zero to row and column ends specified.FederationMap
FederationMap. copyWithNewIDAndRange(long rowRangeEnd, long colRangeEnd, long outputID, FTypes.FType type)
static FederationMap
FederationUtils. federateLocalData(CacheableData<?> data)
FederationMap
FederationMap. filter(IndexRange ixrange)
FederationMap
MatrixLineagePair. getFedMapping()
FederationMap
FederationMap. identCopy(long tid, long id)
FederationMap
FederationMap. mapParallel(long newVarID, BiFunction<FederatedRange,FederatedData,Void> mappingFunction)
Execute a function for eachFederatedRange
+FederatedData
pair mapping the pairs to their new form by directly changing bothFederatedRange
andFederatedData
.FederationMap
FederationMap. modifyFedRanges(long value, int dim)
Take the federated mapping and sets one dimension of all federated ranges to the specified value.FederationMap
FederationMap. transpose()
Methods in org.apache.sysds.runtime.controlprogram.federated with parameters of type FederationMap Modifier and Type Method Description static MatrixBlock
FederationUtils. aggMatrix(AggregateUnaryOperator aop, Future<FederatedResponse>[] ffr, Future<FederatedResponse>[] meanFfr, FederationMap map)
static MatrixBlock
FederationUtils. aggMatrix(AggregateUnaryOperator aop, Future<FederatedResponse>[] ffr, FederationMap map)
static MatrixBlock
FederationUtils. aggMean(Future<FederatedResponse>[] ffr, FederationMap map)
static MatrixBlock
FederationUtils. aggMinMaxIndex(Future<FederatedResponse>[] ffr, boolean isMin, FederationMap map)
static MatrixBlock
FederationUtils. aggProd(Future<FederatedResponse>[] ffr, FederationMap fedMap, AggregateUnaryOperator aop)
static ScalarObject
FederationUtils. aggScalar(AggregateUnaryOperator aop, Future<FederatedResponse>[] ffr, Future<FederatedResponse>[] meanFfr, FederationMap map)
static ScalarObject
FederationUtils. aggScalar(AggregateUnaryOperator aop, Future<FederatedResponse>[] ffr, FederationMap map)
static MatrixBlock
FederationUtils. aggVar(Future<FederatedResponse>[] ffr, Future<FederatedResponse>[] meanFfr, FederationMap map, boolean isRowAggregate, boolean isScalar)
FederationMap
FederationMap. bind(long rOffset, long cOffset, FederationMap that)
boolean
FederationMap. isAligned(FederationMap that, boolean transposed)
Determines if the two federation maps are aligned row/column partitions at the same federated sites (which allows for purely federated operation)boolean
FederationMap. isAligned(FederationMap that, boolean transposed, boolean equalRows, boolean equalCols)
determines if the two federated data are aligned row/column partitions (depending on parameters equalRows/equalCols) at the same federated site (which often allows for purely federated operations)boolean
FederationMap. isAligned(FederationMap that, FTypes.AlignType... alignTypes)
helper function for checking multiple allowed alignment types -
Uses of FederationMap in org.apache.sysds.runtime.instructions.fed
Methods in org.apache.sysds.runtime.instructions.fed with parameters of type FederationMap Modifier and Type Method Description static void
MultiReturnParameterizedBuiltinFEDInstruction. encodeFederatedFrames(FederationMap fedMapping, MultiColumnEncoder globalencoder, MatrixObject transformedMat)
-
Uses of FederationMap in org.apache.sysds.runtime.io
Methods in org.apache.sysds.runtime.io with parameters of type FederationMap Modifier and Type Method Description static void
ReaderWriterFederated. write(String file, FederationMap fedMap)
TODO add writing to each of the federated locations so that they also save their matrices.
-


Financial transactions are essentially about exchanging financial resources between accounts. Account numbers are financial addresses for financial transactions: they identify the source and the destination of the financial resources.
Problem Definition
- An important percentage of payments fail because the account number is not valid.
- Fraudsters can substitute account numbers. The payee cannot check the link between the account number and the beneficiary.
- Sanction screening is based on names, not necessarily on account numbers
Solution
- Using DNS to resolve Account Numbers, just like DNS is resolving URLs, to reach the account servicing bank.
- Exposing “GetAccountDetails” at the account servicing bank
- Controlling information access to protect privacy while providing a value add service
Value Proposition
Based on Web Standards and Web Infrastructure - Low investment - Collaborative - Innovation enabling


Leetcode Single Number (python)
12 June 2014
Requirement:
Given an array of integers, every element appears twice except for one. Find that single one.
Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Analysis:
Number exclusive or itself yields 0. 0 exclusive or other number x will yield x itself. Bit magic is linear without using extra memory.
Code:
1 class Solution:
2 # @param A, a list of integer
3 # @return an integer
4 def singleNumber(self, A):
5 result = None
6 for i in A:
7 if result is None:
8 result = i
9 else:
10 result ^= i
11 return result
blog comments powered by Disqus


The header file <elf.h> defines the format of ELF executable binary
files. Amongst these files are normal executable files, relocatable object
files, core files, and shared objects.
An executable file using the ELF file format consists of an ELF
header, followed by a program header table or a section header table, or
both. The ELF header is always at offset zero of the file. The program
header table and the section header table's offset in the file are defined
in the ELF header. The two tables describe the rest of the particularities
of the file.
This header file describes the above mentioned headers as C
structures and also includes structures for dynamic sections, relocation
sections and symbol tables.
The following types are used for N-bit architectures (N=32,64, ElfN
stands for Elf32 or Elf64, uintN_t stands for
uint32_t or uint64_t):
ElfN_Addr Unsigned program address, uintN_t
ElfN_Off Unsigned file offset, uintN_t
ElfN_Section Unsigned section index, uint16_t
ElfN_Versym Unsigned version symbol information, uint16_t
Elf_Byte unsigned char
ElfN_Half uint16_t
ElfN_Sword int32_t
ElfN_Word uint32_t
ElfN_Sxword int64_t
ElfN_Xword uint64_t
(Note: the *BSD terminology is a bit different. There,
Elf64_Half is twice as large as Elf32_Half, and
Elf64Quarter is used for uint16_t. In order to avoid confusion
these types are replaced by explicit ones in the below.)
All data structures that the file format defines follow the
"natural" size and alignment guidelines for the relevant class. If
necessary, data structures contain explicit padding to ensure 4-byte
alignment for 4-byte objects, to force structure sizes to a multiple of 4,
and so on.
The ELF header is described by the type Elf32_Ehdr or Elf64_Ehdr:
#define EI_NIDENT 16
typedef struct {
unsigned char e_ident[EI_NIDENT];
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
ElfN_Addr e_entry;
ElfN_Off e_phoff;
ElfN_Off e_shoff;
uint32_t e_flags;
uint16_t e_ehsize;
uint16_t e_phentsize;
uint16_t e_phnum;
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
} ElfN_Ehdr;
The fields have the following meanings:
- e_ident
- This array of bytes specifies how to interpret the file, independent of
the processor or the file's remaining contents. Within this array
everything is named by macros, which start with the prefix EI_ and
may contain values which start with the prefix ELF. The following
macros are defined:
- EI_MAG0
- The first byte of the magic number. It must be filled with ELFMAG0.
(0: 0x7f)
- EI_MAG1
- The second byte of the magic number. It must be filled with
ELFMAG1. (1: 'E')
- EI_MAG2
- The third byte of the magic number. It must be filled with ELFMAG2.
(2: 'L')
- EI_MAG3
- The fourth byte of the magic number. It must be filled with
ELFMAG3. (3: 'F')
- EI_CLASS
- The fifth byte identifies the architecture for this binary:
- ELFCLASSNONE
- This class is invalid.
- ELFCLASS32
- This defines the 32-bit architecture. It supports machines with files and
virtual address spaces up to 4 Gigabytes.
- ELFCLASS64
- This defines the 64-bit architecture.
- EI_DATA
- The sixth byte specifies the data encoding of the processor-specific data
in the file. Currently, these encodings are supported:
- ELFDATANONE
- Unknown data format.
- ELFDATA2LSB
- Two's complement, little-endian.
- ELFDATA2MSB
- Two's complement, big-endian.
- EI_VERSION
- The seventh byte is the version number of the ELF specification:
- EV_NONE
- Invalid version.
- EV_CURRENT
- Current version.
- EI_OSABI
- The eighth byte identifies the operating system and ABI to which the
object is targeted. Some fields in other ELF structures have flags and
values that have platform-specific meanings; the interpretation of those
fields is determined by the value of this byte. For example:
- ELFOSABI_NONE
- Same as ELFOSABI_SYSV
- ELFOSABI_SYSV
- UNIX System V ABI
- ELFOSABI_HPUX
- HP-UX ABI
- ELFOSABI_NETBSD
- NetBSD ABI
- ELFOSABI_LINUX
- Linux ABI
- ELFOSABI_SOLARIS
- Solaris ABI
- ELFOSABI_IRIX
- IRIX ABI
- ELFOSABI_FREEBSD
- FreeBSD ABI
- ELFOSABI_TRU64
- TRU64 UNIX ABI
- ELFOSABI_ARM
- ARM architecture ABI
- ELFOSABI_STANDALONE
- Stand-alone (embedded) ABI
- EI_ABIVERSION
- The ninth byte identifies the version of the ABI to which the object is
targeted. This field is used to distinguish among incompatible versions of
an ABI. The interpretation of this version number is dependent on the ABI
identified by the EI_OSABI field. Applications conforming to this
specification use the value 0.
- EI_PAD
- Start of padding. These bytes are reserved and set to zero. Programs which
read them should ignore them. The value for EI_PAD will change in
the future if currently unused bytes are given meanings.
- EI_NIDENT
- The size of the e_ident array.
- e_type
- This member of the structure identifies the object file type:
- ET_NONE
- An unknown type.
- ET_REL
- A relocatable file.
- ET_EXEC
- An executable file.
- ET_DYN
- A shared object.
- ET_CORE
- A core file.
- e_machine
- This member specifies the required architecture for an individual file.
For example:
- EM_NONE
- An unknown machine
- EM_M32
- AT&T WE 32100
- EM_SPARC
- Sun Microsystems SPARC
- EM_386
- Intel 80386
- EM_68K
- Motorola 68000
- EM_88K
- Motorola 88000
- EM_860
- Intel 80860
- EM_MIPS
- MIPS RS3000 (big-endian only)
- EM_PARISC
- HP/PA
- EM_SPARC32PLUS
- SPARC with enhanced instruction set
- EM_PPC
- PowerPC
- EM_PPC64
- PowerPC 64-bit
- EM_S390
- IBM S/390
- EM_ARM
- Advanced RISC Machines
- EM_SH
- Renesas SuperH
- EM_SPARCV9
- SPARC v9 64-bit
- EM_IA_64
- Intel Itanium
- EM_X86_64
- AMD x86-64
- EM_VAX
- DEC Vax
- e_version
- This member identifies the file version:
- EV_NONE
- Invalid version
- EV_CURRENT
- Current version
- e_entry
- This member gives the virtual address to which the system first transfers
control, thus starting the process. If the file has no associated entry
point, this member holds zero.
- e_phoff
- This member holds the program header table's file offset in bytes. If the
file has no program header table, this member holds zero.
- e_shoff
- This member holds the section header table's file offset in bytes. If the
file has no section header table, this member holds zero.
- e_flags
- This member holds processor-specific flags associated with the file. Flag
names take the form EF_`machine_flag'. Currently, no flags have been
defined.
- e_ehsize
- This member holds the ELF header's size in bytes.
- e_phentsize
- This member holds the size in bytes of one entry in the file's program
header table; all entries are the same size.
- e_phnum
- This member holds the number of entries in the program header table. Thus
the product of e_phentsize and e_phnum gives the table's
size in bytes. If a file has no program header, e_phnum holds the
value zero.
- If the number of entries in the program header table is larger than or
equal to PN_XNUM (0xffff), this member holds PN_XNUM
(0xffff) and the real number of entries in the program header table is
held in the sh_info member of the initial entry in section header
table. Otherwise, the sh_info member of the initial entry contains
the value zero.
- PN_XNUM
- This is defined as 0xffff, the largest number e_phnum can have,
specifying where the actual number of program headers is assigned.
- e_shentsize
- This member holds a sections header's size in bytes. A section header is
one entry in the section header table; all entries are the same size.
- e_shnum
- This member holds the number of entries in the section header table. Thus
the product of e_shentsize and e_shnum gives the section
header table's size in bytes. If a file has no section header table,
e_shnum holds the value of zero.
- If the number of entries in the section header table is larger than or
equal to SHN_LORESERVE (0xff00), e_shnum holds the value
zero and the real number of entries in the section header table is held in
the sh_size member of the initial entry in section header table.
Otherwise, the sh_size member of the initial entry in the section
header table holds the value zero.
- e_shstrndx
- This member holds the section header table index of the entry associated
with the section name string table. If the file has no section name string
table, this member holds the value SHN_UNDEF.
- If the index of section name string table section is larger than or equal
to SHN_LORESERVE (0xff00), this member holds SHN_XINDEX
(0xffff) and the real index of the section name string table section is
held in the sh_link member of the initial entry in section header
table. Otherwise, the sh_link member of the initial entry in
section header table contains the value zero.
An executable or shared object file's program header table is an array of
structures, each describing a segment or other information the system needs to
prepare the program for execution. An object file segment contains one
or more sections. Program headers are meaningful only for executable
and shared object files. A file specifies its own program header size with the
ELF header's e_phentsize and e_phnum members. The ELF program
header is described by the type Elf32_Phdr or Elf64_Phdr
depending on the architecture:
typedef struct {
uint32_t p_type;
Elf32_Off p_offset;
Elf32_Addr p_vaddr;
Elf32_Addr p_paddr;
uint32_t p_filesz;
uint32_t p_memsz;
uint32_t p_flags;
uint32_t p_align;
} Elf32_Phdr;
typedef struct {
uint32_t p_type;
uint32_t p_flags;
Elf64_Off p_offset;
Elf64_Addr p_vaddr;
Elf64_Addr p_paddr;
uint64_t p_filesz;
uint64_t p_memsz;
uint64_t p_align;
} Elf64_Phdr;
The main difference between the 32-bit and the 64-bit program
header lies in the location of the p_flags member in the total
struct.
- p_type
- This member of the structure indicates what kind of segment this array
element describes or how to interpret the array element's
information.
- PT_NULL
- The array element is unused and the other members' values are undefined.
This lets the program header have ignored entries.
- PT_LOAD
- The array element specifies a loadable segment, described by
p_filesz and p_memsz. The bytes from the file are mapped to
the beginning of the memory segment. If the segment's memory size
p_memsz is larger than the file size p_filesz, the
"extra" bytes are defined to hold the value 0 and to follow the
segment's initialized area. The file size may not be larger than the
memory size. Loadable segment entries in the program header table appear
in ascending order, sorted on the p_vaddr member.
- PT_DYNAMIC
- The array element specifies dynamic linking information.
- PT_INTERP
- The array element specifies the location and size of a null-terminated
pathname to invoke as an interpreter. This segment type is meaningful only
for executable files (though it may occur for shared objects). However it
may not occur more than once in a file. If it is present, it must precede
any loadable segment entry.
- PT_NOTE
- The array element specifies the location of notes (ElfN_Nhdr).
- PT_SHLIB
- This segment type is reserved but has unspecified semantics. Programs that
contain an array element of this type do not conform to the ABI.
- PT_PHDR
- The array element, if present, specifies the location and size of the
program header table itself, both in the file and in the memory image of
the program. This segment type may not occur more than once in a file.
Moreover, it may occur only if the program header table is part of the
memory image of the program. If it is present, it must precede any
loadable segment entry.
- PT_LOPROC, PT_HIPROC
- Values in the inclusive range [PT_LOPROC, PT_HIPROC] are
reserved for processor-specific semantics.
- PT_GNU_STACK
- GNU extension which is used by the Linux kernel to control the state of
the stack via the flags set in the p_flags member.
- p_offset
- This member holds the offset from the beginning of the file at which the
first byte of the segment resides.
- p_vaddr
- This member holds the virtual address at which the first byte of the
segment resides in memory.
- p_paddr
- On systems for which physical addressing is relevant, this member is
reserved for the segment's physical address. Under BSD this member is not
used and must be zero.
- p_filesz
- This member holds the number of bytes in the file image of the segment. It
may be zero.
- p_memsz
- This member holds the number of bytes in the memory image of the segment.
It may be zero.
- p_flags
- This member holds a bit mask of flags relevant to the segment:
- PF_X
- An executable segment.
- PF_W
- A writable segment.
- PF_R
- A readable segment.
- A text segment commonly has the flags PF_X and PF_R. A data
segment commonly has PF_W and PF_R.
- p_align
- This member holds the value to which the segments are aligned in memory
and in the file. Loadable process segments must have congruent values for
p_vaddr and p_offset, modulo the page size. Values of zero
and one mean no alignment is required. Otherwise, p_align should be
a positive, integral power of two, and p_vaddr should equal
p_offset, modulo p_align.
A file's section header table lets one locate all the file's sections. The
section header table is an array of Elf32_Shdr or Elf64_Shdr
structures. The ELF header's e_shoff member gives the byte offset from
the beginning of the file to the section header table. e_shnum holds
the number of entries the section header table contains. e_shentsize
holds the size in bytes of each entry.
A section header table index is a subscript into this array. Some
section header table indices are reserved: the initial entry and the indices
between SHN_LORESERVE and SHN_HIRESERVE. The initial entry is
used in ELF extensions for e_phnum, e_shnum and
e_shstrndx; in other cases, each field in the initial entry is set to
zero. An object file does not have sections for these special indices:
- SHN_UNDEF
- This value marks an undefined, missing, irrelevant, or otherwise
meaningless section reference.
- SHN_LORESERVE
- This value specifies the lower bound of the range of reserved
indices.
- SHN_LOPROC, SHN_HIPROC
- Values greater in the inclusive range [SHN_LOPROC,
SHN_HIPROC] are reserved for processor-specific semantics.
- SHN_ABS
- This value specifies the absolute value for the corresponding reference.
For example, a symbol defined relative to section number SHN_ABS
has an absolute value and is not affected by relocation.
- SHN_COMMON
- Symbols defined relative to this section are common symbols, such as
FORTRAN COMMON or unallocated C external variables.
- SHN_HIRESERVE
- This value specifies the upper bound of the range of reserved indices. The
system reserves indices between SHN_LORESERVE and
SHN_HIRESERVE, inclusive. The section header table does not contain
entries for the reserved indices.
The section header has the following structure:
typedef struct {
uint32_t sh_name;
uint32_t sh_type;
uint32_t sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
uint32_t sh_size;
uint32_t sh_link;
uint32_t sh_info;
uint32_t sh_addralign;
uint32_t sh_entsize;
} Elf32_Shdr;
typedef struct {
uint32_t sh_name;
uint32_t sh_type;
uint64_t sh_flags;
Elf64_Addr sh_addr;
Elf64_Off sh_offset;
uint64_t sh_size;
uint32_t sh_link;
uint32_t sh_info;
uint64_t sh_addralign;
uint64_t sh_entsize;
} Elf64_Shdr;
No real differences exist between the 32-bit and 64-bit section
headers.
- sh_name
- This member specifies the name of the section. Its value is an index into
the section header string table section, giving the location of a
null-terminated string.
- sh_type
- This member categorizes the section's contents and semantics.
- SHT_NULL
- This value marks the section header as inactive. It does not have an
associated section. Other members of the section header have undefined
values.
- SHT_PROGBITS
- This section holds information defined by the program, whose format and
meaning are determined solely by the program.
- SHT_SYMTAB
- This section holds a symbol table. Typically, SHT_SYMTAB provides
symbols for link editing, though it may also be used for dynamic linking.
As a complete symbol table, it may contain many symbols unnecessary for
dynamic linking. An object file can also contain a SHT_DYNSYM
section.
- SHT_STRTAB
- This section holds a string table. An object file may have multiple string
table sections.
- SHT_RELA
- This section holds relocation entries with explicit addends, such as type
Elf32_Rela for the 32-bit class of object files. An object may have
multiple relocation sections.
- SHT_HASH
- This section holds a symbol hash table. An object participating in dynamic
linking must contain a symbol hash table. An object file may have only one
hash table.
- SHT_DYNAMIC
- This section holds information for dynamic linking. An object file may
have only one dynamic section.
- SHT_NOTE
- This section holds notes (ElfN_Nhdr).
- SHT_NOBITS
- A section of this type occupies no space in the file but otherwise
resembles SHT_PROGBITS. Although this section contains no bytes,
the sh_offset member contains the conceptual file offset.
- SHT_REL
- This section holds relocation offsets without explicit addends, such as
type Elf32_Rel for the 32-bit class of object files. An object file
may have multiple relocation sections.
- SHT_SHLIB
- This section is reserved but has unspecified semantics.
- SHT_DYNSYM
- This section holds a minimal set of dynamic linking symbols. An object
file can also contain a SHT_SYMTAB section.
- SHT_LOPROC, SHT_HIPROC
- Values in the inclusive range [SHT_LOPROC, SHT_HIPROC] are
reserved for processor-specific semantics.
- SHT_LOUSER
- This value specifies the lower bound of the range of indices reserved for
application programs.
- SHT_HIUSER
- This value specifies the upper bound of the range of indices reserved for
application programs. Section types between SHT_LOUSER and
SHT_HIUSER may be used by the application, without conflicting with
current or future system-defined section types.
- sh_flags
- Sections support one-bit flags that describe miscellaneous attributes. If
a flag bit is set in sh_flags, the attribute is "on" for
the section. Otherwise, the attribute is "off" or does not
apply. Undefined attributes are set to zero.
- SHF_WRITE
- This section contains data that should be writable during process
execution.
- SHF_ALLOC
- This section occupies memory during process execution. Some control
sections do not reside in the memory image of an object file. This
attribute is off for those sections.
- SHF_EXECINSTR
- This section contains executable machine instructions.
- SHF_MASKPROC
- All bits included in this mask are reserved for processor-specific
semantics.
- sh_addr
- If this section appears in the memory image of a process, this member
holds the address at which the section's first byte should reside.
Otherwise, the member contains zero.
- sh_offset
- This member's value holds the byte offset from the beginning of the file
to the first byte in the section. One section type, SHT_NOBITS,
occupies no space in the file, and its sh_offset member locates the
conceptual placement in the file.
- sh_size
- This member holds the section's size in bytes. Unless the section type is
SHT_NOBITS, the section occupies sh_size bytes in the file.
A section of type SHT_NOBITS may have a nonzero size, but it
occupies no space in the file.
- sh_link
- This member holds a section header table index link, whose interpretation
depends on the section type.
- sh_info
- This member holds extra information, whose interpretation depends on the
section type.
- sh_addralign
- Some sections have address alignment constraints. If a section holds a
doubleword, the system must ensure doubleword alignment for the entire
section. That is, the value of sh_addr must be congruent to zero,
modulo the value of sh_addralign. Only zero and positive integral
powers of two are allowed. The value 0 or 1 means that the section has no
alignment constraints.
- sh_entsize
- Some sections hold a table of fixed-sized entries, such as a symbol table.
For such a section, this member gives the size in bytes for each entry.
This member contains zero if the section does not hold a table of
fixed-size entries.
Various sections hold program and control information:
- .bss
- This section holds uninitialized data that contributes to the program's
memory image. By definition, the system initializes the data with zeros
when the program begins to run. This section is of type SHT_NOBITS.
The attribute types are SHF_ALLOC and SHF_WRITE.
- .comment
- This section holds version control information. This section is of type
SHT_PROGBITS. No attribute types are used.
- .ctors
- This section holds initialized pointers to the C++ constructor functions.
This section is of type SHT_PROGBITS. The attribute types are
SHF_ALLOC and SHF_WRITE.
- .data
- This section holds initialized data that contribute to the program's
memory image. This section is of type SHT_PROGBITS. The attribute
types are SHF_ALLOC and SHF_WRITE.
- .data1
- This section holds initialized data that contribute to the program's
memory image. This section is of type SHT_PROGBITS. The attribute
types are SHF_ALLOC and SHF_WRITE.
- .debug
- This section holds information for symbolic debugging. The contents are
unspecified. This section is of type SHT_PROGBITS. No attribute
types are used.
- .dtors
- This section holds initialized pointers to the C++ destructor functions.
This section is of type SHT_PROGBITS. The attribute types are
SHF_ALLOC and SHF_WRITE.
- .dynamic
- This section holds dynamic linking information. The section's attributes
will include the SHF_ALLOC bit. Whether the SHF_WRITE bit is
set is processor-specific. This section is of type SHT_DYNAMIC. See
the attributes above.
- .dynstr
- This section holds strings needed for dynamic linking, most commonly the
strings that represent the names associated with symbol table entries.
This section is of type SHT_STRTAB. The attribute type used is
SHF_ALLOC.
- .dynsym
- This section holds the dynamic linking symbol table. This section is of
type SHT_DYNSYM. The attribute used is SHF_ALLOC.
- .fini
- This section holds executable instructions that contribute to the process
termination code. When a program exits normally the system arranges to
execute the code in this section. This section is of type
SHT_PROGBITS. The attributes used are SHF_ALLOC and
SHF_EXECINSTR.
- .gnu.version
- This section holds the version symbol table, an array of ElfN_Half
elements. This section is of type SHT_GNU_versym. The attribute
type used is SHF_ALLOC.
- .gnu.version_d
- This section holds the version symbol definitions, a table of
ElfN_Verdef structures. This section is of type
SHT_GNU_verdef. The attribute type used is SHF_ALLOC.
- .gnu.version_r
- This section holds the version symbol needed elements, a table of
ElfN_Verneed structures. This section is of type
SHT_GNU_versym. The attribute type used is SHF_ALLOC.
- .got
- This section holds the global offset table. This section is of type
SHT_PROGBITS. The attributes are processor-specific.
- .hash
- This section holds a symbol hash table. This section is of type
SHT_HASH. The attribute used is SHF_ALLOC.
- .init
- This section holds executable instructions that contribute to the process
initialization code. When a program starts to run the system arranges to
execute the code in this section before calling the main program entry
point. This section is of type SHT_PROGBITS. The attributes used
are SHF_ALLOC and SHF_EXECINSTR.
- .interp
- This section holds the pathname of a program interpreter. If the file has
a loadable segment that includes the section, the section's attributes
will include the SHF_ALLOC bit. Otherwise, that bit will be off.
This section is of type SHT_PROGBITS.
- .line
- This section holds line number information for symbolic debugging, which
describes the correspondence between the program source and the machine
code. The contents are unspecified. This section is of type
SHT_PROGBITS. No attribute types are used.
- .note
- This section holds various notes. This section is of type SHT_NOTE.
No attribute types are used.
- .note.ABI-tag
- This section is used to declare the expected run-time ABI of the ELF
image. It may include the operating system name and its run-time versions.
This section is of type SHT_NOTE. The only attribute used is
SHF_ALLOC.
- .note.gnu.build-id
- This section is used to hold an ID that uniquely identifies the contents
of the ELF image. Different files with the same build ID should contain
the same executable content. See the --build-id option to the GNU
linker (ld (1)) for more details. This section is of type
SHT_NOTE. The only attribute used is SHF_ALLOC.
- .note.GNU-stack
- This section is used in Linux object files for declaring stack attributes.
This section is of type SHT_PROGBITS. The only attribute used is
SHF_EXECINSTR. This indicates to the GNU linker that the object
file requires an executable stack.
- .note.openbsd.ident
- OpenBSD native executables usually contain this section to identify
themselves so the kernel can bypass any compatibility ELF binary emulation
tests when loading the file.
- .plt
- This section holds the procedure linkage table. This section is of type
SHT_PROGBITS. The attributes are processor-specific.
- .relNAME
- This section holds relocation information as described below. If the file
has a loadable segment that includes relocation, the section's attributes
will include the SHF_ALLOC bit. Otherwise, the bit will be off. By
convention, "NAME" is supplied by the section to which the
relocations apply. Thus a relocation section for .text normally
would have the name .rel.text. This section is of type
SHT_REL.
- .relaNAME
- This section holds relocation information as described below. If the file
has a loadable segment that includes relocation, the section's attributes
will include the SHF_ALLOC bit. Otherwise, the bit will be off. By
convention, "NAME" is supplied by the section to which the
relocations apply. Thus a relocation section for .text normally
would have the name .rela.text. This section is of type
SHT_RELA.
- .rodata
- This section holds read-only data that typically contributes to a
nonwritable segment in the process image. This section is of type
SHT_PROGBITS. The attribute used is SHF_ALLOC.
- .rodata1
- This section holds read-only data that typically contributes to a
nonwritable segment in the process image. This section is of type
SHT_PROGBITS. The attribute used is SHF_ALLOC.
- .shstrtab
- This section holds section names. This section is of type
SHT_STRTAB. No attribute types are used.
- .strtab
- This section holds strings, most commonly the strings that represent the
names associated with symbol table entries. If the file has a loadable
segment that includes the symbol string table, the section's attributes
will include the SHF_ALLOC bit. Otherwise, the bit will be off.
This section is of type SHT_STRTAB.
- .symtab
- This section holds a symbol table. If the file has a loadable segment that
includes the symbol table, the section's attributes will include the
SHF_ALLOC bit. Otherwise, the bit will be off. This section is of
type SHT_SYMTAB.
- .text
- This section holds the "text", or executable instructions, of a
program. This section is of type SHT_PROGBITS. The attributes used
are SHF_ALLOC and SHF_EXECINSTR.
String table sections hold null-terminated character sequences, commonly called
strings. The object file uses these strings to represent symbol and section
names. One references a string as an index into the string table section. The
first byte, which is index zero, is defined to hold a null byte ('\0').
Similarly, a string table's last byte is defined to hold a null byte, ensuring
null termination for all strings.
An object file's symbol table holds information needed to locate
and relocate a program's symbolic definitions and references. A symbol table
index is a subscript into this array.
typedef struct {
uint32_t st_name;
Elf32_Addr st_value;
uint32_t st_size;
unsigned char st_info;
unsigned char st_other;
uint16_t st_shndx;
} Elf32_Sym;
typedef struct {
uint32_t st_name;
unsigned char st_info;
unsigned char st_other;
uint16_t st_shndx;
Elf64_Addr st_value;
uint64_t st_size;
} Elf64_Sym;
The 32-bit and 64-bit versions have the same members, just in a
different order.
- st_name
- This member holds an index into the object file's symbol string table,
which holds character representations of the symbol names. If the value is
nonzero, it represents a string table index that gives the symbol name.
Otherwise, the symbol has no name.
- st_value
- This member gives the value of the associated symbol.
- st_size
- Many symbols have associated sizes. This member holds zero if the symbol
has no size or an unknown size.
- st_info
- This member specifies the symbol's type and binding attributes:
- STT_NOTYPE
- The symbol's type is not defined.
- STT_OBJECT
- The symbol is associated with a data object.
- STT_FUNC
- The symbol is associated with a function or other executable code.
- STT_SECTION
- The symbol is associated with a section. Symbol table entries of this type
exist primarily for relocation and normally have STB_LOCAL
bindings.
- STT_FILE
- By convention, the symbol's name gives the name of the source file
associated with the object file. A file symbol has STB_LOCAL
bindings, its section index is SHN_ABS, and it precedes the other
STB_LOCAL symbols of the file, if it is present.
- STT_LOPROC, STT_HIPROC
- Values in the inclusive range [STT_LOPROC, STT_HIPROC] are
reserved for processor-specific semantics.
- STB_LOCAL
- Local symbols are not visible outside the object file containing their
definition. Local symbols of the same name may exist in multiple files
without interfering with each other.
- STB_GLOBAL
- Global symbols are visible to all object files being combined. One file's
definition of a global symbol will satisfy another file's undefined
reference to the same symbol.
- STB_WEAK
- Weak symbols resemble global symbols, but their definitions have lower
precedence.
- STB_LOPROC, STB_HIPROC
- Values in the inclusive range [STB_LOPROC, STB_HIPROC] are
reserved for processor-specific semantics.
- There are macros for packing and unpacking the binding and type
fields:
- ELF32_ST_BIND(info),
ELF64_ST_BIND(info)
- Extract a binding from an st_info value.
- ELF32_ST_TYPE(info),
ELF64_ST_TYPE(info)
- Extract a type from an st_info value.
- ELF32_ST_INFO(bind, type),
ELF64_ST_INFO(bind, type)
- Convert a binding and a type into an st_info value.
- st_other
- This member defines the symbol visibility.
- STV_DEFAULT
- Default symbol visibility rules. Global and weak symbols are available to
other modules; references in the local module can be interposed by
definitions in other modules.
- STV_INTERNAL
- Processor-specific hidden class.
- STV_HIDDEN
- Symbol is unavailable to other modules; references in the local module
always resolve to the local symbol (i.e., the symbol can't be interposed
by definitions in other modules).
- STV_PROTECTED
- Symbol is available to other modules, but references in the local module
always resolve to the local symbol.
There are macros for extracting the visibility type:
ELF32_ST_VISIBILITY(other) or
ELF64_ST_VISIBILITY(other)
- st_shndx
- Every symbol table entry is "defined" in relation to some
section. This member holds the relevant section header table index.
Relocation is the process of connecting symbolic references with symbolic
definitions. Relocatable files must have information that describes how to
modify their section contents, thus allowing executable and shared object
files to hold the right information for a process's program image. Relocation
entries are these data.
Relocation structures that do not need an addend:
typedef struct {
Elf32_Addr r_offset;
uint32_t r_info;
} Elf32_Rel;
typedef struct {
Elf64_Addr r_offset;
uint64_t r_info;
} Elf64_Rel;
Relocation structures that need an addend:
typedef struct {
Elf32_Addr r_offset;
uint32_t r_info;
int32_t r_addend;
} Elf32_Rela;
typedef struct {
Elf64_Addr r_offset;
uint64_t r_info;
int64_t r_addend;
} Elf64_Rela;
- r_offset
- This member gives the location at which to apply the relocation action.
For a relocatable file, the value is the byte offset from the beginning of
the section to the storage unit affected by the relocation. For an
executable file or shared object, the value is the virtual address of the
storage unit affected by the relocation.
- r_info
- This member gives both the symbol table index with respect to which the
relocation must be made and the type of relocation to apply. Relocation
types are processor-specific. When the text refers to a relocation entry's
relocation type or symbol table index, it means the result of applying
ELF[32|64]_R_TYPE or ELF[32|64]_R_SYM, respectively, to the
entry's r_info member.
- r_addend
- This member specifies a constant addend used to compute the value to be
stored into the relocatable field.
The .dynamic section contains a series of structures that hold relevant
dynamic linking information. The d_tag member controls the
interpretation of d_un.
typedef struct {
Elf32_Sword d_tag;
union {
Elf32_Word d_val;
Elf32_Addr d_ptr;
} d_un;
} Elf32_Dyn;
extern Elf32_Dyn _DYNAMIC[];
typedef struct {
Elf64_Sxword d_tag;
union {
Elf64_Xword d_val;
Elf64_Addr d_ptr;
} d_un;
} Elf64_Dyn;
extern Elf64_Dyn _DYNAMIC[];
- d_tag
- This member may have any of the following values:
- DT_NULL
- Marks end of dynamic section
- DT_NEEDED
- String table offset to name of a needed library
- DT_PLTRELSZ
- Size in bytes of PLT relocation entries
- DT_PLTGOT
- Address of PLT and/or GOT
- DT_HASH
- Address of symbol hash table
- DT_STRTAB
- Address of string table
- DT_SYMTAB
- Address of symbol table
- DT_RELA
- Address of Rela relocation table
- DT_RELASZ
- Size in bytes of the Rela relocation table
- DT_RELAENT
- Size in bytes of a Rela relocation table entry
- DT_STRSZ
- Size in bytes of string table
- DT_SYMENT
- Size in bytes of a symbol table entry
- DT_INIT
- Address of the initialization function
- DT_FINI
- Address of the termination function
- DT_SONAME
- String table offset to name of shared object
- DT_RPATH
- String table offset to library search path (deprecated)
- DT_SYMBOLIC
- Alert linker to search this shared object before the executable for
symbols
- DT_REL
- Address of Rel relocation table
- DT_RELSZ
- Size in bytes of Rel relocation table
- DT_RELENT
- Size in bytes of a Rel table entry
- DT_PLTREL
- Type of relocation entry to which the PLT refers (Rela or Rel)
- DT_DEBUG
- Undefined use for debugging
- DT_TEXTREL
- Absence of this entry indicates that no relocation entries should apply to
a nonwritable segment
- DT_JMPREL
- Address of relocation entries associated solely with the PLT
- DT_BIND_NOW
- Instruct dynamic linker to process all relocations before transferring
control to the executable
- DT_RUNPATH
- String table offset to library search path
- DT_LOPROC, DT_HIPROC
- Values in the inclusive range [DT_LOPROC, DT_HIPROC] are
reserved for processor-specific semantics
- d_val
- This member represents integer values with various interpretations.
- d_ptr
- This member represents program virtual addresses. When interpreting these
addresses, the actual address should be computed based on the original
file value and memory base address. Files do not contain relocation
entries to fixup these addresses.
- _DYNAMIC
- Array containing all the dynamic structures in the .dynamic
section. This is automatically populated by the linker.
ELF notes allow for appending arbitrary information for the system to use. They
are largely used by core files (e_type of ET_CORE), but many
projects define their own set of extensions. For example, the GNU tool chain
uses ELF notes to pass information from the linker to the C library.
Note sections contain a series of notes (see the struct
definitions below). Each note is followed by the name field (whose length is
defined in n_namesz) and then by the descriptor field (whose length
is defined in n_descsz) and whose starting address has a 4 byte
alignment. Neither field is defined in the note struct due to their
arbitrary lengths.
An example for parsing out two consecutive notes should clarify
their layout in memory:
void *memory, *name, *desc;
Elf64_Nhdr *note, *next_note;
/* The buffer is pointing to the start of the section/segment */
note = memory;
/* If the name is defined, it follows the note */
name = note->n_namesz == 0 ? NULL : memory + sizeof(*note);
/* If the descriptor is defined, it follows the name
(with alignment) */
desc = note->n_descsz == 0 ? NULL :
memory + sizeof(*note) + ALIGN_UP(note->n_namesz, 4);
/* The next note follows both (with alignment) */
next_note = memory + sizeof(*note) +
ALIGN_UP(note->n_namesz, 4) +
ALIGN_UP(note->n_descsz, 4);
Keep in mind that the interpretation of n_type depends on
the namespace defined by the n_namesz field. If the n_namesz
field is not set (e.g., is 0), then there are two sets of notes: one for
core files and one for all other ELF types. If the namespace is unknown,
then tools will usually fallback to these sets of notes as well.
typedef struct {
Elf32_Word n_namesz;
Elf32_Word n_descsz;
Elf32_Word n_type;
} Elf32_Nhdr;
typedef struct {
Elf64_Word n_namesz;
Elf64_Word n_descsz;
Elf64_Word n_type;
} Elf64_Nhdr;
- n_namesz
- The length of the name field in bytes. The contents will immediately
follow this note in memory. The name is null terminated. For example, if
the name is "GNU", then n_namesz will be set to 4.
- n_descsz
- The length of the descriptor field in bytes. The contents will immediately
follow the name field in memory.
- n_type
- Depending on the value of the name field, this member may have any of the
following values:
- Core files (e_type = ET_CORE)
- Notes used by all core files. These are highly operating system or
architecture specific and often require close coordination with kernels, C
libraries, and debuggers. These are used when the namespace is the default
(i.e., n_namesz will be set to 0), or a fallback when the namespace
is unknown.
- NT_PRSTATUS
- prstatus struct
- NT_FPREGSET
- fpregset struct
- NT_PRPSINFO
- prpsinfo struct
- NT_PRXREG
- prxregset struct
- NT_TASKSTRUCT
- task structure
- NT_PLATFORM
- String from sysinfo(SI_PLATFORM)
- NT_AUXV
- auxv array
- NT_GWINDOWS
- gwindows struct
- NT_ASRS
- asrset struct
- NT_PSTATUS
- pstatus struct
- NT_PSINFO
- psinfo struct
- NT_PRCRED
- prcred struct
- NT_UTSNAME
- utsname struct
- NT_LWPSTATUS
- lwpstatus struct
- NT_LWPSINFO
- lwpinfo struct
- NT_PRFPXREG
- fprxregset struct
- NT_SIGINFO
- siginfo_t (size might increase over time)
- NT_FILE
- Contains information about mapped files
- NT_PRXFPREG
- user_fxsr_struct
- NT_PPC_VMX
- PowerPC Altivec/VMX registers
- NT_PPC_SPE
- PowerPC SPE/EVR registers
- NT_PPC_VSX
- PowerPC VSX registers
- NT_386_TLS
- i386 TLS slots (struct user_desc)
- NT_386_IOPERM
- x86 io permission bitmap (1=deny)
- NT_X86_XSTATE
- x86 extended state using xsave
- NT_S390_HIGH_GPRS
- s390 upper register halves
- NT_S390_TIMER
- s390 timer register
- NT_S390_TODCMP
- s390 time-of-day (TOD) clock comparator register
- NT_S390_TODPREG
- s390 time-of-day (TOD) programmable register
- NT_S390_CTRS
- s390 control registers
- NT_S390_PREFIX
- s390 prefix register
- NT_S390_LAST_BREAK
- s390 breaking event address
- NT_S390_SYSTEM_CALL
- s390 system call restart data
- NT_S390_TDB
- s390 transaction diagnostic block
- NT_ARM_VFP
- ARM VFP/NEON registers
- NT_ARM_TLS
- ARM TLS register
- NT_ARM_HW_BREAK
- ARM hardware breakpoint registers
- NT_ARM_HW_WATCH
- ARM hardware watchpoint registers
- NT_ARM_SYSTEM_CALL
- ARM system call number
- n_name = GNU
- Extensions used by the GNU tool chain.
- NT_GNU_ABI_TAG
- Operating system (OS) ABI information. The desc field will be 4
words:
- word 0: OS descriptor (ELF_NOTE_OS_LINUX, ELF_NOTE_OS_GNU,
and so on)`
- word 1: major version of the ABI
- word 2: minor version of the ABI
- word 3: subminor version of the ABI
- NT_GNU_HWCAP
- Synthetic hwcap information. The desc field begins with two words:
- word 0: number of entries
- word 1: bit mask of enabled entries
- Then follow variable-length entries, one byte followed by a
null-terminated hwcap name string. The byte gives the bit number to test
if enabled, (1U << bit) & bit mask.
- NT_GNU_BUILD_ID
- Unique build ID as generated by the GNU ld(1) --build-id
option. The desc consists of any nonzero number of bytes.
- NT_GNU_GOLD_VERSION
- The desc contains the GNU Gold linker version used.
- Default/unknown namespace (e_type != ET_CORE)
- These are used when the namespace is the default (i.e., n_namesz
will be set to 0), or a fallback when the namespace is unknown.
- NT_VERSION
- A version string of some sort.
- NT_ARCH
- Architecture information.
as(1), elfedit(1), gdb(1), ld(1), nm(1),
objdump(1), patchelf(1), readelf(1), size(1),
strings(1), strip(1), execve(2),
dl_iterate_phdr(3), core(5), ld.so(8)
Hewlett-Packard, Elf-64 Object File Format.
Santa Cruz Operation, System V Application Binary
Interface.
UNIX System Laboratories, "Object Files", Executable
and Linking Format (ELF).
Sun Microsystems, Linker and Libraries Guide.
AMD64 ABI Draft, System V Application Binary Interface AMD64
Architecture Processor Supplement.


常问问题¶
We’ve been collecting some commonly asked questions here. We’ll either be updating the guide directly, providing answers here, or both.
What Node versions does Feathers support¶
The latest version of Feathers and all plugins work with Node 6 and later. Node 6 will be supported until 2019-04-18 when the official support cycle ends.
The Feathers guides and applications
generated by the CLI (@feathersjs/cli
) use newer language features
like async/await
and require Node 8 or later.
How do I create custom methods?¶
One important thing to know about Feathers is that it only exposes the official api/services to clients. While you can add and use any service method on the server, it is not possible to expose those custom methods to clients.
Feathers is built around the REST architectural constraints and there are many good reasons for it. In general, almost anything that may require custom methods or RPC style actions can also be done either by creating a api/services or through api/hooks.
The benefits (like security, predictability, sending well defined real-time events) so far heavily outweighed the slight change in thinking required when conceptualizing your application logic.
Examples:
Send email action that does not store mail message in database.
Resources (services) don’t have to be database records. It can be any kind of resource (like the current weather for a city or creating an email which will send it). Sending emails is usually done with either a separate email api/services:
app.use('/email', {
create(data) {
return sendEmail(data);
}
})
Or in a api/hooks.
Place an order in e-commerce web site. Behind the scenes, there are many records will be inserted in one transaction: order_item, order_header, voucher_tracking etc.
This is what api/hooks are for. When creating a new order you also have a well defined hook chain:
app.service('orders').hooks({
before: {
create: [
validateData(),
checkStock(),
checkVoucher()
]
},
after: {
create: [
chargePayment(), // hook that calls `app.service('payment').create()`
sendEmail(), // hook that calls `app.service('email').create()`
updateStock() // Update product stock here
]
}
})
A
userService.resetPassword
method
This can also be implemented as a password service that resets the
password in the create
method:
const crypto = require('crypto');
class PasswordService {
create(data) {
const userId = data.user_id;
const userService = this.app.service('user');
return userService.patch(userId, {
passwordToken: crypto.randomBytes(48)
}).then(user => sendEmail(user))
}
setup(app) {
this.app = app;
}
}
How do I do nested or custom routes?¶
Normally we find that they actually aren’t needed and that it is much
better to keep your routes as flat as possible. For example something
like users/:userId/posts
is - although nice to read for humans -
actually not as easy to parse and process as the equivalent
:doc:/posts?userId=<userid>
that is already supported by Feathers out of the box <../api/databases/querying>. Additionally, this will also
work much better when using Feathers through websocket connections which
do not have a concept of routes at all.
However, nested routes for services can still be created by registering an existing service on the nested route and mapping the route parameter to a query parameter like this:
app.use('/posts', postService);
app.use('/users', userService);
// re-export the posts service on the /users/:userId/posts route
app.use('/users/:userId/posts', app.service('posts'));
// A hook that updates `data` with the route parameter
function mapUserIdToData(context) {
if(context.data && context.params.route.userId) {
context.data.userId = context.params.route.userId;
}
}
// For the new route, map the `:userId` route parameter to the query in a hook
app.service('users/:userId/posts').hooks({
before: {
find(context) {
context.params.query.userId = context.params.route.userId;
},
create: mapUserIdToData,
update: mapUserIdToData,
patch: mapUserIdToData
}
})
Now going to /users/123/posts
will call
postService.find({ query: { userId: 123 } })
and return all posts
for that user.
For more information about URL routing and parameters, refer to the Express chapter.
注解
URLs should never contain actions that change data (like
post/publish
or post/delete
). This has always been an
important part of the HTTP protocol and Feathers enforces this more
strictly than most other frameworks. For example to publish a post
you would call .patch(id, { published: true })
.
Can you support another database?¶
Feathers api/databases/adapters implement 90% of the functionality you may need to use Feathers with certain databases and ORMs. However, even if your favourite database or ORM is not on the list or the adapter does not support specific functionality you are looking for, Feathers can still accomodate all your needs by api/services.
重要
To use Feathers properly it is very important to understand how services work and that all existing database adapters are just services that talk to the database themselves.
The why and how to write your own services is covered in the basics guide. In the generator a custom service
can be created by running feathers generate service
, choosing “A
custom service” and then editing the
<servicename>/<servicename>.class.js
file to make the appropriate
database calls.
If you would like to publish your own database adapter, first make sure
there isn’t already a community maintained adapter
for that database (many maintainers are happy to get some help, too). If
not, you can run feathers generate plugin
to create a new plugin. A
reference implementation for a database adapter can be found in the
feathers-memory repository.
It is always possible for community maintained adapters to graduate into
an official Feathers adapter, at the moment there are however no plans
to add support for any new databases from the Feathers team directly.
I am not getting real-time events¶
Feathers Buzzard<EMAIL_ADDRESS>) introduced a new,
more secure event system that does not send real-time events by
default. If you are not getting real-time events on the client, it is
usually a problem with the api/channels setup.
Have a look a the example at feathersjs.com, the real-time basics guide and the channels documentation. If you are migrating from a previous version, also see the channels section in the migration guide.
The generated application already sets up a channels.js
file that
sends events to only authenticated users by default but can be modified
to your needs according the the channels documentation.
How do I do search?¶
This depends on the database adapter you are using. See the search querying chapter for more information.
Why am I not getting JSON errors?¶
If you get a plain text error and a 500 status code for errors that
should return different status codes, make sure you have the
express.errorHandler()
from the @feathersjs/express
module
configured as described in the Express errors chapter.
Why am I not getting the correct HTTP error code¶
See the above answer.
How can I do custom methods like findOrCreate
?¶
Custom functionality can almost always be mapped to an existing service
method using hooks. For example, findOrCreate
can be implemented as
a before-hook on the service’s get
method. See this gist for
an example of how to implement this in a before-hook.
Why are you using JWT for sessions¶
Feathers is using JSON web tokens (JWT) for its standard authentication mechanism. Some articles like Stop using JWT for sessions promotes using standard cookies and HTTP sessions. While it brings up some valid points, not all of them apply to Feathers and there are other good reasons why Feathers relies on JWT:
Feathers is designed to support many different transport mechanisms, most of which do not rely on HTTP but do work well with JWT as the authentication mechanism. This is even already the case for websockets where an established connection normally is not secured by a traditional HTTP session.
By default the only thing that Feathers stored in the JWT payload is the user id. It is a stateful token. You can change this and make the token stateless by putting more data into the JWT payload but this is at your discretion. Currently the user is looked up on every request after the JWT is verified to not be expired or tampered with.
You need to make sure that you revoke JWT tokens or set a low expiration date or add custom logic to verify that a user’s account is still valid/active. Currently the default expiration is 1 day. We chose a reasonable default for most apps but depending on your application this might be too long or too short.
Additionally, it is still possible to use Feathers with existing
traditional Express session mechanism by using custom Express middleware. For example, params.user
for all
service calls from a traditional Express session can be passed like
this:
app.use(function(req,res, next) {
// Set service call `param.user` from `session.user`
req.feathers.user = req.session.user;
});
How do I render templates?¶
Feathers works just like Express so it’s the exact same. We’ve created a helpful little guide right here. For protecting Express views with authentication, also see this guide.
OAuth is not setting the cookie¶
If you are authenticating via oAuth but your API and frontend reside on different domains the cookie used by the authentication client can not be set. Instead, a query string redirect has to be used as shown in this gist.
How do I create channels or rooms¶
In Feathers api/channels are the way to send api/events to only certain clients.
How do I do validation?¶
If your database/ORM supports a model or schema (ie. Mongoose or Sequelize) then you have 2 options.
The preferred way¶
You perform validation at the service level using hooks. This is better because it keeps your app database agnostic so you can easily swap databases without having to change your validations much.
If you write a bunch of small hooks that validate specific things it is easier to test and also slightly more performant because you can exit out of the validation chain early instead of having to go all the way to the point of inserting data into the database to find out if that data is invalid.
If you don’t have a model or schema then validating with hooks is currently your only option. If you come up with something different feel free to submit a PR!
The ORM way¶
With ORM adapters you can perform validation at the model level:
The nice thing about the model level validations is Feathers will return the validation errors to the client in a nice consistent format for you.
How do I do associations?¶
Similar to validation, it depends on if your database/ORM supports models or not.
The preferred way¶
For any of the feathers database/ORM adapters you can just use api/hooks to fetch data from other services.
This is a better approach because it keeps your application database
agnostic and service oriented. By referencing the services (using
app.service().find()
, etc.) you can still decouple your app and have
these services live on entirely separate machines or use entirely
different databases without having to change any of your fetching code.
We show how to associate data in a hook in the chat guide.
An alternative are the fastJoin
or populate
in feathers-hooks-common.
The ORM way¶
With mongoose you can use the $populate
query param to populate
nested documents.
// Find Hulk Hogan and include all the messages he sent
app.service('user').find({
query: {
name<EMAIL_ADDRESS>$populate: ['sentMessages']
}
});
With Sequelize you can do this:
// Find Hulk Hogan and include all the messages he sent
app.service('user').find({
name<EMAIL_ADDRESS>sequelize: {
include: [{
model: Message,
where: { sender: Sequelize.col('user.id') }
}]
}
});
Or set it in a hook as described here.
Sequelize models and associations¶
If you are using the Sequelize adapter, understanding SQL and Sequelize first is very important. See the associations section in the feathers-sequelize documentation for more information on how to associate models using the Sequelize Feathers adapter.
What about Koa/Hapi/X?¶
There are many other Node server frameworks out there like Koa, a “next generation web framework for Node.JS” using ES6 generator functions instead of Express middleware or HapiJS etc. Currently, Feathers is framework independent but only provides an api/express integration for HTTP APIs. More frameworks may be supported in the future with direct Node HTTP being the most likely.
How do I access the request object in hooks or services?¶
In short, you shouldn’t need to. If you look at the hooks chapter you’ll see all the params that are available on a hook.
If you still need something from the request object (for example, the
requesting IP address) you can simply tack it on to the req.feathers
object as described here or
:doc:socket.feathers
when using web sockets as described here <../api/socketio#appconfiguresocketiocallback>.
How do I mount sub apps?¶
It’s pretty much exactly the same as Express. More information can be found here.
How do I do some processing after sending the response to the user?¶
The hooks workflow allows you to handle these situations quite gracefully. It depends on the promise that you return in your hook. Here’s an example of a hook that sends an email, but doesn’t wait for a success message.
function (context) {
// Send an email by calling to the email service.
context.app.service('emails').create({
to<EMAIL_ADDRESS>body: 'You are so great!'
});
// Send a message to some logging service.
context.app.service('logging').create(context.data);
// Return a resolved promise to immediately move to the next hook
// and not wait for the two previous promises to resolve.
return Promise.resolve(context);
}
How do I debug my app¶
It’s really no different than debugging any other NodeJS app but you can refer to this blog post for more Feathers specific tips and tricks.
possible EventEmitter memory leak detected
warning¶
This warning is not as bad as it sounds. If you got it from Feathers you
most likely registered more than 64 services and/or event listeners on a
Socket. If you don’t think there are that many services or event
listeners you may have a memory leak. Otherwise you can increase the
number in the api/socketio via
io.sockets.setMaxListeners(number)
and with
api/primus via primus.setMaxListeners(number)
.
number
can be 0
for unlimited listeners or any other number of
how many listeners you’d expect in the worst case.
Why can’t I pass params
from the client?¶
When you make a call like:
const params = { foo: 'bar' };
client.service('users').patch(1, { admin: true }, params).then(result => {
// handle response
});
on the client the context.params
object will only be available in
your client side hooks. It will not be provided to the server. The
reason for this is because context.params
on the server usually
contains information that should be server-side only. This can be
database options, whether a request is authenticated, etc. If we passed
those directly from the client to the server this would be a big
security risk. Only the client side context.params.query
and
context.params.headers
objects are provided to the server.
If you need to pass info from the client to the server that is not part
of the query you need to add it to context.params.query
on the
client side and explicitly pull it out of context.params.query
on
the server side. This can be achieved like so:
// client side
client.hooks({
before: {
all: [
context => {
context.params.query.$client = {
platform: 'ios',
version: '1.0'
};
return context;
}
]
}
});
// server side, inside app.hooks.js
const hooks = require('feathers-hooks-common');
module.exports = {
before: {
all: [
// remove values from context.params.query.$client and move them to context.params
// so context.params.query.$client.version -> context.params.version
// and context.params.query.$client is removed.
hooks.client('version', 'platform')
]
}
}
My queries with null values aren’t working¶
When making a request using REST (HTTP) query string values don’t have
any type information and will always be strings. Some database adapters
that have a schema (like feathers-mongoose
or
feathers-sequelize
) will try to convert values to the correct type
but others (like feathers-mongodb
) can’t. Additionally, null
will always be a string and always has to be converted if you want to
query for null
. This can be done in a before
api/hooks:
app.service('myservice').hooks({
before: {
find(context) {
const { params: { query = {} } } = context;
if(query.phone === 'null') {
query.phone = null;
}
context.params.query = query;
return context;
}
}
});
Also see this issue.
注解
This issue does not happen when using websockets since it retains all type information.
Why are queries with arrays failing?¶
If you are using REST and queries with larger arrays (more than 21 items
to be exact) are failing you are probably running into an issue with the
querystring module which limits the size of arrays to 21 items by default. The
recommended solution is to implement a custom query string parser
function via app.set('query parser', parserFunction)
with the
arrayLimit
option set to a higher value:
var qs = require('qs');
app.set('query parser', function (str) {
return qs.parse(str, {
arrayLimit: 100
});
});
For more information see the Express application settings [@feathersjs/rest#88](https://github.com/feathersjs/feathers-rest/issues/88) and feathers-mongoose#205.
I always get a 404 for my custom middleware¶
Just like in Express itself, the order of middleware matters. If you
registered a custom middleware outside of the generator, you have to
make sure that it runs before the notFound()
error midlleware.
How do I get OAuth working across different domains¶
The standard Feathers oAuth setup sets the JWT in a cookie which can only be passed between the same domain. If your frontend is running on a different domain you will have to use query string redirects as outlined in this Gist.
My configuration isn’t loaded¶
If you are running or requiring the Feathers app from a different folder api/configuration needs to be instructed where the configuration files for the app are located. Since it uses node-config this can be done by setting the NODE_CONFIG_DIR envorinment variable.
How do I set up HTTPS?¶
Check out the Feathers Express HTTPS docs.
Is Feathers production ready?¶
Yes! It’s being used in production by a bunch of companies from startups to fortune 500s. For some more details see this answer on Quora.


--- notes: | An address lookup (sometimes called a ‘postcode lookup’) lets users specify a UK address by entering their postcode (and optionally their street name or number) and selecting their address from a list. **Advantages of address lookup** Using an address lookup means that: - people entering UK addresses don’t have to enter as much information manually - there’s less chance of mis-typed UK addresses **If you use an address lookup** When using an address lookup you should: - make it clear that the address lookup only works for UK addresses - provide a manual option for people with international addresses or addresses that are missing or badly formed in the Royal Mail database ---


{% load static %} Tonify In a certain mood? We'll generate a few songs that match it! Task Generate Playlist


Several apples were harmed during the making of this video
Slimbook Tease New Linux Laptop in Apple-Bashing Video
by By Joey SneddonFruitarians, apple fans, and the easily traumatised might not find the latest marketing campaign from Slimbook particularly funny.
The Spanish company is promoting an upcoming hardware launch with a bizarre new video campaign that involves bashing apple.
And in case you’re wondering, I don’t mean the video sees people criticising Apple™.
No, I’m talking literal apple bashing here!
The video, which should be embedded above, is relatively short and relatively bizarre. It follows a Slimbook engineer in a penguin mask carefully measuring an apple before getting up and smashing it with a baseball bat bearing the Slimbook brand name.
Accompanying the clip are the hashtags #NoMoreFruit and #ForgetTheFruit — a playful dig at a certain fruit-branded company whose laptops are fairly popular? I think so.
The video also reveals that Slimbook will announce its new device on November 21, 2019 via the Slimbook website.
But that’s all we know.
Specific details about the product are being revealed a daily basis on a holding page on the Slimbook website, and includes the relative graphics and CPU performance versus other Slimbook laptops, like the Slimbook Pro X.
Based on the information revealed thus far we can make a couple of qualified guesses.
The new device is a 15-inch laptop that’s 16mm thin and powered by an Intel Core-i7-9750H processor (up to 4.5Ghz, 6-core, 12 threads). It’ll boast Super RAID NvME and offer up to 12 hours of battery life.
But for details on RAM, GPU and ports you, I and everyone else, will have to wait until Thursday November 21 for the full reveal.