Class Pattern
Represents a textual pattern.
Namespace: Stringier.Patterns
Assembly: Stringier.Patterns.dll
Syntax
public abstract class Pattern : object
Constructors
| Improve this Doc View SourcePattern()
Initialize a new Pattern.
Declaration
protected Pattern()
Fields
| Improve this Doc View SourceAtEnd
Predefined
Declaration
protected static readonly Exception AtEnd
Field Value
| Type | Description |
|---|---|
| Exception |
NoMatch
Predefined
Declaration
protected static readonly Exception NoMatch
Field Value
| Type | Description |
|---|---|
| Exception |
Properties
| Improve this Doc View SourceEndOfLine
Check for the end of the line.
Declaration
public static Pattern EndOfLine { get; }
Property Value
| Type | Description |
|---|---|
| Pattern |
Remarks
This checks for various OS line endings, properly handling Windows convention, not just single UNICODE line terminators.
EndOfSource
Check for the end of the source.
Declaration
public static Pattern EndOfSource { get; }
Property Value
| Type | Description |
|---|---|
| Pattern |
Methods
| Improve this Doc View SourceBlockComment(String, String)
Creates a pattern representing a line comment introduced by the from
and ended by the to
delimiters.
Declaration
public static Pattern BlockComment(String from, String to)
Parameters
| Type | Name | Description |
|---|---|---|
| String | from | The token delimiting the start of a block comment. |
| String | to | The token delimiting the stop of a block comment. |
Returns
| Type | Description |
|---|---|
| Pattern | A pattern representing a block comment. |
Capture(out Capture)
Declares this Pattern should be captured into capture
for later reference.
Declaration
public virtual Pattern Capture(out Capture capture)
Parameters
| Type | Name | Description |
|---|---|---|
| Capture | capture | A Capture object to store into. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which will capture its result into |
Capture(Pattern, out Capture)
Declares the pattern
should be captured into capture
for later reference.
Declaration
public static Pattern Capture(Pattern pattern, out Capture capture)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to capture. |
| Capture | capture | A Capture object to store into. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which will capture its result into |
Consume(ReadOnlySpan<Char>, ref Int32, out Exception, IAdd<Capture>)
Calls the consume parser for this Pattern on the source
.
Declaration
protected abstract void Consume(ReadOnlySpan<Char> source, ref Int32 location, out Exception exception, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | source | The source to parse. |
| Int32 | location | The location within the |
| Exception | exception | The exception that occurred during parsing, if any. |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Remarks
This looks in source
at the location
for this Pattern, advancing location
to the position just after the match, if found, and leaving it unchanged if not found. exception
is null if a match is found, and assigned with information on the failure that occurred. If trace
is a valid object, it is used to collection steps through the pattern graph for debugging purposes.
IsConsumeHeader(ReadOnlySpan<Char>, Int32)
Checks if the header for the consume parser is present. This is an efficient check to determine whether the consume parser should be called at all.
Declaration
protected abstract Boolean IsConsumeHeader(ReadOnlySpan<Char> source, Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | source | The source to check. |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| Boolean | true if the pattern is potentially at this |
IsNeglectHeader(ReadOnlySpan<Char>, Int32)
Checks if the header for the neglect parser is present. This is an efficient check to determine whether the neglect parser should be called at all.
Declaration
protected abstract Boolean IsNeglectHeader(ReadOnlySpan<Char> source, Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | source | The source to check. |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| Boolean | true if the pattern is potentially at this |
LineComment(String)
Creates a pattern representing a line comment introduced by the delimiter
.
Declaration
public static Pattern LineComment(String delimiter)
Parameters
| Type | Name | Description |
|---|---|---|
| String | delimiter | The token delimiting the start of a line comment. |
Returns
| Type | Description |
|---|---|
| Pattern | A pattern representing a line comment. |
Many()
Marks this Pattern as spanning.
Declaration
public virtual Pattern Many()
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which spans, repeating as many times as necessary until it doesn't match anymore. |
Many(Pattern)
Marks the pattern
as spanning.
Declaration
public static Pattern Many(Pattern pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to span. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which spans, repeating as many times as necessary until it doesn't match anymore. |
Maybe()
Marks this Pattern as optional.
Declaration
public virtual Pattern Maybe()
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which may or may not be present in order to match. |
Maybe(Pattern)
Marks the pattern
as optional.
Declaration
public static Pattern Maybe(Pattern pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to make optional. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which may or may not be present in order to match. |
Neglect(ReadOnlySpan<Char>, ref Int32, out Exception, IAdd<Capture>)
Calls the neglect parser for this Pattern on the source
.
Declaration
protected abstract void Neglect(ReadOnlySpan<Char> source, ref Int32 location, out Exception exception, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | source | The source to parse. |
| Int32 | location | The location within the |
| Exception | exception | The exception that occurred during parsing, if any. |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Remarks
This behaves identically to Consume(ReadOnlySpan<Char>, ref Int32, out Exception, IAdd<Capture>), except that a match is defined as anything the same length as this Pattern, but not equal to it. If the source is the same length and content as this Pattern, it is considered a failed match. This is used to implement Not().
Not()
Marks this Pattern as negated.
Declaration
public virtual Pattern Not()
Returns
| Type | Description |
|---|---|
| Pattern |
Not(Pattern)
Marks the pattern
as negated.
Declaration
public static Pattern Not(Pattern pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to negate. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which matches the negation of the |
OneOf(Pattern[])
Declares the patterns
to be alternates of each other; one of them will match.
Declaration
public static Pattern OneOf(params Pattern[] patterns)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern[] | patterns | The set of Pattern. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern alternating all of the |
Or(Char)
Declares other
to be an alternate of this Pattern.
Declaration
public virtual Pattern Or(Char other)
Parameters
| Type | Name | Description |
|---|---|---|
| Char | other | The |
Returns
| Type | Description |
|---|---|
| Pattern |
Or(String)
Declares other
to be an alternate of this Pattern.
Declaration
public virtual Pattern Or(String other)
Parameters
| Type | Name | Description |
|---|---|---|
| String | other | The |
Returns
| Type | Description |
|---|---|
| Pattern |
Or(Pattern)
Declares other
to be an alternate of this Pattern.
Declaration
public virtual Pattern Or(Pattern other)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | other |
Returns
| Type | Description |
|---|---|
| Pattern |
Parse(Char*, Int32, ref Int32)
Parses the source
.
Declaration
public Span<Char> Parse(Char*source, Int32 length, ref Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| Char* | source | The source to parse. |
| Int32 | length | The length of the |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| Span<Char> | The captured text. |
Parse(Char*, Int32, ref Int32, IAdd<Capture>)
Parses the source
.
Declaration
public Span<Char> Parse(Char*source, Int32 length, ref Int32 location, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| Char* | source | The source to parse. |
| Int32 | length | The length of the |
| Int32 | location | The location within the |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Returns
| Type | Description |
|---|---|
| Span<Char> | The captured text. |
Parse(Char[], ref Int32)
Parses the source
.
Declaration
public Memory<Char> Parse(Char[] source, ref Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| Char[] | source | The source to parse. |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| Memory<Char> | The captured text. |
Parse(Char[], ref Int32, IAdd<Capture>)
Parses the source
.
Declaration
public Memory<Char> Parse(Char[] source, ref Int32 location, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| Char[] | source | The source to parse. |
| Int32 | location | The location within the |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Returns
| Type | Description |
|---|---|
| Memory<Char> | The captured text. |
Parse(Memory<Char>, ref Int32)
Parses the source
.
Declaration
public Memory<Char> Parse(Memory<Char> source, ref Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| Memory<Char> | source | The source to parse. |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| Memory<Char> | The captured text. |
Parse(Memory<Char>, ref Int32, IAdd<Capture>)
Parses the source
.
Declaration
public Memory<Char> Parse(Memory<Char> source, ref Int32 location, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| Memory<Char> | source | The source to parse. |
| Int32 | location | The location within the |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Returns
| Type | Description |
|---|---|
| Memory<Char> | The captured text. |
Parse(ReadOnlyMemory<Char>, ref Int32)
Parses the source
.
Declaration
public ReadOnlyMemory<Char> Parse(ReadOnlyMemory<Char> source, ref Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<Char> | source | The source to parse. |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<Char> | The captured text. |
Parse(ReadOnlyMemory<Char>, ref Int32, IAdd<Capture>)
Parses the source
.
Declaration
public ReadOnlyMemory<Char> Parse(ReadOnlyMemory<Char> source, ref Int32 location, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<Char> | source | The source to parse. |
| Int32 | location | The location within the |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<Char> | The captured text. |
Parse(ReadOnlySpan<Char>, ref Int32)
Parses the source
.
Declaration
public ReadOnlySpan<Char> Parse(ReadOnlySpan<Char> source, ref Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | source | The source to parse. |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| ReadOnlySpan<Char> | The captured text. |
Parse(ReadOnlySpan<Char>, ref Int32, IAdd<Capture>)
Parses the source
.
Declaration
public ReadOnlySpan<Char> Parse(ReadOnlySpan<Char> source, ref Int32 location, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<Char> | source | The source to parse. |
| Int32 | location | The location within the |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Returns
| Type | Description |
|---|---|
| ReadOnlySpan<Char> | The captured text. |
Parse(Span<Char>, ref Int32)
Parses the source
.
Declaration
public Span<Char> Parse(Span<Char> source, ref Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<Char> | source | The source to parse. |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| Span<Char> | The captured text. |
Parse(Span<Char>, ref Int32, IAdd<Capture>)
Parses the source
.
Declaration
public Span<Char> Parse(Span<Char> source, ref Int32 location, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| Span<Char> | source | The source to parse. |
| Int32 | location | The location within the |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Returns
| Type | Description |
|---|---|
| Span<Char> | The captured text. |
Parse(String, ref Int32)
Parses the source
.
Declaration
public ReadOnlyMemory<Char> Parse(String source, ref Int32 location)
Parameters
| Type | Name | Description |
|---|---|---|
| String | source | The source to parse. |
| Int32 | location | The location within the |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<Char> | The captured text. |
Parse(String, ref Int32, IAdd<Capture>)
Parses the source
.
Declaration
public ReadOnlyMemory<Char> Parse(String source, ref Int32 location, IAdd<Capture> trace)
Parameters
| Type | Name | Description |
|---|---|---|
| String | source | The source to parse. |
| Int32 | location | The location within the |
| IAdd<Capture> | trace | The object to trace the steps through the pattern graph in. |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<Char> | The captured text. |
Repeat(Int32)
Marks this Pattern as repeating count
times.
Declaration
public virtual Pattern Repeat(Int32 count)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | The amount of times to repeat. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern repeated |
Repeat(Pattern, Int32)
Marks the pattern
as repeating count
times.
Declaration
public static Pattern Repeat(Pattern pattern, Int32 count)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to repeat. |
| Int32 | count | The amount of times to repeat. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern repeated |
StringLiteral(String)
Creates a pattern representing a string literal contained by the delimiter
.
Declaration
public static Pattern StringLiteral(String delimiter)
Parameters
| Type | Name | Description |
|---|---|---|
| String | delimiter | The token delimiting the start and end of the literal. |
Returns
| Type | Description |
|---|---|
| Pattern | A pattern representing a string literal. |
StringLiteral(String, String)
Creates a pattern representing a string literal contained by the delimiter
.
Declaration
public static Pattern StringLiteral(String delimiter, String escape)
Parameters
| Type | Name | Description |
|---|---|---|
| String | delimiter | The token delimiting the start and end of the literal. |
| String | escape | The token escaping the |
Returns
| Type | Description |
|---|---|
| Pattern | A pattern representing a string literal. |
Then(Char)
Concatenates the nodes so that this Pattern comes before the other
Declaration
public virtual Pattern Then(Char other)
Parameters
| Type | Name | Description |
|---|---|---|
| Char | other | The succeeding |
Returns
| Type | Description |
|---|---|
| Pattern |
Then(String)
Concatenates the nodes so that this Pattern comes before the other
Declaration
public virtual Pattern Then(String other)
Parameters
| Type | Name | Description |
|---|---|---|
| String | other | The succeeding |
Returns
| Type | Description |
|---|---|
| Pattern |
Then(Pattern)
Declaration
public virtual Pattern Then(Pattern other)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | other | The succeeding Pattern. |
Returns
| Type | Description |
|---|---|
| Pattern |
To(Pattern)
Create a pattern representing the range from this Pattern until to
.
Declaration
public virtual Pattern To(Pattern to)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | to | The ending Pattern. |
Returns
| Type | Description |
|---|---|
| Pattern |
To(Pattern, Pattern)
Create a pattern representing the range from this Pattern until to
, allowing an escape
.
Declaration
public virtual Pattern To(Pattern to, Pattern escape)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | to | The ending Pattern. |
| Pattern | escape | The escape Pattern./ |
Returns
| Type | Description |
|---|---|
| Pattern |
Remarks
If escape
is null this does the same as To(Pattern).
ToNested(Pattern)
Create a pattern representing the range from this Pattern until to
, that allows nesting of this pattern inside of itself.
Declaration
public virtual Pattern ToNested(Pattern to)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | to | The ending Pattern. |
Returns
| Type | Description |
|---|---|
| Pattern |
Remarks
The easiest way to explain this is that is shows up a lot in programming, with things like if-then-else statements which can contain other if-then-else statements.
Operators
| Improve this Doc View SourceBitwiseAnd(Pattern, Pattern)
Declares right
to come after left
.
Declaration
public static Pattern operator &(Pattern left, Pattern right)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | left | The lefthand Pattern; placed first. |
| Pattern | right | The righthand Pattern; placed last. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern matching |
BitwiseOr(Pattern, Pattern)
Declares right
to be an alternate of left
.
Declaration
public static Pattern operator |(Pattern left, Pattern right)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | left | The lefthand Pattern; checked first. |
| Pattern | right | The righthand Pattern; checked last. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern matching |
Implicit(Char to Pattern)
Converts to a Pattern matching exactly the char
.
Declaration
public static implicit operator Pattern(Char char)
Parameters
| Type | Name | Description |
|---|---|---|
| Char | char | The |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit(Char[] to Pattern)
Converts to a Pattern matching exactly the array
.
Declaration
public static implicit operator Pattern(Char[] array)
Parameters
| Type | Name | Description |
|---|---|---|
| Char[] | array | The |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit(Memory<Char> to Pattern)
Converts to a Pattern matching exactly the memory
.
Declaration
public static implicit operator Pattern(Memory<Char> memory)
Parameters
| Type | Name | Description |
|---|---|---|
| Memory<Char> | memory | The |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit(ReadOnlyMemory<Char> to Pattern)
Converts to a Pattern matching exactly the memory
.
Declaration
public static implicit operator Pattern(ReadOnlyMemory<Char> memory)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<Char> | memory | The |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit(String to Pattern)
Converts to a Pattern matching exactly the string
.
Declaration
public static implicit operator Pattern(String string)
Parameters
| Type | Name | Description |
|---|---|---|
| String | string | The |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit(Capture to Pattern)
Converts to a Pattern matching exactly the capture
.
Declaration
public static implicit operator Pattern(Capture capture)
Parameters
| Type | Name | Description |
|---|---|---|
| Capture | capture | The Capture to match. |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit((Char, Case) to Pattern)
Converts to a Pattern matching exactly the char
.
Declaration
public static implicit operator Pattern((Char, Case) char)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueTuple<Char, Case> | char | A |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit((Char[], Case) to Pattern)
Converts to a Pattern matching exactly the array
.
Declaration
public static implicit operator Pattern((Char[], Case) array)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueTuple<Char[], Case> | array | A |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit((Memory<Char>, Case) to Pattern)
Converts to a Pattern matching exactly the memory
.
Declaration
public static implicit operator Pattern((Memory<Char>, Case) memory)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueTuple<Memory<Char>, Case> | memory | A |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit((ReadOnlyMemory<Char>, Case) to Pattern)
Converts to a Pattern matching exactly the memory
.
Declaration
public static implicit operator Pattern((ReadOnlyMemory<Char>, Case) memory)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueTuple<ReadOnlyMemory<Char>, Case> | memory | A |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit((String, Case) to Pattern)
Converts to a Pattern matching exactly the string
.
Declaration
public static implicit operator Pattern((String, Case) string)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueTuple<String, Case> | string | A |
Returns
| Type | Description |
|---|---|
| Pattern |
Implicit((Capture, Case) to Pattern)
Converts to a Pattern matching exactly the capture
.
Declaration
public static implicit operator Pattern((Capture, Case) capture)
Parameters
| Type | Name | Description |
|---|---|---|
| ValueTuple<Capture, Case> | capture | A |
Returns
| Type | Description |
|---|---|
| Pattern |
LogicalNot(Pattern)
Marks the pattern
as negated.
Declaration
public static Pattern operator !(Pattern pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to negate. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which matches the negation of |
Multiply(Pattern, Int32)
Marks the pattern
as repeating count
times.
Declaration
public static Pattern operator *(Pattern pattern, Int32 count)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to repeat. |
| Int32 | count | The amount of times to repeat. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern repeated |
UnaryNegation(Pattern)
Marks the pattern
as optional.
Declaration
public static Pattern operator -(Pattern pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to make optional. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which may or may not be present in order to match. |
UnaryPlus(Pattern)
Marks the pattern
as spanning.
Declaration
public static Pattern operator +(Pattern pattern)
Parameters
| Type | Name | Description |
|---|---|---|
| Pattern | pattern | The Pattern to span. |
Returns
| Type | Description |
|---|---|
| Pattern | A new Pattern which spans, repeating as many times as necessary until it doesn't match anymore. |


0a
About
About
Archy
, the anthropic machine who writes on 0a.io
nothing much.
Logs before the Game That Matters
Apr 16, 2015
16
Apr 2015
The Game That Matters
Sep 23, 2014
23
Sep 2014
Sometime, somewhere, in this world in which we live: a poem, with a sum-up on the black hole information paradox
Feb 19, 2015
19
Feb 2015
Prologue for 0a explains: Set Theory and Axiomatic Systems
Sep 10, 2014
10
Sep 2014
And by you I mean
you
who is me
Dec 13, 2014
13
Dec 2014
On screwing up: I was still a loser in human interaction
Apr 16, 2015
16
Apr 2015
The Game That Matters
Feb 19, 2015
19
Feb 2015
Prologue for 0a explains: Set Theory and Axiomatic Systems
Dec 13, 2014
13
Dec 2014
On screwing up: I was still a loser in human interaction
Sep 23, 2014
23
Sep 2014
Sometime, somewhere, in this world in which we live: a poem, with a sum-up on the black hole information paradox
Sep 10, 2014
10
Sep 2014
And by you I mean
you
who is me


Plain of Tears [ar32], plain, in Mandoria, peasants: 143
Last updated Turn #126
Plain of Tears [ar32], plain, in Mandoria, peasants: 143
------------------------------------------------------------------------
27: None of them [s9n], refugee, arrived from the south.
30: The population grows by one peasant.
Routes leaving Plain of Tears:
North, plain, to Plain of Tears [aq32], 7 days
Garrison [in9h], garrison, uncontrolled, with four peasants
East, plain, to Plain of Tears [ar33], 7 days
Garrison [gc8o], garrison, uncontrolled, with ten peasants
South, plain, to Plain of Tears [as32], 7 days
West, plain, to Plain of Tears [ar31], 7 days
Garrison [cn8t], garrison, uncontrolled, with five peasants
Seen here:
Garrison [bj6y], garrison, uncontrolled, with ten peasants
None of them [s9n], refugee


Featured Work Orbs Link to project Blue Link to project Mosaic Link to project Wave Link to project Landscape Link to project Rock Link to project


| | |
- col(df, colname='artists')
- :param df:
:param colname: (Default value = "artists")
- create_random_dict(df_by_artists, length, score)
- This method is used to test the system. It creates random
dictionary of artists and rates
:param df_by_artists:
:param length:
:param score:
- perfect_eval(string)
- This method evaluates string
:param string:
- pretty_recommend_artist(df_by_artists, name_rate_dict, how_many)
- "This method is used if the print in the console needed
:param df_by_artists:
:param name_rate_dict:
:param how_many:
- query_artist(df, string='--', full=False, strict=True)
- :param df:
:param string: (Default value = "--")
:param full: (Default value = False)
:param strict: (Default value = True)
- query_artists(df, lists=[], full=False, strict=True)
- :param df:
:param lists: (Default value = [])
:param full: (Default value = False)
:param strict: (Default value = True)
- rate_artist(df_by_artists, name_rate_dict)
- This method selects best-rated genres from the name_rate_dict
:param df_by_artists:
:param name_rate_dict:
- recommend_artist_by_genre(df_by_artists, name_rate_dict, how_many)
- This method is used to create recommendations based on dictionary
of artists names and rates
:param df_by_artists:
:param name_rate_dict:
:param how_many:
- select_artist(df_by_artists, df_rate)
- This method selects artists which perform the same genre as
artists were given
:param df_by_artists:
:param df_rate:
- songs_dict(name_rate_dict, how_many)
- This function is used in main.py. It returns dictionary of recommended
songs, which viewed when user presses "get recommendations" button
:param name_rate_dict:
:param how_many:
|


◆ _collisionLinks
| List<CollisionLink> BrawlLib.Modeling.CollisionState._collisionLinks |
◆ _collisionNode
◆ _collisionObject
◆ _collisionPlane
◆ _create
| bool BrawlLib.Modeling.CollisionState._create |
◆ _delete
| bool BrawlLib.Modeling.CollisionState._delete |
◆ _linkVectors
| List<Vector2> BrawlLib.Modeling.CollisionState._linkVectors |
◆ _merge
| bool BrawlLib.Modeling.CollisionState._merge |
◆ _split
| bool BrawlLib.Modeling.CollisionState._split |
The documentation for this class was generated from the following file:
- BrawlLib/Modeling/SaveState.cs


CffeeMedia
Welcome to CoffeeMedia, a secure and dedicated social networking site. Your info and needs are our first priority. We don't have a help forum because the public chat is checked daily, and all customer questions are guaranteed an answer.
See a post you don't like? Is it offensive... or maybe rude and inapropriate? It's never been easier to report bad posts, and with an instant report button, we can block any post with ease. Is someone harrasing you? BAM! They're banned!
Here at CoffeeMedia, we know how annoying it is to see ads everywhere. That's why CoffeeMedia is ad free. We are completly a independant, non-profit, ad-free, social network. You will never need to pay to get access, and anyone with a Google account can use it!
Introducing CoffeeTalk, a private and safe way to chat with other users. Perfect for secrets, orginizations, and other private things. Only users with the chat code can access your private chat.
The Meme of the Week Contest (MWC) is a weekly contest where you, the user, psots an image and a caption for the MWC, and the best one is put here.
Note:The meme must be coffee-related!
When coffee loves
You back


The AssumeRole permissions are very flexible and, if misconfigured, could lead to unintended consequences. For example, if the access role “AWS”: “*” is associated and any user from any account may be able to assume the role (given that they have the correct AWS Account ID and Role Name).
Testing AssumeRole - Enumerating if Roles Exist (and potentially assume that role)
AWS 'AssumeRole' Enumeration Script - 1100+ word wordlist. Script is capable to automatically assuming the discovered role and outputting the issues credentials.
Also included in Pacu - The AWS exploitation framework.
Note: The keys used must have the “sts:AssumeRole” permission on any resource (*) to be able to assume a misconfigured role. Lacking this permission, roles can still be identified, but not assumed.


You're gonna do a great job, buddy!
There's not a lot to do in the apocalypse. Luckily, we've got all these movies that were left behind
Unluckily, no one's been updating IMDB since the world ended, and all the information's been scrambled
So, do you think you could help us out?


Simple try...catch
Finally statement with catch block
Finally statement (Success)
Throw custom error
Check for error type (Reference)
Check for error type (Range)
Check for error type (Type)
Check for error type (URI)
Check for error type (Syntax)


To include quotes from interview(s)and newspaper clippings from the 1950s/1960s and present day(if any).


{% extends "content_base.django.html" %} {% with request.user as user %} {% block content_title %}Editing {{ user }}'s Profile{% endblock %} {% block extra_content_headx %} {% endblock %} {% block content %} {% with user.profile.all.0 as profile %}
| First Name: | ||
| Last Name: | ||
| Website: | ||
| Twitter: (no @) |
||
| Bio: (html allowed) |


IMF approves $450 mln loan tranche for Pakistan
by https://www.facebook.com/dunyanewsWASHINGTON (AFP) - The IMF on Friday praised Pakistan s economic performance and agreed on next steps, paving the way for release of another portion of a $6 billion, three-year loan package.
Once the International Monetary Fund board gives the go ahead, the Washington-based lender will provide $450 million to help right the South Asian nation s economy, on top of the $1 billion released in July.
"Despite a difficult environment, program implementation has been good, and all performance criteria for end-September were met with comfortable margins," IMF mission chief Ernesto Ramirez Rigo said in a statement.
The official, who led a team that spent two weeks in the country, pointed to signs of improving economic stability, including the move to a flexible exchange rate, and slowing inflation that is projected to fall under 12 percent next year.
But he said more work was needed to target money laundering and on terror finance controls.
Approval of the first performance review of Pakistan s policy program will also help unlock "significant funding from bilateral and multilateral partners."
Under the loan program, the government agreed to slash civil expenditure and freeze military spending while promising to substantially raise revenues to stem a yawning fiscal deficit, and pledging to collect 5.5 trillion rupees ($36 billion) in taxes.


..... …and I work for the next generation of makers.
Tech is reshaping how we learn and come togethe. Software is ubiquitious and every person can now build their way to a future that inspires them. However, today’s world isn’t designed to work for these makers creating an imbalance between the impact they’re capable of, and what’s expected of them.
I’m working to solve this problem…
…and through one commit at a time.
Currently, I am working as Head of Engineering at Sdui . It’s an amazing gig where I get to work alongside great developers on a software product that has become an integral medium upon which tens of thousands of teachers, parents and students rely to guarantee essential communication.
I’m currently living in Helsinki, Finland. Some other places I’ve lived in are Berlin, San Francisco, Hong Kong, Toronto, and Munich.
I’m a huge physics nerd, in particular cosmology. I wrote about the accelerating expansion of the universe, or better know as Dark Energy here.
I founded and built Hackerbayas CTO with three awesome friends. We took a small insight from hackathons –software is not a 12 month development cycle – and built up a B2B company. We worked with Twitter, Vodafone, Allianz and some of Germany’s largest corporations. With NFX we had incredible investors on board and always an open ear from James, Pete, or Gigi.
After five years of immense personal and professional growth, priorities changed and we decided to pursue new opportunities, where each of our personal strengths are best put to use.
For me that’s building tools for ..enabling the next billion developers.
I’m most active on Twitterand GitHubbut you can also find me on LinkedIn. The best way to contact me is either through Twitter, or my email at my first name @ mfts.io – my DMs and inbox are always open.
© Copyright 2021 | Henry King


| Previous Lecture | lect07 Before Slides | lect07 Annotated Slides | Next Lecture |
Topics
Under the hood of program compilation and execution
- From high-level programs to machine code
- What are .h, .o and .cpp file?
- What is an execuatble
- Steps in compilation * Creating object files and linking programs with g++
- Separate compilation with Makefiles read about Makefile
- Compile-time errors
- Linker errors
- Header guards
Lesson plan
- We will start with the code that we wrote in lecture 5 for drawing shapes and testing the functions we wrote with our home grown test framework
-
Our first goal is to split our original implementation into multiple files in a way that maximizes reuse. For example we can reuse our drawTriangle and drawSquare functions to draw a house. However, this is not possible with the file structure in lecture 5. We’ll discuss why that is.
-
Once we have broken down our single cpp file into logical separate files, its time to compile the code. Our goal will be to select and combine the pieces that make a complete program
-
If we tried to compile any one file (independent of the others), we are likely to get compiler errors and linker errors. You should be able to distinguish between these two types of errors and why they occur. To understand this distinction we need to peek under the hood of the compilation process and the intermediate steps that g++ takes to create an executable (see slides for more information). You will be introduced to object files - a very important concept for later lessons.
- We will first try to compile each file separately on the command line using the g++ option -c. For example
g++ -c shapes.cpp
The above command creates the object file shapes.o
We will then look at how to link all the object files into an executable using the -o option as shown below
g++ file1.o file2.o file3.o -o finalexecuatble
- Next we will automate this process by writing a makefile


Default li-rating component :
Default li-rating component with fill-mode: full
Default li-rating component with fill-mode: half
Text icon with color :
Text icon with stroke color and width :
Text icons with number of icons :
Font-awesome SVG icon with color :
SVG icon from path :
SVG icon from path :


Download Code
1 Introduction
We are interested in the numerical discretization of the Kolmogorov equation [12]
where $\mu>0$ is a diffusive function and $v$ a potential function.
This is one example of degenerate advection-diffusion equations which have the property of hypo-ellipticity (see for instance, [6, 13, 14]), ensuring the $C^\infty$ regularity of solutions for $t>0$ ([6]).
In the present case, the generator of the semigroup is constituted by the superposition of operators $\mu \partial_{xx}$ and $ v(x) \partial_y $. Despite the presence of a first order term, that could lead to transport phenomena and, consequently, to the lack of smoothing, the regularizing effect is ensured by the fact that the commutator of these two operators is non-trivial, allowing to gain regularity in the variable $y$. A full characterization of hypo-ellipticity can be found in [6].
Solutions of (1) experience also decay properties as $t\to \infty$. This is also a manifestation of hypo-coercivity (in the sense developed by Villani [13], [14]) as a byproduct of the hidden interaction of the two operators entering in the generator of the semigroup.
In this particular case $\mu=1$ and $v(x)=x$, using the Fourier transform, the fundamental solution of (1) (starting from an initial Dirac mass $\delta_{(x_0, y_0)}$) can be computed explicitly getting the following anisotropic Gaussian kernel
which exhibits different diffusivity and decay scales in the variables $x$ and $y$.
In view of the structure of the fundamental solution, one can deduce the following decay rates:
for solutions with initial data $f_0$ in $L^2$. Similar decay properties can be predicted by scaling arguments, due to the invariance properties of the equation in (\ref{kolmo}).
These decay properties are of anisotropic nature and of a different rate in the $x$ and $y$-directions. Indeed, in the $x$-direction, as in the classical heat equation, we observe a decay rate of the order of $t^{-1/2}$, while, in the $y$-variable, the decay is of order $t^{-3/2}$.
The obtention of these decay properties by energy methods has been a challenging topic of particular interest when dealing with more general convection-diffusion models that do not allow the explicit computation of the kernel. In this effort, the asymptotic behavior of Kolmogorov equation and several other relevant kinetic models was investigated intensively through the concept and techniques of hypo-coercivity, which allow to make explicit the hidden diffusivity and dissipativity of the involved operators (see [13], [14] and the previous references therein).
The literature on the asymptotic behaviour of models related with Kolmogorov equation is huge. We refer for instance to [8], [9], [2] for earlier works, and to [4], [5] for more recent approaches. Roughly speaking, it is by now well known that, constructing well-adapted Lyapunov functionals through variations of the natural energy of the system, one can make the dissipativity properties of the semigroup emerge and then obtain the sharp decay rates. These techniques have been developed also in other contexts such as partially dissipative hyperbolic systems (see [1]).
In [10] Porretta and Zuazua introduces a numerical scheme that preserves this hypo-coercivity property at the numerical level, uniformly on the mesh-size parameters. The issue is relevant from a computational point of view since, as it has been observed in a number of contexts (wave propagation, dispersivity of Schrödinger equations, conservation laws, etc. [15], [7]), the convergence property in the classical sense of numerical analysis (a property that concerns finite-time horizons) is not sufficient to ensure the asymptotic behavior of the PDE solutions to be captured correctly. The fact that the numerical approximation schemes preserve the decay properties of continuous solutions can be considered as a manifestation of the property of numerical hypo-coercivity.
In [3] Foster et al introduces a numerical scheme which preserves the long time behavior of solutions to the Kolmogorov equation. The method presented is based on a self-similar change of variables technique to transform the Kolmogorov equation into a new form, such that the problem of designing structure preserving schemes, for the original equation, amounts to building a standard scheme for the transformed equation. We also present an analysis for the operator splitting technique for the self-similar method and numerical results for the described scheme.
Here, instead of, we investigate this behavior using the characteristics-Galerkin finite element method (trough Freefem++ [11]) and in particular, we confront the results to those obtained in [3].
2 Description of the numerical scheme
At the numerical level, we employ a finite element method based on characteristics-Galerkin technique, and for the sake of simplicity and ease, we use the Freefem ++ software ([11]). As described above, solution of Equation (1) does not only diffuses in the direction of x, by the effect of the diffusion operator $\partial_{xx} f$, but it is also diffuses in the direction of $y$, due to the transport equation $\partial_t f - v(x) \partial_y f$. We will treat both effects, transport and diffusion separately, using the characteristics method, that we recall hereafter, for the equation $\partial_t f - v(x) \partial_y f$ and linear or quadratic finite element to discretise the diffusion term.
2.1 Transport
Let us consider the following scalar two dimensional transport equation
for some function $g$. Let (x,y,t)$\in \mathbb{R}^2 \times \mathbb{R}^+$. This transport equation can be written using the total derivative
if and only if the curve $( X_{x,y,t}(s),s)$ satisfies the system of ordinary differential equation
Under suitable assumptions on $ c$, the problem is well defined and there exists a unique solution to (6) $ X_{x,y,t}$, called the characteristic curve reaching (or passing from) the point $(x,y)$ at time $t$.
Since we cannot compute explicitly, in general, the solution of the equation (6), hence (4), we look for an approximate solution. Noting $\delta t>0$ the time step and $t_{n+1} = t_n + \delta t$, an easy manner to approximate the solution of Equation (4) is to perform a backward convection by the method of characteristic
where $f^n(x,y) = f(x,y,t_n)$ and $ X_{x,y,t_n}(x)$ is an approximation, as shown below, of the solution at time $t_n=n \delta t$ of the ordinary differential equation (6) for $s\in(t_n,t_{n+1})$ with the final data $ X_{x,y,t}(t_{n+1}) = (x,y)$.
Assuming $f$ regular enough, by Taylor expansion, one can write
Applying also a Taylor expansion to the function $t\mapsto f^n((x,y)-t c( X_{x,y,t_n}(t_n),t_n))$, we get
and therefore one can approximate $f^n( X_{x,y,t}(t_{n}))$ by $f^n((x,y)- \delta t \ c( X_{x,y,t_n}(t_n),t_n))$. For the sake of clarity, in the sequel, we note $X(t)$ the characteristic curve passing through the point $(x,y)$ at time $t$.
2.2 Numerical algorithm
For numerical purpose, we consider Equation (1) in $\Omega \subset \mathbb{R}^2$ with homogeneous Neumann boundary conditions. Keeping in mind the characteristic method, Equation (1) can be written
where $ n$ stands for the outward unit normal to $\Omega$, and for all $s\in(0,t)$, $ X$ is the solution of
Here, we use the following notations
Formally, thus, one can write, for any $\varphi \in V$ for some functional space, the weak form of Equation (8) as follows
Let us denote $t_0<t_1<\ldots < t_M = T$ be the discrete time with $t_n = n \delta t$ where $\delta t$ denotes the time step. We set $M = T/\delta t$.
Using the method of characteristic for the total derivative (see section 2.1), the weak form (10) can be approximated by
or
where
Here $(\cdot,\cdot)$ is the inner product in $L^2(\Omega)$.
Therefore, denoting $\tau_h$ a partition of $\Omega$ by triangles and $V_h$ the $P_k$-finite element space (of degree $k$),
the weak discrete form of the problem (8) is
Find ${f_h^n}_{n=1}^{M=T/\delta t} \subset V_h$ such that for $n=1,\dots, M$,
The Freefem++ script corresponding to the problem may as follows
</ol>
Freefem++ CODE:
- Freefem++ code for prog_control.m:
/*
C****************************************************************************C
C C
C This program solve the Kolmogorov equation C
C f_t-mu*f_{xx}-v(x) f_y = 0 on Omega x [0,T] C
C with free boundary conditions C
C using the Characteristic-Galerkin Finite Element Method C
C********************************************C*******************************C
C f(i,j) ==> unknown scalar function C
C phi(i,j) ==> test function C
C v(i) ==> scalar potential function C
C********************************************C
*/
//Omega : square mesh [0,20]x[0,20]
real aa = 10;
real x0=-aa,x1=aa;
real y0=-aa,y1=aa;
int m = 100;
mesh Th=square(m,m,[x0+(x1-x0)*x,y0+(y1-y0)*y]);
real Tf = 10,
dt = 0.01,
mu = 1; // viscosity parameter (see equation above)
fespace Vh(Th,P2); // P1 linear finite element
Vh f0 = exp(-x^2-y^2), // initial data
phi, // test function
v=-x,
f;
for(real t=0;t<=Tf;t=t+dt)
{
Vh c=convect([0,v(x,y)],-dt,f0);
solve Kolmogorov(f,phi)
=
int2d(Th)(f*phi/dt +mu*(dx(f)*dx(phi)))
- int2d(Th)(c/dt*phi)
;
f0=f;
}
3 Numerical experiment
In this section we present a test case, [3], for which we confront to an exact solution of the Kolmogorov Equation (1) with $\mu=1$ and $v(x)=x$. In particular, we compare our results to the one obtained in [3]. For our numerical test case, we have used linear finite element.
The initial value problem (1) with the initial data $f_0(x,y) = \exp(-x^2-y^2)$ admits the following exact solution
$$f_{ex}(x,y,t) = \frac{\exp\left(-\frac{(( 3+3t^2 +4t^3)x^2 +6t(1+2t)xy+3(1+4t)y^2)}{(3+12t+4t^3 +4t^4)}\right)}{\sqrt{1 + 4 t + 4/3 t^2 + 4/3 t^4}} \ . $$
As done in [3], for each numerical tests, we have considered the time interval, and problem domain to be respectively $[0, T=10]$ and $\Omega = [−10, 10] \times [−10,10]$, The time step is kept constant equal to $\delta t = 0.01$ and the number of triangles along each side of the domain is given by $m=50$, $100$ and $150$.
As one can see in the video above, the support for the function grows beyond the problem domain in the given time interval and interact with boundary conditions. This interaction, since we do not use here transparent boundary conditions, increases the error as one can also observe in Figure 1. We also show the time evolution of $\|f(\cdot,t)-f_{ex}(\cdot,t)\|_2$, $\|\partial_xf(\cdot,t)\|_2$, $\|\partial_y f(\cdot,t)\|_2$ and
$$D(t)=\left(\| f(t)\|_{L^2}+ \sqrt t\, \| \partial_x f(t) \|_{L^2}+ t^{\frac 32} \|\partial_y f(t)\| _{L^2}\right)/||f_0||_{L^2} \ ,$$ in Figure 2. The $L_2$ error at time time $T=10$ is approximately $0.0072$ as one can see in Figure 2(a). Moreover, the error $\int_0^T \| f(\cdot,t)-f_{ex}(\cdot,t)\|_2 dt $ is approximately of order $0.02$. We also observe, due to the interaction with the boundary conditions that the errors increase sensibly for each numerical experiments approximately at time $t\approx 8.5$. Therefore, in order to compute the numerical order of convergence, we have computed for each $m$, $m\mapsto \max_t\left( \|f(\cdot,t)-f_{ex}(\cdot,t)\|_2\right)$. We find almost the order $1$ which is satisfactory. Finally, we have computed the quantity
$$D(t) =\left(\| f(t)\|_{L^2}+ \sqrt t\, \| \partial_x f(t) \|_{L^2}+ t^{\frac 32} \|\partial_y f(t)\| _{L^2}\right)/||f_0||_{L^2}\ , $$
for which we numerically show that the constant for the decay rates is $C=1$ as shown in Figure 2(d)
Movie 1: Numerical simulation of the test case .
Figure 1.a: Numerical and exact solution at time $T=10$, Freefem solution with $m=100$
Figure 1.b: Numerical and exact solution at time $T=10$, Exact solution
Figure 2.a: $L_2$ errors, $t\mapsto\|f(\cdot,t)-f_{ex}(\cdot,t)\|_2$
Figure 2.b: $L_2$ errors, $t\mapsto \|\partial_xf(\cdot,t)\|_2$
Figure 2.c: $L_2$ errors, $t\mapsto \|\partial_yf(\cdot,t)\|_2$
Figure 2.d: $L_2$ errors,$t\mapsto D(t)$
To end, we present a last numerical simulation of rotating and moving initial data.
Movie 2: Numerical simulation on $\Omega = [0,10]\times[0,20]$, $[0,T=0.6]$ with $\mu=10^{-3}$, $v(x)=-x$ and $f_0(x,y) = 20 \exp(-(y-15)^2) \exp(-0.1(x-10)^2)$.
Bibliography
[1] K. Beauchard and E. Zuazua, Sharp large time asymptotics for partially dissipative hyperbolic systems, Arch. Ration. Mech. Anal. 199 (2011) 177-7227.
[2] A. Carpio, Long-time behavior for solutions of the Vlasov-Poisson-Fokker-Planck equation, Mathematical methods in the applied sciences 21 (1998), 985-1014.
[3] E. L. Foster, J. Lohéac and M.-B. Tran, A Structure Preserving Scheme for the Kolmogorov Equation, preprint 2014 (arXiv:1411.1019v3).
[4] F. Hérau, Short and long time behavior of the Fokker-Planck equation in a confining potential and applications, J. Funct. Anal. 244 (2007), 95-118.
[5] F. Hérau and F. Nier, Isotropic hypoellipticity and trend to equilibrium for the Fokker-Planck equation with a high-degree potential, Arch. Ration. Mech. Anal. 171 (2004), 151-218.
[6] L. Höormander, Hypoelliptic second order differential equations, Acta Math. 119 (1967), 147-171.
[7] L. Ignat, A. Pozo and E. Zuazua, Large-time asymptotics, vanishing viscosity and numerics for 1-D scalar conservation laws, Math of Computation, to appear.
[8] A. M. Il'in, On a class of ultraparabolic equations, Soviet Math. Dokl. 5 (1964), 1673-1676.
[9] A. M. Il'in and R. Z. Kasminsky, On the equations of Brownian motion, Theory Probab. Appl. 9 (1964), 421-444.
[10] A. Porretta and E. Zuazua, Numerical hypocoercivity for the Kolmogorov equation, Mathematics of Computation 86.303 (2017): 97-119.
[11] Frédéric Hecht, Olivier Pironneau, A~Le~Hyaric and K~Ohtsuka, Freefem++ manual, 2005.
[12] A. Kolmogoroff, Zufallige bewegungen (zur theorie der brownschen bewegung) Annals of Mathematics, pages 116--117, 1934.
[13] C. Villani, Hypocoercivity, Mem. Amer. Math. Soc. 202 (2009).
[14] C. Villani, Hypocoercive diffusion operators, In International Congress of Mathematicians, Vol. III, 473-498. Eur. Math. Soc. Zürich, 2006.
[15] E. Zuazua, Propagation, observation, and control of waves approximated by finite difference methods, SIAM Review, 47 (2) (2005), 197-243.


SetRenderQueue()
Syntax
SetRenderQueue(ObjectID, Queue [, Priority])Description
Change the render order of the specified object.
Parameters
ObjectID The object ID to convert the coordinate from. It can be one of the following type: - Entity : use EntityID() to get a valid ID. - Light : use LightID() to get a valid ID. - Mesh : use MeshID() to get a valid ID. - ParticleEmitter: use ParticleEmitterID() to get a valid ID. - BillboardGroup : use BillboardGroupID() to get a valid ID. - Text3D : use Text3DID() to get a valid ID.Queue The queue number to use to render the object. Queue number can be from 0 (background) to 100 (foreground). The default queue is 0, and is render behind all the other render queues. Priority (optional) The priority to use within the queue. Valid values are from 0 (background) to 10000 (foreground).
Return value
None.
Supported OS
All


Yea, I shall return with the tide. - Khalil Gibran
Hello again! It’s been over a year since my last post, and I’ve spent every day of it aching to get back to posting! Not really though, I mostly spent it with my head between the pages Casella and Berger’s Statistical Inference. The first year of my Ph.D. has been… eventful. I was too busy trying to absorb all that I’d learned to keep up with this blog, so I figure now that I finally have some time again I should update this blog with what I’ve been learning and what my plans are for this blog in the future.
I’ve been learning a lot about Bayesian statistics in Austin. Turns out, it’s not all linear algebra! I’ve gotten super involved in Bayesian inference on graphical models, specifically pairwise Markov random fields. As part of that research, I studied a recent paper Sampling Algorithms for Discrete Markov Random Fields and Related Graphical Models (2021) by Alan Julian Izenman. I spent much of my summer working on implementations of the sampling algorithms reviews in that paper, and have more news about that to share in dedicated posts.
I also did some work on constrained nuclear norm maximization which took me down a rabbit hole that seems to have ended at subgradient methods. With good progress, you can expect posts about that in the future as well.
The last project on the desk right now is experimenting with Bayesian predictive resampling as in On Recursive Bayesian Predictive Distributions (2018) by P. Richard Hahn, Ryan Martin, and one of my very own professors Stephen G. Walker. I’ve only just begun this work but as I come to understand this kind of sampling scheme I’ll surely be trying to make some kind of overview or tutorial post because I think this can become an incredibly useful and popular method for Bayesian prediction.
Going forward, I hope to update this blog at least monthly, but having just moved out to Austin I’m still getting a handle on my routines here and might not be all that consistent. To push consistency, I plan on making some small personal or non-statistical posts every now and then between big project updates. I’ll probably disregard my previous posts, specifically what was going to be the “Generalizing Linear Models” series, because it’ll take enough time just to catch y’all up on my projects. So consider this a reboot!
I’m looking forward to sharing more with you all soon!
Thank you,
Blake


My Team
Shannon
Manager
ID: 13
Email:
<EMAIL_ADDRESS>Office number: 5553423
Seth
Engineer
ID: 568
Email:
<EMAIL_ADDRESS>GitHub:
seth568
Jess
Intern
ID: 930
Email:
<EMAIL_ADDRESS>School: UNCW


|
AceTime
0.5.2
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
|
An implementation of ZoneProcessor that supports a subset of the zones containing in the TZ Database. More...
#include <BasicZoneProcessor.h>
Public Member Functions | |
| BasicZoneProcessor (const basic::ZoneInfo *zoneInfo=nullptr) | |
| Constructor. More... | |
| const void * | getZoneInfo () const override |
| Return the underlying ZoneInfo. More... | |
| uint32_t | getZoneId () const override |
| Return the unique stable zoneId. More... | |
| TimeOffset | getUtcOffset (acetime_t epochSeconds) const override |
| Return the total UTC offset at epochSeconds, including DST offset. More... | |
| TimeOffset | getDeltaOffset (acetime_t epochSeconds) const override |
| Return the DST delta offset at epochSeconds. More... | |
| const char * | getAbbrev (acetime_t epochSeconds) const override |
| Return the time zone abbreviation at epochSeconds. More... | |
| OffsetDateTime | getOffsetDateTime (const LocalDateTime &ldt) const override |
| void | printTo (Print &printer) const override |
| Print a human-readable identifier (e.g. More... | |
| void | printShortTo (Print &printer) const override |
| Print a short human-readable identifier (e.g. More... | |
| void | log () const |
| Used only for debugging. More... | |
| Public Member Functions inherited from ace_time::ZoneProcessor | |
| uint8_t | getType () const |
| Return the kTypeXxx of the current instance. More... | |
Static Public Member Functions | |
| static basic::MonthDay | calcStartDayOfMonth (int16_t year, uint8_t month, uint8_t onDayOfWeek, int8_t onDayOfMonth) |
| Calculate the actual (month, day) of the expresssion (onDayOfWeek >= onDayOfMonth) or (onDayOfWeek <= onDayOfMonth). More... | |
Additional Inherited Members | |
| Static Public Attributes inherited from ace_time::ZoneProcessor | |
| static const uint8_t | kTypeBasic = 2 |
| Indicate BasicZoneProcessor. More... | |
| static const uint8_t | kTypeExtended = 3 |
| Indicate ExtendedZoneProcessor. More... | |
| Protected Member Functions inherited from ace_time::ZoneProcessor | |
| ZoneProcessor (const ZoneProcessor &)=delete | |
| ZoneProcessor & | operator= (const ZoneProcessor &)=delete |
| ZoneProcessor (uint8_t type) | |
| Constructor. More... | |
| Protected Attributes inherited from ace_time::ZoneProcessor | |
| uint8_t | mType |
An implementation of ZoneProcessor that supports a subset of the zones containing in the TZ Database.
The supported list of zones, as well as the list of unsupported zones, are is listed in the zonedb/zone_info.h header file. The constructor expects a pointer to one of the ZoneInfo structures declared in the zone_infos.h file.
The internal ZoneRule and ZoneEra records that match the year of the given epochSeconds are cached for performance. The expectation is that repeated calls to the various methods will have epochSeconds which do not vary too greatly and will occur in the same year.
The Rule records are transition points which look like this:
* Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S *
Each record is represented by basic::ZoneRule and the entire collection is represented by basic::ZonePolicy.
The Zone records define the region which follows a specific set of Rules for certain time periods (given by UNTIL below):
* Zone NAME GMTOFF RULES FORMAT [UNTIL] *
Each record is represented by basic::ZoneEra and the entire collection is represented by basic::ZoneInfo.
This class assumes that the various components of ZoneInfo, ZoneEra, and ZonePolicy, ZoneRule have a number of limitations and constraints which simplify the implementation of this class. The tzcompiler.py script will remove zones which do not meet these constraints when generating the structs defined by zonedb/zone_infos.h. The constraints are at least the following (see tools/transformer.py for the authoratative algorithm):
Even with these limitations, zonedb/zone_info.h shows that 231 out of a total of 359 zones are supported by BasicZoneProcessor.
Not thread-safe.
Definition at line 184 of file BasicZoneProcessor.h.
|
inlineexplicit |
Constructor.
The ZoneInfo is given only for unit tests.
| zoneInfo | pointer to a ZoneInfo. |
Definition at line 190 of file BasicZoneProcessor.h.
|
inlinestatic |
Calculate the actual (month, day) of the expresssion (onDayOfWeek >= onDayOfMonth) or (onDayOfWeek <= onDayOfMonth).
There are 4 combinations:
* onDayOfWeek=0, onDayOfMonth=(1-31): exact match * onDayOfWeek=1-7, onDayOfMonth=1-31: dayOfWeek>=dayOfMonth * onDayOfWeek=1-7, onDayOfMonth=0: last{dayOfWeek} * onDayOfWeek=1-7, onDayOfMonth=-(1-31): dayOfWeek<=dayOfMonth *
Caveats: This method handles expressions which crosses month boundaries, but not year boundaries (e.g. Jan to Dec of the previous year, or Dec to Jan of the following year.)
Not private, used by ExtendedZoneProcessor.
Definition at line 333 of file BasicZoneProcessor.h.
|
inlineoverridevirtual |
Return the time zone abbreviation at epochSeconds.
This is an experimental method that has not been tested thoroughly. Use with caution. Returns an empty string ("") if an error occurs.
Implements ace_time::ZoneProcessor.
Definition at line 215 of file BasicZoneProcessor.h.
|
inlineoverridevirtual |
Return the DST delta offset at epochSeconds.
This is an experimental method that has not been tested thoroughly. Use with caution. Returns TimeOffset::forError() if an error occurs.
Implements ace_time::ZoneProcessor.
Definition at line 208 of file BasicZoneProcessor.h.
|
inlineoverridevirtual |
The Transitions calculated by BasicZoneProcessor contain only the epochSeconds when each transition occurs. They do not contain the local date/time components of the transition. This design reduces the amount of memory required by BasicZoneProcessor, but this means that the information needed to implement this method correctly does not exist.
The implementation is somewhat of a hack:
0) Use the localDateTime to extract the offset, assuming that the localDatetime is UTC. This will get us within 12-14h of the correct UTC offset. 1) Use (localDateTime, offset0) to determine offset1. 2) Use (localdateTime, offset1) to determine offset2. 3) Finally, check if offset1 and offset2 are equal. If they are we reached equilibrium so we can just return (localDateTime, offset1). If they are not equal, then we have a cycle because the localDateTime occurred in a DST gap (STD->DST transition) or overlap (DST->STD transition). We arbitrarily pick the offset of the later epochSeconds since that seems to match closely to what most people would expect to happen in a gap or overlap (e.g. In the gap of 2am->3am, a 2:30am would get shifted to 3:30am.)
The code is written slightly ackwardly to try to encourage the compiler to perform Return Value Optimization. For example, I use only a single OffsetDateTime instance, and I don't use early return.
Implements ace_time::ZoneProcessor.
Definition at line 249 of file BasicZoneProcessor.h.
|
inlineoverridevirtual |
Return the total UTC offset at epochSeconds, including DST offset.
Returns TimeOffset::forError() if an error occurs.
Implements ace_time::ZoneProcessor.
Definition at line 201 of file BasicZoneProcessor.h.
|
inlineoverridevirtual |
Return the unique stable zoneId.
Implements ace_time::ZoneProcessor.
Definition at line 199 of file BasicZoneProcessor.h.
|
inlineoverridevirtual |
Return the underlying ZoneInfo.
Implements ace_time::ZoneProcessor.
Definition at line 195 of file BasicZoneProcessor.h.
|
inline |
Used only for debugging.
Definition at line 298 of file BasicZoneProcessor.h.
|
overridevirtual |
Print a short human-readable identifier (e.g.
"Los_Angeles")
Implements ace_time::ZoneProcessor.
Definition at line 16 of file BasicZoneProcessor.cpp.
|
overridevirtual |
Print a human-readable identifier (e.g.
"America/Los_Angeles").
Implements ace_time::ZoneProcessor.
Definition at line 12 of file BasicZoneProcessor.cpp.


|
|||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
| Interface Summary | |
| ConnectionEventLoggingDelegate | Defines API to log connection events. |
| Class Summary | |
| ConnectionWrapper | ConnectionWrapper is a java.sql.Connection implementation that wraps another
Connection, delegating method calls to this connection. |
| ContainerPoolFactory | Basic JNDI object factory that creates an instance of
PoolManager that has been configured based on the
RefAddr values of the specified Reference . |
| DataSourceInfo | Helper JavaBean class that holds DataSource login information. |
| DriverDataSource | A DataSource implementation wrapping a JDBC driver. |
| PoolDataSource | PoolDataSource allows to generate pooled connections. |
| PooledConnectionImpl | PooledConnectionImpl is an implementation of a pooling wrapper for the database connection as per JDBC3 spec. |
| PoolManager | PoolManager is a pooling DataSource impementation. |
Provides full DataSource implementation. Allows to wrap JDBC drivers into a DataSource-compatible classes. Adds features like connection pooling, etc. Can be used as a DataSource implementation with application servers, web containers, etc. For detailed discussion of this topic follow this link to the User Guide.
|
|||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |


`Concurrent::Map` is a hash-like object and should have much better performance characteristics, especially under high concurrency, than `Concurrent::Hash`. However, `Concurrent::Map `is not strictly semantically equivalent to a ruby `Hash` – for instance, it does not necessarily retain ordering by insertion time as `Hash` does. For most uses it should do fine though, and we recommend you consider `Concurrent::Map` instead of `Concurrent::Hash` for your concurrency-safe hash needs.
> require 'concurrent' > > map = ::new
@!visibility private
@!method delete_pair
@!macro map_method_is_atomic
# File lib/concurrent/map.rb, line 81 def initialize(options = nil, &block) if options.kind_of?(::Hash) validate_options_hash!(options) else options = nil end super(options) @default_proc = block end
# File lib/concurrent/map.rb, line 92 def [](key) if value = super # non-falsy value is an existing mapping, return it right away value # re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call # a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value # would be returned) # note: nil == value check is not technically necessary elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL)) @default_proc.call(self, key) else value end end
# File lib/concurrent/map.rb, line 166 def each_key each_pair {|k, v| yield k} end
# File lib/concurrent/map.rb, line 170 def each_value each_pair {|k, v| yield v} end
# File lib/concurrent/map.rb, line 180 def empty? each_pair {|k, v| return false} true end
@!macro [attach] map_method_not_atomic
The "fetch-then-act" methods of `Map` are not atomic. `Map` is intended to be use as a concurrency primitive with strong happens-before guarantees. It is not intended to be used as a high-level abstraction supporting complex operations. All read and write operations are thread safe, but no guarantees are made regarding race conditions between the fetch operation and yielding to the block. Additionally, this method does not support recursion. This is due to internal constraints that are very unlikely to change in the near future.
# File lib/concurrent/map.rb, line 118 def fetch(key, default_value = NULL) if NULL != (value = get_or_default(key, NULL)) value elsif block_given? yield key elsif NULL != default_value default_value else raise_fetch_no_key end end
@!macro map_method_not_atomic
# File lib/concurrent/map.rb, line 131 def fetch_or_store(key, default_value = NULL) fetch(key) do put(key, block_given? ? yield(key) : (NULL == default_value ? raise_fetch_no_key : default_value)) end end
override default inspect() method: firstly, we don't want to be spilling our guts (i-vars), secondly, MRI backend's inspect() call on its @backend i-var will bump @backend's iter level while possibly yielding GVL
# File lib/concurrent/map.rb, line 209 def inspect id_str = (object_id << 1).to_s(16).rjust(DEFAULT_OBJ_ID_STR_WIDTH, '0') "#<#{self.class.name}:0x#{id_str} entries=#{size}<EMAIL_ADDRESS>end
# File lib/concurrent/map.rb, line 174 def key(value) each_pair {|k, v| return k if v == value} nil end
# File lib/concurrent/map.rb, line 154 def keys arr = [] each_pair {|k, v| arr << k} arr end
# File lib/concurrent/map.rb, line 191 def marshal_dump raise TypeError, "can't dump hash with default proc" if @default_proc h = {} each_pair {|k, v| h[k] = v} h end
# File lib/concurrent/map.rb, line 198 def marshal_load(hash) initialize populate_from(hash) end
@!macro map_method_is_atomic
# File lib/concurrent/map.rb, line 138 def put_if_absent(key, value) computed = false result = compute_if_absent(key) do computed = true value end computed ? nil : result end
# File lib/concurrent/map.rb, line 185 def size count = 0 each_pair {|k, v| count += 1} count end
# File lib/concurrent/map.rb, line 147 def value?(value) each_value do |v| return true if value.equal?(v) end false end
# File lib/concurrent/map.rb, line 160 def values arr = [] each_pair {|k, v| arr << v} arr end
# File lib/concurrent/map.rb, line 219 def initialize_copy(other) super populate_from(other) end
# File lib/concurrent/map.rb, line 224 def populate_from(hash) hash.each_pair {|k, v| self[k] = v} self end
# File lib/concurrent/map.rb, line 215 def raise_fetch_no_key raise KeyError, 'key not found' end
# File lib/concurrent/map.rb, line 229 def validate_options_hash!(options) if (initial_capacity = options[:initial_capacity]) && (!initial_capacity.kind_of?(Fixnum) || initial_capacity < 0) raise ArgumentError, ":initial_capacity must be a positive Fixnum" end if (load_factor = options[:load_factor]) && (!load_factor.kind_of?(Numeric) || load_factor <= 0 || load_factor > 1) raise ArgumentError, ":load_factor must be a number between 0 and 1" end end


freeCodeCamp Survey Form
Thank you for taking the time to help us improve the platform
Name
Email
Age (optional)
Which option best describes your current role?
Select current role
Student
Full Time Job
Full Time Learner
Prefer not to say
Other
Would you recommend freeCodeCamp to a friend?
Definitely
Maybe
Not Sure
What is your favourite feature of freeCodeCamp?
Select an option
Challenges
Projects
Community
Open Source
What would you like to see improved? (Check all that apply)
Front-End Projects
Back-End Projects
Data Visualization
Challenges
Open-Source Community
Gitter Help-Rooms
Videos
City-Meetups
Wiki
Forum
Additional Courses
Any comments or suggestions?
Submit


My profile
My Ads
My Car Orders
My Orders
Log Out
Details about the Ad
Thank you for reporting this problem


Photo Credit: The International Phonetic Association
Phonetics
Work
A link to the Phonetics Laboratory at The University of Melbourne
Teaching
Practical Phonetics
- My favourite site for visualising and learning the sounds of the IPA: Seeing Speech
- Lawson, E., Stuart-Smith, J., Scobbie, J. M., Nakai, S., Beavan, D., Edmonds, F., Edmonds, I., Turk, A., Timmins, C., Beck, J., Esling, J., Leplatre, G., Cowen S., Barras, W., Durham, M. (2015). Seeing Speech: an articulatory web resource for the study of Phonetics. University of Glasgow. 1st April 2015. http://www.seeingspeech.ac.uk/
- A great clickable IPA chart on that site that shows MRI, Ultrasound and some animations of the different speech sounds defined by the IPA (IPA Chart)


Drawer Title
subtitle
Drawer content
{{ title }}
ASM - the Android Studio Mobile.
Code, Build, and Run on your mobile device.


I am a Kwadwo, wordering what it means?Well got a chance to visit
Ghana a beautiful African country,interacted with the people and
their way of living.
Something that really struck me was the ways they used to name
new-borns.
Using the Akan names.A child is named according to the day
of the week she/he was born.
Now you know what Kwadwo means.
Fill in the form given with your Birthday
and depending your gender,you'll know the day of
the week you were born and your Akan.
>


London
London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants. Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium. Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium.


Create Product
Name:
Description:
Type:
Choose type...
{{typeOptions}}
Create Product
Back to homepage


|
Aspen MUD
Aspen is a light-weight, barebones mud engine written in c++ utilizing Lua for its' scripting engine.
|
#include <baseSocket.h>
Public Member Functions | |
| BaseSocket (int desc) | |
| virtual int | GetControl (void) const |
| virtual bool | Read () |
| virtual void | Write (const std::string &txt) |
| virtual size_t | Write (const unsigned char *data) |
| virtual size_t | Write (const void *buffer, size_t count) |
| virtual bool | Flush (void) |
| virtual std::string | GetInBuffer (void) |
| virtual void | ClrInBuffer (void) |
| virtual bool | InputPending () const |
| virtual sockaddr_in * | GetAddr () |
| virtual void | SetAddr (sockaddr_in *addr) |
| bool | Close () |
| bool | Connect (const char *address, unsigned short port) |
Protected Attributes | |
| int | _control |
| sockaddr_in | _addr |
| std::string | _inBuffer |
| std::string | _outBuffer |
This class is a basic socket. It contains the underlying logic for the telnet parser.
| BaseSocket::BaseSocket | ( | int | desc | ) |
Constructs a basic socket with a descriptor.
| [in] | desc | The FD to assign to the socket. |
| bool BaseSocket::Close | ( | ) |
Closes the socket, if one is actually open.
|
virtual |
Clears the input buffer.
| bool BaseSocket::Connect | ( | const char * | address, |
| unsigned short | port | ||
| ) |
Creates a socket and connects it to the specified address.
| [in] | address | the address to connect to. |
| [in] | port | the port to connect to. |
|
virtual |
Flushes the sockets output buffer to the client.
Reimplemented in Socket.
|
virtual |
Returns the address of the socket.
|
virtual |
Returns the socket's fd.
|
virtual |
Returns the input buffer.
Reimplemented in Socket.
|
virtual |
Determines whether there is input pending in the buffer.
|
virtual |
Reads the pending data and places it in the sockets input buffer.
Reimplemented in Socket.
|
virtual |
Coppies the address to the socket's address buffer.
| [in] | addr | a pointer to a sockaddr_in structure. |
|
virtual |
Appends the specified to the output buffer.
| [in] | txt | the data to append to the output buffer. |
Reimplemented in Socket.
|
virtual |
Flushes the current buffer and writes len bytes, stored in buffer.
| [in] | buffer | a pointer to the buffer to write. |
| [in] | count | the number of bytes to write. |
Reimplemented in Socket.


This advanced example shows how to process text data with recipes and use them in a predictive model. It also has an example of extracting information from each model fit for later use.
The data are from Amazon:
“This dataset consists of reviews of fine foods from amazon. The data span a period of more than 10 years, including all ~500,000 reviews up to October 2012. Reviews include product and user information, ratings, and a plaintext review.”
A small subset of the data are contained here; we sampled a single review from 5,000 random products and 80% of these data were used as the training set. The remaining 1,000 were used as the test set.
There is a column for the product, a column for the text of the review, and a factor column for a class variable. The outcome is whether the reviewer game the product a five-star rating or not.
library(tidymodels) library(tune) library(modeldata) data("small_fine_foods") training_data #> # A tibble: 4,000 x 3 #> product review score #> <chr> <chr> <fct> #> 1 B000J0LSBG "this stuff is not stuffing its not good at all save yo… other #> 2 B000EYLDYE "I absolutely LOVE this dried fruit. LOVE IT. Whenever I … great #> 3 B0026LIO9A "GREAT DEAL, CONVENIENT TOO. Much cheaper than WalMart and… great #> 4 B00473P8SK "Great flavor, we go through a ton of this sauce! I discove… great #> 5 B001SAWTNM "This is excellent salsa/hot sauce, but you can get it for … great #> 6 B000FAG90U "Again, this is the best dogfood out there.  They pack a lo… great #> 10 B001EO5ZXI "One of the nicest, smoothest cup of chai I've made. Nice m… great #> # … with 3,990 more rows
The idea is to process the text data into features and use these features to predict whether the review was five-star or not.
The data processing steps are:
create an initial set of features based on simple word/character scores, such as the number of words, URLs and so on; The textfeatures
will be used for this
the text is tokenized (i.e. broken into smaller components such as words)
stop words (such as “the”, “an”, etc.) are removed
tokens are stemmed to a common root where possible
tokens are converted to dummy variables via a signed, binary hash function
non-token features are optionally transformed to a more symmetric state using a Yeo-Johnson transformation
predictors with a single distinct value are removed
all predictors are centered and scaled.
Some of these steps may or may not be good ideas (such as stemming). In this process, the main tuning parameter will be the number of feature hash features to use.
A recipe will be used to implement this. We’ll also need some helper objects. For example, for the Yeo-Johnson transformation, we need to know the initial feature set:
library(textfeatures) basics <- names(textfeatures:::count_functions) head(basics) #> [1] "n_words" "n_uq_words" "n_charS" "n_uq_charS" "n_digits" #> [6] "n_hashtags"
Also, the implementation of feature hashes does not produce binary values. This small function will help convert the scores to values of -1, 0, or 1:
The recipe is:
# uses the devel version of textrecipes # devtools::install_github("tidymodels/textrecipes") library(textrecipes) pre_proc <- recipe(score ~ product + review, data = training_data) %>% # Do not use the product ID as a predictor update_role(product, new_role = "id") %>% # Make a copy of the raw text step_mutate(review_raw = review) %>% # Compute the initial features. This removes the `review_raw` column step_textfeature(review_raw) %>% # Make the feature names shorter step_rename_at( starts_with("textfeature_"), fn = ~ gsub("textfeature_review_raw_", "", .) ) %>% step_tokenize(review) %>% step_stopwords(review) %>% step_stem(review) %>% # Here is where the tuning parameter is declared step_texthash(review, signed = TRUE, num_terms = tune()) %>% # Simplify these names step_rename_at(starts_with("review_hash"), fn = ~ gsub("review_", "", .)) %>% # Convert the features from counts to values of -1, 0, or 1 step_mutate_at(starts_with("hash"), fn = binary_hash) %>% # Transform the initial feature set step_YeoJohnson(one_of(!!basics)) %>% step_zv(all_predictors()) %>% step_normalize(all_predictors())
Note that, when objects from the global environment are used, they are injected into the step objects via !!
. For some parallel processing technologies, these objects may not be found by the worker processes.
To model these data, a regularized logistic regression model will be used:
Three tuning parameters should be trained for this data analysis.
There are enough data here such that 10-fold resampling would hold out 400 reviews at a time to estimate performance. Performance estimates using this many observations have sufficiently low noise to measure and tune models.
set.seed(8935) folds <- vfold_cv(training_data)
A regular grid is used. For glmnet
models, evaluating penalty values is fairly cheap due to the use of the “submodel-trick”. The grid will use 20 penalty values, 5 mixture values, and 3 values for the number of hash features.
five_star_grid <- expand.grid( penalty = 10^seq(-3, 0, length = 20), mixture = seq(0, 1, length = 5), num_terms = 2^c(8, 10, 12) )
Note that, for each resample, the text processing recipe is only prepped 6 times. This increases the computational efficiency of the analysis by avoiding redundant work.
For illustration, we will save information on the number of predictors by penalty value for each glmnet
model. This might help use understand how many features were used across the penalty values. An extraction function is used to do this:
glmnet_vars <- function(x) { # `x` will be a workflow object mod <- extract_model(x) # `df` is the number of model terms for each penalty value tibble(penalty = mod$lambda, num_vars = mod$df) } ctrl <- control_grid(extract = glmnet_vars)
Finally, let’s run the grid search:
roc_scores <- metric_set(roc_auc) set.seed(1559) five_star_glmnet <- tune_grid(lr_mod, pre_proc, resamples = folds, grid = five_star_grid, metrics = roc_scores, control = ctrl)
This took a while to complete. What did the results look like? Let’s get the resampling estimates of the area under the ROC curve for each tuning parameter:
grid_roc <- collect_metrics(five_star_glmnet) %>% arrange(desc(mean)) grid_roc #> # A tibble: 300 x 8 #> penalty mixture num_terms .metric .estimator mean n std_err #> <dbl> <dbl> <dbl> <chr> <chr> <dbl> <int> <dbl> #> 1 0.0379 0.25 4096 roc_auc binary 0.816 10 0.00753 #> 2 0.0183 0.5 4096 roc_auc binary 0.814 10 0.00776 #> 3 0.0127 0.75 4096 roc_auc binary 0.814 10 0.00781 #> 4 0.00886 1 4096 roc_auc binary 0.813 10 0.00794 #> 5 0.0264 0.25 4096 roc_auc binary 0.813 10 0.00790 #> 6 0.0546 0.25 4096 roc_auc binary 0.811 10 0.00805 #> 7 0.0127 0.5 4096 roc_auc binary 0.811 10 0.00810 #> 8 0.00886 0.75 4096 roc_auc binary 0.810 10 0.00803 #> 9 0.0264 0.5 4096 roc_auc binary 0.810 10 0.00812 #> 10 0.0127 1 4096 roc_auc binary 0.810 10 0.00808 #> # … with 290 more rows
The best results had a fairly high penalty value and focused on the ridge penalty (i.e. no feature selection via the lasso’s L1 penalty). The best solutions also used the largest number of hashing features.
What was the relationship between performance and the tuning parameters?
autoplot(five_star_glmnet, metric = "roc_auc")
There is definitely an effect due to the number of features used1. The profiles with mixture values greater than zero had steep drop-offs in performance. What’s that about? Those are cases where the lasso penalty is removing too many (and perhaps all) features from the model2.
It’s clear from the panels at least 4096 features that there are several parameter combinations that have roughly equivalent performance. A case could be made to choose a larger mixture value and less of a penalty to select a more simplistic model that contains fewer predictors. If more experimentation were conducted, a largest set of features should also be considered.
We’ll come back to the extracted glmnet
components at the end of this example.
What if we had started with Bayesian optimization? Would a good set of conditions have been found more efficiently?
Let’s pretend that we haven’t seen the grid search results. We’ll initialize the Gaussian process model with five tuning parameter combinations chosen with a space-filling design.
It might be good to use a custom dials
object for the number of hash terms. The default object, num_terms()
, uses a linear range and tries to set the upper bound of the parameter using the data. Instead, let’s create a parameter set, change the scale to be log2, and define the same range as was used in grid search.
hash_range <- num_terms(c(8, 12), trans = log2_trans())
To use this, we have to merge the recipe and parsnip
model object into a workflow:
library(workflows) five_star_wflow <- workflow() %>% add_recipe(pre_proc) %>% add_model(lr_mod)
Then we can extract and manipulate the corresponding parameter set:
five_star_set <- five_star_wflow %>% parameters() %>% update( num_terms = hash_range, penalty = penalty(c(-3, 0)), mixture = mixture(c(0.05, 1.00)) )
This is passed to the search function via the param_info
argument.
Finally, the initial rounds of search can be biased more towards exploration of the parameter space (as opposed to staying near the current best results).  No improvement for 10 iterations; returning current results.
The results show some improvement over the initial set. One issue is that so many settings are sub-optimal (as shown in the figure above for grid search) so there are poor results periodically. There are regions where the penalty parameter becomes too large and all of the predictors are removed from the model. These regions are also dependent on the number of terms. There is a fairly narrow ridge4 where good performance can be achieved. Using more iterations would probably result in the search finding better results.
A plot of model performance versus the search iterations:
autoplot(five_star_search, type = "performance")
What would we do if we knew about the grid search results? In this case, we would restrict the range for the number of hash features to be larger (especially with more data). We might also restrict the penalty and mixture parameters to have a more restricted upper bound.
Jumping back to the grid search results, let’s examine the results of our extract
function. For each fitted model, a tibble was saved that has the relationship between the number of predictors and the penalty value. Let’s look at these results for the best model:
params <- select_best(five_star_glmnet, metric = "roc_auc") params #> # A tibble: 1 x 3 #> penalty mixture num_terms #> <dbl> <dbl> <dbl> #> 1 0.0379 0.25 4096
Recall that we saved the glmnet
results in a tibble. The column five_star_glmnet$.extracts
is a list of tibbles.  Let’s unnest five_star_glmnet$.extracts
:
library(tidyr) extracted <- five_star_glmnet %>% dplyr::select(id, .extracts) %>% unnest(cols = .extracts) extracted #> # A tibble: 150 x 5 #> id num_terms penalty mixture .extracts #> <chr> <dbl> <dbl> <dbl> <list> #> 1 Fold01 256 1 0 <tibble [100 × 2]> #> 2 Fold01 256 1 0.25 <tibble [89 × 2]> #> 3 Fold01 256 1 0.5 <tibble [82 × 2]> #> 4 Fold01 256 1 0.75 <tibble [69 × 2]> #> 5 Fold01 256 1 1 <tibble [70 × 2]> #> 6 Fold01 1024 1 0 <tibble [100 × 2]> #> 7 Fold01 1024 1 0.25 <tibble [100 × 2]> #> 8 Fold01 1024 1 0.5 <tibble [100 × 2]> #> 9 Fold01 1024 1 0.75 <tibble [98 × 2]> #> 10 Fold01 1024 1 1 <tibble [97 × 2]> #> # … with 140 more rows
One thing to realize here is that tune_grid()
may not fit all of the models that are evaluated. In this case, for each value of mixture
and num_terms
, the model is fit overall all penalty values5. To select the best parameter set, we can exclude the penalty
column in extracted
:
extracted <- extracted %>% dplyr::select(-penalty) %>% inner_join(params, by = c("num_terms", "mixture")) %>% # Now remove it from the final results dplyr::select(-penalty) extracted #> # A tibble: 10 x 4 #> id num_terms mixture .extracts #> <chr> <dbl> <dbl> <list> #> 1 Fold01 4096 0.25 <tibble [100 × 2]> #> 2 Fold02 4096 0.25 <tibble [100 × 2]> #> 3 Fold03 4096 0.25 <tibble [100 × 2]> #> 4 Fold04 4096 0.25 <tibble [100 × 2]> #> 5 Fold05 4096 0.25 <tibble [100 × 2]> #> 6 Fold06 4096 0.25 <tibble [100 × 2]> #> 7 Fold07 4096 0.25 <tibble [100 × 2]> #> 8 Fold08 4096 0.25 <tibble [100 × 2]> #> 9 Fold09 4096 0.25 <tibble [100 × 2]> #> 10 Fold10 4096 0.25 <tibble [100 × 2]>
Now we can get at the results that we want using another unnest
:
extracted <- extracted %>% unnest(col = .extracts) # <- these contain a `penalty` column extracted #> # A tibble: 1,000 x 5 #> id num_terms mixture penalty num_vars #> <chr> <dbl> <dbl> <dbl> <int> #> 1 Fold01 4096 0.25 0.360 0 #> 2 Fold01 4096 0.25 0.344 1 #> 3 Fold01 4096 0.25 0.328 2 #> 4 Fold01 4096 0.25 0.313 2 #> 5 Fold01 4096 0.25 0.299 3 #> 6 Fold01 4096 0.25 0.286 3 #> 7 Fold01 4096 0.25 0.273 4 #> 8 Fold01 4096 0.25 0.260 5 #> 9 Fold01 4096 0.25 0.248 7 #> 10 Fold01 4096 0.25 0.237 7 #> # … with 990 more rows
Let’s look at a plot of these results (per resample):
ggplot(extracted, aes(x = penalty, y = num_vars)) + geom_line(aes(group = id, col = id), alpha = .5) + ylab("Number of retained predictors") + scale_x_log10() + ggtitle(paste("mixture = ", params$mixture, "and", params$num_terms, "features")) + theme(legend.position = "none")
These results might help guide the range of the penalty
value if more optimization was conducted.
This is a small sample of the overall data set. When more data are used, a larger feature set is optimal.↩
See the last section below for more details.↩
See the vignette on acquisition functions for more details.↩
Sorry, pun intended.↩
This is a feature of this particular model and is not generally true for other engines.↩


Error: $status
$userMessage
Sorry about that. Please try to
reload
,
go back
or
go to start
details
$details


Before Change
// Get ids to assign to the output sequences in the result Alignment object
seq1_id, seq2_id = _get_seq_ids(seq1, seq2)
return Alignment(
[BiologicalSequence(aligned1, id=seq1_id),
BiologicalSequence(aligned2, id=seq2_id)],
score=score, start_end_positions=start_end_positions)
// Functions from here allow for generalized (global or local) alignment. I
// will likely want to put these in a single object to make the naming a little
// less clunky.
After Change
"to track progress on this).", EfficiencyWarning)
if isinstance(seq1, unicode) or isinstance(seq1, str):
seq1 = Alignment([BiologicalSequence(seq1)])
elif isinstance(seq1, BiologicalSequence):
seq1 = Alignment([seq1])
else:
pass


Jenkins on Azure
Building a browser-based test automation server with Jenkins on Azure by using SeleniumBase¶
Step 0. Fork the SeleniumBase repo on GitHub to get started quickly.¶
- (You'll be using your own repository eventually.)
Step 1. Find Jenkins in the Azure Marketplace¶
Search for "Jenkins" in the Azure Marketplace and select the Jenkins (Publisher: Microsoft)
result to get to the Jenkins Start page.¶
Step 2. Launch a Jenkins instance¶
Click "Create" and follow the steps...¶
Continue to "Additional Settings" when you're done with "Basics".¶
On the "Additional Settings" section, set the Size to "B2s":¶
Once you've reached Step 5, click "Create" to complete the setup.¶
Step 3. Inspect your new Jenkins instance to SSH into the new machine¶
Once your new Jenkins instance has finished launching, you should be able to see the main page¶
On the main page, you should be able to find the Public IP Address.¶
- Use that IP Address to SSH into the machine:
ssh USERNAME@IP_ADDRESS
Step 4. Clone the SeleniumBase repository from the root ("/") directory.¶
cd /
sudo git clone https://github.com/seleniumbase/SeleniumBase.git
Step 5. Enter the "linux" folder¶
cd SeleniumBase/integrations/linux/
Step 6. Give the "jenkins" user sudo access (See jenkins_permissions.sh for details)¶
./jenkins_permissions.sh
Step 7. Become the "jenkins" user and enter a "bash" shell¶
sudo su jenkins
bash
Step 8. Install dependencies (See Linuxfile.sh for details)¶
./Linuxfile.sh
Step 9. Start up the headless browser display mechanism: Xvfb (See Xvfb_launcher.sh for details)¶
./Xvfb_launcher.sh
Step 10. Go to the SeleniumBase directory¶
cd /SeleniumBase
Step 11. Install the requirements for SeleniumBase¶
sudo pip install -r requirements.txt --upgrade
Step 12. Install SeleniumBase (Make sure you already installed the requirements above)¶
sudo python setup.py develop
Step 13. Install chromedriver¶
sudo seleniumbase install chromedriver
Step 14. Run an example test in Chrome to verify installation (May take up to 10 seconds)¶
pytest examples/my_first_test.py --headless --browser=chrome
Step 15. Secure your Jenkins machine¶
Navigate to http://JENKINS_IP_ADDRESS/jenkins-on-azure/¶
(Depending on your version of Jenkins, you may see the following screen, or nothing at all.)
Initially, Jenkins uses only http
, which makes it less secure.¶
You'll need to set up SSH Port Forwarding in order to secure it.¶
- To do this, copy/paste the string and run it in a NEW command prompt on your local machine (NOT from an SSH terminal session), swapping out the username and DNS name with the ones you set up when creating the Jenkins instance in Azure.
ssh -L <IP_ADDRESS>:8080:localhost:8080 USERNAME@DNS_NAME
Step 16. Login to Jenkins¶
If you've correctly set up SSH Port Forwarding, the url will be http://<IP_ADDRESS>:8080/
¶
You'll need to get the password from the SSH terminal on the Linux machine to log in¶
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Step 17. Customize Jenkins¶
Step 18. Create an Admin user¶
Once Jenkins has finished loading, the top left of the page should look like this¶
Step 19. Create a new Jenkins job¶
- Click on "New Item"
- Give your new Jenkins job a name (ex: "Test1")
- Select "Freestyle project"
- Click "OK"
Step 20. Setup your new Jenkins job¶
- Under "Source Code Management", select "Git".
- For the "Repository URL", put:
https://github.com/seleniumbase/SeleniumBase.git
. (You'll eventually be using your own clone of the repository here.)
- Under "Build", click the "Add build step" dropdown.
- Select "Execute shell".
- For the "Command", paste:
cd examples
pytest my_first_test.py --headless
Click "Save" when you're done.¶
- You'll see the following page after that:
Step 21. Run your new Jenkins job¶
- Click on "Build Now"
- (If everything was done correctly, you'll see a blue dot appear after a few seconds, indicating that the test job passed.)
Step 22. See the top Jenkins page for an overview of all jobs¶
Step 23. Future Work¶
If you have a web application that you want to test, you'll be able to create SeleniumBase tests and add them to Jenkins as you saw here. You may want to create a Deploy job, which downloads the latest version of your repository, and then kicks off all tests to run after that. You could then tell that Deploy job to auto-run whenever a change is pushed to your repository by using: "Poll SCM". All your tests would then be able to run by using: "Build after other projects are built".


--- layout: default title: Home tag: full_width ---
The Sensu Plugins Project contains plugins, handlers, mutators and other code to maximize the effective use of Sensu in various types of auto-scaling and traditional environments. Sensu itself is agnostic to the language of the code it executes, though most are implemented in Ruby and use the sensu-plugin gem while some others are written in Python using sensu-plugin-python. Anyone and everyone working to make monitoring simple and code reusable are welcome in our community.


10.6. Collision Resolution (WORK IN PROGRESS)¶
10.6.1. Collision Resolution¶
We now turn to the most commonly used form of hashing: closed hashing with no bucketing, and a collision resolution policy that can potentially use any slot in the hash table.
During insertion, the goal of collision resolution is to find a free slot in the hash table when the home position for the record is already occupied. We can view any collision resolution method as generating a sequence of hash table slots that can potentially hold the record. The first slot in the sequence will be the home position for the key. If the home position is occupied, then the collision resolution policy goes to the next slot in the sequence. If this is occupied as well, then another slot must be found, and so on. This sequence of slots is known as the probe sequence, and it is generated by some probe function that we will call p. Insertion works as follows.
// Insert e into hash table HT
void hashInsert(Key k, Elem e) {
int home; // Home position for e
int pos = home = h(k); // Init probe sequence
for (int i=1; EMPTYKEY != (HT[pos]).key(); i++) {
if (k == HT[pos].key()) {
println("Duplicates not allowed");
return;
}
pos = (home + p(k, i)) % M; // probe
}
HT[pos] = e;
}
# Insert e into hash table HT
def hashInsert(k, e):
int home = h(k) # Home position for e
int pos = home # Init probe sequence
i = 1
while EMPTYKEY != HT[pos].key():
if k == HT[pos].key():
raise ValueError("Duplicates not allowed")
pos = (home + p(k, i)) % M # probe
HT[pos] = e
Method hashInsert
first checks to see if the home slot for the
key is empty.
If the home slot is occupied, then we use the probe function
\(\textbf{p}(k, i)\) to locate a free slot in the table.
Function p has two parameters, the key \(k\) and a
count \(i\) of where in the probe sequence we wish to be.
That is, to get the first position in the probe sequence after the
home slot for key \(K\), we call \(\textbf{p}(K, 1)\).
For the next slot in the probe sequence, call \(\textbf{p}(K, 2)\).
Note that the probe function returns an offset from the original home
position, rather than a slot in the hash table.
Thus, the for
loop in hashInsert
is computing positions
in the table at each iteration by adding the value returned from the
probe function to the home position.
The \(i\) th call to p returns the \(i\) th offset to be used.
Searching in a hash table follows the same probe sequence that was followed when inserting records. In this way, a record not in its home position can be recovered. An implementation for the search procedure is as follows.
// Search for the record with Key K
bool hashSearch(Key K, Elem e) {
int home; // Home position for K
int pos = home = h(K); // Initial position is the home slot
for (int i = 1;
(K != (HT[pos]).key()) && (EMPTYKEY != (HT[pos]).key());
i++) {
pos = (home + p(K, i)) % M; // Next on probe sequence
}
if (K == (HT[pos]).key()) { // Found it
e = HT[pos];
return true;
}
else { return false; } // K not in hash table
}
# Search for the record with Key K
def hashSearch(K, e):
home = h(K) # Home position for K
pos = home # Initial position is the home slot
i = 1
while K != HT[pos]).key() and EMPTYKEY != HT[pos]).key():
pos = (home + p(K, i)) % M # Next on probe sequence
i += 1
if K == HT[pos].key() # Found it
e = HT[pos]
return True
else:
return False # K not in hash table
Both the insert and the search routines assume that at least one slot on the probe sequence of every key will be empty. Otherwise they will continue in an infinite loop on unsuccessful searches. Thus, the hash system should keep a count of the number of records stored, and refuse to insert into a table that has only one free slot.
The simplest approach to collsion resolution is simply to move down the table from the home slot until a free slot is found. This is known as linear probing. The probe function for simple linear probing is \(\textbf{p}(K, i) = i\). That is, the \(i\) th offset on the probe sequence is just \(i\), meaning that the \(i\) th step is simply to move down \(i\) slots in the table. Once the bottom of the table is reached, the probe sequence wraps around to the beginning of the table (since the last step is to mod the result to the table size). Linear probing has the virtue that all slots in the table will be candidates for inserting a new record before the probe sequence returns to the home position.
Can you see any reason why this might not be the best approach to collision resolution?
<IP_ADDRESS>. The Problem with Linear Probing¶
While linear probing is probably the first idea that comes to mind when considering collision resolution policies, it is not the only one possible. Probe function p allows us many options for how to do collision resolution. In fact, linear probing is one of the worst collision resolution methods. The main problem is illustrated by the next slideshow.
Again, the ideal behavior for a collision resolution mechanism is that each empty slot in the table will have equal probability of receiving the next record inserted (assuming that every slot in the table has equal probability of being hashed to initially). This tendency of linear probing to cluster items together is known as primary clustering. Small clusters tend to merge into big clusters, making the problem worse. The objection to primary clustering is that it leads to long probe sequences.


OpenMPF
Home
General
Release Notes
License and Distribution
Acknowledgements
Guides
Install Guide
Admin Guide
User Guide
Media Segmentation Guide
Feed Forward Guide
Derivative Media Guide
Object Storage Guide
Markup Guide
TiesDb Guide
REST API
Component Development
Component API Overview
Component Descriptor Reference
C++ Batch Component API
Python Batch Component API
Java Batch Component API
GPU Support Guide
Additional Developer Resources
Contributor Guide
Development Environment Guide
Node Guide
Workflow Manager Architecture
C++ Streaming Component API
OpenMPF
Docs
»
404
Page not found


Apply for help to pay for NHS costs
If you have little money to live off, help is available to pay for things like prescriptons, dental treatment and glasses.
The actual amount you get depends on your income, personal circumstances and outgoings, like council tax and housing costs.
If you qualify you, your partner and your children may get help to pay for:
- NHS dental check-ups and treatments
- NHS prescriptions
- NHS wigs and fabric supports
- sight tests, glasses and contact lenses
- travel to hospital to receive NHS treatment
Are you already entitled to help?
You can already claim help with health costs if you have an NHS Tax Credit Exemption Certificate or get any of these benefits:
Income Support Pension Credit Guarantee Credit Universal Credit Start now