Configuration for Meta Forms
Contribution Guidelines Edit | Report
Contents[hide] |
Scenario
An organization works in the domain of water conservation and works in multiple Indian states, with NGOs, village panchayats and other authorities. The organization would like to tailor different forms on Sunbird to match their requirements. They want to configure various available forms based on their terminology and needs. They intend to change the display labels, the fields, the types of fields etc. on the forms.
Prerequisites
As the organization administrator ensure the following: 1. Install the server instance of Sunbird. For details, refer to Server Installation
-
Create a channel for your organization (XYZ corporation). For details, refer to Channel APIs
-
Register your channel/ organization i.e, (XYZ corporation) with Ekstep. On registration, a unique Channel ID is assigned to your organization (XYZ corporation) channel ID is: 12300786
-
Create users for your organization (XYZ corporation) either by:
- onboarding XYZ corporation users in bulk, refer to Bulk upload service APIs, or
- creating the XYZ corporation users individually, refer to User APIs
Note:
An Organizational administrator requires to:
-
Use an API client (for example Postman) to make Form API calls and perform various operations as mentioned in the Task-flow section
-
Have the API Key for access and basic authentication
-
Have a User Token that authenticates the organization administrator for read-write access
-
Have access to Form APIs
Overview
The architecture of the Sunbird platform is logically divided into following main components.
-
Sunbird Editor(s)
-
Sunbird Portal
-
Sunbird Mobile etc.
Each of the component uses a metadata-driven development model to help the adopters to be more productive by allowing the flexibility to tailor these components based on their needs.The platform provides a mechanism where each of the forms in the components are configurable as they are metadata driven. This implies that the basic functionality of elements, such as, the forms, labels, fields, number of fields, types of fields etc. are defined as metadata in a database,instead of hard-coding them in a programming language. When any end user accesses a form on the portal or on mobile, it renders the metadata into the interface of user interface.
To alter the configuration of each of the available metadata driven forms, Sunbird provides a set of Form API endpoints. The administrator uses these APIs to programmatically manage, configure and customize each form.These APIs provide straightforward, powerful, and open ways to programmatically access the form data and provide the capabilities of configuring all the metadata available for forms.
List of Metadata driven Forms
The following table provides a detailed list of all the available metadata driven forms on the Sunbird platform:
Forms in Editor
| Form | Description | Type | Subtype | Action | Component | |
|---|---|---|---|---|---|---|
| Book Save | This form is displayed on clicking edit details in book editor |
content | textbook | save | editor | |
| Book Review | This form is displayed on clicking send for review in book editor |
content | textbook | review | editor | |
| Resource Save | This form is displayed on clicking edit details in content/generic editors |
content | resource | save | editor | |
| Resource Review | This form is displayed on clicking send for review in content/generic editors |
content | resource | review | editor | |
| Course Save | This form is displayed on clicking edit details in course editor |
content | course | save | editor | |
| Course Review | This form is displayed on clicking send for review in course editor |
content | course | review | editor | |
| Lesson Plan Save | This form is displayed on clicking edit details in lesson plan editor |
content | Lessonplan | save | editor | |
| Lesson Plan Review | This form is displayed on clicking send for review in lesson plan editor |
content | Lessonplan | review | editor | |
| Collection Save | This form is displayed on clicking edit details in collection editor |
content | collection | save | editor | |
| Collection Review | This form is displayed on clicking send for review in collection editor |
content | collection | review | editor | |
| Question Save | This form is displayed on clicking create question in content editor |
content | questions | question-meta-save | editor | |
| Question Search | This form is displayed on clicking search questions in content editor |
content | questions | question-filter-view | editor |
Supported Input & Data Types
The following table lists down the supported input types with corresponding data types in the Sunbird Editor component:
| Data Type | Input Type |
|---|---|
| Text | text, select, number |
| List | multiselect, conceptselector, keywordsuggestion, dialcode, topicselector |
| Url | file |
JSON Structure definitions
The following table lists down the sample JSON structure with descriptions for each form in the Sunbird Editor component:
| Property Name | Type | Description | Default Value | Example |
|---|---|---|---|---|
| code | string |
Unique identifier of the field on your form | NA | name, description etc. |
| dataType | string |
Format of data of the field on your form | NA | list ,text |
| description | string |
Description specific to a field on your form | NA | Title of the content |
| depends | array |
Describes the dependency in case if a field-A is dependent on field-B on your form | NA | depends: ["subject", "science"] |
| editable | boolean |
Defines the mode of the field i.e whether it can be read only or editable | true | true, false |
| index | integer |
Represents the location/ position of the field on your form | NA | 1 |
| inputType | string |
Defines the type of your form field | NA | text ,number , select ,multiselect ,conceptselector , topicselector , keywordsuggestion ,dialcode |
| label | string |
It is the display name of your field | NA | Title |
| name | string |
Name of the field | None | fieldSelect |
| placeholder | string |
Represents the placeholder for the field | NA | Enter Title For Book |
| range | array |
Represents the range of all the values specific to a particular field in a form | None | range: ['story','game','worksheet'] |
| renderingHints | object |
“renderingHints”: {“width”: “xx%”, maxlength: 00} | None | Ex: { maxlength : 100 } |
| required | boolean |
To make a field as mandatory | None | Ex: false |
| visible | boolean |
To make the field visible or hidden | None | Ex: true |
| validation | array |
Allows validation on any particular field of your form | None | Ex: [{ “type”: “regex”, “value”: “[A-Z]”,”message”: “Invalid Input” }] |
Forms in Portal
The following table lists down the available forms in Sunbird Portal component:
| Form | Description | Type | Subtype | Action | Component |
|---|---|---|---|---|---|
| Book Create | This form is displayed on clicking Book from your workspace |
content | textbook | create | portal |
| Course Create | This form is displayed on clicking Course from your workspace |
content | course | create | portal |
| Collection Create | This form is displayed on clicking Collection from your workspace |
content | collection | create | portal |
| Lesson Plan Create | This form is displayed on clicking Lesson Plan from your workspace |
content | lesson | review | editor |
| Resource create | This form is displayed on clicking Resource from your workspace |
content | course | save | editor |
| Library Filters | This form is displayed on clicking filters from your library |
content | library | search | portal |
| Course Filters | This form is displayed on clicking filters from your course |
content | course | search | portal |
| All My Contents Filters | This form is displayed on clicking filters option from any of the content types in your workspace |
content | allmycontent | search | portal |
| Up For Review Filters | This form is displayed on clicking Up For Review in the UP FOR REVIEW section in your workspace |
content | upforreview | search | portal |
| Explore Filters | This form is displayed on clicking filters in the explore page |
content | explore | search | portal |
| Resource Bundle Filters | This form is displayed on clicking language drop down in the explore Page |
content | resourcebundle | search | portal |
Supported Input & Data Types
The following table lists down the supported input types with corresponding data types in the Sunbird Portal component:
| Data Type | Input Type |
|---|---|
| Text | text, select, number |
| List | multiselect, conceptselector |
JSON Structure definitions
The following table lists down the example JSON structure with descriptions for each form in the Sunbird Portal component:
| Property Name | Type | Description | Default Value | Example |
|---|---|---|---|---|
| code | string |
Unique identifier of the field on your form | None | name, description etc. |
| dataType | string |
Format of data of the field on your form | None | list ,text |
| description | string |
Description specific to a field on your form | None | Title of the content |
| editable | boolean |
Defines the mode of the field i.e either you can keep your field as read only or make it editable | true | true, false |
| index | integer |
Location/ position of the field on your form | None | 1 |
| inputType | string |
Defines the type of your form field | None | text ,number , select ,multiselect ,conceptselector |
| label | string |
Display name of your field | None | Title |
| name | string |
Name of the field | None | Title |
| placeholder | string |
Placeholder for the field | None | Enter Title For Book |
| range | array |
Used to populate dropdown values | None | range: ['story','game','worksheet'] |
| renderingHints | object |
“renderingHints”: {“width”: “xx%”, maxlength: 00} | None | { semanticColumnWidth : three } |
| required | boolean |
To make a field a mandatory or optional | None | false |
| visible | boolean |
To make the field visible or hidden | None | true |
| validation | array |
Allows validation on a particular field of your form | None | [{ “type”: “regex”, “value”: “[A-Z]”,”message”: “Invalid Input” }] |
Forms in Mobile App
The following table lists down the available forms in Mobile app component:
| Form | Description | Type | Subtype | Action | Component |
|---|---|---|---|---|---|
| Onboarding Details | This form is used to save/update/read onboarding question details | user | instructor | onboarding | app |
| Force/Optional Upgrade | This form is used to save/update/read or force/optional app upgrade | app | install | upgrade | app |
Input & Data Types
The following table lists down the supported input types with corresponding data types in Mobile app component:
| Data Type | Input Type |
|---|---|
| String | text, number |
| List | fields, range |
| type | force, optional |
JSON Structure definitions
The following table lists down the example JSON structure with descriptions for each form in the Mobile app component:
| Property Name | Type | Description | Default Value | Example |
|---|---|---|---|---|
| templateName | string |
The default template used for the form | NA | defaultTemplate, defaultApp UpgradeTemplate |
| code | string |
Unique identifier of the field on the form | NA | upgrade, syllabus |
| name | string |
Name of the field on the form | NA | Upgrade of the app, What syllabus do you follow? |
| selectLabel | string |
Represents the display label for a field on the form | NA | Select Syllabus |
| loadingLabel | string |
Represents the display label for a field on the form | NA | Loading Syllabus |
| language | string |
Represents the display language of the field on a form | NA | en,hi,ta |
| range | list |
Represents the range of all the values specific to a particular field in a form | NA | “templateName”:”defaultTemplate”, “action”:”onboarding”, “fields”:[] |
| frameworkId | string |
Represents a framework uniquely | NA | ap_k-12,mh_k-12_15 |
| name | string |
Represents a range values within a field on a form | NA | State (Andhra Pradesh),State (Maharashtra) |
| minVersionCode | string |
Represents the minimum version of the app | NA | 0,9 |
| maxVersionCode | string |
Represents the maximum version of the app | NA | 10,15 |
| versionName | string |
Represents the name of version | NA | v1.0.1 |
| type | string |
Represents the type of the upgrade that is required | NA | optional, force |
All the available forms exist as a part of creation workflows, updation workflows, review workflows etc within the Sunbird. The primary usage of these forms is not just limited to adding meta information to the content, but metadata driven forms enable extensive searching capabilities, helps in onboarding in mobile app at the end user level and much more. Each form supports certain input data types to build on the metadata.
Note: Each of the form has a specific action associated to it, for example: create, update, save etc.
Task Flow
The form configuration is a post installation task. Being a Sunbird adopter, you can configure an existing form as well as create a new form.
Configure an Existing Form
Follow the steps to configure the forms available:
- Ensure that all the prerequisites are met
- Get access to Form APIResources
- Use an API client to perform the update form operation
- UseUpdate Form API to configure the metadata fields on a form, ensure that you provide valid inputs to the configuration parameters in the header, request payload while calling the API.
Configuration Parameters
The following are the header parameters for Update Form API endpoint:
- Authorization
- Content-Type
For more information about the usage of header parameters refer to the Update Form API reference document.
Sample payload for Update Form API
{ "request": { "type": "content", "subType": "resource", "action": "save", "rootOrgId": "*", "framework": "NCF", "data": { "templateName": "defaultTemplate", "action": "save", "fields": [ { "code": "appicon", "dataType": "url", "description": "App Icon", "editable": true, "index": 1, "inputType": "file", "label": "App Icon", "name": "App Icon", "placeholder": "App Icon", "renderingHints": {}, "required": false, "visible": true }, { "code": "name", "dataType": "text", "description": "Title of the content", "editable": true, "index": 2, "inputType": "text", "label": "Title", "name": "Title", "placeholder": "Enter Title For Book", "renderingHints": {}, "required": true, "visible": true }, { "code": "description", "dataType": "text", "description": "Brief description", "editable": true, "index": 3, "inputType": "textarea", "label": "Description", "name": "Description", "placeholder": "Brief description about the Book", "renderingHints": {}, "required": false, "visible": true }, { "code": "keywords", "dataType": "list", "description": "Keywords for the content", "editable": true, "index": 4, "inputType": "keywordsuggestion", "label": "keywords", "name": "Keywords", "placeholder": "Enter Keywords", "required": false, "visible": true }, { "code": "board", "dataType": "text", "description": "Curriculum", "editable": true, "index": 5, "inputType": "select", "label": "Curriculum", "name": "Curriculum", "placeholder": "Select Curriculum", "renderingHints": {}, "required": false, "visible": true }, { "code": "gradeLevel", "dataType": "list", "description": "Class", "editable": true, "index": 6, "inputType": "multiselect", "label": "Class", "name": "Class", "placeholder": "Select Class", "renderingHints": {}, "required": false, "visible": true }, { "code": "subject", "dataType": "text", "description": "", "editable": true, "index": 7, "inputType": "select", "label": "Subject", "name": "Subject", "placeholder": "Select Subject", "renderingHints": {}, "required": false, "visible": true }, { "code": "medium", "dataType": "text", "description": "", "editable": true, "index": 8, "inputType": "select", "label": "Medium", "name": "medium", "placeholder": "Select Medium", "renderingHints": {}, "required": false, "visible": true }, { "code": "concepts", "dataType": "list", "description": "Choose a concept", "editable": true, "index": 9, "inputType": "conceptselector", "label": "Concepts", "name": "Concepts", "placeholder": "Choose Concepts", "renderingHints": {}, "required": false, "visible": true }, { "code": "topic", "dataType": "list", "description": "Choose a Topics", "editable": true, "index": 10, "inputType": "topicselector", "label": "Topics", "name": "Topic", "placeholder": "Choose Topics", "renderingHints": {}, "required": false, "visible": true }, { "code": "resourceType", "dataType": "text", "description": "Resource Type", "editable": true, "index": 11, "inputType": "select", "label": "Resource Type", "name": "resourceType", "placeholder": "", "range": [ "Teach", "Practice", "Learn", "Test", "Play", "Read", "Experiment" ], "renderingHints": {}, "required": false, "visible": true }, { "code": "attributions", "dataType": "list", "description": "Attributions", "editable": true, "index": 12, "inputType": "text", "label": "Attributions", "name": "attribution", "placeholder": "", "renderingHints": {}, "required": false, "visible": true }, { "code": "audience", "dataType": "list", "description": "", "editable": true, "index": 13, "inputType": "select", "label": "Audience", "name": "Audience", "placeholder": "Select Audience", "renderingHints": {}, "range": [ "Learner", "Instructor" ], "required": false, "visible": true } ] } } }
Sample Payload for Read Form API
{ "request": { "type": "content", "subType": "resource", "action": "save", "rootOrgId": "*", "framework": "NCF" } }
Sample Payload for Create form API
{ "request": { "type": "content", "subType": "questions", "action": "question-filter-view", "rootOrgId": "*", "framework": "NCF", "data": { "action": "question-filter-view", "templateName": "filterMetaDataTemplate", "fields": [ { "code": "searchText", "dataType": "text", "description": " by question title", "editable": true, "inputType": "text", "label": "Search", "name": "Search", "index": 0, "placeholder": "Search by question title", "renderingHints": {}, "required": false, "visible": true }, { "code": "medium", "dataType": "text", "description": "", "editable": true, "index": 1, "inputType": "select", "label": "Language", "name": "medium", "placeholder": "Select Language", "renderingHints": {}, "required": false, "visible": true }, { "code": "level", "dataType": "text", "description": "Add Notes", "editable": true, "index": 2, "inputType": "select", "label": "Difficulty", "name": "level", "placeholder": "Select Level", "range": [ "EASY", "MEDIUM", "DIFFICULT" ], "renderingHints": {}, "required": false, "visible": true }, { "code": "questionType", "dataType": "list", "description": "Class", "editable": true, "index": 3, "inputType": "multiselect", "label": "Question Type", "name": "Question Type", "placeholder": "Question Type", "range": [ "Multiple Choice Questions", "Fill in the Blanks", "Match the Following" ], "renderingHints": {}, "required": false, "visible": true }, { "code": "gradeLevel", "dataType": "list", "description": "Class", "editable": true, "index": 4, "inputType": "multiselect", "label": "Grade Level", "name": "Class", "placeholder": "Select Class", "renderingHints": {}, "required": false, "visible": true }, { "code": "concepts", "dataType": "list", "description": "Choose a concept", "editable": true, "inputType": "conceptselector", "label": "Concepts", "name": "Concepts", "placeholder": "Choose Concepts", "renderingHints": {}, "required": false, "visible": true, "index": 5 }, { "code": "myQuestions", "dataType": "toggle", "description": "My Questions", "editable": true, "inputType": "checkbox", "label": "My Questions", "name": "My Questions", "placeholder": "My Questions", "renderingHints": {}, "required": false, "visible": true, "index": 6 } ] } } }
Concepts Covered
- Metadata driven forms
- List of available metadata driven forms
- Request payload for update metadata form


