text:
# Rendering 18

Realtime GI, Probe Volumes, LOD Groups

- Support Realtime Global Illumination.
- Animate emissive light contribution to GI.
- Work with light probe proxy volumes.
- Use LOD groups in combination with GI.
- Cross-fade between LOD levels.

This is part 18 of a tutorial series about rendering. After wrapping up baked global illumination in [part 17](https://catlikecoding.com/unity/tutorials/rendering/part-17/), we move on to supporting realtime GI. After that, we'll also support light probe proxy volumes and cross-fading LOD groups.

From now on, this tutorial series is made with Unity 2017.1.0f3.  It won't work with older versions, because we'll end up using a new  shader function.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/tutorial-image.jpg) 					A combination of static LOD groups and realtime GI.

## Realtime Global Illumination

Baking light works very well for static geometry, and also  pretty well for dynamic geometry thanks to light probes. However, it  cannot deal with dynamic lights. Lights in mixed mode can get away with  some realtime adjustments, but too much makes it obvious that the baked  indirect light doesn't change. So when you have an outdoor scene, the  sun has to be unchanging. It cannot travel across the sky like it does  in real life, as it requires gradually changing GI. So the scene has to  be frozen in time.

To make indirect lighting work with something like a moving sun,  Unity uses the Enlighten system to calculate realtime global  illumination. It works like baked indirect lighting, except that the  lightmaps and probes are computed at runtime.

Figuring out indirect light requires knowledge of how light  could bounce between static surfaces. The question is which surfaces are  potentially affected by which other surfaces, and to what degree.  Figuring out these relationships is a lot of work and cannot be done in  realtime. So this data is processed by the editor and stored for use at  runtime. Enlighten then uses it to compute the realtime lightmaps and  probe data. Even then, it's only feasible with low resolution lightmaps.

### Enabling Realtime GI

Realtime global illumination can be enabled independent of  baked lighting. You can have none, one, or both active at the same time.  It is enabled via the checkbox in the *Realtime Lighting* section of the *Lighting* window.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/realtime-gi-enabled.png) 							Both realtime and baked GI enabled.

To see realtime GI in action, set the mode of the main light in  our test scene to realtime. As we have no other lights, this  effectively turns off baked lighting, even when it is enabled.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/realtime-light.png) 							Realtime main light.

Make sure that all objects in the scene use our white material.  Like last time, the spheres are all dynamic and everything else is  static geometry.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/realtime-gi-dynamic-only.png) 							Only dynamic objects receive realtime GI.

It turns out that only the dynamic objects benefit from  realtime GI. The static objects have become darker. That's because the  light probes automatically incorporated the realtime GI. Static objects  have to sample the realtime lightmaps, which are not the same as the  baked lightmaps. Our shader doesn't do this yet.

### Baking Realtime GI

Unity already generates the realtime lightmaps while in edit  mode, so you can always see the realtime GI contribution. These maps are  not retained when switching between edit and play mode, but they end up  the same. You can inspect the realtime lightmaps via the *Object maps* tab of the *Lighting* window, with a lightmap-static object selected. Choose the *Realtime Intensity* visualization to see the realtime lightmap data.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/realtime-intensity.png) 							Realtime lightmap, with roof selected.

Although realtime lightmaps are already baked, and they might  appear correct, our meta pass actually uses the wrong coordinates.  Realtime GI has its own lightmap coordinates, which can end up being  different than those for static lightmaps. Unity generates these  coordinates automatically, based on the lightmap and object settings.  They are stored in the third mesh UV channel. So add this data to `**VertexData**` in *My Lightmapping*.

```
struct VertexData {
	float4 vertex : POSITION;
	float2 uv : TEXCOORD0;
	float2 uv1 : TEXCOORD1;
	float2 uv2 : TEXCOORD2;
};
```

Now `MyLightmappingVertexProgram` has  to use either the second or third UV set, together with either the  static or dynamic lightmap's scale and offset. We can rely on the `UnityMetaVertexPosition` function to use the right data.

```
Interpolators MyLightmappingVertexProgram (VertexData v) {
	Interpolators i;
//	v.vertex.xy = v.uv1 * unity_LightmapST.xy + unity_LightmapST.zw;
//	v.vertex.z = v.vertex.z > 0 ? 0.0001 : 0;
//
//	i.pos = UnityObjectToClipPos(v.vertex);
	i.pos = UnityMetaVertexPosition(
		v.vertex, v.uv1, v.uv2, unity_LightmapST, unity_DynamicLightmapST
	);

	i.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
	i.uv.zw = TRANSFORM_TEX(v.uv, _DetailTex);
	return i;
}
```

 							What does `UnityMetaVertexPosition` look like?

Note that the meta pass is used for both baked and realtime  lightmapping. So when realtime GI is used, it will also be included in  builds.

### Sampling Realtime Lightmaps

To actually sample the realtime lightmaps, we have to also add the third UV set to `**VertexData**` in *My Lighting*.

```
struct VertexData {
	float4 vertex : POSITION;
	float3 normal : NORMAL;
	float4 tangent : TANGENT;
	float2 uv : TEXCOORD0;
	float2 uv1 : TEXCOORD1;
	float2 uv2 : TEXCOORD2;
};
```

When a realtime lightmap is used, we have to add its lightmap  coordinates to our interpolators. The standard shader combines both  lightmap coordinate sets in a single interpolator – multiplexed with  some other data – but we can get away with separate interpolators for  both. We know that there is dynamic light data when the *DYNAMICLIGHTMAP_ON* keyword is defined. It's part of the keyword list of the `multi_compile_fwdbase` compiler directive.

```
struct Interpolators {
	…

	#if defined(DYNAMICLIGHTMAP_ON)
		float2 dynamicLightmapUV : TEXCOORD7;
	#endif
};
```

Fill the coordinates just like the static lightmap coordinates,  except with the dynamic lightmap's scale and offset, made available via  `unity_DynamicLightmapST`.

```
Interpolators MyVertexProgram (VertexData v) {
	…

	#if defined(LIGHTMAP_ON) || ADDITIONAL_MASKED_DIRECTIONAL_SHADOWS
		i.lightmapUV = v.uv1 * unity_LightmapST.xy + unity_LightmapST.zw;
	#endif

	#if defined(DYNAMICLIGHTMAP_ON)
		i.dynamicLightmapUV =
			v.uv2 * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
	#endif

	…
}
```

Sampling the realtime lightmap is done in our `CreateIndirectLight` function. Duplicate the `#if defined(LIGHTMAP_ON)` code block and make a few changes. First, the new block is based on the *DYNAMICLIGHTMAP_ON* keyword. Also, it should use `DecodeRealtimeLightmap` instead of `DecodeLightmap`,  because the realtime maps use a different color format. Because this  data might be added to baked lighting, don't immediately assign to `indirectLight.diffuse`,  but use an intermediate variable which is added to it at the end.  Finally, we should only sample spherical harmonics when neither a baked  nor a realtime lightmap is used.

```
		#if defined(LIGHTMAP_ON)
			indirectLight.diffuse =
				DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.lightmapUV));

			#if defined(DIRLIGHTMAP_COMBINED)
				float4 lightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(
					unity_LightmapInd, unity_Lightmap, i.lightmapUV
				);
				indirectLight.diffuse = DecodeDirectionalLightmap(
					indirectLight.diffuse, lightmapDirection, i.normal
				);
			#endif

			ApplySubtractiveLighting(i, indirectLight);
//		#else
//			indirectLight.diffuse += max(0, ShadeSH9(float4(i.normal, 1)));
		#endif

		#if defined(DYNAMICLIGHTMAP_ON)
			float3 dynamicLightDiffuse = DecodeRealtimeLightmap(
				UNITY_SAMPLE_TEX2D(unity_DynamicLightmap, i.dynamicLightmapUV)
			);

			#if defined(DIRLIGHTMAP_COMBINED)
				float4 dynamicLightmapDirection = UNITY_SAMPLE_TEX2D_SAMPLER(
					unity_DynamicDirectionality, unity_DynamicLightmap,
					i.dynamicLightmapUV
				);
            	indirectLight.diffuse += DecodeDirectionalLightmap(
            		dynamicLightDiffuse, dynamicLightmapDirection, i.normal
            	);
			#else
				indirectLight.diffuse += dynamicLightDiffuse;
			#endif
		#endif

		#if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
			indirectLight.diffuse += max(0, ShadeSH9(float4(i.normal, 1)));
		#endif
```

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/realtime-gi-everything.png) 							Realtime GI applied to everything.

Now realtime lightmaps are used by our shader. Initially, it  might look the same as baked lighting with a mixed light, when using  distance shadowmask mode. The difference becomes obvious when turning  off the light while in play mode.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/mixed-light-runtime-disabled.png) 							Indirect light remains after disabling mixed light.

After disabling a mixed light, its indirect light will remain.  In contrast, the indirect contribution of a realtime light disappears –  and reappears – as it should. However, it might take a while before the  new situation is fully baked. Enlighten incrementally adjust the  lightmaps and probes. How quickly this happens depends on the complexity  of the scene and the *Realtime Global Illumination CPU* quality tier setting.

Toggling realtime light with realtime GI.

All realtime lights contribute to realtime GI. However, its  typical use is with the main direction light only, representing the sun  as it moves through the sky. It is fully functional for directional  lights. Points lights and spotlights work too, but only unshadowed. So  when using shadowed point lights or spotlights you can end up with  incorrect indirect lighting.

 							![inspector](Realtime GI, Probe Volumes, LOD Groups.assets/spotlight-inspector.png) 							![scene](Realtime GI, Probe Volumes, LOD Groups.assets/realtime-gi-spotlight.png) 							Realtime spotlight with unshadowed indirect light.

If you want to exclude a realtime light from realtime GI, you can do so by settings its *Indirect Multiplier* for its light intensity to zero.

### Emissive Light

Realtime GI can also be used for static objects that emit  light. This makes it possible to vary their emission with matching  realtime indirect light. Let's try this out. Add a static sphere to the  scene and give it a material that uses our shader with a black albedo  and white emission color. Initially, we can only see the indirect  effects of the emitted light via the static lightmaps.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/baked-emissive.png) 							Baked GI with emissive sphere.

To bake emissive light into the static lightmap, we had to set  the material's global illumination flags in our shader GUI. As we always  set the flags to `BakedEmissive`, the light ends up in the baked lightmap. This is fine when the emissive light is constant, but doesn't allow us to animate it.

To support both baked and realtime lighting for the emission,  we have to make this configurable. We can do so by adding a choice for  this to `**MyLightingShaderGUI**`, via the `MaterialEditor.LightmapEmissionProperty` method. Its single parameter is the property's indentation level.

```
	void DoEmission () {
		MaterialProperty map = FindProperty("_EmissionMap");
		Texture tex = map.textureValue;
		EditorGUI.BeginChangeCheck();
		editor.TexturePropertyWithHDRColor(
			MakeLabel(map, "Emission (RGB)"), map, FindProperty("_Emission"),
			emissionConfig, false
		);
		editor.LightmapEmissionProperty(2);
		if (EditorGUI.EndChangeCheck()) {
			if (tex != map.textureValue) {
				SetKeyword("_EMISSION_MAP", map.textureValue);
			}

			foreach (Material m in editor.targets) {
				m.globalIlluminationFlags =
					MaterialGlobalIlluminationFlags.BakedEmissive;
			}
		}
	}
```

We also have to stop overriding the flags each time an emission  property has changed. Actually, it is a bit more complicated than that.  One of the flag options is `EmissiveIsBlack`, which  indicates that computation of the emission can be skipped. This flag is  always set for new materials. To make indirect emission work, we have to  guarantee that this flag is not set, regardless whether we choose  realtime or baked. We can do this by always masking the `EmissiveIsBlack` bit of the flags value.

