Apache Felix Framework Launching and Embedding
[This document describes framework launching introduced in Felix 2.0.0 and is incompatible with older versions of the Felix framework.]
Introduction
The Apache Felix framework is intended to be easily launchable and embeddable. For example, Felix avoids the use of system properties for configuration, since these are globals and can cause interference if multiple framework instances are created in the same VM. Felix also tries to multiplex singleton facilities, like the URL stream handler factory. The goal is to make it possible to use Felix in as many scenarios as possible; however, this is still just a goal. In other words, this is a work in progress and if any issues arise, it would be greatly appreciated if they are brought to the attention of the Felix community. The next section provides a Felix API overview, while the remainder of the document is divided into two sections, one focusing on how to launch Felix and one focusing on how to embed Felix into a host application.
API Overview
The Felix framework is implemented by the org.apache.felix.framework.Felix class or just Felix for short. As part of the R4.2 OSGi specification, the launching and embedding API of the OSGi framework has been standardized. The approach is to have the framework implement the org.osgi.framework.launch.Framework interface, which extends the org.osgi.framework.Bundle interface. These interfaces provide the necessary means to launch and manage framework instances. The Bundle interface is defined as:
public interface Bundle { BundleContext getBundleContext(); long getBundleId(); URL getEntry(String name); Enumeration getEntryPaths(String path); Enumeration findEntries(String path, String filePattern, boolean recurse); Dictionary getHeaders(); Dictionary getHeaders(String locale); long getLastModified(); String getLocation(); URL getResource(String name); Enumeration getResources(String name) throws IOException; ServiceReference[] getRegisteredServices(); ServiceReference[] getServicesInUse(); int getState(); String getSymbolicName(); Version getVersion(); boolean hasPermission(Object obj); Class loadClass(String name) throws ClassNotFoundException; void start() throws BundleException; void stop() throws BundleException; void uninstall() throws BundleException; void update() throws BundleException; void update(InputStream is) throws BundleException; }
The Framework interface is defined as:
public interface Framework extends Bundle { void init(); FrameworkEvent waitForStop(); }
To actually construct a framework instance, the R4.2 specification defines the FrameworkFactory interface:
public interface FrameworkFactory { Framework newFramework(Map configMap); }
The framework factory can be used to create configured framework instances. It is obtained following the standard META-INF/services approach.
Creating and Configuring the Framework Instance
You use the framework factory to construct and configure a framework instance (or by directly instantiating the Felix class). The configuration map may contain the following OSGi standard properties:
- org.osgi.framework.system.packages - specifies a list of packages the system bundle should export from the environment; if this is not set, then the framework uses a reasonable default fault.
- org.osgi.framework.system.packages.extra - specifies a list of additional packages the system bundle should export from the environment that are appended to the packages specified in org.osgi.framework.system.packages; there is no default value for this property.
- org.osgi.framework.bootdelegation - specifies a list of packages that should be made implicitly available to all bundles from the environment (i.e., no need to import them); there is no default value for this property and its use should be avoided.
- org.osgi.framework.storage - specifies the path to a directory, which will be created if it does not exist, to use for bundle cache storage; the default value for this property is "felix-cache" in the current working directory.
- org.osgi.framework.storage.clean - specifies whether the bundle cache should be flushed; the default value for this property is "none", but it can be changed to "onFirstInit" to flush the bundle cache when the framework is initialized.
- org.osgi.framework.startlevel.beginning - specifies the start level the framework enters upon startup; the default value for this property is 1.
Felix also has the following, non-standard configuration properties:
- felix.cache.rootdir - specifies which directory should be used to calculate absolute paths when relative paths are used for the org.osgi.framework.storage property; the default value for this property is the current working directory.
- felix.systembundle.activators - specifies a List of BundleActivator instances that are started/stopped when the System Bundle is started/stopped; the specified instances will receive the System Bundle's BundleContext when invoked.
- felix.log.logger - specifies an instance of org.apache.felix.framework.util.Logger that the framework uses as its default logger.
- felix.log.level - specifies an integer String whose value indicates the degree of logging reported by the framework; the default value is "1" and "0" turns off logging completely, otherwise log levels match those specified in the OSGi Log Service (i.e., 1 = error, 2 = warning, 3 = information, and 4 = debug).
- felix.startlevel.bundle - specifies the start level for newly installed bundles; the default value is 1.
- felix.bootdelegation.implicit - specifies whether or not the framework should try to guess when to boot delegate when external code tries to load classes or resources; the default value is "true".
- framework.service.urlhandlers - specifies whether or not to activate the URL Handlers service for the framework instance; the default value is "true", which results in the URL.setURLStreamHandlerFactory() and URLConnection.setContentHandlerFactory() being called.
The configuration map is copied and the keys are treated as case insensitive. You are not able to change the framework's configuration after construction. If you need a different configuration, you must create a new framework instance.
| WARNING Felix configuration properties have change considerably starting from 1.4.0; if you are upgrading from an earlier version, the usage document describes the configuration property changes. |
Starting the Framework Instance
The start() method is used to start the framework instance. If the init() method was not invoked prior to calling start(), then it is invoked by start(). The two methods result in two different framework state transitions:
- init() results in the framework instance in the Bundle.STARTING state.
- start() results in the framework instance in the Bundle.ACTIVE state.
The init() method is necessary since the framework does not have a BundleContext when it is first created, so a transition to the Bundle.STARTING state is required to acquire its context (via Bundle.getBundleContext()) for performing various tasks, such as installing bundles. Note that Felix also provides the felix.systembundle.activators property that serves a similar purpose, but is not standard. After the init() method completes, the follow actions have been performed:
- Event handling is enabled.
- The security manager is installed if it is enabled.
- The framework is set to start level 0.
- All bundles in the bundle caches are reified and their state is set to Bundle.INSTALLED.
- The framework gets a valid BundleContext.
- All framework-provided services are made available (e.g., PackageAdmin, StartLevel, etc.).
- The framework enters the Bundle.STARTING state.
A call to start() is necessary to start the framework instance, if the init() method is invoked manually. Invoking init() or start() on an already started framework as no effect.
Stopping the Framework Instance
To stop the framework instance, invoke the stop() method, which will asynchronously stop the framework. To know when the framework has finished its shutdown sequence, use the waitForStop() method to wait until it is complete. A stopped framework will be in the Bundle.RESOLVED state. It is possible to restart the framework, using the normal combination of init()/start() methods as previously described.
Launching a Framework
Launching a framework is fairly simple and involves only four steps:
- Define some configuration properties.
- Obtain framework factory.
- Use factory to create framework with the configuration properties.
- Invoke the Framework.start() method.
In reality, the first step is optional, since all properties will have reasonable defaults, but if you are creating a launcher you will generally want to more than that, such as automatically installing and starting bundles when you start the framework instance. The default Felix launcher defines reusable functionality to automatically install and/or start bundles upon framework startup; see the usage document for more information on configuring Felix and on the various configuration properties.
The remainder of this section describes how the standard Felix launcher works as well as how to create a custom launcher for Felix.
Standard Felix Framework Launcher
The standard Felix launcher is very simple and is not intended to solve every possible requirement; it is intended to work for most standard situations. Most special launching requirements should be resolved by creating a custom launcher. This section describes how the standard launcher works. The following code represents the complete main() method of the standard launcher, each numbered comment will be described in more detail below:
public static void main(String[] args) throws Exception { // (1) Check for command line arguments and verify usage. String bundleDir = null; String cacheDir = null; boolean expectBundleDir = false; for (int i = 0; i < args.length; i++) { if (args[i].equals(BUNDLE_DIR_SWITCH)) { expectBundleDir = true; } else if (expectBundleDir) { bundleDir = args[i]; expectBundleDir = false; } else { cacheDir = args[i]; } } if ((args.length > 3) || (expectBundleDir && bundleDir == null)) { System.out.println("Usage: [-b <bundle-deploy-dir>] [<bundle-cache-dir>]"); System.exit(0); } // (2) Load system properties. Main.loadSystemProperties(); // (3) Read configuration properties. Properties configProps = Main.loadConfigProperties(); if (configProps == null) { System.err.println("No " + CONFIG_PROPERTIES_FILE_VALUE + " found."); configProps = new Properties(); } // (4) Copy framework properties from the system properties. Main.copySystemProperties(configProps); // (5) Use the specified auto-deploy directory over default. if (bundleDir != null) { configProps.setProperty(AutoProcessor.AUTO_DEPLOY_DIR_PROPERY, bundleDir); } // (6) Use the specified bundle cache directory over default. if (cacheDir != null) { configProps.setProperty(Constants.FRAMEWORK_STORAGE, cacheDir); } // (7) Add a shutdown hook to clean stop the framework. String enableHook = configProps.getProperty(SHUTDOWN_HOOK_PROP); if ((enableHook == null) || !enableHook.equalsIgnoreCase("false")) { Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { if (m_fwk != null) { m_fwk.stop(); m_fwk.waitForStop(0); } } catch (Exception ex) { System.err.println("Error stopping framework: " + ex); } } }); } // Print welcome banner. System.out.println("\nWelcome to Felix"); System.out.println("================\n"); try { // (8) Create an instance and initialize the framework. FrameworkFactory factory = getFrameworkFactory(); m_fwk = factory.newFramework(configProps); m_fwk.init(); // (9) Use the system bundle context to process the auto-deploy // and auto-install/auto-start properties. AutoProcessor.process(configProps, m_fwk.getBundleContext()); // (10) Start the framework. m_fwk.start(); // (11) Wait for framework to stop to exit the VM. m_fwk.waitForStop(0); System.exit(0); } catch (Exception ex) { System.err.println("Could not create framework: " + ex); ex.printStackTrace(); System.exit(-1); } }
The general steps of the standard launcher are quite straightforward:
- The launcher supports setting the auto-deploy directory (with the -b switch) and setting the bundle cache path with a single argument, so check for this and issue a usage message it there are more than one arguments.
- Load any system properties specified in the system.properties file; this file is typically located in the conf/ directory of the Felix installation directory, but it can be specified directly using the felix.system.properties system property. This file is not needed to launch Felix and is provided merely for convenience when system properties must be specified. The file is a standard Java properties file, but it also supports property substitution using ${<property-name} syntax. Property substitution can be nested; only system properties will be used for substitution.
- Load any configuration properties specified in the config.properties file; this file is typically located in the conf/ directory of the Felix installation directory, but it can be specified directly using the felix.config.properties system property. This file is used to configure the Felix instance created by the launcher. The file is a standard Java properties file, but it also supports property substitution using "${<property-name>}" syntax. Property substitution can be nested; configuration and system properties will be used for substitution with configuration properties having precedence.
- For convenience, any configuration properties that are set as system properties are copied into the set of configuration properties. This provide an easy way to add to or override configuration properties specified in the config.properties file, since the Felix instance will never look at system properties for configuration.
- If the -b switch was used to specify an auto-deploy directory, then use that to set the value of felix.auto.deploy.dir.
- If a single command-line argument is specified, then use that to set the value of org.osgi.framework.storage; relative paths are relative to the current directory unless the felix.cache.rootdir property is set.
- Add a shutdown hook to cleanly stop the framework, unless the hook is disabled.
- Create a framework instance using the FrameworkFactory passing in the configuration properties, then initialize the factory instance; see the custom launcher example below to see how the META-INF/services FrameworkFactory is obtained.
- Use org.apache.felix.main.AutoProcessor, which will automatically deploy any bundles in the auto-deploy directory as well as bundles specified in the felix.auto.install and felix.auto.start configuration properties during framework startup to automatically install and/or start bundles; see the usage document for more information configuration properties and bundle auto-deploy.
- Invoke waitForStop() to wait for the framework to stop to force the VM to exit; this is necessary because the framework never calls System.exit() and some libraries (e.g., Swing) create threads that will not allow the VM to exit.
The framework is not active until the start() method is called. If no shell bundles are installed and started or if there is difficulty locating the shell bundles specified in the auto-start property, then it will appear as if the framework is hung, but it is actually running without any way to interact with it since the shell bundles provide the only means of interaction.
Custom Framework Launcher
This section creates a bare-bones launcher to demonstrate the minimum requirements for creating an interactive launcher for the Felix framework. This example uses the standard Felix shell bundles for interactivity, but any other bundles could be used instead. For example, the shell service and telnet bundles could be used to launch Felix and make it remotely accessible.
This example launcher project has the following directory structure:
launcher/ lib/ org.apache.felix.main-2.0.0.jar bundle/ org.apache.felix.shell-1.4.0.jar org.apache.felix.shell.tui-1.4.0.jar src/ example/ Main.java
The lib/ directory contains Felix' main JAR file, which also contains the OSGi core interfaces. The main JAR file is used so that we can reuse the default launcher's auto-install/auto-start configuration property handling; if these capabilities are not needed, then it would be possible to use the framework JAR file instead of the main JAR file. The bundle/ directory contains the shell service and textual shell interface bundles that will be used for interacting with the framework instance. Note: If you do not launch Felix with interactive bundles, it will appear as if the framework instance is hung, but it is actually just sitting there waiting for someone to tell it to do something. The src/example/ directory contains the following Main.java file, which is a very simplistic Felix launcher.
package example; import java.io.*; import org.osgi.framework.launch.*; import org.apache.felix.main.AutoProcessor; public class Main { private static Framework m_fwk = null; public static void main(String[] argv) throws Exception { // Print welcome banner. System.out.println("\nWelcome to Felix."); System.out.println("=================\n"); try { m_fwk = getFrameworkFactory().newFramework(null); m_fwk.init() AutoProcessor.process(null, m_fwk.getBundleContext()); m_fwk.start(); m_fwk.waitForStop(); System.exit(0); } catch (Exception ex) { System.err.println("Could not create framework: " + ex); ex.printStackTrace(); System.exit(-1); } } private static FrameworkFactory getFrameworkFactory() throws Exception { URL url = Main.class.getClassLoader().getResource( "META-INF/services/org.osgi.framework.launch.FrameworkFactory"); if (url != null) { BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); try { for (String s = br.readLine(); s != null; s = br.readLine()) { s = s.trim(); // Try to load first non-empty, non-commented line. if ((s.length() > 0) && (s.charAt(0) != '#')) { return (FrameworkFactory) Class.forName(s).newInstance(); } } } finally { if (br != null) br.close(); } } throw new Exception("Could not find framework factory."); } }
This launcher relies on the default behavior of AutoProcessor to automatically deploy the shell bundles. This simple, generic launcher provides a good starting point if the default Felix launcher is not sufficient. Since very few configuration properties are specified, the default values are used. For the bundle auto-deploy directory, "bundle" in the current directory is used, while for the framework bundle cache, "felix-cache" in the current directory is used.
By breaking down the above source code into small chunks, it is quite easy to see what is going on.
m_fwk = getFrameworkFactory().newFramework(null);
m_fwk.init()
These steps get a the framework factory service and use it to create a framework instance with a default configuration. Once the framework instance is created, it is initialized with init().
AutoProcessor.process(null, m_fwk.getBundleContext());
The AutorProcessor will automatically deploy bundles in the auto-deploy directory and any referenced from the auto-install/start properties. Since we are using an empty configuration, the auto-deploy directory is the bundle directory in the current directory and there are no auto properties. Therefore, in this case, the two shell bundles will be installed.
m_fwk.start();
m_fwk.waitForStop();
System.exit(0);
These final steps start the framework and cause the launching application thread to wait for the framework to stop and when it does the launching thread calls System.exit() to make sure the VM actually exits.
private static FrameworkFactory getFrameworkFactory() throws Exception { ... }
This method retrieves the framework factory service by doing a META-INF/services resource lookup, which it can use to obtain the concrete class name for the factory. If you are using Java 6, then you can use the ServiceLoader API in the JRE to further simplify the factory service lookup.
The following command compiles the launcher when run from the root directory of the launcher project:
javac -d . -classpath lib/org.apache.felix.main-2.0.0.jar src/example/Main.java
After executing this command, an example/ directory is created in the current directory, which contains the generated class file. The following command executes the simple launcher when run from the root directory of the launcher project:
java -cp .:lib/org.apache.felix.main-2.0.0.jar example.Main
After executing this command, a "felix-cache/" directory is created that contains the cached bundles, which were installed from the bundle/ directory.
Embedding Felix
Embedding Felix into a host application is a simple way to provide a sophisticated extensibility mechanism (i.e., a plugin system) to the host application. Embedding Felix is very similar to launching Felix as described above, the main difference is that the host application typically wants to interact with the framework instance and/or installed bundles/services from the outside. This is fairly easy to achieve with Felix, but there are some subtle issues to understand. This section presents the mechanisms for embedding Felix into a host application and the issues in doing so.
Host/Felix Interaction
In the section on launching Felix above, the Felix accepts a configuration property called felix.systembundle.activators, which is a list of bundle activator instances. These bundle activator instances provide a convenient way for host applications to interact with the Felix framework. The ability offered by these activators can also be accomplished by invoking init() on the framework instance and the using getBundleContext() to get the System Bundle's context, but it can be more convenient to use an activator instance.
Each activator instance passed into the constructor effectively becomes part of the System Bundle. This means that the start()/stop() methods of each activator instance in the list gets invoked when the System Bundle's activator start()/stop() methods gets invoked, respectively. Each activator instance will be given the System Bundle's BundleContext object so that they can interact with the framework. Consider following snippet of a bundle activator:
public class HostActivator implements BundleActivator { private BundleContext m_context = null; public void start(BundleContext context) { m_context = context; } public void stop(BundleContext context) { m_context = null; } public Bundle[] getBundles() { if (m_context != null) { return m_context.getBundles(); } return null; } }
Given the above bundle activator, it is now possible to embed Felix into a host application and interact with it as the following snippet illustrates:
public class HostApplication { private HostActivator m_activator = null; private Felix m_felix = null; public HostApplication() { // Create a configuration property map. Map configMap = new HashMap(); // Create host activator; m_activator = new HostActivator(); List list = new ArrayList(); list.add(m_activator); configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); try { // Now create an instance of the framework with // our configuration properties. m_felix = new Felix(configMap); // Now start Felix instance. m_felix.start(); } catch (Exception ex) { System.err.println("Could not create framework: " + ex); ex.printStackTrace(); } } public Bundle[] getInstalledBundles() { // Use the system bundle activator to gain external // access to the set of installed bundles. return m_activator.getBundles(); } public void shutdownApplication() { // Shut down the felix framework when stopping the // host application. m_felix.stop(); m_felix.waitForStop(); } }
Notice how the HostApplication.getInstalledBundles() method uses its activator instance to get access to the System Bundle's context in order to interact with the embedded Felix framework instance. This approach provides the foundation for all interaction between the host application and the embedded framework instance.
Providing Host Application Services
Providing services from the host application to bundles inside the embedded Felix framework instance follows the basic approach laid out in above. The main complication for providing a host application service to bundles is the fact that both the host application and the bundles must be using the same class definitions for the service interface classes. Since the host application cannot import classes from a bundle, this means that the service interface classes must be accessible on the class path, typically as part of the host application itself. The host application then must export the service interface package via the system bundle so that bundles installed into the embedded framework instance can import it. This is achieved using the org.osgi.framework.system.packages.extra configuration property previously presented.
Consider the follow simple property lookup service:
package host.service.lookup; public class Lookup { public Object lookup(String name); }
This package is simply part of the host application, which is potentially packaged into a JAR file and started with the "java -jar" command. Now consider the following host application bundle activator, which will be used to register/unregister the property lookup service when the embedded framework instance starts/stops:
package host.core; import java.util.Map; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import host.service.lookup; public class HostActivator implements BundleActivator { private Map m_lookupMap = null; private BundleContext m_context = null; private ServiceRegistration m_registration = null; public HostActivator(Map lookupMap) { // Save a reference to the service's backing store. m_lookupMap = lookupMap; } public void start(BundleContext context) { // Save a reference to the bundle context. m_context = context; // Create a property lookup service implementation. Lookup lookup = new Lookup() { public Object lookup(String name) { return m_lookupMap.get(name); } }; // Register the property lookup service and save // the service registration. m_registration = m_context.registerService( Lookup.class.getName(), lookup, null); } public void stop(BundleContext context) { // Unregister the property lookup service. m_registration.unregister(); m_context = null; } }
Given the above host application bundle activator, the following code snippet shows how the host application could create an embedded version of the Felix framework and provide the property lookup service to installed bundles:
package host.core; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import host.service.lookup.Lookup; import org.apache.felix.framework.Felix; import org.apache.felix.framework.util.FelixConstants; import org.osgi.framework.Constants; public class HostApplication { private HostActivator m_activator = null; private Felix m_felix = null; private Map m_lookupMap = new HashMap(); public HostApplication() { // Initialize the map for the property lookup service. m_lookupMap.put("name1", "value1"); m_lookupMap.put("name2", "value2"); m_lookupMap.put("name3", "value3"); m_lookupMap.put("name4", "value4"); // Create a configuration property map. Map configMap = new HashMap(); // Export the host provided service interface package. configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "host.service.lookup; version=1.0.0"); // Create host activator; m_activator = new HostActivator(m_lookupMap); List list = new ArrayList(); list.add(m_activator); configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); try { // Now create an instance of the framework with // our configuration properties. m_felix = new Felix(configMap); // Now start Felix instance. m_felix.start(); } catch (Exception ex) { System.err.println("Could not create framework: " + ex); ex.printStackTrace(); } } public void shutdownApplication() { // Shut down the felix framework when stopping the // host application. m_felix.stop(); m_felix.waitForStop(); } }
Rather than having the host application bundle activator register the service, it is also possible for the the host application to simply get the bundle context from the bundle activator and register the service directly, but the presented approach is perhaps a little cleaner since it allows the host application to register/unregister the service when the system bundle starts/stops.
Using Services Provided by Bundles
Using services provided by bundles follows the same general approach of using a host application bundle activator. The main complication for the host application using a service from a bundle is the fact that both the host application and the bundle must be using the same class definitions for the service interface classes. Since the host application cannot import classes from a bundle, this means that the service interface classes must be accessible on the class path, typically as part of the host application itself. The host application then must export the service interface package via the system bundle so that bundles installed into the embedded framework instance can import it. This is achieved using the org.osgi.framework.system.packages.extra configuration property previously presented.
Consider the following simple command service interface for which bundles provide implementations, such as might be used to create an extensible interactive shell:
package host.service.command; public class Command { public String getName(); public String getDescription(); public boolean execute(String commandline); }
This package is simply part of the host application, which is potentially packaged into a JAR file and started with the "java -jar" command. Now consider the previously introduced host application bundle activator below, which simply provides access to the system bundle context:
package host.core; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class HostActivator implements BundleActivator { private BundleContext m_context = null; public void start(BundleContext context) { m_context = context; } public void stop(BundleContext context) { m_context = null; } public BundleContext getContext() { return m_context; } }
With this bundle activator, the host application can use command services provided by bundles installed inside its embedded Felix framework instance. The following code snippet illustrates one possible approach:
package host.core; import java.util.List; import java.util.ArrayList; import java.util.Map; import host.service.command.Command; import org.apache.felix.framework.Felix; import org.apache.felix.framework.util.FelixConstants; import org.apache.felix.framework.cache.BundleCache; import org.osgi.framework.Constants; import org.osgi.util.tracker.ServiceTracker; public class HostApplication { private HostActivator m_activator = null; private Felix m_felix = null; private ServiceTracker m_tracker = null; public HostApplication() { // Create a configuration property map. Map configMap = new HashMap(); // Export the host provided service interface package. configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "host.service.command; version=1.0.0"); // Create host activator; m_activator = new HostActivator(); List list = new ArrayList(); list.add(m_activator); configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list); try { // Now create an instance of the framework with // our configuration properties. m_felix = new Felix(configMap); // Now start Felix instance. m_felix.start(); } catch (Exception ex) { System.err.println("Could not create framework: " + ex); ex.printStackTrace(); } m_tracker = new ServiceTracker( m_activator.getContext(), Command.class.getName(), null); m_tracker.open(); } public boolean execute(String name, String commandline) { // See if any of the currently tracked command services // match the specified command name, if so then execute it. Object[] services = m_tracker.getServices(); for (int i = 0; (services != null) && (i < services.length); i++) { try { if (((Command) services[i]).getName().equals(name)) { return ((Command) services[i]).execute(commandline); } } catch (Exception ex) { // Since the services returned by the tracker could become // invalid at any moment, we will catch all exceptions, log // a message, and then ignore faulty services. System.err.println(ex); } } return false; } public void shutdownApplication() { { // Shut down the felix framework when stopping the // host application. m_felix.stop(); m_felix.waitForStop(); } }
The above example is overly simplistic with respect to concurrency issues and error conditions, but it demonstrates the overall approach for using bundle-provided services from the host application.
Using Bundle Services via Reflection
It possible for the host application to use services provided by bundles without having access to the service interface classes and thus not needing to put the service interface classes on the class path. To do this, the host application uses the same general approach to acquire the system bundle context object, which it can use to look up service objects. Using either an LDAP filter or the service interface class name, the host application can retrieve the service object and then use standard Java reflection to invoke methods on the service object.
Other Approaches
The Transloader project is another attempt at dealing with issues of classes loaded from different class loaders and may be of interest.
Caveat
The code in this document has not been thoroughly tested nor even compiled and may be out of date with respect to the current Felix source code. If you find errors please report them so the that they can be corrected.
Feedback
Subscribe to the Felix users mailing list by sending a message to<EMAIL_ADDRESS>after subscribing, email questions or feedback to users@felix.apache.org.


|
Simple JSON for C
|
Simple JSON for C. More...
#include <stddef.h>
Go to the source code of this file.
Typedefs | |
| typedef struct s_json | s_json_t |
Enumerations | |
| enum | s_json_err_t { S_JSON_OK = 0, S_JSON_NOT_FOUND, S_JSON_ERR_NO_MEM, S_JSON_ERR_PARSE, S_JSON_ERR_WRONG_JSON, S_JSON_ERR_WRONG_ROOT, S_JSON_ERR_INTERNAL } |
Functions | |
| s_json_t * | s_json_init (const char *json_string, size_t json_string_len, s_json_err_t *rc) |
| int | s_json_int (s_json_t *json, const char *json_path, int root_object_index, s_json_err_t *rc) |
| long | s_json_long (s_json_t *json, const char *json_path, int root_object_index, s_json_err_t *rc) |
| double | s_json_double (s_json_t *json, const char *json_path, int root_object_index, s_json_err_t *rc) |
| float | s_json_float (s_json_t *json, const char *json_path, int root_object_index, s_json_err_t *rc) |
| int | s_json_boolean (s_json_t *json, const char *json_path, int root_object_index, s_json_err_t *rc) |
| char * | s_json_string (s_json_t *json, const char *json_path, int root_object_index, s_json_err_t *rc) |
| void | s_json_string_raw (const char **string_raw, size_t *string_raw_length, s_json_t *json, const char *json_path, int root_object_index, s_json_err_t *rc) |
| int | s_json_object (s_json_t *json, const char *json_path, int root_object_index, s_json_err_t *rc) |
| void | s_json_cleanup (s_json_t *json) |
Simple JSON for C.
| typedef struct s_json s_json_t |
Opaque JSON document object.
| enum s_json_err_t |
A Simple JSON error.
| int s_json_boolean | ( | s_json_t * | json, |
| const char * | json_path, | ||
| int | root_object_index, | ||
| s_json_err_t * | rc | ||
| ) |
Parse true/false to (int)1/(int)0 See s_json_int()
| void s_json_cleanup | ( | s_json_t * | json | ) |
Cleanup the memory resources associated with the given opaque s_json_t object.
| double s_json_double | ( | s_json_t * | json, |
| const char * | json_path, | ||
| int | root_object_index, | ||
| s_json_err_t * | rc | ||
| ) |
See s_json_int()
| float s_json_float | ( | s_json_t * | json, |
| const char * | json_path, | ||
| int | root_object_index, | ||
| s_json_err_t * | rc | ||
| ) |
See s_json_int()
| s_json_t* s_json_init | ( | const char * | json_string, |
| size_t | json_string_len, | ||
| s_json_err_t * | rc | ||
| ) |
Parse the json_string and return an opaque s_json_t object you later use to access json values. You should call s_json_cleanup() when you finish using the object.
| [in] | json_string | The json string to parse. It is not copied to new memory, so it has to exist at least as long as the s_json_t object exists. |
| [in] | json_string_len | The length of the json string. |
| [out] | rc | Used for error handling. Can be NULL. See s_json_err_t for a list of possible errors. |
| int s_json_int | ( | s_json_t * | json, |
| const char * | json_path, | ||
| int | root_object_index, | ||
| s_json_err_t * | rc | ||
| ) |
| [in] | json | A valid/initialized s_json_t object. |
| [in] | json_path | The path of |
| [in] | root_object_index | Set this to 0 if you wan't to search the whole document. If you wan't to search just part of it (inside an object or array) then use the s_json_object() function to get the index of the object/array to search inside of. |
| [out] | rc | Used for error handling. Can be NULL. See s_json_err_t for a list of possible errors. |
| long s_json_long | ( | s_json_t * | json, |
| const char * | json_path, | ||
| int | root_object_index, | ||
| s_json_err_t * | rc | ||
| ) |
See s_json_int()
| int s_json_object | ( | s_json_t * | json, |
| const char * | json_path, | ||
| int | root_object_index, | ||
| s_json_err_t * | rc | ||
| ) |
See s_json_int()
| char* s_json_string | ( | s_json_t * | json, |
| const char * | json_path, | ||
| int | root_object_index, | ||
| s_json_err_t * | rc | ||
| ) |
See s_json_int()
| void s_json_string_raw | ( | const char ** | string_raw, |
| size_t * | string_raw_length, | ||
| s_json_t * | json, | ||
| const char * | json_path, | ||
| int | root_object_index, | ||
| s_json_err_t * | rc | ||
| ) |
See s_json_int()
| [out] | string_raw | NON '\0' terminated string!!! You have to use the string_raw_length parameter to find the end of the string. The string is not malloc()-ed as it still uses the original json_string you passed into the s_json_init() function for the backing memory storage. So it is only valid as long as json_string is valid!!! Do not free() it.!!! |
| [out] | string_raw_length | The length of the returned NON '\0' terminated string. |
When an error happens the string_raw pointer is set to NULL and the string_raw_length is set to 0 and rc (if you didn't pass NULL to it) contains the specific error code.


Home > JavaScript Questions > What will be the output of the code below?
var x = { foo : 1};
var output = (function(){
delete x.foo;
return x.foo;
})();
console.log(output);
The above code will output the following to the console:
undefined
The delete
operator is used to delete the property of an object.
Here, x
is an object which has the property foo
, and as it is a self-invoking function, we will delete the foo
property from object x
.
After doing so, when we try to reference a deleted property foo
, the result is undefined
.


Helix
Introduction
What is Helix? In a nutshell: it's a WebGL 3D/game engine built in Javascript.
I didn't build it to compete with other Javascript 3D engines. Building and maintaining 3D engines is a sort of hobby of mine. It allows me to experiment much more freely than when I'm confined to an existing engine. I do occasionally use it for real projects depending on their requirements.
If you're interested in playing around with it, go ahead! Want to go straight ahead and use it in a professional project, the risk is entirely yours. As the engine is built by me and for myself, you may run into some quirks and pedantries that may be confusing at first. The original code base was ported from a personal C++/DirectX project, and since then large parts of the JS version have been rewritten and remolded. Some concepts from DirectX (blend/stencil states, vertex layouts, ...) stayed in because they were simply good ideas. If you're coming from an old-school Flash background, you may also run into approaches that are similar to the original Away3D "Broomstick" prototype that I developed back in 2010 before it became 4.0.
In any case, I think it's worth making things open source. There may always be things to learn and teach doing so.
Some aspects of note:
- The 3D engine uses a right-handed system, where X points "right", Y into the screen / "forward", and Z "up". This may be different from most Javascript libraries, but it allows for a consistent notion where positive Y means forward. Always. It's also the most common convention in mathematics/physics.
- The engine is built using the Entity/Component/System model. This means objects in the Scene are Entities that can have Components registered to them, defining modular behaviour. More information on this in the documentation.
- Materials are strictly split up in "geometry" code and "lighting model" code. You can focus on writing uncluttered geometry code.
- Some aspects may or may not be supported by the device (hdr rendering, WebGL 2 support). The engine will catch this automatically, but in most cases it's good to provide alternative solutions. Lack of HDR support or adaptive tone mapping may require a different lighting setup.
- "Bones" (used in skinned animations) are always named "joints". It's more correct, and I'm a pedant. There!
- More pedantry: adding and removing children to a scene graph node is called "attaching" and "detaching". I feel it describes more accurately what the relationship between child/parent is.
Getting started
The easiest way to get started is just grabbing and including the .js
files in the build
folder. Take a look at
examples/hello-world
to see how to create a simple scene and render it (the other examples hide a lot of boilerplate
code).
Some important things to note:
HX.init(yourDOMCanvas)
needs to be called before anything else!- You do not need to call
requestAnimationFrame
. Helix handles this internally and exposes theHX.onFrame
Signal. Just bind a function to it, and it will be called every frame.
With this, you're ready to explore the other examples. Easy ones to start:
primitive-texture
primitive-dir-light
primitives
env-map-equirectangular
ggx-lighting
io-md5
sibenik-obj
specular-properties
Building
If you want to change code and re-build the project yourself? Helix's compilation process uses Node.js, npm, and gulp, so be sure to have those installed. Then, in a terminal, simply perform the following steps in the helix directory:
npm install -g gulp
npm install
This will make sure all dependencies are installed. Unless any dependencies change, you need to do this only once.
Then, to compile:
gulp
The newly built files will end up in the build
folder.
If anything goes wrong, make sure you have the latest versions of Node.js and npm installed!
Modules
Helix is divided into several modules, each having their own directory in the src folder and are built to separate files to prevent optional functionality bloating your Javascript includes. Currently these are the following:
helix-core
: the module containing the basic game engine and essential functionality.helix-io
: the module containing non-essential importers.helix-physics
: the module containing the physics engine, which is a wrapper for cannon.js.


Hi! My name is Nemanja Sekulić. I'm a junior Full-stack web developer. My best strength is to learn new things very quickly. It will take a very short time for me to start work in a totally new environment.
I strive to exceed my clients expectations! Skils: WordPress, JavaScript ( AngularJS, Bootstrap), HTML5, CSS3, Java, Spring Framework, MySQL. Thank you for taking time to read through my profile.


Technojitsu is an open source code project for
beginners as well as experienced programmers meant to pick up as well
as cultivate interest in computers and its many major roles played in
present times.
This platform provides a variety of features for related parties which
facilitates interaction between contemporary thinkers with
contemporary times so as to be kept well informed in a fast paced
world.
Projects
A platform to upload projects with simple and precise animations on
real time electronic applications for a better learning and
understanding experience of the same and to be an inspiration for
better and more practical projects which can be used to ease our
everyday lives.
Articles
Articles of the contemporary discoveries and thoughts which decides
the path taken in future or the updates on tech or gizmos which
could make one have a head start in their professional lives or have
secure knowledge of one’s personal life’s privacy and security.
Programming-Lang-Guide
A look into the workings of software/program languages, on the basic
but essential knowledge which one should know so as to enter the
world of data and applications on which we are deliberately
dependent upon in our day to day lives as ones sees through software
like google maps, notes, calendar etc.


Feb 9, 2017 10:35 AM
Topic: Updates from EdLab Studios Fearful Leader: Luke Malone Description: Luke and the members of the EdLab Studios team will report on current projects and plans for the future. Reviews: The "can-miss seminar of the year!" -Brian Hughes "Probably should wear sweatpants to this one!" -Luke Malone "Didn't we do one last week?"  -Lauren Slusser "How come everyone on the video team got a quote except me?" -Andrew Visser III Location: Fifth Floor Pre-Read: This Media: and and RSVP by Friday February 17th. (This seminar is limited to library and EdLab staff) Light Lunch: Subs-unconscious Video: This Seminar will not be recorded because we haven't been replaced by robots yet. Producers: Zoe Logan , Seungkyun Lee


Implementation of multiple approaches to perform inference in high-dimensional models.
| Version: |
0.1-6 |
| Depends: |
scalreg |
| Imports: |
grDevices, graphics, stats, parallel, MASS, glmnet, linprog |
| Suggests: |
Matrix |
| Published: |
2016-03-21 |
| Author: |
Lukas Meier [aut, cre], Ruben Dezeure [aut], Nicolai Meinshausen [aut], Martin Maechler [aut], Peter Buehlmann [aut] |
| Maintainer: |
Lukas Meier <meier at stat.math.ethz.ch> |
| License: |
GPL-2 | GPL-3 [expanded from: GPL] |
| NeedsCompilation: |
no |
| Citation: |
hdi citation info |
| Materials: |
NEWS |
| In views: |
MachineLearning |
| CRAN checks: |
hdi results |


{{ user.first_name }} finds this link interesting. Check it out ! {{ title }}
Also get your account on Bookmark It !


Getting Started (Quickstart)
The easiest way to get started with the Apicurio Studio is to download the quickstart (based on Wildfly) and fire it up! All you need is to have Java (version 8) installed, and you're ready to rock.
Download & Install
- Apicurio Studio {{ latestRelease.tag_name }}
- Unpack the Apicurio Studio Quickstart zip
Configure
The Apicurio Studio quickstart is designed to work automatically if you download and run it on your local machine. If you wish to run it on a different machine, or put it into production, please see our documentation.
Run
- Start WildFly
- Point your browser at Apicurio Studio and log in (or register a new account)!
Or try this...
mkdir ~/apicurio-studio-{{ site.version }} cd ~/apicurio-studio-{{ site.version }} curl -L {{ theasset.browser_download_url }} -o {{ theasset.name }} unzip {{ theasset.name }} cd apicurio-studio-{{ site.version }} ./bin/standalone.sh -c standalone-apicurio.xml


I’ve worked for more than 5 years now to simplify my life, and while I’ve discovered the sublime joys of living a simple life, I’ve realized most people don’t get it.
“Why would I want LESS?” they ask themselves. “Less is less fun, harder, monk-like, boring.”
The simple answer: because life can be so much better with less.
That’s hard to believe if you haven’t tried it, but today I am happier than ever. I’m better off financially than ever, now that I’m out of debt and living blissfully debt-free. I am unencumbered by a crapload of stuff, and I have room in my life for what’s truly important: my family, my writing, and my twin loves of reading and running.
The beautiful thing is that you don’t need to earn more money or buy a bigger house or car or have a bigger company in order to have this better life — you need less of all of that. It’s attainable simply by cutting back.
Here’s how to do it — briefly. This will be familiar to long-time readers, but it’s a necessary primer for newer converts.
Do less. Cut back on your workload, on your commitments, on your schedule, on your todo list. Focus on the things that make the highest impact, and drop everything else. You can do this slowly, over time, but do it consciously. The result is you’ll have more room in your life for other things, you’ll be more effective with your time, and you’ll be less stressed out. Read more.
Have less. If you learn that enjoyment of life isn’t having stuff, you’ll be able to let go of it … and declutter. Having a life with a minimal amount of clutter is so enjoyable, so peaceful, it’s hard to describe. It leaves you feeling free, without the stress that comes with an overwhelming amount of stuff, and leaves room in your life for relaxation. Less of a focus on buying stuff means you also have more money, or less debt, or you need to work less in order to live the life you want. Any of those options are good.
Produce less. This is nonsensical to a lot of people — after all, aren’t we all trying to Get Things Done? To Get More Done? Well, that’s the norm, I’ll grant you that — people seem to think that producing grand amounts is great — to write a prodigious amount, to code a prodigious amount, to create a ton of products, to churn out services at an astronomical rate, to have more billable hours than anyone else. Well, that’s fine if you want your life to be all about churning out stuff, but not if you’re concerned about quality, about beauty, about meaning, and about having a life outside of producing. Instead, try producing less — spend more time making better things. Spend more time editing your work down to less, leaving only the most essential parts. Embrace a philosophy that work which is edited down to a minimum is better than volume.
Consume less. This is about how many resources we consume, how much we eat, how much waste we produce from our consumption. Instead of consuming, focus on enjoying what you have, preserving the beauty in what you’ve attained, being content with what’s already around you.
Connect online less. I love connecting with others online. Unfortunately, it consumes our lives if we let it. So if you do a lot of connecting online, through email and web surfing and blog reading and Twittering and Facebooking and what have you … cut back a little. Disconnect from time to time. Read the beta version of my book, Focus.
Connect with others, and your passions, more. Ah, here’s the good part. This is how your life becomes better, not worse, in living a life with less. It’s better because you disconnect from the online world in order to connect with what’s truly important: your loved ones, real people in the real world, and the things you really love doing. You’ve cut things out of your life not just for the sake of cutting, but for the sake of making room for what you’re really passionate about.
Edit, edit. Simplifying isn’t a one-step process of cutting things out. It’s an ongoing process, not only of simplifying but of putting a focus on what’s essential … and then continuing to edit. Think of your life as a work of art, and you as the artist. Come back to it and make it more beautiful by whittling away the unnecessary. Then come back and do it again, and again, until all you’re left with is what’s most beautiful, what’s most essential.
Life can really be better with less, if what’s left is what you love.
—
Posted with :


06 December 1996
Disease Outbreak Reported
The UNHCR has reported on action taken as a result of the laboratory confirmation of cholera on 23 November in a refugee from a Kigoma holding centre. Cholera has since been confirmed in all three holding centres in Kigoma town. As at 4 December, 1 100 cases of presumed cholera had been detected (note: the case definition of presumed cholera is only "watery diarrhoea") in the refugee population; six were fatal - three among children under 10 years of age and three in patients over 60 years of age. Six percent of the 1 100 presumed cases required IV rehydration. The population in the holding centres is estimated at 25 000. The number fluctuates as refugees continue to arrive from Zaire and others are transferred from the holding centres to the camps. Based on a total refugee population at risk the 1 100 cases detected correspond to a daily incidence of watery diarrhoea of 5-8 per 1 000. Incidence of bloody diarrhoea is 2 to 3 per thousand per day.
Action taken: Improving water, sanitation and living conditions in all three Kigoma holding centres was the first priority. Latrines have been built, water is now available almost continuously and trucks are transporting people out of the holding centres to the camps at a rate of 1 000 persons per day, weather permitting. Daily surveillance of diarrhoeal disease in all camps and holding centres by IRC, MSF and UNHCR is coupled with active case-finding in the holding centres by community health workers. MSF has set up an emergency treatment area in one of the holding centres for oral and IV rehydration and strict hygienic control of the cholera patients. Nyarugusu Camp, which is receiving most of the refugees transferred out of the holding centres, is also ready to treat patients with cholera. Ujiji Hospital, which has a special diarrhoea ward, is being upgraded by MSF logistics. Wards are being rebuilt, electricity is brought in, extra latrines are under construction. Forty extra beds, in addition to the existing 10, will be made available this week. Vibrio cholerae cultures obtained from both refugees and locals have been sent to the Tanzanian Reference Laboratory for confirmation, grouping and sensitivity testing. Supplies have also been ordered to allow the local laboratory technician to work on identification and sensitivity testing of cholera strains, as well as shigella strains, should a shigella outbreak occurs.
(Source: A report by UNHCR Health Coordinator in Kigoma. GLR Health Information Network, No. 6)
A WHO epidemiologist from the Global Cholera Task Force is joining the international team in Kigoma today.


About
Do I really need to worry about the department itself?
Absolutely! No matter where you go to school, your major is determined by the faculty that comprise that particular department. These professors are the individuals whom you will spend a lot of time with in classes, laboratories and in completing homework assignments and projects. They help to shape your future and take great interest in their students. You’ll find SVSU’s Department of Computer Science & Information Systems is staffed by qualified, competent professionals who are committed to teaching and research. We are here to help you grow and succeed in your academic and professional career. Our class sizes are small compared to other institutions and you’ll get to know and work with the CSIS faculty one-on-one. This helps to foster a learning environment aimed at student success.
Here are some of the reasons why SVSU’s CSIS Department is superior to other institutions:
- 1) Quality Instruction
- Faculty have the necessary education and experience to bring real world knowledge into their classrooms. SVSU prides itself on being a teaching institution and the Department continually strives to provide the best instruction on campus. Our programs and our curriculum are continually evaluated and change as the computing field and industry evolve. We put a lot of effort into trying to keep our programs as up-to-date as possible and bring in new technology wherever we can.
- 2) Capstone Projects
- How would you like to work on a real-world project while still an undergraduate? That’s exactly what the capstone projects in each major do. When you are a senior you’ll find out what it’s really like to be in industry because you’ll be building up a large scale system under the guidance of a CSIS faculty member. Few other institutions afford their students this unique learning opportunity.
- 3) Computer Laboratories
- You’ll find that the university provides numerous computer labs throughout the campus that are automatically updated with the newest equipment every two to three years. Additionally, the CSIS Department has specialized labs for computer networking, computer forensics and capstone classes/projects. Furthermore most faculty use the online VSpace electronic learning environment to enrich your education.
- 4) Use of the Latest Software
- The Department provides hands-on instruction using the latest and most popular software packages available, including both open source and commercial systems such as Visual Studio, PHP, C++, Linux, Windows, IIS, Apache, Microsoft Project, Visio, mySQL, Oracle, SQL Server, Expression Studio and DreamWeaver.
- 5) Tutoring/Advising
- Need some extra help? We have tutors available to help students out when they need it. The caring faculty of the Department also maintain regular office hours and are ready to assist whenever called upon. We also work with students in planning their schedules through one-on-one advising as well as offering career information.
- 6) Computer Laboratories
- The CSIS Department uses open source software where applicable and students may freely download the same software for their personal computers. The Department also participates in the Microsoft Academic Alliance which means that students have free access to the same applications, development tools, operating systems and server software for their personal computers as that used in classes and labs.
- 7) Preparation for Graduate School
- We have had many students interesting in going on to grad school. Those students who did pursue higher education found that they were well prepared from their undergrad studies. Many faculty provide opportunities for students to participate in research projects and/or independent studies that allow students to further pursue their personal interests. Students receive shared credit for the research and often present at conferences.
- 8) Networking with Industry
- The Department maintains close ties to local industry. This means that CSIS students have the ability to land internships, co-op positions and part-time employment in their field while still an undergraduate. In addition to a paycheck, the experience this opportunity provides goes a long way toward landing that first job after graduation. Many employers also contact the Department directly when they are looking to hire new recruits for full time positions.
- 9) Student Networking
- Want more face-to-face time with your peers? The Department has an active student chapter of the Association for Computing Machinery (ACM). This group puts on numerous talks, training sessions and gaming nights each year as well as hosting the annual high school programming contest. The ACM is a professional society and becoming active as a student looks great on your resume. You may even consider sharpening your leadership skills by becoming a board member of the chapter.


--- layout: post title: This, that and the other tags: - JavaScript status: draft type: post published: false meta: _edit_last: '2' ---
Explain all of the different scope bits


Your new wallet seed is:
Please write this down on paper or in a password manager, you will need this to access your wallet. Do not let anyone see this seed or they can take your Ether.


Chapter 4 Properties of single loci
4.1 Introduction
too easy
4.2 Allele and genotype frequencies
too easy
4.3 The transmission of genetic information
4.3.1 The Hardy-Weinberg principle
\[\begin{equation} p^2 + 2pq + q^2 = 1 \tag{4.1} \end{equation}\]
where \(p\) = allele frequency of first allele at a locus and \(q\) = allele frequency of the second allele at that same locus.
Assumptions of H-W:
- No selection
- No mutation
- Random mating
- No differential migration
- No random drift
Even though these assumptions will never be met completely in the real world, for the majority of the time the H-W prinicple holds regardless.
Assuming assumptions are met, 2 important points from H-W:
- It takes no more than a single generation to equilibriate and stabilize gene frequencies in the two sexes.
- Only one additional generation is required for the stabilisation of the genotype frequencies into the predictible Hardy-Weinberg proportions.
4.3.2 Sex-linked loci
Alleles on sex chromosomes in diploid organisms are obviously different. Sons can only receive an X chromosome from their mother so the frequency of X linked loci in the sons is equal to that of their mothers. Daughters receive both an X chromosome from Mum + from Dad.
Overall this means allele frequencies oscilate around an equilibrium state, but continually get closer to that state over the generations (see Figure 4.2 and page 56 for equation).
4.3.3 Polyploidy
Skipped over this section because it’s not relevant to human quant gen. Buuut, essentially it just details how to derive allele frequencies under a certain case of polyploidy. Also, it should be noted that of course H-W does not hold under polyploidy!
4.3.4 Age structure
Age structure also complicates our idealised model of H-W. In populations composed of several age classes, the generations overlap, and this causes the approach of genotype frequencies towards the H-W expectations to be gradual (rather than just by 1 or 2 generations), even in the case of an autosomal locus. Doesn’t explain this very much, but it’s covered elsewhere. Importantly, when newly founded populations have significant age structure, fluctuations in both gene and genotoype frequencies may occur for a substantial period of time even in the abscence of selection!
4.3.5 Testing for Hardy-Weinberg proportions
Says in the book that LRT can be used to test for departures from HWE and it can, but another common method is the chi-squared test and in PLINK they used Haldane’s exact test which is apparently analogus to Fisher’s exact test (papier on it) (can also use Fisher’s exact test if the sample size is tiny and the allele is rare.). Essentially, in a population, at a specific locus, you can calculate the allele frequencies (and from that expected genotype frequencies) from the observed genotype frequencies then test if there is a difference between the observed and expected values. LRT equation for it given on page 60. See code for some comparisons.
Should remember (as pointed out above), that just because some assumptions are violated, doesn’t mean you’d get a departure from HWE!
4.4 Characterising the influence of a locus on the phenotype
If a trait is entirely influenced by a single locus then the genetic effect on that trait can be characterised pretty easily and the dominance and additive effects of the alleles can be calculated. So if a locus has genotypes \(B_1B_1\), \(B_1B_2\), \(B_2B_2\), then the values given to these genotypes can be said to be: \(-a\), \((1 + k)a\) and \(+a\). Now if you have genotype data at that locus and data on the trait you can work out the effect of the \(B_2\) allele by taking the mean phenotypic value of individuals with \(B_2B_2\) and subtracting the mean phenotypic value of individuals with \(B_1B_1\) and dividing by 2 i.e.
\[\begin{equation} B_{2eff} = \frac{p_{B2} - p_{B1}} {2} \tag{4.2} \end{equation}\]
where \(B_{2eff}\) is the effect of allele \(B_2\), \(p_{B2}\) is the mean phenotypic value of individuals with \(B_2B_2\) and \(p_{B1}\) is the mean phneotypic value of individuals with \(B_1B_1\).
As \(B_{2eff} = a\) you can then substitute this in to \((1 + k)a\) to get the dominance coefficient \(k\). Of course if \(k = 0\) then there is no dominance (in reality you would calculate probability of dominance).
4.5 The basis of dominance
Confusing part… Don’t really get the enzyme activity bit…
Main point (I think) is that new deleterious mutations are very likely to be recessive and new mutations with a slight deleterious effect interact in an almost entirely additive fashion (no dominance!).
4.6 Fisher’s decomposition of the genotypic value
Recalling that the phenotypic value can be partitioned like so:
\[\begin{equation} z = G + E \tag{4.3} \end{equation}\]
where \(z\) is the phenotype, \(G\) is the genotypic value and \(E\) is the environmental value.
The genotypic value of a specific locus can be partitioned into it’s “expected” values based on there being only additive effects (\(\hat{G}\)) and the deviations from the expected values or dominance effects (\(\delta\)).  So the regression is:
\[\begin{equation} G_{ij} ~ N_2 + N_1 \end{equation}\]
By noting that for any individual, \(N_1 = 2 - N_2\) you can reduce the multiple regression model into an easier to work with univariate model. Give it a go (use equation (4.5)):
\[\begin{equation} \begin{split} G_{ij} &= \mu_G + \alpha_1(2 - N_2) + \alpha2N_2 + \delta_{ij} \\ &= l + (\alpha_2 - \alpha_1)N_2 + \delta_{ij} \end{split} \tag{4.6} \end{equation}\]
where \(l = \mu_G + 2\alpha_1\) is the intercept and the slope is \(\alpha = \alpha_2 - \alpha_1\)
If you plotted the genotypic value (\(G\)) against gene content (\(N_2\) or number of \(B_2\) alleles) and calculated residuals these residuals would be \(\delta\), the dominance deviation (see Figure 4.6).
The rest of the chapter uses this regression and what we know about genotype frequencies to derive a formula for the average effect of allelic substitution:
\[\begin{equation} \alpha = a[1 + k(p_1 - p_2)] \tag{4.7} \end{equation}\]
where \(a\) = genotypic value of \(B_2\) (see above), \(k\) is the dominance coefficient and \(p_1\) and \(p_2\) are the frequencies of \(B_1\) and \(B_2\). This value \(\alpha\) represents the average change in genotypic value that results when a \(B_2\) allele is randomly substituted for a \(B_1\) allele. If no dominance (\(k = 0\)) then \(\alpha = a\). Except in the case of additivity, the average effect of allelic substitution is not simply a function of the inherent physiological properties of the allele. It can only be defined in the context of the population!
4.7 Partioning the genetic variance.
Deriving variance of \(G\):
\[\begin{align} \begin{split} G &= \hat{G} + \delta \notag \\ \sigma^2_G &= \sigma^2(\hat{G} + \delta) \notag \\ &= \sigma^2(\hat{G}) + 2\sigma(\hat{G} + \delta) + \sigma^2(\delta) \end{split} \tag{4.8} \end{align}\]
The top equation is just like a regression, with \(\delta\) being the residual error and we know that for least-squares there is no correlation between the residual error and the predictor. So there is no correlation between \(\hat{G}\) and \(\delta\). Therefore:
\[ \sigma^2_G = \sigma^2(\hat{G}) + \sigma^2(\delta) \] OR more commonly \[\begin{equation} \sigma^2_G = \sigma^2_A + \sigma^2_D \tag{4.9} \end{equation}\]
\(\sigma^2_A\) is the variance of \(G\) explained by regression on \(N_2\) (or \(N_1\)), and \(\sigma^2_D\) is the residual variance of that regression. The variance of the additive and dominance effects!
For a diallelic locus we can do some rearranging of equations in Table 4.1 of the book and get these equations:
\[\begin{align} \sigma^2_A &= 2p_1p_2\alpha^2 \tag{4.10} \\ \sigma^2_D &= (2p_1p_2ak)^2 \tag{4.11} \end{align}\]
From these we can clearly see that both components depend on allele frequencies, the dominance coefficient and the homozygous effect (remember \(\alpha\) is just the slope of the \(G ~ N_2\) regression!).
By plotting how genetic variance changes with gene frequency under different scenarios (see 4.1). You see some interesting patterns. Firstly, at a single diallelic locus, you see that \(\sigma^2_A\) reaches it’s peak when \(p_1 = p_2 = 0.5\). Secondly, it’s clear that, even in the case of overdominance (which is rare!), additive genetic variance will almost always be much higher than genetic variance from dominance effects, even when the frequency of the dominant allele is high.
4.8 Additive effects, average excesses and breeding values
The dominance deviation of a parent, which is a function of the interaction between the two parental alleles, is eliminated when gametes are produced. Thus, one can think of \(\hat{G}\) and \(\delta\) as the heritable and nonheritable components of an individual’s genotypic value.
Fisher proposed two different measures of the effect of an allele: one being the additive effect (\(\alpha_i\)) and then the average excess \(\alpha^x_i\). The average excess \(\alpha^x_2\) of allele \(B_2\) is the difference between the mean genotypic value of individuals carrying at least one copy of \(B_2\) and the mean genotypic value of a random individual from the entire population:
\[\begin{equation} \alpha^x_2 = (G_{12}P_{12|2} + G_{22}P_{22|2}) - \mu_G \tag{4.12} \end{equation}\]
where \(P_{ij}\) is the conditional probability of a \(B_iB_j\) genotype given that one allele is \(B_i\). Under random mating \(P_{ij|i} = p_j\) (\(p_j\) = frequency of allele \(B_j\)). THINK ABOUT HARDY-WEINBERG AND IT MAKES SENSE!
So under random mating,
\[\begin{equation} \alpha^x_2 = G_{12}p_1 + G_{22}p_2 - \mu_G \tag{4.13} \end{equation}\]
\(G_{12} = a(1+k)\) and \(G_{22} = 2a\). By substituting these into the equation above for \(\alpha^x_1\) and \(\alpha^x_2\) and then calculating \(\alpha_1\) and \(\alpha_2\) (additive effects) by the method previously mentioned (regressing genotypic value \(G\) on the number of \(B_2\) alleles, \(N_2\)), we will see they’re equivalent (shown on page 72):
\[\begin{align} \alpha_2 &= p_1\alpha \notag \\ \alpha_1 &= -p_2\alpha \end{align}\]
The breeding value of an individual (\(A\)) is the sum of the additive effects of its genes. So the breeding value of a \(B_1B_1\) homozygote is just \(2\alpha_1\). In randomly mating populations the breeding value of a genotype is equivalent to twice the expected deviation of its offspring mean phenotype from the population mean. Soooo, no genotype information is needed to calculate the breeding value. All we have to do is mate an individual to many randomly chosen individuals from the population and taking twice the deviation of its offspring mean from the population mean. EASY IN HUMANS!!!
In Chapter 13 this will be discussed wrt candidate gene studies.
4.9 Extensions for multiple alleles and non random mating
So this section seems mostly unrelevant as we’re unlikely to deal with situations with more than 2 alleles. Non-random mating could be encountered if we’re interested in some phenotypes (e.g. alcohol intake). Buuuut, it’s still good to note some of the generalised equations for what we’ve been discussing so far in the chapter.
4.9.1 Average excess
When \(n\) alleles are present, the average excess, \(\alpha^x_i\), for any allele \(B_i\) is given by
\[\begin{equation} \alpha^x_i = \sum_{j=1}^{n} P_{ij|i}G_{ij} - \mu_G \tag{4.14} \end{equation}\]
Remember, under random mating \(P_{ij|i} == p_j\)
4.9.2 Additive effects
The genotypic value can also be obtained using regression as before, but in it’s generalised form is a multivariate regression. For \(n\) alleles
\[\begin{equation} G = \mu_G + \sum_{i=1}^{n} \alpha_{i}N_{i} + \delta \tag{4.15} \end{equation}\]
After some re-arranging can derive the regression coefficients and finally end with
\[\begin{equation} \alpha_i = \sum_{j=1}^{n} p_jG_{ij} - \mu_G \tag{4.16} \end{equation}\]
i.e. under random mating, the average effects (\(\alpha_i\)) are equal to the conditional mean deviations from the mean genotypic value of the population (\(\mu_G\)).
For non-random mating we need the inbreeding coefficient, \(f\) to define our genotype frequencies:
\[\begin{align} P_{ii} &= (1 - f)p^2_i + fp_i \notag \\ P_{ij} &= 2(1 -f)p_ip_j \tag{4.17} \end{align}\]
Unsure of why, but this means
\[\begin{equation} \alpha_i = \frac{\alpha^x_i} {1 + f} \tag{4.18} \end{equation}\]
so \(f\) is the fractional reduction of heterozygote frequencies relative to those expected under random mating. This means you can kind of do a test for random mating by checking heterozygote and homozygote frequencies in a population!
4.9.3 Additive genetic variance
The additive genetic variance across \(n\) alleles is
\[\begin{equation} \sigma^2_A = 2 \sum_{i=1}^{n} p_i\alpha_i\alpha^x_i \tag{4.19} \end{equation}\]
In general inbreeding inflates the additive genetic variance by causing correlations among the effects of alleles within the same individuals.
The broad sense heritability, even under scenarios of non-random mating can be given by
\[\begin{equation} \sigma^2_G = \sigma^{2}(\alpha_i + \alpha_j) + \sigma^{2}(\delta_{ij}) \end{equation}\]
although it should be noted that the definitions of \(\alpha_i\) and \(\delta_ij\) change with the degree of inbreeding! Random mating means \(\alpha_i\) and \(\alpha_j\) are uncorrelated so we get back to the good old equation
\[ \sigma^2_G = \sigma^2_A + \sigma^2_D \]
Importantly, under random mating, \(\sigma^2_A\) is equivalent to the variance of breeding values of individuals in the population.
Summarising some key terms
The homozygous effect, \(a\), and the dominance coefficient, \(k\), are intrinsic properties of allelic products. They are not functions of allele frequencies, but may vary with genetic background
The additive effect, \(\alpha_i\), and the average excess, \(\alpha^x_i\), are properties of alleles in a particular population. They are functions of \(a\), \(k\) and genotype frequencies (\(p_i\)).
The breeding value, \(A\), is a property of a particular individual in reference to a particular population. It’s equivalent to the sum of the additive effects of an individual’s alleles.
The additive genetic variance, \(\sigma^2_A\) is a property of a particular population. It is equivalent to the variance of the breeding values of individuals within the population.
4.10 End of chapter questions
- What is the Hardy-Weinberg principle and what are it’s assumptions?
- What does the H-W principle mean for gene and genotype frequencies across generations?
- What is age structure and how does it affect HWE?
- How can you test for HWE?
- Are deliterious mutations likely to be dominant or recessive?
- Assuming a trait was entirely influenced by a single locus, how could you calculate dominance and additive effects knowing the genotypes and phenotypes of the individuals in the sample?
- What is the formula for the average effect of allelic substitution?
- For a diallelic locus, what does the additive genetic variance and dominance genetic variance depend on?
- How does the contribution of additive genetic variance to total genetic variance change when \(k\) varies?
- What is the breeding value of an individual?
- Define the additive genetic variance in the presence of \(n\) alleles
- Learn the definitions of the key terms!


Bus Mall
Home
About us
Sales
Contact us
Number Of Rounds
Which of the below Product would be most likely to purchase ?
Click on your favorite option !
View Results


Shelbourne announce signing of ex-Dundalk, Bohs and Waterford midfielder Poynton
The 22-year-old has plenty of experience in the League of Ireland given his age.
by Ben BlakeSHELBOURNE HAVE added Georgie Poynton to their ranks ahead of next season’s return to the top flight.
The SSE Airtricity League First Division champions have signed 22-year-old midfielder Poynton from Waterford, where he made 28 appearances last season.
An Ireland underage international, the Dubliner has previously been on the books at Dundalk, Bohemians and, briefly, St Patrick’s Athletic.
“When I heard Shels were interested as a northside lad it made it that bit more exciting and I’m looking forward to get going,” Poynton said.
“Obviously it’s a big year for the club with a lot of history behind them but we’re definitely on the rise again.
It was a very positive in the way Ian Morris was thinking and how it is going to go this year so I just want to be apart of it.”
Shels boss Morris added: “He comes from a fantastic upbringing of clubs.”
“He went from East Meath to Dundalk at 15, where he has been given a fantastic football education.
“At only 22 he has great experience at Premier Division level. He will bring energy and quality to our squad.”


kmeaningful package¶
Submodules¶
kmeaningful.find_elbow module¶
-
kmeaningful.find_elbow.
find_elbow
(X)[source]¶ This function takes in unlabeled, scaled data and performs clustering using the KMeans clustering algorithm values of K up to the min(10, n_samples - 1).
It returns the value for K which maximizes the mean silhouette scores for all clusters.
- Parameters
X (numpy ndarray) –
data to train clustering model with. (Pre-scaled) –
- Returns
optimal_K (int)
The value for K which maximizes the mean silhouette scores across all
clusters.
Examples
>>> from sklearn.datasets import make_blobs >>> X, _ = make_blobs(n_samples=10, centers=3, n_features=2) >>> processed_data = preprocess(X) >>> optimal_K = find_elbow(processed_data)
kmeaningful.fit_assign module¶
-
kmeaningful.fit_assign.
assign
(X, centers)[source]¶ Assigns data to clusters based on Euclidean distance to the nearest centroid.
- Parameters
X (array) –
for cluster assignment. Dimensions (Data) –
centers (array) –
locations of the cluster centers. (The) –
- Returns
array
The cluster assignments for the data.
Examples
>>> from sklearn.datasets import make_blobs >>> X, _ = make_blobs(n_samples=10, centers=3, n_features=2) >>> centers = fit(X, 3) >>> cluster_assignments = predict(X, centers)
-
kmeaningful.fit_assign.
calc_centers
(X, centers, labels)[source]¶ Calculates the coordinates of the centroid of each cluster
- Parameters
X (array) –
for cluster assignment. Dimensions (Data) –
centers (array) –
locations of the cluster centers. Dimensions (The) –
only to determine number of clusters (Used) –
labels (array) –
assigned cluster for each data point in X. Dimensions (The) –
- Returns
array
A (k,d) array of the center locations for each cluster.
-
kmeaningful.fit_assign.
fit
(X, k)[source]¶ This function takes in unlabeled, scaled data and performs clustering using the KMeans clustering algorithm.
- Parameters
X (array) –
to train clustering model with. Dimensions (Data) –
k (int) –
number of clusters to use for Kmeans. (The) –
- Returns
array
A (k,d) array of the center locations for each cluster.
Examples
>>> from sklearn.datasets import make_blobs >>> X, _ = make_blobs(n_samples=10, centers=3, n_features=2) >>> centers = fit(X, 3)
-
kmeaningful.fit_assign.
fit_assign
(X, k)[source]¶ This function takes in data and performs clustering using the KMeans clustering algorithm.
- Parameters
X (array) –
data to train clustering model with. Dimensions (Pre-scaled) –
k (int) –
number of clusters to use for Kmeans. (The) –
- Returns
array
The coordinates of the cluster centers
list
A list containing the cluster label for every example (row) in X.
Examples
>>> from sklearn.datasets import make_blobs >>> X, _ = make_blobs(n_samples=10, centers=3, n_features=2) >>> centers, labels = fit_assign(X, 3)
-
kmeaningful.fit_assign.
init_centers
(X, k)[source]¶ This function chooses initial cluster locations using Kmeans++
- Parameters
X (array) –
used to find clusters. Dimensions (Data) –
k (int) –
desired number of clusters . (The) –
- Returns
array
Array containing the initial coordinates of the k clusters
Examples
>>> from sklearn.datasets import make_blobs >>> X, _ = make_blobs(n_samples=10, centers=3, n_features=2) >>> intial_centers = init(X, 3)
-
kmeaningful.fit_assign.
measure_dist
(X, centers)[source]¶ Measures the euclidean distance between each row (point) in X, and each row (cluster centre) in centers
- Parameters
X (array) –
for cluster assignment. Dimensions (Data) –
centers (array) –
locations of the cluster centers. Dimensions (The) –
- Returns
array
The distances from each point to each center. Dimensions ((n, k))
Examples
>>> from sklearn.datasets import make_blobs >>> X, _ = make_blobs(n_samples=10, centers=3, n_features=2) >>> centers = fit(X, 3) >>> distances = predict(X, centers)
kmeaningful.preprocess module¶
-
kmeaningful.preprocess.
preprocess
(X)[source]¶ This function takes in training data and applies preprocessing steps such as scaling and one hot encoding.
- Parameters
X (Array-like of shape (n_samples, n_features)) –
data on which to apply preprocessing steps (Unprocessed) –
be (can) –
form of DataFrame or Array. (in) –
- Returns
Numpy ndarray of shape (n_samples, n_features_new)
An array representing the data after appropriate preprocessing
steps are applied.
Examples
>>> from sklearn.datasets import make_blobs >>> X, _ = make_blobs(n_samples=10, centers=3, n_features=2) >>> processed_data = preprocess(X)
kmeaningful.show_clusters module¶
-
kmeaningful.show_clusters.
show_clusters
(data, clusters, centroids=None)[source]¶ This function reduces a data set to 2 dimensions using principle component analysis (PCA) and colours clusters of points. Parameters
data : DataFrame Scaled data
clusters : list, pandas Series corresponding cluster for X
centroids: 2d array Coordinates of cluster centroids
- Returns
plot
A 2d principle components scatter plot coloured by cluster
Examples
>>> from sklearn.datasets import make_blobs >>> X, y = make_blobs(n_samples=10, centers=3, n_features=2) >>> show_clusters(X, y, centroids)


WiFi
Battery
Bluetooth
Network
Location
Airplane mode
Display
Security
Accounts & Users
Date & Time
Input & Language
Sound


Delete Result
Are you sure you wish to delete this result?
Name:
[[lastname]]
,
[[firstname]]
Quiz:
[[quizname]]
Score:
[[score]]
/
[[possiblescore]]
Cancel
Delete


The <embed-page/>
is an open source (GitHub) proof of concept for Embeddable Progressive Application
- a microapplication
container implemented as WebComponent acting as
<embed-page/>
covers 2 extreme cases.
<embed-page/>
has been made with security considerations in mind.
It is definitely safer than exposing the whole page to 3rd part scripts which is a usual practice as of now.
Within <embed-page/>
scripts and CSS are insulated and which makes the container page relatively safe.
It is not prone for hackers though. IFRAME given some extra safeguard with loosing on integration into web page
and still having some holes addressed by <embed-page/>
.
The ultimate goal of <embed-page/>
is to bring the web 3.0 needs to browser teams attention.
Eventually making its functionality available on native level, safe and sound.
Please comment, file the bug, star <embed-page/> project
to support the cause.
Navigation menu provides links to demo pages with sources, visual and unit tests. Here are some most typical uses:


W E L C O M E
Artificial Intelligence (AI) systems to address mental well-being Problem: Mental Disorders like Depression is a major issue in the youth of the USA, and also one of the leading causes of suicides. The current situation of the global pandemic has only aggravated this situation. Many individuals are unable to avail proper care due to a variety of reasons some attributed to the inability to monitor or diagnose the disorder at early stages, therapy and care not being easily accessible and/or affordable, and/or the disorder being treated as a taboo/stigma in their social circles. Goal: Design and Develop an Artificial Intelligence system that will aid in the monitoring and therapy of major depressive disorder with the goal to make the treatment more accessible and acceptable by individuals. Key-Ideas/Research Domains: Artificial Intelligence/Machine Learning, psychology, data science (understanding patterns of depressive behavior), delivery of an AI system that will be trusted and accepted by humans (should you develop a chatbot? Should you integrate it with devices like Amazon Alexa, should you develop an AR/VR technology that is more immersive, etc. what works more effectively?)


In the world of big data, it is increasingly importat to find efficient ways of sorting through that information. One way to do this would be to type in your long-hand code for every time you want to sort through your information. This would work, but it would add a lot of unnecessary code to your program. Thankfully, the wonderful brains behind Ruby thought of this! They created a module called 'Enumerable', which defined means "able to be counted by one-to-one correspondence with the set of all positive integers". When you think about it in terms of your code, that translates to pretty much the same, you are going through all your information one at a time and applying some code block to it to achieve what you want to.
One of the first enumerable methods I learned about was #map. Map is a method that has 2 names, and the other name is collect. These two methods do the same thing, but as in most things Ruby related, there is always more than 1 way to skin the proverbial cat (what a morbid metaphor). Well what does map do? No, it doesn't draw you a cool subway map of your code or your information. It will run your specified code block, or the changes you want to make to your information, and return an object containing the results of your mapping. You can use this to manipulate information based on whatever your needs are.
While to me it seems that #collect seems to be a more accurate description of what you're doing, #map is the more convential method to use. This is going to be a very vague sentence, but if you want to do anything to everything in a group of information, you're going to use an enumerable.


Fun facts about football.
-Football was created in China.
-On Earth football is the most played and watched sport.
-In a football game the players each run about 9.65 km.
-November 6, 1869 football was created.
Fun facts about basketball.
-People used a soccer ball to play basketball in till 1936.
-backboards were first made of wire.
-The first hoops were just peach baskets.
-Basketball was created in December 1891 by Dr. James Naismith.
Fun facts about baseball.
-In MLB the oldest ballpark as built in 1912.
-Abner Doubleday invented baseball.
-The longest baseball game was 23 innings.
-Alexander Cartwright made there first important set of rules for baseball.
Fun facts about soccer.
-A soccer ball has 32 panels and they represent the 32 countries in Europe.
-The first soccer goals were wicker baskets.
-Up until 1908 soccer balls were inflated stomach tissue from executed prisoners.
-The first professional American soccer league was USSA.


| 1 | package fr.sii.ogham.helper.email; | |
| 2 | ||
| 3 | import java.io.IOException; | |
| 4 | import java.io.InputStream; | |
| 5 | import java.nio.charset.Charset; | |
| 6 | import java.util.regex.Pattern; | |
| 7 | ||
| 8 | import org.apache.commons.io.IOUtils; | |
| 9 | ||
| 10 | /** | |
| 11 | * Class used in tests for ensuring that the content of an email is respected. | |
| 12 | * It contains the expected content and the expected Mime Type. | |
| 13 | * | |
| 14 | * @author Aurélien Baudet | |
| 15 | * | |
| 16 | */ | |
| 17 | public class ExpectedContent { | |
| 18 | /** | |
| 19 | * The expected body content as string | |
| 20 | */ | |
| 21 | private String body; | |
| 22 | ||
| 23 | /** | |
| 24 | * The expected Mime Type (regular expression) | |
| 25 | */ | |
| 26 | private Pattern mimetype; | |
| 27 | ||
| 28 | /** | |
| 29 | * Initialize with the expected body and the expected Mime Type (regular | |
| 30 | * expression). | |
| 31 | * | |
| 32 | * @param body | |
| 33 | * the expected body | |
| 34 | * @param mimetype | |
| 35 | * the expected Mime Type pattern | |
| 36 | */ | |
| 37 | public ExpectedContent(String body, String mimetype) { | |
| 38 | this(body, Pattern.compile(mimetype)); | |
| 39 | } | |
| 40 | ||
| 41 | /** | |
| 42 | * Initialize with the expected body and the expected Mime Type pattern. | |
| 43 | * | |
| 44 | * @param body | |
| 45 | * the expected body | |
| 46 | * @param mimetype | |
| 47 | * the expected Mime Type pattern | |
| 48 | */ | |
| 49 | public ExpectedContent(String body, Pattern mimetype) { | |
| 50 | super(); | |
| 51 | this.body = body; | |
| 52 | this.mimetype = mimetype; | |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| 56 | * Initialize with the expected body and the expected Mime Type pattern. | |
| 57 | * | |
| 58 | * @param body | |
| 59 | * the expected body to read from the stream | |
| 60 | * @param mimetype | |
| 61 | * the expected Mime Type pattern | |
| 62 | * @throws IOException | |
| 63 | * when the expected content stream is not readable | |
| 64 | */ | |
| 65 | public ExpectedContent(InputStream body, String mimetype) throws IOException { | |
| 66 | this(IOUtils.toString(body, Charset.defaultCharset()), mimetype); | |
| 67 | } | |
| 68 | ||
| 69 | public String getBody() { | |
| 70 |
3
1. getBody : All method body replaced by: return "" → NO_COVERAGE 2. getBody : All method body replaced by: return "A" → NO_COVERAGE 3. getBody : All methods instructions replaced by: return null; → NO_COVERAGE |
return body; |
| 71 | } | |
| 72 | ||
| 73 | public Pattern getMimetype() { | |
| 74 |
1
1. getMimetype : All methods instructions replaced by: return null; → NO_COVERAGE |
return mimetype; |
| 75 | } | |
| 76 | ||
| 77 | } | |
Mutations | ||
| 70 |
1.1 2.2 3.3 |
|
| 74 |
1.1 |


Rapinoe, who highlighted a series of issues in her acceptance speech for her FIFA Player of the Year award last month, went on to brand the €75,000 fine given to Bulgaria “an absolute joke”.
Speaking to BBC Radio 1’s Newsbeat, the American star said it was time for clubs, officials and fans’ groups to stand up and be counted on issues such as racism.
Rapinoe said: “We’re not going to accept this. This is not something that’s going to be in our game.
Make it super extreme so it's damaging to the team, to the federation, so it's damaging financially
“So I feel like all of the clubs and the presidents and fan groups and everyone, you know, frankly are failing these players.”
Rapinoe pointed at the controversial punishment handed to the Bulgarian FA following evidence of strong and persistent racist abuse during the recent Euro 2020 qualifier.
 “That’s just the end of it. I mean £65,000 is an absolute joke.
“For me I’m just like, make it super extreme so it’s damaging to the team, to the federation, so it’s damaging financially.”
Rapinoe went on to single out Raheem Sterling for special praise following the Manchester City star’s strong and persistent stance on racism.
But she insisted more players need to stand up and follow Sterling’s example if the scourge of racism is to be finally banished from the game.
“I need all the players on Raheem’s team, all the players in the Premier League and in the leagues abroad to make it their problem because it really is everybody’s issue,” she added.


Click to
create a request
.
Click to
abort the request
(be faster than the network).
Waiting...
Received code from server:


HTTP/1.0 503 Service Unavailable
Cache-Control: no-cache
Connection: close
Content-Type: text/html
Service Unavailable | Horreum
Horreum is currently experiencing downtime.
{#if hasBanner }
This is the last message from admin (recorded at {created}):
{title}
{message.raw}
{/if}


Thanks
Ionic Framework, AngularJS, Sass, NPM, Github, Google, Apple, Paypal and all open source world
Dev with ♥ from Brazil by Willian Ribeiro Angelo


Bangladeshi housemaid Sumi says she was ‘sold’ for 22,000 riyals in Saudi Arabia
by bdnews24.comSumi Akter – the Bangladeshi housemaid whose video appeal for help after alleged torture in Saudi Arabia went viral – has recounted “the cruelty” she had been subjected to.
The 18-year old alleged, on returning home, that her employer in the Gulf kingdom had “sold” her for 22,000 riyals after the torture.
She arrived in Dhaka on Friday morning and the Wage Earners’ Welfare Board took her straight to her parents in Panchagarh.
Her husband Nurul Islam and their children were also there at the airport but he was not given her custody due to security reasons.
Sumi said Nurul had inspired her to go abroad and she was lured with the promise of a good job and salary.
Ruposhi Bangla Overseas was the agency that recruited her in Saudi Arabia and she travelled to the country on May 30.
Her mother Mollica Begum said they had sent Sumi to her maternal uncle in Dhaka where she had taken a job at a readymade garment factory.
“We came to know about the marriage and her going abroad later. Her husband contacted us and told us about the torture 15 to 20 days after she went abroad,” she said.
Sumi told reporters that her employer in Saudi Arabia used to beat her up and torture her in different ways.
“He poured hot oil on my hand one day. He locked me up in a room as I cried,” Sumi alleged.
“When I fell very ill, the owner of the house in Riyadh sold me to another person in Najran near the border with Yemen for 22,000 riyals. I was tortured there as well.
“The owner of that house took away my mobile phone. When he gave it back following repeated requests, I recorded my statement on the torture secretly in the toilet and sent the video to my husband in Dhaka,” she said.
Sumi made international headlines earlier this month after the video was released on social media.
Police later took her to the Consulate General of Bangladesh in Jeddah from her employer’s home, but the employer refused to sign off on her “final exit” before recouping the 22,000 riyal he paid for her.
He eventually allowed her to leave after a labour court rejected his plea for the repayment of the “dues”.


| # | Sta | Rlx | Name | Row Text |
| 0 | | 0 | autoRow0 | a "campfire" is a kind of "fire" (db8c-9eae-6023-0d7b) |
| 1 | ST | 0 | autoRow1 | heat is a kind of energy (9e7d-986e-6af1-5ac1) |
| 2 | ST | 0 | autoRow2 | fire gives off light ; heat ; smoke (891f-4f5c-91a2-bd31) |
| 3 | ST | 0 | autoRow3 | warmer means greater ; higher in temperature ; warmth (3c5b-8471-16d4-f1b2) |
| 4 | ST | 0 | autoRow4 | radiation is when heat is transferred through waves ; particles (1d10-2a0a-bf2e-7622) |
| 5 | ST | 0 | autoRow5 | fire transfers heat through waves (8a8a-5122-efe7-7c20) |
| 6 | ST | 0 | autoRow6 | if heat is transferred to an object , then the object will get hot (5a0e-924d-c180-98d7) |
| 7 | ST | 0 | autoRow7 | radiation is a kind of process (a15e-101d-6fea-e0b6) |
| 8 | ST | 0 | autoRow8 | more burning causes fire to be hotter (4f8f-58c9-a1d6-6470) |
| 9 | ST | 0 | autoRow9 | radiation can affect objects that are not touching (3274-5890-ead5-c376) |
| 10 | ST | 0 | autoRow10 | radiation means radiant energy (e7e8-9711-1051-9165) |
| 11 | ST | 0 | autoRow11 | electromagnetic radiation means electromagnetic energy (71fe-7f84-ac6f-b391) |
| # | Sta | Rlx | Name | Row Text |
| 0 | | 0 | autoRow0 | a "campfire" is a kind of "fire" (db8c-9eae-6023-0d7b) |
| 1 | ST | 0 | autoRow1 | heat is a kind of energy (9e7d-986e-6af1-5ac1) |
| 2 | ST | 0 | autoRow2 | fire gives off light ; heat ; smoke (891f-4f5c-91a2-bd31) |
| 3 | ST | 0 | autoRow3 | warmer means greater ; higher in temperature ; warmth (3c5b-8471-16d4-f1b2) |
| 4 | ST | 0 | autoRow4 | radiation is when heat is transferred through waves ; particles (1d10-2a0a-bf2e-7622) |
| 5 | ST | 0 | autoRow5 | fire transfers heat through waves (8a8a-5122-efe7-7c20) |
| 6 | | | autoRow6 | Empty |
| 7 | ST | 0 | autoRow7 | radiation is a kind of process (a15e-101d-6fea-e0b6) |
| 8 | ST | 0 | autoRow8 | more burning causes fire to be hotter (4f8f-58c9-a1d6-6470) |
| 9 | ST | 0 | autoRow9 | radiation can affect objects that are not touching (3274-5890-ead5-c376) |
| 10 | ST | 0 | autoRow10 | radiation means radiant energy (e7e8-9711-1051-9165) |
| 11 | ST | 0 | autoRow11 | electromagnetic radiation means electromagnetic energy (71fe-7f84-ac6f-b391) |


This example was taken copied from Steve Sanderson fluent validator project.
Credit card Honour system @if (paymentMethod.MethodType == PaymentMethod.Type.CreditCard) { } else if (paymentMethod.MethodType == PaymentMethod.Type.HonourSystem) { Sure, we trust you to pay us somehow eventually } customer.PaymentMethods.Remove(paymentMethod))" @onclick:preventDefault>Remove
Submit


 Pile into the centre of the breast the olives, tomato and basil and season well with salt and freshly ground black pepper. Fold the breast over, then roll up tightly in the prosciutto.
Heat the olive oil in a frying pan and cook the chicken breast for 4-5 minutes on each side, or until golden-brown all over and completely cooked through. Remove from the heat and allow to rest.
For the tomato sauce, place the tomato purée and water in a pan and heat through, stirring well.
For the parsley purée, place the parsley and oil together in a mini food processor and blend until smooth.
To serve, slice the chicken breast on the diagonal. Spoon a dollop of the tomato sauce in the centre of a serving plate and place the slices of chicken breast on top, then drizzle over the parsley purée and serve.