On Stack Safety
Stack safety is a sticky topic in Rust right now. There are multiple conflicting tensions. My goal is to lay them bare, untangle the mess, and see if there’s a better way forward (spoiler: there is!).
When a program is “stack safe”, the stack pointer never points outside of allocated memory specifically dedicated to the stack. The most interesting violation of stack safety as it applies to Rust is the stack overflow. (In fact, given safe code, or even unsafe code as long as it doesn’t putz with the stack pointer or the stack frame, it is the only possible violation of stack safety). Stack overflow happens when the stack does not have enough space to store the full stack frame.
There are three basic ways of dealing with stack overflow:
- Give up and accept the potential memory unsafety and resulting bugs.
- Do static analysis to determine the maximum stack size, and make sure that the stack is at least that large.
- Do runtime checks to make sure that there is always enough space on the stack for a function to proceed, and handle violation of that condition somehow.
(Note: in what follows, I conflate “language” with “implementation of a given language” for clarity)
Examples of languages that take strategy #1 are C, C++, Nimrod, and Objective-C. Stack overflow usually manifests as a segmentation fault or bus error, though more colorful errors are possible when a thread runs into another thread’s stack, or onto the heap, causing heap corruption or threads stomping on each others’ stack. Clearly this is not a viable solution for Rust: the very act of calling a function becomes unsafe.
Strategy #2 is tempting, but cannot be used in the general case. The research I found investigate stack depth in the case of no recursion (so the call graph is actually a call (directed-)acyclic graph) but with asynchronous interrupt handlers. Indeed, it’s trivial to show that when recursion is disallowed, a conservative stack limit can be calculated just by taking the longest path through the call graph with the nodes being weighted by the size that function’s stack frame needs (this is a slightly different construction than most weighted graphs). This solution is not viable either: recursion is perfectly valid, rejecting it would make Rust very crippled as a language. To my knowledge, no languages rely on this for stack safety, though in practice I am sure many applications apply this technique.
This leaves us with strategy #3, dynamic checks. Dynamic checking is fairly easy to do. The size of a function’s stack frame is easy to calculate. One need only increment/decrement some global (or, rather, thread-local) counter by the stack frame size. When it becomes negative, there is no more stack. Almost every language I’ve used (the exceptions are noted above) use this technique. Java, Python, Lua, Ruby, Go, the list goes on. The only differences between the languages is what they do when the stack does overflow. Most throw an exception. Another method of implementing dynamic checks is to leave a “guard zone” after the stack. This zone is mapped in a way that accessing it causes a page fault, which sends a signal or kills the process. (The exact implementation of this strategy differs; some allocate a stack frame for a function on the heap. Things get blurry with the interpreted languages, but they generally prevent stack overflow in a memory safe way.)
Rust currently uses strategy #3, with tweaks. The current implementation
heavily depends on LLVM’s segmented
stack feature. On x86
(and I assume other platforms as well), a pointer to the end of the stack is
stored in thread-local storage. The prelude to every function call compares
that value to the value of the stack pointer, and calls a special function
__morestack
which will allocate a new stack segment for the function call to
take place on. The stack segment is freed afterwards. The kink comes when
using the FFI to call C code. C assumes a single, large stack. In order to
fulfill that expectation, we have the fixed_stack_segment
attribute to
give a function a large stack segment: hopefully large enough that the C
function doesn’t overflow the stack.
Segmented stacks are of questionable utility. On large systems, such as x64, address space is practically boundless, so lazily allocating stack segments is going to be slower than just requesting a very large mmap’d stack that the OS will lazily allocate. On small, resource-constrained systems, the overhead of stack size checking (it requires TLS and stack size checks) is too much. Segmented stacks only optimize for mid-sized address spaces. And the entire purpose of segmented stacks (conservative but growable stack sizes) is moot if one is not using many tasks with small stacks. (Previously, previously)
All of the solutions so far are inadequate. They’re inflexible and have poor composability in the case where a crate wants custom stack safety. I propose a hybrid:
- If there is no recursion or other sources of stack size uncertainty, the maximum stack size is decidable and is used as the only stack size, like strategy #2. Every function would be annotated with the total stack size it could possibly use, given static function calls. This fails at the first introduction of function pointers: it is impossible to know how much stack they need until runtime. However, this is not as limiting as it may sound, as long as one only tries to achieve a conservative estimate of maximum stack size. Since function pointers only come from trait objects and closures, the compiler can take the max of the stack frame for every implemention of the trait. I would assume closures could work in a similar way, in limited cases. There will always be cases where this analysis fails.
- If the analysis in step 1 results in indeterminate stack sizes, rustc will
check a crate attribute. This crate attribute indicates which stack safety
strategy should be used: either guard zones, stack size checks, segmented
stacks, or no stack safety at all (note that stack size checks is segmented
stacks minus expanding the stack with
__morestack
). Disabling stack safety “taints” a crate, and any use of its functions requiresunsafe
, like calling C code, and they cannot be coerced to closures (this would lose the “taint” bit). Note that when the maximum stack size is decidable, this attribute won’t be checked.
All of the trickiness comes from compiling libraries with this. Executables are easy: since they define the execution context, they can decide how they want the stack to be secured. Libraries, being embedded in other contexts, need to obey their execution environment. At the very least, no-stack-safety will make it possible to implement libraries exposing a native ABI in Rust without requiring weirdness in the FFI, as well as implement custom stack safety when it’s desired.
By allowing crates to chose how they want stack safety to be implemented, we retain flexibility to fit any situation. By making it a crate attribute, we can handle combination of crates using different stack safety schemes in a sane way. There are still some niggling details with combining crates using different stack safety schemes (propagating the taint bit is quite difficult in the face of trait objects, but for now we could simply disallow combinations and work them out later (it’s a backwards compatible change). I think this is a good stack safety strategy, superior to the current one, and worth implementing.
Please email me any comments, or see the discussion on reddit.


import java.net.URI;
import java.io.File;
import java.util.Date;
@Stateful
public class MyBean {
@Resource URI blog;
@Resource Date birthday;
@Resource File homeDirectory;
}
New in OpenEJB 3.0
EJB 3.0
OpenEJB 3.0 supports the EJB 3.0 specification as well as the prior EJB 2.1, EJB 2.0, and EJB 1.1. New features in EJB 3.0 include:
-
Annotations instead of xml
-
No home interfaces
-
Business Interfaces
-
Dependency Injection
-
Intercpetors
-
Java Persistence API
-
Service Locator (ala SessionContext.lookup)
-
POJO-style beans
EJB 2.x features since OpenEJB 1.0 also include: - MessageDriven Beans - Container-Managed Persistence (CMP) 2.0 - Timers
The two aspects of EJB that OpenEJB does not yet support are: - Web Services (JAX-WS, JAX-RPC) - CORBA
JAX-WS and CORBA support will be added in future releases. Support for the JAX-RPC API is not a planned feature.
Extensions to EJB 3.0
CMP via JPA
Our CMP implementation is a thin layer over the new Java Persistence API (JPA). This means when you deploy an old style CMP 1.1 or CMP 2.1 bean it is internally converted and ran as a JPA bean. This makes it possible to use both CMP and JPA in the same application without any coherence issues that can come from using two competing persistence technologies against the same data. Everything is ultimately JPA in the end.
Extended Dependency Injection
Dependency Injection in EJB 3.0 via @Resource
is largely limited to
objects provided by the container, such as DataSources, JMS Topics and
Queues. It is possible for you to supply your own configuration
information for injection, but standard rules allow for only data of
type String, Character, Boolean, Integer, Short, Long, Double, Float and
Byte. If you needed a URL, for example, you’d have to have it injected
as a String then convert it yourself to a URL. This is just plain silly
as the conversion of Strings to other basic data types has existed in
JavaBeans long before Enterprise JavaBeans existed.
OpenEJB 3.0 supports injection of any data type for which you can supply a JavaBeans PropertyEditor. We include several built-in PropertyEditors already such as Date, InetAddress, Class, File, URL, URI, Map, List and more.
The META-INF/env-entries.properties
Along the lines of injection, one of the last remaining things in EJB 3
that people need an ejb-jar.xml file for is to supply the value of
env-entries. Env Entries are the source of data for all user supplied
data injected into your bean; the afore mentioned String, Boolean,
Integer, etc. This is a very big burden as each env-entry is going to
cost you 5 lines of xml and the complication of having to figure out how
to add you bean declaration in xml as an override of an existing bean
and not accidentally as a new bean. All this can be very painful when
all you want is to supply the value of a few @Resource
String fields in
you bean class.
To fix this, OpenEJB supports the idea of a META-INF/env-entries.properties file where we will look for the value of things that need injection that are not container controlled resources (i.e. datasources and things of that nature). You can configure you ejbs via a properties file and skip the need for an ejb-jar.xml and it’s 5 lines per property madness.
blog = http://acme.org/myblog
birthday = locale=en_US style=MEDIUM Mar 1, 1954
homeDirectory = /home/esmith/
Support for GlassFish descriptors
Unit testing EJBs with OpenEJB is a major feature and draw for people, even for people who may still use other app servers for final deployment such as Geronimo or GlassFish. The descriptor format for Geronimo is natively understood by OpenEJB as OpenEJB is the EJB Container provider for Geronimo. However, OpenEJB also supports the GlassFish descriptors so people using GlassFish as their final server can still use OpenEJB for testing EJBs via plain JUnit tests in their build and only have one set of vendor descriptors to maintain.
JavaEE 5 EAR and Application Client support
JavaEE 5 EARs and Application Clients can be deployed in addition to ejb jars. EAR support is limited to ejbs, application clients, and libraries; WAR files and RAR files will be ignored. Per the JavaEE 5 spec, the META-INF/application.xml and META-INF/application-client.xml files are optional.
Application Validation for EJB 3.0
Incorrect usage of various new aspects of EJB 3.0 are checked for and reported during the deployment process preventing strange errors and failures.
As usual validation failures (non-compliant issues with your
application) are printed out in complier-style "all-at-once" output
allowing you to see and fix all your issues in one go. For example, if
you have 10 @PersistenceContext
annotations that reference an invalid
persistence unit, you get all 10 errors on the first deploy rather
than one failure on the first deploy with 9 more failed deployments to
go.
Validation output comes in three levels. The most verbose level will tell you in detail what you did wrong, what the options are, and what to do next… even including valid code and annotation usage tailored to your app that you can copy and paste into your application. Very ideal for beginners and people using OpenEJB in a classroom setting.
Most configurable JNDI names ever
General Improvements
Online Deployment Security Service Connection Pooling ##
Configuration Overriding Flexible JNDI Name Formatting Cleaner Embedding Tomcat 6 Support Business locals remotable
If you want to make business local interfaces remotable, you can set this property:
openejb.remotable.businessLocals=true
Then you can lookup your business local interfaces from remote clients.
You’d still have to ensure that the you pass back and forth is serializable.


--- layout: post title: SOAP web service remote troubleshooting categories: [] tags: soap-ws status: publish type: post published: true meta: structured_content: '{"oembed":{},"overlay":true}' ---
While it is possible to test the web service via a browser it is only possible to do this from the actual server machine. If you are not able to connect directly to the server you may wish to use this simple app to check if the web service is actually running and that you can authenticate. You can experiment with authentication and might see an error like this:
If you connect successfully you will see a response including the connected user name, like this:
To use this test app simply:


AWS::IoTAnalytics::Pipeline
The AWS::IoTAnalytics::Pipeline resource consumes messages from one or more channels and allows
you to process the messages before storing them in a data store. You must specify both a
channel
and a datastore
activity and, optionally, as many
as 23 additional activities in the pipelineActivities
array. For more information, see
How to Use AWS IoT Analytics in the AWS IoT Analytics User Guide.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::IoTAnalytics::Pipeline", "Properties" : { "PipelineActivities" :
[ Activity, ... ]
, "PipelineName" :String
, "Tags" :[ Tag, ... ]
} }
YAML
Type: AWS::IoTAnalytics::Pipeline Properties: PipelineActivities:
- Activity
PipelineName:String
Tags:- Tag
Properties
PipelineActivities
-
A list of "PipelineActivity" objects. Activities perform transformations on your messages, such as removing, renaming or adding message attributes; filtering messages based on attribute values; invoking your Lambda functions on messages for advanced processing; or performing mathematical transformations to normalize device data.
The list can be 2-25 PipelineActivity objects and must contain both a
channel
and adatastore
activity. Each entry in the list must contain only one activity, for example:pipelineActivities = [ { "channel": { ... } }, { "lambda": { ... } }, ... ]
Required: Yes
Type: List of Activity
Maximum:
25
Update requires: No interruption
PipelineName
-
The name of the pipeline.
Required: No
Type: String
Minimum:
1
Maximum:
128
Pattern:
(^(?!_{2}))(^[a-zA-Z0-9_]+$)
Update requires: Replacement
Tags
-
Metadata which can be used to manage the pipeline.
For more information, see Tag.
Required: No
Type: List of Tag
Maximum:
50
Update requires: No interruption
Examples
Simple Pipeline
The following example creates a simple pipeline.
JSON
{ "Description": "Create a simple Pipeline", "Resources": { "Pipeline": { "Type": "AWS::IoTAnalytics::Pipeline", "Properties": { "PipelineName": "SimplePipeline", "PipelineActivities": [ { "Channel": { "Name": "ChannelActivity", "ChannelName": "SimpleChannel", "Next": "DatastoreActivity" }, "Datastore": { "Name": "DatastoreActivity", "DatastoreName": "SimpleDatastore" } } ] } } } }
YAML
--- Description: "Create a simple Pipeline" Resources: Pipeline: Type: "AWS::IoTAnalytics::Pipeline" Properties: PipelineName: "SimplePipeline" PipelineActivities: - Channel: Name: "ChannelActivity" ChannelName: "SimpleChannel" Next: "DatastoreActivity" Datastore: Name: "DatastoreActivity" DatastoreName: "SimpleDatastore"
Complex Pipeline
The following example creates a complex pipeline.
JSON
{ "Description": "Create a complex Pipeline", "Resources": { "Pipeline": { "Type": "AWS::IoTAnalytics::Pipeline", "Properties": { "PipelineName": "ComplexPipeline", "PipelineActivities": [ { "Channel": { "Name": "ChannelActivity", "ChannelName": "Channel", "Next": "LambdaActivity" }, "Lambda": { "Name": "LambdaActivity", "LambdaName": "Lambda", "BatchSize": 1, "Next": "AddAttributesActivity" }, "AddAttributes": { "Name": "AddAttributesActivity", "Attributes": { "key1": "attribute1", "key2": "attribute2" }, "Next": "RemoveAttributesActivity" }, "RemoveAttributes": { "Name": "RemoveAttributesActivity", "Attributes": [ "attribute1", "attribute2" ], "Next": "SelectAttributesActivity" }, "SelectAttributes": { "Name": "SelectAttributesActivity", "Attributes": [ "attribute1", "attribute2" ], "Next": "FilterActivity" }, "Filter": { "Name": "FilterActivity", "Filter": "attribute1 > 40 AND attribute2 < 20", "Next": "MathActivity" }, "Math": { "Name": "MathActivity", "Attribute": "attribute", "Math": "attribute - 10", "Next": "DeviceRegistryEnrichActivity" }, "DeviceRegistryEnrich": { "Name": "DeviceRegistryEnrichActivity", "Attribute": "attribute", "ThingName": "thingName", "RoleArn": "arn:aws:iam::<your_Account_Id>:role/Enrich", "Next": "DeviceShadowEnrichActivity" }, "DeviceShadowEnrich": { "Name": "DeviceShadowEnrichActivity", "Attribute": "attribute", "ThingName": "thingName", "RoleArn": "arn:aws:iam::<your_Account_Id>:role/Enrich", "Next": "DatastoreActivity" }, "Datastore": { "Name": "DatastoreActivity", "DatastoreName": "Datastore" } } ] } } } }
YAML
--- Description: "Create a complex Pipeline" Resources: Pipeline: Type: "AWS::IoTAnalytics::Pipeline" Properties: PipelineName: "ComplexPipeline" PipelineActivities: - Channel: Name: "ChannelActivity" ChannelName: "Channel" Next: "LambdaActivity" Lambda: Name: "LambdaActivity" LambdaName: "Lambda" BatchSize: 1 Next: "AddAttributesActivity" AddAttributes: Name: "AddAttributesActivity" Attributes: key1: "attribute1" key2: "attribute2" Next: "RemoveAttributesActivity" RemoveAttributes: Name: "RemoveAttributesActivity" Attributes: - "attribute1" - "attribute2" Next: "SelectAttributesActivity" SelectAttributes: Name: "SelectAttributesActivity" Attributes: - "attribute1" - "attribute2" Next: "FilterActivity" Filter: Name: "FilterActivity" Filter: "attribute1 > 40 AND attribute2 < 20" Next: "MathActivity" Math: Name: "MathActivity" Attribute: "attribute" Math: "attribute - 10" Next: "DeviceRegistryEnrichActivity" DeviceRegistryEnrich: Name: "DeviceRegistryEnrichActivity" Attribute: "attribute" ThingName: "thingName" RoleArn: "arn:aws:iam::<your_Account_Id>:role/Enrich" Next: "DeviceShadowEnrichActivity" DeviceShadowEnrich: Name: "DeviceShadowEnrichActivity" Attribute: "attribute" ThingName: "thingName" RoleArn: "arn:aws:iam::<your_Account_Id>:role/Enrich" Next: "DatastoreActivity" Datastore: Name: "DatastoreActivity" DatastoreName: "Datastore"
See also
-
How to Use AWS IoT Analytics in the AWS IoT Analytics User Guide
-
CreatePipeline in the AWS IoT Analytics API Reference


