teleren/devto huggingface dataset:
My "lightbulb" Moment!
Tags: teabreakchallenge, webdev, motivation, discuss
Published: 2019-01-30 02:01:57

---
title: My "lightbulb" Moment!
published: true
description: My response to Teabreak Challenge #29. My "lightbulb" moment!
tags: #teabreakchallenge, #webdev, #motivation, #discuss
---

> No matter how you started coding, you have had formative moments when learning. Reflect on one of your “lightbulb” moments when things started to “click." ~ Tea Break Challenge, Day #29

Almost six years ago... The beginning of my career, during college, I was hired as a part-time Mobile Software Developer consultant. I was hired with little to no knowledge on how to do the job — but, I was so determined... I went the entire first year without really understanding how to read API documentation; however, I was able to build my first production mobile application for a client within this first year! Although the app was a success, I really was still unsure about myself and how I was able to build it. The company I was working for then hired a new developer who was also aspiring to be a software developer, and it was me assigned to teach him "how to build mobile applications." — Whelp, so I did! I taught him how to read API documentation, And you know what...? That's when it clicked! I won't forget that "lightbulb!" moment, because I looked at him like... **** I know what I am talking about after all!

Teach and you will learn.

**What's a lightbulb moment of yours?**

___

Hello! I'm Jon Major Condon. I spend my days as a Software Farmer, tending to client codebases at Bendyworks. As a farmer of software, I focus on Javascript, CSS, and mainly React. That's not all though; I love spending my time with my wife and kids and focusing on my growth as a developer and helping others grow too! This year I am working to grow my writing skills, so I hope to publish some of my "Tea Break Challenge" responses and other posts involving anything life and dev related. I hope you enjoy!

What's the [Tea break Challenge](https://www.teabreakchallenge.com/)? Every day there is a new challenge to help developers connect with their inner-self. The Tea Break Challenge is also done by a phenomenal dev podcast called [DeveloperTea](https://developertea.simplecast.fm/)
How were bugs handled post production RTM before the cloud?
Tags: discuss, bugs
Published: 2019-01-30 01:54:51

---
title: How were bugs handled post production RTM before the cloud?
published: true
description: discussion about software bugs in the old days
tags: discuss, bugs
---

