teleren/devto huggingface dataset:
Deploy contract with Hardhat th.
Published: 2022-03-08 10:15:30

บทความนี้เหมาะสำหรับคนที่มีความรู้เรื่องการ deploy smart contract อยู่แล้ว
* แต่ปัญหาที่เจอ Hardhat ไม่ support บาง chain เช่น klaytn ใช้ truffle เหมือนเดิมดีกว่า

# Hardhat vs Truffle
ส่วนตัวผมนั้นเคยใช้ Truffle เป็นประจำอยู่แล้ว จากประสบการณ์ การเขียน smart contract มันมี step เดิมๆ ที่ต้องใช้ tool 2 ตัวนี้
- test 
- run test chain (อาจจะใช้ ganache หรือ testnet ก็ได้)
- complie
- deploy

# Setup Hardhat
ใช้ npm ธรรมดาเลย
```
npm install --save-dev hardhat
```
# Debug
ข้อดีของ hardhat เวลา debug เราสามารถใช้ console.log ได้เลยซึ่จะมีในตัวอย่างตอนที่เราสร้างขึ้นมาตาม command ข้างล่าง

# Command 
## Create project 
```
npx hardhat
```
ตรงนี้แล้วแต่จะเลือกเลยจะใช้ อะไรผมชอบ typescript 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pba3xgq68xltl5l8ytgc.png)


## Compile
```
npx hardhat compile 
```

## Test
```
npx hardhat test
```

