ZendOpenId\Consumer can be used to implement OpenID authentication for web sites.
From a web site developer’s point of view, the OpenID authentication process consists of three steps:
. Show OpenID authentication form
. Accept OpenID identity and pass it to the OpenID provider
. Verify response from the OpenID provider
The OpenID authentication protocol actually requires more steps, but many of them are encapsulated inside ZendOpenId\Consumer and are therefore transparent to the developer.
The end user initiates the OpenID authentication process by submitting his or her identification credentials with the appropriate form. The following example shows a simple form that accepts an OpenID identifier. Note that the example only demonstrates a login.
The Simple OpenID Login form
1 2 3 4 5 6 |
<form method="post" action="example-1_2.php"><fieldset>
<legend>OpenID Login</legend>
<input type="text" name="openid_identifier">
<input type="submit" name="openid_action" value="login">
</fieldset></form>
|
This form passes the OpenID identity on submission to the following PHP script that performs the second step of authentication. The PHP script need only call the ZendOpenId\Consumer::login() method in this step. The first argument of this method is an accepted OpenID identity, and the second is the URL of a script that handles the third and last step of authentication.
The Authentication Request Handler
1 2 3 4 | $consumer = new ZendOpenId\Consumer();
if (!$consumer->login($_POST['openid_identifier'], 'example-1_3.php')) {
die("OpenID login failed.");
}
|
The ZendOpenId\Consumer::login() method performs discovery on a given identifier, and, if successful, obtains the address of the identity provider and its local identifier. It then creates an association to the given provider so that both the site and provider share a secret that is used to sign the subsequent messages. Finally, it passes an authentication request to the provider. This request redirects the end user’s web browser to an OpenID server site, where the user can continue the authentication process.
An OpenID provider usually asks users for their password (if they weren’t previously logged-in), whether the user trusts this site and what information may be returned to the site. These interactions are not visible to the OpenID consumer, so it can not obtain the user’s password or other information that the user did not has not directed the OpenID provider to share with it.
On success, ZendOpenId\Consumer::login() does not return, instead performing an HTTP redirection. However, if there is an error it may return FALSE. Errors may occur due to an invalid identity, unresponsive provider, communication error, etc.
The third step of authentication is initiated by the response from the OpenID provider, after it has authenticated the user’s password. This response is passed indirectly, as an HTTP redirection using the end user’s web browser. The consumer must now simply check that this response is valid.
The Authentication Response Verifier
1 2 3 4 5 6 | $consumer = new ZendOpenId\Consumer();
if ($consumer->verify($_GET, $id)) {
echo "VALID " . htmlspecialchars($id);
} else {
echo "INVALID " . htmlspecialchars($id);
}
|
This check is performed using the ZendOpenId\Consumer::verify method, which takes an array of the HTTP request’s arguments and checks that this response is properly signed by the OpenID provider. It may assign the claimed OpenID identity that was entered by end user in the first step using a second, optional argument.
The following example combines all three steps in one script. It doesn’t provide any new functionality. The advantage of using just one script is that the developer need not specify URL‘s for a script to handle the next step. By default, all steps use the same URL. However, the script now includes some dispatch code to execute the appropriate code for each step of authentication.
The Complete OpenID Login Script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <?php
$status = "";
if (isset($_POST['openid_action']) &&
$_POST['openid_action'] == "login" &&
!empty($_POST['openid_identifier'])) {
$consumer = new ZendOpenId\Consumer();
if (!$consumer->login($_POST['openid_identifier'])) {
$status = "OpenID login failed.";
}
} else if (isset($_GET['openid_mode'])) {
if ($_GET['openid_mode'] == "id_res") {
$consumer = new ZendOpenId\Consumer();
if ($consumer->verify($_GET, $id)) {
$status = "VALID " . htmlspecialchars($id);
} else {
$status = "INVALID " . htmlspecialchars($id);
}
} else if ($_GET['openid_mode'] == "cancel") {
$status = "CANCELLED";
}
}
?>

<?php echo "$status
" ?>
<form method="post">
<fieldset>
<legend>OpenID Login</legend>
<input type="text" name="openid_identifier" value=""/>
<input type="submit" name="openid_action" value="login"/>
</fieldset>
</form>

