apache_beam.io.gcp.bigquery module¶
BigQuery sources and sinks.
This module implements reading from and writing to BigQuery tables. It relies on several classes exposed by the BigQuery API: TableSchema, TableFieldSchema, TableRow, and TableCell. The default mode is to return table rows read from a BigQuery source as dictionaries. Similarly a Write transform to a BigQuerySink accepts PCollections of dictionaries. This is done for more convenient programming. If desired, the native TableRow objects can be used throughout to represent rows (use an instance of TableRowJsonCoder as a coder argument when creating the sources or sinks respectively).
Also, for programming convenience, instances of TableReference and TableSchema have a string representation that can be used for the corresponding arguments:
- TableReference can be a PROJECT:DATASET.TABLE or DATASET.TABLE string.
- TableSchema can be a NAME:TYPE{,NAME:TYPE}* string (e.g. ‘month:STRING,event_count:INTEGER’).
The syntax supported is described here: https://cloud.google.com/bigquery/bq-command-line-tool-quickstart
BigQuery sources can be used as main inputs or side inputs. A main input (common case) is expected to be massive and will be split into manageable chunks and processed in parallel. Side inputs are expected to be small and will be read completely every time a ParDo DoFn gets executed. In the example below the lambda function implementing the DoFn for the Map transform will get on each call one row of the main table and all rows of the side table. The runner may use some caching techniques to share the side inputs between calls in order to avoid excessive reading::
main_table = pipeline | 'VeryBig' >> beam.io.Read(beam.io.BigQuerySource()
side_table = pipeline | 'NotBig' >> beam.io.Read(beam.io.BigQuerySource()
results = (
main_table
| 'ProcessData' >> beam.Map(
lambda element, side_input: ..., AsList(side_table)))
There is no difference in how main and side inputs are read. What makes the side_table a ‘side input’ is the AsList wrapper used when passing the table as a parameter to the Map transform. AsList signals to the execution framework that its input should be made available whole.
The main and side inputs are implemented differently. Reading a BigQuery table as main input entails exporting the table to a set of GCS files (currently in JSON format) and then processing those files. Reading the same table as a side input entails querying the table for all its rows. The coder argument on BigQuerySource controls the reading of the lines in the export files (i.e., transform a JSON object into a PCollection element). The coder is not involved when the same table is read as a side input since there is no intermediate format involved. We get the table rows directly from the BigQuery service with a query.
Users may provide a query to read from rather than reading all of a BigQuery table. If specified, the result obtained by executing the specified query will be used as the data of the input transform.:
query_results = pipeline | beam.io.Read(beam.io.BigQuerySource(
query='SELECT year, mean_temp FROM samples.weather_stations'))
When creating a BigQuery input transform, users should provide either a query or a table. Pipeline construction will fail with a validation error if neither or both are specified.
Time partitioned tables
BigQuery sink currently does not fully support writing to BigQuery time partitioned tables. But writing to a single partition may work if that does not involve creating a new table (for example, when writing to an existing table with create_disposition=CREATE_NEVER and write_disposition=WRITE_APPEND). BigQuery source supports reading from a single time partition with the partition decorator specified as a part of the table identifier.
* Short introduction to BigQuery concepts * Tables have rows (TableRow) and each row has cells (TableCell). A table has a schema (TableSchema), which in turn describes the schema of each cell (TableFieldSchema). The terms field and cell are used interchangeably.
- TableSchema: Describes the schema (types and order) for values in each row.
- Has one attribute, ‘field’, which is list of TableFieldSchema objects.
- TableFieldSchema: Describes the schema (type, name) for one field.
- Has several attributes, including ‘name’ and ‘type’. Common values for the type attribute are: ‘STRING’, ‘INTEGER’, ‘FLOAT’, ‘BOOLEAN’. All possible values are described at: https://cloud.google.com/bigquery/preparing-data-for-bigquery#datatypes
- TableRow: Holds all values in a table row. Has one attribute, ‘f’, which is a
- list of TableCell instances.
- TableCell: Holds the value for one cell (or field). Has one attribute,
- ‘v’, which is a JsonValue instance. This class is defined in apitools.base.py.extra_types.py module.
-
class
apache_beam.io.gcp.bigquery.
TableRowJsonCoder
(table_schema=None)[source]¶ Bases:
apache_beam.coders.coders.Coder
A coder for a TableRow instance to/from a JSON string.
Note that the encoding operation (used when writing to sinks) requires the table schema in order to obtain the ordered list of field names. Reading from sources on the other hand does not need the table schema.
-
class
apache_beam.io.gcp.bigquery.
BigQueryDisposition
[source]¶ Bases:
object
Class holding standard strings used for create and write dispositions.
-
CREATE_NEVER
= 'CREATE_NEVER'¶
-
CREATE_IF_NEEDED
= 'CREATE_IF_NEEDED'¶
-
WRITE_TRUNCATE
= 'WRITE_TRUNCATE'¶
-
WRITE_APPEND
= 'WRITE_APPEND'¶
-
WRITE_EMPTY
= 'WRITE_EMPTY'¶
-
-
class
apache_beam.io.gcp.bigquery.
BigQuerySource
(table=None, dataset=None, project=None, query=None, validate=False, coder=None, use_standard_sql=False, flatten_results=True)[source]¶ Bases:
apache_beam.runners.dataflow.native_io.iobase.NativeSource
A source based on a BigQuery table.
Initialize a
BigQuerySource
.Parameters: - table (str) – The ID of a BigQuery table. If specified all data of the
table will be used as input of the current source. The ID must contain
only letters
a-z
,A-Z
, numbers0-9
, or underscores_
. If dataset and query arguments areNone
then the table argument must contain the entire table reference specified as:'DATASET.TABLE'
or'PROJECT:DATASET.TABLE'
. - dataset (str) – The ID of the dataset containing this table or
None
if the table reference is specified entirely by the table argument or a query is specified. - project (str) – The ID of the project containing this table or
None
if the table reference is specified entirely by the table argument or a query is specified. - query (str) – A query to be used instead of arguments table, dataset, and project.
- validate (bool) – If
True
, various checks will be done when source gets initialized (e.g., is table present?). This should beTrue
for most scenarios in order to catch errors as early as possible (pipeline construction instead of pipeline execution). It should beFalse
if the table is created during pipeline execution by a previous step. - coder (Coder) – The coder for the table
rows if serialized to disk. If
None
, then the default coder isRowAsDictJsonCoder
, which will interpret every line in a file as a JSON serialized dictionary. This argument needs a value only in special cases when returning table rows as dictionaries is not desirable. - use_standard_sql (bool) – Specifies whether to use BigQuery’s standard SQL
dialect for this query. The default value is
False
. If set toTrue
, the query will use BigQuery’s updated SQL dialect with improved standards compliance. This parameter is ignored for table inputs. - flatten_results (bool) – Flattens all nested and repeated fields in the
query results. The default value is
True
.
Raises: ValueError
– if any of the following is true:- the table reference as a string does not match the expected format
- neither a table nor a query is specified
- both a table and a query is specified.
-
format
¶ Source format name required for remote execution.
- table (str) – The ID of a BigQuery table. If specified all data of the
table will be used as input of the current source. The ID must contain
only letters
-
class
apache_beam.io.gcp.bigquery.
BigQuerySink
(table, dataset=None, project=None, schema=None, create_disposition='CREATE_IF_NEEDED', write_disposition='WRITE_EMPTY', validate=False, coder=None)[source]¶ Bases:
apache_beam.runners.dataflow.native_io.iobase.NativeSink
A sink based on a BigQuery table.
Initialize a BigQuerySink.
Parameters: - table (str) – The ID of the table. The ID must contain only letters
a-z
,A-Z
, numbers0-9
, or underscores_
. If dataset argument isNone
then the table argument must contain the entire table reference specified as:'DATASET.TABLE'
or'PROJECT:DATASET.TABLE'
. - dataset (str) – The ID of the dataset containing this table or
None
if the table reference is specified entirely by the table argument. - project (str) – The ID of the project containing this table or
None
if the table reference is specified entirely by the table argument. - schema (str) – The schema to be used if the BigQuery table to write has
to be created. This can be either specified as a
TableSchema
object or a single string of the form'field1:type1,field2:type2,field3:type3'
that defines a comma separated list of fields. Here'type'
should specify the BigQuery type of the field. Single string based schemas do not support nested fields, repeated fields, or specifying a BigQuery mode for fields (mode will always be set to'NULLABLE'
). - create_disposition (BigQueryDisposition) –
A string describing what happens if the table does not exist. Possible values are:
BigQueryDisposition.CREATE_IF_NEEDED
: create if does not exist.BigQueryDisposition.CREATE_NEVER
: fail the write if does not exist.
- write_disposition (BigQueryDisposition) –
A string describing what happens if the table has already some data. Possible values are:
BigQueryDisposition.WRITE_TRUNCATE
: delete existing rows.BigQueryDisposition.WRITE_APPEND
: add to existing rows.BigQueryDisposition.WRITE_EMPTY
: fail the write if table not empty.
- validate (bool) – If
True
, various checks will be done when sink gets initialized (e.g., is table present given the disposition arguments?). This should beTrue
for most scenarios in order to catch errors as early as possible (pipeline construction instead of pipeline execution). It should beFalse
if the table is created during pipeline execution by a previous step. - coder (Coder) – The coder for the
table rows if serialized to disk. If
None
, then the default coder isRowAsDictJsonCoder
, which will interpret every element written to the sink as a dictionary that will be JSON serialized as a line in a file. This argument needs a value only in special cases when writing table rows as dictionaries is not desirable.
Raises: TypeError
– if the schema argument is not astr
or aTableSchema
object.ValueError
– if the table reference as a string does not match the expected format.
-
format
¶ Sink format name required for remote execution.
- table (str) – The ID of the table. The ID must contain only letters
-
class
apache_beam.io.gcp.bigquery.
WriteToBigQuery
(table, dataset=None, project=None, schema=None, create_disposition='CREATE_IF_NEEDED', write_disposition='WRITE_APPEND', batch_size=None, test_client=None)[source]¶ Bases:
apache_beam.transforms.ptransform.PTransform
Initialize a WriteToBigQuery transform.
Parameters: - table (str) – The ID of the table. The ID must contain only letters
a-z
,A-Z
, numbers0-9
, or underscores_
. If dataset argument isNone
then the table argument must contain the entire table reference specified as:'DATASET.TABLE'
or'PROJECT:DATASET.TABLE'
. - dataset (str) – The ID of the dataset containing this table or
None
if the table reference is specified entirely by the table argument. - project (str) – The ID of the project containing this table or
None
if the table reference is specified entirely by the table argument. - schema (str) – The schema to be used if the BigQuery table to write has to
be created. This can be either specified as a
TableSchema
object or a single string of the form'field1:type1,field2:type2,field3:type3'
that defines a comma separated list of fields. Here'type'
should specify the BigQuery type of the field. Single string based schemas do not support nested fields, repeated fields, or specifying a BigQuery mode for fields (mode will always be set to'NULLABLE'
). - create_disposition (BigQueryDisposition) –
A string describing what happens if the table does not exist. Possible values are:
BigQueryDisposition.CREATE_IF_NEEDED
: create if does not exist.BigQueryDisposition.CREATE_NEVER
: fail the write if does not exist.
- write_disposition (BigQueryDisposition) –
A string describing what happens if the table has already some data. Possible values are:
BigQueryDisposition.WRITE_TRUNCATE
: delete existing rows.BigQueryDisposition.WRITE_APPEND
: add to existing rows.BigQueryDisposition.WRITE_EMPTY
: fail the write if table not empty.
For streaming pipelines WriteTruncate can not be used.
- batch_size (int) – Number of rows to be written to BQ per streaming API insert.
- test_client – Override the default bigquery client used for testing.
-
static
get_table_schema_from_string
(schema)[source]¶ Transform the string table schema into a
TableSchema
instance.Parameters: schema (str) – The sting schema to be used if the BigQuery table to write has to be created. Returns: The schema to be used if the BigQuery table to write has to be created but in the TableSchema
format.Return type: TableSchema
-
static
table_schema_to_dict
(table_schema)[source]¶ Create a dictionary representation of table schema for serialization
-
static
get_dict_table_schema
(schema)[source]¶ Transform the table schema into a dictionary instance.
Parameters: schema (TableSchema) – The schema to be used if the BigQuery table to write has to be created. This can either be a dict or string or in the TableSchema format. Returns: The schema to be used if the BigQuery table to write has to be created but in the dictionary format. Return type: Dict[str, Any]
- table (str) – The ID of the table. The ID must contain only letters


Skateboarding has been one of my favorite hobbies since I was 13 years old.
I even started a skateboarding company of my own.
It was named Skelter Skateboards.
It was an amazing experience.
Saint Louis Skateboarding
JB Skatepark
I also grew up skateboarding in Illinois
As well as a lot of traveling, mostly to the south but some of the east coas as well.


Mock objects that implement many of the Servlet and Http Servlet interfaces. These classes allow for the standalone testing of ActionBeans in their native habitat without the need to deploy anything to a Servlet container.
The two classes of most interest are
MockServletContext
which provides a
simple mock implementation of a servlet context that can accept requests and process them,
and
MockRoundtrip
which encapsulates several mock objects to provide an easy to use
interface to generate a request to an ActionBean, process it and then verify the results.


COMA (1978) A Film Review Copyright Dragan Antulov 1999
There are some films that resemble quality wines - they get better with each passing year and decade. But few of them could enjoy such favourable fate because they became more frightening for future generations than for their contemporaries. One of such cases is COMA, 1978 thriller by Michael Chricton. In its time, it was branded as science fiction by most critics, even those very familiar with the genre. But today, nobody would dare to do it, because some of the future predictions in this film became chillingly accurate. Which, of course, makes this film even more scary.
The script, written also by Michael Chricton, was based on the best-selling novel by Robin Cook, author of many successful medical thrillers. The movie protagonist is Doctor Susan Wheeler (played by Genevieve Bujold), young doctor in big Boston hospital. During her practice, she begins noticing a strange pattern of young and healthy patients falling into unexplained coma during the routine surgeries. She begins to investigate, although everyone, including her boyfriend and colleague Doctor Marc Bellows (played by Michael Douglas), doesn't believe her claims about all those cases being connected. Actually, the cause of that phenomenon becomes even more sinister after Doctor Wheeler survives an attempt on her life. Finally motivated to push through the bitter end, she begins to reveal the shocking truth.
COMA is just another example for all those film critics of today who consider 1970s to be the Golden Age of world cinema. That time period was very fruitful for many movie directors who had made many great films, only to deliver disappointments in the latter decades. Michael Chricton, acclaimed novelist, screenwriter and director was one of them, reaching the peak of his film career in 1970s. Many, including the author of this review, would claim that COMA happens to be his best film. One of the reason for that is Crichton's medical background that provided him an opportunity to create realistic settings and characters (same as with his hit TV-show ER two decades later). As a result, COMA is a film with very plausible plot and convincing characters. And the realism worked very well in order to create extremely scary atmosphere - the hospital, institution where the people are supposed to be safer than in all other places, is suddenly turned into place of unimaginable horrors. The movie is even more scarier than cult horrors that used to be very popular in those days; few people could imagine themselves being attacked by sharks or stalked by axe murderers and supernatural demons, but almost everyone could expect himself to end in hospital, helpless and totally at the mercy of people in white coats. Scariness also sprang from the widespread feeling of post-Watergate paranoia, when every segment of the establishment, including even the medical profession, caused suspicion about its good intentions or scruples.
Crichton's direction in this film is almost flawless. He presents the scenes of Doctor Wheeler's boring and totally unexciting domestic and professional every day life, shot in almost quasi-documentary fashion, and quickly replaces them with the breath-taking scenes of suspense. Doctor Wheeler's battle with the assassin in the dark corridors and autopsy room is one of those scenes that leave strong impact on the viewers. And the truth, being finally revealed in the Jefferson Institute, is one of the most memorable and frightening images in the history of cinema. The movie was deliberately left without original musical score for most of its part, except in the suspense scenes, when always reliable Jerry Goldsmith provides needed audio stimuli for suspense and horror.
Acting talent in this film is excellent. Genevieve Bujold was very well cast as a heroine of this film. She portrays Doctor Wheeler as a liberated, professional woman of 1970s, strong and stubborn, and yet vulnerable because of her physical limitations. In many ways she resembles Sigourney Weaver as Ripley in ALIEN, another feminist action hero faced with unspeakable horrors. The other actors mostly fill the blanks - Michael Douglas is, at best, passable as her romantic interest. Richard Widmark is good as Doctor Wheeler's mentor. The movie also shows many future stars and respected actors like Ed Harris and Tom Selleck in small roles, although the latter one looks rather lame.
That wasn't the only flaw of this film. The plot worked very well until the very end, with the unexpected plot twist which had reduced Doctor Wheeler from the heroine into typical "damsel in distress". And the ending was rather weak and not too cathartic. But that plot twist at the end was also an opportunity for the authors to allow some of the characters to explain the ethical challenges - the basis for the plot premise. That same premise looked preposterous twenty years ago, but today, it is taken for granted as a sad fact of life. Perhaps that, more than everything else, makes this film so scary and so effective after all those years.
RATING: 8/10 (+++)
Review written on September 27th 1999
Dragan Antulov a.k.a. Drax Fido: 2:381/100 E-mail<EMAIL_ADDRESS>E-mail<EMAIL_ADDRESS>E-mail<EMAIL_ADDRESS>The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


ShakeAlert warnings will be issued for all earthquakes (including aftershocks) over a set magnitude threshold of 4.5 or level III intensity, which is the level that can begin to create damage and affect public safety. You can also see the history of all recent earthquakes over magnitude 3.0 listed under “View recent earthquakes” These alerts apply to the LA County area only. The alert will include an initial alert sound and message such as alert sounds and “Earthquake! Earthquake! Expect (no, weak, moderate, strong) shaking. Drop, cover, and hold on. Protect yourself now!”.
When an earthquake starts, it may take a while for the shaking to reach you. ShakeAlertLA alerts you that shaking has started close by so that you can get to a safe place.
The alert will pop up on your phone (even if the app is closed), similar to an Amber Alert.
If you tap “Dismiss” the alert will go away, but you can find the information on the Active Alert or Recent Earthquakes screens.


Change Marker Position
Toggle Marker Draggable
Change Marker Icon
Change Marker Info
Change Marker Options
Delete Marker
Change PolyLine Path
Change PolyLine Options
Delete Line
Change Polygon Path
Change Polygon Options
Delete Polygon
Change Rectangle Bounds
Change Rectangle Options
Delete Rectangle
Change Circle Center
Change Circle Radius
Change Circle Options
Delete Circle
Add Marker to list
Delete Marker from list
Add Polyline to list
Delete Polyline from list
Add Polygon to list
Delete Polygon from list
Add Rectangle to list
Delete Rectangle from list
Add Circle to list
Delete Circle from list


--- layout: post title: How to change root route behavior in Rails 3 date: 2011-03-14 15:29:00.000000000 -05:00 comments: true categories: - rails 3 - rails routes published: true ---
These instructions have only been tested with declarative_authorization. So while it may work with other authorization gems, I haven't tested it so can't verify.
Say you want your users to see your marketing site (when they try to go to yourapp.com) when they are not logged in, but when they are logged in, you want them to see something different (like the dashboard of your app - which is found by going to your home controller, and index action - 'home#index'), how do you do this in Rails 3?
If you put an index.html file in your public directory, that takes precedence over everything else. Rails routing doesn't even execute when that file is included (as far as I understand it anyway). So, you do it like this: In your routes.rb file, change your root route to the following:
https://gist.github.com/869820
Rename your 'public/index.html' file to some other name, e.g. 'public/marketing.html'. In your home controller, do this:
https://gist.github.com/869828
Now, when a user is not logged in, they will be redirected to your static marketing page. But when they are logged in, they will go to your dashboard at home#index. Hope that helps you.
You should follow me on Twitter here: www.twitter.com/marcgayle.
>


|
MPack
0.8.2
A C encoding/decoding library for the MessagePack serialization format.
|
The MPack Node API allows you to parse a chunk of MessagePack data in-place into a dynamically typed data structure.
Typedefs | |
| typedef struct mpack_node_data_t | mpack_node_data_t |
| The storage for nodes in an MPack tree. More... | |
| typedef struct mpack_node_t | mpack_node_t |
| A handle to node data in a parsed MPack tree. More... | |
| typedef void(* | mpack_tree_error_t) (mpack_tree_t *tree, mpack_error_t error) |
| An error handler function to be called when an error is flagged on the tree. More... | |
| typedef struct mpack_tree_t | mpack_tree_t |
| An MPack tree parsed from a blob of MessagePack. More... | |
| typedef void(* | mpack_tree_teardown_t) (mpack_tree_t *tree) |
| A teardown function to be called when the tree is destroyed. More... | |
Tree Functions | |
| void | mpack_tree_init (mpack_tree_t *tree, const char *data, size_t length) |
| Initializes a tree by parsing the given data buffer. More... | |
| void | mpack_tree_init_pool (mpack_tree_t *tree, const char *data, size_t length, mpack_node_data_t *node_pool, size_t node_pool_count) |
| Initializes a tree by parsing the given data buffer, using the given node data pool to store the results. More... | |
| void | mpack_tree_init_error (mpack_tree_t *tree, mpack_error_t error) |
| Initializes an MPack tree directly into an error state. More... | |
| void | mpack_tree_init_file (mpack_tree_t *tree, const char *filename, size_t max_bytes) |
| Initializes a tree by reading and parsing the given file. More... | |
| mpack_node_t | mpack_tree_root (mpack_tree_t *tree) |
| Returns the root node of the tree, if the tree is not in an error state. More... | |
| mpack_error_t | mpack_tree_error (mpack_tree_t *tree) |
| Returns the error state of the tree. More... | |
| size_t | mpack_tree_size (mpack_tree_t *tree) |
| Returns the number of bytes used in the buffer when the tree was parsed. More... | |
| mpack_error_t | mpack_tree_destroy (mpack_tree_t *tree) |
| Destroys the tree. More... | |
| void | mpack_tree_set_context (mpack_tree_t *tree, void *context) |
| Sets the custom pointer to pass to the tree callbacks, such as teardown. More... | |
| void | mpack_tree_set_error_handler (mpack_tree_t *tree, mpack_tree_error_t error_fn) |
| Sets the error function to call when an error is flagged on the tree. More... | |
| void | mpack_tree_set_teardown (mpack_tree_t *tree, mpack_tree_teardown_t teardown) |
| Sets the teardown function to call when the tree is destroyed. More... | |
| void | mpack_tree_flag_error (mpack_tree_t *tree, mpack_error_t error) |
| Places the tree in the given error state, calling the error callback if one is set. More... | |
| void | mpack_node_flag_error (mpack_node_t node, mpack_error_t error) |
| Places the node's tree in the given error state, calling the error callback if one is set. More... | |
Node Core Functions | |
| mpack_error_t | mpack_node_error (mpack_node_t node) |
| Returns the error state of the node's tree. More... | |
| mpack_tag_t | mpack_node_tag (mpack_node_t node) |
| Returns a tag describing the given node, or a nil tag if the tree is in an error state. More... | |
| void | mpack_node_print_file (mpack_node_t node, FILE *file) |
| Converts a node to pseudo-JSON for debugging purposes and pretty-prints it to the given file. More... | |
| void | mpack_node_print (mpack_node_t node) |
| Converts a node to pseudo-JSON for debugging purposes and pretty-prints it to stdout. More... | |
Node Primitive Value Functions | |
| mpack_type_t | mpack_node_type (mpack_node_t node) |
| Returns the type of the node. More... | |
| void | mpack_node_nil (mpack_node_t node) |
| Checks if the given node is of nil type, raising mpack_error_type otherwise. More... | |
| bool | mpack_node_bool (mpack_node_t node) |
| Returns the bool value of the node. More... | |
| void | mpack_node_true (mpack_node_t node) |
| Checks if the given node is of bool type with value true, raising mpack_error_type otherwise. More... | |
| void | mpack_node_false (mpack_node_t node) |
| Checks if the given node is of bool type with value false, raising mpack_error_type otherwise. More... | |
| uint8_t | mpack_node_u8 (mpack_node_t node) |
| Returns the 8-bit unsigned value of the node. More... | |
| int8_t | mpack_node_i8 (mpack_node_t node) |
| Returns the 8-bit signed value of the node. More... | |
| uint16_t | mpack_node_u16 (mpack_node_t node) |
| Returns the 16-bit unsigned value of the node. More... | |
| int16_t | mpack_node_i16 (mpack_node_t node) |
| Returns the 16-bit signed value of the node. More... | |
| uint32_t | mpack_node_u32 (mpack_node_t node) |
| Returns the 32-bit unsigned value of the node. More... | |
| int32_t | mpack_node_i32 (mpack_node_t node) |
| Returns the 32-bit signed value of the node. More... | |
| uint64_t | mpack_node_u64 (mpack_node_t node) |
| Returns the 64-bit unsigned value of the node. More... | |
| int64_t | mpack_node_i64 (mpack_node_t node) |
| Returns the 64-bit signed value of the node. More... | |
| unsigned int | mpack_node_uint (mpack_node_t node) |
| Returns the unsigned int value of the node. More... | |
| int | mpack_node_int (mpack_node_t node) |
| Returns the int value of the node. More... | |
| float | mpack_node_float (mpack_node_t node) |
| Returns the float value of the node. More... | |
| double | mpack_node_double (mpack_node_t node) |
| Returns the double value of the node. More... | |
| float | mpack_node_float_strict (mpack_node_t node) |
| Returns the float value of the node. More... | |
| double | mpack_node_double_strict (mpack_node_t node) |
| Returns the double value of the node. More... | |
Node String and Data Functions | |
| void | mpack_node_check_utf8 (mpack_node_t node) |
| Checks that the given node contains a valid UTF-8 string. More... | |
| void | mpack_node_check_utf8_cstr (mpack_node_t node) |
| Checks that the given node contains a valid UTF-8 string with no NUL bytes. More... | |
| int8_t | mpack_node_exttype (mpack_node_t node) |
| Returns the extension type of the given ext node. More... | |
| uint32_t | mpack_node_data_len (mpack_node_t node) |
| Returns the length of the given str, bin or ext node. More... | |
| size_t | mpack_node_strlen (mpack_node_t node) |
| Returns the length in bytes of the given string node. More... | |
| const char * | mpack_node_str (mpack_node_t node) |
| Returns a pointer to the data contained by this node, ensuring it is a string. More... | |
| const char * | mpack_node_data (mpack_node_t node) |
| Returns a pointer to the data contained by this node. More... | |
| size_t | mpack_node_copy_data (mpack_node_t node, char *buffer, size_t bufsize) |
| Copies the bytes contained by this node into the given buffer, returning the number of bytes in the node. More... | |
| size_t | mpack_node_copy_utf8 (mpack_node_t node, char *buffer, size_t bufsize) |
| Checks that the given node contains a valid UTF-8 string and copies the string into the given buffer, returning the number of bytes in the string. More... | |
| void | mpack_node_copy_cstr (mpack_node_t node, char *buffer, size_t size) |
| Checks that the given node contains a string with no NUL bytes, copies the string into the given buffer, and adds a null terminator. More... | |
| void | mpack_node_copy_utf8_cstr (mpack_node_t node, char *buffer, size_t size) |
| Checks that the given node contains a valid UTF-8 string with no NUL bytes, copies the string into the given buffer, and adds a null terminator. More... | |
| char * | mpack_node_data_alloc (mpack_node_t node, size_t maxsize) |
| Allocates a new chunk of data using MPACK_MALLOC with the bytes contained by this node. More... | |
| char * | mpack_node_cstr_alloc (mpack_node_t node, size_t maxsize) |
| Allocates a new null-terminated string using MPACK_MALLOC with the string contained by this node. More... | |
| char * | mpack_node_utf8_cstr_alloc (mpack_node_t node, size_t maxsize) |
| Allocates a new null-terminated string using MPACK_MALLOC with the UTF-8 string contained by this node. More... | |
| size_t | mpack_node_enum (mpack_node_t node, const char *strings[], size_t count) |
| Searches the given string array for a string matching the given node and returns its index. More... | |
| size_t | mpack_node_enum_optional (mpack_node_t node, const char *strings[], size_t count) |
| Searches the given string array for a string matching the given node, returning its index or count if no strings match. More... | |
Compound Node Functions | |
| size_t | mpack_node_array_length (mpack_node_t node) |
| Returns the length of the given array node. More... | |
| mpack_node_t | mpack_node_array_at (mpack_node_t node, size_t index) |
| Returns the node in the given array at the given index. More... | |
| size_t | mpack_node_map_count (mpack_node_t node) |
| Returns the number of key/value pairs in the given map node. More... | |
| mpack_node_t | mpack_node_map_at (mpack_node_t node, size_t index, size_t offset) |
| mpack_node_t | mpack_node_map_key_at (mpack_node_t node, size_t index) |
| Returns the key node in the given map at the given index. More... | |
| mpack_node_t | mpack_node_map_value_at (mpack_node_t node, size_t index) |
| Returns the value node in the given map at the given index. More... | |
| mpack_node_t | mpack_node_map_int (mpack_node_t node, int64_t num) |
| Returns the value node in the given map for the given integer key. More... | |
| mpack_node_t | mpack_node_map_int_optional (mpack_node_t node, int64_t num) |
| Returns the value node in the given map for the given integer key, or a nil node if the map does not contain the given key. More... | |
| mpack_node_t | mpack_node_map_uint (mpack_node_t node, uint64_t num) |
| Returns the value node in the given map for the given unsigned integer key. More... | |
| mpack_node_t | mpack_node_map_uint_optional (mpack_node_t node, uint64_t num) |
| Returns the value node in the given map for the given unsigned integer key, or a nil node if the map does not contain the given key. More... | |
| mpack_node_t | mpack_node_map_str (mpack_node_t node, const char *str, size_t length) |
| Returns the value node in the given map for the given string key. More... | |
| mpack_node_t | mpack_node_map_str_optional (mpack_node_t node, const char *str, size_t length) |
| Returns the value node in the given map for the given string key, or a nil node if the map does not contain the given key. More... | |
| mpack_node_t | mpack_node_map_cstr (mpack_node_t node, const char *cstr) |
| Returns the value node in the given map for the given null-terminated string key. More... | |
| mpack_node_t | mpack_node_map_cstr_optional (mpack_node_t node, const char *cstr) |
| Returns the value node in the given map for the given null-terminated string key, or a nil node if the map does not contain the given key. More... | |
| bool | mpack_node_map_contains_int (mpack_node_t node, int64_t num) |
| Returns true if the given node map contains exactly one entry with the given integer key. More... | |
| bool | mpack_node_map_contains_uint (mpack_node_t node, uint64_t num) |
| Returns true if the given node map contains exactly one entry with the given unsigned integer key. More... | |
| bool | mpack_node_map_contains_str (mpack_node_t node, const char *str, size_t length) |
| Returns true if the given node map contains exactly one entry with the given string key. More... | |
| bool | mpack_node_map_contains_cstr (mpack_node_t node, const char *cstr) |
| Returns true if the given node map contains exactly one entry with the given null-terminated string key. More... | |
| typedef struct mpack_node_data_t mpack_node_data_t |
The storage for nodes in an MPack tree.
You only need to use this if you intend to provide your own storage for nodes instead of letting the tree allocate it.
| typedef struct mpack_node_t mpack_node_t |
A handle to node data in a parsed MPack tree.
Nodes represent either primitive values or compound types. If a node is a compound type, it contains a pointer to its child nodes, or a pointer to its underlying data.
Nodes are immutable.
| typedef void(* mpack_tree_error_t) (mpack_tree_t *tree, mpack_error_t error) |
An error handler function to be called when an error is flagged on the tree.
The error handler will only be called once on the first error flagged; any subsequent node reads and errors are ignored, and the tree is permanently in that error state.
MPack is safe against non-local jumps out of error handler callbacks.
Bear in mind when using longjmp that local non-volatile variables that have changed are undefined when setjmp() returns, so you can't put the tree on the stack in the same activation frame as the setjmp without declaring it volatile.
You must still eventually destroy the tree. It is not destroyed automatically when an error is flagged. It is safe to destroy the tree within this error callback, but you will either need to perform a non-local jump, or store something in your context to identify that the tree is destroyed since any future accesses to it cause undefined behavior.
| typedef struct mpack_tree_t mpack_tree_t |
An MPack tree parsed from a blob of MessagePack.
The tree contains a single root node which contains all parsed data. The tree and its nodes are immutable.
| typedef void(* mpack_tree_teardown_t) (mpack_tree_t *tree) |
A teardown function to be called when the tree is destroyed.
| mpack_node_t mpack_node_array_at | ( | mpack_node_t | node, |
| size_t | index | ||
| ) |
Returns the node in the given array at the given index.
If the node is not an array, mpack_error_type is raised and a nil node is returned. If the given index is out of bounds, mpack_error_data is raised and a nil node is returned.
| size_t mpack_node_array_length | ( | mpack_node_t | node | ) |
Returns the length of the given array node.
Raises mpack_error_type and returns 0 if the given node is not an array.
| bool mpack_node_bool | ( | mpack_node_t | node | ) |
Returns the bool value of the node.
If this node is not of the correct type, false is returned and mpack_error_type is raised.
| void mpack_node_check_utf8 | ( | mpack_node_t | node | ) |
Checks that the given node contains a valid UTF-8 string.
If the string is invalid, this flags an error, which would cause subsequent calls to mpack_node_str() to return NULL and mpack_node_strlen() to return zero. So you can check the node for error immediately after calling this, or you can call those functions to use the data anyway and check for errors later.
| mpack_error_type | If this node is not a string or does not contain valid UTF-8. |
| node | The string node to test |
| void mpack_node_check_utf8_cstr | ( | mpack_node_t | node | ) |
Checks that the given node contains a valid UTF-8 string with no NUL bytes.
This does not check that the string has a null-terminator! It only checks whether the string could safely be represented as a C-string by appending a null-terminator. (If the string does already contain a null-terminator, this will flag an error.)
This is performed automatically by other UTF-8 cstr helper functions. Only call this if you will do something else with the data directly, but you still want to ensure it will be valid as a UTF-8 C-string.
| mpack_error_type | If this node is not a string, does not contain valid UTF-8, or contains a NUL byte. |
| node | The string node to test |
| void mpack_node_copy_cstr | ( | mpack_node_t | node, |
| char * | buffer, | ||
| size_t | size | ||
| ) |
Checks that the given node contains a string with no NUL bytes, copies the string into the given buffer, and adds a null terminator.
If this node is not of a string type, mpack_error_type is raised. If the string does not fit, mpack_error_data is raised.
If any error occurs, the buffer will contain an empty null-terminated string.
| node | The string node from which to copy data |
| buffer | A buffer in which to copy the node's string |
| size | The size of the given buffer |
| size_t mpack_node_copy_data | ( | mpack_node_t | node, |
| char * | buffer, | ||
| size_t | bufsize | ||
| ) |
Copies the bytes contained by this node into the given buffer, returning the number of bytes in the node.
| mpack_error_type | If this node is not a str, bin or ext type |
| mpack_error_too_big | If the string does not fit in the given buffer |
| node | The string node from which to copy data |
| buffer | A buffer in which to copy the node's bytes |
| bufsize | The size of the given buffer |
| size_t mpack_node_copy_utf8 | ( | mpack_node_t | node, |
| char * | buffer, | ||
| size_t | bufsize | ||
| ) |
Checks that the given node contains a valid UTF-8 string and copies the string into the given buffer, returning the number of bytes in the string.
| mpack_error_type | If this node is not a string |
| mpack_error_too_big | If the string does not fit in the given buffer |
| node | The string node from which to copy data |
| buffer | A buffer in which to copy the node's bytes |
| bufsize | The size of the given buffer |
| void mpack_node_copy_utf8_cstr | ( | mpack_node_t | node, |
| char * | buffer, | ||
| size_t | size | ||
| ) |
Checks that the given node contains a valid UTF-8 string with no NUL bytes, copies the string into the given buffer, and adds a null terminator.
If this node is not of a string type, mpack_error_type is raised. If the string does not fit, mpack_error_data is raised.
If any error occurs, the buffer will contain an empty null-terminated string.
| node | The string node from which to copy data |
| buffer | A buffer in which to copy the node's string |
| size | The size of the given buffer |
| char* mpack_node_cstr_alloc | ( | mpack_node_t | node, |
| size_t | maxsize | ||
| ) |
Allocates a new null-terminated string using MPACK_MALLOC with the string contained by this node.
The allocated string must be freed with MPACK_FREE() (or simply free() if MPack's allocator hasn't been customized.)
| mpack_error_type | If this node is not a string or contains NUL bytes |
| mpack_error_too_big | If the size of the string plus null-terminator is larger than the given maximum size |
| mpack_error_memory | If an allocation failure occurs |
| node | The node from which to allocate and copy string data |
| maxsize | The maximum size to allocate, including the null-terminator |
| const char* mpack_node_data | ( | mpack_node_t | node | ) |
Returns a pointer to the data contained by this node.
The pointer is valid as long as the data backing the tree is valid.
If this node is not of a str, bin or map, mpack_error_type is raised, and NULL
is returned.
| char* mpack_node_data_alloc | ( | mpack_node_t | node, |
| size_t | maxsize | ||
| ) |
Allocates a new chunk of data using MPACK_MALLOC with the bytes contained by this node.
The allocated data must be freed with MPACK_FREE() (or simply free() if MPack's allocator hasn't been customized.)
| mpack_error_type | If this node is not a str, bin or ext type |
| mpack_error_too_big | If the size of the data is larger than the given maximum size |
| mpack_error_memory | If an allocation failure occurs |
| node | The node from which to allocate and copy data |
| maxsize | The maximum size to allocate |
| uint32_t mpack_node_data_len | ( | mpack_node_t | node | ) |
Returns the length of the given str, bin or ext node.
This returns zero if the tree is in an error state.
| double mpack_node_double | ( | mpack_node_t | node | ) |
Returns the double value of the node.
The underlying value can be an integer, float or double; the value is converted to a double.
| mpack_error_type | if the underlying value is not a float, double or integer. |
| double mpack_node_double_strict | ( | mpack_node_t | node | ) |
Returns the double value of the node.
The underlying value must be a float or double, not an integer. This ensures no loss of precision can occur.
| mpack_error_type | if the underlying value is not a float or double. |
| size_t mpack_node_enum | ( | mpack_node_t | node, |
| const char * | strings[], | ||
| size_t | count | ||
| ) |
Searches the given string array for a string matching the given node and returns its index.
If the node does not match any of the given strings, mpack_error_type is flagged. Use mpack_node_enum_optional() if you want to allow values other than the given strings.
If any error occurs or if the tree is in an error state, count is returned.
This can be used to quickly parse a string into an enum when the enum values range from 0 to count-1. If the last value in the enum is a special "count" value, it can be passed as the count, and the return value can be cast directly to the enum type.
| node | The node |
| strings | An array of expected strings of length count |
| count | The number of strings |
| size_t mpack_node_enum_optional | ( | mpack_node_t | node, |
| const char * | strings[], | ||
| size_t | count | ||
| ) |
Searches the given string array for a string matching the given node, returning its index or count if no strings match.
If the value is not a string, or it does not match any of the given strings, count is returned and no error is flagged.
If any error occurs or if the tree is in an error state, count is returned.
This can be used to quickly parse a string into an enum when the enum values range from 0 to count-1. If the last value in the enum is a special "count" value, it can be passed as the count, and the return value can be cast directly to the enum type.
| node | The node |
| strings | An array of expected strings of length count |
| count | The number of strings |
| mpack_error_t mpack_node_error | ( | mpack_node_t | node | ) |
Returns the error state of the node's tree.
| int8_t mpack_node_exttype | ( | mpack_node_t | node | ) |
Returns the extension type of the given ext node.
This returns zero if the tree is in an error state.
| void mpack_node_false | ( | mpack_node_t | node | ) |
Checks if the given node is of bool type with value false, raising mpack_error_type otherwise.
| void mpack_node_flag_error | ( | mpack_node_t | node, |
| mpack_error_t | error | ||
| ) |
Places the node's tree in the given error state, calling the error callback if one is set.
This allows you to externally flag errors, for example if you are validating data as you read it.
If the tree is already in an error state, this call is ignored and no error callback is called.
| float mpack_node_float | ( | mpack_node_t | node | ) |
Returns the float value of the node.
The underlying value can be an integer, float or double; the value is converted to a float.
| mpack_error_type | if the underlying value is not a float, double or integer. |
| float mpack_node_float_strict | ( | mpack_node_t | node | ) |
Returns the float value of the node.
The underlying value must be a float, not a double or an integer. This ensures no loss of precision can occur.
| mpack_error_type | if the underlying value is not a float. |
| int16_t mpack_node_i16 | ( | mpack_node_t | node | ) |
Returns the 16-bit signed value of the node.
If this node is not of a compatible type, mpack_error_type is raised and zero is returned.
| int32_t mpack_node_i32 | ( | mpack_node_t | node | ) |
Returns the 32-bit signed value of the node.
If this node is not of a compatible type, mpack_error_type is raised and zero is returned.
| int64_t mpack_node_i64 | ( | mpack_node_t | node | ) |
Returns the 64-bit signed value of the node.
If this node is not of a compatible type, mpack_error_type is raised and zero is returned.
| int8_t mpack_node_i8 | ( | mpack_node_t | node | ) |
Returns the 8-bit signed value of the node.
If this node is not of a compatible type, mpack_error_type is raised and zero is returned.
| int mpack_node_int | ( | mpack_node_t | node | ) |
Returns the int value of the node.
Returns zero if an error occurs.
| mpack_error_type | If the node is not an integer type or does not fit in the range of an int |
| bool mpack_node_map_contains_cstr | ( | mpack_node_t | node, |
| const char * | cstr | ||
| ) |
Returns true if the given node map contains exactly one entry with the given null-terminated string key.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node contains more than one entry with the given key |
| bool mpack_node_map_contains_int | ( | mpack_node_t | node, |
| int64_t | num | ||
| ) |
Returns true if the given node map contains exactly one entry with the given integer key.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node contains more than one entry with the given key |
| bool mpack_node_map_contains_str | ( | mpack_node_t | node, |
| const char * | str, | ||
| size_t | length | ||
| ) |
Returns true if the given node map contains exactly one entry with the given string key.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node contains more than one entry with the given key |
| bool mpack_node_map_contains_uint | ( | mpack_node_t | node, |
| uint64_t | num | ||
| ) |
Returns true if the given node map contains exactly one entry with the given unsigned integer key.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node contains more than one entry with the given key |
| size_t mpack_node_map_count | ( | mpack_node_t | node | ) |
Returns the number of key/value pairs in the given map node.
Raises mpack_error_type and returns 0 if the given node is not a map.
| mpack_node_t mpack_node_map_cstr | ( | mpack_node_t | node, |
| const char * | cstr | ||
| ) |
Returns the value node in the given map for the given null-terminated string key.
The key must exist within the map. Use mpack_node_map_cstr_optional() to check for optional keys.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node does not contain exactly one entry with the given key |
| mpack_node_t mpack_node_map_cstr_optional | ( | mpack_node_t | node, |
| const char * | cstr | ||
| ) |
Returns the value node in the given map for the given null-terminated string key, or a nil node if the map does not contain the given key.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node contains more than one entry with the given key |
| mpack_node_t mpack_node_map_int | ( | mpack_node_t | node, |
| int64_t | num | ||
| ) |
Returns the value node in the given map for the given integer key.
The key must exist within the map. Use mpack_node_map_int_optional() to check for optional keys.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node does not contain exactly one entry with the given key |
| mpack_node_t mpack_node_map_int_optional | ( | mpack_node_t | node, |
| int64_t | num | ||
| ) |
Returns the value node in the given map for the given integer key, or a nil node if the map does not contain the given key.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node contains more than one entry with the given key |
| mpack_node_t mpack_node_map_key_at | ( | mpack_node_t | node, |
| size_t | index | ||
| ) |
Returns the key node in the given map at the given index.
A nil node is returned in case of error.
| mpack_error_type | if the node is not a map |
| mpack_error_data | if the given index is out of bounds |
| mpack_node_t mpack_node_map_str | ( | mpack_node_t | node, |
| const char * | str, | ||
| size_t | length | ||
| ) |
Returns the value node in the given map for the given string key.
The key must exist within the map. Use mpack_node_map_str_optional() to check for optional keys.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node does not contain exactly one entry with the given key |
| mpack_node_t mpack_node_map_str_optional | ( | mpack_node_t | node, |
| const char * | str, | ||
| size_t | length | ||
| ) |
Returns the value node in the given map for the given string key, or a nil node if the map does not contain the given key.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node contains more than one entry with the given key |
| mpack_node_t mpack_node_map_uint | ( | mpack_node_t | node, |
| uint64_t | num | ||
| ) |
Returns the value node in the given map for the given unsigned integer key.
The key must exist within the map. Use mpack_node_map_uint_optional() to check for optional keys.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node does not contain exactly one entry with the given key |
| mpack_node_t mpack_node_map_uint_optional | ( | mpack_node_t | node, |
| uint64_t | num | ||
| ) |
Returns the value node in the given map for the given unsigned integer key, or a nil node if the map does not contain the given key.
The key must be unique. An error is flagged if the node has multiple entries with the given key.
| mpack_error_type | If the node is not a map |
| mpack_error_data | If the node contains more than one entry with the given key |
| mpack_node_t mpack_node_map_value_at | ( | mpack_node_t | node, |
| size_t | index | ||
| ) |
Returns the value node in the given map at the given index.
A nil node is returned in case of error.
| mpack_error_type | if the node is not a map |
| mpack_error_data | if the given index is out of bounds |
| void mpack_node_nil | ( | mpack_node_t | node | ) |
Checks if the given node is of nil type, raising mpack_error_type otherwise.
| void mpack_node_print | ( | mpack_node_t | node | ) |
Converts a node to pseudo-JSON for debugging purposes and pretty-prints it to stdout.
| void mpack_node_print_file | ( | mpack_node_t | node, |
| FILE * | file | ||
| ) |
Converts a node to pseudo-JSON for debugging purposes and pretty-prints it to the given file.
| const char* mpack_node_str | ( | mpack_node_t | node | ) |
Returns a pointer to the data contained by this node, ensuring it is a string.
The pointer is valid as long as the data backing the tree is valid.
If this node is not a string, mpack_error_type is raised and NULL
is returned.
| size_t mpack_node_strlen | ( | mpack_node_t | node | ) |
Returns the length in bytes of the given string node.
This does not include any null-terminator.
This returns zero if the tree is in an error state.
| mpack_tag_t mpack_node_tag | ( | mpack_node_t | node | ) |
Returns a tag describing the given node, or a nil tag if the tree is in an error state.
| void mpack_node_true | ( | mpack_node_t | node | ) |
Checks if the given node is of bool type with value true, raising mpack_error_type otherwise.
| mpack_type_t mpack_node_type | ( | mpack_node_t | node | ) |
Returns the type of the node.
| uint16_t mpack_node_u16 | ( | mpack_node_t | node | ) |
Returns the 16-bit unsigned value of the node.
If this node is not of a compatible type, mpack_error_type is raised and zero is returned.
| uint32_t mpack_node_u32 | ( | mpack_node_t | node | ) |
Returns the 32-bit unsigned value of the node.
If this node is not of a compatible type, mpack_error_type is raised and zero is returned.
| uint64_t mpack_node_u64 | ( | mpack_node_t | node | ) |
Returns the 64-bit unsigned value of the node.
If this node is not of a compatible type, mpack_error_type is raised, and zero is returned.
| uint8_t mpack_node_u8 | ( | mpack_node_t | node | ) |
Returns the 8-bit unsigned value of the node.
If this node is not of a compatible type, mpack_error_type is raised and zero is returned.
| unsigned int mpack_node_uint | ( | mpack_node_t | node | ) |
Returns the unsigned int value of the node.
Returns zero if an error occurs.
| mpack_error_type | If the node is not an integer type or does not fit in the range of an unsigned int |
| char* mpack_node_utf8_cstr_alloc | ( | mpack_node_t | node, |
| size_t | maxsize | ||
| ) |
Allocates a new null-terminated string using MPACK_MALLOC with the UTF-8 string contained by this node.
The allocated string must be freed with MPACK_FREE() (or simply free() if MPack's allocator hasn't been customized.)
| mpack_error_type | If this node is not a string, is not valid UTF-8, or contains NUL bytes |
| mpack_error_too_big | If the size of the string plus null-terminator is larger than the given maximum size |
| mpack_error_memory | If an allocation failure occurs |
| node | The node from which to allocate and copy string data |
| maxsize | The maximum size to allocate, including the null-terminator |
| mpack_error_t mpack_tree_destroy | ( | mpack_tree_t * | tree | ) |
Destroys the tree.
| mpack_error_t mpack_tree_error | ( | mpack_tree_t * | tree | ) |
Returns the error state of the tree.
| void mpack_tree_flag_error | ( | mpack_tree_t * | tree, |
| mpack_error_t | error | ||
| ) |
Places the tree in the given error state, calling the error callback if one is set.
This allows you to externally flag errors, for example if you are validating data as you read it.
If the tree is already in an error state, this call is ignored and no error callback is called.
| void mpack_tree_init | ( | mpack_tree_t * | tree, |
| const char * | data, | ||
| size_t | length | ||
| ) |
Initializes a tree by parsing the given data buffer.
The tree must be destroyed with mpack_tree_destroy(), even if parsing fails.
The tree will allocate pages of nodes as needed, and free them when destroyed.
Any string or blob data types reference the original data, so the data pointer must remain valid until after the tree is destroyed.
| void mpack_tree_init_error | ( | mpack_tree_t * | tree, |
| mpack_error_t | error | ||
| ) |
Initializes an MPack tree directly into an error state.
Use this if you are writing a wrapper to mpack_tree_init() which can fail its setup.
| void mpack_tree_init_file | ( | mpack_tree_t * | tree, |
| const char * | filename, | ||
| size_t | max_bytes | ||
| ) |
Initializes a tree by reading and parsing the given file.
The tree must be destroyed with mpack_tree_destroy(), even if parsing fails.
The file is opened, loaded fully into memory, and closed before this call returns.
| tree | The tree to initialize |
| filename | The filename passed to fopen() to read the file |
| max_bytes | The maximum size of file to load, or 0 for unlimited size. |
| void mpack_tree_init_pool | ( | mpack_tree_t * | tree, |
| const char * | data, | ||
| size_t | length, | ||
| mpack_node_data_t * | node_pool, | ||
| size_t | node_pool_count | ||
| ) |
Initializes a tree by parsing the given data buffer, using the given node data pool to store the results.
If the data does not fit in the pool, mpack_error_too_big will be flagged on the tree.
The tree must be destroyed with mpack_tree_destroy(), even if parsing fails.
| mpack_node_t mpack_tree_root | ( | mpack_tree_t * | tree | ) |
Returns the root node of the tree, if the tree is not in an error state.
Returns a nil node otherwise.
| void mpack_tree_set_context | ( | mpack_tree_t * | tree, |
| void * | context | ||
| ) |
Sets the custom pointer to pass to the tree callbacks, such as teardown.
| tree | The MPack tree. |
| context | User data to pass to the tree callbacks. |
| void mpack_tree_set_error_handler | ( | mpack_tree_t * | tree, |
| mpack_tree_error_t | error_fn | ||
| ) |
Sets the error function to call when an error is flagged on the tree.
This should normally be used with mpack_tree_set_context() to register a custom pointer to pass to the error function.
See the definition of mpack_tree_error_t for more information about what you can do from an error callback.
| tree | The MPack tree. |
| error_fn | The function to call when an error is flagged on the tree. |
| void mpack_tree_set_teardown | ( | mpack_tree_t * | tree, |
| mpack_tree_teardown_t | teardown | ||
| ) |
Sets the teardown function to call when the tree is destroyed.
This should normally be used with mpack_tree_set_context() to register a custom pointer to pass to the teardown function.
| tree | The MPack tree. |
| teardown | The function to call when the tree is destroyed. |
| size_t mpack_tree_size | ( | mpack_tree_t * | tree | ) |
Returns the number of bytes used in the buffer when the tree was parsed.
If there is something in the buffer after the MessagePack object (such as another object), this can be used to find it.
This is zero if an error occurred during tree parsing (since the portion of the data that the first complete object occupies cannot be determined if the data is invalid or corrupted.)


(Web Authoring CMP1130M)
Designer, Developer, Director & Senior Lecturer
1 PDF with annotated Mood-boards, sitemap, wireframes, prototypes, Peer review and reflection sheet(added to BB)
Plus anything working as MP4 video
The workshop (home work) looked at
loops
Conditionals
Operators
Concatenation
Writing a function
Targeting an element by ID (again)
Getting an elements value(again)
Useful for those who will be catching up this week
Not waiting for the DOM to be Loaded
Not using developer tools to check
Syntax mistakes
Concatenation
window.onload = function() {
init();
}
function init(){
console.log('init fired');
}
If you use the same element a lot make it a variable. Saves dom searches and typing time.
var obj =document.getElementById("myid");
obj.value='10';
Make a var global then assign it when you need to
//store varibles ready for use later.
var examplevar, anothervar, morevars, vars;
window.onload = function() {
examplevar = "youhavebeen assigned";
//no null object error
}
Use single quotes when joining strings in JS
(especially when writing html element which will contain "" double quotes )
var string = '

';
Using document.write()
after the page has fully loaded will delete all the existing HTML
use:
document.body.innerHTML = 'string';
document.getElementById("myid").innerHTML = 'string';
My Favorite student quote from Web Auth
(student has been anonymised for data protection)
// use ; not ,
for( var i = 0; i > 20; i++ )
{
// do something 20 times
}
var txt;
for(var i = 0; i > 20; i++){
txt+='';
}
document.getElementById("myid").innerHTML = txt;
if(condition === true){
// do something
}
// you can use 1 line with no {}
if(condition === true) obj.value="met";
//shorter
if(condition) obj.value="met";
Greater than
Less than
Greater or equal to
Absolutely Equal to
Or
And
Plus 1
Minus 1
Exponentiation (first operand to the power second operand)
you just never know when you might need it!
Todays Lecture
The <canvas> element
We will be watching some coding:
Introduction to the canvas element
Drawing to context2d
Storing an array.
Looping through that array.
Random functions.
Animate using setinterval()
<canvas id="canvas" width="500" height="500"></canvas>
The HTML <canvas>
element can be used to draw
graphs, make photo compositions, create animations,
or even do real-time video processing or rendering
Examples that wont break my presentation.
http://www.craftymind.com/factory/html5video/CanvasVideo.html
http://html5doctor.com/demos/video-canvas-magic/demo1.html(has sound)
Although i expect yours to be a bit like...
The HTML <canvas>
elements only a container for graphics.
You must use a script to actually draw the graphics.
Canvas has several methods for drawing paths, boxes, circles, text, and adding images.
The CanvasRenderingContext2D interface provides
the 2D rendering context for the drawing surface of a
<canvas>
element.
To get an object of this interface, call getContext()
on a <canvas>
, supplying "2d" as the argument.
//assumes canvas tag in html doc
var mycanvas = document.getElementById('canvas');
// creates and adds tag
var mycanvas = document.createElement('canvas');
document.body.appendChild(mycanvas);
var my_ctx = canvas.getContext('2d');
Coding Examples
Get ready to take notes!
We will be watching some coding:
Get the canvas
Get context 2d
Set a colour
Draw a shape to the context 2d (Note differences between circle and square)
Set Interval function to animate
Clear the <canvas>
Redraw on <canvas> changing positioning and size
Create an array to store values
Create a random function
Loop through array to create & position multiple shapes
Randomize colour
Simple add rect (Live example)
var canvas, my_context,random_colour ;
canvas = document.getElementById("canvas");
//make canvas full screen
canvas.width=window.innerWidth;
canvas.height=window.innerHeight;
my_context = canvas.getContext('2d');
random_colour = '#'+Math.floor(Math.random()*16777215).toString(16);
my_context.fillStyle='#ffffff';
//position fillrect has 4 arguments: x,y, width, height
my_context.fillRect(canvas.width/2-5,canvas.height/2-5,10,10);
var random_colour = '#'+Math.floor(Math.random()*16777215).toString(16);
Simple Loop using random colour (Live example)
var canvas, my_context,random_colour, width=10, height=10;
canvas = document.getElementById("canvas");
canvas.width=window.innerWidth;
canvas.height = window.innerHeight;
my_context = canvas.getContext('2d');
for(var x=0; x < 10 ;x++)
{
for(var y=0; y < 10 ;y++)
{
console.log(x ,y);
random_colour = '#'+Math.floor(Math.random()*16777215).toString(16);
my_context.fillStyle=random_colour;
my_context.fillRect(x*20,y*20,width,height);
}
}
The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds). The setInterval() method will continue calling the function until clearInterval() is called, or the window is closed.
setInterval(function, interval);
//note animate does need () as it expects a function as an argument
setInterval(animate, 1000);
//set as a var can be cleared
var myVar = setInterval(animate, 1000);
clearInterval(myVar);
//create
var my_Array={x:250,y:250,size:10};
//add
my_Array.push({x:250,y:250,size:10});
Set Interval (live example)
var canvas = document.getElementById("canvas");
canvas.width=window.innerWidth;
canvas.height=window.innerHeight;
var my_context = canvas.getContext('2d');
// create an array
var my_pixel={x:225,y:225,size:50};
// animate: could use request animation frame for better syncing
setInterval(draw,30);
function draw(){
// clear the canvas or we will get a lovely start pattern
my_context.clearRect(0,0,500,500);
my_context.fillStyle='#ffffff';
//position draw pixel on canvas square version
my_context.fillRect(my_pixel.x,my_pixel.y,my_pixel.size,my_pixel.size);
// update position x and y to offset
my_pixel.x=my_pixel.x+ 5;
//my_pixel.y=my_pixel.y+ 5;
// reduce the size of the pixel by
//my_pixel.size=my_pixel.size*0.96;
}
for(var i=0; i < my_Array.length; i++)
{
//code
}
function randomRange(min, max)
{
return Math.random()*(max-min)+min;
}
JS
// Returns a random number between min (inclusive) and max (exclusive)
function randomRange(min, max) {
return Math.random()*(max-min) + min;
}
window.onload = function()
{
console.log('loaded');
setInterval(draw,20);
}
function draw(){
// create an array item, local variable (look at variable scope)
var my_pixel={x:250,y:250,xSpeed:randomRange(-5,5),ySpeed:randomRange(-5,5),size:5};
//add to array
my_Array.push(my_pixel);
// clear the canvas or we will get a lovely start pattern
my_context.clearRect(0,0,500,500);
// loop through all in the updated array and reposition and scale
for(var i=0; i < my_Array.length;i++)
{
my_pixel=my_Array[i];
// creates a random colour using (16777215 == ffffff in decimal)
var random_colour ='#'+Math.floor(Math.random()*16777215).toString(16);
my_context.fillStyle="#ffffff";
//position draw pixel on canvas square version
my_context.fillRect(my_pixel.x,my_pixel.y,my_pixel.size,my_pixel.size);
// update position x and y to offset
my_pixel.x=my_pixel.x+ my_pixel.xSpeed;
my_pixel.y=my_pixel.y+ my_pixel.ySpeed;
// reduce the size of the pixel by
my_pixel.size=my_pixel.size*0.96;
my_pixel.opacity=my_pixel.size*0.50;
}
}
Doing the above!


Nestled in between the luscious green hills of the Buhoma village in Kanungu district of southern Uganda, the Bwindi Impenetrable Forest National Park is home to about 400 Mountain Gorillas– a species only found in this part of the world. Mountain Gorillas are a species of Gorillas, Gorilla beringei beringei, that can only survive in their natural habitat. To witness the lives of these majestic creatures in their own territory is an experience of a lifetime. The Gorilla Tracking Safari Ltd offers excellent trekking experiences for guests willing to venture into the impenetrable forests! Visit us in Bwindi to learn more about the region, to experience the beauty of the Bwindi rainforest, and of course, to meet a wonderful family of mountain gorillas, our distant cousins. We are all 97.7% Gorilla!
To assure that all our guests get a chance to see the mountain gorillas, we facilitate two types of treks:
Short trek: After a jeep ride to the trekking site, guests will have to walk for about an hour and a half on relatively easy terrain before stumbling upon one of the gorilla families.
Long trek: On our longer treks, guest trek up relatively steeper trails for about 2 to 3 hours, depending upon where the gorilla family has been located by our experienced trackers.
For guests who have disabilities that prevent them from walking on steep or elevated trails, a team of porters are ready to carry you up to the gorilla family. This service is available to guests who, during their trek, feel unwell or are unable to make it to the site. The disabled are given special considerations; it is advisable to let us know about the disabled so we can organise our 991 team that carries you over the hills.
By visiting these mountain gorillas, you will be contributing significantly to the conservation of the species. Your visit will provide funds for conservation projects, to create jobs and bring other benefits to the local communities around Bwindi.
Even if you are unable to visit Uganda, you can still play your role in ensuring the safety and efficiency of our trackers by donating the following items:
How has the mountain gorilla population in Bwindi changed over the years?
Since the discovery of mountain gorillas in 1902, this species has endured uncontrolled hunting, disease, destruction of its forest habitats, capture of illegal trade, and even war. It was feared that the Mountain Gorilla would go extinct in the same century it was discovered in.This drastic drop in numbers prompted conservation efforts around the region. This species has been intensely monitored since the 1950s.
During the first proper census of this species in 1997, the national park had just begun habituating the mountain gorillas. The population remained at a low of 300 while organizations like IUCN, WWF, and Uganda Wildlife Authority (UWA) began establishing rules for conservation.
In 2002, a positive trend was observed as there was an additional 20 individuals added to the gorilla families in Bwindi. More number of juvenile and adult gorillas began to get habituated as well.
The census of 2006 revealed that the total number of mountain gorillas had dropped, due to reasons unidentified, but the number of habituated gorillas continued to grow indicating that the efforts of the park rangers were moving ahead successfully.
The given census shows that all the efforts being made have started to pay off. The Mountain Gorilla population in Bwindi has reached the 400 individuals mark, and hopefully, will continue to grow as conservation laws and efforts continue to be enforced.
Project Founder
Trek Leader
Operations Manager
Visit us in Bwindi to learn more about the region, to experience the beauty of the Bwindi rainforest, and of course, to meet a wonderful family of mountain gorillas, our distant cousins.


bla bla
Hide
Show
"JavaScript: The Definitive Guide", "author" => "David Flanagan", "edition" => 6 ); ?>