Provider Portal
Loading...
New Authorization
Get Records
Add Record
Select Patient
Retrieve
Add
Confirm Authorization
×
Please click 'OK' to confirm authorization


Configures an Nginx server as an SSL proxy for a Jenkins server.
Difficulty: 3
Time: 30 Minutes
Jenkins is a popular tool for continuous pipeline integration, offering features for managing and monitoring project build jobs. This article describes how to use NGINX as a reverse proxy with SSL for Jenkins. It assumes you have already installed Nginx and acquired and installed an SSL certificate. Although the steps for creating a reverse proxy NGINX configuration with SSL for Jenkins are covered here, you may wish to consult configuring NGINX as a reverse proxy for a more general understanding.
server { listen 80; server_name YourServerName or IP; ...


The Boost C++ Libraries
This book is licensed under a Creative Commons License.
Every function having the potential to fail during execution needs a way to communicate this to its caller appropriately. In C++, this is done either by using a return value or by throwing an exception. A return value is usually used if the failure is not really considered exceptional in a common sense. The caller is expected to check the return value and to react accordingly.
Exceptions are used to indicate exceptional conditions that are not considered to happen normally. A good example is the exception of type std::bad_alloc
that is thrown if a dynamic memory allocation using new
fails. Since memory can usually be reserved without any issue, it would be cumbersome to always have to check the return value.
This chapter introduces two Boost C++ Libraries assisting a developer in leveraging error handling: Boost.System translates operating system specific error codes into platform independent ones. Thanks to Boost.System, functions returning a value based on an operating system type can be designed in a platform-independent way. Boost.Exception allows to add additional information to any exception that can be utilized inside the catch
handler accordingly to better react to the exception.
Boost.System is a small library defining four classes to identify errors. boost::system::error_code
is the most basic class and represents operating system specific errors. Since operating systems typically enumerate errors, boost::system::error_code
saves an error code in a variable of type int
. The following example illustrates how to use this class by accessing the Boost.Asio library.
#include <boost/system/error_code.hpp> #include <boost/asio.hpp> #include <iostream> #include <string> int main() { boost::system::error_code ec; std::string hostname = boost::asio::ip::host_name(ec); std::cout << ec.value() << std::endl; }
Boost.Asio offers the free-standing boost::asio::ip::host_name()
function that returns the name of the computer the application is executed on.
An object of type boost::system::error_code
can be passed as the sole argument to boost::asio::ip::host_name()
. If the underlying operating system function fails, this argument contains the corresponding error code. It is also possible to call boost::asio::ip::host_name()
without any argument in case the error code is irrelevant.
boost::asio::ip::host_name()
was actually broken in Boost 1.36.0 and therefore serves as a perfect example. The function possibly returned an error code even though the underlying operating system function did actually return the name of the computer successfully. Since the issue was resolved in Boost 1.37.0, boost::asio::ip::host_name()
can now be used without concerns.
Since an error code is nothing but a numeric value, it can be displayed with the help of the value()
method. Since the error code 0 usually means that no error has occurred, the meaning of other values depends on the operating system and should be looked up in the manual accordingly.
Compiled on Windows XP using Visual Studio 2008, the above application repeatedly generated error code 14 (not enough storage available to complete the operation) while using Boost 1.36.0. Even though boost::asio::ip::host_name()
successfully determined the name of the computer, error code 14 was reported. This behavior is actually due to a broken implementation of boost::asio::ip::host_name()
.
Besides value()
, boost::system::error_code
offers the category()
method. This method returns an object of the second class defined in Boost.System: boost::system::category
.
Error codes are simply numeric values. While operating system manufacturers such as Microsoft are able to guarantee the uniqueness of system error codes, keeping error codes unique throughout all existing applications is virtually impossible for any application developer. It would require a centralized database filled with error codes by all software developers to avoid reusing the same codes for different scenarios which certainly is impractical. For this reason, error categories exist.
Error codes of type boost::system::error_code
always belong to a category that can be retrieved using the category()
method. Operating system errors are represented by the predefined object boost::system::system_category.
By calling category()
, a reference to the predefined boost::system::system_category is returned. It allows to retrieve specific information about the category such as the name using the name()
method which is system
in case of the system category.
#include <boost/system/error_code.hpp> #include <boost/asio.hpp> #include <iostream> #include <string> int main() { boost::system::error_code ec; std::string hostname = boost::asio::ip::host_name(ec); std::cout << ec.value() << std::endl; std::cout << ec.category().name() << std::endl; }
Errors are uniquely identified by the error code and the error category. Since error codes are only required to be unique within a category, developers should create a new category whenever they want to define error codes specific to an application. This allows for arbitrary error codes that do not interfere with error codes of other developers.
#include <boost/system/error_code.hpp> #include <iostream> #include <string> class application_category : public boost::system::error_category { public: const char *name() const { return "application"; } std::string message(int ev) const { return "error message"; } }; application_category cat; int main() { boost::system::error_code ec(14, cat); std::cout << ec.value() << std::endl; std::cout << ec.category().name() << std::endl; }
A new error category is defined by creating a class derived from boost::system::error_category
and implementing different methods as required by the interface of the new category. At minimum, the methods name()
and message()
must be supplied since they are defined as pure virtual in boost::system::error_category
. For additional methods, the default behavior can be overridden accordingly if required.
While name()
returns the name of the error category, message()
is used to retrieve the error description for a particular error code. Unlike the above example, the ev parameter is usually evaluated to return a description based on the error code.
Objects of type of the newly created error category can be used to initialize an error code accordingly. The example defines the error code ec using the new application_category
category. Therefore, error code 14 is no longer a system error; its meaning is specified by the developer of the new error category instead.
boost::system::error_code
contains a method named default_error_condition()
which returns an object of type boost::system::error_condition
. The interface of boost::system::error_condition
is almost identical to the one of boost::system::error_code
. The only difference is the default_error_condition()
method which is only provided by boost::system::error_code
.
#include <boost/system/error_code.hpp> #include <boost/asio.hpp> #include <iostream> #include <string> int main() { boost::system::error_code ec; std::string hostname = boost::asio::ip::host_name(ec); boost::system::error_condition ecnd = ec.default_error_condition(); std::cout << ecnd.value() << std::endl; std::cout << ecnd.category().name() << std::endl; }
boost::system::error_condition
is used just like boost::system::error_code
. Both the value()
and category()
method can be called for the boost::system::error_condition
object as shown in the above example.
The reason for having two more or less identical classes is fairly simple: While boost::system::error_code
is used for platform dependent error codes, boost::system::error_condition
is used to access platform independent error codes instead. By calling the default_error_condition()
method, a platform dependent error code is translated into a platform independent error code of type boost::system::error_condition
.
If the above application is executed, it displays the number 12 and the error category GENERIC
. The platform dependent error code 14 has been translated into the platform independent error code 12. Thanks to boost::system::error_condition
, the error is always represented by the same number - disregarding of the underlying platform. While Windows reports the error as 14, the same error may be reported as 25 with a different operating system. Using boost::system::error_condition
, the error will always be reported as 12.
The last class offered by Boost.System is boost::system::system_error
which is derived from std::runtime_error
. It can be used to transport an error code of type boost::system::error_code
within an exception.
#include <boost/asio.hpp> #include <boost/system/system_error.hpp> #include <iostream> int main() { try { std::cout << boost::asio::ip::host_name() << std::endl; } catch (boost::system::system_error &e) { boost::system::error_code ec = e.code(); std::cerr << ec.value() << std::endl; std::cerr << ec.category().name() << std::endl; } }
The free-standing boost::asio::ip::host_name()
function is provided in two versions: One expecting an argument of type boost::system::error_code
and one expecting no arguments. The second version will throw an exception of type boost::system::system_error
in case of an error. The exception transports the error code of type boost::system::error_code
accordingly.
The Boost.Exception library offers a new exception type boost::exception
allowing to add information to an exception after it has been thrown. It is defined in boost/exception/exception.hpp
. Since Boost.Exception spreads its classes and functions over multiple header files, the following example rather accesses boost/exception/all.hpp
to avoid including the header files individually.
#include <boost/exception/all.hpp> #include <boost/lexical_cast.hpp> #include <boost/shared_array.hpp> #include <exception> #include <string> #include <iostream> typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info; class allocation_failed : public boost::exception, public std::exception { public: allocation_failed(std::size_t size) : what_("allocation of " + boost::lexical_cast<std::string>(size) + " bytes failed") { } virtual const char *what() const throw() { return what_.c_str(); } private: std::string what_; }; boost::shared_array<char> allocate(std::size_t size) { if (size > 1000) throw allocation_failed(size); return boost::shared_array<char>(new char[size]); } void save_configuration_data() { try { boost::shared_array<char> a = allocate(2000); // saving configuration data ... } catch (boost::exception &e) { e << errmsg_info("saving configuration data failed"); throw; } } int main() { try { save_configuration_data(); } catch (boost::exception &e) { std::cerr << boost::diagnostic_information(e); } }
The example calls the function save_configuration_data()
inside main()
which in turn calls the allocate()
function. allocate()
allocates memory dynamically; however, it checks whether or not a certain limit is exceeded. This limit is arbitrarily set to 1,000 bytes in the example.
If allocate()
is called with a value greater than 1,000, an exception is thrown accordingly which is the case inside the save_configuration_data()
function. The function supposedly saves configuration data in the dynamically allocated memory as indicated by the comment.
The purpose of the example is to actually throw the exception in order to demonstrate Boost.Exception. The exception, thrown by allocate()
, is of type allocation_failed
and is derived from both boost::exception
and std::exception
.
Deriving from std::exception
is certainly not necessary. allocation_failed
could have also been derived from a different class hierarchy in order to embed it inside an existing framework. While the above example uses the class hierarchy defined by the C++ standard, deriving allocation_failed
solely from boost::exception
would have also been sufficient.
When throwing an exception of type allocation_failed
, the size of the memory expected to be allocated, is stored inside the exception to alleviate debugging of the corresponding application. If more memory is requested than can be provided by allocate()
, the root cause for the exception can be easily spotted.
If allocate()
is called by only one function (in the example save_configuration_data()
), this information is sufficient to locate the issue. However, in more complex applications with many functions calling allocate()
to dynamically allocate memory, the information is no longer sufficient to effectively debug the application. In these cases, it rather would help to actually know which function tried to allocate more memory than allocate()
can provide. Adding more information to the exception in these cases would help the debugging process tremendously.
The particular challenge is that allocate()
does not have information such as the caller name in order to add it to the exception accordingly.
Boost.Exception offers the following solution: Information can be added to an exception at all times by defining a data type based on boost::error_info
for every information that should be added to the exception.
boost::error_info
is a template expecting two arguments: The first argument is a so-called tag, uniquely identifying the newly created data type. Commonly, a structure with a unique name is utilized. The second argument refers to the data type of the information stored inside the exception.
The application defined a new data type errmsg_info
, uniquely identifiable via the tag_errmsg
structure, which stores a string of type std::string
.
Inside the catch
handler of save_configuration_data()
, the data type tag_errmsg
is accessed to create an object, initialized with the string "saving configuration data failed", to add additional information to the exception of type boost::exception
via the operator<<()
operator. The exception is then re-thrown accordingly.
The exception now not only carries the size of memory expected to be dynamically allocated, but also the description of the error added inside the save_configuration_data()
function. This description certainly helps while debugging since it now becomes clear which function tried to allocate more memory than can be provided.
To retrieve all available information from an exception, the boost::diagnostic_information()
function can be used as seen in the example inside the catch
handler of main()
. For every exception passed, boost::diagnostic_information()
not only calls the what()
method but also accesses all additional information stored inside the exception. A string of type std::string
is returned that can e.g. be written to the standard output stream.
Above application compiled with Visual C++ 2008 displays the following message:
Throw in function (unknown) Dynamic exception type: class allocation_failed std::exception::what: allocation of 2000 bytes failed [struct tag_errmsg *] = saving configuration data failed
As can be seen, the message contains the data type of the exception, the error message as retrieved from the what()
method, and the description including the corresponding name of the structure.
boost::diagnostic_information()
checks at run-time whether or not a given exception is derived from std::exception
. Only if it is, the what()
method is actually called.
The name of the function that has thrown the exception of type allocation_failed
is indicated as "unknown" in the message.
Boost.Exception provides a macro to throw an exception including not only the name of the function but also additional information such as the file name and the line number.
#include <boost/exception/all.hpp> #include <boost/lexical_cast.hpp> #include <boost/shared_array.hpp> #include <exception> #include <string> #include <iostream> typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info; class allocation_failed : public std::exception { public: allocation_failed(std::size_t size) : what_("allocation of " + boost::lexical_cast<std::string>(size) + " bytes failed") { } virtual const char *what() const throw() { return what_.c_str(); } private: std::string what_; }; boost::shared_array<char> allocate(std::size_t size) { if (size > 1000) BOOST_THROW_EXCEPTION(allocation_failed(size)); return boost::shared_array<char>(new char[size]); } void save_configuration_data() { try { boost::shared_array<char> a = allocate(2000); // saving configuration data ... } catch (boost::exception &e) { e << errmsg_info("saving configuration data failed"); throw; } } int main() { try { save_configuration_data(); } catch (boost::exception &e) { std::cerr << boost::diagnostic_information(e); } }
By using the macro BOOST_THROW_EXCEPTION
instead of throw
, additional information such as function name, file name and line number are automatically added to the exception. This only works if the compiler supports corresponding macros though. While macros such as __FILE__
and __LINE__
are defined by the C++ standard, there is no standardized macro for returning the name of the current function. Since many of the compiler manufacturers provide such a macro, BOOST_THROW_EXCEPTION
tries to identify the underlying compiler and utilize the corresponding macro accordingly. Compiled with Visual C++ 2008, the above application displays the following message:
.\main.cpp(31): Throw in function class boost::shared_array<char> __cdecl allocate(unsigned int) Dynamic exception type: class boost::exception_detail::clone_impl<struct boost::exception_detail::error_info_injector<class allocation_failed> > std::exception::what: allocation of 2000 bytes failed [struct tag_errmsg *] = saving configuration data failed
The code compiles without errors even though the allocation_failed
class is no longer derived from boost::exception
. BOOST_THROW_EXCEPTION
accesses a function named boost::enable_error_info()
that dynamically identifies whether or not an exception is derived from boost::exception
. If not, it automatically creates a new exception type derived both from the specified type and boost::exception
. This mechanism is the reason for the above message to not display allocation_failed
only.
Finally, this section concludes with an example to selectively access information added to an exception.
#include <boost/exception/all.hpp> #include <boost/lexical_cast.hpp> #include <boost/shared_array.hpp> #include <exception> #include <string> #include <iostream> typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info; class allocation_failed : public std::exception { public: allocation_failed(std::size_t size) : what_("allocation of " + boost::lexical_cast<std::string>(size) + " bytes failed") { } virtual const char *what() const throw() { return what_.c_str(); } private: std::string what_; }; boost::shared_array<char> allocate(std::size_t size) { if (size > 1000) BOOST_THROW_EXCEPTION(allocation_failed(size)); return boost::shared_array<char>(new char[size]); } void save_configuration_data() { try { boost::shared_array<char> a = allocate(2000); // saving configuration data ... } catch (boost::exception &e) { e << errmsg_info("saving configuration data failed"); throw; } } int main() { try { save_configuration_data(); } catch (boost::exception &e) { std::cerr << *boost::get_error_info<errmsg_info>(e); } }
The example does not utilize boost::diagnostic_information()
but rather uses boost::get_error_info()
to directly access the error message of type errmsg_info
. boost::get_error_info()
returns a smart pointer of type boost::shared_ptr
. In case the argument passed is not of type boost::exception
, a null pointer is returned accordingly. If the BOOST_THROW_EXCEPTION
macro is always used to throw an exception, it is guaranteed that the exception is derived from boost::exception
- there is no need to check the returned smart pointer for null in these cases.
Copyright © 2008-2010 Boris Schäling


The Plexus registry is a single source of external configuration for Plexus components and applications. It can be used by components to source configuration, knowing that it can be used from within applications without the information being hard coded into the component.
To facilitate a variety of providers, Commons Configuration is used to implement the backing storage.
This relies on a pull-based (or lookup) mechanism - the applications request specific pieces of configuration at the time they need them, and it is retrieved from the registry.
The registry is configurable so that configuration can be placed in any location desired, and is shared container wide. A registry using the same file as other running VMs should operate correctly.
Note: Inside the application server, this means that the scope is application wide as each application has it's own container. It may be feasible to provide a single registry for the whole server, but this has not yet been tested. This would only be necessary if the server was to dictate configuration locations that the registry was not already configured to use. Of course, such additional locations could be added to the application registry instances programmatically as well.
<component> <role>org.codehaus.redback.components.registry.Registry</role> <implementation>org.codehaus.plexus.registry.CommonsConfigurationRegistry</implementation> <role-hint>commons-configuration</role-hint> <configuration> <properties> <system/> <jndi prefix="java:comp/env" config-optional="true"/> <xml fileName="${user.home}/.m2/archiva.xml" config-optional="true" config-name="org.apache.maven.archiva" config-at="org.apache.maven.archiva" config-forceCreate="true"/> <properties fileName="${user.home}/.m2/security.properties" config-optional="true" config-at="org.codehaus.plexus.security"/> </properties> </configuration> </component>
The configuration inside the outer <properties> element is equivalent to the builder syntax for Commons Configuration. This maps to similar concepts in the registry.
In this example, the precedence is to first look in the system properties, then JNDI, then the given XML file, and finally the given properties file.
Registries can have 'sections', which are declared as partitioned areas of the registry. This is done using the config-name attribute in Commons Configuration. While the sections behave normally as a part of the global registry, they can easily be retrieved independently. This is particularly useful for write-back operations so the file the section is stored in can be saved when the registry is modified.
Each configuration source can be configured with a given mount-point in the registry using the config-at attribute. This will cause all of the properties to be stored with the given prefix.
The registry can be used as a simple directory, for example:
int value = registry.getInt( "test.property" ); String text = registry.getString( "text.data" ); boolean enabled = registry.getBoolean( "system.enabled", true );
The first parameter is always a key. The registry is hierachical, so in the key, a . (period) represents a nested configuration, and can be traversed to any level.
The second parameter specifies a default value. If it is not given, then null is returned for strings if the key is not found in the registry, and an exception is thrown for integers and booleans under the same circumstances.
There are two ways to work with a portion of the registry at a time: subsets and sections.
Sections were encountered earlier - and while they return a subset it may span a number of different base prefixes, depending on whether config-at was specified on the section or not. Even so, if it is a subset of the hierachy, some elements of the hierachy at the same level might not be returned because they come from a different section.
On the other hand, subsets are reductions of the registry to keys descending from a given prefix.
Once a subset (or section) is obtained, it behaves the same as the registry as a whole, however it will have fewer values, and looking up values will not have the prefix as a part of the key.
For example:
String value = registry.getString( "org.codehaus.plexus.registry.value" ); Registry subset = registry.getSubset( "org.codehaus.plexus.registry" ); value = subset.getString( "value" ); // this will equal the earlier value retrieved
It is also possible to retrieve subsets of the registry as collections.
To simplify the translation of configuration into reusable beans and to produce a self-documenting system, Modello can be used to generate registry I/O classes. The appropriate goals in the plugin are registry-reader and registry-writer.


Lebanon's Hariri meets Aoun, says will continue talks
BEIRUT (Reuters) - Lebanon’s caretaker Prime Minister Saad al-Hariri met President Michel Aoun on Thursday and said after the meeting he would continue to hold talks with the head of state and other parties.
Hariri resigned as prime minister last week.
“I came to talk to his Excellency the President and we will continue the consultations with other parties,” he said, adding that this was all he wanted to say.


We're leaving tomorrow for Mexico! We're going to Oaxaca, and then on the latter part of the trip making our way to Mexico City where we fly out.
Lots of stuff going on lately, I've been feeling overwhelmed but also excited. So it feels hard to just leave. OTOH, it seems really great to leave. I look forward to the break.
Despite living in a city surrounded by Spanish writing and Spanish speakers, I have sadly not practiced my Spanish for years. However, while my grammar has decayed and my vocabulary is poor, I'm hoping an ability to string together large numbers of simple words to make statements that allude to my true meaning will work out. It's like charades with words. I need to ask for a decongestant? Necesito medecino para me nariz, porque esta lleno de agua! I hope such attempts will amuse if not inform.
I'll be back on the 21st. Ta-ta!


{% extends 'weblab-master.html' %} {% block body %} {% from "_form_helpers.html" import render_field, render_simple_field %}
| {{ gettext("Remote system") }} | {{ gettext("Local mapping") }} | {{ gettext("Action") }} |
|---|---|---|
{{ gettext("The following associations were once added and now the remote system does not provide them anymore") }}
| {{ gettext("Old remote name") }} | {{ gettext("Local mapping") }} | {{ gettext("Action") }} |
|---|---|---|


Show Hyatt.com
Login or Register
United States (English)
Estaré
Resorts
Day Spas
Services
Products
Cart
Help
My
Estaré
Experience
Estaré
Sign In
Estaré
account
Remember Me
Cancel
Submit
Don't Have an Estaré Account?
Sign Up
Praesent adipiscing
Nullam
Etiam
Nullam vel
Fusce neque
Quisque ut nisi
Praesent
Curabitur turpis


Enumeration members
alternate
alternate: = "alternate"
archives
archives: = "archives"
author
author: = "author"
bookmark
bookmark: = "bookmark"
canonical
canonical: = "canonical"
dnsprefetch
dnsprefetch: = "dns-prefetch"
external
external: = "external"
import
import: = "import"
license
license: = "license"
manifest
manifest: = "manifest"
modulepreload
modulepreload: = "modulepreload"
nofollow
nofollow: = "nofollow"
noopener
noopener: = "noopener"
noreferrer
noreferrer: = "noreferrer"
opener
opener: = "opener"
pingback
pingback: = "pingback"
preconnect
preconnect: = "preconnect"
prefetch
prefetch: = "prefetch"
preload
preload: = "preload"
prerender
prerender: = "prerender"
search
search: = "search"
shortlink
shortlink: = "shortlink"
sidebar
sidebar: = "sidebar"
stylesheet
stylesheet: = "stylesheet"
https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types


Instantly share links between any of your devices. Never email yourself a link again just to get it somewhere else.
Pushbullet works on all of your devices, making sharing and chatting with friends more convenient than ever.
Moving pictures and files between your devices has never been easier. Just drag and drop onto Pushbullet.


Dep10y
Dashboard
Signed in as
loading
.
Logout?
Flask
Sinatra
You have no projects!
You can create some, and they will appear here.
Loading your projects


{% extends "email/base_email.html" %} {% block content %}
Hello {{ user.username }}!
Someone has requested a link to change your password. You can do this through the link below.
If you didn't request this, please ignore this email.
Your password won't change until you access the link above and create a new one.
{% endblock %}


Module: ActiveSupport::LoggerThreadSafeLevel
Do not use. This module is for internal use only.
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Concern
|
|
| Defined in: | activesupport/lib/active_support/logger_thread_safe_level.rb |
Class Method Summary
Concern
- Extended
| class_methods | Define class methods from given block. |
| included | Evaluate given block in context of base class, so that you can write class macros here. |
| prepended | Evaluate given block in context of base class, so that you can write class macros here. |
| append_features, prepend_features |
Instance Attribute Summary
Instance Method Summary
-
#add(severity, message = nil, progname = nil, &block)
Redefined to check severity against #level, and thus the thread-local level, rather than @level.
- #level
-
#log_at(level)
Change the thread-local level for the duration of the given block.
Instance Attribute Details
#local_level (rw)
[ GitHub ]# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 20
def local_level IsolatedExecutionState[:logger_thread_safe_level] end
#local_level=(level) (rw)
[ GitHub ]# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 24
def local_level=(level) case level when Integer when Symbol level = Logger::Severity.const_get(level.to_s.upcase) when nil else raise ArgumentError, "Invalid log level: #{level.inspect}" end IsolatedExecutionState[:logger_thread_safe_level] = level end
Instance Method Details
#add(severity, message = nil, progname = nil, &block)
Redefined to check severity against #level, and thus the thread-local level, rather than @level. FIXME: Remove when the minimum Ruby version supports overriding Logger#level
.
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 50
def add(severity, = nil, progname = nil, &block) # :nodoc: severity ||= UNKNOWN progname ||= @progname return true if @logdev.nil? || severity < level if .nil? if block_given? = yield else = progname progname = @progname end end @logdev.write \ (format_severity(severity), Time.now, progname, ) end
#level
[ GitHub ]# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 36
def level local_level || super end
#log_at(level)
Change the thread-local level for the duration of the given block.
# File 'activesupport/lib/active_support/logger_thread_safe_level.rb', line 41
def log_at(level) old_local_level, self.local_level = local_level, level yield ensure self.local_level = old_local_level end


This defines an API for writing test
suites, to make it easy to portably test Scheme APIs, libraries,
applications, and implementations. A test suite is a collection of
test cases that execute in the context of a
test-runner. This specifications also supports writing new
test-runners, to allow customization of reporting and processing the
result of running test suites.


14 MacLean Hall, The University of Iowa, Iowa City, IA 52242-1419, USA
Conference Papers:
Book Chapters:
Poster Presentations:


returns the Typeface used for the labels, returns null if none is set
{@link Font}
Returns the text color that is set for the labels.
returns the text size that is currently set for the labels, in pixels
returns the Typeface used for the labels, returns null if none is set
{@link Font}
Returns the used offset on the x-axis for drawing the axis or legend labels. This offset is applied before and after the label.
Returns the used offset on the x-axis for drawing the axis labels. This offset is applied before and after the label.
Returns true if this comonent is enabled (should be drawn), false if not.
Set this to true if this component should be enabled (should be drawn), false if not. If disabled, nothing of this component will be drawn. Default: true
sets a specific Typeface for the labels
Sets the text color to use for the labels. Make sure to use getResources().getColor(...) when using a color from the resources.
sets the size of the label text in density pixels min = 6f, max = 24f, default 10
the text size, in DP
Îsets a specific Typeface for the labels
Sets the used x-axis offset for the labels on this axis.
Sets the used y-axis offset for the labels on this axis. For the legend, higher offset means the legend as a whole will be placed further away from the top.
Generated using TypeDoc
This class encapsulates everything both Axis, Legend and LimitLines have in common.
Philipp Jahoda


Lost
Your plane crashed and you are alone on a island. You must collect the transmitter, the antena and the battery in order to broadcast your SOS before you starve. Pick fruits or berries to slow you hunger.
Arrow keys / wasd / zqsd to move, e to take food or equipment.
Press space to start


FeaturesAndBenefits_2_FeatureBenefitItem
- Amount : String
Amount associated to the feature/benefit where applicable e.g. 200 Pounds worth of travel insurance
- FeatureBenefitEligibility : List
Feature and Benefit eligibility
- Identification : String
Unique and unambiguous identification of a Feature and Benefit Item.
- Indicator : Boolean
True/False indicator for a particular feature/benefit e.g. Interest Free Overdraft?
- Name : String
Name which can be attached to the feature/benefit
- Notes : List
Optional additional notes to supplement the feature/benefit item. Only used for very specific conditions
- Textual : String
Provides textual information about a feature/benefit e.g. 10% off cinema tickets on Tuesday nights
- Type : String
Common types of features & benefits
- Enum:
- AccountManagement
- AccountOpeningOrSwitchingIncentive
- Cashback
- Entertainment
- HomeInsurance
- HomeProtection
- InternationalPaymentSupport
- Lifestyle
- MotorBreakdown
- OverdraftControl
- Other
- PremiumService
- PreferentialRates
- PassiveSaving
- RelationshipManager
- Rewards
- TechnologyInsurance
- TravelInsurance
- Travel


Class: Jammit::Compressor
- Inherits:
- Object
- Defined in:
- lib/jammit/compressor.rb
Overview
Uses the YUI Compressor or Closure Compiler to compress JavaScript. Always uses YUI to compress CSS (Which means that Java must be installed.) Also knows how to create a concatenated JST file. If “embed_images” is turned on, creates “mhtml” and “datauri” versions of all stylesheets, with all enabled images inlined into the css.
Constant Summary
- IMAGE_MIME_TYPES = Mapping from extension to mime-type of all embeddable images.
{ '.png' => 'image/png', '.jpg' => 'image/jpeg', '.jpeg' => 'image/jpeg', '.gif' => 'image/gif', '.tif' => 'image/tiff', '.tiff' => 'image/tiff' }
- IMAGE_DETECTOR =
/url\(['"]?([^\s)]+\.(png|jpg|jpeg|gif|tif|tiff))['"]?\)/
- IMAGE_EMBED =
/[\A\/]embed\//
- IMAGE_REPLACER =
/url\(__EMBED__([^\s)]+)\)/
- MHTML_START = MHTML file constants.
"/*\r\nContent-Type: multipart/related; boundary=\"JAMMIT_MHTML_SEPARATOR\"\r\n\r\n"
- MHTML_SEPARATOR =
"--JAMMIT_MHTML_SEPARATOR\r\n"
- MHTML_END =
"*/\r\n"
- JST_START = JST file constants.
"(function(){window.JST = window.JST || {};"
- JST_END =
"})();"
- COMPRESSORS =
{ :yui => YUI::JavaScriptCompressor, :closure => Closure::Compiler }
- DEFAULT_OPTIONS =
{ :yui => {:munge => true}, :closure => {} }
Method Summary
- - (Object) compile_jst(paths) Compiles a single JST file by writing out a javascript that adds template properties to a top-level “window.JST” object.
- - (Object) compress_css(paths, variant = nil, asset_url = nil) Concatenate and compress a list of CSS stylesheets.
- - (Object) compress_js(paths) Concatenate together a list of JavaScript paths, and pass them through the YUI Compressor (with munging enabled).
- - (Compressor) initialize Creating a compressor initializes the internal YUI Compressor from the “yui-compressor” gem, or the internal Closure Compiler from the “closure-compiler” gem.
- - (Object) absolute_path(image_pathname, css_pathname) private Get the site-absolute public path for an image file path that may or may not be relative, given the path of the stylesheet that contains it.
- - (Object) concatenate(paths) private Concatenate together a list of asset files.
- - (Object) concatenate_and_tag_images(paths, variant = nil) private In order to support embedded images from relative paths, we need to expand the paths before contatenating the CSS together and losing the location of the original stylesheet path.
- - (Object) embeddable?(image_path) private An image is valid for embedding if it exists, is less than 32K, and is stored somewhere inside of a folder named “embed”.
- - (Object) encoded_contents(image_path) private Return the Base64-encoded contents of an image on a single line.
- - (Object) mime_type(image_path) private Grab the mime-type of an image, by filename.
- - (Object) relative_path(absolute_path) private CSS images that are referenced by relative paths, and are not being embedded, must be rewritten relative to the newly-merged stylesheet path.
- - (Object) rewrite_image_path(image_path, css_path, embed = false) private Return a rewritten image URL for a new stylesheet — the image should be tagged for embedding if embeddable, and referenced at the correct level if relative.
- - (Object) with_data_uris(css) private Re-write all enabled image URLs in a stylesheet with their corresponding Data-URI Base-64 encoded image contents.
- - (Object) with_mhtml(css, asset_url) private Re-write all enabled image URLs in a stylesheet with the MHTML equivalent.
Constructor Details
- (Compressor) initialize
Creating a compressor initializes the internal YUI Compressor from the “yui-compressor” gem, or the internal Closure Compiler from the “closure-compiler” gem.
47 48 49 50 51 52 |
# File 'lib/jammit/compressor.rb', line 47 def initialize @css_compressor = YUI::CssCompressor.new flavor = Jammit.javascript_compressor = DEFAULT_OPTIONS[flavor].merge(Jammit.) @js_compressor = COMPRESSORS[flavor].new() end |
Method Details
- (Object) compile_jst(paths)
Compiles a single JST file by writing out a javascript that adds template properties to a top-level “window.JST” object. Adds a JST-compilation function to the top of the package, unless you’ve specified your own preferred function, or turned it off. JST templates are named with the basename of their file.
80 81 82 83 84 85 86 87 88 |
# File 'lib/jammit/compressor.rb', line 80 def compile_jst(paths) compiled = paths.map do |path| template_name = File.basename(path, File.extname(path)) contents = File.read(path).gsub(/\n/, '').gsub("'", '\\\\\'') "window.JST.#{template_name} = #{Jammit.template_function}('#{contents}');" end compiler = Jammit.include_jst_script ? File.read(DEFAULT_JST_SCRIPT) : ''; [JST_START, compiler, compiled, JST_END].flatten.join("\n") end |
- (Object) compress_css(paths, variant = nil, asset_url = nil)
Concatenate and compress a list of CSS stylesheets. When compressing a :datauri or :mhtml variant, post-processes the result to embed referenced images.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/jammit/compressor.rb', line 64 def compress_css(paths, variant=nil, asset_url=nil) css = concatenate_and_tag_images(paths, variant) css = @css_compressor.compress(css) unless [:disabled] case variant when nil then return css when :datauri then return with_data_uris(css) when :mhtml then return with_mhtml(css, asset_url) else raise PackageNotFound, "\"#{variant}\" is not a valid stylesheet variant" end end |
- (Object) compress_js(paths)
Concatenate together a list of JavaScript paths, and pass them through the YUI Compressor (with munging enabled).
56 57 58 59 |
# File 'lib/jammit/compressor.rb', line 56 def compress_js(paths) js = concatenate(paths) [:disabled] ? js : @js_compressor.compress(js) end |
- (Object) absolute_path(image_pathname, css_pathname) (private)
Get the site-absolute public path for an image file path that may or may not be relative, given the path of the stylesheet that contains it.
143 144 145 146 147 |
# File 'lib/jammit/compressor.rb', line 143 def absolute_path(image_pathname, css_pathname) (image_pathname.absolute? ? Pathname.new(File.join(PUBLIC_ROOT, image_pathname)) : css_pathname.dirname + image_pathname).cleanpath end |
- (Object) concatenate(paths) (private)
Concatenate together a list of asset files.
174 175 176 |
# File 'lib/jammit/compressor.rb', line 174 def concatenate(paths) [paths].flatten.map {|p| File.read(p) }.join("\n") end |
- (Object) concatenate_and_tag_images(paths, variant = nil) (private)
In order to support embedded images from relative paths, we need to expand the paths before contatenating the CSS together and losing the location of the original stylesheet path. Validate the images while we’re at it.
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/jammit/compressor.rb', line 97 def concatenate_and_tag_images(paths, variant=nil) stylesheets = [paths].flatten.map do |css_path| File.read(css_path).gsub(IMAGE_DETECTOR) do |url| ipath, cpath = Pathname.new($1), Pathname.new(File.(css_path)) is_url = URI.parse($1).absolute? is_url ? url : "url(#{rewrite_image_path(ipath, cpath, !!variant)})" end end stylesheets.join("\n") end |
- (Object) embeddable?(image_path) (private)
An image is valid for embedding if it exists, is less than 32K, and is stored somewhere inside of a folder named “embed”. IE does not support Data-URIs larger than 32K, and you probably shouldn’t be embedding images that large in any case.
159 160 161 |
# File 'lib/jammit/compressor.rb', line 159 def (image_path) image_path.to_s.match(IMAGE_EMBED) && image_path.exist? && image_path.size < 32.kilobytes end |
- (Object) encoded_contents(image_path) (private)
Return the Base64-encoded contents of an image on a single line.
164 165 166 |
# File 'lib/jammit/compressor.rb', line 164 def encoded_contents(image_path) Base64.encode64(File.read(image_path)).gsub(/\n/, '') end |
- (Object) mime_type(image_path) (private)
Grab the mime-type of an image, by filename.
169 170 171 |
# File 'lib/jammit/compressor.rb', line 169 def mime_type(image_path) IMAGE_MIME_TYPES[File.extname(image_path)] end |
- (Object) relative_path(absolute_path) (private)
CSS images that are referenced by relative paths, and are not being embedded, must be rewritten relative to the newly-merged stylesheet path.
151 152 153 |
# File 'lib/jammit/compressor.rb', line 151 def relative_path(absolute_path) File.join('../', absolute_path.sub(PUBLIC_ROOT, '')) end |
- (Object) rewrite_image_path(image_path, css_path, embed = false) (private)
Return a rewritten image URL for a new stylesheet — the image should be tagged for embedding if embeddable, and referenced at the correct level if relative.
135 136 137 138 139 |
# File 'lib/jammit/compressor.rb', line 135 def rewrite_image_path(image_path, css_path, =false) public_path = absolute_path(image_path, css_path) return "__EMBED__#{public_path}" if && (public_path) image_path.absolute? ? image_path.to_s : relative_path(public_path) end |
- (Object) with_data_uris(css) (private)
Re-write all enabled image URLs in a stylesheet with their corresponding Data-URI Base-64 encoded image contents.
110 111 112 113 114 |
# File 'lib/jammit/compressor.rb', line 110 def with_data_uris(css) css.gsub(IMAGE_REPLACER) do |url| "url(\"data:#{mime_type($1)};base64,#{encoded_contents($1)}\")" end end |
- (Object) with_mhtml(css, asset_url) (private)
Re-write all enabled image URLs in a stylesheet with the MHTML equivalent. The newlines (“\r\n”) in the following method are critical. Without them your MHTML will look identical, but won’t work.
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/jammit/compressor.rb', line 119 def with_mhtml(css, asset_url) paths, index = {}, 0 css = css.gsub(IMAGE_REPLACER) do |url| i = paths[$1] ||= "#{index += 1}-#{File.basename($1)}" "url(mhtml:#{asset_url}!#{i})" end mhtml = paths.map do |path, identifier| mime, contents = mime_type(path), encoded_contents(path) [MHTML_SEPARATOR, "Content-Location: #{identifier}\r\n", "Content-Type: #{mime}\r\n", "Content-Transfer-Encoding: base64\r\n\r\n", contents, "\r\n"] end [MHTML_START, mhtml, MHTML_END, css].flatten.join('') end |


--- layout: collection-item title: S3 Resume and Reel Review (S3R3) enable-header: true close-date: Dec 30th, 2021 signup-tabs: true onsite-signup-form: https://airtable.com/appEY7eAfzzaicShh/shryR867HUK0OdUEB onlinestudent-signup-form: '' reviewer-signup-form: https://airtable.com/appEY7eAfzzaicShh/shr12qPtghZU50umr onsite-signup-tab: Sign-up for a review! onlinestudent-signup-tab: '' reviewer-signup-tab: Reviewer Interest Form onsite-tab-enabled: true onlinestudent-tab-enabled: false reviewer-tab-enabled: true onsite-tab-active: true onlinestudent-tab-active: false reviewer-tab-active: false tab-size: '2' ---
S3R3 is the Early Career Development Committee (formerly S3) Resume and Reel Review program where students and emerging professionals with less than 3 years’ experience have their resume or reel reviewed by industry professionals. This is conducted either virtually or in-person at the SIGGRAPH and SIGGRAPH Asia Conferences in 20-minute sessions. Reviewers assess students’ work and offer tips to improve the chances of finding work within the computer graphics industry. Students are matched to industry professionals based on their desired work field and job skills and provide their resume and/or reel for review and expert advice. Some example categories for students to choose from to have their work/resumes reviewed are not limited to but include the following:
Participants of the Resume and Reel Review Program (S3R3) are expected to maintain a high level of professionalism and adhere to appropriate behavior during the onsite review sessions. It is crucial for reviewers to understand their role as industry professionals and the power dynamics inherent in the mentorship relationship. They should approach the review process with respect, empathy, and a commitment to fostering a safe and inclusive environment.
Harassment of any kind, including but not limited to discrimination, bullying, or any form of misconduct, will not be tolerated during the S3R3 sessions. Reviewers must be aware of the impact their words and actions can have on the reviewees and should refrain from engaging in any behavior that may cause discomfort or distress. Any harassment or inappropriate conduct should be reported immediately to the event organizers.
By participating in the S3R3 program, reviewers are expected to provide constructive feedback, offer guidance, and share their expertise in a supportive and professional manner. This includes focusing on the reviewee's work, skills, and potential for growth within the computer graphics industry. Reviewers should prioritize creating a positive learning environment that encourages the reviewees' professional development and increases their chances of success in the industry.
The S3R3 program values professionalism, respect, and understanding, recognizing that the ultimate goal is to assist students and emerging professionals in their career pursuits. Together, by upholding these principles, we can foster an inclusive and empowering environment that benefits both the reviewers and the reviewees.
Please contact<EMAIL_ADDRESS>for issues or questions related to this code of conduct.


--- layout: default title: "DITA Open Toolkit Contribution Policy" ---
The purpose of the DITA Open Toolkit Contribution Policy is to set forth the general principles under which the DITA Open Toolkit project shall accept contributions, license contributions, license materials owned by this project, and manage other intellectual property matters.
The Apache License 2.0, which is incorporated herein by reference, will serve as the primary license under which the Committer will accept contributions of software, documentation, information (including, but not limited to, ideas, concepts, know-how and techniques) and/or other materials (collectively "Content") to the project from Contributors. A copy of the Apache License 2.0 can be found at the root directory of the DITA Open Toolkit deliverable package.
This Contribution Policy should at all times be interpreted in a manner that is consistent with the Purposes of the this project as set forth in the DITA Open Toolkit Development Process goals and objectives. This Contribution Policy shall serve as the basis for how non-Committers interact with this project through participation in this project, web-sites owned, controlled, published and/or managed under the auspices of the this project, or otherwise.
The Apache License 2.0 shall serve as the primary license under which the Committer(s) shall accept software, documentation, information (including, but not limited to, ideas, concepts, know-how and techniques) and/or other materials (collectively "Content") from contributors including, but not limited to, Contributors and Committers.
The DITA Open Toolkit project provides a process for accepting bug fixes and contributions from parties who have not accepted the license to be Contributors. See Due Diligence for Submission of Bug Fixes and Patches from Non-Committers
The Committer(s), shall be responsible for scrutinizing all Content contributed to the DITA Open Toolkit project and help ensure that the Contribution Policy licensing requirements set forth above are met. Except as set forth below, the applicable Committer shall conduct the following activities prior to uploading any Content into the repository or otherwise making the Content available for distribution:
If the applicable Committer has any doubts about the ability to distribute the Content under terms and conditions that are consistent with the Apache License 2.0 or the proposed alternative terms and conditions, the Committer may not upload the code to the repository or otherwise distribute the Content. The Committer(s) shall be responsible for filing/maintaining the information collected for future reference as needed.
The above record keeping requirements shall not apply to
While the record keeping requirements do not apply to the items listed above, Committers must conduct reasonable due diligence to satisfy themselves that proposed Contributions can be licensed under the terms of the Apache License 2.0.


1.15.5 / 2022-01-10
Fixed:
- Fix long double argument or return values on 32bit i686. #849
- FFI::ConstGenerator: avoid usage of the same binary file simultaneously. #929
Added:
- Add Windows fat binary gem for Ruby-3.1
Removed:
- Remove Windows fat binary gem for Ruby < 2.4
1.15.4 / 2021-09-01
Fixed:
- Fix build for uClibc. #913
- Correct module lookup when including
ffi-module
gem. #912
Changed:
- Use ruby code of the ffi gem in JRuby-9.2.20+. #915
1.15.3 / 2021-06-16
Fixed:
- Fix temporary packaging issue with libffi. #904
1.15.2 / 2021-06-16
Added:
- Add support for Windows MINGW-UCRT build. #903
- Add
/opt/homebrew/lib/
to fallback search paths to improve homebrew support. #880 #882
Changed:
- Regenerate
types.conf
for FreeBSD12 aarch64. #902
1.15.1 / 2021-05-22
Fixed:
- Append -pthread to linker options. #893
- Use arm or aarch64 to identify Apple ARM CPU arch. #899
- Allow overriding
gcc
with theCC
env var inconst_generator.rb
andstruct_generator.rb
. #897
1.15.0 / 2021-03-05
Fixed:
- Fix MSVC build
- Fix async callbacks in conjunction with fork(). #884
Added:
- Allow to pass callbacks in varargs. #885
- Name the threads for
FFI
callback dispatcher and async thread calls for easier debugging. #883 The name can be retrieved by Thread.name and is shown by Thread.list.inspect etc. Even gdb shows the thread name on supported operating systems. - Add types.conf for powerpc64le-linux
- Add types.conf for riscv64-linux
- More release automation of ffi gems
Changed:
- Switch from rubygems-tasks to bundler/gem_helper
Removed:
- Remove unused VariadicInvoker#init
1.14.2 / 2020-12-21
Fixed:
- Fix builtin libffi on newer Ubuntu caused by an outdated Makefile.in . #863
1.14.1 / 2020-12-19
Changed:
- Revert changes to FFI::Pointer#write_string made in ffi-1.14.0. It breaks compatibilty in a way that can cause hard to find errors. #857
1.14.0 / 2020-12-18
Added:
- Add types.conf for x86_64-msys, x86_64-haiku, aarch64-openbsd and aarch64-darwin (alias arm64-darwin)
- Add method AbstractMemory#size_limit? . #829
- Add new extconf option --enable-libffi-alloc which is enabled per default on Apple M1 (arm64-darwin).
Changed:
- Do NULL pointer check only when array length > 0 . #305
- Raise an error on an unknown order argument. #830
- Change FFI::Pointer#write_string to terminate with a NUL byte like other string methods. #805
- Update bundled libffi to latest master.
Removed:
- Remove win32/stdint.h and stdbool.h because of copyright issue. #693
Fixed:
- Fix possible UTF-8 load error in loader script interpretation. #792
- Fix segfault on non-array argument to #write_array_of_*
- Fix memory leak in MethodHandle . #815
- Fix possible segfault in combination with fiddle or other libffi using gems . #835
- Fix possibility to use ffi ruby gem with JRuby-9.3 . #763
- Fix a GC issue, when a callback Proc is used on more than 2 callback signatures. #820
1.13.1 / 2020-06-09
Changed:
- Revert use of
ucrtbase.dll
as default C library on Windows-MINGW.ucrtbase.dll
is still used on MSWIN target. #790 - Test for
ffi_prep_closure_loc()
to make sure we can use this function. This fixes incorrect use of system libffi on MacOS Mojave (10.14). #787 - Update types.conf on x86_64-dragonflybsd
1.13.0 / 2020-06-01
Added:
- Add TruffleRuby support. Almost all specs are running on TruffleRuby and succeed. #768
- Add ruby source files to the java gem. This allows to ship the Ruby library code per platform java gem and add it as a default gem to JRuby. #763
- Add FFI::Platform::LONG_DOUBLE_SIZE
- Add bounds checks for writing to an inline char[] . #756
- Add long double as callback return value. #771
- Update type definitions and add types from stdint.h and stddef.h on i386-windows, x86_64-windows, x86_64-darwin, x86_64-linux, arm-linux, powerpc-linux. #749
- Add new type definitions for powerpc-openbsd and sparcv9-openbsd. #775, #778
Changed:
- Raise required ruby version to >= 2.3.
- Lots of cleanups and improvements in library, specs and benchmarks.
- Fix a lot of compiler warnings at the C-extension
- Fix several install issues on MacOS:
- Look for libffi in SDK paths, since recent versions of macOS removed it from
/usr/include
. #757 - Fix error
ld: library not found for -lgcc_s.10.4
- Don't built for i386 architecture as it is deprecated
- Look for libffi in SDK paths, since recent versions of macOS removed it from
- Several fixes for MSVC build on Windows. #779
- Use
ucrtbase.dll
as default C library on Windows instead of oldmsvcrt.dll
. #779 - Update builtin libffi to fix a Powerpc issue with parameters of type long
- Allow unmodified sourcing of (the ruby code of) this gem in JRuby and TruffleRuby as a default gem. #747
- Improve check to detect if a module has a #find_type method suitable for
FFI
. This fixes compatibility with stdlibmkmf
. #776
Removed:
- Reject callback with
:string
return type at definition, because it didn't work so far and is not save to use. #751, #782
1.12.2 / 2020-02-01
- Fix possible segfault at FFI::Struct#[] and []= after GC.compact . #742
1.12.1 / 2020-01-14
Added:
- Add binary gem support for ruby-2.7 on Windows
1.12.0 / 2020-01-14
Added:
- FFI::VERSION is defined as part of
require 'ffi'
now. It is no longer necessary torequire 'ffi/version'
.
Changed:
- Update libffi to latest master.
Deprecated:
- Overwriting struct layouts is now warned and will be disallowed in ffi-2.0. #734, #735
1.11.3 / 2019-11-25
Removed:
- Remove support for tainted objects which cause deprecation warnings in ruby-2.7. #730
1.11.2 / 2019-11-11
Added:
- Add DragonFlyBSD as a platform. #724
Changed:
- Sort all types.conf files, so that files and changes are easier to compare.
- Regenerated type conf for freebsd12 and x86_64-linux targets. #722
- Remove MACOSX_DEPLOYMENT_TARGET that was targeting very old version 10.4. #647
- Fix library name mangling for non glibc Linux/UNIX. #727
- Fix compiler warnings raised by ruby-2.7
- Update libffi to latest master.
1.11.1 / 2019-05-20
Changed:
- Raise required ruby version to >=2.0. #699, #700
- Fix a possible linker error on ruby < 2.3 on Linux.
1.11.0 / 2019-05-17
This version was yanked on 2019-05-20 to fix an install issue on ruby-1.9.3. #700
Added:
- Add ability to disable or force use of system libffi. #669
Use like
gem inst ffi -- --enable-system-libffi
. - Add ability to call
FFI
callbacks from outside ofFFI
call frame. #584 - Add proper documentation to
::FFI::Generator
and ::Task - Add gemspec metadata. #696, #698
Changed:
- Fix stdcall on Win32. #649, #669
- Fix load paths for FFI::Generator::Task
- Fix FFI::Pointer#read_string(0) to return a binary String. #692
- Fix benchmark suite so that it runs on ruby-2.x
- Move FFI::Platform::CPU from C to Ruby. #663
- Move FFI::StructByReference to Ruby. #681
- Move FFI::DataConverter to Ruby (#661)
- Various cleanups and improvements of specs and benchmarks
Removed:
- Remove ruby-1.8 and 1.9 compatibility code. #683
- Remove unused spec files. #684
1.10.0 / 2019-01-06
Added:
- Add /opt/local/lib/ to ffi's fallback library search path. #638
- Add binary gem support for ruby-2.6 on Windows
- Add FreeBSD on AArch64 and ARM support. #644
- Add FFI::LastError.winapi_error on Windows native or Cygwin. #633
Changed:
- Update to rake-compiler-dock-0.7.0
- Use 64-bit inodes on FreeBSD >= 12. #644
- Switch time_t and suseconds_t types to long on FreeBSD. #627
- Make register_t long_long on 64-bit FreeBSD. #644
- Fix Pointer#write_array_of_type #637
Removed:
- Drop binary gem support for ruby-2.0 and 2.1 on Windows
1.9.25 / 2018-06-03
Changed:
- Revert closures via libffi. This re-adds ClosurePool and fixes compat with SELinux enabled systems. #621
1.9.24 / 2018-06-02
Security Note:
This update addresses vulnerability CVE-2018-1000201: DLL loading issue which can be hijacked on Windows OS, when a Symbol is used as DLL name instead of a String. Found by Matthew Bush.
Added:
- Added a CHANGELOG file
- Add mips64(eb) support, and mips r6 support. (#601)
Changed:
- Update libffi to latest changes on master.
- Don't search in hardcoded /usr paths on Windows.
- Don't treat Symbol args different to Strings in ffi_lib.
- Make sure size_t is defined in Thread.c. Fixes #609
1.9.23 / 2018-02-25
Changed:
- Fix unnecessary rebuild of configure in darwin multi arch. Fixes #605
1.9.22 / 2018-02-22
Changed:
- Update libffi to latest changes on master.
- Update detection of system libffi to match new requirements. Fixes #617
- Prefer bundled libffi over system libffi on Mac OS.
- Do closures via libffi. This removes ClosurePool and fixes compat with PaX. #540
- Use a more deterministic gem packaging.
- Fix unnecessary update of autoconf files at gem install.
1.9.21 / 2018-02-06
Added:
- Ruby-2.5 support by Windows binary gems. Fixes #598
- Add missing win64 types.
- Added support for Bitmask. (#573)
- Add support for MSYS2 (#572) and Sparc64 Linux. (#574)
Changed:
- Fix read_string to not throw an error on length 0.
- Don't use absolute paths for sh and env. Fixes usage on Adroid #528
- Use Ruby implementation for
which
for better compat with Windows. Fixes #315 - Fix compatibility with PPC64LE platform. (#577)
- Normalize sparc64 to sparcv9. (#575)
Removed:
- Drop Ruby 1.8.7 support (#480)
1.9.18 / 2017-03-03
Added:
- Add compatibility with Ruby-2.4.
Changed:
- Add missing shlwapi.h include to fix Windows build.
- Avoid undefined behaviour of LoadLibrary() on Windows. #553


Laptop Volume Buttons in AwesomeWM
I've been using Arch Linux on my laptop for a while now running Awesome as my window manager.
I've have struggled to find the motivation to actually fix minor inconveniences because of the workarounds that I always seem to find first.
In this post, the inconvenience that I ended up solving is one that laptop users take for granted: the keyboard volume controls.
Initially, I just had trouble getting sound working. Turns out that I just needed to unmute.
Just being overwhelmed by how much I need to read just to return some basic niceities back to my laptop usage, I've defaulted to the command line methods of doing what I need to do rather than read new documentation.
So that means that I've just been using alsamixer
whenever I needed to control my volume since my volume keys did not have any function.
It turned out to be very simple. I just had to add a few lines to my awesome config file (rc.lua
).
awful.key({ }, "XF86AudioMute", function () awful.util.spawn("amixer -c 0 set Master toggle") end),
awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer -c 0 set Master 2+ unmute") end),
awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer -c 0 set Master 2-") end)
These went at the bottom of the globalkeys section in the rc.lua file. I'm not going to cover rc.lua, because if you don't know, then you really need to catch up on some documentation or you will probably screw things up.
I got the XF86* names by running xev
and pressing the buttons. The amixer command -c
flag is specific to my needs, so beware before copy/pasting.
When I get more comfortable with editing rc.lua, I plan on making a more detailed post.
Just taking a break between writing my review for my MetaWatch. Coming soon, I promise.


Feb 27th 2017 by Margaret
At the beginning, we had an overview about what postfix, infix and prefix are by a review about the construction of a tree.
We practiced on drawing a tree in accordance to the simple code to visualize the differences among them:
A. prefix: node + left + right
B. infix: left + node +right
C. postfix: left + right + node
The code of the three different types of tree if posted below:
import turtle
def tree(branchlen,t):
if branchlen>20:
t.forward(branchlen)
t.right(20)
# A
# t.circle(1, None, None)
tree(branchlen-15,t)
# B
# t.circle(1, None, None)
t.left(40)
tree(branchlen-15,t)
# C
# t.circle(1, None, None)
t.right(20)
t.backward(branchlen)
def main():
t=turtle.Turtle()
myWin = turtle.Screen()
t.left(90)
t.up()
t.backward(100)
t.down()
t.color("green")
t.speed(10)
tree(75,t)
myWin.exitonclick()
main()
Apart from working hard to figure out the real sequence of output, we can also have an effortless method by drawing flags beside each node. For example, with infix, a little flag can be drawn on the left side of each node and the sequence is shown as we draw a line to link them up smoothly. Also, you can try to flatten the tree to get a result of infix.
This method can also be utilized when we are expecting different outputs changed by different ways to traverse a tree. For example, when we have a tree as:
class Tree:
def __init__(self, cargo, left=None, right=None):
self.cargo = cargo
self.left = left
self.right = right
def __str__(self):
return str(self.cargo)
tree = Tree("i",Tree("b"),Tree("c",Tree("s")))
def print_tree1(tree):
if tree is None: return
print(tree.cargo, end=" ")
print_tree1(tree.left)
print_tree1(tree.right)
def print_tree2(tree):
if tree is None: return
print_tree2(tree.left)
print(tree.cargo, end=" ")
print_tree2(tree.right)
def print_tree3(tree):
if tree is None: return
print_tree3(tree.left)
print_tree3(tree.right)
print(tree.cargo, end=" ")
print_tree1(tree)
print_tree2(tree)
print_tree3(tree)
- With prefix Tree1, we get: i b c s
- With infix Tree2, we get: b i s c
- With postfix Tree3, we get: b s c i
As we proceed on understanding prefix, infix and postfix well, we start to learn about the RPN calculator.
First of all, we made a comparison between an ordinary calculator and a RPN calculator. It turned out that a RPN calculator need the user to press less buttons and therefore is more convenient and time-efficient to use. Meanwhile, as there is no ambiguous interpretation about the existence of parenthesis and the sequence of calculation in RPN, it is widely used in lots of circumstances where precise calculations are required.
With an ordinary calculator using infix and a RPN calculator using postfix, samples ra given here:
Infix
|
2 * 3 + 5
|
2 * (3 + 5)
|
Postfix
|
2 3 * 5 +
|
2 3 5 + *
|
What actually happens here is that a stack is used in RPN: when a number is appended to the stack, it will accumulate in there, but when a notation such as “+” or “*” is appended, the last two numbers will be “popped” and be calculated. With this logic, a sample code is provided here:
import math
def postfix_evaluation(s):
s = s.split()
n = len(s)
stack = []
for i in range(n):
if s[i].isdigit():
stack.append(int(s[i]))
elif s[i]=="+":
a = stack.pop()
b = stack.pop()
stack.append(int(a)+int(b))
elif s[i] =="*":
a = stack.pop()
b = stack.pop()
stack.append(int(a)*int(b))
elif s[i] =="-":
a = stack.pop()
b = stack.pop()
stack.append(int(a) - int(b))
elif s[i] =="/":
a = stack.pop()
b = stack.pop()
stack.append(int(a)/int(b))
elif s[i] =="%":
a = stack.pop()
b = stack.pop()
stack.append(int(a) % int(b)
return stack.pop()
s = "10 2 8 * + 3 -"
val = postfix_evaluation(s)
print(val)
With the help of it, we can create a calculator with more functions, such as:
- various methods including “-” “/ ” “%” “sin” “cos” etc.
- change the postfix into a normal look by printing out the infix version of it


WITNESS LIST Appropriations Committee July 23, 1998-9:30A Children's Health Insurance On: Alma Gilden (M.D.) Andy Sewell (DDS) Anne Dunkelberg (CPPP) Beverly Zinser (DDS) Dale Rahn (Dental Hygiensts) DeAnn Friedholm (March of Dimes) Don Gilbert (HHSC) Heather Coreenwood (Assc. of Social Workers) Jerry Long (Dental Association) Linda Wertz (HHSC) Lisa McGiffert (Consumers Union) Liz Newhouse (Respite Resource Net.) Reyn Archer (TDH) Robin Moore (Comm. Health Centers) Shirley Hutzler (Health Insurance Agent) Stephen Schwartz (DDS) Susan Murphree (Disability Policy Cons.)


Sister Six (AKA Death Nurse)
Secret Green Mission:
- Collect six or more messages of any color.
Character Abilities:
- 拷問: Whenever you Test another player, you may take a card from that player's hand.
- 搜取: When a player dies, you randomly pick one of the cards from the dead player's hand, and can choose either to add that card to your hand or to your message board.


1 The Regular deck of 52 cards is used in this game.
2 The cards numbered from 2 to 9 equals to the point of their face values.
3 Ace equals 1 point.
4 King, Queen and Joker equals 0.
5 The goal is to predict who will be getting more points, Banker, Player or it will be a tie.
6 Therefore there are 3 spots on which you can bet. On the PLayer, on the Banker or a Tie.
7 The dealer pulls 2 cards for the player and two for the banker. The sum of the cards counts as the point of the player or banker.
8 If the count is over 10 then the digit on the units place is considered in that case. Like if the player gets 2+9 which is 11 the player will get only 1 point.
9 If you guess correct the amount gets doubled.


--- layout: page title: Status header: information Page ---
NOTICE
This is a personal task manager for Pouya Kary and is not officially related to any project hence the task defined here may and may not relate to the actual official project or may just show a personal part of that.


EUR - USD calculator
Loading exchange rates
EUR - WHATEVER calculator
EUR - {{ selectedCurrency }}
Exchangerate for {{ toggled ? 'EUR - ' + selectedCurrency : selectedCurrency + ' - EUR' }}: {{ rate }}


{{ post.date | date: "%B %Y" }}: {% if post.speaker != "N/A" %} {{ post.speaker }} - {% endif %} {{ post.title }}
{{ post.content | truncatewords:40}}
Read More Join Us on Meetup
--- layout: default description: LRDNUG meets monthly at the Innovation Hub in North Little Rock. We cover .NET and other programming technologies. Come to our meetings and see for yourself the benefits of interacting with other Central Arkansas software developers. ---


---
layout: archive
title: Lean Prover Zulip Chat Archive
permalink: 116395maths/56373everypartialordercanbeorderembeddedintoapowerset.html
---
The archive URL format has changed. Please find this page at:
https://leanprover-community.github.io/archive/stream/116395-maths/topic/every.20partial.20order.20can.20be.20order-embedded.20into.20a.20powerset.html


Session (pydent.aqsession
)¶
Session class for interacting with Trident and Aquarium. To initialize a new session, you’ll need your Aquarium login credentials and an Aquarium url:
from pydent import AqSession
session = AqSession('joeshmoe', 'pass123', 'http://myaquariumurl.org`)
Note
To login discretely with a hidden password, you may use
the pydent.login
method.
After initializing a session, models are accessible from the Session:
sample = session.Sample.one()
last50 = session.Item.last(50)
first10 = session.SampleType.first(10)
mysamples = session.Sample.last(10, query={'user_id': 66})
User Objects¶
The AqSession and Browser are the main interaction objects for querying the Aquarium server. The Browser class provides special methods for speeding up and caching results from the server, which is covered in Advanced Topics.
|
Holds an AqHTTP with login information. |
|
A class for browsing models and Aquarium inventory. |
Non-User Objects¶
These modules provide utility support for Trident. These are not relevant for most users.
Session abstract base class. |
|
|
Defines a Python to Aquarium server connection. |
Interfaces¶
Interfaces govern how the session searches, loads, and dumps Aquarium models from the server.
|
Initializer for SessionInterface. |
|
Create, Update, Delete interface. |
|
Makes requests using AqHTTP that are model specific. |
Interface that is used by models to find other models. |
|
|
Generic session interface. |
|
Miscellaneous and specialized requests for creating, updating, etc. |
-
class
pydent.aqsession.
AqSession
(login, password, aquarium_url, name=None, aqhttp=None)[source] Bases:
pydent.sessionabc.SessionABC
Holds an AqHTTP with login information. Creates SessionInterfaces for models.
session1 = AqSession(username, password, aquarium_url) session1.User.find(1) # <User(id=1,...)>
Initializes a new trident Session.
- Parameters
login (str) – the Aquarium login for the user
password (str) – the password for the Aquarium login. This will not be stored anywhere. However, login headers for Aquarium will be stored in .__aqhttp. This may change in the future with changes authentication for the Aquarium API
aquarium_url (str) – the http formatted Aquarium url
name (str or None) – (optional) name for this session
-
_aqhttp
= None requests interface
-
_browser
= None the sessions browser
-
_initialize_interfaces
()[source] Initializes the session’s interfaces.
-
_log_to_aqhttp
(msg)[source] Sends a log message to the aqhttp’s logger.
-
static
_swap_sessions
(from_session, to_session)[source] Moves models from one session to another.
-
property
current_user
Returns the current User associated with this session.
Returns None if no user is found (as in cases where the Aquarium connection is down).
- Return type
-
property
interface_class
Returns the session’s interface class.
- Return type
Type
-
logged_in
()[source] Returns whether the user is logged in. If the session is able to return the User model instance using the session’s login credentials, the user is considered to be logged in.
- Returns
whether user is currently logged in
- Return type
boolean
-
property
login
Logs into aquarium, generating the necessary headers to perform requests to Aquarium.
- Return type
str
-
model_interface
(model_name, interface_class=None)[source] Returns model interface by name.
- Return type
-
property
models
Returns list of all models available.
- Return type
List
[str
]
-
open
()[source] Open Aquarium in a web browser window.
-
ping
(num=5)[source] Performs a number of simple requests (pings) to estimate the speed of the server.
Displays a message about the average time each ping took.
- Return type
Optional
[int
]
-
query
(data, use_cache=False)[source] Perform a complex query a complex JSON query object.
Check out the JSON Schema page for more information.
You may also checkout AqSession.query_schema to view the JSON schema that validates the input.
{ "__model__": "Item", "__description__": "Get available primers in last 7 days", "query": { "object_type": { "query": { "sample_type": { "query": { "name": "Primer" } } } }, "created_at": { "__time__": { "__days__": -7 } }, "location": { "__not__": "deleted" } "__options__": { "limit": 1 } } }
- ..versionadded:: 0.1.5a16
Added query method for complex queries
Changed in version 0.1.5a23: query key now changed to __query__
- Parameters
data (
Dict
) – data queryuse_cache (
bool
) – whether to inherit the cache from the provided session (default: False)
- Return type
List
[ModelBase
]- Returns
list of models fitting the query
- Raises
AquariumQueryLanguageValidationError if input data is invalid.
-
property
session
Return self.
- Return type
-
set_timeout
(timeout_in_seconds)[source] Sets the request timeout.
-
property
url
Returns the aquarium_url for this session.
-
property
utils
Instantiates a utility interface.
-
with_cache
(using_requests=None, using_models=False, timeout=None, verbose=None)[source] - Parameters
using_requests (
Optional
[bool
]) – if False, ForbiddenRequest will be raised if requests are made using the session.using_models (
bool
) – if True (default: False), derived session will inherit the current sessions model_cachetimeout (
Optional
[int
]) – the requests timeout in secondsverbose – if True, verbose mode will be activated for the derived session
- Return type
- Returns


Application complete
Your reference number
{{ pk }}
{{ pk }}
We have sent you a confirmation email.
What happens next
Your application has been sent to the Tradeshow Access Programme team.
They will contact you in the next 2 to 3 weeks using the details you’ve provided to confirm whether your application has been successful or to ask you for any further information.


{% extends "nuvola.html" %} {% import "snippets.html" as snippets %} {% block tab_content %}
The Flathub repository provides GNOME Platform runtime, which is used by Nuvola to share common dependencies with other Flatpak apps to reduce disk & memory usage. The Nuvola Player repository contains Nuvola Player Service and individual integration scripts.
Unfortunately, Flatpak support in elementaryOS is incomplete, so you need to use terminal commands.
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --if-not-exists --user nuvola https://dl.tiliado.eu/flatpak/nuvola.flatpakrepo
flatpak update
It is necessary to restart your computer to activate new flatpak repositories. Unfortunately, just logging out and logging in is not enough.
{{ snippets.about_nuvola_service() }}In order to install Nuvola Player Service, launch AppCenter, search for Nuvola Player Service and finally click the Install button.
Alternatively, launch Terminal application, type the following command and press the Enter key to install this package.
flatpak install nuvola {{ nuvola.uid }}
{{ snippets.install_individual_apps(apps, distro_spec) }}
{% endblock %}


Principal components analysis (alternative to princomp). A simple linear dimensionality reduction technique. Use to create an orthonormal basis for the points in R^d such that the coordinates of a vector x in this basis are of decreasing importance. Instead of using all d basis vectors to specify the location of x, using only the first k<d still gives a vector xhat that is close to x. This function operates on arrays of arbitrary dimension, by first converting the arrays to vectors. If X is m+1 dimensional, say of size [d1 x d2 x...x dm x n], then the first m dimensions of X are combined. X is flattened to be 2 dimensional: [dxn], with d=prod(di). Once X is converted to 2 dimensions of size dxn, each column represents a single observation, and each row is a different variable. Note that this is the opposite of many matlab functions such as princomp. If X is MxNxn, then X(:,:,i) represents the ith observation (useful for stack of n images), likewise for n videos X is MxNxKxn. If X is very large, it is sampled before running PCA. Use this function to retrieve the basis U. Use pcaApply to retrieve that basis coefficients for a novel vector x. Use pcaVisualize(X,...) for visualization of approximated X. To calculate residuals: residuals = cumsum(vars/sum(vars)); plot(residuals,'-.') USAGE [U,mu,vars] = pca( X ) INPUTS X - [d1 x ... x dm x n], treated as n [d1 x ... x dm] elements OUTPUTS U - [d x r], d=prod(di), each column is a principal component mu - [d1 x ... x dm] mean of X vars - sorted eigenvalues corresponding to eigenvectors in U EXAMPLE load pcaData; [U,mu,vars] = pca( I3D1(:,:,1:12) ); [Y,Xhat,avsq] = pcaApply( I3D1(:,:,1), U, mu, 5 ); pcaVisualize( U, mu, vars, I3D1, 13, [0:12], [], 1 ); Xr = pcaRandVec( U, mu, vars, 1, 25, 0, 3 ); See also princomp, pcaApply, pcaVisualize, pcaRandVec, visualizeData Piotr's Computer Vision Matlab Toolbox Version 3.24 Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com] Licensed under the Simplified BSD License [see external/bsd.txt]


Mara's favorite places
Here are some of my favorite places!
These are my three favorites, in order:
Thanks for reading about my favorite places!


Project Manager
Because Nothing Else Fit My Needs
Save All
Clear All
Projects
Milestones
Tasks
Times
Projects Commands:
View
New
Milestone Commands:
View
New
Task Commands:
View
New
Time Commands:
View


The words "design influences" can be understood as both a plural noun and as subject and verb. The plural noun speaks of those who have come before us and paved the way. The verb speaks of the responsibility of design to lead the way. By understanding where we have come from, we have a better idea of where we are going and, perhaps, where we should be heading.


| Location |
Total |
| Point A |
16 |
| Point B |
10 |
| Point C |
14 |
| Point D |
14 |
| Point E |
11 |
| Point F |
15 |
| Location |
Total |
| Point A |
96 |
| Point B |
57 |
| Point C |
84 |
| Point D |
77 |
| Point E |
109 |
| Point F |
122 |
| Age |
Total |
| 1-10 |
15 |
| 11-20 |
12 |
| 21-30 |
3 |
| 31-40 |
0 |
| 41-50 |
0 |
| > 50 |
1 |
| Age |
Total |
| 1-10 |
149 |
| 11-20 |
123 |
| 21-30 |
4 |
| 31-40 |
0 |
| 41-50 |
0 |
| > 50 |
3 |


System Architect Picture "Membership Subject Relation"
Parent Diagram:
Partitive Subject Relation
(UML Class)


You may now login into the website or app! ^^