|
In addition, this code differentiates between cancelled and invalid authentication responses. The provider returns a cancelled response if the identity provider is not aware of the supplied identity, the user is not logged in, or the user doesn’t trust the site. An invalid response indicates that the response is not conformant to the OpenID protocol or is incorrectly signed.
When an OpenID-enabled site passes authentication requests to a provider, it identifies itself with a realm URL. This URL may be considered a root of a trusted site. If the user trusts the realm URL, he or she should also trust matched and subsequent URLs.
By default, the realm URL is automatically set to the URL of the directory in which the login script resides. This default value is useful for most, but not all, cases. Sometimes an entire domain, and not a directory should be trusted. Or even a combination of several servers in one domain.
To override the default value, developers may pass the realm URL as a third argument to the ZendOpenId\Consumer::login method. In the following example, a single interaction asks for trusted access to all php.net sites.
Authentication Request for Specified Realm
1 2 3 4 5 6 | $consumer = new ZendOpenId\Consumer();
if (!$consumer->login($_POST['openid_identifier'],
'example-3_3.php',
'http://*.php.net/')) {
die("OpenID login failed.");
}
|
This example implements only the second step of authentication; the first and third steps are similar to the examples above.
In some cases, an application need only check if a user is already logged in to a trusted OpenID server without any interaction with the user. The ZendOpenId\Consumer::check method does precisely that. It is executed with the same arguments as ZendOpenId\Consumer::login, but it doesn’t display any OpenID server pages to the user. From the users point of view this process is transparent, and it appears as though they never left the site. The third step succeeds if the user is already logged in and trusted by the site, otherwise it will fail.
Immediate Check without Interaction
1 2 3 4 | $consumer = new ZendOpenId\Consumer();
if (!$consumer->check($_POST['openid_identifier'], 'example-4_3.php')) {
die("OpenID login failed.");
}
|
This example implements only the second step of authentication; the first and third steps are similar to the examples above.
There are three steps in the OpenID authentication procedure, and each step is performed by a separate HTTP request. To store information between requests, ZendOpenId\Consumer uses internal storage.
Developers do not necessarily have to be aware of this storage because by default ZendOpenId\Consumer uses file-based storage under the temporary directory- similar to PHP sessions. However, this storage may be not suitable in all cases. Some developers may want to store information in a database, while others may need to use common storage suitable for server farms. Fortunately, developers may easily replace the default storage with their own. To specify a custom storage mechanism, one need only extend the ZendOpenId\Consumer\Storage class and pass this subclass to the ZendOpenId\Consumer constructor in the first argument.
The following example demonstrates a simple storage mechanism that uses Zend\Db as its backend and exposes three groups of functions. The first group contains functions for working with associations, while the second group caches discovery information, and the third group can be used to check whether a response is unique. This class can easily be used with existing or new databases; if the required tables don’t exist, it will create them.
Database Storage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | class DbStorage extends ZendOpenId\Consumer\Storage
{
private $_db;
private $_association_table;
private $_discovery_table;
private $_nonce_table;
// Pass in the Zend\Db\Adapter object and the names of the
// required tables
public function __construct($db,
$association_table = "association",
$discovery_table = "discovery",
$nonce_table = "nonce")
{
$this->_db = $db;
$this->_association_table = $association_table;
$this->_discovery_table = $discovery_table;
$this->_nonce_table = $nonce_table;
$tables = $this->_db->listTables();
// If the associations table doesn't exist, create it
if (!in_array($association_table, $tables)) {
$this->_db->getConnection()->exec(
"create table $association_table (" .
" url varchar(256) not null primary key," .
" handle varchar(256) not null," .
" macFunc char(16) not null," .
" secret varchar(256) not null," .
" expires timestamp" .
")");
}
// If the discovery table doesn't exist, create it
if (!in_array($discovery_table, $tables)) {
$this->_db->getConnection()->exec(
"create table $discovery_table (" .
" id varchar(256) not null primary key," .
" realId varchar(256) not null," .
" server varchar(256) not null," .
" version float," .
" expires timestamp" .
")");
}
// If the nonce table doesn't exist, create it
if (!in_array($nonce_table, $tables)) {
$this->_db->getConnection()->exec(
"create table $nonce_table (" .
" nonce varchar(256) not null primary key," .
" created timestamp default current_timestamp" .
")");
}
}
public function addAssociation($url,
$handle,
$macFunc,
$secret,
$expires)
{
$table = $this->_association_table;
$secret = base64_encode($secret);
$this->_db->insert($table, array(
'url' => $url,
'handle' => $handle,
'macFunc' => $macFunc,
'secret' => $secret,
'expires' => $expires,
));
return true;
}
public function getAssociation($url,
&$handle,
&$macFunc,
&$secret,
&$expires)
{
$table = $this->_association_table;
$this->_db->delete(
$table, $this->_db->quoteInto('expires < ?', time())
);
$select = $this-_db->select()
->from($table, array('handle', 'macFunc', 'secret', 'expires'))
->where('url = ?', $url);
$res = $this->_db->fetchRow($select);
if (is_array($res)) {
$handle = $res['handle'];
$macFunc = $res['macFunc'];
$secret = base64_decode($res['secret']);
$expires = $res['expires'];
return true;
}
return false;
}
public function getAssociationByHandle($handle,
&$url,
&$macFunc,
&$secret,
&$expires)
{
$table = $this->_association_table;
$this->_db->delete(
$table, $this->_db->quoteInto('expires < ', time())
);
$select = $this->_db->select()
->from($table, array('url', 'macFunc', 'secret', 'expires')
->where('handle = ?', $handle);
$res = $select->fetchRow($select);
if (is_array($res)) {
$url = $res['url'];
$macFunc = $res['macFunc'];
$secret = base64_decode($res['secret']);
$expires = $res['expires'];
return true;
}
return false;
}
public function delAssociation($url)
{
$table = $this->_association_table;
$this->_db->query("delete from $table where url = '$url'");
return true;
}
public function addDiscoveryInfo($id,
$realId,
$server,
$version,
$expires)
{
$table = $this->_discovery_table;
$this->_db->insert($table, array(
'id' => $id,
'realId' => $realId,
'server' => $server,
'version' => $version,
'expires' => $expires,
));
return true;
}
public function getDiscoveryInfo($id,
&$realId,
&$server,
&$version,
&$expires)
{
$table = $this->_discovery_table;
$this->_db->delete($table, $this->quoteInto('expires < ?', time()));
$select = $this->_db->select()
->from($table, array('realId', 'server', 'version', 'expires'))
->where('id = ?', $id);
$res = $this->_db->fetchRow($select);
if (is_array($res)) {
$realId = $res['realId'];
$server = $res['server'];
$version = $res['version'];
$expires = $res['expires'];
return true;
}
return false;
}
public function delDiscoveryInfo($id)
{
$table = $this->_discovery_table;
$this->_db->delete($table, $this->_db->quoteInto('id = ?', $id));
return true;
}
public function isUniqueNonce($nonce)
{
$table = $this->_nonce_table;
try {
$ret = $this->_db->insert($table, array(
'nonce' => $nonce,
));
} catch (Zend\Db\Statement\Exception $e) {
return false;
}
return true;
}
public function purgeNonces($date=null)
{
}
}
$db = Zend\Db\Db::factory('Pdo_Sqlite',
array('dbname'=>'/tmp/openid_consumer.db'));
$storage = new DbStorage($db);
$consumer = new ZendOpenId\Consumer($storage);
|
This example doesn’t list the OpenID authentication code itself, but this code would be the same as that for other examples in this chapter. examples.
In addition to authentication, the OpenID standard can be used for lightweight profile exchange to make information about a user portable across multiple sites. This feature is not covered by the OpenID authentication specification, but by the OpenID Simple Registration Extension protocol. This protocol allows OpenID-enabled sites to ask for information about end users from OpenID providers. Such information may include:
An OpenID-enabled web site may ask for any combination of these fields. It may also strictly require some information and allow users to provide or hide additional information. The following example instantiates the ZendOpenId\Extension\Sreg class, requiring a nickname and optionally requests an email and a fullname.
Sending Requests with a Simple Registration Extension
1 2 3 4 5 6 7 8 9 10 11 | $sreg = new ZendOpenId\Extension\Sreg(array(
'nickname'=>true,
'email'=>false,
'fullname'=>false), null, 1.1);
$consumer = new ZendOpenId\Consumer();
if (!$consumer->login($_POST['openid_identifier'],
'example-6_3.php',
null,
$sreg)) {
die("OpenID login failed.");
}
|
As you can see, the ZendOpenId\Extension\Sreg constructor accepts an array of OpenID fields. This array has the names of fields as indexes to a flag indicating whether the field is required; TRUE means the field is required and FALSE means the field is optional. The ZendOpenId\Consumer::login method accepts an extension or an array of extensions as its fourth argument.
On the third step of authentication, the ZendOpenId\Extension\Sreg object should be passed to ZendOpenId\Consumer::verify. Then on successful authentication the ZendOpenId\Extension\Sreg::getProperties method will return an associative array of requested fields.
Verifying Responses with a Simple Registration Extension
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | $sreg = new ZendOpenId\Extension\Sreg(array(
'nickname'=>true,
'email'=>false,
'fullname'=>false), null, 1.1);
$consumer = new ZendOpenId\Consumer();
if ($consumer->verify($_GET, $id, $sreg)) {
echo "VALID " . htmlspecialchars($id) ."
\n";
$data = $sreg->getProperties();
if (isset($data['nickname'])) {
echo "nickname: " . htmlspecialchars($data['nickname']) . "
\n";
}
if (isset($data['email'])) {
echo "email: " . htmlspecialchars($data['email']) . "
\n";
}
if (isset($data['fullname'])) {
echo "fullname: " . htmlspecialchars($data['fullname']) . "
\n";
}
} else {
echo "INVALID " . htmlspecialchars($id);
}
|
If the ZendOpenId\Extension\Sreg object was created without any arguments, the user code should check for the existence of the required data itself. However, if the object is created with the same list of required fields as on the second step, it will automatically check for the existence of required data. In this case, ZendOpenId\Consumer::verify will return FALSE if any of the required fields are missing.
ZendOpenId\Extension\Sreg uses version 1.0 by default, because the specification for version 1.1 is not yet finalized. However, some libraries don’t fully support version 1.0. For example, www.myopenid.com requires an SREG namespace in requests which is only available in 1.1. To work with such a server, you must explicitly set the version to 1.1 in the ZendOpenId\Extension\Sreg constructor.
The second argument of the ZendOpenId\Extension\Sreg constructor is a policy URL, that should be provided to the user by the identity provider.
Zend Framework provides a special class to support user authentication: Zend\Auth. This class can be used together with ZendOpenId\Consumer. The following example shows how OpenIdAdapter implements the Zend\Auth\Adapter\Interface with the authenticate() method. This performs an authentication query and verification.
The big difference between this adapter and existing ones, is that it works on two HTTP requests and includes a dispatch code to perform the second or third step of OpenID authentication.
ZendAuth Adapter for OpenID
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | <?php
class OpenIdAdapter implements Zend\Auth\Adapter\Interface {
private $_id = null;
public function __construct($id = null) {
$this->_id = $id;
}
public function authenticate() {
$id = $this->_id;
if (!empty($id)) {
$consumer = new ZendOpenId\Consumer();
if (!$consumer->login($id)) {
$ret = false;
$msg = "Authentication failed.";
}
} else {
$consumer = new ZendOpenId\Consumer();
if ($consumer->verify($_GET, $id)) {
$ret = true;
$msg = "Authentication successful";
} else {
$ret = false;
$msg = "Authentication failed";
}
}
return new Zend\Auth\Result($ret, $id, array($msg));
}
}
$status = "";
$auth = Zend\Auth\Auth::getInstance();
if ((isset($_POST['openid_action']) &&
$_POST['openid_action'] == "login" &&
!empty($_POST['openid_identifier'])) ||
isset($_GET['openid_mode'])) {
$adapter = new OpenIdAdapter(@$_POST['openid_identifier']);
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
ZendOpenId\OpenId::redirect(ZendOpenId\OpenId::selfURL());
} else {
$auth->clearIdentity();
foreach ($result->getMessages() as $message) {
$status .= "$message
\n";
}
}
} else if ($auth->hasIdentity()) {
if (isset($_POST['openid_action']) &&
$_POST['openid_action'] == "logout") {
$auth->clearIdentity();
} else {
$status = "You are logged in as " . $auth->getIdentity() . "
\n";
}
}
?>

<?php echo htmlspecialchars($status);?>
<form method="post"><fieldset>
<legend>OpenID Login</legend>
<input type="text" name="openid_identifier" value="">
<input type="submit" name="openid_action" value="login">
<input type="submit" name="openid_action" value="logout">
</fieldset></form>
|
With Zend\Auth the end-user’s identity is saved in the session’s data. It may be checked with Zend\Auth\Auth::hasIdentity and Zend\Auth\Auth::getIdentity.
Finally a couple of words about integration into Model-View-Controller applications: such Zend Framework applications are implemented using the Zend\Controller class and they use objects of the Zend\Controller\Response\Http class to prepare HTTP responses and send them back to the user’s web browser.
ZendOpenId\Consumer doesn’t provide any GUI capabilities but it performs HTTP redirections on success of ZendOpenId\Consumer::login and ZendOpenId\Consumer::check. These redirections may work incorrectly or not at all if some data was already sent to the web browser. To properly perform HTTP redirection in MVC code the real Zend\Controller\Response\Http should be sent to ZendOpenId\Consumer::login or ZendOpenId\Consumer::check as the last argument.
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.