Bike Share
About Us
Sign up
User Login
Email address *
Name Error
Password *
Name Error
Submit
Connect to Facebook


go
by
qwertyoruiopz
&
pangu team
, for iOS 9.3.x
may take multiple tries, 64 bit only
tyvm NSO, sick 0day (at the time)


OpenSSL public/private key generation tools.
| author | Barry O'Donovan |
|---|---|
| author | The Skilled Team of PHP Developers at Open Solutions |
| category | OSS |
| package | OSS_Crypt |
| copyright | Copyright (c) 2007 - 2012, Open Source Solutions Limited, Dublin, Ireland |
| license | New BSD License |
exportCert() : string
Converts self signed certificate to string, and returns it.
\OSS_Crypt_Exception |
if $_cert is not generated. |
|---|
string
exportKeyPair(\boo $encrypt) : resource
Exports key pair which is actually private key which store public key information. If encrypt is set to true then export resource will be encrypted with $_passphrase else it will return the actual key without encryption. By default $encrypt is true.
\boo
The encrypt flag to encrypt or not the returning resource.
\OSS_Crypt_Exception |
if $_keypair is not generated, or if encryption required and $_passphrase is not unset. |
|---|
resource
of key pairexportPublicKey() : resource
Exports public key from $_keypair.
\OSS_Crypt_Exception |
if $_keypair is not generated. |
|---|
resource
of public keygenCertificate(array $dn, $options) : resource
| oaram | array|null $options Options for creating certificate |
|---|
array
Certificate information
resource
genKeyPair(array $options) : resource
Generates public and private key pair for encryption / decryption.
array
The generator options.
resource
of key pairgenSelfSignedCert(array $dn, int $days, array | null $options, int $serial) : resource
array
Certificate information
int
Days until certificate expires
array
null
Options for creating certificate
int
Serial number by default is 0
resource
of certificate.genSignedCert(array $dn, int $days, string $cacert, string $cakey, array | null $options, int $serial) : resource
array
Certificate information
int
Days until certificate expires
string
Encrypted issuer certifcate
string
Encrypted issuer private key
array
null
Options for creating certificate
int
Serial number by default is 0
resource
of certificate.parseCertificate(string $cert) : array
string
Encrypted certificate
array
setKeyPair(string $keypair) : resource
Sets key pair from key pair file content
string
The key pair file content
resource
of key pairsetPassphrase(string $passphrase) : void
Sets passphrase which will be used for key pair encryption.
string
The passphrase for key pair encryption
$_cert : resource
$_keypair : resource
$_passphrase : string


