Apache Jena implementation of RDF Binary
RDF Thrift has been incorporated into Apache Jena, from version 2.12.1.
Comand line
The riot
command has an output format argument:
riot --out=TRDF data.nt > data.trdf
Graphs and Datasets
Use RDFDataMgr
operations.
Read a graph:
Model m = RDFDataMgr.loadModel("data.trdf") ;
Write a model:
RDFDataMgr.write(System.out, m, Lang.RDFTHRIFT) ;
and other RDFDataMgr
operations.
Reading using RDFDataMgr
is preferred. model.read
operations may not detect
the file syntax.
SPARQL Result Sets
ResultSet resultSet = ResultSetMgr.read(inputStream, ResultSetLang.SPARQLResultSetThrift) ;
ResultSetMgr.write(outputStream, resultSet, ResultSetLang.SPARQLResultSetThrift) ;
Experimentation
If you want to access the code for the Thrift encoding, see the classes:
BinRDF
– the read and write operations.ThriftConvert
– conversion to and from Thrift datastructures.TRDF
– support code for handling Thrift I/O (e.g.TProtocol
).


Galaxy class¶
This will read in a data file for a given galaxy and snap, returning the data in a variety of formats.
-
class
galaxy.galaxy.
Galaxy
(name, snap=0, datadir=None, usesql=False, ptype=None, stride=1)[source]¶ A class to find, read and manipulate files for a single galaxy.
- Args:
- name (str):
short name used in filename of type ‘name_000.txt’, eg ‘MW’, ‘M31’.
- snap (int):
Snap number, equivalent to time elapsed. Zero is starting conditions.
- datadir (str):
Directory to search first for the required file. Optional, and a default list of locations will be searched.
- usesql (bool):
If True, data will be taken from a PostgreSQL database instead of text files.
- ptype (int or list):
Optional. Restrict data to this particle type, for speed. Only valid with usesql=True.
- stride (int):
Optional. For stride=n, get every nth row in the table. Only valid with usesql=True.
- Class attributes:
- filepath (pathlib.Path object):
directory containing the data file
- filename (str):
in name_snap.txt format, something like ‘MW_000.txt’
- data (np.ndarray):
type, mass, position_xyz, velocity_xyz for each particle
-
read_db
(ptype, stride)[source]¶ Get relevant data from a PostgreSQL database and format it to be identical to that read from test files.
- Args:
- ptype (int):
Optional. Restrict data to this particle type.
- stride (int):
Optional. For stride=n, get every nth row in the table.
- Changes:
self.time, self.particle_count and self.data are set.
Returns: nothing
-
get_filepath
(datadir)[source]¶ - Args:
datadir (str): path to search first for the required file
- Returns:
pathlib.Path object. A directory containing the file.
- Raises:
FileNotFoundError
Pretty boring housekeeping code, but may make things more resilient.
-
read_file
()[source]¶ Read in a datafile in np.ndarray format, store in self.data.
- Requires:
self.path and self.filename are already set.
- Changes:
self.time, self.particle_count and self.data are set.
Returns: nothing
-
type2name
(particle_type)[source]¶ Args: particle_type (int): valid values are 1, 2, or 3
Returns: typename (str): ‘DM’, ‘disk’ or ‘bulge’
-
name2type
(typename)[source]¶ Args: typename (str): valid values are ‘DM’, ‘disk’ or ‘bulge’
Returns: particle_type (int): 1, 2, or 3 as used in data files
-
filter_by_type
(particle_type, dataset=None)[source]¶ Subsets the data to a single particle type.
- Args:
particle_type (int): for particles, 1=DM, 2=disk, 3=bulge dataset (array including a type column): defaults to self.data
- Kwargs:
dataset (np.ndarray): optionally, a starting dataset other than self.data
Returns: np.ndarray: subset data
-
single_particle_properties
(particle_type=None, particle_num=0)[source]¶ Calculates distance from the origin and magnitude of the velocity.
- Kwargs:
- particle_type (int):
a subset of the data filtered by 1=DM, 2=disk, 3=bulge
- particle_num (int):
zero-based index to an array of particles
- returns:
- 3-tuple of
Euclidean distance from origin (kpc), Euclidean velocity magnitude (km/s), particle mass (M_sun)
-
all_particle_properties
(particle_type=None, as_table=True)[source]¶ Calculates distances from the origin and magnitude of the velocities for all particles (default) or a specied particle type.
- Kwargs:
- particle_type (int):
A subset of the data filtered by 1=DM, 2=disk, 3=bulge
- as_table (boolean): Return type.
If True, an astropy QTable with units. If False, np.ndarrays for position and velocity
- Returns:
QTable: The full list, optionally with units, optionally filtered by type.
-
component_count
(particle_type=None)[source]¶ - Kwargs: particle_type (int):
a subset of the data filtered by 1=DM, 2=disk, 3=bulge
- Returns: Quantity:
The number of particles in the galaxy of this type
-
all_component_counts
()[source]¶ - Returns: list:
The number of particles of each type in the galaxy Ordered as [halo, disk, bulge]
-
component_mass
(particle_type=None)[source]¶ - Kwargs: particle_type (int):
a subset of the data filtered by 1=DM, 2=disk, 3=bulge
- Returns: Quantity:
The aggregate mass of all particles in the galaxy of this type
-
all_component_masses
()[source]¶ - Returns: list:
The aggregate masses of particles of each type in the galaxy


This app creates a controller that makes calls to an API server, retrieving data from a MongoDB collection. The controller stores a list of collection items and presents views to retrieve and delete items, and validating forms to add and edit items. For this stock example, d3 is used to present 5-year price data.
GitHub Repo


?
Is this the item you were looking for? Add it to your cart
Men's Dress Pants
Macy's
Sizes: S-XXL
Sale $99.99
URL: https://www.macys.com/
Add to Cart
Previous Page


