teleren/devto huggingface dataset:
Automate Backup database SQL Server in docker container.
Tags: sql, linux, docker
Published: 2021-05-17 13:17:41

Hi, everyone. This is first my post in dev.to and my first time for write article in second language. today I want to share some trick for backup your database from docker container. let's begin... :blush:
**Note** I assume your already running container. 
### 1. Write T-SQL for backup your database.
For example I use TutorialDB database for demonstrate purpose. Your can create same database click [Create a database](https://docs.microsoft.com/en-us/sql/azure-data-studio/quickstart-sql-server?view=sql-server-ver15#create-a-database)
```
PRINT "Start Backup process...";
DECLARE @MyFileName varchar(200)
SELECT @MyFileName=N'/tmp/Backup_' + convert(nvarchar(20),GetDate(),112)+'_'+convert(nvarchar(20),GetDate(),108)+ '.bak'
BACKUP DATABASE [TutorialDB] TO DISK=@MyFileName
PRINT "Finished backup process...";
```
Then save above T-SQL to backup-database.sql
### 2. Copy backup-database.sql file to your container.
For example I just copy it to tmp directory. You can copy it to any your directory.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nwiuc0jggck83goacj1u.png)
Then go inside container and see in tmp directory as below
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tw5e3z8anxenfrs62tzw.png)
### 3. Update packages list to new version.
Go inside your container by docker exec cli as below
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/27l83eru4ept5gmu5cfl.png)
**Note** You need to use --user root (option) for update package list.
Now, update package list by apt-get update -y as below
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n5zisiqcobmgvzat2y41.png)
Then you will installing 2 package such as vim and cron as below
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u67zj8nurlnvl0hnrjku.png)
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2mmleibq9yok9i8a8gl.png)
### 4. Add sqlcmd cli to crontab by cron -e cli as below
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/leod92unp5vtvhi0k8zz.png)
For example above configuration is running backup-database.sql every 1 minute. Keep in mind it's just example for show how it work. Next you want to restart crontab for start your schedule job like this
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtuk50cojg5apimviz7c.png)
### 5. see log by tail -f /tmp/daily-backup.log & .bak files.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6sgtut8xpcfvvh3101gu.png)
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbagw2p288kyzsbsf50e.png)

**_Until we meet again. Thank you_** :rocket: :rocket: :rocket:
What are the essential features of school management software?
Published: 2021-05-17 12:24:10

Fee management is one of the most important functions of a school. A fee management application supports the collection and management of fees paid by the students, as well as the entire accounts management process including earning and expenses. Most of the school fee management software in India include features and modules for managing fee collection, records, scholarship, configurable fee structures etc. With such features, you can set a configurable fee structure for various students, manage tuition fees, transport fees, caution deposits, exam fees, etc. The modules can also assist in accounts management and receipt generation. for more detail plz follow this link <a href="https://www.edneed.com">School Management Software</a>
Download Youtube video to mp3 with Python
Tags: python, showdev, tutorial, productivity
Published: 2021-05-17 12:18:10

I often need to download videos from Youtube in  `mp3` format. There are many websites where you can convert Youtube videos to `mp3`, but I am giving you a simple Python script that does the same job. 