ColorSet
About
ColorSet
is a macOS utility and framework allowing developers to manage custom interface colors with ease.
Rationale
As of macOS 10.14 Mojave, Apple introduced a system-wide dark-mode.
Applications linked with the macOS 10.14 SDK now need to react to system appearance changes.
While built-in AppKit UI elements handle this perfectly, an application often relies on custom controls, custom drawing code, or at last custom colors.
As an example, the following code will perfectly react to the dark mode.
This is a system color, so everything is handled automatically by AppKit:
let color = NSColor.textColor
While the following won’t change, as the color components are hard-coded:
let color = NSColor( deviceRed: 1, green: 0, blue: 0, alpha: 1 )
Apple provides a nice solution, relying on Asset Catalog files.
As of Xcode 10, you can create custom colors in Asset Catalogs, identified by a name, and optionally containing variants for a specific UI theme or device.
Unfortunately, this feature is only available for applications running on macOS 10.13 and later.
It basically means you’ll have to drop support for macOS 10.12 and below.
If you need to support macOS 10.12 or below, Apple’s official recommendation (as seen during WWDC18) is to actually hard-code colors using conditional platform-detection code.
So here comes ColorSet
.
ColorSet & ColorSetKit
ColorSet
is both a macOS application and a macOS Swift framework, ColorSetKit
.
The application lets you create files containing colors and variants, just as an Asset Catalog File, while the framework allows you, in your application, to retrieve colors from the .colorset
file using names, just like the macOS 10.13 SDK.
Creating a .colorset
file
The application lets you create as many colors as you want, each with a unique name.
For each color, an optional dark variant can be set:
Using ColorSetKit
By default, ColorSetKit
will look for a file named Colors.colorset
in your application’s bundle.
Colors can be retrieved using a custom method on NSColor
:
let color = NSColor.colorFromColorSet( "MyCustomColor" )
By themselves, colors won’t react to UI theme changes.
But the colorFromColorSet
method will return the correct color, based on the current UI theme.
This means that if you use custom drawing code, you shouldn’t cache color objects, but instead call colorFromColorSet
directly from your drawing code.
This way, the correct color will be used each time your view is redrawn (which happens automatically when the UI theme changes).
License
ColorSet
is released under the terms of the MIT license.
Repository Infos
Owner: DigiDNA
Web: www.digidna.net
Blog: imazing.com/blog
Twitter: @DigiDNA
GitHub: github.com/DigiDNA


