teleren/devto huggingface dataset:
Easy Log Facilities for JavaScript
Tags: javascript, debug
Published: 2022-10-08 18:39:41


Here are some log debugging facilities exposed for JS.

## 1. console.log (arg1, arg2, ..., argn)

console.log can take more than one argument. If it is the case, it would make logs as much as separate arguments count.

## 2. console.log ({ ...props })

You can either pass an object or a property bag object and it will be logged as well. Remember that if an object does not have an explicit toString() method it will output something like "[object Object]" when concatenated in a message string, and could be useless.

```
// example
const a = 1
const b = 2
const c = 3

// shorthand object notation
const item = { a, b, c }

// instead of:
console.log ('The item is ' + item)

// prefer: 
console.log ('the item is:', item)

// or: 
console.log ({ item })
```

## debug flag for factory functions

You can pass to a factory function a debug flag, and log if it is true, just with logical AND!
```
let debug = true

const factoryFun = ({ x, y, debug }) => {
    const point = { x, y }

    point.distance = (other) => {
        const dx = Math.abs (this.x - other.x)
        const dy = Math.abs (this.y - other.y)

        debug && console.log ('computing distance between another point')
        
        return Math.sqrt (dx*dx + dy*dy)
    }

    debug && console.log ('factory')

    return point
}

const point = factoryFun ({ x:4, y:2, debug })
```

## 4. Adjustable verbosity level filtering


let level = 0 // no log !```

const bigImplFun = ({ level }) => {
    const filter = (x) => x > 0 && x >= level

    filter (1) && console.log ('log level 1')
    filter (2) && console.log ('log level 2')
    filter (3) && console.log ('log level 3')
}

bigImplFun ({ level: 3 })
```
## 5. Indentable logging messages

Wrap it up ! If you're tired writing ampersands "&&" sequences, isolate inside a function body

```
const debugx = ( level, message ) => {
    const test = x > 0 && x >= level
    const indent = '\t'.repeat (level - 1)

    test && console.log (indent + message)
}

const BigImplModule = ({ level }) => {
    const nested = () => {
        debug (2, 'log level2')
    }

    const f1 = () => {
        debug (1, 'log level1')
    }
    const f2 = () => {
        debug (1, 'log level1')
        nested ()
    }

    const mod = { f1, f2 }
   return mod
}

let level = 0 // no debug !!!
let instance = bigImplModule ({ level })

instance.f1 ()
instance.f2 ()
```

Et voilà ! Happy coding.
PostgreSQL unit-8
Tags: postgres, database, sql, mysql
Published: 2022-10-10 06:59:57


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

```
SELECT * FROM users WHERE date_of_birth BETWEEN DATE '2000-05-05' AND  '2008-01-01' ORDER BY date_of_birth;
```

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




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

```
SELECT * FROM users WHERE email LIKE '%.com';
```

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

```
SELECT * FROM users WHERE email LIKE '%web%';
```

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


```
SELECT * FROM users WHERE email LIKE '_______@%';
```


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

```
SELECT * FROM users WHERE country ILIKE 'p%';
```

```
SELECT * FROM users WHERE country LIKE 'p%';
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/btrjf34g56mss3gj4uk9.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tvd7ofygetbkcknt6rfc.png)
PostgreSQL unit-7
Tags: postgres, sql, database, mysql
Published: 2022-10-10 06:56:55


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



```
 SELECT * FROM users LIMIT 10;
```

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

```
 SELECT * FROM users OFFSET 15 LIMIT 10;
```

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

```
SELECT * FROM users OFFSET 15 FETCH FIRST 10 ROW ONLY;
```


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

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

