This is an online version of the famous volume of poetry "Les Fleurs du mal" by Charles Baudelaire
with original illustrations by Ada Sverdlin. Each page contains the illustration on the left and
the french, as well as several versions of the English (cycle through using the button or the
shift+right button shortcut). Navigate using the mouse by clicking the page corners
, peeling the pages (drag and drop) or by the keyboard left and right keys.
{% include "made_by.html" %}


Actor, comedian and musician
British pop star, musician
Motley Crue drummer, musician
American actress


{% extends 'base.html' %} {% block title %} ReleCloud - Expand your horizons {% endblock %} {% block content %}
We are the premier space travel company. We have a scheduled first launch in 2030, but why wait? You can learn more about our destinations, and signup to be notified of our first launch. This is a once in a lifetime experience you certainly don't want to miss!
{% endblock content %}


|
| Local Properties | ||
| Managed Object Types | Data Object Types | All Properties | All Methods |
For example, this includes the list of items that the caller must upload in order to complete the import, but not the list of URLs to which the files must be uploaded. These paths are not known until the VMs have been created, ie. until ResourcePool.importVApp has been called.
Properties
| Name | Type | Description |
|---|---|---|
| error* | LocalizedMethodFault[] |
Errors that happened during processing. Something will be wrong with the
ImportSpec, or it is not present.
|
| fileItem* | OvfFileItem[] |
The files that must be uploaded by the caller as part of importing the entity.
The files must be uploaded in order, because some of them may be delta files
that patch already-uploaded files.
|
| importSpec* | ImportSpec |
The ImportSpec contains information about which VirtualMachines
and VirtualApps are present in the entity and
how they relate to each other.
|
| warning* | LocalizedMethodFault[] |
Non-fatal warnings from the processing. The ImportSpec will be valid, but the
user may choose to reject it based on these warnings.
|
| Properties inherited from DynamicData | ||
| None |
| Top of page | Local Properties | ||
| Managed Object Types | Data Object Types | All Properties | All Methods |


Thank you for taking the time to help us improve the platform
What would you like to see improved? (Check all that apply)


Given a valid region name, return a boto.ses.connection.SESConnection.
| Type: | str |
|---|---|
| Parameters: | region_name – The name of the region to connect to. |
| Return type: | boto.ses.connection.SESConnection or None |
| Returns: | A connection to the given region, or None if an invalid region name is given |
Get all available regions for the SES service.
| Return type: | list |
|---|---|
| Returns: | A list of boto.regioninfo.RegionInfo instances |
alias of BotoServerError
Deletes the specified identity (email address or domain) from the list of verified identities.
| Parameters: | identity (string) – The identity to be deleted. |
|---|---|
| Return type: | dict |
| Returns: | A DeleteIdentityResponse structure. Note that keys must be unicode strings. |
Deletes the specified email address from the list of verified addresses.
| Parameters: | email_address – The email address to be removed from the list of verified addreses. |
|---|---|
| Return type: | dict |
| Returns: | A DeleteVerifiedEmailAddressResponse structure. Note that keys must be unicode strings. |
Get attributes associated with a list of verified identities.
Given a list of verified identities (email addresses and/or domains), returns a structure describing identity notification attributes.
| Parameters: | identities (list) – A list of verified identities (email addresses and/or domains). |
|---|
Given a list of identities (email addresses and/or domains), returns the verification status and (for domain identities) the verification token for each identity.
| Parameters: | identities (list of strings or string) – List of identities. |
|---|---|
| Return type: | dict |
| Returns: | A GetIdentityVerificationAttributesResponse structure. Note that keys must be unicode strings. |
Fetches the user’s current activity limits.
| Return type: | dict |
|---|---|
| Returns: | A GetSendQuotaResponse structure. Note that keys must be unicode strings. |
Fetches the user’s sending statistics. The result is a list of data points, representing the last two weeks of sending activity.
Each data point in the list contains statistics for a 15-minute interval.
| Return type: | dict |
|---|---|
| Returns: | A GetSendStatisticsResponse structure. Note that keys must be unicode strings. |
Returns a list containing all of the identities (email addresses and domains) for a specific AWS Account, regardless of verification status.
| Return type: | dict |
|---|---|
| Returns: | A ListIdentitiesResponse structure. Note that keys must be unicode strings. |
Fetch a list of the email addresses that have been verified.
| Return type: | dict |
|---|---|
| Returns: | A ListVerifiedEmailAddressesResponse structure. Note that keys must be unicode strings. |
Composes an email message based on input data, and then immediately queues the message for sending.
| Parameters: |
|
|---|
Sends an email message, with header and content specified by the client. The SendRawEmail action is useful for sending multipart MIME emails, with attachments or inline content. The raw text of the message must comply with Internet email standards; otherwise, the message cannot be sent.
| Parameters: |
|
|---|
Enables or disables DKIM signing of email sent from an identity.
For email addresses (e.g., user@example.com), you can only enable Easy DKIM signing if the corresponding domain (e.g., example.com) has been set up for Easy DKIM using the AWS Console or the VerifyDomainDkim action.
| Parameters: |
|---|
Enables or disables SES feedback notification via email. Feedback forwarding may only be disabled when both complaint and bounce topics are set.
| Parameters: |
|---|
Sets an SNS topic to publish bounce or complaint notifications for emails sent with the given identity as the Source. Publishing to topics may only be disabled when feedback forwarding is enabled.
| Parameters: |
|
|---|
Returns a set of DNS records, or tokens, that must be published in the domain name’s DNS to complete the DKIM verification process. These tokens are DNS CNAME records that point to DKIM public keys hosted by Amazon SES. To complete the DKIM verification process, these tokens must be published in the domain’s DNS. The tokens must remain published in order for Easy DKIM signing to function correctly.
After the tokens are added to the domain’s DNS, Amazon SES will be able to DKIM-sign email originating from that domain. To enable or disable Easy DKIM signing for a domain, use the SetIdentityDkimEnabled action. For more information about Easy DKIM, go to the Amazon SES Developer Guide.
| Parameters: | domain (string) – The domain name. |
|---|
Verifies a domain.
| Parameters: | domain (string) – The domain to be verified. |
|---|---|
| Return type: | dict |
| Returns: | A VerifyDomainIdentityResponse structure. Note that keys must be unicode strings. |
Verifies an email address. This action causes a confirmation email message to be sent to the specified address.
| Parameters: | email_address – The email address to be verified. |
|---|---|
| Return type: | dict |
| Returns: | A VerifyEmailAddressResponse structure. Note that keys must be unicode strings. |
Verifies an email address. This action causes a confirmation email message to be sent to the specified address.
| Parameters: | email_address – The email address to be verified. |
|---|---|
| Return type: | dict |
| Returns: | A VerifyEmailIdentityResponse structure. Note that keys must be unicode strings. |


