teleren/devto huggingface dataset:
A blockchain for dummies
Tags: blockchain, proofofwork, javascript, node
Published: 2018-09-03 15:13:47

---
title: A blockchain for dummies
published: true
description: A super simple implementation that one might do in order to teach someone basic concepts of blockchain and proof-of-work
tags: blockchain, proof-of-work, javascript, nodejs
---

While crypto-currencies are having bad time financially these days, it obviously has inspired and spun up a lot of [applications](https://medium.com/@matteozago/50-examples-of-how-blockchains-are-taking-over-the-world-4276bf488a4b). *Blockchain* and *proof-of-work* are fundamental concepts for the buzz that surrounds crypto-currency. While I see many people discussing the applications and possibilities, the serious lack of understanding among common developers prompted me to do a "**Blockchain for dummies**" implementation. So [here it is](https://repl.it/@maxpert/51b7eBlockchain):

{% replit @maxpert/51b7eBlockchain %}

Here are the goals I've tried to achieve:

 - I wanted to implement it in most popular language, so I selected Javascript.
 - Wanted to show clear separation between proof-of-work and actual chain itself.
 - For proof-of-work I selected floating numbers and hex string matching. Rather than having random string generation or something complicated it  allows a simpler implementation that won't irritate your eyes but still shows the difficulty you can achieve.
 - For blockchain I stored everything in memory again for simplicity.
 - No comments! If code can't explain itself I would call it useless.
 - Use everything builtin (no external packages), because you don't need anything else!

I would be more than happy to improve it based upon feedback. Let me know what you think!
What are some reasons to switch to a "native" desktop stack over a web based one?
Tags: discuss
Published: 2018-09-03 15:29:25

---
title: What are some reasons to switch to a "native" desktop stack over a web based one?
published: true
tags: discuss
cover_image: https://i.ytimg.com/vi/Oct2xKMGOno/maxresdefault.jpg
---


Hello my dudes.

My main projects over the past year were software solutions for various businesses. My model so far:

1. Gather relevant information for planning.

2. Develop a web app.

3. Deploy it to their network for consumption.

I chose to create solutions as web applications (even if most of the time internet connection is not required) because web development is my domain and being cross platform is important. Another point is that these are not mission-critical solutions that need to squeeze the maximum performance to operate; continuous delivery is much more valued.

So back to the question(s): 

- What are some reasons to switch to a "native" desktop stack over a web based one?
- What are some good options that you can recommend based on the information above? 

I could see some greenfield projects in the near future, so I'll be really appreciative for your input!
Handle React Native crashes with the componentDidCatch error boundary
Tags: reactnative, react, mobile, javascript
Published: 2018-09-03 14:08:20

---
title: Handle React Native crashes with the componentDidCatch error boundary
published: true
description: 
tags: #reactnative #react #mobile #javascript
---

*Want to stay up-to-date? Check out React Native Now, the bi-weekly [React Native newsletter](https://reactnativenow.com/)*

---

React 16 allows you to [catch JavaScript errors](https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html) inside of your components, which is great if you're aware of a particular component that is prone to break for one reason or another. As an added measure of protection, you can also utilize error boundaries in our top level parent with a `componentDidCatch` so that your users can have a better experience if an unexpected error occurs in any of the children/screens.

In the below example, I utilize a native alert combined with the [react-native-restart](https://www.npmjs.com/package/react-native-restart) package to provide users with an easy way to reboot the app and recover from a crash.

````js
componentDidCatch(error, info) {
    // to prevent this alert blocking your view of a red screen while developing
    if (__DEV__) {
        return;
    }
    
    // to prevent multiple alerts shown to your users
    if (this.errorShown) {
        return;
    }

    this.errorShown = true;

    Alert.alert(
        null,
        'An unexpected error has occurred. Please restart to continue.',
        [
            {
                text: buttonText,
                onPress: RNRestart.Restart,
            },
        ],
        { cancelable: false }
    );
}
````
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2018-09-03 13:56:26

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---

#1. Self-control

From being too comfortable to not exercising enough, Lewis shares a few habits developers tend to have with recommendations on how to fix them.

{% link https://dev.to/lewismenelaws/bad-habits-developers-should-fix-53n9 %}

#2. Back to the basics

A thorough guide to React without the unnecessary complexity (that you sometimes see in other guides) to grasp the basics.

{% link https://dev.to/aspittel/a-complete-beginners-guide-to-react-2cl6 %}

#3. What exactly is the problem?

Botond walks us through a scenario where it makes sense to use the null object pattern.

{% link https://dev.to/balazsbotond/dealing-with-nothing-in-c---the-null-object-pattern-2e9c %}

#4. _The Worst_

Four things we don't need to complain about anymore 😂

{% link https://dev.to/remotesynth/4-things-developers-take-for-granted-that-used-to-be-really-hard-2fd3 %} 

#5. Flirting with change!

George asks the community for their advice and experiences on moving away from js.

{% link https://dev.to/katsanos_george/breaking-up-with-javascript-3gik %}

#6. You've got options

Helens shares ten ways to make life easier when it comes to SSMS. 

{% link https://dev.to/helenanders26/10-ways-to-make-the-most-of-ssms-1b0h %}

#7. Practice makes better

Four takeaways from "Clean Code" -- with good vs bad examples!

{% link https://dev.to/effingkay/4-practices-for-better-code-4nf3 %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
Holy Quran app made via NativeScript.
Tags: nativescript, javascript, showdev, islam
Published: 2018-09-03 12:17:14

---
title: Holy Quran app made via NativeScript.
published: true
description: Holy Quran app made via NativeScript.
tags: nativescript,javascript,showdev,islam
cover_image: https://raw.githubusercontent.com/sarfraznawaz2005/nativescript-holyquran/master/screen3.png
---

Holy Quran app made via NativeScript.

{% github https://github.com/sarfraznawaz2005/nativescript-holyquran %}
Where do you learn?
Tags: discuss
Published: 2018-02-23 05:54:06

---
title: Where do you learn?
published: true
tags: discuss
---

In no particular order, here's the list of my favorite places to study new things.

1. <a href='https://www.devu.com'>DevU</a> - used to be LearnVisualStudio.net - courses that covered everything .Net, VisualStudio, C#, Microsoft Tools. I got a lifetime membership. One of the best purchases I made in my junior years.

2. <a href='http://bit.ly/2FpkGvB'>Pluralsight</a> - Love it! Excellent IT, DevOps, Management, and other topics! 

3. <a href='https://www.edx.org/'>EDX</a> - Free Online University. I love their Micro Masters and Certifications. 


There're others, of course, but the above three are my favorite ones.

<a href='http://highscalability.com/'>Highscalability.com</a> is not a site where you find courses, but I love it for its "Stuff that Internet says on Scalability..." that are posted every Friday. If you're into high traffic, big data, fast and edge technologies, I strongly recommend this site. Even if you aren't it's still going to be useful to you :)

What are your favorites sites to learn and sharpen your skills?
Integration Tests In ASP.NET Core Controllers
Tags: csharp, dotnet, unittest, dotnetcore
Published: 2018-09-03 13:58:21

---
title: Integration Tests In ASP.NET Core Controllers
published: true
tags: csharp,dotnet,unittest,dotnetcore
canonical_url: https://www.matheus.ro/2018/09/03/integration-tests-in-asp-net-core-controllers/
---

 ![](https://www.matheus.ro/wp-content/uploads/2018/09/Integration-Tests-In-ASP.NET-Core-Controllers-768x384.png)

Continuing the series of posts to explore different testing aspects in asp .net core. We’re going experiment with Test Server to create integration tests.

Test Server is a new features that asp .net core is bringing. It creates a browser abstraction, allowing us to simulate application’s behavior without opening a browser.

There are many ways to deal with the database in integration tests. The idea is to not affect the data that’s already in the database. We could use an entirely different database, creating and deleting it every time we run our tests.

Other approach is to use the same database as the application, but clean up data after each test. For example, if we add a register into the database and in the end of the test we remove it.

We can follow a transactional approach. Which means that we create a transaction scope within each unit test to not commit changes when we call `.SaveChanges()`. Then, when the test is over, this transaction is disposed and no changes are committed to the database.

Entity Framework Core In-Memory database could also be used. Following this approach we won’t have to worry about storing data. But, how can we call this an integration test if we aren’t using a real database? Yeah, that’s right, this approach will fall into the unit test category.

For this post, we’re going to use the transactional approach.

[Continue Reading...](https://www.matheus.ro/2018/09/03/integration-tests-in-asp-net-core-controllers/)
How-to manage different project release versions in Git?
Tags: help
Published: 2018-09-03 10:23:57

---
title: How-to manage different project release versions in Git?
published: true
tags: help
---

I'm relatively new to using Git and I was hoping someone might be able to help me out with a scenario I have found myself in?

I have a requirement to create multiple versions of an app, each with a different feature set activated depending on the client's requirements; but also continue to develop a core feature set available to all versions.

Initially I was going to put each version in it's own repository, but, from what I can tell, that would mean a lot more administrative overhead when releasing updates that are relevant to all versions, and isn't taking advantage of Gits features.

I'm guessing the correct way to go with this is to use branches and merge the core updates in to each client specific branch but, I've only ever used Git to manage a single solution with a master, dev and sometimes a release branch, so I have no idea if this is the right or wrong way to go, how I would structure the repository etc.

Any advice would be greatly appreciated.
Essential Oils for Carpal Tunnel Pain Relief
Tags: oils, carpaltunnel, carpal, homeremedy
Published: 2018-09-03 10:03:44

---
title: Essential Oils for Carpal Tunnel Pain Relief
published: true    
description: Carpal Tunnel Syndrome (CTS) is a condition that occurs when the median nerve of the hand becomes compressed. A median nerve runs from the forearm into the palm. It further results in numbness, pain in the hand, wrist, and fingers.
tags: #oils #carpaltunnel #carpal #homeremedy

---
Carpal Tunnel Syndrome (CTS) is a condition that occurs when the median nerve of the hand becomes compressed. A median nerve runs from the forearm into the palm. It further results in numbness, pain in the hand, wrist, and fingers....

Read full article at https://health-booster.com/health/essential-oils-for-carpal-tunnel-pain-relief/
async actions in redux
Tags: react, redux, javascript
Published: 2018-09-03 09:27:13

---
title: async actions in redux
published: true
description: async actions in redux
tags: react, redux, javascript 
---

The most common question I hear post intro to redux is: "How do I fetch some data in actions?"

Most of them would hit the roadblock with: `Actions must be plain objects. Use custom middleware for async actions.` that is because Actions are meant to be plain JavaScript objects and must have a `type` property that indicates the type of action being performed.


Let us see a quick example to make an API request say this [xkcd](http://xkcd-imgs.herokuapp.com/) comic API.

As there is no community consensus for handling async actions and there are [many](https://www.npmjs.com/package/redux-thunk) [libs](https://www.npmjs.com/package/redux-promise) [out](https://www.npmjs.com/package/redux-saga) there that will make things easier in handling async actions, but in this example below we shall take the vanilla approach.

Let us start with an initial state that looks like:

```js
const initialState = {
  loading: false,
  error: false,
  comic: null
}
```

a `reducer` which handle `fetching`, `fetched` and `failed` states of the action.

```js
const reducer = (state = initialState, action) => {
  switch (action.type) {
    case 'FETCHING_COMIC':
      return {
        ...state,
        comic: action.comic
      }
    case 'FETCH_COMIC_SUCCESS':
      return {
        ...state,
        comic: action.comic
      }
    case 'FETCH_COMIC_FAILED':
      return {
        ...state,
        error: action.error
      }
  }
}
```

a `store` and `dispatch` based on the flow:

```js

const store = Redux.createStore(reducer);

store.dispatch({
  type: 'FETCHING_COMIC'
})

fetch('https://xkcd-imgs.herokuapp.com/')
  .then(response => response.json())
  .then(comic => {
    store.dispatch({
      type: 'FETCH_COMIC_SUCCESS',
      comic
    })
  })
  .catch(error => store.dispatch({
    type: 'FETCH_COMIC_FAILED',
    error
  }))
```

Some mandatory `render` method (not react this time ;))

```js
const render = function(state) {
    let xkcd = document.querySelector('#xkcd');
    xkcd.src = state.comic.url;
    xkcd.alt = state.comic.title;
  }
```

__Working code:__

{% replit @hemanth1/async-actions-redux %}


__Some interesting discussions:__

{% twitter 964070760443604993 %}

P.S: Thanks to `<GreenJello>` on the quick review.

P.P.S: This is a repost from [h3manth.com](http://h3manth.com/new/blog/2018/redux-async-actions/)
Why use Terraform instead of other alternatives.
Tags: terraform, devops, ci, cd
Published: 2018-09-03 06:15:21

---
title: Why use Terraform instead of other alternatives.
published: true
description: Terraform being the best DevOps tool in the industry today has many advantages that the alternatives. 
tags: terraform, devops, ci, cd
---

Why use Terraform instead of other alternatives. Why?

Because of the following benefits:

* Templating is powerful
* Orchestration, not merely configuration
* It supports many cloud providers and not only AWS
* Immutable infrastructure
* Easier to create reusable modules
* Declarative, not procedural code
* Client-only architecture
* It is agentless

If you're unfamiliar with Terraform, it would be good to start with learning how to provision infrastructure manually. 

Refer to a [step-by-step tutorial](http://blog.shippable.com/provision-aws-vpc-terraform)

Let me know what else you like about Terraform and how do you use it?
Do Developers Need Project Management Skill?
Tags: discuss, help, career
Published: 2018-09-03 05:11:37

---
title: Do Developers Need Project Management Skill?
published: true
description: 
tags: #discuss #help #career
---

# Project Management
Project Management is the practice of initiating, planning, executing, controlling and closing the work of a team.


# Technical Skill
Technical Skill is the abilities and knowledge needed to perform specific tasks. 


# Questions

* Do developers need project management skill?
* How do you study project management?
* Why do some Project Managers think the coding is easy after they get promised to Project Manager?
lit-html 0.11.0 update
Tags: javascript, html, example, howto
Published: 2018-09-03 03:47:40

---
title: lit-html 0.11.0 update
published: true
description: We look at the last release of lit-html and what have been added to the latest API.
tags: javascript, html, example, howto
---

{% youtube 715UbPR4SCc %}
How I built an Advanced Gatsbyjs site
Tags: gatsby, react, javascript, webdev
Published: 2018-09-03 03:32:17

---
title: How I built an Advanced Gatsbyjs site
published: true
description: Build your own Advanced gatsbyjs site 
tags: gatsbyjs,react,javascript,webdev
---

In last month i build a test site using Gatsby where i loved the site loading speed and its plugin ecosystem.

After that, i build an advanced site using Gatsby still works the same 100% loading speed. 

[![jshype](https://thepracticaldev.s3.amazonaws.com/i/urgo11i4w1zniijxfdgp.png)](https://jshype.com)


Advanced means i concentrated on everything while building a site.

Final outcome when i test it on google chrome audits.

![](https://thepracticaldev.s3.amazonaws.com/i/14vauk9vk7ore7bw7gq8.png)

Everything is 100%  even i checked on applied CPU 4x throttling it's still 90% performance.


### Why i built this site?

- I have a problem in reading long blog posts or tutorials where i often confused to read it from top to bottom.

### Let's talk about SEO now.

- Even i added an SEO to my site with Structured data where i used json/LD for the rich snippets.

![jshype json/ld](https://thepracticaldev.s3.amazonaws.com/i/ve8isgd4c6amnw598rbl.png)


### What i have learned by building this site?

At starting i really don't have any idea where to start but by building this i have learned many things.

first, i have used code sandbox where i faced a problem even my code is correct but it's doesn't work so i checked it on my local machine it works fine i figured it out after 1 day of debugging it literally made me laugh.

so sometimes you need to check your code on the local machine.

I have learned some things about accessibility which are color blindness people are not able to see properly of red and green colors and they both look as a brown color to them,  less contrast, small text, keyboard interaction like is your site navigation works perfectly without the mouse by using tab keys.

They are lot of people in the world having some type of disabilities.
If you're interested in accessibility read the stories about  [how disability people using the web](https://www.w3.org/WAI/people-use-web/user-stories/)


My code is open sourced.
#### [My site url](https://reactgo.com)
### [Code repository](https://github.com/saigowthamr/jshype.com)

If you love my work give me a 🌟 star on [GitHub](https://github.com/saigowthamr/jshype.com)



### Resources

1. Chrome dev tools.
2. [ Web accessibility tutorials](https://www.w3.org/WAI/tutorials/)
2. [Seo starter guide by Google](https://support.google.com/webmasters/answer/7451184?hl=en)
3. [Create a high-quality page](https://developers.google.com/search/docs/guides/quality-pages)
4. [Think with the Google](https://www.thinkwithgoogle.com/)
Fixed Price Project
Tags: discuss, help
Published: 2018-09-03 02:30:25

---
title: Fixed Price Project
published: true
description: 
tags: #discuss #help
---

# Background

Do you try to find a project yourself? Do you try to do a project yourself?

Cost is extreme important factor for you. 

Do you face any problem for Fixed Price Project?

How would you deal with this situation?

# Problem 

For me, the biggest problem would be user often change requirement and give the requirement even after deadline. 

# Solution

Collect and document requirement list. Besides the list, it would cost for change.
Why Javascript of all languages? 
Tags: javascript, development, opensource, discuss
Published: 2018-09-03 02:07:30

---
title: Why Javascript of all languages? 
published: true
description: After being just a language to give dynamism to front-end, why javascript has become so popular on the back-end and applications in general as well?
tags: javascript, development, opensource, discuss
---

Javascript has been the standard language in front-end development to make websites dynamic since ever and now with NodeJs it has been gaining popularity also in back-end development, principally in the open source community. Many projects are come across are made in Javascript nowadays, be it a website written in Angular, React, Vue and other frameworks, applications that uses the power of Electron like the very famous Visual Studio Code and mobile applications that leverage Javascript capacity to be cross-platform. It appears to me that the community is trying to make Javascript an universal language in the development world. 

Only in the previous paragraph I already listed at least one reason that Javascript may have become popular among developments: the capacity to be cross-platform between web and mobile. But even when cross-platform is not the goal Javascript it taking space, web servers and APIs using Express, CLIs and other use cases. Other reason I've seen a lot is performance against languages such as Java and C#.  

I've been working with web development using Java for almost a year now so I can say with more knowledge that projects can become very complex in some weeks after the start of the development. At least in Java you have many classes, many controllers, many services and a pile of other classes to take care of database communication. With object oriented programming it becomes easy to organize all the business logic in a meaningful way even for someone who is not a programmer, just by taking a look at the name of the classes you can have a idea of the project goals, that's why many project design tools such as UML uses object oriented concepts to connect all the business logic and its entities. 

Javascript has been improving, I've seen news that even classes are possible to use in the recent versions, but it is still not something people are using in a daily basis as far as I know. With all this complexity, the tendency of projects to lead to chaos, why Javascript has been gaining so much popularity of all languages? To be frank, Javascript looks crude to me as language, it doesn't give the safety of statically typed languages, Typescript was created because this gap is real. Why build around unsteady basis like this?  

Please, don't see this post as rant towards Javascript. I've been learning NodeJS recently and also TypeScript and it is a honest doubt I have since taking all pros and cons the popularity of Javascript in all sectors of development right now the result doesn't add up for me. What do you, principally more experienced NodeJS developers, think about this?