In this notebook, a template is provided for you to implement your functionality in stages, which is required to successfully complete this project. If additional code is required that cannot be included in the notebook, be sure that the Python code is successfully imported and included in your submission if necessary.
Note: Once you have completed all of the code implementations, you need to finalize your work by exporting the iPython Notebook as an HTML document. Before exporting the notebook to html, all of the code cells need to have been run so that reviewers can see the final implementation and output. You can then export the notebook by using the menu above and navigating to \n", "File -> Download as -> HTML (.html). Include the finished document along with this notebook as your submission.
In addition to implementing code, there is a writeup to complete. The writeup should be completed in a separate file, which can be either a markdown file or a pdf document. There is a write up template that can be used to guide the writing process. Completing the code template and writeup template will cover all of the rubric points for this project.
The rubric contains "Stand Out Suggestions" for enhancing the project beyond the minimum requirements. The stand out suggestions are optional. If you decide to pursue the "stand out suggestions", you can include the code in this Ipython notebook and also discuss the results in the writeup file.
Note: Code and Markdown cells can be executed using the Shift + Enter keyboard shortcut. In addition, Markdown cells can be edited by typically double-clicking the cell to enter edit mode.
# Load pickled data
import pickle
import numpy as np
training_file = 'traffic-signs-data/train.p'
validation_file= 'traffic-signs-data/valid.p'
testing_file = 'traffic-signs-data/test.p'
with open(training_file, mode='rb') as f:
train = pickle.load(f)
with open(validation_file, mode='rb') as f:
valid = pickle.load(f)
with open(testing_file, mode='rb') as f:
test = pickle.load(f)
X_train, y_train = train['features'], train['labels']
X_valid, y_valid = valid['features'], valid['labels']
X_test, y_test = test['features'], test['labels']
The pickled data is a dictionary with 4 key/value pairs:
'features'
is a 4D array containing raw pixel data of the traffic sign images, (num examples, width, height, channels).'labels'
is a 1D array containing the label/class id of the traffic sign. The file signnames.csv
contains id -> name mappings for each id.'sizes'
is a list containing tuples, (width, height) representing the original width and height the image.'coords'
is a list containing tuples, (x1, y1, x2, y2) representing coordinates of a bounding box around the sign in the image. THESE COORDINATES ASSUME THE ORIGINAL IMAGE. THE PICKLED DATA CONTAINS RESIZED VERSIONS (32 by 32) OF THESE IMAGESComplete the basic data summary below. Use python, numpy and/or pandas methods to calculate the data summary rather than hard coding the results. For example, the pandas shape method might be useful for calculating some of the summary results.
n_train = len(X_train)
n_validation = len(X_valid)
n_test = len(X_test)
image_shape = X_train[0].shape
n_classes = y_train.max()+1
print("Number of training examples =", n_train)
print("Number of testing examples =", n_test)
print("Image data shape =", image_shape)
print("Number of classes =", n_classes)
def convertToOneHot(y):
oneHot = np.zeros((len(y), max(y) + 1))
oneHot[np.arange(0, len(y)), y] = 1
return oneHot
Y_train = convertToOneHot(y_train)
Y_test = convertToOneHot(y_test)
Y_valid = convertToOneHot(y_valid)
Visualize the German Traffic Signs Dataset using the pickled file(s). This is open ended, suggestions include: plotting traffic sign images, plotting the count of each sign, etc.
The Matplotlib examples and gallery pages are a great resource for doing visualizations in Python.
NOTE: It's recommended you start with something simple first. If you wish to do more, come back to it after you've completed the rest of the sections. It can be interesting to look at the distribution of classes in the training, validation and test set. Is the distribution the same? Are there more examples of some classes than others?
import matplotlib.pyplot as plt
%matplotlib inline
def show_images(image_dataset, n_rows, n_cols, graph_title='Training Images'):
plt.figure(figsize=(8, 6.5))
selected_classes = np.random.randint(44, size=n_rows)
image_number = 1
for row in selected_classes:
for col in range(1, n_cols + 1):
plt.subplot(n_rows, n_cols, image_number)
image_number += 1
x_selected = X_train[y_train == row]
random_index = np.random.randint(x_selected.shape[0])
plt.imshow(x_selected[random_index, :, :, :])
plt.axis('off')
plt.title('class: {}'.format(row))
plt.suptitle(graph_title)
plt.show()
def show_class_distribution(class_labels):
plt.figure(figsize=(10, 4))
examples_per_class = np.bincount(class_labels)
num_classes = len(examples_per_class)
plt.bar(np.arange(num_classes), examples_per_class, 0.8, color='green', label='Inputs per class')
plt.xlabel('Class number')
plt.ylabel('Examples per class')
plt.title('Distribution of Training Examples Amongst Classes')
plt.show()
show_images(X_train, 5, 5)
show_class_distribution(y_train)
Design and implement a deep learning model that learns to recognize traffic signs. Train and test your model on the German Traffic Sign Dataset.
The LeNet-5 implementation shown in the classroom at the end of the CNN lesson is a solid starting point. You'll have to change the number of classes and possibly the preprocessing, but aside from that it's plug and play!
With the LeNet-5 solution from the lecture, you should expect a validation set accuracy of about 0.89. To meet specifications, the validation set accuracy will need to be at least 0.93. It is possible to get an even higher accuracy, but 0.93 is the minimum for a successful project submission.
There are various aspects to consider when thinking about this problem:
Here is an example of a published baseline model on this problem. It's not required to be familiar with the approach used in the paper but, it's good practice to try to read papers like these.
Minimally, the image data should be normalized so that the data has mean zero and equal variance. For image data, (pixel - 128)/ 128
is a quick way to approximately normalize the data and can be used in this project.
Other pre-processing steps are optional. You can try different techniques to see if it improves performance.
Use the code cell (or multiple code cells, if necessary) to implement the first step of your project.
from skimage import exposure
def preprocessing(X):
#Scaling features
X = (X / 255.).astype(np.float32)
#Converting to grayscale using BT.601 recommendation
X = 0.299 * X[:, :, :, 0] + 0.587 * X[:, :, :, 1] + 0.114 * X[:, :, :, 2]
# X -= np.mean(X, axis = 0)
# X /= np.std(X, axis = 0)
for i in range(X.shape[0]):
X[i] = exposure.equalize_adapthist(X[i])
# Add a single grayscale channel
X = X.reshape(X.shape + (1,))
return X
X_train = preprocessing(X_train)
X_valid = preprocessing(X_valid)
X_test = preprocessing(X_test)
from sklearn.utils import shuffle
X_train, Y_train = shuffle(X_train, Y_train)
from collections import namedtuple
HyperParam = namedtuple('Parameters', [
'num_classes', 'batch_size', 'max_epochs',
'learning_rate', 'l2_lambda',
'conv1_k', 'conv1_d', 'conv1_p',
'conv2_k', 'conv2_d', 'conv2_p',
'conv3_k', 'conv3_d', 'conv3_p',
'fc4_size', 'fc4_p'
])
### Define your architecture here.
### Feel free to use as many code cells as needed.
import tensorflow as tf
def conv_relu_factory(input, kernel_size, depth):
weights = tf.get_variable( 'weights',
shape = [kernel_size, kernel_size, input.get_shape()[3], depth],
initializer = tf.contrib.layers.xavier_initializer()
)
biases = tf.get_variable( 'biases',
shape = [depth],
initializer = tf.constant_initializer(0.0)
)
conv = tf.nn.conv2d(input, weights,
strides = [1, 1, 1, 1], padding = 'SAME')
return tf.nn.relu(conv + biases)
def fully_connected_factory(input, size):
weights = tf.get_variable( 'weights',
shape = [input.get_shape()[1], size],
initializer = tf.contrib.layers.xavier_initializer()
)
biases = tf.get_variable( 'biases',
shape = [size],
initializer = tf.constant_initializer(0.0)
)
return tf.matmul(input, weights) + biases
def fully_connected_relu_factory(input, size):
return tf.nn.relu(fully_connected_factory(input, size))
def pool_factory(input, size):
return tf.nn.max_pool(
input,
ksize = [1, size, size, 1],
strides = [1, size, size, 1],
padding = 'SAME'
)
def model(input, params, predict_flag):
with tf.variable_scope('conv1'):
conv1 = conv_relu_factory(input, kernel_size = params.conv1_k, depth = params.conv1_d)
pool1 = pool_factory(conv1, size = 2)
pool1 = tf.cond(predict_flag,
lambda: pool1,
lambda: tf.nn.dropout(pool1, keep_prob = params.conv1_p)
)
with tf.variable_scope('conv2'):
conv2 = conv_relu_factory(pool1, kernel_size = params.conv2_k, depth = params.conv2_d)
pool2 = pool_factory(conv2, size = 2)
pool2 = tf.cond(predict_flag,
lambda: pool2,
lambda: tf.nn.dropout(pool2, keep_prob = params.conv2_p),
)
with tf.variable_scope('conv3'):
conv3 = conv_relu_factory(pool2, kernel_size = params.conv3_k, depth = params.conv3_d)
pool3 = pool_factory(conv3, size = 2)
pool3 = tf.cond(predict_flag,
lambda: pool3,
lambda: tf.nn.dropout(pool3, keep_prob = params.conv3_p)
)
# 1st conv-relu output
pool1 = pool_factory(pool1, size = 4)
shape = pool1.get_shape().as_list()
pool1 = tf.reshape(pool1, [-1, shape[1] * shape[2] * shape[3]])
# 2nd conv-relu output
pool2 = pool_factory(pool2, size = 2)
shape = pool2.get_shape().as_list()
pool2 = tf.reshape(pool2, [-1, shape[1] * shape[2] * shape[3]])
# 3rd conv-relu output
shape = pool3.get_shape().as_list()
pool3 = tf.reshape(pool3, [-1, shape[1] * shape[2] * shape[3]])
flattened = tf.concat([pool1, pool2, pool3], 1)
with tf.variable_scope('fc4'):
fc4 = fully_connected_relu_factory(flattened, size = params.fc4_size)
fc4 = tf.cond(predict_flag,
lambda: fc4,
lambda: tf.nn.dropout(fc4, keep_prob = params.fc4_p),
)
with tf.variable_scope('out'):
logits = fully_connected_factory(fc4, size = params.num_classes)
softmax = tf.nn.softmax(logits)
return logits, softmax
I used Pierre Sermanet and Yann LeCun's Multiscale convnet architecture. It has 3 convolutional layers for feature extraction, followed by pooling layers and finally a fully connected layer for softmax classification. The unique characterisitc of multi scale features is that the conv layers' output is not only forwarded into subsequent layer, but is also branched off and fed into classifier (e.g. fully connected layer).
The size of each layer is defined in the HyperParam namedtuple below.
A validation set can be used to assess how well the model is performing. A low accuracy on the training and validation sets imply underfitting. A high accuracy on the training set but low accuracy on the validation set implies overfitting.
### Train your model here.
### Calculate and report the accuracy on the training and validation set.
### Once a final model architecture is selected,
### the accuracy on the test set should be calculated and reported as well.
### Feel free to use as many code cells as needed.
import time
params = parameters
# Build the graph
graph = tf.Graph()
with graph.as_default():
tf_x = tf.placeholder(tf.float32, shape = (None, image_shape[0],
image_shape[1],
1))
tf_y = tf.placeholder(tf.float32, shape = (None, n_classes))
predict_flag = tf.placeholder(tf.bool)
current_epoch = tf.Variable(0, trainable=False)
learning_rate = tf.train.exponential_decay(params.learning_rate,
current_epoch,
decay_steps = params.max_epochs,
decay_rate = 0.01)
logits, predictions = model(tf_x, params, predict_flag)
with tf.variable_scope('fc4', reuse = True):
l2_loss = tf.nn.l2_loss(tf.get_variable('weights'))
softmax_cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits=logits,
labels=tf_y)
loss = tf.reduce_mean(softmax_cross_entropy) + params.l2_lambda * l2_loss
optimizer = tf.train.AdamOptimizer(
learning_rate = learning_rate).minimize(loss)
with tf.Session(graph = graph) as session:
session.run(tf.global_variables_initializer())
def calculate_accuracy(X, y):
all_predictions = []
all_losses = []
sce = []
for offset in range(0, len(y), params.batch_size):
end = offset + params.batch_size
x_batch, y_batch = X[offset:end], y[offset:end]
feed_dict = {
tf_x : x_batch,
tf_y : y_batch,
predict_flag : True
}
[pred_batch, loss_batch] = session.run([predictions, loss], feed_dict)
all_predictions.extend(pred_batch)
all_losses.append(loss_batch)
all_predictions = np.array(all_predictions)
all_losses = np.array(all_losses)
accuracy = 100.0 * np.sum(np.argmax(all_predictions, 1) == np.argmax(y, 1)) / all_predictions.shape[0]
all_losses = np.mean(all_losses)
return (accuracy, all_losses)
for epoch in range(params.max_epochs):
current_epoch = epoch
X_train, Y_train = shuffle(X_train, Y_train)
for offset in range(0, len(Y_train), params.batch_size):
end = offset + params.batch_size
x_batch, y_batch = X_train[offset:end], Y_train[offset:end]
session.run([optimizer], feed_dict = {
tf_x : x_batch,
tf_y : y_batch,
predict_flag : False
}
)
valid_accuracy, valid_loss = calculate_accuracy(X_valid, Y_valid)
train_accuracy, train_loss = calculate_accuracy(X_train, Y_train)
print("-------------- EPOCH %4d/%d --------------" % (epoch, params.max_epochs))
print(" Train loss: %.8f, accuracy: %.2f%%" % (train_loss, train_accuracy))
print("Validation loss: %.8f, accuracy: %.2f%%" % (valid_loss, valid_accuracy))
saver = tf.train.Saver()
if current_epoch % 10 == 0:
save_path = saver.save(session, "./" + str(current_epoch) + "_exp2_model.ckpt")
print("Model saved in file: %s" % save_path)
parameters = HyperParam(
num_classes = n_classes,
batch_size = 512,
max_epochs = 50,
learning_rate = 0.001,
l2_lambda = 0.001,
conv1_k = 5, conv1_d = 32, conv1_p = 0.8,
conv2_k = 5, conv2_d = 64, conv2_p = 0.6,
conv3_k = 5, conv3_d = 128, conv3_p = 0.6,
fc4_size = 1024, fc4_p = 0.5
)
The above parameters and hyperparameters were used for model training. Adam optimizer was used with L2 regularization and dropout probability of 0.8, 0.6, 0.6 and 0.4 in the consecutive convolutional and FC layers.
As visible from the above training logs, this network with the choice of hyperparameters was able to achieve 98.57% validation accuracy. There is definitely a possibility of improving the accuracy further by exploring other choices of hyperparameters and adding synthetic data.
I would like to highlight that the use of multiscale convnets greatly attributed to achieving an accuracy of 98.57% on the validation set without any data augmentation.
Usual ConvNets are organized in strict feed-forward layered architectures in which the output of one layer is fed only to the layer above.
However, in this model, the output of the first stage is branched out and fed to the classifier, in addition to the output of the second stage. Additionally, applying a second subsampling stage on the branched output yielded higher accuracies than with just one. This multiscale technique especially helps in recognizing the features of same classes that look similar but vary in scale [1]. Using the same network without multiscale features yielded an accuracy of <95% on the validation set.
I also tried to use the Spatial Transformer Network module but could not get it to work. STNs have demonstrated the ability of introducing spatial invariance in the networks.
with tf.Session(graph = graph) as sess:
saver = tf.train.Saver()
saver.restore(sess, './models/40_exp2_model.ckpt')
session = sess
test_accuracy, test_loss = calculate_accuracy(X_test, Y_test)
print("Test loss: %.8f, accuracy: %.2f%%" % (test_loss, test_accuracy))
To give yourself more insight into how your model is working, download at least five pictures of German traffic signs from the web and use your model to predict the traffic sign type.
You may find signnames.csv
useful as it contains mappings from the class id (integer) to the actual sign name.
### Load the images and plot them here.
### Feel free to use as many code cells as needed.
import os
import scipy.misc
NEW_IMAGES_FOLDER = './images/'
images = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg']
def resize_image(image_file):
image = plt.imread(NEW_IMAGES_FOLDER + image_file)
return scipy.misc.imresize(image, (32, 32))
resized_image_data = [resize_image(image) for image in images]
def display_images(imgs_data, grey = False):
index = 1
plt.figure(figsize=(11,7))
for img in imgs_data:
plt.subplot(1, 5, index)
plt.imshow(img[:,:,0]) if grey else plt.imshow(img,)
plt.axis('off')
index += 1
plt.show()
display_images(resized_image_data)
As visible from the above plots, all images appear to be good quality except the last one i.e. "Slippery road ahead". As the image appears quite blurred, the model might misclassify it. Moreover, there's a label below the image.
preprocessed_images = preprocessing(np.array(resized_image_data))
### Run the predictions here and use the model to output the prediction for each image.
### Make sure to pre-process the images with the same pre-processing pipeline used earlier.
### Feel free to use as many code cells as needed.
import pandas as pd
from matplotlib import gridspec
def print_result(top_k_prob, top_k_indices):
class_names = pd.read_csv('./signnames.csv')['SignName'].values
index = 0
img_index = 0
plt.figure(figsize=(14, 11))
gs = gridspec.GridSpec(5, 2, width_ratios=[1, 0.45])
for i in range(5):
img = resized_image_data[img_index]
img_index += 1
plt.subplot(gs[index])
plt.imshow(img)
plt.axis('off')
# plt.title(tag)
index += 1
plt.subplot(gs[index])
plt.barh(np.arange(1, 6, 1),
top_k_prob[i, :],
0.8,
color='green')
plt.yticks(np.arange(1, 6, 1), class_names[top_k_indices[i, :]])
index += 1
plt.suptitle('Test Images and their Softmax Probabilities')
plt.show()
with tf.Session(graph = graph) as sess:
saver = tf.train.Saver()
saver.restore(sess, './models/40_exp2_model.ckpt')
x_batch = preprocessed_images
feed_dict = {
tf_x : x_batch,
predict_flag : True
}
ps = sess.run(predictions, feed_dict)
top_k_op = tf.nn.top_k(ps, k=5)
top_k_results = sess.run(top_k_op)
print_result(top_k_results.values, top_k_results.indices)
As visible from the above visualization, the model performs accurately for all the images. Compared to the rest, the model is less confident for the slippery road image due to the blurriness of the image.
As calculated before, the accuracy on the original test set was 97.64% whereas it is 100% on these 5 images taken from the web.
Already done in above visualization
Note: Once you have completed all of the code implementations and successfully answered each question above, you may finalize your work by exporting the iPython Notebook as an HTML document. You can do this by using the menu above and navigating to \n", "File -> Download as -> HTML (.html). Include the finished document along with this notebook as your submission.


Welcome to ENASearch’s documentation!¶
The European Nucleotide Archive (ENA) is a database with a comprehensive record of nucleotide sequencing information (raw sequencing data, sequence assembly information and functional annotation). The data contained in ENA can be accessed manually or programmatically via REST URLs. However, building HTTP-based REST requests is not always straightforward - a user friendly, high-level access is needed to make it easier to interact with ENA programmatically.
We developed ENASearch, a Python library to search and retrieve data from ENA database. It also allows for rich querying support by accessing different fields, filters or functions offered by ENA. ENASearch can be used as a Python package, through a command-line interface or inside Galaxy.


Expression object for the transposition of a sparse vector.The SVecTransposer class is a wrapper object for the temporary transposition of a sparse vector. More...
#include <SVecTransposer.h>
Inherits blaze::SparseVector< SVecTransposer< VT, TF >, TF >.
Public Types | |
| enum | : bool { smpAssignable = VT::smpAssignable } |
| Compilation flag for SMP assignments. More... | |
| using | This = SVecTransposer< VT, TF > |
| Type of this SVecTransposer instance. | |
| using | ResultType = TransposeType_< VT > |
| Result type for expression template evaluations. | |
| using | TransposeType = ResultType_< VT > |
| Transpose type for expression template evaluations. | |
| using | ElementType = ElementType_< VT > |
| Resulting element type. | |
| using | ReturnType = ReturnType_< VT > |
| Return type for expression template evaluations. | |
| using | CompositeType = const This & |
| Data type for composite expression templates. | |
| using | Reference = Reference_< VT > |
| Reference to a non-constant matrix value. | |
| using | ConstReference = ConstReference_< VT > |
| Reference to a constant matrix value. | |
| using | Iterator = Iterator_< VT > |
| Iterator over non-constant elements. | |
| using | ConstIterator = ConstIterator_< VT > |
| Iterator over constant elements. | |
| using | VectorType = SVecTransposer< VT, TF > |
| Type of the vector. | |
Public Member Functions | |
| SVecTransposer (VT &sv) noexcept | |
| Constructor for the SVecTransposer class. More... | |
| ConstReference | operator[] (size_t index) const |
| Subscript operator for the direct access to the vector elements. More... | |
| ConstReference | at (size_t index) const |
| Checked access to the vector elements. More... | |
| Iterator | begin () |
| Returns an iterator to the first non-zero element of the sparse vector. More... | |
| ConstIterator | begin () const |
| Returns an iterator to the first non-zero element of the sparse vector. More... | |
| ConstIterator | cbegin () const |
| Returns an iterator to the first non-zero element of the sparse vector. More... | |
| Iterator | end () |
| Returns an iterator just past the last non-zero element of the sparse vector. More... | |
| ConstIterator | end () const |
| Returns an iterator just past the last non-zero element of the sparse vector. More... | |
| ConstIterator | cend () const |
| Returns an iterator just past the last non-zero element of the sparse vector. More... | |
| template<typename Other > | |
| EnableIf_< IsNumeric< Other >, SVecTransposer > & | operator*= (Other rhs) |
| Multiplication assignment operator for the multiplication between a vector and a scalar value ( ). More... | |
| template<typename Other > | |
| EnableIf_< IsNumeric< Other >, SVecTransposer > & | operator/= (Other rhs) |
| Division assignment operator for the division of a vector by a scalar value ( ). More... | |
| size_t | size () const noexcept |
| Returns the current size/dimension of the vector. More... | |
| void | reset () |
| Resets the vector elements. More... | |
| Iterator | insert (size_t index, const ElementType &value) |
| Inserting an element into the sparse vector. More... | |
| Iterator | find (size_t index) |
| Inserting an element into the sparse vector. More... | |
| void | reserve (size_t nonzeros) |
| Setting the minimum capacity of the sparse vector. More... | |
| void | append (size_t index, const ElementType &value, bool check=false) |
| Appending an element to the sparse vector. More... | |
| template<typename Other > | |
| bool | canAlias (const Other *alias) const noexcept |
| Returns whether the vector can alias with the given address alias. More... | |
| template<typename Other > | |
| bool | isAliased (const Other *alias) const noexcept |
| Returns whether the vector is aliased with the given address alias. More... | |
| bool | canSMPAssign () const noexcept |
| Returns whether the vector can be used in SMP assignments. More... | |
| template<typename VT2 > | |
| void | assign (const DenseVector< VT2, TF > &rhs) |
| Implementation of the transpose assignment of a dense vector. More... | |
| template<typename VT2 > | |
| void | assign (const SparseVector< VT2, TF > &rhs) |
| Implementation of the transpose assignment of a sparse vector. More... | |
| BLAZE_ALWAYS_INLINE VectorType & | operator~ () noexcept |
| Conversion operator for non-constant vectors. More... | |
| BLAZE_ALWAYS_INLINE const VectorType & | operator~ () const noexcept |
| Conversion operator for constant vectors. More... | |
Private Member Functions | |
| size_t | extendCapacity () const noexcept |
| Calculating a new vector capacity. More... | |
Private Attributes | |
| VT & | sv_ |
| The sparse vector operand. | |
Expression object for the transposition of a sparse vector.
The SVecTransposer class is a wrapper object for the temporary transposition of a sparse vector.
| anonymous enum : bool |
Compilation flag for SMP assignments.
The smpAssignable compilation flag indicates whether the vector can be used in SMP (shared memory parallel) assignments (both on the left-hand and right-hand side of the assignment).
|
inlineexplicitnoexcept |
Constructor for the SVecTransposer class.
| sv | The sparse vector operand. |
|
inline |
Appending an element to the sparse vector.
| index | The index of the new element. The index has to be in the range . |
| value | The value of the element to be appended. |
| check | true if the new value should be checked for default values, false if not. |
This function provides a very efficient way to fill a sparse vector with elements. It appends a new element to the end of the sparse vector without any additional memory allocation. Therefore it is strictly necessary to keep the following preconditions in mind:
Ignoring these preconditions might result in undefined behavior! The optional check parameter specifies whether the new value should be tested for a default value. If the new value is a default value (for instance 0 in case of an integral element type) the value is not appended. Per default the values are not tested.
|
inline |
Implementation of the transpose assignment of a dense vector.
| rhs | The right-hand side dense vector to be assigned. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Implementation of the transpose assignment of a sparse vector.
| rhs | The right-hand side sparse vector to be assigned. |
This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.
|
inline |
Checked access to the vector elements.
| index | Access index. The index has to be in the range . |
| std::out_of_range | Invalid vector access index. |
|
inline |
Returns an iterator to the first non-zero element of the sparse vector.
|
inline |
Returns an iterator to the first non-zero element of the sparse vector.
|
inlinenoexcept |
Returns whether the vector can alias with the given address alias.
| alias | The alias to be checked. |
|
inlinenoexcept |
Returns whether the vector can be used in SMP assignments.
|
inline |
Returns an iterator to the first non-zero element of the sparse vector.
|
inline |
Returns an iterator just past the last non-zero element of the sparse vector.
|
inline |
Returns an iterator just past the last non-zero element of the sparse vector.
|
inline |
Returns an iterator just past the last non-zero element of the sparse vector.
|
inlineprivatenoexcept |
Calculating a new vector capacity.
This function calculates a new vector capacity based on the current capacity of the sparse vector. Note that the new capacity is restricted to the interval .
|
inline |
Inserting an element into the sparse vector.
| index | The index of the search element. The index has to be in the range . |
This function can be used to check whether a specific element is contained in the sparse vector. It specifically searches for the element with index index. In case the element is found, the function returns an iterator to the element. Otherwise an iterator just past the last non-zero element of the sparse vector (the end() iterator) is returned. Note that the returned sparse vector iterator is subject to invalidation due to inserting operations via the subscript operator or the insert() function!
|
inline |
Inserting an element into the sparse vector.
| index | The index of the new element. The index has to be in the range . |
| value | The value of the element to be inserted. |
| std::invalid_argument | Invalid sparse vector access index. |
This function inserts a new element into the sparse vector. However, duplicate elements are not allowed. In case the sparse matrix already contains an element with row index index, a std::invalid_argument exception is thrown.
|
inlinenoexcept |
Returns whether the vector is aliased with the given address alias.
| alias | The alias to be checked. |
|
inline |
Multiplication assignment operator for the multiplication between a vector and a scalar value ( ).
| rhs | The right-hand side scalar value for the multiplication. |
|
inline |
Division assignment operator for the division of a vector by a scalar value ( ).
| rhs | The right-hand side scalar value for the division. |
|
inline |
Subscript operator for the direct access to the vector elements.
| index | Access index. The index has to be in the range . |
|
inlinenoexceptinherited |
Conversion operator for non-constant vectors.
|
inlinenoexceptinherited |
Conversion operator for constant vectors.
|
inline |
Setting the minimum capacity of the sparse vector.
| nonzeros | The new minimum capacity of the sparse vector. |
This function increases the capacity of the sparse vector to at least nonzeros elements. The current values of the vector elements are preserved.
|
inline |
Resets the vector elements.
|
inlinenoexcept |
Returns the current size/dimension of the vector.


