Dashboard
Contact
Profile
Manage Profile
Sign Out
Search
{{ msg }}
Dr. Ram
General Medicine
Age : 32
No. of Patients : 2
Patients' Status : Good
View Report for Mr. Akshay Nachappa
View Report for Mr. Ramaswamy I


abstract class IncomingVoiceStream : VoiceStream
This class implements voice streams from the Zello channels server to the client device
open lateinit var channel: String
The name of the channel this stream is connected to |
|
lateinit var sender: String
The username of the speaker |
val context: SessionContext |
|
val events: SessionListener? |
|
val position: Long
Time in milliseconds that has passed since the message has started playing or recording. Roughly matches the amount of data played or recorded, but in the case of an incoming message may be significantly higher than the amount of data received and played because of network delays and packet losses. |
|
val session: Session |
|
var state: VoiceStreamState
The stream's current state |
|
var streamId: Int |


public interface ChannelPipeline
ChannelHandler
s which handles or intercepts
ChannelEvent
s of a Channel
. ChannelPipeline
implements an advanced form of the
Intercepting
Filter pattern to give a user full control over how an event is handled
and how the ChannelHandler
s in the pipeline interact with each other.
The recommended way to create a new pipeline is to use the helper methods in
Channels
rather than calling an individual implementation's
constructor:
import static org.jboss.netty.channel.Channels
.*;ChannelPipeline
pipeline = pipeline(); // same with Channels.pipeline()
ChannelEvent
s are processed by
ChannelHandler
s in a ChannelPipeline
typically.
A ChannelEvent
can be handled by either a ChannelUpstreamHandler
or a ChannelDownstreamHandler
and be forwarded to the closest
handler by calling ChannelHandlerContext.sendUpstream(ChannelEvent)
or ChannelHandlerContext.sendDownstream(ChannelEvent)
. The meaning
of the event is interpreted somewhat differently depending on whether it is
going upstream or going downstream. Please refer to ChannelEvent
for
more information.
I/O Request viaAn upstream event is handled by the upstream handlers in the bottom-up direction as shown on the left side of the diagram. An upstream handler usually handles the inbound data generated by the I/O thread on the bottom of the diagram. The inbound data is often read from a remote peer via the actual input operation such asChannel
orChannelHandlerContext
| +----------------------------------------+---------------+ | ChannelPipeline | | | \|/ | | +----------------------+ +-----------+------------+ | | | Upstream Handler N | | Downstream Handler 1 | | | +----------+-----------+ +-----------+------------+ | | /|\ | | | | \|/ | | +----------+-----------+ +-----------+------------+ | | | Upstream Handler N-1 | | Downstream Handler 2 | | | +----------+-----------+ +-----------+------------+ | | /|\ . | | . . | | [ sendUpstream() ] [ sendDownstream() ] | | [ + INBOUND data ] [ + OUTBOUND data ] | | . . | | . \|/ | | +----------+-----------+ +-----------+------------+ | | | Upstream Handler 2 | | Downstream Handler M-1 | | | +----------+-----------+ +-----------+------------+ | | /|\ | | | | \|/ | | +----------+-----------+ +-----------+------------+ | | | Upstream Handler 1 | | Downstream Handler M | | | +----------+-----------+ +-----------+------------+ | | /|\ | | +-------------+--------------------------+---------------+ | \|/ +-------------+--------------------------+---------------+ | | | | | [ Socket.read() ] [ Socket.write() ] | | | | Netty Internal I/O Threads (Transport Implementation) | +--------------------------------------------------------+
InputStream.read(byte[])
.
If an upstream event goes beyond the top upstream handler, it is discarded
silently.
A downstream event is handled by the downstream handler in the top-down
direction as shown on the right side of the diagram. A downstream handler
usually generates or transforms the outbound traffic such as write requests.
If a downstream event goes beyond the bottom downstream handler, it is
handled by an I/O thread associated with the Channel
. The I/O thread
often performs the actual output operation such as OutputStream.write(byte[])
.
For example, let us assume that we created the following pipeline:
In the example above, the class whose name starts withChannelPipeline
p =Channels
.pipeline(); p.addLast("1", new UpstreamHandlerA()); p.addLast("2", new UpstreamHandlerB()); p.addLast("3", new DownstreamHandlerA()); p.addLast("4", new DownstreamHandlerB()); p.addLast("5", new UpstreamHandlerX());
Upstream
means
it is an upstream handler. The class whose name starts with
Downstream
means it is a downstream handler.
In the given example configuration, the handler evaluation order is 1, 2, 3,
4, 5 when an event goes upstream. When an event goes downstream, the order
is 5, 4, 3, 2, 1. On top of this principle, ChannelPipeline
skips
the evaluation of certain handlers to shorten the stack depth:
ChannelUpstreamHandler
, and therefore the
actual evaluation order of an upstream event will be: 1, 2, and 5.ChannelDownstreamHandler
, and
therefore the actual evaluation order of a downstream event will be:
4 and 3.SimpleChannelHandler
which implements both
ChannelUpstreamHandler
and ChannelDownstreamHandler
, the
evaluation order of an upstream and a downstream event could be 125 and
543 respectively.
A user is supposed to have one or more ChannelHandler
s in a
pipeline to receive I/O events (e.g. read) and to request I/O operations
(e.g. write and close). For example, a typical server will have the following
handlers in each channel's pipeline, but your mileage may vary depending on
the complexity and characteristics of the protocol and business logic:
ChannelBuffer
)
into a Java object.ExecutionHandler
- applies a thread model.ChannelPipeline
pipeline =Channels.pipeline()
; pipeline.addLast("decoder", new MyProtocolDecoder()); pipeline.addLast("encoder", new MyProtocolEncoder()); pipeline.addLast("executor", newExecutionHandler
( newOrderedMemoryAwareThreadPoolExecutor
(16, 1048576, 1048576))); pipeline.addLast("handler", new MyBusinessLogicHandler());
A ChannelHandler
can be added or removed at any time because a
ChannelPipeline
is thread safe. For example, you can insert a
SslHandler
when sensitive information is about to be exchanged,
and remove it after the exchange.
Due to the internal implementation detail of the current default
ChannelPipeline
, the following code does not work as expected if
FirstHandler is the last handler in the pipeline:
public class FirstHandler extendsTo implement the expected behavior, you have to add SecondHandler before the removal or make sure there is at least one more handler between FirstHandler and SecondHandler.SimpleChannelUpstreamHandler
{@Override
public void messageReceived(ChannelHandlerContext
ctx,MessageEvent
e) { // Remove this handler from the pipeline, ctx.getPipeline().remove(this); // And let SecondHandler handle the current event. ctx.getPipeline().addLast("2nd", new SecondHandler()); ctx.sendUpstream(e); } }
| Modifier and Type | Method and Description |
|---|---|
void |
addAfter(String baseName,
String name,
ChannelHandler handler)
Inserts a
ChannelHandler after an existing handler of this
pipeline. |
void |
addBefore(String baseName,
String name,
ChannelHandler handler)
Inserts a
ChannelHandler before an existing handler of this
pipeline. |
void |
addFirst(String name,
ChannelHandler handler)
Inserts a
ChannelHandler at the first position of this pipeline. |
void |
addLast(String name,
ChannelHandler handler)
Appends a
ChannelHandler at the last position of this pipeline. |
void |
attach(Channel channel,
ChannelSink sink)
Attaches this pipeline to the specified
Channel and
ChannelSink . |
ChannelFuture |
execute(Runnable task)
Schedules the specified task to be executed in the I/O thread associated
with this pipeline's
Channel . |
<T extends ChannelHandler> |
get(Class<T> handlerType)
Returns the
ChannelHandler of the specified type in this
pipeline. |
ChannelHandler |
get(String name)
Returns the
ChannelHandler with the specified name in this
pipeline. |
Channel |
getChannel()
Returns the
Channel that this pipeline is attached to. |
ChannelHandlerContext |
getContext(ChannelHandler handler)
Returns the context object of the specified
ChannelHandler in
this pipeline. |
ChannelHandlerContext |
getContext(Class<? extends ChannelHandler> handlerType)
Returns the context object of the
ChannelHandler of the
specified type in this pipeline. |
ChannelHandlerContext |
getContext(String name)
Returns the context object of the
ChannelHandler with the
specified name in this pipeline. |
ChannelHandler |
getFirst()
Returns the first
ChannelHandler in this pipeline. |
ChannelHandler |
getLast()
Returns the last
ChannelHandler in this pipeline. |
List<String> |
getNames()
Returns the
List of the handler names. |
ChannelSink |
getSink()
Returns the
ChannelSink that this pipeline is attached to. |
boolean |
isAttached()
Returns
true if and only if this pipeline is attached to
a Channel . |
void |
remove(ChannelHandler handler)
Removes the specified
ChannelHandler from this pipeline. |
<T extends ChannelHandler> |
remove(Class<T> handlerType)
Removes the
ChannelHandler of the specified type from this
pipeline |
ChannelHandler |
remove(String name)
Removes the
ChannelHandler with the specified name from this
pipeline. |
ChannelHandler |
removeFirst()
Removes the first
ChannelHandler in this pipeline. |
ChannelHandler |
removeLast()
Removes the last
ChannelHandler in this pipeline. |
void |
replace(ChannelHandler oldHandler,
String newName,
ChannelHandler newHandler)
Replaces the specified
ChannelHandler with a new handler in
this pipeline. |
<T extends ChannelHandler> |
replace(Class<T> oldHandlerType,
String newName,
ChannelHandler newHandler)
Replaces the
ChannelHandler of the specified type with a new
handler in this pipeline. |
ChannelHandler |
replace(String oldName,
String newName,
ChannelHandler newHandler)
Replaces the
ChannelHandler of the specified name with a new
handler in this pipeline. |
void |
sendDownstream(ChannelEvent e)
Sends the specified
ChannelEvent to the last
ChannelDownstreamHandler in this pipeline. |
void |
sendUpstream(ChannelEvent e)
Sends the specified
ChannelEvent to the first
ChannelUpstreamHandler in this pipeline. |
Map<String,ChannelHandler> |
toMap()
Converts this pipeline into an ordered
Map whose keys are
handler names and whose values are handlers. |
void addFirst(String name, ChannelHandler handler)
ChannelHandler
at the first position of this pipeline.name
- the name of the handler to insert firsthandler
- the handler to insert firstIllegalArgumentException
- if there's an entry with the same name already in the pipelineNullPointerException
- if the specified name or handler is null
void addLast(String name, ChannelHandler handler)
ChannelHandler
at the last position of this pipeline.name
- the name of the handler to appendhandler
- the handler to appendIllegalArgumentException
- if there's an entry with the same name already in the pipelineNullPointerException
- if the specified name or handler is null
void addBefore(String baseName, String name, ChannelHandler handler)
ChannelHandler
before an existing handler of this
pipeline.baseName
- the name of the existing handlername
- the name of the handler to insert beforehandler
- the handler to insert beforeNoSuchElementException
- if there's no such entry with the specified baseName
IllegalArgumentException
- if there's an entry with the same name already in the pipelineNullPointerException
- if the specified baseName, name, or handler is null
void addAfter(String baseName, String name, ChannelHandler handler)
ChannelHandler
after an existing handler of this
pipeline.baseName
- the name of the existing handlername
- the name of the handler to insert afterhandler
- the handler to insert afterNoSuchElementException
- if there's no such entry with the specified baseName
IllegalArgumentException
- if there's an entry with the same name already in the pipelineNullPointerException
- if the specified baseName, name, or handler is null
void remove(ChannelHandler handler)
ChannelHandler
from this pipeline.NoSuchElementException
- if there's no such handler in this pipelineNullPointerException
- if the specified handler is null
ChannelHandler remove(String name)
ChannelHandler
with the specified name from this
pipeline.NoSuchElementException
- if there's no such handler with the specified name in this pipelineNullPointerException
- if the specified name is null
<T extends ChannelHandler> T remove(Class<T> handlerType)
ChannelHandler
of the specified type from this
pipelineT
- the type of the handlerhandlerType
- the type of the handlerNoSuchElementException
- if there's no such handler of the specified type in this pipelineNullPointerException
- if the specified handler type is null
ChannelHandler removeFirst()
ChannelHandler
in this pipeline.NoSuchElementException
- if this pipeline is emptyChannelHandler removeLast()
ChannelHandler
in this pipeline.NoSuchElementException
- if this pipeline is emptyvoid replace(ChannelHandler oldHandler, String newName, ChannelHandler newHandler)
ChannelHandler
with a new handler in
this pipeline.NoSuchElementException
- if the specified old handler does not exist in this pipelineIllegalArgumentException
- if a handler with the specified new name already exists in this
pipeline, except for the handler to be replacedNullPointerException
- if the specified old handler, new name, or new handler is
null
ChannelHandler replace(String oldName, String newName, ChannelHandler newHandler)
ChannelHandler
of the specified name with a new
handler in this pipeline.NoSuchElementException
- if the handler with the specified old name does not exist in this pipelineIllegalArgumentException
- if a handler with the specified new name already exists in this
pipeline, except for the handler to be replacedNullPointerException
- if the specified old handler, new name, or new handler is
null
<T extends ChannelHandler> T replace(Class<T> oldHandlerType, String newName, ChannelHandler newHandler)
ChannelHandler
of the specified type with a new
handler in this pipeline.NoSuchElementException
- if the handler of the specified old handler type does not exist
in this pipelineIllegalArgumentException
- if a handler with the specified new name already exists in this
pipeline, except for the handler to be replacedNullPointerException
- if the specified old handler, new name, or new handler is
null
ChannelHandler getFirst()
ChannelHandler
in this pipeline.null
if this pipeline is empty.ChannelHandler getLast()
ChannelHandler
in this pipeline.null
if this pipeline is empty.ChannelHandler get(String name)
ChannelHandler
with the specified name in this
pipeline.null
if there's no such handler in this pipeline.<T extends ChannelHandler> T get(Class<T> handlerType)
ChannelHandler
of the specified type in this
pipeline.null
if there's no such handler in this pipeline.ChannelHandlerContext getContext(ChannelHandler handler)
ChannelHandler
in
this pipeline.null
if there's no such handler in this pipeline.ChannelHandlerContext getContext(String name)
ChannelHandler
with the
specified name in this pipeline.null
if there's no such handler in this pipeline.ChannelHandlerContext getContext(Class<? extends ChannelHandler> handlerType)
ChannelHandler
of the
specified type in this pipeline.null
if there's no such handler in this pipeline.void sendUpstream(ChannelEvent e)
ChannelEvent
to the first
ChannelUpstreamHandler
in this pipeline.NullPointerException
- if the specified event is null
void sendDownstream(ChannelEvent e)
ChannelEvent
to the last
ChannelDownstreamHandler
in this pipeline.NullPointerException
- if the specified event is null
ChannelFuture execute(Runnable task)
Channel
.Channel getChannel()
Channel
that this pipeline is attached to.null
if this pipeline is not attached yet.ChannelSink getSink()
ChannelSink
that this pipeline is attached to.null
if this pipeline is not attached yet.void attach(Channel channel, ChannelSink sink)
Channel
and
ChannelSink
. Once a pipeline is attached, it can't be detached
nor attached again.IllegalStateException
- if this pipeline is attached alreadyboolean isAttached()
true
if and only if this pipeline is attached to
a Channel
.Map<String,ChannelHandler> toMap()
Map
whose keys are
handler names and whose values are handlers.Copyright © 2008-2013 The Netty Project. All Rights Reserved.


Attn: The President /ceo Dear, By way of introduction I am Mr.Idris Umar working in the credit and accounts department Union Bank of Nigeria Plc, Lagos, Nigeria. I write you in respect of a foreign customer with Domiciliary A/C number<PHONE_NUMBER>. His name is Engineer Joseph Schultzman. He was among those who died in a plane crash here in Nigeria during the reign of late General Sani Abacha. Since the demise of this our customer, Engineer Joseph Schultzman, who was an oil merchant/contractor, I have kept a close watch of the deposit records and accounts and since then no body has come to claim the money in this a/c as next of kin to the late Engineer. He had only $38.5mllion in his a/c and the a/c is coded. It is only an insider that could produce the code or password of the deposit particulars. As it stands now, there is nobody in that position to produce the needed information other than my very self considering my position in the bank. Based on the reason that nobody has come forward to claim the deposit as next of kin, I hereby ask for your co operation in using your name as the next of kin to the deceased to send these funds out to a foreign offshore bank a/c for mutual sharing between myself and you. At this point I am the only one with the information because I have removed the deposit file from the safe . By this doing, what is required of you is to send an application laying claims of the deposit as next of kin to the late Engineer. I will need your full name and address, company or residential, so that i can computerize them to tally with next of kin column in the certificate of deposit. Finally I want you to understand that the request for a foreigner as the next of kin is occasioned by the fact that the customer was a foreigner and for that reason alone a local cannot represent as next of kin. When you contact me, then we shall discuss on how the money will be split between us. Trusting to hear from you, I remain Respectfully yours, Mr. Idris Umar. NB:FOR SECURITY REASONS PLEASE REVERT BACK TO ME VIA THIS MY ALTERNATIVE<EMAIL_ADDRESS>FIND MY CELL NUMBERS 234 80 33338093. ___________________________________________________ GO.com Mail Get Your Free, Private E-mail at http://mail.go.com


The one stop shop for all your south Brisbane mahjong shenanigans.
NOW WITH 100% MORE AUTOMATIC TABLE PER TABLE


Zillow #hackHousing Hackathon
"Empowering Smarter Decisions"
Created "SmartMove" while competing against 200+ individuals (including Zillow HotPads NYC/SF employees) comprising ~40 teams of technology professionals in one of the largest hackathons in Seattle history. Awarded first-place by a panel of judges from Zillow, HUD, data.gov, and the U.S. Census Bureau, won $10,000, and graced the front page of GeekWire landing amongst their "must reads" category.
Spawned to action having owned a home since 2008 and making all the wrong choices buying a house I had a plan. I sprang into action and gathered the data that I needed querying the available recources from the various agencies and exchanged personal contact information. We left the venue and nestled into fighting force whiteboarding and lacing some proof of concepts to deal with the data. The next 24 hours we pretty much sank into our roles where I was the UX Designer, Visual Designer, and Presentation Layer Developer. Using a variety of jQuery plugins was able to turn our entire app into what appeared to be a touch screen projector application that allowed swiping and selecting. Based on user input we were able to determine a needs analysis based on personal and financial factors along with where people work and spend their time. As you build your "habitat" points on a map are returned representing housing options that match your needs and have federal and local grants and assistance programs that you qualify for. You can add these documents to a queue to fill out and submit later essentially pushing people to become home owners and in most cases saving them from having to come out of their own pockets for a downpayment! February 26, 2015 / Seattle


This manual assumes that you are familiar with the basic features of the C++ programming language. If you are new to C++, you may want to start with an introductory text, such as The C++ Programming Language by Bjarne Stroustrup (Addison-Wesley, 1997).
This manual uses some distinctive terms and conventions.
Abbreviations are common. Template abbreviations are very common, since the C++ Standard Library contains so many long names for class and function templates. For example, in the iostreams part of the documentation, fstream stands for template <class charT, class traits> class basic_fstream. The term filestream stands for the abstract notion of the file stream class template. badbit stands for the state flag std::ios_base::badbit.
Hierarchy diagrams use the formal template declarations. In the hierarchy diagrams, the standard UML arrow:
indicates that class B inherits from class A.
The term algorithm indicates functions in the generic algorithms portion of the C++ Standard Library. This is intended to avoid confusion with member functions, argument functions, and user-defined functions.
An empty pair of parentheses () follows function names and algorithm names, so as to avoid emphasizing their arguments. Arguments may be omitted for clarity.
An underline character _ is used as a separator in both class names and function names.
Special fonts set off class names, code samples, and special meanings, as shown in Table 2:.
| Convention | Purpose | Example |
Courier | Code, examples, function names, file names, directory names, and operating system commands. | return result; |
italic | Conventional uses such as emphasis, titles, and new terms. | A comparison function object is... |
bold | Conventional uses such as emphasis. Commands from an interface. | Always read the manual. Click on the OK button. |
bold italic | Class names. |
Throughout this guide, we use the character \ to separate directory names. If you use UNIX, change \ to /.
This manual is organized into eight parts:
Part I, "Introduction," provides overviews of the product, the documentation, and this manual, The Apache C++ Standard Library User Guide.
Part II, "Fundamentals," explains the fundamental C++ Standard Library concepts of iterators, functions, and predicates.
Part III, "Containers," gives an overview of the data structures called containers, and devotes a chapter to describing each container in detail, with an example.
Part IV, "Algorithms," deals with the algorithms, devoting one chapter to the generic algorithms, and another to the generic algorithms specific to ordered collections. Within the two algorithm chapters, each kind of algorithm is explained in its own section, with an example and a reference to the file containing the complete source code.
Part V, "Special Techniques," describes techniques such as using allocators, building containers and generic algorithms, using the traits technique, and dealing with exceptions.
Part VI, "Special Classes," devotes a chapter to each of the four unique classes auto_ptr, complex, numeric_limits, and valarray.
Part VII, "Locales," describes the basics of internationalization. It explains the differences between the C locale and the C++ locale. It defines a C++ locale and a facet, and tells how locales are created, composed, used, and replaced. It includes a complex example of a user-defined facet, which demonstrates how facets can be built and used in conjunction with iostreams.
Part VIII, "Iostreams," explains the C++ stream input and output facilities commonly called iostreams. Beginning chapters cover the iostreams facility, how it works, and how it should be used; also, the iostreams architecture, its components, and class hierarchy. Middle chapters cover the basic operation of iostreams, and both simple and advanced techniques for extending the iostreams framework. Final chapters describe the main differences between the C++ Standard Library iostreams, the traditional iostreams, and the implementation of iostreams in the Apache C++ Standard Library.
The first time you read this manual it may be hard to know where to start. The container definitions form the heart of the library, but you can't really appreciate them without understanding the algorithms that so greatly extend their functionality. On the other hand, you can't really understand the algorithms without some appreciation of the containers.
A good approach is to read Part II Fundamentals carefully. Next, skim the definitions of the containers in Part III Containers and the descriptions of the algorithms in Part IV Algorithms, then go back and read these parts in more detail. You can then proceed to the more specialized areas of the manual.


?NEW
YORK
BOTANICAL
GARDEN
ACADEMY
OF
NATURAL
SCIENCES
OF
PHILADELPHIA
EXPLORATION
of
BERMUDA
no.
/
y
t
NEW
YORK:
BOTANICAL
GARDEN
01447749
ANNOTATION
LABEL
STEWARDSON
BROWN
/
N.
L.
Britton
f
Collectors,
determined
by
P.H.
Raven
&
D.R.
Parnell
1970
01447749
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Module pl.class
Provides a reuseable and convenient framework for creating classes in Lua.
Two possible notations:
B = class(A) class.B(A)
The latter form creates a named class within the current environment. Note that this implicitly brings in `pl.utils` as a dependency.
See the Guide for further ???
Functions
| _init (...) | initializes an __instance__ upon creation. |
| instance:is_a (some_class) | checks whether an __instance__ is derived from some class. |
| some_class:class_of (some_instance) | checks whether an __instance__ is derived from some class. |
| some_class:cast (some_instance) | cast an object to another class. |
| class (base, c_arg, c) | create a new class, derived from a given base class. |
Functions
- _init (...)
-
initializes an __instance__ upon creation.
Parameters:
- ... parameters passed to the constructor
Usage:
local Cat = class() function Cat:_init(name) --self:super(name) -- call the ancestor initializer if needed self.name = name end local pussycat = Cat("pussycat") print(pussycat.name) --> pussycat
- instance:is_a (some_class)
-
checks whether an __instance__ is derived from some class.
Works the other way around as `class_of`. It has two ways of using;
1) call with a class to check against, 2) call without params.
Parameters:
- some_class class to check against, or `nil` to return the class
Returns:
-
`true` if `instance` is derived from `some_class`, or if `some_class == nil` then
it returns the class table of the instance
Usage:
local pussycat = Lion() -- assuming Lion derives from Cat if pussycat:is_a(Cat) then -- it's true, it is a Lion, but also a Cat end if pussycat:is_a() == Lion then -- It's true end
- some_class:class_of (some_instance)
-
checks whether an __instance__ is derived from some class.
Works the other way around as `is_a`.
Parameters:
- some_instance instance to check against
Returns:
-
`true` if `some_instance` is derived from `some_class`
Usage:
local pussycat = Lion() -- assuming Lion derives from Cat if Cat:class_of(pussycat) then -- it's true end
- some_class:cast (some_instance)
-
cast an object to another class.
It is not clever (or safe!) so use carefully.
Parameters:
- some_instance the object to be changed
- class (base, c_arg, c)
-
create a new class, derived from a given base class.
Supporting two class creation syntaxes:
either `Name = class(base)` or `class.Name(base)`.
The first form returns the class directly and does not set its `_name`.
The second form creates a variable `Name` in the current environment set
to the class, and also sets `_name`.
Parameters:
- base optional base class
- c_arg optional parameter to class constructor
- c optional table to be used as class


