My favorite food is pizza. It's very delicious. My favorite kind of chicken pizza, with some vegetables and cheese, however, I don't care which sauce it is unless it's spicy.
Pizza is a very popular food, and there are many pizzerias worldwide, including Pizza Hut, Domino's Pizza, Papa John's, Pizza Corner, and Smokin' Joe's.
Modern-day pizza was made in Naples 200 to 300 years ago, as what is now known as Neapolitan pizza. It can be sold fresh or frozen, in a whole or in slices of a pizza.
In a pizza, there's the original flatbread-like design, on which there's sauce, cheese and toppings(that can include vegetables and meat). On the outside there is a hard layer known as the crust. The ending result is very delicious! There are several types of pizza, variations usually either change one or two things to the main process and/or change toppings.
But I guess there's not much to say about pizza, if everyone eats it and loves it and thinks that la pizza è così deliziosa!
Pizza-like foods were made over 7,000 years ago, several notable pizza-like things include flatbread with cheese and dates in 600 B.C. for Persian soldiers, then in Ancient Greece, people added herbs, onion, cheese, and garlic to flatbread, a story written from 29 to 19 B.C. included a pizza-like thing.
A type of flatbread was named "pizza" and had many pizza-like things 400 years ago, although it was considered "food for the poor people". Then in 1800, after some people became desperate for food and ate tomatoes, they realized it was not poisonous(because it is in the same group of plants as other poisonous plants, people thought it was). It was added to pizza, and it quickly became popular, some people even went to poor places to eat some pizza! In 1807, 54 pizzerias had already opened, the first one being Antica Pizzeria Port'Alba, adding almost 70 more in 50 years! Legend says that a baker, Raffaele Esposito went to the queen of Italy, giving her a pizza with red, white, and green(Italy's national colors). It was called Margherita Pizza.
In the United States, during the late 19th century, Italian immigrants, and the first pizza shop was made in New York City's Little Italy neighborhood.
However, pizza really took off when WWII soldiers stationed in Italy returned. Many regional types developed, and now one eighth of the U.S. Population(almost 43 million people!) eat pizza each day.
Use one of these two videos to help you make pizza!
The largest pizza, which was made in December 2012 was Ottavia, a 1261.65 square meter pizza made in Rome by Dovilo Nardi, Andrea Mannocchi, Marco Nardi, Matteo Nardi and Matteo Giannotte.
The longest pizza, made in June 2017 measured 1930.39 meters. Many companies and people joined to make this record breaking pizza in Fountain, CA. It was given to several charities.


Google bans political advertising just before the UK general election
by Shereesa MoodleyFollowing Twitter’s recent ban on political advertising, Google on Wednesday announced updates to its own policies surrounding the matter.
According to the updates, Google will now restrict political entities from targeting ads on its platforms in an attempt to “improve voters’ confidence in the political ads they may see”.
“That’s why we’re limiting election ads audience targeting to the following general categories: age, gender, and general location,” the company explained on its website.
This means that political ads on Google can only be targeted to audiences according to how old they are and where they are from.
“This will align our approach to election ads with long-established practices in media such as TV, radio, and print, and result in election ads being more widely seen and available for public discussion,” Google continued.
Additionally, however, the company also noted that political advertisers will still be able to target “contextual” ads based on the content users read about often.
Google will begin implementing the new rules ahead of the UK’s upcoming General Election.
The policies will affect advertisers globally by 6 January 2020.
Feature image: Shereesa Moodley/Memeburn