Hi there, I am Bhasker Aggrawal. I am a 1st year computer science engineering student from DIT University, Dehradun. I love coding web.
Apart from that, I am designing my portfolio website.
| Year | Qualification | College/Institute | Score |
|---|---|---|---|
| 2016-2020 | BTech | DIT University, Dehradun. | 9.9 |
| 2015 | BSER | KOTA PUBLIC SCHOOL,ALWAR | 81.67% |
| 2013 | BSER | GYANDEEP BAL NIKETAN,BHARATPUR | 84.67% |
Social Links
Here I am
Facebook Twitter Instagram Github


two experiments in the Python environment. The first is virtualenv, which is a rethinking of virtual-python.py, and my attempt to move away from workingenv. It works mostly like virtual-python.py, and on systems where it works (not Windows, nor Framework Mac Python) I think it works considerably better than workingenv. No more not a setuptools' site.py, in particular. The basic technique is that it creates/copies a new python executable, and anything that uses that executable (including a script that references that executable with #!) will use that environment.
On the systems where it doesn’t work, I’m not quite sure what to do. The problem with the Mac is that sys.prefix is not determined by the location of the python executable, it’s hard-coded in some fashion. I asked about it on distutils-sig and got some response, but haven’t figured out any solution yet.
On Windows similarly sys.prefix is not determined by the executable location. What it’s determined by there I don’t know — the location of python25.dll, something in the registry? If I could figure it out, perhaps this could work there too — the existance of symlinks isn’t as important as it was with virtual-python.py.
If I can get these figured out, I think this will be a much happier experience than workingenv, and a somewhat friendlier experience than virtual-python.py. On non-Mac posix systems it works well right now.
The other experiment is in buildutils (downloadable with Mercurial): a new command python setup.py bundle, run in the application package you want to bundle. This creates a directory with all the dependencies of the application, and scripts that load up the appropriate dependencies. You can then ship the entire thing in a zip file as a runnable application that doesn’t require any installation except for unpacking.
Actually creating the bundle can be a little finicky, because easy_install has a tendency to prefer things on the local machine even though it shouldn’t. Probably it would be best to run this inside a virtualenv; when you are done you can also feel more confident that you’ve actually included all the dependencies (if you use --no-site-packages when creating the virtualenv).
Anyway, while both of these are a little incomplete I’m feeling optimistic about them, and I’m hoping intrepid souls can give feedback on how they work.
Update: virtualenv 0.8.2 is out, featuring Better Error Messages (and nothing else). Still doesn’t work on Mac Framework Pythons, or Windows. You’ll have to keep using workingenv there — but patches extremely welcome! Contact me if you are interested in supporting these platforms. It will involve some digging, but maybe we can just do the digging once for everyone.
Update 2: virtualenv 0.8.3 is out, featuring Windows!
Automatically generated list of related posts:
- Python Application Package I’ve been thinking some more about deployment of Python web...
- The Shrinking Python Web Framework World When I was writing the summary of differences between WebOb...
- Opening Python Classes So, I was reading through comments to despam my old...
- Python HTML Parser Performance In preparation for my PyCon talk on HTML I thought...
- A Python Web Application Package and Format (we should make one) At PyCon there was an open space about deployment, and...
I’m interested in the virtualenv script, as I’ve been using workingenv.py quite a lot, and I do keep getting bitten by the ‘not a setuptools site.py’ problem.
I think there is a typo in virtualenv.py – it tries to create the no-global-site-packages.txt file in the stdlib:
writefile(join(stdlib_dir, 'no-global-site-packages.txt'), '')
This should probably just be:
writefile(join(lib_dir, 'no-global-site-packages.txt'), '')
shouldn’t it?
Thanks for another great contribution.
[Ed note: updated in trunk]
It’s strange – virtualenv.py works fine with my from-python.org version of 2.5 – but you’re perfectly correct that it doesn’t play nice with the default-framework version. If I get a chance, I’ll see if I can unsnarl it – but I might also look into testing this out on Leopard instead (leopard had 2.5+ on it by default).
Curses, I take that back. Initial setup works fine, but as you point out on the mac, easy_setup still points stuff down into the frameworks library. I’ll look and see if there’s some tricky that can be done but for now I am back to using good old workingenv.py.
There is a minor problem in Windows
There are the steps
install Python 2.5 in c:\Python25
install setuptools (through ez_setup.py)
Where I tried to use the virtualenv.exe in Scripts, there is a problem
c:\Python25>c:\Python25\Scripts\virtualenv.exe ENV Creating ENV\Lib Creating ENV\Lib\site-packages Creating ENV\Scripts Copying C:\Python25\python.exe to ENV\Scripts ERROR: The executable ENV\Scripts\python.exe is not functioning ERROR: It thinks sys.prefix is ‘C:\Python25\ENV’ (should be ‘ENV’) ERROR: virtualenv is not compatible with this system or executable
c:\Python25>python lib\site-packages\virtualenv-0.8.3-py2.5.egg\virtualenv.py ENV Overwriting ENV\Lib\orig-prefix.txt with new content Copying c:\Python25\python.exe to ENV\Scripts Installing setuptools Processing setuptools-0.6c7-py2.5.egg Copying setuptools-0.6c7-py2.5.egg to c:\python25\env\lib\site-packages Adding setuptools 0.6c7 to easy-install.pth file Installing easyinstall-script.py script to c:\Python25\ENV\Scripts Installing easyinstall.exe script to c:\Python25\ENV\Scripts Installing easyinstall-2.5-script.py script to c:\Python25\ENV\Scripts Installing easyinstall-2.5.exe script to c:\Python25\ENV\Scripts
Installed c:\python25\env\lib\site-packages\setuptools-0.6c7-py2.5.egg Processing dependencies for setuptools==0.6c7 Finished processing dependencies for setuptools==0.6c7 Processing setuptools-0.6c7-py2.5.egg Removing c:\python25\env\lib\site-packages\setuptools-0.6c7-py2.5.egg Copying setuptools-0.6c7-py2.5.egg to c:\python25\env\lib\site-packages setuptools 0.6c7 is already the active version in easy-install.pth Installing easyinstall-script.py script to c:\Python25\ENV\Scripts Installing easyinstall.exe script to c:\Python25\ENV\Scripts Installing easyinstall-2.5-script.py script to c:\Python25\ENV\Scripts Installing easyinstall-2.5.exe script to c:\Python25\ENV\Scripts
Installed c:\python25\env\lib\site-packages\setuptools-0.6c7-py2.5.egg Processing dependencies for setuptools==0.6c7 Finished processing dependencies for setuptools==0.6c7
Thanks for yout great job
Agustin
[Ed. note: message fixed in 0.8.4]
Fun stuff. You should check out [how virtualenv is being used with zopeproject](http://baijum81.livejournal.com/22191.html).
One nit: the include directory doesn’t get copied by virtualenv. So eggs which build some C extensions (e.g., numpy) will not install with the easy_install copied over by virtualenv.
[Ed. note: the include directory is copied over in virtualenv trunk]
Good work, Ian, as always. Pylons is deciding which virtual Python environment to recommend/HOWTO in its tutorials. (Can HOWTO be a verb?) I have been recommending workingenv, and James G has started promoting zc.buildout. My main concern is the proliferation of approaches and the instability if we keep changing our minds. Kind of like the problem of too many web frameworks. I’d like to see a Python standard emerge but I guess it’s too soon for that.
I hope the incompatibility with Apple’s Python gets resolved soon, since portability to all platforms is an important factor for some people choosing a virtual environment.
Hi again,
(Where should virtualenv issues be reported, by the way? Is the distutils list a better place?)
I don’t think virtualenv (0.8.4) works if you don’t have an internet connection and you don’t already have setuptools installed. This is because it runs ez_setup.py, and ez_setup.py always downloads setuptools unless it finds the appropriate egg in os.curdir (ie. it ignores the egg mentioned on the command line)
A possible workaround would be to change directory to the support-files directory before running ez_setup.py. Otherwise ez_setup.py itself needs to be changed.
Thanks again,
Simon
activate.bat doesn’t seem to work in windows much. I was going to diagnose the problem further but looking at the script I can see this has no hope in hell of working and just needs an overhaul. All the percent signs and backslashed are doubled, the _OLD_VIRTUAL_PROMPT is used before it is set, and it sets the path to %VIRTUALENV%\bin, even though python and easyinstall are being installed in Scripts … need I go on? I would prefer to see it installing things into bin/ for cross-platform compatibility, too, instead of scripts.
C:\work>test_env\Scripts\activate.bat (test_env) %PROMPT%deactivate ‘deactivate’ is not recognized as an internal or external command, operable program or batch file.
(test_env) %PROMPT%python ‘pyth\on’ is not recognized as an internal or external command, operable program or batch file.
(test_env) %PROMPT%easy_install ‘easy_install’ is not recognized as an internal or external command, operable program or batch file.
[Ed. note: the include directory is copied over in virtualenv trunk]
What happened?
Python 2.5.1 straight out of Ubuntu Feisty repo; fresh Feisty; just testing. include is over in /usr/include/python2.5. Is there a command line option to point out the correct directory? I guess I can manually copy this over? Is this a Python 2.5 thing?
Chris: in the trunk I switched to a monkeypatch of distutils.sysconfig, which should point distutils at your site-wide include directory. This should make it unnecessary to copy over include.


Release notes
- Plugin system. Develop and share custom features
- Data mining, an advanced text pattern search over database objects and tables data
- Included SQL Template for CREATE TABLE and ALTER TABLE
- Included SQL Template for inserting and updating records
- Included DDL/Properties for all remaining elements in the tree (PostgreSQL)
- DDL tab now show grants for all supported objects (PostgreSQL)
- Query Data action now creates a SQL Template including all columns and ORDER BY primary key
- BDR 3.0 removed from OmniDB core, it is now a plugin
- Debugger can now be used when connecting via SSH tunnel
- Queries that return very large sets of data no longer block the query server
- Fixed SSH tunnel connection issue when using the monitoring dashboard
- Fixed \dx+ EXTENSION command in console tab


The polybar.
Down at the bottom resides the polybar which displays some information about the system, provides the systray, lets you control the volume and lets you interact with i3.


A set of classes and a cli for generating plots roughly according to the guiding ideas behind Principiae. This video presents a quick discussion on the types of plots that this tool is meant to capture. The command for generating plots is meant to be minimal, and extended mostly through a public css api, including most translations. Due to this being entirely without rendering, some features are impossible, i.e. aligning items based off of their size, since their size is inherently unknown. If you desire more than basic svg generation, use the base principia tool that includes various rendering options.
npm i -g principia-plot
principia-plot -i <spec.json> -o <result.svg> -c <style.css>
will take a plot specification as json and write the compiled svg to the result. Optional styles can be applied via user supplied styling. Since this is meant to operate without rendering, some alignment may be necessary via custom css transforms.
The spec file is a json file describing the plot.
Many of the items will be common between each plot type, but each josn starts with a a type
field with a string indicating what chart type ot produce
Each plot starts with a root group with several classes, princ--root
, princ--<type>
, and optionally a user specified set of classes for global style tweaking.
Different plotting types will default with a theme which will be replaced with user specified classes.
Each plotted set of data will be in a group with the class princ--item
any user specified classes.
Each plotted item with be successive child elements of their parent container, so the .princ--item:nth-child
pseudo-selector will pick succesive plotted elements.
In order to make default plotting easier, there are several color themes that take advantage of this to style each item with a new color, however due to css prescience that often means that the selector for an item specific class will get overridden in prescidence by a color theme.
To overcome operator prescidence, styling a specific item should have the following selector .princ--root .princ--item.<user-class> .princ--<type>
.
The command line api will pull default styles from the built-in style, as well as any css in "\$HOME/.princ_style.css" and ".princ_style.css". The built in location can be used an example of how to use the css api.
This type of plot is meant to capture comparisons between different labeled numbers, where their absolute magnitude is relevant. The ultimate representation is a bar style graph, sideways for legibility.
The base json specification for a zero comparison plot is:
{
type: "comparizonz",
width?: number,
format?: string,
classed?: string,
axis?: {
format?: string,
max?: number,
ticks: number[]
},
data: [...]
}
Each element of data is:
{
name: string,
value: number,
classed?: string
}
This plot has one xaxis on the bottom following the standard axis api.
Inside each princ--item
are three groups:
princ--name
.princ--value
.princ--num
.The width of each line is controlled by the font size to make things adjustable.
Thus the size and width of the bars and labels are also set via the font size.
To shrink the relative height of the bar, just adjust the font-size in princ--value
accordingly.
This type of plot is meant to capture how one or many variables changes as another evolves. Its representation is as a line graph.
The base json specification for an evolution plot is:
{
type: "evolution",
width?: number,
height?: number,
classed?: string,
xaxis?: ...
yaxis?: ...
data: [...]
}
Each axis has the following structure:
{
label?: string,
format?: string,
min?: number,
max?: number,
ticks?: number[]
}
Each data object can be a line or a span. Lines are simple line evolutions showing hove the y variable changes with the x variable. Lines have the following structure:
{
type: "line",
data: [number, number][],
classed?: string,
label?: string,
curve?: string,
point?: string
}
linear
, step
, step_before
, step_after
, basis
, cardinal
, monotone
, catmull_rom
.circle
, cross
, diamond
, square
, star
, triangle
, wye
.Spans show how a range of y values changes with x values. They can also be used to show error around a line. Spans have the following structure:
{
type: "span",
data: [number, number, number][],
classed?: string,
label?: string,
curve?: string,
point?: string
}
This plot has an x and a y axis following the standard axis api.
Each princ--item
will also have another class indicating whether it's a princ--line-item
or a princ--span-item
.
Inside each princ--item
are three groups:
princ--labels
followed by princ--label
with the label for the item.princ--point
.princ--span
or princ--line
.The size of points can be adjusted by scaling up or down the princ--point
class.
If a line has one of the classes princ--{dash,dot,dash-dot}
it will get the default styling for those types of line styles.
Labels can be moved away from the data by x translating princ--labels
or individually separated by translating princ--label
.
Many plots have axes showing the data, although some tweak presentation slightly.
The axes come in a root group with the class princ--axis
.
This potentially contains two groups: princ--xaxis
and princ--yaxis
.
Each axis is composed of four elements:
princ--tick-line
.princ--ticks
and then a separate princ--tick
for each tick.
Each princ-tick
will be the nth-child
in its container and in sorted order, so the selector princ--tick:nth-child(1)
will get the lowest tick.princ--tick-labels
and the separate princ--tick-label
for each individual label.
Like ticks, a princ--tick-label
will be its nth-child
.princ--axis-label
.The length of axis ticks can be set by x or y scaling the princ--tick
class.
Translating princ--tick-labels
and princ--axis-label
allows adjusting the spacing of those labels.
In order to make quick styling easier, a number of built in classes exist to change colors.
Color themes set the default coloring for successive items.
Each theme is a class that should be applied to the root element, prefixed by princ--
.
The available themes are:
In addition there are a number of default colors.
If a color class is applied to an item with the prefix princ--
it will change the color of that item, if it's applied to the root it will function as a one color theme.
The available colors are:
There a number of npm run scripts to aid with development.
npm run lint
will lint the typescript.npm run docs
will build the docs for github pages.npm run style
will update the default style sheet from base_style.css
and themes.json
.Generated using TypeDoc


class Connection implements ConnectionInterface
Methods
| void |
__construct(PDO $pdo, string $database = '', string $tablePrefix = '', array $config = array())
Create a new database connection instance. |
|
| void |
useDefaultQueryGrammar()
Set the query grammar to the default implementation. |
|
| void |
useDefaultSchemaGrammar()
Set the schema grammar to the default implementation. |
|
| void |
useDefaultPostProcessor()
Set the query post processor to the default implementation. |
|
| Builder |
getSchemaBuilder()
Get a schema builder instance for the connection. |
|
| Builder |
table(string $table)
Begin a fluent query against a database table. |
|
| Expression |
raw(mixed $value)
Get a new raw query expression. |
|
| mixed |
selectOne(string $query, array $bindings = array())
Run a select statement and return a single result. |
|
| array |
select(string $query, array $bindings = array())
Run a select statement against the database. |
|
| bool |
insert(string $query, array $bindings = array())
Run an insert statement against the database. |
|
| int |
update(string $query, array $bindings = array())
Run an update statement against the database. |
|
| int |
delete(string $query, array $bindings = array())
Run a delete statement against the database. |
|
| bool |
statement(string $query, array $bindings = array())
Execute an SQL statement and return the boolean result. |
|
| int |
affectingStatement(string $query, array $bindings = array())
Run an SQL statement and get the number of rows affected. |
|
| bool |
unprepared(string $query)
Run a raw, unprepared query against the PDO connection. |
|
| array |
prepareBindings(array $bindings)
Prepare the query bindings for execution. |
|
| mixed |
transaction(Closure $callback)
Execute a Closure within a transaction. |
|
| void |
beginTransaction()
Start a new database transaction. |
|
| void |
commit()
Commit the active database transaction. |
|
| void |
rollBack()
Rollback the active database transaction. |
|
| array |
pretend(Closure $callback)
Execute the given callback in "dry run" mode. |
|
| void |
logQuery(string $query, array $bindings, $time $time = null)
Log a query in the connection's query log. |
|
| void |
listen(Closure $callback)
Register a database query listener with the connection. |
|
| Column |
getDoctrineColumn(string $table, string $column)
Get a Doctrine Schema Column instance. |
|
| AbstractSchemaManager |
getDoctrineSchemaManager()
Get the Doctrine DBAL schema manager for the connection. |
|
| Connection |
getDoctrineConnection()
Get the Doctrine DBAL database connection instance. |
|
| PDO |
getPdo()
Get the current PDO connection. |
|
| PDO |
getReadPdo()
Get the current PDO connection used for reading. |
|
| Connection |
setPdo(PDO $pdo)
Set the PDO connection. |
|
| Connection |
setReadPdo(PDO $pdo)
Set the PDO connection used for reading. |
|
| string|null |
getName()
Get the database connection name. |
|
| mixed |
getConfig(string $option)
Get an option from the configuration options. |
|
| string |
getDriverName()
Get the PDO driver name. |
|
| Grammar |
getQueryGrammar()
Get the query grammar used by the connection. |
|
| void |
setQueryGrammar(Grammar $grammar)
Set the query grammar used by the connection. |
|
| Grammar |
getSchemaGrammar()
Get the schema grammar used by the connection. |
|
| void |
setSchemaGrammar(Grammar $grammar)
Set the schema grammar used by the connection. |
|
| Processor |
getPostProcessor()
Get the query post processor used by the connection. |
|
| void |
setPostProcessor(Processor $processor)
Set the query post processor used by the connection. |
|
| Dispatcher |
getEventDispatcher()
Get the event dispatcher used by the connection. |
|
| void |
setEventDispatcher(Dispatcher $events)
Set the event dispatcher instance on the connection. |
|
| Environment |
getPaginator()
Get the paginator environment instance. |
|
| void |
setPaginator(Environment|Closure $paginator)
Set the pagination environment instance. |
|
| CacheManager |
getCacheManager()
Get the cache manager instance. |
|
| void |
setCacheManager(CacheManager|Closure $cache)
Set the cache manager instance on the connection. |
|
| bool |
pretending()
Determine if the connection in a "dry run". |
|
| int |
getFetchMode()
Get the default fetch mode for the connection. |
|
| int |
setFetchMode(int $fetchMode)
Set the default fetch mode for the connection. |
|
| array |
getQueryLog()
Get the connection query log. |
|
| void |
flushQueryLog()
Clear the query log. |
|
| void |
enableQueryLog()
Enable the query log on the connection. |
|
| void |
disableQueryLog()
Disable the query log on the connection. |
|
| string |
getDatabaseName()
Get the name of the connected database. |
|
| string |
setDatabaseName(string $database)
Set the name of the connected database. |
|
| string |
getTablePrefix()
Get the table prefix for the connection. |
|
| void |
setTablePrefix(string $prefix)
Set the table prefix in use by the connection. |
|
| Grammar |
withTablePrefix(Grammar $grammar)
Set the table prefix and return the grammar. |
Details
at line 132
public void
__construct(PDO $pdo, string $database = '', string $tablePrefix = '', array $config = array())
Create a new database connection instance.
at line 158
public void
useDefaultQueryGrammar()
Set the query grammar to the default implementation.
at line 178
public void
useDefaultSchemaGrammar()
Set the schema grammar to the default implementation.
at line 195
public void
useDefaultPostProcessor()
Set the query post processor to the default implementation.
at line 215
public Builder
getSchemaBuilder()
Get a schema builder instance for the connection.
at line 228
public Builder
table(string $table)
Begin a fluent query against a database table.
at line 243
public Expression
raw(mixed $value)
Get a new raw query expression.
at line 255
public mixed
selectOne(string $query, array $bindings = array())
Run a select statement and return a single result.
at line 269
public array
select(string $query, array $bindings = array())
Run a select statement against the database.
at line 293
public bool
insert(string $query, array $bindings = array())
Run an insert statement against the database.
at line 305
public int
update(string $query, array $bindings = array())
Run an update statement against the database.
at line 317
public int
delete(string $query, array $bindings = array())
Run a delete statement against the database.
at line 329
public bool
statement(string $query, array $bindings = array())
Execute an SQL statement and return the boolean result.
at line 348
public int
affectingStatement(string $query, array $bindings = array())
Run an SQL statement and get the number of rows affected.
at line 371
public bool
unprepared(string $query)
Run a raw, unprepared query against the PDO connection.
at line 387
public array
prepareBindings(array $bindings)
Prepare the query bindings for execution.
at line 417
public mixed
transaction(Closure $callback)
Execute a Closure within a transaction.
at line 449
public void
beginTransaction()
Start a new database transaction.
at line 464
public void
commit()
Commit the active database transaction.
at line 476
public void
rollBack()
Rollback the active database transaction.
at line 496
public array
pretend(Closure $callback)
Execute the given callback in "dry run" mode.
at line 560
public void
logQuery(string $query, array $bindings, $time $time = null)
Log a query in the connection's query log.
at line 578
public void
listen(Closure $callback)
Register a database query listener with the connection.
at line 604
public Column
getDoctrineColumn(string $table, string $column)
Get a Doctrine Schema Column instance.
at line 616
public AbstractSchemaManager
getDoctrineSchemaManager()
Get the Doctrine DBAL schema manager for the connection.
at line 626
public Connection
getDoctrineConnection()
Get the Doctrine DBAL database connection instance.
at line 640
public PDO
getPdo()
Get the current PDO connection.
at line 650
public PDO
getReadPdo()
Get the current PDO connection used for reading.
at line 661
public Connection
setPdo(PDO $pdo)
Set the PDO connection.
at line 674
public Connection
setReadPdo(PDO $pdo)
Set the PDO connection used for reading.
at line 686
public string|null
getName()
Get the database connection name.
at line 697
public mixed
getConfig(string $option)
Get an option from the configuration options.
at line 707
public string
getDriverName()
Get the PDO driver name.
at line 717
public Grammar
getQueryGrammar()
Get the query grammar used by the connection.
at line 728
public void
setQueryGrammar(Grammar $grammar)
Set the query grammar used by the connection.
at line 738
public Grammar
getSchemaGrammar()
Get the schema grammar used by the connection.
at line 749
public void
setSchemaGrammar(Grammar $grammar)
Set the schema grammar used by the connection.
at line 759
public Processor
getPostProcessor()
Get the query post processor used by the connection.
at line 770
public void
setPostProcessor(Processor $processor)
Set the query post processor used by the connection.
at line 780
public Dispatcher
getEventDispatcher()
Get the event dispatcher used by the connection.
at line 791
public void
setEventDispatcher(Dispatcher $events)
Set the event dispatcher instance on the connection.
at line 801
public Environment
getPaginator()
Get the paginator environment instance.
at line 817
public void
setPaginator(Environment|Closure $paginator)
Set the pagination environment instance.
at line 827
public CacheManager
getCacheManager()
Get the cache manager instance.
at line 843
public void
setCacheManager(CacheManager|Closure $cache)
Set the cache manager instance on the connection.
at line 853
public bool
pretending()
Determine if the connection in a "dry run".
at line 863
public int
getFetchMode()
Get the default fetch mode for the connection.
at line 874
public int
setFetchMode(int $fetchMode)
Set the default fetch mode for the connection.
at line 884
public array
getQueryLog()
Get the connection query log.
at line 894
public void
flushQueryLog()
Clear the query log.
at line 904
public void
enableQueryLog()
Enable the query log on the connection.
at line 914
public void
disableQueryLog()
Disable the query log on the connection.
at line 924
public string
getDatabaseName()
Get the name of the connected database.
at line 935
public string
setDatabaseName(string $database)
Set the name of the connected database.
at line 945
public string
getTablePrefix()
Get the table prefix for the connection.
at line 956
public void
setTablePrefix(string $prefix)
Set the table prefix in use by the connection.
at line 969
public Grammar
withTablePrefix(Grammar $grammar)
Set the table prefix and return the grammar.


Typedefs | |
| typedef struct grib_handle | grib_handle |
| typedef struct grib_multi_handle | grib_multi_handle |
Functions | |
| int | grib_count_in_file (grib_context *c, FILE *f, int *n) |
| Counts the messages contained in a file resource. | |
| grib_handle * | grib_handle_new_from_file (grib_context *c, FILE *f, int *error) |
| Create a handle from a file resource. | |
| grib_handle * | grib_handle_new_from_message (grib_context *c, void *data, size_t data_len) |
| Create a handle from a user message in memory. | |
| grib_handle * | grib_handle_new_from_multi_message (grib_context *c, void **data, size_t *data_len, int *error) |
| Create a handle from a user message in memory. | |
| grib_handle * | grib_handle_new_from_message_copy (grib_context *c, const void *data, size_t data_len) |
| Create a handle from a user message. | |
| grib_handle * | grib_handle_new_from_template (grib_context *c, const char *res_name) |
| Create a handle from a read_only template resource. | |
| grib_handle * | grib_handle_new_from_samples (grib_context *c, const char *res_name) |
| Create a handle from a message contained in a samples directory. | |
| grib_handle * | grib_handle_clone (grib_handle *h) |
| Clone an existing handle using the context of the original handle, The message is copied and reparsed. | |
| int | grib_handle_delete (grib_handle *h) |
| Frees a handle, also frees the message if it is not a user message. | |
| grib_multi_handle * | grib_multi_handle_new (grib_context *c) |
| Create an empty multi field handle. | |
| int | grib_multi_handle_append (grib_handle *h, int start_section, grib_multi_handle *mh) |
| Append the sections starting with start_section of the message pointed by h at the end of the multi field handle mh. | |
| int | grib_multi_handle_delete (grib_multi_handle *mh) |
| Delete multi field handle. | |
| int | grib_multi_handle_write (grib_multi_handle *mh, FILE *f) |
| Write a multi field handle in a file. |
| typedef struct grib_handle grib_handle |
Grib handle, structure giving access to parsed grib values by keys
| typedef struct grib_multi_handle grib_multi_handle |
Grib multi field handle, structure used to build multi fields messages.
| int grib_count_in_file | ( | grib_context * | c, | |
| FILE * | f, | |||
| int * | n | |||
| ) |
Counts the messages contained in a file resource.
| c | : the context from wich the handle will be created (NULL for default context) | |
| f | : the file resource | |
| n | : the number of messages in the file |
| grib_handle* grib_handle_clone | ( | grib_handle * | h | ) |
Clone an existing handle using the context of the original handle, The message is copied and reparsed.
| h | : The handle to be cloned |
| int grib_handle_delete | ( | grib_handle * | h | ) |
Frees a handle, also frees the message if it is not a user message.
| h | : The handle to be deleted |
| grib_handle* grib_handle_new_from_file | ( | grib_context * | c, | |
| FILE * | f, | |||
| int * | error | |||
| ) |
Create a handle from a file resource.
The file is read until a message is found. The message is then copied. Remember always to delete the handle when it is not needed any more to avoid memory leaks.
| c | : the context from wich the handle will be created (NULL for default context) | |
| f | : the file resource | |
| error | : error code set if the returned handle is NULL and the end of file is not reached |
| grib_handle* grib_handle_new_from_message | ( | grib_context * | c, | |
| void * | data, | |||
| size_t | data_len | |||
| ) |
Create a handle from a user message in memory.
The message will not be freed at the end. The message will be copied as soon as a modification is needed.
| c | : the context from which the handle will be created (NULL for default context) | |
| data | : the actual message | |
| data_len | : the length of the message in number of bytes |
| grib_handle* grib_handle_new_from_message_copy | ( | grib_context * | c, | |
| const void * | data, | |||
| size_t | data_len | |||
| ) |
Create a handle from a user message.
The message is copied and will be freed with the handle
| c | : the context from wich the handle will be created (NULL for default context) | |
| data | : the actual message | |
| data_len | : the length of the message in number of bytes |
| grib_handle* grib_handle_new_from_multi_message | ( | grib_context * | c, | |
| void ** | data, | |||
| size_t * | data_len, | |||
| int * | error | |||
| ) |
Create a handle from a user message in memory.
The message will not be freed at the end. The message will be copied as soon as a modification is needed. This function works also with multi field messages.
| c | : the context from which the handle will be created (NULL for default context) | |
| data | : the actual message | |
| data_len | : the length of the message in number of bytes | |
| error | : error code |
| grib_handle* grib_handle_new_from_samples | ( | grib_context * | c, | |
| const char * | res_name | |||
| ) |
Create a handle from a message contained in a samples directory.
The message is copied at the creation of the handle
| c | : the context from wich the handle will be created (NULL for default context) | |
| res_name | : the resource name |
| grib_handle* grib_handle_new_from_template | ( | grib_context * | c, | |
| const char * | res_name | |||
| ) |
Create a handle from a read_only template resource.
The message is copied at the creation of the handle
| c | : the context from wich the handle will be created (NULL for default context) | |
| res_name | : the resource name |
| int grib_multi_handle_append | ( | grib_handle * | h, | |
| int | start_section, | |||
| grib_multi_handle * | mh | |||
| ) |
Append the sections starting with start_section of the message pointed by h at the end of the multi field handle mh.
Remember always to delete the multi handle when it is not needed any more to avoid memory leaks.
| h | : The handle from which the sections are copied. | |
| start_section | : section number. Starting from this section all the sections to then end of the message will be copied. | |
| mh | : The multi field handle on which the sections are appended. |
| int grib_multi_handle_delete | ( | grib_multi_handle * | mh | ) |
Delete multi field handle.
| mh | : The multi field handle to be deleted. |
| grib_multi_handle* grib_multi_handle_new | ( | grib_context * | c | ) |
Create an empty multi field handle.
Remember always to delete the multi handle when it is not needed any more to avoid memory leaks.
| c | : the context from wich the handle will be created (NULL for default context) |
| int grib_multi_handle_write | ( | grib_multi_handle * | mh, | |
| FILE * | f | |||
| ) |
Write a multi field handle in a file.
Remember always to delete the multi handle when it is not needed any more to avoid memory leaks.
| mh | : The multi field handle to be written. | |
| f | : File on which the file handle is written. |


Ricky Gervais lands performance of the year gong for After Life
He will be celebrated at the Rose d’Or awards next month.
Ricky Gervais will be honoured with the Rose d’Or performance of the year prize at a ceremony next month, it has been announced.
The Office star will be presented with the gong for his work in Netflix series After Life, which he also penned.
The Rose d’Or awards, which celebrate international excellence in entertainment programming, will be handed out at a gala event hosted by Sir Lenny Henry.
After Life has also been shortlisted for the comedy drama and sitcom prize, alongside Sex Education, Plebs, The Bisexual, Arde Madrid and Derry Girls.
The show follows widower Tony, played by Gervais, who is devastated by the death of his wife and decides to punish the world by saying and doing whatever he likes.
The second series, which will see the return of Gervais and co-stars Penelope Wilton, Kerry Godliman and Mandeep Dhillon, is due to launch on Netflix in 2020.
Sofia Helin, chairwoman of the Rose d’Or jury, said: “After Life’s first season moves between dark comedy and affecting drama, Ricky gives a standout performance, bringing a new dimension to his talent.”
Gervais will be presented with his prize at the Rose d’Or awards in London on December 1.


"BEHEAD "a method of taking away life practised among the Egyptians(Genesis 40:17-19). There are instances of this mode of punishment also among the Hebrews (2 Samuel 4:8; 20:21,22; 2 Kings 10:6-8). It is also mentioned in the New Testament (Matthew 14:8-12; Acts 12:2).
"BEHEAD "a method of taking away life practised among the Egyptians(Genesis 40:17-19). There are instances of this mode of punishment also among the Hebrews (2 Samuel 4:8; 20:21,22; 2 Kings 10:6-8). It is also mentioned in the New Testament (Matthew 14:8-12; Acts 12:2).


I consider myself to be a well experienced smoker of cannabis and generally have used good caution while doing so. I have always loved smoking weed and generally had good experiences. I always smoked it with trusted friends and loved how it would let me unwind. I've never had any ill effects other than mild anxiety and one panic attack. After my first panic attack I learned that I wasn't the first to experience this and decided it must be a one off. I learned a lot about anxiety and felt I could shake off any future occurrences of a panic attack.
I felt confused and baffled as to why I reacted this way. I decided then to do a test and smoke a few hits with my friend J for my two days off from work. I was deeply relaxed for the first two days and felt very relaxed and care free about life. I thought one more day would be perfect so I called out sick the next day.
I went to my buddy J's house again to have a nice relaxing day watching movies and smoking a bit. Ready to take on the sweet herb I had no worries and freed my mind anxiety. This was one of the first times smoking from a bong and I thought I'd go for a few really good hits.
 It was back... I felt oncoming panic and anxiety yet again. After we hung out for a bit and I took some deep breaths I could still feel my heart beating way too fast. I thought those two good hits were far too little to feel these feelings again. I politely excused myself from J's house and I took some deep breaths in the car and turned on The Doors - Waiting for the Sun. I was high as a kite and felt the familiar racing heart/mild anxiety but was able to shake it off somewhat. The music helped me get into a stoner state of mind and let my worries drift away.
At this time I thought it would be a good time to visit my old friend B. I started my journey breathing deep and taking the side streets. When I arrived I told B that I was really high and enjoying it as I was able to harness my anxiety/panic. At this point B gave me a nice little package of Pot cookies that I'd later consume that night. At this point I'd never eaten pot and thought I'd give it a try. I wanted to beat my panic attack and thought I'd go for a super session to train myself. I quickly ate 2 small cookies that night at about 8:00 PM to quickly feel the most euphoric I've ever felt on any substance. It only took about 30-60 minutes to kick in.
After eating the cookies I couldn't get to sleep and was starting to have racing thoughts, concepts and ideas racing through my head. Being a computer geek I decided to browse the web and listen to some of my favorite 60's psych/garage bands. As the night progressed I found I was reading whole articles very quickly. I was finding a lot of intrigue with HP Lovecraft's early life. I didn't know why it came to me, he just always intrigued me and thought I'd read up on him. This is where I came across his writing about the mirage plant, and how it has been considered to be the true origin of the meaning of 4:20. In my stoned state this blew my mind and I had to take a break. His words spoke right to me and I was thinking deeply at this point.
I got a little tired around 1 AM and thought I'd lay on the couch for a bit. This is where things were getting weird for me. The dream I experienced shortly after haunts me to this day. I remember being in front of group of men in full Freemasonic dress and they were initiating me to be a 33rd degree Freemason. It was dark and the men kept telling me I was chosen to follow out their task. At this point I awoke sweating with a fast beating heart. I got up and went outside to smoke a cigarette. I looked at the clock and it was just after 3:00 AM. The cigarette calmed me down a bit and I could think about my dream.
Normally it would've just been a dream but being high I managed to run my mind into an over analytical loop of what the dream was really trying to say. I've always been a little intrigued by secret societies. The night sky was so clear and the stars were bright. I got a strange dark feeling shortly after and felt I knew the answer to the universe. I felt like there was a reason I chose to smoke and eat weed. For what seemed like an eternity of being stoned I decided to go to bed shortly after 4:20 AM and decided I found what being high was all about. I listened to some Electric Wizard and the slow drone lulled me off to sleep.
The next day I awoke refreshed but didn't feel myself. I still felt high but I was thinking clear enough to go to work, or so I thought. What was I thinking. I was still high and was over analyzing everything. I went to work and totally freaked my co-workers out. I kept telling them that the computer system wasn't running right. In my strange state of mind was trying to explain how to fix it. I had to use the restroom multiple times due to all the water I was drinking to flush the THC out of my system. How could I still be high and why was I starting to feel panic yet again?
I've been in touch with my spirituality but never liked to label myself as any certain religion. On my first break I thought I'd meditate/pray that these feelings would pass. Strangely it kind of worked. But what happened next was any pot smokers worst nightmare. I was asked into my supervisor's office.
That did it... The panic really set in then. They could tell I was high on something and I wasn't in my right mind. My sup said I had to take a drug test and drove me to the clinic to run a test. At this time I really disliked my job and decided to stand up for myself I refused to take the drug test and they sent me home. My wife came to pick me up and she and I were really angry at the situation. At the time she didn't know I was partaking in smoking/eating pot the previous few days so she was confused and upset. I felt trapped by my anxiety and was beginning to get very nervous.
I was tempted to run out of the car but she kept me in. She decided to stop off at her work and she ordered me to stay in the car. At this point I started to lose touch with reality and can't explain why I thought this was a good idea. I ran into her office flipping everyone off and ran to the bathroom. Everyone was in shock and the cops were called.
They asked me why I was acting the way I did and I told them I smoked and ate weed and that I felt it should be legal. That was a great idea... After confirming with them that I wasn't going to hurt myself or anyone else they decided that I needed to go to the hospital. At this point I had no reason to hide what I did and let them search my bag which had nothing in it. As I was having a full blown panic attack they put me in the custody of my wife and I was in the back of an ambulance. I was in a dream state for the next 2 days and completely blacked out. I remember feeling as if I was dying and had let go of my soul and was in purgatory. I had a sense of astral projection a number of times and could see myself in the hospital bed and wondered why I couldn't get up. I later found that they pumped me full of benzos and sleeping aids.
I awoke the third day realizing I wasn't at the hospital anymore. Feeling back to base line I felt that I'd explore my new surroundings. I made my way to the main area of the building and asked the lady at the desk where I was. She informed me that I was at the state mental hospital... What in the hell.. At this point I was shocked and couldn't believe what happened. I barely could recognize myself in the mirror. I looked ghostly and tired. Apparently I didn't sleep for the first day at the hospital and wasn't making much sense when talking. In my altered state I also refused counseling which made them initially think I was crazy. I was put on psych analysis and they couldn't find anything wrong with me after all of the testing. The only thing that came out of it was that I was in psychosis and had anxiety/panic disorder.
I got out of the hospital after 72 hour hold and never had any legal issues due to this incident. I don't blame the weed but more my own stupidity for getting me into this situation. It was very hard to put this in words but this experience has definitely changed me for the better. Since then I've smoked a couple more times, but will never eat weed again. I didn't even get a tinge of anxiety when I smoked again but only took 1 hit each time. In a way I feel this has been a learning/spiritual experience. I found that before smoking I've always had a bit of underlying anxiety. I don't touch weed anymore just to be safe. I do still believe it should be legalized though. When used in a controlled environment it can be very beneficial. I feel that prohibition and fear of being caught put me into the situation more than the weed itself.
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.


final |
|---|
| Methods | ||
|---|---|---|
public
|
__construct(
HttpRequest $request,
RouteFactory $factory,
EventHandler|null $dispatcher = null,
Application|null $app = null,
)
|
# |
public
|
match(HttpRequest $request): Route|null
|
# |
protected
|
process(RouteBag $routes): bool
|
# |
public
|
render(Route $route): mixed
|
# |
public
|
addLoadedRoute(Route $route): void
|
# |
public
|
getRoutes(): RouteBag
|
# |
public
|
getLoadedRoutes(): RouteBag
|
# |
| Properties | |||
|---|---|---|---|
protected
|
RouteBag
|
$loadedRoutes
|
# |
protected
|
RouteBag
|
$processedRoutes
|
# |
protected
|
RouteFactory
|
$factory
|
# |
protected
|
HttpRequest
|
$request
|
# |
protected
|
EventHandler|null
|
$dispatcher
|
# |
protected
|
Application|null
|
$app
|
# |


Chasing a Cunning Android bug
Most software bugs are small, pesky problems with an obvious cause and a simple solution. But every once in a while I encounter a bug who is more advanced: a bug that hides in the shadows of other bugs, avoiding detection by its coffee-drinking predator. This week I had the opportunity to stalk an advanced bug that was hiding in the development version of Square Card Reader.
Symptoms
We never saw the bug on Android 4.0 (Ice Cream Sandwich). But it was easy to reproduce on my Android 2.2 (Froyo) test device. Clicking ‘Sign In’ consistently failed with this exception:
java.lang.IllegalStateException: Could not find a method signIn(View) in the
activity class com.squareup.ui.ReaderLandingActivity for onClick handler on
view class android.widget.Button with id 'landing_sign_in_button'
at android.view.View$1.onClick(View.java:2059)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8816)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
Caused by: java.lang.NoSuchMethodException
at java.lang.Class.getDeclaredMethods(Native Method)
at java.lang.ClassCache.getDeclaredPublicMethods(ClassCache.java:166)
at java.lang.ClassCache.getDeclaredMethods(ClassCache.java:179)
at java.lang.ClassCache.findAllMethods(ClassCache.java:249)
at java.lang.ClassCache.getFullListOfMethods(ClassCache.java:223)
at java.lang.ClassCache.getAllPublicMethods(ClassCache.java:204)
at java.lang.Class.getMethod(Class.java:984)
at android.view.View$1.onClick(View.java:2052)
... 11 more
The Android framework was looking for signIn(View)
because we’d registered an onClick
handler in our XML layout:
<Button
android:id="@+id/landing_sign_in_button"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:onClick="signIn"
android:text="@string/sign_in"
/>
But this shouldn’t have failed! We properly declared that method in our ReaderLandingActivity
:
public void signIn(View v) {
startActivity(new Intent(this, ReaderLoginActivity.class));
}
Something was going wrong in Dalvik, Android’s application runtime. It wasn’t seeing a method that I knew was there.
APIs from the future
To share code and structure, all of Square’s activities extend from a common superclass activity. It declares a couple of methods involving types not introduced until Honeycomb:
public final void onActionModeStarted(android.view.ActionMode mode) {
...
}
public final void onActionModeFinished(android.view.ActionMode mode) {
...
}
This is generally okay. As long as we don’t call the method, Dalvik should ignore the missing classes.
Dalvik did bulk reflection back in Froyo
Suppose you’re calling ReaderLandingActivity.class.getMethod("signIn", View.class)
.
- In Ice Cream Sandwich, Dalvik calls some C code that walks through the
.dex
file, finds thesignIn
method, and returns it as aMethod
object. - In Froyo, Dalvik calls some C code that walks through the
.dex
file and finds all methods onReaderLandingActivity
. Then Java takes over and searches for thesignIn
method in that list.
Dalvik did too much class initialization back in Froyo
Just because I’m looking up a method doesn’t mean I’ll ever invoke it. For example, Guice just checks for an annotation and ignores it if unfound. Class initialization is expensive and should be put off until necessary.
But in Froyo, Dalvik eagerly initialized each method’s return type and its parameter types. If any of those types failed to initialize, we have a problem.
Squash the bug
We ask for one method, signIn
. Dalvik loads all methods on ReaderLandingActivity
and its supertypes. That includes onActionModeStarted
, which takes a parameter that didn’t exist on Froyo. Dalvik cannot initialize the missing class so the failure cascades and causes our method lookup to fail.
This was made especially difficult to find because of another bug. When a class fails to initialize during getMethods()
, Dalvik swallows the missing class failure and throws a less useful NoSuchMethodException
.
We worked around the problem by declaring click handlers in code rather than XML. Though it’s more verbose, it also avoids potentially inefficient reflection calls on those devices where reflection is the slowest.
Dalvik has steadily improved in quality and efficiency from release to release. But it means we need to be extra careful when we’re testing and optimizing our code for older devices.
Comments
Get support help at squareup.com/support. We'll delete off-topic comments.


