Last Update: 4/25/2002
NOTICE: This document is intended for advanced CORBA developers.
The Java CORBA Object Request Broker (ORB) provides hooks, or interception points, through which ORB services can intercept the normal flow of execution of the ORB. These Portable Interceptors provide a mechanism for plugging in additional ORB behavior, or, by modifying the communications between client and server, for modifying the behavior of the ORB. The example that follows shows different ways of using Portable Interceptors.
Support for Portable Interceptors is a major recent addition to the CORBA specification. Using RequestInterceptors, one can easily write and attach portable ORB hooks that will intercept any ORB-mediated invocation. Using IORInterceptors, one can write code to annotate CORBA object references.
It is highly recommended that you read the Portable Interceptors Specification at ptc/2001-03-04 before reading this document.
The following topics are included in this document:
ORBInitializers
in
Java
There are currently three types of interceptors that can be registered, as shown below. Examples of each are shown in the example that follows.
IORInterceptor
In some cases, a portable ORB service implementation may need to add information describing the server's or object's ORB service-related capabilities to object references in order to enable the ORB service implementation in the client to function properly. This is supported through the IORInterceptor and IORInfo interfaces. The IOR Interceptor is used to establish tagged components in the profiles within an Interoperable Object Reference (IOR).
An example of an IOR Interceptor is shown in the file AServiceIORInterceptor.java in the example that follows.
ClientRequestInterceptor
A request Interceptor is designed to intercept the flow of a request/reply sequence through the ORB at specific points so that services can query the request information and manipulate the service contexts which are propagated between clients and servers. The primary use of request Interceptors is to enable ORB services to transfer context information between clients and servers.
A ClientRequestInterceptor
intercepts the flow of a
request/reply sequence through the ORB on the client
side.
An example of a ClientRequestInterceptor is shown in the file LoggingServiceClientInterceptor.java in the example that follows.
ServerRequestInterceptor
A ServerRequestInterceptor
intercepts the flow of a
request/reply sequence through the ORB on the server
side.
An example of a ServerRequestInterceptor is shown in the file LoggingServiceServerInterceptor.java in the example that follows.
ORBInitializers
in JavaThe
ORBInitializer
interface facilitates interceptor
registration and ORB initialization.
Interceptors are intended to be a means by which ORB services
gain access to ORB processing, effectively becoming part of the
ORB. Since interceptors are part of the ORB, when
ORB.init
returns an ORB, the interceptors shall have
been registered. Interceptors cannot be registered on an ORB after
it has been returned by a call to ORB.init
.
ORBInitializers
are registered via Java ORB
properties. An interceptor is registered by registering an
associated ORBInitializer
object which implements the
ORBInitializer
interface. When an ORB is initializing,
it shall call each registered ORBInitializer
, passing
it an ORBInitInfo
object which is used to register its
interceptor.
The property names are of the form:
org.omg.PortableInterceptor.ORBInitializerClass.<Service>
where <Service>
is the string name of a class
which implements
org.omg.PortableInterceptor.ORBInitializerTo avoid name collisions, the reverse DNS name convention should be used. For example, if company
Example
has three
initializers, it could define the following properties:
org.omg.PortableInterceptor.ORBInitializerClass.com.example.Init1
org.omg.PortableInterceptor.ORBInitializerClass.com.example.Init2
org.omg.PortableInterceptor.ORBInitializerClass.com.example.Init3
Note: Any values associated with
ORBInitializerClass
properties are ignored.
During ORB.init, these ORB properties which begin with
org.omg.PortableInterceptor.ORBInitializerClass
shall
be collected, the <Service>
portion of each
property shall be extracted, an object shall be instantiated with
the <Service>
string as its class name, and the
pre_init
and post_init
methods shall be
called on that object. If there are any exceptions, the ORB shall
ignore them and proceed.
ORB.init
with the provided orb_id
). Since
registration occurs during ORB initialization, results of
invocations on this ORB while it is in this state are
undefined.The PortableInterceptor::Current object (hereafter referred to as PICurrent) is a Current object that is used specifically by portable Interceptors to transfer thread context information to a request context. Portable Interceptors are not required to use PICurrent, but if information from a client's thread context is required at an Interceptor's interception points, then PICurrent can be used to propagate that information. PICurrent allows portable service code to be written regardless of an ORB's threading model.
Note: PICurrent is typically NOT used directly by CORBA client or server code. Instead, it is generally used by interceptor-based service implementations as demonstrated in the AService example interceptor which follows.
Before an invocation is made, PICurrent is obtained via a call to ORB::resolve_initial_references ( PICurrent ). From within the interception points, the data on PICurrent that has moved from the thread scope to the request scope is available via the get_slot operation on the RequestInfo object. A PICurrent can still be obtained via resolve_initial_references, but that is the Interceptor's thread scope PICurrent.
The thread scope PICurrent (TSC) is the PICurrent that exists within a thread's context. A request scope PICurrent (RSC) is the PICurrent associated with the request. On the client-side, the thread scope PICurrent is logically copied to the request scope PICurrent from the thread s context when a request begins and is attached to the ClientRequestInfo object. On the server-side, the request scope PICurrent is attached to the ServerRequestInfo and follows the request processing. It is logically copied to the thread scope PICurrent after the list of receive_request_service_contexts interception points are processed. See the Updated Interceptors specification, Section, <IP_ADDRESS>, Flow of PICurrent between Scopes for a detailed discussion of the scope of PICurrent.
This section contains an example logging service application. The sample code for this application is quite complicated because it covers even subtle "corner cases". The following scenarios are covered in this sample application:
Note: These examples explicitly register ORBInitializers to make the code easier to experiment with and setup. Typically this would not be done. Instead, this information would be passed as -D properties to the Java virtual machine when the applications are started. That way the applications are not coupled to the fact that either the service exists (e.g., the logging service) or that a service that they explicitly use (e.g., the AService interface) is implemented as an interceptor.
The purpose of the logging service example is to show how to avoid infinite recursion when making outcalls (i.e., invocations on CORBA references) from within interception points. This turns out to be quite involved when all corner cases are covered.
The purpose of the "empty" service example is to show how to implement services which flow context information from client to server and back.
A typical interceptor-based service will flow context information between clients and servers. The AService example shows how this information is flowed from the client thread into the client interceptors, across the wire into the server interceptors, to the servant thread and back.
It is important to note that neither the client nor the servant is aware that the service is implemented using interceptors. Instead, they interact with the service through local object references (the aService reference in this example).
AService diagram
Description of the steps of the AService diagram:
1.a. aService.begin() sets the service context information in a slot it has reserved in PICurrent.
Some services may need to make invocations on other CORBA object references from within interception points. When making outcalls from within interception points, steps must be taken to avoid infinite recursion since those outcalls will flow through the interception points. The LoggingService example illustrates this case.
The LoggingService example is comprised of ClientRequestInterceptors registered in a client program, and ServerRequestInterceptors registered in a server program. These interceptors send information from the client and server to a LoggingService implemenation which logs this information.
However, since the LoggingService implementation is itself a CORBA server, we must ensure that we do not log calls to the logger. The following diagrams illustrate the steps taken to avoid infinite recursion.
The following diagram shows the simplest case of avoiding recursion when calling an external logger from within interceptors. These steps are useful for the case where the client ORB only contains ClientRequestInterceptors, the server ORB only contains ServerRequestInterceptors, and the LoggingService is external to both the client and server ORBs.
LoggingService diagram
Description of the steps of the LoggingService diagram:
The following diagram illustrates the case where the LoggingService may be colocated in the same ORB as the reference being invoked by the client. In general, it is not possible to know that a particular object reference is NOT colocated with any other objects hosted by that ORB. Therefore, to cover all corner cases, more steps must be taken.
This diagram shows only the server side. The client side steps are identical to those in the preceding diagram.
LoggingServiceColocated diagram
Description of the steps of the LoggingServiceColocated diagram:
After Step 13, the original request that left off at Step 3 would be serviced.
The main point illustrated in this example is the necessity of using both client and server interceptors in conjunction with PICurrent slots and service contexts to indicate an outcall.
A simpler way to avoid recursion is to ensure that the outcall references are associated with a different ORB that does not have the logging interceptors registered. That way the outcall invocations never go through interceptors.
This seems like a simple solution, but, in general, interceptors are registered via properties passed to the VM during startup. This means that all ORBs created in that VM will contain all interceptors so this solution will not work.
This solution will only work where interceptors are explicitly registered in client code during ORB.init. However, that is neither a typical nor a recommended way to register interceptor-based services.
The following files contain the code which the above diagrams illustrate. Instructions for compiling and executing these examples follow the code. The files included in this example are:
serviceexample.idl
LoggingServiceClientORBInitializer.java
LoggingServiceClientInterceptor.java
LoggingServiceServerORBInitializer.java
LoggingServiceServerInterceptor.java
LoggingServiceImpl.java
AServiceORBInitializer.java
AServiceImpl.java
AServiceInterceptor.java
AServiceIORInterceptor.java
ArbitaryObjectImpl.java
Client.java
ColocatedServers.java
serviceexample.idl
This is the Interface Definition Language (IDL) file that contains definitions of an arbitrary object on which to make invocations and two services which will service calls to the arbitrary object.
// serviceexample.idl // Copyright and License module pi { module serviceexample { // Create some arbitrary object to call. Those calls // will be serviced by the service implemented using interceptors. exception ArbitraryObjectException { string reason; }; interface ArbitraryObject { string arbitraryOperation1 ( in string a1 ); oneway void arbitraryOperation2 ( in long a1 ); void arbitraryOperation3 ( in string a1 ) raises (ArbitraryObjectException); }; // This would typically be in a file separate from the "ArbitraryObject" // and probably unknown to it. interface LoggingService { void log ( in string a1 ); }; // This would also typically be in a file of its own. // IMPORTANT: the interface should be a local object to avoid // unnecessary overhead. /*local*/ interface AService { void begin(); void end(); void verify(); }; // Tagged component for adding to an IOR to indicate that // the AService must be in effect when invocations are made // on the object containing this tagged component. // Note: we explicitly declare the tag type rather than using // the IOP typedef (commented out) to simplify compiling this // example (i.e., to avoid includes and make include path directives). //const IOP::ComponentId TAG_ASERVICE_COMPONENT = 2345; const unsigned long TAG_ASERVICE_COMPONENT = 2345; struct ASERVICE_COMPONENT { boolean requiresAService; }; }; // module serviceexample }; // module pi
LoggingServiceClientORBInitializer.java
This file creates and registers the logging service interceptor used by object clients.
// LoggingServiceClientORBInitializer.java // Copyright and License package pi.serviceexample; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.PortableInterceptor.Current; import org.omg.PortableInterceptor.CurrentHelper; import org.omg.PortableInterceptor.ORBInitInfo; public class LoggingServiceClientORBInitializer extends org.omg.CORBA.LocalObject implements org.omg.PortableInterceptor.ORBInitializer { public void pre_init(ORBInitInfo info) { } public void post_init(ORBInitInfo info) { try { // Get a reference to the LoggingService object. NamingContext nameService = NamingContextHelper.narrow( info.resolve_initial_references("NameService")); NameComponent path[] = { new NameComponent("LoggingService", "") }; LoggingService loggingService = LoggingServiceHelper.narrow(nameService.resolve(path)); // Get a reference to TSC PICurrent. Current piCurrent = CurrentHelper.narrow( info.resolve_initial_references("PICurrent")); // Allocate a slot id to use for the interceptor to indicate // that it is making an outcall. This is used to avoid // infinite recursion. int outCallIndicatorSlotId = info.allocate_slot_id(); // Create (with the above data) and register the client // side interceptor. LoggingServiceClientInterceptor interceptor = new LoggingServiceClientInterceptor(loggingService, piCurrent, outCallIndicatorSlotId); info.add_client_request_interceptor(interceptor); } catch (Throwable t) { System.out.println("Exception handling not shown."); } } }
LoggingServiceClientInterceptor.java
This interceptor logs client side interception points. It illustrates how to make invocations on other objects from within an interceptor and how to avoid infinite recursion during those "outcall" invocations.
// LoggingServiceClientInterceptor.java // Copyright and License package pi.serviceexample; import org.omg.CORBA.Any; import org.omg.CORBA.ORB; import org.omg.CORBA.TCKind; import org.omg.IOP.ServiceContext; import org.omg.PortableInterceptor.ClientRequestInterceptor; import org.omg.PortableInterceptor.ClientRequestInfo; import org.omg.PortableInterceptor.Current; import org.omg.PortableInterceptor.InvalidSlot; public class LoggingServiceClientInterceptor extends org.omg.CORBA.LocalObject implements ClientRequestInterceptor { private LoggingService loggingService; private Current piCurrent; private int outCallIndicatorSlotId; public LoggingServiceClientInterceptor(LoggingService loggingService, Current piCurrent, int outCallIndicatorSlotId) { this.loggingService = loggingService; this.piCurrent = piCurrent; this.outCallIndicatorSlotId = outCallIndicatorSlotId; } // // Interceptor operations // public String name() { return "LoggingServiceClientInterceptor"; } public void destroy() { } // // ClientRequestInterceptor operations // public void send_request(ClientRequestInfo ri) { log(ri, "send_request"); } public void send_poll(ClientRequestInfo ri) { log(ri, "send_poll"); } public void receive_reply(ClientRequestInfo ri) { log(ri, "receive_reply"); } public void receive_exception(ClientRequestInfo ri) { log(ri, "receive_exception"); } public void receive_other(ClientRequestInfo ri) { log(ri, "receive_other"); } // // Utilities. // public void log(ClientRequestInfo ri, String point) { // IMPORTANT: Always set the TSC out call indicator in case // other interceptors make outcalls for this request. // Otherwise the outcall will not be set for the other interceptor's // outcall resulting in infinite recursion. Any indicator = ORB.init().create_any(); indicator.insert_boolean(true); try { piCurrent.set_slot(outCallIndicatorSlotId, indicator); } catch (InvalidSlot e) { } try { indicator = ri.get_slot(outCallIndicatorSlotId); // If the RSC out call slot is not set then log this invocation. // If it is set that indicates the interceptor is servicing the // invocation of loggingService itself. In that case do // nothing (to avoid infinite recursion). if (indicator.type().kind().equals(TCKind.tk_null)) { loggingService.log(ri.operation() + " " + point); } } catch (InvalidSlot e) { System.out.println("Exception handling not shown."); } } }
LoggingServiceServerORBInitializer.java
// LoggingServiceServerORBInitializer.java // Copyright and License package pi.serviceexample; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.PortableInterceptor.Current; import org.omg.PortableInterceptor.CurrentHelper; import org.omg.PortableInterceptor.ORBInitInfo; public class LoggingServiceServerORBInitializer extends org.omg.CORBA.LocalObject implements org.omg.PortableInterceptor.ORBInitializer { public void pre_init(ORBInitInfo info) { } public void post_init(ORBInitInfo info) { try { // Create and register the logging service interceptor. // Give that interceptor references to the NameService and // PICurrent to avoid further lookups (i.e., optimization). // More importantly, allocate and give the interceptor // a slot id which is will use to tell itself not to // log calls that the interceptor makes to the logging process. NamingContext nameService = NamingContextHelper.narrow( info.resolve_initial_references("NameService")); Current piCurrent = CurrentHelper.narrow( info.resolve_initial_references("PICurrent")); int outCallIndicatorSlotId = info.allocate_slot_id(); LoggingServiceServerInterceptor interceptor = new LoggingServiceServerInterceptor(nameService, piCurrent, outCallIndicatorSlotId); info.add_client_request_interceptor(interceptor); info.add_server_request_interceptor(interceptor); } catch (Throwable t) { System.out.println("Exception handling not shown."); } } }
LoggingServiceServerInterceptor.java
This interceptor logs server side interception points, and is implemented as both a ClientRequestInterceptor and a ServerRequestInterceptor to illustrate the need to set some "out call" service context data (in addition to setting an out call slot) to avoid infinite recursion for the case noted in the description of LoggingServiceServerORBInitializer.java.
// LoggingServiceServerInterceptor.java // Copyright and License package pi.serviceexample; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.CORBA.Any; import org.omg.CORBA.BAD_PARAM; import org.omg.CORBA.ORB; import org.omg.CORBA.TCKind; import org.omg.IOP.ServiceContext; import org.omg.PortableInterceptor.ClientRequestInterceptor; import org.omg.PortableInterceptor.ClientRequestInfo; import org.omg.PortableInterceptor.Current; import org.omg.PortableInterceptor.InvalidSlot; import org.omg.PortableInterceptor.ServerRequestInterceptor; import org.omg.PortableInterceptor.ServerRequestInfo; public class LoggingServiceServerInterceptor extends org.omg.CORBA.LocalObject implements ClientRequestInterceptor, ServerRequestInterceptor { private NamingContext nameService; private LoggingService loggingService; private Current piCurrent; private int outCallIndicatorSlotId; private static final int serviceContextId = 100001; private static final byte[] serviceContextData = {1}; // Returns a reference to the logging process. private LoggingService loggingService() { if (loggingService == null) { NameComponent path[] = { new NameComponent("LoggingService", "") }; try { loggingService = LoggingServiceHelper.narrow(nameService.resolve(path)); } catch (Throwable t) { System.out.println("Exception handling not shown."); } } return loggingService; } public LoggingServiceServerInterceptor(NamingContext nameService, Current piCurrent, int outCallIndicatorSlotId) { this.nameService = nameService; this.piCurrent = piCurrent; this.outCallIndicatorSlotId = outCallIndicatorSlotId; } // // Interceptor operations // public String name() { return "LoggingServiceServerInterceptor"; } public void destroy() { } // // ClientRequestInterceptor operations // public void send_request(ClientRequestInfo ri) { // If the server interceptor sets the recursion slot then // put in the service context so the server doesn't make // the call again in the case where the server side interceptor // is colocated in the same ORB as the object being invoked. try { Any indicator = ri.get_slot(outCallIndicatorSlotId); if (indicator.type().kind().equals(TCKind.tk_boolean)) { ServiceContext serviceContext = new ServiceContext(serviceContextId, serviceContextData); ri.add_request_service_context(serviceContext, false); } } catch (InvalidSlot e) { System.out.println("Exception handling not shown."); } } public void send_poll(ClientRequestInfo ri) { } public void receive_reply(ClientRequestInfo ri) { } public void receive_exception(ClientRequestInfo ri) { } public void receive_other(ClientRequestInfo ri) { } // // ServerRequestInterceptor operations // public void receive_request_service_contexts(ServerRequestInfo ri) { log(ri, "receive_request_service_contexts"); } public void receive_request(ServerRequestInfo ri) { log(ri, "receive_request"); } public void send_reply(ServerRequestInfo ri) { log(ri, "send_reply"); } public void send_exception(ServerRequestInfo ri) { log(ri, "send_exception"); } public void send_other(ServerRequestInfo ri) { log(ri, "send_other"); } // // Utilities. // public void log(ServerRequestInfo ri, String point) { // This is only relevant for the colocated example. // Do not attempt to log until the logging service object // has been bound in naming. Otherwise the attempt to call // rebind on naming will call log which will fail. if (! ColocatedServers.colocatedBootstrapDone) { return; } // IMPORTANT: // The conditional logging of the invocation is only necessary // if there is a chance that the object being invoked is colocated // in the same ORB as this interceptor. Otherwise the outcall to // the logging service can be made unconditionally. // Always set the recursion slot. Any indicator = ORB.init().create_any(); indicator.insert_boolean(true); try { piCurrent.set_slot(outCallIndicatorSlotId, indicator); } catch (InvalidSlot e) { System.out.println("Exception handling not shown."); } // Make the out call if you have not already done so. try { // Only the presence of the service context counts. // The data is ignored. ri.get_request_service_context(serviceContextId); } catch (BAD_PARAM e) { // Recursion indicator not set so make the call. loggingService().log(ri.operation() + " " + point); } } }
LoggingServiceImpl.java
// // Copyright and License package pi.serviceexample; import org.omg.CORBA.ORB; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.PortableServer.POAHelper; import java.util.Properties; class LoggingServiceImpl extends LoggingServicePOA { public static ORB orb; // // The IDL operations. // public void log(String a1) { System.out.println(a1); } // // The server. // public static void main(String[] av) { try { if (orb == null) { orb = ORB.init(av, null); } POA rootPOA = POAHelper.narrow( orb.resolve_initial_references("RootPOA")); rootPOA.the_POAManager().activate(); byte[] objectId = rootPOA.activate_object(new LoggingServiceImpl()); org.omg.CORBA.Object ref = rootPOA.id_to_reference(objectId); NamingContext nameService = NamingContextHelper.narrow( orb.resolve_initial_references("NameService")); NameComponent path[] = { new NameComponent("LoggingService", "") }; nameService.rebind(path, ref); // Only relevant for colocated example. ColocatedServers.colocatedBootstrapDone = true; System.out.println("LoggingService ready."); orb.run(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } System.exit(0); } }
AServiceORBInitializer.java
// AServiceORBInitializer.java // Copyright and License package pi.serviceexample; import org.omg.IOP.Codec; import org.omg.IOP.CodecFactory; import org.omg.IOP.CodecFactoryHelper; import org.omg.IOP.Encoding; import org.omg.PortableInterceptor.Current; import org.omg.PortableInterceptor.CurrentHelper; import org.omg.PortableInterceptor.ORBInitInfo; public class AServiceORBInitializer extends org.omg.CORBA.LocalObject implements org.omg.PortableInterceptor.ORBInitializer { private AServiceImpl aServiceImpl; private AServiceInterceptor aServiceInterceptor; public void pre_init(ORBInitInfo info) { try { int id = info.allocate_slot_id(); aServiceInterceptor = new AServiceInterceptor(id); info.add_client_request_interceptor(aServiceInterceptor); info.add_server_request_interceptor(aServiceInterceptor); // Create and register a reference to the service to be // used by client code. aServiceImpl = new AServiceImpl(id); info.register_initial_reference("AService", aServiceImpl); } catch (Throwable t) { System.out.println("Exception handling not shown."); } } public void post_init(ORBInitInfo info) { try { Current piCurrent = CurrentHelper.narrow( info.resolve_initial_references("PICurrent")); aServiceImpl.setPICurrent(piCurrent); CodecFactory codecFactory = CodecFactoryHelper.narrow( info.resolve_initial_references("CodecFactory")); Encoding encoding = new Encoding((short)0, (byte)1, (byte)2); Codec codec = codecFactory.create_codec(encoding); aServiceInterceptor.setCodec(codec); AServiceIORInterceptor aServiceIORInterceptor = new AServiceIORInterceptor(codec); info.add_ior_interceptor(aServiceIORInterceptor); } catch (Throwable t) { System.out.println("Exception handling not shown."); } } }
AServiceImpl.java
// // Copyright and License package pi.serviceexample; import org.omg.CORBA.Any; import org.omg.CORBA.TCKind; import org.omg.CORBA.LocalObject; import org.omg.CORBA.ORB; import org.omg.PortableInterceptor.Current; import org.omg.PortableInterceptor.InvalidSlot; class AServiceImpl extends LocalObject implements AService { private int slotId; private int currentServiceId = 0; private Current piCurrent; private Any NOT_IN_EFFECT; public AServiceImpl(int slotId) { this.slotId = slotId; NOT_IN_EFFECT = ORB.init().create_any(); } // Package protected so the AService ORBInitializer can access this // non-IDL defined method. void setPICurrent(Current piCurrent) { this.piCurrent = piCurrent; } public void begin() { Any any = ORB.init().create_any(); any.insert_long(++currentServiceId); setSlot(any); } public void end() { setSlot(NOT_IN_EFFECT); } public void verify() { try { Any any = piCurrent.get_slot(slotId); if (any.type().kind().equals(TCKind.tk_long)) { System.out.println("Service present: " + any.extract_long()); } else { System.out.println("Service not present"); } } catch (InvalidSlot e) { System.out.println("Exception handling not shown."); } } // Synchronized because two threads in the same ORB could be // sharing this object. synchronized private void setSlot(Any any) { try { piCurrent.set_slot(slotId, any); } catch (InvalidSlot e) { System.out.println("Exception handling not shown."); } } }
AServiceInterceptor.java
This interceptor is responsible for arranging to pass the client side AService information to the service side.
On the client side, if AService.begin() has been called, the send_request(ri) point will see the service id in the RSC slot. In this case, it inserts the value of that service id into an org.omg.CORBA.ServiceContext and adds that service context to the data to be passed along with the invocation.
On the server side, receive_request_service_context(ri) looks for the presence of that service context. When present, it extracts the service id value from the ServiceContext and sets the RSC slot to that value. When the servant is executing, the value of that RSC slot is available in the TSC slot.
// AServiceInterceptor.java // Copyright and License package pi.serviceexample; import org.omg.CORBA.Any; import org.omg.CORBA.BAD_PARAM; import org.omg.CORBA.ORB; import org.omg.CORBA.TCKind; import org.omg.IOP.Codec; import org.omg.IOP.CodecPackage.FormatMismatch; import org.omg.IOP.CodecPackage.TypeMismatch; import org.omg.IOP.ServiceContext; import org.omg.IOP.TaggedComponent; import org.omg.PortableInterceptor.ClientRequestInterceptor; import org.omg.PortableInterceptor.ClientRequestInfo; import org.omg.PortableInterceptor.InvalidSlot; import org.omg.PortableInterceptor.ServerRequestInterceptor; import org.omg.PortableInterceptor.ServerRequestInfo; public class AServiceInterceptor extends org.omg.CORBA.LocalObject implements ClientRequestInterceptor, ServerRequestInterceptor { private int slotId; private Codec codec; private static final int serviceContextId = 1234; public AServiceInterceptor(int slotId) { this.slotId = slotId; } void setCodec(Codec codec) { this.codec = codec; } // // Interceptor operations // public String name() { return "AServiceInterceptor"; } public void destroy() { } // // ClientRequestInterceptor operations // public void send_request(ClientRequestInfo ri) { // // See if the target object contains an ASERVICE_COMPONENT. // try { TaggedComponent taggedComponent = ri.get_effective_component(TAG_ASERVICE_COMPONENT.value); Any sAny = null; try { sAny = codec.decode_value(taggedComponent.component_data, ASERVICE_COMPONENTHelper.type()); } catch (TypeMismatch e) { System.out.println("Exception handling not shown."); } catch (FormatMismatch e) { System.out.println("Exception handling not shown."); } ASERVICE_COMPONENT aServiceComponent = ASERVICE_COMPONENTHelper.extract(sAny); // // Only send the service context if the target object requires it. // if (aServiceComponent.requiresAService) { try { Any any = ri.get_slot(slotId); if (any.type().kind().equals(TCKind.tk_long)) { int serviceId = any.extract_long(); byte[] serviceContextData = { // Little endian to make it // easier to see in debugger. (byte)((serviceId >>> 0) & 0xFF), (byte)((serviceId >>> 8) & 0xFF), (byte)((serviceId >>> 16) & 0xFF), (byte)((serviceId >>> 24) & 0xFF) }; ri.add_request_service_context( new ServiceContext(serviceContextId, serviceContextData), false); } } catch (InvalidSlot e) { System.out.println("Exception handling not shown."); } } } catch (BAD_PARAM e) { // If it is not present, do nothing. ; } } public void send_poll(ClientRequestInfo ri) { } public void receive_reply(ClientRequestInfo ri) { } public void receive_exception(ClientRequestInfo ri) { } public void receive_other(ClientRequestInfo ri) { } // // ServerRequestInterceptor operations // public void receive_request_service_contexts(ServerRequestInfo ri) { try { ServiceContext serviceContext = ri.get_request_service_context(serviceContextId); byte[] data = serviceContext.context_data; int b1, b2, b3, b4; b4 = (data[0] << 0) & 0x000000FF; b3 = (data[1] << 8) & 0x0000FF00; b2 = (data[2] << 16) & 0x00FF0000; b1 = (data[3] << 24) & 0xFF000000; int serviceId = (b1 | b2 | b3 | b4); Any any = ORB.init().create_any(); any.insert_long(serviceId); ri.set_slot(slotId, any); } catch (BAD_PARAM e) { // Not present means service is not in effect. // Do nothing. ; } catch (InvalidSlot e) { System.out.println("Exception handling not shown."); } } public void receive_request(ServerRequestInfo ri) { } public void send_reply(ServerRequestInfo ri) { } public void send_exception(ServerRequestInfo ri) { } public void send_other(ServerRequestInfo ri) { } }
AServiceIORInterceptor.java
// AServiceIORInterceptor.java // Copyright and License package pi.serviceexample; import org.omg.CORBA.Any; import org.omg.CORBA.LocalObject; import org.omg.CORBA.ORB; import org.omg.IOP.TaggedComponent; import org.omg.IOP.Codec; import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; import org.omg.PortableInterceptor.IORInfo; import org.omg.PortableInterceptor.IORInterceptor; public class AServiceIORInterceptor extends org.omg.CORBA.LocalObject implements IORInterceptor { private Codec codec; public AServiceIORInterceptor(Codec codec) { this.codec = codec; } // // Interceptor operations // public String name() { return "AServiceInterceptor"; } public void destroy() { } // // IOR Interceptor operations // public void establish_components(IORInfo info) { // // Note: typically, rather than just inserting a tagged component // this interceptor would check info.get_effective_policy(int) // to determine if a tagged component reflecting that policy // should be added to the IOR. That is not shown in this example. // ASERVICE_COMPONENT aServiceComponent = new ASERVICE_COMPONENT(true); Any any = ORB.init().create_any(); ASERVICE_COMPONENTHelper.insert(any, aServiceComponent); byte[] value = null; try { value = codec.encode_value(any); } catch (InvalidTypeForEncoding e) { System.out.println("Exception handling not shown."); } TaggedComponent taggedComponent = new TaggedComponent(TAG_ASERVICE_COMPONENT.value, value); info.add_ior_component(taggedComponent); } }
ArbitaryObjectImpl.java
This file is an implementation and server for the ArbitraryObject IDL interface. The implementations of the IDL interface operations explicitly call the AServiceImpl.verify() method to illustrate the end-to-end passing of data from the client (via AService.begin()) to the servant.
// ArbitaryObjectImpl.java // Copyright and License package pi.serviceexample; import org.omg.CORBA.ORB; import org.omg.CORBA.ORBPackage.InvalidName; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import org.omg.PortableServer.POAHelper; import java.util.Properties; class ArbitraryObjectImpl extends ArbitraryObjectPOA { public static ORB orb; private AService aService; // // The IDL operations. // public String arbitraryOperation1(String a1) { verifyService(); return "I got this from the client: " + a1; } public void arbitraryOperation2 (int a1) { verifyService(); } public void arbitraryOperation3(String a1) throws ArbitraryObjectException { verifyService(); if (a1.equals("throw exception")) { throw new ArbitraryObjectException("because you told me to"); } } private void verifyService() { getAService().verify(); } private AService getAService() { // Only look up the service once, then cache it. if (aService == null) { try { aService = AServiceHelper.narrow( orb.resolve_initial_references("AService")); } catch (InvalidName e) { System.out.println("Exception handling not shown."); } } return aService; } // // The server. // public static void main(String[] av) { try { if (orb == null) { Properties props = new Properties(); props.put("org.omg.PortableInterceptor.ORBInitializerClass." + "pi.serviceexample.AServiceORBInitializer", ""); props.put("org.omg.PortableInterceptor.ORBInitializerClass." + "pi.serviceexample.LoggingServiceServerORBInitializer", ""); orb = ORB.init(av, props); } POA rootPOA = POAHelper.narrow( orb.resolve_initial_references("RootPOA")); // Create a POA so the IOR interceptor executes. POA childPOA = rootPOA.create_POA("childPOA", null, null); childPOA.the_POAManager().activate(); byte[] objectId = childPOA.activate_object(new ArbitraryObjectImpl()); org.omg.CORBA.Object ref = childPOA.id_to_reference(objectId); NamingContext nameService = NamingContextHelper.narrow( orb.resolve_initial_references("NameService")); NameComponent path[] = { new NameComponent("ArbitraryObject", "") }; nameService.rebind(path, ref); System.out.println("ArbitaryObject ready."); orb.run(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } System.exit(0); } }
Client.java
This is a client that calls methods on ArbitraryObject. It makes some of those calls within the context of AService and some outside of its context. It is unaware of the existence of the logging interceptor (except that it explicitly registers the LoggingServerClientORBInitializer as noted above).
// Client.java // Copyright and License package pi.serviceexample; import org.omg.CORBA.ORB; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import java.util.Properties; public class Client { public static void main(String av[]) { try { Properties props = new Properties(); props.put("org.omg.PortableInterceptor.ORBInitializerClass." + "pi.serviceexample.AServiceORBInitializer", ""); props.put("org.omg.PortableInterceptor.ORBInitializerClass." + "pi.serviceexample.LoggingServiceClientORBInitializer", ""); ORB orb = ORB.init(av, props); // // The client obtains a reference to a service. // The client does not know the service is implemented // using interceptors. // AService aService = AServiceHelper.narrow( orb.resolve_initial_references("AService")); // // The client obtains a reference to some object that // it will invoke. // NamingContext nameService = NamingContextHelper.narrow( orb.resolve_initial_references("NameService")); NameComponent arbitraryObjectPath[] = { new NameComponent("ArbitraryObject", "") }; ArbitraryObject arbitraryObject = ArbitraryObjectHelper.narrow(nameService.resolve(arbitraryObjectPath)); // // The client begins the service so that invocations of // any object will be done with that service in effect. // aService.begin(); arbitraryObject.arbitraryOperation1("one"); arbitraryObject.arbitraryOperation2(2); // // The client ends the service so that further invocations // of any object will not be done with that service in effect. // aService.end(); // This invocation is not serviced by aService since // it is outside the begin/end. arbitraryObject.arbitraryOperation3("just return"); aService.begin(); try { arbitraryObject.arbitraryOperation3("throw exception"); throw new RuntimeException("should not see this"); } catch (ArbitraryObjectException e) { // Expected in this example, so do nothing. } aService.end(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } System.out.println("Client done."); System.exit(0); } }
ColocatedServers.java
This is a server which runs both ArbitraryObject and LoggingService in the same ORB. This means that these objects are colocated.
The server is created this way in order to exercise the code in LoggingServiceServerInterceptor that illustrates when interceptors make out calls to objects colocated in the same ORB extra steps must be taken to avoid infinite recursion.
// ColocatedServers.java // Copyright and License package pi.serviceexample; import org.omg.CORBA.ORB; import java.util.Properties; public class ColocatedServers { public static ORB orb; public static boolean colocatedBootstrapDone = false; public static void main (String[] av) { try { // // Share an ORB between objects servers. // Properties props = new Properties(); props.put("org.omg.PortableInterceptor.ORBInitializerClass." + "pi.serviceexample.AServiceORBInitializer", ""); props.put("org.omg.PortableInterceptor.ORBInitializerClass." + "pi.serviceexample.LoggingServiceServerORBInitializer", ""); ORB orb = ORB.init(av, props); ArbitraryObjectImpl.orb = orb; LoggingServiceImpl.orb = orb; // // Start both object servers. // ServerThread ServerThread = new ServerThread(av); ServerThread.start(); ArbitraryObjectImpl.main(av); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } } } class ServerThread extends Thread { String[] av; ServerThread (String[] av) { this.av = av; } public void run () { LoggingServiceImpl.main(av); } }
The example code, which contains the logging example and the service example, may be compiled and run using a Makefile such as that shown below:
# Makefile for the Example Files # Copyright and License JAVA_HOME=/path_to_J2SE_installation CLASSPATH=. JAVAC=$(JAVA_HOME)/bin/javac JAVA=$(JAVA_HOME)/bin/java ORB_INITIAL_PORT=1050 IDLJ=$(JAVA_HOME)/bin/idlj IDLJ_FLAGS=-fall -td $(CLASSPATH) -verbose ORBD=${JAVA_HOME}/bin/orbd -ORBInitialPort ${ORB_INITIAL_PORT} build: $(IDLJ) $(IDLJ_FLAGS) serviceexample.idl $(JAVAC) -d $(CLASSPATH) *.java $(JAVAC) pi/serviceexample/*.java runorbd: $(ORBD) runloggingservice: $(JAVA) -classpath $(CLASSPATH) pi.serviceexample.LoggingServiceImpl \ -ORBInitialPort ${ORB_INITIAL_PORT} runarbitraryobject: $(JAVA) -classpath $(CLASSPATH) pi.serviceexample.ArbitraryObjectImpl \ -ORBInitialPort ${ORB_INITIAL_PORT} runcolocatedservers: $(JAVA) -classpath $(CLASSPATH) pi.serviceexample.ColocatedServers \ -ORBInitialPort ${ORB_INITIAL_PORT} runclient: $(JAVA) -classpath $(CLASSPATH) pi.serviceexample.Client \ -ORBInitialPort ${ORB_INITIAL_PORT} clean: rm -rf pi rm -rf orb.db # Order of steps: # Build: clean build # Remote: runorbd runloggingservice runarbitraryobjectimpl runclient # Colocated: runorbd runcolocatedservers runclient
The following steps show how to build and run the example on the
Solaris operating system using the above Makefile. From the command
prompt, run these commands as shown. The %
symbol is
used as a reminder that these are commands that are to be run from
the command prompt.
After this step, you will see output such as this:
resolve send_request resolve receive_reply arbitraryOperation1 send_request Service present: 1 arbitraryOperation1 receive_reply arbitraryOperation2 send_request Service present: 1 arbitraryOperation2 receive_other arbitraryOperation3 send_request Service not present arbitraryOperation3 receive_reply arbitraryOperation3 send_request Service present: 2 arbitraryOperation3 receive_exception Client done.