I am using [youtube_dl](https://pypi.org/project/youtube_dl/). Command-line program to download videos from YouTube.com and other video sites. It requires the Python interpreter, version 2.6, 2.7, or 3.2+, and it is not platform-specific. It should work on your Unix box, on Windows, or on macOS. 

Let's jump to the code: 

```python
import youtube_dl
def run():
    video_url = input("please enter youtube video url:")
    video_info = youtube_dl.YoutubeDL().extract_info(
        url = video_url,download=False
    )
    filename = f"{video_info['title']}.mp3"
    options={
        'format':'bestaudio/best',
        'keepvideo':False,
        'outtmpl':filename,
    }

    with youtube_dl.YoutubeDL(options) as ydl:
        ydl.download([video_info['webpage_url']])

    print("Download complete... {}".format(filename))
   
if __name__=='__main__':
    run()
```

Just enter the URL of the song and the script will download that song in `mp3` format, cool isn't it?

Thank you all.
Daily Developer Jokes - Monday, May 17, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-05-17 12:00:01

---
title: "Daily Developer Jokes - Monday, May 17, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Monday%2C%20May%2017%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259369613c.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ How does a sysadmin keep a fire going?

___A:___ They rotate the logs.
 -->
Quizzes and Assignments to Understand Ethereum client
Tags: blockchain, ethereum, dapps, geth
Published: 2021-05-17 11:52:00

## Pre-requirement

You can start this training material without taking any previous course.

## Knowledge

Here, you can Learn the following knowledge.

- Ethereum Client
  - Geth
- Node Service
  - Infura
- Development tools
  - Hardhat
- General Information
  - Docker
  - Curl

## Quizzes and Assignments

### Part 1: Running Geth in Local Environment

#### QUIZZES

- What is Geth?
- What can you do with Geth?
- Is there any alternative to Geth? What is the difference between the tools?
- What is the difference between light-node, archive-node, full-node?
- What is docker?
- What is the difference between Mainnet, Rinkeby, Private Network in the Geth setting?

#### Assignments

- Run "Hello, world" with docker.
- Run docker Geth Mainnet in local.
- Run docker Geth Rinkeby in local.
- explore blockchain info from Geth Javascript console (ex. eth.getBlock(0))
- Run docker Geth private network in local.

### Part 2: Infura, the Node Service

#### QUIZZES

- What is Infura?
- Is there any alternative to Infura? What is the difference between the platforms?
- What is Curl?
- What is JSON RPC?

#### Assignments

- Create an account and create your project in Infura.
- Get current block number, get block information, get transaction information, get balance for a specific account from Infura node by curl.

### Part 3: Local Development Environment

#### QUIZZES

- What is Hardhat?
- Is there any alternative to Hardhat? What is the difference between the tools?

#### Assignments

- Run Hardhat local chain.
- Get current block number, get block information, get transaction information, get balance for a specific account from a local chain by curl.
- Run Hardhat Mainnet fork node.
- Get current block number, get block information, get transaction information, get balance for a specific account by curl.
[tips]Download File in Android with OkHttp
Tags: kotlin
Published: 2021-05-17 11:47:02

####Reading the file
ตอนที่เราดาวน์โหลดมันข้อมูลที่เราได้จะมาในรูปแบบ stream of data เราจึงต้องอ่านทีละส่วนเพื่อประกอบเป็นไฟล์ลงในเครื่อง

ซึ่งใน Kotlin เราสามารถทำได้อย่างง่ายดายด้วย code ไม่กี่บรรทัด ตัวอย่างด้านล่าง
```
body.byteStream().apply {
    file.outputStream().use { fileOut ->
        copyTo(fileOut, BUFFER_LENGTH_BYTES)
    }
}
```

อย่างไรก็ตามการใช้ copyTo มีข้อเสียอย่างหนึ่งคือเราไม่สามารถรู้ progress ในการทำงานได้
Ethereum Application Development Guide
Tags: blockchain, ethereum, dapps, solidity
Published: 2021-05-17 11:41:06

This document is a blockchain application development guide created by [BlockBaseLab](https://discord.gg/dGGwjKmcwH) peer learning community. About the detail of the community, please refer to [this document](https://medium.com/blockbase/introduce-blockchain-peer-learning-community-84de3bb0092d).

## About this 

### Self Learning & Peer Learning
We prioritize self-learning and peer learning. So most of the guide will only contain quizzes and assignments. If you have any questions, please join the [Discord](https://discord.gg/dGGwjKmcwH). Then, please submit it in [GitHub](https://github.com/block-base/learning-blockchain-community) when you want to get your submission reviewed.

## Levels
We categorize each material into three levels—basic, intermediate, advanced. 

The basic is for fundamental knowledge to understand blockchain products. This level includes Ethereum client, data model in Ethereum, solidity smart-contract development basic, building frontend using web3.

The intermediate level is learning from actual Ethereum applications such as Maker, Compound, Uniswap, etc. This level is mainly composed of smart-contract reading. And it also includes some existing hacking methods to make you evaluate the risk of the Ethereum application.

The Advanced level is not only just learning but also making some money building actual products. This level provides hands-on to build a product that benefits you.

## Contents
### Basic
- [Quizzes and Assignments to Understand Ethereum client](https://dev.to/blockbase/ethereum-application-development-guide-basic-ethereum-client-3kmo)

### Intermediate
Under creation. Please stay tuned!

### Advanced
Under creation. Please stay tuned!

If you have any questions or requests for new material, please leave a comment or join our [community](https://discord.gg/dGGwjKmcwH)!
What To Look For When Hiring A Laravel Development Company for Laravel Web Application
Tags: laravel, php, zend
Published: 2021-05-17 11:39:44

When you’re looking for a Laravel development company, you must be aware of some of the things before giving it a go. There is no doubt that the laravel is one of the best php frameworks. If you’re also looking for a customized web application then you’re on the right track.

In Laravel web application development, the developers use the model view controller which is very handy, useful and truthfully works better than the PHP. With the right laravel development company, your application will finish quickly and errorless. Laravel’s features include caching, routing and session which will avail you to have your work on time.

In my opinion, you mustn’t directly go for a company which is offering you cheap prices for your project. If your application is crucial for your business than I reckon to wait, think and then decide scenario. Cheap plans often end up with either poor quality application or cheap tricks with crossing the deadline with the increase in expense and still never get the quality work.

Concentrate on these pointers before hiring a company for the laravel web application development -


Before you open the project, understand what kind of developer are you looking for. There is two sort of developers one of which work on back-end while the other one works while some of them work on the user interface.
Now, observe your budget. What kind of budget you have for your project? Budget is very important here because if it is estimated wrongly by you, you might have a really hard time to adjust it afterward. So, do your research thoroughly.
Now, while you’re shortlisting the companies to hire laravel development company. Approach them with a clear mind of what exactly you want and ask them to quote the pricing.
In my opinion, references are very important here. When you shortlist the companies, ask your family, friends or colleagues if any of them had previously worked with any company. If yes, then go for that company first as you will have a clear idea of how they work from your close ones.
Always check the portfolio before you hire laravel developers. Look for the similar kind of work they have done.
This will help you to evaluate efficiently if they are the right choice or not.

So, these are the pointers you must remember before going for any Laravel Development company.
How can I get cheap assignment writing help online?
Published: 2021-05-17 11:33:49

Best assignment experts are the best place for students studying in London Assignment helps their higher education. We assist in the dissertation, essay, case study scholarship essay, and thesis writing help service.Assignments and essays and basically elaboration of a topic given to understand both the advantages and disadvantages of a particular topic taken by doing
proper information search for establishing critical analysis on it. Essays are of different kinds such as narrative essays, expository essays, descriptive essays and argumentative or persuasive essays. All these four kinds of essays are very different from each other and therefore how they are done are very distinctive and bring out different results and perspectives from a single topic. Narrative essays can be defined as the one where storytelling is the main purpose whereas argumentative essays are the type of essays that are based on strong arguments on a particular topic highlighting both its strengths and weaknesses. Similarly, the other two essay formats are very much different or distinct and therefore it becomes difficult for a student to rightly analyse what kind of essay topic needs to be written on.

<a href="https://www.bestassignmentexperts.com/cheap-assignment-help/">Cheap assignments</a>
What if you don't have testers?
Tags: testing, development
Published: 2021-05-17 11:32:12

---
title: What if you don't have testers?
published: true
description: 
tags: testing, development
//cover_image: https://direct_url_to_image.jpg
---

Well, you have couple of options:
1. Don't test it (let the user test).
2. Test it yourself.

Each has its consequences. Each requires zero to many efforts.
If you let user test it, you are risking annoying the user and eventually tarnishing your brand/trust. Even opensource project has threshold to tolerating bugs. The worst case, the user will leave the project/product for better alternative.

If you choose to test it yourself then you need to know how your app should benefit the user. You need to know what your app should do and must not do. You need to own it more than just building it.

You will need to cross the borders. Not only from developer realm to testing realm, but also into product design realm. You need to figure out not only how to implement dropdown UI, but also why it needs to be a dropdown. Why not listbox, why not textbox, what is that you want the user to accomplish.

## Alternate reality
In the alternate reality, you have a big team with specific roles. You have a team of testers. You have a product designer/manager. Finally you can focus on building things. The boundaries are clear and you are afraid to cross them.

This alternate reality, while looks perfect with its roles, is full of pitfall. The boundaries does not incentives team member to cross them which eventually lead to disconnects.

Your team delivers the product late because it was buggy and needs multiple fixes. When the product is finally out, it requires hotfixes as it doesn't actually address critical use case.

## Reality sucks
As much as we want clear separation of roles and responsibility, each roles still need to stretch a bit beyond its boundary. Each roles need to make sure it gets the right/complete input and delivers the right/complete output. It won't happen without stretching, reaching to adjacent roles.

To practice this mentality, imagine you don't have tester. Or, imagine you don't have developers. Pick any role and imagine what you would do without them. You will need to own their role in their place. You'll know how to stretch.

Have you stretch beyond your boundaries?
[tips]ทำให้การอ่านไฟล์เป็นเรื่องง่ายด้วยคำสั่ง USE ใน Kotlin
Published: 2021-05-17 11:31:26

คำสั่งในการอ่านไฟล์แบบเดิมนั้นค่อนข้างยาวและเข้าใจยาก ตามตัวอย่างด้านล่าง
```
private val CustomReader by lazy {
    val file = File(cacheDir, fileName)
    val outputStream = FileOutputStream(file)
    try {
       val inputStream = assets.open(fileName)
       var bytesCopied: Long = 0
       val buffer = ByteArray(8 * 1024)
       var bytes = inputStream.read(buffer)
       while (bytes >= 0) {
           outputStream.write(buffer, 0, bytes)
           bytesCopied += bytes
           bytes = inputStream.read(buffer)
       }
    } finally {
       outputStream.close()
    }
    CustomReader(file)
}
```

ใน Kotlin 1.2 มี extension function สำหรับ Closeable ที่เรียกว่า *use* โดยเจ้าคำสั่งนี้จะช่วยอำนวยความสะดวกให้เรา ทำให้เราไม่ต้องตาม try finally close() เหมือนแต่ก่อนอีกต่อไป.

ด้วยคำสั่งนี้เราสามารถลดความซับซ้อนของ code ด้านบนได้อย่างง่ายดาย ดั่งตัวอย่างด้านล่างนี้เลย
```
private val CustomReader by lazy {
    val file = File(cacheDir, fileName)
    val outputStream = FileOutputStream(file)
    outputStream.use { outputStream ->
        val inputStream = assets.open(fileName)
        var bytesCopied: Long = 0
        val buffer = ByteArray(8 * 1024)
        var bytes = inputStream.read(buffer)
        while (bytes >= 0) {
            outputStream.write(buffer, 0, bytes)
            bytesCopied += bytes
            bytes = inputStream.read(buffer)
        }
    }
    CustomReader(file)
}
```
แต่ยังไม่หมด เราสามารถลด code ได้อีกด้วย extension function อีกสองตัวคือ
##### copy-to 
```
private val CustomReader by lazy {
    val file = File(cacheDir, fileName)
    val outputStream = FileOutputStream(file)
    outputStream().use { fileOut ->
        assets.open(fileName).copyTo(fileOut)
    }
    CustomReader(file)
}
```
##### outputStream
```
private val CustomReader by lazy {
    val file = File(cacheDir, fileName)
    file.outputStream().use { fileOut ->
        assets.open(fileName).copyTo(fileOut)
    }
    CustomReader(file)
}
```
React.js in Depth
Published: 2021-05-17 11:24:47

### React Component
React is basically component based javascript library. Components are different independent and reusable part of UI. Components can be expressed in two way.

Function Component:
`function Welcome() {
  return <h1>Hello, Reactjs</h1>;
}`

Class Component:
`class Welcome extends React.Component {
  render() {
    return <h1>Hello, Reactjs</h1>;
  }
}`

### React State
React components has a built-in state object. Property values of a component are stored in state object. When the state object changes, the component re-renders automatically.
`class Car extends React.Component {
  constructor(props) {
    super(props);
    this.state = {brand: "Ford"};
  }
  render() {
    return (
      <div>
        <h1>My Car</h1>
      </div>
    );
  }
}`

### React props
In React, props are arguments that can be passed through component to component. So, any object of a component can be used in another.
`class Car extends React.Component {
  render() {
    return <h2>I am a {this.props.brand.model}!</h2>;
  }
}
class Garage extends React.Component {
  render() {
    const carinfo = {name: "Ford", model: "Mustang"};
    return (
      <div>
      <h1>Who lives in my garage?</h1>
      <Car brand={carinfo} />
      </div>
    );
  }
}
ReactDOM.render(<Garage />, document.getElementById('root'));`

### React Hook
If anything might be changed dynamically, then hook is used. Hook connect the change factor with UI. When change factor be changed, it's impact on UI acts automatically.

useState Hook:
`import React, { useState } from 'react';
function Example() {
  const [count, setCount] = useState(0);
  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>
        Click me
      </button>
    </div>
  );
}`

useEffect Hook:
`import React, { useState, useEffect } from 'react';
function Example() {
  const [count, setCount] = useState(0);
  useEffect(() => {
    document.title = `You clicked ${count} times`;
  });
  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>
        Click me
      </button>
    </div>
  );
}`

### React CSS
In React, css can be applied inline or also can be applied as an object.
`class MyHeader extends React.Component {
  render() {
    const mystyle = {
      color: "white",
      backgroundColor: "DodgerBlue",
      padding: "10px",
      fontFamily: "Arial"
    };
    return (
      <div>
      <h1 style={mystyle}>Hello Style!</h1>
      <p>Add a little style!</p>
      </div>
    );
  }
}`
Randomly Sort Array in just one line;
Tags: javascript, showdev, gamedev
Published: 2021-05-17 11:14:59

Yesterday I was working on a JavaScript game and found this pretty cool and easy way to sort a Array randomly.

for this I use the `.sort()` function of Javascript

## .sort()
.sort() is a function in javascript which usually sort the array on the basis of the String value in ascending order by default.

but it can be changed using a compare function inside parameters.

## how to Randomize Array
`const NumArray = ['one','two','three'];
NumArray.sort(() => 0.5 - Math.random());
console.log(NumArray);`

Basically, how compare function works is when it take two positions from array and put them into the function if it returs _positve_ value don't change the order and vice versa.

so here Math.random(); give between 0 to 1 and its subtracted from 0.5 .

## sum up
We use sort() function, Inside sort we put a compare function which is have chances to return postive or negetive number 50/50 and thats how we are getting random sorted Array
Best Image API for Your Website - Unsplash API
Tags: html, serverless, css, tailwindcss
Published: 2021-05-17 11:03:08

In this short, less than a minute tutorial I've shown you, how you can fetch very high-quality images to your website fast and in the most efficient way possible. In this way, you can easily fetch very attractive, HD quality, unlimited free stock images from the best images source for independent creators, Unsplash.

In this video, I've shown you how you can fetch photos, with the help of Unsplash API from Unsplash Source. You can choose what would be the image size and what would be the theme of that image.

You can even fetch random images every time when you click refresh.

Watch more: https://bit.ly/3uDiFUs

**Step 1:**
Go to: https://source.unsplash.com/

**Step 2:**
Copy the link and add it to your project as an image source.

**Step 3**
80% done, now follow step 4.

**Step 4**
Follow me on Twitter:
https://twitter.com/thesouvikpaul

You have more options:
Instagram: https://instagram.com/amisouvikpaul
Facebook: https://fb.com/thesouvikpaul