teleren/devto huggingface dataset:
Laravel 9: New Helpers!
Tags: laravel, laravel9, php, webdev
Published: 2022-01-25 06:25:59

Soon, Laravel 9 wil release and there are some new features that we can use them. 

This series is going to be a sequel about Laravel framework version 9 and in each article we will review a new feature!

### 1. str()

A new useful helper in Laravel 9 is `str()`. This function will return a new `Stringable` (`Illuminate\Support\Stringable`). We had this method on `Str` class and now it is more easier to use. eg:

``` php

$name = str('Reza')->append(' Khademi'); // 'Reza Khademi'

$snake = str()->snake('LaravelFramework'); // 'laravel_framework

```
We should know, if no argument passed to this function it will give us a new instance of `Illuminate\Support\Str`.

### 2. to_route()

If we want to redirect user to a specific route, this will come handy:

``` php

return to_route(
   'users.show',
   ['user' => 1],
   302,
   ['X-Framework' => 'Laravel']
);

```
we can pass the route name as the first, our desired data as the second and additional response headers as the third and fourth arguments to the `to_route()` method.

### PHP 8 String Functions

Since PHP 8, `str_contains()`, `str_starts_with()` and `str_ends_with()` functions moved in to the `\Illuminate\Support\Str` class.
CSS Pseudo-classes: Other states
Tags: css, beginners
Published: 2022-01-25 06:13:22

This is the last series in the CSS pseudo-class exploration.
These are pseudo-classes that did not fit any of the previous categories.

I've split this up into a series of four, where this is the last part about other pseudo-states.

The other parts:

