Nadal outplayed by Zverev at ATP Finals
London - Rafael Nadal refused to make excuses after being outplayed by defending champion Alexander Zverev at the ATP Finals on Monday as Stefanos Tsitsipas got his campaign off to a flying start.
The Spanish top seed, who has never won the season-ending event, came into the tournament at London's O2 Arena under an injury cloud and was well short of his imperious best as he went down 6-2, 6-4.
In the earlier round-robin match in Group Andre Agassi, sixth seed Tsitsipas beat Daniil Medvedev 7-6 (7/5), 6-4, admitting their spiky relationship had made his job tougher.
Nadal is locked in a battle with Novak Djokovic to finish as the year-end No 1 but was not serving flat out in practice last week due to an abdominal strain that forced him to pull out of the Paris Masters at the semi-final stage.
The 33-year-old led Germany's Zverev 5-0 in head-to-head contests coming into the match but was uncharacteristically sloppy in the first set, conceding two breaks of serve.
Buoyed by his dominant start, Zverev, seeded seventh, broke in the first game of the second set to take an iron grip on the match.
Nadal dug deep, urging himself on but his 22-year-old opponent proved too strong. He did not concede a single break point in the entire match.
Zverev hit a total of 26 winners - double his opponent's tally - and Nadal managed just three forehand winners in the entire match.
"The physical issue was not an excuse at all," said the Spanish 19-time Grand Slam champion, who said he did not feel any pain from his abdominal injury. "The only excuse is I was not good enough tonight.
"What really matters is I need to play much better in two days. That's the only thing," he added. "We knew that it was going to be tough, because the period of time since the injury until today is very short, but we are here trying."
Zverev, one of four players under the age of 24 at the event in London, was delighted to recapture his best form after a mixed season.
"This means so much, playing here again after winning my biggest title so far in my career here last year," he said. "This means everything to me.
"Playing here, playing in front of you all, playing in the O2 is something that we don't have during the year, and this is so special."
Nadal faces a tough task now to qualify for the semi-finals from the group phase, with matches still to come against Tsitsipas and Medvedev.
The Spaniard has qualified for the year-end championships for 15 years in a row but has only made nine appearances due to injuries.
Tsitsipas hunger
Earlier, Tsitsipas made light of a 5-0 losing record against his Russia's Medvedev, edging a first-set tie-break and breaking late in the second set to seal the match.
The two players have had a rocky relationship.
Tensions flared between them in Miami last year and Tsitsipas recently labelled Medvedev's way of winning as "boring" after defeat against the Russian in Shanghai.
The Greek player said Medvedev had got "into my head" in Miami - he said the row had centred on a demand from the Russian for an apology over a net cord.
"I mean, our chemistry definitely isn't the best that you can find on the tour," said Tsitsipas, who added that Monday's match had been tougher because he was so desperate to win.
Djokovic launched his bid for a sixth ATP Finals title with a comfortable win against Matteo Berrettini on Sunday but Roger Federer slipped to a straight-sets defeat against Dominic Thiem.
Results on the second day of the ATP Finals at London's O2 Arena on Monday (x denotes seeding):
Singles
Group Andre Agassi
Stefanos Tsitsipas (GRE x6) bt Daniil Medvedev (RUS x4) 7-6 (7/5), 6-4
Alexander Zverev (GER x7) bt Rafael Nadal (ESP x1) 6-2, 6-4
Doubles
Group Max Mirnyi
Kevin Krawietz/Andreas Mies (GER/GER x3) bt Jean-Julien Rojer/Horia Tecau (NED/ROU x6) 7-6 (7/3), 4-6, 10-6
Pierre-Hugues Herbert/Nicolas Mahut (FRA/FRA x7) bt Juan Sebastian Cabal/Robert Farah (COL/COL x1) 6-3, 7-5


Cubism Plots: Manner of Death versus Age
In these charts, we plot a time series representing the number of deaths
that occur, corresponding to a given birth year. Areas of darker color
indicate higher rates of death. By plotting this information, it is possible
to visually spot trends in manners of death versus age.
These visualizations utilize static plots in Cubism,
which is really intended for real-time displays and dashboards,
but this type of plot was too useful to pass up.


A struct that provides the hash function of edge objects. More...
#include <edge.h>
A struct that provides the hash function of edge objects.
Definition at line 73 of file edge.h.
Generate the hash of an edge.
Definition at line 52 of file edge.cpp.


ReaderBase
Base class for different Reader types, that produce a record every step.
Conceptually, Readers convert string 'work units' into records (key, value pairs). Typically the 'work units' are filenames and the records are extracted from the contents of those files. We want a single record produced per step, but a work unit can correspond to many records.
Therefore we introduce some decoupling using a queue. The queue contains the work units and the Reader dequeues from the queue when it is asked to produce a record (via Read()) but it has finished the last work unit.
Readers are not compatible with eager execution. Instead, please
use tf.data
to get data into your model.
__init__
__init__( reader_ref, supports_serialize=False )
Creates a new ReaderBase.
reader_ref
: The operation that implements the reader.supports_serialize
: True if the reader implementation can
serialize its state.RuntimeError
: If eager execution is enabled.reader_ref
Op that implements the reader.
supports_serialize
Whether the Reader implementation can serialize its state.
num_records_produced
num_records_produced(name=None)
Returns the number of records this reader has produced.
This is the same as the number of Read executions that have succeeded.
name
: A name for the operation (optional).An int64 Tensor.
num_work_units_completed
num_work_units_completed(name=None)
Returns the number of work units this reader has finished processing.
name
: A name for the operation (optional).An int64 Tensor.
read
read( queue, name=None )
Returns the next record (key, value) pair produced by a reader.
Will dequeue a work unit from queue if necessary (e.g. when the Reader needs to start reading from a new file since it has finished with the previous file).
queue
: A Queue or a mutable string Tensor representing a handle
to a Queue, with string work items.name
: A name for the operation (optional).A tuple of Tensors (key, value).
key
: A string scalar Tensor.value
: A string scalar Tensor.read_up_to
read_up_to( queue, num_records, name=None )
Returns up to num_records (key, value) pairs produced by a reader.
Will dequeue a work unit from queue if necessary (e.g., when the Reader needs to start reading from a new file since it has finished with the previous file). It may return less than num_records even before the last batch.
queue
: A Queue or a mutable string Tensor representing a handle
to a Queue, with string work items.num_records
: Number of records to read.name
: A name for the operation (optional).A tuple of Tensors (keys, values).
keys
: A 1-D string Tensor.values
: A 1-D string Tensor.reset
reset(name=None)
Restore a reader to its initial clean state.
name
: A name for the operation (optional).The created Operation.
restore_state
restore_state( state, name=None )
Restore a reader to a previously saved state.
Not all Readers support being restored, so this can produce an Unimplemented error.
state
: A string Tensor.
Result of a SerializeState of a Reader with matching type.name
: A name for the operation (optional).The created Operation.
serialize_state
serialize_state(name=None)
Produce a string tensor that encodes the state of a reader.
Not all Readers support being serialized, so this can produce an Unimplemented error.
name
: A name for the operation (optional).A string Tensor.


