teleren/devto huggingface dataset:
Javascript Math floor(), Math ceil() and Math round()
Tags: javascript, programming, tutorial, webdev
Published: 2021-12-27 08:46:44

---
title: Javascript Math floor(), Math ceil() and Math round()
published: true
date: 2021-11-21 13:01:30 UTC
tags: Javascript, programming, tutorial, webdev
canonical_url: https://devswisdom.com/javascript-math-floor-math-ceil-and-math-round/
---

## **Introduction**

In javascript there are many ways to round a number, one of the methods is to use a built-in object called  **Math** which gives us three methods to use, Javascript Math.floor(), Math.ceil() and Math.round(), each of these methods serve their purpose and should not be confused with each other or alternatives for each other, in this post, we will try to see how each method works with different examples and which one is suitable for which case.

## **Math.floor()**

This method returns us the largest integer less than or equal to the number which we pass as the input to the method.

### **Examples**

```javascript
console.log(Math.floor(5.95)); // output: 5

console.log(Math.floor(-11.23)); // output: -12

console.log(Math.floor(9.78)); // output: 9
```

## **Math.ceil()**

This method returns us the smallest integer greater than or equal to the number which we pass as the input to the method, which means it rounds up the number to the next greater or equal integer.

### **Examples**

```javascript
console.log(Math.ceil(5.95)); // output: 6

console.log(Math.ceil(-11.23)); // output: -11

console.log(Math.ceil(9.78)); // output: 10
```

## **Math.round()**

This method returns us the number rounded to the nearest integer, the question may arise that is this going to round up or round down to get to the nearest integer, this depends on the fractional part of the number, so if the fractional part is greater than 0.5 then the number is rounded up and if the fractional part is less than 0.5 then this method rounds down the number and if it is equal to the number than it also rounds up the number.

### **Examples**

```javascript
console.log(Math.round(5.95)); // output: 6

console.log(Math.round(5.23)); // output: 5

console.log(Math.round(-15.5)); // output: -15
```

## Conclusion

So now it is clear that these methods are different and cannot be used as an alternative for each other, we need to use each one according to our use case.

Check out some more posts from DevsWisdom

