How to Declare an Execution
03 Apr 2015Following up on the previous list I did on configuration formats which are used to execute code snippets, I will try to summarize here some of the behaviors which are being expressed in order to transparently modify the execution of something.
This time, I will divide into sections around how to express…
- execution chains
- IO redirection
- requirements & dependencies
- constraints
- resources
- liveness
- calls & rules
Execution Chains
The very basic functionality of task runners like make
. In order
for something to be executed, first it must meet its prerequisites.
The most basic example of this is make
:
some_binary: other.txt
touch some_binary
other.txt:
touch other.txt
And a similar example in Ant. Here jar
needs to be called once
compile
has succeeded in execution:
<target name="compile" description="compile the Java source code to class files">
<mkdir dir="classes"/>
<javac srcdir="." destdir="classes"/>
</target>
<target name="jar" depends="compile" description="create a Jar file for the application">
<jar destfile="hello.jar">
<fileset dir="classes" includes="**/*.class"/>
<manifest>
<attribute name="Main-Class" value="HelloProgram"/>
</manifest>
</jar>
</target>
IO Redirection
Sometimes it is needed to capture the output from a workload to something with it. It could be only for inspection purposes (the logging problem), or to trigger the execution of something else in case it matches some condition (e.g. determining its liveness).
An example of this usage would be Gradle, which captures the output from the command to trigger other actions (link)
// Link to SO question where this example belongs:
//
// http://stackoverflow.com/questions/11093223/how-to-use-exec-output-in-gradle
//
task setWhoamiProperty << {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'whoami'
}
ext.whoami = os.toString()
}
}
task setHostnameProperty << {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'hostname'
}
ext.hostname = os.toString()
}
}
task printBuildInfo(dependsOn: [setWhoamiProperty, setHostnameProperty]) {
println whoami
println hostname
}
A much more interesting example are the Continuum Semantic Pipelines, which can create hooks in the connection so they can be actioned upon by an event handler:
// Example from the Continuum docs here: http://docs.apcera.com/tutorials/pipelines/
//
if (req.body.Command.match(/DROP/i) || req.body.Command.match(/DELETE/i)) {
// reject all drop and delete commands
res.json({ Permitted: false, Reason: "No!" });
} else {
// permit anything else
res.json({ Permitted: true, Reason: "Move along" });
}
Requirements & Dependencies
These are conditions which must be met in order for the execution to succeed. For example, we would like to express that a package should exists, or that it should use a certain container image.
An example of how Aurora specifies that something should be run using
the python:2.7
docker container is below:
hello_world_proc = Process(
name="hello_process",
cmdline="""
while true; do
echo -n "Hello world! The time is now: " && date
sleep 10
done
""")
hello_world_docker = Task(
name = 'hello docker',
processes = [hello_world_proc],
resources = Resources(cpu = 1, ram = 1*MB, disk=8*MB))
jobs = [
Service(cluster = 'devcluster',
environment = 'devel',
role = 'docker-test',
name = 'hello_docker',
task = hello_world_docker,
container = Container(docker = Docker(image = 'python:2.7')))]
Another example of this could be Puppet’s usage of require
, before
and
ensures
(link), which reminds me a bit on the Hoare-style program verification (link).
file {'/tmp/test1':
ensure => present,
content => "Hi.",
}
notify {'/tmp/test1 has already been synced.':
require => File['/tmp/test1'],
}
Continuum also has its own package resolution functionality, meaning that when creating a new package: (link)
depends [ { os: "ubuntu" },
{ package: "build-essential" },
{ package: "git" },
{ package: "bzr" },
{ package: "mercurial" } ]
provides [ { runtime: "go" },
{ runtime: "go-1.3" } ]
Constraints
These are checks which happen to an execution which is ready and determine the context on which the execution would be valid.
An example of this are the Marathon constraints. By using UNIQUE
for example, a command would be executed only once per hostname.
{
"id": "sleep-unique",
"cmd": "sleep 60",
"instances": 3,
"constraints": [["hostname", "UNIQUE"]]
}
This functionality is similar to Conflicts
in CoreOS Fleet.
In Fleet, it is also possible to set Global
, which in Marathon
translates to rack_id:GROUP_BY
.
Resources
Besides having a proper environment to run, it will also need some resources in the infrastructure like cpu, memory or disk required.
An extensive specfication of the resources that a workload may needs can be found in the Kubernetes Resource Model
resources: [
request: [ cpu: 2.5, memory: "40Mi" ],
limit: [ cpu: 4.0, memory: "99Mi" ],
capacity: [ cpu: 12, memory: "128Gi" ],
maxusage: [ cpu: 3.8, memory: "80Mi" ],
]
Some of the resources could be cpus, memory, storage and network related.
Liveness and Desired State
Once something is executed, we may want to define the health of a workload to be able to either restart it or forcibly terminate it.
Kubernetes has the concept of probes
to check whether something is ok or not.
livenessProbe:
exec:
command:
- "cat"
- "/tmp/health"
initialDelaySeconds: 15
In the case of Marathon:
{
"protocol": "COMMAND",
"command": { "value": "curl -f -X GET http://$HOST:$PORT0/health" },
"gracePeriodSeconds": 300,
"intervalSeconds": 60,
"timeoutSeconds": 20,
"maxConsecutiveFailures": 3
}
Consul has its version of checks
as well (link):
{
"check": {
"id": "api",
"name": "HTTP API on port 5000",
"http": "http://localhost:5000/health",
"interval": "10s",
"timeout": "1s"
}
}
Continuum and Bazel both have timeout
option meaning that if the
execution takes longer than the timeout parameter, then it is
stopped.
Bazel also provides flaky
meaning that it will retry to execute 3
times before failing.
Calls & Rules
Many times the same resulting command will change depending on the environment. In order to cope around this, it is taken advantage the fact that we are using a configuration format to have function like constructs which we can call.
For example, Ant defines the delete
method to remote a file:
<delete file="hello.jar"/>
To put it in other words, it is calling a function named delete
which takes a $file
as parameter, and then wrapping the portability
logic inside there.
In Bazel, we can see a similar concept in its rules. In the example
below, we pass 3 parameters when calling sh_binary
:
sh_binary(
name = "foo",
srcs = ["foo.sh"],
deps = ...,
data = glob(["datafiles/*.txt"]),
)
Remarks
The coverage of this writing is not very extensive but hopefully it serves to clarify a bit what are some of the common ways or patterns to modify the execution of something. The list could go on and on, though next time I see some new build or automation tool, I’ll make sure to check what it is doing around the items that I described above.


Life in the UK Resources
| Website | Description |
|---|---|
| Tests & Exams | |
| lifeintheuktestweb.co.uk | – 40 free tests + 15 free exams (visit "Exams" tab) – Tests by chapter available |
| theuktest.com | – 48 free tests – Search by topic is available – Personalised stats on test completion |
| lifeintheuktests.co.uk | 15 free tests |
| test-questions.com | 87 free tests (10 questions each) |
| About The Test | |
| gov.uk | Official information about the test |
| lituktestbooking.co.uk | Book your test here |
| nathankowald.com | Nathan Kowald's blog post about LITUK test |


Files CCore/inc/PacketPool.h CCore/src/PacketPool.cpp
The class PacketPool implements a pool of packets. There is the default global packet pool in the CCore. Two global constants PacketPool_PacketCount and PacketPool_PacketMaxDataLen determine properties of this pool. You may override these constants by defining them in you project. Default values are provided by the target as DefaultPacketCount and DefaultPacketMaxDataLen.
The following global pool functions are to work with raw packets.
PacketHeader * TryAllocPacket_raw(); PacketHeader * AllocPacket_raw(); // may return 0 PacketHeader * AllocPacket_raw(MSec timeout); PacketHeader * AllocPacket_raw(TimeScope time_scope); PacketHeader * TryAllocPacket_raw_short(); PacketHeader * AllocPacket_raw_short(); // never return 0 PacketHeader * AllocPacket_raw_short(MSec timeout); PacketHeader * AllocPacket_raw_short(TimeScope time_scope); void DetachPacketBufs();
TryAllocPacket_raw() is a non-blocking allocation function. If the operation has failed, the return pointer is null. The packet is a "long" packet, i.e. has an attached data buffer. The length of the buffer is PacketPool_PacketMaxDataLen.
AllocPacket_raw() is a blocking allocation function. It blocks while packet pool is empty. Once a packet becomes available it tries to attach a data buffer and return this packet. If this failed, the return pointer is null. So, despite the function is blocking, it still may return a null pointer.
AllocPacket_raw(MSec) and AllocPacket_raw(TimeScope) are timed variants of the AllocPacket_raw(). In case of timeout the null pointer is returned.
There are "short" variants of four functions, mentioned above. They allocate a "short" packet, i.e. this packet does not necessary has an attached data buffer (but may have). AllocPacket_raw_short() never returns null, because of this.
DetachPacketBufs() detaches data buffers from all packets in the pool.
There is no "free" function, because you return a packet back to the pool, when you complete it. Initially pool has a PacketPool_PacketCount packets without attached data buffers.
And there are functions to work with specialized packets. They are direct calls of the correspondent raw functions.
template <PODType POD> Packet<POD> TryAllocPacket() { return TryAllocPacket_raw(); } template <PODType POD> Packet<POD> AllocPacket() { return AllocPacket_raw(); } // may return 0 template <PODType POD> Packet<POD> AllocPacket(MSec timeout) { return AllocPacket_raw(timeout); } template <PODType POD> Packet<POD> AllocPacket(TimeScope time_scope) { return AllocPacket_raw(time_scope); } template <PODType POD> Packet<POD> TryAllocPacket_short() { return TryAllocPacket_raw_short(); } template <PODType POD> Packet<POD> AllocPacket_short() { return AllocPacket_raw_short(); } // never return 0 template <PODType POD> Packet<POD> AllocPacket_short(MSec timeout) { return AllocPacket_raw_short(timeout); } template <PODType POD> Packet<POD> AllocPacket_short(TimeScope time_scope) { return AllocPacket_raw_short(time_scope); }
Here is the PacketPoll class itself. On XCore you may use its methods only in a task context. So you cannot complete a packet in the interrupt context.
The allocation method semantic is the same as of global functions above.
The name is used to name internal synchronization objects.
Internally all packets are stores in a list. Packets with an attached data buffer goes first.
Destructor calls Abort(), if not all packets are released at the moment.
class PacketPool : public Funchor_nocopy
{
....
public:
// constructors
explicit PacketPool(ulen count,ulen max_data_len=DefaultPacketMaxDataLen);
PacketPool(TextLabel name,ulen count,ulen max_data_len=DefaultPacketMaxDataLen);
~PacketPool();
// get
PacketHeader * try_get();
PacketHeader * get(); // may return 0
PacketHeader * get(MSec timeout);
PacketHeader * get(TimeScope time_scope);
// get_short
PacketHeader * try_get_short();
PacketHeader * get_short(); // never return 0
PacketHeader * get_short(MSec timeout);
PacketHeader * get_short(TimeScope time_scope);
// detachBufs
void detachBufs();
};


RiOS v7.0.1 and later supports inbound QoS. You configure inbound QoS in the Configure > Networking > Inbound QoS page.Inbound QoS allocates bandwidth and prioritizes traffic flowing into the LAN network behind the Steelhead appliance. This provides the benefits of QoS for environments that cannot meet their QoS requirements with outbound QoS.A deployment that does not have a Steelhead appliance located at the traffic source (for example, the traffic comes from the Internet, or from servers at a site without a Steelhead appliance). Figure 6‑7. Guarantee Bandwidth for Incoming TrafficA deployment that has multiple Steelhead appliances located at the traffic source (for example, behind an Interceptor cluster). The Steelhead appliances do not share bandwidth information with each other. As a result, they can overwhelm the branch office site at the remote location. A branch office receiving data from multiple data centers (either with or without Steelhead appliances). Because the two data centers do not coordinate the amount of bandwidth sent to the branch office, they can overwhelm the link at the branch office, causing degraded performance. Configuring inbound QoS focusses on prioritizing types of traffic using rules and classes just like outbound QoS. The inbound configuration is separate from the outbound configuration. You define the applications on the local network and then create their corresponding shaping policies.Figure 6‑10. Inbound QoS OverviewInbound QoS applies the HFSC shaping policies to the ingress traffic. This addresses environments in which bandwidth constraints exist at the downstream location. When this occurs, the downstream Steelhead appliance (where inbound QoS is enabled) dynamically communicates the bandwidth constraints to the client transmitting the traffic. The client slows down the throughput and the traffic adheres to the configured inbound QoS rule. Inbound QoS, just like outbound QoS, is not a dual-ended Steelhead appliance solution. A single Steelhead appliance performing traffic shaping as needed to avoid network congestion controls inbound WAN traffic on its own.For details about the HFSC queuing technology, see Traffic Classification and the Steelhead Appliance Deployment Guide.Inbound rules define the types of traffic flowing into the branch office. As with outbound QoS, the rule can match the traffic based on VLAN, IP header values, TCP/UDP ports, and AFE information. As an example, you can ensure that the voice traffic on the WAN is reserved a fixed bandwidth and this traffic has a higher priority over the recreational Internet traffic.Inbound classes shape the inbound traffic. The class configuration resembles a flat outbound QoS class configuration. An outbound QoS configuration describes remote sites and services/applications. Inbound QoS describes the local services/applications and how to shape the inbound traffic.The inbound traffic shaping configuration includes a default shaping class. The QoS scheduler applies the built-in inbound default class constraints and parameters on traffic not placed in any other class by the configured QoS rules. The default shaping class has a 10 percent minimum bandwidth allocation and a 100 percent maximum bandwidth allocation. You cannot delete the default class; however, you can change its bandwidth allocations.Unlike Outbound QoS (Advanced), inbound QoS does not support hierarchical mode; it uses flat mode only. A deployment using inbound QoS will typically not require a hierarchical configuration to support multiple sites across the WAN. Deployment scenarios include configuring hierarchical mode using outbound QoS in the data center and configuring inbound QoS in the branch offices. Inbound QoS does not classify and shape traffic received from a peer Steelhead appliance when using the connection forwarding feature. In these configurations, the Steelhead appliance that first intercepts the traffic classifies and shapes it. Inbound QoS is not fully compatible with RSP when one or more virtual machines are connected to the in-path data flow. In such scenarios all traffic that enters any Virtual Machine connected to the in-path data flow falls into the default class. When packet-mode optimization is enabled, the QoS scheduler places UDP4 traffic into the MX-TCP class. All other traffic goes into the proper class. You cannot configure inbound QoS in an out-of-path deployment over a primary or auxiliary interface. Inbound QoS does not throttle certain flows such as MX-TCP and UDP bulk traffic flows; however it does provide bandwidth and latency reservation for them. The maximum number of inbound QoS rules is 500. The maximum number of inbound QoS classes is 200. The inbound QoS connection classification limit depends on the Steelhead appliance model. When the number of optimized connections exceed the connection classification limit for the appliance model, all new connections are passed through unoptimized. This table lists the limits.
For outbound QoS limit recommendations, see the Steelhead Appliance Deployment Guide.
1. Select each WAN interface and define the bandwidth link rate for each interface. Important: If you delete or add new rules, the existing connections are not affected; the changes only affect new connections.
Enable Inbound QoS Shaping and Enforcement Enables QoS to control the prioritization of different types of inbound network traffic and to ensure that the Steelhead appliance gives certain network traffic (for example, Voice Over IP) higher priority than other network traffic. Traffic is not classified until at least one WAN interface is enabled. Enable QoS on <interface> with WAN bandwidth (kbps) Enables a WAN interface <X-Y>. Specify its bandwidth link rate in kbps. The bandwidth for the default site is automatically set to this value.Inbound QoS supports in-path interfaces only; it does not support primary or auxiliary interfaces.The link rate is the bottleneck WAN bandwidth, not the interface speed out of the WAN interface into the router or switch: for example, if your Steelhead appliance connects to a router with a 100-Mbps link, do not specify this value—specify the actual WAN bandwidth (for example, T1, T3).Important: Different WAN interfaces can have different WAN bandwidths; you must enter the bandwidth link rate correctly for QoS to function properly.
Indicates how delay-sensitive a traffic class is to the QoS scheduler. Select the latency priority for the class from the drop-down list (highest priority to lowest):Real-Time - Specifies real-time traffic class. Give this value to your highest priority traffic; for example, VoIP, video conferencing. Interactive - Specifies an interactive traffic class: for example, Citrix, RDP, telnet and ssh. Business Critical - Specifies the high priority traffic class: for example, Thick Client Applications, ERPs, and CRMs. Normal Priority - Specifies a normal priority traffic class: for example, Internet browsing, file sharing, and email. Low Priority - Specifies a low priority traffic class for all traffic that does not fall into any other service class: for example, FTP, backup, replication, other high-throughput data transfers, and recreational applications such as audio file sharing. Best Effort - Specifies the lowest priority. These are minimum priority guarantees; if better service is available, it is provided: for example, if a class is specified as low priority and the higher priority classes are not active, then the low priority class receives the highest possible available priority for the current traffic conditions. This parameter controls the priority of the class relative to the other classes.Important: The latency priority describes only the delay sensitivity of a class, not how much bandwidth it is allocated, nor how important the traffic is compared to other classes. Typically, you configure low latency priority for high-throughput, nonpacket delay sensitive applications like FTP, backup, and replication. Specify the minimum amount of bandwidth (as a percentage) to guarantee to a traffic class when there is bandwidth contention. All of the classes combined cannot exceed 100 percent. During contention for bandwidth, the class is guaranteed the amount of bandwidth specified. The class receives more bandwidth if there is unused bandwidth remaining.The minimum bandwidth must fall within the bandwidth limit for the Steelhead appliance.A default class is automatically created with minimum bandwidth of 10 percent. Traffic that does not match any of the rules is put into the default class. Riverbed recommends that you change the guaranteed bandwidth of the default class to the appropriate value. Specify the maximum allowed bandwidth (as a percentage) a class receives as a percentage of the minimum bandwidth. The limit is applied even if there is excess bandwidth available. Specify the weight for the class. The link share weight determines how the excess bandwidth is allocated among sibling classes. Link share does not depend on the minimum bandwidth. By default, all the link shares are equal.Classes with a larger weight are allocated more of the excess bandwidth than classes with a lower link share weight. Select the check box next to the name and click Remove Selected.
3. Click Apply to apply your settings.
4. Tip: The inbound QoS classes appear in the inbound QoS class table. To display QoS rules associated with the class, click the magnifying glass. To hide the rules associated with a QoS class, click the close icon.Each rule maps a type of network traffic to a QoS class. You can create multiple QoS rules for a class. When multiple QoS rules are created for a class, the rules are followed in the order in which they appear in the Inbound QoS page and only the first matching rule is applied to the class.
Steelhead appliances evaluate rules in numerical order starting with rule 1. If the conditions set in the rule match, then the rule is applied, and the system moves on to the next packet. If the conditions set in the rule do not match, the system consults the next rule: for example, if the conditions of rule 1 do not match, rule 2 is consulted. If rule 2 matches the conditions, it is applied, and no further rules are consulted. Specify an IP address and mask pattern for the traffic destination, or you can specify all or <IP_ADDRESS>/0 as the wildcard for all traffic.Use this format: XXX.XXX.XXX.XXX/XX.—or—Specify a host label. You predefine host labels on the Configure > Optimization > Host Labels page. Optionally, specify all source ports, a single source port value or a port range of port1-port2, where port1 must be less than port2. The default setting is all ports.—or—Specify a port label. You predefine port labels on the Configure > Optimization > Port Labels page. Specify an IP address and mask for the traffic source, or you can specify all or <IP_ADDRESS>/0 as the wildcard for all traffic.Use this format: XXX.XXX.XXX.XXX/XX.—or—Specify a host label. You predefine host labels on the Configure > Optimization > Host Labels page. Optionally, specify all destination ports, a single source port value or a port range of port1-port2, where port1 must be less than port2. The default setting is all ports.—or—Specify a port label. You predefine port labels on the Configure > Optimization > Port Labels page. Select All, TCP, GRE, UDP, ICMP, IPSecAH (Authentication Header), IPSecESP (Encapsulating Security Payload), or a number from the drop-down list. All specifies all TCP and UDP-based protocols. Select All, Optimized, or Passthrough from the drop-down list. The system applies the QoS rules to optimized and pass-through (ingress only) traffic. Select an application from the drop-down list of global applications. To narrow the search, type the first characters in the application name.Selecting HTTP expands the control to include the Domain Name and Relative Path controls. Enter the domain name and relative path. The relative path is the part of the URL that follows the domain name. Select the box next to the name and click Move QoS Rules. Click the arrow next to the desired rule position. The rule moves to the new position.
3. Click Apply to apply your settings.
4.
4. Click Apply to save your settings to the running configuration.
5. After you apply your settings, you can verify whether the traffic is categorized in the correct class by choosing Reports > Networking > Inbound QoS and viewing the report. For example, if you have configured VoIP traffic as real-time, check the real-time class and verify that the other classes are not receiving VoIP traffic.You can also verify whether the configuration is honoring the bandwidth allocations by reviewing the Inbound QoS report.When you have verified appropriate changes, you can write the active configuration that is stored in memory to the active configuration file (or you can save it as any filename you choose). For details about saving configurations, see Managing Configuration Files.Configuring Port Labels Managing Configuration Files Viewing Inbound QoS Reports


