iptables¶
Esta página es mitad teoría mitad práctica. Ver también Seguridad.
Es posible cargar extensiones o módulos con más reglas, objetivos, etc.
Se pueden hacer filtros stateful, esto significa que se analiza a cada paquete teniendo en cuenta su relación con paquetes anteriores (por ejemplo para conexiones TCP). No vemos filtros stateful, usamos todo stateless.
Reglas: Son líneas que especifican tipos de paquetes, llevan asociadas un objetivo (target) a utilizar en el caso en el que un paquete coincida.
Objetivos: Es lo que quiero hacer con los paquetes que coinciden con una regla: aceptar, rechazar, etc.
Cadenas: Es una de reglas a corroborar secuencialmente cada vez que llega un paquete. Ya vienen las cadenas INPUT, OUTPUT, FORWARD, etc. que contienen reglas a utilizar ante paquetes entrantes, salientes, redireccionados, etc.
Tablas: Es un conjunto de cadenas, cada tabla se usa para cosas distintas, la tabla por defecto es filter, cada una extá explicada abajo.
En esta imagen se ve por qué cadenas y tablas pasa cada paquete:
Tablas que hay:
filter: This is the default table (if no -t option is passed). It contains the built-in chains INPUT (for packets destined to local sockets), FORWARD (for packets being routed through the box), and OUTPUT (for locally-generated packets).
nat: This table is consulted when a packet that creates a new connection is encountered. It consists of four built-ins: PREROUTING (for altering packets as soon as they come in), INPUT (for altering packets destined for local sockets), OUTPUT (for altering locally-generated packets before routing), and POSTROUTING (for altering packets as they are about to go out). IPv6 NAT support is available since kernel 3.7.
mangle: This table is used for specialized packet alteration. Until kernel 2.4.17 it had two built-in chains: PREROUTING (for altering incoming packets before routing) and OUT‐ PUT (for altering locally-generated packets before routing). Since kernel 2.4.18, three other built-in chains are also supported: INPUT (for packets coming into the box itself), FORWARD (for altering packets being routed through the box), and POSTROUTING (for altering packets as they are about to go out).
raw: This table is used mainly for configuring exemptions from connection tracking in combination with the NOTRACK target. It registers at the netfilter hooks with higher priority and is thus called before ip_conntrack, or any other IP tables. It provides the following built-in chains: PREROUTING (for packets arriving via any network interface) OUTPUT (for packets generated by local processes)
security: This table is used for Mandatory Access Control (MAC) networking rules, such as those enabled by the SECMARK and CONNSECMARK targets. Mandatory Access Control is implemented by Linux Security Modules such as SELinux. The security table is called after the filter table, allowing any Discretionary Access Control (DAC) rules in the filter table to take effect before MAC rules. This table provides the following built-in chains: INPUT (for packets coming into the box itself), OUTPUT (for altering locally-generated packets before routing), and FORWARD (for altering packets being routed through the box).
Para ver alguna tabla:
iptables [-t table] -L
El uso simplificado del comando iptables es:
iptables [-t table] {-A|-C|-D} chain rule-specification
En ese comando, {-A|-C|-D} son ejemplos de opciones a dar, rule-specification vendría a ser un conjunto de parámetros que especifican la regla en sí. Al final se usa -j y el objetivo (target) para especificar la acción a realizar.  Sino se
puede usar por ejemplo iptables -p tcp --help
.
Opciones¶
Especifican si la regla dada se debe agregar, borrar, reemplazar, etc.:
-A, --append chain rule-specification
Append one or more rules to the end of the selected chain. When the
source and/or destination names resolve to more than one address, a rule
will be added for each possible address combination.
-C, --check chain rule-specification
Check whether a rule matching the specification does exist in the
selected chain. This command uses the same logic as -D to find a
matching entry, but does not alter the existing iptables configura‐
tion and uses its exit code to indicate success or failure.
-D, --delete chain rule-specification
-D, --delete chain rulenum
Delete one or more rules from the selected chain. There are two
versions of this command: the rule can be specified as a number in the
chain (starting at 1 for the first rule) or a rule to match.
-I, --insert chain [rulenum] rule-specification
Insert one or more rules in the selected chain as the given rule
number. So, if the rule number is 1, the rule or rules are inserted at
the head of the chain. This is also the default if no rule number
is specified.
-R, --replace chain rulenum rule-specification
Replace a rule in the selected chain. If the source and/or
destination names resolve to multiple addresses, the command will fail.
Rules are numbered starting at 1.
-L, --list [chain]
List all rules in the selected chain. If no chain is selected, all
chains are listed. Like every other iptables command, it applies to
the specified table (filter is the default), so NAT rules get listed by
iptables -t nat -n -L Please note that it is often used with the -n
option, in order to avoid long reverse DNS lookups. It is legal
to specify the -Z (zero) option as well, in which case the chain(s)
will be atomically listed and zeroed. The exact output is affected by
the other arguments given. The exact rules are suppressed until you
use iptables -L -v or iptables-save(8).
-S, --list-rules [chain]
Print all rules in the selected chain. If no chain is selected, all
chains are printed like ipta‐ bles-save. Like every other iptables
command, it applies to the specified table (filter is the
default).
-F, --flush [chain]
Flush the selected chain (all the chains in the table if none is
given). This is equivalent to deleting all the rules one by one.
-Z, --zero [chain [rulenum]]
Zero the packet and byte counters in all chains, or only the given
chain, or only the given rule in a chain. It is legal to specify
the -L, --list (list) option as well, to see the counters immedi‐ ately
before they are cleared. (See above.)
-N, --new-chain chain
Create a new user-defined chain by the given name. There must be no
target of that name already.
-X, --delete-chain [chain]
Delete the optional user-defined chain specified. There must be no
references to the chain. If there are, you must delete or
replace the referring rules before the chain can be deleted. The chain
must be empty, i.e. not contain any rules. If no argument is given, it
will attempt to delete every non-builtin chain in the table.
-P, --policy chain target
Set the policy for the built-in (non-user-defined) chain to the
given target. The policy target must be either ACCEPT or DROP.
-E, --rename-chain old-chain new-chain
Rename the user specified chain to the user supplied name. This is
cosmetic, and has no effect on the structure of the table.
-h Help. Give a (currently very brief) description of the command syntax.
Parámetros¶
Especifican a la regla. Estas son algunos parámetros disponibles, ver man
iptables-extensions
:
-4, --ipv4
This option has no effect in iptables and iptables-restore. If a
rule using the -4 option is inserted with (and only with)
ip6tables-restore, it will be silently ignored. Any other uses will
throw an error. This option allows IPv4 and IPv6 rules in a single rule
file for use with both ipta‐ bles-restore and ip6tables-restore.
-6, --ipv6
If a rule using the -6 option is inserted with (and only with)
iptables-restore, it will be silently ignored. Any other uses will
throw an error. This option allows IPv4 and IPv6 rules in a single rule
file for use with both iptables-restore and ip6tables-restore.
This option has no effect in ip6tables and ip6tables-restore.
[!] -p, --protocol protocol
The protocol of the rule or of the packet to check. The specified
protocol can be one of tcp, udp, udplite, icmp, icmpv6,esp, ah, sctp,
mh or the special keyword "all", or it can be a numeric value,
representing one of these protocols or a different one. A protocol
name from /etc/protocols is also allowed. A "!" argument before
the protocol inverts the test. The number zero is equivalent to all.
"all" will match with all protocols and is taken as default when this
option is omitted. Note that, in ip6tables, IPv6 extension headers
except esp are not allowed. esp and ipv6-nonext can be used with
Kernel version 2.6.11 or later. The number zero is equivalent to all,
which means that you cannot test the protocol field for the value
0 directly. To match on a HBH header, even if it were the last, you
cannot use -p 0, but always need -m hbh.
[!] -s, --source address[/mask][,...]
Source specification. Address can be either a network name, a hostname,
a network IP address (with /mask), or a plain IP address. Hostnames
will be resolved once only, before the rule is submitted to the kernel.
Please note that specifying any name to be resolved with a remote query
such as DNS is a really bad idea. The mask can be either an ipv4
network mask (for iptables) or a plain number, specifying the number of
1's at the left side of the network mask. Thus, an iptables mask of 24
is equivalent to <IP_ADDRESS>. A "!" argument before the address
specification inverts the sense of the address. The flag --src is an
alias for this option. Multiple addresses can be specified, but this
will expand to multiple rules (when adding with -A), or will cause
multiple rules to be deleted (with -D).
[!] -d, --destination address[/mask][,...]
Destination specification. See the description of the -s (source) flag
for a detailed description of the syntax. The flag --dst is an alias
for this option.
-m, --match match
Specifies a match to use, that is, an extension module that tests for
a specific property. The set of matches make up the condition under
which a target is invoked. Matches are evaluated first to last as
specified on the command line and work in short-circuit fashion,
i.e. if one extension yields false, evaluation will stop.
-j, --jump target
This specifies the target of the rule; i.e., what to do if the packet
matches it. The target can be a user-defined chain (other than the
one this rule is in), one of the special builtin targets which decide
the fate of the packet immediately, or an extension (see EXTENSIONS
below). If this option is omitted in a rule (and -g is not
used), then matching the rule will have no effect on the packet's fate,
but the counters on the rule will be incremented.
-g, --goto chain
This specifies that the processing should continue in a user specified
chain. Unlike the --jump option return will not continue processing
in this chain but instead in the chain that called us via --jump.
[!] -i, --in-interface name
Name of an interface via which a packet was received (only for packets
entering the INPUT, FORWARD and PREROUTING chains). When the
"!" argument is used before the interface name, the sense is inverted.
If the interface name ends in a "+", then any interface which begins
with this name will match. If this option is omitted, any interface
name will match.
[!] -o, --out-interface name
Name of an interface via which a packet is going to be sent (for
packets entering the FORWARD, OUT‐ PUT and POSTROUTING chains). When
the "!" argument is used before the interface name, the sense is
inverted. If the interface name ends in a "+", then any interface
which begins with this name will match. If this option is omitted, any
interface name will match.
[!] -f, --fragment
This means that the rule only refers to second and further IPv4
fragments of fragmented packets. Since there is no way to tell the
source or destination ports of such a packet (or ICMP type), such a
packet will not match any rules which specify them. When the "!"
argument precedes the "-f" flag, the rule will only match head
fragments, or unfragmented packets. This option is IPv4 specific, it is
not available in ip6tables.
-c, --set-counters packets bytes
This enables the administrator to initialize the packet and byte
counters of a rule (during INSERT, APPEND, REPLACE operations).
Objetivos¶
Cada cadena tiene su propia política por defecto, que se puede ver al mostrar las tablas. Para cambiarla se usa:
iptables [-t table] --policy chain target
La política por defecto es la que se utiliza si el paquete no coincide con ninguna regla.
Estos son algunos de los objetivos posibles, ver man iptables-extensions
:
ACCEPT: Deja pasar el paquete.
DROP: Descarta el paquete.
REJECT: Descarta el paquete y responde con un ICMP (unreachable port por defecto, pero se puede cambiar).
SNAT: Significa Source NAT. This target is only valid in the nat table, in the POSTROUTING and INPUT chains, and user-defined chains which are only called from those chains. It specifies that the source address of the packet should be modified (and all future packets in this connection will also be mangled), and rules should cease being examined. Generalmente se usa con la opción
--to-source [ipaddr[-ipaddr]][:port[-port]]
: Which can specify a single new source IP address, an inclusive range of IP addresses. Optionally a port range, if the rule also specifies one of the following protocols: tcp, udp, dccp or sctp. If no port range is specified, then source ports below 512 will be mapped to other ports below 512: those between 512 and 1023 inclusive will be mapped to ports below 1024, and other ports will be mapped to 1024 or above. Where possible, no port alteration will occur.
Ejemplo:
iptables -t nat -A POSTROUTING -o {interfaz WAN} -j SNAT --to {IP salida}
MASQUERADE: This target is only valid in the nat table, in the POSTROUTING chain. It should only be used with dynamically assigned IP (dialup) connections: if you have a static IP address, you should use the SNAT target. Masquerading is equivalent to specifying a mapping to the IP address of the interface the packet is going out, but also has the effect that connections are forgotten when the interface goes down. This is the correct behavior when the next dialup is unlikely to have the same interface address (and hence any established connections are lost anyway). La única opción interesante que tiene es:
--to-ports port[-port]
: This specifies a range of source ports to use, overriding the default SNAT source port-selection heuristics (see above). This is only valid if the rule also specifies one of the following protocols: tcp, udp, dccp or sctp.
Ejemplo:
iptables -t nat -A POSTROUTING -o {interfaz WAN} -j MASQUERADE
DNAT: Significa Destination NAT. This target is only valid in the nat table, in the PREROUTING and OUTPUT chains, and user-defined chains which are only called from those chains. It specifies that the destination address of the packet should be modified (and all future packets in this connection will also be mangled), and rules should cease being examined. Generalmente se usa con la opción:
--to-destination [ipaddr[-ipaddr]][:port[-port]]
Which can specify a single new destination IP address, an inclusive range of IP addresses. Optionally a port range, if the rule also specifies one of the following protocols: tcp, udp, dccp or sctp. If no port range is specified, then the destination port will never be modified. If no IP address is specified then only the destination port will be modified.
LOG: Turn on kernel logging of matching packets. When this option is set for a rule, the Linux kernel will print some information on all matching packets (like most IP/IPv6 header fields) via the kernel log (where it can be read with dmesg or read in the syslog). This is a «non-terminating target», i.e. rule traversal continues at the next rule. So if you want to LOG the packets you refuse, use two separate rules with the same matching criteria, first using target LOG then DROP (or REJECT).
--log-level level
: Level of logging, which can be (system-specific) numeric or a mnemonic. Possible values are (in decreasing order of priority): emerg, alert, crit, error, warning, notice, info or debug.--log-prefix prefix
: Prefix log messages with the specified prefix; up to 29 letters long, and useful for distinguishing messages in the logs.--log-tcp-sequence
: Log TCP sequence numbers. This is a security risk if the log is readable by users.--log-tcp-options
: Log options from the TCP packet header.--log-ip-options
: Log options from the IP/IPv6 packet header.--log-uid
: Log the userid of the process which generated the packet.


This is an Angular implementation for the d3 chart at: https://observablehq.com/@d3/zoomable-scatterplot


Here Be Dragons!
Guggenheim 2013 - Sold for $20,100
Deep Space Research
Berlin Art Festival 2015 - Sold for $7,400
The Stiggs (Original Album Artwork)
Amsterdam Albert Heijn - Sold for $10,000
Guggenheim 2013 - Sold for $20,100
Berlin Art Festival 2015 - Sold for $7,400
Amsterdam Albert Heijn - Sold for $10,000


Network Logs Help
As soon as you start an application that uses network protocols Holodeck begins
intercepting and logging all incoming and outgoing network messages. The Network
Logs pane shows a summary of the information having to do with that
packet.
Network Logs Links
Network Logs
Network
Message Details
Network
Corruption Fault
Tips
To see the complete network message select the Network log entry and view the
Network Message Details Pane.
Set a Network Corruption Fault with
the information learned in Network logs using the Network Corruption Wizard.
Export the
network log to a file by clicking File > Export Log to File…


{% extends "layout.html" %} {% from "tabs/macro.njk" import govukTabs %} {% block content %}
An interactive map of probation areas overlaid with local authority, prisons and police force areas to illustrate the changes form the probation reform programme.


ZooKeeper Java Example
A Simple Watch Client
To introduce you to the ZooKeeper Java API, we develop here a very simple watch client. This ZooKeeper client watches a ZooKeeper node for changes and responds to by starting or stopping a program.
Requirements
The client has four requirements:
-
It takes as parameters:
-
the address of the ZooKeeper service
-
then name of a znode - the one to be watched
-
an executable with arguments.
-
-
It fetches the data associated with the znode and starts the executable.
-
If the znode changes, the client refetches the contents and restarts the executable.
-
If the znode disappears, the client kills the executable.
Program Design
Conventionally, ZooKeeper applications are broken into two units, one which maintains the connection, and the other which monitors data. In this application, the class called the Executor maintains the ZooKeeper connection, and the class called the DataMonitor monitors the data in the ZooKeeper tree. Also, Executor contains the main thread and contains the execution logic. It is responsible for what little user interaction there is, as well as interaction with the exectuable program you pass in as an argument and which the sample (per the requirements) shuts down and restarts, according to the state of the znode.
The Executor Class
The Executor object is the primary container of the sample application. It contains both the ZooKeeper object, DataMonitor, as described above in Program Design.
// from the Executor class... public static void main(String[] args) { if (args.length < 4) { System.err .println("USAGE: Executor hostPort znode filename program [args ...]"); System.exit(2); } String hostPort = args[0]; String znode = args[1]; String filename = args[2]; String exec[] = new String[args.length - 3]; System.arraycopy(args, 3, exec, 0, exec.length); try { new Executor(hostPort, znode, filename, exec).run(); } catch (Exception e) { e.printStackTrace(); } } public Executor(String hostPort, String znode, String filename, String exec[]) throws KeeperException, IOException { this.filename = filename; this.exec = exec; zk = new ZooKeeper(hostPort, 3000, this); dm = new DataMonitor(zk, znode, null, this); } public void run() { try { synchronized (this) { while (!dm.dead) { wait(); } } } catch (InterruptedException e) { } }
Recall that the Executor's job is to start and stop the executable whose name you pass in on the command line. It does this in response to events fired by the ZooKeeper object. As you can see in the code above, the Executor passes a reference to itself as the Watcher argument in the ZooKeeper constructor. It also passes a reference to itself as DataMonitorListener argument to the DataMonitor constructor. Per the Executor's definition, it implements both these interfaces:
public class Executor implements Watcher, Runnable, DataMonitor.DataMonitorListener { ...
The Watcher interface is defined by the ZooKeeper Java API. ZooKeeper uses it to communicate back to its container. It supports only one method, process(), and ZooKeeper uses it to communciates generic events that the main thread would be intersted in, such as the state of the ZooKeeper connection or the ZooKeeper session.The Executor in this example simply forwards those events down to the DataMonitor to decide what to do with them. It does this simply to illustrate the point that, by convention, the Executor or some Executor-like object "owns" the ZooKeeper connection, but it is free to delegate the events to other events to other objects. It also uses this as the default channel on which to fire watch events. (More on this later.)
public void process(WatchedEvent event) { dm.process(event); }
The DataMonitorListener interface, on the other hand, is not part of the the ZooKeeper API. It is a completely custom interface, designed for this sample application. The DataMonitor object uses it to communicate back to its container, which is also the the Executor object.The DataMonitorListener interface looks like this:
public interface DataMonitorListener { /** * The existence status of the node has changed. */ void exists(byte data[]); /** * The ZooKeeper session is no longer valid. * * @param rc * the ZooKeeper reason code */ void closing(int rc); }
This interface is defined in the DataMonitor class and implemented in the Executor class. When Executor.exists() is invoked, the Executor decides whether to start up or shut down per the requirements. Recall that the requires say to kill the executable when the znode ceases to exist.
When Executor.closing() is invoked, the Executor decides whether or not to shut itself down in response to the ZooKeeper connection permanently disappearing.
As you might have guessed, DataMonitor is the object that invokes these methods, in response to changes in ZooKeeper's state.
Here are Executor's implementation of DataMonitorListener.exists() and DataMonitorListener.closing:
public void exists( byte[] data ) { if (data == null) { if (child != null) { System.out.println("Killing process"); child.destroy(); try { child.waitFor(); } catch (InterruptedException e) { } } child = null; } else { if (child != null) { System.out.println("Stopping child"); child.destroy(); try { child.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } } try { FileOutputStream fos = new FileOutputStream(filename); fos.write(data); fos.close(); } catch (IOException e) { e.printStackTrace(); } try { System.out.println("Starting child"); child = Runtime.getRuntime().exec(exec); new StreamWriter(child.getInputStream(), System.out); new StreamWriter(child.getErrorStream(), System.err); } catch (IOException e) { e.printStackTrace(); } } } public void closing(int rc) { synchronized (this) { notifyAll(); } }
The DataMonitor Class
The DataMonitor class has the meat of the ZooKeeper logic. It is mostly asynchronous and event driven. DataMonitor kicks things off in the constructor with:
public DataMonitor(ZooKeeper zk, String znode, Watcher chainedWatcher, DataMonitorListener listener) { this.zk = zk; this.znode = znode; this.chainedWatcher = chainedWatcher; this.listener = listener; // Get things started by checking if the node exists. We are going // to be completely event driven zk.exists(znode, true, this, null); }
The call to ZooKeeper.exists() checks for the existence of the znode, sets a watch, and passes a reference to itself (this) as the completion callback object. In this sense, it kicks things off, since the real processing happens when the watch is triggered.
Don't confuse the completion callback with the watch callback. The ZooKeeper.exists() completion callback, which happens to be the method StatCallback.processResult() implemented in the DataMonitor object, is invoked when the asynchronous setting of the watch operation (by ZooKeeper.exists()) completes on the server.
The triggering of the watch, on the other hand, sends an event to the Executor object, since the Executor registered as the Watcher of the ZooKeeper object.
As an aside, you might note that the DataMonitor could also register itself as the Watcher for this particular watch event. This is new to ZooKeeper 3.0.0 (the support of multiple Watchers). In this example, however, DataMonitor does not register as the Watcher.
When the ZooKeeper.exists() operation completes on the server, the ZooKeeper API invokes this completion callback on the client:
public void processResult(int rc, String path, Object ctx, Stat stat) { boolean exists; switch (rc) { case Code.Ok: exists = true; break; case Code.NoNode: exists = false; break; case Code.SessionExpired: case Code.NoAuth: dead = true; listener.closing(rc); return; default: // Retry errors zk.exists(znode, true, this, null); return; } byte b[] = null; if (exists) { try { b = zk.getData(znode, false, null); } catch (KeeperException e) { // We don't need to worry about recovering now. The watch // callbacks will kick off any exception handling e.printStackTrace(); } catch (InterruptedException e) { return; } } if ((b == null && b != prevData) || (b != null && !Arrays.equals(prevData, b))) { listener.exists(b); prevData = b; } }
The code first checks the error codes for znode existence, fatal errors, and recoverable errors. If the file (or znode) exists, it gets the data from the znode, and then invoke the exists() callback of Executor if the state has changed. Note, it doesn't have to do any Exception processing for the getData call because it has watches pending for anything that could cause an error: if the node is deleted before it calls ZooKeeper.getData(), the watch event set by the ZooKeeper.exists() triggers a callback; if there is a communication error, a connection watch event fires when the connection comes back up.
Finally, notice how DataMonitor processes watch events:
public void process(WatchedEvent event) { String path = event.getPath(); if (event.getType() == Event.EventType.None) { // We are are being told that the state of the // connection has changed switch (event.getState()) { case SyncConnected: // In this particular example we don't need to do anything // here - watches are automatically re-registered with // server and any watches triggered while the client was // disconnected will be delivered (in order of course) break; case Expired: // It's all over dead = true; listener.closing(KeeperException.Code.SessionExpired); break; } } else { if (path != null && path.equals(znode)) { // Something has changed on the node, let's find out zk.exists(znode, true, this, null); } } if (chainedWatcher != null) { chainedWatcher.process(event); } }
If the client-side ZooKeeper libraries can re-establish the communication channel (SyncConnected event) to ZooKeeper before session expiration (Expired event) all of the session's watches will automatically be re-established with the server (auto-reset of watches is new in ZooKeeper 3.0.0). See ZooKeeper Watches in the programmer guide for more on this. A bit lower down in this function, when DataMonitor gets an event for a znode, it calls ZooKeeper.exists() to find out what has changed.
Complete Source Listings
/** * A simple example program to use DataMonitor to start and * stop executables based on a znode. The program watches the * specified znode and saves the data that corresponds to the * znode in the filesystem. It also starts the specified program * with the specified arguments when the znode exists and kills * the program if the znode goes away. */ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.ZooKeeper; public class Executor implements Watcher, Runnable, DataMonitor.DataMonitorListener { String znode; DataMonitor dm; ZooKeeper zk; String filename; String exec[]; Process child; public Executor(String hostPort, String znode, String filename, String exec[]) throws KeeperException, IOException { this.filename = filename; this.exec = exec; zk = new ZooKeeper(hostPort, 3000, this); dm = new DataMonitor(zk, znode, null, this); } /** * @param args */ public static void main(String[] args) { if (args.length < 4) { System.err .println("USAGE: Executor hostPort znode filename program [args ...]"); System.exit(2); } String hostPort = args[0]; String znode = args[1]; String filename = args[2]; String exec[] = new String[args.length - 3]; System.arraycopy(args, 3, exec, 0, exec.length); try { new Executor(hostPort, znode, filename, exec).run(); } catch (Exception e) { e.printStackTrace(); } } /*************************************************************************** * We do process any events ourselves, we just need to forward them on. * * @see org.apache.zookeeper.Watcher#process(org.apache.zookeeper.proto.WatcherEvent) */ public void process(WatchedEvent event) { dm.process(event); } public void run() { try { synchronized (this) { while (!dm.dead) { wait(); } } } catch (InterruptedException e) { } } public void closing(int rc) { synchronized (this) { notifyAll(); } } static class StreamWriter extends Thread { OutputStream os; InputStream is; StreamWriter(InputStream is, OutputStream os) { this.is = is; this.os = os; start(); } public void run() { byte b[] = new byte[80]; int rc; try { while ((rc = is.read(b)) > 0) { os.write(b, 0, rc); } } catch (IOException e) { } } } public void exists(byte[] data) { if (data == null) { if (child != null) { System.out.println("Killing process"); child.destroy(); try { child.waitFor(); } catch (InterruptedException e) { } } child = null; } else { if (child != null) { System.out.println("Stopping child"); child.destroy(); try { child.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } } try { FileOutputStream fos = new FileOutputStream(filename); fos.write(data); fos.close(); } catch (IOException e) { e.printStackTrace(); } try { System.out.println("Starting child"); child = Runtime.getRuntime().exec(exec); new StreamWriter(child.getInputStream(), System.out); new StreamWriter(child.getErrorStream(), System.err); } catch (IOException e) { e.printStackTrace(); } } } }
/** * A simple class that monitors the data and existence of a ZooKeeper * node. It uses asynchronous ZooKeeper APIs. */ import java.util.Arrays; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.ZooKeeper; import org.apache.zookeeper.AsyncCallback.StatCallback; import org.apache.zookeeper.KeeperException.Code; import org.apache.zookeeper.data.Stat; public class DataMonitor implements Watcher, StatCallback { ZooKeeper zk; String znode; Watcher chainedWatcher; boolean dead; DataMonitorListener listener; byte prevData[]; public DataMonitor(ZooKeeper zk, String znode, Watcher chainedWatcher, DataMonitorListener listener) { this.zk = zk; this.znode = znode; this.chainedWatcher = chainedWatcher; this.listener = listener; // Get things started by checking if the node exists. We are going // to be completely event driven zk.exists(znode, true, this, null); } /** * Other classes use the DataMonitor by implementing this method */ public interface DataMonitorListener { /** * The existence status of the node has changed. */ void exists(byte data[]); /** * The ZooKeeper session is no longer valid. * * @param rc * the ZooKeeper reason code */ void closing(int rc); } public void process(WatchedEvent event) { String path = event.getPath(); if (event.getType() == Event.EventType.None) { // We are are being told that the state of the // connection has changed switch (event.getState()) { case SyncConnected: // In this particular example we don't need to do anything // here - watches are automatically re-registered with // server and any watches triggered while the client was // disconnected will be delivered (in order of course) break; case Expired: // It's all over dead = true; listener.closing(KeeperException.Code.SessionExpired); break; } } else { if (path != null && path.equals(znode)) { // Something has changed on the node, let's find out zk.exists(znode, true, this, null); } } if (chainedWatcher != null) { chainedWatcher.process(event); } } public void processResult(int rc, String path, Object ctx, Stat stat) { boolean exists; switch (rc) { case Code.Ok: exists = true; break; case Code.NoNode: exists = false; break; case Code.SessionExpired: case Code.NoAuth: dead = true; listener.closing(rc); return; default: // Retry errors zk.exists(znode, true, this, null); return; } byte b[] = null; if (exists) { try { b = zk.getData(znode, false, null); } catch (KeeperException e) { // We don't need to worry about recovering now. The watch // callbacks will kick off any exception handling e.printStackTrace(); } catch (InterruptedException e) { return; } } if ((b == null && b != prevData) || (b != null && !Arrays.equals(prevData, b))) { listener.exists(b); prevData = b; } } }


class RoutingResolveContext
Represents a context in which routing resolution is being performed
routing
- root node for resolution to start at
call
- instance of ApplicationCall to use during resolution
RoutingResolveContext(routing: Route, call: ApplicationCall)
Represents a context in which routing resolution is being performed |
val call: ApplicationCall |
|
val routing: Route |
|
val segments: List<String>
List of path segments parsed out of a call |
fun resolve(): RoutingResolveResult
Executes resolution procedure in this context and returns RoutingResolveResult |


Lots of great news from the Amazon AWS team. First of all there is now an SLA for their service. This in itself is very cool indeed, not because I don’t trust their uptime and their will to be up and running, but it just ads a little bit of accountability to the mix. 99.9% uptime is roughly an hour of downtime per year by the way. Not bad.
The one that excited me even more, and I am happy to quiz one of their evangelists when he comes over to cologne next month, is from an eWeek article:
Andy Jassy, senior vice president of Amazon Web Services, told the audience that the offering was currently working on static IP technology.
Wow!  I just really need one, and a way to manage which server gets that IP. Sure I could use some dyndns like service, or even Neustar Ultra Services or something but having one unique IP that is up and that can be bound to a load balancer would be great. Add WeoCeo and I am set. :)


Tesla Cybertruck Gets 2 Lakh Orders In 48 Hours [Update]
by Sahil KukrejaA total of 1,48,000 Tesla Cybertrucks have been booked already, confirmed the head of authority Elon Musk
Update: 25th Nov 1:15 PM
25th Nov 12:19 PM –
Earlier this week, Tesla revealed its Cybertruck concept, which is a six-seat pickup truck with three electric motors, armoured glass and a driving range of about 805 km. The internet was divided in terms of its design, but the pickup has surely generated quite a buzz in the market.
Tesla co-founder, product architect and CEO, Elon Musk confirmed that “1,46,000 orders have been made for the recently unveiled Cybertruck so far”, which is an impressive number considering the fact that it had only been 48 hours since the unveiling of the truck when the statement was made.
Musk further added that the brand was able to reach the number “with no advertising and no paid endorsement.” People were able to make the reservations for the Cybertruck with just a small $100 (Rs 7,165) deposit.
The Cybertruck was revealed with three different range variants – a single motor rear-wheel-drive variant with a range of 250 miles, a dual-motor all-wheel drive with a 300 miles range and a tri-motor all-wheel drive with a range of up to 500 miles on a single charge. The maximum number of bookings came from the dual motor variant (61,320), followed by the tri-motor version (59,860), and the single motor variant (24,820) respectively.
The Cybertruck features an unconventional angular shape, which is unlike any other pickup truck ever seen, with the only curved aspect on the truck being its tyres. It is made out of a heavy-duty exterior shell made from “ultra-hard 30X cold-rolled stainless steel” and uses the same alloy metal that is being used in Starship, the rocket SpaceX is developing to travel to Mars.
The Cybertruck comes with an adaptive air suspension along with Tesla’s Autopilot semi-self driving technology. The range-topping tri-motor Cybertruck would be able to reach the speed of 100 kmph in just 2.9 seconds and have a towing capacity of around 6,350 kg.
No launch date for the Tesla Cybertruck has been confirmed yet, but expect it to hit the markets by the end of 2021 at the earliest. The fully-electric pickup truck will have a starting price of $39,990 (Rs 28.65 lakh).


--- layout: default title: Ruby Monk link: http://rubymonk.com/ categories: [ruby] level: [beginner] instruction: [online] price: [free] image: ruby-monk.png --- The Ruby Primer is a free interactive book that helps you learn Ruby.
Discover Ruby idioms, learn lessons and solve problems, all in your browser!


Profile
Friends
Additional Information
Victor's friends
Sasho Georgiev
Network Administrator
Pencho Alexandrov
Web Designer
Gosho Penchev
PHP Developer


Sorry, this service requires JavaScript. Feel free to browse the files directly
here
, or visit the origin site for them at
https://developer.mozilla.org/en/CSS
or
Fork this on Github


These are some of my favorite websites to visit,
some of These sites are from 2006 and may not work but I always have a saved copy are a replica of the site.
The reason I love this website (more like app) is because is allows you to do almost anything and everything with enought time and creativity.
Its sandbox that i played with during my free time all thoughout elementary and some of junior high.
I probably use this app more than any other website on a day to day basis.
I mostly use Youtube to watch and listen to japanpod 101, and other content creators.
| Content type | Content creator | Content I watch |
|---|---|---|
| Gaming | Markipler | 3 Scary Games |
| gaming | Get Good Gaming | GTA |
| educational | Japanpod 101 | Learn Japanese |
| music | 1-Hour Nation | Music On Repeat |
| Sports | STORROR | Parkour |
Spotify is just a good app/website to listen to music/podcasts in the background without having to worry about switching to a new playlist.


Maturity Amount :
Rs. {maturity amount}
Interest Earned :
Rs. {interest}
Yearly PF balance and interest
Year
Deposit
Balance
Interest
1
{deposit}
{balance}
{interest}


Python Unit Testing¶
Unit tests are absolutely essential. It’s very difficult to consider any feature as complete without automated unit tests.
We have several ways to tackle unit tests for our application, shown below:
We can create
unittest.TestCase
class definitions.We can include examples in the docstrings. These are called doctest examples.
We can write test functions. These tend to be simpler than the
unittest.TestCase
classes.
We have three sets of tools available, shown below:
The
unittest
tool can only processunittest.TestCase
class tests.The
doctest
tool can only process doctest examples in docstrings.The
pytest
tool can comfortably find and process all three kinds of of unit tests.
We suggest always using pytest
because it’s slightly easier and more comprehensive
in what it can do. We’ll describe both kinds of tests. Some developers
find it slightly easier to write test functions.
In Using Unit Tests we’ll look at an overall development process that leverages unit tests as a way to write testable specifications.
We’ll show a small class which to be tested in Example Class Definition.
We’ll look at a unittest.TestCase
example in Example TestCase classes.
We’ll also look at pytest functions in Example Test Function.
In Python doctest Testing we’ll look at how we can execute the test cases in the document strings of a module, class, function, or method.
In Building Doctest Examples we’ll show how we can take interactive Python output and transform it into a doctest example. This will involve copy and paste. It’s not too challenging.
In the next section we’ll overview how to structure our work around failing and passing test cases.
Using Unit Tests¶
One approach to unit testing is to build the tests first, then write a class which at least doesn’t crash, but may not pass all the tests. Once we have this in place, we can now debug the tests until everything looks right. This is called test-driven development. This is called “Test-Driven Development” (TDD) because testing drives everything.
This can be difficult in practice. In many cases, we want to work back and forth between our target code and the unit tests for that code. When we’re learning a language or a design pattern, it can be difficult to write the tests first.
Generally, the process for creating a class with the unit tests has the following outline.
Write a skeleton for the class that will be the unit under test. Initially, the class doesn’t really need to do anything. It only has to exist so the tests can run.
Write the test case. This will create instances of the class under test, exercise those instances, and make assertions about the state of those instances. The test class may create mocks for the various collaborators of the target class.
Run the test, knowing that the first few attempts will fail.
While at least one test is failing.
Fix the broken things.
Run the test suite.
At this point, the class under test passes the suite of tests. However, it may still fail to meet other quality criteria. For example, it may have a convoluted structure, or it may be inefficient, or it may lack appropriate documentation. In any case, we’re not really done with development.
While our target class fails to meet our quality standards.
Refactor to correct the quality problems in our target class.
Run the test suite. If we have refactored properly, the tests still pass. If we have introduced a problem, tests will fail.
The failing tests help us develop new code. Once the tests pass, we can refactor and fine-tune the application knowing that a change didn’t break anything that used to work.
In the next section we’ll look at an example test using the
unittest.TestCase
definitions.
Example Class Definition¶
As an example, we’ll rework the hw.py
module in the src
directory. The revision
will make a more complete application.
"""
A hello world to be sure all our tools work.
"""
from dataclasses import dataclass
@dataclass
class Greeting:
greeting: str
audience: str
def __str__(self) -> str:
return f"{self.greeting} {self.audience}"
def main() -> None:
g = Greeting("hello", "world")
print(g)
if __name__ == "__main__":
main()
We’ve defined a class and a function.
We’ve also put the top-most code into an __name__ == "__main__"
block.
This block will only be executed when we run the module
directly. If the module is imported, it won’t do anything
automatically, making it much easier to test.
Example TestCase classes¶
This goes into a file called tests/test_hw_1.py
. The
_1
suffix is a hint that we’ll write a second set of test
cases below, and we’ll use a different suffix.
The test module will have two test cases:
The
TestGreeting
class will tet theGreeting
class. This is is relatively clear because there are no dependencies in theGreeting
class.The
TestMain
class will test themain()
function. This is more complex because the function depends onGreeting. A unit test should isolated from dependencies, which means a patch and a mock object must be used. Further, the :func:`main
function writes to stdout via theprint()
function.
We’ll decompose the example into three separate sections. First, the imports look like this:
from io import StringIO
from unittest import TestCase
from unittest.mock import Mock, patch
import hw
The test for the Greeting
class creates an instance of
the class, and then confirms the value of the str()
function
uses the Greeting.__str__()
method.
class TestGreeting(TestCase):
def test(self):
g = hw.Greeting("x", "y")
self.assertEqual(str(g), "x y")
The test for the main()
function is a bit more complex. The
TestMain.setUp()
method creates a mock for the Greeting
class. The top-level Mock
instance behaves like a class
definition. When it is called as a function it returns an mock
object that behaves as an instance of the class; it’s named "Greeting instance"
to clarify the role it plays.
The instance mock provides an easy-to-spot response to the __str__()
method.
This will make it easier to confirm that the str()
was used appropriately.
class TestMain(TestCase):
def setUp(self):
self.mock_greeting = Mock(
name="Greeting", return_value=Mock(
name="Greeting instance",
__str__=Mock(return_value="mock str output")
)
)
self.mock_stdout = StringIO()
def test(self):
with patch('hw.Greeting', new=self.mock_greeting):
with patch('sys.stdout', new=self.mock_stdout):
hw.main()
self.mock_greeting.assert_called_with('hello', 'world')
self.mock_greeting.return_value.__str__.assert_called_with()
self.assertEqual("mock str output\n", self.mock_stdout.getvalue())
The patch()
function is used to make two changes inside the hw
module.
The
hw.Greeting
class is replaced with theself.mock_greeting
object. This means themain()
function will interact with the mock object, allowing the test to confirm themain()
function made valid requests.The
sys.stdout
object is replaced with an instance ofio.StringIO
. This object will collect output destined to standard output so it can be examined in the test.
The test()
method confirms the mock objects were all used properly
by the main()
function:
The mocked
Greeting
class was called with the expected arguments.The mocked
Greeting
instance had theGreeting.__str__()
method called with no arguments.The output sent to stdout was the output from the
Greeting.__str__()
method.
This test exercises a service, the Greeting
class, and a client of that
service, the main()
function. Because the function has a direct dependence
on the service class, we’re forced to use patch()
to inject a different dependency
for testing.
Example Test Function¶
This goes into a file called tests/test_hw_2.py
. The
_2
suffix separates these tests from the tests defined above
using unittest.TestCase
.
The test module will have two test cases:
The
test_greeting()
function will tet theGreeting
class.The
test_main
function will test themain()
function. This is more complex because the function depends onGreeting. A unit test should isolated from dependencies, which means mock objects must be used. Further, the :func:`main
function writes to stdout via theprint()
function, and this output needs to be captured.
We’ll decompose the example into three separate sections. First, the import look like this:
from io import StringIO
from unittest.mock import Mock
import pytest
import hw
The test for the Greeting
class looks like this:
def test_greeting():
g = hw.Greeting("x", "y")
assert str(g) == "x y"
As with the unittest.TestCase
example, the test is a exercises
the class to confirm the expected behavior.
Unlike the unittest.TestCase
class, we use the built-in assert
statement when working with the pytest
tool.
The mock object created for use with the pytest
tool is a
complete repeat of the example Mock
object shown above.
The unittest.mock
module is used both by the pytest
tool
as well as the unittest
tool.
The @pytest.fixture
decoration is used to identify functions
that create test fixtures. In this case, the fixture is a Mock
object that can be shared by multiple tests.
@pytest.fixture
def mock_greeting(monkeypatch):
greeting = Mock(
name="Greeting", return_value=Mock(
name="Greeting instance",
__str__=Mock(return_value="mock str output")
)
)
monkeypatch.setattr(hw, 'Greeting', greeting)
return greeting
def test_main(mock_greeting, capsys):
hw.main()
mock_greeting.assert_called_with('hello', 'world')
mock_greeting.return_value.__str__.assert_called_with()
out, err = capsys.readouterr()
assert out == "mock str output\n"
The test for the main()
function is similar in many respects
to the unittest.TestCase
version. The test asserts that
the mock was used correctly, and it examines the captured standard output.
The mock_greeting
and capsys
parameters are supplied automatically
by the pytest
tool when the test is run. The mock_greeting
value will
be the results of the mock_greeting()
fixture. The capsys
value
will be a built-in fixture that captures the sys.stdout
and sys.stderr
output for the test.
Running Pytest¶
We can run the tests with the following command.
PYTHONPATH=src python -m pytest tests
The pytest
tool will find all of the files with names starting with test_
.
Any unittest.TestCase
classes will be processed.
Any functions with names starting with test_
will also be processed.
This one tool lets us use either style of testing. After looking
at the very sophisticated unittest
tool and pytest
tool,
the next section will look at the doctest
tool. This tool
has some limitations, and doesn’t support comprehensive tests. It
is, however, so easy to use that it can be the first thing
we turn to.
Python doctest Testing¶
Python doctest
module requires us to put our test cases
and expected results into the docstring comments on a class, method
or function. Since we’re going to write docstring comments, and
we’re going to provide examples, there’s very little overhead to this testing.
The test case information becomes a formal part of the API documentation. When a docstring includes doctest comments, the string serves dual duty as formal test and a working example.
Workflow.
To use doctest
is to build the class, exercise it in the
Python interpreter, then put snippets of the interactive log into our
docstrings.
Generally, we follow this outline.
Write and debug the class, including docstring comments.
Exercise the class in an interactive Python interpreter.
Copy the snippets out of the interactive log. Paste them into the docstring comments.
Run doctest to be sure that you’ve copied and pasted correctly.
Example. This is an example of what a module with doctest docstrings looks like.
Module with doctest examples.
"""
Superclass for cards.
>>> c2d = Card(2, Card.Diamonds)
>>> str(c2d)
' 2♢'
>>> c2d.softValue
2
>>> c2d.hardValue
2
"""
Clubs = u"\N{BLACK CLUB SUIT}"
Diamonds = u"\N{WHITE DIAMOND SUIT}"
Hearts = u"\N{WHITE HEART SUIT}"
Spades = u"\N{BLACK SPADE SUIT}"
Jack = 11
Queen = 12
King = 13
Ace = 1
def __init__(self, rank: int, suit: str) -> None:
assert suit in (Card.Clubs, Card.Diamonds, Card.Hearts, Card.Spades)
assert 1 <= rank < 14
self.rank = rank
self.suit = suit
self.order = rank
@property
def hardValue(self) -> int:
return self.rank
@property
def softValue(self) -> int:
return self.rank
Running Doctest¶
There are two ways to use doctest: you can run it directly,
or use it as part of pytest
.
Running Doctest from the Command Line
python -m doctest -v code/blackjack_doctest.py
This runs doctest and examines the specific module for comments that can be taken as useful examples.
Running Doctest via Pytest
python -m pytest --doctest-modules code/blackjack_doctest.py
The --doctest-modules
option is used to examine all of the
modules named for doctest examples. This can be done for the
entire src
directory.
Building Doctest Examples¶
Let’s assume we’ve built two classes; for example, Card
and Deck
.
One class defines a standard
playing card and the other class deals individual card instances. We’ll
define some minimal doctests.
The first step is to develop our baseline class. See Example Class Definition
for a version of the blackjack module with the Card
class definition
that we might start with.
Exercise the Class. Once we have the class, we need to exercise it using interactive Python. Here’s what we saw.
MacBookPro-SLott:OODesign-3.1 slott$ python3
Python 3.7.4 (default, Aug 13 2019, 15:17:50)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from blackjack import Card, AceCard, FaceCard
>>> c2d = Card(2, Card.Diamonds)
>>> str(c2d)
' 2♢'
>>> cas = AceCard(Card.Ace, Card.Spades)
>>> str(cas)
' A♠'
>>> cas.softValue
11
During our session, we played with the preferred use cases for our class. We can copy the examples from the interactive session and paste them into our class docstrings.
Update the Docstrings.
After we have some output that shows correct behavior of our class, we
can put that output into the class docstrings. Here’s our updated card.py
module with doctest comments.
blackjack.py With Doctests Included
>>> str(cas)
' A♠'
>>> cas.softValue
11
"""
def __init__(self, rank: int, suit: str) -> None:
assert rank == 1
super().__init__(rank, suit)
self.order = 14 # above King
def __str__(self) -> str:
return f" A{self.suit}"
@property
def hardValue(self) -> int:
return 1
@property
def softValue(self) -> int:
return 11
We’ve only shown the docstrings from two classes within the overall module file.
In both cases, we’ve copied and pasted lines from
an interactive session to show show the class definitions
shold behave. When we process this module with
doctest
we can confirm that the advertised behavior
matches the actual behavior of the classes.
Handling Dependencies¶
Let’s assume we’ve built two classes in some chapter; for example, we’re building
Card
and Deck
. One class defines a standard
playing card and the other class deals individual card instances. We
need unit tests for each class.
Generally, unit tests are taken to mean that a class is tested in
isolation. In our case, a unit test for the Card
class is completely isolated because
it has no dependencies.
However, our Deck
class depends on the Card
class, leading us to make a choice
between the following two alternatives:
Create a
Mock
object to stand in for theCard
class. This lets us test theDeck
class in complete isolation. Doing this means we either usepatch()
(ormonkeypatch.setattr()
), or we design theDeck
class so it doesn’t have a direct dependency onCard
.Test the
Deck
class knowing it depends on theCard
class. In this case we haven’t isolated the two classes, pushing the edge of the envelope on one of the ideas behind unit testing. It’s not clear that this is utterly evil, however. It’s acceptable when we can create an integrated test of theDeck
class which also tests all of the features of theCard
class.
The choice depends on the relative complexity of the Card
class,
whether or not the Deck
class and Card
class will evolve independently,
and whether or not we can test all of the Card
class and Deck
class.
Some folks demand that all testing be done in “complete” isolation with
Mock
objects. In order to reduce the number of patches, we need to consider
ways of making the the two classes independent. We could, for example, provide
the Card
class as a parameter to the Deck
class, removing
the implicit dependency, and making testing simpler.
Looking Forward¶
Programming involves writing application code as well as test code. In many cases, we’ll write a great deal of test code for relatively small – but important – pieces of application code.
It helps to have an easy-to-use testing tool. The pytest
tool
makes it easy to run a complete suite of unit tests, confirming that
everything we write behaves as we expected.
In the next chapter we’ll look at one of the other important parts
of creating trusted, high-quality code: the documentation. While a simple
README.rst
is helpful, using the sphinx
tool produces
more complete, and easier to use documentation with relatively little work.


Bad and Wrong
`Prev `__
B
`Next `__
--------------
**Bad and Wrong**: adj.
[Durham, UK] Said of something that is both badly designed and wrongly
executed. This common term is the prototype of, and is used by contrast
with, three less common terms — Bad and Right (a kludge, something ugly
but functional); Good and Wrong (an overblown GUI or other attractive
nuisance); and (rare praise) Good and Right. These terms entered common
use at Durham c.1994 and may have been imported from elsewhere; they are
also in use at Oxford, and the emphatic form “Evil and Bad and Wrong”
(abbreviated EBW) is reported from there. There are standard
abbreviations: they start with B&R, a typo for “Bad and Wrong”.
Consequently, B&W is actually “Bad and Right”, G&R = “Good and Wrong”,
and G&W = “Good and Right”. Compare `*evil and
rude* <../E/evil-and-rude.html>`__, `*Good
Thing* <../G/Good-Thing.html>`__, `*Bad Thing* `__.
--------------
+------------------------+----------------------------+------------------------------+
| `Prev `__ | `Up <../B.html>`__ | `Next `__ |
+------------------------+----------------------------+------------------------------+
| BAD | `Home <../index.html>`__ | Bad Thing |
+------------------------+----------------------------+------------------------------+


Giampaolo needed more time - Bonera
by BeSoccerDaniele Bonera described how there is "never much time" at AC Milan, where Marco Giampaolo was given just seven games as coach.
Marco Giampaolo needed more time to have a genuine chance of implementing his plans for AC Milan, according to assistant coach Daniele Bonera.
Milan sacked Giampaolo following a 2-1 win over Genoa in October, his seventh match in charge. The former Sampdoria boss presided over three victories and four defeats before the Rossoneri rushed to appoint Stefano Pioli – a move that, so far, has failed to lead to an upturn in the team's fortunes. Pioli has led the team to four points from five games since his arrival, with their solitary triumph coming at home to lowly SPAL.
Featured links
- Ballon d'Or winner already been decided
- The latest football transfers news and rumours
- Possible 'Clasico' in the Spanish Supercup final
- Who has the most free-kicks goals: Messi or Cristiano?
"In a few months, two coaches arrived with different working methods, two ways of thinking on a defensive level," Bonera, an assistant under both coaches, told La Gazzetta dello Sport. "With Giampaolo, we thought more about the ball. With Pioli, we are more practical and we work on the positioning of players. Giampaolo did not have the time he needed, but at a club like Milan there is never much time."
Asked about the players, Bonera said: "I see guys who are very committed. Many are really young, in their twenties. It takes time. We need patience, which is a rare commodity in football. We are trying to do better every day. I've never seen any of the players holding back because of fatigue."
Milan's problems could grow further if Ligue 1 side Paris Saint-Germain launch a January bid to sign goalkeeper Gianluigi Donnarumma, as has been rumoured in recent days. Bonera, who made over 150 Serie A appearances for Milan during his nine-year spell with the club as a player, recommends the 20-year-old Donnarumma remains with his boyhood club.
"As a fan and someone in love with Milan, I would recommend he stay with us," Bonera said. "But he has staff and family who advise him."


Jean de Dieu Makiese (May 28, 1952 – August 11, 2007), popularily known as Madilu System, was a Soukous singer and songwriter born in Léopoldville, Belgian Congo. He was once a member of T.P.O.K Jazz which dominated African popular music in the 1960s, 1970s and 1980s.
Madilu was 19 when he started his career in Kinshasa’s thriving music scene in 1969. Over the next fifteen years he sang with Orchestre Symba, Papa Noel’s Orchestre Bambula, Sam Mangwana’s Festival des Maquisards and his own Orchestre Bakuba Mayopi, but his career thus far neither revealed nor promised anything out of the ordinary (in an extraordinary milieu). It was Franco who made a star of Madilu System (as the big man had dubbed him). "Mamou (Tu Vois)," the record that introduced the new T.P.O.K. Jazz singer, was a hit in 1984. Madilu followed that up with his own composition for the band, "Pesa Position." Then came "Mario" and "Reponse de Mario" in ‘85 and perhaps the best of the Franco-Madilu duets, "La Vie des Hommes" in ’86.
Congo has bred singers with more impressive range, more force or sweeter tone than Madilu, but very few who sang with his expressiveness, his ability to vivify character with his voice. It was this quality that Franco appreciated so well. He and Madilu shared the lead vocals on many of Franco’s story-songs, Franco singing the narrative and Madilu assuming the role of the protagonist.
When Franco died in 1989, T.P.O.K. Jazz ceased making music for one year, then came together again with Madilu as one of the leaders. In the ensuing years he was a key participant in several of the band’s reunions on stage and in the studio, but at the same time he established himself as an independent artist. Of all the T.P.O.K. Jazz veterans, perhaps only Sam Mangwana had a stronger solo career than Madilu – and Madilu, unlike Sam, never lost his huge fan base in Kinshasa, even while he lived in Paris and Geneva.
Below are some video links


Wrekin candidate seeks out student vote
by Mark AndrewsAn election hopeful was targeting the student vote when he visited a college to spread his party's message.
Dylan Harrison, who is challenging The Wrekin seat for Labour, was outside Telford College's Haybridge campus in Wellington speaking to students as they headed into their lectures.
"It was great to meet with students at Telford College this morning," he said.
"I am trying to meet as many people across the constituency as possible during the campaign.
"We had a good reception from students and encouraged as many as possible to register to vote.
"Students are concerned about their future employment and about the impact of climate change."
Mr Harrison will be challenging Conservative Mark Pritchard, who has held the seat since 2005.
Mr Pritchard will be defending a majority of 9,564. Also standing will be Liberal Democrat Thomas Janke.


Testing results for the oneM2M ontology.
The following table lists the oneM2M ontology requirements and it satisfies them.
There are four possible results for each requirement:
| Identifier | Category | Competency Question | Result |
|---|---|---|---|
| oneM2M-1 | Thing | A thing is an entity that can be identified in the oneM2M System. | |
| oneM2M-2 | Thing | A thing may have properties | |
| oneM2M-3 | Thing | A thing can have relations to other things | |
| oneM2M-4 | Aspect | An aspect could be a (physical or non-physical) entity or it could be a quality | |
| oneM2M-5 | Aspect | An aspect can have metadata | |
| oneM2M-6 | Metadata | Metadata contain data (like units, precision-ranges) about a variable or about an aspect | |
| oneM2M-7 | Device Network | A device is a thing that is able to interact electronically with its environment via a network | |
| oneM2M-8 | Device | A device may be a physical or non-physical entity | |
| oneM2M-9 | Device Task | A device performs one or more functionalities in order to accomplish a particular task | |
| oneM2M-10 | Device Service | A device has one or more services that expose in the network its functionalities | |
| oneM2M-11 | Device | A device can be composed of several (sub-)devices | |
| oneM2M-12 | Accessibility | An interworked device is a device that does not support oneM2M interfaces and can only be accessed from the oneM2M System by communicating with a proxied (virtual) device that has been created by an interworking proxy entity | |
| oneM2M-13 | Accessibility Communication Protocol | An interworked device is part of an area network | |
| oneM2M-14 | Accessibility | An area network is a network that provides data transport services between an interworked device and the oneM2M System | |
| oneM2M-15 | Accessibility | An area network follows an standard that defines its physical properties | |
| oneM2M-16 | Accessibility Communication Protocol | An area network follows a communication protocol | |
| oneM2M-17 | Profile Accessibility | An area network follows a profile | |
| oneM2M-18 | Service Function | A service is an electronic representation of a functionality in a network | |
| oneM2M-19 | Service Function | A service can expose one or more functionalities | |
| oneM2M-20 | Service | A service can be composed of independent (sub-)services | |
| oneM2M-21 | Service | A service has an operation | |
| oneM2M-22 | Service | A service has an input data point | |
| oneM2M-23 | Service | A service has an output data point | |
| oneM2M-24 | Function Task | A functionality represents the functionality necessary to accomplish the task for which a device is designed | |
| oneM2M-25 | Function User | A functionality has commands that allow human users to influence/observe such functionality | |
| oneM2M-26 | Function | A controlling functionality represents a functionality that has impacts on the real world, but does not gather data | |
| oneM2M-27 | Function | A measuring functionality represents a functionality that has no impacts on the real world, but only gathers data | |
| oneM2M-28 | Operation | An operation is the means of a service to communicate in a procedure-type manner over the network (i.e. transmit data to/from other devices) | |
| oneM2M-29 | Operation | An operation is the -machine interpretable- exposure of a -human understandable- command to a network | |
| oneM2M-30 | Operation | An operation may receive input data from input data points (persistent entities) | |
| oneM2M-31 | Operation | An operation may receive data from operation inputs (transient entities that are deleted when the operation finishes) | |
| oneM2M-32 | Operation | An operation may produce output data into output data points (persistent entities) | |
| oneM2M-33 | Operation | An operation may produce data into operation outputs (transient entities that are deleted when the operation finishes) |
The following table summarises the metrics related to the oneM2M ontology
| Metric | Result |
|---|---|
| Percentage of covered requirement | 96.96% |
| Percentage of requirements with terms that are undefined in the ontology | 3.04% |
| Percentage of requirements that lead to conflict | 0% |
| Percentage of tested terms | 71.42% |


Before Change
from django.test import TestCase
from django.utils.six import StringIO
out = StringIO()
try:
call_command("create_qn_target", organism="homo_sapiens", min=1, stdout=out)
except SystemExit as e: // this is okay!
pass
stdout = out.getvalue()
self.assertTrue("Target file" in stdout)
path = stdout.split("\n")[0].split(":")[1].strip()
self.assertTrue(os.path.exists(path))
self.assertEqual(path, utils.get_most_recent_qn_target_for_organism(homo_sapiens).absolute_file_path)
After Change
experiment.organism_names = [homo_sapiens.name]
experiment.save()
// We don"t have a 0.tsv
codes = [str(i) for i in range(1, 201)]
for code in codes:
sample = Sample()


Razer Synapse Cloud Based Driver Software
Razer Synapse 2 0 Software Demonstration Youtube
Razer Software
Razer Synapse Download 2021 Latest For Windows 10 8 7
Download Razer Synapse 3 6 0415 040812
Razer Synapse 2 0 Download Archives Razer Drivers
Cloud Based Hardware Configuration Razer Synapse 3
Fixed Razer Synapse Not Detecting Mouse Keyboard Driver Easy
When Will My Mouse Be Supported By The Synapse 3 0 Razer
Synapse 2 0 Software Updates For The Razer Naga Youtube
Razer Synapse 3 6 0415 040812 For Windows Download
Razer Synapse 2 2 Download Free Rzsynapse Exe
Download Razer Synapse 2 0 Msi For Free
Download Razer Synapse 2 0
How To Control The Lighting Of Your Razer Peripherals The Verge
Razer Synapse 3 Mac Pressfasr
Razer Deathadder Chroma Review Software Performance
Razer Synapse 2 0 Download For Windows Mac Razer Drivers
Mac Os Support In Synapse 2 0 And Synapse 3
Razer Synapse 2 0 Download Codilap
Razer Synapse 2 0 Keyboard Mac Archives Razer Drivers
Https Encrypted Tbn0 Gstatic Com Images Q Tbn And9gcqnvsiniycke Xqkjo4pkrzam11ltx0glcq3fy X4ish4pp5ez7 Usqp Cau
New Razer Chroma Keyboard Configurator For Synapse 2 0 Colors Effects Youtube
How To Perform A Clean Re Installation Of Razer Synapse 3 2 0 On Windows
Razer Synapse 2 0 Cloud Based Driver Software Razer Australia
Razer Chroma Headset Setup Archives Razer Drivers
Razer Chroma Workshop Get The Most Out Of Your Chroma Devices
Razer Synapse 2 0 Complete Walkthrough And Tutorial On All Content Youtube


Don't have a password yet?
If you don't have a password yet, stop by the Library counter the next time you're in College. We'll happily set one up for you.
Don't have a staff ID card?
If you don't have a staff ID card, please come and see us and we can provide you with one. Remember to bring some proof of ID.


Accordion One
Add content of your choice here.
Accordion Two
Add content of your choice here.
Accordion Three
Add content of your choice here.
Accordion Four
Add content of your choice here.


Login boostrap
Home
Contact
History
Account Type
Business
Personal
Bootstrap
@
M tech solution
Delivering Cost-Effective Solutions
%50 discount
To get %50 discount use coupon code ASD3D23
Free Tech solution
Contact us!
Previous
Next
Hover
Hover


|
Separates the source value in the ST(0) register into its exponent and mantissa, stores the exponent in ST(0), and pushes the mantissa onto the register stack. Following this operation, the new top-of-stack register ST(0) contains the value of the original mantissa expressed as a floating-point value. The sign and mantissa of this value are the same as those found in the source operand, and the exponent is 3FFFH (biased value for a true exponent of zero). The ST(1) register contains the value of the original operand's true (unbiased) exponent expressed as a floating-point value. (The operation performed by this instruction is a superset of the IEEErecommended logb(x) function.) This instruction and the F2XM1 instruction are useful for performing power and range scaling operations. The FXTRACT instruction is also useful for converting numbers in double extended-precision floating-point format to decimal representations (e.g., for printing or displaying).
If the floating-point zero-divide exception (#Z) is masked and the source operand is zero, an exponent value of -infinite is stored in register ST(1) and 0 with the sign of the source operand is stored in register ST(0).
|


Rosemary Duhaime
Democrat
Real estate agent, System Application Specialists (telecom), 2020 CFS (Census Field Supervisor)
BA Journalism, BA History, TEFL certified
80134
I have always been pretty politically active, volunteering for candidates for national, state and local elects.
donated to ACLU, ACT Blue, and many Democratic candidates for National and State office, including outside of Colorado. Probably donated to MoveOn, but don't remember for sure, did donate to The Lincoln Project. Have signed petitions for Planned Parenthood, Sierra Club
I donate to many organizations (see above) but actually being a member? I get the ACLU newsletter, but not sure I "belong" to this organization. I don't go to meetings or even read about meetings
I believe Colorado (and every state in the union) needs INDEPENDENT redistricting committees, to get better representation in our government, be it National, or Local governments.
While I am a registered Democrat, I have changed my party affiliation to Unaffiliated/Independent at times because I feel Independent in my political beliefs. As a small business owner, I do see many concerns of the GOP and I have voted for Republican candidates many times in my life.
As a parent of 4 children, 2 biological and 2 internationally adopted bi-racial children, I have had to analyze issues for complex healthcare decisions (for a special needs child) social issues, academic, budgetary and management issues for a household and family. I have had to be the best role model possible. As a real estate agent, I must be exact in my written and verbal communications with clients and other agents as well as title representatives, home inspectors, mortgage officers, appraisers, repair technicians as well as all the clerks and assistants who are gate keepers. In addition, I must ensure my business is efficient with budgeting, advertising, marketing, navigating potential legal challenges with critical and challenging deadlines. As a technician working in remote diagnostics in telecommunications, I had to myself analyze and troubleshoot and repair software, hardware as well as human error. Furthermore, I had to do the same analyzing, troubleshooting and repair with an onsite technician as my eyes and ears with hardware and client waiting for critical services to be resumed. All these traits required applying logical thinking, following logical paths and laying out a plan of action that would be successful for all parties at hand, whether customers, employers, engineers, teachers, administrators or other parents.
Female


The Dependently Typed Revolution
Proving your programs are correct with dependent types
Andrew Miller -<EMAIL_ADDRESS>https://github.com/A1kmm
https://rea.to/careers
Properties and Propositions
natToString : Nat → String
Properties and Propositions
natToString : Nat → String
stringToNat : String → Maybe Nat
Properties and Propositions
natToString : Nat → String
stringToNat : String → Maybe Nat
forall a in Nat. stringToNat (natToString a) = Just a
Properties and Propositions
natToString : Nat → String
stringToNat : String → Maybe Nat
forall a in Nat. stringToNat (natToString a) = Just a
prop : Nat → Bool
prop a = stringToNat (natToString a) == Just a
Formal Verification and Certified Software
forall a in Nat, a > 0, b in Nat, b > 0,
c in Nat, c > 0, n in Nat, n > 2:
an + bn ≠ cn
Proposition stated 1637
Proved 1994
Curry-Howard Correspondence
Photograph of Haskell Curry
Image credit: Gleb Svechnikov. Licensed under Creative
Commons – By – Share Alike
Curry-Howard Correspondence
| Typed Lambda Calculus |
Mathematical Logic |
Example |
| Type | A proposition |
x : Nat ↔ There exists at least one natural number |
| Value | A proof |
x = 1 (I have proved that there exists a natural number by supplying an example, 1). |
Traditional Type Systems
Dependent Types in Idris
data Vec : Nat -> Type -> Type where
MkVec : (l : List a) -> Vec (length l) a
myVec : Vec 5 Nat
myVec = MkVec [1, 2, 3, 4, 5]
Minesweeper as an Example Problem
https://github.com/A1kmm/proofsweeper
Haskell Web Application Interface
http4idris HttpEngine
http4idris HttpEngine
Sharing knowledge with guilds
Questions?
Get in touch<EMAIL_ADDRESS>ProofSweeper: https://github.com/A1kmm/proofsweeper
http4idris: https://github.com/A1kmm/http4idris
REA Tech blog: https://rea.to/techblog
Find out about working at REA: https://rea.to/careers


We are proud that TruLabz has associated with us as Workshop Outreach Partner.
They are an emerging training startup lead by highly experienced professionals who unfold various industry chapters and worked with reputable organizations like IIT Bombay, IIT Gandhinagar, IIT Roorkee, IIST, Eureka and many more.
They will be conducting various workshops at several colleges and the final contest for the workshops' winners, will be held at ηvision IITH on November.
For more details: Click Here
For Associations
Ramoji Rao
Marketing Manager
<EMAIL_ADDRESS>Niranjan
Soumitra Khanale
B V Dinesh


 When a person goes to a web page like their computer sends a HTTP Request to a server. The server finds the appropriate HTML document and sends it back to the user's computer where a web browser interprets the page and displays it on the user's screen. This video does a good job of explaining.
HTML stands for Hypertext Markup Language. HTML documents form the majority of the content on the web. HTML documents contain text content which describes "what you see" and markup which describes "how it looks". This video gives a good overview.
 This makes them very unforgiving since a small mistake by a programmer can cause huge problems in a program.
HTML elements are either inline or block. Block elements form an "invisible box" around the content inside of them.


What is an Arduino?
Why would I use an Arduino?
What can I use an Arduino for?
How can I get started?
Open Source
Microcontroller board with addressable GPIO pins
Various form factors depending on need
Communicates with electronics using GPIO pins
General Purpose Input and Output
Can be used to receive and transmit current to electronic components
Can also be used to pass messages to serial input
Are how the Microcontroller talks to the outside world
Normal pins which can be set high or low
Analogue and PWM Pins
Analogue pins which can read values between 0 and 1023
PWM Pins can be set to values between 0 and 255
Not a comic law enforcement agency (in this case)
Add on to an Arduino which extends functionality
Can be stacked, but some care does need to be taken
Plugs to the non-GPIO pins need to reach all shields.
Each shield will have outputs which need to be left unconnected to.
Outputs to the Arduino need to be unique.
Breaks down in to two main types
Code that is compiled to C / C++ and uploaded to the microcontroller
Code that communicates with the board and issues commands
Different sizes serve different needs
Easy to Use
Works on Linux, Mac and Windows
Large Community
Open Source
Not expensive to use
Lots of starter examples to tinker with
Lots of pre-written libraries
Ideal for Making
Circuit Design and Electronics
Soldering
Introduction to Programming
Physical Prototyping
NodeJS library informed by robotics
Makes turning your arduino in to a robot easy
NodeJS library informed by interactive applications
Contains server and client in one codebase
Web pages can access any arduino connected to the computer
Pick a directory
npm install johnny-five
Creating instances of hardware objects and passing initiation properties
var servo = new five.Servo(10);
servo.min(), servo.max(), servo.center(), move(deg), sweep(deg)
var five = require("johnny-five"), button, led, litBool;
var board = new five.Board();
board.on("ready", function() {
//Once the board is ready and the callback fires, your code goes here!
litBool = false;
led = five.Led(13);
button = new five.Button(8);
button.on("down", function() {
if(litBool == false){
led.off();
}else{
led.on();
}
litBool = !litBool;
});
button.on("hold", function() {
led.strobe();
});
});
Node Framework for Client Side Arduino
Combines Server and Page in to one framework
Allows Arduino to be connected through the webpage
Upload an Arduino sketch to the Arduino
$ > git clone git@github.com:semu/noduino.git
$ > cd noduino
$ > git submodule update --init
$ > npm install
$ > node app.js
Creating instances of hardware objects as functions and passing through callbacks
board.withLED(
{pin: 13},
function(err, LED) {
//logic here
}
);
var Noduino = new NoduinoObj(
{debug: true,
host:'http://localhost:8090'},
Connector);
Noduino.connect(function(err, board) {
if (err) { return console.log(err); }
board.withLED({pin: 13}, function(err, LED) {
if (err) { return console.log(err); }
LED.blink(250);
LED.on('on', function() }
console.log('LED is on!');
});
});
});


CrimPapers
Articles published on 21 July 2018
On 21 July 2018, 3 new articles were published in 3 journals.
Recantation of Sexual Abuse Disclosure Among Child Victims: Accommodation Syndrome by Gonca Celik, Ayşegül Tahiroğlu, Belgin Yoruldu, Dilek Varmiş, Necmi Çekin, Ayşe Avci, Nurdan Evliyaoğlu, Serhat Nasiroğlu
A Study of Public Establishment-Based and Private Network Commercial Sexual Exploitation in Kolkata and Mumbai, India by Andee Cooper Parks, Kyle Vincent, Ashley Russell, Zixin Nie, Alesha Guruswamy Rusk
Draining the Swamp While Fighting Off the Alligators: Crime Prevention in An Epoch of Contraction


--- Title: Free bus pass (Diamond Travelcard) Breadcrumb1_url: section-parking.html Breadcrumb1_title: Parking & Travel ---
You’re entitled to a free bus pass if you’re a BANES resident and have reached the qualifying age or have certain disabilities. The bus pass is called a Diamond Travelcard.