Herodote is a "data to compute" serverless software. When you push data (new file or update a file) to the Openstack object storage in a project (bucket), Herodote checks for hooks. If a hook is defined for this data, then a job is automatically submitted. The hook will download the file, execute the commands you defined and upload the results back to the storage server. For more info, look at Projects and Hooks sections.
All is about automation, users focus on data, not on jobs.
So the first step is to create a project...
The project is the entry-point of Herodote. When you create a project, a new bucket is created in the storage server. Once bucket is created, you can push or download files from the server using the Openstack swift client or Herodote-file (https://github.com/osallou/herodote-file). Instructions on setup and how to download/upload files are given in project page.
However, while no hook is defined, no job is triggered on data modification. Project is only a storage area automatically created for you.
Of course, you can access your data, but you can also share access with other users, they even do not need to have an account.
For more info on data access rights, see the ACLs section.
Once a project is created, you should create a hook (or several ones)
To delete a project, you must empty the data before.
When a file is modified (or created), Herodote is triggered by storage server. Hooks, related to a project, define if a job should be triggered for this file.
For this, hooks define a regexp (regular expression) that will match (or not) the file path
It there is a match, the script defined in the hook will be executed on a executor (slurm , etc. see executors section for more info)
The recommended data structure is to push your data in a data subdirectory and to use a regexp matching data/.* and to push your result files to result/ subdirectory
Result directory will contain a compressed archive with your results and a log file.
Hook triggers works on a single file basis, you cannot push related files and execute a script against all those files. Herodote is triggered on a per file basis. If you need to execute a job based on multiple files:
A hook will globally defined:
Warning: a hook specifies some cpu and memory requirements. Before defining a hook, please make sure the remote system can support those requirements (requiring too much cpus or memory). If job is rejected by the executor, you will get no progress/rejection information in the jobs panel.
ACLs lets you define who can access to your data. You can add external users with read-only (ro) or read-write(rw) access to your project data.
Each user will have a personal token that should be used to access the data with the swift client
To remove access to a user, simply remove it from the ACLs list for your project.
You also have a permanent specific token to access your data (read-write). You can get it in the ACLs panel of your project
ACLs are defined by:
For example, someone:ro:data/public will generate an access key to any file under data/public in read only mode
A token is linked to a specific project.
If you have an openstack account, you can use your openstack environement file with the swift client, you do not need to use the token to upload or download data.
. my_openstack_env_file.sh
swift download myUserID_myProjectName file_to_download
Once a hook detected that a job should be run, Herodote will trigger a new job on the executor.
Though a job is sbumitted, it may take a longer time to start, the remote system may schedule it at a later time if resources are not available immediatly.
The jobs section of the project shows the list of jobs (submitted, running or over) for the selected project, their status should be updated if you kept the $SENDHERODOTEPROGRESS macros in the hook script
If you have an account on the executor system, you can login to the executor to get more info/progress on your job.
In case of problem with a job (not starting, no termination status), please contact the support
Herodote supports multiple execution systems (will vary on configuration).
Hooks define on which executor the job should be executed
Supported executors are:
For the moment, only the slurm and Docker execution via Go-Docker is supported. In the future we expect to add native slurm job submission as well as Go-Docker container based submission
Extra parameters:
* Slurm
No extra parameter
* Docker
image (mandatory: name of Docker image), volumes (optional: comma separated list of volume names as defined in go-docker) and project (optional: if not specified uses default project). Example: project=default, image=centos, volumes=db,home
Container can be ran as root with extra parameter root=true, else container is ran with user unix rights
Volumes are mounted in read-only mode
* Web hooks
url and secret extra parameters are mandatory (url=XXX, secret=YYY). url is the URL to trigger and secret is a shared secret to encode a JWT token for authorization (in Authorization header, Authorization: bearer XXX).
Herodote sends a POST request with job information in the body encoded in JSON format:
Now you should have a project, and maybe some hooks to trigger some jobs. What's next?
You, or users declared in ACLs can push data to the project. Example commands are shown in the project "How-to" section.
If some hooks were defined to trigger some jobs on file update, you should take care to push your files matching the regular expression defined in hook
For example, if a hook is defined the regexp ^data/.*$ (all files with path beginning with data/, the default), then files should be push with a path starting with data/
# Upload local file file_to_upload to data/file_to_upload swift --os-auth-token "$TOKEN" --os-storage-url https://genostack-api-swift.genouest.org/v1/AUTH_xxxxx upload my_project file_to_upload --object-name data/file_to_upload # Or using herodote-file (https://github.com/osallou/herodote-file/releases) hero-file --os-auth-token "$TOKEN" --os-storage-url https://genostack-api-swift.genouest.org/v1/AUTH_xxxxx upload my_project file_to_upload --object-name data/file_to_upload
TOKEN is the ACL generated for you or your friends in the ACLs section of your project
If using herodote-file to upload yuor files, tool will display the id of the executed jobs
Jobs will appear in herodote ui "Jobs" section. It is also possible to query herodote about job status via command-line using my-herodote (https://www.npmjs.com/package/@osallou/my-herodote)
To list jobs using my-herodote:
npm install -g my-herodote # Run once my-hero login my_user_id entifier my_project_name # Or use your ACL token export HERO_TOKEN=__my_token__ # Get last jobs my-hero jobs
If you used the default hook template, when job is over, log file and archive result will be uploaded back to your project storage in result/__path_to_file__/__job_specific_identifier__/
Given previous example, If you uploaded data/myexperiments/myfile, results will be in:
You can list and download files using swift client or herodote-file:
hero-file --os-auth-token "$TOKEN" --os-storage-url https://genostack-api-swift.genouest.org/v1/AUTH_xxxxx list my_project hero-file --os-auth-token "$TOKEN" --os-storage-url https://genostack-api-swift.genouest.org/v1/AUTH_xxxxx download my_project results/data/myexperiment/myfile/myproject.myhook.123456789/myproject.myhook.123456789.log
See How-to section of your project for command-line usage examples and tool help for more info.
Last updated: 2019-01-15
{{operator}} ("us", "we", or "our") operates https://herodote.genouest.org/ui (the "Site"). This page informs you of our policies regarding the collection, use and disclosure of Personal Information we receive from users of the Site.
We use your Personal Information only for providing and improving the Site. By using the Site, you agree to the collection and use of information in accordance with this policy.
Information Collection And Use
While using our Site, we may ask you to provide us with certain personally identifiable information that can be used to contact or identify you. Personally identifiable information may include, but is not limited to your name ("Personal Information").
Log Data
Like many site operators, we collect information that your browser sends whenever you visit our Site ("Log Data").
This Log Data may include information such as your computer's Internet Protocol ("IP") address, browser type, browser version, the pages of our Site that you visit, the time and date of your visit, the time spent on those pages and other statistics.
Communications
We may use your Personal Information to contact you in case of possible abuse of the service or issues found with your account.
Cookies
Cookies are files with small amount of data, which may include an anonymous unique identifier. Cookies are sent to your browser from a web site and stored on your computer's hard drive.
We use cookies only to create a session when you log in, no personal information or usage is recorded.
Security
The security of your Personal Information is important to us, but remember that no method of transmission over the Internet, or method of electronic storage, is 100% secure. While we strive to use acceptable means to protect your Personal Information, we cannot guarantee its absolute security.
Changes To This Privacy Policy
This Privacy Policy is effective as of 2019-01-15 and will remain in effect except with respect to any changes in its provisions in the future, which will be in effect immediately after being posted on this page.
We reserve the right to update or change our Privacy Policy at any time and you should check this Privacy Policy periodically. Your continued use of the Service after we post any modifications to the Privacy Policy on this page will constitute your acknowledgment of the modifications and your consent to abide and be bound by the modified Privacy Policy.
If we make any material changes to this Privacy Policy, we will notify you either through the email address you have provided us, or by placing a prominent notice on our website.
Contact Us
If you have any questions about this Privacy Policy, please contact us {{support}}.


Class: Mongoid::Association::Embedded::EmbedsOne::Binding
- Inherits:
-
Object
- Object
- Mongoid::Association::Embedded::EmbedsOne::Binding
- Includes:
- Bindable
- Defined in:
- lib/mongoid/association/embedded/embeds_one/binding.rb
Overview
Binding class for all embeds_one associations.
Instance Attribute Summary
Attributes included from Bindable
#_association, #_base, #_target
Instance Method Summary collapse
-
#bind_one ⇒ Object
Binds the base object to the inverse of the association.
-
#unbind_one ⇒ Object
Unbinds the base object and the inverse, caused by setting the reference to nil.
Methods included from Bindable
Instance Method Details
#bind_one ⇒ Object
Binds the base object to the inverse of the association. This is so we are referenced to the actual objects themselves on both sides.
This case sets the association metadata on the inverse object as well as the document itself.
26 27 28 29 30 31 |
# File 'lib/mongoid/association/embedded/embeds_one/binding.rb', line 26 def bind_one _target.parentize(_base) binding do _target.do_or_do_not(_association.inverse_setter(_target), _base) end end |
#unbind_one ⇒ Object
Unbinds the base object and the inverse, caused by setting the reference to nil.
41 42 43 44 45 |
# File 'lib/mongoid/association/embedded/embeds_one/binding.rb', line 41 def unbind_one binding do _target.do_or_do_not(_association.inverse_setter(_target), nil) end end |


Shapes............................................................................................................................................................................ 1
Shapes Contents.................................................................................................................................................. 1
Shapes......................................................................................................................................................................... 2
Shape Overview..................................................................................................................................................... 2
An Example Shape................................................................................................................................................. 3
Fill Styles............................................................................................................................................................... 4
Line Styles............................................................................................................................................................. 5
Shape structures..................................................................................................................................................... 5
Shape Records........................................................................................................................................................ 6
End Shape Record.................................................................................................................................................. 6
Style Change Record.............................................................................................................................................. 6
FillStyle0 and
FillStyle1........................................................................................................................................ 7
Edge Records.......................................................................................................................................................... 8
Straight Edge Record.............................................................................................................................................. 9
Curved Edge Record............................................................................................................................................... 9
Converting between
Quadratic and Cubic Bezier curves..................................................................................... 10
DefineShape......................................................................................................................................................... 10
DefineShape2....................................................................................................................................................... 11
DefineShape3....................................................................................................................................................... 11
Macromedia Flash File Format (SWF) SDK
Examples................................................................. 11
The Macromedia Flash (SWF) shape architecture is designed to be compact, flexible and rendered very quickly to the display. It is similar to most vector formats in that shapes are defined by a list of edges called a path. A path may be closed – where the start and end of the path meet to close the figure, or open – where the path forms an open-ended stroke. A path may contain a mixture of straight edges, curved edges, and ‘pen up and move’ commands. The latter allows multiple disconnected figures to be described by a single shape structure. (see MoveTo flag)
A fill style defines the appearance of an area enclosed by a path. Fill styles supported by Macromedia Flash (SWF) include a color, a gradient, or a bitmapped image.
A line style defines the appearance of the outline of a path. The line style may be a stroke of any thickness and color.
Most vector formats only allow one fill and line style per path. Macromedia Flash (SWF) extends this concept by allowing each edge to have its own line and fill style. This can have unpredictable results when fill styles change in the middle of a path.
Flash also supports two fill styles per edge, one for each side of the edge:
FillStyle0 and FillStyle1. FillStyle0
should always be used first and then FillStyle1 if the shape is filled on both
sides of the edge.
A shape is comprised of the following elements:
·
CharacterId — A
16-bit value that uniquely identifies this shape as a ‘character’ in the
dictionary. The CharacterId can be
referred to in control tags such as PlaceObject. Characters can be re-used and combined with other characters to
make more complex shapes.
· Bounding box — The rectangle that completely encloses the shape.
· Fill style array — A list of all the fill styles used in a shape.
· Line style array — A list of all the line styles used in a shape.
·
Shape-record array — A
list of shape-records. Shape-records
can define straight or curved edges, style changes, or move the drawing
position.
Note: Line and fill styles are defined once only, and may be used
(and re-used) by any of the edges in the shape.
This example appears to be a collection of shapes, but it can be described with a single DefineShape tag.
The red circle, red square and green rounded-rectangle are closed paths. The curved line is an open path. The red square consists of all straight edges, the red circle consists of all curved edges, while the rounded rectangle has curved edges interspersed with straight edges.
There are two fill styles; solid green and solid red, and two line styles; 1-pixel black, and 2-pixel black. The red circle and red square share the same fill and line styles. The rounded rectangle and curved line share the same line style.
Here’s how to describe this example with Macromedia Flash (SWF):
· First, the fill styles are defined with a FILLSTYLEARRAY. The two unique fill styles are solid red and solid green.
· This is followed by a LINESTYLEARRAY that includes the two unique line styles; 1-pixel black, and 2-pixel black .
· This is followed by an array of SHAPERECORDs.
All shape records share a similar structure but can have varied
meaning. A shape-record can define
straight or curved edge, a style change, or it can move the current drawing
position.
Now we define the curved line:
· The first shape-record selects the 2-pixel wide line style, and moves the drawing position to the top of the curved line by setting the MoveTo flag.
· The next shape-record is a curved edge, which ends to the bottom of the line. The path is not closed.
Now we define the red square:
· The next shape-record selects the 1-pixel line style and the red fill style. It also moves the drawing position to the top-left corner of the red rectangle.
· The following four shape-records are straight edges. The last edge must end at the top-left corner. Flash requires that closed figures be joined explicitly. That is, the first and last points must be co-incident.
Now we define the red circle:
· The next shape-record does not change any style settings, but moves the drawing position to the top of the red circle.
· The following eight shape-records are curved edges that define the circle. Again, the path must finish where it started.
Now we define the green rounded-rectangle:
· The next shape-record selects the 2-pixel wide line style, and the green fill. It also moves the drawing position to the top-left of the rounded-rectangle.
· The following twelve shape-records are a mixture of straight shape-records (the sides) interspersed with curved shape-records (the rounded corners). The path finishes where it began.
Macromedia Flash (SWF) supports three basic types of fills for a shape.
A fill style array enumerates a number of fill styles. The format of a fill style array is described in the following table:
(See class FFillStyleArray in the Macromedia Flash File Format (SWF) SDK)
|
FILLSTYLEARRAY |
||
|
Field |
Type |
Comment |
|
FillStyleCount |
count = UI8 |
Count of fill styles |
|
FillStyleCountExtended |
If count = 0xFF count =
UI16 |
Extended count of fill
styles. Supported only for Shape2 and Shape3. |
|
FillStyles |
FILLSTYLE[count] |
Array of fill styles |
The format of a fill style value within the file is described in the following table:
(See class FFillStyle in the Macromedia Flash File Format (SWF) SDK)
|
FILLSTYLE |
|
|
|
Field |
Type |
Comment |
|
FillStyleType |
type = UI8 |
Type of fill style |
|
Color |
If type = 0x00 RGBA (if
Shape3); RGB (if Shape1 or Shape2) |
Solid fill color with
transparency information |
|
GradientMatrix |
If type = 0x10 or 0x12 MATRIX |
Matrix for gradient fill |
|
Gradient |
If type = 0x10 or 0x12 GRADIENT |
Gradient fill |
|
BitmapId |
If type = 0x40 or 0x41 UI16 |
ID of bitmap character for
fill |
|
BitmapMatrix |
If type = 0x40 or 0x41 MATRIX |
Matrix for bitmap fill |
A line style array enumerates a number of line styles. The format of a line style array is described in the following table:
(See class FLineStyleArray in the Macromedia Flash File Format (SWF) SDK)
|
LINESTYLEARRAY |
|
|
|
Field |
Type |
Comment |
|
LineStyleCount |
count = UI8 |
Count of line styles |
|
LineStyleCountExtended |
If count = 0xFF count =
UI16 |
Extended count of line
styles |
|
LineStyles |
LINESTYLE[count] |
Array of line styles |
A line style represents a width and color of a line. The format of a line style value within the file is described in the following table:
(See class FLineStyle in the Macromedia Flash File Format (SWF) SDK)
|
LINESTYLE |
||
|
Field |
Type |
Comment |
|
Width |
UI16 |
Width of line in twips |
|
Color |
Color value including alpha
channel information for Shape3s |
Notes:
1. All lines in Macromedia Flash (SWF) have rounded joins and end-caps. Different join styles and end styles can be simulated with a very narrow shape that looks identical to the desired stroke.
2. Macromedia Flash (SWF) has no native support for dashed or dotted line styles. A dashed line can be simulated by breaking up the path into a series of short lines.
The SHAPE structure defines a shape without a fill style or line style information. SHAPE is used by the DefineFont tag, to define character glyphs.
(See class FShape in the Macromedia Flash File Format (SWF) SDK)
|
SHAPE |
|
|
|
Field |
Type |
Comment |
|
NumFillBits |
NfillBits = UB[4] |
Number of fill index bits |
|
NumLineBits |
NlineBits = UB[4] |
Number of line index bits |
|
ShapeRecords |
SHAPERECORD[one or more] |
Shape records - see below |
The SHAPEWITHSTYLE structure extends the SHAPE structure by including fill style and line style information. SHAPEWITHSTYLE is used by the DefineShape tag.
(See class FShapeWStyle in the Macromedia Flash File Format (SWF) SDK)
|
SHAPEWITHSTYLE |
||
|
Field |
Type |
Comment |
|
FillStyles |
Array of fill styles |
|
|
LineStyles |
Array of line styles |
|
|
NumFillBits |
NfillBits = UB[4] |
Number of fill index bits |
|
NumLineBits |
NlineBits = UB[4] |
Number of line index bits |
|
ShapeRecords |
SHAPERECORD[one
or more] |
Shape records - see below |
Note: The LINESTYLELARRAY and FILLSTYLEARRAY begin at
index 1, not index 0.
This
diagram illustrates the SHAPEWITHSTYLE structure.
First, the Fill styles and Line styles are defined. These are defined once only and are referred to by array index.
The blue area represents the array of shape-records.
The first shape-record selects a fill from the fill style array, and moves the drawing position to the start of the shape. This is followed by a series of edge records that define the shape.
The next record changes the fill style, and the subsequent edge-records are filled using this new style.
This tag is a completely autonomous object. The style change records only refer to fill and line styles that have been defined in this tag.
There are four types of shape-record:
1. End shape record.
2. Style change record.
3. Straight edge record.
4. Curved edge record.
All shape-records begin with a TypeFlag. If the TypeFlag is zero, the shape-record is a non-edge record, and a further five bits of flag information follow.
The end shape record simply indicates the end of the shape-record array. It is a non-edge record with all five flags equal to zero.
(See class FShapeRecEnd in the Flash File Format SDK)
|
ENDSHAPERECORD |
||
|
Field |
Type |
Comment |
|
TypeFlag |
UB[1] = 0 |
Non-edge record flag |
|
EndOfShape |
UB[5] = 0 |
End of shape flag |
The style change record is also a non-edge record. It can be used to:
· Select a fill or line style for drawing
· Move the current drawing position (without drawing)
· Replace the current fill and line style arrays with a new set of styles
Because fill and line styles often change at the start of a new path, it is useful to perform more than one action in a single record. For example, say a DefineShape tag defines a red circle and a blue square. After the circle is closed, it is necessary to move the drawing position, and replace the red fill with the blue fill. The style change record can achieve this with a single shape-record.
(See class FShapeRecChange in the Macromedia Flash File Format (SWF) SDK)
|
STYLECHANGERECORD |
||
|
Field |
Type |
Comment |
|
TypeFlag |
UB[1] = 0 |
Non-edge record flag |
|
StateNewStyles |
NewStyles = UB[1] |
New styles flag. Used by
DefineShape2 and DefineShape3 only. |
|
StateLineStyle |
LineStyle = UB[1] |
Line style change flag |
|
StateFillStyle1 |
FillStyle1 = UB[1] |
Fill style 1 change flag |
|
StateFillStyle0 |
FillStyle0 = UB[1] |
Fill style 0 change flag |
|
MoveTo
= UB[1] |
Move
to flag |
|
|
MoveBits |
If moveTo nMoveBits = UB[5] |
Move bit count |
|
MoveDeltaX |
If moveTo SB[nMoveBits] |
Delta X value |
|
MoveDeltaY |
If moveTo SB[nMoveBits] |
Delta Y value |
|
FillStyle0 |
If fillStyle0 UB[nFillBits] |
Fill 0 Style |
|
FillStyle1 |
If fillStyle1 UB[nFillBits] |
Fill 1 Style |
|
LineStyle |
If lineStyle UB[nLineBits] |
Line Style |
|
FillStyles |
If newStyles FILLSTYLEARRAY |
Array of new fill styles |
|
LineStyles |
If newStyles LINESTYLEARRAY |
Array of new line styles |
|
NumFillBits |
If newStyles NfillBits = UB[4] |
Number of fill index bits
for new styles |
|
NumLineBits |
If newStyles NlineBits = UB[4] |
Number of line index bits
for new styles |
In the first shape record MoveDeltaX and MoveDeltaY are relative to the shape origin. In subsequent shape-records, MoveDeltaX and MoveDeltaY are relative to the current drawing position.
The style arrays begin at index 1, not index 0. FillStyle = 1 refers to the first style in the fill style array, FillStyle = 2 refers to the second style in the fill style array, and so on. A fill style index of zero means the path is not filled, and a line style index of zero means the path has no stroke. Initially the fill and line style indices are set to zero – no fill or stroke.
Flash supports two fill styles per edge, one
for each side of the edge: FillStyle0 and FillStyle1. For most shapes (those which don’t self-intersect or overlap)
FillStyle0 should be used. For
overlapping shapes the situation is more complex.
For example, if a shape
consisted of two overlapping squares, and only FillStyle0 is defined, the Flash
player will render a ‘hole’ where the paths overlap. This area can be filled using FillStyle1. In this situation, the rule is that for any
directed vector, FillStyle0 is the color to the left of the vector, and
FillStyle1 is the color to the right of the vector. (See diagram below)
Note: FillStyle0 and FillStyle1 should not be confused with FILLSTYLEARRAY indices. FillStyle0 and FillStyle1 are variables that contain indices into the FILLSTYLEARRAY.
Edge-records have a TypeFlag of 1. There are two types of edge records; straight and curved. The StraightFlag determines the type.
The straight-edge record stores the edge as an X-Y delta. The delta is added to the current drawing position, and this becomes the new drawing position. The edge is rendered between the old and new drawing positions.
Straight-edge records support three types of line:
1. General lines.
2. Horizontal lines.
3. Vertical lines.
General lines store both X & Y deltas, the horizontal and vertical lines store only the X delta and Y delta respectively.
(See class FShapeRecEdgeStraight in the Macromedia Flash File Format (SWF) SDK)
|
STRAIGHTEDGERECORD |
||
|
Field |
Type |
Comment |
|
TypeFlag |
UB[1] = 1 |
This is an edge record |
|
StraightFlag |
UB[1] = 1 |
Straight edge – always 1 |
|
NumBits |
NBits = UB[4] +
2 |
|
|
GeneralLineFlag |
LineFlag = UB[1] |
General Line equals 1 Vert/Horz Line equals 0 |
|
DeltaX |
If lineFlag = 1
SB[nBits] |
X delta |
|
DeltaY |
If lineFlag = 1
SB[nBits] |
Y delta |
|
VertLineFlag |
If lineFlag = 0 vertFlag = SB[1] |
Vertical Line equals 1 Horizontal Line equals 0 |
|
DeltaX |
If vertFlag = 0
SB[nBits] |
X delta |
|
DeltaY |
If vertFlag = 1
SB[nBits] |
Y delta |
Macromedia Flash (SWF) differs
from most vector file formats by using Quadratic Bezier curves rather than
Cubic Bezier curves. PostScript uses
Cubic Beziers, as do most drawing applications, such as Illustrator, FreeHand
and Corel Draw. Macromedia Flash (SWF)
uses Quadratic Bezier curves because they can be stored more compactly, and can
be rendered more efficiently.
Below is a diagram of a Quadratic Bezier curve and a Cubic Bezier curve.
A Quadratic Bezier curve has 3 points. Two on-curve anchor points, and one off-curve control point.
A Cubic Bezier curve has 4 points. Two on-curve anchor points, and two off-curve control points.
The curved-edge record stores the edge as two X-Y deltas. The three points that define the Quadratic Bezier are calculated like this:
· The first anchor point is the current drawing position.
· The control point is the current drawing position + ControlDelta.
· The last anchor point is the current drawing position + ControlDelta + AnchorDelta.
The last anchor point becomes the current drawing position.
(See class FShapeRecEdgeCurved in the Macromedia Flash File Format (SWF) SDK)
|
CURVEDEDGERECORD |
||
|
Field |
Type |
Comment |
|
TypeFlag |
UB[1] = 1 |
This is an edge record |
|
StraightFlag |
UB[1] = 0 |
Curved edge - always 0 |
|
NumBits |
nBits = UB[4] +
2 |
|
|
ControlDeltaX |
SB[nBits] |
X control point change |
|
ControlDeltaY |
SB[nBits] |
Y control point change |
|
AnchorDeltaX |
SB[nBits] |
X anchor point change |
|
AnchorDeltaY |
SB[nBits] |
Y anchor point
change |
A Quadratic Bezier curve can be represented exactly by a Cubic Bezier curve, since you are going from a 2nd order curve to a 3rd order curve. The conversion is fairly straightforward.
For a discussion of how to convert Quadratic Bezier curves to Cubic Bezier curves see: http://www.icce.rug.nl/erikjan/bluefuzz/beziers/beziers/node2.html
A Cubic Bezier curve can be only be approximated with a Quadratic Bezier curve, since you are going from a 3rd order curve to a 2nd order curve. This involves recursive subdivision of the curve, until the cubic curve and the quadratic equivalent are matched within some arbitrary tolerance.
For a discussion of how to approximate Cubic Bezier curves
with Quadratic Bezier curves see: http://www.research.microsoft.com/~hollasch/cgindex/curves/cbez-quadspline.html
http://fonts.apple.com/TTRefMan/RM08/appendixE.html
The DefineShape tag defines a shape for later use by control tags such as PlaceObject. The ShapeId uniquely identifies this shape as ‘character’ in the Dictionary. The ShapeBounds field is the rectangle that completely encloses the shape. The SHAPEWITHSTYLE structure includes all the paths, fill styles and line styles that make up the shape.
(See class FDTDefineShape in the Flash File Format SDK)
|
DefineShape |
|
|
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 2 |
|
ShapeId |
UI16 |
ID for this character |
|
ShapeBounds |
Bounds of the shape |
|
|
Shapes |
Shape information |
Extends the capabilities of DefineShape with the ability to support more than 255 styles in the style list and multiple style lists in a single shape. (Macromedia Flash (SWF) 2)
(See class FDTDefineShape2 in the Macromedia Flash File Format (SWF) SDK)
|
DefineShape2 |
||
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 22 |
|
ShapeId |
UI16 |
ID for this character |
|
ShapeBounds |
Bounds of the shape |
|
|
Shapes |
Shape information |
Extends the capabilities of DefineShape2 by extending all of the RGB color fields to support RGBA with alpha transparency. (Macromedia Flash (SWF) 3)
(See class FDTDefineShape3 in the Macromedia Flash File Format (SWF) SDK)
|
DefineShape3 |
||
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 32 |
|
ShapeId |
UI16 |
ID for this character |
|
ShapeBounds |
Bounds of the shape |
|
|
Shapes |
Shape information |
The Macromedia Flash File Format (SWF) SDK contains C++ examples that demonstrate how to create shapes in Macromedia Flash (SWF).
The low-level examples are:
· FExampleRectangle.cpp creates a rectangle from straight edge records.
· FExampleCircle.cpp creates a circle from curved edge records.
· FExampleOval.cpp creates an oval (or ellipse) from curved edge records.
The high-level examples are:
· HFExampleRectangle.cpp creates three rectangles by specifying the origin and size of each rectangle.
· HFExampleCircle.cpp creates two circles by specifying center and radius.
· HFExampleOval.cpp creates an oval by specifying the bounding-box of the oval.


The use case for this option is when another Pipeline job wants call the VectorCAST pipeline job and has checked out the VectorCAST Project. This options sets up the following parameters to be passed in from another Pipeline Job.
- VCAST_PROJECT_DIR - Path to the location of the VectorCAST Project or root of the external SCM checkout. This path will be prefixed to the entry for VectorCAST Project
- VCAST_FORCE_NODE_EXEC_NAME - Forces VectorCAST Jobs to be run on a specific node instead of a node with a label matching the compiler
The two parameters can be used independently. If you are using VCAST_PROJECT_DIR to specify an external VectorCAST Project, please ensure that any setup/tear down script is properly setup. For example, if a setenv.bat is in the external repository, you can prefixed the script as follows:
call ${VCAST_PROJECT_DIR}\setenv.bat
Syntax of what a calling job may use to call a parameterized VectorCAST Pipeline job
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', catchInterruptions : false ) {
build job: 'UnitTestingProject_vcast_pipeline',
parameters: [string(name: 'VCAST_PROJECT_DIR', value: 'C:\\UnitTesting\\Project'),
string(name: 'VCAST_FORCE_NODE_EXEC_NAME', value: 'MyTestNode')]
}


Rendering a Bunch of Cubes
David Kanenwisher • October 16, 2021
swiftIf you thought one moving cube was cool you are gonna love Lots of Moving Cubes!
In some ways this wasn't as hard as I thought it would be. I simply put a bunch of cubes on the screen!
I wanted a new cube to appear in a random place each time the screen is touched. I made this happen by moving the code the creates the point into the code that updates the world in response to a "click" event:
func click() {
switch state {
case .playing:
state = .paused
self.nodes.append(
Node(
location: Point(
Float.random(in: -1...1),
Float.random(in: self.cameraBottom...self.cameraTop),
Float.random(in: 0...1)
),
vertices: VerticeCollection().c[.cube]!
)
)
case .paused:
state = .playing
}
}
The biggest change was moving the random Point code out of Vertices. This became even more important as I tried to keep the points in side the camera by reference the top and bottom of the camera. This made me realize that it's likely some models need to information about the camera. This allows them to make decisions about their geometry if they need to show up in direct relation to the camera in someway.
I also wanted the newest cube to appear red allowing you to track where it goes. This took a bit more adjusting so the color of the Vertices can be changed after the fact. It also revealed a need to have more control of the logic around what cube is red in one place. For instance I have this bit in render()
:
// this probably shouldn't be here but it's currently the easiest place
// to make it happen.
if node === world.nodes.last {
color = Colors().red
}
I didn't fix this yet, but I hope to get to it soon. Gotta eat one bite at a time!


FocaLearn
Set an assignment date to be reminded 1 day before:
Assignment name:
Assignment due date:
Set reminder
Clear reminders
Current reminders:
Book an appointment


Trusted by 31,000+ users globally
Reliable contracts, multifanctionality & best usage of Unify template
Secure & integrated options to create individual & business websites
Look no further you came to the right place. Unify offers everything you have dreamed of in one package.


Toggle navigation
blog.ipedrazas.me
Archives
Categories
Android
6
Architecture
1
Arduino
2
Bitcoin
1
CMS
1
Cassandra
3
DevOps
9
Development
8
Docker
5
Idea
3
London
2
Maker
1
Me
2
Python
2
Spanish
2
Uncategorized
1
analytics
1
books
1
children
3
startups
1
stats
1
Tags
Android
3
Idea
5
stats
1
kubernetes
3
immutable
1
architecture
1
Arduino
1
Cassandra
3
Docker
7
cassandra
2
docker
8
tutorial
1
DevOps
11
ansible
1
vagrant
2
jenkins
1
neo4j
1
devops
2
mesos
3
Mesos
1
apachekafka
1
aws
1
kinesis
1
London
2
coreos
1
lxd
1
meetup
1
ubuntu
1
microservices
1
Development
6
Javascript
1
Python
3
deploy
1
python
2
clinker
1
Java
2
elasticsearch
2
github
1
testing
1
taiga
1
Spanish
4
pycones
2
Me
1
startups
4
Maker
1
RaspberryPi
1
dev
1
gunicorn
1
java
1
tomcat
1
sexism
1
Uncategorized
1
dotmarks
1
children
2
security
1
raspberrypi
1
anti-patterns
1
Archives
2015-11-02 00:40
Snapshot Architecture
2015-08-25
Spaghetti management
2015-08-12
Contain 3
2015-06-25
Deconstructing
2015-06-16
Distance to Mesos
2015-04-03
Everyday Sexism, the Python way
2015-04-01
Docker in the Enterprise
2015-03-24
2nd Docker Birthday, the London Way
2015-03-12
'Using Cassandra in AWS for Dev & Test'
2015-03-06
Buckets of Water
2015-03-04
Managing Clusters
2015-02-23
What do I talk about when I talk about DevOps
2014-11-02
Asistentes a mi taller – PyCoNes 2014
2014-10-30
PyConEs 2014
2014-10-08
Local Taiga with Docker
2014-09-22
The Art of Testing in the rain
2014-09-18
Cassandra and Docker – round 1
2014-09-07
Analytics From my Browsing History
2014-08-22
How to build (and run) Microservices in Java without losing your Sanity
2014-08-05
What’s the Filthiest PostCode in UK? and the Cleanest too!
2014-07-27
GmIT
2014-06-27
Enter Bitcoin
2014-06-18
Thoughts on Docker
2014-06-09
Sólo Chicas
2014-05-04
Distributed Access
2014-03-26
Breeding Entrepreneurs
2013-08-19
Hardware Week
2013-08-15
Arduino Listen to me
2013-07-23
'Vagrant: Up and Running By Mitchell Hashimoto'
2013-06-30
The Challenge
2013-06-28
Monitoring Cron Jobs with Jenkins
2013-06-18
Vagrant, second round
2013-06-15
3 links to save your sanity
2013-06-14
Vagrant, dev love
2013-06-12
(Gunicorn + Python) vs (Tomcat + Java)
2013-06-10
The Wrong Methodology
2013-05-25
Eclipse and Android
2013-04-22
The Pizza example
2013-04-18
Ghost Bed Ideas
2013-04-10
Online vs Offline
2013-04-07
Not The Pizza Example… yet
2013-04-02
Raspberry Pi + webcam = CCTV
2013-03-25
:blibb a Content Manager for humans
2013-03-01
Now in London
2013-02-27
Startups Españolas, This is London Calling
2013-02-26
What’s next?
2013-02-21
Analysis of traffic for My Secret Valentine
2013-02-20
Secret Valentine – Results
2013-02-19
Why Project Managers should have children
2013-02-11
This is London Calling!
2013-02-10
My Secret Valentine – I
2013-02-09
Iterating the Idea
2013-02-08
Love is in the Air — The Challenge
2013-02-07
The Challenge
2013-02-06
Mobile Apps, a workshop
2013-02-05
Why? really, why?


--- layout: oregon-2017/camp-detail title: Offline Camp Code of Conduct tab: coc root_path: ../../ ---
All attendees, speakers, sponsors, partners and volunteers at our camp are required to adhere to the following code of conduct. Organizers will enforce this code throughout the event. We expect cooperation from all participants to help ensure a safe environment for everyone.
We are dedicated to providing a safe and comfortable space for all Offline Campers. If you are being harassed, notice that someone else is being harassed, or have any other questions and/or concerns, please tell an organizer immediately. You can contact the camp organizing team by email, call Teri directly at +1<PHONE_NUMBER>, or talk directly to any camp organizer. You will be able to identify camp organizers at camp because we will introduce ourselves at the beginning AND we will be wearing "camp counselor" badges.
Our camp is dedicated to providing a harassment-free camp experience for everyone, regardless of gender, gender identity and expression, age, sexual orientation, disability, physical appearance, body size, race, ethnicity, religion (or lack thereof), or technology choices. We do not tolerate harassment of camp participants in any form. Sexual language and imagery is not appropriate for any camp venue, including talks, workshops, parties, Twitter and other online media. Unacceptable behavior from any camper, including sponsors and organizers with decision-making authority, will not be tolerated. Anyone asked to stop unacceptable behavior is expected to comply immediately. If a camper engages in unacceptable behavior, the organizers reserve the right to respond with any action the community deems appropriate, up to and including ejection from camp without warning and without refund.

Offline Camp is BYOB and as such, to ensure the safety and comfort of our participants, we have outlined an Alcohol Policy. Offline Camp will only provide non-alcoholic beverages to campers, which means alcoholic beverages will not be sponsored. While this weekend is “BYOB” (aka “bring your own beer”), excessive drunkenness will not be tolerated. As this is a professional event with a mission, things like drinking games, taking shots, etc., are not appropriate behavior. Organizers reserve the right to eject any participant who is exhibiting inappropriate drunken behavior up to and including the involvement of local law enforcement. It should also be mentioned that the presence of any illegal weapons, knives, fireworks, or illegal drugs is strictly prohibited from camp.
Participants asked to stop any harassing behavior are expected to comply immediately.
Sponsors are also subject to the anti-harassment policy. In particular, sponsors should not use sexualized images, activities, or other material. Camp staff (including volunteers) should not use sexualized clothing/uniforms/costumes, or otherwise create a sexualized environment.
If a participant engages in harassing behavior, the camp organizers may take any action they deem appropriate, including warning the offender or expulsion from the camp with no refund.
If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact a member of camp staff immediately.
Camp staff will be happy to help participants contact hotel/venue security or local law enforcement, provide escorts, or otherwise assist those experiencing harassment to feel safe for the duration of the camp. We value your attendance.
We expect participants to follow these rules at all camp and workshop venues and camp-related social events.


Host {0} cannot be found.
The connection with {0} has been lost.
{0} not found.
Cannot log with this username.


ROLE
Mobile Design
DATES
Sept 2014 - April 2015
I have a passion for building social networking apps. I’ve always been interested in psychology and what drives human behavior. Today, people use their devices very often and I think it's great if they can meet new people through their devices. I see a big room for improvement in social networking space — which was one the major motivations to join Unravel.
I came on board at a very early stage, to build the app basically from the ground up. The team had just come up with a few sketches and rough prototypes.
DESIGN GOALS SUMMARY
Design dating iOS app, with modern aesthetic, where the main feature is to unlock someone’s photos by guessing their personality. When two people have unlocked each others' photos — they can chat.
DESIGN METHODS
Sketching and storyboarding, wireframing, creating user flows, designing low to high fidelity mocks, conducting user interviews, A/B tests, focus groups, surveys, user behavior data metrics, usability testing.
We had a short deadline, so I had to design first version of the app within 3-4 weeks. The reason for that deadline is that we were asked to build a beta version fast and iterate on it later when we launch our beta in the UK.
Early wireframes
After discussing and understanding our product goals, I started out by researching our competitors, which include major players such as Tinder, Hinge and Coffee Meets Bagel. I’ve studied their onboarding experience, branding, interaction and navigation patterns. We have noticed that the majority of them use blue as their primary color. We've concluded that red was the best color to convey the look and feel, as well as characteristics of our app, which is activity, passion, joy and sexuality. After a short team meeting we have decided to go with tomato (moderate) red.
Typical user flow
Layout exploration sketches
One of our biggest challenges was to solve the content creation problem. People don’t like to spend much time writing about themselves, but at the same time they want to see a decent amount of information about their potential match. In Unravel you don’t write much about yourself, but you answer 3-10 personal multiple choice questions.
Basic style guide
PERSONAS
To help the team and myself, I’ve come up with 5 simple personas as a way to model, summarize and communicate research about people who have been observed or researched in some way. It served us well in the future.
METRICS
When we have launched our beta in the UK in November 2014, we have been running A/B tests to see what flows, interactions and layouts work better for users. We have been focusing on retention, waterfall and engagement.
ACCESSIBILITY
In the process I was asked to design custom iconography for our tab bar and a few other sections. I was using Adobe Illustrator to create the icons. I’ve run color blind test to make sure that people with color blindness can differentiate between active and inactive icon states.
How people with normal eyesight see
How people with color blindness would see
Wireframing version 2.0 and collection of artboards of the current version.
Game interaction
2.0
Since our official launch in February, I’ve learned a lot from all the A/B tests, and user interviews we have done to start designing a better — 2.0 version of Unravel. Improved layout, smooth onboarding and content creation experience, and a new game flow are coming soon.
One of the main improvements in the 2.0 version was profile and game. Users now have more control over chat configuration, profile and game navigation. Tag line was added to your profile to give a little more information about yourself. View my InVision prototype here.
IMPROVING SIGNUP FLOW
One subtle detail about this flow — the button “Create Account” becomes filled only after 3 characters has been written for username. That way it’s a little hint to a user that the chosen username is good to go. Prior to that we had a problem where new users would try to choose a username consisting of only 2 characters. Due to a technical constraint we wanted to indicate that 3 characters are required in a subtle way. Another way to guide user's attention was through a dynamic photo placeholder. The placeholder is the largest element on the screen and calls for action, but it decreases in size after the photo is chosen. Now all the attention is on the username input.
BREAKING THE ICE
Instead of having the chat screen be empty after two people match, we decided to give both parties a something in common to start a conversation. As a result of this, more people were sending first messages, and more people in return would respond, since the messages were more relevant to their interests.
ANDROID
Since December I’ve also been designing the Android version of Unravel utilizing Google’s material design guidelines. It recently came out in the Google Store, but it’s still at a very early stage.
2016 update. I left Unravel in 2015, but today the product is no longer available.


Solving blaming game
Context: stuck with problems, cannot find root cause, dunno and cannot understand and reproduce problem. Maybe feeling very tired for a long day, already taken 5 hours without any good executions. Maybe you don’t want to take responsibility for that.
Introducing blaming: the fine art of making others responsible for all the difficult things that happen to you.
Nowadays, there are many many contexts & examples for blaming. I only want to wide the scope of this mindset, into SRE/Devops/Sysadmin fields. Why we blaming each others, right or wrong? How can we fix/improve our mindset? How can we do better?
Table of Contents
REAL LIFE EXAMPLE
Working on infras of someone else, working on services that not be built by ourself
- many legacy/unknown components
- bad naming & coding conventions
- lack of resource inventory, lack of useful documents.
- found bad lines of code from developers, but must solve that shitty issue.
- found unacceptable implementations, like opened all ports, all protocols to <IP_ADDRESS>/0 (WTF)
We start blaming others because they are bad, very bad
- Who did it?
- Who’s the interviewer of that f*cker guy?
 Badness
We have a deep need for a sense of identity, and one way we do this is through social comparison, contrasting ourselves against others. If we can place ourselves higher in the pecking order of society then we can feel more important and have a greater sense of control.
We seek a higher status than others. And blame is one of the tools we use to this end. If the other person is bad, then it seems we must be relatively good.
2. Defending
Maybe we’re scared that we’re going to fall, because if our boss found this issue, we will be fire, or cannot have a higher salary. If we are not at fault, we blame to defend. If we are at fault, then we blame to deflect.
3. Attacking
Sometimes we know the reasons of issues are most from our side, but also come from their side. We want to blame others less because we are moving attention away from ourselves and more because we specifically want to attack others.
A common reason to attack others is that we have some grudge against them, believing them to be bad or unworthy in some way and hence deserving punishment. Perhaps they have blamed us unfairly in past. Maybe they have hurt one of our friends. In any case, the opportunity to blame is used as a convenient method of subtle attack.
HOW CAN WE DO BETTER?
 Calm down, breath, take a deep breath, let’s standup and take a coffee/tea cup, then relax your mind.
I recommended that you should switch your mindset from blaming others to thinking that you have a change to make things better.
Even the f*cker is developer or other junior devops/sysdmin. They are bad, lack of knowledge. Your job is inspecting, finding, solving, validating, auditing, not pointing the figure elsewhere.
Disclamer and question:
- If you cannot solve issues, it means you don’t have enough permission and knowledge to blame. RIGHT?
- Blaming or not blaming, at the end, issues still right there. Blaming is not solving problems.
- Why dont we sit down then try to fix that shit?


Email
HackerRank
MD5
Rot13
Pancake Flipper
Welcome to my webpage. Here you will find various ways of contacting me, and tools. The tools are small introductions into frameworks I made for learning purposes.


--- title: Week 2 - Classes and IDs layout: post ---
Why would you use a class or id?
When designing a webpage, we use the language of html. Built into the language are elements such as header, main, section, aside etc. Each of those help the web designer layout their webpage, but they only go so far. As creative people tend to break the mold, it's easy to find a situation where the given elements will not accomplish the styling that one needs.
Scenario A:
You want to create a container for all your blog posts on one page so you can add a blue background behind your articles, but there is no specific html element for that. You could use a div, but you have other div elements already, and you don't want to make all of those blue too.
Scenario B:
You want to highlight a quote from your article by styling it differently from all the other paragraph text. You may have to use more quotes later in the article too.
This is where classes and ids come in handy.
What are classes and ids?
Classes and ids are 'hooks' that can be attached to a particular element and then be 'selected' in the stylesheet (the CSS file).
How are they used?
To create a class or id, you just have to define it inside the element tag.
In html:

In css:
.quotes{ width: 600px; } #blogwrapper{ width: 300px; }
The only difference when selecting the element in the css is that classes are called by using . and ids are called by using # in front of their names.
What is the difference between a class or an id?
The only difference between a class and an id is that classes can be used more than once on a page, and an id once and only once.
A class is like a common characteristic or a shared attribute. When you think of a class of students, you think many. Or economy class on an airplane, which contains many seats.
An id is unique. If I'm a teacher and I take attendence by calling out a student, I would call out one unique id.
When should I use a class, and when should I use an id?
Ask yourself, will I be using this more than once? If so, make a class. If not, make an id.
Now see if you can figure out which ones to use for Scenario A and B above.


--- layout: api title: "v2.0.0 JavaScript Library: L.IProjection" categories: api version: v2.0.0 permalink: /api/v2.0.0/l-iprojection/ ---
An object with methods for projecting geographical coordinates of the world onto a flat surface (and back). See Map projection.
| Method | Returns | Description |
|---|---|---|
project(
|
Point |
Projects geographical coordinates into a 2D point. |
unproject(
|
LatLng |
The inverse of project . Projects a 2D point into geographical location. |
Leaflet comes with a set of already defined projections out of the box:
| Projection | Description |
|---|---|
L.Projection.SphericalMercator |
Spherical Mercator projection — the most common projection for online maps, used by almost all free and commercial tile providers. Assumes that Earth is a sphere. Used by the EPSG:3857 CRS. |
L.Projection.Mercator |
Elliptical Mercator projection — more complex than Spherical Mercator. Takes into account that Earth is a geoid, not a perfect sphere. Used by the EPSG:3395 CRS. |
L.Projection.LonLat |
Equirectangular, or Plate Carree projection — the most simple projection, mostly used by GIS enthusiasts. Directly maps x as longitude, and y as latitude. Also suitable for flat worlds, e.g. game maps. Used by the EPSG:3395 and Simple CRS. |


In this document will demonstrate how to use SOFATracer to track of Datasource.
Assuming you have built a simple Spring Web project based on SOFABoot, Then you can be operated by the following steps:
Introduce SOFATracer
Introduce SOFATracer dependency in the new Spring Boot project:
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>tracer-sofa-boot-starter</artifactId>
<version>2.2.0</version>
</dependency>
Introduce h2database dependencies
For convenience, we use the h2database memory database for test. So, we need to introduce the following dependencies:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
Introduce the required connection pool dependencies
Introduce the required connection pool dependency packages, such as druid, c3p0, tomcat, dbcp, Hikari, and so on.
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.12</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version><IP_ADDRESS></version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>8.5.31</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-java6</artifactId>
<version>2.3.8</version>
</dependency>
Configure data source
Taking HikariCP
as the example, we create a new Spring configuration file named datasource.xml
, which defines the followings:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- dataSource pool -->
<bean id="simpleDataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close" primary="true">
<property name="driverClassName" value="org.h2.Driver"/>
<property name="jdbcUrl" value="jdbc:h2:~/test"/>
<property name="username" value="sofa"/>
<property name="password" value="123456"/>
</bean>
</beans>
Application configuration
- Required configuration
It should be noted that it is required to configure the application name when introducing SOFATracer; otherwise, the application may fails to start. This property is consistent with the SOFABoot framework requirements and is configured as follows:
spring.application.name=SOFATracerDataSource
- Optional configuration
In order to run the sample project normally, you need to configure the h2database properties. Also for easy viewing of logs, configure the log path as follows:
# logging path
logging.path=./logs
# h2 web consloe path
spring.h2.console.path=/h2-console
#enable h2 web consloe, which defaults to false
spring.h2.console.enabled=true
#Allow remote access to h2 web consloe
spring.h2.console.settings.web-allow-others=true
spring.datasource.username=sofa
spring.datasource.password=123456
spring.datasource.url=jdbc:h2:~/test
spring.datasource.driver-class-name=org.h2.Driver
Create a new Rest Service
In order to achieve the demo effect, we create a new Rest service and trigger SQL statement execution to view the tracer records of sql. The Rest service is created as follows:
@RestController
public class SimpleRestController {
@Autowired
private DataSource simpleDataSource;
@RequestMapping("/create")
public Map<String, Object> create() {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
Connection cn = simpleDataSource.getConnection();
Statement st = cn.createStatement();
st.execute("DROP TABLE IF EXISTS TEST;"
+ "CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));");
resultMap.put("success", true);
resultMap.put("result", "CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))");
} catch (Throwable throwable) {
resultMap.put("success", false);
resultMap.put("error", throwable.getMessage());
}
return resultMap;
}
}
You can see that the Rest service has created a table.
Demonstration
Start the application and visit localhost:8080/create
to execute the above Rest service. You can see the Tracer log of sql execution in ./logs/datasource-client-digest.log
and ./logs/datasource-client-stat.log
:
+ datasource-client-digest.log
{"time":"2018-09-05 11:48:16.917","local.app":"SOFATracerDataSource","traceId":"1e323a031536119296795100182779","spanId":"0.1.2","database.name":"test","sql":"DROP TABLE IF EXISTS TEST;CREATE TABLE TEST(ID INT PRIMARY KEY%2C NAME VARCHAR(255));","result.code":"success","total.time":"103ms","connection.establish.span":"92ms","db.execute.cost":"8ms","database.type":"h2","database.endpoint":"jdbc:h2:~/test:-1","current.thread.name":"http-nio-8080-exec-1","baggage":""}
- datasource-client-stat.log (print once in 60s by default)
{"time":"2018-09-05 11:49:10.117","stat.key":{"local.app":"SOFATracerDataSource","database.name":"test"},"count":1,"total.cost.milliseconds":103,"success":"true","load.test":"F"}
Other
Introduce the SOFATracer dependency in the Spring Boot project, which will automatically enable the DataSource events. You can disable starting DataSource by configuring the following switch, which is turned on by default:
com.alipay.sofa.tracer.datasource.enable=false
Notes
- To introduce SOFATracer, it is required to configure the application name; otherwise, the application fails to be started. The property name is:
spring.application.name
. - Based on the standard JDBC interface implementation, SOFATracer 2.2.0 theoretically supports event tracking for all standard database connection pools (such as DBCP, BoneCP, etc.). In Spring Boot environment, automatic event tracking is available for the five connection pools, namely DBCP, Druid, c3p0, tomcat, and HikariCP. It means that you only need to introduce SOFATracer dependency. In non-Spring Boot environment or for other connection pools (such as BoneCP), you need to configure them manually, for example:
<bean id="smartDataSource" class="com.alipay.sofa.tracer.plugins.datasource.SmartDataSource" init-method="init">
<property name="delegate" ref="simpleDataSource"/>
<!--application name-->
<property name="appName" value="yourAppName"/>
<!--database name -->
<property name="database" value="yourDatabase"/>
<!--database type, supporting MYSQL, ORACLE-->
<property name="dbType" value="MYSQL"/>
</bean>
<bean id="simpleDataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://<IP_ADDRESS>/yourdb" />
<property name="username" value="root"/>
<property name="password" value="abcdefgh"/>
...
</bean>
That is, you need to configure the com.alipay.sofa.tracer.plugins.datasource.SmartDataSource
provided by SOFATracer.


EBD - Easton Bible DIctionary
Sponge
SPONGE
"SPONGE "occurs only in the narrative of the crucifixion (
Matthew 27:48
;
Mark 15:36
;
John 19:29
). It is ranked as a zoophyte. It is found attached to rocks at the bottom of the sea.
"SPONGE "occurs only in the narrative of the crucifixion (Matthew 27:48; Mark 15:36; John 19:29). It is ranked as a zoophyte. It is found attached to rocks at the bottom of the sea.


Lufenuron treatment for killing Candida
Day 1†††† Wednesday, April 02, 2014
††††††††††††††† Both Mae and I started taking this treatment today.
††††††††††††††† We each took the Lufenuron powder with our noon meal.
††††††††††††††† By evening neither of us felt any affects or results.
Day 2†††† Thursday, April 03, 2014
††††††††††††††† At 2AM I woke with strong feelings going through out my complete body.† My first thoughts were that it was like the pain that was going through my body when my illness started in 1989.† The pain was a shooting sharp pain that started in one point and traveled to another.† This time instead of pain, it was a strong uncomfortable feeling.† The feeling was occurring throughout my body from my feet to my head, even in my ears.† This lasted for about an hour.† My first reaction was fear; I felt my heart racing and my breath quick and heavy but then I realized that it might be the treatment removing the Candida from my body. ††My next thoughts were of driving the school bus and I was concerned about my motor skills.† I removed my c-pap mask and got out of bed.† I did some movements and walked into the bathroom.† I was steady on my feet and felt no dizziness, so that fear left.† I used the toilet and my bladder and bowels functioned properly.† When I had gone to bed I was constipated but now it moved comfortably on its own.† By now all feelings had returned to normal and I was able to return to sleep until the alarm woke me.
Day 3†††† Friday, April 04, 2014
††††††††††††††† I noticed no changes by this morning.
††††††††††††††† We took the last does of Lufenuron at noon today.
Day 15†† Thursday, April 17, 2014
††††††††††††††† I really havenít seen any significant changes.


{% extends "base.html" %} {% block title %}
Medieval catalogues > UNIVERSITY AND COLLEGE LIBRARIES OF OXFORD > The Queen's College > Indenture of receipt of electio books by Henry Scayfe, 1445
{% endif %}7 identified entries found.
All data was derived from the List of Identifications by Professor Richard Sharpe.
{% if not printing %}
A key to codes used in the List is available (opens in new tab).{% endif %}


--- title: Writing layout: application active: writing ---
I've had the great pleasure of contributing to colleagues' books.
Featured in Discussing Design: Improving Communication and Collaboration through Critique by Adam Connor and Aaron Irizarry
Featured in The Sketchnote Handbook: The Illustrated Guide to Visual Note Taking by Mike Rohde
I write regularly in my newsletter, Finding Out, and occasionally elsewhere. Here a couple highlights to get you started:
Even Facebook researchers struggle to be heard when their findings contradict leadership's wishes. A small paragraph in a Wall Street Journal piece brought to mind my own struggles with sharing research findings, and how these struggles originate with our culture.
Read more on the Finding Out archives
Smooth meetings primarily come down to whether everyone can see and hear what’s going on. While this sounds simple enough, the obstacles to location-independent collaboration are varied and often invisible to those with the most power to remove them.
Read more on the NPR Design Blog
You can check out more in my newsletter, on Medium, and in my personal blog.


In this notebook, a template is provided for you to implement your functionality in stages, which is required to successfully complete this project. If additional code is required that cannot be included in the notebook, be sure that the Python code is successfully imported and included in your submission if necessary.
Note: Once you have completed all of the code implementations, you need to finalize your work by exporting the iPython Notebook as an HTML document. Before exporting the notebook to html, all of the code cells need to have been run so that reviewers can see the final implementation and output. You can then export the notebook by using the menu above and navigating to \n", "File -> Download as -> HTML (.html). Include the finished document along with this notebook as your submission.
In addition to implementing code, there is a writeup to complete. The writeup should be completed in a separate file, which can be either a markdown file or a pdf document. There is a write up template that can be used to guide the writing process. Completing the code template and writeup template will cover all of the rubric points for this project.
The rubric contains "Stand Out Suggestions" for enhancing the project beyond the minimum requirements. The stand out suggestions are optional. If you decide to pursue the "stand out suggestions", you can include the code in this Ipython notebook and also discuss the results in the writeup file.
Note: Code and Markdown cells can be executed using the Shift + Enter keyboard shortcut. In addition, Markdown cells can be edited by typically double-clicking the cell to enter edit mode.
import pickle
import matplotlib
import pandas as pd
import numpy as np
import matplotlib.pyplot as plot
import random
import cv2
import tensorflow as tf
import skimage
from skimage import io
from skimage import transform
from skimage.filters import gaussian
import glob
# Load pickled data
training_file = "./traffic-signs-data/train.p"
validation_file= "./traffic-signs-data/valid.p"
testing_file = "./traffic-signs-data/test.p"
with open(training_file, mode='rb') as f:
train = pickle.load(f)
with open(validation_file, mode='rb') as f:
valid = pickle.load(f)
with open(testing_file, mode='rb') as f:
test = pickle.load(f)
X_train, y_train = train['features'], train['labels']
X_valid, y_valid = valid['features'], valid['labels']
X_test, y_test = test['features'], test['labels']
print("X_train: ", X_train.shape, "y_train:" , y_train.shape )
print("X_valid: ", X_valid.shape, "y_valid:" , y_valid.shape )
print("X_test: ", X_test.shape, "y_test:" , y_test.shape )
The pickled data is a dictionary with 4 key/value pairs:
'features'
is a 4D array containing raw pixel data of the traffic sign images, (num examples, width, height, channels).'labels'
is a 1D array containing the label/class id of the traffic sign. The file signnames.csv
contains id -> name mappings for each id.'sizes'
is a list containing tuples, (width, height) representing the original width and height the image.'coords'
is a list containing tuples, (x1, y1, x2, y2) representing coordinates of a bounding box around the sign in the image. THESE COORDINATES ASSUME THE ORIGINAL IMAGE. THE PICKLED DATA CONTAINS RESIZED VERSIONS (32 by 32) OF THESE IMAGESComplete the basic data summary below. Use python, numpy and/or pandas methods to calculate the data summary rather than hard coding the results. For example, the pandas shape method might be useful for calculating some of the summary results.
#Number of training examples
n_train = X_train.shape[0]
#Number of validation examples
n_valid = X_test.shape[0]
#Number of testing examples.
n_test = X_valid.shape[0]
#What's the shape of an traffic sign image?
image_shape = X_train.shape[1:]
#How many unique classes/labels there are in the dataset.
n_classes = len(np.unique(y_train))
print("Number of training examples =", n_train)
print("Number of validation examples =", n_valid)
print("Number of testing examples =", n_test)
print("Image data shape =", image_shape)
print("Number of classes =", n_classes)
Helper function to get SignName for each label from the CSV line
signs = pd.read_csv('./signnames.csv')
signs.set_index('ClassId',inplace=True)
def getSignNameFromLabel(label):
return signs.loc[label].SignName
Visualize the German Traffic Signs Dataset using the pickled file(s). This is open ended, suggestions include: plotting traffic sign images, plotting the count of each sign, etc.
The Matplotlib examples and gallery pages are a great resource for doing visualizations in Python.
NOTE: It's recommended you start with something simple first. If you wish to do more, come back to it after you've completed the rest of the sections. It can be interesting to look at the distribution of classes in the training, validation and test set. Is the distribution the same? Are there more examples of some classes than others?
### Data exploration visualization code goes here.
### Feel free to use as many code cells as needed.
import matplotlib.pyplot as plt
# Visualizations will be shown in the notebook.
%matplotlib inline
Show one of each traffic sign.
def getOneOfEach():
# List of all the image indeces
selected = list()
# list to keep track of labels selected
slected_labels = list()
# loop until one of each label is found
while len(selected) < 43:
index = np.random.randint(len(y_train))
if y_train[index] not in slected_labels:
selected.append(index)
slected_labels.append(y_train[index])
return list(selected)
plt.figure(figsize=(20,80))
count=0
cols = 10
for index in getOneOfEach():
count+=1
plt.subplot(43,cols,count)
plt.imshow(X_train[index])
plt.axis('off')
Histogram representation of label distribution
hist, bins = np.histogram(y_train, bins=n_classes)
width = 0.7 * (bins[1] - bins[0])
center = (bins[:-1] + bins[1:]) / 2
plot.title("Label distribution Histogram")
plot.xlabel("Labels")
plot.ylabel("Frequency")
plot.bar(center, hist, align='center', width=width)
plot.show()
Design and implement a deep learning model that learns to recognize traffic signs. Train and test your model on the German Traffic Sign Dataset.
The LeNet-5 implementation shown in the classroom at the end of the CNN lesson is a solid starting point. You'll have to change the number of classes and possibly the preprocessing, but aside from that it's plug and play!
With the LeNet-5 solution from the lecture, you should expect a validation set accuracy of about 0.89. To meet specifications, the validation set accuracy will need to be at least 0.93. It is possible to get an even higher accuracy, but 0.93 is the minimum for a successful project submission.
There are various aspects to consider when thinking about this problem:
Here is an example of a published baseline model on this problem. It's not required to be familiar with the approach used in the paper but, it's good practice to try to read papers like these.
Minimally, the image data should be normalized so that the data has mean zero and equal variance. For image data, (pixel - 128)/ 128
is a quick way to approximately normalize the data and can be used in this project.
Other pre-processing steps are optional. You can try different techniques to see if it improves performance.
Use the code cell (or multiple code cells, if necessary) to implement the first step of your project.
# Convert to grayscale
X_train_gry = np.sum(X_train/3, axis=3, keepdims=True)
X_valid_gry = np.sum(X_valid/3, axis=3, keepdims=True)
X_test_gry = np.sum(X_test/3, axis=3, keepdims=True)
# Normalize
X_train_normalized = (X_train_gry - 128)/128
X_valid_normalized = (X_valid_gry - 128)/128
X_test_normalized = (X_test_gry - 128)/128
X_train = X_train_normalized
X_valid = X_valid_normalized
X_test = X_test_normalized
print('Grayscale shape:', X_train.shape)
from tensorflow.contrib.layers import flatten
from sklearn.utils import shuffle
def LeNet(x):
# Arguments used for tf.truncated_normal, randomly defines variables for the weights and biases for each layer
mu = 0
sigma = 0.1
# SOLUTION: Layer 1: Convolutional. Input = 32x32x1. Output = 28x28x6.
conv1_W = tf.Variable(tf.truncated_normal(shape=(5, 5, 1, 6), mean = mu, stddev = sigma))
conv1_b = tf.Variable(tf.zeros(6))
conv1 = tf.nn.conv2d(x, conv1_W, strides=[1, 1, 1, 1], padding='VALID') + conv1_b
# SOLUTION: Activation.
conv1 = tf.nn.relu(conv1)
# SOLUTION: Pooling. Input = 28x28x6. Output = 14x14x6.
conv1 = tf.nn.max_pool(conv1, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='VALID')
# SOLUTION: Pooling. Input = 28x28x6. Output = 14x14x6.
conv2_W = tf.Variable(tf.truncated_normal(shape=(5, 5, 6, 16), mean = mu, stddev = sigma))
conv2_b = tf.Variable(tf.zeros(16))
conv2 = tf.nn.conv2d(conv1, conv2_W, strides=[1, 1, 1, 1], padding='VALID') + conv2_b
# SOLUTION: Activation.
conv2 = tf.nn.relu(conv2)
# SOLUTION: Pooling. Input = 10x10x16. Output = 5x5x16.
conv2 = tf.nn.max_pool(conv2, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='VALID')
# SOLUTION: Flatten. Input = 5x5x16. Output = 400.
fc0 = flatten(conv2)
# SOLUTION: Layer 3: Fully Connected. Input = 400. Output = 120.
fc1_W = tf.Variable(tf.truncated_normal(shape=(400, 120), mean = mu, stddev = sigma))
fc1_b = tf.Variable(tf.zeros(120))
fc1 = tf.matmul(fc0, fc1_W) + fc1_b
# SOLUTION: Activation.
fc1 = tf.nn.relu(fc1)
# drop out
dr1 = tf.nn.dropout(fc1, drop_probability)
# SOLUTION: Layer 4: Fully Connected. Input = 120. Output = 84.
fc2_W = tf.Variable(tf.truncated_normal(shape=(120, 84), mean = mu, stddev = sigma))
fc2_b = tf.Variable(tf.zeros(84))
fc2 = tf.matmul(dr1, fc2_W) + fc2_b
# SOLUTION: Activation.
fc2 = tf.nn.relu(fc2)
# drop out
dr2 = tf.nn.dropout(fc2, drop_probability)
# SOLUTION: Layer 5: Fully Connected. Input = 84. Output = 10.
fc3_W = tf.Variable(tf.truncated_normal(shape=(84, 43), mean = mu, stddev = sigma))
fc3_b = tf.Variable(tf.zeros(43))
logits = tf.matmul(dr2, fc3_W) + fc3_b
return logits
A validation set can be used to assess how well the model is performing. A low accuracy on the training and validation sets imply underfitting. A high accuracy on the training set but low accuracy on the validation set implies overfitting.
x = tf.placeholder(tf.float32, (None, 32, 32, 1))
y = tf.placeholder(tf.int32, (None))
drop_probability = tf.placeholder(tf.float32)
one_hot_y = tf.one_hot(y, 43)
rate = 0.0007
logits = LeNet(x)
cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits, one_hot_y)
loss_operation = tf.reduce_mean(cross_entropy)
optimizer = tf.train.AdamOptimizer(learning_rate = rate)
training_operation = optimizer.minimize(loss_operation)
correct_prediction = tf.equal(tf.argmax(logits, 1), tf.argmax(one_hot_y, 1))
accuracy_operation = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
saver = tf.train.Saver()
def evaluate(X_data, y_data):
num_examples = len(X_data)
total_accuracy = 0
sess = tf.get_default_session()
for offset in range(0, num_examples, BATCH_SIZE):
batch_x, batch_y = X_data[offset:offset+BATCH_SIZE], y_data[offset:offset+BATCH_SIZE]
accuracy = sess.run(accuracy_operation, feed_dict={x: batch_x, y: batch_y, drop_probability: 1.0})
total_accuracy += (accuracy * len(batch_x))
return total_accuracy / num_examples
EPOCHS = 40
BATCH_SIZE = 128
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
num_examples = len(X_train)
print("Training...")
print()
for i in range(EPOCHS):
X_train, y_train = shuffle(X_train, y_train)
for offset in range(0, num_examples, BATCH_SIZE):
end = offset + BATCH_SIZE
batch_x, batch_y = X_train[offset:end], y_train[offset:end]
sess.run(training_operation, feed_dict={x: batch_x, y: batch_y, drop_probability: 0.5})
validation_accuracy = evaluate(X_valid, y_valid)
print("EPOCH {} ...".format(i+1))
print("Validation Accuracy = {:.3f}".format(validation_accuracy))
print()
saver.save(sess, 'lenet')
print("Model saved")
#evaluate the accuracy of the model on the test dataset
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
testsave = tf.train.import_meta_graph('./lenet.meta')
testsave.restore(sess, "./lenet")
test_accuracy = evaluate(X_test, y_test)
print("Test Set Accuracy = {:.3f}".format(test_accuracy))
To give yourself more insight into how your model is working, download at least five pictures of German traffic signs from the web and use your model to predict the traffic sign type.
You may find signnames.csv
useful as it contains mappings from the class id (integer) to the actual sign name.
i=1
plt.figure(figsize=(12,10))
for el in glob.glob('./web_images/*.jpg'):
print (el)
img = io.imread(el)
plt.subplot(1,6,i)
plt.imshow(img)
i+=1
plt.axis('off')
# Read the images
i=1
images_raw = []
labels_raw = []
for el in glob.glob('./web_images/*.jpg'):
label = el.split('/')[-1].split ('.')[-2]
label = int(label)
image = cv2.imread(el)
images_raw.append(image)
labels_raw.append(label)
webimagesnp = np.asarray(images_raw)
webimagesnp_gray = np.sum(webimagesnp/3, axis=3, keepdims=True)
webimagesnp_norm = (webimagesnp_gray - 128)/128
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
websave = tf.train.import_meta_graph('./lenet.meta')
websave.restore(sess, "./lenet")
my_accuracy = evaluate(webimagesnp_norm, labels_raw)
print("Test Set Accuracy = {:.3f}".format(my_accuracy))
For each of the new images, print out the model's softmax probabilities to show the certainty of the model's predictions (limit the output to the top 5 probabilities for each image). tf.nn.top_k
could prove helpful here.
The example below demonstrates how tf.nn.top_k can be used to find the top k predictions for each image.
tf.nn.top_k
will return the values and indices (class ids) of the top k predictions. So if k=3, for each sign, it'll return the 3 largest probabilities (out of a possible 43) and the correspoding class ids.
Take this numpy array as an example. The values in the array represent predictions. The array contains softmax probabilities for five candidate images with six possible classes. tf.nn.top_k
is used to choose the three classes with the highest probability:
# (5, 6) array
a = np.array([[ 0.24879643, 0.07032244, 0.12641572, 0.34763842, 0.07893497,
0.12789202],
[ 0.28086119, 0.27569815, 0.08594638, 0.0178669 , 0.18063401,
0.15899337],
[ 0.26076848, 0.23664738, 0.08020603, 0.07001922, 0.1134371 ,
0.23892179],
[ 0.11943333, 0.29198961, 0.02605103, 0.26234032, 0.1351348 ,
0.16505091],
[ 0.09561176, 0.34396535, 0.0643941 , 0.16240774, 0.24206137,
0.09155967]])
Running it through sess.run(tf.nn.top_k(tf.constant(a), k=3))
produces:
TopKV2(values=array([[ 0.34763842, 0.24879643, 0.12789202],
[ 0.28086119, 0.27569815, 0.18063401],
[ 0.26076848, 0.23892179, 0.23664738],
[ 0.29198961, 0.26234032, 0.16505091],
[ 0.34396535, 0.24206137, 0.16240774]]), indices=array([[3, 0, 5],
[0, 1, 4],
[0, 5, 1],
[1, 3, 5],
[1, 4, 3]], dtype=int32))
Looking just at the first row we get [ 0.34763842, 0.24879643, 0.12789202]
, you can confirm these are the 3 largest probabilities in a
. You'll also notice [3, 0, 5]
are the corresponding indices.
logits = tf.nn.softmax(logits)
top_k = tf.nn.top_k(logits, k=5)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
saver = tf.train.import_meta_graph('./lenet.meta')
saver.restore(sess, "./lenet")
output_logits = sess.run(logits, feed_dict={x: webimagesnp_norm, drop_probability: 1.0})
output_top_k = sess.run(top_k, feed_dict={x: webimagesnp_norm, drop_probability: 1.0})
fig, axs = plt.subplots(len(images_raw),6, figsize=(12, 14))
fig.subplots_adjust(hspace = .4, wspace=.2)
axs = axs.ravel()
for i, image in enumerate(images_raw):
axs[6*i].axis('off')
axs[6*i].imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
axs[6*i].set_title('input')
guess1 = output_top_k[1][i][0]
index1 = np.argwhere(y_valid == guess1)[0]
axs[6*i+1].axis('off')
axs[6*i+1].imshow(X_valid[index1].squeeze(), cmap='gray')
axs[6*i+1].set_title('1st guess: {} ({:.0f}%)'.format(guess1, 100*output_top_k[0][i][0]))
guess2 = output_top_k[1][i][1]
index2 = np.argwhere(y_valid == guess2)[0]
axs[6*i+2].axis('off')
axs[6*i+2].imshow(X_valid[index2].squeeze(), cmap='gray')
axs[6*i+2].set_title('2nd guess: {} ({:.0f}%)'.format(guess2, 100*output_top_k[0][i][1]))
guess3 = output_top_k[1][i][2]
index3 = np.argwhere(y_valid == guess3)[0]
axs[6*i+3].axis('off')
axs[6*i+3].imshow(X_valid[index3].squeeze(), cmap='gray')
axs[6*i+3].set_title('3rd guess: {} ({:.0f}%)'.format(guess3, 100*output_top_k[0][i][2]))
guess4 = output_top_k[1][i][3]
index4 = np.argwhere(y_valid == guess4)[0]
axs[6*i+4].axis('off')
axs[6*i+4].imshow(X_valid[index4].squeeze(), cmap='gray')
axs[6*i+4].set_title('4th guess: {} ({:.0f}%)'.format(guess4, 100*output_top_k[0][i][3]))
guess5 = output_top_k[1][i][4]
index5 = np.argwhere(y_valid == guess5)[0]
axs[6*i+5].axis('off')
axs[6*i+5].imshow(X_valid[index5].squeeze(), cmap='gray')
axs[6*i+5].set_title('5th guess: {} ({:.0f}%)'.format(guess5, 100*output_top_k[0][i][4]))
Note: Once you have completed all of the code implementations and successfully answered each question above, you may finalize your work by exporting the iPython Notebook as an HTML document. You can do this by using the menu above and navigating to \n", "File -> Download as -> HTML (.html). Include the finished document along with this notebook as your submission.


Add an RPC endpoint
Path of the endpoint (e.g., '/execute')
Module whose methods can be executed via the RPC endpoint
RPC endpoint options
Add a custom RPC endpoint
Instance of a class extending the 'RpcEndpoint' class
Initialize class attributes based on the provided command line arguments, environment variables and provided instance options
Register all endpoints to the given server object
Start the RPC server:
Stop the RPC server (print an error message if the server is not running)
RPC Server class


registrationform
Overview
Coredata
Qualifications
Event-specific
Logout
Qualifications
Career
Current work:
Open here
Pupil
Undergraduate
Apprentice
Employee
Freelance
Retiree
Faculty:
Education Institute:
Career:
Save
Knowlege
Mother tongue:
Open here
English
French
German
Italian
Other
1st Additional Language:
Open here
English
French
German
Italian
Other
Translation Knowledge:
Open here
Basic
Good
Great
Interpreting Knowledge:
Open here
Basic
Good
Great
2nd Additional Language:
Open here
English
French
German
Italian
Other
Translation Knowledge:
Open here
Basic
Good
Great
Interpreting Knowledge:
Open here
Basic
Good
Great
3rd Additional Language:
Open here
English
French
German
Italian
Other
Translation Knowledge:
Open here
Basic
Good
Great
Interpreting Knowledge:
Open here
Basic
Good
Great
4th Additional Language:
Open here
English
French
German
Italian
Other
Translation Knowledge:
Open here
Basic
Good
Great
Interpreting Knowledge:
Open here
Basic
Good
Great
Only 4 languages can be chosen!
IT Knowledge:
Open here
None
Basic
Advanced
Expert
Additional Qualifications:
Event Experiences:
Save