teleren/devto huggingface dataset:
Reviewing the Air BnB React/JSX Style Guide: 1. Basic Rules
Tags: airbnb, styleguide, jsx, react
Published: 2022-10-29 18:04:26

I love Air Bnb - not only is their app amazing (I love looking at the unique hosting spots [like this home suspended from a cliff overhang in Kentucky](https://www.airbnb.com/rooms/47114758?adults=1&category_tag=Tag%3A8225&children=0&infants=0&search_mode=flex_destinations_search&check_in=2022-11-13&check_out=2022-11-18&previous_page_section_name=1000&federated_search_id=6670aa84-8757-41b9-b4aa-39a398b3c51b)), but I also love their style guide and keep it handy every time I write code. I would be fair to say that Air BnB would be my dream job. 

I thought it would be fun to review each of their style guide rules for React/JSX each day. It's a good review to do and also allows one to meditate upon it's meaning. I find this as a useful way to really nail down good practices. 

## Day 1: Basic Rules
Here are the basic rules laid out by Air BnB

- Include only one React component per file. Except for Stateless, or Pure, Components - they allow multiple per file.
 - Set eslint: `react/no-multi-comp`

- Always use JSX syntax.

- Don't use `React.createElement` unless you're initializing an app from a file that is not JSX.

- `react/forbid-prop-types` will allow `arrays` and `objects` only if it is explicitly noted what they contain, using `arrayOf`, `objectOf`, or `shape`.

## That's all for the basic rules! See you tomorrow

So that's not too bad right? I will meditate upon those and think about what that means for my code. 


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

"Oooohhhhhhhhhmmmmmmmmmmmmm..."
"Oooohhhhhhhhhmmmmmmmmmmmmm..."
"Oooohhhhhhhhhmmmmmmmmmmmmm..."
...............
Day 0 of Reading React Code
Tags: react, javascript, opensource, webdev
Published: 2022-10-18 19:07:47

I learn from ground up. I can't say that I fully learned something without actually understanding the fundamentals and inner working of anything.

I come from a Physics background. When Physicists find something they don't just sit and use what ever they find. They leave that task to the engineers and go find how the tool works and why it works the way it works.

As you can see my mindset really applies to physics. But I am idiot and dropped out of college and now I am trying to be a "PROGRAMMER". I can say that I am "typical" programmer who can code stuff. But it gives me zero satisfaction. I want more, I want to have this mind map where I can understand what's going on.

So, I started reading the React source code on [github](https://github.com/facebook/react/). 
*BTW if you add 1s at the end of github domain(github1s.com), the code will open in a web version of vscode*

**I can't understand a single thing in the codebase**(I mean I can see what is going on  which a kindergartener can do 😉 but I can't figure out why). Then I decided to search for awesome people who tried to do it before me and I found this [ReactJS under the hood](https://bogdan-lyashenko.github.io/Under-the-hood-ReactJS/stack/book/Intro.html). This is awesome(even though I haven't read it yet).

That's all for today and maybe see you tomorrow, if I don't go crazy trying to understand react.
supplements
Tags: webdev
Published: 2022-10-29 17:27:36

Who better to take care of your health than yourself?  One of the main reasons for the surge in consumer interest in THCV concentrates [url]https://valhallavitalityshop.com/blogs/news/buy-thcv-online-in-valhalla-vitality-shop[/url] is the possibility that they may improve mood and enhance one's ability to concentrate on certain activities. THCV concentrate has attracted worldwide attention, although more research is needed to prove that it is useful for improving concentration and mood.
write function that provides change directory with javascript
Published: 2022-10-29 17:17:27

```
function cd(a, b) {
    var a_path_arry = a.split('/');
    var a_clear_path = [];
    var b_clear_path = [];
    a_path_arry.map((ele) => {
        if(ele != '') a_clear_path.push(ele);
    });
    b_path_arry = b.split('/');
    b_path_arry.map((ele) => {
        if(ele != '') b_clear_path.push(ele);
    });
    b_path_length = b_clear_path.length;
    for(var i=0;i<b_path_length;i++) {
        if(b_clear_path[i] == '.') {
            continue;
        } else if(b_clear_path[i] != '..') {
            a_clear_path.push(b_clear_path[i])
        }  
        else {
            a_clear_path.pop();            
        }
    }
    var path = '';
    a_clear_path.map((ele)=> {
        path += ele + '/';
    });
    console.log(path);
}

cd('a/b/c', './//d/e');
```
How to create a Windows VM and Install a Web Server
Published: 2022-10-29 16:01:30

Hands-On Lab on Creating the Azure VM (Windows Server 2019)
There are 3 primary steps in creating the Azure VM (Linux (ubuntu 20.04).

Create virtual machine in the Azure Portal + Configurations
Test the Connection
Install Web Server & View the Web Server in Action

1. Create virtual machine in the Azure Portal + Configurations
Go to your Azure Portal. Now, on your left-hand side, click “Virtual Machines”. If this is your first time creating VMs, then you will not see any instances running. Proceed “Create Virtual Machine”.


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


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

For “Project Details”, make sure the correct subscription is selected.

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

In administrator account, provide the admin username for the VM and password.
Make sure you select HTTP for web access

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

Then, I will leave the rest of the configurations by default. Proceed “Review + Create”. Wait until the deployment is successful.

Note: Make sure it passes Validation

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

Congratulations!!! You just created a Virtual Machine

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

#Install Web Server
Download the RDP File

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

Launch RDP File and connect with Windows credentials
Once Successful, Launch the PowerShell Application (Run as Administrator) and Install the web server with the commands below

```
Install-WindowsFeature -name Web-Server -IncludeManagementTools
```

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


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

After successfully installing the server, Launch the Public IP Address from Azure on a Browser


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

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

Share and Like
Navbar with background blur! Aesthetic look in 2 lines of code .
Tags: webdev, javascript, html, programming
Published: 2022-10-29 17:14:58

The one thing I always do when I begin a project is to add a navbar with **background blur**. Just got obsessed with it.

My Personal Website. [View ](https://shrihari-portfolio.vercel.app/)
![Personal Website](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hn9r9x3h2a8qxlpn5mmc.gif)

PvZ2[PlantsVsZombies](https://pvz-2-api.vercel.app/)

![Open source Contibution.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wmle38osjalpvpksui7.gif)

---

We will see how to do this in your website too! Just add this to your navbar container.

```css
.bg-blur {
  background: transparent;
  backdrop-filter: blur(10px);
}
```

#Code Review

`background: transparent;` - If you are having background color make sure you **remove color** and add this. This is what allows the **background content to be visible** on the navbar.

`backdrop-filter: blur(10px);` - This creates that smooth transition of navbar over background with that blur. Play with that values. `10px` works good for me.

For more information. [MDN Docs
](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#browser_compatibility)
![Browser Compatability](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0sdlgqxbt51i2y2ag9i2.png)

_Peace 🕊_

---

If you are here it means you may have enjoyed reading this blog. Just follow me @shrihari which will motivate to write more, contribute open source.

You can make a drink [Buttermilk 🥛](https://www.buymeacoffee.com/shriharimohan). Small support comes a long way!

Subscribe If you want to receive these blogs in your mail from @[Medium](https://medium.com/@shriharimohan) for free!

## Try Our new product for free!
[DocsAI](https://docsai.app/) - Create AI support agents with your documents in the most affordable price, starts at **0$**. Don't need a bot , but need ai help on your docs just upload and start chating !

Using for a company ? [Check out our pricing](https://docsai.app/pricing) Just contact me for personalized pricing !

![docsAi](https://firebasestorage.googleapis.com/v0/b/shrihari-personal-storage.appspot.com/o/banner-docs-jpeg.jpeg?alt=media&token=45c47666-de2a-4e02-8881-beb6e43ce581)

{% embed https://dev.to/shrihari/the-chrome-dev-tool-you-are-missing-feat-recorder-4ao5 %}

{% embed https://dev.to/shrihari/two-things-that-make-my-terminal-experience-awesome-in-mac-3eie %}

{% embed https://dev.to/shrihari/colors-design-inspiration-websites-for-new-comers-1lcb %}
user is not allowed to do action [insert] on [nodeMongoCrud.use]
Published: 2022-10-29 16:56:03

এই এররটা অনেকে ফেইস করতেছেন আজকে।
এইটা সমাধান করার জন্য প্রথমে আপনি mongodb তে লগইন করবেন। তারপর সাইডবার থেকে Database Access অপশান সিলেক্ট করবেন।


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

এরপর, সেখান থেকে আপনি যে ইউজারটি ব্যাবহার করছিলেন সেটির পাশে Edit বাটনে ক্লিক করবেন। আমি ধরে নিলাম ইউজারের নাম dbUser2.

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

এরপরে যে মোডালটি আসবে সেটিতে স্ক্রল করে নিচে চলে গেলে একটি অপশন পাবেন "Built-in Role" লিখা। 

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

এই accordion আইটেমে/ অপশানে ক্লিক করে "Add Built In Role" বাটনে ক্লিক করে , এরপর "Select Role" ড্রপডাউনে ক্লিক করেন। সেখান থেকে "Atlas Admin" বা "Read and write to any database" সিলেক্ট করেন। তারপর নিচে "Update User" বাটনে ক্লিক করে আপডেট করে নিন। এরপরে সার্ভার সাইডের টার্মিনাল আবার চালু করে দেখন nodemon index.js কমান্ড দিয়ে। 



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


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


আশা করি সমাধান হয়ে যাবে। না হলে আমাদের সাপোর্ট সেশনে যোগাযোগ করবেন।
Run Jupyter notebook in any location
Tags: jupyter
Published: 2022-10-29 16:43:46

First go to the folder where you want to open the jupyter notebook. 

Then 

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

Clear the folder location and type `cmd`

in the cmd, type `jupyter notebook`

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pic02bvcra80ha9slhkr.png)
The Notebook will be open now.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7jq1sf9vwco0x028fvsc.png)
Code Smell 174 - Class Name in Attributes
Tags: javascript, webdev, beginners, programming
Published: 2022-10-29 16:27:21

*Redundancy in names is a bad smell. Names should be contextual*

> TL;DR: Don't prefix your attributes with your class name

# Problems

- Not Contextual Names

# Solutions

1. Remove the class prefix from the attribute

# Context

This is a naming smell, we should not read attributes in isolation and names are contextual.

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/a826cc57021603442286f8c40d6981a2)
```java
public class Employee {
   String empName = "John";
   int empId = 5;
   int empAge = 32;
}
```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/60f3381be1d06def7f68419ec2776b3a)
```java
public class Employee {
   String name;
   int id; // Ids are another smell
   int age; // Storing the age is yet another smell
}
```

# Detection

[X] Semi-Automatic 

When the full name is included in the prefix, our linters can warn us.

# Tags

- Naming

# Conclusion

Careful naming is a very important task.

We need to name after the behavior, not type or data

# Relations

{% post https://dev.to/mcsee/code-smell-141-iengine-avehicle-implcar-58ch %}

{% post https://dev.to/mcsee/code-smell-96-my-objects-5cij %}

# More Info

{% post https://dev.to/mcsee/what-exactly-is-a-name-part-ii-rehab-20gd %}

- [Linux Hint](https://linuxhint.com/java-class-attributes/)

# Disclaimer

Code Smells are just my [opinion](https://dev.to/mcsee/i-wrote-more-than-90-articles-on-2021-here-is-what-i-learned-1n3a).

# Credits

Photo by [Phoenix Han](https://unsplash.com/@phienix_han) on [Unsplash](https://unsplash.com/s/photos/mushroom)
  
* * *

> Copying skips understanding. Understanding is how you grow. You have to understand why something works or why something is how it is. When you copy it, you miss that. You just repurpose the last layer instead of understanding all the layers underneath.

_Jason Fried_

{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}
R: Calculating averages
Tags: r, datascience
Published: 2022-10-29 15:57:31

To calculate the average of a value we can use `summarise` from the `dplyr` package. 

```
library(dplyr)
```

```
mtcars %>%
  summarise(average_mileage = mean(mpg))
```

mpg stands for miles per gallon. This gives us the average mileage of all the cars. 

If we want to get averages for each cylinder type, then we can use the `group_by` function to separate the averages for each group.

```
mtcars %>%
  group_by(cyl) %>%
  summarise(average_mileage = mean(mpg))
```
AWSome October, from Amazon File Cache to Skyplane
Tags: aws, beginners, serverless
Published: 2022-10-29 15:49:53

As an editor for [InfoQ](https://www.infoq.com/profile/Renato-Losio/), every month I follow and (try to) cover the most interesting news in the cloud space. From Amazon File Cache now GA to data transfer with Skyplane, below are the  announcements and news in the AWS space that caught my attention in October. You can read the full articles on InfoQ.

**AWS Introduces AWS Parameters and Secrets Lambda Extension to Improve Performances and Security**

AWS announced [the Parameters and Secrets Lambda Extension](https://www.infoq.com/news/2022/10/aws-parameters-secrets-lambda/?itm_source=infoq&itm_campaign=user_page&itm_medium=link), a new way for developers to retrieve parameters from Systems Manager Parameter Store and secrets from Secrets Manager. The Lambda extension caches parameters and secrets, reducing latency and costs.

**AWS Lambda Supports Event Filtering for Amazon MSK, Kafka and Amazon MQ**

Amazon announced that [AWS Lambda supports content filtering options](https://www.infoq.com/news/2022/10/aws-lambda-event-filterting/?itm_source=infoq&itm_campaign=user_page&itm_medium=link) for Amazon MSK, Self-Managed Kafka, Amazon MQ for Apache ActiveMQ, and Amazon MQ for RabbitMQ as event sources. The new options extend the filtering to data store and broker services and reduce traffic to Lambda functions, simplifying application logic and reducing costs.

**Open Source Skyplane Targets Faster and Cheaper Data Transfers between Clouds**

A team of researchers at the RISELab at UC Berkeley has [released Skyplane](https://www.infoq.com/news/2022/10/skyplane-data-transfer-cloud/?itm_source=infoq&itm_campaign=user_page&itm_medium=link), an open source tool to optimize the transfer of large datasets between cloud providers, reducing transfer times and costs.

**Amazon File Cache Now Generally Available**

Amazon announced the [general availability of File Cache](https://www.infoq.com/news/2022/10/amazon-file-cache/?itm_source=infoq&itm_campaign=user_page&itm_medium=link), a managed high-speed cache for processing file data stored in disparate locations. The new service can be linked to multiple sources including on premises network file systems and managed AWS services like Amazon FSx or S3.


**Interactive Query Service Amazon Athena Introduces New Engine**

AWS announced [version 3 of the engine for Amazon Athena](https://www.infoq.com/news/2022/10/amazon-athena-engine-3/), the serverless interactive service to query S3 data using standard SQL. The cloud provider claims that the new engine improves performance and supports new use cases thanks to over 50 new SQL functions and 30 new analytics features

To read my other articles on InfoQ, [follow me](https://www.linkedin.com/in/rlosio/).
Useful Minor Python Projects. Easy to Understand :)
Tags: programming, python, beginners, codenewbie
Published: 2022-10-29 15:48:31

## 1.Auto Capture Screenshot And save

```
import pyautogui
import time

i = 1
n = 1
while i < 10000:
    #this Pics Will Save Your Desktop
    pg = pyautogui.screenshot('screenshot{}.png'.format(n))
    i=i+1
    n=n+1
    time.sleep(10)
```

- `import pyautogui` this program needs pyautogui package, you can easily install this Package by `pip install pyautogui` running this command on Your CMD.


- `pg = pyautogui.screenshot()` in this line assigning `pyautogui.screenshot()` function to pg variable.

## 2.Send Mail Using Python (smtplib)

```
import smtplib

server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login("your username", "your password")
server.sendmail(
  "from@address.com", 
  "to@address.com", 
  "this message is from python")
server.quit()

```
- `import smtplib` this program needs smtplib package, you can easily install this Package by `pip install smtplib` running this command on Your CMD.


> smtplib.SMTPAuthenticationError: Please log in via your web browser and then try again. Learn more at https://support.google.com/mail/answer/78754

-if You Got this error, there is nothing wrong with the code.You can fix this issue by navigating [google less secure app access](https://myaccount.google.com/lesssecureapps) and allowing less secure apps.

**_More Projects Updating Soon_**
About Spring Boot Native Images
Tags: java, native, spirngboot, docker
Published: 2022-10-29 15:26:28

I was recently impressed by Spring Boot's native images feature. I considered sharing some information about native images.

I created two simple Spring Boot projects
1) spring-with-native-plugin
2) spring-without-native-plugin

Apart from the Main class, I used the same controller in both projects.

![Hello World Controller](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mdiliu6koh6qpqdbt8er.png)

I used the following command to create docker images.

```sh
mvn spring-boot:build-image 
```
(Both projects are based on maven)

When I ran both docker images, I was surprised by the application startup time.

![Spring-Without-native](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9cn3yicwk6cru6rx0kqs.png)

![Spring-with-native](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/emb7o2ks243xvem3wept.png)

There's also a significant difference in the sizes of the two Docker images.

![memory-deference](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3ksxmmsmvojq5huxgy7.png)

So, What happened after we installed the native plugin?

* Thanks to Spring AOT Process, it performed a code analysis to identify unnecessary code.
* After the code analysis, all unnecessary code was removed, and a native image was created.

Now, This native image is **no longer dependent on the JVM** and can run without the JVM.

We must thank @graalvmfor making this all possible.
Paracetamol.test.js🧪| #8: Testea este código JavaScript
Tags: javascript, spanish, webdev, testing
Published: 2022-10-29 14:55:45

## **<center>Testea el siguiente código JavaScript</center>**
#### <center>**Dificultad:** <mark>Básico</mark></center>

```js
//arr.test.js
const sum = (arr) => {
  return arr.reduce((currrent, item) => {
    return currrent + item;
  }, 0);
};

test("[1,2,3,4,5] => regresa max 15", () => {
  const value = sum([1, 2, 3, 4, 5]);
  expect(value).toBeGreaterThan(3);
  expect(value).toBeGreaterThanOrEqual(15);
});
```

A. `toBeGreaterThan() y toBeGreaterThanOrEqual() no pansan los test`
B. `Solo toBeGreaterThan() pasa los test`
C. `Solo toBeGreaterThanOrEqual() pasa los test`
D. `Ambos pasan los test`

Respuesta en el primer comentario.


---
Share code snippets instantly in vs code
Tags: webdev, programming, productivity
Published: 2022-10-29 14:50:39

Hi Devs,

We just released vs code extension to share code snippets instantly. No more switching of windows and copy paste while coding and trying to share code with colleague, do it inside VS CODE🔥

![Share code snippets gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tse2g6msdbzwr7eeni2w.gif)

If you are using vs code then don't forget to checkout this vs code extension - [share code snippets](https://marketplace.visualstudio.com/items?itemName=RahulKumarSingh.share-code-snippets)

**Here is how to use this extension:**

Highlight the code you want to capture, and run the share code snippet extension. You'll be redirected to [goonlinetools share code snippets](https://dev.to/goonlinetools/share-code-snippets-easily-with-your-friends-2hci) with your selected code populating the textarea.

If you have any questions or suggestion please comment below.
Convert enum to string literal union type in TS
Published: 2022-10-29 14:40:44

Hello everyone, this is a quick tutorial, In my work, I wanted to avoid duplicating code as I can and abstract things for example if I use an **enum** named Weekdays and it contains the following data:

```
enum Weekdays = {
    MONDAY = 'mon',
    TUESDAY = 'tue',
    WEDNESDAY = 'wed'
}
```
Let's say you want to create a type called WeekdayType which should contain 'mon' | 'Tue' | 'Wed', how we can do this? Starting from version 4.1 you can do a tricky thing to do it in a single line of code, let's see it.
```
type WeekdayType = `${Weekdays}`;
// WeekdayType = 'mon' | 'Tue' | 'Wed'|
```

Congratulations, you did it! Awesome, right?
Exipure - Shocking Results, Price, Pros, Cons, Scam Or Legit?
Tags: javascript, webdev, beginners, programming
Published: 2022-10-29 14:37:58

[Exipure](url) there are many people of which are overweight. As Americans we look for magic pill solutions to permanent fat burning. This leaves open a gigantic marketplace for unscrupulous weight reducing supplement insurance providers. These companies are out to generate a quick buck and you might want to watch on the internet. Here are things you should know about [](https://www.outlookindia.com/outlook-spotlight/exipure-danger-reveal-weight-loss-ingredients-shocking-truth-you-must-check-it-news-233096/)
https://soundcloud.com/exipure-631108481/exipurefacts
https://kdskhdnya.wixsite.com/my-site
https://www.pinterest.com/pin/955748352146909195/
https://www.facebook.com/profile.php?id=100087271483119
https://www.scoop.it/topic/exipure-fact
https://twitter.com/exipurefacts
https://tautaruna.nra.lv/forums/tema/48912-exipure-shocking-results-price-pros-cons-scam-or-legit/
https://www.launchora.com/story/exipure-side-effects-ingredients-benefits-for
https://minimore.com/b/z3s8a/1
https://www.sportsblog.com/exipureresult/