Former Nottingham Forest striker blasts Jose Mourinho as Spurs appoint him as manager
'Amazing how some have bought into "Mourinho the winner" without any regard for how he leaves clubs'
by James PallattFormer Nottingham Forest striker Stan Collymore has questioned Tottenham's appointment of Jose Mourinho.
Mourinho is the new manager of Tottenham following the sacking of Mauricio Pochettino.
The former Chelsea and Manchester United boss has signed a three-and-a-half year contract with the London club.
The appointment comes less than 12 hours after Spurs parted company with Pochettino on Tuesday evening.
The 56-year-old Portuguese said: "I am excited to be joining a club with such a great heritage and such passionate supporters.
"The quality in both the squad and the academy excites me. Working with these players is what has attracted me."
Nottingham Forest latest
This is your round up of all things Forest; the one-stop shop that will keep you updated on the latest goings on at the City Ground and beyond.
Transfers, injuries, match-days and managers, we’ve got you covered.
We’ll be bringing the very latest on the Reds throughout the week and around the clock.
Make sure you keep yourself updated with our handy daily catch up...
Must reads...
- Reds skipper Dawson on the battle ahead
- New Notts owners on Forest relationship
- Lamouchi's message over stadium plans
- Worrall picks his Reds team of the decade
For all your latest NFFC news, opinion, analysis and transfer gossip, click here
You can follow our Reds reporter Sarah Clapson on Twitter, and her email address is<EMAIL_ADDRESS>Ex-Reds striker Collymore has made his feelings on the subject clear, on Twitter.
"Amazing how some have bought into "Mourinho the winner" without any regard for how he leaves clubs," he wrote.
"Unbalanced, fractured, overspending, soulless.
"Everything Spurs tried to avoid.
"Good luck, I like Spurs a lot, but it's not how this man comes in, it's how he'll leave you."


Basic Elements
Form Elements
Basic
A Block of help text that breaks onto a new line and may extended beyond one line.
Validation With Submit Clear
A Block of help text that breaks onto a new line and may extended beyond one line.
A Block of help text that breaks onto a new line and may extended beyond one line.
A Block of help text that breaks onto a new line and may extended beyond one line.


Click on button in image container
Forgot password?
Sign up and discover great amount of new opportunities!
If you already has an account, just sign in. We've missed you!


|
2D physics simulator
Basic 2D physics simulator, needs libraries hwlib and bmptk to work.
|
Vector ADT. More...
#include <particle.hpp>
Public Member Functions | |
| vector | operator+ (const vector &rhs) const |
| Add vector with vector. More... | |
| vector & | operator*= (const int &rhs) |
| Multiply vector with integer. More... | |
| vector | operator* (const vector &rhs) const |
| Multiply vector with vector. More... | |
| vector | operator* (const float &rhs) const |
| Multiply vector with float. More... | |
| bool | operator== (const vector &rhs) const |
| Compare two vectors. More... | |
| float | magnitude () |
| output operator vector to std::ostream More... | |
| float | squaredMagnitude () |
| Magnitude squared vector. More... | |
| vector | norm () |
| Norm of vector. More... | |
Public Attributes | |
| float | x |
| float | y |
Friends | |
| vector | operator* (const float &lhs, const vector &rhs) |
| Multiply float with vector. More... | |
| hwlib::ostream & | operator<< (hwlib::ostream &lhs, const vector &rhs) |
| output operator vector to hwlib::ostream More... | |
Vector ADT.
This is an ADT that implements a vector based on floats.
The vector contains two floats.
It contains the needed operators to be used in the application.
| float vector::magnitude | ( | ) |
output operator vector to std::ostream
This operator streams the vector to a std::ostream.
The operator will give the following result in the ostream: (x,y)
The x and y values are printed in a 7 decimal precision. Magnitude vector
This function returns the magnitude of the vector.
In other words, it returns the length of the vector.
The magnitude is the sqrt(sq(x)+sq(y)). Call example: float magn = vector.magnitude();
| vector vector::norm | ( | ) |
Norm of vector.
This function returns the norm of the vector.
Call example: auto norm = vector.norm(); More information about the norm can you find on:
https://en.wikipedia.org/wiki/Norm_(mathematics)
Multiply vector with vector.
This operator multiplies a vector with another vector.
The x and y values of the vectors are multiplied with eachother.
It returns a new vector.
| vector vector::operator* | ( | const float & | rhs | ) | const |
Multiply vector with float.
This operator multiplies a vector with a float.
It will multiply both the x and y value with the float.
It returns a new vector.
| vector& vector::operator*= | ( | const int & | rhs | ) |
Multiply vector with integer.
This operator multiplies a vector with an integer.
It will multiply both the x and y value with the integer.
The answer is saved in the vector, left of the equation.
Add vector with vector.
This operator adds two vectors.
The operator adds the x and y of the two vectors.
It returns a new vector.
| bool vector::operator== | ( | const vector & | rhs | ) | const |
Compare two vectors.
This operator test for equality.
It returns true if and only if the x and y of both vectors are equal.
| float vector::squaredMagnitude | ( | ) |
Magnitude squared vector.
This function returns the magnitude squared.
Call example: float sqmagn = vector.magnitude();
Multiply float with vector.
This operator multiplies a float with a vector.
It will multiply both the x and y value with the float.
It returns a new vector.
|
friend |
output operator vector to hwlib::ostream
This operator streams the vector to a hwlib::ostream.
The operator will give the following result in the ostream: (x,y)
The x and y values are printed in a 7 decimal precision.


Seq has a value of 1
Body = The Body for the first note.
Body does not contain body.
20 greater than 1
Seq has a value of 2
Body = The body for the second note.
Body contains body.
20 greater than 2
Seq has a value of 3
Body = The body for the third note.
Body contains body.
20 greater than 3
Seq has a value of 21
Body = This note has a sequence of 21.
Body does not contain body.
20 not greater than 21


Who you work with
This interactive visualisation maps the relationships between the Centre of Expertise in Methodology to their stakeholders within ONS.
The size of the arrow represents the 2015/2016 Full Time Equivalent (FTE) metric, ie number of allocated employee working full-time. Thus, the size of the arrow relates to the strength of the relationship between two nodes.
Arrow size to FTE:


Up
78-year-old grumbler Karl Fredriksen believes that life bypasses him. To keep his promise to his deceased wife, he decides to fulfill his dream of a great adventure by tying thousands of balloons to his home and flying into the wilds of South America. Without flying and half a mile, the traveler discovers that he inadvertently brought along an extremely talkative and incorrigibly cheerful 8-year-old boy named Russell...


Buy Bitcoin Cash instantly with your credit card. Enter your email to get started.
Enter the security code we've just sent you to verify your email.


