teleren/devto huggingface dataset:
Vue Component Communication Part 1 - Parents and Children [VueJS]
Tags: vue, javascript, beginners, tutorial
Published: 2018-02-06 01:39:27

---
title: Vue Component Communication Part 1 - Parents and Children [VueJS]
published: true
description: Learn how parent and child components communicate using props, events and the sync modifier.
tags: vue, javascript, beginner, tutorial
cover_image: https://thepracticaldev.s3.amazonaws.com/i/gjshjmgz3kwu9cqe24s5.png
---

> Subscribe to my YouTube channel for [more tutorials on working with VueJS and AdonisJS -- an MVC framework for NodeJS](https://www.youtube.com/channel/UCF5w1QdWroWOoxxXMgp88AQ?sub_confirmation=1)!

When you are first starting out with VueJS, you will quickly get to a point where you need to communicate data between a parent component and its children.

In this tutorial, I cover the basics of how data can be sent between the two:

* How to pass data **down** from parent to child
* How to pass data **up** from child to parent
* How to use the **.sync** modifier

## Watch Video + Fork the Pen

{% youtube hPoT1kdzi2Y %}


{% codepen https://codepen.io/patrickodacre/pen/pagdbw %}


## Coming Soon

1. Communication between sibling components.
2. Sharing data between unrelated components -- those not on the same page at the same time.
Any recommendations for programming fundamental books for beginners?
Tags: discuss, beginners
Published: 2018-02-06 00:56:34

---
title: Any recommendations for programming fundamental books for beginners?
published: true
description: 
tags: discuss, beginners 
---

I'm reading currently reading _Code Complete_ by Steve McConnell, which I find a great resource, but there are many parts that still assume a good amount of knowledge in computer science and programming. Some of the code examples don't make a lot of sense to me either, because I'm still a beginner.

Does anyone have any recommendations for a similar book geared towards super beginners that would be a good complement?
Replace a `git` remote
Tags: git
Published: 2020-02-24 08:17:10

---
title: Replace a `git` remote
published: true
date: 2018-02-06 00:00:00 UTC
tags: git
canonical_url: http://blog.gnclmorais.com/replace-a-git-remote
---

I’ve found myself a few times waiting to move a whole project away from GitHub, but I keep forgetting about the process for such. Don’t get me wrong, there is nothing wrong with GitHub. But regarding projects I wish to keep private, when I think I could keep them on [Bitbucket](https://bitbucket.org) or [GitLab](https://about.gitlab.com) for free _and_ still keep their privacy, I start to wonder if I should just move them all to these platforms and keep on GitHub only what I wish to publicly release.
**Update:** GitHub has private repos now! I’m going to start using them as well. 🙌🏻

OK, so let’s assume you have a project on GiHub but you want to move it to, say, GitLab. The process to do so can be quite simple, mostly relying on changing the `origin` remote of that git repository.

First, make sure you create a new project on GitLab: ![Click ‘New project’](http://blog.gnclmorais.com/images/posts/gitlab_new_project.png)

Fill up all the information you need and click ‘Create project’: ![Click ‘Create project’](http://blog.gnclmorais.com/images/posts/gitlab_create_project.png)

Now that we have a new project, grab the `git` link of the project (just click and it will be copied): ![Click the clipboard button](http://blog.gnclmorais.com/images/posts/gitlab_copy_project.png)

Sweet, we got ourselves a remote link to point to. Now we go into out project’s folder (the one we had hosted on GitHub) and we replace the `origin` remote, basically telling git to push its changes into a different place in the cloud:

```bash
cd my_awesome_project

# Just check the current remotes you have
git remote -v
# origin git@github.com:gnclmorais/my_awesome_project.git (fetch)
# origin git@github.com:gnclmorais/my_awesome_project.git (push)

# Replace the current origin to GitLab's project
git remote set-url origin git@gitlab.com:gnclmorais/my_awesome_project.git

# Check the changes, notice how it doesn't say 'github' anymore
git remote -v
# origin git@gitlab.com:gnclmorais/my_awesome_project.git (fetch)
# origin git@gitlab.com:gnclmorais/my_awesome_project.git (push)

# Now just `git push` and your project will be on GitLab
git push

```
Code for all
Tags: codequality, abetterworldforall
Published: 2018-02-05 21:15:55

---
title: Code for all
published: true
description: Code must be written in a way that is easy to read
tags: codequality, aBetterWorldForAll
---

Code is for developers as languages are for countries, there are zones were even speaking the same language, you will hardly understand one thing or two.

``` javascript

const a = true;
const b = true;

const something = a && b;

if (something) {
    const text = "Its because is well coded (???)";
    console.log(text);
}

```

Putting just a bit of effort you can communicate so why not do the same with coding?

``` javascript

const isWellCoded = true;
const didYouTakeYourTime = true;

const youCanReadThis = isWellCoded && didYouTakeYourTime;

if (youCanReadThis) {
    const whyCanYouReadThis = "Its because is well coded";
    console.log(whyCanYouReadThis);
}

```

Once a teacher said to me, 
> Code must be written in a way that is easy to read. You should spend your effort in understanding what it does not in what is says.

If you are committed, after some practice you stop thinking on the quality because it comes out of your mind pre-formatted.
Concept: High Performance web server w/ Promises
Tags: node, softwareengineering, exploration
Published: 2018-02-27 21:56:58

---
title: "Concept: High Performance web server w/ Promises"
published: true
tags: nodejs,software engineering,Exploration
canonical_url: https://theopensourceu.org/concept-high-performance-web-server-w-promises/
---

## Purpose
 ![Concept: High Performance web server w/ Promises](https://theopensourceu.org/content/images/2018/02/webserver-promise.png)

My intended purpose is to provide a higher level of throughput -- service more requests per second through an _async API_. It is expected that the time to service each request would increase but that is fine if we handle more requests per second. _Or_ if nothing else, at least handle more requests before issues start to occur.

## Concept Overview - _How?_

The high-level idea is for an http server running on Express + Node. From there, any incoming request is wrapped in a promise and the promise resolves to respond to the request. Of course, if throughout processing the request, other async processing is needed, other `then`-ables can be used.

For example, this:

```
/* GET home page. */
router.get('/', function(req, res, next) {
    debug("GET /");
    res.render('site/index', { title: 'The Open Source U' });
});
```

Becomes:

```
/* GET home page. */
router.get('/', function(req, res, next) {
  new Promise(function() {
    debug("GET /");
    return { title: 'The Open Source U' }; //calculation or object
  })
  .then(function(payload) {
    res.render('site/index', payload)
  });
});
```

This is regardless of need. So, I intentionally have no async operation but still use a promise; this accurately represents my idea.

## Result: Ineffective

I quickly did a proof of concept... which showed that this doesn't help. In fact, it made performance worse. In considering _why_, I suspect the cost to service the promise (memory and processing) is more costly than simply responding to the http request.

This is not to say a promise should be avoided in the `http` request/response cycle but it should, instead, be used at async appropriate times. Regardless, we've learned something here and I thought it was worth sharing.

> Success is not final, failure is not fatal: it is the courage to continue that counts. _Winston Churchill_

I am disappointed this didn't have even a neutral effect on performance, let alone a negative one but it is what it is.

## Update (new article coming)

Because of a comment on [Dev.to (here)](https://dev.to/theopensourceu/concept-high-performance-web-server-w-promises-kb1), I've revisited this. The commenter pointed out a mistake I made in the code I posted. That code was an example and not 1:1 from the original test code (which I ran from a [Linode server](https://www.linode.com/?r=348bfde802d0569573c9d64dea875c1c39519950)). 

I've posted my test code here: https://github.com/TheOpenSourceU/tOSU-PromiseWebServer-Experiment 

I should have done this in the first place.
Write a script to find "Happy Numbers"
Tags: challenge
Published: 2018-02-05 20:43:17

---
title: Write a script to find \"Happy Numbers\"
published: true
cover_image: https://cl.ly/1I35272H2O1l/Image%202018-02-05%20at%203.43.00%20PM.png
description: Write a script that finds these so-called "happy numbers."
tags: challenge
---

These challenge posts have been a lot of fun.  Another one inspired by [Fermat's Library](https://twitter.com/fermatslibrary).

{% tweet 950366488245960707 %}

# Challenge

In the language of your choice, **write a script to find "Happy Numbers."**  Via [Wikipedia](https://en.wikipedia.org/wiki/Happy_number):

> A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits in base-ten, and repeat the process until the number either equals 1 (where it will stay), or it loops endlessly in a cycle that does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers (or sad numbers).

Looking at the picture in the embedded tweet will probably help solidify the process. Here are the first few happy numbers to help check your work:

> 1, 7, 10, 13, 19, 23, 28, 31

Have fun!
★ Notification specific routing in Laravel 5.6
Tags: laravel, php
Published: 2020-01-02 22:58:40

---
title: ★ Notification specific routing in Laravel 5.6
published: true
date: 2018-02-05 19:47:49 UTC
tags: laravel, php
canonical_url: https://freek.dev/971-notification-specific-routing-in-laravel-56
---

Laravel has [a very powerful notification system](https://laravel.com/docs/5.6/notifications). From the docs:

> In addition to support for sending email, Laravel provides support for sending notifications across a variety of delivery channels, including mail, SMS (via Nexmo), and Slack. Notifications may also be stored in a database so they may be displayed in your web interface.

Summarized you can send a `Notification` to a `Notifiable` via a certain channel. A notifiable can be any class that uses the `Notifiable` trait, for example a user. A good example of a channel is Slack.

In Laravel 5.4 and 5.5 this is how you can specify the slack webhook to be used when sending a user a notification.

```
class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the Slack channel.
     *
     * @return string
     */
    public function routeNotificationForSlack()
    {
        return $this->slack_webhook_url;
    }
}
```

The problem is that there is no way to send a a specific notification to a specific Slack webhook.

In Laravel 5.6 this [is solved](https://github.com/laravel/framework/pull/22289) by using the notification that's being passed to the routing method on the notifiable.

```
class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the Slack channel.
     *
     * @return string
     */
     public function routeNotificationForSlack($notification)
     {
          if ($notification instanceof MySpecialSnowflakeNotification) {
               return $this->alternative_slack_webhook;
          }
     
          return $this->slack_webhook;
     }
}
```

If you want to know some more new Laravel 5.6 features, be sure to watch [Taylor's talk](https://twitter.com/taylorotwell/status/958725579066499072) at [Laracon Online](https://laracon.net/) this Wednesday.
Hubrix accepting applicants for Hurima™ Beta, now through March 1
Tags: testing, showdev, devops, opensource
Published: 2018-02-05 18:26:11

---
title: Hubrix accepting applicants for Hurima™ Beta, now through March 1
published: true
description: 50 Chosen Ones can end their access-control pain before anyone else… and have a chance to win a Lego® Millenium Falcon™ by applying for the Hurima API Beta, now through March 01, 2018.
tags: testing, showdev, DevOps, Open-source 
canonical_url: https://www.hubrix.co/2018/01/hurima-beta-open/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/30cbk5ahayt6cupremxm.png
---

Hubrix is delighted to announce that we are accepting applications to the Hurima™ Beta test.

Hurima is an **access-control and user-rights management API**, suitable for integration with any local, Web, mobile or cloud application. **It is not an IAM component and it provides no authentication service.** Rather it relies on other, better APIs to provide authentication. So, Hurima by itself is just access control. But Hurima + PAM, Hurima + LDAP, or Hurima + Auth0 — any of those pairs *would* be an IAM component.

#The First Rule of Beta Club is...

1. **Anyone can apply, but only 50 will be chosen.** We are looking for developers with a genuine need for an access-control feature-set, and whose current or near-future work will benefit from Hurima.

2. **It’s a closed Beta.** Until we launch, the Beta will be the only way to use Hurima. Participants will be required to sign a non-disclosure agreement, that will expire when Hurima 1.0 launches.

3. **It’s a time commitment.** If you cannot devote at least 2 hours per week to the Beta program, please don’t step up. 

4. **There are perks.** We expect a lot from our Beta users, and we intend to reward them in return:
   + Limited-edition “Hurima Beta Blaster” T-shirt, issued exclusively to Beta participants
   + 25 EUR Amazon gift card
   + 1 Coupon code entitling you to Hurima Cloud at no charge for 6 months after launch
   + 5 Coupon codes for 40% off Hurima Cloud for 6 months, to give to your friends & colleagues
   + VIP Pass to the Hurima Launch Party in Paris, France
   + Hubrix staff will choose one MVT (“Most Valuable Tester”) who will be awarded a **Lego® Millenium Falcon™** (retail value 800€) at the conclusion of the Beta

![Dat Millenium Falcon](https://thepracticaldev.s3.amazonaws.com/i/0u5hzm0e4alpqxm7oy6i.png)

#How to Apply

**Just complete the form**: **https://hbr.li/hbeta**

This form has (at most) 13 questions and you should be able to complete it in **less than 2 mins** of your time.

Upon completing the form you will receive a confirmation email. **That’s it, you’ve applied.**

#What happens next

We’re accepting applications until 11:59 pm CET, **March 01, 2018**. We’ll triage all applicants to get a list of finalists. We will schedule online interviews with each finalist. Those accepted into the Beta program will be notified by March 26. The Beta program will run from April 02 through May 31.

We'll be glad to welcome you into our community!
Writing Huge CSVs Easily and Efficiently With PySpark
Published: 2023-04-29 22:26:47

---
title: Writing Huge CSVs Easily and Efficiently With PySpark
published: true
date: 2018-02-05 18:15:34 UTC
tags: 
canonical_url: https://mikestaszel.com/2018/02/05/writing-huge-csvs.html
---

I recently ran into a use case that the usual Spark CSV writer didn’t handle very well — the data I was writing had an unusual encoding, odd characters, and was really large.

I needed a way to use the Python `unicodecsv` library with a Spark dataframe to write to a huge output CSV file.

I don’t know how I missed this RDD method before, but `toLocalIterator` was the cleanest, most straight-forward way I got this to work. Here’s the code (with a bunch of data cleanup and wrangling omitted):

```
with open("output.csv", "w+") as f:
    w = unicodecsv.DictWriter(f, fieldnames=["num", "data"])
    for rdd_row in df.rdd.toLocalIterator():
        w.writerow(rdd_row.asDict())

```

That’s all there is to it! `toLocalIterator` returns a Python iterator which yields RDD rows. It’s essentially doing a collect to the driver, but only one partition is being processed at a time, saving memory.
(╯°□°）╯︵ ┻━┻
Tags: showdev, ruby, fun, developer
Published: 2018-02-05 16:42:51

---
title: (╯°□°）╯︵ ┻━┻
published: true
description: A useless gem for developer fun
tags: showdev, ruby, fun, developer
cover_image: https://camo.githubusercontent.com/7eebac3d6363f8c1b4a83c0b9d129112b7c066e2/687474703a2f2f692e696d6775722e636f6d2f78325247795a532e6a7067
---


I created a useless gem that prepends the table flipper on Exception messages :D

Check it out here: [https://github.com/iridakos/table_flipper](https://github.com/iridakos/table_flipper)
I'm not getting this...
Tags: dev
Published: 2018-02-05 16:25:12

---
title: I'm not getting this...
published: true
description: 
tags: Dev
---
Hi everyone, I've posted a few questions with Batch Code and I've noticed it getting a lot of "reactions" but no answers. I assumed this was a place for coding and developer questions but I'm getting the feel that nobody really knows CMD here. Is there a section I should be posting in?
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2018-02-05 15:36:36

---
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/xsr1z6iqv0pd7p3s6ns3.png
---

#1. Local Storage is **SO** _basic_

An explanation of the pros and cons of local storage. But most importantly: why it's insecure and shouldn't be used to store sensitive data. 

{% link https://dev.to/rdegges/please-stop-using-local-storage-1i04 %}

#2. ☁️ Try cloud-native development ⭐️

Announced recently, Alex writes about AWS Cloud9 and CodeStar for serverless apps. Take an in-depth look at what these tools are, along with their benefits and constraints.
 
{% link https://dev.to/alexcasalboni/welcome-to-cloud-native-development-with-aws-cloud9--aws-codestar--3ell %}

#3. Are you a senior or master dev?

Inspired by an article about programming salaries, Arandi breaks down the list of skills expected for each programmer classification. 

{% link https://dev.to/arandilopez/what-kind-of-programmer-are-you-2862 %}

#4. Give me some space

Don't you hate seeing a footer right underneath a header? This quick tutorial demonstrates how to use CSS grid to keep that footer away from the header when there isn't enough content to fill up the space. 

{% link https://dev.to/niorad/keeping-the-footer-at-the-bottom-with-css-grid-15mf %}

#5. conferCal

Made by Bourn, this is an app that lets you search for tech conferences. Perfect for people who are too lazy to scour the internet. This iteration already displays conference topics, dates, prices and locations. 

{% link https://dev.to/madebybourn/a-conference-calendar-for-people-in-tech-4ag7 %}

#6. Fun useless thing

Christopher shows us how to develop the opening crawl of Star Wars using HTML, CSS, and a bit of JS -- from creating the background to adding the infamous John William's track.

{% link https://dev.to/christopherkade/developing-the-star-wars-opening-crawl-in-htmlcss-2j9e %}

#7. Don't be a Framework Developer

Why frameworks are a stepping stone, and advice on how to move beyond them. Hint: your favorite framework is not the solution to everything. 

{% link https://dev.to/nebojsac/you-are-not-your-framework-3cm6 %}

_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!_
Should I prioritize authentication first in my project than its core functionalities?
Tags: authentication, sideprojects, discuss
Published: 2018-02-05 13:37:32

---
title: Should I prioritize authentication first in my project than its core functionalities?
published: true
description: 
tags: authentication, sideprojects, discuss
---

So, I'm quite at an impasse with my side project.

I never knew authentication would be so daunting and so I consider it as difficult as the core functionalities itself. I'm building an API and right now, I'm deciding whether to focus completing the authentication module (access tokens, refresh tokens, etc) or continue with the core functionality first and implement authentication later.

I know both would take huge time in development and I need recommendations for my next step.

I know most of the answers here will be opinionated but, hey, this is not stackoverflow. 😄 Every opinion counts and is super appreciated.

Thank you all in advance.
Concurrent HTTP downloads using Go
Tags: go, goroutines, channels, concurrency
Published: 2018-02-05 13:37:03

---
title: Concurrent HTTP downloads using Go
published: true
description: 
tags: golang, goroutines, channels, concurrency
---

Recently for an implementation of feature in Geektrust, we had to download multiple images from the internet and use it. This had to be an efficient implementation. This post is a brief explanation of the simple implementation done using goroutines and channels.

![Image courtesy — https://hackernoon.com/why-we-love-concurrency-and-you-should-too-c64c2d08a059](https://cdn-images-1.medium.com/max/1600/1*qBiZD7mvwkNcIGDrkyZeCQ.jpeg)

Go has an http package which has simple APIs to do HTTP operations. For e.g. if you want to download a page all you need to do is this.

```
resp, err := http.Get("http://example.com/")
if err != nil {
	// handle error
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
```
Given below is the implementation of downloading a file from a public URL and using it as bytes.


{% gist https://gist.github.com/dhanush/860d1695cda1813b27f9f1e26896422b %}

For downloading multiple files concurrently you can use the help of goroutines and channels.

{% gist https://gist.github.com/dhanush/a82220c307194d53084c2aec7bf6dafc %}

In the above code snippet, we initialise two channels, one for sending the file downloaded as []byte type and another for sending any errors that happened while downloading.

We then loop though all the urls and call the downloadFile method for each of them in a goroutine. These goroutines are executed concurrently and so the for loop is finished processing in no time. Inside the goroutine each file is downloaded and we get back bytes and error.

If there is an error in the download, then the error is pushed to the error channel and nil value is pushed to the done channel. If there is no error then the bytes are pushed to the done channel and a nil entry is pushed to the error channel.

An array of byte arrays is declared to collect the downloaded files back. We again loop through as many times as there are URLs to collect the byte array back from the done channel.

```
bytesArray = append(bytesArray, <-done)  
if err := <-errch; err != nil {   
   errStr = errStr + " " + err.Error()  
}
```

These two lines inside the for loop wait for the done and the error channel to receive data. Once the data has arrived, it increments the loop count. Bytes are appended to the array of bytes while error string is appended, if there are any errors.

You have now downloaded the files concurrently and they are available as an array of bytes. All just using simple Go code.

This article was first published on my [personal tech blog](https://medium.com/@dhanushgopinath/concurrent-http-downloads-using-go-32fecfa1ed27).