How to upgrade your edge gateway
Overview
This guide shows you how to check the existing version of your edge gateway and, if necessary, upgrade it to the latest available version. If you need any assistance with the upgrade process, contact the support team by raising a service request in the My Calls section of the UKCloud Portal.
We highly recommend that you upgrade your edge gateways to 6.2.x so that you can then convert them to advanced gateways. Upgrading to 6.2.x also fixes known issues with TcpUdp firewall rules.
Note
You must upgrade all edge gateways to 6.2.x prior to our planned upgrade to vCloud Director 9.1.
Intended audience
To complete the steps in this guide you must have access to the UKCloud Portal and vCloud Director.
Prerequisites
Before you attempt to upgrade your edge gateway, check for the following.
Check current version
To check the existing version of your edge gateway:
Log in to the UKCloud Portal.
For more detailed steps, see the Getting Started Guide for the UKCloud Portal.
If necessary, switch to the appropriate account.
Click My VMs.
Select the compute service (vOrg) that the edge gateway belongs to.
Select the My VMs tab.
From the Currently viewing for VDC list, select the VDC that the edge gateway you want to check belongs to.
Select the Edge Gateway tab.
From the Select Edge list, select the edge gateway that you want to check.
The VM version field shows the version number of your edge gateway.
If the version is lower than 6.2.7 (for example, 5.5.4), make a note that the edge gateway needs upgrading.
Repeat these steps for any other edge gateways that you want to check.
Load balancers with weight of 0
In the NSX API in vCloud Director 8.20, using a load balancer weight of 0 to disable a member is no longer valid. If you attempt to upgrade an edge gateway with a load balancer member weight of 0, the redeployment will fail.
For more information, see the following VMware Knowledge Base article: https://kb.vmware.com/s/article/51724.
To resolve this issue, before you upgrade your edge gateway, set the load balancer member weight to 1.
In vCloud Director, select the Administration tab.
Double-click the VDC that the edge gateway that you want to edit belongs to (or right-click the VDC and select Open).
Select the Edge Gateways tab.
Right-click the edge gateway that you want to edit and select Edge Gateway Services.
Select the Load Balancer tab.
Select the load balancer you want to edit and click Edit.
Select the Manage Members tab.
Select the load balancer member that you want to edit and click Edit.
In the Ratio weight field, enter
1
.
After you've upgraded the edge gateway, we recommend that you convert it to an advanced gateway, where you can then disable the load balancer member.
Important
Before you convert your edge gateway, read How to convert your edge to an advanced gateway for important known issues relating to APIs, disabling firewalls and firewall rule keywords.
Upgrading your edge gateway to the latest available version
The following steps show how to upgrade your edge gateway using vCloud Director.
Note
Before you begin the upgrade process, bear in mind that there will be a brief network disruption for the networks that are used by the edge gateway instance.
Note
You cannot redeploy edge gateways in the new vCloud Director 9.1 tenant portal. If your environment uses vCloud Director 9.1, you must first switch to the vCloud Director web console. For more information, see How to switch to the vCloud Director web console from the tenant portal.
In vCloud Director, select the Administration tab.
Double-click the VDC that the edge gateway that you want to upgrade belongs to (or right-click the VDC and select Open).
Select the Edge Gateways tab.
Right-click the edge gateway that you want to upgrade and select Re-Deploy.
In the confirmation dialog box, click Yes.
Important
This step requires downtime as a new VM needs to be deployed for the edge gateway. You should make sure that you have planned for this downtime before proceeding.
You can monitor the status in the Activity Task Detail dialog box.
After the redeployment has finished, you can check the version of the edge gateway again in the UKCloud Portal to confirm that the upgrade has been successful.
Next steps
We recommend that you convert your edge gateway to an advanced gateway to take advantage of more features and to access the new HTML5-based tenant portal. For more information, including known issues, see How to convert your edge to an advanced gateway.
Feedback
If you find an issue with this article, click Improve this Doc to suggest a change. If you have an idea for how we could improve any of our services, visit UKCloud Ideas. Alternatively, you can contact us at products@ukcloud.com.


--- title: kerasgenerator v0.0.1 Released! author: R. Dimas Bagas Herlambang date: 2019-01-01 11:59:00 +7000 slug: kerasgenerator-v-0-0-1-released categories: - R tags: - kerasgenerator - package - R ---
kerasgenerator
package is designed to simplify the process of preparing the dataset so it could be properly passed to keras
’ fit, evaluate, or predict on generator functions.
Currently, it is still in a very early development stage–it is even only have 2 functions right now :grin:. But it is my first experience in developing a package, and I really can’t resist to publish it to test some features from devtools
, usethis
, and pkgdown
. To be honest, this is also one of the main reason I started this blog–which give me a perfect excuse to try blogdown
. I will share some of my experiences in using those package in this blog :smile:
At the moment I’m posting this, I’m still building some vignettes for kerasgenerator
. As soon as it this finished, I will upload the link in the package website. I’m also developing some other features:
recipes
package for data preprocessingIf you interested in the package, please stay tuned on this blog for further post related to this package. Also don’t forget to check the package’s website and push the star buttons on the package GitHub repository :grin:
Happy new year!


just enough to make sense not a tiny inch more maybe too much in a sense to plant what is growing inside the light in this primitive darkness! we fear deep for the hate her love is supposed to radiate told the tiny white scorpion walking through my left ear. into my electrocuted skull i feel she's near yet i can not hear...


PICS:Accident Alert… ZRP Avondale shares car crash photos from the weekend
by Sharon Chirisa
ZRP Avondale shares car crash photos from the weekend
ZRP Avondale has shared pictures of traffic accident which occured in Avondale during the weekend.
Said ZRP in a statement
YOU MAY ALSO LIKE
CRAZY TIMES:This is How Much a 10kg Bag Of Mealie Meal Now Costs in Zimbabwe
The Real Reason Behind Steamy Photographs Of Plaxedes & Ben 10 Finally revealed
PIC:Madzibaba na Madzimai….Mambo Dhuterere & wife serve couple goals in church garments
‘Businessman’ Buyanga Threatens First Family…Issues “Stern Warning” To Auxillia Mnangagwa As Child Custody Fight Heats Up
To View and Apply for the latest Jobs and Vacancies in Zimbabwe, Please Visit our Sister website iHarare Jobs


--- layout: post status: publish published: true title: Roundtable Discussion on the Future of Flex - The Flex Show author: Arthur Rosa author_login: arthurlockman author_email<EMAIL_ADDRESS>author_url: https://b.rthr.me wordpress_id: 291 wordpress_url: http://b.rthr.me/?p=291 date: '2011-11-16 11:57:14 -0500' date_gmt: '2011-11-16 16:57:14 -0500' ---
This week, the episode of The Flex Show podcast is about the future of Flex following the announcement on Flash Player Mobile being killed. The podcast is in a roundtable format, with me, Sim Bateman, and Ashkay Dave. This was recorded prior to the blog post from Deepa and Andrew Shorten, and they are planning on organizing another one to discuss those announcements as well.
For now though, go get the podcast! It has lots of good opinions and ideas, and really gets into flex in the real world.
All for now!


--- layout: post title: Making some pizza dough date: 2010-06-14 03:15:18.000000000 -07:00 type: post published: true status: publish categories: [] tags: [] meta: {} author: ---
Sent via iPhone


Frequently Asked Questions
I highly encourage you to familiarize yourself with the FAQ section, so you can get answers to common inquiries regarding Earlybird quickly
Why a PWA medium?
A progressive web app (PWA) offers core benefits inclusive of but not limited to: increased security, improved engagement, cost-effectiveness,
improved search ranking, and smooth performance on unstable networks. Additionally, PWAs offer accessibility on all devices, which is the highlight
of the Earlybird app itself. Learn more about PWAs here.
Why an Android app medium?
An Android app medium gives Earlybird a cost-effective native app environment, for those who would prefer an Android app version via Google Play
Why isn't there an iOS version?
Unfortunately, due to the cost in development and additional annual publishing fees, an iOS version of Earlybird is not
likely in the foreseeable future. However, the PWA version of Earlybird acts as a primary substitute for this issue, and is accessible and
installable as well!
Is Earlybird open source?
Yes! Earlybird is fully open source and its source code is available here.
There is a "main" branch for the source code of the app environments, as well as a Github Pages environment branch named "gh-pages", which
is the source code for the website
Is Earlybird under development?
Yes, Earlybird is currently under development with a projected release date around Summer 2021. Developments to the project are made on a daily
basis
How is the app/web app/website made?
The Earlybird website is utilizing HTML, CSS, Bootstrap, JS, JS libraries, and jQuery
The Earlybird progressive web app is utilizing HTML, CSS, JS. Likely back-end languages will be Python and Django (TBD)
The Earlybird Android app is utilizing Java and the Android Studio
The Earlybird progressive web app is utilizing HTML, CSS, JS. Likely back-end languages will be Python and Django (TBD)
The Earlybird Android app is utilizing Java and the Android Studio
Still need help? Feel free to use the live chat on the bottom-right corner of the page