```
			foreach (Material m in editor.targets) {
				m.globalIlluminationFlags &=
					~MaterialGlobalIlluminationFlags.EmissiveIsBlack;
			}
```

 							![inspector](Realtime GI, Probe Volumes, LOD Groups.assets/realtime-emissive-inspector.png) 							![scene](Realtime GI, Probe Volumes, LOD Groups.assets/realtime-emissive.png) 							Realtime GI with emissive sphere.

The visual difference between baked and realtime GI is that the  realtime lightmap usually has a much lower resolution than the baked  one. So when the emission doesn't change and you use baked GI anyway,  make sure to take advantage of its higher resolution.

 							What is the purpose of `EmissiveIsBlack`?

### Animating Emission

Realtime GI for emission is only possible for static objects.  While the objects are static, the emission properties of their materials  can be animated and will be picked up by the global illumination  system. Let's try this out with a simple component that oscillates  between a white and black emission color.

```
using UnityEngine;

public class EmissiveOscillator : MonoBehaviour {

	Material emissiveMaterial;

	void Start () {
		emissiveMaterial = GetComponent<MeshRenderer>().material;
	}

	void Update () {
		Color c = Color.Lerp(
			Color.white, Color.black,
			Mathf.Sin(Time.time * Mathf.PI) * 0.5f + 0.5f
		);
		emissiveMaterial.SetColor("_Emission", c);
	}
}
```

Add this component to our emissive sphere. When in play mode,  its emission will animate, but indirect light isn't affected yet. We  have to notify the realtime GI system that it has work to do. This can  be done by invoking the `Renderer.UpdateGIMaterials` method of the appropriate mesh renderer.

```
	MeshRenderer emissiveRenderer;
	Material emissiveMaterial;

	void Start () {
		emissiveRenderer = GetComponent<MeshRenderer>();
		emissiveMaterial = emissiveRenderer.material;
	}

	void Update () {
		…
		emissiveMaterial.SetColor("_Emission", c);
		emissiveRenderer.UpdateGIMaterials();
	}
```

Realtime GI with animating emissive sphere.

Invoking `UpdateGIMaterials` triggers a complete  update of the object's emission, rendering it using its meta pass. This  is necessary when the emission is more complex than a solid color, for  example if we used a texture. If a solid color is sufficient, we can get  away with a shortcut by invoking `DynamicGI.SetEmissive`  with the renderer and the emission color. This is quicker than  rendering the object with the meta pass, so take advantage of it when  able.

```
//		emissiveRenderer.UpdateGIMaterials();
		DynamicGI.SetEmissive(emissiveRenderer, c);
```

unitypackage

## Light Probe Proxy Volumes

Both baked and realtime GI is applied to dynamic objects via  light probes. An object's position is used to interpolate light probe  data, which is then used to apply GI. This works for fairly small  objects, but is too crude for larger ones.

As an example, add long stretched cube to the test scene so that  it is subject to varying lighting conditions. It should use our white  material. As it is a dynamic cube, it ends up using a single point to  determine its GI contribution. Positioning it so that this point ends up  shadowed, the entire cube becomes dark, which is obviously wrong. To  make it very obvious, use a baked main light, so all lighting comes from  the baked and realtime GI data.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/large-object.png) 						Large dynamic object with bad lighting.

To make light probes work for cases like this, we can use a  light probe proxy volume, or LPPV for short. This works by feeding the  shader a grid of interpolated probe values, instead of a single one.  This requires a floating-point 3D texture with linear filtering, which  limits it to modern graphics cards. Besides that, also make sure that  LPPV support is enabled in the graphics tier settings.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/support-lppv.png) 							LPPV support enabled.

### Adding an LPPV to an Object

An LPPV can be setup in various ways, the most straightforward  is as a component of the object that will use it. You can add it via *Component / Rendering / Light Probe Proxy Volume*.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/lppv-inspector.png) 							LPPV component.

LPPVs work by interpolating between light probes at runtime, as  if they were a grid of regular dynamic objects. The interpolated values  are cached, with the *Refresh Mode* controlling when they are updated. The default is *Automatic*, which means that updates happen when the dynamic GI changes and when the probe group moves. *Bounding Box Mode* controls how the volume is positioned. *Automatic Local*  means that it fits the bounding box of the object it's attached to.  These default settings work well for our cube, so we'll keep them.

To have our cube actually use the LPPV, we have to set the *Light Probes* mode of its mesh renderer to *Use Proxy Volume*. The default behavior is to use the LPPV component of the object itself, but you could also force it to use another volume.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/mesh-renderer-settings.png) 							Using a proxy volume instead of regular probes.

The automatic resolution mode doesn't work well for our stretched cube. So set the *Resolution Mode* to *Custom*  and make sure that there are sample points at the cube corners and  multiple along its long edges. You can see these sample points when you  have the object selected.

 							![inspector](Realtime GI, Probe Volumes, LOD Groups.assets/custom-resolution.png) 							![scene](Realtime GI, Probe Volumes, LOD Groups.assets/lppv-gizmos.png) 							Custom probe resolution to fit the stretched cube.

### Sampling the Volume

The cube has become black, because our shader doesn't support  LPPV sampling yet. To make it work, we have to adjust the spherical  harmonics code inside our `CreateIndirectLight` function. When an LPPV is used, *UNITY_LIGHT_PROBE_PROXY_VOLUME* is defined as 1. Let's do nothing in that case and see what happens.

```
		#if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON)
			#if UNITY_LIGHT_PROBE_PROXY_VOLUME
			#else
				indirectLight.diffuse += max(0, ShadeSH9(float4(i.normal, 1)));
			#endif
		#endif
```

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/no-more-sh.png) 							No more spherical harmonics.

It turns out that all spherical harmonics are disabled, also for dynamic objects that don't use LPPVs. That's because *UNITY_LIGHT_PROBE_PROXY_VOLUME* is defined project-wide, not per object instance. Whether an individual object uses an LPPV is indicated by the X component of `unity_ProbeVolumeParams`, defined in *UnityShaderVariables*. If it is set to 1, then we have an LPPV, otherwise we should use regular spherical harmonics.

```
			#if UNITY_LIGHT_PROBE_PROXY_VOLUME
				if (unity_ProbeVolumeParams.x == 1) {
				}
				else {
					indirectLight.diffuse +=
						max(0, ShadeSH9(float4(i.normal, 1)));
				}
			#else
				indirectLight.diffuse += max(0, ShadeSH9(float4(i.normal, 1)));
			#endif
```

To sample the volume, we can use the `SHEvalLinearL0L1_SampleProbeVolume` function instead of `ShadeSH9`. This function is defined in *UnityCG* and requires the world position as an extra parameter.

```
				if (unity_ProbeVolumeParams.x == 1) {
					indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
						float4(i.normal, 1), i.worldPos
					);
					indirectLight.diffuse = max(0, indirectLight.diffuse);
				}
```

 							How does `SHEvalLinearL0L1_SampleProbeVolume` work?

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/lppv-too-dark.png) 							Sampled LPPV, too dark in gamma space.

Our shader now samples the LPPV when needed, but the result is  too dark. At least, that is the case when working in gamma color space.  That's because the spherical harmonics data is stored in linear space.  So a color conversion might be required.

```
				if (unity_ProbeVolumeParams.x == 1) {
					indirectLight.diffuse = SHEvalLinearL0L1_SampleProbeVolume(
						float4(i.normal, 1), i.worldPos
					);
					indirectLight.diffuse = max(0, indirectLight.diffuse);
					#if defined(UNITY_COLORSPACE_GAMMA)
			            indirectLight.diffuse =
			            	LinearToGammaSpace(indirectLight.diffuse);
			        #endif
				}
```

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/lppv-correct.png) 							Sampled LPPV, with correct colors.

unitypackage

## LOD Groups

When an object ends up covering only a small portion of the  app's window, you don't need a highly detailed mesh to render it. You  can use different meshes depending on the view size of the object. This  is known as level of detail, or LOD for short. Unity allows us to do  this via the *LOD Group* component.

### Creating a LOD Hierarchy

The idea is that you use multiple version of the same mesh at  various detail levels. The highest level – LOD 0 – has the most  vertices, sub-objects, animations, complex materials, and so on.  Additional levels become progressively simpler and cheaper to render.  Ideally, adjacent LOD levels are designed so that you can't easily tell  the difference between them when Unity switches from one to the other.  Otherwise the sudden change would be glaring. But while investigating  this technique we'll use obviously different meshes.

Create an empty game object and give it two children. The first  is a standard sphere and the second is a standard cube with its scale  set to 0.75 uniformly. The result looks like and overlapping sphere and  cube, as expected.

 							![scene](Realtime GI, Probe Volumes, LOD Groups.assets/lod-object-scene.png) 							![hierarchy](Realtime GI, Probe Volumes, LOD Groups.assets/lod-object-hierarchy.png) 							Sphere and cube as one object.

Add a LOD group component to the parent object, via *Component / Rendering / LOD Group*.  You'll get a LOD group with default settings, which has three LOD  levels. The percentages refer to the vertical portion of the window  covered by the object's bounding box. So the default is to switch to LOD  1 when the vertical size drops down to 60% of the window's height, and  to LOD 2 when it is reduced to 30%. When it reaches 10% it isn't  rendered at all. You can change these thresholds by dragging the edges  of the LOD boxes.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/lod-component.png) 							LOD Group component.

The thresholds are modified by the *LOD Bias*,  which is mentioned by the component's inspector. This is a quality  settings with a default value of 2, which means that the thresholds are  effectively halved. It is also possible to set a maximum LOD level,  which results in the highest levels being skipped.

To makes it work, you have to tell the component which objects  to use per LOD level. This is done by selecting a LOD block and adding  objects to its *Renderers* list. While you could  add any object in the scene, by sure to add its child objects. Use the  sphere for LOD 0 and the cube for LOD 1. We'll leave LOD 2 empty, so we  effectively only have two LOD levels. If you want to, you can delete and  insert LOD levels via the right-click context menu.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/lod-0-inspector.png) 							Using the sphere child for LOD 0.

Once the LOD levels are configured, you can see them in action  by moving the camera. If the object ends up big enough, it'll use the  sphere, otherwise it will use the cube or won't be rendered at all.

LOD transitions in action.

### Baked GI and LOD Groups

Because how a LOD group is rendered depends on its view size,  they are naturally dynamic. However, you can still make them static. Do  this for the entire object hierarchy, so both the root and its two  children. Then set the main light to baked to see what happens.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/baked-lighting.png) 							Using baked lighting.

It looks like LOD 0 is used when baking static lightmaps. We  end up always seeing the sphere's shadow and indirect light  contribution, even when the LOD group switches to a cube or culls  itself. But note that the cube uses the static lightmap as well. So it  doesn't use light probes, right? Turn of the light probe group to find  out.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/baked-lighting-without-probes.png) 							Baked lighting without probes.

Disabling the probe group made the cubes darker. This means  that that they no longer receive indirect light. This happens because  LOD 0 is used when determining indirect light during the baking process.  To find the indirect light for the other LOD levels, the best Unity can  do is rely on the baked light probes. So we need light probes to get  indirect light baked for our cubes, even if we don't need light probes  at runtime.

### Realtime GI and LOD Groups

When only using realtime GI, the approach is similar, except  that our cube now uses the light probes at runtime. You can verify this  by selecting the sphere or the cube. When the cube is selected, you can  see the gizmos that show which light probes are used. The sphere doesn't  show them, because it uses the dynamic lightmap.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/realtime-gi-lod-1-probes.png) 							LOD 1 uses probes for realtime GI.