After this step, you will see output such as this:
[1]- Running make runorbd & [4]+ Running make runcolocatedservers &
ORBInitInfo


Represents a JDBC result set. This interface was added in SQL Server JDBC Driver 3.0.
Package: com.microsoft.sqlserver.jdbc
Extends: java.sql.ResultSet
Syntax
public interface ISQLServerResultSet
Remarks
This interface is implemented by SQLServerResultSet Class.
This interface exposes the following SQL Server JDBC Driver-specific methods:
| Method | For more information, see |
|---|---|
|
public microsoft.sql.DateTimeOffset getDateTimeOffset(int) |
|
|
public microsoft.sql.DateTimeOffset getDateTimeOffset(String) |
|
|
public void updateDateTimeOffset(int, microsoft.sql.DateTimeOffset) |
|
|
public void updateDateTimeOffset(String, microsoft.sql.DateTimeOffset) |
This interface exposes the following SQL Server JDBC Driver-specific fields:
| Field | For more information, see |
|---|---|
|
public static final int CONCUR_SS_OPTIMISTIC_CC |
|
|
public static final int CONCUR_SS_OPTIMISTIC_CCVAL |
|
|
public static final int CONCUR_SS_SCROLL_LOCKS |
|
|
public static final int TYPE_SS_DIRECT_FORWARD_ONLY |
|
|
public static final int TYPE_SS_SCROLL_DYNAMIC |
|
|
public static final int TYPE_SS_SCROLL_KEYSET |
|
|
public static final int TYPE_SS_SCROLL_STATIC |
|
|
public static final int TYPE_SS_SERVER_CURSOR_FORWARD_ONLY |


