|
Groovy JDK |
| Method Summary | |
|---|---|
Object
|
asType(Class c)
Provides a method to perform custom 'dynamic' type conversion to the given class using the as operator.
|
Pattern
|
bitwiseNegate()
Turns a String into a regular expression Pattern |
String
|
capitalize()
Convenience method to capitalize the first letter of a string (typically the first letter of a word). |
String
|
center(Number numberOfChars)
Pad a String to a minimum length specified by numberOfChars by adding the space character around it as many times as needed so that it remains centered. |
String
|
center(Number numberOfChars, String padding)
Pad a String to a minimum length specified by numberOfChars, appending the supplied padding String around the original as many times as needed keeping it centered. |
String
|
collectReplacements(Closure transform)
Iterate through this String a character at a time collecting either the original character or a transformed replacement String. |
boolean
|
contains(String text)
Provide an implementation of contains() like Collection#contains to make Strings more polymorphic. |
int
|
count(String text)
Count the number of occurrences of a substring. |
byte[]
|
decodeBase64()
Decode the String from Base64 into a byte array. |
byte[]
|
decodeHex()
Decodes a hex string to a byte array. |
String
|
denormalize()
Return a String with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator. |
Object
|
eachLine(Closure closure)
Iterates through this String line by line. |
Object
|
eachLine(int firstLine, Closure closure)
Iterates through this String line by line. |
String
|
eachMatch(Pattern pattern, Closure closure)
Process each regex group matched substring of the given pattern. |
String
|
eachMatch(String regex, Closure closure)
Process each regex group matched substring of the given string. |
Process
|
execute()
Executes the command specified by self as a command-line process.
|
Process
|
execute(String[] envp, File dir)
Executes the command specified by self with environment defined by envp
and under the working directory dir .
|
Process
|
execute(List envp, File dir)
Executes the command specified by self with environment defined
by envp and under the working directory dir .
|
String
|
expand()
Expands all tabs into spaces with tabStops of size 8. |
String
|
expand(int tabStop)
Expands all tabs into spaces. |
String
|
expandLine(int tabStop)
Expands all tabs into spaces. |
String
|
find(Pattern pattern)
Finds the first occurrence of a compiled regular expression Pattern within a String. |
String
|
find(Pattern pattern, Closure closure)
Returns the result of calling a closure with the first occurrence of a compiled regular expression found within a String. |
String
|
find(String regex)
Finds the first occurrence of a regular expression String within a String. |
String
|
find(String regex, Closure closure)
Returns the result of calling a closure with the first occurrence of a regular expression found within a String. |
List
|
findAll(Pattern pattern)
Returns a (possibly empty) list of all occurrences of a regular expression (in Pattern format) found within a String. |
List
|
findAll(Pattern pattern, Closure closure)
Finds all occurrences of a compiled regular expression Pattern within a String. |
List
|
findAll(String regex)
Returns a (possibly empty) list of all occurrences of a regular expression (in String format) found within a String. |
List
|
findAll(String regex, Closure closure)
Finds all occurrences of a regular expression string within a String. |
String
|
getAt(Collection indices)
Select a List of characters from a String using a Collection to identify the indices to be selected. |
String
|
getAt(EmptyRange range)
Support the range subscript operator for String with EmptyRange |
String
|
getAt(int index)
Support the subscript operator for String. |
String
|
getAt(IntRange range)
Support the range subscript operator for String with IntRange |
String
|
getAt(Range range)
Support the range subscript operator for String |
char[]
|
getChars()
Converts the given String into an array of characters. |
boolean
|
isAllWhitespace()
True if a String only contains whitespace characters. |
boolean
|
isBigDecimal()
Determine if a String can be parsed into a BigDecimal. |
boolean
|
isBigInteger()
Determine if a String can be parsed into a BigInteger. |
boolean
|
isCase(Object switchValue)
'Case' implementation for a String, which uses String#equals(Object) in order to allow Strings to be used in switch statements. |
boolean
|
isDouble()
Determine if a String can be parsed into a Double. |
boolean
|
isFloat()
Determine if a String can be parsed into a Float. |
boolean
|
isInteger()
Determine if a String can be parsed into an Integer. |
boolean
|
isLong()
Determine if a String can be parsed into a Long. |
boolean
|
isNumber()
Determine if a String can be parsed into a Number. |
StringBuffer
|
leftShift(Object value)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a String. |
boolean
|
matches(Pattern pattern)
Tells whether or not self matches the given compiled regular expression Pattern. |
String
|
minus(Object target)
Remove a part of a String. |
String
|
multiply(Number factor)
Repeat a String a certain number of times. |
String
|
next()
This method is called by the ++ operator for the class String. |
String
|
normalize()
Return a String with linefeeds and carriage returns normalized to linefeeds. |
String
|
padLeft(Number numberOfChars)
Pad a String to a minimum length specified by numberOfChars by adding the space character to the left as many times as needed. |
String
|
padLeft(Number numberOfChars, String padding)
Pad a String to a minimum length specified by numberOfChars, adding the supplied padding String as many times as needed to the left. |
String
|
padRight(Number numberOfChars)
Pad a String to a minimum length specified by numberOfChars by adding the space character to the right as many times as needed. |
String
|
padRight(Number numberOfChars, String padding)
Pad a String to a minimum length specified by numberOfChars, adding the supplied padding String as many times as needed to the right. |
String
|
plus(Object value)
Appends the String representation of the given operand to this string. |
String
|
previous()
This method is called by the -- operator for the class String. |
List
|
readLines()
Return the lines of a String as a List of Strings. |
String
|
replaceAll(Pattern pattern, Closure closure)
Replaces all occurrences of a captured group by the result of a closure call on that text. |
String
|
replaceAll(Pattern pattern, String replacement)
Replaces all substrings of a String that match the given compiled regular expression with the given replacement. |
String
|
replaceAll(String regex, Closure closure)
Replaces all occurrences of a captured group by the result of a closure on that text. |
String
|
replaceFirst(Pattern pattern, Closure closure)
Replaces the first occurrence of a captured group by the result of a closure call on that text. |
String
|
replaceFirst(Pattern pattern, String replacement)
Replaces the first substring of a String that matches the given compiled regular expression with the given replacement. |
String
|
replaceFirst(String regex, Closure closure)
Replaces the first occurrence of a captured group by the result of a closure call on that text. |
String
|
reverse()
Creates a new string which is the reverse (backwards) of this string |
int
|
size()
Provide the standard Groovy size() method for String .
|
String[]
|
split()
Convenience method to split a string (with whitespace as delimiter) Like tokenize, but returns an Array of Strings instead of a List |
Object
|
splitEachLine(Pattern pattern, Closure closure)
Iterates through the given String line by line, splitting each line using the given separator Pattern. |
Object
|
splitEachLine(String regex, Closure closure)
Iterates through the given String line by line, splitting each line using the given separator. |
String
|
stripIndent()
Strip leading spaces from every line in a String. |
String
|
stripIndent(int numChars)
Strip numChar leading characters from every line in a String. |
String
|
stripMargin()
Strip leading whitespace/control characters followed by '|' from every line in a String. |
String
|
stripMargin(char marginChar)
Strip leading whitespace/control characters followed by marginChar from every line in a String. |
String
|
stripMargin(String marginChar)
Strip leading whitespace/control characters followed by marginChar from every line in a String. |
BigDecimal
|
toBigDecimal()
Parse a String into a BigDecimal |
BigInteger
|
toBigInteger()
Parse a String into a BigInteger |
Boolean
|
toBoolean()
Converts the given string into a Boolean object. |
Character
|
toCharacter()
Converts the given string into a Character object using the first character in the string. |
Double
|
toDouble()
Parse a String into a Double |
Float
|
toFloat()
Parse a String into a Float |
Integer
|
toInteger()
Parse a String into an Integer |
List
|
toList()
Converts the given String into a List of strings of one character. |
Long
|
toLong()
Parse a String into a Long |
Set
|
toSet()
Converts the given String into a Set of unique strings of one character. |
Short
|
toShort()
Parse a String into a Short |
URI
|
toURI()
Transforms a String representing a URI into a URI object. |
URL
|
toURL()
Transforms a String representing a URL into a URL object. |
List
|
tokenize()
Tokenize a String (with a whitespace as the delimiter). |
List
|
tokenize(Character token)
Tokenize a String based on the given character delimiter. |
List
|
tokenize(String token)
Tokenize a String based on the given string delimiter. |
String
|
tr(String sourceSet, String replacementSet)
Translates a string by replacing characters from the sourceSet with characters from replacementSet. |
String
|
unexpand()
Replaces sequences of whitespaces with tabs using tabStops of size 8. |
String
|
unexpand(int tabStop)
Replaces sequences of whitespaces with tabs. |
String
|
unexpandLine(int tabStop)
Replaces sequences of whitespaces with tabs within a line. |
| Method Detail |
|---|
public Object asType(Class c)
as
operator.
Example: '123' as Double
By default, the following types are supported:
c
- the desired class.public Pattern bitwiseNegate()
public String capitalize()
assert 'h'.capitalize() == 'H' assert 'hello'.capitalize() == 'Hello' assert 'hello world'.capitalize() == 'Hello world' assert 'Hello World' == 'hello world'.split(' ').collect{ it.capitalize() }.join(' ')
public String center(Number numberOfChars)
['A', 'BB', 'CCC', 'DDDD'].each{ println '|' + it.center(6) + '|' }will produce output like:
| A | | BB | | CCC | | DDDD |
numberOfChars
- the total minimum number of characters of the resulting string.public String center(Number numberOfChars, String padding)
['A', 'BB', 'CCC', 'DDDD'].each{ println '|' + it.center(6, '+') + '|' }will produce output like:
|++A+++| |++BB++| |+CCC++| |+DDDD+|
numberOfChars
- the total minimum number of characters of the resulting string.padding
- the characters used for padding.public String collectReplacements(Closure transform)
assert "Groovy".collectReplacements{ it == 'o' ? '_O_' : null } == 'Gr_O__O_vy' assert "B&W".collectReplacements{ it == '&' ? '&' : null } == 'B&W'
public boolean contains(String text)
text
- a String to look for.public int count(String text)
text
- a substring.public byte[] decodeBase64()
public byte[] decodeHex()
public String denormalize()
public Object eachLine(Closure closure)
closure
- a closure.public Object eachLine(int firstLine, Closure closure)
firstLine
- the line number value used for the first line (default is 1, set to 0 to start counting from 0).closure
- a closure (arg 1 is line, optional arg 2 is line number).public String eachMatch(Pattern pattern, Closure closure)
pattern
- a regex Pattern.closure
- a closure with one parameter or as much parameters as groups.public String eachMatch(String regex, Closure closure)
regex
- a Regex string.closure
- a closure with one parameter or as much parameters as groups.public Process execute()
self
as a command-line process.
For more control over Process construction you can use
java.lang.ProcessBuilder
(JDK 1.5+).
public Process execute(String[] envp, File dir)
self
with environment defined by envp
and under the working directory dir
.
For more control over Process construction you can use
java.lang.ProcessBuilder
(JDK 1.5+).
envp
- an array of Strings, each element of which
has environment variable settings in the format
name=value, or
null if the subprocess should inherit
the environment of the current process..dir
- the working directory of the subprocess, or
null if the subprocess should inherit
the working directory of the current process..public Process execute(List envp, File dir)
self
with environment defined
by envp
and under the working directory dir
.
For more control over Process construction you can use
java.lang.ProcessBuilder
(JDK 1.5+).
envp
- a List of Objects (converted to Strings using toString), each member of which
has environment variable settings in the format
name=value, or
null if the subprocess should inherit
the environment of the current process..dir
- the working directory of the subprocess, or
null if the subprocess should inherit
the working directory of the current process..public String expand()
public String expand(int tabStop)
tabStop
- The number of spaces a tab represents.public String expandLine(int tabStop)
tabStop
- The number of spaces a tab represents.public String find(Pattern pattern)
For example, if the pattern doesn't match the result is null:
assert null == "New York, NY".find(~/\d{5}/)If it does match, we get the matching string back:
assert "10292" == "New York, NY 10292-0098".find(~/\d{5}/)If we have capture groups in our expression, the groups are ignored and we get back the full match:
assert "10292-0098" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/)If you need to work with capture groups, then use the closure version of this method or use Groovy's matcher operators or use eachMatch.
pattern
- the compiled regex Pattern.public String find(Pattern pattern, Closure closure)
For example, if the pattern doesn't match, the result is null:
assert null == "New York, NY".find(~/\d{5}/) { match -> return "-$match-"}If it does match and we don't have any capture groups in our regex, there is a single parameter on the closure that the match gets passed to:
assert "-10292-" == "New York, NY 10292-0098".find(~/\d{5}/) { match -> return "-$match-"}If we have capture groups in our expression, our closure has one parameter for the match, followed by one for each of the capture groups:
assert "10292" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour -> assert match == "10292-0098" assert zip == "10292" assert plusFour == "0098" return zip }If we have capture groups in our expression, and our closure has one parameter, the closure will be passed an array with the first element corresponding to the whole match, followed by an element for each of the capture groups:
assert "10292" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour -> assert array[0] == "10292-0098" assert array[1] == "10292" assert array[2] == "0098" return array[1] }If a capture group is optional, and doesn't match, then the corresponding value for that capture group passed to the closure will be null as illustrated here:
assert "2339999" == "adsf 233-9999 adsf".find(~/(\d{3})?-?(\d{3})-(\d{4})/) { match, areaCode, exchange, stationNumber -> assert "233-9999" == match assert null == areaCode assert "233" == exchange assert "9999" == stationNumber return "$exchange$stationNumber" }
pattern
- the compiled regex Pattern.closure
- the closure that will be passed the full match, plus each of the capturing groups.public String find(String regex)
For example, if the regex doesn't match the result is null:
assert null == "New York, NY".find(/\d{5}/)If it does match, we get the matching string back:
assert "10292" == "New York, NY 10292-0098".find(/\d{5}/)If we have capture groups in our expression, we still get back the full match
assert "10292-0098" == "New York, NY 10292-0098".find(/(\d{5})-?(\d{4})/)
regex
- the capturing regex.public String find(String regex, Closure closure)
For example, if the regex doesn't match, the result is null:
assert null == "New York, NY".find(~/\d{5}/) { match -> return "-$match-"}If it does match and we don't have any capture groups in our regex, there is a single parameter on the closure that the match gets passed to:
assert "-10292-" == "New York, NY 10292-0098".find(~/\d{5}/) { match -> return "-$match-"}If we have capture groups in our expression, our closure has one parameter for the match, followed by one for each of the capture groups:
assert "10292" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour -> assert match == "10292-0098" assert zip == "10292" assert plusFour == "0098" return zip }If we have capture groups in our expression, and our closure has one parameter, the closure will be passed an array with the first element corresponding to the whole match, followed by an element for each of the capture groups:
assert "10292" == "New York, NY 10292-0098".find(~/(\d{5})-?(\d{4})/) { match, zip, plusFour -> assert array[0] == "10292-0098" assert array[1] == "10292" assert array[2] == "0098" return array[1] }If a capture group is optional, and doesn't match, then the corresponding value for that capture group passed to the closure will be null as illustrated here:
assert "2339999" == "adsf 233-9999 adsf".find(~/(\d{3})?-?(\d{3})-(\d{4})/) { match, areaCode, exchange, stationNumber -> assert "233-9999" == match assert null == areaCode assert "233" == exchange assert "9999" == stationNumber return "$exchange$stationNumber" }
regex
- the capturing regex string.closure
- the closure that will be passed the full match, plus each of the capturing groups.public List findAll(Pattern pattern)
For example, if the pattern doesn't match, it returns an empty list:
assert [] == "foo".findAll(~/(\w*) Fish/)Any regular expression matches are returned in a list, and all regex capture groupings are ignored, only the full match is returned:
def expected = ["One Fish", "Two Fish", "Red Fish", "Blue Fish"] assert expected == "One Fish, Two Fish, Red Fish, Blue Fish".findAll(~/(\w*) Fish/)
pattern
- the compiled regex Pattern.public List findAll(Pattern pattern, Closure closure)
If there are no matches, the closure will not be called, and an empty List will be returned.
For example, if the pattern doesn't match, it returns an empty list:
assert [] == "foo".findAll(~/(\w*) Fish/) { match, firstWord -> return firstWord }Any regular expression matches are passed to the closure, if there are no capture groups, there will be one parameter for the match:
assert ["couldn't", "wouldn't"] == "I could not, would not, with a fox.".findAll(~/.ould/) { match -> "${match}n't"}If there are capture groups, the first parameter will be the match followed by one parameter for each capture group:
def orig = "There's a Wocket in my Pocket" assert ["W > Wocket", "P > Pocket"] == orig.findAll(~/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" }
pattern
- the compiled regex Pattern.closure
- will be passed the full match plus each of the capturing groups.public List findAll(String regex)
For example, if the regex doesn't match, it returns an empty list:
assert [] == "foo".findAll(/(\w*) Fish/)Any regular expression matches are returned in a list, and all regex capture groupings are ignored, only the full match is returned:
def expected = ["One Fish", "Two Fish", "Red Fish", "Blue Fish"] assert expected == "One Fish, Two Fish, Red Fish, Blue Fish".findAll(/(\w*) Fish/)If you need to work with capture groups, then use the closure version of this method or use Groovy's matcher operators or use eachMatch.
regex
- the capturing regex String.public List findAll(String regex, Closure closure)
If there are no matches, the closure will not be called, and an empty List will be returned.
For example, if the regex doesn't match, it returns an empty list:
assert [] == "foo".findAll(/(\w*) Fish/) { match, firstWord -> return firstWord }Any regular expression matches are passed to the closure, if there are no capture groups, there will be one parameter for the match:
assert ["couldn't", "wouldn't"] == "I could not, would not, with a fox.".findAll(/.ould/) { match -> "${match}n't"}If there are capture groups, the first parameter will be the match followed by one parameter for each capture group:
def orig = "There's a Wocket in my Pocket" assert ["W > Wocket", "P > Pocket"] == orig.findAll(/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" }
regex
- the capturing regex String.closure
- will be passed the full match plus each of the capturing groups.public String getAt(Collection indices)
indices
- a Collection of indices.public String getAt(EmptyRange range)
range
- an EmptyRange.public String getAt(int index)
index
- the index of the Character to get.public String getAt(IntRange range)
range
- an IntRange.public String getAt(Range range)
range
- a Range.public char[] getChars()
public boolean isAllWhitespace()
public boolean isBigDecimal()
public boolean isBigInteger()
public boolean isCase(Object switchValue)
switch( str ) { case 'one' : // etc... }Note that this returns
true
for the case where both the
'switch' and 'case' operand is null
.switchValue
- the switch value.public boolean isDouble()
public boolean isFloat()
public boolean isInteger()
public boolean isLong()
public boolean isNumber()
public StringBuffer leftShift(Object value)
value
- an Object.public boolean matches(Pattern pattern)
pattern
- the regex Pattern to which the string of interest is to be matched.public String minus(Object target)
target
- an object representing the part to remove.public String multiply(Number factor)
factor
- the number of times the String should be repeated.public String next()
public String normalize()
public String padLeft(Number numberOfChars)
println 'Numbers:' [1, 10, 100, 1000].each{ println it.toString().padLeft(5) }will produce output like:
Numbers: 1 10 100 1000
numberOfChars
- the total minimum number of characters of the resulting string.public String padLeft(Number numberOfChars, String padding)
println 'Numbers:' [1, 10, 100, 1000].each{ println it.toString().padLeft(5, '*') } [2, 20, 200, 2000].each{ println it.toString().padLeft(5, '*_') }will produce output like:
Numbers: ****1 ***10 **100 *1000 *_*_2 *_*20 *_200 *2000
numberOfChars
- the total minimum number of characters of the resulting string.padding
- the characters used for padding.public String padRight(Number numberOfChars)
['A', 'BB', 'CCC', 'DDDD'].each{ println it.padRight(5) + it.size() }will produce output like:
A 1 BB 2 CCC 3 DDDD 4
numberOfChars
- the total minimum number of characters of the resulting string.public String padRight(Number numberOfChars, String padding)
['A', 'BB', 'CCC', 'DDDD'].each{ println it.padRight(5, '#') + it.size() }will produce output like:
A####1 BB###2 CCC##3 DDDD#4
numberOfChars
- the total minimum number of characters of the resulting string.padding
- the characters used for padding.public String plus(Object value)
value
- any Object.public String previous()
public List readLines()
public String replaceAll(Pattern pattern, Closure closure)
For examples,
assert "hellO wOrld" == "hello world".replaceAll(~"(o)") { it[0].toUpperCase() } assert "FOOBAR-FOOBAR-" == "foobar-FooBar-".replaceAll(~"(([fF][oO]{2})[bB]ar)", { it[0].toUpperCase() }) Here, it[0] is the global string of the matched group it[1] is the first string in the matched group it[2] is the second string in the matched group assert "FOOBAR-FOOBAR-" == "foobar-FooBar-".replaceAll(~"(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() }) Here, it[0] is the global string of the matched group it[1] is the first string in the matched group it[2] is the second string in the matched group assert "FOO-FOO-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() }) Here, x is the global string of the matched group y is the first string in the matched group z is the second string in the matched groupNote that unlike String.replaceAll(String regex, String replacement), where the replacement string treats '$' and '\' specially (for group substitution), the result of the closure is converted to a string and that value is used literally for the replacement.
pattern
- the capturing regex Pattern.closure
- the closure to apply on each captured group.public String replaceAll(Pattern pattern, String replacement)
Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher#replaceAll. Use Matcher#quoteReplacement to suppress the special meaning of these characters, if desired.
assert "foo".replaceAll('o', 'X') == 'fXX'
pattern
- the regex Pattern to which the string of interest is to be matched.replacement
- the string to be substituted for the first match.public String replaceAll(String regex, Closure closure)
For examples,
assert "hellO wOrld" == "hello world".replaceAll("(o)") { it[0].toUpperCase() } assert "FOOBAR-FOOBAR-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() }) Here, it[0] is the global string of the matched group it[1] is the first string in the matched group it[2] is the second string in the matched group assert "FOO-FOO-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() }) Here, x is the global string of the matched group y is the first string in the matched group z is the second string in the matched groupNote that unlike String.replaceAll(String regex, String replacement), where the replacement string treats '$' and '\' specially (for group substitution), the result of the closure is converted to a string and that value is used literally for the replacement.
regex
- the capturing regex.closure
- the closure to apply on each captured group.public String replaceFirst(Pattern pattern, Closure closure)
For example (with some replaceAll variants thrown in for comparison purposes),
assert "hellO world" == "hello world".replaceFirst(~"(o)") { it[0].toUpperCase() } // first match assert "hellO wOrld" == "hello world".replaceAll(~"(o)") { it[0].toUpperCase() } // all matches assert '1-FISH, two fish' == "one fish, two fish".replaceFirst(~/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } assert '1-FISH, 2-FISH' == "one fish, two fish".replaceAll(~/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() }
pattern
- the capturing regex Pattern.closure
- the closure to apply on the first captured group.public String replaceFirst(Pattern pattern, String replacement)
Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher#replaceFirst. Use Matcher#quoteReplacement to suppress the special meaning of these characters, if desired.
assert "foo".replaceFirst('o', 'X') == 'fXo'
pattern
- the regex Pattern to which the string of interest is to be matched.replacement
- the string to be substituted for the first match.public String replaceFirst(String regex, Closure closure)
For example (with some replaceAll variants thrown in for comparison purposes),
assert "hellO world" == "hello world".replaceFirst("(o)") { it[0].toUpperCase() } // first match assert "hellO wOrld" == "hello world".replaceAll("(o)") { it[0].toUpperCase() } // all matches assert '1-FISH, two fish' == "one fish, two fish".replaceFirst(/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() } assert '1-FISH, 2-FISH' == "one fish, two fish".replaceAll(/([a-z]{3})\s([a-z]{4})/) { [one:1, two:2][it[1]] + '-' + it[2].toUpperCase() }
regex
- the capturing regex.closure
- the closure to apply on the first captured group.public String reverse()
public int size()
size()
method for String
.public String[] split()
public Object splitEachLine(Pattern pattern, Closure closure)
pattern
- the regular expression Pattern for the delimiter.closure
- a closure.public Object splitEachLine(String regex, Closure closure)
regex
- the delimiting regular expression.closure
- a closure.public String stripIndent()
assert ' A\n B\nC' == ' A\n B\n C'.stripIndent()
public String stripIndent(int numChars)
assert 'DEF\n456' == '''ABCDEF\n123456'''.stripIndent(3)
numChars
- The number of characters to strip.public String stripMargin()
assert 'ABC\n123\n456' == '''ABC |123 |456'''.stripMargin()
public String stripMargin(char marginChar)
assert 'ABC\n123\n456' == '''ABC *123 *456'''.stripMargin('*')
marginChar
- Any character that serves as margin delimiter.public String stripMargin(String marginChar)
marginChar
- Any character that serves as margin delimiter.public BigDecimal toBigDecimal()
public BigInteger toBigInteger()
public Boolean toBoolean()
public Character toCharacter()
public Double toDouble()
public Float toFloat()
public Integer toInteger()
public List toList()
public Long toLong()
public Set toSet()
Example usage:
assert 'groovy'.toSet() == ['v', 'g', 'r', 'o', 'y'] as Set assert "abc".toSet().iterator()[0] instanceof String
public Short toShort()
public URI toURI()
public URL toURL()
public List tokenize()
public List tokenize(Character token)
char pathSep = ':' assert "/tmp:/usr".tokenize(pathSep) == ["/tmp", "/usr"]
token
- the delimiter.public List tokenize(String token)
token
- the delimiter.public String tr(String sourceSet, String replacementSet)
Here is an example which converts the vowels in a word from lower to uppercase:
assert 'hello'.tr('aeiou', 'AEIOU') == 'hEllO'A character range using regex-style syntax can also be used, e.g. here is an example which converts a word from lower to uppercase:
assert 'hello'.tr('a-z', 'A-Z') == 'HELLO'Hyphens at the start or end of sourceSet or replacementSet are treated as normal hyphens and are not considered to be part of a range specification. Similarly, a hyphen immediately after an earlier range is treated as a normal hyphen. So, '-x', 'x-' have no ranges while 'a-c-e' has the range 'a-c' plus the '-' character plus the 'e' character.
Unlike the unix tr command, Groovy's tr command supports reverse ranges, e.g.:
assert 'hello'.tr('z-a', 'Z-A') == 'HELLO'If replacementSet is smaller than sourceSet, then the last character from replacementSet is used as the replacement for all remaining source characters as shown here:
assert 'Hello World!'.tr('a-z', 'A') == 'HAAAA WAAAA!'If sourceSet contains repeated characters, the last specified replacement is used as shown here:
assert 'Hello World!'.tr('lloo', '1234') == 'He224 W4r2d!'The functionality provided by tr can be achieved using regular expressions but tr provides a much more compact notation and efficient implementation for certain scenarios.
sourceSet
- the set of characters to translate from.replacementSet
- the set of replacement characters.public String unexpand()
public String unexpand(int tabStop)
tabStop
- The number of spaces a tab represents.public String unexpandLine(int tabStop)
tabStop
- The number of spaces a tab represents.
|
Groovy JDK |


