text:
#ifndef LIBPRAEFECTUS_SYSTEM_H_
#define LIBPRAEFECTUS_SYSTEM_H_

#include "common.h"
#include "object.h"
#include "event.h"
#include "message-bus.h"
#include "clock.h"
#include "messages/PraefNetworkIdentifierPair.h"
#include "messages/PraefMsgJoinRequest.h"

__BEGIN_DECLS

/**
 * A praef_system is a full assembly of all the smaller components of
 * praefectus (though the application is still responsible for wiring some of
 * these together).
 *
 * Once created and configured, the primary interface between praefectus and
 * the application is via callbacks defined in the praef_app structure.
 */
typedef struct praef_system_s praef_system;
/**
 * Defines the callback interface between praefectus and the application.
 *
 * Callbacks suffixed with _opt may be NULL to indicate that the application
 * does not wish to do anything special on the callback. In the majority of
 * cases this means that the callback effectively does nothing.
 *
 * Callbacks suffixed with _bridge can be implemented by the "standard system
 * bridge", which is suitable for the vast majority of applications.
 *
 * Note that instances of this structure do not necessarily comprise the full
 * structure if the application was built against an older ABI. Optional
 * callbacks beyond the runtime-declared end-of-struct are assumed to be NULL.
 */
typedef struct praef_app_s praef_app;

/**
 * Describes the IP version restrictions, if any, of a praef_system.
 *
 * All nodes within one system MUST use the same IP version restrictions. It is
 * the application's responsibility to ensure that any network identifier pairs
 * it passes to praefectus meet any restrictions it has enacted.
 */
typedef enum {
  /**
   * Indicates that any IP versions are permissible. This configuration should
   * be used with caution, since it could result in a system consisting of some
   * number of IPv4-only and IPv6-only hosts that have no way to communicate.
   */
  praef_siv_any,
  /**
   * Indicates that IPv4 is the only permissible IP version. Attempts to
   * communicate with the local node from another protocol version will be
   * silently ignored.
   */
  praef_siv_4only,
  /**
   * Indicates that IPv6 is the only permissible IP version. Attempts to
   * communicate with the local node from another protocol version will be
   * silently ignored.
   */
  praef_siv_6only
} praef_system_ip_version;

/**
 * Describes the network locality restrictions, if any, of a praef_system.
 *
 * The network address of a peer in praefectus is identified by one or two IP
 * addresses, referred to as intranet and Internet. An identifier with only an
 * intranet address is "local"; one with both intranet and Internet is
 * "global".
 *
 * All nodes within one system MUST use the same locality restrictions.
 */
typedef enum {
  /**
   * Indicates that arbitrary mixtures of local and global identifiers is
   * permissible. There is virtually never any reason to use this
   * configuration, as it permits pairs of local-only nodes which cannot use
   * local communication.
   */
  praef_snl_any,
  /**
   * Indicates that all network addresses shall be local-only. Attempts to
   * communicate with the local node with a global network identifier will be
   * silently ignored.
   */
  praef_snl_local,
  /**
   * Indicates that all network addresses shall be global. Attempts to
   * communicate with the local node with a local network identifier will be
   * silently ignored.
   */
  praef_snl_global
} praef_system_network_locality;

/**
 * Instructs the application to create a node-object in the underlying system
 * with the given id. In the vast majority of applications, this corresponds to
 * creating an instance of a praef_object with that id and adding it to the
 * bottom-layer praef_context.
 *
 * @param id The id of the object to create. As long as the application has
 * implemented permit_object_id_opt correctly (if required), this id is
 * guaranteed not to conflict with any existing object id.
 */
typedef void (*praef_app_create_node_object_t)(praef_app*, praef_object_id);

/**
 * Instructs the application to initialise data for a new node with the given
 * id. This is always called immediately before create_node_object().
 *
 * Unlike create_node_object(), most applications will simply let the standard
 * system bridge implement this method, hence its separation.
 *
 * @return Whether the operation succeeds. If it fails, create_node_object()
 * will not be called and the OOM flag on the system will be set.
 */
typedef int (*praef_app_create_node_t)(praef_app*, praef_object_id);

/**
 * Returns the time at which the given node gained the GRANT status. A time in
 * the future or at the current instant indicates it does not have
 * GRANT. Typically, ~0 is used in this case.
 *
 * Most applications will simply use the implementation provided by the
 * standard system bridge.
 *
 * @param id The id of the node being queried.
 * @return The time at which GRANT was gained by the node, or a future time if
 * the node does not have GRANT.
 */
typedef praef_instant (*praef_app_get_node_grant_t)(
  praef_app*, praef_object_id);

/**
 * Returns the time at which the given node gained the DENY status. A time in
 * the future or at the current instant indicates it does not have
 * DENY. Typically, ~0 is used in this case.
 *
 * Most applications will simply use the implementation provided by the
 * standard system bridge.
 *
 * @param id The id of the node being queried.
 * @return The time at which DENY was gained by the node, or a future time if
 * the node does not have DENY.
 */
typedef praef_instant (*praef_app_get_node_deny_t)(
  praef_app*, praef_object_id);

/**
 * Requests the application to decode the given byte array into an
 * application-specific event.
 *
 * @param instant The instant of the event to be created.
 * @param object The target of the event to be created.
 * @param sn The serial number of the event to be created.
 * @param data The input data from which the event is to be decoded.
 * @param sz The number of bytes in the data buffer.
 * @return The decoded event. Ownership of the return value transfers to the
 * caller. If the data is malformed, return NULL. If an internal error occurs
 * attempting to decode the data, return NULL and arrange to destroy the
 * system.
 */
typedef praef_event* (*praef_app_decode_event_t)(
  praef_app*, praef_instant instant, praef_object_id object,
  praef_event_serial_number sn,
  const void* data, size_t sz);

/**
 * Inserts an event into the underlying system. The event given was produced by
 * a call to decode_event().
 *
 * The standard system bridge provides a reasonable implementation of this
 * function for most applications. It is guaranteed that the event does not
 * conflict with another existing event at the same level of abstraction.
 *
 * @param event An event (produced by decode_event()) to insert into the lower
 * system. Ownership transfers to the callee; however, the callee may not
 * destroy the event until the system is destroyed.
 * @see praef_app_neutralise_event_t
 */
typedef void (*praef_app_insert_event_t)(praef_app*, praef_event* event);

/**
 * Neutralises an event in-place in the underlying system. This is necessary
 * when a node violates the protocol and creates conflicting events.
 *
 * For reasons of consistency, the event itself must continue to exist, so true
 * redaction is impossible. A typical implementation (one provided by the
 * standard system bridge) is to roll the bottom praef_context back to the time
 * of the event, and then set the apply() function to one that does
 * nothing. This may not work for all applications, however, particularly those
 * where object rollback is dependent on the events themselves.
 *
 * @param event An event that was formerly passed into insert_event_bridge().
 */
typedef void (*praef_app_neutralise_event_t)(praef_app*, praef_event* event);

/**
 * Inserts a chmod into the lower layer of the system. This corresponds to
 * praef_metatransactor_chmod().
 *
 * The vast majority of applications will simply use the implementation
 * provided by the standard system bridge.
 *
 * @param target The node to be affected by this chmod. This is guaranteed to
 * correspond to an already-existing node.
 * @param voter The node voting to execute this chmod. This is guaranteed to
 * correspond to an already-existing node.
 * @param mask A mask with one bit set indicating which status bit is to be
 * modified.
 * @param when The instant at which the proposed change is to take effect.
 */
typedef void (*praef_app_chmod_t)(praef_app*, praef_object_id target,
                                  praef_object_id voter, unsigned mask,
                                  praef_instant when);
/**
 * Returns whether a chmod with the given parameters (as per
 * praef_app_chmod_t()) has already been added to the underlying system. This
 * corresponds to praef_metatransactor_has_chmod().
 *
 * The vast majority of applications will simply use the implementation
 * provided by the standard system bridge.
 */
typedef int (*praef_app_has_chmod_t)(praef_app*, praef_object_id target,
                                     praef_object_id voter, unsigned mask,
                                     praef_instant when);

/**
 * Inserts an event vote into the lower layer of the system. This corresponds
 * to praef_transactor_votefor().
 *
 * The praef_system handles filtering out duplicate votes.
 *
 * The vast majority of applications will sipmly use the implementation
 * provided by the standard system bridge.
 *
 * @param voter The node which is casting the vote.
 * @param object The object element of the event identifier triple being
 * affirmed.
 * @param instant The instant element of the event identifer triple being
 * affirmed.
 * @param serial_number The serial number element of the event identifier
 * triple being affirmed.
 */
typedef void (*praef_app_vote_t)(praef_app*,
                                 praef_object_id voter,
                                 praef_object_id object,
                                 praef_instant instant,
                                 praef_event_serial_number serial_number);

/**
 * Advances the state of the lower layer of the system by the given number of
 * ticks.
 *
 * Many applications will simply wish to use the implementation provided by the
 * standard system bridge.
 *
 * This will not be called when a system has not at least reached the
 * clock-synchronisation phase of connection setup.
 *
 * @param delta The number of steps to advance. This may be zero; in such a
 * case, the application must still ensure that it has reached a consistent
 * state before returning. The application SHOULD consider having some maximum
 * delta it is willing to process, as advancing, eg, 3 billion steps into the
 * future will usually take an unacceptably large amount of time and is likely
 * indicative of an attack.
 * @see praef_system_conf_max_advance_per_frame()
 */
typedef void (*praef_app_advance_t)(praef_app*, unsigned delta);

/**
 * Inquires the application as to whether the authentication on the given join
 * request is valid.
 *
 * The response from this call MUST be consistent for all nodes in the system,
 * regardless of current state.
 *
 * The default implementation if this callback is not provided is to consider
 * all authentication valid.
 *
 * @return Whether the join request is considered by the application to have
 * valid authentication.
 */
typedef int (*praef_app_is_auth_valid_t)(
  praef_app*, const PraefMsgJoinRequest_t*);

/**
 * Generates application-specific authentication data to be used with the given
 * join request.
 *
 * @param req The request that may need authentication data. Its auth field is
 * initially NULL.
 * @param auth_data An OCTET STRING with a 58-byte data array. If the
 * application wishes to use authentication, it should fill this data array in
 * and set the size appropriately, then point req->data at auth_data.
 */
typedef void (*praef_app_gen_auth_t)(
  praef_app*, PraefMsgJoinRequest_t* req,
  OCTET_STRING_t* auth_data);