Namespace Sfdc.canvas.client
Sfdc.canvas.client
Defined in: client.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
ajax(url, settings)
Performs a cross-domain, asynchronous HTTP request.
|
|
|
autogrow(client, b, interval)
Starts or stops a timer which checks the content size of the iFrame and
adjusts the frame accordingly.
|
|
|
ctx(clientscb, client)
Returns the context for the current user and organization.
|
|
|
publish(client, e)
Publishes a custom event.
|
|
|
refreshSignedRequest(clientscb)
Refresh the signed request.
|
|
|
repost(refresh)
Repost the signed request.
|
|
|
resize(client, size)
Informs the parent window to resize the canvas iFrame.
|
|
|
Temporary storage for the signed request.
|
|
|
size()
Returns the current size of the iFrame.
|
|
|
subscribe(client, s)
Subscribes to parent or custom events.
|
|
|
token(t)
Stores or gets the oauth token in a local javascript variable.
|
|
|
unsubscribe(client, s)
Unsubscribes from parent or custom events.
|
|
|
version()
Returns the current version of the client.
|
Method Detail
ajax(url, settings)
Performs a cross-domain, asynchronous HTTP request.
Note: this method shouldn't be used for same domain requests.
Note: this method shouldn't be used for same domain requests.
//Posting to a Chatter feed: var sr = JSON.parse('<%=signedRequestJson%>'); var url = sr.context.links.chatterFeedsUrl+"/news/" +sr.context.user.userId+"/feed-items"; var body = {body : {messageSegments : [{type: "Text", text: "Some Chatter Post"}]}}; Sfdc.canvas.client.ajax(url, {client : sr.client, method: 'POST', contentType: "application/json", data: JSON.stringify(body), success : function(data) { if (201 === data.status) { alert("Success" } } });
// Gets a list of Chatter users: // Paste the signed request string into a JavaScript object for easy access. var sr = JSON.parse('<%=signedRequestJson%>'); // Reference the Chatter user's URL from Context.Links object. var chatterUsersUrl = sr.context.links.chatterUsersUrl; // Make an XHR call back to Salesforce through the supplied browser proxy. Sfdc.canvas.client.ajax(chatterUsersUrl, {client : sr.client, success : function(data){ // Make sure the status code is OK. if (data.status === 200) { // Alert with how many Chatter users were returned. alert("Got back " + data.payload.users.length + " users"); // Returned 2 users } })};
- Parameters:
- {String} url
- The URL to which the request is sent
- {Object} settings
- A set of key/value pairs to configure the request
The success setting is required at minimum and should be a callback function - {String} settings.client Optional
- The required client context {oauthToken: "", targetOrigin : "", instanceId : ""}
- {String} settings.contentType Optional
- "application/json"
- {String} settings.data Optional
- The request body
- {String} settings.headers Optional
- request headers
- {String} settings.method Optional, Default: "GET"
- The type of AJAX request to make
- {Function} settings.success Optional
- Callback for all responses from the server (failure and success). Signature: success(response); interesting fields: [response.data, response.responseHeaders, response.status, response.statusText}
- {Boolean} settings.async Optional, Default: true
- Asynchronous: only
true
is supported.
- Throws:
- An error if the URL is missing or the settings object doesn't contain a success callback function.
autogrow(client, b, interval)
Starts or stops a timer which checks the content size of the iFrame and
adjusts the frame accordingly.
Use this function when you know your content is changing size, but you're not sure when. There's a delay as
the resizing is done asynchronously. Therfore, if you know when your content changes size, you should
explicitly call the resize() method and save browser CPU cycles.
Note: you should turn off scrolling before this call, otherwise you might get a flicker.
// Turn on auto grow with default settings. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.autogrow(sr.client); }); // Turn on auto grow with a polling interval of 100ms (milliseconds). Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.autogrow(sr.client, true, 100); }); // Turn off auto grow. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.autogrow(sr.client, false); });
- Parameters:
- {client} client
- The object from the signed request
- {boolean} b
- Whether it's turned on or off; defaults to
true
- {Integer} interval
- The interval used to check content size; default timeout is 300ms.
ctx(clientscb, client)
Returns the context for the current user and organization.
// Gets context in the canvas app. function callback(msg) { if (msg.status !== 200) { alert("Error: " + msg.status); return; } alert("Payload: ", msg.payload); } var ctxlink = Sfdc.canvas.byId("ctxlink"); var client = Sfdc.canvas.oauth.client(); ctxlink.onclick=function() { Sfdc.canvas.client.ctx(callback, client)}; }
- Parameters:
- {Function} clientscb
- The callback function to run when the call to ctx completes
- {Object} client
- The signedRequest.client.
publish(client, e)
Publishes a custom event. Events are published to all subscribing canvas applications
on the same page, regardless of domain. Choose a unique namespace so the event doesn't collide with other
application events. Events can have payloads of arbitrary JSON objects.
// Publish the foo.bar event with the specified payload. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.publish(sr.client, {name : "foo.bar", payload : {some : 'stuff'}}); });
- Parameters:
- {client} client
- The object from the signed request
- {Object} e
- The event to publish
refreshSignedRequest(clientscb)
Refresh the signed request. Obtain a new signed request on demand. Note the
authentication mechanism of the canvas app must be set to SignedRequest and not OAuth.
// Gets a signed request on demand. Sfdc.canvas.client.refreshSignedRequest(function(data) { if (data.status === 200) { var signedRequest = data.payload.response; var part = signedRequest.split('.')[1]; var obj = JSON.parse(Sfdc.canvas.decode(part)); } }
- Parameters:
- {Function} clientscb
- The client's callback function to receive the base64 encoded signed request.
repost(refresh)
Repost the signed request. Instruct the parent window to initiate a new post to the
canvas url. Note the authentication mechanism of the canvas app must be set to SignedRequest and not OAuth.
// Gets a signed request on demand, without refreshing the signed request. Sfdc.canvas.client.repost(); // Gets a signed request on demand, first by refreshing the signed request. Sfdc.canvas.client.repost({refresh : true});
- Parameters:
- {Boolean} refresh Optional, Default: false
- Refreshes the signed request when set to true.
resize(client, size)
Informs the parent window to resize the canvas iFrame. If no parameters are specified,
the parent window attempts to determine the height of the canvas app based on the
content and then sets the iFrame width and height accordingly. To explicitly set the dimensions,
pass in an object with height and/or width properties.
//Automatically determine the size Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.resize(sr.client); });
//Set the height and width explicitly Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.resize(sr.client, {height : "1000px", width : "900px"}); });
//Set only the height Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.resize(sr.client, {height : "1000px"}); });
- Parameters:
- {Client} client
- The object from the signed request
- {size} size
- The optional height and width information
{Object}
signedrequest(s)
Temporary storage for the signed request. An alternative for users storing SR in
a global variable. Note: if you would like a new signed request take a look at refreshSignedRequest().
- Parameters:
- {Object} s
- signedrequest to be temporarily stored in Sfdc.canvas.client object.
- Returns:
- {Object} the value previously stored
{Object}
size()
Returns the current size of the iFrame.
//get the size of the iFrame and print out each component. var sizes = Sfdc.canvas.client.size(); console.log("contentHeight; " + sizes.heights.contentHeight); console.log("pageHeight; " + sizes.heights.pageHeight); console.log("scrollTop; " + sizes.heights.scrollTop); console.log("contentWidth; " + sizes.widths.contentWidth); console.log("pageWidth; " + sizes.widths.pageWidth); console.log("scrollLeft; " + sizes.widths.scrollLeft);
- Returns:
- {Object}
heights.contentHeight
: the height of the virtual iFrame, all content, not just visible content.
heights.pageHeight
: the height of the visible iFrame in the browser.
heights.scrollTop
: the position of the scroll bar measured from the top.
widths.contentWidth
: the width of the virtual iFrame, all content, not just visible content.
widths.pageWidth
: the width of the visible iFrame in the browser.
widths.scrollLeft
: the position of the scroll bar measured from the left.
subscribe(client, s)
Subscribes to parent or custom events. Events
with the namespaces 'canvas', 'sfdc', 'force', 'salesforce', and 'chatter' are reserved by Salesforce.
Developers can choose their own namespace and event names.
Event names must be in the form
namespace.eventname
.
// Subscribe to the parent window onscroll event. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); // Capture the onScrolling event of the parent window. Sfdc.canvas.client.subscribe(sr.client, {name : 'canvas.scroll', onData : function (event) { console.log("Parent's contentHeight; " + event.heights.contentHeight); console.log("Parent's pageHeight; " + event.heights.pageHeight); console.log("Parent's scrollTop; " + event.heights.scrollTop); console.log("Parent's contentWidth; " + event.widths.contentWidth); console.log("Parent's pageWidth; " + event.widths.pageWidth); console.log("Parent's scrollLeft; " + event.widths.scrollLeft); }} ); });
// Subscribe to a custom event. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.subscribe(sr.client, {name : 'mynamespace.someevent', onData : function (event) { console.log("Got custom event ", event); }} ); });
// Subscribe to multiple events Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.subscribe(sr.client, [ {name : 'mynamespace.someevent1', onData : handler1}, {name : 'mynamespace.someevent2', onData : handler2}, ]); });
//Subscribe to Streaming API events. //The PushTopic to subscribe to must be passed in. //The 'onComplete' method may be defined, //and will fire when the subscription is complete. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); var handler1 = function(){ console.log("onData done");}, handler2 = function(){ console.log("onComplete done");}; Sfdc.canvas.client.subscribe(sr.client, {name : 'sfdc.streamingapi', params:{topic:"/topic/InvoiceStatements"}}, onData : handler1, onComplete : handler2} ); });
- Parameters:
- {client} client
- The object from the signed request
- {Object} s
- The subscriber object or array of objects with name and callback functions
{Object}
token(t)
Stores or gets the oauth token in a local javascript variable. Note, if longer term
(survive page refresh) storage is needed store the oauth token on the server side.
- Parameters:
- {String} t
- oauth token, if supplied it will be stored in a volatile local JS variable.
- Returns:
- {Object} the oauth token.
unsubscribe(client, s)
Unsubscribes from parent or custom events.
//Unsubscribe from the canvas.scroll method. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.unsubscribe(sr.client, "canvas.scroll"); });
//Unsubscribe from the canvas.scroll method by specifying the object name. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.unsubscribe(sr.client, {name : "canvas.scroll"}); });
//Unsubscribe from multiple events. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.unsubscribe(sr.client, ['canvas.scroll', 'foo.bar']); });
//Unsubscribe from Streaming API events. //The PushTopic to unsubscribe from must be passed in. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.unsubscribe(sr.client, {name : 'sfdc.streamingapi', params:{topic:"/topic/InvoiceStatements"}}); });
- Parameters:
- {client} client
- The object from the signed request
- {Object} s
- The events to unsubscribe from
{Object}
version()
Returns the current version of the client.
- Returns:
- {Object} {clientVersion : "29.0", parentVersion : "29.0"}.


