teleren/devto huggingface dataset:
Creating a Vuejs Plugin
Tags: vue, database, pouchdb, javascript
Published: 2018-06-21 08:03:54

---
title: Creating a Vuejs Plugin
published: true
tags: vuejs,database,pouchdb,javascript
canonical_url: 
---

#### Plugin to help us work with PouchDB in a Vuejs application

![](https://cdn-images-1.medium.com/max/1024/1*GRM7VUZFA-y4cR4gFPB_lA.jpeg)<figcaption>awesome vuejs image</figcaption>

This post assumes that you at least have some working knowledge of [Vuejs](https://vuejs.org/v2/guide/index.html) and [PouchDB](https://pouchdb.com/getting-started.html).

Don’t worry i'm not going to tell you to install 1000 things before you get started. All you need is [Vuejs](https://vuejs.org/js/vue.js) and [PouchDB](https://github.com/pouchdb/pouchdb/releases/download/6.0.7/pouchdb-6.0.7.js).

Plugins provides a way for you to add global-level functionality to Vue. For example Vue by itself doesn’t have a built-in routing system. Vue-router plugin adds a routing functionality to Vue. There are very few resources on how to create a vuejs plugin, so i hope this will help.

Before diving into the details of building, have a look at how you will be able to use this plugin we are about to make.

{% gist https://gist.github.com/sadick254/371521954633d075aa297ce3240e5b57 %}

#### Initializing a plugin

A Vue.js plugin should expose an install method. The method will be called with the Vueconstructor as the first argument, along with possible options.

{% gist https://gist.github.com/sadick254/e0fc6ec39413a33ab12e16ae170d5050 %}

#### Defining a Mixin

Mixins are a flexible way to distribute reusable functionalities for Vue components.

{% gist https://gist.github.com/sadick254/cfa05cea53448f2ef4b512e8bf868211 %}

Note the beforeCreate property. This is an event that gets emitted by vuejs before the initialization of the vue instance properties and methods. The init is a function which you will be creating next.

{% gist https://gist.github.com/sadick254/78ee036b2b4dc27de4c46e5d8fea133a %}

In the init function we get the pouchdb option that is set in a vue instance. You will use the ensureRef function to set the $pouchdbRefs property which will hold a reference to the PouchDB object.

{% gist https://gist.github.com/sadick254/3c104a6335e1f0aef08a7880f45405e3 %}

Now the interesting part. You will create the bind function which its main responsibility will be to make the data from PouchDB reactive.

{% gist https://gist.github.com/sadick254/8a746e877bd3bbaa6dd3184f264d5caf %}

One last thing you need to do is notify Vue that it should track changes made on the PouchDB data. The defineReactive function will be responsible for that part. You will use the util from vue to define the reactivity.

{% gist https://gist.github.com/sadick254/a6730a6c62ee79aa7fd660661ad51f4f %}

#### Bringin it all together

{% gist https://gist.github.com/sadick254/c74ea35c2f62c2a5cc02de4778f12768 %}

You can find the project at [github](https://github.com/sadick254/vuepouch) contributions are welcomed.
Hi, I'm Josh Evenson
Tags: introductions
Published: 2016-11-18 14:57:58

---
title: Hi, I'm Josh Evenson
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 6 years.

You can find me on GitHub as [@jevenson](https://github.com/jevenson)

I live in Plover, WI.

I work for Berkshire Hathaway Travel Protection

I mostly program in these languages: C#, TypeScript.

I am currently learning more about Angular 2.

Nice to meet you.
Hi, I'm shine
Tags: introductions
Published: 2016-11-18 01:18:00

---
title: Hi, I'm shine
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 5 years.

You can find me on GitHub as [@](https://github.com/ShineShe)

I live in [changsha].

I work for [allfrombit]

I mostly program in these languages: [C].

I am currently learning more about [ffmpeg].

Nice to meet you.
Hi, I'm Randy Daw-Ran Liou
Tags: introductions
Published: 2016-11-18 01:12:21

---
title: Hi, I'm Randy Daw-Ran Liou
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding professionally for 3 years.

You can find me on Twitter as [@dawranliou](https://twitter.com/dawranliou)

I live in the SF Bay Area.

I work for KLA-Tencor

I mostly program in these languages: Python!

I am currently learning more about Data Science and Web Development.

Nice to meet you.
Hi, I'm Naveen
Tags: introductions
Published: 2016-11-17 03:10:44

---
title: Hi, I'm Naveen
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for more than 7 years.

You can find me on Twitter as [@k_nav](https://twitter.com/k_nav)

I live in Singapore.

I mostly program in these languages: C#.

I am currently learning more about Object oriented programming, dot Net Framework, Windows presentation foundation, SQL, Agile methodologies. 

Nice to meet you all.
Hi, I'm 
Tags: introductions
Published: 2016-11-17 01:20:58

---
title: Hi, I'm 
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for [number] years.

You can find me on GitHub as [@](https://github.com/)

I live in [city].

I work for [company]

I mostly program in these languages: [languages].

I am currently learning more about [topic].

Nice to meet you.
Kottpd — HTTP Server in pure Kotlin
Tags: kotlin, https, java, restapi
Published: 2018-03-03 08:51:33

---
title: "Kottpd — HTTP Server in pure Kotlin"
published: true
tags: kotlin,https,java,rest-api
canonical_url: 
---

In today’s post I would like to talk about one of the projects I’m working on. I define it as light **HTTP framework** and it is made in pure [**Kotlin**](http://kotlinlang.org/). Based on these two facts I’ve named it&nbsp;[**kottpd**](https://github.com/gimlet2/kottpd).

This project was born during long bus ride. There was no Internet and I decided to write something without external dependencies. What could be better then implementing well-known text-based protocol?!

Not all pieces were easy to find in the palaces of the mind but in couple of hours first version was ready to serve standard HTTP queries. The design of API was made with inspiration from **Spark-Java**. So, it looks quite&nbsp;similar.

What we could find under the hood? First of all it is Cached ThreadsPool. It helps to allocate and reuse threads for each HTTP request. Then in infinite loop the server waits for incoming connections, reads it, tries to match against configured routes and passes to corresponding handler if found. Beside request handlers you could also specify **Before** and **After** filters to implement some sort of middleware(for example — login, transactions, etc.).

#### What for is it&nbsp;useful?

Well, it could be used if you want to make a web application, or an **REST API** , or just to serve a static content(it supports that too!). But you want to do it in a lightweight way. And you like **Kotlin**! That it is a perfect choice for you. Have I mentioned it supports&nbsp; **SSL**?

To explain it better let me show you an example that could be easily found in the README file. But first of all you need to add it as a dependency to your project. The library is published into maven central repository, so you should not face any issues with&nbsp;it.

{% gist https://gist.github.com/gimlet2/fbc638616846a3ec19dbb5d914c9af25 %}

Here we create an instance of _Server_ class, define path to the folder with static content we want our server to serve. Then we define several request handlers(yes, you could use regular expressions for that). And then there is a block with filters. They could be global — when there is no specific path defined — and path specific. And of course you could define some exception handlers too. The only thing is left to be done — call _start()_ method. By default your application will listen on the **port 9000**. But you could just pass any port value you want as argument to _start()_ method or define it with server.port system property(_-Dserver.port=8080_).

#### Conclusion

I hope you got interested with my project. Please, try to use it in your applications and I will be really happy to see any feedback from you. If you have never used Kotlin before, it is a good moment to&nbsp;start!

Do Kotlin — do the&nbsp;Web!
The Trusted Packaging Index
Tags: python, packaging, pypi
Published: 2019-07-05 03:19:51

---
title: The Trusted Packaging Index
published: true
tags: python, packaging, pypi
canonical_url: https://tryexceptpass.org/article/the-trusted-packaging-index/
cover_image: https://tryexceptpass.org/images/trusted-packaging-index.jpeg
---

### A proposal for funding PyPI infrastructure and development

A few days ago, I was listening to the latest episode of [Talk Python To Me: Are we failing to fund Python’s core infrastructure?](https://talkpython.fm/episodes/show/84/are-we-failing-to-fund-python-s-core-infrastructure), which had a panel of guests from the [Python Software Foundation](https://www.python.org/psf/), [PyPI](https://pypi.org/) and [Read The Docs](https://readthedocs.org/). As someone that writes open source code, the topic of sustainability is always floating around in my mind. Being able to mostly work on the things that tickle my brain would definitely be awesome, but even if you had a fantastically successful project — which I don’t — it still is extraordinarily difficult to achieve.

I always wondered how organizations like the PSF made it all work, especially with infrastructure and systems that have the level of traffic we see in PyPI. The closest parallel I can draw is to research projects, where a considerable amount of time is dedicated towards finding the _right_ kind of funding.

[Read on ...](https://tryexceptpass.org/article/the-trusted-packaging-index/)
Bash on Ubuntu on Windows + オールインワンmintty
Tags: bash, windows10, bashonubuntuonwindows
Published: 2016-11-15 06:31:00

---
title: Bash on Ubuntu on Windows + オールインワンmintty
published: true
tags: Bash, Windows10, BashOnUbuntuOnWindows
date: 20161115T06:31Z
canonical_url: https://qiita.com/shiena/items/b8036514c217000a221e
---
# はじめに

先日、mattnさんが[Bash on Ubuntu on Windows の最高の端末環境を教えてやるからちょっと来い。](http://mattn.kaoriya.net/software/bow/20160824234928.htm)と素晴しい記事を書かれていたのですが、[cbwin](https://github.com/xilun/cbwin)も一緒に使えないかと思っていたら既に統合されたものがありました！！！

* [wsl-terminal](https://github.com/goreliu/wsl-terminal)

# インストール

[wsl-terminal/release](https://github.com/goreliu/wsl-terminal/releases)から最新の7zもしくはzipをダウンロードして任意のフォルダーに展開するだけです。

# 使い方

* `open-wsl.exe`をWindowsから実行するとminttyが起動します。
* `tools/add-open-wsl-here-menu.js`を実行するとエクスプローラのコンテキストメニューからminttyを実行できます。
* `run-wsl-file.exe`をWindowsから実行すると`.sh`などのスクリプトを実行できます。

## ログインシェルとして実行したい！

デフォルトのままではログインシェルではないので実行パスが起動時のカレントディレクトリになっていますが、minttyから使うときはログインシェルにしたいものです。
その場合は以下の設定でログインシェルとしてbashを実行してホームディレクトリから起動できます。

### v0.5.1より後のバージョン

2016/9/9現在、まだリリースされていませんが、以下のコミットでopen-wsl.exeに`-l`オプションが追加されたので、これを利用します。
https://github.com/goreliu/wsl-terminal/commit/1b1b74b85f54dafb57c999e4c46bf0e756a96a96
https://github.com/goreliu/wsl-terminal/commit/7d0a8832acf00f0678063c4fddd83ecd35102e5e

### v0.5.1以前のバージョン

wsl-terminal.confの`shell`を上記のコミットと同じようなコマンドに変更します。

```ini:etc/wsl-terminal.conf
[config]
title="        "
shell=bash -c "cd; bash -l"
use_cbwin=0
use_tmux=0
```

## cbwin

wsl-terminalの`bin`フォルダーに[cbwin](https://github.com/xilun/cbwin)が同梱されています。
Bash on Ubuntu on Windows側からインストーラを実行して`etc/wsl-terminal.conf`の`use_cbwin`を`1`に設定すればwcmd(Windowsのcmd)とwstart(Windowsのstart)を使うことができます。

```shell-session:インストール
cd bin && sudo ./install_cbwin.sh
```

```ini:etc/wsl-terminal.conf
[config]
title="        "
shell=bash
use_cbwin=1
use_tmux=0
```

以上でminttyを使いつつWindowsのコマンドを実行することもできる環境の完成です。
Demonstrating IoT at SAP TechEd Barcelona
Tags: usecases, cloud, iot
Published: 2020-11-19 14:09:30

---
title: Demonstrating IoT at SAP TechEd Barcelona
published: true
date: 2016-11-15 06:00:00 UTC
tags: UseCases,cloud,iot
canonical_url: https://solace.com/blog/demonstrating-iot-sap-teched-barcelona/
---

 ![Further thoughts on FPGA co-processing and performance](https://solace.com/wp-content/uploads/2019/08/solace-default-blog-thumbnail-600x285.jpg)

Last week I attended SAP TechEd in Barcelona. As a strategic partner of SAP, Solace had a booth where I had set up an Internet of Things demo. It consisted of a toy train carrying a sensor which collected information about temperature, direction and speed, and sent the data to a Raspberry Pi via Bluebooth. The Raspberry Pi in turn published this information to a topic in a Solace appliance in London using the MQTT protocol. A consumer represented by a Java program deployed locally on my Macbook in Barcelona subscribed to the topic and provisioned an influx database, which was used by a Grafana Dashboard to display the sensor information.

Here is the architecture of the demo:  
 ![sap-teched-demo-architecture](https://solace.com/wp-content/uploads/2016/11/sap-teched-demo-architecture.png)

This simple demo illustrated the ability of Solace to easily provide a pub/sub architecture that’s robust, scalable and highly available. On top of this, Solace serving as the messaging back-bone of SAP Hana Cloud Platform was another real life example of the reliability of our solution, being used already in many SAP datacenters worldwide.

Tweets of the demo:

> Our [#iot](https://twitter.com/hashtag/iot?src=hash&ref_src=twsrc%5Etfw) demo is ready! Come to the [#solacedotcom](https://twitter.com/hashtag/solacedotcom?src=hash&ref_src=twsrc%5Etfw) booth [#SAPTechEd](https://twitter.com/hashtag/SAPTechEd?src=hash&ref_src=twsrc%5Etfw) [pic.twitter.com/Vr12AC96It](https://t.co/Vr12AC96It)
> 
> — Magali Boulet (@MagaliBoulet) [November 8, 2016](https://twitter.com/MagaliBoulet/status/795948211047432192?ref_src=twsrc%5Etfw)

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

> Come visit our booth [#SAPTechEd](https://twitter.com/hashtag/SAPTechEd?src=hash&ref_src=twsrc%5Etfw) [pic.twitter.com/JOvpcRVoQF](https://t.co/JOvpcRVoQF)
> 
> — Magali Boulet (@MagaliBoulet) [November 8, 2016](https://twitter.com/MagaliBoulet/status/795942235615457280?ref_src=twsrc%5Etfw)

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Here’s a video I made of the demo:  
<iframe title="Solace IOT demo - pub/sub - raspberryPI" width="800" height="600" src="https://www.youtube.com/embed/0hH6KMoZj6c?&amp;wmode=transparent&amp;rel=0&amp;feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

The post [Demonstrating IoT at SAP TechEd Barcelona](https://solace.com/blog/demonstrating-iot-sap-teched-barcelona/) appeared first on [Solace](https://solace.com).
Merging nested Lists or Arrays with Java 8
Tags: java, programming, beginners
Published: 2021-01-15 20:04:57

---
title: Merging nested Lists or Arrays with Java 8
published: true
date: 2016-11-15 00:00:00 UTC
tags: java, programming, beginners
canonical_url: https://bmuskalla.github.io/blog/2016-11-15-merging-nested-lists-or-arrays-with-java-8/
---

When accessing 3rd party APIs with pagination, we tend to see the same pattern over and over again. Usually, a response (represented as POJO) looks something like this:

```
class Result {
  public List<Item> getItems() {
    ...
  }
}

```

Be it from a third party service or your own APIs, after retrieving all results of the API call, we end up with something like a `List<Result>`. Great. We don’t really care about the response itself, we’re actually interested in all the items of the responses. Let’s say we want all the items, filter some of them out and transform them into a `TransformedItem`. People usually start writing something like the following:

```
List<Result> results = ...
List<TransformedItem> newItems = results.stream()
     .map(result -> result.getItems())
     .filter(item -> item.isValid())
     .map(TransformedItem::new)
     .collect(toList());

```

Ooops, this doesn’t even compile. The problem is that the first map doesn’t return a `Stream<Item>` but actually a `Stream<List<Item>>`. In order to actually merge/flatten all those nested lists, you can use [Stream#flatMap](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#flatMap-java.util.function.Function-). The difference is quite simple. `#map` allows you to transform an element in the stream into another element. On the other hand, `#flatMap` allows you to convert a single element to many (or no) elements.

```
List<Result> results = ...
List<TransformedItem> newItems = results.stream()
     .map(result -> result.getItems())
     .flatMap(List::stream)
     .map(TransformedItem::new)
     .collect(toList());

```

Just in case you’re working with a 3rd party API that returns something ugly as `List<Item[]>`, you can use the same pattern, just choose the corresponding the flatMap function.

```
class QueryResponse {
  public Item[] getItems() {
    ...
  }
}

...

List<TransformedItem> newItems = results.stream()
     .map(result -> result.getItems())
     .flatMap(Arrays::stream)
     .map(TransformedItem::new)
     .collect(toList());

```

Have fun with `#flatMap` and let me know [on Twitter](https://twitter.com/bmuskalla) how you used `#flatMap` in your scenarios. A great explanation of how to compose streams and some concepts behind streams can be found in Martin Fowler [Collection Pipeline](http://martinfowler.com/articles/collection-pipeline/).
Hi, I'm Margaret E. Ikeda
Tags: introductions
Published: 2016-11-11 21:48:55

---
title: Hi, I'm Margaret E. Ikeda
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for 1 year.

You can find me on Twitter as [@Mgtei](https://twitter.com/Mgtei).

I live in New York City.

I work for Coalition for Queens.

I mostly program in these languages: Swift.

I am currently learning more about encryption, multi-threading, Core Data, and how tech can help NYC foster children.

Nice to meet you.
Hi, I'm Jerome Hardaway
Tags: introductions
Published: 2016-11-11 17:30:42

---
title: Hi, I'm Jerome Hardaway
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for five years.

You can find me on Twitter as [@JeromeHardaway](https://twitter.com/JeromeHardaway)

I live in Nashville.

I work for CBS as a Front End Engineer and #VetsWhoCode as the Geek-At-Arms.

I mostly program in HTML, CSS, Javascript, React && Gatsby.

I am currently learning more about the serverless web and JAM stack principles while executing on the things I have learned in regards to nonprofit and product leadership.

Nice to meet you.
Hi, I'm Sawyer
Tags: introductions
Published: 2016-11-10 20:59:51

---
title: Hi, I'm Sawyer
published: true
description: My introduction post
cover_image: 
tags: introductions
---

I have been coding for [number] years.

You can find me on GitHub as https://github.com/SawyerMerchant

I live in Tampa, Fl.

I mostly program in these languages: Ruby, Rails, Javascript.


Nice to meet you.
Polyglot Libraries (And Frameworks)
Tags: programminglanguage, softwaredevelopment, softwareengineering, library
Published: 2019-01-20 15:00:11

---
title: Polyglot Libraries (And Frameworks)
published: true
tags: programming_language,software_development,software_engineering,library
canonical_url: https://horia141.com/polyglot-libraries.html
---

The name _Polyglot Library_ is one I propose for those libraries which appear in more than one programming language. The most famous example of this is, perhaps, the xUnit family of testing frameworks. While all of them are written in different languages, there’s an undoubted conceptual core which is static, as well as a “tree of influence” between versions.

Testing is fertile ground for such libraries, with mockito, selenium etc. being ported to many different programming languages and platforms.

Quite related are libraries implementing “external” specs. Many templating languages fall into this category, and indeed, [mustache](http://mustache.github.io/) boasts more than 40 distinct programming language implementations. Thanks to the rather small feature set and required API, the implementations look fairly similar. I’d also put things like Protocol Buffers, Thrift, Avro etc. or the various JSON parsing libraries in this bucket, PCRE, re2 etc. as well.

At a broader level, we can say that the library becomes an entity separate from the programming language. Given that more and more programming languages seem to develop a similar [feature set](http://horia141.com/string-interpolation.html), it will become easier and easier to express one successful library in the language of your choice.

Ideally, there would be a master list of such libraries. Part of a programming language’s design team job would be to port these libraries to the new plaform. While raising the bar for implementation, it would radically lower the bar for early adopters, as they’d find all their favorite libraries in one place.
Hi, I'm Areeb Beigh
Tags: introductions
Published: 2016-11-10 06:58:29

---
title: Hi, I'm Areeb Beigh
published: true
description: My introduction post
cover_image: http://i.imgur.com/3pFUwLU.png
tags: introductions
---

I have been coding for 2 years.

You can find me on GitHub as <a href="https://github.com/areebbeigh">@areebbeigh</a>

I live in Srinagar, Jammu & Kashmir.

I'm a high school student.

I mostly program in these languages: Python, Java and C#.

I am currently learning more about everything? lol.

Nice to meet you.

(I am bad at writing)
An Impromptu NYC Meetup — Putting Our Heads (And Hearts) Together
Published: 2016-11-09 22:26:48

---
title: An Impromptu NYC Meetup — Putting Our Heads (And Hearts) Together
published: true
description: 
cover_image: http://media.architecturaldigest.com/photos/5699802bc6772b7614567435/2:1/w_2560/new-york-city-guide.jpg
tags: 
---

My Practical Dev partner, Jess Lee, and I have organized an impromptu meetup/community discussion along with [Tech For Good NYC](https://www.meetup.com/Tech-For-Good-NYC/). We'll be meeting at the office of [DoSomething.org](https://dosomething.org), a not-for-profit tech organization dedicated to social good with a really wonderful Flatiron location.

There will be a bit of speaking and a few opportunities to share thoughts and stories with the group. Mostly, however, we just wanted to organize an opportunity for people within our community to be there for one another through discussion and sharing.

The meetup will take place in the Flatiron area of Manhattan.

### 7:00 PM Thursday

19 West 21st St, 8th Floor
New York, NY 10010

### [Here is the meetup page](https://www.meetup.com/Tech-For-Good-NYC/events/235472916/) 👈 Please RSVP and share 😊

![DoSomething.org](https://media.licdn.com/mpr/mpr/shrinknp_800_800/p/2/000/1f7/348/0599152.jpg)

This is short notice, but we felt a sense of emotional urgency. We are not looking to be reactionary or to solve problems tomorrow. We are making an attempt to come together as a community. We saw enough people openly crying today in this city to know that a night of community could do well.

Of course there is "partisanship" at play here, but what is important is respecting and being there for people who are hurt right now. This is not "about" technology, but the people within our industry have shared experiences and values. We also have tremendous opportunities to do outsized good through our work and our projects. So much of that involves community coordination through open source and other avenues.

I do not know what the turnout will be like. There are no success metrics at play here. If you feel like you could use a night of community, please come, be helpful, and be respectful.