|
MCNetwork
|
#include <system.h>
Public Member Functions | |
| System (std::shared_ptr< ParameterStorage > const &) | |
| System (System const &oldSys) | |
| void | createRandomNewDevice () |
| void | loadDevice () |
| void | initilizeMatrices () |
| void | getReadyForRun () |
| void | reset () |
| void | resetStoredStates () |
| void | run (int steps) |
| void | updatePotential (std::vector< double > const &voltages) |
| void | updatePotential (mfem::GridFunction const &potential) |
| void | updateOccupationAndPotential (std::vector< bool > const &newOccupation, mfem::GridFunction const &potential) |
| std::vector< bool > const & | getOccupation () |
| mfem::GridFunction | getPotential () const |
Data Fields | |
| int * | outputCurrentCounter |
| double | time =0 |
Private Member Functions | |
| void | updateAfterSwap () |
| void | setOccupation (std::vector< bool > const &newOccupation) |
| void | findSwap () |
| void | findSwapBS () |
| void | updateRatesStoringMode () |
| void | updateRates () |
| void | increaseTime () |
| void | resetPotential () |
| void | setNewPotential () |
Private Attributes | |
| int | acceptorNumber |
| int | electrodeNumber |
| int | hoppingSiteNumber |
| double * | donorPositionsX |
| double * | donorPositionsY |
| double * | acceptorPositionsX |
| double * | acceptorPositionsY |
| double * | electrodePositionsX |
| double * | electrodePositionsY |
| double * | distances |
| double * | energies |
| int * | currentCounter |
| double * | pairEnergies |
| double * | deltaEnergies |
| double * | rates |
| double * | baseRates |
| std::vector< bool > | occupation |
| std::vector< std::vector< int > > | interactionPartners |
| std::vector< std::vector< int > > | hoppingPartnersAcceptors |
| std::vector< std::vector< int > > | hoppingPartnersElectrodes |
| int | lastSwapped1 =0 |
| int | lastSwapped2 =0 |
| double | ratesSum =0 |
| double | constantRatesSumPart =0 |
| double | locLenA |
| std::unique_ptr< FiniteElementeBase > | finEle |
| std::shared_ptr< std::vector< double > > | partRatesSumList |
| std::shared_ptr< std::unordered_map< std::vector< bool >, std::shared_ptr< std::vector< double > > > > | konwnPartRatesSumList |
| std::shared_ptr< std::unordered_map< std::vector< bool >, double > > | knownRatesSum |
| std::shared_ptr< ParameterStorage > | parameterStorage |
| std::shared_ptr< DataFile > | additionalDatafile |
| bool | readyForRun =false |
| bool | storingMode |
| bool | ratesInMemory =false |
| bool | storeKnownStates = true |
main class for physical model
| System::System | ( | System const & | oldSys | ) |
copy constructor. used in parallelization.
| void System::createRandomNewDevice | ( | ) |
creates device and saves it to "device.txt"
|
private |
sets System::lastSwapped1 and System::lastSwapped2 to swap pair
|
private |
using binary search
find swapping pair using binary search (BS) algorithm. only used if state is known (in store known states)
| mfem::GridFunction System::getPotential | ( | ) | const |
returns FiniteElementeBase::solutionVector of System::finEle
| void System::getReadyForRun | ( | ) |
|
private |
increase time recording to exponential distribution
| void System::initilizeMatrices | ( | ) |
init c arrays
| void System::loadDevice | ( | ) |
loads device from "device.txt". no error handling! does not check if number of acceptors/donors matches -> unexpected errors might occur
| void System::reset | ( | ) |
set System::time = 0 and System::currentCounter[i] = 0
|
private |
set all energies back to coulomb interaction only
| void System::resetStoredStates | ( | ) |
| void System::run | ( | int | steps | ) |
run kinetic MC
|
private |
set energies to potential set before
|
private |
set new occupation and update energies
|
private |
updates System::occupation and System::energies after swap pair was found
| void System::updateOccupationAndPotential | ( | std::vector< bool > const & | newOccupation, |
| mfem::GridFunction const & | potential | ||
| ) |
see System::updatePotential and System::setOccupation. by updating both at once the energies have to be recalculated only once
| void System::updatePotential | ( | std::vector< double > const & | voltages | ) |
updates voltages and solves laplace eq
| void System::updatePotential | ( | mfem::GridFunction const & | potential | ) |
copys laplace equation solution, does not solve laplace eq itself.
|
private |
core calculation of rates
update rates after each swap
|
private |
single processor, storing mode
see System::updateRates(). only used in storing mode. additionally setting unused rates = 0. checking for saved states/saving state.
|
private |
acceptors = dopants
|
private |
save data in verbose mode
|
private |
2D-array: constant distance dependend part of transition rates (exp(-2r/a))
|
private |
rates of electrode-electrode hops are constant
|
private |
1D-array: counter for all electrodes
|
private |
2D-array: difference between hopping site energies
|
private |
2D-array: hopping site distances
|
private |
2D-array: hopping site distances 1D - array
|
private |
1D-array: single hopping site energies
|
private |
finEle device
|
private |
indices of possible hopping partner (acceptors). needed bc of cut on hoppingPartners by "minHoppingDist" and "maxHoppingDist". sorted by hoppingSite index. example: hoppingPartnersAcceptors[hoppingSiteIndex] <- vector of indices of acceptors where hole form hoppingSiteIndex can hop to.
|
private |
indices of possible hopping partner (electrodes). needed bc of cut on hoppingPartners by "minHoppingDist" and "maxHoppingDist". sorted by hoppingSite index. example: hoppingPartnersElectrodes[hoppingSiteIndex] <- vector of indices of electrodes where hole form hoppingSiteIndex can hop to.
|
private |
acceptors and electrodes are both hoppingSites => hoppingSiteNumber = acceptorNumber + electrodeNumber
|
private |
indices of coulomb interacting partners. needed bc of cut on coulomb interaction by "maxInteractionDist". sorted by hoppingSite index
|
private |
map of rate sums for binary search, to store known states. only used in storing mode.
|
private |
map of lists of accumulated rates for binary search, to store known states. only used in storing mode.
|
private |
swap 1->2; int = index
|
private |
swap 1->2; int = index
|
private |
physical parameter "a". copied from input file for better performance (otherwise map.at() had to be called a lot of times)
|
private |
1D-array: occupation of hopping sites
| int* System::outputCurrentCounter |
counts hops to/from output electrode
|
private |
2D-array: coulomb interaction between pair of hopping sites
|
private |
list of accumulated rates. only used in storing mode for binary search
|
private |
2D-array: transition rates
|
private |
save if last step was found in stored states. if true, binary search is done to find swap
|
private |
set by System::getReadyForRun()
|
private |
set false after memory limit is reached
|
private |
if set true performance is optimized by storing known states
| double System::time =0 |
system time. see System::increaseTime()