---
layout: post
title: Comparing Six Ways to Identify Top Blogs in Any Niche - ReadWriteWeb
date: '2008-02-28T20:22:47-08:00'
tags:
tumblr_url: http://alexhwilliams.tumblr.com/post/27574821/comparing-six-ways-to-identify-top-blogs-in-any-niche
---
Comparing Six Ways to Identify Top Blogs in Any Niche - ReadWriteWeb


//A common issue with loops is is that closures share the same single environment //Take a look at example 1 in both html and js
Helpful notes will appear here
E-mail:
Name:
Age:
//The reason this does not work is because the three closures that have been created share the same environement. //By the time the callbacks are executed, the loop has run its course and the item variable(which is shared by all three closures) is left pointing to the last entry. //Use the same html code from example 1 for example 2. //This calls back what you would expect, 3 different "help" callbacks.


{% extends "layout.html" %} {% block css %} {% endblock %} {% block content %}
Here you need to add some details about the person you are monitoring before proceeding.
{% if carereceiver == None %}
Register someone »
{% else %}
Current care receiver is {{ carereceiver.full_name }}.
Unregister »
{% endif %}
Register a movement sensor to your connected care-receiver or disconnect it.
{% if movement_sensor == None %} Connect » {% else %} Disconnect » {% endif %}
Register a heart rate sensor to your connected care-receiver or disconnect it.
{% if hr_sensor == None %} Connect » {% else %} Disconnect » {% endif %}


| initializeCopyModel {FSDM} | R Documentation |
initializeCopyModel
initializes a new model by creating a directory
with the model name and copying the contents of an existing model into that
directory. Creates and saves a model status list.
initializeCopyModel(ModelsDir, ModelName, CopyModelName, Author, CopyScenarios = FALSE)
ModelsDir |
a string identifying the path to the models folder in which |
ModelName |
a string identifying the model name. |
CopyModelName |
a string identifying the name of the model to copy. |
Author |
a string identifying the name of the author. |
CopyScenarios |
a logical to determine whether to copy the model scenarios. |
This function initializes a new model with the given model name from an existing model. It does this by creating a directory with the model name and copying the model files for an existing model into it. It also copies and updates the model status list by identifying the new model name, the parent model (i.e. copied model) name, time and date of creation, edit and attribution history, and model notes. The function can be used to copy only the model or all the scenarios as well as the model
a model status list for the model which includes information about the copied model.


Contact Me
Get in touch to find out more.
Name
Email Address
Consulting
Training & Workshops
Coaching
Other
arrow_drop_down
Interested in...
Tell me a bit about you or your company...


Gecode code statistics
The following approximate breakdown into the different parts of Gecode gives some statistics about the amount of code and documentation contained in the code (as comments) where blank lines are excluded.The abbreviation "loc" means "lines of code" and "lod" means "lines of documentation".
- Kernel: 46 classes, 2961 loc, 2124 lod
- Core functionality: 18 classes, 1376 loc, 1096 lod
- Miscellaneous: 28 classes, 1585 loc, 1028 lod
- Search engines: 19 classes, 1056 loc, 790 lod
- Finite domain integers: 245 classes, 22142 loc, 9808 lod
- Variables, views, and variable implementations: 29 classes, 3015 loc, 1926 lod
- Propagators: 168 classes, 15736 loc, 6082 lod
- Branchings: 23 classes, 495 loc, 332 lod
- Posting propagators and branchings: 9 classes, 2725 loc, 1299 lod
- Miscellaneous: 16 classes, 171 loc, 169 lod
- Finite integer sets: 87 classes, 10090 loc, 5492 lod
- Variables, views, and variable implementations: 46 classes, 3187 loc, 2126 lod
- Propagators: 23 classes, 5501 loc, 2580 lod
- Branchings: 7 classes, 170 loc, 156 lod
- Posting propagators and branchings: 0 classes, 1056 loc, 474 lod
- Miscellaneous: 11 classes, 176 loc, 156 lod
- Minimal modelling support: 11 classes, 1453 loc, 700 lod
- Range and value iterators: 36 classes, 1763 loc, 1292 lod
- Support algorithms and datastructures: 12 classes, 771 loc, 404 lod
- Example scripts: 49 classes, 4268 loc, 2208 lod
- Systematic tests: 190 classes, 6356 loc, 1051 lod
- Core functionality: 3 classes, 669 loc, 78 lod
- Finite domain integers: 102 classes, 3167 loc, 508 lod
- Finite integer sets: 82 classes, 2225 loc, 268 lod
- System stress: 3 classes, 295 loc, 197 lod
The grand total: 695 classes, 50860 loc, 23869 lod


§490:2-303 Allocation or division of risks. Where this article allocates a risk or a burden as between the parties "unless otherwise agreed", the agreement may not only shift the allocation but may also divide the risk or burden. [L 1965, c 208, §2-303; HRS §490:2-303]


Welcome, !
You have successfully logged in!
Access Token:
Expires In:
ID Token:
Refresh Token:
Scope(s):
Token Type:


Founder and CEO of The Privilege Escalation Foundation. She is a transgender computer scientist with a passion for knowledge.
She is an author, distinguished engineer, and transgender rights advocate best known for her work in Kubernetes, Linux, cyber security and cloud infrastructure.


List of all mentees
|
||||||||
Would you like to have another mentee?become a mentor |
||||||||
Would you like to request a mentor?request a mentor |
Match me with someone who identifies as:
Other
|
Message to potential mentor |
Anything else you want to share? |
Select one or more potential mentees
| |
Trans*Network Mentor FAQWhat is a mentor? |
Why should I mentor? |
What can I do as a mentor? |
Think you are ready? |


The queen of the hills is a Himalayan city in the Indian state of West Bengal. It is internationally renowned as a tourist destination for its spectacular view of Mt.Kanchandzonga, along with its tea industry and the Darjeeling Himalayan Railway, a UNESCO World Heritage site.
Digha is a seaside resort town in the state of West Bengal, India. It lies in Purba Medinipur district and at the northern end of the Bay of Bengal. It has a low gradient with a shallow sand beach. It is the most popular sea resort in West Bengal.
Bishnupur was ruled under the Gupta period by local Hindu kings who paid tribute to Samudra Gupta.Following a long period of obscurity, where the land oscillated between being a minor independent principality and a vassal state. The land is also called Mallabhum after the Malla rulers of this place.
The Sundarbans is a mangrove area in the delta formed by the confluence of Ganges, Brahmaputra and Meghna Rivers in the Bay of Bengal. It spans from the Hooghly River in India's state of West Bengal to the Baleswar River in Bangladesh.
The Dooars or Duars are the alluvial floodplains in northeastern India that lie south of the outer foothills of the Himalayas and north of the Brahmaputra River basin. This region is about 30 km wide and stretches over about 350 kmfrom the Teesta River in West Bengal to the Dhanshiri River in Assam.
Murshidabad is a town in the Indian state of West Bengal. It is located on the eastern bank of the Hooghly River, a distributary of the Ganges River. It forms part of the Murshidabad district. During the 18th-century, Murshidabad was an early modern financial center. It was the capital of the Bengal Subah in the Mughal Empire for seventy years, with a jurisdiction covering modern-day Bangladesh and the Indian states of West Bengal, Bihar and Orissa.