In this notebook, some template code has already been provided for you, and you will need to implement additional functionality to successfully complete this project. You will not need to modify the included code beyond what is requested. Sections that begin with '(IMPLEMENTATION)' in the header indicate that the following block of code will require additional functionality which you must provide. Instructions will be provided for each section, and the specifics of the implementation are marked in the code block with a 'TODO' statement. Please be sure to read the instructions carefully!
Note: Once you have completed all of the code implementations, you need to finalize your work by exporting the iPython Notebook as an HTML document. Before exporting the notebook to html, all of the code cells need to have been run so that reviewers can see the final implementation and output. You can then export the notebook by using the menu above and navigating to \n", "File -> Download as -> HTML (.html). Include the finished document along with this notebook as your submission.
In addition to implementing code, there will be questions that you must answer which relate to the project and your implementation. Each section where you will answer a question is preceded by a 'Question X' header. Carefully read each question and provide thorough answers in the following text boxes that begin with 'Answer:'. Your project submission will be evaluated based on your answers to each of the questions and the implementation you provide.
Note: Code and Markdown cells can be executed using the Shift + Enter keyboard shortcut. Markdown cells can be edited by double-clicking the cell to enter edit mode.
The rubric contains optional "Stand Out Suggestions" for enhancing the project beyond the minimum requirements. If you decide to pursue the "Stand Out Suggestions", you should include the code in this IPython notebook.
In this notebook, you will make the first steps towards developing an algorithm that could be used as part of a mobile or web app. At the end of this project, your code will accept any user-supplied image as input. If a dog is detected in the image, it will provide an estimate of the dog's breed. If a human is detected, it will provide an estimate of the dog breed that is most resembling. The image below displays potential sample output of your finished project (... but we expect that each student's algorithm will behave differently!).
In this real-world setting, you will need to piece together a series of models to perform different tasks; for instance, the algorithm that detects humans in an image will be different from the CNN that infers dog breed. There are many points of possible failure, and no perfect algorithm exists. Your imperfect solution will nonetheless create a fun user experience!
We break the notebook into separate steps. Feel free to use the links below to navigate the notebook.
In the code cell below, we import a dataset of dog images. We populate a few variables through the use of the load_files
function from the scikit-learn library:
train_files
, valid_files
, test_files
- numpy arrays containing file paths to imagestrain_targets
, valid_targets
, test_targets
- numpy arrays containing onehot-encoded classification labels dog_names
- list of string-valued dog breed names for translating labelsfrom sklearn.datasets import load_files
from keras.utils import np_utils
import numpy as np
from glob import glob
# define function to load train, test, and validation datasets
def load_dataset(path):
data = load_files(path)
dog_files = np.array(data['filenames'])
dog_targets = np_utils.to_categorical(np.array(data['target']), 133)
return dog_files, dog_targets
# load train, test, and validation datasets
train_files, train_targets = load_dataset('dogImages/train')
valid_files, valid_targets = load_dataset('dogImages/valid')
test_files, test_targets = load_dataset('dogImages/test')
# load list of dog names
dog_names = [item[20:-1] for item in sorted(glob("dogImages/train/*/"))]
# print statistics about the dataset
print('There are %d total dog categories.' % len(dog_names))
print('There are %s total dog images.\n' % len(np.hstack([train_files, valid_files, test_files])))
print('There are %d training dog images.' % len(train_files))
print('There are %d validation dog images.' % len(valid_files))
print('There are %d test dog images.'% len(test_files))
In the code cell below, we import a dataset of human images, where the file paths are stored in the numpy array human_files
.
import random
random.seed(8675309)
# load filenames in shuffled human dataset
human_files = np.array(glob("lfw/*/*"))
random.shuffle(human_files)
# print statistics about the dataset
print('There are %d total human images.' % len(human_files))
We use OpenCV's implementation of Haar feature-based cascade classifiers to detect human faces in images. OpenCV provides many pre-trained face detectors, stored as XML files on github. We have downloaded one of these detectors and stored it in the haarcascades
directory.
In the next code cell, we demonstrate how to use this detector to find human faces in a sample image.
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
# extract pre-trained face detector
haar_face_cascade = cv2.CascadeClassifier('haarcascades/haarcascade_frontalface_alt.xml')
def detect_faces(cascade, colr_img):
# load color (BGR) image
img = cv2.imread(colr_img)
# convert BGR image to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# find faces in image
faces = cascade.detectMultiScale(gray)
# print number of faces detected in the image
print('Number of faces detected:', len(faces))
# get bounding box for each detected face
for (x,y,w,h) in faces:
# add bounding box to color image
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
# convert BGR image to RGB for plotting
cv_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# display the image, along with bounding box
plt.imshow(cv_rgb)
plt.show()
detect_faces(haar_face_cascade, human_files[0])
Before using any of the face detectors, it is standard procedure to convert the images to grayscale. The detectMultiScale
function executes the classifier stored in face_cascade
and takes the grayscale image as a parameter.
In the above code, faces
is a numpy array of detected faces, where each row corresponds to a detected face. Each detected face is a 1D array with four entries that specifies the bounding box of the detected face. The first two entries in the array (extracted in the above code as x
and y
) specify the horizontal and vertical positions of the top left corner of the bounding box. The last two entries in the array (extracted here as w
and h
) specify the width and height of the box.
We can use this procedure to write a function that returns True
if a human face is detected in an image and False
otherwise. This function, aptly named face_detector
, takes a string-valued file path to an image as input and appears in the code block below.
# returns "True" if face is detected in image stored at img_path
def face_detector(cascade, img_path):
img = cv2.imread(img_path)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = cascade.detectMultiScale(gray)
return len(faces) > 0
Question 1: Use the code cell below to test the performance of the face_detector
function.
human_files
have a detected human face? dog_files
have a detected human face?  You will see that our algorithm falls short of this goal, but still gives acceptable performance. We extract the file paths for the first 100 images from each of the datasets and store them in the numpy arrays human_files_short
and dog_files_short
.
Answer: human accuracy 99.0%, dog accuracy 11.0%
human_files_short = human_files[:100]
dog_files_short = train_files[:100]
# Do NOT modify the code above this line.
## TODO: Test the performance of the face_detector algorithm
## on the images in human_files_short and dog_files_short.
def getAccuracy(cascade):
human_out = []
for i in human_files_short :
human_out.append(face_detector(cascade,i))
dog_out = []
for i in dog_files_short :
dog_out.append(face_detector(cascade,i))
human_true_count = human_out.count(True)
dog_true_count = dog_out.count(True)
human_accuracy = human_true_count*100/100.0
dog_accuracy = dog_true_count*100/100.0
print('human accuracy {}%'.format(human_accuracy))
print('dog accuracy {}%'.format(dog_accuracy))
return human_accuracy, dog_accuracy
getAccuracy(haar_face_cascade)
Question 2: This algorithmic choice necessitates that we communicate to the user that we accept human images only when they provide a clear view of a face (otherwise, we risk having unneccessarily frustrated users!). In your opinion, is this a reasonable expectation to pose on the user? If not, can you think of a way to detect humans in images that does not necessitate an image with a clearly presented face?
Answer: It may not be reasonable users to provide images with clear views of face. Haars face detection doesnot guareentee to correctly detect human face when there is no clear view of the face. Below is lbp classifier which has lower accuracy in detecting human faces and higher accuracy in not detecting dog faces as humans. Over all can try training the images using deep learning and provide unclear images along with clear images in the training set so that the model is able to correctly detect human faces in both clear and unclear images.
We suggest the face detector from OpenCV as a potential way to detect human images in your algorithm, but you are free to explore other approaches, especially approaches that make use of deep learning :). Please use the code cell below to design and test your own face detection algorithm. If you decide to pursue this optional task, report performance on each of the datasets. human accuracy 84.0%, dog accuracy 1.0%
## (Optional) TODO: Report the performance of another
## face detection algorithm on the LFW dataset
### Feel free to use as many code cells as needed.
lbp_face_cascade = cv2.CascadeClassifier('lbpcascades/lbpcascade_frontalface.xml')
detect_faces(lbp_face_cascade, human_files[0])
getAccuracy(lbp_face_cascade)
In this section, we use a pre-trained ResNet-50 model to detect dogs in images. Our first line of code downloads the ResNet-50 model, along with weights that have been trained on ImageNet, a very large, very popular dataset used for image classification and other vision tasks. ImageNet contains over 10 million URLs, each linking to an image containing an object from one of 1000 categories. Given an image, this pre-trained ResNet-50 model returns a prediction (derived from the available categories in ImageNet) for the object that is contained in the image.
from keras.applications.resnet50 import ResNet50
# define ResNet50 model
ResNet50_model = ResNet50(weights='imagenet')
When using TensorFlow as backend, Keras CNNs require a 4D array (which we'll also refer to as a 4D tensor) as input, with shape
$$ (\text{nb_samples}, \text{rows}, \text{columns}, \text{channels}), $$
where nb_samples
corresponds to the total number of images (or samples), and rows
, columns
, and channels
correspond to the number of rows, columns, and channels for each image, respectively.
The path_to_tensor
function below takes a string-valued file path to a color image as input and returns a 4D tensor suitable for supplying to a Keras CNN. The function first loads the image and resizes it to a square image that is $224 \times 224$ pixels. Next, the image is converted to an array, which is then resized to a 4D tensor. In this case, since we are working with color images, each image has three channels. Likewise, since we are processing a single image (or sample), the returned tensor will always have shape
$$ (1, 224, 224, 3). $$
The paths_to_tensor
function takes a numpy array of string-valued image paths as input and returns a 4D tensor with shape
$$ (\text{nb_samples}, 224, 224, 3). $$
Here, nb_samples
is the number of samples, or number of images, in the supplied array of image paths. It is best to think of nb_samples
as the number of 3D tensors (where each 3D tensor corresponds to a different image) in your dataset!
from keras.preprocessing import image
from tqdm import tqdm
def path_to_tensor(img_path):
# loads RGB image as PIL.Image.Image type
img = image.load_img(img_path, target_size=(224, 224))
# convert PIL.Image.Image type to 3D tensor with shape (224, 224, 3)
x = image.img_to_array(img)
# convert 3D tensor to 4D tensor with shape (1, 224, 224, 3) and return 4D tensor
return np.expand_dims(x, axis=0)
def paths_to_tensor(img_paths):
list_of_tensors = [path_to_tensor(img_path) for img_path in tqdm(img_paths)]
return np.vstack(list_of_tensors)
Getting the 4D tensor ready for ResNet-50, and for any other pre-trained model in Keras, requires some additional processing. First, the RGB image is converted to BGR by reordering the channels. All pre-trained models have the additional normalization step that the mean pixel (expressed in RGB as $[103.939, 116.779, 123.68]$ and calculated from all pixels in all images in ImageNet) must be subtracted from every pixel in each image. This is implemented in the imported function preprocess_input
. If you're curious, you can check the code for preprocess_input
here.
Now that we have a way to format our image for supplying to ResNet-50, we are now ready to use the model to extract the predictions. This is accomplished with the predict
method, which returns an array whose $i$-th entry is the model's predicted probability that the image belongs to the $i$-th ImageNet category. This is implemented in the ResNet50_predict_labels
function below.
By taking the argmax of the predicted probability vector, we obtain an integer corresponding to the model's predicted object class, which we can identify with an object category through the use of this dictionary.
from keras.applications.resnet50 import preprocess_input, decode_predictions
def ResNet50_predict_labels(img_path):
# returns prediction vector for image located at img_path
img = preprocess_input(path_to_tensor(img_path))
return np.argmax(ResNet50_model.predict(img))
While looking at the dictionary, you will notice that the categories corresponding to dogs appear in an uninterrupted sequence and correspond to dictionary keys 151-268, inclusive, to include all categories from 'Chihuahua'
to 'Mexican hairless'
. Thus, in order to check to see if an image is predicted to contain a dog by the pre-trained ResNet-50 model, we need only check if the ResNet50_predict_labels
function above returns a value between 151 and 268 (inclusive).
We use these ideas to complete the dog_detector
function below, which returns True
if a dog is detected in an image (and False
if not).
### returns "True" if a dog is detected in the image stored at img_path
def dog_detector(img_path):
prediction = ResNet50_predict_labels(img_path)
return ((prediction <= 268) & (prediction >= 151))
Question 3: Use the code cell below to test the performance of your dog_detector
function.
human_files_short
have a detected dog? dog_files_short
have a detected dog?Answer: human- 2%, dog- 100%
### TODO: Test the performance of the dog_detector function
### on the images in human_files_short and dog_files_short.
human_out = [dog_detector(img) for img in human_files_short]
dog_out = [dog_detector(img) for img in dog_files_short]
human_true_count = human_out.count(True)
dog_true_count = dog_out.count(True)
human_accuracy = human_true_count*100/100.0
dog_accuracy = dog_true_count*100/100.0
print('human percentage {}%'.format(human_accuracy))
print('dog percentage {}%'.format(dog_accuracy))
Now that we have functions for detecting humans and dogs in images, we need a way to predict breed from images. In this step, you will create a CNN that classifies dog breeds. You must create your CNN from scratch (so, you can't use transfer learning yet!), and you must attain a test accuracy of at least 1%. In Step 5 of this notebook, you will have the opportunity to use transfer learning to create a CNN that attains greatly improved accuracy.
Be careful with adding too many trainable layers! More parameters means longer training, which means you are more likely to need a GPU to accelerate the training process. Thankfully, Keras provides a handy estimate of the time that each epoch is likely to take; you can extrapolate this estimate to figure out how long it will take for your algorithm to train.
We mention that the task of assigning breed to dogs from images is considered exceptionally challenging. To see why, consider that even a human would have great difficulty in distinguishing between a Brittany and a Welsh Springer Spaniel.
| Brittany | Welsh Springer Spaniel |
|---|---|
It is not difficult to find other dog breed pairs with minimal inter-class variation (for instance, Curly-Coated Retrievers and American Water Spaniels).
| Curly-Coated Retriever | American Water Spaniel |
|---|---|
Likewise, recall that labradors come in yellow, chocolate, and black. Your vision-based algorithm will have to conquer this high intra-class variation to determine how to classify all of these different shades as the same breed.
| Yellow Labrador | Chocolate Labrador | Black Labrador |
|---|---|---|
We also mention that random chance presents an exceptionally low bar: setting aside the fact that the classes are slightly imabalanced, a random guess will provide a correct answer roughly 1 in 133 times, which corresponds to an accuracy of less than 1%.
Remember that the practice is far ahead of the theory in deep learning. Experiment with many different architectures, and trust your intuition. And, of course, have fun!
We rescale the images by dividing every pixel in every image by 255.
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
# pre-process the data for Keras
train_tensors = paths_to_tensor(train_files).astype('float32')/255
valid_tensors = paths_to_tensor(valid_files).astype('float32')/255
test_tensors = paths_to_tensor(test_files).astype('float32')/255
train_tensors.shape[1:]
Create a CNN to classify dog breed. At the end of your code cell block, summarize the layers of your model by executing the line:
model.summary()
We have imported some Python modules to get you started, but feel free to import as many modules as you need. If you end up getting stuck, here's a hint that specifies a model that trains relatively fast on CPU and attains >1% test accuracy in 5 epochs:
Question 4: Outline the steps you took to get to your final CNN architecture and your reasoning at each step. If you chose to use the hinted architecture above, describe why you think that CNN architecture should work well for the image classification task.
Answer: first layer detects features like edges, curves using initial filter map and maxpooling. The output of this layer is called feature or activation map. This acts as input to the second convoulution layer which uses more filters to obtain more higher level features. We again use maxpooling to get the new activation map. we can have more layers until we extract all the features of an image. Global average poooling to flatten the output of the previous layer and softmax function for determining 133 dog breeds is used. For every output we get probabilities of dog belonging to every breed. The max of these probabilities determines the actual breed.
from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D
from keras.layers import Dropout, Flatten, Dense
from keras.models import Sequential
model = Sequential()
### TODO: Define your architecture.
model.add(Conv2D(filters=16, kernel_size=2, padding='same', activation='relu',
input_shape=(224, 224, 3)))
model.add(MaxPooling2D(pool_size=2))
model.add(Conv2D(filters=32, kernel_size=2, padding='same', activation='relu'))
model.add(MaxPooling2D(pool_size=2))
model.add(Conv2D(filters=64, kernel_size=2, padding='same', activation='relu'))
model.add(MaxPooling2D(pool_size=2))
model.add(Dropout(0.2))
model.add(GlobalAveragePooling2D())
model.add(Dense(133, activation='softmax'))
model.summary()
model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])
Train your model in the code cell below. Use model checkpointing to save the model that attains the best validation loss.
You are welcome to augment the training data, but this is not a requirement.
###IMAGE AUGMENTATION OF TRAINING DATA
from keras.preprocessing.image import ImageDataGenerator
# create and configure augmented image generator
datagen_train = ImageDataGenerator(
width_shift_range=0.1, # randomly shift images horizontally (10% of total width)
height_shift_range=0.1, # randomly shift images vertically (10% of total height)
horizontal_flip=True) # randomly flip images horizontally
# fit augmented image generator on data
datagen_train.fit(train_tensors)
from keras.callbacks import ModelCheckpoint
### TODO: specify the number of epochs that you would like to use to train the model.
epochs = 5
batch_size = 20
### Do NOT modify the code below this line.
checkpointer = ModelCheckpoint(filepath='saved_models/weights.best.from_scratch.hdf5',
verbose=1, save_best_only=True)
# model.fit(train_tensors, train_targets,
# validation_data=(valid_tensors, valid_targets),
# epochs=epochs, batch_size=20, callbacks=[checkpointer], verbose=1)
model.fit_generator(datagen_train.flow(train_tensors, train_targets, batch_size=batch_size),
validation_data=(valid_tensors, valid_targets),
steps_per_epoch=train_tensors.shape[0] // batch_size,
epochs=epochs, callbacks=[checkpointer], verbose=1)
model.load_weights('saved_models/weights.best.from_scratch.hdf5')
Try out your model on the test dataset of dog images. Ensure that your test accuracy is greater than 1%.
# get index of predicted dog breed for each image in test set
dog_breed_predictions = [np.argmax(model.predict(np.expand_dims(tensor, axis=0))) for tensor in test_tensors]
# report test accuracy
test_accuracy = 100*np.sum(np.array(dog_breed_predictions)==np.argmax(test_targets, axis=1))/len(dog_breed_predictions)
print('Test accuracy: %.4f%%' % test_accuracy)
bottleneck_features = np.load('bottleneck_features/DogVGG16Data.npz')
train_VGG16 = bottleneck_features['train']
valid_VGG16 = bottleneck_features['valid']
test_VGG16 = bottleneck_features['test']
The model uses the the pre-trained VGG-16 model as a fixed feature extractor, where the last convolutional output of VGG-16 is fed as input to our model. We only add a global average pooling layer and a fully connected layer, where the latter contains one node for each dog category and is equipped with a softmax.
VGG16_model = Sequential()
VGG16_model.add(GlobalAveragePooling2D(input_shape=train_VGG16.shape[1:]))
VGG16_model.add(Dense(133, activation='softmax'))
VGG16_model.summary()
VGG16_model.compile(loss='categorical_crossentropy', optimizer='rmsprop', metrics=['accuracy'])
checkpointer = ModelCheckpoint(filepath='saved_models/weights.best.VGG16.hdf5',
verbose=1, save_best_only=True)
VGG16_model.fit(train_VGG16, train_targets,
validation_data=(valid_VGG16, valid_targets),
epochs=20, batch_size=20, callbacks=[checkpointer], verbose=1)
VGG16_model.load_weights('saved_models/weights.best.VGG16.hdf5')
Now, we can use the CNN to test how well it identifies breed within our test dataset of dog images. We print the test accuracy below.
# get index of predicted dog breed for each image in test set
VGG16_predictions = [np.argmax(VGG16_model.predict(np.expand_dims(feature, axis=0))) for feature in test_VGG16]
# report test accuracy
test_accuracy = 100*np.sum(np.array(VGG16_predictions)==np.argmax(test_targets, axis=1))/len(VGG16_predictions)
print('Test accuracy: %.4f%%' % test_accuracy)
from extract_bottleneck_features import *
def VGG16_predict_breed(img_path):
# extract bottleneck features
bottleneck_feature = extract_VGG16(path_to_tensor(img_path))
# obtain predicted vector
predicted_vector = VGG16_model.predict(bottleneck_feature)
# return dog breed that is predicted by the model
return dog_names[np.argmax(predicted_vector)]
You will now use transfer learning to create a CNN that can identify dog breed from images. Your CNN must attain at least 60% accuracy on the test set.
In Step 4, we used transfer learning to create a CNN using VGG-16 bottleneck features. In this section, you must use the bottleneck features from a different pre-trained model. To make things easier for you, we have pre-computed the features for all of the networks that are currently available in Keras:
The files are encoded as such:
Dog{network}Data.npz
where {network}
, in the above filename, can be one of VGG19
, Resnet50
, InceptionV3
, or Xception
. Pick one of the above architectures, download the corresponding bottleneck features, and store the downloaded file in the bottleneck_features/
folder in the repository.
In the code block below, extract the bottleneck features corresponding to the train, test, and validation sets by running the following:
bottleneck_features = np.load('bottleneck_features/Dog{network}Data.npz')
train_{network} = bottleneck_features['train']
valid_{network} = bottleneck_features['valid']
test_{network} = bottleneck_features['test']
### TODO: Obtain bottleneck features from another pre-trained CNN.
bottleneck_features = np.load('bottleneck_features/DogResnet50Data.npz')
train_Resnet50 = bottleneck_features['train']
valid_Resnet50 = bottleneck_features['valid']
test_Resnet50 = bottleneck_features['test']
test_Resnet50.shape[1:]
Create a CNN to classify dog breed. At the end of your code cell block, summarize the layers of your model by executing the line:
<your model's name>.summary()
Question 5: Outline the steps you took to get to your final CNN architecture and your reasoning at each step. Describe why you think the architecture is suitable for the current problem.
Answer: In Convolutional Networks, the first few layers are generally same for any model. This is because the first few layers represent basic features which are common to any training set. For example first layer would identify lines, second circles and as we go deeper shapes specific to the trainin data are learnt. Often, during training we freeze the early layers of the convolutional network and only train the parameters for the filters in the last few layers. In more extreme cases, we freeze all of the convolutional layers and only train the parameters for the fully connected layers that follow. We are going to use this pattern to our model. We are using Transfer learning using Resnet. On the ImageNet dataset residual nets are pretrained and weights from this model can be used. ImageNet is a very large dataset which has several images. Another advantage of Resnet is that it solves vanishing gradient problem which allows having a deeper network with several layers. We use the get the directly use the bottleneck features by training using this model and then apply GlobalMaxPooling to flatten the input and softmax to obtain the output.
### TODO: Define your architecture.
Resnet50_model = Sequential()
Resnet50_model.add(GlobalAveragePooling2D(input_shape=train_Resnet50.shape[1:]))
Resnet50_model.add(Dense(133, activation='softmax'))
Resnet50_model.summary()
### TODO: Compile the model.
Resnet50_model.compile(loss='categorical_crossentropy', optimizer='rmsprop', metrics=['accuracy'])
Train your model in the code cell below. Use model checkpointing to save the model that attains the best validation loss.
You are welcome to augment the training data, but this is not a requirement.
### TODO: Train the model.
checkpointer = ModelCheckpoint(filepath='saved_models/weights.best.Resnet50.hdf5',
verbose=1, save_best_only=True)
Resnet50_model.fit(train_Resnet50, train_targets,
validation_data=(valid_Resnet50, valid_targets),
epochs=20, batch_size=20, callbacks=[checkpointer], verbose=1)
### TODO: Load the model weights with the best validation loss.
Resnet50_model.load_weights('saved_models/weights.best.Resnet50.hdf5')
Try out your model on the test dataset of dog images. Ensure that your test accuracy is greater than 60%.
### TODO: Calculate classification accuracy on the test dataset.
# get index of predicted dog breed for each image in test set
Resnet50_predictions = [np.argmax(Resnet50_model.predict(np.expand_dims(feature, axis=0))) for feature in test_Resnet50]
# report test accuracy
test_accuracy = 100*np.sum(np.array(Resnet50_predictions)==np.argmax(test_targets, axis=1))/len(Resnet50_predictions)
print('Test accuracy: %.4f%%' % test_accuracy)
Write a function that takes an image path as input and returns the dog breed (Affenpinscher
, Afghan_hound
, etc) that is predicted by your model.
Similar to the analogous function in Step 5, your function should have three steps:
dog_names
array defined in Step 0 of this notebook to return the corresponding breed.The functions to extract the bottleneck features can be found in extract_bottleneck_features.py
, and they have been imported in an earlier code cell. To obtain the bottleneck features corresponding to your chosen CNN architecture, you need to use the function
extract_{network}
where {network}
, in the above filename, should be one of VGG19
, Resnet50
, InceptionV3
, or Xception
.
### TODO: Write a function that takes a path to an image as input
### and returns the dog breed that is predicted by the model.
from extract_bottleneck_features import *
def Resnet50_predict_breed(img_path):
# extract bottleneck features
bottleneck_feature = extract_Resnet50(path_to_tensor(img_path))
# obtain predicted vector
predicted_vector = Resnet50_model.predict(bottleneck_feature)
# return dog breed that is predicted by the model
return dog_names[np.argmax(predicted_vector)]
Write an algorithm that accepts a file path to an image and first determines whether the image contains a human, dog, or neither. Then,
You are welcome to write your own functions for detecting humans and dogs in images, but feel free to use the face_detector
and dog_detector
functions developed above. You are required to use your CNN from Step 5 to predict dog breed.
Some sample output for our algorithm is provided below, but feel free to design your own user experience!
### TODO: Write your algorithm.
### Feel free to use as many code cells as needed.
def predict_image(image):
if (dog_detector(image)):
print("Dog detected with breed ", Resnet50_predict_breed(image) )
elif (face_detector(lbp_face_cascade, image)):
print("Human detected with resemblence breed ",Resnet50_predict_breed(image) )
else :
print("Neither dog nor human detected")
img = cv2.imread(image)
cv_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
imgplot = plt.imshow(cv_rgb)
In this section, you will take your new algorithm for a spin! What kind of dog does the algorithm think that you look like? If you have a dog, does it predict your dog's breed accurately? If you have a cat, does it mistakenly think that your cat is a dog?
Test your algorithm at least six images on your computer. Feel free to use any images you like. Use at least two human and two dog images.
Question 6: Is the output better than you expected :) ? Or worse :( ? Provide at least three possible points of improvement for your algorithm.
Answer: The output is better than expected. It got everything right. Below i have 3 images of myself. The first 2 images resembeled me to Brussels_griffon but the last one to Silky_terrier. This may be because of different length of hair, beard and different facial expression.
3 possible ways of improving alogirthm are
## TODO: Execute your algorithm from Step 6 on
## at least 6 images on your computer.
## Feel free to use as many code cells as needed.
predict_image("testimages/me.png")
predict_image("testimages/me1.png")
predict_image("testimages/chitti.png")
predict_image("testimages/golden.png")
predict_image("testimages/dachshud.png")
predict_image("testimages/norfolk.png")
predict_image("testimages/pinscher.png")
predict_image("testimages/cat.png")
predict_image("testimages/fox.png")
predict_image("testimages/me3.png")


Software Engineer & open source fan.
THIS IS A TESTI'm currently the lead software engineer at Bayesquare.
I love interacting with new people, languages and frameworks. Software has the power to make people more productive and happier. That's what I'm all about.
Right now I'm particularly interested in the intersection of programming and finance. This means my focus is on Machine Learning and Statistics, manipulating data-sets with Python. I also love web development, with most of my time spent writing HTML, CSS, Javascript and PHP.
If you're interested in learning more about my work, check out my projects page to see what I've worked on and what I'm doing right now.


Hacking/typing/writing at 200 words per minute
04:30 PM - 05:25 PM on July 17, 2016, Room CR6Ted Morin
- Audience level:
- intermediate
Description
Plover is free software written in Python that enables you to type on a computer at over 200 words per minute. Plover brings machine stenography, an art older than computers, into everyone's hands. Plover's current lead developer, Ted Morin, will talk about what stenography is, why Plover was created, how Plover works, and explain the role stenography might have in the modern world, as it moves beyond transcription and into the hands of hackers.
Abstract
A decade ago, stenography (steno) was a proprietary, locked down technology with a heavy upfront learning cost and high dropout rate. Mirabai Knight, a true geek, was so frustrated after she became a professional stenographer that she hired a developer to help her make a FOSS steno solution. Now, the open steno community exists with her passion driving them forward. At the core is Plover, the free software that lets anyone try and learn stenography for free. Around it there are helper tools, learning resources, open hardware initiatives, and more. Ted manages the GitHub repository and is a student of the Open Steno Project himself. He will talk about Open Steno, where it came from, what it was like before it existed, what it's good for, how it works (as a Python application), and where it may go in the future.


Pocket Monsters from ‘Pokémon Sword and Shield’ are set to arrive in Pokémon Go
Pokémon Sword and Shield spoiler alert ahead
by Brad BennettIt looks like some of the new Pocket Monsters from Pokémon Sword and Pokémon Shield are going to make their way to Pokémon Go.
Data miners have found references to the new regional Pokémon in the mobile game. The running theory is that these Pokémon will launch alongside the release of Sword and Shield on Friday.
Regional Pokémon from the 3DS games Sun and Moon made their way to Pokémon Go in special 7km eggs that players could gift to each other. These new monsters will likely be introduced to the game in a similar way.
The data miners found the code for Sword and Shield Galarian forms on October 22nd, but it only seemed to mention Linoone, Zigzagoon and Weezing.
That said, hackers have been able to find 20 Galarian Pokémon, so there could be that many in the game.
Unlike the Sun and Moon regionals, there are a few new Pokémon that evolve from regionals but were not in any of the previous games. This includes Perrserker, Cursola, Sirfetch’d, Mr. Rime and Runegrigus.
While all of this is based on leaked code and past Pokémon Go content releases, we’ll have to wait until Friday to know for sure.
Source: iMore


OTP
Please check registered email for 6 digit OTP.
verify OTP
Pick Account Type
{{acc.name}}
Submit
{{alertMsg }}


I have had the pleasure of experimenting with the currently legal, synthetic cannabinoid “Spice” lately, and I would like to share the lessons I have learned with others of the community. In order to be concise, feel free to skip to “My Experience” if you don't care about the details.
Vital Stats:
Male. 29. 175 lbs. In decent shape.
Previous Drug Experience: I was raised in a religious household and have only begun experimenting with drugs within the last few years. Aside from alcohol and tobacco, Spice is the first and only controlled substance I have ever tried.
Background:
I am a professional journalist by trade, and our publication recently decided to cover the growing Spice trade in our city, which had been much sensationalized by other local media sources. An an independent and rather liberal publication, we figured we would have a different take on it.
As part of our “research,” my coworkers and I went down to the local head shop and bought up a couple of grams and smoked it on the roof. It was an interesting enough experience I have since experiment about 6 or 7 times then, and I think I am now able to synthesize my experiences into a coherent and useful set of remarks and suggestions. I will refer to two specific experiences — one good and one bad — but the experience has been consistent enough you can assume these two description are indicative of all other times.
My Good Experience:
When I smoked, I used a very small glass pipe, and I only needed to use a tiny pinch of spice. I estimate that it only took about 2/10 of a gram to get as high as I can stand. This is potent stuff, and not to be trifled with. I consumed 4 glasses of wine and waited about 20 minutes for a mild alcohol buzz to kick in. Once pleasantly buzzed, but certainly not drunk, I went out to my car and smoked the spice. Using just the pinch, I took 4 big hits off my little glass pipe, holding it in for 20-30 seconds each time.

By the end of my 4th hit, I can feel it starting to kick in. I can feel the temptation to smoke more, but since I have decided in advance to stop at 4, I do.
By the time I have walked back into my house, I can feel it overtaking me. I feel slightly paranoid, and I am already wondering if I did too much. From previous experience, I feel confident in my dosage and tell myself this will only last the first five minutes, which it does. The paranoia washes over me and makes it hard to complete my current task — washing my pipe — but it's only a mild annoyance, since I know it will be soon over.
By the time I clean my pipe and put my spice away, the paranoia is gone, but I am having trouble walking, and I feel like I am traveling in slow motion. It's a good feeling and it makes me giggle. I sit down with my wife and put on “Caddyshack.”
From about 10 minutes to 25 minutes into the trip, the spice has 100% control over me. I am traveling on the surface of Arrakis, and I can't even begin to perceive what's going on in the movie. I have persistent, mild hallucinations and see shapes and patterns, and the room is strobing brightly. Everything is funny. When high on spice, I feel like I have access to a different set of memories—spice memories —that I can only access while stoned, and memories of previous spice trips come flooding back to me in exquisite details.
With my spice memory bank, I been having epiphanies en masse. Certain emotional concepts seem so obvious and simple to me, like my political preferences, while complex ideas—like what will I be doing a year from now—are next to impossible to fathom. My short term memory is nearly gone, and everything that happened more than 5 seconds ago seems like a dream. Having a conversation is extremely difficult, as I will forget what I am talking about halfway through a sentence. It's not scary, though—it's hilarious.
Part of my spice memory bank that occurs to me every time is the overpowering desire to want this to become the “perfect” spice trip, and I am filled with the desire to adjust the temperature, find the right movie with the right mood, and make everything perfect. Unfortunately, I can barely move, so making any changes to my environment is not really an option. The euphoria kicks in and I am fine with my current situation.
About an hour into the trip, I have given up on Caddyshack, as I can't follow the plot, and so I go grab a Calvin and Hobbes book. I can feel myself coming down — I know this because I can now walk — but I am still thoroughly stoned. Calvin and Hobbes is extra hilarious, and I perceive it in ways that I never have before. I can only read about 10 pages before I collapse in euphoric fatigue on the carpet, but it's not a bad thing. It's a wonderful feeling, and it occurs to me that I prefer this to “real” life, which is a rather scary thought now, but it made a lot of sense while stoned.
I come down slowly and gently over the next two hours. At about the three hour mark, I come all the way out of the high all at once.
I get up, brush my teeth, and go to bed feeling a little drained, but quite good.  I have trouble remembering most of my epiphanies in the same way it is hard to remember a dream, but if I focus, they come slowly back. It was a fantastic experience, and my only regret was that I was not able to get high with someone else.
My Bad Experience:
One time I smoked 5 hits with no alcohol before hand; it was a radically different and horrible experience. By the time I had walked inside, the paranoia was almost overpowering. It was not at all a physical sensation but an mental and intellectual one — it was sheer terror. I knew I had smoked too much, and I instantly regretted not consuming alcohol beforehand to calm me.
By the time I clean my pipe and sit down, I am in a strobing, pulsing psychedelic nightmare. I comment to my wife that I did too much and that I am scared. I have the insight to tell her not to worry, that I will be fine, but that am feeling terror. I have to struggle not to gasp, as my breathes are labored and erratic, and the weight of the world feels like it is crashing in on me. I feel that my mind is just not strong enough to handle the distortion the spice is causing, and I worry that I will go insane.
This feeling comes in waves for the next hour or so. The waves get less and less frequent over time, and it's not fun. After about an hour, I come down to a level where there is no longer any panic. I come out after about 3 hours of a fitful high, and I vow never to do that again.
In Summation: Is Spice Worth it?
Yes, when taken in the right dosage and in the right environment, it was a fantastic and visionary experience. I certainly plan to continue smoking it, but only under stringently controlled conditions.
Do I Need Alcohol?: I certainly do. Any dose of spice makes me somewhat paranoid, especially within the first 5-10 minutes of the high. Getting a good buzz takes the edge off this and seems to be the perfect companion to spice. On the other hand, I cannot fathom how terrible it would be to overdose on spice and simultaneously have the spins from alcohol.
How Much Should I Smoke?: Spice is “mixed” by headshops by people with no experience or qualifications. Dosage between units can allegedly be wildly different. Spice is not marijuana — so my friends tell me — I *can* absolutely smoke too much, and I deeply regret it when I do. I never felt like I was in any physical danger when I did too much, more of feeling like I was going to go insane. It's not fun.
Is it Dangerous?: I certainly wouldn't smoke it every day. I don't know what other chemicals or fragrances are put into it. I use a bong so I'm not eating burnt chunks from the pipe.
Does it Enhance the Experience to Quote Dune and Talk About Sand Worms?: Most definitely.
He who controls the spice, controls the universe.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


OJ Howard Bobbles Ball Behind Him & Causes A Jameis Winston INT (VIDEO)
by Darrelle LincolnAnother week, another Jameis Winston interception, but this one wasn’t hi sfault.
After completing a pass to OJ Howard, he proceeded to bobble the ball several times that it went behind his back until he knocked it into the air and went to the other team.


1941 : Born on the 9th of September in Bronxville, New York to Alistair E. Ritchie, a Bell Labs Scientist, and his wife
1959 : Graduates from Summit High School in Summit, New Jersey and begins undergraduate studies of Physics and Applied Mathematics at Harvard University in Cambridge, Massachusetts
1967 : Begins working at the Bell Laboratories Computing Sciences Research Center in Murray Hill, New Jersey
1968 : Defends his PhD thesis on "Program Structure and Computational Complexity" at Harvard University under the supervision of Patrick C. Fischer, though he never officially received his PhD
1972 : Releases first version of the C programming language with Bell Laboratories
1973 : Releases UNIX operating system publicly along with Ken Thompson, Brian Kernighan, Douglas McIlroy, and Joe Ossanna at Bell Laboratories
1983 : Receives the Turing Award along with Ken Thompson for their development of generic operating systems theory and specifically for their implementation of the UNIX operating system
1990 : Receives the IEEE Richard W. Hamming Medal from the Institute of Electrical and Electronics Engineers (IEEE), along with Ken Thompson, for the "origination of the UNIX operating system and the C programming language"
1994 : Receives the Computer Pioneer Award
1997 : Becomes a Computer History Museum Fellow, along with Ken Thompson, for "for co-creation of the UNIX operating system, and for development of the C programming language"
1998 : Jointly receives the National Medal of Techonology from President William Jefferson Clinton for co-inventing the UNIX operating system and the C programming language which, according to the medal "led to enormous advances in computer hardware, software, and networking systems and stimulated growth of an entire industry, thereby enhancing American leadership in the Information Age"
2005 : Awarded the Industrial Institute's Achievement Award in recognition of his contribution to science and technology, and to society generally, with his development of the UNIX operating system
2011 : Awarded the Japan Prize for Information and Communications, along with Ken Thompson, for their work in the development of the UNIX operating system
2011 : Dies on the 12th of October in Berkeley Heights, New Jersey at the age of 70.
Ritchie was under the radar. His name was not a household name at all, but... if you had a microscope and could look in a computer, you'd see his work everywhere inside.
~ Paul E. Ceruzzi, computer historian
His Wikipedia page warrants a thorough perusing should the reader have the time to learn of one of the modern computing era's most influential pioneers...


| Forward | w |
| Backward | s |
| Strafe Left | a |
| Strafe Right | d |
| Up | q |
| Down | e |
| Pitch Up | t |
| Pitch Down | y |
| Roll Clockwise | g |
| Roll Anticlockwise | h |
| Yaw Left | b |
| Yaw Right | n |
| Reset to Origin | r |
| Point Light | |
| Directional Light | |
| Ambient Light | |
| Specular Reflection | |
| Shadow | |
| Reflection | |
| Reflection Depth |


--- layout: post mathjax: true comments: true date: 2012-12-09 title: [Project Euler] #6 Solution excerpt: | This page presents a Ruby solution to Project Euler Problem 6. tags: - project euler problem 6 solution - project euler problem 6 answer - project euler problem 6 ruby ---
The sum of the squares of the first ten natural numbers is,
\[1^2 + 2^2 + ... + 10^2 = 385\]The square of the sum of the first ten natural numbers is,
\[(1 + 2 + ... + 10)^2 = 55^2 = 3025\]Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is \(3025 − 385 = 2640\).
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
25164150


Kirk Herbstreit Doesn’t Think Michigan-Michigan State Will Be Close
by Andrew HolleranThe Michigan-Michigan State rivalry has provided the college football world with some pretty crazy games over the years. Will we get another one today?
Kirk Herbstreit doesn’t think so. The ESPN college football analyst has unveiled his prediction for this afternoon’s rivalry game in Ann Arbor.
The College GameDay analyst likes Michigan – big.
“Michigan kills Michigan State today,” he said this morning.
ESPN’s Football Power Index projections seem to agree with Herbstreit, too. The computer model doesn’t think Michigan State has much of a chance.
ESPN’s Football Power Index is giving Michigan an 84.2 percent chance of winning today’s game. It gives Michigan State just a 15.8 percent chance of pulling off the upset.
Few head coaches need a win today more than Mark Dantonio, though it doesn’t look like anyone is expecting him to get one.
Michigan and Michigan State are set to kick off at noon E.T.
The game will be on FOX.


White to play 15
pips White=167 Black=157
(CorrectAnswer= 0/0, ErrorScore= 0)
1. 13/8 6/5 eq: -0.207 44.96% (G:11.89% B:0.44%) 55.04% (G:14.64% B:0.84%) 2. 24/23 13/8 eq: -0.213 (-0.006) 44.42% (G:11.20% B:0.37%) 55.58% (G:13.16% B:0.59%) 3. 24/18 eq: -0.233 (-0.026) 44.40% (G: 9.77% B:0.37%) 55.60% (G:13.82% B:0.57%) 4. 13/7 eq: -0.271 (-0.064) 43.00% (G:10.95% B:0.33%) 57.00% (G:14.68% B:0.85%) 5. 24/23 6/1* eq: -0.276 (-0.069) 42.64% (G:10.18% B:0.24%) 57.36% (G:14.03% B:0.67%)


Pizza Size
Pick your size first.  Medium will be feed 2-3 and Large 3-4 people.
The Pizzeria Revolution began where all great pizzas beign, Italy. There simple ingredients come together in firey brick ovens to make one of the truly great culinary wonders. It demands greatness. However in a time of Dominos, Pizza Hut, and Papa John's greatness is lacking. The Pizzeria holds the keys to make this happen. Starting with centuries of tradition, the freshest ingredients, wood fired ovens, and the best chefs we bring the all that real pizza has to offer. Now from a small town in Campania to a corner near you the revolution has come to turn mediocrity into flavor!
Pick your size first.  Medium will be feed 2-3 and Large 3-4 people.
Each pizza comes with a roasted red pepper and tomato sauce and cheese. Additional ingredients below:
Select how many pizzas would you like. Limit 5 pizzas per online order. Call for larger orders.
Size:
Topping:
Quntity:
Total: $


Your final score is.
Enter the name you would like to log your score on the leaderboard with (10 character limit): Submit results View High Scores


See notes at the bottom of this page for usage notes in version 1.x, although since 1.x is no longer supported, an upgrade is strongly recommended.
First some definitions:
You set a global error handler like this:
dwr.engine.setErrorHandler(handler);
You can also specify call or batch level error or warning handlers. For example, in the call meta-data:
Remote.method(params, { callback:function(data) { ... }, errorHandler:function(errorString, exception) { ... } });or, in batch meta-data:
dwr.engine.beginBatch(); Remote.method(params, function(data) { ... }); // Other remote calls dwr.engine.endBatch({ errorHandler:function(errorString, exception) { ... } });
DWR can marshall exceptions, and they will become errors in JavaScript land (they can't be thrown since this will probably be happening asynchronously).
For example, if we remote the following Java class:
public class Remote { public String getData() { throw new NullPointerException("message"); } }
Then in Javascript we will see the following:
function errh(msg) { alert(msg); } dwr.engine.setErrorHandler(errh); Remote.getData(function(data) { alert(data); });
The result will be an alert dialog from the errh()
error handler.
Exceptions are subject to the usual marshaling rules - that is nothing is converted without express permission. However, there is one deviation from this rule. If there is no marshaller in place for an exception, then a default MinimalistExceptionConverter is used. The MinimalistExceptionConverter tells the client that something has gone wrong (which the client could guess anyway, since the call did not work) but for security reasons, it does not say what broke - so exception types are converted to a java.lang.Throwable.
When there is no exception converter specified for an exception, the exception object passed to the client looks like this:
{ javaClassName:'java.lang.Throwable', message:'Error' }
You can enable a more verbose exception handler with the following in dwr.xml:
<convert match="java.lang.Exception" converter="exception"/>
By default, this will attempt to convert everything that is part of the exception, so the converted exception might look like this:
{ javaClassName:'org.xml.sax.SAXParseException', lineNumber:42, publicId:'somePublicId', message:'Missing >' }
Clearly, permission will be needed to convert nested properties, which includes the stack trace. By default, there is no permission to convert StackTrace elements. It is a good idea to either expose only the information that you wish to expose (better for a live environment):
<convert match="java.lang.Exception" converter="exception"> <param name='include' value='message,lineNumber'/> </convert>
Or allow stack traces too, (which can be useful in development):
<convert match="java.lang.StackTraceElement" converter="bean"/>
Aside from the fact that this is obviously insecure, it can also be quite verbose, so it might be best to use this technique only when the browser and web-server are close together in network terms.
The primary purpose of textHtmlHandler is to allow you to cope with the server expiring your session and sending a login page in response to a DWR request without letting DWR handle the response at all.
The standard usage goes something like this:
dwr.engine.setTextHtmlHandler(function() { window.alert("Your session has expired, please login again." ); document.location = '/mycontext/login'; });
From DWR version 2.0.3 it is possible to show the login page using a pop-up div, keeping the user on the current page. The textHtmlHandler function is passed a parameter which contains information about the failure. The data passed in the parameter is:
Example usage might be something like this:
dwr.engine.setTextHtmlHandler(function(pageData) { // display pageData.responseText in a Lightbox });
A fully working example would need to post the login from inside an iframe to allow the user to remain on the same page.
Prior to DWR 2.0 you had to use the old format for registering handlers. (This still works with version 2.0 however it is deprecated).
DWREngine.setErrorHandler(handler);


Hi, I'm William, a digital nomad specialising in language generation. I talk to people about computers and build computers that talk to people. Scroll down to see a few of the things I've built and where I've built them.
I grew up in Durham, England before moving up to Scotland to read software engineering at the University of Edinburgh. My focus there was on Natural Language Generation (NLG), AI that writes text like a human. After graduation I moved to Aberdeen to work in a startup called Data2Text which later became Arria NLG.
At Arria I built projects for a wide variety of clients and built up the technology powering those solutions. I became the expert on Arria's SDK and took a position as the Head of Technology Development. A large part of that role was to stand in front of clients (from developers to CEOs) educating them on how NLG could improve customer experience and help them scale.
After nearly six years at Arria I left Aberdeen so that I could travel the world and work on a few personal projects. Look below to see where a year as a digital nomad has taken me.
At the moment I'm enjoying the British countryside while looking for my next opportunity. If you have an idea of what that could be, please get in touch at w.a.bradshaw@gmail.com.


Our users were our fellow classmates but were meant to be symbolic of the general population.
The business plan my partner and I came up with was an app that would streamline people's experiences with doctors and making appointments.
Using interviews of our other classmates, we developed a persona for our average user (shown below). Our interviews showed that there was a need for a more user friendly appointment making process.
The following images I took quickly with my phone are a few of the hand-drawn wireframes my partner and I created for our app entitled MobileDoc. The app was designed to give users greater control over their healthcare by streamlining making appointments, choosing the right doctors, and keeping track of information.


This is a description for the first slide
This is my paragraph tag with some text.
This is my paragraph tag with some text please keep reading here so that i can fill up this section with content.


{{ template "header.html" . }}
jfa-go
Version {{ .version }}
Commit {{ .commit }}
Available under the MIT License.
Apply settings from an existing profile, or source them directly from a user.
A restart is needed to apply some settings you changed. Do it now or later?
Refresh the page in a few seconds.
Create an Ombi user and configure it, then select it here. It's settings/permissions will be stored and applied to new ombi users created by jfa-go.
Profiles are applied to users when they create an account. A profile includes library access rights and homescreen layout.
Create a Jellyfin user and configure it. Select it here, and when this profile is applied to an invite, new users will be created with its settings.
Warning invites with infinite uses can be used abusively.


|
Perl Weekly
Issue #36 - 2012-04-02 - Testing, testing, testing: QA Hackathon and Test Automation courses
latest | archive | by Gabor Szabo
|
|
Hi,
The QA Hackathon just finished in Paris. There are a number of posts from the participants. I was sorry to miss it this year, but I have some other traveling to do:
I'll visit both Kiev in Ukraine and Madison, Wisconsin in the USA, for YAPC::Russia and YAPC::NA respectively. At both events I'll run a 2-days long version of my Test Automation using Perl class. For details see the link below.
Now for the articles...
|
|
|
Headlines
|
|
|
Announcements
|
DBD::Oracle v1.43_00 On CPAN -- Now With 100% Less DBIS
I am not sure if Yanick is not just fooling with us releasing DBD::Oracle on 1st April. This was probably the most serious post I read from him. Ever. He is also using plain English. I don't know. Maybe Oracle does that to him.
|
|
Articles
|
Why I love my job
Damian Conway tells us why he loves his job. I only saw part of his Presentation Aikido class, but I saw several other presentations by Damian. I can really recommend him! (Not that he needs my recommendation :)
|
|
|
|
Installing modules with cpanminus
The latest post on the Perl-tips newsletter by Paul Fenwick and Jacinta Richardson is dealing with cpanminus. Subscribe to their mailing list if you don't want to miss the next episode (and the course discount that usually comes with it.)
|
|
|
|
Discussion
|
DuckDuckGo is blowing up
This is the first time I link to an item on Hacker News and it is strange. In any case, DDG had some impressive growth. You might want to pay attention. Also I liked the comment: 'DDG is written in Perl, good looking Perl too'
|
|
The syntax of English is undecidable
It is only related to Perl as this was written by Jeffrey Kegler, author of the Marpa parser. It generated responses from some people who have not commented yet which is really nice. Broadening the Perl community.
|
|
Switching from Perl to Python: Speed
This is a funny. It seems that once someone starts to use Python, s/he immediately has the urge to fetch the 'unreadable' mantra. Even when the Perl code is much more readable than the Python code. The fact that the Perl version is also twice as fast than the Python version is just a minor side issue. Well, everyone and their bias.
|
|
Testing
|
Vim report for Devel::Cover (Perl QA Hackathon)
Paul Johnson stole some ideas from Ruby so now you can see (part of the) report from vim. Cute green >> marks and red :( marks appropriately on lines without a coverage. I tried it and for me it was only working on the files in blib/lib but maybe I need to fix something in my setup.
|
|
Party In Paris - 2012 QA Hackathon (part 1)
Barbie made some very nice improvement to the CPAN Testers infrastructure. Most notably there is now an API to fetch updates from the database. Eliminating the need to download the whole database which is several Gb.
|
|
|
|
The cost of technical debt: 3.61$ / line of code
Tudor Constantin found a research that puts some quantitative measures to the cost of 'technical debt'. I am not sure what the conclusion of this should be. Throwing away the old and partially broken code? Adding automatic tests to the existing application? Nothing? After all we would like to avoid paying that debt.
|
|
|
|
Debugging
|
Major DB::Color update (Perl QA Hackathon)
Ovid improved DB::Color that allows you to have color while using the built-in debugger of Perl. He also discovered some bugs in Syntax::Highlight::Engine::Kate that I maintain. As it was in the SVN repository of Padre I quickly converted it to Github and Ovid already pushed some regression tests. It would be nice if some good soul took a look at that module as I probably won't have much time for it.
|
|
Logging in Dancer
Flavio Poletti writes about the use of Log4perl together with Dancer.
|
|
Fun
|
Public TWiki Sites
Did you know that Pixar runs on Perl (too)? And the other nice web sites?  I wanted to play a bit with it and while reading the documentation I found some issues. So now I am a co-maintainer of the module. You are more than welcome to send bug reports, failing tests and fixes. You can also see a few simple examples in the blog.
|
|
|
|
Events
|
|
|
|
|
|
|
YAPC::NA
June 13-15, 2012, Madison, Wisconsin, USA
|
|
You know, you could get the Perl Weekly right in your mailbox. Every Week. Free of charge!
|


search
Pampers Baby Fresh Baby Wipes, 504 sheets
Hanes Baby Toddler Short Sleeve Tee
Gerber Newborn Baby Boy Zip Front Sleep N Plays, 2-Pack
Delta Children Gateway 4-in-1 Convertible Crib Dark Chocolate


African Book Lover's Haven
At its core, The Bluest Eye is a story about the oppression of women. The novel's women not only suffer the horrors of racial oppression, but also the tyranny and violation brought upon them by the men in their lives. The novel depicts several phases of a woman's development into womanhood.
Read MoreAmagqabantshintshi is an isiXhosa collection of poems on different subjects: faith, religion, politics, identity, and love.
Read MoreThe novel is an acute portrayal of a rapidly changing Zimbabwe. In addition to Vimbai and Dumisani’s personal development, the book shows us how social concerns shape the lives of everyday people.
Read MoreDon't drink too much alcohol. For some people, alcohol can become a problem. You may drink more than usual as a way of coping with or hiding your emotions, or just to fill time. But alcohol won't help you solve your problems and could also make you feel more depressed.
Read MoreShe only wants to escape to a quiet life, but the others disapprove of the newest, youngest, cleverest addition to the family. Treated with respect by her husband, she is viewed with suspicion by her seniors - who fear she may unlock their well-guarded secret. Through the voices of Baba Segi and his four wives, Lola Shoneyin weaves a vibrant story of love, secrets and a family like every other - happy and unhappy, truthful and not, sometimes kind, sometimes competitive, always bound by blood, and the past.
Read MoreThe River and the Source traces the lives of three generations of women and the men who stood by them.  Akoko's determination and clarity of vision is prominent among the five generations of Akokos's family. The River and the Source is a story of unparralleled vision, endurance, and hope.
Read MoreThings Fall Apart is the first of three novels in Chinua Achebe's critically acclaimed African Trilogy. It is a classic narrative about Africa's cataclysmic encounter with Europe as it establishes a colonial presence on the continent. Told through the fictional experiences of Okonkwo, a wealthy and fearless Igbo warrior of Umuofia in the late 1800s, Things Fall Apart explores one man's futile resistance to the devaluing of his Igbo traditions by British political andreligious forces and his despair as his community capitulates to the powerful new order.
Read MoreThe story tells about the struggle of a young leader, Waiyaki, to unite the two villages of Kameno and Makuyu through sacrifice and pain. The novel is set during the colonial period, when white settlers arrived in Kenya's "White Highlands", and has a mountain setting.
Read MoreThe Color of Kink explores black women's representations and performances within American pornography and BDSM (bondage and discipline, domination and submission, and sadism and masochism) from the 1930s to the present, revealing the ways in which they illustrate a complex and contradictory negotiation of pain, pleasure, and power for black women.
Read MoreReign is sexy, arrogant, and next in line to be president of the Black Smoke MC. He notices Gabriella the second she steps into the biker bar. She's curvy and beautiful — everything he likes for a one night stand. So he buys her a drink, thinking it'll be the beginning of a fun night. .
  As Morrison follows their affair, which plays out from the Caribbean to Manhattan and the deep South, she charts all the nuances of obligation and betrayal between blacks and whites, masters and servants, and men and women
Read MoreA Deeper Shade of Sex explores erotic possibilities as imagined and reported by more than 70 authors, both well known and emerging. This collection, including poetry, fiction, and essays, covers a compelling breadth of styles and emotions in contemporary African American writing.
Read MoreBrothers Gavin, Slade, and Dex, fall hard for Gavin’s new secretary, beautiful Hannah Craig. The oil executives know they must give her time to get to know them before she can choose one . . . who will seduce the virgin and keep her for his own. But when a dangerous predator begins stalking the small-town beauty, they work together to protect her, abducting Hannah and spiriting her to an isolated hideaway. Once alone with her, none of them can contain their burning desire. Though Slade and Dex don’t mind sharing, Gavin’s tragic past has put distance between him and his brothers. Now, they’re hoping that not only will Hannah love them back . . . but maybe mend their fractured family.
Read MoreI fell for someone I shouldn’t have. I’m not the only person to ever do such a thing. I know that. And I’m not an awful person for desiring his touch, his kiss, his everything… but I knew I shouldn’t have indulged. There’s something about knowing it’s wrong that tempts me that much more. The seduction became a game with higher stakes than any before him. In fact, it was only ever him. The thing is, I knew I shouldn’t. Now that the game is over and the pieces have fallen… I know I should have just walked away. There’s no way out of the wreckage. That doesn’t change the fact, that I wanted him more than anything. I still want him more than anything.
Read MoreWhat’s love got to do with it? The stories in this collection prove that love has everything to do with it. The myth has always been that Africans are too busy dealing with the politics of things, with poverty and bad governance and Boko Haram and El Shabab and a million other micro-aggressions thrown at them by Africa to bother with love’s niceties. .
Read MoreBlack Women in Sequence takes readers on a search for women of African descent in comics subculture. From the 1971 appearance of the Skywald Publications character "the Butterfly" - the first Black female superheroine in a comic book - to contemporary comic books, graphic novels, film, manga, and video gaming, a growing number of Black women are becoming producers, viewers, and subjects of sequential art.
Read MoreAn exploration of the history of South Africa, from the earliest known human inhabitation of the region to the end of the 20th century. For this third edition, the author adds two new chapters on the transfer of power and South Africa under the presidencies of Mandela and Mbeki..
Read MoreEast Africa is a very important geographical area in the study of human evolution. It is believed that people migrated to Asia and parts of Europe about 500,000 years ago from eastern Africa. Hunter-gatherers were living in East Africa when, about 12, 000 years ago, Caucasoid people came and settled in the Rift Valley area of Kenya and the central plains of Tanzania. Their skeletons have been found at Gamble‟s Cave, Kenya
Read MoreA Long Way Gone is the true story of Ishmael Beah, who becomes an unwilling boy soldier during a civil war in Sierra Leone. When he is twelve years old, Beah's village is attacked while he is away performing in a rap group with friends.
Read MoreSome quick example text to build on the card title and make up the bulk of the card's content.
Read MoreNigeria is Africa’s most populous country and the world’s eighth largest oil producer, but its success has been undermined in recent decades by ethnic and religious conflict, political instability, rampant official corruption, and an ailing economy.
Read MoreIn The Challenge For Africa, Maathai analyzes roadblocks to development, including the absence of peace and security, the lack of technological developments, the absence of fair international trade, population pressures and enduring hunger, the silencing of native languages and the evisceration of traditional cultures.
Read MoreThe media industry in Tanzania has gone through four major phases. There were the German colonial media established to serve communication interests (and needs) of the German administration. By the same time, missionaries tried to fulfil their tasks by editing a number of papers. There were the media of the British administration established as propaganda tool to support the colonial regime, and later the nationalists’ media established to agitate for self-governance and respect for human rights.
Read MoreThe Fate of Africa has been hailed by reviewers as "A masterpiece....The nonfiction book of the year" (The New York Post); "a magnificent achievement" (Weekly Standard); "a joy," (Wall Street Journal) and "one of the decade's most important works on Africa" (Publishers Weekly, starred review). Spanning the full breadth of the continent, from the bloody revolt in Algiers against the French to Zimbabwe's civil war, Martin Meredith's classic history focuses on the key personalities, events and themes of the independence era, and explains the myriad problems that Africa has faced in the past half-century. It covers recent events like the ongoing conflict in Sudan, the controversy over Western aid, the exploitation of Africa's resources, and the growing importance and influence of China..
Read MoreA 13-year-old boy is thrown out of the school he loves when his family can no longer afford the fees. He sneaks into the library and learns how to build a windmill to save his village from a famine.
Read MoreRead this warm tale of camaraderie and affection set in the wild and beautiful Savannah in our free illustrated kid's book. Ginger the giraffe uses her long neck to save the other animals from the blazing forest fire. Follow them in their jungle paths as they all meet with yet another adventure .
Read MoreThe class took a little train and went deep into the woods on their first school trip. But things didn’t go as planned and a whirlwind of adventure unfolds in this wonderful free bed time story book.
Read MoreLove shines through this great illustrated kids’ book . Read how a little girl makes chores fun and easy to do. A fantastic addition to your little one’s free bed time story collection.
Read MoreWas it just another game of hide and seek? No. It was not. First she fell into a deep, dark hole in the ground and then they found a treasure. Did it end there? No! It did not. Read more about this thrilling adventure of Sally and friends in this free illustrated kids’ book. The fun never ends when Sally’s around!
Read MoreAbe was a real Service Dog who dedicated his life assisting BJ, a good family friend. Service Dogs are smart, well trained, well behaved, dedicated, and committed to ensuring their master is safe. This book is intended to bring an awareness of their importance to early readers
Read MoreDr. Zob’s evil plans had failed once again, thanks to his wonder dog, Winston. They were just were they had to be, with Princess Aura at her birthday party. Read on to find out why Winston deserves a big cuddle and a juicy big bone. A big ‘Woof!’ to this wonderful free children’s story book.
Read MoreSulwe has skin the color of midnight. She is darker than everyone in her family.  Sulwe just wants to be beautiful and bright, like her mother and sister. Then a magical journey in the night sky opens her eyes and changes everything. In this stunning debut picture book, actress Lupita Nyong’o creates a whimsical and heartwarming story to inspire children to see their own unique beauty.
Read MoreThe book profiles his early life, coming of age, education and 27 years in prison. Under the apartheid government, Mandela was regarded as a terrorist and jailed on the infamous Robben Island for his role as a leader of the then-outlawed ANC. He later achieved international recognition for his leadership as president in rebuilding the country's once segregated society. The last chapters of the book describe his political ascension, and his belief that the struggle still continued against apartheid in South Africa.
 Living proof of his parents' indiscretion, Trevor was kept mostly indoors for the first years of his life, bound by the extreme and often absurd measures his mother took to hide him from a government that could, at any moment, take him away.
Read MoreWangari Maathai, in full Wangari Muta Maathai, (born April 1, 1940, Nyeri, Kenya—died September 25, 2011, Nairobi), Kenyan politician and environmental activist who was awarded the 2004 Nobel Prize for Peace, becoming the first black African woman to win a Nobel Prize.Jul 6, 2020 Born: April 1, 1940, Nyeri Founded: Green Belt Movement Nationality: Kenya Works written: The Green Belt Movement
Read MoreOne of Africa’s most respected figures, Julius Nyerere (1922 — 1999) was a politician of principle and intelligence. Known as Mwalimu or teacher he had a vision of education that was rich with possibility.
Read MoreKenneth Binyavanga Wainaina was a Kenyan author, journalist and 2002 winner of the Caine Prize for African Writing. In April 2014, Time magazine included Wainaina in its annual TIME 100 as one of the "Most Influential People in the World
Read MoreThe rise and fall of Ethiopia's former emperor, Emperor Haile Selassie.
Read MoreThe first thing to be said about Ellen Johnson Sirleaf’s This Child Will Be Great is that it is exceptionally well written, a true story that seems as much a thriller as the remembrances of an ambitious and brave woman.
Read MoreThe Green Book is a short book setting out the political philosophy of Libyan leader Muammar Gaddafi. The book was first published in 1975. It was "intended to be read by all people". It is said to have been inspired in part by The Little Red Book.
Read More


These contents are passed Ajax Loaded remotely。
Click the refresh button on the right of the head Can re-acquire content remotely。


Ocean [ar47], ocean, in The Inner Sea
Last updated Turn #139
Ocean [ar47], ocean, in The Inner Sea
------------------------------------------------------------------------
21: Pleasure Sloop [v5n], ship, 30 hulls, 1 rowing port, 90 sails, arrived
21: from Ocean [as47], owner:
21: Dorothy [v1b], Pen, with one worker, 94 sailors
21: Apollo [b5e], Imperial Empire, with 11 workers, six sailors, 63 lt.
21: xbowmen, accompanied by:
21: Lutra [a4w], Imperial Empire, with 13 paladins, 29 pikemen
21: Hera [g3f], Imperial Empire, with seven soldiers, 42 pikemen
21: Thor [r4g], Imperial Empire, with 43 pikemen
21: Eos [a2t], Imperial Empire, with ten workers, 48 lt. xbowmen
21: Khaki Blazer [w4j], Imperial Empire, with 13 soldiers,
21: six pikemen, 32 lt. foot
21: Banian [e7n], Imperial Empire, duke, the High Priest of the
21: Church of Eres [151], with four soldiers, ten angels
21: Winstin [o7y], Mandor Confederacy, prisoner
21: Merbit [e2m], Mandor Confederacy, prisoner
22: Pleasure Sloop [v5n], ship, 30 hulls, 1 rowing port, 90 sails,
22: departed for Pen City [aa0d].
30: The fog has cleared.
Routes leaving Ocean:
North, to Ocean [aq47], 6 days
East, to Ocean [ar48], 6 days
South, to Ocean [as47], 6 days
West, city, to Pen City [aa0d], Oceania, 1 day
West, forest, to Penhome [ar46], Oceania, impassable
It is raining.


🔧
🔍
▶
||
enable
disable
reset
remove
˅
finished downloads
disabled downloads
failed downloads
add download
list filenames
new Package
➫
move
⇄
sort
Downloads:
⁇
Speed:
⁇
File size:
⁇
/
⁇