/**
 * Inquires the application as to whether the given object identifier is
 * permissible to be used by a node.
 *
 * Many applications will have one or more "well-known" object identifiers that
 * are not maintained by any node, but rather represent "environmental" state
 * independent of any node. (For example, in a game of Pong, the ball would
 * likely have its own id.) This callback allows the application to reserve
 * such ids for its own use.
 *
 * If an id that would be generated is reserved by the application, praefectus
 * will try the next even-numbered identifier, until this call returns true.
 *
 * Note that this MUST necessarily be completely stateless. A praefectus system
 * will diverge if any two nodes produce different responses for this call.
 *
 * The assumed implementation if this callback is not provided is to accept all
 * identifiers.
 *
 * @param id The object identifier the system would like to use for a new
 * node/object pair.
 * @return Whether the application permits node-object usage of the given
 * identifier.
 */
typedef int (*praef_app_permit_object_id_t)(praef_app*, praef_object_id id);

/**
 * Notifies the application that the local node has acquired a node id.
 *
 * @param id The new id of the local node.
 */
typedef void (*praef_app_acquire_id_t)(praef_app*, praef_object_id id);

/**
 * Notifies the application that a new external node has come into existence.
 */
typedef void (*praef_app_discover_node_t)(
  praef_app*, const PraefNetworkIdentifierPair_t*, praef_object_id);

/**
 * Notifies the application that the route to the given existing external node
 * is being terminated.
 */
typedef void (*praef_app_remove_node_t)(praef_app*, praef_object_id);

/**
 * Notifies the application that traversal of the full node-join tree is
 * believed to be complete. At this point the local node will begin connecting
 * to other nodes in the system and actively synchronising with them.
 *
 * This is only ever called once at some point after a call to
 * praef_system_connect().
 */
typedef void (*praef_app_join_tree_traversed_t)(praef_app*);

/**
 * Notifies the application of the approximate current progress of the hash
 * tree scan process, which occurs during joining after the join tree has been
 * traversed. The progress is reported in terms of a fraction. The hash tree
 * scan is fully complete when this is called with numerator==denominator.
 *
 * This may be called even though the progress has not changed since the
 * previous call, and may even report a lower progress than the previous call
 * in uncommon cases.
 *
 * @param numerator The numerator of current progress. This is guaranteed
 * to be <= denominator.
 * @param denominator The denominator of the current progress. This is
 * guaranteed to be non-zero.
 */
typedef void (*praef_app_ht_scan_progress_t)(
  praef_app*, unsigned numerator, unsigned denominator);

/**
 * Notifies the application that the local node is still awaiting the stability
 * of the given other node. This may be called multiple times per frame.
 *
 * @param node The node being awaited.
 * @param systime The current system time as perceived by the local node.
 * @param committed The committed threshold of the referenced node.
 * @param validated The validated threshold of the referenced node.
 */
typedef void (*praef_app_awaiting_stability_t)(
  praef_app*, praef_object_id node, praef_instant systime,
  praef_instant committed, praef_instant validated);

/**
 * Notifies the application that the local node now believes it has all
 * information necessary to interoperate with other live nodes.
 *
 * This will only be called after a call to praef_system_connect().
 */
typedef void (*praef_app_information_complete_t)(praef_app*);

/**
 * Notifies the application that the local node's clock is believed to be
 * reasonably synchronised with the rest of the system, and that the
 * application's state has been advanced up to that point.
 */
typedef void (*praef_app_clock_synced_t)(praef_app*);

/**
 * Notifies the application that the local node has tenatively received the
 * GRANT status for the first time. This is usually permanent, though in
 * certain circumstances the status could be temporarily or even permanently
 * lost after this notification.
 *
 * Generally, the application can view this notification as an intication that
 * the system is fully set up and ready for full use.
 */
typedef void (*praef_app_gained_grant_t)(praef_app*);

/**
 * Notifies the application that it has received an application-defined unicast
 * message.
 *
 * How the application chooses to handle invalid application-defined unicast
 * messages is entirely up to the application. No mechanism is provided for the
 * application to inform libpraefectus about invalid messages, for example.
 *
 * If no implementation for this function is given, all incoming
 * application-defined unicast messages are discarded.
 *
 * @param from_node The node that signed the packet containing this
 * message. Note that there is no guarantee that that node actually sent the
 * message to *this* node. The application MUST gracefully handle receiving
 * unicast messages intended for another node.
 * @param instant The instant attached to the packet containing the
 * message. This corresponds to the time of from_node when it created the
 * message.
 * @param data The contents of the application-defined message.
 * @param size The number of bytes in the data buffer.
 */
typedef void (*praef_app_recv_unicast_t)(praef_app*, praef_object_id from_node,
                                         praef_instant instant,
                                         const void* data, size_t size);

/**
 * Notifies the application of a developer-targetted log message produced by
 * the system.
 */
typedef void (*praef_app_log_t)(praef_app*, const char*);

struct praef_app_s {
  /**
   * Equal to the compile-time value of sizeof(praef_app). (This allows new
   * fields to be added without breaking binary compatibility).
   */
  size_t size;

  praef_app_create_node_object_t create_node_object;
  praef_app_decode_event_t decode_event;

  praef_app_create_node_t create_node_bridge;
  praef_app_get_node_grant_t get_node_grant_bridge;
  praef_app_get_node_deny_t get_node_deny_bridge;
  praef_app_insert_event_t insert_event_bridge;
  praef_app_neutralise_event_t neutralise_event_bridge;
  praef_app_chmod_t chmod_bridge;
  praef_app_has_chmod_t has_chmod_bridge;
  praef_app_vote_t vote_bridge;
  praef_app_advance_t advance_bridge;

  /* Optional control callbacks */
  praef_app_permit_object_id_t permit_object_id_opt;
  praef_app_is_auth_valid_t is_auth_valid_opt;
  praef_app_gen_auth_t gen_auth_opt;

  /* Optional notification callbacks */
  praef_app_acquire_id_t acquire_id_opt;
  praef_app_discover_node_t discover_node_opt;
  praef_app_remove_node_t remove_node_opt;
  praef_app_join_tree_traversed_t join_tree_traversed_opt;
  praef_app_ht_scan_progress_t ht_scan_progress_opt;
  praef_app_awaiting_stability_t awaiting_stability_opt;
  praef_app_information_complete_t information_complete_opt;
  praef_app_clock_synced_t clock_synced_opt;
  praef_app_gained_grant_t gained_grant_opt;
  praef_app_log_t log_opt;

  /* Optional application-defined-message callbacks */
  praef_app_recv_unicast_t recv_unicast_opt;
};

/**
 * Describes the status of a praef_system. Any status that does not test as
 * false can be considered abnormal, but whether such an abnormality is
 * permanent depends on the particular status.
 *
 * In cases where more than one status is considered relevant, the most severe
 * one is generally used.
 */
typedef enum {
  /**
   * Indicates that the system is normally connected.
   */
  praef_ss_ok = 0,
  /**
   * Indicates that the local node has not received an identifier yet, and so
   * is unable to do terribly much. This status becomes cleared upon
   * bootstrapping or successful connection. In the latter case, the status can
   * be expected to tranfer to pending_grant.
   *
   * If this status remains for too long (as defined by the application) after
   * a connect attempt, the application should destroy this system and retry
   * connection with a new one.
   */
  praef_ss_anonymous,
  /**
   * Indicates that the local node has not yet received the GRANT status, and
   * so cannot yet participate in the system .
   *
   * If this status remains for too long (as defined by the application), the
   * application should destroy this system and retry connection with a new
   * one.
   */
  praef_ss_pending_grant,
  /**
   * Indicates that the local node has entered a state in which it is
   * attempting to DENY more than half of the nodes in the system which are
   * currently alive. This usually indicates a permanent and fatal network
   * partition. (The most common cause arising from the local host losing
   * network/Internet access.) Applications may wish to wait a short while to
   * see if the status clears itself, which can happen if new nodes are
   * introduced before any vote passes.
   */
  praef_ss_partitioned,
  /**
   * Indicates that the local node has gained the DENY status, preventing it
   * from taking further meaningful action. This is almost always a permanent
   * and fatal condition, though applications may wish to wait a short while to
   * see if it gets cleared, which can happen due to retroactive status changes
   * of other nodes in some circumstances.
   */
  praef_ss_kicked,
  /**
   * Indicates that the system ran out of memory while attempting to carry on
   * normal operations. This means that the local node is no longer able to
   * properly follow the protocol, and thus is a fatal error. Upon seeing this
   * status, the application should clean up and destroy the system.
   */
  praef_ss_oom,
  /**
   * Indicates that the end of time has been reached, prevting the system from
   * making any further progress. This is a permanent and fatal condition,
   * which furthermore prevents graceful disconnects from being meaningful.
   *
   * Most applications will never encounter this condition unless a malicious
   * node severely skews the clock while it has strong control over it (and if
   * the application accepts such great time advancement).
   *
   * Note that for the sake of being conservative about correctness, the
   * threshold of "the end of time" is actually at instant 0x80000000 instead
   * of 0xFFFFFFFF.
   */
  praef_ss_overflow,
  /**
   * Indicates that the local node experienced a fatal id collision with
   * another node. This status is always permanent and fatal. Graceful
   * disconnect may or may not be possible.
   */
  praef_ss_collision
} praef_system_status;

/**
 * Defines the strategy for calculating default configuration values from the
 * standard latency of the system.
 */
typedef enum {
  /**
   * Specifies to make the system as strict as possible. Any time-based
   * configuration that can meaningfully be zero on a latent network is set to
   * zero. This will result in amplified network latency effects (typically
   * quadruple that of a one-way trip), but makes it impossible for malicious
   * nodes to gain unfair advance knowledge.
   */
  praef_sp_strict,
  /**
   * Specifies to make the system more permissive, setting certain non-critical
   * values according to the standard latency. This substantially reduces
   * latency effects (in good cases, bringing them down to that of a single
   * one-way trip); however, malicious nodes whose true latency to the local
   * host is under the standard latency may gain unfair advance knowledge.
   *
   * This is usually the best choice for applications driven by real-time human
   * input, especially if their standard latency is at or below general human
   * reaction time.
   */
  praef_sp_lax
} praef_system_profile;

/**
 * Constructs a new, empty, unconnected praef_system.
 *
 * @param app The application callback interface. The application must ensure
 * that this pointer remains valid for the lifetime of the system.
 * @param bus The message bus to use for communication. The application must
 * ensure that this pointer remains valid for the lifetime of the system.
 * @param self The network identifier of the local node.
 * @param std_latency The "standard latency" of the underlying network, in
 * terms of instants. This is used (along with profile) to set the default
 * configuration of the system. This should be the latency that the application
 * is designed to most commonly experience, rather than the maximum value it
 * expects to. For example, an application operating over the Internet at 64
 * instants per real second could reasonably use a standard latency of 8 (125
 * ms). A value of zero is not reasonable even on zero-latency networks, as
 * a minimum latency of one instant is introduced by the nature of the
 * message-bus abstraction.
 * @param profile The profile to use to calculate default configuration based
 * on std_latency.
 * @param ip_version The IP version restrictions on the system, if any.
 * @param net_locality The network locality restrictions on the system, if
 * any.
 * @param mtu The MTU for message encoders. This needs to be at least
 * PRAEF_HLMSG_MTU_MIN+8.
 * @return The new system, or NULL if insufficient memory was available.
 */