|
libpqxx
4.0.1
|
Namespaces | |
| namespace | pqxx::internal |
| Private namespace for libpqxx's internal use; do not access. |
Classes | |
| struct | pqxx::string_traits< T > |
| Traits class for use in string conversions. More... | |
| struct | pqxx::string_traits< const char * > |
| String traits for C-style string ("pointer to const char") More... | |
| struct | pqxx::string_traits< char * > |
| String traits for non-const C-style string ("pointer to char") More... | |
| struct | pqxx::string_traits< char[N]> |
| String traits for C-style string constant ("array of char") More... | |
| struct | pqxx::string_traits< const char[N]> |
| String traits for "array of const char.". More... | |
| struct | pqxx::string_traits< std::string > |
| struct | pqxx::string_traits< const std::string > |
| struct | pqxx::string_traits< std::stringstream > |
Macros | |
| #define | PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION(T) |
Functions | |
| template<typename T > | |
| void | pqxx::from_string (const char Str[], T &Obj) |
| Attempt to convert postgres-generated string to given built-in type. | |
| template<typename T > | |
| void | pqxx::from_string (const char Str[], T &Obj, size_t) |
| Conversion with known string length (for strings that may contain nuls) | |
| template<> | |
| void | pqxx::from_string< std::string > (const char Str[], std::string &Obj, size_t len) |
| template<typename T > | |
| void | pqxx::from_string (const std::string &Str, T &Obj) |
| template<typename T > | |
| void | pqxx::from_string (const std::stringstream &Str, T &Obj) |
| template<> | |
| void | pqxx::from_string (const std::string &Str, std::string &Obj) |
| template<typename T > | |
| std::string | pqxx::to_string (const T &Obj) |
| Convert built-in type to a readable string that PostgreSQL will understand. |
For purposes of communication with the server, values need to be converted from and to a human-readable string format that (unlike the various functions and templates in the C and C++ standard libraries) is not sensitive to locale settings and internationalization. This section contains functionality that is used extensively by libpqxx itself, but is also available for use by other programs.
| #define PQXX_DECLARE_STRING_TRAITS_SPECIALIZATION | ( | T | ) |
| void pqxx::from_string | ( | const char | Str[], |
| T & | Obj | ||
| ) |
Attempt to convert postgres-generated string to given built-in type.
If the form of the value found in the string does not match the expected type, e.g. if a decimal point is found when converting to an integer type, the conversion fails. Overflows (e.g. converting "9999999999" to a 16-bit C++ type) are also treated as errors. If in some cases this behaviour should be inappropriate, convert to something bigger such as long
int
first and then truncate the resulting value.
Only the simplest possible conversions are supported. No fancy features such as hexadecimal or octal, spurious signs, or exponent notation will work. No whitespace is stripped away. Only the kinds of strings that come out of PostgreSQL and out of to_string() can be converted.
References pqxx::from_string().
| void pqxx::from_string | ( | const char | Str[], |
| T & | Obj, | ||
| size_t | |||
| ) |
Conversion with known string length (for strings that may contain nuls)
This is only used for strings, where embedded nul bytes should not determine the end of the string.
For all other types, this just uses the regular, nul-terminated version of from_string().
References pqxx::from_string().
| void pqxx::from_string | ( | const std::string & | Str, |
| T & | Obj | ||
| ) |
References pqxx::from_string().
| void pqxx::from_string | ( | const std::stringstream & | Str, |
| T & | Obj | ||
| ) |
References pqxx::from_string().
| void pqxx::from_string | ( | const std::string & | Str, |
| std::string & | Obj | ||
| ) |
| void pqxx::from_string< std::string > | ( | const char | Str[], |
| std::string & | Obj, | ||
| size_t | len | ||
| ) |
| std::string pqxx::to_string | ( | const T & | Obj | ) |
Convert built-in type to a readable string that PostgreSQL will understand.
No special formatting is done, and any locale settings are ignored. The resulting string will be human-readable and in a format suitable for use in SQL queries.
References pqxx::to_string().


GrADS User's Guide
Table of Contents
General Topics
Starting and Quiting GrADS
Basic Concept of Operation
Gridded Data Sets
Gridded Data Descriptor File
Structure of a Gridded Binary Data File
Binary Data Formats
Creating Data Files
The Ensemble Dimension in GrADS version 2.0
Elements of a GrADS Data Descriptor File
Creating a Data Descriptor File for GRIB Data
Reading NetCDF and HDF-SDS Files with GrADS
Reading and Writing Compressed Data Sets
Reinitialization of GrADS
Command Line Editing and History
External Utilities
Analysis Topics
Dimension Environment
GrADS Variables
Variable Names
Defining New Variables
Undefining Variables
GrADS Expressions
Using Templates to Aggregate Data Files
About GrADS Station Data
Structure of a GrADS Station Data File
Creating a GrADS Station Data File
GrADS Station Data Descriptor File
The STNMAP Utility
The BUFR Format for Station Data
Using Station Data
Operating on Station Data
Plotting Station Models
Drawing Arbitrary Cross Sections
User Defined Functions
Overview of User Defined Functions
The user defined function table
Format of the function data transfer file
Format of the function result file
Example: Linear Regression Function
Using Pre-Projected Data in GrADS
Polar Stereo Preprojected Data
Lambert Conformal Preprojected Data
NCEP ETA Model
NCEP polar stereographic grid for SSMI data
CSU RAMS oblique polar stereographic grid
Pitfalls when using preprojected data
GrADS Display Projections
Summary and Plans
Non-Standard Variable Formats and Data File Structures
Display Topics
Displaying Data
Drawing Plots
Clearing the Display
Graphics Output Types
Graphics Options
Drawing Basic Graphics Elements
Drawing the Contents of a Shapefile
Animation
Page Control
Real and Virtual Pages
Controlling the Plot Area
Drawing Multi-Panel Plots
Color Control
Font Control
Producing Hardcopy and Image Output from GrADS
GrADS Scripting Language
Introduction to GrADS scripts
Elements of the Language:
comment
statement
assignment
say / prompt / pull
if / else / endif
while / endwhile
variables
operators
expressions
Functions
Intrinsic Functions
Commands that complement the scripting language
Widgets
Dynamic Loading of Script Functions
Script Library


Implementing an algorithm by modelling an FSM in an HDL
We are going to use Verilog for this project. So, any verilog compiler and simulator should do.
Xilinx and ModelSim are really good tools. But since I’m a *nix guy, I’m going to use
Icarus Verilog to compile code and gtkwave to view the signal timing diagrams.
They are free to use, easy to learn and much more light-weight than other full-fledged options.
Required tools
Steps to install, setup and use these two tools (iverilog and gtkwave) are explained in another of my article.
Concepts
In a complex digital system, the hardware is typically partitioned into two parts:
a) Data Path, which consists of the functional units where all computations are carried out. Typically consists of registers, multiplexers, bus, adders, multipliers, counters and other functional blocks.
b) Control Path, which implements a finite-state machine and provides control signals to the data path in proper sequence. In response to the control signals, various operations are carried out by the data path. Also, it takes inputs from the data path regarding various status information.
The state transition is controlled by control path or control unit or controller.
The control unit (CU) send all the signals necessary to trigger any operation in data path.
The data path consists of elements that process data and addresses. Usually there’s also a clock
signal and a data bus that go to both data path and control path. By specifying a particular sequence of
operations, the control unit can implement a given algorithm.
The following block diagram shows the idea of separating a system into a data path and a control path:
The problem to model
Multiplication by repeated addition
Algorithm: Multiply (a, b)
Step 1. Get the values for a and b.
Step 2. If (either a = 0 or b = 0) then
Step 3. Set the value of the product to be 0
Step 4. Else
Step 5. Set the value of product to 0
Step 6. While (b > 0)
Step 7. Set the value of product to (product + a)
Step 8. Set the value of b to (b - 1)
Step 9. End while loop
Step 10. End if
Step 11. Print the value of product
Step 12. Stop
Flowchart
Data path and control path design
Our data path consists of three registers: A, B and P, one adder unit and one comparator unit. Moreover, these components are connected to data bus (through which input data comes) and different incoming signals (LdA, LdP, clrP, LdB, decB, clk) from control unit and clock frequency generator. Also, there is an outgoing status signal eqz. Moreover there are 3 wires: wire x connecting register A to adder, wire y connecting register P to adder and wire z that puts the sum of A and P back into P.
If we see the overall system, 1 data line (data_in) and 2 signals (start and clk) are going in and one status signal (done) is coming out. These 4 parameters are what we we will use in test bench also to test our design. Other than that, 5 control signals are going to data path unit from control unit apart from a clock signal. And data path is returning eqz (equal to zero) status signal from comparator to CU.
The control unit and its signals help specify the transitions to different states for different operations and conditions. The following diagram shows how the algorithm flow chart is mapped to finite state diagram:
Implementation in Verilog
Module for parallel in parallel out register A
This PIPO register saves 16-bit data till load signal (ld) is not set again. Once ld is set,
new data is loaded on the next positive clock edge.
Module for parallel in parallel out register P
This PIPO register saves 16 bit data till load (ld) or clear (clr) signal is not set again.
Once ld is set, new data is loaded on the next positive clock edge. When clr signal is set,
then all data is erased to 0.
Module for adder unit
Takes two 16 bit data and adds and returns back 16 bit sum. Doesn’t care for overflow.
Module for comparator unit
Checks if the data is equal to 0 or not.
Module for PIPO register B and counter (to decrement register B value)
PIPO register B loads new data if ld signal is on. It decrements the content of B by 1 if dec signal is on.
Module for data path
It implements the data path design.
Module for controller
Implements the control path design as shown in figure 6. The data path
performs the actual processing on the input data, and the control path
determines which operation should be performed by the data path using the
signals LdA, LdB, LdP, clrP, decB and done. The CU also implements the FSM.
Test Bench
Implements test bench to test the modules by multiplying 5 with 6 using
repetitive addition. The waveform dump file is saved in mul.vcd which can be
used to visualize the signal waveforms for each time instant. It will also print
each product value and done status signal value with their time instant value.


