teleren/devto huggingface dataset:
Normalization of Tables: From 2NF to 3NF
Published: 2023-04-21 20:23:24

---
title: Normalization of Tables: From 2NF to 3NF
published: true
date: 2023-04-14 18:43:24 UTC
tags: 
canonical_url: https://harshmange.hashnode.dev/normalization-of-tables-from-2nf-to-3nf
---

The second normal form (2NF) ensures that each non-key attribute of a table is fully dependent on the primary key. However, it is still possible for a table to have transitive dependencies, where non-key attributes depend on other non-key attributes. To address this issue, we can use the third normal form (3NF) to further normalize the database.

The third normal form (3NF) requires that all non-key attributes in a table be independent of each other, and that each non-key attribute depends only on the primary key. This helps eliminate data redundancy and improves data consistency and maintainability.

Let's consider an example of a fictional database for an online bookstore. Suppose we have a table called "Books" that contains information about books, including their title, author, publisher, and the department they belong to:

| **ISBN** | **Title** | **Author** | **Publisher** | **Department** |
| 978-0316067928 | The Hunger Games | Suzanne Collins | Scholastic | Fiction |
| 978-0316015844 | Catching Fire | Suzanne Collins | Scholastic | Fiction |
| 978-0547928227 | The Hobbit | J.R.R. Tolkien | Houghton Mifflin | Fiction |
| 978-0590353427 | Harry Potter and the Philosopher's Stone | J.K. Rowling | Bloomsbury | Fiction |

This table is in 2NF because each non-key attribute depends fully on the primary key (ISBN). However, we can see that there is a transitive dependency between the "Department" column and the "Title" column, because the department of a book is determined by the title of the book, which is determined by the ISBN.

To normalize this table to 3NF, we need to split it into two tables. The first table, "Books", will contain information about each book and its ISBN, author, and publisher:

| **ISBN** | **Title** | **Author** | **Publisher** |
| 978-0316067928 | The Hunger Games | Suzanne Collins | Scholastic |
| 978-0316015844 | Catching Fire | Suzanne Collins | Scholastic |
| 978-0547928227 | The Hobbit | J.R.R. Tolkien | Houghton Mifflin |
| 978-0590353427 | Harry Potter and the Philosopher's Stone | J.K. Rowling | Bloomsbury |

The second table, "Departments", will contain information about each department and the books it contains:

| **Department** | **ISBN** |
| Fiction | 978-0316067928 |
| Fiction | 978-0316015844 |
| Fiction | 978-0547928227 |
| Fiction | 978-0590353427 |

In this normalized database, each non-key attribute (title, author, publisher, and department) depends only on the primary key or the combination of the primary key and a single non-key attribute. There are no transitive dependencies, which improves data consistency and maintainability.
Setting Up A Julia Development Environment
Tags: julialang, vscode, setup
Published: 2023-04-16 14:20:02

### Introduction