|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<Keys> org.openqa.selenium.Keys
public enum Keys
Representations of pressable keys that aren't text. These are stored in the Unicode PUA (Private Use Area) code points, 0xE000-0xF8FF. Refer to http://www.google.com.au/search?&q=unicode+pua&btnG=Search
| Method Summary | |
|---|---|
char |
charAt(int index)
|
static java.lang.String |
chord(java.lang.CharSequence... value)
Simulate pressing many keys at once in a "chord". |
int |
length()
|
java.lang.CharSequence |
subSequence(int start,
int end)
|
java.lang.String |
toString()
|
static Keys |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static Keys[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final Keys NULL
public static final Keys CANCEL
public static final Keys HELP
public static final Keys BACK_SPACE
public static final Keys TAB
public static final Keys CLEAR
public static final Keys RETURN
public static final Keys ENTER
public static final Keys SHIFT
public static final Keys LEFT_SHIFT
public static final Keys CONTROL
public static final Keys LEFT_CONTROL
public static final Keys ALT
public static final Keys LEFT_ALT
public static final Keys PAUSE
public static final Keys ESCAPE
public static final Keys SPACE
public static final Keys PAGE_UP
public static final Keys PAGE_DOWN
public static final Keys END
public static final Keys HOME
public static final Keys LEFT
public static final Keys ARROW_LEFT
public static final Keys UP
public static final Keys ARROW_UP
public static final Keys RIGHT
public static final Keys ARROW_RIGHT
public static final Keys DOWN
public static final Keys ARROW_DOWN
public static final Keys INSERT
public static final Keys DELETE
public static final Keys SEMICOLON
public static final Keys EQUALS
public static final Keys NUMPAD0
public static final Keys NUMPAD1
public static final Keys NUMPAD2
public static final Keys NUMPAD3
public static final Keys NUMPAD4
public static final Keys NUMPAD5
public static final Keys NUMPAD6
public static final Keys NUMPAD7
public static final Keys NUMPAD8
public static final Keys NUMPAD9
public static final Keys MULTIPLY
public static final Keys ADD
public static final Keys SEPARATOR
public static final Keys SUBTRACT
public static final Keys DECIMAL
public static final Keys DIVIDE
public static final Keys F1
public static final Keys F2
public static final Keys F3
public static final Keys F4
public static final Keys F5
public static final Keys F6
public static final Keys F7
public static final Keys F8
public static final Keys F9
public static final Keys F10
public static final Keys F11
public static final Keys F12
| Method Detail |
|---|
public static Keys[] values()
for (Keys c : Keys.values()) System.out.println(c);
public static Keys valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is nullpublic static java.lang.String chord(java.lang.CharSequence... value)
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public int length()
length
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Enum<Keys>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |


Thailand
South East Asia's Top Ranked Travel Destination. A highly export-oriented economy, as two-thirds of the country's GDP is derived from exports and tourism.
The hotel and restaurant sector is the biggest contributor (24.9%) to Thailand's GDP. The next biggest sectors are trade and logistics, which account for 13.4% of GDP, followed by agriculture (8.4%). In terms of GDP, Thailand ranks as the second largest of Southeast Asia’s economies. The country has achieved a dramatic decrease in poverty levels between 1988 and 2011. Automobiles, financial services, tourism, electrical equipment, and cement are some of the biggest industries in Thailand, while machinery, electronics, chemicals, automobiles and parts, textiles, and furniture are the country's top exports. China, USA, Japan, Malaysia, and Australia are Thailand's five top export partners.


@main("About") {
Jasper Wagen is a budding software developer based in Bristol, England. He first gained development experience as an Engineering Undergraduate at the University of the West of England. Most recently he has gained employment at HMRC Digital as a DevOps Apprentice.


jsfx
See
github
for more information.
Reset
Randomize
Play
To Library
Load
link
Play On Change
Library
Log
jsfx... loading...


Java Programming Resources for CSC 120
CS Lab Virtual Image
Click here to log in and use the CS Lab Virtual Image
(can be used directly if you are on-campus; requires a VPN connection to use from off-campus)
Starter Templates for Java Programming
(right-click on the link(s) and choose "Save File As..." or "Save Link As...")
For basic one-panel Applications:
- MUPanel.java
→ note: you must rename the file so that it has a .java extension!
For Applications that use the GUI Designer:
- MUFrameWithGUIDesigner.zip
(Extract All from this to obtain 3 files that should be copied to the src folder of your NetBeans project)
Web Pages to help you with Java
JavaDocs and Java Classes
How to Use Swing Components for a User Interface
MU Java Docs for the graphical classes: Balloon, Flag, etc.
MU Java Docs for the non-graphical classes: Grownup, Infant.
MU Java Classes - these are the class files to download for labs. Java Class files included are Balloon, BalloonOnAString, Boat, Book, and Flag


Check your benefit payment letter
The type of JSA you get is shown on page 3 or 4, under the heading 'How your Jobseeker's Allowance was worked out'. It will say either:
It will say either:
- 'We call this income-based Jobseeker's Allowance.'
- 'We call this contribution-based Jobseeker's Allowance.'
Find out more about the different types of JSA.
It's important you know what benefit you get. If you're not sure contact the Jobcentre Plus
Helpline.


@li.present /// /// # Presentation Use mouse click and arrow keys to change the slide, or scroll just through. ////// # Slide 2 ### To View This Presentation 1. Save with _.html_ extension 2. Open in any web browser that has JavaScript enabled ### To Edit This Presentation 1. Open in any raw text editor (Notepad on Windows, TextEdit on Mac) 2. Enter text beneath the script tag on the first line 3. Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to format the text or add images ////// # Displaying Data @li.table Month,Location,Profit 2018-10,London,134.05 2018-10,New York,-23.45 2018-11,London,154.60 2018-11,New York,243.23 2018-12,London,294.33 2018-12,New York,324.32 2019-01,London,243.03 2019-01,New York,144.23 2019-01,Tokyo,145.20 Tables are interactive! This table was copy and pasted from a CSV, but you can also paste straight from a spreadsheet. ////// # Slide 4 Use six slashes to separate out the slides. This presentation will auto resize to fit any screen, and you can change the zoom with **Ctrl+** and **Ctrl-** if you want to increase or decrease the text size. Remember to make the browser full screen! //////


[§8-19] Makahiki Commemoration Day. November 20th of each year shall be known and designated as Makahiki Commemoration Day. This day shall not be construed as a state holiday. [L 2008, c 68, §2]


This website was created for my Capstone in the Artificial Intelligence Guild Apprentice Program.
The Kombucha Mold Detector is a Convolutional Neural Network (CNN) Classifier built via ResNet18 with transfer learning through the fast.ai library.
Using the brightness and color of individual pixels as input features, CNN classifiers ("Computer Vision models") utilize the brains of a neural network to identify granular shapes and textures within images and ultimately understand their relationship to the target variable (in this case, the presense of Mold).
The model was trained on images scraped from various Kombucha blogs and other photos labeled from credible sources.
Prediction Accuracy rate: 88.9%.
Prediction Recall rate: 87.7%.


A resource can be updated by sending a PATCH request to the URL that
represents the resource.
The URL for a resource can be obtained in the self link of the resource
object.
Alternatively, when a GET request returns a single resource object as
primary data, the same request URL can be used for updates.
The PATCH request MUST include a single resource object as primary data.
The resource object MUST contain type and id members.
Any or all of a resource’s attribute may be changed in a PATCH request.
Note: Any missing attributes will remain unchanged. The server MUST NOT
have their values changed to null.
Similar to attributes, a Resource’s relationship may also be changed using
a PATCH request.
Note: Any missing relationships will remain unchanged. The server MUST NOT
have their values changed to null.


Username
Password (
reset
)
Sign in
Sign up
Hello there,
!
Sign out
Something Tracker
Amount
Note
Add item
Tracked Items
Amount
Note
Nothing tracked yet, add something!
Clear tracked items


Are you and your spouse one of those crazy nature lovers looking for an adventurous holiday in Sri Lanka? You’ve come to the right spot! From rainforests to jungles to tea estates to beaches to riversides, you decide where you want to camp for the night! If you are wondering whether you might have to compromise on comfort and luxury to get hold of this adventurous holiday, don’t sweat it. We have couple camping options in Sri Lanka to suit your requirements; be it a restricted budget or a luxury honeymoon.
Belihul Oya is a unique climatically transitional area that connects the dry and wet zones of Sri Lanka and consists of moist semi-evergreen forests, montane temperature forests, tropical savanna forests and dry grasslands. Another highlight in Belihul Oya is a natural rock pool where two streams meet and create a natural bathing area with clear and unpolluted water. While at this one-of-a-kind campsite, feel free to try activities such as canoeing and trekking with your loved one. Best time to visit: Throughout the year Camping Companies: River Garden Resort – Semi luxury camping
Only for the true nature lovers: enjoy an adventure filled camping holiday in Kitulgala with your partner. Camping here means you get to wake up to the sounds of birds chirping and water flowing from nearby waterfalls. Kitulgala is the wettest zone in all of Sri Lanka and is the base for white water rafting. Hence you can partake in fun activities such as white water rafting, trekking, nature trails, bird watching, cycling, river expeditions, swimming in waterfalls, confidence jumps and much more. Best time to visit: January to April.
To be absorbed in one of the oldest civilizations of the country, you should definitely try camping in the Dambana Veddha village of Sri Lanka. People here have their own cultures and traditions, so this will be very interesting because you can meet them and talk about their life styles. You can also enjoy their unique cuisines and know more about the history of Sri Lanka. Best time to visit is : Throughout the year
Like I mentioned there are many camping options in Sri Lanka, jungles and lakes are not the only place – you can camp in a beach too. This will be completely different, as you will be waking up to the sounds of the waves clashing against rocks with a beautiful sunrise in-front of you. Also Kalpitiya beach is one of the best beaches in Sri Lanka that offers you a wide range of activities like Canoeing, dolphin watching and kite surfing. Best time to visit is : October to May


[News] San Jose talks campaign finance after dramatic and costly election
As San Jose winds down from a feisty and expensive election season, Councilmember Sergio Jimenez asked lawmakers to rethink campaign finance regulations to help restore public trust in local government....


U.C. Berkeley
January 2014 - Present
Fluid Mechanics Laboratory
Research and Design under Professor Ömer Savaş
I am a U.C. Berkeley senior pursuing a BS in Mechanical Engineering. My primary interests in the field are aerospace engineering and manufacturing design. I have enjoyed exploring these areas through my classes, as well as implementing concepts in real-world situations: I have produced test equipment for wind tunnels, designed miniature robots for electrical engineering competitions, and analyzed the orbital mechanics of celestial bodies. I enjoy both conceptual and practical challenges, and look forward to facing new ones. Continue reading to learn more about who I am and what I do.
September 2011 - May 2015
Bachelor of Science, Mechanical Engineering
U.C. Berkeley
January 2014 - Present
Research and Design under Professor Ömer Savaş
U.C. Berkeley
January 2014 - May 2014
Research under Professor James Casey
U.C. Berkeley
January 2014 - May 2014
Fabrication Team; 1st Place MIDPAC 2014, 3rd Place Nationals
Fountain Valley, CA
May 2014 - August 2014
Mechanical/Quality Engineering Intern
Long Beach, CA
December 2012
Engineering Extern
SOLIDWORKS |
INVENTOR |
AUTOCAD |
MATLAB |
LABVIEW |
PYTHON |
C++ (ARDUINO) |
HTML |
CSS |
MS OFFICE |
PHOTOSHOP |
ILLUSTRATOR |
LATEX |
WINDOWS |
OS X |
FLUID MECHANICS |
OFFSHORE SYSTEMS |
AERODYNAMICS |
SOLID MECHANICS |
ENGINEERING MECHANICS |
PLANAR MACHINERY |
FEEDBACK CONTROL |
MEASUREMENT SYSTEMS |
MECHATRONIC |
BEHAVIOR OF MATERIALS |
MATERIALS IN MANUFACTURING |
FINITE ELEMENT METHODS |
HEAT TRANSFER |
COMBUSTION |
CIRCUITS |
ENGINEERING DESIGN GRAPHICS |
MECHANICAL ENGINEERING LABORATORY |
Playing the piano - I currently hold a Level 10 Certificate of Merit. I play and enjoy a wide variety of music
Cooking - preparing dishes is an entertaining experience. The most interesting part is learning how to improve the regular recipe so that it tastes even better - because of that.
SAT Tutoring - in high school, I dedicated a lot of time to learning the ins and outs of the SAT exam. Since then, I've worked, and continue to work, as a private tutor teach how to take the exam and score to their maximum potential.
Graphic Design - aside from designing posters and handouts for classes, I also do small design projects on the side and keeep up with new or interesting imaging techniques.


{% include '_includes/head.html' %}
{% include '_includes/header.html' %}
{% block content %}{% endblock %}
{% include '_includes/footer.html' %} {% include '_includes/scripts.html' %}


Documentation / SQL / Queries
Where raw()
We can use raw()
expressions to add arbitrary SQL expressions to the where
clause of a query.
Order.find.where()
.raw("add_days(orderDate, 10) < ?", someDate)
.findList();
findNative
With findNative()
we give Ebean SQL
. Ebean will automatically map the columns
in the result back to the bean(s).
String nativeSql = "select id, name from customer where name like :some";
List<Customer> customers =
ebeanServer.findNative(Customer.class, nativeSql);
.setParameter("some", "Rob%")
.findList();
RawSql
RawSql
is like findNative except instead of the mapping being automatic we explicitly
define the mapping of how the result columns map to the entity beans.
String rs = "select o.id, o.status, c.id, c.name, " +
" d.id, d.order_qty, p.id, p.name " +
"from orders o join customer c on c.id = o.customer_id " +
"join order_detail d on d.order_id = o.id " +
"join product p on p.id = d.product_id " +
"where o.id <= :maxOrderId and p.id = :productId " +
"order by o.id, d.id asc";
RawSql rawSql = RawSqlBuilder.parse(rs)
.tableAliasMapping("c", "customer")
.tableAliasMapping("d", "details")
.tableAliasMapping("p", "details.product")
.create();
List<Order> ordersFromRaw = Ebean.find(Order.class)
.setRawSql(rawSql)
.setParameter("maxOrderId", 2)
.setParameter("productId", 1)
.findList();
SqlQuery
SqlQuery
is a query that doesn't use entity beans and instead returns SqlRow
objects. As such there is no bean mapping
.
SQL Views


Hi, I'm Drew. I spent a week writing code for this website from scratch. All the code is hosted on github, if you're curious. If you have any questions or concerns, I can be reached by email.