Couchsite Test Suite
By default, our test suite assumes you are using a server on <IP_ADDRESS>:5984
Email address
Password
Login
Run Test Suite
Start Tests
Couchsite Code


How to apply
Choose a course
Do some research before you device on a school or university.
You could:
- ask teachers
- look at training provider websites
- read school Ofsted inspection reports
- compare university courses at discoveruni.gov.uk
- find out how many people finished their course and got a teaching job in the initial teacher training census data
Check the distance
Find out how far away the course is from where you live. Think about how you'll get to the schools you'll need to visit on placement and whether it's possible.
Find a course
Search postgraduate teacher training courses in England.
Write a personal statement
You must include a personal statement to apply for teacher training through UCAS.
Your personal statement is the main part of your application, so write about the knowledge and skills you’ll bring to teaching.
Make sure you get across your energy, enthusiasm and passion for teaching.
What to put in your statement
Include information about:
- why you want to teach
- the skills and strengths you can bring to teaching like communication, organisation and creativity
- why you'll be a good teacher
- the reason you want to teach your chosen subject and age group
Use relevant examples from:
- your education and work experience
- any other experience you have of working with young people
Get two references
You must give two references to apply for teacher training.
Your referees need to comment on:
- your skills
- your personality
- why you would make a good teacher
Contact them before you apply and ask them to reply quickly when UCAS ask for their reference. A delay could mean that you may not get your first choice of training course.
Your referees
If you're still at university you need a reference from both:
a current or recent tutor
someone you have worked for, or another professional
if you have not been in education in the last 5 years, you can give two personal references.
if one of your references is from a school where you have gained school experience or been employed, it must come from the headteacher.
Your references must not be:
- friends
- family
- partners
- ex-partners
Apply for teacher training
You can apply via UCAS, or by using a new GOV.UK service called Apply for teacher training. We'll help you choose the service that's right for you.


