text:
The convention is simple: to document a type, variable, constant, function, or even a package, write a regular comment directly preceding its declaration, with no intervening blank line. Godoc will then present that comment as text alongside the item it documents. For example, this is the documentation for the `fmt` package's `Fprint` function:

```go
// Fprint formats using the default formats for its operands and writes to w.
// Spaces are added between operands when neither is a string.
// It returns the number of bytes written and any write error encountered.
func Fprint(w io.Writer, a ...interface{}) (n int, err error) {
```

### Types

* `int`
* `float32`, `float64`
* `bool`
* `string`
* `byte`: alias for `uint8`

```go
// programs by default are written in main

// importing multiple packages
import (
    "fmt"
    "math"
)

// declaring variables
var x, y = 1, 2
a, b := 3, 4
const c = 65  // not :=

// variables can be declared in an if stmt!
// they are only in the scope until the end of the if!
// notice no parens but must have {}
if v := 1; v = true {
    fmt.Println("Cool eh?")
} else {
    fmt.Println("Yeah")
}

// switch statement auto adds the break stmt!
// so it won't pass through multiple cases!
// it doesn't need a condition!
switch x := 1; x {
    case 1:
        fmt.Println("Yeah")
    case 2:
        fmt.Println("Never reached!")
    default:
        fmt.Println("Seems normal C")
}

// structs
type Vertex struct {
    X, Y int
}

var (
    v1 = Vertex{1, 2}  // has type Vertex
    v2 = Vertex{X: 1}  // Y:0 is implicit
    v3 = Vertex{}      // X:0 and Y:0
    p  = &Vertex{1, 2} // has type *Vertex
)

// arrays
var arr [10]string // literally an array of strings!
arr[0] = "start of"
arr[1] = "a super long string!"
primes := [6]int{2, 3, 5, 7, 11, 13}

// slices - list magic equivalent
// very efficient - basically pointers
s := []int{2, 3, 5, 7, 11, 13}
a := make([]int, x) // dynamic
a := make([]int, length, capacity) // dynamic

// if you specify a lower bound when slicing
// this will affect the capacity!
// otherwise specifying an upper bound doesn't!
s = s[1:] // cap -= 1
s = [:0] // no change in cap, only in len

// function declarations
// this syntax is to avoid the disgusting C function pointers
func swap(x, y string) (string, string) {
    return y, x
}

// main function
func main() {
    a, b := swap("hello", "world")  // like Python :D
    fmt.Println(a, b)
}

```

#### Printing

```go
s := "go is interesting"  // double quotes matter!
fmt.Printf("Type: %T, val: %v\n", 100, 100)
fmt.Printf("Type: %T, without quotes: %v, with quotes: %q\n", s, s, s)
```

### Slices

Slices deserves its own space - really awesome data structure like lists in Python but better and a bit more magic.

* length of a slice is the number of elements it contains.
* capacity of a slice is the number of elements in the underlying array, counting from the first element in the slice.
* `len(s)` and `cap(s)`.

```go
// more interesting ones
s := []struct {
        i int
        b bool
    }{
        {11, false},
        {13, true},
    }

// extending a slice
// actually allocates in multiples of 2
var s []int            // len(0), cap(0)
s = append(s, 0, 1)    // len(3), cap(2)
s = append(s, 2, 3, 4) // len(5), cap(8)

// array literal
a := [3]bool{true, true, false};
// this creates the same array as above, then builds a slice that references it
a := []bool{true, true, false}

// iterate slice with range
for i, v := range a {
    fmt.Printf("index: %d = val: %d\n", i, v)
}
```

#### make

The make function allocates a zeroed array and *returns a slice* that refers to that array:

```go
a := make([]int, 5)  // len(a)=5

// to specify a capacity, pass a third argument to make:
b := make([]int, 0, 5) // len(b)=0, cap(b)=5

b = b[:cap(b)] // len(b)=5, cap(b)=5
b = b[1:]      // len(b)=4, cap(b)=4

```

### Defers