This module computes a shadow projection of a 3D uniform scalar field onto the three major planes (xy, xz, yz).
Input Ports
Name Type Description in Mesh_Unif+Node_Data input field for which the shadow projection takes place. Parameters
Name Type Description Name axis int Projection Axis. This axis is perpendicular to the output plane. Slider method enum selection of projection methods RadioBox Output Ports
Name Type Description out Mesh_Unif+Node_Data 2D Projection througth the 3D data volume obj DefaultObject Directly renderable object of the 2D output
The ProjectNodeData module computes a shadow projection of the node data stored in a 3D uniform scalar field onto the 3 mojor planes (xy, xz, yz).
If the Node_Data contains multiple components, all the components use the same mapping method. The data value of point on the 2D plane is dependent on all the datapoints which are using the same coordinates in the 2 used axis in the 3D volume (i.e. if y is the mapping axis points with identical x and z coordinates will be used for the same point in the 2D field).
The module provides the following mapping methods:
- Maximum
Each point on the plane is allocated the maximum value of all the node data values contibuting.
- Depth
Each point on the plane is allocated the location of the maximum value of all the node data values contibuting on the mapping axis.
- Depth+Maximum
Each point on the plane is allocated the maximum value multiplied by its location on the mapping axis.
- Mean
Each point on the plane is allocated the average value of all the node data values contibuting.
- Sum
Each point on the plane is allocated the sum of all the node data values contibuting.
- Magnitude
Each point on the plane is allocated the magnitude (square root of values squared) of all the node data values contibuting.
Inputs
inMesh_Unif+Node_Data that contains the 3D mesh to be projectedParameters
axisThis slider allows to select the projection axis (perpendicular to the projection plane).methodThis radiobox is used to select the mapping method.Outputs
outThis Mesh_Unif+Node_Data contains the 2D projection.objThis DataObject is a directly renderable object of the 2D projection.
The example applications show the usage of ProjectNodeData in a 2D and 3D environment. The 3D example uses 3 ProjectNodeData modules to 'build the cube.
xp_comm_proj/projnd/projnd.v
Creates the XP_COMM_PROJ.ProjectNodeData library.
xp_comm_proj/projnd/prndmod.v
Creates the ProjectNodeDataMods library containing the low-level module ProjectNodeDataCore and the parameter group ProjectNodeDataParams.
xp_comm_proj/projnd/prndmac.v
Creates the ProjectNodeDataMacs library containing the high-level macros ProjectNodeDataFunc, ProjectNodeDataUI and ProjectNodeData.
xp_comm_proj/projnd/prndapp.v
Creates the ProjectNodeDataApps library containing the examle applications ProjectNodeData2DEg and ProjectNodeData3DEg.
Tobias Schiebeck Manchester Visualization Centre


Travel
Hotels
{{ hotel.name }}
{{ hotel.short }}+make reservation
Tours
{{ tour.name }}
{{ tour.short }}+learn more
If you are interested in taking one of these tour please contact Cocha Tours - Carolina Sciaccaluga<EMAIL_ADDRESS>or Marianela Arias<EMAIL_ADDRESS>Tel: 56-22-4641500 /1504/1532
Restaurants
You will get special discounts in these selected restaurants if you present your Fab13 Credentials!
{{ restaurant.name }}
{{ restaurant.short }}+visit site
Visa Invitation Letters
{{ site.data.travel.invitationletters.eng }}
{% for link in site.data.travel.invitationletters.links %}+ {{ link.eng }}
{% endfor %}Visa Requirements
{{ site.data.travel.visas.eng }}
{{ letter.initial }}
-
{% for country in letter.countries %}
- {{ country.name }} {% endfor %}
We can't list all of the rules for each country here but a useful site to check is http://www.minrel.gob.cl/. Although it's helpful, we cannot vouch for the accuracy of the information on this site. If you want to be absolutely sure that you are receiving the correct information please contact your Foreign Office or relevant government institution.
Transport
{{ site.data.travel.transport.eng }}
{% for link in site.data.travel.transport.links %}+ {{ link.eng }}
{% endfor %}What you can and can't enter to Chile
{{ site.data.travel.customs.eng }}
{% for link in site.data.travel.customs.links %}+ {{ link.eng }}
{% endfor %}Other useful links
{{ site.data.travel.otherlinks.eng}}
{% for link in site.data.travel.otherlinks.links %}


We store your personal data in the United States. See our privacy policy for more information.
Building an application, service, or tool that integrates with GitHub? Join the GitHub Developer Program,or read more about it at our Developer site.
Check out the Developer site for guides, our API reference, and other resources for building applications that integrate with GitHub. Make sure your contact information is up-to-date below. Thanks for being a member!


background-position
top right
top left
bottom right
bottom left
background-size
First example has a size set in pixels. Second one in points. See the difference at 120dpi.
aspect="atleast"
aspect="atmost"
background-repeat
repeat
no-repeat


MorseGen is a program for generating raw data based on user-specified summary (descriptive) statistics. Samples based on the supplied statistics are drawn from a normal distribution (or, in some cases, an exponential distribution) and scaled to match the desired descriptive statistics. Intended uses include creating raw data that fits desired characteristics or to replicate the results in a published study.
| Version: | 1.2 |
| Published: | 2012-06-04 |
| Author: | Brendan Morse |
| Maintainer: | Brendan Morse <bmorse at bridgew.edu> |
| License: | GPL-2 |
| NeedsCompilation: | no |
| CRAN checks: | MorseGen results |
| Reference manual: | MorseGen.pdf |
| Package source: | MorseGen_1.2.tar.gz |
| Windows binaries: | r-devel: MorseGen_1.2.zip, r-release: MorseGen_1.2.zip, r-oldrel: MorseGen_1.2.zip |
| OS X binaries: | r-release: MorseGen_1.2.tgz, r-oldrel: MorseGen_1.2.tgz |
| Old sources: | MorseGen archive |
Please use the canonical form https://CRAN.R-project.org/package=MorseGen to link to this page.


For frequently-asked questions, see below. For all other questions, please call our office manager Gina Pashby at<PHONE_NUMBER>
You will receive a copy of your bill. After your insurance has paid, we'll provide you with a monthly statement of your account.
Generally, it takes from 45 to 60 days to obtain payment from an insurance carrier.
If we have received any such information from your insurance company, we'll be glad to share it with you. However, for answers to any questions about insurance payments, deductibles, or co-payments, you generally need to check with your insurance company.
Please contact our office manager, Gina Pashby at<PHONE_NUMBER> for any questions about your bill. She would be happy to assist you.
Our services are billed by Catalyst Behavioral Health or by an affiliate billing company. Our providers participate in most all of the major health insurance plans in the region. Please be aware that with any health plan there may be deductibles and co-payments for which you could be responsible. In our office, payment is expected at the time of service.
We ask that all clients kindly notify us of an appointment cancellation at least 24 hours in advance. If you are unable to give us 24 hours notice, your account will be billed $50. This fee is not covered by insurance and must be paid before your next appointment. This policy may not apply to Medicare clients. Thank you for your understanding.
If Lincoln Public Schools are closed due to inclement weather, our office will be closed as well. Some providers may choose to still see clients. Please check with your provider directly for more information.


Main game class used to initialize the game, create a game window and add scenes to it.
More...
#include <Game.hpp>
|
| | Game (const unsigned int WIDTH, const unsigned int HEIGHT, const std::string TITLE, const bool SHOW_DEBUG_PANE=true) |
| | Initializes the Game instance and member variables. More...
|
| |
| void | clear () |
| | Clears the window by calling the clear method on the SFML RenderWindow instance. More...
|
| |
| void | render () |
| | Resets the view (m_view) inside the window and calls the display method of the SFML RenderWindow to render the window. More...
|
| |
| void | draw (const sf::Drawable &drawable) |
| | Draws a SFML Drawable object on the window. More...
|
| |
| void | handleEvents () |
| | Polls the SFML Window for events received in the window, and handles them appropriately. More...
|
| |
| bool | isOpen () |
| |
| bool | hasFocus () |
| |
| void | mainLoop () |
| | Performs the game's main loop. More...
|
| |
| void | addScene (std::unique_ptr< Scene > scene) |
| | Adds a new scene to the game. More...
|
| |
| void | removeScene () |
| | Removes a scene from the game. More...
|
| |
| void | changeScene (std::unique_ptr< Scene > scene) |
| | Changes the current scene in the game. More...
|
| |
|
| sf::View | m_view |
| | SFML View instance for the game window. More...
|
| |
| std::unique_ptr< sf::RenderWindow > | m_window |
| | Unique pointer to a SFML RenderWindow object. TODO this and m_view can be made private maybe? More...
|
| |
Main game class used to initialize the game, create a game window and add scenes to it.
◆ Game()
| GameAIDemos::Game::Game |
( |
const unsigned int |
WIDTH, |
|
|
const unsigned int |
HEIGHT, |
|
|
const std::string |
TITLE, |
|
|
const bool |
SHOW_DEBUG_PANE = true |
|
) |
| |
Initializes the Game instance and member variables.
- Parameters
-
| WIDTH | The width of the game window. |
| HEIGHT | The height of the game window. |
| TITLE | A title for the game window. |
| SHOW_DEBUG_PANE | A boolean specifying whether the debug pane should be displayed. Defaults to true. |
◆ addScene()
| void GameAIDemos::Game::addScene |
( |
std::unique_ptr< Scene > |
scene | ) |
|
Adds a new scene to the game.
Adds a pointer to a Scene to the game's scene pointer queue. std::move() is used as to not push a copy of the pointer, but rather the pointer itself.
- Parameters
-
| scene | A unique pointer to a Scene object. |
- See also
- Scene
◆ changeScene()
| void GameAIDemos::Game::changeScene |
( |
std::unique_ptr< Scene > |
scene | ) |
|
Changes the current scene in the game.
Changes to a new scene in the game by removing the top scene and adding a new scene to the queue.
- Parameters
-
| scene | A unique pointer to a Scene object. |
- See also
- Scene
◆ clear()
| void GameAIDemos::Game::clear |
( |
| ) |
|
Clears the window by calling the clear method on the SFML RenderWindow instance.
◆ draw()
| void GameAIDemos::Game::draw |
( |
const sf::Drawable & |
drawable | ) |
|
Draws a SFML Drawable object on the window.
- Parameters
-
| drawable | Reference to the SFML Drawable object to be drawn on the window. |
◆ handleEvents()
| void GameAIDemos::Game::handleEvents |
( |
| ) |
|
Polls the SFML Window for events received in the window, and handles them appropriately.
◆ hasFocus()
| bool GameAIDemos::Game::hasFocus |
( |
| ) |
|
- Returns
- A boolean indicating if the window has focus.
◆ isOpen()
| bool GameAIDemos::Game::isOpen |
( |
| ) |
|
- Returns
- A boolean indicating if the window is open.
◆ mainLoop()
| void GameAIDemos::Game::mainLoop |
( |
| ) |
|
Performs the game's main loop.
Handles user input, updates game state and renders the game scene.
◆ removeScene()
| void GameAIDemos::Game::removeScene |
( |
| ) |
|
Removes a scene from the game.
Calls pop() on the Scene pointer queue.
- See also
- Scene
◆ render()
| void GameAIDemos::Game::render |
( |
| ) |
|
Resets the view (m_view) inside the window and calls the display method of the SFML RenderWindow to render the window.
◆ m_clock
| sf::Clock GameAIDemos::Game::m_clock |
|
private |
Instance of SFML Clock used to measure time. Used to get a delta time.
◆ m_deltaTime
| float GameAIDemos::Game::m_deltaTime |
|
private |
The delta time for the game's update frequency rate.
◆ m_hasFocus
| bool GameAIDemos::Game::m_hasFocus |
|
private |
Boolean specifying if the window has focus. This member variable is set in handleEvents() method.
◆ m_height
| unsigned int GameAIDemos::Game::m_height |
|
private |
Height of the game window.
◆ m_logger
| Logger GameAIDemos::Game::m_logger |
|
private |
Instance of Logger for logging.
◆ m_sceneQueue
| std::queue<std::unique_ptr<Scene> > GameAIDemos::Game::m_sceneQueue |
|
private |
Queue of unique pointers to Scene instances.
◆ m_showDebugPane
| bool GameAIDemos::Game::m_showDebugPane |
|
private |
Boolean specifying if the debug pane should be displayed in the game window. Defaults to true in the constructor.
◆ m_title
| std::string GameAIDemos::Game::m_title |
|
private |
Title of the game window seen in titlebar.
◆ m_view
| sf::View GameAIDemos::Game::m_view |
SFML View instance for the game window.
◆ m_width
| unsigned int GameAIDemos::Game::m_width |
|
private |
Width of the game window.
◆ m_window
| std::unique_ptr<sf::RenderWindow> GameAIDemos::Game::m_window |
Unique pointer to a SFML RenderWindow object. TODO this and m_view can be made private maybe?
The documentation for this class was generated from the following files:
- E:/Phixyn/Projects/ai-assignment-one-Phixyn/GameAIDemos/include/Game.hpp
- E:/Phixyn/Projects/ai-assignment-one-Phixyn/GameAIDemos/src/Game.cpp


