PROUD MOMENT
Motherwell star Gallagher almost cried knowing family watched him play for Scotland
by David FrielTHE Tartan Army have been in tears watching Scotland recently.
Declan Gallagher felt like crying as he prepared to play for his country.
The Motherwell defender opened up on his long-awaited Scotland debut in Cyprus.
Gallagher, 28, was overcome with emotion as his proud family watched on at the GSP stadium in Nicosia.
The former Celtic kid is a late developer and admits pulling on the Scotland strip meant everything to him.

“They’d been over since Monday so it was like a holiday for them. It was good they were there to see me get my first cap.
“I said to my wife that it was special. I texted her saying I felt like crying knowing that her and my little girl were there to see me get my first cap.
“It was amazing. My mum and dad were over in Russia too when I was in the squad. They go everywhere, they never miss a game.
“They were happy going with the Tartan Army into Moscow and just basically drank a few bars dry.
“They were happy with that but it’s definitely a reward that they got to see me play in Cyprus.
“It’s a big achievement for me and my family because they are the rock behind me. It was great as much for them as it was for me.
“There was also a wee round of applause at the end of the game back in the dressing room.
“The boys gave a round of applause for Steven Naismith getting 50 caps and for me getting my first. It was a special moment for me.”
Gallagher has had a long road to the Scotland squad, coming through dark times in his personal life.
He was jailed for assault in 2015 and has previously thanked Livingston for standing by him.
Playing for Scotland would have seemed a dream back then but he has managed to rebuild his career.
Now he wants to cement his place in the national side, just like his early mentors at Celtic did.
He said: “I looked up to the likes of Gary Caldwell and Stephen McManus, they were absolutely excellent.
“I was in the youth team at Celtic when I was watching them. I saw them in training and it was great.
“I want to be like that, be in the Scotland set-up all the time and hopefully I’ve done enough to do that. I owe thanks to everybody that has worked with me.
“Livingston were a big part of it and Stephen Robinson has pushed me massively. He’s pushed me on and off the park and he is always pushing me in the press.
“I owe a massive thanks to him and the backroom staff at Motherwell because they push me non-stop.
“They probably deserve as much credit as I do for getting into the Scotland squad.”
Gallagher got the nod ahead of Mikey Devlin and Ryan Porteous to play beside Scott McKenna.
He thanked Steve Clarke for showing faith in him and hopes to keep his place for the clash with Kazakhstan.
He said: “Once I got my breath, I enjoyed it. I found out I was starting the night before the game.
“We had a team meeting and the gaffer likes to prepare the boys.
“It’s just to get any nervousness out of your head so you know you’re playing and you can focus on your game.
 If you aren’t nervous it means you have no emotions.
“It’s a European qualifier and my first cap so it’s a big moment in my career.
“It’s good to be nervous at the start, but as soon as the whistle goes that all goes out the window and you focus on the game.
“All I can do is take my chance and hopefully I’ve done enough to get another cap.
"But there are a lot of good players out injured just now and a lot of good players in the squad so I just have to keep doing well.
“Cyprus played some good football but I felt we were comfortable. I was delighted with the win on my debut.
“It’s up to the manager what he does on Tuesday. He might want to freshen it up. I just need to keep working hard in training and see where it takes us.”
Gallagher will head back to Motherwell later this week and hopes boss Robinson will be there to greet him.
The Fir Park gaffer remains in the frame for the Hearts and Northern Ireland jobs but the Scotland man doesn’t want to lose him.
He said: “I’ve texted him a few things, saying ‘don’t think you’re going anywhere’ and stuff like that.
“To be fair, he deserves it. He’s an incredible manager and for me one of the best in Scotland.
“His attention to detail is magnificent and he deserves to go to the very top.
“Now I’ve been there and done it he is going to push me to stay there and keep going up and up. Hopefully that’s what I can do.”


Several years ago I became aware of which is called the convex regular 4-polytopes - basically four-dimensional analogs of the Platonic solids. At that time I did not fully understand the mathematics, but wanted to revisit the topic at a later time.


