Hey,Want to Know your Akan Name
Akan names are derived from the Ghanian culture.
Children in Ghana are given their first name as a 'day
name',which corresponds to the day in the week they were born.
Here are the Ghanian day names:
MALE
- Sunday:Kwasi
- Monday:Kwadwo
- Tuesday:Kwabena
- Wednesday:Kwaku
- Thursday:Yaw
- Friday:Kofi
- Saturday:kwame
FEMALE
- Sunday:Akosua
- Monday:Adwoa
- Tuesday:Abenaa
- Wednesday:Akua
- Thursday:Yaa
- Friday:Afua
- Saturday:Ama


Git Gud v0.1.0 GitRekt.WireProtocol behaviour View Source
Conveniences for Git transport protocol and server side commands.
Link to this section Summary
Functions
Returns a stream of decoded PKT-LINEs for the given pkt
Returns true
if service
is done; elsewhise returns false
Returns an PKT-LINE encoded representation of the given lines
Returns a new service object for the given repo
and executable
Runs the given service
to the next step
Returns the given data
formatted as PKT-LINE
Returns a stream describing each ref and it current value
Runs all the steps of the given service
at once
Sets the given service
to the next logical step without performing any action
Callbacks
Callback used to transist a service to the next step
Callback used to transist a service to the next step without performing any action
Link to this section Functions
Returns a stream of decoded PKT-LINEs for the given pkt
.
Returns true
if service
is done; elsewhise returns false
.
Returns an PKT-LINE encoded representation of the given lines
.
Returns a new service object for the given repo
and executable
.
Runs the given service
to the next step.
Returns the given data
formatted as PKT-LINE
reference_discovery(GitRekt.Git.repo(), binary()) :: iolist()
Returns a stream describing each ref and it current value.
Runs all the steps of the given service
at once.
Sets the given service
to the next logical step without performing any action.
Link to this section Callbacks
Callback used to transist a service to the next step.
Callback used to transist a service to the next step without performing any action.


--- ---
Crocetta del Montello -- Treviso (Italy)
Last updated on {{ site.time | to_utc }}
careers.stackoverflow.com/edymtt
http://stackoverflow.com/users/753737/edymtt
I'm a computer enthusiast for 13 years and a professional software developer with 4 years of experience.
I enjoy designing and writing clear, testable and maintainable applications; to achieve this I practice unit testing, I refactor ``legacy code'' and I employ object oriented and functional paradigms.
I'm well versed in exploring new technologies to assess their characteristics and the problems they pose in their adoption. I employ both theory and experience to deliver software in a successful fashion.
I strive to continually improve my skills, to apply best practices in my daily work and to keep myself up to date -- in this period I'm sharpening up my management skills (now I'm reading Peopleware), I'm studying how to build compilers and I'm exploring how to perform lengthy builds with continuous integration servers.
I aspire to work as a Software Engineer, Software Engineer in Test or Build Engineer (or equivalent roles), possibly on operating systems, compilers, developer tools or real-time/embedded systems.
Development, maintenance and support of software for Points of Sale (.NET 3.5/4.0/4.5):
Online and approximate algorighms, concurrency, distributed systems, cryptography, semantics of programming languages, static analysis, data warehouse, business intelligence, multimedia, hypermedia, audio/video compression, bioinformatics, real-time systems, information retrieval, wireless networks, ITIL v2, abstract algebra, constraint programming, machine learning
Programming, algorithms, software engineering, relational databases, SQL , XML, probability, statistics, logic, operational research, programming languages, linear algebra, mathematical analisys, computer architectures, operating systems, networks, automata, numerical analysis, artificial intelligence, discreet mathematics, security
Computer science (programming, operating systems, DBMS, boolean logic), mathematics (analysis, integral, derivatives), electronics (transistors, operational amplifiers, logical ports), statistics (probability, stochastics variables)
Further details at www.edymtt.io
Object oriented paradigm, functional paradigm, design, profiling, distributed systems, compensation, bug tracking, single responsibility principle, unit testing, separation of concerns, test automation, build automation, backward compatibility and versioning
.NET (from 1.1 to 4.5), Visual Basic .NET, LINQ, C#, async, NuGet, Java, C++, C, SQL (Transact SQL), Ruby, XML, regular expressions, Windows Forms, Windows Presentation Foundation (WPF), Windows Azure Compute (PaaS), Storage, Windows Azure Service Bus, Windows Azure Caching, ACS 2.0, Windows Azure Active Directory, Visual Studio 2003/2005/2008/2010/2012, Eclipse, SQL Server 2008/2008 R2, SQL Azure, SQL Compact 3.5, Sqlite 3, Subversion, Mercurial, Git, Team Foundation Server 2010, git-tfs, LLBLGen Pro 2/3/3.1, Entity Framework 4, Jenkins, MSBuild, Make, rake, Windows Communication Foundation (WCF), HTML 5, CSS, Javascript, ASP.NET, ASP.NET MVC and Web Api, Fiddler, OAuth 2.0, Bootstrap, Jekyll, Mac OS X, Linux (Ubuntu, Fedora, Debian), Windows, Android, Touch typist (Self-taught, QWERTY, mostly italian layout, about 47 words-per-minute), LaTeX, Markdown, Textile, Powershell, VMware Fusion, VirtualBox, ECDL, OData, Bash (interactive usage and scripting), ILSpy
According to the Common European Framework of Reference (CEF) level
In real life:


You can list your NFT in the Marketplace Platform. You can Sell/Trade it for a fixed price or in an auction. In auction you have provided the starting price and auction end time. The highest bidder at the end of auction will get your NFT
Next Question: How to Buy NFT?.


(Route : File Menu, Terminal Command, Edit Button)
The Font tab page allows you to select which font will be used in the Terminal window.
This is a Hot Spot image. Move your mouse pointer over the image
and when the mouse pointer changes to the shape of a hand click
the left mouse button once for extra help.
Choose the font type from the Font list, the font style from the Style list and the font size from the Size list.
A sample of the font that you have chosen will be displayed in the Sample view underneath the list boxes.


Indira Gandhi remembered
Congress cadre celebrate birth anniversary of former PM
by Special CorrespondentCongress cadre led by District Congress Committee president Manala Mohan Reddy, here on Tuesday, paid homage to former Prime Minister Indira Gandhi on the occasion of her 103rd birth anniversary by garlanding her statue and portrait. They observed a two-minute silence in her memory.
Speaking on the occasion, Mr. Mohan Reddy said that Indira Gandhi was a great visionary leader and made efforts to alleviate poverty by nationalising banks, launched 20-point programme and several other welfare schemes. Her ‘Gareebi Hatao’ slogan helped combat poverty, he said and added that the nation became strong during her reign with the nuclear test at Pokhran.
Among those who attended the meeting at Congress Bhavan included the former DCC president Taher Bin Hamdan, Anthireddy Raji Reddy, Sekhar Goud, Panchareddy Charan, Usha Rani and Vijayalaxmi. In Kamareddy at the party office the party cadres led by DCC president K. Srinivas paid tributes to Indira Gandhi.


|
| dictionary | error_messages |
| |
| | profile_username_both |
| |
| | profile_password_both |
| |
| | profile_confirm_password_both |
| |
A form that changes the user's username and password.
Definition at line 10 of file change_username_password_form.py.
◆ __init__()
| def capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.__init__ |
( |
|
self, |
|
|
|
args, |
|
|
|
kwargs |
|
) |
| |
◆ clean_profile_confirm_password_both()
| def capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.clean_profile_confirm_password_both |
( |
|
self | ) |
|
Clean the change-username-and-password form. Raise an error if the passwords do not match,
otherwise return the password.
:return: The password provided.
Definition at line 59 of file change_username_password_form.py.
◆ save_profile()
| def capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.save_profile |
( |
|
self, |
|
|
|
request |
|
) |
| |
This function saves the user's new username and new password.
:param request: The HTML request containing the user's information.
:return: True if the information was updated successfully.
Definition at line 88 of file change_username_password_form.py.
◆ update_profile()
| def capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.update_profile |
( |
|
self, |
|
|
|
request |
|
) |
| |
This function facilitates updating the username and password.
:param request: The HTML requets containing the user's existing information.
:return: False if the profile was not updates, otherwise True.
Definition at line 109 of file change_username_password_form.py.
◆ username_available()
| def capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.username_available |
( |
|
self | ) |
|
This function checks if a username is available or already being used. If the username is not available, a
Validation Error will be raised.
:return: None.
Definition at line 100 of file change_username_password_form.py.
◆ error_messages
| dictionary capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.error_messages |
|
static |
Initial value:= {
'unavailable_username': _("The username is unavailable."),
'password_mismatch': _("The two password fields didn't match.")}
Definition at line 14 of file change_username_password_form.py.
◆ profile_confirm_password_both
| capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.profile_confirm_password_both |
|
static |
Initial value:= forms.CharField(
label=("Confirm Password"),
max_length=20,
widget=forms.PasswordInput(
attrs={'class': 'form-control',
'placeholder': 'Confirm password'}),
strip=False,
help_text=("Enter the same password as before, for verification."))
Definition at line 35 of file change_username_password_form.py.
◆ profile_password_both
| capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.profile_password_both |
|
static |
Initial value:= forms.CharField(
label=_("Password"),
max_length=20,
strip=False,
widget=forms.PasswordInput(
attrs={'class': 'form-control',
'placeholder': 'Enter password'}))
Definition at line 27 of file change_username_password_form.py.
◆ profile_username_both
| capstoneproject.app_forms.change_username_password_form.ChangeUsernamePasswordForm.profile_username_both |
|
static |
Initial value:= forms.CharField(
label=_("Username"),
max_length=20,
strip=False,
widget=forms.TextInput(
attrs={'class': 'form-control',
'placeholder': 'Enter username'}),
help_text=_("Enter a username with less than 20 characters."))
Definition at line 18 of file change_username_password_form.py.
The documentation for this class was generated from the following file:


{% extends 'layout.html' %} {% set pageName='Data download' %} {% block page_heading %}
This data has been moved to Data Workspace.
The data downloads previously on this page are now available on Data Workspace. Follow the links below for the data you need.
Note that you can still download search results in Data Hub. See the help article on downloading for guidance
Make sure you know the rules and your responsibilities around handling Official Sensitive DIT information. More information can be found on the intranet about Using management information (MI) and Knowledge and information management: principles.


My passion for technology began in high school when I became fascinated with animation, such as films by Pixar. Not knowing how to get started with animation, I enrolled at San Francisco State University as a Computer Science major. There, I discovered computer programming, and everything changed.
I am highly interested in mobile development, but I enjoy learning different kinds of technology. My goal is to develop products that people will find beneficial in their everyday lives.
Skillset: Java, Swift, iOS Development, Android Development, Git,
HTML/CSS, JavaScript
Feel free to email me with feedback on my projects, new project ideas, or even a collaboration on your projects!