|
JTS Topology Suite version 1.13 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vividsolutions.jts.io.WKTWriter
public class WKTWriter
Writes the Well-Known Text representation of a Geometry
.
The Well-Known Text format is defined in the
OGC
Simple Features Specification for SQL.
See WKTReader
for a formal specification of the format syntax.
The WKTWriter
outputs coordinates rounded to the precision
model. Only the maximum number of decimal places
necessary to represent the ordinates to the required precision will be
output.
The SFS WKT spec does not define a special tag for LinearRing
s.
Under the spec, rings are output as LINESTRING
s.
In order to allow precisely specifying constructed geometries,
JTS also supports a non-standard LINEARRING
tag which is used
to output LinearRings.
WKTReader
| Constructor Summary | |
|---|---|
WKTWriter()
Creates a new WKTWriter with default settings |
|
WKTWriter(int outputDimension)
Creates a writer that writes Geometry s with
the given output dimension (2 or 3). |
| Method Summary | |
|---|---|
void |
setFormatted(boolean isFormatted)
Sets whether the output will be formatted. |
void |
setMaxCoordinatesPerLine(int coordsPerLine)
Sets the maximum number of coordinates per line written in formatted output. |
void |
setTab(int size)
Sets the tab size to use for indenting. |
static java.lang.String |
stringOfChar(char ch,
int count)
Returns a String of repeated characters. |
static java.lang.String |
toLineString(Coordinate p0,
Coordinate p1)
Generates the WKT for a LINESTRING specified by two Coordinate s. |
static java.lang.String |
toLineString(CoordinateSequence seq)
Generates the WKT for a LINESTRING specified by a CoordinateSequence . |
static java.lang.String |
toPoint(Coordinate p0)
Generates the WKT for a POINT specified by a Coordinate . |
java.lang.String |
write(Geometry geometry)
Converts a Geometry to its Well-known Text representation. |
void |
write(Geometry geometry,
java.io.Writer writer)
Converts a Geometry to its Well-known Text representation. |
java.lang.String |
writeFormatted(Geometry geometry)
Same as write , but with newlines and spaces to make the
well-known text more readable. |
void |
writeFormatted(Geometry geometry,
java.io.Writer writer)
Same as write , but with newlines and spaces to make the
well-known text more readable. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WKTWriter()
public WKTWriter(int outputDimension)
Geometry
s with
the given output dimension (2 or 3).
If the specified output dimension is 3, the Z value
of coordinates will be written if it is present
(i.e. if it is not Double.NaN
).
outputDimension
- the coordinate dimension to output (2 or 3)| Method Detail |
|---|
public static java.lang.String toPoint(Coordinate p0)
Coordinate
.
p0
- the point coordinate
public static java.lang.String toLineString(CoordinateSequence seq)
CoordinateSequence
.
seq
- the sequence to write
public static java.lang.String toLineString(Coordinate p0, Coordinate p1)
Coordinate
s.
p0
- the first coordinatep1
- the second coordinate
public static java.lang.String stringOfChar(char ch, int count)
String
of repeated characters.
ch
- the character to repeatcount
- the number of times to repeat the character
String
of characterspublic void setFormatted(boolean isFormatted)
isFormatted
- true if the output is to be formattedpublic void setMaxCoordinatesPerLine(int coordsPerLine)
coordsPerLine
- the number of coordinates per line to output.public void setTab(int size)
size
- the number of spaces to use as the tab string
java.lang.IllegalArgumentException
- if the size is non-positivepublic java.lang.String write(Geometry geometry)
Geometry
to its Well-known Text representation.
geometry
- a Geometry
to process
public void write(Geometry geometry, java.io.Writer writer) throws java.io.IOException
Geometry
to its Well-known Text representation.
geometry
- a Geometry
to process
java.io.IOException
public java.lang.String writeFormatted(Geometry geometry)
write
, but with newlines and spaces to make the
well-known text more readable.
geometry
- a Geometry
to process
public void writeFormatted(Geometry geometry, java.io.Writer writer) throws java.io.IOException
write
, but with newlines and spaces to make the
well-known text more readable.
geometry
- a Geometry
to process
java.io.IOException
|
JTS Topology Suite version 1.13 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Last updated: 2021-07-03
Checks: 7 0
Knit directory: wgcna-workflow/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20210703)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version e65c504. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rproj.user/
Untracked files:
Untracked: LICENSE
Untracked: data/all_for_wgcna/
Untracked: data/project/
Unstaged changes:
Modified: analysis/_site.yml
Modified: data/README.md
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/FindPower.Rmd
) and HTML (docs/FindPower.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| Rmd | e65c504 | xiayh17 | 2021-07-03 | add findpower section for myproject |
| html | f603eba | xiayh17 | 2021-07-03 | Build site. |
| Rmd | 42955dd | xiayh17 | 2021-07-03 | Change theme for myproject |
依据前面的探索表达值筛选和cpm处理.，我们使用方案四进行后续分析
# load a test data
fs=list.files(path = 'data/project/',
pattern='PRJ',full.names = T,recursive = T)
f=fs[1]
load(f)
# get group info
pro=gsub('.Rdata','',basename(f))
library(fs)
key <- gsub(".Rdata","",basename(f),perl = TRUE)
test <- dir_info("data/all_for_wgcna", recurse = TRUE)
patho <- grep(key,test$path)
path <- test[patho,]$path
gd <- read.delim(path)
group <- as.factor(gd$infection_status)
# filter with filterByExpr
keep.exprs <- edgeR::filterByExpr(cg_exp, group=group)
cg_exp2 <- cg_exp[keep.exprs,] # 重新计算文库大小
ct <- cg_exp2
# cpm with log
datExpr4 <- edgeR::cpm(ct,log=T)
datExpr4 <- t(datExpr4)
这一步涉及到使用WGCNA包，在Rstudio中运行WGCNA时，是无法激活WGCNA的并行加速度，官方教程中有细致的说明 Tutorials for WGCNA R package, 但是这个教程很久没更新了，在查找软阈值这一步，根据CPU的状态判断，Rstudio中设置后还是可以并行的
# Load the WGCNA package
library(WGCNA)
Warning: 程辑包'WGCNA'是用R版本4.0.5 来建造的
载入需要的程辑包：dynamicTreeCut
Warning: 程辑包'dynamicTreeCut'是用R版本4.0.3 来建造的
载入需要的程辑包：fastcluster
Warning: 程辑包'fastcluster'是用R版本4.0.5 来建造的
载入程辑包：'fastcluster'
The following object is masked from 'package:stats':
hclust
Warning: 'which'存在多个方法表
载入程辑包：'WGCNA'
The following object is masked from 'package:stats':
cor
# The following setting is important, do not omit.
options(stringsAsFactors = FALSE);
library(WGCNA)
# Allow multi-threading within WGCNA. This helps speed up certain calculations.
# At present this call is necessary for the code to work.
# Any error here may be ignored but you may want to update WGCNA if you see one.

# See note above.
enableWGCNAThreads()
Allowing parallel execution with up to 7 working processes.
经过之前的处理，这一步一般都是没问题的 ，默认省略
# gsg = goodSamplesGenes(datExpr4, verbose = 3)
# gsg$allOK
这是教程中的模板代码，几乎通用
# Choose a set of soft-thresholding powers
powers = c(c(1:10), seq(from = 12, to=20, by=2))
# Call the network topology analysis function
sft = pickSoftThreshold(datExpr4, powerVector = powers, verbose = 5)
pickSoftThreshold: will use block size 3454.
pickSoftThreshold: calculating connectivity for given powers...
..working on genes 1 through 3454 of 12952
..working on genes 3455 through 6908 of 12952
..working on genes 6909 through 10362 of 12952
..working on genes 10363 through 12952 of 12952
Power SFT.R.sq slope truncated.R.sq mean.k. median.k. max.k.
1 1 0.3730 1.720 0.985 3320.00 3230.000 5270.0
2 2 0.0554 -0.302 0.919 1280.00 1160.000 2960.0
3 3 0.5700 -1.040 0.930 606.00<PHONE_NUMBER>.0
4 4 0.7570 -1.420 0.933 324.00<PHONE_NUMBER>.0
5 5 0.8270 -1.570 0.949 189.00 122.000 980.0
6 6 0.8550 -1.640 0.955 117.00 66.200 747.0
7 7 0.8520 -1.700 0.949 76.50 37.800 584.0
8 8 0.8480 -1.750 0.948 51.80 22.400 467.0
9 9 0.8570 -1.760 0.955 36.30 13.800 380.0
10 10 0.8430 -1.790 0.948 26.10 8.660 313.0
11 12 0.8550 -1.790 0.961 14.30 3.620 221.0
12 14 0.8360 -1.830 0.958 8.42 1.610 161.0
13 16 0.8560 -1.800 0.974 5.22 0.763 120.0
14 18 0.8620 -1.800 0.980 3.36 0.377 92.0
15 20 0.8530 -1.820 0.982 2.25 0.193 71.7
# Plot the results:
sizeGrWindow(9, 5)
par(mfrow = c(1,2));
cex1 = 0.85;
# Scale-free topology fit index as a function of the soft-thresholding power
plot(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
xlab="Soft Threshold (power)",ylab="Scale Free Topology Model Fit,signed R^2",type="n",
main = paste("Scale independence"));
text(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
labels=powers,cex=cex1,col="red");
# this line corresponds to using an R^2 cut-off of h
abline(h=0.90,col="red")
# Mean connectivity as a function of the soft-thresholding power
plot(sft$fitIndices[,1], sft$fitIndices[,5],
xlab="Soft Threshold (power)",ylab="Mean Connectivity", type="n",
main = paste("Mean connectivity"))
text(sft$fitIndices[,1], sft$fitIndices[,5], labels=powers, cex=cex1,col="red")
pickSoftThreshold函数中的RsquaredCut 参数是最小无标度拓扑拟合指数 R^2，也就是纵轴，数值越高，网络越符合无标度特征 (non-scale)，达到这个值的最小的power将会被选中，也有可能一直达不到，默认是0.85.
我们可以这样提取出来
sft$powerEstimate
[1] 6
如果一直达不到怎么办呢？这个问题在WGCNA的FAQ里有提到，详情可以去看看WGCNA package: Frequently Asked Questions (ucla.edu) 结论如下
| Number of samples | Unsigned and signed hybrid networks | Signed networks |
|---|---|---|
| Less than 20 | 9 | 18 |
| 20-30 | 8 | 16 |
| 30-40 | 7 | 14 |
| more than 40 | 6 | 12 |
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] WGCNA_1.70-3 fastcluster_1.2.3 dynamicTreeCut_1.63-1
[4] fs_1.5.0 workflowr_1.6.2
loaded via a namespace (and not attached):
[1] Biobase_2.50.0 sass_0.4.0 edgeR_3.30.3
[4] bit64_4.0.5 jsonlite_1.7.2 splines_4.0.2
[7] foreach_1.5.1 bslib_<IP_ADDRESS> Formula_1.2-4
[10] assertthat_0.2.1 stats4_4.0.2 latticeExtra_0.6-29
[13] blob_1.2.1 impute_1.62.0 yaml_2.2.1
[16] backports_1.2.1 pillar_1.6.1 RSQLite_2.2.7
[19] lattice_0.20-41 glue_1.4.2 limma_3.46.0
[22] digest_0.6.27 checkmate_2.0.0 RColorBrewer_1.1-2
[25] promises_<IP_ADDRESS> colorspace_2.0-1 preprocessCore_1.50.0
[28] htmltools_<IP_ADDRESS> httpuv_1.6.1 Matrix_1.3-4
[31] pkgconfig_2.0.3 purrr_0.3.4 GO.db_3.11.4
[34] scales_1.1.1 whisker_0.4 jpeg_0.1-8.1
[37] later_1.2.0 htmlTable_2.2.1 git2r_0.28.0
[40] tibble_3.1.2 generics_0.1.0 IRanges_2.22.2
[43] ggplot2_3.3.5 ellipsis_0.3.2 cachem_1.0.5
[46] nnet_7.3-14 BiocGenerics_0.36.0 survival_3.2-11
[49] magrittr_2.0.1 crayon_1.4.1 memoise_2.0.0
[52] evaluate_0.14 fansi_0.5.0 doParallel_1.0.16
[55] foreign_0.8-80 data.table_1.14.0 tools_4.0.2
[58] lifecycle_1.0.0 matrixStats_0.59.0 stringr_1.4.0
[61] S4Vectors_0.26.1 munsell_0.5.0 locfit_1.5-9.4
[64] cluster_2.1.0 AnnotationDbi_1.50.3 compiler_4.0.2
[67] jquerylib_0.1.4 rlang_0.4.11 grid_4.0.2
[70] rstudioapi_0.13 iterators_1.0.13 htmlwidgets_1.5.3
[73] base64enc_0.1-3 rmarkdown_2.9 gtable_0.3.0
[76] codetools_0.2-16 DBI_1.1.1 R6_2.5.0
[79] gridExtra_2.3 knitr_1.33 dplyr_1.0.7
[82] fastmap_1.1.0 bit_4.0.4 utf8_1.2.1
[85] Hmisc_4.5-0 rprojroot_2.0.2 stringi_1.5.3
[88] parallel_4.0.2 Rcpp_1.0.6 rpart_4.1-15
[91] vctrs_0.3.8 png_0.1-7 tidyselect_1.1.1
[94] xfun_0.24