Your Ketarn dashboard
-
[[${project}]] View project
You don't take part at any project yet
Projects are hidden
-
[[${task.key}]] - [[${task.text}]] (project - [[${task.project}]])
Given by [[${task.authorName}]] on [[${task.createdOn}]]
Deadline: [[${task.deadline}]]
You don't have any tasks yet
Tasks are hidden
No notes yet
[[${LoggedUser.messages[i].text}]]
[[${LoggedUser.messages[i].text}]]
[[${LoggedUser.messages[i].text}]]
Accept task completion
Reject task completion
No messages in archive
[[${LoggedUser.readMessages[i].text}]]
[[${LoggedUser.messages[i].text}]]


Task Pool¶
We use task pool to limit the parallelism of asynchronous tasks. Generally, asynchronous io tasks is easy to hit a bottleneck of server. And connection pool usualy can only tell you that connection pool is full. So we need a task pool to limit the parallelism of asynchronous tasks so that server's io limit will not so easy to reach.
Kinds of task pool¶
Now there are 6 kinds of task pool:
worker number fixed task pool
AioFixedTaskPoolSimple
AioFixedTaskPoolLifo
AioFixedTaskPoolPriority
worker number auto scale task pool
AioAutoScaleTaskPoolSimple
AioAutoScaleTaskPoolLifo
AioAutoScaleTaskPoolPriority
How to use¶
All of them can use as asynchronous context manager.
async def test(name):
print(f"{name} start")
for i in range(5):
await asyncio.sleep(1)
result = f"{name} done"
print(result)
return "ok:"+ result
async def main():
async with AioFixedTaskPoolSimple() as task_pool:
print(f"test pool size {task_pool.size}")
print("test 4 task with pool size 3")
print("test await blocking submit")
r = await task_pool.submit(test, func_args=["e"])
assert r == "ok:e done"
print("test await blocking submit")
print("scale 3")
await task_pool.scale(3)
print(f"test pool size {task_pool.size}")
Task pools can also deal with a normal function, but it will be run in a concurrent.futures.Executor
def test(name):
print(f"{name} start")
for i in range(5):
time.sleep(1)
result = f"{name} done"
print(result)
return "ok:" + result
async def main():
executor = concurrent.futures.ProcessPoolExecutor()
async with AioFixedTaskPoolSimple(executor=executor) as task_pool:
async with AioFixedTaskPoolSimple() as task_pool:
print(f"test pool size {task_pool.size}")
print("test 4 task with pool size 3")
await asyncio.gather(
task_pool.submit(test, func_args=["c"]),
task_pool.submit(test, func_args=["b"]),
task_pool.submit(test, func_args=["a"]),
task_pool.submit(test, func_args=["d"])
)
Of course you can just use start
and close
to manage the task pool's Life Cycle.
async def main():
task_pool = AioFixedTaskPoolSimple()
await task_pool.start()
print(f"test pool size {task_pool.size}")
print("test 4 task with pool size 3")
print("test await blocking submit")
r = await task_pool.submit(test, func_args=["e"])
assert r == "ok:e done"
print("test await blocking submit")
print("scale 3")
await task_pool.scale(3)
print(f"test pool size {task_pool.size}")
await task_pool.close()
Oprations¶
There are only 3 Oprations:
submit
Submit a task to the task pool.result = await task_pool.submit(test, func_args=["e"])
If you use a Priority task pool, you can submit with a int param
weight
, the more small the more fast to be execut.result = await priority_task_pool.submit(test, func_args=["e"],weight=1)
scale
Scale the worker's number to increase/decrease the parallelism.number must be a int,if it's negative,task pool will decrease the parallelism.await task_pool.scale(-1)
pause
Pause/unpause the task pool to manange if user can submit task.You can usepaused
to check if you can submit tasks.await task_pool.pause() print(task_pool.paused)