Inven
tories
Tagless
All owned
[Instill purpose here]
This is a collection name
42
You haven't tagged any games yet.
Build a new collection


| App |
|
| Context |
|
| Depot |
|
| Depot.Attribute |
|
| Depot.Events |
Event declarations.
|
| Depot.Events.Create |
Event implementation for event 'Create'
|
| Depot.Events.Create.Builder |
|
| DepotBehaviour |
|
| EventService |
|
| Order |
|
| Order.Attribute |
|
| Order.Events |
Event declarations.
|
| Order.Events.ArrivedDepot |
Event implementation for event 'Arrived depot'
|
| Order.Events.ArrivedDepot.Builder |
|
| Order.Events.ArrivedFinalDepot |
Event implementation for event 'Arrived final depot'
|
| Order.Events.ArrivedFinalDepot.Builder |
|
| Order.Events.Assign |
Event implementation for event 'Assign'
|
| Order.Events.Assign.Builder |
|
| Order.Events.CouldNotDeliver |
Event implementation for event 'Could not deliver'
|
| Order.Events.CouldNotDeliver.Builder |
|
| Order.Events.Create |
Event implementation for event 'Create'
|
| Order.Events.Create.Builder |
|
| Order.Events.DeliverAgain |
Event implementation for event 'Deliver again'
|
| Order.Events.DeliverAgain.Builder |
|
| Order.Events.Delivered |
Event implementation for event 'Delivered'
|
| Order.Events.Delivered.Builder |
|
| Order.Events.DeliveredByPickup |
Event implementation for event 'Delivered by pickup'
|
| Order.Events.DeliveredByPickup.Builder |
|
| Order.Events.Delivering |
Event implementation for event 'Delivering'
|
| Order.Events.Delivering.Builder |
|
| Order.Events.DeliveryFailed |
Event implementation for event 'Delivery failed'
|
| Order.Events.DeliveryFailed.Builder |
|
| Order.Events.NoMoreAttempts |
Event implementation for event 'No more attempts'
|
| Order.Events.NoMoreAttempts.Builder |
|
| Order.Events.PickedUp |
Event implementation for event 'Picked up'
|
| Order.Events.PickedUp.Builder |
|
| Order.Events.ReturnToSender |
Event implementation for event 'Return to sender'
|
| Order.Events.ReturnToSender.Builder |
|
| Order.Events.Send |
Event implementation for event 'Send'
|
| Order.Events.Send.Builder |
|
| OrderBehaviour |
|
| SystemEvent |
|
| SystemEvent.Attribute |
|
| SystemEvent.Events |
Event declarations.
|
| SystemEvent.Events.Create |
Event implementation for event 'Create'
|
| SystemEvent.Events.Create.Builder |
|
| SystemEvent.Events.NewEvent |
Event implementation for event 'New Event'
|
| SystemEvent.Events.NewEvent.Builder |
|
| SystemEventBehaviour |
|