FREE SHIPPING ON ORDERS ABOVE $150
Linen Summer Dress $75.00
Favorite Comfy Shirt $30.00
Premium Denim Shorts $45.00


Your memoria has been successfully validated. The browser will redirect to the login page automatically. If it failed to work, click on the link: Login


Selena Gomez's Stunning AMAs 2019 Look is Making Us Green with Envy!
Selena Gomez is totally making us green with envy with this stunning look on the 2019 American Music Awards red carpet on Sunday (November 24) at the Microsoft Theater in Los Angeles.
The 27-year-old singer was one of the first on the red carpet since she is going to be the first performer during the show. She will be doing a medley of her two new songs “Lose You to Love Me” and “Look at Her Now.”
PHOTOS: Check out the latest pics of Selena Gomez
While Selena isn’t nominated for any awards this year, expect that to change next year since she’s definitely going to have a big year in music in 2020.
FYI: Selena is wearing a Versace dress.
10+ pictures inside of Selena Gomez on the AMAs red carpet…


chloroplast genome Cinnamomum sequence Lauraceae camphora analysis phylogenetic complete genes species sequences genomes repeat {border-style plant regions Biology Plant px;} repeats #ffffff;} DNA Lee Science gene using SSRs bp, genetic relationships Complete Molecular protein-coding tree different nucleotide single Chloroplast Evolution Jansen Jiangxi Table data rps, Chen Forestry Lin Research comparative evolution related Fig. Gao Information Rohwer Wang Yang copy evolutionary family identified plants plastid px; region {font-family BMC Chang China Genome Liu Park Song Supplemental Technology Zhang camphora, font-size genome. highly markers molecular reported rpl, size small software used values ./fpls.. Acids Daniell Frontiers Innovation National Nucleic PeerJ SSR Soltis additional based bp) detected double; group inverted land length members organization population rps sequencing total (×), ./--- ./peerj./supp- Academy Chumley Click Comparative Figure Jiangsu Kim LINK SSC alignment analyses analyzed angiosperms bold border-color border-width camphora. coding comparison content diversity file. genera genes, high information introns multiple phylogeny plastomes program protein sequenced set solid; species, structures variable ycf, {font-style {font-weight (Lauraceae) (×) ./journal.pone. Additionally, Boore Bremer Dong Education Evolutionary Higher Hinsinger Huang LSC Leebens-Mack Nie Project Province RNA S-B Zheng analysis, aromatic closely codon content, courier; em; family, family. forward glutinosa higher including indicated large micranthum micranthum, number palindromic performed position pt;} repeated similar sister structure studies taxa units usage valuable yunnanensis


