teleren/devto huggingface dataset:
Allow newly registered users to check Code of conduct etc while on-boarding
Tags: meta, onboarding, signup, welcome
Published: 2019-12-23 17:38:59

Hi Team,

Thanks for great platform for developers, Appreciate. This is my first post in meta :) 

Today I signed up , and was taken to below screen as part of on-boarding process.


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/d8v41pk9gl8vawyx6b8m.JPG)


I wanted to check both Code of conduct and Terms and Conditions, But it seems it keeps on redirecting to [https://dev.to/onboarding](https://dev.to/onboarding) and not allowing me to check those two links until I click continue and setup my complete profile.
Q: What Technologies Should I Use for Migrating a Rails Monolith to Microservices in 2020?
Tags: rails, microservices, kubernetes, architecture
Published: 2019-12-23 17:26:55

So I have this 6 years old rails application monolith that contains all these things:

- user interface
- database
- additional tables for statistics (snowflake schema)
- API for android app
- workflow engine
- batch workers (sidekiq)

Currently I'm running 4 instances of this application, each is configured especially for the customer who's using the instance. Yes, that makes 4 customers, each has ~300 users, so we're talking about 1200 users. A virtual server with 2 cores and 8 GB RAM handles it easily. The web server is nginx and the ruby application server is passenger.

**In 2020 a new UI (SPA) will be written**, so I can get rid of the UI in rails. However I will have to provide an API for the SPA and it will be totally different than the API for the android app.

**What a great opportunity to split the monolith into microservices!**

I might split the microservices like this:

- API for new UI
- API for android app
- batch workers
- statistics
- what's left in the old rails app (business logic, workflow engine)

So far I pretty much know what I'm doing. However I don't have much experience in the microservices world, so **I have a bunch of questions for you:**

- What about user authentication at the API for the new UI? Are JSON web tokens the way to go?
- What about the database? Should I split it along the microservices?
- How do the microservices communicate with each other? I prefer a message bus over direct REST calls, so...?
  - RabbitMQ?
  - Kafka?
  - Nats?
- Is it worth learning the whole Kubernetes stack? Or is docker plus docker-compose (or helm???) enough? Any other alternatives?

Actually my monolith isn't even dockerized, yet. Currently I feel overwhelmed by all the technologies I can chose from. **But what's the right technology stack for rails? And for me? This rails application is only a hobby project. Any recommendations?**
Resources for a React Full Stack Beginner
Tags: react, beginners, discuss, help
Published: 2019-12-23 16:58:52

Over the last year or so, I've gotten really familiar with and have come to love the simplicity and elegance of React on the front end, but when it came time to hook React up to the backend, I got lost in a sea of tutorials without really learning the fundamentals of backend development. For all of you who have experience using react on the backend, where do I get started with the fundamentals (like express) so that I can branch out into more complex topics (like hosting on a Docker container, GraphQL, and JSON Web Token Authentication)? Thanks in advance.
I miss you, var.
Tags: javascript, webdev
Published: 2019-12-23 16:27:12

---
title: I miss you, var.
published: true
description: An open poem to the JavaScript var
tags: javascript, webdev
cover_image: https://thepracticaldev.s3.amazonaws.com/i/f8j1owwledj95gxh4l15.png
---


This is my open poem for the JavaScript `var`:

{% twitter 1209148138201796609 %}
Exobrain: week of 12/15/2019
Published: 2019-12-23 16:26:14

# Weekly Digest

I keep trying to figure out a way to make myself blog more (at all 🧐). I realized that maybe the lowest bar to entry might just be to keep a log/digest of various interesting posts, tutorials, news stories, etc. that I find useful or interesting and post them weekly. Here's the first one.

## Heredocs in Ruby

Heredocs can be very useful in Ruby. Especially when it comes to things like writing out raw SQL in a Rails app. Yet I use them just rarely enough that I usually have to remind myself how. For that I usually use this reference.

- https://www.rubyguides.com/2018/11/ruby-heredoc/

## Weird Ruby - Lambdas

Can't quite remember how to call that lambda in Ruby? Maybe it's because there are [5 different ways...](https://metaredux.com/posts/2019/12/17/weird-ruby-invoking-lambdas.html)
Mocking HttpClients using HttpClientHandler in C#
Tags: csharp, testing, firstpost
Published: 2019-12-23 15:25:25

I was working on a gateway which based on the logged-in user would call APIs in the appropriate system appropriately. The architecture was basically client would call an API in the gateway and the gateway would in effect then redirect the call to the appropriate backend system as shown below. 
![Architecture](https://thepracticaldev.s3.amazonaws.com/i/hpz87bfgkdb6xhogwzxf.PNG)

The gateway directly calls APIs of the 2 source systems using HttpClient. The HttpClient had to be mocked to write UnitTests and the HttpClientHandler class was used to override the SendAsync method to return appropriate statuses based on the tests. 
A Sample implementation is as shown below

In the below code snippet the method _TestForHttpClient_ has to be tested and here we need to mock the implementation of _httpClient.GetAsync(Uri url)_ method.

```C#
public class ClassForUT
    {
        private HttpClient _httpClient;

        public ClassForUT(HttpClient httpClient)
        {
            _httpClient = httpClient;
        }
        public async Task<HttpResponseMessage> TestForHttpClients()
        {
            var content = await _httpClient.GetAsync("http://www.google.com");
            return content;
        }
    }
```
Solution: 

A Mock class was created which inherited from the HttpClientHandler class. HttpClients were created which were an object of this mocked class. The _GetAsync _ method of the HttpClient was abstracted in this class.

```C#
public abstract class MockHttpHandler : HttpClientHandler
    {
        protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken token)
        {
            var response = new HttpResponseMessage(System.Net.HttpStatusCode.OK);
            return await Task.FromResult(response);
        }

        public abstract HttpResponseMessage GetAsync(Uri url);
    }
```

Then the test method is created as shown below

```C#
 public class ClassForUTTests : IDisposable
    {
        private HttpClient _mockClient;
        private Mock<MockHttpHandler> _mockHttpClient;

 public ClassForUTTests()
        {
            _mockHttpClient = new Mock<MockHttpHandler> { CallBase = true };
            _mockClient = new HttpClient(_mockHttpClient.Object);
        }

[Fact(DisplayName ="Test For HttpClients Test")]
        public async void HttpClientsTest()
        {
            ClassForUT utClass = new ClassForUT(_mockClient);
            _mockHttpClient.Setup(p=>p.GetAsync(It.IsAny<Uri>()));
            var result = await utClass.TestForHttpClients();
            Assert.Equal(System.Net.HttpStatusCode.OK, result.StatusCode);
        }

        public void Dispose()
        {
            _mockClient=null;
            _mockHttpClient=null;
        }

}
```
Here when the _GetAsync_ method is called, the GetAsync method from the MockHttpHandler class gets invoked which returned the response from the overridden _SendAsync_ method.
Envelop Browser Extension
Tags: blockstack, browser, webextension, javascript
Published: 2019-12-23 15:54:24

We launched [Envelop](https://envelop.app) for Web and Android last June. Since then, we had around 1000 people trying it out. And it reached 10th place in the [App Mining Ranking](https://app.co/mining/july-2019).

Going forward, our main goal is to keep Envelop as simple to use as possible. The app should not get in the way of the task you’re doing. Uploading a private file should be quick, safe and not interrupt your flow.

In Android, you can already upload a file from any app on your phone, by sharing it to the Envelop Android app. Now, on the web, we've built a browser extension, so you can share file without losing the context of what you’re doing.

Here's what it looks like:

![Screenshot 1](https://thepracticaldev.s3.amazonaws.com/i/gcvcvxl92l0nc1hipogd.png)
![Screenshot 2](https://thepracticaldev.s3.amazonaws.com/i/puu8t8b02pn23icsz758.png)

Some great use cases for the Envelop browser extension:

- Your email client doesn’t allow you to attach files larger than 20MB
- Your messaging app doesn’t let you send a certain file type
- You’re filling in a form without a field to upload a file
- You can bypass those limitations by dragging the file you want to share onto the extension window and getting a link to send. Envelop ensures your files stay private and encrypted.

The browser extension supports Chrome, Firefox and Opera. Give it a try:

👉 [Chrome](https://chrome.google.com/webstore/detail/envelop/fedfongpkeoiknldijklbhhmiomelogi)
👉 [Firefox](https://addons.mozilla.org/en-US/firefox/addon/envelop/)
👉 [Opera](https://addons.opera.com/en/extensions/details/envelop/)

---

## Some details from under the hood

We opted for a window popup, instead of dropdown under the extension icon, so we could support file drag and drop.

The popup just opens a special version of the web app, designed for the small window. This has which has two advantages. It avoids needing to authenticate twice, once for the web and again for the extension. And updates are simpler, you instantly get the latest version of the app on the extension.

For cross-browser support, we relied on the [Web Extensions APIs](https://developer.mozilla.org/pt-PT/docs/Mozilla/Add-ons/WebExtensions).
What's Wrong With Agile Development
Tags: agile, scrum, xp, softwaredevelopment
Published: 2019-12-23 15:41:42

---
title: What's Wrong With Agile Development
published: true
description: 
tags: #agile #scrum #xp #softwaredevelopment
---

It's been a while since I've heard an amazing episode of JavaScript Jabber podcast about agile development [JSJ 349: Agile Development - The Technical Side with James Shore](https://devchat.tv/js-jabber/jsj-349-agile-development-the-technical-side-with-james-shore/). The ideas from that episode are coming up again and again, not only in my mind but also in discussions with other developers about the software development process. I decided to summarize my key takeaways from that episode in this short blog post:


1. Scrum masters aren’t there to charge but to enable. Perhaps, they should be just a temporary role until the team is self-organized in the process.


2. Scrum certifications are unfortunately more about the business that has been built around it rather than bringing actual value.


3. Agile tends to be more focused on how to organize rather than how to do the actual work. We need to discuss the technical side of agile more.


4. Start with one particular method (XP recommended), but always be focused mainly on the basic ideas from Agile manifesto.


5. Agile manifesto values some things more than others, but it doesn’t mean that the other parts are not important or useful.


6. Software development is not a sprint, it’s a marathon. Try to imagine athletes to run one sprint after another. Don't count weekends as a pause between sprints. Look at [The Six Week Cycle](https://3.basecamp-help.com/article/35-the-six-week-cycle) by Basecamp for an example of a different approach.

Agile is about shortening the feedback loop with a focus on delivering value to the customer according to values in [Agile Manifesto](https://agilemanifesto.org/). Keep it in mind whenever introducing some process or technique from any agile methodology.
How to make DevOps Resume
Tags: career, devops, linux, resume
Published: 2019-12-23 15:20:49

Hi All,
I recently found https://dev.to/, while searching on the internet about DevOps.
I am working as Linux administrator in Health care company, where I am taking care of their most critical website, who is hosted is using LAMP and MySQL-Replication.
I am very keen to get into DevOps and started to learn different DevOps tools.
I have gone through the Git, Maven and going through the Jenkins.
I do not have prior experience of DevOps and when I am going to apply for the job for DevOps, they are asking more than 4-year or 5-year experience.
I am pursuing course, where I will be learning different tools about DevOps technologies step by step.
Kindly help me how to make resume to get into DevOps and sample resume example.
I am having 4 year experience in Linux administrator.
Building an Indie Business Podcast- Great Podcasts from 2019🎙
Tags: podcast
Published: 2019-12-23 15:03:45

In this episode I discuss great podcasts I've listened to this year.

[Revenue Research](https://revenueresearch.co/)
[Episode Page](https://baib-podcast.com)
https://overcast.fm/+RG5gPyzw0
What's your way of learning a new language/framework?
Tags: discuss
Published: 2019-12-23 14:46:43

---
title: What's your way of learning a new language/framework?
published: true
description: 
tags: discuss
---

What's your way of learning a new language/framework?
Do you go direct to the documentation, watch crash course videos on youtube, go to MOOCs (Massive Open Online Course) to watch the videos and do the exercises?
Sample in a Range
Tags: ruby, metaprogramming
Published: 2019-12-23 06:26:25

---
title: Sample in a Range
published: true
description: open Range class a little bit to make magic happen
tags: ruby, metaprogramming
---

I wanted to get a sample from 1 to 10, when I was writing a test case. So as a believer in ruby magic, I just did `.sample` on Range `1..10`. It did not work! I got this

```ruby
2.5.7 :005 > (1..10).sample
Traceback (most recent call last):
        1: from (irb):5
NoMethodError (undefined method `sample' for 1..10:Range)
```

Okay, cool! Maybe there is a random method. So I called .random on the Range. Nope, that did not work either

```ruby
2.5.7 :004 > (1..10).random
Traceback (most recent call last):
        1: from (irb):4
NoMethodError (undefined method `random' for 1..10:Range)
```

What, are you serious? This should have been there right? Well, turns out the only way to get this working is by doing `rand(1..10)`. But this is not very object-oriented, is it? So how can we make this object-oriented?

Enter Open Classes, In ruby .. you can open whatever the class the language provides and put your own methods in it, as long as you are not breaking the language

```ruby
class Range
  def sample
    rand(self)
  end
end
```

Now things work as expected

```ruby
2.5.7 :011 > (1..10).sample
 => 5
```

**Explanation:**

What did I just do there in the above example?

I opened `Range` class, declared an instance method called `sample`. Inside it, I am calling `rand` with self as an argument. When you use `(1..10)` it's just a syntactic sugar of the representation `Range.new(1,10)`. So basically `(1..10)` is an instance of the `Range` class. Hence by defining an instance method `sample`, I made it available to be called on our object `(1..10)`. 

Hope, this cleared things up. Happy programming :)
What are your goals for 2020? Here are mine:
Tags: newyear, motivation, goals
Published: 2019-12-23 14:40:11

So, heya people.
Last Friday I had a surgery done (nothing serious but still need lots of rest) so this week I won't write much, but I really want you to comment with your goals. Pretty please???

I will divide mine into Tech related x Non-tech related rather then professional x personal, because if I am being honest some of my tech goals are personal but I pretend they are professional 😂. Some are both!
But you can share any goals and in any ways you want.

So I go first:

##My tech-related goals##
-Launch an online community for women starting in tech,
-Launch my own blog and start posting there as well,
-Write at least 1 technical post a month,
-Write a talk proposal and maybe, actually do the talk,
-Redo my Portfolio,
-Get my first paying Tech job,
-Starting learning Python with my bestie, just for fun,
-Buy a better laptop.


##Non-tech goals##
-Start some type of at home exercise,
-As soon as I get a paying job, start Yoga,
-Watch over how much I eat,
-Journal more,
-Pay off the evil credit cards,
-Save some money for emergencies,
-Stay longer in Brazil next time I visit,
-Maybe go to Canada visit bestie?


LOTS of goals as you can see. But wait!!! There is more!

I also have DEV specific bonus goals:

##DEV.to bonus goals##
-Have a post chosen as the top 7 so you will get me on your email and I will have a new badge ;)
-Be one of the top 500 authors of 2020. 


SO yes,
that is what I plan to get done in 2020. Will I? Who knows!

But I am sure to keep you all updated.

That is all for today, and please share your goals with me ;D

Have a very great week!!!

Merry Xmas if you are into that.

XOXO,
P.
Access To Free Developer Knowledge Sites
Tags: discuss
Published: 2019-12-23 14:24:39

Happy Monday Friends,

I wanted to share with you all one of my favorite knowledge websites that I get for free through my local library it is [lynda.com](https://www.lynda.com). If you've got a library card you might want to check if you get it for free as well. For my local library it was listed under Resources if its listed bingo you're good to go. Once you confirm your library is a partner you can head over to lynda.com and sign in under [organization portal](https://www.lynda.com/signin/organization) option with your library card number and pin.

What knowledge websites do you use for free?
Updating a table from another table
Tags: sql, snippet
Published: 2019-12-23 13:53:11

It's the end of the year, so I'm just going to translate an old post from 2007 that I still refer to once in a while : [Mise à jour d'une table à partir d'une autre](https://blog.pagesd.info/2007/05/30/mise-a-jour-table-partir-autre/).

To update a column in a table from the equivalent column of another table, MS Access easily accepts two table names for the UPDATE command, but not SQL Server.

Example: after updating the VAT rates in the products table, you have to copy these revisions in the invoice details table.

With Access:

```sql
UPDATE InvoiceDetails, Products
SET    InvoiceDetails.VatRate = Products.VatRate
WHERE  InvoiceDetails.Product_ID = Products.Product_ID
```

With SQL Server:

```sql
UPDATE InvoiceDetails
SET    InvoiceDetails.VatRate = Products.VatRate
FROM   InvoiceDetails
INNER JOIN Products ON Products.Product_ID = InvoiceDetails.Product_ID
```

With Oracle:

```sql
UPDATE InvoiceDetails
SET    InvoiceDetails.VatRate = (SELECT Products.VatRate
                                 FROM   Products
                                 WHERE  Products.Product_ID = InvoiceDetails.Product_ID)
```

---

This post was originally published on my [blog](https://blog.pagesd.info/2019/12/23/update-table-from-another-table/).
Cover image : [dbdiagram.io](https://dbdiagram.io/).
Value Tuples makes actions better
Tags: csharp, dotnet
Published: 2019-12-23 13:40:21

(First published on [What the # do I know?](https://zoharpeled.wordpress.com/2019/12/23/value-tuples-makes-actions-better/))

After a long wait, c#7 finally introduced [value tuples](https://docs.microsoft.com/en-us/dotnet/api/system.valuetuple?view=netframework-4.8) - we no longer have to work with those awful `Item1`, `Item2`...`Itemn` properties that [`System.Tuple`](https://docs.microsoft.com/en-us/dotnet/api/system.tuple?view=netframework-4.8) provides - we now have named tuples - meaning a much more readable code.

How does it help with actions? 
Instead of using an `Action<T1, T2, T3>` With c#7 you can use an `Action<(T1, T2, T3)>`. Now I know that it doesn't seem like much when you look at it like this - but take a real life example and the difference should be painfully obvious:

```csharp
// This is a part of a text file parser:

public void ReadFile(
    string fullPath, 
    Action<int, string, Exception> onReadError) 
{
    // implementation here
}
```

vs:

```csharp
// This is a part of a text file parser:

public void ReadFile(
    string fullPath, 
    Action<(int RowNumber, string RowContent, Exception ReadException)> onReadError) 
{
    // implementation here
}
```

Using value tuples enables you to name your parameters - which makes your code far more readable and easy to understand and to use - since these names will also be visible in intellisense.
The A.I. Protocol
Tags: ai, machinelearning
Published: 2019-12-23 13:37:00

Whether you are a Developer 👩🏽‍💻, Designer 🖥, an artist 🎨, a student 📚 or playing several distinct roles all at once, you need to organise your stuff wisely. ⏰
By wisely means, sorting things to get the maximum output, in minimum time, ✌️ as we know that according to theory of relativity, TIME and ENERGY are relative to each other. 🤔😇😀🤷🏽‍♂️
“Well, lets not dive deep into that physics class, for now at least. 🤫😁 ”
As it can be seen from the above diagram, the A.I. protocol depends upon some basic factors. One of which is the most important — the DATABASE.💁🏽‍♂️
For a moment, until my next article ✍🏻 where I am going to breifly explain each of these topics, separately, I am leaving you with your thoughts and knowledge about ‘ which of these are important and what role they play as ‘ the basis of an A.I. foundation. 🙂
This is me ‘ Designer Anna ‘ and we will meet again through my next article.
You can follow me on 👉🏼 twitter.com/designeranna1/ .
Till then Keep Coding #100DaysOfCode💯
I'm a Doer. How do I become a Knower?
Tags: beginners, discuss, productivity, career
Published: 2019-12-23 13:28:49

Recently I've been lucky enough to score some interviews for coding jobs (specifically front-end web development) but I've hit the same roadblock every time.
I'm a Doer. This means that I can have an idea for a website, app, etc. and *just do it*- I can work out how to build a blog with Netlify CMS or make a WordPress Plugin or a fancy CSS animation. Typically this involves google and a lot of trial and error.
The problem is that I'm not a *Knower*. I don't typically know how things work. I know how to make them work, or at least I can tinker until they do, but ask me or god forbid, whiteboard me and my knowledge always comes up short. Way short. My first technical coding interview was a disaster where the solution ended up being a single line of code and a basic math problem. I've been asked "explain what a [struct/interface/doohicky] is and I don't know the answer.
How does one bridge the gap between "I can do this" to "I know how to do this"? What's the best path forward for the Doers among us who need to build our Knower knowledge?
How to show phrases from textarea in paragraph?
Tags: javascript, string, html
Published: 2019-12-23 13:25:35

How to show phrases from textarea in paragraph?


function chunkIt(str, chunk) {
            var words = str.split(" ");
            var arr = [];
            for (var i = (chunk - 1); i < words.length; i++) {
                var start = i - (chunk - 1);
                arr.push(words.slice(start, start + chunk));
            }
            return arr.map(v => v.join(" "));
        }


        const newTextArea = text => {
            const newEl = document.createElement('textarea');
            newEl.innerText = text;
            document.body.append(newEl);
        }


     var test = document.getElementById("textarea");
        console.log(chunkIt(test, 2));
        console.log(chunkIt(test, 3));
        console.log(chunkIt(test, 4));

        newTextArea(chunkIt(test, 4));

























https://codepen.io/drago-ivan/pen/yLybXqN