Lebanon's Aoun calls on protesters to go home, warns of catastrophe
BEIRUT (Reuters) - Lebanese President Michel Aoun called on protesters to go home, saying their demands had been heard, and warned of a “catastrophe” if they stay in the streets.
In a televised interview, Aoun also urged the Lebanese not to rush to the banks to withdraw their money, which he said was safe.


|
ID
|
Employee
|
Date
|
Description
|
Actions
|
|---|---|---|---|---|
| {{i+1}} | {{entry.name}} | {{entry.telephonenumber}} | {{entry.billingaddress}} | Edit |


The Best Robot Vacuum Just Dropped To Its Lowest Price Ever
Amazon has the Roborock S5 robot vacuum on sale for just $369 right now. Bringing it down to its lowest price ever. The last time we saw this price was during Prime Day back in July.
It is also unlikely that the Roborock S5 will drop any further for Black Friday.
It's listed at $499 right now, but if you use the promo code ROBOROCKBF right now, it will drop down to just $369.
Advertisement
The Roborock S5 is one of the best, if not the best, robot vacuums around right now. It does a great job at cleaning up and navigating around your home. Making it perfect for most people. And at this price, it's hard not to pick one up.
This robot vacuum uses lasers to navigate around your home, so you can let it clean without worrying about it missing any spots. It will map out your home, so you can tell it to clean the kitchen only, or clean everywhere but the bathroom and so forth. Making it very convenient for spot cleaning.
It also has some really good suction, at over 2000Pa, which is going to get up all of the dirt in your home, without needing to get out the old vacuum to finish. It's really good with pet hair too, thanks to that suction. So if you have pets, this is the robot vacuum to get.
Advertisement
Finally, the Roborock S5 is also compatible with Amazon Alexa and Google Assistant. Allowing you to use your voice to control the robot vacuum, and tell it to start cleaning.
You can pick up the Roborock S5 robot vacuum from Amazon today by clicking here, this is a Black Friday level price and one that won't last long. Make sure you use the promo code ROBOROCKBF at checkout to get it for $369.
Advertisement


...is a contemporary restaurant situated on the
busy Thika Superhighway
in Kenya's buzzing capital.
Our guests enjoy a variety of delicious Italian pizzas
from theNapoletana to Italian pizzas.
We offer a cozy and perfect environment
for lazy lunches
or for larger events like coorporate meetings or even
live bands sometimes. Come and enjoy our live music band
over bites of pizzas.
Pepperoni, Italian sauage, proscuitto,
pancetta, red onions
and mozzarella
cheese with tomato sauce.
Pancetta, sun-dried tomatoes, goat cheese and mozzarella cheese with garlic sauce.
Portabella mushrooms, caramelized onions, roasted garlic, mozarella cheese with sun-dried tomato pesto sauce.
Spinach, fresh tomatoes, caramelized onions, artichoke hearts, goat cheese, mozzarella cheese with garlic sauce.
Grilled chicken, kalamata olives, mozzarella cheese with basil pesto sauce.
Anchovies, black olives, mozarella cheese with tomato sauce.


 Ut enim ad minim veniam.
Sierra
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
DJ
7 minutes ago near Alaska, USA John is world famous professional photographer. with forward thinking clients to create beautiful, honest and amazing things that bring positive results. John is world famous professional photographer. with forward thinking clients to create beautiful, honest and amazing things that bring positive results.
Supereffective
7 minutes ago near Alaska, USA John is world famous professional photographer. with forward thinking clients to create beautiful, honest and amazing things that bring positive results. John is world famous professional photographer. with forward thinking clients to create beautiful, honest and amazing things that bring positive results.
Steven
something.
Benn
woohaa


s6-rc
Software
skarnet.org
The s6-rc-bundle program
s6-rc-bundle is a tool to add or delete bundles from a compiled
service database without having to recompile it from source.
It is an offline tool, i.e. you can run it on any
compiled service database without actually having a live set
of services managed by s6-rc. However, if you do have a live
set, you can still run s6-rc-bundle on the current database (and
it is the default); it won't interfere with your normal service
operation.
Interface
s6-rc-bundle help
s6-rc-bundle [ -f ] [ -l live ] [ -c compiled ] [ -b ] add bundlename contents...
s6-rc-bundle [ -f ] [ -l live ] [ -c compiled ] [ -b ] delete bundlenames...
s6-rc-bundle [ -f ] [ -l live ] [ -c compiled ] [ -b ] multiple args...
- s6-rc-bundle expects to find a compiled service database
in compiled; by default it uses the service database
used by the live state in live.
- Depending on the arguments, it adds a bundle definition to this database, or
deletes a bundle definition from it, or performs multiple additions/deletions.
Options
- -c compiled : operate on a
compiled service database in compiled instead of
the current live one.
- -l live : assume the live
state is in live. This option is ignored if the
-c option has been given. Default is
/run/s6-rc. The default can be changed at package
compilation time, by giving the --livedir=live
option to ./configure.
- -f : force. s6-rc-bundle will not complain
when given a nonexisting name to delete (it will do nothing), or
when given an existing name to add (it will replace the definition).
By default, s6-rc-bundle will complain and exit when asked to delete a
nonexistent name or to add an existing name.
- -b : blocking lock. If the database is currently
being used by another program, s6-rc-bundle will wait until that
other program has released its lock on the database, then proceed.
By default, s6-rc-bundle fails with an error message if the database
is currently in use.
Exit codes
- 0: success
- 1: identifier already exists in service database
- 3: identifier not found in service database
- 4: invalid or corrupted service database
- 5: wrong identifier type for the given command
- 100: wrong usage
- 111: system call failed
Subcommands
s6-rc-bundle help
Prints a help message on stdout.
s6-rc-bundle add bundlename contents...
Adds a bundle named bundlename to the database, representing
the services listed in contents. The arguments in contents...
are resolved before the database is modified by the
s6-rc-bundle invocation.
s6-rc-bundle delete bundlenames...
Deletes bundles listed in bundlenames....
s6-rc-bundle multiple args...
Performs multiple bundle deletions and additions. This subcommand is best
used in an execline
script, because it uses
blocks.
args... is composed of:
- One block listing bundle names that will be
deleted from the database.
- Zero or more addition definitions, each of them composed of:
- One argument that is the name of the bundle to add
- One block listing the services contained in the
new bundle. The names in the block are resolved before any addition
or deletion is made to the database.


| Interface | Description |
|---|---|
| Binding<T> |
A
Binding calculates a value that depends on one or more sources. |
| NumberBinding |
A tagging interface to mark all Bindings that wrap a number-value.
|
| NumberExpression |
A
NumberExpression is a
ObservableNumberValue plus additional convenience
methods to generate bindings in a fluent style. |
| Class | Description |
|---|---|
| Bindings |
Bindings is a helper class with a lot of utility functions to create simple
bindings.
|
| BooleanBinding |
Base class that provides most of the functionality needed to implement a
Binding of a boolean value. |
| BooleanExpression |
A
BooleanExpression is a
ObservableBooleanValue plus additional convenience
methods to generate bindings in a fluent style. |
| DoubleBinding |
Base class that provides most of the functionality needed to implement a
Binding of a double value. |
| DoubleExpression |
A
DoubleExpression is a
ObservableDoubleValue plus additional convenience
methods to generate bindings in a fluent style. |
| FloatBinding |
Base class that provides most of the functionality needed to implement a
Binding of a float value. |
| FloatExpression |
A
FloatExpression is a
ObservableFloatValue plus additional convenience
methods to generate bindings in a fluent style. |
| IntegerBinding |
Base class that provides most of the functionality needed to implement a
Binding of an int value. |
| IntegerExpression |
A
IntegerExpression is a
ObservableIntegerValue plus additional convenience
methods to generate bindings in a fluent style. |
| ListBinding<E> |
Base class that provides most of the functionality needed to implement a
Binding of an ObservableList . |
| ListExpression<E> |
A
ListExpression is a
ObservableListValue plus additional convenience
methods to generate bindings in a fluent style. |
| LongBinding |
Base class that provides most of the functionality needed to implement a
Binding of a long value. |
| LongExpression |
A
LongExpression is a ObservableLongValue
plus additional convenience methods to generate bindings in a fluent style. |
| MapBinding<K,V> |
Base class that provides most of the functionality needed to implement a
Binding of an ObservableMap . |
| MapExpression<K,V> |
A
MapExpression is a
ObservableMapValue plus additional convenience
methods to generate bindings in a fluent style. |
| NumberExpressionBase |
A
NumberExpressionBase contains convenience methods to generate bindings in a fluent style,
that are common to all NumberExpression subclasses. |
| ObjectBinding<T> |
Base class that provides most of the functionality needed to implement a
Binding of an Object . |
| ObjectExpression<T> |
A
ObjectExpression is a
ObservableObjectValue plus additional convenience
methods to generate bindings in a fluent style. |
| SetBinding<E> |
Base class that provides most of the functionality needed to implement a
Binding of an ObservableSet . |
| SetExpression<E> |
A
SetExpression is a
ObservableSetValue plus additional convenience
methods to generate bindings in a fluent style. |
| StringBinding |
Base class that provides most of the functionality needed to implement a
Binding of a String . |
| StringExpression |
A
StringExpression is a
ObservableStringValue plus additional convenience
methods to generate bindings in a fluent style. |
| When |
Starting point for a binding that calculates a ternary expression.
|
Bindings are assembled from one or more sources, usually called their dependencies. A binding observes its dependencies for changes and updates its own value according to changes in the dependencies.
Almost all bindings defined in this library require
implementations of Observable
for their
dependencies. There are two types of implementations already provided,
the properties in the package javafx.beans.property
and the
observable collections (ObservableList
and
ObservableMap
). Bindings also implement
Observable
and can again serve as sources for other bindings
allowing to construct very complex bindings from simple ones.
Bindings in our implementation are always calculated lazily. That means, if a dependency changes, the result of a binding is not immediately recalculated, but it is marked as invalid. Next time the value of an invalid binding is requested, it is recalculated.
The Binding API is roughly divided in two parts, the High Level Binding API and the Low Level Binding API. The High Level Binding API allows to construct simple bindings in an easy to use fashion. Defining a binding with the High Level API should be straightforward, especially when used in an IDE that provides code completion. Unfortunately it has its limitation and at that point the Low Level API comes into play. Experienced Java developers can use the Low Level API to define bindings, if the functionality of the High Level API is not sufficient or to improve the performance. The main goals of the Low Level API are fast execution and small memory footprint.
Following is an example of how both APIs can be used. Assuming
we have four instances of DoubleProperty
a
, b
, c
, and d
, we can define a binding that calculates a*b
+ c*d
with the High Level API for example like this:
NumberBinding result = Bindings.add (a.multiply(b),
c.multiply(d));
Defining the same binding using the Low Level API could be done like this:
DoubleBinding foo = new DoubleBinding() {
{
super.bind(a, b, c, d);
}
@Override
protected double computeValue() {
return a.getValue() * b.getValue() + c.getValue() * d.getValue();
}
};
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2021, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


