Werkzeug is intended to be a utility rather than a framework. Because of that the user-friendly API is separated from the lower-level API so that Werkzeug can easily be used to extend another system.
All the functionality the Request and Response objects (aka the “wrappers”) provide is also available in small utility functions.
This example implements a small Hello World application that greets the user with the name entered:
from werkzeug import Request, Response, escape
@Request.application
def hello_world(request):
result = ['<title>Greeter</title>']
if request.method == 'POST':
result.append('
Hello %s!
' % escape(request.form['name']))
result.append('''
<form action="" method="post">

Name: <input type="text" name="name" size="20">
<input type="submit" value="Greet me">
</form>
''')
return Response(''.join(result), mimetype='text/html')
Alternatively the same application could be use without request and response objects but by taking advantage of the parsing functions werkzeug provides:
from werkzeug import parse_form_data, escape
def hello_world(environ, start_response):
result = ['<title>Greeter</title>']
if environ['REQUEST_METHOD'] == 'POST':
form = parse_form_data(environ)[1]
result.append('
Hello %s!
' % escape(form['name']))
result.append('''
<form action="" method="post">

Name: <input type="text" name="name" size="20">
<input type="submit" value="Greet me">
</form>
''')
start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')])
return [''.join(result)]
Usually you want to use the high-level layer (the request and response objects). But there are situations where this might not be what you want.
For example you might be maintaining code for an application written in Django or another framework and you have to parse HTTP headers. You can utilize Werkzeug for that by accessing the lower-level HTTP header parsing functions.
Another situation where the low level parsing functions can be useful are custom WSGI frameworks, unit-testing or modernizing an old CGI/mod_python application to WSGI as well as WSGI middlewares where you want to keep the overhead low.


---
sort_order: 116
tei_id: rdx_191dd.p.idp18975232
annotation_count: 0
images:
small-thumbnail: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfh3m/mini-thumbnail/
json: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfh3m/info/
full: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfh3m/fs/
page: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfh3m/single-page/
thumbnail: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfh3m/thumbnail/
title: Page 116
number: 116
---
{% raw %}\18 THE LAKD-CLAm.{% endraw %}
{% raw %}putting such a question, Sir Deming, did not a consciousness of{% endraw %}
{% raw %}my own unworthiness tie my tongue," eaid AUen.{% endraw %}
{% raw %}" What's that, sir !  Sir Deming, I thiuk you understand that tho{% endraw %}
{% raw %}seeming equality of our circumstances has ceased to exist.{% endraw %}
{% raw %}You do not believe iu unequal marriages—aud neither do I."{% endraw %}
{% raw %}" Well! well! -well!—do you hear that, Alicia ?  It is myself—my love—as pure and{% endraw %}
{% raw %}ardent a love as man ever felt—that I propose to sacrifice to{% endraw %}
{% raw %}her present and future good. If I -n'cre rich, and could keep{% endraw %}
{% raw %}her in the social position she is entitled to, the case would{% endraw %}
{% raw %}then be different. As it is, I can not ask her to marry me."{% endraw %}
{% raw %}" By Jupiter, young man, I like your spirit! I like your{% endraw %}
{% raw %}nation, too, I have seeu much of Americans this summer,{% endraw %}
{% raw %}and I liTce them, A good amount of brag—but they came{% endraw %}
{% raw %}honestly by that—for there's no greater boaster than John{% endraw %}
{% raw %}BuU, That's not the question, however.  cried the baronet, laughing.{% endraw %}
{% raw %}" Who but a woman would have found so smooth a way out{% endraw %}
{% raw %}of a difficulty ? I must give you away, must I ? I have half{% endraw %}
{% raw %}a mind uot to humor the republican, to do that. But, if I{% endraw %}
{% raw %}don't, I shall have you so dull, that your comp.any will quite{% endraw %}
{% raw %}upset my enjoyment of our travel. Here, Mr. Alien, I giv«{% endraw %}
{% raw %}her to you. She is yours, and I congratulate you both. Mrs.{% endraw %}
{% raw %}Wyman does the same, I am sure."{% endraw %}
{% raw %}" The Lord be praised!" exclaimed Mrs. Wyman, as Allen{% endraw %}
{% raw %}received his young bride iu his arms. " If ever I wished any{% endraw %}
{% raw %}thing in my life, I did wish for this!"{% endraw %}
{% raw %}" Do you think you can get these young people marri*^{% endraw %}


CHASE SILLEVIS
. . \`_\`. \\ . / |-, -~~=>;_. ' "
__\""~-, `< <-, -~~=>;_. ' "
__ -=""" <-, -~~`>;_,'' "
_,.-, -~~=<' /' > // ;/'
People I work with have described me as disciplined, flexible, motivated and hard-working. I care deeply about advancing the human race and truly believe any one of us can make the difference. “The purpose of life is finding the largest burden that you can bear, and bearing it.” ― Jordan B. Peterson
Links: * github * linkedin * twitter Certifications: * certified terraform associate * certified kubernetes administrator * game theory * duolingo english proficiency * python for data science and machine learning bootcamp
You might know me via: * google * digilyfe * fitbit * blockstream * my wolfdog 🐺 * lord of the code * hashbang.sh * zenbot * terraform-provider-gsuite * dualdev * mediamonks * leadfeeder * etopia * sweebr


#
INFO 610 Fall 2020
Week 6
More on the SQL
chrisfauerbach.github.io/info610_fall_2020/
--- # SQL Review * Materialized Views * Query / Distinct * Join types * Grouping --- # Materialized Views Materialized views in PostgreSQL use the rule system like views do, but persist the results in a table-like form. The main differences between: ```sql CREATE MATERIALIZED VIEW mymatview AS SELECT * FROM mytab; ``` and: ```sql CREATE TABLE mytable AS SELECT * FROM mytab; CREATE VIEW myview AS SELECT * FROM mytab; ``` are that the materialized view cannot subsequently be directly updated and that the query used to create the materialized view is stored in exactly the same way that a view's query is stored, so that fresh data can be generated for the materialized view with: ```sql REFRESH MATERIALIZED VIEW mymatview; ``` --- While access to the data stored in a materialized view is often much faster than accessing the underlying tables directly or through a view, the data is not always current; yet sometimes current data is not needed. Consider a table which records sales: ```sql CREATE TABLE invoice ( invoice_no integer PRIMARY KEY, seller_no integer, -- ID of salesperson invoice_date date, -- date of sale invoice_amt numeric(13,2) -- amount of sale ); ``` If people want to be able to quickly graph historical sales data, they might want to summarize, and they may not care about the incomplete data for the current date: ```sql CREATE MATERIALIZED VIEW sales_summary AS SELECT seller_no, invoice_date, sum(invoice_amt)::numeric(13,2) as sales_amt FROM invoice WHERE invoice_date < CURRENT_DATE GROUP BY seller_no, invoice_date ORDER BY seller_no, invoice_date; ``` --- # Update Materialized View This materialized view might be useful for displaying a graph in the dashboard created for salespeople. A job could be scheduled to update the statistics each night using this SQL statement: ```sql REFRESH MATERIALIZED VIEW sales_summary; ``` --- # Distinct
SELECT DISTINCT
eliminates duplicate rows from the result. If SELECT DISTINCT is specified, all duplicate rows are removed from the result set (one row is kept from each group of duplicates) --- # In practice ```sql CREATE TABLE t1 ( id serial NOT NULL PRIMARY KEY, bcolor VARCHAR, fcolor VARCHAR ); INSERT INTO t1 (bcolor, fcolor) VALUES ('red', 'red'), ('red', 'red'), ('red', NULL), (NULL, 'red'), ('red', 'green'), ('red', 'blue'), ('green', 'red'), ('green', 'blue'), ('green', 'green'), ('blue', 'red'), ('blue', 'green'), ('blue', 'blue'); ``` --- ```sql SELECT * FROM t1; ``` |ID|bcolor|fcolor| |--|--|--| |1|red|red| |2|red|red| |3|red|| |4||red| |5|red|green| |6|red|blue| |7|green|red| |8|green|blue| |9|green|green| |10|blue|red| |11|blue|green| |12|blue|blue| --- ```sql SELECT * FROM t1; ``` |ID|bcolor|fcolor| |--|--|--| |1|red|red| |2|red|red| |3|red|| |4||red| |5|red|green| |6|red|blue| |7|green|red| |8|green|blue| |9|green|green| |10|blue|red| |11|blue|green| |12|blue|blue| --- ```sql select distinct bcolor from t1 ``` |bcolor| |--| |(null)| |green| |blue| |red| --- # Joins * Left Outer * Inner * Right Outer * Full Outer ---
--- # Previous week's SQL Outer joins
class.sql
--- # WHERE clause Chapter 5, Pg 179 * Used to filter data in a result set * Filtering is specified after the `WHERE` keyword * If rows MATCH the `WHERE` clause, they are returned ```sql SELECT [COLUMNS] FROM [TABLE(s)] WHERE [CONDITION(s)] ``` e.g. ```sql SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID = 4 ``` --- # WHERE examples ```sql SELECT * FROM car_model WHERE make='Ford'; SELECT * FROM car WHERE mileage < 250000; SELECT * FROM car WHERE number_of_doors > 3 AND number_of_owners <= 2 ; ``` Can perform math, watch out for divide by zero ```sql SELECT * FROM t WHERE b / a > 0.5 and a<>0; ``` * <, <=, >, >=, <> * BETWEEN ( x BETWEEN a AND b ) ( inclusive, x >= a AND x <= b ) * OVERLAPS (comparing two dates ranges) * (date '2018-10-25', date '2018-10-31') OVERLAPS (date '2018-10-25', date '2018-11-15') --- # Grouping The GROUP BY Statement in SQL is used to arrange identical data into groups with the help of some functions. i.e if a particular column has same values in different rows then it will arrange these rows in a group * https://www.geeksforgeeks.org/sql-group-by/ ```sql SELECT column1, function_name(column2) FROM table_name WHERE condition GROUP BY column1, column2 ORDER BY column1, column2; function_name: Name of the function used for example, SUM() , AVG(). table_name: Name of the table. condition: Condition used. ``` --- # Example |make|model|year|price| |--|--|--| |Ford|Flex|2012|11,234| |Ford|Flex|2013|12,222| |Ford|Flex|2012|14,999| |BMW|330i|2012|17,999| |BMW|330i|2013|18,999| |...|...|...|...| ```sql SELECT make, model, count(*) FROM car_for_sale GROUP BY make, model ``` |Make|Model|Count(*)| |--|--|--| |Ford|Flex|3| |BMW|330i|7| |Honda|Civic|9| --- # HAVING |make|model|year|price| |--|--|--| |Ford|Flex|2012|11,234| |Ford|Flex|2013|12,222| |Ford|Flex|2012|14,999| |BMW|330i|2012|17,999| |BMW|330i|2013|18,999| |...|...|...|...| ```sql SELECT make, model, count(*) c FROM car_for_sale GROUP BY make, model HAVING c > 7 ``` |Make|Model|Count(*)| |--|--|--| |Honda|Civic|9| --- # Ordering Results `ORDER BY` clause allows for sorting of results ```sql ... ORDER BY price desc ``` ```sql ... ORDER BY price asc ``` * NULL is considered great than any other value ```sql SELECT make, model, count(*) c FROM cars GROUP BY make, model ORDER BY c desc ``` ```sql SELECT make, model, price FROM cars ORDER BY price asc ``` ```sql SELECT make, model, price FROM cars ORDER BY 1, 2, price asc // Make, Model, Price ``` --- # INSERT Put data into the database ```sql INSERT INTO cars (make, model, year, price) values ('Ford','Focus', 2001,1500); ``` ```sql INSERT INTO cars (make, model, year, price) values ('Ford','Focus', 2001,1500) ,('Honda','Civic', 2005,2250); ``` ```sql INSERT INTO expensive_cars(make, model, year, price) SELECT make, model, year, price FROM cars WHERE price > 20000; ``` --- # UPDATE Changes data that's in the database. ```sql UPDATE t SET f = f + 1 WHERE id = 5; ``` ```sql UPDATE t SET description = "This is a new description"; ``` --- # DELETE Permanently removes data from a database ```sql DELETE FROM t WHERE id = 120; ``` ```sql DELETE FROM t WHERE id = 120; ``` ```sql DELETE FROM car WHERE make = 'porsche' RETURNING *; porsche, 911 Turbo, 2003, 23000 ``` --- # TRUNCATE Deletes ALL the data in a table, leaves the table behind. ```sql TRUNCATE TABLE cars; ``` Really useful on large tables. Same as ```sql DELETE FROM cars; ``` but much faster since it doesn't delete row by row. --- # PICK A PROJECT * Come up with a project definition. Less than two page writeup of what will happen in your application/database * Design database tables, ER Diagram, Relationships (one to one, one to many, many to many), name your tables * Detail Design - All columns, data types, primary keys, foreign keys * Build SQL to generate tables * Build SQL to insert data * Generate SQL to query state of the database * Each project needs at least 10 tables. If you can't come up with 10, then add more to your story. --- ---


| package |
ArangoDBClient |
| since |
3.5 |
| inherited_from |
\ArangoDBClient\TransactionBase |
Methods
Constructs a streaming transaction object
__construct(\ArangoDBClient\Connection $connection, array $transactionArray = null
)
| inherited_from |
\ArangoDBClient\TransactionBase::__construct() |
Parameters
$connection
\ArangoDBClient\Connection
$transactionArray
array
- array with collections used by the transaction
Initialise the transaction object
__construct(\ArangoDBClient\Connection $connection)
Inherited
Parameters
$connection
\ArangoDBClient\Connection
- the connection to be used
Exceptions
\ArangoDBClient\ClientException |
|
Get an attribute, magic method
__get(string $key) : mixed
Inherited
This function is mapped to get() internally.
Parameters
Returns
mixed
- value of attribute, NULL if attribute is not set
Is triggered by calling isset() or empty() on inaccessible properties.
__isset(string $key) : boolean
Inherited
Parameters
Returns
boolean
returns true or false (set or not set)
Set an attribute, magic method
__set(string $key, mixed $value) : void
Inherited
This is a magic method that allows the object to be used without
declaring all document attributes first.
Parameters
Exceptions
\ArangoDBClient\ClientException |
|
Get an attribute
get(string $key) : mixed
Inherited
Parameters
Returns
mixed
- value of attribute, NULL if attribute is not set
Get a participating collection of the transaction by name
Will throw an exception if the collection is not part of the transaction
getCollection(string $name) : \ArangoDBClient\StreamingTransactionCollection
Parameters
Exceptions
\ArangoDBClient\ClientException |
|
Returns
\ArangoDBClient\StreamingTransactionCollection
- collection object
Get collections array
getCollections() : array
Inherited
This holds the read and write collections of the transaction
Returns
array
$value
Convenience function to directly get exclusive-collections without having to access
them from the collections attribute.
getExclusiveCollections() : array
Inherited
Get the transaction's id
getId() : string
Returns
string
- transaction id
Get lockTimeout value
getLockTimeout() : integer
Inherited
Returns
integer
lockTimeout
Convenience function to directly get read-collections without having to access
them from the collections attribute.
getReadCollections() : array
Inherited
get waitForSync value
getWaitForSync() : boolean
Inherited
Returns
boolean
waitForSync
Convenience function to directly get write-collections without having to access
them from the collections attribute.
getWriteCollections() : array
Inherited
Executes an AQL query inside the transaction
query(array $data) : \ArangoDBClient\Cursor
This is a shortcut for creating a new Statement and executing it.
Parameters
$data
array
- query data, as is required by Statement::__construct()
Exceptions
\ArangoDBClient\ClientException |
|
Returns
\ArangoDBClient\Cursor
- query cursor, as returned by Statement::execute()
Sets an attribute
set($key, $value)
Inherited
Parameters
$key
$value
Exceptions
\ArangoDBClient\ClientException |
|
Set the collections array.
setCollections(array $value)
Inherited
The array should have 2 sub-arrays, namely 'read' and 'write' which should hold the respective collections
for the transaction
Parameters
$value
array
Convenience function to directly set exclusive-collections without having to access
them from the collections attribute.
setExclusiveCollections(array $value)
Inherited
Set the transaction's id - this is used internally and should not be called by end users
setId(mixed $id)
Parameters
$id
mixed
- transaction id as number or string
Set lockTimeout value
setLockTimeout(integer $value)
Inherited
Parameters
$value
integer
Exceptions
\ArangoDBClient\ClientException |
|
Convenience function to directly set read-collections without having to access
them from the collections attribute.
setReadCollections(array $value)
Inherited
set waitForSync value
setWaitForSync(boolean $value)
Inherited
Parameters
$value
boolean
Exceptions
\ArangoDBClient\ClientException |
|
Convenience function to directly set write-collections without having to access
them from the collections attribute.
setWriteCollections(array $value)
Inherited
Build the object's attributes from a given array
buildTransactionAttributesFromArray($options)
| inherited_from |
\ArangoDBClient\TransactionBase::buildTransactionAttributesFromArray() |
Parameters
$options
Exceptions
\ArangoDBClient\ClientException |
|
Build the object's attributes from a given array
buildTransactionAttributesFromArray($options)
Inherited
Parameters
$options
Exceptions
\ArangoDBClient\ClientException |
|
Return the connection object
getConnection() : \ArangoDBClient\Connection
Inherited
Returns
\ArangoDBClient\Connection
- the connection object
Properties
The transaction's attributes.
$attributes : array
An array of collections used by this transaction
$_collections : array
The connection object
$_connection : \ArangoDBClient\Connection
The transaction id - assigned by the server
$_id : string
Constants
Collections index
ENTRY_COLLECTIONS = 'collections'
EXCLUSIVE index
ENTRY_EXCLUSIVE = 'exclusive'
class constant for id values
ENTRY_ID = 'id'
Lock timeout index
ENTRY_LOCK_TIMEOUT = 'lockTimeout'
Read index
ENTRY_READ = 'read'
WaitForSync index
ENTRY_WAIT_FOR_SYNC = 'waitForSync'
WRITE index
ENTRY_WRITE = 'write'


DTKit is a set of libraries and tools for converting input files (from different tools) into output files with a standard formats (JUNIT or TUSAR).
DTKit stands for Data Transformation Kit.It includes a set of default transformation.
Extensible
The DTKit architecture is extensible so that he end user can extend it with his own tools.
Have a look at the DTKit Design
JUnit
JUNIT is the standard Java xUnit framework. Running JUnit framework provides result files in a JUnit format. Hudson can record JUnit test results and provide useful information about test results, such as the historical test result trends, web UI for viewing test reports, tracking failures, and so on.
DTKit provides conversion in JUnit files with a set of xUnit result files (from C/C++,.NET or Ada xUnit frameworks) and the recording is performed by the Hudson xUnit plugin.
TUSAR
TUSAR stands for Thales Unified Sofware Analysis Report.
It’s a generic metric format composed of 4 categories:
- Coverage
- Measure
- Test
- Violations
TUSAR is defined by an XSD and a set of associated JAVA files.
The TUSAR XSD can be found in the Hudson trunk.
I. Content
1. DTKIT FRMK
DTKIT is a set of API. It is composed of a standard XSD for JUnit and TUSAR outputs.
DTKIT FRMK will be used if you want to add conversion for your own tools.
Changelog
Version 0.12
* Upgraded to Jenkins 1.396 API
Version 0.11
* Conversions make it possible to take parameters for XSL transformations
Version 0.10
* Internal Refactoring
Version 0.9
* Internal Refactoring
Version 0.8
* Internal Refactoring
Version 0.7
* Internal Refactoring
Version 0.6
* Internal Refactoring
Version 0.5
* Internal technical refactoring
* Added some JAXB and Jackson annotations to use DTKIT FRMK objects in a web service layer
Version 0.4
* Fixed some regressions introduced on DTKIT FRMK 0.3
Version 0.3
* Internal Technical Refactoring
Version 0.2
* Fixed package name for JUNIT model
Version 0.1
* Initial release
Compatibility version
DTKIT FRMK Version / Hudson Core |
Hudson 1.355 |
Jenkins 1.396 |
|---|---|---|
0.12 |
|
|
0.11 |
|
|
0.10 |
|
|
0.9 |
|
|
0.8 |
|
|
0.7 |
|
|
0.6 |
|
|
0.5 |
|
|
0.4 |
|
|
0.3 |
|
|
0.2 |
|
|
0.1 |
|
|
2. DTKIT Hudson Maven Plugin
DTKIT Maven Hudson Plugin makes its possible to convert generic POJOs from DTKIT into Hudson Java files so that they can be processed by xUnit Hudson plugin and TusarNotifier Hudson plugin.
Changelog
Version 0.10
* Upgraded to Jenkins 1.396 API
Version 0.9
* Upgraded its dependency to DTKIT FRMK 0.10
Version 0.8
* Upgraded its dependency to DTKIT FRMK 0.8
Version 0.7
* Upgraded its dependency to DTKIT FRMK 0.7
Version 0.6
* Upgraded its dependency to DTKIT FRMK 0.6
Version 0.5
* Upgraded its dependency to DTKIT FRMK 0.5
Version 0.4
* Upgraded its dependency to DTKIT FRMK 0.4
Version 0.3
* The generated DESCRIPTOR for each type returns a singleton
Version 0.2
* Added test phases in the plugin life-cycle
Version 0.1
* Initial release
Compatibility version
DTKIT Hudson Maven Plguin Version |
CI Core |
Default FRMK version |
|---|---|---|
0.10 |
Jenkins 1.396 |
0.12 |
0.9 |
Hudson 1.355 |
0.10 |
0.8 |
Hudson 1.355 |
0.8 |
0.7 |
Hudson 1.355 |
0.7 |
0.6 |
Hudson 1.355 |
0.6 |
0.5 |
Hudson 1.355 |
0.5 |
0.4 |
Hudson 1.355 |
0.4 |
0.3 |
Hudson 1.355 |
0.1 |
0.2 |
Hudson 1.355 |
0.1 |
0.1 |
Hudson 1.355 |
0.1 |
3. DTKIT Processor
This module makes it possible to declare metrics by annotation.
Changelog
Version 0.2
* Upgraded to Jenkins 1.396 API
Version 0.1
* Initial version
Compatibility version
DTKIT Default Version / |
Core Version |
|---|---|
0.2 |
Jenkins 1.396 |
0.1 |
Hudson 1.355 |
4. DTKIT Default
This module provides default outputs for the DTKIT.
Changelog
Version 0.14
* Integrated with DTKIT-Processor 0.1
Version 0.13
* Upgraded to DTKT FRMK 0.11
Version 0.12
* Upgraded to DTKT FORMAT JUNIT 0.12
Version 0.11
* Upgraded to DTKT FORMAT JUNIT 0.11
Version 0.10
* Upgraded to DTKT FRMK 0.10
* Upgraded to DTKIT Maven Plugin 0.9
Version 0.9
* Upgraded to DTKT FRMK 0.8
* Upgraded to DTKIT Maven Plugin 0.8
Version 0.8
* Internal Enhancement
Version 0.7
* Upgraded to DTKT FRMK 0.7
* Upgraded to DTKIT Maven Plugin 0.7
Version 0.7
* Upgraded to DTKT FRMK 0.6
* Upgraded to DTKIT Maven Plugin 0.6
Version 0.5
* Upgraded to DTKT FRMK 0.5
* Upgraded to DTKIT Maven Plugin 0.5
Version 0.4
* Upgraded to DTKT FRMK 0.4
* Upgraded to DTKIT Maven Plugin 0.4
Version 0.3
* Upgraded to DTKIT FRMK 0.3
Version 0.2
* Upgraded to DTKIT Hudson Maven Plugins 0.2
Version 0.1
* Initial release
Compatibility version
DTKIT Default Version / |
Hudson Core Version |
Default FRMK Version |
Default Hudson Maven Plugin |
|---|---|---|---|
0.14 |
1.355 |
0.11 |
0.9 |
0.13 |
1.355 |
0.11 |
0.9 |
0.12 |
1.355 |
0.10 |
0.9 |
0.11 |
1.355 |
0.10 |
0.9 |
0.10 |
1.355 |
0.10 |
0.9 |
0.9 |
1.355 |
0.8 |
0.8 |
0.8 |
1.355 |
0.7 |
0.7 |
0.7 |
1.355 |
0.7 |
0.7 |
0.6 |
1.355 |
0.6 |
0.6 |
0.5 |
1.355 |
0.5 |
0.5 |
0.4 |
1.355 |
0.4 |
0.4 |
0.3 |
1.355 |
0.2 |
0.2 |
0.2 |
1.355 |
0.1 |
0.1 |
0.1 |
1.355 |
0.1 |
0.1 |
DTKIT JUNIT Default
By, the default-supported tools are:
- Aunit
- BoostTest
- CppTest
- CppUnit
- FPCUnit
- MSTest
- Nunit
- PHPUnit
- TUSAR (output)
- UnitTest
For some tools, we supports a predefined version; and for other versions, the tool version is not determined (N/A) due to a lack of knowledge (Any help is welcome!).
We try to validate user inputs by an XSD file for each supported tool.
The role of the XSD is to validate the end users input files before being processed by DTKIT through the associated xUnit plugin and its derived plugins (Gallio, CppTest, CppUnit, Gnat).
Tool/Format |
Default supported version |
Input XSD |
JUnit output format |
|---|---|---|---|
AUNIT |
3.1.1 |
|
1.0 |
BOOSTTEST |
1.43.0 |
|
1.0 |
CPPTEST |
7.3 |
|
1.0 |
CPPUNIT |
1.12.1 |
|
1.0 |
FPCUNIT |
2.0 |
|
1.0 |
MSTEST |
N/A |
|
1.0 |
NUNIT |
N/A |
|
1.0 |
PHPUNIT |
3.4 |
|
1.0 |
TUSAR Format |
1.0 |
|
1.0 |
UNITTEST |
1.4 |
|
1.0 |
Changelog
Version 0.17
* Fixed C++Test Unit
Version 0.16
* Fixed somme minor issues
Version 0.15
* No dependency with dtkit-default
* Fixed JENKINS-8492 - NUnit test suites is not parsed correctly
* Fixed JENKINS-8553 - BoostTest output coverting to JUnit format can't be recognized if contains Exceptions in boostTest result
Version 0.14
* Integrated with DTKIT-Processor 0.1
Version 0.13
* pgraded to DTKT FRMK 0.11
Version 0.12
* Fixed JENKINS-7335 - Test function name containing < and > is not considered valid.
* Fixed JENKINS-8003 - xUnit plugin fails to parse simple xml output from unittest++
Version 0.11
* No changes. Release attached to Default Tusar
Version 0.10
* Fixed internal transformers
Version 0.9
* Fixed internal transformers
Version 0.8
* Added internal transformers
Version 0.7
* Internal Refactoring
Version 0.6
* Fixed JENKINS-7039 - New XSD and XSL for Boost Test - Thanks to under2x
* Fixed JENKINS-7255 - Enhanced XSD and XSL for Boost Test
Version 0.5
* Fixed JENKINS-7012 - Fixed CppUnit XSD - Thanks to qinqon
* Upgraded to DTKIT Default 0.4
Version 0.4
* Fixed reopened JENKINS-6951 (PHPUnit XSD)
* Enhanced version name
Version 0.3
* Fixed JENKINS-6951 (PHPUnit XSD)
Version 0.2
* Fixed PHPUnit XSL and added PHPUnit testcases
Version 0.1
* Initial release
Compatibility version
DTKIT Default JUnit Verion |
DTKIT Default Version |
|---|---|
0.17 |
x |
0.16 |
x |
0.15 |
x |
0.14 |
0.14 |
0.13 |
0.13 |
0.12 |
0.12 |
0.11 |
0.11 |
0.10 |
0.10 |
0.9 |
0.9 |
0.8 |
0.8 |
0.7 |
0.7 |
0.6 |
0.6 |
0.5 |
0.4 |
0.4 |
0.3 |
0.3 |
0.2 |
0.2 |
0.1 |
0.1 |
0.1 |
From 0.15, DTKit Default JUnit is independent.
DTKIT TUSAR Default
By, the default-supported tools are:
- Checkstyle
- Cobertura
- Cppcheck
- Cpptest
- Junit
- Klockwork
Changelog
Version 0.22
* Updated to Tusar model 0.16
Version 0.21
* Update the Klocwork XSD
Version 0.20
* Fixed metrics tools (klockwork, C++Test)
Version 0.19
* Fixed metrics tools
Version 0.18
* Fixed metrics tools
Version 0.17
* Fixed metrics tools
Version 0.16
* Upgraded to Jenkins 1.396 API
Version 0.15
* Integrated with DTKIT-Processor 0.1
Version 0.14
* Fixed boostest
Version 0.13
* Updated to DTKIT FRMK 0.13
Version 0.12
* No changes. Release attached to Default JUnit
Updated to TUSAR Format 0.11
* Fixed internal transformers
Version 0.10
* Introduced a new TUSAR 3 format
Version 0.9
* Fixed internal transformers
Version 0.8
* Fixed internal transformers
Version 0.7
* Added the support of Gnatmetric
* Internal Refactoring
Version 0.6
* Enhanced the C++Test XSL
Version 0.5
* Upgraded to DTKIT Default 0.4
Version 0.4
* Enhanced version name
Version 0.3
* Technical Release
Version 0.2
* Fixed wrong artifact spelling
Version 0.1
* Initial release
Compatibility version
DTKIT Default TUSAR Verion |
DTKIT Default Version |
|---|---|
0.22 |
x |
0.21 |
x |
0.20 |
x |
0.19 |
x |
0.18 |
x |
0.17 |
x |
0.16 |
x |
0.15 |
0.14 |
0.14 |
0.13 |
0.13 |
0.13 |
0.12 |
0.12 |
0.11 |
0.11 |
0.10 |
0.10 |
0.9 |
0.9 |
0.8 |
0.8 |
0.7 |
0.7 |
0.6 |
0.6 |
0.5 |
0.4 |
0.4 |
0.3 |
0.3 |
0.2 |
0.2 |
0.1 |
0.1 |
0.1 |
From 0.16, DTKit Default Tusar is independent.
5. DTKIT RS
is module provides RESTful web services for DTKIT.
You are able to add transformers (metrics), validate input files against an existing metric, convert input files against a supported format.
There are also generic services for validating and converting any input files.
DTKIT-RS contains a set of default transformers (the embbedded mode, given by the module dtkit-default-junit and dtkit-default-tusar).
Additionaly, you are able to add your own tramsformer (a metric associated with a name, a version, an XSL and an optional XSD).
For storing new metrics, we use a NoSQL datastore MongoDB.
The services are:
- GET /inputMetrics returns all the metrics (or transformers).
The response is sent in XML or JSON according the client request header.Example
curl -X GET -H "Accept:application/json" http://localhost:8080/inputMetrics
- GET /inputMetrics;{filter} returns all the information for the current metrics (matching the criterion given by the user with the filter).
The response is sent in XML or JSON according the client request header.Example
curl -X GET -H "Accept:application/json" http://localhost:8080/inputMetrics;name=boosttest;format=junit
- GET /inputMetrics/xsd;{filter} returns the XSD content for the current metrics (matching the criterion given by the user with the filter).
If there are no XSD for the selected metric, a 404 status is returned.Be Careful
The request header must be application/xml
Example
- POST /inputMetricsValidation;{filter} validates an input file (sent in the request body) against XSD of the current metrics (matching the criterion given by the user with the filter).
If the metric, doesn't have an XSD, the validation is OK and the status code is 200.
The response is sent in XML or JSON according the client request header.Example
curl -X POST -H "Accept:application/json"<EMAIL_ADDRESS>http://localhost:8080/inputMetricsValidation;name=boosttest;format=junit
- POST /inputMetricsValidation validates a given input file against an input xsd (sent in the request body).
The method returns a validation string in XML or JSON according the client request header.Saxon library is used for the validation
Example
curl -X POST -H "Accept:application/json"<EMAIL_ADDRESS><EMAIL_ADDRESS>http://localhost:8080/inputMetricsValidation
- POST /inputMetricsConversion/{filter} converts the input file (sent in the request body) with the associated conversion method (provided programmatically by the metric or via its XSL) for the current metrics (matching the criterion given by the user with the filter).
The method returns the converted file.
The converted file is in the output format associated to the input metric.Be Careful
The request header must be application/xml
Example
curl -X POST<EMAIL_ADDRESS>http://localhost:8080/inputMetricsConversion;name=boosttest;format=junit
- POST /inputMetricsConversion/ converts a given input file againt a given input xsl (both files in the request body).
The method returns the converted file.
The converted file is in the output format associated to the input metric.Be Careful
The request header must be application/xml
Example
curl -X POST<EMAIL_ADDRESS><EMAIL_ADDRESS>http://localhost:8080/inputMetricsConversion
- PUT /inputMetrics inserts a metric with the form parameters 'name, version, format and type'
Example
curl -X PUT -F name=newMeric -F version=2.0 -Ftype=TEST -Fformat=tusar -F<EMAIL_ADDRESS>http://localhost:8080/inputMetrics
- *DELETE /inputMetrics/{filter}* delete the current metrics (matching the criterion given by the user with the filter).
Example
curl -X DELETE http://localhost:8080/inputMetrics;name=metricSelected
For each request, the {filter} is the conbinaison betweem the a name, a version, a format and a type, as such:
- GET /inputMetrics;name=cpptest
- GET /inputMetrics;name=cpptest;version=7.3
- GET /inputMetrics;name=cpptest;version=7.3;format=junit
- GET /inputMetrics;name=cpptest;version=7.3;format=tusar;type=violation
The supported format for the embedded mode are:
- JUNIT
- TUSAR
For the peristance store, it can be any value inserted in the datastore.
The supported type are the following values:
- MEASURE
- TEST
- VIOLATION
- COVERAGE
Roadmap
* Adding a persistence layer with PUT REST services
Changelog
Version 0.6
* Upgraded to Jenkins 1.396 API
* Fixed text output without xml declaration
Version 0.5
* Updated to dtkit-default-junit 0.13
* Updated to dtkit-default-tusar 0.13
* Updated internal technical versions
Version 0.4
* Fixed DELETE AND GET XSD operations
Version 0.3
* Updated to DTKIT FRMK 0.8
* Updated to DTKIT DEFAULT JUNIT and DEFAULT TUSAR 0.9
* Added a NoSQL datastore with MongoDB
Version 0.2
* Upgraded the internal metrics to DTKIT DEFAULT 0.7
* Added generic web service for converting and validating input files
Version 0.1
* Initial release
Compatibility version
DTKIT RS |
DTKIT JUNIT Default Version |
DTKIT TUSAR Default Version |
Default FRMK Version |
|---|---|---|---|
0.6 |
0.15 |
0.16 |
0.12 |
0.5 |
0.13 |
0.13 |
0.11 |
0.4 |
0.9 |
0.9 |
0.8 |
0.3 |
0.9 |
0.9 |
0.8 |
0.2 |
0.7 |
0.7 |
0.7 |
0.1 |
0.6 |
0.6 |
0.6 |
II. Adding Tool for the embedded part
DTKIT is an extensible solution and lets the users to add its own tools.
The new tools will be available in the xUnit Hudson plugin (for xUnit tools) and in the TusarNotifier Hudson plugin (for all other metric tools) without a new version of these plugins.
Adding a new tool can be done in two ways:
- by making a new Hudson plugin
- by making to make a new DTKIT project and you have to generate an Hudson archive with all Hudson generated classes and meta-data.
Making a new Plugin
This is the case of the following plugin: Gallio, Gnat, CppTest, CppUnit.
These plugins are 'a plugin of a plugin', i.e a plugin that extends another plugin.
You have to perform the following steps:
- Creating a template plugin
- Defining a netric class
- Defining a class that extends one the Metrics extension point
- Bundling and deploying the plugin
1.Creating a template plugin
With the Hudson archetype or manually, create the Hudson plugin layout with its dedicated Maven descriptor
<modelVersion>4.0.0</modelVersion> <parent> <groupId>org.jvnet.hudson.plugins</groupId> <artifactId>plugin</artifactId> <version>1.355</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>gallio</artifactId> <packaging>hpi</packaging> <version>1.0-SNAPSHOT</version> <name>Hudson Gallio plugin</name> <url>http://wiki.jenkins-ci.org/display/HUDSON/Gallio+Plugin</url> <dependencies> <dependency> <groupId>org.jvnet.hudson.plugins</groupId> <artifactId>xunit</artifactId> <version>1.5</version> </dependency> </dependencies> </project>
Your maven descriptor extends the xUnit plugin for adding additional testing tools.
By transitivity, you will get all the DTKIT API and external dependencies.
You have to extend the tusarnotifier plugin if you would like to add metrics tools with a TUSAR output.
2.Defining a metric class
This metric class provides all conversion and validation informations.
public class GallioInputMetric extends InputMetricXSL { @Override public InputType getToolType() { return InputType.TEST; } @Override public String getToolName() { return Messages.gallio_toolName(); } @Override public String getToolVersion() { return "N/A"; } @Override public String getXslName() { return "gallio-1.0-to-junit-1.0.xsl"; } @Override public String getInputXsd() { return null; } @Override public OutputMetric getOutputFormatType() { return JUnitModel.OUTPUT_JUNIT_1_0; } }
You can extend 'InputMetricXSL' class or either extend 'InputMetricOther' class.
Extending InputMetricXSL lead to define all the metric informations (XSL, XSD, Tool Version, ...).
XSD
The XSD for validating input files are optional.
If you don't have XSD, you have to return null to the overridden 'getInputXsd' method. In this case, the input validation will be ignored.
Extending InputMetricOther lets you define your own conversion and validation methods in case your tool outputs is not in XML or is too complex to set up an XSL.
3.Defining a class that extends one of the Hudson Metrics extension point
The Metrics extension point can be found in 'com.thalesgroup.dtkit.metrics.hudson.api.type' package. The possible values are:
- TestType,
- MeasureType,
- ViolationType
- CoverageType
public class GallioPluginType extends TestType { @DataBoundConstructor public GallioPluginType(String pattern, boolean faildedIfNotNew, boolean deleteOutputFiles) { super(pattern, faildedIfNotNew, deleteOutputFiles); } public TestTypeDescriptor<?> getDescriptor() { return new GallioPluginType.DescriptorImpl(); } @Extension public static class DescriptorImpl extends TestTypeDescriptor<GallioPluginType> { public DescriptorImpl() { super(GallioPluginType.class, GallioInputMetric.class); } public String getId() { return GallioPluginType.class.getCanonicalName(); } } }
You have to define also the associated descriptor.
4.Bundling and deploying the plugin
With Maven, launch the Maven packaging command (mvn package) and you will get an hpi plugin file.
Then deploy it into your Hudson $HUDSON_HOME/plugins directory.


WITNESS LIST Culture, Recreation, & Tourism Committee April 5, 2005-1:30P HB 391 For: Brown, Kirby (Texas Wildlife Association) Seale, Charly (Exotic Wildlife Association) Trimble, Robert L. (Skip) (Texas Humane Legislation Network) Tripp, Alice (Texas State Rifle Association) Against: Hansen, Allen (Self) Lockwood, John (Owner of live-shot.com) Registering, but not testifying: For: del Core Borromeo, Marida Favio (Exotic Wildlife Association) Hendrix, Susan (Self) Hubbard, John (Self and Texas Federation of Humane Societies) Mayberry, Warren (Texas Farm Bureau) Nordyke, Patricia M. (Self) Seale, Carolyn (Exotic Wildlife Association) Terrell, James (Self) HB 1352 For: Brown, Kirby (Texas Wildlife Association) Mica, Tara (National Rifle Association) Tripp, Alice (Texas State Rifle Association) On: Bright, Ann (Texas Parks and Wildlife) HB 1636 Registering, but not testifying: For: Brown, Kirby (Texas Wildlife Association) HB 1959 On: Brown, Kirby (Texas Parks and Wildlife Department) HB 2903 For: Dwyer, Pete (Self) Stine, Mark (Texas Bicycle Coalition) Registering, but not testifying: For: Geiger, Carol (Self) King, Laura (Self) Rice, Chuck (Texas Bicycle Coalition) Seeboth, Casey (Self) Watkins, April (Self) HB 3386 For: Mica, Tara (National Rifle Association) Tripp, Alice (Texas State Rifle Association) Registering, but not testifying: For: Brown, Kirby (Texas Wildlife Association) HCR 93 For: Vecera, LaDena (Self) Woodard, Vicki (Schulenburg Chamber of Commerce)


Xiaomi Enters Hotels and Real Estate Niches And Brings AIoT Solutions
by Argam ArtashyanXiaomi Enters Hotels and Real Estate Niches And Brings AIoT Smart Solutions
2 (40%) 1 vote
Today, at the Xiaomi Developers Conference 2019, Xiaomi Group founder and chairman Lei Jun said that under the “mobile +AIoT” dual-engine strategy, the company will continue to promote the next generation of “5G+AIoT”. “The super Internet has become a part of public life. As the leader of smart life, Xiaomi will give full play to the global leading edge of Xiaomi AIoT. Also, it will use core technology to help upgrade the home industry and promote the construction of smart homes.”
At today’s conference, Xiaomi Group released its own IoT industry interconnection solution. Lei Jun said that the Xiaomi AIoT platform has access to 2200+ products. Also, the number of connected devices reached 196 million, an increase of 69.5%. More than 3 million users have 5 or more IoT devices.
The Xiaomi executive said that the Xiaomi IoT platform will enter a new stage of development and move towards scene interconnection. The enterprise side of the scene interconnection is undoubtedly an important market.
In this sense, the Xiaomi solution consists of three parts: hotel, real estate, and IoT Enterprise Suite.
- In the field of hotels, we offer Xiao Ai speakers, Xiaomi TVs, multi-function gateways, intelligent lighting, and other categories. This year, the company should deliver 5000+ hotels covering 34 cities;
- In the field of real estate, we offer Xiao Ai speakers, Xiaomi TVs, Xiaomi routers, smart door locks, and other categories. This year, 2000 sets of cooperation with Zall, Greenland and Times Real Estate will be carried out, and there will be 14 inter-model projects.
- In the IoT Enterprise Suite, it currently includes purifiers, switches, air conditioning temperature control, and sensors.


A source-code getaway.
link_to seems pretty nice, though it takes some big leaps. It looks like the link text is the first argument, then... an object, or a string, or a hash, or a symbol... or a ball, a sandwich... can literally anything go here? Let's find out.
Eric Saxman | 'Andrelton' - 2015.
Find me on GitHub | LinkedIn.
Example: <% @photos.each do |photo| %> ... <%= link_to 'View Photo', photo %> <% end %>
link_to receives the desired link text as name, along with various other options.
url_for is used to build a url from the provided options, which in this example is a photo model object.
Later, content_tag will return the html element for the link using:
- an anchor tag
- the link text as provided above, or the url, as a default
- the html options (e.g. class, data), including the url generated above
rails/actionview/lib/action_view/helpers/url_helper.rb
def link_to(name = nil, options = nil, html_options = nil, &block) html_options, options, name = options, name, block if block_given? options ||= {} html_options = convert_options_to_data_attributes(options, html_options) url = url_for(options) html_options['href'] ||= url content_tag(:a, name || url, html_options, &block) end
url_for is called in link_to regardless of the option type. Thus, if options is a string, it is assumed to be a url, and it is returned unchanged.
Otherwise, a url is built from the provided options. For example, if options is a model (as in the example, a common usage), handle_model_call is used to construct the url.
The controller instance (self) and the options are passed along as arguments.
rails/actionpack/lib/action_dispatch/routing/url_for.rb
def url_for(options = nil) case options when nil _routes.url_for(url_options.symbolize_keys) when Hash route_name = options.delete :use_route _routes.url_for(options.symbolize_keys.reverse_merge!(url_options), route_name) when String options when Symbol HelperMethodBuilder.url.handle_string_call self, options when Array polymorphic_url(options, options.extract_options!) when Class HelperMethodBuilder.url.handle_class_call self, options else HelperMethodBuilder.url.handle_model_call self, options end end
In the example above, it would be common to see routing methods like 'photo_path(photo)' in the app's views. With the help of the subsequent three methods, handle_model_call will send a method (photo_path) to the target (the photos controller) with the photo as the argument.
handle_model constructs that 'photo_path' string, which will be sent to the controller.
model_name, called on the photo object, allows get_method_for_string to construct 'photo_path'.
These methods are being called on an instance of HelperMethodBuilder. 'path' is the suffix held as an attribute on that instance.
Upon sending the photos controller the 'photo_path' method, handle_model_call will receive a string like '/photos/< photo's id >'. It passes this back to url_for, which returns it to link_to. link_to now has a url for use in content_tag's construction of the html element for the link.
rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
def handle_model_call(target, model) method, args = handle_model model target.send(method, *args) end def handle_model(record) args = [] model = record.to_model named_route = if model.persisted? args << model get_method_for_string model.model_name.singular_route_key else get_method_for_class model end [named_route, args] end def get_method_for_class(klass) name = @key_strategy.call klass.model_name get_method_for_string name end def get_method_for_string(str) "#{prefix}#{str}_#{suffix}" end
content_tag simply prepares the arguments to be sent along to content_tag_string.
rails/actionview/lib/action_view/helpers/tag_helper.rb
def content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block) if block_given? options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash) content_tag_string(name, capture(&block), options, escape) else content_tag_string(name, content_or_options_with_block, options, escape) end end
content_tag_string returns an html-element string, the final result of link_to.
def content_tag_string(name, content, options, escape = true)
tag_options = tag_options(options, escape) if options
content = ERB::Util.unwrapped_html_escape(content) if escape
"<#{name}#{tag_options}>#{PRE_CONTENT_STRINGS[name.to_sym]}#{content}#{name}>".html_safe
end
Result: "<a href="/photos/< id >">View Photo"


We provide the best in class user experience . A bunch of young and enthusisastic developers teamed up to design this webisite to give the best online ambience.
What's New !
Features
FILTER
This feature gives the best search experience based on your preference .
LOYALTY POINTS
Based on your number of bookings you receive loyalty points.
DISCOUNT
Based on your loyalty points you get discounts on your bookings.
LESS TAXES
Unlike other platforms ,we charge less internet handling charges on your bookings .
PAYMENT GATEWAY
We provide the amount required to pay immediatly after the selection of your seats.
PRIVACY
We will not share your booking history to third party organisations.
Co-Sponsored by
Zeina - 0
Logic
Smart
Softtech
Wheel
3designs
Heart
Devtech
Chartz
Login
Login
Filter by
Language
English
Telugu
Hindi
Categories
Chamber Orchestra Concerts
Children's or Family Concerts
Choral Music
Concert Band Concerts
Opera


#include <globalplatform.h>
Public Attributes | |
| DWORD | currentWork |
| The current work which is done. If not known this contains OPGP_WORK_UNKNOWN. | |
| DWORD | totalWork |
| The total work which needs to be done. If not known this contains OPGP_WORK_UNKNOWN. | |
| DWORD | finished |
| Task is finished. If finished contains OPGP_TASK_FINISHED. | |
| PVOID | parameters |
| Proprietary parameters for the function passed in with OPGP_PROGRESS_CALLBACK. |
The structure measures the progress of a task. This structure is passed to the callback function.
The current work which is done. If not known this contains OPGP_WORK_UNKNOWN.
Task is finished. If finished contains OPGP_TASK_FINISHED.
Proprietary parameters for the function passed in with OPGP_PROGRESS_CALLBACK.
The total work which needs to be done. If not known this contains OPGP_WORK_UNKNOWN.


This outlines the problems I faced, I don't want to dig into details and try to reproduce each case as I have had enough pain already. I also don’t care if it is by-design. I would describe the process not the migration but the copy-pasting.
- Code is not migrated. THE MOST of time is wasted doing copy-paste (in best case).
- Interfaces are not migrated (so I have to put all the interfaces back and because of 1 implement them).
- One-to-many association names are not preserved and default names are used. Breaks code. And no it is not even cross-package references. The association links 2 classes from same package on the same diagram.
- Some associations are not imported at all.
- The import process added attributes to classes that do not belong there. It definitely breaks runtime as mapping will not contain them (and yes, I discovered it later).
- The import does not preserve IsNavigable for some associations.
- Wrong migration of attributes in large hierarchy: the attribute in the middle of hierarchy has been put into its parent.
- Import the same package twice gives very weird result: it duplicates all TaggedValues, Constraints, and method parameters (not methods)! Better it said me that the package already imported and did nothing as I had to manually correct everything.
- The EcoSpace had to be reconfigured from scratch as there are too many changes from Borland.* to Eco.*.
- Ordered value for associations is not preserved in some case (discover very late when could not make couple of tests pass).
The issues I have faced making all my tests to pass (related to ECO only):
- I cannot longer use custom class as type of an attribute (custom Money class). This is a real showstopper. Why newer version supports LESS! I had to use Decimal instead of custom class.
Attribute ClassName.TotalCostsAmount has an invalid type: Shared.Money. Only arrays, enums, strings and valuetypes are allowed SignificantOCL syntax changes that breaks the runtime. It cannot be detected at compile time as OCL is just a string.Best example: “self.Name->trim(true, true).length > 0”. which trims the string on both sides (indicated by boolean parameters). Now it should use normal .NET Trim method: “self.Name.Trim().length > 0”.(I missed to install my trim OCL operation).- HasUserCode on associations is not available. That was simple way of doing things (thou you have to prohibit explicitly other ways of changing associations). Now I have to implement ISingleLinkCatcher. Much better in terms of functionality but much worse in terms of maintenance.
- The bug is still not fixed (derived attribute that uses externalId is not invalidate if it changes).
- The logging has not been improved.
- Cannot specify additional namespaces to be used for the whole package (so I have to go through every class).
- Code generation takes a lot of time for simple change (2 minutes). It is related to the migration as during this process I often have to regenerate code and it just kills my time.
- Cannot select MANY objects (properties, methods, associations) and change values for all of them. Instead have to go one by one (Don’t tell me I have to use the AutoForm!).
- Sometimes the Modelr just freezes. It SHOWS the model but it is READ-ONLY. I cannot even select anything on it. VS restart helps.
- Cannot search class on the diagram (“select as you type” kind of thing). There is search for the whole model but not on a single diagram.
The outcome
- About 12 hours to migrate the model and compile project.
- About 4 (16 in total) hours to make ~40% of tests to pass.
- About 4 (20 in total) hours to make ~90% of tests to pass.
- About 2 (22 in total) hours to make all tests to pass EXCEPT ONE.
- About 2 (24 in total) hours to make the last test to pass (related to the fact that I no longer use the Database for unit testing).
Breathing out
At the moment of writing this I have my new ECO5 business objects and all the tests working.The migration process has not yet finished for the application in total but the major step is done and I can tell that I am happy with the overall result despite some frustrations.
The biggest frustration is that I had to copy-paste old code to new objects. It probably took at least 80% of my time.
Next thing is to migrate small WinForms utility. Will see how I go with it.
Last Note for those who does not want to write unit tests
It took me 3 working days to migrate all my system core with tests. Additionally tests were just a healthiness indicator. I am confident that without unit tests it would take at least one-two weeks in best case scenario.So guys: “"Stressed? Write a test!”.


---
layout: post
title: 8/22/2013
date: '2013-08-23T21:47:00.000-06:00'
author: Jacob .
tags:
- homeschool-journal
- homeschooling
modified_time: '2013-08-24T22:08:48.863-06:00'
blogger_id: tag:blogger.com,1999:blog-6400085873105072120.post-5786634031970993785
blogger_orig_url: http://www.svlark.com/2013/08/8222013.html
---
We all went to the opening session for KinderHeart, Audrey's twice-a-week homeschool-supplemental Waldorf program, today. It was really nice, and I think it'll be a great community of kids for her and parents for us.


Pepper Constraints
A Quick Overview
Pepper constraints are functions that reduce domains for constraint satisfaction problems, such as the provided Pepper.allDiff (for the all different constraint) and Pepper.setVal (for any unary constraint). TableSalt allows you to write your own constraint functions, to allow flexibility in the problems you want to solve. Each pepper constraint is then passed in to the framework along with the variables it modifies before solving.
Writing Pepper Constraints
Declaring a new pepper constraint is easy:
function newConstraint(section, board, ...)
The TableSalt framework will always pass in the section
and board
for each constraint function. So be sure that these are the first two arguments declared when creating a new constraint function! The section
is a table of id's corresponding to variables that that constraint will be modifying and the board
is the current TableSalt instance that is being used. Pepper constraint functions also allow for multiple additional parameters to be passed in, hence the ...
in the function decleration. Constraints should be designed to work in a variety of situations, they are applied to certain variables (called a section
) when they are passed in to the framework.
The main thing about pepper constraints are that they should return a table of tables of the new domains that correspond to the section
ids passed in to the constraint. While that sounds confusing let's break it down. Take the Pepper.setVal constraint for example:
function Pepper.setVal(section, board, val) local allValues = {} for i = 1, #section do allValues [ #allValues+1 ] = {val} end return allValues end
It's important that the table that is returned, allValues
, is the same length as section
. The first element in allValues
corresponds to the new domain (which is always given as a table) of the first element (which will be an id for a constraint) in section
. Since this is the setVal constraint, each domain is reduced to exactly one value.
It's also worth noting that if a constraint fails on a specific id, the associated domain should be an empty table: {}
. Ex: The section {1, 3, 4}
fails the constraint on the third element, the table the constraint returns could look like this: { {1, 4, 3}, {2}, {} }
.
Helpful functions when writing constraints
Since the pepper constraints pass in an instance of TableSalt , some of the functions available should be quite useful. Most particularly TableSalt:getValueByID()
and TableSalt:getDomainByID()
. Here's a quick example of how they could be used:
function newConstraint(section, board) for ind, id in ipairs(section) do local currentValue = board:getValueByID(id) local currentDomain = board:getDomainByID(id) -- some more stuff end end
This will iterate through all the variables's ids that were passed in and do magical things with their associated values and domains!
Passing in Pepper Constraints
There are a multitude of functions that are used to pass in pepper constraints:
- TableSalt:addConstraintByIDs
- TableSalt:addConstraintByPairs
- TableSalt:addConstraintByNames
- TableSalt:addConstraintForEachRow
- TableSalt:addConstraintForEachColumn
- TableSalt:addConstraintForAll
The first three (addConstraintByIDs , addConstraintByPairs , and addConstraintByNames ) in the list all follow a similar structure for passing in pepper constraints:
--code addConstraintByX(section, pepperConstraint, ...) --more code
The section
can be passed in through a variety of methods, check the documentation on those specific functions for more information on that. The pepperConstraint
is simply the name of the pepperConstraint
(be sure not to pass in any arguments here). The ...
represents any additional arguments that are required to run the constraint.
The other three (addConstraintForEachRow , addConstraintForEachColumn , and addConstraintForAll ) only pass in the pepperConstraint
and any additional arguments.
Here's a quick example on how to pass in Pepper.setVal(section, board, val)
which takes in the additional parameter 'val':
-- some crazy game that is played on 5 squares where each square have the values 1-5 local crazyGame = TableSalt:new({1, 2, 3, 4, 5}, 5) -- squares 1, 3, and 5 all need to be set to 5 for some reason crazyGame:addConstraintByIDs({1, 3, 5}, Pepper.setVal, 5)
Any additional parameters can just be appended and TableSalt should take care of the rest!


Force an element to clear its floated child element and
prevent its layout from collapsing.
Installation
Using npm:
npm i -S jigsass-utils-clearfix
Usage
Import JigSass Utils Clearfix into your main scss file near its very end, together with all
other utilities (utilities should always be the last to be imported).
@import 'path/to/jigsass-utils-clearfix/scss/index';
Importing the file will not create any styles by itself. You would need to indicate that the
.u-cf
class should actually be generated in each component or object it is used in:
// _c.foo.scss
.foo {
@include jigsass-util(u-cf);
...
}
// _c.bar.scss
.bar {
@include jigsass-util(u-cf);
...
}
// _c.baz.scss
.baz {
@include jigsass-util(u-cf);
...
}
Doing so helps us a great deal with portability, as no matter where we import component or object
partials, the correct utility classes will be generated. Think of it as a poor man's dependency
management.
Developer communication is also assisted by including "dependencies" wherever they are required,
as anyone going through a partial, can easily understand how it should be marked up with just a
glance.
As far as bloat goes, just don't worry about it - the actual styles will only be generated once,
at the location in the cascade where the Jigsass Clearfix partial was imported into the main file:


Class LaserRandom
- All Implemented Interfaces:
java.io.Serializable
public class LaserRandom
extends java.util.Random
implements java.io.Serializable
Random
.
Like how a laser is made of many beams of photons that don't cross paths, this allows many different
random number streams that don't overlap either.
This fills in much of the functionality of MathUtils in libGDX, though with all code as instance methods instead of static methods, and some things renamed (randomTriangular() became
nextTriangular()
,
for instance, and random() became nextFloat()
). It also supplies some rare and sometimes-useful
code: skip(long)
allows "fast-forward" and "rewind," you can get and set the exact state with
getStateA()
, getStateB()
, setStateA(long)
, and setStateB(long)
(which
is useful if you want to save a LaserRandom and reload it later), and there's bounded int and long
generators which can use a negative number as their exclusive outer bound nextSignedInt(int)
and
nextSignedLong(long)
, plus overloads that take an inner bound).
Every method defined in this class advances the state by the same amount unless otherwise documented (only
nextTriangular()
and nextTriangular(float)
advance the state twice). The state can
advance 2 to the 64 times before the sequence of random numbers repeats, which would take a few years of
continuous generation. There are also 2 to the 63 possible sequences this can produce; you can tell which
one you're using with getStream()
. Note, Random
can only advance 2 to the 48 times, which
takes under half a day to make it repeat on recent laptop hardware while also analyzing the numbers for
statistical issues. If statistical quality is a concern, don't use Random
, since the aforementioned
analysis finds statistical failures in about a minute when checking about 16GB of output; this class can
produce 64TB of random output without a tool like PractRand finding any failures (sometimes it can't find
any minor anomaly over several days of testing).
You can copy this class independently of the library it's part of; it's meant as a general replacement for Random and also RandomXS128. LaserRandom is generally faster than RandomXS128, and can be over 3x faster when running on OpenJ9 (generating over 3 billion random long values per second). On top of that, this doesn't have the statistical failures that the outdated XorShift128+ algorithm has.
Pew pew! Lasers!
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description LaserRandom()
Creates a new LaserRandom.LaserRandom(long seed)
Creates a new LaserRandom using a singlelong
seed; the stream depends on whether the seed is even or odd.LaserRandom(long seedA, long seedB)
Creates a new LaserRandom usingseedA
exactly to set stateA (as withsetStateA(long)
,, and usingseedB
to set stateB as withsetStateB(long)
(meaning seedB will be used exactly if odd, otherwise it will have 1 added to it and then used). -
Method Summary
Modifier and Type Method Description LaserRandom
copy()
long
getStateA()
Get the "A" part of the internal state as a long.long
getStateB()
Get the "B" part of the internal state as a long.long
getStream()
Gets a long that identifies which stream of numbers this generator is producing; this stream identifier is always an odd long and won't change by generating numbers.int
next(int bits)
Generates the next pseudorandom number with a specific maximum size in bits (not a max number).boolean
nextBoolean()
Returns the next pseudorandom, uniformly distributedboolean
value from this random number generator's sequence.boolean
nextBoolean(float chance)
Returns true if a random value between 0 and 1 is less than the specified value.void
nextBytes(byte[] bytes)
Generates random bytes and places them into a user-supplied byte array.double
nextDouble()
Returns the next pseudorandom, uniformly distributeddouble
value between0.0
(inclusive) and1.0
(exclusive) from this random number generator's sequence.float
nextFloat()
Returns the next pseudorandom, uniformly distributedfloat
value between0.0
(inclusive) and1.0
(exclusive) from this random number generator's sequence.double
nextGaussian()
Returns the next pseudorandom, Gaussian ("normally") distributeddouble
value with mean0.0
and standard deviation1.0
from this random number generator's sequence.int
nextInt()
Returns the next pseudorandom, uniformly distributedint
value from this random number generator's sequence.int
nextInt(int bound)
Returns a pseudorandom, uniformly distributedint
value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.int
nextInt(int innerBound, int outerBound)
Returns a pseudorandom, uniformly distributedint
value between the specifiedinnerBound
(inclusive) and the specifiedouterBound
(exclusive).long
nextLong()
Returns the next pseudorandom, uniformly distributedlong
value from this random number generator's sequence.long
nextLong(long bound)
Returns a pseudorandom, uniformly distributedlong
value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.long
nextLong(long innerBound, long outerBound)
Returns a pseudorandom, uniformly distributedlong
value between the specifiedinnerBound
(inclusive) and the specifiedouterBound
(exclusive).int
nextSign()
Returns -1 or 1, randomly.int
nextSignedInt(int outerBound)
Returns a pseudorandom, uniformly distributedint
value between an inner bound of 0 (inclusive) and the specifiedouterBound
(exclusive).int
nextSignedInt(int innerBound, int outerBound)
Returns a pseudorandom, uniformly distributedint
value between the specifiedinnerBound
(inclusive) and the specifiedouterBound
(exclusive).long
nextSignedLong(long outerBound)
Returns a pseudorandom, uniformly distributedlong
value between an inner bound of 0 (inclusive) and the specifiedouterBound
(exclusive).long
nextSignedLong(long innerBound, long outerBound)
Returns a pseudorandom, uniformly distributedlong
value between the specifiedinnerBound
(inclusive) and the specifiedouterBound
(exclusive).float
nextTriangular()
Returns a triangularly distributed random number between -1.0 (exclusive) and 1.0 (exclusive), where values around zero are more likely.float
nextTriangular(float max)
Returns a triangularly distributed random number between-max
(exclusive) andmax
(exclusive), where values around zero are more likely.float
nextTriangular(float min, float max)
Returns a triangularly distributed random number betweenmin
(inclusive) andmax
(exclusive), where themode
argument defaults to the midpoint between the bounds, giving a symmetric distribution.float
nextTriangular(float min, float max, float mode)
Returns a triangularly distributed random number betweenmin
(inclusive) andmax
(exclusive), where values aroundmode
are more likely.static double
probit(double d)
A way of taking a double in the (0.0, 1.0) range and mapping it to a Gaussian or normal distribution, so high inputs correspond to high outputs, and similarly for the low range.void
setSeed(long seed)
Sets the seed of this random number generator using a singlelong
seed.void
setStateA(long stateA)
Set the "A" part of the internal state with a long.void
setStateB(long stateB)
Set the "B" part of the internal state with a long; the least significant bit is ignored (will always be odd).long
skip(long advance)
Advances or rolls back theLaserRandom
' state without actually generating each number.
-
Field Details
-
Constructor Details
-
LaserRandom
public LaserRandom()Creates a new LaserRandom. This constructor sets the states of the random number generator to values very likely to be distinct from any other invocation of this constructor. -
LaserRandom
public LaserRandom(long seed)Creates a new LaserRandom using a singlelong
seed; the stream depends on whether the seed is even or odd.- Parameters:
seed
- the initial seed- See Also:
setSeed(long)
-
LaserRandom
public LaserRandom(long seedA, long seedB)Creates a new LaserRandom usingseedA
exactly to set stateA (as withsetStateA(long)
,, and usingseedB
to set stateB as withsetStateB(long)
(meaning seedB will be used exactly if odd, otherwise it will have 1 added to it and then used).- Parameters:
seedA
- any long; will be used exactly to set stateA as withsetStateA(long)
seedB
- any odd long will be used exactly to set stateB, otherwise, as withsetStateB(long)
, it will be made odd
-
-
Method Details
-
getStateA
public long getStateA()Get the "A" part of the internal state as a long.- Returns:
- the current internal "A" state of this object.
-
setStateA
public void setStateA(long stateA)Set the "A" part of the internal state with a long.- Parameters:
stateA
- a 64-bit long
-
getStateB
public long getStateB()Get the "B" part of the internal state as a long.- Returns:
- the current internal "B" state of this object.
-
setStateB
public void setStateB(long stateB)Set the "B" part of the internal state with a long; the least significant bit is ignored (will always be odd). That is, if stateB is odd, this uses it verbatim; if stateB is even, it adds 1 to it to make it odd.- Parameters:
stateB
- a 64-bit long
-
setSeed
public void setSeed(long seed)Sets the seed of this random number generator using a singlelong
seed. The general contract ofsetSeed
is that it alters the state of this random number generator object so as to be in exactly the same state as if it had just been created with the argumentseed
as a seed.The implementation of
setSeed
by classRandom
uses all 64 bits of the given seed. In general, however, an overriding method may use all 64 bits of thelong
argument as a seed value.- Overrides:
setSeed
in classjava.util.Random
- Parameters:
seed
- the initial seed
-
next
public int next(int bits)Generates the next pseudorandom number with a specific maximum size in bits (not a max number). If you want to get a random number in a range, you should usually usenextInt(int)
instead. For some specific cases, this method is more efficient and less biased thannextInt(int)
. Forbits
values between 1 and 30, this should be similar in effect tonextInt(1 << bits)
; though it won't typically produce the same values, they will have the correct range. Ifbits
is 31, this can return any non-negativeint
; note thatnextInt(1 << 31)
won't behave this way because1 << 31
is negative. Ifbits
is 32 (or 0), this can return anyint
.The general contract of
next
is that it returns anint
value and if the argumentbits
is between1
and32
(inclusive), then that many low-order bits of the returned value will be (approximately) independently chosen bit values, each of which is (approximately) equally likely to be0
or1
.- Overrides:
next
in classjava.util.Random
- Parameters:
bits
- random bits- Returns:
- the next pseudorandom value from this random number generator's sequence
-
nextBytes
public void nextBytes(byte[] bytes)Generates random bytes and places them into a user-supplied byte array. The number of random bytes produced is equal to the length of the byte array.- Overrides:
nextBytes
in classjava.util.Random
- Parameters:
bytes
- the byte array to fill with random bytes- Throws:
java.lang.NullPointerException
- if the byte array is null
-
nextInt
public int nextInt()Returns the next pseudorandom, uniformly distributedint
value from this random number generator's sequence. The general contract ofnextInt
is that oneint
value is pseudorandomly generated and returned. All 232 possibleint
values are produced with (approximately) equal probability.- Overrides:
nextInt
in classjava.util.Random
- Returns:
- the next pseudorandom, uniformly distributed
int
value from this random number generator's sequence
-
nextInt
public int nextInt(int bound)Returns a pseudorandom, uniformly distributedint
value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. The general contract ofnextInt
is that oneint
value in the specified range is pseudorandomly generated and returned. Allbound
possibleint
values are produced with (approximately) equal probability.- Overrides:
nextInt
in classjava.util.Random
- Parameters:
bound
- the upper bound (exclusive). If negative or 0, this always returns 0.- Returns:
- the next pseudorandom, uniformly distributed
int
value between zero (inclusive) andbound
(exclusive) from this random number generator's sequence
-
nextSignedInt
public int nextSignedInt(int outerBound)Returns a pseudorandom, uniformly distributedint
value between an inner bound of 0 (inclusive) and the specifiedouterBound
(exclusive). This is meant for cases where the outer bound may be negative, especially if the bound is unknown or may be user-specified. A negative outer bound is used as the lower bound; a positive outer bound is used as the upper bound. An outer bound of -1, 0, or 1 will always return 0, keeping the bound exclusive (except for outer bound 0).- Parameters:
outerBound
- the outer exclusive bound; may be any int value, allowing negative- Returns:
- a pseudorandom int between 0 (inclusive) and outerBound (exclusive)
-
nextInt
public int nextInt(int innerBound, int outerBound)Returns a pseudorandom, uniformly distributedint
value between the specifiedinnerBound
(inclusive) and the specifiedouterBound
(exclusive). IfouterBound
is less than or equal toinnerBound
, this always returnsinnerBound
.
For any case where outerBound might be valid but less than innerBound, you can usenextSignedInt(int, int)
.- Parameters:
innerBound
- the inclusive inner bound; may be any int, allowing negativeouterBound
- the exclusive outer bound; must be greater than innerBound (otherwise this returns innerBound)- Returns:
- a pseudorandom int between innerBound (inclusive) and outerBound (exclusive)
-
nextSignedInt
public int nextSignedInt(int innerBound, int outerBound)Returns a pseudorandom, uniformly distributedint
value between the specifiedinnerBound
(inclusive) and the specifiedouterBound
(exclusive). This is meant for cases where either bound may be negative, especially if the bounds are unknown or may be user-specified.- Parameters:
innerBound
- the inclusive inner bound; may be any int, allowing negativeouterBound
- the exclusive outer bound; may be any int, allowing negative- Returns:
- a pseudorandom int between innerBound (inclusive) and outerBound (exclusive)
-
nextLong
public long nextLong()Returns the next pseudorandom, uniformly distributedlong
value from this random number generator's sequence. The general contract ofnextLong
is that onelong
value is pseudorandomly generated and returned.An individual
LaserRNG
can't return all 18-quintillion possiblelong
values, but the full set of 9-quintillion possible random number streams that this class can produce will, as a whole, produce alllong
values with equal likelihood.- Overrides:
nextLong
in classjava.util.Random
- Returns:
- the next pseudorandom, uniformly distributed
long
value from this random number generator's sequence
-
nextLong
public long nextLong(long bound)Returns a pseudorandom, uniformly distributedlong
value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. The general contract ofnextLong
is that onelong
value in the specified range is pseudorandomly generated and returned. Allbound
possiblelong
values are produced with (approximately) equal probability.Note that this advances the state by the same amount as a single call to
nextLong()
, which allows methods likeskip(long)
to function correctly, but introduces some bias whenbound
is very large. This will also advance the state ifbound
is 0 or negative, so usage with a variable bound will advance the state reliably.- Parameters:
bound
- the upper bound (exclusive). If negative or 0, this always returns 0.- Returns:
- the next pseudorandom, uniformly distributed
long
value between zero (inclusive) andbound
(exclusive) from this random number generator's sequence
-
nextSignedLong
public long nextSignedLong(long outerBound)Returns a pseudorandom, uniformly distributedlong
value between an inner bound of 0 (inclusive) and the specifiedouterBound
(exclusive). This is meant for cases where the outer bound may be negative, especially if the bound is unknown or may be user-specified. A negative outer bound is used as the lower bound; a positive outer bound is used as the upper bound. An outer bound of -1, 0, or 1 will always return 0, keeping the bound exclusive (except for outer bound 0).Note that this advances the state by the same amount as a single call to
nextLong()
, which allows methods likeskip(long)
to function correctly, but introduces some bias whenbound
is very large.- Parameters:
outerBound
- the outer exclusive bound; may be any long value, allowing negative- Returns:
- a pseudorandom long between 0 (inclusive) and outerBound (exclusive)
-
nextLong
public long nextLong(long innerBound, long outerBound)Returns a pseudorandom, uniformly distributedlong
value between the specifiedinnerBound
(inclusive) and the specifiedouterBound
(exclusive). IfouterBound
is less than or equal toinnerBound
, this always returnsinnerBound
.
For any case where outerBound might be valid but less than innerBound, you can usenextSignedLong(long, long)
.- Parameters:
innerBound
- the inclusive inner bound; may be any long, allowing negativeouterBound
- the exclusive outer bound; must be greater than innerBound (otherwise this returns innerBound)- Returns:
- a pseudorandom long between innerBound (inclusive) and outerBound (exclusive)
-
nextSignedLong
public long nextSignedLong(long innerBound, long outerBound)Returns a pseudorandom, uniformly distributedlong
value between the specifiedinnerBound
(inclusive) and the specifiedouterBound
(exclusive). This is meant for cases where either bound may be negative, especially if the bounds are unknown or may be user-specified.- Parameters:
innerBound
- the inclusive inner bound; may be any long, allowing negativeouterBound
- the exclusive outer bound; may be any long, allowing negative- Returns:
- a pseudorandom long between innerBound (inclusive) and outerBound (exclusive)
-
nextBoolean
public boolean nextBoolean()Returns the next pseudorandom, uniformly distributedboolean
value from this random number generator's sequence. The general contract ofnextBoolean
is that oneboolean
value is pseudorandomly generated and returned. The valuestrue
andfalse
are produced with (approximately) equal probability.- Overrides:
nextBoolean
in classjava.util.Random
- Returns:
- the next pseudorandom, uniformly distributed
boolean
value from this random number generator's sequence
-
nextFloat
public float nextFloat()Returns the next pseudorandom, uniformly distributedfloat
value between0.0
(inclusive) and1.0
(exclusive) from this random number generator's sequence.The general contract of
nextFloat
is that onefloat
value, chosen (approximately) uniformly from the range0.0f
(inclusive) to1.0f
(exclusive), is pseudorandomly generated and returned. All 224 possiblefloat
values of the form m x 2-24, where m is a positive integer less than 224, are produced with (approximately) equal probability.The hedge "approximately" is used in the foregoing description only because the next method is only approximately an unbiased source of independently chosen bits. If it were a perfect source of randomly chosen bits, then the algorithm shown would choose
float
values from the stated range with perfect uniformity.- Overrides:
nextFloat
in classjava.util.Random
- Returns:
- the next pseudorandom, uniformly distributed
float
value between0.0
and1.0
from this random number generator's sequence
-
nextDouble
public double nextDouble()Returns the next pseudorandom, uniformly distributeddouble
value between0.0
(inclusive) and1.0
(exclusive) from this random number generator's sequence.The general contract of
nextDouble
is that onedouble
value, chosen (approximately) uniformly from the range0.0d
(inclusive) to1.0d
(exclusive), is pseudorandomly generated and returned.The hedge "approximately" is used in the foregoing description only because the
next
method is only approximately an unbiased source of independently chosen bits. If it were a perfect source of randomly chosen bits, then the algorithm shown would choosedouble
values from the stated range with perfect uniformity.- Overrides:
nextDouble
in classjava.util.Random
- Returns:
- the next pseudorandom, uniformly distributed
double
value between0.0
and1.0
from this random number generator's sequence
-
nextGaussian
public double nextGaussian()Returns the next pseudorandom, Gaussian ("normally") distributeddouble
value with mean0.0
and standard deviation1.0
from this random number generator's sequence.The general contract of
nextGaussian
is that onedouble
value, chosen from (approximately) the usual normal distribution with mean0.0
and standard deviation1.0
, is pseudorandomly generated and returned.This uses an approximation as implemented by
probit(double)
, which can't produce as extreme results in extremely-rare cases as methods like Box-Muller and Marsaglia Polar can. All but one possible result are between-8.209536145151493
and8.209536145151493
, and the one result outside that is38.5
.- Overrides:
nextGaussian
in classjava.util.Random
- Returns:
- the next pseudorandom, Gaussian ("normally") distributed
double
value with mean0.0
and standard deviation1.0
from this random number generator's sequence
-
skip
public long skip(long advance)Advances or rolls back theLaserRandom
' state without actually generating each number. Skips forward or backward a number of steps specified by advance, where a step is equal to one call tonextLong()
, and returns the random number produced at that step. Negative numbers can be used to step backward, or 0 can be given to get the most-recently-generated long fromnextLong()
.Note that none of the number-generating methods here advance state differently from
nextLong()
except for the Stream APIs. This is somewhat unusual; in many generators, calls tonextInt(int)
and similar bounded-range random generators can advance the state by a variable amount. Using a fixed advance permits this method and also allows guaranteeing the cycle length (also called period), but introduces a tiny amount of bias for some bounds (mostly very large ones).- Parameters:
advance
- Number of future generations to skip over; can be negative to backtrack, 0 gets the most-recently-generated number- Returns:
- the random long generated after skipping forward or backwards by
advance
numbers
-
copy
-
getStream
public long getStream()Gets a long that identifies which stream of numbers this generator is producing; this stream identifier is always an odd long and won't change by generating numbers. It is determined at construction and will usually (not always) change ifsetStateA(long)
orsetStateB(long)
are called. Each stream is a probably-unique sequence of 2 to the 64 longs, where approximately 1/3 of all possible longs will not ever occur (while others occur twice or more), but this set of results is different for every stream. There are 2 to the 63 possible streams, one for every odd long.- Returns:
- an odd long that identifies which stream this LaserRandom is generating from
-
probit
public static double probit(double d)A way of taking a double in the (0.0, 1.0) range and mapping it to a Gaussian or normal distribution, so high inputs correspond to high outputs, and similarly for the low range. This is centered on 0.0 and its standard deviation seems to be 1.0 (the same asRandom.nextGaussian()
). If this is given an input of 0.0 or less, it returns -38.5, which is slightly less than the result when givenDouble.MIN_VALUE
. If it is given an input of 1.0 or more, it returns 38.5, which is significantly larger than the result when given the largest double less than 1.0 (this value is further from 1.0 thanDouble.MIN_VALUE
is from 0.0). If givenDouble.NaN
, it returns whateverMath.copySign(double, double)
returns for the arguments38.5, Double.NaN
, which is implementation-dependent. It uses an algorithm by Peter John Acklam, as implemented by Sherali Karimov. Original source. Information on the algorithm. Wikipedia's page on the probit function may help, but is more likely to just be confusing.
Acklam's algorithm and Karimov's implementation are both quite fast. This appears faster than generating Gaussian-distributed numbers using either the Box-Muller Transform or Marsaglia's Polar Method, though it isn't as precise and can't produce as extreme min and max results in the extreme cases they should appear. If given a typical uniform randomdouble
that's exclusive on 1.0, it won't produce a result higher than8.209536145151493
, and will only produce results of at least-8.209536145151493
if 0.0 is excluded from the inputs (if 0.0 is an input, the result is38.5
). A chief advantage of using this with a random number generator is that it only requires one random double to obtain one Gaussian value;Random.nextGaussian()
generates at least two random doubles for each two Gaussian values, but may rarely require much more random generation.
This can be used both as an optimization for generating Gaussian random values, and as a way of generating Gaussian values that match a pattern present in the inputs (which you could have by using a sub-random sequence as the input, such as those produced by a van der Corput, Halton, Sobol or R2 sequence). Most methods of generating Gaussian values (e.g. Box-Muller and Marsaglia polar) do not have any way to preserve a particular pattern.- Parameters:
d
- should be between 0 and 1, exclusive, but other values are tolerated- Returns:
- a normal-distributed double centered on 0.0; all results will be between -38.5 and 38.5, both inclusive
-
nextBoolean
public boolean nextBoolean(float chance)Returns true if a random value between 0 and 1 is less than the specified value.- Parameters:
chance
- a float between 0.0 and 1.0; higher values are more likely to result in true- Returns:
- a boolean selected with the given
chance
of being true
-
nextSign
public int nextSign()Returns -1 or 1, randomly.- Returns:
- -1 or 1, selected with approximately equal likelihood
-
nextTriangular
public float nextTriangular()Returns a triangularly distributed random number between -1.0 (exclusive) and 1.0 (exclusive), where values around zero are more likely. Advances the state twice.This is an optimized version of
randomTriangular(-1, 1, 0)
-
nextTriangular
public float nextTriangular(float max)Returns a triangularly distributed random number between-max
(exclusive) andmax
(exclusive), where values around zero are more likely. Advances the state twice.This is an optimized version of
randomTriangular(-max, max, 0)
- Parameters:
max
- the upper limit
-
nextTriangular
public float nextTriangular(float min, float max)Returns a triangularly distributed random number betweenmin
(inclusive) andmax
(exclusive), where themode
argument defaults to the midpoint between the bounds, giving a symmetric distribution. Advances the state once.This method is equivalent of
randomTriangular(min, max, (min + max) * 0.5f)
- Parameters:
min
- the lower limitmax
- the upper limit
-
nextTriangular
public float nextTriangular(float min, float max, float mode)Returns a triangularly distributed random number betweenmin
(inclusive) andmax
(exclusive), where values aroundmode
are more likely. Advances the state once.- Parameters:
min
- the lower limitmax
- the upper limitmode
- the point around which the values are more likely
-


Toggle navigation
About
Courses
Research
BacToMars (2017)
HoloMuse (2017)
Personal Genomics (2015)
Brain-Computer Interaction (2014)
Projects
(current)
This page is being updated!
Resume
Contact
Jasmine Davis
Projects
THIS PAGE IS CURRENTLY BEING UPDATED


Here.. is your destination
Marc Strong
Full-stack web developer
Contact Info
Phone:
847-668-5177
Email:
<EMAIL_ADDRESS>About Me
Portfolio
GitHub
LinkedIn
Resume


Basic ExpansionExpansion panel Official Component Personal data Type your name and age Self aware panel Currently I am {{panelOpenState ? 'open' : 'closed'}}
I'm visible because I am open
AccordionExpansion panel Personal data Type your name and age
account_circle Destination Type the country name
map Day of the trip Inform the date you wish to travel
date_range


Twitter-to-Instapaper Configuration
Instapaper Credentials
Email Address or Username:
Password:
Save


class Application extends Container
Constants
| VERSION |
|
| OS_OSX |
|
| OS_WIN |
|
| OS_LINUX |
|
| OS_OTHER |
|
Methods
|
__construct(string $basePath, string $appPath = null, string $resourcesPath = null)
Construct the application container |
||
|
setEventDispatcher(EventDispatcherInterface $event)
Set the event dispatcher |
from Container | |
| Container |
createChild()
Create a child Container with a new property scope that that has the ability to access the parent scope when resolving. |
from Container |
| void |
addProvider(mixed $provider)
Add a service provider to the application. |
from Container |
|
providers($registered = true)
|
from Container | |
| void |
initializeProxies()
Initialize the proxies with this instance of the container |
from Container |
| Definition|Closure |
bind(string $abstract, Closure|string $concrete = null)
Method to bind a concrete class to an abstract class or interface. |
from Container |
| bool |
bound(string $binding, bool $lazy = true)
Checks to see if a binding key has been bound in current Container. |
from Container |
| mixed |
build(string $concrete)
Build a concrete instance of a class. |
from Container |
| void |
registerProvidersFor(string $binding)
Register the service providers for a specific binding |
from Container |
| array |
provides(string $binding)
Return the service providers that provide a specified binding |
from Container |
| void |
extend(string $binding, Closure $closure)
Extend an existing binding. |
from Container |
| Definition|Closure |
getRaw(string $binding)
Get the raw object prior to resolution. |
from Container |
| mixed |
resolve(string $binding, bool $alias = true)
Resolve the given binding. |
from Container |
| void |
alias(string $alias, bool $concrete)
Add an alias |
from Container |
| bool |
offsetExists($offset)
Determine if a given offset exists. |
from Container |
| mixed |
offsetGet($offset)
Get the value at a given offset. |
from Container |
| void |
offsetSet(string $offset, mixed $value)
Set the value at a given offset. |
from Container |
| void |
offsetUnset($offset)
Unset the value at a given offset. |
from Container |
| static Application |
fromCwd()
Create application from current working directory |
|
| void |
launching(callable $callback, integer $priority = 100)
Bind an event to be triggered when the application is launching |
|
| void |
quitting(callable $callback, integer $priority = 100)
Bind an event to be triggered when the application is quitting |
|
| string |
mode()
Get the current application mode |
|
|
setMode(string $mode)
Set the application mode |
||
| void |
boot()
Boot the application |
|
| void |
launch()
Fire the application launching events |
|
| void |
quit()
Fire the application quitting events |
|
| Application |
get()
Get the instance of the app |
|
| string |
appPath()
Get the path the the app directory |
|
| string |
basePath()
Get the base path |
|
| string |
resourcesPath()
Get the path to resources |
|
| string |
os()
Get the current operating system |
Details
at line 39
public
__construct(string $basePath, string $appPath = null, string $resourcesPath = null)
Construct the application container
in Container at line 73
public
setEventDispatcher(EventDispatcherInterface $event)
Set the event dispatcher
in Container at line 84
public Container
createChild()
Create a child Container with a new property scope that that has the ability to access the parent scope when resolving.
in Container at line 95
public void
addProvider(mixed $provider)
Add a service provider to the application.
in Container at line 115
public
providers($registered = true)
in Container at line 125
public void
initializeProxies()
Initialize the proxies with this instance of the container
in Container at line 138
public Definition|Closure
bind(string $abstract, Closure|string $concrete = null)
Method to bind a concrete class to an abstract class or interface.
in Container at line 160
public bool
bound(string $binding, bool $lazy = true)
Checks to see if a binding key has been bound in current Container.
If not bound in the current Container, it will recursively search parent Container's until it finds the $binding.
in Container at line 175
public mixed
build(string $concrete)
Build a concrete instance of a class.
in Container at line 204
public void
registerProvidersFor(string $binding)
Register the service providers for a specific binding
in Container at line 217
public array
provides(string $binding)
Return the service providers that provide a specified binding
in Container at line 233
public void
extend(string $binding, Closure $closure)
Extend an existing binding.
in Container at line 284
public Definition|Closure
getRaw(string $binding)
Get the raw object prior to resolution.
in Container at line 303
public mixed
resolve(string $binding, bool $alias = true)
Resolve the given binding.
in Container at line 332
public void
alias(string $alias, bool $concrete)
Add an alias
in Container at line 343
public bool
offsetExists($offset)
Determine if a given offset exists.
in Container at line 355
public mixed
offsetGet($offset)
Get the value at a given offset.
in Container at line 367
public void
offsetSet(string $offset, mixed $value)
Set the value at a given offset.
in Container at line 378
public void
offsetUnset($offset)
Unset the value at a given offset.
at line 60
static public Application
fromCwd()
Create application from current working directory
at line 72
public void
launching(callable $callback, integer $priority = 100)
Bind an event to be triggered when the application is launching
at line 84
public void
quitting(callable $callback, integer $priority = 100)
Bind an event to be triggered when the application is quitting
at line 94
public string
mode()
Get the current application mode
at line 104
public
setMode(string $mode)
Set the application mode
at line 114
public void
boot()
Boot the application
at line 154
public void
launch()
Fire the application launching events
at line 164
public void
quit()
Fire the application quitting events
at line 174
public Application
get()
Get the instance of the app
at line 184
public string
appPath()
Get the path the the app directory
at line 194
public string
basePath()
Get the base path
at line 204
public string
resourcesPath()
Get the path to resources
at line 214
public string
os()
Get the current operating system


Chapter 13 R books
As with the cheatsheets, there are open access books out there (as well as expensive ones to buy). For beginners, “The Pirates Gude to R” by Nathaniel D. Phillips is HIGHLY recommended. You can access it here
As with the cheatsheets, there are open access books out there (as well as expensive ones to buy). For beginners, “The Pirates Gude to R” by Nathaniel D. Phillips is HIGHLY recommended. You can access it here


# Use the recipe-data class to collect SRC_URI for the manifest.
#
# While this will need to be globally INHERIT'd to work properly, inherit
# locally so that parsing does not fail.
inherit recipe-data
# Instead of re-adding the do_rootfs task, re-add the do_emit_recipe_data_all
# task to run before do_rootfs.
deltask do_emit_recipe_data_all
# There seems to be something special with the rootfs task and task dependencies
# are not working as expected, so use the install task instead.
addtask emit_recipe_data_all after do_emit_recipe_data before do_install
get_sources_from_recipe(){
[ ! -z "$1" ] || return 0
# Check if a full URL is given (e.g. ipks from sourceipk class)
if [ $(echo "$1" | grep -c '://') -gt 0 ]
then
echo "$1"
return 0
fi
# Now assume that this was created by the package_ipk class
# Cannot assume that recipe filename is ${PN}_${PV}.bb
# This is easily seen with BBCLASSEXTEND recipes.
for pn in $(sed -ne 's|FILE_pn-\([^ \t=]*\)[ \t]*=[ \t]*".*/'$1'".*|\1|p' "${RECIPE_DATA_FILE}")
do
# Only need a single PN incase there are native, nativesdk, target variants.
break
done
recipe_data_get_var_sh "$pn" "SRC_URI"
}
# This function expects to be passed the following parameter
# - The location to the opkg info directory containing the control files
# of the installed packages
# Optionally if the second parameter is set to true then only GPLv3 contents
# will be listed. This is for TI SW Manifests where GPLv3 content is
# highlighted as a separate table.
generate_sw_manifest_table() {
control_dir="$1"
gplv3_only="$2"
# Call this here so that the function gets added to the task script
get_sources_from_recipe
if [ ! -d "$control_dir" ]
then
echo "Could not find the control directory ($control_dir)"
return 1
fi
if [ "$gplv3_only" == "" ]
then
# The second parameter was not passed so set to false
gplv3_only="false"
fi
echo "
| Software Name |
Version |
License |
Location |
Delivered As |
Modified by TI |
Obtained from |
" >> ${SW_MANIFEST_FILE}
cat >> ${SW_MANIFEST_TEXT} << EOF
EOF
control_files_there=0
for possible_control_file in $control_dir/*.control
do
if [ -f $possible_control_file ]
then
control_files_there=1
break
fi
done
if [ $control_files_there -eq 0 ]
then
for pkg_idx in $control_dir/oe*; do
package_start=`grep -n "^Package" $pkg_idx || true`
IFS_OLD=${IFS}
IFS="
"
begin=""
end=""
for pkg in ${package_start}; do
end=`echo $pkg | cut -d: -f1`
if [ -z $begin ]; then
pkg_name=`echo $pkg | cut -d: -f3`
begin=`echo $pkg | cut -d: -f1`
continue
fi
cnt=$[$cnt+1]
head -n $[$end - 1] $pkg_idx | tail -n $[$end - $begin] > ${control_dir}/${pkg_name// /}.control
pkg_name=`echo $pkg | cut -d: -f3`
begin=$end
done
if [ ! -z $end ]; then
end=`wc -l $pkg_idx | awk '{ print $1 }'`
end=$[$end + 1]
tail -n $[$end - $begin] $pkg_idx > ${control_dir}/${pkg_name// /}.control
fi
IFS=${IFS_OLD}
done
fi
for i in $control_dir/*.control
do
package="`cat $i | grep Package: | awk {'print $2'}`"
version="`cat $i | grep Version: | awk {'print $2'} | cut -f1-2 -d-`"
long_version="`cat $i | grep Version: | awk {'print $2'}`"
license="`cat $i | grep License: | cut -d: -f2 `"
architecture="`cat $i | grep Architecture: | awk {'print $2'}`"
recipe="`cat $i | grep Source: | cut -d ':' -f2-`"
sources="`get_sources_from_recipe $recipe`"
location="$package""_""$long_version""_""$architecture"".ipk"
# Set the highlight color if the license in GPLv3. If this is
# a GPLv3 only table then skip this package.
case "$license" in
*GPLv3*)
highlight="bgcolor=yellow" ;;
*unknown*)
if [ "$gplv3_only" != "true" ]
then
highlight="bgcolor=yellow"
else
continue
fi
;;
*)
if [ "$gplv3_only" != "true" ]
then
highlight=""
else
continue
fi
;;
esac
# source variable contains the text to be used in the manifest
source=""
# Are there additional files in the package that come from the
# arago/OE metadata?
extra_files="0"
modified="No"
for s in $sources
do
case "$s" in
file://*)
extra_files="1"
;;
http://install.source.dir.local*)
# If we are pulling something from a local file system then
# it is not a public modification and this should be marked
# as modified. This should not be the normal case.
modified="Yes"
;;
*)
source="$source""$s";;
esac
done
if [ "$extra_files" == "1" ]
then
source="$source""
Files from:
git://arago-project.org/git/meta-arago.git
git://arago-project.org/git/meta-ti.git"
fi
case "$package" in
task-*)
continue ;;
*-src*)
delivered_as="Source"
;;
*)
delivered_as="Binary"
;;
esac
echo "
| ${package} |
${version} |
${license} |
${location} |
${delivered_as} |
${modified} |
${source} |
" >> ${SW_MANIFEST_FILE}
cat >> ${SW_MANIFEST_TEXT} << EOF
| ${package} | ${version} | ${license//\|/or} | ${delivered_as} | ${modified} | ${location} | ${source}
EOF
done
echo "
" >> ${SW_MANIFEST_FILE}
cat >> ${SW_MANIFEST_TEXT} << EOF
EOF
}