JComponent
can have one or more borders.
Borders are incredibly useful objects
that, while not themselves components,
know how to draw
the edges of Swing components.
Borders are useful not only for drawing lines and fancy edges,
but also for providing titles and empty space around components.
JPanel
s,
JLabel
s, and custom subclasses of
JComponent
. Although technically you can set the border
on any object that inherits from JComponent
, the look and feel
implementation of many standard Swing components doesn't work well with
user-set borders. In general, when you want to set a border on a
standard Swing component other than JPanel
or JLabel
,
we recommend that you put the component in a JPanel
and set
the border on the JPanel
.
To put a border around a JComponent
,
you use its
setBorder
method.
You can use the
BorderFactory
class to create most of the borders that Swing provides.
If you need a reference to a border — say, because you
want to use it in multiple components — you can save
it in a variable of type
Border
. Here is an example of code that creates a bordered container:
JPanel pane = new JPanel(); pane.setBorder(BorderFactory.createLineBorder(Color.black));
Here's a picture of the container, which contains a label component. The black line drawn by the border marks the edge of the container.
BorderDemo
that
displays the borders Swing provides.
We show the code for creating these borders
a little later,
in Using the Borders Provided by Swing.
Click the Launch button to run the BorderDemo example using Java™ Web Start (download JDK 6). Alternatively, to compile and run the example yourself, consult the example index.
BorderDemo.java
.
//Keep references to the next few borders, //for use in titles and compound borders. Border blackline, raisedetched, loweredetched, raisedbevel, loweredbevel, empty; blackline = BorderFactory.createLineBorder(Color.black); raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); raisedbevel = BorderFactory.createRaisedBevelBorder(); loweredbevel = BorderFactory.createLoweredBevelBorder(); empty = BorderFactory.createEmptyBorder(); //Simple borders jComp1.setBorder(blackline); jComp2.setBorder(raisedbevel); jComp3.setBorder(loweredbevel); jComp4.setBorder(empty); //Matte borders ImageIcon icon = createImageIcon("images/wavy.gif", "wavy-line border icon"); //20x22 jComp5.setBorder(BorderFactory.createMatteBorder( -1, -1, -1, -1, icon)); jComp6.setBorder(BorderFactory.createMatteBorder( 1, 5, 1, 1, Color.red)); jComp7.setBorder(BorderFactory.createMatteBorder( 0, 20, 0, 0, icon)); //Titled borders TitledBorder title; title = BorderFactory.createTitledBorder("title"); jComp8.setBorder(title); title = BorderFactory.createTitledBorder( blackline, "title"); title.setTitleJustification(TitledBorder.CENTER); jComp9.setBorder(title); title = BorderFactory.createTitledBorder( loweredetched, "title"); title.setTitleJustification(TitledBorder.RIGHT); jComp10.setBorder(title); title = BorderFactory.createTitledBorder( loweredbevel, "title"); title.setTitlePosition(TitledBorder.ABOVE_TOP); jComp11.setBorder(title); title = BorderFactory.createTitledBorder( empty, "title"); title.setTitlePosition(TitledBorder.BOTTOM); jComp12.setBorder(title); //Compound borders Border compound; Border redline = BorderFactory.createLineBorder(Color.red); //This creates a nice frame. compound = BorderFactory.createCompoundBorder( raisedbevel, loweredbevel); jComp13.setBorder(compound); //Add a red outline to the frame. compound = BorderFactory.createCompoundBorder( redline, compound); jComp14.setBorder(compound); //Add a title to the red-outlined frame. compound = BorderFactory.createTitledBorder( compound, "title", TitledBorder.CENTER, TitledBorder.BELOW_BOTTOM); jComp15.setBorder(compound);
BorderFactory
class
to create each border.
The BorderFactory
class,
which is in the javax.swing
package,
returns objects that implement the
Border
interface.
The Border
interface,
as well as its Swing-provided implementations,
is in the
javax.swing.border
package.
You often don't need to directly use anything in the border package,
except when specifying constants that are specific
to a particular border class or when referring to
the Border
type.
BorderFactory
doesn't offer you enough control
over a border's form,
then you might need to directly use the API in the border package —
or even define your own border.
In addition to containing the Border
interface,
the border package
contains the classes that implement the
borders you've already seen:
LineBorder
,
EtchedBorder
,
BevelBorder
,
EmptyBorder
,
MatteBorder
,
TitledBorder
, and
CompoundBorder
.
The border package also contains a class named
SoftBevelBorder
, which produces a result similar to BevelBorder
,
but with softer edges.
If none of the Swing borders
is suitable, you can implement your own border.
Generally, you do this by creating a subclass
of the
AbstractBorder
class.
In your subclass, you must implement at least one constructor
and the following two methods:
paintBorder
,
which contains the drawing code
that a JComponent
executes
to draw the border.
getBorderInsets
,
which specifies the amount of space the border needs
to draw itself.
If a custom border has insets (and they typically have insets)
you need to override both
AbstractBorder.getBorderInsets(Component c)
and
AbstractBorder.getBorderInsets(Component c, Insets insets)
to provide the correct insets.
For examples of implementing borders,
see the source code for the classes in the
javax.swing.border
package.
| Method | Purpose |
|---|---|
|
Border createLineBorder(Color) Border createLineBorder(Color, int) |
Create a line border.
The first argument is a
java.awt.Color object
that specifies the color of the line.
The optional second argument
specifies the width in pixels of the line. |
|
Border createEtchedBorder() Border createEtchedBorder(Color, Color) Border createEtchedBorder(int) Border createEtchedBorder(int, Color, Color) |
Create an etched border. The optional Color
arguments specify the highlight and shadow colors to be
used. In release 1.3, methods with int
arguments were added that allow the border methods to
be specified as either EtchedBorder.RAISED
or EtchedBorder.LOWERED . The methods
without the int arguments create a
lowered etched border.
|
| Border createLoweredBevelBorder() | Create a border that gives the illusion of the component being lower than the surrounding area. |
| Border createRaisedBevelBorder() | Create a border that gives the illusion of the component being higher than the surrounding area. |
|
Border createBevelBorder(int, Color, Color) Border createBevelBorder(int, Color, Color, Color, Color) |
Create a raised or lowered beveled border,
specifying the colors to use.
The integer argument can be either
BevelBorder.RAISED or
BevelBorder.LOWERED .
With the three-argument constructor,
you specify the highlight and shadow colors.
With the five-argument constructor,
you specify the outer highlight, inner highlight, outer shadow,
and inner shadow colors, in that order. |
|
Border createEmptyBorder() Border createEmptyBorder(int, int, int, int) |
Create an invisible border. If you specify no arguments, then the border takes no space, which is useful when creating a titled border with no visible boundary. The optional arguments specify the number of pixels that the border occupies at the top, left, bottom, and right (in that order) of whatever component uses it. This method is useful for putting empty space around your components. |
|
MatteBorder createMatteBorder(int, int, int, int, Color) MatteBorder createMatteBorder(int, int, int, int, Icon) |
Create a matte border. The integer arguments specify the number of pixels that the border occupies at the top, left, bottom, and right (in that order) of whatever component uses it. The color argument specifies the color which with the border should fill its area. The icon argument specifies the icon which with the border should tile its area. |
|
TitledBorder createTitledBorder(String) TitledBorder createTitledBorder(Border) TitledBorder createTitledBorder(Border, String) TitledBorder createTitledBorder(Border, String, int, int) TitledBorder createTitledBorder(Border, String, int, int, Font) TitledBorder createTitledBorder(Border, String, int, int, Font, Color) |
Create a titled border.
The string argument specifies the title to be displayed.
The optional font and color arguments specify
the font and color to be used for the title's text.
The border argument specifies the border
that should be displayed along with the title.
If no border is specified, then a look-and-feel-specific
default border is used.
By default, the title straddles
the top of its companion border
and is left-justified.
The optional integer arguments
specify the title's position and justification,
in that order.
|
|
CompoundBorder createCompoundBorder(Border, Border) |
Combine two borders into one. The first argument specifies the outer border; the second, the inner border. |
| Method | Purpose |
|---|---|
|
void setBorder(Border) Border getBorder() |
Set or get the border of the receiving JComponent . |
|
void setBorderPainted(boolean) boolean isBorderPainted() (in AbstractButton ,
JMenuBar ,
JPopupMenu ,
JProgressBar , and
JToolBar ) |
Set or get whether the border of the component should be displayed. |
| Example | Where Described | Notes |
|---|---|---|
BorderDemo |
This section | Shows an example of each type of border
that BorderFactory
can create.
Also uses an empty border to add breathing space
between each pane and its contents. |
BoxAlignmentDemo |
How to Use BoxLayout | Uses titled borders. |
BoxLayoutDemo |
How to Use BoxLayout | Uses a red line to show where the edge of a container is, so that you can see how the extra space in a box layout is distributed. |
ComboBoxDemo2 |
How to Use Combo Boxes | Uses a compound border to combine a line border with an empty border. The empty border provides space between the line and the component's innards. |


Definitions used to configure the program start-up. More...
| #define | OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS |
| Initialise multiple RAM sections. | |
| #define | OS_BOOL_STARTUP_GUARD_CHECKS (true) |
| Enable guard checks for .bss and .data sections. | |
| #define | OS_INCLUDE_STARTUP_INIT_FP |
| Always initialise the hardware FPU. | |
| #define | OS_USE_SEMIHOSTING_SYSCALLS |
| Make the application a fully semihosted application. | |
| #define | OS_INTEGER_SEMIHOSTING_MAX_OPEN_FILES (20) |
| Define the maximum number of semihosting open files. | |
| #define | OS_INCLUDE_STANDARD_POSIX_FUNCTIONS |
| Include definitions for the standard POSIX system calls. | |
| #define | OS_INCLUDE_NEWLIB_POSIX_FUNCTIONS |
| Include definitions for the newlib system calls. | |
| #define | OS_DISABLE_CORTEXM_SET_MSP_VIA_VTOR |
| Disable setting MSP during startup. | |
Definitions used to configure the program start-up.
| #define OS_BOOL_STARTUP_GUARD_CHECKS (true) |
Enable guard checks for .bss and .data sections.
Sometimes mistakes in the liner script prevent the .bss area to be initialised to zero, and/or the .data area to be fully initialised with content from flash.
To validate that the start-up properly initialised these areas, some guard words are defined at the begin/end of the .bss and .data areas, and are explicitly checked.
Definition at line 512 of file os-app-config.h.
| #define OS_DISABLE_CORTEXM_SET_MSP_VIA_VTOR |
Disable setting MSP during startup.
On Cortex-M, during startup, the MSP register is set to the stack pointer available in the first word pointed by VTOR. Some platforms run custom firmware (like Nordic's soft radio) that take control of VTOR and set it to a location which does point to the valid interrupt stack. It is perfectly acceptable to not reset MSP, and leave it to the location where it reached before switching to PSP, just that some stack space is wasted.
Definition at line 580 of file os-app-config.h.
| #define OS_INCLUDE_NEWLIB_POSIX_FUNCTIONS |
Include definitions for the newlib system calls.
Definition at line 566 of file os-app-config.h.
| #define OS_INCLUDE_STANDARD_POSIX_FUNCTIONS |
Include definitions for the standard POSIX system calls.
Definition at line 559 of file os-app-config.h.
| #define OS_INCLUDE_STARTUP_INIT_FP |
Always initialise the hardware FPU.
Definition at line 517 of file os-app-config.h.
| #define OS_INCLUDE_STARTUP_INIT_MULTIPLE_RAM_SECTIONS |
Initialise multiple RAM sections.
Definition at line 496 of file os-app-config.h.
| #define OS_INTEGER_SEMIHOSTING_MAX_OPEN_FILES (20) |
Define the maximum number of semihosting open files.
The implementation of the semihosting file support requires an array of open files, to keep track of the host files.
To simplify the implementation and avoid dynamic allocations, a static array is used. This option defines the size of this array.
Definition at line 552 of file os-app-config.h.
| #define OS_USE_SEMIHOSTING_SYSCALLS |
Make the application a fully semihosted application.
When writing test applications it is necessary to use some of the resources available from the host system (STDOUT/STDERR, file system, time, exit code, etc).
This requires the entire behaviour of the system calls to be changed and most calls to be forwarded to the host. The application is transformed into a 'fully semihosted' application.
One major difference from a regular embedded application is that a fully semihosted test application does not run in an endless loop, but terminates, and the test result must be passed back to the host system, via the exit code and optionally via a detailed status file.
Definition at line 537 of file os-app-config.h.


 Well, it turns out that swapping with random users was a little broken. I received a few reports of swaps failing, and it turns out that trying to swap with a random user hit an untested corner case in my code, so it was failing. I have fixed this bug (and added more tests), but you all need to go back to voteswap and try to swap again. It'll work this time!
I feel pretty awful that this was failing silently, but there's still plenty of time to swap your vote before election day!
We're only two days away from election day! Membership of voteswap keeps growing, so if we can all swap we can help keep Trump out of the White House. If you haven't already, please enable swapping with random users to increase the chances of finding a swap before Tuesday by going to your profile and clicking the "OK to match me with people I don't know" checkbox.
Don't forget to share voteswap with your friends. Clinton can still lose the election, and every vote helps!


LESSONS
TUTORIALS
QUIZZES
ABOUT
☰
LESSONS
TUTORIALS
QUIZZES
ABOUT
Magnets Quiz
Are you ready for the quiz? If not, go back to the lessons page.
Question #1
How are magnetic fields created?
electrons flow in different directions.
electrons flow from the north pole to the south pole.
electrons flow like an ocean.
magnet electrons have different qualities than normal materials.
Question #2
Which one is a magnet?
the earth
a cat
a plastic ruler
your phone
Question #3
What are magnets made of?
iron
steel
both a and b
electricity
Question #4
Why is the Earth a magnet?
the inner core is a magnet
the inner core is solid metal
the outer core has liquid iron in it
the inner core has liquid iron in it
Question #5
What type of connection will make magnets stick together?
having the north poles of both magnets facing each other
having both magnets face away from each other
having the north pole of one magnet face the south pole of the other
having the south poles of both magnets face each other
Submit


| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one | |
| 3 | * or more contributor license agreements. See the NOTICE file | |
| 4 | * distributed with this work for additional information | |
| 5 | * regarding copyright ownership. The ASF licenses this file | |
| 6 | * to you under the Apache License, Version 2.0 (the | |
| 7 | * "License"); you may not use this file except in compliance | |
| 8 | * with the License. You may obtain a copy of the License at | |
| 9 | * | |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | * | |
| 12 | * Unless required by applicable law or agreed to in writing, | |
| 13 | * software distributed under the License is distributed on an | |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| 15 | * KIND, either express or implied. See the License for the | |
| 16 | * specific language governing permissions and limitations | |
| 17 | * under the License. | |
| 18 | */ | |
| 19 | package org.apache.empire.exceptions; | |
| 20 | ||
| 21 | import org.apache.empire.commons.ErrorType; | |
| 22 | ||
| 23 | public class NotImplementedException extends EmpireException | |
| 24 | { | |
| 25 | /** | |
| 26 | * Comment for serialVersionUID | |
| 27 | */ | |
| 28 | private static final long serialVersionUID = 1L; | |
| 29 | | |
| 30 | public static final ErrorType errorType = new ErrorType("error.notImplemented", "The function {0} is not implemented for type {1}."); | |
| 31 | | |
| 32 | public NotImplementedException(Object object, String functionName) | |
| 33 | { | |
| 34 |
1
1. <init> : negated conditional → NO_COVERAGE |
super(errorType, new String[] { functionName, (object!=null ? object.getClass().getName() : "{unknown}") }); |
| 35 | } | |
| 36 | ||
| 37 | } | |
Mutations | ||
| 34 |
1.1 |


As decision day nears for Najee Harris, America’s No. 1 football recruit, life becomes more stressful on and off the field
Hot pursuit
The Najee Chronicles, Chapter 5:
Top schools ramp up recruiting of Antioch's Najee Harris, the nation’s No. 1 football prospect


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
input_real = tf.placeholder(tf.float32, (None, image_width, image_height, image_channels), name='input_real')
input_z = tf.placeholder(tf.float32, (None, z_dim), name='input_z')
learning_rate_placeholder = tf.placeholder(tf.float32, name='learning_rate')
return input_real, input_z, learning_rate_placeholder
"""
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 discriminator, tensor logits of the discriminator).
def discriminator(images, reuse=False, alpha=0.2):
"""
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
# name variable scope 'discriminator' for building GAN model
with tf.variable_scope('discriminator', reuse=reuse):
# input layer is 28x28x3
x1 = tf.layers.conv2d(images, 64, 5, strides=2, padding='same')
relu1 = tf.maximum(alpha * x1, x1)
# 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)
# 7x7x128
x3 = tf.layers.conv2d(relu2, 256, 5, strides=2, padding='same')
bn3 = tf.layers.batch_normalization(x3, training=True)
relu3 = tf.maximum(alpha * bn3, bn3)
# 4x4x256
x4 = tf.layers.conv2d(relu3, 512, 5, strides=1, padding='same')
bn4 = tf.layers.batch_normalization(x4, training=True)
relu4 = tf.maximum(alpha * bn4, bn4)
# 4x4x516
# Flatten it
flat = tf.reshape(relu4, (-1, 4*4*512))
logits = tf.layers.dense(flat, 1)
out = tf.sigmoid(logits)
return out, 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, alpha=0.2):
"""
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
with tf.variable_scope('generator', reuse=not is_train):
# first fully connected layer
x1 = tf.layers.dense(z, 7*7*512)
# reshape it to start convolutional stack
x1 = tf.reshape(x1, (-1, 7, 7, 512))
x1 = tf.layers.batch_normalization(x1, training=is_train)
x1 = tf.maximum(alpha * x1, x1)
# 7x7x512
x2 = tf.layers.conv2d_transpose(x1, 256, 5, strides=2, padding='same')
x2 = tf.layers.batch_normalization(x2, training=is_train)
x2 = tf.maximum(alpha * x2, x2)
# 14x14x256
x3 = tf.layers.conv2d_transpose(x2, 128, 5, strides=2, padding='same')
x3 = tf.layers.batch_normalization(x3, training=is_train)
x3 = tf.maximum(alpha * x3, x3)
# 28x28x128
x4 = tf.layers.conv2d_transpose(x3, 64, 5, strides=1, padding='same')
x4 = tf.layers.batch_normalization(x4, training=is_train)
x4 = tf.maximum(alpha * x4, x4)
# 28x28x64
x5 = tf.layers.conv2d_transpose(x4, 32, 5, strides=1, padding='same')
x5 = tf.layers.batch_normalization(x5, training=is_train)
x5 = tf.maximum(alpha * x5, x5)
# 28x28x32
# Output layer
logits = tf.layers.conv2d_transpose(x5, out_channel_dim, 5, strides=1, padding='same')
# 28x28x3 now
out = tf.tanh(logits)
return out
"""
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, alpha=0.2):
"""
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, alpha=alpha)
d_model_real, d_logits_real = discriminator(input_real, alpha=alpha)
d_model_fake, d_logits_fake = discriminator(g_model, reuse=True, alpha=alpha)
d_loss_real = tf.reduce_mean(
tf.nn.sigmoid_cross_entropy_with_logits(logits=d_logits_real,
labels=tf.ones_like(d_model_real) * 0.9))
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
with tf.control_dependencies(tf.get_collection(tf.GraphKeys.UPDATE_OPS)):
d_train_opt = tf.train.AdamOptimizer(learning_rate, beta1=beta1).minimize(d_loss, var_list=d_vars)
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")
"""
# TODO: Build Model
tf.reset_default_graph()
_, image_width, image_height, image_channels = data_shape
input_real, input_z, learning_rate_placeholder = model_inputs(image_width, image_height, image_channels, z_dim)
d_loss, g_loss = model_loss(input_real, input_z, image_channels)
d_opt, g_opt = model_opt(d_loss, g_loss, learning_rate, beta1)
steps = 0
print_every = 10
show_every = 100
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):
# TODO: Train Model
steps += 1
batch_images = batch_images * 2
# 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,
learning_rate_placeholder: learning_rate})
_ = sess.run(g_opt, feed_dict={input_real: batch_images,
input_z: batch_z,
learning_rate_placeholder: learning_rate})
if steps % print_every == 0:
# At the end of each epoch, get the losses and print them out
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+1, epoch_count),
"Discriminator Loss: {:.4f}...".format(train_loss_d),
"Generator Loss: {:.4f}".format(train_loss_g))
if steps % show_every == 0:
show_generator_output(sess, 25, input_z, image_channels, data_image_mode)
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 = 128
z_dim = 100
learning_rate = 0.001
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 = 128
z_dim = 100
learning_rate = 0.001
beta1 = 0.5
"""
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
epochs = 1
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.


{% raw %} This is a Company Search field Company Name (typeahead) Company Number Company Name {% endraw %} {% raw %} This is an Address field Attention Street Address (typeahead) Street Address City Province Alberta British Columbia Manitoba New Brunswick Newfoundland and Labrador Northwest Territories Nova Scotia Nunavut Ontario Prince Edward Island Quebec Saskatchewan Yukon Territory Postal Code Country Canada {% endraw %} {% raw %}


August 27
Whatever is born of God is victorious over the world; and this is the victory that conquers the world, even our faith. 1 John 5:4
Years ago the devil started a rumor. He told a few Christians that as long as they lived in the world, they had to suffer as the world did. He told them they had to share the diseases and the defeat, the poverty and the failure of those around them. It was a crafty lie--and it worked. Believers accepted it and began to spread it among themselves. You may have even heard it yourself. If so, I want to help you put that rumor to rest today. I want to help you get the facts straight once and for all.
You see, despite what you may have heard, health, prosperity and victorious living aren't concepts some comfort-hungry believer selfishly dreamed up. They are God's ideas. You may say, "That sounds good, Gloria, but we've got to be realistic. We live in a world that's full of problems. And as long as we live in this world, it seems to me we're going to have our share."
Yes, that's true. Even Jesus said, "In the world you have tribulation and trials and distress and frustration." But notice, He didn't stop there! He went on to say, "But be of good cheer-- take courage, be confident, certain, undaunted--for I have overcome the world.-- I have deprived it of power to harm, have conquered it [for you]" (John 16:33, The Amplified Bible).
Most believers don't have any trouble believing the first part of that verse. They know all too well how many tribulations, trials, distresses, and frustrations surround them. But they're less certain about the last part. They haven't yet experienced for themselves exactly what Jesus meant when He said He had deprived those things of power to harm them. Why not? Because they're still living as though they're part of the world. But, listen. Jesus said you and I are to be "sanctified," or separated from the evils of this world. How? Through the Word of God! (John 17:17).
The Word of God will separate you from the world. His Word will set His dream for victory into motion in your life. If you'll receive it and believe it, speak it and act on it, that Word will set you apart from those around you. It will take you from trouble to triumph again and again. Scripture Reading: John 17:1-17


Delta Heavy Share The Must-See Visuals To "Take Me Home"
The single dropped earlier this year on RAM Records.
by Daniel DayAfter the massive success of their Zeds Dead collaboration "Lift Me Up" and the release of their second studio album Only In Dreams, bass dons Delta Heavy continue the onslaught by dropping the visuals for single "Take Me Home."
This song just so happens to be the final track on the album, and it definitely leaves you with a good feeling once all is said and done. The visuals carry the same vibe, showing the story of two toy dolls living and falling in love inside an arcade claw machine. Written and directed by Kun-I Chang and Shih-Wen Lin, the stunning visuals serve up a gripping narrative from its central characters.
It’s the ideal way for Delta Heavy to round off another mammoth year as they prepare to welcome in 2020. Make sure you check out the official video for "Take Me Home" below.
Read our interview with them here.


Magister Justin:
To tell you the truth, this temple's atmosphere is so solemn that it makes me feel want to take a nap. Thank goodness I can still concentrate on my studies...
Are you here to study also?
Learn skills.
Ask about Skill Enchanting.
Quest


Creation Date: {{QuoteDetailCtrl.quote.date | date:'hh:mm a , dd MMM, yyyy'}}
{{question.text}}
{{comment.text}}
{{comment.text}}
added at {{comment.createDate |date:'hh:mm a on dd/MM/yyyy'}}


|
| virtual ComponentListener | FocusMove [get] |
| | Fires when focus is moved within an element. More...
|
| |
| virtual ComponentListener | DOMActivate [get] |
| | Where supported. Fires when an element is activated, for instance, through a mouse click or a keypress. More...
|
| |
| virtual ComponentListener | DOMAttrModified [get] |
| | Where supported. Fires when an attribute has been modified. More...
|
| |
| virtual ComponentListener | DOMCharacterDataModified [get] |
| | Where supported. Fires when the character data has been modified. More...
|
| |
| virtual ComponentListener | DOMFocusIn [get] |
| | Where supported. Similar to HTML focus event, but can be applied to any focusable element. More...
|
| |
| virtual ComponentListener | DOMFocusOut [get] |
| | Where supported. Similar to HTML blur event, but can be applied to any focusable element. More...
|
| |
| virtual ComponentListener | DOMNodeInserted [get] |
| | Where supported. Fires when a node has been added as a child of another node. More...
|
| |
| virtual ComponentListener | DOMNodeInsertedIntoDocument [get] |
| | Where supported. Fires when a node is being inserted into a document. More...
|
| |
| virtual ComponentListener | DOMNodeRemoved [get] |
| | Where supported. Fires when a descendant node of the element is removed. More...
|
| |
| virtual ComponentListener | DOMNodeRemovedFromDocument [get] |
| | Where supported. Fires when a node is being removed from a document. More...
|
| |
| virtual ComponentListener | DOMSubtreeModified [get] |
| | Where supported. Fires when the subtree is modified. More...
|
| |
| virtual ComponentListener | Abort [get] |
| | Fires when an object/image is stopped from loading before completely loaded. More...
|
| |
| virtual ComponentListener | Blur [get] |
| | Fires when an element loses focus either via the pointing device or by tabbing navigation. More...
|
| |
| virtual ComponentListener | Change [get] |
| | Fires when a control loses the input focus and its value has been modified since gaining focus. More...
|
| |
| virtual ComponentListener | Click [get] |
| | Fires when a mouse click is detected within the element. More...
|
| |
| virtual ComponentListener | DblClick [get] |
| | Fires when a mouse double click is detected within the element. More...
|
| |
| virtual ComponentListener | Error [get] |
| | Fires when an object/image/frame cannot be loaded properly. More...
|
| |
| virtual ComponentListener | Focus [get] |
| | Fires when an element receives focus either via the pointing device or by tab navigation. More...
|
| |
| virtual ComponentListener | KeyDown [get] |
| | Fires when a keydown is detected within the element. More...
|
| |
| virtual ComponentListener | KeyPress [get] |
| | Fires when a keypress is detected within the element. More...
|
| |
| virtual ComponentListener | KeyUp [get] |
| | Fires when a keyup is detected within the element. More...
|
| |
| virtual ComponentListener | Load [get] |
| | Fires when the user agent finishes loading all content within the element. Only supported by window, frames, objects and images. More...
|
| |
| virtual ComponentListener | MouseDown [get] |
| | Fires when a mousedown is detected within the element. More...
|
| |
| virtual ComponentListener | MouseEnter [get] |
| | Fires when the mouse enters the element. More...
|
| |
| virtual ComponentListener | MouseLeave [get] |
| | Fires when the mouse leaves the element. More...
|
| |
| virtual ComponentListener | MouseMove [get] |
| | Fires when a mousemove is detected with the element. More...
|
| |
| virtual ComponentListener | MouseOut [get] |
| | Fires when a mouseout is detected with the element. More...
|
| |
| virtual ComponentListener | MouseOver [get] |
| | Fires when a mouseover is detected within the element. More...
|
| |
| virtual ComponentListener | MouseUp [get] |
| | Fires when a mouseup is detected within the element. More...
|
| |
| virtual ComponentListener | Painted [get] |
| | Fires whenever this Element actually becomes visible (painted) on the screen. This is useful when you need to perform 'read' operations on the DOM element, i.e: calculating natural sizes and positioning. Note: This event is not available to be used with event delegation. Instead painted only fires if you explicitly add at least one listener to it, for performance reasons. More...
|
| |
| virtual ComponentListener | Reset [get] |
| | Fires when a form is reset. More...
|
| |
| virtual ComponentListener | Resize [get] |
| | Important note: For the best performance on mobile devices, use this only when you absolutely need to monitor a Element's size. Note: This event is not available to be used with event delegation. Instead resize only fires if you explicitly add at least one listener to it, for performance reasons. More...
|
| |
| virtual ComponentListener | Scroll [get] |
| | Fires when a document view is scrolled. More...
|
| |
| virtual ComponentListener | Select [get] |
| | Fires when a user selects some text in a text field, including input and textarea. More...
|
| |
| virtual ComponentListener | Submit [get] |
| | Fires when a form is submitted. More...
|
| |
| virtual ComponentListener | Unload [get] |
| | Fires when the user agent removes all content from a window or frame. For elements, it fires when the target element or any of its content has been removed. More...
|
| |
| virtual ComponentListener | DoubleTap [get] |
| | Fires when there is a double tap. More...
|
| |
| virtual ComponentListener | LongPress [get] |
| | Fires when you touch and hold still for more than 1 second. More...
|
| |
| virtual ComponentListener | Pinch [get] |
| | Fires continuously when there is pinching (the touch must move for this to be fired). More...
|
| |
| virtual ComponentListener | PinchEnd [get] |
| | Fires when a pinch has ended. More...
|
| |
| virtual ComponentListener | PinchStarted [get] |
| | Fired once when a pinch has started. More...
|
| |
| virtual ComponentListener | Rotate [get] |
| | Fires continuously when there is rotation (the touch must move for this to be fired). When listening to this, ensure you know about the Ext.event.Event.angle and Ext.event.Event.rotation properties in the event object. More...
|
| |
| virtual ComponentListener | RotateEnd [get] |
| | Fires when a rotation event has ended. More...
|
| |
| virtual ComponentListener | RotateStart [get] |
| | Fired once when a rotation has started. More...
|
| |
| virtual ComponentListener | SingleTap [get] |
| | Fires when there is a single tap. More...
|
| |
| virtual ComponentListener | Swipe [get] |
| | Fires when there is a swipe When listening to this, ensure you know about the Ext.event.Event.direction property in the event object. More...
|
| |
| virtual ComponentListener | TapHold [get] |
| | Fires when you touch and hold still for more than 1 second. More...
|
| |
| override ConfigOptionsCollection | ConfigOptions [get] |
| |
| virtual string | InstanceOf [get] |
| |
| ItemState | State [get] |
| |
| virtual DefaultValueMode | DefaultValueMode [get, set] |
| |
| virtual bool | DesignMode [get] |
| |
| bool | AutoDataBind [get, set] |
| |
| ResourceManager | ResourceManager [get] |
| |
| virtual Control | Owner [get, set] |
| | The Owner Control for this Listener. More...
|
| |
| virtual bool | IsDefault [get] |
| | Does this object currently represent it's default state. More...
|
| |
| bool | IsTrackingViewState [get] |
| |
| EventHandlerList | Events [get] |
| |
| EventHandler | DataBinding |
| |
| Control | BindingContainer [get] |
| |
| virtual ConfigItemCollection | CustomConfig [get] |
| | Collection of custom js config More...
|
| |
| virtual ConfigOptionsCollection | ConfigOptions [get] |
| |
| virtual ConfigOptionsExtraction | ConfigOptionsExtraction [get] |
| |
|
System.Web.Mvc.HtmlHelper | HtmlHelper [get, set] |
| |
| ConfigOptionsCollection | ConfigOptions [get] |
| |
| ConfigOptionsExtraction | ConfigOptionsExtraction [get] |
| |
| DefaultValueMode | DefaultValueMode [get, set] |
| |


G# Class Item
· Create Method – Shows a dialog to create a method.
· Create Type Def Control – Shows a dialog to create a type def control.
· Create Property - Shows a dialog to create property get and set methods. If using LabVIEW 2010, this will create Property Definition folders.
· Edit Attributes – Opens the panel of the ObjectAttributes.ctl where the attributes of the class are defined.
· Edit Class Attributes – Opens the panel of the ClassAttributes.ctl where the attributes of the class are defined.
· Edit Class Icon – Shows the Class Icon Editor allowing change of the class icon header and colors. These changes will be applied to all VIs in the class.
· Change Descriptions – Shows a dialog to edit the description of the class, but also to all members of the class (VIs and controls).
· Clone Class – Shows a dialog to clone (copy) the class. An identical copy of the class will be created with a new name, icon and location.
· Rename Class – Shows a dialog to rename the class.
· Delete Class – Shows a confirmation dialog to delete the class. Class will be removed from both project and disk. The class could still be in memory though until LabVIEW is restarted.
· Change Inheritance – Shows a dialog to change the parent class to another class within the project. The class can also be converted to a base class.
· Change Abstract – Toggles if the class should be abstract or not. The class icon will also change. If abstract, the constructor of the class will be set to protected scope and if not abstract, the constructor will be set to public scope.
· Implement Interface – Shows a dialog to implement an already created G# interface. It will create the interface implementation class as well as all the methods defined in the G# interface.
· Create Unit Test – This feature is not yet supported.
· Class Information – Shows a dialog containing information about the class (template, version, provider and description).


Transit Near Me is an online tool that shows you the transit services, like buses and Metro rail, that serve your immediate area (or any other area you choose). Double-click or double-tap in an open area of the map to center your "circle" on that spot, and see all the transit services which stop inside the circle. Zoom out to see all the places those transit services go. Click on an individual stop to see which lines serve it. Click on an individual line to see where it goes.
Transit Near Me is being developed by the Mobility Lab Tech Transit Initiative, a project in the Washington, DC area to foster collaboration among software developers and create open source tools that help people better understand their transit options. Thanks to open data, where many transit agencies in our region and around the nation make their routes and schedules available to anyone for free, it's possible to build many useful applications that help people get around by transit and other modes. The Mobility Lab is part of Arlington County Commuter Services.
We plan to! In the spirit of open source development, we want to show you what we are working on early in the evolution of this tool. We think this has some very useful features already, and want to give you a chance to try it out. Meanwhile, we're working on a number of additional features to make it even more helpful.
That shouldn't stop you from telling us your thoughts. We welcome your input on how to improve Transit Near Me in the future, and which features to prioritize most highly. Please send us your feedback at<EMAIL_ADDRESS>Transit Near Me maps are powered by Leaflet. Map data is © OpenStreetMap contributors, CC-BY-SA. Map tiles are courtesy of MapQuest .
Transit information provided by Transit Near Me is for planning purposes only, and may not reflect real-time service availability. Please consult with local transit agencies for any service changes and outages, and plan your trips accordingly.


This privacy policy governs your use of the software application aspace (“Application”) for mobile devices that was created by aspace, Inc. The Application is the aspace app that connects commuters to more remote/cheaper parking spots and then last-mile transportation, like bike and scooter shares. The aspace app makes the transfer from parked car to bike/scooter seamless, and allows commuters to save hundreds of dollars a month on parking.
User Provided Information
The Application obtains the information you provide when you download and register the Application. Registration with us is optional. However, please keep in mind that you may not be able to use some of the features offered by the Application unless you register with us.
When you register with us and use the Application, you generally provide (a) your name, email address, age, user name, password and other registration information; (b) transaction-related information, such as when you make purchases, respond to any offers, or download or use applications from us; (c) information you provide us when you contact us for help; (d) credit card information for purchase and use of the Application, and; (e) information you enter into our system when using the Application, such as contact information and project management information.
We may also use the information you provided us to contact your from time to time to provide you with important information, required notices and marketing promotions.
Automatically Collected Information
In addition, the Application may collect certain information automatically, including, but not limited to, the type of mobile device you use, your mobile devices unique device ID, the IP address of your mobile device, your mobile operating system, the type of mobile Internet browsers you use, and information about the way you use the Application.
When you visit the mobile application, we may use GPS technology (or other similar technology) to determine your current location in order to determine the city you are located within and display a location map with relevant advertisements. We may share your current location with other users or partners.
If you do not want us to use your location for the purposes set forth above, you should turn off the location services for the mobile application located in your account settings or in your mobile phone settings and/or within the mobile application.
Yes. We will share your information with third parties only in the ways that are described in this privacy statement.
We may disclose User Provided and Automatically Collected Information:
as required by law, such as to comply with a subpoena, or similar legal process;
when we believe in good faith that disclosure is necessary to protect our rights, protect your safety or the safety of others, investigate fraud, or respond to a government request;
with our trusted services providers who work on our behalf, do not have an independent use of the information we disclose to them, and have agreed to adhere to the rules set forth in this privacy statement.
if aspace, Inc is involved in a merger, acquisition, or sale of all or a portion of its assets, you will be notified via email and/or a prominent notice on our Web site of any change in ownership or uses of this information, as well as any choices you may have regarding this information.
You can stop all collection of information by the Application easily by uninstalling the Application. You may use the standard uninstall processes as may be available as part of your mobile device or via the mobile application marketplace or network. You can also request to opt-out via email, at<EMAIL_ADDRESS>We will retain User Provided data for as long as you use the Application and for a reasonable time thereafter. We will retain Automatically Collected information for up to 24 months and thereafter may store it in aggregate. If you’d like us to delete User Provided Data that you have provided via the Application, please contact us at<EMAIL_ADDRESS>we will respond in a reasonable time. Please note that some or all of the User Provided Data may be required in order for the Application to function properly.
We do not use the Application to knowingly solicit data from or market to children under the age of 13. If a parent or guardian becomes aware that his or her child has provided us with information without their consent, he or she should contact us at<EMAIL_ADDRESS>We will delete such information from our files within a reasonable time.
We are concerned about safeguarding the confidentiality of your information. We provide physical, electronic, and procedural safeguards to protect information we process and maintain. For example, we limit access to this information to authorized employees and contractors who need to know that information in order to operate, develop or improve our Application. Please be aware that, although we endeavor provide reasonable security for information we process and maintain, no security system can prevent all potential security breaches.
This Privacy Policy may be updated from time to time for any reason. We will notify you of any changes to our Privacy Policy by posting the new Privacy Policy here and informing you via email or text message. You are advised to consult this Privacy Policy regularly for any changes, as continued use is deemed approval of all changes. You can check the history of this policy by clicking here.
By using the Application, you are consenting to our processing of your information as set forth in this Privacy Policy now and as amended by us. "Processing,” means using cookies on a computer/hand held device or using or touching information in any way, including, but not limited to, collecting, storing, deleting, using, combining and disclosing information, all of which activities will take place in the United States. If you reside outside the United States your information will be transferred, processed and stored there under United States privacy standards.
If you have any questions regarding privacy while using the Application, or have questions about our practices, please contact us via email at help@trya.space.


File
New
Open
Save
Edit
Sketch
Save
Quit
StepThru
Help
Up to date
Undo
H
L
R
B
T
+
-
If you are seeing this, your web browser does not support the <canvas> element.
Type of Branch to add:
Primitives
Grown
Applied
Boolean
Transform
Sketch
Solver
point
extrude
fillet
intersect
translate
skbeg
solbeg
box
rule
chamfer
subtract
rotatex
skvar
solcon
sphere
blend
hollow
union
rotatey
skcon
solend
cone
revolve
join
rotatez
linseg
cylinder
sweep
connect
scale
cirarc
torus
loft*
extract
mirror
arc
import
combine
applycsys
spline
udprim
reorder
bezier
restore
skend
Utilities
dimension
mark
patbeg
ifthen
dump
select
throw
set
group
patbreak
elseif
store
getattr
catbeg
assert
patend
else
project
catend
udparg
endif
Enter arguments for the new Branch
Either select one of these options ...
... or edit the arguments of the current Branch
Type:
-----
Name:
Activity:
Active
Suppressed
Num Attrs:
-----
Name1:
Name2:
Name3:
Name4:
Name5:
Name6:
Name7:
Name8:
Name9:
Attr1:
(attr)
Attr2:
(attr)
Attr3:
(attr)
Attr4:
(attr)
Attr5:
(attr)
Attr6:
(attr)
Attr7:
(attr)
Attr8:
(attr)
Attr9:
(attr)
Either select one of these options...
... or enter values for the new Parameter
Either select one of these options ...
... or edit the current Parameter
Name:
-----
the table goes here
filename
You should not see this.


Mike Plummer | Senior Consultant | Object Partners
Slides and source available on GitHub
Combination of Directive and Controller from Angular 1.x
@Component({
selector: 'mySelector',
templateUrl: './myTemplate.html',
directives: [ChildComponent1, ChildComponent2],
pipes: [UsedPipe1],
styles: ['background-color: #fff'],
providers: [UsedService1, UsedService2]
})
| Type | Syntax | Example |
|---|---|---|
| Element Name | name | <omaha> |
| Attribute | [name] | <city omaha> |
| Attribute & Value | [name=value] | <div [city]="omaha"> |
| CSS Class | .name | <city class="omaha"> |
| Negation | :not(name) | |
| Multiple (any match) | selector1, selector2 |
Angular 2 uses hierarchical injection - eliminates service/factory/provider uncertainty from Angular 1.x
How do we move data between a directive and the view?
| Type | Syntax |
|---|---|
| Value | {{ }} |
| Event | ( ) |
| One-way | [ ] |
| Two-way | [( )] |
| Type | Syntax |
|---|---|
| Public variables | cookie: Oreo; |
| Accept attribute from view | @Input |
| Emit events view can respond to | @Output |
Ready, ready
Omaha rules!
Eat snacks
Eat snacks
Just kidding, let's look at some pre-written code that won't inevitably fail to work.


{%extends "nav_events.html" %} {%load pgmarkdown%} {%block title%}New Conference Sponsor Shipment - {{conference}}{%endblock%} {%block content %}
Pick which address you want to ship to, based on the criteria.
Shipments to this address may not arrive before {{a.startdate}}.
Shipments to this address must arrive before or on {{a.enddate}}.


Home of the Bob's Burger, may I take your order.
Enter username and password for UNLIMITED POWAAAAA!!!
Buy it now! or don't, I'm not your boss


Hey! My name is William An and I am a recent graduate of University of California, San Diego (2017, Physics B.s.)
More Information
This blog is for me to document my experience learning and playing with various computer technologies and topics. I hope it will be of some use to anyone who happens to take a look!
I am interested in pursuing a career in data science.
When I am not working on a computer, I like to surf and swim.


Spencer Hasting's Friend Space
Spencer Hasting has
352
friends.
Franklin
Brooks
Featherstone
Frida
Billy H. M.
Aoife
Amado
Stars


EN
FR
ZAR
USD
free shipping for standard order over R100
Home
Shop
About
NATE B
Blog
Contact
Lookbook
Contact us
Home
/ Contact us
Our Address
379 5th Ave, Rondebosch, CT 7700
<EMAIL_ADDRESS>3 of 3


{% load static %}
I am a college student who wants to be a programmer in the IT field. It is a portfolio page that records my career in this web page. This homepage is a journal for my personal record.
Thank you.
{{c.post}}
Besides IT, I have a hobby like games and movies. It enjoys indoor activity mainly but enjoys sports such as soccer. Among the sports, I enjoy the football the most, but I can not do well.
When forced indoors, My favorite hobby is also a game. I enjoy various games from RPG to FPS. Because programmers can relax and enjoy quickly and easily, there is nothing better than a game. I usually do my study the most, but If you choose the next, it will be a game.
No post are available.
{% endif %}


Crank up the bass with your Echo Buds
How to change the EQ controls on your Echo Buds
by Jeramy JohnsonWe love how customizable the Echo Buds are. From controlling the Active Noise Reduction to playing or pausing a track, there are a lot of ways you can make the Buds do your bidding. Did you know that you can also control the EQ settings for your Echo Buds in the Amazon Alexa app? You can turn up the bass or adjust the treble to your heart's content. Read on and we'll show you how!
Products used in this guide
- Easy EQ controls: Amazon Echo Buds ($130 at Amazon)
How to change the EQ controls on your Echo Buds
- Open your Echo Buds case and put the Buds in your ears.
- Open the Alexa app, and notice the Echo Buds quick settings.
- Scroll down to the Audio Control section and tap on Equalizer.
-
From the Equalizer screen you can adjust the Base, Mid, and Treble to suit your personal tastes.
Source: Jeramy Johnson / Android Central
We told you it was easy to adjust your EQ settings! Now that you know how it's done, you can go back and tweak the settings per song or genre whenever you want.
Our top equipment picks
If you were on the fence about picking up a pair of Echo Buds for yourself, read all about why we love them in our review, and then grab a pair for yourself or your loved ones for the holidays.
Alexa in your ear
Echo Buds
Alexa breaks out
The Amazon Echo Buds offer great sound, Alexa access, and custom controls for a solid wireless earbud experience.
The Echo Buds are a great, affordable pair of wireless earbuds that have a surprising amount of customization in the app controls. Alexa can help you with your daily tasks or change music for you on the fly, and you'll be surprised how useful the EQ features are in crafting that "just right" sound!
Additional Equipment
If you haven't already, why not sign up for one of these great music streaming services that you can control with Alexa via your Echo Buds?
Amazon Music Unlimited (From $8 per month at Amazon)
Amazon Music Unlimited offers over 40 million songs, special exclusives, and tailored playlists and stations. It's already affordable, but Amazon Prime members can even get some money off.
Apple Music (From $10 per month at Apple)
Apple Music is one of the top streaming services, and can be easily connected to and controlled by your Echo Buds and other Echo devices.
We may earn a commission for purchases using our links. Learn more.


A Wikipedia-style web application built with Ruby on Rails, Blocipedia incorporates 3rd party gems like Devise, Redcarpet, and Stripe to provide a realistic ‘wiki’ experience.
Devise - Authentication
For user authentication, Blocipedia makes use of a really handy and popular rails extention and gem called devise. It enhances your User
model with the necessary attributes and methods for secure authentication as well as many additional auth-related features.
Out-of-the-box devise (depicted above) works quite well, but it is a very plain appearance by default. As Blocipedia matured and took on a particular look and feel (inherited from Boostrap v4), I wanted to modify the views that devise provides by default to fit in a bit better. Luckily Devise supports customization fairly well, so all I had to do was run this command:
rails generate devise:views User
This moved the default devise views into my application directories, so that I could modify them to fit my needs, adding bootstrap wrappers and classes. This led to a set of views that was much more in-line with the rest of the application aesthetic.
While most of what I changed was HTML tags and classes, I also customized the default devise messaging system to integrate better with my own rails flash
-based approach for displaying success/failure messages.
Views weren’t the only thing about devise I ended up wanting to customize, however. I needed custom user-related routes like /unsubscribe_from_premium
and /user/update_password
. Customizing the routes did end up posing some challenges; particularly when trying to write tests for my intended functionality. Here is the error I received when I attempted to run these tests.
Luckily, the answer is right there in the error message, but it took a bit of research to understand exactly what it meant. I learned that these tests bypass the routing mechanism that devise relies on to direct URIs to their appropriate actions. What I needed to do was to tell the test to use those ‘mappings’ so that the correct actions are invoked. To do this I specified the devise mappings in the @request.env
hash prior to making the requests.
[spec/controllers/registrations_controller_spec.rb]
before do
@request.env["devise.mapping"] = Devise.mappings[:user]
end
Doing that allowed all the test requests to invoke the appropriate actions and lead to the expected outcomes.
Pundit - Authorization
Pundit is a tool that allows you to create authorization logic (as opposed to authentication logic) to allow users to access only that information which they should be allowed to access.
Pundit does this by creating policy classes associated with models. When used a appropriately, the Pundit policy for a stands as a protective layer in between the access request and the model or controller itself. Each model and controller method/action can have a corresponding Pundit policy method which evaluates the current context to return a true
or false
representation of whether or not the user should be allowed to perform that action. Often these decisions are based solely on the logged in user instance and the model class they are trying to access.
For example, Blocipedia allows non-members to read public wikis, but private wikis may only be seen by their creators and collaborators. The pundit wiki_policy
includes the following to boolean methods which determine a user’s ability to request the index
and show
actions on the Wiki
controller.
def index?
true
end
def show?
user.try(:admin?) or user == record.owner or record.collaborators.find_by(user_id: user.try(:id)) or record.public?
end
As you can see, anyone may access the index
action on the Wiki
controller. Granted, the set of wikis that are shown on that page are only a subset (i.e. ‘public’ wikis) if no user is logged in, but that logic is handled in what’s called a Pundit Scope definition. Here we’re only determining if they’re allowed to execute an action on the controller.
The show
action has a much higher barrier of entry. A user must be an admin, the owner of the wiki in question, a contributor to it (via the HMT relationship), or the wiki must be public in order for the action to be allowed.
Pundit can greatly simplify the management of authroization strategies through clear separation of concerns. When data models begin to have complex relationships with other models that affect authorization, defining scope can be especially tricky, but knowing that authorization is handled in one specific location is extraordinarily helpful.
Redcarpet
I couldn’t imagine writing a wikipedia ‘pastiche’ that didn’t involve some form of markdown language. While I have a lot of experience with the mediawiki markdown style, I rather prefer the style used by github and other code-focused platforms. I searched around for a bit and found redcarpet to be a good option for rails development, so I included it in my project very near the beginning.
I wrote several helper functions to help provide seed data for Blocipedia’s dev and test environments and was disappointed to learn that tools like FactoryBot recommend NOT leveraging their factories in seed files, so there is a bit of redundancy where those ‘fake wiki’ functions are concerned. I also used Faker to easily access a bunch of fun example text to make these non-production environments feel more real.
Markdown Previews
A big feature that I found missing in this project early on was the ability to preview a wiki that you’re editing so that you can quickly make adjustments and obtain your desired look before actually ‘saving’ the page. This was somewhat tricky however, as redcarpet performs server-side HTML rendering of markdown text. When the user is editing, however, the server doesn’t have those edits until they’re submitted – traditionally as part of the create/update actions – so I needed some other tool.
I needed to have a small piece of aysynchronous code in the /edit/:id
view that would make a server call to render some submitted text and send back the rendered html. The client side code would then insert the received HTMl into a ‘preview container’ for display to the user.
To accomplish this, I created a custom preview
action in the wikis_controller.rb
that corresponded to a /markdown
route in routes.rb
. By performing a POST
to that route, I could leverage the server-side rendering capabilities of Redcarpet with a helper function and return it to the calling code - a snippet of JQuery that made the request and used a small callback function to insert it into the wiki-preview
container, which corresponded with a tabbed area using bootstrap.
The result is a very functional and convenient preview feature to help users quickly verify the effects of the markup they are writing.
Bootstrap 4
My Blocipedia project cooincided nicely with the release of Twitter Bootstrap’s v4 release. This version was a significant overhaul of Bootstrap’s paradigm with changes to underlying css properties used, syntax, and offered features. While it took some adjusting to, I greatly appreciated the updates: grid layout leveraging flex
instead of float
; improved class relationships which reduced the overall quantity of classes required; and the updated aesthetics which, though similar, are more ‘clean’ than previous versions, in my opinion.
Stripe
Integrating with Stripe allowed me to explore the real-world scenario of incorporating payment and subscriptions into my application. Blocipedia users can upgrade their membership to Premium
status to access additional features, like creating private wikis. Since Blocipedia is not a true business venture, only the test version of Stripe is used to demonstrate this functionality (no financial transactions will actually take place).


|
Panda3D
|
A block of bytes that holds one or more VertexDataBlocks. More...
Public Types | |
| enum | RamClass { RC_resident = 0, RC_compressed = 1, RC_disk = 2, RC_end_of_list = 3 } |
Public Member Functions | |
| VertexDataBlock | alloc (int size) |
| Allocates a new block. More... | |
| VertexDataBook | getBook () |
| Returns a pointer to the book that owns this page. More... | |
| VertexDataBlock | getFirstBlock () |
| Returns a pointer to the first allocated block, or NULL if there are no allocated blocks. More... | |
| VertexDataPage::RamClass | getPendingRamClass () |
| Returns the pending ram class of the array. More... | |
| VertexDataPage::RamClass | getRamClass () |
| Returns the current ram class of the array. More... | |
| output (Ostream out) | |
| requestResident () | |
| Ensures that the page will become resident soon. More... | |
| bool | saveToDisk () |
| Writes the page to disk, but does not evict it from memory or affect its LRU status. More... | |
| write (Ostream out, int indent_level) | |
| Public Member Functions inherited from SimpleAllocator | |
| __init__ (int max_size, Mutex lock) | |
| __init__ (SimpleAllocator from) | |
| Move constructor. More... | |
| SimpleAllocatorBlock | alloc (int size, int alignment) |
| Allocates a new block. More... | |
| int | getContiguous () |
| Returns an upper-bound estimate of the size of the largest contiguous block that may be allocated. More... | |
| SimpleAllocatorBlock | getFirstBlock () |
| Returns a pointer to the first allocated block, or NULL if there are no allocated blocks. More... | |
| int | getMaxSize () |
| Returns the available space for allocated objects. More... | |
| int | getTotalSize () |
| Returns the total size of allocated objects. More... | |
| bool | isEmpty () |
| Returns true if there are no blocks allocated on this page, or false if there is at least one. More... | |
| output (Ostream out) | |
| setMaxSize (int max_size) | |
| Changes the available space for allocated objects. More... | |
| write (Ostream out) | |
| Public Member Functions inherited from SimpleLruPage | |
| __init__ (const SimpleLruPage copy) | |
| __init__ (int lru_size) | |
| dequeueLru () | |
| Removes the page from its SimpleLru. More... | |
| enqueueLru (SimpleLru lru) | |
| Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added. More... | |
| evictLru () | |
| Evicts the page from the LRU. More... | |
| SimpleLru | getLru () |
| Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU. More... | |
| int | getLruSize () |
| Returns the size of this page as reported to the LRU, presumably in bytes. More... | |
| markUsedLru () | |
| To be called when the page is used; this will move it to the tail of the SimpleLru queue it is already on. More... | |
| markUsedLru (SimpleLru lru) | |
| To be called when the page is used; this will move it to the tail of the specified SimpleLru queue. More... | |
| SimpleLruPage | operator= (const SimpleLruPage copy) |
| output (Ostream out) | |
| setLruSize (int lru_size) | |
| Specifies the size of this page, presumably in bytes, although any unit is possible. More... | |
| write (Ostream out, int indent_level) | |
Static Public Member Functions | |
| static | flushThreads () |
| Waits for all of the pending thread tasks to finish before returning. More... | |
| static TypeHandle | getClassType () |
| static SimpleLru | getGlobalLru (VertexDataPage::RamClass rclass) |
| Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass. More... | |
| static int | getNumPendingReads () |
| Returns the number of read requests that are waiting to be serviced by a thread. More... | |
| static int | getNumPendingWrites () |
| Returns the number of write requests that are waiting to be serviced by a thread. More... | |
| static int | getNumThreads () |
| Returns the number of threads that have been spawned to service vertex paging requests, or 0 if no threads have been spawned (which may mean either that all paging requests will be handled by the main thread, or simply that no paging requests have yet been issued). More... | |
| static SimpleLru | getPendingLru () |
| Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread. More... | |
| static VertexDataSaveFile | getSaveFile () |
| Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary. More... | |
| static | stopThreads () |
| Call this to stop the paging threads, if they were started. More... | |
Public Attributes | |
| VertexDataSaveFile | save_file |
| Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary. More... | |
A block of bytes that holds one or more VertexDataBlocks.
The entire page may be paged out, in the form of in-memory compression or to an on-disk cache file, if necessary.
| enum RamClass |
| VertexDataBlock alloc | ( | int | size | ) |
Allocates a new block.
Returns NULL if a block of the requested size cannot be allocated.
To free the allocated block, call block->free(), or simply delete the block pointer.
|
static |
Waits for all of the pending thread tasks to finish before returning.
| VertexDataBook getBook | ( | ) |
Returns a pointer to the book that owns this page.
|
static |
| VertexDataBlock getFirstBlock | ( | ) |
Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.
|
static |
Returns a pointer to the global LRU object that manages the VertexDataPage's with the indicated RamClass.
|
static |
Returns the number of read requests that are waiting to be serviced by a thread.
|
static |
Returns the number of write requests that are waiting to be serviced by a thread.
|
static |
Returns the number of threads that have been spawned to service vertex paging requests, or 0 if no threads have been spawned (which may mean either that all paging requests will be handled by the main thread, or simply that no paging requests have yet been issued).
|
static |
Returns a pointer to the global LRU object that manages the VertexDataPage's that are pending processing by the thread.
| VertexDataPage::RamClass getPendingRamClass | ( | ) |
Returns the pending ram class of the array.
If this is different from get_ram_class(), this page has been queued to be processed by the thread. Eventually the page will be set to this ram class.
| VertexDataPage::RamClass getRamClass | ( | ) |
Returns the current ram class of the array.
If this is other than RC_resident, the array data is not resident in memory.
|
static |
Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary.
| output | ( | Ostream | out | ) |
| requestResident | ( | ) |
Ensures that the page will become resident soon.
Future calls to get_page_data() will eventually return non-NULL.
| bool saveToDisk | ( | ) |
Writes the page to disk, but does not evict it from memory or affect its LRU status.
If it gets evicted later without having been modified, it will not need to write itself to disk again.
|
static |
Call this to stop the paging threads, if they were started.
This may block until all of the pending tasks have been completed.
| write | ( | Ostream | out, |
| int | indent_level | ||
| ) |
| VertexDataSaveFile save_file |
Returns the global VertexDataSaveFile that will be used to save vertex data buffers to disk when necessary.


Your best Matches
22nd Feb/Wednesday 3.30 PM
HarbourFront
23rd Feb/Thursday 10.00 AM
Changi Airport
23rd Feb/Thursday 11.00 PM
Clarke Quay


Swift
Q1. What is this code an example of?
let val = (Double)6
- [x] an error
- [ ] typecasting
- [ ] assignment
- [ ] initialization
Q2. What is the error in this code?
let x = 5
guard x == 5 { return }
- [x] The guard is missing the else.
- [ ] Nothing is wrong.
- [ ] The guard is missing a then.
- [ ] The comparison is wrong.
Q3. What is the raw/underlying type of this enum?
enum Direction {
case north, south, east, west
}
- [x] There is none.
- [ ] String
- [ ] Any
- [ ] Int
Q4. Why is dispatchGroup used in certain situations?
- [x] It allows multiple synchronous or asynchronous operations to run on different queues.
- [ ] It allows track and control execution of multiple operations together.
- [ ] It allows operations to wait for each other as desired.
- [ ] all of these answers.
Q5. What is this code an example of?
let val = 5
print("value is: \(val)")
- [x] string interpolation
- [ ] string compilation
- [ ] method chaining
- [ ] string concatenation
Q6. What are the contents of vals after this code is executed?
var vals = [10, 2]
vals.sort { (s1, s2) -> Bool in
s1 > s2
}
- [x] [10, 2]
- [ ] [2, 10]
- [ ] nil
- [ ] This code contains an error
Q7. What does this code print?
typealias Thing = [String, Any]
var stuff: Thing
print(type(of: stuff))
- [ ] Dictionary<String, Any> (To print this than code in question has to be
typealias Thing = [String: Any]
)
- [ ] Dictionary
- [x] ERROR (If code in question is really like that.)
- [ ] Thing
Q8. What is the value of y?
let x = ["1", "2"].dropFirst()
let y = x[0]
- [x] This code contains an error
- [ ] 1
- [ ] 2
- [ ] nil
Q9. What is the value of test in this code?
var test = 1 == 1
- [x] TRUE
- [ ] YES
- [ ] 1
- [ ] This code contains an error
Q10. What is the value of y?
var x: Int?
let y = x ?? 5
- [x] 5
- [ ] 0
- [ ] nil
- [ ] This code contains an error
Q11. What is the type of this function?
func add(a: Int, b: Int) -> Int { return a+b }
- [ ] Int
- [x] (Int, Int) -> Int
- [ ] Int
- [ ] Functions don't have types.
Q12. What is the correct was to call this function?
func myFunc(_ a: Int, b: Int) -> Int {
return a + b
}
- [x] myFunc(5, b: 6)
- [ ] myFunc(5, 6)
- [ ] myFunc(a: 5, b: 6)
- [ ] myFunc(a, b)
Q13. The Codable protocol is **_**?
- [x] a combination of Encodable and Decodable
- [ ] not a true protocol <<<<—Possibly correct as it's a typealias of Encodable and Decodable
- [ ] required of all classes
- [ ] automatically included in all classes
Q13. What is the type of value1 in this code?
let value1 = "\("test".count)"
- [x] String
- [ ] Int
- [ ] null
- [ ] test.count
Q14. When a function takes a closure as a parameter, when do you want to mark is as escaping?
- [x] when it's executed after the function returns
- [ ] when it's scope is undefined
- [ ] when is's lazy loaded
- [ ] all of these answers
Q15. What's wrong with this code?
class Person {
var name: String
var address: String
}
- [x] Person has no initializers.
- [ ] Person has no base class.
- [ ] var name is not formatted corrrectly.
- [ ] address is a keyword.
Q16. What is the value of names after this code is executed?
let names = ["Bear", "Joe", "Clark"]
names.map { (s) -> String in
return s.uppercased()
}
- [ ] ["BEAR", "JOE", "CLARK"]
- [ ] ["B", "J", "C"]
- [x] ["Bear", "Joe", "Clark"]
- [ ] This code contains an error.
Q17. What describes this line of code?
let val = 5
- [x] a constant named val of type Int
- [ ] a variable named val of type item
- [ ] a constant named val of type Number
- [ ] a variable named val of type Int
Q18. What is the error in this code?
extension String {
var firstLetter: Character = "c" {
didSet {
print("new value")
}
}
}
- [x] Extensions can't add properties. // although extensions technically can't contain stored properties
- [ ] Nothing is wrong with it.
- [ ] didSet takes a parameter.
- [ ] c is not a character.
Q19. didSet and willSet are examples of \***\*\_\*\***
?
- [x] property observers
- [ ] key properties
- [ ] all of these answers
- [ ] newOld value calls
Q20. What is wrong with this code?
self.callback = {
self.attempts += 1
self.downloadFailed()
}
- [x] Use of self inside the closure causes retain cycle.
- [ ] You cannot assign a value to closure in this manner.
- [ ] You need to define the type of closure explicitly.
- [ ] There is nothing wrong with this code.
Q21. How many values does vals have after this code is executed?
var vals = Set<String> = ["4", "5", "6"]
vals.insert("5")
- [x] three
- [ ] four
- [ ] eight
- [ ] This code contains an error.
Q22. How can you avoid a strong reference cycle in a closure?
- [x] Use a capture list to set class instances of weak or unowned.
- [ ] You can't, there will always be a danger of strong reference cycles inside a closure.
- [ ] Initialize the closure as read-only.
- [ ] Declare the closure variable as lazy.
Q23. How can you avoid a strong reference cycle in a closure?
- [x] an instance of any class
- [ ] all of these answers
- [ ] an instance of an optional type
- [ ] an instance of function type
Q24. What is wrong with this code?
if let s = String.init("some string") {
print(s)
}
- [x] This String initializer does not return an optional.
- [ ] String does not have an initializer that can take a String.
- [ ] = is not a comparison.
- [ ] Nothing is wrong with this code.
Q25. Which code snippet correctly creates a typealias closure?
- [x] typealias CustomClosure: () -> ()
- [ ] typealias CustomClosure { () -> () }
- [ ] typealias CustomClosure -> () -> ()
- [ ] typealias CustomClosure -> () {}
Q26. How do you reference class members from within a class?
- [x] self
- [ ] instance
- [ ] class
- [ ] this
Q27. All value types in Swift are **_** under the hood?
- [x] structs
- [ ] classes
- [ ] optionals
- [ ] generics
Q28. What is the correct was to ass a value to this array?
var strings = [1, 2, 3]
- [x] all of these answers
- [ ] strings.append(4)
- [ ] strings.insert(5, at: 1)
- [ ] strings += [5]
Q29. How many times will this loop be executed?
for i in 0...100 {
print(i)
}
- [ ] 0
- [x] 101
- [ ] 99
- [ ] 100
Q30. What can AnyObject represent?
- [x] an instance of any class
- [ ] an instance of an optional type
- [ ] an instance of a function type
- [ ] all of these answers
Q31. What does this code print?
typealias Thing = [String:Any]
var stuff : Thing
print(type(of:stuff))
- [ ] Dictionary
- [ ] ERROR
- [ ] Thing
- [x] Dictionary<String, Any>
Q32. What is the value of test in this code?
var test = 1 == 1
- [x] TRUE
- [ ] 1
- [ ] This code contains an error.
- [ ] YES
Q33. What is the value of y?
var x : Int?
let y = x ?? 5
- [ ] 0
- [ ] nil
- [ ] This code contains an error.
- [x] 5
Q34. What is the value of y?
let x = ["1","2"].dropFirst()
let y = x[0]
- [ ] 1
- [ ] nil
- [x] This code contains an error.
- [ ] 2
Q35. What is the value of t after this code is executed?
let names = ["Larry","Sven","Bear"]
let t = names.enumerated().first().offset
- [x] This code is invalid.
- [ ] 0
- [ ] 1
- [ ] Larry
Q36. What is the value of test after this code executes?
let vt = (name: "ABC", val: 5)
let test = vt.0
- [x] ABC
- [ ] 0
- [ ] 5
- [ ] name
Q37. What is the base class in this code?
class LSN : MMM {
}
- [x] MMM
- [ ] LSN
- [ ] There is no base class.
- [ ] This code is invalid.
Q38. What does this code print to the console?
var userLocation: String = "Home" {
willSet(newValue) {
print("About to set userLocation to \(newValue)...")
}
didSet {
if userLocation != oldValue {
print("userLocation updated with new value!")
} else {
print("userLocation already set to that value...")
}
}
}
userLocation = "Work"
- [x] About to set userLocation to Work… userLocation updated with new value!
- [ ] About to set userLocation to Work… userLocation already set to that value…
- [ ] About to set userLocation to Home… userLocation updated to new value!
- [ ] ERROR
Q39. What must a convenience initializer call?
- [ ] a base class convenience initializer
- [ ] either a designated or another convenience initializer
- [x] a designated initializer
- [ ] none of these answers
Q40. Which object allows you access to specify that a block of code runs in a background thread?
- [ ]
DispatchQueue.visible
- [x]
DispatchQueue.global
- [ ]
errorExample
need to be labeled as throws
.
- [ ]
DispatchQueue.background
Q41. What is the inferred type of x?
let x = ["a", "b", "c"]
- [ ]
String[]
- [x]
Array<String>
- [ ]
Set<String>
- [ ]
Array<Character>
Q42. What is the value of oThings
after this code is executed?
let nThings: [Any] = [1, "2", "three"]
let oThings = nThings.reduce("") { "\($0)\($1)" }
- [ ]
11212three
- [ ]
115
- [x]
12three
- [ ] Nothing, this code is invalid.
Q43. How would you call a function that throws errors and also returns a value?
- [ ]
!try
- [x]
try?
- [ ]
try!
- [ ]
?try
Q44. What is wrong with this code?
protocol TUI {
func add(x1 : Int, x2 : Int) -> Int {
return x1 + x2
}
}
- [ ] Protocol functions cannot have return types.
- [x] Protocol functions cannot have implementations.
- [ ] Nothing is wrong with it.
- [ ]
add
is a reserved keyword.
Q45. In this code, what are wheels
and doors
examples of?
class Car {
var wheels: Int = 4
let doors = 4
}
- [ ] class members
- [ ] This code is invalid.
- [ ] class fields
- [x] class properties
Q46. What is the value of t
after this code is executed?
let names = ["Larry", "Sven", "Bear"]
let t = names.enumerated().first().offset
- [x] This code does not compile.
- [ ]
0
- [ ]
1
- [ ]
Larry
Q47. How do you designate a failable initializer?
- [ ]
init?
- [ ]
deinit
- [x]
init
- [ ] You can't.
Q48. What is printed when this code is executed?
let dbl = Double.init("5a")
print(dbl ?? ".asString()")
- [ ]
five
- [ ]
5a
- [x]
.asString()
- [ ]
5
Q49. In the function below, what are this and toThat examples of?
func add(this x: Int, toThat y: Int)->{}
- [ ] none of these answers
- [ ] local terms
- [x] argument labels
- [ ] parameters names
Q50. What can AnyObject represent?
- [ ] an instance of any class
- [ ] an instance of function type
- [x] all of these answers
- [ ] an instance of an optional type
Q51. What is wrong with this code?
if let s = String.init("some string"){
print (s)
}
- [ ] Nothing is wrong with this code
- [ ] = is not a comparison
- [ ] String does not have an initializer that can take a String
- [x] This String initializer does not return an optional
Q52. What is wrong with this code?
for (key, value) in [1: "one", 2: "two"]{
print(key, value)
}
- [ ] The interaction source is invalid
- [ ] The interaction variable is invalid
- [x] There is nothing wrong with this code
- [ ] The comma in the print is misplaced
Q53. Which of these choices is associated with unit testing?
- [ ] XCTest
- [X] all of these answers
- [ ] @testable
- [ ] XCAssert
Q54. In the code below, what is width an example of?
class Square{
var height: Int = 0
var width : Int {
return height
}
}
- [ ] This code contains error
- [ ] a closure
- [x] a computed property
- [ ] lazy loading
Q55. What data type is this an example of?
let vals = ("val", 1)
- [ ] a dictionary
- [x] a tuple
- [ ] an optional
- [ ] This code contains error
Q56. What is wrong with this code?
var x = 5
x = 10.0
- [x] You cannot assign a Double to a variable of type Int
- [ ] x is undefined
- [ ] x is a constant
- [ ] x has no type
Q57. What is the type of x: let x = try?
String.init(from: decoder)
- [ ] String
- [x] String?
- [ ] String!
- [ ] try?
Q58. What will this code print to the console?
var items = ["a":1, "b":2, "c":"test"] as [String: Any]
items["c"] = nil
print(items["c"] as Any)
- [ ]
Any
- [ ]
test
- [ ]
1,2,3
- [x]
nil
Q59. What is wrong with this code?
let val = 5.0 + 10
- [x] There is nothing wrong with this code
- [ ] val is a constant and cannot be changed
- [ ] 5.0 and 10 are different types
- [ ] There is no semicolon
Q60. How many parameters does the initializer for Test have?
struct Test{
var score: Int
var date: Date
}
- [ ] zero
- [ ] This code contains an error
- [x] two
- [ ] Structs do not have initializers
Q61. What prints to the console when executing this code?
let x = try? String.init("test")
print(x)
- [ ]
nil
- [ ] Nothing - this code contains an error
- [x]
Optional("test")
- [ ]
test
Q62. How can you sort this array?
var vals = [1,2,3]
- [ ]
vals.sort { $0 < $1 }
- [ ]
vals.sort { (s1, s2) in s1 < s2 }
- [ ]
vals.sort(by: <)
- [x] all of these answers
Q63. What is printed when this code is executed?
let dbl = Double.init("5a")
print(dbl ?? ".asString()")
- [ ]
5a
- [ ]
5
- [ ]
five
- [x]
asString()
Q64. DispatchQueue.main.async takes a block that will be
- [ ] not executed
- [x] executed in the main queue
- [ ] none of these answers
- [ ] executed on the background thread
Q65. What is the value of test after this code executes?
let vt = (name: "ABC", val: 5)
let test = vt.0
- [x]
ABC
- [ ]
name
- [ ]
5
- [ ]
0
Q66. When is deinit called?
- [ ] When a class instance needs memory
- [x] All of these answers
- [ ] When the executable code is finished
- [ ] When a class instance is being removed from memory
Q67. How do you designated a failable initializer?
- [ ] You cannot
- [ ]
deinit
- [x]
init?
- [ ]
init
Q68. How do you declare an optional String?
- [x]
String?
- [ ]
Optional[String]
- [ ]
[String]?
- [ ]
?String
Q69. Why is dispatchGroup used in certain situation?
- [x] All of these answers
- [ ] It allows multiple synchronous or asynchronous operations to run on different values
- [ ] It allows operations to wait for each other as defined
- [ ] It allows track and control execution of multiple operations together
Q70. What is the value of t after this code is executed?
let names = ["Larry", "Sven", "Bear"]
let t = names.enumerated().first().offset
- [ ]
Larry
- [ ]
0
- [ ]
1
- [x] This code does not compile
Q71. How many times this code will be executed?
for i in ["0", "1"]{
print(i)
}
- [ ] one
- [X] two
- [ ] three
- [ ] This code does not compile
Q72. What does this code print?
let names = ["Bear", "Tony", "Svante"]
print(names[1]+"Bear")
- [ ]
1Bear
- [ ]
BearBear
- [x]
TonyBear
- [ ] Nothing, this code is invalid


Fluff Stuff
Shop
About
Fabrication
Cart
Log In/Check Out
Shop > Couch Pillow > After School Special Couch Pillow
Add to Cart


| « Prev 4.3.1 Environments | Table of Contents | Next » 4.3.3 Builders |
Construction variables are values assigned to keys within an Environment. Construction variables are used by Builders to produce output files. See Default Construction Variables for a reference of all built-in construction variables.
Example:
env do |env| env["CCFLAGS"] += %w[-O2 -Wall] env["LIBS"] += %w[m] end
This example modifies the CCFLAGS
construction variable to add -O2
and
-Wall
to the compilation commands used for C and C++ source files.
It also instructs the linker to link against the m
library.
| « Prev 4.3.1 Environments | Table of Contents | Next » 4.3.3 Builders |


Copyright © (C) 2012, Kong Fanbin
Authors: Kong Fanbin (kfbuniversity@gmail.com).
| abort_transaction/1 | Abort a transaction. |
| batch_modify_data/3 | Multiple put_data or delete_data operations in one request. |
| commit_transaction/1 | Commit a transaction. |
| create_table/1 | Create a table in OTS. |
| create_table_group/2 | Create a table group in OTS. |
| delete_data/2 | Delete a row of data in OTS. |
| delete_data/3 | Delete a row of data in OTS. |
| delete_table/1 | Delete a table in OTS. |
| delete_table_group/1 | Delete a table group in OTS. |
| get_row/2 | Get a row of data in OTS. |
| get_row/3 | Get a row of data in OTS. |
| get_rows_by_offset/2 | Get multi rows of data from OTS table or views by range. |
| get_rows_by_offset/3 | Get multi rows of data from OTS table or views by offset. |
| get_rows_by_range/2 | Get multi rows of data from OTS table or views by range. |
| get_rows_by_range/3 | Get multi rows of data from OTS table or views by range. |
| get_table_meta/1 | Get a table's META in OTS. |
| init/2 | Initialize OTS access information. |
| list_table/0 | List all tables in OTS. |
| list_table_group/0 | List all table groups in OTS. |
| modify_data/2 | |
| put_data/2 | Put a row of data in OTS. |
| put_data/3 | Put a row of data in OTS. |
| start_transaction/2 | Start a transaction in OTS table or table group. |
abort_transaction(TransactionID) -> Result
Abort a transaction.
All operations during this transaction will be canceled. The transaction ID will be invalid after this transaction abort.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfbatch_modify_data(TableName, DataOps::[DataOp], TransactionID) -> Result
Multiple put_data or delete_data operations in one request.
Table name and data operation list and transaction id are required to finish this request. The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfcommit_transaction(TransactionID) -> Result
Commit a transaction.
The transaction ID will be invalid after a successful commit.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfcreate_table(Table) -> Result
Create a table in OTS.
At least table name and primary keys are required to create a table The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfcreate_table_group(GroupName, PartitionKeyType) -> Result
Create a table group in OTS.
A table group name and partition key type are required to create a table group. Partition key type can only be integer or string.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfdelete_data(TableName, Data_op::DataOp) -> Result
Delete a row of data in OTS.
At least table name and data operation are required to delete data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfdelete_data(TableName, Data_op::DataOp, TransactionID) -> Result
Delete a row of data in OTS.
At least table name and data operation are required to delete data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfdelete_table(TableName) -> Result
Delete a table in OTS.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfdelete_table_group(GroupName) -> Result
Delete a table group in OTS.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfget_row(TableName, Data_op::DataOp) -> Result
Get a row of data in OTS.
At least table name and data operation are required to get data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfget_row(TableName, Data_op::DataOp, TransactionID) -> Result
Get a row of data in OTS.
At least table name and data operation are required to get data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfget_rows_by_offset(TableName, Data_op::DataOp) -> Result
Get multi rows of data from OTS table or views by range.
At least table name and data operation are required to get data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfget_rows_by_offset(TableName, Data_op::DataOp, TransactionID) -> Result
Get multi rows of data from OTS table or views by offset.
At least table name and data operation are required to get data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfget_rows_by_range(TableName, Data_op::DataOp) -> Result
Get multi rows of data from OTS table or views by range.
At least table name and data operation are required to get data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfget_rows_by_range(TableName, Data_op::DataOp, TransactionID) -> Result
Get multi rows of data from OTS table or views by range.
At least table name and data operation are required to get data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfget_table_meta(TableName) -> Result
Get a table's META in OTS.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfinit(OTS_ACCESS_ID::string(), OTS_ACCESS_KEY::string()) -> ok
Initialize OTS access information.
The provided access id and access key are stored in an ets table named as "erlaly_ots" which is the module name. Make sure this name is not used elsewhere. As the ets table is global, erlaly_ots does not support requests from different access ids simultaneously.list_table() -> Result
List all tables in OTS.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdflist_table_group() -> Result
List all table groups in OTS.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfmodify_data(Request, Params) -> any()
put_data(TableName, Data_op::DataOp) -> Result
Put a row of data in OTS.
At least table name and data operation are required to put data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfput_data(TableName, Data_op::DataOp, TransactionID) -> Result
Put a row of data in OTS.
At least table name and data operation are required to put data The table name must be unique among the tables associated with your aliyun Access ID.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfstart_transaction(EntityName, PartitionKeyValue) -> Result
Start a transaction in OTS table or table group.
A table or table group name and a partition key value are required to start a transaction. Partition key value can only be integer or string type.
See document: http://ots.aliyun.com/ots_sdk/OTS_RESTful_API_2012_01_06.pdfGenerated by EDoc, Feb 25 2012, 17:15:15.