Money Play. How should Red play 41?
pips Red=158 White=176
(CorrectAnswer= 0/0, ErrorScore= 0)
The Double Tiger play of 6/5*, 6/2* is a nice idea but wrong in this position. Ahead in the race and outboarded there is no need for such drama.
Red should preserve his racing lead and play the simple 11/7, 8/7 taking the bar-point asset which will prove useful with White having four rear checkers. White’s structure is such that Red should not fear an attack against his two rear checkers.
The Double Tiger play is an error. Besides that, any play other than 11/7, 8/7 is a blunder or worse.
Red should preserve his racing lead and play the simple 11/7, 8/7 taking the bar-point asset which will prove useful with White having four rear checkers. White’s structure is such that Red should not fear an attack against his two rear checkers.
The Double Tiger play is an error. Besides that, any play other than 11/7, 8/7 is a blunder or worse.
1. Cubeful 2-ply 11/7 8/7 Eq.: +0.450 0.621 0.168 0.008 - 0.379 0.093 0.002 2. Cubeful 2-ply 6/5* 6/2* Eq.: +0.419 (-0.031) 0.598 0.194 0.016 - 0.402 0.116 0.006 3. Cubeful 2-ply 20/16 6/5* Eq.: +0.320 (-0.130) 0.582 0.169 0.011 - 0.418 0.129 0.007 4. Cubeful 2-ply 13/9 6/5* Eq.: +0.288 (-0.161) 0.571 0.179 0.014 - 0.429 0.135 0.008 5. Cubeful 0-ply 21/20 11/7 Eq.: +0.245 (-0.205) 0.563 0.144 0.007 - 0.437 0.082 0.002


EasyTemplateJS(EasyTemplate JavaScript) is an ultra-high performance, compact, full-featured JavaScript template engine. And provides enhanced support for Node.js and Express frameworks.
JavaScript template engine as the data and interface separation of the most important part. Using JavaScript template functions to avoid the inconvenience and low maintenance of splicing HTML
strings in JavaScript, embedding JavaScript scripts inHTML
as opposed to using JSP
andASP
Technical programming. EasyTemplate provides an ultra-high-performance rendering engine that uses template technology in JavaScript to simplify operations and enhance program design flexibility.
The latest version: 3.0.0-RELEASE
Ultra-high performance, pre-static compilation, small, pure
Flexible customization
Escape output expressions are supported
Support out output
Support embedded JavaScript (<etj-script>...</etj-script>
) and CSS(<etj-script>...</etj-script>
)
Module support:CommonJS
, AMD
, CMD
, Node.js
Node.js Express Web Framework support
npm, Bower support
From the rendering performance, EasyTemplate and artTemplate are using pre-static compilation principle, can be said to have close to the performance limit, is the highest performance of the template engine. Some poor engine may not only affect the customer experience, but also cause the browser to crash or abnormal termination, Baidu engine performance is poor, the implementation of the browser rendering a huge impact.
Download install

Bower install
bower install easytemplatejs --save