| Enum Constant and Description |
|---|
CRASHED
Indicates the application has CRASHED.
|
DISPOSED
Indicates the application has been shutdown.
|
INITIALIZATION
Indicates the application has not done anything.
|
MAINLOOP
Indicates the application has started the main loop.
|
NETWORKING
Indicates the application has started the networking (UDP in particular) and is waiting on the cluster.
|
RELOAD
Indicates the application is reloading.
|
SHUTDOWN
Indicates the application is preparing to shutdown.
|
STARTED
Indicates the application has started.
|
STARTUP
Indicates the application has started all managers and dispatchers then loads plugins.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkRunlevelOrder(Runlevel currentRunlevel)
Checks the RunLevel was called in proper order.
|
int |
intValue() |
static Runlevel |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Runlevel[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Runlevel INITIALIZATION
public static final Runlevel STARTUP
public static final Runlevel MAINLOOP
public static final Runlevel NETWORKING
public static final Runlevel STARTED
public static final Runlevel RELOAD
public static final Runlevel SHUTDOWN
public static final Runlevel DISPOSED
public static final Runlevel CRASHED
public static Runlevel[] values()
for (Runlevel c : Runlevel.values()) System.out.println(c);
public static Runlevel valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic boolean checkRunlevelOrder(Runlevel currentRunlevel)
currentRunlevel
- The current Runlevelpublic int intValue()


{% extends 'base.html' %} {% block head %} {% endblock %} {% block body %}
Two Letter Words (with hooks)


Reflecting Objects: Which objects in the scene explain the radio frequency spectrum?
Crossmodal Self-supervised Learning
I am working in the area of applied self-supervised Deep Learning, a subfield within the ever so growing domain of artificial intelligence.
Why radar matters
Radar offers many key advantages for modern autonomous vehicles. Particularly in adverse weather or compromised environment conditions does radar exhibit invaluable properties. When cameras and Lidar fails, radar still provides reliable estimates of obstables in the systems field of view.
Radar offers complementary features to camera systems
The need for annotation-free algorithms
In many areas of application, labelled data is scarce to come by or virtually infeasible to obtain due to financial constraints and/or time limitations. Manual human-in-the-loop approaches in which highly-trained individuals highlight relevant properties within the input data trying to capture their essence are error-prone and deprive the neural algorithms of the chance to find inherent patterns buried within the data.
Annotating raw sensor data is cost-intensive and time-consuming
Not only will a human being inevitably make mistakes in annotating streams of data by hand, it also influences the subsequent methods by introducing human biases thus steering the algorithm in a certain direction from the very beginning.
Finally there is the financial aspectg. Most companies and research facilities cannot afford to pay millions to employ an armada of experts to annotate plethora of data points.
The outlined problems necessitate a more natural approach in which the neural network is tasked with finding interesting properties and complex correlations within the data by itself without relying on predefined target specifications.
Relying on raw sensor data
There is yet another problem in using high-level annotated data as input to neural machines, namely the exclusion of vital and possibly valuable information. According to information theory special care has to be taken in order to avoid equivocation, i.e. the outflow of potentially essential knowledge by capturing the data as close to the respective sensor as possible.
This allows to retain a maximum of information which otherwise would have been either altered or discarded altogether by subsequent steps along the individual sensor processing chain.
Minimal processing of data retains valuable information
Only a minimum of preprocessing is performed on the data to retain as much information as possible inherent in the signals
Crossmodal correspondence learning
The basic idea is to employ time-synchronized streams of two orthogonal sensor types then use one modality to supervise the other and vice versa. This allows for the mathematically consistent formulation of an auxiliary task which is attempted to be solved by the neural network in order to facilitate backpropagation and enable the learning process.
The network is presented with temporally aligned and misaligned pairs of camera and radar samples alternatingly. Upon transformation by means of two individual encoder blocks, it then tries to bring matching samples closer to each other in the high-dimensional embedding space, whereas the distance between disparate sample pairs is to be increased simultaneously. This causes the network to learn semantically meaningful representations of one and the same real-world scene originating from orthogonal physical measurement principles.
The ultimate goal is to reveal areas within the camera image which are most likely to be the source of electromagnetic reflections thus establishing a close correspondence between both modalities which can then be used further for safety-relevant applications downstream.


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Duration predictor related modules."""
import torch
from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
[docs]class DurationPredictor(torch.nn.Module):
"""Duration predictor module.
This is a module of duration predictor described in `FastSpeech: Fast, Robust and Controllable Text to Speech`_.
The duration predictor predicts a duration of each frame in log domain from the hidden embeddings of encoder.
.. _`FastSpeech: Fast, Robust and Controllable Text to Speech`:
https://arxiv.org/pdf/1905.09263.pdf
Note:
The calculation domain of outputs is different between in `forward` and in `inference`. In `forward`,
the outputs are calculated in log domain but in `inference`, those are calculated in linear domain.
"""
def __init__(self, idim, n_layers=2, n_chans=384, kernel_size=3, dropout_rate=0.1, offset=1.0):
"""Initilize duration predictor module.
Args:
idim (int): Input dimension.
n_layers (int, optional): Number of convolutional layers.
n_chans (int, optional): Number of channels of convolutional layers.
kernel_size (int, optional): Kernel size of convolutional layers.
dropout_rate (float, optional): Dropout rate.
offset (float, optional): Offset value to avoid nan in log domain.
"""
super(DurationPredictor, self).__init__()
self.offset = offset
self.conv = torch.nn.ModuleList()
for idx in range(n_layers):
in_chans = idim if idx == 0 else n_chans
self.conv += [torch.nn.Sequential(
torch.nn.Conv1d(in_chans, n_chans, kernel_size, stride=1, padding=(kernel_size - 1) // 2),
torch.nn.ReLU(),
LayerNorm(n_chans, dim=1),
torch.nn.Dropout(dropout_rate)
)]
self.linear = torch.nn.Linear(n_chans, 1)
def _forward(self, xs, x_masks=None, is_inference=False):
xs = xs.transpose(1, -1) # (B, idim, Tmax)
for f in self.conv:
xs = f(xs) # (B, C, Tmax)
# NOTE: calculate in log domain
xs = self.linear(xs.transpose(1, -1)).squeeze(-1) # (B, Tmax)
if is_inference:
# NOTE: calculate in linear domain
xs = torch.clamp(torch.round(xs.exp() - self.offset), min=0).long() # avoid negative value
if x_masks is not None:
xs = xs.masked_fill(x_masks, 0.0)
return xs
[docs] def forward(self, xs, x_masks=None):
"""Calculate forward propagation.
Args:
xs (Tensor): Batch of input sequences (B, Tmax, idim).
x_masks (ByteTensor, optional): Batch of masks indicating padded part (B, Tmax).
Returns:
Tensor: Batch of predicted durations in log domain (B, Tmax).
"""
return self._forward(xs, x_masks, False)
[docs] def inference(self, xs, x_masks=None):
"""Inference duration.
Args:
xs (Tensor): Batch of input sequences (B, Tmax, idim).
x_masks (ByteTensor, optional): Batch of masks indicating padded part (B, Tmax).
Returns:
LongTensor: Batch of predicted durations in linear domain (B, Tmax).
"""
return self._forward(xs, x_masks, True)
[docs]class DurationPredictorLoss(torch.nn.Module):
"""Loss function module for duration predictor.
The loss value is Calculated in log domain to make it Gaussian.
"""
def __init__(self, offset=1.0, reduction="mean"):
"""Initilize duration predictor loss module.
Args:
offset (float, optional): Offset value to avoid nan in log domain.
reduction (str): Reduction type in loss calculation.
"""
super(DurationPredictorLoss, self).__init__()
self.criterion = torch.nn.MSELoss(reduction=reduction)
self.offset = offset
[docs] def forward(self, outputs, targets):
"""Calculate forward propagation.
Args:
outputs (Tensor): Batch of prediction durations in log domain (B, T)
targets (LongTensor): Batch of groundtruth durations in linear domain (B, T)
Returns:
Tensor: Mean squared error loss value.
Note:
`outputs` is in log domain but `targets` is in linear domain.
"""
# NOTE: outputs is in log domain while targets in linear
targets = torch.log(targets.float() + self.offset)
loss = self.criterion(outputs, targets)
return loss


| Home | Libraries | People | FAQ | More |
The performance of Boost.Regex in both recursive and non-recursive modes
should be broadly comparable to other regular expression libraries: recursive
mode is slightly faster (especially where memory allocation requires thread
synchronisation), but not by much. The following pages compare Boost.Regex
with various other regular expression libraries for the following compilers:
Boost.Regex 递归和非递归模式的性能可以和其它任何正则表达式库比较：递归模式相对较快(尤其当内存分配需要线程同步时)，但不会快很多。
后面几页比较 Boost.Regex 和其它几个正则表达式库在下面编译器上的性能：


@remarks
IsNullOrWhiteSpace is a convenience method that is similar to the following code, except that it offers better performance:
Len(CorString.Trim(s)) = 0
White-space characters are defined by the Unicode standard. The IsNullOrWhiteSpace method interprets any character that returns a value of true when it is passed to the Char.IsWhiteSpace method as a white-space character.
Public Sub Main() Dim Values() As String Dim Value As Variant Values = NewStrings(vbNullString, "", "ABCDE", Space$(20), t(" \t "), String$(&H2000, 10)) For Each Value In Values Console.WriteLine CorString.IsNullOrWhiteSpace(CStr(Value)) Next Console.ReadKey ' The example displays the following output: ' True ' True ' False ' True ' True ' True End Sub


I do a lot of things, kind of hard to sum it up breifly.
I started taking coding seriously with web development around 14 months ago, and found myself migrating to back end nodejs and php, I now focus mainly on Java, Python, and the GNU toolkit for Linux/BSD.


{{ data }} {% for method in methods %}
{{ method }}
{% endfor %}
Headers (in JSON, except Content-Type: application/json)


The ZerodhaBrokerageModel uses the SecurityMarginModel. If you have a margin account, the ZerodhaBrokerageModel allows up to 5x leverage.
ZerodhaBrokerageModel
SecurityMarginModel


Cranky Critic® movie reviews: Blue Streak Rated PG-13, 93 minutes Starring Martin Lawrence, Luke Wilson, Peter Greene, Dave Chappelle and William Forsythe Written by Michael Berry & John Blumenthal and Steve Carpenter Directed by Les Mayfield website: http://www.sony.com/bluestreak
IN SHORT: Fall's first popcorn flick. (and only two weeks early . . .)
So... Cranky mingles with the crowd filing in to see a sneak of Blue Streak but he's stopped at the door by a press rep demanding... "Do you need notes?" Has demographic targeting gone so far that a pale guy can't enjoy a Martin Lawrence flick? Or is it that, after five years of running the preview route, these guys have finally figured out that I'm in this end of the biz for the long run? I'll choose the latter, 'cuz Blue Streak is a decent comedy popcorn flick and good comedy knows no racial barrier. To put it another way, Blue Streak's script lingo doesn't drown you in street talk and the music to talk ratio is remarkably low, so anyone in fear of rap music or slang need not fear.
Here's what I consider interesting. The reviewers who saw Blue Streak long before me are busy making comparisons to black comedians whose shadows dominate the field. There's a longer, and sadly long forgotten shadow that Blue Streak's comedy is closer to, and those are the films of Jerry Lewis, the guy who does the MDA telethon every year. Those flicks went like this: Ordinary guy has to go to extraordinary lengths, usually involving outrageous disguises and impersonations to obtain a goal. That goal was usually a date with a girl -- it was the 50's. Considering what Lewis' stock character was, getting a date was almost as implausible as finding the Holy Grail.
In Blue Streak, ordinary guy Miles Logan (Lawrence) has to go to extraordinary lengths, including one outrageous costume and one major impersonation to obtain his heart's desire. This being the 90s, Lawrence is a hi-tech jewelry burglar who gets double crossed by one of his crew, and is forced to stash a stolen diamond worth $17 millions inside a building under construction. When Miles goes to retrieve the loot after a two year prison term, he discovers that the building houses the 37th Precinct of the LAPD. To get into the building, he tries to sneak into the building as a pizza delivery man, complete with Lewis style glasses, buck teeth and dead on Lewish shtick. It's too obvious to be anything but an homage, which is why I've spent so much time on the comparison. That attempt fails, so the only logical next step is to impersonate a cop.
Which, of course, he does brilliantly, having spent many man hours watching COPS. Yeah, I've blabbed a gag. The shtick which comes before and after is plentiful, so nothing's been ruined. The supporting cast, including Peter Greene and Dave Chapelle as the rest of the burglary crew, Luke Wilson as the traffic cop turned detective and William Forsythe as top cop is strong and though there is one point where the needs of the story force an unbelievable coincidence to occur, Blue Streak provides a fun time.
On average, a first run movie ticket will run you Eight Bucks. Were Cranky able to set his own price to Blue Streak, he would have paid...
$5.00
Dateflick level. Buy the big popcorn and settle in.
The Cranky Critic® is a Registered Trademark of, and Copyright © 1999 by, Chuck Schwartz. All Rights Reserved. Cranky on the web at www.crankycritic.com
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


Attachment object.
An Attachment object is largely interchangeable with a (filename, payload)
tuple.
Note that the behavior is a bit asymmetric with respect to unpacking and
equality comparison. An Attachment object without a content ID will be
equivalent to a (filename, payload) tuple. An Attachment with a content ID
will unpack to a (filename, payload) tuple, but will compare unequally to
that tuple.
Thus, the following comparison will succeed:
attachment = mail.Attachment('foo.jpg', 'data')
filename, payload = attachment
attachment == filename, payload
...while the following will fail:
attachment = mail.Attachment('foo.jpg', 'data', content_id='<foo>')
filename, payload = attachment
attachment == filename, payload
The following comparison will pass though:
attachment = mail.Attachment('foo.jpg', 'data', content_id='<foo>')
attachment == (attachment.filename,
attachment.payload,
attachment.content_id)
Attributes:
filename: The name of the attachment.
payload: The attachment data.
content_id: Optional. The content-id for this attachment. Keyword-only.


Check if method is an attribute method or not.
# File lib/active_model/validations.rb, line 157 def attribute_method?(attribute) method_defined?(attribute) end
Copy validators on inheritance.
# File lib/active_model/validations.rb, line 162 def inherited(base) dup = _validators.dup base._validators = dup.each { |k, v| dup[k] = v.dup } super end
Adds a validation method or block to the class. This is useful when overriding the validate instance method becomes too unwieldy and you’re looking for more descriptive declaration of your validations.
This can be done with a symbol pointing to a method:
class Comment include ActiveModel::Validations validate :must_be_friends def must_be_friends errors.add(:base, "Must be friends to leave a comment") unless commenter.friend_of?(commentee) end end
With a block which is passed with the current record to be validated:
class Comment include ActiveModel::Validations validate do |comment| comment.must_be_friends end def must_be_friends errors.add(:base, "Must be friends to leave a comment") unless commenter.friend_of?(commentee) end end
Or with a block where self points to the current record to be validated:
class Comment include ActiveModel::Validations validate do errors.add(:base, "Must be friends to leave a comment") unless commenter.friend_of?(commentee) end end
# File lib/active_model/validations.rb, line 132 def validate(*args, &block) options = args.extract_options! if options.key?(:on) options = options.dup options[:if] = Array.wrap(options[:if]) options[:if].unshift("validation_context == :#{options[:on]}") end args << options set_callback(:validate, *args, &block) end
This method is a shortcut to all default validators and any custom validator classes ending in ‘Validator’. Note that Rails default validators can be overridden inside specific classes by creating custom validator classes in their place such as PresenceValidator.
Examples of using the default rails validators:
validates :terms, :acceptance => true validates :password, :confirmation => true validates :username, :exclusion => { :in => %w(admin superuser) } validates :email, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :on => :create } validates :age, :inclusion => { :in => 0..9 } validates :first_name, :length => { :maximum => 30 } validates :age, :numericality => true validates :username, :presence => true validates :username, :uniqueness => true
The power of the validates method comes when using custom validators and default validators in one call for a given attribute e.g.
class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add attribute, (options[:message] || "is not an email") unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i end end class Person include ActiveModel::Validations attr_accessor :name, :email validates :name, :presence => true, :uniqueness => true, :length => { :maximum => 100 } validates :email, :presence => true, :email => true end
Validator classes may also exist within the class being validated allowing custom modules of validators to be included as needed e.g.
class Film include ActiveModel::Validations class TitleValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add attribute, "must start with 'the'" unless value =~ /\Athe/i end end validates :name, :title => true end
Additionally validator classes may be in another namespace and still used within any class.
validates :name, :'film/title' => true
The validators hash can also handle regular expressions, ranges, arrays and strings in shortcut form, e.g.
validates :email, :format => /@/ validates :gender, :inclusion => %w(male female) validates :password, :length => 6..20
When using shortcut form, ranges and arrays are passed to your validator’s initializer as +options+ while other types including regular expressions and strings are passed as +options+
Finally, the options :if, :unless, :on, :allow_blank, :allow_nil and :strict can be given to one specific validator, as a hash:
validates :password, :presence => { :if => :password_required? }, :confirmation => true
Or to all at the same time:
validates :password, :presence => true, :confirmation => true, :if => :password_required?
# File lib/active_model/validations/validates.rb, line 81 def validates(*attributes) defaults = attributes.extract_options! validations = defaults.slice!(*_validates_default_keys) raise ArgumentError, "You need to supply at least one attribute" if attributes.empty? raise ArgumentError, "You need to supply at least one validation" if validations.empty? defaults.merge!(:attributes => attributes) validations.each do |key, options| key = "#{key.to_s.camelize}Validator" begin validator = key.include?('::') ? key.constantize : const_get(key) rescue NameError raise ArgumentError, "Unknown validator: '#{key}'" end validates_with(validator, defaults.merge(_parse_validates_options(options))) end end
This method is used to define validation that cannot be corrected by end user and is considered exceptional. So each validator defined with bang or :strict option set to true will always raise ActiveModel::StrictValidationFailed instead of adding error when validation fails. See validates for more information about validation itself.
# File lib/active_model/validations/validates.rb, line 109 def validates!(*attributes) options = attributes.extract_options! options[:strict] = true validates(*(attributes << options)) end
Validates each attribute against a block.
class Person include ActiveModel::Validations attr_accessor :first_name, :last_name validates_each :first_name, :last_name do |record, attr, value| record.errors.add attr, 'starts with z.' if value.to_s[0] == ?z end end
Options:
:on - Specifies the context where this validation is active (e.g. :on => :create or :on => :custom_validation_context)
:allow_nil - Skip validation if attribute is nil.
:allow_blank - Skip validation if attribute is blank.
:if - Specifies a method, proc or string to call to determine if the validation should occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The method, proc or string should return or evaluate to a true or false value.
:unless - Specifies a method, proc or string to call to determine if the validation should not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The method, proc or string should return or evaluate to a true or false value.
# File lib/active_model/validations.rb, line 87 def validates_each(*attr_names, &block) options = attr_names.extract_options!.symbolize_keys validates_with BlockValidator, options.merge(:attributes => attr_names.flatten), &block end
If you pass any additional configuration options, they will be passed to the class and available as options:
class Person include ActiveModel::Validations validates_with MyValidator, :my_custom_key => "my custom value" end class MyValidator < ActiveModel::Validator def validate(record) options[:my_custom_key] # => "my custom value" end end
# File lib/active_model/validations/with.rb, line 79 def validates_with(*args, &block) options = args.extract_options! args.each do |klass| validator = klass.new(options, &block) validator.setup(self) if validator.respond_to?(:setup) if validator.respond_to?(:attributes) && !validator.attributes.empty? validator.attributes.each do |attribute| _validators[attribute.to_sym] << validator end else _validators[nil] << validator end validate(validator, options) end end
When creating custom validators, it might be useful to be able to specify additional default keys. This can be done by overwriting this method.
# File lib/active_model/validations/validates.rb, line 119 def _validates_default_keys [:if, :unless, :on, :allow_blank, :allow_nil , :strict] end
Generated with the Darkfish Rdoc Generator 2.


Welcome, this is the official IDE for the Sherwood Architecture. Click "Load Project" or "Create Project" to begin.
Click on a project to load.Projects only in are shown.


The following are examples of the kinds of plots and widgets that can be easily embedded into a website. These examples come from technologies within the SciPy/PyData world. However, the technologies not exclusive to Python.
This second example comes from the Vega package. Vega visualization can be easily created using the Altair python package. They can them be embedded into a website using the vega-embed library. Note that this plot is interactive in the sense that the hover action highlights the bar and shows a tooltip corresponding to the frequency of observations in the bin.
This next Vega plot demonstrates further interactivity. This plot is taken from the Altair gallery (see here). It demonstrates cross-highlighting. Selections in one chart affect the display of the other chart. Clicking on a bar in the histogram will select out the corresponding observations and updates the bivariate histogram on top. Clicking in the whitespace on the bottom histogram will reset the figure.
This third example is an attempt at replicating a visualization produced by The Economist (see here). This example uses the Plotly library. This library works on several platforms and languages, including Python, R, Matlab, Javascript, and others. This is a plot that I created locally and then uploaded to my account on the plotly website: plot.ly. From the plotly website, it is easy to share plots in a variety of ways. In this case, I used the share feature to export the plot to html code that references this plot saved under my plot.ly account.
Note that you can enable and disable the lines from various cities to make the graph easier to read as you explore this visualization. You can do this by clicking on the lines located in the legend of the figure. You can also isolate a single trace by double clicking it in the legend.