It gets more complicated when both baked and realtime GI are  used at the same time. In that case, the cube should use lightmaps for  the baked GI and light probes for the realtime GI. Unfortunately this is  not possible, because lightmaps and spherical harmonics cannot be used  at the same time. it's either one or the other. Because lightmap data is  available for the cube, Unity ends up using that. Consequently, the  cube isn't affected by realtime GI.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/lod-1-only-baked.png) 							Only baked lighting for LOD 1, using a low-intensity main light.

An important detail is that the baking and rendering of LOD  levels is completely independent. They don't need to use the same  settings. If realtime GI ends up more important than baked GI, you can  force the cube to use light probes by making sure that it is not  lightmap-static, while keeping the sphere static.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/lod-1-forced-probes.png) 							LOD 1 forced to use light probes.

### Cross-fading Between LOD Levels

A downside of LOD groups is that it can be visually obvious  when the LOD level changes. Geometry suddenly pops into view,  disappears, or changes shape. This can be mitigated by cross-fading  between adjacent LOD levels, which is done by setting the group's *Fade Mode* to *Cross Fade*. There is also another fade mode, used by Unity for SpeedTree objects, which we won't use.

When cross-fading is enabled, each LOD level shows a *Fade Transition Width*  field that controls which portion of its block is used for fading. For  example, when set to 0.5 half the LOD's range is used to fade to the  next level. Alternatively, the fading can be animated, in which case it  takes about half a second to transition between LOD levels.

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/cross-fade-inspector.png) 							Cross-fade with 0.5 transition width.

When cross-fading is enabled, two LOD levels are rendered at the same time while the group is transitioning between them.

### Supporting Cross-fading

Unity's standard shader doesn't support cross-fading by  default. You'd have to copy the standard shader and add a multi-compile  directive for the *LOD_FADE_CROSSFADE* keyword. We need to add that directive as well to support cross-fading with *My First Lighting Shader*. Add the directive to all passes except the meta pass.

```
			#pragma multi_compile _ LOD_FADE_CROSSFADE
```

We'll use dithering to transition between the LOD levels. That  approach works with both forward and deferred rendering, and also with  shadows.

We've already used dithering, when creating [semitransparent shadows](https://catlikecoding.com/unity/tutorials/rendering/part-12/).  It required the fragment's screen-space coordinates, which forced us to  use different interpolator structures for the vertex and fragment  program. So let's duplicate the `**Interpolators**` structure in *My Lighting* as well, renaming one to `**InterpolatorsVertex**`.

```
struct InterpolatorsVertex {
	…
};

struct Interpolators {
	…
};

…

InterpolatorsVertex MyVertexProgram (VertexData v) {
	InterpolatorsVertex i;
	…
}
```

The interpolators for the fragment program have to contain `vpos` when we have to cross-fade, otherwise we can keep the usual position.

```
struct Interpolators {
	#if defined(LOD_FADE_CROSSFADE)
		UNITY_VPOS_TYPE vpos : VPOS;
	#else
		float4 pos : SV_POSITION;
	#endif

	…
};
```

We can perform the cross-fading by using the `UnityApplyDitherCrossFade` function at the start of our fragment program.

```
FragmentOutput MyFragmentProgram (Interpolators i) {
	#if defined(LOD_FADE_CROSSFADE)
		UnityApplyDitherCrossFade(i.vpos);
	#endif

	…
}
```

 							How does `UnityApplyDitherCrossFade` work?

![img](RealtimeGI,ProbeVolumes,LODGroups.assets/dithering-geometry.png) 							Cross-fading geometry via dithering.

Crossfading now works for geometry. To make it work for shadows as well, we have to adjust *My Shadows*. First, `vpos` has to be used when we're cross-fading. Second, we also have to use `UnityApplyDitherCrossFade` at the start of the fragment program.

```
struct Interpolators {
	#if SHADOWS_SEMITRANSPARENT || defined(LOD_FADE_CROSSFADE)
		UNITY_VPOS_TYPE vpos : VPOS;
	#else
		float4 positions : SV_POSITION;
	#endif

	…
};

…

float4 MyShadowFragmentProgram (Interpolators i) : SV_TARGET {
	#if defined(LOD_FADE_CROSSFADE)
		UnityApplyDitherCrossFade(i.vpos);
	#endif

	…
}
```

Cross-fading both geometry and shadows.

Because the cube and sphere intersect each other, we get some  strange self-shadowing while cross-fading between them. This is handy to  see that cross-fading between shadows works, but you have to watch out  for such artifacts when creating LOD geometry for actual games.