In Tibetan cuisine, Xab Momo is a bun, usually baked or steamed, stuffed with beef or mutton.<ref name="LiJiang2003">{{cite book|last1=Li|first1=Tao|last2=Jiang|first2=Hongying|title=Tibetan customs|url=http://books.google.com/books?id=k5L0TQjLGgUC&pg=PA36|accessdate=5 August 2011|year=2003|publisher=五洲传播出版社|isbn=978-7-5085-0254-0|page=37}}</ref>
{{Reflist}}
{{Tibet-cuisine-stub}}


MARCH 17 St Patrick, Bishop
(305-361). Born in
Common
of Pastors (for
missionaries) or (for bishops)
COLLECT
O God, who chose
the Bishop Saint Patrick to preach your glory to the peoples of
In
countries where this celebration is a feast:
ENTRANCE ANTIPHON
Leave your country, your family and your fatherís house, for the land I will show you. I will make you a great nation; I will bless you and make your name so famous that it will be used as a blessing.
COLLECT
O God, who
chose the Bishop Saint Patrick to preach your glory to the peoples of
PRAYER OVER THE GIFTS
Rejoicing in the gift of faith, O Lord, we bring you these offerings; grant that, through the prayers and example of Saint Patrick, our lives may be united to Christ our Saviour in a holy sacrifice of praise. Through Christ our Lord.
Preface of Holy Men and Women I or
II
COMMUNION ANTIPHON
What I say to you in the darkness speak in the light, says the Lord, what you hear whispered, proclaim on the housetops.
PRAYER AFTER COMMUNION
Receiving,
almighty Father, the Body and Blood of your Son, we have known a foretaste of
the heavenly banquet; grant that, in communion with Saint Patrick and all our
forebears in faith, we may be true to your commandments on earth and so share
eternal joy in heaven. Through Christ our Lord.


Emergency access is a feature that is only available for LastPass Premium or LastPass Families users. With emergency access, you give someone you trust the ability to access your vault items in the event that you cannot. Learn more


RECV
Section: Linux Programmer's Manual (2)Updated: 2009-03-10
Index Return to Main Contents
NAME
recv, recvfrom, recvmsg - receive a message from a socketSYNOPSIS
#include <sys/types.h>
#include <sys/socket.h> ssize_t recv(int sockfd, void *buf, size_t len, int flags); ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen); ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
DESCRIPTION
The recvfrom() and recvmsg() calls are used to receive messages from a socket, and may be used to receive data on a socket whether or not it is connection-oriented.If src_addr is not NULL, and the underlying protocol provides the source address, this source address is filled in. When src_addr is NULL, nothing is filled in; in this case, addrlen is not used, and should also be NULL. The argument addrlen is a value-result argument, which the caller should initialize before the call to the size of the buffer associated with src_addr, and modified on return to indicate the actual size of the source address. The returned address is truncated if the buffer provided is too small; in this case, addrlen will return a value greater than was supplied to the call.
The recv() call is normally used only on a connected socket (see connect(2)) and is identical to recvfrom() with a NULL src_addr argument.
All three routines return the length of the message on successful completion. If a message is too long to fit in the supplied buffer, excess bytes may be discarded depending on the type of socket the message is received from.
If no messages are available at the socket, the receive calls wait for a message to arrive, unless the socket is non-blocking (see fcntl(2)), in which case the value -1 is returned and the external variable errno is set to EAGAIN or EWOULDBLOCK. The receive calls normally return any data available, up to the requested amount, rather than waiting for receipt of the full amount requested.
The select(2) or poll(2) call may be used to determine when more data arrives.
The flags argument to a recv() call is formed by OR'ing one or more of the following values:
- MSG_CMSG_CLOEXEC (recvmsg() only; since Linux 2.6.23)
- Set the close-on-exec flag for the file descriptor received via a Unix domain file descriptor using the SCM_RIGHTS operation (described in unix(7)). This flag is useful for the same reasons as the O_CLOEXEC flag of open(2).
- MSG_DONTWAIT (since Linux 2.2)
- Enables non-blocking operation; if the operation would block, the call fails with the error EAGAIN or EWOULDBLOCK (this can also be enabled using the O_NONBLOCK flag with the F_SETFL fcntl(2)).
- MSG_ERRQUEUE (since Linux 2.2)
- This flag specifies that queued errors should be received from the socket error queue. The error is passed in an ancillary message with a type dependent on the protocol (for IPv4 IP_RECVERR). The user should supply a buffer of sufficient size. See cmsg(3) and ip(7) for more information. The payload of the original packet that caused the error is passed as normal data via msg_iovec. The original destination address of the datagram that caused the error is supplied via msg_name.
-
For local errors, no address is passed (this can be checked with the
cmsg_len
member of the
cmsghdr).
For error receives, the
MSG_ERRQUEUE
is set in the
msghdr.
After an error has been passed, the pending socket error
is regenerated based on the next queued error and will be passed
on the next socket operation.
The error is supplied in a sock_extended_err structure:
#define SO_EE_ORIGIN_NONE 0 #define SO_EE_ORIGIN_LOCAL 1 #define SO_EE_ORIGIN_ICMP 2 #define SO_EE_ORIGIN_ICMP6 3 struct sock_extended_err { uint32_t ee_errno; /* error number */ uint8_t ee_origin; /* where the error originated */ uint8_t ee_type; /* type */ uint8_t ee_code; /* code */ uint8_t ee_pad; /* padding */ uint32_t ee_info; /* additional information */ uint32_t ee_data; /* other data */ /* More data may follow */ }; struct sockaddr *SO_EE_OFFENDER(struct sock_extended_err *);
- ee_errno contains the errno number of the queued error. ee_origin is the origin code of where the error originated. The other fields are protocol-specific. The macro SOCK_EE_OFFENDER returns a pointer to the address of the network object where the error originated from given a pointer to the ancillary message. If this address is not known, the sa_family member of the sockaddr contains AF_UNSPEC and the other fields of the sockaddr are undefined. The payload of the packet that caused the error is passed as normal data.
- For local errors, no address is passed (this can be checked with the cmsg_len member of the cmsghdr). For error receives, the MSG_ERRQUEUE is set in the msghdr. After an error has been passed, the pending socket error is regenerated based on the next queued error and will be passed on the next socket operation.
- MSG_OOB
- This flag requests receipt of out-of-band data that would not be received in the normal data stream. Some protocols place expedited data at the head of the normal data queue, and thus this flag cannot be used with such protocols.
- MSG_PEEK
- This flag causes the receive operation to return data from the beginning of the receive queue without removing that data from the queue. Thus, a subsequent receive call will return the same data.
- MSG_TRUNC (since Linux 2.2)
-
For raw
(AF_PACKET),
Internet datagram (since Linux 2.4.27/2.6.8),
and netlink (since Linux 2.6.22) sockets:
return the real length of the packet or datagram,
even when it was longer than the passed buffer.
Not implemented for Unix domain
sockets.
For use with Internet stream sockets, see tcp(7).
- MSG_WAITALL (since Linux 2.2)
- This flag requests that the operation block until the full request is satisfied. However, the call may still return less data than requested if a signal is caught, an error or disconnect occurs, or the next data to be received is of a different type than that returned.
The recvmsg() call uses a msghdr structure to minimize the number of directly supplied arguments. This structure is defined as follows in <sys/socket.h>:
struct iovec { /* Scatter/gather array items */ void *iov_base; /* Starting address */ size_t iov_len; /* Number of bytes to transfer */ }; struct msghdr { void *msg_name; /* optional address */ socklen_t msg_namelen; /* size of address */ struct iovec *msg_iov; /* scatter/gather array */ size_t msg_iovlen; /* # elements in msg_iov */ void *msg_control; /* ancillary data, see below */ socklen_t msg_controllen; /* ancillary data buffer len */ int msg_flags; /* flags on received message */ };
Here msg_name and msg_namelen specify the source address if the socket is unconnected; msg_name may be given as a null pointer if no names are desired or required. The fields msg_iov and msg_iovlen describe scatter-gather locations, as discussed in readv(2). The field msg_control, which has length msg_controllen, points to a buffer for other protocol control-related messages or miscellaneous ancillary data. When recvmsg() is called, msg_controllen should contain the length of the available buffer in msg_control; upon return from a successful call it will contain the length of the control message sequence.
The messages are of the form:
struct cmsghdr { socklen_t cmsg_len; /* data byte count, including hdr */ int cmsg_level; /* originating protocol */ int cmsg_type; /* protocol-specific type */ /* followed by unsigned char cmsg_data[]; */ };
Ancillary data should only be accessed by the macros defined in cmsg(3).
As an example, Linux uses this auxiliary data mechanism to pass extended errors, IP options or file descriptors over Unix sockets.
The msg_flags field in the msghdr is set on return of recvmsg(). It can contain several flags:
- MSG_EOR
- indicates end-of-record; the data returned completed a record (generally used with sockets of type SOCK_SEQPACKET).
- MSG_TRUNC
- indicates that the trailing portion of a datagram was discarded because the datagram was larger than the buffer supplied.
- MSG_CTRUNC
- indicates that some control data were discarded due to lack of space in the buffer for ancillary data.
- MSG_OOB
- is returned to indicate that expedited or out-of-band data were received.
- MSG_ERRQUEUE
- indicates that no data was received but an extended error from the socket error queue.
RETURN VALUE
These calls return the number of bytes received, or -1 if an error occurred. The return value will be 0 when the peer has performed an orderly shutdown.ERRORS
These are some standard errors generated by the socket layer. Additional errors may be generated and returned from the underlying protocol modules; see their manual pages.- EAGAIN or EWOULDBLOCK
- The socket is marked non-blocking and the receive operation would block, or a receive timeout had been set and the timeout expired before data was received. POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities.
- EBADF
- The argument sockfd is an invalid descriptor.
- ECONNREFUSED
- A remote host refused to allow the network connection (typically because it is not running the requested service).
- EFAULT
- The receive buffer pointer(s) point outside the process's address space.
- EINTR
- The receive was interrupted by delivery of a signal before any data were available; see signal(7).
- EINVAL
- Invalid argument passed.
- ENOMEM
- Could not allocate memory for recvmsg().
- ENOTCONN
- The socket is associated with a connection-oriented protocol and has not been connected (see connect(2) and accept(2)).
- ENOTSOCK
- The argument sockfd does not refer to a socket.
CONFORMING TO
4.4BSD (these function calls first appeared in 4.2BSD), POSIX.1-2001.POSIX.1-2001 only describes the MSG_OOB, MSG_PEEK, and MSG_WAITALL flags.
NOTES
The prototypes given above follow glibc2. The Single Unix Specification agrees, except that it has return values of type ssize_t (while 4.x BSD and libc4 and libc5 all have int). The flags argument is int in 4.x BSD, but unsigned int in libc4 and libc5. The len argument is int in 4.x BSD, but size_t in libc4 and libc5. The addrlen argument is int * in 4.x BSD, libc4 and libc5. The present socklen_t * was invented by POSIX. See also accept(2).According to POSIX.1-2001, the msg_controllen field of the msghdr structure should be typed as socklen_t, but glibc currently (2.4) types it as size_t.
EXAMPLE
An example of the use of recvfrom() is shown in getaddrinfo(3).SEE ALSO
fcntl(2), getsockopt(2), read(2), select(2), shutdown(2), socket(2), cmsg(3), sockatmark(3), socket(7)COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.
Index
This document was created by man2html, using the manual pages.
Time: 05:33:04 GMT, December 24, 2015


User Problem
A developer would like to configure an application or the application runtime deployed to Openshift.
Description
This project demonstrates application and runtime configuration leveraging external configuration sources. Alongside the basic means to set up a configmap and use with a specific runtime, this quickstart also demonstrates how changes to the configuration can be applied to services already deployed to openshift.
Resources Available


Testing calling of approve transaction to MetaMask wallet via HTML
Notes
Web3 object is injected via MetaMask and is unavailable if MetaMask Chrome/Firefox plugin is not installed or browser is in incognito mode
Not Tested on FireFox
References
https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#partly_sunny-web3---ethereum-browser-environment-check
https://github.com/MetaMask/faq/blob/master/detecting_metamask.md


UK based student developer with 2 years experience in game, and web development. Experience with libraries NodeJS, WebVR, HTML5 and languages Javascript, Python, and C++ with many projects completed.
Creator of game studio boomcrypt, and open source contributor - see more details about these projects on github and other projects above!


---
title: Chris February Playlist
author: Chris
short: Some disco inspired jams for your listening pleasure.
category: plus
comments: true
published: true
image: /images/chris_feb_playlist.jpg
---
Every month I try to put together a new playlist on Soundcloud to give you a sense of the kind of music that moves me. You can always find them on my profile page here. This month, Feb. 2016, I'm feeling the disco vibe like never before. I would also like to make this a small tribute to the recently deceased Maurice White, co-founder of the timeless seminal band Earth, Wind and Fire, one of my all-time favorite bands. RIP Maurice, and thank you for the band and the music that shaped my childhood.
My monthly playlists are living playlists so I will continually update them throughout the month with new songs that fit my fancy. You can also check out all of my older playlists on Soundcloud as well.


A tool which parses an OCaml module signature and automatically
generates property-testing code specialized to the interface, checking
if two modules implementing the interface are observationally
equivalent.
Mechanized Type Soundness Proofs for the Hindley-Milner Type
System
Mechanized type soundness proofs for the Hindley-Milner (or
“Damas-Milner”) type system using the locally
nameless representation in Coq, along with the LNGen & Ott metatheory tools.
The proofs are for the non-syntax-directed version of the HM type
system, as presented in Peyton
Jones et al. (2007).
Final project for CIS 6250
(Theory of Machine Learning)
Asymptotic Behavior of Cliques in Inhomogeneous W-random Graphs
Hladký et al. (2021)
proved a limit theorem for the no. of cliques in W-random graphs (an
inhomogeneous variant of Erdős-Rényi random graphs). In these slides, I
introduce the relevant background in graphon theory, provide a
high-level overview of Hladký et al.’s proofs & conduct numerical
simulations in Python verifying their results.
Proving Pólya’s Random Walk Theorem using Electric Network
Theory
In these slides, I discuss the applications of electric network
theory to random walks on integer lattices, focusing on Doyle
& Snell’s (1984) proof for Pólya’s Random Walk Theorem.
Slides for a talk I gave for CIS 6700 (Advanced
Topics in Programming Languages)
In these slides, I cover the Church & Scott encodings of various
datatypes in the untyped λ-calculus,
following the presentation in Pierce’s Types & Programming
Languages textbook.
Parsers in Haskell
Slides for a guest lecture for CIS 1940
(Introduction to Haskell)
In these slides, I cover monadic parser combinators (à la Parsec),
Haskell’s Applicative typeclass & testing parsers using
QuickCheck.
I also designed an assignment where students build a parser for
Lisp-style S-expressions using Applicative functors, and
test the correctness of their parser using round-trip properties in
QuickCheck.
A Unix-esque operating system implemented in C (~10k lines of
code)
I worked on the OS kernel, in particular implementing the scheduler
and handling signals/process statuses, as well as integrating the kernel
with the shell.


Toggle navigation
Home
Info
Erase the Stigma
What is Mental Illness?
Self Help
Meditation
The Void
For Parents
Get Help
Hotlines
Find a Therapist
Find a Therapist in Your Area
Please type the city or area code you would like to locate a therapist for


Last week, I reflected on Stereotype Threat and the DevBootcamp educational experience. This week, I’ll take it a step further and discuss how to fight stereotype threat and other nasties like the imposter syndrome.
A little bit about me - I pursued an engineering degree from a well respected educational institution. I had a number of classes where I was the only female in the room. None of my engineering classes even approached a 50⁄50 M-to-F ratio. I think I had one female engineering professor during my entire collegiate experience. That being said, I’m at a loss as to how to discuss negative stereotypes of women in technology, because I’ve never experienced them in any significant way in an academic environment. I have noticed it in other situations, just not in the strongly liberal world of higher education.
What I struggle with most, then, is not stereotype threat, it’s the Imposter Syndrome. My biggest fear, to date, is that after deciding to be a developer, I won’t be good at it. I have a critical inner voice saying “who do you think you are, to think you’re [good, smart, disciplined, etc.] enough to succeed at this”. And so this conversation is just as relevant for me as it is for those under the influence of stereotype threat.
How to Combat Stereotype Threat
Some lovely sciency people did some studies on this, and below is my take on what they came up with. They were fabulous about citing studies. I will not be. If you’re interested, check out the original article here. This is how you address stereotype threat:
- Create a detailed self-concept map (see mine below).
- When providing feedback, include assurance that the student is capable of meeting standards.
- Seek role models and mentors.
- Provide an (ideally external and temporary) explanation for anxiety that neither implicates the self nor validates the stereotype OR explain that the anxiety will improve performance.
- Awareness of what’s going on is often enough.
Self-Concept Map
Why make a self-concept map? How about becuase “women encouraged to think of themselves in terms of their valued and unique characteristics were less likely to experience stereotype threat in mathematics,” or becuase individuals encouraged “to consider themselves as complex and multi-faceted [reduces] vulnerability to stereotype threat.”
What do I value? It feels strange to put this on the internet - at the same time empowering and incredibly self-indulgent. I’m doing this for two reasons, to provide an example, and to define my values in a place that is easy to reference, in case I need a reminder.
For this project, I was given a (huge) list of values and asked wich ones apply when I am happiest or most satisfied with my life. I ended up grouping the values into categories, and my result is a good representation of where my interests lie. It’s not the prettiest thing. Maybe one day I’ll make a large and beautiful poster of “Self”, but today is not that day. Here’s what my values are, in approximate order of importance:
| Category | Values |
|---|---|
| Independence | Introspection, inner peace, stability, self-sufficiency, privacy, honesty, integrity, reputation, ambition, personal development, achievement, cleverness |
| Change | Movement, adaptability, decisiveness, coolness under fire |
| Optimism | Enthusiasm, excitement, vibrancy, inspiration, creativity, love, cooperation, playfulness |
| Engagement | Meaningful work, work I believe in, responsibility, commitment, competence, excellence |
| Connection | Mentorship, someone that believes in me, meaningful relationships, community, support network |
| Aesthetics | Pleasing environment, organization, efficiency, cleanliness, nice smells |
| Physicality | Physical challenge, physical contact with other humans |
| Spirituality | Oneness, belief in the good of humanity, faith, nature |
| Vulnerability | Openness, authenticity, song, dance, creative expression |
I would be really interested to see, if any of my cohort share one of these, what the similarities and differences are.
Feedback
Here’s what I learned about feedback:
“Constructive feedback appears most effective when it communicates high standards for performance but also assurances that the student is capable of meeting those high standards.” Also - “High standards and assurances of capability appear to signal that students will not be judged stereotypically and that their abilities and “belonging” are assumed rather than questioned.”
I plan to keep this in mind when giving feedback to others.
Role Models
“Their evidence suggests that providing even a single role model that challenges stereotypic assumptions can eliminate performance decrements under stereotype threat.” Even a single role model. Maybe one day I can be that person for someone else. For now, I really need to find some mentors of my own. Perhaps some of these inspiring women.
Alternate Explanations
“Several studies have shown that stereotype threat can be diminished by providing individuals with explanations regarding why anxiety and distraction are occurring that do not implicate the self or validate the stereotype.”
“Encouraging students to attribute struggle to an external, temporary cause eliminated typical gender differences in math performance.”
“Telling individuals under stereotype threat that their performance will not be hindered and might even be improved by the anxious feelings they might be experiencing eliminated the performance decrements associated with stereotype threat.”
Awareness
Finally, some research has examined the effects of blatantly identifying and disarming the anxiety that arises from stereotype threat. For example, “it’s important to keep in mind that if you are feeling anxious while taking this test, this anxiety could be the result of these negative stereotypes that are widely known in society and have nothing to do with your actual ability to do well on the test.” And that fixes the problem, how cool is that?!
Take Aways
If you internalize anything from reading this page, let it be that people have the power to effect real change in the lives of others. All you need is awareness, knowledge, and the desire to do so.


Preparation time
less than 30 mins
Cooking time
over 2 hours
Serves
Serves 6-8
Dietary
An autumnal take on the classic Australian pavlova, best served with a glass of good red wine. Quince is a difficult fruit to get hold of, but if you can find it, it makes a sublime addition.
For the meringue, preheat the oven to 140C/275F/Gas 1. Line a large baking tray with greaseproof paper.
Put the sugar and lemon juice into a large bowl. Add one egg white and whisk for a minute (the mixture will look hard, but don’t worry). Add another egg white and whisk for a few minutes, then add the remaining egg whites and whisk for 4–5 minutes or until the meringue is stiff and shiny.
Dollop the mixture in a 20cm/8in circle on the baking paper, making the sides slightly higher than the centre. Bake in the bottom of the oven for 1–1½ hours, or until the meringue is firm and crisp on the outside but still soft and ‘pillowy’ inside. If you can, wedge the oven door open a tiny bit with a damp tea towel; this allows the moisture to escape and dries out your meringue more quickly. You don’t want too much colour – it may begin to turn a very, very pale beige, but that is it. Once cooked, turn off the oven and leave the meringue inside until completely cool.
Meanwhile, put all the fruit filling ingredients, except the blackberries, in a medium saucepan set over a medium heat. You can throw the vanilla seeds and the pod into the mixture (or vanilla extract if using). Heat the liquid until just boiling, then reduce the heat to a poach. (A poach is when there is only one or two bubbles breaking the surface of the liquid.) Cook for about 15 minutes, or until the fruit is soft, but still has a bit of bite. Add the blackberries and remove the pan from the heat, leaving the fruit to cool in the liquid.
To make the cream filling, whip the cream, sugar and vanilla seeds in a large bowl. The cream is whipped enough when it just starts to hold its shape in the bowl and does not run when the bowl is tipped. It is best to be very slightly under whipped, as the cream will thicken when left to stand.
Drain the fruit through a sieve or colander (you can reserve the liquid if you like and warm it to drink as a hot toddy).
To assemble the pavlova, place the meringue onto a serving plate. Dollop the cream mixture all over it, leaving a 4cm/1½in border all the way around. Pile the drained fruit on top of the cream and serve.
You need JavaScript to view this clip.
Whipping cream by hand
You need JavaScript to view this clip.
Whisking egg whites


We're a team from the University of Waterloo that's competing in the Hyperloop Pod competition. Interested?


1 June 2004
As of 1 June 2004, the Ministry of Health, Burkina Faso has reported no new cases of yellow fever in Bobo-Dioulasso district (see previous report).
However, there is a high risk of a major urban outbreak of yellow fever in Bobo-Dioulasso in the immediate future. The rainy season is just beginning and the vector for yellow fever in an urban setting, Aedes aegypti, is already present in the district. Bobo-Dioulasso, with a population of 740 192, is densely populated and vaccination coverage against yellow fever is low. The district is also a busy crossroads for population movements across West Africa.
For these reasons, WHO strongly recommends a mass vaccination campaign in Bobo-Dioulasso as soon as possible.