{% include chiptune-head.html %}
{% include chiptune-header.html %} {% include chiptune-about.html %} {% include chiptune-call-to-action.html %} {% include chiptune-footer.html %} {% include chiptune-scripts.html %}


The components of Atlas can be grouped under the following major categories:
Atlas core includes the following components:
Type System: Atlas allows users to define a model for the metadata objects they want to manage. The model is composed of definitions called ‘types’. Instances of ‘types’ called ‘entities’ represent the actual metadata objects that are managed. The Type System is a component that allows users to define and manage the types and entities. All metadata objects managed by Atlas out of the box (like Hive tables, for e.g.) are modelled using types and represented as entities. To store new types of metadata in Atlas, one needs to understand the concepts of the type system component.
One key point to note is that the generic nature of the modelling in Atlas allows data stewards and integrators to define both technical metadata and business metadata. It is also possible to define rich relationships between the two using features of Atlas.
Graph Engine: Internally, Atlas persists metadata objects it manages using a Graph model. This approach provides great flexibility and enables efficient handling of rich relationships between the metadata objects. Graph engine component is responsible for translating between types and entities of the Atlas type system, and the underlying graph persistence model. In addition to managing the graph objects, the graph engine also creates the appropriate indices for the metadata objects so that they can be searched efficiently. Atlas uses the JanusGraph to store the metadata objects.
Ingest / Export: The Ingest component allows metadata to be added to Atlas. Similarly, the Export component exposes metadata changes detected by Atlas to be raised as events. Consumers can consume these change events to react to metadata changes in real time.
Users can manage metadata in Atlas using two methods:
API: All functionality of Atlas is exposed to end users via a REST API that allows types and entities to be created, updated and deleted. It is also the primary mechanism to query and discover the types and entities managed by Atlas.
Messaging: In addition to the API, users can choose to integrate with Atlas using a messaging interface that is based on Kafka. This is useful both for communicating metadata objects to Atlas, and also to consume metadata change events from Atlas using which applications can be built. The messaging interface is particularly useful if one wishes to use a more loosely coupled integration with Atlas that could allow for better scalability, reliability etc. Atlas uses Apache Kafka as a notification server for communication between hooks and downstream consumers of metadata notification events. Events are written by the hooks and Atlas to different Kafka topics.
Atlas supports integration with many sources of metadata out of the box. More integrations will be added in future as well. Currently, Atlas supports ingesting and managing metadata from the following sources:
The integration implies two things: There are metadata models that Atlas defines natively to represent objects of these components. There are components Atlas provides to ingest metadata objects from these components (in real time or in batch mode in some cases).
The metadata managed by Atlas is consumed by a variety of applications for satisfying many governance use cases.
Atlas Admin UI: This component is a web based application that allows data stewards and scientists to discover and annotate metadata. Of primary importance here is a search interface and SQL like query language that can be used to query the metadata types and objects managed by Atlas. The Admin UI uses the REST API of Atlas for building its functionality.
Tag Based Policies: Apache Ranger is an advanced security management solution for the Hadoop ecosystem having wide integration with a variety of Hadoop components. By integrating with Atlas, Ranger allows security administrators to define metadata driven security policies for effective governance. Ranger is a consumer to the metadata change events notified by Atlas.


{{currentText}}
{{currentText}}
You have no recorded tasks yet
{{task.date}}
{{task.note}}
{{task.ftime}}
{{task.fpause}}


Nothing Found
There's nothing matching the description you're looking for, try a different keyword.
Top Questions
Customers Ask These OftenIf we skipped a question be sure to send us a support question, we're always here to answer your questions.
What are Buffer Overflows?Buffer overflow vulnerability affects the web applications that require user input. When the input that is sent to the application is more than the buffer capacity and the buffers are left unchecked, buffer overflow occurs
Application firewalls analyze the requests at the application level. These firewalls are used for specific applications like a web server or a database server. The web application firewalls protect the web server from HTTP based attacks.
Application Hardening and Shielding is a set of technologies that typically modify an application’s binary code to make it more resistant to reverse-engineering, tampering, invasive monitoring and intrusion. Enterprises harden their applications to protect their software assets and the data touched by the application.
There are chances that the information is modified before it reaches the server. Attackers browsing the site can manipulate the information in a GET or POST request. Although the client and the server may be trusted, we cannot be sure that the information is not modified after it leaves the browser. Attackers can capture the information on the way and manipulate it.