## Run test chain
```
npx hardhat node
```
## Config Hardhat
[https://hardhat.org/config/](https://hardhat.org/config/)

## Deploy contract

```
npx hardhat run scripts/sample-script.js
or
npx hardhat run scripts/sample-script.js --network localhost 
# สำหรับเลือก network
```

หลังจาก deploy มัน auto verify code ให้เลยถ้าจะปิดหาวิธีเองนะ

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


# สรุป
รวมๆ เป็น tool ที่ครบเครื่องมากๆ ในการ dev ไม่ว่าจะเป็นตัว plugin verify code, ตัว run chain test , test lib ต่างๆ  รวมถึงตัว debug สุดล้ำ
* ข้อเสียอย่างเดียวเลยคือ ไม่ได้ support ทุก chain แต่จะ dev ในนี้ไป deploy ใน truffle ก็ไม่เสียหาย hardhat ก็เทสไปใช้เท่าที่ใช้ได้ 555
Encryption - Decryption in BrightScript / Roku
Tags: brightscript, rokusdk, scenegraph, roku
Published: 2022-03-08 10:09:07

---
title: Encryption - Decryption in BrightScript / Roku
published: true
description: Perform encoding - decoding in BrightScript / Roku
tags: #brightscript #rokusdk #scenegraph #roku
cover_image: https://images.pexels.com/photos/4973899/pexels-photo-4973899.jpeg?cs=srgb&dl=pexels-dan-nelson-4973899.jpg&fm=jpg
---

In this article, we will see how can perform Encrypt and Decrypt a string using the ToBase64String() and ToAsciiString() functions available in BrightScript respectively.

## Encryption
```
ba = CreateObject("roByteArray")
ba.FromAsciiString("123456")
encryptedString = ba.ToBase64String()
```

## Decryption
```
ba = CreateObject("roByteArray")
ba.FromBase64String(encryptedString)
encryptedString = ba.ToAsciiString()
```
5 WooCommerce Best Plugins in 2022
Published: 2022-03-08 10:06:23


To maximize your online store conversion and users engagement, the ease of site navigation and easier checkout and order placement online require various types of addons, plugins and extensions that fully make a site functioning and user-friendly. Here we enlist some popular plugins that will enrich the user experience and increase the user's dwell time. 

- [WooCommerce video in product gallery](https://woocommerce.com/products/add-featured-videos-in-product-gallery/) Plugin
- Biometric Login Plugin 
- Facebook Chabot
- Cart Discount 
- WhatsApp Chat Plugin
Before investing, know about the tax on cryptocurrency in India
Tags: cryptocurrency, blockchain, productivity, ankitgupta
Published: 2022-03-08 09:41:48

**Budget 2022 tax announcements for cryptocurrency in India states -**

1. Income (Any gains or losses made from a crypto asset held less than 12 months / Financial year) from any transfer of crypto, even gifts, would attract a **30% tax**
2. Investors will also have to face **additional 1% TDS** (Tax Deducted at Source) on digital asset transfers above a certain threshold, which will allow it to capture transaction data with the government.
3. In addition, investors cannot get any deductions and won’t be allowed to set off losses from transfer of such assets against any other income.
4. As a disclosure requirements the taxpayers will have to report income from crypto through a separate column while filing I-T returns.
5. RBI-backed ‘digital rupee’ to be launched in FY23.

> **_Conclusion:_** _The higher tax rate also hints at tougher crypto regulations & government wants people to be aware of the higher volatility & risk into crypto market before investing into crypto._

> _Happy Leaning!_

**Connect me on Twitter for regular updates on such informative contents @** [**MrAnkitGupta01**](http://twitter.com/Mr_AnkitGupta01)

> **_I’ll be happy to connect you on my socials :)_** [**_Ankit Gupta_**](http://ankitgupta.bio.link) 🔗
How to read Feeds in PHP
Tags: beginners, php, webdev, feeds
Published: 2022-03-08 09:34:55

A Feeds is an xml file which contains the information about website. For an example xml file of E-Commerce website contains information about products, categories, offers, tags. The data in xml(Extensible Markup Language) file contains in the form of structured tags. In this article, we will learn how to read feeds in php.

Here we will read the xml feeds of our website URL w3courses.org/feed/

```php
<?php

$xml=simplexml_load_file("https://www.w3courses.org/feed/") or die("Error: Cannot create object");

foreach ($xml->channel->item as $key => $value) {
	print_r($value);
}

?>
```
We used the function [simplexml_load_file ](https://www.w3schools.com/php/func_simplexml_load_file.asp)to read the feeds in PHP. SimpleXML is a PHP extension that allows us to easily manipulate and get XML data. Inside the print_r we have the information about item tags.

The SimpleXML Parser in PHP
SimpleXML is a tree-based parser. It provides an easy way of getting an element’s name, attributes and textual content if you know the XML document’s structure or layout.

SimpleXML turns an XML document into a data structure you can iterate through like a collection of arrays and objects.

Compared to DOM or the Expat parser, SimpleXML takes a fewer lines of code to read text data from an element.

---
Please like share and give positive feedback to motivate me to write more.

For more tutorials [visit my website](https://www.w3courses.org/tutorials/) or follow me.

Thanks:)
Happy Coding:)
Subtitles on Twitter are a pain. You should include them anyway. Here's how.
Tags: a11y, twitter
Published: 2022-03-08 09:32:28

Video subtitles on Twitter are a PAIN IN THE ASS.

NO, that's not an excuse to exclude them from your videos.

Let's make it less of a pain in the ass in 2 minutes or less.

Twitter video is great for engagement. But for it to have as wide a reach as possible, you need subtitles.

Turns out, however, adding subtitles to your video is a huge headache.

In 2 minutes, it'll be less of a headache.
 
Read on.

## Step 1: Upload your video

To upload your video on Twitter, first head to [Media Studio](https://studio.twitter.com/), on either desktop or mobile.

Click on Upload Media.

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

and select your video.

## Step 2: Create the subtitles file

Next step is to create the subtitles file.

It's called an SRT file.

It looks like this:

```srt
1
00:00:02,000 --> 00:00:08,000
This is some text

2
00:00:08,000 --> 00:00:10,000
This is some more text

3
00:00:10,000 --> 00:00:22,000
Even more text
```

* The first line is the order for each line of your subs, starting with 1

* The second line is the starting and ending time. Example: `00:00:02,000 --> 00:00:08,000` means that the line starts at 2 seconds and ends at 8 seconds

* The third line is the actual subtitle text.

Use Notepad, VSCode or any text editor to create your own file. Follow this pattern each time somethin in your video needs subtitling (speech, sounds etc).

## Step 3: Add the file to your video

Save your subs file as a `.srt` file.

Go back to the [Media Studio](https://studio.twitter.com/) and click on your video.

Click on the Subtitles tab.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/apxg9of4jicktxhbvmyj.png)
 
Choose a language (eg. English) from the dropdown and click Upload.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a4p0mt5dbo6qgmkr8fsy.png)
 
Choose the `.srt` file you just created.

It should soon be added to the Languages list below.

You're done! The subtitles should soon show up on your video!

## Step 4: Tweet your video

Use the Tweet button to share your subtitled video.

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

Your viewers should be able to see the subtitles by clicking the "CC" button at the bottom right of the video.
 

Your viewers should be able to see the subtitles by clicking the "CC" button at the bottom right of the video.
Nevertheless, Lydia Zaki Keeps Coding in 2022
Tags: wecoded, womenintech, webdev
Published: 2022-03-08 09:24:18

Hello world! I'm Lydia Zaki and my journey in the world of technology is pretty funny. Sooo, let's go!

## How I began?
2013 - I started my tech journey during high school and I was placed in computer science class. However, I decided to change to pure science class because I see myself wearing a lab coat and becoming a doctor. But, two years later, my SPM results did not turn out what I hoped for... but... oh well, life must go on.

2015 - I was offered science stream module 2 in matriculation, and the subjects were chemistry, physics, computer science
and mathematics. Sooo, I still have a chance to wear a lab coat! A year later, BAM! I got A for my computer science subject...the only A.

2016 - So, after I graduated from matriculation, we were given 20 selections to choose from any courses and fields that suits our results. Out of 20 selections, I placed computer science in 20th place, the 19 above were any chemistry related fields. But, months later, to my chagrin, I'm being enrolled to Graphic Technology and Multimedia, one of the computer science courses... The last option I have placed. At this point, I was like, fine, I accepted my fate and let's have it a go.

2020 - Four years later, I graduated with 6 dean's list in Graphic Technology and Multimedia. Woohoo!

Fast forward to 2022, after all the impromptu decisions, I am one of the developers in REKA Inisiatif Sdn. Bhd.

## My biggest technical goals are…
- To learn as much as I can and expand my technical skills in different areas
- To help my colleagues and others in their coding journey
- To become a better developer and contribute as much as i can in the company

## I pledge to break the bias in tech by…
Support and motivate other women and minorities to break out of their comfort zones. Explore and do what you love, no matter what society tells us to do. And of course to recognise their success.

## Advocating for myself looks like…
Getting up every day and doing what you know it is best for you and become the person you want to be and help others.

KEEP MOVING FORWARD!
How to save text file in database using PHP?
Tags: php, beginners, database, mysql
Published: 2022-03-08 09:22:55

In PHP we can process the file as many ways like uploading image file, processing video file, uploading audio file, saving a zip file etc. Sometimes we needs to get and save the data from text file also. So, here we will learn how to save text file in database using PHP.

We will simple use [$_FILES](https://www.php.net/manual/en/reserved.variables.files.php) array, [get the contents](https://www.w3schools.com/php/func_filesystem_file_get_contents.asp) from it and [explode ](https://www.w3schools.com/php/func_string_explode.asp) the contents. Then gets the data line by line using foreach loop and finally save the data in database.
{% embed https://www.youtube.com/watch?v=Ok0h_hv_W_8 %}
Simply create a file save.php, paste the code given below and run the file at your localhost or server.

```php
<?php
/*database connection*/
$host = 'localhost';
$dbname = 'file_in_db';
$username = 'root';
$password = '';

$conn = new PDO('mysql:host='.$host.';dbname='.$dbname,$username,$password);
/*database connection*/

/*submit form*/

$success = $error = '';

if (isset($_POST['submit']) && $_POST['submit'] == 'Submit') {
	
	if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		
		$content = file_get_contents($_FILES['file']['tmp_name']);

		$content = explode("\n", $content);

		foreach ($content as $key => $value) {
			
			try{

				$currentDate = date('Y-m-d H:i:s');

				$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

				$sql = 'INSERT INTO `emails`(email,created_at) VALUES("'.$value.'", "'.$currentDate.'")';

				$conn->exec($sql);

				$success = 'Email Inserted';

			}catch(PDOException $e){
				$error = 'All Emails Not Inserted';
				echo $sql.'<br>'. $e->getMessage();
			}

		}

	}
}

/*submit form*/


?>

<!DOCTYPE html>
<html>
<head>
	<title>Save Text File in Database</title>
	<style type="text/css">
		.success{
			color: green;
		}
		.error{
			color: red;
		}
	</style>
</head>
<body>

	<center>
		<?php if($success): ?>
			<h3 class="success"><?php echo $success; ?></h3>
		<?php endif; ?>

		<?php if($error): ?>
			<h3 class="error"><?php echo $error; ?></h3>
		<?php endif; ?>
	</center>

	<center>
		<h1>Save Text File in Database</h1>
		<form method="POST" enctype="multipart/form-data">
			<input type="file" name="file"/>

			<input type="submit" name="submit" value="Submit">
		</form>
	</center>

</body>
</html>
```
In the above code we have used the [PDO ](https://www.php.net/manual/en/book.pdo.php) for database connection and execute the query.

Please like share and give positive feedback to motivate me to write more

For more tutorials [visit my website](https://www.w3courses.org/tutorials/).

Thanks:)
Happy Coding:)
cz-git, A lazy man's commitizen adapter.

Tags: node, javascript, typescript
Published: 2022-03-08 09:20:47

For the past year, I have been committing almost every day, and as a lazy software engineer I realized that almost all commitizen adapters are not very comfortable for me to use.

For example, if I repaired the table in the monorepo ui library, I must subconsciously fix the table. Why do I need to keep selecting up and down? I just want `fi` to press Enter to output `fix`, `ta` to press Enter to output `table`. so that I made the cz-git adapter.

guide | website: http://cz-git.qbenben.com/

github: https://github.com/Zhengqbbb/cz-git
What is Semantic HTML?
Tags: html, beginners, devjournal, frontend
Published: 2022-03-08 09:08:33

Producing semantic HTML originates from the desire to communicate, which should be the primary purpose of every online page. By including semantic tags in your text, you convey more information about it to the browsers and, importantly, search engines.

**Semantic HTML tags indicate what the different sections of an [HTML Document](https://worldofdev.info/basic-html-document-structure/) are instead of merely how they look. This is a key principle in web design and semantic HTML tags make it easier to see what information is on the page and its importance.**

**Table Of Contents**

1. [What is semantic HTML?](https://worldofdev.info/what-is-semantic-html/#what-is-semantic-html) 
2. [Semantic HTML tags](https://worldofdev.info/what-is-semantic-html/#semantichtml-tags)
3. [Conclusion](https://worldofdev.info/what-is-semantic-html/#conclusion)

## **What is semantic HTML?**

Not all tags are created equally in HTML.  Some are semantic tags, and some are **non-semantic**. Elements such as `<div>` and `<span>`  tell the browser nothing about the content, making them **non-semantic**.

**Semantic** elements such as `<header>`*, `<nav>`*, and *`<footer>`* provide browsers with a clear definition of the content within the tag that defines its content.

## **Semantic HTML tags**

### **Header:**

The `<header>` tag is normally used for a banner image or a series of navigational links (see `<nav>` below). The typical contents of a `<header>` element are elements like an `<h1>` tag or a logo.


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

For more code examples that you can copy and explanations of the **[different Semantic HTML sections](https://worldofdev.info/what-is-semantic-html/)** **[click here](https://worldofdev.info/what-is-semantic-html/)**
One color palette a day with example. - 004
Tags: design, webdev, uiweekly
Published: 2022-03-08 08:46:23

www.colorsandfonts.com

## Color and typography for Web Developers and Digital Designers.

From today, I will sharing 1 Color palette a day as I did before, when I started Colors & fonts.


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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kklew3lktsklf3l8uvj.jpeg)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/64792ac5lj2vmottg7ls.jpeg)

You will find them here, Dribbble, Instagram, Pinterest and Twitter.

Since 2017 - 2022
Arrays in solidity for complete beginners
Tags: beginners, blockchain, web3
Published: 2022-03-08 08:45:28

When you want a collection of something,you can use an array. There are two types of arrays in solidity.

1. **Fixed arrays**.
2. **Dynamic arrays**.

_// Array with a fixed length of 2 elements._
**Uint[2] fixed array;**
_//Another fixed array, can contain 5 strings:_
**String [5] string array;**
_// A dynamic array- has no fixed size , can keep growing and increasing._
**Uint[ ] dynamic array;**
**Person [ ] people;** /_/ dynamic array,we keep adding._
 **Note:**
- Remember that state variables are stored permanently in the Blockchain?
- So creating a dynamic array of structs like this can be useful for storing structured data in your contract, kind of a database.

**PUBLIC ARRAYS**
You can declare an array as public, and solidity will automatically create a **getter** method for it. The syntax looks like:
Person [ ] **public** people.
So other contracts could be able to read from, but not write to, this array. So this is a useful pattern for storing public data in your contract.
Build A Tkinter App (Part 1 / Basics) - Python
Tags: learn, python, computerscience
Published: 2022-03-08 08:44:57

Today we're going to use a usefull library in python to build awesome applications. We'll use : [`Tkinter`](https://docs.python.org/fr/3/library/tkinter.html).

![Image description](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSlPahCP6G8aYJFvBy8-KMzH9Zq6QlIFbBRKw&usqp=CAU)

In this first part, we'll know how to create the base of our application. In a second part, we'll see the different widgets, this module propose to us and how to display them. And finally, in a third part, the inputs and actions.

---

## <u>The module : </u>

First Tkinter is a module that can create some GUI applications for all plateforms as Windows, Mac OS and Linux. If you have Python already installed on your computer, you have surely tkinter with it. If it's not you can run this command in the console :

```
pip install tkinter
```

---

## <u>The base of the app :</u>

So, let's start with the script. Create a file with the `.py` extension (PS : you can use `.pyw` extension if you want to hide the console when the script is running).

In this empty file, insert the import of Tkinter :

```python
import tkinter # Basic import
from tkinter import * # Import all propreties from tkinter module
```
We'll use the second import because it's a better way to do.

Now, we can create a variable that store the application :

```python
app = Tk()
```

After that, we can asign some options to the app :

1) A title : `app.title("Our Application")`
2) A size by default : `app.geometry("600x400")` -> "widthxheight"

And now, we can finally finish the programm by this line :

```python
app.mainloop()
```
Like that our app can run on the screen.

---

# <u>Full script :</u>

```python
from tkinter import *

app = Tk()
app.title("Our Application")
app.geometry("600x400")

app.mainloop()
```

# <u>Output :</u>
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sjk4jpf45mwn0sqp2py1.png) 
Yeah, an exmpty screen... But it's a good start.

---

As you see, create a desktop application with tkinter is very simple. In the next post, we'll see the different widgets we can add to our app and how to display them on the screen.

If you have some questions on this first part, please write it in the comment section below.

I hope this help you. And see you soon. Bye bye 👋👨‍💻
3 Ways a Duplicate Content Checker Can Help You
Tags: beginners
Published: 2022-03-08 08:27:24

Plagiarism is one of the issues which writers face. Even if writers pick up an easy topic, they do have to face plagiarism. Because the internet is the ocean of content and there you can find millions of works like [Coursework Help Online Services](https://allessaywriter.com/coursework-help.html) even if you are searching for something unique. What writers do is that they paraphrase the content and write it in their own words. In that way, they can manage plagiarism. But still, they do face these issues regularly. Let's discuss three ways by which Duplicate Content Checker can help you. 
1.You can lose your client - Yes, if you deliver plagiarised content, you will need a [Dissertation Help Online Services](https://allessaywriter.com/dissertation-help.html) USA otherwise you may lose your client. The client pays you the amount you claim, and in return, they want unique content. That is why it is always suggested that you do not write plagiarised content. Even if you do note by mistake then always check your plagiarism using a tool. You can download the Plagiarism report by Turnitin. Or you can even use Grammarly Premium to prevent plagiarism when you making [Do My Homework Expert Assistance](https://allessaywriter.com/do-my-homework.html). 
2.Affects the quality - Yes, plagiarism does affect the quality of your work like when you are making [Online Essay Editing Service Help](https://allessaywriter.com/essay-editor.html). That is why it is suggested that you always take your time in paraphrasing from where you are deriving the actual content of your work. You can use an online Plagiarism checker. 
3.It may affect your name in the market - If you continuously deliver plagiarized content then it may affect your name in the content writing need. And in that case you will be needed [Exploratory Essay Help Experts Online](https://allessaywriter.com/exploratory-essay.html). You may stop getting orders anymore. You may even get blacklisted. Always use a Plagiarism scanner. It will check the plagiarism in your work. 
Conclusion
From the above discussions, it can thus be said that you always need to check plagiarism before you submit the work like [Term Paper Help Online Services USA](https://allessaywriter.com/term-paper-help.html). If you get caught delivering plagiarism content, then it may affect your career as a writer. 
Always paraphrase and write. In that way, you will be able to work, and also you will also be able to beat plagiarism.
Blog Reference: [https://redsocialgoool.com/read-blog/48994](https://redsocialgoool.com/read-blog/48994)