[What is AWS Artifact?](https://devswisdom.com/what-is-aws-artifact/)

[How to extract text from an image with AWS Textract?](https://devswisdom.com/extract-text-with-aws-textract-using-aws-step-functions/)

[Most Common Methods Used In Javascript and FAQ](https://devswisdom.com/most-common-methods-used-in-javascript-and-faq/)

[AWS Cognito Authentication With Serverless and NodeJS](https://devswisdom.com/aws-cognito-authentication-with-serverless-and-nodejs/)

The post [Javascript Math floor(), Math ceil() and Math round()](https://devswisdom.com/javascript-math-floor-math-ceil-and-math-round/) appeared first on [DevsWisdom](https://devswisdom.com).
What exactly is Domain Tokenization?
Tags: blockchain, web3
Published: 2021-11-21 13:00:08


Tokenization is the process of converting physical or non-physical assets into digital tokens. It is like transforming ownership rights of an asset into tokens. It is the new way of financing in the blockchain. 

The application of tokenization is evident in payment transactions among participants as it also creates multi-party ownership of assets. Tokens also provide an easy way to transfer ownership of assets. 

A domain name is like an asset, I can call it real estate in the digital world. Just like you have your real estate buildings as a physical asset, a domain name is a digital asset that can be tokenized.

Combining domain name as an asset and the definition of tokenization, we can say domain tokenization is the process of transferring domain names into a digital token for better ownership and shared ownership. Asset tokenization has been used since the 1970s for converting customer information into strings of non-sensitive characters for security.

**Why Do you need to Tokenize your Asset?** 
Let us use real estate as an example: You have an apartment worth $100,000  and you are in need of $20,000. Can you use your current apartment to get the money you need? This is where blockchain tokenization comes in, let us look at how tokenization works here aside from the fact that it helps in the conversion of ownership rights.

Asset tokenization can help convert $100,000 worth of the apartment into 100,000 tokens which means each token will carry a 0.001% share of the apartment. If a user purchases a token, the user has a 0.001% share of the apartment. On the other hand, purchasing 80,000 tokens entitles an individual to ownership of almost 80% of the concerned asset.

Tokenization enables better liquidity, faster settlements, and reduced costs easily without any concerns.

**Domain Tokenization**
Assuming you love pets and you want to create a website where people can see pets and like their pictures. You get the domain name say petlovers.com and put in some content, then your website is up. 

What if you tokenize that domain name and offer a portion of ownership to your friends who are also pet lovers? 

Let's say you offered 100 of your friends a portion of ownership, which means you have 100x  the number of people who have an economic incentive to contribute to the growth of a site, by adding content and promoting it.

So when someone comes to get the domain name, he won't just get it from one person, but from everyone that owns the domain name with revenues allocated based on fractional ownership.

That is domain tokenization and thankfully, through tokenization, an existing asset like a domain name can be owned by multiple people. 

**How to Tokenize Your Domain.**
Coudname is one of the leading platforms to trade and tokenize your domain name via NFTs(Non-fungible tokens) and it runs on multichain on Ethereum, Solana, Polkadot and Binance to allow free flow of assets and communication between networks.

You can join the community to get your first CNAME tokens.
Day 44 of 100 Days of Code & Scrum: Deadlines and Pressure
Tags: 100daysofcode, beginners, javascript, programming
Published: 2021-11-21 12:54:43

Happy Sunday, everyone!

I decided that I will focus on my website primarily for this week. I must create an output that I can deploy and show at the end of the week. I'm giving myself a deadline so that I'm forced to work the best that I can.

## Yesterday

Just like I do every weekend, I did my 6th Weekly Sprint Review and Retrospective, in which I went over what I've managed to do well, what my shortcomings were, and what I could do better in the future.

## Today

I set up my weekly Sprint Goals, which will mostly concern my **company website's homepage**. The others are secondary goals, which I will work on for a little bit each day without compromising my main objective.

## Weekly Sprint Goals

- finish my company website's homepage (and avoid getting distracted by more interesting projects).
- continue to learn Next.js and Typescript by using concepts while I build my website.
- continue studying for Professional Scrum Master I (PSM I) certification.
- continue networking, but allocate less time to this (coding is more important).

Have a great week, everyone!

![Thank You Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9ayfxxxaz2g2hfcqbsk.png)

### Resources/Recommended Readings

- [How to Receive Emails from Your Site's "Contact Us" form Using AWS SES, Lambda, & API Gateway](https://www.freecodecamp.org/news/how-to-receive-emails-via-your-sites-contact-us-form-with-aws-ses-lambda-api-gateway/)
- [Official Next.js tutorial](https://nextjs.org/learn/basics/create-nextjs-app?utm_source=next-site&utm_medium=nav-cta&utm_campaign=next-website)
- [The Typescript Handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
- [The 2020 Scrum Guide](https://scrumguides.org/scrum-guide.html)
- [Mikhail Lapshin's Scrum Quizzes](https://mlapshin.com/index.php/scrum-quizzes/)

### DISCLAIMER

**This is not a guide**, it is just me sharing my experiences and learnings. This post only expresses my thoughts and opinions (based on my limited knowledge) and is in no way a substitute for actual references. If I ever make a mistake or if you disagree, I would appreciate corrections in the comments!

<hr />

### Other Media

Feel free to reach out to me in other media!

<span><a target="_blank" href="https://www.rammina.com/"><img src="https://res.cloudinary.com/rammina/image/upload/v1638444046/rammina-button-128_x9ginu.png" alt="Rammina Logo" width="128" height="50"/></a></span>

<span><a target="_blank" href="https://twitter.com/RamminaR"><img src="https://res.cloudinary.com/rammina/image/upload/v1636792959/twitter-logo_laoyfu_pdbagm.png" alt="Twitter logo" width="128" height="50"/></a></span>

<span><a target="_blank" href="https://github.com/Rammina"><img src="https://res.cloudinary.com/rammina/image/upload/v1636795051/GitHub-Emblem2_epcp8r.png" alt="Github logo" width="128" height="50"/></a></span>
Ultimate Backend Roadmap 2022
Tags: beginners, devjournal, programming
Published: 2021-11-21 12:43:13

#Hey There,

**Are you a Java developer, or a Python developer, or maybe Golang developer?**
Well, whoever you are, we all face the same set of problems in our backend, just our language of choice is different in solving those problems. But one may think how to grow, not just in particular technology but as an engineer in a whole. So I present the [Backend Skillset Roadmap](https://whimsical.com/backend-dev-3UYBHbZzFYjmZbPToLxJje)



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


This roadmap is language agnostic and could be thought of as a checklist instead of a roadmap. You don't need to learn things serially, one can progress through each parallelly.


> P.S: Don't be Jack of all and Master of none.
The development cycle, and how I follow it
Tags: beginners, discuss, productivity, devjournal
Published: 2021-11-21 12:42:20

Hello! I am Piyush Raj and today I will be telling you about the development cycle and how I personally follow it. In this post, I will have the different stages in software development and at the end of each paragraph, I will show you what I do at that particular stage.


## Pre-Production: Where the pot of ideas boil
As the name suggests, pre-production is that stage before creating the final product. This is the stage where the team comes together to plan out how the product will look like through the use of designs, mind maps, etc.

In this stage, I usually like to make a [Milanote](https://milanote.com/) board and put design specifications(or a checklist that the final product must/should have) and based on that I(or my team if applicable) make a visual design of the final product using it. I like to use Milanote because it has many tools that help me put my ideas down in a flowing way that anyone can understand and helps me to plan in an efficient way. I also like to use MS Paint and Gimp to create any visual designs.


## Production: Where the ideas are cooked into finished products
This is probably the most exciting(and my favourite) part of the development cycle. This is where you(and your team) come together to make the final product based on all of the planning you did in the pre-production stage.

As I said earlier this is my favourite part of the development cycle. I usually like to use [GitHub](https://www.github.com) as my source control tool for my projects and to collaborate on projects as well. As for what tools I use, it's probably what you'd expect, [VS Code](https://code.visualstudio.com) for creating web projects and the [Unity Engine](https://unity.com/) to create video games.


## Post-Production
This is kind of what most people would refer to as the "boring" or not so fun stage. This is the stage where the final product is tested for any issues. This is done mainly through AB testing and other forms of testing. This is also the stage where apps are given constant updates after production. This stage mainly depends on user feedback and results from the AB tests.

I'll be very honest, I haven't really been part of a post-production stage but I do know that we run beta tests and roll them out to a few users if it's an app and we usually ask for opinions if the final product is a website. We then work accordingly based on the feedbacks we receive.


## Conclusion
So, I guess that was the end of this article and I would like to thank you for taking your time to read this article. I hope you enjoyed and hope you learnt something new!
My Coding Bootcamp Odyssey - Weeks 2-4
Tags: beginners, javascript, webdev
Published: 2021-11-21 12:39:40

**Odyssey** : *noun*

> 
a series of experiences that give knowledge or understanding to someone


> 
an intellectual or spiritual quest

Hi folks, thanks for tuning in! This is a kinda catch-up post as I have been a bad boy and not blogged weekly as I intended - blame it on the mind-blowing-bending stuff we have learned 🤯 and the need to rest my brain!

I am now calling this series my odyssey because that better encapsulates the path I am on - a bit more epic that a mere functional journey, I think.

So to orient ourselves this is about weeks 2-4 of my odyssey, following week 1 which was an introduction week. This is called the fundamentals block which covers the building blocks of JavaScript which we need to understand to progress to more higher-level and useful ways of using JavaScript. I'm a big fan of fundamentals-first learning.

I'm going to list the topics we have covered and give them a rating based on how well I think I grasped the topic:

🤯 I get what it is about but would struggle to teach it or give a good example

😐 I get it and could probably explain it

🤓 Love it! totally makes sense

**Here we go:**

- Testing with Jest 🤓
- Array Methods 🤓
- Higher order functions 😐
- Scope 🤓
- Function hoisting 😐
- Difference between a variable's value versus its reference 🤓
- 'Pure functions' 😐
- Testing side effects of functions with no return value with jest mock functions 🤯
- Closure 😐
- Destructuring 🤓
- Higher order functions
- Recursion 🤯
- Object Orientated Programming 🤓
- Factory functions and `this` keyword 🤓
- Constructor functions and instance methods 🤓
- `Class` syntax 🤓
- Callback functions 😐
- HTTP requests with Axios 🤓
- Promises and .then() and .catch() 😐

Wow! what a list - we covered so much in 3 weeks. It was not all plain sailing but we will be getting a lot more practice so I am confident the majority will sink in, in time.

Bring on the back end!
SMS Bomber App - Flutter
Tags: flutter, dart, python, android
Published: 2021-11-21 12:26:09

Note:- This app is only for educational purpose only. Please don't abuse the app or the API. Use it for fun not for revenge.

About this app:-  This is one of my small project to prank your friends which send bulk sms in a short period of time. Based on Flutter and Dart and for back-end I have used https://github.com/devn913/bomber_api which is hosted on free Heroku tier.

I am not a Flutter developer so if you have any ideas how to make this app better, I am open to contribution make sure to Fork it star it and follow me if you liked this project.

If you want me to add more API contact me by mail - devnirwal16@gmail.com

If you want to add more API yourself use this repo - https://github.com/devn913/bomber_api

Project GitHub Link - https://github.com/Devn913/bomber_app

APK link  - https://github.com/Devn913/bomber_app/blob/main/app-release.apk

My GitHub Profile https://github.com/Devn913

Virus Total - https://www.virustotal.com/gui/file/5f1c9a5eddddd14da717d0681d892665e946517f0b18c5a5ac7e6e2da4d6ffc1?nocache=1

Star it, Follow me if you liked this project.

Contact me if you are facing any issues.
HTML to APK
Tags: html, android, javascript
Published: 2021-11-21 12:13:02

HTML or Hyper Text Markup Language, isn't this world familiar to you?
Yes, may be you would say my First programming language...

But have you ever thought of making an Android App using pure HTML?

It is possible with the help of APPS GEYSER 
<A href="https://files.appsgeyser.com/ProTec%20Games_14786108.apk">
Try my App  </a>

I made it from my website link for absolutely <b>free of cost</b>...

<A href="https://protecgames.godaddysites.com/"><b><I><u>VISIT WEBSITE</U></I></B>

That's all for today follow for more...
Universal Auth nodejs auth system with mysql
Tags: node, mysql, react, bootstrap
Published: 2021-11-21 12:09:16

---
title: Universal Auth nodejs auth system with mysql
published: true
description: simply this is a full Auth system made with nodejs and express and mysql db
tags: nodejs, mysql,reactjs, bootstrap 
cover_image: https://user-images.githubusercontent.com/66588352/141417597-c2efee5a-e164-4677-9899-8b11d2b167f0.png
---

Since i struggled finding an setup for Authorization uses the Nodejs with Mysql.

I thought It might be a god idea to make my own setup which seemed to be a good start for any project you might start and it will save some time for those who like to work with Mysql rather than mongodb so I wish this help some people to start fresh in there projects.

Seems that my frontend not enough for that so if you like to make changes in it in my github repo you are welcomed to help other people with your changes.

Did I forget to mention that I used react-bootstrap to handle the UI,
I also planning to change it to tailwind for efficient use and more easy starter for anyone.

You can check the project from here : https://github.com/mahmoud-bebars/UA-MERN
& sorry for not having a live demo
Escolhendo o Worker Node - Kubernetes Instance Calculator
Tags: kubernetes, aws, k8s
Published: 2021-11-21 12:08:17

Estabelecer quais tipos de servidores serão usados no cluster não é uma tarefa muito fácil, podemos errar a mão para baixo ou errar a mão para cima (bye $$$).

Para nos ajudar nessa tarefa vou deixar abaixo dois links do [learnk8s.io](https://learnk8s.io/):

O **primeiro** é um post em que eles abordam como escolher o tamanho de um Worker Node: 

[Architecting Kubernetes clusters — choosing a worker node size (learnk8s.io)](https://learnk8s.io/kubernetes-node-size)

O **segundo** é um utilitário web para ajudar a escolher o melhor tipo de instância para seu cenário, com base no workload que você irá informar:

[Kubernetes instance calculator (learnk8s.io)](https://learnk8s.io/kubernetes-instance-calculator)

Espero que essas duas dicas rápidas ajudem nessa tarefa.
Contribute like a Pro. A guide for git-branching model (Part 1)
Tags: git, opensource, agile, github
Published: 2021-11-21 11:52:50

Building a software in a team requires a clear understanding and proper management of the codebase. If the team members **only** know the "pull-push",  you'll soon find yourself in the trap of resolving merge conflicts! 

Developing while shipping the software may become tricky if the team is not familiar with version control. Git-flow plays a great role in agile development. I insist you to read every single word in this article, don't skim. Let's start exploring git-branching model.

### Git-branching model
Implementing the git-flow, your repo should contain two main branches:

- master (or main)
- develop

Master branch is the main branch which is automatically created once you initialize a repo in a git. It is the origin of the repo and pre-exist. You'll find it written `origin/master`.  This is the branch which must contain "clean codes", the codebase which is ready for deployment. You **should not** contribute or push codes direct to this repo! I'll tell you where to push your codes.

Develop branch is the branch which you should create. I advice you, to do this even if you're building alone. This is a branch which contains **active codebase**, the project at development state. Whether the feature is working or buggy, this is the right place for it. This is how you start:
```
# Create a develop branch and switch it on
$ git checkout -b develop
# Pull the codebase from master branch into your current branch(develop)
$ git pull origin master
``` 
### Other branches
Apart from the main two branches, there are three other branches. All these branches should be created within `develop` branch. These branches are:
- Features branch
- Hotfix branch 
- Release branch

This is how you create them:
```
# Created as a sub-branch of develop branch (replace feature-backup with a branch name)
$ git checkout -b feature-backup develop
# Or a hotfix branch
$ git checkout -b hotfix-443 develop
```

### Naming convention and merging
Naming these branches follows the standard way. Such as `feature-*`,` hotfix-*` and `release-*`. So for example; `feature-login`, or `release-1.0.1`

After all your implementation in the feature branch (or any other branch apart from main branches) you should merge it back to `develop` branch then later to `master` branch (during production). This is how you do it:
```
# Switch to develop branch
$ git checkout develop
# Merge the feature branch
$ git merge --no-ff feature-backup
```

Merging with flag `--no-ff` creates a new commit record. This helps to store historical information of the feature branch **even after the merge**. Thus, makes it easy to roll back in a particular feature just from the develop branch (even after merging).


![git-merge(2).jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1637488117745/C6CIU48eL.jpeg)

Don't miss the next part of this article.

Thanks for reading!

Originally, posted [here](https://maenblog.tech)
Console.error or throw new Error?
Tags: javascript, errors, beginners, opinion
Published: 2021-11-21 11:50:11

Recently, I was involved in a discussion about error handling. We couldn't agree on proper usage of `console.error` and when to use `throw`. So I've decided to write a short post on how I see it.

## When to use console.error

Almost never. `console.error` is nothing else but `console.log` that outputs red in your developer tools. **It can’t be really considered as an error handling tool.**

Use `console.error` (or `console.assert`) to make assertions to prevent impossible. Anytime you think "this could never happen", add assertion on that.

**Keep those assertions also in production code** unless it is a performance issue. You will experience way more "impossible" scenarios in production and having assertions in your code will help you to discover them earlier.

## When to use throw new Error

Anytime you have corrupted data or an impossible state - throw!

> Dead program can do less harm than a program with corrupted data.

Consider following scenario

```js
try {
  let today = new Date(‘orange’)
} catch (e) {
  // handle error
}
```

Since it’s impossible to create a date from `orange`, it’s better to throw an error.

## What’s the alternative (future)?

Exceptions (throwing errors) are mostly used in OOP languages. Functional languages treat **errors as a type** rather than something special.

It's becoming more common to see this pattern also in non-OOP languages. But I would be careful to use it until it becomes standard.

```rust
let f = File::open("hello.txt");

let f = match f {
    Ok(file) => // do something with file
    Err(error) => // do something with error
};
```

The example above is from Rust. The method `open()` returns either `File` type or `Error` type. In either case, **it’s just a type**, no `exceptions`.

I find this error handling most straightforward. It makes it obvious what functions may return `Errors`, plus it forces you to handle them properly.

## Conclusion

Don't use `console.error` for real error handling. Use `throw new Error()` when you can't satisfy your business needs. And **treat all errors equally, no matter where they come from**. It will make your life easier.

PS: Warning is just a future error.