Soy candle
Made with pure soy wax and essential oils. These candles burn for 40+ hours and can also be used as massage or body oil.
Pre-done blends are changed seasonally or by client request.
Bath Salts
Made with Epsom salts, Dead Sea salts, baking soda and essential oils. A bath with these salts will relieve deep muscle
tension, relax the mind and leave your skin feeling silky soft. Pre-done blends include sweet relief and sleepy time.
Bath Bombs
Made with all natural ingredients which include Epsom salts, baking soda and essential oils. A bath can be fun and luxurious
with these bath bombs. You will get deep relaxation and silky skin from this product.
Whipped Body Butter
Made with pure coconut oil, pure cocoa butter, pure sweet almond or shea butter, sweet almond oil and essential oils. This
luxurious body butter will melt into your skin leaving it soft and moisturized. This product can be used on face or body.
Body Oil
Made with coconut, sweet almond, or grapeseed oil and essential oils. Pre-done blends include stress relief, calm (for anxiety),
wellness (for treatment and prevention of cold and flu), sweet relief (for muscle tension) and sweet dreams. These oils can be used as body
moisturizer, massage oil, or spot treatment. You will receive treatment benefits from these oils as well as soft moisturized skin.
Nose inhaler
Made with essential oils. Pre-done blends include breathe easy (for sinus pain and congestion), and headache healer.
Lip Balm
Made with pure coconut oil, beeswax and natural flavor.
Diffuser Blends
Blended for use in electric diffusers. Pre-done blends include stress relief, calm (for anxiety), wellness (for treatment and prevention of cold and flu), and sweet dreams.
Diffusers for home and car are available for purchase and can be used with diffuser blends.
Some of the additional Professional products used in the treatment room include Dr. Schrammek Facial and Peeling Treatments,
Bellabacci Cupping Treatments, Footlogix Treatment Pedicure, Ceripil/Perron Rigot Waxing Treatments


4#ifndef DECAL_H_INCLUDED
5#define DECAL_H_INCLUDED
Defines an XML like element.
Represents a Celeste decal (either foreground or background).
Definition: Decal.h:20
void LoadFromElement(Element *e)
Loads a decal from an element. Loads position, texture, and scale.
Definition: Decal.cpp:6
Element * SaveToElement(void)
Creates an element from a decal.
Definition: Decal.cpp:24
std::string texture
The texture to use for the decal.
Definition: Decal.h:47
int32_t y
The y position of the decal.
Definition: Decal.h:49
int32_t scaleY
Scale of the decal (negative means inversed)
Definition: Decal.h:51
int32_t x
The x position of the decal.
Definition: Decal.h:48
int32_t scaleX
Scale of the decal (negative means inversed)
Definition: Decal.h:50
Decal()
Creates an empty decal.
Definition: Decal.cpp:41
Element is an XML like element, designed to store XML data.
Definition: Element.h:30


Ruben Kritzinger
×
Bubbles
dynamic javaScript.html
Bobot
Moving robot
dream car
JS Super-Calculator
word game
People I Know
train game
My Wish List
guess the secret number
JS Activity of the Day
javaScript WordGame
wheathervorcast
Shopping cart program
☰ labs
Ruben Kritzinger
Hi my name is Ruben, i whas born in the year 1998 on the 27 of July . I grew up in pretoria .
Category
Project Name
Category
Project Name
Category
Project Name
Category
Project Name
Category
Project Name
Category
Project Name


Lex Chudzik is a full stack software developer. Recently graduated from Prime Digital Academy, Lex is a fast learner who enjoys being exposed to new technologies.
An immersive, full time program in full stack software engineering, focused on practical learing experience.
Verified, paid and filed incoming invoices. Paid invoices and entered goods receipts in SAP. Communicated with vendors to resolve any issues related to payment. Assisted with other duties including office organization and covering dispatch.
Assisted in a project within a law office which transitioned to an electronic document file storage system. Scanned legal documents. Ensured the documents were accessible and transferred to the server.
Responsible for Front Desk duties in a Boy Scout youth camp. Answered inquiries from guests, in person and by phone. Performed data entry and compiled weekly reports detailing attendance and populations at the various campsites. Handled filing, organized the office and stockroom.


#assign javalin="active">
DInject has moved to avaje.io/http - taking you there now ...
Goto
/docs/javalin


Please check your mail. If the provided email address matches our records then a password reset link will be sent to {{fields.email.value}}.
{{unknownError}}


Expansion Panel Groups allow you to controll a set of panels. You can add panels using templates and controllers. You can also register panels to add by a given name; and you can pass in locals.


Ability Skin: This skin unlocks a unique Hero portrait for your in-game Avatar and also an additional ability while equipped.
When Magnus kills an Enemy with his Ultimate, other Enemies suffer a morale collapse, resulting in a permanent 10% drop in Physical and Magic Attack. The effect can stack up to 3 times
Ability only available while Artic Warfare Skin is equipped


Tables must not have a significant "roll" that would help a player.
Tournament rules
At the beginning of your match please pan your camera around the room.
After you pan your camera then set it up to view the table from a downward angle.
Before playing please state your name for the video
When racking, the 1, 2 and 3 balls must be on the corners.
The lowest number ball must be struck first or it is a foul.
Any foul ends the current rack you are playing.
If you make a good hit and scratch, then all balls made with that hit will be counted.
Immediately after the break you have two options:
a.) Play the cue ball from where it lies with no penalty - OR -
b.) Take ball in hand and take a 2 point penalty.
If you scratch on the break you must shoot from behind the scratch line
and it is a 2 point penalty. If the object ball you are shooting at is behind
this line then you must shoot past the line and come back to hit it.
If any part of the ball is touching the scratch line then it is considered behind the line.
Anytime a ball comes off the table (other than a legal jump) it will end the rack.
Anyone caught intentionally cheating will be suspended or banned from any future tournaments.
A person, whether it be the shooter or someone else, must remain in the view of
the camera at all times.
We encourage, but don't require, having music playing in the background.
General Rules
Your recording device must be set up to view the entire table and at least 5' or more
on all sides.
We will give all players a handicap after the first tournament based on your match/matches.
Any player that is playing for the first time can have a handicap. Please see the
Handicap Conversion page.
Anyone caught "sandbagging" will lose all handicaps for a time frame that 10ball.org
decides.
The 10ball.org review board will have all final say on rules violations and penalties.
Anyone winning money may have a reduced or removed handicap for the period of
up too three tournaments.
A player can only win 1 prize amout in each tournament. Example: A player played 5 times in 1 tournament
and ended up getting 1st & 2nd. They would only get the first place payout and all other players would move up 1 spot
Tiebreakers
5 more racks will be shot and scored.
...If stil tied after the 2nd set of 5 racks then the following will be used...
Total number of balls made on the 1st break.
Toatl number of balls made on the first 2 breaks.
Total number of balls made on the first 3 breaks.
Total number of balls made on the first 4 breaks.
Total number of balls made on all 5 breaks.
If no winner is decided by this point then the prize will be split between the 2 spots
If it is last place then the 2 players will split the last places prize.