teleren/devto huggingface dataset:
Short example of :has selector
Tags: css, html
Published: 2023-02-06 19:41:32

## The idea

Make a label transition from above the input to its initial position when you focus the input using :has selector


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

## Basic Form

Let's put a basic form just as an example

```
<form action="">
    <div class="form-field">
        <label for="">Name</label>
        <div class="field">
            <input type="text">
        </div>
    </div>
</form>
```

## Basic Style

I'm going to add some padding to the input, and put the label above the input

```
    input{
        padding: 5px 20px;
    }
    label{
        color:#666;
        transform:translate(.8rem, 1.5rem);
        transition:all .3s ease;
        display: block;
        pointer-events: none; 
    }
```

We are going to add `pointer-events: none;` to the label aswell to allow focus on the input since the label messes with the focus interactions

Now it looks like this


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

## **:has**

First we need to target any `<div>` sibling of `<label>`

we can use the `~` sibling combinator which targets any sibling, no matter if it is a previous or next one and along with that we can check in `<div>` has an `input:focus` as child

```
    label:has(~ div input:focus){
        transform: translate(0, 0);
    }
```

Final result

```
    input{
        padding: 5px 20px;
    }
    label{
        color:#666;
        transform:translate(.8rem, 1.5rem);
        transition:all .3s ease;
        display: block;
        pointer-events: none;
    }
    label:has(~ div input:focus){
        transform: translate(0, 0);
    }
```

If you know more about this selector and have recommendations for compatibility let me know in the comments

Some sources:
https://css-tricks.com/child-and-sibling-selectors/
https://ishadeed.com/article/css-has-parent-selector/
Kafka optimization for Streaming Market Data
Tags: kafka, optimization, productivity
Published: 2023-02-06 19:27:27

Hi All, Please help !!!!
We are currently facing latency.. Basically we are getting streaming market data from Binance and publishing into Kafka instance, According to my dev Kafka is adding an additional latency to each message up to 20/ms per msg. Please note that we are targeting to consume the msg as fast as possible within micro or nanoseconds. Please find attached my kafka config key values used for realtime: 

Topics : 
Nb partition=3 

Producer : 
Batch.size =1
linger_ms = 0
acks = 0

Consumer : 
fetch.min.bytes = 1 
fetch.max.wait.bytes ms = 0

Please advise..
Criando Testes de perfoamance com Jmeter
Tags: webdev, java, test, postman
Published: 2023-02-06 19:03:28

Aprenda como utilizar essa poderosa ferramenta para tests de performance em Java.