| 1 | /* | |
| 2 | * Copyright 2001-2010 Stephen Colebourne | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.joda.time; | |
| 17 | ||
| 18 | import org.joda.convert.FromString; | |
| 19 | import org.joda.convert.ToString; | |
| 20 | import org.joda.time.base.BaseSingleFieldPeriod; | |
| 21 | import org.joda.time.field.FieldUtils; | |
| 22 | import org.joda.time.format.ISOPeriodFormat; | |
| 23 | import org.joda.time.format.PeriodFormatter; | |
| 24 | ||
| 25 | /** | |
| 26 | * An immutable time period representing a number of hours. | |
| 27 | *
 | |
| 28 | * Hours is an immutable period that can only store hours. | |
| 29 | * It does not store years, months or minutes for example. As such it is a | |
| 30 | * type-safe way of representing a number of hours in an application. | |
| 31 | *
 | |
| 32 | * The number of hours is set in the constructor, and may be queried using | |
| 33 | * getHours(). Basic mathematical operations are provided - | |
| 34 | * plus(), minus(), multipliedBy() and | |
| 35 | * dividedBy(). | |
| 36 | *
 | |
| 37 | * Hours is thread-safe and immutable. | |
| 38 | * | |
| 39 | * @author Stephen Colebourne | |
| 40 | * @since 1.4 | |
| 41 | */ | |
| 42 | public final class Hours extends BaseSingleFieldPeriod { | |
| 43 | ||
| 44 | /** Constant representing zero hours. */ | |
| 45 | public static final Hours ZERO = new Hours(0); | |
| 46 | /** Constant representing one hour. */ | |
| 47 | public static final Hours ONE = new Hours(1); | |
| 48 | /** Constant representing two hours. */ | |
| 49 | public static final Hours TWO = new Hours(2); | |
| 50 | /** Constant representing three hours. */ | |
| 51 | public static final Hours THREE = new Hours(3); | |
| 52 | /** Constant representing four hours. */ | |
| 53 | public static final Hours FOUR = new Hours(4); | |
| 54 | /** Constant representing five hours. */ | |
| 55 | public static final Hours FIVE = new Hours(5); | |
| 56 | /** Constant representing six hours. */ | |
| 57 | public static final Hours SIX = new Hours(6); | |
| 58 | /** Constant representing seven hours. */ | |
| 59 | public static final Hours SEVEN = new Hours(7); | |
| 60 | /** Constant representing eight hours. */ | |
| 61 | public static final Hours EIGHT = new Hours(8); | |
| 62 | /** Constant representing the maximum number of hours that can be stored in this object. */ | |
| 63 | public static final Hours MAX_VALUE = new Hours(Integer.MAX_VALUE); | |
| 64 | /** Constant representing the minimum number of hours that can be stored in this object. */ | |
| 65 | public static final Hours MIN_VALUE = new Hours(Integer.MIN_VALUE); | |
| 66 | ||
| 67 | /** The paser to use for this class. */ | |
| 68 | private static final PeriodFormatter PARSER = ISOPeriodFormat.standard().withParseType(PeriodType.hours()); | |
| 69 | /** Serialization version. */ | |
| 70 | private static final long serialVersionUID =<PHONE_NUMBER>7380864L; | |
| 71 | ||
| 72 | //----------------------------------------------------------------------- | |
| 73 | /** | |
| 74 | * Obtains an instance of Hours that may be cached. | |
| 75 | * Hours is immutable, so instances can be cached and shared. | |
| 76 | * This factory method provides access to shared instances. | |
| 77 | * | |
| 78 | * @param hours the number of hours to obtain an instance for | |
| 79 | * @return the instance of Hours | |
| 80 | */ | |
| 81 | public static Hours hours(int hours) { | |
| 82 | switch (hours) { | |
| 83 | case 0: | |
| 84 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ZERO; |
| 85 | case 1: | |
| 86 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ONE; |
| 87 | case 2: | |
| 88 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return TWO; |
| 89 | case 3: | |
| 90 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return THREE; |
| 91 | case 4: | |
| 92 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return FOUR; |
| 93 | case 5: | |
| 94 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return FIVE; |
| 95 | case 6: | |
| 96 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return SIX; |
| 97 | case 7: | |
| 98 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return SEVEN; |
| 99 | case 8: | |
| 100 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return EIGHT; |
| 101 | case Integer.MAX_VALUE: | |
| 102 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return MAX_VALUE; |
| 103 | case Integer.MIN_VALUE: | |
| 104 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return MIN_VALUE; |
| 105 | default: | |
| 106 |
1
1. hours : mutated return of Object value for org/joda/time/Hours::hours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new Hours(hours); |
| 107 | } | |
| 108 | } | |
| 109 | ||
| 110 | //----------------------------------------------------------------------- | |
| 111 | /** | |
| 112 | * Creates a Hours representing the number of whole hours | |
| 113 | * between the two specified datetimes. | |
| 114 | * | |
| 115 | * @param start the start instant, must not be null | |
| 116 | * @param end the end instant, must not be null | |
| 117 | * @return the period in hours | |
| 118 | * @throws IllegalArgumentException if the instants are null or invalid | |
| 119 | */ | |
| 120 | public static Hours hoursBetween(ReadableInstant start, ReadableInstant end) { | |
| 121 | int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.hours()); | |
| 122 |
1
1. hoursBetween : mutated return of Object value for org/joda/time/Hours::hoursBetween to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(amount); |
| 123 | } | |
| 124 | ||
| 125 | /** | |
| 126 | * Creates a Hours representing the number of whole hours | |
| 127 | * between the two specified partial datetimes. | |
| 128 | *
 | |
| 129 | * The two partials must contain the same fields, for example you can specify | |
| 130 | * two LocalTime objects. | |
| 131 | * | |
| 132 | * @param start the start partial date, must not be null | |
| 133 | * @param end the end partial date, must not be null | |
| 134 | * @return the period in hours | |
| 135 | * @throws IllegalArgumentException if the partials are null or invalid | |
| 136 | */ | |
| 137 | public static Hours hoursBetween(ReadablePartial start, ReadablePartial end) { | |
| 138 |
2
1. hoursBetween : negated conditional → NO_COVERAGE 2. hoursBetween : negated conditional → NO_COVERAGE |
if (start instanceof LocalTime && end instanceof LocalTime) { |
| 139 | Chronology chrono = DateTimeUtils.getChronology(start.getChronology()); | |
| 140 | int hours = chrono.hours().getDifference( | |
| 141 | ((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis()); | |
| 142 |
1
1. hoursBetween : mutated return of Object value for org/joda/time/Hours::hoursBetween to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(hours); |
| 143 | } | |
| 144 | int amount = BaseSingleFieldPeriod.between(start, end, ZERO); | |
| 145 |
1
1. hoursBetween : mutated return of Object value for org/joda/time/Hours::hoursBetween to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(amount); |
| 146 | } | |
| 147 | ||
| 148 | /** | |
| 149 | * Creates a Hours representing the number of whole hours | |
| 150 | * in the specified interval. | |
| 151 | * | |
| 152 | * @param interval the interval to extract hours from, null returns zero | |
| 153 | * @return the period in hours | |
| 154 | * @throws IllegalArgumentException if the partials are null or invalid | |
| 155 | */ | |
| 156 | public static Hours hoursIn(ReadableInterval interval) { | |
| 157 |
1
1. hoursIn : negated conditional → NO_COVERAGE |
if (interval == null) { |
| 158 |
1
1. hoursIn : mutated return of Object value for org/joda/time/Hours::hoursIn to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.ZERO; |
| 159 | } | |
| 160 | int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.hours()); | |
| 161 |
1
1. hoursIn : mutated return of Object value for org/joda/time/Hours::hoursIn to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(amount); |
| 162 | } | |
| 163 | ||
| 164 | /** | |
| 165 | * Creates a new Hours representing the number of complete | |
| 166 | * standard length hours in the specified period. | |
| 167 | *
 | |
| 168 | * This factory method converts all fields from the period to hours using standardised | |
| 169 | * durations for each field. Only those fields which have a precise duration in | |
| 170 | * the ISO UTC chronology can be converted. | |
| 171 | *
 | |
| 172 | *
One week consists of 7 days. | |
| 173 | *
One day consists of 24 hours. | |
| 174 | *
One hour consists of 60 minutes. | |
| 175 | *
One minute consists of 60 seconds. | |
| 176 | *
One second consists of 1000 milliseconds. | |
| 177 | *
 | |
| 178 | * Months and Years are imprecise and periods containing these values cannot be converted. | |
| 179 | * | |
| 180 | * @param period the period to get the number of hours from, null returns zero | |
| 181 | * @return the period in hours | |
| 182 | * @throws IllegalArgumentException if the period contains imprecise duration values | |
| 183 | */ | |
| 184 | public static Hours standardHoursIn(ReadablePeriod period) { | |
| 185 | int amount = BaseSingleFieldPeriod.standardPeriodIn(period, DateTimeConstants.MILLIS_PER_HOUR); | |
| 186 |
1
1. standardHoursIn : mutated return of Object value for org/joda/time/Hours::standardHoursIn to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(amount); |
| 187 | } | |
| 188 | ||
| 189 | /** | |
| 190 | * Creates a new Hours by parsing a string in the ISO8601 format 'PTnH'. | |
| 191 | *
 | |
| 192 | * The parse will accept the full ISO syntax of PnYnMnWnDTnHnMnS however only the | |
| 193 | * hours component may be non-zero. If any other component is non-zero, an exception | |
| 194 | * will be thrown. | |
| 195 | * | |
| 196 | * @param periodStr the period string, null returns zero | |
| 197 | * @return the period in hours | |
| 198 | * @throws IllegalArgumentException if the string format is invalid | |
| 199 | */ | |
| 200 | @FromString | |
| 201 | public static Hours parseHours(String periodStr) { | |
| 202 |
1
1. parseHours : negated conditional → NO_COVERAGE |
if (periodStr == null) { |
| 203 |
1
1. parseHours : mutated return of Object value for org/joda/time/Hours::parseHours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.ZERO; |
| 204 | } | |
| 205 | Period p = PARSER.parsePeriod(periodStr); | |
| 206 |
1
1. parseHours : mutated return of Object value for org/joda/time/Hours::parseHours to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(p.getHours()); |
| 207 | } | |
| 208 | ||
| 209 | //----------------------------------------------------------------------- | |
| 210 | /** | |
| 211 | * Creates a new instance representing a number of hours. | |
| 212 | * You should consider using the factory method {@link #hours(int)} | |
| 213 | * instead of the constructor. | |
| 214 | * | |
| 215 | * @param hours the number of hours to represent | |
| 216 | */ | |
| 217 | private Hours(int hours) { | |
| 218 | super(hours); | |
| 219 | } | |
| 220 | ||
| 221 | /** | |
| 222 | * Resolves singletons. | |
| 223 | * | |
| 224 | * @return the singleton instance | |
| 225 | */ | |
| 226 | private Object readResolve() { | |
| 227 |
1
1. readResolve : mutated return of Object value for org/joda/time/Hours::readResolve to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(getValue()); |
| 228 | } | |
| 229 | ||
| 230 | //----------------------------------------------------------------------- | |
| 231 | /** | |
| 232 | * Gets the duration field type, which is hours. | |
| 233 | * | |
| 234 | * @return the period type | |
| 235 | */ | |
| 236 | public DurationFieldType getFieldType() { | |
| 237 |
1
1. getFieldType : mutated return of Object value for org/joda/time/Hours::getFieldType to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return DurationFieldType.hours(); |
| 238 | } | |
| 239 | ||
| 240 | /** | |
| 241 | * Gets the period type, which is hours. | |
| 242 | * | |
| 243 | * @return the period type | |
| 244 | */ | |
| 245 | public PeriodType getPeriodType() { | |
| 246 |
1
1. getPeriodType : mutated return of Object value for org/joda/time/Hours::getPeriodType to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return PeriodType.hours(); |
| 247 | } | |
| 248 | ||
| 249 | //----------------------------------------------------------------------- | |
| 250 | /** | |
| 251 | * Converts this period in hours to a period in weeks assuming a | |
| 252 | * 7 day week and 24 hour day. | |
| 253 | *
 | |
| 254 | * This method allows you to convert between different types of period. | |
| 255 | * However to achieve this it makes the assumption that all weeks are 7 days | |
| 256 | * long and all days are 24 hours long. | |
| 257 | * This is not true when daylight savings time is considered, and may also | |
| 258 | * not be true for some unusual chronologies. However, it is included as it | |
| 259 | * is a useful operation for many applications and business rules. | |
| 260 | * | |
| 261 | * @return a period representing the number of whole weeks for this number of hours | |
| 262 | */ | |
| 263 | public Weeks toStandardWeeks() { | |
| 264 |
2
1. toStandardWeeks : Replaced integer division with multiplication → NO_COVERAGE 2. toStandardWeeks : mutated return of Object value for org/joda/time/Hours::toStandardWeeks to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Weeks.weeks(getValue() / DateTimeConstants.HOURS_PER_WEEK); |
| 265 | } | |
| 266 | ||
| 267 | /** | |
| 268 | * Converts this period in hours to a period in days assuming a | |
| 269 | * 24 hour day. | |
| 270 | *
 | |
| 271 | * This method allows you to convert between different types of period. | |
| 272 | * However to achieve this it makes the assumption that all days are 24 hours long. | |
| 273 | * This is not true when daylight savings time is considered, and may also | |
| 274 | * not be true for some unusual chronologies. However, it is included as it | |
| 275 | * is a useful operation for many applications and business rules. | |
| 276 | * | |
| 277 | * @return a period representing the number of whole days for this number of hours | |
| 278 | */ | |
| 279 | public Days toStandardDays() { | |
| 280 |
2
1. toStandardDays : Replaced integer division with multiplication → NO_COVERAGE 2. toStandardDays : mutated return of Object value for org/joda/time/Hours::toStandardDays to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Days.days(getValue() / DateTimeConstants.HOURS_PER_DAY); |
| 281 | } | |
| 282 | ||
| 283 | /** | |
| 284 | * Converts this period in hours to a period in minutes assuming a | |
| 285 | * 60 minute hour. | |
| 286 | *
 | |
| 287 | * This method allows you to convert between different types of period. | |
| 288 | * However to achieve this it makes the assumption that all hours are 60 minutes long. | |
| 289 | * This may not be true for some unusual chronologies. However, it is included | |
| 290 | * as it is a useful operation for many applications and business rules. | |
| 291 | * | |
| 292 | * @return a period representing the number of minutes for this number of hours | |
| 293 | * @throws ArithmeticException if the number of minutes is too large to be represented | |
| 294 | */ | |
| 295 | public Minutes toStandardMinutes() { | |
| 296 |
1
1. toStandardMinutes : mutated return of Object value for org/joda/time/Hours::toStandardMinutes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Minutes.minutes(FieldUtils.safeMultiply(getValue(), DateTimeConstants.MINUTES_PER_HOUR)); |
| 297 | } | |
| 298 | ||
| 299 | /** | |
| 300 | * Converts this period in hours to a period in seconds assuming a | |
| 301 | * 60 minute hour and 60 second minute. | |
| 302 | *
 | |
| 303 | * This method allows you to convert between different types of period. | |
| 304 | * However to achieve this it makes the assumption that all hours are | |
| 305 | * 60 minutes long and all minutes are 60 seconds long. | |
| 306 | * This may not be true for some unusual chronologies. However, it is included | |
| 307 | * as it is a useful operation for many applications and business rules. | |
| 308 | * | |
| 309 | * @return a period representing the number of seconds for this number of hours | |
| 310 | * @throws ArithmeticException if the number of seconds is too large to be represented | |
| 311 | */ | |
| 312 | public Seconds toStandardSeconds() { | |
| 313 |
1
1. toStandardSeconds : mutated return of Object value for org/joda/time/Hours::toStandardSeconds to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Seconds.seconds(FieldUtils.safeMultiply(getValue(), DateTimeConstants.SECONDS_PER_HOUR)); |
| 314 | } | |
| 315 | ||
| 316 | //----------------------------------------------------------------------- | |
| 317 | /** | |
| 318 | * Converts this period in hours to a duration in milliseconds assuming a | |
| 319 | * 60 minute hour and 60 second minute. | |
| 320 | *
 | |
| 321 | * This method allows you to convert from a period to a duration. | |
| 322 | * However to achieve this it makes the assumption that all hours are | |
| 323 | * 60 minutes and all minutes are 60 seconds. This might not be true for an | |
| 324 | * unusual chronology, for example one that takes leap seconds into account. | |
| 325 | * However, the method is included as it is a useful operation for many | |
| 326 | * applications and business rules. | |
| 327 | * | |
| 328 | * @return a duration equivalent to this number of hours | |
| 329 | */ | |
| 330 | public Duration toStandardDuration() { | |
| 331 | long hours = getValue(); // assign to a long | |
| 332 |
2
1. toStandardDuration : Replaced long multiplication with division → NO_COVERAGE 2. toStandardDuration : mutated return of Object value for org/joda/time/Hours::toStandardDuration to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new Duration(hours * DateTimeConstants.MILLIS_PER_HOUR); |
| 333 | } | |
| 334 | ||
| 335 | //----------------------------------------------------------------------- | |
| 336 | /** | |
| 337 | * Gets the number of hours that this period represents. | |
| 338 | * | |
| 339 | * @return the number of hours in the period | |
| 340 | */ | |
| 341 | public int getHours() { | |
| 342 |
1
1. getHours : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return getValue(); |
| 343 | } | |
| 344 | ||
| 345 | //----------------------------------------------------------------------- | |
| 346 | /** | |
| 347 | * Returns a new instance with the specified number of hours added. | |
| 348 | *
 | |
| 349 | * This instance is immutable and unaffected by this method call. | |
| 350 | * | |
| 351 | * @param hours the amount of hours to add, may be negative | |
| 352 | * @return the new period plus the specified number of hours | |
| 353 | * @throws ArithmeticException if the result overflows an int | |
| 354 | */ | |
| 355 | public Hours plus(int hours) { | |
| 356 |
1
1. plus : negated conditional → NO_COVERAGE |
if (hours == 0) { |
| 357 |
1
1. plus : mutated return of Object value for org/joda/time/Hours::plus to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this; |
| 358 | } | |
| 359 |
1
1. plus : mutated return of Object value for org/joda/time/Hours::plus to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(FieldUtils.safeAdd(getValue(), hours)); |
| 360 | } | |
| 361 | ||
| 362 | /** | |
| 363 | * Returns a new instance with the specified number of hours added. | |
| 364 | *
 | |
| 365 | * This instance is immutable and unaffected by this method call. | |
| 366 | * | |
| 367 | * @param hours the amount of hours to add, may be negative, null means zero | |
| 368 | * @return the new period plus the specified number of hours | |
| 369 | * @throws ArithmeticException if the result overflows an int | |
| 370 | */ | |
| 371 | public Hours plus(Hours hours) { | |
| 372 |
1
1. plus : negated conditional → NO_COVERAGE |
if (hours == null) { |
| 373 |
1
1. plus : mutated return of Object value for org/joda/time/Hours::plus to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this; |
| 374 | } | |
| 375 |
1
1. plus : mutated return of Object value for org/joda/time/Hours::plus to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return plus(hours.getValue()); |
| 376 | } | |
| 377 | ||
| 378 | //----------------------------------------------------------------------- | |
| 379 | /** | |
| 380 | * Returns a new instance with the specified number of hours taken away. | |
| 381 | *
 | |
| 382 | * This instance is immutable and unaffected by this method call. | |
| 383 | * | |
| 384 | * @param hours the amount of hours to take away, may be negative | |
| 385 | * @return the new period minus the specified number of hours | |
| 386 | * @throws ArithmeticException if the result overflows an int | |
| 387 | */ | |
| 388 | public Hours minus(int hours) { | |
| 389 |
1
1. minus : mutated return of Object value for org/joda/time/Hours::minus to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return plus(FieldUtils.safeNegate(hours)); |
| 390 | } | |
| 391 | ||
| 392 | /** | |
| 393 | * Returns a new instance with the specified number of hours taken away. | |
| 394 | *
 | |
| 395 | * This instance is immutable and unaffected by this method call. | |
| 396 | * | |
| 397 | * @param hours the amount of hours to take away, may be negative, null means zero | |
| 398 | * @return the new period minus the specified number of hours | |
| 399 | * @throws ArithmeticException if the result overflows an int | |
| 400 | */ | |
| 401 | public Hours minus(Hours hours) { | |
| 402 |
1
1. minus : negated conditional → NO_COVERAGE |
if (hours == null) { |
| 403 |
1
1. minus : mutated return of Object value for org/joda/time/Hours::minus to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this; |
| 404 | } | |
| 405 |
1
1. minus : mutated return of Object value for org/joda/time/Hours::minus to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return minus(hours.getValue()); |
| 406 | } | |
| 407 | ||
| 408 | //----------------------------------------------------------------------- | |
| 409 | /** | |
| 410 | * Returns a new instance with the hours multiplied by the specified scalar. | |
| 411 | *
 | |
| 412 | * This instance is immutable and unaffected by this method call. | |
| 413 | * | |
| 414 | * @param scalar the amount to multiply by, may be negative | |
| 415 | * @return the new period multiplied by the specified scalar | |
| 416 | * @throws ArithmeticException if the result overflows an int | |
| 417 | */ | |
| 418 | public Hours multipliedBy(int scalar) { | |
| 419 |
1
1. multipliedBy : mutated return of Object value for org/joda/time/Hours::multipliedBy to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(FieldUtils.safeMultiply(getValue(), scalar)); |
| 420 | } | |
| 421 | ||
| 422 | /** | |
| 423 | * Returns a new instance with the hours divided by the specified divisor. | |
| 424 | * The calculation uses integer division, thus 3 divided by 2 is 1. | |
| 425 | *
 | |
| 426 | * This instance is immutable and unaffected by this method call. | |
| 427 | * | |
| 428 | * @param divisor the amount to divide by, may be negative | |
| 429 | * @return the new period divided by the specified divisor | |
| 430 | * @throws ArithmeticException if the divisor is zero | |
| 431 | */ | |
| 432 | public Hours dividedBy(int divisor) { | |
| 433 |
1
1. dividedBy : negated conditional → NO_COVERAGE |
if (divisor == 1) { |
| 434 |
1
1. dividedBy : mutated return of Object value for org/joda/time/Hours::dividedBy to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return this; |
| 435 | } | |
| 436 |
2
1. dividedBy : Replaced integer division with multiplication → NO_COVERAGE 2. dividedBy : mutated return of Object value for org/joda/time/Hours::dividedBy to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(getValue() / divisor); |
| 437 | } | |
| 438 | ||
| 439 | //----------------------------------------------------------------------- | |
| 440 | /** | |
| 441 | * Returns a new instance with the hours value negated. | |
| 442 | * | |
| 443 | * @return the new period with a negated value | |
| 444 | * @throws ArithmeticException if the result overflows an int | |
| 445 | */ | |
| 446 | public Hours negated() { | |
| 447 |
1
1. negated : mutated return of Object value for org/joda/time/Hours::negated to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Hours.hours(FieldUtils.safeNegate(getValue())); |
| 448 | } | |
| 449 | ||
| 450 | //----------------------------------------------------------------------- | |
| 451 | /** | |
| 452 | * Is this hours instance greater than the specified number of hours. | |
| 453 | * | |
| 454 | * @param other the other period, null means zero | |
| 455 | * @return true if this hours instance is greater than the specified one | |
| 456 | */ | |
| 457 | public boolean isGreaterThan(Hours other) { | |
| 458 |
1
1. isGreaterThan : negated conditional → NO_COVERAGE |
if (other == null) { |
| 459 |
3
1. isGreaterThan : changed conditional boundary → NO_COVERAGE 2. isGreaterThan : negated conditional → NO_COVERAGE 3. isGreaterThan : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return getValue() > 0; |
| 460 | } | |
| 461 |
3
1. isGreaterThan : changed conditional boundary → NO_COVERAGE 2. isGreaterThan : negated conditional → NO_COVERAGE 3. isGreaterThan : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return getValue() > other.getValue(); |
| 462 | } | |
| 463 | ||
| 464 | /** | |
| 465 | * Is this hours instance less than the specified number of hours. | |
| 466 | * | |
| 467 | * @param other the other period, null means zero | |
| 468 | * @return true if this hours instance is less than the specified one | |
| 469 | */ | |
| 470 | public boolean isLessThan(Hours other) { | |
| 471 |
1
1. isLessThan : negated conditional → NO_COVERAGE |
if (other == null) { |
| 472 |
3
1. isLessThan : changed conditional boundary → NO_COVERAGE 2. isLessThan : negated conditional → NO_COVERAGE 3. isLessThan : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return getValue() < 0; |
| 473 | } | |
| 474 |
3
1. isLessThan : changed conditional boundary → NO_COVERAGE 2. isLessThan : negated conditional → NO_COVERAGE 3. isLessThan : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return getValue() < other.getValue(); |
| 475 | } | |
| 476 | ||
| 477 | //----------------------------------------------------------------------- | |
| 478 | /** | |
| 479 | * Gets this instance as a String in the ISO8601 duration format. | |
| 480 | *
 | |
| 481 | * For example, "PT4H" represents 4 hours. | |
| 482 | * | |
| 483 | * @return the value as an ISO8601 string | |
| 484 | */ | |
| 485 | @ToString | |
| 486 | public String toString() { | |
| 487 |
1
1. toString : mutated return of Object value for org/joda/time/Hours::toString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "PT" + String.valueOf(getValue()) + "H"; |
| 488 | } | |
| 489 | ||
| 490 | } | |
Mutations | ||
| 84 |
1.1 |
|
| 86 |
1.1 |
|
| 88 |
1.1 |
|
| 90 |
1.1 |
|
| 92 |
1.1 |
|
| 94 |
1.1 |
|
| 96 |
1.1 |
|
| 98 |
1.1 |
|
| 100 |
1.1 |
|
| 102 |
1.1 |
|
| 104 |
1.1 |
|
| 106 |
1.1 |
|
| 122 |
1.1 |
|
| 138 |
1.1 2.2 |
|
| 142 |
1.1 |
|
| 145 |
1.1 |
|
| 157 |
1.1 |
|
| 158 |
1.1 |
|
| 161 |
1.1 |
|
| 186 |
1.1 |
|
| 202 |
1.1 |
|
| 203 |
1.1 |
|
| 206 |
1.1 |
|
| 227 |
1.1 |
|
| 237 |
1.1 |
|
| 246 |
1.1 |
|
| 264 |
1.1 2.2 |
|
| 280 |
1.1 2.2 |
|
| 296 |
1.1 |
|
| 313 |
1.1 |
|
| 332 |
1.1 2.2 |
|
| 342 |
1.1 |
|
| 356 |
1.1 |
|
| 357 |
1.1 |
|
| 359 |
1.1 |
|
| 372 |
1.1 |
|
| 373 |
1.1 |
|
| 375 |
1.1 |
|
| 389 |
1.1 |
|
| 402 |
1.1 |
|
| 403 |
1.1 |
|
| 405 |
1.1 |
|
| 419 |
1.1 |
|
| 433 |
1.1 |
|
| 434 |
1.1 |
|
| 436 |
1.1 2.2 |
|
| 447 |
1.1 |
|
| 458 |
1.1 |
|
| 459 |
1.1 2.2 3.3 |
|
| 461 |
1.1 2.2 3.3 |
|
| 471 |
1.1 |
|
| 472 |
1.1 2.2 3.3 |
|
| 474 |
1.1 2.2 3.3 |
|
| 487 |
1.1 |


Welcome to the day 19 of the Azure Advent Calendar!
Today we are going to talk about the Azure Dedicated Host. This is a new service offering in Microsoft Azure that was originally introduced in August 2019 as a Public Preview, and it is generally available since December 2019.
Azure Dedicated Host provides a single-tenant physical server to host your Azure virtual machines for Windows and Linux. The server capacity is not shared with other customers. As a result, you can run general purpose, memory intensive or compute intensive workloads in a hardware-isolated and virtualized server environment dedicated to your organization. With Azure Dedicated Host, you can address specific compliance requirements while increasing visibility and control over your underlying infrastructure.
As part of Azure Advent Calendar, I created a little video where you can find more information about it and see it in action:
If you are not familiar with Azure Advent Calendar, here are the links that you should follow:
I am excited about all the great content that is being published daily as part of this initiative.
Big thanks to Gregor and Richard for this initiative and for the opportunity to be part of this event.
Happy learning and happy holidays.
Vukašin Terzić


General
Board configuration
- Modify settings associated with board, forum, member registration and member lockouts
Server configuration
- Server and domain dependent settings


This is a Latin keyboard for transcription of Balochi languages.
The Balochi Scientific Keyman Keyboard is distributed under The MIT License (MIT)


Try a different routes in Aalborg Municipality for a different outdoors activities. Nature is about being free. You decide at what pace you want to go, how far you want to go, and when to stop for breaks.


House Dems release transcripts from impeachment depositions The two witnesses were on the phone call between Trump and the Ukrainian president; Chad Pergram has the latest. 17 Nov 2019, 14:11


--- layout: post title: Logging, logging, logging…… date: 2010-08-22 18:50:18.000000000 -05:00 type: post published: true status: publish categories: - Ruby on Rails tags: - wxPython meta: _edit_last: '15714693' _wp_old_slug: '' _wpas_skip_twitter: '1' author: login: broberts65 email<EMAIL_ADDRESS>display_name: Bob Roberts first_name: '' last_name: '' ---
So with a lot of help from friends and a programmer that works with us, we have just about completed our first wxPython GUI that we are going to use for a clients interface. For those that have a clue about basic programming (which I did NOT) I am sure that you are familiar with setting break points to troubleshoot your code. Even better than this (in my opinion and easier as well) is the use of logging. Using logging statements all over your code in areas that may be giving you problems, you can see where the issue may be occurring.
[sourcecode language="Python"]
import logging
logging.basicConfig(filename='dev.log',level=logging.DEBUG,filemode='w',
format='%(filename)s::%(module)s::%(funcName)s::%(lineno)d %(levelname)s %(message)s'
)
# above is the config/setup. Put at top of file.
# here's some examples using it.
# look in "dev.log" for output!
def blah() :
logging.debug("starting blah!")
logging.debug("finished blah!")
blah()
[/sourcecode]
Now when you run your process you can check your dev.log to see if all of your logging statement are there. If they are not all there, then you can see where the last statement was and it helps to zero in on your problem.


SubControllers in ASP.NET MVC
I should have known something was up when I caught Jeffrey Palermo (my boss at Headspring) browsing the ASP.NET MVC Preview 5 source.
We're working on a enterprise web application using ASP.NET MVC.  We wanted the ability to push behavior decisions to smaller and smaller pieces, and reuse those pieces on other pages. We needed testability, dependency injection and minimal friction. We needed composition.
Since I have been (hardly) working on components of CodeCampServer and hanging out with others interested in MVC I had heard about these SubController things. "We need SubControllers!" and "When they finally put in SubControllers we can do X!" "RenderAction is troublesome because of Y and partials are limited for reasons of Z!"
Admittedly I had no idea what they were talking about, but I sort of fell in line and waited for something cool to come out of Redmond.
Still, since he's literally writing the book on ASP.NET MVC, I shouldn't have been surprised when after a few hours of keyboard clicking Jeffrey looked up and said, "Hey, I just committed SubControllers."
Then a few days later he wrote a sample application and sent some info to the MvcContrib mailing list. He's been heads-down on our project and I've seen a few questions online about how to create reusable components in ASP.NET MVC, so I asked Jeffrey if I could do a write-up here. To be clear, I didn't invent, write, or even imagine SubControllers.. it's all Jeffrey… but I have been using them with success for a few weeks.
You may want to check out the sample before I dive into the details.
Here's a few screenshots of the sample in action. The rendered page (each component there is rendered by an isolated SubController's action) :
A nested SubController:
What is this "SubController"?
So let's take each of these in turn.
How it works
First, a look at the ISubController interface:
public interface ISubController : IController
{
Action GetResult(ControllerBase parentController);
}
Pretty straight forward. It's a method named GetResult that takes a ControllerBase parameter and returns an Action.
Here is the SubController class' implementation of that method:
public virtual Action GetResult(ControllerBase parentController)
{
RequestContext requestContext = GetNewRequestContextFromController(parentController);
return () => Execute(requestContext);
}
Ok. Now we are getting somewhere. This System.Action is a delegate with no arguments and a return type of void. What it's actually doing is encapsulating a regular Controller's Execute method. Which pops off the controller action method: stuffs ViewData and renders the View and all that. The parameterless delegate Action is new in .NET 3.5 (though Action<T> was introduced in .NET 2.0).
Anyway, that's the real meaty bit of SubControllers: providing a delegate that can be put into ViewData.
So the next thing that has to happen is the delegate has to be created to represent the SubController's action method (that returns an ActionResult). This is where we start using the convention of naming the SubController's action method in an obvious way. We'll come back to this convention.
Let's take a look at the rest of the SubController class:
public RequestContext GetNewRequestContextFromController(ControllerBase parentController)
{
RouteData parentRouteData = parentController.ControllerContext.RouteData;
var routeData = new RouteData(parentRouteData.Route, parentRouteData.RouteHandler);
string controllerName = GetControllerName();
routeData.Values["controller"] = controllerName;
routeData.Values["action"] = controllerName;
return new RequestContext(parentController.ControllerContext.HttpContext, routeData);
}
public string GetControllerName()
{
return GetType().Name.ToLowerInvariant().Replace("subcontroller", "").Replace("controller", "");
}
The important thing to note is that the GetControllerName() method returns the part of the controller name minus the word "controller" and "subcontroller". So if your SubController is named ProductDetailSubController that method would return "ProductDetail".
The other important thing to note is that in the GetNewRequestContextFromController(…) method the action key of the routeData is set to this same value. In our example, "ProductDetail" is the action.
When the SubController's delegate is eventually invoked it will execute a method on the SubController with the name "ProductDetail".
Therefore the convention is to use an action method with the same name as the SubController (minus the text "subcontroller" or "controller").
So far we see that SubControllers give us a delegate (System.Action) that represents an invocation of its method with the conventional name.
Hello SubControllers
Let's take a quick detour to see what a SubController might look like:
public class FirstLevelSubController : SubController
{
public ViewResult FirstLevel()
{
ViewData["text"] = "I am a first level controller";
return View();
}
}
This is straight out of Jeffrey's example. Looks just like a regular controller except it derives from SubController and has one action method with the conventional name. FirstLevelSubController's GetResult() will return a delegate that represents the FirstLevel() method.
By the way, you test SubControllers exactly the same way as you would regular controllers: execute the action method and assert that the ActionResult is in the proper state with the correct ViewData and ViewName.
Using SubControllers from host Controllers
Now that we have the System.Action delegate we need to get it into ViewData. This is how I started out doing it:
public class HomeController : Controller
{
public ActionResult Index(FirstLevelSubController firstLevel)
{
ViewData["firstLevel"] = firstLevel.GetResult(this);
return View();
}
}
… and so on, and so on, for each SubController in the parameter list. This works fine. The System.Action gets put in ViewData and we can invoke it from the view just like we expect. Testing it is straightforward as well, just mock the SubController and expect that its action gets put in ViewData:
[Test]
public void Index_puts_subcontroller_action_into_viewdata()
{
var controller = new HomeController();
var firstLevelSubController = MockRepository.GenerateStub<FirstLevelSubController>();
Action stubAction = () => { };
firstLevelSubController.Stub(sub => sub.GetResult(controller)).Return(stubAction);
var result = controller.Index(firstLevelSubController) as ViewResult;
Assert.That(result.ViewData.Get<Action>("firstLevel"), Is.EqualTo(stubAction));
}
Yeah, straight forward as in straight forward but not as in easy or concise (especially when it comes to actions that depend on many SubControllers - imagine 5 or 7 or 10 stubs in there..)..
Going frictionless
Enter the SubControllerActionToViewDataAttribute! This ActionFilterAttribute cycles through the host action's parameters (filterContext.ActionParameters - a neat trick) and puts each SubController parameter's System.Action into ViewData:
public class SubControllerActionToViewDataAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
foreach (var pair in filterContext.ActionParameters)
{
object value = pair.Value;
if(value == null)
{
continue;
}
if (typeof(ISubController).IsAssignableFrom(value.GetType()))
{
var controller = (ISubController) value;
filterContext.Controller.ViewData.Add(pair.Key, controller.GetResult(filterContext.Controller));
}
}
base.OnActionExecuting(filterContext);
}
}
We have added a second convention: the SubController's parameter variable name (pair.Key above) is the key of the respective System.Action in ViewData.
The concern now becomes testing that the attribute works and that the your controllers have the attribute, not testing that individual SubController's System.Actions are put in ViewData. These tests are in MvcContrib. This frees developers from the weight of having to write cumbersome tests.
In fact, the SubController base class in MvcContrib has this attribute allowing for infinite nesting.
"Calling" the SubController from the view
Once we pop that System.Action delegate into ViewData we can invoke it straight from the host action's view:
<% ViewData.Get<Action>("firstLevel").Invoke(); %>
The strong-typed Get<T>() method is another feature built into MvcContrib.
Dependency injection
Finally, we definitely need rich dependency injection support in these SubControllers. MVC Preview 5 introduced theIModelBinder interface that is responsible for constructing action parameters. We can add them in Global.asax or wherever the controllers are constructed:
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
ModelBinders.DefaultBinder = new SubControllerBinder();
}
Here is the basic implementation of SubControllerBinder in MvcContrib:
public class SubControllerBinder : DefaultModelBinder
{
protected override object ConvertType(CultureInfo culture, object value, Type destinationType)
{
if (typeof (ISubController).IsAssignableFrom(destinationType))
{
object instance = CreateSubController(destinationType);
if (instance == null)
{
throw new InvalidOperationException(destinationType + " not created properly.");
}
return instance;
}
return base.ConvertType(culture, value, destinationType);
}
///<summary>
/// Creates the subcontroller given its type. Override this method to wire into an IoC container
///</summary>
///<param name="destinationType">The type of subcontroller</param>
///<returns>an object instance</returns>
public virtual object CreateSubController(Type destinationType)
{
return Activator.CreateInstance(destinationType, true);
}
}
And you can wire this up to a container with ease:
public class StructureMapSubControllerBinder : SubControllerBinder
{
public override object CreateSubController(Type destinationType)
{
object instance = ObjectFactory.GetInstance(destinationType);
if (instance == null)
{
throw new InvalidOperationException(destinationType + " not registered with StructureMap");
}
return instance;
}
}
So there you have it. You can download and explore a complete working sample from MvcContrib. If you have a suggestion for improvement MvcContrib is accepting patches. I have a few more posts in the queue about some intermediate usages and testing.


