This is the begining of my website home page.
It will eventually contain a list of links to all my blogs.
Hi I'm George, and somehow you've stumbled upon my little slice of the web!
The purpose of this site is to showcase the work I am doing towards becomming a Web Developer through Enspiral Dev Academy's wonderful program.


Access is granted automatically through the meeting venue's network.
If you are ouside the venue (e.g. in your hotel),
you have to provide your CBD Badge number to unlock and display the document(s) in this section.
Sorry! Your CBD Badge number is invalid.
You must provide the number located on the top right of your CBD meeting access badge.


Welcome to RedWarn Patrol!
To the left, you can see a list of recent changes. To view the latest revision of the article that was changed, simply click it on the left.
The stronger the colour, the more the amount of content that has been changed. By default, red means a change that made the page smaller, and green as an edit that made the page bigger. You can change these colours in your preferences.
For full instructions, refer to the user guide.


I saw Whale Rider tonight. I was most unimpressed. Yet another movie about a native people struggling to hold on to their tradition while resolving its conflict with the modern world. Yawn.
It's damned hard to tell the difference between this kind of movie when it features Maori, American Indian, or any other native people -- or heck, it could be talking about Italians, Irish, Appalachian, or any other quaint ethnicity. Oh, this one had whales, and the particular chants and dances showed off the richness of the Maori culture.
I couldn't help but compare it to The Fast Runner (also called Atanarjuat), which was a much better movie. That movie, instead of being yet another modern-world-meets-traditional-values, was a straight up movie about the Inuit, with no modern culture at all (it was based on a traditional tale, placed before any Western influence). I believe that's the first movie of its kind I've ever seen, which seems very odd. Were there no stories worth repeating in these cultures before modern influences? Would it be that hard to make one up?
This might be because The Fast Runner was written, produced, and directed entirely by native people, unlike Whale Rider and every other movie about native people (yes, all of them!) In so many others there seems to be this lack of imagination, leading to the same story being told over and over again. That might be unsurprising: if everything is produced by outsiders, who look in on these cultures as charming and quaint, trivially unique, will they really be able to tell stories that are representative of these cultures?
Part of annoyance with Whale Rider might be from my lack of appreciation for the outward traditions of those cultures. The chants, songs, ceremonial dress, etc. -- to me those seem like the most trivial, most petty aspect of the cultures. A good story should give a picture of more than the physical trappings of a culture. That's the difference between a story and a museum display. Whale Rider was just a very pretty museum display.
I think you missed the whole thrust of this incredible movie, based on a novel written by a Maori novelist. If you are looking for a culture completely separated from the world, there are fewer and fewer place that will meet your needs. How communities engage in the world around them is certainly an interesting topic to me. In addition, there were deep philosophical elements involved in this movie. What is truth? How is truth discovered? What role does tradition serve in discerning the truth. Does truth evolve? The girl represents a post-modern conception truth, embracing tradition, but realizing that truth can be discovered in new ways to new generations. Anyway, my two cents.
# Pablo