praef_system* praef_system_new(praef_app* app,
                               praef_message_bus* bus,
                               const PraefNetworkIdentifierPair_t* self,
                               unsigned std_latency,
                               praef_system_profile profile,
                               praef_system_ip_version ip_version,
                               praef_system_network_locality net_locality,
                               unsigned mtu);

/**
 * Frees all memory held by the given praef_system.
 *
 * If connected to other nodes, this is a *graceless*
 * disconnection. Applications are recommended to gracefully disconnect with
 * praef_system_disconnect() if doing so when the status of the system is
 * "ok".
 */
void praef_system_delete(praef_system*);

/**
 * "Connects" this system by making the local node the bootstrap node. This
 * only makes sense for a newly-created praef_system.
 */
void praef_system_bootstrap(praef_system*);
/**
 * Connects this system by executing the node-joining protocol with the
 * existing node at the given network address. This is asynchronous (ie,
 * proceeds during successive calls to praef_system_advance()). If it succeeds,
 * the system will transition away from the "anonymous" status.
 *
 * @param target The network identifier to use to initiate the connection. The
 * system object takes ownership of this pointer.
 */
void praef_system_connect(praef_system*,
                          const PraefNetworkIdentifierPair_t* target);

/**
 * Initiates a graceful disconnect from the system. The graceful disconnect
 * will usually succeed if praef_system_advance() is called at least once
 * after this call, though applications may wish to wait for the status to
 * cease to be "ok" to ensure disconnects are as graceful as possible.
 */
void praef_system_disconnect(praef_system*);

/**
 * Advances the system the given number of instants forward.
 *
 * @return The current status of the system.
 */
praef_system_status praef_system_advance(praef_system*, unsigned);

/**
 * Adds a new (encoded) event to the system, which implicitly applies to the
 * local node's object. This call is not meaningful if the local node does not
 * yet have an id.
 *
 * @param data The encoded form of the event, as decodable by the application's
 * decode_event().
 * @param size The size of the data buffer, in bytes.
 * @return Whether the operation succeeds.
 */
int praef_system_add_event(praef_system*, const void* data, size_t size);

/**
 * Adds a new vote-for event to the system, indicating the local node's
 * acceptance of an event identified by the given triple.
 */
int praef_system_vote_event(praef_system*, praef_object_id,
                            praef_instant, praef_event_serial_number);

/**
 * Sends an application-defined unicast message to the specified node. No
 * reliablity or synchronicity mechanism is provided through this call;
 * messages it sends can arrive in any order and any number of times. If the
 * application wishes to know if or when the target receives the message, it
 * must implement such a mechanism itself.
 *
 * It is also possible for the receiver to forward the message to another node
 * in the system, which will make the final receiver believe the local node
 * sent it directly to that node. If this is a problem, the application should
 * include destination node ids in its messages and validate them itself.
 *
 * @param target The id of the node that is to receive this message.
 * @param data The encoded form of the message, as decodable by the
 * application's recv_unicast_opt().
 * @param size The size of the data buffer, in bytes.
 * @return Whether the operation succeeds. ("Success" meaning that nothing
 * surprising, such as out-of-memory, occurred when attempting to carry out the
 * request.)
 */
int praef_system_send_unicast(praef_system*, praef_object_id target,
                              const void* data, size_t size);

/**
 * Returns the global clock maintained by the given praef_system.
 */
const praef_clock* praef_system_get_clock(praef_system*);

/**
 * Returns the id of the local node, or 0 if the local id is not yet known.
 */
praef_object_id praef_system_get_local_id(const praef_system*);

/**
 * Returns the latency to the node with the given id, in instants, or ~0u if no
 * node with that id is known.
 */
unsigned praef_system_get_latency_to(const praef_system*, praef_object_id);

/**
 * Sets the Out-of-Memory flag on the given praef_system. All further calls to
 * praef_system_advance() will return praef_ss_oom.
 */
void praef_system_oom(praef_system*);

/**
 * Configures the obsolescence interval of the clock on the given system.
 *
 * The default is 5*std_latency.
 *
 * @see praef_clock::obsolescence_interval
 */
void praef_system_conf_clock_obsolescence_interval(praef_system*, unsigned);
/**
 * Configures the tolerance of the clock on the given system.
 *
 * The default is std_latency.
 *
 * @see praef_clock::tolerance
 */
void praef_system_conf_clock_tolerance(praef_system*, unsigned);

/**
 * Configures the commit interval, in instants, of the given system.
 *
 * Smaller values reduce latency effects but increase bandwidth usage.
 *
 * The default is std_latency/2, or 1, whichever is greater.
 */
void praef_system_conf_commit_interval(praef_system*, unsigned);
/**
 * Configures the maximum commit lag, in instants, of the given system.
 *
 * The local node will begin voting to DENY nodes with GRANT whose commit
 * threshold lags behind the current time by more than this number of
 * instants. Since commits are simply single messages, fairly low latencies can
 * usually be expected; however, this does need to be at least
 * praef_system_conf_public_visibility_lag() +
 * praef_system_conf_linear_ack_interval() +
 * praef_system_conf_commit_interval() in order to correctly recover from
 * packet loss. Larger values are more forgiving of high-latency nodes and
 * packet loss, but increase the possible latency effects proportionally.
 *
 * The default is std_latency*32.
 */
void praef_system_conf_max_commit_lag(praef_system*, unsigned);
/**
 * Configures the maximum validated lag, in instants, of the given system.
 *
 * The local node will begin voting to DENY nodes with GRANT whose validated
 * threshold lags behind the current time by more than this number of
 * instants. Since many messages may be part of a commit, greater latencies
 * than commits can usually be expected. Larger values are more forgiving of
 * high-latency nodes, but increase the possible latency effects
 * proportionally.
 *
 * It does not make sense for this to be less than
 * praef_system_conf_max_commit_lag().
 *
 * The default is std_latency*64.
 */
void praef_system_conf_max_validated_lag(praef_system*, unsigned);
/**
 * Configures the laxness of the commited threshold of a node as it applies to
 * that node's ability to see committed-redistributable messages.
 *
 * This parameter is designed to mitigate latency effects incurred by other
 * nodes' networks. It allows nodes to see an additional number of instants
 * equal to this value beyond the commit threshold, even after adjusting for
 * the local node's estimated intrinsic latency. Larger values reduce latency
 * effects; if the sum of this value and the local node's estimated intrinsic
 * latency (after adjustment via
 * praef_system_conf_self_commit_lag_compensation()) is greater than or equal
 * to the true latency between two nodes, the effects of latency from the local
 * node to the destination node are completely reduced to that of a one-way
 * trip in the absence of packet loss.
 *
 * Note that any non-zero value for this field makes it possible for other
 * nodes to see beyond their commit threshold, which could permit them to make
 * decisions based upon information that should be in the future for them.
 *
 * Typically, this should be set to half the expected one-way latency plus any
 * delay that could be incurred by praef_system_conf_commit_interval(),
 * provided that the advance knowledge nodes could gain is not useful in that
 * time interval.
 *
 * For the lax profile, this defaults to std_latency. For the strict profile,
 * it defaults to 0.
 */
void praef_system_conf_commit_lag_laxness(praef_system*, unsigned);
/**
 * Configures a fraction by which to multiply the estimated latency incurred by
 * the local node's network in order to compensate for commit lag.
 *
 * The local node maintains an estimate of how much latency its own local
 * network incurs when talking to other nodes. This can be thought of as
 * one-quarter the minimum round-trip time to any other node. This estimate is
 * multiplied by some fraction to determine how much to adjust the message
 * visibility for other nodes based on their commit thresholds.
 *
 * Larger values reduce the effects of latency; together with
 * praef_system_conf_commit_lag_laxness(), they can be reduced to that of a
 * one-way trip in the absence of packet loss.
 *
 * Note that any non-zero value makes it possible for other nodes to see beyond
 * their commit threshold. However, assuming that no node has an exceptionally
 * low latency to the local node which it is able to hide, any node wishing to
 * do so must necessarily delay comitting for the true one-way latency between
 * the nodes, which still causes it to be deprived of further information. In
 * most cases, this is a greater disadvantage than anything provided by the
 * future information.
 *
 * For the vast majority of applications, 1/1 is reasonable, though values up
 * to 2/1 may occasionally be desirable to further mitigate latency. The
 * decesion of what this value should be should be based upon how useful
 * future information is versus the additional latency that would be incurred
 * in exchange for acquiring it.
 *
 * For the lax profile, this defaults to 1/1. For the strict profile, it
 * defaults to 0/1.
 *
 * @param numerator The numerator of the fraction. This must be below 65536.
 * @param denominator The denominator of the fraction. This must must be
 * non-zero.
 */
void praef_system_conf_self_commit_lag_compensation(
  praef_system*, unsigned numerator, unsigned denominator);
/**
 * Controls the threshold beyond which all information is assumed public.
 *
 * Larger values reduce the possibility of using side-channels to gain
 * information without committing, but reduces the synchronicity of a new node
 * immediately after connecting.
 *
 * The default is 4 * std_latency.
 */
void praef_system_conf_public_visibility_lag(
  praef_system*, unsigned lag);
/**
 * Configures the number of instants in which all live nodes are maintaining
 * their commitments that the local node will wait before requesting GRANT
 * permissions.
 *
 * This value directly adds to the total connection time. Larger values reduce
 * the probability that a new node will fumble around and incorrectly deem
 * another node dead immediately after it gains GRANT.
 *
 * The default is 4 * std_latency.
 */
void praef_system_conf_stability_wait(praef_system*, unsigned);
/**
 * Configures the interval upon which queries to the node join tree are
 * retried.
 *
 * Smaller values will allow the traversal of the join tree to recover more
 * quickly from dropped packets, reducing the time it takes to become a
 * fully-functional member of a system, but may make the network noisier.
 *
 * The default is std_latency.
 */
void praef_system_conf_join_tree_query_interval(
  praef_system*, unsigned interval);
/**
 * Controls the minimum interval between the acceptance of new nodes into the
 * system by *this node*. Attempts to join the system which arrive before this
 * interval has expired since the last accept are silently ignored.
 *
 * This value simply makes the system more DoS-resistant, and only controls the
 * behaviour of the local node. Other nodes in the system can still potentially
 * accept nodes into the system at an arbitrary rate.
 *
 * The only way to strongly protect an application from accept floods is to
 * define an authentication mechanism which makes it difficult or impossible to
 * generate large numbers of valid accepts. For example, one could employ a
 * centralised server that is the sole source of authentication information,
 * and either has a limited rate at which it will generate such information, or
 * is aware of the number of nodes in a system and will refuse to exceed that
 * number.
 *
 * The default is std_latency*8.
 */
void praef_system_conf_accept_interval(
  praef_system*, unsigned interval);
/**
 * Controls the approximate maximum node count in the system. The local node
 * will not accept join requests when the number of live nodes is greater than
 * or equal to this value.
 *
 * Note that there is nothing preventing other nodes already in the system from
 * blowing past this limit if they choose to do so. Furthermore, even when all
 * nodes are cooperating with the same limit, the limit can still be exceeded
 * due to the asynchronous nature of the network. Therefore, applications MUST
 * be able to handle systems which exceed the node count limit.
 *
 * The default is ~0 (ie, effectively no limit).
 */
void praef_system_conf_max_live_nodes(
  praef_system*, unsigned max);
/**
 * Controls the maximum number of responses that will be produced in response
 * to a hash-tree-range query.
 *
 * Larger values *may* make the joining of new nodes faster, provided bandwidth
 * constraints do not cause packets to be dropped. The approximate outgoing
 * bandwidth requirement is generally approximately
 *
 *   mtu * ht_range_max / round_trip_latency
 *
 * The default value is 64. On a system with the minimal MTU of 307 bytes, and
 * a network with 100ms round-trip latency, this consumes up to 191kB/sec (or
 * 1.5 Mbps) of bandwidth (not including IP overhead and such) while a node is
 * joining per concurrent range query (see
 * praef_system_conf_ht_scan_concurrency()).
 */
void praef_system_conf_ht_range_max(praef_system*, unsigned);
/**
 * Controls the interval at which hash-tree-range queries are retried.
 *
 * Larger values make node joining faster in the presence of packet loss, but
 * may cause excessive redundant traffic if too low.
 *
 * The default is std_latency*4.
 */
void praef_system_conf_ht_range_query_interval(praef_system*, unsigned);
/**
 * Controls the redundancy level used for hash tree scans when joining a
 * system.
 *
 * When possible, at least this many nodes will be queried for the same ranges
 * in the hash tree, though no node will be queried for the same range more
 * than once. Join time increases linearly with this value, but the certainty
 * that all messages are received from the scan increases as well. This may
 * also increase bandwidth usage, though that can be more precicely controlled
 * with praef_system_conf_ht_range_query_interval(),
 * praef_system_conf_ht_range_max(), and
 * praef_system_conf_ht_scan_concurrency().
 *
 * The default is 2.
 */
void praef_system_conf_ht_scan_redundancy(praef_system*, unsigned);
/**
 * Controls the maximum concurrency with which the local node will perform
 * range queries during the hash tree scan. Note that the local node never runs
 * more than one conncurrent range query against any other single node.
 *
 * This is a direct linear trade-off between bandwidth usage and the time it
 * takes to join. (Obviously, once bandwidth limits are hit, increasing the
 * value further will only reduce performance due to packet loss.) This value
 * must be less than 255. A value of zero is permissible, but is generally not
 * a good idea, as it will cause the hash tree scan step to be skipped.
 *
 * The default is 3.
 */
void praef_system_conf_ht_scan_concurrency(praef_system*, unsigned char);
/**
 * Controls the maximum number of consecutive failed attempts at a hash tree
 * range query that the local node will perform against another node before
 * deeming the node unusable for range queries.
 *
 * The default is 5.
 */
void praef_system_conf_ht_max_scan_tries(praef_system*, unsigned);
/**
 * Controls the intervals at which hash tree snapshots are taken.
 *
 * Specifically, one hash tree snapshot will be taken at every instant which is
 * evenly divisible by this value. Smaller values (more frequent snapshots)
 * will allow nodes to more precicely synchronise their hash trees in the
 * presence of minor clock skew and latency jitter, at the cost of lower
 * tolerance to larger clock skew and latency.
 *
 * It is highly advisable for all nodes in a system to use the same value for
 * this configuration.
 *
 * The default is std_latency.
 *
 * The effect of passing a value of 0 is undefined.
 */
void praef_system_conf_ht_snapshot_interval(praef_system*, unsigned);
/**
 * Controls the maximum number of hash tree snapshots that will be maintained.
 *
 * Larger values counteract the downsides of more frequent snapshots (as
 * documented in praef_system_conf_ht_snapshot_interval()) in exchange for
 * somewhat greater memory and CPU usage.
 *
 * The default is 64. Invoking this function will purge any existing snapshots
 * if it succeeds, so it should generally only be used before the system is
 * connected.
 *
 * @return Whether adjusting the configuration succeeds. If 0 is returned, the
 * configuration is unchanged and no snapshots were purged.
 */
int praef_system_conf_ht_num_snapshots(praef_system*, unsigned);
/**
 * Controls the interval at which queries against the root hash tree directory
 * of each node are performed.
 *
 * Smaller values will reduce the effects of packet loss (in particular
 * momentary network partitions) by resynchronising the hash trees more
 * quickly, at the cost of greater bandwidth usage. Note that this is a
 * particularly inefficient way of recovering from packet loss; it is intended
 * as a back-up for when the much faster and lighter sequence-number-based
 * system fails to recover packets. Frequent queries can consume substantial
 * amounts of redundant bandwidth.
 *
 * The default is std_latency*16.
 */
void praef_system_conf_ht_root_query_interval(praef_system*, unsigned);
/**
 * Controls the time offset for hash tree queries.
 *
 * Specifically, any queries against another node's hash tree is back-dated by
 * this amount. Smaller values permit recovering from momentary network
 * partitions more quickly; however, very small values can incur potentially
 * large amounts of wasted bandwidth in cases of clock skew.
 *
 * The default is std_latency*4.
 */
void praef_system_conf_ht_root_query_offset(praef_system*, unsigned);
/**
 * Controls the interval at which Route messages are sent to new nodes that
 * have received neither the GRANT nor the DENY status.
 *
 * Lower values will allow new nodes to discover which nodes in the system are
 * still active, which makes their connection faster, and will generally reduce
 * load on the initial node to which they connect, as the hash tree scan will
 * be better distributed. The only cost is bandwidth, which is fairly low.
 *
 * The default is 4*std_latency.
 */
void praef_system_conf_ungranted_route_interval(praef_system*, unsigned);
/**
 * Controls the interval at which Route messages are sent to nodes which have
 * already received the GRANT status and have not received the DENY status.
 *
 * Lower values increase the probability of new nodes surviving untimely
 * network partitions and reduce the window of the initial connection target
 * being a single point of failure, but otherwise have little effect. As with
 * praef_system_conf_ungranted_route_interval(), the only real cost is
 * bandwidth.
 *
 * The default is 32*std_latency.
 */
void praef_system_conf_granted_route_interval(praef_system*, unsigned);
/**
 * Controls the interval at which new Ping messages will be sent to other
 * nodes.
 *
 * Lower values yield more accurate short-term estimates of latency, thus
 * adapting more quickly to changes in the behaviour of the network. However,
 * this also acts as a cap on the maximum network latency between any two
 * nodes, beyond which both nodes will switch to a negative disposition towards
 * each other.
 *
 * The default is 16*std_latency.
 */
void praef_system_conf_ping_interval(praef_system*, unsigned);
/**
 * Controls the maximum amount of time that may elapse since receiving a valid
 * Pong response from another node before the local node will switch to a
 * negative disposition to this node. This occurs even if other traffic is
 * still being received from that node.
 *
 * This is primarily a defence against nodes deliberately not responding to
 * Pings in order to hide their latency; commit and verification lag are the
 * primary means of liveness testing.
 *
 * Lower values increase the chance of incorrectly identifying a node as dead
 * or malicious due to packet loss.
 *
 * The default is 128*std_latency, ie, up to 8 pings at the default interval
 * may be lost.
 */
void praef_system_conf_max_pong_silence(praef_system*, unsigned);
/**
 * Controls the amount of time after a node has received the DENY status that
 * the local node permanently kills its route to that node.
 *
 * When a remote node first gets killed, the local node will continue
 * maintaining communications with it for a while, in case new information
 * causes the DENY status to be retroactively removed. This reduces the
 * negative effects of such an error, though the local node will continue
 * attempting to make the DENY status permanent.
 *
 * Larger values improve the resilience to DENY revocations. However, there is
 * a (potentially substantial) cost of both bandwidth and CPU if the node
 * incorrectly or maliciously acts as if it is still alive, due to divergence
 * of hash trees and ack lists.
 *
 * The default is 256*std_latency.
 */
void praef_system_conf_route_kill_delay(praef_system*, unsigned);
/**
 * Controls the interval at which the local node will propose for itself to
 * gain the GRANT status once it feels it is ready to handle it.
 *
 * Smaller values will somewhat reduce the time required to join a system in
 * the face of packet loss, at the cost of slightly greater bandwidth usage.
 *
 * The default is 16*std_latency.
 */
void praef_system_conf_propose_grant_interval(praef_system*, unsigned);
/**
 * Controls the frequency at which the local node will suggest setting the DENY
 * bit on any node it feels negatively about.
 *
 * All nodes in the system should use the same value for this configuration to
 * minimise bandwidth, though the penalty for not doing so is reasonably small.
 * Smaller values increase bandwidth usage, but will somewhat reduce the time
 * needed to start DENYing another node.
 *
 * The default is 16*std_latency.
 *
 * @see praef_system_conf_vote_chmod_offset()
 */
void praef_system_conf_vote_deny_interval(praef_system*, unsigned);
/**
 * Controls the offset into the future at which GRANT/DENY suggestions produced
 * by the local node are proposed to take effect.
 *
 * All nodes in the system MUST use the same value for this configuration or
 * risk divergence. Larger values increase the probability of a status change
 * carrying when sufficient nodes are in agreement, at the cost of it taking
 * longer for the the status change to take effect.
 *
 * This setting also controls the maximum distance into the future relative to
 * the message envelope at which chmod events will be accepted.
 *
 * The default is 16*std_latency.
 */
void praef_system_conf_vote_chmod_offset(praef_system*, unsigned);
/**
 * Configures the amount of time that a new node has before it is expected to
 * begin adhering to timeliness requirements, in particular the commit lag
 * requirements.
 *
 * This necessarily needs to be greater than intervals (such as the commit
 * interval) upon which this is based.
 *
 * The default is 16*std_latency.
 */
