Dashboard
Property Management
Add Property
View Properties
Listing Requests To Rent/For Sale
View Pending Submissions
View Approval Requests
Help Us Help You
View/Edit Amenities & Features
Contacts Management
Add Contacts
View Contacts
Manage Type of Contacts
Appointment Management
Add Appointment
View Appointments
Payment Management
Transaction Reports
Pricing Comparison
Contents Management
Bookings Management
Check In/Check Out
Payments Due
Contracts
Reports
Listings
Total Number of days available
ROI per property per year
Total Listings in Database
Average Commission per Short_Long_Sale
Properties under Management
Total Short Lets in Database
Custom Total Listings in Database
Sales
Website
Top 5 Most searched Locations
Office
Investment Portfolio
Settings
View Users
Toggle navigation
Jone William
Last Login
20-March-2017 2:15pm
User Profile
Settings
Logout
Appointment Management
Home
Appointment Management
Add Appointment
Listing ID
Search
Customer ID
Property Type
Property Address
Postcode
Locality
Country
Select Country
Market Status
Recent Reduced
Customer Name & Surename
Prospector
Inspector
Agent
Price
Notes & Comment
Remarks
Choose Date
Time
Client Details
Customer ID
Name & Surename
Contact No
Purpose
Viewing
Comments
Appointment Date
Listing Id
Appointment Time
Agent
APT58493
10-04-2017
17:30
Tom Brady
APT58493
08-04-2017
14:15
Aaron Rodgers
APT58490
05-04-2017
12:05
Peyton Manning
APT58481
31-03-2017
11:45
Frank Gifford


Home
Accomodations
Activities
Travel Arrangements
Pictures
Contact Us
Here is a list of ways you probably have already thought of getting here.>


Internal implementation objects used by the rule system interpreters and compilers. Note that the class in here are not intended for general use. In particular, they are primarily stucts rather than correctly encasulated objects (i.e. they access each other's fields directly in some cases, instead of indirectly through accessor methods).


001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.commons.math.estimation; 019 020 import java.io.Serializable; 021 022 /** 023 * This class represents measurements in estimation problems. 024 * 025 *
This abstract class implements all the methods needed to handle 026 * measurements in a general way. It defines neither the {@link 027 * #getTheoreticalValue getTheoreticalValue} nor the {@link 028 * #getPartial getPartial} methods, which should be defined by 029 * sub-classes according to the specific problem.
 030 * 031 *
The {@link #getTheoreticalValue getTheoreticalValue} and {@link 032 * #getPartial getPartial} methods must always use the current 033 * estimate of the parameters set by the solver in the problem. These 034 * parameters can be retrieved through the {@link 035 * EstimationProblem#getAllParameters 036 * EstimationProblem.getAllParameters} method if the measurements are 037 * independent of the problem, or directly if they are implemented as 038 * inner classes of the problem.
 039 * 040 *
The instances for which the ignored flag is set 041 * through the {@link #setIgnored setIgnored} method are ignored by the 042 * solvers. This can be used to reject wrong measurements at some 043 * steps of the estimation.
 044 * 045 * @see EstimationProblem 046 * 047 * @version $Revision: 811827 $ $Date: 2009-09-06 17:32:50 +0200 (dim. 06 sept. 2009) $ 048 * @since 1.2 049 * @deprecated as of 2.0, everything in package org.apache.commons.math.estimation has 050 * been deprecated and replaced by package org.apache.commons.math.optimization.general 051 */ 052 053 @Deprecated 054 public abstract class WeightedMeasurement implements Serializable { 055 056 /** Serializable version identifier. */ 057 private static final long serialVersionUID =<PHONE_NUMBER>796901941L; 058 059 /** Measurement weight. */ 060 private final double weight; 061 062 /** Value of the measurements. */ 063 private final double measuredValue; 064 065 /** Ignore measurement indicator. */ 066 private boolean ignored; 067 068 /** 069 * Simple constructor. 070 * Build a measurement with the given parameters, and set its ignore 071 * flag to false. 072 * @param weight weight of the measurement in the least squares problem 073 * (two common choices are either to use 1.0 for all measurements, or to 074 * use a value proportional to the inverse of the variance of the measurement 075 * type) 076 * 077 * @param measuredValue measured value 078 */ 079 public WeightedMeasurement(double weight, double measuredValue) { 080 this.weight = weight; 081 this.measuredValue = measuredValue; 082 ignored = false; 083 } 084 085 /** Simple constructor. 086 * 087 * Build a measurement with the given parameters 088 * 089 * @param weight weight of the measurement in the least squares problem 090 * @param measuredValue measured value 091 * @param ignored true if the measurement should be ignored 092 */ 093 public WeightedMeasurement(double weight, double measuredValue, 094 boolean ignored) { 095 this.weight = weight; 096 this.measuredValue = measuredValue; 097 this.ignored = ignored; 098 } 099 100 /** 101 * Get the weight of the measurement in the least squares problem 102 * 103 * @return weight 104 */ 105 public double getWeight() { 106 return weight; 107 } 108 109 /** 110 * Get the measured value 111 * 112 * @return measured value 113 */ 114 public double getMeasuredValue() { 115 return measuredValue; 116 } 117 118 /** 119 * Get the residual for this measurement 120 * The residual is the measured value minus the theoretical value. 121 * 122 * @return residual 123 */ 124 public double getResidual() { 125 return measuredValue - getTheoreticalValue(); 126 } 127 128 /** 129 * Get the theoretical value expected for this measurement 130 *
The theoretical value is the value expected for this measurement 131 * if the model and its parameter were all perfectly known.
 132 *
The value must be computed using the current estimate of the parameters 133 * set by the solver in the problem.
 134 * 135 * @return theoretical value 136 */ 137 public abstract double getTheoreticalValue(); 138 139 /** 140 * Get the partial derivative of the {@link #getTheoreticalValue 141 * theoretical value} according to the parameter. 142 *
The value must be computed using the current estimate of the parameters 143 * set by the solver in the problem.
 144 * 145 * @param parameter parameter against which the partial derivative 146 * should be computed 147 * @return partial derivative of the {@link #getTheoreticalValue 148 * theoretical value} 149 */ 150 public abstract double getPartial(EstimatedParameter parameter); 151 152 /** 153 * Set the ignore flag to the specified value 154 * Setting the ignore flag to true allow to reject wrong 155 * measurements, which sometimes can be detected only rather late. 156 * 157 * @param ignored value for the ignore flag 158 */ 159 public void setIgnored(boolean ignored) { 160 this.ignored = ignored; 161 } 162 163 /** 164 * Check if this measurement should be ignored 165 * 166 * @return true if the measurement should be ignored 167 */ 168 public boolean isIgnored() { 169 return ignored; 170 } 171 172 }


Filter
Interested
X
Budget
Roommates
Bedrooms
Occupation Location
My location
Find me a roommate
X
Previous
Next
Location
2 Roommates
3 Beds
3000 QAR/Month
30 minutes away from work
Services close by
Amenities:
Posted by: Ziyad Mahmoud


Animal, Vegetable, or Mineral?
CONGRATS!
You beat the game!
×
Score:
0
Main
Animal
Vegetable
Mineral


- parentAbsPath - Static variable in class _157239n.Final_Simple_Net
-
The absolute parent directory of the sketch
- pl(String, String) - Method in class _157239n.Rect
-
Prints the Rect out onto the console with some additional String at both ends.
- pl() - Method in class _157239n.Rect
-
Prints the Rectangle out onto the console.
- print() - Method in class _157239n.Matrix
-
Print the matrix out into the console
- print(String) - Method in class _157239n.Matrix
-
Print the matrix out into a file
- processSpecificDisplay() - Method in class _157239n.Work
-
Specifies whether to leave the displayed graphics to the inner threads.
- progressesLength() - Method in class _157239n.ProgressThread
-
Returns the size of the number of progresses in operation (currently)
- progressesSize() - Method in class _157239n.ProgressThread
-
Returns the size of the number of progresses in operation (currently).
- progressLength() - Method in class _157239n.ProgressThread
-
Returns the size of the number of progresses in operation (currently)
- progressSize() - Method in class _157239n.ProgressThread
-
Returns the size of the number of progresses in operation (currently).
- ProgressThread - Class in _157239n
-
Represents a complex progress thread.
- PVectorSize() - Method in class _157239n.InfoPacket
-
Returns the current size of the PVector array.


What lurks in the forest?
Blair Witch comes to PlayStation 4, set to release on December 3
Horror twists its way onto PS4.
by Samuel TolbertWhat you need to know
- Blair Witch is a first-person horror game from Bloober Team.
- Blair Witch released on Xbox One and PC earlier this year.
- Bloober Team announced today that Blair Witch is coming to PlayStation 4 on December 3.
- A new DLC pack will be released for all versions of the game, adding new skins for Bullet and more.
Horror title Blair Witch is making its way over to PlayStation 4, Bloober Team and Lionsgate Games have confirmed. This version of the game coincides with a DLC pack that will be available on all versions of the game called the Good Boy Pack. This DLC, appropriately enough, adds new skins for the dog Bullet, as well as new animations, cell phone games and wallpapers. You can check out the announcement trailer for the PlayStation 4 version of the game below.
Blair Witch is set to release digitally on December 3 on PlayStation 4 and will cost $29.90 USD. A physical release is planned but does not yet have a release date.
Blair Witch is set in 1996, as a young boy disappears in the Black Hills Forest near Burkittsville, Maryland. Taking on the role of a police officer named Ellis, players have to work with their dog bullet to try and find the lost kid while navigating the dangers that await in the woods.
If you'd like to learn more about Blair Witch, you can check out the review of the Xbox One version on Windows Central. Brendan Lowry, staff writer for Windows Central, noted that "While Blair Witch certainly has its issues, it's a very good horror game. It's also a title that stays true to the source material, while bringing some new concepts to the table."

- Best keyboards for PlayStation 4 in 2019
- Best PlayStation 4 Games
We may earn a commission for purchases using our links. Learn more.


Hey! Welcome to the Loreto College Crumlin TY Newsletter. What is TY? TY is a one year programme after your Junior Cycle filled with opportunities to have new experiences and develop new skills. Doing this through work experiences, musicals and TY Trips. Here, we can keep you up to date on your upcoming trips, read blog posts from your fellow students, or comment some suggestions on what you think we should do next in TY!


Lila’s objective is to get the best possible outcome today, but someone else is involved… No one except the second player will know their intentions. They may help Lila, but they may want to ruin her day instead. The second player will get to delete a choice out of the ones available to accomplish what they want, leaving only the remaining for Lila. Make the best possible choices for you.
Lila Player 2


The vpx_codec_encode() function is at the core of the decode loop. It processes raw images passed by the application, producing packets of compressed data. The deadline
parameter controls the amount of time in microseconds the encoder should spend working on the frame. For more information on the deadline
parameter, see Deadline.


{% extends "base.html" %} {% load i18n crispy_forms_tags django_bootstrap_breadcrumbs %} {% block breadcrumbs %}{{ block.super }} {% breadcrumb "Signup" "account_signup" %} {% endblock breadcrumbs %} {% block container%}
{% trans 'Just look at it as a gift. Or maybe Michael is stinking-rich and does not know how to make a profit out of this page.' %}
{% trans 'Do not want to track your work time? Fine. We do not force you to.' %}
{% trans 'The whole code is available under the MIT-License and can be found on GitHub. You can join the development!' %}


I'm a full stack web developer after being a professional campus minister in a past life.
A campus minister turned coder?
In a nutshell, yes. I loved ministry, but I needed a change. I needed a new challenge where I would be encouraged to try new things. I made the decision and dove head first into programming. It's been a challenging, but exciting journey so far, and I can't wait to see where it takes me!
This site was built with Rails, AngularJS, and Semanti-UI.


REQ
Section: OpenSSL (1)Updated: 2012-08-23
Index Return to Main Contents
NAME
req - PKCS#10 certificate request and certificate generating utility.SYNOPSIS
openssl req [-inform PEM|DER] [-outform PEM|DER] [-in filename] [-passin arg] [-out filename] [-passout arg] [-text] [-pubkey] [-noout] [-verify] [-modulus] [-new] [-rand file(s)] [-newkey rsa:bits] [-newkey alg:file] [-nodes] [-key filename] [-keyform PEM|DER] [-keyout filename] [-keygen_engine id] [-[digest]] [-config filename] [-subj arg] [-multivalue-rdn] [-x509] [-days n] [-set_serial n] [-asn1-kludge] [-no-asn1-kludge] [-newhdr] [-extensions section] [-reqexts section] [-utf8] [-nameopt] [-reqopt] [-subject] [-subj arg] [-batch] [-verbose] [-engine id]DESCRIPTION
The req command primarily creates and processes certificate requests in PKCS#10 format. It can additionally create self signed certificates for use as root CAs for example.COMMAND OPTIONS
- -inform DER|PEM
- This specifies the input format. The DER option uses an ASN1 DER encoded form compatible with the PKCS#10. The PEM form is the default format: it consists of the DER format base64 encoded with additional header and footer lines.
- -outform DER|PEM
- This specifies the output format, the options have the same meaning as the -inform option.
- -in filename
- This specifies the input filename to read a request from or standard input if this option is not specified. A request is only read if the creation options (-new and -newkey) are not specified.
- -passin arg
- the input file password source. For more information about the format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
- -out filename
- This specifies the output filename to write to or standard output by default.
- -passout arg
- the output file password source. For more information about the format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
- -text
- prints out the certificate request in text form.
- -subject
- prints out the request subject (or certificate subject if -x509 is specified)
- -pubkey
- outputs the public key.
- -noout
- this option prevents output of the encoded version of the request.
- -modulus
- this option prints out the value of the modulus of the public key contained in the request.
- -verify
- verifies the signature on the request.
- -new
-
this option generates a new certificate request. It will prompt
the user for the relevant field values. The actual fields
prompted for and their maximum and minimum sizes are specified
in the configuration file and any requested extensions.
If the -key option is not used it will generate a new RSA private key using information specified in the configuration file.
- -subj arg
- Replaces subject field of input request with specified data and outputs modified request. The arg must be formatted as /type0=value0/type1=value1/type2=..., characters may be escaped by \ (backslash), no spaces are skipped.
- -rand file(s)
- a file or files containing random data used to seed the random number generator, or an EGD socket (see RAND_egd(3)). Multiple files can be specified separated by a OS-dependent character. The separator is ; for MS-Windows, , for OpenVMS, and : for all others.
- -newkey arg
-
this option creates a new certificate request and a new private
key. The argument takes one of several forms. rsa:nbits, where
nbits is the number of bits, generates an RSA key nbits
in size. If nbits is omitted, i.e. -newkey rsa specified,
the default key size, specified in the configuration file is used.
All other algorithms support the -newkey alg:file form, where file may be an algorithm parameter file, created by the genpkey -genparam command or and X.509 certificate for a key with approriate algorithm.
param:file generates a key using the parameter file or certificate file, the algorithm is determined by the parameters. algname:file use algorithm algname and parameter file file: the two algorithms must match or an error occurs. algname just uses algorithm algname, and parameters, if neccessary should be specified via -pkeyopt parameter.
dsa:filename generates a DSA key using the parameters in the file filename. ec:filename generates EC key (usable both with ECDSA or ECDH algorithms), gost2001:filename generates GOST R 34.10-2001 key (requires ccgost engine configured in the configuration file). If just gost2001 is specified a parameter set should be specified by -pkeyopt paramset:X
- -pkeyopt opt:value
- set the public key algorithm option opt to value. The precise set of options supported depends on the public key algorithm used and its implementation. See KEY GENERATION OPTIONS in the genpkey manual page for more details.
- -key filename
- This specifies the file to read the private key from. It also accepts PKCS#8 format private keys for PEM format files.
- -keyform PEM|DER
- the format of the private key file specified in the -key argument. PEM is the default.
- -keyout filename
- this gives the filename to write the newly created private key to. If this option is not specified then the filename present in the configuration file is used.
- -nodes
- if this option is specified then if a private key is created it will not be encrypted.
- -[digest]
-
this specifies the message digest to sign the request with (such as
-md5, -sha1). For full list of possible digests see
openssl dgst -h output. This overrides the digest algorithm specified in
the configuration file.
Some public key algorithms may override this choice. For instance, DSA signatures always use SHA1, GOST R 34.10 signatures always use GOST R 34.11-94 (-md_gost94).
- -config filename
- this allows an alternative configuration file to be specified, this overrides the compile time filename or any specified in the OPENSSL_CONF environment variable.
- -subj arg
- sets subject name for new request or supersedes the subject name when processing a request. The arg must be formatted as /type0=value0/type1=value1/type2=..., characters may be escaped by \ (backslash), no spaces are skipped.
- -multivalue-rdn
-
this option causes the -subj argument to be interpreted with full
support for multivalued RDNs. Example:
/DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe
If -multi-rdn is not used then the UID value is 123456+CN=John Doe.
- -x509
- this option outputs a self signed certificate instead of a certificate request. This is typically used to generate a test certificate or a self signed root CA. The extensions added to the certificate (if any) are specified in the configuration file. Unless specified using the set_serial option 0 will be used for the serial number.
- -days n
- when the -x509 option is being used this specifies the number of days to certify the certificate for. The default is 30 days.
- -set_serial n
- serial number to use when outputting a self signed certificate. This may be specified as a decimal value or a hex value if preceded by 0x. It is possible to use negative serial numbers but this is not recommended.
- -extensions section
- -reqexts section
- these options specify alternative sections to include certificate extensions (if the -x509 option is present) or certificate request extensions. This allows several different sections to be used in the same configuration file to specify requests for a variety of purposes.
- -utf8
- this option causes field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings.
- -nameopt option
- option which determines how the subject or issuer names are displayed. The option argument can be a single option or multiple options separated by commas. Alternatively the -nameopt switch may be used more than once to set multiple options. See the x509(1) manual page for details.
- -reqopt
-
customise the output format used with -text. The option argument can be
a single option or multiple options separated by commas.
See discission of the -certopt parameter in the x509 command.
- -asn1-kludge
-
by default the req command outputs certificate requests containing
no attributes in the correct PKCS#10 format. However certain CAs will only
accept requests containing no attributes in an invalid form: this
option produces this invalid format.
More precisely the Attributes in a PKCS#10 certificate request are defined as a SET OF Attribute. They are not OPTIONAL so if no attributes are present then they should be encoded as an empty SET OF. The invalid form does not include the empty SET OF whereas the correct form does.
It should be noted that very few CAs still require the use of this option.
- -no-asn1-kludge
- Reverses effect of -asn1-kludge
- -newhdr
- Adds the word NEW to the PEM file header and footer lines on the outputed request. Some software (Netscape certificate server) and some CAs need this.
- -batch
- non-interactive mode.
- -verbose
- print extra details about the operations being performed.
- -engine id
- specifying an engine (by its unique id string) will cause req to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms.
- -keygen_engine id
- specifies an engine (by its unique id string) which would be used for key generation operations.
CONFIGURATION FILE FORMAT
The configuration options are specified in the req section of the configuration file. As with all configuration files if no value is specified in the specific section (i.e. req) then the initial unnamed or default section is searched too.The options available are described in detail below.
- input_password output_password
- The passwords for the input private key file (if present) and the output private key file (if one will be created). The command line options passin and passout override the configuration file values.
- default_bits
- This specifies the default key size in bits. If not specified then 512 is used. It is used if the -new option is used. It can be overridden by using the -newkey option.
- default_keyfile
- This is the default filename to write a private key to. If not specified the key is written to standard output. This can be overridden by the -keyout option.
- oid_file
- This specifies a file containing additional OBJECT IDENTIFIERS. Each line of the file should consist of the numerical form of the object identifier followed by white space then the short name followed by white space and finally the long name.
- oid_section
- This specifies a section in the configuration file containing extra object identifiers. Each line should consist of the short name of the object identifier followed by = and the numerical form. The short and long names are the same when this option is used.
- RANDFILE
- This specifies a filename in which random number seed information is placed and read from, or an EGD socket (see RAND_egd(3)). It is used for private key generation.
- encrypt_key
- If this is set to no then if a private key is generated it is not encrypted. This is equivalent to the -nodes command line option. For compatibility encrypt_rsa_key is an equivalent option.
- default_md
- This option specifies the digest algorithm to use. Possible values include md5 sha1 mdc2. If not present then MD5 is used. This option can be overridden on the command line.
- string_mask
-
This option masks out the use of certain string types in certain
fields. Most users will not need to change this option.
It can be set to several values default which is also the default option uses PrintableStrings, T61Strings and BMPStrings if the pkix value is used then only PrintableStrings and BMPStrings will be used. This follows the PKIX recommendation in RFC2459. If the utf8only option is used then only UTF8Strings will be used: this is the PKIX recommendation in RFC2459 after 2003. Finally the nombstr option just uses PrintableStrings and T61Strings: certain software has problems with BMPStrings and UTF8Strings: in particular Netscape.
- req_extensions
- this specifies the configuration file section containing a list of extensions to add to the certificate request. It can be overridden by the -reqexts command line switch. See the x509v3_config(5) manual page for details of the extension section format.
- x509_extensions
- this specifies the configuration file section containing a list of extensions to add to certificate generated when the -x509 switch is used. It can be overridden by the -extensions command line switch.
- prompt
- if set to the value no this disables prompting of certificate fields and just takes values from the config file directly. It also changes the expected format of the distinguished_name and attributes sections.
- utf8
- if set to the value yes then field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings.
- attributes
- this specifies the section containing any request attributes: its format is the same as distinguished_name. Typically these may contain the challengePassword or unstructuredName types. They are currently ignored by OpenSSL's request signing utilities but some CAs might want them.
- distinguished_name
- This specifies the section containing the distinguished name fields to prompt for when generating a certificate or certificate request. The format is described in the next section.
DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT
There are two separate formats for the distinguished name and attribute sections. If the prompt option is set to no then these sections just consist of field names and values: for example,
CN=My Name OU=My Organization<EMAIL_ADDRESS>This allows external programs (e.g. GUI based) to generate a template file with all the field names and values and just pass it to req. An example of this kind of configuration file is contained in the EXAMPLES section.
Alternatively if the prompt option is absent or not set to no then the file contains field prompting information. It consists of lines of the form:
fieldName="prompt" fieldName_default="default field value" fieldName_min= 2 fieldName_max= 4
``fieldName'' is the field name being used, for example commonName (or CN). The ``prompt'' string is used to ask the user to enter the relevant details. If the user enters nothing then the default value is used if no default value is present then the field is omitted. A field can still be omitted if a default value is present if the user just enters the '.' character.
The number of characters entered must be between the fieldName_min and fieldName_max limits: there may be additional restrictions based on the field being used (for example countryName can only ever be two characters long and must fit in a PrintableString).
Some fields (such as organizationName) can be used more than once in a DN. This presents a problem because configuration files will not recognize the same name occurring twice. To avoid this problem if the fieldName contains some characters followed by a full stop they will be ignored. So for example a second organizationName can be input by calling it ``1.organizationName''.
The actual permitted field names are any object identifier short or long names. These are compiled into OpenSSL and include the usual values such as commonName, countryName, localityName, organizationName, organizationUnitName, stateOrProvinceName. Additionally emailAddress is include as well as name, surname, givenName initials and dnQualifier.
Additional object identifiers can be defined with the oid_file or oid_section options in the configuration file. Any additional fields will be treated as though they were a DirectoryString.
EXAMPLES
Examine and verify certificate request:
openssl req -in req.pem -text -verify -noout
Create a private key and then generate a certificate request from it:
openssl genrsa -out key.pem 1024 openssl req -new -key key.pem -out req.pem
The same but just using req:
openssl req -newkey rsa:1024 -keyout key.pem -out req.pem
Generate a self signed root certificate:
openssl req -x509 -newkey rsa:1024 -keyout key.pem -out req.pem
Example of a file pointed to by the oid_file option:
<IP_ADDRESS> shortName A longer Name <IP_ADDRESS> otherName Other longer Name
Example of a section pointed to by oid_section making use of variable expansion:
testoid1=<IP_ADDRESS> testoid2=${testoid1}.6
Sample configuration file prompting for field values:
[ req ] default_bits = 1024 default_keyfile = privkey.pem distinguished_name = req_distinguished_name attributes = req_attributes x509_extensions = v3_ca dirstring_type = nobmp [ req_distinguished_name ] countryName = Country Name (2 letter code) countryName_default = AU countryName_min = 2 countryName_max = 2 localityName = Locality Name (eg, city) organizationalUnitName = Organizational Unit Name (eg, section) commonName = Common Name (eg, YOUR name) commonName_max = 64 emailAddress = Email Address emailAddress_max = 40 [ req_attributes ] challengePassword = A challenge password challengePassword_min = 4 challengePassword_max = 20 [ v3_ca ] subjectKeyIdentifier=hash authorityKeyIdentifier=keyid:always,issuer:always basicConstraints = CA:true
Sample configuration containing all field values:
RANDFILE = $ENV::HOME/.rnd [ req ] default_bits = 1024 default_keyfile = keyfile.pem distinguished_name = req_distinguished_name attributes = req_attributes prompt = no output_password = mypass [ req_distinguished_name ] C = GB ST = Test State or Province L = Test Locality O = Organization Name OU = Organizational Unit Name CN = Common Name emailAddress =<EMAIL_ADDRESS>[ req_attributes ] challengePassword = A challenge password
NOTES
The header and footer lines in the PEM format are normally:
-----BEGIN CERTIFICATE REQUEST----- -----END CERTIFICATE REQUEST-----
some software (some versions of Netscape certificate server) instead needs:
-----BEGIN NEW CERTIFICATE REQUEST----- -----END NEW CERTIFICATE REQUEST-----
which is produced with the -newhdr option but is otherwise compatible. Either form is accepted transparently on input.
The certificate requests generated by Xenroll with MSIE have extensions added. It includes the keyUsage extension which determines the type of key (signature only or general purpose) and any additional OIDs entered by the script in an extendedKeyUsage extension.
DIAGNOSTICS
The following messages are frequently asked about:
Using configuration from /some/path/openssl.cnf Unable to load config info
This is followed some time later by...
unable to find 'distinguished_name' in config problems making Certificate Request
The first error message is the clue: it can't find the configuration file! Certain operations (like examining a certificate request) don't need a configuration file so its use isn't enforced. Generation of certificates or requests however does need a configuration file. This could be regarded as a bug.
Another puzzling message is this:
Attributes: a0:00
this is displayed when no attributes are present and the request includes the correct empty SET OF structure (the DER encoding of which is 0xa0 0x00). If you just see:
Attributes:
then the SET OF is missing and the encoding is technically invalid (but it is tolerated). See the description of the command line option -asn1-kludge for more information.
ENVIRONMENT VARIABLES
The variable OPENSSL_CONF if defined allows an alternative configuration file location to be specified, it will be overridden by the -config command line switch if it is present. For compatibility reasons the SSLEAY_CONF environment variable serves the same purpose but its use is discouraged.BUGS
OpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectively treats them as ISO-8859-1 (Latin 1), Netscape and MSIE have similar behaviour. This can cause problems if you need characters that aren't available in PrintableStrings and you don't want to or can't use BMPStrings.As a consequence of the T61String handling the only correct way to represent accented characters in OpenSSL is to use a BMPString: unfortunately Netscape currently chokes on these. If you have to use accented characters with Netscape and MSIE then you currently need to use the invalid T61String form.
The current prompting is not very friendly. It doesn't allow you to confirm what you've just entered. Other things like extensions in certificate requests are statically defined in the configuration file. Some of these: like an email address in subjectAltName should be input by the user.
SEE ALSO
x509(1), ca(1), genrsa(1), gendsa(1), config(5), x509v3_config(5)
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- COMMAND OPTIONS
- CONFIGURATION FILE FORMAT
- DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT
- EXAMPLES
- NOTES
- DIAGNOSTICS
- ENVIRONMENT VARIABLES
- BUGS
- SEE ALSO
This document was created by man2html, using the manual pages.
Time: 05:29:10 GMT, December 24, 2015


Simple Util
A Simple Solution for Your Site.
Simple Util is a lightweight set of utilities that are commonly used in development.
Read More »Simple Util
How long does development take?
A bit faster and cleaner than plain vanilla.
Read More »Simple Util
The Right Team to Keep You Smiling.
A small team with a small codebase is a happy team.
Read More »


Every OS Sucks
Here. "It was slow and it was buggy, so they wrote it again. Now they're up to OS 10. They'll charge you for the beta and then charge you again."
"Bill Gates may be richer than Captain Kirk, but Windows blows.  At the same time!"
"Linux... It's a great big mess for elitist, nerdy shmucks... Getting it running is half the fun, but I've got a girlfriend and things to get done."
Equal opportunity bashing of "everything since the abacus." Also hilarious.


| I l@ve RuBoard |
This section describes algorithms that modify the elements of a range. There are two ways to modify elements:
Modify them directly while iterating through a sequence.
Modify them while copying them from a source range to a destination range.
Several modifying algorithms provide both ways of modifying the elements of a range. In this case, the name of the latter uses the _copy suffix.
You can't use an associative container as a destination range because the elements in an associative container are constant. If you could, it would be possible to compromise the automatic sorting.
All algorithms that have a separate destination range return the position after the last copied element of that range.
OutputIterator
copy (InputIterator sourceBeg, InputIterator sourceEnd, OutputIterator destBeg)
BidirectionalIteratorl
copy_backward (BidirectionalIterator1 sourceBeg, BidirectionalIterator1 source End, BidirectionalIterator2 destEnd)
Both algorithms copy all elements of the source range [source Beg,sourceEnd) into the destination range starting with destBeg or ending with destEnd respectively.
They return the position after the last copied element in the destination range (the first element that is not overwritten).
destBeg or destEnd should not be part of [sourceBeg,sourceEnd).
copy() iterates forward through the sequence, whereas copy_backward() iterates backward. This difference matters only if the source and destination ranges overlap.
To copy a range to the front, use copy(). Thus, for copy(), destBeg should have a position in front of sourceBeg.
To copy a range to the back, use copy_backward(). Thus, for copy_backward(), destEnd should have a position after sourceEnd.
So whenever the third argument is an element of the source range specified by the first two arguments, use the other algorithm. Note that switching to the other algorithm means that you switch from passing the beginning of the destination range to passing the end. See page 365 for an example that demonstrates the differences.
There is no copy_if() algorithm provided. To copy only those elements that meet a certain criterion, use remove_copy_if() (see page 380).
Use reverse_copy() to reverse the order of the elements during the copy (see page 386). reverse_copy() may be slightly more efficient than using copy() with reverse iterators.
The caller must ensure that the destination range is big enough or that insert iterators are used.
See page 271 for the implementation of the copy() algorithm.
To assign all elements of a container, use the assignment operator (if the containers have the same type; see page 236) or the assign() member function (if the containers have different types; see page 237) of the containers.
To remove elements while they are being copied, use remove_copy() and remove_copy_if() (see page 380).
To modify elements while they are being copied, use transform() (see page 367) or replace_copy() (see page 376).
Complexity: linear (numberOfElements assignments).
The following example shows some simple calls of copy():
// algo/copy1.cpp #include "algostuff.hpp" using namespace std; int main() { vector<int> coll1; list<int> coll2; INSERT_ELEMENTS(coll1,1,9); /*copy elements of coll1 into coll2 *-use back inserter to insert instead of overwrite */ copy (coll1.begin(), coll1.end(), //source range back_inserter(coll2)) ; //destination range /*print elements of coll2 *-copy elements to cout using an ostream iterator */ copy (coll2.begin(), coll2.end(), //source range ostream_iterator<int>(cout," ")); //destination range cout << endl; /*copy elements of coll1 into coll2 in reverse order *-now overwriting */ copy (coll1.rbegin(), coll1.rend(), //source range coll2.begin()); //destination range //print elements of coll2 again copy (coll2.begin(), coll2.end(), //source range ostream_iterator<int>(cout, " ")); //destination range cout << endl; }
In this example, back inserters (see Section 7.4.2,) are used to insert the elements in the destination range. Without using inserters, copy() would overwrite the empty collection coll2, which results in undefined behavior. Similarly, the example uses ostream iterators (see Section 7.4.3,) to use standard output as the destination.
The program has the following output:
1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1
The following example demonstrates the difference between copy() and copy_backward():
// algo/copy2.cpp #include "algostuff.hpp" using namespace std; int main() { /*initialize source collection with ".......... abcdef.........." */ vector<char> source(10,'.'); for (int c='a'; c<='f'; C++) { source.push_back(c); } source.insert(source.end(),10,'.'); PRINT_ELEMENTS(source,"source: "); //copy all letters three elements in front of the 'a' vector<char> c1(source.begin(),source.end()); copy (c1.begin()+10, c1.begin()+16, //source range c1.begin()+7); //destination range PRINT_ELEMENTS(c1,"c1: "); //copy all letters three elements behind the 'f' vector<char> c2(source.begin(),source.end()); copy_backward (c2.begin()+10, c2.begin()+16, //source range c2.begin()+19); //destination range PRINT_ELEMENTS(c2,"c2: "); }
Note that in both calls of copy() and copy_backward(), the third argument is not part of the source range.
A third example demonstrates how to use copy() as a data filter between standard input and standard output. he program reads strings and prints them, each on one line:
// algo/copy3.cpp #include <iostream> #include <algorithm> #include <string> using namespace std; int main() { copy (istream_iterator<string>(cin), //beginning of source istream_iterator<string>(), //end of source ostream_iterator<string>(cout, "\n")); //destination }
The transform() algorithms provide two abilities:
The first form has four arguments. It transforms elements from a source to a destination range. Thus, it copies and modifies elements in one step.
The second form has five arguments. It combines elements from two source sequences and writes the result to a destination range.
OutputIterator
transform (InputIterator sourceBeg, InputIterator sourceEnd, Output Iterator destEeg, UnaryFunc op)
Calls
op(elem)
for each element in the source range [sourceBeg,sourceEnd) and writes each result of op to the destination range starting with destBeg:
Returns the position after the last transformed element in the destination range (the first element that is not overwritten with a result).
The caller must ensure that the destination range is big enough or that insert iterators are used.
sourceBeg and destBeg may be identical. Thus, as with for_each() you can use this algorithm to modify elements inside a sequence. See the comparison with the for_each() algorithm on page 325 for this kind of usage.
To replace elements matching a criterion with a particular value, use the replace() algorithms (see page 375).
Complexity: linear (numberOfElements calls of op()).
The following program demonstrates how to use this kind of transform():
// algo/transf1.cpp #include "algostuff.hpp" using namespace std; int main() { vector<int> coll1; list<int> coll2; INSERT_ELEMENTS(coll1,1,9); PRINT_ELEMENTS(coll1,"coll1: "); //negate all elements in coll1 transform (coll1.begin(), coll1.end(), //source range coll1.begin(), //destination range negate<int>()); //operation PRINT_ELEMENTS(coll1,"negated: "); //transform elements of coll1 into coll2 with ten times their value transform (coll1.begin(), coll1.end(), //source range back_inserter(coll2), //destination range bind2nd(multiplies<int>(),10)); //operation PRINT_ELEMENTS(coll2,"coll2: "); //print coll2 negatively and in reverse order transform (coll2.rbegin(), coll2.rend(), //source range ostream_iterator<int>(cout," "), //destination range negate<int>()); //operation cout << endl; }
The program has the following output:
coll1: 1 2 3 4 5 6 7 8 9 negated: -1 -2 -3 -4 -5 -6 -7 -8 -9 coll2: -10 -20 -30 -40 -50 -60 -70 -80 -90 90 80 70 60 50 40 30 20 10
See the example on page 315 of how to combine two different operations while processing the elements.
OutputIterator
transform (InputIterator1 source1Beg, InputIterator1 source1End, InputIterator2 source2Beg, OutputIterator destBeg, BinaryFunc op)
Calls
op(source1Elem, source2Elem)
for all corresponding elements from the first source range [source1Beg,source1 End) and the second source range starting with source2Beg, and writes each result to the the destination range starting with destBeg:
Returns the position after the last transformed element in the destination range (the first element that is not overwritten with a result).
The caller must ensure that the second source range is big enough (has at least as many elements as the source range).
The caller must ensure that the destination range is big enough or that insert iterators are used.
source1Beg, source2Beg, and destBeg may be identical. Thus, you can process the results of elements that are combined with themselves and you can overwrite the elements of a source with the results.
Complexity: linear (numberOfElements calls of op()).
The following program demonstrates how to use this form of transform():
// algo/transf2.cpp #include "algostuff.hpp" using namespace std; int main() { vector<int> coll1; list<int> coll2; INSERT_ELEMENTS(coll1,1,9); PRINT_ELEMENTS(coll1,"coll1: "); //square each element transform (coll1.begin(), coll1.end(), //first source range coll1.begin(), //second source range coll1.begin(), //destination range multiplies<int>() ); //operation PRINT_ELEMENTS(coll1,"squared: "); /*add each element traversed forward with each element traversed backward *and insert result into coll2 */ transform (coll1. begin(), coll1. end(), //first source range coll1.rbegin(), //second source range back_inserter(coll2), //destination range plus<int>()); //operation PRINT_ELEMENTS(coll2,"coll2: "); // print differences of two corresponding elements cout << "diff: "; transform (coll1.begin(), coll1.end(), //first source range coll2.begin(), //second source range ostream_iterator<int>(cout, " "), //destination range minus<int>()); //operation cout << endl; }
The program has the following output:
coll1: 1 2 3 4 5 6 7 8 9 squared: 1 4 9 16 25 36 49 64 81 coll2: 82 68 58 52 50 52 58 68 82 diff: -81 -64 -49 -36 -25 -16 -9 -4 -1
ForwardIterator2
swap_ranges (ForwardIterator1 beg1, ForwardIterator1 end1, ForwardIterator2 beg2)
Swaps the elements in the range [beg1,end1) with the corresponding elements starting with beg2.
Returns the position after the last swapped element in the destination range.
The caller must ensure that the destination range is big enough or that insert iterators are used.
To swap all elements of a container of the same type, use its swap() member function because the member function usually has constant complexity (see page 237).
Complexity: linear (numberOfElements swap operations).
The following example demonstrates how to use swap_ranges():
// algo/swap1.cpp #include "algostuff.hpp" using namespace std; int main() { vector<int> coll1; deque<int> coll2; INSERT_ELEMENTS(coll1,1,9) ; INSERT_ELEMENTS(col12,11,23); PRINT_ELEMENTS(coll1,"coll1: "); PRINT_ELEMENTS(coll2,"coll2: "); //swap first four elements deque<int>::iterator pos; pos = swap_ranges (coll1.begin(), coll1.end(), //first range coll2.begin()); //second range PRINT_ELEMENTS(coll1,"\ncoll1: "); PRINT_ELEMENTS(coll2,"col12: "); if (pos != coll2.end()) { cout << "first element not modified: " << *pos << endl; } //mirror first three with last three elements in coll2 swap_ranges (coll2.begin(), coll2.begin()+3, //first range coll2.rbegin()); //second range PRINT_ELEMENTS(coll2,"\ncoll2: ") ; }
The first call of swap_ranges() swaps the elements of coll1 with the corresponding elements of coll2. The remaining elements of coll2 are not modified. The swap_ranges() algorithm returns the position of the first element not modified. The second call swaps the first and the last three elements of coll2. One of the iterators is a reverse iterator, so the elements are mirrored (swapped from outside to inside). The program has the following output:
coll1: 1 2 3 4 5 6 7 8 9 coll2: 11 12 13 14 15 16 17 18 19 20 21 22 23 coll1: 11 12 13 14 15 16 17 18 19 coll2: 1 2 3 4 5 6 7 8 9 20 21 22 23 first element not modified: 20 coll2: 23 22 21 4 5 6 7 8 9 20 3 2 1
void
fill (ForwardIterator beg, ForwardIterator end, const T& newValue)
void
fill_n (OutputIterator beg, Size num, const T& newValue)
fill() assigns newValue to each element in the range [beg,end).
fill_n() assigns newValue to the first num elements in the range starting with beg.
The caller must ensure that the destination range is big enough or that insert iterators are used.
Complexity: linear (numberOfElements or num assignments respectively).
The following program demonstrates the use of fill() and fill_n():
// algo/fill1.cpp #include "algostuff.hpp" using namespace std; int main() { //print ten times 7.7 fill_n(ostream_iterator<float>(cout, " "), //beginning of destination 10, //count 7.7); //new value cout << endl; list<string> coll; //insert "hello" nine times fill_n(back_inserter(coll), //beginning of destination 9, //count "hello"); //new value PRINT_ELEMENTS(coll,"coll: "); //overwrite all elements with "again" fill(coll.begin(), coll.end(), //destination "again"); //new value PRINT_ELEMENTS(coll,"coll: "); //replace all but two elements with "hi" fill_n(coll.begin(), //beginning of destination coll.size()-2, //count "hi"); //new value PRINT_ELEMENTS(coll,"coll: "); //replace the second and up to the last element but one with "hmmm" list<string>:: iterator posl, pos2; posl = coll.begin(); pos2 = coll.end(); fill (++pos1, --pos2, //destination "hmmm"); //new value PRINT_ELEMENTS(coll,"coll: "); }
The first call shows how to use fill_n() to print a certain number of values. The other calls of fill() and fill_n() insert and replace values in a list of strings. The program has the following output:
7.7 7.7 7.7 7.7 7.7 7.7 7.7 7.7 7.7 7.7 coll: hello hello hello hello hello hello hello hello hello coll: again again again again again again again again again coll: hi hi hi hi hi hi hi again again coll: hi hmmm hmmm hmmm hmmm hmmm hmmm hmmm again
void
generate (ForwardIterator beg, ForwardIterator end, Func op)
void
generate_n (OutputIterator beg, Size num, Func op)
generate() assigns the values that are generated by a call of
op()
to each element in the range [beg,end).
generate_n() assigns the values that are generated by a call of
op()
to the first num elements in the range starting with beg.
The caller must ensure that the destination range is big enough or that insert iterators are used.
Complexity: linear (numberOfElements or num calls of op() and assignments).
The following program demonstrates how to use generate() and generate_n() to insert or assign some random numbers:
// algo/generate.cpp #include <cstdlib> #include "algostuff.hpp" using namespace std; int main() { list<int> coll; //insert five random numbers generate_n (back_inserter(coll), //beginning of destination range 5, //count rand); //new value generator PRINT_ELEMENTS(coll); //overwrite with five new random numbers generate (coll.begin(), coll.end(), //destination range rand); //new value generator PRINT_ELEMENTS(coll); }
The rand() function is described in Section 12.3. The program might have the following output:
41 18467 6334 26500 19169 15724 11478 29358 26962 24464
The output is platform dependent because the random number sequence that rand() generates is not standardized.
See Section 8.1.2, for an example that demonstrates how to use generate() with function objects so that it generates a sequence of numbers.
void
replace (Forwardlterator beg, ForwardIterator end, const T& oldValue, const T& newValue)
void
replace_if (ForwardIterator beg, ForwardIterator end, UnaryPredicate op, const T& newValue)
replace() replaces each element in the range [beg,end) that is equal to oldValue with newValue.
replace_if() replaces each element in the range [beg,end) for which the unary predicate
op(elem)
yields true with newValue.
Note that op should not change its state during a function call. See Section 8.1.4, for details.
Complexity: linear (numberOfElements comparisons or calls of op() respectively).
The following program demonstrates some examples of the use of replace() and replace_if():
// algo/replace1.cpp #include "algostuff.hpp" using namespace std; int main() { list<int> coll; INSERT_ELEMENTS(coll,2,7); INSERT_ELEMENTS(coll,4,9); PRINT_ELEMENTS(coll,"coll: "); //replace all elements with value 6 with 42 replace (coll.begin(), coll.end(), //range 6, //old value 42); //new value PRINT_ELEMENTS(coll,"coll: "); //replace all elements with value less than 5 with 0 replace_if (coll.begin(), coll.end(), //range bind2nd(less<int>(),5), //criterion for replacement 0); //new value PRINT_ELEMENTS(coll,"coll: "); }
The program has the following output:
coll: 2 3 4 5 6 7 4 5 6 7 8 9 coll: 2 3 4 5 42 7 4 5 42 7 8 9 coll: 0 0 0 5 42 7 0 5 42 7 8 9
OutputIterator
replace_copy (InputIterator sourceBeg, InputIterator sourceEnd, OutputIterator destBeg, const T& oldValue, const T& newValue)
OutputIterator
replace_copy_if (InputIterator sourceBeg, InputIterator sourceEnd, OutputIterator destBeg, UnaryPredicate op, const T& newValue)
replace_copy() is a combination of copy() and replace(). It replaces each element in the source range [beg,end) that is equal to oldValue with newValue while the elements are copied into the destination range starting with destBeg.
replace_copy_if() is a combination of copy() and replace_if(). It replaces each element in the source range [beg,end) for which the unary predicate
op(elem)
yields true with newValue while the elements are copied into the destination range starting with destBeg.
Both algorithms return the position after the last copied element in the destination range (the first element that is not overwritten).
Note that op should not change its state during a function call. See Section 8.1.4, for details.
The caller must ensure that the destination range is big enough or that insert iterators are used.
Complexity: linear (numberOfElements comparisons or calls of op() and assignments respectively).
The following program demonstrates how to use replace_copy() and replace_copy_if():
// algo/replace2.cpp #include "algostuff.hpp" using namespace std; int main() { list<int> coll; INSERT_ELEMENTS(coll,2,6); INSERT_ELEMENTS(coll,4,9); PRINT_ELEMENTS(coll); //print all elements with value 5 replaced with 55 replace_copy(coll.begin(), coll.end(), //source ostream_iterator<int>(cout," "), //destination 5, //old value 55); //new value cout << endl; //print all elements with a value less than 5 replaced with 42 replace_copy_if (coll.begin(), coll.end(), //source ostream_iterator<int>(cout," "), //destination bind2nd(less<int>(),5), //replacement criterion 42); //new value cout << endl; //print each element while each odd element is replaced with 0 replace_copy_if (coll.begin(), coll.end(), //source ostream_iterator<int>(cout," "), //destination bind2nd (modulus<int>(),2), //replacement criterion 0); //new value cout << endl; > }
The program has the following output:
2 3 4 5 6 4 5 6 7 8 9 2 3 4 55 6 4 55 6 7 8 9 42 42 42 5 6 42 5 6 7 8 9 2 0 4 0 6 4 0 6 0 8 0
| I l@ve RuBoard |


public class BlacklistTracker
extends Object
| Constructor and Description |
|---|
BlacklistTracker() |
| Modifier and Type | Method and Description |
|---|---|
static long |
getBlacklistTimeout(SparkConf conf) |
static boolean |
isBlacklistEnabled(SparkConf conf)
Returns true if the blacklist is enabled, based on checking the configuration in the following
order:
1.
|
static void |
validateBlacklistConfs(SparkConf conf)
Verify that blacklist configurations are consistent; if not, throw an exception.
|
public static boolean isBlacklistEnabled(SparkConf conf)
conf
- (undocumented)public static long getBlacklistTimeout(SparkConf conf)
public static void validateBlacklistConfs(SparkConf conf)
The configuration for the blacklist is expected to adhere to a few invariants. Default values follow these rules of course, but users may unwittingly change one configuration without making the corresponding adjustment elsewhere. This ensures we fail-fast when there are such misconfigurations.
conf
- (undocumented)


Kool Dude is one enigmatic character. I don't know if he actually exists or is someone's alter ego on this Web development forum I visit. Something tells me he is actually just a real person like you and me, though.
I can't find any real contact information for him. The site he lists in his forum profile doesn't work and his e-mail address bounves. He could be on a social network but I just can't find his profile...


public class SmsSubmissionResult
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static int |
STATUS_ACCOUNT_NOT_HTTP
Message was rejected because your account is not provisioned for submitting via the REST interface.
|
static int |
STATUS_COMMS_FAILURE
Message was not submitted because there was a communications failure.
|
static int |
STATUS_FACILITY_NOT_ALLOWED
Your request makes use of a facility that is not enabled on your account
|
static int |
STATUS_INTERNAL_ERROR
Message was rejected due to a failure within the Nexmo systems.
Message can be re-submitted after a short delay |
static int |
STATUS_INVALID_CREDENTIALS
Message was rejected due to receiving invalid account api key and/or secret
|
static int |
STATUS_INVALID_FROM_ADDRESS
The 'from' address specified in the message submission was not permitted
|
static int |
STATUS_INVALID_MESSAFE_CLASS
The message class value supplied was out of range (0 - 3)
|
static int |
STATUS_INVALID_MESSAGE
Message was rejected because the Nexmo service was unable to handle this request.
|
static int |
STATUS_INVALID_PARAMS
Message was rejected due to an illegal value in one or more elements of the submission request
|
static int |
STATUS_INVALID_SIGNATURE
Message was not submitted due to a verification failure in the submitted signature
|
static int |
STATUS_INVALID_TTL
invalid TTL -- The ttl parameter values, or combination of parameters is invalid
|
static int |
STATUS_MESSAGE_TOO_LONG
Message was rejected because it exceeds the allowable maximum length (140 octets for a binary message, or 3200 chars for a text message)
|
static int |
STATUS_MISSING_PARAMS
Message was rejected due to incomplete data in the submission request
|
static int |
STATUS_NUMBER_BARRED
Message was rejected because the phone number you tried to submit to has been blacklisted.
|
static int |
STATUS_NUMBER_UNREACHABKE
This destination cannot be delivered to at this time (if reachable=true is specified)
|
static int |
STATUS_OK
Message was successfully submitted to the Nexmo service
|
static int |
STATUS_PARTNER_ACCOUNT_BARRED
Message was rejected because your account has been barred, or has not yet been activated
|
static int |
STATUS_PARTNER_QUOTA_EXCEEDED
Message was rejected because your pre-paid balance does not contain enough credit to handle this request.
Please top up your balance before re-submitting this request or subsequent requests. |
static int |
STATUS_THROTTLED
Message was rejected due to exceeding the maximum throughput allowed for this account.
Message can be re-submitted after a short delay |
static int |
STATUS_TOO_MANY_BINDS
Message was rejected because already have the maximum number of concurrent connections allowed for your account.
|
static int |
STATUS_TOO_MANY_DESTINATIONS
There are more than the maximum allowed number of destinations in this request
|
| Modifier | Constructor and Description |
|---|---|
protected |
SmsSubmissionResult(int status,
java.lang.String destination,
java.lang.String messageId,
java.lang.String errorText,
java.lang.String clientReference,
java.math.BigDecimal remainingBalance,
java.math.BigDecimal messagePrice,
boolean temporaryError,
SmsSubmissionReachabilityStatus smsSubmissionReachabilityStatus,
java.lang.String network) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getClientReference() |
java.lang.String |
getDestination() |
java.lang.String |
getErrorText() |
java.lang.String |
getMessageId() |
java.math.BigDecimal |
getMessagePrice() |
java.lang.String |
getNetwork() |
java.math.BigDecimal |
getRemainingBalance() |
SmsSubmissionReachabilityStatus |
getSmsSubmissionReachabilityStatus() |
int |
getStatus() |
boolean |
getTemporaryError() |
java.lang.String |
toString() |
public static final int STATUS_OK
public static final int STATUS_THROTTLED
public static final int STATUS_MISSING_PARAMS
public static final int STATUS_INVALID_PARAMS
public static final int STATUS_INVALID_CREDENTIALS
public static final int STATUS_INTERNAL_ERROR
public static final int STATUS_INVALID_MESSAGE
public static final int STATUS_NUMBER_BARRED
public static final int STATUS_PARTNER_ACCOUNT_BARRED
public static final int STATUS_PARTNER_QUOTA_EXCEEDED
public static final int STATUS_TOO_MANY_BINDS
public static final int STATUS_ACCOUNT_NOT_HTTP
public static final int STATUS_MESSAGE_TOO_LONG
public static final int STATUS_COMMS_FAILURE
public static final int STATUS_INVALID_SIGNATURE
public static final int STATUS_INVALID_FROM_ADDRESS
public static final int STATUS_INVALID_TTL
public static final int STATUS_NUMBER_UNREACHABKE
public static final int STATUS_TOO_MANY_DESTINATIONS
public static final int STATUS_FACILITY_NOT_ALLOWED
public static final int STATUS_INVALID_MESSAFE_CLASS
protected SmsSubmissionResult(int status, java.lang.String destination, java.lang.String messageId, java.lang.String errorText, java.lang.String clientReference, java.math.BigDecimal remainingBalance, java.math.BigDecimal messagePrice, boolean temporaryError, SmsSubmissionReachabilityStatus smsSubmissionReachabilityStatus, java.lang.String network)
public int getStatus()
public java.lang.String getDestination()
public java.lang.String getMessageId()
public java.lang.String getErrorText()
public java.lang.String getClientReference()
public java.math.BigDecimal getRemainingBalance()
public java.math.BigDecimal getMessagePrice()
public boolean getTemporaryError()
public SmsSubmissionReachabilityStatus getSmsSubmissionReachabilityStatus()
public java.lang.String getNetwork()
public java.lang.String toString()
toString
in class java.lang.Object


- readFarm(String) - Method in class me.lactem.pvz.farm.FarmManager
-
- reloadConfig() - Method in class me.lactem.pvz.util.files.FileUtils
-
- reloadJoinInv() - Method in class me.lactem.pvz.util.files.FileUtils
-
- reloadMessages() - Method in class me.lactem.pvz.util.files.FileUtils
-
- reloadStats() - Method in class me.lactem.pvz.util.files.FileUtils
-
- reloadTypeInv() - Method in class me.lactem.pvz.util.files.FileUtils
-
- RemoveFromCooldown - Class in me.lactem.pvz.tasks
-
- RemoveFromCooldown(UUID, int, boolean, boolean) - Constructor for class me.lactem.pvz.tasks.RemoveFromCooldown
-
- removeFromDeathCountdown(UUID) - Method in class me.lactem.pvz.game.GameManager
-
Removes a player from the death countdown list if he/she is in it
- removeFromGameInv(UUID) - Method in class me.lactem.pvz.inventory.InventoryManager
-
Removes a player from the list of players in the game inventory
- removeFromTypeInv(UUID) - Method in class me.lactem.pvz.inventory.InventoryManager
-
Removes a player from the list of players in the type inventory
- removeGame(Game) - Method in class me.lactem.pvz.game.GameManager
-
Removes a game from the list of games if it exists
- removeInventory(Player) - Method in class me.lactem.pvz.inventory.InventoryManager
-
Resets a player by clearing inventory, removing potion effects, setting the player to survival, resetting food/health, unhiding, and undisguising
- removePlant(Player) - Method in class me.lactem.pvz.team.TeamManager
-
Removes a plant player from a game
- removeZombie(Player) - Method in class me.lactem.pvz.team.TeamManager
-
Removes a zombie player from the game
- replaceHolders(int, List<String>, ArrayList<String>, Game) - Method in class me.lactem.pvz.inventory.InventoryManager
-
Replaces placeholders// such as /map> and /status> in one list of lore.
- reset(String) - Method in class me.lactem.pvz.stats.StatsManager
-
- ResetCommand - Class in me.lactem.pvz.command
-
- ResetCommand() - Constructor for class me.lactem.pvz.command.ResetCommand
-
- resetStats(String, boolean) - Method in class me.lactem.pvz.util.sql.SQLUtils
-
Resets a player's statistics
- restartGame(Game) - Method in class me.lactem.pvz.game.GameManager
-
Restarts a game after it ended so that new players can join
- Row - Class in me.lactem.pvz.row
-
- Row(SerializableSelection) - Constructor for class me.lactem.pvz.row.Row
-
- run() - Method in class me.lactem.pvz.tasks.Countdown
-
- run() - Method in class me.lactem.pvz.tasks.Fireworks
-
- run() - Method in class me.lactem.pvz.tasks.GameRunnable
-
- run() - Method in class me.lactem.pvz.tasks.RemoveFromCooldown
-
- run() - Method in class me.lactem.pvz.tasks.Unfreeze
-


Experiences
What is 'Experiences'?
Imagine, if at will, you could rejuvenate yourselves & restore confidence in times of stress, sadness, failure, restlessness, and those sleepless nights.
Well, you don’t need to imagine any more. ‘Experiences’ is an app for your iPad that feeds your senses a unique blend of videos interwoven with beautiful music & classic quotations that take you away from the stress & tension of this world.
So, how does it work?
In life, it's really the little things that matter. These are life's simple pleasures that are commonly overlooked. And possibly everyday sources of happiness can be found within them. Walking down a beach, spending an afternoon in front of a warm cozy fireplace, watching the rain; all these moments make us feel at peace. These little things are the source of pure bliss and joy. This is where true happiness lies.
“Experiences” brings all these moments directly to you. Just after you launch the app, you will be presented with two choices:
- You can select from one of the default presets, or - You can also customize an experience according to your specific needs.
Default presets
Some of the default presets from which you can pick from are:
- I'm having a down day today. I want to feel cheerful. - I had a stressful day. I want to feel relaxed. - I keep falling off track. I want to stick to my goals. - I want to explore the deeper meaning of life. - and more...
Based on your current mood, you can accordingly pick a experience preset.
Customize your own experience
It is your life. Make it magical.
If you do not choose a preset, there are a total of 15 high quality videos available for you to select from.
You can pick from a wide range of beautiful audio tracks to play alongside the video clip. In addition to this, you can select quotes & citations by some great personalities to appear while the video is playing.
How can I get it?
‘Experiences’ is available worldwide on the Apple App Store. You can check it out here:
https://itunes.apple.com/us/app/experiences/id636709923?mt=8&uo=4
Screenshots
[gallery type=”rectangular” ids=”111,112,113,114,115,116,117,118,119”]


SolidVC Issuer
Home
Subject
Issuer
Verifier
Switch Accounts
Issue
Review
Revoke
×
Review Credential Requests
Revoke Credential
Provide Credential ID:
NOTE: This does not necessarily have to be a dereferenceable URL
Issue New Credential
Select Credential Domain:
Select "General" if unsure
Education
Finance
General
Government
Health
Law
Medicine
Profession
Transportation
Travel
Provide Credential Subject ID:
Icons made by
Smashicons
from
www.flaticon.com
is licensed by
CC 3.0 BY


--- layout: post title: Start Side-Hustling ---
Back in university I worked in a media office, and it seemed like all the creatives had two jobs in their life: their real job, and the thing they did on the side. Our graphic designers would run a consultancy, our photographers would put together a magazine, and our videographers would were constantly shooting for events or contests.
I once asked the head of our office about this, and he sagely responded “everybody has to have a side hustle”. Although I didn’t understand it at the time, years later I’ve come to realize that he’s right: whether you’re a videographer or a software engineer, having a side-hustle at work can be a valuable way to grow your skills and impact.
A side hustle is pretty much anything you do which is not part of your specific job responsibilities. If you’re a software engineer, you could have a side hustle where you help define and maintain your team’s code review practices. Alternatively, you could spend time writing blog posts, or leading brainstorming sessions about team direction. You can even side-hustle outside of your day job (we call those hobbies), but for this purpose we’ll just focus on side hustles during your day job.
Now you may be thinking to yourself “Why bother with side hustles? Why not just keep doing and let someone else take care of that messy, non-coding, work?” The simple reason is because side hustles represent a huge opportunity for you and your team.
Side hustle opportunities exist because there’s a problem that needs to be solved and no ones currently solving it. Chances are there’s a problem brewing under the surface, but everyone else has been too busy to deal with it; this is good news for you! It means there's an opportunity for you to step up, fill that gap, and learn something new in the process.
Take the above example of a team that doesn’t have clear code review guidelines. On a team of three people, it’s probably not such a big deal: everyone has a social agreement about how code review should operate. However, as you onboard a couple of more engineers you notice that code reviews begin to slow down, and maybe start to focus more on nitpicking than important questions.
At this point, the problem is probably not the most urgent one for the team, so no manager or CEO is going to say “time to roll up my sleeves and fix this team’s code review disagreements”. However, the lack of code review standards is a very real problem, and one which left unchecked will lead to slow code reviews and a lot of grief for the team. If no one does anything and you onboard four more engineers, your code reviews may descend into slow, grinding, arguments. Fortunately, if someone steps up and solves the problem now, before it’s too late, the whole team will avoid this fate.
Side hustles don’t just help your team, they help you broaden your own impact. There’s always a limited number of technical problems to be solved, so you may not always be able to lead a shiny new engineering project. Side hustles allow you to find a new challenge even when the rest of your job isn’t pushing you to solve new challenges.
Once you start taking on side hustles you’ll also find that they bring you into contact with people you would have never otherwise met. These connections are rarely immediately valuable, but they can be immensely useful as you look for new opportunities, or even just a new way to solve problems in the future.
Great! You’re now on-board with the idea of a side-hustle and you’re keen to start your own, but you don’t know where to start. How can you get started side hustling?
First, you need to figure out what it is you want to solve and how to solve it. For me, this always starts with a problem that I’m experiencing for myself. Coming back to the example at hand I may say “I’ve been running into a lot of disagreements on code review lately. How can I fix that”.
With that problem in hand, I next try to figure out how to solve it locally. So, I may sit down and say “why do we do code review?” and “how can I make sure we avoid bikeshedding in code reviews?”. With those answers in hand, I’d try to build a set of personal code review guidelines and see how they work.
Once you’ve gotten a local solution to the problem, the next step is to figure out how others view the same problem. The best way to make this happen is shockingly easy: talk to people and ask them how they feel about the same problem.
For me, this often consists of setting up coffee meetings three groups: peers with context on the problem, peers who are totally unfamiliar with the problem, and a brief discussion with The Decider(s), people who could block or empower any solution I come up with.1
Generally these meetings consist of me saying “Hey, I’ve been thinking about
Once you've had your brief conversations and have gotten positive signals about your direction, the next step is to actually define what you’re going to do to scale up your idea. You wouldn’t launch a big feature without first writing up a design document; similarly, wouldn’t want to implement company-wide code review guidelines without having a plan for how to draft, review, pilot, and finalize them. So write down a plan for your project and make sure it includes a set of small milestones which allow you to start small, validate your idea, and then grow from there. Taking our example of code review guidelines, that plan would look something like this:
Notice how this plan doesn't try to solve the whole problem at once. It breaks the problem down into discrete steps and then layers on complexity only once the foundations are solid. Whatever your goal is, you want to define a similar set of clear steps which provide lots of check-in points for others.
Plan in hand, it’s time to get empowered to start
side-hustling. Generally doing this consists of a meeting with The Deciders, who you
should have already identified and talked to. If not, here's a quick rule of
thumb: if it’s a team-level change, that’s probably your manager; if it’s larger, it’s probably a
manager-of-managers. Find your decider and tell them “So I’ve been thinking
about
For some people, this may seem weird. “I’m telling my boss what we should be doing? Don’t they know what’s going on?” Well, maybe, but it’s much more likely that they have 25 other things which demand there attention, so if you stroll into their office and say “hi, I’d like to solve one of those problems for you”, their first thought will not be “get out of my office plebe”, it will be “oh thank god someone is solving this problem for me.” Remember, the time between something becoming a problem and the time when it becomes a fire can be long, and filled with lots of pain.
Of course, they won’t always say “yes” immediately, but they may push you to revise/clarify a couple of plans. However, so long as you vet your idea up-front, chances are you should be able to move forward with your plan.
Great! You’ve gotten the okay for your plan. Now what?? How can you do your new project along with your “normal work”? The secret here is running your side-hustle just like another project.
 You should have defined an MVP, milestones, and a scaling plan as part of the proposal you showed to The Decider. Now’s the time to use that. If you haven't, then go make one.
Start by working on the first milestone on your project. In our case, this would mean just writing down some rough high-level principles and getting feedback on those. Execute on that piece effectively, document your learnings, and then come back to subsequent milestones based on what you’ve learned. Trying to do the whole thing at once is a recipe for getting overwhelmed, so keep your focus small.
Once you have that plan, it’s time to start working towards your first milestone. Again, you should be treating this like just another engineering project. Start by breaking down your first milestone into a set of individual tasks, and begin working through them. You can even have bi-weekly planning meetings where you establish a goal for the week and then myopically execute on that.
I also like to block off 30-60 minute sections at the end of a day as “side-hustling time”. During this time I put down my normal work and only work on side-hustles. This calendar time is important for me, as it serves as a reminder to put down the urgent work I’ve been focused on, and refocus on making forward progress on this important task. It’s okay if I miss a couple of these, but I try to make sure to have at least one or two a week so that the project never slips into “neutral”.
You may also find that as you work through these milestones you’re stuck and don’t know where to go next. That’s when it’s a great time to shoot an email to The Decider and get some feedback from them. Chances are they can unblock you by pointing you towards a resource who can help you. Don’t expect The Decider to solve your problems, but they are useful if you’re at wit’s end and don’t know where to turn.
As you start to accomplish, you want to make sure to check back with the original person who you worked with to get sign-off. As you hit each milestone, report back to them with what you tried, what you learned, and where you are thinking of going next. They may not be able to jump in and directly lend a hand (remember, they’ve probably got other priorities), however, they will be able to serve as a good sounding board for possible landmines on your way forward.
You’ll often find that this project feels a bit slow and plodding. That’s okay! Your side-projects are never going to move as fast as the things you spend the other 36 hours a week working on. What’s important is that you keep moving forward and showing progress. If you do that, and you keep trucking through obstacles, you’ll find that over time your pilot becomes a full-blown solution. It won’t be fast, but you’ll find that the people you meet and the things you learn will make it worth the while.
1The concept of deciders is universal, but I stole this particular version of the idea from Jake Knapp's excellent Sprint book.
A big thank you goes out to Michael Stephens, who reviewed early drafts of this post.


This exercise is a continuation of exercise 3 from exercise set 1 (week 35). We will use the same function to generate our data set, still staying with a simple function \( y(x) \) which we want to fit using linear regression, but now extending the analysis to include the Ridge and the Lasso regression methods. You can use the code under the Regression as an example on how to use the Ridge and the Lasso methods, see the regression slides).
We will thus again generate our own dataset for a function \( y(x) \) where \( x \in [0,1] \) and defined by random numbers computed with the uniform distribution. The function \( y \) is a quadratic polynomial in \( x \) with added stochastic noise according to the normal distribution \( \cal{N}(0,1) \).
The following simple Python instructions define our \( x \) and \( y \) values (with 100 data points).
x = np.random.rand(100)
y = 2.0+5*x*x+0.1*np.random.randn(100)
a) Write your own code for the Ridge method (see chapter 3.4 of Hastie et al., equations (3.43) and (3.44)) and compute the parametrization for different values of \( \lambda \). Compare and analyze your results with those from exercise 3. Study the dependence on \( \lambda \) while also varying the strength of the noise in your expression for \( y(x) \).
Solution. The code here allows you to perform your own Ridge calculation and perform calculations for various values of the regularization parameter \( \lambda \). This program can easily be extended upon.
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
def R2(y_data, y_model):
return 1 - np.sum((y_data - y_model) ** 2) / np.sum((y_data - np.mean(y_data)) ** 2)
def MSE(y_data,y_model):
n = np.size(y_model)
return np.sum((y_data-y_model)**2)/n
# A seed just to ensure that the random numbers are the same for every run.
# Useful for eventual debugging.
np.random.seed(3155)
x = np.random.rand(100)
y = 2.0+5*x*x+0.1*np.random.randn(100)
# number of features p (here degree of polynomial
p = 3
# The design matrix now as function of a given polynomial
X = np.zeros((len(x),p))
X[:,0] = 1.0
X[:,1] = x
X[:,2] = x*x
# We split the data in test and training data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
scaler = StandardScaler()
scaler.fit(X_train)
X_train_scaled = scaler.transform(X_train)
X_test_scaled = scaler.transform(X_test)
# matrix inversion to find beta
OLSbeta = np.linalg.inv(X_train.T @ X_train) @ X_train.T @ y_train
print(OLSbeta)
# and then make the prediction
ytildeOLS = X_train @ OLSbeta
print("Training R2 for OLS")
print(R2(y_train,ytildeOLS))
print("Training MSE for OLS")
print(MSE(y_train,ytildeOLS))
ypredictOLS = X_test @ OLSbeta
print("Test R2 for OLS")
print(R2(y_test,ypredictOLS))
print("Test MSE OLS")
print(MSE(y_test,ypredictOLS))
# Repeat now for Ridge regression and various values of the regularization parameter
I = np.eye(p,p)
# Decide which values of lambda to use
nlambdas = 20
MSEPredict = np.zeros(nlambdas)
MSETrain = np.zeros(nlambdas)
lambdas = np.logspace(-4, 1, nlambdas)
for i in range(nlambdas):
lmb = lambdas[i]
Ridgebeta = np.linalg.inv(X_train.T @ X_train+lmb*I) @ X_train.T @ y_train
# and then make the prediction
ytildeRidge = X_train @ Ridgebeta
ypredictRidge = X_test @ Ridgebeta
MSEPredict[i] = MSE(y_test,ypredictRidge)
MSETrain[i] = MSE(y_train,ytildeRidge)
# Now plot the results
plt.figure()
plt.plot(np.log10(lambdas), MSETrain, label = 'MSE Ridge train')
plt.plot(np.log10(lambdas), MSEPredict, 'r--', label = 'MSE Ridge Test')
plt.xlabel('log10(lambda)')
plt.ylabel('MSE')
plt.legend()
plt.show()
b) Repeat the above but using the functionality of Scikit-Learn. Compare your code with the results from Scikit-Learn. Remember to run with the same random numbers for generating \( x \) and \( y \).
Solution. To use scikit-learn with Ridge, we simply need to add the relevant function Ridge(), as done in the code here.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import sklearn.linear_model as skl
def R2(y_data, y_model):
return 1 - np.sum((y_data - y_model) ** 2) / np.sum((y_data - np.mean(y_data)) ** 2)
def MSE(y_data,y_model):
n = np.size(y_model)
return np.sum((y_data-y_model)**2)/n
# A seed just to ensure that the random numbers are the same for every run.
# Useful for eventual debugging.
np.random.seed(3155)
x = np.random.rand(100)
y = 2.0+5*x*x+0.1*np.random.randn(100)
# number of features p (here degree of polynomial
p = 3
# The design matrix now as function of a given polynomial
X = np.zeros((len(x),p))
X[:,0] = 1.0
X[:,1] = x
X[:,2] = x*x
# We split the data in test and training data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
scaler = StandardScaler()
scaler.fit(X_train)
X_train_scaled = scaler.transform(X_train)
X_test_scaled = scaler.transform(X_test)
# matrix inversion to find beta
OLSbeta = np.linalg.inv(X_train.T @ X_train) @ X_train.T @ y_train
print(OLSbeta)
# and then make the prediction
ytildeOLS = X_train @ OLSbeta
print("Training R2 for OLS")
print(R2(y_train,ytildeOLS))
print("Training MSE for OLS")
print(MSE(y_train,ytildeOLS))
ypredictOLS = X_test @ OLSbeta
print("Test R2 for OLS")
print(R2(y_test,ypredictOLS))
print("Test MSE OLS")
print(MSE(y_test,ypredictOLS))
# Repeat now for Ridge regression and various values of the regularization parameter
I = np.eye(p,p)
# Decide which values of lambda to use
nlambdas = 100
MSEPredict = np.zeros(nlambdas)
MSEPredictSKL = np.zeros(nlambdas)
MSETrain = np.zeros(nlambdas)
lambdas = np.logspace(-4, 0, nlambdas)
for i in range(nlambdas):
lmb = lambdas[i]
# add ridge
clf_ridge = skl.Ridge(alpha=lmb).fit(X_train, y_train)
yridge = clf_ridge.predict(X_test)
Ridgebeta = np.linalg.inv(X_train.T @ X_train+lmb*I) @ X_train.T @ y_train
# and then make the prediction
ytildeRidge = X_train @ Ridgebeta
ypredictRidge = X_test @ Ridgebeta
MSEPredict[i] = MSE(y_test,ypredictRidge)
MSEPredictSKL[i] = MSE(y_test,yridge)
MSETrain[i] = MSE(y_train,ytildeRidge)
#then plot the results
plt.figure()
plt.plot(np.log10(lambdas), MSETrain, label = 'MSE Ridge train')
plt.plot(np.log10(lambdas), MSEPredict, 'r--', label = 'MSE Ridge Test')
plt.plot(np.log10(lambdas), MSEPredictSKL, 'g--', label = 'MSE Ridge sickit-learn Test')
plt.xlabel('log10(lambda)')
plt.ylabel('MSE')
plt.legend()
plt.show()
c) Our next step is to study the variance of the parameters \( \beta_1 \) and \( \beta_2 \) (assuming that we are parameterizing our function with a second-order polynomial). We will use standard linear regression and the Ridge regression. You can now opt for either writing your own function or using Scikit-Learn to find the parameters \( \beta \). From your results calculate the variance of these parameters (recall that this is equal to the diagonal elements of the matrix \( (\hat{X}^T\hat{X})+\lambda\hat{I})^{-1} \)). Discuss the results of these variances as functions of \( \lambda \). In particular, try to link your discussion with the discussion in Hastie et al. and their figures 3.10 and 3.11. Scikit-Learn may not provide the variance of the parameters \( \beta \). This needs to be checked. With your own code you can however do so.
Solution.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import sklearn.linear_model as skl
def R2(y_data, y_model):
return 1 - np.sum((y_data - y_model) ** 2) / np.sum((y_data - np.mean(y_data)) ** 2)
def MSE(y_data,y_model):
n = np.size(y_model)
return np.sum((y_data-y_model)**2)/n
# A seed just to ensure that the random numbers are the same for every run.
# Useful for eventual debugging.
np.random.seed(3155)
x = np.random.rand(100)
y = 2.0+5*x*x+0.1*np.random.randn(100)
# number of features p (here degree of polynomial
p = 3
# The design matrix now as function of a given polynomial
X = np.zeros((len(x),p))
X[:,0] = 1.0
X[:,1] = x
X[:,2] = x*x
# We split the data in test and training data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
scaler = StandardScaler()
scaler.fit(X_train)
X_train_scaled = scaler.transform(X_train)
X_test_scaled = scaler.transform(X_test)
# matrix inversion to find beta
OLSbeta = np.linalg.inv(X_train.T @ X_train) @ X_train.T @ y_train
print(OLSbeta)
# The variance is given by the inverse of the matrix X^TX
print(np.linalg.inv(X_train.T @ X_train))
# Repeat now for Ridge regression and various values of the regularization parameter
I = np.eye(p,p)
# Decide which values of lambda to use
nlambdas = 10
MSEPredict = np.zeros(nlambdas)
MSEPredictSKL = np.zeros(nlambdas)
MSETrain = np.zeros(nlambdas)
lambdas = np.logspace(-4, 0, nlambdas)
for i in range(nlambdas):
lmb = lambdas[i]
Ridgebeta = np.linalg.inv(X_train.T @ X_train+lmb*I) @ X_train.T @ y_train
print(np.linalg.inv(X_train.T @ X_train+lmb*I))
d) Repeat the previous step but add now the Lasso method, see equation (3.53) of Hastie et al.. Discuss your results and compare with standard regression and the Ridge regression results. You can write your own code or use the functionality of scikit-learn. We recommend the latter since we have not yet discussed how to solve the Lasso equations numerically. Also, you do not need to compute the variance of the parameters \( \beta \) but you can extract their values and study their behavior as functions of the regularization parameter \( \lambda \).
Solution.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import sklearn.linear_model as skl
#from sklearn.linear_model import LinearRegression, Ridge, Lasso
def R2(y_data, y_model):
return 1 - np.sum((y_data - y_model) ** 2) / np.sum((y_data - np.mean(y_data)) ** 2)
def MSE(y_data,y_model):
n = np.size(y_model)
return np.sum((y_data-y_model)**2)/n
# A seed just to ensure that the random numbers are the same for every run.
# Useful for eventual debugging.
np.random.seed(3155)
x = np.random.rand(100)
y = 2.0+5*x*x+0.1*np.random.randn(100)
# number of features p (here degree of polynomial
p = 3
# The design matrix now as function of a given polynomial
X = np.zeros((len(x),p))
X[:,0] = 1.0
X[:,1] = x
X[:,2] = x*x
# We split the data in test and training data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
scaler = StandardScaler()
scaler.fit(X_train)
X_train_scaled = scaler.transform(X_train)
X_test_scaled = scaler.transform(X_test)
# matrix inversion to find beta
OLSbeta = np.linalg.inv(X_train.T @ X_train) @ X_train.T @ y_train
print(OLSbeta)
# and then make the prediction
ytildeOLS = X_train @ OLSbeta
print("Training R2 for OLS")
print(R2(y_train,ytildeOLS))
print("Training MSE for OLS")
print(MSE(y_train,ytildeOLS))
ypredictOLS = X_test @ OLSbeta
print("Test R2 for OLS")
print(R2(y_test,ypredictOLS))
print("Test MSE OLS")
print(MSE(y_test,ypredictOLS))
# Repeat now for Ridge regression and various values of the regularization parameter
I = np.eye(p,p)
# Decide which values of lambda to use
nlambdas = 100
MSEPredictLasso = np.zeros(nlambdas)
MSEPredictRidge = np.zeros(nlambdas)
lambdas = np.logspace(-4, 0, nlambdas)
for i in range(nlambdas):
lmb = lambdas[i]
# add ridge
clf_ridge = skl.Ridge(alpha=lmb).fit(X_train, y_train)
clf_lasso = skl.Lasso(alpha=lmb).fit(X_train, y_train)
yridge = clf_ridge.predict(X_test)
ylasso = clf_lasso.predict(X_test)
MSEPredictLasso[i] = MSE(y_test,ylasso)
MSEPredictRidge[i] = MSE(y_test,yridge)
#then plot the results
plt.figure()
plt.plot(np.log10(lambdas), MSEPredictRidge, 'r--', label = 'MSE Ridge Test')
plt.plot(np.log10(lambdas), MSEPredictLasso, 'g--', label = 'MSE Lasso Test')
plt.xlabel('log10(lambda)')
plt.ylabel('MSE')
plt.legend()
plt.show()
e) Finally, using Scikit-Learn or your own code, compute also the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error defined as $$ MSE(\hat{y},\hat{\tilde{y}}) = \frac{1}{n} \sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2, $$ and the \( R^2 \) score function. If \( \tilde{\hat{y}}_i \) is the predicted value of the \( i-th \) sample and \( y_i \) is the corresponding true value, then the score \( R^2 \) is defined as $$ R^2(\hat{y}, \tilde{\hat{y}}) = 1 - \frac{\sum_{i=0}^{n - 1} (y_i - \tilde{y}_i)^2}{\sum_{i=0}^{n - 1} (y_i - \bar{y})^2}, $$ where we have defined the mean value of \( \hat{y} \) as $$ \bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i. $$ Discuss these quantities as functions of the variable \( \lambda \) in the Ridge and Lasso regression methods.
Solution. These results can all be studied with the codes we have above. These scores are included in the codes above.
A much used approach before starting to train the data is to preprocess our data. Normally the data may need a rescaling and/or may be sensitive to extreme values. Scaling the data renders our inputs much more suitable for the algorithms we want to employ.
Scikit-Learn has several functions which allow us to rescale the data, normally resulting in much better results in terms of various accuracy scores. The StandardScaler function in Scikit-Learn ensures that for each feature/predictor we study the mean value is zero and the variance is one (every column in the design/feature matrix). This scaling has the drawback that it does not ensure that we have a particular maximum or minimum in our data set. Another function included in Scikit-Learn is the MinMaxScaler which ensures that all features are exactly between \( 0 \) and \( 1 \). The
The Normalizer scales each data point such that the feature vector has a euclidean length of one. In other words, it projects a data point on the circle (or sphere in the case of higher dimensions) with a radius of 1. This means every data point is scaled by a different number (by the inverse of it’s length). This normalization is often used when only the direction (or angle) of the data matters, not the length of the feature vector.
The RobustScaler works similarly to the StandardScaler in that it ensures statistical properties for each feature that guarantee that they are on the same scale. However, the RobustScaler uses the median and quartiles, instead of mean and variance. This makes the RobustScaler ignore data points that are very different from the rest (like measurement errors). These odd data points are also called outliers, and might often lead to trouble for other scaling techniques.
It also common to split the data in a training set and a testing set. A typical split is to use \( 80\% \) of the data for training and the rest for testing. This can be done as follows with our design matrix \( \boldsymbol{X} \) and data \( \boldsymbol{y} \) (remember to import scikit-learn)
# split in training and test data
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.2)
Then we can use the standard scaler to scale our data as
scaler = StandardScaler()
scaler.fit(X_train)
X_train_scaled = scaler.transform(X_train)
X_test_scaled = scaler.transform(X_test)
In this exercise we want you to to compute the MSE for the training data and the test data as function of the complexity of a polynomial, that is the degree of a given polynomial. We want you also to compute the \( R2 \) score as function of the complexity of the model for both training data and test data. You should also run the calculation with and without scaling.
One of the aims is to reproduce Figure 2.11 of Hastie et al. We will also use Ridge and Lasso regression.
Our data is defined by \( x\in [-3,3] \) with a total of for example \( 100 \) data points.
np.random.seed()
n = 100
maxdegree = 14
# Make data set.
x = np.linspace(-3, 3, n).reshape(-1, 1)
y = np.exp(-x**2) + 1.5 * np.exp(-(x-2)**2)+ np.random.normal(0, 0.1, x.shape)
where \( y \) is the function we want to fit with a given polynomial.
a) Write a first code which sets up a design matrix \( X \) defined by a fifth-order polynomial. Scale your data and split it in training and test data.
Solution.
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.preprocessing import PolynomialFeatures
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
np.random.seed(2018)
n = 50
maxdegree = 5
# Make data set.
x = np.linspace(-3, 3, n).reshape(-1, 1)
y = np.exp(-x**2) + 1.5 * np.exp(-(x-2)**2)+ np.random.normal(0, 0.1, x.shape)
TestError = np.zeros(maxdegree)
TrainError = np.zeros(maxdegree)
polydegree = np.zeros(maxdegree)
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2)
scaler = StandardScaler()
scaler.fit(X_train)
x_train_scaled = scaler.transform(x_train)
x_test_scaled = scaler.transform(x_test)
for degree in range(maxdegree):
model = make_pipeline(PolynomialFeatures(degree=degree), LinearRegression(fit_intercept=False))
clf = model.fit(x_train_scale,y_train)
y_fit = clf.predict(x_train_scaled)
y_pred = clf.predict(x_test_scaled)
polydegree[degree] = degree
TestError[degree] = np.mean( np.mean((y_test - y_pred)**2) )
TrainError[degree] = np.mean( np.mean((y_train - y_fit)**2) )
plt.plot(polydegree, TestError, label='Test Error')
plt.plot(polydegree, TrainError, label='Train Error')
plt.legend()
plt.show()
b) Perform an ordinary least squares and compute the means squared error and the \( R2 \) factor for the training data and the test data, with and without scaling.
Solution. This requires a simple extension to the above code where you simply add a statement calling the \( R2 \) function included in the same code.
c) Add now a model which allows you to make polynomials up to degree \( 15 \). Perform a standard OLS fitting of the training data and compute the MSE and \( R2 \) for the training and test data and plot both test and training data MSE and \( R2 \) as functions of the polynomial degree. Compare what you see with Figure 2.11 of Hastie et al. Comment your results. For which polynomial degree do you find an optimal MSE (smallest value)?
Solution. Here you simply need to change the degree of the polynomial in the above code to \( n=15 \).
d) Repeat part (2c) but now using Ridge regressions with various hyperparameters \( \lambda \). Make the same plots for the optimal \( \lambda \) value for each polynomial degree. Compare these results with those from the standard OLS approach.
Solution. Here you need to add for example the same loop over the parameters \( \lambda \) as you did in the first exercise, that is add
nlambdas = 100
MSEPredictRidge = np.zeros(nlambdas)
lambdas = np.logspace(-4, 0, nlambdas)
for i in range(nlambdas):
lmb = lambdas[i]
# add ridge
clf_ridge = skl.Ridge(alpha=lmb).fit(X_train_scaled, y_train)
The plotting functionality of the first exercise can be reused here as well.


Event Team
Home
About
Profile
Team Form
Home
About
Profile
Click on the page to close the navigation.
Minumum Team Size: {{minTeamSize}}
Maximum Team Size: {{maxTeamSize}}
Start Date: {{startDate | date:'yyyy-MM-dd'}}
End Date: {{endDate | date:'yyyy-MM-dd'}}
Details: {{details}}
Edit
Teams with places left
Sort by places left
Teams that match my skills
Sort by the number of skills matched
{{teamKey}}
Request
Edit
create