teleren/devto huggingface dataset:
Local time of employees in Notion
Tags: notion, timezone, utc, gmt
Published: 2021-12-30 01:38:48

Companies that have many employees working remotely, it's important to know the time of employees in their local time zone.

Unfortunately, Notion doesn't have a function to display UTC time, but a little magic and here's the formula:

```
formatDate(dateAdd(dateSubtract(now(), toNumber(formatDate(now(), "Z")), "hours"), prop("UTC"), "hours"), "HH:mm")
```
UTC is the column that contains the difference between the employee's local time and Greenwich Mean Time. In the table, this column can be hidden.

The formula is used to get the UTC time:

```
dateSubtract(now(), toNumber(formatDate(now(), "Z")), "hours")
```

The magic is hidden here: `formatDate(now(), "Z")`, `Z` is the time zone in ISO 8601. Our timezone is subtracted from our local time, thus obtaining UTC (GMT) time.
Read-after-write Consistency in MongoDB
Tags: mongodb, database, architecture
Published: 2021-12-30 01:20:04

# Read-after-write Consistency in MongoDB

In this article, I will describe how to achieve read-after-write consistency in MongoDB. The problem what we want to solve is:
- A collection maintains profiles.
- After we insert a new profile, we want to retrieve the top 20 ordered by some criteria in the same function.
- We find the newest profile is always not been found.

Our MongoDB client's configuration is almost default with a connection string, `readPreference=secondaryPreferred`.

## Changing Read Preference (incorrect)

