Press Space to Play.
score
00000
rows
0
level
0
Sorry, this example cannot be run because your browser does not support the <canvas> element


100
6.1.4.b relevant property
You must see the output "Discount : 100" after you activate the Enter 1500 trigger, but not when you activate the Enter 250 trigger.
Order Amount:
Discount :
Enter 250
250
Enter 1500
1500


|
Panda3D
|
Defines a particular DistributedClass as read from an input .dc file. More...
Public Member Functions | |
| Datagram | aiFormatGenerate (object distobj, DOIDTYPE do_id, ZONEIDTYPE parent_id, ZONEIDTYPE zone_id, CHANNELTYPE district_channel_id, CHANNELTYPE from_channel_id, object optional_fields) |
| Datagram | aiFormatUpdate (str field_name, DOIDTYPE do_id, CHANNELTYPE to_id, CHANNELTYPE from_id, object args) |
| Generates a datagram containing the message necessary to send an update for the indicated distributed object from the AI. More... | |
| Datagram | aiFormatUpdateMsgType (str field_name, DOIDTYPE do_id, CHANNELTYPE to_id, CHANNELTYPE from_id, int msg_type, object args) |
| Generates a datagram containing the message necessary to send an update, using the indicated msg type for the indicated distributed object from the AI. More... | |
| Datagram | clientFormatGenerateCMU (object distobj, DOIDTYPE do_id, ZONEIDTYPE zone_id, object optional_fields) |
| Generates a datagram containing the message necessary to generate a new distributed object from the client. More... | |
| Datagram | clientFormatUpdate (str field_name, DOIDTYPE do_id, object args) |
| Generates a datagram containing the message necessary to send an update for the indicated distributed object from the client. More... | |
| directUpdate (object distobj, str field_name, const Datagram datagram) | |
| Processes an update for a named field from a packed datagram. More... | |
| directUpdate (object distobj, str field_name, VectorUchar value_blob) | |
| Processes an update for a named field from a packed value blob. More... | |
| object | getClassDef () |
| Returns the class object that was previously associated with this DistributedClass. More... | |
| DCField | getConstructor () |
| Returns the constructor method for this class if it is defined, or NULL if the class uses the default constructor. More... | |
| DCFile | getDcFile () |
| Returns the DCFile object that contains the class. More... | |
| DCField | getField (int n) |
| Returns the nth field in the class. More... | |
| DCField | getFieldByIndex (int index_number) |
| Returns a pointer to the DCField that has the indicated index number. More... | |
| DCField | getFieldByName (str name) |
| Returns a pointer to the DCField that shares the indicated name. More... | |
| DCField | getInheritedField (int n) |
| Returns the nth field field in the class and all of its ancestors. More... | |
| str | getName () |
| Returns the name of this class. More... | |
| int | getNumber () |
| Returns a unique index number associated with this class. More... | |
| int | getNumFields () |
| Returns the number of fields defined directly in this class, ignoring inheritance. More... | |
| int | getNumInheritedFields () |
| Returns the total number of field fields defined in this class and all ancestor classes. More... | |
| int | getNumParents () |
| Returns the number of base classes this class inherits from. More... | |
| object | getOwnerClassDef () |
| Returns the owner class object that was previously associated with this DistributedClass. More... | |
| DCClass | getParent (int n) |
| Returns the nth parent class this class inherits from. More... | |
| bool | hasClassDef () |
| Returns true if the DCClass object has an associated Python class definition, false otherwise. More... | |
| bool | hasConstructor () |
| Returns true if this class has a constructor method, false if it just uses the default constructor. More... | |
| bool | hasOwnerClassDef () |
| Returns true if the DCClass object has an associated Python owner class definition, false otherwise. More... | |
| bool | inheritsFromBogusClass () |
| Returns true if this class, or any class in the inheritance heirarchy for this class, is a "bogus" class–a forward reference to an as-yet-undefined class. More... | |
| bool | isBogusClass () |
| Returns true if the class has been flagged as a bogus class. More... | |
| bool | isStruct () |
| Returns true if the class has been identified with the "struct" keyword in the dc file, false if it was declared with "dclass". More... | |
| output (Ostream out) | |
| Write a string representation of this instance to <out>. More... | |
| bool | packRequiredField (Datagram datagram, object distobj, const DCField field) |
| Looks up the current value of the indicated field by calling the appropriate get*() function, then packs that value into the datagram. More... | |
| bool | packRequiredField (DCPacker packer, object distobj, const DCField field) |
| Looks up the current value of the indicated field by calling the appropriate get*() function, then packs that value into the packer. More... | |
| receiveUpdate (object distobj, DatagramIterator di) | |
| Extracts the update message out of the packer and applies it to the indicated object by calling the appropriate method. More... | |
| receiveUpdateAllRequired (object distobj, DatagramIterator di) | |
| Processes a big datagram that includes all of the "required" fields that are sent when an avatar is created. More... | |
| receiveUpdateBroadcastRequired (object distobj, DatagramIterator di) | |
| Processes a big datagram that includes all of the "required" fields that are sent along with a normal "generate with required" message. More... | |
| receiveUpdateBroadcastRequiredOwner (object distobj, DatagramIterator di) | |
| Processes a big datagram that includes all of the "required" fields that are sent along with a normal "generate with required" message. More... | |
| receiveUpdateOther (object distobj, DatagramIterator di) | |
| Processes a datagram that lists some additional fields that are broadcast in one chunk. More... | |
| setClassDef (object class_def) | |
| Sets the class object associated with this DistributedClass. More... | |
| setOwnerClassDef (object owner_class_def) | |
| Sets the owner class object associated with this DistributedClass. More... | |
| startGenerate () | |
| Starts the PStats timer going on the "generate" task, that is, marks the beginning of the process of generating a new object, for the purposes of timing this process. More... | |
| stopGenerate () | |
| Stops the PStats timer on the "generate" task. More... | |
| Public Member Functions inherited from DCDeclaration | |
| DCClass | asClass () |
| const DCClass | asClass () |
| DCSwitch | asSwitch () |
| const DCSwitch | asSwitch () |
| output (Ostream out) | |
| Write a string representation of this instance to <out>. More... | |
| write (Ostream out, int indent_level) | |
| Write a string representation of this instance to <out>. More... | |
Defines a particular DistributedClass as read from an input .dc file.
| Datagram aiFormatGenerate | ( | object | distobj, |
| DOIDTYPE | do_id, | ||
| ZONEIDTYPE | parent_id, | ||
| ZONEIDTYPE | zone_id, | ||
| CHANNELTYPE | district_channel_id, | ||
| CHANNELTYPE | from_channel_id, | ||
| object | optional_fields | ||
| ) |
| Datagram aiFormatUpdate | ( | str | field_name, |
| DOIDTYPE | do_id, | ||
| CHANNELTYPE | to_id, | ||
| CHANNELTYPE | from_id, | ||
| object | args | ||
| ) |
Generates a datagram containing the message necessary to send an update for the indicated distributed object from the AI.
| Datagram aiFormatUpdateMsgType | ( | str | field_name, |
| DOIDTYPE | do_id, | ||
| CHANNELTYPE | to_id, | ||
| CHANNELTYPE | from_id, | ||
| int | msg_type, | ||
| object | args | ||
| ) |
Generates a datagram containing the message necessary to send an update, using the indicated msg type for the indicated distributed object from the AI.
| Datagram clientFormatGenerateCMU | ( | object | distobj, |
| DOIDTYPE | do_id, | ||
| ZONEIDTYPE | zone_id, | ||
| object | optional_fields | ||
| ) |
Generates a datagram containing the message necessary to generate a new distributed object from the client.
This requires querying the object for the initial value of its required fields.
optional_fields is a list of fieldNames to generate in addition to the normal required fields.
This method is only called by the CMU implementation.
| Datagram clientFormatUpdate | ( | str | field_name, |
| DOIDTYPE | do_id, | ||
| object | args | ||
| ) |
Generates a datagram containing the message necessary to send an update for the indicated distributed object from the client.
| directUpdate | ( | object | distobj, |
| str | field_name, | ||
| const Datagram | datagram | ||
| ) |
Processes an update for a named field from a packed datagram.
| directUpdate | ( | object | distobj, |
| str | field_name, | ||
| VectorUchar | value_blob | ||
| ) |
Processes an update for a named field from a packed value blob.
| object getClassDef | ( | ) |
Returns the class object that was previously associated with this DistributedClass.
This will return a new reference to the object.
| DCField getConstructor | ( | ) |
Returns the constructor method for this class if it is defined, or NULL if the class uses the default constructor.
| DCField getField | ( | int | n | ) |
Returns the nth field in the class.
This is not necessarily the field with index n; this is the nth field defined in the class directly, ignoring inheritance.
| DCField getFieldByIndex | ( | int | index_number | ) |
Returns a pointer to the DCField that has the indicated index number.
If the numbered field is not found in the current class, the parent classes will be searched, so the value returned may not actually be a field within this class. Returns NULL if there is no such field defined.
| DCField getFieldByName | ( | str | name | ) |
Returns a pointer to the DCField that shares the indicated name.
If the named field is not found in the current class, the parent classes will be searched, so the value returned may not actually be a field within this class. Returns NULL if there is no such field defined.
| DCField getInheritedField | ( | int | n | ) |
Returns the nth field field in the class and all of its ancestors.
This used to be the same thing as get_field_by_index(), back when the fields were numbered sequentially within a class's inheritance hierarchy. Now that fields have a globally unique index number, this is no longer true.
| str getName | ( | ) |
Returns the name of this class.
| int getNumber | ( | ) |
Returns a unique index number associated with this class.
This is defined implicitly when the .dc file(s) are read.
| int getNumFields | ( | ) |
Returns the number of fields defined directly in this class, ignoring inheritance.
| int getNumInheritedFields | ( | ) |
Returns the total number of field fields defined in this class and all ancestor classes.
| int getNumParents | ( | ) |
Returns the number of base classes this class inherits from.
| object getOwnerClassDef | ( | ) |
Returns the owner class object that was previously associated with this DistributedClass.
This will return a new reference to the object.
| DCClass getParent | ( | int | n | ) |
Returns the nth parent class this class inherits from.
| bool hasClassDef | ( | ) |
Returns true if the DCClass object has an associated Python class definition, false otherwise.
| bool hasConstructor | ( | ) |
Returns true if this class has a constructor method, false if it just uses the default constructor.
| bool hasOwnerClassDef | ( | ) |
Returns true if the DCClass object has an associated Python owner class definition, false otherwise.
| bool inheritsFromBogusClass | ( | ) |
Returns true if this class, or any class in the inheritance heirarchy for this class, is a "bogus" class–a forward reference to an as-yet-undefined class.
| bool isBogusClass | ( | ) |
Returns true if the class has been flagged as a bogus class.
This is set for classes that are generated by the parser as placeholder for missing classes, as when reading a partial file; it should not occur in a normal valid dc file.
| bool isStruct | ( | ) |
Returns true if the class has been identified with the "struct" keyword in the dc file, false if it was declared with "dclass".
| output | ( | Ostream | out | ) |
Write a string representation of this instance to <out>.
Looks up the current value of the indicated field by calling the appropriate get*() function, then packs that value into the datagram.
This field is presumably either a required field or a specified optional field, and we are building up a datagram for the generate-with-required message.
Returns true on success, false on failure.
Looks up the current value of the indicated field by calling the appropriate get*() function, then packs that value into the packer.
This field is presumably either a required field or a specified optional field, and we are building up a datagram for the generate-with-required message.
Returns true on success, false on failure.
| receiveUpdate | ( | object | distobj, |
| DatagramIterator | di | ||
| ) |
Extracts the update message out of the packer and applies it to the indicated object by calling the appropriate method.
| receiveUpdateAllRequired | ( | object | distobj, |
| DatagramIterator | di | ||
| ) |
Processes a big datagram that includes all of the "required" fields that are sent when an avatar is created.
This is all of the atomic fields that are marked "required", whether they are broadcast or not.
| receiveUpdateBroadcastRequired | ( | object | distobj, |
| DatagramIterator | di | ||
| ) |
Processes a big datagram that includes all of the "required" fields that are sent along with a normal "generate with required" message.
This is all of the atomic fields that are marked "broadcast required".
| receiveUpdateBroadcastRequiredOwner | ( | object | distobj, |
| DatagramIterator | di | ||
| ) |
Processes a big datagram that includes all of the "required" fields that are sent along with a normal "generate with required" message.
This is all of the atomic fields that are marked "broadcast ownrecv". Should be used for 'owner-view' objects.
| receiveUpdateOther | ( | object | distobj, |
| DatagramIterator | di | ||
| ) |
Processes a datagram that lists some additional fields that are broadcast in one chunk.
| setClassDef | ( | object | class_def | ) |
Sets the class object associated with this DistributedClass.
This object will be used to construct new instances of the class.
| setOwnerClassDef | ( | object | owner_class_def | ) |
Sets the owner class object associated with this DistributedClass.
This object will be used to construct new owner instances of the class.
| startGenerate | ( | ) |
Starts the PStats timer going on the "generate" task, that is, marks the beginning of the process of generating a new object, for the purposes of timing this process.
This should balance with a corresponding call to stop_generate().
| stopGenerate | ( | ) |
Stops the PStats timer on the "generate" task.
This should balance with a preceding call to start_generate().


