teleren/devto huggingface dataset:
Type Conversion and Type Coercion - JavaScript
Tags: javascript, webdev, coding, development
Published: 2023-09-07 08:04:11

## Type Conversion:
In programming, type conversion or type casting is the process of explicitly converting a value from one type to another.
For instance, you may have a string value of '5' and you want to convert it to a number value of 5 so that you can do some arithmetic operations on it.

Converting a string into a number using `Number()` or the unary plus (`+`) operator.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4pou0be3r4xuf3z551ia.png)


Trying to convert the string 'Zouhair' into a number results in NaN (Not-a-Number).
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4mjbdf59c5wzb6ckusj.png)

NaN is a special value in JavaScript, representing an "Invalid Number."
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qnmmoen4uwruioaslqpm.png)

We actually get a special "number" called NaN, which stands for Not a Number... Yeah, that's JavaScript for you. A number that is "not a number". There are some really strange and quirky aspects of JavaScript. The good news is that most of it doesn't get in your way in practical development. It's just when we start to dig down deeper.



## Type Coercion
Type Coercion is when data types are converted implicitly by JavaScript. 
Although the conversion that we did mention above can also be called explicit coercion. There's so many different words for the same thing in programming.
Typically coercion happens when you apply operators to values of different types.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mot7z4skse6mpc1srw3k.png)

The "`+`" operator trigger a coercion to strings so whenever an operation between a string and number, the number will convert to a string, and that's exactly what's happen in the template literals.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iz6aee8226pprftoolhj.png)
The "-" operator triggers coercion to numbers converting strings to numbers.


**In summary**: Type Conversion involves explicitly changing the data type of a value using functions like **`Number()`** and **`String()`**. 

On the other hand, Type Coercion is the automatic conversion that occurs during operations between values of different types, such as when the "`+`" operator converts numbers to strings and the "`-`" operator converts strings to numbers.
Turbo without Typescript
Tags: typescript
Published: 2023-09-07 06:10:17