Commons-IO contains utility classes, endian classes, line iterator, file filters and stream implementations.
For a more detailed descriptions, take a look at the javadocs.
IOUtils contains utility methods dealing with reading, writing and copying. The methods work on InputStream, OutputStream, Reader and Writer.
As an example, consider the task of reading bytes from a URL, and printing them. This would typically done like this:
InputStream in = new URL( "http://jakarta.apache.org" ).openStream(); try { InputStreamReader inR = new InputStreamReader( in ); BufferedReader buf = new BufferedReader( inR ); String line; while ( ( line = buf.readLine() ) != null ) { System.out.println( line ); } } finally { in.close(); }
With the IOUtils class, that could be done with:
InputStream in = new URL( "http://jakarta.apache.org" ).openStream(); try { System.out.println( IOUtils.toString( in ) ); } finally { IOUtils.closeQuietly(in); }
In certain application domains, such IO operations are common, and this class can save a great deal of time. And you can rely on well-tested code.
For utility code such as this, flexibility and speed are of primary importance. However you should also understand the limitations of this approach. Using the above technique to read a 1GB file would result in an attempt to create a 1GB String object!
The FileUtils class contains utility methods for working with File objects. These include reading, writing, copying and comparing files.
For example to read an entire file line by line you could use:
File file = new File("/commons/io/project.properties"); List lines = FileUtils.readLines(file, "UTF-8");
The FilenameUtils class contains utility methods for working with filenames without using File objects. The class aims to be consistent between Unix and Windows, to aid transitions between these environments (such as moving from development to production).
For example to normalize a filename removing double dot segments:
String filename = "C:/commons/io/../lang/project.xml"; String normalized = FilenameUtils.normalize(filename); // result is "C:/commons/lang/project.xml"
The FileSystemUtils class contains utility methods for working with the file system to access functionality not supported by the JDK. Currently, the only method is to get the free space on a drive. Note that this uses the command line, not native code.
For example to find the free space on a drive:
long freeSpace = FileSystemUtils.freeSpace("C:/");
Different computer architectures adopt different conventions for byte ordering. In so-called "Little Endian" architectures (eg Intel), the low-order byte is stored in memory at the lowest address, and subsequent bytes at higher addresses. For "Big Endian" architectures (eg Motorola), the situation is reversed.
There are two classes in this package of relevance:
DataInput
interface. With
this, one can read data from files of non-native Endian-ness.
org.apache.commons.io.LineIterator
class
provides a flexible way for working with a line-based file.
An instance can be created directly, or via factory methods on
FileUtils
or IOUtils
.
The recommended usage pattern is:
LineIterator it = FileUtils.lineIterator(file, "UTF-8"); try { while (it.hasNext()) { String line = it.nextLine(); /// do something with line } } finally { LineIterator.closeQuietly(iterator); }
The org.apache.commons.io.filefilter
package defines an interface
(IOFileFilter)
that combines both java.io.FileFilter
and
java.io.FilenameFilter
. Besides
that the package offers a series of ready-to-use
implementations of the IOFileFilter
interface including
implementation that allow you to combine other such filters.
These filters can be used to list files or in FileDialog, for example.
See the filefilter package javadoc for more details.
The org.apache.commons.io.input
and
org.apache.commons.io.output
packages
contain various useful implementations of streams.
These include:


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/variable.20a.20problem.html ---
This is presumably well-known but it has just bitten one of my undergraduates. They wrote have Ht2 : (a < nat.succ t) → (nat.succ t < c) → (a < c),
in the middle of a tactic proof, with a,t,c nats, and get a type mismatch error: term a has type nat.succ t < c : Prop
. Chris tells me that this is because you can't use have
in a tactic proof with an implies sign and a variable a
. That sounds like a bug to me. Is it officially not a bug though?
Oh, it is https://github.com/leanprover/lean/issues/1822
So we have to wait for the parser refactoring?
Yes
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


Project roles and team
The Castle Project is made of the following roles:
- Committer: have access to the code repository and has binding votes
- PMC Chair: leads the PMC
- PMC Members: vote new committers, oversee the project goals in mid to long terms
- Patch Manager: guarantees that submitted patches will not be forgotten
- Documentation Manager: enforces standards on the documentation
Active members
The following is the list of people actively involved with the Castle Project ordered by the inclusion date.
- hammett/Hamilton Verissimo
- Henry Conceição
- Kevin Williams
- Craig Neuwirt
- Fabio David Batista
- Ayende Rahien
- G. Richard Bellamy
- Roelof Blom
- Josh Robb
- Ernst Naezer
- Fabian Schmied
- Dave Godfrey
- Markus Zywitza
Managers
Patch Manager: Josh Robb
Documentation Manager: hammett
PMC Members
(ordered by the date when joined the PMC)
- hammett/Hamilton Verissimo (Chair)
- Henry Conceição
- Kevin Williams
- Craig Neuwirt
- Ayende Rahien
- Fabio David Batista
- Roelof Blom
- Josh Robb
Emeritus
(no longer active committers)
- Gilles Bayon
- Dan
- Andrew Hallock
- Jason Nelson
- Dru Sellers
- John Morales
- CobraLord
- Tatham Oddie
- Chad Humphries
- Ahmed Ghandour
- Marc-Andre Cournoyer


--- ---
If you like how Windows Explorer and File Manager lets you open documents just by double clicking on them, without opening the associated program first, here's how to achieve similar functionality from your Delphi program:
program ShellExe; uses WinTypes, ShellAPI; procedure OpenObject(sObjectPath: string); begin ShellExecute(0, nil, PChar( sObjectPath ), nil, nil, SW_NORMAL); end; begin OpenObject('c:\my_docs\report.txt'); end.
Now you can open any type of document from your program without knowing which program is associated with it.
Don't forget that web site addresses and other URLs also have programs associated with them. So, if you want to open the default browser to a specific URL, simply call OpenObject() with the absolute URL as follows:
OpenObject('https://www.chami.com/tips/');
You can also use the same function to run executable programs, for example:
OpenObject('notepad.exe');


Twiny Massfollow
You already followed 0 account with this extension
Number to follow:
Time between 2 follow (ms):
Max :
Follow only account with description :
Skip your followers :
Skip protected account :
Skip verified account :
Account minimum followers:
Max (0 = no limit):
Minimum of tweets:
Start mass-follow
Powered by
twinybots


---
layout: post
title: ! 'Next meeting: Tuesday 6 November'
alias: /next-meeting-tuesday-6-november
published: true
---
The next meeting is 6 November (that's tomorrow!), 7pm for 7.30 in the Brewery Tap.
As we didn't get any volunteers to talk this month we'll be having a general Q&A/hacking night – if something Ruby-related is confusing, annoying or intriguing you, come along and ask about it and hopefully someone else will have some experience and might be able to help. Failing that we can all just discuss it randomly and you'll go away even more confused :-)
Also, if you have a bit of code you'd like someone to hack on with you for a bit, bring it along and grab someone.
If all else fails, we can all just have a nice chat over a few beers!
It would be nice to have a couple of talks next month though, so start thinking about what you might be able to present, and I'll be badgering people to put their names down!


Situated on Grand Terre, opposite the clearance port of Dzaoudzi. There is a frequent ferry service between the two ports. Mamoudzou has better shoreside facilities, chandleries/repair service companies etc. however Dzaoudzi is better protected from a berthing point of view.
For full details on clearance go to Mayotte Formalities.
The marina here (see Frederic who is in charge) can organise entry and departure clearance. Weekend clearance is also possible.
The marina here is full of local motorboats, as well as a few sailboats on moorings in the not-so-protected bay, so visitor berthing is unlikely. One can however come alongside for water.
Last updated September 2013.


The Raspberry Pi 3B+ was the leading version of the small yet effective computer system in 2018. While it was not too large a change from the previous Pi 3B, it introduced a number of minor firmware changes that broke support for existing OS images.
Since the current phase of my career features quite a lot of system administration duties, small computers like the Pi make it easy to run simple tasks in a non-containerized environment.
However I was recently dismayed during my attempts to migrate the SD cards from Pi 3B to 3B+ resulted in a litany of errors. In addition, there was no meaningful upgrade path from Ubuntu 16.04 to 18.04 on the Pi since quite a lot of people use the standard Raspian so everything else tends to be out of date.
Understandably, many clients however prefer having the maximum possible compatibility with desktop Ubuntu LTS, so I was forced to do some more digging.
An image of Ubuntu 18.04.2 LTS for the Raspberry Pi 3B exists and can be found here, however, it does not support some minor variants of 3B, notably the 3B+ is not supported.
Looking at the Raspberry Pi spec sheets carefully, I figured since the physical CPU had not changed between 3B and 3B+ that there was no Linux limitation against it working. So I proceeded to write the image to the SD card as per usual:
sudo unxz ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img.xz
sudo dd if=ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img \
of=/dev/sdc bs=4M conv=fsync status=progress
I plugged that into my Pi and, sadly, it was unable to boot. It remained stuck at the rainbow colour palette startup screen. So my guess was the bootloader had failed somehow.
Plugging the SD back into my desktop, I did a lsblk to determine /boot partition location. Then I did a ls to see what what files were present. Mostly firmware blobs and vmlinuz and the infamous config.txt which controls the Pi boot process. So I opened it with vim noticed that kernel was pointing to a uboot file which was not present. Bingo!
Thankfully the Broadcom CPU used in the Pi has been pushed to kernel upstream, which is what Ubuntu LTS relies on, so I could just delete the device_tree_address line used by u-boot and adjust several lines in the config.txt to point to the plain ol' Linux vmlinuz.
kernel=vmlinuz
initramfs initrd.img followkernel
arm_control=0x200
device_tree_address=0x0200000 # -- delete this line --
As an aside, I noticed many of the Raspberry Pi blobs for the other devices were missing. So if you need those, you'll want to obtain them via the official GitHub repo. In my case I only needed the ComputeModule3 blob, which is bcm2710-rpi-cm3.dtb, so I copied that into the boot partition.
With that, my Raspberry Pi 3B+ was able to boot the latest Ubuntu 18.04.2 LTS. Since this is Ubuntu, the normal username and password combo is 'ubuntu' for both, and I was able to login just fine.
Finally, for a 4-core computer with only 1GB of RAM, the commandline use was quite fast and it didn't need more than about 150Mb at any given time. I was able to trim that by quite a bit removing the cloud-init services and got it down to about 110Mb.
Thus I was able to use the humble Raspberry Pi for semi-important business goals and so wraps up this blog post.


I'm a fast learner which allows me to be flexible with my technologies as necessary. I'm looking for internships and other learning opportunities so if you need another team member, feel free to contact me!
Aside from mathematics and computer science, I invest my time in basketball, track & field, weightlifting, chess, drawing and reading.
Projects
Hover for details or click on a project for more information.