```
 SELECT * FROM users WHERE  country='China' OR country='Russia' OR country='Sweden';
```
## and
```
SELECT * FROM users WHERE  country IN ('China','Russia','Sweden');
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gnqwwcy94wk23ciklsu3.png)
React Shorthand Tips and Tricks - JSAyushThakur
Tags: webdev, react, tutorial, beginners
Published: 2022-10-10 06:56:26

####   Original Tweet From  [@JSAyushThakur](https://twitter.com/JSAyushThakur)
{% embed https://twitter.com/JSAyushThakur/status/1577327919520952321 %}

### 1️⃣ Fragment shorthand

➡ Simple empty tags could be used instead of React Fragment ![Twitter Image 1](https://pbs.twimg.com/media/FePKAIKaEAApZLt.png) 

### 2️⃣ Omitting a prop value

➡ A prop's default value is true, so we can simply skip assigning value to it ![Twitter Image 2](https://pbs.twimg.com/media/FePKHCPagAApYbW.png) 

### 3️⃣ Destructing the props

➡ Destructure property can be used in props to make the code cleaner ![Twitter Image 3](https://pbs.twimg.com/media/FePKK9kakAA4_I3.png) 

### 4️⃣ Handling undefined

➡ This shorthand trick can be used to check whether a value is empty or not ![Twitter Image 4](https://pbs.twimg.com/media/FePKNQWaEAAKHYw.png) 

### 5️⃣ Automatically assign keys

➡ React.Children.toArray() could be used to automatically assign keys ![Twitter Image 5](https://pbs.twimg.com/media/FePKTUPaYAYYJ7e.jpg) 


AdSpace Here!!


### 6️⃣ Rendering components

➡ React Components can be simply called or rendered as functions ![Twitter Image 6](https://pbs.twimg.com/media/FePKWQdaUAAX_YV.png) 

Thank you for reading the thread ☺️

If you like [](url)it then do give the first tweet a RETWEET 🙌

{% embed https://twitter.com/JSAyushThakur/status/1577327919520952321?t=AkfEOXj3IYc_le2gThYBpw&s=19 %} 


Click [Here](https://www.knowledge-twitter.com/?utm_source=dev.to)  For More Posts Like This [https://www.knowledge-twitter.com](https://www.knowledge-twitter.com/?utm_source=dev.to)
Best CSS Libraries 2022 - mujeeb0147
Tags: webdev, css, techtips, beginners
Published: 2022-10-10 06:49:21

####   Original Tweet From  [@mujeeb0147](https://twitter.com/mujeeb0147)
{% embed https://twitter.com/mujeeb0147/status/1577501294218170374 %}
Best CSS Libraries 2022

Thread🧵👇 

### 1. Animate .css
🔗 {% embed https://animate.style/ %}

### 2. Picnic.css
🔗 [https://picnicss.com/](https://picnicss.com/)

### 3. MagicAnimation
🔗 [https://www.minimamente.com/project/magic/](https://www.minimamente.com/project/magic/)

### 4. Cirrus.css
🔗 {% embed https://www.cirrus-ui.com/ %}

### 5. Halfmoon.css
🔗 {% embed https://www.gethalfmoon.com/docs/introduction/ %} 

If you enjoyed this thread, please do the following:
1. Retweet the first tweet.
2. Add me as a follower and enable notifications: [@mujeeb0147](https://twitter.com/mujeeb0147).
Thank you for staying with me this far. 



Click [Here](https://www.knowledge-twitter.com/?utm_source=dev.to)  For More Posts Like This [https://www.knowledge-twitter.com](https://www.knowledge-twitter.com/?utm_source=dev.to)
Web App for Worksheet
Published: 2022-10-10 06:40:19

Hi, 

This article talks about a web application that I created using front stack - Angular and backend - nodejs with Express DB-Mysql. 

**Purpose**
Aim of the application is to act as repository for practice questions for school and colleges. You can search practice questions using multiple attributes, arrange them and publish them.

Website - [Praksheet.com](https://praksheet.com)
Web App - [Praksheet App](https://ioblitz.praksheet.com)

There is a defined roadmap for this application. This is version 1.0. I am happy to see it take off and it was fun working on this site. Working on a separate technical article. 

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

Video detailing features of the website. 
{% embed https://youtu.be/SxJd11XkYss %}

Thanks
Look it up
Tags: development
Published: 2022-11-03 23:55:50

---
title: Look it up
published: true
date: 2022-10-10 06:26:00 UTC
tags: development
canonical_url: https://rachsmith.com/look-it-up/
---

### Link: [Look it up!](https://geoffgraham.me/look-it-up/)

Geoff writes:

> The best skill you can develop as a front-end developer is [how to think like a front-end developer](https://css-tricks.com/how-to-think-like-a-front-end-developer/). And front-end developers know where to find answers more than they know the actual answers.

Yes, exactly. We get a lot of practice at looking things up as developers. After a while, you may forget that it is a skill you developed over time and assume everyone else can do it.

I am reminded of this whenever my mother-in-law asks me to help her out with a tech issue, and she watches in amazement as I quickly google a phrase, scan the results, adjust the search term, and repeat until I find a link that helps me.
PostgresSQL unit-6
Tags: postgres, database, sql, mysql
Published: 2022-10-10 06:24:46

```
SELECT DISTINCT country FROM users ORDER BY country;
```

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



```
SELECT * FROM users WHERE gender='Female';
```

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

```
SELECT * FROM users WHERE gender='Female' AND country='China';
```

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

```
SELECT * FROM users WHERE gender='Female' AND (country='China' OR country='Russia');
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ychcci4s9i3g81t77m9k.png)
Adding a layout to NextJS - part 3
Tags: nextjs, javascript, webdev, beginners
Published: 2022-10-10 06:24:45

Now that we have our [basic application set up](https://daily-dev-tips.com/posts/nextjs-portfolio-setting-up-part-2/), we can dive into the more detailed work.

In [part 1](https://daily-dev-tips.com/posts/creating-a-nextjs-portfolio-part-1/) I asked you to think about the global structure you are seeing, and in the template I picked, we got to know there were three designed pages.

![Analyzing the layout](https://cdn.hashnode.com/res/hashnode/image/upload/v1664515340181/10QcFqKQB.png)

The common element on all these three pages is the header and footer part. They look the same on every page and thus can be created in one layout file, so we don't have to repeat ourselves.

In this article, I'll show you how to do just that.

## Creating the layout

Let's start by adding our layout file. For this, we must first add a components folder to our project.
Then inside, create a file called `layout.js`.

Let's start with some hardcoded layout elements, and we'll move them to our components later.

```js
export default function Layout({ children }) {
  return (
    <>
      <header>Header</header>
      <main>{children}</main>
      <footer>&copy; 2022 - Our portfolio</footer>
    </>
  );
}
```

As you can see, a layout is technically simply a component that renders some other elements.
Inside, it renders `"children"`, which is whatever we put inside of it.

To use this layout, we need to load it from our `_app.js` file.
This file is the entry point for our application.

It will return whatever we throw at it by default, but we can wrap that into this layout.

```js
import '../styles/globals.css';
import Layout from '../components/layout';

function MyApp({ Component, pageProps }) {
  return (
    <Layout>
      <Component {...pageProps} />
    </Layout>
  );
}

export default MyApp;
```

As you can see, the component element is now wrapped in our layout, so the `Component` will become the `children` part as defined there.

You can now run your project to see it in action. The page should now have the header and footer.
They don't look much yet, but we'll discuss that in the following article.

![Layout in action](https://cdn.hashnode.com/res/hashnode/image/upload/v1664516202560/Od-xNL1ZD.png)

If you want to see the code for today, I uploaded it to [GitHub](https://github.com/rebelchris/next-portfolio/tree/part-3).

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Foal v2.11 has been released with better password management
Tags: node, typescript, javascript
Published: 2022-10-10 06:24:27

---
title: Foal v2.11 has been released with better password management
published: true
description: Foal v2.11 has been released
tags: NodeJs, node, typescript, javascript
canonical_url: https://foalts.org/blog/2022/10/09/version-2.11-release-notes
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5rbge88780e26db457qx.png
# Use a ratio of 100:42 for best results.
---

![Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5rbge88780e26db457qx.png)

Version 2.11 of [Foal](https://foalts.org/) is out! Here are the improvements that it brings:

## Number of Iterations on Password Hashing Has Been Increased

The PBKDF2 algorithm (used for password hashing) uses a number of iterations to hash passwords. This work factor is deliberate and slows down potential attackers, making attacks against hashed passwords more difficult.

As computing power increases, the number of iterations must also increase. This is why, starting with version 2.11, the number of iterations has been increased to 310,000.

To check that an existing password hash is using the latest recommended number of iterations, you can use the `passwordHashNeedsToBeRefreshed` function.

The example below shows how to perform this check during a login and how to upgrade the password hash if the number of iterations turns out to be too low.

```typescript
const { email, password } = ctx.request.body;

const user = await User.findOne({ email });

if (!user) {
  return new HttpResponseUnauthorized();
}

if (!await verifyPassword(password, user.password)) {
  return new HttpResponseUnauthorized();
}

// highlight-start
// This line must be after the password verification.
if (passwordHashNeedsToBeRefreshed(user.password)) {
  user.password = await hashPassword(password);
  await user.save();
}
// highlight-end

// Log the user in.
```
Sonovive: It's Taking 100% Result for ear pain!
Published: 2022-10-10 06:14:39

I feel that you'll locate that I have a few outstanding credentials. I did meet with a number of opposition on that and this is how to stop inordinate worrying. We want to talk to decision makers. Did this produce the desired results? This can be very a conundrum for [Sonovive](https://www.outlookindia.com/outlook-spotlight/sonovive-beware-of-fake-supplement-hidden-truth-you-must-know-it-news-223575 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9pli5zs37v8co0c532pp.jpg)) buyers. The reality is that could happen again. The step backward is a bad scheme to get your hands on more types of Sonovive. 

[https://www.outlookindia.com/outlook-spotlight/sonovive-beware-of-fake-supplement-hidden-truth-you-must-know-it-news-223575 ](https://www.outlookindia.com/outlook-spotlight/sonovive-beware-of-fake-supplement-hidden-truth-you-must-know-it-news-223575 )
Setting up Domain with Namecheap & Netlify
Tags: namecheap, programming, beginners, webdev
Published: 2022-10-10 06:13:29

In this article, I would be showing how to connect a Namecheap domain to an application deployed with Netlify.

The first step is to have [Netlify](https://www.netlify.com/) and [Namecheap](https://www.namecheap.com/) accounts setup. Once that has been done, go ahead and purchase your domain on [Namecheap](https://www.namecheap.com/) and also deploy your application to [Netlify](https://www.netlify.com/).

> Note: It is assumed that you have an application hosted on Netlify and that you've also purchased your domain on Namecheap.

After purchasing your domain on Namecheap, navigate to your dashboard you should see the purchased domain there. Click on the manage button on the far right corner of the domain.


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

Navigate to your application on Netlify and click on the Domain Settings or Setup Custom Domain


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

Add your domain in the input field and click on the verify button. Netlify would try to validate the domain.


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

After adding the domain, click on the options dropdown to the right of the domain you just added, and select Set Up Netlify DNS. See example in the image below


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

Click through till you get to the point where Netlify shows a list of Nameservers. See example in the images below


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

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

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

Navigate back to Namecheap, and copy each of the DNS servers one at a time to the **NAMESERVERS** section of Namecheap. After adding them, click on the check icon to the right to save them. See example in the image below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mwz2488fr8plqdo07b3g.png)
And that's it, we're done. You would need to wait for 1–5 minutes for Netlify to propagate, after that your web page can now be accessed by the custom domain.

Netlify will issue your domain free SSL certificates, so you would not need to worry about setting up HTTPS on your own.
Laravel 8 Paypal Payment Gateway Integration
Tags: laravel, laravel8, paypal, integratrion
Published: 2022-10-10 05:54:11

In this article, we will see laravel 8 PayPal payment gateway integration. Paypal is an international payment processing gateway working in the majority of countries that support online money transfers. 

Paypal is a safer, easier way to pay around the world.​ So, we will learn how to integrate the PayPal payment gateway in laravel 8.

PayPal is an american company operating a worldwide online payments system that supports online money transfers and serves as an electronic alternative to traditional paper methods like checks and money orders. 

For this example, we are using paypal/rest-api-sdk-php package. Using PayPal you can pay online, buy now, buy online, make an online payment, transfer money online, shop online and etc.

So, let's see PayPal payment gateway integration in laravel 8.

```
Step 1: Create a new laravel 8 application

Step 2: Setup database configuration

Step 3: Install paypal/rest-api-sdk-php package

Step 4: Configure the paypal.php file

Step 5: Add route in web.php file

Step 6: Create a controller

Step 7: Create a blade file
```
PostgresSQL unit-5
Published: 2022-10-10 05:34:54

```
SELECT * FROM users ORDER BY country;
```

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




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



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

## REVERSE DATA

```
SELECT * FROM users ORDER BY country DESC;
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/klc0a10djvbln1ri4fgn.png)
2. Linux Basics
Tags: linux, centos, vm
Published: 2022-10-10 05:22:19

**- Step 1**
Install Oracle VM virtual box 6.1
https://www.virtualbox.org/

VM is an environment where we can host different systems.

**- Step 2:**
**Install ISO Centos:**
http://isoredirect.centos.org/centos/7/isos/x86_64/

**- Step 3:**
Configuration:
- Click on New
- Give any name ex. Centos
- Type: Linux
- Version: Red Hat 64 bit

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

memory size: atleast 2GB

**- Step 4:**
create a disk drive option
Hard disk file type: VDI(Virtual Disk image)

**- Step 5:**
Storage on physical hard disk: dynamically allocated

File location and size:
around 20GB


Click on Start of Centos, browse and import ISO Centos, Add.
select first option on screen as
`Install CentOS 7`

**Linux OS:**

- Open source Operating System
- software update,customization,distribution can be done in Linux.
- Free to use
- Cost of Linux is low
- Large community support

Linus Sytem: package(Deb-RPM-YUM) --repo
RPM -RedHat Package Manager
YUM - Yellow Dog Updater

**RPM**

- RPM can install only single package at a time.
- RPM cannot resolve dependencies
- cannot rollback with RPM


**YUM**

- Yum can install multiple packages at a time
- Yum can resolve dependencies automatically
- Yum can rollback any changes


Assignment: Install all dependency for making Centos full screen
https://www.youtube.com/watch?v=Eo-DjIIwPvw

Update centos

```
sudo yum -y update
```

**Hypervisor:**
A hypervisor, also known as a virtual machine monitor or VMM, is software that creates and runs virtual machines (VMs). A hypervisor allows one host computer to support multiple guest VMs by virtually sharing its resources, such as memory and processing.


**Types of Hypervisor:**
between OS and Hardware
between OS and OS

Right click -> open new terminal
Linux Commands:

- whoami

- ls(list)

`cd ~
whoami
pwd
ls
ls -l
cd Desktop
mkdir inueron
cd inueron
touch devops.txt
ls -l devops.txt
chmod 777 devops.txt 
`

User Group Other
7    7     7

Read - 4
Write - 2
Execute - 1 
4+2+1 =7 (all)

chmod 4

Login as root user
`sudo su`