This guide provides a simple walkthrough on how to get Julia running in VS Code. So it is assummed that you have the IDE (Integrated Development Environment) installed. If not you can download VS Code [here](https://code.visualstudio.com/download).

### Installation Steps

1. Download and Install Julia: As recommended on the [official Julia website](https://julialang.org/downloads/) you should be downloading and using the latest stable release of Julia for you machine. After downloading, run the installer and follow the instructions.

2. Install the Julia Extension: you can find the extension [here](https://marketplace.visualstudio.com/items?itemName=julialang.language-julia) or you could directly search the term `julia` in the extension marketplace. It should be the first popping up with "Julia Language Support" as the description. The extension provides language support and other features like syntax highlighting, code completion, and debugging.


![Julia Extension Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m31p3y9rm93nckyxsdhd.PNG)

3. Test Your Setup: To make sure your setup is working correctly, open VS Code and create a new file with a `.jl` extension, `main.jl` for example. Then write your first line of Julia, such as `println("Hello, world!")`. Save the file and run it by clicking the "play" button at the top right corner in VS Code.

If you're getting an error message that reads like this:

```
Cannot read properties of undefined.
```

It might be that the extension does not find the julia executable. You can fix this by setting the `julia.executablePath` to point to `julia.exe` on your machine. You can set the path via the menu `File->Preferences->Settings->Extensions` and the select `julia`. Under julia go to `Julia: Executable Path` and enter the path. 

You can find the right path by searching `julia.exe`, open the file location and copy the path, which should look something like this: 

```
C:\Users\moyoj\AppData\Local\Programs\Julia-1.8.5\bin\julia.exe
```

And your Julia program should run successfully.

---

*I hope that this article is helpful and you learned something from it. Being a technical writer and content creator I am passionate about sharing my knowledge (including tips and advice) and helping other people achieve their goals, especially those just starting out in tech. You can connect with me on my social media profiles and blogs [here](https://linktr.ee/johnademoye).*
Building Splitwise - A Tip Splitting App
Tags: webdev, node, devlog, frontend
Published: 2023-04-16 13:56:26


As a developer, I wanted to create a simple and easy-to-use tip splitting app that could help people easily split the bill when dining out with friends or colleagues. I named the app Splitwise and used a combination of HTML, CSS, JavaScript, Express, EJS, and Sass to build it.

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

Here is the [live website](https://splitwise-yobe.onrender.com/) if you want to take a look

If you want to create your own Tip splitting app you can follow along with this tutorial [Tip Splitting App with HTML, CSS, JavaScript and Express](https://dev.to/danielholm/tip-splitting-app-with-html-css-javascript-and-express-4n8b)


## Project Setup and Technologies Used:

I began by setting up the project using Node.js and the Express framework to handle the backend of the application. I used EJS as the templating engine and Sass to write my CSS.

For the frontend, I used HTML and JavaScript to build the user interface. I used Bootstrap for the CSS framework to quickly build a responsive and mobile-friendly design.
## Personal Insights:

Building this app taught me a lot about building a full-stack web application. I learned how to set up a Node.js project, use Express to handle HTTP requests, and use EJS to render dynamic content. I also learned how to use Sass to write more efficient and organized CSS code.

In addition, I learned about the importance of proper input validation to prevent errors and improve the user experience. I also learned about the importance of responsive design for a mobile-friendly user interface.

## Resources:

I used various resources to help me build this app, including the official documentation of the technologies I used, online tutorials, and stack overflow.

- [SCSS/SASS Documentation](https://sass-lang.com/documentation/)
- [MDN](https://developer.mozilla.org/en-US/)
- [Tutorial to Set up Sass](https://www.youtube.com/watch?v=EsSHjDo0Y3E&t=1s)

## Conclusion:

Splitwise is a simple yet powerful tip splitting app that makes it easy for people to split the bill when dining out with friends or colleagues. Building this app was a great learning experience for me, and I hope that it can help others as well.
HackerRank: Mini-Max Sum Solution using PHP (Algorithm)
Tags: php, algorithms, hackerrank, hackathon
Published: 2023-04-16 13:50:18

## Problem Description

In this HackerRank Mini-Max Sum problem solution Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.

**Example**

`arr = [1,3,5,7,9]`

The minimum sum is 1+3+5+7 = 16 and the maximum sum is 3+5+7+9 = 24. The function prints

`16 24`

**Function Description**
Complete the miniMaxSum function in the editor below.

miniMaxSum has the following parameter(s):

`arr: an array of  integers`

**Print**

Print two space-separated integers on one line: the minimum sum and the maximum sum of 4 of 5 elements.

**Input Format**
A single line of five space-separated integers.

**Constraints**

`1 <= arr[i] <= 10^9`

**Output Format**
Print two space-separated long integers denoting the respective minimum and maximum values that can be calculated by summing exactly four of the five integers. (The output can be greater than a 32 bit integer.)

## Solution ( My Way)

```PHP
sort($arr);
$minsum = array_sum(array_slice($arr, 0, 4));
$maxsum = array_sum(array_slice($arr, 1));
echo $minsum ." ". $maxsum;
```
Link to the HackerRank: [Mini-Max Sum](https://www.hackerrank.com/challenges/mini-max-sum/problem)
Starting Web App in 2023 [Research]
Tags: webdev, javascript, programming, beginners
Published: 2023-04-16 13:34:27


Today, we are proud to announce the launch of our annual research studying the way  [web](https://flatlogic.com/blog/7-trends-in-javascript-to-look-for-in-2020/)  apps are started. Last year, we conducted the same  [research](https://flatlogic.com/starting-web-app-in-2022-research) and it received considerable attention and numerous feedback. This year’s research is going to show the dynamics of the industry and changes in patterns of  [web app development](https://flatlogic.com/blog/react-vs-vue-what-to-choose-in-2023/).

[![](https://b1694534.smushcdn.com/1694534/wp-content/uploads/2023/04/9-1024x632.png?lossy=1&strip=1&webp=1)](https://docs.google.com/forms/d/e/1FAIpQLSfcYL9b4zpurOTlvpbK5vatLMvVKU4j37XCctgh7p38JvOJBA/viewform)

By participating in our anonymous survey you will be contributing valuable insights to our understanding of the patterns, platforms, and technologies used to start web applications in 2023. This research will benefit both developers and the ecosystem as a whole.

We are aiming to gain a comprehensive understanding of “how web apps are started” regardless of the job titles of those who initiate  [web app](https://flatlogic.com/blog/bootstrap-vs-material-ui-which-one-to-use-for-the-next-web-app/)  projects. This way, we can capture both  [no-code](https://flatlogic.com/blog/hard-limits-of-low-code-no-code/)/low-code and classical approaches. By participating in our survey, you will help us identify patterns, preferences, and technology shifts, ultimately making the web  [app development](https://flatlogic.com/blog/why-build-mobile-app-using-a-template/)  process more efficient and innovative.

At the end of our research, the results will be publicly available and open-source. As a thank you for your valuable input and for joining us in our mission to advance the web  [app](https://flatlogic.com/blog/difference-between-react-and-angular-a-comparison-guide-for-2021/)  development community, all participants will receive a  **50****%** **[discount](https://flatlogic.com/blog/happyeaster-flatlogic-gives-50-discount-on-all-templates/)  on all  [Flatlogic](https://flatlogic.com/blog/stand-with-ukraine/)  products.**

We encourage everyone to take part in our survey and help us make the web app development process more efficient and innovative.

To take part in the survey, please click the link below:  [**GO TO FORM**](https://docs.google.com/forms/d/e/1FAIpQLSfcYL9b4zpurOTlvpbK5vatLMvVKU4j37XCctgh7p38JvOJBA/viewform?usp=sf_link).

Thank you for your continued support!
solana-dev-docker
Tags: solana, docker
Published: 2023-04-16 13:25:29

I just made a docker dev env which pre-setup essential tools for Solana development.

included:
- Rust v1.68
- Solana-cli v1.14.17
- Node v18.16.0, with NPM/YARN
- Anchor v0.27.0

The setup repo:
https://github.com/airicyu/solana-dev-docker
How To Get The Best BIM 360 Assignment Help from Experts?
Tags: beginners, devjournal
Published: 2023-04-16 13:18:27

Students often find it difficult to cope with the pressure of deadlines and the demands of the course. However, there is no need to worry! We are here to help you. Our team of experts provides the best **[BIM 360 assignment help](https://www.bookmyessay.com/bim-360-assignment/)**. We have a wealth of experience and knowledge in the field of BIM and can provide you with comprehensive, well-researched, and original assignments.
Playwright Tutorial for Beginners 9 - Assertions
Tags: testing, qualityassurance, playwright, beginners
Published: 2023-04-16 17:20:51

---
title: Playwright Tutorial for Beginners 9 - Assertions
published: true
date: 2023-04-16 13:09:00 UTC
tags: testing, qualityassurance, playwright, beginners
canonical_url: https://blog.zt4ff.dev/playwright-tutorial-for-beginners-9-assertions
series: Testing with Playwright
---

## Playwright Assertions

Playwright make use of [expect](https://jestjs.io/docs/expect) library (provided by [Jest](https://jestjs.io)) for assertions. The library provides different types of matchers like `toEqual`, `toContain`, `toMatch`, `toMatchSnapshots` and many more.

To make use of the library, import it into your test script.

```
const { expect } = require('@playwright/test')

```

You can extend with async matchers that will wait until the specified assertion condition is met.

```
expect(value).toEqual(anotherValue);

await expect(value).toBeTruthy();

```

### Common patterns

```
// assert text content
expect(await page.locator('.welcomeMsg').textContent()).toEqual('Welcome pal');

// assert inner text
expect(await page.locator('.goodbyeMsg').innerText()).toBe('Goodbye pal');

// assert inner html
expect(await page.locator('.button-container').innerText()).toEqual(
    '<button>Submit</button>'
  );

// assert attribute
expect(await page.locator('css=#name-input')).toHaveAttribute('type', 'text');

// assert url
expect(await page.url()).toMatch(/\/users\/test/);

// and many more!

```

### Custom assertions

To have custom assertions, you can extend the `expect` provided by [Jest](https://jestjs.io). For instance, we will create a custom matcher called `toBeBetween10And100`:

```
const { expect, default: test } = require('@playwright/test');

expect.extend({
  toBeBetween10And100(num) {
    const pass = num > 10 && num < 100;

    if (pass) {
      return {
        message: () => `expected ${num} to be not within 10 and 100`,
        pass: true
      };
    }
    return {
      message: () => `expected ${num} to be within 10 and 100`,
      pass: false
    };
  }
});

test('simple test', async () => {
    // pass
  expect(25).toBeBetween10And100();
});

```

There are a bunch of matchers you can use with Playwright depending on what your test suites are.
Playwright Tutorial for Beginners 8 - Screenshots
Tags: testing, softwaretesting, playwright, beginners
Published: 2023-04-16 17:19:47

---
title: Playwright Tutorial for Beginners 8 - Screenshots
published: true
date: 2023-04-16 13:08:00 UTC
tags: testing, softwaretesting, playwright, beginners
canonical_url: https://blog.zt4ff.dev/playwright-tutorial-for-beginners-8-screenshots
series: Testing with Playwright
---

To screenshot, make use of `page.screenshot({ path: 'screenshot/screenshot.png' })`

## Full page screenshots

Full page screenshot is a screenshot of a full scrollable page, as if you had a very tall screen and the page could fit it entirely.

```
await page.screenshot({ path: 'screenshot.png', fullPage: true });

```

## Element screenshots

You can also take screenshots of elements too:

```
await page.locator('.header').screenshot({ path: 'screenshot.png' });

```

## An example

```
const { test } = require('@playwright/test');

test('Demo video', async ({ page }) => {
  await page.goto('https://playwright.dev');
  await page.screenshot({ path: 'screenshot.png' });
});

```

![screenshot.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1641909952990/H1Iw0ZKq1.png)
Playwright Tutorial For Beginners 7 - Videos
Tags: testing, beginners, playwright, softwaretesting
Published: 2023-04-16 17:18:12

---
title: Playwright Tutorial For Beginners 7 - Videos
published: true
date: 2023-04-16 13:07:00 UTC
tags: testing, beginners, playwright, softwaretesting
canonical_url: https://blog.zt4ff.dev/playwright-tutorial-for-beginners-7-videos
series: Testing with Playwright
---

Playwright can record videos for all pages in a **browser context**.

A [BrowserContext](https://playwright.dev/docs/browser-contexts) is an isolated incognito-alike session within a browser. Just like when you open an incognito window of your browser, the browser state (cache, cookies etc.) is isolated between test.

> Using the page provide by Playwright test runner, `@playwright/test`, the `page` provided in the tests callback opens in a new context out of the box.

To record a video, we will:

- create a new context from a browser with some options in place
- create a new page with from the context
- open a web app in the page
- make sure to close the context (the video is generated after this

We will create a test scripts in `demo.spec.js` and run to generate a video:

```
// demo.spec.js
const { test } = require('@playwright/test');

test('Demo video', async ({ browser }) => {
  const context = await browser.newContext({ recordVideo: { dir: 'videos' } });
  const page = await context.newPage();
  await page.goto('https://google.com');

  await page.type('input', 'playwright');
  await page.press('input', 'Enter');
  await page.waitForTimeout(1000);

  await context.close();
});

```

The test will generate a video in a `/videos` folder.

![generated video](https://cdn.hashnode.com/res/hashnode/image/upload/v1641909639432/RIEo09eW2.gif)
HackerRank: Staircase Solution using PHP (Algorithm)
Tags: hackerrank, hackathon, programming, algorithms
Published: 2023-04-16 13:04:50

## Problem
This is a staircase of size n=4:

```
     #
   ##
  ###
####
```

Its base and height are both equal to n. It is drawn using # symbols and spaces. The last line is not preceded by any spaces.

Write a program that prints a staircase of size n.

**Function Description**
Complete the staircase function in the editor below.

staircase has the following parameter(s):

int n: an integer

**Print**

Print a staircase as described above.

**Input Format**
A single integer, n, denoting the size of the staircase.

**Constraints**

0 < n <= 100

**Output Format**
Print a staircase of size n using # symbols and spaces.

**Note:** The last line must have 0 spaces in it.

## Solution (Based on how i solved it)

```PHP
    $space = " ";
    $hash = "#";
    
    for ($i = 1; $i <= $n; $i++){
        $res = str_repeat($space, $n - $i) . str_repeat($hash,$i);
echo $res. PHP_EOL;

    }
```

Link to the HackerRank: [Staircase Problem](https://www.hackerrank.com/challenges/staircase/problem)
Playwright Tutorial for Beginners 4 - Selectors and Locators
Tags: testing, softwaretesting, qualityassurance, playwright
Published: 2023-04-16 17:05:42

---
title: Playwright Tutorial for Beginners 4 - Selectors and Locators
published: true
date: 2023-04-16 13:04:00 UTC
tags: testing, softwaretesting, qualityassurance, playwright
canonical_url: https://blog.zt4ff.dev/playwright-tutorial-for-beginners-4-selectors-and-locators
series: Testing with Playwright
---

## Playwright locators and selectors

To interact with elements, you need to locate the element first. Selectors are used when locating an element. Then we can perform actions and write assertions on the elements by means of methods such `click()`, `dbclick()`.

Ways to select locate an element in Playwright:

## Text selectors

The selector locates element that contains specified text. e.g

```
test('Locate "Log in" button', async() => {
    await page.locate('text=Log in').click();
});

```

Text selector has a few variations:

- `text=Log in` - default matching case is case-insensitive and searches for a sub string. For instance, `text=Log` matches `<button>Log in</button>`

- wrap the text single or double quotes to make playwright match the exact text. For instance,

- You can make use of a JavaScript-like regex wrapped in `/` symbol. For instance:

- `:has-text` pseudo-class matches an element that contains specified text inside somewhere. It is used with other CSS specifiers because it will match all elements that contain the specified test. For instance

## CSS selectors

CSS selector can be used in Playwright by :

- CSS selector engine, e.g. `page.locator(css='.button')`
- Using Playwright custom CSS locator with additional pseudo-classes like `:visible`, `:text` and many more

**Query CSS selectors directly, for instance**

```
await page.locator('.form > .button');

```

You can read more about [selectors and locators](https://playwright.dev/docs/selectors) in the official documentation.
Playwright Tutorial for Beginners 3 - Trace Viewer
Tags: testing, softwaretesting, qualityassurance, playwright
Published: 2023-04-16 17:02:05

---
title: Playwright Tutorial for Beginners 3 - Trace Viewer
published: true
date: 2023-04-16 13:03:00 UTC
tags: testing, softwaretesting, qualityassurance, playwright
canonical_url: https://blog.zt4ff.dev/playwright-tutorial-for-beginners-3-trace-viewer
series: Testing with Playwright
---

In this tutorial, we will learn about another GUI tool provided by Playwright called the Trace Viewer.

The Playwright Trace Viewer is a GUI tool that helps in exploring recorded Playwright traces after a tests script is executed.

## Recording a Trace

We set the `trace` configuration in the Playwright configuration file, `playwright.config.js`.

For instance:

```
// playwright.config.js

const config = {
    retries: 1,
    use: {
        trace: 'on-first-retry'
    }
};

module.exports = config;

```

When you run a test with the above configuration, a `trace.zip` file would be created for each test that was retried.

> When you specify the `retries` key in the config file, Playwright retries the test until the test is passed or the maximum number of `retries` specified is reached.

Available options for the `trace` key:

- `off` - does not record a trace at all
- `on` - records a trace for each test ran
- `retain-on-failure` - record trace for each test but removes it when the test runs successfully
- `on-first-retry` - record a trace only when retrying a test for the first time

## Lets practice now

- Lets configure trace to run on every test in the `playwright.config.js` file and make use of the `Desktop Chrome` device:

- Lets create a test:

- Running the test with `npx playwright test simple_test.spec.js` would generate a `trace.zip` file.
- You can view the trace by running this command in the CLI. (The `trace.zip` file is stored in the `test-results` folder:

- Doing this would open the Trace Viewer window now you can see the actions performed by the script.

![playwright-trace-viewer-window.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1641908794273/Ud08XvJjN.png)

- The `trace-viewer` shows the action on the script on the left side of the window and clicking each of the actions reveals:
  - action snapshot
  - action log
  - source code location
  - network log for the action
- For instance, clicking on the `locator.click text=Phones`:

![clicked-action-trace-viewer.PNG](https://cdn.hashnode.com/res/hashnode/image/upload/v1641908814835/-40RSUncp.png)

The `trace viewer` is a really useful tool when you want to trace how some of your tests ran (flaky or failing).

You can play more around the tool. And read more on the official [documentation](https://playwright.dev/docs/trace-viewer#viewing-the-trace).