Here, we'll deal with global properties and configuration, but first, we must review what exactly this page does differently from regular HTML.
Firstly, this is a Single Page Application, which means it won't reload every time we enter another page. It will instead load sections via AJAX. Furthermore, the header and the navigation bar are unaffected by following different sections.
The main feature this page has would be the user data, that is persistent throughout the whole page. The panel on the header, the user edit page and the cool page all share this same data. This data should remain even after you exit the page.
To start, after including the AngularJS script (via


{% extends "admin/layout.html" %} {% block title %}{{ _("Cache Options") }}{% endblock %} {% block contents %}
{% trans %} pyClanSphere comes with a cache system that allows you to survive a sudden storm of visitors. The caching system has different backends you can choose from and also different settings that you should set depending on the type of server you have and the number of visitors. {% endtrans %}
{% trans %} Keep in mind that if caching is enabled templates will be cached too and as a result of that, they are not reloaded. If you are trying to develop plugins it might be a good idea to disable all caching. {% endtrans %}
{{ _("Currently pyClanSphere supports three caching systems:") }}
{% trans %}Per default no cache system is active.{% endtrans %}
{{ form.cache_system() }}
{% trans %} In order to use the memcached system you have to provide the address of at least one machine running memcached. For further details have a look at the memcached webpage. Separate multiple addresses with commas. This also requires either the cmemcache or python-memcached module. {% endtrans %}
{% trans %}
If you for example have a memcached running on localhost (<IP_ADDRESS>)
port 11211 you would have to enter <IP_ADDRESS>:11211
into
the following text field.
{% endtrans %}
{{ form.memcached_servers(size=60) }}
{% trans %} When using the filesystem cache you can control where pyClanSphere puts all the cache data. This path is relative to your pyClanSphere instance folder and will be created automatically by pyClanSphere. Keep in mind that if you change that path and old cache data is left in the old folder, pyClanSphere won't clean up the data left for you. {% endtrans %}
{% trans %}
One thing you have to keep in mind is that the cache path must
be a directory that only pyClanSphere uses for file management. The
pyClanSphere code cleans up there from time to time and it could delete
files that are otherwise not tracked by pyClanSphere. This is especially
the case if you try to cache into /tmp
or a similar
folder that all kinds of applications use for storing temporary files.
{% endtrans %}
{{ form.filesystem_cache_path(size=40) }}
{% trans %} The following configuration values are cache system-independent. You can use them to fine-tune the caching. The timeout is the number of seconds an item is cached per default. Some items have different cache timeouts though. If “eager caching” is enabled the cache system will cache a lot more but it will have visible side-effects. {% endtrans %}


Book Description
Enterprise Java developers must achieve broader, deeper test coverage, going beyond unit testing to implement functional and integration testing with systematic acceptance. Next Generation Java Testing introduces breakthrough Java testing techniques and TestNG, a powerful open source Java testing platform.
Cédric Beust, TestNG's creator, and leading Java developer Hani Suleiman, present powerful, flexible testing patterns that will work with virtually any testing tool, framework, or language. They show how to leverage key Java platform improvements designed to facilitate effective testing, such as dependency injection and mock objects. They also thoroughly introduce TestNG, demonstrating how it overcomes the limitations of older frameworks and enables new techniques, making it far easier to test today's complex software systems.
Pragmatic and results-focused, Next Generation Java Testing will help Java developers build more robust! code for today's mission-critical environments.
This book
Whether you use TestNG, JUnit, or another testing framework, the ! testing design patterns presented in this book will show you how to im prove your tests by giving you concrete advice on how to make your code and your design more testable.
Cédric Beust, a senior software engineer at Google, is an active member of the Java Community Process who has been extensively involved in the development of the latest Java release. He is the creator and main contributor to the TestNG project.
Hani Suleiman is CTO of Formicary, a consulting and portal company specializing in financial applications. He is one of two individual members who has been elected to the Executive Committee of the Java Community Process.


That Landers Life was built on a Django platform. It features a travel blog, photo gallery comprised using JavaScript and Bootstrap. The main feature of the site is the 'Donation' page. The page is an ECommerce backend with set donation amount. It gives the viewer the option to pay by card or login to their Stripe account.
This project was a fun project Bryce created using a D3 database with a Flask Backend. The data was retrieved online and stored in MySQL database. Once the information was scrubbed and cleanned up, I created various charts to reflect Sales by year, Sales by Publisher, Sales by Platform and the overall sales throughout video games lifetime. The charts are all interactive and entertaining compare your favorite Video Games, Genre, Publisher, or Platform. Once on the site, locate the 'Start Tour' button for more information.
Peter's site is a bit different from the rest. His site was created on WordPress using a custom made template, PHP and several plugins. Peter intrust me to not only create his site but manage it as well. He gave me full responsiblity to host, design, build, and maintain his political landing page.
Allied Internet Marketing didn't start off and Bryce's site. A client approached him very frustrated and overwhelmed with the site and process. Allied Internet Marketing's ower approached Bryce after a third party company failed to finish the site. Bryce stepped in and finished the remainded of the site, tying in his style to the design that was already in-place.


Insert tab content items to create tabs in a Tab Set with additional Allowed Component options.
The Tab Content component is comprised of a tab title and tab body. Additional Allowed Components can be placed within the tab body.
Enter the tab title as text — entry here is rendered h3
in the panel-title
section.
Enter tab body text — entry here is rendered in the panel-body
section.
Note that this item uses the Rich Text (RTE) editor so additional HTML can be entered.
Add additional Allowed Components — classes here will be relevant to the placed components.
To navigation between tab content items, click on the area surround the title but not in the title area.
See Tab Set for samples. Additional Components placed within tab content will rely on its component classes.


{% extends 'main.html' %} {% block extraheader %} {% load filtering_tags_book %} {% endblock %} {% block content %}
You can join now to join thousands of enthusiasts in rating and viewing information about your favourite books and authors


Copyright 2015 Qualcomm Technologies International, Ltd.
Bluetooth Low Energy CSRmesh 2.0
CSRmesh™ is a product of Qualcomm Technologies International Ltd.
Functions | |
| CSRmeshResult | AttentionModelClientInit (CSRMESH_MODEL_CALLBACK_T app_callback) |
| Initialises Attention Model Client functionality. More... | |
| CSRmeshResult | AttentionSetState (CsrUint8 nw_id, CsrUint16 dest_id, CSRMESH_ATTENTION_SET_STATE_T *p_params) |
| Setting Flashing State: Upon receiving an ATTENTION_SET_STATE message, the device saves the AttractAttention and AttentionDuration fields into the appropriate state value. It then responds with an ATTENTION_STATE message with the current state information. If the AttractAttention field is set to 0x01 and the AttentionDuration is not 0xFFFF, then any existing attention timer is cancelled and a new attention timer is started that will expire after AttentionDuration milliseconds. If the AttractAttention field is set to 0x01 and the AttentionDuration field is 0xFFFF, then the attention timer is ignored. If the AttractAttention field is set to 0x00, then the attention timer is cancelled if it is already running. More... | |
| CSRmeshResult AttentionModelClientInit | ( | CSRMESH_MODEL_CALLBACK_T | app_callback | ) |
| app_callback | Pointer to the application callback function that will be called when the model client receives a message. |
| CSRmeshResult AttentionSetState | ( | CsrUint8 | nw_id, |
| CsrUint16 | dest_id, | ||
| CSRMESH_ATTENTION_SET_STATE_T * | p_params | ||
| ) |
This function packs the given parameters into a CSRmesh message and sends it over the network. When a response is received the application callback function is called to notify the CSRMESH_ATTENTION_STATE
| nw_id | Network identifier over which the message has to be sent. |
| dest_id | 16-bit identifier of the destination device/group |
| p_params | Pointer to the message parameters of type CSRMESH_ATTENTION_SET_STATE_T |


Frame control struct. More...
Data Fields | |
| struct win_window * | container |
| Container, ultimate widget parent. | |
| struct win_window * | contents |
| Contents, holds child widgets. | |
| struct win_window * | resize |
| The resize handle window. | |
| char * | caption |
| Copy of caption string. | |
| enum wtk_frame_state | state |
| Current state. | |
| wtk_frame_handler_t | frame_handler |
| Frame command event handler. | |
| void * | custom_data |
| Data for applications and handlers. |
Frame control struct.
This is the frame control struct. It contains references to the windows composing the frame, as well as non-window information required.
For internal use only.
Definition at line 132 of file wtk_frame.c.
| char* wtk_frame::caption |
Copy of caption string.
Definition at line 140 of file wtk_frame.c.
Referenced by wtk_frame_create(), and wtk_frame_handler().
| struct win_window* wtk_frame::container |
Container, ultimate widget parent.
Definition at line 134 of file wtk_frame.c.
Referenced by wtk_frame_as_child(), wtk_frame_create(), wtk_frame_handler(), wtk_handle_frame_press(), wtk_handle_frame_release(), and wtk_resize_frame().
| struct win_window* wtk_frame::contents |
Contents, holds child widgets.
Definition at line 136 of file wtk_frame.c.
Referenced by wtk_frame_as_parent(), wtk_frame_create(), wtk_handle_resize_release(), and wtk_resize_frame().
| void* wtk_frame::custom_data |
Data for applications and handlers.
Definition at line 147 of file wtk_frame.c.
Referenced by wtk_frame_create(), and wtk_frame_get_custom_data().
Frame command event handler.
Definition at line 145 of file wtk_frame.c.
Referenced by wtk_frame_create(), and wtk_frame_handler().
| struct win_window* wtk_frame::resize |
The resize handle window.
Definition at line 138 of file wtk_frame.c.
Referenced by wtk_frame_create(), wtk_frame_handler(), wtk_handle_resize_press(), and wtk_resize_frame().
Current state.
Definition at line 142 of file wtk_frame.c.
Referenced by wtk_frame_create(), wtk_handle_frame_move(), wtk_handle_frame_press(), wtk_handle_frame_release(), wtk_handle_resize_move(), wtk_handle_resize_press(), and wtk_handle_resize_release().


It is often necessary to protect important notes in order to prevent them from being accessed by others, but text editors that offer encryption features are sometimes too complex for users who just want a secure Notepad alternative. Crypto Notepad stands out through its relatively simple design, as it looks very similar to the standard Windows Notepad. It offers a few extra features, such as encryption and a customizable UI, but it remains lightweight and very easy to use.
Crypto Notepad allows you to create secure notes using AES algorithms, able to customize different parameters of the encryption, such as: hash algorithm, key size, password iterations.
Crypto Notepad, besides the main features of the default Windows Notepad, also supports drag and drop, url detection, associate own file type with application, integrate with windows context menu.
Crypto Notepad is an open source project. It will always remain free and ad-free. If you're asked to pay for "full version" or "ad removal", most probably it's a scam.
Crypto Notepad can be run from any location without being installed on your PC beforehand. For example, you can place it on a portable storage device and use it to create secure notes on the go.


In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementation of the neural network up to you (for the most part). After you've submitted this project, feel free to explore the data and the model more.
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
A critical step in working with neural networks is preparing the data correctly. Variables on different scales make it difficult for the network to efficiently learn the correct weights. Below, we've written the code to load and prepare the data. You'll learn more about this soon!
data_path = 'Bike-Sharing-Dataset/hour.csv'
rides = pd.read_csv(data_path)
rides.head()
This dataset has the number of riders for each hour of each day from January 1 2011 to December 31 2012. The number of riders is split between casual and registered, summed up in the cnt
column. You can see the first few rows of the data above.
Below is a plot showing the number of bike riders over the first 10 days or so in the data set. (Some days don't have exactly 24 entries in the data set, so it's not exactly 10 days.) You can see the hourly rentals here. This data is pretty complicated! The weekends have lower over all ridership and there are spikes when people are biking to and from work during the week. Looking at the data above, we also have information about temperature, humidity, and windspeed, all of these likely affecting the number of riders. You'll be trying to capture all this with your model.
rides[:24*10].plot(x='dteday', y='cnt')
Here we have some categorical variables like season, weather, month. To include these in our model, we'll need to make binary dummy variables. This is simple to do with Pandas thanks to get_dummies()
.
dummy_fields = ['season', 'weathersit', 'mnth', 'hr', 'weekday']
for each in dummy_fields:
dummies = pd.get_dummies(rides[each], prefix=each, drop_first=False)
rides = pd.concat([rides, dummies], axis=1)
fields_to_drop = ['instant', 'dteday', 'season', 'weathersit',
'weekday', 'atemp', 'mnth', 'workingday', 'hr']
data = rides.drop(fields_to_drop, axis=1)
data.head()
To make training the network easier, we'll standardize each of the continuous variables. That is, we'll shift and scale the variables such that they have zero mean and a standard deviation of 1.
The scaling factors are saved so we can go backwards when we use the network for predictions.
quant_features = ['casual', 'registered', 'cnt', 'temp', 'hum', 'windspeed']
# Store scalings in a dictionary so we can convert back later
scaled_features = {}
for each in quant_features:
mean, std = data[each].mean(), data[each].std()
scaled_features[each] = [mean, std]
data.loc[:, each] = (data[each] - mean)/std
We'll save the data for the last approximately 21 days to use as a test set after we've trained the network. We'll use this set to make predictions and compare them with the actual number of riders.
# Save data for approximately the last 21 days
test_data = data[-21*24:]
# Now remove the test data from the data set
data = data[:-21*24]
# Separate the data into features and targets
target_fields = ['cnt', 'casual', 'registered']
features, targets = data.drop(target_fields, axis=1), data[target_fields]
test_features, test_targets = test_data.drop(target_fields, axis=1), test_data[target_fields]
We'll split the data into two sets, one for training and one for validating as the network is being trained. Since this is time series data, we'll train on historical data, then try to predict on future data (the validation set).
# Hold out the last 60 days or so of the remaining data as a validation set
train_features, train_targets = features[:-60*24], targets[:-60*24]
val_features, val_targets = features[-60*24:], targets[-60*24:]
Below you'll build your network. We've built out the structure and the backwards pass. You'll implement the forward pass through the network. You'll also set the hyperparameters: the learning rate, the number of hidden units, and the number of training passes.
The network has two layers, a hidden layer and an output layer. The hidden layer will use the sigmoid function for activations. The output layer has only one node and is used for the regression, the output of the node is the same as the input of the node. That is, the activation function is $f(x)=x$. A function that takes the input signal and generates an output signal, but takes into account the threshold, is called an activation function. We work through each layer of our network calculating the outputs for each neuron. All of the outputs from one layer become inputs to the neurons on the next layer. This process is called forward propagation.
We use the weights to propagate signals forward from the input to the output layers in a neural network. We use the weights to also propagate error backwards from the output back into the network to update our weights. This is called backpropagation.
Hint: You'll need the derivative of the output activation function ($f(x) = x$) for the backpropagation implementation. If you aren't familiar with calculus, this function is equivalent to the equation $y = x$. What is the slope of that equation? That is the derivative of $f(x)$.
Below, you have these tasks:
self.activation_function
in __init__
to your sigmoid function.train
method.train
method, including calculating the output error.run
method.class NeuralNetwork(object):
def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate):
# Set number of nodes in input, hidden and output layers.
self.input_nodes = input_nodes
self.hidden_nodes = hidden_nodes
self.output_nodes = output_nodes
# Initialize weights
self.weights_input_to_hidden = np.random.normal(0.0, self.input_nodes**-0.5,
(self.input_nodes, self.hidden_nodes))
self.weights_hidden_to_output = np.random.normal(0.0, self.hidden_nodes**-0.5,
(self.hidden_nodes, self.output_nodes))
self.lr = learning_rate
#### TODO: Set self.activation_function to your implemented sigmoid function ####
#
# Note: in Python, you can define a function with a lambda expression,
# as shown below.
self.activation_function = lambda x : 1/(1+np.exp(-x)) # Replace 0 with your sigmoid calculation.
### If the lambda code above is not something you're familiar with,
# You can uncomment out the following three lines and put your
# implementation there instead.
#
#def sigmoid(x):
# return 0 # Replace 0 with your sigmoid calculation here
#self.activation_function = sigmoid
def train(self, features, targets):
''' Train the network on batch of features and targets.
Arguments
---------
features: 2D array, each row is one data record, each column is a feature
targets: 1D array of target values
'''
n_records = features.shape[0]
delta_weights_i_h = np.zeros(self.weights_input_to_hidden.shape)
delta_weights_h_o = np.zeros(self.weights_hidden_to_output.shape)
for X, y in zip(features, targets):
#### Implement the forward pass here ####
### Forward pass ###
# TODO: Hidden layer - Replace these values with your calculations.
hidden_inputs = np.dot(X,self.weights_input_to_hidden) # signals into hidden layer
hidden_outputs = self.activation_function(hidden_inputs)# signals from hidden layer
# TODO: Output layer - Replace these values with your calculations.
final_inputs = np.dot(hidden_outputs,self.weights_hidden_to_output) # signals into final output layer
#as it is a regression and not a classification we don't apply our activation function
final_outputs = final_inputs
#### Implement the backward pass here ####
### Backward pass ###
error = y - final_outputs # Output layer error is the difference between desired target and actual output.
output_error_term = error # because we have not applied activation function we don't have to take its gradient.
# TODO: Calculate the hidden layer's contribution to the error
hidden_error = np.dot(self.weights_hidden_to_output,output_error_term.reshape(-1,1)).T
# TODO: Backpropagated error terms - Replace these values with your calculations.
hidden_error_term = hidden_error * hidden_outputs * (1 - hidden_outputs)
# Weight step (input to hidden)
delta_weights_i_h += np.dot(X.reshape(-1,1),hidden_error_term.reshape(1,-1))
# Weight step (hidden to output)
delta_weights_h_o += np.dot(hidden_outputs.reshape(-1,1),output_error_term.reshape(1,-1))
# TODO: Update the weights - Replace these values with your calculations.
self.weights_hidden_to_output += self.lr * delta_weights_h_o / n_records # update hidden-to-output weights with gradient descent step
self.weights_input_to_hidden += self.lr * delta_weights_i_h / n_records # update input-to-hidden weights with gradient descent step
def run(self, features):
''' Run a forward pass through the network with input features
Arguments
---------
features: 1D array of feature values
'''
#### Implement the forward pass here ####
# TODO: Hidden layer - replace these values with the appropriate calculations.
hidden_inputs = np.dot(features,self.weights_input_to_hidden) # signals into hidden layer
hidden_outputs = self.activation_function(hidden_inputs) # signals from hidden layer
# TODO: Output layer - Replace these values with the appropriate calculations.
final_inputs = np.dot(hidden_outputs,self.weights_hidden_to_output) # signals into final output layer
#as it is a regression and not a classification we don't apply our activation function
final_outputs = final_inputs # signals from final output layer
return final_outputs
def MSE(y, Y):
return np.mean((y-Y)**2)
import pdb
Run these unit tests to check the correctness of your network implementation. This will help you be sure your network was implemented correctly befor you starting trying to train it. These tests must all be successful to pass the project.
import unittest
inputs = np.array([[0.5, -0.2, 0.1]])
targets = np.array([[0.4]])
test_w_i_h = np.array([[0.1, -0.2],
[0.4, 0.5],
[-0.3, 0.2]])
test_w_h_o = np.array([[0.3],
[-0.1]])
class TestMethods(unittest.TestCase):
##########
# Unit tests for data loading
##########
def test_data_path(self):
# Test that file path to dataset has been unaltered
self.assertTrue(data_path.lower() == 'bike-sharing-dataset/hour.csv')
def test_data_loaded(self):
# Test that data frame loaded
self.assertTrue(isinstance(rides, pd.DataFrame))
##########
# Unit tests for network functionality
##########
def test_activation(self):
network = NeuralNetwork(3, 2, 1, 0.5)
# Test that the activation function is a sigmoid
self.assertTrue(np.all(network.activation_function(0.5) == 1/(1+np.exp(-0.5))))
def test_train(self):
# Test that weights are updated correctly on training
network = NeuralNetwork(3, 2, 1, 0.5)
network.weights_input_to_hidden = test_w_i_h.copy()
network.weights_hidden_to_output = test_w_h_o.copy()
network.train(inputs, targets)
print(network.weights_hidden_to_output)
self.assertTrue(np.allclose(network.weights_hidden_to_output,
np.array([[ 0.37275328],
[-0.03172939]])))
self.assertTrue(np.allclose(network.weights_input_to_hidden,
np.array([[ 0.10562014, -0.20185996],
[0.39775194, 0.50074398],
[-0.29887597, 0.19962801]])))
def test_run(self):
# Test correctness of run method
network = NeuralNetwork(3, 2, 1, 0.5)
network.weights_input_to_hidden = test_w_i_h.copy()
network.weights_hidden_to_output = test_w_h_o.copy()
self.assertTrue(np.allclose(network.run(inputs), 0.09998924))
suite = unittest.TestLoader().loadTestsFromModule(TestMethods())
unittest.TextTestRunner().run(suite)
Here you'll set the hyperparameters for the network. The strategy here is to find hyperparameters such that the error on the training set is low, but you're not overfitting to the data. If you train the network too long or have too many hidden nodes, it can become overly specific to the training set and will fail to generalize to the validation set. That is, the loss on the validation set will start increasing as the training set loss drops.
You'll also be using a method know as Stochastic Gradient Descent (SGD) to train the network. The idea is that for each training pass, you grab a random sample of the data instead of using the whole data set. You use many more training passes than with normal gradient descent, but each pass is much faster. This ends up training the network more efficiently. You'll learn more about SGD later.
This is the number of batches of samples from the training data we'll use to train the network. The more iterations you use, the better the model will fit the data. However, if you use too many iterations, then the model with not generalize well to other data, this is called overfitting. You want to find a number here where the network has a low training loss, and the validation loss is at a minimum. As you start overfitting, you'll see the training loss continue to decrease while the validation loss starts to increase.
This scales the size of weight updates. If this is too big, the weights tend to explode and the network fails to fit the data. A good choice to start at is 0.1. If the network has problems fitting the data, try reducing the learning rate. Note that the lower the learning rate, the smaller the steps are in the weight updates and the longer it takes for the neural network to converge.
The more hidden nodes you have, the more accurate predictions the model will make. Try a few different numbers and see how it affects the performance. You can look at the losses dictionary for a metric of the network performance. If the number of hidden units is too low, then the model won't have enough space to learn and if it is too high there are too many options for the direction that the learning can take. The trick here is to find the right balance in number of hidden units you choose.
import sys
#this fonction returns the best network, in terms of performance on the validation set (not the last one)
#so even if the number of iteration is too high this is not an issue.
def test_configuration(iterations,learning_rate,hidden_nodes):
output_nodes = 1
N_i = train_features.shape[1]
network = NeuralNetwork(N_i, hidden_nodes, output_nodes, learning_rate)
losses = {'train':[], 'validation':[]}
best_val_loss=1
for ii in range(iterations):
# Go through a random batch of 128 records from the training data set
batch = np.random.choice(train_features.index, size=128)
X, y = train_features.ix[batch].values, train_targets.ix[batch]['cnt']
network.train(X, y)
# Printing out the training progress
train_loss = MSE(network.run(train_features).T, train_targets['cnt'].values)
val_loss = MSE(network.run(val_features).T, val_targets['cnt'].values)
sys.stdout.write("\rProgress: {:2.1f}".format(100 * ii/float(iterations)) \
+ "% ... Training loss: " + str(train_loss)[:5] \
+ " ... Validation loss: " + str(val_loss)[:5])
sys.stdout.flush()
losses['train'].append(train_loss)
losses['validation'].append(val_loss)
if (ii==0 or val_loss<best_val_loss):
best_network=network
best_val_loss=val_loss
return(best_network,losses)
#after some experimentation it seems that learning_rate=0.05 si small enough and 40000 is enough for a first pass.
#we experiment various values for hidden_nodes to find the best one.
all_results=[]
iterations=40000
learning_rate=0.05
for hidden_nodes in (list(range(2,10))+list(range(10,20,2))+list(range(20,50,5))):
print("\nEvaluating performances for ",hidden_nodes," hidden nodes")
(network,losses)=test_configuration(iterations,learning_rate,hidden_nodes)
all_results.append((iterations,learning_rate,hidden_nodes,min(losses['train']),min(losses['validation'])))
all_results
#now that we have established that 6 nodes provides the best performance on the validation set, we try with more iterations
#again, there is not risk of overfitting because the network which is returned is the best, not the last.
(network,losses)=test_configuration(100000,0.05,6)
#here is the performance of our best network
min(losses['validation'])
#we can see that it is not as good as in the hidden layer size search (previous experiment).
#This shows that there is a part of random is the performance of the learning.
#The random comes from the initialization and the stocastic gradient descent. Sometimes we are probably trapped into local minima.
#the best number was reach after this number of iterations:
losses['validation'].index(min(losses['validation']))
plt.plot(losses['train'], label='Training loss')
plt.plot(losses['validation'], label='Validation loss')
plt.legend()
_ = plt.ylim()
Here, use the test data to view how well your network is modeling the data. If something is completely wrong here, make sure each step in your network is implemented correctly.
fig, ax = plt.subplots(figsize=(8,4))
mean, std = scaled_features['cnt']
predictions = network.run(test_features).T*std + mean
ax.plot(predictions[0], label='Prediction')
ax.plot((test_targets['cnt']*std + mean).values, label='Data')
ax.set_xlim(right=len(predictions))
ax.legend()
dates = pd.to_datetime(rides.ix[test_data.index]['dteday'])
dates = dates.apply(lambda d: d.strftime('%b %d'))
ax.set_xticks(np.arange(len(dates))[12::24])
_ = ax.set_xticklabels(dates[12::24], rotation=45)
Answer these questions about your results. How well does the model predict the data? Where does it fail? Why does it fail where it does?
Note: You can edit the text in this cell by double clicking on it. When you want to render the text, press control + enter
The model predictions are reasonably good. As we can see in the last graph, they start to fail on the 22nd of December.
That is easy to explain: bike rental is clearly correlated with the fact that christmad holidays are starting. But this information, which is obvious to the reader, does not explicitely appear in the training set. The dataset does include christmas holidays but there are no features specific to these holidays and no way for the model to learn a difference between these holidays and the rest of the year.
One way to solve this issue would be to add a "holiday" or maybe "christmas holiday" flag. Without specific flag, we might implement more sophisticated approach for seasonality management.


The Bastille Crack
Current Temperature:
{{routesCtrl.weather.currently.temperature}}°
Chance of Precipitation:
{{routesCtrl.weather.currently.precipProbability}}%
Daily Forecast:
{{routesCtrl.weather.hourly.summary}}
Difficulty:
{{routesCtrl.routeInfo[28].original}}
Pitches:
{{routesCtrl.routeInfo[28].pitches}}
Gear:
{{routesCtrl.routeInfo[28].protection}}
Base of Route:
{{routesCtrl.routeInfo[28].coordinates}}
Route Description:
{{routesCtrl.routeInfo[28].description}}


--- layout: default title: "Talks" ---
I speak at conferences and meetups. Well, sometimes at least. And it is fun. Here's what it looks like.
To be announced...
The second ngDuo talk of all time happened at the first official european Angular conference ngEurope. In this talk we showed the people what Web Components are and how they can be integrated with the Angular of today (1.3.x), what issues can occur and how the Angular of tomorrow (2.x) will solve these problems. It was a blast!
Hello Istanbul! Another great conference but this time in beautiful Istanbul. I gave a deep introduction to native Web Components technologies and how they are compared to libraries like Polymer and X-Tag.
First german conference I gave a talk at. In this session I dug deeper into the E2E part of Full Spectrum Testing. Loads of live demos with Protractor.
New conference, new experience. This time I was honoured to speak together with the awesome Carmen Popoviciu about several testing approaches for AngularJS based applications.
A follow up talk of my Kod.io talk "AngularJS and i18n". Basically the same slide deck but slightly changed.
First conference talk ever! Actually have to thank Pete Bacon Darwin for making it possible. This opportunity was a key experience in my life.
My very first international experience when it comes to speaking. This was also my first official talk about the angular-translate project.
Yeap, I played with it a looong time before it was cool. In this talk I showed how Polymer will help to change the way we'll build web applications in the future.
My second talk about AngularJS. This time about mastering Angular directives. I mainly showed what directives are, why they are powerful and how to implement them.
My very first talk about AngularJS. In this talk I gave a lot of insights on how Angular is actually working and what happens behind the scenes.


{% extends "layout.html" %} {% block content %}
Hi there! Could you do us a favor and pick out which of these videos plays for you? Don't worry if they don't all work perfectly - we expect some to fail. After watching a video that works, please check the box underneath it. You don't have to watch all of them all the way through, but it would be great if you tried to watch at least one of them all the way through. Thanks!
Warning: unless otherwise noted, all of these have audio. If you see one without audio, that means it's broken and you shouldn't check the box.
{% endblock %}


A minimal kernel provides
interrupt handlers, a mechanism for starting and stopping processes, a scheduler,
and interprocess communication. Logically, server and driver processes are structured into three layers, although they all are user-mode processes as seen by the kernel. The lowest level contains device drivers. Above this layer are the server processes - VFS server, underlying file system implementations, process server, reincarnation server etc. On top of these servers come the ordinary user processes including shells, compilers, utilities and application programs.
Minix 3.2 is different from earlier versions in Minix 3 in the design of the file system and its dealing with related system calls. A Virtual file system is added as a layer between user library and the minix file system for the purpose of abstraction and uniform implemetation. Visit the official website for further information.
Reference : http://www.minix3.org/


A problem occurred, ensure the API token is set in
options
.
Task Title:
Schedule a task for:
Today
Tomorrow
Plan:
This Week
Next Week
This Month
Next Month
Set time estimate:
5m
10m
15m
30m
45m
1h
1h30m
2h
Set priority:
⭐
⭐⭐
⭐⭐⭐
Set reward points:
$1
$2
$3
$4
$5
Create Item
Options
New task added successfully.
Open Marvin


MPlayerX
MPlayerX is an alternative media player powered by ffmpeg and mplayer.
MPlayerX is an alternative media player powered by ffmpeg and mplayer.
SiteSucker is an Macintosh application that automatically downloads Web sites from the Internet.
Following the acclaimed Audirvana Plus versions, specially the one including Direct Mode and Integer Mode, Audirvana Plus is now offering a full featured library manager that can scale up to more than 100,000 tracks。
MPlayerX is an alternative media player powered by ffmpeg and mplayer.


Here is a collection of all of the work that I am most proud of.
Click or tap the titles for more information.
Escape Amnesia Manor is a dark, thrilling, and thought provoking 2D escape the room game. As with most escape the room games, the player will follow a breadcrumb trail of clues that leads to the discovery of riddles, keys, codes, and eventually, the unlocking of the final door to freedom. Escape Amnesia Manor has a strong emphasis on writing and world design, forcing you to think outside the room. Will you make it out and reach the goal?
As Lead Designer, I created the workings of Eascape Amnesia Manor. I wrote the story and designed gameplay.
I worked as a programmer for part of the project also. I helped to implement the drawing of objects to the screen.
I was the artist on hand for the project. With great dirrection from the art dirrector I was able to nail the style and mood.
I created sounds and music to immerse the player in the world. the spooky vibe is set immediatly with a classic organ chord.
This project is an updated take on the classic arcade game, Asteroids. I worked on this project as an exersice in programming ability and artistic dirrection.
I worked with C# in Unity to recreate the spaceship behaviors of the original Asteroids
I created the pixel art to convey a fresh, yet retro, space theme.
I created the music to give action and excitement to the loney travelers of the cosmos
Originally created under the codename FOD20, GotOW is a total conversion/ expansion of Wizards of the Coast's Dungeons & Dragons 5th Edition. The system was built from the ground up to bring Bethesda Game Studio's Fallout franchise to the table top roleplaying game genre. Its still in development, but you are welcome to take an early sneak peek
I worked tirelessly to create a rich apocalyptic experience based on Fallout in the D&D 5th Edition SRD. I reworked Fallouts perk system to work more like 5e Feats and reworked the way characters interact with the world via Skills
I am in the process of laying out my content into a professional quality PDF complete with custom art, graphics, and a whitty narrator. I am using Adobe InDesign to layout GotOW
I made music for my D&D campaign. I experimented with orchestral instruments and synths to provide some cosmic post fantasy vibes.
My goal with Tales from K'trell was to create an audio experience for the players of my 5th Edition campaign. I wanted to convey mystery, tension, and epic vibes throughout the entire campaign using the tracks on this album.
This is a pixel painter web application. Me and a partner worked on this project to test our skills with JavaScript. Made by Professor Tony Jefferson's IGME 230 Web Design and Implementation. Free to use share or modify with proper citation of the source material.
I worked with a partner to design a web based pixel art tool. I was responsible for crafting the visual design of the site
My work on the local storage system allowed me to realy strech my muscles as i was learning Javascript. I also worked with my partner to develop the color swatches and hex color system
This project is meant to recreate the drama of the 1940s and bring film noir to the modern age. A team of five 3D modelers, including myself, have set up the office of The Silver Bullet, a private investigator from the inner city. You will be able to explore his office as he's off trying to take matters into his own hands. He’s a loose cannon but he’ll get the job done.
As lead designer I designed the office layout and developed the theme for the overall level
I also worked as a modeler for the level creating objects like the ashtray, blinds, clock, and door. I created each object from scratch then UV'd and textured each.
In Project IPRE a partner and I created a 2D game in the format of a non traditional shoot 'em up game with heavy influences from space and sci-fi genres. The player is piloting a crew through the cosmos and must fight to outrun The Hunger before it consumes The Starblaster and ends thier research of the great beyond.
We chose to design this game as "a shoot'em up without the shooting." Making it more of a runner. we choose this to stay faithful to the source material, The McElroy Brother's, The Adventure Zone: Balance
I worked to create the livly enemy we know as The Hunger. I also implemented the alert system and score managment for the game
I created the art for The Starblaster, Light of Creation, and Lucretia's shield. I also oversaw the UI style choices and overall visual design of the game
I recreated Griffin McElroy's original song, "The Starblaster", which was used during the final arch or The Adventure Zone. I wanted to pay respects to Griffin's story and music while also expanding my experience in digital audio creation
'Twas night before Christmas
As a matter of course
Something sinister was stirring
A menacing force...
As resident sugarplum fairy, it is your job to climb the Christmas tree and put an end to the source of the dark energy emanating from its top.
Dodge and dismantle the bewitched soldiers of evil that guard your path and free Christmas angels from their ornamental cages."
As this game was created for the GameJam Ludum Dare, He had to come up with an idea quickly. I helped the team come up with ideas for the game and some of its mechanics
To nail the christmas theme, I wanted to recreate some classic holiday tunes. I recreated Tchaikovsky's "Dance of the Sugarplum Fairy" and Mariah Carey's cult favorite "All I Want For Christmas Is You"
Great! Lets get in touch.
© Declan E. Behan 2017. All Rights Reserved. Shout out to: Bootstrap


Occupant Information |
||
|---|---|---|
Ownership and Insurance |
||
|---|---|---|
|
Chelsea L Bailey 107 Page Rd Bow, NH 03304 |
Insurance Company Name |
NAIC # |
|
Policy # |
Vehicle Details |
||
|---|---|---|
|
Vehicle Identification Number |
Vehicle Unit Type |
Body Type Category |
|
Vehicle Registration Identifier |
Vehicle Make |
Vehicle Size |
|
Vehicle Registration Year |
Vehicle Model |
Number of Trailing Units |
|
License Plate Number |
Vehicle Model Year |
Hazardous Materials Placard? |
Factors and conditions |
||
|---|---|---|
|
Posted/Statutory Speed Limit |
Travel Directions |
Travel Direction Before Crash |
|
Traffic Control Devices (TCDs) |
Inoperative or Missing TCDs |
Vehicle Maneuver/Action |
|
Barrier Type |
||
|
Divided? |
Towed Due to Disabling Damage |
Contributing Circumstances from Vehicle |
|
Location of Damage Area(s) |
Initial Point of Contact |
Resulting Extent of Damage |
|
HOV/HOT Lanes |
Crash Related to HOV/HOT? |
|
|
Sequence of Events |
Emergency Motor Vehicle Use |
Special Function in Transport |
|
Vehicle's Most Harmful Event |
Horizontal Alignment |
Total Through Lanes |
|
Hit and Run? |
Grade |
Total Auxiliary Lanes |
|
Has Automated System(s)? |
Automated System Levels (ASLs) |
ASLs Engaged during Crash |
First Trailer Behind Tractor |
||
|---|---|---|
|
License Plate Number |
Make |
Model and Year
|
|
VIN |
Total Number of Axles |
Second Trailer Behind Tractor |
||
|---|---|---|
|
License Plate Number |
Make |
Model and Year
|
|
VIN |
Total Number of Axles |
Third Trailer Behind Tractor |
||
|---|---|---|
|
License Plate Number |
Make |
Model and Year
|
|
VIN |
Total Number of Axles |
Motor Carrier Identification |
||
|---|---|---|
|
carrier name Street address town, State ZIP code |
Identification Type |
Identification Number |
|
Country/State Code |
Type of Carrier |
Vehicle Configuration |
||
|---|---|---|
|
Configuration |
Special Sizing |
Permitted? |
|
Number of Axles on Tractor |
Cargo Body Type |
Hazardous Materials |
||
|---|---|---|
|
Hazardous Materials ID |
Hazardous Materials Class |
Release of hazardous materials from a cargo compartment, container, or package? |


[gecode-users] How to stop a branching?
Christian Schulte
cschulte at kth.se
Fri May 29 14:11:39 CEST 2009
Right now, you can't stop branching. While just having an operation to do
that is easy, but I do not see yet how one would get that to work with
recomputation.
Did you see that you can actually post branching incrementally, maybe that
could help. Check "Executing code between branching" in MwG. You could
control whether a branching is posted or not by an additional variable. Just
an idea, don't know whether that would help.
Christian
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Martin Mann
Sent: Friday, May 29, 2009 2:04 PM
To: gecode user list
Subject: [gecode-users] How to stop a branching?
Hi,
I would like to know, if it is possible to stop a branching (when
multiple ones are present). Thus, to ignore all remaining branches for
this specific one.
Maybe an example to make my question clear.
I have two sets of variables X_1, X_2 linked via several constraints.
Within my Space I post two brachning B_1(X_1) and B_2(X_2) such that
first all variables of X_1 are assigned before B_2 is considered.
My final goal is to enumerate solutions with different X_1 assignments!
My current solution (was implemented for Gecode 1.3.* and I am going to
reimplement in 3.*) is to formulate a COP instead of a CSP and to
implement the *constrain* function and to post a constraint that ensures
that the next solution is at least in one X_1 assignment different from
the current solution.
Thus, I get a new constraint per solution ... and I dont like that! ;)
But when looking at the problem, it would be sufficient to stop the
branching on X_2! I dont need to post new constraints but to cancel the
remaining branching of B_2 on X_2. This will lead to a backtracking in
B_1 and therefore ensures that the next solution differs in the X_1
assignment in at least one solution...
This seems to be much more efficient to me. Btw. I would end up with a
CSP instead of this strange COP hack.
So my question: Is it possible to stop the remaining branching on B_2
out of the (Gecode 3.*) box? Or do I have to implement/subclass my own
branching?
Thanks for your help,
Martin
--
Martin Mann, Dipl. Bioinf.
Bioinformatics - Inst. of Computer Science
Albert-Ludwigs-University Freiburg
Tel: ++49-761-203-8259
Fax: ++49-761-203-7462
http://www.bioinf.uni-freiburg.de/~mmann/
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list


Font size: 20px
The One Where Heckles Dies
47 minutes, 41 seconds
It’s our 100th episode! We’re pretty sure anyway! And it’s the final episode of this series of FWF, but fear not, we won’t be away for long. It’s all about saying goodbye to Mr Heckles this week even though, let’s face it, he turned out to be a massive creep. Plus: evolution, lamps and Adam’s apples.
Transcription
- [OWL SOUND] ... The following podcast is a member of the big owl family. [FRIENDS INTRO]
- Hellow, welcome to this final episode of this series! Of guitars fifteenth biggest film and tv's podcast.. fiends of friends P Allison and this is Steve Crib.
- AYOH hoy happy birthday P!
- THANKYOU..., I mean eh... My birthday is tomorrow, at which point this episode won't be out
- ya awhh.., Yea your birthday's right between recording and it going out. that's the problem, isn't it?
- NaAh, I'll take that happy birthday thank you
- Yeah.. As you follow us on Instagram at @fwfpod, you'll kno that P's Happy Birthday iss on Saturday
- eh, yea
- That's this weekend.
- That's two days before
- Y'know what I realised? What happened tho P? I realised that what's at stake.
- Whatsthat?


new Envelope(text, message, user, channel)
Represents an Envelope object, responsible for holding metadata of an incoming message.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
String | Incoming text of the messsage. May have been changed by the active adapter. This value will be used by all subsystems responsible for parsing and matching input data. |
message |
AnyObject | Original adapter message object. |
user |
AnyObject | User who sent this message. |
channel |
AnyObject | Channel where this message was sent. |
- Source:
Methods
allowPropagation() → {undefined}
Indicates underlaying mechanisms that the parsing of this message should continue. Upstream mechanisms automatically voids messages; use this if your module is supposed to let the message continue traversing the matching chain.
- Source:
Returns:
Nothing.
- Type
- undefined