| Company | Contact | Phone | Active | Groups | Date | ||
|---|---|---|---|---|---|---|---|
| 1 | Flatley-Wolff View | Contacts | Delete | Wilfred Runolfsson |<EMAIL_ADDRESS>|<PHONE_NUMBER> |
|
2019-07-29 | |
| 2 | Feeney-Pouros View | Contacts | Delete | Beau Reilly |<EMAIL_ADDRESS>| +1<PHONE_NUMBER> |
|
VIP Wholesaler | 2019-07-29 |
| 3 | Gorczany Barton View | Contacts | Delete | Kristian Rowe |<EMAIL_ADDRESS>| 977-0658 |
|
High Budget | 2019-07-29 |
| 4 | Hilll Inc View | Contacts | Delete | Gideon Schowalter |<EMAIL_ADDRESS>| 1-486-985-8752 |
|
VIP Wholesaler | 2019-07-29 |
| 5 | Bechtelar Lueilwitz View | Contacts | Delete | Tremaine Bailey |<EMAIL_ADDRESS>| 1-521-678-5686 |
|
High Budget | 2019-07-29 |
| 6 | Bogisich LLC View | Contacts | Delete | Jules Rutherford |<EMAIL_ADDRESS>|<PHONE_NUMBER> |
|
VIP Wholesaler | 2019-07-29 |
| 7 | Herman-Zieme View | Contacts | Delete | Emerson Wuckert |<EMAIL_ADDRESS>|<PHONE_NUMBER> |
|
High Budget | 2019-07-29 |
| 8 | Kutch-Prohaska View | Contacts | Delete | Reed Pouros |<EMAIL_ADDRESS>|<PHONE_NUMBER> |
|
VIP Low Budget | 2019-07-29 |
| 9 | Flatley Mraz View | Contacts | Delete | Darien Kozey |<EMAIL_ADDRESS>|<PHONE_NUMBER> |
|
Wholesaler | 2019-07-29 |
| 10 | Upton and Sons View | Contacts | Delete | Haskell Toy |<EMAIL_ADDRESS>|<PHONE_NUMBER> |
|
VIP High Budget | 2019-07-29 |
| 11 | Schultz Waters View | Contacts | Delete | Prof. Fletcher Jerde |<EMAIL_ADDRESS>|<PHONE_NUMBER> |
|
2019-07-30 |


×
The game has 2 players, playing in rounds
- In each turn, a player rolls a "dice", with the value represented by the fingers of the artists. The player rolls it many times as he whishes. Each result get added to his ROUND score
- BUT, if the player rolls a 6 (Dave Grohl), all his ROUND score gets lost. After that, it's the next player's turn
- The player can choose to 'Hold', which means that his ROUND score gets added to his GLOBAL score. After that, it's the next player's turn
- The first player to reach 100 points on GLOBAL score wins the game
-
1 point
-
2 points
-
3 points
-
4 points
-
5 points
-
looser


Toggle navigation
Menu
skills
Work
About
Contact
Home
Welcom to My World
I am Ly.
I like the challenge.
❮
❯


Burton mum looks amazing after being 'shocked' into losing weight
She's been through an incredible change
by Rhea TurnerA Winshill mum was shocked into losing four stone following a stark warning from a colleague - and is now helping others do the same.
Angela Grist started piling on the pounds after the births of her children.
But after a recent health scare she decided enough was enough and swapped fish and chips for fresh fruit.
Angela, 55, said: "When the children were younger I just got used to looking after them first.
"I worked full time so I was cooking child-friendly meals that weren't always the healthiest, and eating out more.
"I have always eaten quite healthily but would have takeaways if I was tired.
"Sometimes it was just easier to go to the fish and chip shop.
"I was also drinking alcohol more regularly then I do now; I would have it three or four times a week.
"Before I knew it, my weight was creeping up.
"You try to lose weight and think you can manage it, but then, when you are happy and comfortable in a relationship and you get complacent, the weight piles on again."
Angela, who works in mental health services, said she felt her weight was holding her back on a trip to New York, but her wake-up call came from a colleague who warned her about her health.
She said: "I couldn’t enjoy the things I wanted to. I went to New York with my husband and I struggled walking round everywhere.
"Then a couple of years ago I had a brain scan as I was getting quite severe headaches. Thankfully the scan was all clear but I spoke to a colleague about it.
"I work in memory services so I asked one of my colleagues who is a doctor about it. He told me not to worry, but ten minutes later he came to find me and said I need to look after my cardiovascular hygiene, which basically told me to watch my weight and look after my cholesterol and blood pressure.
"Working with people with dementia I know that if those things are compromised there can be serious health risks.
"It dawned on me then that I was putting my own health at risk and it made me change my lifestyle."
The mother of two decided to join her local Slimming World group after previously having success with the programme.
She said: "I have done it two or three times over a span of 25 years and this is my third journey with them.
"It was the late 80s and early 90s when I first started and I hadn’t been in about 12 years when I decided to go back.
"After meeting my husband, Simon, I wanted to enjoy life more.
"I wanted to be able to go to normal shops and buy things off the rack."
Angela tipped the scales at 15 stone and five pounds when she joined the Burton group in 2015 and was wearing sizes 16 to 18.
But after changing her diet she says her life has been changed and she now fits in to sizes 10 to 12 - and sometimes an eight.
She said: "I have lost nearly four stone in total and I feel like a different person.
"My ultimate aim was to get healthier. I wanted to walk without getting out of breath and get my confidence back, but the change has been incredible.
"I have been at my target weight for a couple of years now and I have much more energy and I feel more confident. I can actually dress up and look nice.
"Sometimes it is really easy to think I have reached target and take your foot off the gas, so I joined a social team which keeps me motivated and I am always trying to help others.
"I have been called an inspiration and given the title of 'woman of the year' from the other slimmers.
"It has changed the way I think about food.
"I batch-cook now. I get the cookbook out and plan ahead and my husband is very supportive and gets involved too."
Her newfound confidence has given Angela a boost and she is now taking a leap into helping others by joining Slimming World as a consultant.
She said: "It is a bit daunting but I am very excited. I have been asked before but with working full time I couldn’t commit.
"However, I am retiring next year and I have made so many encouraging friends that, when the opportunity came about, they gave me the belief I could do it."
Angela’s Diet: Before and After
Before
Breakfast - Two slices of toast with butter and marmalade
Lunch - A sandwich and crisps
Dinner - A quick meal or roast dinner
Snacks - Crisps and biscuits
After
Breakfast - Sometimes a big cooked breakfast and other times porridge and fruit; or scrambled eggs, beans, mushrooms and toast
Lunch - Salad or leftovers, a jacket potato or chilli con carne
Dinner - A Slimming World meal, such as chips or homemade burgers
Snacks - Fruit and yoghurt


Location: Seattle
Open Hours: From 6:00 am until 8:00 am
Contact Tel.: +12066561175
Location: Tokyo
Open Hours: From 6:00 am until 8:00 am
Contact Tel.: +817095891992
Location: Dubai
Open Hours: From 6:00 am until 8:00 am
Contact Tel.: +971559537457
Location: Paris
Open Hours: From 6:00 am until 8:00 am
Contact Tel.: +33765558312
Location: Lima
Open Hours: From 6:00 am until 8:00 am
Contact Tel.: +51-955-5466-06


--- title: Mobile web vs native apps excerpt: 'A balanced opinion piece on the rivalry between #Mobile Web vs Native Apps: http://bit.ly/e9hBCS' date: '2011-03-31 09:58:13 +0200' date_gmt: '2011-03-31 07:58:13 +0200' categories: - Webdev tags: - tweets - web - design - development ---
A balanced opinion piece on the rivalry between #Mobile Web vs Native Apps: http://bit.ly/e9hBCS


Show steem earnings of the selected steemit account
@
Your username is required.
steem node URL
URL is required.
get earnings
Results


Women’s 16-step program (derived from 12-step program)
PARENTING CLASS
Focus
Strength-based parenting workshops
Centering on step-by-step parent-child communication skills
Assertive parenting vs. passive parenting
Understanding the child-mind
Safe parenting; listening to kids / being heard
Letting go of negative, punitive approaches
We clearly outline:
Firm-but-fair vs. unlimited freedom styles of parenting
What parents can do for their children in an unkind world
Helping them without “put-downs” and programmed unhappiness
Books Referenced:
The Secret Of Happy Children by Steven Biddulph
Growing Up Again, Parenting Ourselves, Parenting Our Children by Jean Illsley Clarke and Connie Dawson
RELATIONSHIP CLASS
Improving conscious relationship skills
Using book and video tapes of Getting the Love You Want by Harville Hendrix
Discover unconscious motivations and personal image
Improve communication skills, boundaries, family dynamics
“I” statements
Active listening
Paraphrasing
Feelings identification and expression
Role playing
Identifying relationship patterns
Journaling feelings
CAREER and LIFE SKILLS CLASS
Focus
Preparing clients for workforce
Choosing inspired career paths
This Class Will Include:
Resume writing
Interviewing skills
Dress for success
Career evaluation testing
Educational information
Look at relationship with money
Learn about negative family programming regarding prosperity issues
Create a life goals list and write a vision and mission statement
CHILDREN’S ADDICTION RECOVERY GROUP
Addiction education–an artistic focus to help children process their feelings about family misuse of drugs and alcohol
CHILDREN’S GROUPS: Ages 5-9, 10-13, 14-18
Coping with grief and loss
Self esteem
Feelings identification
Conflict resolution issues
Using creative art techniques
SPIRITUALITY and HEALING CLASS
Exploring spiritual beliefs
Healing physical, mental, emotional and spiritual health issues
Developing a personal relationship with a higher power
May use prayer, meditation, breathwork, Yoga, Tai Chi, and other spiritual practices
EXPRESSIVE ART THERAPY CLASS
Reparenting recovery work
Learning to live a sober life
Learning to play again
For children and adults
Includes:
Storytelling, music therapy, creative movement, visual arts, sculpture with clay work, drama, dress-up, parts work, role playing, and poetry therapy. Children and parents will work together at times.
CLINICAL TRAINING CLASSES (New Calendar Starting 2017)