Level up your JavaScript
Wipe out confusion and become confident
Realization from first talk
-
Reduce explanation of this.. Just focused
Combination of live coding and slides
Summary was repeating
Remove second hosting question
May be breakdown in its number one, number 2, etc
Practice and practice
Wasn't able to sell ticket
Didn't tweeted the slides
Jokes wasn't prepared
Agenda
-
→ Function in depth
Scope, hoisting, closure -
bind, call, apply
explicitly set value of this. -
How JS works
Stack, Heap, Event loop. -
Promise
blocking, non-blocking... -
this
De-mystify notorious this -
Inheritance
Prototype chain.
Who is this dude?
-
- @jsdude005
- Organize Chicago JavaScript meetup
- Sr. Web Developer, Nielsen
- Enjoy Learning, talking about JavaScript
Why Core JavaScript?
You are still coding JavaScript and your friendly framework will not be around forever.
-
You need JavaScript to use the Framework.
Just only a framework will not a build an application. To put logic, functionalities, you have to use javascript.
-
Magic will through you in trouble.
Magic is good to do simple things. For large application, magic in frameworks will through you under the bus.
-
Feel why it works not how it works.
Making things working and understanding .
Function
Create a function
Declaration
function foo(a, b){
return a * b;
}
Expression - anonymous
var foo = function(a, b){
return a * b;
}
Expression - named
var foo = function boo(a, b){
console.log(boo);
return a * b;
}
var foo = new Function("a", "b", "return a * b;");
function in JS
function add(a,b){
return a + b;
}
console.log(add.length); //2
function like an object
could have property
have a length property
length is number of parameters
function in JS
function add(a,b){
return a+b;
}
console.log(add(2,3));//5
function noFunc(){
}
console.log(noFunc());//undefined
Always return
Default return is
undefined
"new" for constructor returns this
function add(a,b){
return a+b;
}
var b = add(2,3);
console.log(b); //5
function add(a,b){
return a+b;
}
var b = new add(2,3);
console.log(b); //add{}
function add(a,b){
this.a = a;
this.b = b;
return a+b;
}
var b = new add(2,3);
console.log(b);
//add{a:2, b:3}
arguments
- all the arguments passed to the function
function add(a,b){
console.log(arguments);
return a+b;
}
add(2,3);
//[2,3]
function add(a,b){
console.log(arguments);
return a+b;
}
add(2,3,5,7);
//[2,3,5,7]
function add(a,b){
console.log(arguments);
return a+b;
}
add();
//[]
Function Execution
function foo(a, b){
return a * b;
}
foo(2,3);
-
Creation Stage.
-
Execution Stage.
Creation Stage
Each function call creates own ExectuionContext
Roughly an 'environment' where function executes
inner variable, inner function
function foo(a, b){
function inner(){
console.log(a);
}
inner();
var c = a * b;
return c;
}
inner variable, inner function
function foo(a, b){
function inner(){
console.log(c);
}
inner();
var c = a * b;
return c;
}
scanning and adding to the variable object
ExecutionContext: {
scopeChain : { ... },
variableObject: {
arguments:{
0 : 2,
1 : 3,
length : 2
},
a : 2,
b : 3,
inner : pointer to function inner,
c : undefined
}
}
Execution Context and Scope
A concept in the language spec
Roughly an 'environment' where function executes
It holds: scope, scope chain, arguments, variables
Each function call creates own ExectuionContext
Scope is static
Set when function is created and never changes
Scope is a property of the function
Execution stage
Start reading the code from first line
Assign values
If need to access variable, it read from ExecutionContext
Until hits first return or body ends
Summary
Two stages of function: creation, execution
Creates execution context (before running any code)
First thing created is the scope chain
Then it creates variableObject
Create arguments, variable, determine
this
Execute function
Scope chain
A collection of
Current execution context
All parent execution context
JavaScript Scope
Global scope
Local scope
Block scope
- Lexical scope
Global...Globe
Global scope
var a = 2;
function b(){
console.log(a);
}
Local Scope
Local/function scope
-
function call creates execution context (before running any code)
-
First thing created is the scope chain
-
Create arguments, variable, determine
this
-
variables and inner functions are available inside only
function usa(){
var kim = 21;
console.log(kim);
}
usa(); // 21
console.log(kim);
//Uncaught ReferenceError: kim is not defined
JS scope chain
Multi execution context
var a = 2;
function b(){
console.log(a);
}
function c(){
console.log(a);
}
b();
c();
local events
Block Scope
-
Block: Anything inside curly braces
-
Javascript Block statements do not introduce a scope
-
JavaScript(up to ES5) does not have block scope.
-
Variables introduced within a block are scoped to the containing function or script
for(var i = 0; i<5; i++){
var twice = i*2;
}
console.log(i);// 5
console.log(twice);//8
ES6: let and const
-
let: declares a block scope local variable
-
Current block and contained sub-blocks
-
const: can not be reassigned.
-
const can be recreated inside a loop
for(let i = 0; i<5; i++){
const twice = i*2;
}
console.log(i);
//Uncaught ReferenceError: i is not defined
console.log(twice);
//Uncaught ReferenceError: twice is not defined
Closure
function in a function
function counter(){
var i = 0;
return function(){
return i++;
}
}
var a = counter();
a;
//function (){
// return i++;
//}
a(); //0
a(); //1
a(); //2
Lexical scope/Scope Chain
function counter(){
var i = 0;
return function(){
return i++;
}
}
const a = counter();
a(); // 0
Lexical Scoping defines how variable names are resolved in nested functions: inner functions contain the scope of parent functions even if the parent function has returned.
Multiple Closure
-
Every assignment of counter function creates new closure
-
Private variable
-
Save state
-
Create encapsulation
Who cares?
Garbage collector: can not claim the variable you are holding.
How many closure are you creating?
Variable reference: Don't use excessively large private variable
Unnecessary closure affect processing speed and memory consumption
Closure in Summary
function inside another function
Doesn't have to return function
Refer to variables, parameters outside of current scope
Read and write outer scope variable
Each closure has separate private variable
Closure for dummies
so far...
function could have properties
Two stages of function call: Creation, Execution
ExecutionContext: Scope chain, variableObj, this
Jackie Chan, Kim Kardashian, super bowl
Scope chain: collection of current + all parent Execution context
Closure: save states and create encapsulation
Hoist a variable
function foo(a, b){
function inner(){
console.log(a);
}
inner();
var c = a * b;
return c;
}
ExecutionContext: {
scopeChain : { ... },
variableObject: {
arguments:{
0 : 2,
1 : 3,
length : 2
},
a : 2,
b : 3,
inner : pointer to function inner,
c : undefined
}
}
Just Looping
function justLooping() {
for (var i = 0; i < 5; i++) {
var twice = i*2;
}
console.log(i);
console.log(twice);
}
justLooping();// 5 8
function justLooping() {
var i;
var twice;
for (i = 0; i < 5; i++) {
twice = i*2;
}
console.log(i);
console.log(twice);
}
justLooping(); // 5 8
Hoist function declaration with definition
function outer(){
inner();
function inner(){
console.log('inside inner function');
}
}
outer();
function outer(){
function inner(){
console.log('inside inner');
}
inner();
}
outer();
Hoist function name only for function expression
function outer(){
inner();
var inner = function(){
console.log('inside inner');
}
}
outer();
//Uncaught TypeError: inner is not a function
function outer(){
var inner;
inner();
inner = function(){
console.log('inside inner');
}
}
outer();
//Uncaught TypeError: inner is not a function
Million dollar question
var a = 1;
function bar(){
a = 10;
return;
var a = 7;
}
bar();
console.log(a);//?
function foo(){
var f = function() {
console.log("original");
}
function f() {
console.log("duplicate");
}
f();
}
foo(); //?
Class
Inheritance: in JavaScript
-
JavaScript only has one construct: objects
-
Each object has a private property (referred to as [[Prototype]] )
-
Holds a link to another object called its prototype
-
That prototype object has a prototype of its own
-
Until an object is reached with null as its prototype
-
By definition, null has no prototype, and acts as the final link in this prototype chain
Prototype Chain
var o = object.create(null);
var o = {
id: 42,
name: 'john'
}
function Entity(id, name){
this.id = id;
this.name = name;
}
Using Object (without constructor)
var person = {
hours: 5,
getHours: function() {
return this.hours + 3;
}
};
person.getHours(); // 8
var manager = Object.create(person);
// manager is an object that inherits from person
manager.getHours(); //8
// creates an own property 'hours' on manager
manager.hours = 1;
manager.getHours(); //4
Using constructor
function Person (id, hours) {
this.id = id;
this.hours = hours;
this.getHours = function() {
return this.id + ' works:' + this.hours +'hr';
};
}
function Person (id, hours) {
this.id = id;
this.hours = hours;
}
Person.prototype.getHours = function() {
return this.id + ' works:' + this.hours +'hr';
};
Get what is in prototype
var dad = {
fathersName:'big Dad'
}
var child = Object.create(dad);
child.whoIsYourFather = function(){
return this.fathersName;
}
child.whoIsYourFather(); //big Dad
child.hasOwnProperty('fathersName'); //false
Object.getPrototypeOf(child);
//{fathersName: "big Dad"}
this
walks through prototype chain.
ES6 - class (syntactical sugar )
function User(name) {
this.name = name;
}
User.prototype.sayHi = function() {
return 'Hi '+ this.name;
}
let user = new User("John");
user.sayHi();
class User {
constructor(name) {
this.name = name;
}
sayHi() {
return 'Hi ' + this.name;
}
}
let user = new User("John");
user.sayHi();
What is this?
console.log(this);//window
function whatIsThis() {
return this;
}
whatIsThis(); //window
function justAddName(name) {
this.name = name;
return this;
}
justAddName("Amy Farrah Fowler");//window
console.log(window.name); //Amy Farrah Fowler
What is this really?
(function(){
console.log(this);
})();
//window
(function(){
'use strict';
console.log(this);
})();
//undefined
Give my this
back in strict mode
(function(self){
'use strict';
console.log(self);
})(this);
//window
(function(){
'use strict';
console.log(this);
}).call(this);
//window
Spec 10.4.3
this of an Object
var buddy = {
firstName:'Penny',
lastName:this.firstName,
context:this
}
buddy.firstName; //Penny
buddy.lastName;//undefined
buddy.context;//window
var buddy = {
firstName:'Penny',
getName:function(){
return this.firstName;
},
getContext: function() {
return this;
}
};
buddy.getName(); //Penny
buddy.getContext();
// Object {getContext: function}
Understand the context of execution
var a = {
b: function() {
return this;
}
};
a.b();
//Object {b: function}
var foo = a.b;
console.log(foo);
/* function(){
return this;
};*/
foo(); //window
window.foo(); //window
var d = {
d:'my D'
};
d.c = a.b;
d.c();
//Object {d:'my D', c: function}
Watch left side of dot(.)
Some more execution context
var a = {
b: function() {
var c = function() {
console.log(this);
};
c();
}
};
a.b();//window
var a = {
b: function() {
(function() {
console.log(this);
})();
}
};
a.b(); //window
strict mode will return undefined
context of thissetTimeout inside constructor
function Menu(item){
this.item = item;
this.context = this;
setTimeout(function(){
console.log('setTimeout context:', this);
}, 10);
}
var lunch = new Menu('pizza');
//setTimeout context: window
lunch.context;
//Menu {item: "pizza", context: Menu}
Same behavior with setInterval
How to fix this?
function Menu(item){
var that = this;
this.item = item;
this.context = this;
setTimeout(function(){
console.log('setTimeout context:', that);
}, 10);
}
var lunch = new Menu('pizza');
//setTimeout context: Menu {item: "pizza", context: Menu}
lunch.context;
//Menu {item: "pizza", context: Menu}
function Menu(item){
this.item = item;
this.context = this;
setTimeout( () => {
console.log('setTimeout context:', this);
}, 10);
}
var lunch = new Menu('pizza');
//setTimeout context: Menu {item: "pizza", context: Menu}
lunch.context;
//Menu {item: "pizza", context: Menu}
DOM event handler
this = the element that fired the event
//execute it in console
document.getElementById('myButton')
.addEventListener('click', function(){
console.log(this);
});
function Bluify(e){
// Always true
console.log(this === e.currentTarget);
this.style.backgroundColor = 'blue';
}
Now. I know this
left of dot(.) will indicate value of this
window (no dot)
undefined (strict mode IIFE)
object (left of dot('.') for a method call)
newly constructed object (constructor: new keyword)
window (inside setTimeout)
element fired the event, inside event handler
use bind, call, apply to set value of this explicitly
JS: execution context
Explicitly set this
bind any function that has this
Create a new function by holding the context(this) to be used later such as dom binding.
function getMonthlyFee(fee){
var remaining = this.total - fee;
this.total = remaining;
return this.name +' remaining balance:'
+ remaining;
}
var rachel = {
name:'Rachel Green',
total:500
};
//bind
var getRachelFee = getMonthlyFee.bind(rachel, 90);
//deduct
getRachelFee();
//Rachel Green remaining balance:410
getRachelFee();
//Rachel Green remaining balance:320
bind any method on other object
var monica = {
name: 'Monica',
getMonthlyFee: function(fee){
var remaining = this.total - fee;
this.total = remaining;
return this.name +' remaining balance:'
+ remaining;
}
}
var ross = {
name:'Ross Geller',
total:250
};
//bind
var getRossFee = monica.getMonthlyFee.bind(ross, 25);
//deduct
getRossFee();
//Ross Geller remaining balance:225
getRossFee();
//Ross Geller remaining balance:200
call and apply
Just use the provided context and execute immediately
function lunch(budget, time){
return this.menu +' for ' + budget +' within '+ time +' min.';
}
var forDev = {menu: 'pizza'};
lunch.call(forDev, 5, 10);//pizza for 5 within 10 min.
lunch.apply(forDev, [5, 10]);//pizza for 5 within 10 min.
this
in arguments
8 function allows thisArg
Function.prototype.bind( thisArg [ , arg1 [ , arg2, ... ] ] )
Function.prototype.call( thisArg [ , arg1 [ , arg2, ... ] ] )
Function.prototype.apply( thisArg, argArray )
Array.prototype.every( callbackfn [ , thisArg ] )
Array.prototype.some( callbackfn [ , thisArg ] )
Array.prototype.forEach( callbackfn [ , thisArg ] )
Array.prototype.map( callbackfn [ , thisArg ] )
Array.prototype.filter( callbackfn [ , thisArg ] )
What is JavaScript?
How JavaScript works?
A single-threaded, non-blocking, asnchronous concurrent runtime
I am a programmer, give me detail
Maintain a call stack, event loop, queue, etc.
Are these in JS?
No. They are in JavaScript implementation.
call stack
function multiply(a,b){
return a * b;
}
function square (n){
return multiply(n,n);
}
function consoleSquare(n){
var squared = square(n);
console.log(squared);
}
consoleSquare(3);
Call stack
multiply
square
consoleSquare
Stack overflow
function foo(){
foo();
}
Call stack
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
foo
Blocking
Blocking methods execute synchronously
Non-blocking methods execute asynchronously
Does networking or uses timers
Usually takes a callback
Async stack
console.log('Hi');
setTimeout(function(){
console.log('Chicago');
}, 2000)
console.log('There');
// Hi
// There
// Chicago
Call stack
console.log('There')
???
console.log('Hi')
Concurrency model and Event Loop
-
Stack: frames of call
-
Heap: Objects allocated in teh memory
-
Queue: Runtime list of messages to be processed
-
Event Loop: Check if stack is empty. if empty push anything waiting in the queue
Javascript is single threaded but you have a browser
Events
Event delegate