The same as sethc, just with a different utility. Utilman runs as SYSTEM, so if the application is replaced with cmd.exe, easy shell. Trigger is WIN + U
Without rebooting:
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\utilman.exe" /t REG_SZ /v Debugger /d “C:\windows\system32\cmd.exe” /f
Windows Utility Manager, launched with the button on the login screen or with Win + U


WebRTC
RTC (Real-Time Communications) technology enables video and audio communication over computer networks. Historically, RTC systems have been complex, expensive, and proprietary.
Recently, WebRTC standards have made RTC more accessible, bringing it to open source and freely-available web runtimes. WebRTC enables developers to build RTC systems using standard web technologies (HTML and JavaScript), without the need for plugins or downloads.
WebRTC APIs are available in Crosswalk 5 or later on ARM; and Crosswalk <IP_ADDRESS> or later for x86. They are also widely supported in modern browsers.
The WebRTC APIs can be used in a range of situations, such as:
- Implementing dedicated chat applications on the web (with or without audio and video).
- Adding video chat to web applications (e.g. support desk software).
- Passing data between clients in multi-player HTML5 games.
- Web-based collaborative document editing.
In the following tutorial, you'll develop a simple video call client and related server infrastructure using WebRTC.
All of the source code for the tutorial is available as part of the crosswalk-samples download, or on github at https://github.com/crosswalk-project/crosswalk-samples (inside the webrtc
directory).
Introduction to the tutorial
In this tutorial, you will develop two components:
Client application (installed on two target devices)
A very simple video call client, using WebRTC to transport data between the clients. The application will enable one client to "dial" the other client and make a video call (with audio).
This application only works between two clients, but can be extended to multiple clients fairly easily. It can be run in a Chrome or Firefox browser, or in an Android app wrapped in Crosswalk.
For the purposes of testing, you'll install this on two targets.
The user interface is written using standard HTML5 and JavaScript (no plugins).
Server (installed on a desktop/laptop)
The server brokers the initial connection between the two clients. Once a connection is established between the clients, their communication continues in a peer to peer mode: none of the video data is routed through the server.
The server is also written in JavaScript, but runs from the command-line (not in a browser).
To keep the tutorial simple, a WebRTC wrapper library is used to manage communications between clients. (WebRTC is a complex low-level protocol, and unless you are interested in writing your own WebRTC wrapper library, knowledge of the fine detail is not required.) The library used in this tutorial is PeerJS.
By the end of this tutorial, you will understand how to write a basic WebRTC application with PeerJS and run it on Android using Crosswalk.
How video calling works in the application
This is what the client application looks like when a call is in progress:
Here are the steps involved in setting up the server and clients to establish a call:
The server is started. This should be done on a machine with a known IP address, as this has to be hard-coded into the client application.
The PeerJS server uses WebSockets to set up the initial connections between clients, but this is not mandated by the specification: if you prefer to use another mechanism to establish the connection (e.g. Bluetooth or NFC), the specification does not prevent this.
The two client applications are started, one as a Crosswalk application (as shown in the image above) and one on a Chrome browser or a second Android device (either using Chrome or Crosswalk).
Each client application connects to the server, identifying itself via a unique string which becomes its ID.
At the same time as the connection is being set up, the local media streams (audio and video) are captured via the
navigator.getUserMedia()
method. Thesrc
attribute of a<video>
element is set to the URL for the local media stream, giving a preview of what the person on the other end will see when a call is initiated (the "LOCAL" video element in the screenshot above).One client initiates a call to the other, using the recipient's ID. Note that the caller needs to know the recipient's ID, as there's no way to discover it from the application. Obviously, in a more realistic application, you could provide a contacts list. (Note that PeerJS provides a mechanism for listing connected clients: see Aside: querying connected clients for details.)
Under the covers, the clients use the RTCPeerConnection API to establish the peer to peer connection.
Once the connection has been established, the application uses the media stream from the other end of the call as the source for a second
<video>
element (the "REMOTE" video element in the screenshot above).
Pre-requisites
This section covers the pre-requisite software and hardware you'll need in this tutorial. You will need:
- A host for developing the code and running the server.
- Two targets to run the client application. One of these could be the same machine as the host.
To give an example of suitable devices, here is the setup used to write this tutorial:
- Linux desktop with webcam and Google Chrome. This was used as the development host, as well as one of the targets. The client application ran directly from the filesystem (it was not deployed via Crosswalk or web server).
- HTC OneX phone (ARM) running Android 4.0.4 (which has a user-facing camera). This was used as the second target. The client application was deployed to it via Crosswalk.
- ZTE Geek phone (x86) running Android 4.2.2.
You could have a host machine to run the server and two Android devices to run the client applications if you prefer. Alternatively, you could use one or more emulated Android devices, providing they are able to emulate the camera.
Host setup
The host should first be set up for Crosswalk Android development (Windows, Linux). Pay particular attention to the Installation for Crosswalk Android section.
You will also need to install node to run the server. Providing you use a recent enough version of node, it should also include the npm package manager; if not, you will need to install that separately.
Target setup
For Android targets, ensure that you have access via adb. No special setup is required beyond that.
If you are using a desktop machine as a target, no special setup is required, other than ensuring that you have a Chrome browser installed.
Setting up the project
Make a project directory:
$ mkdir xwalk-webrtc
The server and client code will be put into separate directories, as they have no dependencies on each other.
Server code
Make a directory for the server code:
$ cd xwalk-webrtc $ mkdir server $ cd server
Install the peer library via
npm
(in theserver
directory):$ npm install peer
This provides the PeerJS server library.
Install the ip library via
npm
(still in theserver
directory):$ npm install ip
This library used to show the IP address of the server when it starts, to make it a bit easier to set up the clients.
Create an
index.js
file containing the server code:var ip = require('ip'); var PeerServer = require('peer').PeerServer; var port = 9000; var server = new PeerServer({port: port}); server.on('connection', function (id) { console.log('new connection with id ' + id); }); server.on('disconnect', function (id) { console.log('disconnect with id ' + id); }); console.log('peer server running on ' + ip.address() + ':' + port);
This server shows the IDs of clients as they connect, to make debugging a bit easier.
You should now be able to start the server (from the
server/
directory):$ node index.js peer server running on <IP_ADDRESS>:9000
Note that your IP address is likely to be different.
Make a note of the IP address shown, as you will need to encode this into the client application.
Aside: querying connected clients
The PeerJS server can be configured to allow querying of the list of connected clients: just set the allow_discovery
option to true
when starting it:
var server = new PeerServer({port: port, allow_discovery: true});
Once this is done, you can get an array of connected clients by sending an HTTP request to:
http://<peer server IP and port>/peerjs/peers
This functionality is not used in this tutorial, but could be used as the basis for address book functionality in a more complex application.
Client code
The client code is bare but functional. Its purpose is to demonstrate the minimal amount of code required for a useful WebRTC application. However, note that the error checking and recovery is consequently also minimal: this means that unless you follow the steps to make a call precisely, you may run into unrecoverable errors. The Troubleshooting section covers some of the most common issues and explains how to "reset" if things go wrong.
To add the client code, follow these steps:
Make a directory for the code:
$ mkdir client
Go to the
client/
directory:$ cd client
Download PeerJS (the client-side variant):
$ wget https://raw.githubusercontent.com/peers/peerjs/master/dist/peer.js
If you don't have
wget
on your system, open the above URL in a browser and use Save as... to download a copy into theclient/
directory.Create the HTML file
index.html
. This is the user interface for the application:<!DOCTYPE html>   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>WebRTC client</title>

 Connect as: <input type="text" id="caller-id" size="15"> <button id="connect">Connect</button>

 Make call to: <input type="select" id="recipient-id"> </input> <button id="dial">Call</button>

REMOTE:
 <video id="remote-video" autoplay></video>

LOCAL:
 <video id="local-video" autoplay></video>

