teleren/devto huggingface dataset:
Maker Faire Berlin 2018
Tags: music, arduino, tapes, upcycling
Published: 2018-08-12 10:36:11

---
title: Maker Faire Berlin 2018
published: true
description: Hoerapparate, a project to bring forgotten music media back to life
tags: music, arduino, tapes, upcycling
---

For this year's Maker Faire in Berlin, we came up with the idea of recovering old music media and make a cool project. We ended up choosing music boxes and casette tapes for creating two totally different musical experiments. 


![alt text](https://thepracticaldev.s3.amazonaws.com/i/9clja149iei4i54nnplz.png "Maker Faire")

One of the experiments is a cassette tape mixer. You can hear two cassettes tapes playing simultaneously and choose the output volume with a mixer.


The cassette mixer:

[![](http://img.youtube.com/vi/4jQXFzW5YX8/0.jpg)](http://www.youtube.com/watch?v=4jQXFzW5YX8 "Cassette Mixer")

This second project that I did is a synthesizer that reads notes from paper in the way of the old piano rolls. My main idea was to make music storage media readable  and understandable because since the introduction of magnetic media the distance between the creators of the media technology and the consumers has become very big and all the media is like a black box that cannot be decodified without the use of very complex machines also created by the producers of media technology. This leaves the consumer with almost zero means of using their storage media without depending on the big (damn capitalists) machines. In this experiment you can draw on a paper and the paper is at the same time your storage media and the notes and you can understand them in the same way the machine does. Thus bringing the user closer to his/her creation (inclusive writing, of course), bridging da big gap, if you know what I mean.

I want to elaborate further on this idea, I was thinking about building a machine that reads colors on a stripe of paper and produces music and play with the concept of Synesthesia.  

[![](http://img.youtube.com/vi/gJl-_CWCea8/0.jpg)](http://www.youtube.com/watch?v=gJl-_CWCea8 "Paper Reading Synth")

[![](http://img.youtube.com/vi/nTD39pFpj90/0.jpg)](http://www.youtube.com/watch?v=nTD39pFpj90 "Paper Reading Synth").



[Link to the project description from the Official Maker Faire website.](https://maker-faire.de/maker/h%C2%9Arapparate-mitmachen-und-verstehen-2/)
React Weather App Video Course - 11
Tags: javascript, react
Published: 2018-08-12 10:07:31

---
title: React Weather App Video Course - 11
tags: javascript, react
published: true
description: React tutorial for beginners. Making weather app part 11.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ojsoibgy6hwt92m05eq8.jpg
---

Now we finally make the card flip.

* [Part 11](https://youtu.be/L3PbRgGXeS4)
4 Full Examples of Monte Carlo Simulation
Tags: beginners, learning, matlab, python
Published: 2018-08-12 09:49:41

---
title: 4 Full Examples of Monte Carlo Simulation
published: true
description: We can use Monte Carlo simulation to solve real-world problems that lack the exact solution. Find out how through craps, Penney's game, Buffon's needle, and How Big Is Your Heart problems.
cover_image: https://crunchingnumbersdotlive.files.wordpress.com/2018/08/monte_carlo_simulation.png
canonical_url: https://crunchingnumbers.live/2016/01/24/monte-carlo-simulations-craps/
tags: #beginners, #learning, #matlab, #python
---

People land (stumble) on my [blog](https://crunchingnumbers.live/) the most to learn Monte Carlo simulation. It's a numerical method for solving real-world problems, especially those for which we don't know the exact solution. It's also a great way to learn coding and use math to further understand a problem.

Let me show you 4 examples, best to be read in sequence. The codes on my blog are in Matlab, but you can also find them in Python and R on [GitHub](https://github.com/ijlee2/crunchingnumbers).


### 1. [Craps](https://crunchingnumbers.live/2016/01/24/monte-carlo-simulations-craps/)

> Skills covered:

> - Random number generation
> - If-else statement
> - While and for loops
> - Conditional probability

![Dice being rolled](https://crunchingnumbersdotlive.files.wordpress.com/2016/01/dice.jpg)


### 2. [Penney's Game](https://crunchingnumbers.live/2016/01/28/monte-carlo-simulations-penneys-game/)

> Skills covered:

> - Arrays
> - String operations
> - User-defined function
> - Conway's algorithm

![Probability distribution of winning Penney's game](https://crunchingnumbersdotlive.files.wordpress.com/2016/01/penney_ante_distribution3.jpg)


### 3. [Buffon's Needle](https://crunchingnumbers.live/2016/02/01/monte-carlo-simulations-buffons-needle/)

> Skills covered:

> - Ceiling and floor functions
> - Min and max functions
> - Trigonometry & calculus
> - Affine transformation
> - Vectorization (parallelization)
> - Polymorphism

![Needles intersecting lines](https://crunchingnumbersdotlive.files.wordpress.com/2016/01/buffons_needle.jpg)


### 4. [How Big Is Your Heart?](https://crunchingnumbers.live/2016/02/05/monte-carlo-simulations-how-big-is-your-heart/)

> Skills covered:

> - Dimensional analysis
> - Boundary value analysis
> - Size-dependent simulation

![Hearts of various sizes](https://crunchingnumbersdotlive.files.wordpress.com/2016/02/heart_shape1.png)
在 Windows 建置以 Visual Studio 為基礎的 Python / Node.js 開發環境
Published: 2018-08-12 09:06:04

---
title: 在 Windows 建置以 Visual Studio 為基礎的 Python / Node.js 開發環境
published: true
description: 用 Windows 做開發的人一定要裝 Visual Studio 這樣專業的 IDE，不要裝其他次等的文字編輯器，才可以有效提升專業度。
tags: 
canonical_url: https://editor.leonh.space/2020/setting-up-python-node-js-development-environment-in-windows/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j9r2qhpp3idwdm8tpi9e.jpg
---

已經很久沒開 Windows 的我，最近又遇到非開 Windows 不可的理由，就順勢在新的 SSD 上重裝 Windows 以及 Python 與 Node.js 的開發環境。

比較特別的是這次想使用 Visual Studio 附帶的 Git 與 Python 與 C++ Build Tools 為基礎來打造開發環境，能不能順利完成，讓我們看下去。

起手式當然是先裝肥大的 Visual Studio 2019，把 「Python 開發」、「Node.js 開發」、「使用 C++ 的桌面開發」三種工作負載都裝起來，然後就去泡個茶等它。

![Viiual Studio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t4e8kswdug3958s0m36l.png)

## Git

<p>雖然安裝程式沒有特別告知，不過 Git 其實已經是 Visual Studio 標準安裝的一部份了，位置在 C:\Program Files (x86)\<wbr>Microsoft Visual Studio\<wbr>2019\<wbr>Community\<wbr>Common7\<wbr>IDE\<wbr>CommonExtensions\<wbr>Microsoft\<wbr>TeamFoundation\<wbr>Team Explorer\<wbr>Git\<wbr>git.exe 這個又臭又長的路徑，可以把這個 git.exe 加入環境變數的 Path 內，之後會比較方便。</p>

補個題外話，微軟自家的版控工具 Team Foundation Version Control 好像已經被當棄子了吧？

## Python

<p>因為在裝 Visual Studio 的時候就選了「Python 開發」，因此 Python 也會被貼心地一併裝好，位置在 C:\Program Files (x86)\<wbr>Microsoft Visual Studio\<wbr>Shared\<wbr>Python37_64\<wbr>python.exe 同樣又臭又長。而 Python 的套件管理工具 pip 則在同樣的位置下的 pip/pip.exe。一樣可以加到 Path 內方便使用。</p>

這樣裝的 Python 是系統全域安裝，還不確定會不會帶來一些什麼潛在的缺點，要免責聲明一下。

編按：認真想建置 Python 環境的小夥伴請見〈[建置 Python 3 開發環境](https://editor.leonh.space/2021/python/)〉。

## Node.js

和前面兩位不同，雖然在 Visual Studio 安裝也有勾了「Node.js 開發」，不過 **Visual Studio Installer 並沒有幫我們裝好 Node.js**，所以請去 Node.js 網站自行下載安裝 Node.js。

在 Node.js 方面，如果考慮到未來某些 npm 套件如果是 C++ 套件的話，npm 會幫我們做編譯，但需要事先幫它準備好編譯工具，也就是 MSVC C++ 建置工具，在 Visual Studio 2019 內稱為「**MSVC v142 – VS2019 C++ x86/64 建置工具（v14.25）**」（很有[微軟風格的取名](https://youtu.be/EUXnJraKM3k)啊！），它是 Visual Studio Install「使用 C++ 的桌面開發」的元件之一。

折騰完之後可以試裝一下需要編譯的 npm 套件：

```powershell
> npm install -g sqlite3
```

如果沒問題就是沒問題，如果有問題就不能稱之為沒問題。

## 結語

至此我們的電腦內有了 Git、Python、Node.js、C++ 的開發環境了，接下來就裝個 Visual Studio Code 來開開心心寫 code 吧！Visual Studio 則靜靜地躺在開始內裝Ｂ即可。
Being average in > 1 things is easier and more valuable than being excellent at 1 thing.
Tags: career, learning
Published: 2018-08-12 08:54:17

---
title: Being average in > 1 things is easier and more valuable than being excellent at 1 thing.
published: true
description: A short note on how you can increase your value as a software engineer without developing an olympic level of coding skill.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ztef2t8nseahekme9xai.jpg
tags: career,learning
---

> Note - This guideline is most useful for the bottom 99% of the practising software engineers. So if you are part of the remaining 1% - you can safely skip the this post.

There is a surprisingly easy hack that you can apply to increase your value generally in life. Pick up more skills. It sounds obvious when put on paper but there is one subtlety which makes it a “hack” in my opinion.

For this point we turn to the excellent Scott Adams’ book - “How to fail at almost everything and still win big”. Speaking about being successful, he says -  

> “… I tell them there’s a formula for it. You can manipulate your odds of success by how you choose to fill out the variables in the formula. The formula, roughly speaking, is that every skill you acquire doubles your odds of success.”

He goes on to mention that the level of proficiency for a skill is not mentioned because -
 
> “… you can raise your market value by being *merely good* - not extraordinary - at more than one skill.”

> “To put the success formula into its simplest form: **Good + Good > Excellent**”

This subtlety makes it very easy to execute. You don’t need to be extraordinary, you just have to be ordinary/average. Hence, if you are an average software engineer and you have any of the skills mentioned below - 
- Good at drawing 
- Public speaking
- Managing people 
- Have a knack to pick up people’s emotions
- An eye for design in product
- Spot problems in operational processes
- Shoot, edit and/or make videos
- Make original music
- Sing 
- Writing essays/blog posts
- Or anything else

You are immediately more valuable to yourself and your organisation vs someone is who is a very good software engineer only. So if you are a software engineer who can think of product ideas and execute independently (remember you only have to be of an **average** skill in it) - you have more than doubled your value. 

####__Leverage that skill.__

***

This is a short excerpt from a book I am writing - **[self.debug](https://leanpub.com/selfdebug)**. Its about using emotions and mindfulness to become a better software engineer. Please download it (has a **free option**!), and help make it better by providing feedback.

***

Photo by Alice Achterhof on Unsplash
When is your code 'good enough'?
Tags: discuss, beginners, productivity, webdev
Published: 2018-08-12 07:42:53

---
title: When is your code 'good enough'?
published: true
description: Curious to know when do the devs here decide to stop adding code.
tags: #discuss, #beginners, #productivity, #webdev
---

When do you decide your code is good enough? Is it after refactoring a dozen times or when you've check marked every task you had to do? 

Is it when there's not a single error or are you just happy that it doesn't crash your terminal when you run it?

I ask because I've been reading Katrina Owen's and Sandi Metz's book titled [99 Bottles of OOP](https://www.sandimetz.com/99bottles) and they talk about what they think is *good code*. 

As a beginner, I fall into the *write the code; run it; pray* category.

So tell me Devs. When do you decide your code is good enough?
Git the basics #1 (how-to)
Tags: git, tutorial, example
Published: 2018-08-12 06:25:23

---
title: Git the basics #1 (how-to)
published: true
description: We look into the very basic commands of git. Making changes and committing to a branch.
tags: git, tutorial, example, basic
---

{% youtube _hf_Al8ykq8 %}
Get HTTP request body data using Node
Tags: node, javascript
Published: 2018-08-15 10:15:36

---
title: Get HTTP request body data using Node
published: true
tags: node, javascript
canonical_url: https://flaviocopes.com/node-request-data/
---

Here is how you can extract the data that was sent as JSON in the request body.

If you are using Express, that’s quite simple: use the `body-parser` Node module.

For example, to get the body of this request:

```js
const axios = require('axios')

axios.post('https://flaviocopes.com/todos', {
  todo: 'Buy the milk'
})
```

This is the matching server-side code:

```js
const bodyParser = require('body-parser')

app.use(bodyParser.urlencoded({
  extended: true
}))

app.use(bodyParser.json())

app.post('/endpoint', (req, res) => {
  console.log(request.body.todo)
})
```

If you’re not using Express and you want to do this in vanilla Node, you need to do a bit more work, of course, as Express abstracts a lot of this for you.

The key thing to understand is that when you initialize the HTTP server using `http.createServer()`, the callback is called when the server got all the HTTP headers, but not the request body.

The `request` object passed in the connection callback is a [stream](https://flaviocopes.com/nodejs-streams/).

So, we must listen for the body content to be processed, and it’s processed in chunks.

We first get the data by listening to the stream `data` events, and when the data ends, the stream `end` event is called, once:

```js
const server = http.createServer((req, res) => {
  // we can access HTTP headers
  req.on('data', chunk => {
    console.log(`Data chunk available: ${chunk}`)
  });
  req.on('end', () => {
    //end of data
  })
})
```

So to access the data, assuming we expect to receive a string, we must put it into an array:

```js
const server = http.createServer((req, res) => {
  let data = []
  req.on('data', chunk => {
    data.push(chunk)
  });
  req.on('end', () => {
    JSON.parse(data).todo // 'Buy the milk'
  })
})
```
Android Architecture Components: Room, ViewModel and LiveData
Tags: android, room, livedata, viewmodel
Published: 2018-08-12 04:30:40

---
title: Android Architecture Components: Room, ViewModel and LiveData
published: true
description: 
tags: Android,Room, LiveData, ViewModel
---

![Architecture Components](https://thepracticaldev.s3.amazonaws.com/i/jen7dsuf625espc8unn8.png)

“Android Architecture Components: Room, ViewModel and LiveData” @akshay81844 https://medium.com/mindorks/android-architecture-components-room-viewmodel-and-livedata-50611793e4a9
Python's type hints
Tags: python, python3, typehint
Published: 2018-08-12 02:12:26

---
title: Python's type hints
published: true
description: One of my favorite ways to make my Python code more explicit - type hints
tags: python,python3,typehint
series: Python tips
cover_image: https://thepracticaldev.s3.amazonaws.com/i/tpg9vxl6h27r5qhh0ci0.png
---

If you've been working with Python for a little time, chances are that you've heard that [explicit is better than implicit](https://www.python.org/dev/peps/pep-0020/). If you've been working with Python for a long time, chances are that you strongly agree with that statement.

Today, I wanna share with you one of my favorite ways to make my Python code more explicit:

## Use type hints

Let's consider the following function:

{% gist https://gist.github.com/victor-o-silva/c87568eb0c0a64dff6daf4538b8ac99b %}

Before reading its body (which could be extremely complex), one knows neither the expected parameter type nor the return type.

Of course, we could name the function `get_due_dates_dict` and the parameter `start_date`, but that would be extremely anti-pythonic, specially when we have a much better option: [type hinting](https://docs.python.org/3/library/typing.html) via [function annotations](https://www.python.org/dev/peps/pep-3107/). Check it out:

{% gist https://gist.github.com/victor-o-silva/c12f965665a4f1da25d1b760fcbdf314 %}

Ok, now by just looking at the function's heading, we know that it expects a date and returns a dict. And just as important, any Python-aware IDE will know this as well, and will give us some nice autocompletion features.

But we can do better. We can annotate our function is such a way that we (and our IDEs) know even the structure of its return without having to read its body:

{% gist https://gist.github.com/victor-o-silva/eaaeda5cd1658c95d749cba738c40b0f %}

Now, it's explicit that our function returns a dict in which the keys are integers and the values are dates. In the screenshots below, we can see that [PyCharm](https://www.jetbrains.com/pycharm/) understands this perfectly, and gives us precise tips and autocompletions:

![PyCharm - parameter](https://thepracticaldev.s3.amazonaws.com/i/x21gx2rh60n6p1stktx6.png)

![PyCharm - return](https://thepracticaldev.s3.amazonaws.com/i/3ao8p81e81jbcjgp3f1y.png)

Type hints make everyone's life easier down the road.

That's it for today, happy coding!
Imposter syndrome
Tags: discuss, career, beginners, productivity
Published: 2018-08-11 23:51:20


---
title: Imposter syndrome
published: true
description: the imposter syndrome, how i overcame it
tags: #discuss,#career,#beginners,#productivity 
---
<img src="https://thepracticaldev.s3.amazonaws.com/i/6oby64hf6dk928xm76pg.png"/>
<a href="https://www.chanty.com/blog/stop-feeling-like-imposter-work/">image source</a> 


**S**o, i have been studying software engineering for almost 5 years, and i always had a problem, i always thought (and still now sometimes) that i don't know how to code, that I'm not even average, or that they are many genius programmers and I'm just one guy that struggle to write code.
But, two weeks ago, a friend of mine told me something that turned me upside down :
>"you are a role model and i am working day and night to reach the coding skills that you have,i want to be just like you".

When she said that, i was shocked, so many things came to my mind : 
*how can she want to be just like me when i spend my time on stack-overflow, when i can't remember some basics CSS rules?*
But i realized something, coding is a journey, you will never be the best but you always have to work to be the best.
Sometimes you may feel like you know nothing, but remember that those who answer your questions on Stack-overflow were one day just like you.
Remember that there is someone out there who is working and hoping someday to be like you, to reach the level where you are now.
So whenever the imposter syndrome hits you , just remember what you have already done and say to yourself that you are just starting your journey. Always say to yourself that you are the best, that you are going to be the best, self confidence is the key.
Ruby Gem debug_helper v2.0 Supports Custom Handlers
Tags: ruby, debugging
Published: 2018-08-11 23:06:42

---
title: Ruby Gem debug_helper v2.0 Supports Custom Handlers
published: true
description: 
tags: ruby, debugging
---

Ruby gem `debug_helper` [Version 2.0](https://github.com/BurdetteLamar/debug_helper#new-in-version-20) is up.

The `debug_helper` assists in printf-style debugging by displaying details about objects, often recursively.

New support for custom handlers:  previously, the helper supported selected classes in the Ruby core and standard libraries.

Now you can make custom handlers for your own user-defined classes.
Why mailchimp-mandrill driving me nuts?
Tags: programming, api, email, mailchimp
Published: 2018-09-12 11:04:14

---
title: Why mailchimp-mandrill driving me nuts?
published: true
tags: Programming,API,e-mail,mailchimp
canonical_url: 
---

I have used mailchimp and its API mandrill in couple of projects recently.

Both of these projects had requirements to send a relatively complex emails such as confirmations to customers, detailed invoice and account totals which required a strong email template engine to allow sending object list and let the template itself loop through the objects and display them.

I found Mandrill and their template engine which you can set it to use Handlebars.js is very powerful and fit my needs pretty well.

Because Mailchimp templates design editor is robust and easy to use, we started to build the templates in mailchimp then pushed to mandrill to be called from my project.

Till this moment everything looks perfect and no problems.

But, what happened next is the following:

I wanted to remove some code which Mailchimp template designer adds to the template by default: [https://stackoverflow.com/a/46185879/20126](https://stackoverflow.com/a/46185879/20126)

So I went to the Mandrill template editor, (which has no UI, you will need to update pure HTML) and updated the code there. all good, But now I can’t push the template back to Mailchimp, there is no way to sync between them anymore, and as a result I have now 2 different version of the same template, original one on Mailchimp (which I don’t to push anymore to Mandrill), the Mandrill new updated version.

And the real pain behind this that the Mandrill email template editor is very poor comparing the rich design Mailchimp template editor.

But now I have no way to go back to Mailchimp and I am trapped in Mandrill  ![🙁](https://s.w.org/images/core/emoji/11/72x72/1f641.png)

Mailchimp: please you will need more integration functions with Mandrill to look like one application.
Do you have a morning routine?
Tags: discuss
Published: 2018-08-11 21:53:52

---
title: Do you have a morning routine?
published: true
description: 
tags: discuss
---

I recently started the following morning routine:

1. Clean my room and make my bed
2. Do a couple body-weight exercises
3. Stretch
4. Drink a glass of water and take vitamins
5. Shower and get dressed

I do it the same way every single day. The difference it has made in my outlook and ability to focus for the rest of the day is noticeable. Do any of you do something similar with your mornings?
Customizing Keyboard Shortcuts for any macOS App
Tags: productivity, keyboard, shortcuts
Published: 2018-08-14 01:13:33

---
title: Customizing Keyboard Shortcuts for any macOS App
published: true
tags: Productivity,Keyboard,Shortcuts
canonical_url: https://ishan.co/macos-keyboard-shortcuts
cover_image: https://ishan.co/wp-content/uploads/2018/08/Ishan-Sharma-Customizing-macOS-Shortcuts.png
---

If you are reading this, chances are that you use keyboard shortcuts as part of your daily workflow. From cut, copy, paste to the “Paste and Match Style” to IDE's code folding and unfolding, there are shortcuts that you use without even realizing. Most apps allow you to customize the shortcuts, but you may find a few that do not support that.

I was in this situation a couple of weeks ago when I needed a quick shortcut to archive the messages in Mail app. The default shortcut was not very intuitive and I needed something quick, like `⌘ + A`.

After some searching, I found that macOS has a built-in setting that lets you customize shortcuts for any app.

You just need to go to System Preferences → Keyboard → Shortcuts → App Shortcuts and add a new one. You can either add a shortcut for a specific app or system wide.

Some other shortcuts that I use in the Mail app:

1. `⌘ + 1` for numbered lists
2. `⌘ + 8` for unnumbered lists

Here’s the tweet that inspired me to write this post (good tip, though I don’t use it):

{% twitter 1024656834571976705 %}

And here’s Apple’s documentation if you prefer detailed steps: [macOS Sierra: Create keyboard shortcuts for apps](https://support.apple.com/kb/PH25377?locale=en_US "macOS Sierra: Create keyboard shortcuts for apps").

Know any other tips like this? Go ahead and share in the comments or on [Twitter](https://twitter.com/real_ishan).
Advice needed: writing a paper/thesis
Tags: discuss, beginners, computerscience
Published: 2018-08-11 19:06:31

---
title: Advice needed: writing a paper/thesis
published: true
description: Writing my first thesis, for CS undergraduate degree
tags: discuss, beginner, computerscience
---

My little background: I just started writing (in english, definitely not my native language) my CS undergraduate degree thesis after a 3 months internship in a startup that helped me realizing a blockchain based application for the IOT.

Of course I have contact with my professor, but I wanted to ask here if anyone have some experience and wants to share some tips :)

I started reading a couple of other thesis shared from the professor, I understand they are not blog posts and must be formal - but is it okay if they are boring? Also, should I go deep into details (even the ones that seems obvious) and explain literally *everything*?

Thank you :)