Turbo just dropped Typescript in [this GitHub PR](https://world.hey.com/dhh/turbo-8-is-dropping-typescript-70165c01). DHH wrote about it on [the Hey blog](https://world.hey.com/dhh/turbo-8-is-dropping-typescript-70165c01).

I'd like to connect this with [my idea of conventional typing](https://schmijos.medium.com/conventionally-typed-ruby-6a8e76172e99) because I think the PR makes very good examples of why to remove TS is valuable.
The question I often like to ask is whether the types are here for humans or for machines.

Consider the following example from the PR:


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

The naming already suggests the types for humans. "delegate", "map" and "callback" are well known concepts in the context of Turbo. The types were only here for the machine.

If your IDE cannot infer the types automatically or you would like to provide types for the users of your library, you can still annotate in separate `d.ts` files. These files can be auto-generated and are out of your way when writing business-relevant code.
500 open-source components for TailwindCSS
Tags: tailwindcss
Published: 2023-09-07 07:55:31

[![Tailwind components](https://tailwind-elements.com/img/components-big.jpg)](https://tailwind-elements.com/)        
                       I'd like to share my latest discovery with you. 
       [Tailwind Elements](https://tailwind-elements.com/) is currently, the most popular 3rd party UI kit for TailwindCSS with over 10k Github stars.        [![GitHub Repo stars](https://img.shields.io/github/stars/mdbootstrap/tailwind-elements?style=social)](https://github.com/mdbootstrap/Tailwind-Elements/)        It's a **huge collection of stunning components** made with attention to the smallest detail.         Forms, cards, buttons, and hundreds of others.         All components have **dark mode** and very intuitive **theming options**.        The project is supported by an [engaged community on GitHub](https://github.com/mdbootstrap/Tailwind-Elements/discussions), I recommend you check it out and join one of the many discussions.        
       You will find installation instructions [here](https://tailwind-elements.com/docs/getting-started/installation), and you can track the progress of the project live         [here](https://tailwind-elements.com/docs/standard/getting-started/changelog/).        
       The project was kickstarted by @MDBootstrap, a group of open-source developers behind [MDB UI Kit](https://github.com/mdbootstrap/mdb-ui-kit) - a high-quality UI kit for Bootstrap, and also behind [MDB GO](https://mdbgo.com/) - hosting and deployment platform.        
       I highly recommend you to check it out!        
       {% link mdbootstrap/tailwind-elements-breakthrough-version-is-here-59hh %}

## With SvelteKit
If you have a SvelteKit app and want to try out Tailwind Elements, here's a [great tutorial](https://tailwind-elements.com/docs/standard/integrations/svelte-integration/) on how to set up your app.
SASS up your Code: SCSS in Nuxt or HTML
Tags: scss, css, tutorial, programming
Published: 2023-09-07 07:51:27

## Using SCSS with Nuxt
To use SCSS with Nuxt, you need to add the `sass` package to your project. You can do this by running the following command: `pnpm add -D sass` (works completely fine with a [tauri app](https://dev.to/waradu/how-to-use-tauri-with-nuxt-18d9))

After adding the package, you can use Sass in your Nuxt project by changing the `<style>` tags to `<style lang="scss">` tags in all .vue files.

## Using SCSS with HTML in VS Code
To use SCSS with HTML in VS Code, you need to install the `glenn2223.live-sass` extension. After installing the extension, open any `.scss` file and click on the `watch sass` button at the bottom right of the screen.

To import the generated CSS into your HTML file, use the same method as you would for normal CSS. However, make sure to use the `.css` file extension instead of `.scss`, as `live-sass` will convert `.scss` files to `.css` files.

If you have any questions/problems/ideas, feel free to add me on discord: `waradu`.
How to Delete PDF Pages in C#
Tags: csharp, programming, tutorial
Published: 2023-09-07 07:50:23

Compared to other document formats, the PDF document format is more stable and generally difficult to edit or change. However, in our daily work, dealing with PDF documents is essential. For example, by removing duplicate or unnecessary pages from a PDF document, you can simplify the content of the document and provide a better viewing experience for readers. It can save you a lot of effort and time, especially for large documents. This article will share how to delete specified pages in a PDF file through a C# program.

## Tool:

- Visual Studio 2022
- [Free Spire.PDF for .NET](https://www.e-iceblue.com/Introduce/free-pdf-component.html)
This is a free version of Spire.PDF for Java, supports editing and converting PDF on .NET platforms freely. You can also download the commercial version from [this link](https://www.e-iceblue.com/Introduce/pdf-for-net-introduce.html) and trial it for 30 days.

## Installation:

- Download and install [Free Spire.PDF for .NET](https://www.e-iceblue.com/Download/download-pdf-for-net-free.html).
- Create a new C# project and open it.
- Right-click " References " in the " Solution Explorer ".
- And then select " Add Reference " > " Browse ". 
- Find the DLL file in the BIN folder under the installation path and click " OK " to add it as a reference.

## Sample Code：
```c#
using Spire.Pdf;

namespace RemovePage
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a PdfDocument object
            PdfDocument document = new PdfDocument();

            //Load a sample PDF document
            document.LoadFromFile(@"sample.pdf");

            //Remove the second page
            document.Pages.RemoveAt(1);

            //Save the result document
            document.SaveToFile("RemovePages.pdf");
        }
    }
}
```
First, create a **PdfDocument** object and load “ sample.pdf ”. And then get the desired page by **PdfDocument.Pages** property and delete it by using **PdfPageCollection.RemoveAt(int index)** method. Finally, save the document to another file.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2qo6td6znd8h7b4llhzu.png)
Privileges in PostgreSQL
Tags: postgres, apecheage
Published: 2023-09-07 07:43:20

## What are privileges in Postgresql?
Privileges refer to the permissions and rights granted to database objects, such as tables, views, schemas, and functions, allowing users and roles to perform various actions on these objects
In PostgreSQL, multiple privileges are present for every object that is created. By default, the owner (or a superuser) of an object has all the privileges on it. In PostgreSQL, the following types of privileges are present:
- SELECT
- INSERT 
- UPDATE 
- DELETE 
- TRUNCATE 
- REFERENCES 
- TRIGGER 
- CREATE 
- CONNECT 
- TEMPORARY 
- EXECUTE 
- USAGE

There are different privileges associated with different objects. For instance, the EXECUTE privilege is associated with procedure. The `GRANT` command is used to grant any privilege to any user. It allows you to control what actions users can perform on the object. The syntax for granting privileges is as follows:

```
GRANT privilege_name(s) ON object_name TO user_name_or_role;

```

To grant the `EXECUTE` privilege on a procedure named "my_function" to a user "my_user," you would use:

```
GRANT EXECUTE ON FUNCTION my_function TO my_user;
```
Similarly, to take back privileges, the `REVOKE` command is used. The REVOKE command is used to revoke previously granted privileges from a user or role. It allows you to take back specific privileges that were previously assigned. The syntax for revoking privileges is shown below:

```
REVOKE privilege_name(s) ON object_name FROM user_name_or_role;
```

To revoke the previously granted EXECUTE privilege on the "my_function" procedure from the "my_user," you would use:

```
REVOKE EXECUTE ON FUNCTION my_function FROM my_user;
```

It is important to note that managing privileges in PostgreSQL is crucial for access control in your data and ensuring the security and integrity of your database is intact.
How to Customize the React TreeMap Component
Tags: webdev, react
Published: 2023-09-07 07:28:59

Learn how easily you can customize the React TreeMap Component from Syncfusion. This video demonstrates how to customize the layout and labels of the React TreeMap component. It also shows how to display TreeMap items on different levels and customize the headers of the group. 

The Syncfusion React TreeMap is a UI component designed to visualize data in a hierarchical and structured way. It is particularly useful for displaying data with a parent-child relationship or hierarchical structure, such as organizational charts, project structures, and financial data. 

The component offers a high degree of customization. You can configure properties for data sources, color mapping, labels, tooltips, and legend settings to tailor visualization to your specific requirements. The TreeMap includes legends that provide context for color mappings, helping users understand the meaning behind the colors used in visualizations. 

**Product overview:** https://www.syncfusion.com/react-components/react-treemap

**Tutorial video:** https://www.syncfusion.com/tutorial-videos

**Download the example from GitHub:** https://github.com/SyncfusionExamples/how-to-customize-the-react-treemap-component

{% youtube 4uU7ohUXZts %}
PHP: Tackling Limitations, Boosting Performance, and Enhancing Maintainability
Tags: php, wordpress, laravel, softwaredevelopment
Published: 2023-09-07 07:27:19

Here are some of the main pain points and limitations developers experience with PHP:

- **Performance** - PHP interprets code at runtime rather than compiling so it is slower for intensive tasks.

- **Memory usage** - The PHP engine's memory handling is not as efficient as languages like C, so apps can require more resources.

- **Concurrency** - PHP does not have native multiprocessing capabilities. Workarounds exist but can be complex.

- **Code execution** - PHP waits until code finishes executing before returning a response, blocking the server.

- **Code maintenance** - Dynamic typing, global state, and inconsistent function naming can make PHP apps harder to maintain.

- **Resource intensive** - PHP apps often require more infrastructure scaling to handle load compared to other languages.

- **Weak typing** - Lack of type safety can lead to bugs and coercion issues.

- **Built-in libraries** - PHP's core libraries lack robustness compared to other languages.

- **Verbose syntax** - Lots of boilerplate compared to languages with modern syntax like Python.

The key problems are performance, scalability, and difficulty maintaining large complex applications. But PHP's convenience and approachability are why it remains popular despite these downsides.

Here are some ways to mitigate PHP's limitations by integrating with other technologies:

**Performance:**

- Use HipHop VM or PHP compilers like Phalanger to convert PHP into optimized bytecode

- Offload intensive processing to background workers powered by Swoole, ReactPHP, or Amp 

- Implement caching with Redis or Memcached to reduce database queries 

- Use FFI to invoke high-performance C libraries directly from PHP code

**Scalability:**

- Horizontally scale PHP using a load balancer and reverse proxy like Nginx

- Enable autoscaling groups on cloud platforms like AWS Elastic Beanstalk 

- Adopt asynchronous and event-driven architectures via Swoole 

- Use services like Cloudflare to absorb network load

**Maintainability:**

- Improve code quality by adopting standards like PSR-12 coding style

- Leverage static analysis tools such as PHPStan and Psalm to catch bugs

- Use PHP 7+ features like strict typing to identify issues early 

- Refactor into reusable components and libraries for modular code

- Utilize design patterns more systematically

Integrating PHP with other technologies like caches, queues, and high-performance libraries/services can help overcome some of its limitations.
AI coding tools are good at simple tasks. McKinsey and GitHub data suggests
Tags: ai, githubcopilot, genai, productivity
Published: 2023-09-07 07:17:12

My confirmation bias is satisfied yet again... 

Recently I've shared my experience with AI coding assistants shining in [smart refactoring](https://dev.to/maximsaplin/smart-refactoring-with-ai-beyond-old-school-refactors-8od) while they fail to impress in more complicated stuff requiring a deep understanding of the code base ([SourceGraph's Cody AI](https://dev.to/maximsaplin/exploring-cody-an-ai-coding-assistant-that-knows-your-codebase-17bh), [Google's Project IDX](https://dev.to/maximsaplin/project-idx-by-google-web-flutter-ai-its-not-there-yet-91m)). 

In this [recent study of generative AI tools in software development by McKinsey](https://www.mckinsey.com/capabilities/mckinsey-digital/our-insights/unleashing-developer-productivity-with-generative-ai), conducted on a pool of 40 developers, there were little-to-no gains on complex tasks. On the contrary simpler tasks (aka "code generation, refactoring, documentation") saw most of the time savings when developers used AI coding assistants:

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

[Another study from 2022 by the GitHub Copilot team](https://github.blog/2022-09-07-research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/) evaluated how the task of creating a simple JavaScript Web server, which typically took **~3 hours** (161 minutes to be precise), got accelerated. In a control group of developers who used Copilot time got cut to **~1 hour** (71 minutes).

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

So far I have seen no evidence of successful employment of Coding AI assistants in big/complex coding tasks. Neither in research available in open sources nor in my own experience in a 60 000 software engineering company.

Assistants, such as GitHub's CoPilot X and SourceGraph's Cody AI, are moving in the direction of taking on larger scopes of tasks. Their tech has already stepped beyond GPT-based text autocompletion (as it was in the original CoPilot and Amazon's CodeWhisperer) and chat conversations. Let's see if they manage to bring understanding of the solution to AI and have it reliably change and verify multiple parts of the code base.

Yet developers can start benefiting from AI already. AI coding skills can give small gains and edge to individuals. Pick a tool for your favourite IDE and start typing and prompting! Don't expect AI to magically read your mind and provide large snippets of bulletproof code and you'll be good :)


_**P.S.:** I've seen improvements in Cody AI, they've recently introduced embeddings in their code base understanding tech. Worse a deeper trial and a separate 'Part 2' post._
Immune Booster IV Therapy
Tags: ivtherapy, immunebooster, drip, runner
Published: 2023-09-07 07:13:14

Top Benefits Of Immune Booster IV Therapy.
Immune booster IV therapy, also known as intravenous immune support or immune system IV drip, is a treatment that involves the infusion of vitamins, minerals, and other nutrients directly into the bloodstream. While its effectiveness may vary from person to person, here are some potential benefits associated with immune booster IV therapy:

Enhanced Immune Function: 
Immune booster IV therapy often includes essential vitamins and minerals like vitamin C, zinc, and selenium, which can help strengthen the immune system and improve its ability to fight off infections.

Quick Nutrient Absorption: 
IV therapy delivers nutrients directly into the bloodstream, allowing for faster and more efficient absorption compared to oral supplements, which must pass through the digestive system.

Increased Energy Levels: 
Some IV formulations include B vitamins and amino acids that can boost energy levels and combat fatigue, helping you stay active and alert.

Improved Hydration: 
IV therapy can provide rapid hydration, which is essential for overall health and immune function. Proper hydration helps the body flush out toxins and maintain essential bodily functions.

Reduced Recovery Time: 
Athletes and individuals recovering from illness or strenuous activities may benefit from immune booster IV therapy to speed up recovery and reduce downtime.

Stress Reduction: 
Certain IV formulations may include magnesium and other minerals that can help relax the body and reduce stress, which in turn can positively impact immune function.

Detoxification: 
IV therapy can aid in detoxifying the body by promoting the removal of harmful toxins and free radicals, potentially reducing the burden on the immune system.

Recommendation :

Check out most popular and Immune Booster IV therapy by " [Drip Runner](https://driprunner.us/) " with the perfect blend of essential vitamins and nutrients, which can maximize your energy, boost your brain function, lighten your mood and ramp up the growth of immune cells, helping you fight off inflammation and infections.
Baldi's Basics - the best horror game
Tags: game, horror
Published: 2023-09-07 07:07:18

Get away from [Baldi](https://baldisbasics.io)'s academy once more in the improved sequel to the classic Baldi's Basics! Gather the seven notebooks without being detected using cunning and planning.
Baldi's Basics, the first and only official release of the horror edutainment parody game. You can't take this game at face value.
Fundamentals of Education and Learning by Baldi, a 2018 parody survival horror game made by American independent developer Micah McGonigal, is also known as Baldi's Basics and Baldi's Basics Classic. The game parodies educational video games from the 1990s by using poor visuals and concepts that are comparable to those of Sonic's Schoolhouse, IM Meen, and 3D Dinosaur Adventure. For Microsoft Windows and macOS, Baldi's Basics was originally made available as a beta version on March 31, 2018. On June 12, 2020, Baldi's Basics Plus, the full version of this game including its primary gameplay and extra features, was made available for early access.
The main character's buddy forgot seven notebooks at the neighborhood school but couldn't go collect them since he was running late and "rehearsing," so he had to ask the protagonist to go get them for him. When the player first arrives, he meets an instructor by the name of Baldi, who will provide him with three basic arithmetic questions every time he discovers a notebook. If the player can successfully complete all of these tests, he will get a prize. Baldi is also a highly irritable character, and after giving the player a task to solve, the instructor will start pursuing them if they provide the incorrect solution. The main character must continue looking for every other notepad while evading other classmates and numerous barriers. If the player choose to provide incorrect answers to every question, they will have to experience an alternative ending that features a warped version of Baldi and another secret character that forces them to destroy the game before it automatically ends.
What Do You Wish People Asked?
Tags: discuss
Published: 2023-09-07 07:00:00

_Welcome to Code Chatter, your go-to series for conversational coding insights. What makes this series of questions different from all the others? Well, truth be told, not much, but they're still thought-provoking and fun. Join us as we explore the coding world, one witty question at a time._

> Is there something specific you wish people would ask or discuss with you more often regarding coding?

Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
No account password is required to obtain the data table structure
Published: 2023-09-07 06:58:45

Is there a method to extract the structure of data tables in a database without requiring a database account password? This issue arose when I tried Amundsen's ingestion service.

For example, MySQL or PostgreSQL, I know the IP address and port number (such as 3306) that provide this service, but I don't know its account and password. Is there any way to extract its data table structure (or metadata)?

I really look forward to your answer to this question. If you provide an answer, I would be very grateful.