This imports two JavaScript files: the
peer.js
file you downloaded previously, and amain.js
file. The latter is what you'll create in the next step.Note that
index.html
has some inline CSS in the
element. Usually, it's best not to do this; but as there is very little CSS in this application (because it's so simple), it makes sense to avoid adding an additional file for it.Create the
main.js
JavaScript file. This wires up the user interface elements to the PeerJS library, so a user can make a call to another client and show the local and remote video streams. The steps involved are described above in How video calling works in the application.Edit the
main.js
file, adding the following content:document.addEventListener('DOMContentLoaded', function () { // PeerJS server location var SERVER_IP = '<IP_ADDRESS>'; var SERVER_PORT = 9000; // DOM elements manipulated as user interacts with the app var messageBox = document.querySelector('#messages'); var callerIdEntry = document.querySelector('#caller-id'); var connectBtn = document.querySelector('#connect'); var recipientIdEntry = document.querySelector('#recipient-id'); var dialBtn = document.querySelector('#dial'); var remoteVideo = document.querySelector('#remote-video'); var localVideo = document.querySelector('#local-video'); // the ID set for this client var callerId = null; // PeerJS object, instantiated when this client connects with its // caller ID var peer = null; // the local video stream captured with getUserMedia() var localStream = null; // DOM utilities var makePara = function (text) { var p = document.createElement('p'); p.innerText = text; return p; }; var addMessage = function (para) { if (messageBox.firstChild) { messageBox.insertBefore(para, messageBox.firstChild); } else { messageBox.appendChild(para); } }; var logError = function (text) { var p = makePara('ERROR: ' + text); p.style.color = 'red'; addMessage(p); }; var logMessage = function (text) { addMessage(makePara(text)); }; // get the local video and audio stream and show preview in the // "LOCAL" video element // successCb: has the signature successCb(stream); receives // the local video stream as an argument var getLocalStream = function (successCb) { if (localStream && successCb) { successCb(localStream); } else { navigator.webkitGetUserMedia( { audio: true, video: true }, function (stream) { localStream = stream; localVideo.src = window.URL.createObjectURL(stream); if (successCb) { successCb(stream); } }, function (err) { logError('failed to access local camera'); logError(err.message); } ); } }; // set the "REMOTE" video element source var showRemoteStream = function (stream) { remoteVideo.src = window.URL.createObjectURL(stream); }; // set caller ID and connect to the PeerJS server var connect = function () { callerId = callerIdEntry.value; if (!callerId) { logError('please set caller ID first'); return; } try { // create connection to the ID server peer = new Peer(callerId, {host: SERVER_IP, port: SERVER_PORT}); // hack to get around the fact that if a server connection cannot // be established, the peer and its socket property both still have // open === true; instead, listen to the wrapped WebSocket // and show an error if its readyState becomes CLOSED peer.socket._socket.onclose = function () { logError('no connection to server'); peer = null; }; // get local stream ready for incoming calls once the wrapped // WebSocket is open peer.socket._socket.onopen = function () { getLocalStream(); }; // handle events representing incoming calls peer.on('call', answer); } catch (e) { peer = null; logError('error while connecting to server'); } }; // make an outgoing call var dial = function () { if (!peer) { logError('please connect first'); return; } if (!localStream) { logError('could not start call as there is no local camera'); return } var recipientId = recipientIdEntry.value; if (!recipientId) { logError('could not start call as no recipient ID is set'); return; } getLocalStream(function (stream) { logMessage('outgoing call initiated'); var call = peer.call(recipientId, stream); call.on('stream', showRemoteStream); call.on('error', function (e) { logError('error with call'); logError(e.message); }); }); }; // answer an incoming call var answer = function (call) { if (!peer) { logError('cannot answer a call without a connection'); return; } if (!localStream) { logError('could not answer call as there is no localStream ready'); return; } logMessage('incoming call answered'); call.on('stream', showRemoteStream); call.answer(localStream); }; // wire up button events connectBtn.addEventListener('click', connect); dialBtn.addEventListener('click', dial); });
Near the top of the
main.js
file, there is one line which needs to be edited for your environment:var SERVER_IP = '<IP_ADDRESS>';
Change the IP address to the value output by the PeerJS server when you started it.
Create a minimal Crosswalk manifest file,
manifest.json
, with this content:{ "name": "WebRTC", "description": "WebRTC client", "version": "0.0.1", "app": { "launch": { "local_path": "index.html" } } }
This provides the minimal metadata required for packaging by Crosswalk Android.
You are now ready to run the client application on your two targets, either on a desktop machine (Windows or Linux) or an Android device.
Run on a desktop machine with Chrome
To run the application on a desktop machine via Chrome, do the following:
Close Chrome. This is so you can start it with the correct command-line options in the next step.
If you open an application in Chrome (via a
file://
URI), access to the webcam is blocked by default. Because you're going to open the application directly from the filesystem via afile://
URI, you therefore need to explicitly enable access to the webcam.The solution is to start Chrome with the
--allow-file-access-from-files
option, which givesfile://
URIs access to the webcam (as well as other things). As an example, to start the WebRTC client on Linux with Chrome, you would use the following command line:$ google-chrome --allow-file-access-from-files \ file:///<path to xwalk-webrtc>/client/index.html
The webcam should now be accessible.
Run on Android with Crosswalk
During the host setup for Android (Windows, Linux), you will have downloaded the Crosswalk Android bundle. You can use this to generate an Android package for the client application. Full details are on this page, but here's a summary (tested on Linux):
$ cd crosswalk-${XWALK-STABLE-ANDROID-X86}
$ python make_apk.py --package=org.crosswalkproject.example \
--manifest=xwalk-webrtc/client/manifest.json
...
An APK for the web application "WebRTC" including the
Crosswalk Runtime built for x86 was generated successfully,
which can be found at
/home/me/crosswalk-${XWALK-STABLE-ANDROID-X86}/WebRTC_0.0.1_x86.apk.
An APK for the web application "WebRTC" including the
Crosswalk Runtime built for arm was generated successfully,
which can be found at
/home/me/crosswalk-${XWALK-STABLE-ANDROID-X86}/WebRTC_0.0.1_arm.apk.
# install the package for your target's architecture
$ adb install /home/me/crosswalk-${XWALK-STABLE-ANDROID-X86}/WebRTC_0.0.1_arm.apk
Finally, start the application on the target by selecting its icon in the applications list.
Make a call
Once the application is running on two targets, you should be able to make a call between them by following these steps:
Make sure the PeerJS server is running.
In the first client, enter a string in the Connect as text box (I used "elliot"). Click the Connect button.
If you are using Chrome, you will be prompted to allow the application to use the webcam:
Click on Allow to grant access.
A preview of the stream from the first client's camera should load into the "LOCAL" video element.
Check the console window where the PeerJS server is running. You should see some output like this:
new connection with id elliot
In the second client, do the same: enter a name to Connect as and click Connect. Make sure you use a name which is different from the one you used for the first client (I used "chewie").
A preview of the stream from the second client's camera should load into the "LOCAL" video element.
Check the PeerJS console again for the connection message:
new connection with id chewie
Go back to the first client.
In the Make call to text entry, enter the ID of the second client:
Click the Call button.
In the first client, you should see a message which states: "outgoing call initiated". You should eventually see the stream from the second client in the "REMOTE" video element.
In the second client, you should see a message which states: "incoming call answered". You should eventually see the stream from the first client in the "REMOTE" video element.
Troubleshooting
If one or both of the client applications isn't working, or you have problems making a call, there are a few things you can try:
Check the PeerJS server output. Make sure that connection requests are reaching the server and that it is registering the IDs correctly.
Make sure that you set the
SERVER_IP
variable in themain.js
file to the correct value (the IP address of the machine running the PeerJS server).Try opening two tabs in a single Chrome browser on a laptop machine, and load the client application into both. These tabs can still make calls to each other, but it's much easier to get at the logs (through the developer console: Ctrl+Shift+j).
To debug the client application running in Crosswalk Android, build the package with the
--enable-remote-debugging
option:$ python make_apk.py --package=org.crosswalkproject.example \ --enable-remote-debugging --manifest=...
Once the application is launched on the Android target, open Chrome and go to the special "chrome://inspect" address. You should see the Android target listed, along with applications which can be debugged:
Click on the link to open a console for the application. Look for error messages.
As a last resort, you can reset the clients and server:
- Ctrl+c in the server console, then restart it with
node index.js
. - Refresh the client application in the browser with Ctrl+F5.
- Close the client application on Android (e.g. with the task manager) and start it again.
Once you've followed these steps, go through the steps in Make a call again and the call should work.
- Ctrl+c in the server console, then restart it with
Useful WebRTC resources
- W3C specification for WebRTC
- Google-sponsored webrtc.org website is a good starting point
- HTML5 Rocks introduction to WebRTC is also very useful.
Acknowledgements
The application developed in this tutorial uses the PeerJS JavaScript library; the client and the server libraries are released under the MIT licence.


--- layout: beatrice_page title: "Designing with Variable Fonts" description: "An introduction to the variable font format with visual explanations of weight, width, and other axes." permalink: /about-variable-fonts/ --- {% capture content %}
Variable fonts are an evolution of the OpenType specification. They let you use CSS to access all the styles contained in a single font file without worrying about browser distortions like fake bolds or italics.
Previously, using multiple styles meant loading multiple files—one for every width, weight, or italic. This created tension between design expressiveness (the number of fonts used) and website performance (the amount of data to download). With variable fonts, that whole equation changes.
{% endcapture %}Now you can use as many variations of a font as you like without slowing down your site
A variation axis is the expression of a single aspect of a typeface’s design.
{% comment %} {% endcomment %}The weight axis, for example, defines how light or bold a font looks. With standard fonts, the terms “normal” and “bold” refer to specific files that are called to serve those styles. With variable fonts, weight is conveyed through minimum and maximum numeric values, and designers or developers can choose any value in between.
Not every variable font will have every possible axis (weight will likely be the most popular), but the format, browser implementation, and operating systems guarantee they’ll all work as intended.
Axes are divided into 2 types, registered and custom. While there are currently 5 registered axes, type designers can define their own custom axes, creating any kind of variations they can dream up. There are fonts with custom axes for grade, expressiveness, the ascender and descender height of lowercase letters, and countless more. The format itself is purposely left open to allow this sort of innovation.
In the CSS, the abbreviations of the registered or conventional axes are written in lowercase, and the abbreviations of custom axes are written in uppercase.
The registered axes map to standard CSS attributes. Custom axes can be referenced using the new CSS attribute font-variation-settings
.
| Axis & Abbreviation | CSS attribute |
|---|---|
Weight (wght ) |
font-weight |
Width (wdth ) |
font-width |
Italic (ital ) |
font-style |
Slant (slnt ) |
font-style |
Optical size (opsz ) |
font-optical-sizing |
Downloading a single file instead of multiple individual fonts can yield a significant performance gain in reduced file size and fewer file requests.
Variable fonts are better for web and mobile apps
Since that single file includes the entire design space instead of a few very specific weights or other variants, the design vocabulary is much greater. Instead of only 1 or 2 weights, the entire available range can be referenced directly via CSS—from extra-light to extra-heavy, narrow to wide, upright to italic.
Effective use of type generates greater clarity and hierarchy, which benefits both design and user experience. There are accessibility benefits, too, like providing a way for users to increase font weight and color contrast to help with low vision, or making subtle adjustments to the typography for a dark-mode implementation for people who are sensitive to light.
Many typefaces are designed with at least regular and bold weights, and quite often with much lighter/thinner and bolder extremes.
With a variable font, the standard CSS attribute of font-weight
can be used with a number somewhere between the minimum and maximum value defined for the font. This allows far greater flexibility and precision in specifying weight than just a keyword like “normal” or “bold”. According to the OpenType specification, 400 should equate to normal for any given font. In practice, though, that varies quite a bit from typeface to typeface.
p {
font-weight: 425;
}
strong {
font-weight: 675;
}
A broader range for design elements, like an extra-thin weight for big quotes or a super-heavy one for extra emphasis, is very useful. It’s also worth experimenting with what it means for something to be “bold.”
Using a slightly less bold value for bold text inline with body copy (i.e., the strong
tag) can bring more legibility to emphasized text while still standing out. With heavier weights, characters tend to close up, so being just a little bolder at smaller sizes can still provide emphasis while preserving openness. Try setting strong
to a font-weight
somewhere between 500–600 instead of the default 700.
Width in typeface design is often expressed in terms like “condensed” or “compressed” or “extended”—though the exact meaning of those words is subjective. These terms all refer to how relatively narrow or wide a font is in relation to the “normal” design.
According to the specification, 100 should equate to a “normal” width, and valid values can range from 1 to 1000. Like weight, it maps to an existing CSS attribute, in this case font-stretch
, and is expressed as a percentage.
In these early stages of adoption, many type designers and foundries have not necessarily adhered to this standard. Number ranges like 3%–5%, while still valid, can look a little odd in your CSS (in this case 5% is actually the normal width). Hopefully over time more standardization will emerge.
p {
font-stretch: 89%;
}
Making sure larger headlines don’t end up fitting only one or two words per line can be a challenge on smaller screens. In addition to adjusting font-size
based on viewport size using techniques like media queries or viewport units and calc()
, a width axis can make headings slightly narrower, fitting more words per line without having to make the font-size
even smaller.
The italic axis is fairly straightforward. In most cases it’s a boolean 0 or 1: off ( upright) or on—usually meaning slanted strokes and sometimes glyph replacements (the lowercase a and g often have different italic forms, for example).
It’s possible to have a range rather than strictly 0 or 1, but the off/on scenario is the most common.
Unfortunately, while it is intended to map to font-style: italic
, this is one of the areas where browsers have not fully resolved the implementation. If you have separate variable font files for italic and upright (such as when you are referencing them from the Google Fonts API), then you can use the standard font-style: italic
syntax.
.italic-text {
font-style: italic;
}
If, however, you have a single variable font that contains both italic and upright axes, it’s necessary to use the lower-level syntax of font-variation-settings
. This is a good case for using a CSS custom property so that you can alter only the italic/upright setting without having to redeclare the entire font-variation-settings
string.
:root {
--text-ital: 0;
}
body {
font-variation-settings: 'ital' var(--text-ital);
}
em {
--text-ital: 1;
}
Having italics available alongside the upright forms is useful when combined with weight to handle everyday needs for body copy, requiring only 1 or 2 files instead of at least 4. Combined with the range of additional axes available in some typeface designs, there may be no need for other fonts at all.
The slant axis is similar to italic, but differs in two key ways. First, it’s expressed as a degree continuum, and according to the OpenType specification should be “greater than -90 and less than +90”; and, second, it doesn’t include glyph substitution. Usually associated with sans serifs, it allows for any value along the range specified. If the font in use only has a slant axis and no italics, use the standard attribute of font-style
, like so:
em {
font-style: oblique 12deg;
}
If the font in use has both slant and italic axes, then you have to use font-variation-settings
. In this case, it’s just a numeric value without the deg
nomenclature.
:root {
--text-slnt: 0;
}
body {
font-variation-settings: 'slnt' var(--text-slnt);
}
em {
--text-slnt: 12;
}
The slant axis allows for anything within the defined range. Opportunities abound to set the angle a little differently, or to add animation so the text slants just a little after the page loads. It’s a unique way to draw attention to a text element in an understated way.
The practice of optical sizing evolved in the sixteenth century, back when punchcutters were carving type out of metal by hand. It entailed cutting physically smaller type with slightly thicker strokes and less contrast to ensure it would print well and be legible at smaller sizes. Other aspects could be fine-tuned as well—apertures could become wider, terminals more angled, bowls enlarged. Conversely, larger point sizes would be cut with greater finesse, allowing for heightened contrast and intricate details. This allowed a single typeface design to work optimally at a range of physical sizes.
The practice of optical sizing was lost, however, with the shift to phototypesetting and then digital type. Both of these newer practices involved taking a single outline and scaling it up or down. The fine details that appeared so graceful at larger sizes grew muddy or even hampered legibility when type was scaled down; sturdier type that worked well in running text at smaller sizes became spindly and frail (especially on early lower-resolution screens) when scaled up. Regaining optical sizing in the form of a variable axis restores tremendous range to individual designs.
The concept is that the numeric value for this axis should match the rendered font size, and a new attribute was introduced to go along with it: font-optical-sizing
. The default is auto
, and this is supported behavior in all shipping browsers. You can force it to off
, or you can set an explicit value via font-variation-settings
.
body {
font-optical-sizing: auto;
}
Or:
:root {
--text-opsz: 16;
}
body {
font-variation-settings: 'opsz' var(--text-opsz);
}
h1 {
--text-opsz: 48;
font-size: 3em;
}
A good optical-size axis makes type more legible at smaller sizes. Tailoring it to the size at which it’s used makes a remarkable difference. On the other end of the spectrum, increased stroke contrast (and anything else the type designer decides to vary) means a single font can feel completely different when used smaller for body copy and larger for headings. The variable version of Roslindale (from David Jonathan Ross’ Font of the Month Club) in use on RWT.io (December 2019) showcases what a big impact this can have. The site uses a single font for both headings and body copy, yet they feel completely different in width, weight, and stroke contrast.
It’s unclear if the creators of the variable font specification were thinking of this when it was written, but technically there is no reason there can’t be separate axes for slant (i.e., angle) and italic (i.e., glyph substitution). Indeed, both David Jonathan Ross and Stephen Nixon have done just that, with Roslindale Italic and Recursive, respectively. With Recursive, it’s apparent how much flexibility can be achieved by separating the angle change from the glyph substitution. It can impart a completely different feel to a block of text to have an angle without the alternate forms. With the state of italic implementation and the fact that they share the same CSS attribute, this is a situation that requires the use of font-variation-settings
in order to set the attributes separately.
:root {
--text-ital: 0;
--text-slnt: 0;
}
body {
font-variation-settings: 'ital' var(--text-ital), 'slnt' var(--text-slnt);
}
em {
--text-ital: 1;
--text-slnt: 12;
}
.slanted {
--text-slnt: 12;
}
.italic-forms-only {
--text-ital: 1;
}
Having these axes separated offers greater design flexibility when creating typographic systems. In some cases, slant alone may be the best option; in others, both angle and glyph substitution may be desirable. Although not the most critical of features, it does add an extra dimension to the utility and dynamic range of a font.
Because there are so many examples of custom axes, it’s impossible to cover them all here. Nick Sherman’s v-fonts.com is a good place to browse if you want to see what sort of variety exists. Let’s focus on examples of a few custom axes that highlight usage for accessibility and UI improvements, and that also give you creative latitude with typographic systems and expressiveness.
Grades were first introduced to compensate for ink gain on different kinds of paper and presses. They act as a sort of “equalizer”—a way of visually correcting a typeface across workflows so it appears the same in every environment. A grade alters the weight of a font without changing the overall space the text occupies. Having this as a variable axis can be useful in a couple of ways. Creating a higher-contrast mode, where the text gets slightly heavier without reflowing, can make text more legible in low-light situations or in designing for “dark mode.” And when animating interface elements, this axis can add a heavier text grade along with a background-color shift on hover, tap, or focus.
It can also be handy for responding to low-resolution screens, where type can easily become spindly. Note that as with other custom axes, the abbreviation needs to be specified in all caps.
:root {
--text-grad: 0;
}
body {
font-variation-settings: 'GRAD' var(--text-grad);
}
body.dark {
--text-grad: 0.5;
}
Likely the most significant use of a grade axis will be for accessibility—designing a dark or high-contrast mode, for example. But it will also work well in UI animations, like making text heavier on buttons or navigation on hover or focus without altering the physical space occupied by the text.
The variable font Recursive has 5 different axes, but the custom one we’ll focus on here is called Casual. It makes the font shift from a typical sans serif design to one that looks more like freehand sign-painting.
:root {
--text-casl: 0;
}
body {
font-variation-settings: 'CASL' var(--text-casl);
}
.casual {
--text-casl: 0.95;
}
Some might not see the value in this axis, but it does let you introduce a vastly different feel to a block of text (like headings, perhaps) without loading a second font. This gives the design vocabulary tremendous range.
This custom axis alters the height of the ascenders and descenders of lowercase letters. These are the parts of letters that “ascend” (the tops of b, d, t, and h) and “descend” (the bottoms of p, q, g, and y). This axis is useful for adjusting how expressive a block of text feels and for setting text without a lot of space between lines. The variable font Amstelvar has two custom axes: YTAS
for ascenders and YTDE
for descenders.
:root {
--text-ytas: 750;
--text-ytde: -240;
}
body {
font-variation-settings: 'YTAS' var(--text-ytas), 'YTDE' var(--text-ytde);
}
.shorter {
--text-ytas: 675;
--text-ytde: -138;
}
.taller {
--text-ytas: 825;
--text-ytde: -500;
}
It’s common to set large text blocks very tightly. Reducing the length of ascenders and descenders allows lines of text to be set very closely together without the descenders on one line crashing into the ascenders of the line below.
Congratulations! You’re well on your way to understanding the power and flexibility of variable fonts. They may not always be the most appropriate solution, but in many cases they can offer substantial benefits. Take a look at Implementing Variable Fonts to give them a try and see how to incorporate them into your own projects, and have a look at the resources section for more links, articles, and tutorials to explore.


|
Copyright © 1999 O'Reilly & Associates,
Inc. All rights reserved.
Printed in the United States of America.
Published by O'Reilly & Associates, Inc.,
1005 Gravenstein Highway North, Sebastopol, CA 95472.
O'Reilly & Associates books may be
purchased for educational, business, or sales promotional use.
Online editions are also available for most titles (safari.oreilly.com). For more information,
contact our corporate/institutional sales department: (800)
998-9938 or<EMAIL_ADDRESS>Nutshell Handbook, the Nutshell Handbook
logo, and the O'Reilly logo are registered trademarks of
O'Reilly & Associates, Inc. Many of the designations used
by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in this
book, and O'Reilly & Associates, Inc. was aware of a
trademark claim, the designations have been printed in caps or
initial caps. The association between the image of sea horses
and the topic of algorithms with C is a trademark of O'Reilly
& Associates, Inc.
While every precaution has been taken in the
preparation of this book, the publisher assumes no
responsibility for errors or omissions, or for damages
resulting from the use of the information contained
herein.
|


[ht::head {Miscellaneous Admin Settings}]
<%nochildlist%>
There are a number of other site administation tabs available.
Statistics
This shows statistics of the system and the database. Note: if there seems to be
memory usage problems (e.g., excessive memory use from a memory leak) you can simply
add a URL argument to any URL:
...?gc=true
(I know its a bit of a hack)
and the caches will be cleared and Java garbage collector will run. Then, you can revisit the statistics
page and see if that has affected the memory usage (it should).
Access
This tab just shows an overview of all of the entry access control settings.
Logs
You can view the last 200 accesses to the repository. Because the googlebot is so
voracious we show its (and other bots) accesses highlighted.
This tab also provides access to the current error log and the full error log.
These two log files are in <ramadda home>/logs. The current log is the log
file for just this current run of the repository. The full log file is a concatenation
of all of the logging.
This view shows the last N lines of the log file. You cann show more or less of the log.
Also, Java stack traces are shown hidden and can be expanded.
Clean Up
This still needs work but the Clean Up facility will go through the
resository database and remove all entries that are file used and the
file does not exist. For example, if you are harvesting a real-time
data archive and adding the entries into the database the files in the archive
may be removed from some external process (e.g., scouring). In this case these
entries will not be shown to a user (RAMADDA checks for that) but they will not
be deleted from the database.
We are intending to do this automatically in the future.
User Message
You can enter a message that is shown to all users one time in this tab.
For example, you could announce that the repository will be unavailable
for a certain time, etc.
[ht::foot]


and.activation.model.iactivationAuthor:Charles Sanders Date: 2006.4.28 Activation function interface |
| Page was generated with on Sat Nov 28 00:10:25 2020 |
and.activation.model.iactivationAuthor:Charles Sanders Date: 2006.4.28 Activation function interface |
| Page was generated with on Sat Nov 28 00:10:25 2020 |


Babri Mosque verdict on inaugural day of Kartarpur Corridor is 'meaningful': FM
by https://www.facebook.com/dunyanewsISLAMABAD (Dunya News) – Foreign Minister Shah Mehmood Qureshi has on Saturday said that the Babri Mosque verdict [in favor of Ram Mandir by India’s Supreme Court] on the inaugural day of Kartarpur Corridor is ‘meaningful.’
Shah Mehmood Qureshi expressed surprise on the chosen day and said the ruling apparently reflects the bigoted ideology of Modi government.
The Foreign Minister noted that Muslims are already under a lot of pressure in India and this decision of the Indian court will further increase pressure on them.
Commenting on the Indian Supreme Court s judgment in Babri Mosque case, Special Assistant on Information and Broadcasting Firdous Ashiq Awan said the verdict has blemished the Indian secular face.
She said the Indian apex court has given the message that it is not independent.
Firdous Ashiq Awan said Pakistan is guaranting the rights of minorities by opening the Kartarpur corridor but India on the other hand is subjecting minorities including Muslims to oppression.
Firdous Ashiq Awan regretted that the RSS ideology has engulfed India.
Minister for Science and Technology Fawad Chaudhry talking to Radio Pakistan said the Indian Supreme Court s decision in Babri Mosque has added to the woes, pain and agony of Muslims in India.
He said this judgment is in continuation of Modi s policies against minorities especially the Muslims.
He said Pakistan is giving the message of protection of rights of minorities by opening Kartarpur corridor but the message emanating from New Delhi is that of intolerance and prejudice against the minorities.


Aarron Walter
VP of Design Education at InVision. Founded UX practice at MailChimp. Author of Designing for Emotion. @aarron
Books
Select Writings
- 7 Problems Growing Design Teams Face
- When Design Becomes a Black Box
- Building a UX Team
- Hire People Not Skills
- Connected UX
- Social Login Buttons Aren't Worth It
- The UX Reader
- Data-driven Design With an Annual Survey
- Creating Collaborative Workspaces
- Redesigning With Personality
- Personality in Design
- Emotional Interface Design: The Gateway to Passionate Users
- The Expanding Role of User Experience Design
Speaking
- O'Reilly Design Mar 19-20, 2017 San Francisco
- Recently
- Agile Iceland Nov 15-16, 2016 Reykjavík
- Creative Director Camp Jun 8-11, 2016 Atlanta
- Smashing Conference Mar 14-16, 2016 Oxford, England
- World IA Day Feb 20, 2016 Atlanta
- Beyond Tellerrand Nov 3-5, 2015 Berlin
- Creative Mornings Sep 25, 2015 Atlanta
- Web Afternoon Aug 28, 2015 Atlanta
- UX Days Tokyo Apr 17-19, 2015 Tokyo
Notable
Interviews & Articles
- Inside Intercom
- User Defenders Podcast
- This is Product Management
- Designer News Podcast
- The UX and Growth Podcast
- Ways We Work
- Advice for Designers
- The Big Web Show with Jeffrey Zeldman
- Dorm Room Tycoon
- Fast Company: Your 5-Minute Guide To UX
- TechCrunch: The Most Overlooked Aspect Of UX Design Could Be The Most Important
- Design Matters With Debbie Millman
- nGen Works: The MailChimp Story
- The UX Intern
- .net Magazine
- The Web Ahead
- The East Wing
- Lullabot
Say Hello
- Email me or get in touch on Twitter


Class cc.EventListener
- Defined in: CCEventListener.js
- Extends cc.Class
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
The base class of event listener. |
Method Summary
Class Detail
The base class of event listener.
If you need custom listener which with different callback, you need to inherit this class.
For instance, you could refer to EventListenerAcceleration, EventListenerKeyboard,
EventListenerTouchOneByOne, EventListenerCustom.
Field Detail
Method Detail
-
{boolean} checkAvailable()Checks whether the listener is available.
- Returns:
- {boolean}
-
{cc.EventListener} clone()Clones the listener, its subclasses have to override this method.
- Returns:
- {cc.EventListener}
-
Create a EventListener object by json object
cc.EventListener.create({ event: cc.EventListener.TOUCH_ONE_BY_ONE, swallowTouches: true, onTouchBegan: function (touch, event) { //do something return true; } });
- Parameters:
- {object} argObj
- a json object
- Returns:
- {cc.EventListener}
-
ctor(type, listenerID, callback)Initializes event with type and callback function
- Parameters:
- {number} type
- {string} listenerID
- {function} callback
-
{boolean} isEnabled()Checks whether the listener is enabled
- Returns:
- {boolean}
-
release()
Currently JavaScript Bindings (JSB), in some cases, needs to use retain and release. This is a bug in JSB, and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB. This is a hack, and should be removed once JSB fixes the retain/release bug
You will need to retain an object if you created a listener and haven't added it any target node during the same frame.
Otherwise, JSB's native autorelease pool will consider this object a useless one and release it directly,
when you want to use it later, a "Invalid Native Object" error will be raised.
The retain function can increase a reference count for the native object to avoid it being released,
you need to manually invoke release function when you think this object is no longer needed, otherwise, there will be memory learks.
retain and release function call should be paired in developer's game code. -
retain()
Currently JavaScript Bindings (JSB), in some cases, needs to use retain and release. This is a bug in JSB, and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB. This is a hack, and should be removed once JSB fixes the retain/release bug
You will need to retain an object if you created a listener and haven't added it any target node during the same frame.
Otherwise, JSB's native autorelease pool will consider this object a useless one and release it directly,
when you want to use it later, a "Invalid Native Object" error will be raised.
The retain function can increase a reference count for the native object to avoid it being released,
you need to manually invoke release function when you think this object is no longer needed, otherwise, there will be memory learks.
retain and release function call should be paired in developer's game code. -
setEnabled(enabled)Enables or disables the listener
- Parameters:
- {boolean} enabled


this website still under construction
time remains . . .
Month
days
hours
If You have an idea to put in this web page, you can send me a message through the following link below


Anime Boston is part of the non-profit called North Eastern Anime Society. The Anime Boston Volunteer Program (ABVP) is a subsection of Anime Boston in charge of assisting in providing volunteer labor for the convention as well as creating a positive experience for volunteers. Volunteer work includes things such as line control, passing out pamflits, and assisting departments in other similar work.
For the summer event in 2016, we took the volunteers to a theme park. We subsidized the ticket costs to make the event more accessible to everyone.


{% extends "base.html" %} {% import 'bootstrap/form.html' as wtf %} {% block app_content %}
Please provide a csv or json file.


--- layout: api title: "v3.2.0 JavaScript Library: L.mapbox.geocoder(id|url, options)" categories: api version: v3.2.0 permalink: /api/v3.2.0/l-mapbox-geocoder/ ---
A low-level interface to the Mapbox Geocoding API, useful for complex uses and reverse-geocoding.
| Options | Value | Description |
|---|---|---|
| id or url | string | Value must be
|
| options | Object | The second argument is optional. If provided, it may include:
|
Returns a L.mapbox.geocoder
object.
Queries the geocoder with a query string, and returns its result, if any. This performs forward geocoding.
| Options | Value | Description |
|---|---|---|
| queryString (required) | string | a query, expressed as a string, like 'Arkansas' |
| options | object | an object containing the query and options parameters like { query: 'Austin', proximity: L.latlng(lat, lng) } |
| callback (required) | function | a callback |
Valid options are:
L.LatLng
object or [latitude, longitude]
array that will
bias the search results toward a geographical pointus
or ca
which will be included in the search. Ommitting this parameter
(the default) includes all countries.false
. Otherwise, by default it is true
.The callback is called with arguments
The result. This is an object with the following members:
{
results: // raw results
latlng: // a map-friendly latlng array
bounds: // geojson-style bounds of the first result
lbounds: // leaflet-style bounds of the first result
}
Example: Live example of geocoder.query centering a map.
Returns: the geocoder object. The return value of this function is not useful - you must use a callback to get results.
Queries the geocoder with a location, and returns its result, if any. This performs reverse geocoding.
| Options | Value | Description |
|---|---|---|
| location (required) | object | A query, expressed as an object:
|
| callback (required) | function | The callback is called with arguments
|
Returns: the geocoder object. The return value of this function is not useful - you must use a callback to get results.


- Name: Tomales 2008-10-04 17-01-22
- File Name: Tomales 2008-10-04 17-01-22.NEF
- Date: 10/4/08 5:01:22 PM PDT
- File Size: 15.46 MB
- Keywords: Nick's Cove
- Aperture: ƒ/10
- Shutter Speed: 1/400
- Exposure Bias: -1 ev
- Focal Length: 180mm
- ISO: ISO 200
- Focal Length (35mm): 270.0mm
- Focal Length: 180mm
- Pixel Size: 3884 × 2600 (10.1 MP)
- Camera Model: NIKON D200
- Rating: 2
|


--- title: discreteSample sidebar: function_reference_sidebar permalink: discreteSample.html folder: function_reference toc: false ---
take a diskrete sample from a list of vectors, orientations, grains, EBSD
| f | density function, e.g., function handle, S2Fun, SO3Fun |
| gB | grainBoundary |
| ebsd | EBSD |
| ori | orientation |
| v | vector3d |
| points | number of random samples |
| obj | same as first input |
| ind | indeces of the selected subsamples |
| withReplacement | take the random sample with replacement (default) |
| withoutReplacement | take the random sample without replacement |


You have started Eclipse Ditto
Thank you for trying out Eclipse Ditto!
In order to get started quickly, you can now have a look at the OpenAPI documentation for
Try out the HTTP APIs by using username "ditto" and password "ditto" when asked for by your browser.
We'll add more documentation and examples soon.
— the Ditto team


Every day we should hear at least one little song, read one good poem, see one exquisite picture, and, if possible, speak a few sensible words. Johann Wolfgang von Goethe .
{{post.title}}
{{post.description}}
{{post.time}} - {{post.author}}


LATEX The larcc IDE requires the users to embed the compute code within LATEX files written for documenting their work. Therefore the first requirement is a working LATEX environment. “As TEX Live is the basis of MacTEX, and is the TEX system for Unix, if you work cross-platform and want an identical system on all of your machines, then TEX Live is the way to go” [Wri12].
Python As of today, most of larcc development was done in Python. Hence a working Python environment is required, including three packages: scipy, pyopengl, and pyplasm. On a Mac, Python is installed by default, whereas scipy and pyopengl may be installed in the terminal by doing
Finally, to install pyplasm look at the README file in its downloaded directory:
Nuweb In 1984, Knuth introduced the idea of literate programming. The idea was that a programmer writes just one document, the web file—with suffix .w, that combines the documentation with the code. Nuweb works with any programming language and LATEX, and is probably the simplest incarnation of the Knut’s original work. The web site of the tool is sourceforge.net/projects/nuweb/. A revised version of source files can be found on code.google.com/p/nuweb. This package can build using the standard tools:
For some documentation read the wiki page. Test your installation by just compiling to pdf the nuweb.w document itself, whose chapter one contains the user documentation:
Of course, in order to extend larcc and/or to make an efficient use of it, you are supposed to read carefully the first chapter of the nuweb.pdf document.


All remote sensing systems such as satellites depend on energy. Energy comes in many forms yet most traditional remote sensing systems measure wavelengths of electromagnetic radiation from within the electromagnetic spectrum.
We can only see a small portion within the electromagnetic
spectrum, called visible light.
Computer processing enables us to interpret images from satellites.
Satellite images can be produced from a range of different sensors, each used for different purposes.
Spectral resolution refers to the range of wavelengths or bands in the electromagnetic spectrum detected by the sensors.


This component represents an alert.
An alert may be closed automatically, on event, or not closable at all.
The following attributes are available:
alert-type
: One of basic
, custom
, or self-closing
.closeable
: One of true
or false
.closeTimer
: A unit of time in milliseconds for how long to wait before auto-closing.theme-variant
: The name of a theme variant to use for the alert.tl-alert
component with no customizations.


Baccano! (2007–2008)
★
8.5 / 10 (5,296 votes)
TV-MA — 25 min — Animation Action Adventure
Cast:
J. Michael Tatum
Caitlin Glass
Akemi Kanda
Languages:
English
Japanese
A crazy fantasy caper involving alchemists, immortals, gangsters, outlaws and an elixir of immortality, spread over several decades.
Data Retrieved: 2015-10-31
Directory Name: "Baccano! (2007)"


Shaibya: page header
Shaibya: Main content section
A.Markup is designed for the processing, defination and presentation of the text. Markup specifies code for formatting both the layout and style within a textfile. HTML is widely used markup language.
B. Hypertext is a link from one path to another that uses text in many case. It is used to generate links that leads you from one path to another.
HyperMedia is the word derived from hypertext. It is the non-sequential access of text document using a multimedia environment and providing user felxibility to select which documents they want to view. Hypermedia simply combine hypertext and multimedia.
C. Doctype is the document type declaration. It is important to include in every HTML beacuse without instruction the browser will not know which version of HTML you are using.
D. CSS language can be used to style web documents.
E. HTML elements are required for a valid XHTML5 document.
F. Self-closing tag is an element of HTML code that has evolved in the language. eg:
G. A general purpose markup language with stricter syntax rules than HTML is XML. It is important beacuse it is essential for well structured documents that are easier to develop and maintain.
I. The four XML rules are listed below:
J.


public class Task
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
Task() |
Task(java.lang.String taskRequester,
java.lang.String taskName,
java.lang.String taskDescription)
This method is a constructor that creates a new instance of the Task class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptBid(java.lang.String taskProvider)
This method accepts a bid placed on a task by assigning the string passed to the method
to the "assignedTaskProvider" variable.
|
void |
addBid(Bid bid)
This method adds a bid to the local BidList and changes the status of Task to "Bidded".
|
void |
addPicture(java.lang.String encodedPicture)
This method adds a picture to the local ArrayList
|
void |
deleteAllBids()
This method deletes all bids associated with this task from the BidList
|
void |
deleteBid(Bid receivedBid)
This method deletes the bid from the local BidList and changes the status to "Requested"
if there are no other bids on this task.
|
BidList |
getBids()
This method returns an BidList that represents all the bids associated with this task
|
java.lang.Boolean |
getEditStatus()
A method that returns whether a task is being edited currently or not
|
java.lang.String |
getId()
A method that returns the string that represents the unique ID assigned this task
|
java.lang.Double |
getLatitude()
A method that returns the Double object that represents the latitude associated with this task
|
java.lang.Double |
getLongitude()
A method that returns the Double object that represents the longitude associated with this task
|
java.lang.String |
getLowestBid()
A method that transverses all the bids placed on a specific task and returns the value of the
lowest bid placed on this particular task.
|
java.lang.String |
getPicture()
A method that returns the first picture associated with a task
|
java.util.ArrayList<java.lang.String> |
getPictures()
This method returns an ArrayList
|
java.lang.String |
getStatus()
This method returns the string that represents the current status of the task
|
java.lang.String |
getTaskDescription()
This method returns the string that corresponds to the task description given to this task
|
java.lang.String |
getTaskName()
This methods returns the string that corresponds to the give taskName of this task.
|
java.lang.String |
getTaskProvider()
This method returns the string that represents the username of the user that has
been assigned to perform this task
|
java.lang.String |
getTaskRequester()
This methods returns the string that corresponds to the task requester associated
with with the task's
|
void |
setEditStatus(java.lang.Boolean status)
A method that replaced the editing attribute with the parameter provided.
|
void |
setId(java.lang.String id)
A method that replaces the id attribute with the parameter provided
|
void |
setLatitude(java.lang.Double latitude)
A method that replaces the latitude attribute with the parameter provided
|
void |
setLongitude(java.lang.Double longitude)
A method that replaces the longitude attribute with the parameter provided
|
void |
setStatus(java.lang.String status)
A method that replaces the status attribute with the parameter provided
|
void |
setTaskDescription(java.lang.String taskDescription)
A method that replaces the description attribute with the parameter provided
|
void |
setTaskName(java.lang.String taskName)
A method that replaces the taskName attribute with the parameter provided
|
void |
setTaskProvider(java.lang.String taskProvider)
A method that replaces the taskProvider attribute with the parameter provided
|
java.lang.String |
toString()
This method returns a string that represents this task.
|
public Task(java.lang.String taskRequester, java.lang.String taskName, java.lang.String taskDescription)
This method is a constructor that creates a new instance of the Task class. As well as assigning variables to the provided parameters, it also sets the status to the default value "Requested" and sets assignedTaskProvider to the default value "".
taskRequester
- taskName
- taskDescription
- public Task()
public java.lang.String getTaskRequester()
This methods returns the string that corresponds to the task requester associated with with the task's
public java.lang.String getTaskProvider()
This method returns the string that represents the username of the user that has been assigned to perform this task
public void setTaskProvider(java.lang.String taskProvider)
A method that replaces the taskProvider attribute with the parameter provided
taskProvider
- string that represents the username of the user that has been assigned to
perform this activitypublic java.lang.String getTaskName()
This methods returns the string that corresponds to the give taskName of this task.
public void setTaskName(java.lang.String taskName)
A method that replaces the taskName attribute with the parameter provided
taskName
- string that represents the name given to this taskpublic java.lang.String getTaskDescription()
This method returns the string that corresponds to the task description given to this task
public void setTaskDescription(java.lang.String taskDescription)
A method that replaces the description attribute with the parameter provided
taskDescription
- string that represents the description given to this taskpublic java.lang.String getStatus()
This method returns the string that represents the current status of the task
public void setStatus(java.lang.String status)
A method that replaces the status attribute with the parameter provided
status
- string that represents the new status of the taskpublic java.lang.String getId()
A method that returns the string that represents the unique ID assigned this task
public void setId(java.lang.String id)
A method that replaces the id attribute with the parameter provided
id
- string that represents the unique id assigned to the taskpublic java.lang.Double getLatitude()
A method that returns the Double object that represents the latitude associated with this task
public void setLatitude(java.lang.Double latitude)
A method that replaces the latitude attribute with the parameter provided
latitude
- a Double object that represents the latitude associated with the taskpublic java.lang.Double getLongitude()
A method that returns the Double object that represents the longitude associated with this task
public void setLongitude(java.lang.Double longitude)
A method that replaces the longitude attribute with the parameter provided
longitude
- a Double object that represents the longitude associated with the taskpublic void addBid(Bid bid)
This method adds a bid to the local BidList and changes the status of Task to "Bidded". This method also uses ElasticSearchController to update the database.
bid
- a Bid that has been placed on this taskpublic void deleteBid(Bid receivedBid)
This method deletes the bid from the local BidList and changes the status to "Requested" if there are no other bids on this task. This method also uses ElasticSearchController to update the database.
receivedBid
- a Bid that is to be deleted from this taskpublic void deleteAllBids()
This method deletes all bids associated with this task from the BidList
public BidList getBids()
This method returns an BidList that represents all the bids associated with this task
public java.util.ArrayList<java.lang.String> getPictures()
This method returns an ArrayList
public void addPicture(java.lang.String encodedPicture)
This method adds a picture to the local ArrayList
encodedPicture
- a Bitmap that has been placed on this taskpublic java.lang.String getPicture()
A method that returns the first picture associated with a task
public void acceptBid(java.lang.String taskProvider)
This method accepts a bid placed on a task by assigning the string passed to the method to the "assignedTaskProvider" variable. This method also updates this task entry on the database.
taskProvider
- a string that represents the username of the user assigned to perform this taskpublic java.lang.String toString()
This method returns a string that represents this task.
toString
in class java.lang.Object
public java.lang.String getLowestBid()
A method that transverses all the bids placed on a specific task and returns the value of the lowest bid placed on this particular task.
public void setEditStatus(java.lang.Boolean status)
A method that replaced the editing attribute with the parameter provided.
status
- a boolean value that represents whether it is currently being editedpublic java.lang.Boolean getEditStatus()
A method that returns whether a task is being edited currently or not


---
title: Geo-locate Emails part-3 - Concluding...
tags:
meta:
abstract: In earlier posts we saw how to capture sender's IP and then use that IP to locate the person. Although, that works many times - it may not be always correct. Here, we will see how these exceptions can occur.
thumbnail:
date: 2006-09-26T00:04
---
Is the answer, found in this way, always correct?
Depends. It need not be always correct. But most of the time, I have found this information to be incorrect in the following cases.
- Somebody knows this technique and intentionally sends the mail through entirely different connection. (I have not yet been able to trace such people through mail headers)
- A mail is routed through many internal networks about which the external world has no information. Example. In a large organization, with offices in different parts of a country, they might be using a single server placed at the head office to send the mails. In that case you will only get the head-office location every time.
- The mail providers like GMail hide this information from the receiver in some cases.
Warning: The information about the geographical location for an IP is available from the Internet IP registration authorities (this is not what these authorities are actually called). If the registration information is incomplete or incorrect or hidden, this method will yield incorrect results.
Well this ends the usage part - those who are interested in knowing answers to somewhat technical stuff may read further.
How to change the outgoing information?
Basically you cannot change the IP in the email headers until you use some kind of IP spoofing. But you can make use of an entirely different connection. How? Use the public proxies. When the mails are sent using public proxies, they originate from that public proxy IP address and therefore not possible to track directly (except when the heavy use is monitored and statistically analyzed conclusions are derived)
A concept called “Onion Routing” disallows such analysis attacks too. Though at some advanced networking level, you may like to see
http://www.onion-router.net/
A not-so-well written article (by me) may allow you people to perform “
Onion Routing”
What happens when mail is routed within the organization before being sent?
Again taking the example of the big organization “Infosys”. This company has a development center at Pune, India. Any mails coming from its Pune development center are sent to the Internet through their Bangalore facility.
Fig 4 - Image from PUNITP, Infosys
As seen from the above header, there are many “Received from” headers, but last two of them are unreachable from the Internet, because they are internal to the organization. So we use the third last IP, which resolved to Bangalore India. That is incorrect. The mail is from Pune, but still we cannot use this method to find out the real location of the sender. But from the naming conventions like “PUNITPMSG09.ad.infosys.com”, we can assume that the IP is from Pune. Assumptions may be wrong, but fortunately in this case it was correct.
How GMail is preventing geo-location?
Not exactly preventing all such mails. But I found that mails sent from one GMail to another GMail account does not have the “Received From” headers. This makes it really difficult to trace the sender. Only GMail authorities would be capable of doing so.
It is possible that I am wrong in this case. Correct me if so.
The image below shows how GMail blocks “Received from” headers:
Fig 5 - Image from GMail to GMail headers
Note:
Any example used in this article has scrambled data at many places.
References to the organization "Infosys" are purely co-incidental.


| DOSE: T+ 0:00 |
1.0 mg |
insufflated |
2C-E |
(powder / crystals) |
| T+ 4:00 |
5.0 mg |
insufflated |
2C-E |
(powder / crystals) |
| T+ 4:05 |
5.0 mg |
insufflated |
2C-E |
(powder / crystals) |
2:10pm ~1mg (scale dust) insufflated. BURN! Much sweating, isolated to my cheeks. Feel a wave of wobbly heat come over me. Set aside the 10mg weighed amount for later.
2:20pm Swallow of coke brings mild nausea. Check mirror... slight eye dilation. Definite tingly alteration of touch, but very mild.
3:10pm Still some sensations. outside colors were slightly intensified. I'm considering trying half or all of the 10 I weighed out and set aside.
4:10pm No longer any noticable alteration of any senses.  Decide to delay additional experiment until later this evening.
-=-
6:03pm After a brief moment of internal opening circle, insufflated roughly half of the weighed out 10mg. Burn was a little less, but its still sharp and intense. immediate sense of quiver. sit it out for a few minutes with no strong sense of really 'taking off', but very into the music playing (pfly - short circuit -- any pfly just seems to fit with any material for me).  No real g-forces. Up the nose goes the other half. Within a few minutes, it starts coming on strong. Body load increases dramatically over the next 20 minutes. Adductors in my legs spasm uncontrollably (acetylcholine action?). I get similar spasms in my wrists and occasionally my abdomen. Its that common fluttery feeling of psilocyb but magnified several times over. Pfly's music takes on an otherworldly feel before ending.
6:30pm Continuing to come on strong. I moved around the house and felt taller by several inches. It was partly from holding myself more erect but also an exaggerated sense.  First twinge of queasiness, undoubtedly due to the overwhelming phlegm.
For the next hour plus, the intensity continued to build. Giving into it increased the altered perceptions; struggling against it diminished them (as I've found to be the case with many substances). Some open eye visuals began around 7pm; by 8, shadows had texture (lace; weave; corduroy-like). CEVs were especially strong and flowing with a great variety of geometries, ranging from kaliedescope intricacies to lava lamp type patterns.
I puked 2 or 3 different times during that hour. Very little bile or food/liquid; just big balls of white, puffy phlegm. Mmmmm. The puking was very gag-like, not an all-out purge like I get on other substances. The muscle tremors also continued to increase in frequency and intensity. It never got to the point of dibilitating me, but it was uncomfortable. I had serious second thoughts about the method of delivery I'd chosen.
Smoking cannabis during this period helped some with the nausea and added to the sensations.
Sat for a short while on the back porch enjoying dusk. Thoughts turned to family and friends and history. I remember being awed by the number of memories in my head and how I possibly stored them all, even when rarely or never accessed.
Upon returning inside just before 8pm, Jetsam handed me an old college notebook of mine I hadn't seen in years. I sat down with it listening to Shri Durga by dj Cheb i Sabbah. I marvelled at my old notes, remembering in detail each class. I was struck again by how many of those words were simply placeholders, never really playing any further role in my life. Occasionally, I'd come across a real gem and reel from the wave of thoughts of all the ways it had impacted my perceptions since; my life; me.
At some point I lost track of the book and got caught up in the music and just staring at stones and plants in the room. Even stronger came thoughts of how many variables are involved in any given instant of time/experience and how truly lucky I have been to have so many of them come together with any regularity in my life. I had visions of myself as the trunk of a tree (probably because I was staring blankly at a tree at the time ;] ) and how the experiences of the past were my roots, the variables of any given instant the dirt I stood in, and my future was in my branches. I was humbled by the immensity of it all, with my mind assigning names to roots and branches at the speed of light, unable to consciously examine but a few due to the overwhelming speed with which they came.
The music ended. My awareness of my surroundings returned.
Game 4 of the world series had started and I went in to see if it would interest me around 9pm. Actually, I found it fascinating from a mental acuity perspective. I was extremely anal about stats and current standings. I didn't make the connection to earlier thoughts at the time, but I was flying thru all the variables involved each time the ball moved.
By 11pm, I was distinctly over the peak and physically tired. I watched the end of the game until nearly midnight and tried to get some sleep. I laid awake for awhile before drifting off fitfully, awakening every half hour or so. Sleep was difficult (lots of tossing and turning, getting up and walking around a bit, etc.) until approximately 4am.
The effects, while extremely mild, were noticable the entire next day -- a mixture of hangover, sleep deprivation, and lingering chemical alteration.
In conclusion, I think 2c-e has the most potential as an analytical tool of any substance I've come across in recent years. I hope to conduct further experiments, but I don't think I'll be insufflating it again without good reason... the burn and the phlegm alone are too much of a price, let alone the body load (which, from what I've read, is not as much an issue when taken orally).
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.


Money Play. How should Red play 41?
pips Red=89 White=146
(CorrectAnswer= 0/0, ErrorScore= 0)
I found this one very instructive. 13/9*, 7/6, 13/9*/8 and 7/3*/2 all win the same percentage of games within a few thousandths of equity points.
The difference comes in the percentage of gammons won. Hitting on the 9-pt gains approximately 5% more gammons – there is no discernible difference between the two hitting plays.
It is therefore worth the risk of White establishing a 3-5 back game to gain those extra gammons – something that may not be intuitively obvious when you first study the position.
The difference comes in the percentage of gammons won. Hitting on the 9-pt gains approximately 5% more gammons – there is no discernible difference between the two hitting plays.
It is therefore worth the risk of White establishing a 3-5 back game to gain those extra gammons – something that may not be intuitively obvious when you first study the position.
1. Cubeful 2-ply 13/9* 7/6 Eq.: +0.848 0.753 0.457 0.008 - 0.247 0.038 0.001 2. Cubeful 2-ply 13/9*/8 Eq.: +0.818 (-0.030) 0.772 0.373 0.005 - 0.228 0.026 0.000 3. Cubeful 2-ply 13/12 13/9* Eq.: +0.793 (-0.055) 0.743 0.428 0.007 - 0.257 0.039 0.001 4. Cubeful 2-ply 7/3*/2 Eq.: +0.770 (-0.078) 0.766 0.346 0.004 - 0.234 0.032 0.001 5. Cubeful 2-ply 13/12 7/3* Eq.: +0.577 (-0.271) 0.686 0.383 0.006 - 0.314 0.075 0.004


Network Overview
Python provides a wide assortment of network support.
Network Basics: TCP/IP
Python’s networking modules primarily support TCP/IP.
TCP is the most common (HTTP, FTP, SMTP, etc…). Both protocols are supported using “sockets”.
A socket is a file-like object. Allows data to be sent and received across the network like a file. But it also includes functions to accept and establish connections. Before two machines can establish a connection, both must create a socket
Network Basics: Ports
In order to receive a connection, a socket must be bound to a port (by the server). A port is a number in the range 0-65535 that’s managed by the OS. Used to identify a particular network service (or listener). Ports 0-1023 are reserved by the system and used for common protocols:
Ports above 1024 are reserved for user processes.
Socket programming in a nutshell
Socket Programming Example
The socket module
Provides access to low-level network programming functions. The following example is a simple server that returns the current time
import time, socket
s = socket(AF_INET, SOCK_STREAM)#Create TCP socket
s.bind(("",8888)) #Bind to port 8888
s.listen(5) #Start listening
while 1:
client,addr = s.accept() #Wait for a connection
print “Got a connection from “, addr
client.send(time.ctime(time.time())) #Send time back
client.close()
Notes: The socket first opened by server is not the same one used to exchange data.Instead, the accept() function returns a new socket for this (’client’ above).listen() specifies max number of pending connections
The following example is the client program for the above time server which connect to time server and get current time.
from socket import *
s = socket(AF_INET,SOCK_STREAM) #Create TCP socket
s.connect((“google.com”,8888)) #Connect to server
tm = s.recv(1024) #Receive up to 1024 bytes
s.close() # Close connection
print “The time is”, tm
Notes: Once connection is established, server/client communicate using send() and recv(). Aside from connection process, it’s relatively straightforward. Of course, the devil is in the details. And are there ever a LOT of details.
The Socket Module
The socket module used for all low-level networking, creation and manipulation of sockets, and general purpose network functions (hostnames, data conversion, etc…). It’s a direct translation of the BSD socket interface.
Utility Functions
- socket.gethostbyname(hostname) # Get IP address for a host
- socket.gethostname() # Name of local machine
- socket.ntohl(x) # Convert 32-bit integer to host order
- socket.ntohs(x) # Convert 16-bit integer to host order
- socket.htonl(x) # Convert 32-bit integer to network order
- socket.htons(x) # Convert 16-bit integer to network order
Comments: Network order for integers is big-endian. Host order may be little-endian or big-endian (depends on the machine).
The socket(family, type, proto) function creates a new socket object. Family is usually set to AF_INET. Type is one of:
- SOCK_STREAM Stream socket (TCP)
- SOCK_DGRAM Datagram socket (UDP)
- SOCK_RAW Raw socket
Proto is usually only used with raw sockets:
- IPPROTO_ICMP
- IPPROTO_IP
- IPPROTO_RAW
- IPPROT O_TCP
- IPPROTO_UDP
Socket methods
- s.accept() # Accept a new connection
- s.bind(address) # Bind to an address and port
- s.close() # Close the socket
- s.connect(address) # Connect to remote socket
- s.fileno() # Return integer file descriptor
- s.getpeername() # Get name of remote machine
- s.getsockname() #Get socket address as (ipaddr,port)
- s.getsockopt(…) # Get socket options
- s.listen(backlog) # Start listening for connections
- s.makefile(mode) # Turn socket into a file like object
- s.recv(bufsize) # Receive data
- s.recvfrom(bufsize) # Receive data (UDP)
- s.send(string) # Send data
- s.sendto(string, address) # Send packet (UDP)
- s.setblocking(flag) #Set blocking or nonblocking mode
- s.setsockopt(…) #Set socket options
- s.shutdown(how) #Shutdown one or both halves of connection
There are a huge variety of configuration/connection options. You’ll definitely want a good reference at your side
The SocketServer Module
Provides a high-level class-based interface to sockets. Each protocol is encapsulated in a class (TCPServer, UDPServer, etc.). It also provides a series of handler classes that specify additional server behavior.
To create a network service, need to inherit from both a protocol and handler class. Example, the same time server we done before:
import SocketServer
import time
# This class actually implements the server functionality
class TimeHandler(SocketServer.BaseRequestHandler):
def handle(self):
self.request.send(time.ctime(time.time()))
# Create the server
server = SocketServer.TCPServer(”",8888),TimeHandler)
server.serve_forever()
Not es: The module provides a number of specialized server and handler types. Ex: ForkingTCPServer, ThreadingTCPServer, StreamRequestHandler, etc.
Common Network Protocols
Modules are available for a variety of network protocols:
- ftplib FTP protocol
- smtplib SMTP (mail) protocol
- nntplib News
- gopherlib Gopher
- poplib POP3 mail server
- imaplib IMAP4 mail server
- telnetlib Telnet protocol
- httplib HTTP protocol
These modules are built using sockets, but operate on a very low-level. Working with them requires a good understand of the underlying protocol. But can be quite powerful if you know exactly what you are doing
The httplib Module
Implements the HTTP 1.0 protocol and can use to talk to a web server.
HTTP in two bullets:
- Client (e.g., a browser) sends a request to the server
GET /index.html HTTP/1.0
Connection: Keep-Alive
Host: www.python.org
User-Agent: Mozilla/4.61 [en] (X11; U; SunOS 5.6 sun4u)
[blank line]
- Server responds with something like this:
HTTP/1.0 200 OK
Content-type: text/html
Content-length: 72883
Headers: blah
[blank line]
Data
…
Making an HTTP connection
import httplib
h = httplib.HTTP(“www.python.org”)
h.putrequest(’GET’,’/index.html’)
h.putheader(’User-Agent’,’Lame Tutorial Code’)
h.putheader(’Accept’,’text/html’)
h.endheaders()
errcode,errmsg, headers = h.getreply()
f = h.getfile() # G et file object for reading data
data = f.read()
f.close()
You should understand some HTTP to work with httplib.
The urllib Module
A high-level interface to HTTP and FTP which provides a file-like object that can be used to connect to remote servers
import urllib
f = urllib.urlopen(“http://www.python.org/index.html")
data = f.read()
f.close()
Utility functions
- urllib.quote(str) # Quotes a string for use in a URL
- urllib.quote_plus(str) # Also replaces spaces with ’+’
- urllib.unquote(str) # Opposite of quote()
- urllib.unquote_plus(str) # Opposite of quote_plus()
- urllib.urlencode(dict)
- # Turns a dictionary of key=value pairs into a HTTP query-string
Examples
urllib.quote(“ebeid@ieee”) #Produces “ebeid%40ieee”
urllib.unquote("%23%21/bin/sh”) #Produces “/bin/sh”
The urlparse Module
Contains functions for manipulating URLs
- URL’s have the following general format
scheme:/netloc/path;parameters?query#fragment
- urlparse(urlstring) - Parses a URL into components
import urlparse
t = urlparse.urlparse(“http://www.python.org/index.html")
#Produces (’http’,’www.python.org’,’/index.html’,’’,’’,’’)
- urlunparse(tuple) - Turns tuple of components back into a URL string
url = urlparse.urlunparse((’http’,’www.python.org’,’foo.html’, ’bar=spam’,’’))
# Produces “http://www.python.org/foo.html?bar=spam”
- urljoin(base, url) - Combines a base and relative URL
urlparse.urljoin(“http://www.python.org/index.html","help.html")
# Produces “http://www.python.org/help.html”
In this note we explored horizontally the network programming capabilities of Python. Every single module and topic mentioned here, needs multiple posts to cover it. In the upcoming posts, we will dig into network programming in detail.


<{VINEGAR}> is what things are made of. The above example demonstrates advanced higharchy based object replacement.


{% extends "testtool/manager/base_log.html" %}
{% block header %}
Log Book
{% endblock header %}
{% block table_heading %}
All events in your recorded history
{% endblock table_heading %}
{% block no_log %}
There is no recorded activity.
{% endblock no_log %}


Pages
Page
Title
Short Name
Edit
Delete
[[${post.page.name}]]
[[${post.title}]]
[[${post.shortName}]]
Edit
Delete
New


|
e-puck
1.0
|
Initialize the ports on standard configuration. More...
Functions | |
| _FOSC (CSW_FSCM_OFF &XT_PLL8) | |
| _FWDT (WDT_OFF) | |
| _FBORPOR (PBOR_OFF &MCLR_EN) | |
| _FGS (CODE_PROT_OFF) | |
| void | testAccGyroPresence () |
| void | e_init_port (void) |
| Initialize all ports (in/out) More... | |
| unsigned char | isEpuckVersion1_3 (void) |
Variables | |
| unsigned char | isPresentFlag = 0 |
Initialize the ports on standard configuration.
| _FBORPOR | ( | PBOR_OFF & | MCLR_EN | ) |
| _FGS | ( | CODE_PROT_OFF | ) |
| _FOSC | ( | CSW_FSCM_OFF & | XT_PLL8 | ) |
| _FWDT | ( | WDT_OFF | ) |
| void e_init_port | ( | void | ) |
Initialize all ports (in/out)
Call this method to set all the standards output components (LEDs, IR, camera, motors, I2C, audio) on their defaults values and set their corresponding PIN to "output". The method also set the corresponding PIN to "input" for all the standards inputs components (IR receiver, selector, camera, battery level).
| unsigned char isEpuckVersion1_3 | ( | void | ) |
| void testAccGyroPresence | ( | ) |
| unsigned char isPresentFlag = 0 |


Nematode Type
Zack doesn't have good vision or memory.
He can only see his current square.
Kelly doesn't have good vision, but at least she has memory.
She can see her current square and her previous square.
Slater has good vision, but alas, no memory.
He can see his current square and also the one directly in front of him.
Lisa has superwoman vision. She can see every square near her.
Number of Moves


Home
Set
Train
i
r
reg.io
Your personal irregular verbs trainer
Irregio is a perfect companion for language learners, who want to practice irregular verbs conjugation and learn their translation.
I know
I learn
Difficulty
Congraulations!
You have done well and used
hints
Redo
-
-
help
press
Shift+Alt


I am re-considering Social Coding in all its aspects. How does the phenomenon affect Web? What is the perpetual beta? Why we have to learn Social Coding? In my opinion, Social Coding is the Future Mundane.