- java.lang.Object
-
- org.joda.money.Money
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<BigMoneyProvider>
,BigMoneyProvider
public final class Money extends java.lang.Object implements BigMoneyProvider, java.lang.Comparable<BigMoneyProvider>, java.io.Serializable
An amount of money with the standard decimal places defined by the currency.This class represents a quantity of money, stored as a
BigDecimal
amount in a singlecurrency
.Every currency has a certain standard number of decimal places. This is typically 2 (Euro, British Pound, US Dollar) but might be 0 (Japanese Yen), 1 (Vietnamese Dong) or 3 (Bahrain Dinar). The
Money
class is fixed to this number of decimal places.For example, US dollars has a standard number of decimal places of 2. The major units are dollars. The minor units are cents, 100 to the dollar. This class does not allow calculations on fractions of a cent.
This class is immutable and thread-safe.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Money
abs()
Returns a copy of this monetary value with a positive amount.int
compareTo(BigMoneyProvider other)
Compares this monetary value to another.Money
convertedTo(CurrencyUnit currency, java.math.BigDecimal conversionMultipler, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value converted into another currency using the specified conversion rate, with a rounding mode used to adjust the decimal places in the result.Money
dividedBy(double valueToDivideBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value divided by the specified value.Money
dividedBy(long valueToDivideBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value divided by the specified value.Money
dividedBy(java.math.BigDecimal valueToDivideBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value divided by the specified value.boolean
equals(java.lang.Object other)
Checks if this monetary value equals another.java.math.BigDecimal
getAmount()
Gets the amount.java.math.BigDecimal
getAmountMajor()
Gets the amount in major units as aBigDecimal
with scale 0.int
getAmountMajorInt()
Gets the amount in major units as anint
.long
getAmountMajorLong()
Gets the amount in major units as along
.java.math.BigDecimal
getAmountMinor()
Gets the amount in minor units as aBigDecimal
with scale 0.int
getAmountMinorInt()
Gets the amount in minor units as anint
.long
getAmountMinorLong()
Gets the amount in minor units as along
.CurrencyUnit
getCurrencyUnit()
Gets the currency.int
getMinorPart()
Gets the minor part of the amount.int
getScale()
Gets the scale of theBigDecimal
amount.int
hashCode()
Returns a hash code for this monetary value.boolean
isEqual(BigMoneyProvider other)
Checks if this monetary value is equal to another.boolean
isGreaterThan(BigMoneyProvider other)
Checks if this monetary value is greater than another.boolean
isLessThan(BigMoneyProvider other)
Checks if this monetary value is less than another.boolean
isNegative()
Checks if the amount is less than zero.boolean
isNegativeOrZero()
Checks if the amount is zero or less.boolean
isPositive()
Checks if the amount is greater than zero.boolean
isPositiveOrZero()
Checks if the amount is zero or greater.boolean
isSameCurrency(BigMoneyProvider other)
Checks if this instance and the specified instance have the same currency.boolean
isZero()
Checks if the amount is zero.Money
minus(double amountToSubtract)
Returns a copy of this monetary value with the amount subtracted.Money
minus(double amountToSubtract, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the amount subtracted.Money
minus(java.lang.Iterable<Money> moniesToSubtract)
Returns a copy of this monetary value with a collection of monetary amounts subtracted.Money
minus(java.math.BigDecimal amountToSubtract)
Returns a copy of this monetary value with the amount subtracted.Money
minus(java.math.BigDecimal amountToSubtract, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the amount subtracted.Money
minus(Money moneyToSubtract)
Returns a copy of this monetary value with the amount subtracted.Money
minusMajor(long amountToSubtract)
Returns a copy of this monetary value with the amount in major units subtracted.Money
minusMinor(long amountToSubtract)
Returns a copy of this monetary value with the amount in minor units subtracted.Money
multipliedBy(double valueToMultiplyBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value multiplied by the specified value.Money
multipliedBy(long valueToMultiplyBy)
Returns a copy of this monetary value multiplied by the specified value.Money
multipliedBy(java.math.BigDecimal valueToMultiplyBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value multiplied by the specified value.Money
negated()
Returns a copy of this monetary value with the amount negated.static Money
of(BigMoneyProvider moneyProvider)
Obtains an instance ofMoney
from a provider.static Money
of(BigMoneyProvider moneyProvider, java.math.RoundingMode roundingMode)
Obtains an instance ofMoney
from a provider, rounding as necessary.static Money
of(CurrencyUnit currency, double amount)
Obtains an instance ofMoney
from adouble
using a well-defined conversion.static Money
of(CurrencyUnit currency, double amount, java.math.RoundingMode roundingMode)
Obtains an instance ofMoney
from adouble
using a well-defined conversion, rounding as necessary.static Money
of(CurrencyUnit currency, java.math.BigDecimal amount)
Obtains an instance ofMoney
from aBigDecimal
.static Money
of(CurrencyUnit currency, java.math.BigDecimal amount, java.math.RoundingMode roundingMode)
Obtains an instance ofMoney
from aBigDecimal
, rounding as necessary.static Money
ofMajor(CurrencyUnit currency, long amountMajor)
Obtains an instance ofMoney
from an amount in major units.static Money
ofMinor(CurrencyUnit currency, long amountMinor)
Obtains an instance ofMoney
from an amount in minor units.static Money
parse(java.lang.String moneyStr)
Parses an instance ofMoney
from a string.Money
plus(double amountToAdd)
Returns a copy of this monetary value with the amount added.Money
plus(double amountToAdd, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the amount added.Money
plus(java.lang.Iterable<Money> moniesToAdd)
Returns a copy of this monetary value with a collection of monetary amounts added.Money
plus(java.math.BigDecimal amountToAdd)
Returns a copy of this monetary value with the amount added.Money
plus(java.math.BigDecimal amountToAdd, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the amount added.Money
plus(Money moneyToAdd)
Returns a copy of this monetary value with the amount added.Money
plusMajor(long amountToAdd)
Returns a copy of this monetary value with the amount in major units added.Money
plusMinor(long amountToAdd)
Returns a copy of this monetary value with the amount in minor units added.Money
rounded(int scale, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value rounded to the specified scale without changing the current scale.BigMoney
toBigMoney()
Implements theBigMoneyProvider
interface, returning aBigMoney
instance with the same currency, amount and scale.java.lang.String
toString()
Gets the monetary value as a string.static Money
total(java.lang.Iterable<Money> monies)
Obtains an instance ofMoney
as the total value of a collection.static Money
total(CurrencyUnit currency, java.lang.Iterable<Money> monies)
Obtains an instance ofMoney
as the total value of a possibly empty collection.static Money
total(CurrencyUnit currency, Money... monies)
Obtains an instance ofMoney
as the total value of a possibly empty array.static Money
total(Money... monies)
Obtains an instance ofMoney
as the total value of an array.Money
withAmount(double amount)
Returns a copy of this monetary value with the specified amount using a well-defined conversion from adouble
.Money
withAmount(double amount, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the specified amount using a well-defined conversion from adouble
.Money
withAmount(java.math.BigDecimal amount)
Returns a copy of this monetary value with the specified amount.Money
withAmount(java.math.BigDecimal amount, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the specified amount.Money
withCurrencyUnit(CurrencyUnit currency)
Returns a copy of this monetary value with the specified currency.Money
withCurrencyUnit(CurrencyUnit currency, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the specified currency.static Money
zero(CurrencyUnit currency)
Obtains an instance ofMoney
representing zero.
-
-
-
Method Detail
-
of
public static Money of(CurrencyUnit currency, java.math.BigDecimal amount)
Obtains an instance ofMoney
from aBigDecimal
.This allows you to create an instance with a specific currency and amount. No rounding is performed on the amount, so it must have a scale compatible with the currency.
- Parameters:
currency
- the currency, not nullamount
- the amount of money, not null- Returns:
- the new instance, never null
- Throws:
java.lang.ArithmeticException
- if the scale exceeds the currency scale
-
of
public static Money of(CurrencyUnit currency, java.math.BigDecimal amount, java.math.RoundingMode roundingMode)
Obtains an instance ofMoney
from aBigDecimal
, rounding as necessary.This allows you to create an instance with a specific currency and amount. If the amount has a scale in excess of the scale of the currency then the excess fractional digits are rounded using the rounding mode.
- Parameters:
currency
- the currency, not nullamount
- the amount of money, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new instance, never null
- Throws:
java.lang.ArithmeticException
- if the rounding fails
-
of
public static Money of(CurrencyUnit currency, double amount)
Obtains an instance ofMoney
from adouble
using a well-defined conversion.This allows you to create an instance with a specific currency and amount. No rounding is performed on the amount, so it must have a scale compatible with the currency.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.- Parameters:
currency
- the currency, not nullamount
- the amount of money, not null- Returns:
- the new instance, never null
- Throws:
java.lang.ArithmeticException
- if the scale exceeds the currency scale
-
of
public static Money of(CurrencyUnit currency, double amount, java.math.RoundingMode roundingMode)
Obtains an instance ofMoney
from adouble
using a well-defined conversion, rounding as necessary.This allows you to create an instance with a specific currency and amount. If the amount has a scale in excess of the scale of the currency then the excess fractional digits are rounded using the rounding mode.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.- Parameters:
currency
- the currency, not nullamount
- the amount of money, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new instance, never null
- Throws:
java.lang.ArithmeticException
- if the rounding fails
-
ofMajor
public static Money ofMajor(CurrencyUnit currency, long amountMajor)
Obtains an instance ofMoney
from an amount in major units.This allows you to create an instance with a specific currency and amount. The amount is a whole number only. Thus you can initialise the value 'USD 20', but not the value 'USD 20.32'. For example,
ofMajor(USD, 25)
creates the instanceUSD 25.00
.- Parameters:
currency
- the currency, not nullamountMajor
- the amount of money in the major division of the currency- Returns:
- the new instance, never null
-
ofMinor
public static Money ofMinor(CurrencyUnit currency, long amountMinor)
Obtains an instance ofMoney
from an amount in minor units.This allows you to create an instance with a specific currency and amount expressed in terms of the minor unit. For example, if constructing US Dollars, the input to this method represents cents. Note that when a currency has zero decimal places, the major and minor units are the same. For example,
ofMinor(USD, 2595)
creates the instanceUSD 25.95
.- Parameters:
currency
- the currency, not nullamountMinor
- the amount of money in the minor division of the currency- Returns:
- the new instance, never null
-
zero
public static Money zero(CurrencyUnit currency)
Obtains an instance ofMoney
representing zero.For example,
zero(USD)
creates the instanceUSD 0.00
.- Parameters:
currency
- the currency, not null- Returns:
- the instance representing zero, never null
-
of
public static Money of(BigMoneyProvider moneyProvider)
Obtains an instance ofMoney
from a provider.This allows you to create an instance from any class that implements the provider, such as
BigMoney
. No rounding is performed on the amount, so it must have a scale compatible with the currency.- Parameters:
moneyProvider
- the money to convert, not null- Returns:
- the new instance, never null
- Throws:
java.lang.ArithmeticException
- if the scale exceeds the currency scale
-
of
public static Money of(BigMoneyProvider moneyProvider, java.math.RoundingMode roundingMode)
Obtains an instance ofMoney
from a provider, rounding as necessary.This allows you to create an instance from any class that implements the provider, such as
BigMoney
. The rounding mode is used to adjust the scale to the scale of the currency.- Parameters:
moneyProvider
- the money to convert, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new instance, never null
- Throws:
java.lang.ArithmeticException
- if the rounding fails
-
total
public static Money total(Money... monies)
Obtains an instance ofMoney
as the total value of an array.The array must contain at least one monetary value. Subsequent amounts are added as though using
plus(Money)
. All amounts must be in the same currency.- Parameters:
monies
- the monetary values to total, not empty, no null elements, not null- Returns:
- the total, never null
- Throws:
java.lang.IllegalArgumentException
- if the array is emptyCurrencyMismatchException
- if the currencies differ
-
total
public static Money total(java.lang.Iterable<Money> monies)
Obtains an instance ofMoney
as the total value of a collection.The iterable must provide at least one monetary value. Subsequent amounts are added as though using
plus(Money)
. All amounts must be in the same currency.- Parameters:
monies
- the monetary values to total, not empty, no null elements, not null- Returns:
- the total, never null
- Throws:
java.lang.IllegalArgumentException
- if the iterable is emptyCurrencyMismatchException
- if the currencies differ
-
total
public static Money total(CurrencyUnit currency, Money... monies)
Obtains an instance ofMoney
as the total value of a possibly empty array.The amounts are added as though using
plus(Money)
starting from zero in the specified currency. All amounts must be in the same currency.- Parameters:
currency
- the currency to total in, not nullmonies
- the monetary values to total, no null elements, not null- Returns:
- the total, never null
- Throws:
CurrencyMismatchException
- if the currencies differ
-
total
public static Money total(CurrencyUnit currency, java.lang.Iterable<Money> monies)
Obtains an instance ofMoney
as the total value of a possibly empty collection.The amounts are added as though using
plus(Money)
starting from zero in the specified currency. All amounts must be in the same currency.- Parameters:
currency
- the currency to total in, not nullmonies
- the monetary values to total, no null elements, not null- Returns:
- the total, never null
- Throws:
CurrencyMismatchException
- if the currencies differ
-
parse
public static Money parse(java.lang.String moneyStr)
Parses an instance ofMoney
from a string.The string format is '$currencyCode $amount' where there may be zero to many spaces between the two parts. The currency code must be a valid three letter currency. The amount must match the regular expression
[+-]?[0-9]*[.]?[0-9]*
. The spaces and numbers must be ASCII characters. This matches the output fromtoString()
.For example,
parse("USD 25")
creates the instanceUSD 25.00
whileparse("USD 25.95")
creates the instanceUSD 25.95
.- Parameters:
moneyStr
- the money string to parse, not null- Returns:
- the parsed instance, never null
- Throws:
java.lang.IllegalArgumentException
- if the string is malformedjava.lang.ArithmeticException
- if the amount is too large
-
getCurrencyUnit
public CurrencyUnit getCurrencyUnit()
Gets the currency.- Returns:
- the currency, never null
-
withCurrencyUnit
public Money withCurrencyUnit(CurrencyUnit currency)
Returns a copy of this monetary value with the specified currency.The returned instance will have the specified currency and the amount from this instance. If the scale differs between the currencies such that rounding would be required, then an exception is thrown.
This instance is immutable and unaffected by this method.
- Parameters:
currency
- the currency to use, not null- Returns:
- the new instance with the input currency set, never null
- Throws:
java.lang.ArithmeticException
- if the scale of the new currency is less than the scale of this currency
-
withCurrencyUnit
public Money withCurrencyUnit(CurrencyUnit currency, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the specified currency.The returned instance will have the specified currency and the amount from this instance. If the number of decimal places differs between the currencies, then the amount may be rounded.
This instance is immutable and unaffected by this method.
- Parameters:
currency
- the currency to use, not nullroundingMode
- the rounding mode to use to bring the decimal places back in line, not null- Returns:
- the new instance with the input currency set, never null
- Throws:
java.lang.ArithmeticException
- if the rounding fails
-
getScale
public int getScale()
Gets the scale of theBigDecimal
amount.The scale has the same meaning as in
BigDecimal
. Positive values represent the number of decimal places in use. For example, a scale of 2 means that the money will have two decimal places such as 'USD 43.25'.For
Money
, the scale is fixed and always matches that of the currency.- Returns:
- the scale in use, typically 2 but could be 0, 1 and 3
-
getAmount
public java.math.BigDecimal getAmount()
Gets the amount.This returns the value of the money as a
BigDecimal
. The scale will be the scale of this money.- Returns:
- the amount, never null
-
getAmountMajor
public java.math.BigDecimal getAmountMajor()
Gets the amount in major units as aBigDecimal
with scale 0.This returns the monetary amount in terms of the major units of the currency, truncating the amount if necessary. For example, 'EUR 2.35' will return 2, and 'BHD -1.345' will return -1.
This is returned as a
BigDecimal
rather than aBigInteger
. This is to allow further calculations to be performed on the result. Should you need aBigInteger
, simply callBigDecimal.toBigInteger()
.- Returns:
- the major units part of the amount, never null
-
getAmountMajorLong
public long getAmountMajorLong()
Gets the amount in major units as along
.This returns the monetary amount in terms of the major units of the currency, truncating the amount if necessary. For example, 'EUR 2.35' will return 2, and 'BHD -1.345' will return -1.
- Returns:
- the major units part of the amount
- Throws:
java.lang.ArithmeticException
- if the amount is too large for along
-
getAmountMajorInt
public int getAmountMajorInt()
Gets the amount in major units as anint
.This returns the monetary amount in terms of the major units of the currency, truncating the amount if necessary. For example, 'EUR 2.35' will return 2, and 'BHD -1.345' will return -1.
- Returns:
- the major units part of the amount
- Throws:
java.lang.ArithmeticException
- if the amount is too large for anint
-
getAmountMinor
public java.math.BigDecimal getAmountMinor()
Gets the amount in minor units as aBigDecimal
with scale 0.This returns the monetary amount in terms of the minor units of the currency, truncating the amount if necessary. For example, 'EUR 2.35' will return 235, and 'BHD -1.345' will return -1345.
This is returned as a
BigDecimal
rather than aBigInteger
. This is to allow further calculations to be performed on the result. Should you need aBigInteger
, simply callBigDecimal.toBigInteger()
.- Returns:
- the minor units part of the amount, never null
-
getAmountMinorLong
public long getAmountMinorLong()
Gets the amount in minor units as along
.This returns the monetary amount in terms of the minor units of the currency, truncating the amount if necessary. For example, 'EUR 2.35' will return 235, and 'BHD -1.345' will return -1345.
- Returns:
- the minor units part of the amount
- Throws:
java.lang.ArithmeticException
- if the amount is too large for along
-
getAmountMinorInt
public int getAmountMinorInt()
Gets the amount in minor units as anint
.This returns the monetary amount in terms of the minor units of the currency, truncating the amount if necessary. For example, 'EUR 2.35' will return 235, and 'BHD -1.345' will return -1345.
- Returns:
- the minor units part of the amount
- Throws:
java.lang.ArithmeticException
- if the amount is too large for anint
-
getMinorPart
public int getMinorPart()
Gets the minor part of the amount.This return the minor unit part of the monetary amount. This is defined as the amount in minor units excluding major units.
For example, EUR has a scale of 2, so the minor part is always between 0 and 99 for positive amounts, and 0 and -99 for negative amounts. Thus 'EUR 2.35' will return 35, and 'EUR -1.34' will return -34.
- Returns:
- the minor part of the amount, negative if the amount is negative
-
isZero
public boolean isZero()
Checks if the amount is zero.- Returns:
- true if the amount is zero
-
isPositive
public boolean isPositive()
Checks if the amount is greater than zero.- Returns:
- true if the amount is greater than zero
-
isPositiveOrZero
public boolean isPositiveOrZero()
Checks if the amount is zero or greater.- Returns:
- true if the amount is zero or greater
-
isNegative
public boolean isNegative()
Checks if the amount is less than zero.- Returns:
- true if the amount is less than zero
-
isNegativeOrZero
public boolean isNegativeOrZero()
Checks if the amount is zero or less.- Returns:
- true if the amount is zero or less
-
withAmount
public Money withAmount(java.math.BigDecimal amount)
Returns a copy of this monetary value with the specified amount.The returned instance will have this currency and the new amount. No rounding is performed on the amount to be added, so it must have a scale compatible with the currency.
This instance is immutable and unaffected by this method.
- Parameters:
amount
- the monetary amount to set in the returned instance, not null- Returns:
- the new instance with the input amount set, never null
- Throws:
java.lang.ArithmeticException
- if the scale of the amount is too large
-
withAmount
public Money withAmount(java.math.BigDecimal amount, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the specified amount.The returned instance will have this currency and the new amount. If the scale of the
BigDecimal
needs to be adjusted, then it will be rounded using the specified mode.This instance is immutable and unaffected by this method.
- Parameters:
amount
- the monetary amount to set in the returned instance, not nullroundingMode
- the rounding mode to adjust the scale, not null- Returns:
- the new instance with the input amount set, never null
-
withAmount
public Money withAmount(double amount)
Returns a copy of this monetary value with the specified amount using a well-defined conversion from adouble
.The returned instance will have this currency and the new amount. No rounding is performed on the amount to be added, so it must have a scale compatible with the currency.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.This instance is immutable and unaffected by this method.
- Parameters:
amount
- the monetary amount to set in the returned instance, not null- Returns:
- the new instance with the input amount set, never null
- Throws:
java.lang.ArithmeticException
- if the scale of the amount is too large
-
withAmount
public Money withAmount(double amount, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the specified amount using a well-defined conversion from adouble
.The returned instance will have this currency and the new amount. If the scale of the
BigDecimal
needs to be adjusted, then it will be rounded using the specified mode.The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.This instance is immutable and unaffected by this method.
- Parameters:
amount
- the monetary amount to set in the returned instance, not nullroundingMode
- the rounding mode to adjust the scale, not null- Returns:
- the new instance with the input amount set, never null
-
plus
public Money plus(java.lang.Iterable<Money> moniesToAdd)
Returns a copy of this monetary value with a collection of monetary amounts added.This adds the specified amounts to this monetary amount, returning a new object. The amounts must be in the same currency.
This instance is immutable and unaffected by this method.
- Parameters:
moniesToAdd
- the monetary values to add, no null elements, not null- Returns:
- the new instance with the input amounts added, never null
- Throws:
CurrencyMismatchException
- if the currencies differ
-
plus
public Money plus(Money moneyToAdd)
Returns a copy of this monetary value with the amount added.This adds the specified amount to this monetary amount, returning a new object. The amount added must be in the same currency.
The addition has no rounding issues and is always accurate. For example,'USD 25.95' plus 'USD 3.02' will 'USD 28.97'.
This instance is immutable and unaffected by this method.
- Parameters:
moneyToAdd
- the monetary value to add, not null- Returns:
- the new instance with the input amount added, never null
- Throws:
CurrencyMismatchException
- if the currencies differ
-
plus
public Money plus(java.math.BigDecimal amountToAdd)
Returns a copy of this monetary value with the amount added.This adds the specified amount to this monetary amount, returning a new object. No rounding is performed on the amount to be added, so it must have a scale compatible with the currency.
This instance is immutable and unaffected by this method.
- Parameters:
amountToAdd
- the monetary value to add, not null- Returns:
- the new instance with the input amount added, never null
- Throws:
java.lang.ArithmeticException
- if the scale of the amount is too large
-
plus
public Money plus(java.math.BigDecimal amountToAdd, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the amount added.This adds the specified amount to this monetary amount, returning a new object. If the amount to add exceeds the scale of the currency, then the rounding mode will be used to adjust the result.
This instance is immutable and unaffected by this method.
- Parameters:
amountToAdd
- the monetary value to add, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new instance with the input amount added, never null
-
plus
public Money plus(double amountToAdd)
Returns a copy of this monetary value with the amount added.This adds the specified amount to this monetary amount, returning a new object. No rounding is performed on the amount to be added, so it must have a scale compatible with the currency.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.This instance is immutable and unaffected by this method.
- Parameters:
amountToAdd
- the monetary value to add, not null- Returns:
- the new instance with the input amount added, never null
- Throws:
java.lang.ArithmeticException
- if the scale of the amount is too large
-
plus
public Money plus(double amountToAdd, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the amount added.This adds the specified amount to this monetary amount, returning a new object. If the amount to add exceeds the scale of the currency, then the rounding mode will be used to adjust the result.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.This instance is immutable and unaffected by this method.
- Parameters:
amountToAdd
- the monetary value to add, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new instance with the input amount added, never null
-
plusMajor
public Money plusMajor(long amountToAdd)
Returns a copy of this monetary value with the amount in major units added.This adds an amount in major units, leaving the minor units untouched. For example, USD 23.45 plus 138 gives USD 161.45.
This instance is immutable and unaffected by this method.
- Parameters:
amountToAdd
- the monetary value to add, not null- Returns:
- the new instance with the input amount added, never null
-
plusMinor
public Money plusMinor(long amountToAdd)
Returns a copy of this monetary value with the amount in minor units added.This adds an amount in minor units. For example, USD 23.45 plus 138 gives USD 24.83.
This instance is immutable and unaffected by this method.
- Parameters:
amountToAdd
- the monetary value to add, not null- Returns:
- the new instance with the input amount added, never null
-
minus
public Money minus(java.lang.Iterable<Money> moniesToSubtract)
Returns a copy of this monetary value with a collection of monetary amounts subtracted.This subtracts the specified amounts from this monetary amount, returning a new object. The amounts must be in the same currency.
This instance is immutable and unaffected by this method.
- Parameters:
moniesToSubtract
- the monetary values to subtract, no null elements, not null- Returns:
- the new instance with the input amounts subtracted, never null
- Throws:
CurrencyMismatchException
- if the currencies differ
-
minus
public Money minus(Money moneyToSubtract)
Returns a copy of this monetary value with the amount subtracted.This subtracts the specified amount from this monetary amount, returning a new object. The amount subtracted must be in the same currency.
The subtraction has no rounding issues and is always accurate. For example,'USD 25.95' minus 'USD 3.02' will 'USD 22.93'.
This instance is immutable and unaffected by this method.
- Parameters:
moneyToSubtract
- the monetary value to subtract, not null- Returns:
- the new instance with the input amount subtracted, never null
- Throws:
CurrencyMismatchException
- if the currencies differ
-
minus
public Money minus(java.math.BigDecimal amountToSubtract)
Returns a copy of this monetary value with the amount subtracted.This subtracts the specified amount from this monetary amount, returning a new object. No rounding is performed on the amount to be subtracted, so it must have a scale compatible with the currency.
This instance is immutable and unaffected by this method.
- Parameters:
amountToSubtract
- the monetary value to subtract, not null- Returns:
- the new instance with the input amount subtracted, never null
- Throws:
java.lang.ArithmeticException
- if the scale of the amount is too large
-
minus
public Money minus(java.math.BigDecimal amountToSubtract, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the amount subtracted.This subtracts the specified amount from this monetary amount, returning a new object. If the amount to subtract exceeds the scale of the currency, then the rounding mode will be used to adjust the result.
This instance is immutable and unaffected by this method.
- Parameters:
amountToSubtract
- the monetary value to subtract, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new instance with the input amount subtracted, never null
-
minus
public Money minus(double amountToSubtract)
Returns a copy of this monetary value with the amount subtracted.This subtracts the specified amount from this monetary amount, returning a new object. No rounding is performed on the amount to be subtracted, so it must have a scale compatible with the currency.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.This instance is immutable and unaffected by this method.
- Parameters:
amountToSubtract
- the monetary value to subtract, not null- Returns:
- the new instance with the input amount subtracted, never null
- Throws:
java.lang.ArithmeticException
- if the scale of the amount is too large
-
minus
public Money minus(double amountToSubtract, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value with the amount subtracted.This subtracts the specified amount from this monetary amount, returning a new object. If the amount to subtract exceeds the scale of the currency, then the rounding mode will be used to adjust the result.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.This instance is immutable and unaffected by this method.
- Parameters:
amountToSubtract
- the monetary value to subtract, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new instance with the input amount subtracted, never null
-
minusMajor
public Money minusMajor(long amountToSubtract)
Returns a copy of this monetary value with the amount in major units subtracted.This subtracts an amount in major units, leaving the minor units untouched. For example, USD 23.45 minus 138 gives USD -114.55.
This instance is immutable and unaffected by this method.
- Parameters:
amountToSubtract
- the monetary value to subtract, not null- Returns:
- the new instance with the input amount subtracted, never null
-
minusMinor
public Money minusMinor(long amountToSubtract)
Returns a copy of this monetary value with the amount in minor units subtracted.This subtracts an amount in minor units. For example, USD 23.45 minus 138 gives USD 22.07.
This instance is immutable and unaffected by this method.
- Parameters:
amountToSubtract
- the monetary value to subtract, not null- Returns:
- the new instance with the input amount subtracted, never null
-
multipliedBy
public Money multipliedBy(java.math.BigDecimal valueToMultiplyBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value multiplied by the specified value.This takes this amount and multiplies it by the specified value, rounding the result is rounded as specified.
This instance is immutable and unaffected by this method.
- Parameters:
valueToMultiplyBy
- the scalar value to multiply by, not nullroundingMode
- the rounding mode to use to bring the decimal places back in line, not null- Returns:
- the new multiplied instance, never null
- Throws:
java.lang.ArithmeticException
- if the rounding fails
-
multipliedBy
public Money multipliedBy(double valueToMultiplyBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value multiplied by the specified value.This takes this amount and multiplies it by the specified value, rounding the result is rounded as specified.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.This instance is immutable and unaffected by this method.
- Parameters:
valueToMultiplyBy
- the scalar value to multiply by, not nullroundingMode
- the rounding mode to use to bring the decimal places back in line, not null- Returns:
- the new multiplied instance, never null
- Throws:
java.lang.ArithmeticException
- if the rounding fails
-
multipliedBy
public Money multipliedBy(long valueToMultiplyBy)
Returns a copy of this monetary value multiplied by the specified value.This takes this amount and multiplies it by the specified value.
This instance is immutable and unaffected by this method.
- Parameters:
valueToMultiplyBy
- the scalar value to multiply by, not null- Returns:
- the new multiplied instance, never null
-
dividedBy
public Money dividedBy(java.math.BigDecimal valueToDivideBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value divided by the specified value.This takes this amount and divides it by the specified value, rounding the result is rounded as specified.
This instance is immutable and unaffected by this method.
- Parameters:
valueToDivideBy
- the scalar value to divide by, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new divided instance, never null
- Throws:
java.lang.ArithmeticException
- if dividing by zerojava.lang.ArithmeticException
- if the rounding fails
-
dividedBy
public Money dividedBy(double valueToDivideBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value divided by the specified value.This takes this amount and divides it by the specified value, rounding the result is rounded as specified.
The amount is converted via
BigDecimal.valueOf(double)
which yields the most expected answer for most programming scenarios. Anydouble
literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'.This instance is immutable and unaffected by this method.
- Parameters:
valueToDivideBy
- the scalar value to divide by, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new divided instance, never null
- Throws:
java.lang.ArithmeticException
- if dividing by zerojava.lang.ArithmeticException
- if the rounding fails
-
dividedBy
public Money dividedBy(long valueToDivideBy, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value divided by the specified value.This takes this amount and divides it by the specified value, rounding the result is rounded as specified.
This instance is immutable and unaffected by this method.
- Parameters:
valueToDivideBy
- the scalar value to divide by, not nullroundingMode
- the rounding mode to use, not null- Returns:
- the new divided instance, never null
- Throws:
java.lang.ArithmeticException
- if dividing by zerojava.lang.ArithmeticException
- if the rounding fails
-
negated
public Money negated()
Returns a copy of this monetary value with the amount negated.This instance is immutable and unaffected by this method.
- Returns:
- the new instance with the amount negated, never null
-
abs
public Money abs()
Returns a copy of this monetary value with a positive amount.This instance is immutable and unaffected by this method.
- Returns:
- the new instance with the amount converted to be positive, never null
-
rounded
public Money rounded(int scale, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value rounded to the specified scale without changing the current scale.Scale has the same meaning as in
BigDecimal
. A scale of 2 means round to 2 decimal places.- Rounding 'EUR 45.23' to a scale of -1 returns 40.00 or 50.00 depending on the rounding mode.
- Rounding 'EUR 45.23' to a scale of 0 returns 45.00 or 46.00 depending on the rounding mode.
- Rounding 'EUR 45.23' to a scale of 1 returns 45.20 or 45.30 depending on the rounding mode.
- Rounding 'EUR 45.23' to a scale of 2 has no effect (it already has that scale).
- Rounding 'EUR 45.23' to a scale of 3 has no effect (the scale is not increased).
This instance is immutable and unaffected by this method.
- Parameters:
scale
- the new scaleroundingMode
- the rounding mode to use, not null- Returns:
- the new instance with the amount converted to be positive, never null
- Throws:
java.lang.ArithmeticException
- if the rounding fails
-
convertedTo
public Money convertedTo(CurrencyUnit currency, java.math.BigDecimal conversionMultipler, java.math.RoundingMode roundingMode)
Returns a copy of this monetary value converted into another currency using the specified conversion rate, with a rounding mode used to adjust the decimal places in the result.This instance is immutable and unaffected by this method.
- Parameters:
currency
- the new currency, not nullconversionMultipler
- the conversion factor between the currencies, not nullroundingMode
- the rounding mode to use to bring the decimal places back in line, not null- Returns:
- the new multiplied instance, never null
- Throws:
java.lang.IllegalArgumentException
- if the currency is the same as this currencyjava.lang.IllegalArgumentException
- if the conversion multiplier is negativejava.lang.ArithmeticException
- if the rounding fails
-
toBigMoney
public BigMoney toBigMoney()
Implements theBigMoneyProvider
interface, returning aBigMoney
instance with the same currency, amount and scale.- Specified by:
toBigMoney
in interfaceBigMoneyProvider
- Returns:
- the money instance, never null
-
isSameCurrency
public boolean isSameCurrency(BigMoneyProvider other)
Checks if this instance and the specified instance have the same currency.- Parameters:
other
- the money to check, not null- Returns:
- true if they have the same currency
-
compareTo
public int compareTo(BigMoneyProvider other)
Compares this monetary value to another.This allows
Money
to be compared to anyBigMoneyProvider
. Scale is ignored in the comparison. The compared values must be in the same currency.- Specified by:
compareTo
in interfacejava.lang.Comparable<BigMoneyProvider>
- Parameters:
other
- the other monetary value, not null- Returns:
- -1 if this is less than , 0 if equal, 1 if greater than
- Throws:
CurrencyMismatchException
- if the currencies differ
-
isEqual
public boolean isEqual(BigMoneyProvider other)
Checks if this monetary value is equal to another.This allows
Money
to be compared to anyBigMoneyProvider
. Scale is ignored, so 'USD 30.00' and 'USD 30' are equal. The compared values must be in the same currency.- Parameters:
other
- the other monetary value, not null- Returns:
- true is this is greater than the specified monetary value
- Throws:
CurrencyMismatchException
- if the currencies differ- See Also:
equals(Object)
-
isGreaterThan
public boolean isGreaterThan(BigMoneyProvider other)
Checks if this monetary value is greater than another.This allows
Money
to be compared to anyBigMoneyProvider
. Scale is ignored in the comparison. The compared values must be in the same currency.- Parameters:
other
- the other monetary value, not null- Returns:
- true is this is greater than the specified monetary value
- Throws:
CurrencyMismatchException
- if the currencies differ
-
isLessThan
public boolean isLessThan(BigMoneyProvider other)
Checks if this monetary value is less than another.This allows
Money
to be compared to anyBigMoneyProvider
. Scale is ignored in the comparison. The compared values must be in the same currency.- Parameters:
other
- the other monetary value, not null- Returns:
- true is this is less than the specified monetary value
- Throws:
CurrencyMismatchException
- if the currencies differ
-
equals
public boolean equals(java.lang.Object other)
Checks if this monetary value equals another.The comparison takes into account the scale. The compared values must be in the same currency.
- Overrides:
equals
in classjava.lang.Object
- Parameters:
other
- the other object to compare to, not null- Returns:
- true if this instance equals the other instance
-
hashCode
public int hashCode()
Returns a hash code for this monetary value.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a suitable hash code
-
toString
public java.lang.String toString()
Gets the monetary value as a string.The format is the 3 letter ISO currency code, followed by a space, followed by the amount as per
BigDecimal.toPlainString()
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation of this monetary value, never null
-
-


Try to put divs inside a text :
Here you can seem some div elements in a text. Here is one :
Orange
and another one :
Blue
and a last one :
Green


Home
Places
Search
Forum
Account
Edit account
Connect with Facebook
Connect with Google
Log out
Welcome!
It seems you are new. What you want to do?
Add place »
Search place »


Welcome to the official UIP web portal.
Here you will find all that the UIP has to publicly offer. Information requests can be made if you would like source information, evidence, etc.
Please keep in mind that information and materials that can be considered a threat to an individual, their security, or the security of the city/county/state/nation will not be released unless requested by a government employee.
If you would like to request all information that involves you, make a standard request and attach a photo of your picture ID, your face, and any other identity verification methods requested. We do not release personal information discovered during investigations without proof of identity.
If you would like to request the removal of a published paper, make a request as normal through the general public requests page, then add a note stating you would like the paper removed permanently. You may need to confirm your identity to complete this process.
While we carefully review all materials before publishing, things can slip through the cracks. If you notice a piece of sensitive information in a paper, contact us immediately and we will rectify the issue.
If you would like to make a request for investigation, go through the general public requests page, then select "new investigation." If the request is legal and viable, it will be added to the queue. Remember to check the division your request will be investigated in.


Navigation : about dev docs examples navigation Welcome to pico-go the game and demoscene development tool for Go developers. Powered by hugo about


2011 - McCafferty was formed & Nick Harktop realeased Mom+Dads EP
2012 - Harktop released Japan and DanceBeats To Hurt Girls
2013 - I Hate This Body, It's a Bad Idea, Forest Life and This Will Mean Nothing were released. Band signed with Monkey Boy Records + released Beachboy later in the year.
2015 - Released two more EPs: When The Lightning Hit and Happy Birthday, Dad
2016 - Harktop decided to end McCafferty, but later came back after some successful crowdfunding to support another EP.
2017 - McCafferty signed with Take This To Heart Records + released Thanks. Sorry. Sure.
2018 - Released a split EP with Heart Attack Man + signed to Triple Crown Records.
* Next album Yarn set to be released at the end of March 2018.
"I started as a very basic level musician and then slowly progressed into the artist I am today. The new album is going to be very very very cool."


While learning, students are often told which functions to write, including the function names, parameters and return types.
The next set of videos focus on an exercise where you get to decide yourself which functions to write. The example also gives you more practice with dictionaries, lists, and files.
The problem we'll be tackling is a restaurant recommendation system.
We are given a list of restaurants that contains:
The program will make a recommendation to the user based on this data.
We'll tell you a bit about the main function, but this task is complex and helper functions will make writing the main function much easier.
Write a function that has three parameters:
The function returns a list of restaurants (in that price range, serving at least one of those cuisines), and their ratings sorted from highest to lowest.
Next Video: Explore how to keep track of data in Python
Following Video: How to break the problem into a series of sub-problems


Learn More About Me
I'm currently a structural engineer in training, but I like to dabble in code in my free time. This website was made from scratch by me.
Skills
I have both engineering and coding skills.
- Coding Skills:
- JavaScript
- HTML
- CSS
- Engineering Skills:
- Wood design
- Steel design
- Concrete design
Contact me
Find me on GitHub! @Eliz964


04/04/14 - Ruby Enumerable#map
First, a short definition of Ruby Enumerable#map according to ruby-doc.org:
- Enumerable#map returns a new array with the results of running block once for every element in enum. If no block is given, an enumerator is returned instead.
- You can also use the method's destructive version map! which changes the original collection. It modifies the original collection by running the block for each of its elements. It returns not a copy but the modified original source.
Example:
map { |obj| block }
(1..4).map { |i| i*i } #=> [1, 4, 9, 16]
map and collect are interchangeable
(1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
map => an_enumerator
{name: "Sebastian", age: 4}.map #=> Enumerator
(1..4).map #=> Enumerator
["adam","eve","snake"].map #=> Enumerator
Module Enumerable
Lets look at the the module Enumerable and the method .map a little bit closer.
In addition to classes, Ruby has modules which are containers for methods and constants. If you want to write code once and share it between different unrelated classes, you can put it in modules to be mixed in with your classes. In order for a class to use Enumerable, it must define an .each method, like the classes Array or Hash.
- In general, we can say that Enumerable provides several functions for filtering your collections.
Example:
(1..4).map { |i| i*i } #=> [1, 4, 9, 16]
[1,2,3,4].select {|i| i < 3 } #=> [1, 2]
%w{apple pear fig}.sort_by { |word| word.length} #=> ["fig", "pear", "apple"]
Enumerable#map
The method .map takes an enumerable object and a block, and runs the block for each element, outputting each returned value from the block in a new array. Being a part of the Enumerable module, you can use the method .map on various classes.
- When mapping a hash with or without a block, the method returns an instance of Enumerator. As mentioned above, this is also true when you call the method .map without a block.
Enumerator is a class which allows both internal and external iteration. You can find more information at ruby-doc.org.
Example:
#using "strings" as keys and integer as values
{"Sebastian" => 35, "Milo" => 4, "Anton" => 1}.map #=> Enumerator
#using a symbol as key instead of a "string" to omit the "hash rocket", i.e. => within the hash
{name: "Sebastian", age: 4}.map #=> Enumerator
#calling .map on a range #=> Enumerator
(2..4).map - When mapping an array, you apply a function to each of the array's elements, and return a new array with the results. The new array is a copy of the original array whose elements are modified according to the function defined in the code block.
Example:
[5,6,4].map { |i| i + 1 } #=> [6, 7, 5]
Conclusion
Use Enumerable#map when you're working with instances of the class Array. You can also convert an instance of Hash into an nested array of [key, value] arrays.
In order to iterate through your collection, you can either call the method .each or the method .map. How do you know which one to use when?
- Use the method .each if you don't want a return value from the operations
- Use the method .map if you're looking for a return value and you want the return value to be a transformed version of each element
Example:
persons = ["adam","eve","snake"]
x = persons.each do |name|
name + "!"
end
#=> no return value for x
persons = ["adam","eve","snake"]
x = persons.map do |name|
name + "!"
end
#=> return value for x = ["adam!""eve!","snake!"]


This page uses nifty spite sheet-animations to show what will happen if you read too much history: it will come alive!


--- layout: post status: publish published: true title: Ivy Envy featured as miCubs.com's Blog of the Week author: display_name: Corey Fineran login: Corey email<EMAIL_ADDRESS>url: '' author_login: Corey author_email<EMAIL_ADDRESS>wordpress_id: 5533 wordpress_url: http://ivyenvy.com/?p=5533 date: '2011-06-30 09:40:48 +0000' date_gmt: '2011-06-30 14:40:48 +0000' categories: - Ivy Envy - Cubs Blogs tags: - Brian Bedo - Jordan Bernfield - miCubs.com comments: [] ---
This week, Ivy Envy was featured as miCubs.com's Blog of the Week. Brian did an audio interview with me and posted it, along with a write-up about our site. Go check out the article/interview here, and add their site to your list of Cubs sites to frequent.


I'm a frontend developer, so i write html, css, javascript, etc.
These are the technologies i use as a frontend developer
Contact me mail or telephone, or read more about me on LinkedIn or review some of my code on GitHub


Me building you
a reached purposes website
No only make your website I Kiss U, but also make it convertable.
Web and App Development Services
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
Our Works
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
What Our Clients Said
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
Get Intouch
Thanks for getting intouch with us! You can use any of the following contact to reach out team
Contact Address
- House #384, National High Way #6, Preah Ponlia,
- Sereisophon, Banteay Meanchey, Cambodia
- 01254
- +855-12-000-000
- basicblogtalk@gmail.com


Replaces all the variables in a graph with constants of the same values. (deprecated)
tf.compat.v1.graph_util.convert_variables_to_constants( sess, input_graph_def, output_node_names, variable_names_whitelist=None, variable_names_blacklist=None )
Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.convert_variables_to_constants
If you have a trained graph containing Variable ops, it can be convenient to convert them all to Const ops holding the same values. This makes it possible to describe the network fully with a single GraphDef file, and allows the removal of a lot of ops related to loading and saving the variables.
sess
: Active TensorFlow session containing the variables.input_graph_def
: GraphDef object holding the network.output_node_names
: List of name strings for the result nodes of the graph.variable_names_whitelist
: The set of variable names to convert (by default,
all variables are converted).variable_names_blacklist
: The set of variable names to omit converting
to constants.GraphDef containing a simplified version of the original.


Udbhav Gambhir
Studying CSE at Jaypee Institute of Information technology
Noida, Delhi-NCR (201309)
School Education
Class 10
th
successfully completed from Nosegay Public School, Rajasthan with a CGPA of 10.0.
Class 12
th
successfully completed from Lav Kush Model School, Rajasthan with a percentage of 84.8%.
Programming known
Web areas
Database Systems used.
Contact me using Social Networks!
Got so many ways to do it!
Your Name
Please enter your Name
Input Name
Your E-Mail
E-Mail won't be published
Input E-Mail
Submit


Sixteen people found in sealed trailer on ferry bound for Ireland
Sixteen people have been found in a sealed trailer on a ferry sailing from France to the Republic of Ireland.
Police said the driver and owners of an articulated lorry were helping them with their inquiries.
In a statement, Ian Hampton, Stena Line's chief people & communications officer, said the 16 people are reported to be in good health.
"During the Stena Horizon's 9pm sailing from Cherbourg, France, to Rosslare in the Republic of Ireland on Wednesday November 20, one of our employees during a routine inspection discovered 16 people in a sealed trailer on the vehicle deck," he said.
"All the individuals are reported to be in good health and have been moved to a private passenger lounge on the ship where their wellbeing is the focus of our employees.
"Stena Line has alerted security and immigration officials in Rosslare so as the necessary arrangements can be made for the group on the vessel's arrival in Rosslare.
"The vessel is scheduled to arrive at approximately 3.30pm today."
Opposition party Fianna Fail's spokesman on justice, Jim O'Callaghan, has expressed his shock and demanded a full investigation into the incident.
"A full investigation must be launched into the discovery of up to 16 people being transported in the back of a lorry to Ireland," he said.
"Human trafficking is a modern form of slavery and needs to be tackled with fully resourced policing.
"Recent events show unfortunately Ireland is playing a significant part in this crime.
"These traffickers have to be thoroughly policed so vulnerable people are protected."
A Garda (police service of Republic of Ireland) statement said: "An Garda Siochana are now investigating all the circumstances of this incident.
"The articulated truck involved in this incident has been detained.
"The driver and the owners of the articulated vehicle are assisting An Garda Siochana with our inquiries."


10.6.a events dispatched by toggle element
If you are in the "in" case and you activate the Show Out Case trigger
you must see an xforms-deselect(in) message followed by an
xforms-select(out) message.
If you are in the "out" case and you activate the Show In Case trigger
you must see an xforms-deselect(out) message followed by an
xforms-select(in) message.
You are now in the "in" case
Show Out Case
xforms-select(in)
xforms-deselect(in)
You are now in the "out" case
Show In Case
xforms-select(out)
xforms-deselect(out)


{% extends "layout.html" %} {% block page_title %} Where you live {% endblock %} {% block content %} {% include "../includes/phase_banner_beta.html" %} Back Where do you live?


The Killers announce new album ‘Imploding the Mirage’
by Andrew SacherBrace yourselves, The Killers will have a new album out in spring 2020. It’s called Imploding the Mirage, and it’s the followup to 2017’s Wonderful Wonderful. No music is out from it yet, but the band says “future musical teasing imminent.”
They also announced a UK/Ireland tour, with support varying by date and coming from Blossoms, Sam Fender, and Manic Street Preachers. All dates are listed below.
The Killers — 2020 Tour Dates
05-28 Falkirk, Scotland – The Falkirk Stadium ^
05-30 Manchester, England – Emirates Old Trafford ^
06-01 Norwich, England – Carrow Road Stadium ^
06-03 Southampton, England – St Mary’s Stadium ^
06-06 London, England – Emirates Stadium @
06-09 Bristol, England – Ashton Gate Stadium %
06-11 Coventry, England – Ricoh Stadium %
06-13 Middlesbrough, England – Riverside Stadium %
06-16 Dublin, Ireland – Malahide Castle @
^ with Blossoms
@ with Sam Fender
% with Manic Street Preachers


name: inverse layout: true class: center, middle, inverse --- #Introduction to Webscraping Michael Weaver Yale University October 9, 2015 --- ##What is it? -- ###Automate navigation of web -- ###Structured data -- ###Large web-based databases -- ###Save time --- ##What is it good for? -- ###Accessing databases -- ###Collecting original data -- ###Using web services --- layout: false .left-column[ ##Uses ###Databases ] .right-column[ ###Access databases Service records of US Civil War soldiers Searching historical newspaper archives Data on dams in India ] --- .left-column[ ##Uses ###Databases ###Collect ] .right-column[ ###Collect new data Social media activity Connections between blogs Government reports ] --- .left-column[ ##Uses ###Databases ###Collect ###Services ] .right-column[ ###Use web services Geocoding Gender of names Translation ] --- template:inverse ##How do you do it? --- .left-column[ ##How ###Languages ] .right-column[ ###Programming Languages Perl Python R etc. ] --- .left-column[ ##How ###Languages ###Packages ] .right-column[ ###Packages/modules Make life easier Easy to start R: ```httr```, ```rvest``` Python: ```requests```, ```BeautifulSoup```, ```selenium``` ] --- template:inverse ##Flavors --- .left-column[ ##Varieties ###APIs ] .right-column[ ###APIs "Application Programming Interface" * Request data from database based on parameters Characteristics * Request specific data * Data returned in highly structured format * JSON, XML * Just the data, no markup * Hourly/daily limits Uses: * Databases: * Twitter, Facebook, Instagram * FCC Broadband * Services: * Google Maps * Genderizer ] --- .left-column[ ##Varieties ###APIs ###Scraping ] .right-column[ ###Scraping HTML Data is arrayed visually on a page Parse HTML to get the data (usually tables) ####GET Query is embedded within the HTML: ``` http://chroniclingamerica.loc.gov/search/pages/results/ ?proxtext=test ``` Or data is paginated: ``` http://chroniclingamerica.loc.gov/search/titles/results/ ?&page=2&sort=relevance ``` ####POST Fill/submit 'forms' ] --- .left-column[ ##Varieties ###APIs ###Scraping ###Other ] .right-column[ ###Downloading Automate file downloads Public datasets broken in many parts ] --- template:inverse ##Examples --- .left-column[ ##APIs ###Basics ] .right-column[ Easiest to use Usually a guide Usually need a key Procedure: 1. Construct the API 'call' * URL with various parameters 2. Submit the request 3. Parse returned data * JSON, XML ] --- .left-column[ ##APIs ###Basics ###The call ] .right-column[ ###Example: Google Maps Geocoding API https://developers.google.com/maps/documentation/geocoding/intro 1. ```https://maps.googleapis.com/maps/api/geocode/``` 2. ```json?``` 3. ```address=219+Prospect+St,+New+Haven,+CT+06511``` 4. ```key=AIzaSyBRwkNgdC_su7y7aBwcdncgc54w8R2Xp68``` All together: ``` https://maps.googleapis.com/maps/api/geocode/ json?address=219+Prospect+St,+New+Haven,+CT+06511 &key=AIzaSyBRwkNgdC_su7y7aBwcdncgc54w8R2Xp68 ``` Tips: 1. look at API guide to see options 2. Encode text for URL: "%20" ] --- .left-column[ ##APIs ###Basics ###The request ] .right-column[ ###Submitting the request ```python import requests import json stub = "https://maps.googleapis.com/maps/api/geocode/json?" address = "address=219+Prospect+St,+New+Haven,+CT+06511" key = "key=AIzaSyBRwkNgdC_su7y7aBwcdncgc54w8R2Xp68" url = "&".join((stub,address,key)) response = requests.get(url) print response.text ``` ] --- .left-column[ ##APIs ###Basics ###The request ###The response ] .right-column[ ###JSON Hierarchical data format * Lists, key:value pairs * Dictionaries in Python * Lists in R [google maps json](https://maps.googleapis.com/maps/api/geocode/json?address=219+Prospect+St,+New+Haven,+CT+06511&key=AIzaSyBRwkNgdC_su7y7aBwcdncgc54w8R2Xp68) Explore: http://jsonviewer.stack.hu/ Tools to parse: * Python: ```json``` * R: ```jsonlite``` ```python parsed = json.loads(response.text) parsed['results'] parsed['results'][0] parsed['results'][0]['geometry']['location'] ``` ] --- .left-column[ ##HTML ###Basics ] .right-column[ Without API, data is formatted for visual display Steps are similar: 1. Create URL / form 2. Submit request / post form 3. Parse data ] --- .left-column[ ##HTML ###Basics ###GET ] .right-column[ ###GET Type of request 1. Fixed content (you are scraping data over specific pages) 2. Search/query database: like API, query embedded in URL * May be no guide to the query [example](http://chroniclingamerica.loc.gov/search/titles/results/?&page=2) ```python import requests from bs4 import BeautifulSoup url = "http://chroniclingamerica.loc.gov/search/titles/results/?&page=2" out = requests.get(url) soup = BeautifulSoup(out.text) soup.find('ul', class_='results_list').find_all('li')[0] ``` ] --- .left-column[ ##HTML ###Basics ###GET ###POST ] .right-column[ ###POST Type of request HTML page includes a 'form' * You must find the form and complete the values * May be easy or complicated * Inspect the request in your browser [example](https://www.newspapers.com/signon.php) ```python import requests import lxml.html signin_url = "https://www.newspapers.com/signon.php" session = requests.session() #Log in signin = session.get(signin_url) doc = lxml.html.fromstring(signin.text) signin_form = doc.forms[0] signin_form.form_values() ``` ] --- .left-column[ ##HTML ###Basics ###GET ###POST ###Parse ] .right-column[ ###Parsing HTML Options: * xpath: in most languages * css selector: R, Python * beautifulsoup: python How to find tags, class, id, attributes, etc.? * Chrome: right click => inspect element * Safari: right click => inspect element * Must enable "Show Developer Menu" in preferences * Firefox: right click => inspect element Help: * http://flukeout.github.io/ * http://www.crummy.com/software/BeautifulSoup/bs4/doc/ * Regular expressions: http://www.regexr.com/ ] --- template:inverse ##Be nice -- ###Limit your requests -- ###May need permission --- template:inverse ##Troubleshooting --- .left-column[ ##Trouble ###Cookies ] .right-column[ ###Cookies and sessions Logging in, cookies may be required to access pages Packages like ```httr``` in R and ```requests``` in Python help to handle this. ] --- .left-column[ ##Trouble ###Cookies ###Headers ] .right-column[ ###Headers Page may not load if request headers are wrong Use browser to look at headers of successful requests (inspect element) [example](http://chroniclingamerica.loc.gov/) ] --- .left-column[ ##Trouble ###Cookies ###Headers ###Dynamic ] .right-column[ ###Dynamic pages Some pages load data dynamically: can't access the data from the HTML Explore how the page loads [example](http://www.newspapers.com) ] --- .left-column[ ##Trouble ###Cookies ###Headers ###Dynamic ] .right-column[ ###Dynamic pages Some pages load data dynamically: can't access the data from the HTML Explore how the page loads [example](http://www.newspapers.com) APIs under the hood * No documentation: reverse engineer ] --- .left-column[ ##Trouble ###Cookies ###Headers ###Dynamic ###Errors ] .right-column[ ###Error handling Usually scraping many pages What happens when pages fail to load? * Connection times out * Read times out * Other errors ```python while True: try: get_latlong = requests.get(dam_latlong_call, timeout=(2,10)) break except requests.exceptions.ConnectionError: print "trying again..." sleep(5) except requests.exceptions.ReadTimeout: print "trying again..." sleep(5) ``` ] --- template:inverse ##Questions???? --- Resources: [Guide to scraping in R](http://gastonsanchez.com/work/webdata/getting_web_data_r1_introduction.pdf) http://docs.python-requests.org/en/latest/ StackExchange, StackOverflow


Dan Osborne takes son Teddy to Arsenal as he makes Jacqueline Jossa trial plea
The fed-up former EastEnders star will take on the Crevice of Cruelty with Ian Wright on Sunday but unhappy Dan has had enough of seeing his brave wife suffer
by Sam Elliott, https://www.mirror.co.uk/authors/sam-elliott/It was probably a good way to distract them both from what's going on over on the other side of the world.
Dan Osborne took son Teddy, five, to see Arsenal - and it was a great chance to get their mind off the Jugle.
His wife Jacqueline Jossa is doing well in Australia but the relentless Bushtucker trials are adding strain.
Not that the Gunners-mad reality star was given too much to smile about at the football.
Arsenal were booed off against lowly Southampton after scraping a 2-2 Premier League draw six minutes into injury time.
Dan later appealed for the British public to stop voting for Jacqueline, who he shares daughters Ella, four, and Mia 17 months, with.
The ex-EastEnder will take on the Crevice of Cruelty with Ian Wright but ticked off Dan has had enough of seeing her suffer.
He said on Instagram : “I know I said to you all to vote for Jac because she isn’t in there to change lightbulbs, I didn’t mean every singe trial.
"Give her a break now, come on.
"She’s worried about it but she keeps smashing them all. She’ll keep proving everyone wrong.
"She’s doing it with Ian Wright too, which is good. He’ll look after her.
"Let her do this one and then just give her a break please because she’s getting upset now and it ain’t nice. But she’ll be good, she’ll smash it.
"She’ll get all the stars and head back to camp with meals.”
Meanwhile, Andrew Maxwell broke down in tears and threatened to walk out on Saturday's I'm A Celebrity.
The comedian confessed he had "hit a wall" as he became "overwhelmed" with jungle life.
Andrew said: "I honestly thought that I was gonna walk out, but I haven’t, when you’re tired, you just say ‘have I done the right thing’."


At least two dozen workers walked off the job on August 29, demanding the company negotiate their first contract with Teamsters Local 25.
After 84 days, they decided they no longer wanted to work for Republic even if they were able to reach an agreement on a contract.
Local 25 has vowed to find the workers jobs in Teamsters-covered industries.
"Local 25 will continue to work with locals to build a long-term, national strategic network to fight the white-collar criminals who run Republic," Teamsters Local 25 President Sean O'Brien said in a statement. "I want to thank the members of Teamsters Local 25, Joint Council 10 and all of the Teamsters and union supporters everywhere for standing with these brave workers. This is just one battle in a long war that we will win."
Republic has out-of-state replacement workers taking care of contracted trash services in Marshfield, Abington and Rockland.
Boston 25 News has reached out to Republic for comment.


@* * Copyright 2019 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import include._ @import include.status._ @import models.status._ @import config.ApplicationConfig @import org.joda.time.LocalDateTime @import utils.DateHelper @(regNo: String, businessName: Option[String], feeResponse: Option[FeeResponse], fromDuplicateSubmission: Boolean = false)(implicit request: Request[_],m:Messages) @main2(title = Messages("status.submissionreadyforreview.heading") + " - Your registration", showURRBanner = true) {
This section is: @Messages("summary.status")
@Messages("status.business")
@bn
} @feeResponse.map { fees =>@Messages("status.status")
@Messages("status.submittedForReview.submitteddate.text", DateHelper.formatDate(fees.createdAt.toLocalDate))
}


About Bluetooth
Introduction
Bluetooth is a wireless communications technology which allows devices to communicate with each other without the need for a central device like a router or access point.
Bluetooth has a special “low energy feature” which means it can be used without requiring much power from the devices using it. It’s the Bluetooth low energy feature which the Calliope mini uses.
In the world of Bluetooth low energy, a device has something called a “profile” which defines the way other devices are able to communicate over Bluetooth with it. In a way, the Bluetooth profile defines the way a device appears to other devices in terms of its features and the things it can do.
To put it another way, a Bluetooth profile is really an interface specification. It defines the data which a device has, what another device can do with that data over a Bluetooth connection and how the device with the profile should respond when a connected device acts upon its data in some way. Let’s look at that description in a little more technical detail.
Basic Concepts
A Bluetooth device contains a table of data called an Attribute Table which can be accessed by other connected devices in various possible ways. That table of data and the ways in which it can be exploited falls into a technical area of Bluetooth called the Generic Attribute profile or “GATT” for short and you may see the term GATT in some of the documentation for APIs such as those provided by the Android platform.
The Attribute Table contains something like a series of records of various types. The main types are called Services, Characteristics and Descriptors. Let’s look at each of these terms in turn.
Attributes
Services, Characteristics and Descriptors are all types of Attribute. Hence Generic Attribute Profile, Attribute Table and something called the Attribute Protocol. All attributes have a type which is identified by a UUID (Universally Unique Identifer). Some Attributes are defined by the Bluetooth SIG, the technical standards body for Bluetooth and these have UUIDs which are 16 bits in length. Some Attributes are custom designed for a particular device by the product team and these have 128 bit UUIDs. The Calliope mini uses a mixture of 16 bit and 128 bit UUIDs.
Structure
Services, Characteristics and Descriptors are organised in a hierarchy with Services at the top and Descriptors at the bottom. Services contain one or more Characteristics. A Characteristic owns zero or more Descriptors. Zero because Descriptors are completely optional whereas a Service must contain at least one Characteristic.
Services
A Service is a container for logically related Bluetooth data items. Those data items are in fact called Characteristics. A Service can be thought of as the owner of the Characteristics inside it. Often a Service represents a particular feature (e.g. a hardware feature) of a device like the buttons or a particular sensor. An example of a Bluetooth SIG defined Service is the Device Information Service which, as the name suggests, is a container for various items of information about the device such as its manufacturer and serial number. The Calliope mini has this service.
Characteristics
Characteristics are items of data which relate to a particular internal state of the device or perhaps some state of the environment which the device can measure using a sensor. The current battery level is an example of internal state data whereas the ambient temperature could perhaps be measured by a sensor. Sometimes Characteristics represent configuration data such as the frequency at which you want something to be measured. In any of these cases, the way a device can expose such data to other devices to use via Bluetooth is by making them available as a Characteristic. An example of a Bluetooth SIG defined Characteristic is the Serial Number String which you’ll find inside the Device Information service.
Characteristics contain various parts. They have a type, a value, some properties and some permissions.
Type is something already explained above, a UUID value which indicates which particular type of Characteristic an Attribute is. Value is the value of the associated state data item.
Properties define what another device can do with the characteristic over Bluetooth in terms of various defined operations such as READ, WRITE or NOTIFY. Reading a characteristic means transferring its current value from the attribute table to the connected device over Bluetooth. Writing allows the connected device to change that value in the state table. Notifications are a special message type which a device like the Calliope mini can send to a connected device whenever the value of the associated characteristic changes or perhaps periodically, controlled by a timer. Not all Characteristics support all operations. The Characteristic’s properties tell you which operations are supported.
Sometimes the device will have been programmed to respond in a special way when it processes an operation like reading or writing a value from the attribute table so operations can result in more happening than simply transferring data across the connection. Perhaps changing the value of a Characteristic will result in the device changing the frequency with which it samples readings from the device accelerometer for example.
Permissions are to do with security and further describe the security conditions that must be met before read or write access to the characteristic is to be granted.
Descriptors
Descriptors contain meta data which either augments the details relating to the Characteristic which the Descriptor belongs to or allows the configuration of a behaviour involving that Characteristic. Notification messages are switched on or off using a special descriptor called the Client Characteristic Configuration Descriptor for example.
Profile
A Bluetooth profile is a specification which pulls together all the required information about how a device behaves, how it can be accessed in terms of its services, characteristics and descriptors, security rules, concurrency limitations and so on.
Client Server Architecture
When a smartphone application interacts with a device like the Calliope mini over a Bluetooth connection we have a client/server architecture. The phone application is usually the GATT client and the Calliope mini is usually the GATT server. They communicate using a protocol called the Attribute Protocol or just ATT for short. As a smartphone developer you work with APIs and do not have to worry about formulating ATT protocol data units and so on.
Device Discovery
Everything described above relates to devices which are connected and communicating as GATT client and server. But there’s a stage which precedes this where the two devices are not yet connected. How do they find each other and connect? The answer to this question is termed ‘Device Discovery’ and is the responsibility of another part of the Bluetooth architecture called the Generic Access Profile (GAP).
In GAP, one devices advertises, emitting small packets of data periodically. These packets contain information about the device doing the advertising. Other devices looking for devices to connect to perform something called scanning, receiving and processing advertising packets and filtering out those that come from devices of a type that are not of interest. Usually the user is given information about devices which are discovered and they then select one to be connected to. The device which advertises is called a Bluetooth Peripheral whereas the one doing the scanning is a Bluetooth Central device. Calliope mini is a Bluetooth peripheral.
Bluetooth on the Calliope mini
Full documentation for the Calliope mini Bluetooth profile as used by this application can be found at the Lancaster University documentation web site.
The Calliope mini’s accelerometer (motion detector), magnetometer (digital compass), two buttons on the front, LED Display, IO pins on the edge connector, internal message bus and internal temperature sensor are all exposed as Services so that applications can exploit these features of the device. In addition:
- the Bluetooth SIG defined Device Information Service is included to allow applications to obtain information such as firmware version details over Bluetooth
- there’s a Device Firmware Update (DFU) service which allows new Calliope mini code to be flashed to the device over Bluetooth instead of over USB
- there’s a UART service which allows arbitrary data to be exchanged with the Calliope mini in a way resembling traditional serial communications.
Everything you can do with the Calliope mini over Bluetooth is achieved through read, write and notify operations. Not all characteristics support all three so check the profile documentation. Often there are Characteristics whose purpose is to allow you to write configuration values which control other behaviours. Technically these are called Control Points. For example you can specify the frequency with which accelerometer data is sampled before it is transmitted as a Notification message to your application.
Want to Know More?
The Bluetooth SIG web site at http://www.bluetooth.com is a good place for further information about Bluetooth in general. You’ll find all the SIG defined profiles, services, characteristics and descriptors there as well as the core specification for all Bluetooth technology.
That’s it! Enjoy using Bluetooth on the Calliope mini!
Martin Woolley, Bluetooth SIG. Twitter: @bluetooth_mdw
Video
See also
About Bluetooth, Calliope mini Bluetooth profile overview , Calliope mini Bluetooth profile reference, Bluetooth on Calliope mini resources, Bluetooth SIG
bluetooth


|
Contiki 2.5
|
The name of the function that should be called when UDP datagrams arrive. More...
Defines | |
| #define | UIP_TCP |
| Toggles whether UDP support should be compiled in or not. | |
| #define | UIP_ACTIVE_OPEN |
| Determines if support for opening connections from uIP should be compiled in. | |
| #define | UIP_CONNS |
| The maximum number of simultaneously open TCP connections. | |
| #define | UIP_LISTENPORTS |
| The maximum number of simultaneously listening TCP ports. | |
| #define | UIP_URGDATA |
| Determines if support for TCP urgent data notification should be compiled in. | |
| #define | UIP_RTO 3 |
| The initial retransmission timeout counted in timer pulses. | |
| #define | UIP_MAXRTX 8 |
| The maximum number of times a segment should be retransmitted before the connection should be aborted. | |
| #define | UIP_MAXSYNRTX 5 |
| The maximum number of times a SYN segment should be retransmitted before a connection request should be deemed to have been unsuccessful. | |
| #define | UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) |
| The TCP maximum segment size. | |
| #define | UIP_RECEIVE_WINDOW |
| The size of the advertised receiver's window. | |
| #define | UIP_TIME_WAIT_TIMEOUT 120 |
| How long a connection should stay in the TIME_WAIT state. |
The name of the function that should be called when UDP datagrams arrive.
| #define UIP_ACTIVE_OPEN |
Determines if support for opening connections from uIP should be compiled in.
If the applications that are running on top of uIP for this project do not need to open outgoing TCP connections, this configuration option can be turned off to reduce the code size of uIP.
| #define UIP_CONNS |
The maximum number of simultaneously open TCP connections.
Since the TCP connections are statically allocated, turning this configuration knob down results in less RAM used. Each TCP connection requires approximately 30 bytes of memory.
Definition at line 326 of file uipopt.h.
Referenced by uip_init(), and uip_process().
| #define UIP_LISTENPORTS |
The maximum number of simultaneously listening TCP ports.
Each listening TCP port requires 2 bytes of memory.
Definition at line 340 of file uipopt.h.
Referenced by uip_init(), uip_listen(), uip_process(), and uip_unlisten().
| #define UIP_MAXRTX 8 |
The maximum number of times a segment should be retransmitted before the connection should be aborted.
This should not be changed.
Definition at line 369 of file uipopt.h.
Referenced by uip_process().
| #define UIP_MAXSYNRTX 5 |
The maximum number of times a SYN segment should be retransmitted before a connection request should be deemed to have been unsuccessful.
This should not need to be changed.
Definition at line 378 of file uipopt.h.
Referenced by uip_process().
| #define UIP_RECEIVE_WINDOW |
The size of the advertised receiver's window.
Should be set low (i.e., to the size of the uip_buf buffer) if the application is slow to process incoming data, or high (32768 bytes) if the application processes data quickly.
Definition at line 402 of file uipopt.h.
Referenced by uip_process().
| #define UIP_RTO 3 |
The initial retransmission timeout counted in timer pulses.
This should not be changed.
Definition at line 361 of file uipopt.h.
Referenced by uip_process().
| #define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN) |
The TCP maximum segment size.
This is should not be to set to more than UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
Definition at line 389 of file uipopt.h.
Referenced by uip_process(), and uip_split_output().
| #define UIP_TIME_WAIT_TIMEOUT 120 |
How long a connection should stay in the TIME_WAIT state.
This can be reduced for faster entry into power saving modes.
Definition at line 413 of file uipopt.h.
Referenced by uip_process().


Farmer John has N hills on his farm (1 <= N <= 1,000), each with an integer elevation in the range 0 .. 100. In the winter, since there is abundant snow on these hills, FJ routinely operates a ski training camp.
Unfortunately, FJ has just found out about a new tax that will be assessed next year on farms used as ski training camps. Upon careful reading of the law, however, he discovers that the official definition of a ski camp requires the difference between the highest and lowest hill on his property to be strictly larger than 17. Therefore, if he shortens his tallest hills and adds mass to increase the height of his shorter hills, FJ can avoid paying the tax as long as the new difference between the highest and lowest hill is at most 17.
If it costs x^2 units of money to change the height of a hill by x units, what is the minimum amount of money FJ will need to pay? FJ can change the height of a hill only once, so the total cost for each hill is the square of the difference between its original and final height. FJ is only willing to change the height of each hill by an integer amount.
| Line 1: | The integer N. |
| Lines 2..1+N: | Each line contains the elevation of a single hill. |
5 20 4 1 24 21
FJ's farm has 5 hills, with elevations 1, 4, 20, 21, and 24.
| Line 1: | The minimum amount FJ needs to pay to modify the elevations of his hills so the difference between largest and smallest is at most 17 units. |
18
FJ keeps the hills of heights 4, 20, and 21 as they are. He adds mass to the hill of height 1, bringing it to height 4 (cost = 3^2 = 9). He shortens the hill of height 24 to height 21, also at a cost of 3^2 = 9.


Campaign helps military members get home for the holidays
LYNCHBURG, Tenn. (AP) - The Tennessee distillery that produces Jack Daniel’s whiskey is once again teaming up with a military support group to help service members and their families get home for the holidays.
For the ninth year, the distillery is working with the Armed Services YMCA for the “Operation Ride Home” campaign. It provides financial assistance to active duty junior-enlisted military members and their families to travel home during the holidays.
Distillery officials say that since the campaign began, about 7,230 service members and their relatives have been assisted. Jack Daniel’s says it has again donated $100,000 to kick off the campaign.
Military members have been able to travel to all 50 states thanks to the program.
Jack Daniel’s is the flagship brand of Louisville, Kentucky-based Brown-Forman Corp.
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


@see NetworkInformation API details and Browser compability table on MDN page.
| option | value | info |
|---|---|---|
| downlink | not supported | Returns the effective bandwidth estimate in megabits per second, rounded to the nearest multiple of 25 kilobits per seconds. |
| downlinkMax | not supported | Returns the maximum downlink speed, in megabits per second (Mbps), for the underlying connection technology. |
| effectiveType | not supported | Returns the effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'. This value is determined using a combination of recently observed round-trip time and downlink values. |
| rtt | not supported | Returns the estimated effective round-trip time of the current connection, rounded to the nearest multiple of 25 milliseconds. |
| saveData | not supported | Returns true if the user has set a reduced data usage option on the user agent. |
| type | not supported | Returns the type of connection a device is using to communicate with the network. It will be one of the following values: "bluetooth", "cellular", "ethernet", "none", "wifi", "wimax", "other", "unknown" |
| onchange | not supported | The event that's fired when connection information changes and the change is fired on this |
Throttle network speed from DevTools panel to update network connection log table.(@see helper picture below)
| * | effectiveType | rtt | downlink | saveData | speed change |
|---|


npm explore <pkg> [ -- <command>]
Spawn a subshell in the directory of the installed package specified.
If a command is specified, then it is run in the subshell, which then immediately terminates.
This is particularly handy in the case of git submodules in the node_modules
folder:
npm explore some-dependency -- git pull origin master
Note that the package is not automatically rebuilt afterwards, so be sure to use npm rebuild
<pkg>
if you make any changes.
The shell to run for the npm explore
command.


Our helmets are thoroughly tested in-house and elsewhere to ensure they can protect your head in a crash. Furthermore, we pass Consumer Product Safety Commission standard for bicycle helmets.
We want to ensure everyone is able to access a helmet when using bicycle-sharing programs, so it's key our helmets are inexpensive.
Our helmets are design to decay over the course of 30 days once disposed.
Hong Kong Polytechnic University, Ph.D. 2019
University of Hong Kong, Bachelors 2017
MIT, Bachelors 2018
University of Hong Kong, Masters 2017
MIT, Sloan School of Management, M.B.A. 2018
Some of the top dreamers, builders, and scientists from MIT, HKU, and PolyU have gathered to solve bicycle transportation and safety.


Semlab Wikibase Semantic Lab's experimental Wikibase installation. Our datastore for projects and research. Semlab Wikibase Backup Status:
Selavy Document to Data tool. This application is in early development. Selavy Tool (Semlab login required) Selavy Alpha Demo Video Backup Status:
Triple Builder A RDF sandbox where you can build triples using a spreadsheet interface and share with others. tb.semlab.io
DADAlytics: NER Service A service that you can send text to and it will return extracted named entities using up to six NER tools. This service is no longer online. If you would like to run it locally please follow these directions.


If no one can speak the language at all, it becomes an extinct language. We may study "dead languages" through recordings or writing, but it remains "dead" or extinct unless there are fluent speakers of the language.
It is estimated that a language dies every 14 days. We observe currently endangered languages and the global trend of people replacing these languages with languages from a small set of globally recognized "official" languages.


NewsBreak: Oil Inventories Rose by 1.38M Last Week
by Investing.comInvesting.com - Oil inventories rose a little less than expected last week, the Energy Information Administration reported Wednesday, sending crude prices higher.
- Crude stockpiles rose by 1.38 million barrels for the week ended Nov. 15, the EIA said. The market was expecting a build of about 1.54 million barrels, according to forecasts compiled by Investing.com.
- Gasoline inventories rose by about 1.8 million barrels, versus analysts’ expectations for a rise of 870,000 barrels. Distillate stockpiles fell by about 1 million barrels, compared with forecasts for a decline of about 730,000 barrels.
- WTI futures were up 1.4%. Prices were up about 0.8% before the report was released.


VOYAGE TO THE BEGINNING OF THE WORLD
Reviewed by Harvey Karten, Ph.D. Strand Releasing Director: Manoel De Oliveira Writer: Manoel de Oliveira Cast: Marcello Mastroianni, Jean Yves Gautier, Leonor Siolveira
Maybe the Europeans should leave the road movies to the Americans. "Voyage to the Beginning of the World," which takes place largely in a car travleing over the roads of Northern Portugal, is the sort of film that has the viewers wondering, "Are we there yet?" When we get there, though, there's no payoff, just the pretentious chatter of uninteresting people who are fond of talking in metaphors.
This latest film of a ninety-year old director has nothing in common with his 1970s works which critics admire for their modernist complexities, and seems world apart from his more accessible 1995 film, "The Convent," which featured a crackerjack role for John Malkovich. Perhaps it will be marketed as a tribute to great Marcello Mastroianni, who died in 1996 at the age of 73 shortly after appearing in "Voyage," too soon even to see a screening of the movie.
The journey from France to Portugal is undertaken by a Portuguese director, his small company, and a French actor who is hired to do a TV shoot with them in the Iberian country. The Frenchman, Afonso (Jean Yves Gautier) was brought up in France by a French mother and by a Portuguese father who died young and did not teach the boy any of his language. Afonso uses the trip as an excuse to visit his father's town where he hopes to meet his dad's surviving sister, and since the Portuguese director, Manoel (Marcello Mastroianni) and the two actors can translate for him, they agree to go with him to the village. Reminiscing is apparently contagious: director Manoel, who looks more old and tired than his 73 years and wallows in self-pity, describes the past as a time that "it's good to remember" since the days "will not come back." He describes the horniness of his earlier years, his strict education under the Jesuits, and insists that he could never become a priest as the mere sight of a woman would make him forget about celibacy. In a roundabout way he even suggests a liaison with the attractive Portuguese actress in the car, Judite (Leonor Silveira), who is not engrossed but who, despite her name, has no interest in beheading the director. Much is made of a mustachioed statue they encounter on the road, a statue which takes on great metaphoric weight as a man whom "no one can set free." When the troupe arrive at the old aunt's house, the crone at first refuses to believe that Afonso is her nephew, but is convinced of their relationship when she touches his arm and somehow senses that they are of the same blood.
While Manoel's dad seems to be an interesting dude, one who left ol' Portugal and its spartan ways to fight in Spain, bought his way out of a Republican jail, and wound up in France, Manoel, Afonso, Judite et famille are crashing bores.
Traveling from a hip, modern area of France to a backwoods village in Northern Portugal is indeed a journey back to the dawn of time. Though the picture is a mere 95 minutes, the viewers can't be blamed for feeling that they themselves have had the experience.
Not Rated. Running time: 95 minutes. (C) Harvey Karten 1998
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews