vignettes/supervised_learning.Rmd
supervised_learning.Rmd
library(fastrtext)
data("train_sentences")
data("test_sentences")
# prepare data
tmp_file_model <- tempfile()
train_labels <- paste0("__label__", train_sentences[,"class.text"])
train_texts <- tolower(train_sentences[,"text"])
train_to_write <- paste(train_labels, train_texts)
train_tmp_file_txt <- tempfile()
writeLines(text = train_to_write, con = train_tmp_file_txt)
test_labels <- paste0("__label__", test_sentences[,"class.text"])
test_labels_without_prefix <- test_sentences[,"class.text"]
test_texts <- tolower(test_sentences[,"text"])
test_to_write <- paste(test_labels, test_texts)
# learn model
execute(commands = c("supervised", "-input", train_tmp_file_txt, "-output", tmp_file_model, "-dim", 20, "-lr", 1, "-epoch", 20, "-wordNgrams", 2, "-verbose", 1))
##
Read 0M words
## Number of words: 5060
## Number of labels: 15
##
Progress: 100.0% words/sec/thread: 1108251 lr: 0.000000 loss: 0.306367 ETA: 0h 0m
## add .bin extension to the path
# prediction are returned as a list with words and probabilities
predictions <- predict(model, sentences = test_to_write)
print(head(predictions, 5))
## [[1]]
## OWNX
## 0.9996475
##
## [[2]]
## MISC
## 0.9847125
##
## [[3]]
## MISC
## 0.9911765
##
## [[4]]
## OWNX
## 0.9216562
##
## [[5]]
## AIMX
## 0.9848558
## [1] 0.8316667
# because there is only one category by observation, hamming loss will be the same
get_hamming_loss(as.list(test_labels_without_prefix), predictions)
## [1] 0.8316667
# test predictions
predictions <- predict(model, sentences = test_to_write)
print(head(predictions, 5))
## [[1]]
## OWNX
## 0.9996475
##
## [[2]]
## MISC
## 0.9847125
##
## [[3]]
## MISC
## 0.9911765
##
## [[4]]
## OWNX
## 0.9216562
##
## [[5]]
## AIMX
## 0.9848558
# you can get flat list of results when you are retrieving only one label per observation
print(head(predict(model, sentences = test_to_write, simplify = TRUE)))
## OWNX MISC MISC OWNX AIMX CONT
## 0.9996475 0.9847125 0.9911765 0.9216562 0.9848558 0.4192168
## used (Mb) gc trigger (Mb) max used (Mb)
## Ncells 641703 34.3 1212111 64.8 1212111 64.8
## Vcells 1311645 10.1 8388608 64.0 2061190 15.8


About Me
I' m sonu gurjar and Web Developer
Hi! my name is sonu gurjar. i am a wab Developer, and I' m very passionate and dedicate.
Birthday : 18 set. 1997
Age : 28
Wabsite :
Email : sanjaygurjar.......
phone :<PHONE_NUMBER>
City : Rajesthan
Javascript
76%
Wordpress
90%
Java
80%
Bootstrap
60%
hello
hello


In TorchVision v0.9, we released a series of new mobile-friendly models that can be used for Classification, Object Detection and Semantic Segmentation. In this article, we will dig deep into the code of the models, share notable implementation details, explain how we configured and trained them, and highlight important tradeoffs we made during their tuning. Our goal is to disclose technical details that typically remain undocumented in the original papers and repos of the models.
Network Architecture
The implementation of the MobileNetV3 architecture follows closely the original paper. It is customizable and offers different configurations for building Classification, Object Detection and Semantic Segmentation backbones. It was designed to follow a similar structure to MobileNetV2 and the two share common building blocks.
Off-the-shelf, we offer the two variants described on the paper: the Large and the Small. Both are constructed using the same code with the only difference being their configuration which describes the number of blocks, their sizes, their activation functions etc.
Configuration parameters
Even though one can write a custom InvertedResidual setting and pass it to the MobileNetV3 class directly, for the majority of applications we can adapt the existing configs by passing parameters to the model building methods. Some of the key configuration parameters are the following:
-
The
width_mult
parameter is a multiplier that affects the number of channels of the model. The default value is 1 and by increasing or decreasing it one can change the number of filters of all convolutions, including the ones of the first and last layers. The implementation ensures that the number of filters is always a multiple of 8. This is a hardware optimization trick which allows for faster vectorization of operations. -
The
reduced_tail
parameter halves the number of channels on the last blocks of the network. This version is used by some Object Detection and Semantic Segmentation models. It’s a speed optimization which is described on the MobileNetV3 paper and reportedly leads to a 15% latency reduction without a significant negative effect on accuracy. -
The
dilated
parameter affects the last 3 InvertedResidual blocks of the model and turns their normal depthwise Convolutions to Atrous Convolutions. This is used to control the output stride of these blocks and has a significant positive effect on the accuracy of Semantic Segmentation models.
Implementation details
Below we provide additional information on some notable implementation details of the architecture. The MobileNetV3 class is responsible for building a network out of the provided configuration. Here are some implementation details of the class:
-
The last convolution block expands the output of the last InvertedResidual block by a factor of 6. The implementation is aligned with the Large and Small configurations described on the paper and can adapt to different values of the multiplier parameter.
-
Similarly to other models such as MobileNetV2, a dropout layer is placed just before the final Linear layer of the classifier.
The InvertedResidual class is the main building block of the network. Here are some notable implementation details of the block along with its visualization which comes from Figure 4 of the paper:
-
There is no expansion step if the input channels and the expanded channels are the same. This happens on the first convolution block of the network.
-
There is always a projection step even when the expanded channels are the same as the output channels.
-
The activation method of the depthwise block is placed before the Squeeze-and-Excite layer as this improves marginally the accuracy.
Classification
In this section we provide benchmarks of the pre-trained models and details on how they were configured, trained and quantized.
Benchmarks
Here is how to initialize the pre-trained models:
large = torchvision.models.mobilenet_v3_large(pretrained=True, width_mult=1.0, reduced_tail=False, dilated=False)
small = torchvision.models.mobilenet_v3_small(pretrained=True)
quantized = torchvision.models.quantization.mobilenet_v3_large(pretrained=True)
Below we have the detailed benchmarks between new and selected previous models. As we can see MobileNetV3-Large is a viable replacement of ResNet50 for users who are willing to sacrifice a bit of accuracy for a roughly 6x speed-up:
| Model | Acc@1 | Acc@5 | Inference on CPU (sec) | # Params (M) |
|---|---|---|---|---|
| MobileNetV3-Large | 74.042 | 91.340 | 0.0411 | 5.48 |
| MobileNetV3-Small | 67.668 | 87.402 | 0.0165 | 2.54 |
| Quantized MobileNetV3-Large | 73.004 | 90.858 | 0.0162 | 2.96 |
| MobileNetV2 | 71.880 | 90.290 | 0.0608 | 3.50 |
| ResNet50 | 76.150 | 92.870 | 0.2545 | 25.56 |
| ResNet18 | 69.760 | 89.080 | 0.1032 | 11.69 |
Note that the inference times are measured on CPU. They are not absolute benchmarks, but they allow for relative comparisons between models.
Training process
All pre-trained models are configured with a width multiplier of 1, have full tails, are non-dilated, and were fitted on ImageNet. Both the Large and Small variants were trained using the same hyper-parameters and scripts which can be found in our references folder. Below we provide details on the most notable aspects of the training process.
Achieving fast and stable training
Configuring RMSProp correctly was crucial to achieve fast training with numerical stability. The authors of the paper used TensorFlow in their experiments and in their runs they reported using quite high rmsprop_epsilon
comparing to the default. Typically this hyper-parameter takes small values as it’s used to avoid zero denominators, but in this specific model choosing the right value seems important to avoid numerical instabilities in the loss.
Another important detail is that though PyTorch’s and TensorFlow’s RMSProp implementations typically behave similarly, there are a few differences with the most notable in our setup being how the epsilon hyperparameter is handled. More specifically, PyTorch adds the epsilon outside of the square root calculation while TensorFlow adds it inside. The result of this implementation detail is that one needs to adjust the epsilon value while porting the hyper parameter of the paper. A reasonable approximation can be taken with the formula PyTorch_eps = sqrt(TF_eps)
.
Increasing our accuracy by tuning hyperparameters & improving our training recipe
After configuring the optimizer to achieve fast and stable training, we turned into optimizing the accuracy of the model. There are a few techniques that helped us achieve this. First of all, to avoid overfitting we augmented out data using the AutoAugment algorithm, followed by RandomErasing. Additionally we tuned parameters such as the weight decay using cross validation. We also found beneficial to perform weight averaging across different epoch checkpoints after the end of the training. Finally, though not used in our published training recipe, we found that using Label Smoothing, Stochastic Depth and LR noise injection improve the overall accuracy by over 1.5 points.
The graph and table depict a simplified summary of the most important iterations for improving the accuracy of the MobileNetV3 Large variant. Note that the actual number of iterations done while training the model was significantly larger and that the progress in accuracy was not always monotonically increasing. Also note that the Y-axis of the graph starts from 70% instead from 0% to make the difference between iterations more visible:
| Iteration | Acc@1 | Acc@5 |
|---|---|---|
| Baseline with “MobileNetV2-style” Hyperparams | 71.542 | 90.068 |
| + RMSProp with default eps | 70.684 | 89.38 |
| + RMSProp with adjusted eps & LR scheme | 71.764 | 90.178 |
| + Data Augmentation & Tuned Hyperparams | 73.86 | 91.292 |
| + Checkpoint Averaging | 74.028 | 91.382 |
| + Label Smoothing & Stochastic Depth & LR noise | 75.536 | 92.368 |
Note that once we’ve achieved an acceptable accuracy, we verified the model performance on the hold-out test dataset which hasn’t been used before for training or hyper-parameter tuning. This process helps us detect overfitting and is always performed for all pre-trained models prior their release.
Quantization
We currently offer quantized weights for the QNNPACK backend of the MobileNetV3-Large variant which provides a speed-up of 2.5x. To quantize the model, Quantized Aware Training (QAT) was used. The hyper parameters and the scripts used to train the model can be found in our references folder.
Note that QAT allows us to model the effects of quantization and adjust the weights so that we can improve the model accuracy. This translates to an accuracy increase of 1.8 points comparing to simple post-training quantization:
| Quantization Status | Acc@1 | Acc@5 |
|---|---|---|
| Non-quantized | 74.042 | 91.340 |
| Quantized Aware Training | 73.004 | 90.858 |
| Post-training Quantization | 71.160 | 89.834 |
Object Detection
In this section, we will first provide benchmarks of the released models, and then discuss how the MobileNetV3-Large backbone was used in a Feature Pyramid Network along with the FasterRCNN detector to perform Object Detection. We will also explain how the network was trained and tuned alongside with any tradeoffs we had to make. We will not cover details about how it was used with SSDlite as this will be discussed on a future article.
Benchmarks
Here is how the models are initialized:
high_res = torchvision.models.detection.fasterrcnn_mobilenet_v3_large_fpn(pretrained=True)
low_res = torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn(pretrained=True)
Below are some benchmarks between new and selected previous models. As we can see the high resolution Faster R-CNN with MobileNetV3-Large FPN backbone seems a viable replacement of the equivalent ResNet50 model for those users who are willing to sacrifice few accuracy points for a 5x speed-up:
| Model | mAP | Inference on CPU (sec) | # Params (M) |
|---|---|---|---|
| Faster R-CNN MobileNetV3-Large FPN (High-Res) | 32.8 | 0.8409 | 19.39 |
| Faster R-CNN MobileNetV3-Large 320 FPN (Low-Res) | 22.8 | 0.1679 | 19.39 |
| Faster R-CNN ResNet-50 FPN | 37.0 | 4.1514 | 41.76 |
| RetinaNet ResNet-50 FPN | 36.4 | 4.8825 | 34.01 |
Implementation details
The Detector uses a FPN-style backbone which extracts features from different convolutions of the MobileNetV3 model. By default the pre-trained model uses the output of the 13th InvertedResidual block and the output of the Convolution prior to the pooling layer but the implementation supports using the outputs of more stages.
All feature maps extracted from the network have their output projected down to 256 channels by the FPN block as this greatly improves the speed of the network. These feature maps provided by the FPN backbone are used by the FasterRCNN detector to provide box and class predictions at different scales.
Training & Tuning process
We currently offer two pre-trained models capable of doing object detection at different resolutions. Both models were trained on the COCO dataset using the same hyper-parameters and scripts which can be found in our references folder.
The High Resolution detector was trained with images of 800-1333px, while the mobile-friendly Low Resolution detector was trained with images of 320-640px. The reason why we provide two separate sets of pre-trained weights is because training a detector directly on the smaller images leads to a 5 mAP increase in precision comparing to passing small images to the pre-trained high-res model. Both backbones were initialized with weights fitted on ImageNet and the 3 last stages of their weights where fined-tuned during the training process.
An additional speed optimization can be applied on the mobile-friendly model by tuning the RPN NMS thresholds. By sacrificing only 0.2 mAP of precision we were able to improve the CPU speed of the model by roughly 45%. The details of the optimization can be seen below:
| Tuning Status | mAP | Inference on CPU (sec) |
|---|---|---|
| Before | 23.0 | 0.2904 |
| After | 22.8 | 0.1679 |
Below we provide some examples of visualizing the predictions of the Faster R-CNN MobileNetV3-Large FPN model:
Semantic Segmentation
In this section we will start by providing some benchmarks of the released pre-trained models. Then we will discuss how a MobileNetV3-Large backbone was combined with segmentation heads such as LR-ASPP, DeepLabV3 and the FCN to conduct Semantic Segmentation. We will also explain how the network was trained and propose a few optional optimization techniques for speed critical applications.
Benchmarks
This is how to initialize the pre-trained models:
lraspp = torchvision.models.segmentation.lraspp_mobilenet_v3_large(pretrained=True)
deeplabv3 = torchvision.models.segmentation.deeplabv3_mobilenet_v3_large(pretrained=True)
Below are the detailed benchmarks between new and selected existing models. As we can see, the DeepLabV3 with a MobileNetV3-Large backbone is a viable replacement of FCN with ResNet50 for the majority of applications as it achieves similar accuracy with a 8.5x speed-up. We also observe that the LR-ASPP network supersedes the equivalent FCN in all metrics:
| Model | mIoU | Global Pixel Acc | Inference on CPU (sec) | # Params (M) |
|---|---|---|---|---|
| LR-ASPP MobileNetV3-Large | 57.9 | 91.2 | 0.3278 | 3.22 |
| DeepLabV3 MobileNetV3-Large | 60.3 | 91.2 | 0.5869 | 11.03 |
| FCN MobileNetV3-Large (not released) | 57.8 | 90.9 | 0.3702 | 5.05 |
| DeepLabV3 ResNet50 | 66.4 | 92.4 | 6.3531 | 39.64 |
| FCN ResNet50 | 60.5 | 91.4 | 5.0146 | 32.96 |
Implementation details
In this section we will discuss important implementation details of tested segmentation heads. Note that all models described in this section use a dilated MobileNetV3-Large backbone.
LR-ASPP
The LR-ASPP is the Lite variant of the Reduced Atrous Spatial Pyramid Pooling model proposed by the authors of the MobileNetV3 paper. Unlike the other segmentation models in TorchVision, it does not make use of an auxiliary loss. Instead it uses low and high-level features with output strides of 8 and 16 respectively.
Unlike the paper where a 49x49 AveragePooling layer with variable strides is used, our implementation uses an AdaptiveAvgPool2d
layer to process the global features. This is because the authors of the paper tailored the head to the Cityscapes dataset while our focus is to provide a general purpose implementation that can work on multiple datasets. Finally our implementation always has a bilinear interpolation before returning the output to ensure that the sizes of the input and output images match exactly.
DeepLabV3 & FCN
The combination of MobileNetV3 with DeepLabV3 and FCN follows closely the ones of other models and the stage estimation for these methods is identical to LR-ASPP. The only notable difference is that instead of using high and low level features, we attach the normal loss to the feature map with output stride 16 and an auxiliary loss on the feature map with output stride 8.
Finally we should note that the FCN version of the model was not released because it was completely superseded by the LR-ASPP both in terms of speed and accuracy. The pre-trained weights are still available and can be used with minimal changes to the code.
Training & Tuning process
We currently offer two MobileNetV3 pre-trained models capable of doing semantic segmentation: the LR-ASPP and the DeepLabV3. The backbones of the models were initialized with ImageNet weights and trained end-to-end. Both architectures were trained on the COCO dataset using the same scripts with similar hyper-parameters. Their details can be found in our references folder.
Normally, during inference the images are resized to 520 pixels. An optional speed optimization is to construct a Low Res configuration of the model by using the High-Res pre-trained weights and reducing the inference resizing to 320 pixels. This will improve the CPU execution times by roughly 60% while sacrificing a couple of mIoU points. The detailed numbers of this optimization can be found on the table below:
| Low-Res Configuration | mIoU Difference | Speed Improvement | mIoU | Global Pixel Acc | Inference on CPU (sec) |
|---|---|---|---|---|---|
| LR-ASPP MobileNetV3-Large | -2.1 | 65.26% | 55.8 | 90.3 | 0.1139 |
| DeepLabV3 MobileNetV3-Large | -3.8 | 63.86% | 56.5 | 90.3 | 0.2121 |
| FCN MobileNetV3-Large (not released) | -3.0 | 57.57% | 54.8 | 90.1 | 0.1571 |
Here are some examples of visualizing the predictions of the LR-ASPP MobileNetV3-Large model:
We hope that you found this article interesting. We are looking forward to your feedback to see if this is the type of content you would like us to publish more often. If the community finds that such posts are useful, we will be happy to publish more articles that cover the implementation details of newly introduced Machine Learning models.


 Starring John Cusack, Cameron Diaz, Catherine Keener, John Malkovich, Orson Bean, Mary Kay Place, Charlie Sheen, W. Earl Brown. Written by Charlie Kaufman. Directed by Spike Jonze. Rated R.
It's unusual, but every once in a while there comes a movie that is utterly unpredictable, one that starts with an idea and takes the viewer off in every possible direction. "Being John Malkovich" is one such film. So often we see movies that start off with a good idea and go absolutely nowhere, getting lost in a predictable plot and contrived sitcom-friendly situations. Not this one. This film explores every possible angle that could be derived from its admittedly bizarre premise. The film is a funny, entertaining, thought-provoking original. It's truly amazing this film actually got made with studio backing, considering it's practically unmarketable. Nevertheless, "Being John Malkovich" is here, and we're all better off for it. It's the most creative film of the year.
John Cusack stars as Craig Schwartz, an out-of-work puppeteer who longs for the chance to become famous through his craft. Pushed by his wife Lotte (Cameron Diaz) into getting a steady job, he becomes a filing clerk for the company on the 7½ floor (don't ask). While working in his office, Craig discovers a portal in the wall that leads into the head of John Malkovich, allowing him to see through the actor's eyes for fifteen minutes. Craig lets Maxine (Catherine Keener), a co-worker he is attracted to, in on the secret. The opportunistic Maxine convinces Craig to turn the portal into a tourist attraction, and it becomes a huge hit. Complications ensue when Lotte visits Malkovich's brain while Maxine is seducing him, and the two women find they are attracted to each other . . . but only through Malkovich. The situation grows ever more bizarre when Malkovich himself realizes what has been going on, and Craig learns how to control his new "puppet."
This film takes a lot of chances, the biggest of which may be in taking its most marketable stars and robbing them of their glamour. Cusack and Diaz play so far against type that I was barely able to recognize them (it took me 20 minutes to realize Diaz was even in the movie). Both actors acquit themselves nicely. Cusack's bemused nature is perfect for the part of Craig, and Diaz delivers an unexpectedly touching performance as his homely wife. Catherine Keener, so wasted in "8mm," plays the femme fatale to delicious perfection-every one of her lines drips with contempt for the smitten Craig. As for the title character himself, Malkovich must first be given credit for his willingness to go along with such a self-deprecating premise, and then given accolades for a truly brilliant performance. The actor begins by playing what is supposed to be himself, but seems more like a composite of how the general public pictures him. He must then pull off something even more difficult, which is to take on the personality of whoever is inside his head. When Craig learns to control his body, Malkovich makes a notable shift into playing John Cusack. He does it so well that I eventually forgot he was acting; it really seemed like John Cusack inside John Malkovich. It's most likely the best work he has ever done.
The screenplay, by Charlie Kaufman, is quite simply one of the most inventive and clever screenplays to be released in a long while. "Being John Malkovich" has a seemingly endless supply of clever ideas and jokes. It has hilarious sight gags, like the "half-floor" Craig works on that causes everyone to stoop down constantly, a fact most of Craig's coworkers seem blissfully unaware of. There are classic supporting characters, like the lecherous old Dr. Lester (Orson Bean), who believes he has a speech impediment because his secretary (Mary Kay Place) mishears everything said to her. Numerous self-parodying cameos by Hollywood stars (Charlie Sheen, Brad Pitt, Sean Penn) crop up, each more surprising than the last. The laughs come consistently in "Being John Malkovich," and best of all, they are of the subtle and intelligent variety. The film unapologetically resides in the absurd for its entire running time. If you're willing to buy into its skewed sense of reality, you'll have a great ride.
What's truly most admirable about this film is that it doesn't shy away from any exploration of its central idea. There are countless issues raised by and possible ramifications resulting from entering another man's head, and "Being John Malkovich" eschews conventional (read: formula) movie plots to explore all of them. A less ambitious film might have gone for sappy sentimentalism or cheap jokes with a predictable story, but this one actually surprised me fairly consistently. I was never certain where the story was going, and I loved discovering it. Nearly any pressing question about the premise one might ask is explored. For example, what happens if someone learns to control Malkovich? What if Malkovich went inside his own head? What if more than one person takes control? What if there are others who have people inside their heads? Most films might only explore one or fewer of these possibilities. "Being John Malkovich" explores all of them.
There are plenty of mind-bending issues raised by the film that it is sure to become the topic of many a late-night dorm room conversation. It raises questions about the nature of celebrity, and why we are fascinated by them. (Perhaps the film's best joke is that no one can name one of Malkovich's films, even though everyone recognizes him.) It raises issues of self-identity and role-playing. (Is it a coincidence we are sent into the brain of an actor?) It raises issues of homosexuality and sexuality in general. In fact, there are so many pressing ideas brought up by this film, it would be pointless to try to list them all. I'll just leave it at this: After seeing "Being John Malkovich," it's hard to figure just who is pulling anyone's strings, including your own. A film that can accomplish that is definitely doing something right.
A film as creative as "Being John Malkovich" doesn't get made very often. It 's funny, inventive, and unpredictable. It may have some difficulty reaching mainstream audiences because it's so far "out there." After all, this film takes place in a distorted reality, one in which people don't find the concept of going into someone else's head remotely unusual. All they see it as is a business venture, or a new toy. Some may find this hard-to-swallow, but the removal of what might have been used as an easy comic device helps make the issues that much clearer. Whatever one may think of it, "Being John Malkovich" is probably the most original film to be released through Hollywood in the past few years, and it's definitely a must-see.
-reviewed by Shay Casey
For more reviews, go to http://www.geocities.com/Hollywood/Land/4252/movies.html
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Name:
Password:
Gender:
Male:
Female:
Hobbies:
Travel
Social work
Address
Default address
Qualifiaction:
BTech
MTech
File:
Reset


{{define "base"}}
| SLN | Unique identifier for a section. |
| Section | Identifier for a section within a class. Quiz sections are prefixed with their main section identifier. |
| Credit | Credits received from taking the section. Else, an abbreviation indicating a different type of section. |
Indicates whether enrollment for a section is closed or not.
When/where a section is held. Some sections may have multiple meeting times, or none at all if they have not been arranged.
Each section may or may not have these attributes.
| Restr | Indicates there are Class, Major, or College requirements that restrict registration into this section. |
| > | Add Code required. |
| IS | Independent Study: Faculty Code required. |
| No fee / $*** | Some courses require additional fees beyond tuition. Course fees are still owed for courses dropped after the fourteenth calendar day of the quarter. Contact the offering department for possible course fee refund after the fourteenth calendar day. |
| CR/NC | Credit/No-Credit grading. |
| D | Distance learning (51% or more of the course instruction for this course is through some mode of distance learning). |
| H | Honors section. |
| J | Jointly offered course (Select the SLN to see Joint Curriculum). |
| R | Research. |
| S | Service learning. |
| W | Writing section. |
| % | New course. |
| # | This course is not eligible for some or all types of Financial Aid. Select course SLN for more details. |


|
|
| FfmpegVideoOutput (const std::string &filename, int base_frame_rate, int bit_rate, bool flip=false) |
| |
|
const std::vector< StreamInfo > & | Streams () const override |
| | Get format and dimensions of all video streams.
|
| |
|
void | SetStreams (const std::vector< StreamInfo > &streams, const std::string &uri, const picojson::value &properties) override |
| |
|
int | WriteStreams (const unsigned char *data, const picojson::value &frame_properties) override |
| |
|
bool | IsPipe () const override |
| |
|
|
void | Initialise (std::string filename) |
| |
|
void | StartStream () |
| |
|
void | Close () |
| |
|
|
std::string | filename |
| |
|
bool | started |
| |
|
AVFormatContext * | oc |
| |
|
std::vector< FfmpegVideoOutputStream * > | streams |
| |
|
std::vector< StreamInfo > | strs |
| |
|
int | frame_count |
| |
|
int | base_frame_rate |
| |
|
int | bit_rate |
| |
|
bool | is_pipe |
| |
|
bool | flip |
| |
|
|
class | FfmpegVideoOutputStream |
| |
The documentation for this class was generated from the following file:
- /home/aoberai/programming/python/blind-navigation/display_3d/documentation/Pangolin/include/pangolin/video/drivers/ffmpeg.h


We optimize methodologies!
- deliver collaborative web-readiness
- aggregate killer systems
- incentivize killer experiences
- aggregate compelling markets
- deliver dynamic metrics
- enable extensible relationships
- revolutionize bricks-and-clicks partnerships
- iterate strategic solutions


Enter a positive number and the program will count up to that number except
Numbers divisible by 3 are replaced with "ping"
Numbers divisible by 5 are replaced with "pong"
Numbers divisible by 15 are replaced with "pingpong"


Projects
Employees
Roles
Edit Employee
First Name:
Last Name:
Middle Name:
Email:
Roles:
Back
Submit


|
QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.30
|
#include <ql/math/statistics/histogram.hpp>
Public Types | |
| enum | Algorithm { None , Sturges , FD , Scott } |
Public Member Functions | |
constructors | |
| Histogram () | |
| template<class T > | |
| Histogram (T data_begin, T data_end, Size breaks) | |
| template<class T > | |
| Histogram (T data_begin, T data_end, Algorithm algorithm) | |
| template<class T , class U > | |
| Histogram (T data_begin, T data_end, U breaks_begin, U breaks_end) | |
inspectors | |
| Size | bins () const |
| const std::vector< Real > & | breaks () const |
| Algorithm | algorithm () const |
| bool | empty () const |
results | |
| std::vector< Real > | data_ |
| Size | bins_ = 0 |
| Algorithm | algorithm_ = None |
| std::vector< Real > | breaks_ |
| std::vector< Size > | counts_ |
| std::vector< Real > | frequency_ |
| Size | counts (Size i) const |
| Real | frequency (Size i) const |
| void | calculate () |
Histogram class.
This class computes the histogram of a given data set. The caller can specify the number of bins, the breaks, or the algorithm for determining these quantities in computing the histogram.
Definition at line 38 of file histogram.hpp.
| enum Algorithm |
| Enumerator | |
|---|---|
| None | |
| Sturges | |
| FD | |
| Scott |
Definition at line 40 of file histogram.hpp.
| Histogram | ( | ) |
Definition at line 44 of file histogram.hpp.
| Histogram | ( | T | data_begin, |
| T | data_end, | ||
| U | breaks_begin, | ||
| U | breaks_end | ||
| ) |
| Size bins | ( | ) | const |
| const std::vector< Real > & breaks | ( | ) | const |
| Histogram::Algorithm algorithm | ( | ) | const |
Definition at line 75 of file histogram.cpp.
| bool empty | ( | ) | const |
Definition at line 79 of file histogram.cpp.
Definition at line 83 of file histogram.cpp.
|
private |
Definition at line 99 of file histogram.cpp.
|
private |
Definition at line 81 of file histogram.hpp.
|
private |
Definition at line 82 of file histogram.hpp.
Definition at line 83 of file histogram.hpp.
|
private |
Definition at line 84 of file histogram.hpp.
|
private |
Definition at line 85 of file histogram.hpp.
|
private |
Definition at line 86 of file histogram.hpp.


RT @QuinnyPig: How has @github been around for eleven years and yet somehow never had custom branded dining forks as swag?
5/27/2019, 1:03:56 PM
Favs: 0
Retweets: 0
link--- layout: tweet ---
RT @QuinnyPig: How has @github been around for eleven years and yet somehow never had custom branded dining forks as swag?
5/27/2019, 1:03:56 PM
Favs: 0
Retweets: 0
link


Features
-
Create zipped backups of your server files
-
Download created backups to your computer
-
Rollback a particular backup (restore points)
-
Create database backup
-
Delete backup files
-
Download created backup (automatically zipped for faster download)
-
Rollback a particular database backup (restore points)
-
Database SQL importer
-
Exclude directories, files, file extensions from your backup to make the backups smaller
-
Cronjob supported to create file backups or restore them
-
Cronjob supported to create database backups or restore them
-
Easy to install (change config and upload to server)
-
Easily creating backup from your, and your clients websites.
-
Email file and/or database backups to your email address
- Backup to remote FTP server


This is a huge header
This is a little smaller
Smaller
Smaller...
Smaller.....
Smallest
Testing 123
Two lines Ignores Spaces
My first paragraph
extra text
My second paragraph
This is going to be in bold
This is going to be italic
I want this to be underlined
This will be struck through
- First Item in unordered list
- Second Item in unordered list
- First Item in ordered list
- Second Item in ordered list


Burj Khalifa is a megatall skyscraper in Dubai, United Arab Emirates, the building is best known for being the current world's tallest skyscraper, it's the most popular tourist attraction in Dubai
Burj Khalifa, literally means Khalifa Tower. Formerly known as Burj Dubai or Dubai Tower, which was changed to Burj Khalifa when the tower officially opened on January 4th 2010. Khalifa is derived from the name of Sheikh Khalifa Bin Zayed Al Maktoum, who is the president of Adu Dhabi as well as United Arab Emirates, Burj Khalifa and other construction projects in Dubai were once on the verge of halting due to the attack of Financial Crisis, it was neighbor Adu Dhabi provided funds to Dubai in the hard time, this is the main reason for Dubai to rename the tower Burj Khalifa, additionally the word Khalifa has a important significance in Islam, it means Islamic world's supreme leader.
The architectural height of Burj Khalifa is 828 meters or 2717 feet, this is measured to the top of the spire, as its spire is considered an architectural element of the tower.
Before 2010, Burj Khalifa's height has long been kept as a secret in order to prevent it from being surpassed by potential competitors. Finally the owner Emaar claimed the standard height of Burj Khalifa to be 828 meters, with a total height of 829.8 meters to its tip (there's a 1.7 meter small needle atop the top of spire at 828 meters), making it the tallest building in the world in any categories. As of 2019, Burj Khalifa has been holding the crown of World's Tallest Building for 10 years, it will keep the crown for another 3 to 5 years, until in 2022 or later when either the Dubai Creek Tower or Jeddah Tower surpasses it.


---
layout: post
title: Tracing crowd
date: '2013-03-18T12:21:00+01:00'
categories:
- Atoleiros Battle
picture_url: https://film-Storyboards.tumblr.com/post/45681754717/tracing-crowd-in-layers-on-the-drawing-table-for
---
Tracing crowd in layers on the drawing table for an animatic


MedImage Server offers a choice of three ways to connect to your computer. You can add new phones by pressing one of the option buttons above, and if you come back later, you can add more phones with the same option.
Wifi
Connect through a wifi network attached to this server. This is very fast and free to use, but works only in range of the wifi network.
Use our AJ servers
Usage charges apply after an initial 500MB of free bandwidth (note: this is the total bandwidth allowed under the free program, not a monthly figure), but the charges are very reasonable.
Use your own web servers
See the 'Cloud server' setup for instructions. This allows you to have complete control of your security and bandwidth.


Edit Menu
View Order
Register
Feedbacks
LOG OUT
Welcome Canteen Adminstrator
Feedbacks
Roll No.
Feedback
Date


Github Search
User + Repositories:
Write the username of a Github user and see a list of all of their public repositories:
Find User
Here is what we found:


Next: unsigned-byte, Previous: integer, Up: Numbers Dictionary
signed-byte, integer, rational,
real,
The atomic type specifier signed-byte denotes the same type as is denoted by the type specifier integer; however, the list forms of these two type specifiers have different semantics.
Abbreviating.
(signed-byte
{[s | *]})
s—a positive integer.
This denotes the set of integers that can be represented in two’s-complement form in a byte of s bits. This is equivalent to (integer -2^s-1 2^s-1-1). The type signed-byte or the type (signed-byte *) is the same as the type integer.


vector abundance global population model aegypti Aedes potential Figure climate distribution data human change larval Model increase used {border-style px;} #ffffff;} socio-economic temperature areas mathematical study dengue development female modeling based density parameters occurrence albopictus emission factors Public South breeding century estimate estimated presence averaged carbon century. future models using Climate adult low px; shown sites {font-family America, Dis. However, RCP. Supplementary average carrying climatic driving dynamics environmental field font-size mosquito number past transmission vectors Africa, Health Umeå University Yang aegypti, aegypti. changes climate, double; highest increased process-based statistical urban (see Brazil European RCP., Trop abundance. addition, area border-color border-width capacity climate-driven data, described drivers economic eggs high higher included including limited mosquitoes occurred presence/absence relative research scale scale. sensitivity shows site) solid; spatial time twenty-first use validated virus {font-style {font-weight (e.g., (per (–) (–). ./journal.pntd. Africa Asia Asia, CRU Environ GDPpc Global Health. ISIMIP Kraemer Material Negl North Sweden abundance, account arbovirus areas, article blood bold central centuries containers courier; decade decades dependent difference disease effects em; empirical end factor following future, globally helped important indicates infestation influence largest lifecycle linear manuscript. models, new parameters, population, possible postdicted precipitation pt;} realized recent response scenario site southern surveillance tropical validate vector's world yellow


Battery Recall Assistant
The Battery Recall Assistant helps you to determine if your battery is eligible for a battery replacement program by Apple.
The Assistant asks you the battery serial number, the computer serial number (it is already filled in for your convenience) and your country. Then verifies if your battery is eligible for the program
WARNING: the Battery Recall Assistant is provided as a convenience only. You should not rely blindly on it, because Apple may change the rules for the recall programs at any time. It is recommended that you check the Apple Support website by clicking on the More info… button to get the latest updates.
To verify if your battery is eligible for the recall program, enter the battery serial number, the computer serial number and choose your country, then press Check.
To learn your battery serial number, power off the laptop, then disconnect the AC cable, extract the battery and flip it to read the label (see picture).


In this page you can give a quick glance at my published works. Most of them are in the context of Continual Deep Learning as you could have guessed from my research interests :)
Recent Works | Complete list of Publications | Invited Talks
Recent Works
This section may be outdated: click here for a more updated list!
Lorenzo Pellegrini, Gabriele Graffieti, Vincenzo Lomonaco, Davide Maltoni. Latent Replay for Real-Time Continual Learning. ArXiv pre-print arXiv:1912.01100, 2019.
[ arXiv pre-print ]
Vincenzo Lomonaco, Davide Maltoni, Lorenzo Pellegrini. Fine-Grained Continual Learning. ArXiv pre-print arXiv:1907.03799, 2019.
[ arXiv pre-print ]
Qi She, Fan Feng, Xinyue Hao, Qihan Yang, Chuanlin Lan, Vincenzo Lomonaco, Xuesong Shi, Zhengwei Wang, Yao Guo, Yimin Zhang, Fei Qiao, Rosa H. M. Chan. OpenLORIS-Object: A Dataset and Benchmark Towards Lifelong Object Recognition. IEEE International Conference on Robotics and Automation (ICRA), 2020.
[ article | arXiv pre-print ]
Vincenzo Lomonaco, Karan Desai, Eugenio Culurciello, Davide Maltoni Continual Reinforcement Learning in 3D Non-stationary Environments. Continual Learning Workshop at CVPR, 2020.
[ article | arXiv pre-print ]
Jary Pomponi, Simone Scardapane, Vincenzo Lomonaco, Aurelio Uncini Efficient Continual Learning in Neural Networks with Embedding Regularization. Elsevier Neurocomputing, Volume 397, 15 July 2020, Pages 139-148, 2020.
[ article | arXiv pre-print ]
Timothée Lesort, Vincenzo Lomonaco, Andrei Stoian, Davide Maltoni, David Filliat, Natalia Díaz-Rodríguez. Continual Learning for Robotics: Definition, Framework, Learning Strategies, Opportunities and Challenges. Elsevier Information Fusion Journal, 2019.
[ article | arXiv pre-print ]
Vincenzo Lomonaco. Continual Learning with Deep Architectures. PhD Thesis, 2019.
[ PhD Thesis ]
Lomonaco Vincenzo, Diaz Rodriguez Natalia , Filliat David and Maltoni Davide. Don’t forget, there is more than forgetting: new metrics for Continual Learning. Continual Learning Workshop (NeurIPS 2018).
[ article | poster | slides ]
Maltoni Davide and Lomonaco Vincenzo. Continuous Learning in Single-Incremental-Task Scenarios, vol. 116, pp. 56-73, Neural Networks, 2019.
[ arXiv pre-print | article ]
Lomonaco Vincenzo and Maltoni Davide. CORe50: a New Dataset and Benchmark for Continuous Object Recongition. 1st Annual Conference on Robot Learning, 2017.
[ article | arXiv extended version | poster | video-presentation ]
Maltoni Davide and Lomonaco Vincenzo. Semi-supervised Tuning from Temporal Coherence. 23rd International Conference on Pattern Recognition, 2016.
[ article | arXiv extended version | poster ]
Lomonaco Vincenzo and Maltoni Davide. Comparing Incremental Learning Strategies for Convolutional Neural Networks. IAPR Workshop on Artificial Neural Networks in Pattern Recognition. Springer International Publishing, 2016.
[ article | poster | slides | video-presentation ]
Complete list of Publications
Invited Talks
Continuous Unsupervised Training of Deep Architectures
Istituto Italiano di Tecnologia (IIT), Genova.
6th July 2017.
[slides]
Continuous Learning with Deep Architectures
Neurala, Boston.
25th March 2017.
[slides]
Continuous Learning with Deep Architectures
Autonomous System and Robotics, ENSTA ParisTech, Paris.
17th May 2018.
[slides]
Continual Learning with Deep Architectures
Computer VISIONers Conference, Kyiv, Ukraine.
6th October 2018.
[slides]
Open-Source Frameworks for Deep Learning: an Overview
Alma Mater Studiorum - University of Bologna, Cesena, Italy.
13th December 2018.
[slides]
Continual/Lifelong Learning with Deep Architectures
Workshop @ Data Science Milan, Milan, italy.
28th january 2019.
[slides]
Open-Source Frameworks for Deep Learning: an Overview
Data Science Bologna @ Musixmatch, Italy.
28th February 2019.
[slides]
Continual Reinforcement Learning in 3D Non-stationary Environments
Computational Science Lab @ UPF, Barcelona, Spain.
29th March 2019.
[slides]
Continual Lifelong Learning with Neural Networks
Tutorial @ INNSBDDL2019, Sestri Levante, Italy.
16th April 2019.
[slides]
Apprendimento Automatico Continuo per la Robotica e l'Intelligenza Artificiale
Codemotion Meetup @ AlmaCube, Bologna..
4th July 2019.
[slides]
Continual Learning for Robotics
Istituto Italiano di Tecnologia (IIT), Genova.
9th September 2019.
[slides]
Continual Learning: Another Step Towards Truly Intelligent Machines
Numenta, Redwood City, California..
16th September 2017.
[slides]


These descriptions apply to FTPlib V4.0.
These routines allow programs access to the data streams connected to remote files and directories.
Last Updated - June 7, 2013


Blogging Basics
Octopress offers some rake tasks to create post and pages preloaded with metadata and according to Jekyll’s naming conventions.
Blog Posts
Blog posts must be stored in the source/_posts
directory and named according to Jekyll’s naming conventions: YYYY-MM-DD-post-title.markdown
. The name of the file will be used
as the url slug, and the date helps with file distinction and determines the sorting order for post loops.
Octopress provides a rake task to create new blog posts with the right naming conventions, with sensible yaml metadata.
Syntax
1
|
|
new_post
expects a naturally written title and strips out undesirable url characters when creating the filename.
The default file extension for new posts is markdown
but you can configure that in the Rakefile
.
Example
1 2 |
|
The filename will determine your url. With the default permalink settings the url would be something like
http://site.com/blog/20011/07/03/zombie-ninjas-attack-a-survivors-retrospective/index.html
.
Open a post in a text editor and you’ll see a block of yaml front matter which tells Jekyll how to processes posts and pages.
1 2 3 4 5 6 7 |
|
Here you can turn comments off and or categories to your post. If you are working on a multi-author blog, you can add author: Your Name
to the
metadata for proper attribution on a post. If you are working on a draft, you can add published: false
to prevent it from being posted when you generate your blog.
You can add a single category or multiple categories like this.
1 2 3 4 5 6 7 8 9 10 11 |
|
New Pages
You can add pages anywhere in your blog source directory and they’ll be parsed by Jekyll. The URL will correspond directly to the filepath, so about.markdown
will become site.com/about.html
. If you prefer the URL site.com/about/
you’ll want to create the page as about/index.markdown
.
Octopress has a rake task for creating new pages easily.
1 2 3 4 5 |
|
Like with the new post task, the default file extension is markdown
but you can configure that in the Rakefile
. A freshly generated page might look like this.
1 2 3 4 5 6 7 8 |
|
The title is derived from the filename so you’ll likely want to change that. This is very similar to the post yaml except it doesn’t include categories, and you can toggle sharing and comments or remove the footer altogehter. If you don’t want to show a date on your page, just remove it from the yaml.
Generate & Preview
1 2 3 |
|
Jekyll’s built in WEBrick server is handy, but if you’re a POW user, you can set it up to work with Octopress like this.
1 2 3 |
|
Now that you’re setup with POW, you’ll just run rake watch
and load up http://octopress.dev
instead.
Also see Sharing Code Snippets and Blogging with Plugins


Puzzle 1: Advanced Arithmetic
Find the sum of all positive integers between 1 and 125, inclusive, excluding the numbers 79 and 97.
Welcome to Puzzling! Complete as many of the following puzzles as you can within 30 minutes. Submit your answers as you go (if you resubmit a question, that will override the answer you provided earlier). Note that incorrect solutions made after a correct solution will not override the correct solution, to prevent sabotaging another hacker. Also, the puzzles are not necessarily in ascending order of difficulty.
The winner will be the one with the most completed questions, with time taken as a tiebreaker. Note that submissions that do not increase your score will not change your last submission time, so there is no harm in continuing to work on remaining questions after getting some initial questions.
If you have reason to believe that your answer is correct, but it is not being accepted, please bring this to our attention on the #random channel.
Before you begin, please tell us your name:
Find the sum of all positive integers between 1 and 125, inclusive, excluding the numbers 79 and 97.
Define an = [2πn], where [x] denotes the greatest integer less than or equal to x (that is, the floor). Define bn to be the nth positive integer not in sequence a. Compute b1000000.
Define F1 = 1
and F2 = 1
. Then let
Fn = Fn-1 + Fn-2
. Compute the remainder of
F2100 ÷ 216
. (That is, the Fibonacci number
with index 2100!)
How many prime numbers are there between 2 and 79661, inclusive?
How many squares are there in the following diagram? Count only squares with vertices at lattice points and where all four edges are black lines.
How many palindromes can you make out of (whole-word) anagrams of "Antidisestablishment"?
The collatz chain for the number n is a sequence that starts with the number n, and to get the next number, one follows the following rule:
Find the lowest number whose collatz chain contains the number 8153620


--- layout: default title: blog rank: 7 ---
chronological
{% include print_categories_for_thing.html thing=post %}
{{ post.date | date_to_string }}
{{ post.excerpt }} read more


Project 2 has come and gone. It was a week full of many lessons learned and victory dances. Let’s get to it.
Project 2: Building our First Full-Stack App:
Let’s review the Technical Requirements
The app must…
- Be built in Rails.
- Have at least 2 models with at least 1 association (more if it makes sense).
- Have complete RESTful routes for at least one of your resources with GET, POST, PUT, and DELETE.
- Have error handling & validations for all resources
- Utilize an ORM to create a database table structure (e.g. ActiveRecord) and interact with your relationally-stored data.
- Have semantically-clean HTML and CSS that passes the standard validators.
- Record and publish a video on Youtube describing your process, showing off your code, and speaking about things you’ll like to add to your app
What did I do?
Have you ever had a random idea, thought or just a question you wanted to throw out into the world and get real-time feedback on?
I built a fully functional CRUD full-stack app with user authentication and permissions. Rails on the front end, ActiveRecord as my ORM, and Postgres for my database. For this project, I wanted to focus on writing clean, easy to follow, and DRY code. DRY = Don’t Repeat Yourself.
I challenged myself to implement Ruby gems not taught in class so I could practice reading other developer’s documentation.
I was able to find a neat gem called Acts As Votable. This gem allows users to upvote and downvote their own and other user’s ideas. An user can only vote once per vote.
I’m very proud of keeping true to my goal and delivering DRY code. I used partials and helpers in my application that helped keep my files neat, readable and easy for other developers to use.
I’m pretty darn proud of my project 2. I enjoyed learning more about Rails, ActiveRecord and Postgres. I now have my first full stack application where users can log in/out, leave the site and data will persistent within my database. It’s definitely worth a pat on the back.
Once the project was done, I took 1 hour to record my presentation using QuickTime. With QuickTime, you can easily record whatever is on your computer screen. For recording your screen, I highly recommend grabbing headphones and using QuickTime!
Moving on, as promised here are my project 2 links:
Youtube link
Github link
Live Demo - Remember this is public so if you use it, anyone can see anything you post!
Day 5: Intro to Angular && Campus Lunch && Student Surprise!
No time off. Right back to learning new material the day after project submission. Today is a special day because today we are stepping into the A of the MEAN stack. Angularjs.
Intro to Angular
I am super pumped to start moving into the MEAN stack and learn a brand new front end framework called Angularjs. Today in class, we’re building a classic application… a Todo App.
We bootstrapped our Angular app, learned how to use Angular directives such as ‘ng-app, ng-repeat, ng-model, ng-click, ng-show and ng-hide’ and walked through coding a Todo App in class.
Campus Lunch
Every other Friday, General Assembly provides catered lunch for the whole campus. This is clearly one of the best perks and a highly anticipated one. Obviously, free lunch taste better and it’s a lot of fun hanging and eating with my classmates.
Surprise!
Project 2 is done and we have two more projects to go! We’re right at the midpoint of our adventure and because of this rite of passage we were rewarded our official WDI General Assembly zip up hoodie! Yes, now we are a free walking marketing board for GA! Haha, I see right through General Assembly but hey, it’s cool to represent! These hoodies are not available to the public and only full time students receive them so yeah, it’s pretty special.
Lab and Happy Hour
To wrap up this full week, we were given a lab to solidify the Angular lesson taught earlier today. The theme of the lab: Superhero Phonebook.
Using Angular, build a superhero phonebook using directives, add a button next to each superhero that, when clicked, causes the hero’s image to be displayed on the page. Also, this phonebook should have search capabilities where you can easily type a term and the phonebook responds accordingly. Really fun stuff that definitely gave me a better understanding of Angular.
What a week! Time to wrap up and head to Happy Hour. Until next time!


Girl's Day's Minah reveals first MV teaser for new solo single 'Butterfly'
by sl278Girl's Day's Minah has revealed her first MV teaser for her solo single "Butterfly".
The simple but nostalgic video clip shows Minah driving as she hums along to her acoustic ballad tune that is bound to tug at the heartstrings and get you in the mood for an emotional fall afternoon.
"Butterfly" will be released on November 21 at 6 pm KST. Check out the teaser above and stay tuned for more updates!


Andrew Gerrand
<EMAIL_ADDRESS>http://wh3rd.net/practical-go/
Go is a general-purpose programming language.
Go's killer features:
This talk will cover the complete development of a simple web application.
There's a lot to cover, so we'll move pretty fast.
If you're new to Go there may be some syntax you don't understand. The important thing is to get a feel for what the program does, rather than exactly how it does it.
These slides are available at http://wh3rd.net/practical-go/ - you may want to follow along.
Complete source code and other bits are available in the git repository: http://github.com/nf/goto
Twitter stuff:
#golang
hashtag
@go_nuts
(that's me!)
Goto is a web service (HTTP) that does two things:
http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=tokyo&sll=37.0625,-95.677068&sspn=68.684234,65.566406&ie=UTF8&hq=&hnear=Tokyo,+Japan&t=h&z=9
http://goo.gl/UrcGq
Goto maps short URLs to long URLs. To store this mapping in memory we can use a hash table.
Go's map
type allows you to map values of any* type
to values of any other type.
Maps must be initialized with the built-in make
function:
m := make(map[int]string) m[1] = "One" u := m[1] // u == "One" v, present := m[2] // v == "", present == false
(*The keys must be comparable with ==
.)
We specify the URLStore
type,
Goto's fundamental data structure:
type URLStore map[string]string m := make(URLStore)
To store the mapping of http://goto/a
to http://google.com/
in m
:
m["a"] = "http://google.com/"
url := m["a"]
// url == "http://google.com/"
This has a shortcoming: Go's map
type is not thread-safe.
Goto will serve many requests concurrently, so we must make our
URLStore
type safe to access from separate threads.
To protect the map
type from being modified while it is being
read, we must add a lock to the data structure.
Changing the type definition, we make URLStore
a
struct
type with two fields: the map
and
a RWMutex
from the sync
package.
import "sync" type URLStore struct { urls map[string]string mu sync.RWMutex }
An RWMutex
has two locks: one for readers, and one for writers.
Many clients can take the read lock simultaneously, but only one client can
take the write lock (to the exclusion of all readers).
We must now interact with the URLStore
through Set
and Get
methods.
The Get
method takes the read lock with mu.RLock
, and
returns the URL as a string. If the key is present in the map, the
zero value for the string type (an empty string) will be returned.
func (s *URLStore) Get(key string) string { s.mu.RLock() url := s.urls[key] s.mu.RUnlock() return url }
The Set
method takes the write lock and updates the url map.
If the key is already present, Set
returns a boolean
false
value and the map is not updated.
(Later, We will use this behavior to ensure that each URL has a unique key.)
func (s *URLStore) Set(key, url string) bool { s.mu.Lock() _, present := s.urls[key] if present { s.mu.Unlock() return false } s.urls[key] = url s.mu.Unlock() return true }
A defer
statement pushes a function call onto a list.
The list of saved calls is executed after the surrounding function returns.
Defer is commonly used to simplify functions that perform various clean-up
actions.
For example, this function will print "Hello" and then "World":
func foo() { defer fmt.Println("World") fmt.Println("Hello") }
We can use defer
to simplify the Set
and
Get
methods.
There's much more to know about defer. See the "Defer, Panic, and Recover" blog post for an in-depth discussion.
Using defer, the Get
method can avoid using the local
url
variable and return the map value directly:
func (s *URLStore) Get(key string) string { s.mu.RLock() defer s.mu.RUnlock() return s.urls[key] }
And the logic for Set
becomes clearer:
func (s *URLStore) Set(key, url string) bool { s.mu.Lock() defer s.mu.Unlock() _, present := s.urls[key] if present { return false } s.urls[key] = url return true }
The URLStore
struct contains a map
field,
which must be initialized with make
before it can be used.
type URLStore struct { urls map[string]string mu sync.RWMutex }
Go doesn't have constructors. Instead, the convention is to write a function
named NewXXX
that returns an intialized instance of the type.
func NewURLStore() *URLStore { return &URLStore{ urls: make(map[string]string), } }
Creating an instance:
s := NewURLStore()
Setting a URL by key:
if s.Set("a", "http://google.com") { // success }
Getting a URL by key:
if url := s.Get("a"); url != "" { // redirect to url } else { // key not found }
We already have the Get
method for retrieving URLs.
Let's create a Put
method that takes a URL,
stores the URL under a corresponding key, and returns that key.
func (s *URLStore) Put(url string) string { for { key := genKey(s.Count()) if s.Set(key, url) { return key } } panic("shouldn't get here") } func (s *URLStore) Count() int { s.mu.RLock() defer s.mu.RUnlock() return len(s.urls) }
The genKey
function takes an integer and returns a corresponding
alphanumeric key:
func genKey(n int) string { /* implementation omitted */ }
Go's http
package provides the infrastructure to serve HTTP
requests:
package main import ( "fmt" "http" ) func Hello(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello, world!") } func main() { http.HandleFunc("/", Hello) http.ListenAndServe(":8080", nil) }
Our program will have two HTTP handlers:
Redirect
, which redirects short URL requests, and
Add
, which handles the submission of new URLs.
The HandleFunc
function is used to register them with the
http
package.
func main() { http.HandleFunc("/", Redirect) http.HandleFunc("/add", Add) http.ListenAndServe(":8080", nil) }
Requests to /add
will be served by the Add
handler.
All other requests will be served by the Redirect
handler.
The Add
function reads the url
parameter from an HTTP request, Put
s it into
the store
, and sends the corresponding short URL to the user.
func Add(w http.ResponseWriter, r *http.Request) { url := r.FormValue("url") key := store.Put(url) fmt.Fprintf(w, "http://localhost:8080/%s", key) }
But what is store
?
It's a global variable pointing to an instance of URLStore
:
var store = NewURLStore()
The line above can appear anywhere in the top level of a source file.
It will be evaluated at program initialization, before the main
function is called.
What about the user interface? Let's modify Add
to display an
HTML form when no url
is supplied:
func Add(w http.ResponseWriter, r *http.Request) { url := r.FormValue("url") if url == "" { fmt.Fprint(w, AddForm) return } key := store.Put(url) fmt.Fprintf(w, "http://localhost:8080/%s", key) } const AddForm = ` <form method="POST" action="/add"> URL: <input type="text" name="url"> <input type="submit" value="Add"> </form> `
The Redirect
function finds the key in the HTTP request path,
retrieves the corresponding URL from the store
,
and sends an HTTP redirect to the user.
If the URL is not found, a 404 "Not Found" error is sent instead.
func Redirect(w http.ResponseWriter, r *http.Request) { key := r.URL.Path[1:] url := store.Get(key) if url == "" { http.NotFound(w, r) return } http.Redirect(w, r, url, http.StatusFound) }
The key
is the request path minus the first character.
For the request "/foo
" the key would be "foo
".
http.NotFound
and http.Redirect
are helpers for
sending common HTTP responses. The constant http.StatusFound
represents HTTP code 302 ("Found").
We've written under 100 lines of code, and have a complete, functional web application.
See the code we've written so far:
These slides are available at http://wh3rd.net/practical-go/
When the goto process ends, the shortened URLs in memory will be lost.
This isn't very helpful.
Let's modify URLStore
so that it writes its data to a file,
and restores that data on start-up.
Go's interface types define a set of methods. Any type that implements those methods satisfies that interface.
One frequently-used interface is Writer
, specified by the
io
package:
type Writer interface { Write(p []byte) (n int, err os.Error) }
Many types, from both the standard library and other Go code, implement the
Write
method described above, and can thus be used anywhere an
io.Writer
is expected.
In fact, we've already used an io.Writer
in our
HTTP handlers:
func Add(w http.ResponseWriter, r *http.Request) {
...
fmt.Fprintf(w, "http://localhost:8080/%s", key)
}
The Fprintf
function expects an io.Writer
as its
first argument:
func Fprintf(w io.Writer, format string, a ...interface{}) (n int, error os.Error)
Because http.ResponseWriter
implements the Write
method, w
can be passed to Fprint
as an
io.Writer
.
How should we represent the URLStore
on disk?
Go's gob
package handles serializing and deserializing Go
data structures.
(Similar to Python's "pickle" or Java's "Serialization".)
The gob
package's NewEncoder
and
NewDecoder
functions wrap io.Writer
and
io.Reader
values respectively.
The resulting Encoder
and Decoder
objects provide
Encode
and Decode
methods for writing and reading
Go data structures.
Let's create a new data type, record
, which describes how
single key/url pair will be stored on disk:
type record struct { Key, URL string }
The new save
method writes a given key and url
to disk as a gob-encoded record
:
func (s *URLStore) save(key, url string) os.Error { e := gob.NewEncoder(s.file) return e.Encode(record{key, url}) }
But what is s.file
?
URLStore
's new file
field (of type *os.File
)
will be a handle to an open file that can be used for writing and reading.
type URLStore struct { urls map[string]string mu sync.RWMutex file *os.File }
The NewURLStore
function now takes a filename
argument, OpenFile
s the file, and stores the *os.File
value in the file
field:
func NewURLStore(filename string) *URLStore { s := &URLStore{urls: make(map[string]string)} f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644) if err != nil { log.Fatal("URLStore:", err) } s.file = f return s }
The new load
method will Seek
to the beginning of
the file, read and Decode
each record
,
and store write the data to the map using the Set
method:
func (s *URLStore) load() os.Error { if _, err := s.file.Seek(0, 0); err != nil { return err } d := gob.NewDecoder(s.file) var err os.Error for err == nil { var r record if err = d.Decode(&r); err == nil { s.Set(r.Key, r.URL) } } if err == os.EOF { return nil } return err }
Took hook it all up, first we add a call to load
to the
constructor function:
func NewURLStore(filename string) *URLStore { s := &URLStore{urls: make(map[string]string)} f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644) if err != nil { log.Fatal("URLStore:", err) } s.file = f if err := s.load(); err != nil { log.Println("URLStore:", err) } return s }
And save
each new URL as it is Put
:
func (s *URLStore) Put(url string) string { for { key := genKey(s.Count()) if s.Set(key, url) { if err := s.save(key, url); err != nil { log.Println("URLStore:", err) } return key } } panic("shouldn't get here") }
Finally, we must specify a filename when instantiating the URLStore:
var store = NewURLStore("store.gob")
See the code we've written so far:
These slides are available at http://wh3rd.net/practical-go/
Consider this pathological situation:
Put
will return.
Add
requests to go through.
To remedy these issues, we should decouple the Put
and
save
processes.

Goroutines are launched by a go
statement. This code executes
both foo
and bar
concurrently:
go foo() bar()
The foo
function runs in a newly created goroutine, while
bar
runs in the main goroutine.
Memory is shared between goroutines, like in many popular threading models.
Goroutines are cheaper to create than operating system threads.
 They provide many interesting algorithmic possibilities.
Like maps, channels must be initialized with make
:
ch := make(chan int) // a channel of ints
Communication is expressed using the "channel operator", <-
:
ch <- 7 // send the int 7 to the channel i := <-ch // receive an int from the channel
Data always moves in the direction of the arrow.
Communicating between goroutines:
func sum(x, y int, c chan int) { c <- x + y } func main() { c := make(chan int) go sum(24, 18, c) fmt.Println(<-c) }
Channel send/receive operations typically block until the other side is ready. Channels can be either buffered or unbuffered. Sends to a buffered channel will not block until the buffer is full.
Buffered channels are initialized by specifying the buffer size as the
second argument to make
:
ch := make(chan int, 10)
See the blog posts "Share Memory by Communicating" and "Timing out, moving on" for a detailed discussion of goroutines and channels.
Instead of making a function call to save each record to disk,
Put
can send a record
to a buffered channel:
type URLStore struct { urls map[string]string mu sync.RWMutex save chan record } func (s *URLStore) Put(url string) string { for { key := genKey(s.Count()) if s.Set(key, url) { s.save <- record{key, url} return key } } panic("shouldn't get here") }
At the other end of the save
channel we must have a receiver.
This new method, saveLoop
, will run in a separate goroutine.
It receives record
values and writes them to a file.
func (s *URLStore) saveLoop(filename string) { f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) if err != nil { log.Fatal("URLStore:", err) } e := gob.NewEncoder(f) for { r := <-s.save if err := e.Encode(r); err != nil { log.Println("URLStore:", err) } } }
We need to modify the NewURLStore
function to launch the
saveLoop
goroutine (and remove the now-unnecessary file opening
code):
const saveQueueLength = 1000 func NewURLStore(filename string) *URLStore { s := &URLStore{ urls: make(map[string]string), save: make(chan record, saveQueueLength), } if err := s.load(filename); err != nil { log.Println("URLStore:", err) } go s.saveLoop(filename) return s }
Go's flag
package makes it easy to handle command-line flags.
Let's use it to replace the constants we have in our code so far.
import ( "flag" "fmt" "http" )
We first create some global variables to hold the flag values:
var ( listenAddr = flag.String("http", ":8080", "http listen address") dataFile = flag.String("file", "store.gob", "data store file name") hostname = flag.String("host", "localhost:8080", "host name and port") )
Then we can add flag.Parse()
to the main
function,
and instantiate the URLStore
after the flags have been parsed
(once we know the value of *dataFile
).
var store *URLStore func main() { flag.Parse() store = NewURLStore(*dataFile) http.HandleFunc("/", Redirect) http.HandleFunc("/add", Add) http.ListenAndServe(*listenAddr, nil) }
And substitute *hostname
in the Add
handler:
fmt.Fprintf(w, "http://%s/%s", *hostname, key)
See the code we've written so far:
These slides are available at http://wh3rd.net/practical-go/
So far we have a program that runs as a single process. But a single process running on one machine can only serve so many concurrent requests.
A URL Shortener typically serves many more Redirects (reads) than it does Adds (writes).
Therefore we can create an arbitrary number of read-only slaves that serve and cache Get requests, and pass Puts through to the master.
Go's rpc
package provides a convenient means of making function
calls over a network connection.
Given a value, rpc
will expose to the network the value's methods
that meet this function signature:
func (t T) Name(args *ArgType, reply *ReplyType) os.Error
To make URLStore
an RPC service we need to alter the
Put
and Get
methods so that they match this
function signature:
func (s *URLStore) Get(key, url *string) os.Error func (s *URLStore) Put(url, key *string) os.Error
And, of course, we need to change the call sites to call these functions appropriately.
These changes are described in full by some slides at the end of this presentation. They have been omitted here for time reasons.
Add a command-line flag to enable the RPC server:
var rpcEnabled = flag.Bool("rpc", false, "enable RPC server")
And then Register
the URLStore
with the
rpc
package and set up the RPC-over-HTTP handler with
HandleHTTP
.
func main() {
flag.Parse()
store = URLStore(*dataFile)
if *rpcEnabled {
rpc.RegisterName("Store", store)
rpc.HandleHTTP()
}
... (set up http)
}
Now that we have the URLStore available as an RPC service, we can build another type that forwards requests to the RPC server.
We will call it ProxyStore
:
type ProxyStore struct { client *rpc.Client } func NewProxyStore(addr string) *ProxyStore { client, err := rpc.DialHTTP("tcp", addr) if err != nil { log.Println("ProxyStore:", err) } return &ProxyStore{client: client} }
Its Get
and Put
methods pass the requests directly
to the RPC server:
func (s *ProxyStore) Get(key, url *string) os.Error { return s.client.Call("Store.Get", key, url) } func (s *ProxyStore) Put(url, key *string) os.Error { return s.client.Call("Store.Put", url, key) }
But there's something missing: the slave must cache the data it gets from the master, otherwise it provides no benefit.
We already have the perfect data structure for caching this data,
the URLStore
.
Let's add a URLStore
instance to ProxyStore
:
type ProxyStore struct { urls *URLStore client *rpc.Client } func NewProxyStore(addr string) *ProxyStore { client, err := rpc.DialHTTP("tcp", addr) if err != nil { log.Println("ProxyStore:", err) } return &ProxyStore{urls: NewURLStore(""), client: client} }
(And we must modify the URLStore
so that it doesn't try to write
to or read from disk if an empty filename is given.)
The Get
method should first check if the key is in the cache.
If present, Get
should return the cached result. If not,
it should make the RPC call, and update its local cache with the result.
func (s *ProxyStore) Get(key, url *string) os.Error { if err := s.urls.Get(key, url); err == nil { return nil } if err := s.client.Call("Store.Get", key, url); err != nil { return err } s.urls.Set(key, url) return nil }
The Put
method need only update the cache when it performs a
successful RPC Put
.
func (s *ProxyStore) Put(url, key *string) os.Error { if err := s.client.Call("Store.Put", url, key); err != nil { return err } s.urls.Set(key, url) return nil }
Now we want to be able to use ProxyStore
with the web front-end,
in the place of URLStore
.
Since they both implement the same Get
and Put
methods, we can specify an interface to generalize their behavior:
type Store interface { Put(url, key *string) os.Error Get(key, url *string) os.Error }
Now our global variable store
can be of type Store
:
var store Store
Our main
function can instantiate either a URLStore
or ProxyStore
depending on a new command-line flag:
var masterAddr = flag.String("master", "", "RPC master address")
func main() { flag.Parse() if *masterAddr != "" { // we are a slave store = NewProxyStore(*masterAddr) } else { // we are the master store = NewURLStore(*dataFile) } ... }
The rest of the front-end code continues to work as before.
It does not need to be aware of the Store
interface.
Now we can launch a master and several slaves, and stress-test the slaves.
See the complete program:
These slides are available at http://wh3rd.net/practical-go/
While this program does what we set out to do, there are a few ways it could be improved:
template
package.
Andrew Gerrand
<EMAIL_ADDRESS>http://wh3rd.net/practical-go/
To make URLStore
an RPC services, we need to alter the
Get
and Put
methods to be rpc
-friendly.
The function signatures change, and now return an os.Error
value.
The Get
method can return an explicit error when the provided key
is not found:
func (s *URLStore) Get(key, url *string) os.Error { s.mu.RLock() defer s.mu.RUnlock() if u, ok := s.urls[*key]; ok { *url = u return nil } return os.NewError("key not found") }
Beyond the function signature, the Put
method barely changes
in its actual code (not shown here):
func (s *URLStore) Put(url, key *string) os.Error
In turn, the HTTP handlers must be modfied to accommodate the changes to
URLStore
.
The Redirect
handler now returns the error string provided by
the URLStore
:
func Redirect(w http.ResponseWriter, r *http.Request) { key := r.URL.Path[1:] var url string if err := store.Get(&key, &url); err != nil { http.Error(w, err.String(), http.StatusInternalServerError) return } http.Redirect(w, r, url, http.StatusFound) }
The Add
handler changes in much the same way:
func Add(w http.ResponseWriter, r *http.Request) { url := r.FormValue("url") if url == "" { fmt.Fprint(w, AddForm) return } var key string if err := store.Put(&url, &key); err != nil { http.Error(w, err.String(), http.StatusInternalServerError) return } fmt.Fprintf(w, "http://%s/%s", *hostname, key) }


The HTML Responsive Presentation Framework Created by Ela Cai / @elacai
Press ESC to enter the slide overview.
Use picture stored on the cloud disk.用云盘中的图片做背景

Background repeat.重复图片背景

Config background transitions via the backgroundTransition option. This one's called "zoom".
Reveal.configure({ backgroundTransition: 'zoom' })
Page Number followed by enter to jump to a certain slide. Have a try. Type 5 followed by enter. Then type 10 followed by enter to come back.
There's a speaker view. It includes a timer, preview of the upcoming slide as well as your speaker notes.
Press the S key to try it out.
Press the B key or . to pause the presentation.
Click"next" to navigate to first page.


The nuget package of drapo comes with the declaration files used by drapo. By default typescript loads the types from node_modules\@types folder. Drapo add the declaration type file as a linked file in csproj. The only thing that you need to do is to persist this link file in the disk. You can do that inserting the following code in your csproj:


Rail lines re-open after incident on mainline
by Katy SandallsGreater Anglia say that lines have re-opened after rail passengers were told not travel following an emergency incident.
Emergency services were dealing with an incident close to the railway between Chadewell Heath and Romford in Essex meaning that some lines were blocked.
Services between Ipswich and London Liverpool street were cancelled, delayed or revised and will remain so until 4pm today.
A number of services into the capital from Suffolk and Essex were cancelled.
As a result Greater Anglia were warning travellers to stay away as they run a reduced service.
Greater Anglia tickets are being accepted on the London Underground , c2c sevices and First Essex bus routes between Colchester and Colchester Town.
In a statement on their website the rail operator said: "Greater Anglia and Network Rail are sorry if your journey has been affected by this disruption."


Blog Archive 2014 Trying to Free Up 95 Express Mar 01 2014 Road Songs With a #@!%ing Twist Feb 15 2014 Yes, People Do Get Pulled Over And/or Why @evanbenn Owes Us Feb 15 2014 I-95’s Narrow Shoulders and Speeding Cars Problematic for Florida Highway Patrol Feb 15 2014 I-95 Has a Speed Limit!? Feb 15 2014 Broward-to-Date Among Most ‘Popular’ Commutes in United States Feb 15 2014 An Explaination of I-95’s $17 Million ‘Bridge to Nowhere’ Feb 15 2014 Bus Is the New Train - at Least the Affordable One Feb 15 2014 Florida Has a (Bipartisan) Need for Speed! Feb 14 2014 What’s the Craziest Thing You’ve Seen on I-95? Feb 10 2014 Snowbirding on I-95 Feb 10 2014 The Commuter: A Diary Feb 10 2014


Extraverted, enthusiastic.
Critical, quarrelsome.
Dependable, self-disciplined.
Anxious, easily upset.
Open to new experiences, complex.
Reserved, quiet.
Sympathetic, warm.
Disorganized, careless.
Calm, emotionally stable.
Conventional, uncreative.


public static final String |
ATTR_ACTUAL_AVG_RUNTIME |
"averageActualRuntime" |
public static final String |
ATTR_ACTUAL_OMPH |
"actualOperationMixesPerHour" |
public static final String |
ATTR_ACTUAL_OPH |
"actualOperationsPerHour" |
public static final String |
ATTR_ACTUAL_OPS |
"actualOperationsPerSecond" |
public static final String |
ATTR_ACTUAL_RUNTIME |
"actualRuntime" |
public static final String |
ATTR_ASK_FORMAT |
"askFormat" |
public static final String |
ATTR_AVG_RESPONSE_TIME |
"averageResponseTime" |
public static final String |
ATTR_AVG_RESPONSE_TIME_GEOM |
"averageResponseTimeGeometric" |
public static final String |
ATTR_AVG_RUNTIME |
"averageRuntime" |
public static final String |
ATTR_AVG_RUNTIME_GEOM |
"averageRuntimeGeometric" |
public static final String |
ATTR_COMPRESSION |
"compression" |
public static final String |
ATTR_COUNTING |
"counting" |
public static final String |
ATTR_FASTEST_OPERATION |
"fastestOperation" |
public static final String |
ATTR_GRAPH_FORMAT |
"graphFormat" |
public static final String |
ATTR_ID |
"id" |
public static final String |
ATTR_LIMIT |
"limit" |
public static final String |
ATTR_MAX_DELAY |
"maxDelay" |
public static final String |
ATTR_MAX_MIX_RUNTIME |
"maxMixRuntime" |
public static final String |
ATTR_MAX_OPERATION_RUNTIME |
"maxOperationRuntime" |
public static final String |
ATTR_MIN_MIX_RUNTIME |
"minMixRuntime" |
public static final String |
ATTR_MIN_OPERATION_RUNTIME |
"minOperationRuntime" |
public static final String |
ATTR_NAME |
"name" |
public static final String |
ATTR_OMPH |
"operationMixesPerHour" |
public static final String |
ATTR_OPH |
"operationsPerHour" |
public static final String |
ATTR_OPS |
"operationsPerSecond" |
public static final String |
ATTR_OUTLIERS |
"outliers" |
public static final String |
ATTR_QUERY_ENDPOINT |
"queryEndpoint" |
public static final String |
ATTR_RANDOM_ORDER |
"randomOrder" |
public static final String |
ATTR_RESPONSE_TIME |
"responseTime" |
public static final String |
ATTR_RESULT_COUNT |
"resultCount" |
public static final String |
ATTR_RUN_ORDER |
"runOrder" |
public static final String |
ATTR_RUNS |
"runs" |
public static final String |
ATTR_RUNTIME |
"runtime" |
public static final String |
ATTR_SANITY_CHECKING |
"sanityChecking" |
public static final String |
ATTR_SELECT_FORMAT |
"selectFormat" |
public static final String |
ATTR_SLOWEST_OPERATION |
"slowestOperation" |
public static final String |
ATTR_STD_DEV |
"standardDeviation" |
public static final String |
ATTR_THREADS |
"threads" |
public static final String |
ATTR_TIMEOUT |
"timeout" |
public static final String |
ATTR_TOTAL_RESPONSE_TIME |
"totalResponseTime" |
public static final String |
ATTR_TOTAL_RUNTIME |
"totalRuntime" |
public static final String |
ATTR_TYPE |
"type" |
public static final String |
ATTR_VALUE |
"value" |
public static final String |
ATTR_VARIANCE |
"variance" |
public static final String |
ATTR_WARMUPS |
"warmups" |
public static final String |
TAG_CONFIG_PROPERTY |
"property" |
public static final String |
TAG_CONFIGURATION |
"configuration" |
public static final String |
TAG_MIX_RUN |
"operationMixRun" |
public static final String |
TAG_MIX_RUNS |
"operationMixRuns" |
public static final String |
TAG_OPERATION |
"operation" |
public static final String |
TAG_OPERATIONS |
"operations" |
public static final String |
TAG_SPARQL_BENCHMARK |
"sparqlBenchmark" |
public static final String |
TAG_STATS |
"statistics" |
public static final String |
TAG_SUMMARY |
"summary" |


Page Links: First Previous 1 2 3 Last Index Page
| ngcgliding 7th Jan 2016, 14:27 permalink Post: 1916 |
JohnA
Great to see some facts from an expert. It was a long time ago and memories fade, but one cannot get away from the knowledge that we were on the edge of our operating limits, especially when operating out of Casablanca on the engine surge programme and max cruise.
Sorry to read about Andre' All the best to you for 2016. |


MBPlatform Class Reference
| Inherits from | NSObject |
|---|---|
| Conforms to | MBSingleton |
| Declared in | MBPlatform.h |
Overview
The MBPlatform
singleton provides a platform-independent mechanism for
accessing information about the current execution environment.
Warning: You must not create instances of this class yourself; this class
is a singleton. Call the instance
class method (declared by the
MBSingleton
protocol) to acquire the singleton instance.
Platform information
platformType
Determines whether the code is running on a Mac OS X system; YES
if it
is, NO
otherwise.
@property (nonatomic, readonly) MBPlatformType platformType
Declared In
MBPlatform.h
platformName
Returns a human-readable string containing the name of the platform on which the code is running.
@property (nonnull, nonatomic, readonly) NSString *platformName
Declared In
MBPlatform.h
isMacOS
Determines whether the code is running on a macOS system; YES
if it
is, NO
otherwise.
@property (nonatomic, readonly) BOOL isMacOS
Declared In
MBPlatform.h
isIOS
Determines whether the code is running on an iOS system; YES
if it
is, NO
otherwise.
@property (nonatomic, readonly) BOOL isIOS
Declared In
MBPlatform.h
isTVOS
Determines whether the code is running on an Apple TV (tvOS) system;
YES
if it is, NO
otherwise.
@property (nonatomic, readonly) BOOL isTVOS
Declared In
MBPlatform.h
isWatchOS
Determines whether the code is running on an Apple Watch (watchOS) system;
YES
if it is, NO
otherwise.
@property (nonatomic, readonly) BOOL isWatchOS
Declared In
MBPlatform.h
isUIKit
Determines whether the code is running on a UIKit-based system such as
an iPhone, iPad or Apple TV; YES
if it is, NO
otherwise.
@property (nonatomic, readonly) BOOL isUIKit
Declared In
MBPlatform.h


# Mitmproxy Core Features
- Anticache
- Client-side replay
- Proxy Authentication
- Replacements
- Server-side replay
- Set Headers
- Sticky Auth
- Sticky Cookies
- Streaming
- Upstream Certificates
# Anticache
When the anticache
option is set, it removes headers (if-none-match
and
if-modified-since
) that might elicit a 304 not modified
response from the
server. This is useful when you want to make sure you capture an HTTP exchange
in its totality. It’s also often used during client-side replay, when you want
to make sure the server responds with complete data.
# Client-side replay
Client-side replay does what it says on the tin: you provide a previously saved HTTP conversation, and mitmproxy replays the client requests one by one. Note that mitmproxy serialises the requests, waiting for a response from the server before starting the next request. This might differ from the recorded conversation, where requests may have been made concurrently.
You may want to use client-side replay in conjunction with the anticache
option, to make sure the server responds with complete data.
# Proxy Authentication
Asks the user for authentication before they are permitted to use the proxy. Authentication headers are stripped from the flows, so they are not passed to upstream servers. For now, only HTTP Basic authentication is supported. The proxy auth options are not compatible with the transparent, socks or reverse proxy mode.
# Replacements
The replacements
option lets you specify an arbitrary number of patterns that
define text replacements within flows. A replacement pattern looks like this:
/patt/regex/replacement
Here, patt is a mitmproxy filter expression that defines which flows a
replacement applies to, regex is a valid Python regular expression that
defines what gets replaced, and replacement is a string literal that is
substituted in. The separator is arbitrary, and defined by the first character.
If the replacement string literal starts with @
, it is treated as a file path
from which the replacement is read.
Replace hooks fire when either a client request or a server response is received. Only the matching flow component is affected: so, for example, if a replace hook is triggered on server response, the replacement is only run on the Response object leaving the Request intact. You control whether the hook triggers on the request, response or both using the filter pattern. If you need finer-grained control than this, it’s simple to create a script using the replacement API on Flow components.
# Examples
Replace foo
with bar
in requests:
:~q:foo:bar
Replace foo
with with the data read from ~/xss-exploit
:
mitmdump --replacements :~q:foo:@~/xss-exploit
# Server-side replay
The server_replay
option lets us replay server responses from saved HTTP
conversations. To do this, we use a set of heuristics to match incoming requests
with saved responses. By default, we exclude request headers when matching
incoming requests with responses from the replay file, and use only the URL and
request method for matching. This works in most circumstances, and makes it
possible to replay server responses in situations where request headers would
naturally vary, e.g. using a different user agent.
There is a slew of ways to customise the matching heuristic, including
specifying headers to include, request parameters to exclude, etc. These options
are collected under the server_replay
prefix - please see the built-in
documentation for details.
# Response refreshing
Simply replaying server responses without modification will often result in unexpected behaviour. For example cookie timeouts that were in the future at the time a conversation was recorded might be in the past at the time it is replayed. By default, mitmproxy refreshes server responses before sending them to the client. The date, expires and last-modified headers are all updated to have the same relative time offset as they had at the time of recording. So, if they were in the past at the time of recording, they will be in the past at the time of replay, and vice versa. Cookie expiry times are updated in a similar way.
You can turn off this behaviour by setting the server_replay_refresh
option to
false
.
# Replaying a session recorded in Reverse-proxy Mode
If you have captured the session in reverse proxy mode, in order to replay it you still have to specify the server URL, otherwise you may get the error: ‘HTTP protocol error in client request: Invalid HTTP request form (expected authority or absolute…)‘.
During replay, when the client’s requests match previously recorded requests, then the respective recorded responses are simply replayed by mitmproxy. Otherwise, the unmatched requests is forwarded to the upstream server. If forwarding is not desired, you can use the –kill (-k) switch to prevent that.
# Set Headers
The setheaders
option lets you specify a set of headers to be added to
requests or responses, based on a filter pattern. A setheaders
expression
looks like this:
/patt/name/value
Here, patt is a mitmproxy filter expression that defines which flows to set headers on, and name and value are the header name and the value to set respectively.
# Sticky auth
The stickyauth
option is analogous to the sticky cookie option, in that HTTP
Authorization headers are simply replayed to the server once they have been
seen. This is enough to allow you to access a server resource using HTTP Basic
authentication through the proxy. Note that mitmproxy doesn’t (yet) support replay of HTTP Digest
authentication.
# Sticky cookies
When the stickycookie
option is set, mitmproxy will add the cookie most
recently set by the server to any cookie-less request. Consider a service that
sets a cookie to track the session after authentication. Using sticky cookies,
you can fire up mitmproxy, and authenticate to a service as you usually would
using a browser. After authentication, you can request authenticated resources
through mitmproxy as if they were unauthenticated, because mitmproxy will
automatically add the session tracking cookie to requests. Among other things,
this lets you script interactions with authenticated resources (using tools like
wget or curl) without having to worry about authentication.
Sticky cookies are especially powerful when used in conjunction with client replay - you can record the authentication process once, and simply replay it on startup every time you need to interact with the secured resources.
# Streaming
By default, mitmproxy will read an entire request/response, perform any indicated manipulations on it, and then send the message on to the other party. This can be problematic when downloading or uploading large files. When streaming is enabled, message bodies are not buffered on the proxy but instead sent directly to the server/client. HTTP headers are still fully buffered before being sent.
Request/response streaming is enabled by specifying a size cutoff in the
stream_large_bodies
option.
# Customizing Streaming
You can also use a script to customise exactly which requests or responses are
streamed. Requests/Responses that should be tagged for streaming by setting
their .stream
attribute to True
:
def responseheaders(flow):
"""
Enables streaming for all responses.
This is equivalent to passing `--set stream_large_bodies=1` to mitmproxy.
"""
flow.response.stream = True
# Websockets
The stream_websockets
option enables an analogous behaviour for websockets.
When WebSocket streaming is enabled, portions of the code which may perform
changes to the WebSocket message payloads will not have any effect on the actual
payload sent to the server as the frames are immediately forwarded to the
server. In contrast to HTTP streaming, where the body is not stored, the message
payload will still be stored in the WebSocket flow.
# Upstream Certificates
When mitmproxy receives a connection destined for an SSL-protected service, it freezes the connection before reading its request data, and makes a connection to the upstream server to “sniff” the contents of its SSL certificate. The information gained - the Common Name and Subject Alternative Names - is then used to generate the interception certificate, which is sent to the client so the connection can continue.
This rather intricate little dance lets us seamlessly generate correct certificates even if the client has specified only an IP address rather than the hostname. It also means that we don’t need to sniff additional data to generate certs in transparent mode.
Upstream cert sniffing is on by default, and can optionally be turned off with
the upstream_cert
option.


Star Carr is a Mesolithic (Middle Stone Age) archaeological site, dating to around 9000 BC, just centuries after the end of the last Ice Age. It has become world famous in the archaeological world due to the preservation of artefacts found buried deep in the peat.
Learn moreLife beside the lake wins the prestigious award for 2020. Read more at the Current Archaeology website.
Two volumes are available to buy or download from the White Rose Press.
More newsWatch videos of the excavations, and see the team talk about the site and finds.
WatchView 3D models of the famous antler frontlets.
ViewAntler frontlets are exhibited in a number of museums (Scarborough Rotunda, Museum of Archaeology and Anthropology Cambridge, The British Museum). The Yorkshire Museum also has an exhibition featuring Star Carr. You can find out more on the Exhibitions page.
Our new book, "Star Carr: Life in Britain after the Ice Age" (which was nominated for Book of the Year) is now available to buy from retailers at RRP £13.
A collection of resources for teachers has been developed as part of the POSTGLACIAL project, based on the Mesolithic site of Star Carr.
Created by public archaeology expert Don Henson, these resources are designed to encourage children to develop and express their own ideas about the period.
For more information, visit the Schools page.
Learn moreUnfortunately not! The site is active farmland, and nothing of the original site or excavations remain above ground. You can learn about the site in museum exhibitions.
More FAQsIf you cannot find the answer to your question within this website, please contact .
Watch the team talk about the exciting discovery of a unique shale pendant.
More videos


EastEnders fans convinced Sharon will have Lisa sectioned to hide her baby secret
Lisa's final goodbye?
by Entertainment DailyFans of EastEnders think they know how Sharon Mitchell will get out of Lisa Fowler telling Phil the baby isn't his - and it's cruel.
On Thursday night's episode Sharon panicked when Lisa accused her of murdering Mel to keep her from telling Phil that he isn't the father.
Of course viewers know he isn't the father - Keanu is - but Lisa doesn't know that and so made this accusation in front of Phil, Louise and Keanu.
She said: "Is that Mel's blood on your hands? Mel followed you to the airport to tell Phil, didn't she?
Read more: EastEnders fans pay tribute to 'iconic' Mel Owen after she dies in horrific accident
"You killed her.

Read more: EastEnders fans beg for Slaters to be killed off like the Owen family
They are convinced Sharon is going to use Lisa's mental health issues against her and have her sectioned.
One said: "Sharon will convince everyone that’s Lisa’s losing it again and try and get her sectioned again. #Eastenders @bbceastenders".
A second said: "She's gonna get Lisa sectioned 🙈🙈🙈🙈 #EastEnders".
Fans fears could be well founded after all Sharon is going to have to go to extreme lengths to keep her and Keanu's secret before it explodes on Christmas Day.

"And what I like about it is all of the fall out, if I asked you to guess the fall out now, you wouldn't guess what we've got."
Exciting!
What do you think will happen at Christmas? Leave us a comment on our Facebook page @EntertainmentDailyFix and let us know what you think!


Object-Oriented Code
DASH is written in an object-oriented programming (OOP) style, which allows the toolbox to be separated into different components. DASH users do not need to be familiar with OOP to use the toolbox. However, we use a few OOP terms throughout the tutorial, and so we define them here. We also introduce dot-indexing, which is how DASH users will access different functions in the toolbox. A glossary of new vocabulary is provided at the bottom of the page.
Learning Objectives
Define classes and objects, and
Introduce dot-indexing
Classes
The DASH toolbox is written in an object-oriented style. This means that the toolbox is divided into components called classes. A class is a piece of code that describes a specialized structure - this structure will have some data fields, and also some functions that operate using those data fields. The data fields are known as properties, and the functions are known as methods.
For example, DASH includes a kalmanFilter
class, which helps implement the Kalman filter algorithm. This class has various data fields (properties), such as the ensemble prior and the observations / proxy records. The class also includes various functions (methods) that help to run an ensemble Kalman filter. For example, the kalmanFilter
class includes a localize
method, which implements covariance localization, and a run
method, which runs the Kalman filter algorithm.
Objects
An object is a specific instance of a class. Essentially, a class is the blueprint of a structure, and an object is the actual structure itself. To create an object for a particular class, you usually use a function that matches the name of the class. The output of the function is the object. For example, to create a kalmanFilter
object, you would use:
myObject = kalmanFilter;
The output myObject
is an object that implements the Kalman filter algorithm.
It’s important to note that you can create multiple different objects of the same class. These different objects can hold different values in their data fields. For example, to create objects for two separate assimilations, you could do:
object1 = kalmanFilter('Experiment 1');
object2 = kalmanFilter('Experiment 2');
Here, objects 1 and 2 could hold data values for two different experiments, and could run the Kalman filter algorithm using different experimental parameters.
Dot Indexing
Dot indexing provides a way for users to:
Access an object’s data fields, and
Call object methods
To use dot indexing in a script or console, place a dot .
immediately after the object. To return a data field for the object, place the name of the data field after the dot. For example, the kalmanFilter
class has a data field named label
, which stores an optional label for a kalmanFilter
object. Continuing the previous examples, you can return the label for object 1 using:
object1.label
"Experiment 1"
Similarly, you can return the label for object 2 using:
object2.label
"Experiment 2"
To call one of the object’s methods, place the name of the method after the dot. For example, to run the Kalman filter algorithm for experiment 1, you would do:
object1.run
Remember that methods are essentially functions. Aside from the dot indexing, they use the standard function syntax – so you can pass additional input arguments to the method using parentheses. For example, if you wanted to run experiment 1 with some extra options, you could do:
object1.run("Option A", 'some parameter', "Option B", 5)
Note
These options are just for demonstration purposes. They aren’t real options for kalmanFilter.run
.
Glossary
class: Describes a specialized structure that has both data fields and functions that operate using those data fields.
property: A data field in a class.
method: A function for a class.
object: A specific instance of a class. Different objects of the same class can have different values in their data fields.
dot-indexing: Using a dot . to access the data fields and functions of an object