first item

second item

third item

forth item

Fifth item

var el = document.getElementById('listToDestroy');
el.addEventListener('click', function (e) {
var list = e.target.parentNode;
list.parentNode.removeChild(list);
e.preventDefault();
});
Event delegate (demo)

first item

second item

third item

forth item

Fifth item

var el = document.getElementById('listToDestroy');
el.addEventListener('click', function (e) {
var list = e.target.parentNode;
list.parentNode.removeChild(list);
e.preventDefault();
});
Promise
Ready to Start?
Start a new journey with confidence.
Be the premium developer. The go to guy.
Hands on Learning
The best way to learn is to do it yourself while someone else is there to answer your questions:
- Date: Nov 11, 2017 9.45am to 5.00pm
- Location: Close to Merchandise mart.
- Promo code: chicago


Week 1 The Website
Week 2 Lazer Cutting
Week3 3-D Printing
Week 4 3-D Scanning
Week 5 Codename: Chicken Dinner
Week 6 Shanghaino
Week 8 Chicken-Eaters Reassembled!
To me, Fablab is where I can fulfill my ideas, superficial, but earnest.
Together with: Justin, Christine and Tina.


Asamah:
Where did you learn this song?
It seems like you not only know the melody of it, but that you also understand the spirit and meaning of the song.
When I hear you sing, in fact, it's plain to me that you understand!
Explain how you learned about Kirikachin and an outsider's friendship.


Jason Kim is a software developer, self-proclaimed chef, winner of the participation award across every little league sport, and an aspiring lottery winner.
He will be graduating from Princeton university with a Bachelors in Computer Science next spring.
This is his website v1.0 (which is currently under construction).
Experience skills/languages
Places I've worked with links. Applied Predictive Technologies Perfect Company.
learn more front end, using this site to practice different technologies.


X-Fold
Having something relevant to say to customers is not good enough today. You need to capture their attention first.
This marketing tool supports our main business objective – helping our customers maximise their investment when they buy from us.


--- Part One ---
Your flight to the major airline hub reaches cruising altitude without incident. While you consider checking the in-flight menu for one of those drinks that come with a little umbrella, you are interrupted by the kid sitting next to you.
Their handheld game console won't turn on! They ask if you can take a look.
You narrow the problem down to a strange infinite loop in the boot code (your puzzle input) of the device. You should be able to fix it, but first you need to be able to run the code in isolation.
The boot code is represented as a text file with one instruction per line of text. Each instruction consists of an operation (acc
, jmp
, or nop
) and an argument (a signed number like +4
or -20
).
acc
increases or decreases a single global value called the accumulator by the value given in the argument. For example,acc +7
would increase the accumulator by 7. The accumulator starts at0
. After anacc
instruction, the instruction immediately below it is executed next.jmp
jumps to a new instruction relative to itself. The next instruction to execute is found using the argument as an offset from thejmp
instruction; for example,jmp +2
would skip the next instruction,jmp +1
would continue to the instruction immediately below it, andjmp -20
would cause the instruction 20 lines above to be executed next.nop
stands for No OPeration - it does nothing. The instruction immediately below it is executed next.
For example, consider the following program:
nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6
These instructions are visited in this order:
nop +0 | 1
acc +1 | 2, 8(!)
jmp +4 | 3
acc +3 | 6
jmp -3 | 7
acc -99 |
acc +1 | 4
jmp -4 | 5
acc +6 |
First, the nop +0
does nothing. Then, the accumulator is increased from 0 to 1 (acc +1
) and jmp +4
sets the next instruction to the other acc +1
near the bottom. After it increases the accumulator from 1 to 2, jmp -4
executes, setting the next instruction to the only acc +3
. It sets the accumulator to 5, and jmp -3
causes the program to continue back at the first acc +1
.
This is an infinite loop: with this sequence of jumps, the program will run forever. The moment the program tries to run any instruction a second time, you know it will never terminate.
Immediately before the program would run an instruction a second time, the value in the accumulator is 5
.
Run your copy of the boot code. Immediately before any instruction is executed a second time, what value is in the accumulator?


MRSA costs patients positive S&D isolation policy prevalence PCR screening culture Staphylococcus Kennemer patient rate {border-style (.%) Dutch aureus benefits contact hospital study average px;} #ffffff;} inpatients risk nosocomial total unexpected used additional pre-emptive using Total negative Health Table bacteraemia data following groups number test Costs Gasthuis Rijen high-risk nursing set Gasthuis, Netherlands calculated days estimated high patients, van Available: SAB contacts cost current hospitals rates studies tracing variable Destroy HCWs Search calculation compared control costs: dialysis extra guidelines px; screened situation {font-family (%) HCWs) Number annual available category countries font-size infection infections isolated mortality out- patients. performed proposed rooms ./journal.pone..t Additionally, Infect Inpatients Kennemerland, Medical Medicine Sciences Wassenberg addition associated assumed based considered daily different double; higher low lower policy. resulting results showed year (and (as (at (for (patients (set) (such Annual Care FTE However, Infection Laboratory Outpatients PPE SME Subtotal abandoning aureus: border-color border-width consisted deaths fixed information laboratory methicillin-resistant nose patient, positive, present save scenario seven shown solid; strict taken tested times transmission treatment treatment, {font-style {font-weight (in (with (without -expected BLH Benefits Biology Cosgrove Fig Follow-up Inpatient: JWB. Methicillin-resistant Outpatient: Un- abroad actually adjustment bold break-even calculate case categorized colonization combined consists cost-benefit costs. courier; culturing days) described detection em; group included lives measures median national new outpatients pathogens percentage policies policy, practitioner pt;} region regional replacement reported resistance result shows spread) study, swabs work year) year).


Showing the ten latest blog posts of Web Designer Wall
This uses Google APIs to convert RSS/XML to JSON.


What's New
Highlights
- Switching the dual kernel version to LTS 4.9.79
and LTS 4.14.16. LTS 4.4 is not tested in this release and under
maintenance mode
- U-Boot v2017.11 update
- LS2084A and LS2088A top bin and non-E part
- Direct device assignment in guest kernel on LTS
4.14 [DPAA2 processors]
- Support for edge compute on EdgeScale, including
secure manufacturing, secure keys, EdgeScale dashboard for users and application
management
- MC upgrade to 10.6.0
- Python scripts to generate RCW binaries for
LS1012A, LS1088A and LS2088A
- Support for DPDK 17.11 as base and OVS 2.9
- Includes several software fixes. Refer to Fixed,
Open, and Closed Issues on Layerscape Software Development Kit 18.03 Documentation -
Knowledge Center which has a list of all fixed issues
- Includes additional workarounds for Chip Errata:
A-008851, A-009611, A-009668, A-010131, A-010477, A-010843, A-011026
Ubuntu Userland
- No change since the last LSDK
Linux Kernel Core, Virtualization
- LTS kernel 4.9.79 update
- LTS kernel 4.14.16
- Direct device assignment in guest kernel on LTS
4.14 [DPAA2 processors]
- QEMU: MC portal emulation
Linux Kernel Drivers
- DPAA2 CAAM: generic gcm (aes), IPsec GCM -
rfc4106
- DPAA2 Ethernet: XDP, L2Switch driver update to
switchdev version
- USB: U1/U2 mode in host
Data Plane Development Kit (DPDK)
- Support of DPDK 17.11 as base
- Support of LTS 4.14
- AIOP cmdif support
- Ethernet poll mode driver with push mode queues,
Crypto - Scatter Gather support, Eventde driver, tail drop using WRED -
- CGR [DPAA1 processors]
- IPSEC protocol offload support
- KNI support
- PKTGEN 3.4.8
Virtualization - OVS-DPDK
Open Data Plane (ODP)
- No change since the last LSDK
U-Boot Boot Loader
- U-Boot v2017.11
- Support for IFC and EMMC switch support in qixis
[LS1088A]
Unified Extensible Firmware Interface (UEFI)
- No change since the last LSDK
EdgeScale - Edge Compute
- Secure Manufacturing
- Tools available for Secure Fuse provisioning
[LS1012A, LS1043A, LS1046A]
- Secure Keys [LS1046A]
- Support of API's to import/generate RSA keys
securely
- Support of PKCS#11 interface for signing
operations
- Support of OPENSSL engine to access these keys
- EdgeScale Dashboard for Users
- Device management
- Secure device enrolment
- Secure key/certificate provisioning
- OTA: firmware update [LS1043A, LS1046A]
- Device status monitoring
- Application management
- Dynamic deployment of container based
applications
Other Tools and Utilities
- AIOP
- AIOP boot error handling, error frame handling,
TX buffer layout
- API for configuring timestamp passing behavior
inside a recycle path flow
- ASA opaque
- User-defined exception handler
- MC 10.6.0 update
- RCW
- LS2084A and LS2088A top bin and non-E part
- Python scripts to generate RCW binaries for
LS1012A, LS1088A and LS2088A