The next tutorial is [GPU Instancing](https://catlikecoding.com/unity/tutorials/rendering/part-19/).

unitypackage

PDF


text:
# Family Investment Program Recipients and Grants by Month and County

## Dataset

| Name | Value |
| :--- | :---- |
| Catalog | [Link](https://catalog.data.gov/dataset/family-investment-program-recipients-and-grants-by-month-and-county) |
| Metadata | [Link](https://data.iowa.gov/api/views/79c3-mzyc) |
| Data: JSON | [100 Rows](https://data.iowa.gov/api/views/79c3-mzyc/rows.json?max_rows=100) |
| Data: CSV | [100 Rows](https://data.iowa.gov/api/views/79c3-mzyc/rows.csv?max_rows=100) |
| Host | data.iowa.gov |
| Id | 79c3-mzyc |
| Name | Family Investment Program Recipients and Grants by Month and County |
| Attribution | Iowa Department of Human Services, Family Investment Program |
| Category | Economy |
| Tags | public assistance, fip, tanf, family investment program |
| Created | 2014-11-10T14:42:59Z |
| Publication Date | 2016-11-07T13:58:15Z |

## Description

The Family Investment Program (FIP) is Iowa's Temporary Assistance to Needy Families (TANF) program. FIP provides cash assistance to needy families, as they become self-supporting so children may be cared for in their own homes or in the homes of relatives.  Data are provided on the number of cases (families) served, the number of recipients served and the dollar value of the payments provided summed by month and county starting January 2011 and updated monthly. A case is defined as a family group who receives FIP assistance together. A recipient is an individual on a FIP case.

## Columns

```ls
| Included | Schema Type    | Field Name          | Name                | Data Type     | Render Type   |
| ======== | ============== | =================== | =================== | ============= | ============= |
| No       |                | cy                  | CY                  | number        | number        |
| Yes      | time           | month               | Month               | calendar_date | calendar_date |
| Yes      | series tag     | county_name         | County Name         | text          | text          |
| Yes      | series tag     | county              | County #            | text          | text          |
| Yes      | series tag     | service_area        | Service Area        | text          | text          |
| Yes      | numeric metric | cases               | Cases               | number        | number        |
| Yes      | numeric metric | recipients          | Recipients          | number        | number        |
| Yes      | numeric metric | grants              | Grants              | money         | money         |
| No       |                | primary_county_lat  | Primary County Lat  | number        | number        |
| No       |                | primary_county_long | Primary County Long | number        | number        |
```

## Time Field

```ls
Value = month
Format & Zone = yyyy-MM-dd'T'HH:mm:ss
```

## Series Fields

```ls
Excluded Fields = cy,primary_county_lat,primary_county_long
```

## Data Commands

```ls
series e:79c3-mzyc d:2015-03-31T00:00:00.000Z t:county=1 t:service_area="Des Moines" t:county_name=Adair m:cases=16 m:recipients=38 m:grants=5258

series e:79c3-mzyc d:2015-03-31T00:00:00.000Z t:county=2 t:service_area="Des Moines" t:county_name=Adams m:cases=9 m:recipients=17 m:grants=2261

series e:79c3-mzyc d:2015-03-31T00:00:00.000Z t:county=3 t:service_area=Northern t:county_name=Allamakee m:cases=45 m:recipients=137 m:grants=16300
```

## Meta Commands

```ls
metric m:cases p:integer l:Cases d:"Number of family groups who receives FIP assistance together" t:dataTypeName=number

metric m:recipients p:integer l:Recipients d:"Number of individuals on a FIP cases" t:dataTypeName=number

metric m:grants p:double l:Grants d:"Amount of cash assistance payments made" t:dataTypeName=money

entity e:79c3-mzyc l:"Family Investment Program Recipients and Grants by Month and County" t:attribution="Iowa Department of Human Services, Family Investment Program" t:url=https://data.iowa.gov/api/views/79c3-mzyc

property e:79c3-mzyc t:meta.view v:id=79c3-mzyc v:category=Economy v:averageRating=0 v:name="Family Investment Program Recipients and Grants by Month and County" v:attribution="Iowa Department of Human Services, Family Investment Program"

property e:79c3-mzyc t:meta.view.license v:name="Public Domain"

property e:79c3-mzyc t:meta.view.owner v:id=grmb-3z9d v:profileImageUrlMedium=/api/users/grmb-3z9d/profile_images/THUMB v:profileImageUrlLarge=/api/users/grmb-3z9d/profile_images/LARGE v:screenName="Iowa Department of Human Services" v:profileImageUrlSmall=/api/users/grmb-3z9d/profile_images/TINY v:displayName="Iowa Department of Human Services"

property e:79c3-mzyc t:meta.view.tableauthor v:id=grmb-3z9d v:profileImageUrlMedium=/api/users/grmb-3z9d/profile_images/THUMB v:profileImageUrlLarge=/api/users/grmb-3z9d/profile_images/LARGE v:screenName="Iowa Department of Human Services" v:profileImageUrlSmall=/api/users/grmb-3z9d/profile_images/TINY v:roleName=editor v:displayName="Iowa Department of Human Services"
```

## Top Records

```ls
| cy   | month               | county_name | county | service_area | cases | recipients | grants    | primary_county_lat | primary_county_long |
| ==== | =================== | =========== | ====== | ============ | ===== | ========== | ========= | ================== | =================== |
| 2015 | 2015-03-31T00:00:00 | Adair       | 1      | Des Moines   | 16    | 38         | 5258.00   | 41.330746400000002 | -94.470941300000007 |
| 2015 | 2015-03-31T00:00:00 | Adams       | 2      | Des Moines   | 9     | 17         | 2261.00   | 41.0289839         | -94.699184900000006 |
| 2015 | 2015-03-31T00:00:00 | Allamakee   | 3      | Northern     | 45    | 137        | 16300.00  | 43.284283799999997 | -91.378092300000006 |
| 2015 | 2015-03-31T00:00:00 | Appanoose   | 4      | Cedar Rapids | 49    | 114        | 15374.00  | 40.743163500000001 | -92.868610399999994 |
| 2015 | 2015-03-31T00:00:00 | Audubon     | 5      | Western      | 17    | 37         | 5629.00   | 41.684589299999999 | -94.905822200000003 |
| 2015 | 2015-03-31T00:00:00 | Benton      | 6      | Cedar Rapids | 53    | 132        | 18566.00  | 42.080186400000002 | -92.065691200000003 |
| 2015 | 2015-03-31T00:00:00 | Black Hawk  | 7      | Northern     | 782   | 1871       | 246260.00 | 42.470095700000002 | -92.308819700000001 |
| 2015 | 2015-03-31T00:00:00 | Boone       | 8      | Des Moines   | 66    | 159        | 21644.00  | 42.036549299999997 | -93.931670999999994 |
| 2015 | 2015-03-31T00:00:00 | Bremer      | 9      | Northern     | 31    | 70         | 9871.00   | 42.7745873         | -92.318054799999999 |
| 2015 | 2015-03-31T00:00:00 | Buchanan    | 10     | Northern     | 56    | 119        | 17391.00  | 42.470777699999999 | -91.837839200000005 |
```

repository: SpellarBot/open-data-catalog

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: SpellarBot/open-data-catalog


text:
# Mortar Github Recommender

This Mortar project contains the scripts which generate recommendations for [gitrec.mortardata.com](http://gitrec.mortardata.com/). This readme details how the algorithm works; for a just a quick overview, see [this blog post](http://blog.mortardata.com/post/53294300530/gitrec-your-personalized-github-repo-recommender).

The recommendations are generated by three pigscripts, [parse_events.pig](pigscripts/parse_events.pig), [gen_item_recs.pig](pigscripts/gen_item_recs.pig), and [gen_user_recs.pig](pigscripts/gen_user_recs.pig), which can be called using a controlscript [gitrec.py](controlscripts/gitrec.py).

To be more generic (and possibly reusable), the code uses the term "item" instead of "repo". Also, if there is a thing that looks like a function call at the beginning of a pig statement, i.e.

    user_ids = Utils__AssignIntegerIds(...)

that is actually a macro in the file denoted by the portion before the underscores, i.e. in this case [utils.pig](macros/utils.pig).

If you want to run these scripts yourself, you will have to copy Github event logs from the [Github Archive](http://www.githubarchive.org/) into your own S3 bucket, and optionally download a sample to use for local development.

- [This repo](https://github.com/MarkRoddy/github-data) has a script for copying the logs to your S3 bucket; be sure to run it on an EC2 node for high bandwidth to S3; also be sure to run it in a screen session so your ssh doesn't timeout.
- If you want to use a sample of the logs for local development, download the sample you want from your S3 bucket and change the path for the parameter EVENT_LOGS_PATH in [parse_events.pig](pigscripts/parse_events.pig) to hit your data (it is relative to the pigscripts directory). 5 days should be enough to see sensible results for active repos, but not so much that your laptop cannot handle it.

To run one of the scripts in local mode, use:

    mortar local:run pigscripts/the_script.pig

To run it on Mortar, edit the [paramfile](paramfiles/gitrec-cloud.params) and use:

	mortar register my_gitrec
    mortar run pigscripts/the_script.pig -f paramfiles/gitrec-cloud.params -s 11

To run all the scripts together, use `controlscripts/gitrec.py` in the commands instead of `pigscritps/the_script.pig`.

## Generating A User-Repo Affinity Graph

[parse_events.pig](pigscripts/parse_events.pig) parses raw Github event logs into a "user-repo affinity" graph where each edge represents that a user U has some connection to a repo R.

We consider four kinds of signals:

- user watches repo
- user forks repo
- user submits a pull request to a repo
- user pushes a commit to a repo

These signals each have three values assigned to them: one for "specific interest" (in our case, pushes and pull requests express this), one for "general interest" (watches and forks express this), and lastly a "graph score" (a combination of both that is used to make the actual graph).

We aggregate each of these scores for each unique user-repo pair. To avoid problems where a hyper-active user who makes many commits to a repo every data messing up the algorithm, we use a logistic scaling function to map each aggregate score to a value in [0, 1] representing how engaged a user is with the repo.

[parse_events.pig](pigscripts/parse_events.pig) also extracts the most recent metadata we have available for each repo. Combining the number of forks and stars fields from the metadata (popularity) with the sum of all the user-repo affinity scores for a given repo (activity) gives an overall "importance score" for each repo.

## Finding The Neighborhood Of Each Repo

[gen_item_recs.pig](pigscripts/gen_item_recs.pig) finds the collection of repos that are most similar to each individual repo, which we call its "neighborhood". It outputs these neighborhoods for use by the subsequent script, but it also joins a copy of them to repo metadata to produce final recommendations for "repos similar to the given repo" (we use DynamoDB to store the recommendations, so the output has to be denormalized).

The first step in generating the neighborhoods is to reduce the user-repo affinities into a repo-repo similarity graph. Each user contributes to a link between repos A and B if they have interacted with both A and B (i.e. forked both). We sum up every users contribution to the A-B link to get a "link score". We use both the "link score" for A-B and the "importance score" for B to estimate the P(user interacts with A | user interacts with B), incorporating a Bayesian prior to guard against small sample sizes. The reciprocal of this probability is said to be the distance of A->B. Note that these distances are not symmetric, that is A->B =/= B->A. Using this distance metric "close" repos are similar, "far" repos are dissimilar.

The reason for choosing to estimate P(A | B) for the A->B edge instead of P(B | A) is a bit counter-intuitive, but this example should help explain: suppose P(twitter/bootstrap | random/repo) = 1, that is every user who likes random/repo also likes twitter/bootstrap. That means there should be random/repo -> twitter/bootstrap should a short distance; but twitter/bootstrap -> random/repo should definitely not be short, since the users they share in common are only a tiny percentage of all the users of twitter/bootstrap.

To get distances for repos that are not directly connected, we follow shortest paths on the repo-repo distance graph up to a maximum path length of 3.

## Choosing Recommendations For Each User

[gen_user_recs.pig](pigscripts/gen_user_recs.pig) does the last step of the recommender pipeline, choosing which repos to recommend for each user for each of two categories, "specific interest" (similar to those you've contributed to) and "general interest" (similar to those you've looked at). Once it generates it recommendations, it joins them to repo metadata to product the final denormalized output.

Choosing recommendations is simple: consider all the repos in the neighborhoods of repos the user has interacted with in each category (specific/general), then assign an new user-neighbor affinity score based on

1. the original user-repo affinity score for the repo that led us to the neighbor (called the "reason")
2. the distance between reason repo and the neighbor repo
3. the importance score of the neighbor repo. Then take the top N neighbor repos by affinity for each user.

Some care is also taken to avoid the following bad recommendations:

1. repos the user owns
2. repos the user has already interacted with
3. for the "general interest" category, repos which were already recommended as part of the "specific interest" category

repository: pombredanne/gitrec

repo_name: pombredanne/gitrec


text:
---
layout: default
---

# 1994-08-09 - (fwd) Anonymous posters & Misinformation = Net pollution

## Header Data

From<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: a516b245d86064c35f149064ed87b790d53b08ff60067d6af73762449f89e22d

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1994-08-09 15:02:22 UTC

Raw Date: Tue, 9 Aug 94 08:02:22 PDT

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>Date: Tue, 9 Aug 94 08:02:22 PDT
To<EMAIL_ADDRESS>Subject: (fwd) Anonymous posters & Misinformation = Net pollution
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Path: math.utexas.edu!news.dell.com!swrinde!cs.utexas.edu!uwm.edu!reuter.cse.ogi.edu!netnews.nwnet.net!news.u.washington.edu!mcdaniel
From<EMAIL_ADDRESS>(McDaniel)
Newsgroups: talk.politics.misc,news.admin.policy
Subject: Anonymous posters & Misinformation = Net pollution
Date: 7 Aug 1994 08:13:45 GMT
Organization: University of Washington
Lines: 39
Message-ID<EMAIL_ADDRESS>NNTP-Posting-Host: stein4.u.washington.edu
Keywords: misinformation disinformation propaganda net anon anonymous
Xref: math.utexas.edu talk.politics.misc:239273 news.admin.policy:19179

The problem:  Anonymous posters supplying pseudo-news reports or
otherwise wasting bandwidth in groups more concerened with fact
or atleast genuine concerns (such as political talk groups and
sci groups.)

The soultion: Limited anonymous posters to forums where accountability
for what one says is of little concern (such as rec groups where
applicable.)   OR provide the owners of moderated groups with detailed
accounts of the true identity of any anonymous poster who post to
a serious newsgroup and make that procedure known to the would-be
anonymous user.

I attempted recently to secure the actual address of an anon poster
who deliberetly spread misinformation concerning a non-existant
U.S. Presidential Executive Order and a news-look-alike story dealing
with proven falsehoods.

Needless to say the administrator of the popular anon.penet.fi server
has not been cooperative.  I suggest that groups wishing to deal with
issues based a little stronger in reality ban anonymous posters and
encourage their posters NEVER to repeat information supplied by anonymous
posters elsewhere.  Some groups have already come to that same conclusion.

I believe that anonymous posting is a valuable service in many forums.
However, it seems that service is being abused in political and technical
newsgroups.

I suppose yet another solution would be to make widely known the
general untrustability of anonymous posters in groups where truth and
fact are paramount.  But this letter should go a tiny ways towards that
goal.

Opinions?

-McDaniel

{% endraw %}
```

## Thread

+ Return to [August 1994](/archive/1994/08)

+ Return to "[nzook@math.utexas.edu](/authors/nzook_at_math_utexas_edu)"

+ 1994-08-09 (Tue, 9 Aug 94 08:02:22 PDT) - (fwd) Anonymous posters & Misinformation = Net pollution -<EMAIL_ADDRESS>

license: MIT

gha_license_id: MIT


text:
## f\_gets

The f\_gets reads a string from the file.

    TCHAR* f_gets (
      TCHAR* buff, /* [OUT] Read buffer */
      int len,     /* [IN] Size of the read buffer */
      FIL* fp      /* [IN] File object */
    );

#### Parameters

  - buff
    Pointer to read buffer to store the read string.
  - len
    Size of the read buffer in unit of character.
  - fp
    Pointer to the open file object structure.

#### Return Values

When the function succeeded, `buff` will be returuned.

#### Description

The `f_gets()` function is a wrapper function of [`f_read()`](read.md)
function. The read operation continues until a `'\n'` is stored, reached
end of the file or the buffer is filled with `len - 1` characters. The
read string is terminated with a `'\0'`. When no character to read or
any error occured during read operation, it returns a null pointer. The
status of EOF and error can be examined with `f_eof()` and `f_error()`
macros.

When FatFs is configured to Unicode API (`_LFN_UNICODE == 1`), data
types on the srting fuctions, `f_putc()`, `f_puts()`, `f_printf()` and
`f_gets()`, is also switched to Unicode. The character encoding on the
file to be read/written via those functions is selected by
`_STRF_ENCODE` option.

#### QuickInfo

Available when `_USE_STRFUNC` is 1 or 2. When it is set to 2, `'\r'`s
contained in the file are stripped out.

#### See Also

`f_open, f_read, f_putc, f_puts, f_printf, f_close, FIL`

repository: Zeke-OS/zeke

gha_language: C

gha_license_id: NOASSERTION

repo_name: Zeke-OS/zeke


text:
# BlueInk Embed JS Library

A Javascript library to create embedded signing sessions with the BlueInk API.

## Installation

From NPM:
```bash
npm install @blueink360/blueink-embed-js
```

Or if you prefer yarn:
```bash
yarn add @blueink360/blueink-embed-js
```

From CDN:
```html
<script<EMAIL_ADDRESS>```

If including this library directly with a script tag, the `BlueInkEmbed`
class will be added to the global namespace.

## Usage

To use the library, you will need a public API key from your BlueInk account.
If you do not have a BlueInk account, you can
[create one here](https://blueink.com/esignature-api/). You can send
unlimited test Bundles for free while developing your eSignature integration.

### Quickstart

```javascript
import BlueInkEmbed from 'blueink-embed-js';
const embedUrl = 'EMBED-URL-RETURNED-BY-THE-SERVER';
const embed = new BlueInkEmbed('YOUR-PUBLIC-API-KEY');

// Mount the embedded signing iFrame in a div with ID 'iframe-container'
embed.mount(embedUrl, '#iframe-container');

// Optionally, unmount the signing iFrame when done
embed.unmount();
```

### Fuller Example, with Error and Event Handling

This example shows fetching the embedUrl from the server via
[axios](https://github.com/axios/axios), and handling errors.

```javascript
import BlueInkEmbed from 'blueink-embed-js';

const exampleRequestData = {
    signerName: 'Frank Ricard',
    signerEmail<EMAIL_ADDRESS>};

// This assumes that your server-side App can receive requests
// at /get-embed-url and will create a new Bundle and return
// an embedded signing URL. See the BlueInk API docs for examples.

axios.post('/get-embed-url', exampleRequestData)
    .then(response => {
        try {
            const embedUrl = response.data.embedUrl;
            const embed = new BlueInkEmbed('YOUR-BLUEINK-PUBLIC-API-KEY');

            // Setup event listeners to respond to events emitted
            // by the embedded signing iFrame
            embed.on(BlueInkEmbed.EVENT.COMPLETE, () => {
                console.log('signing complete!');
            });

            embed.on(BlueInkEmbed.EVENT.ERROR, (eventData) => {
                console.log('Signing error occurred.');
                console.log(eventData.message);
            });

            embed.mount(embedUrl, '#iframe-container');
        } catch(error) {
            // An error could be thrown if the public API key is invalid,
            // or if no element was found with id 'iframe-container'
            console.log(error.message);
        }
    })
    .catch(error => {
        // This catch block would handle if the /get-embed-url
        // request returned a 5XX or 4XX error.
        const message = error.response.data.error || error.message;
        console.log(message);
    });
```

### More Resources

* [BlueInkEmbed class and methods](https://blueinkhq.github.io/blueink-embed-js/BlueInkEmbed.html)
* [Events emitted by the BlueInkEmbed instance](https://blueinkhq.github.io/blueink-embed-js/global.html#EVENT)
* [BlueInk API Documentation](https://blueink.com/esignature-api/api-docs/)

## Getting Help / Contributing

If you have a BlueInk Account and need help integrating this library into
your API project, please contact our support team from your BlueInk
account dashboard.

If you find issues in this codebase, or have any suggestions for improvement
please create an issue here on github.

We welcome contributions and will consider any pull requests.

If you are making modifications to the library, or running the project,
locally the following commands should come in handy. We use yarn internally,
but all of the commands below should work with there `npm` equivalents.

```bash
# Run the tests
$ yarn test
$ yarn test:coverage

# Build a production, minified version of the library
$ yarn run build

# Build a development, unminified version of the library
$ yarn run build:dev

# Run webpack-dev-server, so that the library will be accessible
# at http://localhost:8080/blueink-embed.js
$ yarn run devserver

# Build the docs
$ yarn run build:docs
```

## License

MIT

repository: blueinkhq/blueink-embed-js

gha_language: JavaScript

repo_name: blueinkhq/blueink-embed-js


text:
[![Twitter Follow](https://img.shields.io/twitter/follow/oskar_at_net?style=social)](https://twitter.com/oskar_at_net) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/oskardudycz/)](https://github.com/sponsors/oskardudycz/) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_jvm) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_net)

# Introduction to Event Sourcing Workshop

Event Sourcing is perceived as a complex pattern. Some believe that it's like Nessie, everyone's heard about it, but rarely seen it. In fact, Event Sourcing is a pretty practical and straightforward concept. It helps build predictable applications closer to business. Nowadays, storage is cheap, and information is priceless. In Event Sourcing, no data is lost.

The workshop aims to build the knowledge of the general concept and its related patterns for the participants. The acquired knowledge will allow for the conscious design of architectural solutions and the analysis of associated risks.

The emphasis will be on a pragmatic understanding of architectures and applying it in practice using Marten and EventStoreDB.

1. Introduction to Event-Driven Architectures. Differences from the classical approach are foundations and terminology (event, event streams, command, query).
2. What is Event Sourcing, and how is it different from Event Streaming. Advantages and disadvantages.
3. Write model, data consistency guarantees on examples from Marten and EventStoreDB.
4. Various ways of handling business logic: Aggregates, Command Handlers, functional approach.
5. Projections, best practices and concerns for building read models from events on the examples from Marten and EventStoreDB.
6. Challenges in Event Sourcing and EDA: deliverability guarantees, sequence of event handling, idempotency, etc.
8. Saga, Choreography, Process Manager,  distributed processes in practice.
7. Event Sourcing in the context of application architecture, integration with other approaches (CQRS, microservices, messaging, etc.).
8. Good and bad practices in event modelling.
9. Event Sourcing on production, evolution, events' schema versioning, etc.

You can do the workshop as a self-paced kit. That should give you a good foundation for starting your journey with Event Sourcing and learning tools like Marten and EventStoreDB. If you'd like to get full coverage with all nuances of the private workshop, feel free to contact me via [email](mailto:oskar.dudycz@gmail.com).

Read also more in my article [Introduction to Event Sourcing - Self Paced Kit](https://event-driven.io/en/introduction_to_event_sourcing/?utm_source=event_sourcing_net).

## Exercises

1. [Events definition](./01-EventsDefinition).
2. [Getting State from events](./02-GettingStateFromEvents).
3. Appending Events:
   * [Marten](./03-AppendingEvents.Marten)
   * [EventStoreDB](./04-AppendingEvents.EventStoreDB)
4. Getting State from events
   * [Marten](./05-GettingStateFromEvents.Marten)
   * [EventStoreDB](./06-GettingStateFromEvents.EventStoreDB)
5. Business logic:
   * [General](./07-BusinessLogic)
   * [Marten](./08-BusinessLogic.Marten)
   * [EventStoreDB](./09-BusinessLogic.EventStoreDB)
6. Optimistic Concurrency:
   * [Marten](./10-OptimisticConcurrency.Marten)
   * [EventStoreDB](./11-OptimisticConcurrency.EventStoreDB)
7. Projections:
   * [General](./12-Projections)
   * [Idempotency](./13-Projections.Idempotency)
   * [Eventual Consistency](./14-Projections.EventualConsistency)

## Prerequisites

1. Install git - https://git-scm.com/downloads.
2. Clone this repository.
3. Install .NET 7.0 - https://dotnet.microsoft.com/download/dotnet/7.0.
4. Install Visual Studio, Rider or VSCode.
5. Install docker - https://docs.docker.com/engine/install/.
6. Open [Exercises.sln](./Exercises.sln) solution.

## Running

1. Run: `docker-compose up`.
2. Wait until all dockers got are downloaded and running.
3. You should automatically get:
    - Postgres DB running for [Marten storage](https://martendb.io)
    - PG Admin - IDE for postgres. Available at: http://localhost:5050.
        - Login<EMAIL_ADDRESS>Password: `admin`
        - To connect to server click right mouse on Servers, then Register Server and use host: `postgres`, user: `postgres`, password: `Password12!`
   - EventStoreDB UI: http://localhost:2113/
4. Open, build and run [Exercises.sln](./Exercises.sln) solution.
4. To see solved exercises, open [Solved.sln](./Solved.sln) solution.

branch_name: refs/heads/main

gha_language: C#


text:
# Overview

This repo contains software to be used to connect to the cloud service **IBM Cloud Hyper Protect Crypto Services**. For more information regarding this service please see https://console.bluemix.net/docs/services/hs-crypto/index.html#getting-started-with-ibm-cloud-hyper-protect-crypto-services

# Contents

The contents of this repo are offered *as-is* and is subject to change at anytime. This is an *Experimental Service* from IBM Cloud at this point in time. To see more information about the Terms and Conditions, review http://www-03.ibm.com/software/sla/sladb.nsf/sla/bm-6605-12.

# Golang Example

The Golang examples can be found [here](golang/README.md). The examples show how to manipulate with **IBM Cloud Hyper Protect Crypto Services** to accomplish following functions:

* Get mechenism information
* Encrypt and decrypt
* Sign and verify
* Wrap and unwrap key
* Derive key
* Build message digest


text:
---
layout: post
title: "Individual sound files for each selection (or how to create a warbleR function)"
date: 06-06-2017
---

A friend of mine wants to "create individual sound files for each selection" in a selection table. This is a good opportunity to show how to create a function that works iteratively on signals in a selection table (like most [warbleR](https://cran.r-project.org/package=warbleR) functions).

It takes 3 main steps:

1. Create a (internal) function that does what we want on a single selection (i.e. a single row of the selection table)

2. Add and `(X)lapply` loop to run the function from step 1 iteratively on each row

3. Put all inside a new function

Other things can be added to the function to check arguments and set working directory, but this is not critical.

### Step 1: Create function that does what we want on a single selection

First install and/or load [warbleR](https://cran.r-project.org/package=warbleR) (which also loads [tuneR](https://cran.r-project.org/package=tuneR), the package for cutting and saving sound files):

{% highlight r %}
if(!"devtools" %in% installed.packages()[,"Package"])  install.packages("devtools")
require("devtools")

devtools::install_github("maRce10/warbleR")
require("warbleR")
{% endhighlight %}

Save the example sound files as *.wav* in a temporary working directory (to test the code):

{% highlight r %}
setwd(tempdir())

data(list = c("Phae.long1", "Phae.long2", "Phae.long3",
              "Phae.long4", "selec.table"))
writeWave(Phae.long1,"Phae.long1.wav")
writeWave(Phae.long2,"Phae.long2.wav")
writeWave(Phae.long3,"Phae.long3.wav")
writeWave(Phae.long4,"Phae.long4.wav")
{% endhighlight %}

We can check that now there are 4 sound files in the working directory:

{% highlight r %}
list.files(pattern = "\\.wav$", ignore.case = TRUE)
{% endhighlight %}

{% highlight text %}
## [1] "Phae.long1.wav" "Phae.long2.wav" "Phae.long3.wav" "Phae.long4.wav"
{% endhighlight %}

The selection table `selec.table` contains columns for sound file name, start and end of signals (in seconds), and a unique ID for each selection:

{% highlight r %}
head(selec.table)
{% endhighlight %}

{% highlight text %}
##      sound.files channel selec     start       end bottom.freq top.freq
## 1 Phae.long1.wav       1     1 1.1693549 1.3423884    2.220105 8.604378
## 2 Phae.long1.wav       1     2 2.1584085 2.3214565    2.169437 8.807053
## 3 Phae.long1.wav       1     3 0.3433366 0.5182553    2.218294 8.756604
## 4 Phae.long2.wav       1     1 0.1595983 0.2921692    2.316862 8.822316
## 5 Phae.long2.wav       1     2 1.4570585 1.5832087    2.284006 8.888027
## 6 Phae.long3.wav       1     1 0.6265520 0.7577715    3.006834 8.822316
##   sel.comment rec.comment
## 1         c24          NA
## 2         c25          NA
## 3         c26          NA
## 4         c27          NA
## 5         c28          NA
## 6         c29          NA
{% endhighlight %}

Now write a code that takes the selection from a single row, extracts the *.wav* file segment, and save it to the working directory. To do this use the functions `readWave` and `writeWave` from [tuneR](https://cran.r-project.org/package=tuneR):

{% highlight r %}
#lets use X for the selection table data frame as is the convention in warbleR functions
X <- selec.table

# Cut wave for the first row
wvcut <- tuneR::readWave(as.character(X$sound.files[1]), from = X$start[1], to = X$end[1], units = "seconds")

# save cut removing file extension
tuneR::writeWave(object = wvcut, filename = paste0(gsub("\\.wav$", "",X$sound.files[1], ignore.case = TRUE), "-", X$selec[1], ".wav"))
{% endhighlight %}

Note that the sound file name (with the file extension removed) and selection ID were used to name the cut. This is important because it will produce a unique name for each cut, so they won't be overwritten.

The following code shows that there is a new sound file corresponding to the new cut:

{% highlight r %}
list.files(pattern = "\\.wav$", ignore.case = TRUE)
{% endhighlight %}

{% highlight text %}
## [1] "Phae.long1-1.wav" "Phae.long1.wav"   "Phae.long2.wav"
## [4] "Phae.long3.wav"   "Phae.long4.wav"
{% endhighlight %}

Now put the code inside a function. The index number 1 used above has to be replaced by 'i' so it runs one each row iteratively. I also added a few more line of codes to:

  * Allow adding margins at both sides of the signals
  * Adjust the start and end when the margin surpasses the start (0) and end of the whole sound file

{% highlight r %}
cutFUN <- function(X, i, mar){

    # Read sound files, initialize frequency and time limits for spectrogram
    r <- tuneR::readWave(as.character(X$sound.files[i]), header = TRUE)
    f <- r$sample.rate
    t <- c(X$start[i] - mar, X$end[i] + mar)

    # fix margins if below 0 or length of recordings
    mar1 <- mar
    mar2 <- mar1 + X$end[i] - X$start[i]

    if (t[1] < 0)  t[1] <- 0

    if(t[2] > r$samples/f) t[2] <- r$samples/f

    # Cut wave
    wvcut <- tuneR::readWave(as.character(X$sound.files[i]), from = t[1], to = t[2], units = "seconds")

tuneR::writeWave(object = wvcut, filename = paste0(as.character(X$sound.files[i]), "-", X$selec[i], ".wav"))

  }
{% endhighlight %}

### Step 2: Add a (X)lapply function

Several versions of the `lapply` function can be used. The function `pblapply` from the package [pbapply](https://cran.r-project.org/package=pbapply) provides a nice progress bar. The following code should produce cuts for each selection in `selec.table`:

{% highlight r %}
out <- pbapply::pblapply(1:nrow(selec.table), function(y)
  cutFUN(X = selec.table, i = y, mar = 0.05))
{% endhighlight %}

We could also used `lapply` (no progress bar) or `mclapply` ([parallel](https://cran.r-project.org/package=parallel) package, parallel computing), or even `pbmclapply` ([pbmcapply](https://cran.r-project.org/package=pbmcapply) package, parallel computing and progress bar, but not available for windows). In fact, all these options are included in most [warbleR](https://cran.r-project.org/package=pbmcapply) functions.

### Step 3: Put all the code inside a new function

Just copy/paste the `cutFUN` function and the `(X)lapply` function inside a new function:

{% highlight r %}
cut.selections <- function(X, mar){

# internal function to cut each selection
cutFUN <- function(X, i, mar){

    # Read sound files, initialize frequency and time limits for spectrogram
    r <- tuneR::readWave(as.character(X$sound.files[i]), header = TRUE)
    f <- r$sample.rate
    t <- c(X$start[i] - mar, X$end[i] + mar)

    # fix margins if below 0 or length of recordings
    mar1 <- mar
    mar2 <- mar1 + X$end[i] - X$start[i]

    if (t[1] < 0)  t[1] <- 0

    if(t[2] > r$samples/f) t[2] <- r$samples/f

    # Cut wave
    wvcut <- tuneR::readWave(as.character(X$sound.files[i]), from = t[1], to = t[2], units = "seconds")

tuneR::writeWave(object = wvcut, filename = paste0(as.character(X$sound.files[i]), "-", X$selec[i], ".wav"))

  }

# lapply function to run over all selections
out <- pbapply::pblapply(1:nrow(X), function(y) cutFUN(X = selec.table, i = y, mar = 0.05))

}
{% endhighlight %}

Let's see if it works. First we should remove the cuts we created previously. The following code removes only the cuts but not the original sound files (filtered out based on file size):

{% highlight r %}
wvs <- list.files(pattern = "\\.wav$", ignore.case = TRUE)

sz <- file.info(list.files(pattern = "\\.wav$", ignore.case = TRUE))$size

unlink(wvs[sz < 50000])

list.files(pattern = "\\.wav$", ignore.case = TRUE)
{% endhighlight %}

{% highlight text %}
## [1] "Phae.long1.wav" "Phae.long2.wav" "Phae.long3.wav" "Phae.long4.wav"
{% endhighlight %}

And run the function:

{% highlight r %}
cut.selections(X = selec.table, mar = 0.05)
{% endhighlight %}

The cuts now are found in the working directory:

{% highlight r %}
list.files(pattern = "\\.wav$", ignore.case = TRUE)
{% endhighlight %}

{% highlight text %}
##  [1] "Phae.long1.wav"       "Phae.long1.wav-1.wav" "Phae.long1.wav-2.wav"
##  [4] "Phae.long1.wav-3.wav" "Phae.long2.wav"       "Phae.long2.wav-1.wav"
##  [7] "Phae.long2.wav-2.wav" "Phae.long3.wav"       "Phae.long3.wav-1.wav"
## [10] "Phae.long3.wav-2.wav" "Phae.long3.wav-3.wav" "Phae.long4.wav"
## [13] "Phae.long4.wav-1.wav" "Phae.long4.wav-2.wav" "Phae.long4.wav-3.wav"
{% endhighlight %}

I put together all the code in a new [warbleR](https://cran.r-project.org/package=warbleR) function called `cut_sels` (available in version 1.1.9, currrently only on github).  I added a few more arguments (labels, overwrite, parallel, ...), some argument checks to warn users when using invalid values, and parallel and progress bar options. Here is the code in case you are curious:

{% highlight r %}
cut_sels <- function(X, mar = 0.05, parallel = 1, path = NULL, dest.path = NULL, pb = TRUE,
                     labels = c("sound.files", "selec"), overwrite = FALSE, ...){

  #check path to working directory
  if(!is.null(path))
  {wd <- getwd()
  if(class(try(setwd(path), silent = TRUE)) == "try-error") stop("'path' provided does not exist") else
    setwd(path)} #set working directory

  #check path to working directory
  if(!is.null(dest.path))
  {if(class(try(setwd(dest.path), silent = TRUE)) == "try-error") stop("'dest.path' provided does not exist")} else dest.path <- getwd()
     #set working directory

  #if X is not a data frame
  if(!class(X) == "data.frame") stop("X is not a data frame")

  if(!all(c("sound.files", "selec",
            "start", "end") %in% colnames(X)))
    stop(paste(paste(c("sound.files", "selec", "start", "end")[!(c("sound.files", "selec",
                                                                   "start", "end") %in% colnames(X))], collapse=", "), "column(s) not found in data frame"))

  #if there are NAs in start or end stop
  if(any(is.na(c(X$end, X$start)))) stop("NAs found in start and/or end")

  #if end or start are not numeric stop
  if(all(class(X$end) != "numeric" & class(X$start) != "numeric")) stop("'end' and 'selec' must be numeric")

  #if any start higher than end stop
  if(any(X$end - X$start<0)) stop(paste("The start is higher than the end in", length(which(X$end - X$start<0)), "case(s)"))

  #return warning if not all sound files were found
  recs.wd <- list.files(pattern = "\\.wav$", ignore.case = TRUE)
  if(length(unique(X$sound.files[(X$sound.files %in% recs.wd)])) != length(unique(X$sound.files)))
    (paste(length(unique(X$sound.files))-length(unique(X$sound.files[(X$sound.files %in% recs.wd)])),
           ".wav file(s) not found"))

  #missing label columns
  if(!all(labels %in% colnames(X)))
    stop(paste(paste(labels[!(labels %in% colnames(X))], collapse=", "), "label column(s) not found in data frame"))

  #count number of sound files in working directory and if 0 stop
  d <- which(X$sound.files %in% recs.wd)
  if(length(d) == 0){
    stop("The .wav files are not in the working directory")
  }  else {
    X <- X[d, ]
  }

  #convert factors to characters
  X[,sapply(X, is.factor)] <- apply(X[,sapply(X, is.factor)], 2, as.character)

  #remove .wav from sound file names
  X2 <- X
  X2$sound.files <- gsub("\\.wav$", "", X2$sound.files, ignore.case = TRUE)

  # If parallel is not numeric
  if(!is.numeric(parallel)) stop("'parallel' must be a numeric vector of length 1")
  if(any(!(parallel %% 1 == 0),parallel < 1)) stop("'parallel' should be a positive integer")

  #if parallel and pb in windows
  if(parallel > 1 &  pb & Sys.info()[1] == "Windows") {
    message("parallel with progress bar is currently not available for windows OS")
    message("running parallel without progress bar")
    pb <- FALSE
  }

  #create function to run within Xapply functions downstream
  cutFUN <- function(X, i, mar, labels, dest.path){

    # Read sound files, initialize frequency and time limits for spectrogram
    r <- tuneR::readWave(as.character(X$sound.files[i]), header = TRUE)
    f <- r$sample.rate
    t <- c(X$start[i] - mar, X$end[i] + mar)

    # fix margins if below 0 or length of recordings
    mar1 <- mar
    mar2 <- mar1 + X$end[i] - X$start[i]

    if (t[1] < 0)  t[1] <- 0
    if(t[2] > r$samples/f) t[2] <- r$samples/f

    # Cut wave
    wvcut <- tuneR::readWave(as.character(X$sound.files[i]), from = t[1], to = t[2], units = "seconds")

    # save cut
    if(overwrite) unlink(file.path(dest.path, paste0(paste(X2[i, labels], collapse = "-"), ".wav")))

    tuneR::writeWave(object = wvcut, filename = file.path(dest.path, paste0(paste(X2[i, labels], collapse = "-"), ".wav")), ...)

  }

  # Run parallel in windows
  if(parallel > 1) {
    if(Sys.info()[1] == "Windows") {

      i <- NULL #only to avoid non-declared objects

      cl <- parallel::makeCluster(parallel)

      doParallel::registerDoParallel(cl)

      out <- foreach::foreach(i = 1:nrow(X)) %dopar% {
        cutFUN(X = X, i = i, mar = mar, labels = labels, dest.path = dest.path)
      }

      parallel::stopCluster(cl)

    }
    if(Sys.info()[1] == "Linux") {    # Run parallel in Linux

      if(pb)
        out <- pbmcapply::pbmclapply(1:nrow(X), mc.cores = parallel, function (i) {
          cutFUN(X = X, i = i, mar = mar, labels = labels, dest.path = dest.path)
        }) else
          out <- parallel::mclapply(1:nrow(X), mc.cores = parallel, function (i) {
            cutFUN(X = X, i = i, mar = mar, labels = labels, dest.path = dest.path)

          })
    }
    if(!any(Sys.info()[1] == c("Linux", "Windows"))) # parallel in OSX
    {
      cl <- parallel::makeForkCluster(getOption("cl.cores", parallel))

      doParallel::registerDoParallel(cl)

      out <- foreach::foreach(i = 1:nrow(X)) %dopar% {
        cutFUN(X = X, i = i, mar = mar, labels = labels, dest.path = dest.path)
      }

      parallel::stopCluster(cl)

    }
  }
  else {
    if(pb)
      out <- pbapply::pblapply(1:nrow(X), function(i) cutFUN(X = X, i = i, mar = mar, labels = labels, dest.path = dest.path)) else
        out <- lapply(1:nrow(X), function(i) cutFUN(X = X, i = i, mar = mar, labels = labels, dest.path = dest.path))
  }

  if(!is.null(path)) setwd(wd)
}
{% endhighlight %}

That's is it. If you developed a function that you think could be useful to other people we could include it in [warbleR](https://cran.r-project.org/package=warbleR).

gha_language: HTML


text:
# Features targeting Australia

The following area is included as part of [country-coder](https://github.com/rapideditor/country-coder) and doesn't need its own feature.

- [au-tas](https://location-conflation.com/?locationSet=%7B%22include%22%3A%5B%22au-tas%22%5D%7D&referrer=nsi) - Tasmania

States / territories of Australia targeted with a feature using [ISO_3166-2:AU](https://en.wikipedia.org/wiki/ISO_3166-2:AU)

- [au-nsw.geojson](https://location-conflation.com/?locationSet=%7B%22include%22%3A%5B%22au-nsw.geojson%22%5D%7D&referrer=nsi) - New South Wales
- [au-qld.geojson](https://location-conflation.com/?locationSet=%7B%22include%22%3A%5B%22au-qld.geojson%22%5D%7D&referrer=nsi) - Queensland
- [au-sa.geojson](https://location-conflation.com/?locationSet=%7B%22include%22%3A%5B%22au-sa.geojson%22%5D%7D&referrer=nsi) - South Australia
- [au-vic.geojson](https://location-conflation.com/?locationSet=%7B%22include%22%3A%5B%22au-vic.geojson%22%5D%7D&referrer=nsi) - Victoria
- [au-wa.geojson](https://location-conflation.com/?locationSet=%7B%22include%22%3A%5B%22au-wa.geojson%22%5D%7D&referrer=nsi) - Western Australia
- [au-act.geojson](https://location-conflation.com/?locationSet=%7B%22include%22%3A%5B%22au-act.geojson%22%5D%7D&referrer=nsi) - Australian Capital Territory
- [au-nt.geojson](https://location-conflation.com/?locationSet=%7B%22include%22%3A%5B%22au-nt.geojson%22%5D%7D&referrer=nsi) - Northern Territory

repository: osmlab/name-suggestion-index

repo_name: osmlab/name-suggestion-index


text:
#### 3.0.6 - 07.09.2018
* Allows more flexible configuration

#### 3.0.5 - 17.11.2017
* Adds CosmosEventStorePlayer to the Player

#### 3.0.4 - 31.05.2017
* Changes ReplayDefinition UseProjection to use already registered projection

#### 3.0.3 - 31.05.2017
* Ignore adding projections that are already added

#### 3.0.2 - 31.05.2017
* Adds ability to register multiple projections for replay at once
* Removes throwing of exception when trying to use projection which is not registered

#### 3.0.1 - 31.05.2017
* Adds separation between registered projections and available projections for replay

#### 3.0.0 - 19.05.2017
* Removes replay rules
* Starts using IObserver

#### 2.0.4 - 19.05.2017
* Updates IReplayRulesManager register methods to return IReplayRulesManager

#### 2.0.3 - 19.05.2017
* Adds ability to register more then one rule at a time

#### 2.0.2 - 19.05.2017
* Moves IReplayRulesManager to be part of ReplayDefinition

#### 2.0.1 - 19.05.2017
* Changes replay fixes to replay definitions
* Adds replay rules

#### 2.0.0 - 18.05.2017
* Changes replay fixes to replay definitions
* Adds replay rules

#### 1.0.1 - 18.05.2017
* No longer replaying events. We are now replyaing AggregateCommits

#### 1.0.0 - 18.05.2017
* No longer replaying events. We are now replyaing AggregateCommits

#### 0.1.3 - 04.04.2017
* Adds ability to add multiple projections at same time

#### 0.1.2 - 11.10.2016
* Fixes namespaces

#### 0.1.1 - 11.10.2016
* Fixes nuget package

#### 0.1.0 - 11.10.2016
* Initial release


text:
# `zsh-autocomplete`
`zsh-autocomplete` adds **real-time type-ahead autocompletion** to Zsh. Find as you type, then
press Tab to insert the top completion, ShiftTab to insert the
bottom one, or ↓/PgDn to select another completion.

[![file-search](.img/file-search.gif)](https://asciinema.org/a/377611)

> Enjoy using this software? [Become a sponsor!](https://github.com/sponsors/marlonrichert).

## Other Features
Besides live autocompletion, `zsh-autocomplete` comes with many other useful completion features.

### Optimized completion config
Zsh's completion system is powerful, but hard to configure. So, `zsh-autocomplete` [does it for
you](scripts/.autocomplete.config), while providing a manageable list of [configuration
settings](.zshrc) for changing the defaults.

### Live history search
Press CtrlR or CtrlS to do live, multi-line history
search.

[![history-search](.img/history-search.gif)](https://asciinema.org/a/379844)

### History menu
Press ↑ (or Alt↑ or PgUp) to open a menu with the last
16 history items. If the command line is not empty, then the contents of the command line are used
to perform a fuzzy history search.

![history menu](.img/history-menu.png)

### Multi-selection
Press CtrlSpace in the completion menu or the history menu to insert more
than one item.

![multi-select](.img/multi-select.png)

### Recent dirs completion
Works out of the box with zero configuration, but also supports `zsh-z`, `zoxide`, `z.lua`,
`rupa/z.sh`, `autojump` and `fasd`.

![recent dirs](.img/recent-dirs.png)

## Key Bindings

On the command line:
| Key(s) | Action | [Widget](.zshrc) |
| ------ | ------ | --- |
| Tab | Accept top completion | `complete-word` |
| ShiftTab | Accept bottom completion | `complete-word` |
| CtrlSpace | Show additional completions | `list-expand` |
| ↓ | Cursor down (if able) or completion menu | `down-line-or-select` |
| PgDn / Alt↓ | Completion menu (always) | `menu-select` |
| ↑ | Cursor up (if able) or [history menu](#history-menu) | `up-line-or-search` |
| PgUp / Alt↑ | [History menu](#history-menu) (always) | `history-search` |
| CtrlR | [Live history search](#live-history-search), newest to oldest | `history-incremental-search-backward` |
| CtrlS | [Live history search](#live-history-search), oldest to newest | `history-incremental-search-forward` |

In the completion menu:
| Key(s) | Action |
| ------ | ------ |
| ↑ / ↓ / ← / → | Change selection |
| Alt↑ | Backward one group |
| Alt↓ | Forward one group |
| PgUp / PgDn | Page up/down |
| CtrlR | Full text search or previous search match |
| CtrlS | Full text search or next search match |
| CtrlSpace | Multi-select |
| Tab | Accept selection |
| ShiftTab | Accept bottom completion |
| Enter | Accept command line |
| most other keys | Accept selection, then perform usual action |

In the history menu:
| Key(s) | Action |
| --- | --- |
| ↑/↓ | Change selection |
| CtrlSpace | Multi-select |
| Tab | Accept selection |
| Enter | Accept command line |
| most other keys | Accept selection, then perform usual action |

## Requirements
Recommended:
* Tested to work with [Zsh](http://zsh.sourceforge.net) 5.7 or newer.

Minimum:
* Should theoretically work with Zsh 5.4 or newer, but I'm unable to test that.

## Installing & Updating
If you use [Znap](https://github.com/marlonrichert/zsh-snap), simply add the following to your
`.zshrc` file:
```zsh
znap source marlonrichert/zsh-autocomplete
```
Then restart your shell.

To update, do
```zsh
% znap pull
```

For configuration options, see the included [`.zshrc` file](.zshrc).

To uninstall, remove `znap source marlonrichert/zsh-autocomplete` from your `.zshrc` file, then run
```zsh
% znap uninstall
```

### Manual installation
 1. Clone the repo:
    ```zsh
    % cd ~/Git  # ...or wherever you keep your Git repos/Zsh plugins
    % git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
    ```
 1. Add at or near the top of your `.zshrc` file (_before_ any calls to `compdef`):
    ```zsh
    source ~/Git/zsh-autocomplete/zsh-autocomplete.plugin.zsh
    ```
 1. Remove any calls to `compinit` from your `.zshrc` file.
 1. If you're using Ubuntu, add to your `.zshenv` file:
    ```zsh
    skip_global_compinit=1
    ```
Then restart your shell.

To update, do:
```zsh
% git -C ~zsh-autocomplete pull
```

To uninstall, simply undo the installation steps above in reverse order:
 1. Restore the lines you deleted in step 3.
 1. Delete the line you added in step 2.
 1. Delete the repo you created in step 1.
Finally, restart your shell.

### Other Frameworks/Plugin Managers
To install with another Zsh framework or plugin manager, please refer to your
framework's/plugin manager's documentation for instructions.

## Troubleshooting
Try the steps in the [bug report template](.github/ISSUE_TEMPLATE/bug-report.md).

## Author
© 2020-2021 [Marlon Richert](https://github.com/marlonrichert)

## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

repository: amitarya/oh-my-zsh

repo_name: amitarya/oh-my-zsh


text:
+++
title = "Push the Code"
weight = 30
pre= "<b>5.1.3. </b>"
+++

### Ignore the build artifacts
Copy and paste the following lines at the end of the `sls-api/.gitgnore` file. There is no need to track the  .aws-sam directory or the packaged.yaml under version control as they are re-generated on every build.

```
.aws-sam/
packaged.yaml
```

In Cloud9, remember to enable hidden files:

![EnableHiddenFiles](/images/build-pipeline/screenshot-hidden-files-cloud9.png)

Open the `.gitignore` file and paste the two lines described above.

From the root directory of your _sls-api_ project, run the following commands:

```
cd ~/environment/sls-api
git init
git add .
git commit -m "Initial commit"
```

### Push the code
Add your CodeCommit repository URL as a _remote_ on your local git project. This is the `cloneUrlHttp` value that you got back after creating the repository in Step 1 of this chapter.

{{% notice tip %}}
If you can't find the CodeCommit repository URL, you can find it by running this command: `aws codecommit get-repository --repository-name sls-api`.
{{% /notice %}}

```
git remote add origin REPLACE_WITH_HTTP_CLONE_URL

# git remote set-url origin https://git-codecommit.ap-southeast-1.amazonaws.com/v1/repos/sls-api
```

{{% notice tip %}}
If you typed the origin url incorrectly, you can remove it by running: `git remote rm origin`.
{{% /notice %}}

Now, push the code:

```
git push -u origin master
```

### Verify in CodeCommit
Navigate to the [AWS CodeCommit console](https://console.aws.amazon.com/codesuite/codecommit/home), find your _sls-api_ repository and click on it to view its contents. Make sure your code is there. You should see a screen like the following:

![VerifyCodeCommit](/images/build-pipeline/screenshot-verify-codecommit.png)


text:
# aeproject fire-editor

## [Fire Editor aepp](http://fireeditor.nikitafuchs.de/) integration

The integration between the aeproject and the [Fire Editor aepp](http://fireeditor.nikitafuchs.de/) allows the user to compile and deploy contracts, call contract's function from different accounts using the **Fire Editor aepp**.

### Prerequisite

Please note that the *fire-editor* is running on top of Angular CLI 8.0+
The official Node.js version of *Angular CLI 8.0+* that is supported is **10.9.0** or greater

The Fire Editor aepp runs on [http://localhost:4200/](http://localhost:4200/) by default. There are two optional parameters to `aeproject fire-editor`:

* --update - update the Fire Editor aepp with the latest version;
* --ignorebrowser - ignoring opening of the browser;

license: ISC

repository: javascriptit/aepp-aeproject-js

repo_name: javascriptit/aepp-aeproject-js


text:
---
layout: default
---

# 1996-06-30 - Re: fbi botches intel "ecspionage" case

## Header Data

From: jim bell<EMAIL_ADDRESS>To: "Vladimir Z. Nuri"<EMAIL_ADDRESS>Message Hash: f974d65dfa80f537629da8e13e2c3c688443dc338b5457ab8c893ee174ccc031

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-06-30 02:31:55 UTC

Raw Date: Sun, 30 Jun 1996 10:31:55 +0800

## Raw message

```
{% raw  %}From: jim bell<EMAIL_ADDRESS>Date: Sun, 30 Jun 1996 10:31:55 +0800
To: "Vladimir Z. Nuri"<EMAIL_ADDRESS>Subject: Re: fbi botches intel "ecspionage" case
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

At 12:25 PM 6/29/96 -0700, Vladimir Z. Nuri wrote:
>
>"economic espionage" (ecspionage?) is in full swing as being
>promoted as the new bogeyman to justify spending billions of
>dollars to our intelligence agencies, both military and
>the FBI.
>we already have a very good example where this has
>backfired. I was watching Nightline on Tues night or
>so in which there was info about how the FBI helped
>get an informant into Intel in a *very* sensitive
>position, where he was able to film the pentium chip
>plans. he said he sold them, as I recall,
>to iraq, syria, china, etc.
[snip]
>I was thinking about all the objections I had to the
>FBI ecspionage treatment that were never raised on the
>program:

>1. there was an implicit assumption that merely having
>the plans to the chip would allow other countries to somehow
>slaughter us in economic competition. but INTEL has spent
>billions of dollars on physical infrastructure without which
>the plans are virtually useless. it would take other countries
>years to get the kind of equipment necessary to produce the
>pentium, by which it might actually be yesterday's technology
>that no one cares about any more.

It's worse than this.  I can recall talk of a big problem WITHIN INTEL
trying to tranfer the process to produce a part between (as I recall) two
Intel semiconductor fabs,  Fab IV and Fab V, which are buildings only a
couple hundred feet apart!  And obviously, this was done with the full
cooperation of everyone within Intel, and did not require the interfacing
with any other company.  The idea that you can just steal the "plans" for a
chip and build it yourself is crazy.

>2. we have a tradition of separation of church and state in
>this country, and also separation of the public government
>and private industry. suddenly we have the FBI saying they
>want to infiltrate companies to deal with economic espionage.
>well, these companies have their own policy, and what do
>they gain by having a government agency working inside them?
>in the above case I note, it led to exactly the *opposite*
>of what was intended: the theft of *highly*sensitive* plans
>by an FBI mole.

I was even more disgusted with the FBI:  I kept hearing them claim, "We did
not authorize him to break the law."   Huh?!?  Maybe they didn't, this time,
but does this mean, implicitly, that this country has sunk so low that the
FBI thinks it has the legal authority to "authorize" somebody to break the
law?????

Jim Bell
<EMAIL_ADDRESS>

{% endraw %}
```

## Thread

+ Return to [June 1996](/archive/1996/06)

+ Return to "[jim bell <jimbell@pacifier.com>](/authors/jim_bell_jimbell_at_pacifier_com_)"
+ Return to "["Vladimir Z. Nuri" <vznuri@netcom.com>](/authors/vladimir_z_nuri_vznuri_at_netcom_com_)"

+ 1996-06-30 (Sun, 30 Jun 1996 10:31:55 +0800) - Re: fbi botches intel "ecspionage" case - _jim bell<EMAIL_ADDRESS>  + 1996-06-30 (Sun, 30 Jun 1996 11:23:32 +0800) - [Re: fbi botches intel "ecspionage" case](/archive/1996/06/bd097be06d9d32df92969c68b8aca0343379c65bca315db3357bc335f63c2c0d) - _"Vladimir Z. Nuri"<EMAIL_ADDRESS>


text:
Description
===========

This is a [express](https://github.com/strongloop/express) web application for hosting my chrome extension file.

Installation
============

Clone the repository
```sh
git clone https://github.com/dreamingblackcat/oneclick-fontchanger-site.git
```
cd into the directory
```sh
cd oneclick-fontchanger-site
```
Run app/server.js with node.
```sh
node app/server.js
```

The code was written with mainly coffeescript. It was meant to host on heroku free account. So, I used [nedb](https://github.com/louischatriot/nedb.git)


text:
# Run as service on Debian based distro

## Using systemd

!!! warning
    Make sure to follow the instructions to [install from binary](binary.md) before.

To create a new service, paste this content in `/etc/systemd/system/swarm-cronjob.service`:

```
[Unit]
Description=swarm-cronjob
Documentation={{ config.site_url }}
After=syslog.target
After=network.target

[Service]
RestartSec=2s
Type=simple
User=swarmcronjob
Group=swarmcronjob
ExecStart=/usr/local/bin/swarm-cronjob
Restart=always
#Environment=TZ=Europe/Paris

[Install]
WantedBy=multi-user.target
```

Change the user, group, and other required startup values following your needs.

Enable and start swarm-cronjob at boot:

```shell
sudo systemctl enable swarm-cronjob
sudo systemctl start swarm-cronjob
```

To view logs:

```shell
journalctl -fu swarm-cronjob.service
```

repository: crazy-max/swarm-cronjob

gha_language: Go

repo_name: crazy-max/swarm-cronjob


text:
# ML.NET 1.0.0-preview Release Notes

This release is `Release Candidate` for version `1.0.0` of [ML.NET](https://aka.ms/mlnet). We have closed our main [API project](https://github.com/dotnet/machinelearning/projects/13). The next release will be `1.0.0` and during this sprint we are focusing on improving documentation and samples and consider addressing major critical issues. The goal is to avoid any new breaking changes going forward. One change in this release is that we have moved `IDataView` back into `Microsoft.ML` namespace based on some feedback that we received.

### Installation

ML.NET supports Windows, MacOS, and Linux. See [supported OS versions of .NET Core 2.0](https://github.com/dotnet/core/blob/master/release-notes/2.0/2.0-supported-os.md) for more details.

You can install ML.NET NuGet from the CLI using:
```
dotnet add package Microsoft.ML
```

From package manager:
```
Install-Package Microsoft.ML
```

### Release Notes

Below are a few of the highlights from this release. There are many other improvements in the API.

* Move `IDataView` into `Microsoft.ML` namespace. ([#2987](https://github.com/dotnet/machinelearning/pull/2987))
* Move KeyType, VectorType and VBuffer to `ML.DataView`. ([#3022](https://github.com/dotnet/machinelearning/pull/3022))
* Remove ConcurrencyFactor from `IHostEnvironment`. ([#2846](https://github.com/dotnet/machinelearning/pull/2846))
* More work in reorganizing namespaces related to issue: ([#2751](https://github.com/dotnet/machinelearning/issues/2751))
* Remove Value-tuples in the public API. ([#2950](https://github.com/dotnet/machinelearning/pull/2950))
* Categorizing NuGets into preview and stable. ([#2951](https://github.com/dotnet/machinelearning/pull/2951))
* Hiding `ColumnOptions`. ([#2959](https://github.com/dotnet/machinelearning/pull/2959))
* Asynchronous cancellation mechanism. ([#2797](https://github.com/dotnet/machinelearning/pull/2797))

### Acknowledgements

Shoutout to [MarcinJuraszek](https://github.com/MarcinJuraszek),
[llRandom](https://github.com/llRandom),
[jwood803](https://github.com/jwood803), [Potapy4](https://github.com/Potapy4) and the [ML.NET](https://aka.ms/mlnet) team for their
contributions as part of this release!

repository: dotnet/machinelearning

repo_name: dotnet/machinelearning


text:
# Ansible Bastion

A dockerized SSH and SOCKS5 bastion for Ansible.

## Getting Started

These instructions will cover usage information and for the docker container

### Prerequisities

In order to run this container you'll need docker installed.

* [Windows](https://docs.docker.com/windows/started)
* [OS X](https://docs.docker.com/mac/started/)
* [Linux](https://docs.docker.com/linux/started/)

### Usage

#### Examples

Import public keys from file.keys and use ports 22/2222.

```shell
docker run -d -p 22:22 -p 2222:2222 -e AUTHORIZED_KEYS_FILE=/file.keys -v /path/to/file.keys:/file.keys arcts/ansible-bastion
```

Import public keys from file.keys, use existing host keys, and random ports.

```shell
docker run -d -P -e AUTHORIZED_KEYS_FILE=/file.keys -v /path/to/file.keys:/file.keys -e HOST_KEYS_DIR=/host_keys -v /path/to/host_keys:/host_keys arcts/ansible-bastion
```

#### Environment Variables

* `AUTHORIZED_KEYS` - A string containing authorized keys
* `AUTHORIZED_KEYS_FILE` - Specifies a file containing authorized keys to import. You will also need to mount the file inside the container
* `HOST_KEYS_DIR` - Specifies a directory to import SSH host keys from. This will only import keys that start with ssh_host_

repository: umich-arc/ansible-bastion

repo_name: umich-arc/ansible-bastion


text:
# go-rpg-cgm
GoLang 2D RPG Game - Chandragupta Maurya (CGM)

Please feel free to connect;
- [twitter.com/ajinkyax](https://twitter.com/ajinkyax)
- Telegram me **@ajinkyax** [LINK](http://tg//msg?text=Hello&to=@ajinkyax)

## Setup (Install)
`go get -v ...`
OR
`go get -v all`

## DEMO
[![Go RPG](https://img.youtube.com/vi/XBQ6jMGGk_Y/0.jpg)](https://www.youtube.com/watch?v=XBQ6jMGGk_Y)

# Pending Tasks

## 1. Working on Town map - (difficult)
   - Town map inn NPC (e.g. enter house inside map see devlog video 03)
   - cave map quest
   - random encounters in town
  - persisting game state
## 2. Bug - At Menu screen XP box is going out of screen (easy)
## 3. replace Storyboard reflect type with Enum Match (medium)


text:
### new emails

1. add a new template file in `assets/emails/` and follow this naming schema
for the file name: `[template_name].tmpl`.
2. add the email's subject to the `email.yml` strings file and follow this
naming schema for the key name: `[template_name]_subject`.
3. update the `EMAIL` variable in `message.ts`.
4. update the `TEMPLATES` variable in `email.ts`.

repository: consumr-project/cp

repo_name: consumr-project/cp


text:
# java-annotation-presentation

Presentation used on webinar on Feb 4th.

You can find more information about this presentation on [zielony-backlog.pl](https://zielony-backlog.pl/blog/2021/02/08/jak-przygotowac-prezentacje-o-javie/)


text:
# ONNX Simplifier

[![PyPI version](https://img.shields.io/pypi/v/onnx-simplifier.svg)](https://pypi.python.org/pypi/onnx-simplifier/)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/onnx-simplifier.svg)](https://pypi.python.org/pypi/onnx-simplifier/)
[![PyPI license](https://img.shields.io/pypi/l/onnx-simplifier.svg)](https://pypi.python.org/pypi/onnx-simplifier/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/daquexian/onnx-simplifier/pulls)

_ONNX is great, but sometimes too complicated._

## Background

One day I wanted to export the following simple reshape operation to ONNX:

```python
import torch

class JustReshape(torch.nn.Module):
    def __init__(self):
        super(JustReshape, self).__init__()

    def forward(self, x):
        return x.view((x.shape[0], x.shape[1], x.shape[3], x.shape[2]))

net = JustReshape()
model_name = 'just_reshape.onnx'
dummy_input = torch.randn(2, 3, 4, 5)
torch.onnx.export(net, dummy_input, model_name, input_names=['input'], output_names=['output'])
```

The input shape in this model is static, so what I expected is

![simple_reshape](imgs/simple_reshape.png)

However, I got the following complicated model even after
[polishing](https://github.com/onnx/onnx/blob/master/docs/PythonAPIOverview.md#polishing-the-model):

![complicated_reshape](imgs/complicated_reshape.png)

Moreover, there are also some operations performed on weights (like
[this](https://github.com/JDAI-CV/DNNLibrary/issues/17#issuecomment-455934190)), which
can all be eliminated by offline computation.

## Our solution

ONNX Simplifier is presented to simplify the ONNX model. It infers the whole computation graph
and then replaces the redundant operators with their constant outputs.

### Web version

We have published ONNX Simplifier on https://convertmodel.com. It works out of the box and **doesn't need any installation**. Just open the webpage, choose ONNX as the output format, check the onnx simplifier and then select your model to simplify. Note that **the web version is in its very early stage**, if the web version doesn't work well for you, you can install the Python version following the instructions below.

### Python version

```
pip3 install -U pip && pip3 install onnx-simplifier
```

Then

```
python3 -m onnxsim input_onnx_model output_onnx_model
```

For more functions like skipping optimization and setting input shape manually (when input shape is dynamic itself), try the following command for help message

```
python3 -m onnxsim -h
```

## Demonstration

An overall comparison between
[a complicated model](https://github.com/JDAI-CV/DNNLibrary/issues/17#issuecomment-455934190)
and its simplified version:

![Comparison between old model and new model](imgs/comparison.png)

## In-script workflow

If you would like to embed ONNX simplifier python package in another script, it is just that simple.

```python
import onnx
from onnxsim import simplify

# load your predefined ONNX model
model = onnx.load(path + model_name + '.onnx')

# convert model
model_simp, check = simplify(model)

assert check, "Simplified ONNX model could not be validated"

# use model_simp as a standard ONNX model object
```

You can see more details of the API in [onnxsim/\_\_main\_\_.py](onnxsim/__main__.py)