text:
Kore - Kodi/XBMC remote for Android
====================================

GitHub repository for the [Kore][1] Android app.

Kore is a simple and easy to use Kodi remote.

You'll need to create the following files:

1. `gradle.properties`, with the value `IAP_KEY` set to something (this is used for the in-app purchase).
2. `app/keystore.properties` with the values `store`, `alias`, `pass`, `storePass` set. This is for signing the release build. Alternatively, comment the `signingConfigs` in `app/build.gradle`.

Links
-----

- [Website][2]
- [Google Play][1]
- [Google+ community][3]

License
-------

    Copyright 2014 Synced Synapse

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

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

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

[1]: https://play.google.com/store/apps/details?id=com.syncedsynapse.kore2
[2]: http://syncedsynapse.com/kore/
[3]: https://plus.google.com/u/0/communities/110340113064213296333

repository: checko/Kore

repo_name: checko/Kore


text:
# ASP.NET Core 5 and React - Second Edition

This is the code repository for [ASP.NET Core 5 and React - Second Edition](https://www.packtpub.com/in/web-development/asp-net-core-5-and-react-second-edition), published by Packt.

**Full-stack web development using .NET 5, React 17, and TypeScript 4**

## What is this book about?
The book starts by taking you through React and TypeScript components for building an intuitive single-page application and then shows you how to design scalable REST APIs that can integrate with a React-based frontend. Next, you’ll get to grips with the latest features, popular patterns, and tools available in the React ecosystem, including function-based components, React Router, and Redux. As you progress through the chapters, you'll learn how to use React with TypeScript to make the frontend robust and maintainable and cover key ASP.NET 5 features such as API controllers, attribute routing, and model binding to build a sturdy backend. In addition to this, you’ll explore API security with ASP.NET 5 identity and authorization policies and write reliable unit tests using both .NET and React, before deploying your app on Azure.
By the end of this book, you’ll have gained the knowledge you need to enhance your C# and JavaScript skills and build full-stack, production-ready applications with ASP.NET 5 and React.

This book covers the following exciting features:
* Build RESTful APIs with .NET 5 using API controllers
* Secure REST APIs with identity and authorization policies
* Create strongly typed, interactive, and function-based React components using Hooks
* Understand how to style React components using Emotion.js
* Perform client-side state management with Redux
* Run a range of automated tests on the frontend and backend
* Implement continuous integration and continuous delivery (CI/CD) processes in Azure using Azure DevOps

If you feel this book is for you, get your [copy](https://www.amazon.com/dp/180020616X) today!

## Instructions and Navigations
All of the code is organized into folders. For example, Chapter02.

The code will look like the following:
```
if (test expression)
{
  Statement upon condition is true
}
```

**Following is what you need for this book:**
If you're a web developer looking to get up to speed with full-stack web application development with .NET Core and React, this book is for you. Although the book does not assume any knowledge of React, a basic understanding of .NET Core will help you to get to grips with the concepts covered.

With the following software and hardware list you can run all code files present in the book (Chapter 1-15).

### Software and Hardware List

| Chapter  | Software required                   | OS required                        |
| -------- | ------------------------------------| -----------------------------------|
| 1 to 15      | Visual Studio 2019                  | Windows, Mac OS X, and Linux (Any) |
| 1 to 15       | .NET Core 5           | Windows, Mac OS X, and Linux (Any) |
| 1 to 15      | Visual Studio Code           | Windows, Mac OS X, and Linux (Any) |
| 1 to 15      | Node.js 8.2 or greater and npm 5.2 or greater           | Windows, Mac OS X, and Linux (Any) |
| 1 to 15    | SQL Server Express Edition          | Windows, Mac OS X, and Linux (Any) |
| 1 to 15     | SQL Server Management Studio           | Windows, Mac OS X, and Linux (Any) |
| 1 to 15     | Google Chrome           | Windows, Mac OS X, and Linux (Any) |

## Code in Action

Click on the following link to see the Code in Action:

[YouTube](http://bit.ly/3mB8KuU)

### Errata
* **Page 67**: Please ignore/remove points 6 & 7. As these steps are replicated from steps 2 and 3. At this point they have been completed already.
* **Page 70**: When creating the .prettierrc file in step 4, there is a missing comma at the end of the line that reads, ```"trailingComma": "all"**```. So, this line should be replaced with  ```"trailingComma": "all",```
*  **Page 114**: If using React 17+, it may appear that a “double render” doesn’t occur because “rendered” is output to the console once. A “double render” does occur but React suppresses `console.log` statements in the second render. See the note at the bottom of this React doc for more information: https://reactjs.org/docs/strict-mode.html

### Related products <Other books you may enjoy>
* An Atypical ASP.NET Core 5 Design Patterns Guide [[Packt]](https://www.packtpub.com/web-development/asp-net-core-5-design-patterns) [[Amazon]](https://www.amazon.com/dp/1789346096)

* C# 9 and .NET 5 – Modern Cross-Platform Development - Fifth Edition [[Packt]](https://www.packtpub.com/product/c-9-and-net-5-modern-cross-platform-development-fifth-edition/9781800568105) [[Amazon]](https://www.amazon.com/dp/180056810X)

## Get to Know the Author
**Carl Rippon**
has been involved in the software industry for over 20 years, developing a complex line of business applications across various sectors. He has spent the last 9 years building single-page applications using a wide range of JavaScript technologies, including Angular, ReactJS, and TypeScript. Carl has written over 150 blog posts on various technologies.

## Other books by the authors
* [ASP.NET Core 3 and React](https://www.packtpub.com/product/asp-net-core-3-and-react/9781789950229)

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
Those tips don't work for npm 3+ because it uses symlink.

When using the generator-jhipster, the command `npm install` may take several minutes, depending on your connection speed.

This tip can be used in many cases:

- for demo of JHipster, to improve your experience
- for dev team, to regenerate faster a project with `.yo-rc.json`
- for continuous integration

## Create a new project for node_modules

Create a directory which will contain all `node_modules` libraries, and go into it:

```
mkdir jhipster-speedup
cd jhipster-speedup
```

Create the directory `node_modules`:

```
mkdir -p node_modules
```

The project structure is :

    jhipster-speedup
    ├── node_modules

**Warning!**  It will link to your fork project of generator-jhipster:

```
npm link generator-jhipster
```

## Generating projects

Create a directory which will contain your new JHipster project, and go into it:

```
mkdir jhipster
cd jhipster
```

Create a link to the directory `node_modules`:

```
ln -s <your path>/jhipster-speedup/node_modules
```

Generate a new project, and answer to all questions:

```
jhipster
```

The first time, it will take several minutes.

The next times, it will use the existing `node_modules` directory, so npm won't download all libraries.

**Warning!** If you use specific libraries and modify your package.json, you should copy the `node_modules`
from jhipster-speedup to your folder project, instead of using a link.

branch_name: refs/heads/main

gha_language: JavaScript

gha_license_id: NOASSERTION


text:
---
layout: default
---

# 1995-09-11 - Media coverage of NIST Export meetings?

## Header Data

From: "Pat Farrell"<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: d664951600bb78d89cacded47dedf7351155c44c94b840690f24c7b70cc9f00b

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1995-09-11 12:57:18 UTC

Raw Date: Mon, 11 Sep 95 05:57:18 PDT

## Raw message

```
{% raw  %}From: "Pat Farrell"<EMAIL_ADDRESS>Date: Mon, 11 Sep 95 05:57:18 PDT
To<EMAIL_ADDRESS>Subject: Media coverage of NIST Export meetings?
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Has anyone seen any media coverage of last week's meetings?
I haven't seen anything in either the Washington Post or
the Wall Street Journal. Nothing on radio or local TV either.

I don't expect much coverage, as Joe Sixpack has no knowledge of
why he should be interested. But I expected at least a paragraph
hidden somewhere inside.  Perhaps I missed it.

Anyone else seen any???

Pat

Pat Farrell    Grad Student      http://www.isse.gmu.edu/students/pfarrell
Info. Systems & Software Engineering, George Mason University, Fairfax, VA
PGP key available on homepage               #include <standard.disclaimer>

{% endraw %}
```

## Thread

+ Return to [September 1995](/archive/1995/09)

+ Return to "[Christian Wettergren <cwe@Csli.Stanford.EDU>](/authors/christian_wettergren_cwe_at_csli_stanford_edu_)"
+ Return to "["Pat Farrell" <pfarrell@netcom.com>](/authors/pat_farrell_pfarrell_at_netcom_com_)"

+ 1995-09-11 (Mon, 11 Sep 95 05:57:18 PDT) - Media coverage of NIST Export meetings? - _"Pat Farrell"<EMAIL_ADDRESS>  + 1995-09-12 (Mon, 11 Sep 95 18:07:21 PDT) - [Re: Media coverage of NIST Export meetings?](/archive/1995/09/00be8d55a345adf83db23cae3a1f30d75bc9ba6a64a1c20ae0df2f2bf465f3d6) - _Christian Wettergren<EMAIL_ADDRESS>

gha_license_id: MIT


text:
# A Tour of Go Exercise

[A Tour of Go](http://go-tour-jp.appspot.com/#1)

## Setup

```bash
$ got get https://code.google.com/p/go-tour
```

repository: koshigoe/a-tour-of-go-exercise

gha_language: Go

repo_name: koshigoe/a-tour-of-go-exercise


text:
## Material Theme for BetterFindBuffer

A simple [Material](https://material.google.com/) theme for the awesome [BetterFindBuffer](https://packagecontrol.io/packages/BetterFindBuffer) — based on the fantastic work of Mattia Astorino in his Sublime Text 3 [Material Theme](https://github.com/equinusocio/material-theme).

If you don't use that theme, make sure you do. It's awesome.

![How it looks](http://i.imgur.com/AHO2o7m.png)

### Installation

Make sure the [BetterFindBuffer](https://packagecontrol.io/packages/BetterFindBuffer) plugin is already installed.

1. Download both `FindResults.hidden-tmTheme` and `Find Results.sublime-settings` — and make any necessary changes, like font size!
2. Copy them into your User folder (usually located in `~/Library/Application Support/Sublime Text 3/Packages/User/` in OS X)
3. ???
4. Profit

Restart your Sublime Text 3 app for the changes to take effect.


text:
## Events

Channel: `pusher`

- Create
`dummy_model.create`

- Update
`dummy_model.update`

- Destroy
`dummy_model.destroy`

The payload will be the output of the model instance `to_json`. If defined, a serializer will be used (eg. `DummyModelSerializer`).

Including `Pushable` will also add `client_id` as a virtual attribute. Your client can use this attribute to distinguish not yet saved records.
To add the `client_id` attribute to the model json you can include `PushableSerializer` in your `ActiveModel::Serializer`s, like this:

```ruby
class DummyModelSerializer < ActiveModel::Serializer
  include PushableSerializer
end
```

## Integrations

This library works well with [ember-pushable](https://github.com/matteodepalo/ember-pushable)

## Contributing

1. Fork it ( http://github.com/matteodepalo/pushable-rails/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

repository: JeroenKnoops/pushable-rails

repo_name: JeroenKnoops/pushable-rails


text:
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) > [typeioc](./typeioc.md) > [IContainerBuilder](./typeioc.icontainerbuilder.md)

## IContainerBuilder interface

Represents container builder interface

<b>Signature:</b>

```typescript
export interface IContainerBuilder
```

## Methods

|  Method | Description |
|  --- | --- |
|  [build()](./typeioc.icontainerbuilder.build.md) | Creates an instance of [IContainer](./typeioc.icontainer.md) interface |
|  [copy(builder)](./typeioc.icontainerbuilder.copy.md) | Copies all registrations from the container builder provided into self |
|  [register(service)](./typeioc.icontainerbuilder.register.md) | Registers a service using fluent API |

## Remarks

Container builders provide functionality for working with containers and registering services

repository: typeioc/typeioc

repo_name: typeioc/typeioc


text:
---
path: "/brain-drain-australia"
date: "2016-08-05"
title: "Australia Brain Drain"
published: false
tags: ["australia", "brain", "drain"]
---

My first NDC conference (anywhere) I have to say the whole event was very well planned, although there are a
couple of things which can be improved:

Wifi connection - the Hilton's wifi connection was so crap, all the guest speakers especially american and uk
    speakers think that Australia as a whole are running on a 56k modem. I actually attended a session where the speaker had
    to tether from an Android 4G connection just to demo his stuff (Peter Myers, please forgive us). If you are from overseas
    speaking/spoke at NDC Sydney, please accept our sincerest apology, and please don't misunderstand. Our internet connection
    in Australia is pretty good, it's just at Hilton's, so please forgive us.

Pricing was a bit steep. I understand Sydney is one of the most expensive cities in the world, yes yes. It's such
    a shame though many developers are left out of NDC because of pricing/cost. Personally I know many a great
    developer that missed out on NDC Sydney purely due to financial reasons. I believe an event such as this should be more
    accessible and affordable to the community in general, because it's a symbiosis. The more people attending these events,
    the more aware they are of the current technologies on offer today, the higher the adoption rate and awareness, and
    the whole thing propagates in a vicious cycle that can only benefit the development world.

Enough of my rant and angst, I want to emphasise on a more pressing issue at hand; which is the title of this blog today "Brain Drain".
Not for the first time in recent years/months, I heard a colleague/friend saying "Oh I used to work in {insert iconic aussie company here},
but I'm moving to Seattle to work for Amazon now".

I have to admit, I have attended more than one interviews with
Amazon, Facebook, Google you name it and the lure of working for these mammoth companies is irresistible. Not only the prospect
 of living and working overseas attractive for Australians, imagine how your resume will look after working for
 Facebook or Amazon. You can pretty much quit after 2 years, come back to Australia or go anywhere in the world and
 get a job based on the premise that "Oh by the way I worked for Aws/Facebook for a couple of years". It's definitely a legit reason
 to quit your job in Australia and move to the States.

I want to challenge that temptation right now. Australia is facing a severe "brain drain" at the moment. What I mean by that
is our talent is being poached by Amazon/Facebook/Google; they are leaving Australia for the States because these are the
leading innovative tech companies at the moment. Or so people assume.

Think about it for a second. If you are a developer in Australia and you are offered by Facebook to join their engineering team,
would you turn it down?  Probably. Instinctively I think most people would say yes. However, I would
implore you to consider more carefully.

For one, food. I'm an avid food lover, and I like my food healthy and cholesterol friendly. I want my kids and family to be
healthy too. I'm not saying the food in the States are crap, all I'm saying is that we are spoilt for choice in Sydney.
There are things that we take for granted, for example good coffee or a decent loaf of bread or fresh seafood. You can still
find these in Sillicon Valley, but perhaps not so easily.

Secondly weather. I was in San Francisco a few weeks ago and I had a chance to experience "summer" there. Let me tell you now you can't
wear a bikini to the beach even in summer there. For one, there are no "beaches" there, at least not one that's comparable to Bondi or any beach in
Sydney. It's just way too cold even during summer to go to the beach for a dip. If you think winter in Sydney is cold, think again.

I'm just really disappointed in Australia's inability to retain talent. We are a talented nation. I know so because I have been
working in the IT industry for over 13 years now and I've met and worked with many talented developers. Why can't Australia keep Australians
working in Australia in the IT industry? There are a few reasons that pop to my head.

For one, the "big" names like Apple, Facebook, Amazon are too big to resist. Hollywood movies of Steve Jobs and "The Social Network" further
extremised these views that Sillicon Valley is the place to be if you want to be somebody. I don't blame them. The Australian government are
not helping either, imposing strict legislations on innovative services and startups like Uber and AirBnb.

Do you know that Uber is still not
completely legal in Australia? Nor is AirBnb. In San Francisco, the local government are so supportive of tech and startups, it became almost
seamless and natural that new ideas are legalised almost immediately. In fact, if you are against new ideas or innovation, you're weird.

Australia need
to embrace tech like the San Franciscans.  There is no reason why we can't nurture this culture of tech startups and innovation. There is no reason
why Sydney can't have a "Sillicon Valley" or "Kangaroo Valley" (excuse the pun). We actually do have a place called Kangaroo Valley which is quite
lovely, I highly recommend it.

A change in government mentality towards technology is required in Australia to promote innovation and startups and to retain talent. I believe
one day Australia will be a comparable competitor to the States in terms of technological advancement, talent pool and innovation. Companies like
Atlassian and Xero are leading the way, but we need more. One day the tables will turn and Australia will be the ones poaching talent from the
States and the rest of the world as well.

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

extension: markdown


text:
---
title: Cooking in a sleeping bag
date: '2018-12-21 06:00:00'
image: beans_thermos_.jpg
tags: energy efficient cooking diy rv insulate home improvement solar oven offgrid
categories: food solar vandwelling water
layout: post
---

Maybe we have to cook in a sleeping bag cause we're living offgrid and it's December? Can you picture us wrapped up in blankets standing around the [grill](https://reverdecer.annalisagross.com/2018/08/08/our-grill/)?

Not a bad idea for breakfast or late dinner, but it's been [hot every fabulous, sunny winter afternoon,](https://reverdecer.annalisagross.com/2018/12/09/july-in-christmas/) much hotter than summer! (Not the nights, though, we woke up to ice in the water this morning, but at least we don't have to worry about freezing pipes - we have no pipes,)

But we've actually developed a way to cook in a sleeping bag that we recommend - even if you have a fully electric life.

[![](/images/beans_.jpg){:width="60%"}](/images/beans.jpg)

We bring beans/rice/veggies/soup to a boil on the grill, then wrap the pot in our sleeping bag and wait. it stays **hot** for hours, even stays warm overnight. Rice gets overcooked easily - we never pull it out soon enough. Beans require a second boil, or even a third. But this is still a vast improvement over cooking beans on the grill - we always seem to run out of propane before the beans get soft, and hours on the grill is a total waste of gas.

| [![](/images/beans_bag_.jpg)](/images/beans_bag.jpg) | [![](/images/beans_bag2_.jpg)](/images/beans_bag2.jpg)

We've tried beans in a thermos, too (see header photo). Bring to boil, then pour into a thermos and wrap that in a sleeping bag. Still takes two rounds of coming to a boil, but better than wasting hours of propane.

[We have tried passive solar cooking](https://reverdecer.annalisagross.com/2018/10/16/welcome-to-our-kitchen/) but it takes days and the food starts to smell bad before it's cooked. We got a big piece of glass so may try adapting the solar oven, again. Now that the rains are gone we have more hours of sunlight - what a great winter!

gha_language: CSS


text:
wh40k-imperial-calendar
=======================

Edit 2014-01-01: Precision has been improved to the second as of the latest changeset.

This can be used to convert dates and times into the Imperial Dating System found in the Warhammer 40k Universe.

Live example can be viewed at: http://www.valkrysa.com/experiments/40k-date-generator/

#### Usage

If you want to use the Object Oriented version use imperial-calendar.js
A single function version is available in imperial-calendar-functional.js

Basic usage. Uses the current date.
```
//The OO version.
var theImperialDate = new ImperialCalendar();
console.log( theImperialDate.imperialDate() ); //results in: 0910013.M3

//The single function version
var theImperialDate = imperialCalendar();
console.log( theImperialDate ); //results in: 0910013.M3
```

You can also specify your own date using a basic Javascript Date Object.
```
//The OO version.
var theGregorianDate = new Date(2013, 10, 29);
var theImperialDate = new ImperialCalendar(theGregorianDate);
console.log( theImperialDate.imperialDate() ); //results in: 0910013.M3

//The single function version
var theGregorianDate = new Date(2013, 10, 29);
var theImperialDate = imperialCalendar(theGregorianDate);
console.log( theImperialDate ); //results in: 0910013.M3
```

You can pass true to add spaces between date parts as a stylistic choice.
```
//The OO version
console.log( theImperialDate.imperialDate(true) ); //results in: 0 910 013.M3

//The single function version, you pass true as the second parameter, date being the first.
var theGregorianDate = new Date(2013, 10, 29);
var theImperialDate = imperialCalendar(theGregorianDate, true);
console.log( theImperialDate ); //results in: 0 910 013.M3
```

If you are using this from anywhere other than earth the setCheckNumber() method can be useful.

If you are on the International Space Station you could use:
```
//The OO version
theImperialDate.setCheckNumber(1);
console.log( theImperialDate.imperialDate(true) ); //results in: 1 910 013.M3

//The single function version, you can pass a check number as the third parameter,
//a style value as the second parameter like before, and of course date being the first.
var theGregorianDate = new Date(2013, 10, 29);
var theImperialDate = imperialCalendar(theGregorianDate, true, 1);
console.log( theImperialDate ); //results in: 1 910 013.M3
```

If you are running this from an alien world you can mark it the following way, also, please visit your nearest Inquisitorial office as soon as possible for further instructions.
```
theImperialDate.setCheckNumber(9);
console.log( theImperialDate.imperialDate(true) ); //results in: 9 910 013.M3

var theGregorianDate = new Date(2013, 10, 29);
var theImperialDate = imperialCalendar(theGregorianDate, true, 9);
console.log( theImperialDate ); //results in: 9 910 013.M3
```


text:
---
title: ZTO Express
description:

css: scss/case-detail.scss

section1:
  title: ZTO Express
  content: Shared by Yang Xiaofei, head of R&D of ZTO Express’s Cloud Platform, this article mainly introduces the development and deployment of KubeSphere on production environment, as well as application scenarios of ZTO Express.

section2:
  listLeft:
    - title: 'Company Introduction'
      contentList:
        - content: ZTO is both a key enabler and a direct beneficiary of China’s fast-growing e-commerce market, and has established itself as one of the largest express delivery service providers for millions of online merchants and consumers transacting on leading Chinese e-commerce platforms, such as Alibaba and JD.com. Globally, ZTO provides delivery services in key overseas markets through its business partners as it expands coverage of international express delivery by collaborating with international industry players.
      image: '/images/case/ZTO/ZTO1.jpg'

    - title: 'Background'
      contentList:
        - content: For further development, five prominent challenges were waiting to be addressed.
        - content: First, different versions were required to adapt to different environments. However, as multiple versions were carried out, we could not effectively respond to resources through virtual machines.
        - content: Second, frequent upgrading called for quick environment initialization, and new versions were proposed frequently even every week.
        - content: Third, resource application and environment initialization were over-complex. We used conventional approaches for resource application in 2019, when trouble tickets were required for environment initialization delivery. It was troublesome and low efficient for testers as they needed to apply for resources first and release those resources after testing.
        - content: Fourth, low utilization of existing virtual resource was another problem. Staff turnovers and changes in positions sent abundant resources into zombies, especially on development and testing environment.
        - content: Fifth, we lacked horizontal extension capacity. Resources were scarce on important shopping days such as “6.18” and “double 11”. To address this problem, we used to prepare resources in advance and take them back after the events. This proved to be outdated.
        - content: Confronting all those challenges, we discussed with developers and decided to embark on cloudification.

    - title: 'Cloudification on Production Environment'
      contentList:
        - content: Our cloudification includes three steps, namely, cloud-based, cloud-ready and cloud-native.
      image: /images/case/ZTO/ZTO2.jpg

    - title:
      contentList:
        - content: Based on Dubbo framework, our micro-service completed transformation in an early date. However, the micro-service was carried out through virtual machine, when the emergence of Salts led to troubles. Therefore, we needed to make transformations on IaaS and container.
      image: /images/case/ZTO/ZTO3.jpg

    - title: 'KubeSphere Development and Deployment'
      contentList:
        - content: We decided to apply KubeSphere as the construction scheme of our container management platform, ZKE, and as an upper container PaaS platform for running micro-services.
      image: /images/case/ZTO/ZTO4.jpg

    - title: 'Construction Direction'
      contentList:
        - content: In line with the reality, we took KubeSphere as the container platform for running our stateless service, Kubernetes observability, and infrastructure resource monitoring, while stateful service like middlewares are provided in Iaas.
      image: /images/case/ZTO/ZTO5.jpg

    - title: 'Small Clusters with a Single Tenant'
      contentList:
        - content: After the selection of KubeSphere, we encountered another problem——Should we choose small clusters with a single tenant or a large cluster with multi-tenants?  After consulting the KubeSphere team and evaluating our own demands, we picked up small clusters with single tenant. In accordance with business scenarios (such as middle desk business, and scanning business) and resource applications (such as big data, edge), we created different clusters.
        - content: Based on multi-cluster design, we made cloud transformation in line with KubeSphere v2.0. Each cluster on development, testing and production environment were deployed with a set of KubeSphere, while public components are drawn out, such as monitor and log.

    - title: 'Secondary Development Based on KubeSphere'
      contentList:
        - content: For realizing some customized features to meet our demand, we integrated our business scenarios to KubeSphere. Here is the integration took place between the summer of 2019 and October of 2020.

    - title: 'Super-Resolution'
      contentList:
        - content: We applied super-resolution. Hence, once the limit is set, requests could be quickly computed and integrated. On production environment, the super-resolution ratio for CPU is 10 and memory 1.5.

    - title: 'CPU Cluster Monitoring'
      contentList:
        - content: In this part, we merely applied CPU cluster monitoring for demonstrating the data we monitored.

    - title: 'HPA Horizontal Scaling'
      contentList:
        - content: We held high expectation in HPA Horizontal Scaling. As KubeSphere resource allocation supports horizontal scaling, we set the horizontal scaling independently and integrated it with super-resolution, thus to facilitate the measurement of the super-resolution ratio.
        - content: Based on HPA and clear interface of KubeSphere, we have almost been free from operation and maintenance of some core businesses. In addition, demand in emergency scenarios can be quickly responded. For example, when it comes to upstream consumption backlogs, we can quickly increase replication and give a instant response.

    - title: 'Batch Restart'
      contentList:
        - content: As abundant deployments might be restarted under extreme conditions, we set an exclusive module in particular. Hence, what we need is only one click to get instant restart and quick response of clusters or deployments under one Namespace.

    - title: 'Affinity of Container'
      contentList:
        - content: In terms of affinity of container, we applied the soft anti-affinity, as some applications found their resource usage mutually exclusive. In addition, we also added some features and affinity settings in this part.

    - title: 'Scheduling Strategy'
      contentList:
        - content: In terms of scheduling strategy, the features of specifying a host group and exclusive host stood out.  As some of our businesses needed to access to the internet port, we put all those businesses within one host group and provided it with access to the internet. We also applied exclusive host to run big data applications in the early hours of morning, because the service was idle at that moment.

    - title: 'Gateway'
      contentList:
        - content: Each Namespace in KubeSphere held an independent gateway. Independent gateway met our production requirement, while we also needed pan-gateway in development and testing, thus to achieve quicker responses to servers. Hence, we set both pan-gateway and independent gateway, and had access to all development and testing through pan-domain name. After configuration, our services could be directly accessed through KubeSphere interface.

    - title: 'Log Collection'
      contentList:
        - content: We used to apply Fluent-Bit for log collection, while since there were some mistakes made in resources upgrading or parameters, it always failed as businesses kept increasing. Therefore, we turned to Sidecar. Services based on Java all set an independent Sidecar, and pushed logs to centers like ElasticSearch through Logkit, a small agent. We continued to use Fluent-agent to collect logs  under development and testing environment, while for production scenarios that require complete logs, we took further steps to ensure that logs were persistently stored at disks. All logs of containers were collected through four approaches, including console log, Fluent-agent console log, /data Sldercar-logkit and /data NFS.

    - title: 'Event Tracing'
      contentList:
        - content: In term of Event Tracing, we made transformation on the basis of Kube-eventer, and added event tracing to KubeSphere, where configurated information could be sent to Ding Talk. As for changes in businesses that were highly concerned under production environment, we could send them to work group of Ding Talk through customized configuration.

    - title: 'Future Planning'
      contentList:
        - content: In the future, we would like to make some improvements in several aspects. First of all, service plate will ensure that all individuals, including operators, maintainers as well as developers, can understand the framework of the services provided, the middlewares and data bases relied on,as well as the running status. Second, it is expected that status quo of all PODS, including changes in color and resources allocation can be seen from the perspective of the whole cluster. Third, we hope that edge computing can be applied for uploading scanned statistics of transferred expresses, automatic recognition of violate practice of operator, the wisdom park project and other purposes.
        - content: In addition, we also encounter some difficulties in the management of abundant edge nodes, stability and high availability of KubeEdge, and deployment and automatic operation and maintenance of edge nodes. We are exploring more uncharted areas with the pursuit of breakthroughs.

  rightPart:
    icon: /images/case/ZTO/ZTO6.jpg
    list:
      - title: INDUSTRY
        content: Delivery
      - title: LOCATION
        content: China
      - title: CLOUD TYPE
        content: On-premises
      - title: CHALLENGES
        content: Multi-clusters, HA, Microservice Migration, Unifying Container and VM Networking
      - title: ADOPTED FEATURES
        content: HPA, DevOps, Grayscale Release, Monitoring and Alerting

---

repository: kubesphere/website

gha_language: SCSS

repo_name: kubesphere/website


text:
---
layout: post
title: "VTDP: Model-Based Interactive Planning for System Design"
---

For an increasing number of applications human decision making is supported by a computer model of some system. In general, such models start with an existing state of a system and run the model forward in time for a period ranging from hours to years. The human decision maker operates in an interactive loop, adjusting model parameters, representing possible alternative strategies, and combining knowledge that only they have with the model forecast to decide on a course of action.

**Example 1:** A business spreadsheet is used to forecast profit margins based on assumptions about such variables as materials costs, labor costs, transportation costs, etc.  The output is a time series of forecast revenues and profits.

**Example 2:** A traffic behavior model is used to simulate the effect of a new intersection design on congestion patterns.

**Example 3:** A model of interactions between a number of commercial fish species is used to forecast the effects of changing the allowable catch.

###The process of model-based interactive planning

* Display Environment: Model output is displayed as time series plots, or possibly a map with a time slider.
A set of sliders or input boxes allow users to change model parameters.*

1. *User constructs a hypothesis concerning the effects of a change in some model parameter(s) relating to design alternatives, business or management decisions.*
2. *User adjusts the parameter(s) to test the hypothesis.*
3. *Visually query resulting changes in forecasts.*
4. *Incorporate results into mental model of system behavior. This model incorporates features both of the computer model and prior experience relating to system behavior.*
5. *Repeat from 1 until an acceptable solution is found.*

###Cognitive and Perceptual Issues

**Visual Query Support:** Common queries relate to how forecast outcomes will change based on alternative system design or business decisions. It is therefore important that the time series plots show both the new forcast and a previous or baseline forecast and that the differences are clear.

**Cognitive Guideline:** The speed of the cognitive process depends largely on the speed with which the forecast is updated as a result of changes in model parameters.  Real time update is ideal.

**Display Guideline:** Since design decisions often have to be justified to others, a way of saving simplified views showing the effect of different alternatives can be useful.

###Example Application

The figure below shows an interface to the MSPROD fisheries model designed by Carmen St Jean and Colin Ware. The model is described in [^1].  The analyst can change the fishing effort on different species categories and see the resulting change in forecast instantaneously. The shaded portion of each time series plot shows the change from a previous forecast.

The arcs to the left and right show interactions between fish species representing competition and predation. These reveal the workings of the model and allow for an analysis to see both that a forecast has changed and the reason for the change.

###MSProdVisualization

![Fisheries model visualization](/images/MSProdVis.png)

###References

[^1]: Gamble R, Link J. (2009) Analyzing the tradeoffs among ecological and fishing effects on an example fish community: A multispecies (fisheries) production model. Ecological Modelling. 220(19).

repository: ColinWare/VTDPsite

branch_name: HEAD

repo_name: ColinWare/VTDPsite


text:
# trueChart-Menubar

The **trueChart-Menubar** allows for vertical and horizontal buttons and selections
(fields, master dimensions and variables) as well as unlimited trigger based Actions.
This visualization extension supports [Qlik Sense®](http://www.qlik.com/us/products/qlik-sense)
from version 3.0.0 up to currently latest version November 2017 Patch 1 including exporting and story mode capability.

[Get trueChart-Menubar!](https://www.highcoordination.com/downloads/truechart-menubar/)

![trueChart Menubar Example](./assets/example.gif)

## Features

* **Responsive** vertical and horizontal design
* Create **buttons** and assign _Triggers_ and _Actions_ to
  - navigate through Qlik Sense and within self-created mashups,
  - make selections (upon button click, after page loading, after selection,
  bevor navigation or based on your own JS-based custom trigger event),
  - created individual actions based on your own JS code,
* Comprehensive **Button Editor** for button styling,
* Create _Select_ widgets to make **selections** from (drill-down) dimensions.
* Create _Variable_ widgets to set **variable values** just by a click.
* **Maximum space gain** by optionally hiding the Qlik Sense® menus
(menu, selection and title bar)

## Update

### trueChart-Menubar v1.1.x

> **Features and Improvements**
* **Support of Sense PDF export function** [HICO-2178]
* **Support of drill-down dimensions** in selections (Single, Sense and Multi) [HICO-2560]
* **Conditional display and hiding of menu elements** [HICO-2890]
* Improvement when using master item dimensions and expression-based dimensions [HICO-2524]
* Specify expressions for dimension definition directly [HICO-2601]
* Option to enter title, subtitle or footnote [HICO-2889]
* Mark button+ actions for parallel (faster) or sequential (in order)execution [HICO-40445]
* New position of edit button state in properties panel [HICO-40461]
* Performance: Reduced initial loading time [HICO-40463]

## Showcase

### Selection and navigation

![Selection and navigation](./assets/selection-and-navigation.gif)

### Triggers and actions

![Triggers and actions](./assets/triggers-and-actions.gif)

## Prerequisites

### Qlik Sense® Support
trueChart-Menubar supports Qlik Sense® from version 3.0.0 up to currently
latest version November 2017 Patch 1 including exporting and story mode capability.

#### nPrinting Support
The trueChart-Menubar does not yet fully support nPrinting. Expression updates are not
performed due to technical restrictions. The general export (without expressions) was
successfully tested with the nPrinting 2017 September version.

### Browser Support
At present trueChart-Menubar supports the browsers listed below:

* Microsoft Internet Explorer 11
* Microsoft Edge
* Mozilla Firefox (latest version – v54, at the time of writing)
* Google Chrome (latest version – v59, at the time of writing)
* Safari for iOS 9

The indicated versions are the minimum conditions. In each case, the latest
version is to be preferred.

## Download and installation

Here you will find the official release version, which can be used directly in Qlik Sense®.

[Get trueChart-Menubar!](https://www.highcoordination.com/downloads/truechart-menubar/)

### _Qlik Sense Desktop_

For _Qlik Sense Desktop_, simply extract the contents of the ZIP file to your
`Documents/Qlik/Sense/Extensions` folder.

### _Qlik Sense Server_

1. Enter the QMC and navigate to **Manage Resources** → **Extensions**
2. Click the **Import** button at the bottom,
3. In the pop-up dialog, click on **Choose File** to browse the downloaded folder,
4. Click on **Import**.

## Build

In order to further develop the trueChart-Menubar, the git-repo must first be cloned.
Then perform locally the following step to build an extension that can be used in Qlik Sense®:

1. npm install
2. npm run build
2. npm run zip -> builds/tcmenu-[version]_dev.zip

## Documentation

The trueChart-Menubar also includes a complete user documentation and from
installation, configuration to use everything is explained.
The documentation can be accessed through properties panel **Display** → **Info**
via link **Manual[PDF]** or directly here [User Manual](./doc/tcmenu.pdf).

## Contacts
* Web: [HighCoordination GmbH](https://www.highcoordination.com/en)
* Email: [info<EMAIL_ADDRESS>* Twitter: [Hi_Coordination](https://twitter.com/Hi_Coordination)
* Facebook: [HighCoordination](https://www.facebook.com/HighCoordination)
* LinkedIn: [highcoordination-gmbh](https://www.linkedin.com/company/highcoordination-gmbh)
* Xing: [highcoordinationgmbh](https://www.xing.com/companies/highcoordinationgmbh)

## Links
* [trueChart-Menubar Website](https://www.highcoordination.com/en/products/truechart-menubar)
* [Buy trueChart-Menubar support](https://www.highcoordination.com/en/learn-more/contact/?formular=kontaktformular-vertrieb#section-kontaktformular-vertrieb)
* [trueChart-Menubar Support](https://www.highcoordination.com/en/support)
* [trueChart-Menubar Demo](https://sense.highcoordination.de/demo/extensions/HiCoDemo/HiCoDemo.html)

## License

This project is licensed under the terms of the [Apache 2.0 license](./LICENSE).

The project published here can be used directly, but without support.
For trueChart-Menubar a commercial license including support can be purchased
via HighCoordination. In particular, this includes support for future versions of
Qlik Sense® and technical support.

[Buy trueChart-Menubar support](https://www.highcoordination.com/en/learn-more/contact/?formular=kontaktformular-vertrieb#section-kontaktformular-vertrieb)

If you have any questions regarding licensing - please [contact us](https://www.highcoordination.com/en/learn-more/contact).


text:
# Lua native thread experiment

This is a Lua C module for experiments of native threads.
It is based on sample code in Programming in Lua 2nd Ed.

## Build and test

```
mkdir out
cd out
cmake ..
make
make test
```

## License
MIT License

repository: hnakamur/lua-native-thread-experiment

repo_name: hnakamur/lua-native-thread-experiment


text:
# Topic 4 - Activity 4.1

**Challenge 1:** How effective is the design?

It if difficult to directly measure the effect of a new UX design because its it hard to tell if customers experience is being influenced by other variables.

e.g if you roll out a newer more modern looking UI and the user complaints drop, can you be sure that's not because old people are driven off by a new design and you have attracted a younger and more technologically literate audience because of the new design?

**Challenge 2:** Whats the real problem?

Customer complaints are useful but how can you be sure they are accurate? If customers complain about a new design, is it because its a worse design or are they complaining because its different from the old design and they haven't become accustomed to it.

**Challenge 3:** Bias, preference and prospective

A UX team needs to look at a design from the prospective of the user, this is difficult because developers may have different sensibility's and preferences to users.
e.g A dev might like how their product looks with a dark theme and feel that it is a sleeker and better UX but the user might find it difficult to see menus and text under sunlight and thing a light or more vibrant theme would be a better UX.

**Challenge 4:** Prototyping

Prototyping is difficult because you need to think of everything your UI will need to accommodate a good UX, a lot of the time you can miss or not realize a crucial feature for a good UX and will need to rethink your prototype, implement it later in the development stage or put it in the next release.


text:
# DNS Records for a Zone

Documentation for Cloudflare DNS records

## List DNS Records

`GET` List, search, sort, and filter a zones' DNS records.

> GET zones/:zone_identifier/dns_records

**Permission needed:** `#dns_records:read`

Available in:

* FREE
* PRO
* BUSINESS
* ENTERPRISE

## Create DNS Record

`POST` Create a new DNS record for a zone. See the record object definitions for required attributes for each record type

> POST zones/:zone_identifier/dns_records

**Permission needed:** `#dns_records:edit`

Available in:

* FREE
* PRO
* BUSINESS
* ENTERPRISE

## DNS Record Details

`GET`

> GET zones/:zone_identifier/dns_records/:identifier

**Permission needed:** `#dns_records:read`

Available in:

* FREE
* PRO
* BUSINESS
* ENTERPRISE

## Update DNS Record

`PUT`

> PUT zones/:zone_identifier/dns_records/:identifier

**Permission needed:** `#dns_records:edit`

Available in:

* FREE
* PRO
* BUSINESS
* ENTERPRISE

## Patch DNS Record

`PATCH`

> PATCH zones/:zone_identifier/dns_records/:identifier

**Permission needed:** `#dns_records:edit`

Available in:

* FREE
* PRO
* BUSINESS
* ENTERPRISE

## Delete DNS Record

`DELETE`

> DELETE zones/:zone_identifier/dns_records/:identifier

**Permission needed:** `#dns_records:edit`

Available in:

* FREE
* PRO
* BUSINESS
* ENTERPRISE

## Import DNS Records

`POST` You can upload your BIND config through this endpoint. It assumes that cURL is called from a location with bind_config.txt (valid BIND config) present.

> POST zones/:zone_identifier/dns_records/import

**Permission needed:** `#dns_records:edit`

Available in:

* FREE
* PRO
* BUSINESS
* ENTERPRISE

## Export DNS Records

`GET` You can export your BIND config through this endpoint.

> GET zones/:zone_identifier/dns_records/export

**Permission needed:** `#dns_records:read`

Available in:

* FREE
* PRO
* BUSINESS
* ENTERPRISE

repository: andridus/elixir-cloudflare-api-client

repo_name: andridus/elixir-cloudflare-api-client


text:
---
layout: post
date:	2011-02-17 08:35:00
title:  The Rabdi Shop
tags: [archived-posts]
categories: archives
permalink: /:categories/:year/:month/:day/:title/
---
As we passed Agra, our driver, Gajendra Singh, told us about a shop where the

 rabdi

was excellent.

How could we resist that? Here's where we stopped:

<lj-cut text="some images of the rabdi shop,  and  of the rabdi">

The shop doesn't seem to have a name, but it's a nice large one:

At the shop,

 samosas

were also being made, you can see the wheat flour being rolled out and shaped into Indian pyramids!

I was impressed by this technical innovation to make the fire burn better...an exhaust fan, incorporated into the mud stove!

Here's the rabdi itself, being made slowly in that large kaDHAi (our wok)....

</lj-cut>

We liked the rabdi as it was not over-sweet the way it sometimes can be.

It was served in little bowls made of pressed-leaves and old juice containers...surely great recycling!

The rabdi was truly delicious, and my somewhat-tight jeans are an attestation to that!

I must get <lj user="idahoswede"> and <lj user="kejn"> some rabdi (or its Kannada equivalent) when they come back tomorrow...they've been having a gala time in the forests of Karnataka, and then meeting <lj user="premkudva">.

I've posted a video on the making of jalebis

 here

Ah, our sweets....slurp!


text:
The folder contains code produced by the DSI (mostly Jane Carlen and Stanislaw Saganowski, building on work by Duncan Temple Lang) with the goal of extracting prices tables from the Sherry Lehmann wine catalogs.

Organization:

- The **tablewine** R package contains the functions needed for price table extraction. Currently the hierarchy is that the main function to extract price tables from an image is in wine_price_tables.R, which is composed mainly of functions in wine_price_\*.R scripts, and those variously call the shorter one-task functions in helper.R. Scripts with truth or evaluate in the name are related to creating or organizing truth data or evaluating output of the table extraction code.
   + parse_items.R - items parser. Expects trimmed .jpg as an input. Extracts year, color, region, producer, brackets, and name (what's left).
   + create_dictionaries.R - creates dictionaries (province, region, producer) from Kaggle wine data set
   + (fill in rest)

- The **scripts** folder contains scripts to run price table extraction on a folder (currently the images with price tables from Duncan's original (random?) sample of 100 images, SampleCatalogPages) or one image file. Subsequent run_\*.R scripts parse the names found and turn results into output tables for our database. See the **wine price table workflow.pdf** for an overview of the process and how these scripts work together.

Notes on running scripts:

- You can run scripts like **run_wine_price_tables.R** from the command line. Examples:

Example 1 to run only OCR on a single file:
```
Rscript run_wine_price_tables.R FILESET=OCR_SherryLehmann/Sample/Sample1/UCD_Lehmann_0015.jpg DATA.OUTPUT.DIR=Data/sample_output OCR.ONLY=TRUE
```
Example 2 to run a whole folder, supplying data from previous
```
Rscript run_wine_price_tables.R FILESET=OCR_SherryLehmann/Sample/Sample1 OUTPUT.DIR=Data/sample_output DATA.INPUT.DIR=Data/sample_output
```
Possible arguments for **run_wine_price_tables.R**:
Seperate name from value with = sign and no spaces, as shown above.
Entry order doesn't matter.

- FILESET: Required argument. A path to a specifiic image or a folder containing images.
- OCR.ONLY = TRUE or FALSE. If true only create OCR-output data objects (no price table extraction).
- OUTPUT.DIR: Directory where to store price table extraction objects. Needed if OCR.ONLY is false.
- DATA.OUTPUT.DIR: Optional directory to store data objects. (If not given data is not stored.)
- DATA.INPUT.DIR: Optional directory where to look for pre-run data objects (to avoid re-OCRing when possible).
- SAVE.DESKEWED = TRUE or FALSE. Save the deskewed image (usually not needed)? Defaults to false.
- PIX.THRESHOLD = Optional numeric in 1-255 to override the default.
- BINARY.THRESHOLD = Optional numeric in 1-255 to override the default.

repository: ucd-library/wine-price-extraction

repo_name: ucd-library/wine-price-extraction


text:
# router

A simple router for client *and* server side apps.

Dispatches a URL to each matching handler.

## Installation

    npm install --save iso-router

## Usage

    var router = require('iso-router');

    router()
      .map('/', function() {
        console.log('index');
      })
      .map('/user/:username', function(ctx) {
        console.log('user profile', ctx.params.username);
      })
      .route('/')
      .route('/user/jameslnewell')
      .route('/blah')
    ;

## Examples

### Simple

    $ node example/simple.js

### Client

    $ browserify example/client.js > example/client.build.js
    $ open example/client.html

### Server

    $ node example/server.js
    $ open http://localhost:3001/
    $ open http://localhost:3001/user/jameslnewell
    $ open http://localhost:3001/blah

## API

### new Router()

Create a new router.

### .map(pattern : string|RegExp, handler : function)

Add a handler for a URL.

### .route(url : string, [context : object], [callback : function])

Route a URL each matching handler.

- url - the URL
- context - the route context - a data object passed to the route handler
- callback - a function called when the route handler has finished

## To Do

- splats http://backbonetutorials.com/what-is-a-router/
- named routes for URL generation
- prefixes/router chains
- return the fn and match info from .route() and extract calling of the handler fn into a dispatch method to allow the user to call the handler as they wish e.g. pass in the req, res and next???? but code needs to be consistent on client and server anyway

## License

The MIT License (MIT)

Copyright (c) 2015 James Newell

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

repository: iso-js/router

repo_name: iso-js/router


text:
# json-schema-editor
Web-based editor for JSON schemata.

Please sign the CLA using the CLA assistant before contributing: https://cla-assistant.io/eclipsesource/json-schema-editor

Original project: [JsonFormsEditor](https://github.com/eclipsesource/JsonFormsEditor)


text:
# hippeis
*Server side of a home automation project written in Ruby*

The server provides a RESTful JSON API for the clients.

## API
#### /temperature
* GET: query reference and current temperature
* POST: set reference temperature

#### /lighting
* GET: query reference and current lighting
* POST: set reference lighting

#### /control
* GET: query current state of temperature control
* POST: enable/disable automatic temperature control


text:
# bitbucket-pull-reminders

The purpose of this repo is to replicate the behavior of Pull Panda on Github for Bitbucket repositories.

## About the Project

Github acquired Pull Panda and now offers Pull Request reminders for free. There is no open source alternative for Bitbucket, and the ones I've found lacked some functionality such as listing members who did not act on the pull request and how long the pull request has been stale for. This project mimics the behavior of Pull Panda for Bitbucket users.

## Getting Started

This application assumes access to Bitbucket and Slack.

### Installation

1. Clone the repo
```sh
git clone git@github.com:Yitaek/bitbucket-pull-reminders.git
```

2. Install NPM packages
```sh
npm install
```

3. Create a `.env` file and fill out the following details
```sh
PASSWORD=<bitbucket password>
USERNAME=<bitbucket username>
TEAMNAME=<bitbucket teamname>
BB_PROJECTS=<AB,CD,EF> # comma separated list of project names
SLACK_WEBHOOK_URL=<slack webhook url>
```

When the script is running locally, it will use unencrpyted variables from .env. In production, KMS will be used to encrpyt secrets prior to deploying to Cloud Functions so other can't see your bitbucket password or slack webhook in unencrpyted form.

## Deployment

Currently, a full, automated setup is supported on GCP via Cloud Scheduler and Cloud Functions, but a similar architecture is possible via AWS CloudWatch and Lambda.

### GCP

Requirements
- Cloud Scheduler
- Cloud Functions
- Cloud Pub/Sub
- Cloud KMS (optional)
- gcloud

Replace the GCP variables under `setup/setGCPvars.sh`

```sh
export GCP_PROJECT=<YOUR-GCP-PROJECT-NAME>

## Feel free to use these defaults
export GCP_REGION=us-east4
export KMS_KEY_RING=bb-pr-bot
export KMS_KEY=bb-pr-bot-key
export PUBSUB_TOPIC=bb-pr-bot
```

Run `npm setup:gcp` to create Pub/Sub, KMS key ring, IAM bindings, and Cloud Scheduler.

By default, this will create a Cloud Function named `bitbucket-pr-bot` listening to PubSub topic `bb-pr-bot` that is triggered at 9am ET on weekdays via Cloud Scheduler job `bitbucket-pr-bot-daily`.

Run `npm encrypt` to create an encrypted version (.env.enc) of your configs.

Finally, run `npm deploy:gcf` to package and deploy the Cloud Function.

## Roadmap

- Include AWS equivalent deployment using Lambda and Cloudwatch
- Make Slack messages more useful (e.g. unmerged branches with all approvals, tag users)
- Other components from Pull Panda (e.g. UI, analytics board, etc)

## License

Distributed under the MIT License. See `LICENSE.md` for more information.

repository: maniacs-oss/bitbucket-pull-reminders

repo_name: maniacs-oss/bitbucket-pull-reminders


text:
lgtm,codescanning
* Support for `d3` has improved. The XSS queries now recognize HTML injection sinks
  from the `d3` API.
  Affected packages are
    [d3](https://npmjs.com/package/d3),
    [d3-selection](https://npmjs.com/package/d3-selection).

repository: github/codeql

gha_language: CodeQL

repo_name: github/codeql


text:
# Presenter First Android - GeoQuiz Chapter 2

Chapter 1 app expanded with functionality for showing 5 different questions and forwards-cycling through them using a next button.

![Screenshots](screenshots.png?raw=true)

repository: olerass/presenter-first-android

repo_name: olerass/presenter-first-android


text:
# Chapter 9: Integrating with Node.js

## Overview
The code within these folders represents the Node.js examples discussed in Chapter 9.

## Notes
- Unless otherwise specified, all terminal commands should be run from within their example folder (e.g. `/server-example`).

## Section Instructions
Each of the links below corresponds with a section of Chapter 9. Click to navigate to the section code.

- [Server Side WebAssembly with Express](#server-side-webassembly-with-express)
- [Client Side WebAssembly with Webpack](#client-side-webassembly-with-webpack)
- [Testing WebAssembly Modules with Jest](#testing-webassembly-modules-with-jest)

## Server Side WebAssembly with Express
Example Express application that utilizes a WebAssembly module. Ensure you `cd` into `/server-example` before running any commands.

### Installing the Dependencies
Run the following command to install the required dependencies:
```
npm install
```

### Building the Application
Run the following command to build:
```
npm run build
```

### Starting the Application
Run the following command to start the application:
```
npm start
```

### Testing Out the Application
Run the following command in a separate terminal instance (while application is running):
```
node ./requests.js 1
```

You should see the result of a `GET` call to the transactions endpoint. Consult the book or `requests.js` file for additional options.

## Client Side WebAssembly with Webpack
Example Webpack application that loads a C file using a Webpack loader. Ensure you `cd` into `/webpack-example` before running any commands.

### Installing the Dependencies
Run the following command to install the required dependencies:
```
npm install
```

### Building the Example
Run the following command to build:
```
npm run build
```

### Running the Example
Run the following command to start the example:
```
npm start
```

A browser window should open automatically and navigate to the example. Ensure what you see matches the book.

## Testing WebAssembly Modules with Jest
Example test configuration to test a WebAssembly module's exports using Jest. Ensure you `cd` into `/testing-example` before running any commands.

### Installing the Dependencies
Run the following command to install the required dependencies:
```
npm install
```

### Compiling the C File
Run the following command to compile the C file to a Wasm file:
```
npm run build
```

### Running the Tests
Run the following command to run the test suite:
```
npm test
```

repository: PacktPublishing/Learn-WebAssembly

repo_name: PacktPublishing/Learn-WebAssembly


text:
# View image list {#task_oz2_clt_4y .task}

1.   Log on to the [Container Service console](https://cs.console.aliyun.com).
2.   Under Kubernetes, click**Store** \> **Docker Images**in the left-side navigation pane.

    ![](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/6926/5936_en-US.png)

    You can view the image category.

    -   **Popular**: Some common images recommended by Container Service.
    -   **Official**: Official images provided by Docker Hub.

url: https://raw.githubusercontent.com/michael1991/acs/5bf118f3b80867014dcd3c348463b246a280a05f/intl.en-US/User Guide/Kubernetes cluster/Images/View image list.md

filename: View image list.md


text:
# centrifuge-java

### About

This centrifuge can basically though of as a main point of contact for the inner architecture. It will just hop from one target to other while intially using the input payload as the target payload and then consequently the output payload of each target to the next ones and the output of last one will be automatically passed-on back to the caller.

### Working

This Centrifuge will work as shown in the figure:

![Centifuge working illustration](https://res.cloudinary.com/mrmagician/image/upload/v1608046902/cf-j_y4usxa.png)

### Support

For now, the payload as text or an image is supported. Further more types' support can configured later.

repository: Avchhikara/centrifuge-java

repo_name: Avchhikara/centrifuge-java


text:
# Contributing

## Development

The following are needed for development

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

To deploy `conda-store` run the following command

```shell
docker-compose up --build
```

The following resources will be available:
  - conda-store web server running at http://localhost:5000
  - minio s3 running at http://localhost:9000 with username `admin` and password `password`
  - postgres running at localhost:5432 with username `admin` and password `password` database `conda-store`
  - jupyterhub running at http://localhost:8000 with any username and password `test`

On a fast machine this deployment should only take 10 or so seconds
assuming the docker images have been partially built before. If you
are making and changes to conda-store-server and would like to see
those changes in the deployment. Run.

```shell
docker-compose down  # not always necessary
docker-compose up --build
```

## Documentation

The following are needed for development

 - [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/)

To build the documentation install the development environment via
conda.

```shell
conda env create -f conda-store-server/environment-dev.yaml
conda activate conda-store-server-dev
```

Then go in the documentation directory `docs` and build the
documentation.

```shell
cd docs
sphinx-build -b html . _build
```

Then open the documentation via your favorite web browser.

```shell
firefox _build/index.html
```

The documentation has been primarily written in markdown as to make it
easier to contribute to the documentation.

## REST API

### Status

 - `GET /api/v1/` :: get status of conda-store

### Namespace

 - `GET /api/v1/namespace/?page=<int>&size=<int>&sort_by=<str>&order=<str>` :: list namespaces
   - allowed `sort_by` values: `name` for the name of the namespace

### Environments

 - `GET /api/v1/environment/?search=<str>&page=<int>&size=<int>&sort_by=<str>&order=<str>` :: list environments
   - allowed `sort_by` values : `namespace` for namespace name, `name` for environment name

 - `GET /api/v1/environment/<namespace>/<name>/` :: get environment

 - `PUT /api/v1/environment/<namespace>/<name>/` :: update environment to given build id

 - `DELETE /api/v1/environment/<namespace>/<name>/` :: delete the environment along with all artifacts and builds

### Specifications

 - `POST /api/v1/environment/` :: create given environment

### Builds

 - `GET /api/v1/build/?page=<int>&size=<int>&sort_by=<str>&order=<str>` :: list builds
   - allowed `sort_by` values : `id` to sort by build id

 - `GET /api/v1/build/<build_id>/` :: get build

 - `PUT /api/v1/build/<build_id>/` :: trigger new build of given build specification

 - `DELETE /api/v1/build/<build_id>/` :: delete given build along with all artifacts that are not in `c.CondaStore.build_artifacts_kept_on_deletion`

 - `GET /api/v1/build/<build_id>/logs/` :: get build logs

 - `GET /api/v1/build/<build_id>/packages/?page=<int>&size=<int>&sort_by=<str>&order=<str>` :: list packages within build
   - allowed `sort_by` values : `channel` to sort by channel name, `name` to sort by package name

### Conda Channels

 - `GET /api/v1/channel/?page=<int>&size=<int>` :: list channels

### Conda Packages

 - `GET /api/v1/package/?search=<str>&build=<str>&page=<int>&size=<int>?sort_by=<str>?order=<str>&distinct_on=<str>` :: list packages
   - allowed `sort_by` values : `channel` to sort by channel name, `name` to sort by package name
   - allowed `distinct_on` values : `channel` to be distinct on channel name, `name` to be distinct on package name, `version` to be distinct on version.
   - `build` string to search within `build` for example strings include
     `py27_0` etc which can be useful for filtering specific versions of
     packages.

### REST API Query Format

For several paginated results the following query parameters are accepted.

 - `page` page numbers indexing start at 1
 - `size` the number of results to return in each page. The max size
   is determined by the traitlets parameter
   `c.CondaStoreServer.max_page_size` with default of 100.
 - `sort_by` (can be multiple order_by(s)) indicating a multi-column
   ordering. Each route has a list of allowed sorting keys:
   e.g. `namespace`, `name`, `channel`. All paginated routes support
   this and have a default specific to the given resource.
 - `distinct_on` (can be multiple distinct ons) indicating a
   multi-column distinct on. Each route has a list of allowed distinct
   keys.
 - `order` is either `desc` descending or `asc` ascending with a
   default of `asc`. Only one order parameter is accepted.

If a query requests a page that does not exist a data response of an
empty list is returned.

### REST API Response Format

Several Standard Error Codes are returned
 - 200 :: response was processed normally
 - 400 :: indicates a bad request that is invalid
 - 401 :: indicates that request was unauthenticated indicates that authentication is required
 - 403 :: indicates that request was not authorized to access resource
 - 404 :: indicates that request for resource was not found
 - 500 :: hopefully you don't see this error. If you do this is a bug

Response Format for Errors.

```json
{
   "status": "error",
   "message": "<reason for error>"
}
```

Response Format for Success. Several of these response parts are
optional. A route may optionally return a `message` that may be
displayed to the user.

If the route is paginated it will return a `page`, `size`, and `count`
key.

```json
{
   "status": "ok",
   "message": "<message>",
   "data": [...],
   "page": <int>,
   "size": <int>,
   "count": <int>,
}
```

If the route is not paginated the `page`, `size`, and `count` keys will
not be returned.

```json
{
   "status": "ok",
   "message": "<message>",
   "data": {...},
}
```

## Architecture

Conda Store was designed with the idea of scalable enterprise
management of reproducible conda environments.

![Conda Store architecture diagram](_static/images/conda-store-architecture-simple.png)

### Configuration

[Traitlets](https://traitlets.readthedocs.io/en/stable/) is used for
all configuration of conda-store. In the beginning command line
options were used but eventually we learned that there were too many
options for the user. Traitlets provides a python configuration file
that you can use to configure values of the applications. It is used
for both the server and worker. See
[tests/assets/conda_store_config.py](https://github.com/Quansight/conda-store/blob/main/tests/assets/conda_store_config.py)
for a full example.

### Workers and Server

Conda Store can be broken into two components. The worker(s) which
have the following responsibilities:
 - build Conda environments from Conda `environment.yaml` specifications
 - build Conda pack archives
 - build Conda docker images
 - remove Conda builds
 - modify symlinks to point current environment to given build

All of the worker logic is in `conda_store_server/build.py` and
`conda_store_server/worker/*.py`. Celery is used for managing tasks so
you will see the celery tasks defined in
`conda_store_server/worker/tasks.py` which in turn usually call built
in `CondaStore` functions in `conda_store_server/app.py` or
`conda_store_server/build.py`.

The web server has several responsibilities:
 - serve a ui for interacting with conda environments
 - serve a rest api for managing conda environments
 - serve a programmatic docker registry for interesting docker-conda abilities

The web server is based on
[Flask](https://flask.palletsprojects.com/en/2.0.x/). Flask was chosen
due to it being battle tested and that conda-store is not doing any
special things with the web server. The flask app is defined in
`conda_store_server.server.app`. There are several components to the server:
 - ui :: `conda_store_server/server/views/ui.py`
 - api :: `conda_store_server/server/views/api.py`
 - registry :: `conda_store_server/server/views/registry.py`

Both the worker and server need a connection to the database and s3
server. The s3 server is used to store all build artifacts e.g. logs,
docker layers, and the conda pack tarball. The postgresql database is
used for managing the tasks for the conda-store workers along with
powering the conda-store web server ui, api, and docker
registry. Optionally a broker can be used for tasks that is not a
database e.g. a message queue similar to rabbitmq, kafka, etc. It is
not believed that a full blown message queue will help conda-store with
performance.

### Terminology

![Conda Store terminology](_static/images/conda-store-terminology.png)

`conda_environment = f(open("environment.yaml"), datatime.utcnow())`

 - namespace :: a way of providing scopes between environments. This
   prevents joe's environment named `data-science` from colliding from
   Alice's environment name `data-science`.
 - environment :: a pointer to a current build of a given specification
 - specification :: a [Conda environment.yaml file](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually)
 - build :: a attempt of `conda env install -f environment.yaml` at a
   given point in time

In order to understand why we have the complicated terminology for an
environment it helps to understand how conda builds a given
environment.

### Reproducibility of Conda

```yaml
name: example
channels:
  - defaults
  - conda-forge
dependencies:
  - python >=3.7
```

Suppose we have the given `environment.yaml` file. How does conda
perform a build?

1. Conda downloads `channeldata.json` from each of the channels which
   list the available architectures.

2. Conda then downloads `repodata.json` for each of the architectures
   it is interested in (specifically your compute architecture along
   with noarch). The `repodata.json` has fields like package name,
   version, and dependencies.

You may notice that the channels listed above do not have urls. This
is because in general you can add
`https://conda.anaconda.org/<channel-name>` to a non-url channel.

3. Conda then performs a solve to determine the exact version/sha of each
   package that it will download

4. The specific packages are downloaded

5. Conda does magic to fix the path prefixes of the install

There are two spots that introduce issues to reproducibility. The
first issue is tracking when an `environment.yaml` file has
changes. This can be easily tracked by taking a sha256 of the file
. This is what conda-store does but sorts the dependencies to make
sure it has a way of not triggering a rebuild if the order of two
packages changes in the dependencies list. In step (2) `repodata.json`
is updated regularly. When conda solves for a user's environment it
tries to use the latest version of each package. Since `repodata.json`
could be updated the next minute the same solve for the same
`environment.yaml` file can result in different solves.

### Authentication Model

Authentication was modeled after JupyterHub for implementation. There
is a base class `conda_store_server.server.auth.Authenticaiton`. If
you are extending and using a form of OAuth2 use the
`conda_store_server.server.auth.GenericOAuthAuthentication`. Similar
to JupyterHub all configuration is modified via
[Traitlets](https://traitlets.readthedocs.io/en/stable/). Below shows
an example of setting us OAuth2 via jupyterhub for conda-store.

```python
c.CondaStoreServer.authentication_class = JupyterHubOAuthAuthentication
c.JupyterHubOAuthAuthentication.jupyterhub_url = "http://jupyterhub:8000"
c.JupyterHubOAuthAuthentication.client_id = "service-this-is-a-jupyterhub-client"
c.JupyterHubOAuthAuthentication.client_secret = "this-is-a-jupyterhub-secret"
```

Once a user is authenticated a cookie or token [jwt](https://jwt.io/)
is created to store the user credentials to ensure that conda-store is
as stateless as possible. At this current point in time conda-store
does not differentiate between a service and user. Similar to
jupyterhub `conda_store_server.server.auth.Authentication` has an
`authenticate` method. This method is the primary way to customize
authentication. It is responsible for checking that the user
credentials to login are correct as well as returning a dictionary
following the schema
`conda_store_server.schema.AuthenticationToken`. This stores a
`primary_namespace` for a given authenticated service or user. In
addition a dictionary of `<namespace>/<name>` map to a set of
roles. See the Authorization model to better understand the key to set
of roles meaning.

### Authorization Model

Conda-Store implements role based authorization to supports a flexible
authorization model. A user or service is either authenticated or
not. There are a set of default permissions assigned to authenticated
and unauthenticated users via Traitlets. These can all be modified in
the configuration. These roles are inherited based on the
authentication status of the user or service. To support hierarchies
we map a key such as `default/*` to a set of roles. The `/` separates
the `<namespace>` from the `<name>` and `*` signifies match any (zero
or more) characters. This was chosen to support rich authorization
models while also being easy and efficient to implement in a
database. `*` are supported anywhere in the `key` such as
`*n*viron*/n*me`. Configure the following traitlets to modify the
inherited permissions for authenticated and unauthenticated users.

```python
c.RBACAuthorizationBackend.unauthenticated_role_bindings = {
    "default/*": {"viewer"},
}

c.RBACAuthorizationBackend.authenticated_role_bindings = {
    "default/*": {"viewer"},
    "filesystem/*": {"viewer"},
}
```

Once we have collected the role mappings that a given user has we then
map `roles` to sets of permissions. Currently there are only a few
permissions but Conda-Store is capable of adapting in the future.

```python
class Permissions(enum.Enum):
    ENVIRONMENT_CREATE = "build::create"
    ENVIRONMENT_READ = "build::read"
    ENVIRONMENT_UPDATE = "build::update"
    ENVIRONMENT_DELETE = "build::delete"
```

The role name to permission is configured via a single traitlet shown
below.

```python
c.RBACAuthorizationBackend.role_mappings = {
    "viewer": {
        Permissions.ENVIRONMENT_READ
    },
    "developer": {
        Permissions.ENVIRONMENT_CREATE,
        Permissions.ENVIRONMENT_READ,
        Permissions.ENVIRONMENT_UPDATE,
    },
    "admin": {
        Permissions.ENVIRONMENT_CREATE,
        Permissions.ENVIRONMENT_READ,
        Permissions.ENVIRONMENT_UPDATE,
        Permissions.ENVIRONMENT_DELETE,
    },
}
```

Lets go through a few examples to make this more concrete and assume
the default configuration of conda-store.

> Suppose we have an unauthenticated user trying to view the
> environment `quansight/datascience`.

First since the user is unauthenticated they inherit the default role
mappings.

```
{
    "default/*": {"viewer"},
}
```

We go through each role mapping and try to match the expression
`default/*` to `quansight/datascience`. In this case this does not
match and thus for the given environment `quansight/datascience` the
unauthenticated user has no roles. This user does not have any roles
for the given environment but if they did we would iterate through all
roles and combine the permissions. The next example will show this. So
for this example the user has permissions `{}` in the given
environment. The action of viewing a given environment requires
`build::read` which the unauthenticated user does not have.

> Suppose we have an unauthenticated user trying to delete the
> environment `default/web-dev`.

First since the user is unauthenticated they inherit the default role
mappings.

```
{
    "default/*": {"viewer"},
}
```

We go through each role mapping and try to match the expression
`default/*` to `default/web-dev`. In this case this does match and
thus for the given environment `default/web-dev` the unauthenticated
user has role(s) `{viewer}`. For each role we map the role to
permissions. We get `{build::read}`. The delete environment action
requires `build::delete` permissions and thus the user is not
authenticated to perform the action.

> Suppose we have an authenticated user trying to delete the
> environment `default/web-dev`.

First since the user is authenticated they inherit the default role
mappings.

```python
{
    "default/*": {"viewer"},
    "filesystem/*": {"viewer"},
}
```

In addition to the default role bindings the user was authenticated
via the `authenticate` method and has the following bindings added.

```python
{
    "*/*": {"admin"}
}
```

In total the user has the following bindings.

```python
{
    "default/*": {"viewer"},
    "filesystem/*": {"viewer"},
    "*/*": {"admin"},
}
```

Following the same process as before we iterate through each binding
if it matches we add the given role(s). For this example we get
`{viewer, admin}`. Next we iterate through each role and map it to
permissions and we get the following `{build::create, build::read,
build::update, build::delete}`. The delete environment action requires
`build::delete` permissions which the user has thus the action is
permitted.

repository: aovasylenko/conda-store

repo_name: aovasylenko/conda-store


text:
# Rove

[![Go Report Card](https://goreportcard.com/badge/github.com/josephspurrier/rove)](https://goreportcard.com/report/github.com/josephspurrier/rove)
[![Build Status](https://travis-ci.org/josephspurrier/rove.svg)](https://travis-ci.org/josephspurrier/rove)
[![Coverage Status](https://coveralls.io/repos/github/josephspurrier/rove/badge.svg?branch=master&timestamp=20190115-01)](https://coveralls.io/github/josephspurrier/rove?branch=master)
[![GoDoc](https://godoc.org/github.com/josephspurrier/rove?status.svg)](https://godoc.org/github.com/josephspurrier/rove)

## MySQL Database Migration Tool Inspired by Liquibase

The primary motivation behind this tool is to provide a simple and quick Go (instead of Java) based database migration tool that allows loading migrations from anywhere, including from inside your code so you can distribute single binary applications. You write the migration and rollback SQL, Rove will apply it for you properly.

### How do migrations work?

Database migrations are necessary when you make changes to your applications. You may need a new table or a new column so you have to write the SQL commands to make the changes.  Do you run all of them again and then the new ones after? Or is there an easy way to track which queries have been run so you only run new ones? What if you have to rollback your database because of a feature that was released too early and is causing problem? How do you manage those queries? You can definitely write your own code to manage the migration process, but Rove makes the process much easier for you. You also don't have to convert your SQL code to a another format like JSON or XML, you can just add a few comments around it and Rove will handle the rest.

### How does Rove work?

You'll need to write your changes queries and rollback queries in migration files. These are plain SQL files that can be imported directly into MySQL. Rove just uses comments to help break them into smaller manageable pieces. When you run tell Rove to apply your changes, a table called `rovechangelog` is created in the database to track which changesets have been applied and metadata about them. The tool will ensure no changes have been made to the existing changesets that are already in the database. Changeset checksums are then compared against the changelog table checksums. Any new changesets that are not in the changelog are applied to the database and then a new record is inserted into the changelog for each changeset. Rove supports labeling changesets with a `tag` as well as rolling back to specific tags.

### Rove vs Liquibase

Rove and Liquibase use different changelog tables. Rove includes MySQL out of the box, but it supports adding your own adapters to work with any type of data storage. The Rove changesets can use a very similar plain SQL (no XML or JSON) file format for simplicity and portability. For the most teams, you'll be able use your existing SQL migration files with Rove without making any changes.

To assist with switching from Liquibase to Rove, you can use the CLI tool with the `rove convert` argument to convert a Liquibase `DATABASECHANGELOG` table to a Rove `rovechangelog` table. If you don't run the `rove convert` command first on a database that was originally managed by Liquibase, Rove will try to rerun the same migrations over again if you use the same migration files. The tools use different changelog table names, table schemas, and use different methods for calculating their checksums.

## Dependencies

These are the dependencies required to build Rove.

```
gopkg.in/alecthomas/kingpin.v2
github.com/go-sql-driver/mysql
github.com/jmoiron/sqlx
github.com/stretchr/testify/assert
```

## Quick Start with Docker Compose

You can build a docker image from this repository and set it up along with a MySQL container using Docker Compose.

```bash
# Create a docker image.
docker build -t rove:latest .

# Launch MySQL and the Rove tool with Docker Compose.
docker-compose up

# The database should now have the sample migrations applied.

# Shutdown the containers.
docker-compose down
```

## Testing Migrations in MySQL Docker

Use the following commands to start a MySQL container with Docker:

```bash
# Start MySQL without a password.
docker run -d --name=mysql57 -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:5.7
# or start MySQL with a password.
docker run -d --name=mysql57 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=somepassword mysql:5.7

# Create the database via docker exec.
docker exec mysql57 sh -c 'exec mysql -uroot -e "CREATE DATABASE IF NOT EXISTS webapi DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;"'
# Or create the database manually.
CREATE DATABASE webapi DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;

# Build the CLI tool.
go install

# Apply the database migrations without a password.
rove all testdata/success.sql --hostname=<IP_ADDRESS> --port=3306 --username=root --name=webapi
# or apply the database migrations with a password.
rove all testdata/success.sql --hostname=<IP_ADDRESS> --port=3306 --username=root --password=somepassword --name=webapi
```

## Rove Usage

The Rove package can be used as a standalone CLI application or you can import the package into your own code.

### Rove via CLI

The Rove CLI app uses [Kingpin](https://github.com/alecthomas/kingpin) to handle command-line parsing. To view the info on any of the commands, you can use `--help` as an argument.

Here are the commands available:

```
usage: rove [<flags>] <command> [<args> ...]

Performs database migration tasks.

Flags:
  --help                         Show context-sensitive help (also try --help-long and --help-man).
  --checksum-mode=CHECKSUM-MODE  Set how to handle checksums that don't match [error (default), ignore, update].
  --hostname=HOSTNAME            Database hostname or IP [string].
  --port=PORT                    Database port [int].
  --username=USERNAME            Database username [string].
  --password=PASSWORD            Database password [string].
  --name=NAME                    Database name [string].
  --parameter=PARAMETER          Database parameters [string].
  --envprefix=ENVPREFIX          Prefix for environment variables.

Commands:
  help [<command>...]
    Show help.

  all <file>
    Apply all changesets to the database.

  up <count> <file>
    Apply a specific number of changesets to the database.

  reset <file>
    Apply all rollbacks to the database.

  down <count> <file>
    Apply a specific number of rollbacks to the database.

  tag <name> <file>
    Apply a tag to the latest changeset in the database.

  rollback <name> <file>
    Run all rollbacks until the specified tag on the database.

  convert <file>
    Convert a Liquibase changelog table to a Rove changelog table.

  status
    Output the list of changesets already applied to the database.
```

#### Database Connection Variables

You can either use the database flags or you can set the environment variables below to connect to the database. You can also prefix the environment variables using the `--envprefix` flag.

```
DB_USERNAME - database username
DB_PASSWORD - database password
DB_HOSTNAME - IP or hostname of the database
DB_PORT - port of the database
DB_NAME - name of the database
DB_PARAMETER - parameters to append to the database connection string
```

A full list of MySQL parameters can be found [here](https://github.com/go-sql-driver/mysql#parameters).

#### Example Commands and Output

These examples will show how to interact with Rove and what the output will look like.

```bash
# Set the environment variables to connect to the database.
export DB_USERNAME=root
export DB_PASSWORD=password
export DB_HOSTNAME=<IP_ADDRESS>
export DB_PORT=3306
export DB_NAME=webapi
export DB_PARAMETER="collation=utf8mb4_unicode_ci&parseTime=true"

# Apply all of the changes from the SQL file to the database.
rove all testdata/changeset.sql
# Output:
# Changesets applied (request: 0):
# Applied: 1) josephspurrier:1 (success.sql) b7a8d1c3ea1cc2dc28a1de0e23628250 [tag='']
# Applied: 2) josephspurrier:2 (success.sql) e3065c58bff00322c73eab057427f557 [tag='']
# Applied: 3) josephspurrier:3 (success.sql) 57cc0b1c45cb72032bcaed07483d243d [tag='']

# Try to apply all the changes again.
rove all testdata/changeset.sql
# Output:
# Changesets applied (request: 0):
# Already applied: 1) josephspurrier:1 (success.sql) b7a8d1c3ea1cc2dc28a1de0e23628250 [tag='']
# Already applied: 2) josephspurrier:2 (success.sql) e3065c58bff00322c73eab057427f557 [tag='']
# Already applied: 3) josephspurrier:3 (success.sql) 57cc0b1c45cb72032bcaed07483d243d [tag='']

# Rollback all of the changes to the database.
rove reset testdata/changeset.sql
# Output:
# Changesets rollback (request: 0):
# Applied: 3) josephspurrier:3 (success.sql) 57cc0b1c45cb72032bcaed07483d243d [tag='']
# Applied: 2) josephspurrier:2 (success.sql) e3065c58bff00322c73eab057427f557 [tag='']
# Applied: 1) josephspurrier:1 (success.sql) b7a8d1c3ea1cc2dc28a1de0e23628250 [tag='']

# Apply only 1 new change to the database.
rove up 1 testdata/success.sql
# Output:
# Changesets applied (request: 1):
# Applied: 1) josephspurrier:1 (success.sql) b7a8d1c3ea1cc2dc28a1de0e23628250 [tag='']

# Apply 1 more change to the database.
rove up 1 testdata/changeset.sql
# Output:
# Changesets applied (request: 1):
# Already applied: 1) josephspurrier:1 (success.sql) b7a8d1c3ea1cc2dc28a1de0e23628250 [tag='']
# Applied: 2) josephspurrier:2 (success.sql) e3065c58bff00322c73eab057427f557 [tag='']

# Rollback only 1 change to the database.
rove down 1 testdata/changeset.sql
# Output:
# Changesets rollback (request: 1):
# Applied: 2) josephspurrier:2 (success.sql) e3065c58bff00322c73eab057427f557 [tag='']

# Show a list of migrations already applied to the database.
rove status
# Output:
# Changesets applied:
# 1) josephspurrier:1 (success.sql) b7a8d1c3ea1cc2dc28a1de0e23628250 [tag='']
```

### Rove via Package Import

Below is an example of how to include Rove in your own Go applications.

```go
var changesets = `
--changeset josephspurrier:1
CREATE TABLE user_status (
    id TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT,

    status VARCHAR(25) NOT NULL,

    created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    deleted_at TIMESTAMP NULL DEFAULT NULL,

    PRIMARY KEY (id)
);
--rollback DROP TABLE user_status;

--changeset josephspurrier:2
INSERT INTO user_status (id, status, created_at, updated_at, deleted) VALUES
(1, 'active',   CURRENT_TIMESTAMP,  CURRENT_TIMESTAMP,  0),
(2, 'inactive', CURRENT_TIMESTAMP,  CURRENT_TIMESTAMP,  0);
--rollback TRUNCATE TABLE user_status;`

// Create a new MySQL database object.
db, err := mysql.New(&mysql.Connection{
  Hostname:  "<IP_ADDRESS>",
  Username:  "root",
  Password:  "password",
  Name:      "main",
  Port:      3306,
  Parameter: "collation=utf8mb4_unicode_ci&parseTime=true",
})
if err != nil {
  log.Fatalln(err)
}

// Perform all migrations against the database.
r := rove.NewChangesetMigration(db, changesets)
r.Verbose = true
err = r.Migrate(0)
```

## Adapters

Rove is designed to be extensible via adapters. There is one adapter included in the package:

* mysql

You may also create your own adapters - see the `interface.go` file for interfaces your adapters must satisfy.

### Best Practices

When creating an adapter, will need:

- Struct that satisfies the `rove.Changelog` interface.
- Struct that satisfies the `rove.Transaction` interface.
- Table or data structure to use as the `changelog` to persistently track the changes made by the Rove.

You should store the following fields (at a minimum) in your changelog. This will ensure your adapter can utilize all of the features of Rove.

- id
- author
- filename
- dateexecuted
- orderexecuted
- checksum
- description
- tag
- version

### Example Changelog

Your changelog should contain the same fields as this table:

| id  | author         | filename    | dateexecuted        | orderexecuted | checksum  | description                   | tag  | version |
| --- | -------------- | ----------- | ------------------- | ------------- | --------- | ----------------------------- | ---- | ------- |
| 1   | josephspurrier | success.sql | 2019-01-12 16:04:16 | 1             | f0685b... | Create the user_status table. | NULL | 1.0     |
| 2   | josephspurrier | success.sql | 2019-01-12 16:04:16 | 2             | 3f81b0... |                               | NULL | 1.0     |
| 3   | josephspurrier | success.sql | 2019-01-12 16:04:16 | 3             | 57cc0b... |                               | NULL | 1.0     |

## Migration File Specifications

There are a few components of a changeset:

- Header: must be prefixed by "--changeset " and must follow this format: `author:id` (single line, required)
- Body: valid sql text (multi-line, required)
- Description: must be prefixed by "--description " (multi-line, optional)
- Rollback: must be prefixed "--rollback "  (multi-line, optional)
- Include: must be prefixed by "--include " and must follow this format: `relativefilename.sql` (single line, optional)
- Comments: any other line that starts with "--" (multi-line, optional)

Blank lines are ignored by Rove. The prefixes above are strict so you cannot change the case or add spacing. For instance, you cannot add a space after the dashes: `-- changeset`.

Example migration file:

```sql
--changeset josephspurrier:1
--description Create the user status table.
--description Set deleted_at as a timestamp.
CREATE TABLE user_status (
    id TINYINT(1) UNSIGNED NOT NULL AUTO_INCREMENT,

    status VARCHAR(25) NOT NULL,

    created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    deleted_at TIMESTAMP NULL DEFAULT NULL,

    PRIMARY KEY (id)
);
--rollback DROP TABLE user_status;

--include anotherfile.sql

--changeset josephspurrier:2
INSERT INTO user_status (id, status, created_at, updated_at, deleted) VALUES
(1, 'active',   CURRENT_TIMESTAMP,  CURRENT_TIMESTAMP,  0),
(2, 'inactive', CURRENT_TIMESTAMP,  CURRENT_TIMESTAMP,  0);
--rollback TRUNCATE TABLE user_status;
```

### Header

The header is the unique identifier for the changeset. A changeset is unique is all of these fields don't match another changeset: id, author, and filename. You can have a changeset with the same id and author in two different files.

### Body

The body must be valid single or multi-line SQL queries. You can separate queries by semi-colons, but you must also pass in this parameter to the database connection: `multiStatements=true`. The checksum is based on an MD5 of this value. Any changes once the query has been applied to a database will throw an error message.

### Description

The description provides information about the changeset. It will be added as a value in the changelog table.

### Rollback

The rollback should be SQL which reverts the changes made by the changeset.

### Include

The include allows you to reference other changeset files to load. The filename should be a relative path.

### Comments

Any comments at the beginning of the lines are ignored. They do not count towards the checksum.

repository: josephspurrier/rove

repo_name: josephspurrier/rove


text:
---
layout: post
title: Swift Tips
comments: true
---

## Lazy Initialization

Lazy Initialization is a technique for delaying the creation of an object or some other expensive process until it's needed.