- [Link pseudo-states](https://daily-dev-tips.com/posts/css-pseudo-classes-links/)
- [Form pseudo-states](https://daily-dev-tips.com/posts/css-pseudo-classes-forms/)
- [Element state selectors](https://daily-dev-tips.com/posts/css-pseudo-classes-element-states/)
- _Other pseudo states_ (this one 💖)

## Other state selectors

As for the other ones, we have the following that we can explore.

- `:is`
- `:not`
- `:has`

### `:is`

This selector can be used to match multiple elements on the go.

You might have seen the following in standards CSS before:

```css
div strong,
div i {
  color: hotPink;
}
```

This will make all strong and italic elements in a div pink.
However, we can leverage the `:is` selector to make this a bit more cleaner.

```css
div :is(strong, i) {
  color: hotPink;
}
```

I really like this selector and have been using it more lately. It cleans up classes.

Try it out in this CodePen.

{% codepen https://codepen.io/rebelchris/pen/xxXMBOq %}

### `:not`

Much like the above `:is` selector, this one does the opposite and fires if it's NOT one of the mentioned elements.

We want to style all elements, but the strong and italic ones.

```css
div :not(strong, i) {
  color: hotPink;
}
```

And another cool thing we can do with this selector is validating on even more queries.

```css
img:not([alt]) {
  outline: 10px solid red;
}
```

The above example will put a big red outline around images missing the `alt` attribute.

> Note: check out this article for more information about [CSS attribute selectors](https://daily-dev-tips.com/posts/css-attribute-selectors/)

Try both out in this CodePen.

{% codepen https://codepen.io/rebelchris/pen/NWaoJbV %}

I also have a complete article on the [CSS `:not` selector](https://daily-dev-tips.com/posts/css-not-selector/) if you want some more details.

### `:has`

This is not a stable solution yet, but super excited this is coming out!

So far, you can only use this in the Safari Technology preview version.
But it's super exciting to see what we can do with it.

We can target a parent that contains certain children.

```css
div:has(p) {
  background: yellow;
}
```

This would select all divs that have paragraph elements.

Some use-cases would be to remove margin from a header if it has a subtitle, for instance:

```css
.header {
  margin: 1;
}
.header:has(.subtitle) {
  margin: 0;
}
```

Keep an eye out for this one, as it will become a big change for what we can do with CSS.

### 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)
The Fundamentals of Database Structure
Published: 2022-01-25 06:09:28

## Where to begin?
If you're wondering where to begin when creating a database just ask yourself: what is the purpose of this database? What data do you want to store in your database? How many tables will you need to store your data? What type of data will each table include? How will each table interact with one another? 

**Purpose.** 
First determine what you want to accomplish with your database, i.e. track the classes of students

**Data.** 
In order to track the classes of students you will need to not only store the classes of each student, but also the name of each student. The student itself may be a table that includes information such as the student's name, date of birth, GPA, etc. You may also want to include information about the class such as: the name of the class, the instructor, time and dates the class meet, etc.

**Data Types.** 
Just like when programming in JavaScript, or any other programming language, there are different data types to consider. Some common data types are numbers, strings and boolean. 
Pictured below is how our tables may look with their different data and data types. You will notice each table has its own `id`. This is known as the _primary key_ and is what allows our program to distinguish between each item in each table. 

![how our tables may look with their different data and data types](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/da36ovc1mq8ux9hccfzm.png) 

**Table Organization.** 
Table organization is key. How the tables interact with one another must follow the logic of how you want your database to be organized. This sounds trivial but can be tricky.
For example, a student `has many` classes but a class also `has many` students. 

![Student - classes relationship](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxl9l8gcjhfvjnqaqv1l.png)

This means that we must have a join table, or a table that contains common fields from two or more tables. In our case it will be two fields: classes and students. These fields are known as _foreign keys_. Our join table will be called grades and will store all of the grades for each student and each class.

A student `has many` grades but each grade `belongs to` a student. 

![student-grades relationship](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6dce6pwxo8ueofj2xlvh.png)
A class `has many` grades whiles grades belong to a class. 

![class - grades relationship](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzb9wqa8501dtk6ue4sl.png)
It is important to note that students `has many` classes `through` grades and vice versa - classes `has many` students `through` grades.

![all table relationships](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9skomo3pcmro0gcjic7z.png)

## Conclusion
This is just the beginning of database structure, however, these very building blocks are what are used to create the most complicated databases on the internet.
Why Should Your Child Participate in Sports?
Tags: javascript, programming, productivity, career
Published: 2022-01-25 04:58:48

Sports are ingrained in our society and have an impact on practically everyone's life. Getting your kid active in sports has numerous advantages; nevertheless, some parents have legitimate worries about time commitments and the risk of injury [basketball legends](https://basketball-legends.co). You know your kid best, but in general, the advantages of participating in sports much exceed the disadvantages.

Here are the top five reasons why you should never stop allowing your kid to participate in sports.

Sports are enjoyable, and that is the most crucial factor. Remember, they're kids, and running about and playing with or finding new friends is enjoyable. They will accidentally discover life lessons and team techniques as a bonus. If you or your kid is unsure, take them to a game and show them how the game works and how the participants interact. They'll be wanting to join in the fun soon!
Day 17 of 100 - Java: Multi-threading 2
Published: 2022-01-25 05:17:12

> Journal note: 📝
> I am afraid a lot, a longtime to go before to actually get a job. How to manage social pressure, mental rut over small things, my slow paced learning, interview trials where I hardly have any luck. :(

CountDownLatch - A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes.

project repo - https://github.com/j143/java-threading-example
git bash throwing error related to ssh-rsa 
Tags: sshrsa, gitbash, git, openssh
Published: 2022-01-25 05:11:21

hello , 
I am behind the proxy and accessing my corporate server for development.
my git bash version is : 
mintty 3.5.1
my git version is git version 2.34.0.windows.1

Whenever I am trying to do repo sync i am getting below error : 

Unable to negotiate with <ip address> port 29418: no matching host key type found. **Their offer: ssh-rsa**
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

I have read gone through google many articles on this but could find a solution. In crux git has deprecated the use of ssh-rsa from 2.34 onwards though the previous versions may work fine...

Please let me know how to fix this , 

I even tried adding below lines inside the config file in .ssh folder

Host <myhostname>
    User git
    PubkeyAcceptedAlgorithms +ssh-rsa
    HostkeyAlgorithms +ssh-rsa

This is a workaround but still not working.
Harnessing all my inner willpower...
Tags: beginners, devjournal
Published: 2022-01-25 05:08:44

...to get to writing.

It's not that I don't like it, really. 

###### (over a decade of language teaching might endear you to the activity)

It's just that I feel there has always been a very personal aspect to whatever I write. 

But then again, journaling my career change and small learning victories will be very different from regular creative writing.

I don't expect to educate or inspire - not for a while at least - but these posts will be an entertaining read when I look back and see how far I've come.

Maybe the time has come to puff up my chest and say I blog?



###### besides, there's a lot of interesting content around these parts
Business Intelligence vs. Data Mining
Tags: javascript, programming, webdev, python
Published: 2022-01-25 05:05:34

The following is a list of the main differences between Business Intelligence or Data Mining and other technologies:

- Data Mining looks for patterns in data, whereas Business Intelligence makes use of data to make decisions.
- While Business Intelligence is helpful in decision-making, Data Mining can help with specific problems and decision-making.
- Business intelligence deals with a large amount of data, whereas data mining deals with a much smaller amount.
- Data Mining uses computational intelligence to identify the best solution for a business factor, whereas Business Intelligence is focused on data analysis and business procedures. 
- Data production, aggregation, and analysis are all part of business intelligence. Data mining, on the other hand, entails analysing, integrating, transforming, and evaluating data patterns.
- Data mining produces KPIs that can be displayed in BI results, while Business Intelligence informs and aids Business Administration and executives.
- Dashboards, Reports, and Documents in BI provide a consolidated view of various KPIs in visuals, charts, and data mining delivers reports to aid in decision-making.
- Data Mining can be utilised for BI to develop key performance indicators (KPIs) that will aid decision-making.
AdonisJs 4 - Context per request problem for multi-tenant usage
Tags: adonisjs, api
Published: 2022-01-25 04:52:39

My API uses AdonisJS 4.1 and also got requests from several domain (multi-tenant origin e.g. a.com, b.com either send request to the same API endpoint). I found that the origin header in middleware and controller is not the same as expected once API got concurrent request

Middleware
```js
class DetectOrigin {
   async handle(context, next) {
     // middleware shows the correct origin
     console.log(context.request.header('origin'))
     next()
   }
}
```

Controller
```js
class SomeController {
  async index(context) {
    // controller shows the last request of an incoming concurrent request group
    console.log(context.request.header('origin'))
    context.response.send('Some response data')
  }
}
```

Seem like context has been overwritten once another request comes. Anyone has any suggestion please help
JavaScript is Crazy - Part 2
Tags: javascript, webdev
Published: 2022-01-25 04:49:05


### Hello Folks 👋

What’s up friends, this is **SnowBit** here. I am a young passionate and self-taught developer and have an intention to become a successful developer.

Today, I am here again with a crazy thing in JavaScript.

So, let’s get started.

```jsx
console.log(Math.max())
```

As we all know the biggest positive number is  ∞  (infinity). So the out of the above code snippet should be positive `Infinity`. For better understanding, you can see the attached graph


![graph](https://cdn.hashnode.com/res/hashnode/image/upload/v1643085577324/ZplyntN2K.png)

```js
console.log(Math.max())
// -Infinity
```

But, as we know JavaScript is crazy 🤪; The output of this code is `-Infinity`. Don't believe it? check out the demo - [https://jsfiddle.net/ce0hkoLs/](https://jsfiddle.net/ce0hkoLs/)

Now, here come `Math.min()` it is converse of `Math.max` 

As we all know that lowest negative number is -∞(-infinity), but we know that’s not the case.

```js
console.log(Math.min())
// Infinity
```

---

We all know simple math, right? Now again we have a crazy thing with mathematics in JavaScript.

```js
console.log(0.5 + 0.1 == 0.6)
// true
```

Yes, `0.5 + 0.1 == 0.6` is true, isn’t it? 

Now here comes some thing crazy,

```js
console.log(0.1 + 0.2 == 0.3)
```

As we know, `0.1 + 0.2 == 0.3` is true, but JavaScript don’t think that. Somehow, JavaScript thinks it is false, I actually don’t know the exact reason for that let me know in the comments if you know it.

There, the output will be,

```js
console.log(0.1 + 0.2 == 0.3)
// false
```

Try it - [https://jsfiddle.net/feahj1s2/](https://jsfiddle.net/feahj1s2/)

---

Thank you for reading, have a nice day!
**Your appreciation is my motivation 😊**

- Follow me on Twitter - [@codewithsnowbit](https://twitter.com/codewithsnowbit)
- Subscribe to me on YouTube - [Code With SnowBit](https://www.youtube.com/channel/UCNTKqF1vhFYX_v0ERnUa1RQ?view_as=subscriber&sub_confirmation=1)
Digital Signatures
Published: 2022-01-25 04:43:42

---
canonical_url: https://ironpdf.com/examples/digitally-sign-a-pdf/
---

**C#:**
```
// PM> Install-Package IronPdf
using IronPdf;
 
 
//Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");
 
 
 
 
/***** Advanced example for more control *****/
 
// Step 1. Create a PDF
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
PdfDocument doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");
 
// Step 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader. 
// Read: https://helpx.adobe.com/acrobat/using/digital-ids.html
 
var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");
 
// Step 3. Optional signing options and a handwritten signature graphic
signature.SigningContact = "support@ironsoftware.com";
signature.SigningLocation = "Chicago, USA";
signature.SigningReason = "To show how to sign a PDF";
signature.LoadSignatureImageFromFile("handwriting.png");
 
//Step 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);
 
//Step 4. The PDF is not signed until saved to file, steam or byte array.
doc.SaveAs("signed.pdf");
```

**VB:**
```
' PM> Install-Package IronPdf
Imports IronPdf
 
 
'Cryptographically sign an existing PDF in 1 line of code!
Call (New IronPdf.Signing.PdfSignature("Iron.p12", "123456")).SignPdfFile("any.pdf")
 
 
 
 
'''*** Advanced example for more control ****
 
' Step 1. Create a PDF
Dim Renderer As New IronPdf.ChromePdfRenderer()
Dim doc As PdfDocument = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>")
 
' Step 2. Create a Signature.
' You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader. 
' Read: https://helpx.adobe.com/acrobat/using/digital-ids.html
 
Dim signature = New IronPdf.Signing.PdfSignature("Iron.pfx", "123456")
 
' Step 3. Optional signing options and a handwritten signature graphic
signature.SigningContact = "support@ironsoftware.com"
signature.SigningLocation = "Chicago, USA"
signature.SigningReason = "To show how to sign a PDF"
signature.LoadSignatureImageFromFile("handwriting.png")
 
'Step 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature)
 
'Step 4. The PDF is not signed until saved to file, steam or byte array.
doc.SaveAs("signed.pdf")
```

## Digital Signatures

IronPDF has options to digitally sign new or existing PDF files using .pfx and .p12 X509Certificate2 digital certificates.

Once a PDF is signed, it can not be modified without the certificate being invalidated. This ensures fidelity.

To generate a signing certificate for free using Adobe Reader, please read <a href="https://helpx.adobe.com/acrobat/using/digital-ids.html" rel="nofollow" target="_blank">https://helpx.adobe.com/acrobat/using/digital-ids.html</a>

In addition to cryptographic signing, a hand written signature image or company stamp image may also be used to sign using IronPDF.
Quick SQLite 1.0.0
Published: 2022-01-25 04:17:59

Hey guys welcome to this post today I am going to tell you about **Quick SQLite** in which you can do SQLite operation just in single line. No matter if you'r creating table , inserting ,selecting anything it's just single line . Stay tuned for Further updates. If you like this post please make sure to follow me. That's it Have a great day
UseState is asynchronous: Learn how to use useState and useEffect properly
Tags: javascript, react, webdev, beginners
Published: 2022-01-25 04:16:01


Hello readers, today I’m gonna talk about one of the issues I faced when I was making projects using React js.

UseState is asynchronous, let me show you what I mean via a small example.

```react
import React, { useState, useEffect } from 'react';
 
export default function App() {
 
 
    const [val, setVal] = useState(0);
 
    const addVal = () => {
        setVal(val + 1);
        console.log(val);
    }
 
    useEffect(() => {
 
        console.log("effect ", val);
 
    }, [val]);
 
 
    return <div>
 
        <div>{val}</div>
 
        <div><button onClick={() => { addVal() }}>ADD</button></div>
    </div>
}
 
```

Here we are having a state variable named **val** initialized with 0.

We also have a button, which on click, calls a function addVal()

addVal() has the following functions -

* Set the state of val by incrementing it. 
   It is done by `setVal(val+1)`

* Console.log(val);

We also have a useEffect that is triggered when state of val changes.

Let’s look at the console after clicking the button once.

  
![console.log](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lzfycreq49et39oy52px.png)

**1. First** - The first console is of useEffect when the page first loads.

**2. Second** - The second console is due to the addVal function. 
After, we update the state of val. 

But, the value which gets printed remains the same i.e **0**. 

So, what happening? The value of *val* isn’t updated immediately, useState is asynchronous. It takes time to update so it allows rest of the program to continue and updates the value later. 

**3. Third** - The third console log is due to the useEffect, which displays the value of *val* after the state is updated i.e **1**.

I hope you understood the concept and remember to manage your state changes using useEffect. I have made a lot of mistakes, not knowing the concept completely. I hope you don’t make them too.

 
Keep learning and thanks for reading :)


**Feel free to connect with me on -**

* [Twitter](https://twitter.com/fidalmathew10)
* [Github](https://github.com/FidalMathew)
* [Linkedin](https://www.linkedin.com/in/fidal-mathew-82aba7200/)
Un resumen rápido de F4 Tailandia: Boys Over Flowers

Tags: beginners, discuss, opensource
Published: 2022-01-25 03:22:38

**Un resumen rápido de <a href="https://doramasvip.org/">F4 Tailandia: Boys Over Flowers</a>**

Gorya es una joven desnuda que trabaja en un taller de flores. Ella termina una prueba y es admitida en una escuela noble y extravagante a la que asisten los ricos, administrada por un club de primera clase conocido como F4, compuesto por cuatro jóvenes ricos, atractivos y arruinados.

Gorya es el que en particular se enfrenta a sus formas acosadoras, dejando a todos los jóvenes aturdidos, especialmente a Thyme, el líder del grupo. Inmediatamente afectada por Gorya, Thyme la busca sinceramente, pero ella se preocupa muy poco por él en sus sentimientos iniciales.

En ese momento, ella sucumbe a su querido compañero Ren, pero Ren está enamorado de su amor de juventud, Mira. En todo el caos de la escuela, Gorya no puede resistir la tentación de terminar sucumbiendo a Thyme a la luz de su liberalidad con ella y su familia y su ajuste de carácter.
Self-Taught Developer Journal, Day 46: TOP Building Rock Paper Scissors UI cont.
Tags: webdev, beginners, codenewbie, devjournal
Published: 2022-01-25 03:21:46

Today I set up the HTML elements for the Rock Paper Scissors UI based on my mockup from the previous post.

![Mockup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnlymptamorfizeen3s1.png)

I added each component in the mockup as its own **block** following the BEM methodology naming (I wanted to try and work on naming).

*"Block which holds everything (elements) inside and acts as a scope."*

Then I included the **elements** for each part of the **block**. No modifiers yet. I also chose to use *div* elements. I was not sure what semantic elements to use in this case.

![Rock Paper Scissors HTML](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zkog1dcl628vzpsgdvmj.png)
 
## Resources
[The Odin Project](https://www.theodinproject.com/paths/foundations/courses/foundations/)
[Revisiting Rock Paper Scissors](https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/revisiting-rock-paper-scissors)
http://getbem.com/naming/
https://www.devbridge.com/articles/implementing-clean-css-bem-method/
Hi Guys,  Please Share the information if you know about it.    
Tags: webdev, webcomponents, php, web3
Published: 2022-01-25 03:01:05

I developed a web site at infinity free platform. When ever I make changes to my web pages, The changes are not replacing, if I remove browsing history,Then it showing updated website. 
May I know what is that problem and how to overcome it. 
As a developers, we can't intimate each user to 'remove your browsing history we updated our web page'.