femto
A minimum featured textarea
femto allow you to add a simple text editor for writing some kind of Markup language. It helps user to write these kind of text with the following features:
TAB
indent andSHIFT + TAB
outdentTAB
key move the focus to the next object in browser defaulttextarea
. However most desktop text editor useTAB
key for indent.Auto indent (Keep indent)
Some desktop text editor automatically keep indent level when user hit
RETURN
key. It is useful when user write a kind of Markup text which use indent as a blockquote or code block.Complete Undo/Redo
femto has its own Undo / Redo feature
Usage
Download femto-0.2.2.tar.gz and extract it
Copy extracted files into
femto
directory like+ www +- index.html +- js +- femto +- femto-0.2.2.js +- femto-0.2.2.css
Write
index.html
as:<html> <head> <link rel="stylesheet" href="js/femto/femto.css"> </head> <body> <textarea id="femto-demo"></textarea> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="js/femto/femto.js"></script> <script> $(function() { var options = {}; // set options if necessary $('textarea#femto-demo').femto(options); }); </script> </body> </html>
Options
expandTab
- when true, use spaces instead of tab (default: true)indentLevel
- the number of spaces to describe one indent. it makes sense only whenexpandTab
is true (default: 4)
Supported browsers
The following browsers are supported (or Not Tested yet).
- ✓ Google Chrome
- ✓ Mozilla Firefox
- ✓ Safari
- ✓ Lunascape
- ✓ Opera
- NT Internet Explorer 10
- NT Internet Explorer 9
- ✓ Internet Explorer 8 (limited)
- ✓ Internet Explorer 7 (limited)
- ✓ Internet Explorer 6 (limited)
Test
You can check the test result at femto Travis-ci.
Develop
femto is not stable yet. Features might be changed in future.
License
MIT License
Copyright(c) 2012 lambdalisue, hashnote.net all right reserved.


Electrical Engineer Intern BoschKuala Lumpur, Malaysia Up to MYR 2,000 Power tools and electronics 3d ago Mechanical Engineer - InternHorizon Tele Systems Sdn BhdSubang (Selangor) - Bukit JelutongMYR 1,500Manufacturing/Production 24d ago
Mechanical Engineer - InternHorizon Tele Systems Sdn BhdSubang (Selangor) - Bukit JelutongMYR 1,500Manufacturing/Production 24d ago


Hello
...
Welcome to the Force.com Canvas Python example!
Canvas Request
Below is some information received in the Canvas Request:
First Name:
Last Name:
Username:
Email Address:
Company:


Introducing Oozie Editor/Dashboard
The Oozie Editor/Dashboard application allows you to define Oozie workflow and coordinator applications, run workflow and coordinator jobs, and view the status of jobs. For information about Oozie, see Oozie Documentation.
A workflow application is a collection of actions arranged in a directed acyclic graph (DAG). It includes control flow nodes (start, end, fork, join, decision, and kill) and action nodes (MapReduce, Streaming, Java, Pig, Hive, Sqoop, Shell, Ssh, DistCp, Fs, Email, Sub-workflow, and Generic).
A coordinator application allows you to define and execute recurrent and interdependent workflow jobs. The coordinator application defines the conditions under which the execution of workflows can occur.
Contents
Oozie Editor/Dashboard Installation and Configuration
Oozie Editor/Dashboard is one of the applications that is installed as part of Hue.
| Note In order to run DistCp, Streaming, Pig, Sqoop, and Hive jobs as part of a workflow, Oozie must be configured to use the Oozie ShareLib. See Oozie Installation. |
Starting Oozie Editor/Dashboard
To start Oozie Editor/Dashboard, click the Oozie Editor/Dashboard icon () in the navigation bar at the top of the Hue browser page. Oozie Editor/Dashboard opens with the following screens:
- Dashboard - shows the running and completed workflow and coordinator jobs. The screen is selected and opened to the Workflows page.
- Workflows - shows available workflows.
- Coordinators - shows available coordinators.
- History - shows a list of submitted jobs.
Installing Oozie Editor/Dashboard Samples
The Oozie Editor/Dashboard sample workflows and coordinators can help you learn how to use Oozie Editor/Dashboard. To install the samples:
- Click the Workflows tab.
- Click the Setup App button. This action adds samples demonstrating all the types of actions to the Workflows Editor and one sample to the Coordinator Editor. It also creates workspaces and deployment directories required by the samples in /user/hue/oozie.
Filtering Lists in Oozie Editor/Dashboard
The Dashboard, Workflows, Coordinators, and History screens contain lists of workflows, coordinators, and jobs. When you type in the Filter field on these screens, the lists are dynamically filtered to display only those rows containing text that matches the specified substring.
Permissions in Oozie Editor/Dashboard
In the Dashboard workflows and coordinators can only be viewed, submitted, and modified by its owner or a superuser.
Editor permissions for performing actions on workflows and coordinators are summarized in the following table:
| Action |
Superuser or Owner |
All |
| View |
Y |
Only if "Is shared" is set |
| Submit |
Y |
Only if "Is shared" is set |
| Modify |
Y |
N |
Oozie Dashboard
Oozie Dashboard shows a summary of the running and completed workflow and coordinator jobs.
You can view jobs for a period up to the last 30 days.
You can filter the list by date (1, 7, 15, or 30 days) or status (Succeeded, Running, or Killed). The date and status buttons are toggles.
Workflows
Click the Workflows tab to view the running and completed workflow jobs for the filters you have specified.
Click a workflow row in the Running or Completed table to view detailed information about that workflow job.
For the selected job, the following information is available.
- The Graph tab shows the workflow DAG.
- The Actions tab shows you details about the actions that make up the workflow.
- Click the Id link to see additional details about the action.
- Click the External Id link to view the job in the Job Browser.
- The Details tab shows job statistics including start and end times, and provides a link to the workflow definition in the File Browser.
- The Configuration tab shows selected job configuration settings.
- The Logs tab shows log output generated by the workflow job.
- The Definition tab shows the Oozie workflow definition, as it appears in the workflow.xml file (also linked under the application path properties in the Details tab and the Configuration tab).
Coordinators
Click the Coordinators tab to view the running and completed coordinator jobs for the filters you have specified.
For the selected job, the following information is available.
- The Calendar tab shows the timestamp of the job. Click the timestamp to open the workflow DAG.
- The Actions tab shows you details about the actions that make up the coordinator.
- Click the Id link to see additional details about the action.
- Click the External Id link to view the job in the Job Browser.
- The Configuration tab shows selected job configuration settings.
- The Logs tab shows log output generated by the coordinator.
- The Definition tab shows the Oozie coordinator definition, as it appears in the coordinator.xml file (also linked under the oozie.coord.application.path property in the Configuration tab).
Workflow Manager
In Workflow Manager you create Oozie workflows and submit them for execution.
Click the Workflows tab to open the Workflow Manager.
Each row shows a workflow: its name, description, timestamp of its last modification. It also shows:
- Steps: the number of steps in the workflow execution path. This is the number of execution steps between the start and end of the workflow. This will not necessarily be the same as the number of actions in the workflow, if there are control flow nodes in the control path.
- Status: who can run the workflow. shared means users other than the owner can access the workflow. personal means only the owner can modify or submit the workflow. The default is personal.
- Owner: the user that created the workflow.
In Workflow Editor you edit workflows that include MapReduce, Streaming, Java, Pig, Hive, Sqoop, Shell, Ssh, DistCp, Fs, Email, Sub-workflow, and Generic actions. You can configure these actions in the Workflow Editor, or you can import job designs from Job Designer to be used as actions in your workflow. For information about defining workflows, see the Workflow Specification.
Installing the Sample Workflows
- Click the Setup Examples button at the top right.
Opening a Workflow
To open a workflow, in Workflow Manager, click the workflow. Proceed with Editing a Workflow.
Creating a Workflow
- Click the Create button at the top right.
- In the Name field, type a name.
- Click advanced to specify whether the workflow is shared, the deployment directory, or a job.xml file.
- Click Save. The Workflow Editor opens. Proceed with Editing a Workflow.
Importing a Workflow
- Click the Import button at the top right.
- In the Name field, type a name.
- In the Local workflow.xml file field, click Choose File and select a workflow file.
- Click advanced to specify whether the workflow is shared, the deployment directory, or a job.xml file.
- Click Save. The Workflow Editor opens. Proceed with Editing a Workflow.
Submitting a Workflow
To submit a workflow for execution, do one of the following:
- In the Workflow Manager, click the radio button next to the workflow, and click the Submit button.
- In the Workflow Editor, click the Submit button.
The workflow job is submitted and the Dashboard displays the workflow job.
To view the output of the job, click View the logs.
Suspending a Running Job
In the pane on the left, click the Suspend button.
- Verify that you want to suspend the job.
Resuming a Suspended Job
In the pane on the left, click the Resume button.
- Verify that you want to resume the job.
Rerunning a Workflow
In the pane on the left, click the Rerun button.
- Check the checkboxes next to the actions to rerun.
- Specify required variables.
- Click Submit.
Scheduling a Workflow
To schedule a workflow for recurring execution, do one of the following:
- In the Workflow Manager, click the radio button next to the workflow and click the Schedule button.
- In the Workflow Editor, click the Schedule button.
A coordinator is created and opened in the Coordinator Editor. Proceed with Editing a Coordinator.
Editing a Workflow
In the Workflow Editor you can easily perform operations on Oozie action and control nodes.
Action Nodes
The Workflow Editor supports dragging and dropping action nodes. As you move the action over other actions and forks, highlights indicate active areas. If there are actions in the workflow, the active areas are the actions themselves and the areas above and below the actions. If you drop an action on an existing action, a fork and join is added to the workflow.
- Add actions to the workflow by doing one of the following:
- Click an action () button and drop the action on the workflow. The Edit Node screen displays.
- Set the action properties and click Done. Each action in a workflow must have a unique name.
- Click the Import action link to import an existing job design. The Import Action screen displays.
- Click a radio button next to a job design and click Import. The action is added to the end of the workflow.
- Clone an action by clicking the button.
- The action is opened in the Edit Node screen.
- Edit the action properties and click Done. The action is added to the end of the workflow.
- Delete an action by clicking the button.
- Edit an action by clicking the button.
- Change the position of an action by left-clicking and dragging an action to a new location.
Control Nodes
- Create a fork and join by dropping an action on top of another action.
- Remove a fork and join by dragging a forked action and dropping it above the fork.
- Convert a fork to a decision by clicking the button.
- To edit a decision:
- Click the button.
- Fill in the predicates that determines which action to perform and select the default action from the drop-down list.
- Click Done.
Uploading Workflow Files
In the Workflow Editor, click the Upload button.
Editing Workflow Properties
- In the Workflow Editor, click the link under the Name or Description fields in the left pane.
- To share the workflow with all users, check the Is shared checkbox.
- To set advanced execution options, click advanced and edit the deployment directory, add parameters and job properties, or specify a job.xml file.
- Click Save.
Displaying the History of a Workflow
- Do one of the following:
- In the Workflow Editor, click Show history in the pane at the left. Click a job.
- In the Oozie Dashboard/Editor, click the History tab. Click a submission Id.
Coordinator Manager
In Coordinator Manager you create Oozie coordinator applications and submit them for execution.
Click the Coordinators tab to open the Coordinator Manager.
Each row shows a coordinator: its name, description, timestamp of its last modification. It also shows:
- Workflow: the workflow that will be run by the coordinator.
- Frequency: how often the workflow referenced by the coordinator will be run.
- Status: who can run the coordinator. shared means users other than the owner can access the workflow. personal means only the owner can modify or submit the workflow. The default is personal.
- Owner: the user that created the workflow.
In Coordinator Editor, you edit coordinators and the datasets required by the coordinators. For information about defining coordinators and datasets, see the Coordinator Specification.
Opening a Coordinator
To open a coordinator, in Coordinator Manager, click the coordinator. Proceed with Editing a Coordinator.
Creating a Coordinator
To create a coordinator, in Coordinator Manager:
- Click the *Create button at the top right. The Coordinator wizard opens. Proceed with Editing a Coordinator.
Submitting a Coordinator
To submit a coordinator for execution, click the radio button next to the coordinator and click the Submit button.
Editing a Coordinator
In the Coordinator Editor you specify coordinator properties and the datasets on which the workflow scheduled by the coordinator will operate by stepping through screens in a wizard. You can also advance to particular steps and revisit steps by clicking the Step "tabs" above the screens. The following instructions walk you through the coordinator wizard.
- Type a name, select the workflow, check the Is shared checkbox to share the job, and click Next. If the Coordinator Editor was opened after scheduling a workflow, the workflow will be set.
- Select how many times the communicator will run for each specified unit, the start and end times of the coordinator, the timezone of the start and end times, and click Next. The start and end times must be expressed as UTC times. For example, to run at 10 pm PST, specify a start time of 6 am UTC of the following day (+8 hours) and set the Timezone field to America/Los_Angeles.
- Click Add to select an input dataset and click Next. If no datasets exist, follow the procedure in Creating a Dataset.
- Click Add to select an output dataset. Click Save coordinator or click Next to specify advanced settings.
- To share the coordinator with all users, check the Is shared checkbox.
- Fill in parameters to pass to Oozie, properties that determine how long a coordinator will wait before timing out, how many coordinators can run and wait concurrently, and the coordinator execution policy.
- Click Save coordinator.
Creating a Dataset
- In the Coordinator Editor, do one of the following:
- Click here in the Inputs or Outputs pane at the top of the editor.
- In the pane at the left, click the Create new link. Proceed with Editing a Dataset.
Displaying Datasets
- In the Coordinator Editor, click Show existing in pane at the left.
- To edit a dataset, click the dataset name in the Existing datasets table. Proceed with Editing a Dataset.
Editing a Dataset
- Type a name for the dataset.
- In the Start and Frequency fields, specify when and how often the dataset will be available.
- In the URI field, specify a URI template for the location of the dataset. To construct URIs and URI paths containing dates and timestamps, you can specify the variables ${YEAR},${MONTH},${DAY},${HOUR},${MINUTE}. For example: hdfs://foo:9000/usr/app/stats/${YEAR}/${MONTH}/data.
- In the Instance field, click a button to choose a default, single, or range of data instances. For example, if frequency==DAY, a window of the last rolling 5 days (not including today) would be expressed as start: -5 and end: -1. Check the advanced checkbox to display a field where you can specify a coordinator EL function.
- Specify the timezone of the start date.
- In the Done flag field, specify the flag that identifies when input datasets are no longer ready.
Displaying the History of a Coordinator
- Do one of the following:
- In the Coordinator Editor, click Show history in the pane at the left. Click a job.
- In the Oozie Dashboard/Editor, click the History tab. Click a coordinator.


MPI functions sometimes use arguments with a choice (or union) data type. Distinct calls to the same routine may pass by reference actual arguments of different types. The mechanism for providing such arguments will differ from language to language. For Fortran, the document uses <type> to represent a choice variable, for C, we use (void *).


"""
geolocate wrapper to Geolite2 API.
Programmed by: Dante Signal31
email<EMAIL_ADDRESS>"""
import abc
import datetime
import gzip
import os
import shutil
# import subprocess
import tempfile
import geoip2.database as database
import geoip2.webservice as webservice
import maxminddb
import wget
import geolocate.classes.config as config
import geolocate.classes.exceptions as exceptions
DEFAULT_DATABASE_FILE_EXTENSION = "mmdb"
GEOIP2_WEBSERVICE_TAG = "geoip2_webservice"
GEOIP2_LOCAL_TAG = "geoip2_local"
[docs]def load_geoip_database(configuration=None):
return GeoIPDatabase(configuration)
[docs]class GeoIPDatabase(object):
""" Location engines may have multiple query methods. This class
encapsulates them all in _locators list.
"""
[docs] def __init__(self, configuration):
"""
:param configuration: Geolocate configuration.
:type configuration: config.Configuration
"""
self._configuration = configuration
self._locators = {}
self._add_locators()
self._locators_preference = configuration.locators_preference
def _add_locators(self):
""" Add query methods for this location engine.
:return: None
"""
self._add_webservice_locator()
self._add_local_database_locator()
def _web_service_access_configured(self):
"""
:return: True if access credential to web service are configured, False if not.
:rtype: bool
"""
default_user_id = config.DEFAULT_USER_ID
default_license_key = config.DEFAULT_LICENSE_KEY
if self._configuration.user_id != default_user_id and \
self._configuration.license_key != default_license_key:
return True
else:
return False
def _add_webservice_locator(self):
"""
:return: None
"""
if self._web_service_access_configured():
webservice_locator = WebServiceGeoLocator(self._configuration)
self._locators[GEOIP2_WEBSERVICE_TAG] = webservice_locator
def _add_local_database_locator(self):
"""
:return: None
"""
local_db_locator = LocalDatabaseGeoLocator(self._configuration)
self._locators[GEOIP2_LOCAL_TAG] = local_db_locator
@property
def geoip2_webservice(self):
"""
:return: GeoIPLocateor to query GeoIP webservice.
:rtype: WebServiceGeoLocator
:raises: GeoIP2WebServiceNotConfigured
"""
try:
return self._locators[GEOIP2_WEBSERVICE_TAG]
except KeyError:
raise GeoIP2WebServiceNotConfigured()
@property
def geoip2_local(self):
return self._locators[GEOIP2_LOCAL_TAG]
[docs] def locate(self, ip):
""" Query enabled locators in preference order until getting any
geodata.
:param ip: IP address to look for.
:type ip: IP address string.
:return: Location data for that address.
:rtype: geoip2.models.City
"""
for locator_id in self._locators_preference:
# TODO: Try to disable webservice to see if this is really working.
try:
locator = self._locators[locator_id]
geodata = locator.locate(ip)
except:
continue
else:
break
else:
raise exceptions.IPNotFound(ip)
return geodata
[docs]class GeoLocator(metaclass=abc.ABCMeta):
@abc.abstractmethod
[docs] def __init__(self, configuration):
self._configuration = configuration
self._db_connection = None
[docs] def locate(self, ip):
""" Get geolocation data from database.
:param ip: IP address we are asking about.
:type ip: str
:raises: geoip2.errors.AddressNotFoundError
:return: Geolocation data.
:rtype: geoip2.models.City
"""
geolocation_data = self._db_connection.city(ip)
return geolocation_data
[docs]class WebServiceGeoLocator(GeoLocator):
[docs] def __init__(self, configuration):
"""
:param configuration: Geolocate configuration.
:type configuration: config.Configuration
:return: None
"""
super().__init__(configuration)
self._db_connection = webservice.Client(configuration.user_id,
configuration.license_key)
[docs]class LocalDatabaseGeoLocator(GeoLocator):
[docs] def __init__(self, configuration):
"""
:param configuration: Geolocate configuration.
:type configuration: config.Configuration
:return: none
:raise: LocalDatabaseNotFound
:raise: InvalidLocalDatabase
"""
super().__init__(configuration)
self._update_db()
db_path = configuration.local_database_path
self._db_connection = _open_local_database(db_path)
def _update_db(self):
""" Download a fresh geolocation database if current is too old.
:return: None
"""
if self._local_database_too_old():
self._download_fresh_database()
def _local_database_too_old(self):
"""
:return: True if database file has to be refreshed, False if not.
:rtype: bool
"""
database_path = self._configuration.local_database_path
update_interval = self._configuration.update_interval
try:
last_modification = _get_database_last_modification(database_path)
except LocalDatabaseNotFound:
return True # This should force a database download.
else:
today_date = datetime.date.today()
allowed_age = datetime.timedelta(days=update_interval)
return _must_be_updated(today_date, last_modification, allowed_age)
def _download_fresh_database(self):
""" Download compressed database, decompress it and place it instead
old one.
:return: None
"""
with tempfile.TemporaryDirectory() as temporary_directory:
print("Downloading fresh geolocation database...")
self._download_file(temporary_directory)
try:
_decompress_file(temporary_directory)
except CompressedFileNotFound as e:
_print_compressed_file_not_found_error(e)
else:
self._write_new_database(temporary_directory)
def _download_file(self, temporal_directory):
"""
:param temporal_directory: Folder path to place downloaded file in.
:type temporal_directory: str
:return: None
"""
wget.download(url=self._configuration.download_url,
out=temporal_directory)
def _remove_old_database(self):
"""
:return: None
"""
database_path = self._configuration.local_database_path
os.remove(database_path)
def _write_new_database(self, temporary_directory):
"""
:param temporary_directory: Folder path to place downloaded file in.
:type temporal_directory: str
:return: None
"""
try:
self._remove_old_database()
except FileNotFoundError:
print("\nOld local database not found. May be this is the "
"first time you run geolocate?.")
self._copy_new_database(temporary_directory)
def _copy_new_database(self, decompressed_file_path):
"""
:param decompressed_file_path: Folder where new database is placed.
:type decompressed_file_path: str
:return: None
"""
database_path = self._configuration.local_database_path
new_database_path = _get_new_database_path_name(decompressed_file_path)
shutil.copyfile(new_database_path, database_path)
def _decompress_file(temporary_directory):
""" Decompress tar.gz file found in temporary_directory.
:param temporary_directory: Folder path to compressed file.
:type temporary_directory: str
:return: Path to decompressed folder.
:rtype: str
"""
try:
compressed_file_name_path = _find_compressed_file(temporary_directory)
uncompressed_file_name_path = _get_uncompressed_file_name_path(compressed_file_name_path)
except CompressedFileNotFound as e:
_print_compressed_file_not_found_error(e)
else:
with gzip.open(compressed_file_name_path, "rb") as input_file, \
open(uncompressed_file_name_path, "wb") as output_file:
uncompressed_content = input_file.read()
output_file.write(uncompressed_content)
return compressed_file_name_path
def _find_compressed_file(temporary_directory):
""" Find .gz file name downloaded to temporary directory.
:param temporary_directory: Folder to search compressed file in.
:type temporary_directory: str
:return: Absolute path name of found file.
:rtype: str
:raise: CompressedFileNotFound
"""
for file_name in os.listdir(temporary_directory):
if file_name.endswith(".gz"):
file_name_path = os.path.join(temporary_directory, file_name)
return file_name_path
else:
raise CompressedFileNotFound(temporary_directory)
def _get_uncompressed_file_name_path(compressed_file_name_path):
""" Get file name compressed in .gz file.
:param compressed_file_name_path: Compressed file name absolute path.
:type compressed_file_name_path: str
:return: File name compressed into .gz file.
:rtype: str
"""
uncompressed_file_name_path = os.path.splitext(compressed_file_name_path)[0]
return uncompressed_file_name_path
def _open_local_database(local_database_path):
try:
database_connection = database.Reader(local_database_path)
except FileNotFoundError:
raise LocalDatabaseNotFound(local_database_path)
except maxminddb.InvalidDatabaseError:
raise InvalidLocalDatabase(local_database_path)
else:
return database_connection
def _get_database_last_modification(database_path):
"""
:param database_path: Path to database file to be evaluated.
:type database_path: str
:return: Date of file's last modification.
:rtype: datetime.date
"""
try:
last_modification = os.stat(database_path).st_mtime
except FileNotFoundError:
raise LocalDatabaseNotFound(database_path)
else:
date_last_modification = datetime.date.fromtimestamp(last_modification)
return date_last_modification
def _must_be_updated(today_date, last_modification, allowed_age):
"""
:param today_date: Today's date.
:type today_date: datetime.date
:param last_modification: Date of file's last modification.
:type last_modification: datetime.date
:param allowed_age: Maximum age allowed between today and last modification.
:type allowed_age: datetime.timedelta
:return: True if last modification is older than allowed age; else False.
:rtype: bool
"""
if today_date - last_modification > allowed_age:
return True
else:
return False
def _get_new_database_path_name(decompressed_file_path):
"""
:param decompressed_file_path: Temporary folder path where new database is.
:type decompressed_file_path: str
:return: Temporary folder with database filename and extension appended.
:rtype: str
"""
decompressed_files = os.listdir(decompressed_file_path)
for file in decompressed_files:
if file.endswith(DEFAULT_DATABASE_FILE_EXTENSION):
new_database_path_name = os.path.join(decompressed_file_path, file)
return new_database_path_name
else:
raise NotValidDatabaseFileFound(decompressed_file_path)
def _print_compressed_file_not_found_error(e):
"""
:param e: Exception caught.
:type e: CompressedFileNotFound
:return: none
"""
print("Problem decompressing updated database.")
path = e.compressed_database_path
message = "No .gz file found at {0}".format(path)
print(message)
[docs]class LocalDatabaseNotFound(OSError):
""" Local database file is missing."""
[docs] def __init__(self, local_database_path):
self.local_database_path = local_database_path
message = "Local database file is missing"
OSError.__init__(self, message)
[docs]class InvalidLocalDatabase(Exception):
""" Local database exists but is corrupted. """
[docs] def __init__(self, local_database_path):
self.local_database_path = local_database_path
message = "Local database is invalid."
Exception.__init__(self, message)
[docs]class NotValidDatabaseFileFound(OSError):
""" Raised when a new database pack is downloaded on local, but after
decompression no valid database file is found in decompressed folder.
"""
[docs] def __init__(self, decompressed_database_path):
self.decompressed_database_path = decompressed_database_path
message = "No valid database found in downloaded file."
OSError.__init__(self, message)
[docs]class CompressedFileNotFound(OSError):
""" Raised when no .gz compressed file is found in temporary folder where
downloaded data is placed.
"""
[docs] def __init__(self, compressed_database_path):
self.compressed_database_path = compressed_database_path
message = "No compressed file found in downloaded data."
OSError.__init__(self, message)


Created by Sylvestre Antoine
Pry-byebug is a mix beetween 2 tools :
This two gems let you :
Kill N+1 queries and unused eager loading.
Displays speed badge for every html page.
Static ruby code analyzer.
For people who can't use CodeClimate


Toll Road
East Coast Road (ECR) from Chennai to Pondicherry
Chennai Bye Pass Road from Irumbuliyur, Chennai to NH4 Madhavaram, Chennai
Chennai ECR - Sholinganallur Road from ECR, Chennai to Sholinganallur, Chennai
Chennai OMR - Medavakkam Road from Sholinganallur, Chennai to Medavakkam, Chennai
NH 47 Salem to Coimbatore Expressway / Industrial Corridor
NH 67 Coimbatore to Trichy
NH 7 Hosur to Krishnagiri
NH 4 Krishnagiri to Chennai
NH 45 Chennai to Villupuram
NH 7 Krishnagiri to Salem
NH 45B Madurai to Tuticorin
NH 45 Dindigul to Trichy
NH 45 Villupuram to Trichy
NH 7 Salem to Madurai
NH 7A Tirunelveli to Tuticorin
Chennai to Ennore Express Way (Inner Ring Road & Manali Oil Refinery Rd.)
NH 45B Madurai to Trichy
Vehicle
Motorised Three Wheelers
Car
Light Commercial Vehicles
Truck
Bus
Multi Axle Vehicles
cloud
Proceed To Pay


Rasha Ibrahim Al-Qayyam
<EMAIL_ADDRESS>Personal Profile: Computer science, Fresh graduation, mobile application development, self-learning, leader skills. I am seeking a responsible job that requires my skills and knowledge in the company, which I can identify with.
Training -Nov 2020- Jan.2021) Al Hussein Technical University, National ICT Up-Skilling Program. An intensive program, focusing on applied technical and employability skills, including: - Flutter: (180 Hours): Dart Basics, Flutter Basics, State Management - [Provider], API with Firebase. - English language (100 Hours): Rreport and an email writing, presentations skills, conducting conversations in English, developing listening and writing skills. - Soft skills: (80 Hours): life and employability skills, such as time management, positive attitude, communication skills Self-knowledge and goal setting.
Skills: Personal& Technical skills: - Communication skill - solving problems- Interpersonal skill Hobbies or Interests: - Writing a novel and reading. - Artificial intelligence


Congratulations to the Prime Minister on his announcement today. @TurnbullMalcolm pic.twitter.com/lANrBSmhlR
— Cory Bernardi (@corybernardi) July 29, 2016
Keep Cory Bernardi out of #ME plebiscite debate, stop Lisa complaining about preselection:Send them to UN. Wrong way to select UN trips.
— Christine Milne (@ChristineMilne) July 29, 2016


SFO airport by BART? Watch your wallet!
17 May 2012In one of my visualization projects, I felt curiosity to visualize the fares between BART stations. I was shocked by how much it costs to go to San Francisco airport by BART.
One possibility to have a visual representation is by using a graph network. In this case, the nodes of the graph represent the stations, while the fares are represented by the edges. The pricier a fare, the thicker and brighter its corresponding edge. As you can tell from the previous graph, the SFO Int'l Airport station has the thicker and reddish edges, meaning it is the most expensive one.


Name *
Your parents gave you a beautiful name, Shout it loud by writing it in "CAPITALS".
Roll No. *
Email *
We don't Spam, It's mentioned in our constitution :P
MESS Grievances
Do you have complaints related to mess? Yes you are at the right place.. :)
Mess Grievance Description
Please describe your Grievance (Fill only if you have chosen Mess Grievance, Ignore otherwise)
PREMISES
Premise Grievance Category
Only for Hostels and Faculty Quarters
Premise Grievance Description
Please Describe Your Grievance