![Morris Internet Worm](https://raygun.com/blog/images/costly-software-errors/mole.png)

I was listening to The Changelog podcast [277](https://changelog.com/podcast/277) which is about the The Story of Visual Studio Code. I started thinking about how did software engineering teams handled bugs after Release To Manufacturing (RTM), before the cloud and before git repositories, or any other type of downloadable patch.

If you were on such teams I would love to hear about it. I am interested to know if CD's rom installers were delivered with patches in mind, or even floppy disk installers. Or did another full installer was delivered, rather than a patch. 

 - What was your most memorable bug?
 - What was the most costly bug?
 - How was the patch delivered?
HFOSS litreview1
Tags: rithfoss, bugs, litreview1
Published: 2019-01-30 01:28:14

---
title: HFOSS litreview1
published: true
description: Literature review for my HFOSS class on How to Report Bugs Effectively by Simon Tatham.
tags: #rithfoss #bugs #litreview1
---

[How to Report Bugs Effectively](https://www.chiark.greenend.org.uk/~sgtatham/bugs.html) by Simon Tatham is an article I read recently about how to effectively report bugs when working on a collaborative project. Tahtham is the free-software programmer that created PuTTY, a commonly used free SSH client. In the article Tatham gives a very thorough explanation of how to report bugs to programmer. While I have had a lot of experience debugging my and other people's code, I haven't thought about how to properly articulate these problems to my peers. I think that this article can help people who are having trouble with communicating their issues to others, and people who want to be more efficient at debugging their own code.

In one section of the article titled "So then I tried...", Tatham presents a concept many people don't practice when encountering a problem in their code, restraint. Tatham claims that when encountering a bug many people immediately start trying to fix it without thinking everything through. This can cause a simple problem to become much worse. He advocates for proper planning and research before doing something irreversible. While I do think that the ice isn't always as thin as Tatham suggests in his article, I agree that stopping to think about what happened and planning out a solution before rushing in to fix it would help me a lot in my problem solving process.

While the previous section I mentioned felt more about debugging my own code, the rest of the article is very focused on reporting bugs to other people's projects. The article was was a verbose, but it was a nice description of the proper ways to report bugs as a user or collaborator. Tatham discusses how to provide concise, helpful information to people that need to fix a bug or help you figure out why something isn't working for you. He wants people to provide thorough steps on how to recreate a problem, and be very specific in what you see when things start to break.
Swift Minimum Realtime Speech Recognition Code
Tags: swift, ios
Published: 2019-01-29 12:01:15

---
title: Swift Minimum Realtime Speech Recognition Code
published: true
description: 
tags: swift, ios
---

## Preparation
Add these settings to `Info.plist`.

```xml
	<key>NSSpeechRecognitionUsageDescription</key>
	<string>[description]</string>
	<key>NSMicrophoneUsageDescription</key>
	<string>[description]</string>
```

## Code

```swift
import UIKit
import Speech

class ViewController: UIViewController {

    private let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "ja-JP"))!
    private var recognitionRequest: SFSpeechAudioBufferRecognitionRequest?
    private var recognitionTask: SFSpeechRecognitionTask?
    private let audioEngine = AVAudioEngine()

    override func viewDidLoad() {
        super.viewDidLoad()

        requestRecognizerAuthorization()
        try? start()
    }

    private func requestRecognizerAuthorization() {
        SFSpeechRecognizer.requestAuthorization { (authStatus) in
        }
    }

    private func start() throws {
        if let recognitionTask = recognitionTask {
            recognitionTask.cancel()
            self.recognitionTask = nil
        }

        let audioSession = AVAudioSession.sharedInstance()
        try audioSession.setCategory(.record, mode: .measurement, options: [])
        try audioSession.setActive(true, options: .notifyOthersOnDeactivation)

        let recognitionRequest = SFSpeechAudioBufferRecognitionRequest()
        self.recognitionRequest = recognitionRequest
        recognitionRequest.shouldReportPartialResults = true
        recognitionTask = speechRecognizer.recognitionTask(with: recognitionRequest) { [weak self] (result, error) in
            guard let `self` = self else { return }

            var isFinal = false

            if let result = result {
                print(result.bestTranscription.formattedString)
                isFinal = result.isFinal
            }

            if error != nil || isFinal {
                self.audioEngine.stop()
                self.audioEngine.inputNode.removeTap(onBus: 0)
                self.recognitionRequest = nil
                self.recognitionTask = nil
            }
        }

        let recordingFormat = audioEngine.inputNode.outputFormat(forBus: 0)
        audioEngine.inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in
            self.recognitionRequest?.append(buffer)
        }

        audioEngine.prepare()
        try? audioEngine.start()
    }

    private func stop() {
        audioEngine.stop()
        recognitionRequest?.endAudio()
    }

}
```

## Swift Version
```
Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.2.0
```

## Reference
- https://qiita.com/shu223/items/ca8e62803e83e396c177
- https://dev.classmethod.jp/smartphone/iphone/try-ios10-speech-recognizer/
3 HTML5 Input Attributes To Help Mobile Users
Tags: ui, html, webdev
Published: 2019-01-29 23:17:40

---
title: 3 HTML5 Input Attributes To Help Mobile Users
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/vsy8g49it18j96zthb30.png
description: Shows how adding 3 simple HTML5 input attributes (autocapitalize, autocorrect and spellchecK) can make a mobile users life a little less frustrating when filling in a form.
tags: ui, html, webdev
series: html input attributes
---

#Do you feel the pain?😫📱
* When your phone changes the first letter to an uppercase straight after you've typed the first letter?
* When your phone auto corrects the word as it thinks it spelt incorrectly?
* When your username is marked as being misspelt with a red squiggly line?

If any of the above have frustrated you in the past, then you need to be a good citizen / developer and make sure you use these attributes within your projects.

* autocapitalize
* autocorrect
* spellcheck

**Note:** These attributes only apply to **input** tags with the type *text*, *email* or **textarea** tags.

## autocapitalize
This attribute when set to *none* stops browsers trying to help the user by auto-capitalizing words.

```html
<input type="text" autocapitalize="none" />
```

## autocorrect
This attribute when set to *off* stops iOS from auto correcting words when typed into a text box. Commonly this attribute is switched off for a username field. i.e. A random string that isn't in the dictionary and shouldn't be auto corrected.

```html
<input type="text" autocorrect="off" />
```

## spellcheck
This attribute when set to *false* stops browsers highlighting when a word has been misspelt with a underline.

```html
<input type="text" spellcheck="false" />
```

## Putting It All Together
Below is an example of how a sign in form could use the attributes to make it easier for mobile users.

```html
<form>
    <label for="username">Username</label>
    <input id="username" name="username" type="text" autocapitalize="none" autocorrect="false" spellcheck="false" />
    <label for="password">Password</label>
    <input id="password" name="password" type="password" />
    <button type="submit">Sign In</button>
</form>
```
Looking for a few helping hands!
Tags: webdev, discuss, help
Published: 2019-01-29 22:41:14

---
title: Looking for a few helping hands!
published: true
description: A site of tools to give back to the community
tags: webdev, discuss, help
---

So I recently created a website https://gidgitz.com which is a website to help developers with some tools and resources they use daily. I would love to meet a few developers that would like to be part of the project. I want to start off small so we can organize and get a flow going. 

I hope to keep it free if possible, as I'm a dad and can't really afford an expensive server fee lol. If you want to contribute (no pay :P) just to be part of it and add your touch to it, then message me! 

Thank you!

--DeChamp
Nested json to python object 
Tags: json, python, nested, object
Published: 2019-01-29 22:30:07

---
title: Nested json to python object 
published: true
description: 
tags: json, python, nested, object
---

Today i was creating a configuration file, in the past, i accessed configuration as a dictionary, but this time, i think about changing that. The follwing code creates dynamic attributes with the objects keys recursively.

But first, i'll show the json object:

```json
{
  "key": "value",
  "list": [
    "a",
    "b",
    "c",
    1,
    {
      "key": 1
    }
  ],
  "object": {
    "key": {
      "key": 1
    }
  }
}

```

On the conversion we have 3 cases:
 - lists
 - dicts (new object)
 - bool, int, float and str


```python
import json

class AppConfiguration(object):
    def __init__(self, data=None):
        if data is None:
            with open("cfg.json") as fh:
                data = json.loads(fh.read())
        else:
            data = dict(data)

        for key, val in data.items():
            setattr(self, key, self.compute_attr_value(val))

    def compute_attr_value(self, value):
        if type(value) is list:
            return [self.compute_attr_value(x) for x in value]
        elif type(value) is dict:
            return AppConfiguration(value)
        else:
            return value
```

Now the key, value pairs are attributes - objects.

```python
instance = AppConfiguration()
>>>instance.key
'value'

>>>instance.list[4].key
1

>>> instance.object.key.key
1
```
I Ask: Do people actually say "MERN-stack?"
Tags: javascript, discuss, mern
Published: 2019-01-29 21:48:59

---
title: I Ask: Do people actually say "MERN-stack?"
published: true
description: banabrann asks if the "MERN-stack" is a used word in the industry.
tags: javascript, discussion, MERN
---

* Have you ever heard the term "MERN-stack" used?
* From your experience, would the majority of coders around you understand what that entails to someone's coding tools if they say they're a "MERN-stack developer?" What do you think about this?

**MERN refers to Mongo, Express, React, and Node.** It's a term I've started hearing early this month, and thought nothing of it other than a cool acronym to describe these toolsets. Then, I started hearing it called the "MERN-stack," and one or two "MERN-stack developers" and January passed on.

This is pure curiosity, and I'd be interested in reading your replies.

Thanks for your answers, and Happy Coding!
~bananabrann
The Fantastically Magical handleEvent Function
Tags: javascript, webdev
Published: 2019-01-29 21:10:22

---
title: The Fantastically Magical handleEvent Function
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/rxm8dg58np14irb2fylm.jpeg
description: Using the magical handleEvent function to handle JavaScript events and work around some common event handling caveats
tags: javascript, webdev
---

Let's take a look!

{% codepen https://codepen.io/rikschennink/pen/wNzQYg default-tab=js,result %}

I remember how I reacted when I found out about this years ago, also I still had a majestic mustache.

![A man with a mustache saying: What the fuck?!?](https://thepracticaldev.s3.amazonaws.com/i/pojqauoyf4pk57oyz429.gif)

That's right, this works, it's weird but it does. 

If you set an object as the handler to `addEventListener` and said object has a property that is named `handleEvent` and that property is of type `function` the `event` is automatically sent there.

The reason this works (and works on all browsers):

> The need for compatibility with legacy content required `EventListener` to accept both a `function` and an `object` with a `handleEvent()` property function.

[EventListener on MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventListener)

Another nice thing about *this* is that **this** keeps `this` working.

{% codepen https://codepen.io/rikschennink/pen/PVGgYW default-tab=js,result %}

So, no need for `bind(this)` to ensure you end up in the right scope. Also, events are easily removed with `removeEventListener('click', this)`

Instead of having different functions to handle events, you can use a single `handleEvent` function to route all kinds of events.

```js
class MyClass {
	
  constructor() {

    // Get a reference to the button node
    const btn = document.querySelector('button');
    const input = document.querySelector('input');

    // Handle clicks by this
    btn.addEventListener('click', this);

    // Handle input by this
    input.addEventListener('input', this);

  }
	
  handleEvent(event) {
    if (event.type === 'click') {
      // handle button clicks 
    }
    else if (event.type === 'input') {
      // handle text input
    }
  }
	
}
```

I hope this sparked some interesting new ideas for you to work with!
CSS is awesome.
Tags: css, refactoring
Published: 2019-01-29 20:34:50

---
title: CSS is awesome.
published: true
description: This is a little piece of an iceberg of +3MB css file  
tags: css, refactoring
cover_image: https://thepracticaldev.s3.amazonaws.com/i/2alu8dnpjxvet6abacp5.png
---

I really love CSS, before to start a refactoring job in a project, I usually check the CSS with CSS Stats (https://cssstats.com).

This is a little piece of an iceberg of a CSS file I founded in this project.

![https://thepracticaldev.s3.amazonaws.com/i/6veh8e2cuv9ztc3alzk1.png](https://thepracticaldev.s3.amazonaws.com/i/6veh8e2cuv9ztc3alzk1.png)
_Piece of code with *42* nines for z-index_

![https://thepracticaldev.s3.amazonaws.com/i/m81jwrmkdtne8gc2hx0i.png](https://thepracticaldev.s3.amazonaws.com/i/m81jwrmkdtne8gc2hx0i.png)
_Results of CSS Stats_

CSS is awesome, it's true, but keep a CSS file maintainable it's the challenge.
Overview of React Hooks
Tags: react, reacthooks, javascript, frontend
Published: 2019-01-29 20:30:32

---
title: Overview of React Hooks
published: true
description: Learn what's new with React Hooks. For example, use state in a functional component.
tags: #reactjs #reacthooks #javascript #frontend
canonical_url: https://auth0.com/blog/overview-of-react-hooks/
---

In this article, we are going to go over React Hooks. This new feature is currently in the alpha stage. With React Hooks, we will be able to write functional components that have a state; no need to use a class component for state anymore!

[Read on ⚛️](https://auth0.com/blog/overview-of-react-hooks/?utm_source=dev&utm_medium=sc&utm_campaign=overview_reacthooks)

![Overview of React Hooks](https://thepracticaldev.s3.amazonaws.com/i/7xpcoswvus2asbz1y14x.png)
Welcome Thread - v28
Tags: welcome
Published: 2019-01-29 20:10:43

---
title: Welcome Thread - v28
published: true
description: Introduce yourself to the community!
tags: welcome
---

Hey there! Welcome to dev.to!

![A "cherryhead" rides a rainbow surfboard through space.](https://media.giphy.com/media/26BoDKvaLazkH6q3u/giphy-downsized.gif)

Leave a comment below to introduce yourself to the community! ✌️

Here are some ideas to get you started:

1. You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment and say hello or ask them a question. 👋

3. Or answer this question: do you like listening to music while coding? If so, what's usually playing?
We launched our beta version of React Quantum, a render performance heatmap!
Tags: react, javascript
Published: 2019-01-29 19:23:19

---
title: We launched our beta version of React Quantum, a render performance heatmap!
published: true
description: 
tags: react, javascript
---

Hello everyone of reactjs DEV community!

Our team is delighted to announce that we have launched a beta version of **React Quantum**. Currently under review by Chrome Store , this is **a React component performance measurement tool **that visualizes component tree hierarchy where users can click and hover on nodes to see their respective render time, commit frequency, and props and states that triggered the commit.

This project could not have been possible without the thoughtful and proactive contributions of reactjs members on DEV, Reddit, and Hashnode to the post we put several weeks ago to find project inspiration. **Thank you so much!**

If you are interested in or would like to stay updated about or make contributions to our project, we welcome all of you to follow us on **@reactQuantum** and check out our [Github repository](github.com/ReactQuantum/ReactQuantum/tree/dev) !

Have a nice day!! :)
Exploring Clojure (and FP vs OOP)
Tags: clojure, clojurescript
Published: 2019-01-29 16:15:30

---
title: Exploring Clojure (and FP vs OOP)
published: true
description: 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ekrlkgqv45grx3klxvvg.png
tags: clojure,clojurescript
---

I’ve always viewed functional programming (FP) from afar, mostly because object-oriented programming (OOP) is the dominant development methodology I’ve been using (Java, Ruby, C#, etc.) for many years.  A majority of the articles I’ve read on FP have statements like this:

> If you’ve never tried functional programming development, I assure you that this is one of the best time investments you can make. You will not only learn a new programming language, but also a completely new way of thinking. A completely different paradigm.

Please read the entire article here: <a href="https://bobonmedicaldevicesoftware.com/blog/2019/01/27/exploring-clojure-and-fp-vs-oop/" target="_blank">Exploring Clojure (and FP vs OOP)</a>
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2019-01-29 15:47:02

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

The **[I Am Not A Real Programmer](https://dev.to/andygeorge/i-am-not-a-real-programmer-1ogo)** article is a wonderful and completely-relatable tail of battling imposter syndrome.  @daveskull81 chips in with more encouragement and perspective:
{% devcomment 8c7o %}

@joelnet follows up on a great primer and set of warnings in **[Be careful of the JWT hype train](https://dev.to/darraghor/be-careful-of-the-jwt-hype-train-3e81)**, with some additional thoughts and considerations:
{% devcomment 8al6 %}

This was a really fun thread — **[What is your "Coder/Language Fit"](https://dev.to/ben/what-is-your-coderlanguage-fit-nn7)**.  @rpalo described why Ruby / Python click for his brain:
{% devcomment 8bpm %}

Some of my favorite exchanges happen in the [#help](/t/help) and [#explainlikeimfive](/t/explainlikeimfive) tags.  There's something enjoyable about the clean call and reply.  **[What are SaaS and PaaS?](https://dev.to/wiz_ar/what-are-saas-and-paas-lk3)** received a great answer from @jsrn:
{% devcomment 8bli %}

Finally, when asked: **[Do you have any energy and time for your personal goals after a full day of work at your job?](https://dev.to/ilonacodes/do-you-have-any-energy-and-time-for-your-personal-goals-after-a-full-day-of-work-at-your-job-nm5)** @mortoray discusses motivation, setting goals, and drawing energy from personal projects:
{% devcomment 8d5n %}

See you next week for more great comments ✌
Split string in two parts with bash
Tags: bash, shell
Published: 2019-01-29 15:30:27

---
title: Split string in two parts with bash
published: true
description: 
tags: bash, shell
---
We can use variable substitution to split a string using a character as separator:

```
STRING="x@y"

FIRST="${STRING%@*}"
SECOND="${STRING#*@}"

echo $STRING
echo $FIRST
echo $SECOND
```
Result:
```
x@y
x
y
```
Advice for Developers in the Early Stage of their Career
Tags: discuss, career
Published: 2019-01-29 15:26:13

---
title: Advice for Developers in the Early Stage of their Career
published: true
tags: discuss, career
---

I have been asked this a couple of times and will love to hear from others too. 
How long have you been in the Software Development Industry and what advice can you give to developers that are just starting out?