void praef_system_conf_grace_period(praef_system*, unsigned);
/**
 * Configures the interval at which acknowledgement packets are sent to the
 * node which sent the packets they are acknowledging.
 *
 * Smaller values will improve behaviour in the face of accidental packet loss,
 * in exchange for greater bandwidth usage.
 *
 * The default is 4*std_latency.
 */
void praef_system_conf_direct_ack_interval(praef_system*, unsigned);
/**
 * Configures the interval at which acknowledgement packets are sent to nodes
 * other than the node which sent the packets they are acknowledging.
 *
 * Smaller values will improve behaviour in the face of both accidental and
 * deliberate packet loss, in exchange for greater bandwidth usage. This is
 * only a fallback mechanism which only offers partial protection from
 * deliberate packet loss; the hash tree system covers for the rest of
 * this. Indirect acks consume quadratic bandwidth per peer with respect to the
 * number of live nodes in a system.
 *
 * There is generally no reason to set this to a low value, unless the
 * application also reduces the hash tree query interval.
 *
 * The default is 16*std_latency.
 */
void praef_system_conf_indirect_ack_interval(praef_system*, unsigned);
/**
 * Configures the interval at which "linear acknowledgement" packets are sent
 * to nodes.
 *
 * Smaller values will marginally improve packet recovery from cooperating
 * nodes at the cost of some bandwidth.
 *
 * The default is 2*std_latency.
 */
void praef_system_conf_linear_ack_interval(praef_system*, unsigned);
/**
 * Configures the maximum number of packets that will be retransmitted in
 * response to a linear ack message suggestive of packet loss.
 *
 * There is a direct correlation between wasted bandwidth and this value. This
 * is only a secondary packet-recovery mechanism, so it typically should be
 * fairly small, generally about the number of messages the application expects
 * to produce in two round-trips.
 *
 * The default is 4.
 */
void praef_system_conf_linear_ack_max_xmit(praef_system*, unsigned);
/**
 * Configures the maximum number of ticks that the system will advance the
 * application layer (via praef_app_advance_t()) per frame.
 *
 * This allows the application to remain responsive while catching up to an
 * existing system that has already advanced quite far. It also provides some
 * protection from malicious nodes that deliberately skew the clock by large
 * amounts.
 *
 * The default is ~0u; ie, there is effectively no limit.
 */
void praef_system_conf_max_advance_per_frame(praef_system*, unsigned);
/**
 * Configures the maximum offset (absolute value) of an event-vote from the
 * event itself.
 *
 * This value MUST be the same across all nodes in the system, or malicious
 * nodes will be able to cause the system to diverge. Vote messages which
 * violate this constraint are discarded and cause the local node to begin
 * voting to DENY the offending node.
 *
 * Stricter values reduce the possibility for malicious nodes to change the
 * vote outcome of an event long after the event actually occurred.
 *
 * It is the application's responsibility to ensure it does not violate this
 * constraint.
 *
 * The default is ~0u (ie, unlimited), since the application needs to be fully
 * aware of this configuration itself. Virtually all applications will want to
 * set this to something more reasonable.
 */
void praef_system_conf_max_event_vote_offset(praef_system*, unsigned);

__END_DECLS

#endif /* LIBPRAEFECTUS_SYSTEM_H_ */

redpajama_set_name: RedPajamaGithub


text:
#WhyIWrite: Join Us in Celebrating the National Day on Writing
Educator Innovator Blog
By Liana Gamber-Thompson
Why do you write?
Even if you don't fancy yourself much of a writer, think of all the ways you might practice writing—across a range of platforms and mediums—from day to day. Writing can be expressive, explanatory, creative, or matter of fact. It can inspire, inform, and entertain. Writing looks like a journal entry, a poem, an Instagram story, a confessional video, a tweet!
In that spirit, the National Writing Project (NWP) and the National Council of Teachers of English (NCTE) invite you to use the hashtag #WhyIWrite every October 20 to celebrate writing in all its forms. Join us this year by telling us why you write on Twitter or by tapping into one of the many events hosted by educators across the country. Visit WhyIWrite.us for information on events, resources, the Twitter stream, and a brand new podcast series.
At Educator Innovator (EI) and the National Writing Project, we focus on writing year-round, supporting educators in sustained efforts to improve writing and learning for all learners. Sometimes, though, a re-examination of our own writing is called for; an opportunity to reflect on why we ourselves write and about the value of writing in creating a more active and engaged citizenry, a more just democracy, and an overall culture of curiosity.
Enjoy this set of resources from EI and NWP that illuminate the range of purposes for which writing can be used and the various forms it can take—and these are really just the tip of the iceberg! Then join in telling the world (or at least the Twitterverse) why you write; with more than 60,000 tweets and a reach of millions last year, you're sure to be in good company.
NWP Radio: #WhyIWrite
The National Writing Project has two NWP Radio shows, the first of which originally aired on October 12, with Grant Faulkner, executive director of National Novel Writing Month (NaNoWriMo) and Vicki Meigs-Kahlenberg, teacher and author of The Author's Apprentice about why they write. The second airs on the National Day on Writing (October 20 at 9a ET) and features authors, teachers, and others who are excited to give you a peek inside the Top Secret Story Box Project.
Writing Our Civic Futures
Last month, Educator Innovator announced Writing Our Civic Futures, a collaborative project of the National Writing Project and Marginal Syllabus for the 2017-2018 academic year. We invite educators to a year of social reading, collaborative web annotation, and public conversation that explores our civic imaginations and literacy landscapes. As civic engagement changes and evolves, Writing Our Civic Futures will discuss and consider implications for connected learning and teaching. Read, write, and annotate with us over the coming year!
Letters to the Next President 2.0
In the lead-up to Election Day 2016, thousands of young people from across the country wrote letters to the next president about issues that matter to them, publishing their multi-modal submissions online as part of Letters to the Next President 2.0. The project, which was co-sponsored by NWP and KQED, empowered youth voice and showed how writing is a fundamental part of civic life. We encourage you to read and share the powerful, thoughtful letters that were submitted (12,836 letters to be exact!). And although the project has ended, you can keep supporting youth civic action locally through our collection of resources.
Reflections on the Twist Fate Challenge
With a small twist of fate, any hero could become a villain, and any villain, a hero. That was the premise of 2016's Twist Fate Challenge, a month-long challenge for youth ages 13-17 that kicked off during last year's Teen Tech Week. A collaborative partnership between DeviantArt and Wattpad with the Young Adult Library Association and the National Writing Project as part of the Connected Learning Alliance, the challenge prompted youth to pick a story and character, and create an alternate scenario where a famous hero is the villain, or an infamous villain, the hero. They worked in their favorite modes and mediums, including pictures, written stories, comic panels, illustrations, etc. This CLTV hangout goes to show that writing can be participatory, convention-bending, and more. In this conversation, members of the editorial team for the Twist Fate Challenge discuss their experiences engaging with youth submissions in a wide range of genres and describe some of their favorites.
Resilient Writers!
In this recent blog post at Educator Innovator's The Current, Katie McKay describes how educators and community members in Bastrop, TX have been convening over the past year to support student writing as part of the 2017 LRNG Innovators Challenge. The project, called Choice and Voice, aims to amplify elementary students' voices through innovative publication in public spaces, highlighting Bastrop community stories, passions, and convictions.
Pilot a New iPad Game from GlassLab and the National Writing...
Have the young people you work with put their powers of persuasion to the test...
Redesigned learning spaces can support new learning potential
No, the spaces in this video don't look like the average U.S. high school classroom,...
Visiting Digital Storytellers with the Alchemists at Networked Narratives
The Networked Narratives team talks with scholars and practitioners thinking about new ways to collaboratively...

redpajama_set_name: RedPajamaCommonCrawl


2014 Cadillac Escalade ES... Call for Pricing. 2013 Lincoln Navigator Call for Pricing. 2013 Volkswagen CC Call for Pricing. 2014 Buick Enclave Call for Pricing. 2012 Ford F-150 Call for Pricing. 2009 Land Rover Range Rov... Call for Pricing.
Our clients have high expectations for their vehicles, and equally high expectations about the dealership professionals who serve them. Dallas Car Credit is widely recognized to be among the best in quality, reliability, value and customer satisfaction in both sales and service.


text:
Prices & Seating
"Maria Friedman has long been Britain's most celebrated Sondheim exponent." — The Guardian
West End and Broadway star (and director of Merrily We Roll Along) Maria Friedman brings her critically acclaimed solo show Lenny & Steve to the Huntington for a one-night-only concert event. Exploring the genius of Leonard Bernstein and Stephen Sondheim, four-time Olivier Award winner Ms. Friedman will compare and contrast songs from their separate catalogs, as well as their joint masterpiece West Side Story. This beguiling evening of songs and anecdotes includes "New York, New York," "I Can Cook, Too," "Losing My Mind," and "Send in the Clowns."
Maria Friedman Maria Friedman
Maria Friedman
Maria Friedman directed her acclaimed revival of Merrily We Roll Along at the Huntington.
Jason Carr Music Direction Jason Carr Music Direction
Jason Carr
Jason Carr previously music directed Lenny & Steve: The Music of Bernstein & Sondheim (2017) at the Huntington. He is a composer, lyricist, orchestrator and pianist. His association with Stephen Sondheim includes the orchestrations for the Menier Chocolate Factory productions of Sunday in the Park with George (Drama Desk Award winner and Tony Award nominee) and A Little Night Music, Moving On (Bridewell in the UK and as Opening Doors in New York), and Maria Friedman Sings Sondheim and Lenny & Steve in the UK.
Price $99 $85 $70
October 6— November 5, 2017
A Guide for the Homesick
Bad Dates
April 20 — May 20, 2018
May 18 — June 17, 2018


text:
Anxiety, Guest Posts, healing
Coney Island.
By Gila Lyons.
A plastic palm tree spurting water, a dried peach pit on the concrete sidewalk, white- capped waves, a man jogging in an orange Speedo, a woman in white scarves setting a flower boat out to sea, a man photographing his girlfriend drawing, a barge moving slowly on the ocean, a girl wrapped in a towel eating cheese fries, a hip-hop performance by eight-year-old Romanian Americans, Shoot the Freak, Snake Girl, a four-foot rat, blue cotton candy in a clear plastic bag, a boardwalk dance party, an empty bag of Bamba, a man pulling a suitcase on wheels across the sand, an American flag blowing in the wind, planes taking off, planes landing, seagulls diving.
I was living in New York City, pursuing and MFA in creative writing. A sensitive, tightly-wound, quiet-seeking creature, I was an unlikely candidate for life in the city, but I felt ravenous for New York's flash and pop. I thrilled at the exotic dinginess of the subway, the soft hiss of its doors, its smells of burned rubber and re-circulated air. I lavished in colors of each neighborhood – Chelsea, Chinatown, Soho, Tribeca – their very names like sugar on my tongue. That was the first year.
The second year my mental health crumbled like the apartment across the hall from mine, gutted from the inside out, plaster and fiberglass swirling the air. A life-long anxiety disorder flared and surged through me, leaving me sweating, shaking, breathless, and terrified during class, while teaching, at restaurants, in my own bed. I felt claustrophobic in Manhattan, carving out my path through packed sidewalks. The streetlights and late-night revelers kept me awake all night, even through earplugs and a sleeping mask.
Coney Island became my refuge. Each weekend I descended the steps into the hot subway station at 98th Street to be let out 45 minutes later at the tip of Brooklyn. The vastness of the ocean and the damp salty wind helped my throat to unclench, my lungs to expand, my eyes to rest in an uncomplicated color scheme – tan and blue.
That spring during a yoga class I was felled by a panic attack so strong and fast- acting that by the time I made it to the lobby of the gym, I could barely stand. A circle of trainers leaned on their knees over me, I grasped one woman's hand begging, "please don't leave me." My friend Vivian met me at the hospital where I lay on a stretcher in a curtained-off section of the emergency room. I was clipped to several beeping machines and had an oxygen mask strapped around my head that collected the moisture of my choppy breaths. Vivian climbed onto the stretcher and sat behind me so that I could feel her heart beating at my back. I tried to match my body with the calmness of hers, my jagged inhales to the regularity of her breath. Vivian stayed with me as a doctor examined me, popped a valium in my mouth, and encouraged me to stand on my wobbly legs again. She stayed with me at Duane Reed where I filled my prescription for Ativan and bought applesauce, Saltines, and a gallon of water – my favorite after-panic snack. Vivian walked me home, slept with me in my bed.
After that I couldn't be left alone. When my roommates were out I called a friend. At first I couldn't leave my bed, then my room, gradually my circle of safety widened to include my apartment, widened again to the blocks surrounding my building on the Upper West Side. About a month later I felt stronger, braver with a bottle of Ativan jangling in my pocket, and I started making regular journeys to the beach. Coney Island was a perfect combination of nature and city, solitude and security. I could walk a crowded boardwalk, surrounded by people who could catch me if I fell, could call 9-1-1, while my eyes rested on blue water and sky.
One afternoon I brought a new friend with me. While we walked with waves lapping our ankles, Allie and I discovered we shared a history of phobias, anxiety, and panic attacks. We theorized about what might have caused this, and talked about what we had tried to manage it. Our list was long: psychotherapy, psychiatry, wilderness therapy, herbalism, flower essence therapy, fasting, protein diets, and much, much more. None of it had helped for very long, and talking about it left me feeling raw and exhausted. As the sun set we climbed into a red lifeguard chair, strong winds plastering back our hair. The beach was mostly empty except a man who lay in the sand just beneath our chair where the waves gently broke over him. He turned his face up to us with the sun glinting it orange and smiled as he asked, "Help?"
On our way back to the subway, looking for something to eat, we passed venders selling roasted corn and fried fish and nachos dripping with orange cheese. They all looked good to me but Allie was anxious about where she ate – a shellfish allergy restricted her to only a few restaurants. We found a Dunkin' Donuts, a chain she trusted. Wet and sandy, we shivered on the air-conditioned ride home, hunched over our warm bagels in paper bags. I dreaded reentering Manhattan, loud and concrete, crowded with stagnant air, the site of my panic. Some kids on our car turned on a boom box and started breakdancing in the narrow aisles, the smallest of them pacing the train with an empty hat a few passengers tossed dollar bills into. I watched the boys dance and my eyes welled up. Allie put a hand on mine and a tear rolled down. She wiped it off my chin.
I knew my roommates would be out when we reached Manhattan, so Allie came home with me. We took hot showers and pulled thick sweatpants up to our waists and sat on my couch to watch The Office on my laptop. Allie fell asleep and her breathing became strange and chaotic. I lightly shook her but she didn't wake up. I turned on the light and said her name loudly. She jolted awake gasping that she'd had a nightmare and she couldn't breathe. Her body shook and she sat rocking on the edge of the couch, her head in her hands. She was crying and said she couldn't catch her breath. Her face was red and she kept saying in a shaky voice she felt so dizzy, that her heart was beating too fast. We both knew it was a panic attack, she didn't want me to call an ambulance.
She apologized repeatedly, saying how embarrassed she was. I rubbed her back telling her she was safe, that I would stay with her until it passed. I sat behind her on my couch like Vivian had sat behind me and Allie leaned her back against my chest and instinctively tried to match her breathing to mine. I was amazed at the calm regularity of my own breathing, at my normally-beating heart. I felt like an anchor, something solid for her to grasp onto while the waves of adrenaline pushed and pulled and tossed her body around. I had never felt so strong and steady, so maternal and calm.
I had never witnessed anyone else having a panic attack, had only felt it from the inside. Attending to Allie's panic was like finally being able to attend to myself in all the times panic had rendered me unreachable to my soothing or anyone else's. I saw that Allie in no external danger, that the danger was coming from within. Safety lay just on the other side of a few minutes of deep breathing, but also I knew that to tell a person with a panic disorder to breathe deep and stop panicking is like asking a diabetic to calm down and produce more insulin, or a blind person to just focus and see. Panic disorder is deeply neurological, neurochemical, and biological, it can be helped by psychological work, but in the throes of an attack, such suggestions are insulting. I knew Allie couldn't do anything but let it roll through her.
She was like a woman in labor, the panic raged unrelentingly with tremendous force until it was over, around five a.m. As suddenly as she woke with it lodged in her body, it was gone, and she emerged sweat-drenched and starved. She ate some of my leftover applesauce and Saltines, drank some water. We called her a cab home. While she was bending over her sandy flip-flops she looked up at me and said, "It'll be ok."
I said, "Yes."
She said, "For both of us."
Gila Lyons' work has appeared in Salon, The Millions, The Morning News, Ploughshares, Tablet, The Forward, The NY Press, The Faster Times, The Berkshire Review, and other publications. She has taught writing to children and adults in the classroom, the backcountry, at writing retreats, recovery centers, and prison-alternative programs. She holds an MFA in literary nonfiction from Columbia University, and lives in Boston, where she teaches writing and is at work on a memoir.
Jen Pastiloff is the founder of The manifest-Station. All of her upcoming events listed here, including her two Tuscany retreats.
Jennifer Pastiloff is part of the faculty this year at Other Voices Querétaro in Mexico with Gina Frangello, Emily Rapp, Stacy Berlein, and Rob Roberge. Please email Gina Frangello to be accepted at gfrangello@ameritech.net. Click poster for info or to book. Space is very limited.
Join Jen Pastiloff in The Berkshires of Western Massachusetts in Feb of 2015.
anxietyconey islandGila Lyonshealingmental-healthmfanycpanicpanic attackwriting
Hello, My Name is Rebecca & I Lost My Mom to ALS.
Covid-19 and My Ultra-Orthodox Children
Adoptive Parents are A**holes, Too
My Mother's Hands.
How to Love a Stranger.


text:
Alleged Leaked Email Shows Assistant Principal Ordering Staff To Hide Gender Change Of 7th Grader From Parents
An alleged leaked email from an independent journalist purports to show an assistant principal from San Pasqual Union School in California directing her teachers to use a new name and pronouns for a seventh-grade student.
The email indicates that the assistant principal also directed the staff to hide the changes from the student's parents who are not aware of it.
The subject line of the email reads "Gender Support Plan 7th Grade" and is penned by assistant principal Tammy Lee.
"From here on out, Rebecca (redacted) shall be referred to as Evan (redacted) he/they. He will use the girls' bathroom facilities. All students and staff may know. There will not be an announcement in class," it said.
"Evan's parents DO NOT know, so Synergy and any information that goes home shall say Rebecca (redacted). Please make note in your sub plans to use Evan knowing the attendance sheet from Synergy will say Rebecca," it said.
EXCLUSIVE: I have obtained an email from the Assistant Principal of @pasqual_san where she advises teachers to change a 7th grader's pronouns. She warns them that the student's parents DO NOT KNOW. They are actively going behind the parent's backs and hiding this information. pic.twitter.com/rFfs1CZ9Tj
— Libs of Tik Tok (@libsoftiktok) February 16, 2022
After the information began circulating on Twitter the school deleted its Twitter account.
The school has now deleted their Twitter account pic.twitter.com/qHtH8xZAIQ
In a biography for the assistant principal on the school's website says that "social and emotional affairs are at the forefront of" her work.
"It is with enthusiasm that I introduce myself as the new assistant principal of San Pasqual Union School. I am honored to be a part of a close-knit school family with values near and dear to my heart," the bio said.
"I come with extensive experience in both elementary and middle school. For the previous three years, I served as assistant principal of Empresa Elementary known for academic excellence with an emphasis on Performing and Visual Arts where each student is encouraged to develop an awareness of strengths and interests and be aware of pathways needed to achieve personal academic goals. With this emphasis on achievement both in Language Arts and Mathematics, we earned the California Distinguished School award in 2018. This honor marks the second time I have been part of an award winning team," it said.
"As the assistant principal, social and emotional affairs are at the forefront of my work. I strive for all students to be treated with respect and dignity and to feel included as part of the school community. My training in trauma informed practice and personal connection to students in foster homes has been formative in how I approach students and their needs. I place an importance on relationships and background knowledge and maintain visibility by greeting students and families each morning, build relationships while monitoring recess, and wish students well as they leave school each day," it said.
Responses to the tweet about the alleged email varied.
"So if Rebecca/Evan gets bullied as a result of there are altercations or perhaps they are just in a bad mental state, who would be held responsible since this information is omitted from the parents?" one Twitter user said.
So if Rebecca/Evan gets bullied as a result of there are altercations or perhaps they are just in a bad mental state, who would be held responsible since this information is omitted from the parents?
— Anita S (@beanita83) February 16, 2022
My sister is a public school teacher in a decently sized area and says this is EXTREMELY common.
— Jonny of the Son 🌞 (@JonnyToThe) February 16, 2022
"My sister is a public school teacher in a decently sized area and says this is EXTREMELY common," another said.
Texas Lt. Gov. Patrick Pledges To Rid Universities of Critical Race Theory Curriculum


Jon Jenkins serves as a Field Engineer and APM on his projects to support both the Superintendent, Project Manager and Subcontractor Partners.. On a daily basis, Jon assists the superintendent with operations, conducts safety meetings and serves as a liaison between the superintendent and the project manager. Jon attended Erskine College and Greenville Technical College. He grew up in Piedmont, SC. Some of his past projects include Fellowship Greenville Church and Hillcrest Hospital. At Mavin, "we all strive to be the best and we are all family," says Jon. Outside of work, he is involved in the Boy Scouts of America and is a Freemason. He enjoys hunting, fishing, listening to country music and spending time with his wife, Candace.


text:
MARITAL RAPE: CURSE OF PATRIARCHY
Article 375 of Indian Penal Code, 1860 (Herein after will be referred as "IPC") defines "Rape". The definition of rape under this section includes any type of sexual intercourse (Anal, oral, vaginal) with a woman, by a man against her will, without her consent, with consent obtained by fraud or misrepresentation or coercion, when she not in a condition to give consent, when she is a minor i.e., below 18 years of age, or when she is of unsound mind or intoxicated. However, Exception 2 to Section 375 of IPC protects a man from any prosecution if he is indulging in non-consensual sexual intercourse with his wife, condition being the age of wife should not be below 15 years. (Now it is 18 years).
India is one of the Thirty-six (36) countries around the world where "Marital Rape" or non-consensual sexual intercourse by a husband with his wife is not rape. Poland in 1932 became the first country that criminalised forced sexual intercourse by a husband with his wife. Among the commonwealth countries Australia was the first country to recognise marital rape as a crime in 1976. However, since 1980's various other common law countries have penalised Marital Rape. As per The UN Women's 2011 report Fifty-two (52) countries had taken away the immunity of husbands of not being prosecuted, in case they are involving in forced sex with their wives.
In India, where marriage is being seen as a sacrosanct union between two people, it is very hard for the society to accept the concept of marital rape. In the Indian society it is assumed that when a woman marries a man, she gives her consent for the life time. Behind the veil of this sacrality, women have been abused in our society since time memorial.
However, from past few years various petitions have been filed in Supreme Court and High Courts challenging the constitutionality of Exception 2 to Section 375 of IPC. The present article discusses the reasons that supports the idea of criminalization of Marital Rape in India.
Historical Aspect
India is a patriarchal society and the biasness against women is being continued since time immemorial. This discrimination against women is deep rooted in our society which is clearly evident through the customs, rituals and ancient texts of India. As per Manusmiriti a wife who refuses for sexual intercourse with her husband is not a good wife. In India sex between husband and wife has always been regarded as their private matter and not something that is to be discussed outside the bedroom. Even in Mughal era this thought about institution of marriage was prevalent and the situation of the women worsen in the society.
Further, The Britishers who ruled India during 19th century did not consider the idea of man raping his own wife. According to the British rules of Victorian era, husband and wife are not separate entity but the identity of a woman is merged into the identity of her husband (Doctrine of Unity). Therefore, it is not possible for a man to rape himself. The IPC was drafted in 1860, while India was a British colony by an English man (Lord Macaulay) and therefore IPC have traces of Victorian norms.
When IPC was drafted married women were treated as chattel or property of their husband and did not have many rights that a person with separate legal entity had. However, this oppressive rule of British era continued even after India got Independence. The privacy of marriage was considered superior to the protection of women against abuse. The focal point of the law of rape is 'consent' and as stated above, in our society that consent is been presumed on the part of women for a life time, as soon as she gets married.
In 42nd Law Commission Report for the first time the idea of Marital Rape was endorsed however it took into its ambit only those cases in which husband and wife are not living together either by mutual consent or due to the decree of Judicial Separation. This suggestion has been incorporated in the IPC. Again in 172nd report the question on validity of Exception 2 was raised by Law Commission, but parliament refused to accept the idea of criminalisation of forced sexual intercourse by a husband with his wife citing the reason of privacy of matrimonial relation.
Further, in 2012 when Nirbhaya Rape case shook the whole country a committee was formed under the chairmanship of Justice J.S. Verma to suggest amendments to the Criminal law so that it can effectively deal with the heinous crimes that are committed against women. Among various suggestions by the committee, one was to strike off Exception 2 to Section 375, as in 21st century women are no longer regarded the chattel of husband, they have their own individual identity and the Exception 2 is against the notion of Human Rights. But unfortunately, this recommendation was not accepted by the Parliament Standing Committee on Home Affairs in its 167th report in which it declined to accept the idea of criminalising marital rape on the basis that this will affect the whole family system and in turn will create more injustice.
In 2015 DMK MP Kanimozhi endorsed the idea of criminalisation of Marital Rape in Rajya Sabha and also a private member bill was introduced Congress leader Avinash Pandey to remove the Exception 2 and criminalise Marital Rape in India. The bill could not gain much support.
Further In 2017 in the case of Independent Thought v. Union of India the Supreme Court criminalized forceful sex by a man with his minor wife (under 18 years of age) holding Exception 2 arbitrary and in violation of Article 14 of constitution of India as it discriminates between married and unmarried female child without any reasonable nexus with any understandable objective sought to be achieved. Court also held this classification against Article 15 and Article 21 of constitution of India. However, court clearly refrained from making any comment on forceful sexual intercourse by a man with his adult wife.
Finally in 2018 another private bill was tabled in Rajya Sabha by Congress political leader Dr. Shashi Tharoor demanding the removal of Exception 2 to Section 375 IPC. Even after so much of progress India still is a patriarchal society and the notion of rape of a woman by her husband is strange and unacceptable to the society.
Violation of article 14
Exception 2 to Article 375 is violative of Article 14. The exception forms two classes of women on the basis of their marital status and then discriminates against the married women. The objective of Section 375 of IPC is to protect women from forceful sexual intercourse by a man. But Exception 2 arbitrarily differentiates between married and unmarried women, grants immunity to a man from prosecution even if he is forcing a woman to have sexual intercourse against her will just because she is his wife.
As per State of West Bengal v. Anwar Ali Sarkar and Budhan Choudhary v. State of Bihar, the classification created under Article 14 must be reasonable and not arbitrary that is it should have a reasonable nexus with the objective of the act. However, Exception 2 to Section 375 arbitrarily creates a distinction between married and unmarried women and there is no reasonable nexus between this classification and the objective of Section 375 that is to protect women from forced sex. It does not matter a woman is married or unmarried the rape results in same mental and physical pain to a woman. Moreover, it is much more difficult for a married woman to protect herself from physical abuse and forceable sex as compared to an unmarried woman as she lives in the same house as perpetrator. Therefore, Exception 2 to Section 375 of IPC is violative of Article 14 of the Constitution of India.
Violation of Article 15(3)
Article 15 (3) of Constitution of India allows discrimination on the basis of sex for the benefit of women and children. In the case of Independent Thought v. Union of India, it was unequivocally mentioned by the court that under this article government can only enact a law if it is in benefit of women and if a law is disadvantageous to women in any way, it is violative of Article 15(3) of Constitution of India. Exception 2 to Section 375 of IPC is in no way benefitting the women instead it is against the well-being of married women and jeopardize their welfare.
Further, this exception by granting protection to married men against prosecution when they are indulging in forceful sex with their wives is instead advancing a favour on such married men to the prejudice of married women. Hence, Exception 2 to Section 375 of IPC is violative of Article 15(3) of the Constitution of India.
Article 21 of constitution of India which guarantees 'Life and Liberty' to every individual has been interpreted by Supreme Court in various judgements beyond its literal meaning in a very progressive manner. It interpreted the Article to include right to health, privacy, dignity, safe living conditions, and safe environment etc.
Further, in the case of State of Karnataka v. Krishnappa, it was held by the Supreme Court "Sexual violence apart from being a dehumanizing act is an unlawful intrusion of the right to privacy and sanctity of a female." Again, in Suchita Srivastava v. Chandigarh Administration, The Supreme court associated the right to decide things related to sexual and reproductive activity with right to 'Personal Liberty' under Article 21as well as right to privacy, dignity, and bodily integrity as included under the meaning of Article 21.
In the landmark Judgement of Justice K.S. Puttuswamy (Retd.) v. Union of India the Supreme Court categorically mentioned that right to privacy under Article 21 also incorporate "decisional privacy reflected by an ability to make intimate decisions primarily consisting of one's sexual or procreative nature and decisions in respect of intimate relations."
None of the above stated Judgements mentioned that the right to privacy of an individual is abolished as soon as she gets married to a man. Also, the violation of a woman's body by a man whenever he wants is against her right to live with dignity which is again a part of right to life under Article 21 of Constitution of India.
Again, under Article 21 of Constitution of India, right to health is included. The exclusion of marital rape from the definition of rape is violative of right to health of a married women as when a man indulges in non-consensual sexual intercourse with a woman, it not only affects the physical health of that woman but it also affects her mental health. Therefore, Exception 2 to Article 375 is in violation of Article 21.
Marital Rape in other Countries
Bangladesh- rape law in Bangladesh is very much similar to India and criminal law of Bangladesh does not penalize marital rape if the age of the wife is above thirteen years.
Bhutan- As per Section 199 of the Penal Code of Bhutan marital rape is a crime.
Singapore- The Criminal Law Reform Act 2019 abolished the immunity given to married men and transformed marital rape into a crime.
England- In the case of R v. R (1991) the house of lords granted the status of crime to marital rape.
USA- In USA Nebraska became the first state in 1975 to penalise marital rape. And by 1993 each and every state of US outlawed marital rape.
As most of the countries around the world have already outlawed marital rape/ spousal rape, India should also exhibit a progressive approach and criminalize Marital rape. It should be understood by the Indian society as well as Parliament and Judiciary that they need to overcome their archaic biases and recognise the agony of a married woman, who is continuously subjected to sexual violence by her husband is in no way different from an unmarried woman who is subjected to same kind of treatment. Rape should be punished in the same manner and classifying victim of rapes on the basis of their matrimonial status is against their right to equality, life and liberty.
Indian Penal Code § 375, No. 45 of 1860, India Code.
Makkar, S. (2019, January 1). Marital Rape: A Non-criminalized Crime in India. Harvard Human Right Journal. https://harvardhrj.com/2019/01/marital-rape-a-non-criminalized-crime-in-india/
Yadav, A. (2019). Understanding Marital Rape in India: A Discourse on Textual and Constitutional Perspective. Dr. Ram Manohar Lohiya National Law University Journal,11, 81-93. https://www.scconline.com/blog/
Upadhyay, S. (2019). Is it Time to Criminalise Marital Rape in India?. CPJ Law Journal, 9, 179-192. https://www.scconline.com/blog/
Gupta, B., & Gupta M. (2013). Marital Rape: - Current Legal Framework in India and the Need for Change. Galgotias Journal of Legal Studies,1(2),16-32. https://www.galgotiasuniversity.edu.in/pdfs/issue2.pdf
Independent Thought v. Union of India, (2017) 10 SCC 800.
State of West Bengal v. Anwar Ali Sarkar, AIR (1952) SC 75.
Budhan v. State of Bihar, AIR (1955) SC 191.
The State of Karnataka v. Krishnappa, (2000) 4 SCC 75.
Suchita Srivastava v. Chandigarh Administration, (2008) 14 SCR 989.
Justice K.S. Puttuswamy (Retd.) v. Union of India, (2017) AIR 2017 SC 4161
R. v. R., [1991] 4 All ER 481 (484).
Written by – Indira Yadav


The lovely background on this layout from Enza has a geometric rose pattern and I love how she didn't center it on her page but hung it off the edge and trimmed it off. She balanced this on her page by adding small accents and small banners to the other side. It's the perfect frame for the sweet photo.
Visit the Pink Paislee blog for a closer look.


text:
Q: Show image just uploaded I let the user upload an image, which works fine. The image is also shown on the web form if the user loads the page for the first time.
The problem is when the user uploads another image (replacing the image) I want the new image to be shown on the page (using ajax), but nothing is shown.
the webform:
<asp:TextBox ID="txtVllID" runat="server" />

<asp:Image ID="imgUploaded" runat="server" />

server side script:
Public Sub Page_Load(ByVal sender As Object, ByVal args As EventArgs)

    If Page.IsPostBack Then
        Exit Sub
    End If

    'initieren
    txtVllID.Text = Nothing
    txtVllID.Text = Request.QueryString("vllid")
    imgUploaded.ImageUrl = "ImageHandler.ashx?vllid=" & txtVllID.Text

End Sub

ImageHandler.ashx
<%@ WebHandler Language="VB" Class="ImageHandler" %>

Imports System
Imports System.Web
Imports System.IO

Public Class ImageHandler : Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
    Dim vllid = HttpContext.Current.Request.QueryString("vllid")
    context.Response.ContentType = "image/jpeg"
    context.Response.WriteFile("App_Themes/theme_yellow/uploads/" + vllid + ".jpg")
End Sub

Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
        Return False
    End Get
End Property

End Class

jQuery script:

On the screen the image is not visible. When I look at the result code in the browser the imgUploades.src contains unreadable characters. How can I let this be shown as an image?

A: Just set the img src to the image url, instead of downloading it with ajax.
    onSuccess: function (files, response, xhr) {
        $("#imgUploaded").attr("src", "ImageHandler.ashx?vllid=" + $("#txtVllID").val());
        $("#divGelukt").show("slow", function () { });
    }

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get local country time by TimeZone Id in sql server? i have hosted my site in canada server.  my clients are in different countries. when they add device i have stored timezone id. for example.
'Pacific Standard Time'
'Mountain Standard Time (Mexico)'
'India Standard Time'

now in sql server how can i get country time from timezone Id which is stored in my database like above.?

A: sys.time_zone_info has UTC offsets. This will give you a complete list
SELECT * FROM sys.time_zone_info

From here, you can simply join on the value stored in your table.
MSDN page: https://msdn.microsoft.com/en-us/library/mt612790.aspx

A: Reading the SQL Server from Time Zone can be one way to achieve the current time zone of where the SQL Server is installed.
DECLARE @TimeZone VARCHAR(50)
EXEC MASTER.dbo.xp_regread 'HKEY_LOCAL_MACHINE',
'SYSTEM\CurrentControlSet\Control\TimeZoneInformation',
'TimeZoneKeyName',@TimeZone OUT
SELECT @TimeZone

A: If you are using SQL SERVER 2008 or above you can try this...
SELECT [DateTimeUtil].[UDF_ConvertLocalToLocalByTimezoneIdentifier] (
    'GMT Standard Time', -- the original timezone in which your datetime is stored
    'Middle East Standard Time', -- the target timezone for your user
    '2014-03-30 01:55:00' -- the original datetime you want to convert
)

Source: https://dba.stackexchange.com/questions/39421/how-to-handle-timezone-properly-in-sql-server#comment118319_64418
For more clarification go through the above link...


text:
The following is a list of projects that I have played as either one of the lead(s), a recurring or a series regular.
NIGHT OF SOMETHING STRANGE (WLPFilms / SRS Cinema LLC / Virtual Interactive)
-Feature Film
-Lead Role-Corneilus
TRIVIA-I was told I was the third person (out of over 600) who replied to the ad to audition for NoSS. I was originally asked to audition for another part and I did two video auditions for that. They said they was good but asked if I could try out for "Corneilus" and, if so, to send them an attack video-which I'd never done before. With the help of Ron Bonk and Brian Hewitt I did so. I must of did OK cause I got the part 🙂
NIGHT OF SOMETHING STRANGE ON FACEBOOK
NIGHT OF SOMETHING STRANGE ON IMDB
NIGHT OF SOMETHING STRANGE WEBSITE
NIGHT OF SOMETHING STRANGE ON TWITTER
TALES OF DRACULA (Wolfbain Productions)
-Lead Role-Dracula
TRIVIA-I was totally unaware of auditions and filming being done on this production. I got a message from "Movie Mike" (Mike Rudolf) in regards to this. He really felt that I could do the part of "Dracula." I got in contact with producer Joe DeMuro and set up an audition. I was told later on that I basically got the role as soon as I walked in-me saying a line from the script just confirmed it.
TALES OF DRACULA ON FACEBOOK
TALES OF DRACULA ON IMDB
TALES OF DRACULA ON TWITTER
TALES OF DRACULA ON INSTAGRAM
TALES OF DRACULA ON PINTEREST
STAR TREK NEW VOYAGES:PHASE II (Retro Film Studios LLC)
-TV Show
-Recurring Role-Ensign Dawson Walking Bear
-Seen in the Following Episodes
1)-Mind Sifter
2)-Bread & Savagery
3)-The Holiest Thing
4)-Going Boldly (Vignette)
TRIVIA-I originally went out for an extra role for this and was given a call by writer Patty Wright asking if I wanted to play "Walking Bear" for "Mind Sifter." I said yes. My first day of filming, after my first take, James Cawley (Executive Producer of STP2) took me to the side and asked if I wanted to be a permanent cast member of STP2. I said yes 🙂
STAR TREK:PHASE II ON FACEBOOK
STAR TREK:PHASE II ON YOU TUBE
STAR TREK:PHASE II ON IMDB
ROMEO 3000 (Mad Angel Films / WWJ Productions)
-Lead Role-Tybalt
TRIVIA-'Romeo 3000' started out in 2012 as a 17 page short film script submitted to me from Mad Angel Films Head Taco Matt Peters. Originally I was slated to play the role of Romeo. I asked him if I could tinker with it. Long story short, by 2015, 'Romeo 3000' was now around 123 pages and with me as the role of Tybalt. I was also one of the few cast members who not only designed his own costumes, but bought almost 95% of them on my own as well.
ROMEO 3000 ON FACEBOOK
EMPIRE STATE OF THE DEAD (SRS Cinema LLC)
Ep.-BLESSED ARE THE MEEK (Mad Angel Films)
-Short Film
-Lead Role-Draven
TRIVIA-This was one of two entries I was involved in for a Zombie Short Film contest by Ron Bonk of SRS Cinema LLC. Part of the rules for the contest was you couldn't be in more than one of them unless a) it was the exact same character or b) they were totally different. Since I was already in "Locked In" and I was cast in this one as a killer, I basically went a little extreme to make him kinda "Joker-like." It was actually a little easier to play this role than I'd anticipated, but still, IMO, way short towards approaching The Joker. I just sought to give "Draven" a little Joker "flavor" and I think , in that, I did OK. 🙂 Producer Matt Peters gave me free reign over the character and I basically changed all of my dialogue to be more like what I envisioned "Draven" to be in my head. I was also the one who came up with the title of this short film 🙂 BATM was one of the top finalists in the contest and, as a result, will be included in an upcoming DVD compilation by SRS Cinema LLC called "Empire of the Dead."
BRACKISH (Mad Angel Films)
-Lead Role-Merlock
TRIVIA-This is a remake of the original "Brackish", which was the first feature film Mad Angel Films put out in 2007. I wasn't able to attend the auditions, but was called in when the actor who originally had the "Merlock" role had to pull out. The above photo came from a weekend shoot that found me up for more than 24 hours filming. I couldn't go to sleep due to the contacts. You just make due…
THE CRIMSON MOON (Mad Angel Films / Wicked Six Productions)
-Lead Role-Victor
TRIVIA-Producer Matt Peters contacted me with this role, no audition needed. 🙂 Even though I have had long hair thru out the years, for this production I wore a wig.
MAD ANGEL FILMS WEBSITE
MAD ANGEL FILMS ON FACEBOOK
WICKED SIX PRODUCTIONS ON FACEBOOK
BATAILLE DE SANG (The Horror of it All Productions)
-TRIVIA-I was offered the role of Dracula in this based on my performance in TALES OF DRACULA. However, producer Joe DeMuro wanted me to play the role differently than in Tales so I did 🙂 While this film is also black and white, it's also silent.
THE FERRYMAN (Golden City Films)
-Lead Role-Buddy (AKA The Ferryman)
-TRIVIA-I was notified about this role by my close friend / fellow actor Cassandra Hayes. I went into the audition and, even though I had to go for a call back, I was told it was just a formality. I was also told that basically, as soon as I did the sides that I basically had the role. This was all done at Syracuse University in Syracuse, NY.
G. KHAN (Desolatte Productions)
-Lead Role-Genghis Khan
-TRIVIA-I was contacted directly by director Lee Wilson in regards to taking on the role of Genghis Khan for this via a recommendation from Prashanth Sampathkumaran, who had worked on the crew in the short film 'The Ferryman.'
G KHAN ON TWITTER
DYING TO SURVIVE (JD Film)
-Lead Role-Jake / The Killer
-TRIVIA-I'd done some smaller stuff for both producers Terry Little & James Domroe in the past. Based on that, I was cast as one of the lead roles in DTS without having to audition. Not only that, I'm playing three roles! Who says networking doesn't work? 🙂
DYING TO SURVIVE ON FACEBOOK
LOSING GRACE (Mad Angel Films / Hazy Shade Productions)
-Lead Role-Father Casey
-TRIVIA-When I got this role, writer Cassandra Hayes suggested that-since Father Casey was "buzzed" in this-I should be as well. I considered it…but did I do it? 🙂
FAILMAN (Mad Angel Films)
-Web Series
-Series Regular- Randy AKA "Tonto"
-Episode 1 "The "F" Stands For…."
-Episode 2 "Enter The Buckman"
-Episode 3 "Buckman Vs. Dr. Sinister"
-Episode 4 "Rainbow Fart Blast"
TRIVIA-Producer Matt Peters contacted me for this role shortly after I started filming my first episode of STP2. However, I changed a few things. Originally, Randy was a Native American sidekick who just took verbal abuse. I changed it so that he wasn't Native American (but was still ragged as one) and that while he took it, he fired back as well. In addition, I also suggested that the only reason he doesn't annihilate Failman himself is due to money.
-Episodes of "Failman" can be watched on the VIDEOS page.