## JMeter na prática com exemplo completo no github
{% embed https://www.youtube.com/embed/hhycboGvwvg %}
Claim 2 AWS Certification vouchers for free
Tags: aws
Published: 2023-02-06 18:52:35

Only for women in tech, AWS offers 2 vouchers each year.

One is for the AWS Solution Architect Associate certification exam and the other is for the Cloud Practitioner one.

Feel free to apply sisters and claim these vouchers.

AWS Solution Architect Associate: https://awscloudupforher-saa.splashthat.com/

AWS Cloud Practitioner: https://awsshebuildscloudupcpe.splashthat.com/

Feel free to share this with your peers too.

-Mitul
(AWS Community Builder in Machine learning)
PHP double question marks (Null coalescing operator) explained
Tags: php, webdev, beginners
Published: 2023-02-06 18:51:01

> ✋ **Update:** This post was originally published on my blog [decodingweb.dev](https://www.decodingweb.dev), where you can read the [latest version](https://www.decodingweb.dev/php-double-question-marks) for a 💯 user experience. _~reza_

PHP double question marks (`??`) – officially known as _Null coalescing operator_ – is a convenient alternative to ternary expressions in conjunction with `isset()`.

You might have seen the following expression in your Laravel or PHP projects:

```php
<?php

$result = $value ?? $alternativeValue;
```

But what do two question marks mean in PHP?

The above expression returns its first operand (`$value`) if it exists and is not `null`; otherwise, it returns the second operand (`$alternativeValue`).

The above expression is equivalent to:

```php
<?php

$result = isset($value) ? $value : $alternativeValue;
```

## How to use PHP double question marks

Before the Null coalescing operator, you'd have to use a ternary operator with a call to `isset()`:

```php
<?php

$iceCreamFlavor = isset($_POST['flavor']) ? $_POST['flavor'] : 'vanilla';
```

Or as an `if` statement:

```php
<?php

$iceCreamFlavor = 'vanilla';

if (isset($_POST['flavor'])) {
  $iceCreamFlavor = $_POST['flavor'];
}
```

But with the Null coalescing operator, you can summarize it into:

```php
<?php

$iceCreamFlavor =$_POST['flavor'] ?? 'vanilla';
```

You can also chain multiple operators:

```php
<?php

$display_name =  $first_name ?? $last_name ?? 'Anonymous';
```

The above code will return the first defined value among `$first_name`, `$last_name`, and `Anonymous`.

The Null coalescing operator has been added to PHP since version 7.

I hope you found this quick tip helpful :-)

Thanks for reading!

---

**❤️ You might like:**

- [How to remove the last character from a string in PHP](https://www.decodingweb.dev/php-remove-last-character-from-string)
- [How to become a web developer when you have no degree](https://www.decodingweb.dev/how-to-become-a-web-developer)
- [Do you need to know CMS as a back-end developer?](https://www.decodingweb.dev/cms-knowledge)
- [How back-end web frameworks work?](https://www.decodingweb.dev/backend-web-frameworks)
- [Your master sword: a programming language](https://www.decodingweb.dev/your-master-sword-a-programming-language)
- [What do back-end developers do?](https://www.decodingweb.dev/what-do-back-end-developers-do)
Why Reactjs Hooks Are Essential for Modern Web Development
Tags: webdev, react, javascript, beginners
Published: 2023-02-06 18:46:00

##Introduction
React is one of the very popular javascript Library. It is developed by Facebook and is Facebook's first open source projects maintained by its vast community.

It was released with OOP and functional programming paradigm. In it's initial days the dominating paradigm was OOP or say class based components. Maybe due to _increase in popularity and ease of functional programming_ react team developed hooks to make functional way of programming more powerful.

> With Hooks, you can extract stateful logic from a component so it can be tested independently and reused. Hooks allow you to reuse stateful logic without changing your component hierarchy. This makes it easy to share Hooks among many components or with the community.

React has around 10-15 [built in hooks](https://beta.reactjs.org/reference/react). Out of which generally 6-7 comes handy during development of any application with reactjs 😅.

Hooks in react has replaced the lifecycle methods, and so the class components from react (Hooks don't work inside classes). Despite of 10-15 built-in hooks you can make your own **custom hooks** which can be used in your application at various places honouring the DRY (Do not Repeat Yourself) principle.

##Rules to make Custom hooks
There are rules to be followed before/while making the custom hook.

- Only call Hooks at the top level. Don't call Hooks inside loops, conditions, or nested functions.
- We have to use "use" keyword infront of name of hook.
- Only call Hooks from React function components.
- Don't call Hooks from regular JavaScript functions.

find the concept of hook in many other libraries used with react, as in `react-router-dom` , `redux-toolkit` etc.

##What are react hooks?

Hooks are superpower for functional components which are functions that let you “hook into” React state and lifecycle features from function components. they let you use React without classes.

With hooks you can store you state data for a particular component, you can perform side effects like API calls, setTimeout, and DOM manipulation (with hooks like `useRef`) and many other things which helps you to keep the application work smooth and faster.

##How much to use hooks?

If react has given the superpower it doesn't mean that You will use it as much as you want. Remember a thumb rule in react

> Lesser the number of re-renders, Faster the app will work.

So before declaring any hook think, if it can work without using the hook. Component hierarchy also matters lot when it comes to where to declare/use a hook in a project.

before starting to learn react or even after having a experience in working with react [this page](https://beta.reactjs.org/learn/thinking-in-react) from its docs is worth going through.

Stay happy, Keep your surroundings clean,
Signing off Meet Bhalodiya,

Peace ✌
Visualize data in Amazon RDS for Microsoft SQL Server using Amazon QuickSight
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-02-06 18:44:57

[37/100] #100DaysOfCloud Today, I created a sample Amazon RDS instance on an MS SQL engine, and connected the data for visualization using Amazon QuickSight.

In this, I created a MS SQL database instance in RDS and using Microsoft SQL Server Management Studio, I connected into the database and created a database and added queries to it to create the necessary data. The RDS BD instance was made public to do this and once it is created, it is made not publically accesssible.

Then the necessary security groups are created for the QuickSight to access the RDS instance as well as for the RDS to connect to QuickSight.

Later, I connect create a VPC connection and create a dataset from the data in the RDS DB and then use the dataset to visualise the data in QuickSight.

You can try do it by yourself by following the steps from the link below: [GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/037/Readme.md)
Web Performance Optimisation Techniques for Frontend Developers
Tags: webdev, webperf, javascript, performance
Published: 2023-02-06 18:37:23


As frontend developers, creating fast and responsive web applications is crucial to providing a positive user experience. Web Performance Optimization (WPO) involves making changes to the design and code of a website or application to reduce its load time and improve performance.

In this article, we'll explore some of the most effective WPO techniques for frontend developers.

###Minimizing HTTP Requests
One of the biggest factors that affects web performance is the number of HTTP requests a page makes. Each request takes time to complete, so reducing the number of requests can significantly improve the page's load time. Here are a few techniques for reducing HTTP requests:

- **CSS Sprites**: A CSS sprite is a single image that contains multiple images used on a website. By using a single image, the number of requests made is reduced.
- **Inline Images**: By including small images directly in the HTML code, you can eliminate the need to make separate requests for each image.
- **Combined Files**: Instead of linking to multiple CSS and JavaScript files, combine them into a single file. This reduces the number of requests made to the server.


###Minimizing Data Transfer
Reducing the amount of data transmitted between the server and the browser can also have a significant impact on web performance. Here are a few techniques for minimizing data transfer:

- **Compression**: Compressing files before they're sent to the browser can greatly reduce the amount of data that needs to be transferred.
- **Minification**: Minifying code removes unnecessary characters such as white space and comments. This can greatly reduce the size of files.
- **Code Splitting**: Dividing code into smaller chunks that can be loaded on demand, instead of loading everything at once, can help minimize data transfer.


###Improving Rendering Performance
The way a browser renders a page can also have a significant impact on web performance. Here are a few techniques for improving rendering performance:

- **Lazy Loading**: Lazy loading is a technique where images or other elements are only loaded as needed, rather than all at once. This can improve rendering performance by reducing the amount of data that needs to be processed.
- **Optimizing Images**: Properly optimizing images, such as using the correct image format and compressing images, can significantly improve rendering performance.
- **Reducing the Use of JavaScript**: JavaScript is a powerful tool, but it can also be resource-intensive. Reducing the amount of JavaScript used on a page can improve rendering performance.


In conclusion, Web Performance Optimzation is a crucial aspect of frontend development. By applying the techniques discussed in this article, you can significantly improve the performance and user experience of your web applications.
AWS Cloud Quest: Continuous Delivery Pipeline Study Note
Tags: aws, cloud
Published: 2023-02-06 18:37:14

This is the DIY challenge of the Continuous Delivery Pipeline in AWS Cloud Quest.

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



### DIY Steps:
1. Edit `sam-app-pipeline` CodePipeline
2. Add stage between `Build` and `Deploy`
3. Add `Manual_Approval` stage
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eogyap8z8ek4v7egmu4w.png)
4. Save -> Release change
Smart use of “if/else”
Tags: cleancode
Published: 2023-02-06 17:38:49

---
title: Smart use of “if/else”
published: true
description: 
tags: cleanCode
# cover_image: ![Iran, Shiraz, Nasir al-Mulk](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9gjkf1w7x7lkue12gmlr.jpeg)
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-06 17:12 +0000
---

Actually, this article is not against the `if/else` but tries to show how following an anti-if pattern will improve your code quality. First thing first, I think we have to know how to use `if/else` could be improved your code quality in terms of reading(readability) and hard to debug(maintainability)
There are pretty many articles on the internet that lead you to prevent using `if/else` and [being an Anti-If developer](https://francescocirillo.com/products/the-anti-if-campaign).

In some cases using shorthand `if/else` might also be helpful because it avoids branching your code which costs more in terms of complexity.
For instance in this case you can get rid of `else` just by `return` there is no code branching too:

![No code branching](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g6s1ytj5mxh8cbds4f4f.png)

### Ternary Operator (?:)
If you want to shorten If/else and in this case `else` part is mandatory, you can use `?:` operator as:

```
condition ? action-on-true : action-on-false(else)
// For instance
const gender = isMale ? 'Male' : 'Female';
```

I see this kinda short hand format used for null/undefined checking like:

```
const avatarName = user.firstname ? user.firstname : user.lastname;
```
However in this case you can simply use:
```
const avatarName = user.firstname ?? user.lastname
// or depends on your case you can use  "||"
const avatarName = user.firstname || user.lastname
```
###Logical Operator (&&)
In another case, if you have only `if` condition you can use `&&` operator as:

```
condition && action;
// For instance
!this.settings && (this.settings = new TableSettings());
```
You can also use polymorphism to avoid using `if/else` like as an example below which is really more readable/maintainable, Here is the code :
![no polymorphism](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cckoap29w10bx0tdmget.png)

And then it can be implemented by polymorphism:
![polymorphism](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rnz9cezi3biebfl2nm3d.png)

###Conslusion:
I hope it did help but anyway in order to write a code that is reliable we have to apply best practices.
XYZ Lab - Make every marketing dollar you spend smarter
Tags: analytics, seo, google
Published: 2023-02-06 18:14:47

A leading digital marketing training platform for industry professionals. Our mission is to train and upskill the next generation of digital marketing leaders. 

We empower digital marketers with the knowledge and tools they need to make every dollar spent on marketing smarter.

Born in London, matured in Dubai, and perfected in Singapore, XYZ Lab is a unique breed of digital consulting infused with ideas from around the world.

[https://www.xyzlab.com](https://www.xyzlab.com)
Using JavaScript slice() in React
Tags: react, javascript, tutorial, webdev
Published: 2023-02-06 18:11:04

React is a JavaScript library for creating user interfaces that frequently involves manipulating data arrays. The `slice()` method in JavaScript can be useful for extracting a portion of an array and returning a new one, which can be useful in a variety of situations.

## Understanding the JavaScript slice() method

The `slice()` method is used to extract elements from an array based on the indexes at the beginning and end. It returns a new array containing the extracted elements while leaving the original array unchanged. The slice() syntax is as follows:

```js
array.slice(start, end)
```

- `start`: The index from which to start extraction. If start is negative, counting will begin at the end of the array.
- `end`: The index at which extraction should be terminated. If end is not specified, slice() will extract the remainder of the array. If end is negative, it will cease counting from the array's end.

In React, you can use the `slice()` method to extract elements from an array before passing it down as props to a child component. This can be useful for displaying a portion of the data, such as pagination or a limited number of items per page.

## Example

Here's an example of how you might use `slice()` in a React component:

```jsx
import React from 'react'

const ItemsList = ({ items }) => {
  const slicedItems = items.slice(0, 10)

  return (
    <ul>
      {slicedItems.map((item) => (
        <li key={item.id}>{item.name}</li>
      ))}
    </ul>
  )
}

export default ItemsList
```

`ItemsList` is a functional component in this example that gets an array of items as props. By using `slice() `on items, we extract the top ten elements and provide the resulting array slicedItems to the component.

## Conclusion

In React, the JavaScript `slice()` function can be handy for removing a part of an array. You may increase the efficiency of your application and make your code more legible by using `slice()` to extract the essential data. You now have a strong knowledge of how to utilise `slice()` in React thanks to this article.
Question: How to display Python output on a webpage with Node.js?
Tags: javascript, webdev, python, backend
Published: 2023-02-06 18:00:28

Hi all, 

First of all, I would like to apologize for my question if it is not allowed to post questions on this website, then I have not seen and read in the code of conduct that to post a question is not allowed to. 

Can someone please assisst me to resolve the issue with displaying a python output on a webpage with node.js using modules Python-Shell and express?  I am novice in back-end 
Codes:
`// routes file table.js
router.get("/", function (req, res, next) {
  const test = py.PythonShell.run("pyextc.py", null, (error, res) => {
    if (error) throw error;
    return JSON.stringify(res);
  });
  res.render("table", { python: { ...test } });   <<<--- I assume the issue lies here which I could not figure out.  
});

module.exports = router;

// table.ejs
&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Test Python output&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1>Python output Api</h1&gt;
    &lt;pre&gt;&lt;code&gt;&lt;%= python %&gt;&lt;/code&gt;&lt;/pre&gt;
    &lt;div&gt;&lt;%= python %&gt;&lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
<br />
// pyextc.py
print("Hey, I am Python displaying on a table webpage running from Back-End.")
`
The code above display on the webpage this output:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0564milzst22gbjoeyzu.png)

Although if you run this code:
`async function PyFile() {
   try {
     const test = await py.PythonShell.run("pyextc.py", null, (error, res) => {
       if (error) throw error;
       console.log(res.toString());
     });
   } catch (error) {
     console.log(JSON.stringify("Gotcha error " + error));
   }
 }
 PyFile();
`
The python output displays on the console, and if its working on console, it should also be working on a webpage, but thought as a novice - it does not return python output.  

Thanks in advance for any hints and advise. 

Best regards,
Kanatbek
What is globus bank code
Published: 2023-02-06 17:55:19

[https://www.bankfanz.com/globus-bank-transfer-code/](https://www.bankfanz.com/globus-bank-transfer-code/#utm_source=backlinks&utm_medium=search&utm_campaign=darry+ring+us&utm_content=Michelle)

https://plaza.rakuten.co.jp/globusbankcode1/diary/202302060000/
https://peatix.com/user/15840669/
https://www.provenexpert.com/what-is-globus-bank-transfer-code-202310/
https://www.producthunt.com/@globusbank10
https://www.divephotoguide.com/user/globusbankcode10
https://wakelet.com/@Whatisglobusbanktransfercode2023195
https://vocal.media/authors/what-is-globus-bank-transfer-code-2023-tmfys0lcs
https://www.lifeofpix.com/photographers/globusbankcode10/
https://seedandspark.com/user/what-is-globus-bank-transfer-code-2023-9
https://rosalind.info/users/globusbankcode10/
http://phillipsservices.net/UserProfile/tabid/43/userId/197725/Default.aspx
https://app.roll20.net/users/11600671/what-is-globus-bank-transfer-code-2
https://speakerdeck.com/globusbankcode10
https://social.msdn.microsoft.com/profile/what%20is%20globus%20bank%20transfer%20code%202023%2010/
https://camp-fire.jp/profile/Globusbankcode10
https://plazapublica.cdmx.gob.mx/profiles/globusbankcode10/activity
https://www.metal-archives.com/users/globusbankcode10
https://storium.com/user/globusbankcode202310
https://trabajo.merca20.com/author/globusbankcode10/
https://www.intensedebate.com/people/Globusbankcod10
https://www.mifare.net/support/forum/users/globusbankcode10/
https://pinshape.com/users/2568970-globusbank10
http://foxsheets.com/UserProfile/tabid/57/userId/120094/Default.aspx8
https://www.kompasiana.com/globusbankcode10
https://www.credly.com/users/what-is-globus-bank-transfer-code-2023.2d05cdd2/badges
https://www.myminifactory.com/users/globusbankcode10
https://www.sqlservercentral.com/forums/user/globusbank10
https://www.longisland.com/profile/globusbankcode10
https://guides.co/a/what-is-globu-2979
https://myanimelist.net/profile/globusbankcode10