UNXRANDR(1) UNXRANDR(1) NAME unxrandr - inverse tool of xrandr SYNOPSIS unxrandr DESCRIPTION unxrandr is a tool that queries the XRandR state using ARandR's libraries and outputs an xrandr command line that reproduces the state (as far as it is supported by the library). The command sh -c "unxrandr" should never modify the configured state. It takes no options apart from --help and --version. SEE ALSO man 1 arandr AUTHOR chrysn<EMAIL_ADDRESS>2011-10-01 UNXRANDR(1)


--- layout: post authors: ["Greg Wilson"] title: European Grid Infrastructure is Organizing a Software Carpentry Workshop date: 2012-12-01 time: "09:00:00" tags: ["Community", "University of Manchester", "EGI Forum"] ---
The European Grid Infrastructure project is putting together a Software Carpentry workshop for Manchester in April-early details are in their post, and we'll post more details ourselves as they evolve.


| PostgreSQL 9.0.10 Documentation | ||||
|---|---|---|---|---|
| Prev | Up | Chapter 9. Functions and Operators | Next |
Table 9-47 shows several functions that extract session and system information.
In addition to the functions listed in this section, there are a number of functions related to the statistics system that also provide system information. See Section 27.2.2 for more information.
Table 9-47. Session Information Functions
| Name | Return Type | Description |
|---|---|---|
current_catalog | name | name of current database (called "catalog" in the SQL standard) |
current_database() | name | name of current database |
current_schema [()] | name | name of current schema |
current_schemas(boolean) | name[] | names of schemas in search path, optionally including implicit schemas |
current_user | name | user name of current execution context |
current_query() | text | text of the currently executing query, as submitted by the client (might contain more than one statement) |
pg_backend_pid() | int | Process ID of the server process attached to the current session |
pg_listening_channels() | setof text | channel names that the session is currently listening on |
inet_client_addr() | inet | address of the remote connection |
inet_client_port() | int | port of the remote connection |
inet_server_addr() | inet | address of the local connection |
inet_server_port() | int | port of the local connection |
pg_my_temp_schema() | oid | OID of session's temporary schema, or 0 if none |
pg_is_other_temp_schema(oid) | boolean | is schema another session's temporary schema? |
pg_postmaster_start_time() | timestamp with time zone | server start time |
pg_conf_load_time() | timestamp with time zone | configuration load time |
session_user | name | session user name |
user | name | equivalent to current_user |
version() | text | PostgreSQL version information |
Note:
current_catalog
,current_schema
,current_user
,session_user
, anduser
have special syntactic status in SQL: they must be called without trailing parentheses. (In PostgreSQL, parentheses can optionally be used withcurrent_schema
, but not with the others.)
The session_user
is normally the user who initiated
the current database connection; but superusers can change this setting
with SET SESSION AUTHORIZATION.
The current_user
is the user identifier
that is applicable for permission checking. Normally it is equal
to the session user, but it can be changed with
SET ROLE.
It also changes during the execution of
functions with the attribute SECURITY DEFINER.
In Unix parlance, the session user is the "real user" and
the current user is the "effective user".
current_schema
returns the name of the schema that is
first in the search path (or a null value if the search path is
empty). This is the schema that will be used for any tables or
other named objects that are created without specifying a target schema.
current_schemas(boolean)
returns an array of the names of all
schemas presently in the search path. The Boolean option determines whether or not
implicitly included system schemas such as pg_catalog are included in the
returned search path.
Note: The search path can be altered at run time. The command is:
SET search_path TO schema [, schema, ...]
pg_listening_channels
returns a set of names of
channels that the current session is listening to. See LISTEN for more information.
inet_client_addr
returns the IP address of the
current client, and inet_client_port
returns the
port number.
inet_server_addr
returns the IP address on which
the server accepted the current connection, and
inet_server_port
returns the port number.
All these functions return NULL if the current connection is via a
Unix-domain socket.
pg_my_temp_schema
returns the OID of the current
session's temporary schema, or zero if it has none (because it has not
created any temporary tables).
pg_is_other_temp_schema
returns true if the
given OID is the OID of another session's temporary schema.
(This can be useful, for example, to exclude other sessions' temporary
tables from a catalog display.)
pg_postmaster_start_time
returns the
timestamp with time zone when the
server started.
pg_conf_load_time
returns the
timestamp with time zone when the
server configuration files were last loaded.
(If the current session was alive at the time, this will be the time
when the session itself re-read the configuration files, so the
reading will vary a little in different sessions. Otherwise it is
the time when the postmaster process re-read the configuration files.)
version
returns a string describing the
PostgreSQL server's version.
Table 9-48 lists functions that allow the user to query object access privileges programmatically. See Section 5.6 for more information about privileges.
Table 9-48. Access Privilege Inquiry Functions
| Name | Return Type | Description |
|---|---|---|
has_any_column_privilege (user,
table,
privilege)
| boolean | does user have privilege for any column of table |
has_any_column_privilege (table,
privilege)
| boolean | does current user have privilege for any column of table |
has_column_privilege (user,
table,
column,
privilege)
| boolean | does user have privilege for column |
has_column_privilege (table,
column,
privilege)
| boolean | does current user have privilege for column |
has_database_privilege (user,
database,
privilege)
| boolean | does user have privilege for database |
has_database_privilege (database,
privilege)
| boolean | does current user have privilege for database |
has_foreign_data_wrapper_privilege (user,
fdw,
privilege)
| boolean | does user have privilege for foreign-data wrapper |
has_foreign_data_wrapper_privilege (fdw,
privilege)
| boolean | does current user have privilege for foreign-data wrapper |
has_function_privilege (user,
function,
privilege)
| boolean | does user have privilege for function |
has_function_privilege (function,
privilege)
| boolean | does current user have privilege for function |
has_language_privilege (user,
language,
privilege)
| boolean | does user have privilege for language |
has_language_privilege (language,
privilege)
| boolean | does current user have privilege for language |
has_schema_privilege (user,
schema,
privilege)
| boolean | does user have privilege for schema |
has_schema_privilege (schema,
privilege)
| boolean | does current user have privilege for schema |
has_server_privilege (user,
server,
privilege)
| boolean | does user have privilege for foreign server |
has_server_privilege (server,
privilege)
| boolean | does current user have privilege for foreign server |
has_sequence_privilege (user,
sequence,
privilege)
| boolean | does user have privilege for sequence |
has_sequence_privilege (sequence,
privilege)
| boolean | does current user have privilege for sequence |
has_table_privilege (user,
table,
privilege)
| boolean | does user have privilege for table |
has_table_privilege (table,
privilege)
| boolean | does current user have privilege for table |
has_tablespace_privilege (user,
tablespace,
privilege)
| boolean | does user have privilege for tablespace |
has_tablespace_privilege (tablespace,
privilege)
| boolean | does current user have privilege for tablespace |
pg_has_role (user,
role,
privilege)
| boolean | does user have privilege for role |
pg_has_role (role,
privilege)
| boolean | does current user have privilege for role |
has_table_privilege
checks whether a user
can access a table in a particular way. The user can be
specified by name or by OID
(pg_authid.oid), or if the argument is
omitted
current_user
is assumed. The table can be specified
by name or by OID. (Thus, there are actually six variants of
has_table_privilege
, which can be distinguished by
the number and types of their arguments.) When specifying by name,
the name can be schema-qualified if necessary.
The desired access privilege type
is specified by a text string, which must evaluate to one of the
values SELECT, INSERT,
UPDATE, DELETE, TRUNCATE,
REFERENCES, or TRIGGER. Optionally,
WITH GRANT OPTION can be added to a privilege type to test
whether the privilege is held with grant option. Also, multiple privilege
types can be listed separated by commas, in which case the result will
be true if any of the listed privileges is held.
(Case of the privilege string is not significant, and extra whitespace
is allowed between but not within privilege names.)
Some examples:
SELECT has_table_privilege('myschema.mytable', 'select'); SELECT has_table_privilege('joe', 'mytable', 'INSERT, SELECT WITH GRANT OPTION');
has_sequence_privilege
checks whether a user
can access a sequence in a particular way. The possibilities for its
arguments are analogous to has_table_privilege
.
The desired access privilege type must evaluate to one of
USAGE,
SELECT, or
UPDATE.
has_any_column_privilege
checks whether a user can
access any column of a table in a particular way.
Its argument possibilities
are analogous to has_table_privilege
,
except that the desired access privilege type must evaluate to some
combination of
SELECT,
INSERT,
UPDATE, or
REFERENCES. Note that having any of these privileges
at the table level implicitly grants it for each column of the table,
so has_any_column_privilege
will always return
true if has_table_privilege
does for the same
arguments. But has_any_column_privilege
also succeeds if
there is a column-level grant of the privilege for at least one column.
has_column_privilege
checks whether a user
can access a column in a particular way.
Its argument possibilities
are analogous to has_table_privilege
,
with the addition that the column can be specified either by name
or attribute number.
The desired access privilege type must evaluate to some combination of
SELECT,
INSERT,
UPDATE, or
REFERENCES. Note that having any of these privileges
at the table level implicitly grants it for each column of the table.
has_database_privilege
checks whether a user
can access a database in a particular way.
Its argument possibilities
are analogous to has_table_privilege
.
The desired access privilege type must evaluate to some combination of
CREATE,
CONNECT,
TEMPORARY, or
TEMP (which is equivalent to
TEMPORARY).
has_function_privilege
checks whether a user
can access a function in a particular way.
Its argument possibilities
are analogous to has_table_privilege
.
When specifying a function by a text string rather than by OID,
the allowed input is the same as for the regprocedure data type
(see Section 8.16).
The desired access privilege type must evaluate to
EXECUTE.
An example is:
SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
has_foreign_data_wrapper_privilege
checks whether a user
can access a foreign-data wrapper in a particular way.
Its argument possibilities
are analogous to has_table_privilege
.
The desired access privilege type must evaluate to
USAGE.
has_language_privilege
checks whether a user
can access a procedural language in a particular way.
Its argument possibilities
are analogous to has_table_privilege
.
The desired access privilege type must evaluate to
USAGE.
has_schema_privilege
checks whether a user
can access a schema in a particular way.
Its argument possibilities
are analogous to has_table_privilege
.
The desired access privilege type must evaluate to some combination of
CREATE or
USAGE.
has_server_privilege
checks whether a user
can access a foreign server in a particular way.
Its argument possibilities
are analogous to has_table_privilege
.
The desired access privilege type must evaluate to
USAGE.
has_tablespace_privilege
checks whether a user
can access a tablespace in a particular way.
Its argument possibilities
are analogous to has_table_privilege
.
The desired access privilege type must evaluate to
CREATE.
pg_has_role
checks whether a user
can access a role in a particular way.
Its argument possibilities
are analogous to has_table_privilege
.
The desired access privilege type must evaluate to some combination of
MEMBER or
USAGE.
MEMBER denotes direct or indirect membership in
the role (that is, the right to do SET ROLE), while
USAGE denotes whether the privileges of the role
are immediately available without doing SET ROLE.
Table 9-49 shows functions that determine whether a certain object is visible in the current schema search path. For example, a table is said to be visible if its containing schema is in the search path and no table of the same name appears earlier in the search path. This is equivalent to the statement that the table can be referenced by name without explicit schema qualification. To list the names of all visible tables:
SELECT relname FROM pg_class WHERE pg_table_is_visible(oid);
Table 9-49. Schema Visibility Inquiry Functions
| Name | Return Type | Description |
|---|---|---|
pg_conversion_is_visible(conversion_oid)
| boolean | is conversion visible in search path |
pg_function_is_visible(function_oid)
| boolean | is function visible in search path |
pg_operator_is_visible(operator_oid)
| boolean | is operator visible in search path |
pg_opclass_is_visible(opclass_oid)
| boolean | is operator class visible in search path |
pg_table_is_visible(table_oid)
| boolean | is table visible in search path |
pg_ts_config_is_visible(config_oid)
| boolean | is text search configuration visible in search path |
pg_ts_dict_is_visible(dict_oid)
| boolean | is text search dictionary visible in search path |
pg_ts_parser_is_visible(parser_oid)
| boolean | is text search parser visible in search path |
pg_ts_template_is_visible(template_oid)
| boolean | is text search template visible in search path |
pg_type_is_visible(type_oid)
| boolean | is type (or domain) visible in search path |
Each function performs the visibility check for one type of database
object. Note that pg_table_is_visible
can also be used
with views, indexes and sequences; pg_type_is_visible
can also be used with domains. For functions and operators, an object in
the search path is visible if there is no object of the same name
and argument data type(s) earlier in the path. For operator
classes, both name and associated index access method are considered.
All these functions require object OIDs to identify the object to be checked. If you want to test an object by name, it is convenient to use the OID alias types (regclass, regtype, regprocedure, regoperator, regconfig, or regdictionary), for example:
SELECT pg_type_is_visible('myschema.widget'::regtype);
Note that it would not make much sense to test a non-schema-qualified type name in this way — if the name can be recognized at all, it must be visible.
Table 9-50 lists functions that extract information from the system catalogs.
Table 9-50. System Catalog Information Functions
| Name | Return Type | Description |
|---|---|---|
format_type(type_oid, typemod) | text | get SQL name of a data type |
pg_get_keywords() | setof record | get list of SQL keywords and their categories |
pg_get_constraintdef(constraint_oid) | text | get definition of a constraint |
pg_get_constraintdef(constraint_oid, pretty_bool) | text | get definition of a constraint |
pg_get_expr(expr_text, relation_oid) | text | decompile internal form of an expression, assuming that any Vars in it refer to the relation indicated by the second parameter |
pg_get_expr(expr_text, relation_oid, pretty_bool) | text | decompile internal form of an expression, assuming that any Vars in it refer to the relation indicated by the second parameter |
pg_get_functiondef(func_oid) | text | get definition of a function |
pg_get_function_arguments(func_oid) | text | get argument list of function's definition (with default values) |
pg_get_function_identity_arguments(func_oid) | text | get argument list to identify a function (without default values) |
pg_get_function_result(func_oid) | text | get RETURNS clause for function |
pg_get_indexdef(index_oid) | text | get CREATE INDEX command for index |
pg_get_indexdef(index_oid, column_no, pretty_bool) | text | get CREATE INDEX command for index, or definition of just one index column when column_no is not zero |
pg_get_ruledef(rule_oid) | text | get CREATE RULE command for rule |
pg_get_ruledef(rule_oid, pretty_bool) | text | get CREATE RULE command for rule |
pg_get_serial_sequence(table_name, column_name) | text | get name of the sequence that a serial or bigserial column uses |
pg_get_triggerdef (trigger_oid) | text | get CREATE [ CONSTRAINT ] TRIGGER command for trigger |
pg_get_triggerdef (trigger_oid, pretty_bool) | text | get CREATE [ CONSTRAINT ] TRIGGER command for trigger |
pg_get_userbyid(role_oid) | name | get role name with given OID |
pg_get_viewdef(view_name) | text | get underlying SELECT command for view (deprecated) |
pg_get_viewdef(view_name, pretty_bool) | text | get underlying SELECT command for view (deprecated) |
pg_get_viewdef(view_oid) | text | get underlying SELECT command for view |
pg_get_viewdef(view_oid, pretty_bool) | text | get underlying SELECT command for view |
pg_tablespace_databases(tablespace_oid) | setof oid | get the set of database OIDs that have objects in the tablespace |
pg_typeof(any) | regtype | get the data type of any value |
format_type
returns the SQL name of a data type that
is identified by its type OID and possibly a type modifier. Pass NULL
for the type modifier if no specific modifier is known.
pg_get_keywords
returns a set of records describing
the SQL keywords recognized by the server. The word column
contains the keyword. The catcode column contains a
category code: U for unreserved, C for column name,
T for type or function name, or R for reserved.
The catdesc column contains a possibly-localized string
describing the category.
pg_get_constraintdef
,
pg_get_indexdef
, pg_get_ruledef
,
and pg_get_triggerdef
, respectively reconstruct the
creating command for a constraint, index, rule, or trigger. (Note that this
is a decompiled reconstruction, not the original text of the command.)
pg_get_expr
decompiles the internal form of an
individual expression, such as the default value for a column. It can be
useful when examining the contents of system catalogs. If the expression
might contain Vars, specify the OID of the relation they refer to as the
second parameter; if no Vars are expected, zero is sufficient.
pg_get_viewdef
reconstructs the SELECT
query that defines a view. Most of these functions come in two variants,
one of which can optionally "pretty-print" the result. The
pretty-printed format is more readable, but the default format is more
likely to be interpreted the same way by future versions of
PostgreSQL; avoid using pretty-printed output for dump
purposes. Passing false for the pretty-print parameter yields
the same result as the variant that does not have the parameter at all.
pg_get_functiondef
returns a complete
CREATE OR REPLACE FUNCTION statement for a function.
pg_get_function_arguments
returns the argument list
of a function, in the form it would need to appear in within
CREATE FUNCTION.
pg_get_function_result
similarly returns the
appropriate RETURNS clause for the function.
pg_get_function_identity_arguments
returns the
argument list necessary to identify a function, in the form it
would need to appear in within ALTER FUNCTION, for
instance. This form omits default values.
pg_get_serial_sequence
returns the name of the
sequence associated with a column, or NULL if no sequence is associated
with the column. The first input parameter is a table name with
optional schema, and the second parameter is a column name. Because
the first parameter is potentially a schema and table, it is not treated
as a double-quoted identifier, meaning it is lower cased by default,
while the second parameter, being just a column name, is treated as
double-quoted and has its case preserved. The function returns a value
suitably formatted for passing to sequence functions (see Section 9.15). This association can be modified or
removed with ALTER SEQUENCE OWNED BY. (The function
probably should have been called
pg_get_owned_sequence
; its current name reflects the fact
that it's typically used with serial or bigserial
columns.)
pg_get_userbyid
extracts a role's name given
its OID.
pg_tablespace_databases
allows a tablespace to be
examined. It returns the set of OIDs of databases that have objects stored
in the tablespace. If this function returns any rows, the tablespace is not
empty and cannot be dropped. To display the specific objects populating the
tablespace, you will need to connect to the databases identified by
pg_tablespace_databases
and query their
pg_class catalogs.
pg_typeof
returns the OID of the data type of the
value that is passed to it. This can be helpful for troubleshooting or
dynamically constructing SQL queries. The function is declared as
returning regtype, which is an OID alias type (see
Section 8.16); this means that it is the same as an
OID for comparison purposes but displays as a type name. For example:
SELECT pg_typeof(33); pg_typeof ----------- integer (1 row) SELECT typlen FROM pg_type WHERE oid = pg_typeof(33); typlen -------- 4 (1 row)
The functions shown in Table 9-51 extract comments previously stored with the COMMENT command. A null value is returned if no comment could be found for the specified parameters.
Table 9-51. Comment Information Functions
| Name | Return Type | Description |
|---|---|---|
col_description(table_oid, column_number) | text | get comment for a table column |
obj_description(object_oid, catalog_name) | text | get comment for a database object |
obj_description(object_oid) | text | get comment for a database object (deprecated) |
shobj_description(object_oid, catalog_name) | text | get comment for a shared database object |
col_description
returns the comment for a table column,
which is specified by the OID of its table and its column number.
obj_description
cannot be used for table columns since
columns do not have OIDs of their own.
The two-parameter form of obj_description
returns the
comment for a database object specified by its OID and the name of the
containing system catalog. For example,
obj_description(123456,'pg_class')
would retrieve the comment for the table with OID 123456.
The one-parameter form of obj_description
requires only
the object OID. It is deprecated since there is no guarantee that
OIDs are unique across different system catalogs; therefore, the wrong
comment might be returned.
shobj_description
is used just like
obj_description
except it is used for retrieving
comments on shared objects. Some system catalogs are global to all
databases within each cluster and their descriptions are stored globally
as well.
The functions shown in Table 9-52 provide server transaction information in an exportable form. The main use of these functions is to determine which transactions were committed between two snapshots.
Table 9-52. Transaction IDs and snapshots
| Name | Return Type | Description |
|---|---|---|
txid_current() | bigint | get current transaction ID |
txid_current_snapshot() | txid_snapshot | get current snapshot |
txid_snapshot_xmin(txid_snapshot) | bigint | get xmin of snapshot |
txid_snapshot_xmax(txid_snapshot) | bigint | get xmax of snapshot |
txid_snapshot_xip(txid_snapshot) | setof bigint | get in-progress transaction IDs in snapshot |
txid_visible_in_snapshot(bigint, txid_snapshot) | boolean | is transaction ID visible in snapshot? (do not use with subtransaction ids) |
The internal transaction ID type (xid) is 32 bits wide and wraps around every 4 billion transactions. However, these functions export a 64-bit format that is extended with an "epoch" counter so it will not wrap around during the life of an installation. The data type used by these functions, txid_snapshot, stores information about transaction ID visibility at a particular moment in time. Its components are described in Table 9-53.
Table 9-53. Snapshot components
| Name | Description |
|---|---|
| xmin | Earliest transaction ID (txid) that is still active. All earlier transactions will either be committed and visible, or rolled back and dead. |
| xmax | First as-yet-unassigned txid. All txids greater than or equal to this are not yet started as of the time of the snapshot, and thus invisible. |
| xip_list | Active txids at the time of the snapshot. The list includes only those active txids between xmin and xmax; there might be active txids higher than xmax. A txid that is xmin <= txid < xmax and not in this list was already completed at the time of the snapshot, and thus either visible or dead according to its commit status. The list does not include txids of subtransactions. |
txid_snapshot's textual representation is xmin:xmax:xip_list. For example 10:20:10,14,15 means xmin=10, xmax=20, xip_list=10, 14, 15.


Item 11.
If the word that is found is the one your student wants, he or she should press enter to insert it into the document. To move up and down the list of word suggestions, use backspace or space. You may also use the back and advance thumb-keys. Press enter on a word if you choose to insert it into a document. When finished, press e with space to exit the spelling checker.


Media coverage of ISIS tends to veer from the utilitarian (covering attacks and the daily body-counts of ongoing operations against them) to the absurd, like the story of how a "smart but naive" FBI translator fell in love with a German rapper turned ISIS leader she was supposed to be investigating, and flew over to Syria to marry him (wtaf?!)
Lately, with Mosul being liberated, sobering reports have come to light of life under ISIS, and the violent campaign that freed Mosul.
Earlier this month, Scroll.in carried the story of two families and their experiences in the carnage.
Khalil then heard a loud whoosh - the sound of incoming rockets. "I recognised it," he said, having enlisted in the army for the mandatory one-year service after he completed college in 2000.
The first two rockets hit his uncle's house. The impact pushed Khalil into the basement. A third rocket landed on his friend's garage. A fourth hit a corner of his own house.
"Everything went dark," he said. "All this happened in 15 minutes."
The "Uncle" in the story is the world-renowned Civil Engineer Dr Mohamad Tyeb Al-Layla, who died in the conflict. Generally, education seems to have taken the biggest hit during the period of ISIS control. A BBC report from two days ago says:
Our lives under IS were empty and boring as we were locked in our homes.
On universities:
Most of those institutions were shut down, and education under IS was focused on teaching jihad and combat techniques. Women and men were separated and women were told to completely cover up.
This obsession with female dress was referred to in the earlier story as well:
[Hafidh's daughter, 21-year-old Nawal] brought out the dress she had to wear under ISIS: the abaya, or loose-fitting gown, gloves, socks, niqab, or face veil with slits for the eyes, and an eye-shield on top of it. "We could hardly see when we went out," she said. Any deviation was punished with fines, whiplashes and street executions.
The BBC article carries a more gruesome depiction of what the Hisba (religious police) was capable of:
I will never forget that awful day and what happened to a little seven-year-old on our street. The girl had come down to the small neighbourhood shop to buy some sweets when IS militants approached her. The girl, chatting innocently to the old shop owner, was asked by the militants where her home was. She pointed it out before running and hiding. Her parents come to see what was going on and the IS fighters lectured them about how their daughter was violating Sharia law by being alone with the seller.
After a long debate, the fighters decided the girl's punishment was to be bitten or pinched in her face or on her hands by the women of the Hisba [the religious police], or the more adequately described "monsters of Hisba".
...
The terrified mother begged them to punish her instead of her young daughter but there is no room for discussion with IS.  The monsters aggressively and repeatedly beat her and pinched her. The child was screaming until she passed out and her heart stopped.
A conflict that has lasted more than half a decade (and has involved everything from alleged chemical attacks, to drowning toddlers seeking refuge, to young Yazidi girls forced into sexual slavery) still manages to produce stories of the most senseless crimes imaginable.


| Name | Dimension |
|---|
| Parameter | Range name | Definition |
|---|---|---|
| d1 | d1_linear | Enumeration: |
| d1 | d1_exp | Enumeration: |
| k2 | k2_exp | Exponent: from: to: by: |
| D3 | D3_exp | Linear: from: to: by: |
| Simulation | Base configuration | Dimensions | Action |
|---|---|---|---|
| Submit Download results Graph | |||
| Submit Download results Graph |


$PlayerName wakes up. She isn't in her bed. She isn't even in her room. She isn't at home at all. She is in a midnight forest.
$PlayerName...
[[hides]].
[[yells for help]].What is your name?
<<textbox "$PlayerName" "">>
When you're ready, click [[Start]].Double-click this passage to edit it.Double-click this passage to edit it.


Path
Home
Contact
About us
Services
User
|
Edit
External link
Hash
Hashes
Home
Contact
About us
Services
User
|
Edit
External link


THE NEWTON BOYS (20th Century Fox) Starring: Matthew McConaughey, Ethan Hawke, Skeet Ulrich, Vincent D'Onofrio, Dwight Yoakam, Julianna Margulies. Screenplay: Richard Linklater, Claude Stanush and Clark Lee Walker, based on the book by Stanush. Producer: Anne Walker McBay. Director: Richard Linklater. MPAA Rating: PG-13 (frequent profanity, violence) Running Time: 122 minutes. Reviewed by Scott Renshaw.
I've got to be honest with you: if I were producing a "true crime" bio-pic, Richard Linklater would not be my first choice as director. In fact, I'm not sure he'd make the top fifty. This is, after all, the man who chronicled the meandering SLACKER culture, the man who followed DAZED AND CONFUSED 1970s youth in their hazy misadventures, the man who let two young lovers talk the night away BEFORE SUNRISE. Not exactly the stuff of which blazing shootouts and narrow getaways are made, is it?
As one might expect, there is an amiable, unhurried pace to Richard Linklater's THE NEWTON BOYS. The surprise is that it turns out to be one of the film's most appealing qualities. Based on Claude Stanush's non-fiction book, THE NEWTON BOYS tells the story of the most successful gang of bank robbers in American history: Texas siblings Willis (Matthew McConaughey), Jess (Ethan Hawke), Joe (Skeet Ulrich) and Dock Newton (Vincent D'Onfrio), along with their explosives expert Brentwood Glasscock (Dwight Yoakam). In the early 1920s, the five men went on an unparalleled spree throughout the West and Midwest, working at night and reaping the rewards of the last remaining easily-accessed safes in left in the country.
From the opening credits, it is clear that Linklater is aiming for an old-fashioned whimsy in his telling of the tale. The title cards are styled after silent films, with "The Players" introduced in sienna-tinted head shots, tipping their hats to the camera. THE NEWTON BOYS generally paints its protagonists as light-hearted, almost casual outlaws, polite young men who happened to be very good at robbing banks and milked one effective modus operandi for all it was worth. The script (by Linklater, Stanush and Clark Lee Walker) shows little interest in digging deep into the characters' psyches or exposing the gritty violence of the Old West's final days. Though the climactic train robbery features a bit of bloodshed, far more typical is a scene where a bungled daylight heist turns into a comedy of errors resulting in nothing worse than a couple of flesh wounds. Even the obligatory montage sequence, spinning newspaper headlines and all, is edited with a less frantic sense of urgency than you might expect.
THE NEWTON BOYS is such a lightweight bit of history that it sometimes threatens to float away entirely whenever there's not a robbery going on. The characters are energetically portrayed by the top-notch cast, but they're little more than a token trait a piece -- Joe is the Religious One, Brentwood is the Cautious One, Jess is the Cocky Drunken One, Dock is...well, the _other_ Cocky Drunken One. Only McConaughey is given a bit more to work with, playing Willis as a wronged man rationalizing his lawlessness as payback to the world.
Still, there's something undeniably charming about THE NEWTON BOYS, some intangible alchemy between the actors' obvious enjoyment of their roles and a story with no greater agenda than spotlighting a previously unknown bit of Americana. Two hours may be a bit too much time to support the substance of THE NEWTON BOYS, but if you've indulged Linklater's episodic films in the past, you probably won't be disappointed by his willingness to wander down the side roads of a story. Not a bad choice at all, as it turns out, for a story about some nice young fellas who just happen to rob banks.
On the Renshaw scale of 0 to 10 Newtonian out-laws: 7.
Visit Scott Renshaw's MoviePage http://www.inconnect.com/~renshaw/ *** Subscribe to receive new reviews directly by email! See the MoviePage for details, or reply to this message with subject line "Subscribe".
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