[§556A-1] Short title. This chapter may be cited as the Uniform Fiduciary Access to Digital Assets Act (2016). [L 2016, c 162, pt of §1]


Sheetrock is a jQuery plugin for querying, retrieving, and displaying data from Google Spreadsheets. Use it to load entire sheets or leverage SQL-like queries to treat Google Spreadsheets as a quick-and-dirty JSON datastore. All you need is the URL of a public Google Spreadsheet. It requires no backend code whatsoever—everything is done in the browser.
Basic retrieval is a snap but you can also:
Please see the GitHub repository for detailed documentation of the available options or to contribute, explore, or raise an issue.
Using Bower?
bower install jquery-sheetrock
Otherwise, just grab the latest version (unminified) and stash it in your project. Sheetrock requires jQuery >= 1.6.
These are real, live examples. View source! Extend and adapt them! Table styling on this page is provided by Bootstrap.
Sheetrock’s only required option is the URL of a public Google Spreadsheet. (Short version: Click “Share” and set visibility to “Anyone with the link” or “Public on the web.”) As an example, let’s use this spreadsheet, which contains 1986 National League batting statistics.
The most basic use case of Sheetrock simply grabs the spreadsheet and makes a table out of it.
// Load an entire sheet.
$('#statistics').sheetrock({
url: mySpreadsheet
});
∞
Show a jsFiddle for this example.
However, that’s not very exciting, so we won’t show the result inline here—especially since the spreadsheet has a couple hundred rows.
Let’s move on to something slightly more interesting. Using Sheetrock, we can limit our scope and analyze the data using SQL-like queries. We can also provide a chunkSize
to load just a portion of the data. We can always grab more data later—Sheetrock keeps track of how many rows you’ve requested and the next request will pick up where you left off.
Let’s look at switch hitters and rank them by batting average. We’ll only grab the columns we care about and fetch just the top ten to help focus the reader’s attention.
∞
Show a jsFiddle for this example.
Tables are nice, but we might want to represent the data in different ways. Let’s generate an ordered list by passing in a Handlebars template. This time we’ll rank the top five players by home runs.
∞
Show a jsFiddle for this example.
Next, let’s group some data. For a more readable query, we’ll use column labels (%Team%
and %RBI%
) instead of column letters, and we’ll specify the labels we want Sheetrock to use when it returns the data (labels: ['TeamName', 'TeamRBI']
).
∞
Show a jsFiddle for this example.
Detailed documentation is available at the GitHub repository. Please feel free to raise an issue if you are having a problem with Sheetrock.
Sheetrock was written by Chris Zarate and is released under the MIT license.
This has nothing to do with Sheetrock, but if you’re interested, here’s how the examples on this page were generated. There’s no mockup code—everything including the code below is generated from the actual code that runs on this page.


Prince Andrew Is Stepping Away From His Royal Duties
The royal has been embroiled in controversy over his link to the late Jeffrey Epstein.
by Layla IlchiPrince Andrew is stepping away from his royal duties only days after his controversial interview on the BBC.
The Duke of York released a statement Wednesday saying that he asked his mother, Queen Elizabeth II, for permission to step back from his public duties for the foreseeable future, due to the increasing scrutiny surrounding his link with the late Jeffrey Epstein.
“It has become clear to me over the last few days that the circumstances relating to my former association with Jeffrey Epstein has become a major disruption to my family’s work and the valuable work going on in the many organizations and charities that I am proud to support,” the statement reads.
The intense scrutiny of Prince Andrew increased over the weekend after a cringeworthy interview with BBC’s “Newsnight” went viral, during which the royal denied having any knowledge of Epstein’s alleged child sex trafficking operation and the activities going on at Epstein’s many homes.
He also stated during the interview that he has no memory of meeting Epstein accuser Virginia Roberts Giuffre, who has alleged that she had sex with the royal multiple times because of Epstein.
A photograph of Giuffre and Prince Andrew has circulated online since charges were filed against Epstein over the summer. However, the royal claimed during the interview that he didn’t know how the picture came into existence considering he was picking up daughter Princess Beatrice from a pizza party that night.
Prince Andrew has already experienced setbacks from the interview. On Monday KPMG ended its sponsorship of the royal’s entrepreneurship initiative, Pitch@Palace, according to BBC. The Financial Times also reported Monday that many other firms that supported the prince’s charities were either not renewing their support or reevaluating it.
“I continue to unequivocally regret my ill-judged association with Jeffrey Epstein,” Prince Andrew’s statement continued. “His suicide has left many unanswered questions, particularly for his victims, and I deeply sympathize with everyone who has been affected and wants some form of closure.”
Read more here:
L Brands’ Les Wexner Claims Jeffrey Epstein Embezzled Over $46 Million
Actors Joke About Prince Andrew at Walpole British Luxury Awards
L Brands’ Les Wexner Makes First Comments on Jeffrey Epstein
WATCH: President Trump Opens LVMH’s Texas Factory


Tooltip
Overview
Dark Theme
Light Theme
Default mode
HD Video Player
With template
With animation
Projector PlusHD, Projectors


duperemove
Finds duplicate filesystem extents and optionally schedule them for deduplication.
An extent is small part of a file inside the filesystem.
On some filesystems one extent can be referenced multiple times, when parts of the content of the files are identical.
More information: home page
- Search for duplicate extents in a directory and show them:
duperemove -r path/to/directory
- Deduplicate duplicate extents on a Btrfs or XFS (experimental) filesystem:
duperemove -r -d path/to/directory
- Use a hash file to store extent hashes (less memory usage and can be reused on subsequent runs):
duperemove -r -d --hashfile=path/to/hashfile path/to/directory
- Limit I/O threads (for hashing and dedupe stage) and CPU threads (for duplicate extent finding stage):
duperemove -r -d --hashfile=path/to/hashfile --io-threads=N --cpu-threads=N path/to/directory


Gecode::Search::Par::PBS< Collect > Class Template Reference
Parallel portfolio engine implementation. More...
#include <pbs.hh>
Public Member Functions | |
| PBS (Engine **s, Stop **so, unsigned int n, const Statistics &stat) | |
| Initialize. | |
| virtual Space * | next (void) |
| Return next solution (NULL, if none exists or search has been stopped). | |
| virtual Statistics | statistics (void) const |
| Return statistics. | |
| virtual bool | stopped (void) const |
| Check whether engine has been stopped. | |
| virtual void | constrain (const Space &b) |
| Constrain future solutions to be better than b. | |
| virtual | ~PBS (void) |
| Destructor. | |
Protected Member Functions | |
| bool | report (Slave< Collect > *slave, Space *s) |
| Process report from slave, return false if solution was ignored. | |
Protected Attributes | |
| Statistics | stat |
| Master statistics. | |
| Slave< Collect > ** | slaves |
| Slave engines. | |
| unsigned int | n_slaves |
| Number of slave engines. | |
| unsigned int | n_active |
| Number of active slave engines. | |
| bool | slave_stop |
| Whether a slave has been stopped. | |
| volatile bool | tostop |
| Shared stop flag. | |
| Collect | solutions |
| Collect solutions in this. | |
| Support::Mutex | m |
| Mutex for synchronization. | |
| unsigned int | n_busy |
| Number of busy slaves. | |
| Support::Event | idle |
| Signal that number of busy slaves becomes zero. |
Detailed Description
template<class Collect>
class Gecode::Search::Par::PBS< Collect >
Parallel portfolio engine implementation.
Definition at line 138 of file pbs.hh.
Constructor & Destructor Documentation
template<class Collect >
| Gecode::Search::Par::PBS< Collect >::PBS | ( | Engine ** | s, | |
| Stop ** | so, | |||
| unsigned int | n, | |||
| const Statistics & | stat | |||
| ) | [inline] |
Initialize.
The key invariant of the engine is as follows:
template<class Collect >
| Gecode::Search::Par::PBS< Collect >::~PBS | ( | void | ) | [inline, virtual] |
Member Function Documentation
template<class Collect>
| bool Gecode::Search::Par::PBS< Collect >::report | ( | Slave< Collect > * | slave, | |
| Space * | s | |||
| ) | [inline, protected] |
template<class Collect >
| Space * Gecode::Search::Par::PBS< Collect >::next | ( | void | ) | [inline, virtual] |
Return next solution (NULL, if none exists or search has been stopped).
Reimplemented from Gecode::Search::Par::Engine< Tracer >.
template<class Collect >
| Statistics Gecode::Search::Par::PBS< Collect >::statistics | ( | void | ) | const [inline, virtual] |
template<class Collect >
| bool Gecode::Search::Par::PBS< Collect >::stopped | ( | void | ) | const [inline, virtual] |
Check whether engine has been stopped.
Reimplemented from Gecode::Search::Par::Engine< Tracer >.
template<class Collect >
| void Gecode::Search::Par::PBS< Collect >::constrain | ( | const Space & | b | ) | [inline, virtual] |
Constrain future solutions to be better than b.
Reimplemented from Gecode::Search::Engine.
Member Data Documentation
template<class Collect>
Statistics Gecode::Search::Par::PBS< Collect >::stat [protected] |
template<class Collect>
Slave<Collect>** Gecode::Search::Par::PBS< Collect >::slaves [protected] |
template<class Collect>
unsigned int Gecode::Search::Par::PBS< Collect >::n_slaves [protected] |
template<class Collect>
unsigned int Gecode::Search::Par::PBS< Collect >::n_active [protected] |
template<class Collect>
bool Gecode::Search::Par::PBS< Collect >::slave_stop [protected] |
template<class Collect>
volatile bool Gecode::Search::Par::PBS< Collect >::tostop [protected] |
template<class Collect>
Collect Gecode::Search::Par::PBS< Collect >::solutions [protected] |
Collect solutions in this.
Reimplemented from Gecode::Search::Par::Engine< Tracer >.
template<class Collect>
Support::Mutex Gecode::Search::Par::PBS< Collect >::m [protected] |
template<class Collect>
unsigned int Gecode::Search::Par::PBS< Collect >::n_busy [protected] |
Number of busy slaves.
Reimplemented from Gecode::Search::Par::Engine< Tracer >.
template<class Collect>
Support::Event Gecode::Search::Par::PBS< Collect >::idle [protected] |
The documentation for this class was generated from the following files:


Before Change
if loss_func_params is not None:
self._loss_func_params = loss_func_params
else:
self._loss_func_params = {}
self._data_loss_func = None
self.make_callable_loss_func(loss_type)
def make_callable_loss_func(self, type_str):
After Change
name="loss_function"):
super(LossFunction, self).__init__(name=name)
assert n_class > 0, \
"Number of classes for segmentation loss should be positive."
self._num_classes = n_class
// set loss function and function-specific additional params.
self._data_loss_func = LossSegmentationFactory.create(loss_type)