| < Day Day Up > |
Escaping RevisitedBefore venturing deeply into the world of metacharacters, it is important to understand escaping. Metacharacters are characters that have special meaning within regular expressions. The period (.) is a metacharacter; it is used to match any single character (as explained in Lesson 2). Similarly, the left bracket ([) is a metacharacter; it is used to mark the beginning of a set (as explained in Lesson 3, "Matching Sets of Characters"). Because metacharacters take on special significance when used in regular expressions, these characters cannot be used to refer to themselves. For example, you cannot use a [ to match [ or . to match .. Take a look at the following example. A regular expression is being used to attempt to match a JavaScript array containing [ and ]: var myArray = new Array(); ... if (myArray[0] == 0) { ... } myArray[0] var myArray = new Array(); ... if (myArray[0] == 0) { ... } In this example, the block of text is a JavaScript code snippet (or a part of one). The regular expression is the type that you would likely use within a text editor. It was supposed to have matched the literal text myArray[0], but it did not. Why not? [ and ] are regular expression metacharacters that are used to define a set (but not the characters [ and ]). As such, myArray[0] would match myArray followed by one of the members of the set, and 0 is the only member. Therefore, myArray[0] would only ever match myArray0. As explained in Lesson 2, metacharacters can be escaped by preceding them with a backslash. Therefore, \. matches ., and \[ matches [. Every metacharacter can be escaped by preceding it with a backslash; when escaped, the character itself is matched instead of the special metacharacter meaning. To actually match [ and ], those characters must be escaped. Following is that same example again, this time with the metacharacters escaped: var myArray = new Array(); ... if (myArray[0] == 0) { ... } myArray\[0\]
var myArray = new Array();
...
if (myArray[0] == 0) {
...
}
This time the search worked. \[ matches [ and \] matches ]; so myArray\[0\] matches myArray[0]. Using a regular expression in this example is somewhat unnecessary—a simple text match would have sufficed and would have been easier, too. But imagine if you wanted to match not just myArray[0] but also myArray[1], myArray[2], and so on. Then using a regular expression would make a lot of sense. You would escape [ and ] and specify the characters to match in between them. If you wanted to match array elements 0 through 9, you might use a regular expression such as the following: myArray\[[0-9]\] Tip
Caution
\is used to escape metacharacters. This means that \is itself a metacharacter; it is used to escape other characters. As noted in Lesson 2, to refer to \, you would need to escape the reference as \\. Take a look at the following simple example. The text is a file path using backslashes (used in DOS and Windows). Now imagine that you need to use this path on a Linux or Unix system, and as such, you need to locate all backslashes to change them to slashes: \home\ben\sales\ \\ \home\ben\sales\ \\matches \, and four matches are found. Had you just specified \as the regular expression, you would likely have generated an error (because the regular expression parser would rightfully assume that your expression was incomplete; after all, \is always followed by another character in a regular expression). |
| < Day Day Up > |


Considering an electric car with a 24 kWh battery that gets discharged by 6 kWh per day during the week (monday to friday) and given the fact the car has a 7 kW quick charge and has to be fully charged each morning before 6:00. Calculate (based on the collective costs of energy for 2015): - the total collective energy cost for the vehicle if the user recharges it between 7:00PM and 8:00PM - the same cost if the battery gets charged according to the tariff division given in annex - the total collective energy cost for the vehicle if charged during the best period each night between 7:00PM and 6:00AM
Here are the final results of our work.
With those results we can see that the 7:00PM-8:00PM approach is the most expensive. This is due to the relatively high prices at this moment of the day. Charging the car when coming home may not the best idea.
When charging according to the division plan, there is a significant price drop. It's obviously a better option than charging during the 7:00PM-8:00PM interval. This is due to the cheaper prices during the night.
By charging the car during the best hour of the night we obviously get the best price we could possibly get. It illustrates the benefits of future Smart Home technologies, which will allow us to adapt and improve our energy consumption.
You can contact us by email, or trought a GitHub issue


[Erowid Note: Driving while intoxicated or tripping is dangerous and irresponsible because it endangers other people. Don't do it!]
I was drinking after work and someone told me about these things so I went and picked one (there was a few plants right in the middle of town). While at the bar I was eating the seeds. It was about 11pm.
Then I wake up in a hospital. 3:30 a.m
As ashamed of myself as I am, I will tell you what others told me I did. Driving a car into the other lane and grazing someone elseís car. Then leaving the scene of the accident and driving into the woods. My car got stuck and then I walk away from it. I guess the car I hit called the cops and so did the owner of the land I was on. An ambulance took me to the hospital. I guess I was really hallucinating and smoking fake joints. Then in the hospital with an IV in my arm. kept sitting up and wanted to get a drink but the cops wouldnít let me (they were actually there) and everyone was asking me what I ate and I just told them I was drunk and didnít know what was going on. Then at about 830 in the morning (I was at the hospital for 6 hrs) they said I could go. But thinking about it now I donít know why they let me go.
I waited outside for my dad to pick me up and I was talking to people who werenít there, and hearing voices. I could also make anything I wanted to disappear. I had gotten three tickets for that night, and I couldnít even read them, I also couldnít read a newspaper and right now, 24 hrs later, it is still hard and my pupils are still dilated.
 I would have woken in jail not know what I did, but killing someone, goddamnit. Right now I cant even live with myself. I consider myself to be very lucky and I am truly happy no one got hurt last night.
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.


Since Tobago 4.0.0 an AjaxExceptionHandler takes care of exceptions in ajax case.
Important!
The exception has to be thrown before the renderer phase.
This is the case, in normal actions, but if you need e. g. some initialization of data in a page, you
can achieve that with an
<f:event type="preRenderView" listener="\#{bean.doSomeCriticalWork}"/>
.
The AjaxExceptionHandler take the first exception that occurs and try to find a proper error page. Error pages are defined in the web.xml.
If no proper error page could be found, the error page for error code 500 is displayed instead. If no 500-error-page is defined, the general error page (no exceptiontype or error code defined) is used.
If there is no ajax case, the error page could not be found or the renderer phase is active, the AjaxExceptionHandler do nothing and let JSF handle the exception.
The output field is updated after an change event of the input field.
Set the input value to 'x' to throw an exeption.
This example use the <f:event type="preRenderView"/>
tag.
An exceptions is thrown after page 7 or higher is selected.


JavaScript
Home
Geometric Figures
Prices and Discounts
Average, Mode and Median
Salary Analysis
Curso Practico de JavaScript
Home
Geometric Figures
Prices and discounts
Average, mode and Median
Salary analysis
Julio Loarte
Geometric Figures
Calculate the area and perimeter of a square
Enter one Side:
calculate
Result:
Calculate the area, isosceles height and perimeter of a triangle
Enter Side 01:
Enter Side 02:
Enter Base:
Enter Height:
calculate
Result:
Calculate area and perimeter of a circle
Enter Radius:
calculate
Result:


Class: Aws::EC2::Types::EnableFastLaunchRequest
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Struct
|
|
|
Instance Chain:
self,
::Aws::Structure ,
Struct
|
|
| Inherits: |
Struct
|
| Defined in: | gems/aws-sdk-ec2/lib/aws-sdk-ec2/types.rb |
Overview
Constant Summary
Instance Attribute Summary
-
#dry_run ⇒ Boolean
rw
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response.
-
#image_id ⇒ String
rw
The ID of the image for which you’re enabling faster launching.
-
#launch_template ⇒ Types::FastLaunchLaunchTemplateSpecificationRequest
rw
The launch template to use when launching Windows instances from pre-provisioned snapshots.
-
#max_parallel_launches ⇒ Integer
rw
The maximum number of instances that Amazon EC2 can launch at the same time to create pre-provisioned snapshots for Windows faster launching.
-
#resource_type ⇒ String
rw
The type of resource to use for pre-provisioning the Windows AMI for faster launching.
-
#snapshot_configuration ⇒ Types::FastLaunchSnapshotConfigurationRequest
rw
Configuration settings for creating and managing the snapshots that are used for pre-provisioning the Windows AMI for faster launching.
Instance Method Summary
::Aws::Structure
- Included
| #to_hash | Alias for Structure#to_h. |
Instance Attribute Details
#dry_run ⇒ Boolean
(rw)
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/types.rb', line 29587
class EnableFastLaunchRequest < Struct.new( :image_id, :resource_type, :snapshot_configuration, :launch_template, :max_parallel_launches, :dry_run) SENSITIVE = [] include Aws::Structure end
#image_id ⇒ String
(rw)
The ID of the image for which you’re enabling faster launching.
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/types.rb', line 29587
class EnableFastLaunchRequest < Struct.new( :image_id, :resource_type, :snapshot_configuration, :launch_template, :max_parallel_launches, :dry_run) SENSITIVE = [] include Aws::Structure end
#launch_template ⇒ Types::FastLaunchLaunchTemplateSpecificationRequest (rw)
The launch template to use when launching Windows instances from pre-provisioned snapshots. Launch template parameters can include either the name or ID of the launch template, but not both.
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/types.rb', line 29587
class EnableFastLaunchRequest < Struct.new( :image_id, :resource_type, :snapshot_configuration, :launch_template, :max_parallel_launches, :dry_run) SENSITIVE = [] include Aws::Structure end
#max_parallel_launches ⇒ Integer
(rw)
The maximum number of instances that Amazon EC2 can launch at the
same time to create pre-provisioned snapshots for Windows faster
launching. Value must be 6
or greater.
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/types.rb', line 29587
class EnableFastLaunchRequest < Struct.new( :image_id, :resource_type, :snapshot_configuration, :launch_template, :max_parallel_launches, :dry_run) SENSITIVE = [] include Aws::Structure end
#resource_type ⇒ String
(rw)
The type of resource to use for pre-provisioning the Windows AMI for
faster launching. Supported values include: snapshot
, which is the
default value.
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/types.rb', line 29587
class EnableFastLaunchRequest < Struct.new( :image_id, :resource_type, :snapshot_configuration, :launch_template, :max_parallel_launches, :dry_run) SENSITIVE = [] include Aws::Structure end
#snapshot_configuration ⇒ Types::FastLaunchSnapshotConfigurationRequest (rw)
Configuration settings for creating and managing the snapshots that
are used for pre-provisioning the Windows AMI for faster launching.
The associated ResourceType
must be snapshot
.
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/types.rb', line 29587
class EnableFastLaunchRequest < Struct.new( :image_id, :resource_type, :snapshot_configuration, :launch_template, :max_parallel_launches, :dry_run) SENSITIVE = [] include Aws::Structure end


Software Architect
ProActive Software - Netherlands
- Focused in building a Laravel API which is used by other teams
- Maintained a ruby script to start the local development in a similar way to production servers
- Maintained a python script responsible for creating, copying and deleting client’s environments from one server to another.
- Created a bash script to install all the dependencies for local development.
December 2019 - April 2022
Software Engineer
Youwe B.V. - Netherlands
- I developed web applications using technologies and frameworks such as Symfony, Pimcore, Vue.JS, and Ext.JS
- I developed a web application using AngularJS and Symfony.
- I developed a web application using JAVA EE
March 2018 - November 2019
Software Developer
Catenna Planning - Brazil
- Developing web applications in Java EE language, using JSP, JSF, Structs, and hibernate.
February 2014 - May 2014
Software Developer | System Analyst
IPAD Institute - Brazil
- Developing web applications in JAVA EE language, using JSP, structs and hibernate.
- Developing mobile applications using android technology.
- Requirement analysis and use case specifications.
June 2011 - February 2014


---
layout:post
categories:toeza
tags:toeza
title:wikiHow to Play 31
date:2016-12-07 14:32:45 +0800
---
Edit Article
wikiHow to Play 31
Three Methods:Preparing for the GamePlaying the GameWinning the GameCommunity Q&A
Great for small and large groups, 31 is easy and fun for all ages to play. Competition can be light and friendly or high-stakes, depending on the group. The game provides room for gambling, though gloating rights can prove just as satisfying. Make this flexible and addicting game your group??s new pastime by following the steps below!
Steps
Part 1Preparing for the Game
1
Grab some friends ready to play. Playing groups are recommended at a range of 2 to 9 people, though you really can add as many players as you like.
Experts suggest three players to be the perfect amount, however this number is subjective to your group??s preferences. Some people are all about the competition, while others focus on spending some good time with good friends. [1]
2
Grab a standard 52 deck of cards. Throw out those jokers and shuffle up the cards.
3
Grab some space with a flat surface. Although a table is ideal for card games, all you really need is a comfortable space for people to sit around a central location. Cards will be placed in the center for the whole group to share, so be sure to chose a location where everyone will be able to reach and see these communal cards.
4
Explain the game goal of racing to collect a hand totaling 31 points. Hands consist of three cards and totals are determined by adding together cards of the same suit.
5
Agree on card values and scoring. Card game rules can vary from group to group as rules are often spread by word of mouth, so be sure your group agrees. Official 31 rules state that an Ace equals 11 points, while Jacks, Queens and Kings count as 10 and number cards are worth their face value.[2]
Cards can only be added together if they are from the same suit. For example, your hand may consist of a 3 of diamonds, an Ace of spades and a King of spades. The hand??s total would equal 21. The 3 of diamonds is not a spade. It cannot be added together with the King and Ace.
Any hand with three-of-a-kind is worth 30 points. This means a hand of three fives, three deuces or three kings are all worth 30 points and automatically trump any other hand of the same suit worth 30 points.
6
Select a dealer by cutting the deck. Each player grabs a section of the deck of cards. Players then reveal the bottom card of their cut. Whoever has the card of the lowest value is the chosen dealer.
Each game, the person to the left of the previous dealer takes over the position.
7
Receive three ??lives??. Although it is not necessary, some people prefer to play 31 with ??lives??, represented by three chips, three pennies or three of any marker the group chooses.
After a player looses three lives, they cannot move on to the next round. The game continues until all but one player is eliminated.
Part 2Playing the Game
1
Deal to the left, placing one card face down in front of every player in a clockwise rotation. After everyone has received three cards, each player may look at his or her hand. Under no circumstance should a player allow any other player to see their hand.
2
Place three cards face up in the middle to create the window. Players will be taking and replacing these three cards in turn throughout the game.
3
Assess your cards. Look at the three cards in your hand and the three cards in the window. Decide which cards, both in your hand and in the window, will push you closer to a hand totaling 31.
Never forget you can only add together cards of the same suit! Keep this in mind while strategizing.
4
Place bets. Although betting is not necessary, it can heighten the stakes. If you chose to bet, every player should place an equal amount of chips into the center before anyone takes a turn.
5
Begin play with the player to the left of the dealer. This player has the option to exchange one of their own cards for one of the cards in the window. Players can switch out as many cards as they wish as long as it is their turn.
6
Play continues in a clockwise fashion. Players continue to add value to their three-card hands.
Always make sure you have three cards in your hand, no more or no less.
7
Asses your competition's emotions as you play. Try to reach a hand of 31, but also keep an eye on your opponents. Determine if they seem pleased or agitated by gestures, facial expressions and the tones in their voices.
Scoring exactly 31 can be a difficult task. Sometimes a player must decide they are as close as they will get. Use your knowledge of the other players to decide if your hand has a good chance of winning. Perhaps you only have a score of 23, but everyone seems disgruntled and the game has been lagging on. You may be the winner.
Part 3Winning the Game
1
Knock when you believe your hand has reached its greatest potential. As soon as you have reached as close to 31 as you believe you can, knock on the table. All other players then have one final turn exchanging cards with the window.
If your hand is exactly 31, knock and declare that you have 31. Players do not receive another turn and you show your cards to the group.  This can happen at anytime, even after another player has already knocked to begin the final round.
2
Begin the showdown by revealing your cards to the group. The player with the cards of the same suit closest to totaling 31 wins the game.
In case of tie, the player with the highest-ranking cards wins. For example the combination Ace, Jack, and 4 equals 25 as does a King, Queen, and 5 combination. However the Ace has a higher rank than the King. The Ace, Jack, 4 hand beats the King, Queen 5 hand. [3]
If the tie continues, the second highest cards are compared (Jack and Queen in the case of the previous example), and so on until a winner is determined.
3
Declare the lowest scorer as loser.  Once a player looses all three lives they are eliminated from the game and may not move on to the next hand.
In the event that one player knocks but another ends with the highest score in the final round, the knocker looses a life.
4
Declare the highest scorer as winner. Whether the prize is money, bragging rights, a personal favor or a boost in self-esteem, winning is always fun.
Collect cards, reshuffle, switch dealer to the left and repeat the steps above until all but one have been eliminated.
5
Declare the last player standing as winner of the game. The amount of rounds per game will change depending on how many people are playing. More players increase game length as there are more lives to be lost.


Home of the Week: Getting creative in Clarence
Buffalo native Alycia Ripley has a lot of nice things to say about the home that her mother, Maria Rizzo, has created in Clarence.
Among her mother’s many DIY projects: installing the faux-tin ceiling. Recycling an old damaged mantel and buffet and refinishing them. Crackle painting the breakfast buffet. Performing a plaster treatment on the kitchen and foyer walls before hand glazing them. Landscaping.
Rizzo, a retired nurse, said she has personalized her previous homes – but not on such a large scale.
“Everywhere I have lived I have looked at a space and been able to envision it differently without knocking down a lot of walls and doing major construction,” said Rizzo, whose other interests include architecture and Buffalo history.
Here is how Ripley – an author, actress and social media consultant (@talentedmsripley) – described the family residence for today’s Buffalo News’ “Home of the Week” online feature:
“I was born and raised in Buffalo but because of my work I have lived in New York City and Los Angeles but always love coming back to the family home I share with my mother. It is really special to me and to friends,” wrote Ripley, who graduated from Buffalo Seminary, Syracuse University and New York University.
“It would be difficult to separate the idea of my mother and me from our family home in Clarence. I’ll bet our friends would say the same. When she told me back in 2005 when I was living in Manhattan that she’d be moving from Eggertsville to a house in Clarence, I couldn’t wait to see it. It has been such a journey of personalization and memories.
“What I love most is that it was a basic shell upon her moving in and she customized it due to her self-taught design skill that brings an entire room together with scope and sale.
“She hand-crackled a breakfast cabinet and white-stained the dark wood kitchen cabinets and matching fridge surface (an incredibly challenging technique). She took a photo of our side garden, had it printed on large poster sheets which she attached to adhesive sheets of tiles and created a mural so that we could always see sunshine during the winter.
“We’ve had such fun times in the house, yard and pool – throwing theme parties for friends, such as an homage to ‘Stranger Things,’ ‘Breaking Bad’ and ‘Hot Tub Time Machine.’
“Some of my contributions are the Funko pop characters strategically placed around the house in unexpected places (i.e. John McClane from the “Die Hard” film series, Baby from “Dirty Dancing”).
“Our home has become such an important place in our lives. ... It’s more than a home to us and I’m so proud of all the work, creativity and time she has put into it to make it something special for us and all who come visit.
“It’s truly such a happy place to be. No wonder people now want her help bringing more of a personalized vision to their homes as well,” Ripley wrote.
 This could be your chance.
The Buffalo News is looking for other beautiful local homes and the stories behind them and their décor. Those chosen will be displayed in a weekly feature at buffalonews.com and could be chosen as Home of the Month in a Sunday edition of The Buffalo News.
If you are interested, tell us about your home in 150 words or less, and email at least 10 images (in .jpg form) of the interior and exterior to<EMAIL_ADDRESS>It’s OK to separate the images into several emails.
Those chosen for BuffaloNews.com will be contacted by Home and Style Editor Susan Martin. A phone number is helpful. Single-family homes, condominiums, lofts and apartments are eligible. We will not print your exact street address, though we do like to include the town, city or neighborhood in which you live.
If you have difficulty submitting images, please email<EMAIL_ADDRESS>* In case you missed our most recent Home of the Week:


Copyright (c) 2003-2004 by The BioBike Team (contact Jeff Shrager for more information)
In previous lessons we covered the basics of Lisp and of BioBike, and learned how to interact with the BioBike Web Listener, and how to navigate around the frame system. Turns out, that's pretty much all you need to know to do some fairly interesting computations. This lesson has some examples.Let's start simply by reproducing what we did at the end of one of the previous lessons. There we found all the kinase genes involved in glycolysis by intersecting the genes related to the Gene Ontology's glycolsis frame with its kinaseactivity frame. Let's redo that:
>> (intersection (#^go.related-genes #$go.glycolysis) (#^go.related-genes #$go.kinaseactivity)) :: (#$S6803.sll1196 #$S6803.sll1275 #$S6803.slr0394 #$S6803.sll0593 #$S6803.sll0587 #$S6803.sll0745 #$A7120.alr2973 #$A7120.all4131 #$A7120.all7335)(Your results may be somewhat different. That's ok.)
Let's assign this list of genes to a symbol so that we can use it, and then let's get a couple of the genes individually to work with (notice that you can put multiple assignments in the same SETF):
>> (setf gk-genes *) >> (setf g1 (first gk-genes) g2 (second gk-genes))Now, suppose that we want the sequence of one of these genes. No problem:
>> (extract-sequence g1) :: "ATGGGGGAAATTAAACGCATTGGTATTT ... and so on ...  The first thing we'll do is grab a small part of the gene sequence for expository purposes:
>> (setq g1-init (subseq g1s 0 30)) :: "ATGGGGGAAATTAAACGCATTGGTATTTTA"Now we'll do something biologically specific -- complement the nucleotide sequence (note that it's both complemented and reversed!):
>> (nt-complement g1-init) :: "TAAAATACCAATGCGTTTAATTTCCCCCAT"There is a built in function in BioBike, called ALIGN, that will align two or more sequences. It uses the CLUSTAL tool, which is a standard tool used by the BioInformatics community. Watch:
>> (align '("the rain in spain falls mainly on the plain" "the plain in spain is mainly in the rain")) :: #$ClustalWResult1The result is a frame. To actually see the alignments, you have to either click to the frame browser on that frame, or use the #^ accessor to get the alignment from the frame. We'll use the DF function that we learned in a previous lesson to see all the slots in the frame.
(df *) :: Slots of #$ClustalWResult25: #$fName: "ClustalWResult25" #$consensus: "*** **********: ::******* **** :***" #$alignments: (("the rain in spain falls mainly on the plain" "THER-AININSPAINFALLSMAINLY-NTHEPLAIN") ("the plain in spain is mainly in the rain" "THEPLAININSPAIN---ISMAINLYINTHER-AIN")) #$instanceOf: #$ClustalWResult NILThe alignment itself lives in a slot called #^alignments. This is a bit confusing because CLUSTAL removes all the spaces from the strings it aligns and even uppercases all the letters (which makes sense when doing Biology, but not so with English!). If you look closely you'll see that the two strings sans spaces are both there and aligned so that most of the characters match. There is also a consensus string, which tells us where the strings matched exactly (*).
Let's align the two genes that we selected. ALIGN calls ClustalW on a list of things that have sequences (genes, proteins, or whatever). So...
>> (setq cr (align (list g1 g2))) :: #$ClustalWResult1 >> (#^alignments cr) :: ((#$S6803.sll1196 "[lots of dashes --- left out here] -------ATGGGGGAAATTAAACGCATTGGTATTAACC--AGTGGAGGAGACTGTGCCGGACTAAACGCCGTAAT ..." (#$S6803.sll1275 "[lots of characters left out here] CTGGACCAAGGGGTGGACTGGGTGGCCCTGAGTTGTTCGTAATCCCCAGGATATTGATGAGATTAAGGGGTTAAT ..."))You'll have to scroll over quite a ways to see where they align because one sequence is much longer than the other and CLUSTAL decided that the best alignment matched the ends of both sequences, not the beginnings. Perhaps not the world's best alignment, but not the worst either.
Now, of course we actually have the list of ALL the genes that are glycolysis-related kinases; we left that in the symbol called GK-GENES. How about aligning all of those just for yucks:
>> (#^consensus (align gk-genes)) :: ... a real long string of mostly blanks -- not very interesting! ...One thing to notice is that we've been working with genes from different organisms. This brings up an interesting idea: Since the related-genes slots of the GO frames contain genes from various organisms, we can use the GO as a sort of lingua franca -- or "common language" to inter-translate gene functions between organisms. Let's look at the genes that catalyze the glucokinase reaction:
>> (find-frames "glucokin") :: (#$Go.GlucokinaseActivity #$GlucokinaseActivity #$Go.PhosphoglucokinaseActivity) >> (setf gkframe (first *)) >> (#^go.related-genes gkframe) :: (#$A7120.alr2973 #$S6803.sll0593)Just for fun, let's align those:
>> (#^alignments (align (#^go.related-genes gkframe))) :: ((#$A7120.alr2973 "-------ATGACCTTA---TTGTTAGCAGGAGATATCGGCG...") (#$S6803.sll0593 "GGGGGCCATGGGCGTAAATTTTTTGGCAGGGGATATCGGCG..."))The alignment here probably looks pretty good. Okay, so now we know how to find the genes related to the same function -- that is, the orthologs -- between Synechocystis 6803 and Anabaena 7120 (which is what A7120 stands for); just look in the Gene Ontology for common, related genes!
Now, BioBike is an actual programming language, so we can use it to actually write programs. Let's write a simple one that does something slightly useful. One could, given a whole series of genes, figure out which ones were best aligned to one another. E.g., among ten genes, determine which pair are closest. One way to do this (although not the most efficient way) is to align every pair, and score the alignment, and then pick the pair that work best. Even though this isn't the best way to do that -- it would be very slow for a lot of genes! -- let's do it this way just to show off BioBike.
First we need to know how to score an alignment. We saw that along with the #^alignments slot in the ALIGN result frame, you get a #^consensus slot, and that it has '8' every place that the alignment is perfect. So, one way to do score the alignment is to figure out the percentage of the consensus that is stars.
Try this:
>> (setq c (#^consensus (align (list g1 g2)))) :: " *** ** * ... etc ..." ;[ Again the matches are way over to the right, scrolled off the screen ] >> (count #\* c) :: 522 ; This is the number of stars!! >> (length c) :: 1790 >> (* 100.0 (/ (count #\* c) (length c))) :: 29.16201Simple as that! So, there are 522 stars in a consensus of 1790 total characters, or about 29%. Let's turn this into a function:
>> (defun score-alignment (genes) (let ((c (#^consensus (align genes)))) (* 100.0 (/ (count #\* c) (length c))))) :: SCORE-ALIGNMENTWe just created our own function, called SCORE-ALIGNMENT, which we can call just like any other function. Let's test it:
>> (score-alignment (list g1 g2)) :: 29.248554Ok. We'll use it for real in just a minute...
Now we need to be able to create all possible pairs of genes from the list of genes we are comparing.
Here's a way to create every pair from a list of items:
(defun every-pair (list) ;; If the list is empty we're done. ;; Otherwise, pair up the first element with all the later elements, ;; make more pairs out of the list which has the first element removed, ;; and append the two lists together. (cond ((null (cdr list)) nil) (t (append (mapcar (lambda (next) (list (car list) next)) (rest list)) (every-pair (cdr list))))))Put this into the long expression box and evaluate it. Let's try it out too:
>> (every-pair '(a s d f)) :: ((A S) (A D) (A F) (S D) (S F) (D F))Okay, that looks right. Now we're almost ready. Recall that GK-GENES is our list of all glycolysis-related kinase genes which we obtained at the very start of this tutorial.
>> gk-genes :: (#$S6803.sll1196 #$S6803.sll1275 #$S6803.slr0394 #$S6803.sll0593 #$S6803.sll0587 #$S6803.sll0745 #$A7120.alr2973 #$A7120.all4131 #$A7120.all7335) >> (length gk-genes) :: 9We don't want to be aligning hundreds or thousands of pair of genes, at least now it this tutorial! So if the number of genes you get is more than 9, do this:
>> (setq gk-genes (subseq gk-genes 0 9)) :: <<<< shorter list of genes >>>>Now we're really ready! Let's put our new functions together, looping over every pair and aligning/scoring each pair (even with 9 genes this will take a minute or two):
>> (loop for pair in (every-pair gk-genes) collect (list pair (score-alignment pair))) :: (((#$S6803.sll1196 #$S6803.sll1275) 29.248554) ((#$S6803.sll1196 #$S6803.slr0394) 40.41096) ((#$S6803.sll1196 #$S6803.sll0593) 42.201836) ((#$S6803.sll1196 #$S6803.sll0587) 33.789627) ((#$S6803.sll1196 #$S6803.sll0745) 53.900707) ((#$S6803.sll1196 #$A7120.alr2973) 39.262062) ((#$S6803.sll1196 #$A7120.all4131) 38.71795) ((#$S6803.sll1196 #$A7120.all7335) 64.72832) ((#$S6803.sll1275 #$S6803.slr0394) 30.346819) ((#$S6803.sll1275 #$S6803.sll0593) 27.125505) ((#$S6803.sll1275 #$S6803.sll0587) 44.83555) ((#$S6803.sll1275 #$S6803.sll0745) 27.324587) ((#$S6803.sll1275 #$A7120.alr2973) 25.580046) ((#$S6803.sll1275 #$A7120.all4131) 30.17888) ((#$S6803.sll1275 #$A7120.all7335) 27.056778) ((#$S6803.slr0394 #$S6803.sll0593) 40.63812) ((#$S6803.slr0394 #$S6803.sll0587) 37.6259) ((#$S6803.slr0394 #$S6803.sll0745) 41.191273) ((#$S6803.slr0394 #$A7120.alr2973) 37.925167) ((#$S6803.slr0394 #$A7120.all4131) 70.01718) ((#$S6803.slr0394 #$A7120.all7335) 38.115097) ((#$S6803.sll0593 #$S6803.sll0587) 36.357094) ((#$S6803.sll0593 #$S6803.sll0745) 39.316986) ((#$S6803.sll0593 #$A7120.alr2973) 57.945736) ((#$S6803.sll0593 #$A7120.all4131) 39.678513) ((#$S6803.sll0593 #$A7120.all7335) 41.38889) ((#$S6803.sll0587 #$S6803.sll0745) 35.507248) ((#$S6803.sll0587 #$A7120.alr2973) 31.860971) ((#$S6803.sll0587 #$A7120.all4131) 36.52609) ((#$S6803.sll0587 #$A7120.all7335) 34.099068) ((#$S6803.sll0745 #$A7120.alr2973) 40.124557) ((#$S6803.sll0745 #$A7120.all4131) 41.54104) ((#$S6803.sll0745 #$A7120.all7335) 50.847458) ((#$A7120.alr2973 #$A7120.all4131) 36.417656) ((#$A7120.alr2973 #$A7120.all7335) 43.35206) ((#$A7120.all4131 #$A7120.all7335) 38.297874))Woohoo! Quick! Save it!
>> (setq scores *)Okay, so now we need to find the best. That's pretty easy: just sort it and take the first one:
>> (setq sorted-scores (sort scores '> :key 'second)) :: (((#$S6803.slr0394 #$A7120.all4131) 70.01718) ((#$S6803.sll1196 #$A7120.all7335) 64.72832) ((#$S6803.sll0593 #$A7120.alr2973) 57.945736) ... etc ...Notice that they're now sorted! So the first one, i.e.: (FIRST SORTED-SCORES), is the best match. You can check, just for fun, that these are actually orthologs by clicking on them and reading the GO-IDs. In the case above, the two genes: #$S6803.slr0394, and #$A7120.all4131, whose overlap is 70% both turn out to be Phosphoglycerate Kinase!
Okay, let's put it all together, from the very beginning!
(defun best-related-gene-pair (genes) "Given a gene ontology category, like #$go.glycolysis, figure out the pair of genes among all those in the category that are most closely related, by alignment." (first (sort (loop for pair in (every-pair genes) collect (list pair (score-alignment pair))) '> :key 'second)))Go ahead and try it! It'll take a while....
>> (best-related-gene-pair gk-genes) ::Go ahead and click on the resulting best pair to see what they are. How well did it work?
So, this is cool! We've added completely new functionality to the BioBike system! In the next section we'll learn a little more about how to get around in the BioBike system, and esp. how to get help on all the million functions that there are, which is really useful if you're going to try to write your own complex programs.