from __future__ import print_function, division
from .rv import (probability, expectation, density, where, given, pspace, cdf,
sample, sample_iter, random_symbols, independent, dependent,
sampling_density)
from sympy import sqrt
__all__ = ['P', 'E', 'density', 'where', 'given', 'sample', 'cdf', 'pspace',
'sample_iter', 'variance', 'std', 'skewness', 'covariance',
'dependent', 'independent', 'random_symbols', 'correlation',
'moment', 'cmoment', 'sampling_density']
def moment(X, n, c=0, condition=None, **kwargs):
"""
Return the nth moment of a random expression about c i.e. E((X-c)**n)
Default value of c is 0.
Examples
========
>>> from sympy.stats import Die, moment, E
>>> X = Die('X', 6)
>>> moment(X, 1, 6)
-5/2
>>> moment(X, 2)
91/6
>>> moment(X, 1) == E(X)
True
"""
return expectation((X - c)**n, condition, **kwargs)
[docs]def variance(X, condition=None, **kwargs):
"""
Variance of a random expression
Expectation of (X-E(X))**2
Examples
========
>>> from sympy.stats import Die, E, Bernoulli, variance
>>> from sympy import simplify, Symbol
>>> X = Die('X', 6)
>>> p = Symbol('p')
>>> B = Bernoulli('B', p, 1, 0)
>>> variance(2*X)
35/3
>>> simplify(variance(B))
p*(-p + 1)
"""
return cmoment(X, 2, condition, **kwargs)
def standard_deviation(X, condition=None, **kwargs):
"""
Standard Deviation of a random expression
Square root of the Expectation of (X-E(X))**2
Examples
========
>>> from sympy.stats import Bernoulli, std
>>> from sympy import Symbol, simplify
>>> p = Symbol('p')
>>> B = Bernoulli('B', p, 1, 0)
>>> simplify(std(B))
sqrt(p*(-p + 1))
"""
return sqrt(variance(X, condition, **kwargs))
std = standard_deviation
[docs]def covariance(X, Y, condition=None, **kwargs):
"""
Covariance of two random expressions
The expectation that the two variables will rise and fall together
Covariance(X,Y) = E( (X-E(X)) * (Y-E(Y)) )
Examples
========
>>> from sympy.stats import Exponential, covariance
>>> from sympy import Symbol
>>> rate = Symbol('lambda', positive=True, real=True, finite=True)
>>> X = Exponential('X', rate)
>>> Y = Exponential('Y', rate)
>>> covariance(X, X)
lambda**(-2)
>>> covariance(X, Y)
0
>>> covariance(X, Y + rate*X)
1/lambda
"""
return expectation(
(X - expectation(X, condition, **kwargs)) *
(Y - expectation(Y, condition, **kwargs)),
condition, **kwargs)
def correlation(X, Y, condition=None, **kwargs):
"""
Correlation of two random expressions, also known as correlation
coefficient or Pearson's correlation
The normalized expectation that the two variables will rise
and fall together
Correlation(X,Y) = E( (X-E(X)) * (Y-E(Y)) / (sigma(X) * sigma(Y)) )
Examples
========
>>> from sympy.stats import Exponential, correlation
>>> from sympy import Symbol
>>> rate = Symbol('lambda', positive=True, real=True, finite=True)
>>> X = Exponential('X', rate)
>>> Y = Exponential('Y', rate)
>>> correlation(X, X)
1
>>> correlation(X, Y)
0
>>> correlation(X, Y + rate*X)
1/sqrt(1 + lambda**(-2))
"""
return covariance(X, Y, condition, **kwargs)/(std(X, condition, **kwargs)
* std(Y, condition, **kwargs))
def cmoment(X, n, condition=None, **kwargs):
"""
Return the nth central moment of a random expression about its mean
i.e. E((X - E(X))**n)
Examples
========
>>> from sympy.stats import Die, cmoment, variance
>>> X = Die('X', 6)
>>> cmoment(X, 3)
0
>>> cmoment(X, 2)
35/12
>>> cmoment(X, 2) == variance(X)
True
"""
mu = expectation(X, condition, **kwargs)
return moment(X, n, mu, condition, **kwargs)
def smoment(X, n, condition=None, **kwargs):
"""
Return the nth Standardized moment of a random expression i.e.
E( ((X - mu)/sigma(X))**n )
Examples
========
>>> from sympy.stats import skewness, Exponential, smoment
>>> from sympy import Symbol
>>> rate = Symbol('lambda', positive=True, real=True, finite=True)
>>> Y = Exponential('Y', rate)
>>> smoment(Y, 4)
9
>>> smoment(Y, 4) == smoment(3*Y, 4)
True
>>> smoment(Y, 3) == skewness(Y)
True
"""
sigma = std(X, condition, **kwargs)
return (1/sigma)**n*cmoment(X, n, condition, **kwargs)
def skewness(X, condition=None, **kwargs):
"""
Measure of the asymmetry of the probability distribution
Positive skew indicates that most of the values lie to the right of
the mean
skewness(X) = E( ((X - E(X))/sigma)**3 )
Examples
========
>>> from sympy.stats import skewness, Exponential, Normal
>>> from sympy import Symbol
>>> X = Normal('X', 0, 1)
>>> skewness(X)
0
>>> rate = Symbol('lambda', positive=True, real=True, finite=True)
>>> Y = Exponential('Y', rate)
>>> skewness(Y)
2
"""
return smoment(X, 3, condition, **kwargs)
P = probability
E = expectation