| DOSE: T+ 0:00 |
97 mg |
insufflated |
DPT |
(powder / crystals) |
| T+ 0:43 |
59 mg |
insufflated |
DPT |
(powder / crystals) |
(This is a sequal to the Mind Inside-Out experience posted on Erowid).
I am back for a repeat DPT experience. I have been thinking a lot about my virgin experience and how much I would like to repeat it. Or maybe make it slightly different. Always seeking novelty. I am already thinking about drug combinations that might be good with DPT. Or other tryptamines I might want to try. But not tonight. I need to repeat the pleasant experience I had last time to gain confidence in this area.
I plan to do roughly the same dosage as last time, but all in one shot. Also, I will err on the side of too much, to make sure I donít get cheated out of an intense experience. I took 3/8 of my stash last time (about 93.75 mg), which leaves me with about 156.25 mg. Dividing piles in half is the easiest to do by eye, so I am compelled to do a fraction of my stash that has a denominator thatís a power of 2. If I do 5/8 of whatís left, thatíll be about 97.65 mg. Sounds good.
I am not in a crazy great mood, but I think itís OK. My shoulder has hurt all week, presumably from tearing apart the barn. Iíve been a little upset about being so busy, but not really depressed or anything. I am looking forward to a little R&R tonight. Or at least a vacation from real life.
T-0 is 8:59 pm. I do the 97 mg in two lines, one up each nostril.
I have Deep Forest on the speakers; I will put AcidWarp on the screen. I will meditate to the music until something happens.
I want to try to stay aware at the transition into the peak. I have some blank periods near the beginning of the last trip. I was feeling almost nothing. Then I went to sit down. I looked at Raggedy Ann & Andy as their eyes and mouths started flickering and shifting and changing shapes and colors. Then the next thing I knew I was coming out of the peak. I donít remember coming into the peak.
I am going to go now.
See you later. I love you.
9:10. Onset was fast. Drip. Auditory echoing. Mind shifting, changing shape. Itís weird to meditate while this diffusion is happening, because I can experience it in minute detail.
I am shivering now. I feel cold. I will put on my sweatshirt. I guess I am feeling the tremor. It is more subtle than I expected. I think it is an actual muscle twitch, not just a feeling. Like a shiver. I get it in my hands, arms, and legs. Itís not unpleasant. It feels kind of good, actually. Not like feeling cold, really. More like having a fever. One of those fevers where you feel cold. I guess I like the feeling of having a fever. It feels kind of good. Kind of like this.
9:15. Subtle visual distortions are starting as tremor gets more pronounced.
This fever feeling is turning into the gut pleasure I enjoyed so much last time.
Got to go enjoy this. Bye.
9:20. I am still in full control of my wits. I just went upstairs to fetch a thermometer because I was really curious about what my actual temperature is. All the items on the screen are starting to wiggle and my tremor is pretty bad, like the worst fever Iíve ever had.
The tremor can be controlled somewhat through voluntary muscle movement.
Oral Temperature: 98.2 degrees F. The bodyís a weird thing. I feel freezing.
9:28. Almost all physical so far. The similarities to a fever are frightening. Itís really just the same. I am thinking as I try to find a comfortable position for my muscles to be in, ďthis feels just like having a feverĒ. I will have to remember, the next time I have a fever, to think ďhey, this feels just like being on DPTĒ.
Hey, itís been 30 minutes and I am still on planet earth. At what point will I consider boosting my dose? For last time, I donít know what part of the onset curve was from boosting, and what from waiting.
I couldnít have built up tolerance this quickly, could I? I could also have misjudged my dose. There was probably some waste each time that could mean I got less than I thought. Donít rationalize. If you want to do the rest, just do it.
Wait. It may be happening without a boost. Then again, I felt almost sober for a second there. But doing the rest of it could be pretty wild. Not enough is happening. I am going to do more. I donít need to do ďthe restĒ. Just a line.
9:42. I did the rest.
Almost right away, things seem to be taking on a more luminous, echoing quality and my tremors have increased. This document is becoming more abstract and irrelevant.
The thermometer got to 100.0 degrees and then stopped working. I donít know if time has stopped or I forgot how to hold it.
Typing is becoming increasingly futile.  I remember this from last time, although it went unexpressed in the report.
9:52. Starting to dissolve into the DPT world.
9:56. Music distracting. Turned it off. Very luminous, big fever tremors. Just moving muscles, sitting there dissolving is enough. Will try to stretch muscles, see how that feels.
10:29. Iíve remained much more in control this time.
Itís hard to find a comfortable position. My muscles donít know whether they want to stretch or curl up. Most of the thoughts were about moving my body around. We really spend most of our time rearranging our meat so that it can be in a certain place so we can have a mental experience.
But really, itís about where everyoneís meat is. And itís everywhere.
Extremes of emotion are also here. Hard theyíre not already here. They come in a tightening spiral. I can control. But now the metaphor machineís coming in fast.
Truer than all truths [is one spiral]. Why must it be so much?
I feel like trying to stay aware is bringing me down. I guess alternatively, I just let go and it would be kind of like going to sleep almost.
I havenít let go of awareness once yet. I wonder what would happen if I did. How would I get it back?
I feel a little strange right now. Besides the shivering meat that the metaphor machine is trying to rearrange, thereís the matter of the cloutest of the cloutest hearts. Itís about riding that spiral all the way down.
My body is sagging. Itís my efforts at self-representation that keep me alive. Or awake. I feel like I might be able to go to sleep. It seems independent of the trip. Itís not really a speedy feeling, just the fever twitch.
 [Love interest] was there playing with me as a thing.