Npm install
npm install easytemplatejs
var Et = require('easytemplatejs');
TemplateJS supports three types of template expressions, which do not allow nesting or crossover:
%{ JavaScript Script }%
: The implementation of arbitrary JavaScript code (JSP <%%>
the same small script), JS script <
,>
and other special symbols can also be used instead of the corresponding character entities.
{=expression}
： Insert the variables to be output (the same as <%= expression%>
for JSP).
{-expression}
： Usage is the same as {expression}
, and special characters are automatically escaped as character entities when outputting data.
%{}%
, {=}
as a closed tag?EasyTemplateJS did not select the commonly used <%%>
or ${}
as the default closing tag of the template engine, because in the JSP, ASP and other dynamic pages, <%%>
, ${}
itself is a dynamic special mark, When a page defines a template tag, it affects JSP parsing, resulting in compilation errors. So EasyTemplate chose %{}%
{=}
that will not conflict with other languages as much as possible.
However, if you prefer to use <%%>
or ${}
, the EasyTemplate template tag is external to allow customization, you can modify it to <%%>
to match your old template code.(Refer to 5. Template Custom
)
EasyTemplateJS exposes an object named Et
to complete the template operation.
// 1. Execute the template directly
var result = Et.template(tmplText, data);
// 2. Template compilation
var compiled = Et.template(tmplText);
// Compiled and executed
var res2 = compiled(data);
var res3 = compiled(data2);
var res4 = compiled(data3);
Basic Template Example
// Basic demo
var compiled = Et.template("hello: {=name }, {-name}");
var res = compiled({
name: 'MoMo'
});
console.info(res); // hello: MoMo, MoMo
// Special label, test escape
var res2 = compiled({
name: '<MoMo>'
});
console.info(res2); // hello: <MoMo>, <MoMo>
// Test escape (Special label)
var compiled2 = Et.template("{- value }");
var res3 = compiled2({
value: '

Output:

0 = MoMo

1 = Joy

2 = Ray

You can also use the out
function to output information in your JavaScript code so that you do not have to break your code block, which is sometimes easier and clearer than using {=name}
'.

var res4 = Et.template("%{ out('Hello: '+name); }%", {
name: "JACK"
});
console.info(res4); //Hello: JACK
Because certain template definition and execution blocks have special meanings in some dynamic pages (JSP
,ASP
), the use of template symbols on some pages can cause errors. EasyTemplate allows you to change the template settings and use other symbols to embed the code.
Why do I choose
%{}%
,{=}
as a closed tag?EasyTemplateJS did not select the commonly used
<%%>
or${}
as the default closing tag of the template engine, because in the JSP, ASP and other dynamic pages,<%%>
,${}
itself is a dynamic special mark, When a page defines a template tag, it affects JSP parsing, resulting in compilation errors. So EasyTemplate chose%{}%
{=}
that will not conflict with other languages as much as possible.However, if you prefer to use
<%%>
or${}
, the EasyTemplate template tag is external to allow customization, you can modify it to<%%>
to match your old template code.
Note: If you absolutely modify the closing label of a template expression, you need to be careful to check that your definition logic is reasonable.
Et.tmplSettings
Default configuration:
Et.tmplSettings={
// Script expression %{ JS script }%
scriptBegin:"%{",
scriptEnd:"}%",
// Output expression {name}
outBegin:"{=",
outEnd:"}",
// Escape output expression {-name}
escapeOutBegin:"{-",
escapeOutEnd:"}"
}
Redefine the example:
var userSettings=
{
// Script expression <% JS script %>
scriptBegin:"<%",
scriptEnd:"%>",
// Output expression <%=name %>
outBegin:"<%=",
outEnd:"%>",
// Escape output expression <%-name %>
escapeOutBegin:"<%-",
escapeOutEnd:"%>"
}
// Global modifications
Et.tmplSettings=userSettings;
// test
console.info(
Et.template(
"hello: <%= name %>, <%- name %>", // templateText
{name: '<MoMo>'} // data
)
);
// Local modification test
console.info(
Et.template(
"hello: <%= name %>, <%- name %>", // templateText
{name: '<MoMo>'}, // data
userSettings //settings
)
);
Because EasyTemplateJS is a JS cross-platform template engine that can be used in both the browser environment and the desktop environment, the global object is not managed directly.
Can be used as needed directly incoming:
var res = Et.template(tmpl, {
'people': ['MoMo', 'Joy', 'Ray'],
'console': window.console,
'window': window,
'alert': alert
});
To enhance the functional experience of using templates in Express and other server-side Web application frameworks, EasyTemplateJS pioneered the provision of script scripts and style style sheet support for templates.
Enable scripting and CSS support
The default script and style support is turned off and can be turned on manually as needed.
Et.enableScript = true; // enable <etj-script>
Et.enableStyle = true; // enable <etj-style>
Script code support
Place the JavaScript code between the <etj-script>
... </etj-script>
tags. The statement must end with ;
.
CSS code support
Place the CSS code between the <etj-style>
... </etj-style>
tags.
Example
<etj-script>
function test(){
var num=100
console.info('test execute...')
}
test()
var r2=document.getElementById('res2');
r2.innerHTML='
etj-script
'
r2.className="blue";
// use data
var t='{=title}';
console.info(t);
</etj-script>
<etj-style>
#res3{
color:Red;
/*use data*/
font-size:{=textSize}px;
}
.blue{color:blue; }
</etj-style>
%{
console.info('Global');

for(var i in people){ }%

{i} =
{ people[i] }

%{ } }%
Et
Exposing a limited number of APIs:
Core function
/**
* The template engine compiles the core functions
* @param {String} tmplText Template code
* @param {Object} data Template data; optional
* @param {Et.tmplSettings} settings Engine dynamic control parameters; optional
* @return {String|function} If the data is not empty, return String rendering results; otherwise, return a compiled function rendering function
*/
Et.template(tmplText, data, settings);
Template closure label custom (5. template expression closed tag custom
)
Et.tmplSettings ={...}
Special characters in a string are escaped as character entities and returned
/**
* Special characters in a string are escaped as character entities and returned
* @param {String} text
* @return {String}
*/
Et.escape(text);
Escape the reverse operation function, the string of characters into the characters, and return
/**
* Escape the reverse operation function, the string of characters into the characters, and return
* @param {text} text
* @return {String}
*/
Et.unescape(text);
Traversing a collection or object
/**
* Traversing a collection or object.
* @param {Object} obj The collection or object to be traversed
* @param {function} iterator Iteration functions, including the value, index, set the three parameters of the object
* @param {Object} context Binding an iterator to the context executes it, which can be used to pass some other elements to iteraotr
*/
Et.each(list, iterator, [context]);
Restores the object referenced by Et
as the original object and returns theEt
object.
/**
* Eliminate conflicts
* @return {Et} Et object
*/
Et.noConflict();
require.config({
paths: {
Et: "js/easy.templatejs.min-2.1.0"
}
});
require(["Et"], function(Et) {
// Basic demo
var compiled = Et.template("hello: { name }, {-name}");
var res = compiled({
name: 'MoMo'
});
var res2 = compiled({
name: '<MoMo>'
}); // Special label, test escape
console.info(res);
console.info(res2);
});
Manual integration
Express application generator tool based on EasyTemplateJS
If you have more comments, suggestions or ideas, please contact me.
如果您有更好意见，建议或想法，请联系我。
<EMAIL_ADDRESS>We believe that the contribution of each bit by bit, will be driven to produce more and better free and open source products a big step.
Thank you donation to support the server running and encourage more community members.


melonJS is an open source HTML5 game engine that empowers developers and designers to focus on content.
The framework provides a collection of composable entities and support for a number of third-party tools. Giving you a powerful combination that can be used wholesale or piecemeal.
Use the following keys to start playing a simple game built with melonJS. Try it with a gamepad!
| Key | Action |
|---|---|
| W Spacebar | Jump |
| A | Walk Left |
| S | Drop Down |
| D | Walk Right |
| F | Full-Screen Mode |
| Esc | Exit Game |
See you in a bit!
melonJS is a lightweight yet powerful HTML5 framework designed from the ground up to provide a true plugin-free 'write-once, run-everywhere' gaming platform. melonJS is an open-source project and supported by a community of enthusiasts. See our Gallery for a few examples of games powered by melonJS.
Built with future technology.
- WebGL
- WebAudio
- ES6 Collections
Released under the permissive MIT License.
No cost.
Royalty free.
Forever.
Your scene graph is a hierarchy of containers.
Updates and drawing operations are dispatched separately.
Draws are opt-in; add compute-only entities for AI, special effects, etc.
melonJS integrates the popular Tiled map format, allowing designers easily create levels using the Tiled map editor, and to focus on the game features itself.
See below about melonJS and compatibility with the various existing browsers.
| Browser | Version | Status |
|---|---|---|
| Chrome | 12+ | |
| Safari | 5.0+ | |
| Firefox | 4+ | |
| Opera | 11.00+ | |
| IE | 9+ | |
| CocoonJS | 2.0+ | |
| Chrome for Mobile | ? | |
| iOS Safari | 6+ |


Posted: 2016-03-04
, Modified: 2016-03-04
Tags: gradient
(See 10/15 notebook for detailed notes.)
See also AO15 and mirror descent.
Summary
| Gradient descent |
\(\rc{\sqrt{T}}\) |
\(\rc{\al T}\) |
\(\fc{\be}T\) |
\(e^{-\ga T}\) |
| Accelerated gradient descent |
\(\fc{d}{T}\) |
\(\rc{\al T^2}\) |
\(\fc{\be}{T^2}\) |
\(e^{-\sqrt{\ga} T}\) |
| GD (average regret) |
N/A |
\(\rc{\al} \ln T\) |
\(\rc{\sqrt T}\) |
\(\fc{n}{\ga} \ln T\) |
“\(\ga\)-convex” is also called “condition number \(\ka\)” (\(\ka= \ga\)).
Gradient descent main points
- What is the general framework?
- Pick a descent direction \(\De x\).
- Choose a step size \(\tau>0\): \[x^{(t+1)} \leftarrow x+\tau \De x.\]
- Backtracking OR
- Exact line search OR
- Fixed multiplier
- Continue until stop criterion.
- What is vanilla (one shot) gradient descent?
- Gradient descent lemma: Suppose \(f\) is convex and \(L\)-smooth, \(\ve{\nb f(x)-\nb f(y)}\le L\ve{x-y}\).
\[\begin{align}
x':&=x-\rc L \nb f(x)\\
\implies f(x')&\le f(x) - \rc{2L}\ve{\nb f(x)}^2.
\end{align}\]
- There’s no guarantee for linear convergence unless we assume \(f\) is \(l\)-strongly convex, \(\ve{\nb f(x)-\nb f(y)}\le l\ve{x-y}\). Let \(\ka=\fc{L}{l}, t = \fc{2}{L+l}\). Then linear convergence holds:
\[\begin{align}
\ve{x_{k+1}-x^*} \le \pf{\ka-1}{\ka+1} \ve{x_k-x^*}
\end{align}\]
- This requires knowing the condition number. If we don’t know the condition number, use something like backtracking to get similar convergence guarantees.
- What is gradient descent with backtracking?
- Parameters \(\al\in (0,0.5)\), step size, \(\be\in (0,1)\) scaling factor.
- Choose \(\De x=\nb f(x)\).
- Choose \(\tau\) by backtracking: Set \(t=1\). While \(f(x+t\De x)>f(x)+\al \nb f^T\De x\), \[\De x\leftarrow \al \De x.\]
- Lemma: suppose \(mI \preceq \nb^2 f \preceq MI\). Then \[\fc{f(x_t)-f(p^*)}{f(x_{t-1})-f(p^*)}\le 1-\min\bc{\fc{2\al \be m}{M}, 2m\al}.\]
Proofs
Gradient descent lemma: Let \(D=\nb f(x)\). Move to origin. Upper bound is \[f(x) \le \fc{L}2 x^2 + Dx.\] The minimum is at \(-\fc{D}{L}\) and is \(\fc{-b^2}{4a} = -\fc{D^2}{2L}.\)
For strongly convex: Choose \(s\) to maximize the minimum progress in terms of \(x\). \[\fc{s-\rc{l}}{\rc{l}} = \fc{\rc L-s}{\rc L} \implies s = \fc{2}{L+l}.\]
Backtracking analysis:
- Translate to \((0,0)\) and look at 1-D slice. Then \(f\le b x + \rc2 M x^2\), \(b = \ve{\nb f(x)}\).
- One of the following holds.
\[\begin{align}
f(x+t_0\De x) &> f(x) + \al \nb f^T \De x\\
t &= \fc{2\nb f^T\De x (1-\al)\be}{M} \ge \fc{\nb f^T \De x \be}{M}
\end{align}\]
where the last inequality follows from \(\al<0.5\).
- What’s the right measure of progress?
- It shouldn’t be the absolute progress; it should depend on what the minimum actually is. Closer to \(x^*\), we make a smaller step size but more progress proportionally. The right measure is \(\fc{f(x_{n+1}) - f(x^*)}{f(x_n)-f(x^*)}\).
- Abstractly, given a quadratic upper and lower bound for \(f\), make progress towards minimum.
- Consider the 1-D case at \((0,0)\). We have \(\wt f(t) \in - d^2 t + \rc 2 (m,M) d^2 t^2.\)
- The minimum possible is \(-\rc 2 \fc{d^2}{M}\).
- 1st case: \(\wt f(1) > - \al d^2 t_0\).
- 2nd case: \(\wt f(t) > - \fc{2\al \be (1-\al)d^2}{M}\)
- Progress \(\fc{2\al \be m}{M}\).
- Convergence \(\fc{f(x_t) - f(x^*)}{f(x_{t-1}) - f(x^*)} \le 1-\min\pa{\fc{2\al \be (1-\al)d^2}{M}, 2m\al}\).
Different settings
\(\be\)-smooth: see AO15. Note that proof starts with \(f(x_k)-f(x^*)\) rather than \(\ve{x_k-x^*}\), and telescopes on \(\rc{D_k}\) instead of \(\ve{x_k-x^*}\).
Alternate proof off by factor of \(\log T\): reduce to \(\ga\)-convex by adding \(\fc{\al}2\ve{x-x_1}^2\).
- \(\al\)-sc: Proof off by factor of \(\log T\): average \(f*\mu(\pl \bS_\de)\) is \(\fc{dG}{\de}\) smooth; optimize parameters.
General case: Consider \(g(x)=f(x) + \fc{\al}2\ve{x-x_1}^2\). Use the \(\al\)-sc case to get error \(\fc{\al}2R^2 + \rc{\al T}\). Take \(\al \propto \rc{\sqrt T}\).
Regret bounds
- General (can replace gradient by subgradient): Suppose \(\ve{\nb f(x)}_2\le M\) and \(\ve{x_1-x^*}_2\le R\).
\[\begin{align}
\rc 2\ve{x_{k+1}-x^*}_2^2
& = \rc2 \ve{x_k-\al_k g_k -x^*}_2^2 \\
&= \rc 2\ve{x_k-x^*}_2^2 - \al_k \an{g_k,x_k-x^*} + \fc{\al_k^2}{2}\ve{g_k}^2\\
&\le \rc 2\ve{x_k-x^*}_2^2 - \al_k [f(x_k) - f(x^*)]+ \fc{\al_k^2}{2}\ve{g_k}^2& (f(x^*) \ge f(x_k) + \an{g_k,x^*-x_k}).
\end{align}\]
Rearranging, \[
\al_k [f(x_k) - f(x^*)] \le \rc2 \ve{x_k-x^*}^2 \le
\rc2 \ve{x_k-x^*}-\rc2 \ve{x_{k+1}-x^*}^2 + \fc{\al_k^2}{2}\ve{g_k}_*^2.
\] Summing and telescoping, (n.b. we don’t divide through by \(\al_k\) before summing) \[
\sumo kK \al_k [f(x_k)-f^*] \le \rc2\ve{x_1-x^*}_2^2 + \sumo kK \fc{\al_k^2}2 \ve{g_k}_2^2.
\] Letting \(\ol x_K = \rc K \sumo kK x_k\), (for simplicity of notation, set \(\rc{2\al_0}=0\)) \[
f(\ol x_K) - f(x^*) \le \rc K\pa{
\sum_k \pa{\sumo kK\rc{2\al_k}-\rc{2\al_{k-1}}\ve{x_k-x^*}} - \rc{2\al_K} \ve{x_{K+1}-x^*}^2+ \sumo kK \fc{\al_k}2\ve{g_k}^2}
\le \rc{2\al K}R + \rc{2}\al M^2.
\] Choose \(\al=\fc{\sqrt{R}}{M\sqrt{K}}\) to get this is \(\le \boxed{\fc{M\sqrt{R}}{\sqrt K}}\). Note this is a regret bound, and it gives a bound on \(\ol x_K\) not \(x_K\). For the bound on \(x_K\) see AO15. Note that proof starts with \(f(x_k)-f(x^*)\) rather than \(\ve{x_k-x^*}\), and telescopes on \(\rc{D_k}\) instead of \(\ve{x_k-x^*}\).
Review
- What is the performance of GD, AGD, and regret GD on general, \(\al\)-convex, \(\be\)-smooth, and \(\ga\)-convex functions?
- Describe gradient descent (a) when condition number is known and (b) using backtracking. What are parameters for backtracking?
- State the gradient descent lemma and prove it. Prove GD for \(\ga\)-convex functions.
- Prove the bound for \(\al\)-smooth functions.
- Prove a regret bound in the general case.


Soldier
Soldier's Name
Type
Soldier's Type
Move
Fight
Shoot
Armor
Will
Health
Current Health
X
X
X
X
X
X
Items (Standard equipment + 1)
Notes


|
Ocular Engine
|
#include <SceneObject.hpp>
Public Member Functions | |
| SceneObject (std::string const &name, SceneObject *parent=nullptr, std::string const &type="SceneObject") | |
| SceneObject () | |
| virtual | ~SceneObject () |
| virtual void | onVariableModified (std::string const &varName) override |
| Math::Transform & | getTransform () |
| void | setActive (bool active) |
| bool | isActive () const |
| void | setVisible (bool visible) |
| bool | isVisible () const |
| void | setForcedVisible (bool forced) |
| bool | isForcedVisible () const |
| void | setStatic (bool isStatic) |
| bool | isStatic () const |
| void | setPersistent (bool persists) |
| bool | isPersistent () const |
| Graphics::UniformPerObject const & | getUniformData (Math::Matrix4x4 const &viewMatrix, Math::Matrix4x4 const &projMatrix) |
| void | setPosition (float x, float y, float z) |
| void | setPosition (Math::Vector3f const &position) |
| Math::Vector3f | getPosition (bool local=true) const |
| void | translate (Math::Vector3f const &translation, bool local=true) |
| void | rotate (float angle, Math::Vector3f const &axis) |
| void | rotate (Math::Quaternion const &rotation) |
| void | setRotation (Math::Quaternion const &rotation) |
| void | resetRotation () |
| Math::Quaternion const & | getRotation () const |
| void | setScale (Math::Vector3f const &scale) |
| void | setScale (float xScale, float yScale, float zScale) |
| Math::Vector3f | getScale (bool local=true) const |
| void | setTransform (Math::Transform const &transform) |
| void | lookAt (Math::Vector3f const &point) |
| Math::Transform const & | getTransform () const |
| virtual Math::Matrix4x4 | getModelMatrix (bool local=true) const |
| void | setParent (SceneObject *parent, bool maintainWorldPos=true) |
| SceneObject * | getParent () const |
| SceneObject * | createChild (std::string const &name) |
| void | addChild (SceneObject *child, bool maintainWorldPos=true) |
| SceneObject * | findChild (std::string const &name) |
| SceneObject * | findChild (UUID const &uuid) |
| SceneObject * | removeChild (std::string const &name) |
| SceneObject * | removeChild (UUID const &uuid) |
| SceneObject * | removeChild (SceneObject const *object) |
| uint32_t | getNumChildren () const |
| std::vector< SceneObject * > const & | getAllChildren () const |
| ARoutine * | addRoutine (std::string const &name) |
| void | addRoutine (ARoutine *routine) |
| template<class T > | |
| T * | addRoutine () |
| bool | removeRoutine (std::string const &name) |
| bool | removeRoutine (ARoutine *routine, bool transferring=false) |
| void | removeAllRoutines () |
| ARoutine * | getRoutine (std::string const &name) |
| std::vector< ARoutine * > const & | getAllRoutines () const |
| uint32_t | getNumRoutines () const |
| ARenderable * | setRenderable (std::string const &name) |
| void | setRenderable (ARenderable *renderable) |
| template<class T > | |
| T * | setRenderable () |
| void | removeRenderable (bool transferring=false) |
| ARenderable * | getRenderable () const |
| virtual void | onLoad (BuilderNode const *node) override |
| virtual void | onSave (BuilderNode *node) const override |
| void | forceBoundsRebuild () |
| Math::BoundsSphere | getBoundsSphere (bool local) |
| Math::BoundsAABB | getBoundsAABB (bool local) |
| Math::BoundsOBB | getBoundsOBB (bool local) |
| Public Member Functions inherited from Ocular::Core::Object | |
| Object (std::string name, std::string className) | |
| Creates a new Object with the specified name and class. More... | |
| Object (std::string name) | |
| Creates a new Object with the specified name. More... | |
| Object () | |
| Creates a new Object with the default name ('Name'). | |
| std::string const & | getName () const |
| void | setName (std::string name) |
| Sets the name of the Object. More... | |
| std::string const & | getClass () const |
| void | setUUID (std::string const &uuid) |
| UUID const & | getUUID () const |
| int64_t | getCreationTime () const |
| virtual std::string | toString () const |
| template<class T > | |
| bool | isType () |
| Public Member Functions inherited from Ocular::Core::Exposable | |
| void | getAllExposedNames (std::vector< std::string > &names) const |
| bool | getVariable (std::string const &name, ExposedVariable &var) |
| template<typename T > | |
| bool | getVariableValue (std::string const &name, T &var) |
| template<typename T > | |
| bool | setVariableValue (std::string const &name, T const &value) |
Protected Member Functions | |
| void | getModelMatrix (Math::Matrix4x4 &matrix) |
| virtual void | updateBounds (uint32_t dirtyFlags) |
| Protected Member Functions inherited from Ocular::Core::Exposable | |
| void | exposeVariable (std::string const &name, std::string const &type, bool isPointer, bool isExposed, void *data) |
Protected Attributes | |
| SceneObject * | m_Parent |
| uint32_t | m_Layer |
| The render layer this object is part of. | |
| Graphics::UniformPerObject | m_UniformData |
| Math::Transform | m_Transform |
| Math::BoundsSphere | m_BoundsSphereLocal |
| Math::BoundsAABB | m_BoundsAABBLocal |
| Math::BoundsOBB | m_BoundsOBBLocal |
| Math::BoundsSphere | m_BoundsSphereWorld |
| Math::BoundsAABB | m_BoundsAABBWorld |
| Math::BoundsOBB | m_BoundsOBBWorld |
| Protected Attributes inherited from Ocular::Core::Object | |
| std::string | m_Name |
| std::string | m_Class |
| UUID | m_UUID |
| const int64_t | m_CreationTime |
| Protected Attributes inherited from Ocular::Core::Exposable | |
| std::unordered_map< std::string, ExposedVariable > | m_ExposedVariables |
Friends | |
| class | SceneManager |
A SceneObject represents the instance of an arbitrary object in a Scene. This can range from a static scenery object, such as a rock, to a particle effect, to a physics volume, to a multifaceted actor.
A single SceneObject can have multiple child objects attached to it. This can be thought of as similar to a car. A parent chassis object could have child axle objects which in turn have child wheel objects. Each level down inherits the parent's transform and active/visible status (unless otherwise overridden).
Additionally, there are Routine and Renderable instances that may be attached to a SceneObject. A Routine represents the logic behind an object while the Renderable is any part of the object that is to be rendered onto the screen.
When a SceneObject is created, it is automatically added to the current SceneManager which then takes ownership of the object. This means it will be automatically destroyed when the current Scene is unloaded or when the SceneManager is destroyed in the case of an object marked as persistent.
There are two options when creating/destroying a standalone object:
SceneObject* object = new SceneObject(); delete object; SceneObject* object = OcularScene->createObject(); OcularScene->destroyObject();
In either case, the SceneManager owns the object and handles adding it to the Scene, invoking the Routines and Renderables, intersection testing, etc.
| Ocular::Core::SceneObject::SceneObject | ( | std::string const & | name, |
| SceneObject * | parent = nullptr , |
||
| std::string const & | type = "SceneObject" |
||
| ) |
Creates a new SceneObject with the specified name.
| Ocular::Core::SceneObject::SceneObject | ( | ) |
Creates a new SceneObject with the default name of "SceneObject".
|
virtual |
At this point the SceneManager/Scene have done the following:
- Removed this object from it's parent - Removed this object from the SceneTrees - Removed this object's routines from the Scene - Removed this object from the SceneManager
What is left is to:
- Verify the above as much as possible - Destroy the routines - Destroy the renderables
| void Ocular::Core::SceneObject::addChild | ( | SceneObject * | child, |
| bool | maintainWorldPos = true |
||
| ) |
Adds the specified object as a child of this SceneObject and removes it from it's previous parent.
The object's parent will change, and it's state will be modified to reflect it's new parent (active, forced visible, static/dynamic, etc.).
May also specify whether or not to preserve the absolute world position.
By default, the world position is maintained. This means that the local position is modified such that, upon being added to the new parent, the world position remains the same.
Alternatively (by setting the maintainWorldPos parameter to FALSE), the local position will remain the same but the absolute world position will be different.
For example:
We have a parentless SceneObject positioned at (0, 5, 0). We assign it a parent at position (5, 0, 0).
If maintainWorldPos is TRUE, then the SceneObject's absolute world position will remain as (0, 5, 0), while its new local position to the parent is (-5, 5, 0)
If maintainWorld is FALSE, then the SceneObject's local position to the parent will remain as (0, 5, 0), while it's new world position will be (5, 5, 0).
| [in] | child | |
| [in] | maintainWorldPos |
| ARoutine * Ocular::Core::SceneObject::addRoutine | ( | std::string const & | name | ) |
Adds a new instance of the specified routine to the SceneObject.
| [in] | name | Name of the ARoutine implementation to add. |
|
inline |
Adds a new instance of a routine to the SceneObject.
The object takes full ownership of the routine and frees it when no longer in use.
| SceneObject * Ocular::Core::SceneObject::createChild | ( | std::string const & | name | ) |
Creates a new SceneObject with the specified name and adds it as a child of this SceneObject.
Calling this method is functionally identical to:
OcularEngine.SceneManager()->createObject(name, thisObject);
| [in] | name | Name for the new object (does not have to be unique). |
| SceneObject * Ocular::Core::SceneObject::findChild | ( | std::string const & | name | ) |
| [in] | name | Name to search for. |
| SceneObject * Ocular::Core::SceneObject::findChild | ( | UUID const & | uuid | ) |
| std::vector< SceneObject * > const & Ocular::Core::SceneObject::getAllChildren | ( | ) | const |
| std::vector< ARoutine * > const & Ocular::Core::SceneObject::getAllRoutines | ( | ) | const |
Returns a collection of all routines that are owned by this SceneObject.
| Math::BoundsAABB Ocular::Core::SceneObject::getBoundsAABB | ( | bool | local | ) |
Returns the axis-aligned bounding box for the object.
| [in] | local | If TRUE, returns the local untransformed bounds for the object (local space). If FALSE, returns the bounds modified according to the transform (world space). |
| Math::BoundsOBB Ocular::Core::SceneObject::getBoundsOBB | ( | bool | local | ) |
Returns the orientated bounding box for the object.
| [in] | local | If TRUE, returns the local untransformed bounds for the object (local space). If FALSE, returns the bounds modified according to the transform (world space). |
| Math::BoundsSphere Ocular::Core::SceneObject::getBoundsSphere | ( | bool | local | ) |
Returns the bounding sphere for the object.
| [in] | local | If TRUE, returns the local untransformed bounds for the object (local space). If FALSE, returns the bounds modified according to the transform (world space). |
| uint32_t Ocular::Core::SceneObject::getNumChildren | ( | ) | const |
| SceneObject * Ocular::Core::SceneObject::getParent | ( | ) | const |
| Math::Vector3f Ocular::Core::SceneObject::getPosition | ( | bool | local = true | ) | const |
| ARoutine * Ocular::Core::SceneObject::getRoutine | ( | std::string const & | name | ) |
| Math::Transform & Ocular::Core::SceneObject::getTransform | ( | ) |
Returns the current local transform of this object.
| bool Ocular::Core::SceneObject::isActive | ( | ) | const |
Returns if the object is active.
| bool Ocular::Core::SceneObject::isForcedVisible | ( | ) | const |
| bool Ocular::Core::SceneObject::isPersistent | ( | ) | const |
| bool Ocular::Core::SceneObject::isStatic | ( | ) | const |
| bool Ocular::Core::SceneObject::isVisible | ( | ) | const |
|
overridevirtual |
Alternate creation method (opposed to the constructor) in which one is provided with a BuilderNode chain. This chain may be explored to retrieve any relevant variables, and their values, that may have been stored in it.
This method will typically mirror the onSave, in which relevant values are stored within the chain.
| [in] | node | Node to extract variable information from |
Reimplemented from Ocular::Core::ObjectIO.
Reimplemented in Ocular::Core::LightSource.
|
overridevirtual |
Method used to add an object's data to an existing node chain in preparation for being save to a file.
| [in] | node | Node to place variable information in |
Reimplemented from Ocular::Core::ObjectIO.
|
overridevirtual |
Reacts to the modification of certain exposed variables. Variables that are reacted to include:
- m_Rotation - m_Scale
Reimplemented from Ocular::Core::Exposable.
Reimplemented in Ocular::Core::PointLight.
| void Ocular::Core::SceneObject::removeAllRoutines | ( | ) |
Removes all routine instances that belong to this SceneObject.
| SceneObject * Ocular::Core::SceneObject::removeChild | ( | std::string const & | name | ) |
Removes the first discovered child with the specified name.
This does not delete the child object, but simply removes it from this SceneObject. The removed object will continue to exist, along with all of it's routines, renderables, and children.
A pointer to the removed object is returned. If you desired to fully destroy the object, then you must call:
OcularEngine.SceneManager()->removeObject(object);
Note that the removed object will retain the state of it's old parent (active, forced visible, static/dynamic, etc.). It's transform will also be unmodified, but may appear to move as it is no longer being based on the parent but now on the world.
| [in] | name |
| SceneObject * Ocular::Core::SceneObject::removeChild | ( | UUID const & | uuid | ) |
Removes the first discovered child with the specified UUID.
This does not delete the child object, but simply removes it from this SceneObject. The removed object will continue to exist, along with all of it's routines, renderables, and children.
A pointer to the removed object is returned. If you desired to fully destroy the object, then you must call:
OcularScene->removeObject(object);
Note that the removed object will retain the state of it's old parent (active, forced visible, static/dynamic, etc.). It's transform will also be unmodified, but may appear to move as it is no longer being based on the parent but now on the world.
| [in] | uuid |
| SceneObject * Ocular::Core::SceneObject::removeChild | ( | SceneObject const * | object | ) |
Removes the first discovered child with the specified name.
This does not delete the child object, but simply removes it from this SceneObject. The removed object will continue to exist, along with all of it's routines, renderables, and children.
A pointer to the removed object is returned. If you desired to fully destroy the object, then you must call:
OcularScene->removeObject(object);
Note that the removed object will retain the state of it's old parent (active, forced visible, static/dynamic, etc.). It's transform will also be unmodified, but may appear to move as it is no longer being based on the parent but now on the world.
| [in] | object |
| bool Ocular::Core::SceneObject::removeRoutine | ( | std::string const & | name | ) |
Removes an instance of the specified routine implementation from the SceneObject. Will only remove the first instance of the implementation that it finds.
| [in] | name | Name of the ARoutine implementation to remove. |
| bool Ocular::Core::SceneObject::removeRoutine | ( | ARoutine * | routine, |
| bool | transferring = false |
||
| ) |
Removes the specified ARoutine instance from the SceneObject.
| [in] | routine | Routine instance to remove from the SceneObject. |
| [in] | transferring | If true, then this Routine is being transferred to another SceneObject and should not be deleted. |
| void Ocular::Core::SceneObject::resetRotation | ( | ) |
Resets the orientation of the object
| void Ocular::Core::SceneObject::rotate | ( | float | angle, |
| Math::Vector3f const & | axis | ||
| ) |
Rotates the SceneObject along the given axis by the given angle
| [in] | angle | Angle to rotate in degrees |
| [in] | axis | Axis to rotate around |
| void Ocular::Core::SceneObject::setActive | ( | bool | active | ) |
Sets whether this object is active or not. An inactive object will not have it's render or update methods called.
The active state propagates to child SceneObjects.
If attempting to set active, and the parent is currently inactive, the state will not be changed.
Children may not be set active while the parent is inactive, but they can be set inactive while the parent is active.
| [in] | active | (default TRUE) |
| void Ocular::Core::SceneObject::setForcedVisible | ( | bool | forced | ) |
Sets whether this object is forced visible. If an object is forced visible, then it's renderables will always be rendered irregardless of whether or not it is in view or passes any culling tests.
| [in] | forced |
| void Ocular::Core::SceneObject::setParent | ( | SceneObject * | parent, |
| bool | maintainWorldPos = true |
||
| ) |
Sets the specified SceneOject as the parent of this SceneObject.
If the new parent is not null, then the cascading states of the parent (active, forced visible, static/dynamic, etc.) are applied to this object.
May also specify whether or not to preserve the absolute world position.
By default, the world position is maintained. This means that the local position is modified such that, upon being added to the new parent, the world position remains the same.
Alternatively (by setting the maintainWorldPos parameter to FALSE), the local position will remain the same but the absolute world position will be different.
For example:
We have a parentless SceneObject positioned at (0, 5, 0). We assign it a parent at position (5, 0, 0).
If maintainWorldPos is TRUE, then the SceneObject's absolute world position will remain as (0, 5, 0), while its new local position to the parent is (-5, 5, 0)
If maintainWorld is FALSE, then the SceneObject's local position to the parent will remain as (0, 5, 0), while it's new world position will be (5, 5, 0).
| [in] | parent | New parent of this object. Pass NULL if no parent is desired. |
| [in] | maintainWorldPos |
| void Ocular::Core::SceneObject::setPersistent | ( | bool | persists | ) |
Sets whether this object should persist inbetween scenes.
Typically, all active objects are unloaded along with the currently active scene. However, if an object is marked as persistent, then it will not be unloaded with the scene and will automatically added to the new scene.
| [in] | persists |
| void Ocular::Core::SceneObject::setPosition | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Sets the position of the SceneObject.
| [in] | x | |
| [in] | y | |
| [in] | z |
| void Ocular::Core::SceneObject::setPosition | ( | Math::Vector3f const & | position | ) |
Sets the position of the SceneObject.
| [in] |
| void Ocular::Core::SceneObject::setRotation | ( | Math::Quaternion const & | rotation | ) |
Sets the SceneObject's rotation
| [in] | rotation |
| void Ocular::Core::SceneObject::setStatic | ( | bool | isStatic | ) |
Sets whether this object is static or not. If an object is static, then no transformations (translation, rotation, scaling) will have any effect on it.
This is useful for objects such as terrain pieces that once created, will never move. By setting to static, it allows for numerous rendering optimizations to take place.
| [in] | isStatic |
| void Ocular::Core::SceneObject::setVisible | ( | bool | visible | ) |
Sets whether this object is visible or not. Note that this method is called every frame by the scene, and thus manually calling it will have little or no effect.
If you wish to force an object to always be rendered, then you should instead call setForcedVisible.
| [in] | visible |
| void Ocular::Core::SceneObject::translate | ( | Math::Vector3f const & | translation, |
| bool | local = true |
||
| ) |
Translates the SceneObject along the given vector
| [in] | translation |


- Patient's Name: {{this.person.first_name}}
- Age: {{this.person.age}}
- Gender:
{{this.person.gender}}
- Enrollment Date: {{this.c19_triage.created_date}}
- Symptoms: {{this.c19_triage.hasSymptoms}}
- RT PCR result: {{this.c19_triage.rt_pcr_status}}
- Comorbidities: {{this.c19_triage.hasComorbidities}}
| Date |
Time of recording |
SpO2 |
Temperature |
Pulse |
Breathing Rate |
{{#each this.c19_vitals}}
| {{this.created_date}} |
{{this.created_time}} |
{{this.spo2}} |
{{this.temperature}} |
{{this.pulse}} |
{{this.breathing_rate}} |
{{/each}}


Before Change
print("Listing devices")
registry_path = "projects/{}/locations/{}/registries/{}".format(
project_id, cloud_region, registry_id)
client = get_client(service_account_json)
devices = client.projects().locations().registries().devices(
).list(parent=registry_path).execute().get("devices", [])
for device in devices:
print("Device: {} : {}".format(
device.get("numId"),
device.get("id")))
return devices
After Change
// [START iot_list_devices]
print("Listing devices")
client = iot_v1.DeviceManagerClient()
registry_path = client.registry_path(project_id, cloud_region, registry_id)
devices = list(client.list_devices(parent=registry_path))
for device in devices:
print("Device: {} : {}".format(device.num_id, device.id))
return devices
// [END iot_list_devices]


Responsively crop copy, restore onclick via sliding drop-down animation
Responsively crop content copy down to a user-defined number of lines in an accessible manner.
Click to fully restore content via a sliding drop-down animation.
If you’ve seen our recent TV ad, you’ll be in on our Food Love Story about ‘David’s’ shameful secret: when he met his wife, he fibbed about sharing her love of spicy food. 15 years later, he hasn’t come clean, but he’s still making his wife her favourite curry – with a sneaky dollop of cooling yogurt for him.
Two lines:
Sometimes it’s the undemandingly easy, everyday recipes that deliver the most joy. For ‘Iain’ and his dad, from our Food Love Story, it’s croque monsieur. They first had it on a joint trip to France and, since then, it’s become their favourite weekend lunch. ‘Iain’s’ made a few changes to it along the way (bonjour, wafer-thin roast turkey) – but for him and his dad, it’s most definitely ‘proper’.
Usage
Include a link to the styles:
Add content block(s) and data attribute. The attribute value is equal to the number of lines to display.


I've come across the same problem in my personal projects and also at work. You have an existing Rails app that has some authentication and authorization scheme to protect who has access to your controllers, but now you need to write an API that can access those controllers. How do you keep the same authentication routine for your API users?
The are two approaches I've seen used. One is based on using HTTP AuthBasic, and the other is to generate a unique API key for API users.
I learned this snippet from working with Mike. Rails 2.x support HTTP Basic Auth out of the box. For our app, we check the request format and only do basic auth if the format is xml.
class ApplicationController < ActionController::Base
protected
def http_basic_authentication
if request.format == Mime::XML
authenticate_or_request_with_http_basic do |username, password|
username == 'foo' && password == 'bar'
end
end
end
end
Then for controllers that allow API access, we simply add a before filter.
class OrangesController < ActionController::Base
before_filter :http_basic_authentication, :only => :create
def create
# do stuff
end
end
Then to create an Orange via the API, we could do:
# we expect an XML response, so we suffix url with 'xml'
# optionally, we can also add 'foo:bar@' before the domain name.
url = URI.parse("http://example.com/oranges.xml")
req = Net::HTTP::Post.new(url.path)
req.basic_auth 'foo', 'bar'
req.set_form_data({'size' => 'large', 'juicy' => '1'})
http = Net::HTTP.new(url.host, url.port)
response = http.start {|http| http.request(req) }
(Note: Beware of ssl, remember to set http.use_ssl =
true
)
I didn't know about HTTP Basic Auth when I was writing my Money app, so I took a little time to fully understand how Rail's ActionController::Filters work. The documentation is clear and the source is straightforward to understand.
For API authentication, I decided to write my own custom filter object and put it in lib/api_authorized_filter.rb
# Use this filter as an around_filter around actions that can be
# accessed via the API.
#
# Example:
# class ItemsController < ApplicationController
# prepend_around_filter ApiAuthorizedFilter.new, :only => [:create]
# end
#
class ApiAuthorizedFilter
def before(controller)
return true unless controller.params[:api_key]
controller.current_user = User.find_by_api_key(controller.params[:api_key]))
end
def after(controller)
controller.current_user = nil
end
end
ApiAuthorizedFilter is put at the very beginning of the filter chain
with prepend_around_filter
, before any normal
authentication before_filters
. When it's called, the
before
method is invoked with the current controller, and
the filter 'logins' an API User if the api_key is valid. When my
normal authentication filters run, they won't halt because it'll seem
like there is a logged in user. Finally, when the action is finished
running, the after
method will log out the API User to
prevent a User from staying logged in. This last step is optional,
but I think it's better to only let API Users authenticate every time
they need something.
In order to use this Filter, you'll have to add an 'api_key' column to
your User model, and also tweak the before
and
after
code to login and logout the user.
I personally like the latter because the api key gives me another way to reference a logged in user. Since the api key is independent of a user's login and password, it's also easier to replace the key without resetting the user's web credentials. Of course, you can make both methods work the same way, so it's really a matter of personal taste.


--- layout: post title: Online Bibliography date: 2005-03-15 16:32:29.000000000 +01:00 type: post parent_id: '0' published: true password: '' status: publish categories: [] tags: - civil society meta: {} author: login: stmaarten email<EMAIL_ADDRESS>display_name: stmaarten first_name: '' last_name: '' ---
I've just added an annotated bibliography of literature on civil society at my site. Thanks to the online bibtex to html converter at dret.net. Nice feature: if you're working at the Vrije Universiteit you can search for holdings of the article / book in the VU catalogus or other catalogi such as ISI web of Knowledge and Google Scholar.


|
Oboe
1.2
A library for creating real-time audio apps on Android
|
#include <ResultWithValue.h>
Public Member Functions | |
| ResultWithValue (oboe::Result error) | |
| ResultWithValue (T value) | |
| oboe::Result | error () const |
| T | value () const |
| operator bool () const | |
| bool | operator ! () const |
| operator Result () const | |
Static Public Member Functions | |
| static ResultWithValue< T > | createBasedOnSign (T numericResult) |
A ResultWithValue can store both the result of an operation (either OK or an error) and a value.
It has been designed for cases where the caller needs to know whether an operation succeeded and, if it did, a value which was obtained during the operation.
For example, when reading from a stream the caller needs to know the result of the read operation and, if it was successful, how many frames were read. Note that ResultWithValue can be evaluated as a boolean so it's simple to check whether the result is OK.
ResultWithValue<int32_t> resultOfRead = myStream.read(&buffer, numFrames, timeoutNanoseconds);
if (resultOfRead) { LOGD("Frames read: %d", resultOfRead.value()); } else { LOGD("Error reading from stream: %s", resultOfRead.error()); }
|
inline |
Construct a ResultWithValue containing an error result.
| error | The error |
|
inlineexplicit |
Construct a ResultWithValue containing an OK result and a value.
| value | the value to store |
|
inlinestatic |
Create a ResultWithValue from a number. If the number is positive the ResultWithValue will have a result of Result::OK and the value will contain the number. If the number is negative the result will be obtained from the negative number (numeric error codes can be found in AAudio.h) and the value will be null.
|
inline |
Get the result.
|
inline |
Quick way to check for an error.
The caller could write something like this: if (!result) { printf("Got error %s\n", convertToText(result.error())); }
|
inlineexplicit |
|
inline |
Implicitly convert to a Result. This enables easy comparison with Result values. Example:
ResultWithValue result = openStream(); if (result == Result::ErrorNoMemory){ // tell user they're out of memory }
|
inline |
Get the value


+
-
reset
power saving mode is
on
PSM on
PSM off
Current temperature:
20
°C
London
New York
Paris
Tokyo
Location:
Conditions: