text:
#EchoX3 *(Summary)*
*.. is pronounced "Echo times three", or "Echo three" for short. In a pinch, you can even call it Echo if the context is clear.*

**EchoX3** is a distributed object cache that allows methods to be added to those objects so they can be called remotely. It is grounded on distributed hash-map like scalability, Java nio extreme performance and a simple flexible set of bulk (multiple keys) API. **EchoX3** allows for incredibly powerful applications across terabytes of data, running on hundreds of servers, with on-the-fly changes to the algorithms (code). All this supported by a fanatical dedication to zero planned/unplanned downtime and ease of operation for all parties involved in the lifecycle of your **EchoX3** application. It enables..
* Developers whose life is made simpler with simple APIs and built-in functionality
* The operations team who receives a high-reliability, easy to manage system
* The management team who has to make the easy decision to choose **EchoX3**

#EchoX3 *(Guiding design principles)*
Guiding principles are guidelines to be used when making decision; they are tie breakers; they make the difference between a bug being marked “Won’t fix”, “Postponed” and “Must fix”.

* If you are counting milliseconds, you are already too slow!
* Don’t compromise on quality: We ship reliability!
* Ease of use for the user: Write the component in the units of the user of that component
	* The user of an API is a dev
	* The user of a monitoring console can be ops, application engineer, test  or dev
	* The user of configuration is application engineer
* Servers are compatible with clients one major version backwards e.g. a Server v3.2 is compatible with a client v 2.0
* Zero planned down-time; Zero un-planned down-time.
* Backend upgrades are fully compatible (following the upgrade instructions), with no loss of data and no downtime (see 4), at least with the previous release.
* All configuration settings (including all routing changes) are hot

#EchoX3 *(Overview)*
##What does **EchoX3** do?
**EchoX3** is a distributed object cache. The cache contains real objects (not byte[]). As the client makes calls to write new data to the object, it updates itself. During a read call, the object may return stored values or perform calculations and return the results of the calculations. The key is that a true object resides in the cache that can perform operations in-place.
When the client performs a call (see Figure 1), the **EchoX3** system uses the cache name and the key to find the object. The client’s request is then passed to the object (Figure 2).
![Figure 1](https://cloud.githubusercontent.com/assets/7895210/8338052/4bf4f3a8-1a63-11e5-9437-1f857309b363.jpg)

Figure 1 System overview: Routing

![Figure 2](https://cloud.githubusercontent.com/assets/7895210/8338053/4bf509f6-1a63-11e5-8a0c-1250469902e6.jpg)

Figure 2 System overview: Client request to cache object

To simplify the development effort, a number of logistics tasks are handled automatically by the **EchoX3** system:

* Connection management
* Client side retry
* Routing
* Object creation on the server
* Class definition management (no need to put your jar on the server)
* Synchronization (custom ReadWriteLock)
* Maintenance (e.g. Kick your object to clean-up itself)
* In-place object update - (i.e. Upgrade a user object from MyCacheObjectV1 to MyCacheObjectV2 while taking traffic)
* Local & Remote mode with identical semantics to facilitate development & debugging, and the occasional need for a production local cache.

In addition to the powerful object cache, **EchoX3** supports a simple cache mode, with the standard put/get functionality of a traditional cache.
Of course, each of the **EchoX3** APIs is made more powerful with a complement of efficient multi-key version of the API (aka bulk).

##Hash map tutorial
This section is for those who do not necessary deal with hash maps every day and may need a refresher on how they work. Those intimately familiar with hash map technology may skip this section.

	NOTE:	This section discusses a basic HashMap, not necessarily the HashMap or
			hash function used by **EchoX3** or by the standard Java classes.

Much of the work done by **EchoX3** is mapping from a key to some object. Obviously, from the user’s key to the user’s ITrellisCacheObject, and also at several places for management of internal structures. How does one search for the key? Some of the known techniques include

* Enumeration: Simply walking a complete list of the possible elements until the correct one is found. Statistically, one would have to walk about half the list to find the correct element. It is known as a O(n) solution. For example, if there are 1 million (1,000,000) items in a list, you will have to walk about 500,000 on average to find the correct one.
* Binary search: This can be accomplished by storing the elements in a binary tree or by storing them in a sorted array. Either way, on each test, one looks at the middle of the possibility and eliminates about half the range. If there are 2n elements, this will take n tests to find the correct element and is referred as a O(log(n)) solution. Getting back to our list of 1,000,000 items, the correct element can now be found in about 20 tries (220 = 1,048,576).

A hash map style algorithm is faster than the binary search algorithm, at the cost of requiring additional memory to manage the hash table.
First, one calculates the hash of the key. What is a hash? A hash is the result of a mathematical algorithm applied to the parts of the key. For example, if the key is a byte array and we choose the default Java hash function, the algorithm is..

	public static int hashCode(byte a[])
		{
			if (a == null)
				return 0;

			int result = 1;
			for (byte element : a)
				result = 31 * result + element;

			return result;
		}

This modulo of this number is used to distribute the keys amongst a set number of buckets. Given N buckets, one takes ABS(hash) % N to obtain the bucket number. For example, if the hash is -32 and there are 5 buckets, then the bucket number becomes ABS(-32) % 5 = 2.
In the simple case, each bucket contains a list of the items that map to the buckets. The power of the hash map is achieved when the number of buckets is sufficiently large that there are only very few items per buckets (0, 1 or 2). For example, the Java hash map defaults to a maximum occupancy of 0.75 items per bucket. When more items are placed in the map, Java automatically increases the number of buckets.
When searching within a hash map, one first uses the hash of the key to find the correct bucket, and then walks the list of items in the bucket for the one matching exactly the key. In a properly balanced hash map, this results in, statistically, a single compare to find the correct item. The hash map is said to be of order O(1). The time required to find an item is NOT dependent on the number of items in the map. Of course, more items result in larger the map and larger the memory requirement.

#Hello "EchoX3"
Every good programming manual starts with a HelloWorld program. This is where you make sure you include the proper libraries, perform the correct initialization and can make the most basic call into the new WhateverNewThingYouAreUsing.

	NOTE:	Listings for all samples discussed are in section 6. The code for the Hello applications
			can also be found under the module “Hello” as part of the **EchoX3** distribution.

This section will walk you through "Hello **EchoX3**", from your first program using local mode through setting-up a server and making remote calls to the remote server.

##Dependencies…
**EchoX3** is composed of two separate and distinct deliverables:
* EchoX3Client.jar

The client library used in your application
* EchoX3Server.war

The server application, which runs in a standard Tomcat container.
The self-imposed requirement on the client library (EchoX3Client.jar) is to have a minimal set of dependencies, such that the application using **EchoX3** has the freedom to run under whatever platform it wants. As such, the only dependencies at this point is
* log4j

The server on the other hand runs independently of user code and does not have the same limitation. Server dependencies will be determined later…
* TBD

##HelloSimple.java
Within **EchoX3**, the first step is always to obtain the factory object.

		IClientFactory	factory	= ClientFactory.getInstance();

When operating in local mode, it is necessary to tell **EchoX3** how to configure the cache(s) that will be used. It is recommended that the call to putLocalConfiuration() be made in all cases, as it facilitate the switching between local and remote mode.

		// Set the configuration file for this cache, required only in local.
		URL			url		= ClassLoader.getSystemResource(FILE_NAME);
		factory.putLocalConfiguration(CACHE_NAME, url);

Next, the admin client is used to connect to the cache. This is required in either Local or Remote mode.

		// Create the local cache; or connect to the remote cache; always required
		IAdminClient		admin		= factory.getAdminClient(ClientType.Local);
		admin.connectToCache(CACHE_NAME);

The simple cache client can now be used for put and get operations.

		ISimpleCacheClient	client		=factory.getSimpleClient(ClientType.Local);
		client.put(CACHE_NAME, KEY, VALUE);
		Serializable		back		= client.get(CACHE_NAME, KEY);

##HelloObject.java
The first few steps required in object mode are identical to simple mode. The only difference is the name of the file containing the configuration.

**EchoX3** comes with a built-in TestObject and matching TestObjectFactory. Each request to the TestObject include a burn time (micro-seconds spent burning CPU), sleep time (milli-seconds spent sleeping), a throw flag (telling the object if it should throw an exception). On a write, a byte array is sent to the object and the byte array is returned during a read operation. This object is intended for test programs, including this HelloObject.

The writeOnly call takes a writeRequest.

How do object get put in the object cache?

Objects are actually never put in an object cache by the user’s code. The client API only supports writeOnly() and readOnly(); not put. How do objects get created? Blank objects are created using the factory class specified in the configuration file when a key corresponds to an object that does not exists in the cache. Upon a write operation, rather than returning “not found”, the object cache will create a blank object and pass the write operation to the newly created object.

		IObjectCacheClient	client		= factory.getObjectClient(ClientType.Local);
		byte[]			bytes		= VALUE.getBytes(Charset.defaultCharset());
		TestWriteRequest	writeRequest	= new TestWriteRequest(0, 0, false, bytes);
		client.writeOnly(CACHE_NAME, KEY, writeRequest);

And the read request takes a readRequest to return a readResponse.

		TestReadRequest	readRequest	= new TestReadRequest(0, 0, false);
		Serializable		response	= client.readOnly(CACHE_NAME, KEY, readRequest);
		TestReadResponse	readResponse	= (TestReadResponse) response;
		byte[]			backBytes	= readResponse.getBytes();
		String			back		= new String(backBytes,Charset.defaultCharset());

##Hello EchoX3 server

		[[[TODO]]]

#Writing a EchoX3 application

Figure 3 illustrates the various components of a typical **EchoX3** application. In this section, we will build a complete **EchoX3** application named SmartCache (included in the **EchoX3** distribution).
![Figure 3](https://cloud.githubusercontent.com/assets/7895210/8338054/4bf62cdc-1a63-11e5-8b8f-1e6b7fbfbe7e.jpg)

Figure 3 EchoX3 application components

##SmartCache design
There is a cost to each item placed in a (simple or object) cache. Sometimes, the right conditions are present where this cost can be minimized. SmartCache is a simple cache that minimizes this cost when the following conditions are present:
* The payload (size of key + size of value) is relatively small (<2-5 KB)
* The keys are composed in such a way that several items have the same key up to the last byte (You should use byte[] as keys. The API supports Serializable; however, byte[] are not compressed and essentially kept intact, as is required for this scheme.)

For example, the set of 4 bytes keys illustrated in Figure 4 matches condition 2.

![Figure 4](https://cloud.githubusercontent.com/assets/7895210/8338049/4bf26200-1a63-11e5-819f-7ca54a884073.jpg)

Figure 4 Keys matching condition for SmartCache

If both conditions are met, then significant memory reduction can be obtained. In the example of Figure 4, there are 11 entries, corresponding to 11 entries in SimpleCache. With SmartCache, this will be reduced to only 3 larger entries, where only the first 3 bytes of the key are used as key into the ObjectCache and the fourth byte is used to index into an array internal to the ObjectCache SmartCache object where the values are stored, as illustrated in Figure 5.

![Figure 5](https://cloud.githubusercontent.com/assets/7895210/8338051/4bf488e6-1a63-11e5-992b-0990aadb1697.jpg)

Figure 5 Splitting of the key for SmartCache

SmartCache will implement exactly the ITrellisSimpleCacheClient interface. However, using its own optimized way of storing the data, it will be more memory efficient.

##SmartCacheObject implements ICacheObject
The core of the application is the SmartCache object. In this case, to be fully compatible with the regular SimpleCache, SmartCache needs to support expiration based on TimeWrite or TimeRead. This means we need to maintain an m_lastWrite and m_lastRead for each entry in addition to the m_data.

###Member variables
The member variables for SmartCacheObject become the array version of the member variables for SimpleCacheObject, as illustrated in Figure 6.

		public class SmartCacheObject implements ITrellisCacheObject
		{
			private TrellisSimpleCacheStatusHolder		m_cacheStatus;

			private byte[][]	m_dataList			= new byte[256][];
			private long[]	m_writeTimeListMS		= new long[256];
			private long[]	m_readTimeListMS		= new long[256];
			private long[]	m_expirationTimeListMS	= new long[256];

		}

Figure 6 Member variables for SmartCache

The member variable m_cacheStatus matches same in SimpleCache and maintains the configuration data along with counters. Each object has a pointer to the object owned by the factory associated with the named cache.

Appropriate getters are available on each of these member variables so they can be stolen by a later release of SmartCacheObject for in-place upgrade via the method upgradeClass() of the v2 (or v1.1) new object/class.

The readOnly() and writeOnly() method will be dealt with in the section on request below. The remaining ITrellisCacheObject methods are discussed here.

###Constructor
Following the pattern of TrellisSimpleCacheObject, the constructor takes the TrellisSimpleCacheStatusHolder and keeps a pointer to the master owned by the factory object. After final construction, all data is initialized to null.

###void updateConfiguration(TrellisCacheConfiguration configuration)
This method is called on existing objects to inform them that the configuration has changed. The factory is always called first (guaranteed by **EchoX3**). This means that the m_cacheStatus has been updated before this call. The parameter configuration is ignored and m_expirationTimeListMS is updated for the new configuration.

###void flush(long timeNowMS, long timeFlushMS)
Flush can be a dangerous call in a conventional system. The problem is that, immediately after the flush, there are no entries in the cache and every call is a miss. A simplistic application using caching is illustrated in Figure 7.

		Foo		foo	= cache.get(key);
		if (null == foo)
		{
			foo = backend.computeFoo(...);
			cache.put(key, foo);
		}
		// Use the value of foo

Figure 7 Simple application using cache

After a flush, every call will go to the backend and risks overloading it. To avoid this load spike on the backend, **EchoX3** supports a soft-flush. The flush is spread over N milli-seconds. The client API for flush takes the parameter flushDurationMS. On each server, **EchoX3** utilizes a linear function to distribute the flush time of each object over the flush duration. **EchoX3** then immediately tells each object at which time it should flush itself. It is the responsibility of the object to determine based on its own semantics how it wants to proceed.

In the case of SimpleCache or SmartCache, this is straight forward as the read and write times can be adjusted to ensure the object does not live beyond the scheduled flush time. For each other class of object, the details may be different, up to and including some object that will ignore the call and some object that will ignore the parameter timeFlushMS and flush themselves immediately. That part belongs to the owner (writer/coder) of the object.

![Figure 8](https://cloud.githubusercontent.com/assets/7895210/8338050/4bf44db8-1a63-11e5-912b-1093ad150378.jpg)

Figure 8 Adjusting read/write time for soft flush in SimpleCache and SmartCache

###void doMaintenance(int memoryLevelPercent)
The method doMaintenance is where the object cleans itself. In the case of a SmartCache, it will go through each of its item and delete (nullify) each expired item.

The parameter memoryLevelPercent indicates the level of memory pressure under which the system is currently operating. In other words, this is the percent of normal memory the application should use. When the number is below 100, a well-behaved application should reduce its memory requirement.

In the cache of a standard caching application with a time-to-live (TTL), there is an obvious way to use this parameter. The configuration TTL is multiplied by the memoryLevelPercent (TTL * memoryLevelPercent / 100) to obtain the effective TTL and the effective TTL is used.

The configuration parameters MaintenancePeriodNumber and MaintenancePeriodUnits are used to configure on a per named cache basis how often this method is called.

###Boolean canDelete()
This method is called after every operation which can modify the object (doMaintenance and writeOnly). **EchoX3** is asking the object is it can be deleted. For SmartCache, the answer is yes when all elements of the data list are null.

For SmartCache, there are two ways of implementing this method
* Walk the list until a non-null is found (return false) or the end of list is found (return true)
* Keep a count of non-null elements and return count == 0

##Client wrapper implements ISimpleCacheClient
The client wrapper acts as a simplification agent between the clients of the **EchoX3** application and the **EchoX3** system. To its clients, the wrapper exposes a simple interface in clients “units”. For example, the SmartCache exposes a plain cache interface. The implementation details are hidden from the clients. The wrapper takes in requests and translates them into **EchoX3** calls, either to the SimpleCache or to the ObjectCache, as is appropriate. In a more advanced scenario, a wrapper’s single entry point could require multiple calls to perform its task before returning to the caller.

![Figure 9](https://cloud.githubusercontent.com/assets/7895210/8338057/4c06ccfe-1a63-11e5-8ecc-8ed4cd153b45.jpg)

Figure 9 Client wrapper interfaces

For SmartCache, the obvious and simplest approach is to expose the same API as is used for the **EchoX3** SimpleCache: ISimpleCacheClient:

			class SmartCacheClient implements ITrellisSimpleCacheClient

##Request Objects
There are several approaches possible to the complexity of the request objects. Remember that they are full-fledged Java objects that will exist on the server. At the simple end, they are POJO used by the cache object to determine the request and request parameters. At the more complex end, they can contain the algorithm to run on the cache object’s data.
For SmartCache, the simplicity of the problem lends itself towards the POJO end of the spectrum.

###SmartCacheRequest
The plain SmartCacheRequest is used in both Read and Write mode and is the class that understand how to parse the key to extract the bytes corresponding to the object’s key and the byte corresponding to the array index for the element within the cache object.

		public class SmartCacheRequest implements Serializable
		{
			private transient byte[]		m_objectKey;
			private int				m_index;
		}

Figure 10 Fields of SmartCacheRequest

This class serves multiple purposes as it not only act as a base class for SmartCacheWriteRequest (see below), it is also the class that parses the full key into its components. The components are stored in the two member variables. Note that m_objectKey is marked transient as it does not need to be transmitted to the server. It is used directly as a parameter (key) to the writeOnly (or readOnly) call.

###WriteRequest
The write request extends SmartCacheRequest, adding the byte[] corresponding to the value to be stored (see Figure 11).

		public class SmartCacheWriteRequest extends SmartCacheRequest
		{
			private byte[]		m_value;
		}

Figure 11 Fields of SmartCacheWriteRequest

###ReadRequest
Given the simplicity of this application, the read request is simply the index of the value to retrieve. The class SmartCacheRequest is used to create the required key components.

##Debugging the application
The first phase of debugging takes place in **ClientType.Local**.

It is straight forward to debug into the client wrapper, up to the call into objectCache.writeOnly(). At this point, you may want to set some breakpoints to see what your code is doing. The following are key entry points:
* ObjectFactory.createObject()
* cacheObject.writeOnly()
* cacheObject.readOnly()

Once you see these methods execute properly, you can look at the other methods on your object (e.g. doMaintenance).

#Architecture overview
Clients are the user application calling entry points into libraries supplied by us. The initial offering will include a Java library . All client libraries will implement the same functionality in remote mode. The same Java client will support both Windows and Linux clients.

The servers will be written entirely in 100% portable Java. They will run on Windows, Mac and Linux. Further, the configuration and automatic scalability system will support major cloud providers. It is expected that the v1 server will run on Windows. Yet, the code will be written with the goal to run on Windows, Mac and Linux operating systems.

##Topography
As illustrated (Figure 12), the servers are organized in groups called “clusters”. Each cluster is completely independent from the other clusters in terms of functionality and scalability. The major link between the various “connected” clusters is that, by being aware of each other, it is possible for a client to obtain access to any cluster after connecting to a single server in any cluster.

![Figure 12](https://cloud.githubusercontent.com/assets/7895210/8338055/4c0630dc-1a63-11e5-9865-265d55dff887.jpg)

Figure 12 System overview

At startup, a client only needs to connect to a single server belonging to any cluster of “the system”. It asks that server which servers are members of the cluster containing cache “X”. Any of the permanent servers can answer that question. The client then connects to the servers and is then connected directly to the cluster and independent of any other cluster within the enterprise system.

Internally, each server is composed of three somewhat independent components:
* Transport . On the receiving end, this component receives requests, posts them to the appropriate thread pool. On the other side of the transactions, this component is responsible for transmitting data to other components (e.g. responses to clients or requests to other servers)
* A dispatcher. The director receives requests from clients and is responsible for applying the appropriate routing table to obtain the response required by the client.
* A local ObjectCache responsible for managing the various named ObjectCache stored on the server.

A direct implication of 2 above is that the system is a 2 hops system. This has a cost and provides benefits. The obvious cost is performance. Try the system and, if you find it too slow, tell us and we will fix it. All performance tests performed on our system (e.g. prototype) shows that it is as fast as the fastest commercial single hop system and it is much faster than most.

The 2 hops approach has several advantages, including
* Changes to the back-end (anything from OS maintenance requiring a server bounce to a major version upgrade of the backend) can be made transparently to the client.
* A much higher scalability can be achieved.

##Simplified client interface
The client interface is extremely simple, by design…

The first entry point is used to obtain a client instance object. Note that the instance is a singleton. There are two singleton within the system, one for local and one for remote. In a typical scenario, one may choose to use the local mode for early debugging and switch to remote (100% compatible) for integrated testing and production. In a more complex scenario, both may be used for different named objects. Of course, the use of both concurrently is supported.
* Factory.getInstance().getSimpleClient (Boolean isLocal)

    or

    Factory.getInstance().getObjectClient (Boolean isLocal)

The next call tells the system which named cache you want to use. Multiple calls can be made to access multiple named caches.
* connectToCache(String name)

Then the system is ready to be used with SimpleCache calls such as …
* void put(String name, Serializable key, Serializable value)
* Serializable get(String name, Serializable value)

or ObjectCache calls such as
* boolean writeOnly(String name, Serializable key, Serializable request)
* Serializable readOnly(String name, Serializable key, Serializable request)

Of course, all the appropriate bulk flavors of these calls are available in the complete API. The API will also include other utility entry points known to be useful in such systems.

##A simple session
The first call made by the client is to the Factory, to obtain an instance of the client. By passing true or false as the single parameter (isLocal), the object return will either be local or remote. Both object implement exactly the same interface and will behave identically.

###Connect: Local mode
Calls to conectoBlobCache and connectToObjectCache will actually create the BlobCache or the ObjectCache on the local machine, in the application’s heap.

###Connect: Remote mode
The “connect*” family of calls cause the client to connect to a director on the system. Any director will do. The remote server is queried for the list of servers responsible for the name supplied (Steps 1 and 2 in Figure 12). Unbeknownst to the client, this is the list of servers in the cluster containing the named BlobCache or ObjectCache, on which the clients will be able to talk to the servers.

Internally, the client library establishes a connection to each server/director and builds a load balancing sequence.

In local mode, other calls are simply passed to the local server. The discussion below applies only to the remote mode.

###Get: Remote mode (Steps 3-6 in Figure 12)
When the client calls get(name, key), the call is directed to one of the servers in the list given to the client for that name, based on the load balancing algorithm (discussed in details below). On the server, the request is received by the transport layer which immediately passes it to the director. Technically, the client does not know the difference between a “server” and a “director’. However, this difference is crucial to us.
The director is the brains of the operation. It manages the routing table, uses it to service the client’s requests, including reverting to redundant servers when a failure occurs in the middle of an operation.

Using the key, the director determines which server to query and passes the request to the server. This is done asynchronously (java.nio). When the response comes back from the server, the director composes an appropriate response for the client (e.g. merging responses from multiple servers in the case of a bulk operation) and passes it to the transport layer for transmission.

The server’s role in this is fairly straightforward: Receive get/put, process it, and send response to director.

In the general case, the ratio of reads to writes is not known (e.g. to the items in a bin) and must be assumed to be variable between the extremes. In these situations, the simple synchronized can be used as it is known to be more efficient when a mix of reads and writes occur.

This project does NOT use the standard Java ReadWriteLocks are they are known to perform poorly when contention is present (e.g. 10x slower). The alternate MagicReadWriteLock is used in place.

#Monitoring (aka counting beans)

##Garbage collection
When asked what I do for a living, I could easily say I work in garbage. For **EchoX3** to maintain its record of 99% of the requests faster than X ms, it is not sufficient to write good (great) code. The garbage collection beast must be tamed. When operating at high throughput on large heap JVM, the duration and frequency of the garbage collection cycles becomes as critical as the code.In order to manage GC, it is essential to have adequate monitoring tools. These are discussed below…

###The theory

####Single measurement
First, let’s consider the simplified case where GC is extremely stable and all GCs occur at fixed regular intervals and each last exactly the same time. This is illustrated in Figure 13.

![Figure 13](https://cloud.githubusercontent.com/assets/7895210/8338059/4c089444-1a63-11e5-8741-f3f1517f4d92.jpg)

Figure 13 GC measurement: single measurement

Now, consider the single cycle highlighted. We can define the following variables:
* T(Cycle		Duration of a single cycle (30 seconds)
* T(Pause)	Duration of a single pause (60 ms)
* T(Clock)		Duration of the GC, based on a wall clock
* Count		Count of GC during the interval of interest (obviously 1 during a single cycle)

	Note	Some GC algorithms (collectors) always have T(Pause) =
	    T(Clock) (e.g. Parallel) while others (e.g. G1) will have T(Pause) < T(Clock).

Finally, we can calculate the fraction of the time spent in a GC pause (and therefore not running user code), DutyCycle(GC), as

			DutyCycle(GC)=  (T(Pause))/(T(Cycle))*100%

Applying this equation to the single cycle GC # 2 gives

			DutyCycle(GC)=  (60 ms)/(4 sec)*100%=  (60 ms)/(4,000 ms)*100%=1.5%

This means, in the example, that the JVM spends 1.5% of its time paused to performed garbage collection and 98.5% of its time running user code.

There is more. The collection took a total of 1.2 second. This means that some number of threads was running in parallel to the user code performing some garbage collection task during those 1.2 seconds, T(Clock).

A full cycle can now divided in three phases , as illustrated in Figure 14:
* GC Pause: During this phase, only GC runs and the user code is halted. The limiting factor here is related to the SLA of the relevant service (e.g. **EchoX3**). For the fraction of requests that arrive during a GC (this was 1.5% in the example above), what is the degradation in response time you and your customers are willing to accept?
* GC Concurrent: Here, both GC and user code are running. This implies that some of the processing power available on the server (i.e. cores, memory bandwidth) is used for the garbage collection tasks and is not available to the user code. Unless the servers are running extremely hot, GC concurrent typically does not cause significant problems.
* User code: The objective is always to optimize the time spent in this mode. However, in a machine running hot, a high rate of allocation of short-lived object will drive the time spent in GC.

![Figure 14](https://cloud.githubusercontent.com/assets/7895210/8338058/4c0865fa-1a63-11e5-9b35-a73de073252a.jpg)

Figure 14 Three phases of a single GC cycle

The first step in “tuning” GC is finding the proper collector configuration for the memory utilization pattern of your application. Next comes the trade-off between minimizing DutyCycle(GC) and T(Pause). Typically, improving degrades the other and one must find a reasonable balance.

####Average measurement
In practice, GCs do not occur at exactly fixed intervals and do not always take the same amount of time … but they are in the same ballpark. What counts is that they do not vary widely. They are close enough that working with averages is sufficient for our needs.

![Figure 15](https://cloud.githubusercontent.com/assets/7895210/8338060/4c08d846-1a63-11e5-98d1-920169c95fa5.jpg)

Figure 15 GC measurement: average measurement

Average measurements can be made by measuring at regular intervals
* Count of GC =Count
* Sum of pause = Sum(Pause)
* Duration of interval = Period(Interval)

From which one can calculate Average(Pause), Period(Cycle), and DutyCycle(GC).

The duration of a garbage collection (the 10 sec or so above) can also be used to determine what fraction of the time is spent in collection regardless of pauses. This is particularly useful in busy JVMs: If the collector is constantly running, even if the pauses are at acceptable levels, it may be an indication that the JVM is running near its limit. A small increase in load may push it to the point where the collector cannot keep up, with possibly disastrous results.

####JVM lifetime measurement
The lifetime measurements are made in a manner similar to the average measurements, except the measurement period is always “from the start of the JVM until now”.

The lifetime measurements provide coarse, but stable numbers, sometimes useful from a JVM that sees essentially constant or relatively constant load (e.g. production or specific stress servers). In contrast, the average measurements provide more immediate measurement (e.g. for the past minute), at the cost of being more noisy. The combination of both typically provides good insight into the behavior of the JVM.

###The MBean (JMX)
The MBean are the objects visible in JMX. The classes described below measure the GC parameters and expose them via JMX such that they are visible in JConsole or your favorite tool to look at JMX custom objects.

![Figure 16](https://cloud.githubusercontent.com/assets/7895210/8338056/4c06c83a-1a63-11e5-910e-153c7d285c09.jpg)

Figure 16 GC measurement

###The classes
For programmers who want to expose this information in their application.

# Development Guide

This section is for developers intending to consume or contribute to the project.  It covers the mechanics of working with the project such as building, running tests, and running samples.  It doesn't cover best coding practices, style, design philosophy, etc.

##Build Tools

The project uses the following tools for development.  The rest of this developer guide will assume these tools are installed in the development environment, and that the correct versions can be invoked from the command-line.

Please see the developer's documentation for each tool for installation steps for your platform.

* Java JDK 1.8.0_x
* Apache Maven 3.3.3 or later
* IntelliJ Idea 14 (optional)

##Verifying your Build Environment

If the required tools are installed correctly, the following command-lines should result in the outputs shown.  Note that prompts shown are for bash shell users, but the instructions are the same for other platforms.

###Java

Command-line
```
$ java -version
```

Expected result
```
java version "1.8.0_x"
Java(TM) SE Runtime Environment (build 1.8.0_x-y)
Java HotSpot(TM) 64-Bit Server VM (build 25.x-y, mixed mode)
```

###Maven

Command-line
```
$ mvn --version
```

Expected result
```
Apache Maven 3.3.3<PHONE_NUMBER>791599e205a5524ec3e0dfe41d4a06; 2015-04-22T04:57:37-07:00)
Maven home: <path-to-maven>
Java version: 1.8.0_20, vendor: Oracle Corporation
Java home: <path-to-jdk>
Default locale: <locale info>
OS name: <os name>, version: <version>, arch: <arch name>, family: <family name>
```

##Building

EchoX3 builds using Maven from the root of the project.  This is the directory containing the root POM.XML file for the project.

The root POM.XML file  should contain the following identifiers:
```
<name>EchoX3</name>
<groupId>com.expedia.echox3</groupId>
<artifactId>EchoX3</artifactId>
```

Build-Time Tests

Tests will be automatically run by Maven when building.  Tests may be disabled for convenience by commenting out the appropriate line in the root POM.XML as shown below (or disabled on a per-project basis by adding a similar line to any sub-project's POM.XML).

```
<properties>
  <!-- Uncomment this line to skip tests when building -->
  <maven.test.skip>true</maven.test.skip>
```

Optional: Set OUTPUT_ROOT environment variable

It is highly recommended to set the OUTPUT_ROOT environment variable to control your build output location.  This will be helpful when cleaning the project, and managing the project and build output from IntelliJ Idea if you're using that IDE.

For example (bash shell)
```
$ export OUTPUT_ROOT=/build
```

For example (windows)
```
c:> set OUTPUT_ROOT=d:\build
```

Compile source files and run tests

```
$ mvn compile
```

Create build artifacts (jars and other output artifacts)

```
$ mvn package
```

On Macs or unix based platforms, you may need to create your /build directory, or use the sudo command to build so that these directories may be created.

```
$ sudo mvn package
```

##IDE Support

###IntelliJ Idea 14

IntelliJ project files are supplied in the /idea directory.  There are two files for the EchoX3 project (EchoX3.ipr, EchoX3.iml), and a <module-name>.iml file per module.

Begin by importing the project into IntelliJ Idea.

1. Select File->Open from the IntelliJ Idea menu.
2. Navigate to /EchoX3/idea/
3. Select EchoX3.ipr and click OK

Set project output root

1. From the IntelliJ Idea menu, on Windows, navigate to File->Settings; on Mac, navigate to "IntelliJ IDEA"->Preferences.
3. Type "path variables" in the settings search bar, or naviage to "Build, Execution, Deployment->Path Variables".
4. Change the value for "output.root".  Ideally this should match your OUTPUT_ROOT environment variable (see Maven build instructions above).

Set project SDK

The project SDK must be set before the project will build.  This may happen automatically depending on the configuration of your IDE.  A warning will be issued if the SDK is not set.

1.  Navigate to "File->Project Structure" from the IntelliJ Idea menu
2.  Specify SDK for the project. This must be JDK 1.8.0_x or later compatible versions
3.  Specify project language level.  This must be "8 - Lambdas, type annotations, etc." or later

Verify build

Select "Build->Rebuild Project" from the IntelliJ Idea menu.  The "Messages" tab should display no errors if the project builds successfully.

###Eclipse

The project should be usable with Eclipse.  Most if not all of the instructions given for IntelliJ Idea will work with Eclipse but must be translated into Eclipse terms.  Eclipse project files are not included.

##Examples

Examples may be run from the command-line, or from IntelliJ Idea.  There are three examples.  The following table describes each of them.

| Name        | Description                                           | Main Class                                      |
| ----------- | ----------------------------------------------------- | ----------------------------------------------- |
| HelloSimple | "Dumb" cache of key / value pairs                     | com.expedia.echox3.container.simple.HelloSimple |
| HelloIoc    | API intended for use by Ioc frameworks such as Spring | com.expedia.echox3.container.ioc.HelloIoc       |
| HelloObject | Distributed "smart" Object Cache                      | com.expedia.echox3.container.object.HelloObject |

### Running examples from IntelliJ Idea

Assuming the project has been successfully loaded into IntellIJ Idea and builds successfully, the examples will run from within the IDE.

Run / Debug configuration for example Hello (change the main class for the other examples from the description table).

```
   Main Class:                 com.expedia.echox3.container.simple.HelloSimple
   Working Directory:          ~/src/EchoX3/idea
   Use classpath of module:    EchoX3-Sample-Hello
```

### Running examples from the command line

Shell scripts are provided along with pre-built java jars for the EchoX3 client and examples.  These files are provided in the bin subdirectory of the project.  Shell scripts expect to be run from this directory.

Note: On Mac and 'Nix variants, the executable file attribute must be set for shell scripts.  If this attribute is not set, attempting to execute the shell scripts will result in an error.

Error if executable attribute not set
```
./HelloObject.bash: Permission Denied
```

To set the executable attribute: From the bin directory under project root e.g. /usr/src/EchoX3/bin
```
$ chmod +x *.bash
```

Again these commands must be executed from the bin directory under your project root e.g. /usr/src/EchoX3/bin or d:\src\EchoX3\bin

Mac / 'Nix variants
```
$ ./HelloSimple.bash
$ ./HelloObject.bash
$ ./HelloIoc.bash
```

Windows
```
C:\src\github\EchoX3\bin>HelloSimple.cmd
C:\src\github\EchoX3\bin>HelloObject.cmd
C:\src\github\EchoX3\bin>HelloIoc.cmd
```

Successful output should be similar to the following example shown, with no exceptions thrown.

```
2015-08-12 16:43:26,447  INFO [main] AbstractConfigurationProvider (40175, ConfigurationChange) Configuration provider jar:file:/D:/src/buildverify/EchoX3/bin/EchoX3-Client-0.1.0.jar!/config/BasicsCounters.config.properties modified:
Added Serial.DeflateIsEnabled = null -> false
Added Serial.DeserializeIsEnabled = null -> false
Added Serial.InflateIsEnabled = null -> false
...
       (lots of lines removed)
...
Success -> Retrieved The quick brown fox jumps over the lazy dog.
```


text:
# Notes

The public version in all repositories of the project is temporarily not updated.

[New Launcher (x32 or x64) can be downloaded from here](http://orionuo.online)

# To fix missing api-ms-win-crt-runtime-l1-1-0.dll errors on Win 7 SP 1:

Download and install update: KB2999226

# OrionUO Client

[![Travis Build Status](https://travis-ci.org/Hotride/OrionUO.svg?branch=master)](https://travis-ci.org/Hotride/OrionUO)
[![Build status](https://ci.appveyor.com/api/projects/status/qmd3795itrkiwnr3?svg=true)](https://ci.appveyor.com/project/Hotride/orionuo)

* OrionUO Client - is an alternative, open source Ultima Online graphic client.

* Platforms: Windows and Linux (in progress)

* Rendering: OpenGL 2.0 and higher

## Orion Community

[Discord](https://discord.gg/xSnqcBU8a8)

[WIKI](https://github.com/Hotride/OrionUO/wiki)

[github issue tracking](https://github.com/Hotride/OrionUO/issues)

## Download

* Download [Orion Launcher](http://orionuo.online/Launcher.html) to set everything up and play right away!

### Other Orion Projects

* [Orion.dll](https://github.com/Hotride/OrionDLL) protocol cryptography
* [Orion Launcher](https://github.com/Hotride/OrionLauncher)

--------------

## Building OrionUO

This project requires CMake 3.7 to build. It currently supports Visual Studio 2015, 2017, GCC 7.0 and Clang 6.

### Windows

On Windows, to generate the Visual Studio solution, go inside your cloned OrionUO folder and do:

```bat
md build
cd build
cmake -G "Visual Studio 2017" ..
```

  > This will build a 32bits executable. If you do want 64bits, you can do `cmake -G "Visual Studio 2017 Win64" ..` instead. Note that plugins are still unsupported in the 64bits client.

Or, you can use CMake-GUI to configure and generate the solution.

* If you want to help converting OrionUO to SDL, you can disable `ORION_WISP` option in CMake. This option enables the original client implementation in pure win32 API and is kept as a reference implementation to use during the client conversion to SDL.

### Linux (in progress)

```bash
$ mkdir build
$ cd build
$ cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release
$ ninja OrionUO_unity -j8
$ ./OrionUO/unity/OrionUO
```

  > You'll need a `Client.cuo` and a `uo_debug.cfg` in the working directory. Inside `uo_debug.cfg` you can add a line `CustomPath=/path/to/uo/data`, so Orion will be able to find your original client data files.

--------------

## Contributing

See the project planning [here](https://github.com/Hotride/OrionUO/projects) to find tasks on which you can help.

  > More detailed contribution documentation soon

## Contributors

[Hotride](https://github.com/Hotride/) (Author)

[AimedNuu](https://github.com/AimedNuu)

and [Others](https://github.com/Hotride/OrionUO/graphs/contributors)

--------------
## Support this project, make a donation!

[PayPal](https://www.paypal.me/Hotride)

WebMoney: R644829964694 Z983232789532 E400319624386

Patreon: https://www.patreon.com/hotride

license: MIT

repository: Hotride/OrionUO

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: Hotride/OrionUO


text:
# Examples for Python bindings for FoveAPI

## Setting up python environment

To use the Python bindings for FoveAPI, one needs an instance of python runtime
your system, and have Fove python bindings in the `PYTHONPATH` environment variable.

On Windows, we assume that the samples will be run using `cmd.exe`.
(If you prefer to use a Python IDE, please refer to the manual of the IDE
for propely setting up a `python` executable, `PYTHONPATH`etc.)

Firstly, make sure that a version of `python` is installed and available.
On `cmd.exe`:
```
> python
Python 3.7.5 (default, Oct 14 2019, 23:08:55)
>>> print("Hello, Fove!")
Hello, Fove!
>>> 1 + 1
2
```
Although the Fove Python bindings are supposed to work both for python versions
`2.x` and `3.x`, we strongly recommend the users to use version `3.x`, unless
there are strong reasons not to.

If the Fove SDK has been installed to `C:\path\to\FoveSDK`, python bindings
would be located at `C:\path\to\FoveSDK\python\site-packages\fove`.
So the `PYTHONPATH` environment variable for an instance of `cmd.exe` should be
set as follows:
```
> set PYTHONPATH=C:\path\to\FoveSDK\python\site-packages;%PYTHONPATH%
```
If the `PYTHONPATH` has properly been set, it should be reflected to the
`sys.path` variable on the python runtime:
```
> python
Python 3.7.5 (default, Oct 14 2019, 23:08:55)
>>> import sys
>>> sys.path
[ ..., 'C:\\path\\to\\FoveSDK\\python\\site-packages', ...]
```
(Note that the pass separate `'\'` is escaped as `'\\'` because it is a meta
variable for python strings.)

Then, from the same `cmd.exe`, you should be able to run `sample.py` (provided
that the file is in the current directory; `cd` (change directory) if not):
```
> cd /pass/to/FovePythonSample/
> dir
LICENCE.txt
README.md
sample.py
etc.
> python sample.py
..
```

repository: FoveHMD/FovePythonSample

repo_name: FoveHMD/FovePythonSample


text:
---
layout: post
title: Structure Alignment and Packing in C Programming
date: 2018-07-06 18:32:50 +0700
description: Structure Alignment and Packing in C Programming
img: alignment.jpg
tags: [C]
---
A modern CPU fetches data from memory in multiples of word sized chunks. The word size is dependent on the platform. For 64-bit platform, it would be 8-bytes, meaning that the CPU would fetch data in multiples of 8. For 32-bit platform, the word size is 4-bytes.

The storage for data does not normally start at arbitrary byte addresses in memory. Aligning data in memory to be in multiples of word size helps the read performance.

Every data type has an alignment associated with it which is mandated by the processor architecture rather than the language itself. Aligning data elements allows the processor to fetch data from memory in an efficient manner and thereby improves the performance. The compiler tries to maintain these alignments for data elements to provide optimal performance. The typical alignment requirement for data types on 32-bit and 64-bit platform are shown below

Data Type
32-bit (bytes)
64-bit (bytes)

char
1
1

short
2
2

int
4
4

long
8
8

float
4
4

double
8
8

long long
8
8

long double
4
16

Any pointer
4
8

For structures that generally contain data elements of different types, the compiler tries to maintain the proper alignment of data elements by inserting unused memory between elements. This technique known as Padding. The compiler also aligns the entire structure to its most strictly aligned member. The compiler may also increase the size of structure if necessary, to make it a multiple of the alignment by adding padding at the end of the structure. This is known as Tail Padding.

Let's say we have a 64-bit platform and we create a structure like the one below

struct my_struct {
    char *p;  /* 8 bytes */
    char c;   /* 1 byte */
    long x;   /* 8 bytes */
};

You might think that sizeof(struct my_struct) should be 10 bytes, but it's actually 24 bytes. This is because of self-alignment. Compiler inserted 7 bytes of padding between c and x to keep the structure aligned.

struct my_struct {
    char *p;  /* 8 bytes */
    char c;   /* 1 byte */
    char padding[7];   /* 7 bytes */
    long x;   /* 8 bytes */
};

![Memory representation of struct my_struct members](/assets/img/my_struct.jpg){:class="img-responsive"}

You can minimize the memory wastage by ordering the structure elements such that the widest (largest) element comes first, followed by the second widest, and so on. The following example helps illustrate the effect of ordering of data elements on the size of the structure.

struct s1
{
    char a;  /* 1 byte */
    short a1;   /* 2 bytes */
    char b1;   /* 1 byte */
    float b;   /* 4 bytes */
    int c;   /* 4 bytes */
    char e;   /* 1 byte */
    double f;   /* 8 bytes */
};

The structure above can be aligned and padded to be as follows

struct s1
{
    char a;  /* 1 byte */
    char pad1[1]; /* 1 byte */
    short a1;   /* 2 bytes */
    char b1;   /* 1 byte */
    char pad2[3]; /* 3 bytes */
    float b;   /* 4 bytes */
    int c;   /* 4 bytes */
    char e;   /* 1 byte */
    char pad3[7];  /* 7 bytes */
    double f;   /* 8 bytes */
};

![Memory representation of struct s1](/assets/img/s1.jpg){:class="img-responsive"}

The size of struct s1 after being aligned and padded is 32 bytes.

Now we re-arrange the structure as follows

struct s1
{
    double f;
    float b;
    int c;
    short a1;
    char a,b1,e;
};

After being aligned and padded, the structure will be as follows

struct s1
{
    double f;
    float b;
    int c;
    short a1;
    char a;
    char b1;
    char e;
    char pad[3];
};

![Memory representation of struct s1](/assets/img/re-s1.jpg){:class="img-responsive"}

The size of the struct s1 after re-arranging the elements is 24 bytes. Hence, simply re-arranging the elements during the structure definition may help in avoiding memory wastage.

You can specify the structure members in bits. Structures in C are capable of implementing bit fields. Bit fields allows us to access particular fields stored in an integer. Floating point types are not allowed as bit fields.

For example, we want to store a date with the details of date, month and year.

struct date
{
    short dt;
    short mn;
    short yr;
};

struct date today;

The size of variable today of struct date type is 6 bytes (48 bits). We don't need this much memory. It is enough to have just 23 bits of memory that is 6 bits to store maximum date of 31, 5 bits to store maximum month of 12, and 12 bits to store maximum year of 2047.

The members of struct date are signed types, member dt can hold value from -32 to +31, member mn can hold value from -16 to +15, and member yr can hold value from -2048 to +2047. Actually we don't need the signed value. Hence we can further save the memory by defining the bit fields as unsigned type.

#include<stdio.h>

struct date
{
    unsigned short dt:5;
    unsigned short mn:4;
    unsigned short yr:11;
};

int main()
{
    struct date a;
    a.dt=29;
    a.mn=6;
    a.yr=2018;

    printf("Date: %u/%u/%u\n", a.dt, a.mn, a.yr);
    printf("Memory Taken %lu bytes\n", sizeof(a));

    return 0;
}

Output:

Date: 29/6/2018
Memory Taken 4 bytes

Generally, bytes have address but bits have no address, hence the operator & cannot be used to access the address of bit fields. Trying to access the address of bit fields result compilation error.

#include<stdio.h>

struct date
{
    unsigned short dt:5;
    unsigned short mn:4;
    unsigned short yr:11;
};

int main()
{
    struct date a;

    printf("%u\n%u\n%u\n", &a.dt, &a.mn, &a.yr);

    return 0;
}

Output:

example.c: In function 'main':
example.c:11:2: error: cannot take address of bit-field 'dt'
printf("%u\n%u\n%u",&a.dt,&a.mn,&a.yr);
^
example.c:11:2: error: cannot take address of bit-field 'mn'
example.c:11:2: error: cannot take address of bit-field 'yr'

A bit field can't be defined with the size more than its data size. For example, a bit can't be defined as

unsigned short x:17;

Because under any platform the size of short type is 2 bytes or 16 bits, specifying more than 16 bits is illegal and results compilation error.

You can use pragma directive to specify the new alignment in bytes for structures.

#include<stdio.h>

struct test {
    char  aa;    // size = 1
    int   bb;    // size = 4
    short cc;    // size = 2
    long  dd;    // size = 8
    union {      // size = 16 (_Decimal128 is 16, using union to set the value)
        _Decimal128 ee1;
        long ee2[2];
    } ee;
};
int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of product: %lu\n", sizeof(a));

    return 0;
}

Output:

Address of a.aa:<PHONE_NUMBER>78112
Address of a.bb:<PHONE_NUMBER>78116
Address of a.cc:<PHONE_NUMBER>78120
Address of a.dd:<PHONE_NUMBER>78128
Address of a.ee:<PHONE_NUMBER>78144
Size of product: 48

#pragma pack(n) option (n=1,2,4,8 or 16) allows you to change the alignment of data types within a struct to align to boundaries smaller than its size. It doesn't force alignment of ALL variables, it only changes the alignment of variables larger than the pack setting. For example, if we set #pragma pack to 8, the 16-byte _Decimal128 data type aligns on the 8-byte boundary, but the other data types still use their natural alignment.

#include<stdio.h>
#pragma pack(8)

struct test {
    char  aa;    // size = 1
    int   bb;    // size = 4
    short cc;    // size = 2
    long  dd;    // size = 8
    union {      // size = 16 (_Decimal128 is 16, using union to set the value)
        _Decimal128 ee1;
        long ee2[2];
    } ee;
};
int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test: %lu\n", sizeof(a));

    return 0;
}

Output:

Address of a.aa:<PHONE_NUMBER>74560
Address of a.bb:<PHONE_NUMBER>74564
Address of a.cc:<PHONE_NUMBER>74568
Address of a.dd:<PHONE_NUMBER>74576
Address of a.ee:<PHONE_NUMBER>74584
Size of struct test: 40

How about if we change the pack setting to 4? Now both 8-byte variable dd and 16-byte variable ee have changed alignment.

#include<stdio.h>
#pragma pack(4)

struct test {
    char  aa;    // size = 1
    int   bb;    // size = 4
    short cc;    // size = 2
    long  dd;    // size = 8
    union {      // size = 16 (_Decimal128 is 16, using union to set the value)
        _Decimal128 ee1;
        long ee2[2];
    } ee;
};
int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test: %lu\n", sizeof(a));

    return 0;
}

Output:

Address of a.aa:<PHONE_NUMBER>46800
Address of a.bb:<PHONE_NUMBER>46804
Address of a.cc:<PHONE_NUMBER>46808
Address of a.dd:<PHONE_NUMBER>46812
Address of a.ee:<PHONE_NUMBER>46820
Size of struct test: 36

Continuing on to pack setting of 2

#include<stdio.h>
#pragma pack(2)

struct test {
    char  aa;    // size = 1
    int   bb;    // size = 4
    short cc;    // size = 2
    long  dd;    // size = 8
    union {      // size = 16 (_Decimal128 is 16, using union to set the value)
        _Decimal128 ee1;
        long ee2[2];
    } ee;
};
int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test: %lu\n", sizeof(a));

    return 0;
}

Output:

Address of a.aa:<PHONE_NUMBER>92128
Address of a.bb:<PHONE_NUMBER>92130
Address of a.cc:<PHONE_NUMBER>92134
Address of a.dd:<PHONE_NUMBER>92136
Address of a.ee:<PHONE_NUMBER>92144
Size of struct test: 32

At pack setting of 1, there are no more padding bytes and the struct is as small as possible.

#include<stdio.h>
#pragma pack(1)

struct test {
    char  aa;    // size = 1
    int   bb;    // size = 4
    short cc;    // size = 2
    long  dd;    // size = 8
    union {      // size = 16 (_Decimal128 is 16, using union to set the value)
        _Decimal128 ee1;
        long ee2[2];
    } ee;
};
int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test: %lu\n", sizeof(a));

    return 0;
}

Output:

Address of a.aa:<PHONE_NUMBER>56000
Address of a.bb:<PHONE_NUMBER>56001
Address of a.cc:<PHONE_NUMBER>56005
Address of a.dd:<PHONE_NUMBER>56007
Address of a.ee:<PHONE_NUMBER>56015
Size of product: 31

If we want to set the new alignment only on a certain struct, we can use #pragma pack(push,n) and #pragma pack(pop) where n is 1, 2, 4, 8 or 16.

#include<stdio.h>

struct test1 {
    char  aa;    // size = 1
    int   bb;    // size = 4
    short cc;    // size = 2
    long  dd;    // size = 8
    union {      // size = 16 (_Decimal128 is 16, using union to set the value)
        _Decimal128 ee1;
        long ee2[2];
    } ee;
};

#pragma pack(push,1)
struct test2 {
    char  aa;    // size = 1
    int   bb;    // size = 4
    short cc;    // size = 2
    long  dd;    // size = 8
    union {      // size = 16 (_Decimal128 is 16, using union to set the value)
        _Decimal128 ee1;
        long ee2[2];
    } ee;
};
#pragma pack(pop)

int main()
{
    struct test1 a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    struct test2 b;
    b.aa=(char)0x44;
    b.bb=0x55555555;
    b.cc=0x6666;
    b.dd=0x7777777777777777;
    b.ee.ee2[0]=0x8888888888888888;
    b.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test1: %lu\n", sizeof(a));

    printf("Address of b.aa: %lu\n", &b.aa);
    printf("Address of b.bb: %lu\n", &b.bb);
    printf("Address of b.cc: %lu\n", &b.cc);
    printf("Address of b.dd: %lu\n", &b.dd);
    printf("Address of b.ee: %lu\n", &b.ee);
    printf("Size of struct test2: %lu\n", sizeof(b));

    return 0;
}

Output:

Address of a.aa:<PHONE_NUMBER>97760
Address of a.bb:<PHONE_NUMBER>97764
Address of a.cc:<PHONE_NUMBER>97768
Address of a.dd:<PHONE_NUMBER>97776
Address of a.ee:<PHONE_NUMBER>97792
Size of struct test1: 48
Address of b.aa:<PHONE_NUMBER>97728
Address of b.bb:<PHONE_NUMBER>97729
Address of b.cc:<PHONE_NUMBER>97733
Address of b.dd:<PHONE_NUMBER>97735
Address of b.ee:<PHONE_NUMBER>97743
Size of struct test2: 31

You may also use attributes to specify a new alignment.
* __attribute__((aligned(n))) , this attribute sets the minimum alignment of the specified variables to a specific number of bytes. n must be a the positive of 2 or NIL. NIL can be specified as either __attribute__((aligned())) or __attribute__((aligned)), the compiler automatically sets the alignment for the declared variable or field to the largest alignment
* __attribute__((packed)) , this attribute specifies that a variable or structure field should have the smallest possible alignment -- one byte for a variable and one bit for a field

#include<stdio.h>

struct test {
    char  aa;    // size = 1
    int   bb;    // size = 4
    short cc;    // size = 2
    long  dd;    // size = 8
    union {      // size = 16 (_Decimal128 is 16, using union to set the value)
        _Decimal128 ee1;
        long ee2[2];
    } ee;
} __attribute__ ((aligned (8)));

int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test: %lu\n", sizeof(a));

    return 0;
}

Address of a.aa:<PHONE_NUMBER>59040
Address of a.bb:<PHONE_NUMBER>59044
Address of a.cc:<PHONE_NUMBER>59048
Address of a.dd:<PHONE_NUMBER>59056
Address of a.ee:<PHONE_NUMBER>59072
Size of struct test: 48

![Memory representation of struct test __attribute__((aligned(8)))](/assets/img/align1.jpg){:class="img-responsive"}

The structure declaration above forces the compiler to ensure that each variable of type struct test is aligned on a 8-byte boundary and the size of variables of type struct test should be a multiple of 8 bytes.

#include<stdio.h>

struct test {
    char  aa;
    int   bb;
    short cc __attribute__ ((aligned (32)));
    long  dd;
    union {
        _Decimal128 ee1;
        long ee2[2];
    } ee __attribute__ ((aligned (8)));
} __attribute__ ((aligned (64)));

int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test: %lu\n", sizeof(a));

    return 0;
}

Address of a.aa:<PHONE_NUMBER>21056
Address of a.bb:<PHONE_NUMBER>21060
Address of a.cc:<PHONE_NUMBER>21088
Address of a.dd:<PHONE_NUMBER>21096
Address of a.ee:<PHONE_NUMBER>21104
Size of struct test: 64

![Memory representation of struct test __attribute__((aligned(64)))](/assets/img/align2.jpg){:class="img-responsive"}

The structure declaration above ensure that each variable of type struct test is aligned on a 8-byte boundary and the size of variables of type struct test should be a multiple of 64 bytes.

Having attribute __attribute__ ((aligned (32))) on variable cc makes the variable aa and bb aligned on a 32-byte boundary and the total size of those variables should be a multiple of 32 bytes.

Having attribute __attribute__ ((aligned (8))) on union ee makes the variable aa, bb, cc, and dd aligned on a 8-byte boundary and the total size of those variables should be a multiple of 8 bytes.

#include<stdio.h>

struct test {
    char  aa;
    int   bb;
    short cc;
    long  dd;
    union {
        _Decimal128 ee1;
        long ee2[2];
    } ee;
} __attribute__ ((packed, aligned (64)));

int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test: %lu\n", sizeof(a));

    return 0;
}

Address of a.aa:<PHONE_NUMBER>59200
Address of a.bb:<PHONE_NUMBER>59201
Address of a.cc:<PHONE_NUMBER>59205
Address of a.dd:<PHONE_NUMBER>59207
Address of a.ee:<PHONE_NUMBER>59215
Size of struct test: 64

![Memory representation of struct test __attribute__((packed, aligned(64)))](/assets/img/align3.jpg){:class="img-responsive"}

Having attribute __attribute__ ((packed)) on struct test makes its each member aligned on a 1-byte boundary.

Having attribute __attribute__ ((aligned(64))) on struct test makes the size of variables of type struct test should be a multiple of 64 bytes.

#include<stdio.h>

struct test {
    char  aa;
    int   bb;
    short cc __attribute__ ((aligned (32)));
    long  dd;
    union {
        _Decimal128 ee1;
        long ee2[2];
    } ee __attribute__ ((aligned (8)));
} __attribute__ ((packed, aligned (64)));

int main()
{
    struct test a;
    a.aa=(char)0x44;
    a.bb=0x55555555;
    a.cc=0x6666;
    a.dd=0x7777777777777777;
    a.ee.ee2[0]=0x8888888888888888;
    a.ee.ee2[1]=0x8888888888888888;

    printf("Address of a.aa: %lu\n", &a.aa);
    printf("Address of a.bb: %lu\n", &a.bb);
    printf("Address of a.cc: %lu\n", &a.cc);
    printf("Address of a.dd: %lu\n", &a.dd);
    printf("Address of a.ee: %lu\n", &a.ee);
    printf("Size of struct test: %lu\n", sizeof(a));

    return 0;
}

Address of a.aa:<PHONE_NUMBER>27424
Address of a.bb:<PHONE_NUMBER>27425
Address of a.cc:<PHONE_NUMBER>27456
Address of a.dd:<PHONE_NUMBER>27458
Address of a.ee:<PHONE_NUMBER>27472
Size of struct test: 64

![Memory representation of struct test __attribute__((packed, aligned(64)))](/assets/img/align4.jpg){:class="img-responsive"}

Having attribute __attribute__ ((packed)) on struct test makes its each member aligned on a 1-byte boundary.

Having attribute __attribute__ ((aligned(64))) on struct test makes the size of variables of type struct test should be a multiple of 64 bytes.

Having attribute __attribute__ ((aligned (32))) on variable cc makes the total size of variable aa and bb should be a multiple of 32 bytes.

Having attribute __attribute__ ((aligned (8))) on union ee makes the total size of variable aa, bb, cc, and dd should be a multiple of 8 bytes.

extension: markdown


text:
## Aggregation By MSAMD

```
/data-browser-api/view/msamd/34980?actions_taken=5,6&races=Asian,Joint,White
```

## Aggregation By State

```
/data-browser-api/view/state/CA?actions_taken=5&races=Asian,Joint,White
```

## Aggregation By State and MSAMD

```
/data-browser-api/view/state/CA/msamd/34980?actions_taken=5,6&races=Asian,Joint,White
```

## CSV By MSAMD

```
/data-browser-api/view/msamd/34980/csv?actions_taken=5,6&races=Asian,Joint,White
```

## CSV By State

```
/data-browser-api/view/state/CA/csv?actions_taken=5&races=Asian,Joint,White
```

## CSV By State and MSAMD

```
/data-browser-api/view/state/CA/msamd/34980/csv??actions_taken=5,6&races=Asian,Joint,White
```

## Aggregation By Nationwide

```
/data-browser-api/view/nationwide?actions_taken=5,6&races=Asian,Joint,White
```

## CSV By Nationwide

```
/data-browser-api/view/nationwide/csv?actions_taken=5,6&races=asian1,Joint,White
```

gha_license_id: NOASSERTION


text:
If you're an hardware Audio manufacturer and you've developed a brand new i2s DAC, making it compatible with  Volumio is very easy.

#### Prerequisites

* The kernel driver must be already present in the Kernel that Volumio uses. If that's not true, please [contact us](https://volumio.org/contact/)

#### The dacs.json file

Volumio stores all compatibility data for i2s dac in a single file: the  [dacs.json file](https://github.com/volumio/Volumio2/blob/master/app/plugins/system_controller/i2s_dacs/dacs.json),
here's a brief extract of it :

```json
{ "devices":[
  {"name":"Raspberry PI","data":[
    {"id":"aoide-kazoo-dac","name":"Aoide Kazoo DAC","overlay":"aoide-kazoo-dac","alsanum":"1","mixer":"Digital","modules":"","script":"","needsreboot":"yes"},
    {"id":"generic-dac","name":"Generic I2S DAC","overlay":"hifiberry-dac","alsanum":"1","mixer":"Digital","modules":"","script":"","needsreboot":"yes"},
    {"id":"hifiberry-dacplus","name":"Hifiberry DAC Plus","alsaname":"Hifiberry DAC","overlay":"hifiberry-dacplus","alsanum":"1","mixer":"Digital","modules":"","script":"","eeprom_name":"HiFiBerry DAC+","i2c_address":"4d","needsreboot":"no"},
    {"id":"hifiberry-dac","name":"Hifiberry DAC","overlay":"hifiberry-dac","alsanum":"1","mixer":"Digital","modules":"","script":"","needsreboot":"yes"},
    {"id":"hifiberry-amp","name":"Hifiberry Amp","overlay":"hifiberry-amp","alsanum":"1","mixer":"Master","modules":"","script":"","needsreboot":"yes"},
    {"id":"hifiberry-digi","name":"Hifiberry DIGI","overlay":"hifiberry-digi","alsanum":"1","mixer":"","modules":"","script":"","needsreboot":"yes"},
    {"id":"iqaudio-dacplus","name":"IQaudIO DAC Plus","overlay":"iqaudio-dacplus,auto_mute_amp","alsanum":"1","mixer":"Digital","modules":"","script":"iqamp-unmute.sh","i2c_address":"4c","needsreboot":"no"},
    {"id":"justboom-dac","name":"JustBoom DAC Boards","overlay":"justboom-dac","alsanum":"1","mixer":"Digital","modules":"","script":"","eeprom_name":["JustBoom DAC HAT","JustBoom DAC HAT V1","JustBoom DAC HAT V 10"],"needsreboot":"no"},
    {"id":"iqaudio-amp","name":"IQaudIO Pi-DigiAMP+","overlay":"iqaudio-dacplus,auto_mute_amp","alsanum":"1","mixer":"Digital","modules":"","script":"iqamp-unmute.sh","needsreboot":"yes"},

  ]},
  {"name":"Odroid C1+","data":[
    {"id":"odroid-hifi-shield","name":"HiFi Shield","overlay":"","alsanum":"2","mixer":"","modules":"","script":""}
  ]}
  ]}
```

#### What you need to do

Basically edit the dac.json appropriately and send us a pull request. Here's what you need to change:

* Add your DAC under the specific device it's for, like Raspberry PI or Odroid
* id: An unique identifier. Lowercase and without spaces, possibly use the dt-overlay as id.
* name: the name that will represent your DAC
* overlay: mandatory for raspberry PI. The [DTOverlay parameter](https://www.raspberrypi.org/documentation/configuration/device-tree.md),  used to enable the DAC. If more than one, comma separate them.
* alsaname: if you know how your DAC is named by alsa, its a plus to have it declared here
* alsanum: leave it to 1
* mixer: if your DAC has an hardware mixer, indicate it here, so it will be automatically configured
* script: if you need a script to be launched on start, write here the name and place the script inside the  [scripts folder](https://github.com/volumio/Volumio2/tree/master/app/plugins/system_controller/i2s_dacs/scripts)
* eeprom_name:for Raspberry PI only. Volumio can automatically detect your DAC and configure it without user intervention. The auto-detection method works best by reading the eeprom that every HAT should have. Specifically, we look for the content of `/proc/device-tree/hat/product` . So indicate here such content. Arrays are also accepted, in case this varies over time. This will look like `"eeprom_name":["JustBoom DAC HAT","JustBoom DAC HAT V1","JustBoom DAC HAT V 10"]`
* i2c_address: for Raspberry PI only. As a fallback, we can detect also a specific DAC via its i2c address. Indicate it here. This is a fallback mechanism in case eeprom reading won't work. IMPORTANT: Many dacs can have the same i2c address so use it only if there isn't  already another dac with the same address.
* needs_reboot: on Raspberry PI we can enable some DACs without rebooting, by appying the DTPARAM in userspace. This doesn't work with all dacs. So please try first with this set to no. If that works and you can hear sound, fine. If that does not happen it means that your DAC is not capable of being activated without rebooting, and set this to yes.


text:
# DPC++ trace utility

[![CI pipeline](https://github.com/alexbatashev/dpcpp_trace/actions/workflows/ci.yaml/badge.svg?event=schedule)](https://github.com/alexbatashev/dpcpp_trace/actions/workflows/ci.yaml?query=event%3Aschedule)

**!!!WARNING!!! UNDER CONSTRUCTION**

dpcpp_trace is a simple utility that facilitates debugging of both oneAPI DPC++
runtime and user applications that use it.

**Features**

- Record PI call traces
- Collect performance statistics
- Replay responses from plugins

## Getting pre-built binaries

Pre-built binaries are published to for every nightly release [here](https://github.com/alexbatashev/dpcpp_trace/actions/workflows/ci.yaml?query=event%3Aschedule).

## Build instructions

**Prerequisites:**

1. A modern C++20 capable compiler, like GCC 10.3
2. git
3. [conan](https://conan.io)

**Build instructions:**

1. Download and build DPC++: https://intel.github.io/llvm-docs/GetStartedGuide.html#build-dpc-toolchain

2. Download and build dpcpp_trace:

```bash
git clone --recursive https://github.com/alexbatashev/dpcpp_trace.git
cd dpcpp_trace
mkdir build && cd build
conan install -s compiler.libcxx=libstdc++11 ..
cmake -DINTEL_LLVM_SOURCE_PATH=/path/to/intel/llvm/src/dir -DINTEL_LLVM_BINARY_PATH=/path/to/intel/llvm/build/dir -GNinja ..
ninja
```

**Available options:**

- `DPCPP_TRACE_LINK_STATICALLY` - use static `libstdc++`. This is used in CI to
  produce portable binaries.

## Basic usage

### Recording traces
```bash
dpcpp_trace record -o /path/to/output/dir ./myapp -- --app-arg1 --app-arg2=foo
```

### Printing traces
Simple mode (similar to `SYCL_PI_TRACE=-1`):

```bash
dpcpp_trace print /path/to/output/dir
```

Group per thread:

```bash
dpcpp_trace print /path/to/output/dir --group thread
```

Verbose mode:

```bash
dpcpp_trace print /path/to/output/dir --verbose
```

Performance summary:

```bash
dpcpp_trace print /path/to/output/dir --perf
```

### Replaying traces
```bash
dpcpp_trace replay -o /path/to/output/dir ./myapp -- --app-arg1 --app-arg2=foo
```

branch_name: refs/heads/main


text:
folders for extensions are
```
/usr/share/gnome-shell/extensions
~/.local/share/gnome-shell/extensions
```

### user themes
```
sudo apt install gnome-shell-extensions
```

### install
you can also install extensions using:
```
https://extensions.gnome.org
```

following extensions are used

* Alternatetab
* Hide activities button
* Hide dash x
* Hide top bar
* Dash to panel
* Unblanck screen saver
* More columns in applications view
* Remove app menu
* Remove dropdown arrows
* Remove rounded corners
* Hide workspace thumbnails
* Appfolders Management extension
* CustomCorner

### uninstall unusable extentions
```
cd ~/.local/share/gnome-shell/extensions && sudo rm -rf<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>desktop-icons@csoriano
```

### uninstall ubuntu dock
```
sudo apt remove gnome-shell-extension-ubuntu-dock
```

!!! info "restart gnome shell after removing extensions"

repository: aasmpro/dotfiles

repo_name: aasmpro/dotfiles


text:
# integrationhelper

_A set of helpers for integrations._

## Install integrationhelper

```bash
python3 -m pip install -U integrationhelper
```

repository: ludeeus/integrationhelper

repo_name: ludeeus/integrationhelper


text:
---
templateKey: project-post
title: Prism
course: Playful Interaction
year: 2019
creators: 'Anouk Govers, Kim Jankowski, Ye-Ji Kim, Duo-Wei Yang'
yearLevel: 'Second'
tags:
  - play
image: /images/uploads/2019/pi-prism-0.jpg
---

![](/images/uploads/2019/pi-prism-4.jpg)

An interactive toy that simulates visual experience of an enclosed space using light and mirrors.

<figure>
<video controls src="https://api.kaltura.nordu.net/p/326/sp/0/playManifest/entryId/0_hk2imwek/format/url/flavorParamId/0/video.mp4"></video>
</figure>

Players glimpse a hidden psychedelic world through the periscope of a small screen. They are able to manipulate the world by way of movement sensors in the handles of the whole object.

![](/images/uploads/2019/pi-prism-3.jpg)

![](/images/uploads/2019/pi-prism-1.jpg)

repository: motform/arkiv

repo_name: motform/arkiv


text:
# Quick Start

## Installation

1. Install Anaconda by following the instruction on [anaconda documentation](https://docs.anaconda.com/anaconda/install/).

2. Create an anaconda virtual environment and install dependencies.

    ```
    conda create -n py3-mink python=3.7 anaconda
    conda activate py3-mink
    conda install openblas numpy
    conda install -c bioconda google-sparsehash
    conda install pytorch torchvision -c pytorch  # Use the correct cudatoolkit version
    ```

3. Once you setup the environment, download the repository and install the MinkowskiEngine.

    ```
    conda activate py3-mink
    git clone https://github.com/StanfordVL/MinkowskiEngine.git
    cd MinkowskiEngine
    python setup.py install
    ```

## Running a segmentation network

Go to the top directory of the MinkowskiEngine and run the following.

```
cd /path/to/MinkowskiEngine
python examples/indoor.py
```

When you run the above example, you will download pretrained-weights of a
Minkowski network and will see the semantic segmentation results of a hotel
room.

## CPU only compilation

1. Uncomment line 8 of the Makefile to enable the flag, `CPU_ONLY`.
2. Uncomment line 66 of the `setup.py` to enable the flag, `CPU_ONLY`.
3. `python setup.py install`

repository: theNded/MinkowskiEngine

repo_name: theNded/MinkowskiEngine


text:
---
id: restapi_qs
title: REST API Quickstart
sidebar_label: Quickstart
hide_title: false
description: Overview of the PAN-OS API
keywords:
  - pan-os
  - panos
  - api
  - rest
  - quickstart
image: /img/panos_apis.svg
---

:::note
The following guide will walk you through sending API requests to the PAN-OS® REST API using cURL, although you may optionally use another API tool such as Postman, Insomnia or RESTClient.
:::

## Enable API Access

1. Select an Admin Role profile.

   - Go to Device -> Admin Roles and select or create an admin role.

2. Select features available to the admin role.

   - Select the XML API tab.
   - Enable or disable XML API features from the list, such as Report, Log, and Configuration.
   - Select OK to confirm your change.

3. Assign the admin role to an administrator account.

   _Consult the [official product documentation](https://docs.paloaltonetworks.com/pan-os/10-1/pan-os-panorama-api/get-started-with-the-pan-os-xml-api/get-your-api-key.html) for more details._

 Make a `GET` or `POST` request to the firewall’s hostname or IP address using the administrative credentials and the `type=keygen` URL query argument.

   _Be sure to replace `<firewall>` `<username>` and `<password>` with actual values._

```shell-session
curl -k -X GET 'https://<firewall>/api/?type=keygen&user=<username>&password=<password>'
```

_or_

```shell-session
curl -k -X POST 'https://<firewall>/api/?type=keygen&user=<username>&password=<password>'
```

A successful API call returns `status="success"` along with the API key within the `key` element:

```xml
<response status="success">
  <result>
    <key>gJlQWE56987nBxIqyfa62sZeRtYuIo2BgzEA9UOnlZBhU</key>
  </result>
</response>
```

## Access the PAN-OS® REST API

The PAN-OS® REST API URL format includes a base path and endpoint:

```console
https://<IP address or FQDN>/restapi/<PAN-OS version>/<resource endpoint>
```

Available resource endpoints:

```console

# OBJECTS

/restapi/9.0/Objects/Addresses
/restapi/9.0/Objects/AddressGroups
/restapi/9.0/Objects/Regions
/restapi/9.0/Objects/Applications
/restapi/9.0/Objects/ApplicationGroups
/restapi/9.0/Objects/ApplicationFilters
/restapi/9.0/Objects/Services
/restapi/9.0/Objects/ServiceGroups
/restapi/9.0/Objects/Tags
/restapi/9.0/Objects/GlobalProtectHIPObjects
/restapi/9.0/Objects/GlobalProtectHIPProfiles
/restapi/9.0/Objects/ExternalDynamicLists
/restapi/9.0/Objects/CustomDataPatterns
/restapi/9.0/Objects/CustomSpywareSignatures
/restapi/9.0/Objects/CustomVulnerabilitySignatures
/restapi/9.0/Objects/CustomURLCategories
/restapi/9.0/Objects/AntivirusSecurityProfiles
/restapi/9.0/Objects/AntiSpywareSecurityProfiles
/restapi/9.0/Objects/VulnerabilityProtectionSecurityProfiles
/restapi/9.0/Objects/URLFilteringSecurityProfiles
/restapi/9.0/Objects/FileBlockingSecurityProfiles
/restapi/9.0/Objects/WildFireAnalysisSecurityProfiles
/restapi/9.0/Objects/DataFilteringSecurityProfiles
/restapi/9.0/Objects/DoSProtectionSecurityProfiles
/restapi/9.0/Objects/SecurityProfileGroups
/restapi/9.0/Objects/LogForwardingProfiles
/restapi/9.0/Objects/AuthenticationEnforcements
/restapi/9.0/Objects/DecryptionProfiles
/restapi/9.0/Objects/DecryptionForwardingProfiles
/restapi/9.0/Objects/Schedules

# POLICIES

/restapi/9.0/Policies/SecurityRules
/restapi/9.0/Policies/NATRules
/restapi/9.0/Policies/QoSRules
/restapi/9.0/Policies/PolicyBasedForwardingRules
/restapi/9.0/Policies/DecryptionRules
/restapi/9.0/Policies/TunnelInspectionRules
/restapi/9.0/Policies/ApplicationOverrideRules
/restapi/9.0/Policies/AuthenticationRules
/restapi/9.0/Policies/DoSRules
```

gha_language: JavaScript


text:
# Strapi v3.0.0-alpha.x

If you are reaching this page it's because you are trying to access the **Strapi v3.0.0-alpha.x** documentation.

This version of Strapi is no longer maintained and is deprecated.

We suggest you move to the [**latest version of Strapi**](../).

repository: vincentdoerig/strapi

repo_name: vincentdoerig/strapi


text:
# Security Policy

## Supported Versions

Only the latest commit on the `master` branch is fully supported. For all other commits or tags, please use the code at your own risk.

## Reporting a Vulnerability

To report a vulnerability, please do **not** use issues. Instead, please open a request in security advisories under security to help keep to vulnerability private and others safe. Please expect to wait up to one week before your request is reviewed, or within days if the request is high or critical. If the security vulnerability is not directly related to the code in this repository and instead is related to a dependency, it is declined. Otherwise, it is considered.

gha_language: HTML


text:
# URL Access Frequency

### Data set (Apache log from http://www.almhuette-raith.at/apache-log/access.log)
Can be found [Here](https://drive.google.com/open?id=1pOZBMfIGk6ok5d4R65ORsYQRVX0CuqS1)

### Key: value chosen for MapReduce

* URL: 1

### Usage

Each folder contains the implementation details and instructions


text:
goulash/twikutil
================

[![GoDoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/goulash/twikutil)
[![License: MIT](http://img.shields.io/badge/license-MIT-red.svg?style=flat-square)](http://opensource.org/licenses/MIT)

Package twikutil provides several functions to make working with the
(Twik)[https://github.com/go-twik/twik] language easier.

It also contains a subpackage key, which helps set variables prior to the
execution of a twik script, as well as read them afterwards.

The implementation is not yet well documented, and also not quite finished. :-)
For more information, see the [documentation](http://godoc.org/github.com/goulash/twikutil)! :-)

repository: goulash/twikutil

repo_name: goulash/twikutil


text:
# Field

The combination of a field name and data type, with optional metadata. Fields are used to describe the individual constituents of a nested DataType or a Schema.

## Members

### name : String (read only)

The name of this field.

### type : Type (read only)

The type of this field.

### nullable : Boolean (read only)

Whether this field can contain `null` values, in addition to values of `Type` (this creates an extra null value map).

### metadata : Object | null (read only)

A field's metadata is represented by a map which holds arbitrary key-value pairs. Returns `null` if no metadata has been set.

### typeId : ?

TBD?

### indices : ?

TBD? Used if data type is a dictionary.

## Methods

### constructor(name : String, nullable?: Boolean, metadata?: Object)

Creates an instance of `Field` with parameters initialized as follows:

* `name` - Name of the column
* `nullable`=`false` - Whether a null-array is maintained.
* `metadata`=`null` - Map of metadata


text:
# Laravel Quotes Api

This is a small api for testing front end apps. It comes with 5 users and JWT auth.

## Installation notes

Edit env to your liking.
Run Composer install, php artisan migrate and  php artisan db:seed.

## Frontend
comming soon.... maybe later today.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

repository: sugarfixx/api

gha_language: PHP

repo_name: sugarfixx/api


text:
# PACoPlayer

This is a software preservation project with a goal to read and play back video and animation files created with the PICS Animation Compiler (PACo), created by the Company of Science and Art (CoSA).

## Motivations for this project

My personal motivation for this project is to further preserve and explore the 1993 video game title [Iron Helix](https://en.wikipedia.org/wiki/Iron_Helix). Iron Helix was an early CD-rom game that heavily relied on pre-rendered graphics. This allowed the on-rails player navigation to have surprisingly detailed graphics and level design for a game of its era.

All of these pre-rendered graphics were encoded using the PACo Producer software. This can be confirmed in the Iron Helix manual, where they list out all of the software used during the creation of the game.

The PACo project can also be seen as a pre-cursor to both MacroMedia (later Adobe) Shockwave and Flash, as well as Adobe After Effects. When CoSA disbanded, some of the team left for MacroMedia, and the rest for Adobe.

And lastly, reverse engineering is just plain fun.

repository: GregDomzalski/PACoPlayer

repo_name: GregDomzalski/PACoPlayer


text:
# Trichoramalina melanothrix (Laurer) Rundel & Bowler SPECIES

#### Status
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bryologist 77(2): 194 (1974)

#### Original name
Ramalina melanothrix Laurer

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# GEECL waits for approvals for shale gas exploration

Published at: **2019-11-07T00:00:00+00:00**

Author: **PTI**

Original: [Moneycontrol](https://www.moneycontrol.com/news/business/geecl-waits-for-approvals-for-shale-gas-exploration-4616891.html)

Leading coal-bed methane gas producer Great Eastern Energy Corporation Limited (GEECL) on November 7 said it is still waiting for approvals to begin shale gas exploration in West Bengal's Ranigunj.
The company had announced an investment of  $2 billion over the next 10 years in shale gas extraction project.
"GEECL is in the process of obtaining final approvals and expects to commence initial shale gas exploration work by drilling core wells soon," the company said.

        Close

GEECL's CBM block may hold as much as 6.63 trillion cubic feet (Tcf) of shale gas resources, of which about 1.7 Tcf can be recovered, company officials said.
Speaking on the coal-bed methane, the officials said all the pumps were replaced by June 2019, leading to a 17 percent increase in average production to 16.60 mmscfd in the second half of October 2019.
According to GEECL officials, the company has approached the West Bengal government to amend its existing mining leases (MLs), so that it can start production of shale gas from its blocks in the Raniganj area.
Another company, Essar had also shown interest for coal-bed methane in the state and was keen in shale gas exploration.
GAIL's upcoming "Jagdishpur-Haldia and Bokaro-Dhamra Pipeline" is expected to be operational by December 2020 and this will provide the access to the huge markets of Kolkata and districts in West Bengal, the officials said..Special Thursday Expiry on 10th 7th NovEarly Closure to The Great Diwali Discount. Last Chance to get Moneycontrol PRO for a year @ Rs. 289/- only Coupon code: DIWALI

license: Unlicense

repository: dsadlollioygjmzvcxv/tdc-exported

repo_name: dsadlollioygjmzvcxv/tdc-exported


text:
**Deprecated, please use [InteractiveIcon](#/Icons?id=section-interactive-icons) instead.**

### Making interactive icons

Use the `onClick` prop to create an accessible interactive icon.

Interactive icons will have a minimum click/tap area of about 32px, or 8-10mm, to ensure that they can be touched easily on
mobile devices. Take care not to place other elements too close to interactive icons, as the touch area could overlap.

```jsx
<StandaloneIcon
  symbol="spyglass"
  size={24}
  a11yText="Search this site."
  onClick={() => console.log('searching...')}
/>
```

repository: telus/tds-core

repo_name: telus/tds-core


text:
---
layout: post
title:  "Assignment 3"
date:   2016-10-27 19:45:31 +0530
categories: ["design", "class", "posts"]
author: "Kelsey Hammer"
---

 Written Work

The written work that I included with this assignment is a brief summary about me that
I wrote for a class earlier this semester. It includes my background, current course of study,
and passions.

Document Conversion

There were two ways to get my work into multiple formats that I used throughout the process.
The first way was by running a `pandoc` argument on the command line eg. `pandoc -S -o kelhammer.odt kelhammer.md`.
The other way to covert documents was to run them through my script that used similar flags and argument structure.
I had the system walk the user through converting their file into each file type.

 File List

HTML

ODT

MD

PDF

 Script

Script for Assignment 3

 Editor Link

Editor Link for C9

 Reflections

Greetings Hauser! Is it cool if I call you Hauser? Well I'm commiting to that nickname. That was a poor attempt at
a coding joke (git commit nickname). Everyone knows the best jokes are the ones you have to explain `sarcasm` Yikes. It's been a busy week and the amount of time I've slept would not be
recommended by health professionals. That being said, I think I actually accomplished this assignment. That's going to be a
a really embarrassing sentence if it turns out I pulled a total fail, but I really do feel I had a lightbulb moment during this assignment!

In class when we learning the `pandoc` stuff I felt like I really understood that, but when we got to scripts I knew we were in trouble, and
by we I mean me (the lost one) and Ellen (the one to save the day). Bless Ellen who really helped me on this assignment.
I have history with script writing in another course and it did not go well. I can't even tell you what language we were writing in because I've literally
blocked it from my mind. In ILNS 161 when we talked about scripts, I could just tell it was not sinking into my brain (again), but I thought maybe by
playing around I could learn it. That did not go so well. Ellen was able to show me what she was working with and explain some of the logic that got her
started. Once I started at the same place, I started building and things started to work! `collaboration` We ended up creating very differnt scripts but sharing some of the
base logic really helped me get started. Thanks Ellen! Later I was able to help her with images too so the favor was returned!

I feel overall that I'm getting better at problem solving, whether its looking online or just testing things out. I had trouble getting my table to work
but I learned a lot of things and gained some new resources while I was problem solving. I also had a couple of ticks to work out getting everything into this
blog post but I worked it out with some time and exploring. My only wish for this assignmentwas that it had fallen on a
different week so I could have built more into my script. I would have loved to work with some `if` statements and make my script more interactive
with the user, but that just wasn't in the cards this week. Part of that is time constraints and part of it is bravery with coding.

Anyways, off to do more work!

Hammer


text:
# sample-game
+ A simple 2-levels Android game written in Java using the <b>libGDX</b>.

+ Tap to jump, collect berries and avoid wolves!

# Preview
![20200618_150500](https://user-images.githubusercontent.com/58771510/85030719-b4c01a80-b175-11ea-909d-621dc0f9eb8a.gif)

![20200618_150315](https://user-images.githubusercontent.com/58771510/85030692-ad990c80-b175-11ea-8fc3-c6e0dc93341a.gif)

# Resources used:
Little Red Riding Hood Sprite Character (Licensor's Author: PrimaDev)

## License

[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.html)

```
Copyright 2019 Ersiver

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

repository: ersiver/GameApp

repo_name: ersiver/GameApp