A template system can be used to separate output formatting specifications, which govern the appearance and location of output text and data elements, from the executable logic which prepares the data and makes decisions about what appears in the output.
Template systems lie along a continuum of power versus separation. "Powerful" constructs like variable assignment or conditional statements make it easy to modify the look of an application within the template system exclusively, without having to modify any of the underlying "application logic". They do so, however, at the cost of separation, turning the templates themselves into part of the application logic.
This template system leans strongly towards preserving the separation of logic and presentation. It is intentionally constrained in the features it supports and, as a result, applications tend to require quite a bit of code to instantiate a template. This may not be to everybody's tastes. However, while this design limits the power of the template language, it does not limit the power or flexibility of the template system. This system supports arbitrarily complex text formatting. Many Google applications, including the "main" Google web search, use this system exclusively for formatting output.
Finally, this system is designed with an eye towards efficiency. Template instantiation is very quick, with an eye towards minimizing both memory use and memory fragmentation.
There are two parts to the Google Template System:
The templates are text files that contain the format specification for the formatted output, i.e, the template language. The data dictionaries contain the mappings from the template elements (markers) embedded in the templates to the data that they will format. Here's a simple template:
<title>{{TITLE}}</title>{{META_TAGS}} {{BODY}}
Here's a dictionary that one could use to instantiate the template:
{"TITLE": "Template example", "BODY": "This is a simple template example.\nIt's boring", "DATE": "11/20/2005"}
If we instantiated the template with this dictionary, here's the output we would get:
<title>Template example</title> This is a simple template example. It's boring
{{TITLE}}
and {{{BODY}}
are template
elements, also called markers. In the dictionary,
TITLE
, BODY
, and DATE
are
dictionary names, and the values associated with each one, such
as 11/20/2005
, are dictionary values.
A few points are clear even from this simple example:
DATE
, and to insert the date into the dictionary
already formatted. DATE
is entirely ignored. {{META_TAGS}}
is not found in the
dictionary. This is perfectly legal; missing variable markers
evaluate to the empty string. The template language has four types of markers:
{{VARIABLE}}
{{#SECTION_NAME}}...{{/SECTION_NAME}}
{{>FILENAME}}
{{! comment lives here -- cool, no?}}
These marker types each have their own namespace. For readability, however, it is best to not overuse a single name.
Anything found in a template of the form {{...}}
is
interpreted as a template marker. All other text is considered
formatting text and is output verbatim at template expansion time.
Formatting text may consist of HTML tags, XML tags, linefeeds and
other spacing characters, constant text, etc.
A data dictionary is a map from keys to values. The keys are
always strings, each string representing either a variable, a section,
or a template-include file. (Comments are not stored in the data
dictionary!) These values correspond to the name of the associated
template marker: a section {{#FOO}}
in the template text
is matched to the key "FOO"
in the dictionary, if it
exists. Note the case must match as well.
The value associated with a key differs according to key type. The value associated with a variable is simple: it's the value for that variable. Both keys and values can be any 8-bit character-string, and may include internal NULs (\0).
The value associated with a section is more complicated, and somewhat recursive: it's a list of data dictionaries. Come template-expansion time, the section is expanded once for each dictionary in the list, so if there are two dictionaries in the list, then the section text will occur in the output twice. The first time, all variables/etc. in the section will be evaluated taking into account the first dictionary. The second time, all variables/etc. will be evaluated taking into account the second dictionary. (See below for a definition of "taking into account.")
A template-include is a special type of section, so the associated value is the same: a list of dictionaries. Template-includes also have one other, mandatory associated piece of information: the filename of the template to include. This filename may be specified either as an absolute path, or as a relative path. (In the latter case, the path is taken relative to the template_root, as set by the application.)
The application program is responsible for building this data dictionary, including all nesting. It then applies this dictionary to a single template to produce formatted output.
A program using Google Templates typically reads in templates at load time. During the course of program execution, the program will repeatedly perform the following two steps: first, instantiate a data dictionary, and second, apply the dictionary to the template to produce output.
The template system applies a dictionary to a template by finding
all template markers in the template, and replacing them with the
appropriate dictionary values. It matches template markers to
dictionary keys in the obvious way. For instance, a template marker
{{FOO}}
matches the dictionary key FOO
.
{{FOO:html_escape}}
matches FOO
as well. The
marker {{#BAR}}
matches the dictionary key
BAR
, as does the marker {{/BAR}}
. The
marker {{>BAZ}}
matches the dictionary key
BAZ
. (And of course, the marker {{!
comment}}
doesn't match any dictionary key at all.)
Template-variables can also have modifiers. In that case, the template-system starts by finding the appropriate value for that variable in the dictionary, just like normal. Then it applies each modifier to the variable, left to right. Finally, it emits the modified value to the output. Template-includes can have modifiers in a similar way. In such cases, after the sub-template is expanded, but before its content is injected into the current template, it has the modifiers applied.
If no dictionary key is found for a given template marker, then the template marker is ignored: if a variable, it expands to the empty string; if a section or include-template, the section or include-template is expanded zero times.
All names are case sensitive. Names -- that is, variable keys and,
as a result, template markers -- must be made of (7-bit ascii)
alphanumeric characters and the underscore. The commment marker,
which does not map to dictionary keys, may contain any chararacters
whatsoever except }
, the close-curly brace. It's a
syntax error for any template marker to violate this rule.
Outside of the template markers, templates may contain any text whatsoever, including (single) curly braces and NUL characters.
Recall that variables look like this: {{VARNAME}}
. We
actually allow a more generic form: the variable name may be followed
by one or more modifiers. A modifier is a filter that's
applied at template-expand time, that munges the value of the variable
before it's output. For instance, consider a template that looks like
this:
{{NAME:html_escape}}
This asks the template system to apply the built-in
html_escape
modifier when expanding
{{NAME}}
. If you set NAME
in your
dictionary to be Jim & Bob
, what will actually be
emitted in the template is Jim & Bob
.
Modifiers work for variable names and also for template-includes:
{{>SUB_TEMPLATE:html_escape}}
means that when you expand
SUB_TEMPLATE
, html-escape the expanded text before
inserting it into the current template.
You can chain modifiers together. This template first html-escapes
NAME
, and then javascript-escapes that result:
{{NAME:html_escape:javascript_escape}}
Modifiers typically have a long, descriptive name and also a one-letter abbreviation. So this example is equivalent to the previous one:
{{NAME:h:j}}
Here are the modifiers that are built in to the template system:
| long name | short name | description |
|---|---|---|
:html_escape | :h |
html-escapes the variable before output
(eg & -> & ) |
:pre_escape | :p |
pre-escapes the variable before output (same as html_escape but whitespace is preserved; useful for
...
) |
:url_query_escape | :u |
performs URL escaping on the variable before output.
space is turned into +, and everything other than [0-9a-zA-Z.,_:*/~!()-], is
transformed into %-style escapes. Use this when you are building
URLs with variables as parameters:
{{QUERY:h}} |
:javascript_escape | :j |
javascript-escapes the variable before output
(eg " -> \" ) |
:cleanse_css | :c |
Removes characters not safe for a CSS value. Safe characters are alphanumeric, space, underscore, period, coma, exclamation mark, pound, percent, and dash. |
:json_escape | :o |
json-escapes a variable before output as a string in json;
similar to javascript escaping, but ignores characters such
as = and & . |
:html_escape_with_arg | :H |
special purpose html escaping. See below for details |
:url_escape_with_arg | :U |
special purpose url escaping. See below for details |
:none | leaves the variable as is |
The html_escape_with_arg
and url_escape_with_arg
modifiers are a bit different
because they requires a value to specify the type of escaping to use.
For example, this template is equivalent to using
the pre_escape
modifier:

{{BODY:H=pre}}

Here are the values that are supported by
the html_escape_with_arg
modifier:
| value | description |
|---|---|
=snippet |
like html_escape , but allows HTML entities and
some tags to pass through unchanged. The allowed tags
are
 , <wbr> ,  ,
and  . |
=pre |
same as pre_escape |
=url |
same as :U=html below. For backwards compatibility. |
=attribute |
replaces characters not safe for an use in an unquoted attribute with underscore. Safe characters are alphanumeric, underscore, dash, period, and colon. |
Here are the values that are supported by
the url_escape_with_arg
modifier:
| value | description |
|---|---|
=html |
Ensures that a variable contains a safe URL. Safe means that
it is either a http or https URL, or else it has no protocol
specified. If the URL is safe it is html-escaped, otherwise
it is replaced with # . |
=javascript |
Same as =html , but using javascript escaping
instead of html escaping. |
=query |
Same as url_query_escape . |
NOTE: At the moment, there are no filters for handling XML attributes and text nodes. For HTML snippets, use the html filter; in other situations, it may be appropriate to use CDATA blocks.
In addition to the built-in modifiers, you can write your own
modifier. Custom modifiers must have a name starting with "x-", and
the name can contain alphanumeric characters plus dashes and
underscores. Custom modifiers can also accept values with any
character except for :
and }
. For example this
template could be a valid use of a custom modifier:
{{VAR:x-my_modifier:value1,value2,value3 has spaces,etc}}
See <template_modifiers.h>
for details on how to write a modifier and how to register it (there's
also an example of a custom
modifier below).
The dictionary structure is a tree: there's a 'main' dictionary, and then sub-dictionaries for each section or include-template. Even with all this complexity, the lookup rules are mostly straightforward: when looking up a marker -- be it a variable, section, or include-template marker -- the system looks in the currently applicable dictionary. If it's found there, great. If not, and the parent dictionary is not an include-template, it continues the look in the parent dictionary, and possibly the grandparent, etc. That is, lookup has static scoping: you look in your dictionary and any parent dictionary that is associated with the same template-file. As soon as continuing the lookup would require you to jump to a new template-file (which is what include-template would do), we stop the lookup.
For instance, for a template that says
{{#RESULTS}}{{RESULTNUM}}. {{>ONE_RESULT}}{{/RESULTS}}
,
"ONE_RESULT"
is looked for in the "RESULTS" dictionary,
and if not found there, is looked for in the main, top-level
dictionary. Likewise, the variable "RESULTNUM"
is looked
for first in the "RESULTS" dictionary, then in the main dictionary if
necessary. However, "ONE_RESULT" will not do equivalent cascading
lookups. In fact, it will have no parent dictionaries at all, because
it's a different template file and thus in a different scope.
Because of these scoping rules, it's perfectly reasonable to set
all variables that are needed in a given template file, in the
top-level dictionary for that template. In fact, the ShowSection()
function is provided to
support just this idiom. To avoid confusion in such a usage mode,
it's strongly encouraged that you give unique names to all sections
and include-templates in a single template file. (It's no problem,
given the template scoping rules, for a single section or
include-template name to be repeated across different template
files.)
There's a single special case: the global variable dictionary. Every dictionary inherits its initial set of values from the global dictionary. Clients can set variables in the global dictionary just like they can in normal template dictionaries they create.
The system initializes the global dictionary with a few useful
values for your convenience. All system variables are prefixed with
BI
, to emphasize they are "built in" variables.
BI_SPACE
, which has the value
<space>
. It is used to force a space
at the beginning or end of a line in the template,
where it would normally be suppressed. (See below.) BI_NEWLINE
, which has the value
<newline>
It is used to force a
newline at the end of a line, where it would normally
be suppressed. (See below.) As is usual for inheritence, if a user explicitly assigns a value
to these variable-names in its own dictionary, this overrides the
inherited value. So, dict->SetValue("BI_SPACE",
" ")
causes BI_SPACE
to have the value
, rather than <space>
, when
expanding dict
.
Note that only variables can be inherited from the global dictionary, not section dictionaries or include-file dictionaries.
A couple of small implementation notes: global inheritence is "last
chance", so if a section's parent dictionary redefined
BI_SPACE
, say, the section dictionary inherits the
parent-dict value, not the global-dict value. Second, variable
inheritence happens at expand time, not at dictionary-create time. So
if you create a section dictionary, and then afterwards set a variable
in its parent dictionary (or in the global dictionary), the section
will inherit that variable value, if it doesn't define the
value itself.
Most application code concerns filling a template dictionary, but there is also code for loading templates themselves from disk. A final category of code lets you inspect and control the template system.
The code below assumes the default configuration option of putting
all template code in namespace google
.
The main routine to load a template is
google::Template::GetTemplate()
, defined in
template.h
. This is a static, factory method, that loads
a template from either disk or from an internal template cache, and
returns a pointer to a Template
object. Besides a
filename to load from, this routine takes a 'strip' argument which
defines how to expand whitespace found in a template file. It can
have one of the following values:
google::DO_NOT_STRIP
: do nothing. This expands the
template file verbatim.
google::STRIP_BLANK_LINES
: remove all blank
lines when expanding. This ignores any blank lines found in
the template file when expanding. When the template is html,
this reduces the size of the output text without requiring a
sacrifice of readability for the input file.
google::STRIP_WHITESPACE
: remove not only blank lines when
expanding, but also whitespace at the beginning and end of each
line. It also removes any linefeed (possibly following
whitespace) that follows a closing '}}' of any kind of template
marker except a template variable. (This means a
linefeed may be removed anywhere by simply placing a comment
marker as the last element on the line.) When the template is
html, this reduces the size of the output html without changing
the way it renders (except in a few special cases). When using
this flag, the built-in template variables
BI_NEWLINE
and BI_SPACE
can be useful
to force a space or newline in a particular situation.
This factory method returns NULL if the template cannot be found, or if there is a syntax error trying to load it.
Besides loading templates, the application can also ask the
template system to reload a template, via
template->ReloadIfChanged()
. (You can also reload all
templates at once via google::Template::ReloadAllIfChanged()
.)
ReloadIfChanged()
looks on disk, and if it notices the
template file has changed since the last load, it will reload the
template from disk, replacing the old contents. Actually, the reload
is done lazily: ReloadIfChanged
just sets a bit that
causes the template to be reloaded next time GetTemplate
is called.
The class google::TemplateDictionary
is used for all template
dictionary operations. new google::TemplateDictionary(name)
is
used to create a new top-level dictionary.
dict->AddSectionDictionary(name)
and
dict->AddIncludeDictionary(name)
are used to create
sub-dictionaries for sections or include-files. After
creating a dictionary, the application should call one or more
functions for each marker in the template. As an example, consider
the following template:
 {{! This page has no head section.}} {{#CHANGE_USER}} Click here if you are not {{USERNAME}}
 {{/CHANGE_USER}} Last five searches:
 {{#PREV_SEARCHES}
 {{PREV_SEARCH}} {{/PREV_SEARCHES}}
 {{>RESULT_TEMPLATE}} {{FOOTER}}
To instantiate the template, the user should call a function to set
up FOOTER
, and a function to say what to do for the
sections CHANGE_USER
and PREV_SEARCHES
, and
for the include-template RESULT_TEMPLATE
. Quite likely,
the application will also want to create a sub-dictionary for
CHANGE_USER
, and in that sub-dictionary call a function
to set up USERNAME
. There will also be sub-dictionaries
for PREV_SEARCHES
, each of which will need to set
PREV_SEARCH
. Only when this is all set up will the
application be able to apply the dictionary to the template to get
output.
The appropriate function to call for a given template marker depends on its type.
For variables, the only interesting action is to set the variable's
value. For most variables, the right method to call is
dict->SetValue(name, value)
. (The name and value
can be specified as strings in a variety of ways: C++ strings, char
*'s, or char *'s plus length.)
There are two other ways to set a variable's value as well, each
with a different scoping rule. You can call
google::TemplateDictionary::SetGlobalValue(name, value)
-- no TemplateDictionary
instance needed here -- to set a
variable that can be used by all templates in an application. This
is quite rare.
You can also call dict->SetTemplateGlobalValue(name,
value)
. This sets a variable that is seen by all child
dictionaries of this dictionary: sub-sections you create via
AddSectionDictionary
, and included templates you create
via AddIncludeDictionary
(both described below). This
differs from SetValue()
, because SetValue()
values are never inherited across template-includes. Almost always,
SetValue
is what you want;
SetTemplateGlobalValue
is intended for variables
that are "global" to a particular template but not all templates, such
as a color scheme to use, a language code, etc.
To make it easier to use SetValue()
, there are a few
helper routines to help setting values of a few special forms.
SetIntValue(name, int)
: takes an int as the value. SetEscapedValue(name, value, escape_functor)
:
escapes the value, using the escape-functor, which takes a
string as input and gives a "munged" string as output.
TemplateDictionary
has a few escape-functors built
in, including html_escape
, which replaces
<
, >
, &
, and
"
with the appropriate html entity;
xml_escape
, which deals with the
entity; and
javascript_escape
, which escapes quotes and other
characters that are meaningful to javascript. These are
helpful in avoiding security holes when the template is
html/xml/javascript. You can also define your own functor; see
the example below. SetFormattedValue(name, fmt, ...)
: the
fmt
and ...
work just like in
printf
: SetFormattedValue("HOMEPAGE",
"http://%s/", hostname)
. SetEscapedFormattedValue(name, escape_functor, fmt,
...)
: formats the value just like printf
,
and then escapes the result using the given functor. Example:
google::TemplateDictionary* dict = new google::TemplateDictionary("var example"); dict->SetValue("FOOTER", "Aren't these great results?"); class StarEscape : public template_modifiers::TemplateModifier { void Modify(const char* in, size_t inlen, const template_modifiers::ModifierData* per_expand_data, ExpandEmitter* outbuf, const string& arg) const { outbuf->Emit(string("*") + string(in, inlen) + string("*")); } }; dict->SetEscapedValue("USERNAME", username, StarEscape());
Note that the template itself can also specify escaping via variable modifiers! It's very possible for you to escape the value when setting it in the dictionary, and then have the template escape it again when outputting, so be careful you escape only as much as you need to.
Sections are used in two ways in templates. One is to expand some
text multiple times. This is how PREV_SEARCHES
is used
in the example above. In this case we'll have one small
sub-dictionary for each of the five previous searches the user did.
To do this, call AddSectionDictionary(section_name)
to create the sub-dictionary. It returns a
TemplateDictionary*
that you can use to fill the
sub-dictionary.
The other use of sections is to conditionally show or hide a block
of text at template-expand time. This is how CHANGE_USER
is used in the example template: if the user is logged in, we show the
section with the user's username, otherwise we choose not to show the
section.
This second case is a special case of the first, and the "standard"
way to show a section is to expand it exactly one time, by calling
AddSectionDictionary()
once, and then setting
USERNAME
in the sub-dictionary.
However, the hide/show idiom is so common there are a few
convenience methods to make it simpler. The first takes advantage of
the fact sections inherit variables from their parent: you set
USERNAME
in the parent dictionary, rather than a section
sub-dictionary, and then call ShowSection()
, which adds a
single, empty dictionary for that section. This causes the section to
be shown once, and to inherit all its variable values from its
parent.
A second convenience method is written for the particular case we
have with USERNAME
: if the user's username is non-empty,
we wish to
show the section with USERNAME
set to the username,
otherwise we wish to hide the section and show neither
USERNAME
nor the text around it. The method
SetValueAndShowSection(name, value, section_name)
does
exactly that: if value is non-empty, add a single single dictionary to
section_name
and call section_dict->AddValue(name,
value)
. There's also SetEscapedValueAndShowSection(name,
value, escape_functor, section_name)
, which lets you escape
value
.
Example:
using google::TemplateDictionary; TemplateDictionary* dict = new TemplateDictionary("section example"); const char* username = GetUsername(); // returns "" for no user if (username[0] != '\0') { TemplateDictionary* sub_dict = dict->AddSectionDictionary("CHANGE_USER"); sub_dict->SetValue("USERNAME", username); } else { // don't need to do anything; we want a hidden section, which is the default } // Instead of the above 'if' statement, we could have done this: if (username[0] != '\0') { dict->ShowSection("CHANGE_USER"); // adds a single, empty dictionary dict->SetValue("USERNAME", username); // take advantage of inheritence } else { // don't need to do anything; we want a hidden section, which is the default } // Or we could have done this: dict->SetValueAndShowSection("USERNAME", username, "CHANGE_USER"); // Moving on... GetPrevSearches(prev_searches, &num_prev_searches); if (num_prev_searches > 0) { for (int i = 0; i < num_prev_searches; ++i) { TemplateDictionary* sub_dict = dict->AddSectionDictionary("PREV_SEARCHES"); sub_dict->SetEscapedValue("PREV_SEARCH", prev_searches[i], TemplateDictionary::html_escape); } }
Template-include markers are much like section markers, so
SetIncludeDictionary(name)
acts, not surprisingly,
exactly like SetSectionDictionary(name)
. However, since
variable inheritence doesn't work across include boundaries, there is
no template-include equivalent to ShowSection()
or
SetValueAndShowSection()
.
One difference bewteen template-includes and sections is that for a
sub-dictionary that you create via
SetIncludeDictionary()
, you must call
subdict->SetFilename()
to indicate the name of the
template to include. If you do not set this, the sub-dictionary will
be ignored. The filename may be absolute, or relative, in which case
it's relative to template_root.
Example:
using google::TemplateDictionary; TemplateDictionary* dict = new TemplateDictionary("include example"); GetResults(results, &num_results); for (int i = 0; i < num_results; ++i) { TemplateDictionary* sub_dict = dict->AddIncludeDictionary("RESULT_TEMPLATE"); sub_dict->SetFilename("results.tpl"); FillResultsTemplate(sub_dict, results[i]); }
In practice, it's much more likely that
FillResultsTemplate()
will be the one to call
SetFilename()
. Note that it's not an error to call
SetFilename()
on a dictionary even if the dictionary is
not being used for a template-include; in that case, the function is a
no-op, but is perhaps still useful as self-documenting code.
This last category is a bit esoteric: if you write your own modifier, you can pass data to that modifier
when you call Expand()
. The intended use of this
functionality is to allow a modifier to work one way when you expand a
template with dictionary A, and another way when you expand a template
with dictionary B. For instance, you might have a modifier that
encrypts part of a webpage using a user's secret-key, and the
secret-key is of course different every time you expand the
webpage.
To set data that the modifier can use, you call
SetModifierData()
on a
TemplateDictionary
.
For instance:
TemplateDictionary* dict = new TemplateDictionary("modifier example"); dict->SetValue("USERNAME", thisuser->username); // regular var-setting dict->SetModifierData("encrypt key", (void*)thisuser->secret_key); ...
Your custom modifier is passed all the ModifierData as one of the
arguments to Modify
: see
<google/template_modifiers.h>
for more details.
Once you have a template and a template dictionary, it's simplicity itself to expand the template with those dictionary values, putting the output in a string:
google::Template* tpl = google::Template::GetTemplate(<filename>, google::STRIP_WHITESPACE); google::TemplateDictionary dict("debug-name"); FillDictionary(&dict, ...); string output; bool error_free = tpl->Expand(&output, &dict); // output now holds the expanded template // Expand returns false if the system cannot load any of the template files // referenced by the TemplateDictionary.
The expanded template is written to the string output
.
If output
was not empty before calling
Expand()
, the expanded template is appended to the end of
output
.
The TemplateFromString
class, in
template_from_string.h
, is an alternative to the
Template
class when you really want your template to be
built in to the executable rather than read from a file. It's a
drop-in replacement, that takes an extra argument which is the
template contents.
Prefer Template
to TemplateFromString
,
for several reasons. For one, updating the template requires merely a
data push, rather than pushing the new executable. Also, you can load
the new template without needing to restart the binary. It also makes
it easier for non-programmers to modify the template. Finally,
string-templates cannot be included by other
templates, since {{>include}}
takes a filename.
One reason to use TemplateFromString
is if you are in
an environment where having data files could be dangerous -- for
instance, you work on a disk that is usually full, or need the
template to work even in the face of disk I/O errors.
This package comes with a script, template-converter, that takes a template file as input and emits a C++ code snippet (an .h file) that defines a string with those template contents. This makes it easy to start by using a normal, file-based template, and then switch to template-from-string later if you so desire.
You can use the MakeCopy()
method on a template
dictionary to make a "deep" copy of the template. This can be useful
for situations like the following: you want to fill a template several
times, each time with 90% of the values the same, but the last 10%
different. Computing the values is slow. Here's how you can use
MakeCopy()
to do it:
newdict1 = dict->MakeCopy();
newdict2 = dict->MakeCopy();
Like all web applications, programs that use the Google Template System
to create HTML documents can be vulnerable to Cross-Site-Scripting (XSS)
attacks unless data inserted into a template is appropriately sanitized
and/or escaped. Which specific form of escaping or sanitization is
required depends on the context in which the template variable appears
within a HTML document (such as, regular "inner text", within a

Literals of non-string types cannot be quoted and escaped. Instead, ensure that the variable's value is set such that it is guaranteed that the resulting string corresponds to a javascript literal of the expected type. For example, use
dict->SetValueInt("NUM_ITEMS", num_items);
to populate an integer javascript variable in the template fragment

onClick
.
Tag attributes whose values are evaluated as a javascript
expression (such as on{Click,Load,etc}
handlers) require an
additional consideration, since the attribute's value is HTML-unescaped
by the browser before it is passed to the javascript interpreter.
To avoid XSS vulnerabilities, it is in generally necessary to HTML-escape after javascript-escaping:
<button ... onclick='GotoUrl("{{TARGET_URL:j:h}}");'>
There are a number of scenarios in which XSS can arise that are unrelated to the insertion of values into HTML templates, including,
Location
,charset
,Content-Type
,Content-Disposition: attachment
).Please consult additional documentation on Cross-Site-Scripting for more detailed discussion of such issues.
Both dictionary keys and template filenames are strings. Instead of using raw strings, we encourage you to use a bit of machinery to help protect against various types of errors.
For dictionary keys, you can use the make_tpl_varnames_h tool to create static string variables to use instead of a string constant. This will protect against typos, as the make_tpl_varnames_h documentation describes.
For template filenames that a program uses -- including sub-templates -- we suggest the following idiom:
#include "example.tpl.varnames.h" // defines 1 string per dictionary key RegisterTemplateFilename(EXAMPLE_FN, "example.tpl"); // defines template ... google::Template* tpl = google::Template::GetTemplate(EXAMPLE_FN, ...); ... include_dict->SetFilename(EXAMPLE_FN);
By registering the filename, you can query the template system to detect syntax errors, reload-status, and so forth.
The following functions affect the global state of the template system.
google::Template::SetTemplateRootDirectory(root)
: when
GetTemplate()
is called with a relative filename,
the template system will try to load the template from
root/file
. This defaults to ./
. There are some administrative tools that can help with tweaking template performance and debugging template problems. The following functions work on registered templates.
google::TemplateNameList::GetMissingList()
: returns a list
of all registered templates where the file could not be found
on disk. google::TemplateNameList::AllDoExist()
: true iff the
missing-list is empty. google::TemplateNameList::GetBadSyntaxList()
: returns a
list of all registered templates where the template contains a
syntax error, and thus cannot be used. google::TemplateNameList::IsAllSyntaxOkay()
: true iff the
bad-syntax list is emtpy. google::TemplateNameList::GetLastmodTime()
: the latest
last-modified time for any registered template-file. The following functions help with debugging, by allowing you to examine the template dictionaries and expanded templates in more detail.
dict->Dump()
: dumps the contents of the dictionary
(and any sub-dictionaries) to stderr. dict->DumpToString()
: dumps the contents of the
dictionary (and sub-dictionaries) to the given string. dict->SetAnnotateOutput()
: when applying this
dictionary to a template, add marker-strings to the output to
indicate what template-substitutions the system was making.
This takes a string argument which can be used to shorten the
filenames printed in the annotations: if the filename contains
the string you give, everything before that string is elided
from the filename before printing. It's confusing, but fear
not: it's safe to just always pass in the empty string. Finally, ClearCache()
removes all template objects
from the cache used by GetTemplate()
. Typically, this is
only used in environments that check for memory leaks: calling this at
the end of the program will clean up all memory that the template
system uses.
All static methods on Template
and
TemplateDictionary
objects are threadsafe: you can safely
call google::TemplateDictionary::SetGlobalValue()
without needing
to worry about locking.
Non-static methods are not thread-safe. It is not safe for two threads to assign values to the same template-dictionary without doing their own locking. Note that this is expected to be quite rare: usually only one thread will care about a given template-dictionary.
For Template
objects, the most common idiom is that a
template is loaded via GetTemplate()
, and after that only
const methods like Expand()
are called on the template.
With such usage, it's safe to use the same Template
object in multiple threads without locking. Be careful, however, if
you also call functions like ReloadIfChanged()
.
This package includes several tools to make it easier to use write and use templates.
make_tpl_varnames_h
is a "lint" style syntax checker
and header file generator. It takes the names of template files as
command line arguments and loads each file into a Template object by
retrieving the file via the Template factory method. The loading of
the file does pure syntax checking and reports such errors as
mis-matched section start/end markers, mis-matched open/close
double-curly braces, such as "{{VAR}"
, or invalid characters
in template variables/names/comments.
If the template passes the syntax check, by default the utility then creates a header file for use in the executable code that fills the dictionary for the template. If the developer includes this header file, then constants in the header file may be referenced in the dictionary building function, rather than hard-coding strings as variable and section names. By using these constants, the compiler can notify the developer of spelling errors and mismatched names. Here's an example of how this is used, and how it helps prevent errors:
const char * const kosr_RESULT_NUMBER = "RESULT_NUMBER"; // script output dict.SetValue("RESSULT_NUMBER", "4"); // typo is silently missed dict.SetValue(kosr_RESSULT_NUMBER, "4"); // compiler catches typo
Each constant is named as follows:
one_search_result_post20020815.tpl
are
osr
. As an example, the section name "RESULT_NUMBER" in the file
one_search_result_post20020815.tpl would be given the constant name
kosr_RESULT_NUMBER
and would appear in the header file as
const char * const kosr_RESULT_NUMBER = "RESULT_NUMBER";
-- as in the example above.
By default, the header file is produced in the current directory.
An alternate output directory may be specified
by the command line flag --header_dir
.
The name of the generated header file is the same as the name of
the template file with an extension added to the name. By default,
that extension is .varnames.h
. In the above example, the
header file containing the constant declarations would be named
one_search_result_post20020815.tpl.varnames.h
. An
alternate extension may be provided via the command line flag
--outputfile_suffix
.
Important command line flags:
--noheader
-- Indicates that a header file
should not be generated; only syntax checking should be done. --header_dir
-- sets the directory where the header
is written. Default: "./" --template_dir
-- sets the template root
directory. Default: ./
which is the correct
specification when it is run from the directory where the templates
are located. This is only used if the input template filenames
are specified as relative paths rather than absolute
paths. --outputfile_suffix
-- the extension added to the
name of the template file to create the name of the generated
header file. Default: .varnames.h
.
For a full list of command line flags, run
make_tpl_varnames_h --help
.
The TemplateFromString
class lets you load a template
from a string instead of a file. Applications may prefer this option
to reduce the dependencies of the executable, or use it in
environments where data files are not practical. In such cases,
template-converter
can be used as a template "compiler",
letting the developer write a template file as a data file in the
normal way, and then "compiling" it to a C++ string to be included in
the executable.
Usage is template-converter <template filename>
.
C++ code is output is to stdout; it can be stored in a .h file or
included directly into a C++ file. Perl must be installed to use this
script.


Unreal Library
Unknown Artist
2018 . Stories . 100 shorts
Play all
Add to
More
-
1. Prologue
How it all began...
8 pages
-
2. The Letters
An explorer writes letters from an expedition
25 pages
-
3. The Diary
An old drunk writes a diary.
15 pages
-
4. The recording
Space Pirates record their adventure.
20 pages
-
5. Epilogue
Why did everything happen...
4 pages


Creates a new Alexa emulator
The URL the skill is listening that this emulator should interact with
The path to the intent schema file - defaults to BSTAlexa.DefaultIntentSchemaLocation.
The path to the samples utterances file - defaults to BSTAlexa.DefaultSampleUtterancesLocation.
The application ID. Just makes one up if none is defined.
Emulates the specified intent coming from the Alexa device.
The name of the intent - must exactly match the IntentSchema
A key-value dictionary of slots in the form { "slotName": "slotValue" }
Returns any error, along the response and request JSON associated with this call
Itself
Emulates the specified skill being launched
Returns any error, along the response and request JSON associated with this call
Itself
Registers a callback for Skill events
For AudioPlayer events, the payload is an AudioItem
For event type BSTAlexaEvents.Response, the payload is the response body as JSON A second parameter with the body of the request as JSON is also passed
Itself
Registers a one-time callback for Skill events
For AudioPlayer events, the payload is an AudioItem
For event type BSTAlexaEvents.Response, the payload is the response body as JSON A second parameter with the body of the request as JSON is also passed
Itself
Emulates the current track playing to completion.
The Alexa Emulator will automatically play the next queued track as well as signal to your skill the current track has completed
@param callback Returns any error, along the response and request JSON associated with this call @returns Itself
Triggers a AudioPlayer.PlaybackNearlyFinished request from Alexa
Returns any error, along the response and request JSON associated with this call
Itself
Emulates the track being played back
Updates the offset time on the track
Itself
Triggers a AudioPlayer.PlaybackStopped request from Alexa
Returns any error, along the response and request JSON associated with this call
Itself
Ends the session - requires a reason
Can be ERROR, EXCEEDED_MAX_REPROMPTS or USER_INITIATED
Returns any error, along the response and request JSON associated with this call
Itself
Emulates the specified phrase being said to an Alexa device
Returns any error, along the response and request JSON associated with this call
Itself
Start the emulator
Passes back an error if there are any issues with initialization
Turns off the Alexa emulator. Useful for running inside of tests to ensure all cleanup has completed before next test starts.
Generated using TypeDoc
Programmatic interface for interacting with the Bespoken Tools Alexa emulator.
Overview on usage can be found here. NodeJS tutorial here


In this project, you'll use generative adversarial networks to generate new images of faces.
You'll be using two datasets in this project:
Since the celebA dataset is complex and you're doing GANs in a project for the first time, we want you to test your neural network on MNIST before CelebA. Running the GANs on MNIST will allow you to see how well your model trains sooner.
If you're using FloydHub, set data_dir
to "/input" and use the FloydHub data ID "R5KrjnANiKVhLWAkpXhNBe".
data_dir = './data'
# FloydHub - Use with data ID "R5KrjnANiKVhLWAkpXhNBe"
#data_dir = '/input'
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
helper.download_extract('mnist', data_dir)
helper.download_extract('celeba', data_dir)
show_n_images = 25
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
%matplotlib inline
import os
from glob import glob
from matplotlib import pyplot
mnist_images = helper.get_batch(glob(os.path.join(data_dir, 'mnist/*.jpg'))[:show_n_images], 28, 28, 'L')
pyplot.imshow(helper.images_square_grid(mnist_images, 'L'), cmap='gray')
The CelebFaces Attributes Dataset (CelebA) dataset contains over 200,000 celebrity images with annotations. Since you're going to be generating faces, you won't need the annotations. You can view the first number of examples by changing show_n_images
.
show_n_images = 25
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
mnist_images = helper.get_batch(glob(os.path.join(data_dir, 'img_align_celeba/*.jpg'))[:show_n_images], 28, 28, 'RGB')
pyplot.imshow(helper.images_square_grid(mnist_images, 'RGB'))
Since the project's main focus is on building the GANs, we'll preprocess the data for you. The values of the MNIST and CelebA dataset will be in the range of -0.5 to 0.5 of 28x28 dimensional images. The CelebA images will be cropped to remove parts of the image that don't include a face, then resized down to 28x28.

You'll build the components necessary to build a GANs by implementing the following functions below:
model_inputs
discriminator
generator
model_loss
model_opt
train
This will check to make sure you have the correct version of TensorFlow and access to a GPU
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
from distutils.version import LooseVersion
import warnings
import tensorflow as tf
# Check TensorFlow Version
assert LooseVersion(tf.__version__) >= LooseVersion('1.0'), 'Please use TensorFlow version 1.0 or newer. You are using {}'.format(tf.__version__)
print('TensorFlow Version: {}'.format(tf.__version__))
# Check for a GPU
if not tf.test.gpu_device_name():
warnings.warn('No GPU found. Please use a GPU to train your neural network.')
else:
print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
Implement the model_inputs
function to create TF Placeholders for the Neural Network. It should create the following placeholders:
image_width
, image_height
, and image_channels
.z_dim
.Return the placeholders in the following the tuple (tensor of real input images, tensor of z data)
import problem_unittests as tests
def model_inputs(image_width, image_height, image_channels, z_dim):
"""
Create the model inputs
:param image_width: The input image width
:param image_height: The input image height
:param image_channels: The number of image channels
:param z_dim: The dimension of Z
:return: Tuple of (tensor of real input images, tensor of z data, learning rate)
"""
# TODO: Implement Function
inputs_real = tf.placeholder(tf.float32, (None, image_width, image_height, image_channels), name='input_real')
inputs_z = tf.placeholder(tf.float32, (None, z_dim), name='input_z')
learning_rate = tf.placeholder(tf.float32, name='lr')
return inputs_real, inputs_z, learning_rate
#return None, None, None
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_inputs(model_inputs)
Implement discriminator
to create a discriminator neural network that discriminates on images
. This function should be able to reuse the variabes in the neural network. Use tf.variable_scope
with a scope name of "discriminator" to allow the variables to be reused. The function should return a tuple of (tensor output of the generator, tensor logits of the generator).
def discriminator(images, reuse=False):
"""
Create the discriminator network
:param image: Tensor of input image(s)
:param reuse: Boolean if the weights should be reused
:return: Tuple of (tensor output of the discriminator, tensor logits of the discriminator)
"""
# TODO: Implement Function
alpha = 0.1
with tf.variable_scope('discriminator', reuse=reuse):
# Input layer is 28*28*channels
x1 = tf.layers.conv2d(images, 64, 5, strides=2, padding='same')
relu1 = tf.maximum(alpha*x1, x1)
# Now is 14x14x64
x2 = tf.layers.conv2d(relu1, 128, 5, strides=2, padding='same')
bn2 = tf.layers.batch_normalization(x2, training=True)
relu2 = tf.maximum(alpha*bn2, bn2)
# Now is 7x7x128
# Flatten
#flatten = tf.contrib.layers.flatten(relu2)
flatten = tf.reshape(relu2, (-1, 7*7*128))
# Fully connected layer
logits = tf.layers.dense(flatten, 1)
output = tf.sigmoid(logits)
return output, logits
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_discriminator(discriminator, tf)
Implement generator
to generate an image using z
. This function should be able to reuse the variabes in the neural network. Use tf.variable_scope
with a scope name of "generator" to allow the variables to be reused. The function should return the generated 28 x 28 x out_channel_dim
images.
def generator(z, out_channel_dim, is_train=True):
"""
Create the generator network
:param z: Input z
:param out_channel_dim: The number of channels in the output image
:param is_train: Boolean if generator is being used for training
:return: The tensor output of the generator
"""
# TODO: Implement Function
alpha = 0.1
reuse = not is_train
with tf.variable_scope('generator', reuse=reuse):
# First fully connected layer
x = tf.layers.dense(z, 7*7*512)
# Reshape
x = tf.reshape(x, [-1, 7, 7, 512])
#x2 = tf.contrib.layers.flatten(x2)
x = tf.layers.batch_normalization(x, training=is_train)
x = tf.maximum(alpha*x, x)
# Now is 7x7x128
x = tf.layers.conv2d_transpose(x, 256, 5, strides=2, padding='same')
x = tf.layers.batch_normalization(x, training=is_train)
x = tf.maximum(alpha*x, x)
# Now is 14*14*64
x = tf.layers.conv2d_transpose(x, 128, 5, strides=2, padding='same')
x = tf.layers.batch_normalization(x, training=is_train)
x = tf.maximum(alpha*x, x)
# Output layer
logits = tf.layers.conv2d_transpose(x, out_channel_dim, 5, strides=1, padding='same')
# Now is 28*28*3
output = tf.tanh(logits)
return output
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_generator(generator, tf)
Implement model_loss
to build the GANs for training and calculate the loss. The function should return a tuple of (discriminator loss, generator loss). Use the following functions you implemented:
discriminator(images, reuse=False)
generator(z, out_channel_dim, is_train=True)
def model_loss(input_real, input_z, out_channel_dim):
"""
Get the loss for the discriminator and generator
:param input_real: Images from the real dataset
:param input_z: Z input
:param out_channel_dim: The number of channels in the output image
:return: A tuple of (discriminator loss, generator loss)
"""
# TODO: Implement Function
g_model = generator(input_z, out_channel_dim)
d_model_real, d_logits_real = discriminator(input_real, reuse=False)
d_model_fake, d_logits_fake = discriminator(g_model, reuse=True)
d_loss_real = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_real, labels=tf.ones_like(d_model_real)))
d_loss_fake = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_fake, labels=tf.zeros_like(d_model_fake)))
g_loss = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_fake, labels=tf.ones_like(d_model_fake)))
d_loss = d_loss_real + d_loss_fake
return d_loss, g_loss
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_loss(model_loss)
Implement model_opt
to create the optimization operations for the GANs. Use tf.trainable_variables
to get all the trainable variables. Filter the variables with names that are in the discriminator and generator scope names. The function should return a tuple of (discriminator training operation, generator training operation).
def model_opt(d_loss, g_loss, learning_rate, beta1):
"""
Get optimization operations
:param d_loss: Discriminator loss Tensor
:param g_loss: Generator loss Tensor
:param learning_rate: Learning Rate Placeholder
:param beta1: The exponential decay rate for the 1st moment in the optimizer
:return: A tuple of (discriminator training operation, generator training operation)
"""
# TODO: Implement Function
t_vars = tf.trainable_variables()
d_vars = [var for var in t_vars if var.name.startswith('discriminator')]
g_vars = [var for var in t_vars if var.name.startswith('generator')]
# Optimize
d_train_opt = tf.train.AdamOptimizer(learning_rate, beta1=beta1).minimize(d_loss, var_list=d_vars)
with tf.control_dependencies(tf.get_collection(tf.GraphKeys.UPDATE_OPS)):
g_train_opt = tf.train.AdamOptimizer(learning_rate, beta1=beta1).minimize(g_loss, var_list=g_vars)
return d_train_opt, g_train_opt
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
tests.test_model_opt(model_opt, tf)
"""
DON'T MODIFY ANYTHING IN THIS CELL
"""
import numpy as np
def show_generator_output(sess, n_images, input_z, out_channel_dim, image_mode):
"""
Show example output for the generator
:param sess: TensorFlow session
:param n_images: Number of Images to display
:param input_z: Input Z Tensor
:param out_channel_dim: The number of channels in the output image
:param image_mode: The mode to use for images ("RGB" or "L")
"""
cmap = None if image_mode == 'RGB' else 'gray'
z_dim = input_z.get_shape().as_list()[-1]
example_z = np.random.uniform(-1, 1, size=[n_images, z_dim])
samples = sess.run(
generator(input_z, out_channel_dim, False),
feed_dict={input_z: example_z})
images_grid = helper.images_square_grid(samples, image_mode)
pyplot.imshow(images_grid, cmap=cmap)
pyplot.show()
Implement train
to build and train the GANs. Use the following functions you implemented:
model_inputs(image_width, image_height, image_channels, z_dim)
model_loss(input_real, input_z, out_channel_dim)
model_opt(d_loss, g_loss, learning_rate, beta1)
Use the show_generator_output
to show generator
output while you train. Running show_generator_output
for every batch will drastically increase training time and increase the size of the notebook. It's recommended to print the generator
output every 100 batches.
def train(epoch_count, batch_size, z_dim, learning_rate, beta1, get_batches, data_shape, data_image_mode):
"""
Train the GAN
:param epoch_count: Number of epochs
:param batch_size: Batch Size
:param z_dim: Z dimension
:param learning_rate: Learning Rate
:param beta1: The exponential decay rate for the 1st moment in the optimizer
:param get_batches: Function to get batches
:param data_shape: Shape of the data
:param data_image_mode: The image mode to use for images ("RGB" or "L")
"""
n_samples, width, height, channels = data_shape
input_real, input_z, learn_rate = model_inputs(width, height, channels, z_dim)
d_loss, g_loss = model_loss(input_real, input_z, channels)
d_opt, g_opt = model_opt(d_loss, g_loss, learn_rate, beta1)
steps = 0
show_every = 100
print_every = 10
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for epoch_i in range(epoch_count):
for batch_images in get_batches(batch_size):
batch_images *= 2
# TODO: Train Model
steps += 1
# Sample random noise for G
batch_z = np.random.uniform(-1, 1, size=(batch_size, z_dim))
# Run optimizers
_ = sess.run(d_opt, feed_dict={input_real: batch_images, input_z: batch_z, learn_rate: learning_rate})
_ = sess.run(g_opt, feed_dict={input_real: batch_images, input_z: batch_z, learn_rate: learning_rate})
if steps % show_every == 0:
n_images = 25
show_generator_output(sess, n_images, input_z, channels, data_image_mode)
if steps % print_every == 0:
train_loss_d = d_loss.eval({input_z: batch_z, input_real: batch_images})
train_loss_g = g_loss.eval({input_z: batch_z})
print("Epoch {}/{}...".format(epoch_i, epoch_count),
"Discriminator Loss: {:.4f}...".format(train_loss_d),
"Generator Loss: {:.4f}".format(train_loss_g))
Test your GANs architecture on MNIST. After 2 epochs, the GANs should be able to generate images that look like handwritten digits. Make sure the loss of the generator is lower than the loss of the discriminator or close to 0.
batch_size = 32
z_dim = 100
learning_rate = 0.0002
beta1 = 0.5
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
epochs = 2
mnist_dataset = helper.Dataset('mnist', glob(os.path.join(data_dir, 'mnist/*.jpg')))
with tf.Graph().as_default():
train(epochs, batch_size, z_dim, learning_rate, beta1, mnist_dataset.get_batches,
mnist_dataset.shape, mnist_dataset.image_mode)
Run your GANs on CelebA. It will take around 20 minutes on the average GPU to run one epoch. You can run the whole epoch or stop when it starts to generate realistic faces.
batch_size = 32
z_dim = 100
learning_rate = 0.0002
beta1 = 0.5
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
epochs = 1
tf.reset_default_graph()
celeba_dataset = helper.Dataset('celeba', glob(os.path.join(data_dir, 'img_align_celeba/*.jpg')))
with tf.Graph().as_default():
train(epochs, batch_size, z_dim, learning_rate, beta1, celeba_dataset.get_batches,
celeba_dataset.shape, celeba_dataset.image_mode)
When submitting this project, make sure to run all the cells before saving the notebook. Save the notebook file as "dlnd_face_generation.ipynb" and save it as a HTML file under "File" -> "Download as". Include the "helper.py" and "problem_unittests.py" files in your submission.


Life Sketch of
†Richard Stephen Browning
EARLY YEARS
By Joyce
Before I began I want to give a special thanks for mom, Elise and Janet for countless hours of tender service to dad over the past years most especially the past several months. I want to thank my dad for all he taught me, working with him, and the fun times, observing his unconditional love. I am proud to be his daughter.
Richard Stephen Browning was born January 6, 1924, in the home of his parents, Charles Henry Browning, and Viola Rebecca McFate, in Sugar City, Idaho. He had two older sisters; Geneva and Florence (we called her Flossie) and an older brother, Cleo. Dadís family called him Rich.† He always said, ďI may not have much money but I will always be Rich.Ē† And his wife, Mom, could claim, ďI married Rich.Ē
When Dad was six years old, he had pneumonia and almost died.† The doctor operated on him and took out part of a rib and drained his lungs. The first time he stood up and started to walk across the room he fainted. He had to learn to walk again. Because of this illness, he was a year late starting school.
As a child Dad always liked to play with toy bulldozers and trucks, make roads and bridges, and make tree houses. Maybe that is why he chose the vocation he did.† He never liked school until high school. Then he quite liked agriculture class, an aeronautics class, typing and especially the basketball games and dances.
Dadís family lived in Sugar City during the winter, so that the children could attend school.† But in the summer they lived on a dry farm on Canyon Creek. It consisted of 640 acres, a three-room log house, root cellar, barn, machine shed and granary.
After several years of hard work, drought, hail and poor price for wheat Grandpa lost his farm. It was a sad day for Dad.† Some of his fondest memories are of that grand old place.
Dad had a dog named Snip that he trained to pull him on a sleigh in the winter and a wagon in the summer. They had some good times together. One day Dad and his cousin decided to go camping.† They put blankets and food in the wagon that Snip pulled.† It started to get dark.† Thinking it was getting night time they decided to get their bed roll made and go to bed.† Then it started to rain.† After a while the sun came out again.† Because they were wet and cold they decided to go home for the night.
Dad could hardly remember his mother. In the fall of 1932, when Dad was eight years old, Grandma became ill suddenly and died. Dadís oldest sister and brother had both married that summer so that left Aunt Flossy to take over the home chores. One time she tried to get Dad to do the dishes.† He didnít want to, so ran outside and climbed up on a rope.† The rope broke and Dad fell and broke his arm.† He didnít have to wash dishes for some time.
In 1934, when Dad was 10, Grandpa married Margaret Hill Young who had two children, Margaret and Robert (Uncle Bob), who were both younger than Dad. Three boys were born to this union, LeRoy, Kenneth and Irven.
Grandpa heard of a big boom at Sun Valley. Grandpa made arrangements to move his butcher shop into a store at Ketchum, one mile from Sun Valley. Grandpa and Dad went to Ketchum.† Housing was scarce due to the sudden influx of people. They had a homemade camper for the pickup, made of three bows and a custom made heavy treated canvas cover, much like a covered wagon, which they lived in for several weeks. Marge and the three younger kids, Margaret, Bobby and Roy came out later. The first house they lived in was a tent house about 16 feet square, made of rough lumber floor and walls about 4 feet high with a canvas top. Later they moved into a better home, a cabin.
Dad attended the sixth and seventh grades of school at Ketchum. He did a little skiing and was a caddy on the golf course.
The boom was mostly over in a couple of years and the family moved out of Ketchum. Dad went back to Sugar City and stayed with his older brotherís family. Dad was 14 and earned his keep by working in his brother's store after school, during lunch, and on Saturdays, and other odd jobs during the summer.† One summer he ran a butcher shop for Van Price in Driggs, Idaho.† Dad graduated from the Sugar Salem High School.
The day after graduation Dad and his friend, Mark Hulet, were hitch hiking a ride to Victor where their parents lived.† Their first ride was from Sugar City to Clementsville.† They were walking down the road from there when a farmer, Roy Anderson, came along and offered them a job on his dry farm.† Mr. Anderson said he could tell a good worker from the way they hitch hiked. The ones who got out and hiked were good workers but the ones that just stood or sat at the side of the road were lazy.†  Mr. Anderson and his sons also had a dairy farm in Lost River Valley where Dad helped milk 80 heads of Holstein cows during the winter. He didnít like the cow milking, but he really liked the dry farm.
Dad would tease us by saying that the dust got so thick you could ride the dust out over the canyon to turn around.† Because of the dust they had to clean the air filter quite often.† Dad was cleaning the filter with gasoline.† Mr. Anderson got after him and said, ďdonít use that expensive gasoline.† It cost 15 cents a gallon. Use diesel, it only costs 10 cents a gallon.Ē
MILITARY
By Elise
Dad said, ďI couldnít convince Uncle Sam that farming was more important than soldiering and was drafted on 28 June 1944.Ē† Dad reported to Fort Douglas Army base in Salt Lake City and after a few days was sent to Arkansas for infantry training.† After seventeen weeks of infantry training Dad and some of his buddies had a choice to make.† They could have two weeks delay in route to Japan or they could join the paratroopers, take an additional four weeks paratrooper jump school at Fort Benning, Georgia and be home for Christmas on the way to Germany beside getting $50 a month jump pay, in addition to the $50 regular pay and then another $50 when they went overseas.
The recruiters told the men that if they joined the paratroopers they wouldnít have to march and get blisters on your feet and carry all that gear.† They would be flown to the job.† Dad said the recruiters where right about not marching, now they had to run.† Dad graduated with wings and was home on furlough for Christmas.
Dad was sent to France and was there until the Germans surrendered.† His unit made several practice jumps.† They were alerted and equipped with ammunition and on the plane two different times all ready to be dropped on the front lines when the maneuver was called off because of the successful advancement of the ground troops.
Dad was on the way to Japan by way of the U.S. when the Japanese surrendered.† He arrived in New York to a heroís welcome.† Then he was sent to Fort Bragg, North Carolina.† Since he had some experience in running a movie projector, he was given that job at camp.† He would run the projector 3 or 4 hours a night but the rest of the time he was free to do about anything.† One of his buddies became assistant to the chaplain and because of his position had access to a jeep and they spent time riding around the country.† This was an enjoyable stay but they were anxious to get home.† They were sent back to Fort Douglas for discharge.
When Dad was discharged from the Army on April 29, 1946, he came home and went to work in Island Park cutting down mining timber.† After a week of that he went to work at a rock quarry near Victor.† It was lime rock which was used to process sugar.† At first he was using a sledge hammer to break up the rock.† Soon he was able to drive the truck hauling the rock from the quarry to the railroad where it was loaded onto railroad cars and taken to the sugar factory.† That was a much better job.† That fall he went to Sugar City and stayed with his brother, Cleo, and family.† He spent the winter working in the potato cellar and chasing girls.
FAMILY
By Elise
In February of 1947, Dad met Lois Wheeler at a stake dance in Rexburg.† She was attending Ricks College.† They dated until school was out in June.† The next winter they began dating again.† In December Dad went to Jackson, Wyoming to work in a butcher shop.† They continued to write and to see each other on weekends.† Dad gave Mom a diamond ring on May 16, 1948, and they were married in the Salt Lake Temple on June 24, 1948.
On the 11th of June 1949, they welcomed their first child, a little dark haired, brown eyed baby girl. They named her Janet.
On January 23, 1952, Dad took Mom to the St. Anthony Hospital in Pocatello.† Fifteen minutes later Dr. R.R. Merrill announced to Dad that they had a red headed blue-eyed baby girl.† This was Carla.
The rest of the children were born in the hospital with the star on top.† Phillip Stephen was born March 12, 1953.† He was the first boy. The next child was Elise, born June 28, 1955.† Then there were two more boys, Deven Kay born September 2, 1956 and Dale Richard born August 5, 1958. The seventh child came to the family February 22, 1960. We named her Joyce.
Family was very important to Mom and Dad.† They supported their descendants and extended family in special occasions such as blessing of babies, baptisms, graduation, priesthood ordinations, weddings, funerals, musical performances, drama productions, and sporting events.† They loved family reunions.
Dad also kept in touch with schoolmates by attending class reunions.
HOMES
By Carla
Mom and Dad made their first home in Jackson, Wyoming. The home was a small camp trailer, about 15 feet long and 8 feet wide. They had it parked in a trailer park where they could hook up to water and electricity.† There was a public rest room, shower and laundry that they could use. It was quite comfortable and not much house work.
When the weather became cold the trailer park closed and they were obliged to find another place to park. One of the customers of the store where Dad was working, an elderly, widow lady by the name of Mrs. Saunders, offered to let them park by her home, which was closer to town. She was very good to them and they really enjoyed visiting with her.† Because of the cold temperature they could not hook up to a water supply, but carried water from the house. The trailer was heated by an oil heater.† A barrel of oil was outside the trailer with a small tube attached to bring the oil to the heater.
The winter of 1948-1949 was one of the hardest winters that has been recorded in this area. The snow was very deep that winter and the weather was very cold at times. The trailer had thin walls and no insulation. Most nights it was so cold that the blankets on their bed would be frozen to the wall when they awoke. They were thankful to have enough bedding to keep them warm.† One night the temperature dropped to 60 degrees below zero.† At that temperature the oil could not flow through the tubing, so the fire went out. When morning came they brought a can full of oil into the trailer and put it in the tank on the heater and were able to get a fire going.
The months of February and March were especially difficult for the Jackson area. Because of the mountainous terrain many snow slides occurred, blocking the roads so that no vehicles could get through. Nothing came into the area for three weeks until they were able to get some mail and medical supplies flown in by air.
The last of the snow melted about the first of May and spring came again to the Jackson Hole area. Dad traded in the trailer for a new one and they moved in on June 4. It had insulated walls, was about three feet longer, and had a water heater but not a bathroom.† However, they really were happy to be living in such a nice home. Shortly thereafter they celebrated their first wedding anniversary. They had experienced several different circumstances, but had learned that they could cope with trials in their lives and also appreciate the blessings they had. It had been a good year!
In September of 1949 Mom and Dad moved to Idaho Falls, Idaho. The store in Jackson was sold and Dad had to seek employment elsewhere. He dug sugar beets for the U & I Sugar Company.† When that job was finished Dad began selling Rena Ware cooking utensils.
In December a welcome job was offered in Pocatello cutting meat for Okay Food Stores.† Mom and Dad never thought they would like to live in Pocatello, as it was a big wicked city, but were very glad to find work, especially that time of year.† They moved their 18-foot trailer home to the Barret Trailer Park on Yellowstone Ave.† Mom and Dad really enjoyed living in Pocatello and raising their family.
In the spring of 1951 Dad bought 5 acres of land on Mink Creek Road for $500.00 from J. V. Frazier.† He financed it by selling war bonds that he had bought while he was in the service.† They moved their trailer onto the property April 9, 1951.
When Mom and Dad moved onto the property it was nothing more than a sagebrush-covered hill and some Juniper trees. It took two weeks before they could get electricity. It was four months before they were able to get a well drilled so they could have water. They brought water from town for culinary purposes, but sometimes they dipped water out of a ditch that ran through the property and heated it on a bonfire to do the laundry.
Dad borrowed Mr. Frazierís horse and plow and plowed a little garden spot below the ditch that ran through the place. He watered the garden out of the ditch with a syphon hose. They had a very good garden, even cantaloupe.
Dad rented Andersonís tractor, plow and scraper and dug the basement and also a place to put the well.
Dad tried to get a loan to build a house but without a credit record nor enough ground for a farm loan they gave him the run around.† Dad didnít want to go in debt anyway, so they lived in the trailer house for two more years.
†
In the spring of 1953 Dad began working on the basement. He sold the trailer house to finance the project.† They wanted the trailer by the opening of fishing season the latter part of May.† Dad put up the cinder block walls and got a roof overhead but no floor.† The concrete was poured in one room but it was not dry enough to walk on when they came to get the trailer.† They moved into the one room that had a dirt floor and a trench for a sewer pipe running through it.† They put a little trash burner in one end to use for heat and to cook with. A few days later they were able to move into the other room home where it was more comfortable. Later that summer they were able to put a concrete floor in a third room and that gave them two rooms and a bath room.† We lived in the basement until May of 1961.† A few years later Dad was able to add a two-car garage onto the house. It was several years before Dad was able to buy bricks for the outside of the house. Dad was able to do much of the brick work.
The nice thing about not finishing the house all at one time is that he never had to make any monthly house payments, nor did he have interest to pay.† How many can say they never had a mortgage.† But we were very comfortable and happy.
WORK
By Carla
Dad was a hard worker. Dad cut meat for Okays for about eight years.† In his spare time he plowed gardens and did landscaping with his tractor.† Later Dad bought some hay equipment and did custom haying.† One time Dad asked for some time off to do some haying.† The boss at the store asked him which he would rather do.† He told him cut hay. Dad decided to quit the store and cut hay.† It was a hard decision to make.† The steady income was hard to give up. But he didnít like working Sundays and preferred working with machinery so decided to make the change.
Dadís brothers, Roy, Ken and Irven and Momís brothers, Delynn and Byron, helped quite a bit in the summer. He also hired some other help at different times.
Through the years Dad taught his children to operate the trucks, tractors and hay equipment.† All of the boys helped Dad as much as they could and even us girls helped some.
Dad had two hay balers for a while and did custom haying for people in Inkom, Marsh Valley, north to and on the Indian Reservation and also in Arbon Valley.† He decided to get out of the haying business and do landscaping only.† So he sold the hay equipment to the Pocatello Stake farm.† Dad continued doing landscaping and plowing gardens until 1972. At that time Dad bought a backhoe and added digging basements to his vocation.† He seemed to be making more money with the backhoe so he concentrated more on that kind of work.† In 1975 Rex Browning came to help Dad and they established a partnership called Browning Excavation. They dug basements for many homes and put in sewer systems for numerous people.† Grant Stowell hired them to put in the water system in the Indian Hills Subdivision. Dad, Rex and Phillip spent most of the summer of 1976 in Rexburg helping with the clean up after the Teton Dam broke and flooded the area.† Dad worked with Rex until the latter part of 1992 when he sold his share of the business to Rex and began preparing to go on a mission for the Church.
After dad got home from his mission, he was watching Janet machine quilt and thought he could do that.† He started quilting and ran the quilting machine up until the Charlotte Fire, this year.
For the last 20 years if Dad was not quilting he was usually outside taking care of the yard, or chopping wood for the wood stove.† When he was not busy with that you may of found him watching Little House on the Prairie.
CHURCH CALLINGS
By Janet
We would like to thank you for coming, for your kindness and your support.
Dad served in many callings in the Church of Jesus Christ of Latter-day Saints.†
He was called to head the Senior Aaronic Priesthood where he helped activate and prepare at least 5 families to go to the temple and be sealed for eternity.
During the time that dad was Elders Quorum President there were two session of Stake Conference held at Pocatello High School. Being the president he was in charge of the dinner between sessions, held at the 1st ward building that was across the street in the parking lot behind where the seminary building is today.
He was called to be a Stake Missionary where he taught and had about 26 baptisms his first year.
He was ordained a Seventy.† One of their projects was showing movies, dad got us kids involved by us serving the popcorn candy and drinks between reals.† They showed the good movies like Old Yeller, Pollyanna, Follow Me Boys, or Seven Brides for Seven Brothers.
He was called to be chairman of the Genealogy Committee.
When dad was called to be the 2nd counselor to Bishop Harold Lloyd with Lynn Holiday as 1st counselor he was set apart by Joseph Fielding Smith. One Christmas the three of them went to every family in the ward and sang Christmas Carlos. It took them several evenings but they had an enjoyable time.
Dad also served in Scouting as Cub Scout Committee Chair and Assistant Scout Master.†
Mom and Dad both served together as directors of the names extraction program, as temple workers and as full time missionaries in the Alaska Anchorage Mission. They were assigned to serve in Glennalan and Sitka, Alaska and Whitehorse, Canada.
Mom and Dad were ordinance workers in the Idaho Falls Temple for 8 years from December 1996 to October 2004.
Mom and Dad served on a stake sponsored sealing team until August 31, 2009.† Dad enjoyed going to the temple and knew of the important service that takes place there.
Dad was a home teacher and was able to touch many lives through that service.
Dad did his preaching by living what he preached.
We never missed a church meeting, even on our vacations, unless we were sick.
TRIPS AND VACATIONS
By Janet
Dad was a hard worker.† He also knew how to have fun.† He liked to play games with family and friends.† He was good at checkers and liked to play Racko.† But his favorite was a game we call ďMormon Bridge.Ē
Saturday night was spent watching Lawrence Welk.† Sunday nights were time for popcorn and apples.
When we were young, dad would come home from work and say letís go swimming or lets go camping.† How we enjoyed swimming at Lava Hot Springs or Indian Springs or Green Canyon. I have memories of camping in Yellowstone Park, Stanley Basin, Green Canyon.
Winters were especially fun for us because we had snow machines.† Dad was normally a quiet, calm, cautious man.† But when he got on a snow machine, he was quite aggressive.† We spent many memorable times riding snow machines.
In 1976 Mom and Dad bought a time share condominium in Island Park.† They enjoyed going to Island Park over the years and always shared the time with friends and family.† They had a Club House where we could swim, sit in the hot tubs, play racket ball or ping pong.† They would go snowmobiling when the weather was good enough.† Almost every year they went through Yellowstone Park.† They usually made it to Old Faithful but several times made the loop around Thumb, Yellowstone Lake and Canyon.† Our favorite places to go were Two Top and Big Springs. Other places of interest were Mesa Falls and Lion Head. On stormy days we would play games or watch movies.
Mom and Dad owned several different Motor homes.† They took vacations all over the United States. They have been to all of the states except (9) Hawaii, Maine, Vermont, New Hampshire, Massachusetts, Rhode Island, Connecticut, (Iím not sure about Delaware) and New Mexico.
Rich and Lois were very generous and never took a vacation without a parent, sibling, child, grandchild, niece, nephew, or even a friend along.
One of my vacations with then was in 1992, when they took me, JaNae and Tassi to Missouri to get the quilting machine. We stop at Church sites and spent 3 days in Nauvoo. This was a turning point in JaNaeís life.
Dad gave us a wonderful heritage and a great legacy. He has 28 grandchildren and 34 great-grandchildren. ††We had a very comfortable life.† We have many happy memories to remember him by.
We would like to thank Access Home Health and Hospice for the loving kindness in helping us to take care of dad.
Mine was an honor and privilege to be able to help care for dad the last two months. We had some very tender moments together. I know the veil was very thin. He asked me if I would like him to take my picture with all those people that were there behind me. I wish he could have. I know he is with his mother and father sisters and brother. I know he is forgiven for not knowing his colors and is worthy to be with Heavenly Father.
† We love you Dad!
PS. Note: not given at the funeral. When I (Janet) was a little girl I did not know dad did not know his colors. Dad would point to my color crayons and ask what color is that and then to another and another. I just thought he was checking to see if I knew my colors. About the time I started to drive is when I became aware he was color blind. He knew the stop light by where the red or green light was. He couldnít see the colors of the flowers so didnít like them very much. He thought the drapes and the wall was the same color.† One day this in the last few weeks dad had a hold of my hand and was praying to Heavenly Father that he would be forgiven because he didnít know his colors and would be found worthy.
†


The stack is a memory structure where the methods we call are executed. Think of it like a to do list. The first item added to every JVM stack is the main
method.
call stack
Whenever a method is called within another method, the new method is added to the top of the stack.
1 public static void main(String[] args){
2 int x = 5;
3 methodA();
4 }
call stack
Suppose methodA includes a call to System.out.println()
, Then println()
will be moved to the top of the stack.
1 public boolean void methodA(){
2 int y = 13;
3 System.out.println("this used to be a ghost town");
4 return y % 2 == 0;
5 }
call stack
The items most recently added to the stack are executed first. Last In First Out.
call stack
A recursive method is a method that calls itself. For example
1 public static void lasagna() {
2 System.out.println("lasagna");
3 lasagna();
4 System.out.println("pizza");
5 }
Let's explore what happens when we call this method.
1 public static void main(String[] args){
2 lasagna();
3 }
stack
1 public static void lasagna() {
2 System.out.println("lasagna");
3 ...
4 ...
5 }
stack
1 public static void lasagna() {
2 ...
3 lasagna();
4 ...
5 }
stack
1 public static void lasagna() {
2 System.out.println("lasagna");
3 ...
4 ...
5 }
stack
1 public static void lasagna() {
2 ...
3 lasagna()
4 ...
5 }
stack
1 public static void lasagna() {
2 System.out.println("lasagna");
3 lasagna()
4 System.out.println("pizza");
5 }
stack
The size of the stack is fixed and can vary across JVMs. It is often 1MB. When this memory fills up the program will crash. This is called a Stack Overflow
an infinite uses up CPU resources
1 public static void infinteLoop(){
2 int count = 1;
3 while(1 + 1 == 2){
4 count++;
5 }
6 }
a stack overflow uses up memory
1 public static void stackOverflow(){
2 stackOverflow();
3 }
stack
1 /* precondition: n is a positive integer */
2 public static int pizza(int n){
3 if(n == 1){
4 return 1;
5 }
6 return 2*n + pizza(n-1) - 1;
7 }
8 public static void main(String[] args){
9 System.out.println(pizza(3));
10 }
stack
pizza(2)
)Pizza Example
1 /* precondition: n is a positive integer */
2 public static int pizza(int n){
3 if(n == 1){
4 return 1;
5 }
6 return 2*n + pizza(n-1) - 1;
7 }
8 public static void main(String[] args){
9 System.out.println(pizza(3));
10 }
stack
pizza(1)
) Pizza Example
1 /* precondition: n is a positive integer */
2 public static int pizza(int n){
3 if(n == 1){
4 return 1;
5 }
6 return 2*n + pizza(n-1) - 1;
7 }
8 public static void main(String[] args){
9 System.out.println(pizza(3));
10 }
stack
1
)Pizza Example
1 /* precondition: n is a positive integer */
2 public static int pizza(int n){
3 if(n == 1){
4 return 1;
5 }
6 return 2*n + pizza(n-1) - 1;
7 }
8 public static void main(String[] args){
9 System.out.println(pizza(3));
10 }
stack
2(2) + 1 - 1 = 4
) Pizza Example
1 /* precondition: n is a positive integer */
2 public static int pizza(int n){
3 if(n == 1){
4 return 1;
5 }
6 return 2*n + pizza(n-1) - 1;
7 }
8 public static void main(String[] args){
9 System.out.println(pizza(3));
10 }
stack
2(3) + 4 - 1 = 9
) Pizza Example
1 /* precondition: n is a positive integer */
2 public static int pizza(int n){
3 if(n == 1){
4 return 1;
5 }
6 return 2*n + pizza(n-1) - 1;
7 }
8 public static void main(String[] args){
9 System.out.println(pizza(3));
10 }
stack
Pizza Example
1 /* precondition: n is a positive integer */
2 public static int pizza(int n){
3 if(n == 1){
4 return 1;
5 }
6 return 2*n + pizza(n-1) - 1;
7 }
8 public static void main(String[] args){
9 System.out.println(pizza(3));
10 }
stack
Pizza Example
1 /* precondition: n is a positive integer */
2 public static int pizza(int n){
3 if(n == 1){
4 return 1;
5 }
6 return 2*n + pizza(n-1) - 1;
7 }
8 public static void main(String[] args){
9 System.out.println(pizza(3));
10 }
pizza(n-1)
: This ensured that for positive integers greater than 1, would eventually resolve to a call to the base case. Pizza Example
1 public static int pizza(int n){
2 // base case
3 if(n == 1){
4 return 1;
5 }
6 // recursive call
7 return 2*n + pizza(n-1) - 1;
8 }
Iterative Solution
1 public int factorial(int n){
2 int result = 1;
3 for(int i = 2; i <= n; i++){
4 result *= i;
5 }
6 return result;
7 }
Recursive Solution: Using 1! = 1
as our base case, and the fact that n! = n*(n-1)!
, we can write the following very elegant solution.
1 public int factorial(int n){
2 if(n == 1){
3 return 1;
4 }
5 return n * factorial(n-1);
6 }
Recursion is a tool in your programmer tool box. It works very really well for certain problems and for others a more direct approach is better. For example:
Good Choice: Generating Fibonacci Numbers. The sequence is defined as the sum of the two previous terms (F(n) = F(n-1) + F(n-2), mathematicians call this a recursive definition).
Good Choices: recursive numerical sequences, traversing binary trees, sorting algorithms, and binary search.
Bad Choice: My pizza()
method. You know what would've been a more straight forward solution to that problem?
1 public int pizza(int n){
2 return n * n;
3 }
| Table of Contents | t |
|---|---|
| Exposé | ESC |
| Full screen slides | e |
| Presenter View | p |
| Source Files | s |
| Slide Numbers | n |
| Toggle screen blanking | b |
| Show/hide slide context | c |
| Notes | 2 |
| Help | h |


Interim boss Flick ‘happy’ to steer Bayern through after difficult week
MUNICH, Nov 7 — Interim boss Hansi Flick said he was “happy” to steer Bayern Munich into the Champions League last 16 yesterday, despite admitting the upheaval following Niko Kovac’s sacking “had not been easy”.
Flick was only handed the role of caretaker coach when Kovac was dismissed on Sunday following a 5-1 thrashing at Eintracht Frankfurt which left Bayern fourth in the Bundesliga.
Yesterday, late goals by Robert Lewandowski and Ivan Perisic saw off Olympiakos as a 2-0 win sent Bayern into the knockout stage for the 12th straight season.
“I’m very happy with the performance, we’re into the last 16 and that’s what counts,” said Flick, Germany’s assistant coach when they won the 2014 World Cup.
“The situation hasn’t been easy and we implemented what we worked on in training.”
According to German daily Bild, former Arsenal coach Arsene Wenger is in talks with Bayern, but the club has refused to comment.
Club president Uli Hoeness said on Tuesday they expect to name Kovac’s successor by November 23, but Flick will also take charge of Saturday’s league game against Borussia Dortmund.
Flick’s situation was not helped by injuries to first-choice centre-backs Lucas Hernandez and Niklas Suele yesterday, as midfielder Javi Martinez dropped back alongside David Alaba.
“We needed this back four to get used to each other, which I think they did,” Flick said, having left out Jerome Boateng as he is suspended for the next two Bundesliga games after being sent off at Eintracht.
“My task is for the two games, I was happy that the squad showed their quality, but of course there is room for improvement.
“We’re looking forward to playing Dortmund on Saturday, it’s all about recovery and preparing for that now.”
Bayern sit one point behind second-placed Dortmund, with early pace-setters Borussia Moenchengladbach three points further clear.
“That wasn’t the greatest of performances, but whoever saw the game saw that we were there (and dominated),” said Thomas Mueller, who started ahead of Philippe Coutinho.
Goalkeeper Manuel Neuer said: “I’m glad we didn’t concede a goal. Victory is the main thing, but the confidence in our defensive work was also important.” — AFP


In addition to the task interface, you will also have a training interface on the right side of the screen that you can use to receive task instruction from the teacher.
The image below shows what this interface will look like.
For this experiment, you can take three kinds of actions to get instruction from the teacher: take action in the task interface and verify that the task is complete .
You can take an action directly in the task interface and the teacher will provide you with correctness feedback. If they approve of the action you took, then you will be allowed to continue. However, if they disapprove of the action, then you will have to try a different action.
When you are waiting for feedback from the teacher, the task interface will lock (denoted by a lock symbol in the bottom right of the task interface). When the teacher is finished giving you feedback the interface will unlock again.
When you think you have completed the task, press the "verify task is done" button in the training actions menu in the bottom right. If the task has been completed and the teacher approves of this action, then you will be allowed to proceed to the next action. However, if the task is not done and the teacher disapproves, then you will have to continue working on the task.
Throughout the training process all interactions with the AI student will be recorded in the training interaction log shown in the images above.