My Employee Details
Name
Age
Designation
Salary
Name
Age
Designation
salary
{{company.name}}
{{company.age}}
{{company.designation}}
{{company.salary}}
To assign Values
Name
Age
Designation
Salary


library_books
view_module
view_list
search
close
view_list
Master's Project Archive
Featured Examples
{{ project.first_name }} {{ project.last_name }}
{{ project.year }}
{{ project.title }}
{{ project.question }}
library_books
photo_library
description
speaker_notes
Full List
find_in_page
Search Projects
Title
Author
Year
{{ project.title }}
{{ project.first_name }} {{ project.last_name }}
{{ project.year }}


 Also you might know the answer already. The problem was about the std::map or say std::multimap, both of them are special type of containers who can sort the items by a comparing function pointer(or a built-in one like std::less). They sort it when you are inserting a new item, that's of course so handy, because you don't wanna call a sorting function every time you need to! Actually you will never explicitly call any sorting function on your map or multimap, coz it's already sorted! Now here's my problem-
Say, I have a map like this -
D - 1
D - 2
B - 3
A - 4
Now I need to sort them like this -
A - 4
B - 3
D - 2
D - 1
Here's the explanation of this sorting- first elements(A,B,D) will be sorted in ascending order A --> B --> D regardless of the second element, secondly if the first elements are equal (i.e 2 Ds here) then they will be sorted as the descending order of their corresponding second element.
Using std::multimap will end-up with only the first sorting part, so I took advantage of templates and inheritances. Here's the code -
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <iostream>
#include <utility>
#include <set>
using namespace std;
template <class _A, class _B, class _Compare=less<_A> >
class MMap : public set < pair< _A, _B >, _Compare >
{
public :
MMap():set< pair< _A, _B >, _Compare >(){};
~MMap(){};
};
template< typename InPair >
struct MMapComp{
bool operator() (InPair a , InPair b){
if( a.first == b.first ) return a.second > b.second;
else
return a.first < b.first;
}
};
int main(int argc, char ** argv)
{
MMap<char,int,MMapComp< pair<char , int > > > test;
test.insert(make_pair('D',1));
test.insert(make_pair('D',2));
test.insert(make_pair('B',3));
test.insert(make_pair('A',4));
for( MMap<char,int >::iterator it = test.begin(); it != test.end(); it++ )
cout << (*it).first << "\t" << (*it).second << endl;
return 0;
}
| |
And here's the output -
Ok, I apologize for my undocumented code :) But it's not so hard to read actually. Is it ?


