text:
![generator-angular-2-library](https://cloud.githubusercontent.com/assets/1859381/15875067/91043b32-2d06-11e6-8ab5-de4dfcd0bfa8.jpg)
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]

[Yeoman](http://yeoman.io) generator to create a standalone [Angular 2](https://angular.io/) library in seconds.

If you want to create an Angular 2 library with directives, services and/or pipes, then this generator is just what you need.

The generator:

- creates and configures `package.json` for your library
- creates and configures `tsconfig.json` for your library
- creates and configures `tslint.json` for your library
- creates and configures `typings.json` for your library
- creates and configures `.gitignore`, `.npmignore` and `.travis.yml`
- creates the main library file
- creates a sample directive, component, service and pipe
- creates boilerplate code to conveniently export `PROVIDERS`, `DIRECTIVES` and `PIPES` properties
- creates a default export for future compatibility with angular cli, see this [discussion for more](https://github.com/angular/angular-cli/issues/96)
- configures [tslint](https://palantir.github.io/tslint/) for you with [codelyzer](https://github.com/mgechev/codelyzer) support

## Quick start

![generator-angular2-library-demo](https://cloud.githubusercontent.com/assets/1859381/16332792/45936764-39f8-11e6-884b-c7095bafc59b.gif)

First, install [Yeoman](http://yeoman.io) and generator-angular2-library using [npm](https://www.npmjs.com/) (assuming you already have [node.js](https://nodejs.org/) pre-installed).

```bash
$ npm install -g yo
$ npm install -g generator-angular2-library
```

make a new directory and `cd` into it:

```bash
$ mkdir angular2-library-name
$ cd angular2-library-name
```

and generate your new library:

```bash
$ yo angular2-library
```

The generator will prompt you for:

```bash
? Your full name: Jurgen Van de Moere
? Your email address<EMAIL_ADDRESS>? Your library name (kebab case): angular2-library-name
? Git repository url: https://github.com/jvandemo/angular2-library-name
```

and create the following files for you:

```bash
.
├── .gitignore
├── .npmignore
├── .travis.yml
├── package.json
├── README.md
├── src
│   ├── directives
│   │   ├── sample.component.ts
│   │   └── sample.directive.ts
│   ├── directives.ts
│   ├── index.ts
│   ├── pipes
│   │   └── sample.pipe.ts
│   ├── pipes.ts
│   ├── services
│   │   └── sample.service.ts
│   └── services.ts
├── tsconfig.json
├── tslint.json
└── typings.json
```

You can then add or edit `*.ts` files in the `src/` directory and run:

```bash
$ npm run tsc
```

to automatically create all `*.js`, `*.js.map` and `*.d.ts` files in the `dist/` directory.

## Tslint

Everything comes pre-configured with tslint and codelyzer support. To lint your code:

```bash
$ npm run lint
```

## `PROVIDERS`, `DIRECTIVES` and `PIPES`

The generator automatically prepares boilerplate code to export convenient bundle properties.

As a library author you are free to choose whether you want to do this or not (see [this discussion](https://github.com/angular/angular/issues/5503)).

The benefit is that consumers of your library can easily import bundles of services, directives and pipes:

```javascript
import { Component } from 'angular2/core';
import { PROVIDERS, DIRECTIVES, PIPES } from 'angular2-library-name/angular2-library-name';

@Component({
  selector: 'app'
  providers: [PROVIDERS]
  directives: [DIRECTIVES],
  pipes: [PIPES]
})
export class AppComponent{
  // ...
}

```

The Angular team uses a similar approach with `CORE_DIRECTIVES`, `FORM_DIRECTIVES` and `ROUTER_PROVIDERS`.

## To do

- Create build process for building library that automatically registers with SystemJS so it can be hosted statically and imported using `<script>` element
- Create process for running unit tests

## Issues

Please report bugs and issues [here](https://github.com/jvandemo/generator-angular2-library/issues).

## Development

To run the generator unit tests:

```bash
$ npm run test
```

## License

MIT © [Jurgen Van de Moere](http://www.jvandemo.com)

## Change log

### v2.2.0

- Updated dependencies in package.json to Angular 2 final

### v2.1.0

- Updated templates to Angular 2.0.0 RC3 syntax

### v2.0.0

- Updated with file structure using `src` and `dist` directory

### v1.1.1

- Updated templates to Angular 2.0.0 RC1 syntax

### v1.1.0

- Added codelyzer support
- Added tslint support
- Added typings support

### v1.0.0

- BREAKING CHANGE: Updated to support [Angular 2.0.0-rc.1](https://github.com/angular/angular/blob/master/CHANGELOG.md#200-rc1-2016-05-03)

### v0.6.0

- Updated dependency versions

### v0.5.0

- Added `browser.d.ts` to files in `tsconfig.json` instead of using tripleslash (see #9)

### v0.4.0

- Added reference to Angular typings

### v0.3.1

- Removed explicit RxJS dependency

### v0.3.0

- Updated to Angular 2 beta

### v0.2.0

- Added documentation
- Added support for `PROVIDERS`, `DIRECTIVES` and `PIPES`

### v0.1.0

- Added documentation
- Added boilerplate scaffolding
- Initial version

[npm-image]: https://badge.fury.io/js/generator-angular2-library.svg
[npm-url]: https://npmjs.org/package/generator-angular2-library
[travis-image]: https://travis-ci.org/jvandemo/generator-angular2-library.svg?branch=master
[travis-url]: https://travis-ci.org/jvandemo/generator-angular2-library
[daviddm-image]: https://david-dm.org/jvandemo/generator-angular2-library.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/jvandemo/generator-angular2-library
[coveralls-image]: https://coveralls.io/repos/jvandemo/generator-angular2-library/badge.svg
[coveralls-url]: https://coveralls.io/r/jvandemo/generator-angular2-library


text:
---
layout: post
title: Hacknews2020-09-28新闻
category: Hacknews
tags: hacknews
keywords: hacknews
coverage: hacknews-banner.jpg
---

Hacker News 是一家关于计算机黑客和创业公司的社会化新闻网站，由保罗·格雷厄姆的创业孵化器 Y Combinator 创建。
与其它社会化新闻网站不同的是 Hacker News 没有踩或反对一条提交新闻的选项（不过评论还是可以被有足够 Karma 的用户投反对票）；只可以赞或是完全不投票。简而言之，Hacker News 允许提交任何可以被理解为“任何满足人们求知欲”的新闻。

## HackNews Hack新闻

- [Ask HN: How to learn sales?](item?id=24601579)
- `问HN：如何学习销售？`
- [foo@bar.com](https://www.bar.com/)
-<EMAIL_ADDRESS>- [Mastering PostgreSQL Administration pdf](https://momjian.us/main/writings/pgsql/administration.pdf)
- `掌握PostgreSQL管理pdf`
- [PilBox – Building Android Apps in PicoLisp (2019)](https://picolisp.com/wiki/?PilBox)
- `PilBox –在PicoLisp中构建Android应用程序（2019）`
- [Adequate Vitamin D Levels Cuts Risk of Dying from Covid-19 in Half, Study Finds](https://www.forbes.com/sites/marlamilling/2020/09/26/adequate-vitamin-d-levels-cuts-risk-of-dying-from-covid-19-in-half-study-finds/#39db917b5285)
- `研究发现，足够的维生素D水平可将Covid-19的死亡风险降低一半`
- [Simplicity and Ecosystems](https://orib.dev/simplicity.html)
- `简单性与生态系统`
- [Google's Sundar Pichai says future of office is employee 'on-sites'](https://www.businessinsider.com/google-office-future-employee-on-sites-sundar-pichai-2020-9)
- `谷歌的Sundar Pichai说，办公室的未来是员工的“现场”`
- [Picat 3.0 released (logic-based multi-paradigm programming language)](http://picat-lang.org/updates.txt)
- `Picat 3.0发布（基于逻辑的多范式编程语言）`
- [Apple’s use of Swift and SwiftUI in iOS 14](https://blog.timac.org/2020/0927-state-of-swift-ios14/)
- `苹果在iOS 14中使用Swift和SwiftUI`
- [Law firms pay Supreme Court clerks $400k bonuses – what are they buying?](https://www.nytimes.com/2020/09/21/us/politics/supreme-court-clerk-bonuses.html)
- `律师事务所向最高法院书记官支付40万美元奖金。`
- [Automatic layout algorithms compute layouts for diagrams](https://rtsys.informatik.uni-kiel.de/elklive/)
- `自动布局算法计算图的布局`
- [Hercule Poirot turns 100: The strange case of the Belgian detective](https://www.economist.com/books-and-arts/2020/09/26/hercule-poirot-turns-100)
- `赫尔克里·波洛（Hercule Poirot）诞辰100周年：比利时侦探的奇怪案例`
- [Before you ship a “security mitigation”](http://addxorrol.blogspot.com/2020/03/before-you-ship-security-mitigation.html)
- `运送“安全缓解措施”之前`
- [Nuclear power: Are we too anxious about the risks of radiation?](https://www.bbc.com/news/science-environment-54211450)
- `核电：我们是否过于担心辐射的风险？`
- [Hotel guest in Thailand jailed for defamation after posting bad online reviews](https://loyaltylobby.com/2020/09/27/american-hotel-guest-in-thailand-arrested-jailed-for-defamation-after-posting-bad-online-reviews/?omhide=true)
- `发表糟糕的在线评论后，泰国的酒店客人因诽谤而被判入狱`
- [VkFFT – Vulkan Fast Fourier Transform Library](https://github.com/DTolm/VkFFT)
- `VkFFT – Vulkan快速傅立叶变换库`
- [Won’t Subscribe](https://www.tbray.org/ongoing/When/202x/2020/09/25/Subscription-Overload)
- `不会订阅`
- [Sectorforth: A 16-bit x86 Forth that fits in a boot sector](https://github.com/cesarblum/sectorforth)
- `Sectorforth：适合引导扇区的16位x86 Forth`
- [New Google ChromeOS updates cause 100% CPU usage, heating issues](https://www.bleepingcomputer.com/news/google/new-google-chromeos-updates-cause-100-percent-cpu-usage-heating-issues/)
- `Google ChromeOS的新更新导致100％的CPU使用率，发热问题`
- [Universal Split Screen](https://universalsplitscreen.github.io/)
- `通用分屏`
- [Which colour scheme is better?](https://stitcher.io/blog/why-light-themes-are-better-according-to-science)
- `基于科学，浅色方案更好`
- [Hardcaml: An OCaml library for designing hardware](https://github.com/janestreet/hardcaml)
- `Hardcaml：用于设计硬件的OCaml库`
- [It used to be simpler to teach Unix](https://jpmens.net/2020/09/27/it-used-to-be-simpler/)
- `过去教Unix更简单`
- [Investigating TLS Blocking in India](https://ooni.org/post/2020-tls-blocking-india/)
- `在印度调查TLS阻止`
- [Fully documented source code for Elite on the BBC Micro](https://www.bbcelite.com/)
- `BBC Micro上Elite的完整记录的源代码`
- [Sum-of-Three-Cubes Problem Solved for ‘Stubborn’ Number 33 (2019)](https://www.quantamagazine.org/sum-of-three-cubes-problem-solved-for-stubborn-number-33-20190326/)
- `解决“顽固”数字33的三和数问题`
- [Coinbase is a mission focused company](https://blog.coinbase.com/coinbase-is-a-mission-focused-company-af882df8804)
- `Coinbase是一家专注于使命的公司`
- [British Museum to go more than skin deep with Scythian exhibition (2017)](https://www.theguardian.com/culture/2017/may/30/british-museum-skin-scythian-exhibition-tattoo-empire)
- `大英博物馆将举办Scythian展览（2017）`
- [United States vs. Dread Pirate Roberts (Silk Road) FBI Report (2013) pdf](https://krebsonsecurity.com/wp-content/uploads/2013/10/UlbrichtCriminalComplaint.pdf)
- `美国与恐怖海盗罗伯茨（丝绸之路）联邦调查局报告（2013）pdf`
- [Book of Revelation: On the power of the written word in the Middle Ages](https://www.laphamsquarterly.org/roundtable/book-revelation)
- `启示录：中世纪文字的力量`
- [Does Machine Translation Affect International Trade?](https://www.nber.org/papers/w24917)
- `机器翻译会影响国际贸易吗？`
- [Judge temporarily blocks U.S. ban on TikTok downloads from U.S. app stores](https://www.reuters.com/article/us-usa-tiktok-ban-judge/judge-temporarily-blocks-u-s-ban-on-tiktok-downloads-from-u-s-app-stores-idUSKBN26J00R)
- `法官暂时阻止美国禁止从美国应用商店下载TikTok`
- [Epoch Graphics Engine](https://6502disassembly.com/a2-epoch/engine.html)
- `时代图形引擎`
- [French fathers will now get 28 days of paternity leave](https://www.vogue.com/article/french-fathers-paternity-leave-doubled/)
- `法国父亲现在将获得双倍的陪产假`
- [OpenSSH 8.4](https://marc.info/?l=openssh-unix-dev&m=160121534105667&w=2)
- `OpenSSH 8.4`
- [The Almanack of Naval Ravikant](https://www.navalmanack.com/)
- `海军拉维坎特历书`
- [Facebook Gizmo](https://twitter.com/Foone/status/1310377930661351424)
- `“所以这是我不应该拥有的东西。”`
- [Reverse engineering a Hit Clip (2013)](https://ch00ftech.com/2013/12/31/reverse-engineering-a-hit-clip/)
- `逆向工程命中剪辑（2013）`
- [Modernize your Bash Scripts by adding GUI](https://medium.com/@shalithasuranga/how-to-modernize-your-bash-scripts-by-adding-gui-cba613a34cb7)
- `通过添加GUI现代化Bash脚本`
- [Today is LibreOffice 10th Anniversary](https://twitter.com/libreoffice/status/1310333845368180736)
- `今天是LibreOffice 10周年`
- [The long lost manual for the Zuse Z4 has been found](https://www.vice.com/en_us/article/v7gaaa/the-long-lost-manual-for-the-worlds-oldest-preserved-computer-has-been-found)
- `发现了世界上保存最久的计算机的长期遗失手册`
- [Neolithic Signs in China](https://en.wikipedia.org/wiki/Neolithic_signs_in_China)
- `中国的新石器时代标志`
- [The Polygons of Doom: PSX](https://fabiensanglard.net/doom_psx/)
- `毁灭的多边形：PSX`
- [Assange Trial Day 18](https://www.craigmurray.org.uk/archives/2020/09/your-man-in-the-public-gallery-assange-hearing-day-18/)
- `阿桑奇审判日18`
- [Arcade Perfect: How Sega brought the Mega Drive into the mainstream](https://readonlymemory.vg/arcade-perfect-sega-mega-drive-genesis/)
- `Arcade Perfect：世嘉如何将Mega Drive纳入主流`
- [Rare Edition of Shakespeare’s Last Play Found in Spanish Library](https://www.smithsonianmag.com/smart-news/1634-printing-shakespeares-last-known-work-found-spain-180975915/)
- `莎士比亚上一部戏剧的稀有版本在西班牙图书馆中发现`
- [Poshmark Filed to Go Public](https://www.bloomberg.com/news/articles/2020-09-25/used-clothing-platform-poshmark-says-it-filed-to-go-public)
- `Poshmark申请公开`
- [A SQL database implemented purely in TypeScript type annotations](https://github.com/codemix/ts-sql)
- `一个完全以TypeScript类型注释实现的SQL数据库`
- [Uber secures right to continue operating in London](https://www.bbc.com/news/business-54322579)
- `优步获得在伦敦继续经营的权利`
- [Split Keyboard for Professionals](https://ultimatehackingkeyboard.com/)
- `专业分体式键盘`
- [Default window manager switched to CTWM in NetBSD-current](https://blog.netbsd.org/tnf/entry/default_window_manager_switched_to)
- `默认窗口管理器在NetBSD-current中切换到CTWM`
- [Parametric lamp design using circle packings](https://stuffmatic.com/blog/parametric-lamp-design-using-circle-packings/)
- `使用圆形填料的参量灯设计`
- [How to digitize your lab notebooks](https://www.nature.com/articles/d41586-020-02728-0)
- `如何数字化您的实验室笔记本`
- [Zig's New Relationship with LLVM](https://kristoff.it/blog/zig-new-relationship-llvm/)
- `Zig与LLVM的新关系`
- [Amazon Restricts How Rival Device Makers Buy Ads on Its Site](https://www.wsj.com/articles/amazon-restricts-advertising-competitor-device-makers-roku-arlo-11600786638)
- `亚马逊限制竞争对手设备制造商在其网站上购买广告的方式`
- [Dreading a dark winter lockdown? Think like a Norwegian](https://www.theguardian.com/science/2020/sep/26/dreading-a-dark-winter-lockdown-think-like-a-norwegian)
- `惧怕黑暗的冬季封锁？`
- [Scorpion Transforming Computer Chair](https://www.cluvens.net/news/this-villainous-scorpion-can-transform)
- `蝎子变形电脑椅`
- [Workers Durable Objects Beta: A New Approach to Stateful Serverless](https://blog.cloudflare.com/introducing-workers-durable-objects/)
- `工人耐用对象Beta：有状态无服务器的新方法`

## HackShows Hacks展示

- [ I made a website for 3D Printing freelancers](https://makely.me)
- `Makely –适合所有人的3D打印`
- [ Headless Recorder](https://github.com/checkly/headless-recorder)
- `显示HN：无头记录仪`
- [Launch HN: Scrimba (YC S20) – Interactive video for learning to code](item?id=24579699)
- `推出HN：Scrimba（YC S20）–用于学习编码的交互式视频`
- [ Parametric Equalizer for PulseAudio](https://github.com/keur/prettyeq)
- `Show HN：PulseAudio的参数均衡器`
- [ Video Transcoder on the browser using WASM](https://modfy.video/)
- `显示HN：使用WASM在浏览器上显示视频转码器`
- [ Strongweek, an iOS app focused on weeks months and years, not due dates](https://www.strongweekapp.com/)
- `节目HN：Strongweek，这是一个iOS应用，侧重于未到期的几周和几年`
- [ I'm building an open-source catalog of cloud infrastructures](https://github.com/scaffold-sh/aws-static-website)
- `我正在建立一个云基础架构的开源目录`
- [ Rentify – Create an online rental store](https://rentify.store)
- `显示HN：Rentify –创建在线租赁商店`
- [ Wyre, a hardware definition language that compiles to Verilog](https://github.com/nickmqb/wyre)
- `Wyre，一种可编译为Verilog的硬件定义语言`
- [ Fully Open-Sourced Online MIDI Editor](https://signal.vercel.app/)
- `完全开源的在线MIDI编辑器`
- [ Send Audio Messages in Gmail](https://nat.app/gmail-record-audio)
- `显示HN：在Gmail中发送音频邮件`
- [ Trueq.io – A New Q&A Platform for Developers](https://trueq.io/)
- `Show HN：Trueq.io –针对开发人员的新问答平台`
- [ Fun with cell phone webcam and WebGL shaders](https://acidicworks.github.io/AcidFilters/)
- `显示HN：手机网络摄像头和WebGL着色器的乐趣`
- [ A freelance-only job board](https://lancer.to)
- `仅限自由职业者的工作委员会`
- [ Transactional Outbox Pattern in Go](https://github.com/obsidiandynamics/goharvest)
- `Go中的交易发件箱模式`
- [ Startingcondition.com – Who goes first at standup? (or group events)](https://startingcondition.com/)
- `Startingcondition.com –谁先站起来？ `
- [ Gitjacker: Leak Git repositories from misconfigured websites](https://github.com/liamg/gitjacker)
- `Gitjacker：来自配置错误的网站的Git泄漏存储库`
- [ DevUtils.app – Developer Utilities for macOS](item?id=24604291)
- `DevUtils.app –适用于macOS的开发人员实用程序`
- [ Build AWS ECS external deployments graphically](https://craftydeploy.com/editor)
- `以图形方式构建AWS ECS外部部署`
- [ Wisefin API – Turn messy bank transactions into beautiful data](https://wisefin.ai?hn)
- `Wisefin API –将凌乱的银行交易变成精美的数据`
- [ iPhone app that may prevent you from frequent social media checking](https://apps.apple.com/us/app/id1507694725)
- `iPhone应用程序可能会阻止您频繁进行社交媒体检查`
- [ Timebox – Timer Script for Windows/Linux/macOS to Practice Timeboxing](https://github.com/susam/timebox)
- `Timebox – Windows / Linux / macOS的计时器脚本，用于练习计时`
- [ Validate Your Idea Before Writing a Single Line of Code](https://iwanttobuildthis.com/)
- `在编写一行代码之前验证您的想法`
- [ iOS 14 'Phoenix 2' Space Shooter via App Clips](https://www.macrumors.com/2020/09/26/phoenix-game-demo-app-clips/)
- `iOS 14“ Phoenix 2”太空射击游戏，通过应用剪辑`
- [ bbox-visualizer – Make drawing and labeling bounding boxes easy as cake](https://github.com/shoumikchow/bbox-visualizer)
- `bbox-visualizer –使绘图和标签边界框像蛋糕一样容易`
- [ Simple, customizable, no-code website Hit Counter](https://hitcount.io)
- `简单，可定制，无代码的网站Hit Counter`
- [ Life Calendar – Your Life in Weeks](https://life-calendar-in-weeks.vercel.app)
- `人生日历-您的周生活`
- [ Instant SVG icon search with over 50K+ icons indexed](https://iconsear.ch/search.html)
- `即时SVG图标搜索，索引超过50K +图标`
- [ Prosthesis limbs customization platform in 3D](http://coleg.co)
- `3D假肢肢体定制平台`
- [ Keyboard Simulator – virtual keyboard designer](https://keyboardsimulator.xyz/)
- `Show HN：键盘模拟器–虚拟键盘设计师`
- [ Fast Variant data type for Go](https://github.com/tigrannajaryan/govariant)
- `Go的快速变体数据类型`
- [ File2DB, Upload CSV/JSON/Excel to a (PostgreSQL/MySQL/) Database](https://github.com/BenderV/file2db)
- `File2DB，将CSV / JSON / Excel上传到（PostgreSQL / MySQL /）数据库`
- [ Remote Oil Tank Monitoring Solution](http://myoilguage.com/)
- `远程油箱监控解决方案`
- [ Vocabulary 90 – vocabulary learning automation](https://gsuite.google.com/marketplace/app/vocabulary_90/637385062408)
- `Show HN：词汇90 –词汇学习自动化`
- [ Grayscale/reading mode for i3 and other WMs](https://github.com/kantord/compton-grayscale-reading-mode)
- `i3和其他WM的灰度/读取模式`

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# Decorator Pattern

## Definition

*In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object, dynamically, without affecting the behavior of other objects from the same class. The decorator pattern is often useful for adhering to the [Single Responsibility Principle](../Single-Responsibility-Principle/), as it allows functionality to be divided between classes with unique areas of concern.*

Source: [Wikipedia](https://en.wikipedia.org/wiki/Decorator_pattern)

## Example

### Model

![](http://www.plantuml.com/plantuml/png/bPFDhjCm48NtVehPqGitVO3eghfLMO044eA-W1jF4Wjx9h8dL8YVPyVDJqL9g66HHMRE-Sx46Jz7qK5wxrJbT8pm7b4iDV70986Tmm3V5BpQ6pDrzY981d7paCeVqVCNN7P-g0ctz1tOUqrcwgy2Pibr96Ery3Z8fwGO0om9XbfN26ydmvlqE0nFbk0ubNQ3QMnivk8Z73HLw9mMotJapqW3yMTcved_EtAfpMSilpiRSq-UINh7JPDCj-pNM76udEdJyVQ4Lc5G9CZc0IvKOa5mM0jmdM6NPUehW0yOQWu-WXlbZt3g1GnZf1UI-bMhgK5e-GmZ0hZ3HC2ea0nS4fLghK50tybNyEXF6A9IAxjQ63vJiRlkJ0cMXl3_4wkvD6l-lXGbnFGQbuxbFrkQL7RNYhwxdzuEmgZck3niLEPu-T6smJQjRB_l_ho09LZVEVH84Y4_sB-ZrFs5Wss6aFE_N0UOKO1HFIEPthjV)

### Code

```csharp

internal class LoggingCommandHandlerDecorator<T> : ICommandHandler<T> where T:ICommand
{
    private readonly ILogger _logger;
    private readonly IExecutionContextAccessor _executionContextAccessor;
    private readonly ICommandHandler<T> _decorated;

    public LoggingCommandHandlerDecorator(
        ILogger logger,
        IExecutionContextAccessor executionContextAccessor,
        ICommandHandler<T> decorated)
    {
        _logger = logger;
        _executionContextAccessor = executionContextAccessor;
        _decorated = decorated;
    }
    public async Task<Unit> Handle(T command, CancellationToken cancellationToken)
    {
        if (command is IRecurringCommand)
        {
            return await _decorated.Handle(command, cancellationToken);
        }
        using (
            LogContext.Push(
                new RequestLogEnricher(_executionContextAccessor),
                new CommandLogEnricher(command)))
        {
            try
            {
                this._logger.Information(
                    "Executing command {Command}",
                    command.GetType().Name);

                var result = await _decorated.Handle(command, cancellationToken);

                this._logger.Information("Command {Command} processed successful", command.GetType().Name);

                return result;
            }
            catch (Exception exception)
            {
                this._logger.Error(exception, "Command {Command} processing failed", command.GetType().Name);
                throw;
            }
        }
    }

    private class CommandLogEnricher : ILogEventEnricher
    {
        private readonly ICommand _command;

        public CommandLogEnricher(ICommand command)
        {
            _command = command;
        }
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            logEvent.AddOrUpdateProperty(new LogEventProperty("Context", new ScalarValue($"Command:{_command.Id.ToString()}")));
        }
    }

    private class RequestLogEnricher : ILogEventEnricher
    {
        private readonly IExecutionContextAccessor _executionContextAccessor;
        public RequestLogEnricher(IExecutionContextAccessor executionContextAccessor)
        {
            _executionContextAccessor = executionContextAccessor;
        }
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            if (_executionContextAccessor.IsAvailable)
            {
                logEvent.AddOrUpdateProperty(new LogEventProperty("CorrelationId", new ScalarValue(_executionContextAccessor.CorrelationId)));
            }
        }
    }
}

```
### Description

The Logging decorator logs execution, arguments and processing of each Command. This way each log inside a processor has the log context of the processing command.

A unique trade of a decorator is that it does both:
* It implements  `ICommandHandler<T>` (known also as the *component*).
* It accepts an <u>implementation</u> of `ICommandHandler<T>` (known also as the *concrete component*). Usually that is done via [Dependency Injection](../Dependency-Injection/).

The decorator builds on top of existing functionality provided by the injected `ICommandHandler<T>`, but it does not change the behavior of it.

---

Decorator should not be confused with [Strategy](../Strategy-Pattern/)!!!
*A decorator lets you change the skin of an object, while Strategy lets you change the guts.*

repository: NicoJuicy/modular-monolith-with-ddd

gha_license_id: MIT

repo_name: NicoJuicy/modular-monolith-with-ddd


text:
CoreBluetooth Peripheral Example
================================

- Author: Alastair Tse (@liquidx)
- Updated: *4 November 2012*

A demonstration of using CoreBluetooth (using Bluetoothe 4.0 LE) on the OSX and iOS.

On the OSX side, CoreBluetoothOSXCentral implements the client as a CoreBluetooth Central that scans for suitable Bluetooth 4.0 LE peripherals. Once it discovers one, it will try and connect and subscribe to a fixed service characterstic. Once it receives a notification from the Peripheral it subscribes to, it will immediately unsubscribe.

On the iOS side, CoreBluetootheiOSPeripheral implements the server as a CoreBluetooth Peripheral that advertises a fixed service characteristic. Once a Central (OSX) connects to the service and subscribes to notifications on the characteristic, it will send a "Hello" message to the subscriber.

Basic Bluetooth 4.0 Terminology
-------------------------------

 * **Bluetooth Central**: This is the node that is trying to connect to a data source. Think of this as the *client*.
 * **Bluetooth Peripheral**: This is the node that is providing the primary data source. Think of this as the *server*.
 * **Characteristic**: A characteristic can be considered a variable.
 * **Service**: A group of characteristics live under a "Service".

Implemented
-----------

 * Central
   * Scanning for peripherals
   * Connecting to a peripheral
   * Disconnecting from a peripheral
   * Discovering services
   * Discovering characteristics of a service
   * Subscribing to a characteristic
   * Receiving data from a characteristic

 * Peripheral
   * Advertising a service and characteristic
   * Adding service and characteristic to the PeripheralManager
   * Detecting of new subscribers to a characteristics
   * Detecting of unsubscribing
   * Handling of unready state of the device.

Currently Unimplemented
-----------------------

To keep the implementation simple, this demonstration does not implement:

 * Static read/write characteristics.
 * Multiple characteristics.

Implementation Notes and Caveats
--------------------------------

### UIBackgroundModes ###

According to Apple, if you add `bluetooth-central` or `bluetooth-peripheral` to `UIBackgroundModes` in the `Info.plist`, the application will continue to run in the background and receive `CBCentralManagerDelegate` and/or `CBPeripheralManagerDelegate` events.

I've not fully discovered the behaviour here, but I've advertised services disappear from the advertisments even though the application is still running in the background. Some times they exist with no hassles at all, sometimes the services are dropped by the service name still exists. Sometimes everything is dropped, even the generic services.

It's quite mysterious when it is working and when it is not.

*More investigation needed.*

### Peripheral Mode on OSX ###

As of OSX 10.8, the CoreBluetooth APIs only allow you to have your Mac act as a Central. On iOS 6.0, the iOS device can act as either a Peripheral or a Central.

### Service UUIDs ###

If an iOS device is implementing a *peripheral*, consider using UUIDs that are only 4 characters short (2-bytes).

        CBUUID *serviceUUID = [CBUUID UUIDWithString:@"1234"];

The advertisement packet sent is max 28-bytes (or 38 bytes including the name). If your UUIDs exceed that, then the service will not be discoverable if `CBCentralManager` scans with no specific service UUIDs:

        [managed scanForPeripheralsWithServices:nil ...];

See `CBPeripheralManager.h` for details.

### Overflow in Advertisments (iOS only) ###

If you are implementing the CBCentralManager on iOS, you can also look in the overflow advertisment data field (`CBAdvertisementDataOverflowServiceUUIDsKey`) in the `advertismentData` dictionary.

        - (void)centralManager:(CBCentralManager *)central
                didDiscoverPeripheral:(CBPeripheral *)peripheral
                advertisementData:(NSDictionary *)advertisementData
                RSSI:(NSNumber *)RSSI {
          NSArray *overflowServiceUUIDs = [advertismentData objectForKey:
              CBAdvertisementDataOverflowServiceUUIDsKey];
          ...
        }

### Scanning for Services ###

When scanning for peripherals from CBCentralManager, when you receive a `centralManager:didDiscoverPeripheral:advertismentData:RSSI:` message, you should look in the `advertismentData` dictionary for the `CBAdvertisementDataServiceUUIDsKey` for the advertised services rather than in the `peripheral.services` property.

The `peripheral.services` property will not be filled in until you call `[CBCentralManager discoverServices:]`.

        - (void)centralManager:(CBCentralManager *)central
                didDiscoverPeripheral:(CBPeripheral *)peripheral
                advertisementData:(NSDictionary *)advertisementData
                RSSI:(NSNumber *)RSSI {
          NSArray *serviceUUIDs = [advertismentData objectForKey:
              CBAdvertisementDataServiceUUIDsKey];
          for (CBUUID *foundServiceUUIDs in serviceUUIDs) {
            if ([self.serviceUUIDs containsObject:foundServiceUUIDs]) {
              foundSuitablePeripheral = YES;
              break;
          }
          ...
        }

### Calling [CBPeripheral discoverServices:] ###

Sometimes, if the iOS application acting as the peripheral is in the background, the services for it removed from the advertisment packet. In that case, if you call `[CBPeripheral discoverServices:]` with an array of services, it may not return any services.

### Endianness with UUIDs ###

If you use long UUIDs (eg, using `uuidgen`), then you will run in to endianess issues between iOS and the Mac. This is a bug in Xcode 4.5 and reportedly fixed in Xcode 4.5.1.

### No centralDidConnect: and centralDidDisconnect: messages ###

Despite that was said in the WWDC talk, the subsequent betas for iOS 6.0 will not call `centralDidConnect:` and `centralDidDisconnect:` on the `CBPeripheralManagerDelegate`.

### CBMutableCharacteristics.properties is a bitmask ###

You can have a characteristic that is both readable and notifiable. This example does not do this, but presumably you can set the property of using the bitmask:

      (CBCharacteristicPropertyRead | CBCharacteristicPropertyNotify)

### Bluetooth popups on background ###

See: <http://lists.apple.com/archives/bluetooth-dev/2012/Oct/msg00053.html>

### [CBCentralManager connectPeripheral:] silently fails ###

If you do not retain the `CBPeripheral` you get in the Central implementation, when you call connectPeripheral, it will silently fail. This is surprising because you'd think `connectPeripheral:` would retain the `CBPeripheral`.

In the demo, you'll note that I retain the `CBPeripheral` for time out purposes, but if I didn't do that, `[CBCentralManager connectPeripheral:]` will silently fail.

### Device UUID changes if Bluetooth is enabled/disabled or device is rebooted ###

In the WWDC presentation, reconnecting to the device by UUID is mentiond. However, if the peripheral is an iPhone, the UUID changes if Bluetooth is turned on and off again on the device. The UUID stays consistent if the app is killed and restarted.

### Beware of adding and removing services while running ###

If you remove a service while a Central is connected to the Peripheral, like through a subscribed characteristic, then the Central does not get a disconnection. The peripheral will also lose track of the subscribers for a characteristic, even if the characteristic has the same UUID. That is, don't do this:

        [self.peripheralManager removeService:self.currentService];
        [self.peripheralManager addService:self.currentService];

I ran in to this when I would listen for didSubscribe and then prompt the user to bring the Peripheral implementation to the foreground. When I returned to the foreground, I had code that re-enabled the service that would check if `self.currentService` existed, and if so, removed the service and readded it again. That was not a good idea.

Other Resources
---------------

- <https://github.com/KhaosT/CBPeripheralManager-Demo>

The code only works for readValue and writeValue, but not seemingly for subscribe.

- <https://github.com/timburks/iOSHealthThermometer>
- <https://github.com/timburks/CBSample>

Sample Code:

- <http://lists.apple.com/archives/bluetooth-dev/2012/Sep/msg00084.html>

### Sources of Discussion ###

- <https://devforums.apple.com/community/ios/core/cbt>
- <https://lists.apple.com/archives/bluetooth-dev/2012>
- <http://www.bluetooth.org/Technical/Specifications/adopted.htm>

### Important Threads ###

Rebooting phone fixes not-notifying on subscribable properties.
- <https://devforums.apple.com/message/736002#736002>


text:
# Module: "image-source"

``` JavaScript
// To import the "image-source" module:
var image_source = require("image-source");
```

**[How to "image-source"](HOW-TO.md)**

Class | Description
------|------------
[ImageSource](../image-source/ImageSource.md) | Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.

Enum | Description
------|------------
[ImageFormat](../image-source/ImageFormat.md) | Defines the recognized image formats.

##### Functions
 - **fromResource(** name _String_ **)** [_ImageSource_](../image-source/ImageSource.md)
     Creates a new ImageSource instance and loads it from the specified resource name.
   - **name** - _String_
     The name of the resource (without its extension).
   - _**return**_ - [_ImageSource_](../image-source/ImageSource.md)
 - **fromFile(** path _String_ **)** [_ImageSource_](../image-source/ImageSource.md)
     Creates a new ImageSource instance and loads it from the specified file.
   - **path** - _String_
     The location of the file on the file system.
   - _**return**_ - [_ImageSource_](../image-source/ImageSource.md)
 - **fromData(** data _Object_ **)** [_ImageSource_](../image-source/ImageSource.md)
     Creates a new ImageSource instance and loads it from the specified resource name.
   - **data** - _Object_
     The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
   - _**return**_ - [_ImageSource_](../image-source/ImageSource.md)
 - **fromNativeSource(** source _Object_ **)** [_ImageSource_](../image-source/ImageSource.md)
     Creates a new ImageSource instance and sets the provided native source object (typically a Bitmap).
The native source object will update either the android or ios properties, depending on the target os.
   - **source** - _Object_
     The native image object. Will be either a Bitmap for Android or a UIImage for iOS.
   - _**return**_ - [_ImageSource_](../image-source/ImageSource.md)
 - **fromUrl(** url _String_ **)** [_Promise_](../promises/Promise.md)...
     Downloads the image from the provided Url and creates a new ImageSource instance from it.
   - **url** - _String_
     The link to the remote image object. This operation will download and decode the image.
   - _**return**_ - [_Promise_](../promises/Promise.md) of [_ImageSource_](../image-source/ImageSource.md)

repository: CHAITANYASAI-del/docs

gha_language: CSS

repo_name: CHAITANYASAI-del/docs


text:
# ClassC
A very basic OOP wrapper for plain C using structs and function pointers. For demonstration purposes, a 2D vector implementation is included.

Please note that this project only serves as a learning exercise and thus is not suited for production usage.

Example of usage:

```C
Vector2D test = newVector();
test->x = 2;
test->y = 3;

Vector2D other = newVector();
other->x = 4;
other->y = 1;

test->add(test, other);

test->printThis(test);

deleteVector(test);
deleteVector(other);
```

repository: fwcd/classc

repo_name: fwcd/classc


text:
# tensorflow_keras_to_caffe

### This script implements the tensorflow1.x and keras model into a caffe inference model. [zhihu](https://zhuanlan.zhihu.com/p/115081459)

### envs and tools

```python
tensorflow1.13.2、keras2.2.4、caffe1.0、python3.6、pycharm、Anoconda、MMdnn0.2.4、ubuntu18.04
```

* If caffe is only needed for model transformation, you can simply install with conda, command line:

  ```python
  conda install caffe-gpu
  ```

* If your model is now a keras model, then the [MMdnn]( https://github.com/microsoft/MMdnn) is not needed.

* If your model is now a tensorflow model, such as the ckpt model, then you need Microsoft's MMdnn for conversion. Although this tool currently can not seamlessly convert all different frameworks, the conversion between tf and keras is painless. Command line conversion example:

  ```python
  mmconvert -sf tensorflow -in your_model_name.ckpt.meta -iw your_model_name.ckpt --inNodeName input_name --inputShape 224,224,3 --dstNodeName output1 ouput2 -df keras -om your_keras_model.h5
  ```

### Supported layers

```python
- InputLayer
- Dense
- Dropout
- ZeroPadding2D
- Multiply、Concatenate、Maximum、Add
- Conv2D、Conv2DTranspose
- BatchNormalization
- MaxPooling2D、AveragePooling2D、GlobalAveragePooling2D
- relu、prelu、elu、softmax、sigmoid、tanh
```

You can modify the `generate_layer(blobs, layer, n, net_params)`  function to implement your own layer transformation.

### How to use

Specify your keras model path and the name of the caffe model you want, then just run is. like this:

```python
if __name__=='__main__':

    config = tf.ConfigProto()
    config.gpu_options.allow_growth = True
    sess = tf.Session(config=config)
    K.set_session(sess)

    kModel=load_keras_model('../your_keras_model.h5')
    prototxt='../your_caffe_model.prototxt'
    caffemodel='../your_caffe_model.caffemodel'
    generate_caffe_model(kModel, prototxt, caffemodel)
```

### Tips

* If your model is a tensorflow model and used `conv2d_transpose ` layer (`Deconvolution `in caffe), then you must avoid using high-level api, such as `slim.conv2d_transpose`, and you need to use  `tf.nn.conv2d_transpose` interface. Otherwise, the conversion will fail (it seems that the implementation is different).

* In addition, the padding method of convolution in tensorflow or keras is different from the caffe. When 'same' padding in tf / keras, there is a case only pad the bottom right, but in caffe will pad top, bottom, left and right. That will lead to inaccurate results. To solve this problem, it is recommended to manually add a pad in tensorflow, like this:

  ```python
  def conv2d(inputs, filters, kernel_size,      strides=1,rate=1,biases_initializer=tf.zeros_initializer,  activation_fn=tf.nn.relu):#stride>1时padding，valid卷积实现same
      def _fixed_padding(inputs, kernel_size):
          pad_total = kernel_size - 1
          pad_beg = pad_total // 2
          pad_end = pad_total - pad_beg

          padded_inputs = tf.pad(inputs, [[0, 0], [pad_beg, pad_end],
                                          [pad_beg, pad_end], [0, 0]], mode='CONSTANT')
          return padded_inputs

      if strides > 1:
          inputs = _fixed_padding(inputs, kernel_size)
      inputs = slim.conv2d(inputs, filters, kernel_size,      stride=strides,rate=rate,biases_initializer=biases_initializer,
                         activation_fn=activation_fn,padding=('SAME' if strides == 1  else 'VALID'),weights_initializer=tf.initializers.he_normal())
      return inputs
  ```

  In this way, removing the pad layer during the conversion process, such as removing the `ZeroPadding2D` layer in keras, can directly use only the convolution layer in caffe to achieve same output.

#### reference

https://github.com/anoojpatel/keras2caffe, I fixed some bugs and simplified the code, and only converted to the inference model.


text:
# RemovesubstringApp

The repository contains a little Ghost app to add functionality to remove a substring from a string.
On more infomartion about how to setup and use this app, check out my related blog post here:
https://dotnetfalcon.com/stackoverflow-adventures-creating-custom-ghost-helpers-using-apps

Also check out the Stackoverflow question that inspired this little helper:
https://stackoverflow.com/questions/52977643/internal-tag-parsing-in-ghost

repository: conwid/RemovesubstringApp

repo_name: conwid/RemovesubstringApp


text:
# XBUS-515 Time Series Analyses and Databases

Workshops, code, and examples for the Time Series Analytics course in the Advanced Data Science Certificate.

## Getting Started

Please clone the repository prior to class - note that there is a large dataset included in the repository and it may take a while to download. You can then install the Python dependencies for the notebooks as follows:

```
$ pip install -r requirements.txt
```

You will be assigned breakout rooms to work in pairs or small groups. Run the notebooks using the `jupyter` command.

## References

Chen, Yang. Early Anomaly Detection and Classification with Streaming Synchrophasor Data in Electric Energy Systems. Diss. 2015. https://oaktrust.library.tamu.edu/handle/1969.1/156508

branch_name: refs/heads/main


text:
---
tag:
- testing
- ios
title: Installing an ipa file from the public install page
redirect_from: []
summary: Learn how to install an ipa file from the public install page with or without
  a Bitrise account.
menu:
  testing-main:
    weight: 8

---
The public install page is a convenient way of sharing the latest version of your app with team members and any other stakeholders who wish to check the app out. The page includes all the important details of the build such as filename, size, version code, minimum SDK version, and build number. Anyone, whose email address or Bitrise team role you add before building the app, will receive an email from Bitrise with a link to the public install page. The public install page's direct link can be shared with anyone as well. From there they can quickly install the app on their own test device.

The public install page enables you to install .ipa files on provisioned and registered test devices. The allowed device types are: iPhone and iPad.

Installing an .ipa file on a test device consist of three phases: initiating the device compatibility check, installing a configuration profile on the test device, then finishing up with installing the app on the device.

In this tutorial we’re describing:

* How to install an app on a registered test device without a Bitrise account (for anyone who has not subscribed to Bitrise but wishes to check out the current version of the app).
* How to install an app on a test device which is yet to be registered on Bitrise (for Bitrise users).

## Prepping for installation

Before installing the app on any test device, the app’s developer has to complete a couple of steps to build the app and share it with anyone:

* The device, on which the app will be installed, is registered as a test device at the developer’s Apple account.
* The device has to be included in the provisioning profile of the app.
* The device meets the minimum OS requirements of the app.

Please note that if the test device is not registered on the Apple Developer portal, the developer has to manually add it to the device list, and re-build the app so that the .ipa file contains the test device/s the app can be installed on. We also recommend you [register the test device on Bitrise](/testing/registering-a-test-device/) as well.

{% include message_box.html type="info" title="Which browser should I use with the public install page?" content="Anyone who wishes to install the app on a test device has to make sure that the public install page of the app is opened in a native Safari session with non-incognito mode."%}

## Installing an .ipa file on test devices

During this whole flow, use a native, non-incognito Safari session instead of any other in-app browser type. If you follow the link in the notification email you got from Bitrise, the public install page will automatically open in a native Safari session.

{% include message_box.html type="info" title="Would you rather download the app?" content="If you only wish to download the app and manually upload it somewhere else, you can find the download button on the **APPS & ARTIFACTS** page of the build. Please note that downloading an app does not mean you can install it on the test device."%}

### Installing an app on a test device without a Bitrise account

 1. Long tap on the link you received from Bitrise. To open the link in native Safari, tap **Open Link**. It brings up the public install page in a native Safari session. If you copy the link from the email, make sure you paste it in a native Safari session.
 2. Tap the link in the **Click here to check device compatibility of this device with this app** yellow message box. If you cannot see this message, you are most likely using another browser so switch to Safari.

    ![{{ page.title }}](/img/3a-public-install-page-not-logged-in-bitrise-user-png.png)
 3. Tap **Allow** on the pop-up to install the configuration profile on your device. This configuration profile makes the device’s UDID available to Bitrise for the compatibility check.

    ![{{ page.title }}](/img/4a_-_configuration_profile__not_logged_in_bitrise_user__png.jpg)
 4. A pop-up confirms the configuration profile has been downloaded, and it can be installed in the **Settings** app. Tap **Close**.

    ![{{ page.title }}](/img/5a_-_configuration_profile_downloaded__not_logged_in_bitrise_user__png.jpg)
 5. Tap the **Home** button to go the the home screen.

    ![{{ page.title }}](/img/6_0_home_screen.jpg)
 6. Open **Settings**. You can find the downloaded profile at the top of the **Settings**. Tap **Profile Downloaded** menu item on the left to install the profile.

    ![{{ page.title }}](/img/step6.jpg)
 7. Tap **Install**.

    ![{{ page.title }}](/img/6_2_-_install_configuration_profile_2_png.jpg)
 8. Type your device’s passcode in the **Enter passcode** pop-up.

    ![{{ page.title }}](/img/6_3_-_install_configuration_profile_3_png.jpg)
 9. Tap **Install** again.

    ![{{ page.title }}](/img/6_4_-_install_configuration_profile_4_png.jpg)
10. Wait until the profile is installed.

    ![{{ page.title }}](/img/6_5_-_install_configuration_profile_5_png.jpg)
11. Once the profile is installed, you’re directed to the public install page. As you can see, the **Install** button is now available. Tap it!

    ![{{ page.title }}](/img/7_1_-_install_application_1_png.jpg)
12. Tap **OK** on the next pop-up.

    ![{{ page.title }}](/img/tapok.png)
13. As a final confirmation, tap on **Install** and press the **Home** button. Now you’re installing the app to your test device.

    ![{{ page.title }}](/img/7_3_-_install_application_3_png.jpg)
14. Wait till the app installs on your test device’s home screen.

    ![{{ page.title }}](/img/7_5_install_application_5_png.jpg)

Check out the app you’ve successfully installed on your test device.

### Installing an app on a test device not registered to Bitrise

If you’re accessing the public install page from a test device which displays the below message, you’ll have to register the device on Bitrise which is only a few steps different from the above flow.

Please note that you can only add a test device to Bitrise if you already have a Bitrise account.

![{{ page.title }}](/img/3b_-_public_install_page__logged_in_bitrise_user__png.jpg)

 1. Tap **Click here** to start the device registration process.
 2. Tap **Allow** to download the configuration profile.

    ![{{ page.title }}](/img/4b_-_configuration_profile__logged_in_bitrise_user__png.jpg)
 3. When the configuration profile is downloaded, tap **Close**.

    ![{{ page.title }}](/img/5b_-_configuration_profile_downloaded__logged_in_bitrise_user__png.jpg)
 4. Tap the **Home** button to go to your **Settings** app on your test device’s home screen.

    ![{{ page.title }}](/img/6_0_home_screen-1.jpg)
 5. Open **Settings**. You can find the downloaded profile at the top of the **Settings**. Tap **Profile Downloaded** menu item on the left to install the profile.

    ![{{ page.title }}](/img/step6.jpg)
 6. Tap **Install**.

    ![{{ page.title }}](/img/6_2_-_install_configuration_profile_2_png.jpg)
 7. Type your device’s passcode in the **Enter Passcode** pop-up.

    ![{{ page.title }}](/img/6_3_-_install_configuration_profile_3_png.jpg)
 8. Tap **Install** again in the **Install Profile** pop-up.

    ![{{ page.title }}](/img/6_4_-_install_configuration_profile_4_png.jpg)
 9. Wait until the profile installation is complete. You automatically get redirected to the **Register your test device** page.

    ![{{ page.title }}](/img/6_5_-_install_configuration_profile_5_png.jpg)
10. Your device’s name and UDID gets populated automatically. You can only change the device name here. Tap **Register Device**.

    ![{{ page.title }}](/img/6_6b_-_register_device_png.jpg)
11. You land on the public install page where the **Install** button is now available. Tap it!

    ![{{ page.title }}](/img/7_1_-_install_application_1_png.jpg)
12. Tap **OK** on the prompt.

    ![{{ page.title }}](/img/tapok.png)
13. To install the app on your test device, tap on **Install**. Then press the **Home** button to follow the installment of your app.

If all went well, you can find the installed app on your test device’s **Home** page.

![{{ page.title }}](/img/7_5_install_application_5_png.jpg)

repository: ghostnotes/devcenter

repo_name: ghostnotes/devcenter


text:
Segment.io Node Client
==============

[Segment.io](https://segment.io) is a segmentation-focused analytics platform. If you haven't yet,
register for a project [here](https://segment.io).

This is an official node.js client that wraps the [Segment.io REST API](https://segment.io/docs) .

You can use this driver to identify and track your visitor's events into your Segment.io project.

## Design

This client uses batching to efficiently record your events in aggregate, rather than making an HTTP
request every time. This means that it is safe to use in your web server controllers, or in back-end services
without worrying that it will make too many HTTP requests and slow down the system.

You can control the batching behavior as described below.

## How to Use

#### Install

```javascript
npm install segmentio
```
#### Initialize the client

The default and easiest method for most apps is to just use the API client as a module. To get started, just use the following:

```javascript
var segmentio = require('segmentio');
segmentio.init('YOUR_API_KEY');
```

Then whenever you `require('segmentio')` from your app, you'll have access to the same client.

You can also create your own client if you'd like a little more customization. The API is exactly the same.
```javascript
var segmentio = new require('segmentio').Client();
segmentio.init('YOUR_API_KEY');
```

#### Identify a Visitor

Identifying a visitor ties all of their actions to an ID you recognize and records visitor traits you can segment by.

```javascript
segmentio.identify({
    sessionId : String
    visitorId : String
    traits : Object
});
```

**sessionId** (string) is a unique id associated with an anonymous visitor before they are logged in. If the user
is logged in, you can use null here.

**visitorId** (string) is usually an email, but any unique ID will work. This is how you recognize a signed-in visitor
in your system. Note: it can be null if the visitor is not logged in.By explicitly identifying a visitor, you tie all of
their actions to their identity. This makes it possible for you to run things like segment-based email campaigns.

**traits** (object) is a dictionary with keys like “Subscription Plan” or “Favorite Genre”. You can segment your visitors by any trait you record. Once you record a trait, no need to send it again, so the traits argument is optional.

```javascript
segmentio.identify({
    sessionId : 'DKGXt384hFDT82D',
    userId<EMAIL_ADDRESS>
    traits : {
        'First Name': 'Ilya',
        'Last Name': 'Volodarsky',
        'Subscription Plan': 'Premium',
        'On Mailing List': true
    }
});

```

#### Track an Action

Whenever a visitor triggers an event on your site, you’ll want to track it so that you can analyze and segment by those events later.

```
seg.track({
    sessionId : String,
    userId : String,
    event : String,
    properties : Object
});
```

**sessionId** (string) is a unique id associated with an anonymous visitor before they are logged in. If the user
is logged in, you can use null here. Either this or the userId must be supplied.

**userId** (string) is usually an email, but any unique ID will work. This is how you recognize a signed-in visitor
in your system. Note: it can be null if the visitor is not logged in. By explicitly identifying a visitor, you tie all of
their actions to their identity. This makes it possible for you to run things like segment-based email campaigns. Either this or the sessionId must be supplied.

**event** (string) is a human readable description like "Played a Song", "Printed a Report" or "Updated Status". You’ll be able to segment by when and how many times each event was triggered.

**properties** (object) is a dictionary with items that describe the event in more detail. This argument is optional, but highly recommended—you’ll find these properties extremely useful later.

```javascript

seg.track({
    sessionId : 'DKGXt384hFDT82D',
    userId<EMAIL_ADDRESS>
    event : 'Listened to a song',
    properties : {
        'Title': 'Eleanor Rigby',
        'Artist': 'Beatles',
        'Playlist': 'Popular'
    }
});
```

#### Adjusting Batching

You can adjust the flush triggers in the client. Take a look into the source.

#### Testing

```javascript
npm test
```

#### License

(The MIT License)

Copyright (c) 2012-2012 Segment.io Inc<EMAIL_ADDRESS>
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.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 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: Gabrielmtn/animals

repo_name: Gabrielmtn/animals


text:
# Find-String

Find-String is a PowerShell script whose purpose is to emulate grep and/or ack.
PowerShell already has the built-in Select-String cmdlet, but this script wraps
Select-String and provides match highlighting on top of the searching capabilities.

It currently highlights matches in a similar style to ack.

## Examples:

Find all usages of `form` in all .cs files:

    find-string form *.cs

Find the unique file extensions from all of the files that have the string
'jquery' in them:

    find-string jquery -passThru |
      Select-Object -ExpandProperty Path |
      Select-String '.\.(\w+)$' |
      Select-Object -ExpandProperty Matches |
      ForEach-Object { $_.Groups[1].Value } |
      Select-Object -Unique

Or the same example using built-in aliases (more succinct, likely reflects more
typical usage):

    find-string jquery -pass |
      select -expand path |
      grep '.\.(\w+)$' |
      select -expand matches |
      %{ $_.groups[1].value } |
      select -uniq

## Installation:

Find-String has [PsGet](http://psget.net/) support - once you have PsGet
installed, all you have to do is run `Install-Module Find-String` and the
Find-String command is ready for you.

## Usage:

    NAME
        c:\MyScriptDir\Find-String.ps1

    SYNOPSIS
        Searches text files by pattern and displays the results.

    SYNTAX
        Find-String [-pattern] <Regex> [-filter] <String> [-path <String[]>]
        [-recurse] [-caseSensitive] [-context <Int32[]>] [-passThru] [-pipeOutput]
        [<CommonParameters>]

        Find-String [-pattern] <Regex> [-include] <String[]> [-path<String[]>]
        [-recurse] [-caseSensitive] [-context <Int32[]>] [-passThru] [-pipeOutput]
        [<CommonParameters>]

    DESCRIPTION
        Searches text files by pattern and displays the results.

    PARAMETERS
        -pattern <Regex>
            Specifies the text to find. Type a string or regular expression.

            Required?                    true
            Position?                    1
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -filter <String>
            Specifies the file types to search in. The default is all file types (*.*).

            Required?                    true
            Position?                    2
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -include <String[]>
            Specifies the file types to search in. This allows you to search across multiple file types (i.e. *.
            ps1,*.psm1).

            Required?                    true
            Position?                    2
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -path <String[]>
            Specifies the path to the files to be searched. Wildcards are permitted.
            The default location is the local directory.

            Required?                    false
            Position?                    named
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -recurse [<SwitchParameter>]
            Gets the items in the specified path and in all child directies. This is
            the default.

            Required?                    false
            Position?                    named
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -caseSensitive [<SwitchParameter>]
            Makes matches case-sensitive. By default, matches are not case-sensitive.

            Required?                    false
            Position?                    named
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -context <Int32[]>
            Captures the specified number of lines before and after the line with the
            match. This allows you to view the match in context.

            Required?                    false
            Position?                    named
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -passThru [<SwitchParameter>]
            Passes the literal MatchInfo object representing the found match to the
            pipeline. By default, this cmdlet does not send anything through the
            object pipeline.

            Required?                    false
            Position?                    named
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

        -pipeOutput [<SwitchParameter>]
            Sends all output along the object pipeline. By default, this command uses
            color to help with readability; however, this prevents the output from being
            piped to another command. If you wish to pipe the output of this command to
            something else, be sure to use this parameter.

            requires -version 2

            Required?                    false
            Position?                    named
            Default value
            Accept pipeline input?       false
            Accept wildcard characters?

repository: FranckSix/WindowsPowershell

repo_name: FranckSix/WindowsPowershell


text:
# Software Defined SmartGateway for AWS Alexa

---

JVM-base application fully compatible with AWS Alexa through WEMO-switch protocol:
- UPnP service discovery
- registration of Virtual devices (each VD can assign any function/script, etc.)
- Voice control from Alexa to each VD

> Application was created to run on Raspberry PI, some libs versions are downgraded to support sw that is running on PI.
CPU/memory resources of PI is not enough to start regular spring-boot application that is why [spark](https://sparkjava.com/) (lightweight server) is used

Additional info:
- [Youtube video, my talk about AWS Alexa (including demo of Software Defined Gateway)](https://www.youtube.com/watch?v=mq_vtk71LKE&t=3142s)
- [Google doc presentation slides](https://docs.google.com/presentation/d/1M-Rd8Z52mhnYyF986Eybjn1J4j0ovQfK1s7xH3Ukw-0/edit?usp=sharing)

---

## Installation

```shell
docker run -d -p 27017:27017 --name example-mongo mongo:2.6.1

gradle clean build

gradle run
```

---

## Access UI

![img.png](img.png)

---

## Add Virtual Device

![img_1.png](img_1.png)

---

## Reload server with newly registered devices

![img_2.png](img_2.png)
```shell
[Thread-17] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@6c1039e8{HTTP/1.1,[http/1.1]}{<IP_ADDRESS>:2323}
[Thread-19] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@7ddef6ea{HTTP/1.1,[http/1.1]}{<IP_ADDRESS>:4552}
[Thread-18] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@2f0ef9f2{HTTP/1.1,[http/1.1]}{<IP_ADDRESS>:4545}
[Thread-17] INFO org.eclipse.jetty.server.Server - Started @84644ms
[Thread-19] INFO org.eclipse.jetty.server.Server - Started @84644ms
[Thread-18] INFO org.eclipse.jetty.server.Server - Started @84645ms
{ "_id" : { "$oid" : "63fa3e3e4222744c749c8922"} , "localDateTime" : "2023-02-25T18:58:38.478" , "record" : "Stopped 0 device emulated services."}
{ "_id" : { "$oid" : "63fa3e3e4222744c759c8922"} , "localDateTime" : "2023-02-25T18:58:38.488" , "record" : "Starting emulated devices 3"}

```

---

## Start UPnP discovery process so Alexa can connect 'Alexa, find my devices'

![img_3.png](img_3.png)

```shell
[qtp974491681-29] INFO ua.in.smartjava.upnp.UPnPDiscoverable - UPnP Discovery change state to: true
[pool-1-thread-1] INFO ua.in.smartjava.upnp.UPnPDiscoverable - UPnP Discovery started...
[pool-1-thread-1] INFO ua.in.smartjava.upnp.UPnPDiscoverable - UPnP Discovery stopped...
{ "_id" : { "$oid" : "63fa3e624222744c769c8922"} , "localDateTime" : "2023-02-25T18:59:14.463" , "record" : "Started discovery of 3 devices for 20 seconds."}

```

---

## Toggles can be controled by Alexa Voice commands, also from UI

![img_4.png](img_4.png)

---

## Contributing

Contributions are welcome!

---

## License

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

repository: tsypuk/SmartGateway

gha_language: Java

repo_name: tsypuk/SmartGateway


text:
## Commands to Install MongoDB

// install homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

// install mongoDB

brew install mongodb

// create database files

sudo mkdir -p /data/db

## Commands to Start MongoDB

// run mongodb

sudo mongod

// Expected Output:

// in another terminal:

mongo --host <IP_ADDRESS>:27017

// Notes

## Deploy Your App

### Keys

1. Go to
2. Copy and Paste Keys Here So You Don't Lose them:

* username:
* primary password:
* host:
* port:

3. Also, retrieve what you named your database. You can find this by going to Resource Groups -> (The resource group you created today) -> Then noting the name of the Azure CosmosDB Account below:

* database:

It will be much easier to use the command below if you replace all the values in here and THEN copy and paste it into your Azure portal.

`mongodb://<username>:<primary password>@<host>:<port>/<database>?ssl=true&replicaSet=globaldb`

### Git URL
1. Go to portal.azure.com -> Resource Groups -> (The resource group you created today) -> (the APP SERVICE resource).
2. On the right side of the window, there will be "URL," "App Service plan/pricing tier, Git/Deployment username, Git clone url, and FTP hostname.
3. Copy the Git clone URL and replace YOUR URL HERE with it (below).

`git remote add origin YOUR URL HERE`

## TroubleShooting

### Error 1:

### Error 2:


text:
Project: /_project.yaml
Book: /_book.yaml

# Visibility

{% include "_buttons.html" %}

This page covers Bazel's two visibility systems:
[target visibility](#target-visibility) and [load visibility](#load-visibility).

Both types of visibility help other developers distinguish between your
library's public API and its implementation details, and help enforce structure
as your workspace grows. You can also use visibility when deprecating a public
API to allow current users while denying new ones.

## Target visibility {:#target-visibility}

**Target visibility** controls who may depend on your target — that is, who may
use your target's label inside an attribute such as `deps`.

A target `A` is visible to a target `B` if they are in the same package, or if
`A` grants visibility to `B`'s package. Thus, packages are the unit of
granularity for deciding whether or not to allow access. If `B` depends on `A`
but `A` is not visible to `B`, then any attempt to build `B` fails during
[analysis](/reference/glossary#analysis-phase).

Note that granting visibility to a package does not by itself grant visibility
to its subpackages. For more details on package and subpackages, see
[Concepts and terminology](/concepts/build-ref).

For prototyping, you can disable target visibility enforcement by setting the
flag `--check_visibility=false`. This should not be done for production usage in
submitted code.

The primary way to control visibility is with the
[`visibility`](/reference/be/common-definitions#common.visibility) attribute on
rule targets. This section describes the format of this attribute, and how to
determine a target's visibility.

### Visibility specifications {:#visibility-specifications}

All rule targets have a `visibility` attribute that takes a list of labels. Each
label has one of the following forms. With the exception of the last form, these
are just syntactic placeholders that do not correspond to any actual target.

*   `"//visibility:public"`: Grants access to all packages. (May not be combined
    with any other specification.)

*   `"//visibility:private"`: Does not grant any additional access; only targets
    in this package can use this target. (May not be combined with any other
    specification.)

*   `"//foo/bar:__pkg__"`: Grants access to `//foo/bar` (but not its
    subpackages).

*   `"//foo/bar:__subpackages__"`: Grants access `//foo/bar` and all of its
    direct and indirect subpackages.

*   `"//some_pkg:my_package_group"`: Grants access to all of the packages that
    are part of the given [`package_group`](/reference/be/functions#package_group).

    *   Package groups use a
        [different syntax](/reference/be/functions#package_group.packages) for
        specifying packages. Within a package group, the forms
        `"//foo/bar:__pkg__"` and `"//foo/bar:__subpackages__"` are respectively
        replaced by `"//foo/bar"` and `"//foo/bar/..."`. Likewise,
        `"//visibility:public"` and `"//visibility:private"` are just `"public"`
        and `"private"`.

For example, if `//some/package:mytarget` has its `visibility` set to
`[":__subpackages__", "//tests:__pkg__"]`, then it could be used by any target
that is part of the `//some/package/...` source tree, as well as targets defined
in `//tests/BUILD`, but not by targets defined in `//tests/integration/BUILD`.

**Best practice:** To make several targets visible to the same set
of packages, use a `package_group` instead of repeating the list in each
target's `visibility` attribute. This increases readability and prevents the
lists from getting out of sync.

Note: The `visibility` attribute may not specify non-`package_group` targets.
Doing so triggers a "Label does not refer to a package group" or "Cycle in
dependency graph" error.

### Rule target visibility {:#rule-target-visibility}

A rule target's visibility is:

1. The value of its `visibility` attribute, if set; or else

2. The value of the
[`default_visibility`](/reference/be/functions#package.default_visibility)
argument of the [`package`](/reference/be/functions#package) statement in the
target's `BUILD` file, if such a declaration exists; or else

3. `//visibility:private`.

**Best practice:** Avoid setting `default_visibility` to public. It may be
convenient for prototyping or in small codebases, but the risk of inadvertently
creating public targets increases as the codebase grows. It's better to be
explicit about which targets are part of a package's public interface.

#### Example {:#rule-target-visibility-example}

File `//frobber/bin/BUILD`:

```python
# This target is visible to everyone
cc_binary(
    name = "executable",
    visibility = ["//visibility:public"],
    deps = [":library"],
)

# This target is visible only to targets declared in the same package
cc_library(
    name = "library",
    # No visibility -- defaults to private since no
    # package(default_visibility = ...) was used.
)

# This target is visible to targets in package //object and //noun
cc_library(
    name = "subject",
    visibility = [
        "//noun:__pkg__",
        "//object:__pkg__",
    ],
)

# See package group "//frobber:friends" (below) for who can
# access this target.
cc_library(
    name = "thingy",
    visibility = ["//frobber:friends"],
)
```

File `//frobber/BUILD`:

```python
# This is the package group declaration to which target
# //frobber/bin:thingy refers.
#
# Our friends are packages //frobber, //fribber and any
# subpackage of //fribber.
package_group(
    name = "friends",
    packages = [
        "//fribber/...",
        "//frobber",
    ],
)
```

### Generated file target visibility {:#generated-file-target-visibility}

A generated file target has the same visibility as the rule target that
generates it.

### Source file target visibility {:#source-file-target-visibility}

You can explicitly set the visibility of a source file target by calling
[`exports_files`](/reference/be/functions#exports_files). When no `visibility`
argument is passed to `exports_files`, it makes the visibility public.
`exports_files` may not be used to override the visibility of a generated file.

For source file targets that do not appear in a call to `exports_files`, the
visibility depends on the value of the flag
[`--incompatible_no_implicit_file_export`](https://github.com/bazelbuild/bazel/issues/10225){: .external}:

*   If the flag is set, the visibility is private.

*   Else, the legacy behavior applies: The visibility is the same as the
    `BUILD` file's `default_visibility`, or private if a default visibility is
    not specified.

Avoid relying on the legacy behavior. Always write an `exports_files`
declaration whenever a source file target needs non-private visibility.

**Best practice:** When possible, prefer to expose a rule target rather than a
source file. For example, instead of calling `exports_files` on a `.java` file,
wrap the file in a non-private `java_library` target. Generally, rule targets
should only directly reference source files that live in the same package.

#### Example {:#source-file-visibility-example}

File `//frobber/data/BUILD`:

```python
exports_files(["readme.txt"])
```

File `//frobber/bin/BUILD`:

```python
cc_binary(
  name = "my-program",
  data = ["//frobber/data:readme.txt"],
)
```

### Config setting visibility {:#config-setting-visibility}

Historically, Bazel has not enforced visibility for
[`config_setting`](/reference/be/general#config_setting) targets that are
referenced in the keys of a [`select()`](/reference/be/functions#select). There
are two flags to remove this legacy behavior:

*   [`--incompatible_enforce_config_setting_visibility`](https://github.com/bazelbuild/bazel/issues/12932){: .external}
    enables visibility checking for these targets. To assist with migration, it
    also causes any `config_setting` that does not specify a `visibility` to be
    considered public (regardless of package-level `default_visibility`).

*   [`--incompatible_config_setting_private_default_visibility`](https://github.com/bazelbuild/bazel/issues/12933){: .external}
    causes `config_setting`s that do not specify a `visibility` to respect the
    package's `default_visibility` and to fallback on private visibility, just
    like any other rule target. It is a no-op if
    `--incompatible_enforce_config_setting_visibility` is not set.

Avoid relying on the legacy behavior. Any `config_setting` that is intended to
be used outside the current package should have an explicit `visibility`, if the
package does not already specify a suitable `default_visibility`.

### Package group target visibility {:#package-group-target-visibility}

`package_group` targets do not have a `visibility` attribute. They are always
publicly visible.

### Visibility of implicit dependencies {:#visibility-implicit-dependencies}

Some rules have [implicit dependencies](/extending/rules#private_attributes_and_implicit_dependencies) —
dependencies that are not spelled out in a `BUILD` file but are inherent to
every instance of that rule. For example, a `cc_library` rule might create an
implicit dependency from each of its rule targets to an executable target
representing a C++ compiler.

Currently, for visibility purposes these implicit dependencies are treated like
any other dependency. This means that the target being depended on (such as our
C++ compiler) must be visible to every instance of the rule. In practice this
usually means the target must have public visibility.

You can change this behavior by setting
[`--incompatible_visibility_private_attributes_at_definition`](https://github.com/bazelbuild/proposals/blob/master/designs/2019-10-15-tool-visibility.md){: .external}. When enabled, the
target in question need only be visible to the rule declaring it an implicit
dependency. That is, it must be visible to the package containing the `.bzl`
file in which the rule is defined. In our example, the C++ compiler could be
private so long as it lives in the same package as the definition of the
`cc_library` rule.

## Load visibility {:#load-visibility}

**Load visibility** controls whether a `.bzl` file may be loaded from other
`BUILD` or `.bzl` files outside the current package.

In the same way that target visibility protects source code that is encapsulated
by targets, load visibility protects build logic that is encapsulated by `.bzl`
files. For instance, a `BUILD` file author might wish to factor some repetitive
target definitions into a macro in a `.bzl` file. Without the protection of load
visibility, they might find their macro reused by other collaborators in the
same workspace, so that modifying the macro breaks other teams' builds.

Note that a `.bzl` file may or may not have a corresponding source file target.
If it does, there is no guarantee that the load visibility and the target
visibility coincide. That is, the same `BUILD` file might be able to load the
`.bzl` file but not list it in the `srcs` of a [`filegroup`](/reference/be/general#filegroup),
or vice versa. This can sometimes cause problems for rules that wish to consume
`.bzl` files as source code, such as for documentation generation or testing.

For prototyping, you may disable load visibility enforcement by setting
`--check_bzl_visibility=false`. As with `--check_visibility=false`, this should
not be done for submitted code.

Load visibility is available as of Bazel 6.0.

### Declaring load visibility {:#declaring-load-visibility}

To set the load visibility of a `.bzl` file, call the
[`visibility()`](/rules/lib/globals/bzl#visibility) function from within the file.
The argument to `visibility()` is a list of package specifications, just like
the [`packages`](/reference/be/functions#package_group.packages) attribute of
`package_group`. However, `visibility()` does not accept negative package
specifications.

The call to `visibility()` must only occur once per file, at the top level (not
inside a function), and ideally immediately following the `load()` statements.

Unlike target visibility, the default load visibility is always public. Files
that do not call `visibility()` are always loadable from anywhere in the
workspace. It is a good idea to add `visibility("private")` to the top of any
new `.bzl` file that is not specifically intended for use outside the package.

### Example {:#load-visibility-example}

```python
# //mylib/internal_defs.bzl

# Available to subpackages and to mylib's tests.
visibility(["//mylib/...", "//tests/mylib/..."])

def helper(...):
    ...
```

```python
# //mylib/rules.bzl

load(":internal_defs.bzl", "helper")
# Set visibility explicitly, even though public is the default.
# Note the [] can be omitted when there's only one entry.
visibility("public")

myrule = rule(
    ...
)
```

```python
# //someclient/BUILD

load("//mylib:rules.bzl", "myrule")          # ok
load("//mylib:internal_defs.bzl", "helper")  # error

...
```

### Load visibility practices {:#load-visibility-practices}

This section describes tips for managing load visibility declarations.

#### Factoring visibilities {:#factoring-visibilities}

When multiple `.bzl` files should have the same visibility, it can be helpful to
factor their package specifications into a common list. For example:

```python
# //mylib/internal_defs.bzl

visibility("private")

clients = [
    "//foo",
    "//bar/baz/...",
    ...
]
```

```python
# //mylib/feature_A.bzl

load(":internal_defs.bzl", "clients")
visibility(clients)

...
```

```python
# //mylib/feature_B.bzl

load(":internal_defs.bzl", "clients")
visibility(clients)

...
```

This helps prevent accidental skew between the various `.bzl` files'
visibilities. It also is more readable when the `clients` list is large.

#### Composing visibilities {:#composing-visibilities}

Sometimes a `.bzl` file might need to be visible to an allowlist that is
composed of multiple smaller allowlists. This is analogous to how a
`package_group` can incorporate other `package_group`s via its
[`includes`](/reference/be/functions#package_group.includes) attribute.

Suppose you are deprecating a widely used macro. You want it to be visible only
to existing users and to the packages owned by your own team. You might write:

```python
# //mylib/macros.bzl

load(":internal_defs.bzl", "our_packages")
load("//some_big_client:defs.bzl", "their_remaining_uses")

# List concatenation. Duplicates are fine.
visibility(our_packages + their_remaining_uses)
```

#### Deduplicating with package groups {:#deduplicating-with-package-groups}

Unlike target visibility, you cannot define a load visibility in terms of a
`package_group`. If you want to reuse the same allowlist for both target
visibility and load visibility, it's best to move the list of package
specifications into a .bzl file, where both kinds of declarations may refer to
it. Building off the example in [Factoring visibilities](#factoring-visibilities)
above, you might write:

```python
# //mylib/BUILD

load(":internal_defs", "clients")

package_group(
    name = "my_pkg_grp",
    packages = clients,
)
```

This only works if the list does not contain any negative package
specifications.

#### Protecting individual symbols {:#protecting-individual-symbols}

Any Starlark symbol whose name begins with an underscore cannot be loaded from
another file. This makes it easy to create private symbols, but does not allow
you to share these symbols with a limited set of trusted files. On the other
hand, load visibility gives you control over what other packages may see your
`.bzl file`, but does not allow you to prevent any non-underscored symbol from
being loaded.

Luckily, you can combine these two features to get fine-grained control.

```python
# //mylib/internal_defs.bzl

# Can't be public, because internal_helper shouldn't be exposed to the world.
visibility("private")

# Can't be underscore-prefixed, because this is
# needed by other .bzl files in mylib.
def internal_helper(...):
    ...

def public_util(...):
    ...
```

```python
# //mylib/defs.bzl

load(":internal_defs", "internal_helper", _public_util="public_util")
visibility("public")

# internal_helper, as a loaded symbol, is available for use in this file but
# can't be imported by clients who load this file.
...

# Re-export public_util from this file by assigning it to a global variable.
# We needed to import it under a different name ("_public_util") in order for
# this assignment to be legal.
public_util = _public_util
```

#### bzl-visibility Buildifier lint {:#bzl-visibility-buildifier-lint}

There is a [Buildifier lint](https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#bzl-visibility)
that provides a warning if users load a file from a directory named `internal`
or `private`, when the user's file is not itself underneath the parent of that
directory. This lint predates the load visibility feature and is unnecessary in
workspaces where `.bzl` files declare visibilities.

repository: bazelbuild/bazel

repo_name: bazelbuild/bazel


text:
# Swinger-Man
This is the Super Meat Boy of Spider-Man experiences. A game for hard-core swingers only. The ropes are tight, the curves are smooth and the concrete WILL keep punishing your face until you get it right.

Visit the store pages for more information.

![screenshot01](images/screenshot01_small.jpg)

## Store links
- [Swinger-Man on Steam](https://store.steampowered.com/app/1156680/SwingerMan/)
- [Swinger-Man on Oculus Store](https://www.oculus.com/experiences/rift/2414647548548968)

## Documents
- [Privacy policy](privacy-policy.md)
- [Terms of Service](terms-of-service.md)

## Support and feedback
Please post questions and feedback at [reddit.com/r/SwingerMan/](https://www.reddit.com/r/SwingerMan/).

repository: angularsen/swingerman-website

repo_name: angularsen/swingerman-website


text:
emqttd_plugin_kafka_bridge
===================

Emqttd kafka bridge Plugin, a bridge transfer messages from emqtt to kafka.

Build Plugin
------------

Add the plugin as submodule of emqttd project.

If the submodules exist:

```
git submodule update --remote plugins/emqttd_plugin_kafka_bridge
```

Orelse:

```
git submodule add https://github.com/vowstar/emqttd_plugin_kafka_bridge.git plugins/emqttd_plugin_kafka_bridge
```

And then build emqttd project.

Configure Plugin
----------------
TODO: Move broker list to here

File: etc/plugin.config

```erlang
[
  {emqttd_plugin_kafka_bridge, [
  	{kafka, [
      {bootstrap_broker, {"<IP_ADDRESS>", 9092} },
      {partition_strategy, strict_round_robin}
    ]}
  ]}
].

```

Broker URL and port setting:
-----------
``bootstrap_broker, {"<IP_ADDRESS>", 9092} ``

Partition strategy setting:
-----------
Round robin

``partition_strategy, strict_round_robin``

Random

``partition_strategy, random``

Load Plugin
-----------

```
./bin/emqttd_ctl plugins load emqttd_plugin_kafka_bridge
```

Kafka Topic and messages
-----------

### Topic

All message will be published on to kafka's ``broker_message`` Topic.

### Messages

In the following circumstances, you will receive kafka messages

- when a client connected broker

- when a client disconnected broker

- when a client subscribed a channel

- when a client unsubscribed a channel

- when a client published a message to a channel

- when a client delivered a message

- when a client acknowledged a messages

All these message will published on to kafka.

#### Connected

```json
{
	"type":"connected",
	"client_id":"a client id",
	"cluster_node":"which emqtt node",
	"ts":1469690427
}
```
Note: key "ts" is unix timestamp.

#### Disconnected

```json
{
	"type":"disconnected",
	"client_id":"a client id",
	"reason":"reason why disconnected",
	"cluster_node":"which emqtt node",
	"ts":1469690427
}
```

#### Subscribed

```json
{
	"type":"subscribed",
	"client_id":"a client id",
	"topic":"which topic",
	"cluster_node":"which emqtt node",
	"ts":1469690427
}
```

#### Unsubscribed

```json
{
	"type":"unsubscribed",
	"client_id":"a client id",
	"topic":"which topic",
	"cluster_node":"which emqtt node",
	"ts":1469690427
}
```

#### Published

```json
{
	"type":"published",
	"client_id":"a client id",
	"topic":"which topic",
    "payload":"payload of message",
    "qos":1,
	"cluster_node":"which emqtt node",
	"ts":1469690427
}
```
Note: key "Qos" is QoS level of message.

#### Delivered

```json
{
	"type":"delivered",
	"client_id":"a client id",
	"form":"from client id",
	"topic":"which topic",
    "payload":"payload of message",
    "qos":1,
	"cluster_node":"which emqtt node",
	"ts":1469690427
}
```

#### Acknowledged

```json
{
	"type":"acked",
	"client_id":"a client id",
	"form":"from client id",
	"topic":"which topic",
    "payload":"payload of message",
    "qos":1,
	"cluster_node":"which emqtt node",
	"ts":1469690427
}
```

Author
------

Huang Rui<EMAIL_ADDRESS>
https://www.devicexx.com

Thanks
------
This project is based on the code of:

Erlang MQTT Broker [EMQTTD](https://github.com/emqtt/emqttd)

Helpshift Ekaf [ekaf](https://github.com/helpshift/ekaf)

And learn ideas form:

Gao dongchen's [emqttd_plugin_blackhole](https://github.com/gaodongchen/emqttd_plugin_blackhole)

Abhishek Chawla's [emqttd_publish_client_activity](https://github.com/abhidtu/emqttd_publish_client_activity)


text:
---
title: jQuery upload preview (HTML5)
author: PipisCrew
date: 2020-01-17
categories: [js]
toc: true
---

To get access to the not uploaded data, we can use the HTML5 file reader api. This api provides reading local files. This step is pretty important, because we need to this data in order to show it in the browser window.

https://github.com/opoloo/jquery_upload_preview

origin - https://www.pipiscrew.com/?p=16589 jquery-upload-preview-html5


text:
# Changelog

## v0.2 (February 8, 2014)
* Bugfix: Multiple single character options print together
* Bugfix: Exit on Ctrl+C
* Feature: Check for unknown option and free space errors
* Feature: Comment lines and empty lines allowed in profiles
* Feature: Pushover support in .rsink/tools
* Feature: Single character options system
* Feature: [Pushover] [1] option (`-p` or `--pushover`)
* Feature: Dry-run (`-d` or `--dry-run`) option
* Feature: Help (`-h` or `--help`) option
* Feature: Silent (`-s` or `--silent`) option
* Feature: Version (`-v` or `--version`) option
* Feature: [Versioned backup] [2] profile using `rsync --link-dest`
* Feature: Constants stored in .rsink/constants.sh

## v0.1 (December 12, 2013)
* Initial release
* Automatic install
* `rsink.sh` with config and profiles
* OS X, Linux support

[1]: https://pushover.net/
[2]: http://blog.interlinked.org/tutorials/rsync_time_machine.html

repository: druska/rsink

repo_name: druska/rsink


text:
* Done something? Tick it off.
* Current goals all checked? Message @Lupus590 to update the todo list. (You can also have your pick of the backlog)
* Got a comment on something here? If it's short then add it (don't forget to sign your username), if it's a bit longer then make an issue about it.

## Priority Goal
#### If you can do this then please do it
* [ ] todo to issues? use github project? each item to do will be a seperate issue (thats a lot of issues)
 * will need a priority system
 * how to do sub tasks? issues are for big tasks? several seperate github projects?
 * can have tags (design/coding/bug/etc)

## Current Goals
* [ ] check links in all documents
* [ ] Move docs to wiki?
* [ ] apply this: https://en.wikipedia.org/wiki/MoSCoW_method
* [ ] implement Hive turtle tracking
* [ ] Howl-CI caches howl code builder download
* [ ] organise documentation
 * [ ] contents section for https://github.com/CC-Hive/Main/blob/master/Specification,%20Design%20and%20Ideas/Misc/Misc%20Links.md
 * [ ] cleanup useless info on links in https://github.com/CC-Hive/Main/blob/master/Specification,%20Design%20and%20Ideas/Misc/Misc%20Links.md
 * [ ] merge map.md into https://github.com/CC-Hive/Main/blob/master/Specification,%20Design%20and%20Ideas/Misc/Misc%20Links.md
 * [ ] make sections subfolders and have multiple smaller files https://github.com/CC-Hive/Main/blob/master/Specification,%20Design%20and%20Ideas/Misc/Misc%20Links.md
 * [ ] finish contributing.md - needs lua code presentation guidlines
 * [ ] copy link into file https://github.com/CC-Hive/Main/blob/master/Specification%2C%20Design%20and%20Ideas/Misc/help%20docs.md

## Backlog Goals
* [ ] additinal/better use cases
* [ ] Howl prepends all resulting lua files with [license](https://github.com/CC-Hive/Main/blob/master/LICENSE.txt), preferably as a sting/table of strings so that it can be printed to the screen if a user requests an about page
* [ ] https://help.github.com/articles/helping-people-contribute-to-your-project/
* [ ] Expand with new things to do
* [ ] choose a path finding program, [starNav](http://www.computercraft.info/forums2/index.php?/topic/19491-) or [egps](http://www.computercraft.info/forums2/index.php?/topic/25856-un-official-egps-developement-mapping-pathfinding-api/) - things like this should be in specification folder
* [ ] clean up md files
* [ ] [Others please review] local coorodinate system for task areas (off set from world coordinates by task location)
* [ ] https://github.com/chocolatey/choco/blob/master/COMMITTERS.md
* [ ] https://github.com/chocolatey/choco/blob/master/CONTRIBUTING.md
* [ ] add to contributing
 * [ ] Steps for creating good issues or pull requests.
 * [ ] Links to external documentation, mailing lists, or a code of conduct.
 * [ ] Community and behavioral expectations.
* [ ] other special files: https://en.wikipedia.org/wiki/README
* [ ] link map in readme, to aid navigation of visitors
* [ ] low priority: decide distribution method, github mile stones? is this possible via a script on pastebin?
* [ ] hive suggests replacing the startup script with one which will call hive and gives three options:
 * have hive replace the script. a backup will be made of any script that was named startup
 * do nothing but ask again next time
 * do nothing and don't ask again
 * if hive is set to run via startup script but is not (ie the script was edited or replaced) then it will ask again (the startup script will have to launch hive in a special way

## Extended Goals
#### Don't work on these until the above are done
* [ ] GUI scales
 * [ ] all GUIs scale to fit screen size
 * [ ] all GUIs work on a pocket computer (with multishell being used)
 * [ ] all GUIs rescale when screen size changes
* [ ] base navigation? http://www.computercraft.info/forums2/index.php?/topic/11067-idea-exchange/page__view__findpost__p__251718 http://www.computercraft.info/forums2/index.php?/topic/27007-a-rather-dapper-mapper-%E2%80%93-satellite-gps-maps/
* [ ] tasks are represented by mini-tasks, some of these can depend on other mini-tasks being compleated before they can be done, some may be done in parallel (e.g. multiple turtles per tasks)
* [ ] Multiple turtles can cooperate on one large task - possible implementations:
 * a turtle acts as a server for other turtles - will make small tasks more usefull as turtles out of range of cental server can get new tasks without going all the way back to base; server-turtle will forward status updates back to cental
  * server-turtle can work too, but what if it runs out of fuel? can't go get more as other turtles need his server part?
   * migrate server to new turtle?
   * wait until no dependents?
   * ask dependent to get fuel for server?
 * peer-to-peer, turtles all have task list and ask eachother "Has anyone done this yet, I'd like to do it?"
 * ~~server manages everything~~
* [ ] metadata support https://github.com/lyqyd/metadata
* [ ] Turtles share pathfinding map data, data is stored on server and turtles pull copies of the map as needed and update the map if the world changes
* [ ] Multi language support, perhaps via a table
* [ ] Turtle Transportation Framework - A way to move turtles via a third party, think teleporting/trains/pipes anything which the turtle is inactive while being transported somewhere
* [ ] First time setup guidence, the different programs give instuctions to the user on required peripherals, how to connect a turtle, etc.
* [ ] Addon or plugin support, third-party code which can change the behavour of Hive in ways which a task can't (override how the server does things)
 * [ ] Plugin and Hive components subscribe to events handlers which use callback functions to notify things of events
* [ ] some programs can be loaded as an an API to access their functionality (example programs: http://pastebin.com/cUYTGbpb)
* [ ] stealth mode, turtles communicate to server via disks. good for pvp servers
* [ ] Package manager for addons/pugins and tasks
* [ ] http://www.computercraft.info/forums2/index.php?/topic/27038-generic-builder/
* [ ] port to OpenComputers? ~~make a CC compatability layer first?~~ http://www.computercraft.info/forums2/index.php?/topic/28381-
* [ ] help docs via help api
* [ ] autocomplete
* [ ] crash reporter which makes issues on github
* [ ] plethora vr/ar interface http://www.computercraft.info/forums2/index.php?/topic/29672-arc-really-simple-plethora-augmented-reality/

url: https://raw.githubusercontent.com/CC-Hive/Main/f71da53b8c669c40a92c5c7c349619de2ba09f70/old docs/Specification, Design and Ideas/Todo's/TODO.md

repository: CC-Hive/Main

gha_language: Lua

repo_name: CC-Hive/Main


text:
## Lambdas

Kotlin supports a functional style of programming.
Read about [higher-order functions and function literals (lambdas)](http://kotlinlang.org/docs/reference/lambdas.html) in Kotlin.

Pass a lambda to [`any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/kotlin.-iterable/any.html)
function to check if the collection contains an even number.
The function `any` gets a predicate as an argument and returns true if there is at least one element satisfying the predicate.

gha_language: Kotlin


text:
# Quick Setup

The quickest way to get started with our ecosystem is to try out one of our pre-configured **component generators**.

Install one of the following:
```bash
npm install @teleporthq/teleport-component-generator-react
npm install @teleporthq/teleport-component-generator-vue
```
or using yarn:
```bash
yarn add @teleporthq/teleport-component-generator-react
yarn add @teleporthq/teleport-component-generator-vue
```

For generating a component, you have to start from a **component UIDL**:

```json
{
  "name": "My First Component",
  "node": {
    "type": "element",
    "content": {
      "elementType": "text",
      "children": [
        {
          "type": "static",
          "content": "Hello World!"
        }
      ]
    }
  }
}
```

:::tip
You can play with the UIDL structure on the [online REPL](https://repl.teleporthq.io/)
:::

To use the pre-configured component generators you have to create your generator instance and call the `generateComponent` *async* function:

```javascript
import { createReactComponentGenerator } from '@teleporthq/teleport-component-generator-react'

const uidl = { ... } // your sample here
const generator = createReactComponentGenerator();
const { files } = await generator.generateComponent(uidl)
console.log(files[0].content)
```
The console output will be something like:
```javascript
import React from 'react'

const MyFirstComponent = (props) => {
  return <span>Hello World!</span>
}

export default MyFirstComponent
```

For the `Vue` generator, just switch the package:
```javascript
import { createVueComponentGenerator } from '@teleporthq/teleport-component-generator-vue'

const uidl = { ... } // your sample here
const generator = createVueComponentGenerator();
const { files } = await generator.generateComponent(uidl)
console.log(files[0].content)
```
The console output will be something like:
```vue
<template>
  <span>Hello World!</span>
</template>

<script>
export default {
  name: 'MyFirstComponent',
}
</script>
```

repository: teleporthq/teleport-documentation

branch_name: refs/heads/development

gha_language: JavaScript

repo_name: teleporthq/teleport-documentation


text:
Easy Word Cloud using D3
========================

There is an amazing [D3](http://www.d3js.org/)
[wordcloud plugin](https://github.com/jasondavies/d3-cloud)
for creating beautiful wordclouds. But it's not trivial for everyone
to put it to use. This plugin makes it easy to create such a wordcloud.

![](example/example.png)

Usage
-----

A simple html page with a wordcloud might contain:

```html
<html>
  <head>
    <title>Word Cloud</title>
    <script src="lib/d3/d3.js"></script>
    <script src="lib/d3/d3.layout.cloud.js"></script>
    <script src="d3.wordcloud.js"></script>
  </head>
  <body>
    <div id='wordcloud'></div>
    <script>
      d3.wordcloud()
        .size([800, 400])
        .selector('#wordcloud')
        .words([{text: 'word', size: 5}, {text: 'cloud', size: 15}])
        .start();
    </script>
  </body>
</html>
```

That's all! The following properties are accepted:
* `selector()` which css selector to create the wordcloud on
* `element()` an element instead of the previous selector
* `scale()` a d3 scale for sizing words, e.g. `sqrt`, `log` or `linear`
* `fill()` a d3 scale for coloring words, e.g. `d3.scale.category20b()`
* `transitionDuration()` how many milliseconds a resize transation takes

In addition to this, the following d3-cloud properties are accepted:
* `size()` dimensions [width, height]
* `words()` array of `{text: 'word', size: 1}` hashes
* `font()`
* `fontStyle()`
* `fontWeight()`
* `spiral()`, which can be `archimedean` or `rectangular`
* `padding()`

As a bonus, if a word contains a `href` key, the word will link to the value,
and the word will become slightly larger when the mouse hovers over (to
indicate that it is clickable, in addition to the mouse hand pointer).

Links
-----
* The original [d3-cloud](https://github.com/jasondavies/d3-cloud) plugin
* [d3-wordcloud](https://github.com/shprink/d3js-wordcloud), example of how to use d3-cloud that this plugin is based on
* [Article on using d3-cloud](https://weblogs.java.net/blog/manningpubs/archive/2014/11/10/d3-making-word-cloud-effective-graphical-object)
* Java-based [wordle.net](http://wordle.net), which has inspired the d3-cloud plugin

repository: jonatasgrosman/eras

repo_name: jonatasgrosman/eras


text:
Installation
------------

1. Add this extension to your Gemfile:
  ```ruby
  gem 'spree_promo_users_codes', github: 'rubyonrailsdeveloper/spree_promo_user_code'
  ```
2. Bundle your dependencies and run the installation generator:

  ```shell
  bundle
  bundle exec rails g spree_promo_users_codes:install
  ```


text:
# 1. Functions

Every program in Serene is required to have a `main` function. Here is a basic example of a `main` function that prints "Hello world!" on a new line.

``` serene
function main() {
    print "Hello world!"
}
```

In Serene, the body of a function is a sequence of statements, each beginning with a keyword.  Let's define another function that takes a parameter and also returns a value. The `invert` function is pretty trivial, but it shows what a typical function signature looks like. Note that the types of both the parameters and return values must be specified.

```serene
function invert(b: Bool) -> Bool {
	return (not b)
}

function main() {
	run invert(True)			//return value is discarded
	print invert(True) 			//return value is printed
}
```

Remember that the body of a function is a sequence of statements: `invert(True)` on its own isn't a statement, so we use the `run` keyword to execute it.