teleren/devto huggingface dataset:
A Developer's Diet
Tags: discuss, developer, food, nomnom
Published: 2018-03-30 17:38:31

---
title: A Developer's Diet
published: true
description: A post to find out what developers are eating out there, besides code.
tags: discuss, developer, food, nom nom
---

# The Developer's Digest...ive System

"I would like to have a large number 6, with a side of cheesy fries, and a large soda." ... Well, that's not how my morning breakfast really goes. I usually have some oatmeal with a dash of milk in the morning, or some corn/bran flakes for breakfast. I would then wash all of that down with some ginger and lemon honeyed tea or some green tea. I have been trying to hold back on coffee a bit. After all, coffee is what fuels software developers. I have realized that green tea actually helps in keeping me awake. That is my morning diet routine.

# What's For Lunch?

I have my lunch break at 11:30 am. I usually carry a home cooked meal for lunch, which, on average, has some veges and meat. If I don't carry a home cooked meal, my colleagues and I order some take out. The take out can vary from burgers to pizza, or simply some pie.

#Dinner At Tiffany's

Now this is where things get weird. I usually do not have an appetite come supper time. And no, my mom is not a bad cook. I usually get home from work, take a warm shower, do some yoga, have a cup of tea, and then hop on to my bed and read a book til I pass out. Still, no appetite. Even when I do force myself to eat, I can only take two spoonfuls and I feel full.

#The Snackdown

I am not big on snacking. Maybe I will have a cup of yogurt and a fruit during the day, but is how far my snacking goes.

#Water, Water, and more Water

We sometimes get so distracted by writing code, that we may actually forget to drink water. I try my best to get at least 1.5L of water in my system everyday.

#Puree All The Things
I am the laziest chewer(is this a proper word?) out there, well that I know off. I prefer eating warm and soft food. I usually warm up my bread before I eat it. Weird, I know. I do not eat crunchy food, it is loud and feels uncomfortable in my mouth. If I could, I would puree food and just drink it all up.

#What's Your Diet?

Do you have special dietary requirements? Are you a picky eater? What are you eating?
loadable-component is awesome library for React code-splitting / dynamic-import
Tags: react, javascript, reactrouter, webpack
Published: 2018-03-30 15:52:34

---
title: loadable-component is awesome library for React code-splitting / dynamic-import
published: true
description: Recommendation for loadable-components
tags: react,javascript,reactrouter,webpack
---