Sometimes if I let myself go, all I get is lots of metaphors about how everybodyís cream cheese (their meat) needs to be moved around. It needs to go somewhere while we have these mental experiences. Itís such an incredible bother to always have these hunks of meat tied to us wherever we go.
My mind is still worried about where to put my meat, but what would it be doing anyway if it had its own mind to make up about what to do?
I am definitely not tripping as much as last time. Holding attention has been part of it. However, there just isnít as much of that organic dissolving that I had last time.
I feel that there is nothing besides my consciousness and unconsciousness. That sounds trivial, but I always thought that tripping was very different somehow. Maybe it is, but it doesnít seem that special right now.
Maybe this drug isnít worth repeating after all.
Maybe I can have some fun with it if I lie down in bed and let it run.
Moving around feels pretty good. If I lied down and went to sleep, it would be giving in to shivering and whatever my mind wants to do. I might try to stay conscious and fall asleep.
I want to sleep in my bed. It may be more difficult to keep a record of my thoughts up there. 11:12.
The rolling last time was letting the metaphor machine run, but I wonít let it run now because itís really boring!
Consciousness is more interesting than constant complaining about somebody elseís meat overlapping with yours.
Moving and stretching feels good.
I think I should try to sleep.
1:00. I am having a little trouble sleeping. Partly it is trying to experience it consciously. Also, I am hot and there are mice chewing in the walls. I am hungry, too. I got up, turned the fan on, and came downstairs. I am making decaf Green Tea, and eating almonds. They are really satisfying. Funny how most things that are almond-flavored donít taste anything like almonds. They taste like sugar mostly.
My tea is ready.
I took some melatonin and set an alarm. I am not sleepy. Maybe I will put the relaxation tape on.
1:20. I am enjoying the experience of sitting in my blue space-out chair in my bedroom and resting my hot tea on my genitals between sips. This is a nice experience to have, and I am grateful to my body and the universe for providing it.
The first time, I was totally passive and let the unconscious metaphor machine dominate my brain. Quickly, I forgot what the metaphors were about, and I just enjoyed letting them ring out their reverberating thought patterns. Mostly they were about the meat, and I couldnít even remember that for my last trip report.
This time, I made an extreme effort to be totally conscious of everything. This diminished the experience compared to last time, particularly since much of it was unconscious last time. However, it has deepened my practice immensely. The exercise in mindfulness was very rich and satisfying.
I think Iím totally done with DPT. Once it was closely examined, it was not as pleasurable as I thought, and it was kind of boring. Just repetitive metaphors. I am looking for something more psychological, more spatial.
9:25 am. I had lots of trouble getting to sleep, and I think it must have been almost 3:00 before I achieved it. Nonetheless, I got up at 8:30 with my alarm, and I donít feel bad. I feel kind of peaceful, as the sense of depth of my consciousness has carried over from last night.
Need to think more about this experience and what it means. Will talk it over with [friend] in the car.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