[See more here](https://blog.golang.org/defer-panic-and-recover)

repository: burrt/compsci-docs

branch_name: refs/heads/gh-pages

gha_language: CSS

repo_name: burrt/compsci-docs


text:
# MADER: Trajectory Planner in Multi-Agent and Dynamic Environments #

### **Accepted for publication in the IEEE Transactions on Robotics (T-RO)**

Single-Agent               |  Multi-Agent           |
:-------------------------:|:-------------------------:|
[![MADER: Trajectory Planner in Multi-Agent and Dynamic Environments](./mader/imgs/single_agent1.gif)](https://www.youtube.com/watch?v=aoSoiZDfxGE "MADER: Trajectory Planner in Multi-Agent and Dynamic Environments")      |  [![MADER: Trajectory Planner in Multi-Agent and Dynamic Environments](./mader/imgs/circle.gif)](https://www.youtube.com/watch?v=aoSoiZDfxGE "MADER: Trajectory Planner in Multi-Agent and Dynamic Environments") |
[![MADER: Trajectory Planner in Multi-Agent and Dynamic Environments](./mader/imgs/single_agent2.gif)](https://www.youtube.com/watch?v=aoSoiZDfxGE "MADER: Trajectory Planner in Multi-Agent and Dynamic Environments")       |  [![MADER: Trajectory Planner in Multi-Agent and Dynamic Environments](./mader/imgs/sphere.gif)](https://www.youtube.com/watch?v=aoSoiZDfxGE "MADER: Trajectory Planner in Multi-Agent and Dynamic Environments")    |

## Citation

When using MADER, please cite [MADER: Trajectory Planner in Multi-Agent and Dynamic Environments](https://arxiv.org/abs/2010.11061) ([pdf](https://arxiv.org/abs/2010.11061), [video](https://www.youtube.com/watch?v=aoSoiZDfxGE)):

```bibtex
@article{tordesillas2020mader,
  title={{MADER}: Trajectory Planner in Multi-Agent and Dynamic Environments},
  author={Tordesillas, Jesus and How, Jonathan P},
  journal={IEEE Transactions on Robotics},
  year={2021},
  publisher={IEEE}
}
```

## General Setup

MADER has been tested with
* Ubuntu 16.04/ROS Kinetic
* Ubuntu 18.04/ROS Melodic

The backend optimizer can be either Gurobi (recommended, used by default) or NLOPT (discouraged):

* To use [`Gurobi`](https://www.gurobi.com/), install the [Gurobi Optimizer](https://www.gurobi.com/products/gurobi-optimizer/). You can test your installation typing `gurobi.sh` in the terminal. Have a look at [this section](#issues-when-installing-gurobi) if you have any issues.
* To use [`NLOPT`](https://nlopt.readthedocs.io/en/latest/), set `USE_GUROBI` to `OFF` in the [CMakeList.txt](https://github.com/mit-acl/mader/blob/master/mader/CMakeLists.txt).

Then simply run this commands:

```bash
cd ~/ && mkdir ws && cd ws && mkdir src && cd src
git clone https://github.com/mit-acl/mader.git
cd ..
#bash bash mader/install_nlopt.sh      #ONLY if you are going to use NLOPT, it'll install NLopt v2.6.2
bash mader/install_and_compile.sh
```

The script [install_and_compile.sh](https://github.com/mit-acl/mader/blob/master/install_and_compile.sh) will install [CGAL v4.12.4](https://www.cgal.org/), [GLPK](https://www.gnu.org/software/glpk/) and other ROS packages (check the script for details). It will also compile the repo. This bash script assumes that you already have ROS installed in your machine.

### Running Simulations

#### Single-agent
```
roslaunch mader single_agent_simulation.launch
```
Now you can press `G` (or click the option `2D Nav Goal` on the top bar of RVIZ) and click any goal for the drone.

To run many single-agent simulations in different random environments, you can go to the `scripts` folder and execute `python run_many_sims_single_agent.py`.

#### Multi-agent

> **Note**: For a high number of agents, the performance of MADER improves with the number of CPUs available in your computer.

Open four terminals and run these commands:

```
roslaunch mader mader_general.launch type_of_environment:="dynamic_forest"
roslaunch mader many_drones.launch action:=start
roslaunch mader many_drones.launch action:=mader
roslaunch mader many_drones.launch action:=send_goal
```

(if you want to modify the drone radius, you can do so in `mader.yaml`). For the tables shown in the paper, the parameters (drone radius, max vel,...) used are also detailed in the corresponding section of the paper

#### Octopus Search
You can run the octopus search with a dynamic obstacle by simply running

```
roslaunch mader octopus_search.launch
```
And you should obtain this:

![](./mader/imgs/octopus_search.png)

(note that the octopus search has some randomness in it, so you may obtain a different result each time you run it).

## Issues when installing Gurobi:

If you find the error:
```
“gurobi_continuous.cpp:(.text.startup+0x74): undefined reference to
`GRBModel::set(GRB_StringAttr, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'”
```
The solution is:

```bash
cd /opt/gurobi800/linux64/src/build  #Note that the name of the folder gurobi800 changes according to the Gurobi version
sudo make
sudo cp libgurobi_c++.a ../../lib/
```

## Credits:
This package uses some C++ classes from the [DecompROS](https://github.com/sikang/DecompROS) repo (included in the `thirdparty` folder).

---------

> **Approval for release**: This code was approved for release by The Boeing Company in December 2020.

repository: t-thanh/mader-docker

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: t-thanh/mader-docker


text:
---
path: 'web-perf-2/'
title: 'How to use Preload/Prefetch to boost load time'
subtitle: 'Web performance series - part 2'
date: 2018-10-06
author: Yaser Adel Mehraban
categories: [Web, Performance]
tags: [web, performance, preload, prefetch]
thumbnail: '.WebPerformance.jpg'
---

Recently I had a chance to present a talk at [NDC Sydney](https://ndcsydney.com/talk/need-for-speed-8-performance-tuning-of-your-web-application/) about web performance and it received a great feedback.

<!--more-->

That inspired me to write up a series of posts on each topic I covered in that talk, and who knows, maybe each of these posts would be a talk some day by their own 😃.

Link to all other parts:

[Part 1 on HTML and CSS](/blog/2018/09/29/web-perf-1)

[Part 3 JavaScript tips and tricks](/blog/2018/10/12/web-perf-3)

[Part 4 Image optimisation](/blog/2018/11/12/web-perf-4)

[Part 5 Web font optimisation](/blog/2018/11/23/web-perf-5)

OK, just to recap, here are the rules from part 1:

- Stream HTML to client
- Send minimal CSS and send it fast

In this part, we're going to see how we can request our resources before we need them. You might be wondering why we want to do so, and the answer is, if you want to send minimal CSS to client, or any other resource for that matter, you need to break them into smaller pieces and load them separately.

But, we can do better. One of the letters from [PRPL pattern](https://developers.google.com/web/fundamentals/performance/prpl-pattern/) stands for `pre-cache`. An effective way to load your resources before they are required, cache them and then use them when they are needed. We can achieve this using `preload` and `prefetch` features of browsers.

Before we go further into how, let me explain their difference:

### Preload

`<link rel="preload">` tells the browser that the resource should be loaded as part of the current navigation and it should start fetching it ASAP. This attribute can be applied to CSS, fonts, images, JavaScript files and more. When using this attribute you will also tell the browser what file type this file has, which can be set in an `as` attribute:

```html
<link
  rel="preload"
  as="script"
  href="super-important.js"
/>
<link
  rel="preload"
  as="style"
  href="critical.css"
/>
```

So by now you should have guessed that `preload` is used in the current route and resources fetched via this technique are very important. The difference between using `rel=preload` and `rel=stylesheet` is that browser will know about that resource way ahead of time allowing the download to start sooner.

If you are trying this for your stylesheet and don't see your styles get applied, it is because there is a catch when using `preload` which is the browser downloads the resource but won't apply it until we tell it to. To get it working you will need a bit of JavaScript:

```html
<link
  rel="preload"
  as="style"
  href="critical.css"
  onload="this.rel='stylesheet'"
/>
```

What happens now is that the styles get applied as soon as the file is loaded.

### Prefetch

`<link rel="prefetch">` is different from `<link rel="preload">` in that it is not trying to load a critical resource faster, it is trying to load a non-critical resource sooner.

Resources loaded by this technique are loaded after current page is loaded, page load event is finished and bandwidth is available. This means it is ideal for lazy loading future routes' resources or resources that user might need later. Some use cases are fetching a next page if pagination is used:

```html
<link rel="prefetch" href="page-2.html" />
```

By the time user clicks on next page button, the page is already loaded and the app feels real fast.

To read more about the usage of these features and also know about other useful features, have a look at [Google developer's resource prioritisation page.](https://developers.google.com/web/fundamentals/performance/resource-prioritization)

Same catch applied for `prefetch` as well. But since we are loading a resource which is required potentially for a different route, you might have a separate `rel=stylesheet` on that page which uses this in memory file or in case of a SPA just set the `rel` to `stylesheet` when the route is loaded.

## When to use these

So to emphasise why we need to know about these techniques, let me take you back to part one. CSS is a render blocking element, so we need to break it down to the smallest possible chunk which is required to render our main route. Then we can use the above techniques to either load the resource later in the same page without blocking the rendering or to load the resource which is required for our possible next route beforehand and use it when needed.

Hope this has helped you to get started with optimising your HTML and CSS loading so far.

Next post will be on `JavaScript` and what we can do there to improve our web application's performance.

Alla prossima 😎.

license: MIT

branch_name: refs/heads/main

gha_language: JavaScript

gha_license_id: MIT


text:
# stereo_match
read sidebyside stereo image and make disparity image with sgbm

# make_dataset
read sidebyside image and generate stereo image and xml file for ./cpp-example-stereo_calib to calibrate
found it in opencv_source_dir/build/bin/, source code in opencv_source_dir/samples/cpp/
./stereo_calib -w=<board_width default=9> -h=<board_height default=6> -s=<square_size default=1.0> <image list XML/YML file default=../data/stereo_calib.xml>


text:
[![Build status](https://ci.appveyor.com/api/projects/status/fx4dyiwbxah5xajw/branch/master?svg=true)](https://ci.appveyor.com/project/Suremaker/psmake/branch/master)

# PsMake
A PowerShell based tool which controls a software project build process.

# Quickstart

*Assumptions:*
* *nuget.exe is on PATH environment variable*
* *Powershell window is opened :)*

#### 1. Install psmake and create an example make structure

Please execute following commands:
```
nuget.exe install psmake -version <IP_ADDRESS>
.\psmake.<IP_ADDRESS>\psmake.ps1 -Scaffold empty
ls
```

The output should be similar to this one:
```
D:\tmp> nuget.exe install psmake -version <IP_ADDRESS>
Installing 'psmake <IP_ADDRESS>'.
Successfully installed 'psmake <IP_ADDRESS>'.

D:\tmp> .\psmake.<IP_ADDRESS>\psmake.ps1 -Scaffold empty
Scaffolding project type: empty
Creating ....
Creating make.ps1...
Creating Makefile.ps1...

D:\tmp> ls

    Directory: D:\tmp

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        08/04/2015     13:45            psmake.<IP_ADDRESS>
-a---        08/04/2015     13:45         22 Defaults.ps1
-a---        08/04/2015     13:45        650 make.ps1
-a---        08/04/2015     13:45        189 Makefile.ps1
```

The current directory would contain a following files:
* Defaults.ps1 - a file with default parameters that would be used during make,
* Makefile.ps1 - a file with all step definitions,
* make.ps1 - a file that performs a make.

*Please note that make.ps1 installs psmake package before run, so it is not needed to include psmake package is sources*

#### 2. Running make
Please execute following commands:
```
PS> .\make.ps1 -Target build
```

The output should be like:
```
D:\tmp> .\make.ps1 -Target build
'psmake <IP_ADDRESS>' already installed.

------------------------------------------------------------
- Loading .\Makefile.ps1...
------------------------------------------------------------

1. Step one
2. Step two

------------------------------------------------------------
- Loading modules
------------------------------------------------------------

Reading modules...
.\Modules.ps1 does not exist, skipping...

------------------------------------------------------------
- Loading environment config...
------------------------------------------------------------

.\Environment.ps1 does not exist, skipping...

------------------------------------------------------------
- Executing steps...
------------------------------------------------------------

************************************************************
* 1/2: Step one...
************************************************************

Greetings from step one

************************************************************
* 2/2: Step two...
************************************************************

Greetings from step two
Make finished :)
```

#### 3. Browsing makefile
Please execute following commands:
```
PS> cat .\Makefile.ps1
```

The output should be like:
```
Define-Step -Name 'Step one' -Target 'build' -Body {
        echo 'Greetings from step one'
}

Define-Step -Name 'Step two' -Target 'build,deploy' -Body {
        echo 'Greetings from step two'
}
```

The makefile.ps1 contains a definition of two steps: `Step one` and `Step two`
Each step has specified list of targets for which it should be executed.
All the steps would be executed in definition order, however a given step would be executed only if it belongs to target specified in `-target` parameter of `make.ps1`.
That is why `.\make.ps1 -Target build` resulted with execution of both steps.

#### 4. More information

The generated `make.ps1` passes all parameters to main psmake script, which means that it accepts all parameters as psmake.

Please execute `PS> Get-Help .\psmake.<IP_ADDRESS>\psmake.ps1 -Detailed` to see detailed help and additional examples.

Also please visit [wiki](https://github.com/Suremaker/PsMake/wiki) page for further details.

repository: Suremaker/PsMake

gha_language: PowerShell

repo_name: Suremaker/PsMake


text:
# Overview
This is a WebService that provides access to the UK HMRC MTD(MakeTaxDigital) APIs.
The source code for this shim API is hosted under https://hmrc_oauth.awltux.trader.
The intention is to allow Open Source Accounting tools to call
this shim API and provide access to the Open Source unfriendly MTD API.

# MTD API
The MTD API is currently used to submit VAT returns from VAT registered organisations.
The MTD API is protected by two mechanisms that make it difficult to use with
open source accounting products:
1. Developer ID: All calls to the API must contain a valid, pre-registered Devloper ID
2. Callback REST API: This is a pre-registered web address to a SSL secured REST API.

## Developer ID
A developer ID can be created by anyone registering with the HMRC Developer


text:
# stationary-smart-bike
Converting a standard stationary bike into a "smart" bike.

Welcome to the stationary-smart-bike wiki!

## Gatt specification
Cycling Speed and Cadence (CSP)\
UUID: 1816\
type: org.bluetooth.service.cycling_speed_and_cadence\
xml: [https://www.bluetooth.com/.../Gatt/Xml/Services/org.bluetooth.service.cycling_speed_and_cadence.xml](https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org.bluetooth.service.cycling_speed_and_cadence.xml)

| Characteristic | UUID | Link |
| -------------- | ---- | ---- |
| CSC Measurement | 2A5B | [xml](https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.csc_measurement.xml) |
| CSC Feature | 2A5C | [xml](https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.csc_feature.xml) |
| Sensor Location | 2A5D | [xml](https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.sensor_location.xml) |
| SC Control Point | 2A55 | [xml](https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Characteristics/org.bluetooth.characteristic.sc_control_point.xml) |

license: Unlicense

repository: rikard-engstrom/stationary-smart-bike

repo_name: rikard-engstrom/stationary-smart-bike


text:
# JCS_GamepadSpriteHandler

Handle the sprite between the weather gamepad is plugged/unplugged.

## Variables

| Name       | Description                                                             |
|:-----------|:------------------------------------------------------------------------|
| spriteSets | Any sprite element you want to change depends on controller connection. |

gha_language: C#


text:
# PSPushTeams
Collection of scripts used to push notifications to Microsoft Teams

Microsoft Teams has many connectors available including Incoming Webhook.This provides an easy solution to post notifications / messages from any scripting language through JSON formatted web service call.

### Table of Contents
* [Users Expiring Passwords](https://github.com/bwya77/PSPushTeams/blob/master/README.md#post-users-with-expiring-passwords-as-microsoft-teams-message-with-powershell)
* [Inactive User Accounts](https://github.com/bwya77/PSPushTeams/blob/master/README.md#post-inactive-user-accounts-as-a-microsoft-teams-message-with-powershell)
* [Locked Out Accounts](https://github.com/bwya77/PSPushTeams/blob/master/README.md#post-locked-out-ad-user-accounts-to-microsoft-teams-message-with-powershell)

## Post Users with Expiring Passwords as Microsoft Teams Message with PowerShell
Send a Microsoft Teams message containing all of your Active Directory user accounts that have passwords expiring in 7 days or less. (number is configurable)

* [Blog Writeup](https://thelazyadministrator.com/2018/12/07/post-users-with-expiring-passwords-as-team-message-with-powershell/)
* [Download Script](https://github.com/bwya77/PSPushTeams/blob/master/ExpiringPasswordUsers.ps1)

![Post Message](https://thelazyadministrator.com/wp-content/uploads/2018/12/notification-1.png)

____

## Post Inactive User Accounts as a Microsoft Teams Message with PowerShell
Send a Microsoft Teams message containing all of your Active Directory user accounts have not logged on in 90 days or more. (number is configurable)

* [Blog Writeup](https://thelazyadministrator.com/2018/12/11/post-inactive-users-as-a-microsoft-teams-message-with-powershell/)
* [Download Script](https://github.com/bwya77/PSPushTeams/blob/master/InactiveUsers.ps1)

![Post Message](https://thelazyadministrator.com/wp-content/uploads/2018/12/Inactive-Users.png)

____
## Post Locked Out AD User Accounts to Microsoft Teams Message with PowerShell
Send a Microsoft Teams message the moment one of your Active Directory users gets locked out

* [Blog Writeup](https://thelazyadministrator.com/2018/12/13/get-a-teams-notification-the-moment-an-active-directory-user-gets-locked-out-with-powershell-using-webhooks/)
* [Download Script](https://github.com/bwya77/PSPushTeams/blob/master/LockedOutUser.ps1)

![Post Message](https://thelazyadministrator.com/wp-content/uploads/2018/12/lockoutlocation.png)

repository: onpoint-data/PSPushTeams

repo_name: onpoint-data/PSPushTeams


text:
# Notes

My implementation of the [paper](https://arxiv.org/pdf/1903.11323v3.pdf) A novel machine learning based framework for detection of Autism Spectrum Disorder (ASD)

- [ABIDE-I dataset](http://fcon_1000.projects.nitrc.org/indi/abide/abide_I.html)
- VGG16, top layer re-trained on image data
- softmax activation and ADAM optimizer
- learning rate 0.01, use fastai's LR optimizer for improvements?
- 80/20 train/test split


text:
---
layout: post
title: The Super Bowl
date: '2007-02-05 11:12:00 -0700'
mt_id: 1206
blog_id: 1
post_id: 1206
basename: the_super_bowl
published: false
categories:
- go-daddy
- advertising
---

Go Daddy is regularly lambasted for its advertisements, which often feature Candice Michelle, the Go Daddy Girl, provocatively dancing. And by "provocatively" I mean sexually. Belly dancing is provocative, the tango is provocative, what's she's doing is stripping without the stripping. There are countless  examples in Bob's blog of people asserting that the ads are offensive. One of my co-workers wonders whether we will ever "get beyond the cheap and tawdry."

It's a fair question because much of our advertising has focused on the Go Daddy Girls and there is no sign of a let up. But I think my co-worker and his ilk really miss the boat in their analyses.

Sex sells—that is a fact born out by fifty years or more of advertising. People like to be titillated and they buy things from companies that do that. I think that the examples of pornography throughout human history bear witness to the fact that sex is (and always has been) a part of our lives. I think all of Go Daddy's detractors realize this and wouldn't dispute the ads' effectiveness; they just wish that it weren't so.

But how are their wishes going to change human nature? Sex is, at root, necessary for our survival but, more importantly, it's necessary for our personal survival. Sex is wonderful: there's a reason why people respond so well to images of it.  It's a shame, really.

(Note that I am not here speaking of indiscriminate sex. The kind of person who'd have sex with anything that moves doesn't like himself. I am talking about sex coupled to love. That doesn't have to be between a husband and wife, just between two people in love.)

So the people who lament our commercials pine for a unsexual "witty" commercial. I share their enthusiasm for such commercials because they're invariably the most memorable. Think back to all the ads from the past that you can remember. How many of them had a scantily-clad woman writhing around? How many of them made you laugh out loud? I would bet that nearly all of them were the latter—my favorites sure were.

The views expressed on this website/weblog are mine alone and do not necessarily reflect the views of Go Daddy.com Software, Inc.

extension: markdown


text:
---
title: Wrapping up 2012
category: Misc
date: "2012-12-31T22:00:00.000Z"
archived: true
---

Going back to [my post at the beginning of 2012](/blog/2012-is-full-of-goals) when I set out goals for the first time, it has now reached the end of 2012 and it's time to review my progress.

## Contribute to open source projects

This hasn't gone as well as I would have liked. I have had ~10 pull requests accepted over the year, all of which have been reasonably small (less than 5-10 lines changed). It is a start though and I have been working on my own JavaScript framework for a while now, but that may be a few more months before it gets released publicly as I am building applications with it to funnel the direction a few tricky areas are going to go in.
Overall I am going to try more often to open source modular things I have built and try to contribute bug fixes and improvements to the libraries I use.

## Write at least 2 quality blog posts per month

This has been a massive failure, it is probably a crazy goal, quality blog posts are going to take a lot more time for a writer as bad as myself, trying to do two a month in a short amount of time is never going to work.

I think going forward I will write more often, at least every couple of days and then I hope the quality will improve over time with practise.

## Building apps

* Launch and validate 2 apps
* Build a native iPhone or Mac app and have it in the app store
* Build either a native android or windows phone app and have it in the marketplace

These three goals are kind of stupid. Don't even think about launching two apps without first having a great business or product ideas, or at least something tangibly useful.

In the course of 2012 I have worked on several apps though, but this didn't come from me trying to meet this goal, it came naturually like it should have all along.

The main attraction of the year was [Hedgeho.gg](http://hedgeho.gg/), a content platform to make it easier to create and discover professional content–this took the majority of my app building time and has taught me a lot.

In terms of building for the various platforms I have gathered experience with the Mac and iOS ecosystems, and have found out that the mac apps, particularly UI interfaces are about 10 years behind the iOS experience. I still haven't touched android and barely scratched the surface of windows phone, but will concentrate on business more in the future, rather than on platforms.

I've another post coming shortly outlining what I'll be focusing on in 2013.

**The end.**

gha_language: TypeScript


text:
# Contributing Guide

Currently, this guide is mainly for me, as I am writing the book. I am using it to keep track of useful notes for proofreading.

When proofreading, consider:

1. `which` vs `that` - a common error, good guide here: https://www.quickanddirtytips.com/education/grammar/which-versus-that-0?page=1
2. `—` vs `-` - the first comes back from editors sometimes but doesn't render consistently
3. `–` vs `-` - as above.

repository: petervansark/effective-shell

repo_name: petervansark/effective-shell


text:
---
layout: default
---

# 1993-04-22 - Re: Should we become "suits"?

## Header Data

From<EMAIL_ADDRESS>(Timothy C. May)

To<EMAIL_ADDRESS>Message Hash: 740a3348c55d849fd9b3a451c26b41a20cff30cb4097a2577b984d767d709e22

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1993-04-22 05:26:12 UTC

Raw Date: Wed, 21 Apr 93 22:26:12 PDT

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Timothy C. May)
Date: Wed, 21 Apr 93 22:26:12 PDT
To<EMAIL_ADDRESS>Subject: Re: Should we become "suits"?
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Perry Metzger has written a clear summary of his position, which differs
from mine. I won't restate my points, as both our positions are clear. (As
disputes go, it's quite minor...if a good enough alternative to the name
"Cypherpunks" were to be invented, one that still captured our
"no-compromises" position, I would certainly listen with interest. But if
something ain't provably broke....)

I will answer a couple of Perry's specific points:

>The problem is this: the name "Cypherpunks" makes us sound like people
>who break into computers for fun or other such stuff. I was on the
>phone with John Markoff of the New York Times a couple of days ago,
>and I was unhappy that no one had yet changed the name of the group
>because I frankly felt that I could not encourage him to subscribe --
>the results would be unpredictable. I encouraged him to read more
>sci.crypt instead, which he has already been doing.

I talked to Markoff at the Hackers Conference in October...he is already
aware of Cypherpunks. He placed a call to me last week, before the
Clippershit hit the fan, but I was out. His message to me in e-mail was
that he wanted to check up on what the Cypherpunks were doing....so clearly
he knows all about it.

As it turned out, he talked to others. I can only assume Eric Hughes, who
talked to him on Friday, filled him in on Cypherpunks doings...though by
Friday the focus had of course shifted dramatically.

I think Perry is overly worried about the reaction to our name. Neither
Markoff, nor Levy, nor Kelly, nor Dibbell, nor Mandl has seemed disturbed
by the name. And like I said, the name is interesting and acts as a kind of
"Schelling point" (a natural gathering place) for the subculture of crypto
rebels and privacy advocates.

>I've been associated with radical political causes for a while. I've
>found that in general, the radicals are their own worst enemy. People
>are NOT happy about being lectured to by strange-acting people.

I can only hope Perry is not referring to *me*!

Perry comments on my mention of radical groups in the 60s:

>None of whom accomplished any of their goals. You REALLY want to
>emulate them? I've been an occassional visitor to #9 Bleeker Street,
>where Dana Beal, last of the Yippies, holds court. He doesn't wash
>regularly, and he wonders occassionaly why no one takes his drug
>legalization crusade seriously. Hint: they are connected.

I wasn't holding them up as moral beacons, just noting that various
"niches" exist, in kind of a good cop/bad cop sort of way. Journalists like
some "color" and will seek out those who'll provide it. Readers, too, seek
some excitement. The "Crypto Rebels" title of Steven Levy's piece bespeaks
volumes. (Frankly, I really like the name "Crypto Rebels"...I should note
that some of the names we debated last fall were of this flavor, including
"Crypto Liberation Front," "The Crypto Underground," and "Crypto Radicals."
Even a whimsical "Cryptoids."  I guess it's clear that the West Coast camp
is somewhat more radical than Perry might like.)

>We can't afford to lose this fight. This is a matter of life and
>death. Playing out fantasy games about being 1960s radicals is fine
>and well -- when you don't care about the outcome. We can't afford to
>lose, so we can't afford to emulate losing strategies.

Well, I think referring to our activities as "playing out fantasy games" is
somewhat intemperate and misleading. Sounds like rhetorical excess to me.
And implying that I, or the others in our group, don't care about the
outcome is also misleading and, I think, unfair. I won't list our
achievements as a group or as individuals, but I'll remind Perry that I was
the one who correctly picked up on Denning's tone in her Computer Security
Conference paper and posted the original alert to sci.crypt, the "A Trial
Balloon to Ban Encryption?" posting. Last time I counted, there were more
than a thousand replies--some good, some crap, some repetitive--to this
thread. In my opinion, this helped prepare the readers of sci.crypt,
comp.org.eff, Cypherpunks, and Extropians in the current situation.

I'm hoping you were merely carried away by the exuberance of your rhetoric
and do not really believe these charges.

>..... But you are fooling yourself if you
>think people listen to Hippies over Suits.

I didn't argue this.  I was arguing that Gilmore, Hughes, and others, are
perfectly acceptable messengers to the journalists I know. If "suits" are
available and are as articulate, fine. I don't see any around here, though!

Sidenote: I hold to one other fairly debatable view: I don't think reaching
Middle America, Mom and Pop, our neighbors, the Silent Majority, etc., is
really all that important. The battle, such as it is happening, is taking
place amongst a fairly small elite. Others believe that Joe Average needs
to be sold on the virtues of crypto and privacy. Maybe so, but that's not a
battle I see Cypherpunks fighting and winning. If this is really your
point, that the Crypto Rebels/Cypherpunks approach will not be convincing
to the folks in Peoria, then I basically *agree* with you. To reach them,
you'll need Madison Avenue ad campaigns, Perot-style populism, and legions
of smooth talkers hitting the talk shows and airwaves. Not something
Cypherpunks have any intentions of doing, so far as I've heard.

As I said in my first message, perhaps a large lobbying group is needed.
The NRA is a useful model, but recall how long it had to get rolling before
the assault on the Second Amendment started in earnest. In this battle,
there are few lobbying groups, few sources of NRA-style publicity and
funding, and the government has *already* struck. Remember, this is not a
proposal, it's a done deal...our only hope now is to demolish it with
withering criticism, with sabotage of trust in it, and with the rapid
deployment of strong crypto alternatives.

(I don't want to belabor the parallels with the NRA, for various reasons.
Suffice it to say that with gun-owners, Americans had long owned and used
guns and the right was included as the Second Amendment. The NRA thus had a
running head start and had lots of sources of funding. The crypto situation
is much newer, much more abstract, and only has a tiny handful of active
users. Ironically, most of them are balking at paying *anything* to RSA
Data Security to use convincingly strong crypto, so I don't see many folks
shelling out even $25 a year for a subscription to "American Cryptographer"
or whatever. However, I wish anyone who forms such a group the best luck.
I'll certainly support them.)

Back to Perry's points:

>The fact is this: over and over again, every scientific study thats
>been done (by lots of people), every anecdotal comparison I can make
>in things like why one LP candidate did well and another did poorly or
>why one local group soared while another failed, each one of them
>point to the same conclusion: that conclusion is, sadly, that you are
>completely wrong Tim, and that people judge by appearances, and that
>even the most down and out people in our society will take the word of
>a person who looks respectable over a person who doesn't.

Yes, you've made this point clear a couple of times.

Speaking about the existing groups I mentioned, Perry writes:

>No one can log in to their groups -- we provide an essential service.
>I WANT the New York Times reporter reading this group, but I don't
>want him to think we are crackers or nuts.

Well, while the list is open to all subscribers, it has never been
intended, so far as I know, as a *resource service* for reporters! Perhaps
it *should* be, but that's a much different sort of list than we now have.
(For the Extropians who are reading this, it would be like making the
Extropians list a resource for those trying to learn about the basics of
libertarianism or whatnot, rather than a list for those "already clued
in.")

Several reporters have, at times, subscribed to the list, for brief periods
of time. They were mostly "lurkers." A couple of times I got e-mail, as I
suspect others did, asking me to clarify some point or send more
information. This I did whenever possible.

And with an open list, nothing can be done to censor or stop postings that
make us seem "crackers or nuts," to use Perry's terms. That's just the way
it is. The list is for crypto rebels and people fed up with crypto laws and
regulations, not as an educational arena for outsiders. And not for
sanitized discussions.

People on the list want to talk about digital money, data havens, anonymous
mail services, ways to subvert governments, and so on. They don't want to
just have some unified front that is palatable to reporters. (If I'm wrong
in this judgement, I hope others will give their views as well.)

Your ideas may make sense, Perry, for *some* group. EFF and CPSR operate
roughly in this way, with a paid staff of "reasonable" lawyers and
spokespersons (the newsgroups, like comp.org.eff.talk, are another thing
altogether...as wild and crazy as our list can be). But Cypherpunks does
not seem to fit the bill.

(Personally, I hope EFF takes a leading role in the fight. They have
recently been sidetracked into stuff about ISDN and away from core issues
like privacy in the electronic frontier. They have the resources, lawyers,
speakers, etc.)

As always, I appreciated Perry's comments. Some are reasonable, some I
disagree with strongly. Two hundred other Cypherpunks will probably have
their own views.

Enough for now.

-Tim May
--
Timothy C. May         | Crypto Anarchy: encryption, digital money,
<EMAIL_ADDRESS>     | anonymous networks, digital pseudonyms, zero
408-688-5409           | knowledge, reputations, information markets,
W.A.S.T.E.: Aptos, CA  | black markets, smashing of governments.
Higher Power: 2^756839 | Public Key: MailSafe and PGP available.
Waco Massacre + Big Brother Wiretap Chip = A Nazi Regime

{% endraw %}
```

## Thread

+ Return to [April 1993](/archive/1993/04)

+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_netcom_com_timothy_c_may_)"

+ 1993-04-22 (Wed, 21 Apr 93 22:26:12 PDT) - Re: Should we become "suits"? -<EMAIL_ADDRESS>(Timothy C. May)_


text:
---
layout: default
---

# 1998-02-08 - What's the latest in factoring?

## Header Data

From: Alan Tu<EMAIL_ADDRESS>To: Cypher Punks Mailing List<EMAIL_ADDRESS>Message Hash: 7c760a0ee9282081f07fdd401da7529e947b54ecc969ca3ccc588d72357a586d

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1998-02-08 03:39:31 UTC

Raw Date: Sun, 8 Feb 1998 11:39:31 +0800

## Raw message

```
{% raw  %}From: Alan Tu<EMAIL_ADDRESS>Date: Sun, 8 Feb 1998 11:39:31 +0800
To: Cypher Punks Mailing List<EMAIL_ADDRESS>Subject: What's the latest in factoring?
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

-----BEGIN PGP SIGNED MESSAGE-----

Hi all,

First, I want to say that because I've heard that traffic on this list is
heavy, and I don't have time to file away 40 messages a day, you must
write to me personally in order for me to see the message.  My PGP key is
provided at the end of this message.

What is the latest factoring breakthrough (at least in the civilian
world?)  I had heard a while back that the most recent event was
accomplished by Samuel Wagstaff of Purdue University, whose team factored
(3^349-1)/2, which is a 167-digit number (about 552 bits).  Is there
anything more recent?  Also, whereas 1024 bits was the commonly accepted
threshhold for key lengths more than two years ago, what's the threshhold
now?  Because I have DOS (and like it) I use PGP 2.63ix, when should I
retire my 1024-bit key?  I don't expect anybody to answer that I should
do so immediately, but can someone give me an idea on what people are
doing in regard to key length?

Sincerely,

Alan Tu

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: Requires PGP version 2.6 or later.

iQCVAwUBNN0kkJezmBrl2RXhAQGxnAP9HyIvtTcOeN77s3p80OmSefhagtfxQGEm
H3NqWzxrqEvfODat63UFDVxcf28cSSog3666Icys1nLY9JhNSFZrruejbRIJ6P4o
AKHfxBwUSO00GvSyCl9nI5VjJDoRG2elDZf7iPP1M9h+IoTXuSDpdWnL9uBpqhvi
SFg4sXOKEOA=
=co6G
-----END PGP SIGNATURE-----

Type Bits/KeyID    Date       User ID
pub  1024/E5D915E1 1997/04/27 Alan Tu<EMAIL_ADDRESS>                              Alan Tu<EMAIL_ADDRESS>
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.3i
Comment: Requires PGP version 2.6 or later.

mQCNAzNivkwAAAEEALdGUXD3j+RioIirVG46N6LaGD3YMMVVT5Mjwr5JojQsDICy
856I06Ugo/Fqid2A/os7v/gwE+Sj/WhMERgTsTejUZtsucTpS9sae+cc27Fjjq1l
hOnqcLZqnHDDNyn3+jesVFPLnRlSoHbmcBK1XDW/SJT1anZz55ezmBrl2RXhAAUR
tCBBbGFuIFR1IDxhdHU1NzEzQGNvbXB1c2VydmUuY29tPokAlQIFEDOguk6Xs5ga
5dkV4QEBBF8D/1B0ePqlMavWEUMP0uTmyvWFI7jooAcih6uHZFo2u+u3EzE2Is8X
EoLHg39DhjleTHPu6TnGsWIiwDYEslzYeVw/Cglx6eliYIr/qs7peEywuhtZsEFH
ln6yR9IE6rX3b3GCvPSQ5uPhXWrd2kWaZvG4rQ4Oj1m3yTrFaPRqCBPvtCRBbGFu
IFR1IDwxMDI1MzQuMjE2NUBjb21wdXNlcnZlLmNvbT6JAJUDBRAzyUJWl7OYGuXZ
FeEBAc4TBACT8gLtyE0C8NBGs9aDa9kHfeNzN8VbNfUpoOiWi4duAAZFiAt/e+ji
J2BUMLIY8kzm2WX4mVzpKYjvea5TtHeQgbESV1HVZ5k7abENMUYz5nSMloOE+bb+
XRzgGgFF3htGXDJNywlLNgoYi5vTMT0pbGlCzOu215Cc4mFls2w1iA==
=CM85
-----END PGP PUBLIC KEY BLOCK-----

{% endraw %}
```

## Thread

+ Return to [February 1998](/archive/1998/02)

+ Return to "[Alan Tu <ATU5713@compuserve.com>](/authors/alan_tu_atu5713_at_compuserve_com_)"
+ Return to "[Bill Stewart <bill.stewart@pobox.com>](/authors/bill_stewart_bill_stewart_at_pobox_com_)"
+ Return to "[Ken Williams <jkwilli2@unity.ncsu.edu>](/authors/ken_williams_jkwilli2_at_unity_ncsu_edu_)"

+ 1998-02-08 (Sun, 8 Feb 1998 11:39:31 +0800) - What's the latest in factoring? - _Alan Tu<EMAIL_ADDRESS>  + 1998-02-09 (Mon, 9 Feb 1998 16:31:07 +0800) - [Re: What's the latest in factoring?](/archive/1998/02/769abd1fdc77ad4f5b8c00a130078e6c6487fda36a8ac3c6605ad3632558d19c) - _Ken Williams<EMAIL_ADDRESS>  + 1998-02-10 (Tue, 10 Feb 1998 08:49:07 +0800) - [Re: What's the latest in factoring?](/archive/1998/02/e3914dc2ef5f5d9c591d1c1e340174dd2626e16dbb5daca397418986a4655089) - _Bill Stewart<EMAIL_ADDRESS>


text:
By default it'll be setup to respond with 4 repeated attempts to
"reset" the connection. This leads to an amplifcation factor of 4x packets.


text:
# Self-Driving Car Project 8. Kidnapped Vehicle

## Overview
This repository contains all the code needed to complete the project for the Localization course in the Self-Driving Car Project 8 Kidnapped Vehicle.

### Project Introduction
Our robot has been kidnapped and transported to a new location! Luckily it has a map of this location, a (noisy) GPS estimate of its initial location, and lots of (noisy) sensor and control data.

In this project we will implement a 2 dimensional particle filter in C++. Our particle filter will be given a map and some initial localization information (analogous to what a GPS would provide). At each time step our filter will also get observation and control data.

## Running the Code
This project involves the Kidnapped Vehicle Simulator which can be downloaded [here](https://github.com/udacity/self-driving-car-sim/releases)

This repository includes two files that can be used to set up and install uWebSocketIO for either Linux or Mac systems. For windows we can use either Docker, VMware, or even Windows 10 Bash on Ubuntu to install uWebSocketIO.

Once the install for uWebSocketIO is complete, the main program can be built and ran by doing the following from the project top directory.

1. `mkdir build`
2. `cd build`
3. `cmake ..`
4. `make`
5. `./particle_filter`

Alternatively some scripts have been included to streamline this process, these can be leveraged by executing the following in the top directory of the project:

1. `./clean.sh`
2. `./build.sh`
3. `./run.sh`

Tips for setting up our environment can be found [here](https://classroom.udacity.com/nanodegrees/nd013/parts/40f38239-66b6-46ec-ae68-03afd8a601c8/modules/0949fca6-b379-42af-a919-ee50aa304e6a/lessons/f758c44c-5e40-4e01-93b5-1a82aa4e044f/concepts/23d376c7-0195-4276-bdf0-e02f1f3c665d)

Note that the programs that need to be written to accomplish the project are `src/particle_filter.cpp`, and `particle_filter.h`.

Here is the main protocol that `main.cpp` uses for uWebSocketIO in communicating with the simulator.

**INPUT**: Values provided by the simulator to the c++ program
```
// Sense noisy position data from the simulator
["sense_x"]
["sense_y"]
["sense_theta"]

// Get the previous velocity and yaw rate to predict the particle's transitioned state
["previous_velocity"]
["previous_yawrate"]

// Receive noisy observation data from the simulator, in a respective list of x/y values
["sense_observations_x"]
["sense_observations_y"]
```

**OUTPUT**: Values provided by the c++ program to the simulator
```
// Best particle values used for calculating the error evaluation
["best_particle_x"]
["best_particle_y"]
["best_particle_theta"]

// Optional message data used for debugging particle's sensing and associations
// For respective (x,y) sensed positions ID label
["best_particle_associations"]

// For respective (x,y) sensed positions
["best_particle_sense_x"] <= list of sensed x positions
["best_particle_sense_y"] <= list of sensed y positions
```

Our job is to build out the methods in `particle_filter.cpp` until the simulator output says:

```
Success! Your particle filter passed!
```

## Particle Filter Impementation
The directory structure of this repository is as follows:

```
root
|   build.sh
|   clean.sh
|   CMakeLists.txt
|   README.md
|   run.sh
|
|___data
|   |
|   |   map_data.txt
|
|
|___src
    |   helper_functions.h
    |   main.cpp
    |   map.h
    |   particle_filter.cpp
    |   particle_filter.h
```

The only file we should modify is `particle_filter.cpp` in the `src` directory. The file contains the scaffolding of a `ParticleFilter` class and some associated methods. We can read through the code, the comments, and the header file `particle_filter.h` to get a sense for what this code is expected to do.

If interested, we can take a look at `src/main.cpp` as well. This file contains the code that will actually be running our particle filter and calling the associated methods.

### Inputs to the Particle Filter
You can find the inputs to the particle filter in the `data` directory.

### The Map
The `map_data.txt` includes the position of landmarks (in meters) on an arbitrary Cartesian coordinate system. Each row has three columns
1. x position
2. y position
3. landmark ID

All other data the simulator provides, such as observations and controls.

> * Map data provided by 3D Mapping Solutions GmbH.

## Success Criteria
If our particle filter passes the current grading code in the simulator (we can make sure we have the current version at any time by doing a `git pull`), then we should pass!

The things the grading code is looking for are:
1. **Accuracy**: Our particle filter should localize vehicle position and yaw to within the values specified in the parameters `max_translation_error` and `max_yaw_error` in `src/main.cpp`.
2. **Performance**: Our particle filter should complete execution within the time of 100 seconds.

## Run the Particle Filter

Run the `./run.sh`, and here is the output:
```
Listening to port 4567
Connected!!!
```

Which means the our Particle Filter program has connected to the simulator successfully.

### The Start View of the Simulator

![Start View of the Simulator](README-images/start.png)

### Test Data and Accuracy

The simulator provides the test data and checks the accuracy.

### Test with the Simulator

Here is the final state of the simulator after running the Particle Filter:

![Run Particle Filter](README-images/run-particle-filter.png)

Here is a snapshot on the log of the Particle Filter:

![Particle Filter Log](README-images/run-particle-filter-log.png)

### The Implementation of the Particle Filter

The Particle Filter is implemented in [src/particle_filter.cpp](./src/particle_filter.cpp):
- Initialization: Particle initialization is implemented in [ParticleFilter::init](./src/particle_filter.cpp#L27) from line 27 to line 67.
- Prediction: The prediction step is implemented in [ParticleFilter::prediction](./src/particle_filter.cpp#L69) from line 69 to line 110.
- Updating Weights : This is an important operation in my opinion. It is implemented in [ParticleFilter::updateWeights](./src/particle_filter.cpp#L152) from line 152 to line 248.

The rest of the implementation are is mainly in [src/main.cpp](./src/main.cpp). The event handler declared at [line 56](./src/main.cpp#L56) parses the received message and call the above Particle Filter methods.


text:
# @krustyc/react-timezone

> Timezone Picker for React

## Demo

[Available here.](http://krustyc.github.io/react-timezone/demo/)

## Installation

```bash
$ npm install @krustyc/react-timezone
or
$ yarn add @krustyc/react-timezone
```

## Usage

This a controlled element. `value` and `onChange` needs to be set. Values are timezone codenames.

You can style the container element with `className` and `style` props.

Passing an object as `inputProps` prop will pass it to the underlying input. It can be used for setting `name`, `placeholder` on input or listening to input events.

Minimal styles are included with the build.

Timezones are included in the bundle and can be accessed by importing `timezones` from the package.

A zone object's structure is like this:

```javascript
{
  name: string,
  label: string,
  offset: number,
}
```

## Timezones

Timezones are ~~stolen~~borrowed from Google Calendar.

## Example

```javascript
import TimezonePicker from 'react-timezone';

export default () => (
  <TimezonePicker
    value="Asia/Yerevan"
    onChange={timezone => console.log('New Timezone Selected:', timezone)}
    inputProps={{
      placeholder: 'Select Timezone...',
      name: 'timezone',
    }}
  />
);
```

repository: KrustyC/react-timezone

repo_name: KrustyC/react-timezone


text:
## Check and Set the `metal.no-wipe` Setting on NCNs

Configure the `metal.no-wipe` setting on non-compute nodes \(NCNs\) to preserve data on the nodes before doing an NCN reboot.

Run the `./ncnGetXnames.sh`script to view the `metal.no-wipe` settings for each NCN. The xname and `metal.no-wipe` settings are also dumped out when executing the /opt/cray/platform-utils/ncnHealthChecks.sh script.

### Prerequisites

This procedure requires administrative privileges.

### Procedure

1.  Change to the /opt/cray/platform-utils directory on any master or worker NCN.

    ```bash
    ncn-m001# cd /opt/cray/platform-utils
    ```

2.  Run the `./ncnGetXnames.sh` script.

    The output will include a listing of all of the NCNs, their xnames, and what the `metal.no-wipe` setting is for each.

    ```bash
    ncn-m001# ./ncnGetXnames.sh
    ncn-m001: x3000c0s1b0n0 - metal.no-wipe=1

    ncn-m002: x3000c0s2b0n0 - metal.no-wipe=1

    ncn-m003: x3000c0s3b0n0 - metal.no-wipe=1

    ncn-w001: x3000c0s4b0n0 - metal.no-wipe=1

    ncn-w002: x3000c0s5b0n0 - metal.no-wipe=1

    ncn-w003: x3000c0s6b0n0 - metal.no-wipe=1

    ncn-s001: x3000c0s7b0n0 - metal.no-wipe=1

    ncn-s002: x3000c0s8b0n0 - metal.no-wipe=1

    ncn-s003: x3000c0s9b0n0 - metal.no-wipe=1
    ```

    The `metal.no-wipe` setting must be set to 1 \(metal.no-wipe=1\) if doing a reboot of an NCN to preserve the current data on it. If it is not set to 1 when the NCN is rebooted, it will be completely wiped and will subsequently have to be rebuilt. If the `metal.no-wipe` status for one or more NCNs is not returned, re-run the ncnGetXnames.sh script.

3.  Reset the `metal.no-wipe` settings for any NCN where it is set to 0.

    This step can be skipped if the `metal.no-wipe` is already set to 1 for any NCNs being rebooted.

    1.  Generate a token from any master or worker NCN.

        ```bash
        ncn-m001# export TOKEN=$(curl -k -s -S -d grant_type=client_credentials -d client_id=admin-client \
        -d client_secret=`kubectl get secrets admin-client-auth -o jsonpath='{.data.client-secret}' \
        | base64 -d` https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token \
        | jq -r '.access_token')
        ```

    2.  Update the `metal.no-wipe` settings.

        ```bash
        ncn-m001# /tmp/csi handoff bss-update-param --set metal.no-wipe=1
        ```

    3.  Run the `./ncnGetXnames.sh` script again to verify the no-wipe settings have been reset as expected.

        ```bash
        ncn-m001# ./ncnGetXnames.sh
        ncn-m001: x3000c0s1b0n0 - metal.no-wipe=1

        ncn-m002: x3000c0s2b0n0 - metal.no-wipe=1

        ncn-m003: x3000c0s3b0n0 - metal.no-wipe=1

        ncn-w001: x3000c0s4b0n0 - metal.no-wipe=1

        ncn-w002: x3000c0s5b0n0 - metal.no-wipe=1

        ncn-w003: x3000c0s6b0n0 - metal.no-wipe=1

        ncn-s001: x3000c0s7b0n0 - metal.no-wipe=1

        ncn-s002: x3000c0s8b0n0 - metal.no-wipe=1

        ncn-s003: x3000c0s9b0n0 - metal.no-wipe=1
        ```


text:
### Project Overview

 ## Problem Statement

Dream Housing Finance Inc. specializes in home loans across different market segments - rural, urban and semi-urban. Thier loan eligibility process is based on customer details provided while filling an online application form. To create a targeted marketing campaign for different segments, they have asked for a comprehensive analysis of the data collected so far.

## About the dataset

!!![container width="100%" align="center"]
![Snapshot of dataset](https://storage.googleapis.com/ga-commit-live-prod-live-data/account/b92/11111111-1111-1111-1111-000000000000/b-115/dc396f44-e383-4ac0-99e5-f380ce41a07c/file.PNG)
!!![container-end]

The dataset has details of 614 customers with the following 13 features

-  Feature----------------------------Description
- Loan_ID-----------------------------Unique Loan ID
- Gender------------------------------Male/Female
- Married----------------------------- Applicant Married (Y/N)
- Dependents---------------------- Number of dependents
- Education-------------------------- Graduate/Under Graduate
- Self_Employed-------------------- Self employed (Y/N)
- ApplicantIncome------------------Income of the applicant
- CoapplicantIncome---------------Income of the co-applicant
- LoanAmount------------------------ Loan amount in thousands
- LoanAmountTerm----------------Term of loan in months
- Credit_History---------------------- credit history meets guidelines}
- Property_Area----------------------- Urban/Semi-Urban/Rural
- Loan_Status--------------------------Loan approved (Y/N)

Our major work for this project involves data analysis using Pandas.

### Learnings from the project

 ## Why solve this project ?

After completing this project, you will have better grip on working with pandas. In this project you will apply following concepts.

- Dataframe slicing
- Dataframe aggregation
- Pivot table operations


text:
# Namespace Rolebinding Operator

This repository contains an example of a Kubernetes operator that
listens for changes on namespaces and creates a rolebinding with
cluster edit access within that namespace. This example would be
useful for when using OIDC in a Kubernetes cluster.

For example: You might have a group in your AD with the name:
`ad-kubernetes-kube-system` when the `kube-system` namespace is created,
this operator would create the required RoleBinding so that when a user
with the group `ad-kubernetes-kube-system` logs in via OIDC they'll have
access to edit things in the `kube-system` namespace

## Usage
`--run-outside-cluster # Uses ~/.kube/config rather than in cluster configuration`

## Development

### Build from source
1. `make install_deps`
2. `make build`
3. `./bin/namespace-rolebinding-operator --run-outside-cluster 1`


text:
---
title: "Background services"
description: "Working with one terminal"
layout: post
tags: tests
category: misc
comments: yes
---
My daughter is again doing her trainings so I can spend some time doing my own programming tests. It figures it’s quite easy to use only one terminal to run your command line tools like jekyll serve or grunt watch. You just need to add & at the end of the line and the process will be run in the background. Same can be achieved via interrupting the process with Ctrl+Z and running it again in the background via command ‘bg’. To access background process there’s command ‘fg’.

Nice findings to improve my work ethics.


text:
---
layout: post
title: Quantum of Solace
date: 18-11-2020
tags: [advice, productivity]
---

My *evil* habits are getting out of hand. I can’t let them manifest, take over my productivity. I need to go away to find myself, my quantum of solace.

#### 1. Too smart?

In 2020, smartphones truly take the cake of being the reason for disrupting good habits, rituals.

They crash your productivity, drip feed you social media for your dopamine urge. Addiction sets in and after this everything is irrelevant.

Information at fingertips is a Pandora’s box. A gorgeous disaster.

I needed the off switch. I went ahead and bought a Nokia 105. A basic, no frills, phone.

This is it.

#### 2. No Surf

Surfing on the web can be endless — it is mostly endless. Web is made in a way that you’ll keep surfing it and today with near endless data ( images, videos, text ) you can browse it forever.

I will need to converge. Focus. Mindless browsing doesn't get your far. \\
You don't win.

You win if you NoSurf.

There's no "real" solution to this except discipline. I **need** to make sure I don't click links after links.

I **need** to understand not to get seduced by the web in 2020.

#### 3. Optimize

Often we tend to swing around, proscrastinate and beat around the bush. We somehow get stuff done but it's not accurate or to the point.

Sometimes it's extra. Sometimes not adequate.

I need to pinpoint my work. _There's no extra marks in life._

I'll cut the redundacy, lower the fancy and rather strive to achieve a right balance without compromising ethics.

#### 4. Health

I guess it goes without saying that your life means nothing without good health. Success, happiness, work, achievements everything are tied to your health.

 Physical and mental both are key to a good, healthy life.

For me it's sleep.  There's just so much to learn, read and enjoy in the world! My sleep schedule is abysmal. I'm ashamed to write it down so I'll just nod at myself and hope I change it for the future.

I know, you know and everyone knows innately how to keep themselves healthy. You just have to do it.

#### 5. Future

I think this is a good post for myself. I'll be back to share the results after ~6-8 months.

---

#### Meanwhile...

_COVID is still raging but I feel it's going to be alright. Vaccines are rapidly being worked on and most are aware, scared and are taking precautions. I truly wish we get back to normalcy in an instant but that's just fiction._

_Regarding technology, I'm exicted for the Apple M1 chips. They really have sparked a new interest in me -- Computer Architecture. As we transit rapidly into the unknown future, I feel like Architecture will have a monumental role in the next few decades._

_I have big hopes on Agrotech, Architecture, AI and Quantum computing, Space & Sustainable tech, Genetics, Immunotherapies and Energy/Climate advancements_

_I have ~almost lost the interest to play, discuss about video games even though a new generation has just started. Everything feels the same to me. Pixels after pixels. Consume without any reward. Video games have near to zero RoI and also are a pretty expensive hobby._

_Detrimental to health and they often tend to induce rage, anxiety. Video game addiction is real and with publishers pushing lootboxes, MTX to extreme -- video games are borderline gambling._

_I still respect and admire video games -- they are breathtaking and creative pieces of software engineering. They are very helpful to people in times of despair, crisis and are just a nice, confortable, warm way to forget your troubles and for today, just enjoy._

_I am inching towards picking newer, better hobbies. I'm not ready to share about these today but maybe I'll concrete one or two soon and perhaps achieve something worthwhile to share._

---

Stay safe, take care and a very happy Diwali!

Ankit.

repository: sudoankit/at

repo_name: sudoankit/at


text:
---
title: "Dependencies"
description: ""
weight: 1
---

## CLI and stack

The web interface Console is not yet available. So in this tutorial, we use the command-line interface (CLI) to manage the setup.

You can use the CLI on your local machine or on the server.

>Note: if you need help with any CLI command, use the `--help` flag to get a list of subcommands, flags and their description and aliases.

### Package managers (recommended)

#### macOS

```bash
$ brew install TheThingsNetwork/lorawan-stack/ttn-lw-stack
```

#### Linux

```bash
$ sudo snap install ttn-lw-stack
$ sudo snap alias ttn-lw-stack.ttn-lw-cli ttn-lw-cli
```

### Binaries

If your operating system or package manager is not mentioned, please [download binaries](https://github.com/TheThingsNetwork/lorawan-stack/releases) for your operating system and processor architecture.

## Certificates

By default, The Things Stack requires a `cert.pem` and `key.pem`, in order to to serve content over TLS.

Typically you'll get these from a trusted Certificate Authority. Use the "full chain" for `cert.pem` and the "private key" for `key.pem`. The Things Stack also has support for automated certificate management (ACME). This allows you to easily get trusted TLS certificates for your server from [Let's Encrypt](https://letsencrypt.org/getting-started/). If you want this, you'll need to create an `acme` directory that The Things Stack can write in:

```bash
$ mkdir ./acme
$ chown 886:886 ./acme
```

> If you don't do this, you'll get an error saying something like `open /var/lib/acme/acme_account+key<...>: permission denied`.

For local (development) deployments, you can generate self-signed certificates. If you have your [Go environment](../DEVELOPMENT.md#development-environment) set up, you can run the following command to generate a key and certificate for `localhost`:

```bash
$ go run $(go env GOROOT)/src/crypto/tls/generate_cert.go -ca -host localhost
```

In order for the user in our Docker container to read these files, you have to change the ownership of the certificate and key:

```bash
$ chown 886:886 ./cert.pem ./key.pem
```

> If you don't do this, you'll get an error saying something like `/run/secrets/key.pem: permission denied`.

Keep in mind that self-signed certificates are not trusted by browsers and operating systems, resulting in warnings and errors such as `certificate signed by unknown authority` or `ERR_CERT_AUTHORITY_INVALID`. In most browsers you can add an exception for your self-signed certificate. You can configure the CLI to trust the certificate as well.


text:
# 3YP Overall Energy System Model

## Non-Distpatchable Energy Assets In Kennington

### Sandford Hydro - hydroAsset
Peak power output = 450 kWp

Annual maintenance = £100,000

Number of installations = 1

### Domestic Solar PV Panels - pvAsset
Peak power output = 4 kWp

Annual maintenance = £100

Installation cost = £6,000

Number of installations = 2.8% of households (2020), 100% of households (2050)

### Solar PV Farm - sfAsset
Peak power output = 20 MW

Annual maintenance = ???

Installation cost = ???

Number of panels = 45,000

### Domestic Electricity Demand - loadAsset
Number of households = 1985 (2020), 2574 (2050)

### Non-Domestic Electricity Demand - ndAsset
Number of businesses = 32 (2020), 41 (2050)

### Schools Electricity Demand - ndAsset
Number of schooks = 2 (2020), 3 (2050)

### Electric Vehicle Electricity Demand - evAsset
Number of cars = 1 (2020), 3599 (2050)

### Central Water-Source Heat Pump System - hpAsset
Peak power input = ???

Annual maintenance = ???

Installation cost = ???

### Shoebox Heat Pump Systems - hpAsset
Number of installations = number of households

### Shoebox Heat Pump Systems - hpAsset
Number of installations = number of businesses

## Dispatchable Energy Assets In Kennington

### Domestic Battery Storage - PracticalBatteryAsset1
Battery data: Nissan Leaf EV

Power capacity = 50 kW (rapid charge)

Maximum storage capacity = 32 kWh (80% of original)

Efficiency = 80%

Annual maintenance = ???

Installation cost = ???

Number of installations = number of households with PV

### Community Battery - PracticalBatteryAsset2
Battery data: Tesla Powerpack 2

Power capacity = 500 kW

Maximum storage capacity = 4.2 MWh

Efficiency = 100%

Annual maintenance = ???

Installation cost = ???

### V2G - PracticalBatteryAsset3
Battery data: Nissan Leaf EV

Power capacity = 50 kW (rapid charge)

Maximum storage capacity = 40 kWh

Efficiency = 100%

Annual maintenance = ???

Installation cost = £27,000 (Nissan Leaf EV)

Number of installations = number of households with EV

## Datasets

### Sandford Hydro
Sandford_hydro_generation_30_min_date.csv : 2020 generation from

gen_2050_export_df_v1.csv : 2050 generation predicted from linear regression model

### Solar
oxon_solar_2014.csv : 2014 generation in kW/kWp

### Heat Pump
centralheatpump.csv : central heat pump load

domestic_demand.csv : domestic heat pump load per house

nondomestic_demand.csv : non-domestic heat pump load per user

passivhaus_demand.csv : future heating demand of future new builds

### Loads
EV_Demand_day_1.csv : EV load per vehicle during daytime

EV_demand_night_1.csv : EV load per vehicle during nighttime

ken_dom_annual_demand_per_household_3.csv : 2020 domestic load per house

ideal_domestic_demand_per_household_v1.csv : 2050 domestic load per house predicted from

ken_non_dom_annual_demand_per_user_3.csv : non_domestic load per user

school_demand_profile.csv : load per school

### Storage
Nissan Leaf : EV Batteries

Tesla Powerpack 2 : Community Battery

Nissan Leaf at 80% efficiency and capacity : Domestic Storage Batteries

### Outgoing Tariff
octopus_outgoing_2018_SE.csv : 2018 data for Octopus Outgoing tariff (pence/kWh) for the South East of UK. Data obtained from Octopus Outgoing

### Carbon Intensity
Carbon_Intensity_Data_*Month*.csv : 2020 data for the carbon intensity of emissions for the whole UK. Data obtained from Carbon Intensity API


text:
# Lunch Buddy
A Slack bot, that posts chat messages containing the daily menus of specific restaurants every day.

## Requirements
This application uses [slack-ruby-client](https://github.com/slack-ruby/slack-ruby-client) to integrate the slack bot. Follow their instructions on how to set it up.

You need to set the environment variable `SLACK_API_TOKEN`.

## Installation
This application uses [whenever](https://github.com/javan/whenever) for the cron job setup. To set up the cron jobs run:

`whenever --update-crontab`

Make sure that cron has access to the required environment variable `SLACK_API_TOKEN`.

## Contributing
If you want to add a new restaurant you only need to:

1. Create the model:

`app/models/restaurant/new_restaurant.rb`

2. Let it inherit from `BaseRestaurant`
```ruby
module Restaurant
  class NewRestaurant < BaseRestaurant
    def get_contents(date); end
  end
end
```

3. Implement the `get_contents(date)` method. It should return an array of strings containing the menus of the day.
```ruby
def get_contents(date)
  date.friday? ? ['Fisch'] : ['Schnitzel', 'Moules et frites']
end
```

See `app/models/restaurant/lilly_jo.rb` for a working example.

In general any contribution is appreciated. To do so just:

1. Fork the repository
2. Create a branch (`git checkout -b new-branch`)
3. Commit your changes (`git commit -am 'Add great new thing'`)
4. Push to the branch (`git push origin new-branch`)
5. Create new Pull Request

gha_language: Ruby


text:
---
title: From HTML to HTML (via HTML)
---

Knowing the internals of the HTML family of web standards is quite
important when you are using software such as Thymeleaf. At least if you
want to understand what you are doing.

The problem is that many people know the technologies they are using for
creating webs, but don't really know where these technologies come from.
It has been a long way since the inception of the first web interfaces,
and since then every new technology has been changing the way we
developed for the web by deprecating a good amount of our work and,
especially, our knowledge.

And now, with the arrival of HTML5, things have become even more
complicated. *What's it?* *Why is it HTML instead of XHTML?* *Wasn't the
HTML tag soup considered harmful?*

So let's take a step back, and see how we arrived where we are now, and
why.

Back in the 90s, there was HTML...
----------------------------------

...and HTML was a standard (or more correctly, a *recommendation*)
maintained by the *World Wide Web Consortium* (a.k.a. W3C). Extending
from a language called SGML, HTML defined a tag-based markup language
for writing rich hyper-text documents, highly coupled to the protocol
that was used for serving them and their related resources across the
network: the *Hyper-Text Transfer Protocol* (HTTP).

HTTP used text *headers* for defining what was being served to clients
and how, one of which was extremely important: the `Content-Type`
header. This header explained to browsers what type of content was being
served to them in a language called *MIME (Multipurpose Internet Mail
Extensions)*. And the MIME type used for serving HTML documents was
`text/html`:

```html
    Content-Type: text/html
```

HTML also defined a way to check whether a document was *valid*. Being
valid basically meant that the document was written according to the
HTML rules that dictated what attributes a tag could have, where a tag
could appear in the document, etc.

These validity rules were specified using a language for defining the
structure of SGML documents called *Document Type Definition* or DTD. A
Standard DTD was created for each version of HTML, and HTML documents
had to declare the DTD (and therefore the version of HTML) they
conformed to by means of a clause that should appear as their first
line, the *Document Type Declaration* or `DOCTYPE` clause:

```html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
```

The Document Object Model and the tag soup
------------------------------------------

HTML was meant for displaying documents in browsers, and back in the
late 90s browsers were made by fiercely competing companies that wanted
to offer the maximum amount of cool features to their users. Given that
HTML only defined rules for document formatting, many other features
were left to the browser developers' imagination.

And one of the most interesting ideas that appeared in browsers was
*client-side interactivity*. This interactivity was achieved by
executing *scripts* -- in languages such as JavaScript -- inside the
browser itself, and giving these scripts the ability to handle, modify
and even execute events on parts of the document being displayed. For
this, browsers had to model HTML documents as in-memory trees of
objects, each of them with state and events, and thus the *Document
Object Model* (DOM) was born.

The problem was that HTML rules for well-formedness were quite loose
whereas DOM trees were strictly hierarchical structures, and this meant
that different interpretations of HTML tag positions and sequences could
lead to different DOM object trees in different browsers. Add to this
the fact that these different browsers modelled the API of DOM nodes in
different ways (different names, events, etc) and you will start to get
the idea of how difficult it was to create cross-browser interactivity
back then.

What's more: while all this was happening, browsers had been growing
quite forgiving with HTML authors, allowing them to write HTML documents
that were not well formed (*tag soups*) by automagically correcting
their errors. This lead HTML authors to create even worse formed
documents, and then browsers to allow even more errors in format, adding
to a quite destructive cycle. And guess what: each browser was
correcting all these errors in a different way. Hooray.

The W3C finally standardized the DOM API and a language for scripting in
web browsers: JavaScript (although for some complex reasons they
insisted on calling it ECMAScript). But the damage done by the world of
tag soups coupled with the slow adoption of these standards in full by
browser makers -- in many cases fearing they would damage backwards
compatibility -- produced effects that are still influencing the way we
create web applications today.

Enter XML
---------

Some time after HTML became a widely spread language, the W3C developed
a new specification called XML (*eXtensible Markup Language*), aimed at
the representation of general-purpose data (not only web) in the form of
hierarchical markup text.

XML was extensible in that it allowed the definition of purpose-specific
languages (tags and their attributes) to fit the needs of specific
scenarios. But HTML documents were not well formed from the XML
perspective, XML and HTML remained in fact incompatible languages. It
was not possible to express HTML as an XML *application*.

Being strictly hierarchical and removing the structural ambiguities of
HTML, XML documents were more directly translatable to standardized DOM
trees (a process known as *XML Parsing*). Also given the fact that XML
was a text-based language, and that text is a sort of
technology-agnostic format (as opposed to binary), XML became especially
suited for the cross-platform interchange of data across the internet.
In fact, it led to the birth of the now-ubiquitous *Web Services*
technologies.

HTML + XML = XHTML
------------------

At some point, driven by the obvious usefulness of XML and the fact that
it could make web documents more extensible and interoperable (like, for
example, producing more predictable DOMs across browsers), the W3C
decided to reformulate HTML as an XML dialect (or *application*) instead
of an SGML one, and so XHTML was born.

XHTML required web authors to write their documents as well-formed XML,
which introduced some formatting rules that didn't exist in HTML before:
tags should always be closed, attributes should always be escaped and
surrounded by quotes, etc.

The introduction of XHTML and the transformation of web documents into
well formed XML was generally perceived as a step forward, because it
would allow higher levels of standardization across browsers, less space
for authoring errors that had to be corrected in browser-specific ways,
and easier parsing and automated processing of web pages.

As a part of this, XHTML introduced a controversial concept coming
directly from XML and known as *Draconian Error Handling*, which meant
that any interpreter of XML -- including now a browser -- should fail
immediately should any kind of format error be found in the XML document
being processed. In practice, this meant that XHTML authors would have
to create perfectly well-formed documents or accept the fact that
browsers would never be able (in fact, allowed) to display them at all.

For validation, the XHTML 1.0 specification defined a set of DTDs that
could be used in `DOCTYPE` clauses: `XHTML 1.0 Strict`,
`XHTML 1.0 Transitional` and `XHTML 1.0 Frameset`. The first one was
meant for *pure* XHTML documents that didn't use any deprecated tags
coming from HTML, the second one for transitional documents that still
made use of deprecated tags and attributes, and the third one for
frameset pages.

```html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
```

But one of the most important aspects of XHTML was that it also
introduced a new MIME type, which was the one that every web server was
supposed to use for serving XHTML so that browsers knew that they had to
use their XHTML parser and engine instead of their HTML equivalents.
This was `application/xhtml+xml`:

```html
    Content-Type: application/xhtml+xml
```

Crashing down to (XHTML's) reality
----------------------------------

Just after its introduction, everything looked bright for XHTML. We
developers should just have to wait for browsers to fully implement it
and the world of web development would suddenly look much happier...

Trouble is, that never happened.

What happened was that one specific browser simply denied implementing
support for the `application/xhtml+xml` content type. Guess which one.
Yeah, exactly, that one. Internet Explorer.

Versions of IE older than 11 showed a download dialog when you tried to access a
document served with XHTML's own content type, and that of course meant
that you could not use that content type if you wanted to be able to display
your web site to IE users. By the time this was corrected,
it was simply too late.

Fortunately -- or maybe unfortunately -- The XHTML 1.0 specification
included an appendix that stated that XHTML 1.0 content could also be
served using the old `text/html` content type from the HTML times, in
order to ease the transition. And that's exactly what most of us have
been doing the past several years: creating XHTML 1.0 content, and then
serving it as `text/html`. Given that the XHTML 1.0 specification was
published in 2000, the *transition* has taken long.

But the fact is that when you serve content as HTML instead of XHTML
browsers will use their HTML engines for it, and not the XHTML-specific
ones. And although their HTML engines have been XHTML-enabled, they
still have to provide backwards compatibility for old HTML 4 code ---
which makes them very tricky pieces of software -- and importantly, they
lack some of the most XML-ish features of XHTML, starting with...
Draconian Error Handling.

And if you don't have Draconian Error Handling, you have a forgiving
engine that will let you serve documents that are not well formed,
automagically correcting your errors. And if you know the browser will
correct your errors (in a browser-specific way), you will probably never
correct your documents... and so the HTML horror story still goes on.

Knowing this, think that you've probably never really created a truly
XHTML web site. What you've done is (probably ill-formed) XHTML
documents served and displayed as plain old HTML. How about that?

But it went worse, because in 2002 `XHTML 1.1` removed the possibility
of using the HTML content type, therefore allowing only
`application/xhtml+xml`. The problem was that, instead of this forcing
Internet Explorer to support `application/xhtml+xml`, which didn't
happen, this restriction simply turned XHTML 1.1 into as much a
mythological creature as Nessie. Almost no one ever used it.

In 2009, the W3C allowed again the use of `text/html` with XHTML 1.1
but, again, it was too late.

Towards HTML5: A divorce story
------------------------------

At some point (specifically, 2004), some browser makers realised that
the existing XHTML specifications were evolving too slowly to cope with
the increasing demands of the web (video, audio, richer application
interfaces...), and that the W3C was increasingly pushing them towards
creating stricter interpretations of documents that could end up
rendering huge amounts of (ill-formed) existing code useless.

They wanted to enhance web applications with capabilities like video,
audio, local storage, or advanced form processing, and in fact they
could do it by just adding those features in a browser-specific way, but
they didn't want to go the non-interoperable way again. They needed the
standards to evolve and include these new features.

Nevertheless, there was a problem with evolving the existing standards
of the time (namely XHTML): there were still lots and lots of web sites
and applications still relying on legacy HTML out there, and if those
cool new features were standardized by going the XHTML ultra-strict way,
all those applications would never be able to use the new features
unless they were completely rewritten. And everybody wanted a more
interoperable and standard web, but not at the cost of throwing away
many years of work done by millions of web authors.

So these makers (along with other individuals) presented the W3C with
the idea of evolving HTML in a way that made all (or most) existing HTML
and XHTML code still valid as *new HTML* while providing powerful new
features for web applications and -- importantly -- clearly defining the
way in which error handling should be done.

This latter point meant that instead of failing on the first error,
browsers would know *by specification* how to perform the automagical
correction of errors created by web authors and therefore would react to
them in exactly the same way, effectively turning HTML code (be it
XML-formed or not) fully cross-browser. You would still be recommended
to create XML-formed code for new sites, but if you didn't fancy or you
still had some tons of old legacy HTML (and most certainly you had), you
would still be invited to join the party. See that old HTML site there?
Let's add some video to it! It all sounded quite sensible.

But the fact is, all of this didn't sound quite as well to W3C back in
2004, and they rejected the proposal and decided to go strictly the
XHTML way. HTML was dead for them, there was no reason to resurrect it,
and `XHTML 2.0` was the future.

This led to divorce. The proponents of this new concept for HTML, a
group that included individuals from Opera Software, the Mozilla
Foundation and Apple, left the W3C and founded the *Web Hypertext
Application Technology Working Group (WHATWG)* with the aim of defining
what we today know as HTML5.

Finally, in 2007, the W3C created a working group for *next-generation
HTML*, which later accepted to join efforts with WHATWG, effectively
adopting HTML5 as their working specification and future deliverable.
W3C and WHATWG were now united for creating HTML5, and in 2009 the W3C
just let XHTML 2.0 die by closing the group working on its
specification.

HTML5 was now the *only* future of web standards.

So what is HTML5?
-----------------

HTML5 is a set of standards -- still under development as of 2011 ---
evolving from current HTML 4 and XHTML specifications and aimed at:

-   Adding advanced new capabilities to HTML that effectively move web
    development slightly away from the document-oriented philosophy and
    towards a more application-oriented one. Such capabilities are
    called *HTML5 features* and are in some cases defined by standards
    on their own, apart from the HTML5 core one. HTML5 features include,
    among others: video, audio, drawing canvas, geolocation, local
    storage, offline support and advanced form-related capabilities.
-   Providing a pain-free path for migration from HTML and XHTML, which
    enables the adoption of HTML5 with little or no rewriting of code at
    all.
-   Providing a standard way of handling code errors, so that ill-formed
    HTML5 code will perform in the same predictable way in all browsers.

From a practical point of view, this means that (probably all of) your
current HTML and XHTML code will be considered valid HTML5 just by
changing your `DOCTYPE` to the HTML5 one:

```html
<!DOCTYPE html>
```

And by serving your content with content type `text/html`:

```html
    Content-Type: text/html
```

And here you might be thinking: why does that `DOCTYPE` specify no DTD
at all? Because there isn't one. HTML5 has no DTD because the rules that
define whether a document is valid HTML5 or not are defined as
human-readable text in the specification itself, but cannot be expressed
in the DTD language.

But this does not mean that an HTML5 parser and/or engine cannot
validate. It can. It simply has to be a piece of software especially
devoted to HTML5 parsing including specific code programmed for
executing the rules that are involved in validating HTML5 (as opposed to
reading those rules from a DTD file). Even if the specification is now
quite flexible, it still *is* a specification, and you have to conform
to it.

But if there is no DTD, then why have a DOCTYPE clause at all? Because a
DOCTYPE clause is needed in order to make browsers display documents in
*Standards Mode* (as opposed to *Quirks Mode*). The clause
`<!DOCTYPE html>` is the minimum valid DOCTYPE declaration possible, and
that is exactly all we need. It just acts as a switch.

Can I use HTML5 already?
------------------------

Mostly yes. While (as of 2016) there is no browser that fully
implements the whole HTML5 feature set, most of the common ones do
implement a large part of it. So as long as your users are not stuck
with very old versions of (now-defunct) Internet Explorer, you should
be fine in most scenarios.

Also, note that browser support actually evolves with time not only
because of the quick pace at which browsers release new versions, but
also because the specification itself is still work in progress.

For a list of HTML5 features and the corresponding browser support, check the
[Can I use...](http://caniuse.com/) website.  Notably, the HTML5 category list
for all of the features: [http://caniuse.com/#cats=HTML5](http://caniuse.com/#cats=HTML5)

And what about XHTML5? Does that exist?
---------------------------------------

In theory, yes. XHTML5 is just HTML5 served with:

```html
    Content-Type: application/xhtml+xml
```

But note that IE didn't support this until version 11 (Microsoft
Edge does support it). So again, think about your users' browser capabilities

Also, note that the difference between HTML5 and XHTML5 is the
content type and *only* the content type, because an XML-well-formed
HTML5 document is in fact a perfectly valid HTML5 document. This is quite
different to the relation between HTML4 and XHTML 1.0/1.1, which were
incompatible languages.

repository: thymeleaf-docs-ja/thymeleaf-docs

repo_name: thymeleaf-docs-ja/thymeleaf-docs


text:
# Hardcore Injector

![hc_injector](https://user-images.githubusercontent.com/50682704/69193335-8f175800-0b37-11ea-9d45-0175d0976fef.png)

## Build

Packages required for assembly:

* ```Windows Bundle```
* ```DFFI```

repository: YuhBoyMatty/dn-hardcore-injector

repo_name: YuhBoyMatty/dn-hardcore-injector


text:
# University Of Teesside (2007 - 2011)
* BSc. Computer Games Programming (Skillset Accredited)
* First-class honours

### Modules Included:
* Advanced Games Software Development
* Multiplayer Games Development
* Graphical Mathematics
* Group Development
* Artificial Intelligence
* Graphics Programming

## Dissertation
Assessing the suitability of Android as a games development platform


text:
# The @thx packages

[![Greenkeeper badge](https://badges.greenkeeper.io/thr-consulting/thr-addons.svg)](https://greenkeeper.io/)

This is a monorepo for all of the @thx packages.

You can find documentation here: https://thr-consulting.github.io/thr-addons/

You can find the same documentation in markdown here: [/docs](/docs).

repository: thr-consulting/thr-addons

repo_name: thr-consulting/thr-addons


text:
# LJ code 201 Day - 4

“Tell me and I forget Teach me and I remember. Involve me and I learn.”

Pair Programming Basics

Today the topic of discussion and lessons were about Functions. It was a great experience working out the functions with a partner(Pair Programming). I found this very helpful, Bronwyn my partner was able to help me understand some minor errors in my syntax and I was able to make the necessary corrections according to errors in my code(debugging).

We also learned about Function Scope, Function Declarations (Loads into memory - we give it variables), Function Calls or Innocation (causes code to execute).

Css
Margin, Border, Padding, and Content.
Work with this by Sandboxing...

Wireframing
When building things, make a sketch of what I actually want the page to look like, Containers...

...................
....Content........
...................

.......


text:
# Interval-Based Temporal Predicates

**Files:** *timePredicates.go, timePredicates_test.go*

A very simple implementation of some methods for an interval-based temporal logic based on [James F. Allen's work](http://web.mit.edu/larsb/Public/16.412/pset%204/allen94actions.pdf).
This code can be used to implement scheduling/planning algorithms.


text:
---
layout: post
title: Building a prefix trie
date: 2014-04-14 08:00:48.000000000 -07:00
type: post
parent_id: '0'
published: true
password: ''
status: publish
categories:
- Code
tags:
- autocomplete
- haskell
- trie
meta:
  _edit_last: '1'
  _syntaxhighlighter_encoded: '1'
  _su_rich_snippet_type: none
  _wpas_done_all: '1'
  _jetpack_related_posts_cache: a:1:{s:32:"8f6677c9d6b0f903e98ad32ec61f8deb";a:2:{s:7:"expires";i:1558781240;s:7:"payload";a:3:{i:0;a:1:{s:2:"id";i:4011;}i:1;a:1:{s:2:"id";i:3847;}i:2;a:1:{s:2:"id";i:3656;}}}}

permalink: "/2014/04/14/building-prefix-trie/"
---
[Prefix trie](http://en.wikipedia.org/wiki/Trie)'s are cool data structures that let you compress a dictionary of words based on their shared prefix. If you think about it, this makes a lot of sense. Why store `abs`, `abbr`, and `abysmal` when you only need to store `a,b,b,r,s,y,s,m,a,l`. Only storing what you have to (based on prefix) in this example gives you a 70% compression ratio! Not too bad, and it would only get better the more words you added.

The classical way of dealing with prefix tries is to store the suffixes using a map, but for fun I tried something different and used a list.

## Data

The main data structure I had was like this

[haskell]
type Key a = [a]

data Trie key = Node (Maybe key) [Trie key] Bool deriving (Show, Eq, Read)
[/haskell]

So a trie is really just a node that has a list of other tries (which would be its suffixes). You can see an example of the structure with the word "foo":

[haskell]
[Node (Just 'f')
 [Node (Just 'o')
 [Node (Just 'o') [] True]
 False]
 False]
[/haskell]

It's printable to the screen, equatable, and can be serialized from text. It also contains a boolean field representing if it is the end of a word or not. You can see the boolean at the last "o" of the word, indicating the word terminates. All the other characters are non-terminating fields.

## Searching

Let's add a helper method to find a key in a list of tries. Remember that each root can contain a list of other trie's, so it'll be nice to be able to say "_hey, we're at root X which has a list of possible suffix starts Y. Let's find the next root from the list of Y and return it_".

[haskell]
{-
 Finds a key in the trie list that matches the target key
-}
findKey :: (Eq t) =\> t -\> [Trie t] -\> Maybe (Trie t)
findKey key tries = L.find (\(Node next \_ \_) -\> next == Just key) tries
[/haskell]

It takes an equatable value, and a list of Trie's of those values, and finds the key returned as an option type.

We could even now write code to find a Trie

[haskell]
{-
 Takes a key list and finds the trie that fullfils that prefix
-}
findTrie :: (Eq t) =\> Key t -\> [Trie t] -\> Maybe (Trie t)
findTrie [] \_ = Nothing
findTrie (x:[]) tries = findKey x tries
findTrie (x:xs) tries = findKey x tries \>\>= nextTrie
 where nextTrie (Node \_ next \_) = findTrie xs next
[/haskell]

Since `findKey` is an option type, we can leverage the option monadic bind operator `>>=`. This operator will pass a result to the next function only if the result is a `Just` type. This is a way to safely process 'nullable' items.

## Insertion

Now the insertion code, which honestly was the most complicated.

[haskell]
insert :: (Eq t) =\> Key t -\> [Trie t] -\> [Trie t]
insert [] t = t
insert (x:xs) tries =
 case findKey x tries of
 Nothing -\> [(Node (Just x) (insert xs [])) isEndWord]++tries
 Just value -\>
 let (Node key next word) = value
 in [Node key (insert xs next) (toggleWordEnd word)]++(except value)
 where
 except value = (L.filter ((/=) value) tries)
 isEndWord = if xs == [] then True else False
 toggleWordEnd old = if xs == [] then True else old
[/haskell]

The trick to pure functional insertion is that you need to _rebuild_ the entire data structure WHILE you search for where you want to actually add things.

In the first case where you try to find a key but didn't find it, you want to add the key as a neighbor to the other trees. So if you have a root word of "_abd_" but you add "_def_", the root character of "_d_" doesn't exist yet and needs to be added, hence creating a new list and appending it to the original tries list. Then you recursively go through the new element and add the remaining list. This is why the creation of the new element has a recursive call back to the insert function with the remaining list `xs`. Also, since you created the new element as part of a recursive call, you know this element is already being properly appended to its root.

But, if the key already exists then that means you found a suffix that matches. At this point you need to bubble through the inner suffix tree to add the remaining items you want (basically following the suffix trie down to a point where you haven't already found a suffix root). Once thing to remember is that you also need to recreate the key you found, excluding the original element (hence the `except value` since we want to exclude the old version of the key before).

On top of that, if you've already processed a root, but your word now ends at a root, you need to toggle if that suffix is a word completion. For example, if I've already added "_abcdef_" then "_f_" is the end of the word. But now if I add "_abc_" as a word, then both "_c_" AND "_f_" are end words (so "_c_"'s end word boolean needs to be toggled to true).

I found this concept to be a little complicated because its both finding, updating, and rebuilding the data structure all at the same time, but with practice it does get more natural to trace through.

## Getting the words

Once you can build a trie though, we can leverage haskells list comprehensions to fold the words back out

[haskell]
{-
 Gives you all the available words in the trie list
-}
allWords :: [Trie b] -\> [[b]]
allWords tries =
 let raw = rawWords tries
 in map (flatMap id) raw
 where
 flatMap f = Fold.concatMap (Fold.toList . f)
 rawWords tries = [key:next
 | (Node key suffixes isWord) \<- tries
 , next \<-
 if isWord then
 []:(rawWords suffixes)
 else
 rawWords suffixes]
[/haskell]

Since we have a list of roots, we can go through each suffix and append the root character to it. If we encounter a word, we can pop in an empty list to create a delimiter. The list comprehension will do every combination of every root with its suffixes, so we will get each word.

But, this makes a list of characters and so I wanted to flatmap the list to create strings.

 Let's look at how to guess what the available suffixes would be:

[haskell]
{-
 This function takes a key list and returns the
 full words that match the key list. But, since we already
 know about the source key that matches (the input) we can
 prepend that information to any suffix information that is left.
 If the node found that matches the original query is a word in itself
 we can prepend that too since its a special case
-}
guess :: (Eq a) =\> Key a -\> [Trie a] -\> Maybe [Key a]
guess word trie =
 findTrie word trie \>\>= \(Node \_ next isWord) -\>
 return $ (source isWord) ++ (prependOriginal word $ allWords next)
 where
 source isWord = if isWord then [word] else []
 prependOriginal word = map (\elem -\> word ++ elem)
[/haskell]

The idea is we have a string, and our original roots. We then look for the suffixes and when we find the target trie that ends at the word we have, we can find all the words after that and prepend our original word.

## Examples

Lets look at some basic examples of how to use the Trie:

[code]
\*PrefixTree\> tries = build ["word", "wooordz", "happy", "hoppy"]

\*PrefixTree\> guess "h" tries
Just ["hoppy","happy"]

\*PrefixTree\> allWords tries
["hoppy","happy","wooordz","word"]

\*PrefixTree\> tries
[Node (Just 'h') [Node (Just 'o') [Node (Just 'p') [Node (Just 'p') [Node (Just 'y') [] True] False] False] False,Node (Just 'a') [Node (Just 'p') [Node (Just 'p') [Node (Just 'y') [] True] False] False] False] False,Node (Just 'w') [Node (Just 'o') [Node (Just 'o') [Node (Just 'o') [Node (Just 'r') [Node (Just 'd') [Node (Just 'z') [] True] False] False] False] False,Node (Just 'r') [Node (Just 'd') [] True] False] False] False]

\*PrefixTree\> guess "ha" tries
Just ["happy"]

\*PrefixTree\> guess "hi" tries
Nothing
[/code]

## Conclusion

It would be a lot faster to have leveraged a hash map instead of a list for the suffixes, since each time I need to find the suffix root I have to do an O(n) traversal, instead of an O(1), but since this isn't a production trie I'm not worried about it. It was still a fun exercise!

For a full example check my [github](https://github.com/devshorts/Playground/tree/master/haskell_trie).

repository: devshorts/onoffswitch

gha_language: HTML

repo_name: devshorts/onoffswitch