I found good React code-splitting library and this article recooment this : [`loadable-components`](https://github.com/smooth-code/loadable-components).

---

When I want to use dynamic import and code spliting in React application, I must implement wrapper and it's messy.

In [React document](https://reactjs.org/docs/code-splitting.html#libraries)'s code splitting section use [`react-loadable`](https://github.com/jamiebuilds/react-loadable). 
This is good library, but sadly  this repository is disabled issue.

I watched the React document's issue and found this issue and `loadable-component`. 

https://github.com/reactjs/reactjs.org/pull/573



I felt "Ah, that is great library !"
Below is loadable-component's my favorite points.

# Favorite point: Concept 
From [motivation](https://github.com/smooth-code/loadable-components#motivation)

> main goal: reducing API in order to make it as easier as possible for the developer

I saw the sample and felt that "this is certainly easier than other libraries!"

![img](https://i.imgur.com/QBdFu9k.png)

# Favorite point: Good README (documentation).
`loadable-components`'s README is listed  methods and functions to need, clearly and exhaustive.

FYI: I felt most attractive function is [Prefetch hover](https://github.com/smooth-code/loadable-components#prefetch-on-hover). `react-loadable` has this function too, but I couldn't found that easily.
(Because `react-loadable`'s readme has some very big images..)

# Favorite point: Clean Code & Testing
`loadable-componet` has many function and I predicted code is to hard.
But I suprised that keep very clean code when watch `loadable-component` source code.
If I got problem, I will able to resolve or post pull request.
Of course there are also tests.

# Favorite point: Open issue
Library's owner can select disable or enable issues.
But I want to choose library that accept isses.
Issues is can post my issue and also function as great knowledge　bank.

# Conclusion
I favorited [loadable-component](https://github.com/smooth-code/loadable-components).
AtomからVisual Studio Codeに乗り換えた
Tags: atom, vscode
Published: 2018-03-30 15:37:11

---
title: AtomからVisual Studio Codeに乗り換えた
published: true
description: 
tags: atom,vscode
canonical_url: https://crieit.net/posts/Atom-Visual-Studio-Code
---

最近、長らく使っていたAtomからVisual Studio Codeに乗り換えた。

理由はただひとつ、「重すぎる」

なんだかんだでずっとCodeに乗り換える機会を伺っていた。

### まずAtomのいいところ

Atomはとても良い。
拡張機能で何でも揃えられるし、どんな言語でも扱えるし、
一度起動してしまえばさくさく動いて快適。

使っているパッケージに不満があればプルリクを送って改善していけるし、
みんなで作り上げていくとても良いアプリケーション。

ずっと死ぬまで使い続けていくのだろうなと、あの頃は思っていた。

### Atomの悪いところ

とにかく重い。

週１の常駐業務で32bitのWindows7でAtomを使っていたが起動と終了が重すぎる。
複数のプロジェクトを同時進行しようとすると話にならない。

自分のPCは昔ゲーム用に買ったスペックの良いものなのでそれほど気にはならなかったが、
時々PC自体が完全にフリーズするのでおかしいと思ったらAtomを開きすぎるとそうなるっぽかった。

また、オートコンプリート機能などのパッケージは、裏で解析を始めるので途端に重くなる。
キー入力も遅延が生じ始める。仕方がないのでそういったパッケージは使用を断念する。

最近IDE機能が追加されたので期待して試してみたが、期待はずれだった。
このあたりで完全にAtomへの想いが冷めたのだと思う。

### Visual Studio Codeへの乗り換えの懸念

Codeがやけに速くて快適なのはちょくちょく試していたので気づいていた。
乗り換え直前等はAtomの重さを最大限に感じていた時なので、天と地の差くらいには感じていた。

ではなぜ乗り換えなかったかというと、Vimパッケージへの不満だった。

AtomのVimパッケージは、元々あったVimパッケージを日本人開発者の方が別パッケージにして強化して主導権を奪い取ったもので、非常に快適。

CodeのVimは、下記が出来なくて日常的に使うのは厳しいなと感じていた。

* Insert modeの時もCtrl+Fを奪ってしまって検索、置換が面倒
* modeによってはCtrl+PgUp, PgDnでタブ切り替えが出来ない
* システムのClipboardを使う設定にすると一部操作ができなくなる不具合がある（現在改善されている）

たったこれだけではあるがスピード感が失われてストレスが半端ないので使用できなかった。

### 解決方法

解決したので即Codeに乗り換えた。

キーバインディングは自由に設定できるので自分で勝手に設定すれば良いだけだった。
今使っているキーバインディングは下記のような感じ。

```json
[
    {
        "key": "ctrl+f",
        "command": "actions.find",
        "when": "editorTextFocus && vim.active && vim.use<C-f> && vim.mode == 'Insert' && !inDebugRepl"
    },
    {
        "key": "ctrl+pageup",
        "command": "workbench.action.terminal.focusPrevious",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+pagedown",
        "command": "workbench.action.terminal.focusNext",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+pageup",
        "command": "workbench.action.previousEditor",
        "when": "editorTextFocus && vim.active && vim.use<C-pageup> && !inDebugRepl"
    },
    {
        "key": "ctrl+pagedown",
        "command": "workbench.action.nextEditor",
        "when": "editorTextFocus && vim.active && vim.use<C-pagedown> && !inDebugRepl"
    },
    {
        "key": "tab",
        "command": "editor.action.indentLines",
        "when": "editorFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
    }
]
```

### 乗り換えて

非常に快適。とにかく速い。
詳しくはわからないが、Language Serverというのを使っているせいか、オートコンプリートなどの重い機能もやけに速くストレスが無い。

何気にGitの簡単な操作もCode上でできてしまうので便利。

昔Visual Studioを使っており、いつも重いなぁと思いながら使っていたが、
もしかするとMicrosoftが作っていなかったらもっと遅いIDEになっていたのかもしれないとさえ思った。

とにかくVisual Studio Codeおすすめ。
What is the best project management software for field service?
Published: 2018-03-30 14:56:07

---
title: What is the best project management software for field service?
published: True
description: I am looking for a project management software for my field works. I want to track the progress on both my cellphone and desktop. It's better to be cloud-based as the room of my desktop is quite limited. Any advice? 
tags: 
---

I am looking for a project management software for my field works. I want to track the progress on both my cellphone and desktop. It's better to be cloud-based as the room of my desktop is quite limited. I searched on Google and found the EMMI soti [project management software](https://milliontech.com/project-management-software/) on Milliontech. Any one used this app before? Any feedback? Any other advice?
Apache Livy - Apache Spark, HDFS, and Kerberos
Tags: bigdata, apache, livy, spark
Published: 2018-03-31 15:09:07

---
title: Apache Livy - Apache Spark, HDFS, and Kerberos
published: true
tags: bigdata,apache,livy,spark
canonical_url: https://risdenk.github.io/2018/03/30/apache-livy-spark-hdfs-kerberos.html
---

### Overview

[Apache Livy](https://livy.incubator.apache.org/) provides a [REST interface](https://livy.incubator.apache.org/docs/latest/rest-api.html) for interacting with [Apache Spark](https://spark.apache.org/). When using Apache Spark to interact with [Apache Hadoop HDFS](https://hadoop.apache.org/) that is secured with [Kerberos](https://web.mit.edu/kerberos/), a Kerberos token needs to be obtained. This tends to pose some issues due to token delegation.

`spark-submit` [provides a solution to this](https://issues.apache.org/jira/browse/SPARK-12279) by getting a delegation token on your behalf when the job is submitted. For this to work, Hadoop configurations and JAR files must be on the `spark-submit` classpath. Specifically which configurations an JAR files are explained in a references [here](https://risdenk.gitbooks.io/hadoop_book/content/examples/spark_and_hdfs.html).

When using Livy with HDP, the Hadoop JAR files and configurations are already on the classpath for `spark-submit`. This means there is nothing special required to read/write to HDFS with a Spark job submitted through Livy.

If you are looking to do something similar with [Apache HBase](https://hbase.apache.org/) see this [post](/2018/03/05/apache-livy-spark-hbase-kerberos.html).

### Assumptions

- [Apache Ambari](https://ambari.apache.org/) for managing [Apache Spark](https://spark.apache.org/) and [Apache Livy](https://livy.incubator.apache.org/)
- [Apache Knox](https://knox.apache.org/) in front of [Apache Livy](https://livy.incubator.apache.org/) secured with [Kerberos](https://web.mit.edu/kerberos/)
- [Apache Hadoop HDFS](https://hadoop.apache.org/) secured with [Kerberos](https://web.mit.edu/kerberos/)

### `run.sh`

```
curl \
  -u ${USER} \
  --location-trusted \
  -H 'X-Requested-by: livy' \
  -H 'Content-Type: application/json' \
  -X POST \
  https://localhost:8443/gateway/default/livy/v1/batches \
  --data "{
    \"proxyUser\": \"${USER}\",
    \"file\": \"hdfs:///user/${USER}/SparkHDFSKerberos.jar\",
    \"className\": \"SparkHDFSKerberos\",
    \"args\": [
      \"hdfs://PATH_TO_FILE\"
    ]
  }"
```

### `SparkHDFSKerberos`

```
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

public class SparkHDFSKerberos {
  public static void main(String[] args) {
    SparkConf sparkConf = new SparkConf().setAppName(SparkHDFSKerberos.class.getCanonicalName());
    JavaSparkContext jsc = new JavaSparkContext(sparkConf);

    JavaRDD<String> textFile = jsc.textFile(args[0]);
    System.out.println(textFile.count());

    jsc.stop();
    jsc.close();
  }
}
```
Ethics in technology
Tags: code, data, development, freespeech
Published: 2018-03-30 11:48:02

---
title: Ethics in technology
published: true
tags: code,data,development,free speech
canonical_url: https://craignicol.wordpress.com/2018/03/30/ethics-in-technology/
---

This is an extension of a twitter thread I wrote in response to this tweet, and thread about the Cambridge Analytica revelations.

{% tweet 975545527973462016 %}

One of the key modern problems is how easy it is to access these tools. You don’t need professional training to string these together.

It’s as dangerous as if someone invented a weapon that could kill 10s or 100s of people, light enough to carry anywhere, and available in any store, without training. And expecting owners to police themselves.

People are [terrified of AI](https://craignicol.wordpress.com/2015/10/09/why-ai-doesnt-scare-me/). We know we don’t need AI to disable hospitals. We don’t need AI to intercept Facebook logins (although FireSheep and [the pineapple](https://www.troyhunt.com/the-beginners-guide-to-breaking-website/) are less effective now). We don’t need AI to send a drone into a crowded market.

Make a website the only place for government applications, such as medicare or millennials railcards and it’s easy to remove access for all citizens.

But [combine all that with data and you can fuck up someone’s life without trying](https://craignicol.wordpress.com/2013/05/24/analyse-this-the-dangers-of-big-data/). [You can give 2 people the same national insurance number](https://www.telegraph.co.uk/news/uknews/2464627/National-Insurance-mix-up-has-left-dozens-of-elderly-people-without-their-pension.html) or other id. [You can flag them on the no fly list](https://www.factcheck.org/2015/12/ted-kennedy-and-the-no-fly-list-myth/).

[You can encode prejudice into the algorithm and incarcerate someone because they grew up in a black neighborhood](https://www.nytimes.com/2017/10/26/opinion/algorithm-compas-sentencing-bias.html).

The algorithm is God. The algorithm is infallible. Trust the algorithm.

Even when it tells you [someone is more capable than the humans says she is, and punishes them](https://www.theverge.com/2018/3/21/17144260/healthcare-medicaid-algorithm-arkansas-cerebral-palsy).

([unless you’re under GDPR where you have the right to question the algorithm](https://ico.org.uk/for-organisations/guide-to-the-general-data-protection-regulation-gdpr/))

But tell anyone that people will use data for purposes they hadn’t considered ([like using RIPA anti-terror legislation to see if someone’s in the school catchment area](https://www.telegraph.co.uk/news/uknews/3333366/Half-of-councils-use-anti-terror-laws-to-spy-on-bin-crimes.html)) then you’re paranoid.

Be paranoid. People will always stick crowbars in the seams. Whatever your worst case scenario for your code is, you’re probably not even close.

* * *

You can see my original tweet, and the repies, here:

{% tweet 975805201977413633 %}

[The Guardian has a great interview on AI, existential threats and ethics on their podcast here](http://pca.st/ksw0).
Is autocomplete really bad for beginners?
Tags: discuss, beginners
Published: 2018-03-30 06:57:22

---
title: Is autocomplete really bad for beginners?
published: true
description: 
tags: #discuss, #beginners
---

when I was learning to code, a lot of books and tutorials suggested disabling autocomplete feature saying that it will enforce you to learn the language instead of relying on the editor. 

I always find autocomplete a good thing.
- they reduce syntax errors, 
- tell you about what methods are available,
- show you expected datatype of args. 


what I think of learning to code is about "building stuff" not mugging up the language syntax. what do you guys think about it?
Programming in anime
Tags: fun, culture, javascript, html
Published: 2018-03-30 05:58:29

---
title: Programming in anime
published: true
description: 
tags: #fun #culture #javascript #html 
---

When programming is depicted in most shows, particularly in animation, it's typically showing someone typing furiously on the keyboard. The screen would either show the final output or gibberish. If any reference to an actual language or stack is brought up, like in the New Game! anime, it's all typically in the background.

After binging through my backlog for the current season, I ran into this:


[![YouTube video: Programming Language In Anime !](https://thepracticaldev.s3.amazonaws.com/i/opbs8q0d1nwhbti3hsvm.jpg)](https://www.youtube.com/watch?v=vlbO6bakH4)

YouTube video: Programming Language In Anime (https://www.youtube.com/watch?v=vlbO6bakH4)


The show is called Dagashi Kashi, based on a manga about cheap Japanese snacks. These clips are from the second season, episode 9. This is probably the first time I've seen programming in animation, with some attempt at mentioning actual stacks and showing plausible code, even if just for a second.


[![YouTube video: They Decide To Make Dagashi Website !](https://thepracticaldev.s3.amazonaws.com/i/yubuuwjqpzr221jwtjgq.jpg)](https://www.youtube.com/watch?v=8lBY1jnY02s)

YouTube video: They Decide To Make Dagashi Website! (https://www.youtube.com/watch?v=8lBY1jnY02s)

The clip above probably brings you back memories of when you first played around with code and you visibly saw it do stuff on screen. Ahhh, how easily we can get carried away...!

And sometimes, it still happens. :P

Have you ever encountered real-life programming languages or tech stacks in animation?
What are you hacking on this week?
Tags: discuss, question
Published: 2018-03-30 05:17:34

---
title: What are you hacking on this week?
published: true
description: Leave comment and/or link to your project
tags: discuss, question
---

I'm hacking almost exclusively in Erlang. It's a crazy language I visited a while back and ditched almost right away. Revisiting it after a year of FP feels like there's a lot I had missed.

**Advantages I got right away from working with FP**:

- I appreciate ES6 and JavaScript's newer syntax.
- I can't hack around and make code work out of the blue. You can end up doing that in an imperative language and your code will run without you knowing how. In languages like ML and Erlang you just can't.
- I get to think in abstraction ... seeing the wood from the trees.
- I never cease to get my mind blown over simple chop like this:

```erlang
list_length([]) -> 0;
list_length([Head | Rest]) -> 1 + list_length(Rest).
```

versus this

```python
def list_length(l):
    counter = 0
    for m in l:
        counter += 1

    return counter
```

The point is I get to realize that setting a counter variable and adding to it like how we first learned counting fingers as a child isn't the only way. (remember the situations in which you ran out of fingers to count or just plain forgot where you were at and your friend kept counting? That's hilarious, but those things actually cause most of the bugs we pull our hair on decades later).
Coding architecture
Tags: discuss, beginners, learning, csharp
Published: 2018-03-30 01:59:23

---
title: Coding architecture
published: true
description: test description
tags: #discuss #beginners #learning #csharp
---


![Structure-ish image](https://thepracticaldev.s3.amazonaws.com/i/jh7jiyrcd2e396cn95fb.png)

#Problems#

- Code architecture
- OPP in games
- OPP in general apps 
- MVC in non web apps

What should i do? I'm lost..

Hellow guys, i know the basics of C# and few design patterns, but how should i structure the whole project? To be more exact, I'm working with Unity3D, what is EC and that isn't 100% MVC appliable structure.
自宅 IoT
Published: 2018-03-30 00:54:44

---
title: 自宅 IoT
published: true
description: 
tags: 
---

# Echo
![Echo](https://images-na.ssl-images-amazon.com/images/G/09/kindle/dp/2017/879894539601/e/e_prod_v4._CB500873058_.jpg)

(https://www.amazon.co.jp/Amazon-Echo-New%E3%83%A2%E3%83%87%E3%83%AB-%E3%80%81%E3%83%81%E3%83%A3%E3%82%B3%E3%83%BC%E3%83%AB-%E3%83%95%E3%82%A1%E3%83%96%E3%83%AA%E3%83%83%E3%82%AF/dp/B071ZF5KCM)

# Roomba
![Roomba Serial](https://community-home-assistant-assets.s3-us-west-2.amazonaws.com/optimized/2X/c/c1a32634d0727a8b8e8d1db0a5ec1219799d5ccc_1_323x300.png)

![Roomba](https://community-home-assistant-assets.s3-us-west-2.amazonaws.com/original/2X/a/a258c7253f8bd3fe76ad9e7aa1202b60bd113d74.jpg)
​
# esp2866
![ESP2866](https://images-na.ssl-images-amazon.com/images/I/613Q6IxkivL._SL1000_.jpg)

https://www.amazon.co.jp/dp/B0718T232Z
Chrome extension for highlighting variables on GitHub
Published: 2018-03-30 00:00:00

---
title: Chrome extension for highlighting variables on GitHub
date: 20180330T00:00Z
---

[https://github.com/chrismwendt/github-highlight-variables](https://github.com/chrismwendt/github-highlight-variables) highlights variables on hover on GitHub:

![screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/byncmxuj2qznoyk2fzzo.png)
Do you use performance enhancing drugs when coding?
Tags: discuss
Published: 2018-03-29 23:37:54

---
title: Do you use performance enhancing drugs when coding?
published: true
description: High school students all over the world are taking pills to perform.
tags: discuss 
---

![Drugs](https://thepracticaldev.s3.amazonaws.com/i/hz1m09pk6bysyxu6ttay.jpg)
Apparently it is a lot more common than I thought. People using Aderall or ADHD medication when they code. High school students mostly.

Do you use performance enhancing drugs? How do you stand on this topic?
How to define a function in component interface on Roku(BrightScript/SceneGraph)
Tags: brightscript, rokusdk, scenegraph, roku
Published: 2018-03-29 21:50:25

---
title: How to define a function in component interface on Roku(BrightScript/SceneGraph)
published: true
description: Define a function named "doWhateverMan" on the corresponding component interface - short guide 
tags: #brightscript #rokusdk #scenegraph #roku
---

If you have custom component named "doWhateverScreen" and you would like to print a string passed down from a different component named "HomeScene" using function in "doWhateverScreen" component interface, this is how you would do it.

First in your doWhateverScreen.xml file add:

        <interface>
            <function name="doWhateverMan" />
        </interface>

Now in doWhateverScreen.brs file add your "doWhateverMan" function:

        Function doWhateverMan(param as String)
            print param
        End Function

Great, so far so good!Let us continue.
In your HomeScene.xml add this custom created "doWhateverScreen" screen/component and in HomeScene.brs init() function add:

        m.doWhateverScreen= m.top.findNode("doWhateverScreen")

We can now call a function named "doWhateverMan" from HomeScene.brs with:
    
        param = "Do Androids Dream of Electric Sheep?"
        m.doWhateverScreen.callFunc("doWhateverMan",param)

That's it! Have a great day. :-D
MYSQL Query With Timestamp Long Values
Tags: mysql, timestamp, datetime, javascript
Published: 2018-03-29 21:21:00

---
title: MYSQL Query With Timestamp Long Values
published: true
description: In unusual circumstances you be faced with a situation where you have long value representation of date-time at hand but you need to query over a timestamp field in MYSQL. Here is a small utility function that converts the long value to a MYSQL TIMESTAMP comparable format. The output from it can easily be passed to the TIMESTAMP function.
tags: MYSQL, TIMESTAMP, DATETIME, JAVASCRIPT
---

<pre>

<strong>
function MySQLTimeStampCompatibleString(timestamp){
    return new Date(timestamp).toISOString().substring(0, 19).replace('T', ' ');
}
</strong>	
function queryWithTimestampLongValues(fromTime, toTime) {

    var query = "";	   

    if(fromTime && toTime){	     

        query += 'SELECT * FROM user_info WHERE 
                   user_info.created_at > TIMESTAMP("' +     
                   MySQLTimeStampCompatibleString(fromTime) + '") AND 
                   user_info.created_at < TIMESTAMP("' + 
                   MySQLTimeStampCompatibleString(toTime) +  '")';
	

    }

    return query;
}	

</pre>