| Warning |
| This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk. |
SOAP extension can be used to write SOAP Servers and Clients. It supports subsets of SOAP 1.1, SOAP 1.2 and WSDL 1.1 specifications.
The behaviour of these functions is affected by settings in php.ini.
| Name | Default | Changeable |
|---|---|---|
| soap.wsdl_cache_enabled | "1" | PHP_INI_ALL |
| soap.wsdl_cache_dir | "/tmp" | PHP_INI_ALL |
| soap.wsdl_cache_ttl | 86400 | PHP_INI_ALL |
| Constant | Value | Description |
|---|---|---|
| SOAP_1_1 (integer) | 1 | SOAP version - SOAP 1.1. Can be used as an option in SoapClient and SoapServer constructors. |
| SOAP_1_2 (integer) | 2 | SOAP version - SOAP 1.2. Can be used as an option in SoapClient and SoapServer constructors. |
| SOAP_FUNCTIONS_ALL (integer) | 999 | Allows to export all defined functions with SoapClient::addFunction |
| SOAP_PERSISTENCE_SESSION (integer) | 1 | Allows making class passed to SoapServer::setClass persistent for a PHP session. |
| SOAP_PERSISTENCE_REQUEST (integer) | 2 | Allows making class passed to SoapServer::setClass non-persistent for a PHP session. |
| SOAP_ENCODED (integer) | 1 | Can be passed as style option to SoapClient constructor in nonWSDL mode. |
| SOAP_LITERAL (integer) | 2 | Can be passed as style option to SoapClient constructor in nonWSDL mode. |
| SOAP_RPC (integer) | 1 | Can be passed as use option to SoapClient constructor in nonWSDL mode. |
| SOAP_DOCUMENT (integer) | 2 | Can be passed as use option to SoapClient constructor in nonWSDL mode. |
| SOAP_ACTOR_NEXT (integer) | 1 | Can be passed as actor to SoapHeader constructor. |
| SOAP_ACTOR_NONE (integer) | 2 | Can be passed as actor to SoapHeader constructor |
| SOAP_ACTOR_UNLIMATERECEIVER (integer) | 3 | Can be passed as actor to SoapHeader constructor |
| UNKNOWN_TYPE (integer) | 999998 | Encoding for unknown type. Can be passed to SoapVar constructor. |
| XSD_STRING (integer) | 101 | Encoding for standard XMLSchema string type. Can be passed to SoapVar constructor. |
| XSD_BOOLEAN (integer) | 102 | Encoding for standard XMLSchema boolen type. Can be passed to SoapVar constructor. |
| XSD_DECIMAL (integer) | 103 | Encoding for standard XMLSchema decimal type. Can be passed to SoapVar constructor. |
| XSD_FLOAT (integer) | 104 | Encoding for standard XMLSchema float type. Can be passed to SoapVar constructor. |
| XSD_DOUBLE (integer) | 105 | Encoding for standard XMLSchema double type. Can be passed to SoapVar constructor. |
| XSD_DURATION (integer) | 106 | Encoding for standard XMLSchema duration type. Can be passed to SoapVar constructor. |
| XSD_DATETIME (integer) | 107 | Encoding for standard XMLSchema dateTime type. Can be passed to SoapVar constructor. |
| XSD_TIME (integer) | 108 | Encoding for standard XMLSchema time type. Can be passed to SoapVar constructor. |
| XSD_DATE (integer) | 109 | Encoding for standard XMLSchema data type. Can be passed to SoapVar constructor. |
| XSD_GYEARMONTH (integer) | 110 | Encoding for standard XMLSchema gYearMonth type. Can be passed to SoapVar constructor. |
| XSD_GYEAR (integer) | 111 | Encoding for standard XMLSchema gYear type. Can be passed to SoapVar constructor. |
| XSD_GMONTHDAY (integer) | 112 | Encoding for standard XMLSchema gMonthDay type. Can be passed to SoapVar constructor. |
| XSD_GDAY (integer) | 113 | Encoding for standard XMLSchema gDay type. Can be passed to SoapVar constructor. |
| XSD_GMONTH (integer) | 114 | Encoding for standard XMLSchema gMonth type. Can be passed to SoapVar constructor. |
| XSD_HEXBINARY (integer) | 115 | Encoding for standard XMLSchema hexBinary type. Can be passed to SoapVar constructor. |
| XSD_BASE64BINARY (integer) | 116 | Encoding for standard XMLSchema base64Binary type. Can be passed to SoapVar constructor. |
| XSD_ANYURI (integer) | 117 | Encoding for standard XMLSchema anyURI type. Can be passed to SoapVar constructor. |
| XSD_QNAME (integer) | 118 | Encoding for standard XMLSchema QName type. Can be passed to SoapVar constructor. |
| XSD_NOTATION (integer) | 119 | Encoding for standard XMLSchema NOTATION type. Can be passed to SoapVar constructor. |
| XSD_NORMALIZEDSTRING (integer) | 120 | Encoding for standard XMLSchema normalizedString type. Can be passed to SoapVar constructor. |
| XSD_TOKEN (integer) | 121 | Encoding for standard XMLSchema token type. Can be passed to SoapVar constructor. |
| XSD_LANGUAGE (integer) | 122 | Encoding for standard XMLSchema language type. Can be passed to SoapVar constructor. |
| XSD_NMTOKEN (integer) | 123 | Encoding for standard XMLSchema NMTOKEN type. Can be passed to SoapVar constructor. |
| XSD_NAME (integer) | 124 | Encoding for standard XMLSchema Name type. Can be passed to SoapVar constructor. |
| XSD_NCNAME (integer) | 125 | Encoding for standard XMLSchema NCName type. Can be passed to SoapVar constructor. |
| XSD_ID (integer) | 126 | Encoding for standard XMLSchema ID type. Can be passed to SoapVar constructor. |
| XSD_IDREF (integer) | 127 | Encoding for standard XMLSchema IDREF type. Can be passed to SoapVar constructor. |
| XSD_IDREFS (integer) | 128 | Encoding for standard XMLSchema IDREFS type. Can be passed to SoapVar constructor. |
| XSD_ENTITY (integer) | 129 | Encoding for standard XMLSchema ENTITY type. Can be passed to SoapVar constructor. |
| XSD_ENTITIES (integer) | 130 | Encoding for standard XMLSchema ENTITIES type. Can be passed to SoapVar constructor. |
| XSD_INTEGER (integer) | 131 | Encoding for standard XMLSchema integer type. Can be passed to SoapVar constructor. |
| XSD_NONPOSITIVEINTEGER (integer) | 132 | Encoding for standard XMLSchema nonPositiveInteger type. Can be passed to SoapVar constructor. |
| XSD_NEGATIVEINTEGER (integer) | 133 | Encoding for standard XMLSchema negativeInteger type. Can be passed to SoapVar constructor. |
| XSD_LONG (integer) | 134 | Encoding for standard XMLSchema long type. Can be passed to SoapVar constructor. |
| XSD_INT (integer) | 135 | Encoding for standard XMLSchema int type. Can be passed to SoapVar constructor. |
| XSD_SHORT (integer) | 136 | Encoding for standard XMLSchema short type. Can be passed to SoapVar constructor. |
| XSD_BYTE (integer) | 137 | Encoding for standard XMLSchema byte type. Can be passed to SoapVar constructor. |
| XSD_NONNEGATIVEINTEGER (integer) | 138 | Encoding for standard XMLSchema nonNegativeInteger type. Can be passed to SoapVar constructor. |
| XSD_UNSIGNEDLONG (integer) | 139 | Encoding for standard XMLSchema unsignedLong type. Can be passed to SoapVar constructor. |
| XSD_UNSIGNEDINT (integer) | 140 | Encoding for standard XMLSchema unsignedInt type. Can be passed to SoapVar constructor. |
| XSD_UNSIGNEDSHORT (integer) | 141 | Encoding for standard XMLSchema unsignedShort type. Can be passed to SoapVar constructor. |
| XSD_UNSIGNEDBYTE (integer) | 142 | Encoding for standard XMLSchema unsignedByte type. Can be passed to SoapVar constructor. |
| XSD_POSITIVEINTEGER (integer) | 143 | Encoding for standard XMLSchema positiveInteger type. Can be passed to SoapVar constructor. |
| XSD_NMTOKENS (integer) | 144 | Encoding for standard XMLSchema NMTOKENS type. Can be passed to SoapVar constructor. |
| XSD_ANYTYPE (integer) | 145 | Encoding for standard XMLSchema anyType type. Can be passed to SoapVar constructor. |
| SOAP_ENC_ARRAY (integer) | 300 | Encoding for SOAP Array type. Can be passed to SoapVar constructor. |
| SOAP_ENC_OBJECT (integer) | 301 | Encoding for SOAP Struct type. Can be passed to SoapVar constructor. |
| XSD_1999_TIMEINSTANT (integer) | 401 | Encoding for old XMLSchema timeInstant type. Can be passed to SoapVar constructor. |
| XSD_NAMESPACE (string) | The XML Schema namespace. | |
| XSD_1999_NAMESPACE (string) | The old XML Schema namespace. |
| SoapClient |
| SoapServer |
| SoapParam |
| SoapVar |
| SoapHeader |
| SoapFault |
| SoapClient -- SoapClient constructor |
| __call -- calls a SOAP function |
| __getLastRequest -- returns last SOAP request |
| __getLastResponse -- returns last SOAP response |
| __getFunctions -- returns list of SOAP functions |
| __getTypes -- returns list of SOAP types |
| SoapServer -- SoapServer constructor |
| addFunction -- adds one or several functions those will handle SOAP requests |
| setClass -- sets class which will handle SOAP requests |
| getFunctions -- returns list of defined functions |
| setPersistence -- sets persistence mode of SoapServer |
| handle -- handles a SOAP request |
SoapParam is a special low-level class for naming parameters and return values in nonWSDL mode. It is just a data holder and it has not any special method except constructor.
| SoapParam -- SoapParam constructor |
SoapVar is a special low-level class for encoding parameters and return values in nonWSDL mode. It is just a data holder and it has not any special method except constructor. It is useful when you like to set type property in SOAP request or response.
| SoapVar -- SoapVar constructor |
SoapHeader is a special low-level class for passing or returning SOAP headers. It is just a data holder and it has not any special method except constructor.
| SoapHeader -- SoapHeader constructor |
SoapFault is a special class that can be used for error reporting during handling of SOAP request. It is derived form standard PHP Exception class, so it can be used to throw exceptions in server side and to catch tham on client side.
| SoapFault -- SoapFault constructor |
| is_soap_fault -- checks if SOAP call was failed |
| SoapClient::SoapClient -- SoapClient constructor |
| SoapClient::__call -- calls a SOAP function |
| SoapClient::__getLastRequest -- returns last SOAP request |
| SoapClient::__getLastResponse -- returns last SOAP response |
| SoapClient::__getFunctions -- returns list of SOAP functions |
| SoapClient::__getTypes -- returns list of SOAP types |
| SoapServer::SoapServer -- SoapServer constructor |
| SoapServer::addFunction -- adds one or several functions those will handle SOAP requests |
| SoapServer::setClass -- sets class which will handle SOAP requests |
| SoapServer::getFunctions -- returns list of defined functions |
| SoapServer::setPersistence -- sets persistence mode of SoapServer |
| SoapServer::handle -- handles a SOAP request |
| SoapParam::SoapParam -- SoapParam constructor |
| SoapVar::SoapVar -- SoapVar constructor |
| SoapHeader::SoapHeader -- SoapHeader constructor |
| SoapFault::SoapFault -- SoapFault constructor |
(PHP 5)
checks if SOAP call was failed
bool is_soap_fault(mixed obj)
This function is useful when you like to check if the SOAP call was failed,
but don't like to use exceptions. To use it you must create SoapClient object
with exceptions option set to zero or false. In this case SOAP method
will return a special SoapFault object which encapsulate the fault details
(faultcode, faultstring, faultactor and faultdetails). If exceptions is
not set then SOAP call will throw an exception on error.
is_soap_fault() functions checks if the given parameter is a SoapFault object.
<?php $client = SoapClient("some.wsdl",array("exceptions"=>0)); $result = $client->SomeFunction(...); if (is_soap_fault($result)) { trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faulstring})", E_ERROR); } ?> |
Standard method that used by SOAP extension for error reporting is excptions.
<?php try { $client = SoapClient("some.wsdl"); $result = $client->SomeFunction(...); } catch (SoapFault $fault) { trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faulstring})", E_ERROR); } ?> |
(PHP 5)
SoapClient constructor
SoapClient(mixed wsdl [, array options])
The constructor allows creating SoapClient objects in WSDL or nonWSDL mode. The first case requires URI of WSDL file as first parameter and optional options array. The second case requires NULL as first parameter and options array with location and uri options set. Where location is a URL to request and uri is a target namespace of the SOAP service. style and use options has effect only on nonWSDL (in WSDL mode they comes from WSDL file). soap_version option allows to work as SOAP 1.1 or SOAP 1.2 client. Some additional optional options allow using HTTP authentication (login and password) and HTTP connection through proxy server (proxy_host, proxy_port, proxy_login and proxy_password).
$client = new SoapClient("some.wsdl"); $client = new SoapClient("some.wsdl",array('soap_version' => SOAP_1_2)); $client = new SoapClient("some.wsdl",array('login' => "some_name", 'password' => "some_password")); $client = new SoapClient("some.wsdl",array('proxy_host' => "localhost", 'proxy_port' => 8080)); $client = new SoapClient("some.wsdl",array('proxy_host' => "localhost", 'proxy_port' => 8080, 'proxy_login' => "some_name", 'proxy_password' => "some_password")); $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/", 'style' => SOAP_DOCUMENT, 'use' => SOAP_LITERAL)); |
(PHP 5)
calls a SOAP function
mixed __call(string function_name, array arguments, [array options [, mixed input_headers [, mixed &output_headers]]])
This is a low level API function to make a SOAP call. Usually in WSDL mode
you can simple call SOAP functions as SoapClient methods. It is useful for
nonWSDL mode when 'soapaction' is unknown, 'uri' is differ form default or
when ypu like to send and/or receive SOAP Headers. To check if function call
is failed check the result with is_soap_fault() function.
SOAP function may return one or several values. In the first case __call will
return just the value of output parameter, in the second it will return
array with named output parameters.
$client = new SoapClient("some.wsdl"); $client->SomeFunction($a,$b,$c); $client->__call("SomeFunction",array($a,$b,$c)); $client->__call("SomeFunction",array($a,$b,$c), NULL, new SoapHeader(...), $output_headers); $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client->SomeFunction($a,$b,$c); $client->__call("SomeFunction",array($a,$b,$c)); $client->__call("SomeFunction",array($a,$b,$c), array('soapaction' => 'some_action', 'uri' => 'some_uri')); |
(PHP 5)
returns last SOAP request
string __getLastRequest()
This function works only with SoapClient which was created with trace option.
<?php $client = SoapClient("some.wsdl", array('trace'=>1)); $result = $client->SomeFunction(...); echo "REQUEST:\n".$client->__getLastRequest()."\n"; ?> |
(PHP 5)
returns last SOAP response
string __getLastResponse()
This function works only with SoapClient which was created with trace option.
<?php $client = SoapClient("some.wsdl", array('trace'=>1)); $result = $client->SomeFunction(...); echo "RESPONSE:\n".$client->__getLastResponse()."\n"; ?> |
(PHP 5)
returns list of SOAP functions
array __getFunctions()
This function works only in WSDL mode.
<?php $client = SoapClient("some.wsdl"); var_dump($client->__getFunctions()); ?> |
(PHP 5)
returns list of SOAP types
array __getTypes()
This function works only in WSDL mode.
<?php $client = SoapClient("some.wsdl"); var_dump($client->__getTypes()); ?> |
(PHP 5)
SoapServer constructor
SoapServer(mixed wsdl [, array options])
It allows creating SoapServer objects in WSDL or nonWSDL mode. In the first case wsdl must be set to URI of WSDL file. In the second wsdl must be set to null and uti option must be set. Additional options allow setting a default SOAP version (soap_version) and actor URI (actor).$server = new SoapServer("some.wsdl"); $server = new SoapServer("some.wsdl",array('soap_version'=>SOAP_1_2)); $server = new SoapServer("some.wsdl",array('actor'=>"http://example.org/ts-tests/C")); $server = new SoapServer(null,array('uri'=>"http://test-uri/")); |
(PHP 5)
adds one or several functions those will handle SOAP requests
void addFunction(mixed functions)
Exports one or more functions for remote clients. To export one function pass function name into functions parameter as string. To export several functions pass an array of function names and to export all functions pass a special constant SOAP_FUNCTIONS_ALL.function func($inputString) { return $inputString; } $server->addFunction("echoString"); function echoTwoStrings($inputString1, $inputString2) { return array("outputString1"=>$inputString1,"outputString2"=>$inputString2); } $server->addFunction(array("echoString","echoTwoStrings")); $server->addFunction(SOAP_FUNCTIONS_ALL); |
(PHP 5)
sets class which will handle SOAP requests
void setClass(string class_name [, ...])
Exports all methods from specified class. Additional parameters will be passed to default class constructor during object creation. The object can be maiden persistent across request for a given PHP session with SoapServer::setPersistence method.$server->setClass("foo"); $server->setClass("foo", $arg1, $arg2); |
(PHP 5)
returns list of defined functions
array getFunctions()
(PHP 5)
sets persistence mode of SoapServer
void setPersistence(int mode)
This function allows saving data between requests in PHP session. It works only with server that exports functions form class (see SoapServer:setCalss).$server->setpersistence(SOAP_PERSISTENCE_SESSION); $server->setpersistence(SOAP_PERSISTENCE_REQUEST); |
(PHP 5)
handles a SOAP request
void handle([string soap_envelope])
It processes a SOAP request, call necessary functions, and send response back. It assumes request in input parameter or in global $HTTP_RAW_POST_DATA PHP variable if the argument is omitted.<?php function test($x) { return $x; } $server = new SoapServer(null,array('uri'=>"http://test-uri/")); $server->addFunction("test"); $server->handle(); ?> |
(PHP 5)
SoapParam constructor
SoapParam(mixed data, string name)
SoapParam is a special low-level class for naming parameters and return values in nonWSDL mode. It is just a data holder and it has not any special method except constructor. The constructor takes data to pass or return and name. It is possible to pass parameter directly as PHP value, but in this case it will be named as paramN and SOAP Service may not understand it.
<?php $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client->SomeFunction(new SoapParam($a,"a"), new SoapParam($b,"b"), new SoapParam($c,"c")); ?> |
(PHP 5)
SoapVar constructor
SoapVar(mixed data, int encoding [, string type [, string type_ns [, string name [, string name_ns]]]])
SoapVar is a special low-level class for encoding parameters and return values in nonWSDL mode. It is just a data holder and it has not any special method except constructor. It is useful when you like to set type property in SOAP request or response. The constructor takes data to pass or return, encoding ID to encode it (see XSD_... constants) and as option type name and namespace and value name and namespace.
<?php class SOAPStruct { function SOAPStruct($s, $i, $f) { $this->varString = $s; $this->varInt = $i; $this->varFloat = $f; } } $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $struct = new SOAPStruct('arg',34,325.325); $soapstruct = new SoapVar($struct,SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"); $client->echoStruct(new SoapParam($soapstruct, "inputStruct")); ?> |
(PHP 5)
SoapHeader constructor
SoapHeader(string name_ns, string name [, mixed data [, bool must_understand [, mixed actor]]])
SoapHeader is a special low-level class for passing or returning SOAP headers. It is just a data holder and it has not any special method except constructor. It can be used in SoapClient::__call method to pass SOAP header or in SOAP header handler to return header in SOAP response. name_ns and name are namespace and name of the SOAP header element. data is a SOAP header's content. It can be a PHP value or SoapVar object. must_understand and actor are values for mustUnderstand and actor attributes of this SOAP Header element.
<?php $client = new SoapClient(null,array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $client->__call("echoVoid",NULL,NULL, new SoapHeader('http://soapinterop.org/echoheader/', 'echoMeStringRequest', 'hello world')); ?> |
(PHP 5)
SoapFault constructor
SoapFault(string faultcode, string faultstring [, string faultactor [, mixed details [, string faultname [, mixed headerfault]]]])
This class is useful when you like to send SOAP fault response from PHP handler.<?php function test($x) { return new SoapFault("Server","Some error message"); } $server = new SoapServer(null,array('uri'=>"http://test-uri/")); $server->addFunction("test"); $server->handle(); ?> |
It is possible to use PHP exception mechanism to throw SOAP Fault.
<?php function test($x) { throw new SoapFault("Server","Some error message"); } $server = new SoapServer(null,array('uri'=>"http://test-uri/")); $server->addFunction("test"); $server->handle(); ?> |


Set
I have quite a sensitive mind to chemicals. If I don't maintain a tolerance level for alcohol it can drop to the point where one beer will have a noticeable effect, to get stoned I only need a few drags. My previous encounter with LSD was one dud hit a few years back which effected me more then anyone else.
I was back in my home town after a few months away. I had moved to another city where I was busy failing college. I had not maintained a tolerance level for alcohol. I was depressed. In the new city I had found it difficult to make friends I could relax with because my previous friends and I had built one of those internal logic systems of humour and unspoken philosophy without branching out enough.
In the new city I had become introspective with too much time and too much Spliff. Smoking Spliff was making me paranoid. My life had fallen into rituals of image maintainance - fake smiles and laughter.   When I got back I couldn't click with my old friends, things had changed, cocaine had come into the group and they didn't want me to know about it. I got an immediate inferiority complex and started shutting down. I got a stiff-in-my-joints-while-sitting-because-movement-might-betray-my-awkwardness kind of awkwardness. Also, I was feeling guilty for going off to visit my friends without really saying hello to my family.
We were parked at some arb place in the city and there was to be a party at an old friends house which I found myself dreading. Why can't I enjoy this like I'm supposed to?  I thought constantly. I was passed beer in a quart and I found myself getting embarrasingly drunk. I was constantly relating what I was actually doing and saying to what I should've been doing and saying, like some one would ask me a question and I would mumble something inane, the person would move on to find a better vibe quite quickly and I would be left thinking about what I could've and should've said etc.
Not a state in which to smoke a Spliff but when it came around I could not face the task of explaining why I didn't want any. I got bad stoned.  I got some depressing news that the friend we were going to see was now into herion.
Setting
We got to the friends house whose parents were away, his buddies from college and assorted people were there. Our group was a deep house cocaine good vibey loving type of people (and me), there was a harcore tattoo tribal piercing heavy metal type group, and a few yuppie celine dion liking music is not of much importance type group. And some what might be called dirty hippies I guess, I think they were junkies. I feel I was way too analytical in noting these distinctions, but I was in that frame of mind, trying to quantify, understand, reduce.
I bumbled through hellos sat awkwardly and then wump, LSD. 'Hey dude do you have 80 bucks? (South African Rands) It's a bit expensive but the dude has some Hoffmans.  I said and gave the money. I looked at it, put it in my mouth and swallowed it down with beer.
After Iíd swallowed I realised I would much rather be far away from those people, in a bath, reading some really nice book. Escapist thinking. It came on quite quickly, within twenty minutes I was feeling it, and an hour later I was completely wrecked. Everything I wanted to escape from had a crotch which was rubbed in my face.
Equals
I realised I was going to die. The nakedness of the realisation was total, no abstraction whatsoever. You Are Going To Die One Day. It might as well have been within the hour. I saw all my internal organs sitting inside where I still harboured childish notions of internal structure.  GUTS? I thought. I HAVE GUTS INSIDE ME??
My internal organs were there right under a thin flat of skin. This freaked me out. These Guts Will Rot One Day. Fuck. My friends were laughing, delighting in the wonder around them while I was a million miles away.  Your Body.  Dead? Me?   I just didnít have a clue. I tried escaping to the bathroom.
Oh God the mirror in the bathroom. I didn't see myself in the mirror at all, nothing of me was there. No familiar face that Iíve seen each day without concern. How I was moving this was a mystery. It was horror. This covering, thin thin thin covering of skin. And that dripping red flesh moulded onto a white bone skull. A knife could easily peel that away.
(I just want to point out that there was no danger of me harming myself even though I was completely wrecked on LSD. Iím quite positive of it.)
The physics of being able to peel your face off easily are obvious, but I realised the full implications of this possibility. You Can Physically Dismantle a Human Body Into Various Parts. What?? And digging through the pile of guts, 'where are you?' would reveal no little silver glowing orb that was consciousness or spirit.
I realised that right that very second someones body was being sliced open by a murderer.  No Mercy. Although I donít know if it was anywhere near the real horror, I couldnít imagine feeling any worse if I was watching a mauling first hand. Maybe the difference was duration, I would get flashes of the total feeling that I was somewhat able to recoil from.
I got back to the crowd and theyíd moved outside into the freezing cold. My fear of opening up and talking kept all my unfolding revelations inside, and from the outside I suppose I was just a strange person who was completely off his face and worried looking but otherwise calm. My eyes were probably looking in two different directions.
  What sick joke was this? Then my heart dropped, it suddenly hit me that it's entirely possible that we are a mistake.  For thousands and thousands of years no one has been able to conclusively prove otherwise.
God? The word was a noise the mouth makes with air and gristle. Religion could simply have evolved through natural selection to keep humans sane and motivated to the end of their lives.  What a legacy.  WHY? What If I Didnít Want This? Where Is The Choice?
Everything was life or death and my friends were giggling and opening things and eating things, I felt nothing for them, no love. Visuals were constant but they were meaningless. The cloudy night sky was a misty inner dome of a dark cathedral with hundreds of carved gargoyles staring out of the gloom. Friends faces were simultaneous layers of skin, flesh and bone. I saw piles of guts, stomachs, livers, breathing lungs under rib cages. I lost the abstractions. Spines jutted from the back of jerseys and elbows were just protrusions of the underlying skeleton. Thin paper skin covering these. It seemed everyone was just ignoring these obvious betrayals. 'High cheek bones' and 'beautiful knees' but they are just skin covering bone. I stared at my hands and they freaked me out, they were pads. If we had three fingers since memory then we wouldnít think anything of it, I began seeing everyone with three fingers.
Thankfully it all faded after eternity.
Personal Thoughts
This analogy just came to me: An uncontrolled release of pressure is an explosion. Which damages the vessel. Fuck. But a controlled release can be entirely beneficialÖ
I think these kind of experiences are necessary for a person, even the negative ones. But I think mine was too much at the wrong time.  It just makes so much sense to me. Naked blasts of truth and there isnít a religious use for it? Please. Because what happened to me was too much of a burn, Iím now pretty much scared shitless of facing any truth again, Iíve gone back to my escapist ways.  If I can crack that then I will write up on the glory, which Iím sure exists in equal quantities as the hell but Iím yet to experience it fully. Iíve had glimpses on odd Spliff revelations, but nothing full on convincing.
I need to be convinced. Faith based religion does not really work for me, so I need to find a person who has gone into these experiences and come out with some kind of map towards compassion, who has some kind of useful systems/techniques in place and who treats these events with utmost reverence and respect.  (I see this as a five to ten year plan, nothing to be taken lightly. My soul on the line type of thing.)
Although this blasted me into an existential nightmare with lingering effects and what it uncovered has not been covered over again, I think itís better I deal with it now than perhaps after I die? There where there might be less footholds to return to. Though it was the cause, I donít think LSD was to blame for the bad experience, it just accelerated and amplified what was naturally residing in my psychology.
Thanks for letting me share this, it has helped me. I never realised how bad it actually was.
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.


Classic
Sliding
Settings
Website Name
Website name is required
Website Options
Option One
Option Two
Option Three
Option Four
Option Five
Option Six
More Options
Option One
Option Two
Option Three
Option Four
Option Five
Option Six
Maximum Login Attempts
Maximum Login Attempts is required
Next
Additional Settings
Some Text Setting
Some Text setting is required
Another Text Setting
Another Text setting is required
Copyright Year
Copyright Year is required
Review Changes
Review Setting Changes
Website Name
Maximum Login Attempts
Some Text Setting
Another Text Setting
Copyright Year
Save Settings


The variance of some data can be defined in rough terms as the mean of the squared deviations from the mean.
Let’s repeat that because it is important:
Variance: Mean of squared deviations from the mean.
An example helps to illustrate. Assume some class of students are forced to write an exam in a statistics class (OMG). Let’s say the grades range fom 1 to 6, 1 being the best and 6 the worst. We can compute the mean of this class (eg., 2.3); once we know the mean, we can subtract the mean from each individual grade. If Anna scored a 3 (OK but not exciting), “her” residual, delta or deviation would 3 - 2.3 = 0.7, and so on. The following picture illustrates this example.
library(tidyverse)
# df with students' grades (12 students)
grades_df <- data_frame(grades = c(3,2,4,1,1,2,5,1,1,3,2,2))
# compute deltas (deviations from mean)
grades_df %>%
mutate(grades_Delta = grades - mean(grades),
Student = factor(row_number())) -> grades_df
# now plot
grades_df%>%
ggplot(aes(x = Student, y = grades)) + geom_point() +
geom_hline(yintercept = mean(grades_df$grades), color = "firebrick") +
geom_linerange(aes(x = Student, ymin = grades, ymax = grades - grades_Delta), color = "blue")
The vertical blue lines look a bit like little sticks…
In this example, the vertical blue sticks indicate the individual delta. Now try to envision the “average” length of the stick. That’s something similar to the variance but not exactly the same. We have to to square each stick, and then only take the avarage.
In R
, a fancy (piped) way to compute the variance is this:
grades_df$grades %>%
`-`(mean(grades_df$grades)) %>%
`^`(2) %>%
mean
## [1] 1.520833
Literally, in plain English, this code means:
Take the data frame “grades_df”, and from there the column “grades”. Then
subtract the mean of this column. Then
take it to the 2nd power (square it, that is). Then
compute the mean of the numbers.
More formally, the variance of some empirical data is defined as
$$ s^2 = \frac{1}{n}\sum{(x-\bar{x})^2} $$.
And for infinite variables (whatever that is) it is defined as:
$$ s^2 = \varnothing \lbrack (x - \varnothing{x})^2 \rbrack $$.
Note that $$\varnothing$$ means “the mean on the long run” (infinitely long, to be sure).
Which is exactly the same as the R code above; slightly more complicated, I feel, because the steps are nested (because of the brackets). In the R code above, we “sequentialized” the steps, which renders the thing more tangible.
Note that the R function var
does not divide by n
but by n-1
. However, for larger samples, the error is negligible. The reason is that R computes the so-called “sample variance”, that is the estimate of the population variance based on the sample data. Thus, depending on whether you are interested in a guess of the population variance or just the variance of your data at hand, the one or the other is (slightly) more appopriate. If you were to know to population variance, then again you’d divide by n
(not by n-1
). Here, we just divide by n
and by happy.
In general, my opinion is not to worry too much about tiny details (for the purpose given), but rather to try to grasp the big pictures. So we won’t elaborate here on that further.
Note that the dice throws are independent with each others, they are not correlated.
Simulate dice throwing
With this understanding of the variance in mind, let’s continue. Let’s make R throw some dice to illustrate the additivity property of the variance.
Hey R: throw a normal die reps = 1e05
times and plot the results:
reps <- 1e05
dice <- sample(x = c(1:6), size = reps, replace = TRUE)
dice <- tibble(dice)
ggplot(dice) +
aes(x = dice) +
geom_histogram()
OK, fair enough; each side appeared more or less equally often.
Now, what’ the mean and the variance?
var(dice$dice)
## [1] 2.915413
mean(dice$dice)
## [1] 3.494
OK, plausible.
Now, we are concerned with the additivity of the variance. So we are supposed to some stuff up! Suppose we repeat our dice throwing experiment, but now with 2 dices (instead of 1). After each throw, we sum up the score. After some hard thinking we feel reassured that this should yield a number between 2 and 12. Let’s have a look at the plot, as we want to get an intuitive understanding.
dice1 <- sample(x = c(1:6), size = reps, replace = TRUE)
dice2 <- sample(x = c(1:6), size = reps, replace = TRUE)
dice_sum <- dice1 + dice2
# dice_sum <- sum(dice1, dice2) this will not work!
dice_sum <- tibble(dice_sum)
ggplot(dice_sum) +
aes(x = dice_sum) +
geom_histogram() +
scale_x_continuous(breaks = 1:12)
But what about mean and variance? Let’s see.
mean(dice_sum$dice_sum)
## [1] 7.00482
var(dice_sum$dice_sum)
## [1] 5.808515
It appears that the means are adding up, which makes sense, if you think about it. Same for the variance, it adds up!
Sum up k variables
As a last step, let’s add up, say, $$k = 10$$ variables (die throws) to further strengthen our argument.
First, we make up some data with k
columns of dice throws.
d <- list()
k <- 10
for (i in 1:k){
d[i] <- list(sample(x = c(1:6), size = reps, replace = TRUE))
}
d <- rbind.data.frame(d)
names(d) <- paste("V",1:k, sep = "")
Now sum up the score of each of the throws with k dice.
d$sum_throw <- rowSums(d[, 1:10])
We expect the variance to be about k
times var(one_die_throw)
.
var(d$sum_throw)
## [1] 29.29128
Which is what we find. Similarly for the mean:
mean(d$sum_throw)
## [1] 34.99714
OK.
What about sd?
Does this property hold with the sd as well?
So, what’s the sd in each of the die throws?
sds <- apply(d[, 1:10], 2, sd)
sds
## V1 V2 V3 V4 V5 V6 V7 V8
## 1.707311 1.704684 1.707218 1.705219 1.706854 1.709697 1.709320 1.703763
## V9 V10
## 1.704847 1.710907
And their sum is then 17.0698202.
But what is the sd of the sum score of the k=10 throws?
sd(d$sum_throw)
## [1] 5.412142
These two numbers are obviously not equal. So the additivity property does not hold for the sd.
More formally
Thus, we can state with some confidence:
$$Var(A+B+C+ …) = Var(A) + Var(B) + Var(C) + …$$,
where Var
means variance and A, B, C, … are some variables such as dice throws.
Subtracting two variables
OK, we have seen that the variance is additive in the sense that if we sum up som arbitrary number of variables, the variance of the sum score equals the sum of the individual variances (approximately, not exactly).
But what about subtracting two variables. Does the variance get smaller in the same way, too? Let’s try and see.
dice1 <- sample(x = c(1:6), size = reps, replace = TRUE)
dice2 <- sample(x = c(1:6), size = reps, replace = TRUE)
dice_diff <- dice1 - dice2
dice_diff <- tibble(dice_diff)
ggplot(dice_diff) +
aes(x = dice_diff) +
geom_histogram() +
scale_x_continuous(breaks = -5:5)
Obviously, if we subtract one die score from the other the result must come down between -5 and +5. But what about mean and variance? Let’s see.
mean(dice_diff$dice_diff)
## [1] -0.00232
var(dice_diff$dice_diff)
## [1] 5.813533
Interesting. The mean does what it should, it balances out again. But what about the variance? It again adds up! We see that the range is 11. Compare the “width” (range) of the individual dice throws:
ggplot(tibble(dice1)) +
aes(x = dice1) +
geom_histogram() +
scale_x_continuous(breaks = 1:6)
The range is smaller, ie. 6. So, again, it appears that despite us subtracting variables, the variance keeps adding up!.
Formal stuff
Note that in general, the variance of some (infinite) distribution is defined as follows:
$$Var(X) = \varnothing \lbrack (X - \varnothing X ) ^2 \rbrack $$ Here $$\varnothing$$ means “long term average” or “expected value”. X is just some variable such as a fair die throw.
This formula can be rearranged to
$$Var(X) = \varnothing(X^2) - (\varnothing X)^2$$
Mnemonic is “mean of square minus square of mean”; see here for details.
Similarly, for the sum of two variables, X
and Y
, we substitute X
by X+Y
:
$$Var(X+Y) = \varnothing \lbrack(X+Y) \rbrack ^2 - \lbrack \varnothing(X+Y) \rbrack^2 =$$
Let’s open the first bracket (first binomic formula):
$$ \varnothing \lbrack (X^2 + 2XY + Y^2 \rbrack - (\varnothing X + \varnothing Y) ^2 =$$
Now pull the “mean symbol” to each part of the expression:
$$ \varnothing X^2 + 2\varnothing(XY) + \varnothing(Y^2) - \lbrack(\varnothing X)^2 + 2 \varnothing X \varnothing Y + (\varnothing Y)^2 ) $$
Get rid of some brackets:
$$ \varnothing X^2 + 2\varnothing(XY) + \varnothing(Y^2) - (\varnothing X)^2 - 2 \varnothing X \varnothing Y - (\varnothing Y)^2 = $$
And we recognize some known expressions:
$$ \underbrace{\varnothing X^2 - (\varnothing X)^2}{\substack{Var(X)}} + 2\underbrace{(\varnothing XY - \varnothing X \varnothing Y)}{\substack{Cov(X,Y)}} + \underbrace{\varnothing (Y^2) - (\varnothing Y)^2}_{\substack{Var(Y)}}$$
If X and Y are independent (uncorrelated) then Cov(X,Y) = 0
. So we end up with:
$$Var(X+Y) = Var(X) + Var(Y)$$
Debrief
Well, we have dived in to the fact that the variance is additive. That is the variance of a sum (or difference) of k
variables equals the sum of the variance of each variance (see expression above).
To come to this result we have used some simulation which has the advantage that it is less abstract. Then we flipped to some more rigorous proof (but which is less tangible).
What do we need all that stuff for? Basically a number of of statistical tests or procedures use this property such as the ANOVA or R squared. Maybe equally of more important, we here have an answer why the variance is used for descriptive statistics where some other measure appears more tangible. As the variance has this nice feature which we can use for later steps in data analytic projects, we compute it right at the beginning.


Lesson Plan Title: How to Perform Cross Site Scripting (XSS)
Concept / Topic To Teach:
In role-based access control scheme, a role represents
a set of access permissions and privileges. A user can be
assigned one or more roles. A role-based access control
normally consists of two parts: role permission management
and role assignment. A broken role-based access
control scheme might allow a user to perform accesses
that are not allowed by his/her assigned roles, or
somehow obtain unauthorized roles.
General Goal(s):
Your goal is to explore the access control
rules that govern this site. Each role has permission to
certain resources (A-F). Each user is assigned one or more roles.
Only the user with the [Admin] role should have access
to the 'F' resources. In a successful attack, a user doesn't
have the [Admin] role can access resource F.
Solution:
In stage 1 we tried to use an action we are not authorised to use.
In this stage we want to view a profile of an other person. We have the permission
for the action ViewProfile but we should not have the permission to see a profile
of another employee!
Log in as Tom with tom as password. Click on Tom's name in the list and make sure
webscarab will intercept the next request. Change the employee_id for example to 101.


The WordCount Module counts the number of characters, words, and lines of java files.
Moreover it counts the number of blank lines, and the number of code lines (aka SLOC).
Select files, or folders from the explorer view, and invoke the WordCounting action. In the WordCount window the count information is displayed.
You can initiate calculating the count information by using the toolbar action () .
The calculated count informations are presented in the WordCount window.
You can open the WordCount window using Window|OpenWordCountWindow () .
The WordCount window posses a toolbar presenting following action:
A sample WordCount window:
Some explanation about Counter values:
Counting the number of code lines is done in a very simple way.
Following patterns are used for detecting if a line is a comment:
\s*[*].*, \s*//.*, \s*/[*].*
Code lines matching this pattern are ignored:
\s*[:?=(){};]\s*
.


{% extends "base.html" %} {% load static %} {% block title %}User: {{ object.username }}{% endblock %} {% block content %}
| Date | Seller | Price | Status |
|---|---|---|---|
| Content Goes Here | This is longer content Donec id elit non mi porta gravida at eget metus. | Content Goes Here | Content Goes Here |
| Content Goes Here | This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus. | Content Goes Here | Content Goes Here |
| Content Goes Here | This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus. | Content Goes Here | Content Goes Here |
| Content Goes Here | This is longer content Donec id elit non mi porta gravida at eget metus. | Content Goes Here | Content Goes Here |
| Content Goes Here | This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus. | Content Goes Here | Content Goes Here |
| Content Goes Here | This is longer Content Goes Here Donec id elit non mi porta gravida at eget metus. | Content Goes Here | Content Goes Here |


{% extends 'blog/base.html' %} {% load staticfiles %} {%block slideshow-wallpapers%} {%endblock%} {%block content%}
No worries. Click on the "Add post" option in the navigation bar to start posting.
No worries. Click on the "Add post" option in the navigation bar to start posting.
No worries. Click on the "Add post" option in the navigation bar to start posting.


{{ post.title }}
{{ post.excerpt }}
Read More
--- layout: default --- Thanks for stopping by. My name is Shubham and I have started this blog to write about different things that catch my attention and interest. That's it for now.


Player:
Name:
Name
Health:
0
Shield:
0
Selected slot:
0
Selected material:
0
Accuracy:
0
Materials:
Wood:
0
Brick:
0
Metal:
0
Position:
X:
0
Y:
0
Z:
0
Hotbar:
Inventory:
Match info:
Kills:
Deaths:


Medical waste from KATH contaminates river used to irrigate farms
A public health crisis is looming following the discovery of traces of harmful chemicals in vegetables that are irrigated with water from a source contaminated with medical waste.
Researchers at Kwame Nkrumah University of Science and Technology (KNUST) say the Subin River in Kumasi, the Ashanti Region capital, has been contaminated with medical waste from the Komfo Anokye Teaching Hospital (KATH) and Military Hospital.
Researchers found 12 different types of antibiotics in vegetables that have been grown with the contaminated water.
The Subin River flows into other rivers and also serves as a major source of drinking water for some communities.
Researchers warn that people drinking from the contaminated river or eating the contaminated vegetables, risk severe complications during treatment for bacterial infections.
Researchers say during testing, the levels of the 12 common antibiotics found in the hospital wastewater were higher, compared to those found in surface water used for irrigation.
Meanwhile, officials of the hospitals claim they treat their wastes properly before disposing of them into the river.
These revelations are contained in an upcoming JoyNews documentary titled ‘Superbug’.
Officials at the Kumasi Metropolitan Assembly (KMA) and other city officials have since begun consultations on the situation.
Luv FM’s Erastus Asare Donkor reports that details of the study have shocked many residents in Kumasi.
”The various CEOs and entities that put their waste in the river are meeting to address the situation,” he reports.
He said there are discussions to finance a project that will ensure proper disposal of medical and other wastes into the river.


Legend creates a key for a map and is useful for displaying titles, descriptions, and keys for what is being mapped.
Features include:
- Horizontal or Vertical display
A typically area of application is anywhere you need to show a key such as a map or PrimeFaces Timeline.
Based on TileMill CSS Legend.


Quantum computers are computers that utilize a new type of computing - instead of using bits (0s or 1s) like traditional computers do to operate, they use qubits, relying on quantum mechanical principles to operate much faster (faster in the sense that 10 qubits are much more powerful than 10 bits).
In each passing day, 2.5EB of data is produced on the internet (that's<PHONE_NUMBER>000000000 Bytes, or 1 billion Giga Bytes each day). However, that is nothing compared to the projected amount to be produced each day by 2020 - 463EB. As our data production, consumption, as want to use that data increases - the world needs increasingly powerful computers to process that data. This large-scale of gargantuan amounts of data can be extremely useful in fields such as medicine, mathematics, and theoretical physics. But the advent of Quantum Computing may not be all beneficial.
All those trillions upon trillions of bytes of data are not just sitting there on someone's computer - they are actively being sent across the internet - and hackers can steal that data. Credit card information, passwords, and any sort of information one might want confidential are vulnerable. In order to prevent this, data is secured by scrambling it according to an algorithm (encryption) before being sent over the internet, to be reassembled by the receiving computer (decryption).
As time marches forward, quantum computers are expected to become powerful enough to easily break modern encryptions. Today, we use highly advanced algorithms to encrypt data, such as RSA 2048 bit encryption. But it has been estimated that 25 years from now, quantum computers will be able to break 2048-bit RSA in only 8 hours. While this may seem like a lot of time, all sensitive data in the world needs to be updated with quantum-resistant algorithms in those 25 years to remian secure. And even then, any file encrypted with a non-quantum-resistant algorithm can be retroactively decrypted in the future. Secure government files, credit card numbers, and social security numbers, among other data may be at risk in the coming years.


HOW CAN WORK ON TEAM
We all know already that teamwork is the key to success in most realms of life and business.
Only through teamwork can we combine different,
complementary points of view to identify and seize hidden synergy opportunities,
overcome difficult obstacles and achieve challenging objectives.
However, teamwork is a challenge in and of itself. It requires that people manage their egos, develop humility, communicate effectively, resolve conflicts and, above all, commit to one another and to a common goal. Anyone who has worked on a team knows that the only way to do so successfully is by assessing oneself honestly and becoming the best person one can be. In this regard, not only does teamwork increase performance, it also promotes the development of better citizens and societies.
A working group is nothing more than a collection of individuals who make independent contributions to a common objective, thus requiring low levels of integration and alignment. Working groups function well in certain contexts where complexity is low and the objectives are straightforward. However, they become less and less effective as the environment becomes more complex and the objectives become more challenging. More specifically, when identifying and seizing synergies become a prerequisite for survival and long-term sustainability, working groups must evolve into teams or else they will drift away into oblivion


Uncle Joe's Pizzeria
Menu
PIZZAS:
Ask For Gluten Free Pizza Crust
10" Gluten Free Crust
One Topping $5.00
Specialty Pizzas
5 Meat Pie, Vegetable Medley, Ultimate Uncle, BBQ Lover's, Buffalo Chicken, El Tío Loco, Bacon, Cheeseburger, Club House Chicken, Pepper Pie
Toppings
Beef $1.50
Pepperoni $1.50
Italian Sausage $1.50
Sausage $1.50
Chicken $1.50
Canadian Bacon $1.50
Bacon $1.50
Anchovies $1.50
Pineapple $1.50
Red Onion $1.50
Mushrooms $1.50
Black Olives $1.50
Green Peppers $1.50
Red Peppers $1.50
Jalapeno Peppers $1.50
Spinach $1.50
Tomato $1.50
Pickle $1.50
Contact
Address: 8404 W 13th St N, Wichita, KS 67212
Phone:<PHONE_NUMBER>
Hours of Operation:
Sunday 11AM–5PM
Monday - Thursday 11AM–9PM
Friday - Saturday 11AM–10PM


The Head of PyCon China Organizing Committee
Dianwoda - Senior Developer
Liangju Deng - Metasota - Engineering Director
yield.im - Founder
Cyberpeace - Information Security Engineer
Intel - Software Engineer
YouYi Technology - Senior Developer
ByteDance - R&D Engineer
Nokia Alcatel·Lucent - Automated Testing Coach & Architect
NVIDIA - Senior Deep Learning Architect Engineer
SAIC - DevOps
Tencent - Developer
szhgs.360500.com - Python Developmental Engineer


We are a group of aspiring engineers across several diciplines who are looking to improve the world with accessible and effective resources for teachers, scientists, explorers, hobbyists - anyone and everyone.
A spark of inspiration can ignite change. Embyr strives to do the same. We want to ignite technological innovation from small ideas and out of the box thinking. We hope to create open source technology to help people and make lives easier. Our logo represents our out of the box thinking, hoping to spark a change.
Through our research and technological advancement, we hope to provide our communities and the world as a whole with the platform they need to create. We believe that the best way to improve an environment is to provie the tools for others to build up the world around them, allowing them to shape the world for the better.


{% extends "base_template.html" %} {% block title %} Main Page {% endblock %} {% block main %}
LinkedIn: https://www.linkedin.com/in/mconsidin/ GitHub: https://github.com/consimike
LinkedIn: https://www.linkedin.com/in/mconsidin/
GitHub: https://github.com/consimike
LinkedIn: https://www.linkedin.com/in/eddie-licea/


|
Wave Recorder Private API
|
Go to the source code of this file.
Data Structures | |
| struct | WaveLockFreeFIFO |
Typedefs | |
| typedef struct WaveLockFreeFIFO | WaveLockFreeFIFO |
Functions | |
| void | wave_lock_free_fifo_init (WaveLockFreeFIFO *fifo, int capacity, int elementSize) |
| void | wave_lock_free_fifo_deinit (WaveLockFreeFIFO *fifo) |
| int | wave_lock_free_fifo_is_empty (WaveLockFreeFIFO *fifo) |
| int | wave_lock_free_fifo_is_full (WaveLockFreeFIFO *fifo) |
| int | wave_lock_free_fifo_get_num_elements (WaveLockFreeFIFO *fifo) |
| int | wave_lock_free_fifo_push (WaveLockFreeFIFO *fifo, const void *element) |
| int | wave_lock_free_fifo_pop (WaveLockFreeFIFO *fifo, void *element) |
| typedef struct WaveLockFreeFIFO WaveLockFreeFIFO |
Single reader, single writer lock free FIFO.
| int wave_lock_free_fifo_pop | ( | WaveLockFreeFIFO * | fifo, |
| void * | element | ||
| ) |
Called from the consumer thread only.
| int wave_lock_free_fifo_push | ( | WaveLockFreeFIFO * | fifo, |
| const void * | element | ||
| ) |
Called from the producer thread only.


The following variable myObj is declared as type GeneralCase and assigned an instance of a subclass of GeneralCase called SpecificCase:
GeneralCase myObj = new SpecificCase();
Can myObj be used to call a method that is defined for SpecificCase but not GeneralCase
There are no hints for this question


This form serves to assist the user in the process of adding one or more users to the Inter-Res Sports Registration System.


Alan's MenuServer Restaurant
Login
About
Breakfast
Lunch
Dinner
Dessert
Beverages
Select store
Centre Ave Store
Morewood Store
Downtown Store
Item Name
Item Price
Quantity
Perfect French Toast
$12.00
X
Waffle affair
$10.75
X
Scrambled eggs
$9.15
X
Subtotal:
$43.16
Place Order
Cancel


class: center, middle # Don't Fear the Monad ### Pierangelo Cecchetto #### (@pierangelocecc) ### YOLT talks ##### 01-11-2018 --- # Me (as a dev) - 2004-2015 Java - E-commerce, Banking - Spring, hibernate, etc... -- - GoF patterns (copy/paste/change) --
--- # Me (as a dev) - 2013... - FP - Types --- # Agenda - FP definition - Typeclasses - A few monads with examples --- # What is FP? - Programming with `map`, `flatMap`, `filter` ? -- - Programming with `implicit class` / extension methods ? ```scala val x: Int = 2 // x: Int = 2 implicit class RichInt(i: Int) { def square: Int = i * i } // defined class RichInt x.square // res0: Int = 4 ``` --- # Mathematical functions
-- - **Total** -- - **Deterministic** -- - **Pure** --- # Referential transparency ??? This is the property that programming with Pure functions buy us Consider the process of mathematical reasoning and proof advancement -- _- Can I replace an expression with its definition?_ -- Arithmetic ```scala x + 5 + x x = 2 > ? ``` -- ```scala 2 + 5 + 2 > 9 ``` --- # Referential transparency Program ```scala val x: Int = 2 // x: Int = 2 x + 5 + x // res1: Int = 9 ``` -- ```scala 2 + 5 + 2 // res2: Int = 9 ``` -- ### Conclusion `val x: Int = 2` is _Referentially Transparent_ --- # Referential transparency Program ```scala val x: Int = { println("Hello"); 2 } // Hello // x: Int = 2 x + 5 + x // res3: Int = 9 ``` -- ```scala { println("Hello"); 2 } + 5 + { println("Hello"); 2 } // Hello // Hello // res4: Int = 9 ``` -- ### Conclusion `val x: Int = { println("Hello"); 2 }` is **not** Referentially Transparent --- # Referential transparency - Replace equals for equals -- - Equational reasoning -- - Local reasoning --- # Referential Transparency - ~~Shared Mutable State~~ -- - ~~Exceptions~~ -- - ~~Partial functions~~ -- - ~~Eager side effects~~ -- - ~~Program with variables and statements~~ Program with Values and Expressions --- # Typeclasses ??? Let's talk about typeclasses. If we want to program with functions, and we have a strongly typed language at hand, it is natural to define to which objects these functions can be applied Typeclasses are a supreme way to model separation of concerns, and yet make sure we take care of all the necessary concerns, at compile time -- - Separation of concerns -- - Widespread in FP -- - _Ad hoc inheritance_ -- - Declare properties - Declare Laws (TCK) -- - Specify which types enjoy these properties - Or have the compiler deriving them for you -- - Compile-time check --- # Typeclasses ```scala trait Show[A] { def show(a: A): String } ``` ??? A very simple example of a typeclass is `Show` String representation of a class. We have already `toString` but if we forget to override it we end up having strange @ClassName#hashCode, and compiler says nothing! We need stronger guarantees! -- ```scala case class Dog(name: String) ``` -- ```scala implicit val show: Show[Dog] = new Show[Dog] { def show(d: Dog) = s"a dog named ${d.name}" } ``` -- ```scala val charlie = Dog("Charlie") // charlie: Dog = Dog(Charlie) implicitly[Show[Dog]].show(charlie) // res5: String = a dog named Charlie ``` --- # Typeclasses Having to type every time `implicitly[Show[Dog]]` is a bit noisy -- Summoner ```scala object Show { def apply[A: Show]: Show[A] = implicitly } ``` -- ```scala Show[Dog].show(charlie) // res6: String = a dog named Charlie ``` -- Rich Syntax ```scala implicit class ShowSyntax[A: Show](a: A) { def show: String = Show[A].show(a) } ``` ```scala val charlie = Dog("Charlie") // charlie: Dog = Dog(Charlie) charlie.show // res7: String = a dog named Charlie ``` ??? In the next slides we will talk about specific type classes using the std version and the syntax enrichment version in an equivalent manner --- # Typeclasses ```scala def log[A: Show](a: A): String = s"I am logging about [${Show[A].show(a)}]" // log: [A](a: A)(implicit evidence$1: Show[A])String ``` -- ??? What we can do with Show? Explicitly declare how it should behave for a type Without forcing any inheritance All checked by the compiler -- ```scala val jack = Dog("Jack") // jack: Dog = Dog(Jack) log(jack) // res8: String = I am logging about [a dog named Jack] ``` -- ```scala case class Cat(name: String) // defined class Cat val oscar = Cat("Oscar") // oscar: Cat = Cat(Oscar) log(oscar) //
:18: error: could not find implicit value for evidence parameter of type Show[Cat] // log(oscar) // ^ ``` -- ## Compilation errors FTW!!! ??? Compiler is your friend, make use of it! --- # Semigroup ??? Semigroup is math term to express the fact that I can take 2 things of 1 type and produce another thing of the same type (internal, binary operation) TODO: make picture -- - Append ```scala trait Semigroup[A] { def combine(a: A, b: A): A } ``` -- ```scala Semigroup[Int].combine(100, 10) // res0: Int = 110 ``` -- ```scala Semigroup[List[Int]].combine(List(1,2,3), List(4,5,6)) // res1: List[Int] = List(1, 2, 3, 4, 5, 6) ``` --- # Semigroup - `|+|` operator ??? As we have seen, it is frequent practice to enrich the syntax of a type that has a type class with an operator that delegates to the typeclass definition -- ```scala 100 |+| 10 // res2: Int = 110 List(1,2,3) |+| List(4,5,6) // res3: List[Int] = List(1, 2, 3, 4, 5, 6) ``` --- # Semigroup Derived instances - If `A` is a Semigroup, `Map[K, A]` is a Semigroup ```scala val m1 = Map("cat" -> List(1,2,3), "dog" -> List(4,5,6)) // m1: scala.collection.immutable.Map[String,List[Int]] = Map(cat -> List(1, 2, 3), dog -> List(4, 5, 6)) val m2 = Map("cat" -> List(10), "cow" -> List(40)) // m2: scala.collection.immutable.Map[String,List[Int]] = Map(cat -> List(10), cow -> List(40)) ``` ??? `Map[K, V]` is a semigroup if V is a semigroup, therefore we have a semigroup in maps induced by the semigroup in Values -- ```scala m1 |+| m2 // res4: Map[String,List[Int]] = Map(cat -> List(1, 2, 3, 10), cow -> List(40), dog -> List(4, 5, 6)) ``` - If `A` is a semigroup, `Option[A]` is a semigroup ```scala 1.some |+| 2.some // res5: Option[Int] = Some(3) 1.some |+| None // res6: Option[Int] = Some(1) ``` --- # Semigroup ```scala def twice[A: Semigroup](a: A) = a |+| a // twice: [A](a: A)(implicit evidence$1: cats.Semigroup[A])A ``` ??? We can derive functions in terms of base operations, e.g. a function that combines an element with itself -- ```scala scala> twice(List(1,2,3)) res7: List[Int] = List(1, 2, 3, 1, 2, 3) ``` -- ```scala twice(Map("cat" -> List(1,2,3), "dog" -> List(4,5,6))) // res8: scala.collection.immutable.Map[String,List[Int]] = Map(cat -> List(1, 2, 3, 1, 2, 3), dog -> List(4, 5, 6, 4, 5, 6)) ``` --- # Monoid - combine 2 things ??? If we enrich a semigroup by providing a neutral element, we get a Monoid -- - has neutral element -- ```scala trait Monoid[A] { def combine(a: A, b: A): A def empty: A } ``` -- - Monoid Laws ```scala (a |+| b) |+| c === a |+| (b |+| c) ``` -- ```scala a |+| empty === empty |+| a === a ``` -- Grouping is irrelevant ```scala scala> List(1,2,3) |+| List(3,4,5) |+| List(7,8,9) res9: List[Int] = List(1, 2, 3, 3, 4, 5, 7, 8, 9) ``` ??? This simple property is fundamental when designing distributed systems --- # Monoid ```scala def fold[A: Monoid](xs: List[A]) = xs.foldLeft(Monoid[A].empty)(Monoid[A].combine) // fold: [A](xs: List[A])(implicit evidence$1: cats.Monoid[A])A ``` ??? Again, we can derive operations totally generic on monoids that work for _any_ monoid -- ```scala scala> List(1,2,3,4).combineAll res10: Int = 10 ``` -- ```scala scala> List(Some(1), Some(2), None).combineAll res11: Option[Int] = Some(3) ``` ??? Here we used the fact that given a `Monoid[A]`, we have for free a `Monoid[Option[A]]` -- ```scala case class Features(x: Double, y: Double) implicit val monoid: Monoid[Features] = new Monoid[Features] { def combine(a: Features, b: Features): Features = Features(a.x + b.x, a.y + b.y) def empty: Features = Features(0, 0) } val samples = List(Features(50, 50), Features(40,30), Features(10, 20)) ``` ```scala val added = samples.combineAll // added: Features = Features(100.0,100.0) ``` ??? We will see in the section about applicative a natural application of these concepts --- # Monoid Why should I care? - Addition of homogeneous quantities - Error accumulation (form validation) - Log accumulation - (Map) Reduce, parallel processing, scatter-gather --- # But wait...
--- # Function Composition ??? What are effects? Let's consider a simple example, we have a devops application that given the name of the application needs to find the location of configuraiton -- ```scala val lookupPath: String => ConfigLocation = appName => ConfigLocation("application-config-point") ``` ??? And then read this configuration from the location -- ```scala val lookupConfig: ConfigLocation => AppConfig = configLocation => AppConfig(port = 80, rootUrl = "reactive") ``` -- Composition ```scala val bootstrap: String => AppConfig = lookupPath andThen lookupConfig ``` ??? Then we can compose these 2 functions together -- ```scala bootstrap("reactive-app") // res12: AppConfig = AppConfig(80,reactive) ``` -- Or ```scala val bootstrap: String => AppConfig = lookupConfig compose lookupPath ``` -- ```scala bootstrap("reactive-app") // res13: AppConfig = AppConfig(80,reactive) ``` --- # Effects Enrich a computation ??? Let's now introduce Effects. We call effects anything that enriches our domain to express specific, well defined behavior, e.g. - optionality - Error - Reading from context - State changes Let's see how we can enrich our functions to express the potential failure of computation -- ```scala sealed trait Either[+E, +A] case class Left(e: E) extends Either[E, Nothing] case class Right(a: A) extends Either[Nothing, A] ``` -- ```scala type ErrorOr[A] = Either[String, A] ``` ```scala val lookupPath: String => ErrorOr[ConfigLocation] = appName => { if (appName == "reactive-app") Right(ConfigLocation("location")) else Left(s"$appName app not found") } val lookupConfig: ConfigLocation => ErrorOr[AppConfig] = lookupPath => { if (lookupPath == ConfigLocation("location")) Right(AppConfig(port = 80, rootUrl = "reactive")) else Left(s"$lookupPath path not found") } ``` --- # Effects ```scala sealed trait Either[+E, +A] { self => def flatMap(f: A => Either[E, B]): Either[E, B] = self match { case Right(a) => f(a) case Left(e) => Left(e) } } ``` -- ```scala val bootstrap: String => ErrorOr[AppConfig] = location => lookupPath(location).flatMap(lookupConfig) ``` ??? The fact that `Either` is equipped with a `flatMap` allows us to compose 2 functions -- ```scala bootstrap("reactive-app") // res14: ErrorOr[AppConfig] = Right(AppConfig(80,reactive)) bootstrap("my-app") // res15: ErrorOr[AppConfig] = Left(my-app app not found) ``` ??? Let's see how far we can go with effects composition --- # Effects ```scala f: A => B ``` ??? We start with a function `A => B` -- ```scala f: A => ErroOr[B] ``` -- ```scala f: A => F[B] ``` ??? And we enrich the output to an `F[B]`, in our case an Either, so we can conclude that effects... -- ```scala F[A] = Either[String, A] ``` - Effects express richer behaviour -- - Effects != Side Effects ??? To quote a famous guy in the Scala sphere -- > _Effects are good, side effects are bugs_ (Rob Norris) -- ```scala type Id[A] = A f: A => B <---> f: A => Id[B] ``` --- # Effects Composition ```scala val lookupPath: String => ErrorOr[ConfigLocation] = ??? val lookupConfig: ConfigLocation => ErrorOr[AppConfig] = ??? val bootstrap: String => ErrorOr[AppConfig] = location => lookupPath(location).flatMap(lookupConfig) ``` ??? How did we compose our effects? We used `flatMap` --- # Effects Composition ```scala val lookupPath: String => Option[ConfigLocation] = ??? val lookupConfig: ConfigLocation => Option[AppConfig] = ??? val bootstrap: String => Option[AppConfig] = location => lookupPath(location).flatMap(lookupConfig) ``` ??? If the effect was an `Option`, the expressions would look almost the same, just the effect we were expressing was Optionality of the output, without information about the specific error --- # Effects Composition ```scala val lookupPath: String => IO[ConfigLocation] = ??? val lookupConfig: ConfigLocation => IO[AppConfig] = ??? val bootstrap: String => IO[AppConfig] = location => lookupPath(location).flatMap(lookupConfig) ``` ??? If the effect was an `Task`, the expressions would look almost the same, just the effect we were expressing was Asynchronicity, e.g. some api calls happening under the hood THERE MUST BE AN ABSTRACTION AROUND THIS REPETITIVE PATTERN !!! --- # Monad typeclass ```scala trait Monad[F[_]] { def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B] def pure[A](a: A): F[A] } ``` ??? Let's formalize the fact that a type constructor is equipped with a flatMap operation And let's also require that this thing is able to put a given `a: A` in a box of shape `F[_]` --- # Monad typeclass ```scala trait Monad[F[_]] extends Functor[F]{ def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B] def pure[A](a: A): F[A] def map[A, B](fa: F[A])(f: A => B) = flatMap(fa)(a => pure(f(a))) } ``` ??? Just by following the types, we can derive an implementation of map just based on the fact that we have a `flatMap` and a `pure` -- This is all that you need to have a monad -- But don't forget the laws!!! -- - Associativity ```scala x.flatMap(f).flatMap(g) === x.flatMap(a => f(a).flatMap(g)) ``` -- - Identity ```scala flatMap(x)(pure) === x flatMap(pure(y))(f) === f(y) ``` --- # Monad typeclass `Option` implementation ```scala implicit val optionMonad: Monad[Option] = new Monad[Option] { def flatMap[A, B](fa: Option[A])(f: A => Option[B]): Option[B] = fa flatMap f def pure[A](a: A): Option[A] = Some(a) } ``` -- `Id` implementation ```scala implicit val idMonad: Monad[Id] = new Monad[Id] { def flatMap[A, B](fa: Id[A])(f: A => Id[B]): Id[B] = f(fa) def pure[A](a: A): Id[A] = a } ``` --- # Monad Effects composition ```scala val lookupPath: String => ConfigLocation = ??? val lookupConfig: ConfigLocation => AppConfig = ??? val bootstrap: String => AppConfig = lookupPath andThen lookupConfig ``` ??? In the light of what we just said, let's have a look again at our original example -- vs ```scala def lookupPath(path:String): F[ConfigLocation] = ??? def lookupConfig(c: ConfigLocation): F[AppConfig] = ??? def bootstrap[F[_]: Monad](path: String): F[AppConfig] = lookupPath(location).flatMap(lookupConfig) ``` ??? And let's compare it with the effectful version... Still something doesn't add up, these 2 implementations are still quite different from each other... what can we do? --- # Monad Kleisli ```scala val lookupPath: String => ConfigLocation = ??? val lookupConfig: ConfigLocation => AppConfig = ??? val bootstrap: String => AppConfig = lookupPath andThen lookupConfig ``` -- ```scala case class Kleisli[F[_], A, B](run: A => F[B]) { def andThen[C](g: Kleisli[F, B, C])(implicit F: Monad[F]): Kleisli[F, A, C] = Kleisli(a => run(a).flatMap(g.run)) ``` -- ```scala val lookupPath: Kleisli[F, String, ConfigLocation] = ??? val lookupConfig: Kleisli[F, ConfigLocation, AppConfig] = ??? val bootstrap: Kleisli[F, String, AppConfig] = lookupPath andThen lookupConfig ``` -- Now they look the same! ??? Now the expressions look really similar --- # Monad - Kleisli and Monads ```scala trait Monad[F[_]] { def pure[A](a: A): F[A] def compose[A, B, C](f: A => F[B], g: B => F[C]): A => F[C] } ``` ??? These are 2 _equivalent_ formulations of a monad --- # Monad - Kleisli and Monads ```scala trait Monad[F[_]] { def pure[A](a: A): F[A] def compose[A, B, C](f: A => F[B], g: B => F[C]): A => F[C] def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B] = compose(_:Unit => fa, f)(()) } ``` -- Now the associativity law is much easier! ```scala compose(compose (f, g), h) === compose(f, compose(g, h)) ``` -- Just like associativity for Monoids! ```scala (a |+| b) |+| c === a |+| (b |+| c) combine(combine(a, b), c) === combine(a, combine(b, c)) ``` -- A Monad is a monoid in the category of endofunctors! --- class: center, middle
--- # Monad typeclass A Monad for Dependency Injection -- #### Reader Monad ```scala case class Reader[C, A](run: C => A) ``` ```scala implicit def readerMonad[C]: Monad[Reader[C, ?]] = new Monad[Reader[C, ?]] { def flatMap[A, B](fa: Reader[C, A])(f: A => Reader[C, B]): Reader[C, B] = Reader(c => (fa.run(c) andThen f).run(c)) def pure[A](a: A): Reader[C, A] = Reader(_ => a) } ``` --- # Monad typeclass #### Get User Transactions ```scala def getAccountId(userId: UserId, db: DbSession): AccountId def getTransactions(accountId: AccountId, db: DbSession): List[Transaction] def userTransactions(userId: UserId, db: DbSession): List[Transaction] = ??? ``` --- # Monad typeclass #### Get User Transactions ```scala def getAccountId(userId: UserId)(db: DbSession): AccountId def getTransactions(accountId: AccountId)(db: DbSession): List[Transaction] def userTransactions(userId: UserId)(db: DbSession): List[Transaction] = ??? ``` --- # Monad typeclass #### Get User Transactions ```scala def getAccountId(userId: UserId): DbSession => AccountId def getTransactions(accountId: AccountId): DbSession => List[Transaction] def userTransactions(userId: UserId): DbSession => List[Transaction] = ??? ``` -- ```scala Reader[DbSession, A](run: DbSesssion => A) ``` -- ```scala type DbReader[A] = Reader[DbSession, A] ``` --- # Monad typeclass #### Get User Transactions ```scala def getAccountId(userId: UserId): DbReader[AccountId] def getTransactions(accountId: AccountId): DbReader[List[Transaction]] def userTransactions(userId: UserId): DbReader[List[Transaction]] = for { account <- getAccountId(userId) transactions <- getTransactions(userId) } yield transactions ``` -- ```scala val session: DbSession = ??? val userId = UserId("489d9fae-730e-4865-92a9-36df1cd69ee8") val transactions: List[Transaction] = getTransactions(userId).run(session) ``` -- Let the caller inject the dependency (_real IoC_) --- # Monad typeclass #### Get User Transactions Abstract on the monad ```scala trait TransactionsModule[F[_]] { def getAccountId(userId: UserId): F[AccountId] def getTransactions(accountId: AccountId): F[List[Transaction]] def userTransactions(userId: UserId) (implicit M: Monad[F]): F[List[Transaction]] = for { account <- getAccountId(userId) transactions <- getTransactions(userId) } yield transactions } ``` --- # Monad typeclass #### Get User Transactions Abstract on the monad Write tests on the simplest monad at hand! ```scala val test = new TransactionModule[Id] { def getAccountId(userId: UserId) = if (userId == User("123")) AccountId("123") else AccountId("wrong") def getTransactions(accountId: AccountId) = if accountId == AccountId("123") List(tx1, tx2, tx3) else List() } test.userTransactions(User("123")) shouldEqual List(tx1, tx2, tx3) ``` --- # Functional Patterns - Create a few, reusable and composable abstractions -- - You learn them once, you use them everywhere -- - Experiment with them -- - Introduce them at work -- - Read the Red Book _Functional Programming in Scala_ -- - Read _Functional and Reactive Domain Modeling_ -- - Try Haskell --- class: center, middle # Questions?


The Beatles
Bringers of Beatlemania!
From left to right, Ringo Star, George Harrison, John Lennon, and Paul McCartney
Albums
Please Please Me
With the Beatles
A Hard Day's Night
Beatles for Sale
Help!
Rubber Soul
Revolver
Sgt. Pepper's Lonely Hearts Club Band
The Beatles
Yellow Submarine
Abbey Road
Let It Be
To find out more about the Beatles, head on over to this
Wikipedia page
.


Using the Text Lesson Template
The Text Lesson is one of the most versatile templates and likely one of the most often used. It is used to create "show and tell" type lesson pages.
Using the Text Lesson Template:
- Add graphics and text to the stage and control timing using the timeline.
- To have graphics or text fade in:
- Select the graphic or text and make it a Movie Clip using Modify > Convert to Symbol... (or ⌘-F8)
- In the Library panel, select the Movie Clip and open the Symbol Properties dialog by right-clicking and selecting Properties...
- Check Linkage: Export for ActionScript
- change Base Class to: com.davita.elements.FadeIn
- To pause the lesson and allow the student to read the screen, drag a ContinueBtn from the Library to the Stage.
- To end the lesson, drag a LessonEnded component from the Library to the Stage.
- Compile the swf using ⌘-return. (The Test fla does not need to be edited in Flash).
- Close your fla.


From date/time must be less than To date/time
Maximum date/time interval is 7 days
From date/time must be less than Current date/time


Many reasons to get up
and start to get back in
the business
The harder you work for something, the greater you’ll
feel when you achieve it.
The harder you work for something, the greater
you’ll feel when you achieve it.
Your choice
There are many reasons to get down and start to get depressed about your situation.
Ecstatic elegance
Article nor prepare chicken you him
now. Shy merits say advice ten before
lovers innate add.
Folly words widow
Effect if in up no depend seemed.

We me rent been part what.
Possible procured trifling
We me rent been part what. An
concluded sportsman offending so
provision mr education.
Open game
Shy merits say advice ten before
lovers innate add. She cordially
behaviour can attempted estimable.
Endeavor
Improve ashamed married expense
bed her comfort pursuit mrs. Four time
took ye your as fail lady.
Comfort pursuit
Had denoting properly jointure you
occasion directly raillery. In said to of
poor full be post face snug.


  Still beats no unit tests though.
11/27/2007, 1:42:25 PM
Favs: 0
Retweets: 0
link


- badSetStatusTest() - Method in class ca.ualberta.CMPUT3012019T02.alexandria.MessageTests
-
- badSetTypeTest() - Method in class ca.ualberta.CMPUT3012019T02.alexandria.MessageTests
-
- beReturned(boolean) - Method in class ca.ualberta.CMPUT3012019T02.alexandria.model.user.OwnedBook
-
Locally sets the status of this book to available.
- Book - Class in ca.ualberta.CMPUT3012019T02.alexandria.model
-
This class holds general information about a book, including its title, author, description, etc.
- Book() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.Book
-
Deprecated.
- Book(String, String, String) - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.Book
-
Create a new book
- Book(String, String, String, String, String) - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.Book
-
Create a new book
- BookCatalogueFragment - Class in ca.ualberta.CMPUT3012019T02.alexandria.fragment.bookCatalogue
-
- BookCatalogueFragment() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.fragment.bookCatalogue.BookCatalogueFragment
-
- BookController - Class in ca.ualberta.CMPUT3012019T02.alexandria.controller
-
This class manages the addition, retrieval, modification, and transactions of books
- BookControllerTests - Class in ca.ualberta.CMPUT3012019T02.alexandria.controller
-
- BookControllerTests() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.controller.BookControllerTests
-
- BookDataAdapter - Class in ca.ualberta.CMPUT3012019T02.alexandria.adapter
-
Functions as an adapter for BookController, ImageController, and UserController
- BookDataAdapterTests - Class in ca.ualberta.CMPUT3012019T02.alexandria
-
- BookDataAdapterTests() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.BookDataAdapterTests
-
- BookListItem - Class in ca.ualberta.CMPUT3012019T02.alexandria.model
-
Model Class for BookRecyclerViewAdapter
- BookListItem() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.BookListItem
-
Instantiates a new Book list item.
- BookListItem(Bitmap, String, String, String, String, String, String) - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.BookListItem
-
Constructor for BookListItem
- BookListItem(Bitmap, String, String, String) - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.BookListItem
-
Instantiates a new Book list item.
- BookRecyclerViewAdapter - Class in ca.ualberta.CMPUT3012019T02.alexandria.adapter
-
Set up RecyclerView for book lists
Code based on code from https://youtu.be/T_QfRU-A3s4 on 03/04/2019
- BookRecyclerViewAdapter(Context, List<BookListItem>, String) - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.adapter.BookRecyclerViewAdapter
-
Instantiates a new Book recycler view adapter.
- BookTests - Class in ca.ualberta.CMPUT3012019T02.alexandria
-
- BookTests() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.BookTests
-
- BookViewHolder - Class in ca.ualberta.CMPUT3012019T02.alexandria.model.holder
-
Sets up item ID for RecyclerViews
- BookViewHolder(View) - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.holder.BookViewHolder
-
Instantiates a new Book view holder.
- BorrowedBook - Class in ca.ualberta.CMPUT3012019T02.alexandria.model.user
-
This class represents the relationship between a User and an OwnedBook, where the User has made
some sort of transaction/interaction with the OwnedBook (e.g.
- BorrowedBook() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.user.BorrowedBook
-
Deprecated.
- BorrowedBook(String, String, String) - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.model.user.BorrowedBook
-
Creates a new borrowed book with isbn, status, and owner
- BorrowedBookTests - Class in ca.ualberta.CMPUT3012019T02.alexandria
-
- BorrowedBookTests() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.BorrowedBookTests
-
- BorrowedFragment - Class in ca.ualberta.CMPUT3012019T02.alexandria.fragment.exchange
-
Fragment for filtering book list that has the status of Borrowed
- BorrowedFragment() - Constructor for class ca.ualberta.CMPUT3012019T02.alexandria.fragment.exchange.BorrowedFragment
-
- btUser - Variable in class ca.ualberta.CMPUT3012019T02.alexandria.model.holder.UserViewHolder
-
The Bt user.


As the saying goes, 'Safety is our No. 1 priority.' This is a compulsory program for SP students to be trained and safety certified before allowing access and work in workshops, Fablabs or studio with fabricating facilities. The objectives are
Here are some equipments and tools introduced to us in the first few lessons. I was amazed at how diverse on the types of equipments used, the school probably spend a ton too.
Contains wrench, screwdrivers, claw Hammer
6 Piece is a kit containing six cordless power tools
HCM-2S
Foam cutting machine
ABM-500S
Plastic bending machine
Here are some digital fabrication equipments and tools introduced to us in the first few lessons. One of the criteria for the final project was to make use of both 3D printing and laser cutting of our product.
Creates three-dimensional components from CAD models. It mimics the biological process, adding material layer by layer to create a physical part. With 3D printing, you can produce functional shapes, all while using less material than traditional manufacturing methods.
Epilog Fusion M2 Laser Series
Mostly cuts wood and can create parts like puzzles to be fixed together
HCM-2S
For manufacturing of small scale parts
Brother PR-1050X Sewing Machine
An Innovative 10-Needle Home and Small Business Embroidery Machine
Here are all the softwares that I used for this elective, and some reasons to justify my choices.
I'm using Sublime Test 3 as my text editor as my lecturer is using, it is simple and straightforward to use
I'm using Illustrator as my vector editor as my course requires us to use it
I'm using Photoshop as my graphics editor as my course requires us to use it
I'm using Pickpic as my screen capture and image resizer as it is efficient to take a screenshot and crop it.
I'm using Fusion 360 as my CAD software as it is a Pro CAD software on top of a 3 year Education License provided.
I'm using Chrome as my default browser as it has high speed navigations, and can sync across many devices and Google accounts.


--- layout: plainarticle permalink: '/alumni-projects/' title: Alumni Projects ---
Our association is all about enabling the individual alumni and empowering them to contribute towards our network as well as our Alma Mater. With the commitment to support the university in its educational mission we have various Alumni Projects that promote the exchange and interaction between alumni themselves, their Alma Mater as well as current students.
Find out more about our current channels of engagement and see where you can make a difference. Your contribution matters!
{% for project in site.projects %} {% include project.html project=project %} {% endfor %}


class RubyProf::Cmd
Synopsis¶ ↑
Profiles a Ruby program.
Usage¶ ↑
ruby-prof [options] <script.rb> [–] [profiled-script-command-line-options]
Options:
-p, --printer=printer Select a printer: flat - Prints a flat profile as text (default). graph - Prints a graph profile as text. graph_html - Prints a graph profile as html. call_tree - format for KCacheGrind call_stack - prints a HTML visualization of the call tree dot - Prints a graph profile as a dot file multi - Creates several reports in output directory -m, --min_percent=min_percent The minimum percent a method must take before being included in output reports. This option is not supported for call tree. -f, --file=path Output results to a file instead of standard out. --mode=measure_mode Select what ruby-prof should measure: wall - Wall time (default). process - Process time. allocations - Object allocations (requires patched Ruby interpreter). memory - Allocated memory in KB (requires patched Ruby interpreter). -s, --sort=sort_mode Select how ruby-prof results should be sorted: total - Total time self - Self time wait - Wait time child - Child time --allow_exceptions Raise exceptions encountered during profiling (true) or suppress them (false) -R, --require-noprof=lib require a specific library (not profiled) -E, --eval-noprof=code execute the ruby statements (not profiled) --exclude=methods A comma separated list of methods to exclude. Specify instance methods via # (Integer#times) Specify class methods via . (Integer.superclass) --exclude-common Remove common methods from the profile -h, --help Show help message -v, --version version Show version (1.1.0)


Robo Pizza
ORDER
Customize pizza:
Select size:
Small
Medium
Large
Select sauce:
Red
White
Select toppings:
Olives
Onions
Spinach
Pineapple
PLACE ORDER
Thanks for placing an order!
Your receipt:
Toppings


Reports FlexUnit test classes that are not
public
. Non-public classes cannot be run by the FlexUnit runner.


Børnebøger for Danmark is a website for teachers, parents, and community members that aims to promote bilingualism and multilingualism in Denmark. It makes 40 stories from the African Storybook available in the most widely spoken immigrant and refugee languages of Denmark, in addition to dansk. A story that is read in dansk at school can be read in the mother tongue by parents and children at home. In this way, Børnebøger for Danmark helps children to maintain the mother tongue in both oral and print form, while learning Denmark’s official language. Similarly, the audio versions of the stories can help beginning readers and language learners make the important connection between speech and text.
All 40 stories on the Børnebøger for Danmark website come from the African Storybook – a groundbreaking digital initiative of the South African organization Saide, which promotes literacy for African children. The African Storybook has hundreds of stories in multiple African languages, as well as English, French, and Portuguese. The stories are openly licensed, which allows the Børnebøger for Danmark team to repurpose them for a Danish audience. We are very grateful to the African Storybook and Saide for making the stories freely available under an open license.
We selected the 40 stories out of several hundred from the African Storybook, and sought to create a collection of stories of different lengths that balance the African origin of the stories with internationally relevant themes. There are traditional animal fables as well as contemporary stories about city life. Some stories cover serious topics like responsibility and gender equality.  We hope that the universal values reflected in the stories will resonate with children across Denmark.
Børnebøger for Danmark has only been possible with the help of a large number of people, including translators, readers, proofreaders, and others who have been part of the process of making these stories available. We sincerely thank all contributors for their time and effort!
We are particularly grateful to the Storybooks Canada project, which has created the modular website on which Børnebøger for Danmark is based.
Icons provided by FontAwesome (via Fontello) and Elegant Circles.


Agriculture and Food
I am a software engineer working on Agriculture Production SIMulator (APSIM) software. APSIM is a process based model aimed at simulating crop and animal growth at the paddock scale. It outputs customisable reporting data in space delimited text files at daily, month, yearly or crop event time scales. APSIM is used to create simulations that mimic the real world to generate what if scenarios for farming management. Output is compared against real world experiments in order to improve the process based science in the model.
Clusters are currently been used more and more to generate massively large data sets of output files. It is not uncommon to run millions of simulations on clusters with millions of corresponding output files. These large numbers of output files pose a serious problem in analysis of the data. Standard approach when analysing data is to first plot or visualise the data and then once an understanding of your data is obtained then filter out only the data of interest. This approach can no longer be maintained as the sheer quantity of data causes problems for visualisation tools.
My approach is to tip the standard approach on its head, and filter first using customisable sensibility filters applied to each output file and then visualise the data that either passes or fails these tests. In order to speed up the filter process this is done in parallel using the same sort of clustering technology that originally ran the simulations.
The CSIRO High Performance computing cluster using Slurm array jobs is used to run a customised R script in parallel on every output file in the dataset. Standard R plotting packages are used to plot the data eg. ggplot.
I did not know R before data school or how to run jobs on the CSIRO High Performance Computer cluster.
The Git Bash command line has been a surprise favourite of mine. Lets you combine the power of command line Git with the standard tools of ssh for logging in and running jobs on the cluster.
Setting up the Slurm array jobs. Automating this part is proving most difficult.
Create an R package that allows users can easily install. This will allow users from R studio running on their desktop to run the filtering on the cluster and then plot and visualise the results in R studio on their desktop.
Possible idea to test would be to visualise the data spatially on a map of Australia using leaflet or as a shiny app that uses javascript to select points on the map and display more detailed information about the point selected.


Choose in the list the Similarity score to compute the similarity between source and target contexts. Two choices are available: Jaccard and Cosine. The similarity score is one of the parameters of the distributional method.


Package algorithms.compGeometry
Class LinesAndAngles
- java.lang.Object
-
- algorithms.compGeometry.LinesAndAngles
-
public class LinesAndAngles extends java.lang.Object
adapted from https://code.google.com/p/two-point-correlation/source/browse/src/main/java/algorithms/compGeometry/LinesAndAngles.java under MIT License (MIT), Nichole King 2013
-
-
Constructor Summary
Constructors Constructor Description LinesAndAngles()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
calcAngle(int x1, int y1, int x2, int y2, int x3, int y3)
Calculate the angle of segment P3:P1 sweeping clockwise to segment P3:P2.static double
calcClockwiseAngle(int x1, int y1, int x2, int y2, int x3, int y3)
Calculate the angle of segment P3:P1 sweeping clockwise to segment P3:P2.static int[]
calcPolarLineEndPoints(int thetaDegrees, int radius, int imageWidth, int imageHeight)
NOT YET TESTED given a polar angle and radius, calculate the line perpendicular to that point where it intersects with the image boundary.static double
crossProduct(double x1, double y1, double x2, double y2)
determine the cross product and return negative number if the 2nd set of values, p1, are clockwise from the first, p1, w.r.t.static float
crossProduct(float x1, float y1, float x2, float y2)
determine the cross product and return negative number if the 2nd set of values, p1, are clockwise from the first, p1, w.r.t.static int
crossProduct(int x1, int y1, int x2, int y2)
determine the cross product and return negative number if the 2nd set of values, p1, are clockwise from the first, p1, w.r.t.static double
direction(float x1, float y1, float x2, float y2, float x3, float y3)
calculate the direction of change for the 2 vectors P1:P2 to P1:P3 returns negative when direction is clockwise, else if zero the vectors are collinear, else if positive the direction is counterclockwise.static int
direction(int x1, int y1, int x2, int y2, int x3, int y3)
calculate the direction of change for the 2 vectors P1:P2 to P1:P3 returns positive when direction is clockwise, else if zero the vectors are collinear, else if negative the direction is counterclockwise.static double
direction(PairIntWithIndex p1, PairIntWithIndex p2, PairIntWithIndex p3)
calculate the direction of change for the 2 vectors P1:P2 to P1:P3 returns negative when direction is clockwise, else if zero the vectors are collinear, else if positive the directions is counterclockwise.static <T extends algorithms.util.PairInt>
doubledirection(T p1, T p2, T p3)
calculate the direction of change for the 2 vectors P1:P2 to P1:P3 returns negative when direction is clockwise, else if zero the vectors are collinear, else if positive the directions is counterclockwise.protected static int
distanceSqEucl(int x1, int y1, int x2, int y2)
static double
distSquared(double x1, double y1, double x2, double y2)
static boolean
linesIntersect(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
from pseudocode in "Introduction to Algorithms" by Cormen et al.static boolean
linesIntersect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
from pseudocode in "Introduction to Algorithms" by Cormen et al.(package private) static boolean
onSegment(float x1, float y1, float x2, float y2, float x3, float y3)
(package private) static boolean
onSegment(int x1, int y1, int x2, int y2, int x3, int y3)
test whether (x3, y3) is between (x1,y1) and (x2,y2) on same segment.static boolean
pointIsInLine(float xPt, float yPt, float x2, float y2, float x3, float y3)
static boolean
pointIsInLine(int xPt, int yPt, int x2, int y2, int x3, int y3)
-
-
-
Method Detail
-
distSquared
public static double distSquared(double x1, double y1, double x2, double y2)
-
direction
public static double direction(float x1, float y1, float x2, float y2, float x3, float y3)
calculate the direction of change for the 2 vectors P1:P2 to P1:P3 returns negative when direction is clockwise, else if zero the vectors are collinear, else if positive the direction is counterclockwise. p2 p3 / \ / p1- Parameters:
x1
-y1
-x2
-y2
-x3
-y3
-- Returns:
-
direction
public static <T extends algorithms.util.PairInt> double direction(T p1, T p2, T p3)
calculate the direction of change for the 2 vectors P1:P2 to P1:P3 returns negative when direction is clockwise, else if zero the vectors are collinear, else if positive the directions is counterclockwise. p2 p3 / \ / p1- Parameters:
p1
-p2
-p3
-- Returns:
-
direction
public static double direction(PairIntWithIndex p1, PairIntWithIndex p2, PairIntWithIndex p3)
calculate the direction of change for the 2 vectors P1:P2 to P1:P3 returns negative when direction is clockwise, else if zero the vectors are collinear, else if positive the directions is counterclockwise. p2 p3 / \ / p1- Parameters:
p1
-p2
-p3
-- Returns:
-
crossProduct
public static double crossProduct(double x1, double y1, double x2, double y2)
determine the cross product and return negative number if the 2nd set of values, p1, are clockwise from the first, p1, w.r.t. origin (0,0). P2 . . . * P1 <--- P2 is counterclockwise from P1 w.r.t. origin o . o P2 . P1 * . <--- P2 is clockwise from P1 w.r.t. origin o . . o
- Parameters:
x1
-y1
-x2
-y2
-- Returns:
-
linesIntersect
public static boolean linesIntersect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
from pseudocode in "Introduction to Algorithms" by Cormen et al. runtime complexity is O(N lg N) where N is the number of line segments. worse case runtime complexity is O(N^2).- Parameters:
x1
-y1
-x2
-y2
-x3
-y3
-x4
-y4
-- Returns:
-
direction
public static int direction(int x1, int y1, int x2, int y2, int x3, int y3)
calculate the direction of change for the 2 vectors P1:P2 to P1:P3 returns positive when direction is clockwise, else if zero the vectors are collinear, else if negative the direction is counterclockwise. p2 p3 / \ / p1- Parameters:
x1
-y1
-x2
-y2
-x3
-y3
-- Returns:
-
crossProduct
public static int crossProduct(int x1, int y1, int x2, int y2)
determine the cross product and return negative number if the 2nd set of values, p1, are clockwise from the first, p1, w.r.t. origin (0,0).o P2 . . . o P1 P2 is counterclockwise from P1 . 0 --------------------------------------------------------- o P2 . P1 o . P2 is clockwise from P1 . . 0
- Parameters:
x1
-y1
-x2
-y2
-- Returns:
-
onSegment
static boolean onSegment(int x1, int y1, int x2, int y2, int x3, int y3)
test whether (x3, y3) is between (x1,y1) and (x2,y2) on same segment.
-
linesIntersect
public static boolean linesIntersect(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
from pseudocode in "Introduction to Algorithms" by Cormen et al. runtime complexity is O(N lg N) where N is the number of line segments. worse case runtime complexity is O(N^2).- Parameters:
x1
-y1
-x2
-y2
-x3
-y3
-x4
-y4
-- Returns:
-
crossProduct
public static float crossProduct(float x1, float y1, float x2, float y2)
determine the cross product and return negative number if the 2nd set of values, p1, are clockwise from the first, p1, w.r.t. origin (0,0).o P2 . . . o P1 P2 is counterclockwise from P1 . 0 --------------------------------------------------------- o P2 . P1 o . P2 is clockwise from P1 . . 0
- Parameters:
x1
-y1
-x2
-y2
-- Returns:
-
onSegment
static boolean onSegment(float x1, float y1, float x2, float y2, float x3, float y3)
-
pointIsInLine
public static boolean pointIsInLine(int xPt, int yPt, int x2, int y2, int x3, int y3)
-
pointIsInLine
public static boolean pointIsInLine(float xPt, float yPt, float x2, float y2, float x3, float y3)
-
calcClockwiseAngle
public static double calcClockwiseAngle(int x1, int y1, int x2, int y2, int x3, int y3)
Calculate the angle of segment P3:P1 sweeping clockwise to segment P3:P2. Internally, the method uses the law of cosines and the direction method.P1 P2 P3
NOTE that if given a single point, it will return NaN- Parameters:
x1
-y1
-x2
-y2
-x3
-y3
-- Returns:
-
calcAngle
public static double calcAngle(int x1, int y1, int x2, int y2, int x3, int y3)
Calculate the angle of segment P3:P1 sweeping clockwise to segment P3:P2. Internally, the method uses the law of cosines and the direction method.P1 P2 P3
- Parameters:
x1
-y1
-x2
-y2
-x3
-y3
-- Returns:
-
distanceSqEucl
protected static int distanceSqEucl(int x1, int y1, int x2, int y2)
-
calcPolarLineEndPoints
public static int[] calcPolarLineEndPoints(int thetaDegrees, int radius, int imageWidth, int imageHeight)
NOT YET TESTED given a polar angle and radius, calculate the line perpendicular to that point where it intersects with the image boundary.- Parameters:
thetaDegress
-radius
-imageWidth
-imageHeight
-- Returns:
- new int[] {x1, y1, x2, y2}
-
-


--- layout: post title: Devzone article on OSnews date: 2008-12-22 19:04:46.000000000 +05:30 categories: - Nexenta - Opensolaris - tech tags: - devzone - osnews status: publish type: post published: true meta: _edit_last: '1' author: login: admin email<EMAIL_ADDRESS>display_name: admin first_name: '' last_name: '' ---
I just published a devzone article on OSnews.
[caption id="" align="aligncenter" width="400" caption="Devzone"][/caption]
From the blurb:
Devzones, short for development zones, is a type of virtualization found in the Nexenta distribution. It can be used to define a base developer environment, which can be easily cloned many times. These copies can easily be destroyed and recreated. Devzones are built upon Opensolaris Zones, which are extensions of a chroot-like environment for the entire installed system. In other words, it allows for virtualization of an Opensolaris environment (and variants of Linux), without the performance hit that is generally associated with virtualization. This article gives a practical introduction into using Devzones. Read more on this exclusive OSNews article...
The devzone homepage: http://devzone.sf.net


BUNG BUNG!!