teleren/devto huggingface dataset:
Hello, DEV!
Tags: meta
Published: 2020-01-21 18:09:52

---
title: Hello, DEV!
published: true
description: 
tags: meta
---

Hello there! :wave: My name is Vaidehi. I'm a writer, educator, and engineer based in Portland, Oregon. :evergreen_tree: 

I'm so thrilled to share that **I'm joining the engineering team at DEV**.


If you've been following the DEV platform over the past few years as it has grown, you might have seen my name float through your feed at some point. I started posting my technical writing on DEV back in 2017, when @ben initially reached out to me in the company's early days to see if I wanted to share my writing with the budding community. (Spoiler alert: I did!)

As the DEV community grew, my content reached corners of the world I never expected, and my work started to have an impact on the larger developer community. Since those early days, I've maintained a wonderful, friendly relationship with the @peter , @ben , and @jess .

![A photo of Ben, Vaidehi, and Jess in the early days.](https://thepracticaldev.s3.amazonaws.com/i/xpicuii10e53f9woyar0.jpeg)

We've worked together on other projects, like [#basecs](https://dev.to/t/basecs) and [Byte Sized](https://dev.to/bytesized), and they have supported my creative content as I have cheered them on as they grew DEV from a small company to much larger community, reaching [massive milestones](https://dev.to/devteam/special-announcement-from-the-dev-founders-hel) along the way.

{% twitter 1061292475132903424 %}

So, when the founders reached out to me about joining the team last year, it seemed only natural. After many years of watching DEV grow, I'm so excited to join in on the fun. I can't wait to help in leading the technical direction of the product and ensure that it stays a friendly, welcoming community as it scales to serve many different folks and their needs. I'm also excited to be able to produce creative content with the team, and be able to continue my technical writing in a more professional capacity!

Whether you're a member of the DEV community, or interested in knowing more about the product and our mission, I'm always available to answer questions and support you in your programming journey. If you see me at a conference or event, please don't hesitate to introduce yourself—I'd love to meet you! You can also get in touch with me on twitter ([@vaidehijoshi](https://twitter.com/vaidehijoshi)) or via email (vaidehi@dev.to).

I'm so thrilled for this new adventure, and can't wait to see what we can build together. :sunflower:
Automatically block personal events on your work calendar
Tags: productivity, design, startup
Published: 2020-01-21 18:06:36

Hi folks!

I wanted to share something that our team has been working on for the past few months that I think might be useful for this group. It's called [LifeWork Calendar](https://www.lifeworkcalendar.com), and it keeps events from your personal calendar automatically blocked out on your work calendar so that you don't ever end up overbooked.

We've had over 250 users sign up since we soft-launched a few weeks ago, and we're pretty excited to see the results: lots more people making time for their personal lives, less calendar juggling, and a better work-life balance.

Here's a peek at what LifeWork Calendar does:

🤹‍♀️Automatically defends your personal calendar from work overbookings
🔒Keeps your details private while still showing free/busy time to others
🌈Automatically color-codes and Emojifies personal events
🆓Preserves your free time by only blocking events you've accepted
📊Provides you with stats about where your time is going
💬Lets you manage and stay up-to-date on personal events via Slack

Check it out! It's free, and it only takes a few minutes to get it set up.
Pinning a Shoutout?!
Tags: django, python, firstpost
Published: 2020-01-21 17:28:56


__Working on this 7 team web app [Ascent](ca-ascent.herokuapp.com), that helps make everyday tasks at [Base Camp](https://basecampcodingacademy.org/) faster and easier.__

__MY TEAM__ : Shoutouts, we are in charge of making a way where students can be shouted out by other students. Each student has their own shoutouts page with all their shoutouts. A shoutout can be liked and pinned within each student shoutouts page.

I'm going to go over pinning a shoutout.

__Models.py__
 * This is the model for a pinned shoutout. This _OneToOneField_ is making sure that there can only be __one__ _PinnedShoutout_ per _User_ as well as __one__ _PinnedShoutout_ per _Shoutout_.
```python
  class PinnedShoutout(models.Model):
    user = models.OneToOneField(User, on_delete=models.PROTECT)
    shoutout = models.OneToOneField(Shoutout, on_delete=models.PROTECT)
```



__Urls.py__
 * This url's first argument is the path, second argument is going to be the name of the view that it corresponds with, and the third argument is like giving that view another name to be referred as.

```python
   app_name = "shoutouts"

   urlpatterns = [
   path("pinned/<shoutout_id>", PinShoutout.as_view(), name="pinned")
]
```

__Views.py__
 * If this view gets called(a shoutout gets pinned) it gets that shoutouts details redirects to another view, otherwise a shoutout gets created. Then if a shoutout has been pinned already it swaps them out removing the previous shoutout and pinning the new one.

```python
   class PinShoutout(View):
    def post(self, request, shoutout_id):
        user = request.user
        shoutout = get_object_or_404(
            Shoutout, pk=shoutout_id).select_related('shoutout')
        if not hasattr(request.user, "pinnedshoutout"):
            new_pinned = PinnedShoutout.objects.create(
                user=user, shoutout=shoutout)
        else:
            request.user.pinnedshoutout.shoutout = shoutout
            request.user.pinnedshoutout.save()
        return redirect("shoutouts:individual_shoutouts", recipient_id=user.id)

```
HE IS POSTGRESL YODA!!!!
Tags: erdose, postgres
Published: 2020-01-21 18:01:57

Do you think that I and he have some postgresql karma.

I mean I asked the following questions:

- https://stackoverflow.com/questions/59842917/how-i-can-manually-trigger-the-error-canceling-statement-due-to-conflict-with-r/59846261#59846261
- https://dba.stackexchange.com/questions/257775/manually-vacuum-bloated-tables-once-hot-standby-feedback-is-on-on-postgresql
- https://dba.stackexchange.com/questions/257750/could-once-max-standby-archive-delay-and-max-standby-streaming-delay-with-va


And almost according to my problems (or let us be honest my HUGE jira task) had the same person answering to me with acceptable answers. 

I sometimes think just happens like it was planed by G.O.D, what do you think? Have this happened to you?

I think I need to give some extra credit for the perfect answers to my situation.

So please give an aplause and some medals to: (drum sound)

https://stackoverflow.com/users/6464308/laurenz-albe
https://dba.stackexchange.com/users/176905/laurenz-albe
New version of SapphireDb with NodeJs support
Tags: showdev, javascript, database, csharp
Published: 2020-01-21 17:43:56

{% github sapphiredb/sapphiredb-js no-readme %}

SapphireDb now has got a new client implementation that is compatible with any JS client and also compatible with NodeJs. The npm-package is called <b>sapphiredb</b>.

# Story behind

A few days ago I posted an article on HackerNews to advertise a framework I created. The name of it is <b>SapphireDb</b>, it is an extension for Asp.Net Core and EF Core and enables you to easily create self hosted applications with realtime data synchronization. It should serve as alternative to firebase realtime database/firestore.

I got plenty of feedback including a few recommendations like moving the code base of the client implementation to a separate project. I totally agree to that point and decided to do so. At that moment SapphireDb only had a client implementation for Angular.

The process was not that complicated but I had to change all references to Angular specific things to a more generic API. I decided to use axios instead of Angulars HttpClient and it works fine. Also using direct inject of dependency instances instead of Angulars Dependency injection was pretty easy. I only decided to keep ng-packagr as build tool for the client library.

# NodeJs example

```
npm install sapphiredb rxjs axios -S
```

```js
var sapphiredb = require('sapphiredb');

var db = new sapphiredb.SapphireDb({
    serverBaseUrl: 'localhost:5000',
    useSsl: false,
    apiKey: 'webapp',
    apiSecret: 'pw1234'
});

db.collection('demo.entries').values().subscribe(function (values) {
    console.log(values);
});
```

# Changes for ng-sapphiredb

Because I moved the complete code base out of the project because I don't want to maintain the same code in two places you have to install sapphiredb along with ng-sapphiredb when using it.

```
npm install ng-sapphiredb sapphiredb axios -S
```


Check out the documentation to learn more: [https://sapphire-db.com/](https://sapphire-db.com/)

{% github sapphiredb/sapphiredb-js no-readme %}
Importing geo-partitioned data… the easy way
Tags: sql, database, go, design
Published: 2020-01-21 17:42:50



[CockroachDB](https://www.cockroachlabs.com/) is was created to make distributed data easy to manage.  If you are interested in managing data partitioned across the globe within the cloud or on-premise, you owe it to yourself to take a look.

* [Geo-Partitioning the easy way!] (https://glennfawcett.wpcomstaging.com/2019/12/06/importing-geo-partitioned-data-the-easy-way/)
Day 2 of new job.
Published: 2020-01-21 17:42:11

Why am I writing this? Blogging helps me arrange my thoughts, and I hope I never forget this, joining a company is more than just transfering learned skills.

Today I grabbed the bull by the horns, not content with just waiting for things to land in my lap I started asking questions, good start, then I used slack as a means of collecting information that would otherwise float off into space (because I am me and just like you, I am forgetful when under a lot of pressure). It's hard to know what you need to know until you know.

I then realized that yet again it was me putting myself under pressure and I'm trying to ease off now before I wear out my Sorry alowence, it came up again, I say sorry too much, (I don't see a problem but I guess people don't know me yet, sorry is how I start sentences, a bad habit I NEED to stop doing). Although trying to impress and get involved is contra to not doing as much. I am on probation, I am getting paid well and I don't want to let my family down.

Reading this back I can see I need to chill out now. Things will improve even more tomorrow.
Day-1:Learn React Everyday
Tags: react, javascript, webdev
Published: 2020-01-21 17:40:21

Hello !!!! 
Good lord !!! Finally, you are here to learn with me !!!!
I will be posting new article everyday with caculated dosage of knowledge so,keep following and start with me to learn React.

Like the 'young sheldon' said "Let's the learning begin" without wasting time.

Starting with this, i presume that you know 

<B>HTML
CSS
JS </B> (more specifically ES6)

If you don't , don't worry !!! i will make another article for you with just information that you will need from JS so that you can carry on learning JS parallelly with React.

<H3>Installing React in our local system </H3>
<p>First we need to install node in our system before we deal with react . 
Go to https://nodejs.org/en/download/ and download the appropriate version of Node .

Mine is windows 64 bit so i downloaded :

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

Now go to command line and check if node is installed properly.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/p8lz9hase0ugkv6qdgc7.png)

Note: you need to have version version of Node >= 8.10 

Let's create a project : 

    npx create-react-app my-app
    cd my-app
    npm start


Before heading forward, let's dissect and understand what this command is and what is this new term npx that look like npm .

    create-react-app is an utility to bootstrap a react project
 
You can find multiple webpage detailing difference between npm and npx but here is a short and maxim information.
https://stackoverflow.com/questions/50605219/difference-between-npx-and-npm

after the above command you will see page opened in your browser 

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

Now you have React project my-app in your local system ...


We will go to the project directory to understand the boilerplate . For now, we need to get through some JS concept before jumping into react: 
<ul>
<li><h5>'this' keyword</h5></li>
<li><h5>let and const</h5></li>
<li><h5>arrow functions</h5></li>
<li><h5>object literals</h5></li>
<li><h5>Rest and spreads operators</h5></li>
</ul>

<h4> 'this' keyword : </h4>
first what is 'this'?
'this' reference to the object that is executing the current function.

more clearly, if the function is inside the object, 'this' references the object itself .For example :

let's create an object name Laptop 
```javascript
     var Movie = {
                    name:'movie1',
                    play() {
                         console.log(this);
                    }                    
                 };
Movie.play();
```

result in console should be like this :

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/60rosq0pxmslzn4pik53.png)

let's try this with regular function: 

```javascript
   function playaudio(){
     console.log(this);
    }

   playaudio();
```
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/i3mt8f7zq08b8ut2ws46.png)

This is because by default 'this' reference global object which is window for now.

<h6> Arrow function </h6>
Learning Mobile Development: Which path is more "marketable" ?
Tags: discuss, mobile
Published: 2020-01-21 17:33:24

Hi there,
I am a jr. front-end Dev and I want to eventually get into Mobile development.

What is the path that has more demand?
Flutter? 
React Native?
Something else entirely?

P.S. I am in the USA near NYC, so there is where I eventually would look for a job
(D-R-Y)
Tags: 100daysofcode
Published: 2020-01-21 16:59:07

[![View on vgy.me](https://i.vgy.me/rGLl8u.png "View rGLl8u.png on vgy.me")](https://vgy.me/u/rGLl8u)

The DRY Principle is one of the tenets or key concepts of programing. DRY (D-R-Y) stands for Don't Repeat Yourself. 

day24
What is Laravel Model Observers?
Tags: laravel, php
Published: 2020-01-21 16:32:03

What is Laravel Model Observers?

Observers are used to group event listeners for a model. Observers classes method names refer to the Eloquent event you want to listen for. These methods receive the model as their only argument. Laravel does not include a default directory for observers.

Eloquent models fire several events, allowing you to hook into the following points in a model’s lifecycle:

Retrieved: after a record has been retrieved.
Creating: before a record has been created.
Created: after a record has been created.
Updating: before a record is updated.
Updated: after a record has been updated.
Saving: before a record is saved (either created or updated).
Saved: after a record has been saved (either created or updated).
Deleting: before a record is deleted or soft-deleted.
Deleted: after a record has been deleted or soft-deleted.
Restoring: before a soft-deleted record is going to be restored.
Restored: after a soft-deleted record has been restored.
Why we want to use Model Observer.

Now, suppose, if we want to concatenate the string with category name, but we do not want to write the logic or function in the controller then, we can use the Model Events. It will fire automatically when the new record is created or updated or deleted. There are some types of Model Events available in Laravel Doc

Keeps the controllers lean

Using observers will allow controllers to do what they’re supposed to do. Receive requests and return responses. By using observers, you are handing more of the logic over to the model layer which is generally seen to be good practice nowadays.

Encourages maintainable code

Observers make it easier to follow the Keep it simple, stupid design principle. By abstracting some of your logic into observers, you are organising your code base and defining design standards which will be more easily understood by the developers working on the code base in the future.

Encourages reusable code

As the first example below will show, observers make for a very DRY (Don’t Repeat Yourself) codebase. By avoiding repeating yourself, you minimise bugs and localise them. Would you rather fix the same bug in many places? Or just in one place? It’s a no-brainer.

Limitations

There are some limitations attached to Model Observer which you should keep in mind while using the model observers.

When you use saved or saving hooks, you should never call the model’s save method.
If you are using saved hook and want to call the save method, then you should probably use the saving hook.
If your logic need to call model’s save method, then rethink your logic or avoid using observers.
CONCLUSION

Eloquent model observers are a very powerful and useful feature but must be used with care. They can make your codebase more maintainable but you need to be mindful of their limitations.
Problems with Gatsby & WordPress
Tags: gatsby, wordpress
Published: 2020-01-21 16:27:08

I am a self-taught coder, and I am in the process of porting my shared-hosted Wordpress to Gatsby (hosted on Netlify). 

I make the basic works (displaying the post and pages onto Netlify). However, I have some following concerns: 

For page and post content, the data returns is `html` format. It was displayed in React as ``` <div dangerouslySetInnerHTML={{__html: wordpressPost.content}} /> ```

The problems arise are: 

* How could I add custom format for the Wordpress content (the `p`, `h1`, ...) 
* How could I add the `email newsletter` form (maybe at 50% of the content, or after the 3rd paragraph) 
* How could I use the Gatsby `Link` component for `<a>` tag that points to the site (internal URL) 
* How to add `advertisement code block` across the content 

... 

I would really appreciate if someone could shed light on these matters. I really love the Gatsby look and feel, but these issues are holding me back. 

Thanks, 
Tuan.
discussion11
Published: 2020-01-21 16:11:56

Why do you think conditionals are important?conditionals are important to make an organization and really easy way to read the code. 
Give a set of instructions on how you think a thermostat program should work and “bold/underline” the conditionals.
1 we need to have a schedule to organize all the activities.
2 seven day programming.
3stead of having to reprogram your thermostat to keep your home comfortable when it would normally be using energy-saving settings.
4you can use a schedule to control the temperature settings throughout the day.
How to deploy a symfony project on a web server via SSH & FTP
Tags: webdev, tutorial, php, symfony
Published: 2020-01-21 15:44:56

https://www.titocode.fr/article-standard/8/Comment-d%C3%A9ployer-un-projet-Symfony-4-sur-un-FTP-via-SSH

here is a french version of "How to deploy a symfony project on a web server via SSH & FTP"

Titocode.fr
Utilising keywords in your CV
Tags: career
Published: 2020-01-21 15:42:19

It's #TipTuesday - my new little mini series where I share little things that can make a big difference in helping you to secure as many interviews as possible and not get lost in the mix.



Tip number 2 is about Keywords.



You’re probably used to the idea of considering SEO when designing a website, but you might be surprised to hear that you should be applying that same mindset to your CV. If you're uploading it to job boards but not making sure you're maximising the searchability, you're basically wasting your time 😲



There are thousands of CVs on every job board and Recruiters utilise boolean search strings to filter through relevant skillsets. In order for your CV to show up in these search results, you need to think about what skills recruiters will be searching for to fill the kind of role you want.



To do this:

1) Have a look at several job specs of roles you’re interested in. What technical skills / tools are mentioned across the board? Make sure you include all the ones you have experience with.

2) Think about your job title. Is it company-specific (think Subway’s Sandwich Artists) or more generalist? Does it include an abbreviation like UAT or AI? Is it an accurate reflection of what you do?



Company-specific job titles won’t help you show up in search results. To get around this, add the more widely used version in brackets after your company-specific one. You can also do this if you feel your job title isn’t quite an accurate reflection of your role / too generalist.



If your job title includes an abbreviation, you might want to expand it somewhere else in your CV to make sure your profile is found regardless of which way your title is searched.



Hope you found the second #TipTuesday helpful. This is quite a big topic so check back for Keywords Part B next week!



Would love to hear your thoughts in the comments and what you’d like advice on in future #TipTuesdays!



If you missed the first #TipTuesday, you can find it here - https://www.linkedin.com/posts/ashleighlroberts_tiptuesday-tiptuesdays-cvtips-activity-6622786882063343617-aozB/
Pattern Match Struct's Name
Tags: elixir, todayilearned
Published: 2020-01-21 15:39:27

---
title: Pattern Match Struct's Name
published: true
tags: elixir, todayilearned
canonical_url: http://til.ryanwill.dev/posts/nv3b9wpko2-pattern-match-structs-name
---

If we define the following struct.

```elixir
defmodule StructTest do
    defstruct [:foo]
end
```

We can use pattern matching to capture the name of the struct in a variable.

```elixir
%name{} = %StructTest{}
name # StructTest
```

The struct’s name could also be pattern matched in a function clause.

```elixir
def print_name(%module_name{}) do
  IO.puts(module_name)
end

print_name(%StructTest{}) # StructTest
```

This is used in [Elixir’s Access Module](https://github.com/elixir-lang/elixir/blob/7c31ce174a4cde40366b941332aa25f885995639/lib/elixir/lib/access.ex#L209) to dynamically call the `fetch/2` function on a struct’s module.
Side Project: Wrote A Node Program That Can Write A Bash Script To Your Computer (Mac/Linux maybe Windows???)
Tags: bash, node, javascript
Published: 2020-01-21 15:26:32

I don't know how well it will work on Windows, so if you're on a windows machine, give it a try and let me know if it works or not! :fire:

[Check out my GitHub repo to test it out!](https://github.com/JimmyMcBride/bash-script-setup)

## What the program does:

You're most likely going to be in the repo's dir when you `node index.js` to run the program, so it starts by changing into your home directory. Once inside the home directory, it checks to see if you have a bin folder. If so, it moves on; if not, it makes on for you.

Then it checks your path variable, if `$HOME/bin` is not in your path then it exports `$HOME/bin` to your path variable from your .bashrc file. If you don't have a .bashrc file, then one is created. If you do have one, it's appended to the end of your file. 

Once both of those checks are finished, then it changes to your (potentially new) home/bin directory and creates a file named hello, adds text for a simple greeting to be echoed on command and changes the permissions of the file to 755. And just like that, I was able to write a program to write a bash script on your computer. 

### Now it's your turn!

Start writing more bash scripts on your machine! Everything is already set for you now. All you have to do is create a file in your home/bin, write the script (don't forget the shebang!) and `chmod 755 file_name` and your good to go!

I hope you enjoy making your work environment more productive like I do! If you want to read about the basics of writing your own bash scripts, check out my blog, [Write A Bash Script 101](https://dev.to/jimmymcbride/write-a-bash-script-101-4n2p). For a slightly more in-depth look at different tools that you can use in your bash scripts, check out my blog, [Bash Script Tool Kit](https://dev.to/jimmymcbride/bash-script-tool-kit-56i7).