2. Automotive Cybersecurity Intrusion Detection with Cold Start¶
Too many tutorials, esp data science ones, start out with some toy applications and the really basic stuff, and then stalls out on the more complex real-world scenario. This one is going to be different. So, grab a cup of coffee before you continue :)
As automotive vehicles are increasingly connected, they face higher risk of being compromised. Especially, their in-vehicle networks are prone to attacks due to original designs with no security concerns in mind and one of the most common attacks is injecting messages to a vehicle’s CAN Bus.
In fact, this received widespread media attention in 2015 that a Senate bill was proposed in 2015 and recently reintroduced in 2019 to “ensure cybersecurity in increasingly computerized vehicles”.
Similar threats exist for aircrafts, smart factories, smart buildings, and of course, the increasing number of IoT appliances. But let’s focus on automotive cybersecurity in this tutorial.
Two of the proposed requirement in the SPY Car act are:
All entry points to the electronic systems of each motor vehicle manufactured for sale in the United States shall be equipped with reasonable measures to protect against hacking attacks
Any motor vehicle manufactured for sale in the United States that presents an entry point shall be equipped with capabilities to immediately detect, report, and stop attempts to intercept driving data or control the vehicle
It is not obvious that such intrusion detection system (IDS) could work, but it turns out that with careful system design, we can construct it with Human1st.AI. The nature of CAN bus data and vehicle operations is that the normal traffic is highly regular (unlike an open node on the internet) and we can leverage this to build an IDS.
Let’s dive in!
1a. CAN data basics¶
Let’s familiarize ourselves with vehicle data.
Controller Area Network (CAN Bus) is a common in-vehicle network architecture. It was designed to avoid massive physical wires between Engine Control Units (ECUs) in a vehicle. A CAN packet (also called message)’s payload contains data from one or more ECUs which we refer to as sensors such as Car Speed, Steering Wheel’s Angle, Yaw Rate, Longitudinal Acceleration (Gx), Latitudinal Acceleration (Gy).
CAN Bus’ simple communication protocol makes it vulnerable to cyber-attacks due to security issues such as message broadcasting, no authentication, etc. Injection attacks are common to CAN Bus.
NOTE: we’re currently working to make available fully an equivalent dataset to the one used for this tutorial for download. For now the tutorial is read-only. Hold on tight!
import pandas as pd
import numpy as np
DATA_LOCATION = "COMING-SOON"
df = pd.read_parquet('%s/train/attacks/20181113_Driver1_Trip1-0.parquet' % DATA_LOCATION)
df.head(20)
| Timestamp | SteeringAngle | CarSpeed | YawRate | Gx | Gy | Label | |
|---|---|---|---|---|---|---|---|
| 0 | 120.000001 | 12.3 | NaN | NaN | NaN | NaN | Normal |
| 1 | 120.012008 | 12.3 | NaN | NaN | NaN | NaN | Normal |
| 2 | 120.012052 | NaN | NaN | 0.197147 | 0.016671 | -0.002896 | Normal |
| 3 | 120.024006 | NaN | 0.0 | NaN | NaN | NaN | Normal |
| 4 | 120.024007 | 12.3 | NaN | NaN | NaN | NaN | Normal |
| 5 | 120.024076 | NaN | NaN | 0.196988 | 0.016514 | -0.003019 | Normal |
| 6 | 120.035987 | NaN | NaN | 0.196828 | 0.016357 | -0.003141 | Normal |
| 7 | 120.035995 | 12.3 | NaN | NaN | NaN | NaN | Normal |
| 8 | 120.047985 | NaN | NaN | 0.196668 | 0.016200 | -0.003264 | Normal |
| 9 | 120.047986 | 12.3 | NaN | NaN | NaN | NaN | Normal |
| 10 | 120.048021 | NaN | 0.0 | NaN | NaN | NaN | Normal |
| 11 | 120.059906 | NaN | NaN | 0.196509 | 0.016043 | -0.003387 | Normal |
| 12 | 120.060011 | 12.3 | NaN | NaN | NaN | NaN | Normal |
| 13 | 120.072003 | NaN | NaN | 0.196349 | 0.015886 | -0.003510 | Normal |
| 14 | 120.072014 | 12.3 | NaN | NaN | NaN | NaN | Normal |
| 15 | 120.072032 | NaN | 0.0 | NaN | NaN | NaN | Normal |
| 16 | 120.083978 | 12.3 | NaN | NaN | NaN | NaN | Normal |
| 17 | 120.084025 | NaN | NaN | 0.196190 | 0.015729 | -0.003632 | Normal |
| 18 | 120.095950 | NaN | NaN | 0.196030 | 0.015571 | -0.003755 | Normal |
| 19 | 120.096009 | NaN | 0.0 | NaN | NaN | NaN | Normal |
Note that the data has a particular rhythm to it: each non-NA CarSpeed or YawRate comes at a regular interval, and YawRate/Gx/Gy messages always come with each other. In technical parlance, these are 3 different CAN IDs with different message payloads.
1b. Simulating attacks¶
Now comes the hard & fun part, as we only have normal data. How can we develop an intrusion detection system?
The first natural step is to generate attack data. There are many ways to simulate such attacks but the cheapest method is simply to inject fake messages into the stored data stream.
A more realistic (and also more expensive) method to safely simulate attacks is to inject messages directly into the CAN bus while vehicle is stationary (engine on/transmission in park), or when vehicle is in motion in a controlled driving environment / test track such as conducted by the NHTSA
For convenience, we have provided the synthetic data. Let’s take a look at it!
yr = df[(df.Timestamp > 300) & (df.Timestamp < 330)].dropna(subset=["YawRate"])
import matplotlib.pyplot as plt
att = yr[yr["Label"] == "Attack"]
normal = yr[yr["Label"] == "Normal"]
plt.plot(normal.Timestamp, normal.YawRate, label="normal")
plt.plot(att.Timestamp, att.YawRate, label="attack")
plt.legend()
<matplotlib.legend.Legend at 0x7ffbc9024c10>
The key question is can ML/AD system detect the injected messages from the normal ones?
2. Monolithic AD/ML Approaches and Why They are Unsatisfactory¶
Given the abundance of normal driving data, the problem naturally leads to an anomaly detection (AD) formulation. Let’s try some off-the-shell well-known methods for example Isolation Forest!
In theory, AD approach isn’t affected by the Cold Start problem as training data is normal data only, and is hence we only need labels during evaluation of the intrusion detection system.
But will it work accurately enough? Let’s try!
2a. A naive AD approach using IsolationForest¶
SENSORS = ["SteeringAngle", "CarSpeed", "YawRate", "Gx", "Gy"]
def compute_timediff_fillna(df):
df = df.copy()
for s in SENSORS:
sensor_not_isna = df[~df[s].isna()]
df["%s_TimeDiff" % s] = sensor_not_isna.Timestamp - sensor_not_isna.shift(1).Timestamp
#print(df.head(20))
for s in SENSORS:
df[s] = df[s].fillna(method="ffill")
df["%s_TimeDiff" % s] = df["%s_TimeDiff" % s].fillna(method="ffill")
df.dropna(inplace=True)
return df
df = pd.read_parquet("%s/train/attacks/20181113_Driver1_Trip1-0.parquet" % DATA_LOCATION)
df = compute_timediff_fillna(df)
Since we know that message timing is important, we should try to use those features in AD training. Can you spot see the difference between normal vs attack messages?
df_normal = df[df.Label == 'Normal']
df_normal.sample(5)
| Timestamp | SteeringAngle | CarSpeed | YawRate | Gx | Gy | Label | SteeringAngle_TimeDiff | CarSpeed_TimeDiff | YawRate_TimeDiff | Gx_TimeDiff | Gy_TimeDiff | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 310314 | 4651.368009 | 1.599472 | 53.262020 | 0.182120 | 0.036140 | -0.104073 | Normal | 0.011984 | 0.024000 | 0.011943 | 0.011943 | 0.011943 |
| 219474 | 2693.819987 | 4.386408 | 80.489037 | 17.014353 | -0.013549 | -0.894699 | Normal | 0.011960 | 0.024007 | 0.010611 | 0.012002 | 0.012002 |
| 122275 | 2055.612012 | 4.283608 | 46.228298 | 1.063028 | 0.140284 | -0.336961 | Normal | 0.012026 | 0.023980 | 0.000028 | 0.012044 | 0.012044 |
| 211727 | 2660.735991 | 4.903600 | 78.351761 | 1.506351 | 0.139225 | -0.308420 | Normal | 0.011992 | 0.023992 | 0.011897 | 0.011897 | 0.011897 |
| 422124 | 6371.280012 | 15.572001 | 128.386993 | 4.926676 | 0.101201 | 3.130639 | Normal | 0.011982 | 0.024007 | 0.009422 | 0.011985 | 0.011985 |
df_attack = df[df.Label == 'Attack']
df_attack.sample(5)
| Timestamp | SteeringAngle | CarSpeed | YawRate | Gx | Gy | Label | SteeringAngle_TimeDiff | CarSpeed_TimeDiff | YawRate_TimeDiff | Gx_TimeDiff | Gy_TimeDiff | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 467242 | 7426.091304 | 1.01600 | 130.722397 | 40.000000 | -0.173196 | -0.056015 | Attack | 0.012003 | 0.024005 | 0.011349 | 0.011985 | 0.011985 |
| 64307 | 769.020065 | 2.41600 | 73.692062 | 0.446286 | 0.295156 | 0.314811 | Attack | 0.011996 | 0.024002 | 0.000009 | 0.000009 | 0.000009 |
| 208178 | 2647.740008 | 0.26960 | 79.171234 | 0.024701 | -0.010674 | 0.148819 | Attack | 0.011999 | 0.023980 | 0.000007 | 0.000007 | 0.000007 |
| 282899 | 3998.520016 | 2.48938 | 57.042484 | 0.339417 | 0.352549 | -0.127944 | Attack | 0.012006 | 0.024000 | 0.000003 | 0.000003 | 0.000003 |
| 255545 | 3470.351199 | 2.53278 | 0.000000 | 0.523398 | 0.003199 | 0.010731 | Attack | 0.011987 | 0.023975 | 0.011168 | 0.012055 | 0.012055 |
from sklearn.ensemble import IsolationForest
import sklearn.metrics
FEATURES = SENSORS + ["%s_TimeDiff" % s for s in SENSORS]
iforest = IsolationForest(n_estimators=500).fit(df_normal[FEATURES])
df2 = pd.read_parquet("%s/train/attacks/20181203_Driver1_Trip10-20.parquet" % DATA_LOCATION)
df2 = compute_timediff_fillna(df2)
ypred = iforest.predict(df2[FEATURES])
ypred = pd.Series(np.maximum(-ypred, 0))
cf = sklearn.metrics.confusion_matrix(df2.Label == "Attack", ypred)
print(cf)
print("Accuracy = %s " % sklearn.metrics.accuracy_score(df2.Label =="Attack", ypred))
[[37486 6257]
[ 4102 3858]]
Accuracy = 0.7996441212308764
This is certainly not bad for a start. But the TPR and FPR is no where near what’s needed for deployment!
While there are a lot of exciting approaches for AD and sequential time-series data, including using RNN/LSTM/CNN, autoencoders, self-supervised learning, etc. The fundamental problem with AD is that it is hard to achieve high TPR while simultaneously achieving very low FPR.
Since AD after all, is a harder problem than supervised learning and while they are important parts of the tool box, we still need final human clearance to key system decisions.
2b. Machine teaching: leveraging ML to “program” a classifier by specifying human-generated outputs¶
If we zoom in, it is perhaps easier to see the zig-zag patterns of alternating real vs injected messages. It’s clear that perhaps we can leverage a ML to classify these kinds of smooth vs zig-zag patterns.
After all, ML should excel at pattern recognition.
The significance of this approach is that it is much easier for human experts to synthesize the attack data than to write the detection program. And such is the promise of Software 2.0, but will it work?
import matplotlib.pyplot as plt
df[(df.Timestamp >= 200) & (df.Timestamp <= 330)].YawRate.dropna().plot()
plt.title("An period with both normal and attacks of YawRate, can you tell which is which?")
plt.show()
df[(df.Timestamp > 315) & (df.Timestamp < 316)].YawRate.dropna().plot()
plt.title("An attack window on YawRate, zooming in to show zig-zagging between real vs injected values ")
plt.show()
Let’s try a gradient-boosted trees firstly, e.g. sklearn’s HistGradientBoostingClassifier can work well on larger dataset before bringing out bigger guns.
from sklearn.experimental import enable_hist_gradient_boosting
from sklearn.ensemble import HistGradientBoostingClassifier
gbc = HistGradientBoostingClassifier(max_iter=500).fit(df[FEATURES], df.Label == "Attack")
ypred = gbc.predict(df2[FEATURES])
cf = sklearn.metrics.confusion_matrix(df2.Label == "Attack", ypred)
print(sklearn.metrics.accuracy_score(df2.Label == "Attack", ypred))
print(cf)
print("Accuracy = %s " % sklearn.metrics.accuracy_score(df2.Label == "Attack", ypred))
0.8564686768659459
[[42191 1552]
[ 5869 2091]]
Accuracy = 0.8564686768659459
2c. Deep Learning and using a H1ST Model API, organizing, importing, saving & loading¶
We can bring out larger guns like Bidirectional LSTM or CNN or Transformers which can work well on pattern recognition problems on sequential data such as this one. One such model is available in the full tutorial source code package, and it can reach quite impressive accuracy.
Let’s see how we could use it!
import h1st as h1
h1.init()
from AutomotiveCybersecurity.models.blstm_injection_msg_classifier import BlstmInjectionMsgClassifier
m = BlstmInjectionMsgClassifier()
A data-science project in H1ST.AI is designed to be a Python-importable package. You can create such a project using the h1
command-line tool.
Organizing model code this way makes it easy to use as we will see. The Model API provides a unified workflow so that models can be used interactively in notebooks as well as in structured and complex projects as we shall see later.
Here, we call h1.init()
to make sure we can import the package in our notebooks even when the package is not installed (as long as the notebooks are within the project folder structure).
It is a simple matter to import and train such organized h1st.Model
, say on a small fraction of the data.
data = m.load_data(num_files=100)
prepared_data = m.prep_data(data)
m.train(prepared_data, epochs=10)
Epoch 1/10
75/Unknown - 18s 246ms/step - loss: 0.4046 - accuracy: 0.8629
Epoch 00001: val_loss improved from inf to 0.38385, saving model to checkpoints/blstm_classif1.h5
75/75 [==============================] - 21s 274ms/step - loss: 0.4046 - accuracy: 0.8629 - val_loss: 0.3838 - val_accuracy: 0.8558
Epoch 2/10
75/75 [==============================] - ETA: 0s - loss: 0.3661 - accuracy: 0.8729
Epoch 00002: val_loss improved from 0.38385 to 0.37567, saving model to checkpoints/blstm_classif2.h5
75/75 [==============================] - 35s 467ms/step - loss: 0.3661 - accuracy: 0.8729 - val_loss: 0.3757 - val_accuracy: 0.8558
Epoch 3/10
75/75 [==============================] - ETA: 0s - loss: 0.2966 - accuracy: 0.8994
Epoch 00003: val_loss improved from 0.37567 to 0.21447, saving model to checkpoints/blstm_classif3.h5
75/75 [==============================] - 29s 393ms/step - loss: 0.2966 - accuracy: 0.8994 - val_loss: 0.2145 - val_accuracy: 0.9057
Epoch 4/10
75/75 [==============================] - ETA: 0s - loss: 0.2246 - accuracy: 0.9222
Epoch 00004: val_loss improved from 0.21447 to 0.10207, saving model to checkpoints/blstm_classif4.h5
75/75 [==============================] - 29s 392ms/step - loss: 0.2246 - accuracy: 0.9222 - val_loss: 0.1021 - val_accuracy: 0.9543
Epoch 5/10
75/75 [==============================] - ETA: 0s - loss: 0.1273 - accuracy: 0.9547
Epoch 00005: val_loss improved from 0.10207 to 0.06612, saving model to checkpoints/blstm_classif5.h5
75/75 [==============================] - 28s 372ms/step - loss: 0.1273 - accuracy: 0.9547 - val_loss: 0.0661 - val_accuracy: 0.9797
Epoch 6/10
75/75 [==============================] - ETA: 0s - loss: 0.0696 - accuracy: 0.9755
Epoch 00006: val_loss improved from 0.06612 to 0.04757, saving model to checkpoints/blstm_classif6.h5
75/75 [==============================] - 31s 411ms/step - loss: 0.0696 - accuracy: 0.9755 - val_loss: 0.0476 - val_accuracy: 0.9808
Epoch 7/10
75/75 [==============================] - ETA: 0s - loss: 0.0703 - accuracy: 0.9751
Epoch 00007: val_loss improved from 0.04757 to 0.03617, saving model to checkpoints/blstm_classif7.h5
75/75 [==============================] - 40s 531ms/step - loss: 0.0703 - accuracy: 0.9751 - val_loss: 0.0362 - val_accuracy: 0.9835
Epoch 8/10
75/75 [==============================] - ETA: 0s - loss: 0.0419 - accuracy: 0.9848
Epoch 00008: val_loss improved from 0.03617 to 0.02703, saving model to checkpoints/blstm_classif8.h5
75/75 [==============================] - 31s 416ms/step - loss: 0.0419 - accuracy: 0.9848 - val_loss: 0.0270 - val_accuracy: 0.9902
Epoch 9/10
75/75 [==============================] - ETA: 0s - loss: 0.0344 - accuracy: 0.9878
Epoch 00009: val_loss improved from 0.02703 to 0.02337, saving model to checkpoints/blstm_classif9.h5
75/75 [==============================] - 29s 383ms/step - loss: 0.0344 - accuracy: 0.9878 - val_loss: 0.0234 - val_accuracy: 0.9918
Epoch 10/10
75/75 [==============================] - ETA: 0s - loss: 0.0305 - accuracy: 0.9894
Epoch 00010: val_loss improved from 0.02337 to 0.02131, saving model to checkpoints/blstm_classif10.h5
75/75 [==============================] - 32s 431ms/step - loss: 0.0305 - accuracy: 0.9894 - val_loss: 0.0213 - val_accuracy: 0.9923
<AutomotiveCybersecurity.models.blstm_injection_msg_classifier.BlstmInjectionMsgClassifier at 0x7fe5bdf29d30>
As expected, powerful deep learning models can recognize these attack patterns well. (And we haven’t even trained the model on all the data and until fully converged.)
However, we must reckon that these models, after all, are recognizing attack patterns that humans are generating and injecting artificially. While this is convenient to generate output and train the detector program a la “Software 2.0”, for our situation, because the attacks are purely synthetic, we cannot be too sure that they are learning the right things and work robustly and can be trusted to deploy in the field. It’s best to employ them in the right deployment scope, namely useful pattern recognizers.
3. Using H1st.AI: Encoding Human Insights as a Model and Harmonizing Human + ML in a H1st.Graph¶
3a. Use case analysis: turning on safe-mode vs post-moterm analysis¶
The H1ST.AI approach to this problem begins by thinking about the end-users of the decision system, and their uses cases.
What are the use cases for such Automotive Cybersecurity system? We can envision two distinctive use cases:
The onboard intrusion detection system can detect an attack event in realtime and set the car into a safe mode so that drivers can safely get to a safe location and not be stuck in the highway with malfunctioning cars.
An security expert could review the attack in post-mortem mode, in which the IDS provides message-by-message attack vs normal classification.
For use case #1 “safe mode triggering by attack event detection”, the ML requirement is that it has near-zero FPR.
To give an example, each second might contain 100 of CAN messages per car. If we have a fleet with just 1000 cars, each driven 1h per day, then a FPR of 0.00001 at message-level still means that each day we have 0.00001 x 100msg x 3600s x 1000cars = 3600 false positive events per day!
Additionally, for deployment & anticipated regulatory purpose, the system should behave robustly and explainably. While explainability is a complex subject, we meant that one could anticipate the system’s behavior reasonably well, as well as for legal/regulation purposes. As we saw with iForest or GBM ML models, they don’t quite meet this requirement, as it is hard to explain precisely how these models classify attacks, even if they can achieve good accuracy.
For use case #2 “post-morterm analysis”, it turns out that the requirement is very different. Some FPR could be traded off for higher TPR for post-mortem. And the system might not need to highly explainable as it is after all the jobs of the security experts to analyze the attacks in depth and make the final decisions.
3b. Problem (re)formulation into H1st.AI Graph¶
We reformulate the problem into the form of a decision graph, where the outermost flow detects attack events and corresponding yes branches handles message classification. For this tutorial we focus on injection attacks which are most common in the wild (we will revisit this later).
The graph looks like this.
3c. Encoding human insights for event detection as a H1st.Model¶
Remember when we start analyzing the CAN dataset, we have remarked that the normal data is highly regular, especially in terms of the message frequency for each CAN ID.
It turns out that using message frequency statistics for injection event detection is highly accurate for safe-mode use cases (high TPR, low FNR). This surprising fact was first pointed out by the original CAN bus hackers Chris Valasek and Charlie Miller in the seminal white paper Adventures in Automotive Networks and Control Units.
It is pretty straightforward to detect the attacks discussed in this paper. They always involve either sending new, unusual CAN packets or flooding the CAN bus with common packets… Additionally, the frequency of normal CAN packets is very predictable… Therefore we propose that a system can detect CAN anomalies based on the known frequency of certain traffic and can alert a system or user if frequency levels vary drastically from what is well known.
Using H1ST, we can encode insights of such “human” models and use them just like ML models. An h1.Model is essentially anything that can predict. H1ST provides tools to help automate their saving and loading, too, easing the way for using them in an integrated decision system.
In a H1ST project structure, we typically organize this under models
directory, e.g. the content of models/msg_freq_event_detector.py
looks like this.
SENSORS = ["SteeringAngle", "CarSpeed", "YawRate", "Gx", "Gy"]
class MsgFreqEventDetectorModel(h1.Model):
def load_data():
pass
def train(data):
pass
def predict(self, data):
present_size=0.1
df = data['df']
window_starts = data["window_starts"]
window_results = []
for window_start in window_starts:
w_df = df[(df.Timestamp >= window_start) & (df.Timestamp < window_start + WINDOW_SIZE)]
results = {}
for _, sensor in enumerate(SENSORS):
w_df_sensor = w_df.dropna(subset=[sensor])
max_normal_message_freq = self.stats.at['max', sensor]
msg_freq = len(w_df_sensor)
if msg_freq > (max_normal_message_freq+1): #or min_timediff < min_normal_timediff:
results[sensor] = 1
else:
results[sensor] = 0
# print((window_start, sensor, msg_freq, max_normal_message_freq, results[sensor]))
results["WindowInAttack"] = any(results.values())
results["window_start"] = window_start # information for down-stream
window_results.append(results)
return {"event_detection_results": window_results}
Now let’s import and train this MsgFreqEventDetectorModel
.
from AutomotiveCybersecurity.models.msg_freq_event_detector import MsgFreqEventDetectorModel
m = MsgFreqEventDetectorModel()
You can look inside the model file models/msg_freq_event_detector.py
to see the details of training. It’s quite simple, looping through a number of files to compute window statistics such as how many msg per CAN ID are found & what’s the min & max and percentile values.
data = m.load_data(num_samples=20)
m.train(data)
m.stats
| SteeringAngle | CarSpeed | YawRate | Gx | Gy | |
|---|---|---|---|---|---|
| count | 23767.000000 | 23767.000000 | 23767.000000 | 23767.000000 | 23767.000000 |
| mean | 33.053309 | 16.526486 | 33.053267 | 33.053267 | 33.053267 |
| std | 0.425629 | 0.499308 | 0.426474 | 0.426474 | 0.426474 |
| min | 32.000000 | 16.000000 | 32.000000 | 32.000000 | 32.000000 |
| 25% | 33.000000 | 16.000000 | 33.000000 | 33.000000 | 33.000000 |
| 50% | 33.000000 | 17.000000 | 33.000000 | 33.000000 | 33.000000 |
| 75% | 33.000000 | 17.000000 | 33.000000 | 33.000000 | 33.000000 |
| max | 34.000000 | 17.000000 | 34.000000 | 34.000000 | 34.000000 |
The nice things about h1st.Model that we can easily save/load them. By default, the “model”, “stats” and “metrics” properties are persisted and they support a variety of flavors & data structure.
m.persist()
2020-08-11 00:32:41,488 INFO h1st.model_repository: Saving stats property...
'01EFE6YZWFD2DF2GBQSNQ6E666'
3d. Working with H1st Graph¶
Let’s now make some event-level predictions.
Note that since the model was persisted using H1st model repo, this means that we can easily come back to a notebooks and/or scripts and load the trained model or computed statistics.
Importantly, H1st allows much speedier integration into a Graph (and later deployment, too).
from AutomotiveCybersecurity.graph import WindowGenerator
from AutomotiveCybersecurity.models.msg_freq_event_detector import MsgFreqEventDetectorModel
graph = h1.Graph()
graph.start()\
.add(WindowGenerator())\
.add(MsgFreqEventDetectorModel().load())
graph.end()
import glob
fs = glob.glob("/Users/aht/Documents/autocyber/13Prius/predict_data/add/YawRate/*.csv")
print(fs[0])
df = pd.read_csv(fs[0])
df.columns = ['Timestamp', 'Label', 'CarSpeed', 'SteeringAngle', 'YawRate', 'Gx', 'Gy']
results = graph.predict({"df": df})
results.keys()
2020-08-14 22:23:15,192 INFO h1st.model_repository.model_repository: Loading version 01EFQN6454J0AHK60F81PXV8CB ....
/Users/aht/Documents/autocyber/13Prius/predict_data/add/YawRate/Attack_YR_Cycle_Add_back_01_030_1to1_D_01.csv
dict_keys(['df', 'window_starts', 'event_detection_results'])
And we should see that starting we can detect attacks starting at Timestamp<PHONE_NUMBER>000011
[x for x in results["event_detection_results"] if x["WindowInAttack"]][:5]
[{'SteeringAngle': 0,
'WindowInAttack': True,
'CarSpeed': 0,
'YawRate': 1,
'Gx': 1,
'Gy': 1,
'window_start':<PHONE_NUMBER>999997},
{'SteeringAngle': 0,
'WindowInAttack': True,
'CarSpeed': 0,
'YawRate': 1,
'Gx': 1,
'Gy': 1,
'window_start':<PHONE_NUMBER>999997},
{'SteeringAngle': 0,
'WindowInAttack': True,
'CarSpeed': 0,
'YawRate': 1,
'Gx': 1,
'Gy': 1,
'window_start':<PHONE_NUMBER>999997},
{'SteeringAngle': 0,
'WindowInAttack': True,
'CarSpeed': 0,
'YawRate': 1,
'Gx': 1,
'Gy': 1,
'window_start':<PHONE_NUMBER>999997},
{'SteeringAngle': 0,
'WindowInAttack': True,
'CarSpeed': 0,
'YawRate': 1,
'Gx': 1,
'Gy': 1,
'window_start':<PHONE_NUMBER>999996}]
3e. Adding a message classifier, harmonizing human + ML models in the graph¶
For message-level classification we can simply bring back our gradient-boosted trees which did a decent job of recognizing injection messages. (Integrating sequence model such as Bidirectional LSTM is left as an exercise for the reader).
For convenient, we’ve re-orgarnized it as a H1st.Model, ready for use. The content of models/gradient_boosting_msg_classifier.py
looks like this.
FEATURES = SENSORS + ["%s_TimeDiff" % s for s in SENSORS]
class GradientBoostingMsgClassifierModel(h1.Model):
def load_data(self, num_samples=None):
return util.load_data_daic(num_samples, shuffle=True)
def prep_data(self, data):
# concat multiple files into separate training/test pd.DataFrame
def concat_processed_files(files):
dfs = []
for f in files:
z = pd.read_csv(f)
z.columns = ['Timestamp', 'Label', 'CarSpeed', 'SteeringAngle', 'YawRate', 'Gx', 'Gy',]
z = util.compute_timediff_fillna(z)
dfs.append(z)
df2 = pd.concat(dfs)
return df2
return {
"train_attack_df": concat_processed_files(data["train_attack_files"]),
"test_attack_df": concat_processed_files(data["test_attack_files"])
}
def train(self, prepared_data):
df = prepared_data["train_attack_df"]
from sklearn.experimental import enable_hist_gradient_boosting
from sklearn.ensemble import HistGradientBoostingClassifier
X = df[FEATURES]
y = df.Label == "Tx"
self.model = HistGradientBoostingClassifier(max_iter=500).fit(X, y)
def evaluate(self, data):
df = prepared_data["test_attack_df"]
ypred = self.model.predict(df[FEATURES])
import sklearn.metrics
cf = sklearn.metrics.confusion_matrix(df.Label == "Tx", ypred)
acc = sklearn.metrics.accuracy_score(df.Label == "Tx", ypred)
print(cf)
print("Accuracy = %.4f" % acc)
self.metrics = {"confusion_matrix": cf, "accuracy": acc}
def predict(self, data):
df = data["df"].copy()
df = util.compute_timediff_fillna(df)
df['MsgIsAttack'] = 0
df['WindowInAttack'] = 0
for event_result in data["event_detection_results"]:
if event_result['WindowInAttack']:
# print("window %s in attack: event_result = %s" % (event_result['window_start'], event_result))
in_window = (df.Timestamp >= event_result['window_start']) & (df.Timestamp < event_result['window_start'] + WINDOW_SIZE)
w_df = df[in_window]
ypred = self.model.predict(w_df[FEATURES])
df.loc[in_window, "WindowInAttack"] = 1
df.loc[in_window, "MsgIsAttack"] = ypred.astype(int)
return {"injection_window_results": df}
from AutomotiveCybersecurity.models.gradient_boosting_msg_classifier import GradientBoostingMsgClassifierModel
m2 = GradientBoostingMsgClassifierModel()
data = m2.load_data(num_files=50)
prepared_data = m2.prep_data(data)
len train_attack_df = 242167
len test_attack_df = 243774
m2.train(prepared_data)
m2.evaluate(prepared_data)
[[203136 2966]
[ 13066 24606]]
Accuracy = 0.9342
m2.persist()
2020-08-14 22:21:08,989 INFO h1st.model_repository.model_repository: Saving metrics property... 2020-08-14 22:21:08,990 INFO h1st.model_repository.model_repository: Saving model property...
'01EFR910BWJEPT466ARTNCC18E'
class NoOp(h1.Action):
def call(self, command, inputs):
pass
graph = h1.Graph()
graph.start()\
.add(WindowGenerator())\
.add(h1.Decision(MsgFreqEventDetectorModel().load(), decision_field="WindowInAttack"))\
.add(yes=GradientBoostingMsgClassifierModel().load(),
no=NoOp())
graph.end()
results = graph.predict({"df": df})
results.keys()
2020-08-14 22:23:40,159 INFO h1st.model_repository.model_repository: Loading version 01EFQN6454J0AHK60F81PXV8CB .... 2020-08-14 22:23:40,164 INFO h1st.model_repository.model_repository: Loading version 01EFR910BWJEPT466ARTNCC18E ....
dict_keys(['df', 'window_starts', 'event_detection_results', 'injection_window_results'])
Now let’s evaluate the whole graph, especially focusing on the event-level TPR & FPR since they are crucial in the safe-mode deployment use case.
from AutomotiveCybersecurity.util import evaluate_event_graph
evaluate_event_graph(graph, data['test_attack_files'])
============
Event-level confusion matrix
[[1155 0]
[ 0 1300]]
Event TPR = 1.0000, FPR = 0.0000
(1155, 0, 0, 1300)
Woa! We ran through all 400ms windows in the test samples and got event-level FPR=0.0% with zero false positives! (Note that this is still a subsample of the data, but once you’ve tried it on the full dataset the results should be the same: zero false positive at event-level.)
The message-level accuracy should be nearly the same because we used the same classifier. However the decomposition leads to separation of concerns and requirement for these two use cases. We’re much more comfortable with the solution now both in terms of accuracy as well as robustness and explainability.
Another significance worth pointing out here is that we get multiple output streams from H1st.Graph: event-level outputs and msg-level outputs, exactly what we need for two different use cases we highlighted: safe-mode triggering and post-mortem analysis.
Summary & Further Resources¶
That was a long tutorial! But not a trivial
To recap, the H1ST.AI principles & ideas we’ve learned:
Leverage use-case analysis to decompose problems and adopt different models at the right level of abstractions
Encoding human experience as a model
Combine human experience and data-driven insights to work harmoniously in a H1st Graph
Most importantly, we have used H1ST.AI to tackle a real-world challenging automotive cybersecurity problem, for which attack event labels are not available to start with, hence solving the Cold Start problem.
It is important to stress that this is still a toy example IDS and much more is needed to handle attacks (e.g. replacement attacks where a whole ECU can be compromised & normal messages silenced and there won’t be a zig-zag pattern) and of course on-device vs cloud deployment, OTA updates, etc. But it is clear adopting H1ST.AI makes the problem much more tractable and explainable.
H1ST.AI framework further provides productivity tools for a team of Data Scientists and domain experts to collaborate on such complex software projects. Especially, we’ve seen our own productivity vastly when moving from a spaghetti code jungle of ML to a more principled H1ST project structure and make use of H1ST Model API & repository as well as Graph.
Interested? For further resources:
Check out our documentation site!
Contribute! Star/fork our Github repo, we’re looking forward to your contribution to move real-world industrial AI head and to drive “industrial processes and machines and robots”!


The last unsteady note of what had been barely recognizable as “The Wind That Shakes the Willow” faded mercifully away, and Mat lowered Thom’s gold-and-silver-chased flute. Rand took his hands from his ears. A sailor coiling a line on the deck nearby heaved a loud sigh of relief. For a moment the only sounds were the water slapping against the hull, the rhythmic creak of the oars, and now and again the hum of rigging strummed by the wind. The wind blew dead on to the Spray’s bow, and the useless sails were furled.
“I suppose I should thank you,” Thom Merrilin muttered finally, “for teaching me how true the old saying is.  The sailor burst out laughing, and Mat raised the flute as if to throw it at him. Deftly, Thom snagged the instrument from Mat’s fist and fitted it into its hard leather case. “I thought all you shepherds whiled away the time with the flock playing the pipes or the flute. That will show me to trust what I don’t know firsthand.”
“Rand’s the shepherd,” Mat grumbled. “He plays the pipes, not me.”
“Yes, well, he does have a little aptitude. Perhaps we had better work on juggling, boy. At least you show some talent for that.”
“Thom,” Rand said, “I don’t know why you’re trying so hard.” He glanced at the sailor and lowered his voice. “After all, we aren’t really trying to become gleemen. It’s only something to hide behind until we find Moiraine and the others.”
Thom tugged at an end of his mustache and seemed to be studying the smooth, dark brown leather of the flute case on his knees. “What if you don’t find them, boy? There’s no


Welcome to Nakala Analytics. We have seen you have signed up for our application. Please Confirm your Email by clicking below


Nigerian man writes open letter to all yahoo boys in Nigeria
by Sanya AgunbiadeA Nigerian writer Paul Geek has written an open letter to all yahoo boys in Nigeria.
In his piece, he tried to sensitize young Nigerians involved in online fraud on the damages it causes on the economy and the victims, and also gave enlightenment on how they could utilise their time on the internet for positive reasons.
 Apart from the fact that illegal wealth isn’t sustainable, illegal businesses are very addictive. You also lose your creative mind. There are 1001 legitimate businesses you could do online & earn a decent income!
You can make livings and meet ends without defrauding anyone or mailing foreigners to send you dollars in the name of 419. Admittedly, most advertised Internet businesses aren’t as profitable as we’re made to believe. However, a lot of them pay.
The biggest challenge with newbies is that they are over expectant and over ambitious, so the moment their expectations aren’t met as hurriedly as expected, they give up & join the millions who say Internet businesses don’t pay. Nothing good comes cheap!
It troubles me a lot seeing millions of our youths wasting precious time debating bitter politics, religion, tribal issues, etc, when such time could be used productively; for people with unemployment challenge. We need to have a sober reflection as youth.
The easiest & fastest skills/profession anyone could learn today are digital skills. With digital skills, your chances of getting a decent job increases by over 50% at the global labour market & you could work from the comfort of your home in Ajegunle, for a client/firm in Canada.
There are hundreds of thousands of Indians who earn a living from the comfort of their homes. They have no govt or corporate job. In fact, a lot of them don’t even have degrees. They only need to learn basic English & they’re good to go. I have hired hundreds of them, too.
We must kill this sense of entitlement we have held for long now. The sense of entitlement that because we are graduates or hold certain qualifications, the govt or our relatives owe us decent jobs & better lives. This may have been the case some 50yrs ago. Not in 2019, my brother!
We are now in an era where what you know (skills) beyond your conventional educational qualifications, is as or even more important than your educational qualifications, and the earlier we accept this reality, the better for us, especially as young people.
Nevertheless, govts at all levels must also be interested in championing this new direction of thinking as a means of solving youth restiveness & unemployment. This could be done through institutional framework restructuring, designing policies policies that will transform our economy into a digital economy and human-capital development. These have proven to create more jobs in the developing nations. Check Rwanda if I lie.
To achieve this, our leaders, especially political leaders, must first realise that they lack basic understanding of the digital world, then make efforts to learn & understand it; because you only give what you have & you cannot promote what you don’t believe. The time is NOW!
More Nigerian youths have access to the internet than Indians youths, but more Indian earn a living online than Nigerians. The difference? They are taught digital skills from primary school, while an average Nigerian attends his first computer training after graduation. What do they teach them? You already know.
The digital industry can employ more than most govt establishments, if govts could create the enabling environment. It would create more jobs & reduce the burden of employments from govt, as serious govts have little to do with direct job creation. They rather serve as ‘enablers’.
Fellas, the time is NOW to birth a new generation of radical thinkers. Are you ready?
Written By Paul Geek
Follow us on Facebook – @Lailasnews; Twitter – @LailaIjeoma for updates


A collection of routines and documentation that allows one to
perform voxel-wise quantitative analysis of dynamic contrast-enhanced MRI
(DEC-MRI) and diffusion-weighted imaging (DWI) data, with emphasis on
oncology applications.
| Version: |
0.55 |
| Depends: |
R (≥ 2.14.0), oro.nifti (≥ 0.4.3) |
| Imports: |
utils, parallel, methods |
| Suggests: |
bitops, minpack.lm, splines, XML, oro.dicom (≥ 0.4.3), testthat |
| Published: |
2018-09-15 |
| Author: |
Brandon Whitcher [aut, cre],
Volker Schmid [aut],
Andrew Thornton [ctb] |
| Maintainer: |
Brandon Whitcher <bwhitcher at gmail.com> |
| License: |
BSD_3_clause + file LICENSE |
| URL: |
http://www.dcemri.com/, http://dcemri.blogspot.com/ |
| NeedsCompilation: |
yes |
| Citation: |
dcemriS4 citation info |
| In views: |
MedicalImaging |
| CRAN checks: |
dcemriS4 results |


Welcome to Harso Documenation!! This is Harso Documenation.
In here you'll know a lot classes to make Responsive sites!! Let's Begin!!
Include the Given Code to Your Document  tag to use our classes.
Include the given in your head tag -
<link rel="stylesheet"<EMAIL_ADDRESS>type="text/css">
Site in Progress...Not Full Documenation.
In here you'll know a lot classes to make Responsive sites!! Let's Begin!!
Installation
So, You'll need to first Install Our CDN Code to your Document to use Harso Classes.Include the Given Code to Your Document  tag to use our classes.
Include the given in your head tag -
<link rel="stylesheet"<EMAIL_ADDRESS>type="text/css">
Site in Progress...Not Full Documenation.


A custom select / multiselect for Bootstrap using button dropdown, designed to behave like regular Bootstrap selects.
See a Bootstrap 3 example here.
Silvio Moreto, Ana Carolina, caseyjhol, Matt Bryson, and t0xicCode.
Create your <select>
with the .selectpicker
class.
<select class="selectpicker">
<option>Mustard</option>
<option>Ketchup</option>
<option>Barbecue</option>
</select>
If you use a 1.6.3 or newer, you don't need to do anything else, as the data-api automatically picks up the <select>
s with the selectpicker
class.
If you use an older version, you need to add the following either at the bottom of the page (after the last selectpicker), or in a $(document).ready()
block.
// To style only <select>s with the selectpicker class
$('.selectpicker').selectpicker();
Or
// To style all <select>s
$('select').selectpicker();
Checkout the documentation for further information.
N.B.: The CDN is updated after the release is made public, which means that there is a delay between the publishing of a release and its availability on the CDN. Check the GitHub page for the latest release.
Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing. Make sure you're using the latest version of bootstrap-select before submitting an issue.
Copyright (C) 2013-2015 bootstrap-select
Licensed under the MIT license.


|
数字式立体视觉刺激系统
1.0.1
Digital Stereo System
|
#include <nvapi.h>
Public 属性 | |
| NvU32 | version |
| Structure version. 更多... | |
| NvU32 | dpcd_ver |
| DPCD version of the monitor. 更多... | |
| NV_DP_LINK_RATE | maxLinkRate |
| Maximum supported link rate. 更多... | |
| NV_DP_LANE_COUNT | maxLaneCount |
| Maximum supported lane count. 更多... | |
| NV_DP_LINK_RATE | curLinkRate |
| Current link rate. 更多... | |
| NV_DP_LANE_COUNT | curLaneCount |
| Current lane count. 更多... | |
| NV_DP_COLOR_FORMAT | colorFormat |
| Current color format. 更多... | |
| NV_DP_DYNAMIC_RANGE | dynamicRange |
| Dynamic range. 更多... | |
| NV_DP_COLORIMETRY | colorimetry |
| Ignored in RGB space. 更多... | |
| NV_DP_BPC | bpc |
| Current bit-per-component;. 更多... | |
| NvU32 | isDp: 1 |
| If the monitor is driven by a DisplayPort. 更多... | |
| NvU32 | isInternalDp: 1 |
| If the monitor is driven by an NV Dp transmitter. 更多... | |
| NvU32 | isColorCtrlSupported: 1 |
| If the color format change is supported. 更多... | |
| NvU32 | is6BPCSupported: 1 |
| If 6 bpc is supported. 更多... | |
| NvU32 | is8BPCSupported: 1 |
| If 8 bpc is supported. 更多... | |
| NvU32 | is10BPCSupported: 1 |
| If 10 bpc is supported. 更多... | |
| NvU32 | is12BPCSupported: 1 |
| If 12 bpc is supported. 更多... | |
| NvU32 | is16BPCSupported: 1 |
| If 16 bpc is supported. 更多... | |
| NvU32 | isYCrCb422Supported: 1 |
| If YCrCb422 is supported. 更多... | |
| NvU32 | isYCrCb444Supported: 1 |
| If YCrCb444 is supported. 更多... | |
Used in NvAPI_GetDisplayPortInfo().
| NV_DP_BPC NV_DISPLAY_PORT_INFO::bpc |
Current bit-per-component;.
| NV_DP_COLOR_FORMAT NV_DISPLAY_PORT_INFO::colorFormat |
Current color format.
| NV_DP_COLORIMETRY NV_DISPLAY_PORT_INFO::colorimetry |
Ignored in RGB space.
| NV_DP_LANE_COUNT NV_DISPLAY_PORT_INFO::curLaneCount |
Current lane count.
| NV_DP_LINK_RATE NV_DISPLAY_PORT_INFO::curLinkRate |
Current link rate.
| NvU32 NV_DISPLAY_PORT_INFO::dpcd_ver |
DPCD version of the monitor.
| NV_DP_DYNAMIC_RANGE NV_DISPLAY_PORT_INFO::dynamicRange |
Dynamic range.
| NvU32 NV_DISPLAY_PORT_INFO::is10BPCSupported |
If 10 bpc is supported.
| NvU32 NV_DISPLAY_PORT_INFO::is12BPCSupported |
If 12 bpc is supported.
| NvU32 NV_DISPLAY_PORT_INFO::is16BPCSupported |
If 16 bpc is supported.
| NvU32 NV_DISPLAY_PORT_INFO::is6BPCSupported |
If 6 bpc is supported.
| NvU32 NV_DISPLAY_PORT_INFO::is8BPCSupported |
If 8 bpc is supported.
| NvU32 NV_DISPLAY_PORT_INFO::isColorCtrlSupported |
If the color format change is supported.
| NvU32 NV_DISPLAY_PORT_INFO::isDp |
If the monitor is driven by a DisplayPort.
| NvU32 NV_DISPLAY_PORT_INFO::isInternalDp |
If the monitor is driven by an NV Dp transmitter.
| NvU32 NV_DISPLAY_PORT_INFO::isYCrCb422Supported |
If YCrCb422 is supported.
| NvU32 NV_DISPLAY_PORT_INFO::isYCrCb444Supported |
If YCrCb444 is supported.
| NV_DP_LANE_COUNT NV_DISPLAY_PORT_INFO::maxLaneCount |
Maximum supported lane count.
| NV_DP_LINK_RATE NV_DISPLAY_PORT_INFO::maxLinkRate |
Maximum supported link rate.
| NvU32 NV_DISPLAY_PORT_INFO::version |
Structure version.


Info:
Assure-Music is a bot, fully musical.
It uses the DisTube package, and is much simpler than AssureBOT.
Commands:
> Normal Commands:
- help - shows all bot commands
- bot-info (bot, botinfo) - shows info about bot
- calculator (calc) - calculate eclarifies the action given
- avatar (pfp) - shows a pinged user avatar
- ping (ms) - shows a bot latency in ms
> Config Commands:
- setprefix - changes bot prefix
> Music Commands:
- play (p) - plays music
- stop - stopps the music (and disconnects from the voice channel)
- pause - pausing music
- resume - resuming music
- skip - skipps music
- queue - shows music queue
- loop - loops song/queue
- volume - changes music volume
So now, you know all Assure-Music Commands. Enjoy!


| SI No. | Course | Institution/School | Board/University | Years of passing | Aggregate |
|---|---|---|---|---|---|
| 1. | B.Tech (Computer Science and Engineering) | Indian Institute of Information Technology, Kalyani | IIIT Kalyani | Dec 2017 (pursuing) | 9.2 |
| 2. | Higher Secondary | Sunbeam School Lahartara, Varanasi | Central Board of Secondary Education | March 2016 | 93% |
| 3. | Matriculation | St. John's School Marhauli, Varanasi | Council for the Indian School Certificate Examinations | March 2014 | 94.7% |


Verify that unusual activity is logged.
Unusual activity may be an indication that an attack is in progress.
Use the following steps to verify that unusual activity is logged:
Define unusual activity. Make a list of events that constitute unusual activity. Some examples are:
Identify relevant code. Use the list of unusual activity indicators to find code that implements the functionality for each unusual activity. Make a list of functions that implement the related functionality. One common area for detecting suspicious activity is authentication code. Combine this list with the list from Step 1.
Examine code. Verify that for each possible suspicious activity code exists that generates log entries by examining all functions related to each suspicious activity.
Perform the following actions to implement logging of unusual activity:
Define unusual activity. Make a list of events that constitute unusual activity. Some examples are:
Identify relevant code. Use the list of unusual activity indicators to find code that implements the functionality for each unusual activity. Make a list of functions that implement the related functionality. One common area for detecting suspicious activity is authentication code.
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 subsystems 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.
Log unusual activity. Use the list of functions that are related to suspicious events from step 2 to add code that generates log entries when suspicious activity occurs. Use the list of logging APIs from step 3 to write code that generates log entries.


| # | $Date | $Time | $Amount |
|---|---|---|---|
| 3326 | $Date | 3:29 PM | $321.33 |
| 3325 | $Date | $Time | $Money |
| 3324 | $Date | $Time | $Money |
| 3323 | $Date | $Time | $Money |
| 3322 | $Date | $Time | $Money |
| 3321 | $Date | $Time | $Money |
| 3320 | $Date | $Time | $Money |
| 3319 | $Date | $Time | $Money |
Flot is a pure JavaScript plotting library for jQuery, with a focus on simple usage, attractive looks, and interactive features. In SB Admin, we are using the most recent version of Flot along with a few plugins to enhance the user experience. The Flot plugins being used are the tooltip plugin for hoverable tooltips, and the resize plugin for fully responsive charts. The documentation for Flot Charts is available on their website, http://www.flotcharts.org/.
View Flot Charts Documentation


Across: 1,31. Dubious choice of venue saw noted team play badly (8 8) 5. Initially bands opening rocked around the trouble (6) 10,30. Act ten: SOS! (7 6) 11. When sour heart gives way to hate, ultimately trouble becomes much greater (7) 12. Stout beer right to appear early? (5) 13. Live? Ed set out thus! (9) 14. How many sisters received Arthur in Avalon in 28? (4) 15. Listless one, miserable (9) 20,1dn. Spreading feelers in Japan for band (9 8) 21. Nasty eye lump? (4) 24. Idiot's bunk: "mull's synthesised" (9) 27. Greek scene... tragic or funny part? (5) 28. Rocky glen and green and pleasant land (7) 29. City consumption is in 1-51 range (7) 30. see 10 across 31. see 1 across Down: 1. see 20 across 2. As 3 out of 4 told, era once meant permissiveness (9) 3. Harmed ambition to get into medicine (6) 4. Thing's going all wrong ... just not your day? (5) 6. Summary declaration of injury capturing spirit about its source (8) 7,22. Senegal shall revolt without a 19 force hired to keep folks 18 at 1 across (5 6) 8. Desperate desire to live (6) 9. Must I let Tommy carry weapon? (8) 16. Convince one to leave work - super idea! (8) 17. Wit I never managed when chatting! (9) 18. Out of the spotlight, "Gestapo" changed, the quiet becoming quite loud (8) 19. Bond foiled city ruse (8) 22. see 7 down 23. Moving cave? It moved! (6) 25. He has poor eyesight, but makes short work of magazine with glasses (5) 26. Pause outside of life, before getting put back (3-2)


Projects
Terminal Reality
For my final year undergraduate project we had to create a 3D multilayer game, as I
co-majored in Computer Games Development and Computer Science.
We created Terminal Reality, a first person zombie shooter where you have to fight your way out of a Zombie
infested hospital.
This project was done in collaboration with Alon Bresler and Osher Shuman.
The game’s website can be found
here,
where more info and some media content is available, as well as the game itself. The code can be found on my
GitHub page.
BantuWeb
My honours project involves making the Web portal and corresponding back-end for a digital archive for
resource scare South African languages. More about the project can be found on our website.
My role in the project involves creating a Web portal for users to explore the content and for them to
upload their own content in resource scare languages.
Gamification plays a big role, as I am researching how Gamification can influence users to
contribute more content. On the front-end I am using AngularJS and Bootstrap which is working together with a
python Django back-end. I purposefully chose this part of the project as in our undergrad and honours years
no Web development was covered and saw this as an opportunity to get into this important field. Even though
it has been a learning curve of note, I have enjoyed it a lot and pride myself in how much I have achieved
in this field in such a short time for the project.
Kalahari-Eye
In my spare time (which there has been none of this year), I am working on a project for a
family friend involving live video feed processing over long WiFi connections for mobile devices. The
project has taught me a lot and is very interesting to me as it involves a lot of different technologies
that I have previously not worked with. The project is still in very early stages as I have only worked on
it for about a month, but hopefully I have more time to work on it soon. All code can be found on my
GitHub page.


|
xpcc
|
MCP23xxx SPI Transport Layer. More...
#include <xpcc/driver/gpio/mcp23_transport.hpp>
Public Member Functions | |
| Mcp23TransportSpi (uint8_t address) | |
| xpcc::ResumableResult< bool > | ping () |
| pings the sensor | |
| Public Member Functions inherited from xpcc::SpiDevice< SpiMaster > | |
| void | attachConfigurationHandler (Spi::ConfigurationHandler handler) |
Protected Member Functions | |
| xpcc::ResumableResult< bool > | write (uint8_t reg, uint8_t value) |
| write a 8bit value | |
| xpcc::ResumableResult< bool > | write16 (uint8_t reg, uint16_t value) |
| write a 16bit value | |
| xpcc::ResumableResult< bool > | read (uint8_t reg, uint8_t &value) |
| read a 8bit value | |
| xpcc::ResumableResult< bool > | read (uint8_t reg, uint8_t *buffer, uint8_t length) |
| read multiple 8bit values from a start register | |
| Protected Member Functions inherited from xpcc::SpiDevice< SpiMaster > | |
| bool | acquireMaster () |
| bool | releaseMaster () |
| Protected Member Functions inherited from xpcc::NestedResumable< 2 > | |
| NestedResumable () | |
| Construct a new class with nested resumable functions. | |
| void | stopResumable () |
| Force all resumable functions to stop running at the current nesting level. | |
| bool | isResumableRunning () const |
| int8_t | getResumableDepth () const |
This class manages communication with the gpio expcander via the SPI bus. The SPI interface can be clocked with up to 10MHz and requires Mode3.
| Cs | connected Chip Select Pin |


Expected array but received: {0}
This error occurs when orderBy is not passed an array-like value:

{{ key }} : {{ value }}

orderBy
must be used with an array-like value so a subset of items can be returned.
The array can be initialized asynchronously and therefore null
or undefined
won't throw this error.
To use orderBy
to order the properties of an object, you can create your own array based on that object:
angular.module('aModule', [])
.controller('aController', function($scope) {
var myObj = {
one: {id: 1, name: 'Some thing'},
two: {id: 2, name: 'Another thing'},
three: {id: 3, name: 'A third thing'}
};
$scope.arrFromMyObj = Object.keys(myObj).map(function(key) {
return myObj[key];
});
});
That can be used as:

Order by:
<select ng-model="orderProp" ng-options="prop for prop in ['id', 'name']"></select>

[{{ item.id }}] {{ item.name }}

You could as well convert the object to an array using a filter such as toArrayFilter:

Order by:
<select ng-model="orderProp" ng-options="prop for prop in ['id', 'name']"></select>

[{{ item.id }}] {{ item.name }}


Automate user's manual operation on web browser with Selenium and Python
Environment
- Python 3 and libraries
- Selenium
- Google Chrome
Automate MA BID Cost Data Update
Automate manual operation that users are updating cost data in few pages (40 cells by page) by using Python and Selenium technology.
Effect: Workload reduction over 80% and creation of input data
Automate Searching CISCO Inventory
Search and summarize product ID of CISCO inventory data from P/N list automatically and sequentially via CISCO/MA Inventory web site by using Python and Selenium technology.
Effect: Warehouse space cost reduction about 200K$ by parts scrap


Web Event Display, tests
Examples
The following examples should all work, or the merge request should be rejected.
Geometry display
This test should show some simple geometry
Show
ATLAS
Show the ATLAS detector
One simple event
Show
TrackML
Visualisation for TrackML
Shows how to write a custom event loader
Show


KEDU!
Visualize Customer Service Insights Like Never Before.
Friendliness
Problem-Solving Ability
Quality of Conversation
Clarity
Time-Saving Ability
Reliable Information
Extract More Data From Customer Analytics.
Know Your Net Promoter Score Per Period.


@(title: String, headline: Html = Html(""), scripts: Html = Html(""), styles: Html = Html(""))(content: Html)(implicit assets: AssetsFinder)


|
BlockSnake
|
#include <SnakeHead.hpp>
Public Member Functions | |
| SnakeHead (AssetManager *assetManager, Vector3f startPos, SnakeScene *scene) | |
| Public Member Functions inherited from GameObject | |
| Vector3f | getPosition () const |
| bool | canCollide () const |
| virtual | ~GameObject () |
Protected Member Functions | |
| virtual void | update (float tpf) override |
| virtual void | onDestroy () override |
| virtual void | draw (float aspect) override |
| virtual void | onKeyDown (unsigned short keycode) override |
| virtual void | onCollision (GameObject *col) override |
| Protected Member Functions inherited from GameObject | |
| Matrix4x4< float > | getCurrentMat (float aspect) |
Private Types | |
| enum | Direction { Direction::Left, Direction::Right, Direction::Up, Direction::Down } |
Private Attributes | |
| SnakeScene * | scene |
| float | distance = 0.1f |
| GLint | mv_location |
| int | snakeHeadProgram |
| int | primitive |
| std::chrono::steady_clock::time_point | timer |
| AssetManager * | assetManager |
| SnakeBody * | body |
| Direction | direction |
Additional Inherited Members | |
| Protected Attributes inherited from GameObject | |
| Vector3f | position |
| bool | doesCollide |
| Vector3f | scale |
| Vector3f | rotation |
The head of the snake
|
strongprivate |
| SnakeHead::SnakeHead | ( | AssetManager * | assetManager, |
| Vector3f | startPos, | ||
| SnakeScene * | scene | ||
| ) |
initializes the snakehead
| assetManager | the assetmanager that manages the resources |
| startPos | The starting position of this head |
| scene | The scene containing this head |
|
overrideprotectedvirtual |
Implements GameObject.
|
overrideprotectedvirtual |
Reimplemented from GameObject.
|
overrideprotectedvirtual |
Reimplemented from GameObject.
|
overrideprotectedvirtual |
Reimplemented from GameObject.
|
overrideprotectedvirtual |
Implements GameObject.
|
private |
The assetmanager it receives it's assets from
|
private |
Next in line of the body
|
private |
The current direction it goes
|
private |
The distance of the body behind
|
private |
|
private |
The cube reference
|
private |
The scene where the head is residing
|
private |
The opengl program of the snake
|
private |
movement timer


(PECL ibm_db2 >= 1.0.0)
db2_num_rows — Returns the number of rows affected by an SQL statement
$stmt
) : intReturns the number of rows deleted, inserted, or updated by an SQL statement.
To determine the number of rows that will be returned by a SELECT statement, issue SELECT COUNT(*) with the same predicates as your intended SELECT statement and retrieve the value.
If your application logic checks the number of rows returned by a SELECT
statement and branches if the number of rows is 0, consider modifying your
application to attempt to return the first row with one of
db2_fetch_assoc(), db2_fetch_both(),
db2_fetch_array(), or db2_fetch_row(),
and branch if the fetch function returns FALSE
.
Note:
If you issue a SELECT statement using a scrollable cursor, db2_num_rows() returns the number of rows returned by the SELECT statement. However, the overhead associated with scrollable cursors significantly degrades the performance of your application, so if this is the only reason you are considering using scrollable cursors, you should use a forward-only cursor and either call SELECT COUNT(*) or rely on the boolean return value of the fetch functions to achieve the equivalent functionality with much better performance.
stmt
A valid stmt resource containing a result set.
Returns the number of rows affected by the last SQL statement issued by the specified statement handle.


udf.start()
// Fill queue with docs; progress bar will not be updated until this is done
for x in xs:
in_queue.put(x)
in_queue.put(UDF.QUEUE_CLOSED)
while any([udf.is_alive() for udf in self.udfs]) and count_parsed < total_count:
// Fill queue with docs; progress bar will not be updated until this is done
docs_added = 0
xs_generator = xs.generate()
for _ in range(min(parallelism, total_count)):
in_queue.put(next(xs_generator))
docs_added += 1


New Phrases
Cloud History
Cloud Search
This extension is made by PhanNguyen -<EMAIL_ADDRESS>List of new phrases
Delete
Cloud up
Add row
Print
Top
Bottom
No
Cloud?
Phrase
Category
Vietnamese
English
Last modified
History list of cloud phrases
Show
Print
Top
Bottom
No
Phrase
Category
Vietnamese
English
Created on
Search cloud phrases
Search
Filter your search
All
Phrase
Category
English meaning
Vietnamese meaning
Print
Top
Bottom
No
Phrase
Category
Vietnamese
English
Created on


Located in a peaceful bungalow outside of Stowe, Vermont.
Retreat from the desk, return refreshed.
Have the work week you always dreamed of- without the bad wifi.
12 private rooms with ensuite bathrooms, 2 group meeting rooms, and 4 breakout rooms.
Private chef team providing on demand meals- just like your team kitchen.
5 outdoor obstacle courses, including private beach 1/2 mile from bungalow.
Retreat faciltator to manage your day to day activities so you all get a chance to reset.
Dedicated computer room for times that you must wifi.
Become a stronger team in 5 days, like these companies.
LaCrue Bottling Co.
Our team didn't want to leave. From here on out, we are doing it every quarter: work hard, retreat 4xs a year. The accomodations were top notch, and the chefs went out of their way to blow everyone's minds. We swam, had a bonfire on the beach, communicated about some surpressed topics, and released some emotions.


Maritime Bulletin Daily Nov 07 – 08
by Mikhail VoytenkoAccidents
• Tanker fire, Singapore Strait UPDATE
• Bulk carrier aground, West Mediterranean Update
• Captain medevac, Red sea
• Cruise ship CELEBRITY XPEDITION refloated after soft grounding UPDATE disabled breached
• Vessel attacked in Gulf of Guinea UPDATES 2 attacks reported 1 confirmed
• Aground and Not Under Command vessels Worldwide Alerts (3 ships)
Details only for subscribers.
Annual subscription $750. For annual subscription, contact<EMAIL_ADDRESS>Subscribe if you want to receive accidents news ASAP and in full.


Weather Dashboard
Search For a City:
Search
Atlanta, US
New York, US
Lagos, NG
London, UK
Nicosia, CY
5-Day Forecast:


Welcome to Your New Cat!
Your Device: Domestic cat (Felis catus)
Model: Sir Katniss EverKitty
Release Date: May 1, 2015
Original Release: 8,000 BC
Congratulations Human! You have been entrusted to perform the duties of the primary caregiver for your new cat! Remember, you do not own your cat. Your cat owns you. Your new cat has bestowed upon you the privilege of providing them with food, water, shelter, and attention when so requested.
Model Specifications
- Responds to:
Katniss
- Indentifies as:
Male
- Age:
3 years old
- Weigth:
3.6 kg
- Altered:
YES (Neutered)
Parts List
Head
Body
Tail
Sensors
Product History
The domestic cat is believed to have evolved from the Near Eastern wildcat, whose range covers vast portions of the Middle East westward to the Atlantic coast of Africa. Between 70,000 and 100,000 years ago the animal gave rise to the genetic lineage that eventually produced all domesticated cats, having diverged from the Near Eastern wildcat around 8,000 BC in the Middle East.
Product Life Span
The average lifespan for a domestic cat is 15 years
. Spayed and neutered cats live much longer than cats who are unaltered.
Preparing Your Home
It is very important to make preparations before your new cat enters your home. Some cats may be less demanding than others. However, most new cats will expect some basic requirements to be met upon entering your home for the first time.
Installation Requirements
- The home must be a clean environment.
- Do not try to tell your new cat which room belongs to them. Your new cat will claim their rooms without your assistance.
WARNING: Be prepared to find out that your room now belongs to your new cat.
- There must be a designated area for your new cat's food bowls. Most cats will allow you to choose this space.
Recommended Accessories
Cat Tree
An Empty Box
Catnip
Holding Your Cat
Be patient. Your cat will make it known when they wish for you to carry them in your arms.
Key Functions
Sleeping
Eating
Grooming
Slow blinking
Laying around
Laying on your stuff
Ignoring you
Installed Software
Sleep Time
Eat Time
Pee & Poo Time
Self-Grooming Time
Training Options (Software Add-Ons)
No training options are available for your model.
Fuel Requirements
Water
Meat
Catnip
Interior Maintenance
Your cat should have access to food and water at all times. It is best to keep a steady supply of fuel accessible.
Exterior Maintenance
Your cat has self-grooming protocols already installed. There is no reason to ever bath your cat. Doing so could result in an angry cat. You do not want to see your cat when they are angry.
Troubleshooting
Your cat is working exactly as intended. Defective cats do not exist.
Cat. Wikipedia: https://en.wikipedia.org/wiki/Cat.
A 10-Step Instruction Manual for Your New Cat. Petful: https://www.petful.com/behaviors/cat-instruction-manual.
Brunner, Dr. David. The Cat Owner's Manual. Philadelphia: Quirk Books, 2004. Print.
This documentation was written, designed, and coded by Racheal Baker. Sir Katniss EverKitty is a real cat who choose the author of this page as his primary caregiver.


Examples that will never be included
Danger
Importing code from an external site using an import hook could lead to unsafe behaviour and could possibly cause damage on the user’s computer; I want to protect users of my creation from such possibility.
Some examples are (most probably) never going to be included in this project. These are examples such as:
Importing code from an external site.
Any sort of use of braces to enclose a block of Python code.
Todo
Add these examples
I need to add some explanations and provide links to the following examples:
importing “best answer” from StackOverflow
installing module from pypi on request (David Beazley’s talk)
etc.


Toggle navigation
Frank
Resume
Portfolio
Frank Rodriguez
LAMP Stack Developer
Contact
930 South Pine Street, 78210
<EMAIL_ADDRESS>FrankARod
Cell:<PHONE_NUMBER> Home:<PHONE_NUMBER>
Education
LAMP+J Software Development Bootcamp
Codeup, August 2014-November 2014
High School
Brooks Academy of Science and Engineering, 2010-2014
Work Experience
Intern
Codeup, January 2014-May 2014
Honors
National Hispanic Scholar
Honorable Mention


selectors.Rmd
The Get Started guide present basic selectors which are plenty enough in most cases. However, linne comes with some more sophisticated ones if needed.
Below are the basic selectors available in linne.
sel_id()
- Select an object by its id, e.g.: sel_id('btn')
selects shiny::actionButton('btn', 'Button')
.sel_all()
- Selects everything, will apply a change to every element of the page.sel_input()
- Selects an input by its id, e.g.: sel_id('txt')
selects shiny::textInput('txt', 'Text')
.sel_class()
- Select all elements bearing a specific class, e.g.: sel_class('cls')
, selects shiny::h1('hello', class = 'cls')
.sel_tag()
- Select all tags, e.g.: sel_tag('p')
selects p('hello')
.sel_attr()
- Select all tags with a specific attribute.Examples
You can also use some special operators to broaden or narrow down the selection.
%child%
- Selects elements where right hand is child of left hand, e.g.: sel_tag('div') %child% sel_class('aClass')
selects elements with aClass
who are direct children of div
tags.%or%
- Select left hand or right hand, e.g.: sel_id('myId') %or% sel_class('myClass')
will select both the element with the id and elements with the class. Ideal to select and apply changes multiple elements at once.%with%
- Left hand selector with right hand selector, e.g.: sel_tag('div') %with% sel_class('aClass')
selects a div
with a class of aClass
. Ideal to narrow down the selection.Examples
You can also use the when_*
family of functions to narrow the selection based on the state of the element.
when_active()
- Only select only active links.when_hover()
- Only select when the element is hovered.when_focus()
- Only select when the elements is focused.Examples
sel_tag("a") # select all a tag #> ℹ CSS selector: a sel_tag("a") %>% when_active() # selects a tags that are active #> ℹ CSS selector: a:active sel_id("myId") %>% when_hover() #> ℹ CSS selector: #myId:hover


Only people with that external IP can enter this chat room.
Commands: /nick {Your Name} and /me {your status}
Connecting...


email {{user.email}} phone {{user.profiles?.phone||'Mobile unavailable'}} history member since {{user?.createdAt|moment:true}} exit_to_app Last login : {{user?.lastLoggedIn|moment}}
Issuer Name: {{user.issuerName}}
Wallet Address: {{user.walletAddress}}
verified_user Profile is Verified
info_outline Profile changes is pending for approval
highlight_off Profile changes is rejected
| Image | Size | Progress | Actions |
|---|---|---|---|
| {{ item?.file?.size/1024/1024 | number:'.2' }} MB |
|


Login to Apache Fortress Web
Enter Creds
UserID
Password
Copyright (c) 2003-2023, The Apache Software Foundation. All Rights Reserved.;


Till now, you have seen how to print something on the screen and the basics of writing code in C++. Now let's move forward.
Before introducing variables, look at the following example.
#include <iostream>
int main()
{
int n; // declaring integer variable n
n = 4; // assigning 4 to n
std::cout << n; //printing the value of n
return 0;
}
In this example, n is a variable. Variables are used to store certain values. In our case, we stored a value of 4 to the variable n. Let's understand the above example.
int n; - This statement declares that variable 'n' can store some integer value. Whenever a variable is declared, it occupies some space in memory.
n = 4; - This assigns a value 4 to the variable 'n'.
std::cout << n; - This statement prints the value of the variable 'n' and hence 4 gets printed.
Note that 'n' is not written inside " ". 'n' written inside " " would have printed simple n instead of the value of 'n'. Let's see an example:
#include <iostream>
int main()
{
int n; // declaring integer variable n
n = 4; // assigning 4 to n
std::cout << "n is " << n; //printing the value of n
return 0;
}
As you have seen, 'n' inside " " is simple alphabetical character but the later 'n' is the one used as variable.
Initialization
We can also assign the value to a variable at the time of its declaration. Such assignment is known as initialization. Thus, we can assign a value 4 to a variable n at the time of its declaration as follows.
int n = 4;
Here, we initialized a variable 'n' with a value 4.
An uninitialized variable is the one to which we have not assigned any value. Unlike some programming languages where a variable which has not been assigned any value takes a value zero, an uninitialized variable in C++ by default takes some garbage value.
Data Types
Variables can be of different types depending on the type of data it can store. In the last example, the variable 'n' was declared 'int' and thus can store an integer value. Therefore, it was of type int. Similarly, a variable which stores a character value is of type char and so on.
We specify the type of a variable at the time of declaration. For example, a character variable is declared as shown below.
char ch;
In the above declaration, ch is the name of the variable which is of type char i.e., it can store character values. Let's see an example to print a character value.
#include <iostream>
int main()
{
char ch; // declaring character variable
ch = 'b'; // assigning value 'b' to variable
std::cout << ch;
return 0;
}
Here ch is the name of a variable of type char which is given a character value b. Note that the character value is assigned within ' '. Characters are written inside ' '.
Similarly, there are other data types like float (number having decimal), double (number having decimal) and boolean (true or false). These are listed in the following table along with their sizes.
| Type | Keyword | Size (bytes) | Range of Value |
|---|---|---|---|
| Integer | int | 4 | -2,147,483,648 to 2,147,483,647 |
| Floating point | float | 4 | 1.8E-38 to 3.4E+38 |
| Double floating point | double | 8 | 2.2E-308 to 1.8E+308 |
| Character | char | 1 | –128 to 127 |
| Boolean | bool | 1 | false or true |
The sizes of variables might change depending on the compiler and the computer you are using.
Thus, we can store any type of data in a variable by declaring its datatype. Let's see an example.
#include <iostream>
int main()
{
using namespace std;
int i; //declaring integer variable
float f; //declaring float variable
double d; //declaring double variable
char c; //declaring character variable
bool b, bl; //decaring boolean variable;
//assigning values to these variables
i = 45;
f = 34.234;
d = 34.43242343;
c = 'g';
b = true;
bl = 5 < 4;
cout << "int : " << i << endl;
cout << "float : " << f << endl;
cout << "double : " << d << endl;
cout << "char : " << c << endl;
cout << "b : " << b << endl;
cout << "bl : " << bl << endl;
return 0;
}
float : 34.234
double : 34.4324
char : g
b : 1
bl : 0
Here we declared variables of type int, float, double, char and boolean and stored respective values in these. One thing to note here is that boolean gives 1 when true and 0 when false. We declared two boolean variables (b and bl). Since we assigned true to b, therefore it printed 1 and since the expression which we assigned to bl (5 < 4) is false, hence it printed 0.
Taking input for different data-types
Now let's see an example to input a character in C++.
#include <iostream>
int main()
{
char ch;
std::cin >> ch;
std::cout << ch;
return 0;
}
g
This is the same as what we did in the case of integers, with the only difference in the datatype. Similarly, we can input all types of values from the user like float, double etc.
How is a character value stored?
Whenever a character value is given to a variable of type char, its ASCII value (an integer value) gets stored (and not the character value).
We use int(ch) to print the integer value (ASCII value) of any character 'ch'.
You can download the full ASCII from here.
Let's see an example to print the ASCII value of a character.
#include <iostream>
int main()
{
char ch;
std::cin >> ch;
std::cout << int(ch);
return 0;
}
65
When we gave the value 'A' to the variable 'ch', the ASCII code (65) of 'A' gets stored in ch. So, int(ch) displays its integer value i.e. ASCII value.
Type Casting
Suppose, you have a variable whose value is 23.2332 but at some line of your code you want to use its integer value only i.e. 23. The simplest solution is type casting.
Type Casting is the conversion of a variable from one data type to another data type. For example, if we want to convert a char value to an int value.
Type Conversions are of two types - implicit and explicit.
Implicit Conversion
Suppose, we are adding two numbers. The first number is of type int and the second number is of type float. Since we cannot add an int and a float, so both the numbers have to be of the same data type i.e., either both are int or both are float. Since float is a larger data type than int, therefore int variable gets converted into float automatically and then both the float variables add up. This automatic conversion is called implicit conversion.
#include <iostream>
int main(){
int a = 12;
char ch = 'h';
//will add ASCII value of ch
int sum = a + ch;
std::cout << "sum = " << sum << std::endl;
return 0;
}
In the above code, when 'a' and 'ch' were added, the integer value of 'ch' (ASCII value) i.e. 104 gets added to the integer value of 'a' to produce a sum of 116.
Explicit Conversion
We can also manually convert values from one data type to another as follows:
( data-type ) expression ;
Consider an example.
#include <iostream>
int main(){
float x = 2.45;
std::cout << (int)x << std::endl;
}
In this example, since x is declared of type float, therefore we are converting float to type int by writing (int)x.
This is the same thing we did to get the ASCII value of a character. We just converted it into int.
l-values and r-values
We know that when we declare a variable, it is given a memory location and its value is stored in that location. Each memory location has an address which becomes the address of the variable which occupies that memory location.
Now let's come to l-value and r-value. An l-value is a value which has an address. Thus all variables are l-values since variables have addresses. Since the name l-value stands for left-value, so these are always on the left side in an assignment statement (a statement in which we assign the value from the right side to the left side). Therefore whenever a variable is assigned some value, it is always written on the left side of the assignment operator (=).
An r-value is a value which is assigned to an l-value. For example, in the statement x = 8;, x is a l-value since it is a variable to which some value is being assigned and 8 is an r-value since it is being assigned to x. Note that when we write 5 = 8;, there will be a compilation error because 5 is not an l-value (since it is not a variable having any memory space). Let's look at the following example.
#include <iostream>
int main()
{
int x, y;
x = 4;
y = x + 2;
std::cout << "x = " << x << ", y = " << y;
return 0;
}
In the statement x = 4;, 4 is an r-value since it is on the right-hand side and is being assigned to 'x' which is an l-value. Similarly, in the statement y = x + 2;, 'y' is an l-value since it is on the left side and has a memory space. The expression 'x + 2' is an r-value since its value (4 + 2 = 6) is being assigned to the variable 'y'.
Note that to print the value of 'x', 'x' is written without " ".
Literals
Literals are constants which have the same value which cannot be changed in the whole program. For example in x = 5, 'x' is a variable and 5 is a literal (constant) and thus the value of 'x' can be changed but not of 5.
Commonly used literals are Integer Numerals, Floating-Point Numerals, Characters, Strings, Boolean and user-defined literals. Let's have a brief look at them one by one.
Integer Literals
These are constants which are integer values. For example, 45, -256 etc.
Floating-Point Literals
These constants are numbers with decimal. These are of type float or double. Numbers like 23.434, 1.2e-234 and 4.57e152 are examples of floating-point literals.
Characters and Strings
Characters are enclosed within ' '. These can be letters (like 'a','s','z', etc), escape sequence (like \t) or some universal character.
There are some special sequence characters like '\t', '\n' which have some specific meaning. For example,
'\n' is used for changing line,
'\t' is used to give a tab space horizontally,
'\v' is used to give one tab space vertically,
'\'', '\"', '\\' and '\?' are used to print ', ", \ and ? respectively.
Strings are the collection of characters. In simple English, it is a letter, word, sentence or collection of sentences. You will go through a whole topic on string.
Strings are constants which are enclosed within " " like "Hello World", "C++".
So, 'a' is a character but "a" is a string.
#include <iostream>
int main()
{
std::cout << "Hello" << '\t' << "World" << '\n' << '\\' << '\'' << '\"';
return 0;
}
\'"
In the above example, the string written within " " got printed as it is. ' \t ' gave a one tab space between "Hello" and "World" and '\n' changed the line. '\'', '\\', '\"' printed ', \ and " respectively.
Boolean
We have two Boolean literals which are true and false. These Boolean literals are also keywords in C++.
Thus literals are just constants which we have been using in our programs so far. There are also some user-defined literals which you will learn in later chapters.
There is no glory in practice but there is no glory without practice.


West, George White
| Birth Name | West, George White |
| Gender | male |
| Age at Death | 62 years, 4 months, 26 days |
Narrative
May 2006 - Looked at Gore Hill Cemetery Book to find the deaths of George & Ellen & Arthur & Winifred's death dates.
SMH - WEST - 27 May, 1939, at 35a Murray St, Croydon, GEORGE WEST, beloved husband of Ellen West, & loved father of Jack, & Eldest son of the late Arthur Annesley West, M.D, F.R.C, S.I, T.C.D., and Mary Elizabeth West. By request no mourning.
FUNERAL - WEST - The rels & friends of Mrs. Ellen West, Mr. & Mrs. J. West are invited to attend the Funeral of her beloved Husband & their Father, GEORGE WHITE WEST; to leave his late residence, 35a Murray St, Croydon, This Monday afternoon, after a service at 1.45pm, for Gore Hill Cemetery, arriving at Cemetery at 2.45pm.
Events
| Event | Date | Place | Description | Sources |
|---|---|---|---|---|
| Birth | 1877 | Kildare Ireland | ||
|
|
||||
| Death | 1939-05-27 | Burwood NSW #13480 | ||
|
|
||||
| Burial | 1939-05-30 | CofE Cemetery, Gore Hill NSW | ||
|
|
Parents
| Relation to main person | Name | Birth date | Death date | Relation within this family (if not by birth) |
|---|---|---|---|---|
| Father | West, Arthur Annesley White | 1883 | ||
| Mother | Parker, Mary Elizabeth | 1852 | ||
| West, George White | 1877 | 1939-05-27 |
Families
Family of West, George White and Nye, Ellen Rubener(Rubina) |
||||||||||||||||
| Married | Wife | Nye, Ellen Rubener(Rubina) ( * 1873 + 1957-07-31 ) | ||||||||||||||
|
||||||||||||||||
| Children |
| Name | Birth Date | Death Date |
|---|---|---|
| West, Arthur Reginald “Jack” White | 1900 | 1961-09-25 |
| Type | Value | Notes | Sources |
|---|---|---|---|
| _UID | 5310BB60A7CBDA119522EFAAAFD134AC8BA9 |
Attributes
| Type | Value | Notes | Sources |
|---|---|---|---|
| _UID | 5210BB60A7CBDA119522EFAAAFD134AC8A99 |


influenza (.–.) cases virus risk European (%) data fatal <. vaccination reported underlying conditions {border-style :–. disease Centre age analysis px;} reporting #ffffff;} Disease Health ICU years associated CI, Prevention patients Available at: increased infection outcome pandemic respiratory severe surveillance Control .collab: Influenza (IRR, Ref. age, available chronic countries factors included known Member Surveillance []. information lung seasonal subtype A(HN)pdm Accessed basic care death determinants seasons study women HIV Infect Public States admitted dataset disease, number outcome. px; viruses {font-family Analysis Cases Risk analysis. clinical collab: country different font-size identified immune mortality obesity pregnant prevention .–.) Data EU/EEA ICU, Institute National Respir World adjusting al.; compared complications did double; findings intensive laboratory-confirmed medical outcomes proportion review specific A(HN) Dis; Europe Fatal Office Organization Regional Vaccination [–]. border-color border-width early heart, hospitalized identify majority older provided seasons. solid; type type, used work {font-style {font-weight (Figure (Table .–.), CI) ECDC Europe, Forum Infectious Ratio Supplementary Therefore, Underlying Value Viruses; addition, admission antiviral assessment association bold cancer, case-based cases, cases. country, courier; criteria date duration em; groups higher hospital hospitalization however, impact increasing infection, infection/other infections influenza, kidney, likely limited liver male median models multivariable patients. pooled pt;} robust sex, status study, subset support support. systematic systems using vaccine variables variance


Library exercises_propositional
Require Import Classical_Prop.
Example ex_1_3_2: forall p:Prop, ~(~p) <-> p.
Proof.
split.
unfold not. intros H.
elim (classic p).
intros PTrue; exact PTrue.
intro PFalse.
pose (H PFalse) as CONTRA.
contradiction CONTRA.
intros H. unfold not.
intros G.
apply G.
exact H.
Qed.
Example ex_1_3_2: forall p:Prop, ~(~p) <-> p.
Proof.
split.
unfold not. intros H.
elim (classic p).
intros PTrue; exact PTrue.
intro PFalse.
pose (H PFalse) as CONTRA.
contradiction CONTRA.
intros H. unfold not.
intros G.
apply G.
exact H.
Qed.
Note 1:
This proof is not intuitionistic.
It uses this axiom from Classical_Prop.v:
Axiom classic : forall (P : Prop), P \/ ~ P.
The 1st part of this proof repeats the proof of NNPP.
(See Classical_Prop.v.)
The 2nd part of this proof unfolds "not" statements and proceeds as in This example.
Note 2: Some parts of the proof are very condensed. For example:
elim (classic p).
can be rewritten as pose (classic p).
elim o.
clear o.
The 2nd part of this proof unfolds "not" statements and proceeds as in This example.
Note 2: Some parts of the proof are very condensed. For example:
elim (classic p).
can be rewritten as pose (classic p).
elim o.
clear o.
EXERCISE 1.3.4.A SOLUTION
Example ex_1_3_4_a: forall p q r:Prop, (p \/ q) \/ r <-> p \/ (q \/ r).
Proof.
split.
intros pqrLeftOR. destruct pqrLeftOR as [[pTrue | qTrue] | rTrue].
left; exact pTrue.
right; left; exact qTrue.
right; right; exact rTrue.
intros pqrRightOR. destruct pqrRightOR as [pTrue | [qTrue | rTrue]].
left; left; exact pTrue.
left; right; exact qTrue.
right; exact rTrue.
Qed.
Proof.
split.
intros pqrLeftOR. destruct pqrLeftOR as [[pTrue | qTrue] | rTrue].
left; exact pTrue.
right; left; exact qTrue.
right; right; exact rTrue.
intros pqrRightOR. destruct pqrRightOR as [pTrue | [qTrue | rTrue]].
left; left; exact pTrue.
left; right; exact qTrue.
right; exact rTrue.
Qed.
Note 1:
The tactic "destruct" is a shorthand for other tactics. For example,
destruct pqrLeftOR as [[pTrue | qTrue] | rTrue].
can be rewritten as follows: elim pqrLeftOR.
intros pqOR.
elim pqOR.
intros pTrue.
...
intros qTrue.
...
intros rTrue.
...
destruct pqrLeftOR as [[pTrue | qTrue] | rTrue].
can be rewritten as follows: elim pqrLeftOR.
intros pqOR.
elim pqOR.
intros pTrue.
...
intros qTrue.
...
intros rTrue.
...
EXERCISE 1.3.4.B SOLUTION
Example ex_1_3_4_b: forall p q r:Prop, (p /\ q) /\ r <-> p /\ (q /\ r).
Proof.
split.
intros [[H1 H2] H3]. split.
exact H1.
split.
exact H2.
exact H3.
intros [H1 [H2 H3]]. split.
split.
exact H1.
exact H2.
exact H3.
Qed.
Proof.
split.
intros [[H1 H2] H3]. split.
exact H1.
split.
exact H2.
exact H3.
intros [H1 [H2 H3]]. split.
split.
exact H1.
exact H2.
exact H3.
Qed.
Note 1:
Shorthands used here as well:
intros [[H1 H2] H3].
can be rewritten as follows:
intros pqrLeftAND.
destruct pqrLeftAND as [[H1 H2] H3].
And "destruct" in turn can be written as a sequence of elim, intros, clear.
intros [[H1 H2] H3].
can be rewritten as follows:
intros pqrLeftAND.
destruct pqrLeftAND as [[H1 H2] H3].
And "destruct" in turn can be written as a sequence of elim, intros, clear.


public class BrowserKt
| Modifier and Type | Method and Description |
|---|---|
static void |
withAlert(Browser $receiver,
kotlin.jvm.functions.Function1<? super org.openqa.selenium.Alert,kotlin.Unit> alertContext)
Switches to the currently active modal dialog for this particular driver instance.
|
static void |
withFrame(Browser $receiver,
int index,
kotlin.jvm.functions.Function0<kotlin.Unit> iFrameContext)
Select a frame by its (zero-based) index and switch the driver's context to
it.
|
static void |
withFrame(Browser $receiver,
java.lang.String nameOrId,
kotlin.jvm.functions.Function0<kotlin.Unit> iFrameContext)
Select a frame by its name or ID. Frames located by matching name attributes
are always given precedence over those matched by ID.
|
static void |
withFrame(Browser $receiver,
org.openqa.selenium.WebElement webElement,
kotlin.jvm.functions.Function0<kotlin.Unit> iFrameContext)
Select a frame using its previously located WebElement.
|
static void |
withWindow(Browser $receiver,
java.lang.String nameOrHandle,
kotlin.jvm.functions.Function1<? super org.openqa.selenium.WebDriver,kotlin.Unit> windowContext)
Switch the focus of future commands for this driver to the window with the
given name/handle.
|
public static void withAlert(@NotNull Browser $receiver, @NotNull kotlin.jvm.functions.Function1<? super org.openqa.selenium.Alert,kotlin.Unit> alertContext)
Switches to the currently active modal dialog for this particular driver instance.
You can interact with the dialog handler only inside alertContext
.
Browser.drive(driverFactory) {
// Given I navigate to the page under test, which popup alerts
to(pageWithAlerts)
// And I'm in the context of the page
assertEquals(`$`("h1", 0).text, "Page with Alerts")
// When I click in the button which makes the alert appear
`$`("#alert", 0).click()
// And I change the driver's context to the alert
withAlert {
// Then I should be able to get the alert's text
assertEquals(text, "Balin is awesome!")
// And I accept the alert
accept()
}
// Then I should return into the context of the page at the end of the `withAlert` method
assertEquals(`$`("h1", 0).text, "Page with Alerts")
}
alertContext
- here you can interact with the dialog handler.org.openqa.selenium.NoAlertPresentException
- If the dialog cannot be found.alertContext
public static void withFrame(@NotNull Browser $receiver, int index, @NotNull kotlin.jvm.functions.Function0<kotlin.Unit> iFrameContext)
Select a frame by its (zero-based) index and switch the driver's context to it.
Once the frame has been selected, all subsequent calls on the WebDriver
interface are made to that frame till the end of iFrameContext
.
If a exception is thrown inside iFrameContext
, the driver will return to
its default context.
Browser.drive(driverFactory) {
// Given I navigate to the page under test, which contains three IFrames
to(pageWithIFramesUrl)
// And I'm in the context of the page
assertEquals(`$`("h1", 0).text, "Page with IFrames")
// When I change the driver's context to the second IFrame
withFrame(1) {
// Then I should be able to interact with such IFrame
assertEquals(
`$`(".tag-home__item", 0).text.trim(),
"The search engine that doesn't track you. Learn More.")
}
// And I should return into the context of the page at the end of the `withFrame` method
assertEquals(`$`("h1", 0).text, "Page with IFrames")
}
index
- (zero-based) index.iFrameContext
- here you can interact with the given IFrame.org.openqa.selenium.NoSuchFrameException
- If the frame cannot be found.iFrameContext
,
iFrameContext
public static void withFrame(@NotNull Browser $receiver, @NotNull java.lang.String nameOrId, @NotNull kotlin.jvm.functions.Function0<kotlin.Unit> iFrameContext)
Select a frame by its name or ID. Frames located by matching name attributes are always given precedence over those matched by ID.
Once the frame has been selected, all subsequent calls on the WebDriver
interface are made to that frame till the end of iFrameContext
.
If a exception is thrown inside iFrameContext
, the driver will return to
its default context.
Browser.drive(driverFactory) {
// Given I navigate to the page under test, which contains three IFrames
to(pageWithIFramesUrl)
// And I'm in the context of the page
assertEquals(`$`("h1", 0).text, "Page with IFrames")
// When I change the driver's context to the searx.me IFrame
withFrame("searx-iframe") {
// Then I should be able to interact with such IFrame
assertEquals(`$`("#main-logo", 0).text.trim(), "searx")
}
// And I should return into the context of the page at the end of the `withFrame` method
assertEquals(`$`("h1", 0).text, "Page with IFrames")
}
nameOrId
- the name of the frame window, the id of the <frame> or <iframe> element, or the (zero-based) index.iFrameContext
- here you can interact with the given IFrame.org.openqa.selenium.NoSuchFrameException
- If the frame cannot be found.iFrameContext
,
iFrameContext
public static void withFrame(@NotNull Browser $receiver, @NotNull org.openqa.selenium.WebElement webElement, @NotNull kotlin.jvm.functions.Function0<kotlin.Unit> iFrameContext)
Select a frame using its previously located WebElement.
Once the frame has been selected, all subsequent calls on the WebDriver
interface are made to that frame till the end of iFrameContext
.
If a exception is thrown inside iFrameContext
, the driver will return to
its default context.
Browser.drive(driverFactory) {
// Given I navigate to the page under test, which contains three IFrames
to(pageWithIFramesUrl)
// And I'm in the context of the page
assertEquals(`$`("h1", 0).text, "Page with IFrames")
// When I change the driver's context to the first IFrame
withFrame(`$`("iframe", 0)) {
// Then I should be able to interact with such IFrame
assertEquals(`$`(".overview-header", 0).text, "Try Kotlin")
}
// And I should return into the context of the page at the end of the `withFrame` method
assertEquals(`$`("h1", 0).text, "Page with IFrames")
}
webElement
- the frame element to switch to.iFrameContext
- here you can interact with the given IFrame.org.openqa.selenium.NoSuchFrameException
- If the frame cannot be found.iFrameContext
,
iFrameContext
public static void withWindow(@NotNull Browser $receiver, @Nullable java.lang.String nameOrHandle, @NotNull kotlin.jvm.functions.Function1<? super org.openqa.selenium.WebDriver,kotlin.Unit> windowContext)
Switch the focus of future commands for this driver to the window with the given name/handle.
The name/handle can be omitted and the switching will be performed automatically if and only if there is only two windows currently opened.
Once the window has been selected, all subsequent calls on the WebDriver
interface are made to that window till the end of windowContext
.
If a exception is thrown inside windowContext
, the driver will return to
the previous window.
Browser.drive(driverFactory) {
// Given I navigate to the page under test, which contains links that open windows
to(pageWithWindowsUrl)
// And I'm in the context of the original window
assertEquals(`$`("h1", 0).text, "Page with links that open windows")
// And I open a new window by clicking on a link
`$`("#ddg-page", 0).click()
// When I change the driver's context to the just opened window
withWindow(windowHandles.toSet().minus(windowHandle).first()) {
// Then I should be able to interact with such window
assertEquals(
`$`(".tag-home__item", 0).text.trim(),
"The search engine that doesn't track you. Learn More.")
}
// And I should return into the context of the original window
assertEquals(`$`("h1", 0).text, "Page with links that open windows")
// And only one window should be opened
assertEquals(windowHandles.size, 1)
}
nameOrHandle
- The name of the window or the handle as returned by WebDriver.getWindowHandlewindowContext
- Here you can interact with the given window.NoSuchWindowException
- If the window cannot be found or, in the case of no name or handle is indicated,
there is not exactly two windows currently opened.windowContext
,
windowContext


Photo's by Kennedy!
Professional Photos Quick and Easy
Have you ever wanted or needed high quality photo's but didn't know where to get them?
Don't worry...
Photo's by Kennedy is an photagraphy service where you can get amazing photo's easily and quickly
Headshots
Family Photos
Graduation Pictures
Pet Photos
Holiday Card Pictures
Athlete Photos
etc.
How to Pose in Photos


Harold Thimbleby
"Human factors and design, together with user-centered processes, are often taken to be all there is to interaction design, but the hidden partner is the details of how things work when they are used. As they say, the devil is in the details, and this is a matter of programming."
"Interactive programs are too complex for unaided human comprehension; instead, good user-interface-design requirements must be engineered into programs by rigorous, formal processes." [ I disagree ]
"If a device “operates as designed,” it is often assumed to be designed correctly, even if (to more perceptive eyes) the incident is a symptom of bad design, a “system-induced user error.”
"Why aren’t devices made consistent with best clinical practice, so that operator training becomes simpler, rather than the other way around? Why does the report say in its recommendation 10A that nurses should be trained that “mL” on an infusion pump means “mL per hour”[2]? Why does recommendation 10B ask purchasers (hospitals) to do human factors studies of pumps? The same answer to both questions is that for the time being manufacturers—and national regulatory processes—can’t be relied on, and hospitals therefore have to train nurses to cope with bad design."
"We could save many lives if we made people aware that poor interaction
programming is a significant factor in medication incidents."