public abstract class ComposableUnitPeriod
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
NODE_INSIDE_SEGMENT
Node is Inside the Period
|
static int |
NODE_LEFT_OF_SEGMENT
Node is to the Left of the Period
|
static int |
NODE_RIGHT_OF_SEGMENT
Node is to the Right of the Period
|
| Modifier and Type | Method and Description |
|---|---|
int |
accrualCompoundingRule()
Retrieve the Accrual Compounding Rule
|
java.lang.String |
accrualDC()
Retrieve the Accrual Day Count
|
double |
accrualDCF(int iAccrualEnd)
Get the Period Accrual Day Count Fraction to an Accrual End Date
|
boolean |
accrualEOMAdjustment()
Retrieve the Accrual EOM Adjustment Flag
|
abstract double |
baseRate(CurveSurfaceQuoteContainer csqc)
Get the Period Base Coupon Rate
|
abstract double |
basis()
Get the Period Coupon Basis
|
java.lang.String |
calendar()
Retrieve the Calendar
|
abstract java.lang.String |
couponCurrency()
Get the Period Coupon Currency
|
java.lang.String |
couponDC()
Retrieve the Coupon Day Count
|
boolean |
couponDCFOffOfFreq()
Retrieve the Flag indicating whether Coupon DCF is computed off of the DCF Flag
|
boolean |
couponEOMAdjustment()
Retrieve the Coupon EOM Adjustment Flag
|
int |
dateLocation(int iDateNode)
Place the Date Node Location in Relation to the Segment Location
|
int |
endDate()
Retrieve the Accrual End Date
|
int |
freq()
Retrieve the Coupon Frequency
|
double |
fullCouponDCF()
Retrieve the Period Full Coupon DCF
|
double |
fullCouponRate(CurveSurfaceQuoteContainer csqc)
Get the Period Full Coupon Rate
|
int |
startDate()
Retrieve the Accrual Start Date
|
java.lang.String |
tenor()
Convert the Coupon Frequency into a Tenor
|
public static final int NODE_LEFT_OF_SEGMENT
public static final int NODE_INSIDE_SEGMENT
public static final int NODE_RIGHT_OF_SEGMENT
public int startDate()
public int endDate()
public int freq()
public java.lang.String couponDC()
public boolean couponEOMAdjustment()
public java.lang.String accrualDC()
public boolean accrualEOMAdjustment()
public boolean couponDCFOffOfFreq()
public java.lang.String calendar()
public int accrualCompoundingRule()
public double fullCouponDCF()
public java.lang.String tenor()
public int dateLocation(int iDateNode)
iDateNode
- The Node Ordinatepublic double accrualDCF(int iAccrualEnd) throws java.lang.Exception
iAccrualEnd
- Accrual End Datejava.lang.Exception
- Thrown if Inputs are Invalid, or if the Date does not lie within the
Periodpublic double fullCouponRate(CurveSurfaceQuoteContainer csqc) throws java.lang.Exception
csqc
- The Market Curve and Surfacejava.lang.Exception
- Thrown if the Full Coupon Rate cannot be calculatedpublic abstract double baseRate(CurveSurfaceQuoteContainer csqc) throws java.lang.Exception
csqc
- The Market Curve and Surfacejava.lang.Exception
- Thrown if the base Coupon Rate cannot be calculatedpublic abstract double basis()
public abstract java.lang.String couponCurrency()


Step 1: Cut each eggplant into about ½-inch (1-cm) thick round slices.
Step 2: Arrange the slices in a single layer on a baking sheet lined with paper towels.
Step 3: Sprinkle the eggplant with half of the coarse salt. Flip the slices over and sprinkle with the rest of the salt.
Step 4: Put another baking sheet on top of the eggplant and place something heavy, like a cast-iron skillet, on the top baking sheet to help release moisture from the eggplant. Let sit for 30 minutes.
Step 5: Uncover the eggplant slices and pat dry with paper towels. Brush most of the salt from the eggplant with a paper towel, then transfer to a medium bowl. Set aside.
Step 6: In a separate medium bowl, combine the flour, oregano, basil, garlic powder, and pepper. Mix well.
Step 7: Heat the vegetable oil in a large frying pan until it reaches 375°F (190°C).
Step 8: Remove the pizza from the oven and place on a cutting board. Let pizza rest for 1-2 Coat each eggplant slice in the flour mixture, shaking off any excess flour.you cut it. Repeat process with remaining dough.
Step 9: Preheat the oven to 350°F (180°C).
Step 10: Fry the eggplant in batches until golden brown on both sides, 2-3 minutes per side. Drain on a paper towel-lined baking sheet and pat dry using more paper towels to absorb excess oil.
Step 11: Pour about 1 cup (260 g) of marinara sauce into a 2½-quart (2 L) baking dish and spread evenly to cover the bottom of the dish.
Step 12: Add about 8 eggplant slices (it’s okay if they overlap) and cover with ½ cup (130 g) of marinara. Sprinkle with a third of the fresh basil, then top with about a third of the shredded mozzarella and Parmesan. Repeat to make 2 more layers. Finish with the fresh mozzarella cheese and a final sprinkling of Parmesan.
Step 13: Bake for 30 minutes, until the mozzarella is bubbling and golden brown.
Step 14: Let cool for 10 minutes, then serve garnished with fresh basil.
Step 15: Serve and Enjoy!


%rebase('osnova.html', naslov='Flourish and Blotts')
If you came here in hopes to discover that there are more than 7 Harry Potter books, we unfortunately have to inform you, that some things are not possible even with magic.
But luckily there are many other magical books and you have come to the right place to find them. On left side of page there is a bookfinder which you can use to find books of preferred length and genre, to find books that are part of series or if you lack time, the ones that are not. There is also a list of keywords from which you can choose all that you want.
However if you are looking for a specific book, keyword or author you can use the two search bars at the bottom.


British PM Johnson will probably win this uninspiring election, Farage says
PETERBOROUGH, England (Reuters) - British Prime Minister Boris Johnson will probably win the Dec. 12 election with a small majority but the campaign has so far been uninspiring with a host of unrealistic promises on both sides, Brexit Party leader Nigel Farage said on Tuesday.
“The one prediction I am going to make is that it is going to be a low turnout unless parties like us can inspire people to go out and vote for change,” Farage told supporters in Peterborough, a cathedral city in eastern England.
 It does look like he’ll probably get a small majority,” he said, adding that it was one of the most uninspiring elections he could remember.
“I cannot think of any campaign like this that so far is failing to inspire on such an extraordinary scale,” he said. “Everyday we get promises, 100 billion for this, 200 billion for that,” Farage said.
“We’ve heard it all before. My impression is that nobody believes a single word they are being told.”


About the Project
Over the last few years, low-cost commodity sensors have hit the markets allowing — for the first time — the ability to measure hyperlocal air quality conditions outside of our homes.
At the University of Utah, we are building infrastructure that utilizes these new sensors to create accurate measurements of air quality microclimates. Our Outdoor Air Quality project leverages existing government and community-based air quality efforts to build a dense network of sensors across Salt Lake City.
This project utilizes our research in sensor design, air quality science, computational modeling, and communication of data; furthermore, it relies on citizens to engage, promote, and facilitate science. We are currently looking for Salt Lake City residents to be part of building our outdoor network by hosting sensors at their homes. Want to get involved? Head over to the sign in tab to sign-up.
This work is generously funded by grants from the National Science Foundation, the National Institutes of Health, Utah Ignite, Lawrence T. & Janet T. Dee Foundation and UCAIR.
Tech Stack
Our backend is written in Python using the mini web framework Flask! Flask - web development, one drop at a time. We felt that.
The web server is hosted by Google Cloud.
In order to develop for both Android and Apple, we chose to go with React Native.
Our front end is HTLM, CSS, and Vanialla Javascript. No framework used!
Device Firmware is written with C.
Each device communicates with our server using MQTT protocol.
InfluxDB is a time series database that works perfectly with IOT devices.


Login
Register
User Name/ Email
Password
Remember Me
Forgot my password?
Enter Email
Submit
Cancel
I agree to the
'EULA'
and
'Privacy Policy'
.
Register