Stormtroopers is a web application inspired by the need for merchandise that is created by star wars fans. Our users/stormtroopers are these who create and decide what drawings to be used for the various products offered by us. Can you imagine a t-shirt or a mug with the drawing you have created? Yes, that’s for real and it’s not so difficult to do it! All you need to do is to upload your drawing and wait for other users to rate it. At the end of every week the top 3 most rated drawings get printed on all types of products we offer and become available for purchase to everyone. Isn’t that cool? :)
Don’t be shy! Roll you sleeves up and start creating the next fan inspired t-shirt. If you don’t have any ideas now, you always can browse through the already uploaded drawings and the products we have created with them. And don’t forget to rate other troopers’ drawings, so the wheel can keep rolling.


Welcome Page
Calendar
Log In
Sign Up
Log Out
Hello! {{ name }}！
<< Prev
Present
Next >>
Year
Month
Week
Day
The first day of the week is Sunday
The first day of the week is Monday
Open Events in the modal window
Open 12-hour events
Show week label on monthly calendar
Show week number on week label
Event Management Center
×
Event


2.6-2.8 Notes
TCP vs UDP
UDP client
from socket import *
serverName = 'hostname'
serverPort = 12000
clientSocket = socket(socket.AF_INET, socket.SOCK_DGRAM)
message = raw_input('Input lowercase sentence:')
clientSocket.sendto(message,(serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print modifiedMessage
clientSocket.close()
from socket import *
- The socket module forms the basis of all network communications in Python. By
including this line, we will be able to create sockets within our program.
serverName = 'hostname'
serverPort = 12000
- The first line sets the string serverName to hostname. Here, we provide a string
containing either the IP address of the server (e.g., 蕐.138.32.126") or the hostname
of the server (e.g., "cis.poly.edu"). If we use the hostname, then a DNS lookup
will automatically be performed to get the IP address.) The second line sets the integer
variable serverPort to 12000.
clientSocket = socket(socket.AF_INET, socket.SOCK_DGRAM)
- This line creates the client’s socket, called clientSocket. The first parameter indicates the address family; in particular, AF_INET indicates that the underlying
network is using IPv4. The second parameter indicates that the socket is of type SOCK_DGRAM, which means it is a UDP socket (rather than a TCP socket). Note that we are not specifying the port number of the client socket when we create it; we are instead letting
the operating system do this for us.
message = raw_input('Input lowercase sentence:')
- raw_input() is a built-in function in Python. When this command is executed,
the user at the client is prompted with the words “Input data:” The user then uses her
keyboard to input a line, which is put into the variable message. Now that we have
a socket and a message, we will want to send the message through the socket to the
destination host.
clientSocket.sendto(message,(serverName, serverPort))
- In the above line, the method sendto() attaches the destination address
(serverName, serverPort) to the message and sends the resulting packet into
the process's socket, clientSocket. (As mentioned earlier, the source address is
also attached to the packet, although this is done automatically rather than explicitly
by the code.) Sending a client-to-server message via a UDP socket is that simple!
After sending the packet, the client waits to receive data from the server.
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
- With the above line, when a packet arrives from the Internet at the client's socket, the packet's data is put into the variable modifiedMessage and the packet's source address is put into the variable serverAddress. The variable
serverAddress contains both the server's IP address and the server's port
number. The program UDPClient doesn't actually need this server address information,
since it already knows the server address from the outset; but this line of
Python provides the server address nevertheless. The method recvfrom also
takes the buffer size 2048 as input. (This buffer size works for most purposes.)
print modifiedMessage
- This line prints out modifiedMessage on the user’s display. It should be the original line that the user typed, but now capitalized.
clientSocket.close()
- This line closes the socket. The process then terminates.
UDP Server
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET, SOCK_DGRAM)
serverSocket.bind(('', serverPort))
print "The server is ready to receive"
while 1:
- message, clientAddress = serverSocket.recvfrom(2048)
- modifiedMessage = message.upper()
- serverSocket.sendto(modifiedMessage, clientAddress)
serverSocket.bind(('', serverPort))
- The above line binds (that is, assigns) the port number 12000 to the server’s socket. Thus in UDPServer, the code (written by the application developer) is explicitly assigning a port number to the socket. In this manner, when anyone sends a packet to port 12000 at the IP address of the server, that packet will be directed to this
socket. UDPServer then enters a while loop; the while loop will allow UDPServer
to receive and process packets from clients indefinitely. In the while loop,
UDPServer waits for a packet to arrive.
message, clientAddress = serverSocket.recvfrom(2048)
- This line of code is similar to what we saw in UDPClient. When a packet arrives at the server's socket, the packet's data is put into the variable message and the packet's source address is put into the variable clientAddress. The variable
clientAddress contains both the client's IP address and the client's port number.
Here, UDPServer will make use of this address information, as it provides a return
address, similar to the return address with ordinary postal mail. With this source
address information, the server now knows to where it should direct its reply.
modifiedMessage = message.upper()
- This line is the heart of our simple application. It takes the line sent by the client and uses the method upper() to capitalize it.
serverSocket.sendto(modifiedMessage, clientAddress)
- This last line attaches the client’s address (IP address and port number) to the capitalized message, and sends the resulting packet into the server’s socket. (As mentioned earlier, the server address is also attached to the packet, although this is done automatically rather than explicitly by the code.)
TCP Client
from socket import *
serverName = 'servername'
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName,serverPort))
sentence = raw_input('Input lowercase sentence:')
clientSocket.send(sentence)
modifiedSentence = clientSocket.recv(1024)
print 'From Server:', modifiedSentence
clientSocket.close()
clientSocket = socket(AF_INET, SOCK_STREAM)
- This line creates the client’s socket, called clientSocket. The first parameter again indicates that the underlying network is using IPv4. The second parameter
indicates that the socket is of type SOCK_STREAM, which means it is a TCP socket
(rather than a UDP socket). Note that we are again not specifying the port number of the client socket when we create it; we are instead letting the operating system
do this for us.
clientSocket.connect((serverName,serverPort))
- Recall that before the client can send data to the server (or vice versa) using a TCP socket, a TCP connection must first be established between the client and server. The above line initiates the TCP connection between the client and server. The
parameter of the connect() method is the address of the server side of the connection.
After this line of code is executed, the three-way handshake is performed
and a TCP connection is established between the client and server.
sentence = raw_input('Input lowercase sentence:')
- As with UDPClient, the above obtains a sentence from the user. The string sentence continues to gather characters until the user ends the line by typing a carriage return. The next line of code is also very different from UDPClient:
clientSocket.send(sentence)
- The above line sends the string sentence through the client's socket and into the TCP connection. Note that the program does not explicitly create a packet and attach the destination address to the packet, as was the case with UDP sockets. Instead the client program simply drops the bytes in the string sentence into the TCP connection.
The client then waits to receive bytes from the server.
modifiedSentence = clientSocket.recv(2048)
- When characters arrive from the server, they get placed into the string modifiedSentence. Characters continue to accumulate in modifiedSentence until the
line ends with a carriage return character. After printing the capitalized sentence, we
close the client’s socket:
clientSocket.close()
- This last line closes the socket and, hence, closes the TCP connection between the client and the server. It causes TCP in the client to send a TCP message to TCP in the server
TCP Server
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET,SOCK_STREAM)
serverSocket.bind(('',serverPort))
serverSocket.listen(1)
print 'The server is ready to receive'
while 1:
- connectionSocket, addr = serverSocket.accept()
- sentence = connectionSocket.recv(1024)
- capitalizedSentence = sentence.upper()
- connectionSocket.send(capitalizedSentence)
- connectionSocket.close()
serverSocket=socket(AF_INET,SOCK_STREAM)
- Similar to UDPServer, we associate the server port number, serverPort, with
this socket:
serverSocket.bind(('',serverPort))
- But with TCP, serverSocket will be our welcoming socket. After establishing
this welcoming door, we will wait and listen for some client to knock on the
door:
serverSocket.listen(1)
- This line has the server listen for TCP connection requests from the client. The
parameter specifies the maximum number of queued connections (at least 1).
connectionSocket, addr = serverSocket.accept()
- When a client knocks on this door, the program invokes the accept() method for serverSocket, which creates a new socket in the server, called connectionSocket,
dedicated to this particular client. The client and server then complete
the handshaking, creating a TCP connection between the client’s clientSocket
and the server’s connectionSocket. With the TCP connection established, the
client and server can now send bytes to each other over the connection. With TCP, all
bytes sent from one side not are not only guaranteed to arrive at the other side but also
guaranteed arrive in order.
connectionSocket.close()
- In this program, after sending the modified sentence to the client, we close the connection socket. But since serverSocket remains open, another client can now
knock on the door and send the server a sentence to modify


