text:
[online demo]: http://latex2unicode.herokuapp.com/
[demo source]: https://github.com/tomtung/latex2unicode-demo
[PEG]: https://en.wikipedia.org/wiki/Parsing_expression_grammar
[fastparse]: http://www.lihaoyi.com/fastparse
[latex-to-unicode by ypsu]: https://github.com/ypsu/latex-to-unicode
[latex-to-unicode by vikhyat]: https://github.com/vikhyat/latex-to-unicode

# LaTeX2Unicode [![Build Status](https://github.com/tomtung/latex2unicode/actions/workflows/scala.yml/badge.svg)](https://github.com/tomtung/latex2unicode/actions/workflows/scala.yml)

LaTeX2Unicode translates LaTeX markup to human readable Unicode when possible. Here's an [online demo] that can be conveniently used to type in special characters. ([demo source])

Basic math notations are supported. For instance:

```
\because \t{AB} + \t{BC} \neq \t{AC}
\therefore \iint\sqrt[4]{\xi^{\theta+1}} - \frac 38 \le
\Sigma \zeta_i \\
\therefore \exists{x}\forall{y} x \in \^A
```

is converted to

> ∵ A͡B + B͡C ≠ A͡C ∴ ∬∜ξ̅ᶿ̅⁺̅¹̅ - ⅜ ≤ Σ ζᵢ

> ∴ ∃x∀y x ∈ Â

Hundreds of other symbols and special characters are supported, too. For example, `\spadesuit`, `\aleph`, `\OE`, `\downdownarrows` and `\o` are translated to `♠`, `ℵ`, `Œ`, `⇊`, `ø`, respectively.

Some font styles are supported, too. For instance:

```
\textbb{Black Board Bold}, \textfrak{Fraktur},
{\bf Bold Face}, {\cal Calligraphic}, {\it Italic},
{\tt Monospace}
```

is translated to

> 𝔹𝕝𝕒𝕔𝕜 𝔹𝕠𝕒𝕣𝕕 𝔹𝕠𝕝𝕕, 𝔉𝔯𝔞𝔨𝔱𝔲𝔯, 𝐁𝐨𝐥𝐝 𝐅𝐚𝐜𝐞, 𝓒𝓪𝓵𝓵𝓲𝓰𝓻𝓪𝓹𝓱𝓲𝓬, 𝐼𝑡𝑎𝑙𝑖𝑐, 𝙼𝚘𝚗𝚘𝚜𝚙𝚊𝚌𝚎

# Using as Scala / Java Library

LaTeX2Unicode is written in Scala, thus can serve as a 3rd party library in any JVM application that needs to extract information from LaTeX texts (e.g. BibTeX).

## Simple Conversion

For simple conversion without configuration, which works fine in most cases, one call to a static method and you're done.

In Scala:

```scala
import com.github.tomtung.latex2unicode._

val latex = "\\ss^2 + \\alpha_3 \n \\div \\frac{1}{3} = \\sqrt[3]{123}"
val unicode = LaTeX2Unicode.convert(latex)
println(unicode)
```

In Java:

```java
import com.github.tomtung.latex2unicode.LaTeX2Unicode;

String latex = "\\ss^2 + \\alpha_3 \n \\div \\frac{1}{3} = \\sqrt[3]{123}"
String unicode = LaTeX2Unicode.convert(latex)
System.out.println(unicode);
```

## Maven / SBT Dependency

To add dependency on LaTeX2Unicode, insert the following to your `pom.xml` file if you use Apache Maven:

```xml
<dependency>
    <groupId>com.github.tomtung</groupId>
    <artifactId>latex2unicode_2.12</artifactId>
    <version>0.3.2</version>
</dependency>
```

or add the following to your `build.sbt` file if you use sbt 0.11+:

```scala
libraryDependencies += "com.github.tomtung" %% "latex2unicode" % "0.3.2"
```
# Credits

LaTeX2Unicode is inspired by two similar projects, [latex-to-unicode by ypsu] \(written in Python\) and [latex-to-unicode by vikhyat] \(written in Ruby\).

LaTeX2Unicode is built on [fastparse], an fast and elegant [PEG] parsing framework.

# Licence

Apache License Version 2.0

gha_language: Scala


text:
# Antoloji.com-Poem-Scraping
This script is small poem scraping library for antoloji.com.

# Installation
Execute following comment in project directory
```
npm install
```

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
---
layout: post
title: FOSS4G NA Summary

---
### It was my first time at a FOSS4G conference and I really enjoyed it. Here are my favorite talks.

---

## Favorite Talks

### Monday, May 2

#### [Zero to web map!](https://2016.foss4g-na.org/session/zero-web-map)
This was a well put together hands-on workshop that introduced the concepts of web mapping using Mapbox, adding data to the map using GeoJSON, handling pop-ups, map interactions, using the Geolocation API and mapping directions. In the end, you actually build a semi-useful mapping [web app](http://blog.rikitraki.com/web_mapping_workshop/) in just a few hours (note that if you are too far from Raleigh, NC, the walking directions API will not work due to maximum distance limitation 😃).

I was already familiar with most of the concepts taught, but I did learn a bunch of useful bits including the OpenStreetMap Overpass API (including overpass-turbo), using the prose.io editor to directly edit Github content, and the Mapzen directions API. Plus, I really enjoyed Will's presentation style, quality, and pace.

### Tuesday, May 3

#### [Mapping the Planet from Outer Space](https://2016.foss4g-na.org/session/mapping-planet-outer-space)
Excellent introduction to NASA's [Global Imagery Browse Services (GIBS)](https://wiki.earthdata.nasa.gov/display/GIBS), the type of imagery available and how was the service built -- all code is open source and the imagery data is freely available to the public.

The speakers offered a nice overview of NASA's Earth Observation missions since the 1960's to present time, and how the quality of the imagery has drastically improved over the years.

The presentation also gave tons of great examples of how the imagery is being used today: air quality, tropical storms, ocean currents, flooding, sand storms and even visual arts!

RikiTraki project idea: near real-time visualization overlay of forest fires in the vicinity of a trail of interest.

#### [Valhalla - A Tiled Hierarchical Open-Source Routing Solution](https://2016.foss4g-na.org/session/valhalla-tiled-hierarchical-open-source-routing-solution)
This presentation introduced the Mapzen Valhalla Open Source multi-modal routing engine. The engine is used by the [Mapzen Turn-by-Turn](https://mapzen.com/products/turn-by-turn/?d=0&lat=40.7259&lng=-73.9805&z=12&c=multimodal&st_lat=37.737089&st_lng=-122.504467&st=SF%20Zoo&end_lat=37.80927&end_lng=-122.25981&end=699%20Bellevue%20Avenue%2C%20Oakland%2C%20CA%2C%20USA&use_bus=0.5&use_rail=0.6&use_transfers=0.4&dt=2016-07-18T08%3A00&dt_type=1) product, which is a hosted, free service with a very friendly API -- BTW, this service was the one used in the [Zero to Webmap!](#zerowebmap) workshop described above and it was really easy to use). [Here](http://valhalla.github.io/demos/routing/index.html#loc=14,45.996276,-121.809626&directionsoptions={"language":"en-US"}&costing="pedestrian"&directionsoptions={"language":"en-US"}) is a demo.

The API has some really interesting features such as route costing options (e.g., a bike route may want to offer less elevation gain), elevation profile of routes, and mobile optimizations like routing tiles.

I am seriously considering to add the routing capability to RikiTraki in two ways: a) getting to the trailhead, and b) creating a hiking or biking track on the fly since the Valhalla routing engine can route using OpenStreetMap trail data!

#### [Visualizing GPS Tracks with RikiTraki](https://2016.foss4g-na.org/session/visualizing-gps-tracks-rikitraki)

Hey, I really liked this presentation, especially because I was looking at the audience and not at the presenter! 😋

### Wednesday, May 4

#### [3D Tiles: Beyond 2D Tiling](https://2016.foss4g-na.org/session/3d-tiles-beyond-2d-tiling)