#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Authors:
# - Paul Nilsson<EMAIL_ADDRESS>2018
# Note: The Pilot 2 modules that need to record timing measurements, can do so using the add_to_pilot_timing() function.
# When the timing measurements need to be recorded, the high-level functions, e.g. get_getjob_time(), can be used.
# Structure of pilot timing dictionary:
# { job_id: { <timing_constant_1>: <time measurement in seconds since epoch>, .. }
# job_id = 0 means timing information from wrapper. Timing constants are defined in pilot.util.constants.
# Time measurement are time.time() values. The float value will be converted to an int as a last step.
import os
import time
from pilot.util.config import config
from pilot.util.constants import PILOT_START_TIME, PILOT_PRE_GETJOB, PILOT_POST_GETJOB, PILOT_PRE_SETUP, \
PILOT_POST_SETUP, PILOT_PRE_STAGEIN, PILOT_POST_STAGEIN, PILOT_PRE_PAYLOAD, PILOT_POST_PAYLOAD, PILOT_PRE_STAGEOUT,\
PILOT_POST_STAGEOUT, PILOT_PRE_FINAL_UPDATE, PILOT_POST_FINAL_UPDATE, PILOT_END_TIME, PILOT_MULTIJOB_START_TIME
from pilot.util.filehandling import read_json, write_json
#from pilot.util.mpi import get_ranks_info
import logging
logger = logging.getLogger(__name__)
[docs]def read_pilot_timing():
"""
Read the pilot timing dictionary from file.
:return: pilot timing dictionary (json dictionary).
"""
pilot_timing_dictionary = {}
path = os.path.join(os.environ.get('PILOT_HOME', ''), config.Pilot.timing_file)
if os.path.exists(path):
pilot_timing_dictionary = read_json(path)
return pilot_timing_dictionary
[docs]def write_pilot_timing(pilot_timing_dictionary):
"""
Write the given pilot timing dictionary to file.
:param pilot_timing_dictionary:
:return:
"""
timing_file = config.Pilot.timing_file
#rank, max_ranks = get_ranks_info()
#if rank is not None:
# timing_file += '_{0}'.format(rank)
path = os.path.join(os.environ.get('PILOT_HOME', ''), timing_file)
if write_json(path, pilot_timing_dictionary):
logger.debug('updated pilot timing dictionary: %s' % path)
else:
logger.warning('failed to update pilot timing dictionary: %s' % path)
[docs]def add_to_pilot_timing(job_id, timing_constant, time_measurement, args, store=False):
"""
Add the given timing contant and measurement got job_id to the pilot timing dictionary.
:param job_id: PanDA job id (string).
:param timing_constant: timing constant (string).
:param time_measurement: time measurement (float).
:param args: pilot arguments.
:param store: if True, write timing dictionary to file. False by default.
:return:
"""
if args.timing == {}:
args.timing[job_id] = {timing_constant: time_measurement}
else:
if job_id not in args.timing:
args.timing[job_id] = {}
args.timing[job_id][timing_constant] = time_measurement
# update the file
if store:
write_pilot_timing(args.timing)
[docs]def get_initial_setup_time(job_id, args):
"""
High level function that returns the time for the initial setup.
The initial setup time is measured from PILOT_START_TIME to PILOT_PRE_GETJOB.
:param job_id: PanDA job id (string).
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_difference(job_id, PILOT_MULTIJOB_START_TIME, PILOT_PRE_GETJOB, args)
[docs]def get_getjob_time(job_id, args):
"""
High level function that returns the time for the getjob operation for the given job_id.
:param job_id: PanDA job id (string).
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_difference(job_id, PILOT_PRE_GETJOB, PILOT_POST_GETJOB, args)
[docs]def get_setup_time(job_id, args):
"""
High level function that returns the time for the setup operation for the given job_id.
:param job_id: PanDA job id (string).
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_difference(job_id, PILOT_PRE_SETUP, PILOT_POST_SETUP, args)
[docs]def get_stagein_time(job_id, args):
"""
High level function that returns the time for the stage-in operation for the given job_id.
:param job_id: PanDA job id (string).
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_difference(job_id, PILOT_PRE_STAGEIN, PILOT_POST_STAGEIN, args)
[docs]def get_stageout_time(job_id, args):
"""
High level function that returns the time for the stage-out operation for the given job_id.
:param job_id: PanDA job id (string).
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_difference(job_id, PILOT_PRE_STAGEOUT, PILOT_POST_STAGEOUT, args)
[docs]def get_payload_execution_time(job_id, args):
"""
High level function that returns the time for the payload execution for the given job_id.
:param job_id: PanDA job id (string).
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_difference(job_id, PILOT_PRE_PAYLOAD, PILOT_POST_PAYLOAD, args)
[docs]def get_final_update_time(job_id, args):
"""
High level function that returns the time for execution the final update for the given job_id.
:param job_id: PanDA job id (string).
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_difference(job_id, PILOT_PRE_FINAL_UPDATE, PILOT_POST_FINAL_UPDATE, args)
[docs]def get_total_pilot_time(job_id, args):
"""
High level function that returns the end time for the given job_id.
This means the wall time that has passed from the start of the pilot until after the last job update.
:param job_id: PanDA job id (string).
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_difference(job_id, PILOT_START_TIME, PILOT_END_TIME, args)
[docs]def get_postgetjob_time(job_id, args):
"""
Return the post getjob time.
:param job_id: job object.
:param args: pilot arguments.
:return: post getjob time measurement (int). In case of failure, return None.
"""
time_measurement = None
timing_constant = PILOT_POST_GETJOB
if job_id in args.timing:
# extract time measurements
time_measurement_dictionary = args.timing.get(job_id, None)
if time_measurement_dictionary:
time_measurement = time_measurement_dictionary.get(timing_constant, None)
if not time_measurement:
logger.warning('failed to extract time measurement %s from %s (no such key)' % (timing_constant, time_measurement_dictionary))
return time_measurement
[docs]def get_time_measurement(timing_constant, time_measurement_dictionary, timing_dictionary, job_id):
"""
Return a requested time measurement from the time measurement dictionary, read from the pilot timing file.
:param timing_constant: timing constant (e.g. PILOT_MULTIJOB_START_TIME)
:param time_measurement_dictionary: time measurement dictionary, extracted from pilot timing dictionary.
:param timing_dictionary: full timing dictionary from pilot timing file.
:param job_id: PanDA job id (string).
:return: time measurement (float).
"""
time_measurement = time_measurement_dictionary.get(timing_constant, None)
if not time_measurement:
# try to get the measurement for the PILOT_MULTIJOB_START_TIME dictionary
i = '0' if timing_constant == PILOT_START_TIME else '1'
time_measurement_dictionary_0 = timing_dictionary.get(i, None)
if time_measurement_dictionary_0:
time_measurement = time_measurement_dictionary_0.get(timing_constant, None)
else:
logger.warning('failed to extract time measurement %s from %s (no such key)' % (timing_constant, time_measurement_dictionary))
return time_measurement
[docs]def get_time_since_start(args):
"""
Return the amount of time that has passed since the pilot was launched.
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_since('0', PILOT_START_TIME, args)
[docs]def get_time_since_multijob_start(args):
"""
Return the amount of time that has passed since the last multi job was launched.
:param args: pilot arguments.
:return: time in seconds (int).
"""
return get_time_since('1', PILOT_MULTIJOB_START_TIME, args)
[docs]def get_time_since(job_id, timing_constant, args):
"""
Return the amount of time that has passed since the time measurement of timing_constant.
:param job_id: PanDA job id (string).
:param timing_constant:
:param args: pilot arguments.
:return: time in seconds (int).
"""
diff = 0
if job_id in args.timing:
# extract time measurements
time_measurement_dictionary = args.timing.get(job_id, None)
if time_measurement_dictionary:
time_measurement = get_time_measurement(timing_constant, time_measurement_dictionary,
args.timing, job_id)
if time_measurement:
diff = time.time() - time_measurement
else:
logger.warning('failed to extract time measurement dictionary from %s' % str(args.timing))
else:
logger.warning('job id %s not found in timing dictionary' % job_id)
return diff
[docs]def get_time_difference(job_id, timing_constant_1, timing_constant_2, args):
"""
Return the positive time difference between the given constants.
The order is not important and a positive difference is always returned. The function collects the time measurements
corresponding to the given timing constants from the pilot timing file.
The job_id is used internally as a dictionary key. The given timing constants and their timing measurements, belong
to the given job_id.
Structure of pilot timing dictionary:
{ job_id: { <timing_constant_1>: <time measurement in seconds since epoch>, .. }
job_id = 0 means timing information from wrapper. Timing constants are defined in pilot.util.constants.
Time measurement are time.time() values. The float value will be converted to an int as a last step.
:param job_id: PanDA job id (string).
:param timing_constant_1:
:param timing_constant_2:
:param args: pilot arguments.
:return: time difference in seconds (int).
"""
diff = 0
if job_id in args.timing:
# extract time measurements
time_measurement_dictionary = args.timing.get(job_id, None)
if time_measurement_dictionary:
time_measurement_1 = get_time_measurement(timing_constant_1, time_measurement_dictionary,
args.timing, job_id)
time_measurement_2 = get_time_measurement(timing_constant_2, time_measurement_dictionary,
args.timing, job_id)
if time_measurement_1 and time_measurement_2:
diff = time_measurement_2 - time_measurement_1
else:
logger.warning('failed to extract time measurement dictionary from %s' % str(args.timing))
else:
logger.warning('job id %s not found in timing dictionary' % job_id)
# always return a positive number
if diff < 0:
diff = -diff
# convert to int as a last step
try:
diff = int(diff)
except Exception as e:
logger.warning('failed to convert %s to int: %s (will reset to 0)' % (diff, e))
diff = 0
return diff
[docs]def timing_report(job_id, args):
"""
Write a timing report to the job log and return relevant timing measurements.
:param job_id: job id (string).
:param args: pilot arguments.
:return: time_getjob, time_stagein, time_payload, time_stageout, time_total_setup (integer strings).
"""
# collect pilot timing data
time_getjob = get_getjob_time(job_id, args)
time_initial_setup = get_initial_setup_time(job_id, args)
time_setup = get_setup_time(job_id, args)
time_total_setup = time_initial_setup + time_setup
time_stagein = get_stagein_time(job_id, args)
time_payload = get_payload_execution_time(job_id, args)
time_stageout = get_stageout_time(job_id, args)
logger.info('.' * 30)
logger.info('. Timing measurements:')
logger.info('. get job = %d s' % time_getjob)
logger.info('. initial setup = %d s' % time_initial_setup)
logger.info('. payload setup = %d s' % time_setup)
logger.info('. total setup = %d s' % time_total_setup)
logger.info('. stage-in = %d s' % time_stagein)
logger.info('. payload execution = %d s' % time_payload)
logger.info('. stage-out = %d s' % time_stageout)
logger.info('.' * 30)
return time_getjob, time_stagein, time_payload, time_stageout, time_total_setup
[docs]def time_stamp():
"""
Return ISO-8601 compliant date/time format
:return: time information
"""
tmptz = time.timezone
sign_str = '+'
if tmptz > 0:
sign_str = '-'
tmptz_hours = int(tmptz / 3600)
return str("%s%s%02d:%02d" % (time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime()), sign_str, abs(tmptz_hours),
int(tmptz / 60 - tmptz_hours * 60)))
[docs]def get_elapsed_real_time(t0=None):
"""
Return a time stamp corresponding to the elapsed real time (since t0 if requested).
The function uses os.times() to get the current time stamp.
If t0 is provided, the returned time stamp is relative to t0. t0 is assumed to be an os.times() tuple.
:param t0: os.times() tuple for the t0 time stamp.
:return: time stamp (int).
"""
if t0 and type(t0) == tuple:
try:
_t0 = int(t0[4])
except Exception as e:
logger.warning('unknown timing format for t0: %s' % e)
_t0 = 0
else:
_t0 = 0
t = int(os.times()[4])
return t - _t0


We couldn't find your immigration application
We couldn't find an immigration application with the details you provided. Please check the details and try again.
If the problems continue, contact UKVI for help.
@() @main("GOV.UK - The best place to find government services and information") {
We couldn't find an immigration application with the details you provided. Please check the details and try again.
If the problems continue, contact UKVI for help.