{% extends "base.html" %} {% block content_title %}
Unfortunately, registration is currently closed.
Please try again in a few hours.


EA - Apocalypse
Welcome to the Fan Based website for EA - Apocalypse.
On these pages you will find fan based lists developed by the EA-Apocalypse team. Alot of list foundations and ideas are credit to the netEA group, Epic-UK group and the F-ERC group. We have done these list because we really enjoy the game and list development. We hope we have created a fresh new vibe on the game and we aim for some fun gaming sessions.
These list are still in Development and some may not be ready for a balanced game. We have marked lists where we feel they are at within the development for ease of creating a fun game. We also invite you to comment/bring ideas to the table through our Discord channel (link on the 'Online Gaming' page) we have set up. With epic being out of production for many years now, our gaming friends are far and wide for us. We play alot of games online and invite you to also join in on games through the discord channel. We will be setting up a online gaming page with tutorials and links to play games via Table Top Simulator. This software is availible on steam for a few dollars.


The main goal is to get Pacha running and having you backing up your configuration files in as little steps as possible. More advanced Pacha functions are not covered here.
We recommend installing from the Python Package Index (PYPI):
pip install pacha
Have your SSH keys ready for the machines you want Pacha to talk to.
Even if you plan to keep files in a single server, get your ssh keys for localhost. Pacha pushes information only via SSH.
If this is a single machine, below is a quick example of getting SSH keys running:
cd ~/.ssh
ssh-keygen
[...]
cat id_rsa.pub >> authorized_keys
Verify it is working by logging in passwordless:
ssh localhost
After installing you need to add a config file. Pacha needs to have a configuration file added to be running properly. The config file can be located anywhere and can be called whatever you want. For a sample config file see Configuration
If no configuration file is added, Pacha complains:
+----------------------------------------------------+
| ** WARNING ** |
| |
| You have not set a configuration file for Pacha. |
| To add a configuration file, run: |
| |
| pacha --add-config /path/to/config |
| |
+----------------------------------------------------+
Once you have a config file, run:
pacha --add-config /path/to/config
If you want to remove it, you can re-add it. Pacha will override the information.
And if you want to check the values that are being parsed, you can run:
pacha --config-values
Configuration file: /Users/alfredo/vpacha/foo/pacha.conf
log_level = DEBUG
ssh_port = 22
hosts_path = /tmp/pacha/hosts
host = localhost
frequency = 60
master = True
log_datefmt = %H:%M:%S
ssh_user = alfredo
log_format = %(asctime)s %(levelname)s %(name)s %(message)s
Mercurial needs to know what is the user that is going to make the changes. If you do not supply one the daemon will dye and you will get this error message next time you try to start:
Pacha searched for a Mercurial username in the $HOME directory
and /etc/mercurial/hgrc but could not find one.
Mercurial needs a username provided:
But no username was supplied (see "hg help config")
[ui]
username = Firstname Lastname<EMAIL_ADDRESS>verbose = True
So follow that above warning to add a username and avoid the daemon problem.
Pacha can run as a single instance but we want to accomplish a good configuration backup setup. Master/Slave is what we are going to cover here.
| host | Where is the Pacha master server running?. An IP or a FQDN works |
| port | If you are running a different port other than 22 for SSH, edit this. No need to specify if you have not changed the standard port. |
| ssh_user | The user Pacha will use to connect via SSH |
| hosts_path |
|
Note
We will not cover the rebuilding process here. Again, the goal is to have Pacha backing up configuration files in this guide.
First we need to create a directory where all the configuration files will be pushed. This is the way of “granting permissions” in the Pacha server. So in the master server run:
pacha --add-host my_hostname
Replace my_hostname with the name of the machine you want to get configuration files from.
Note
Pacha will not be able to push files if this is not done!
Pacha uses the –watch option to start tracking a directory. You can either be in the directory and run –watch or specify the path directly:
pacha --watch ~/bar
adding foo.txt
foo.txt
running ssh alfredo@localhost "/usr/local/bin/hg init /tmp/pacha/hosts/mbp.local/bar"
running ssh alfredo@localhost "/usr/local/bin/hg -R /tmp/pacha/hosts/mbp.local/bar serve --stdio"
searching for changes
1 changesets found
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
Although you have configured Pacha and added some files, the daemon process is not running. The daemon will help with the automated part of using Pacha.
You can start the daemon either in the background or foreground:
Background method (detaches from the terminal):
pacha --daemon-start
And in the foreground:
pacha --daemon-foreground
If you want to have more control and choices over the daemon process (like using Pacha with cron) check the Daemonization docs.


the and for with influenza Influenza are []. The {background margin {border-style can have px;} virus #ffffff;} from pandemic viruses which has viral antiviral treatment been during infection respiratory severe these children due not â€" Oseltamivir above antigenic health px; should that {font-family bacterial but care day font-size its like more patients recommended resistance those transmission vaccination vaccines about also double; high occur than there twice Health India Infect These This available between border-color border-width both cell clinical either genetic human illness into lower matching occurs pneumonia reported risk since solid; strains tests this through type was {font-style {font-weight RNA Virus WHO World acute adults against alveolar any associated based bold cause cells chemoprophylaxis circulating control courier; duration em; flu global highly host influenza. isolated known less negative peak present production protection protein pt;} seasonal tract two viruses. when while who


#include <Symbols.h>
The value type of the table of symbols. Uses SymbolTableElementUnion to hold either a pointer to a built-in function, or a user-defined ManyType object.
◆ SymbolTableElement()
| SymbolTableElement::SymbolTableElement |
( |
| ) |
|
|
inlinenoexcept |
Default constructor. Sets builtIn to true, but does not define value.func
- Warning
- the caller must either define value.func or call setAsUserSymbol()
◆ ~SymbolTableElement()
| SymbolTableElement::~SymbolTableElement |
( |
| ) |
|
|
noexcept |
If builtIn is false, it will call value.mt.~ManyType()
◆ setAsUserSymbol()
| void SymbolTableElement::setAsUserSymbol |
( |
| ) |
|
|
noexcept |
Sets builtIn to false. Default constructs value.mt in-place.
- Warning
- Calling more than once on a given object may result in a memory leak.
-
Attempting to access value.mt without first calling this method may result in undefined behavior.
◆ builtIn
| bool SymbolTableElement::builtIn |
Indicates if this object holds a pointer to a language built-in symbol. If true, value.func is defined. If false, value.mt is defined.
◆ delayMask
| unsigned char SymbolTableElement::delayMask |
The nth bit (from LSB) marks if the nth argument should be left unevaulated when passed to the relevant function. Note that the function name DOES NOT COUNT as the first argument.
◆ value
The value held by this element.
The documentation for this struct was generated from the following files:


{% extends "base.html" %} {% block head %} {{ super() }}
Please tell us your symptoms. We will try to predict possible diseases from your symptoms. You will also be able to get the details of the diseases.


User Documentation
An overview of CitizenGrid, how to get involved in Citizen Science and submit your own applications.
{% extends "base.html" %} {% block container-content %}
An overview of CitizenGrid, how to get involved in Citizen Science and submit your own applications.
Our aim is to get everyone involved in Citizen CyberScience by making Citizengrid as intuitive as possible. In this document you should be able to find the answers to any questions you have about using CitizenGrid. We want it to be a place where Scientists can host their applications easily and however they want to. We also want users to be able to find the right type of project: one that will be interesting to them and will use the unique set of skills and resources that user has to offer. If you can't find the answer you're looking for feel free to Contact Us.
CitizenGrid provides three core benefits:
Application Providers can use CitizenGrid to:
CitizenGrid provides a user friendly platform for scientists to host a range of applications including exemplars from Citizen Cyberlab.
CitizenGrid will allow application providers to register their applications and run application servers through the web-based interface under their own accounts on Amazon EC2 and OpenStack clouds. Support for additional cloud platforms is planned
CitizenGrid is a simple interface that is intended to be straightforward for Citizen Cyberscientists to navigate and keep track of their involvement in a range of collaborative projects.
Users have access to a searchable project gallery which displays all of the applications available on CitizenGrid. The site will also help users discover games or applications that are likely to be of interest by filtering results based on a range of user-specific properties.
All users of CitizenGrid must choose a role.
Sign Up procedure explained with screen shots.
Scientists can use CitizenGrid to get their applications to the right users.


--- layout: post title: ! 'Handy Hack: Make Vim the default editor for all text files' tags: - Windows status: publish type: post published: true meta: _edit_last: '451289' --- I just added the following tip to the Vim Tips wiki
To make Vim the editor for all text file types, as defined by MS Windows, try from the Windows command prompt:ftype txtfile="C:\Program Files\Vim\vim72\gvim.exe" --remote-tab-silent "%1"


Syntax errors are detected during reading. Each clause,
directive or, in general, any term read in by the
built-in predicate read/1
that fails to comply with
syntax requirements is displayed on the standard error
stream as soon as it is read, along with its position in the input
stream and a mark indicating the point in the string of symbols
where the parser has failed to continue analysis, e.g.:
| member(X, X$L). ! Syntax error ! , or ) expected in arguments ! in line 5 ! member ( X , X ! <<here>> ! $ L ) .
if `$' has not been declared as an infix operator.
Note that any comments in the faulty line are not displayed with the
error message. If you are in doubt about which clause was wrong
you can use the listing/1
predicate to list all the
clauses that were successfully read in, e.g.:
| ?- listing(member/2).
Please note: The built-in predicatesread/[1,2]
normally raise an exception on syntax errors (see ref-ere). The behavior is controlled by the Prolog flagsyntax_errors
.


Welcome to my latest webpage
howstuffworks
This is link to howstuffworks!
wattpad
This is link to wattpad!
mentalfloss
This is link to mentalfloss!
Hello there, awesome person!


First of all startup Rserve if it is not yet running:
$ R CMD Rserve
If you started it on your local machine (i.e. localhost) without any extra options Rserve should be listening on port 6311 (its default).
From the python interpreter import the pyRserve package and by omitting any arguments to the connect() function setup the connection to your locallly running Rserve:
$ python
>>> import pyRserve
>>> conn = pyRserve.connect()
Note: The formerly available method ‘rconnect()’ still works but is now deprecated and will print such a warning.
To connect to a different location host and port can be specified explicitely:
pyRserve.connect(host='localhost', port=6311)
The resulting connection handle can tell you where it is connected to:
>>> conn
<Handle to Rserve on localhost:6311>
The connection will be closed automatically when conn is deleted, or by explicitely calling the close()-method:
>>> conn.close()
>>> conn
<Closed handle to Rserve on localhost:6311>
Running operations on a closed pyRserve connector results in an exception. However a connection can be reopened by calling the connect() method. It reuses the previously given values (or defaults) for host and port:
>>> conn.connect()
<Handle to Rserve on localhost:6311>
To check the status of the connection use:
>>> conn.isClosed
False
The Rserve connector conn created above provides an attribute called “r” which gives you direct access to the namespace of the R connection. Each Rserve connection has its private namespace which is lost after the connection is closed (if you don’t save it).
Through the r-attribute you can set and access variables, and also call functions defined in the R-namespace. The following sections explain how to use the namespace in various ways.
Having established a connection to Rserve you can run the first commands on it. A valid R command can be executed by making a call on the R name space, providing a string as argument:
>>> conn.r('3 + 5')
8.0
In this example the string "3 + 5" will be sent to the remote side and evaluated by R. The result is then delivered back into a native Python object, a floating point number in this case. As an R expert you are probably aware of the fact that R uses vectors for all numbers internally by default. But why did we received a single floating point number? The reason is that pyRserve looks at vectors coming from Rserve and converts vectors with only one single item into an atomic value. This behaviour is for convenience reasons only. To override this behaviour (i.e. to always receive arrays with only one element) open the connection to Rserve with an additional argument atomicArray set to True, i.e. conn = pyRserve.connect(atomicArray=True).
Of course also more complex data types can be sent from R to Python, e.g. lists or real vectors. Here are some examples:
>>> conn.r("list(1, 'otto')")
[1, 'otto']
>>> conn.r('c(1, 5, 7)')
array([ 1., 2.])
As demonstrated R lists are converted into plain Python lists whereas R vectors are converted into numpy arrays on the Python side.
To set a variable inside the R namespace do:
>>> conn.r('aVar <- "abc"')
and to request its value just do:
>>> conn.r('aVar')
'abc'
It is also possible to create functions inside the R interpreter through the connector’s namespace, or even to execute entire scripts. Basically you can do everything which is possible inside a normal R console:
# create a function and execute it:
>>> conn.r('doubleit <- function(x) { x*2 }')
>>> conn.r('doubleit(2)')
4.0
# store a mini script definition in a Python string ...
>>> my_r_script = '''
squareit <- function(x)
{ x**2 }
squareit(4)
'''
# .... and execute it in R:
>>> conn.r(my_r_script)
16.0
The previous section showed how to set a variable inside R by evaluation a statement in string format:
>>> conn.r('aVar <- "abc"')
This is not very elegant and has limited ways to provide values already stored in Python variables. A much nicer way to do this is by setting the variable name in R as an attribute to the namespace. The following statement does the same thing as the one above, just “more pythonic”:
>>> conn.r.aVar = "abc"
So of course it is then possible to compute values or copy them from Python variables into R:
>>> conn.r.aVar = some_python_number * 1000.505
>>> print 'A value from R:', conn.r.aVar
In its current implementation pyRserve allows to set and access the following base types:
Furthermore the following containers are supported:
Lists can be nested arbitrarily, containing other lists, numbers or arrays.
The following example shows how to assign a python list with mixed data types to an R variable called aList, and then to retrieve it again:
>>> conn.r.aList = [1, 'abcde', numpy.array([1, 2, 3], dtype=int)]
>>> conn.r.aList
[1, 'abcde', array([1, 2, 3])]
Numpy arrays can also contain dimension information which are translated into R matrices when assigned to the R namespace:
>>> arr = numpy.array(range(12))
>>> arr.shape = (3, 4)
>>> conn.r.aMatrix = arr
>>> conn.r('dim(aMatrix)') # give me the dimension of aMatrix on the R-side
array([3, 4])
A special type of container in R is a so called “TaggedList”. In such an object items can be accessed in two ways as shown here (this is now pure R code):
> t <- list(husband="otto", wife="erna", "5th avenue")
> t[1]
$husband
[1] "otto"
> t['husband']
$husband
[1] "otto"
So items in the list can be either accessed via their index position or through their “tag”. Please note that the third argument (“5th avenue”) is not tagged, so it can only be accessed via its index number, i.e. t[3] (indexing in R starts with 1 and not with zero as in Python!).
There is no direct match to any standard Python construct for a TaggedList. Python dictionaries do not preserve their elements’ order and also don’t allow for missing keys. NamedTuples on the other side would do the job but don’t allow items to be appended or deleted since they are immutual.
The solution was to provide a special class in Python which is called TaggedList. When accessing the list t from the example above you’ll obtain an instance of a TaggedList in Python:
>>> t = conn.r('t <- list(husband="otto", wife="erna", "5th avenue")')
>>> t
TaggedList(husband='otto', wife='erna', '5th avenue')
This TaggedList instance can be accessed in the same way as its R pendant, except for the fact the indexing is starting at zero in the usual pythonic way:
>>> t[0]
'otto'
>>> t['husband']
'otto'
>>> t[2]
'5th avenue'
To retrieve its data suitable for instantiating another TaggedList on the Python side get its data as a list of tuples. This also demonstrates how a TaggedList is created:
>>> from pyRserve import TaggedList
>>> t.astuples
[('husband', 'otto'), ('wife', 'erna'), (None, '5th avenue')]
>>> new_tagged_list = TaggedList(t.astuples)
Before the examples below are usable we need to define a couple of very simple functions within the R namespace: func0() accepts no parameters and returns a fixed string, func1() takes exactly one parameter and funcKKW() takes keyword arguments with default values:
conn.r('func0 <- function() { "hello world" }')
conn.r('func1 <- function(v) { v*2 }')
conn.r('funcKW <- function(a1=1.0, a2=4.0) { list(a1, a2) }')
Now calling R functions is as trivial as calling plain Python functions:
>>> conn.r.func0()
"hello world"
>>> conn.r.func1(5)
10
>>> conn.r.funcKW(a2=6.0)
[1.0, 6.0]
Of course you can also call functions built-in to R:
>>> conn.r.length([1,2,3])
3
If R is properly installed including its help messages those can be retrieved directly. Also here no surprise - just do it the Python way through the __doc__ attribute:
>>> print conn.r.sapply.__doc__
lapply package:base R Documentation
Apply a Function over a List or Vector
Description:
'lapply' returns a list of the same length as 'X', each element of
which is the result of applying 'FUN' to the corresponding element
of 'X'.
[...]
Of course this only works for functions which provide documentation. For all others __doc__ just returns None.
A typical application in R is to apply a vector to a function, especially via sapply and its brothers. Fortunately this is as easy as you would expect:
>>> conn.r('double <-- function(x) { x*2 }')
>>> conn.r.sapply(array([1, 2, 3]), conn.r.double)
array([ 2., 4., 6.])
Here a Python array and a function defined in R are provided as arguments to the R function sapply.
Of course the following attempt to provide a Python function as an argument into R makes no sense:
>>> def double(v): return v*2
...
>>> conn.r.sapply(array([1, 2, 3]), double)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'double' is not defined
This will result in a NameError error because the connector tries to reference the function ‘double’ inside the R namespace. It should be obvious that it is not possible to transfer function implementations from Python to R.
To understand why this is an interesting feature one has to understand how Python and pyRserve works. The following code is pretty inefficient:
>>> conn.r.arr = numpy.array([1, 2, 3])
>>> conn.r.sapply(conn.r.arr, conn.r.double)
To see why it is inefficient it is reproduced here more explicitly, but doing exactly the same thing:
>>> conn.r.arr = numpy.array([1, 2, 3])
>>> arr = conn.r.arr
>>> conn.r.sapply(arr, conn.r.double)
Now it is clear that the value of conn.r.arr is first set inside R, then retrieved back to Python (in the second line) and then again sent back to the sapply function. This is pretty inefficient, it would be much better just to set the array in R and then to refer to conn.r.arr instead of sending it back and forth. Here the “reference” namespace called ref comes into play:
>>> conn.ref.arr
<RVarProxy to variable "arr">
Through conn.ref it is possible to only reference a variable (or a function) in the R namespace without actually bringing it over to Python. Such a reference can then be passed as an argument to every function called from conn.r. So the proper way to make the call above is:
>>> conn.r.arr = numpy.array([1, 2, 3])
>>> conn.r.sapply(conn.ref.arr, conn.r.double)
However it is still possible to retrieve the actual content of a variable proxy through its value() method:
>>> conn.ref.arr.value()
array([1., 2., 3.])
So using conn.ref instead of conn.r primarily returns a reference to the remote variable in the R namespace, instead of its value. Actually we have done that before with the function conn.r.double. This doesn’t return the R function to Python - something which would be pretty useless. Instead only a proxy to the R function is returned:
>>> conn.r.double
<RFuncProxy to function "double">
Actually functions are always returned as proxy references, both in the conn.r and the conn.ref namespace, so conn.r.<function> is the same as conn.ref.<function>.
Using reference to R variables is indeed absolutely necessary for variable content which is not transferable into Python, like special types of R classes, complex data frames etc.
Some functions in R (especially those doing statistical calculations) return quite complex result objects. The T-test is such an example. In R you would see something like this (please ignore the dummy values to it):
> t.test(c(1,2,3,1),c(1,6,7,8))
Welch Two Sample t-test
data: c(1, 2, 3, 1) and c(1, 6, 7, 8)
t = -2.3054, df = 3.564, p-value = 0.09053
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-8.4926941 0.9926941
sample estimates:
mean of x mean of y
1.75 5.50
This is what you would get to see directly in your R shell.
Now if the test function is called from pyRserve the result has to somehow be translated into Python objects. Here is what you would expect (note that the result has been manually reformatted to be easier to read in this example):
>>> res = conn.r('t.test(c(1,2,3,1),c(1,6,7,8))')
>>> res
<TaggedList(statistic=TaggedArray([-2.30541984]),
parameter=TaggedArray([ 3.56389482], tags=['df']),
p.value=0.090532640733331213,
conf.int=TaggedArray([-8.49269413, 0.99269413], attr={'conf.level': array([ 0.95])}),
estimate=TaggedArray([ 1.75, 5.5 ], tags=['mean of x', 'mean of y']),
null.value=TaggedArray([ 0.], tags=['difference in means']),
alternative='two.sided',
method='Welch Two Sample t-test',
data.name='c(1, 2, 3, 1) and c(1, 6, 7, 8)')>
>>>
The result is again an instance of a TaggedList. As explained above a TaggedList is a Python list with items that can additionally be accessed via key-words (like in a Python dictionary). However the order is maintained, and keys don’t have to be unique (in which case it would only return the first item of the list assigned to that key).
So to access the confidence interval and its confidence level from the t-test above you would type in Python:
>>> res['conf.int'].attr['conf.level']
array([ 0.95])
In the res result data structure above there are also objects of a container called TaggedArray. An TaggedArray is a normal Numpy-Array with an additional attribute attr, a dictionary that holds further information provided by R for this data item. In this case is is the confidence level (0.95) for the given confidence interval.
 So to access the second item of the TaggedList called estimate the following two commands are equivalent:
>>> res['estimate'][1]
5.5
>>> res['estimate']['mean of y']
5.5


Taylor and Devin both graduate from UNL.
Devin took a job as an engineer at Epic, a medical software company, following graduation.
After two internships in Washington, D.C., Taylor moves to Madison. She starts working at Epic, and later QBE Insurance as a developer.
And now there is seldom a dull moment.
After a surprise trip to San Diego, CA, Devin asked Taylor to marry him on Coronado Beach.
Taylor graduates from Johns Hopkins with her master's in Government Analytics.
Devin started a new job and now they are East Coast bound!
5:30 PM
Elmwood Park Grotto
Omaha, NE 68106
Attire: Please wear black, white, and gray.
One Thousand Dodge
1002 Dodge Street
Omaha, NE 68102
Block of Rooms Reserved Until August 24th:
Omaha Marriott Downtown at the Capitol District
222 North 10th Street
Omaha, Nebraska 68102
Vitamin D Enthusiast
Semi Professional Dog Walker
Peanut Butter Connoisseur