FERROR
Section: Linux Programmer's Manual (3)
Updated: 2014-01-15
Index
Return to Main Contents
NAME
clearerr, feof, ferror, fileno - check and reset stream status
SYNOPSIS
#include <stdio.h>
void clearerr(FILE *stream);
int feof(FILE *stream);
int ferror(FILE *stream);
int fileno(FILE *stream);
Feature Test Macro Requirements for glibc (see
feature_test_macros(7)):
fileno():
_POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE
DESCRIPTION
The function
clearerr()
clears the end-of-file and error indicators for the stream pointed to by
stream.
The function
feof()
tests the end-of-file indicator for the stream pointed to by
stream,
returning nonzero if it is set.
The end-of-file indicator can be cleared only by the function
clearerr().
The function
ferror()
tests the error indicator for the stream pointed to by
stream,
returning nonzero if it is set.
The error indicator can be reset only by the
clearerr()
function.
The function
fileno()
examines the argument
stream
and returns its integer descriptor.
For nonlocking counterparts, see
unlocked_stdio(3).
ERRORS
These functions should not fail and do not set the external variable
errno.
(However, in case
fileno()
detects that its argument is not a valid stream, it must
return -1 and set
errno
to
EBADF.)
ATTRIBUTES
Multithreading (see pthreads(7))
The
clearerr(),
feof(),
ferror(),
and
fileno()
functions are thread-safe.
CONFORMING TO
The functions
clearerr(),
feof(),
and
ferror()
conform to C89, C99, POSIX.1-2001, and POSIX.1-2008.
The function
fileno()
conforms to POSIX.1-2001 and POSIX.1-2008.
SEE ALSO
open(2),
fdopen(3),
stdio(3),
unlocked_stdio(3)
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- ERRORS
-
- ATTRIBUTES
-
- Multithreading (see pthreads(7))
-
- CONFORMING TO
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 02:55:12 GMT, September 18, 2014


Custom Elements TS
Create native custom elements using Typescript without using any third party libraries
Get Started
zero dependencies
framework agnostic
small bundle size
Go to github


Home
(current)
Md. Shahnawaz Ahmed
Asst. Manager, bKash Limited
Masters (Statistics), JNU
BSc. (CSE), BU
Product Manager (Payment)
A Father
Full Stack Developer
UI/UX
And more...
7+ Years of experience
Download Resume
Contact me
BRANDS, WHICH ARE RELATED TO MY WORKS


Note: Admin will collect the feedback/message in the form of a mail. Sender will be getting a copy of his/her message or feedback. No database is used. It uses PHP mail () Function to send messages. Easiest and fastest contact us form using php. Post method is used for more secure connection.


Life is a long distance race - PhD Colleague Brian Duncan
All about John
Applied computation
Courses John teaches.
Some of John's talks.