It was really great to attend one of the presentations given by the Cesium team! They described their proposal for 3D tiling as an open standard. 3D tiling is an data structure organization standard for storing and high performance streaming of 3D data. One example usage of 3D tiling is the creation of [visualization models for cities](https://cesiumjs.org/NewYork/index.html?view=-74.01931188565507%2C40.69274729396973%2C696.4681325179864%2C21.27912961153516%2C-21.34255089763543%2C0.07177796178673282) generated from building data (e.g., OpenStreetMap or Government entities). And the best part is that the Cesium team is implementing the standard as part of [Cesiumjs](https://cesiumjs.org) library! Go Cesium!

#### [OGC SensorThings API - Open IoT Made Easy](https://2016.foss4g-na.org/session/ogc-sensorthings-api-open-iot-made-easy)
The presenter gave an overview of the SensorThings API, an Open Geospatial Consortium (OGC) standard for interconnecting and accessing Internet of Things (IOT) devices.

The API definition slightly departs from pure REST by using a parenthesized representation of identities (with query functionality) instead of strictly hierarchical resources representations. It also includes a semantic model mostly based on the OGC Observations and Measurements standard. There is also an open source project called Whiskers that implements the standard in Javascript.

The project looks interesting but it is not clear how much traction it has, given that the entire IOT domain is evolving very rapidly and it is quite unstable at the present time. Besides, I did not like the not so RESTful API.

#### ["Hiroshima Archive" and disaster digital archives series](https://2016.foss4g-na.org/session/hiroshima-archive-and-disaster-digital-archives-series)
Hidenori Watanave introduced an interactive visualization of the Hiroshima nuclear bombing. Using the Cesium 3D library, the web application presents a compilation of historical documentation such as maps, photographs, survivor accounts and statistical information about the attack.

I think that [this web application](http://hiroshima.archiving.jp/index_en.html) is a very creative usage of 3D geographical visualization techniques and it very effectively conveys the terrible human impacts of nuclear warfare.

#### [Bringing OpenStreetMap to the third dimension with 3D Tiles and Cesium](https://2016.foss4g-na.org/session/bringing-openstreetmap-third-dimension-3d-tiles-and-cesium)
This was a great follow on presentation to the [3D Tiles session](#3dtiles). Matthew Amato went through the process he followed to grab OpenStreetMap data and turning it into [3D model of New York City](http://cesiumjs.org/NewYork). The result is amazing, especially considering that the OpenStreetMap data was not meant for this!

### Thursday, May 5

#### [Managing National Park Service Basemap Data with OpenStreetMap Tools](https://2016.foss4g-na.org/session/managing-national-park-service-basemap-data-openstreetmap-tools)
It was great to meet in person the team behind the National Park Service digital mapping capabilities!

The presenter, Jim McAndrew, told me that NPS trail data will be freely available soon -- I would definitely like to incorporate the data into RikiTraki in a visualization layer.

#### [Crowdsource logging roads using OSM](https://2016.foss4g-na.org/session/crowdsource-logging-roads-using-osm)
Construction of logging roads is a good indicator of tropical forest destruction. This group created a capability based on the OpenStreetMap (OSM) and the Humanitarian OSM team tool suite to identify and map logging roads that would otherwise be unknown. The data and visualizations enable researchers to understand ecosystem impacts and also identify illegal logging activities.

#### [Running Docker Containers in Development AND Production](https://2016.foss4g-na.org/session/running-docker-containers-development-and-production-sponsored-red-hat)
This presentation went over the next generation OpenShift platform, which is based on Kubernetes and Docker. The reason I found this presentation enlightening is the fact that RikiTraki is currently hosted in OpenShift online, so I was very interested on learning about the upcoming upgrade to the hosting platform.

---

## Other pretty good talks

### Monday, May 2

#### [Introduction to an Open Source GIS Desktop: QGIS](https://2016.foss4g-na.org/session/introduction-open-source-gis-desktop-qgis)
QGIS is a pretty powerful package, but frankly it is a bit complex and hard to use. This workshop was informational, but it could have been delivered more gently.

### Tuesday, May 3

#### [I see NoSQL document stores in geospatial applications](https://2016.foss4g-na.org/session/i-see-nosql-document-stores-geospatial-applications-sponsored-ibm)
An intro to IBM's Cloudant service.

#### [Open Source Photogrammetry with OpenDroneMap](https://2016.foss4g-na.org/session/open-source-photogrammetry-opendronemap)

How to take imagery captured with drones (and balloons and kites) and transform it into structured 3D data using [OpenDroneMap](https://github.com/OpenDroneMap/OpenDroneMap).

### Wednesday, May 4

#### [A Platform for Data Interoperability: Koop](https://2016.foss4g-na.org/session/open-source-photogrammetry-opendronemap)
Koop is an open source project for translating multiple geo formats.

#### [Cartography with Inkscape](https://2016.foss4g-na.org/session/cartography-inkscape)
Take the output from QGIS and import it into Inkscape for further manipulation and production of a final printable map.

#### [OpenSensorHub for SensorWebs and IoT](https://2016.foss4g-na.org/session/opensensorhub-sensorwebs-and-iot)
Showed some really cool IoT examples.

#### [Cheet'n Death - Tracking Predators in the 'open' Kalahari](https://2016.foss4g-na.org/session/cheetn-death-tracking-predators-open-kalahari)
Tracking and mapping Cheetahs in the Kalahari.

#### [Introduction to GTFS: The Standardized Transit Data Feed](https://2016.foss4g-na.org/session/introduction-gtfs-standardized-transit-data-feed)
Intro to the transit feed standard developed in Portland, OR.

### Thursday, May 5

#### [Point cloud web services with Greyhound, Entwine, and PDAL](https://2016.foss4g-na.org/session/point-cloud-web-services-greyhound-entwine-and-pdal)
Open source capabilities for processing point cloud data.

#### [The Contemporary Geospatial Webapp: Embracing React, Webpack, ES6, Node.js](https://2016.foss4g-na.org/session/contemporary-geospatial-webapp-embracing-react-webpack-es6-nodejs)
Described experiences with this software stack for developing geo web apps.

---
Ok, that's it for now. I learned a lot at this conference. I hope to have the chance to attend another FOSS4G conference in the future!


text:
# Contributing to Pentest image

Want to contribute to docker image? We provide the next guide to help you get started.

## Reporting Issues

A great way to contribute to the project is to send a detailed report when you encounter an issue. To make things easier for contributors and maintainers, we use github issues option.

Please make sure to include a reproduction repository so that bugs can be reproduced without great efforts. The better a bug can be reproduced, the faster we can start fixing it!

## Pull Requests

We'd love to see your pull requests, even if it's just to fix a typo!

However, any significant improvement should be associated to an existing feature request or bug report.

gha_license_id: MIT


text:
### Projects

[Android Mobile App](https://github.com/thedavidang/CSC4151)
- A budget tracking mobile application to keep track of spending and expenses
- Utilized HelloCharts library to display spending data in a line and pie chart
- made with Android Studio and Kotlin

[Calculator App](https://github.com/jasond299/calculator_app)
- Calculator application
- made with HTML,CSS, Vanilla JS

[Rock, Paper, Scissors game](https://github.com/jasond299/rock_paper_scissors)
- A Rock Paper Scissors game implemented with HTML, CSS, and Javascript


text:
---
layout: default
---

# 1995-12-28 - Re: Encrypted script - sort of

## Header Data

From<EMAIL_ADDRESS>(Mark)

To<EMAIL_ADDRESS>(Laszlo Vecsey)

Message Hash: 73f54dc9e8542ad0b385e211007967f4e4518310a41fa680f95d73edc44b9ffb

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1995-12-28 12:48:00 UTC

Raw Date: Thu, 28 Dec 1995 20:48:00 +0800

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Mark)
Date: Thu, 28 Dec 1995 20:48:00 +0800
To<EMAIL_ADDRESS>(Laszlo Vecsey)
Subject: Re: Encrypted script - sort of
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text

>> >A tale I hear is that when HP had to deliver operating system source to
>> >the french government they stripped all comments and changed all variable
>> >and subroutine names to 32 byte strings of I 1 0 (zero) and O (uppercase O).
>> >It still compiled but was 100% useless to human readers.
>
>A somewhat useful utility would be one that would compress C code into as
>small space as possible, stripping out all spaces and making variable
>names one character a piece when possible. And of course one to expand it
>back into 'formatted' text, style could even be incorporated.
>
>I'm sure a Perl fanatic knows a quick solution... I'm always amazed at
>how short Perl code is.. :)   Anyone care to take care of this utility?

press.c has been circulating for several years. I dont know of an unpress.c
but a beautifier would do the same thing.

{% endraw %}
```

## Thread

+ Return to [December 1995](/archive/1995/12)

+ Return to "[jim bell <jimbell@pacifier.com>](/authors/jim_bell_jimbell_at_pacifier_com_)"
+ Return to "[Laszlo Vecsey <master@internexus.net>](/authors/laszlo_vecsey_master_at_internexus_net_)"
+ Return to<EMAIL_ADDRESS>(Mark)](/authors/mark_at_ausnetinfo_com_au_mark_)"

+ 1995-12-22 (Sat, 23 Dec 1995 07:16:17 +0800) - [Re: ex encrypted script](/archive/1995/12/9c9108457243252273e34ffb617799a6ec8502bda982060ce60acdecbc05d347) - _jim bell<EMAIL_ADDRESS>  + 1995-12-23 (Sat, 23 Dec 1995 21:49:46 +0800) - [Encrypted script - sort of](/archive/1995/12/6fadd1acb218af3c7e35ece4149447131c26ccd9cbf4f2fc6f0cfcc376684930) - _Laszlo Vecsey<EMAIL_ADDRESS>    + 1995-12-28 (Thu, 28 Dec 1995 20:48:00 +0800) - Re: Encrypted script - sort of -<EMAIL_ADDRESS>(Mark)_


text:
![Apollo-Core CI Java Repository](https://github.com/Apollo-Core/EE-Guice/workflows/Apollo-Core%20CI%20Java%20Repository/badge.svg)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c4ee791652fe46c281a4611dfdd50676)](https://app.codacy.com/gh/Apollo-Core/EE-Guice?utm_source=github.com&utm_medium=referral&utm_content=Apollo-Core/EE-Guice&utm_campaign=Badge_Grade_Settings)
[![](https://jitpack.io/v/Apollo-Core/EE-Guice.svg)](https://jitpack.io/#Apollo-Core/EE-Guice)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# EE-Guice

Repository defining the main modules used to implement the dynamic dependency injection used in the Apollo EE.

repository: ChristianChiste/EE-Guice

branch_name: refs/heads/main

gha_license_id: NOASSERTION

repo_name: ChristianChiste/EE-Guice


text:
Cuckoo Cycle
============
Whitepaper at https://github.com/tromp/cuckoo/blob/master/doc/cuckoo.pdf?raw=true

Recent blog article explaining Cuckoo Cycle at http://cryptorials.io/beyond-hashcash-proof-work-theres-mining-hashing

This repo is Linux based. Microsoft Windows friendly code at https://github.com/Genoil/cuckoo

Cuckoo Cycle is the first graph-theoretic proof-of-work,
and by far the most memory bound, with memory latency
dominating the mining runtime, yet with instant verification.

Proofs take the form of a length 42 cycle in a bipartite graph
with N nodes and N/2 edges, with N scalable from millions to billions and beyond.

This makes verification trivial: compute the 42x2 edge endpoints
with one initialising sha256 and 84 very cheap siphash-2-4 hashes,
check that each endpoint occurs twice, and that you come back to the
starting point only after traversing 42 edges
(this also makes Cuckoo Cycle, unlike Hashcash, relatively immune from Grover's quantum search algorithm).

A final sha256 hash on the sorted 42 nonces can check whether the 42-cycle meets a difficulty target.

This is implemented in just 157 lines of C code (files src/cuckoo.h and src/cuckoo.c).

From this point of view, Cuckoo Cycle is a very simple PoW,
requiring hardly any code, time, or memory to verify.

Finding a 42-cycle, on the other hand, is far from trivial,
requiring considerable resources, and some luck
(for a given header, the odds of its graph having a 42-cycle are about 2.5%).

Where Satoshi Nakamoto aimed for "one-CPU-one-vote", Cuckoo Cycle aims for
1 memory bank + 1 virtual core = 1 vote
--------------

The algorithm implemented in cuckoo_miner.h runs in time linear in N.
(Note that running in sub-linear time is out of the question, as you could
only compute a fraction of all edges, and the odds of all 42 edges of a cycle
occurring in this fraction are astronomically small).

Memory-wise, it uses N/2 bits to maintain a subset of all edges (potential cycle edges)
and N additional bits (or N/2^k bits with corresponding slowdown)
to trim the subset in a series of edge trimming rounds.
This is the phase that takes the vast majority of (latency dominated) runtime.

Once the subset is small enough, an algorithm inspired by Cuckoo Hashing
is used to recognise all cycles, and recover those of the right length.

The runtime of a single proof attempt on a high end x86 is 5.5min/GB single-threaded, or 1.5min/GB for 8 threads.

I claim that this implementation is a reasonably optimal Cuckoo miner,
secondly, that trading off memory for running time, as implemented in tomato_miner.h,
incurs at least one order of magnitude extra slowdown,
and finally, that cuda_miner.cu is a reasonably optimal GPU miner.
The latter runs about 4x-5x faster on an NVIDA GTX 980 than on an Intel Core-i7 CPU.
To that end, I offer the following bounties:

CPU Speedup Bounty
--------------
$500 for an open source implementation that finds 42-cycles twice as fast, possibly using more memory.

Linear Time-Memory Trade-Off Bounty
--------------
$500 for an open source implementation that uses at most N/k bits while running up to 15 k times slower,
for any k>=2.

Both of these bounties require N ranging over {2^28,2^30,2^32} and #threads ranging over {1,2,4,8},
and further assume a high-end Intel Core i7 or Xeon and recent gcc compiler with regular flags as in my Makefile.

GPU Speedup Bounty
--------------
$500 for an open source implementation for a consumer GPU combo
that finds 42-cycles twice as fast as cuda_miner.cu on comparable hardware.
Again with N ranging over {2^28,2^30,2^32}.

These bounties are to expire at the end of 2016. They are admittedly modest in size, but then
claiming them might only require one or two insightful tweaks to my existing implementations.

I invite anyone who'd like to see my claims refuted to extend any of these bounties
with amounts of your crypto-currency of choice.

(I don't have any crypto-currencies to offer myself, but if need be, I might be able to convert
a bounty through a trusted 3rd party)

Happy bounty hunting!

-John

repository: Genoil/cuckoo

repo_name: Genoil/cuckoo


text:
# gaussianoscillators.org

This repo contains the source code for the (future!)
[gaussianoscillators.org](http://gaussianoscillators.org) website.  This is the
companion website for the paper "Visualizing uncertain curves and surfaces via
Gaussian Oscillators", which is currently under review.


text:
## Beam Analysis
The Beam Analysis is based on the PlotXY widget and gives some options to the user. The idea of this widget is to extract from ShadowOui better figures, with meaninful results. For instance, it is possible calculate not only the beam full-width-half-maximum (FWHM), but also its root-mean-square (RMS), mean value, peak position and data range. The 1D slices may be the 1D histogram (as plotXY), or a cut at a given position (a few options are implemented: cut at (0,0), at peak position, at mean value or at a user given position). It can also fit the beam profile to gaussian and lorentzian distributions (and their sum). All the properties mentioned can be calculated for the fitted distribution as well.

Apart from the statistical calculations, it is also possible to customize the axis labels, add a small text with a description of the simulation to the figure, and show up to 3 texts in the figure (with beam size, for example). The figure can then be exported to a png file. The 2D histogram can also be exported as a matrix that can be readily imported in python, excel, or anything else.

![BAgui](https://github.com/oasys-lnls-kit/OASYS1-LNLS-ShadowOui/blob/master/images/BeamAnalysisGUI.png "BAGUI")

### Options (Calculations Settings Tab)

#### Plot Controls

1. Slices: the 1D slices showing the X and Y intensities profiles can be the 1D histogram (as in plotXY) or a cut at a given position (where cut means a single line or column of the 2D histogram). The implemented options are: cut at (0,0), at peak position, at mean value or at a user given position.

2. Total Flux (Power) in ph/s (Watt): if you know the total flux (or power) at the image plane, use this to input its value in ph/s (or Watt). The ordinates axis of the 1D plots will show then the flux or power distribution. If the Slices are any of the cut options, the units will be ph/s/mm^2 or W/mm^2 (or ph/s/um^2 or W/um^2, depending wether U.M. conversion is active or not - note that, for now, this will only work for workspaces in mm units). If the Slices are 1D histrograms, the units will be ph/s/mm or W/mm (or ph/s/um or W/um).

3. Fitting: None, Gaussi, Lorentz or Lorentz+Gauss. If different from None, it will try to fit the slices to the desired distribution. The Lorentz+Gauss option will fit a sum of a lorentzian and a gaussian distribution. It generally fits quasi-gaussian beams better than the other 2 options. Although it has no physical meaning, it can be useful to "filter" the histogram high frequency noises and thus usually gives more accurate FWHM values.

4. Scale: Data can be shown in Linear or Logarithmic scales.

5. Text 1, 2, 3: These three options allow the user to add texts to the figure, showing the beam FWHM or RMS, for instance, or the fit FWHM, RMS. The option called "Title" will add to the figure the text given in the field below (Title / Description). This is very useful to record, in the picture, relevant parameters to the simulation (for instance, the position where you are observing the beam, energy, source parameters, and so on).

6. Title / Description: This field is used to write a text that can be displayed in the figure. The limit is around 40 characters, and the line break is not automatic (one has to include spaces until the line is broke at the desired position).

7. Horizontal / Vertical Label: These fields can be used to overwrite the abcissa and ordinate axes labels.

8. File Name to Save: any name with .png extension

9. Export Figure: This button is used to save the displayed figure to disk in png format. Note that it saves the displayed figure, but it does not updates the figrue. Use the Refresh button to update the figure before exporting the figure.

#### Advanced Options

This box (below Plot Controls) contains some other few options that should be used with care.

![adv](https://github.com/oasys-lnls-kit/OASYS1-LNLS-ShadowOui/blob/master/images/BeamAnalysisAdvanced.png "ADV")

1. FWHM innermost / outermost: sometimes the beam presents more than one peak. In this case, Innermost will search the firsts half-widths-half-maximum from the peak to the borders. Outermost will search from the borders to the peak.

2. Threshold for FWHM: must be a value between 0 and 1, relative to the peak intensity. This options allows to calculate the beam full-width not only at half-maximum (0.5), but also at any other value, for instance one-tenth-maximum (0.1).

3. Oversampling factor for FWHM: if this factor is greater than 1, it will interpolate the slice distribution and resample the distribution with a number of points equal to the original number of points time this factor, to increase resolution in the calculation. Otherwise the resolution is limited to the original bin width.

4. Large limits: If the plot range is user defined, it is possible that one or two axes limits are larger than the actual data. In this case, the area without data will be shown in white. If the user wants to consider this area as zero, one can set this value to add zeros to the axes borders (zero padding), virtually increasing the data range. This number is the increasing factor (eg. 1 means 100% increase, thus doubling the ranges).

5. Gaussian Filter: this option can be used to apply a gaussian filter to the 2D histogram, if the data is too noisy. This is the factor given as argument to scipy.ndimage.gaussian_filter.

gha_language: Python


text:
# Long Short-Term Memory (LSTM)
:label:`sec_lstm`

The challenge to address long-term information preservation and short-term input
skipping in latent variable models has existed for a long time. One of the
earliest approaches to address this was the
long short-term memory (LSTM) :cite:`Hochreiter.Schmidhuber.1997`. It shares many of the properties of the
GRU.
Interestingly, LSTMs have a slightly more complex
design than GRUs but predates GRUs by almost two decades.

## Gated Memory Cell

Arguably LSTM's design is inspired
by logic gates of a computer.
LSTM introduces a *memory cell* (or *cell* for short)
that has the same shape as the hidden state
(some literatures consider the memory cell
as a special type of the hidden state),
engineered to record additional information.
To control the memory cell
we need a number of gates.
One gate is needed to read out the entries from the
cell.
We will refer to this as the
*output gate*.
A second gate is needed to decide when to read data into the
cell.
We refer to this as the *input gate*.
Last, we need a mechanism to reset
the content of the cell, governed by a *forget gate*.
The motivation for such a
design is the same as that of GRUs,
namely to be able to decide when to remember and
when to ignore inputs in the hidden state via a dedicated mechanism. Let us see
how this works in practice.

### Input Gate, Forget Gate, and Output Gate

Just like in GRUs,
the data feeding into the LSTM gates are
the input at the current time step and
the hidden state of the previous time step,
as illustrated in :numref:`lstm_0`.
They are processed by
three fully-connected layers with a sigmoid activation function to compute the values of
the input, forget. and output gates.
As a result, values of the three gates
are in the range of $(0, 1)$.

![Computing the input gate, the forget gate, and the output gate in an LSTM model.](../img/lstm-0.svg)
:label:`lstm_0`

Mathematically,
suppose that there are $h$ hidden units, the batch size is $n$, and the number of inputs is $d$.
Thus, the input is $\mathbf{X}_t \in \mathbb{R}^{n \times d}$ and the hidden state of the previous time step is $\mathbf{H}_{t-1} \in \mathbb{R}^{n \times h}$. Correspondingly, the gates at time step $t$
are defined as follows: the input gate is $\mathbf{I}_t \in \mathbb{R}^{n \times h}$, the forget gate is $\mathbf{F}_t \in \mathbb{R}^{n \times h}$, and the output gate is $\mathbf{O}_t \in \mathbb{R}^{n \times h}$. They are calculated as follows:

$$
\begin{aligned}
\mathbf{I}_t &= \sigma(\mathbf{X}_t \mathbf{W}_{xi} + \mathbf{H}_{t-1} \mathbf{W}_{hi} + \mathbf{b}_i),\\
\mathbf{F}_t &= \sigma(\mathbf{X}_t \mathbf{W}_{xf} + \mathbf{H}_{t-1} \mathbf{W}_{hf} + \mathbf{b}_f),\\
\mathbf{O}_t &= \sigma(\mathbf{X}_t \mathbf{W}_{xo} + \mathbf{H}_{t-1} \mathbf{W}_{ho} + \mathbf{b}_o),
\end{aligned}
$$

where $\mathbf{W}_{xi}, \mathbf{W}_{xf}, \mathbf{W}_{xo} \in \mathbb{R}^{d \times h}$ and $\mathbf{W}_{hi}, \mathbf{W}_{hf}, \mathbf{W}_{ho} \in \mathbb{R}^{h \times h}$ are weight parameters and $\mathbf{b}_i, \mathbf{b}_f, \mathbf{b}_o \in \mathbb{R}^{1 \times h}$ are bias parameters.

### Candidate Memory Cell

Next we design the memory cell. Since we have not specified the action of the various gates yet, we first introduce the *candidate* memory cell $\tilde{\mathbf{C}}_t \in \mathbb{R}^{n \times h}$. Its computation is similar to that of the three gates described above, but using a $\tanh$ function with a value range for $(-1, 1)$ as the activation function. This leads to the following equation at time step $t$:

$$\tilde{\mathbf{C}}_t = \text{tanh}(\mathbf{X}_t \mathbf{W}_{xc} + \mathbf{H}_{t-1} \mathbf{W}_{hc} + \mathbf{b}_c),$$

where $\mathbf{W}_{xc} \in \mathbb{R}^{d \times h}$ and $\mathbf{W}_{hc} \in \mathbb{R}^{h \times h}$ are weight parameters and $\mathbf{b}_c \in \mathbb{R}^{1 \times h}$ is a bias parameter.

A quick illustration of the candidate memory cell is shown in :numref:`lstm_1`.

![Computing the candidate memory cell in an LSTM model.](../img/lstm-1.svg)
:label:`lstm_1`

### Memory Cell

In GRUs, we have a mechanism to govern input and forgetting (or skipping).
Similarly,
in LSTMs we have two dedicated gates for such purposes: the input gate $\mathbf{I}_t$ governs how much we take new data into account via $\tilde{\mathbf{C}}_t$ and the forget gate $\mathbf{F}_t$ addresses how much of the old memory cell content $\mathbf{C}_{t-1} \in \mathbb{R}^{n \times h}$ we retain. Using the same pointwise multiplication trick as before, we arrive at the following update equation:

$$\mathbf{C}_t = \mathbf{F}_t \odot \mathbf{C}_{t-1} + \mathbf{I}_t \odot \tilde{\mathbf{C}}_t.$$

If the forget gate is always approximately 1 and the input gate is always approximately 0, the past memory cells $\mathbf{C}_{t-1}$ will be saved over time and passed to the current time step.
This design is introduced to alleviate the vanishing gradient problem and to better capture
long range dependencies within sequences.

We thus arrive at the flow diagram in :numref:`lstm_2`.

![Computing the memory cell in an LSTM model.](../img/lstm-2.svg)

:label:`lstm_2`

### Hidden State

Last, we need to define how to compute the hidden state $\mathbf{H}_t \in \mathbb{R}^{n \times h}$. This is where the output gate comes into play. In LSTM it is simply a gated version of the $\tanh$ of the memory cell.
This ensures that the values of $\mathbf{H}_t$ are always in the interval $(-1, 1)$.

$$\mathbf{H}_t = \mathbf{O}_t \odot \tanh(\mathbf{C}_t).$$

Whenever the output gate approximates 1 we effectively pass all memory information through to the predictor, whereas for the output gate close to 0 we retain all the information only within the memory cell and perform no further processing.

:numref:`lstm_3` has a graphical illustration of the data flow.

![Computing the hidden state in an LSTM model.](../img/lstm-3.svg)
:label:`lstm_3`

## Implementation from Scratch

Now let us implement an LSTM from scratch.
As same as the experiments in :numref:`sec_rnn_scratch`,
we first load the time machine dataset.

```{.python .input}
from d2l import mxnet as d2l
from mxnet import np, npx
from mxnet.gluon import rnn
npx.set_np()

batch_size, num_steps = 32, 35
train_iter, vocab = d2l.load_data_time_machine(batch_size, num_steps)
```

```{.python .input}
#@tab pytorch
from d2l import torch as d2l
import torch
from torch import nn

batch_size, num_steps = 32, 35
train_iter, vocab = d2l.load_data_time_machine(batch_size, num_steps)
```

### Initializing Model Parameters

Next we need to define and initialize the model parameters. As previously, the hyperparameter `num_hiddens` defines the number of hidden units. We initialize weights following a Gaussian distribution with 0.01 standard deviation, and we set the biases to 0.

```{.python .input}
def get_lstm_params(vocab_size, num_hiddens, device):
    num_inputs = num_outputs = vocab_size

    def normal(shape):
        return np.random.normal(scale=0.01, size=shape, ctx=device)

    def three():
        return (normal((num_inputs, num_hiddens)),
                normal((num_hiddens, num_hiddens)),
                np.zeros(num_hiddens, ctx=device))

    W_xi, W_hi, b_i = three()  # Input gate parameters
    W_xf, W_hf, b_f = three()  # Forget gate parameters
    W_xo, W_ho, b_o = three()  # Output gate parameters
    W_xc, W_hc, b_c = three()  # Candidate memory cell parameters
    # Output layer parameters
    W_hq = normal((num_hiddens, num_outputs))
    b_q = np.zeros(num_outputs, ctx=device)
    # Attach gradients
    params = [W_xi, W_hi, b_i, W_xf, W_hf, b_f, W_xo, W_ho, b_o, W_xc, W_hc,
              b_c, W_hq, b_q]
    for param in params:
        param.attach_grad()
    return params
```

```{.python .input}
#@tab pytorch
def get_lstm_params(vocab_size, num_hiddens, device):
    num_inputs = num_outputs = vocab_size

    def normal(shape):
        return torch.randn(size=shape, device=device)*0.01

    def three():
        return (normal((num_inputs, num_hiddens)),
                normal((num_hiddens, num_hiddens)),
                d2l.zeros(num_hiddens, device=device))

    W_xi, W_hi, b_i = three()  # Input gate parameters
    W_xf, W_hf, b_f = three()  # Forget gate parameters
    W_xo, W_ho, b_o = three()  # Output gate parameters
    W_xc, W_hc, b_c = three()  # Candidate memory cell parameters
    # Output layer parameters
    W_hq = normal((num_hiddens, num_outputs))
    b_q = d2l.zeros(num_outputs, device=device)
    # Attach gradients
    params = [W_xi, W_hi, b_i, W_xf, W_hf, b_f, W_xo, W_ho, b_o, W_xc, W_hc,
              b_c, W_hq, b_q]
    for param in params:
        param.requires_grad_(True)
    return params
```

### Defining the Model

In the initialization function, the hidden state of the LSTM needs to return an *additional* memory cell with a value of 0 and a shape of (batch size, number of hidden units). Hence we get the following state initialization.

```{.python .input}
def init_lstm_state(batch_size, num_hiddens, device):
    return (np.zeros((batch_size, num_hiddens), ctx=device),
            np.zeros((batch_size, num_hiddens), ctx=device))
```

```{.python .input}
#@tab pytorch
def init_lstm_state(batch_size, num_hiddens, device):
    return (torch.zeros((batch_size, num_hiddens), device=device),
            torch.zeros((batch_size, num_hiddens), device=device))
```

The actual model is defined just like what we discussed before: providing three gates and an auxiliary memory cell. Note that only the hidden state is passed to the output layer. The memory cell $\mathbf{C}_t$ does not directly participate in the output computation.

```{.python .input}
def lstm(inputs, state, params):
    [W_xi, W_hi, b_i, W_xf, W_hf, b_f, W_xo, W_ho, b_o, W_xc, W_hc, b_c,
     W_hq, b_q] = params
    (H, C) = state
    outputs = []
    for X in inputs:
        I = npx.sigmoid(np.dot(X, W_xi) + np.dot(H, W_hi) + b_i)
        F = npx.sigmoid(np.dot(X, W_xf) + np.dot(H, W_hf) + b_f)
        O = npx.sigmoid(np.dot(X, W_xo) + np.dot(H, W_ho) + b_o)
        C_tilda = np.tanh(np.dot(X, W_xc) + np.dot(H, W_hc) + b_c)
        C = F * C + I * C_tilda
        H = O * np.tanh(C)
        Y = np.dot(H, W_hq) + b_q
        outputs.append(Y)
    return np.concatenate(outputs, axis=0), (H, C)
```

```{.python .input}
#@tab pytorch
def lstm(inputs, state, params):
    [W_xi, W_hi, b_i, W_xf, W_hf, b_f, W_xo, W_ho, b_o, W_xc, W_hc, b_c,
     W_hq, b_q] = params
    (H, C) = state
    outputs = []
    for X in inputs:
        I = torch.sigmoid((X @ W_xi) + (H @ W_hi) + b_i)
        F = torch.sigmoid((X @ W_xf) + (H @ W_hf) + b_f)
        O = torch.sigmoid((X @ W_xo) + (H @ W_ho) + b_o)
        C_tilda = torch.tanh((X @ W_xc) + (H @ W_hc) + b_c)
        C = F * C + I * C_tilda
        H = O * torch.tanh(C)
        Y = (H @ W_hq) + b_q
        outputs.append(Y)
    return torch.cat(outputs, dim=0), (H, C)
```

### Training and Prediction

Let us train an LSTM as same as what we did in :numref:`sec_gru`, by instantiating the `RNNModelScratch` class as introduced in :numref:`sec_rnn_scratch`.

```{.python .input}
#@tab all
vocab_size, num_hiddens, device = len(vocab), 256, d2l.try_gpu()
num_epochs, lr = 500, 1
model = d2l.RNNModelScratch(len(vocab), num_hiddens, device, get_lstm_params,
                            init_lstm_state, lstm)
d2l.train_ch8(model, train_iter, vocab, lr, num_epochs, device)
```

## Concise Implementation

Using high-level APIs,
we can directly instantiate an `LSTM` model.
This encapsulates all the configuration details that we made explicit above. The code is significantly faster as it uses compiled operators rather than Python for many details that we spelled out in detail before.

```{.python .input}
lstm_layer = rnn.LSTM(num_hiddens)
model = d2l.RNNModel(lstm_layer, len(vocab))
d2l.train_ch8(model, train_iter, vocab, lr, num_epochs, device)
```

```{.python .input}
#@tab pytorch
num_inputs = vocab_size
lstm_layer = nn.LSTM(num_inputs, num_hiddens)
model = d2l.RNNModel(lstm_layer, len(vocab))
model = model.to(device)
d2l.train_ch8(model, train_iter, vocab, lr, num_epochs, device)
```

LSTMs are the prototypical latent variable autoregressive model with nontrivial state control.
Many variants thereof have been proposed over the years, e.g., multiple layers, residual connections, different types of regularization. However, training LSTMs and other sequence models (such as GRUs) are quite costly due to the long range dependency of the sequence.
Later we will encounter alternative models such as Transformers that can be used in some cases.

## Summary

* LSTMs have three types of gates: input gates, forget gates, and output gates that control the flow of information.
* The hidden layer output of LSTM includes the hidden state and the memory cell. Only the hidden state is passed into the output layer. The memory cell is entirely internal.
* LSTMs can alleviate vanishing and exploding gradients.

## Exercises

1. Adjust the hyperparameters and analyze the their influence on running time, perplexity, and the output sequence.
1. How would you need to change the model to generate proper words as opposed to sequences of characters?
1. Compare the computational cost for GRUs, LSTMs, and regular RNNs for a given hidden dimension. Pay special attention to the training and inference cost.
1. Since the candidate memory cell ensures that the value range is between $-1$ and $1$ by  using the $\tanh$ function, why does the hidden state need to use the $\tanh$ function again to ensure that the output value range is between $-1$ and $1$?
1. Implement an LSTM model for time series prediction rather than character sequence prediction.

:begin_tab:`mxnet`
[Discussions](https://discuss.d2l.ai/t/343)
:end_tab:

:begin_tab:`pytorch`
[Discussions](https://discuss.d2l.ai/t/1057)
:end_tab:


text:
---
title:  "Setting up the Three.js ellipsoids"
subheadline: "Biswajit Banerjee"
description: "Javascript scientific visualization - Part 6"
date:  2017-03-01 10:30:00
categories:
    - Javascript
    - Typescript
    - Threejs
    - Vue
---

##### Introduction #####
In the previous articles in this series we talked about:

1. [Part 1: Reading VTK format particles with Javascript in a browser]({{ site.baseurl }}/javascript/typescript/vue/vuex/xml/reading-vtk-particles/)
2. [Part 2: Saving the read-in particle data in a Vuex store]({{ site.baseurl }}/javascript/typescript/vue/vuex/vuex-store/)
3. [Part 3: Initialization of a store and the user interface]({{ site.baseurl }}/javascript/typescript/threejs/vue/vtk-threejs/).
4. [Part 4: Setting up the Three.js renderer]({{ site.baseurl }}/javascript/typescript/threejs/vue/vtk-threejs-renderer/)
5. [Part 5: Setting up the Three.js scene and camera]({{ site.baseurl }}/javascript/typescript/threejs/vue/vtk-threejs-camera/)

We are now ready to discuss the `three-ellipsoid-particles` component that we introduced in
`ThreeGraphicsPanel.vue`.  Recall that the template has the following form:

{% highlight html %}
<template>

        <three-renderer v-bind:size="{w:500, h:500}">
          <three-scene v-bind:size="size">
            <three-camera v-bind:size="size" v-bind:position="{x: 100,  z: 15 }">
            </three-camera>
            <three-ellipsoid-particles> </three-ellipsoid-particles>
          </three-scene>
        </three-renderer>

</template>
{% endhighlight %}

##### The ellipsoid particles component #####
The file `ThreeEllipsoidParticles.vue` also does not contain any information inside the
`<template>` tags and contains the following:

{% highlight html %}
<template> </template>

{% endhighlight %}

However, the source code contains more - as you can see below.

{% highlight js %}
import * as Vue from "vue";
import { Component, Lifecycle } from 'av-ts';
import THREE = require("three");
import Store from "./Store";
@Component({
  name: 'ThreeEllipsoidParticles'
})
export default class ThreeEllipsoidParticles extends Vue {
  @Lifecycle
  public created() {
    // Create a watch in the store to make sure the particle
    // file has been read before particles are created
    var self = this;
    Store.watch(
      function () {
        return Store.getters.particleReadComplete;
      },
      function () {
        if (Store.getters.particleReadComplete)
          self.createThreeParticles();
      });
  }
  // Actually create the particles
  private createThreeParticles() {
    ..... see below ....
  }
}
{% endhighlight %}

There are several aspects that need consideration in this code.

We use the `watch` "instance method" of [Vuex](https://vuex.vuejs.org/en/api.html) to make sure that
the particles are added to the scene only after the particle file has been read.
{: .notice}

In this example
we do not stop watching the variable `particleReadComplete` (see [Part 2]({{ site.baseurl }}/javascript/typescript/vue/vuex/vuex-store/) for details) after the particle data has been converted and saved.  However, that step is highly recommended.
{: .notice--warning}

##### Creating the ellipsoid particles #####
The particle axis data are in the form of angles between the ellipsoid axes and the world coordinate axes.
These are converted directly into the appropriate rotation matrix.  Sphere objects are then created at
the origin, rotated, scaled, and translated to their actual positions.  The sphere objects are then
transformed into `SphereBufferGeometry` objects to make their manipulation slightly more efficient.
Finally, a "material" shading model is added to make sure that the image displayed isn't flat and
a triangulated mesh is generated for each object.

{% highlight js %}
  private createThreeParticles() {
    // Get the particle data
    let particles = Store.getters.particleData;
    // Extract the radius and center
    let radii = particles["Radius"];
    let centers = particles["Position"];
    let axes_a = particles["Axis a"];
    let axes_b = particles["Axis b"];
    let axes_c = particles["Axis c"];
    // Loop through particles
    var self = this;
    radii.map(function (radius: any, index: number) {
      // Get the radius ratios
      let ratio = [1.0, radius[1]/radius[0], radius[2]/radius[0]];
      // Get the axes into vectors and compute rotation matrix
      let axis_a =
        new THREE.Vector3(Math.cos(axes_a[index][0]),
                          Math.cos(axes_a[index][1]),
                          Math.cos(axes_a[index][2]));
      let axis_b =
        new THREE.Vector3(Math.cos(axes_b[index][0]),
                          Math.cos(axes_b[index][1]),
                          Math.cos(axes_b[index][2]));
      let axis_c =
        new THREE.Vector3(Math.cos(axes_c[index][0]),
                          Math.cos(axes_c[index][1]),
                          Math.cos(axes_c[index][2]));
      let rotMatrix = new THREE.Matrix4();
      rotMatrix.set(
        axis_a.x, axis_b.x, axis_c.y, 0,
        axis_a.y, axis_b.y, axis_c.y, 0,
        axis_a.z, axis_b.z, axis_c.z, 0,
        0, 0, 0, 1
        );
      // Create the sphere geometry
      const sph_geometry = new THREE.SphereGeometry(radius[0], 32, 16);
      // Rotate sphere
      sph_geometry.applyMatrix(rotMatrix);
      // Convert into ellipsoid
      sph_geometry.applyMatrix(new THREE.Matrix4().makeScale(ratio[0], ratio[1], ratio[2]));
      // Translate the geometry
      let center = new THREE.Vector3(centers[index][0], centers[index][1], centers[index][2]);
      sph_geometry.translate(center.x, center.y, center.z);
      // Convert into buffer geometry
      const geometry = new THREE.BufferGeometry().fromGeometry(sph_geometry);
      // Create the material for display purposes
      const material = new THREE.MeshPhongMaterial({
        color: 0xffaa00,
        emissive: 0x072534,
        side: THREE.DoubleSide,
        shading: THREE.SmoothShading,
        wireframe: false
      });
      // Create the mesh
      const sphere = new THREE.Mesh(geometry, material);
      // Save the data
      Store.commit('ADD_THREE_OBJECT', sphere);
    });
    Store.commit('THREE_OBJECTS_CREATED', true);
  }
{% endhighlight %}

The rotation matrix performs a transformation of the form
$$
  \hat{\mathbf{w}} = \boldsymbol{R} \cdot \mathbf{w}\,.
$$
We want to rotate the world coordinate vectors
$$\mathbf{E}_1$$, $$\mathbf{E}_2$$, $$\mathbf{E}_3$$,
into vectors that are aligned with the ellipsoid axes,
$$\mathbf{e}_1$$, $$\mathbf{e}_2$$, $$\mathbf{e}_3$$.
Therefore, we need to find a rotation matrix $$\boldsymbol{R}$$
such that $$\mathbf{e}_\alpha = \boldsymbol{R}\cdot\mathbf{E}_\alpha$$
where $$\alpha = 1,2,3$$. Taking dot products of both sides with
$$\mathbf{E}_\beta$$, we get
$$\mathbf{E}_\beta\cdot\mathbf{e}_\alpha =
\mathbf{E}_\beta\cdot\boldsymbol{R}\cdot\mathbf{E}_\alpha =
(\mathbf{E}_\beta\otimes\mathbf{E}_\alpha):\boldsymbol{R} \,.
$$ Now, $$\boldsymbol{R} = R_{mn} \mathbf{E}_m \otimes \mathbf{E}_n$$.
So we have
$$\mathbf{E}_\beta\cdot\mathbf{e}_\alpha =
  R_{mn} (\mathbf{E}_\beta\otimes\mathbf{E}_\alpha): (\mathbf{E}_m \otimes \mathbf{E}_n)
  = R_{mn} (\mathbf{E}_\beta\cdot\mathbf{E}_m) (\mathbf{E}_\alpha \cdot \mathbf{E}_n)
  = R_{mn} \delta_{\beta m} \delta_{\alpha n}$$.
Therefore, $$ \mathbf{E}_\beta\cdot\mathbf{e}_\alpha = R_{\beta\alpha}$$.
{: .notice--info}

Let us look at the ellipsoid axis vector $$\mathbf{e}_1 = \mathbf{e}_a$$.  This vector has
components $$(e_{11}, e_{12}, e_{13})$$ where $$e_{11} = \mathbf{e}_1 \cdot \mathbf{E}_1 = R_{11}$$,
$$e_{12} = \mathbf{e}_1 \cdot \mathbf{E}_2 = R_{21}$$, and $$e_{13} = \mathbf{e}_1 \cdot \mathbf{E}_3 = R_{31}$$.  That is why we can create the rotation matrix directly from the axis data in
the code sample.

#### Remarks ####
A plot of the ellipsoids produced by our code can be seen below.

![Plot produced by Three.js]({{site.baseurl}}/assets/blogimg/ThreeGraphicsPanel.jpg){:class="img-responsive center-image" height="450px" border="5px double red"}

In the next part of this series we will explore how `vtk.js` can be used to do the same plot.

repository: bbanerjee/ParSim

repo_name: bbanerjee/ParSim


text:
## automerge-backend-wasm

This is a npm wrapper for the rust implementation of [automerge-backend](https://github.com/automerge/automerge-rs/tree/master/automerge-backend).
It is currently experimental and in development against the Automerge performance branch.

### building

Make sure you have the latest rust compiler installed  (1.42.0 or later).

```sh
cargo install wasm-pack
yarn install
```

Then build the debug version with

```sh
yarn build
```
or the release build with

```sh
yarn release
```

repository: nornagon/automerge-rs

repo_name: nornagon/automerge-rs


text:
# opsworks_wordpress

Chef cookbook for deploying WordPress to OpsWorks.

## Supported Platforms

This cookbook is developed and test under Ubuntu 14.04. It should also work on other Linux platform, and please file issues if you get any problems.

## OpsWorks Only?

Though this cookbook is created to be used in AWS OpsWorks, environment setup cookbook (i.e. `opsworks_wordpress::default`) recipe could be used in normal chef environment.

## Recipes

* `opsworks_wordpress::default` - Install HHVM / NGINX, add NGINX shared configs and set up crontab for wp-cron.
* `opsworks_wordpress::deploy` - Download WordPress's latest version, set up NGINX site config, symlink wp-content from current deploy version of app to shared WordPress installation.

## License and Authors

Author: Richard Lee<EMAIL_ADDRESS>
License: Apache


text:
# IP address extensions

This .NET library contains various extensions for the `IPAddress` class.

A NuGet package is available at https://www.nuget.org/packages/Albireo.IPAddressExtensions/

## Requirements

- .NET Framework 4.0
- Visual Studio 2013
- Code contracts

## License

This project is licensed under the MIT license.

## Credits

The reserved networks list is taken from Wikipedia's [Reserved IP addresses]
article.

  [Reserved IP addresses]: http://en.wikipedia.org/wiki/Reserved_IP_addresses


text:
#MX Helper Bar

The **MX Helper** Bar for Magento 2 is intended to help store admins and operators by:

 - showing at a glance which environment(Pipeline instance) they are using so they won't inadvertently make the changes to the wrong environment.
 - acting as a super shortcut bar which allows you to quickly search and perform a list of common tasks, such as clearing cache types, without having to navigate away from the page.
 - **New Feature:** Customizable Commands- easily add your own shortcuts for your customers, or yourself to speed up M2

![Demo of Bob, the quick shortcut helper bar for Magento 2](use.gif)

## Commands

What follows is a list of the commands currently available. This list will grow and get better with time (like wine!).

### Clear Cache (cc)

This command will allow you to refresh cache types as if you were doing it from the Magento _Cache Management_ page.

Start typing 'cc' in the Helper Bar textbox to see the list of available commmands. All the following are valid commands:

```
  > cc
  > cc configuration
  > cc database ddl operations
```

### Template Path and Block Hints (tph)

This command allow you to enable or disable template path hints as you were doing it from _Stores -> Configuration -> Advanced -> Developer -> Debug_

For instance choose _tph front en_ and this will set:
_Enabled Template Path Hints for Storefront_ and _Add Block Names to Hints_ to 'Yes'

instead, if you choose _tph en_ this will enable the template hints on the storefront and in the adminhtml site area

### Navigation shortcut (nav)

The navigation shortcut commands allow you to quickly navigate to other magento pages.
For instance choose _nav cms block_ to be redirected to the Cms Blocks page.

If you want to contribute adding more shortcuts you can easily do so by editing the _etc/di.xml_ file.

Add a new _virtualType_ (see as an example _navigation_redirect_cms_page_) and inject it as a new argument in the type _MX\HelperBar\Model\NavigationRedirectRepository_

## Installing
Then add the module to the require section of the composer file:

```shell
  $ ./php composer.phar require "mx/module-helper-bar": "~1.0.1"
```

This command will add:

```json
  "require": {
    "mx/module-helper-bar": "~1.0.1"
  }
```

## Enable

Once the module is added as dependency, run the Magento setup module, clear the cache and make sure the module status is enabled.

```
  $ bin/magento setup:upgrade
  $ bin/magento c:c
  $ bin/magento module:status MX_HelperBar
```

Now that the module is enabled, you need to make the Helper Bar visible.

![video of how to install ](install.gif)

Navigate to: _Stores -> Configuration -> Advanced -> Developer -> Debug_
and select _"Yes"_ for the option with label _"Enabled Helper Bar for Admin"_

Then refresh the page and you will see the Helper Bar at the bottom of the screen. If you wish, you can temporarily hide it by pressing the 'X' or using CTRL + ` as a keyboard shortcut.

## Contributing
By making this open source we hope others will gain value from it and use it as part of their projects.
Please share any feedback, suggestions and additions so we can help make Magento 2 even faster, easier and simpler to work with and to develop amazing e-Commerce experiences on.

If you wish to contribute to the Helper Bar:

* Fork/Clone this repository
* Install the module
* Create a feature branch with descriptive name (i.e. feature/magento-tasks)
* Make changes
* Push feature branch back to this repo
* Submit a PR with details of changes

###Any Feedback?:
Please kindly raise an issue in Github.

## Contributors

###Dev Team
* James Cowie
* Alessandro Zucca
* Richard Thompson

###Other team members who helped with the module
* Paal Soberg
* Grant Kemp
* Alex Blaney
* Andrew Bennett

###Inspiration
Massive thanks to the Graze.com Team for inspiring this project and agreeing to let us open source the results, especially:
* Jason Malone
* Joe Meehan
* Joe Ferrelly

gha_language: PHP


text:
# servo-hey
Optune servo driver for 'Hey' load generator

## Supported environment variables:

* `HEY_TEST_URL` - URL to measure, e.g. 'http://service:80'
* `HEY_TEST_APP` - HTTP/1.1 Host header, e.g. 'service'

repository: opsani/servo-hey

repo_name: opsani/servo-hey


text:
---
title: Roadshow Bid Process
---

## DRAFT

This is intended to document the bid process for running/hosting a
Roadshow. In particular, if you want ASF budget for it.

You need, at a minimum

* Event chair
    * Must be an ASF member
    * Must be resident in the city where the event is proposed
* Volunteers to support (how many?)
* City/Venue selected
    * University cities are preferred
    * Local tech firms that can sponsor?
* Local keynote suggestion
* Proposed timeline, starting with CFP, going through schedule, speaker notification, the event, and the post-event
* Budget
    * Leads on sponsorship helpful
* Contribute to event "runbook" as output from the event

To run a roadshow or other small event without ASF budget, you only need to:

* Follow our branding guidelines - https://www.apache.org/foundation/marks/events
* [Tell us about<EMAIL_ADDRESS>* Have an Apache member involved in the planning

repository: apache/comdev-events-site

gha_language: HTML

repo_name: apache/comdev-events-site


text:
# tftp-client

TFTP client written in C. Project developed for learning purposes in Networks and Services Architecture subject of Software Engineering degree at University of Valladolid.

## Content

- [Practice statement](/tftp-client-statement.pdf) - TFTP client development requirements. (Spanish)
- [tftp-Sanz-Perez.c](tftp-Sanz-Perez.c) - TFTP client implemented.

## Development

### Requirements

- [GCC](https://gcc.gnu.org), the GNU Compiler Collection.
- TFTP server running ([RFC 1350](https://tools.ietf.org/html/rfc1350)).

### Installation

```bash
# Clone repository.
git clone https://github.com/jorge-sanz/tftp-client.git
cd tftp-client
```

### Compilation

```bash
gcc -Wall -o client.out tftp-Sanz-Perez.c
```

### Execution

- `-r`: read file mode.
- `-w`: write file mode.
- `-v`: tracing mode.

```bash
./client.out server-ip {-r|-w} file [-v]
```

## Deployment

### Remote Linux Virtual Machine via SSH

This C program should be executed in a provided Slackware Linux machine, so one option to send the source files to there is:

```bash
# Transfer file to remote machine
scp -P <port-number> tftp-Sanz-Perez.c youruser@your.machine.address:/destination/folder
```

Then, you can access to your remote machine via SSH and execute the TFTP client from there.

repository: jorge-sanz/tftp-client

repo_name: jorge-sanz/tftp-client


text:
# height

https://developer.mozilla.org/en-US/docs/Web/CSS/height

## auto
```css
.selector {
  composes: auto from 'hydrogencss/height.css'
}
```

or:
```css
.selector {
  composes: auto from 'hydrogencss/height/auto.css'
}
```

## available
```css
.selector {
  composes: available from 'hydrogencss/height.css'
}
```

or:
```css
.selector {
  composes: available from 'hydrogencss/height/available.css'
}
```

## fit-content
```css
.selector {
  composes: fit-content from 'hydrogencss/height.css'
}
```

or:
```css
.selector {
  composes: fit-content from 'hydrogencss/height/fit-content.css'
}
```

## max-content
```css
.selector {
  composes: max-content from 'hydrogencss/height.css'
}
```

or:
```css
.selector {
  composes: max-content from 'hydrogencss/height/max-content.css'
}
```

## min-content
```css
.selector {
  composes: min-content from 'hydrogencss/height.css'
}
```

or:
```css
.selector {
  composes: min-content from 'hydrogencss/height/min-content.css'
}
```

repository: eddiemoore/hydrogencss

gha_language: JavaScript

repo_name: eddiemoore/hydrogencss


text:
# SolarHacks
Our Website: https://www.solarhacks.org

Join the Discord: https://discord.gg/xV9bDJg

Register for Solar Hacks I, taking place on October 12, 2019.

Solar Hacks is a one-day, 200-participant hackathon that is independent and unaffiliated with any school. Our goal is to bring middle and high school students in the Bay Area together to come together and develop innovative ideas that could revolutionize the world. At Solar Hacks, we provide students with the resources and mentorship that would be needed to convert their ideas into a reality. Additionally, by the end of the Hackathon, students will be able to learn how to collaborate with their peers to build STEM projects, gain presentation skills, and be inspired to continue doing things they love! Food, workshops, assistance, drinks, and swag will be provided to all participants for free!

We want all participants to enjoy their day at Solar Hacks, hence, we would encourage everybody to arrive to the Hackathon with a competitive mindset.

### What:
SolarHacks is a high school hackathon in the Bay Area for students by students, and it's completely free! We will have free food, swag, goodies, and more! We will have plenty of games and icebreakers to make your experience memorable.

### Where:
We will be hosting the event at 42 Silicon Valley in Fremont, CA: 6600 Dumbarton Circle, Fremont, CA 94555

### When:
The event is an overnight hackathon on October 12th, 2018. The full schedule is available on our website.

### Who:
Anyone (as long as you're 18 or younger) can come, even if you haven't written a single line of code before! We will have plenty of opportunities for even non-coders to participate!

### Why:
There are tons of free food, swag, and goodies! You can make new friends and even learn some new skills you can show off to others. And plus, it's a free event! Bring along your friends to this wonderful free event.

repository: aryanvichare/SolarHacks

repo_name: aryanvichare/SolarHacks


text:
# 11712639-Project2-Report

## 1.Basic Requirement

#### 1.1 Implements
Based on the syntax tree built in previous project, tranverse this tree to do semantic analysis.
The main idea of traversal is to implement `visit` functions. It point out what to do when traverse different tree node. (for example:)
```c
// when meet node VarList
// it has two productions: ParamDec | ParamDec COMMA VarList
// so it will invoke visit_ParamDec() and visit_VarList()
FieldList* visit_VarList(Node *node){
    FieldList *list = create_FieldList();
    list = visit_ParamDec(node->children[0]);
    if (node->childrenNum == 3){
        list->next = visit_VarList(node->children[2]);
    }
    return list;
}
```
##### ==My implementation for subsequent errors:==

For an undefined identifier, it type is `UNKNOWN`. ==Any operation on unknow type identifier is valid.==

```text
 for example: an undefined identifier a
 a.size
 a()
 a[2]
 return a
 int b = a
 a + 1
 ...
```

For all above cases, my semantic analyser only report `type1 error`, since a's type is unknown and maybe it can be defined by user with correct type later. Only report type1 error to user is enough, I think.  If user later defines it as a wrong type, then question turns into another case that  type checking handles.

#### 1.2 Self-written test cases

1. Continuous definitions (eg. int a, b[2], c;) and array definition.
2. Nested structure definition.
3. Information of firstly defined variable is stored and can't be covered later when redifined variable occours.
4. Funtion components should be checked even it is redefined function.
5. Check return type.
6. Functions call each other.
7. Cases of rvalues on the left of "=".
8. Both function and variable are undefined when function calls.
9. Structure components should be checked even it is redefined structure.
10. Structure oprands.
## 2. Bonus features

### revoke Assumption 6

#### 2.1 Implements
Main idea: functional- style. According to project file:
>   Under such implementation, we organize all these symbol tables into a scope stack, the innermost scope is stored at the top of the stack, with the next containing scope that is underneath it, etc.. When a new scope is opened, a new symbol table is created and the variables declared in that scope are inserted into the new table. We then push the symbol table on the scope stack. When a scope is closed, the top symbol table is popped. To find a symbol, we start at the top of the stack and work our way down until we find it. If we do not find it, the variable is not accessible and an error should be generated.

When to insert a new symbol table into to stack?
* enter a program (global scope)
* a function define
* structure define
* if, else, while blocks

 code segment: (visit.c)
```c
void visit_Program(Node *node, FILE* fp1){
    ...
    printf("visit_Program\n");
    scope_stack = stack_init();
    push(scope_stack, symtab_init());
    visit_ExtDefList(node->children[1]);
    ...
}
TypeTuple* visit_StructSpecifier(Node *node){
    printf("visit_StructSpecifier\n");
    if (node->childrenNum == 5)
    {
        ...
        printf("after insert struct name, create new table\n");
        push(scope_stack, symtab_init());//再建一个table，结构体里的scope
        ...
    }
    return create_TypeTuple(STRUCTURE, node->children[1]->text);
}
IDType* visit_FunDec(Node *node, TypeTuple *type){
    printf("visit_FunDec\n");
    ...
    printf("after insert func name, create new table\n");
    push(scope_stack, symtab_init());
    ...
    return id;
}
void visit_Stmt(Node *node, IDType* func){
    printf("visit_Stmt\n");
    if (node->children[0]->isTerminal)//retrun, if, while
    {
        ...
        else//if, while
        {
            printf("enter if or while, create new table\n");
            visit_Exp(node->children[2]);
            push(scope_stack, symtab_init());
            ...
            if (node->childrenNum == 7)//带有else的情况
            {
                printf("enter else, create new table\n");
                push(scope_stack, symtab_init());
                ...
}
```

When to insert a new id into a symbol table?
* global definiton
* function parameters
* function decleared list
* structure decleared list
* decleared list in block ({})

When to pop a symbol table?
* after structure define
* after function define
* after if, else, while block
* end of program

  code segment:
```c
void visit_ExtDef(Node *node){
    ...
            IDType *func = visit_FunDec(node->children[1], type);
            visit_CompSt(node->children[2], func);
            printf("after visit func, pop table\n");
            pop(scope_stack);
    ...
}
TypeTuple* visit_StructSpecifier(Node *node){
    if (node->childrenNum == 5)
    {   ...
        printf("after visit struct, pop table\n");
        pop(scope_stack);//当结构体建立完成就pop最顶部的table
    }
    ...
}
void visit_Stmt(Node *node, IDType* func){
    ...
            printf("after if or while scope, pop table\n");
            pop(scope_stack);
            if (node->childrenNum == 7)//带有else的情况
            {
                ...
                printf("after else scope, pop table\n");
                pop(scope_stack);
            }
    ...
}
```


text:
# Google AdWords: Fivetran

### Dependencies

This adapter relies on a project `app_marketing_analytics_config` as specified in the manifest.lkml file. This project needs to include an `adwords_config.view.lkml` file.

For example:

```LookML
view: adwords_config {
  extension: required

  dimension: adwords_schema {
    hidden: yes
    sql:adwords;;
  }
}
```

### Interface
#### Account Structure

ad.view:
 - ad_adapter
   - external_customer_id
   - campaign_id
   - ad_group_id
   - creative_id
   - creative
   - status_active

ad_group.view:
 - ad_group_adapter
   - external_customer_id
   - campaign_id
   - ad_group_id
   - ad_group_name
   - status_active

campaign.view:
 - campaign_adapter
   - external_customer_id
   - campaign_id
   - campaign_name
   - status_active
   - budget_id
   - amount

customer.view:
 - customer_adapter
   - external_customer_id

#### Targeting Criteria
geo.view
 - geotargeting
   - state
   - country_code
   - name
   - postal_code

keyword.view
 - keyword_adapter
   - external_customer_id
   - campaign_id
   - ad_group_id
   - criterion_id
   - criteria
   - status_active
   - bidding_strategy_type

#### Reports

ad_impressions.view
 - _date
 - ad_network_type
 - device_type
 - cost
 - impressions
 - interactions
 - clicks
 - conversions
 - conversionvalue
 - averageposition

Account Stats
 - ad_impressions_adapter
 - ad_impressions_hour_adapter
   - hour_of_day

Campaign Stats
 - ad_impressions_campaign_adapter
 - ad_impressions_campaign_hour_adapter
   - hour_of_day

Ad Group Stats
 - ad_impressions_ad_group_adapter
 - ad_impressions_ad_group_hour_adapter
   - hour_of_day

Keyword Stats
 - ad_impressions_keyword_adapter

Ad Stats
 - ad_impressions_ad_adapter

Targeting Reports
 - ad_impressions * [age_range, audience, gender, geo, parental_status, video]

### Block Info

This Block is modeled on the schema from Fivetrans's [Google AdWords ETL](https://fivetran.com/directory/facebook_ads_insights).

The schema documentation for AdWords can be found in [Google's docs](https://developers.google.com/adwords/api/docs/appendix/reports).

### Google AdWords Raw Data Structure

* **Entity Tables and Stats Tables** - There are several primary entities included in the AdWords data set, such as ad, ad group, campaign, customer, keyword, etc.. Each of these tables has a corresponding "Stats" table, which includes all the various metrics for that entity. For example, the "campaign" entity table contains attributes for each campaign, such as the campaign name and campaign status. The corresponding stats table - "Campaign Basic Stats" contains metrics such as impressions, clicks, and conversions. These stats tables are mapped to an ad_impression explore as an interface to the Looker Marketing Analytics application.


text:
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Tobago CI](https://github.com/apache/myfaces-tobago/actions/workflows/tobago-ci.yml/badge.svg)](https://github.com/apache/myfaces-tobago/actions/workflows/tobago-ci.yml)
[![CodeQL](https://github.com/apache/myfaces-tobago/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/apache/myfaces-tobago/actions/workflows/codeql-analysis.yml)
[![Build Status ASF](https://ci-builds.apache.org/buildStatus/icon?subject=ASF-Build&job=MyFaces%2FTobago+pipeline%2Fmain)](https://ci-builds.apache.org/job/MyFaces/job/Tobago%20pipeline/job/main/)

# Apache Tobago

Apache MyFaces Tobago is a JSF component framework that pays special attention to security and is optimized for business applications.

Tobago supports custom themes based on the popular Bootstrap framework and frees the user from having to develop complex CSS and Javascript components.

Compared to many other JSF frameworks, Tobago is still being actively developed and is used in many projects.

# Table of Contents

- [Getting Started](#getting-started)
  * [Prerequisites](#prerequisites)
  * [Building](#building)
- [Live Demo](#live-demo)
- [Examples](#examples)
- [Issue Tracking](#issue-tracking)
- [Contributing](#contributing)
- [Licensing](#licensing)

# Getting Started

## Prerequisites

[Git](https://help.github.com/set-up-git-redirect), [Maven 3](https://maven.apache.org/download.cgi) and at least [JDK8]( https://www.oracle.com/technetwork/java/javase/downloads).

## Building

In the project directory you can use:

```
mvn clean install
```

to run the install target on all sub projects. This will
put all necessary artifacts into your local repository.

## Live Demo

You can find a live demo of all components at [https://tobago-vm.apache.org/](https://tobago-vm.apache.org/)

## Examples

See `tobago-examples` directory for some simple examples on how to use Tobago.

**Demo**

If you want to run the demo locally you need to run the following command

```shell
mvn -f tobago-example/tobago-example-demo/pom.xml clean package tomee:run -Ptomee -Pdev
```

Browse to the local URL http://localhost:8080/

You can also run the demo with different servers and JSF implementations

**Jetty, MyFaces and Weld**

```shell
mvn -f tobago-example/tobago-example-demo/pom.xml clean package jetty:run -Pjetty
```

**Jetty, Mojarra and Weld**
```shell
mvn -f tobago-example/tobago-example-demo/pom.xml clean package jetty:run -Pjetty -Djsf=mojarra-4.0
```

**Tomcat**
```shell
mvn -f tobago-example/tobago-example-demo/pom.xml package -Ptomcat cargo:run
```

**TomEE (currently broken)**
```shell
mvn -f tobago-example/tobago-example-demo/pom.xml clean package -Ptomee tomee:run
```

**Open Liberty**
```shell
mvn -f tobago-example/tobago-example-demo/pom.xml clean -Pliberty liberty:run
```
Browse to the local URL http://localhost:9080/

**Tomcat in Docker**

```
mvn -f tobago-example/tobago-example-demo/pom.xml clean package -Pdocker
docker run -p 8080:8080 myfaces/tobago-example-demo:latest
```

Browse to the local URL http://localhost:8080/

# Issue Tracking

If you find any issues regarding MyFaces Tobago you can use the [Apache Issue Tracker](https://issues.apache.org/jira/projects/TOBAGO) to report them

# Contributing
[Pull requests](https://help.github.com/articles/creating-a-pull-request) are welcome; see the [contributor guidelines](CONTRIBUTING.md) for details.

# Licensing

The terms for software licensing are detailed in the [LICENSE.txt](LICENSE.txt) file.

repository: apache/myfaces-tobago

gha_language: Java

repo_name: apache/myfaces-tobago


text:
---
title: "Introduction to Statistics with R"
author: "content"
date: "2021-03-29T18:55:47Z"
tags: [Statistics]
link: "https://bookdown.org/content/1c8fedce-597c-462d-bfdd-e1a0f2c8596d/"
length_weight: "4.5%"
pinned: false
---

Introduction to Statistics with R [...] Let’s start with a simple question: In the US, are adult men taller, on average, than women? We know the answer to this question already (yes), but attempting to answer it with data will allow us to illustrate many important concepts of statistics. The first step is to collect some ...

gha_language: R


text:
# copy-swarm-secrets
Copy secrets between docker swarm clusters via ssh

# Install

```
docker run --rm --entrypoint=cat nickadam/copy-swarm-secrets copy-swarm-secrets.sh > copy-swarm-secrets.sh
chmod +x copy-swarm-secrets.sh
```

# Usage

```
./copy-swarm-secrets.sh SOURCE DESTINATION SECRET [SECRET]...
```

# Example

```
./copy-swarm-secrets.sh swarm.example.com localhost database_password ssl_key
```

# Notes

Secret names may not contain spaces. The user SSHing to the remote system must
have permissions to run docker.

repository: nickadam/copy-swarm-secrets

repo_name: nickadam/copy-swarm-secrets


text:
---
layout: post
title: Week 3 Day 1
---

# Topics for Today
* Relational Databases
* Postgres cli
* Select Statements
* Joins

# SQL Notes
* [SQL Statements](https://github.com/tiy-lv-python-2015-10/class-notes/blob/master/week3/book-notes.sql)
* [Book DB Dump](https://github.com/tiy-lv-python-2015-10/class-notes/blob/master/week3/dump.zip)

# Creating and Importing Data
1. Make sure postgres is running
2. `psql template1` - This will log you into the db template1
3. `create database movielens;` - This will create the database (don't forget the ;)
4. `\q` will exit you back out to the command line
5. `psql movielens < movielens.sql`

# Homework
[Movie SQL](https://github.com/tiy-lv-python-2015-10/movie-sql)


text:
[//]: # (Image References)

[image1]: https://user-images.githubusercontent.com/10624937/42135619-d90f2f28-7d12-11e8-8823-82b970a54d7e.gif "Trained Agent"

# Project 1: Navigation

![Trained Agent][image1]
## Introduction

In this project, was trained an agent to navigate (and collect bananas!) in a large, square world from Unity. The original project from Udacity, expects an average score of 13.0 in 100 episodes to consider that the environment is solved, but in this project was used 17.0 as targed score.

## Environment

The state space has 37 dimensions and contains the agent's velocity, along with ray-based perception of objects around agent's forward direction.  Given this information, the agent has to learn how to best select actions.  Four discrete actions are available, corresponding to:
- **`0`** - move forward.
- **`1`** - move backward.
- **`2`** - turn left.
- **`3`** - turn right.

A reward of +1 is provided for collecting a yellow banana, and a reward of -1 is provided for collecting a blue banana.  Thus, the goal of your agent is to collect as many yellow bananas as possible while avoiding blue bananas.

The environment is considered solved if the agent obtain an average score of 17.0 in 100 episodes.

## Getting Started

1. Download the environment from one of the links below.  You need only select the environment that matches your operating system:
    - Linux: [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/Banana_Linux.zip)
    - Mac OSX: [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/Banana.app.zip)
    - Windows (32-bit): [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/Banana_Windows_x86.zip)
    - Windows (64-bit): [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/Banana_Windows_x86_64.zip)

    (_For Windows users_) Check out [this link](https://support.microsoft.com/en-us/help/827218/how-to-determine-whether-a-computer-is-running-a-32-bit-version-or-64) if you need help with determining if your computer is running a 32-bit version or 64-bit version of the Windows operating system.

    (_For AWS_) If you'd like to train the agent on AWS (and have not [enabled a virtual screen](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Training-on-Amazon-Web-Service.md)), then please use [this link](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/Banana_Linux_NoVis.zip) to obtain the environment.

2. Place the file in the DRLND GitHub repository, in the `p1_navigation/Banana` folder, and unzip (or decompress) the files.

## (Optional) Challenge: Learning from Pixels

You'll need to download a new Unity environment.  This environment is almost identical to the project environment, where the only difference is that the state is an 84 x 84 RGB image, corresponding to the agent's first-person view.  (**Note**: Udacity students should not submit a project with this new environment.)

Then, place the file in the `p1_navigation/Banana_pixels` folder in the DRLND GitHub repository, and unzip (or decompress) the file.  Next, open `Navigation_Pixels.ipynb` and follow the instructions to learn how to use the Python API to control the agent.

You need only select the environment that matches your operating system:
- Linux: [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/VisualBanana_Linux.zip)
- Mac OSX: [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/VisualBanana.app.zip)
- Windows (32-bit): [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/VisualBanana_Windows_x86.zip)
- Windows (64-bit): [click here](https://s3-us-west-1.amazonaws.com/udacity-drlnd/P1/Banana/VisualBanana_Windows_x86_64.zip)

(_For AWS_) If you'd like to train the agent on AWS, you must follow the instructions to [set up X Server](https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Training-on-Amazon-Web-Service.md), and then download the environment for the **Linux** operating system above.

## Training an agent

Open `Navigation - Solution.ipynb` notebook and run the code, the models should be saved at `models/` folder.

repository: rodrigoAMF/DRLND-Udacity

gha_language: Jupyter Notebook

repo_name: rodrigoAMF/DRLND-Udacity


text:
# storm-docker

[![](https://images.microbadger.com/badges/version/sunside/storm.svg)](http://microbadger.com/images/sunside/storm "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/sunside/storm.svg)](http://microbadger.com/images/sunside/storm "Get your own image badge on microbadger.com")

Dockerfiles for building a storm cluster. Inspired by [https://github.com/ptgoetz/storm-vagrant](https://github.com/ptgoetz/storm-vagrant) and [https://github.com/wurstmeister/storm-docker](https://github.com/wurstmeister/storm-docker).

## Pre-Requisites

- install docker-compose [http://docs.docker.com/compose/install/](http://docs.docker.com/compose/install/)

## Usage

Start a cluster:

- ```docker-compose up```

Destroy a cluster:

- ```docker-compose stop```

Add more supervisors:

- ```docker-compose scale supervisor=3```

## Building

- ```rebuild.sh```

## Running a supervisor

Here, `SUPERVISOR_ADDRESS` is the address of the supervisor's host.

```bash
docker run -d --restart=unless-stopped \
        --name storm-supervisor \
        -p 8000:8000 \
        -e "NIMBUS_ADDRESS=<IP_ADDRESS>" \
        -e "NIMBUS_DRPC_PORT=49772" \
        -e "NIMBUS_DRPCI_PORT=49773" \
        -e "ZOOKEEPER_ADDRESS=<IP_ADDRESS>" \
        -e "ZOOKEEPER_PORT=49181" \
        -e "SUPERVISOR_ADDRESS=<IP_ADDRESS>" \
        sunside/storm-supervisor:0.10.0
```

## FAQ
### How can I access Storm UI from my host?
Take a look at docker-compose.yml:

    ui:
      image: sunside/storm-ui:0.10.0
	      ports:
	        - "49080:8080"

This tells Docker to expose the Docker UI container's port 8080 as port 49080 on the host

If you are running docker natively you can use localhost. If you're using boot2docker, then do:

    $ boot2docker ip
    The VM's Host only interface IP address is: <IP_ADDRESS>

Which returns your docker VM's IP.

So, to open storm UI, type the following in your browser:

    localhost:49080

or

    <IP_ADDRESS>:49080

in my case.

### How can I deploy a topology?
Since the nimbus host and port are not default, you need to specify where the nimbus host is, and what is the nimbus port number.

Following the example above, after discovering the nimbus host IP (could be localhost, could be our docker VM ip as in the case of boot2docker), run the following command:

    storm jar target/your-topology-fat-jar.jar com.your.package.AndTopology topology-name -c nimbus.host=<IP_ADDRESS> -c nimbus.thrift.port=49627

repository: sunsided/storm-docker

repo_name: sunsided/storm-docker


text:
# Getting Started with -saying *Goodbye*

Hyper Island  – FED22 – Dec 2020

---

### A *coding guru* once said:

## "With every brief we explore a new frontier."

We believe he was right.

This last brief is to appreciate his wisdom!

- From everyone at FED '22

---

![Thank you Mario!](./images/mario.png)

---

>*Reda*, thank you for being the person that the students could rely on in their most important times in their education.

I will always remember you as a trustworthy, creative, pedagogical but first and foremost truly kind friend.

P.S.

repository: omidhq/whatthefoo

repo_name: omidhq/whatthefoo


text:
## Generics Part 5: Type checked Elaborator Scripts

In this part of the tutorial we try out at a new technique to get back
some of our beloved type safety when writing elaborator scripts.

```idris
module Doc.Generic5

import public Language.Reflection.Derive
import Doc.Generic1

%language ElabReflection
```

### Properly Typed Default Implementations

When we look back at [Generics Part 4](Generic4.md),
we find that the writing of `Eq'` and `Ord'` forced us to implement these
completely in the untyped world of `TTImp`, simply because we did not
have access to the corresponding record constructors of
`Eq` and `Ord`. But it is actually very easy to get that
constructor back as a properly typed function by using
function `check` from `Language.Reflection`:

```idris
mkEq' : (eq : a -> a -> Bool) -> (neq : a -> a -> Bool) -> Eq a
mkEq' = %runElab check (var $ singleCon "Eq")
```

So, `check` tries to retype an untyped `TTImp` value during
elaboration reflection. Needless to say, we get a type error
if the types do not match. The following, for instance, does not
compile:

```
mkEq' : (eq : a -> a -> Bool) -> Eq a
mkEq' = %runElab check (var $ singleCon "Eq")
```

Now that we have access to `Eq`'s constructor, we can get quite a bit
of type safety back:

```idris
mkEq : (eq : a -> a -> Bool) -> Eq a
mkEq eq = mkEq' eq (\a,b => not $ eq a b)

Eq' : DeriveUtil -> InterfaceImpl
Eq' g = MkInterfaceImpl "Eq" Public `(mkEq genEq) (implementationType `(Eq) g)
```

This time, we used the utilities from `Language.Reflection.Derive`.
They are very similar in functionality to the ones developed in
[Generics Part 4](Generic4.md). This
approach is even more useful when deriving `Ord`: In our previous
version we had to manually pass the `Eq` instance to the `Ord`
constructor forcing us to get access to its implementation function
by means of `implName`. This is now no longer necessary:

```idris
mkOrd' :  (1 _ : Eq a)
      -> (compare : a -> a -> Ordering)
      -> (lt : a -> a -> Bool)
      -> (gt : a -> a -> Bool)
      -> (leq : a -> a -> Bool)
      -> (geq : a -> a -> Bool)
      -> (min : a -> a -> a)
      -> (max : a -> a -> a)
      -> Ord a
mkOrd' = %runElab check (var $ singleCon "Ord")

mkOrd : (1 prf : Eq a) => (comp : a -> a -> Ordering) -> Ord a
mkOrd comp = mkOrd' prf
                    comp
                    (\a,b => comp a b == LT)
                    (\a,b => comp a b == GT)
                    (\a,b => comp a b /= GT)
                    (\a,b => comp a b /= LT)
                    (\a,b => if comp a b == GT then a else b)
                    (\a,b => if comp a b == LT then a else b)

Ord' : DeriveUtil -> InterfaceImpl
Ord' g = MkInterfaceImpl "Ord" Public `(mkOrd genCompare)
                                      (implementationType `(Ord) g)
```

We quickly test if it works:

```idris
data Test a = Foo a | Bar String

Generic (Test a) [[a],[String]] where
  from (Foo a) = Z [a]
  from (Bar s) = S $ Z [s]

  to (Z [a])     = Foo a
  to (S $ Z [s]) = Bar s

%runElab (derive "Test" [Eq',Ord'])

ordTest : Foo (the Int 12) <= Bar "bar" = True
ordTest = Refl
```

### Conclusion

In this very short tutorial we learned that
function `check` is useful whenever we try to implement
a function using elaborator reflection whose type is already known at compile time.
This was not the case for automatically derived interface implementations
whose full type had to be put together from the correspoding
data type's constructors, type parameters, and constructor
arguments. It was, however, possible for functions to create
interface record values whose type we already knew but whose
strangely named constructors we could not use directly in our code.


text:
# Ultrasonic-Altimiter
An IOT-based ultrasonic altimeter for determination of water level in resources.

In this project an iot-based altimeter has been designed to determite the level of water by an ultrasonic waves and report it on mobile alpplications as a volume of water stored in the sources through GSM sim-900 modem.

repository: PAminai/Ultrasonic-Altimiter

repo_name: PAminai/Ultrasonic-Altimiter


text:
# Kubernetes Artifacts for WSO2 Data Analytics Server #
These Kubernetes Artifacts provide the resources and instructions to deploy WSO2 Data Analytics Server on Kubernetes.

## Try it out
Quick steps to run WSO2 Data Analytics Server Docker image in the Standalone mode on Kubernetes.

* Prerequisites
    - Ensure that the default profile of Data Analytics Server Docker image is built and loaded in the Kubernetes node.
    Instructions on how to build Data Analytics Server Docker image is explained in the [Dockerfile for WSO2 Data Analytics Server](https://github.com/wso2/dockerfiles/tree/master/wso2das/README.md#building-the-docker-images). The image can be transfered to the Kubernetes nodes using the `load-images.sh` script.

* Deploying in the Standalone mode
    - The `deploy.sh` script will detect one of the Kubernetes nodes as the host IP, for service health check when the artifacts are deployed. `kubectl` should be working for this to work correctly.
    - Execute `deploy.sh` script.
        + `./deploy.sh`

* Access management console
    - Add an `/etc/hosts` entry in your local machine for `<kubernetes_node_ip> das.wso2.com`. For example:
        + `<IP_ADDRESS>       das.wso2.com`
    - To access the management console.
        +  `https://das.wso2.com:32061/carbon`.

## Undeploying
* To undeploy the Services and the Replication Controllers for the default or distributed deployment, execute `undeploy.sh`.


text:
# Change Log

## TBD

* The response object is now returned in the callback.

## 1.0.1

* The multipart upload endpoints now correctly use `v1` instead of `v0`.

## 1.0.0

* The API version has been updated to `v1`. This introduces backwards
  incompatible changes. Please review the
  [migration guide](https://developers.kloudless.com/docs/v1/migration)
  for more information on migrating from `v0` to `v1`.

repository: venzee/kloudless-node

repo_name: venzee/kloudless-node


text:
---
title: medneo
description: Radiology as a Service
weight: -130
type: client
image: /img/references/medneo.png
---

At [medneo](https://www.medneo.com/), we help build a secure, stable infrastructure, enforcing a separation of concerns and help build meaningful monitoring. We also help in keeping them up to date in all matters GDPR.

repository: port-zero/website

gha_language: CSS

repo_name: port-zero/website


text:
# bindbc-freetype
This project provides both static and dynamic bindings to the [FreeType library](https://www.freetype.org/). They are `@nogc` and `nothrow` compatible can be compiled for compatibility with `-betterC`. This package is intended as a replacement of [DerelictFT](https://github.com/DerelictOrg/DerelictFT), which is not compatible with `@nogc`,  `nothrow`, or `-betterC`.

## Usage
By default, `bindbc-freetype` is configured to compile as a dynamic binding that is not `-betterC` compatible. The dynamic binding has no link-time dependency on the FreeType library, so the FreeType shared library must be manually loaded at runtime. When configured as a static binding, there is a link-time dependency on the FreeType library---either the static library or the appropriate file for linking with shared libraries on your platform (see below).

When using DUB to manage your project, the static binding can be enabled via a DUB `subConfiguration` statement in your project's package file. `-betterC` compatibility is also enabled via subconfigurations.

To use FreeType, add `bindbc-freetype` as a dependency to your project's package config file. For example, the following is configured to FreeType as a dynamic binding that is not `-betterC` compatible:

__dub.json__
```
dependencies {
    "bindbc-freetype": "~>0.1.0",
}
```

__dub.sdl__
```
dependency "bindbc-freetypee" version="~>0.1.0"
```

### The dynamic binding
The dynamic binding requires no special configuration when using DUB to manage your project. There is no link-time dependency. At runtime, the FreeType shared library is required to be on the shared library search path of the user's system. On Windows, this is typically handled by distributing the FreeType DLL with your program. On other systems, it usually means the user must install the FreeType runtime library through a package manager.

To load the shared library, you need to call the `loadFreeType` function. This returns a member of the `FTSupport` enumeration (See [the README for `bindbc.loader`](https://github.com/BindBC/bindbc-loader/blob/master/README.md) for the error handling API):

* `FTSupport.noLibrary` indicating that the library failed to load (it couldn't be found)
* `FTSupport.badLibrary` indicating that one or more symbols in the library failed to load
* a member of `FTSupport` indicating a version number that matches the version of FreeType that `bindbc-freetype` was configured at compile-time to load. By default, that is `FTSupport.ft26`, but can be configured via a version identifier (see below). This value will match the global manifest constant, `ftSupport`.

```d
import bindbc.freetype;

/*
This version attempts to load the FreeType shared library using well-known variations
of the library name for the host system.
*/
FTSupport ret = loadFreeType();
if(ret != ftSupport) {

    // Handle error. For most use cases, its reasonable to use the the error handling API in
    // bindbc-loader to retrieve error messages for logging and then abort. If necessary, it's
    // possible to determine the root cause via the return value:

    if(ret == FTSupport.noLibrary) {
        // FreeType shared library failed to load
    }
    else if(FTSupport.badLibrary) {
        // One or more symbols failed to load. The likely cause is that the
        // shared library is for a lower version than bindbc-freetype was configured
        // to load (via FT_26, FT_27, etc.)
    }
}
/*
This version attempts to load the FreeType library using a user-supplied file name.
Usually, the name and/or path used will be platform specific, as in this example
which attempts to load `freetype.dll` from the `libs` subdirectory, relative
to the executable, only on Windows.
*/
// version(Windows) loadFreeType("libs/freetype.dll")
```
By default, the `bindbc-freetype` binding is configured to compile to load FreeType 2.6. This ensures the widest level of compatibility at runtime. This behavior can be overridden via the `-version` compiler switch or the `versions` DUB directive with the desired FreeType version number. It is recommended that you always select the minimum version you require _and no higher_. In this example, the FreeType dynamic binding is compiled to support FreeType 2.7:

__dub.json__
```
"dependencies": {
    "bindbc-freetype": "~>0.1.0"
},
"versions": ["FT_27"]
```

__dub.sdl__
```
dependency "bindbc-freetype" version="~>0.1.0"
versions "FT_27"
```

With this example configuration, `ftSupport == FTSupport.ft27`. If FreeType 2.7 or later is installed on the user's system, `loadFreeType` will return `FTSupport.ft27`. If only FreeType 2.6 is installed, `loadFreeType` will return `FTSupport.badLibrary`. In this scenario, calling `loadedFreeTypeVersion()` will return a `FTSupport` member indicating which version of FreeType, if any, actually loaded. If a lower version was loaded, it's still possible to call functions from that version of FreeType, but any calls to functions from higher versions will result in a null pointer access. For this reason, it's recommended to always specify your required version of the FreeType library at compile time and abort when you receive a `FTSupport.badLibrary` return value from `loadFreeType`.

No matter which version was configured, the successfully loaded version can be obtained via a call to `loadedFreeTypeVersion`. It returns one of the following:

* `FTSupport.noLibrary` if `loadFreeType` returned `FTSupport.noLibrary`
* `FTSupport.badLibrary` if `loadFreeType` returned `FTSupport.badLibrary` and no version of FreeType successfully loaded
* a member of `FTSupport` indicating the version of FreeType that successfully loaded. When `loadFreeType` returns `FTSupport.badLibrary`, this will be a version number lower than that configured at compile time. Otherwise, it will be the same as the manifest constant `ftSupport`.

The function `isFreeTypeLoaded` returns `true` if any version of FreeType was successfully loaded and `false` otherwise.

Following are the supported versions of FreeType, the corresponding version IDs to pass to the compiler, and the corresponding `FTSupport` members.

| Library & Version  | Version ID       | `FTSupport` Member |
|--------------------|------------------|--------------------|
|FreeType 2.6.4      | Default          | `FTSupport.ft26`   |
|FreeType 2.7.1      | FT_27            | `FTSupport.ft27`   |
|FreeType 2.8.1      | FT_28            | `FTSupport.ft28`   |
|FreeType 2.9.1      | FT_29            | `FTSupport.ft29`   |
|FreeType 2.10.2     | FT_210           | `FTSupport.ft210`  |

## The static binding
The static binding has a link-time dependency on either the shared or the static FreeType library. On Windows, you can link with the static library or, to use the shared library (`freetype.dll`), with the import library. On other systems, you can link with either the static library or directly with the shared library. This requires the FreeType development package be installed on your system at compile time, either by compiling the FreeType source yourself, downloading the FreeType precompiled binaries for Windows, or installing via a system package manager. [See the FreeType download page](https://www.freetype.org/download.html) for details.

When linking with the static library, there is no runtime dependency on FreeType. When linking with the shared library (or the import library on Windows), the runtime dependency is the same as the dynamic binding, the difference being that the shared library is no longer loaded manually---loading is handled automatically by the system when the program is launched.

Enabling the static binding can be done in two ways.

### Via the compiler's `-version` switch or DUB's `versions` directive
Pass the `BindFT_Static` version to the compiler and link with the appropriate library.

When using the compiler command line or a build system that doesn't support DUB, this is the only option. The `-version=BindFT_Static` option should be passed to the compiler when building your program. All of the required C libraries, as well as the `bindbc-freetype` and `bindbc-loader` static libraries must also be passed to the compiler on the command line or via your build system's configuration.

When using DUB, its `versions` directive is an option. For example, when using the static binding:

__dub.json__
```
"dependencies": {
    "bindbc-freetype": "~>0.1.0"
},
"versions": ["BindFT_Static"],
"libs": ["freetype"]
```

__dub.sdl__
```
dependency "bindbc-freetype" version="~>0.1.0"
versions "BindFT_Static"
libs "freetype"
```

### Via DUB subconfigurations
Instead of using DUB's `versions` directive, a `subConfiguration` can be used. Enable the `static` subconfiguration for the `bindbc-freetype` dependency:

__dub.json__
```
"dependencies": {
    "bindbc-freetype": "~>0.1.0"
},
"subConfigurations": {
    "bindbc-freetype": "static"
},
"libs": ["freetype"]
```

__dub.sdl__
```
dependency "bindbc-freetype" version="~>0.1.0"
subConfiguration "bindbc-freetype" "static"
libs "freetype"
```

This has the benefit that it completely excludes from the build any source modules related to the dynamic binding, i.e. they will never be passed to the compiler.

## `betterC` support

`betterC` support is enabled via the `dynamicBC` and `staticBC` subconfigurations, for dynamic and static bindings respectively. To enable the static binding with `-betterC` support:

__dub.json__
```
"dependencies": {
    "bindbc-freetype": "~>0.1.0"
},
"subConfigurations": {
    "bindbc-freetype": "staticBC"
},
"libs": ["freetype"]
```

__dub.sdl__
```
dependency "bindbc-freetype" version="~>0.1.0"
subConfiguration "bindbc-freetype" "staticBC"
libs "freetype"
```

When not using DUB to manage your project, first use DUB to compile the BindBC libraries with the `dynamicBC` or `staticBC` configuration, then pass `-betterC` to the compiler when building your project.

gha_language: D