teleren/devto huggingface dataset:
Build Web APIs with Aqueduct #3 (video series)
Tags: dart, api, webdev, beginners
Published: 2018-12-12 11:02:08

In this article we will look at `Serializable` classes and how they enable us to handle the payload of a request body. We will then proceed to set up and integrate our PostgreSQL database.

Here's the third video in the series:

{% youtube sXk9nkdSVq4 %}
→ [**Watch on YouTube**](http://bit.ly/aqueduct-tutorial-3)

---

## What are Serializable objects?

These objects are responsible for encoding and decoding the payload of a request. To use one of these, extend the `Serializable` class and override the `asMap()` and `readFromMap()` methods.

```dart
class Read extends Serializable {
  String title;
  String author;
  int year;

  @override
  Map<String, dynamic> asMap() => {
    'title': title,
    'author': author,
    'year': year,
  }

  @override
  void readFromMap(Map<String, dynamic> requestBody) {
    title = requestBody['title'] as String;
    author = requestBody['author'] as String;
    year = requestBody['year'] as int;
  }
}
```
So the `asMap()` method takes in the instance members of `Read` and returns a `Map` structure, useful when returning JSON responses.

`readFromMap()` is used when extracting the request payload keys into our instance properties. This allows us to therefore bind our instance to the `body` payload parameter that comes in our POST request method:

```dart
class ReadsController extends ResourceController {
  ...
  ...
  @Operation.post()
  Future<Response> createNewRead(@Bind.body() Read body) async {
    // Notice the `body` parameter cast to the `Read` Serializable subclass
    ...
  }
  ...
  ...
}
```
See how this works in more detail and how we integrate a fully functional PostgreSQL database in the [**full video**](http://bit.ly/aqueduct-tutorial-3).

→ [**Get the source code**](https://github.com/graphicbeacon/aqueduct-tutorial/tree/part-3)

---

[**Subscribe to my YouTube channel**](http://bit.ly/fullstackdart) for more videos covering various aspects of full-stack web development with Dart.

**Like, share and [follow me](https://twitter.com/creativ_bracket)** 😍 for more content on Dart.

## Further reading
1. [**Handling HTTP Requests**: Serializable Objects](http://aqueduct.io/docs/http/request_and_response/#serializable-objects)
2. [**Aqueduct Docs**: Reading from a Database](http://aqueduct.io/docs/tut/executing-queries/)
3. [**Free Dart screencasts on Egghead.io**](https://egghead.io/instructors/jermaine-oppong)
It feels so good to finally release a product.
Tags: showdev, opensource, javascript, feedback
Published: 2018-12-12 10:04:01

---
title: It feels so good to finally release a product.
published: true
description: 
tags: #showdev #opensource #javascript #feedback
---


Hey Devs

Link to PH:https://www.producthunt.com/posts/startips
Link to Website: https://startips.io

💬 The Story
For years I have been trying to start and run many startups but I don't really have much knowledge to keep them running or getting them off the ground. So I seek out tips from other founders. However, I find out that there is no central place to find such tips. So I built StarTips, so that everyone can get useful tips from founders all around the world.

🎁Features:
- Create accounts
- Community Driven
- Ability to submit Tips
- List of resources 

🛠Upcoming Features:
- Contact forum
- More tips
- Different types of tips
- Tips will be searchable and filterable
- More resources coming to the list
Should Apple put usability requirements on ads?
Tags: discuss
Published: 2018-12-12 08:00:36

---
title: Should Apple put usability requirements on ads?
published: true
tags: discuss
---

There has been a lot of discussion online about how apple (ab)uses their power as a gatekeeper to the App Store. But lately I've been thinking there's one area where they should maybe exert some more of their power, **ads**.

I think it'd be nice if they'd reject apps with ads that don't follow rules like these:

 - Buttons in interstitial ads MUST follow the HIG, they must be large enough and have good contrast.
 - Buttons in interstitial ads MUST be accessible using VoiceOver
 - Ads MUST NOT interrupt audio playing in the background
 - Ads MUST NOT use confusing tactics like putting the close button on the left while a video is playing, and then on the right on the screen after the video.

I'm not sure about the audio rule here, as it can be an integral part of the ad. On the other hand, there should then be a mechanism of automatically restarting the audio that was playing before the ad started.

Thoughts?
How to generate mnemonic?
Tags: bip39, generatemnemonic, seed
Published: 2018-12-12 07:25:17

---
title: How to generate mnemonic?
published: true
description: generating a mnemonic seed from bip39 library
tags: bip39, generate mnemonic, seed
---

 var bip39 = require(“bip39”);
 
 // You can generate a mnemonic seed from bip39 library

 var mnemonic = “ishwar chandra tiwari…”;
D does meet standard stability
Tags: dlang
Published: 2018-12-12 07:22:05

---
title: D does meet standard stability
published: true
description: The D programming language has generally been criticized for its unpolished ecosystem, I think they're wrong. 
tags: dlang
---

I've been coding in D since 2006. I've seen a lot of its growth and pains. One of the challenges has been been the out of the box experience.

Back in the old days you'd get a zip file and extract it. That was just too simple. The compiler would compile files you give it, that is confusing, why do I need to spell out what the compiler compiles.

Generally Visual Studio is the example of out of box stability expected by Windows developers. Normally I've agreed with this, things generally work.

But recently I've been put into more collaborative expectations. And I've found people can't deal with update. Any issue is the fault of the update, when there are update issues it's usually because only one of many needed parts are updated. Library dependencies stagnant.

When looking at the web development front. Builds are a collection of languages, tools, conflicting frameworks, and compile times longer then their compiled language counterparts. 

I would not suggest D avoids this if used, but I can say with confidence that the rest of the development world didn't solve the problems either.
What is HD derivation path?
Tags: hdderivationpath, currencies, cointype
Published: 2018-12-12 07:21:55

---
title: What is HD derivation path?
published: true
description: HD derivation path
tags: HD derivation path, currencies, coin_type
---


The HD derivation path is a string that makes it easy to handle multiple crypto currencies (assuming they all use the same signature algorithms), multiple blockchains, multiple accounts, and so on.
The HD derivation path is defined as :
m / purpose' / coin_type' / account' / change / address_index
what is bip39?
Tags: bip39, mnemoniccode, generatingmnemonic
Published: 2018-12-12 07:18:03

---
title: what is bip39?
published: true
description: BIP39 Mnemonic code for generating deterministic keys  
tags: BIP39,Mnemonic code,generating Mnemonic
---
BIPs : This BIP describes the implementation of a mnemonic code or mnemonic sentence - a group of easy to remember words - for the generation of deterministic wallets.
The English-language wordlist for the BIP39 standard has 2048 words, so if the phrase contained only 12 random words, the number of possible combinations would be 204⁸¹² = ²¹³² and the phrase would have 132 bits of security. Actual security of a 12-word BIP39 seed phrase is only 128 bits.
Generally a seed phrase only works with the same wallet software that created it. If storing for a long period of time it's a good idea to write the name of the wallet too.

BIP39: Mnemonic code for generating deterministic keys , BIP39 - used to manage your recovery seed and recovery words. Abstract. This BIP describes the implementation of a mnemonic code or mnemonic sentence - a group of easy to remember words - for the generation of deterministic wallets. It consists of two parts: generating the mnemonic, and converting it into a binary seed. Example: let bip39 = require("bip39");
Elixir: アプリケーションをパッケージ化する
Tags: elixir, webdev, tutorial, programming
Published: 2018-12-12 05:56:52

---
title: Elixir: アプリケーションをパッケージ化する
published: true
description: Elixirアプリケーションを本番サーバーで動かすときにはパッケージ化するとよいでしょう。パッケージ化の利点やその方法、注意すべき点などについてご説明します。
tags: #elixir, #webdev, #tutorial, #programming
---

本稿は「[Elixir アプリケーションをパッケージ化しよう](https://qiita.com/melpon/items/d61907ae51307a55c39a)」をもとに加筆・補正し、文章を整えました。

Elixirアプリケーションを本番サーバーで動かすときにはパッケージ化するとよいでしょう。パッケージ化の利点やその方法、注意すべき点などについてご説明します。


# パッケージ化とは
Elixirのパッケージ化とは、つぎのようなファイルを集めて、ほぼ単体で起動するようにひとつのディレクトリにまとめることです。そのためのツールとしては、今は[Distillery](https://hex.pm/packages/distillery)一択でしょう。

- 依存しているアプリケーションやライブラリのbeamファイル
- 設定ファイル
- Elixir本体のbeamファイル
- ERTSとよばれるErlangランタイム
- アプリケーションを起動するためのスクリプト


# パッケージ化の利点
パッケージ化する利点は、そのサーバーにErlangとElixirを入れる必要がなくなる、ということに尽きます。

- ErlangやElixirを入れる必要がないので、サーバーを構築するためのAnsibleやAMIをつくる作業が楽になります。
- サーバー内のErlangやElixirのバージョンを更新しなくてよいので、インフラ担当との調整が要りません。
- デプロイするためにgitからソースをもってきて起動といったことをせずに済み、zipファイル1個転送すれば動かせます。
- 仕組みがとても単純になるので、デプロイシステム全体を理解する手間が減ります。

ErlangとElixirが要りませんので、ほぼ何も入っていないAlpineLinuxですら、必要なパッケージは`musl`と`ncurses-libs`、`zlib`、`bash`だけになります[^1]。これらのパッケージを入れておけば、パッケージ化したElixirアプリケーションはそのサーバーで動作します。


# パッケージ化する方法
基本的にはDistilleryのドキュメント「[Getting Started](https://hexdocs.pm/distillery/tooling/cli.html)」にしたがって進めれば問題ありません。

重要なのは、**その環境に入っているOSやErlangやElixirのバージョンでパッケージがつくられる**ということです。そのため、本番と同じOSの上でパッケージ化する必要があります。

そのためにビルド用のサーバーをつくり、そこでパッケージ化するという手もあります。けれど、[Docker](https://www.docker.com/)でビルドするとお手軽です。パッケージをビルドするためのイメージと、それを使ってパッケージ化するスクリプトを書いておけば、**誰でも簡単にローカルで**パッケージがつくれるようになるのが利点です[^2]。


# パッケージ化するときの注意点
Distilleryでパッケージ化すると、`Mix`や`ExUnit`というライブラリが入りません。そのため、実行時に`Mix`や`ExUnit`を使うと、それらのモジュールがないことによるエラーが起こります[^3]。

たとえば、つぎのコードは`mix run`では正しく動きますが、パッケージ化して起動するとエラーになります。

```elixir
defmodule Foo do
  def f() do
    # テスト時は :foo を返す
    if Mix.env() == :test do
      :foo
    else
      :bar
    end
  end
end
```

これは`Mix.env/0`を実行時に使っているからです。コンパイル時には`Mix.env/0`が使えるので、以下のように改めればよいでしょう。

```elixir
defmodule Foo do
  # def f() do
  # テスト時は :foo を返す
  if Mix.env() == :test do
    def f() do
      :foo
    end
  else
    def f() do
      :bar
    end
  end
end
```

こうすれば、コンパイル時に`Mix.env/0`が評価され、どちらかの関数だけが残ります。実行時には`Mix.env/0`が使われないのでエラーは起こりません。パッケージ化しするに時々忘れがちですので、気をつけましょう。

また、パッケージ化すると`mix yacto.migrate`のような`Mix`のコマンドは打てません。そのため、本番データベースのマイグレーションをどうやるかが問題になります。これは「[Running migrations](https://hexdocs.pm/distillery/guides/running_migrations.html)」にあるように、Mixは使わずにマイグレーションが実行できるスクリプトをつくり、それをパッケージ化したバイナリ経由で呼び出すのがよいでしょう。

このように少し手間はかかるものの、その後のデプロイやサーバー管理が手軽にできるようになります。Elixirアプリケーションはパッケージ化することがお勧めです。


[^1]: `bash`はDistilleryが要求します。それ以外は、ErlangVMを動かすために必要です。ただし、ビルドフラグによっても変わります（たとえば`--disable-dynamic-ssl-lib`を指定しなかった場合、OpenSSLなどのライブラリが必要になるでしょう）。
[^2]: gimiでは`prod.secret.exs`は用いず、環境変数（`env`パッケージ）を使っているので、シークレットなデータを知らないためにパッケージ化できないといったことは起こりません。
[^3]: これで問題が出たときも、ローカルでパッケージ化できるようにしてあると比較的簡単にデバッグできます。
If you were added to a team with a horrible code base and an unhappy client, what steps would you take to fix everything?
Tags: discuss
Published: 2018-12-12 05:56:01

---
title: If you were added to a team with a horrible code base and an unhappy client, what steps would you take to fix everything?
published: true
description: 
tags: discuss, 
---

I've seen projects that have been successful because they had talented people and good processes from the start, however I was just curious on how one could recover from a situation in which people did not have the foresight to establish good practices early on.

Any suggestions?
Git is a Communication tool 
Tags: git
Published: 2018-12-12 05:23:41

---
title: Git is a Communication tool 
published: true 
description: Emphasize the power provided by git to communicate clearly 
tags: git
canonical_url: https://he-the-great.livejournal.com/60503.html
series: Git Communication
---

Historically there has been a number of complaints on the way git allows people to change history. There are continued discussions on using rebase, merge, and/or squash. I want to bring focus to the point of all these choices, communicating. I'm not looking at providing new suggestions, someone has already written about why you should do one thing or another.

Who might you want to be communicating with? 

* Future self
* Other Developers
* QA member
* Project Management

What is it you might want to communicate?

* That a feature is complete (to the best of your ability at this time)
* This code change is needed to fix bug X
* I have this important documentation update
* I was doing some work and my editor decided to change these files and I don't know why.
* I don't like the formatting of this document, here is my recommendation
* I completed X, Y, or Z and think it is important to get these upstream for everyone to benefit.
* Can we please upgrade our visual studio project files to the latest version of .net?

Now as a developer, wouldn't it be great if this is actually how you developed your work? Nice clear goals, good discipline in only doing one thing, ignoring that bug you found because it isn't the task at hand? Well, no it wouldn't be good you'll forget about that bug, or you will be so busy documenting that it needs fixed you forgot where you were in your task, it's just much better to get those changes into the code base and move on. And this is why Git's history rewrite is so valuable.

{% link https://dev.to/koffeinfrei/the-git-fixup-workflow-386d?utm_source=additional_box&utm_medium=internal&utm_campaign=regular&booster_org= %}
AoC Day 12: Subterranean Sustainability
Tags: adventofcode, discuss
Published: 2018-12-12 05:14:02

---
title: "AoC Day 12: Subterranean Sustainability"
published: true
description: "Day 12: A perfect time to become horticulturalist mole people!"
cover_image: https://thepracticaldev.s3.amazonaws.com/i/bw6z9esyhguzy79an7mw.png
tags: adventofcode, discuss
series: Advent of Code 
---

Whoops!  Looks like I may have spoken too soon yesterday when I mentioned Conway's Game of Life.

On [Day 12](https://adventofcode.com/2018/day/12), we're actually implementing a variation on Conway's Game of Life... Plant Life, that is.  Whether or not a plant is around for the next generation depends on what the plant-life around it looks like on the previous generation.

I will give 100 internet points to anyone who submits a cool animation with their solution!  I will also award 5 bonus internet points for each plant pun we get along the way.  Good luck!  I'm *rooting* for you!
Discovering the pathlib module
Tags: python, tipstricks, pathlib, filesystem
Published: 2018-12-12 04:49:37

---
title: Discovering the pathlib module
published: true
description: Moving with elegance through the filesystem
tags: ["python", "tips&tricks", "pathlib", "file system"]
canonical_url: https://www.christianbarra.com/posts/using-pathlib/
---

{% twitter 1022436417887248384 %}


The [Python Standard Library](https://docs.python.org/3/library/index.html) is like a gold mine, and the [pathlib](https://docs.python.org/3/library/pathlib.html#module-pathlib) module is really a gem.

`pathlib` provides an useful abstraction on top of different filesystems (posix and Windows).

But that's just a small part of the very friendly user experience that you can have.

```bash
# files in my folder
README.md  example.py subfolder/README.md
```

We can import `Path` from `pathlib`

```python
from pathlib import Path

path = Path(".")
# PosixPath('.')

files = [file for file in path.iterdir()]
# [PosixPath('subfolder'), PosixPath('README.md'), PosixPath('example.py')]
```

`Path()` returns (in this case) a `pathlib.PosixPath` object with a very handy `iterdir`, a useful generator for when you have a lot of files in your folder.

```python
path.iterdir()
<generator object Path.iterdir at 0x10aca2cf0>
```

Do you want to get only the files with a specific format?

```python
md_files = [
    file for file in path.iterdir() if file.suffix == '.md'
    ]
# [PosixPath('README.md')]
```

You can get a similar result using `glob`

```python
md_files = [file for file in path.glob("*.md")]
# [PosixPath('README.md')]
```

`glob` is quite powerful, using the `**` pattern you can search recursively

```python
md_files = [file for file in path.glob("**/*.md")]
# [PosixPath('README.md'), PosixPath('subfolder/README.md')]
```

If you want to learn more about the `pathlib` module the [PEP 428](https://www.python.org/dev/peps/pep-0428/) and the [official documentation](https://docs.python.org/3/library/pathlib.html#module-pathlib) are the right places where to start.
Are Side Projects THAT Important?
Tags: discuss, career
Published: 2018-12-12 04:12:34

---
title: Are Side Projects THAT Important?
published: true
description: A perspective and discussion on the importance of side projects. 
tags: #discuss,#career
---

So I have been trying to force myself to start a new side project recently and it has got me thinking how important it really is to have side projects. I believe learning is important and to keep on top of technology but do you really need a bunch of side projects to do that?

I have had exactly _one_ major side project to build a fantasy football draft board. I first built it in Symfony and Aurelia, but I was not pleased with the result so I rebuilt it with Adonis and Vue for backend and frontend respectively. I learned a lot in the process about building API driven single page apps.

On the other hand I also learn a ton by fiddling with things at work in between projects and by reading articles such as on DEV. 

So I wanted to see what the good people of DEV think about side projects and how necessary they are. I for one think that they are nice to have, but not at the expense of your happiness and well being.
Whee!, a newsletter highlighting the funnest web development things
Tags: showdev, fun, webdev, newsletter
Published: 2018-12-12 03:59:35

Years ago, the reason why I got into web development was because it was fun. I loved spending hours in front of my computer, experimenting, tweaking and reloading to see the magic of code transform things on my screen.

My [new newsletter, Whee!](https://whee.fun/) is an attempt to stir that feeling of fun and excitement with experimenting and playing with code. Whee! is a newsletter that curates the funner web dev things around the Internet — whether it’s cool visual experiments on CodePen, an homage to 8-bit graphics in a new CSS library or programming concepts using the latest popular pop song.

My goal with Whee is to share my awesome findings with you every Wednesday to get you over that hump and into the rest of the week saying wheeeee! 🙌

To get the funnest web dev things from the Internet into your inbox every Wednesday, [sign up for Whee!](https://whee.fun/).
How do you transfer the knowledge from HtDP to ReactJS?
Tags: beginners, help, javascript, react
Published: 2018-12-12 01:37:26

---
title: How do you transfer the knowledge from HtDP to ReactJS?
published: true
description: 
tags: beginner,help,javascript,react
---

Hi,

I'm currently taking the course "How to Code: Simple Data" (https://www.edx.org/course/how-code-simple-data-ubcx-htc1x) which is based on the book "How to Design Programs" (https://htdp.org/2018-01-06/Book/).

If you have taken this course (or read the book), can you share how you used the recipes in designing a React program? A concrete example will be very helpful.

TIA.
Resume Review
Tags: discuss, beginners, career
Published: 2018-12-12 00:38:40

---
title: Resume Review
published: true
description: Let's help each other out - Junior or Senior there's something for you here!
tags: discuss, beginners, career
---

Let's help get some fresh talent in the industry. Help out another person by checking for spelling, grammar, making sure their resume is easy to read and any other tips you have come across your journey you think will benefit someone else.


The rules are simple:

##Juniors:
Post a link to your resume / cv below for others to review, or get extra eyes on.

##Seniors:
Please give feedback and reply so we don't all pile on the same one (but you can absolutely provide additional feedback).

*if you don’t want your personal info out there please replace with placeholders so the layout isn’t messed up. *

This thread was started on Twitter. Feel free to follow along in any or both places!
{% twitter 1072635945357336581 %}
The Indie Game Legend 3D now in early access!
Tags: gamedev, unity3d, devlog, motivation
Published: 2018-12-11 23:42:59

---
title: The Indie Game Legend 3D now in early access!
published: true
description: My first commercial game is now on the market.
tags: gamedev, unity, devlog, motivation
cover_image: https://thepracticaldev.s3.amazonaws.com/i/qc2bxpmpwphvs96zyqyo.png
---

{% youtube Eb6a6-S1B5Y %}

Hey everybody! We did it. Early access. The Indie Game Legend 3D is now on the market. This is my first commercial game. I've been dabbling with indie game development for literally as long as I can remember, so it's great to finally have something out there.

To me, this is a game about the love of making games. Even if you're not into that, it's still a lighthearted action adventure game that might remind you what playing video games used to be like. 

We're not done yet, and still need to release part 2 with the final release. But even then, I have lots more games to make so I hope you'll join me and try this one out. Let me know what you think.

And I'll get back to posting about Go stuff soon!

The Indie Game Legend 3D is available on [Steam](https://store.steampowered.com/app/844440/The_Indie_Game_Legend_3D/) and [itch.io](https://progrium.itch.io/tigl3d) for $8.99.

PS: [Retweet me if you'd like to spread the word!](https://twitter.com/progrium/status/1072568005471731713)
Go Proverbs from @rob_pike
Tags: go, tir, proverb, robpike
Published: 2018-12-11 22:37:55

---
title: Go Proverbs from @rob_pike
published: true
description: 
tags: go, tir, proverb, robpike
---

A sublist of a video for Go.

## Simple, Poetic, Pithy

```
Don't communicate by sharing memory, share memory by communicating.
Concurrency is not parallelism.
Channels orchestrate; mutexes serialize.
The bigger the interface, the weaker the abstraction.
Make the zero value useful.
interface{} says nothing.
Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.
A little copying is better than a little dependency.
Syscall must always be guarded with build tags.
Cgo must always be guarded with build tags.
Cgo is not Go.
With the unsafe package there are no guarantees.
Clear is better than clever.
Reflection is never clear.
Errors are values.
Don't just check errors, handle them gracefully.
Design the architecture, name the components, document the details.
Documentation is for users.
Don't panic.
```

https://go-proverbs.github.io/
EatTheBlocks Newsletter #19 - Trading widget for 0x, React Dapp Tutorial...
Tags: ethereum, 0x, 0xprotocol
Published: 2018-12-11 20:57:31

---
title: EatTheBlocks Newsletter #19 - Trading widget for 0x, React Dapp Tutorial...
published: true
description: 
tags: Ethereum, 0x, 0x Protocol
---

[![](https://thepracticaldev.s3.amazonaws.com/i/cvmd2n4goq50exnz6rvq.png)](https://youtu.be/xTkwvjtH1Hs)


EatTheBlocks Newsletter #19 - Trading widget for 0x, React Dapp Tutorial...

Video: https://youtu.be/xTkwvjtH1Hs
Post:  https://eattheblocks.com/eattheblocks-newsletter-19-trading-widget-for-0x-react-dapp-tutorial/

Every week I send the 10 most interesting tutorials, tips & news for Ethereum Dapp developers: Solidity, Truffle, Web3, Ethereum protocol & Token standards. Sign up to the newsletter on https://eattheblocks.com and never miss an episode!