teleren/devto huggingface dataset:
Embedding Types in Go Reduces Noise
Tags: php2go, go, polymorphism, composition
Published: 2020-04-30 11:08:05

My [previous](https://www.tegh.net/8) post was about one of the concurrency patterns that can be achieved with go.
I immediately got some feedback on it, and this is where I will address one of them.

You have seen the code reimplementing `sync.WaitGroup` to have a semaphore in it.
```go
type WaitGroup interface {
	Add(delta int)
	Done()
	Wait()
}

type SemaphoredWaitGroup struct {
	sem chan bool
	wg  sync.WaitGroup
}

func (s *SemaphoredWaitGroup) Add(delta int) {
	s.wg.Add(delta)
	s.sem <- true
}

func (s *SemaphoredWaitGroup) Done() {
	<-s.sem
	s.wg.Done()
}

func (s *SemaphoredWaitGroup) Wait() {
	s.wg.Wait()
}
```
It has been brought to my attention (Thanks, Wojtek!), that there is a "cleaner" way to do it in Go.

# Enter: Type Embedding

Those coming from other languages (e.g.: PHP), you might notice that there is no such thing as an `extends` keyword. 
There is no subclassing in the popular way. What we do have is [type embedding](https://golang.org/doc/effective_go.html#embedding).

To achieve that we change `SemaphoredWaitGroup`:
```diff
type SemaphoredWaitGroup struct {
	sem chan bool
-	wg  sync.WaitGroup
+	sync.WaitGroup
}
```

All methods from the "inner" (embedded) struct are now a part of the "outer" (embedding) type.
It is even possible to access them directly by calling them as if they were actually defined locally. E.g:
```go
func (s *SemaphoredWaitGroup) newMethod() {
	s.Wait()
}
```

There is a catch though. when we re-define the methods from the inner part (here we have: `Add(delta int)` and `Done()`), we need to change the internal calls 
```diff
func (s *SemaphoredWaitGroup) Add(delta int) {
-	s.Add(delta)
+	s.WaitGroup.Add(delta)
	s.sem <- true
}

func (s *SemaphoredWaitGroup) Done() {
	<-s.sem
-	s.Done()
+	s.WaitGroup.Done()
}
```
because the `s.Add(delta)` and `s.Done()` would be recursive calls, and would result in a "[stack overflow](https://en.wikipedia.org/wiki/Stack_overflow)" error in this particular instance.

Also, we don't need to have the `Wait()` method pass calls through to the underlying `sync.WaitGroup` struct.

> A complete example is available on [Go Playground](https://play.golang.org/p/dXpLrguS4Ns).

This was originally posted at: https://www.tegh.net/9
Spotlight Story: William Grzybowski, Lead Maintainer of FreeNAS
Tags: python, opensource
Published: 2020-04-30 11:01:51

*Spotlight is a story series dedicated to creators and builders of open source software.*

***Where did you grow up?***
I grew up in Curitiba, Brazil. I have a degree in Bachelor Science from the Federal University of Parana (UFPR).

***Are you currently working or have worked for a company in the past?***
I work for iXsystems, the company behind FreeNAS and TrueNAS. I have been involved since the company took over the FreeNAS project, rewriting it using more modern technologies. That said, I have worked with the first rewrite of the WebUI, improvements to the back-end and API.

![William Grzybowski FreeNAS](https://i.imgur.com/uMEfBER.png)

***What is FreeNAS?***
FreeNAS is an operating system that can be installed on virtually any hardware platform to share data over a network. It is the simplest way to create a centralized and easily accessible place for your data. You can use FreeNAS with ZFS to protect, store, and back up all of your data.

You can visit the website at [freenas.org](https://www.freenas.org/), and look at the source code at [github.com/freenas/freenas](https://github.com/freenas/freenas).

![FreeNAS Project Stats](https://i.imgur.com/ftP9mob.png)

***What's the primary problem that the project solves?***
FreeNAS makes it easy to build a personal file server for your home, to backup and share movies and photos with your family and friends. FreeNAS works well for home users, small office / home office and large companies. It can be used as a simple way to share some files within a network, backup/restore to/from the cloud.

***How can someone use FreeNAS?***
FreeNAS can be downloaded at [freenas.org/download](https://www.freenas.org/download/). The docs are [here](https://www.ixsystems.com/documentation/freenas/).

***How big is the core maintainer team?***
We have about 12 developers working on the product, as well as a handful more people working on documentation and QA.

***What inspired you to join this project?***
The project combines two things that I love, FreeBSD and Python. That made it a no-brainer for me.

***What's coming up in the next release?***
The next release will feature:

 - Improvements to the user interface
 - Native ZFS encryption
 - KMIP support
 - OpenVPN support

***What is your vision for the future of this project?***
Our vision is to make FreeNAS as easy to use as possible, making it a seamless experience and at the same time allowing it to be a swiss-army knife if needed. Data is priceless and we want to help protect it.

***If someone wants to support the project, where can they donate?***
iXsystems does not accept direct donations, instead we urge people to donate to the FreeBSD project instead, the operating system used by FreeNAS. You can do that [here](https://www.freebsdfoundation.org/donate/).

Link to the original [article](https://deepsource.io/spotlight/william-grzybowski/).
AI April NLP Math Teacher Challenge
Tags: machinelearning, ai, azure, nlp
Published: 2020-04-30 20:25:04

---
title: AI April NLP Math Teacher Challenge
published: true
date: 2020-04-30 10:52:38 UTC
tags: machinelearning, ai, azure, nlp
canonical_url: https://medium.com/microsoftazure/ai-april-nlp-math-teacher-challenge-ebddb43f2a39
---

![](https://cdn-images-1.medium.com/max/1024/0*fnqhtHoHfKi4tREk)

TLDR; Build a model that can perform automatic problem solving, written in natural language on the provided dataset.

### Challenge

Build a model that can perform automatic problem solving, written in natural language on the provided dataset.

![](https://cdn-images-1.medium.com/max/1024/1*4v1oNJ_xHRbJT5A1Yi7IoA.png)<figcaption>Example Challenge Problem</figcaption>

### Questions

I will be monitoring the github issues of the challenge repo and on [twitter](https://twitter.com/pythiccoder) feel free to reach out with any questions.

### Download Dataset

The math teacher dataset can be downloaded [here](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02//dolphin-number_word_std.zip) For more information on the subsets see [here](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02//dolphin-sigmadolphin.datasets.pdf).

### Submission

Submit a submission by creating a pull request to the submissions folder in the Repo below!

[aribornstein/AIApril2020NLPMAthTeacherChallenge](https://github.com/aribornstein/AIApril2020NLPMAthTeacherChallenge)

If you are new to Azure you can get started a free subscription using the link below.

[Create your Azure free account today | Microsoft Azure](https://azure.microsoft.com/en-us/free/?WT.mc.id=aiapril-medium-abornst)

### Useful Resources

- [Spacy](https://spacy.io/)
- [Allen NLP](https://allennlp.org/)
- [PyNeurboParser](https://github.com/aribornstein/pyNeurboParser)
- [Azure Text Analytics](https://azure.microsoft.com/en-us/services/cognitive-services/text-analytics/?WT.mc_id=aiapril-medium-abornst)
- [Hugging Face Transformers](https://github.com/huggingface/transformers)
- [Word Vectors and NLP Modeling from BoW to BERT](https://towardsdatascience.com/beyond-word-embeddings-part-2-word-vectors-nlp-modeling-from-bow-to-bert-4ebd4711d0ec)
- [9 Advanced Tips for Production Machine Learning](https://dev.to/azure/9-advanced-tips-for-production-machine-learning-4ccg)
- [Dolphin 18k Data](https://www.microsoft.com/en-us/research/wp-content/uploads/2015/08/dolphin18k-v1.1.zip)
- [Neural Arithmetic Logic Units](https://github.com/kevinzakka/NALU-pytorch)
- [SymPy](https://www.sympy.org/en/index.html)
- [Project Euclid](https://allenai.org/euclid/)

### About the Author

[**Aaron (Ari) Bornstein**](https://www.linkedin.com/in/aaron-ari-bornstein-22aa7a77/) is an AI researcher with a passion for history, engaging with new technologies and computational medicine. As an Open Source Engineer at Microsoft’s Cloud Developer Advocacy team, he collaborates with Israeli Hi-Tech Community, to solve real world problems with game changing technologies that are then documented, open sourced, and shared with the rest of the world.

* * *
Get Best Driver Fixer App For Free
Tags: driverfixerpro
Published: 2020-04-30 10:12:10

With Driver Fixer Pro app, you no longer have to waste time fooling around with Device Manager. Driver Fixer Pro makes it easy to update your drivers in our user-friendly interface. You’ll notice improved computer performance right away. To download driver fixer pro app, you can get it at <a href="https://driverfixerpro.com/">driverfixerpro.com</a> site.
A nice intro to Svelte Data Fetching
Tags: webdev, discuss, javascript
Published: 2020-04-30 10:12:08

Looking at Svelte it really looks promising and I can see why many people will learn it and use it in the future. 

I just see a lot of issues that are quirky to deal with in React, like data fetching in components, are solved more elegantly in Svelte 😎.

If you want to learn about all the things you need to handle when doing data fetching in React take a look at: 
> [Correctly handling async/await in React components](https://dev.to/alexandrudanpop/correctly-handling-async-await-in-react-components-4h74)
> [Correctly handling async/await in React components - Part 2](https://dev.to/alexandrudanpop/correctly-handling-async-await-in-react-components-part-2-4fl7)

## Data fetching
Now comparing the React way of doing it to Svelte - I think the Svelte approach is much nicer: 
{% youtube _K7LRy6IP_4%}

## Why you should learn Svelte
You should learn Svelte not because it's the new cool kid around the block, but because it adds new paradigm shifts to frontend development, that can certainly help you:
1. Less boilerplate code due to handling state and reactivity in an easy way :star:
2. Global state management built in :star:
3. No Virtual DOM means faster renders due to avoiding not needed CPU cycles :star: 
4. Heavy lifting done at compile step means smaller bundles and faster code :star:
5. Built in auto-scoped CSS in JS and animations :star:

So it has 5 stars from me, what do you think?

If you like this article, chances are you will also enjoy what I post on [Twitter](https://twitter.com/alexandrudanpop). :fire:
Highly Scalable Codebase Architecture
Tags: javascript, node, opensource, graphql
Published: 2020-04-30 09:58:50

---
title: Highly Scalable Codebase Architecture
published: true
description: How writing clean & modular code help you scale your codebase
tags: javascript, node, open-source, graphql
---

Hello Folks! 

Back in time, I was preparing for a live-code session where I demonstrated adding a layer of **GraphQL to an existing REST API**. The session went well, and after that, I noticed my way of writing code and organizing files have really helped me adding the GraphQL layer very smoothly, the codebase architecture really made it feel like a hot knife on butter.

*__You can find the code repo here (do star it! :P) [rest-and-graphql](https://github.com/knaxus/rest-and-graphql)__*

Let's explore the codebase.

![codebase](https://dev-to-uploads.s3.amazonaws.com/i/bcabdrrd8fg3qem78cf4.png)

The source files are inside the `/src` folder. Let's define the roles of the folders inside `/src`

- `config`: contains the `.env` files
- `controllers`: contains the route handlers using methods inside `routes`
- `db`: contains the database connection logic
- `graphql`: contains the resolvers and definitions 
- `routes`: contains the definition of the routes using `services`
- `services`: contains the logic to fetch data from DB
- `utils`: contains the globally used util functions

As you can see, the codebase is organized as per the entities. What really helped me to scale here is the `services` folder, it is the real gem here 

__I wrote the services only once__ for the __REST APIs__ and due to the patterns I followed made the construction of the __GraphQL__ layer very easy. **I only had to call the service inside the resolvers instead of writing it again and again for different layers**. 

*__One added benefit of this kind of codebase is that you can easily split it into independent microservices just by taking out the entities from routes, services, controllers folder__*

Feel free to explore the repo on Github: [rest-and-graphql](https://github.com/knaxus/rest-and-graphql), you can also browse my other projects. And with time I will try to extend this article in detail.

Let me know your thoughts! 

Find me on [LinkedIn](https://linkedin.com/ashokdey) and [Twitter](https://twitter.com/ashokdey_)
How to execute effective daily standups using Slack?
Tags: productivity
Published: 2020-04-30 09:20:44

---
title: How to execute effective daily standups using Slack?
published: true
description: Explaining expectations for daily standups in a written form.
tags: productivity
---

The goal of the daily standup is for the team to synchronise about what has been recently completed and plan for the next 24 hours. It is not a status report to your boss. Rather, it is a meeting in which you as a team make commitments to each other – If today you say you will complete something, everyone knows that tomorrow that will be ready for them to use. Therefore, take time to read through everyone's standup notes and comment if you have questions.

More specific to each question:

## What did you do yesterday?

The goal of this question is to show the entire team what you've achieved yesterday. If someone in the team did a great job – give them a compliment (:+1:).

This question is for mentioning things that you've *completed*. If you've completed the entire ticket – include link to the ticket. If you've completed a subset of the task described in the ticket – described what you've achieved (and link to the associated ticket).

Do not just list ticket IDs – they are meaningless to the reader.

## What will you do today?

The goal of this question is to signal to the rest of the team what tasks you are planning to *complete* today.

As with the previous question, if you are planning to complete the entire ticket – link to the ticket. If you are planning to complete a subset of the ticket, then describe what you are planning to complete and which ticket it relates to.

This question enables the team to know what you've committed to complete today and allows them to start (mentally) plan work for the next day.

## Anything blocking your progress?

You must answer this question if you've not completed what you've committed the day before.

List the impediments that prevented you from completing the task(s) that you've committed to. This could be unplanned meetings or unforeseen technical challenges. Whatever blocks you mention their resolution will be prioritised.
Art in Code
Tags: generative, art
Published: 2020-04-30 09:52:11

What can be done in 22 lines of code ?.

The image below has been created with [RapydScript](https://github.com/atsepkov/RapydScript)

RapydScript allow writing Javascript in Python syntax

![Spiral](https://pictshare.net/5zbmxu.png)
My Journey with Blazor Server
Tags: dotnet, webdev
Published: 2020-04-30 09:41:54

In my study of C# alongside Javascript, and working on my projects (asp.net core and WPF), I came across this technology called Blazor.

This attempts to make C# valid across back-end and front-end, possibly avoiding the use of Javascript on the front-end. Blazor, as a part of Asp.Net Core 3.0 and 3.1, has two flavors, Blazor Webassembly and Blazor Server-Side.

My preoccupation is the latter, as it is production ready. The result is, some asp.net applications that are very fast and responsive, and there are lots of free and beautiful components that can add nice design to the web apps.
![Blazor Server Image](https://dev-to-uploads.s3.amazonaws.com/i/phjjquk67kvl4s4gem0b.png)

The tutorials I checked and can recommend, are the following:
Tim Corey's material about Blazor Server:
- introduction : https://youtu.be/8DNgdphLvag
- components: https://youtu.be/JE0tQ4tx0Nc
- free resources: https://youtu.be/i1Kric5tqYk
- tutorial series on youtube from Nick Chapsas: https://www.youtube.com/watch?v=HFvPKmS2gig&list=PLUOequmGnXxPrY79JGnF72e1Pba8z93zo

**Checking the free resources I want to highlight now two of them:**
- Material Design Components: https://www.matblazor.com/
My small sample app is here, live: https://mat-blazor1.zoltanhalasz.net/

- Radzen Blazor Components: https://blazor.radzen.com/
 My small sample app is here, live:  https://radzen-components-server1.zoltanhalasz.net/menu

*And I found another beautiful tutorial, which I did not yet check in detail:*

https://www.syncfusion.com/ebooks/blazor-succinctly

Overall, I find Blazor Server-Side a very interesting idea, worth exploring further.
What's the dark mode priority should be?
Tags: help
Published: 2020-04-30 08:37:08

From the UX perspective, what's the dark mode priority should be on a site,
localStorage or user default computer theme?

E.g. If a user has a dark theme by default (on a computer), and then the user enabled the light theme (switch on a site), then the next time the user enters a site what value should be applied (default or saved from the localStorage)?

Or have I misunderstood this whole dark mode and doing something wrong?
JSX: In A Nutshell
Tags: javascript, react, beginners, codenewbie
Published: 2020-04-30 08:20:04

JSX is a syntax extension to JavaScript. JSX may remind you of a template language, but it comes with the full power of JavaScript.

We can put the JavaScript syntax between the React component or HTML tag within the curly brackets. React doesn’t require using JSX, but most people find it helpful as a visual aid when working with UI inside the JavaScript code. It also allows React to show more useful error and warning messages.

### **For example**
Put variable to HTML tag within the curly brackets. 

```javascript
function greeting (props) {
  const text = 'JSX is cool'

  return (
    <h3> {text} </h3> // will show JSX is cool
  );
}
```

### **Embedding expressions in JSX**
You can put any valid JavaScript expression inside the curly braces in JSX.

```javascript
function greeting (props) {
  const formatName = (user) => {
    return user.firstName + '' + user.lastName;
  }

  const user = {
    firstName: 'John',
    lastName: 'Doe'
  };

  return (
    <h3>Hello, { formatName(user) }! </h3> // will show Hello, John Doe
  );
}
```

### **JSX is an expression too**
After compilation, JSX expressions become regular JavaScript function calls and evaluate to JavaScript objects. You can use JSX inside of if statements and for loops.

```javascript
function getGreeting(user) {
  if (user) {
    return <h3>Hello, {formatName(user)}!</h3>;
  }
  return <h3>Hello, World!</h3>;
}
```
### Specifying attributes with JSX

You may use quotes to specify string literals as attributes or use curly braces to embed a JavaScript expression in an attribute.

```javascript
const element = <div tabIndex="0"></div>;

const element = <img src={user.avatarUrl}></img>
```

### **Specifying children with JSX**

If a tag is empty, you may close it immediately with />, just like XML.

```javascript
const element = <img src={user.avatarUrl}/>;
```
JSX tags may contain children

```javascript
const element = {
  <div>
    <h2>Hey,</h2>
    <h5>JSX is super cool.</h5>
  </div>
};
```

### **JSX represents Objects**

Babel compiles JSX down to React.createElement() calls

```javascript
const element (
  <h3 className="greeting">
    Hello, World!
  </h3>
);

const element = Create.reactElement(
  'h3'
  {className: 'greeting'},
  'Hello, World!'
);
```
Two examples above are identical ones. 

### **React.createElement**

React.createElement()performs a few checks to help you write bug-free code but essentially it creates an object called React Elements. You can think of them as descriptions of what you want to see on the screen.

**That's all for now folks. Happy coding day!**
Integrating Elasticsearch 7 into Django project
Tags: django, python, elasticsearch, webdev
Published: 2020-04-30 07:50:50

Recently, I had to migrate a Django project from elasticsearch 2.x.x using haystack to latest at that time Elasticsearch 7. It is a Django project maintained by the ns3 team. I wrote a medium article for same [link](https://medium.com/analytics-vidhya/integrating-elasticsearch-7-to-django-project-c3812de78246). I hope this is useful for someone working with the same. Comments and suggestions are appreciated.
Securely embed YouTube and other iframe elements in Markdown
Tags: markdown, webdev, javascript
Published: 2020-04-30 07:48:13

You can use any markdown implementation, including MarkdownIt, but first you have to make it insecure first, by allowing HTML.

```js
const markdownIt = MarkdownIt({
  html: true
})
```

Then, use [DOMPurify](https://github.com/cure53/DOMPurify), but allow `<iframe>` tag, [including related attributes](https://stackoverflow.com/questions/60299226/how-to-allow-an-iframe-tag-in-dompurify-including-all-of-its-attributes).

Then, sanitize insecure iframes later.

```js
DOMPurify.addHook('uponSanitizeElement', (node, data) => {
  if (data.tagName === 'iframe') {
    const src = node.getAttribute('src') || ''
    if (!src.startsWith('https://www.youtube.com/embed/')) {
      return node.parentNode?.removeChild(node)
    }
  }
})
```

## Other useful tags

As for `<style>` tag, I think it can be enabled, but always wrap it in [scopeCSS](https://www.npmjs.com/package/scope-css) or something similar.

As for `<script>` tag, I recommend you not to use it at all, but if you must, you need post-processing after attaching to DOM to run it.

```js
el.querySelectorAll('script').forEach((el0) => {
  el0.replaceWith(el0.cloneNode(true))
})
```
Build a TV Shows App - React Hooks Project Tutorial with CSS Grid and Flexbox [video format]
Tags: react, tutorial, css, javascript
Published: 2020-04-30 07:46:45

In this tutorial, we will create a TV shows App that will fetch some interesting information and facts about all your favourite actors by selecting the cast of a TV show season of your choice. 
We'll be using many modern web technologies and super important concepts such as React hooks, CSS Grid, Flexbox, Transition and Transform. 

The project is going to fetch the remote data from the fantastic TV Maze API using Async/Await syntax. You'll also learn how to use the fundamentals like components, state, props, JSX, events, etc. by building a real world project from Scratch. 🔥

By the end of this tutorial, you will have a strong understanding of React's workflow; including data fetching, hooks, folder structure, and more. We will start by initializing the application using create-react-app as our base, and then start building out the application using React (Custom Hooks), CSS Grid and Flexbox.

Upon completion of this video, you'll be able to add this cool project to your portfolio showcasing your practical skills to potential companies/clients or even build your own projects by using this as a base project.
📚 API Reference:
http://www.tvmaze.com/api

[**SUBSCRIBE**](https://www.youtube.com/channel/UCBF2LIwr2Odb3-pRnNBRegA?sub_confirmation=1) our [**Youtube channel**](https://www.youtube.com/channel/UCBF2LIwr2Odb3-pRnNBRegA) if you want to get notified for more real-world **project-based tutorials**

Share this [video](https://youtu.be/82PZQ6NdCSk) with a friend

Let’s connect:
[Twitter](https://www.twitter.com/codeleague7) 
[Instagram](https://www.instagram.com/codeleague7)
[Github](https://www.github.com/codeleague7)