Man arrested for allegedly murdering brother
by Kingsley Mamore, GNA
Dambai Lakeside (O/R), Nov. 14, GNA - Mr Christopher Kucham, resident of Dambai-Lakeside in the Krachi East Municipality of the Oti Region has been arrested for allegedly stabbing his younger brother Tanimnui Kucham to death.
He was arrested by a group of people said to be his family members and handed over to the Krachi East Municipal police.
Superintendent of Police, Samuel Aboagye, Krachi East Municipal Police Commander, who confirmed this to the Ghana News Agency (GNA), said the body of the deceased had been taken to Worawora Hospital for preservation and autopsy.
He said on November 12, 2019 at about 2130 hours, he had a phone call from the community about the incident and he quickly dispatched the Regional patrol team to the scene.
Mr Aboagye said the suspect however left the scene before the patrol team got there but on November 13, 2019 at 0627 hours he was arrested.
He said the suspect would soon be arraigned as they continued with investigations.
GNA


Welcome to the third project of the Machine Learning Engineer Nanodegree! In this notebook, some template code has already been provided for you, and it will be your job to implement the additional functionality necessary to successfully complete this project. Sections that begin with 'Implementation' in the header indicate that the following block of code will require additional functionality which you must provide. Instructions will be provided for each section and the specifics of the implementation are marked in the code block with a 'TODO'
statement. Please be sure to read the instructions carefully!
In addition to implementing code, there will be questions that you must answer which relate to the project and your implementation. Each section where you will answer a question is preceded by a 'Question X' header. Carefully read each question and provide thorough answers in the following text boxes that begin with 'Answer:'. Your project submission will be evaluated based on your answers to each of the questions and the implementation you provide.
Note: Code and Markdown cells can be executed using the Shift + Enter keyboard shortcut. In addition, Markdown cells can be edited by typically double-clicking the cell to enter edit mode.
In this project, you will analyze a dataset containing data on various customers' annual spending amounts (reported in monetary units) of diverse product categories for internal structure. One goal of this project is to best describe the variation in the different types of customers that a wholesale distributor interacts with. Doing so would equip the distributor with insight into how to best structure their delivery service to meet the needs of each customer.
The dataset for this project can be found on the UCI Machine Learning Repository. For the purposes of this project, the features 'Channel'
and 'Region'
will be excluded in the analysis — with focus instead on the six product categories recorded for customers.
Run the code block below to load the wholesale customers dataset, along with a few of the necessary Python libraries required for this project. You will know the dataset loaded successfully if the size of the dataset is reported.
# Import libraries necessary for this project
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from IPython.display import display # Allows the use of display() for DataFrames
# Import supplementary visualizations code visuals.py
import visuals as vs
# Pretty display for notebooks
%matplotlib inline
# Load the wholesale customers dataset
try:
data = pd.read_csv("customers.csv")
data.drop(['Region', 'Channel'], axis = 1, inplace = True)
print "Wholesale customers dataset has {} samples with {} features each.".format(*data.shape)
except:
print "Dataset could not be loaded. Is the dataset missing?"
In this section, you will begin exploring the data through visualizations and code to understand how each feature is related to the others. You will observe a statistical description of the dataset, consider the relevance of each feature, and select a few sample data points from the dataset which you will track through the course of this project.
Run the code block below to observe a statistical description of the dataset. Note that the dataset is composed of six important product categories: 'Fresh', 'Milk', 'Grocery', 'Frozen', 'Detergents_Paper', and 'Delicatessen'. Consider what each category represents in terms of products you could purchase.
# Display a description of the dataset
display(data.describe())
To get a better understanding of the customers and how their data will transform through the analysis, it would be best to select a few sample data points and explore them in more detail. In the code block below, add three indices of your choice to the indices
list which will represent the customers to track. It is suggested to try different sets of samples until you obtain customers that vary significantly from one another.
# TODO: Select three indices of your choice you wish to sample from the dataset
indices = [22, 165, 380]
# Create a DataFrame of the chosen samples
samples = pd.DataFrame(data.loc[indices], columns = data.keys()).reset_index(drop = True)
print "Chosen samples of wholesale customers dataset:"
display(samples)
import seaborn as sns
sns.heatmap((samples-data.mean())/data.std(ddof=0), annot=True, cbar=False, square=True)
Consider the total purchase cost of each product category and the statistical description of the dataset above for your sample customers.
What kind of establishment (customer) could each of the three samples you've chosen represent?
Hint: Examples of establishments include places like markets, cafes, and retailers, among many others. Avoid using names for establishments, such as saying "McDonalds" when describing a sample customer as a restaurant.
Answer: By looking at the data set above of 3 samples,
Sample 0 customer buys a lot of Fresh and Frozen products as compared to others. This might represent a big retailer.
Sample 1 customer buys Milk, Grocery and Detergents and Paper. This kind will likely represent a restaurant.
Sample 2 customer buys Fresh products more than anyone. This one also can represent a market/retailer dealing in fresh products mostly.
One interesting thought to consider is if one (or more) of the six product categories is actually relevant for understanding customer purchasing. That is to say, is it possible to determine whether customers purchasing some amount of one category of products will necessarily purchase some proportional amount of another category of products? We can make this determination quite easily by training a supervised regression learner on a subset of the data with one feature removed, and then score how well that model can predict the removed feature.
In the code block below, you will need to implement the following:
new_data
a copy of the data by removing a feature of your choice using the DataFrame.drop
function.sklearn.cross_validation.train_test_split
to split the dataset into training and testing sets.test_size
of 0.25
and set a random_state
.random_state
, and fit the learner to the training data.score
function.# TODO: Make a copy of the DataFrame, using the 'drop' function to drop the given feature
new_data = data.drop(['Delicatessen'], axis=1)
test_label = data['Delicatessen']
from sklearn.cross_validation import train_test_split
# TODO: Split the data into training and testing sets using the given feature as the target
X_train, X_test, y_train, y_test = train_test_split(new_data, test_label, test_size=0.25, random_state=2)
from sklearn.tree import DecisionTreeClassifier
# TODO: Create a decision tree regressor and fit it to the training set
regressor = DecisionTreeClassifier(random_state=2).fit(X_train, y_train)
# TODO: Report the score of the prediction using the testing set
score = regressor.score(X_test, y_test)
print score
Which feature did you attempt to predict? What was the reported prediction score? Is this feature necessary for identifying customers' spending habits?
Hint: The coefficient of determination, R^2
, is scored between 0 and 1, with 1 being a perfect fit. A negative R^2
implies the model fails to fit the data.
Answer: I attempted to predict 'Delicatessen'.
The prediction score given by Decision tree is 0.00909
Since the score predicted is very less if we remove this feature, it means by dropping this feature necessary information will be lost in correctly predicting the customer behavior.
Delicatessen feature thus is important part of the data and cannot be removed.
To get a better understanding of the dataset, we can construct a scatter matrix of each of the six product features present in the data. If you found that the feature you attempted to predict above is relevant for identifying a specific customer, then the scatter matrix below may not show any correlation between that feature and the others. Conversely, if you believe that feature is not relevant for identifying a specific customer, the scatter matrix might show a correlation between that feature and another feature in the data. Run the code block below to produce a scatter matrix.
corr = data.corr()
mask = np.zeros_like(corr)
mask[np.triu_indices_from(mask, 1)] = True
with sns.axes_style("white"):
ax = sns.heatmap(corr, mask=mask, square=True, annot=True,
cmap='RdBu', fmt='+.3f')
plt.xticks(rotation=45, ha='center')
# Produce a scatter matrix for each pair of features in the data
pd.scatter_matrix(data, alpha = 0.3, figsize = (14,8), diagonal = 'kde');
Are there any pairs of features which exhibit some degree of correlation? Does this confirm or deny your suspicions about the relevance of the feature you attempted to predict? How is the data for those features distributed?
Hint: Is the data normally distributed? Where do most of the data points lie?
Answer: The pair of features exhibiting some type of correlation are [Milk, Grocery], [Grocery, Detergents_Paper].
From the above data, Delicatessen feature doesn't seem to have any correlation between any other features. All the features when compared to Deli are bunched near the origin and thus don't have a normalized distribution.
This denies my suspicion about the relevance of the feature since the scatter matrix did not show any correlation between Deli and other features.
In this section, you will preprocess the data to create a better representation of customers by performing a scaling on the data and detecting (and optionally removing) outliers. Preprocessing data is often times a critical step in assuring that results you obtain from your analysis are significant and meaningful.
If data is not normally distributed, especially if the mean and median vary significantly (indicating a large skew), it is most often appropriate to apply a non-linear scaling — particularly for financial data. One way to achieve this scaling is by using a Box-Cox test, which calculates the best power transformation of the data that reduces skewness. A simpler approach which can work in most cases would be applying the natural logarithm.
In the code block below, you will need to implement the following:
log_data
after applying logarithmic scaling. Use the np.log
function for this.log_samples
after applying logarithmic scaling. Again, use np.log
.fig, axes = plt.subplots(2, 3)
axes = axes.flatten()
fig.set_size_inches(18, 6)
fig.suptitle('Distribution of Features')
for i, col in enumerate(data.columns):
feature = data[col]
sns.distplot(feature, label=col, ax=axes[i]).set(xlim=(-1000, 20000),)
axes[i].axvline(feature.mean(),linewidth=2, color='y')
axes[i].axvline(feature.median(),linewidth=1, color='r')
# TODO: Scale the data using the natural logarithm
log_data = np.log(data)
# TODO: Scale the sample data using the natural logarithm
log_samples = np.log(samples)
fig, axes = plt.subplots(2, 3)
axes = axes.flatten()
fig.set_size_inches(18, 6)
fig.suptitle('Distribution of Features for Log Data')
for i, col in enumerate(log_data.columns):
feature = log_data[col]
sns.distplot(feature, label=col, ax=axes[i])
axes[i].axvline(feature.mean(),linewidth=2, color='y')
axes[i].axvline(feature.median(),linewidth=1, color='r')
# Produce a scatter matrix for each pair of newly-transformed features
pd.scatter_matrix(log_data, alpha = 0.3, figsize = (14,8), diagonal = 'kde');
# set plot style & color scheme
sns.set_style('ticks')
with sns.color_palette("Reds_r"):
# plot densities of log data
plt.figure(figsize=(8,4))
for col in data.columns:
sns.kdeplot(log_data[col], shade=True)
plt.legend(loc='best')
After applying a natural logarithm scaling to the data, the distribution of each feature should appear much more normal. For any pairs of features you may have identified earlier as being correlated, observe here whether that correlation is still present (and whether it is now stronger or weaker than before).
Run the code below to see how the sample data has changed after having the natural logarithm applied to it.
# Display the log-transformed sample data
display(log_samples)
Detecting outliers in the data is extremely important in the data preprocessing step of any analysis. The presence of outliers can often skew results which take into consideration these data points. There are many "rules of thumb" for what constitutes an outlier in a dataset. Here, we will use Tukey's Method for identfying outliers: An outlier step is calculated as 1.5 times the interquartile range (IQR). A data point with a feature that is beyond an outlier step outside of the IQR for that feature is considered abnormal.
In the code block below, you will need to implement the following:
Q1
. Use np.percentile
for this.Q3
. Again, use np.percentile
.step
.outliers
list.NOTE: If you choose to remove any outliers, ensure that the sample data does not contain any of these points!
Once you have performed this implementation, the dataset will be stored in the variable good_data
.
# For each feature find the data points with extreme high or low values
for feature in log_data.keys():
# TODO: Calculate Q1 (25th percentile of the data) for the given feature
Q1 = np.percentile(log_data[feature], 25.0)
# TODO: Calculate Q3 (75th percentile of the data) for the given feature
Q3 = np.percentile(log_data[feature], 75.0)
# TODO: Use the interquartile range to calculate an outlier step (1.5 times the interquartile range)
step = (Q3 - Q1) * 1.5
# Display the outliers
print "Data points considered outliers for the feature '{}':".format(feature)
display(log_data[~((log_data[feature] >= Q1 - step) & (log_data[feature] <= Q3 + step))])
# OPTIONAL: Select the indices for data points you wish to remove
outliers = [65, 66, 75, 128, 154]
# Remove the outliers, if any were specified
good_data = log_data.drop(log_data.index[outliers]).reset_index(drop = True)
Are there any data points considered outliers for more than one feature based on the definition above? Should these data points be removed from the dataset? If any data points were added to the outliers
list to be removed, explain why.
Answer:
There are some data points which are categorized as outliers in atleast 2 features. The data points added to outliers list are: 65, 66, 75, 128, 154
These points should be removed from the dataset because these data points don't lie within normalized distribution range for two or more features. By removing these outliers, we can then correctly classify other data points.
In this section you will use principal component analysis (PCA) to draw conclusions about the underlying structure of the wholesale customer data. Since using PCA on a dataset calculates the dimensions which best maximize variance, we will find which compound combinations of features best describe customers.
Now that the data has been scaled to a more normal distribution and has had any necessary outliers removed, we can now apply PCA to the good_data
to discover which dimensions about the data best maximize the variance of features involved. In addition to finding these dimensions, PCA will also report the explained variance ratio of each dimension — how much variance within the data is explained by that dimension alone. Note that a component (dimension) from PCA can be considered a new "feature" of the space, however it is a composition of the original features present in the data.
In the code block below, you will need to implement the following:
sklearn.decomposition.PCA
and assign the results of fitting PCA in six dimensions with good_data
to pca
.log_samples
using pca.transform
, and assign the results to pca_samples
.from sklearn.decomposition import PCA
# TODO: Apply PCA by fitting the good data with the same number of dimensions as features
pca = PCA(n_components=6).fit(good_data)
# TODO: Transform log_samples using the PCA fit above
pca_samples = pca.transform(log_samples)
# Generate PCA results plot
pca_results = vs.pca_results(good_data, pca)
How much variance in the data is explained in total by the first and second principal component? What about the first four principal components? Using the visualization provided above, discuss what the first four dimensions best represent in terms of customer spending.
Hint: A positive increase in a specific dimension corresponds with an increase of the positive-weighted features and a decrease of the negative-weighted features. The rate of increase or decrease is based on the individual feature weights.
Answer: The variance in data explained by first and second PCA is 0.7068 or 70.68%
The variance explained by first four PCA dimensions is 0.9311 or 93.11%
The dimensions representing customer spending is as follows:
Dimension-1 It indicates that customer spends more on Detergents_Paper and if customer spends more on Detergents_Paper it will also spend more on Milk and Groceries while spending less on Fresh products and Frozen items. This dimension is inclined to represent maybe a coffee/drinks restaurant.
Dimension-2 In this dimension, all the weights are positive. Customer spends most on Fresh products, Frozen and Deli items with less focus on Milk, Grocery but also buys other items like Milk, Grocery and Detergents_Paper. This will likely represent a market.
Dimension-3 Here customer spends most on Deli and frozen products and doesn't focus on buying Fresh products and Detergents and paper. This most likely represents a Deli restaurant.
Dimension-4 This dimension is represented by Frozen. A customer buys more of Frozen products and Detergents and Paper while keeping away from Deli items and Fresh produce.
Run the code below to see how the log-transformed sample data has changed after having a PCA transformation applied to it in six dimensions. Observe the numerical value for the first four dimensions of the sample points. Consider if this is consistent with your initial interpretation of the sample points.
# Display sample log-data after having a PCA transformation applied
display(pd.DataFrame(np.round(pca_samples, 4), columns = pca_results.index.values))
When using principal component analysis, one of the main goals is to reduce the dimensionality of the data — in effect, reducing the complexity of the problem. Dimensionality reduction comes at a cost: Fewer dimensions used implies less of the total variance in the data is being explained. Because of this, the cumulative explained variance ratio is extremely important for knowing how many dimensions are necessary for the problem. Additionally, if a signifiant amount of variance is explained by only two or three dimensions, the reduced data can be visualized afterwards.
In the code block below, you will need to implement the following:
good_data
to pca
.good_data
using pca.transform
, and assign the results to reduced_data
.log_samples
using pca.transform
, and assign the results to pca_samples
.# TODO: Apply PCA by fitting the good data with only two dimensions
pca = PCA(n_components=2).fit(good_data)
# TODO: Transform the good data using the PCA fit above
reduced_data = pca.transform(good_data)
# TODO: Transform log_samples using the PCA fit above
pca_samples = pca.transform(log_samples)
# Create a DataFrame for the reduced data
reduced_data = pd.DataFrame(reduced_data, columns = ['Dimension 1', 'Dimension 2'])
Run the code below to see how the log-transformed sample data has changed after having a PCA transformation applied to it using only two dimensions. Observe how the values for the first two dimensions remains unchanged when compared to a PCA transformation in six dimensions.
# Display sample log-data after applying PCA transformation in two dimensions
display(pd.DataFrame(np.round(pca_samples, 4), columns = ['Dimension 1', 'Dimension 2']))
A biplot is a scatterplot where each data point is represented by its scores along the principal components. The axes are the principal components (in this case Dimension 1
and Dimension 2
). In addition, the biplot shows the projection of the original features along the components. A biplot can help us interpret the reduced dimensions of the data, and discover relationships between the principal components and original features.
Run the code cell below to produce a biplot of the reduced-dimension data.
# Create a biplot
vs.biplot(good_data, reduced_data, pca)
Once we have the original feature projections (in red), it is easier to interpret the relative position of each data point in the scatterplot. For instance, a point the lower right corner of the figure will likely correspond to a customer that spends a lot on 'Milk'
, 'Grocery'
and 'Detergents_Paper'
, but not so much on the other product categories.
From the biplot, which of the original features are most strongly correlated with the first component? What about those that are associated with the second component? Do these observations agree with the pca_results plot you obtained earlier?
In this section, you will choose to use either a K-Means clustering algorithm or a Gaussian Mixture Model clustering algorithm to identify the various customer segments hidden in the data. You will then recover specific data points from the clusters to understand their significance by transforming them back into their original dimension and scale.
What are the advantages to using a K-Means clustering algorithm? What are the advantages to using a Gaussian Mixture Model clustering algorithm? Given your observations about the wholesale customer data so far, which of the two algorithms will you use and why?
Answer:
Advantages of K-means:
Reference:
Advantages of Gaussian Mixture Model:
In hard classification (like in K-means), a data point is assigned to let's say cluster A with 100% probability or belief that it belongs to cluster A. As the algorithm progresses, it might reverse it belief that the same data point now belongs to another cluster, Cluster B, but with same 100% probability that it belongs to this new cluster. In effect, in every iteration, the cluster assignment is hard in sense that either a data point belong to Cluster or not.
In Soft classification (like in GMM), a data point is assigned to Cluster A with some probability like 90%. At the same time the data point also has 10% OF chance that it belongs to Cluster B. In the next iteration, algorithm will recalculate cluster centers and it might lower the chance that data point now has 80% chance of belonging to Cluster A and 20% chance of belonging to Cluster B. GMM incorporates this degree of uncertainity into the algorithm.
References:
Based on the dataset and PCA analysis, it looks like some of the data points (customers) doesn't really belong to a particular group. The PCA dimension-2 group can be seen as this example. Customers buying Fresh, Frozen and Deli can also be loosely placed in group of customers buying more Frozen items or Deli items. For this reason, Gaussian Mixture model is more appropriate to use.
Depending on the problem, the number of clusters that you expect to be in the data may already be known. When the number of clusters is not known a priori, there is no guarantee that a given number of clusters best segments the data, since it is unclear what structure exists in the data — if any. However, we can quantify the "goodness" of a clustering by calculating each data point's silhouette coefficient. The silhouette coefficient for a data point measures how similar it is to its assigned cluster from -1 (dissimilar) to 1 (similar). Calculating the mean silhouette coefficient provides for a simple scoring method of a given clustering.
In the code block below, you will need to implement the following:
reduced_data
and assign it to clusterer
.reduced_data
using clusterer.predict
and assign them to preds
.centers
.pca_samples
and assign them sample_preds
.sklearn.metrics.silhouette_score
and calculate the silhouette score of reduced_data
against preds
.score
and print the result.from sklearn.mixture import GMM
# TODO: Apply your clustering algorithm of choice to the reduced data
clusterer = GMM(n_components=2).fit(reduced_data)
# TODO: Predict the cluster for each data point
preds = clusterer.predict(reduced_data)
# TODO: Find the cluster centers
centers = clusterer.means_
# TODO: Predict the cluster for each transformed sample data point
sample_preds = clusterer.predict(pca_samples)
from sklearn.metrics import silhouette_score
# TODO: Calculate the mean silhouette coefficient for the number of clusters chosen
score = silhouette_score(reduced_data, preds)
print score
Report the silhouette score for several cluster numbers you tried. Of these, which number of clusters has the best silhouette score?
Answer:
| Number of Clusters | Silhouette Score |
|---|---|
| 2 | 0.41181 |
| 3 | 0.37245 |
| 5 | 0.29544 |
| 7 | 0.32197 |
| 11 | 0.25546 |
| 15 | 0.22718 |
| 30 | 0.18454 |
| 130 | 0.12487 |
| 205 | 0.22035 |
| 435 | 0.29435 |
The number of clusters with best silhouette score is 2.
Once you've chosen the optimal number of clusters for your clustering algorithm using the scoring metric above, you can now visualize the results by executing the code block below. Note that, for experimentation purposes, you are welcome to adjust the number of clusters for your clustering algorithm to see various visualizations. The final visualization provided should, however, correspond with the optimal number of clusters.
# Display the results of the clustering from implementation
vs.cluster_results(reduced_data, preds, centers, pca_samples)
Each cluster present in the visualization above has a central point. These centers (or means) are not specifically data points from the data, but rather the averages of all the data points predicted in the respective clusters. For the problem of creating customer segments, a cluster's center point corresponds to the average customer of that segment. Since the data is currently reduced in dimension and scaled by a logarithm, we can recover the representative customer spending from these data points by applying the inverse transformations.
In the code block below, you will need to implement the following:
centers
using pca.inverse_transform
and assign the new centers to log_centers
.np.log
to log_centers
using np.exp
and assign the true centers to true_centers
.# TODO: Inverse transform the centers
log_centers = pca.inverse_transform(centers)
# TODO: Exponentiate the centers
true_centers = np.exp(log_centers)
# Display the true centers
segments = ['Segment {}'.format(i) for i in range(0,len(centers))]
true_centers = pd.DataFrame(np.round(true_centers), columns = data.keys())
true_centers.index = segments
display(true_centers)
import seaborn as sns
sns.heatmap((true_centers-data.mean())/data.std(ddof=1), annot=True, cbar=False, square=True)
Consider the total purchase cost of each product category for the representative data points above, and reference the statistical description of the dataset at the beginning of this project. What set of establishments could each of the customer segments represent?
Hint: A customer who is assigned to 'Cluster X'
should best identify with the establishments represented by the feature set of 'Segment X'
.
Answer: Based on the cluster centers in above figure and the statistical representation
Segment 1 will then represent coffee/drink restaurant and Segment 0 will represent a prepared foods industry like catering for airline etc.
For each sample point, which customer segment from Question 8 best represents it? Are the predictions for each sample point consistent with this?
Run the code block below to find which cluster each sample point is predicted to be.
# Display the predictions
for i, pred in enumerate(sample_preds):
print "Sample point", i, "predicted to be in Cluster", pred
Answer:
Sample points 1 & 2 are predicted correctly. It looks like sample point 0 belongs more towards cluster 0, but is predicted to be in cluster 1.
In this final section, you will investigate ways that you can make use of the clustered data. First, you will consider how the different groups of customers, the customer segments, may be affected differently by a specific delivery scheme. Next, you will consider how giving a label to each customer (which segment that customer belongs to) can provide for additional features about the customer data. Finally, you will compare the customer segments to a hidden variable present in the data, to see whether the clustering identified certain relationships.
Companies will often run A/B tests when making small changes to their products or services to determine whether making that change will affect its customers positively or negatively. The wholesale distributor is considering changing its delivery service from currently 5 days a week to 3 days a week. However, the distributor will only make this change in delivery service for customers that react positively. How can the wholesale distributor use the customer segments to determine which customers, if any, would react positively to the change in delivery service?
Hint: Can we assume the change affects all customers equally? How can we determine which group of customers it affects the most?
Answer: Segment 1 customers buys more of Milk, Grocery and Detergent and Paper while Segment 0 customers buys more of Fresh products and Frozen items.
Distributor can first select segment 1 customers since Milk, Grocery items need not be delivered everyday and can work with reduced number of days. Distributor can then perform A/B test by dividing the segment 0 customers into two where one group will receive shipments 5 days a week and other group 3 days a week. Based on the response of two groups, if the group with shipment of 3 days respond positively, distributor can choose to switch customers of segment 1 to 3 day shipments.
Similarly, customers in Segment 0 order more Fresh produce which might make customers unhappy about 3 day shipment as fresh produce will not be much 'fresh' as compared to 5 day delivery.
However, all customers in segment 1 cannot be considered as equally since some customers may specifically require 5 day delivery to maintain fresh stock.
Additional structure is derived from originally unlabeled data when using clustering techniques. Since each customer has a customer segment it best identifies with (depending on the clustering algorithm applied), we can consider 'customer segment' as an engineered feature for the data. Assume the wholesale distributor recently acquired ten new customers and each provided estimates for anticipated annual spending of each product category. Knowing these estimates, the wholesale distributor wants to classify each new customer to a customer segment to determine the most appropriate delivery service.
How can the wholesale distributor label the new customers using only their estimated product spending and the customer segment data?
Hint: A supervised learner could be used to train on the original customers. What would be the target variable?
Answer: By combining the customer segment data as a new feature with the 6 original features, distributor can use supervised learning algorithm like Decision Trees or Gradient Boosting to train and predict a customer's delivery schedule based on the results of A/B testing done earlier.
The target variable will then be delivery schedule for new customers.
At the beginning of this project, it was discussed that the 'Channel'
and 'Region'
features would be excluded from the dataset so that the customer product categories were emphasized in the analysis. By reintroducing the 'Channel'
feature to the dataset, an interesting structure emerges when considering the same PCA dimensionality reduction applied earlier to the original dataset.
Run the code block below to see how each data point is labeled either 'HoReCa'
(Hotel/Restaurant/Cafe) or 'Retail'
the reduced space. In addition, you will find the sample points are circled in the plot, which will identify their labeling.
# Display the clustering results based on 'Channel' data
vs.channel_results(reduced_data, outliers, pca_samples)
How well does the clustering algorithm and number of clusters you've chosen compare to this underlying distribution of Hotel/Restaurant/Cafe customers to Retailer customers? Are there customer segments that would be classified as purely 'Retailers' or 'Hotels/Restaurants/Cafes' by this distribution? Would you consider these classifications as consistent with your previous definition of the customer segments?
Answer:
The clustering algorithm does well in predicting 2 as the number of clusters. Seeing the distribution above for 'Channel' feature, the clustering algorithm also predicts nearly same distribution.
Yes, based on the above distribution visualizing 'Channel' feature, most of the customers belong to either one of the customer segments and can be classified as 'Retailers' or 'Hotel/Restaurants/Cafe'.
Yes, the clustering algorithm was able to find a distribution similar to above one based on the 6 features and not including 'Channel' feature and came to same conclusion by giving two segments/clusters as output.
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
File -> Download as -> HTML (.html). Include the finished document along with this notebook as your submission.


Man arrested after Pennsylvania police find him using thermal, night vision technology
by WPXI.comJACKSON TOWNSHIP, Pa. -
A man was arrested after a search on the ground and in the air followed a shooting, Pennsylvania police said.
According to court documents, police were called about a possible drunken driver heading toward Zelienople from Beaver County. The driver, a man, was believed to be suicidal and armed with a handgun. He was involved in a prior shooting in Rochester in Beaver County.
The car was being tracked using the onboard GPS and dispatchers relayed to police that it had stopped at a Speedway gas station in Jackson Township.
When police got there, the man ran from the convenience store and into the woods nearby. A K-9 was brought in to track him on the ground while a state police helicopter was called in to use thermal and night vision technology from the air.
The man was found after a short time and arrested. He is charged with felonious aggravated assault among other charges.
Police have not yet released his identity.


--- title: Classes heading: View more about each of our locations description: classes_table: - name: Ray Elementary, Hyde Park color: "#8e8e8e" features: - text: Beginners Wednesday 4-5 highlight: false - text: Advanced Thursday 4-5 highlight: false call_to_action: link: /enroll/ text: Enroll in Class - name: Woodlawn Center color: "#4a4a4a" features: - text: Open Tuesdays and Thursdays 3-5 highlight: false - text: open for all ages - kids under 10 must be accompanied highlight: true call_to_action: link: http://blog.artificechicago.org/p/favorites.html text: See what we've been working on - name: Hyde Park Neighborhood Club color: "#a4a4a4" features: - text: Available to HPNC students highlight: false - text: Postponed for Fall 2018 highlight: true call_to_action: link: http://hpnclub.org/index.php/about/contact-us/ text: Contact HPNC to learn more - name: Bret Harte Elementary, Hyde Park color: "#1b1b1b" features: - text: "Thursday 3:30-6" highlight: false call_to_action: link: /contact/ text: Contact us to learn more faq: - question: How do I know if I'm signed up for a class? answer: If you have completed the form and made your payment, you are signed up. Sometimes schools don't update their class rosters frequently. - question: A class has already started for this quarter. Can I still join? answer: Possible, you can join up to a few weeks after the start if you are willing to put in the effort to catch up. - question: What kinds of things do you teach? answer: We teach a variety of tech skills. Check out our course material for more information. - question: Can you offer classes at my organization? answer: Possibly, we are always looking for partner organizations if we have volunteer bandwidth. Feel free to contact us with opportunities. - question: Any other questions? answer: Contact us for any further questions<EMAIL_ADDRESS>---
Check out our Events Calendar for more events.


Jailhouse Rock (1957)
Grade: 74
"Jailhouse Rock" is Elvis Presley's best film. He plays an ex-convict struggling to becoming a star as a pop singer. His business partner and would-be girlfriend is Judy Tyler. Presley's character achieves fame and fortune as a recording artist and movie star, but has he surrendered his humanity and values in a greedy and decadent lifestyle?
Elvis Presley had much in common with Frank Sinatra and Bing Crosby. They all were fabulously successful American singers whose fame and charisma also extended to successful film careers. But while Sinatra and Crosby would eventually win Academy Awards, Presley was not as fortunate. Some of his early films were passable, but as Hollywood moguls tried to mine his popularity, the movies came quicker and the scripts grew worse and worse. By the time his studio contracts had been fulfilled, his career had nearly been destroyed.
It is no wonder that most Presley films are terrible. Because there was a soundtrack album to sell, the film had to be laden with songs. This meant that Presley had to portray a singer, and the plot would have to be stripped. He had to have someone to sing to, which meant one or more pretty girls. Add fancy cars and a tropical locale, and what else would be needed to bring the teenagers to the drive-in?
"Jailhouse Rock" was Presley's third film, made at the peak of his career, and before the formula had taken over. Yes, he plays a singer, but the Lieber-Stoller songs are top-notch. He also has a surly attitude, and the party atmosphere of later films is missing. Best of all, the script is terrific, only occasional stumbling to underscore his platonic romance with Judy Tyler or to moralize over his loss of values.
http://members.tripod.com/~Brian_Koller/movies.html
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


[name]
This is a superefficent class for geometries because it saves all data in buffers.
It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the nessecary buffer calculations.
It is mainly interesting when working with static objects.
Constructor
[name]()
This creates a new [name]. It also sets several properties to an default value.
Properties
.[page:Integer id]
Unique number of this buffergeometry instance
.[page:Hashmap Attributes]
This hashmap has as id the name of the attribute to be set and as value the buffer to set it to.
.[page:Boolean dynamic]
When set, it holds certain buffers in memory to have faster updates for this object. When unset, it deletes those buffers and saves memory.
.[page:Array offsets]
This Array should contain every offset at which the buffers should be rendered. This is important for indexed buffers.
.[page:Object boundingBox]
Bounding box.
{ min: new THREE.Vector3(), max: new THREE.Vector3() }
.[page:Object boundingSphere]
Bounding sphere.
{ radius: float }
.[page:Array morphTargets]
Array of morph targets. Each morph target is a Javascript object:
{ name: "targetName", vertices: [ new THREE.Vertex(), ... ] }
Morph vertices match number and order of primary vertices.
Methods
.applyMatrix( [page:Matrix4 matrix] )
Bakes matrix transform directly into vertex coordinates.
.computeVertexNormals()
Computes vertex normals by averaging face normals.
.computeTangents()
Computes vertex tangents.
Based on [link:http://www.terathon.com/code/tangent.html]
Geometry must have vertex [page:UV UVs] (layer 0 will be used).
.computeBoundingBox()
Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are *null*.
.computeBoundingSphere()
Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
Bounding spheres aren't' computed by default. They need to be explicitly computed, otherwise they are *null*.
.dispose()
Disposes the object from memory.
You need to call this when you want the bufferGeometry removed while the application is running.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]


The aim of the NTPsec project is high security, availability, and assurance. The more code we can throw away, the fewer potential vulnerabilities and complexity issues we will have.
Accordingly, we have already removed many obsolete features, and have a schedule of more feature removals planned. If something on this list is important to you, tell us. If the complexity cost of keeping it is low, you win. If the complexity cost is high, then we will need a donation of engineering time or money to support keeping it in the codebase.
Removals already complete
The ntpdc utility has been entirely removed. (All its capabilities are available through ntpq with a similar user unterface.) Support for Mode 7 packets in ntpd has been removed along with it, significantly reducing total attack surface and code complexity.
The ntpsnmpd daemon, being half-complete and not fully conformant with RFC 5907, has been removed. In a future release we would be open to replacing it with a conformant implementation.
The long-deprecated ntpdate program has been replaced with a shell wrapper around ntpdig.
We have removed the following refclock drivers, which were either broken and won’t compile on modern systems (12, 21), or irretrievably obsolete due to the WWVB modulation change in 2013 (3, 19, 32, 34, 36), or had unfixable Y2K issues (37), or unfixable security issues (16, 43), or were deprecated in NTP Classic and had their documentation removed (13, 14, 17).
Type 3: PSTI/Traconex 1020 WWV/WWVH Receiver (WWV_PST) |
Type 12: KSI/Odetics TPRO/S IRIG Interface |
Type 13: Leitch CSD 5300 Master Clock Controller (ATOM_LEITCH) |
Type 14: EES M201 MSF Receiver (REFCLOCK_MSF_EES) |
Type 16: Bancomm GPS/IRIG Receiver (GPS_BANCOMM) |
Type 17: Datum Precision Time System (GPS_DATUM) |
Type 19: Heath WWV/WWVH Receiver (WWV_HEATH) |
Type 21: TrueTime GPS-VME Interface (GPS_VME) |
Type 32: Chrono-log K-series WWVB receiver (CHRONOLOG) |
Type 34: Ultralink WWVB Receivers (ULINK) |
Type 36: Radio WWV/H Audio Demodulator/Decoder (WWV) |
Type 37: Forum Graphic GPS Dating station (FG) |
Type 43: RIPE NCC interface for Trimble Palisade |
In addition, support for WWVB and OMEGA has been removed from the Type 5 (TrueTime) driver. Support for GPS and GOES has been retained.
You may be unable to build NTPsec on a sufficiently archaic big-iron Unix platform. Support for the native APIs of any version that last shipped in the last century has been removed. The codebase assumes full POSIX.1-2001 and C99 conformance including ANSI pthreads; in some cases you may be able to meet this requirement by upgrading to a modern GCC- or clang-based toolchain.
Platform-dependent kernel-space code that raised potential security issues has been removed. No programs access /dev/kmem directly any longer, and STREAMS support for the parse driver has been deleted.
Support for VMS has been removed, and is unlikely to be restored unless that platform has achieved effectively full standards conformance and someone interested throws engineering time and money at us. Likewise for VxWorks.
Suppressed code
While we have not removed the Windows code, we will not ship with Windows supported until that platform has an active port maintainer.
An implementation of the Autokey public-key-based authentication system is still present in the codebase, but we don’t support building with it. This feature is broken and has serious security vulnerabilities. One of our longer-term projects is to re-engineer it.
Obsolete refclocks
We consider a refclock driver obsolete if it fails any of the following tests:
-
It has been discontinued for seven or more years and cannot be found for sale on the Web. Types 5, 9, 10, 26, 27, 35, 37, 38, 41.
-
Duplicates capabilities of GPSD, which specializes in GPSes. Types 20, 29, 30, 31.
-
Deprecated by the NTP Classic documentation in favor of orphan mode (type 1).
-
Accuracy an order of magnitude worse than a cheap 1PPS GPS. Types 6, 7, 33.
Thus, we plan to remove the following refclock drivers:
Type 1: Undisciplined Local Clock |
Type 5: TrueTime GPS/GOES Receivers (TRUETIME) |
Type 6: IRIG Audio Decoder (IRIG_AUDIO) |
Type 7: Radio CHU Audio Demodulator/Decoder (CHU) |
Type 9: Magnavox MX4200 GPS Receiver (GPS_MX4200) |
Type 10: Austron 2200A/2201A GPS Receivers (GPS_AS2201) |
Type 20: Generic NMEA GPS Receiver (NMEA) |
Type 27: Arcron MSF Receiver (MSF_ARCRON) |
Type 29: Trimble Navigation Palisade GPS (GPS_PALISADE) |
Type 30: Motorola UT Oncore GPS (GPS_ONCORE) |
Type 31: Rockwell Jupiter GPS (GPS_JUPITER) |
Type 33: Dumb Clock (DUMBCLOCK) |
Type 35: Conrad Parallel Port Radio Clock (PCF) |
Type 38: hopf GPS/DCF77 6021/komp for Serial Line (HOPF_S) |
Type 41: TrueTime 560 IRIG-B Decoder (REFCLK_TT560) |
Removing 6 and 7 means we will be able to remove all the hair for audio card support.
This will leave the following drivers in place:
Type 4: Spectracom GPS Receivers (SPECTRACOM) |
Type 8: Generic Reference Driver (PARSE) |
Type 11: Arbiter 1088A/B GPS Receiver (GPS_ARBITER) |
Type 18: NIST/USNO/PTB Modem Time Services (ACTS_MODEM) |
Type 22: PPS Clock Discipline (PPS) |
Type 26: Hewlett Packard 58503A GPS Receiver (GPS_HP) |
Type 28: Shared Memory Driver (SHM) |
Type 39: hopf GPS/DCF77 6039 for PCI-Bus (HOPF_P) |
Type 40: JJY Receivers (JJY) |
Type 42: Zyfer GPStarplus Receiver |
Type 44: NeoClock4X - DCF77 / TDF serial line |
Type 45: Spectracom TSync PCI |
Type 46: GPSD NG client protocol |
For details on the technical considerations, see our NTPD driver retention analysis.


No session recording is currently open. Please select a recording to view.
The selected recording cannot be played. The recording may be corrupt, or you may not have permission to read the recording. Please select a different recording.


| Exported Interfaces - Summary |
| XTextTable |
- (referenced entity's summary:)
- manages a text table.
|
| ::com::sun::star::container::XNamed |
- (referenced entity's summary:)
- specifies the name of the object.
|
| ::com::sun::star::table::XCellRange |
- (referenced entity's summary:)
- provides access to the cells or to sub-ranges of a cell range.
|
| ::com::sun::star::chart::XChartDataArray |
- (referenced entity's summary:)
- gives access to data represented as an array of rows.
|
| ::com::sun::star::table::XAutoFormattable |
- (referenced entity's summary:)
- provides a method to apply TableAutoFormats to a cell range.
|
| ::com::sun::star::util::XSortable |
- (referenced entity's summary:)
- makes it possible to sort the contents of this object.
|
| ::com::sun::star::sheet::XCellRangeData |
|
| Properties' Summary |
::com::sun::star::style::BreakType
BreakType |
determins the type of break that is applied at the beginning of the table. |
long
LeftMargin |
contains the left margin of the table.
|
long
RightMargin |
contains the right margin of the table.
|
short
HoriOrient |
contains the horizontal orientation. |
boolean
KeepTogether |
Setting this property to TRUE prevents page or column
breaks between this table and the following paragraph or text table.
|
boolean
Split |
Setting this property to FALSE prevents the table from
getting spread on two pages.
|
short
PageNumberOffset |
If a page break property is set at the table,
this property contains the new value for the page number.
|
string
PageDescName |
If this property is set, it creates a page break before the
table and assigns the value as the name of the new page style sheet to use.
|
short
RelativeWidth |
determins the width of the table relative to its environment.
|
boolean
IsWidthRelative |
determins if the value of the relative width is valid.
|
boolean
RepeatHeadline |
determins if the first row of the table is repeated on every new page.
|
long
HeaderRowCount |
[ OPTIONAL ]
determins the number of rows of the table repeated on every new page.
|
::com::sun::star::table::ShadowFormat
ShadowFormat |
determins the type, color and size of the shadow. |
long
TopMargin |
determins the top margin.
|
long
BottomMargin |
determins the bottom margin.
|
boolean
BackTransparent |
determins if the background color is transparent.
|
long
Width |
contains the absolute table width.
|
boolean
ChartRowAsLabel |
determins if the first row of the table should be treated as
axis labels when a chart is to be created.
|
boolean
ChartColumnAsLabel |
determins if the first column of the table should be treated as
axis labels when a chart is to be created.
|
::com::sun::star::table::TableBorder
TableBorder |
contains the description of the table borders. |
sequence< TableColumnSeparator >
TableColumnSeparators |
contains the column description of the table.
|
short
TableColumnRelativeSum |
contains the sum of the column width values used in TableColumnSeparators.
|
::com::sun::star::util::Color
BackColor |
contains the color of the background.
|
string
BackGraphicURL |
contains the URL for the background graphic.
|
string
BackGraphicFilter |
contains the name of the file filter for the background graphic.
|
::com::sun::star::style::GraphicLocation
BackGraphicLocation |
determines the position of the background graphic. |
boolean
CollapsingBorders |
[ OPTIONAL ]
determines whether borders of neighbouring table cells are
* collapsed into one
|
| Properties' Details |
| BreakType
|
LeftMargin
long LeftMargin;
- Description
- contains the left margin of the table.
|
|
RightMargin
long RightMargin;
- Description
- contains the right margin of the table.
|
|
| HoriOrient
|
KeepTogether
boolean KeepTogether;
- Description
- Setting this property to TRUE prevents page or column
breaks between this table and the following paragraph or text table.
|
|
Split
boolean Split;
- Description
- Setting this property to FALSE prevents the table from
getting spread on two pages.
|
|
PageNumberOffset
short PageNumberOffset;
- Description
- If a page break property is set at the table,
this property contains the new value for the page number.
|
|
PageDescName
string PageDescName;
- Description
- If this property is set, it creates a page break before the
table and assigns the value as the name of the new page style sheet to use.
|
|
RelativeWidth
short RelativeWidth;
- Description
- determins the width of the table relative to its environment.
|
|
IsWidthRelative
boolean IsWidthRelative;
- Description
- determins if the value of the relative width is valid.
|
|
RepeatHeadline
boolean RepeatHeadline;
- Description
- determins if the first row of the table is repeated on every new page.
|
|
HeaderRowCount
long HeaderRowCount;
- Usage Restrictions
- optional
- Description
- determins the number of rows of the table repeated on every new page.
|
|
| ShadowFormat
|
TopMargin
long TopMargin;
- Description
- determins the top margin.
|
|
BottomMargin
long BottomMargin;
- Description
- determins the bottom margin.
|
|
BackTransparent
boolean BackTransparent;
- Description
- determins if the background color is transparent.
|
|
Width
long Width;
- Description
- contains the absolute table width.
As this is only a describing property the value of the actual table may vary depending on the
environment the table is located in and the settings of LeftMargin,
RightMargin and HoriOrient.
|
|
ChartRowAsLabel
boolean ChartRowAsLabel;
- Description
- determins if the first row of the table should be treated as
axis labels when a chart is to be created.
|
|
ChartColumnAsLabel
boolean ChartColumnAsLabel;
- Description
- determins if the first column of the table should be treated as
axis labels when a chart is to be created.
|
|
| TableBorder
|
| TableColumnSeparators
|
TableColumnRelativeSum
short TableColumnRelativeSum;
- Description
- contains the sum of the column width values used in TableColumnSeparators.
|
|
BackColor
::com::sun::star::util::Color BackColor;
- Description
- contains the color of the background.
|
|
BackGraphicURL
string BackGraphicURL;
- Description
- contains the URL for the background graphic.
|
|
BackGraphicFilter
string BackGraphicFilter;
- Description
- contains the name of the file filter for the background graphic.
|
|
| BackGraphicLocation
|
CollapsingBorders
boolean CollapsingBorders;
- Usage Restrictions
- optional
- Description
- determines whether borders of neighbouring table cells are
* collapsed into one
|
|
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


@* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @this( main: views.html.main, viewsHelpers: views.ViewsHelpers, eligibilityConfig: ssttpeligibility.EligibilityServiceConfig ) @( signedIn: Boolean = false, isWelsh: Boolean)(implicit messages: play.api.i18n.Messages, request: Request[_], appConfig: config.AppConfig ) @main( title = Messages("ssttp.debt-too-large.h1") ) {
@Messages("ssttp.debt-too-large.p1", eligibilityConfig.maximumDebtForSelfServe )
@Messages("ssttp.debt-too-large.p2") @Messages("ssttp.debt-too-large.p2.number")


The vCity International Airport is not only a techsimm. Within the larger Zoning Volume there are places where real corporations have set up a VR shop. I notice that most major U.S. air carriers and many foreign national carriers have established links here. Clicking on one of the booths, I find myself in a 2D HTML-based environment -- a web page -- where I can order real tickets or obtain information on real travel schedules and frequent flier programs.
Oops. Back to the virtual reality, please.
The vCity International Airport is the busiest airport in the world. In 2001 it handled more than three hundred million visitors. Checking the data, I see that flow through has increased by 1% in the first three weeks of June. That means we're on target for something like a 20% increase for the year. That's just measuring the people coming through that gateway. The seaport handles some of the other inflow.
We really don't know exactly how many tourists the vCity gets every year. Once people have visited the vCity, they usually just beam to where they want to go, even though strictly speaking they should become vCitizens in order to do that. However, in the vCity world, there is no such thing as an illegal immigrant. You either become a vCitizen or you don't. If you do, you register your IP address and stake a claim to a Zoning Volume. If you don't, you're a welcome guest, and as we point out in the intro, "Stay as long as you please, and come back as often as you like!"


Click the accordions below to expand/collapse the accordion content.
This is the
#second
item accordion body. It is hidden by
default, until the collapse plugin adds the appropriate classes that we use to
style each element. These classes control the overall appearance, as well as
the showing and hiding via CSS transitions. You can modify any of this with
custom CSS or overriding our default variables. It's also worth noting
that just about any HTML can go within the .accordion-body,
though the transition does limit overflow.
Angular Accordion flush
Click the accordions below to expand/collapse the accordion content.


| implement by implementByItem |
The implement-by clause can only be used in a unit. See unit for the definition of a unit.
An implementByItem is one of:
| (a) | id | ||
| (b) | id in fileName |
The second form is used when the implement-by clause is for a separate unit and the imported item is in a file whose name is different from the item's name, as in:
The fileName must be an explicit character string, e.g., "ledgbod.t". See also unit. Parentheses are allowed around the items in an implement-by clauses, as in:
implement by ledgerBody in "ledgbod.t"
implement by ( ledgerBody in "ledgbod.t" )


Wagner eyes scalp of 'freak' Stokes
by Sports DeskBen Stokes is the scalp most prized by Neil Wagner after the England batsman finished day one of the first Test with New Zealand on 67 not out.
The tourists overcame a slow start and recovered from 120-3 to reach 241-4 by the close at Bay Oval.
Stokes – described by Wagner as "a bit of a freak" – was key to their revival, compiling his timely knock patiently as he faced 114 balls, sending nine to the boundary rope.
The all-rounder has proven a thorn in the Black Caps' side before, most notably in a superlative display at the Cricket World Cup final in July.
And left-arm seamer Wagner is determined not to give Stokes any more footage for his ever-expanding highlights reel.
"Ben is that sort of a player," said Wagner. "He is a special talent and he is a bit of a freak at times.

At the top of the order, Rory Burns made a half century but could have been sent packing with only 10 runs to his name when he appeared to edge Trent Boult.
However, the appeal was tame and dismissed, with no review taken, which proved a mistake – although an understandable one, according to Wagner.
"It's quite a tough ground. There was another one that sounded like a nick and was nowhere near the bat," he explained.
"When it's windy – and you don't always feel that from the grass banks – it's quite hard to hear those things.
"There was a little bit of a noise [for the Burns chance] but it was a bob each way; [sometimes] you want to take that risk but also you want to keep hold of them for when you do need them."


Apple Watch Series 6 expected to have improved water resistance, better performance
It's onward and upward for Apple Watch
by Shawn KnightBottom line: The Apple Watch Series 5 is already water resistant to 50 meters. Further bolstering its ability to stay dry might allow Apple to certify it for extreme activities like water skiing or scuba diving. And improved performance –whether courtesy of better wireless chips or a faster SoC – is always welcome.
The Apple Watch Series 5 is less than two months old at this point but already, some are shifting their focus to what might be next for Cupertino’s popular wearable.
Renowned Apple analyst Ming-Chi Kuo in recent a note to investors said he believes Apple’s Series 6 smartwatch will feature improved water resistance as well as faster performance and better wireless transmission for enhanced cellular / Wi-Fi speeds.
Key to delivering these enhancements will be a switch to liquid crystal polymer (LCP) for the flexible circuit boards in the new watches. Up to this point, Apple has used a material called polyimide (PI). Kuo’s note, seen by MacRumors, said the LCP will be supplied by at least three companies including Avary Holding, Dongshan Precision Flexium Interconnect.
This year’s Apple Watch refresh was relatively short on new features. Aside from introducing an always-on display and a built-in compass, where wasn’t much to get excited about versus last year’s model. Still, Apple is leading the pack in terms of shipments and that's great news for the company and investors alike.
Masthead credit: Apple Watch by Denys Prykhodov


| Methods' Summary |
| getImplementationName |
Provides the implementation name of the service implementation.
|
| supportsService |
Tests whether the specified service is supported, i.e. implemented
by the implementation.
|
| getSupportedServiceNames |
Provides the supported service names of the implementation, including
also indirect service names.
|
| Methods' Details |
getImplementationName
| string |
| getImplementationName(); |
- Description
- Provides the implementation name of the service implementation.
- Returns
- unique name of the implementation
|
|
supportsService
| boolean |
| supportsService( |
[in] string |
ServiceName ); |
- Description
- Tests whether the specified service is supported, i.e. implemented
by the implementation.
- Parameter ServiceName
- name of service to be tested
- Returns
- true, if service is supported, false otherwise
|
|
getSupportedServiceNames
| sequence< string > |
| getSupportedServiceNames(); |
- Description
- Provides the supported service names of the implementation, including
also indirect service names.
- Returns
- sequence of service names that are supported
|
|
Top of Page
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


Yelawolf Continues The Series With "Box Chevy 7"
Yelawolf's "Box Chevy" continues to rack up mileage.
by Mitch FindlayBox Chevy 7
Yelawolf
Editor Rating: VERY HOTTTTT
User Rating: very hottttt - 93% (25)
Any other year, we might have said it's been a minute since Yelawolf dropped new music. Yet the Alabama artist is only a few months removed from the release of Trunk Muzik 3, which marked his final release on Shady Records. Now, moving forward with his Slumerican banner held high, Wolf has dropped off a brand new album called Ghetto Cowboy. Though notably more melodic than its hard-hitting predecessor, Ghetto Cowboy highlights a different section of Yela's toolbox, one borne from his country and rock influences.
Yet hip-hop is part of his DNA, and thus the shades remain here. "Box Chevy 7," which marks yet another chapter in the iconic long-running series, takes a more subdued approach. Heavy synthesizers and pianos combine over up-tempo percussion, while Yela pens a love letter to his longtime vehicular bud. Plus, there's also a moral or two to be found within: "If I get drunk I'ma leave her, pick her up tomorrow, don't get behind the wheel if I'm pickin' up a bottle." Go support Yelawolf and stream Ghetto Cowboy here.
Quotable Lyrics
If I see two Maybachs, I'ma park it in the middle
Throw my keys at the butler and then get 'em
No ID, I'ma walk up through the middle
Candy-coated whip like a pocket full of Skittles
Money in my pocket but I don't know how to act right
Glock in the glove box like a flashlight
Cub in the mop-top in the backlight


DEBUG CONTROLS:
SAVE
LOAD
RESET
SUMMON BOSS
SUMMON AMBUSH
Actions
Monster
Orphan
Regions
Consume
Bind
Leave
Win
Lose
Escape
Diminished:
STATS
ABILITIES
0
/
1
/
+
[DANGEROUS]
Travel
Current Location
Fight Boss
Train
Activate
Deactivate


VERTINUM
Welcome to Vertinum Solutions!
We provide the best services and at affordable costs!
We make custom websites suited to YOUR NEEDS
Please provide the details mentioned below and we will get back to you ASAP.
©vertinumsolutions 2021


jQuery Flipping Gallery
Create a Flipping Awesome 3D Gallery with One Function Call
Created by
Pete R.
, Founder of
Travelistly
&
BucketListly
Download on Github
Click Me
Scroll Me
Previous
Next
Back to The Pete Design


History
Customer Relations
Projects
Tasks
Hours
Invoices
Projects
Project name
This is where the description of the project will come.
Time start
Time stop
Total
Day
Month
Year
15.00
22.00
8
21
01
14
12.00
19.00
7
18
01
14


Seven Heads Design is not a design agency. Not one of these people is an employee.
Brad Frost
@brad_frostExpertise
- Front End Development
- Usability Studies
- Workshops
Tim Kadlec
@tkadlecExpertise
- Front End Development
- Performance
- Workshops
- Looking good
Kevin Hoffman
@brad_frostExpertise
- Front End Development
- Usability Studies
- Workshops
Robert Jolly
@tkadlecExpertise
- Front End Development
- Performance
- Workshops
- Looking good
Jenn Lukas
@tkadlecExpertise
- Front End Development
- Performance
- Workshops
- Looking good
Kevin Sharon
@brad_frostExpertise
- Front End Development
- Usability Studies
- Workshops
Dan Rubin
@tkadlecExpertise
- Front End Development
- Performance
- Workshops
- Looking good
Interested in becoming a member of the network?


Emoji Selction Tech Demo
When I say "I am going to exercise today", then my friend reacts like ...
😀 Happy
😖 Confounded
😆 Excited
😫 Distraught
😅 Embarrassed
😭 Crying
🤣 Hilarious
😤 Angry
🥲 Bittersweet
🤬 More Angry
😍 Lovely
🤯 Furious


General support queries. User Guides: https://support.komodoplatform.com/ Support staff: Angelina#6231 gcharang#6833. If you want to ask JL777 a question, use the #ask-jl777 channel.
100 messages
Before 05-Dec-19 12:00 AM
Hermes10-Nov-18 06:10 PM
from CIpi "could be you are experiencing this issue: https://github.com/KomodoPlatform/BarterDEX/issues/128
AYWA has the default datadir/conf-file in an unusual location... ~/.aywacore/aywa.confinstead of ~/.aywa/aywa.conf, so the coins database entry for AWYA contains the additional parameter "conffile": https://github.com/jl777/coins/blob/master/coins#L78
BarterDEX needs to be able to find and open the coins config file
Look after this config file and check if it contains at least this entries
server=1
rpcuser=whatever
rpcpassword=whatever"
There's a bug in shepherd-ipc.js function ProcessCoinsList(coins) { ... Such configuration "confpath":"C:\Users\hanza\AppData\Roaming\terracoincore\terracoin.conf" wil...
Hi! Thank you for added coin in a shot time! We can't do any operations yet. The coin added as Native, wallet is stared. when trying to set a buy or sell order, getting this error at console: {...
Nabob10-Nov-18 06:42 PM
@Aywa Developers
you need to raise pull request to coin repo to add electrum to barterdex
coin parameters and all files needed for GUI support - jl777/coins
plazma11-Nov-18 08:10 AM
Can i switch between litemode and native of kmd in agama and use native pirate at the same time
Acura11-Nov-18 08:18 AM
Yes you can use lite mode kmd and pirate native at the same time
plazma11-Nov-18 08:22 AM
@Acura i want to use native kmd and pirate native but if situation call like net problem in future then i wana switch back to litemodo of kmd.....is it possible
@Hermes yes i use komodo native i got a new wallet
Hermes11-Nov-18 08:34 AM
If you want to switch to lite mode make sure you have the private keys of the address that has your funds in native , with this private key you can enter the lite mode version of the wallet when you need it
Always Backup your wallet.dat before making any changes!!
When you export the private keys in native mode remember that this private key is only for one specific address
And this private key can be used in lite mode the same way as you use your seed and you will be able enter only that specific address
Finally I will just advise to read more about in the guides
plazma11-Nov-18 08:47 AM
@Hermes thanks i have to study so much
It still so slow
I pressed workload for windows button
5654/1092325 connections :1
Hermes11-Nov-18 08:49 AM
You still have some time for it to finish
No worries just let us know when you have more questions
Acura11-Nov-18 12:56 PM
Who can i ask for support for the arrrtip bot
Nabob11-Nov-18 01:07 PM
@FishyGuts know the dev
Acura11-Nov-18 01:13 PM
Ok thx
plazma11-Nov-18 01:52 PM
@Hermes it done....i now run pirate native and komodo native
kmdbrt_test11-Nov-18 11:43 PM
hello
somebody here?
Hermes12-Nov-18 12:17 AM
Hi @kmdbrt_test how can we help you ?
You tried to launch KMD in lite mode in Barterdex and it didn’t went through?
Using Windows
kmdbrt_test12-Nov-18 12:31 AM
yes
No Electrum Servers found for
undefined (kmd)
Please use Native Mode for
undefined (kmd)
for evey coin i get this message
BarterDEX 1.1.2-rc1 and BarterDEX 1.1.2-rc
@Hermes
with barderDEX 1.1.1 work but i dont see any tradex in there btc/kmd kmd/ltc kmd/zec
i start HyperDEX to see if there is somebody
Hermes12-Nov-18 12:46 AM
Will look into it shortly , that’s a little strange are you seeing the icons of the coins ?
kmdbrt_test12-Nov-18 12:46 AM
yes but the name is strange
unknows
Hermes12-Nov-18 12:47 AM
Try erasing the coins.json file inside the %appdata%Roaming/Barterdex and restart the Dex(edited)
kmdbrt_test12-Nov-18 12:48 AM
okk
well i dont have any files there
only the komodo.conf where i insert some line
cause i use Agama App native mode..for shiled tx
now is working
questions: the offers from barterdex are the same from HyperDEX ?
Hermes12-Nov-18 01:04 AM
@kmdbrt_test do it in %appdata%/Roaming/Barterdex i had a typo there
The orders are the same because both of them use marketmaker
kmdbrt_test12-Nov-18 01:06 AM
yes is working now
but in HyperDEX do i need to "broke" my coins in smaller amounts like i was suppose to do in barter dex?
i use barterdex in February 2018 just for fun
Hermes12-Nov-18 01:08 AM
Hyperdex is better because it helps with splitting UTXOs but it’s alway good to have some spare change
That’s the max volume of LTC available in that particular case they can swap for KMD(edited)
kmdbrt_test12-Nov-18 01:20 AM
well i do open an order but is not starting
if there is 4.49 ltc at 44.99 kmd then my 20kmd order need to go instant
Hermes12-Nov-18 01:22 AM
You can also try doing some doing some secondary orders sometimes it doesn’t go in the first one ...
kmdbrt_test12-Nov-18 01:25 AM
i will like that the deposit address to change after each deposit ...
to use a new one
but from what i see no exchange use that
they give you one address and that s it
Hermes12-Nov-18 01:29 AM
Remember that you are entering this the same way via a seed passphrase and yes I think it makes things easier ...to have one address only. For records and also for better user experience.
kmdbrt_test12-Nov-18 01:31 AM
yess but no for privacy !
will be easy to see how many times i deposit in that address
not safe!
last question and i will not bother you anymore
why in HyperDEX my offer request is different then the broadcast one..
nobody take my order
Hermes12-Nov-18 01:41 AM
Remember that Hyperdex is matching the closest order based in your balance and your utxo ...so if you have 20 and the closest utxo that works is for 19 it will take this as reference...this is based in UTXOs not like other exchanges
Regarding to the privacy question Barterdex needs transparent addresses and transactions to be able to see what’s happening that’s it’s main use
Hermes12-Nov-18 02:18 AM
sorry I was out of desk for a while driving ...I will try using Jumblr if you need to have more control or privacy ...but I understand your point(edited)
polycryptoblog12-Nov-18 06:46 PM
I keep getting error code: -4 witness for note commitment is null , anyone know what the problem is? This is when trying to send pirate newest agama
Hermes12-Nov-18 06:59 PM
Are you trying to send the whole balance ? Also is the transaction not being processed or not executed ?
polycryptoblog12-Nov-18 07:02 PM
No any amount , even tried with just one . It's not being executed failed status .
Hermes12-Nov-18 07:22 PM
Strange which OS is this happening in ? Have you already tried restarting the wallet to see if it still persists?
can anyone help me please with agama wallet? i have fresh started my laptop after a grafik driver update. now when i will start agama, he sayd i must close other running agama instance. but problem is, i find no other running agama instance. how i can bring my wallet back running? thanks for help.
Hermes13-Nov-18 04:49 AM
@Thuerlich Go to the task manager and check if the process Komodod or Agama is still running in the background....
Thuerlich13-Nov-18 04:51 AM
no komodo and no agama found running in taskmanager
Hermes13-Nov-18 04:51 AM
if it was a fresh installation it shouldn't happen but maybe the program got executed twice and it was running in the moment...
it just doesn't let you open the program main window right?
I would make sure restarting the PC again and making just sure that the application is only executed one time when clicking in the .exe file


grabCut Runs the GrabCut algorithm
mask = cv.grabCut(img, rect);
mask = cv.grabCut(img, mask);
[mask, bgdmodel, fgdmodel] = cv.grabCut(...);
[...] = cv.grabCut(..., 'OptionName', optionValue, ...);
Input
- img Input 8-bit 3-channel image.
- rect ROI containing a segmented object. A 1-by-4 vector
[x y w h]
.
It will automatically create the mask
. The pixels outside of the ROI
are marked as "obvious background" with label 0, and label 3 for
foreground (see mask
). Using this variant will set Mode
to
'InitWithRect'.
- mask Input 8-bit single-channel mask of same size as
img
and type
uint8
. Its elements may have one of the following values:
- 0 an obvious background pixel
- 1 an obvious foreground (object) pixel
- 2 a possible background pixel
- 3 a possible foreground pixel
Output
- mask output 8-bit single-channel updated mask. The mask is initialized
by the function when
Mode
is set to 'InitWithRect' (see rect
).
- bgdmodel Output array for the background model, to be used for next
iteration. Do not modify it while you are processing the same image.
- fgdmodel Output array for the foreground model, to be used for next
iteration. Do not modify it while you are processing the same image.
Options
- BgdModel Initial array for the background model. A 1x65 double vector.
- FgdModel Initial array for the foreground model. A 1x65 double vector.
- IterCount Number of iterations the algorithm should make before
returning the result. Note that the result can be refined with further
calls with
Mode
as 'InitWithMask' or 'Eval'. Default 10
- Mode Operation mode, default 'Eval'. Could be one of the following:
- InitWithRect The function initializes the state and the mask
using the provided rectangle. After that it runs
IterCount
iterations of the algorithm. This should only be used with the
variant of the function that takes rect
as input.
- InitWithMask The function initializes the state using the
provided
mask
. Then, all the pixels outside of the ROI are
automatically initialized as background with label 0. This
should only be used with the variant of the function that takes
mask
as input.
- Eval The value means that the algorithm should just resume.
The function implements the GrabCut image segmentation algorithm.
http://en.wikipedia.org/wiki/GrabCut


Provides interactive, configurable and elegant graphics visualization of the human chromosomes allowing users to map chromosome elements (like genes, SNPs etc.) on the chromosome plot. It introduces a special plot viz. the "chromosome heatmap" that, in addition to mapping elements, can visualize the data associated with chromosome elements (like gene expression) in the form of heat colors which can be highly advantageous in the scientific interpretations and research work. Because of the large size of the chromosomes, it is impractical to visualize each element on the same plot. However, the plot provides a magnified view for each of chromosome location to render additional information and visualization specific for that location. You can map thousands of genes and can view all mappings easily. Users can investigate the detailed information about the mappings (like gene names or total genes mapped on a location) or can view the magnified single or double stranded view of the chromosome at a location showing each mapped element in sequential order. The plots can be saved as HTML documents that can be customized and shared easily. In addition, you can include them in R Markdown or in R 'Shiny' applications.
| Version: | 0.1 |
| Depends: | R (≥ 3.4.0) |
| Imports: | htmltools (≥ 0.3.6), htmlwidgets (≥ 1.0) |
| Suggests: | knitr, rmarkdown, shiny |
| Published: | 2018-05-15 |
| Author: | Lakshay Anand [aut, cre] |
| Maintainer: | Lakshay Anand <lakshayanand15 at gmail.com> |
| License: | GPL-3 | file LICENSE |
| NeedsCompilation: | no |
| CRAN checks: | chromoMap results |
| Reference manual: | chromoMap.pdf |
| Vignettes: |
chromoMap-An R package for Interactive visualization and mapping of human chromosomes |
| Package source: | chromoMap_0.1.tar.gz |
| Windows binaries: | r-devel: chromoMap_0.1.zip, r-release: chromoMap_0.1.zip, r-oldrel: chromoMap_0.1.zip |
| OS X binaries: | r-release: chromoMap_0.1.tgz, r-oldrel: chromoMap_0.1.tgz |
Please use the canonical form https://CRAN.R-project.org/package=chromoMap to link to this page.


|
Face Verification for an Acess Control System
|
Functions | |
| def | recvall (sock, count) |
| Function that will convert the socket received into a string. More... | |
| def | calc_store_face_descriptors (img, bb) |
| Calculates a face descriptor and appends it with others already calculated into a list. More... | |
| def | store_face_descriptors (face_descriptor1) |
| It will append the face descriptor received into a list. More... | |
| def | store_face_descriptors_folder (face_descriptor, folder_name) |
| Stores the face descriptors received into a folder (already created or not). More... | |
| def | load_descriptors_from_folder (folder) |
| It will load the descriptors that are on a specific folder into a desciptors list. More... | |
| def | load_and_compare_descriptors (person_name) |
| Function that will check if everything is ready for the comparision process. More... | |
| def | compare_descriptors (descriptors_saved) |
| Function that does an average of the similarity values calculated with the face descriptors. More... | |
| def | main () |
Variables | |
| list | descriptor_values = [] |
| string | folder_aux = " " |
| int | i = 0 |
| string | TCP_IP = 'localhost' |
| int | TCP_PORT = 8000 |
| file = open("../../logsverification_values.txt", "a") | |
Program that simulates the server that receives the face descriptors sent by the face tracker and compares them to the descriptors that are in a specific folder whose name is the NFC tag value received. This comparision will give a value: the lower the value the more likely it is the same person.
| def verification_server.calc_store_face_descriptors | ( | img, | |
| bb | |||
| ) |
Calculates a face descriptor and appends it with others already calculated into a list.
| img | Image |
| bb | Bounding box of the biggest face |
| def verification_server.compare_descriptors | ( | descriptors_saved | ) |
Function that does an average of the similarity values calculated with the face descriptors.
| descriptors_saved | The descriptors that are stored on a given folder. |
| 0 | if there was some problem with the division process |
| 1 | if the comparision was sucessfully made |
| def verification_server.load_and_compare_descriptors | ( | person_name | ) |
Function that will check if everything is ready for the comparision process.
It will search if there is face descriptors received by the socket function ready for the comparision. It will also check if the directory given is valid and if there is any face descriptor avaliable for the comparision.
| person_name | String with the name of the folder where the desciptors are. |
| -1 | if there are no descriptors on the folder searched (database) |
| 0 | if there are no descriptors for the comparision (received by the socket) |
| 1 | if the comparision was sucessfully made |
| def verification_server.load_descriptors_from_folder | ( | folder | ) |
It will load the descriptors that are on a specific folder into a desciptors list.
| folder | Folder path |
| def verification_server.recvall | ( | sock, | |
| count | |||
| ) |
Function that will convert the socket received into a string.
| sock | The socket |
| count | The socket size |
| String | Socket Information |
| def verification_server.store_face_descriptors | ( | face_descriptor1 | ) |
It will append the face descriptor received into a list.
If the list is full, the least recent descriptor will be deleted.
| face_descriptor1 | Face descrpitor |
| def verification_server.store_face_descriptors_folder | ( | face_descriptor, | |
| folder_name | |||
| ) |
Stores the face descriptors received into a folder (already created or not).
5 descriptors for each person.
| face_descriptor | The face descriptor |


"use strict";
import {EventManager} from "./EventManager.js";
import {WindowSession} from "./WindowSession.js";
import {WindowMessage} from "./WindowMessage.js";
/**
* Message utils takes care of messaging between multiple windows. Messages can be transfered direcly or forwarded between windows.
*
* Is responsible for keeping track of all sessions, handles message reception, message forwarding and message sending.
*
* When a window is open it cannot be acessed we need to wait for the ready message.
*
* @class
* @param {String} type Type of this window.
* @param {Boolean} initialize Indicates if the manager should be automatically initialized, by default its true. If you want to manually initialize the manager later to avoid loosing message set to false.
*/
function WindowManager(type, initialize)
{
var self = this;
/**
* Type of this window manager object.
*
* @type {String}
*/
this.type = type;
/**
* UUID of this window manager.
*
* Used to identify this window on communication with another windows.
*
* @type {String}
*/
this.uuid = WindowManager.generateUUID();
/**
* Map of known sessions.
*
* Indexed by the UUID of the session.
*
* @type {Object}
*/
this.sessions = {};
/**
* List of sessions in waiting state.
*
* These still havent reached the READY state.
*
* @type {Array}
*/
this.waitingSessions = [];
/**
* On broadcast message callback, receives data and authentication as parameters.
*
* Called when a broadcast message arrives, onBroadcastMessage(data, authentication).
*
* type {Function}
*/
this.onBroadcastMessage = null;
/**
* Global manager on message callback, receives type, data and authentication as parameters.
*
* This onMessage callback is always called before the individual session callback.
*
* It might be used for globally handling authentication tasks.
*
* type {Function}
*/
this.onMessage = null;
/**
* Event manager containing the message handling events for this manager.
*
* @type {EventManager}
*/
this.manager = new EventManager();
this.manager.add(window, "message", function(event)
{
//console.log("TabTalk: Window message event fired.", event);
var message = event.data;
if(message.action === WindowMessage.READY)
{
return;
}
//Messages that need to be redirected
if(message.destinationUUID !== undefined && message.destinationUUID !== self.uuid)
{
console.warn("TabTalk: Destination UUID diferent from self, destination is " + message.destinationUUID, message);
var session = self.sessions[message.destinationUUID];
if(session !== undefined)
{
message.hops.push(self.uuid);
session.send(message);
console.log("TabTalk: Redirected message to destination.", session, message);
}
else
{
console.warn("TabTalk: Unknown destination, cannot redirect message.");
}
return;
}
//Messages to be processed
else
{
//Session closed
if(message.action === WindowMessage.CLOSED)
{
var session = self.sessions[message.originUUID];
if(session !== undefined)
{
session.setStatus(WindowSession.CLOSED);
delete self.sessions[message.originUUID];
}
else
{
console.warn("TabTalk: Unknown closed origin session.")
}
}
//Lookup
else if(message.action === WindowMessage.LOOKUP)
{
console.log("TabTalk: WindowManager lookup request received from " + message.originType + ".", message);
var found = false;
var response;
for(var i in self.sessions)
{
var session = self.sessions[i];
if(session.type === message.destinationType)
{
var response = new WindowMessage(0, WindowMessage.LOOKUP_FOUND, self.type, self.uuid, undefined, undefined,
{
uuid:session.uuid,
type:session.type
});
found = true;
break;
}
}
if(found === false)
{
response = new WindowMessage(0, WindowMessage.LOOKUP_NOT_FOUND, self.type, self.uuid);
}
var session = self.sessions[message.originUUID];
if(session !== undefined)
{
session.send(response);
console.log("TabTalk: Response to lookup request sent.", response);
}
else
{
console.warn("TabTalk: Unknown lookup origin session.");
}
}
//Connect message
else if(message.action === WindowMessage.CONNECT)
{
var gatewayUUID = message.hops.pop();
var gateway = self.sessions[gatewayUUID];
if(gateway !== undefined)
{
var session = new WindowSession(self);
session.uuid = message.originUUID;
session.type = message.originType;
session.gateway = gateway;
session.waitReady();
session.acknowledge();
console.warn("TabTalk: Connect message received, creating a new session.", message, session);
}
else
{
console.error("TabTalk: Connect message received, but the gateway is unknown.", message);
}
}
//Broadcast
else if(message.action === WindowMessage.BROADCAST)
{
console.log("TabTalk: WindowManager broadcast message received " + message.originType + ".", message);
if(self.onBroadcastMessage !== null)
{
self.onBroadcastMessage(message.data, message.authentication);
}
//Add manager uuid to the hop list
message.hops.push(self.uuid);
for(var i in self.sessions)
{
var session = self.sessions[i];
//Forward message only to sessions that are not in the hop list
if(session.uuid !== message.originUUID && message.hops.indexOf(session.uuid) === -1)
{
session.send(message);
if(session.onBroadcastMessage !== null)
{
session.onBroadcastMessage(message.data, message.authentication);
}
}
}
}
//Messages
else if(message.action === WindowMessage.MESSAGE)
{
console.log("TabTalk: WindowManager message received " + message.originType + ".", message);
if(self.onMessage !== null)
{
self.onMessage(message.originType, message.data, message.authentication);
}
var session = self.sessions[message.originUUID];
if(session !== undefined)
{
session.received.push(message);
if(session.onMessage !== null)
{
session.onMessage(message.data, message.authentication);
}
}
else
{
console.warn("TabTalk: Unknown origin session.", message);
}
}
else
{
console.warn("TabTalk: Unknown message type.", message);
}
}
});
this.manager.add(window, "beforeunload", function(event)
{
for(var i in self.sessions)
{
self.sessions[i].close();
}
});
if(initialize !== false)
{
this.initialize();
}
}
/**
* Initialized the manager message handler, checks for the opener window and sends acknowledge message to waiting sessions.
*
* By default it is automatically called on the constructor. But sometimes it might be usefull to initialize the window later on to avoid loosing messages.
*
* Be carefull to specify all the global callbacks before calling this method.
*
* @return {WindowSession} If this window was opened by another one it returns the respective session. Returns null otherwise.
*/
WindowManager.prototype.initialize = function()
{
this.manager.create();
return this.checkOpener();
};
/**
* Log to the console a list of all known sessions.
*
* Useful for debug purposes.
*/
WindowManager.prototype.logSessions = function()
{
console.log("TabTalk: List of known sessions:");
for(var i in this.sessions)
{
var session = this.sessions[i];
console.log(" " + session.uuid + " | " + session.type + " -> " + (session.gateway === null ? "*" : session.gateway.uuid));
}
};
/**
* Broadcast a message to all available sessions.
*
* The message will be passed further on by the other windows that receive it.
*
* @param {WindowMessage} data Data to be broadcasted.
* @param {String} authentication Authentication information.
*/
WindowManager.prototype.broadcast = function(data, authentication)
{
var message = new WindowMessage(0, WindowMessage.BROADCAST, this.manager.type, this.manager.uuid, undefined, undefined, data, authentication);
message.hops.push(this.uuid);
for(var i in this.sessions)
{
this.sessions[i].send(message);
}
};
/**
* Send an acknowledge message.
*
* Used to send a signal indicating the parent window that it is ready to receive data.
*
* @return {WindowSession} Session fo the opener window, null if the window was not opened.
*/
WindowManager.prototype.checkOpener = function()
{
if(this.wasOpened())
{
var session = new WindowSession(this);
session.window = window.opener;
session.acknowledge();
session.waitReady();
return session;
}
return null;
};
/**
* Create a new session with a new window from URL and type.
*
* Before opening a new window it searches for a window of the same type in the known sessions.
*
* If a session of the same type already exists it is returned.
*
* @param {String} url URL of the window.
* @param {String} type Type of the window to open (Optional).
* @return {WindowSession} Session created to open a new window.
*/
WindowManager.prototype.openSession = function(url, type)
{
//Search in the current sessions
for(var i in this.sessions)
{
var session = this.sessions[i];
if(session.type === type)
{
console.warn("TabTalk: A session of the type " + type + " already exists.");
return session;
}
}
var session = new WindowSession(this);
session.type = type;
//Lookup the session
if(type !== undefined)
{
this.lookup(type, function(gateway, uuid, type)
{
//Not found
if(gateway === null)
{
if(url !== null)
{
session.url = url;
session.window = window.open(url);
session.waitReady();
}
}
//Found
else
{
session.gateway = gateway;
session.uuid = uuid;
session.type = type;
session.waitReady();
session.connect();
}
});
}
return session;
};
/**
* Get a session from the manager from its type.
*
* @param {String} type Type of the window to get.
* @return {WindowSession} Session of the type specified, null if none was found.
*/
WindowManager.prototype.getSession = function(type)
{
for(var i in this.sessions)
{
var session = this.sessions[i];
if(session.type === type)
{
return session;
}
}
return null;
};
/**
* Check if a session of a type exists and its available for message exchanging.
*
* @param {String} type Type of the window to check.
* @return {Boolean} True if a session of the type requested exists, false otherwise.
*/
WindowManager.prototype.sessionAvailable = function(type)
{
for(var i in this.sessions)
{
if(this.sessions[i].type === type || message.action !== WindowMessage.CLOSED)
{
return true;
}
}
return false;
};
/**
* Check if a session of a type exists.
*
* @param {String} type Type of the window to check.
* @return {Boolean} True if a session of the type requested exists, false otherwise.
*/
WindowManager.prototype.sessionExists = function(type)
{
for(var i in this.sessions)
{
if(this.sessions[i].type === type)
{
return true;
}
}
return false;
};
/**
* Lookup for a window type.
*
* @param {String} type Type of the window to look for.
* @param {String} onFinish Receives the gateway session, found uuid and type as parameters onFinish(session, uuid, type), if null no window of the type was found.
*/
WindowManager.prototype.lookup = function(type, onFinish)
{
var message = new WindowMessage(0, WindowMessage.LOOKUP, this.type, this.uuid, type, undefined);
var sent = 0, received = 0, found = false;
for(var i in this.sessions)
{
console.log("TabTalk: Send lookup message to " + i + ".", message);
this.sessions[i].send(message);
sent++;
}
if(sent > 0)
{
var self = this;
var manager = new EventManager();
manager.add(window, "message", function(event)
{
var data = event.data;
if(data.action === WindowMessage.LOOKUP_FOUND)
{
if(found === false)
{
var session = self.sessions[data.originUUID];
if(session !== undefined)
{
found = true;
onFinish(session, data.data.uuid, data.data.type);
}
}
console.log("TabTalk: Received lookup FOUND message from " + data.originUUID + ".", data.data);
received++;
}
else if(data.action === WindowMessage.LOOKUP_NOT_FOUND)
{
console.log("TabTalk: Received lookup NOT FOUND message from " + data.originUUID + ".");
received++;
}
if(sent === received)
{
manager.destroy();
if(found === false)
{
onFinish(null);
}
}
});
manager.create();
}
else
{
console.log("TabTalk: No session available to run lookup.");
onFinish(null);
}
};
/**
* Check if this window was opened by another one.
*
* @return {Boolean} True if the window was opened by another window, false otherwise.
*/
WindowManager.prototype.wasOpened = function()
{
return window.opener !== null;
};
/**
* Dispose the window manager.
*
* Should be called when its not used anymore. Destroy all the window events created by the manager.
*/
WindowManager.prototype.dispose = function()
{
for(var i in this.sessions)
{
this.sessions[i].close();
}
this.manager.destroy();
};
/**
* Generate a UUID used to indetify the window manager.
*
* .toUpperCase() here flattens concatenated strings to save heap memory space.
*
* http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
*
* @return {String} UUID generated.
*/
WindowManager.generateUUID = function()
{
var lut = [];
for(var i = 0; i < 256; i ++)
{
lut[i] = (i < 16 ? "0" : "") + (i).toString(16);
}
return function generateUUID()
{
var d0 = Math.random() * 0xffffffff | 0;
var d1 = Math.random() * 0xffffffff | 0;
var d2 = Math.random() * 0xffffffff | 0;
var d3 = Math.random() * 0xffffffff | 0;
var uuid = lut[ d0 & 0xff ] + lut[ d0 >> 8 & 0xff ] + lut[ d0 >> 16 & 0xff ] + lut[ d0 >> 24 & 0xff ] + "-" +
lut[ d1 & 0xff ] + lut[ d1 >> 8 & 0xff ] + "-" + lut[ d1 >> 16 & 0x0f | 0x40 ] + lut[ d1 >> 24 & 0xff ] + "-" +
lut[ d2 & 0x3f | 0x80 ] + lut[ d2 >> 8 & 0xff ] + "-" + lut[ d2 >> 16 & 0xff ] + lut[ d2 >> 24 & 0xff ] +
lut[ d3 & 0xff ] + lut[ d3 >> 8 & 0xff ] + lut[ d3 >> 16 & 0xff ] + lut[ d3 >> 24 & 0xff ];
return uuid.toUpperCase();
};
}();
export {WindowManager};


Ensure your application monitors the use of privileged accounts and logs all activities performed under their credentials.
Privileged accounts by their nature are allowed to do damaging activities. If compromised, they can cause the most damage. Close monitoring can catch unauthorized and/or malicious activities and help minimize any damage done.
To check if your application monitors privileged accounts activities, follow these steps:
Identify the privileged users and roles. For the purposes of security monitoring, privileged accounts are those that can cause more damage than other users. Check for both privileged users and roles (Administrator or the Administrator's group, among others, or root and wheel on a Unix environment). This will vary by application and roles defined, however, some examples are:
Identify potentially dangerous activities. Enumerate all activities enabled by the privileged accounts identified above. Some of the common activities include, but are not limited to:
Ensure all activities are logged. Identify areas of code that perform privileged activates as identified from step 2 above. Verify that all activities, including successful and failed operations, are logged. Ensure that privileged events are logged separately in files that are not accessible to lower privileged users.
Audit the logs. Audit your application's logs regularly. Logs are the first and sometimes only place that security problems can be discovered. Use your logs to detect problems early and prevent them instead of for forensics. Verify that:
If there are no available logs to audit, use your application to generate enough logged sample data from the application's components that require privileged accounts. Then perform an audit to verify that the logging mechanisms have been set up correctly.
Perform the following actions to implement monitoring the use of privileged user accounts:
Identify privileged user roles. Identify the types of privileged user accounts available in your application. Some example are: administrator, root, power user, manager, etc. Make a list of privileged user roles.
Identify functionality unique to privileged users. For each type of privileged user account, make a list of functionality that this type of account can use that a regular user cannot. Some examples are: adding or removing user accounts, changing passwords for other users, changing application settings, shutting down the application, etc. Make a list of functionality that is unique to privileged users.
Identify code that implements functions unique to privileged users. Use the list of actions available exclusively to privileged users to identify the functions that implement these actions. Make a list of these functions.
Identify the logging subsystem. The logging subsystem should provide an API that allows generating log entries from application code. If this API or the logging subsystem don't exist, write them. Make a list of functions that may be used to generate log entries and collect documentation about how to use them.
Implement monitoring of privileged accounts. Use the list of functions that perform actions unique to privileged accounts to add code that generates log entries to each of those functions. Use the list of functions in the logging subsystem when writing code that generates log entries.