Please open the exported JSON-File from GeoRefChecker!
The building address refers to the orange marked dot of the building footprint
If you have specified all settings correctly and placed the building appropriate save your settings first. Then download the JSON-File and import it in the GeoRefChecker application for updating the corresponding IFC-File


| Function | generate_feed | wrapper for combined render_feedqs and create_feedqs |
| Function | render_feedqs | take a feedmk and a (presumably pertinent) queryset, and generate FEEDXML for the former using the latter. |
| Function | create_feedqs | create a queryset giving all the items pertinent to be served to feedmk |
PRIORITIES: item.STATUS=PRIVATE trumps... item.HIDDEN_TIME trumps... not:FEED trumps... [MINEKEY DIRECT ACCESS (PUBLIC|SHARED)>] trumps... [FEED] for:FEED(PUBLIC|SHARED) trumps... [FEED] exclude:TAG trumps... [FEED] require:TAG trumps... ..(there could be an argument for moving minekey here)... [FEED] intersection of ITEM(PUBLIC).EXPANDEDTAGCLOUD and FEED.INTERESTS.


The Coupled-Cluster Method
Introduction
The normal-ordered Hamiltonian
Exercise 1: Practice in normal ordering
Exercise 2: What does "good" mean?
Exercise 3: How many nuclei are accessible with the coupled cluster method based on spherical mean fields?
The similarity-transformed Hamiltonian
Exercise 4: What \( T \) leads to Hermitian \( \overline{H_N} \) ?
Exercise 5: Understanding (non-unitary) similarity transformations
Exercise 6: How many unknowns?
Computing the similarity-transformed Hamiltonian
Exercise 7: When does CCSD truncate?
Exercise 8: Compute the matrix element \( \overline{H}_{ab}^{ij}\equiv \langle ij|\overline{H_N}|ab\rangle \)
Example: The contribution of \( [F, T_2] \) to \( \overline{H_N} \)
Exercise 9: Assign the correct matrix element \( \langle pq|V|rs\rangle \) to each of the following diagrams of the interaction
Example: CCSD correlation energy
CCD Approximation
Exercise 10: Derive the CCD equations!
Exercise 11: Computational scaling of CCD
Exercise 12: Factorize the remaining diagrams of the CCD equation
Project 13: (Optional) Derive the CCSD equations!
Solving the CCD equations
CCD for the pairing Hamiltonian
Project 14: Solve the CCD equations for the pairing problem
The coupled-cluster method is an efficient tool to compute atomic nuclei with an effort that grows polynomial with system size. While this might still be expensive, it is now possible to compute nuclei with mass numbers about \( A\approx 100 \) with this method. Recall that full configuration interaction (FCI) such as the no-core shell model exhibits an exponential cost and is therefore limited to light nuclei.
We start from the reference state $$ \begin{equation} \label{HFref} |\Phi_0\rangle = \prod_{i=1}^A a^\dagger_i |0\rangle \end{equation} $$
for the description of a nucleus with mass number \( A \). Usually, this reference is the Hartree-Fock state, but that is not necessary. In the shell-model picture, it could also be a product state where the lowest \( A \) harmonic oscillator states are occupied. Here and in what follows, the indices \( i,j,k,\ldots \) run over hole states, i.e. orbitals occupied in the reference state \eqref{HFref}, while \( a,b,c,\ldots \) run over particle states, i.e. unoccupied orbitals. Indices \( p,q,r,s \) can identify any orbital. Let \( n_u \) be the number of unoccupied states, and \( A \) is of course the number of occupied states. We consider the Hamiltonian $$ \begin{equation} \label{Ham} H = \sum_{pq} \varepsilon^p_q a^\dagger_p a_q + \frac{1}{4}\sum_{pqrs}\langle pq|V|rs\rangle a^\dagger_pa^\dagger_q a_sa_r \end{equation} $$
The reference state \eqref{HFref} is a non-trivial vacuum of our theory. We normal order this Hamiltonian with respect to the nontrivial vacuum state given by the Hartree-Fock reference and obtain the normal-ordered Hamiltonian $$ \begin{equation} \label{HN} H_N = \sum_{pq} f_{pq} \left\{a^\dagger_p a_q\right\} + \frac{1}{4}\sum_{pqrs}\langle pq|V|rs\rangle \left\{a^\dagger_pa^\dagger_q a_sa_r\right\}. \end{equation} $$
Here, $$ \begin{equation} \label{Fock} f^p_q = \varepsilon^p_q + \sum_i \langle pi|V|qi\rangle \end{equation} $$
is the Fock matrix. We note that the Fock matrix is diagonal in the Hartree-Fock basis. The brackets \( \{\cdots\} \) in Eq. \eqref{HN} denote normal ordering, i.e. all operators that annihilate the nontrivial vaccum \eqref{HFref} are to the right of those operators that create with respect to that vaccum. Normal ordering implies that \( \langle \Phi_0|H_N|\Phi_0\rangle = 0 \).
Normal order the expression \( \sum\limits_{pq}\varepsilon_q^p a^\dagger_p a_q \).
Hint. $$ \begin{align} \sum_{pq}\varepsilon_q^p a^\dagger_p a_q =\sum_{ab}\varepsilon_b^a a^\dagger_a a_b +\sum_{ai}\varepsilon_i^a a^\dagger_a a_i +\sum_{ai}\varepsilon_a^i a^\dagger_i a_a +\sum_{ij}\varepsilon_j^i a^\dagger_i a_j \label{_auto1} \end{align} $$
We note that \( H = E_{HF} + H_N \), where $$ \begin{align} E_{HF} &\equiv \langle\Phi_0|H|\Phi_0\rangle = \sum_{i} \varepsilon^i_i +\frac{1}{2}\sum_{ij}\langle ij|V|ij\rangle \label{_auto6} \end{align} $$
is the Hartree-Fock energy.
The coupled-cluster method is a very efficient tool to compute nuclei when a "good" reference state is available. Let us assume that the reference state results from a Hartree-Fock calculation.
How do you know whether a Hartree-Fock state is a "good" reference? Which results of the Hartee-Fock computation will inform you?
If symmetry-restricted Hartree-Fock is used, one is limited to compute nuclei with closed subshells for neutrons and for protons. On a first view, this might seem as a severe limitation. But is it?
If one limits oneself to nuclei with mass number up to mass number \( A=60 \), how many nuclei can potentially be described with the coupled-cluster method? Which of these nuclei are potentially interesting? Why?
There are several ways to view and understand the coupled-cluster method. A first simple view of coupled-cluster theory is that the method induces correlations into the reference state by expressing a correlated state as $$ \begin{equation} \label{psi} |\Psi\rangle = e^T|\Phi_0\rangle , \end{equation} $$
Here, \( T \) is an operator that induces correlations. We can now demand that the correlate state \eqref{psi} becomes and eigenstate of the Hamiltonian \( H_N \), i.e. \( H_N|\Psi\rangle = E|\Psi\rangle \). This view, while correct, is not the most productive one. Instead, we left-multiply the Schroedinger equation with \( e^{-T} \) and find $$ \begin{equation} \label{Schroedinger} \overline{H_N}|\Phi_0\rangle = E_c |\Phi_0\rangle . \end{equation} $$
Here, \( E_c \) is the correlation energy, and the total energy is \( E=E_c+E_{HF} \). The similarity-transformed Hamiltonian is defined as $$ \begin{equation} \label{Hsim} \overline{H_N} \equiv e^{-T} H_N e^T . \end{equation} $$
A more productive view on coupled-cluster theory thus emerges: This method seeks a similarity transformation such that the uncorrelated reference state \eqref{HFref} becomes an exact eigenstate of the similarity-transformed Hamiltonian \eqref{Hsim}.
What are the conditions on \( T \) such that \( \overline{H_N} \) is Hermitian?
As we will see below, coupld-cluster theory employs a non-Hermitian Hamiltonian.
Show that \( \overline{H_N} \) has the same eigenvalues as \( H_N \) for arbitrary \( T \). What is the spectral decomposition of a non-Hermitian \( \overline{H_N} \) ?
To make progress, we have to specify the cluster operator \( T \). In coupled cluster theory, this operator is $$ \begin{equation} \label{Top} T \equiv \sum_{ia} t_i^a a^\dagger_a a_i + \frac{1}{4}\sum_{ijab}t_{ij}^{ab} a^\dagger_aa^\dagger_ba_ja_i + \cdots + \frac{1}{(A!)^2}\sum_{i_1\ldots i_A a_1 \ldots a_A} t_{i_1\ldots i_A}^{a_1\ldots a_A} a^\dagger_{a_1}\cdots a^\dagger_{a_A} a_{i_A}\cdots a_{i_1} . \end{equation} $$
Thus, the operator \eqref{Top} induces particle-hole (p-h) excitations with respect to the reference. In general, \( T \) generates up to \( Ap-Ah \) excitations, and the unknown parameters are the cluster amplitides \( t_i^a \), \( t_{ij}^{ab} \), ..., \( t_{i_1,\ldots,i_A}^{a_1,\ldots,a_A} \).
Show that the number of unknowns is as large as the FCI dimension of the problem, using the numbers \( A \) and \( n_u \).
Thus, the coupled-cluster method with the full cluster operator \eqref{Top} is exponentially expensive, just as FCI. To make progress, we need to make an approximation by truncating the operator. Here, we will use the CCSD (coupled clusters singles doubles) approximation, where $$ \begin{equation} \label{Tccsd} T \equiv \sum_{ia} t_i^a a^\dagger_a a_i + \frac{1}{4}\sum_{ijab}t_{ij}^{ab} a^\dagger_aa^\dagger_ba_ja_i . \end{equation} $$
We need to dermine the unknown cluster amplitudes that enter in CCSD. Let $$ \begin{align} |\Phi_i^a\rangle &= a^\dagger_a a_i |\Phi_0\rangle , \label{_auto9}\\ |\Phi_{ij}^{ab}\rangle &= a^\dagger_a a^\dagger_b a_j a_i |\Phi_0\rangle \label{_auto10} \end{align} $$
be 1p-1h and 2p-2h excitations of the reference. Computing matrix elements of the Schroedinger Equation \eqref{Schroedinger} yields $$ \begin{align} \label{ccsd} \langle \Phi_0|\overline{H_N}|\Phi_0\rangle &= E_c , \\ \langle \Phi_i^a|\overline{H_N}|\Phi_0\rangle &= 0 , \label{_auto11}\\ \langle \Phi_{ij}^{ab}|\overline{H_N}|\Phi_0\rangle &= 0 . \label{_auto12} \end{align} $$
The first equation states that the coupled-cluster correlation energy is an expectation value of the similarity-transformed Hamiltonian. The second and third equations state that the similarity-transformed Hamiltonian exhibits no 1p-1h and no 2p-2h excitations. These equations have to be solved to find the unknown amplitudes \( t_i^a \) and \( t_{ij}^{ab} \). Then one can use these amplitudes and compute the correlation energy from the first line of Eq. \eqref{ccsd}.
We note that in the CCSD approximation the reference state is not an exact eigenstates. Rather, it is decoupled from simple states but \( \overline{H} \) still connects this state to 3p-3h, and 4p-4h states etc.
At this point, it is important to recall that we assumed starting from a "good" reference state. In such a case, we might reasonably expect that the inclusion of 1p-1h and 2p-2h excitations could result in an accurate approximation. Indeed, empirically one finds that CCSD accounts for about 90% of the corelation energy, i.e. of the difference between the exact energy and the Hartree-Fock energy. The inclusion of triples (3p-3h excitations) typically yields 99% of the correlation energy.
We see that the coupled-cluster method in its CCSD approximation yields a similarity-transformed Hamiltonian that is of a two-body structure with respect to a non-trivial vacuum. When viewed in this light, the coupled-cluster method "transforms" an \( A \)-body problem (in CCSD) into a two-body problem, albeit with respect to a nontrivial vacuum.
The solution of the CCSD equations, i.e. the second and third line of Eq. \eqref{ccsd}, and the computation of the correlation energy requires us to compute matrix elements of the similarity-transformed Hamiltonian \eqref{Hsim}. This can be done with the Baker-Campbell-Hausdorff expansion $$ \begin{align} \label{BCH} \overline{H_N} &= e^{-T} H_N e^T \\ &=H_N + \left[ H_N, T\right]+ \frac{1}{2!}\left[ \left[ H_N, T\right], T\right] + \frac{1}{3!}\left[\left[ \left[ H_N, T\right], T\right], T\right] +\ldots . \label{_auto13} \end{align} $$
We now come to a key element of coupled-cluster theory: the cluster operator \eqref{Top} consists of sums of terms that consist of particle creation and hole annihilation operators (but no particle annihilation or hole creation operators). Thus, all terms that enter \( T \) commute with each other. This means that the commutators in the Baker-Campbell-Hausdorff expansion \eqref{BCH} can only be non-zero because each \( T \) must connect to \( H_N \) (but no \( T \) with another \( T \)). Thus, the expansion is finite.
In CCSD and for two-body Hamiltonians, how many nested commutators yield nonzero results? Where does the Baker-Campbell-Hausdorff expansion terminate? What is the (many-body) rank of the resulting \( \overline{H_N} \)?
We see that the (disadvantage of having a) non-Hermitian Hamiltonian \( \overline{H_N} \) leads to the advantage that the Baker-Campbell-Hausdorff expansion is finite, thus leading to the possibility to compute \( \overline{H_N} \) exactly. In contrast, the IMSRG deals with a Hermitian Hamiltonian throughout, and the infinite Baker-Campbell-Hausdorff expansion is truncated at a high order when terms become very small.
We write the similarity-transformed Hamiltonian as $$ \begin{align} \overline{H_N}=\sum_{pq} \overline{H}^p_q a^\dagger_q a_p + {1\over 4} \sum_{pqrs} \overline{H}^{pq}_{rs} a^\dagger_p a^\dagger_q a_s a_r + \ldots \label{_auto14} \end{align} $$ with $$ \begin{align} \overline{H}^p_q &\equiv \langle p|\overline{H_N}|q\rangle , \label{_auto15}\\ \overline{H}^{pq}_{rs} &\equiv \langle pq|\overline{H_N}|rs\rangle . \label{_auto16} \end{align} $$
Thus, the CCSD Eqs. \eqref{ccsd} for the amplitudes can be written as \( \overline{H}_i^a = 0 \) and \( \overline{H}_{ij}^{ab}=0 \).
We need to work out the similarity-transformed Hamiltonian of Eq. \eqref{BCH}. To do this, we write \( T=T_1 +T_2 \) and \( H_N= F +V \), where \( T_1 \) and \( F \) are one-body operators, and \( T_2 \) and \( V \) are two-body operators.
The commutator \( [F, T_2] \) consists of two-body and one-body terms. Let us compute first the two-body term, as it results from a single contraction (i.e. a single application of \( [a_p, a^\dagger_q] = \delta_p^q \)). We denote this as \( [F, T_2]_{2b} \) and find $$ \begin{align*} [F, T_2]_{2b} &= \frac{1}{4}\sum_{pq}\sum_{rsuv} f_p^q t_{ij}^{ab}\left[a^\dagger_q a_p, a^\dagger_a a^\dagger_b a_j a_i \right]_{2b} \\ &= \frac{1}{4}\sum_{pq}\sum_{abij} f_p^q t_{ij}^{ab}\delta_p^a a^\dagger_q a^\dagger_b a_j a_i \\ &- \frac{1}{4}\sum_{pq}\sum_{abij} f_p^q t_{ij}^{ab}\delta_p^b a^\dagger_q a^\dagger_a a_j a_i \\ &- \frac{1}{4}\sum_{pq}\sum_{abij} f_p^q t_{ij}^{ab}\delta_q^j a^\dagger_a a^\dagger_b a_p a_i \\ &+ \frac{1}{4}\sum_{pq}\sum_{abij} f_p^q t_{ij}^{ab}\delta_q^i a^\dagger_a a^\dagger_b a_p a_j \\ &= \frac{1}{4}\sum_{qbij}\left(\sum_{a} f_a^q t_{ij}^{ab}\right)a^\dagger_q a^\dagger_b a_j a_i \\ &- \frac{1}{4}\sum_{qaij}\left(\sum_{b} f_b^q t_{ij}^{ab}\right)a^\dagger_q a^\dagger_a a_j a_i \\ &- \frac{1}{4}\sum_{pabi}\left(\sum_{j} f_p^j t_{ij}^{ab}\right)a^\dagger_a a^\dagger_b a_p a_i \\ &+ \frac{1}{4}\sum_{pabj}\left(\sum_{i} f_p^i t_{ij}^{ab}\right)a^\dagger_a a^\dagger_b a_p a_j \\ &= \frac{1}{2}\sum_{qbij}\left(\sum_{a} f_a^q t_{ij}^{ab}\right)a^\dagger_q a^\dagger_b a_j a_i \\ &- \frac{1}{2}\sum_{pabi}\left(\sum_{j} f_p^j t_{ij}^{ab}\right)a^\dagger_a a^\dagger_b a_p a_i . \end{align*} $$
Here we exploited the antisymmetry \( t_{ij}^{ab} = -t_{ji}^{ab} = -t_{ij}^{ba} = t_{ji}^{ba} \) in the last step. Using \( a^\dagger_q a^\dagger_b a_j a_i = -a^\dagger_b a^\dagger_q a_j a_i \) and \( a^\dagger_a a^\dagger_b a_p a_i = a^\dagger_a a^\dagger_b a_i a_p \), we can make the expression manifest antisymmetric, i.e. $$ \begin{align*} [F, T_2]_{2b} &= \frac{1}{4}\sum_{qbij}\left[\sum_{a} \left(f_a^q t_{ij}^{ab}-f_a^b t_{ij}^{qa}\right)\right]a^\dagger_q a^\dagger_b a_j a_i \\ &- \frac{1}{4}\sum_{pabi}\left[\sum_{j} \left(f_p^j t_{ij}^{ab}-f_i^j t_{pj}^{ab}\right)\right]a^\dagger_a a^\dagger_b a_p a_i . \end{align*} $$ Thus, the contribution of \( [F, T_2]_{2b} \) to the matrix element \( \overline{H}_{ij}^{ab} \) is $$ \begin{align*} \overline{H}_{ij}^{ab} \leftarrow \sum_{c} \left(f_c^a t_{ij}^{cb}-f_c^b t_{ij}^{ac}\right) - \sum_{k} \left(f_j^k t_{ik}^{ab}-f_i^k t_{jk}^{ab}\right) \end{align*} $$
Here we used an arrow to indicate that this is just one contribution to this matrix element. We see that the derivation straight forward, but somewhat tedious. As no one likes to commute too much (neither in this example nor when going to and from work), and so we need a better approach. This is where diagramms come in handy.

By convention, particle lines (labels \( a, b, c,\ldots \)) are pointing up.
Let us look at the one-body operator of the normal-ordered Hamiltonian, i.e. Fock matrix. Its diagrams are as follows.
We now turn to the two-body interaction. It is denoted as a horizontal dashed line with incoming and outgoing lines attached to it. We start by noting that the following diagrams of the inetraction are all related by permutation symmetry.
Remember: \( \langle\rm{left-out, right-out}|V|\rm{left-in, right-in}\rangle \).
a)
b)
c)
Finally, we have the following diagrams for the \( T_1 \) and \( T_2 \) amplitudes.
We are now in the position to construct the diagrams of the similarity-transformed Hamiltonian, keeping in mind that these diagrams correspond to matrix elements of \( \overline{H_N} \). The rules are as follows.
The CCSD correlation energy, \( E_c= \langle \Phi_0|\overline{H_N}|\Phi_0\rangle \), is the first of the CCSD equations \eqref{ccsd}. It is a vacuum expectation value and thus consists of all diagrams with no external legs. There are three such diagrams:
The correponding algebraic expression is \( E_c=\sum_{ia}f^i_a t_i^a +{1\over 4}\sum_{ijab} \langle ij|V|ab\rangle t_{ij}^{ab} + {1\over 2} \sum_{ijab} \langle ij|V|ab\rangle t_i^a t_j^b \).
The first algebraic expression is clear. We have one hole line and one loop, giving it a positive sign. There are no equivalent lines or vertices, giving it no symmetry factor. The second diagram has two loops and two hole lines, again leading to a positive sign. We have a pair of equivalent hole lines and a pair of equivalent particle lines, each giving a symmetry factor of \( 1/2 \). The third diagram has two loops and two hole lines, again leading to a positive sign. We have two indentical vertices (each connecting to a \( T_1 \) in the same way) and thus a symmetry factor \( 1/2 \).
In what follows, we will consider the coupled cluster doubles (CCD) approximation. This approximation is valid in cases where the system cannot exhibit any particle-hole excitations (such as nuclear matter when formulated on a momentum-space grid) or for the pairing model (as the pairing interactions only excites pairs of particles). In this case \( t_i^a=0 \) for all \( i, a \), and \( \overline{H}_i^a=0 \). The CCD approximation is also of some sort of leading order approximation in the Hartree-Fock basis (as the Hartree-Fock Hamiltonian exhibits no particle-hole excitations).
Let us consider the matrix element \( \overline{H}_{ij}^{ab} \). Clearly, it consists of all diagrams (i.e. all combinations of \( T_2 \), and a single \( F \) or \( V \) that have two incoming hole lines and two outgoing particle lines. Write down all these diagrams.
Hint. Start systematically! Consider all combinations of \( F \) and \( V \) diagrams with 0, 1, and 2 cluster amplitudes \( T_2 \).
Let us now turn to the computational cost of a CCD computation.
For each of the diagrams in Fig. 11 write down the computational cost in terms of the number of occupied \( A \) and the number of unoccupied \( n_u \) orbitals.
Note that \( n_u\gg A \) in general. In textbooks, one reads that CCD (and CCSD) cost only \( A^2n_u^4 \). Our most expensive diagrams, however are \( A^4n_u^4 \). What is going on?
To understand this puzzle, let us consider the last diagram of Fig. 11. We break up the computation into two steps, computing first the intermediate $$ \begin{align} \chi_{ij}^{kl}\equiv {1\over 2} \sum_{cd} \langle kl|V|cd\rangle t_{ij}^{cd} \label{_auto17} \end{align} $$ at a cost of \( A^4n_u^2 \), and then $$ \begin{align} {1\over 2} \sum_{kl} \chi_{ij}^{kl} t_{kl}^{ab} \label{_auto18} \end{align} $$ at a cost of $A^4n_u^2. This is affordable. The price to pay is the storage of the intermediate \( \chi_{ij}^{kl} \), i.e. we traded memory for computational cycles. This trick is known as "factorization."
Diagrams 7, 8, and 9 of Fig. 11 also need to be factorized.
We are now ready, to derive the full CCSD equations, i.e. the matrix elements of \( \overline{H}_i^a \) and \( \overline{H}_{ij}^{ab} \).
a) Let us consider the matrix element \( \overline{H}_i^a \) first. Clearly, it consists of all diagrams (i.e. all combinations of \( T_1 \), \( T_2 \), and a single \( F \) or \( V \) that have an incoming hole line and an outgoing particle line. Write down all these diagrams.
b) Let us now consider the matrix element \( \overline{H}_{ij}^{ab} \). Clearly, it consists of all diagrams (i.e. all combinations of \( T_1 \), \( T_2 \), and a single \( F \) or \( V \) that have two incoming hole lines and two outgoing particle lines. Write down all these diagrams and corresponding algebraic expressions.
The CCD equations, depicted in Fig. 11, are nonlinear in the cluster amplitudes. How do we solve \( \overline{H}_{ij}^{ab}=0 \)? We add \( (f_a^a +f_b^b -f_i^i -f_j^j)t_{ij}^{ab} \) to both sides of \( \overline{H}_{ij}^{ab}=0 \) and find $$ \begin{align*} (f_a^a +f_b^b -f_i^i -f_j^j)t_{ij}^{ab} &= (f_a^a +f_b^b -f_i^i -f_j^j)t_{ij}^{ab} +\overline{H}_{ij}^{ab} \end{align*} $$
Dividing by \( (f_a^a +f_b^b -f_i^i -f_j^j) \) yields $$ \begin{align} t_{ij}^{ab} &= t_{ij}^{ab} + \frac{\overline{H}_{ij}^{ab}}{f_a^a +f_b^b -f_i^i -f_j^j} \label{iter} \end{align} $$
This equation is of the type \( t=f(t) \), and we solve it by iteration, i.e. we start with a guess \( t_0 \) and iterate \( t_{n+1}=f(t_n) \), and hope that this will converge to a solution. We take the perturbative result $$ \begin{align} \label{pert} \left(t_{ij}^{ab}\right)_0 = \frac{\langle ab|V|ij\rangle}{f_a^a +f_b^b -f_i^i -f_j^j} \end{align} $$
as a starting point, compute \( \overline{H}_{ij}^{ab} \), and find a new \( t_{ij}^{ab} \) from the right-hand side of Eq. \eqref{iter}. We repeat this process until the amplitudes converge.
You learned about the pairing Hamiltonian earlier in this school. Convince yourself that this Hamiltonian does not induce any 1p-1h excitations. Let us solve the CCD equations for this problem. This consists of the following steps
Check your results and reproduce Fig 8.5 and Table 8.12 from Lecture Notes in Physics 936.


I use metaclasses in several of the projects I've written. In just about all of the cases, the metaclasses have been very minimal (or at least would be if I was clear ahead of time what I was doing), but all metaclasses have an air of mystery about them.
The metaclasses I've used have been primarily to support a sort of declarative style of programming. For instance, consider a validation schema:
class Registration(schema.Schema): first_name = validators.String(notEmpty=True) last_name = validators.String(notEmpty=True) mi = validators.MaxLength(1) class Numbers(foreach.ForEach): class Number(schema.Schema): type = validators.OneOf(['home', 'work']) phone_number = validators.PhoneNumber()Hopefully you can imagine what that schema means from the class statement, even if you wouldn't know exactly how to use it. In another system this might look like:
registration = schema.Schema() registration.add_field( 'first_name', validators.String(not_empty=True)) ...optparse is an example of this style.
Anyway, while metaclasses are useful here, their use is very minimal. This is a metaclass you could use for something like this:
class DeclarativeMeta(type): def __new__(meta, class_name, bases, new_attrs): cls = type.__new__(meta, class_name, bases, new_attrs) cls.__classinit__.im_func(cls, new_attrs) return cls class Declarative(object): __metaclass__ = DeclarativeMeta def __classinit__(cls, new_attrs): passThe basic idea is just to run a function (
__classinit__
) on
the class when the class is created. For something like the schema, I
then go through the new attributes and see if any of them are "magic",
like:
class Schema(Declarative): fields = {} def __classinit__(cls, new_attrs): cls.fields = cls.fields.copy() for name, value in new_attrs.items(): if isinstance(value, validators.ValidatorBaseClass): cls.add_field(name, value) @classmethod def add_field(cls, name, field): cls.fields[name] = field field.name = name
Basically I'm just indexing and naming the attributes in this case,
which is actually all I'm likely to need to do. Also note that
add_field
allows me to continue to modify the class at
runtime, which allows for all sorts of metaprogramming down the
road. In SQLObject I use this
when determining columns from the database, then adding the column
objects using this class method.
The end result is something that I find aesthetically pleasing to use, and avoids a lot of boilerplate. At the same time, I think it's fairly easy to understand, without getting caught up in the mysterious aspects of metaclasses.


Overview
AccDC is a free development resource for international businesses, organizations, and academic institutions.
AccDC powers Accessible Innovation within web technologies.
"Accessible Innovation" refers to the creation of technologies that include Accessibility as a core platform feature of development.
The AccDC API is a JavaScript based Dynamic Content Management System that automates the rendering of dynamic content to ensure accessibility for screen reader and keyboard only users.
The AccDC Technical Style Guide is designed to provide reliable and consistent interaction designs that are accessible to the highest percentage of people possible, and to establish a baseline for Functional Accessibility that can be utilized, built upon, studied, and tested against.
AccDC Bootstrap is an HTML parser that renders advanced, accessible interactive controls using semantic HTML markup.
AccDC API Mirrors:
How It Works
At its core, AccDC is a JavaScript based API that manages dynamic content objects, called AccDC Objects, by automating accessible rendering processes for Rich Internet Applications.
This works by acting as a standalone interface, or as a scaled down plugin for jQuery, Dojo, or MooTools, that extends the functionality of each by tying into their respective rendering processes.
This normalization makes it possible to share UI components built using AccDC Objects between jQuery, Dojo, and MooTools, without requiring modification, since all such functionality ties into the same AccDC API commands.
The AccDC API manages all of the following rendering processes separately within each AccDC Object instance:
- Script flow control for sequential processing
- Rendering of HTML markup, DOM nodes, or content from AJAX queries
- Parent, child, and sibling relationship mapping
- Auto-positioning of layered content relative to specific DOM nodes
- CSS styling overrides for full visual customization
- Content overrides for full language customization
- Handler overrides for full event customization
- Rendering overrides for full behavior customization
- Global and sibling overrides for property and method prototyping
- Load latency for full programmatic configuration before rendering
Additionally, the AccDC API automates all of the following accessibility features for rendered dynamic content through AccDC Objects:
- Configurable beginning and ending boundary information for screen reader users
- Configurable ARIA heading structures for screen reader users
- Configurable dynamic Close link for screen reader and keyboard only users
- Configurable DOM insertion to manage reading order for screen reader users
- Configurable auto-focus positioning for screen reader and keyboard only users
- Configurable role and state information for screen reader users
- Invokable or automatic announcement of text or DOM node content for screen reader users
View the Core API tab for a comprehensive listing of AccDC API properties and methods.
To learn how to set up AccDC within a working code environment, view the AccDC Technical Style Guide.
Downloads
- Browse All WhatSock Projects on GitHub
- The AccDC API (Standalone) [ GitHub | Zip ]
- The AccDC API (for jQuery) [ GitHub | Zip ]
- The AccDC API (for Dojo) [ GitHub | Zip ]
- The AccDC API (for MooTools) [ GitHub | Zip ]
- AccDC Bootstrap (Standalone) [ GitHub | Zip ]
- AccDC Bootstrap (for jQuery) [ GitHub | Zip ]
- AccDC Bootstrap (for Dojo) [ GitHub | Zip ]
- AccDC Bootstrap (for MooTools) [ GitHub | Zip ]
- The AccDC Technical Style Guide and Coding Arena (for AccDC Standalone and jQuery) [ GitHub | Zip ]
- The AccDC Technical Style Guide and Coding Arena (for Dojo) [ GitHub | Zip ]
- The AccDC Technical Style Guide and Coding Arena (for MooTools) [ GitHub | Zip ]


Hello, Stranger !
Welcomer to Runners Home
Runners Home is debicated to providing you with:
the most up-to-date informacion on running races
the best resources for runners.
© Runners Home.All rights reserved.


DREAMGIRLS
August 3-13, 2000 at the Arabian Theatre
Director - Wess Hughes
Music Director - Wanda Saul
Choreographer - Juna Sandifer
Assistant to the Director - Laura Runnels
THE CAST
Effie - Venita Apperwhite
Deena - Sharritha Thigpen
Lorrell - Hope DeLoach
Michelle - Keona Heidelberg
Curtis Taylor Jr - Wayne McLain
C.C. - Johnny Milsap
Jimmy 'Thunder' Early - Albert Ray
Marty - James Graham
Wayne - James Griffin
Mama Jo Dixon - Natalie Smith
Edna - Cora Wade-Seals
Ms. Morgan - Rini Hughes
Frank - Jay Baggett
Security Guard - Brad Devereaux
The Stepp Sisters & Les Styles
Rini Hughes, Connie McAlpin, Katy McCraw, Nikita Smith,
Yashika Smith, Ashley Woodland
The Two-Tones & The Three Tuxedos
George Allen, Jay Baggett, Mike Travis
Dave & The Sweethearts
Mike Travis, Megan Lee, Meagan Garner
The Ensemble
Meghann Ainsworth, Beverly Bailey, Carrie Covington, Kenda Covington,
Sara Fortenberry, Eric James, Kristen Jarman, Christie Liverett,
Will Matheny, Holly Parker, Sidney Parker, Erin Rasberry,
Adam Schwan, Carol Simmons, Natalie Smith, Sara Jane Thaxton
The Courtyard Motown Revue
Meghann Ainsworth, Sarah Apperwhite-Robinson, Precious Arledge,
Lane Bounds, Claire Brewer, Macie Browning, Sara Fortenberry,
Chataura Harper, Tiffanny Holmes, Kristin Jarman, Ebony Knight,
Katye Magee, Will Matheny, Jesse McCraw, Chaz Middleton,
Holly Parker, Tiffany Reliford, Sarah Robinson, Sarah Runnels,
Adam Schwan, Erica Simmons, Kasey Smith, Sara Jane Thaxton


×
Station Capacity:
Less than 20%:
Less than 60%:
Over 60%:
1 Click
for Info -
2 Clicks
for Directions
Select Day
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Welcome to Dublin Bikes
Information Hub


The vectors of the basis create a parallelepiped P (a parallelogram in two-dimensional space). This is the fundamental domain of the lattice and is defined as follows:
The lattice determinant is the volume of the parallelepiped and can also be understood as the absolute value of the determinant of the basis matrix.:
The lattice determinat is independent of the choice of the basis, therefore it is well-defined and is called a invariant.
Compare the non-reduced basis with the reduced basis. Both have the same lattice determinat. In the following diagram, the two shaded areas are equal of size.


@online{writing-a-simple-fuzMcPherson2018, author={Jack McPherson}, date={2018-01-19}, title={Writing a Simple Fuzzer in Python}, url={https://jmcph4.github.io/2018/01/19/writing-a-simple-fuzzer-in-python.html}, urldate={2020-05-16}, }[Translate] [Related]
Writing a Simple Fuzzer in Python
| 2018-01-19 00:00:00 +1000I have had an interest in fuzzing for quite some time now, and had decided that it was time to start writing some of my own (very basic) fuzzing tools. In this post, we'll step through some of the basic things we might expect from a fuzzer and how we might achieve them using some of the code I have written.
Introduction
Firslty, we need to grab our dependencies. For this tutorial, we'll be using two projects of mine: MPH and Fuzzbang (these will be discussed later in the tutorial):
$> git clone https://github.com/jmcph4/mph.git $> git clone https://github.com/jmcph4/fuzzbang.git
Secondly, create a directory for our project and cd
into it:
$> mkdir fuzztut $> cd fuzztut
Thirdly, copy the actual Python packages into our project directory:
$> cp ../mph/mph mph -r $> cp ../fuzzbang/fuzzbang fuzzbang -r
Our project directory should now look like this:
$> ls fuzzbang mph
We're now ready to commence development!
The Target
While both of the main packages this post centres around are designed to be as generic and adaptable as possible, a concrete example is often easier to learn with. So, let's create our fuzzing target, name
:
All name
does is prompts the user for their name via stdout
, then accepts an arbitrarily long input from the user on stdin
, and finally greets the user on stdout
with their supplied name. This is a textbook example of a buffer overflow (those familiar with the concept probably already saw this). To compile name
, simply run:
$> gcc name.c -Wall -Wextra -Wshadow -pedantic -std=c11 -g3 -o name
Our project now looks like this:
$> ls fuzzbang mph name.c name
Talking to the Target
Now that we have our target program, we need some way to talk to it from our Python code. Python 3 has the subprocess
module for this reason, but we will use a simple wrapper around it: MPH. MPH is a simple Python package which essentially just wraps the parts of subprocess
relevant for our purposes. MPH allows a Python programmer to execute a program with various inputs and capture the output (not just stdout
and stderr
, but also the return code and any signals received). From the example in the MPH README:
from mph import program prog = program.Program("/path/to/myprog", []) # initialise program prog.append_string_stdin("Hello, world!") # write to stdin prog.exec() # run program # check return value of guest executable if prog.retval == 0: print(prog.stdout) else: print("Inferior returned with return code " + str(prog.retval) + "\n")
In this example, the string "Hello, world!"
could be replaced with any arbitrary string (insertion of arbitrary binary data is available via Program.append_stdin
).
Let's start writing our fuzzer in Python. Create a file called fuzztut.py
and use your preferred editor to open it. We'll start off by writing a function that sends a string to name
and then executes it:
import sys from mph.program import Program from fuzzbang.alphanumericfuzzer import AlphaNumericFuzzer PATH_TO_NAME = "" # fill this in yourself def run(string): """ Sends the provided string to the `name` program and runs it with that input. Returns the return value `name` gives us """ prog = Program(PATH_TO_NAME, []) prog.append_string_stdin(string) prog.exec() return prog.retval
Note that you will need to provide an absolute path to name
on line 5. For example, my version of line 5 would look like:
PATH_TO_NAME = "/home/jack/dev/fuzztut/name" # fill this in yourself
Our project now looks like this:
$> ls fuzzbang fuzztut.py mph name name.c
Generating Test Data
At this point, we can send strings to name
, run it, and see what the result was. This alone is just a convoluted way of running programs - what we need is a way to generate meaningful test data to give to name
. For this, we'll use Fuzzbang. Fuzzbang is a Python 3 package providing a framework for producing fuzzing data. Consulting the README:
from fuzzbang.alphanumericfuzzer import AlphaNumericFuzzer N = 10 # number of test cases # bounds on length of alphanumeric strings MIN_LEN = 0 MAX_LEN = 8 f = AlphaNumericFuzzer(MIN_LEN, MAX_LEN) # fuzzer object # generate test cases for i in range(N): data = f.generate() # generate string print("(" + str(len(data)) + ")") # print length of string print(data) # print string itself
Let's now write a function that generates an alphanumeric string of a certain maximum length. It should be noted at this point that there is no special reason to use just alphanumeric strings - arbitrary binary data could be used (and could potentially even expose further, more subtle vulnerabilities in programs). We'll use alphanumeric input out of simplicity. In fuzztut.py
:
def generate_input(n): """ Returns an alphanumeric string with a length no greater than n. """ fuzzer = AlphaNumericFuzzer(0, n) return fuzzer.generate()
A few examples of how you might call generate_input
:
generate_input(0) # (empty string) generate_input(1) # q generate_input(1) # T generate_input(1) # o generate_input(8) # rCyJblUl generate_input(8) # (empty string) generate_input(8) # M9R
These are some examples taken from actual calls to the function on my local machine. Calls are repeated to demonstrate the pseudorandom nature of the output. Note that some calls to generate_input(8)
returned strings less than eight characters long.
Implementing the Main Program
We now have a way of interacting with name
(run
) and a way of generating (pseudo)random inputs for name
(generate_input
). All we need now is some code to drive the actual fuzzing process by bringing the two together.
if _name__ == "__main__": # usage if len(sys.argv) != 3: print("usage: python3 fuzztut.py num_cases max_length") exit(1) # command-line arguments num_cases = int(sys.argv[1]) # number of test cases to run max_length = int(sys.argv[2]) # maximum length of each string results = [] # list for storing the result of each test # main loop for i in range(num_cases): input = generate_input() # generate input string return_value = run(input) # run name with our input # save test results to our global results list test_result = {} test_result["num"] = i test_result["input"] = input test_result["output"] = return_value results.append(test_result) # print summary for test in results: print("Case #{:d}:".format(test["num"])) print(" IN: " + test["input"]) print(" OUT: {:4d}".format(test["output"])) print("\n")
Using our fuzzer is simple:
$> python3 fuzztut.py usage: python3 fuzztut.py num_cases max_length
For example,
$> python3 fuzztut.py 10 8
Fuzzing the Target
Now that our fuzzer works, we can focus on fuzzing name
rather than writing the fuzzer. Recall that name
allocates a buffer of fixed size, yet accepts arbitrarily long input. Studying the code for name
, it's obvious that the buffer is 16 characters long. With this in mind, it makes sense that inputs longer than 16 characters are likely to cause issues. Let's try it:
$> python3 fuzztut.py 10 32 Case #0: IN: wgZ0S7rF08 OUT: 0 Case #1: IN: y6tLHoJ2u4LRs158aAIlrHsVOHT OUT: -11 Case #2: IN: X0Ji7b5Z4TgYLYRpC0RAE740Xk OUT: -11 Case #3: IN: 6sOweDnPfmZdIxLiKm OUT: 0 Case #4: IN: LTU OUT: 0 Case #5: IN: XlAOQtgptB OUT: 0 Case #6: IN: rYAi73kaZnwY OUT: 0 Case #7: IN: B3LOMahprORnA69ROD9yI49OP OUT: -7 Case #8: IN: 6Tyrvvn0IK2GeURZoElR OUT: 0 Case #9: IN: TZjgYFR OUT: 0
Notice that name
returned -11 on inputs 26-27 characters long, and -7 on an input 25 characters long. Let's see what happens if we execute name
ourselves with the same inputs:
$> ./name What's your name? y6tLHoJ2u4LRs158aAIlrHsVOHT Hi there, y6tLHoJ2u4LRs158aAIlrHsVOHT! Segmentation fault $> ./name What's your name? B3LOMahprORnA69ROD9yI49OP Hi there, B3LOMahprORnA69ROD9yI49OP! Bus error
Our fuzzer has revealed multiple inputs that cause name
to reliably crash!
Conclusion
The bugs we found in the previous section warrant further investigation; however, actually fixing the bugs in name
is outside the scope of this tutorial. These bugs will be addressed and explained in another post.
In summary, we used two small, very simple Python packages to write a (very simple) fuzzer to help us diagnose issues in a program we wrote. While name
is only a toy program (with an intentional vulnerability), most of what we did in this tutorial - including the code we wrote - can be easily abstracted to any general binary executable. Both MPH and Fuzzbang provide facilities for doing so.
The complete code for fuzztut.py
is available as a Gist here.


Linked Events provides categorized data on events and places. In the API, you can search data by date or location as well as city neighborhoods.
The API provides data in JSON-LD format.
The API is in beta phase. To help improve the API, please don’t hesitate to comment, give feedback or make suggestions to API's Github issues-page.
Use the browsable version of the API at the bottom of this page to explore the data in your browser.
Events are the main focus point of this API. Click on the event link below to see the documentation for events.


About Me
Hi there! Thanks for stopping by to check out my work. I am a 24 year old full-flex web development bootcamp student at Northwestern University. As you take a gander through this portfolio, you will find my current works, my resume, and some ways to connect with me.
My Work
Examples of my projects
Password Generator
Using Javascript to Create Passwords
Code Quiz
About Me
Daily Planner
About Me


Toggle navigation
Account Login
Door22 Residence
Please use a valid Account # and PIN #.
Login
© 2017
Door22 Residence
. All Rights Reserved.


Red:
Lightness:
Resize width:
Green:
Saturation:
Resize height:
Blue:
Color:
Resize proportional:
Temperature:
Canvasextension:
Vertical
Horizontal
Inverse
Undo
ChangeImg
Reset


Reference Language | Libraries | Comparison | Changes
These core libraries allow an Arduino Leonardo board to appear as a native Mouse and/or Keyboard to a connected computer.
A word of caution on using the Leonardo as a Mouse or Keyboard: if the Mouse or Keyboard library is constantly running, it will be difficult to program your board. Functions such as Mouse.move() and Keyboard.print() will move your cursor or send keystrokes to a connected computer and should only be called when you are ready to handle them. It is recommended to use a control system to turn this functionality on, like a physical switch or only responding to specific input you can control.
When using the Mouse or Keyboard library, it may be best to test your output first using Serial.print(). This way, you can be sure you know what values are being reported. Refer to the Mouse and Keyboard examples for some ways to handle this.
The mouse functions enable to Leonardo to control cursor movement on a connected computer. When updating the cursor position, it is always relative to the cursor's previous location.
The keyboard functions enable to Leonardo to send keystrokes to an attached computer.
Note: Not every possible ASCII character, particularly the non-printing ones, can be sent with the Keyboard library. The Leonardo supports the use of modifier keys. Modifier keys change the behavior of another key when pressed simultaneously. See here for additional information on supported keys and their use.
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.


Before Change
elif self.metric in dist.named_distances:
self._input_distance_func = dist.named_distances[self.metric]
elif self.metric == "precomputed":
warn("Using precomputed metric; transform will be unavailable for new data")
else:
raise ValueError("metric is neither callable, " + "nor a recognised string")
if callable(self.output_metric):
After Change
"a tuple of (distance [float], gradient [np.array])")
elif self.metric in dist.named_distances:
self._input_distance_func = dist.named_distances[self.metric]
try:
self._inverse_distance_func = dist.named_distances_with_gradients[self.metric]
except KeyError:
warn("gradient function is not yet implemented for {} distance metric; "
"inverse_transform will be unavailable".format(self.metric))
self._inverse_distance_func = None
elif self.metric == "precomputed":
warn("using precomputed metric; transform will be unavailable for new data and inverse_transform "
"will be unavailable for all data")
self._inverse_distance_func = None


Add SIP
Choose Coin
Select Token
Sip Frequency
Select unit
Hour
Day
Week
Month
Amount in INR
Reset
Add SIP
Delete SIP
Trigger ID
Remove SIP


End Point
Token
Go to Login
Username
Email
Verify User data
Select the following user data to verify. This example only support email and phone.
Email
Phone
Submit Verify Code
Code
Send


Drag image to chose image position. Scroll mouse wheel onto image to zoom
{{ item.type_name }} {{item.affiliation_name}} {{item.faction_name}}


Our finest resource is our employees. We have hand-picked professionals and capable seasoned team members bring to the table optimum experience for every project. Turn us loose on your next project and let our professionalism speak for itself. As one of Miami's major steel distribution and metal processing sources, we stock a vast inventory of all sizes, types and grades of metals.
Bostic steel is proud of the fine reputation we have built in the community and in the construction industry. Architects, engineers and contractors know that when they entrust ideas to us, not only will they get desired results but they will receive it on time, every time. In fact, that is why much of our business comes from word-of-mouth referrals. Trust us with your vision and we will make it happen.
When you think of steel, words like durable, tough, reliable, and strong come to mind. Bostic Steel stands behind the strength of our product with equal distinction. Our extensive processing capabilities will ensure that the metals you require are Ready For Business. When you are ready, we will be here!


Home
Education
High School
Undergraduate
Graduate
Work
TCS
Mainframe
DB2
COBOL
Skills
Languages
Tools
Platforms
Databases
Projects
Miscellaneous
About Me
Contact
Resume
Gallery
My Updated Resume
Click to Download Resume
Resume (PDF)
Resume (Word)
Project Portfolio (PDF)
Contact me for
Career Opportunities
Software development
Web development
Get in touch with me through


|
AceTime
2.3.0
Date and time classes for Arduino that support timezones from the TZ Database.
|
ZoneSorterByOffsetAndName, templatized on BasicZoneManager or ExtendedZoneManager. More...
#include <ZoneSorterByOffsetAndName.h>
Public Member Functions | |
| ZoneSorterByOffsetAndName (const ZM &zoneManager) | |
| Constructor. More... | |
| void | fillIndexes (uint16_t indexes[], uint16_t size) const |
| Fill the given array of indexes with index from [0, size). More... | |
| void | sortIndexes (uint16_t indexes[], uint16_t size) const |
| Sort the given array of indexes by UTC offset, then by name. | |
| void | sortIds (uint32_t ids[], uint16_t size) const |
| Sort the given array of zone ids by UTC offset, then by name. | |
| void | sortNames (const char *names[], uint16_t size) const |
| Sort the given array of zone names by UTC offset, then by name. | |
Static Public Member Functions | |
| template<typename Z > | |
| static int | compareZone (const Z &a, const Z &b) |
| Return <0, 0, or >0 depending on whether Zone a is <, ==, or > than Zone b. More... | |
ZoneSorterByOffsetAndName, templatized on BasicZoneManager or ExtendedZoneManager.
Sorts the array of zones by UTC offset first, then by name.
| ZM | ZoneManager |
Definition at line 22 of file ZoneSorterByOffsetAndName.h.
|
inline |
Constructor.
| zoneManager | instance of the ZoneManager |
Definition at line 28 of file ZoneSorterByOffsetAndName.h.
|
inlinestatic |
Return <0, 0, or >0 depending on whether Zone a is <, ==, or > than Zone b.
The comparison function is by the zone's last UTC offset in the zoneInfo database, then by name for zones which have the same UTC offset.
We cannot use auto
as the parameter type (apparently, that's a C++14 feature), so we are forced to use template function. The Z
template will be either the BasicZone or ExtendedZone class.
Definition at line 89 of file ZoneSorterByOffsetAndName.h.
|
inline |
Fill the given array of indexes with index from [0, size).
The resulting indexes array can be sorted using sortIndexes().
Definition at line 36 of file ZoneSorterByOffsetAndName.h.


Developer preferences can be accessed via Setup -> Options -> CONSTELLATION -> Developer.
Constellation is a java application which means that the memory management is handled by the Garbage Collector (GC) process inside the Java Virtual Machine (JVM). It is best left to the GC to decide when to release unused memory but we can give a hint to the GC to clear unused memory when a graph is open or closed.
The following options have been enabled by default and does not guarantee that any garbage collection will be performed because it is ultimately up to the GC process to decide. A side effect of having this enabled means that opening and closing graphs could take longer to complete if the GC decides to clean up unused memory on a open or close.
The Constellation graph is rendered via OpenGL so having extra debug information can be useful for troubleshooting or to see what is happening internally. We've provided a few options from this preferences section to include debugging options:
Constellation is built on top of Apache Netbeans with a number of module suites and modules within those module suites. Running this option is a distruptive change that will uninstall all Constellation modules, stripping the application down to just the NetBeans runtime libraries.
NOTE: This option does not work for the standalone version of Constellation and it rather applicable to the version of Constellation that is continuously updating via the update site mechanism. This version is called the "Constellation Shell".


Label location trace¶
For a time-ordered series of coordinates, such as a GPS trace, annotate each point with a location label. Such a coordinate series may look like:
array([[ 55.75259295, 12.34353885 ],
[ 55.7525908 , 12.34353145 ],
[ 55.7525876 , 12.3435386 ],
...,
[ 63.40379175, 10.40477095 ],
[ 63.4037841 , 10.40480265 ],
[ 63.403787 , 10.4047871 ]])
The trace can then be labeled using infostop.detect.label_trace
:
labels = infostop.label_trace(data)
labels
# array([0, 0, -1, ..., 164, 164, 164])
And stacked with the input data:
np.hstack([data, labels.reshape(-1, 1)])
array([[ 55.75259295, 12.34353885, 0. ],
[ 55.7525908 , 12.34353145, 0. ],
[ 55.7525876 , 12.3435386 , -1. ],
...,
[ 63.40379175, 10.40477095, 164. ],
[ 63.4037841 , 10.40480265, 164. ],
[ 63.403787 , 10.4047871 , 164. ]])
Labels 0 and 164 in this example correspond to locations where the user was static, and possibly returned. The label -1 is given to location measurements which are recorded while the user is not stationary.
It is relevant for the user to consider first setting the r1
parameter in infostop.detect.label_trace
, which sets the threshold for the maximum distance between two consecutive location measurements allowed within the same stop location. As a rule of thumb, r1
should be slightly greater than the standard deviation of the uncertainty distribution on the location measurement.
To get bigger stop locations consider increasing r2
, which sets the distance threshold for link creation.
If the input data is not GPS points, the distance_function
parameter should be set to a valid metric, and r1
and r2
should most likely be specified to something meaningful. Per default, Infostop assumes that points are (lat, lon) and uses the haversine distance function, where the thresholds are given in meters.
Label timestamped trace¶
In a third (rightmost) column, timestamps can be listed so the input series looks like:
array([[ 55.75259295, 12.34353885,<PHONE_NUMBER> ],
[ 55.7525908 , 12.34353145,<PHONE_NUMBER> ],
[ 55.7525876 , 12.3435386 ,<PHONE_NUMBER> ],
...,
[ 63.40379175, 10.40477095,<PHONE_NUMBER> ],
[ 63.4037841 , 10.40480265,<PHONE_NUMBER> ],
[ 63403787 , 10.4047871 ,<PHONE_NUMBER> ]])
This is useful, as it allows the user to specify in the infostop.detect.label_trace
function two new parameters: min_staying_time
which sets a lower bound on how short stops can be, and max_time_between
which sets an upper bound on the longest allowed time between two samples before a new stop event is created.
Label static coordinates¶
In cases where the user needs to cluster a collection of points (i.e. static coordinates) infostop.detect.label_static_points
is useful. It creates a network of locations where locations that are closer than r2 to each other are linked, and then clusters this network using Infomap. Since Infomap is a flowbased clustering algorithm, it can detect overlapping clusters (i.e. stop locations or points of interest) as seperate locations.
Label distance matrix¶
Given an (N, N)
distance matrix for a set of coordinates infostop.detect.label_distance_matrix
returns the same result as infostop.detect.label_static_points
does for a (N, 2)
array of coordinates.


My Weka page
Here are some small programs purporting to show the versatility of the Weka
data mining/machine learning system and what it can do. I will not explain everything (in fact, I will not explain very much at all). At the Weka site
http://www.cs.waikato.ac.nz/~ml/weka/index.html you can read more about the system as well as downloading it.
Also see:
As Weka is a Java standalone application with a very nice GUI and a lot more
to tweak than these applets indicates, you will definitely enjoy Weka more if
you use the whole package of your own.
Many of the things shown in these applets is explained in
Chapter 8: Nuts and
bolts: Machine learning algorithms in Java
(
PDF file here) from the excellent book
Data Mining: Practical Machine Learning Tools and Techniques with Java
Implementations (written by Ian H. Witten and Eibe Frank). For more informations about the book, see
http://www.cs.waikato.ac.nz/~ml/weka/book.html.
The programs (so far...)
Please note: these programs was written 2002/2003 for older
versions of Weka (and mostly as a "concept of proof" how to
"appletize" Weka), and has later been fixed for working with the
current Weka version 3.5.2 (mostly correcting the classnames for the
classifiers). These programs was compiled using Sun Java compiler
version 1.5 and Weka version 3.5.2.
ExpandFreqField.javaWeka
filter for copying instances a number of times according to a
frequency field. To use it with Weka Explorer (Java source code and
recompilation of Weka is required):
- Copy the file ExpandFreqField.java to the Weka directory
weka/filters/unsupervised/instance
- Add the following line in the file
weka/gui/GenericObjectEditor.props
together with
other filters.unsupervised.instance filters:
weka.filters.unsupervised.instance.ExpandFreqField,\
(don't forget the trailing "\").
- Compile the Java file
- Start Weka Explorer
Some of my other pages about Weka
Also see the following pages on my site mentioning Weka.
ARFF data files
The data file normally used by Weka is in ARFF file format, which consist
of special tags to indicate different things in the data file
(mostly: attribute names, attribute types, attribute values and the data).
Here is a list of some ARFF-file you can use, many are standard data sets often
used in the machine learning community. Most of them are available from the
Weka site. Many of them are also described and downloadable from http://www.ics.uci.edu/~mlearn/MLRepository.html.
If you click on the link in the list below you can see for yourself
what the data set looks like. Please note that some files are
quite big, and for some algorithms it will take a lot of time (often a lot of time!). The number in parenthesis is the size in bytes. In some of the
files there are quite good comments for the data set, other has no explanation
at all (they are probably converted from some other source by myself).
One more thing: The class attribute (i.e. the attribute we want to learn) must
be the last.
The following data sets are quite large:
ARFF versions of DASL data
DASL - The Data and Story
Library is a great collection of data sets, with background
stories and some analysis. For ARFF versions of these data sets, see ARFF versions of
DASL data sets.
Related pages:
- My Eureqa page: Eureqa is a great tool for symbolic regression
- My JGAP page, I have written my own symbolic regression program using JGAP (Java)
Back to my homepage
Created by Hakan Kjellerstrand hakank@gmail.com


Layout (vertical, horizontal, array) of VTKChartTimeSeries charts.
More...
#include <btkVTKChartLayout.h>
Layout (vertical, horizontal, array) of VTKChartTimeSeries charts.
This implementation take into account if the chart is visible or not and adjust the size of the others in consequence. This class take also the ownership of the included charts. Note: The first chart starts at the top-left.
| btk::VTKChartLayout::VTKChartLayout |
( |
| ) |
|
|
protected |
Constructor Set by default the size of the layout as 0 by 0 chart. A gutter between the chart of 15 (horizontal and vertical) pixels. And borders (left, bottom, right, top) of 50,40,50,40 pixels.
| btk::VTKChartLayout::~VTKChartLayout |
( |
| ) |
|
|
protected |
| void btk::VTKChartLayout::GetBorders |
( |
int |
borders[4] | ) |
|
|
virtual |
Returns the borders of the layout
Get the specified chart element, if the element does not exist (i.e. out of bounds), NULL will be returned. If the chart element has not yet been allocated it will be at this point.
| vtkVector2i btk::VTKChartLayout::GetChartSpan |
( |
const vtkVector2i & |
position | ) |
|
|
virtual |
Get the span of the specified chart.
| vtkVector2f btk::VTKChartLayout::GetGutter |
( |
| ) |
const |
|
inlinevirtual |
Returns the gutter used between each chart
| vtkVector2i btk::VTKChartLayout::GetSize |
( |
| ) |
const |
|
inlinevirtual |
Return the size of the layout.
| bool btk::VTKChartLayout::Paint |
( |
vtkContext2D * |
painter | ) |
|
|
virtual |
Paint event for layout of charts
| void btk::VTKChartLayout::PrintSelf |
( |
ostream & |
os, |
|
|
vtkIndent |
indent |
|
) |
| |
|
virtual |
Print the information of the object
| void btk::VTKChartLayout::SetBorders |
( |
int |
left, |
|
|
int |
bottom, |
|
|
int |
right, |
|
|
int |
top |
|
) |
| |
|
virtual |
Sets the size of the borders
| bool btk::VTKChartLayout::SetChart |
( |
const vtkVector2i & |
position, |
|
|
VTKChartTimeSeries * |
chart |
|
) |
| |
|
virtual |
Set the chart element, note that the chart matrix must be large enough to accommodate the element being set. Note that this class will take ownership of the chart object.
- Returns
- false if the element cannot be set.
| bool btk::VTKChartLayout::SetChartSpan |
( |
const vtkVector2i & |
position, |
|
|
const vtkVector2i & |
span |
|
) |
| |
|
virtual |
Set the span of a chart in the matrix. This defaults to 1x1, and cannot exceed the remaining space in x or y.
- Returns
- false If the span is not possible.
| void btk::VTKChartLayout::SetGutter |
( |
const vtkVector2f & |
gutter | ) |
|
|
virtual |
Sets the gutter used between each chart
| void btk::VTKChartLayout::SetSize |
( |
const vtkVector2i & |
size | ) |
|
|
virtual |
Set the number (rows and columns) of charts. This will cause an immediate update of the layout. The default size is 0x0 (no charts). No chart objects are created until GetChart() is called.
Extract the chart from the layout and remove it.
| void btk::VTKChartLayout::UpdateLayout |
( |
| ) |
|
|
virtual |
Updates the size of each chart by taking into account their number but also their visibility.
FIXME: This method was never tested for horizontal layout or array with invisible charts and should be adapted in consequence.
| btk::VTKChartLayout::Borders |
|
protected |
The borders (left, bottom, right, top) around this layout,
| btk::VTKChartLayout::Gutter |
|
protected |
The gutter between each chart.
| btk::VTKChartLayout::LayoutIsDirty |
|
protected |
Internal variable to determine if the layout must be updated or not.
| btk::VTKChartLayout::Size |
|
protected |
The number of charts in x and y.


About Me
Hi I'm Cynthia Mohan.
I am an aspiring Full Stack Developer.
I am proficient in HTML CSS and Javascript, jQuery moment.js and other libraries associated with
javascript. I have also worked in project using Nodejs and Vuejs.
I have good communication skills and the ability to work independantly and as within
a team. I focus on writing clean and efficient code.
I love Photography, gardening, watching Netflix and spending time with my family.
Work
Silicon-Clicker
Featured Project
Silicon-Clicker is an incremental web browser clicker game similar to Cookie Clicker
or Universal Paper
Clips designed for entertainment. It has been developed using HTML5 CSS3 jQuery
Vuejs for the Frontend. We have used Nodejs and express for our backend as well as
MySql database with sequelize ORM.
Weather Clock with Currency Converter
The World clock is an app that helps the users find the current time, current weather
along with the exchange rates from USD to other
currencies.
Weather dashboard
Enabling a user to search for any city in the US and get the climate data at that
place. The searched cities are stored in local storage so that the user can just
click on them and get the data. It also contains the five day forecast of the
weather.
Javascript Quiz
A user who is on the learning path may use this multiple choice quiz inorder to test
themselves on their proficiency in javascript. The timer enables them to do the quiz
and guage their knowledge in a given span if time. This project uses HTML5 CSS3 and
javascript.


Course Buddy
Carleton University course timetables made easy.
I am currently studying...
and I have completed my courses...
On pattern
Off pattern
Which term do you want to generate a timetable for?
Fall Term
Winter Term
What year standing are you?
Year 1
Year 2
Year 3
Year 4
Why can't we calculate this automatically? See
here.
Which core courses have you taken?
Which elective courses have you taken?
Which core courses would you like to take?
What term do you want to generate a timetable for?
Fall - 1st Year
Winter - 1st Year
Fall - 2nd Year
Winter - 2nd Year
Fall - 3rd Year
Winter - 3rd Year
Fall - 4th Year
Winter - 4th Year
Select your preferred timetable below
Previous timetable
Next timetable
Enroll in this timetable


About Us
How-To is a project built by Lambda School students as part of our build week to demonstrate what we have learned. Each of us were at different points in our learning journey, and some of us came from completely different tracks.
Team Lead
Front End Architect
Back End Architect
UX Designer
IOS Developer
Web UI Developer 1
Web UI Developer 2
Web UI Developer 3


---
title: "Tech & Software"
layout: splash
permalink: /
header:
overlay_color: "#000"
overlay_filter: "0.5"
overlay_image: /assets/images/background.jpg
caption: "Photo credit: [**vldts**](https://flic.kr/p/omaQ4C)"
excerpt: 'Just a personal tech blog
My open source projects: {::nomarkdown}{:/nomarkdown}'
feature_row:
- alt: "Software"
title: "Software"
excerpt: "Nodejs, Python, C++, K8s, Docker, AWS"
url: "/software/"
btn_class: "btn--primary"
btn_label: "Go"
- alt: "Video & Media"
title: "Video & Media"
excerpt: "OTT, IPTV, Encoding, VMAF"
url: "/video/"
btn_class: "btn--primary"
btn_label: "Go"
- alt: "Data Communications"
title: "Data Communications"
excerpt: "QoS, Internet Meassurements, Data Networks"
url: "/internet/"
btn_class: "btn--primary"
btn_label: "Go"
intro:
- excerpt: '`IPTV`, `OTT`, `FFmpeg`,
`TCP/IP`,`Internet Meassurements`, `Internet Topology`'
---
{% include feature_row id="intro" type="center" %}