teleren/devto huggingface dataset:
CRUD Operation In PHP
Tags: php, mysql, html, css
Published: 2021-10-15 04:33:56

Today we will see how to create CRUD Operation In PHP,if you are new developer or fresher in web developing then crud operations in php using mysql example help you to learn how to create login-logout with insert update delete record in php.

So, let's see crud operations in php using mysql.

CRUD (Create, Read, Update,Delete) operation is most important part when you are developing your website with backed, I have added some code and simple example of CRUD with steps.

``` 
Step 1 - Create Folder in xampp for CRUD Operation in PHP,
Step 2 - Create Config File and Add Database
Step 3 - Create Display File
Step 4 - Create Login-Logout File
Step 5 - Create Update Delete File
```

---

> **_[Read More : CRUD Operation In PHP](https://techsolutionstuff.com/post/crud-operation-in-php)_**
Remove duplicates from a list in Python
Published: 2021-10-15 04:18:21

I am going straight to the point

```py
my_list = [1, 2, 3, 4, 4, 5, 2]
```
How do we remove duplicate no. or elements from the list.

Simple, we have 3 easy method.

1 Using `set`

```py
my_list = [1, 2, 3, 4, 4, 5, 2]
updated_list = list(set(my_list))
print(updated_list)

#The output will be: [1, 2, 3, 4, 5]
```

As we know that `set` doesn't support duplicate, we can simply use this method to remove duplicates. Here I have type casted the `list` into a `set` and then again type casted in to `list`.

2 Using `dict`
```py
my_list = [1, 2, 3 , 4, 4, 5, 2]
updated_list = list(dict.fromkeys(my_list))
print(mylist)

#The output will be: [1, 2, 3, 4, 5]
```
Well `dict` also doesn't support duplicates so when we convert the `list` to `dict`, so we are creating `dict` from the `list` and then converting it back to list.

3 I don't know what to call this method

```py
my_list = [1, 2, 3 , 4, 4, 5, 2]
updated_list = []
for item in my_list:
    if item not in list:
        updated_list.append(item)
my_list = updated_list
print(my_list)

#The output will be: [1, 2, 3, 4, 5]
```

So that was 3 ways to remove duplicates from a list.
I you got some more methods write down in the comment box below, I would love to see them,  until then bey bye and


Peace ✌
What goes into building a web component
Published: 2021-10-15 04:09:21

Building something as minimal as a card involves careful design considerations. A web component implies re-usability in different applications, so a card has to be built with adaptability and accessibility in mind.

For the purposes of this blog, this card will contain the following sub-elements:
- an icon: represented by an svg file
- a heading: contains the icon plus a title and a sub-title
- a body: contains text and possibly images
- the card: a summation of the icon, heading, and body

For a team of four, each member can be responsible for one sub-element, with the card member assisting in the other three to ensure that they function together. This might be the most *difficult* aspect of the card development process.

If I have learned anything from creating the button component that preceded this, I expect to improve on how I implement css attributes as well as my JS fundamentals.
Flatiron project 4
Published: 2021-10-15 03:30:35

Here we are at number four with just one more project to go! This particular module really made me feel like I made the right decision in choosing a web development career path. Although my project is a bit rough it has still allowed me to prove to myself than I can overcome whatever challenge may come my way by using the strong foundation of knowledge that Flatiron has provided. With that said I will continue to discuss the project and the multiple steps that were followed along the way.

For this project I was required to make a Rails API backend with a JS frontend to make a single page application. The backend seemed simple enough considering that I had spent an entire two months of banging my head against a desk to learn Rails associations and the other multiple moving parts. To my surprise the backend was a very simple has_many association. The first thing that came to mind was creating an app that let users create game reviews that would be stored within descriptive lists such as genres or a custom list title. After creating my models, migrations, and seed data I got to learn a bit about CORS which was basically a security measure used in Rails to only deal with requests from your specified origin. This had to be uncommented and configured before I cold do anything with my frontend.

For my frontend I spent a lot of time studying the 3 pillars of JS how to manipulate the DOM, make fetch requests(POST, PATCH, DELETE), and the fun part EVENT LISTENERS. It was pretty intimidating to know that I would be taking on a second language and would be expected to know enough to demonstrate the 3 pillars over such a short period of time (I gave myself two months). It was quite a journey with multiple frustrations but in the end I rose above and completed the project with a much deeper understanding of not only JS but of Rails also. I look forward to learning React in the next module so I can really bring everything together and feel prepared to take on bigger projects.
如何複製 EC2 到另一個 AWS 帳號
Tags: aws, ec2
Published: 2021-10-15 03:15:10

來自某個任務的需求，必須把 EC2 從 A 帳號複製到 B 帳號，這篇是複製過程的筆記，比較適合的讀者是已經對 AWS 的基礎操作有經驗的人士，畢竟 AWS 的服務真的太多，而且每間公司配置的方式各有差異，不太可能涵蓋到全部的情況，因此這裡談的是最簡化的情況，具體操作還是要根據自家的 AWS 配置做變通。

另外要注意的是本文是「複製」，並不是熱移轉，並且是從 A 帳號複製到 B 帳號，而 AWS 的 Elastic IP 並無法做到跨帳號的轉移，因此 IP 必定會變動的。

<dl>
    <dt>AWS<br>Amazon Web Services</dt>
    <dd>
        亞馬遜雲端服務，全球最大的雲端服務商。
    </dd>
    <dt>EC2<br>Elastic Compute Cloud</dt>
    <dd>
        AWS 最主要的雲端主機租用服務。
    </dd>
    <dt>EBS<br>Elastic Block Storage</dt>
    <dd>
        搭配 EC2 使用的儲存體服務。
    </dd>
    <dt>EBS Volume</dt>
    <dd>卷，可以簡單的理解為硬碟。</dd>
    <dt>EBS Snapshot</dt>
    <dd>卷的快照，一般是做為備份用。</dd>
    <dt>AMI<br>Amazon Machine Image</dt>
    <dd>EC2 開立機台時的映像檔，EC2 是不用自己裝系統的，都是用現有的映像檔生成機台，映像檔可以用 AWS 提供的，也可以拿自己的快照再產生自有的映像檔。</dd>
    <dt>Elastic IP</dt>
    <dd>靜態 IP，在 EC2 開立機台會配一個公開 IP，但每次重開機都會變動，如果要靜態 IP 則需要在 Elastic IP 的頁面做申請，並附掛到一台 EC2 身上。</dd>
    <dt>AWS Region</dt>
    <dd>AWS 全球各地的機房，不同區域提供的服務可能略有差異，不同區域間開立的資源通常也不能直接調動，不同區域間的費率也略有差異。</dd>
</dl>

## A 帳號流程

在 A 帳號，先把 EC2 的 EBS 做個快照，修改快照權限，填入 B 帳號 ID：

![AWS EBS 快照權限](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ncq0qlcg45akd8objvr5.png)

權限對話框的私有／公有選項請選**私有**，若是公有會公開分享到公共區，其他的 AWS 用戶也會看到喔。

帳號的 ID 可以在 AWS 控制台右上角的下拉選單內找到：

![AWS 帳號 ID](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6igzeu95jmyj8uyyvx97.png)

A 帳號把快照分享給 B 帳號後，A 帳號的部分就完工了。

## B 帳號流程

進入 B 帳號的快照區，並切換到「私有快照」，應該就可以看到剛剛 A 帳號分享出來的快照：

![AWS EBS 快照](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/arvejhkn3z5jrqdefhek.png)

接下來要用這份快照開新機器，但這分快照是來自 A 的分享，並無法用它做 AMI，因此先用這份快照還原一份卷，再用卷做一次快照，這樣做出來的新快照就會是屬於 B 帳號的。

有了新快照就可以拿它做 AMI：

![AWS 根據 EBS 快照創建映像](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjuud7gwhsjj7gx2808a.png)

創建映像對話框內的選項應該都不用動，只要填入名稱就可以產出一份 AMI：

![AWS AMI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhfycf3s2y3b57ksnxfe.png)

有了這份 AMI，就可以用它來開新的 EC2 機器了！

## 注意事項

上面的流程是同區域的操作，如果要做跨區複製，可能要額外的步驟。
React Hooks
Published: 2021-10-15 02:44:07

React Hooks were introduced on React 16.8 by Dan Abramov, the creator of React.js

Hooks are a series of features that allows developers to use certain functionalities that were impossible in plain react function components.

We have a series of pre-defined hooks that react offers us, but we also can create our own hooks.

* useState
* useEffect
* useContext
* useReducer
* useCallback
* useMemo
* useRef
* useImperativeHandle 
* useLayoutEffect
* useDebugValue

And we also will create 3 example custom hooks for our projects.

We will explain the hooks and then move into a project only using hooks.

Let's see the React.js hooks rules:

1. Call Hooks only on the superior level:
You can't call hooks in cycles, conditionals, or nested functions

2. Call Hooks only on React Functional Components or custom hooks


The list of pre-defined hooks we will explore will be:

1. useState

2. useEffect

The useEffect hooks is used on data request, subscriptions and manual actualizations. These ones are called "secondary effects"

If you're familiar with React Class Components, then, you will use the useEffect hook to handle the following lifecycle methods: componentDidMount, componentDidUpdate, componentWillUnmount.

Also, there are 2 types of secondary effects, those who requires sanitizing operation and other who don't.

* Those who do not require sanitizing: Those hooks which we can execute and forget about them, for example: Network Requests, Manual DOM Mutations, Register

* Those who require sanitizing: We sanitize effects that could lead to a memory leak

Effects run at every render, so we use the useEffect hook to reeplace some lifecycle methods (componentDidMount, componentDidUpdate, componentWillUnmount)

Returning a function inside the useEffect to indicate react how to sanitize a effect (clean, unmount)

We usually use the useEffect with state variables.

Omiting effects to optimize rendering: If you do not want to run the effect every time the component is updated, then you should consider using the second argument of the hook, the dependency array.

```js
const [count, setCount] = useState(0)

useEffect(()=>{
   setCount(count + 1)
},[count])
```

This effect will run only and if only the count state variable value changes.

We can add more values to it

If we leave the dependency array empty, it will only run once
The obscure `Function#length` property!
Tags: todayilearned, javascript, programming, tutorial
Published: 2021-10-15 02:33:22

Today I found out about another super cool Javascript feature that I'll never use in my life, and I'm here to share it with you! Introducing `Function.prototype.length`.

```js
// there are 2 expected arguments
function foo(bar, baz) {
  // ...
}

foo.length; // so 2 is outputted
```
It's as simple as that! The `length` property exposes the amount of arguments expected by the function in question.

## Specifications 
Rest parameters are **not included** in the final count!

```js
function foo(bar, ...baz) {
  // ...
}

foo.length; // 1 - rest parameters are not counted
```

Also, only parameters *before* a parameter with a default value are counted.

```js
function foo(bar, baz = true, foobar) {
  // ...
}

foo.length; // 1 - only parameters before one with a default value
```

## What's the difference between `arguments.length` and `Function#length`?

As I described above, `Function#length` will show how many parameters are *expected* in a function. However, `arguments.length` (when used inside the function) will show how many were *actually passed*, regardless of whether they were expected.

```js
function foo(bar, baz) {
  return arguments.length;
}

foo.length; // 2 - expects `bar` and `baz`
foo(1, 2, 3, 4, 5); // 5 - five arguments were actually passed
```

## Use Cases

You tell me! I have no idea 🤣

---

I hope you learned a bit about the `Function#length` property! If you have any questions, corrections, or addons, I would love to hear them. Peace ✌
Performing CRUD Operations Using Google Firebase and Blazor
Tags: blazor, webdev, firebase, dotnet
Published: 2021-10-15 02:03:16

Blazor DataGrid provides a comprehensive set of ready-to-use features to create, read, update, and delete records (CRUD) interactively. 

In this webinar, we will see how to perform CRUD operations using the Blazor DataGrid component and Google Firebase as the database provider.

BLAZOR CONTROLS 
------------------ 

Product overview: https://www.syncfusion.com/blazor-components/blazor-datagrid

Documentation: https://bit.ly/3aFmNMe 

Online samples: https://bit.ly/3vgpaP5 

Download free trial: https://bit.ly/3FJQytH 

NuGet package: https://bit.ly/3kJD4Wl

{% youtube AVoPYLwSfHc %}
Can someone tell me how to add 15% of transaction fee to liquidity? 
Tags: programming, opensource, devops
Published: 2021-10-15 01:48:17

// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

import "https://github.com/panacompu/Burn-it-up/blob/main/BEP20Token.sol";

contract CustomToken is  BEP20Token {

    constructor() {
    _name = "Burn it up";
    _symbol = "BIP";
    _decimals = 18;
    _totalSupply = 10000 * 10 ** 18;
    _balances[msg.sender] = _totalSupply;

    emit Transfer(address(0), msg.sender, _totalSupply);
  }

}
Rewriting history in Git
Tags: git, github, node, javascript
Published: 2021-10-15 01:42:58

## Introduction
Hello everyone, my name is Dustin. Today, I wanted to talk about the experience of refactoring my entire code written in Nodejs and rewriting history in Git.

## Process
To be honest, I didn't think that it would be that difficult until I broke the whole thing. I literally had to rewrite everything from scratch. I mean not everything but everything. So first off, I had to create a `readPath` class which mainly will get the path from main to check if it is a folder or other files: `.txt`, `.md`, or `.json` so that I can use different method for different file types. After that, I need a `produceFile` class, which is going to help me in creating `html` file and a `produceFolder` class, which just helps me create a folder in the root directory where the user is sitting at. 

## Comparison
`Before using classes`
I will have around 6 files in my helpers folder [here](https://github.com/tuanthanh2067/cv-ssg/tree/f919ef4e65e1898b7b82b7ce5f8ec3265a7cca08/bin/helpers)

`After using classes`
I just have 3 classes [here](https://github.com/tuanthanh2067/cv-ssg/tree/main/bin/helpers)

And the code is well organized and easy to read even if for beginners who are used to object-oriented programming.

## Achievement
Thanks to the assignment, I got a chance to learn more about rebasing, amending as well as using classes in Javascript. 

## Commit in git
[3fcb0c88](https://github.com/tuanthanh2067/cv-ssg/commit/3fcb0c88b5d6149cd46f0c9b0ae1177fd2b5fe0e)
Considerations when building a Web-Component
Published: 2021-10-10 22:05:44

So you are considering making a web component for a project, what should you consider before you code a single line? How should much you consider making the component specific to the application or general?  In this post, I will go over my team's design considerations for a display card component we are developing for class.
 
Our card should look like the card below and it will be used in online-course websites for Math or Science courses.  Each card regardless of type has two titles, an icon, and a large section meant to put bulleted text.  When deciding how to attack this project we asked a series of questions: 
* What are the characteristics of the card?
* What design considerations must we take into account?
* What accessibility concerns do we potentially have?
* What security concerns do we potentially have?
* What "states" does this card have?
* What do we call it?
* Do we have room for additional reusable atoms to be produced?
 
Let's go and answer some of these questions.  I broke it down already but we have a header and sub-header text, an icon, a content area for a bulleted list, and a colorized banner in the header.   Looking at the example card it is possible to imagine someone may have a long title or have a smaller icon or several other exceptions.  In general, we must consider scaling of text for the header and list; the color of the banner based on content, changeable icons, and consistency of the margins and padding just to name a few.  When it comes to accessibility we need to ensure that the text inside of the card is accessible to a screen reader; the font on the card is a reasonable size; have a high contrast option; ensure the text inserted can be for any language, and ensure the card can be "tabbed" through.  Security for us is boiled down to SVG file vulnerabilities and content modification most of the content is loaded in via an API.  A card can be clicked, disabled, and focused/hovered.  Cards also have a state based on if they are a Math or Science card.  To keep this card abstract we can have a colored banner, Icon, Skeletal Card which outlines a header and body subcomponent, and the entire card itself to help with margins.
 
 
What difficulties do I expect to experience?  Mainly how to adjust font size and padding based on the length of the text and slotted content.  I do not have a lot of experience with CSS so learning to dynamically change it will be difficult for me.  This component will be practicing encapsulation from other languages except in HTML.  Planning of the slot values will also be difficult.  Considering how four components do need to work with one another, planning these values will be more difficult than coding them.
How is Python Transforming Enterprise App Development in 2021?
Tags: development, python, softwaredevelopment, technology
Published: 2021-11-25 12:17:46

---
title: How is Python Transforming Enterprise App Development in 2021?
published: true
date: 2021-10-15 01:38:00 UTC
tags: Development,Python,SoftwareDevelopment,Technology
canonical_url: https://www.botreetechnologies.com/blog/python-for-enterprise-app-development/
---

Here’s the big news – Python has taken over C and Java to become the #1 programming language in the world. After 20 years, TIOBE’s index witnessed a programming language other than Java, C, and JavaScript to become the leader. Python, in all its glory, is one of the most dynamic and powerful programming languages to reach this spot.

From using Python for enterprise applications to Machine Learning solutions, the heavy growth of Python is due to its versatility. It is helpful in places where other programming languages can’t reach – AR & VR, AI, Data Science, and much more. 

Today, there are 8.2 million+ Python developers in the world, and the number is multiplying every day. The capability of Python for enterprise app development also makes it the first choice for companies that want digital solutions. [Python development services](https://www.botreetechnologies.com/python-development) that focus on enterprise-grade applications are in heavy demand due to the different functionalities that the programming language offers.

This article will highlight why Python is used for enterprise applications. It will also address whether Python is good for scaling enterprise applications when the need be. Since Python is now the #1 programming language, the article will explore why enterprises use it for their digital solution requirements. 


The post [How is Python Transforming Enterprise App Development in 2021?](https://www.botreetechnologies.com/blog/python-for-enterprise-app-development/) appeared first on [BoTree Technologies](https://www.botreetechnologies.com/blog).
String.prototype.padEnd() and String.prototype.padStart()
Tags: javascript, beginners, tutorial
Published: 2021-10-15 01:14:00

**Goal:** To understand and learn how padding a string in JavaScript works.

###String.prototype.padEnd()
`padEnd()` is a string method which pads the **end** of the current string with a **strPadding** up to a **specified length**.

**Syntax**
`padEnd(specifiedLength)`
`padEnd(specifiedLength, strPadding)`

The `specifiedLength` is the length of the resulting string once the padding has been applied to the current string. Note that if this value is less than the current string's length there will be no visible change.

The `strPadding`  is the specific string that will be applied to pad the end of the current string. This parameter is optional. Note that if the length of this string padding is greater than the `specifiedLength`, it will be cut or shortened to fit within the `specifiedLength`.

**Examples**
```javascript
let sayIt = 'Please'
console.log(sayIt.padEnd(12))       //"Please      "
console.log(sayIt.padEnd(12,'*'))   //"Please******"
console.log(sayIt.padEnd(8,'***'))  //"Please**"
console.log(sayIt.padEnd(5))        //"Please"
```
######Since there was no specified `strPadding` on the first example, spaces are applied instead.

###String.prototype.padStart()
`padStart()` is another string method which pads the current string and works similarly with `padEnd()` but on this method the padding is applied at the beginning of the current string. A `strPadding` will be applied to pad the **start** of the **current string** to meet the `specifiedLength`.

**Syntax**
`padStart(specifiedLength)`
`padStart(specifiedLength, strPadding)`

**Examples**
```javascript
let callMe = 'Maybe'
console.log(callMe.padStart(10))        //"     Maybe"
console.log(callMe.padStart(6,'*'))     //"*Maybe"
console.log(callMe.padStart(7,'123'))   //"12Maybe"
console.log(callMe.padStart(1))         //"Maybe"
```
######On example 3, the length of our current string is 5 and we wanted to pad the start with `'123'`. Since the length of the resulting string is 7, only `'12'` was applied at the start and the last one which is `'3'` was cut off.

Again it is important to note the relationship between `specifiedLength` and `strPadding` and with the current string. If the `specifiedLength` is less than the length of the current string then there will be no change to the resulting string and if the length of `strPadding` is way too long than the `specifiedLength` then it will be cut or shortened to fit in the criteria of the `specifiedLength`.

This concludes the tutorial about the `padEnd()` and `padStart()` methods of a string in JavaScript. I hope you enjoyed reading and that it helped you understand how these methods work.