libsocket++ is an object-oriented wrapper around libsocket. To avoid writing the code twice and maintain it twice, libsocket++ calls the functions from libsocket.
libsocket++ uses the namespace libsocket
, so you either have to construct the classes like this:
libsocket::inet_stream sock;
or use some things or the whole namespace:
using namespace libsocket;
(for the internet TCP client socket class)
using libsocket::inet_stream;
The header files are located in headers/; you just have to include the header file of the class(es) you're using. It will
include all header files needed for it to work. E.g.: If you use inet_stream
, you just include inetclientstream.hpp
, but you
don't have to include inetbase.hpp
, socket.hpp
, exception.hpp
and so on.
Build and install the library as described in the README file.
If you want to build a stand-alone binary without the need to link against the libsocket shared object, you may compile libsocket into your application (the license permits this), but there are some pitfalls.
To reduce the size of the executables, it is recommended to compile your code only with that library files which are actually necessary. For example, if you have a program which serves as client for a UDP based application:
$ g++ -o client client.cpp /path/to/libsocket/C/libinetsocket.c /path/to/libsocket/C++/{socket,inetbase,inetdgram,inetclientdgram}.cpp
The class hierarchy is quite complex. You may take a look at it by viewing classes.svg
in this directory or the
Doxygen inheritance diagrams for the socket
class.
The classes have (in general) names made of three components: <domain>_<protocol>_<role>
: E.g. unix_stream_server
or inet_dgram_client
.
However, there's one exception: The TCP internet client class is called inet_stream
.
The files use another schema: <domain><role><protocol>.(c|h)pp
, e.g. inetclientstream.cpp
for the class inet_stream_client
.
Among this classes, there are many other classes. In the diagram, this classes are the white boxes. It makes no sense to instantiate objects from this classes although it's possible (they aren't abstract).
Defined in exception.cpp
, has to be included from exception.hpp
struct socket_exception
{
int err; // errno at throw time (usually set by a crashing syscall in the underlying libsocket)
std::string mesg; // Error message from libsocket++
socket_exception(std::string,int,std::string);
};
A socket_exception
object is thrown in case of error. Almost every function may raise an exception containing a std::string looking like this:
../C++/inetclientstream.cpp:167: <<(std::string) output: Socket not connected!
(1) (2) (3) (4)
It contains information about the file (1), the line (2), the function throwing the exception (3) and information about the cause for the exception (4) - here, a program tried to write to a TCP connection which did not exist at that time.
Example for error handling:
try {
sock << "test";
} catch (libsocket::socket_exception exc)
{
std::cerr << exc.mesg << " errno code: " << exc.err;
}
Machine-readable information about errors are placed in the errno
variable. Possible values are described in the
man pages of the underlying system calls.
libinetsocket++ is the wrapper around libinetsocket.
inet_stream
Class: Internet TCP Client Stream SocketsDeclared in inetclientstream.hpp
, defined in inetclientstream.cpp
Please note that the name is not inet_stream_client
!
1: inet_stream(void);
2: inet_stream(const char* host, const char* port, int proto_osi3, int flags=0);
3: inet_stream(const std::string& dsthost, const std::string& dstport, int proto_osi3, int flags=0);
1: Only initializes the most important things. The socket remains unconnected and must be connected before use using connect()
.
2,3: The constructor initializes the socket and connects it with the given host:
host
: Destination host; if you have the host as std::string
, use its routine std::string::c_str()
to get
the C stringport
: Destination port (TCP, of course); conversion from string like above.proto_osi3
: LIBSOCKET_IPv4
, LIBSOCKET_IPv6
or LIBSOCKET_BOTH
(LIBSOCKET_BOTH
lets the library choose (decision based on DNS response; cpp macros; defined in header file inetbase.hpp
)flags
: Default 0, can be SOCK_NONBLOCK
or SOCK_CLOEXEC
(see: socket(2)
; it must be 0 on other platforms than Linux to avoid errors)connect()
Declared in inetclientstream.hpp
, defined in inetclientstream.cpp
void connect(const char* host, const char* port, int proto_osi3, int flags=0);
void connect(const string& dsthost, const string& dstport, int proto_osi3, int flags);
Connects the socket. Throws an exception if the socket is already connected. May be called after a destroy()
call to re-connect the socket.
host
: Destination host; if you have the host as std::string
, use its routine std::string::c_str()
to get
the C stringport
: Destination port (TCP, of course); conversion from string like above.proto_osi3
: LIBSOCKET_IPv4
or LIBSOCKET_IPv6
(pp macros; defined in header file inetsocket.hpp
)flags
: Default 0, can be SOCK_NONBLOCK
or SOCK_CLOEXEC
(see: socket(2)
; on other platforms than Linux
has to be 0 to avoid errors)Note: This function does actually more than only connect the socket. Because of some internal requirements (the void constructor, libinetsocket design), this function also *creates the socket.*
shutdown()
Declared in streamclient.hpp
, defined in streamclient.cpp
, inherited from stream_client_socket
void shutdown(int method);
Shuts the socket down (shutdown(2)
). If you shut it down using the method LIBSOCKET_WRITE
, the peer receives an EOF
on his socket and you may not write to the socket anymore. If you shut it down using LIBSOCKET_READ
, you may not read anymore from the socket.
method
is LIBSOCKET_READ
, LIBSOCKET_WRITE
, or the ORed combination, LIBSOCKET_READ|LIBSOCKET_WRITE
. LIBSOCKET_READ
and LIBSOCKET_WRITE
are defined in streamclient.hpp
Declared in socket.hpp
, defined in socket.cpp
, inherited from socket
int destroy(void);
Closes the socket and destroys the connection. After a call to destroy()
, you may connect the socket object again using connect()
.
Return value 0 if successful, otherwise -1.
Inherited from stream_client_socket
(defined in streamclient.cpp
)
ssize_t snd(const void* buf, size_t len, int flags=0);
Conventional send function: Send the content of buf
, which is len
bytes long, to
the connected host. flags
may be specified using the values allowed on your platform.
The flags available may be found in send(2)
(the flags beginning with with MSG_
)
Returns the number of sent bytes or throws an exception if an error occurred.
friend inet_stream& operator<<(inet_stream& sock, const char* str);
friend inet_stream& operator<<(inet_stream& sock, std::string& str);
Now, it gets interesting: The class inet_stream
imitates the behaviour of
the standard C++ streams (ostream
, ofstream
etc.). You may write to the
connected socket using the overloaded bitshift operator. It is overloaded for
C strings (const char*
, you may also use char*
) and C++ strings (std::string
).
As you can see at the return value, you may cascade it (from examples++/http.c
):
sock << request1 << request2;
Throws exceptions e.g. if the socket is not connected or write(2)
returned -1.
Inherited from stream_client_socket
(defined in streamclient.cpp
)
ssize_t rcv(void* buf, size_t len, int flags=0);
Conventional receive function: Receive len
bytes from socket and write them to buf
.
flags
may be specified and may take the flags specified in recv(2)
(those beginning with MSG_
)
friend inet_stream& operator>>(inet_stream& sock, std::string& dest);
Stream-like read from socket: Reads at most dest.size()
bytes from socket and puts them to the string. If less than
dest.size()
characters could be read, the string is resized to the number of read characters so you can check
(string.empty()
) if the server is done with sending - either closed the socket on his side or shut it down for write access.
Declared in inetbase.hpp
, defined in inetbase.cpp
std::string gethost(void) const;
std::string getport(void) const;
gethost()
returns a C++ std::string containing the host to which the socket is connected.
getport()
returns a C++ std::string containing the port/service to which the socket is connected.
inet_stream_server
- TCP Internet serverDeclared in inetserverstream.hpp
, defined in inetserverstream.cpp
inet_stream_server(void);
inet_stream_server(const char* bindhost, const char* bindport, int proto_osi3, int flags=0);
inet_stream_server(const std::string& bindhost, const std::string& bindport, int proto_osi3, int flags=0);
Create an internet tcp server (passive) socket.
If you use the first constructor, you have to setup()
the socket before using it. The latter constructors binds the
socket to bindhost:bindport
using proto_osi3
(IPv4
or IPv6
or BOTH
).
flags
are supplied to the internal socket(2)
call.
setup()
void setup(const char* bindhost, const char* bindport, int proto_osi3, int flags=0);
void setup(const std::string& bindhost, const std::string& bindport, int proto_osi3, int flags=0);
If you used the void
-Constructor, you have to setup the server socket to bind it, set it in listening state etc.
Setup is done with this function (which is quite similar to the constructors). You also may use this function if you
close(2)
d the socket and want to reuse it.
accept()
Declared in inetserverstream.hpp
, defined in inetserverstream.cpp
inet_stream* accept(int numeric=0,int accept_flags=0);
Accept an incoming connection. numeric
may be NUMERIC
if you want to have the host and port as numbers.
accept_flags
are passed to accept4()
.
Returns a pointer to a dynamically allocated inet_stream
object. Returns NULL if the server socket is marked as
NONBLOCKing and there is no connection to accept.
Declared in socket.hpp
, defined in socket.cpp
int destroy(void);
Closes the socket and destroys the connection. After a call to destroy()
, you may re-bind the server socket
object again using setup()
.
Return value 0 if successful, otherwise -1.
 The sockets are also destroyed when
the destructor of socket
(virtual, of course) is called.
Declared in inetbase.hpp
, defined in inetbase.cpp
std::string gethost(void) const;
std::string getport(void) const;
gethost()
returns a C++ std::string containing the host to which the socket is bound.
getport()
returns a C++ std::string containing the port/service to which the socket is bound.
inet_dgram_client
Class: Internet UDP SocketsDeclared in inetclientdgram.hpp
, defined in inetclientdgram.cpp
inet_dgram_client(int proto_osi3, int flags=0); // Flags: socket()
inet_dgram_client(const char* host, const char* port, int proto_osi3, int flags=0); // Flags: socket()
inet_dgram_client(const std::string& dsthost, const std::string& dstport, int proto_osi3, int flags=0);
Because the UDP socket can be connected multiple times and send data to various hosts,
it's mandatory to specify the address family at instantiation time. proto_osi3
may be
IPv4
or IPv6
or this information is used to create a socket with create_inet_dgram_client_socket()
which uses socket(2)
.
The second form allows to specify a host and a port to which the UDP socket is connected.
If an UDP socket is connected, calls to snd()
and rcv()
act like on a stream socket;
in this case the data is sent and received only to/from the host to which the socket is connected.
Here, proto_osi3
may be IPv4
, IPv6
or BOTH
(in the latter case, get_address_family()
is used to obtain the address family);
void setup(int proto_osi3, int flags=0);
void setup(const char* dsthost, const char* dstport, int proto_osi3, int flags=0);
void setup(const string& dsthost, const string& dstport, int proto_osi3, int flags=0);
Work like the constructors and only if the socket has been closed before.
Declared in inetclientdgram.hpp
, defined in inetclientdgram.cpp
void connect(const char* host, const char* port);
void connect(const std::string& dsthost, const std::string& dstport);
(Re)connects the socket to the specified host/port. If you want to change the address family, you have to create another socket.
void deconnect(void);
Cut the connection to the host to which the socket was connected to. Now, stream-like
functions like snd()
or rcv()
may not be used anymore.
Declared in socket.hpp
, defined in socket.cpp
int destroy(void);
0: Success, -1: Error (the only errors at close()
come if the file descriptor has been closed already). After close()
, you may call setup()
to re-set-up the socket instance.
Defined in dgramclient.cpp
(Inherited from dgram_client_socket
)
ssize_t snd(const void* buf, size_t len, int flags=0); // flags: send()
Conventional send, only available if socket is connected.
Send len
bytes from buf
(does not need to be const
; in C++ an implicit conversion to const is allowed)
to the connected peer. flags
may be specified and take the flags described in send(2)
(MSG_...
).
Defined in inetdgram.cpp
, inherited from inet_dgram
1: ssize_t sndto(const void* buf, size_t len, const char* host, const char* port, int sndto_flags=0);
2: ssize_t sndto(const void* buf, size_t len, const std::string& host, const std::string& port, int sndto_flags=0)
3: ssize_t sndto(const std::string& buf, const std::string& dsthost, const std::string& dstport, int sndto_flags=0);
1, 2: Send len
bytes from buf
to host
:port
. sndto_flags
may be specified and take the flags described
in sendto(2)
(MSG_...
).
3: Send buf
to dsthost:dstport
.
friend dgram_client_socket& operator<<(dgram_client_socket& sock, const char* str);
friend dgram_client_socket& operator<<(dgram_client_socket& sock, std::string& str);
Only for connected sockets. Send either a std::string or a (NULL terminated!!!) C string to the connected peer. Usage like streams:
sock << "abc" << std::string("def");
Defined in dgramclient.cpp
(inherited from dgram_client_socket
)
ssize_t rcv(void* buf, size_t len, int flags=0);
Conventional receive function: Receive len
bytes from the socket and write them to buf
. flags
may take the
flags described in recv(2)
(MSG_...
). Only available if socket is connected!
Defined in inetdgram.cpp
, inherited from inet_dgram
1: ssize_t rcvfrom(void* buf, size_t len, char* host, size_t hostlen, char* port, size_t portlen, int rcvfrom_flags=0, bool numeric=false);
2: ssize_t rcvfrom(void* buf, size_t len, std::string& srchost, std::string& srcport, int rcvfrom_flags=0, bool numeric=false);
3: ssize_t rcvfrom(std::string& buf, std::string& srchost, std::string& srcport, int rcvfrom_flags=0, bool numeric=false);
1: Receive len
bytes from the socket and place them in buf
. The source host is placed in host
, which is at least
hostlen
bytes long, the source port gets written to port
, which is at least portlen
bytes long. recvfrom_flags
can take the flags described in recvfrom(2)
, numeric
is considered as false
, but if you specify it as
true
, source host and source port are expressed in numerical form. This is recommended because it's faster
than an additional (internal) rDNS query.
2: Same as form 1, but use strings. The strings are resized to the appropriate length of host and port.
3: Same as form 2, but place the data to buf
. This method receives at most buf.size()
bytes.
friend dgram_client_socket& operator>>(dgram_client_socket& sock, std::string& dest);
Stream-like read from (connected!) socket: Reads at most dest.size()
bytes from socket and puts them to the string. If less than dest.size()
characters could be read, the string is resized to
the number of read characters.
Declared in inetbase.hpp
, defined in inetbase.cpp
, inherited from inet_socket
std::string gethost(void) const;
std::string getport(void) const;
gethost()
returns a C++ std::string containing the host to which the socket is connected (if it is connected!)
getport()
returns a C++ std::string containing the port/service to which the socket is connected (if it is!).
Defined in dgramclient.cpp
, inherited from dgram_client_socket
bool getconn(void) const;
getconn()
returns a boolean value which specifies if the socket is connected (true) or not (false).
inet_dgram_server
- INET DGRAM server socketsDeclared in inetserverdgram.hpp
, defined in inetserverdgram.hpp
.
inet_dgram_server(const char* host, const char* port, int proto_osi3, int flags=0);
inet_dgram_server(const std::string& host, const std::string& port, int proto_osi3, int flags=0);
Create and bind a DGRAM socket to host:port
. The only difference to inet_dgram_client
is that this socket is
explicitly bound to somewhere and that you may not connect this socket.
host
to bind toport
to bind toproto_osi3
- IPv4 IPv6 BOTH
flags
is passed to socket(2)
It is not possible to call connect(), rcv(), snd()
on such sockets; the rcvfrom(), sndto()
functions may be called, of course.
Defined in inetserverdgram.cpp
void setup(const char* host, const char* port, int proto_osi3, int flags=0);
void setup(const string& host, const string& port, int proto_osi3, int flags=0);
(Re-)Set up the socket (arguments are the same as in the constructors).
Defined in inetdgram.cpp
, inherited from inet_dgram
1: ssize_t sndto(const void* buf, size_t len, const char* host, const char* port, int sndto_flags=0);
2: ssize_t sndto(const void* buf, size_t len, const std::string& host, const std::string& port, int sndto_flags=0)
3: ssize_t sndto(const std::string& buf, const std::string& dsthost, const std::string& dstport, int sndto_flags=0);
Send the data in buf
to host:port
.
Defined in inetdgram.cpp
, inherited from inet_dgram
1: ssize_t rcvfrom(void* buf, size_t len, char* host, size_t hostlen, char* port, size_t portlen, int rcvfrom_flags=0, bool numeric=false);
2: ssize_t rcvfrom(void* buf, size_t len, std::string& srchost, std::string& srcport, int rcvfrom_flags=0, bool numeric=false);
3: ssize_t rcvfrom(std::string& buf, std::string& srchost, std::string& srcport, int rcvfrom_flags=0, bool numeric=false);
1, 2: Receive at most len
bytes from the socket and place them in buf
. The source host is placed in host
, which is
at least hostlen
bytes long, the source port gets written to port
, which is at least portlen
bytes long. recvfrom_flags
can take the flags described in recvfrom(2)
, numeric
is considered as false
, but if you specify it as true
,
source host and source port are expressed in numerical form. This is recommended because it's faster than an additional
(internal) rDNS query.
3: Receive at most buf.size()
bytes and place them to buf
. buf
is resized to the number of received bytes if the
function received less than buf.size()
bytes.
Declared in inetbase.hpp
, defined in inetbase.cpp
std::string gethost(void) const;
std::string getport(void) const;
gethost()
returns a C++ std::string containing the host to which the socket is bound.
getport()
returns a C++ std::string containing the port/service to which the socket is bound.
Declared in socket.hpp
, defined in socket.cpp
int destroy(void);
0: Success, -1: Error (the only errors at close()
occur if the file descriptor has been closed already).
After destroy()
, it's possible to "re-activate" the socket by calling setup()
.
libunixsocket++ is the UNIX domain socket part of libsocket++. The class tree is described above and in classes.svg
.
unix_stream_client
Defined in unixclientstream.cpp
unix_stream_client(void);
unix_stream_client(const char* path, int socket_flags=0);
unix_stream_client(const std::string& path, int socket_flags=0);
Create a new unix domain stream client socket. The second and the third form connect the socket immediately to path
.
If you use the first form, you have to connect()
your socket before using it. socket_flags
are flags for the socket(2)
syscall.
connect()
Defined in unixclientstream.cpp
void connect(const char* path, int socket_flags=0);
void connect(const std::string& path, int socket_flags=0);
Connect the socket to path
. socket_flags
are given to socket(2)
. You may use this only on unconnected sockets,
i.e. a socket constructed with the non-argument constructor or a socket on which you called before destroy()
.
shutdown()
Defined in streamclient.cpp
, inherited from stream_client_socket
void shutdown(int method=LIBSOCKET_WRITE);
Shuts the socket down (shutdown(2)
). If you shut it down using the method LIBSOCKET_WRITE
, the peer receives an
EOF
on his socket and you may not write to the socket anymore. If you shut it down using LIBSOCKET_READ
, you may
not read anymore from the socket.
Using LIBSOCKET_READ|LIBSOCKET_WRITE
(bitwise OR) shuts the socket completely down.
snd() rcv()
Defined in streamclient.cpp
, inherited from stream_client_socket
1: ssize_t snd(const void* buf, size_t buflen, int send_flags=0);
2: ssize_t rcv(void* buf, size_t len, int recv_flags=0);
1: Send the data in buf
which is buflen
bytes to the connected peer. send_flags
is passed to send(2)
.
2: Receive buflen
bytes from the connected peer and store them in buf. recv_flags
is passed to recv(2)
.
Defined in streamclient.cpp
, inherited from stream_client_socket
friend stream_client_socket& operator<<(stream_client_socket& sock, const char* str);
friend stream_client_socket& operator<<(stream_client_socket& sock, std::string& str);
friend stream_client_socket& operator>>(stream_client_socket& sock, std::string& dest);
Like the normal file stream operators. unix_stream_client
is a child of `streamclientsocket´.
Output ("upload") works for strings and legacy C strings, input ("download") only for C++ strings.
The download function reads at most dest.size()
bytes from the socket. If it reads less,
the string is resized to the new length, 0 if the peer shut its socket down or closed the connection.
SO RESIZE YOUR STRINGS BEFORE DOWNLOADING DATA!
Defined in unixbase.cpp
, inherited from unix_socket
string get_path(void);
Get the peer socket path (to which the socket is connected).
int destroy(void);
Call close()
on the underlying file descriptor. If you call now connect()
on the socket, you may exchange data again.
unix_stream_server
Defined in unixserverstream.cpp
unix_stream_server(void);
unix_stream_server(const char* path, int flags=0);
unix_stream_server(const std::string& path, int flags=0);
Create a unix domain SOCK_STREAM server socket which is bound to path
. flags
are passed to socket(2)
.
If you use the void
constructor, you have to setup()
your socket before using it.
setup()
Defined in unixserverstream.cpp
void setup(const char* path, int flags=0);
If the socket was not set up with a constructor, you have to call this function before using the new socket.
The server socket is bound to path
, and flags
are passed to socket(2)
.
accept()
Defined in unixserverstream.cpp
unix_stream_client* accept(int flags=0);
Accept a new connection on the socket. flags
are passed to accept4(2)
. Returns a pointer to a dynamically allocated
unix_stream_client
object. It's recommended, especially for long-running applications, to call delete
on this pointer
when it isn't needed anymore.
Defined in unixbase.cpp
, inherited from unix_socket
string get_path(void);
Get the socket path (to which the socket is bound).
int destroy(void);
Call close()
on the underlying file descriptor. You may work with the socket again after calling setup()
.
unix_dgram_client
Defined in unixclientdgram.cpp
unix_dgram_client(int flags=0);
unix_dgram_client(const char* path, int flags=0);
unix_dgram_client(const std::string& path, int flags=0);
Create a UNIX DGRAM socket. If you use the second or third constructor, bind it additionally to path.
Defined in unixclientdgram.cpp
void setup(const char* path, int flags=0);
Sets up the socket like the constructor, but only if it is not set up yet.
connect()
, deconnect()
Defined in unixclientdgram.cpp
void connect(const char* path);
void connect(const std::string& path);
Connect the DGRAM socket to the specified path. You may call snd()
or rcv()
on a UNIX DGRAM socket if it's connected.
void deconnect(void);
Disconnect the DGRAM socket. (Connect it to NULL).
Inherited from dgram_client_socket
(dgramclient.cpp
)
friend dgram_client_socket& operator<<(dgram_client_socket& sock, const char* str);
friend dgram_client_socket& operator<<(dgram_client_socket& sock, std::string& str);
friend dgram_client_socket& operator>>(dgram_client_socket& sock, std::string& dest);
ssize_t snd(const void* buf, size_t len, int flags=0); // flags: send()
ssize_t rcv(void* buf, size_t len, int flags=0);
Inherited from unix_dgram
(unixdgram.cpp
)
ssize_t sndto(const void* buf, size_t length, const char* path, int sendto_flags=0);
ssize_t sndto(const void* buf, size_t length, const std::string& path, int sendto_flags=0);
ssize_t sndto(const std::string& buf, const std::string& path, int sendto_flags=0);
ssize_t rcvfrom(void* buf, size_t length, char* source, size_t source_len, int recvfrom_flags=0);
ssize_t rcvfrom(void* buf, size_t length, std::string& source, int recvfrom_flags=0);
ssize_t rcvfrom(std::string& buf, std::string& source, int recvfrom_flags=0);
Defined in unixbase.cpp
, inherited from unix_socket
string get_path(void);
Get the peer socket path (to which the socket is connected, if it's connected). If the socket is not connected, an empty string is returned.
Defined in dgramclient.cpp
, inherited from dgram_client_socket
bool getconn(void)
getconn()
returns a boolean value which specifies if the socket is connected (true) or not (false).
int destroy(void);
Call close()
on the underlying file descriptor. You may work with the socket again after calling setup()
.
unix_dgram_server
Defined in unixserverdgram.cpp
unix_dgram_server(void);
unix_dgram_server(const char* bindpath, int socket_flags=0);
unix_dgram_server(const std::string& bindpath, int socket_flags=0);
unix_dgram_server
is quite similar to unix_dgram_client
, especially if bound. The important difference is that
you may not call connect()
on unix_dgram_server
.
Defined in unixserverdgram.cpp
void setup(const char* bindpath, int socket_flags=0);
void setup(const string& bindpath, int socket_flags=0);
Works like the constructors, but only if the socket is not set up yet.
Defined in unixdgram.cpp
ssize_t sndto(const void* buf, size_t length, const char* path, int sendto_flags=0);
ssize_t sndto(const void* buf, size_t length, const std::string& path, int sendto_flags=0);
ssize_t sndto(const string& buf, const string& path, int sendto_flags=0);
ssize_t rcvfrom(void* buf, size_t length, char* source, size_t source_len, int recvfrom_flags=0);
ssize_t rcvfrom(void* buf, size_t length, std::string& source, int recvfrom_flags=0);
ssize_t rcvfrom(string& buf, string& source, int recvfrom_flags=0);
Defined in unixbase.cpp
, inherited from unix_socket
string get_path(void);
Get the socket path (to which the socket is bound).
int destroy(void);
Call close()
on the underlying file descriptor. You may work with the socket again after calling setup()
.
selectset
class selectset(void)
The selectset
class makes the use of multiple sockets at once easy. It is implemented as template class, this means you
have to specify a socket class as parameter. This is fine as long as you just select between multiple sockets of one type; however,
if you want to use select on different socket types, you have to specify any shared superclass of the sockets, that is in most cases
socket
.
template<typename SocketT>
void add_fd(const SocketT& sock, int method);
First, add just any socket class derived from socket
to the new set. Do this multiple times if you have more
than one socket (which is likely). method
is either LIBSOCKET_READ
or LIBSOCKET_WRITE
, so if you want
to be notified if some socket is ready to be read from it, specify LIBSOCKET_READ
. LIBSOCKET_READ
must also be
specified for server sockets.
template<typename SocketT>
std::pair<std::vector<SocketT*>, std::vector<SocketT*> > wait(long long microsecs=0);
Then call wait()
. The argument is a timeout in microseconds after that the function returns, defaulting to 0 (infinite).
The return type is a std::pair
consisting of two vectors of socket pointers. Don't panic, there's a typedef in select.hpp
:
namespace libsocket {
class selectset {
typedef std::pair<
std::vector<libsocket::socket*>, // Sockets ready for reading
std::vector<libsocket::socket*> // Sockets ready for writing.
> ready_socks;
}
}
If a socket is ready for both reading and writing, it may be a member of both vectors vector.
A typical program snippet using this class could look like this example:
inet_stream sock1("spheniscida.de","80",IPv6);
inet_stream sock2("spheniscida.de","25",IPv6);
selectset<inet_stream> socks;
socks.add_fd(sock1,LIBSOCKET_WRITE);
socks.add_fd(sock2,LIBSOCKET_READ);
selectset<inet_stream>::ready_socks rs = socks.wait();
// In case both sockets became available.
inet_stream* ready_http_sock = rs.second[0];
inet_stream* ready_smtp_sock = rs.first[0];
// Do something with the sockets...


Chapter 2 Introduction to R
Before starting out, it’s worth mentioning that R has a steep learning curve compared to other statistical softwares. While there are tons of blog posts as to why you should learn R, I will keep my list quick so if you get discouraged at any point, you can come back to this list and get re-inspired before R starts paying you back.
- The R community is fantastic, check out #rstats on Twitter as well as everyone affiliated with the tidyVerse
- R will always be free because the people behind it believe in open source principles.
- Time spent learning R is time spent learning how computers work. If you learn about R, you are also learning computer programming. Time spent in something like SPSS or SAS does not easily transfer to other programs.
- On r-jobs.com the way they decide to split jobs is jobs that make above and below $100,000.
- R is your ticket out of academia, if you need it. It’s also insane to think people would learn so much about statistics, the hardest part about becoming a data scientist, without learning the software to get you in the door.
- When you make analyses and graphs in R they are very easy to reproduce. You just press ‘Run’ again.
- If you do your data cleaning in R, then each step is documented. There is less chance for human error.
- It makes gorgeous graphs.
- There are a lot of ways that R integrates into other software. This book is written in bookdown, my website is written in blogdown, you can also make interactive data applications.
- It’s kind of fun.
2.1 Getting Started
Since this book is about statistics and R, the introduction to all things R is a bit shorter than other guides. If you need help, find a friend (or email the author of this book) and they will get you started. The first things you need to do is download R from CRAN, then get the latest version of RStudio. RStudio is an IDE that makes working in R a lot easier. If you use R without RStudio, you are basically a masochist.
Once you have that, you can start to play around with this.
2.2 A Note on Setting the Working Directory
At the end a long writing session you normally have to find a place to save that journal article you are working on. You do this by clicking ‘Save As’ then finding where to stick it and what to call it. If you are programming you need to do this entire act of picking where you are working right away by saving your script (the what) and setting your working directory (the where). After running a couple of “teach yourself R” sessions, I have found that this concept is one of the most tedious parts of starting to learn R, but once you are over this hump, the others will not feel as bad. While these instructions below are meant to be comprehensive, it’s much easier to learn this part of the process with someone walking you through the steps.
When you first open R, it’s good to get in the habit of seeing where your working directory is set to. If RStudio is set on it’s default settings, there should be a little line right above the console just like the image below.
This whole book exists in a folder that lives in the projects folder on my Desktop. If you’re not familiar with how your computer is set up, it’s worth checking out an explanation or having someone walk you through the hierarchy your computer’s directories.
Once you have an basic understanding of this, you can find where you are in R by using the getwd()
function.
If you need to change your working directory at any point, the function is setwd()
.
While it might seem a bit tedious to have to think about things like this right away, by setting up analysis projects in a clean, and organized way you are going to be saving yourself hours in the future.
So with that, open up a new R script, and for your first line set your working directory to a folder where you are going to want to work out of.
2.3 The Basics
With this script set up, we can now start to play around with R! This chapter covers a few basic things:
- The rationale behind to writing scripts and code
- R as Calculator
- Data Structures
- Manipulating Data
- Tons of functions
- Whirlwind tour of R for psychologists
The goals of this chapter are to:
- Learn Basics of R and RStudio
- Practice concepts with simple examples
- Familiarize with vast array of functions
- Have vocabulary and “R” way to think about problem solving
2.4 R as Calculator
The Console of R is where all the action happens. You can use it just like you would use a calculator. Try to do some basic math operations in it.
## [1] 4
## [1] 3
## [1] 2.5
## [1] 1800
## [1] 9
## [1] TRUE
## [1] FALSE
You don’t always want to print your output and retype it in. The idea of being a good programmer is to be very lazy (efficient).
One of the best ways to be efficient when programming is to save variables to objects.
Below is some example code that uses the <-
operator to assign some math to an object.
After you assign it to an object, you can then manipulate it like you would any other number.
## [1] 36
After running these two lines of code, notice what has popped up in your environment in RStudio!
You should see that you now have any object in the Environment called foo
.
In addition to saving single values to objects, you can also store a collection of values. Below we use an example that might have a bit more meaning, the below stores what could be some data into an object that represents what it might be.
The way that the line above works is that we use the c()
function (c for concatenate) to group together a bunch of the same type of data (numbers) into a vector.
Once we have everything concatenated and stored into an object, we can then manipulate all the numbers in the object just like we did above with a single number.
For example, we could multiply all the numbers by three.
## [1] 6 3 12 15 18 21 9 6 12 15 9
Or maybe we realized that our inputs were wrong and we need to shave off two years off of each of the entries.
## [1] 0 -1 2 3 4 5 1 0 2 3 1
Or perhaps we want to find out which of our pieces of data (and other data associated with that observation) are less than 2.
 In addition to treating it like a mathematical operation, we can also run functions on objects. By looking at the name of each function and it’s output, take a guess at what each of the below functions does.
## [1] 3.818182
## [1] 1.834022
## [,1]
## [1,] -0.99136319
## [2,] -1.53661295
## [3,] 0.09913632
## [4,] 0.64438608
## [5,] 1.18963583
## [6,] 1.73488559
## [7,] -0.44611344
## [8,] -0.99136319
## [9,] 0.09913632
## [10,] 0.64438608
## [11,] -0.44611344
## attr(,"scaled:center")
## [1] 3.818182
## attr(,"scaled:scale")
## [1] 1.834022
## [1] 1 7
## [1] 1
## [1] "numeric"
## num [1:11] 2 1 4 5 6 7 3 2 4 5 ...
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.000 2.500 4.000 3.818 5.000 7.000
Often working with data, we don’t want to just play with one group of numbers. Most of the time we are trying to compare diffrent observations in psychology. If we then create two vectors (one of which we have already made!) and then combine them together into a data frame, we have something sort of looking like a spreadsheet.
yearsInGradSchool <- c(2,1,4,5,6,7,3,2,4,5,3)
classesTaken <- c(5,2,5,7,9,9,2,8,4,7,2)
gradData <- data.frame(yearsInGradSchool,classesTaken)
gradData
## yearsInGradSchool classesTaken
## 1 2 5
## 2 1 2
## 3 4 5
## 4 5 7
## 5 6 9
## 6 7 9
## 7 3 2
## 8 2 8
## 9 4 4
## 10 5 7
## 11 3 2
Now if we wanted to use something like R’s correlation function we could just pass in the two objects that we have like this and get a correlation value.
## [1] 0.6763509
But often our data will be saved in data frames and we need to be able to access one of our vectors inside our data frame.
To access a piece of information in a data frame we use the $
operator.
## [1] 2 1 4 5 6 7 3 2 4 5 3
Running the above code will print out the vector called yearsInGradSchool
from the data frame gradData
.
Using this form, we can then use this with the correrlation function.
## [1] 0.6763509
In addition to just getting numeric output, we also want to be able to look at our data. Take a look at the code below and try to figure out what the function call is, as well as what each argument (or thing you pass to a function) does.
plot(yearsInGradSchool,classesTaken,
data = gradData,
main = "My Plot",
xlab = "Years in Grad School",
ylab = "Classes Taken")
## Warning in plot.window(...): "data" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "data" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "data" is not
## a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "data" is not
## a graphical parameter
## Warning in box(...): "data" is not a graphical parameter
## Warning in title(...): "data" is not a graphical parameter
If you are having a hard time understanding arguments, one thing that might help to think about is that each argument is like a click in a software program like SPSS.
Imagine you want to make the same plot with this data in SSPSS, what would you do?
The first thing you would do is to go to the top of the bar and find the Plot
function and click it.
This is the same as typing out plot()
in R.
Then you would have to tell that new pop up screen what two variables you want to plot and click on the related variables.
Dragging and dropping those variables into your plot builder is the same as just typing out the variables you want.
Laslty you want to put names on your axes and a title on your plot.
The same logic would follow.
We’ll explore these ideas a bit more in the next section.
2.5 Data Exploration
## 'data.frame': 150 obs. of 5 variables:
## $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
## $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
## $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
## $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
## $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...

What would the follow commands do?
2.6 Indexing
Let’s combine logical indexing with creating new objects.
What do the follow commands do? Why?
## [1] 5.1
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 2 4.9 3 1.4 0.2 setosa
## Sepal.Length.scale
## 2 -1.1392
## [1] setosa setosa setosa setosa setosa setosa
## [7] setosa setosa setosa setosa setosa setosa
## [13] setosa setosa setosa setosa setosa setosa
## [19] setosa setosa setosa setosa setosa setosa
## [25] setosa setosa setosa setosa setosa setosa
## [31] setosa setosa setosa setosa setosa setosa
## [37] setosa setosa setosa setosa setosa setosa
## [43] setosa setosa setosa setosa setosa setosa
## [49] setosa setosa versicolor versicolor versicolor versicolor
## [55] versicolor versicolor versicolor versicolor versicolor versicolor
## [61] versicolor versicolor versicolor versicolor versicolor versicolor
## [67] versicolor versicolor versicolor versicolor versicolor versicolor
## [73] versicolor versicolor versicolor versicolor versicolor versicolor
## [79] versicolor versicolor versicolor versicolor versicolor versicolor
## [85] versicolor versicolor versicolor versicolor versicolor versicolor
## [91] versicolor versicolor versicolor versicolor versicolor versicolor
## [97] versicolor versicolor versicolor versicolor virginica virginica
## [103] virginica virginica virginica virginica virginica virginica
## [109] virginica virginica virginica virginica virginica virginica
## [115] virginica virginica virginica virginica virginica virginica
## [121] virginica virginica virginica virginica virginica virginica
## [127] virginica virginica virginica virginica virginica virginica
## [133] virginica virginica virginica virginica virginica virginica
## [139] virginica virginica virginica virginica virginica virginica
## [145] virginica virginica virginica virginica virginica virginica
## Levels: setosa versicolor virginica
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 7 4.6 3.4 1.4 0.3 setosa
## 9 4.4 2.9 1.4 0.2 setosa
## 10 4.9 3.1 1.5 0.1 setosa
## 12 4.8 3.4 1.6 0.2 setosa
## 13 4.8 3.0 1.4 0.1 setosa
## 14 4.3 3.0 1.1 0.1 setosa
## 23 4.6 3.6 1.0 0.2 setosa
## 25 4.8 3.4 1.9 0.2 setosa
## 30 4.7 3.2 1.6 0.2 setosa
## 31 4.8 3.1 1.6 0.2 setosa
## 35 4.9 3.1 1.5 0.2 setosa
## 38 4.9 3.6 1.4 0.1 setosa
## 39 4.4 3.0 1.3 0.2 setosa
## 42 4.5 2.3 1.3 0.3 setosa
## 43 4.4 3.2 1.3 0.2 setosa
## 46 4.8 3.0 1.4 0.3 setosa
## 48 4.6 3.2 1.4 0.2 setosa
## 58 4.9 2.4 3.3 1.0 versicolor
## 107 4.9 2.5 4.5 1.7 virginica
## Sepal.Length.scale
## 2 -1.139200
## 3 -1.380727
## 4 -1.501490
## 7 -1.501490
## 9 -1.743017
## 10 -1.139200
## 12 -1.259964
## 13 -1.259964
## 14 -1.863780
## 23 -1.501490
## 25 -1.259964
## 30 -1.380727
## 31 -1.259964
## 35 -1.139200
## 38 -1.139200
## 39 -1.743017
## 42 -1.622254
## 43 -1.743017
## 46 -1.259964
## 48 -1.501490
## 58 -1.139200
## 107 -1.139200
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1 5.1 3.5 1.4 0.2
## 2 4.9 3.0 1.4 0.2
## 3 4.7 3.2 1.3 0.2
## 4 4.6 3.1 1.5 0.2
## 5 5.0 3.6 1.4 0.2
## 6 5.4 3.9 1.7 0.4
## 7 4.6 3.4 1.4 0.3
## 8 5.0 3.4 1.5 0.2
## 9 4.4 2.9 1.4 0.2
## 10 4.9 3.1 1.5 0.1
## 11 5.4 3.7 1.5 0.2
## 12 4.8 3.4 1.6 0.2
## 13 4.8 3.0 1.4 0.1
## 14 4.3 3.0 1.1 0.1
## 15 5.8 4.0 1.2 0.2
## 16 5.7 4.4 1.5 0.4
## 17 5.4 3.9 1.3 0.4
## 18 5.1 3.5 1.4 0.3
## 19 5.7 3.8 1.7 0.3
## 20 5.1 3.8 1.5 0.3
## 21 5.4 3.4 1.7 0.2
## 22 5.1 3.7 1.5 0.4
## 23 4.6 3.6 1.0 0.2
## 24 5.1 3.3 1.7 0.5
## 25 4.8 3.4 1.9 0.2
## 26 5.0 3.0 1.6 0.2
## 27 5.0 3.4 1.6 0.4
## 28 5.2 3.5 1.5 0.2
## 29 5.2 3.4 1.4 0.2
## 30 4.7 3.2 1.6 0.2
## 31 4.8 3.1 1.6 0.2
## 32 5.4 3.4 1.5 0.4
## 33 5.2 4.1 1.5 0.1
## 34 5.5 4.2 1.4 0.2
## 35 4.9 3.1 1.5 0.2
## 36 5.0 3.2 1.2 0.2
## 37 5.5 3.5 1.3 0.2
## 38 4.9 3.6 1.4 0.1
## 39 4.4 3.0 1.3 0.2
## 40 5.1 3.4 1.5 0.2
## 41 5.0 3.5 1.3 0.3
## 42 4.5 2.3 1.3 0.3
## 43 4.4 3.2 1.3 0.2
## 44 5.0 3.5 1.6 0.6
## 45 5.1 3.8 1.9 0.4
## 46 4.8 3.0 1.4 0.3
## 47 5.1 3.8 1.6 0.2
## 48 4.6 3.2 1.4 0.2
## 49 5.3 3.7 1.5 0.2
## 50 5.0 3.3 1.4 0.2
## 51 7.0 3.2 4.7 1.4
## 52 6.4 3.2 4.5 1.5
## 53 6.9 3.1 4.9 1.5
## 54 5.5 2.3 4.0 1.3
## 55 6.5 2.8 4.6 1.5
## 56 5.7 2.8 4.5 1.3
## 57 6.3 3.3 4.7 1.6
## 58 4.9 2.4 3.3 1.0
## 59 6.6 2.9 4.6 1.3
## 60 5.2 2.7 3.9 1.4
## 61 5.0 2.0 3.5 1.0
## 62 5.9 3.0 4.2 1.5
## 63 6.0 2.2 4.0 1.0
## 64 6.1 2.9 4.7 1.4
## 65 5.6 2.9 3.6 1.3
## 66 6.7 3.1 4.4 1.4
## 67 5.6 3.0 4.5 1.5
## 68 5.8 2.7 4.1 1.0
## 69 6.2 2.2 4.5 1.5
## 70 5.6 2.5 3.9 1.1
## 71 5.9 3.2 4.8 1.8
## 72 6.1 2.8 4.0 1.3
## 73 6.3 2.5 4.9 1.5
## 74 6.1 2.8 4.7 1.2
## 75 6.4 2.9 4.3 1.3
## 76 6.6 3.0 4.4 1.4
## 77 6.8 2.8 4.8 1.4
## 78 6.7 3.0 5.0 1.7
## 79 6.0 2.9 4.5 1.5
## 80 5.7 2.6 3.5 1.0
## 81 5.5 2.4 3.8 1.1
## 82 5.5 2.4 3.7 1.0
## 83 5.8 2.7 3.9 1.2
## 84 6.0 2.7 5.1 1.6
## 85 5.4 3.0 4.5 1.5
## 86 6.0 3.4 4.5 1.6
## 87 6.7 3.1 4.7 1.5
## 88 6.3 2.3 4.4 1.3
## 89 5.6 3.0 4.1 1.3
## 90 5.5 2.5 4.0 1.3
## 91 5.5 2.6 4.4 1.2
## 92 6.1 3.0 4.6 1.4
## 93 5.8 2.6 4.0 1.2
## 94 5.0 2.3 3.3 1.0
## 95 5.6 2.7 4.2 1.3
## 96 5.7 3.0 4.2 1.2
## 97 5.7 2.9 4.2 1.3
## 98 6.2 2.9 4.3 1.3
## 99 5.1 2.5 3.0 1.1
## 100 5.7 2.8 4.1 1.3
## 101 6.3 3.3 6.0 2.5
## 102 5.8 2.7 5.1 1.9
## 103 7.1 3.0 5.9 2.1
## 104 6.3 2.9 5.6 1.8
## 105 6.5 3.0 5.8 2.2
## 106 7.6 3.0 6.6 2.1
## 107 4.9 2.5 4.5 1.7
## 108 7.3 2.9 6.3 1.8
## 109 6.7 2.5 5.8 1.8
## 110 7.2 3.6 6.1 2.5
## 111 6.5 3.2 5.1 2.0
## 112 6.4 2.7 5.3 1.9
## 113 6.8 3.0 5.5 2.1
## 114 5.7 2.5 5.0 2.0
## 115 5.8 2.8 5.1 2.4
## 116 6.4 3.2 5.3 2.3
## 117 6.5 3.0 5.5 1.8
## 118 7.7 3.8 6.7 2.2
## 119 7.7 2.6 6.9 2.3
## 120 6.0 2.2 5.0 1.5
## 121 6.9 3.2 5.7 2.3
## 122 5.6 2.8 4.9 2.0
## 123 7.7 2.8 6.7 2.0
## 124 6.3 2.7 4.9 1.8
## 125 6.7 3.3 5.7 2.1
## 126 7.2 3.2 6.0 1.8
## 127 6.2 2.8 4.8 1.8
## 128 6.1 3.0 4.9 1.8
## 129 6.4 2.8 5.6 2.1
## 130 7.2 3.0 5.8 1.6
## 131 7.4 2.8 6.1 1.9
## 132 7.9 3.8 6.4 2.0
## 133 6.4 2.8 5.6 2.2
## 134 6.3 2.8 5.1 1.5
## 135 6.1 2.6 5.6 1.4
## 136 7.7 3.0 6.1 2.3
## 137 6.3 3.4 5.6 2.4
## 138 6.4 3.1 5.5 1.8
## 139 6.0 3.0 4.8 1.8
## 140 6.9 3.1 5.4 2.1
## 141 6.7 3.1 5.6 2.4
## 142 6.9 3.1 5.1 2.3
## 143 5.8 2.7 5.1 1.9
## 144 6.8 3.2 5.9 2.3
## 145 6.7 3.3 5.7 2.5
## 146 6.7 3.0 5.2 2.3
## 147 6.3 2.5 5.0 1.9
## 148 6.5 3.0 5.2 2.0
## 149 6.2 3.4 5.4 2.3
## 150 5.9 3.0 5.1 1.8
## Sepal.Length Sepal.Width Petal.Length Species
## 1 5.1 3.5 1.4 setosa
## 2 4.9 3.0 1.4 setosa
## 3 4.7 3.2 1.3 setosa
## 4 4.6 3.1 1.5 setosa
## 5 5.0 3.6 1.4 setosa
## 6 5.4 3.9 1.7 setosa
## 8 5.0 3.4 1.5 setosa
This could be an entire lecture by itself!!!
2.7 Whirlwind Tour of R
R’s power comes in the fact that you download packages to put on top of base R
- Turning Data tables into already formatted APA Latex Tables (stargazer, xtable)
- Creating Publication Quality Graphs (ggplot2)
- Text manipulation (stringr)
- Exploring data and not making chart after chart after chart (psych)
- Every statistical test you could want (psych, cars, ezanova, lavaan)
- Software to plot not so normal output (SEMplots)
- Making Websites in R
- These slides were written in R
- Quickly processing huge datasets (data.table, dplyr)
- Tons of Machine Learning
library(ggplot2)
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width,
color = Species),
xlab = "Sepal Length",
ylab = "Sepal Width",
main = "My Plot") + geom_point()
Or stuff for data exploration
## Warning: package 'psych' was built under R version 3.4.4
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
2.8 Functions for Psychologists
nlme()
andlme4()
for Multilevel Modelinglavaan()
for Latent Variable AnalysisezAnova()
for ANOVA based testing; the anova() function does model comparisons- profileR for Repeated Measures MANOVA
glm()
andlm()
for linear modelscaret()
for Machine Learning
2.9 Resources
- swirl
- stackoverflow.com
- Your peers
- R Community
2.9.1 Template Stuff
You can label chapter and section titles using {#label}
after them, e.g., we can reference Chapter 2. If you do not manually label them, there will be automatic labels anyway, e.g., Chapter ??.
Figures and tables with captions will be placed in figure
and table
environments, respectively.
Reference a figure by its code chunk label with the fig:
prefix, e.g., see Figure 2.1. Similarly, you can reference tables generated from knitr::kable()
, e.g., see Table 2.1.
| Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species | Sepal.Length.scale |
|---|---|---|---|---|---|
| 5.1 | 3.5 | 1.4 | 0.2 | setosa | -0.89767388 |
| 4.9 | 3.0 | 1.4 | 0.2 | setosa | -1.13920048 |
| 4.7 | 3.2 | 1.3 | 0.2 | setosa | -1.38072709 |
| 4.6 | 3.1 | 1.5 | 0.2 | setosa | -1.50149039 |
| 5.0 | 3.6 | 1.4 | 0.2 | setosa | -1.01843718 |
| 5.4 | 3.9 | 1.7 | 0.4 | setosa | -0.53538397 |
| 4.6 | 3.4 | 1.4 | 0.3 | setosa | -1.50149039 |
| 5.0 | 3.4 | 1.5 | 0.2 | setosa | -1.01843718 |
| 4.4 | 2.9 | 1.4 | 0.2 | setosa | -1.74301699 |
| 4.9 | 3.1 | 1.5 | 0.1 | setosa | -1.13920048 |
| 5.4 | 3.7 | 1.5 | 0.2 | setosa | -0.53538397 |
| 4.8 | 3.4 | 1.6 | 0.2 | setosa | -1.25996379 |
| 4.8 | 3.0 | 1.4 | 0.1 | setosa | -1.25996379 |
| 4.3 | 3.0 | 1.1 | 0.1 | setosa | -1.86378030 |
| 5.8 | 4.0 | 1.2 | 0.2 | setosa | -0.05233076 |
| 5.7 | 4.4 | 1.5 | 0.4 | setosa | -0.17309407 |
| 5.4 | 3.9 | 1.3 | 0.4 | setosa | -0.53538397 |
| 5.1 | 3.5 | 1.4 | 0.3 | setosa | -0.89767388 |
| 5.7 | 3.8 | 1.7 | 0.3 | setosa | -0.17309407 |
| 5.1 | 3.8 | 1.5 | 0.3 | setosa | -0.89767388 |
You can write citations, too. For example, we are using the bookdown package (Xie 2017) in this sample book, which was built on top of R Markdown and knitr (Xie 2015).
References
Xie, Yihui. 2017. Bookdown: Authoring Books and Technical Documents with R Markdown. https://CRAN.R-project.org/package=bookdown.
Xie, Yihui. 2015. Dynamic Documents with R and Knitr. 2nd ed. Boca Raton, Florida: Chapman; Hall/CRC. http://yihui.name/knitr/.


# extends 'base.html' # block content
Share a lesson with the FIRST community. An example lesson is "Using a clamp". (Try to make them short and to the point. If it needs more time we recommend creating a course and adding the various lessons as part of one course.)
Agregate lessons to create a course. This would enable users to have good understanding of a good concept. Example of a course is "FTC Robot Parts"
Create a course track. Example of a track is 'Programming an FRC Robot'
Approve contents and help the community become a great place.
Help maintain the source code and make this a better platform.
TBD


work
Movie Bucket List
A deployed, full stack application that allows users to create accounts, search for movies, and add them to custom lists that are displayed on the home page
Work Day Scheduler
Displays date color coordinates hours left in the workday. Allows user to save tasks to each hour so that they load on refresh
View the repo!Employee Tracker
Allows a user to manage employees, roles, and departments through the command line
View the repo!


Danny's Obtuse Gadget, version 1.0
(I'm writing this as if the thing was finished - far from it! - So this is all provisional design)
A very limited computer based on an Arduino Uno and a TM1638 I/O card. Runs as a virtual machine on top of the Arduino. Inspired by the single-board computers of the mid-1970's notably the MK14 and KIM-1. The architecture and instruction set is loosely derived from the processors used on these machines, the SC/MP and 6502 respectively.
Some novelty is offered by the hardware used is that it should be possible to interface with the built-in I/O of the Arduino. So eg. a digital thermometer could be made by attaching the appropriate sensor and programming the DOG-1 directly, without access to a PC.
uint8_t program[512]; // the code uint8_t pcStack[64]; uint8_t aluStack[64];
Operations will be carried out using the following registers:
16-Bit
8-Bit
Note - I think I'll change this rather 6502-like setup after reading the 6800 datasheet. That has 2 accumulators and one X index register. Seems to make for a simpler but more versatile instruction set.
Also quite interested in trying stack-oriented programming, 'check Here is a list of several stack manipulation operators, including SWAP' https://www.forth.com/starting-forth/2-stack-manipulation-operators-arithmetic/ Also Stack Operations in 6800 doc.
// copied from 6800 spec, need to tweak
ACC - Accumulator In accumulator addressing, either accumulator A or accumulator B is specified. These are 1- byte instructions. Ex: ABA adds the contetns of accumulators and stores the result in accumulator A
IMM - Immediate In immediate addressing, operand is located immediately after the opcode in the second byte of the instruction in program memory (except LDS and LDX where the operand is in the second and third bytes of the instruction). These are 2-byte or 3-byte instructions. Ex: LDAA #$25 loads the number (25)H into accumulator A
ABS - Absolute In absolute addressing, the address contained in the second byte of the instruction is used as the higher eight bits of the address of the operand. The third byte of the instruction is used as the lower eight bits of the address for the operand. This is an absolute address in the memory. These are 3-byte instructions. Ex: LDAA $1000 loads the contents of the memory address (1000)H into accumulator A
IDX - Indexed void LDx(uint8_t id) { // Load accumulator A indexed (6502 calls it Indexed Indirect) unsigned long addr = xReg; // start with the index register value addr += program[++pc]; // add the next byte in the program acc[id] = program[addr]; // look up the value at the total } In indexed addressing, the address contained in the second byte of the instruction is added to the index register. This result is then used to address memory. The modified address is held in a temporary address register so there is no change to the index register. These are 2-byte instructions. Ex: LDx 0A // Initially, LDX #$1000 instruction loads 1000H to the index register (X) using immediate addressing. Then LDAA $10,X instruction, using indexed addressing, loads the contents of memory address (10)H + X = 1010H into accumulator A. // USE 2's comp?
IMP - Implied In the implied addressing mode, the instruction gives the address inherently (i.e, stack pointer, index register, etc.). Inherent instructions are used when no operands need to be fetched. These are 1 byte instructions. Ex: INX increases the contents of the Index register by one. The address information is "inherent" in the instruction itself. INCA increases the contents of the accumulator A by one. DECB decreases the contents of the accumulator B by one.
REL - Relative (tweaked) Relative addressing is used for branching instructions. These instructions take a single byte, which is used as an offset from the address of the next instruction. The offset is given as a two's complement number, allowing negative offsets.
nn = 2 hex digits nnnn = 4 hex digits
| Mode | Assembler Format | Description |
|---|---|---|
| Immediate | #nn | Value is given immediately after opcode |
| Absolute | (nnnn) | Value is contained in the given address |
| Indexed | nnnn, X | - |
STAa 99 10 ; store acc A at 0199 lo, hi
Flags
| Bit | Flag | Name | Description |
|---|---|---|---|
| 0 | N | Negative | Set if bit 7 of ACC is set |
| 1 | V | Overflow | - |
| 2 | Z | Zero | - |
| 3 | C | Carry | - |
| 7 | X | Aux | - |
In unsigned arithmetic, watch the carry flag to detect errors. In unsigned arithmetic, the overflow flag tells you nothing interesting.
In signed arithmetic, watch the overflow flag to detect errors. In signed arithmetic, the carry flag tells you nothing interesting.
// http://teaching.idallen.com/dat2343/10f/notes/040_overflow.txt
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|---|
| LEDs | N | V | Z | C | X | X | X | X |
| 7-Segs | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 |
| Buttons | o | o | o | o | o | o | o | o |
Note : on the board switches are labeled S1-S8, but starting at 0 is less confusing while coding
| TM1368 | Arduino |
|---|---|
| VCC | 5v |
| GND | GND |
| STB | D4 |
| CLK | D7 |
| DATA | D8 |
The LEDs will usually display the contents of the Status Register.
Generally, the 7-Segment displays 0-3 will display the current value (address) of the Program Counter. Displays 6 and 7 showing the contents at that address. All in hexadecimal.
The functionality of the I/O will depend on the system's mode : Program or Run. Display 4 shows the current mode, P or R.
Push-button 4 switches between these modes. At any time, pressing buttons 4 and 5 together will reset the PC to 0000.
Pressing the buttons 0-3, 6-7 will increment the value corresponding to that of the display above it. Programming is achieved by pressing button 3 to increment the PC (with overflow occurring, counting up on displays 0-2). Pressing button 7 will increment the value on display 7 (without overflowing to display 6), ditto for button 6/display 6, together providing the value at the given address.
Pressing button 5 will switch the response from increment to decrement. The PC buttons/display does carry values and wrap at max and min (0000). The code buttons/display act independently to each other and don't wrap in the <0 direction.
Pressing button 4 will switch to Run mode.
0 & 7 - display Auxiliary Stack Pointer & status
0 & 3 - flip from single-step to free run
There are some utilities in the python directory.
This takes quasi-assembly language and looks up the corresponding hex values, producing a version suitable for uploading. The values are taken directly from definitions in DOG-!'s source code right now, so I can change things around without breaking anything. The first line specifies the start address at which to put the program.
Example assembly :
start 0005 LDAi 66 ; put 0x66 in acc A STAa 07 00 ; store acc A at 0070 HALT
Typical usage :
./ass.py -i ../dog-code/random.ass -o ../dog-code/random.dog
Will upload a DOG-1 program to the device of the USB/serial port. Hex values for the opcodes should be the first two characters on each line, everything else is ignored. Right now comms will be terminated on reaching an FF (HALT).
Example program for upload :
00 05 10 LDAi 66 ; put 0x66 in acc A 66 14 STAa 07 00 ; store acc A at 0070 07 00 FF HALT
Typical usage :
./upload.py -i ../dog-code/random.dog -p /dev/ttyACM0
Initially the system will be halted at the current address. Pressing button 3 will single-step through the program (pressing buttons 0-3 will cause the PC to skip to the corresponding address [running or skipping code in between? TBD]).
Alternately the program may be run in real time by pressing button 5. Pressing this button again will halt the program.
The HALT opcode will terminate a program and wait for keyboard input before switching to Program mode and zeroing the program counter.
If the instruction PAUSE is encountered in a program, the program will freeze at this point at display 'PAUSE...'. The flags and registers maynow be inspected. Pressing key 4 sets the program running again.
xxxxnoPE - non-existent operation at xxxx xxxxChar - illegal character at xxxx (when uploading program)
currently 152 instructions, maybe 50 implemented
all off them listed in opcodes.md, opcodes.html, opcodes.pdf
note to self - things like LDA will have a version for each of the addressing modes, ~ 6, so it's probably an idea to hop 8 values between base versions...hmm, testing values for switch statements via masks?
Using index register - probably mainly for table lookup, maybe for subroutine-like things too should support ld, st, inc & dec, swap with PC, conditional swap
Ok, save long list until later, start with a subset...
Canonical version is in the code!!
IMPORTANT TODO : serial comms for save/load
Using the display etc. and Arduino I/O from code will need some specialised opcodes.
Maybe :
USE
as in https://en.wikipedia.org/wiki/Linear-feedback_shift_register
Games? Lunar Lander? noughts & crosses? Space Invaders!!!!!!
Using Arduino I/O - digital thermometer? beepy machine?
This blog post gave me enough of how-to on interfacing with the TM1638 to get started:
Using a TM1638-based board with Arduino
See also :


Hi !! i am Prashant setia . i am a student at VIT(chennai) , persuing my B.Tech degree in Computer science.
An enthusiastic fresher Eager to learn new things and easily get involve with new people
An enthusiastic fresher Eager to learn new things and easily get involve with new people
- Elon Musk
- Robin Sharma
| Name of Institution | Standard | Year |
|---|---|---|
| Aarohi Model School | 10th | 2015-2016 |
| Bharti vidya Mandir School | 12th | 2017-2018 |
| VIT University, Chennai | B.Tech. | 2019-2023 |


eSports Club
Home
About
Members
Events
Next Event:
{{ nextE }}
Register a Team.
Team Name
Team Members:
Email
Summoner Name
Add Team Member
Field left empty
Email
Summoner Name
Register Team


{% extends "learn/base0.html" %} {% block title %}SVM Machine Learning{% endblock %} {% block content %}
Welcome to /learn/. This is my play-around toy with libSVM powered by a Javascript/AJAX interface with a Django web server backend.
By choosing a label color, you can add a point to my dataset. Each point you add is sent via AJAX to a database. After adding points, train the SVM on the dataset.
Then click predict all to see the classifier in action. Press "clear" to remove the prediction to add more points and train/predict again. Pressing predict instead of predict all makes 144 separate AJAX requests to get a separate prediction at each prediction point. The loading effect is cool but if you can, please spare my bandwidth :)


To search for text in a message:
Messages
.
Search
. The standard search will look
for your terms in the subject line of the messages in the selected folder.
Searches are case sensitive.
Advanced Search
and check the appropriate box(es). Available parameters are:Search parameters in advanced searches will remain checked for
subsequent searches until you clear them by clicking
Clear Search
.
Normal Search
.


Address: loading…
Balance: loading…
Status: loading…
Block height: loading…
Peers connected: 0
Recipient
Amount
Message


Weather Dashboard
Test City (MM/DD/YYYY) Weather Icon
Tempurature:
Humidity:
Wind Speed:
UV Index:
5-Day Forecast:
Temp:
Humidity:
Temp:
Humidity:
Temp:
Humidity:
Temp:
Humidity:
Temp:
Humidity:


One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment.
I cannot recommend Gabor enough as a scrum team member. In a complex technical environment, with difficult dependencies and client needs, he has the maturity and expressive capability you really need. On top of his excellent technical writing skills, he has trained on the job to become a scrum master, and this is somewhere his unique skills really work well. He pulls people together. He fosters trust and respect in the team. He solves problems. Go with Gabor!
This is a great game that Scrum Masters use to help people understand what is Scrum like. In this game, participants are asked to perform simple, everyday tasks in ways they haven’t thought of before. Each task evokes conversations about complexity, prioritisation, dependencies, acceptance criteria and teaches a few things about the five values of Scrum.
July 2018
I had the pleasure of working with Gabor at Leo Tech. Originally a Technical Author, he moved into a ScrumMaster role to great effect, was able to transfer a lot of his skills and develop new ones to fill the role. Gabor is a great communicator and can work with both inexperienced and experienced team members to get the best out of them and take a Scrum team forward. He can deal with team conflicts, identify and remove impediments, brings a positive energy to a team, and adopts new practices to further his skills.
This card has supporting text below as a natural lead-in to additional content.
April 2017
This card has supporting text below as a natural lead-in to additional content.
July 2018
Gabor is a skilled technical writer who's apt to learn quickly the domain knowledge required for the job. He's grown a genuine interest in agile methodologies and in particular Scrum, which is what led him to pursue more as a professional and become a good facilitator for the team and then a Scrum master.
This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.
November 2016


Your browser does not support the HTML5 video tag.
Your browser does not support the HTML5 video tag.
TOSS
Current Session:
Heads:
0
Tails:
0
Total Flips:
0


Inner sourcing your
company
Open source is about
openness
License to use
... copy
... modify
... redistribute
Open source is also a methodology
Attribution
Test
Continuous integration
Collaboration tools
Broken silos
Increased + spontaneous
collaboration
Shared knowledge
Outer source → Good karma
Return to community
All you need


Face Recognition: Eigenface and Fisherface Performance Across Pose
Computer Vision Research in GeneralThe computer vision field has recently become a very interesting area to research. Technological improvements in computers and imaging hardware have enabled many novel computer vision applications. Automated computer vision systems that capture and analyze images have found mostly military applications to date: in surveillance, targeting, and biometrics. In the near future, computer vision is likely to be used in consumer applications such as:
Also, some useful commercial applications that are currently or soon-to-be in development include:
Computer vision makes use of multidisciplinary knowledge from many different fields, including optical physics, machine learning, pattern recognition, signal processing, and computer graphics. It can be useful to divide computer vision research into four levels:
While theoretical knowledge is well-developed for image formation and low-level vision, many mid-level and high-level vision problems lack theoretical descriptions or solutions. Because so much remains to be learned, the next several years should be an exciting time to research computer vision. As a researcher beginning study in the computer vision field, I wanted to start with study of an established research topic. The facial recognition problem has been studied extensively, with research beginning in the 1960-70’s that was mostly influenced by early works authored by Bledsoe [1], Kelly [2], and Kanade [3]. Problem StatementBroad Problem Statement
Pictorially, given this database of photos and this new picture, can an automatic algorithm be developed that can match the identity of the person from the new picture with a previously stored image in the database? While the broad goal is appropriate for a research group, the scope must be narrowed a bit for a class project. By assuming that the face detection problem is already solved, we can expect to use pre-processed (in scale, rotation, and alignment) face images as inputs to our face recognition software. An example of this face detection work can be seen at Carnegie Mellon University’s face detection online demo. Running some of our database through this demo gives this result. Our (Specific) Problem Statement
Why is Face Recognition Interesting?Face recognition is interesting to study because it is an application area where computer vision research is being utilized in both military and commercial products. Much effort has been spent on this problem, yet there is still plenty of work to be done. Basic research related to this field is currently active. For example, research searching for a fundamental theory describing how light and objects interact to produce images (via the plenoptic function) was recently published in April 2004 [7]. Often, practical applications can grow out of improvements in theoretical understanding and it seems that this problem will continue to demonstrate this growth. Personally, I’m interested in this project because it’s a high-level pattern recognition problem in which humans are very adept, whereas it can be quite challenging to teach a machine to do it. The intermediate and final visual results are interesting to observe in order to understand failures and successes of the various approaches. BackgroundThe state of the art research of face recognition has progressed much beyond the eigenface and fisherface approaches we study in this project. The history has developed from the 1960’s until now (2004) with many significant advances happening within the last eight years. Influential contributions (with our focus emphasized)
For more historical detail, refer to R. Chellappa’s survey [8] of this topic’s early history, covering the 1960’s until 1995. ApproachWe have implemented the eigenface and fisherface algorithms and tested them against two face databases, observing results across pose (out-of-plane face rotation). We evaluated performance against databases with both densely-sampled and sparsely-sampled facial poses. Our new ideas include:
More detail describing the new ideas can be found in the new contributions section. Mathematics OverviewThis section reviews the basic mathematics for the eigenface and fisherface approaches. We use MATLAB-like pseudo-code notation. EigenfaceGiven:
Feature Extraction:
Nearest-Neighbor Classification:
FisherfaceGiven:
Feature Extraction:
Nearest-Neighbor Classification:
Results and ComparisonsFacial recognition software was developed using the MATLAB programming language by the MathWorks. This environment was chosen because it easily supports image processing, image visualization, and linear algebra. The software was tested against two databases: ALAN & UMIST.
The UMIST database images, displayed below, has uniform lighting and pose varying from side to frontal. UMIST Results Using Eigenface in Densely Sampled DatabaseFor these results, 20 recognition faces (one for each person) were randomly picked from the database, leaving 545 photos to use as training faces. Mp, the number of principal components to use, was chosen as 20. The average face, eigenvalue strengths, and the 20 eigenfaces (eigenvectors) corresponding to the 20 strongest eigenvalues are displayed.
Once these eigenfaces have been found, they can be used as a basis for face-space. All of the training images are projected into this face-space and the projection weights are stored as training data. In order to recognize a face, it is projected into face-space, producing weights that are then used as features in a nearest neighbor classifier that simply finds the minimum euclidean distance between the recognition weights and the training weights. The resulting plots follow. Note that blue text over a face denotes a correct match while red text indicates a incorrect recognition.
All 20 of 20 images were correctly recognized, confirming the very good performance of eigenface with densely and uniformly sampled inputs. For this same database and setup, fisherface performs very similarly. UMIST Results Using Fisherface in Sparsely Sampled DatabaseFor these results, 20 recognition faces (one for each person) were randomly picked from the database, then 60 more photos were used as training faces. Three training faces were picked for each person: a frontal, side, and 45-degree view. The resulting plots follow.
Out of the 20 faces, 16 were correctly classified in the 1st match. Also notice that this approach is rather pose invariant — it often (13 times) picks out all 3 training images from the database. For comparison, the next plots show the same setup run using the eigenface algorithm. Note that 14 of the 20 faces are correctly classified, and all 3 correct images are never found.
Clearly, the fisherface algorithm performs better under pose variation when only a few samples across pose are available in the training set. ALAN Database Results Using EigenfaceThe following images depict the original captured photos and the faces generated by manual pre-processing.
Pre-processing was used to attempt to remove differences among images in lighting (by normalizing skin tone), scale, alignment, and background. For these results, 11 recognition faces (one for each person) were randomly picked from the database, then the remaining 26 photos were used as training faces. The results before and after pre-processing are displayed. While performance was still not perfect, the pre-processing improved the number of correct classifications from 6 to 9 (of 13). Fisherface performance was similar to eigenface for this database. Our New ContributionsEigenface vs. Fisherface for Training Data that is Densely and Sparsely Sampled Across PoseAs displayed by the UMIST results, we found that when only a few training samples across pose are available, fisherface clearly performs better than eigenface. This is not unexpected because fisherface is minimizing the within-class scatter. However, this particular detail not been clearly stated in past literature. Fisherface Algorithm TweakIn experimenting with the fisherface approach, we also implemented a slightly modified version of the algorithm. Our change tweaks the principal component analysis dimension reduction step in the fisherface approach. The original algorithm, detailed in [6], suggests picking the number of principal components to keep in the PCA dimension reduction step as Mp = N - c, where N is the number of training images and c is the number of unique identities. While this choice of Mp guarantees that the resulting matrix will be non-singular, it is not the only possible choice. By choosing Mp less than N - c, we can further reduce the dimensionality before employing the fisherface approach. Our rationale is that the “face-space” does not need the higher dimensional eigenvectors to be well represented. This adds flexibility in making the trade between using the strongest principal components versus classifying based on the within-class and between-class scatter. This modification should improve upon both fisherface and eigenface by:
More thorough testing on larger databases would be necessary to verify these improvements. SummaryTable comparing eigenface to fisherface (* denotes new result)
We find that both the eigenface and fisherface techniques work very well for a uniformly and densely sampled data set varied over pose. When a more sparse data set across pose is available, the fisherface approach performs better than eigenface. Further Work IdeasGiven more time to improve and expand our results, we would suggest getting better databases, trying other recognition techniques, and using the formal FERET test methodology. The eventual goal might be a submission to the Face Recognition Vendor Test. We could augment our results by:
AppendixComments on ECE432I enjoyed this class, ECE 432 Advanced Computer Vision. Adaption of the lecture schedule to better fit the projects people chose was a good idea because it was very helpful to get a detailed explanation about the problem and solution from the professor. One minor improvement I’d like to see made in the future would be a bit more intermediate feedback on the final project. Maybe some earlier demo days where we show running code to classmates and ask for input in class would be useful. MATLAB Code and Tools UsedFunctions:
MATLAB by the MathWorks was used for mose of the software development. Imagemagick, the GIMP, and Markdown were used in preparing the data and documentation. All of the functions required to run version V of the simulation (RunFaceRecog, computeEigenfaces, computeFisherfaces, and classifyFaces) are available in matlab m-file and html formats. A supporting function called subfigure that nicely arranges the plots is also available in matlab m-file and html formats. Cited References[1] W. W. Bledsoe, “The model method in facial recognition,” Panoramic Research Inc., Tech. Rep. PRI:15, Palo Alto, CA, 1964. [2] M. D. Kelly, “Visual identification of people by computer,” Tech. Rep. AI-130, Stanford AI Proj., Stanford, CA, 1970. [3] T. Kanade, Computer Recognition of Human Faces. Basel and Stuttgart: Birkhauser, 1977. [4] M. Turk and A. Pentland, “Eigenfaces for recognition,” J. Cognitive Neuroscience, vol. 3, no. 1, 1991. [5] M. Turk and A. Pentland, “Face recognition using eigenfaces,” Proc. IEEE Conf. on Computer Vision and Pattern Recognition, 1991, pp. 586-591. [6] P. N. Belhumeur, J. P. Hespanha, and D. J. Kriegman, “Eigenfaces vs. fisherfaces: recognition using class specific linear projection,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 19, no. 7, pp. 711-720, July 1997. [7] R. Gross, I. Matthews, S. Baker, “Appearance-based face recognition and light-fields,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 26, no. 4, pp. 449-465, April 2004. [8] R. Chellappa, C. L. Wilson, and S. Sirohey, “Human and machine recognition of faces: A survey,” Proc. IEEE, vol. 83, pp. 705-740, 1995. Other References[9] R. O. Duda, P. E. Hart, and D. G. Stork, Pattern Classification. New York: Wiley, 2001. [10] D. A. Forsyth, J. Ponce, Computer vision: a modern approach. New Jersey: Prentice Hall, 2003. |