We want to make the query always comes from the primary, so we try to assign a session-level read preference to `primary`. The [official manual](https://docs.mongodb.com/manual/reference/mongodb-defaults/) shows the collection-level preference can overwrite the client-level one.

![](https://i.imgur.com/U3lyKeP.png)

However, it does not work. 

## Changing Read and Write Concern (solution)

After consulting the MongoDB solution architect, we find the default read concern is `local` which [doesn't guarantee the operation order](https://docs.mongodb.com/manual/reference/read-concern-local/#read-concern--local-). Thus, the solution is not only changing the read concern to `majority` but also changing the write concern to `majority`.

Then, the problem is resolved.

By the way, the solution is a little complicated than MySQL does. If we use MySQL as one primary and two replicas, we can switch the read operation from a replica to the primary to ensure read-after-write consistency. On the other hand, MongoDB is designed to face the scene of large-volume data, he has to do more to balance the efficiency and functionality. Thus, in addition to configuring the read preference, using read concern and write concern are also essential.
Getting started with NodeJS
Tags: node, javascript, beginners
Published: 2021-12-30 01:08:34

Hello everyone wish you are well and good. For this post i will be sharing on how to get started with NodeJS backend. This is a really basic step. Lets get started



## Getting the idea what is NodeJS

Node.js is a way for web applications to have real-time two-way connections, where both the client and server can initiate communication, allowing them to exchange data freely.

1. create a folder and run npm init with your CMD

```js
npm init
```
So what does npm init does is that it will initialize a package.json file

![npm init command respond](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3rkukv3unjmzfrt9swi.png)

2. For the next step, we need to create a file that contains code for the web application. For the naming of the file, it is upon your own naming convention. A lot of tutorial is using app.js, or server.js as the name of the file. Below is the code needed just to test whether our web server is running or not 

```js
const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

```
3. Next, inside the folder directory use command 
`node {yourwebserverfilename}`

4. ![web server code respond](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wo1xq5nf7gs2t8sy1rmj.png) The image is showing that the web application is running on port 3001

5. Open the browser and check whether it is giving a response or not. 
![web server response](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1nsri749u19x8idax2me.png)
![what does the server response give](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdwsz1rttflatr7wrc0s.png)

If you manage to reach the steps above basically you are done with the basic of NodeJS. There will be an upcoming post to continue from this post as this is just a basic on how to get started with NodeJS

Thank you for your time and i hope you can gain something from this post. See you in the next post 🙌🙌
Time for a job change? 🤔
Published: 2021-12-30 00:46:12

Prices 💲 and services everywhere are continuing to soar 📈 at record levels AND the worth of money on our savings account is losing value over time. Although the yearly salary 💶 increase helps, it seems to be not enough.

The thought of a career 💼 switch definitely came to mind as it may bring at least extra 20% more compensation. It is understandable if this option doesn't apply to many as everybody's situation are different - one is happy and job hopping is a bit risky. 

I am leaning on looking to better provide for my family. As a matter of fact I have couple of interviews lined up next week. What is your situation and are you considering it?

This [resource](https://dev.to/frontendengineer/series/14457) might help you in case you need a refresher on interview.
Holidays are almost over 😭 Back to Reality 😱
Published: 2021-12-30 00:25:08

While some of us might be back to work already after a glorious holiday, some of us will be back after the New Year's holiday and will face the inevitable. I am one of the latter and is definitely not quite ready yet.

I am curious on what did you do during the long holiday - either personal and professional wise. Below is my story. 

1. Spent my leave on staycation. I hang out with the family and in-laws. Lots of shopping and ice skating.

2. Ate a bunch of unhealthy food I shouldn't be eating - more than what I imagined. Major diet after New Year to follow. 😊

3. Finally, wrote couple of ReactJS articles here at dev.to and created a video version that I am very proud of (still honing my video recording skills). Below are the links if you want to check it out. 

Thanks for the dev.to community for a great, warm support of the articles.

[Advance React Interview Questions](https://dev.to/frontendengineer/react-interview-questions-part-2-mid-senior-level-cal)
[Basic React Interview Questions](https://dev.to/frontendengineer/common-react-interview-questions-50gm)

So, that is my story. What is yours - No right/wrong answers.
DevOps, DevSecOps, TriceratOps?
Tags: devops
Published: 2022-02-11 22:31:27

---
title: DevOps, DevSecOps, TriceratOps?
published: true
date: 2021-12-30 00:00:00 UTC
tags: devops
canonical_url: https://jhall.io/archive/2021/12/30/devops-devsecops-triceratops/
---

Daniele Fontani joins the Adventure to discuss the different kinds of Ops like NoOps, AppOps, etc.

He makes fun of the different ways that people try to extend DevOps into other types of movements and why the different focuses may or may not be appropriate ways to manage resources.

[![](https://jhall.io/images/aido-600px_hu064dd3473c23b0dee6f42abfef90a45c_156562_400x0_resize_q85_box.jpg)](https://adventuresindevopspodcast.com/acronyms-in-devops-differen-kinds-ops-daniele-fontani-devops-0987)

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Don't sweat the small stuff
Tags: webdev
Published: 2021-12-29 23:57:14

This post is hypocrisy in motion because of my own track record, but I'm changing my views! Reformed I swear - there are many many micro optimizations and ways to sound clever, you can cite why  X method in JavaScript is bad because of its memory implementation... But is that important? I mean you have GC, we are not writing C here, managing our memory is not actually a real concern unless your running on an N64 or tiny device / in the cloud, we have ample memory budgets.

Is it important is the question you should ask before you open your mouth, could you be using your knowledge to fight bigger more meaningful battles?
Handling form input in React(including drop-down and checkbox)
Tags: javascript, webdev, react, 100daysofcode
Published: 2021-12-29 23:37:51

I have a form that requests for user's details - username and password, how do I get them in react?

Hello my dear reader, my name's Lucas and today we'll be solving the problem above and beyond that.

To start with, I need you to know that the way you create forms in react is very similar to that of vanilla html. Let's create a simple login form.

```javascript
<form>
  <h3>Username:</h3>
  <input type="text"  />

  <h3>Password:</h3>
  <input type="password" />
</form>
```
This is the simple form we'll be using.

Let's start by creating a state for each input, with empty string to start with

```javascript
const initialData = {username: "", password:""};

const [userData, setUserData] = useState(initialData);
```

Next, we destructure the state so that we can interact with its data.

```javascript
const {username, password} = userData;
```

What we'll be doing next is this. We want to recognize each input by their names, so we will be giving both of them a corresponding name plus we'll also set the values to the state's value(**username** and **password** in _useState()_):

```javascript
<form>
  <h3>Username:</h3>
  <input type="text" name="username" value={username} />

  <h3>Password:</h3>
  <input type="password" name="password" value={password} />
</form>
```

Up next, we'll create a function that updates **setUserData** whenever there's a change within it.

```javaScript
const onChangeHandler =(e) => {
  setUserData({... userData, [e.target.name]: e.target.value});
}
```

Or shorter
```javaScript
const onChangeHandler =(e) => {
  const {name, value} = e.target;
  setUserData({... userData, [name]: value})

  console.log(userData):
}
```

Finally all we've got to do is attach the function to each input.

```javascript
<form>
  <h3>Username:</h3>
  <input type="text" name="username" value={username} onChange={onChangeHandler} />

  <h3>Password:</h3>
  <input type="password" name="password" value={password} onChange={onChangeHandler} />
</form>
```


I really love to do for checkbox but then I discovered it will be interesting if you tried it out yourself, using this example. Let me know in the comment section if you did it. I'd be glad to know.


To read and understand more about this topic, visit Reacts official website: https://reactjs.org/docs/forms.html

Did you find this post helpful? Why not give it a like and share with others. 😉
Java Complete Roadmap 2022
Tags: java, webdev, programming, tutorial
Published: 2021-12-29 23:32:47

##Java Complete Roadmap 2022
In this blog we are going to discuss complete roadmap for Java Programming in 2022. I will give you only topics and if you like my post then follow my Blogs. Lets Start:-👇

###[Java Complete Roadmap 2022](https://codexashish.com/2021/12/java-complete-roadmap-2022.html)


##New & Trending Topics:👇
[Top 10 Trending Technologies to Learn in 2022](https://codexashish.com/2021/12/top-10-trending-technologies-to-learn.html)
[Top 10 Programming Languages You Must Know In 2022](https://codexashish.com/2021/12/top-10-programming-languages-you-must.html)
[Machine Learning Complete Roadmap 2022](https://codexashish.com/2021/12/complete-roadmap-of-machine-learning.html)

##Complete Roadmap 2022:-👇
[Python Complete Roadmap 2022](https://codexashish.com/2021/12/complete-roadmap-of-python-programming.html)
[Machine Learning Complete Roadmap 2022](https://codexashish.com/2021/12/complete-roadmap-of-machine-learning.html)
[C++ Complete Roadmap 2022](https://codexashish.com/2021/12/complete-roadmap-of-c-programming.html)
[Java Complete Roadmap 2022](https://codexashish.com/2021/12/java-complete-roadmap-2022.html)
[Data Structure Complete Roadmap 2022](https://codexashish.com/2021/12/complete-roadmap-of-data-structure.html)


##Some Laravel Tutorial for developer:👇
[Laravel 8 Interview Questions and Answers in 2022 (Part #1)](https://codexashish.com/2021/12/laravel-8-interview-questions-and.html)
[Laravel 8 Interview Questions and Answers in 2022 (Part #2)](https://codexashish.com/2021/12/laravel-8-interview-questions-and_22.html)
[Advance Laravel 8 Interview Questions and Answers 2022](https://codexashish.com/2021/12/advance-laravel-8-interview-questions.html)
[Everything About Laravel 8 Composer 2022 | Composer in Laravel 8](https://codexashish.com/2021/12/everything-about-laravel-8-composer.html)
[Laravel Jetstream vs Laravel ui  vs Breeze](https://codexashish.com/2021/12/laravel-jetstream-vs-laravel-ui-vs.html)

##Python Concept and Projects:-👇
[10 Best Python Libraries For Machine Learning](https://codexashish.com/2021/12/10-best-python-libraries-for-machine.html)
[Alarm Clock in Python with GUI](https://codexashish.com/2021/07/alarm-clock-in-python-with-gui.html)
[Tic Tac Toe Game Using Pygame in Python](https://codexashish.com/2021/06/tic-tac-toe-game-using-pygame-in-python.html)

**Thankyou for reading my blogs.**
#####My Website:👇
[CodexAshish](https://codexashish.com/)
🤔 How should I build my Frontend for a huge project?
Tags: webdev, discuss, javascript, html
Published: 2021-12-29 22:44:02

I’ve been working on building a non-profit, open-source organization for a while now and we have gotten to a solid point in the backend code. We have authentication, an event and rsvp system, profile picture generator, etc. If you want to check it out, you can [here](https://github.com/fairfield-programming/backend-server/). 

I’m also working on a frontend, but I’m at a stage where I can change the stack for it completely, so I wanted to hear your suggestions! You can check out the code so far [here](https://github.com/fairfield-programming/fairfield-programming.github.io/), and the domain for the website is [fairfieldprogramming.org](https://fairfieldprogramming.org). 

Do you think I should switch to react, pure html/css, or should I use vue? And how do you think I should communicate with the server?
A printable, PDF - Git cheatsheet
Tags: git, github, webdev
Published: 2021-12-29 22:40:55

---
title: A printable, PDF - Git cheatsheet
published: true
description: 
tags: git, github, webdev 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/anxkzsnin2ltis9pib7k.png
---

Hello guys, 

instead of a new article, I'd like to share two printable cheatsheets with you. 

I hope you'll find these useful.

## Cheatsheet 1: Common Git commands for local development

The first cheatsheet shows a common development workflow when working on a development project. Among these are:

- How to initialize a Git repository
- How to add and remove files from the Git repos
- How to manage code changes over several new features

![Git cheatsheet one](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/anxkzsnin2ltis9pib7k.png)

Get the PDF from my Git repos: https://github.com/tq-bit/dev-cheatsheets/blob/main/q-bit_cheatsheets_git_and_github_I.pdf

## Cheatsheet 2: Remote Git Servers

The second cheatsheet shows you a common, distributed development pattern and visualizes how several maintainers work on the same codebase. 

It attempts to answer the questions about: 

- How does a pull request work?
- How are local and remote repositories synchronized?
- How to delete a remote branch?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fq8v3239ifeocsvvsvkd.png)

Get the PDF from my Git repos: https://github.com/tq-bit/dev-cheatsheets/blob/main/q-bit_cheatsheets_git_and_github_IGit%20Cheatsheet_II.pdf

> Update 19.03.2022: Add new layout for Cheatsheet I
How I started my Web Development career in 2021
Tags: webdev, career, beginners, programming
Published: 2021-12-29 22:33:05

2021 has been a very challenging and exciting year at the same time but at the end I managed to do the switch I always wanted... 

10 years ago I started my bachelor's degree in Information Technology but due to life circumstances I was never able to pursue that career as sometimes life gets in the middle you see. 

I remember, 6 years ago, I was talking with friends and they were asking me what I want to do, what is the dream job for me.. and I remember I was just smiling and I was saying "Web development" and everyone was telling me that I need to focus on that and follow my heart. But in life things aren't as straight forward sometimes. 

I was at a point in my life where I didn't have the space to think or dream about anything, but I had to do what I had to do in order to pay my bills. But every time I was closing my eyes ... I was keep dreaming and thinking about that dream career and job and I was instantly smiling.

In 2020... and when the pandemic started, I realized that life can be too short and there is no reason to waste our time and do things we don't enjoy. For that reason, I decided to apply for a master's degree in Software Development. I was studying full time my online course, while I was working full time as well and sometimes without days off for weeks. But I said to myself that if I can push through this, then I will be unstoppable. 

I only new the basic of C++, HTML, CSS , JS and I just started learning React when I applied for my Masters. The challenge I had in front of me was unreal and many times I was getting frustrated and I was asking myself why I did this as I didn't have the knowledge required for that degree. I had to do python, develop a full stack application and all that while I had to learn the technologies as I go. It was tough...

The first 2 semesters gone and I have been successful so far. In addition to that I had a full stack application in my hands as a project I could add to my portfolio. And that was the point when I started applying for jobs. I applied for over 100 jobs in 3 months time with no luck. And suddenly I've been offered a position as full stack developer position. I couldn't believe it. And few months later, I realized that I do enjoy more front end development and I moved to a different company as front end developer.

The lesson I've learnt from that process is that you will never be 100% ready for any job but apply anyway. Employers are looking for skills and experience, but also they are looking for the right attitude and willingness to learn. Skills get be taught, but the right attitude can't.

So if you are starting out now, make a portfolio and showcase some of the projects you have created, create an attractive resume to show your skills and personality and go get it !! You will fail, you will get rejected at the beginning....but this will help you to learn more and prepare you for the next interview. 

"In order to succeed you must have willing to fail"

Good Luck :)
JS Types to Avoid Polyfilling
Tags: javascript, programming, discuss, webdev
Published: 2021-12-29 22:28:28

I was reading the [AirBnB JavaScript Style Guide](https://github.com/airbnb/javascript#types) recently and came across: 
> "Symbols and BigInts cannot be faithfully polyfilled, so they should not be used when targeting browsers/environments that don’t support them natively."

Since I didn't know what polyfilling was, I couldn't understand the full implication of the rest of the sentence. 

Wikipedia [provided a helpful definition](https://en.wikipedia.org/wiki/Polyfill_(programming)):

> "In web development, a polyfill is code that implements a feature on web browsers that do not support the feature." 

Ok, so that was polyfilling in theory -- using code to patch discrepancies between browsers. But what about in practice? And why doesn't it work for Symbols and BigInts? I decided to hunt down a good example. 

I found a great one on [Javascript.info](https://javascript.info/polyfills). It explained that the Math.trunc() function doesn't exist in all JS engines, so the polyfill code for it checks for the built-in func, and if it doesn't exist, executes the same functionality. 

I found the [exact reason why polyfilling is not a wise idea for BigInt](To emulate such behavior, a polyfill would need to analyze the code and replace all such operators with its functions. But doing so is cumbersome and would cost a lot of performance.) on JavaScript.info as well:

> "To emulate such behavior, a polyfill would need to analyze the code and replace all such operators with its functions. But doing so is cumbersome and would cost a lot of performance."

But what about Symbols? I found the [definition of the Symbol type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) on MDN:

> "Symbol is a built-in object whose constructor returns a symbol primitive — also called a Symbol value or just a Symbol — that’s guaranteed to be unique." 

Because these values must be guaranteed to be unique, I can imagine the process to generate them with a polyfill must also be high performance, like that of generating BigInts. That's my surmise, but I was unable to find anything that supported it, so I'd appreciate input here! 

The last question I have is: 

Why does the AirBnB style guide say Symbols and BigInts cannot be _faithfully_ polyfilled? It seems that they can't be _frugally_ polyfilled, in terms of performance, but I wonder why they used the adjective "faithfully". Does it mean that polyfilling these types changes them in some way?
Create an Image API with MongoDB, Cloudinary and Next.js
Tags: atlashackathon, nextjs, cloudinary, api
Published: 2021-12-29 20:42:30

### Overview of My Submission

Sometimes when you create a website or a blog, you need an image. So you copy the link and use it. But sometimes, the link are no longer available and your website is broken. 

The solution, create your own links. 
Get the link, save the image in a database or use a service like cloudinary and save the link in a database like MongoDB. 

You can take any link, save it to organise your research.
there is many usecases for this API.

### Submission Category: 

Choose Your Own Adventure


### Link to Code

[Github repository](https://github.com/yves0003/mongodb_imageApi)


### Additional Resources / Info

I decided to create an API to save all crypto currency logo and organised them to used it later. 

[Example Page](https://mongodb-image-api.vercel.app/)
Wednesday Links - Edition 2021-12-29
Tags: jvm, java, maven, microservices
Published: 2021-12-29 20:42:16

Should you start your architecture with microservices? (8 min) 🤨
https://arnoldgalovics.com/microservices-in-production/

Migrating Spring Boot app to Java 17 (20 min) 👌
https://blog.codecentric.de/en/2021/12/migrating-spring-boot-java-17-day-2/

Future of Maven (8 min) 💪
https://www.javaadvent.com/2021/12/from-maven-3-to-maven-5.html

GitHub may replace DockerHub (6 min)🙀
https://levelup.gitconnected.com/github-may-replace-dockerhub-a5da5e547f01

Zero dependency library discussion (3 min) 🍿
https://twitter.com/gunnarmorling/status/1474053962034782212

Performance Myths and Continuous Profiling (17 min) 💨
https://richardstartin.github.io/posts/perf-myths-and-continuous-profiling

Custom Spring Data Repository (5 min) 🧐
https://vladmihalcea.com/custom-spring-data-repository/