teleren/devto huggingface dataset:
Extending Puppet CA
Published: 2022-07-04 09:48:13

Puppet encrypts connections using a self-signed OpenSSL based CA.
Usually a Puppet CA has a validity of 5 years. At initial Installation one can configure the ca_ttl setting:

`puppet config set --section server ca_ttl 10y`

Existing installations can extend the CA e.g. by using the following script which has been made public by Neeloy on Puppet Community Slack channel:

```
cd /etc/puppetlabs/puppet/ssl/ca
(openssl rsa -noout -modulus -in ca_key.pem  2> /dev/null | openssl md5 ; openssl x509 -noout -modulus -in ca_crt.pem  2> /dev/null | openssl md5 )
# Generate new CSR
openssl x509 -x509toreq -in ca_crt.pem -signkey ca_key.pem -out ca_csr.pem
# Sign
cat > extension.cnf << EOF
[CA_extensions]
basicConstraints = critical,CA:TRUE
nsComment = "Puppet Ruby/OpenSSL Internal Certificate"
keyUsage = critical,keyCertSign,cRLSign
subjectKeyIdentifier = hash
EOF
cp ca_crt.pem ca_crt.pem.old
openssl x509 -req -days 3650 -in ca_csr.pem -signkey ca_key.pem -out ca_crt.pem -extfile extension.cnf -extensions CA_extensions
openssl x509 -in ca_crt.pem -noout -text|grep -A 3 Validity
chown -R puppet: ./*
cd /etc/puppetlabs/puppet/ssl
cp -a ca/ca_crt.pem certs/ca.pem
```
Another solution is using the [Puppet ca_extend Modul](https://forge.puppet.com/modules/puppetlabs/ca_extend) which uses tBolt tasks and plans to extend an existing CA.

Happy hacking and fun by continuing using Puppet.
Polish Your Writing Skills To Get Academic Editing Jobs Online
Tags: writing
Published: 2022-07-04 09:42:38

Apart from their grasp of the subject, a high-quality Academic Writing Editing Services improves the writer's dedication and professionalism. Academic Writing must be flawless in every area, including language, grammar, style, spelling, and punctuation.
 
Companies that offer **[academic editing services](https://www.firstediting.com/editing-service/professional-academic-english-editors/)** have highly experienced and skilled individuals on staff who specialize in various subjects to assist you with all of your academic editing needs, whether the subject is medicine, science, business, fiction, or something else.

Using academic editing services has a lot of advantages
When you hire an Academic Editing Services, the expert editors will edit your work to improve it, ensuring that it fits the writing criteria of your institution, such as spelling, grammar, word usage, writing style, and use of suitable voice in the text, among others. 

Expert editors and proofreaders have trained to express the necessary alterations and edits, and even to offer recommendations and suggestions for you to better your work in the process. They provide efficient, timely, and dependable academic editing services since they are well trained in diverse writing styles and have deep knowledge of the complexities of syntax and grammar.

If you are a student, the quality of your academic papers, and thus your mark, is determined by clarity. If you are a writer, precision and clarity of your writing are equally crucial because they demonstrate your professionalism. Academic Writing Editors are skilled in detecting any unorganized or repetitive content, as well as the technical modifications needed in your work, to ensure that your papers are precise and of high quality.

Expert editors have a significant understanding of Statistical Analysis systems and can thus assist you with your research in the social science and clinical domains. They may help you not only in developing your research questions, but also in data interpretation, analysis, and design methodologies.

Whether you need your non-fiction manuscript polished or proofread, these academic writing experts can improve the quality of your content by making suitable revisions and edits. They are, in fact, the ideal option for achieving your writing goals if you are serious about it.

About the company 

Allowing an expert from First Editing to do the **[Academic Editing Jobs](https://www.firstediting.com/editing-jobs/)** helps you to have quality proofreading that makes the next step easier and faster. In most cases, their specialists return with the necessary formatting, editing, and changes in less than a day, allowing you to quickly move on to your next project while still ensuring that your publications and submissions are completed on time.
Best Data Protection Solutions: our top picks
Tags: beginners, programming, discuss
Published: 2022-07-04 09:23:35

CyberNews is a [data protection solutions](https://cybernews.com/resources/best-data-protection-solutions/) provider. We help you learn about and implement the best strategies for protecting your business data from loss or theft. Our team of experts has experience in all aspects of IT security, to ensure that companies have the highest possible level of protection against cybercrime.
javascript 中常见的可中断执行编程范式
Tags: javascript, programming
Published: 2022-07-04 09:21:23

### 如何跳出嵌套循环语句？
在日常开发中，有时候会通过编写双重 for 循环语句来完成业务逻辑，跳出 for 循环使用 break; 语句，如果需要跳出双重 for 循环就需要定义 label 语句了
```js
let num = 0;
outermost:
for (let i = 0; i < 10; i++) {
  for (let j = 0; j < 10; j++) {
    if (i === 5 && j === 5) {
      break outermost;
    }
    num++;
  }
}
console.log(num);
```

### 如何实现脚本执行“睡眠”
在 debug 阶段有时候需要用到下面的 sleep 函数来中断代码执行：模拟网络请求、暂停执行逻辑查看过渡效果。
```js
function sleep(time) {
    return new Promise((resolve) => setTimeout(resolve, time));
}

(async function () {
    console.log('开始执行' + new Date());
    await sleep(3000);
    console.log('等待3s后继续执行' + new Date());
})();
```

### 如何中止已经发起的网络请求
当用户频繁点击“提交”或“查询”按钮向后台发起请求时，为了获得优秀的用户体验和节省网络带宽，开发者需要对用户的点击行为进行约束，常见的方式有切换 loading 态处理，如下图所示


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7b72iffz6n968e3k73np.gif)

在点击按钮后切换成 loading 样式，这时在请求返回前是不能发起新的请求的，这样做有个弊端：当网络请求时间长一些的时候，用户无法取消当前请求，切换新的请求入参，发起新的请求。

解决方案：可以利用 JS 新特性 AbortController 来实现 fetch 请求的中断。演示代码如下：
```js
function FooComponent(props) {
    useEffect(() => {
      const controller = new AbortController();
      const { signal } = controller;
  
      const request = (async () => {
        const data = await fetch(url, query, { signal });
        // perfom setData
      })();
  
      return () => controller.abort();
    }, [query]);
  
    return <>...</>;
}
```
Programming Rule Vs Machine Learning
Tags: javascript, webdev, machinelearning, datascience
Published: 2022-07-04 09:16:28

Hi everyone, Today I'am seeing the people to activity such as post, comment, and upload something in social media, shopping with digital platform, control smart electrical appliance with application and other. This is reason to make a lot of data in every day. 

A lot of data is incomming to make new problems such as Marketer cann't analyzing a lot of data is comming every day.
I'm web developer. I like to solve to problems. I would like to learn that how to solve problems in the news problem about a lot of data.

Now, Machine learning is one of solutions to solve problem about how to analyzing a big data. I'm starting to learn machine learning and start to learn with [tensorflowjs] (https://www.tensorflow.org/resources/learn-ml/basics-of-tensorflow-for-js-development) becase I'm freindly to use javascript to make some services and applicaiton and I'm starting to read book [Deep learning with Javascript](https://www.amazon.com/Deep-Learning-JavaScript-networks-TensorFlow-js/dp/1617296171). The book has overview the concept of programing rule and machine learning. This is good for understand and start learning machine learning

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/me1uwdivj4it12qywkay.png)
 
 
<u>_Programing rule_</u> is something you make application or some function. you write to rule when data input and return to something output when you write by rule.

<u>_Machine Learning_</u> is someting you have dataset and answer you putting to algorithm of machine to learn data and output to rule of data that cover the awnser when new data put the rule. The output of rule that we call Model.

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

The picture explain when you would like to use machine learning to solve problem in your application. we have 2 phase

<u>_Training Phase_</u>, First, You create machine learning model and need to have dataset and answer to trainning your model and when you trained model you have countinue to inference phase for using trained model

<u>_Inference Phase_</u>, Final, You apply trained model from model in Training Phase to your application or function in your code. when new data is comming to application or function the trainend model is processing your new data and output to your answer follow by tranined model that you make.
Hackerrank-Time Conversion Solution in Kotlin
Published: 2022-07-04 09:09:01

## problem
Given a time in **12**-hour AM/PM format, convert it to military (24-hour) time.
Note: - 12:00:00AM on a 12-hour clock is 00:00:00 on a 24-hour clock.
-12:00:00PM on a 12-hour clock is 12:00:00 on a 24-hour clock. 

## Example 

- **s = '12:01:00PM'**
Return '12:01:00'.

- **s= '12:01:00AM'**
Return '00:01:00'.

## Function Description

Complete the timeConversion function in the editor below. It should return a new string representing the input time in 24 hour format.

timeConversion has the following parameter(s):

- string s: a time in **12** hour format 

**Returns**

- string: the time in **24** hour format

## Input Format

A single string **s** containing a time in **12** -hour clock format (i.e.: **hh:mm:ssAM** or **hh:mm:ssPM**)

## Constraints

-  All input times are valid

## Sample Input

```
07:05:45PM
```

## Sample Output 

```
19:05:45
```


## Answer :

```

  fun timeConversion(s: String): String {

        val hour = s.substring(0, 2).toInt()
        val minsec = s.substring(2, 8)
        val timeZone = s.substring(8, 10)
        val time = s.substring(0, 8)

        var clock = return when (timeZone) {

            "AM" -> {
                if (hour == 12)
                    "00$minsec"
                else time
            }

            "PM" -> {
                if (hour == 12)
                    time
                else {
                    val sum = hour + 12
                    "$sum$minsec"
                }
            }

            else -> ""
        }
    }
```
5 Reasons to Choose ReactJs for Your Next project
Tags: react, javascript, programming
Published: 2022-07-04 08:52:51



 

ReactJS is a JavaScript library for building user interfaces. It was created by Facebook with the intention of making it easier to build large applications with data that changes over time.

The introduction of React.js has changed the way how UI is built. React provides a number of benefits to create rich user interface, including ease of implementation, better performance, and excellent cross-platform compatibility.

## 1. Simple to learn

ReactJs is extremely intuitive which makes it very simple to work with and start building UI with it. Unlike Angular, it is not complex to get started. When it’s easy to pick up, developers can easily find a grip over it.

Also react being a open source library, there  is easy to reach support in form of various communities with developers from all over the world


## 2. Reach user interface
 

With ReactJS, you can build rich interfaces easily. This is highly favorable, especially for apps as low quality UI pisses off the users. With declarative components available, it is easy to use them to build great interfaces easily.

With other technologies too you can build the interface, but it is not as easy as reactJS


## 3.JAVA Script library
 

ReactJS uses a strong combination of Javascript and HTML tags. The JS library helps to convert HTML elements into required functions which makes the entire process of creation of UI quite simplistic.

## 4. Component Reuse
 

No need to constantly churn out the same piece of tried andtested code again which is meant to be standard for some websites. In ReactJS, it is possible to split the components into reusable pieces which can be used individually as needed.

This fastens the development process which eventually is cost- effective too. You can also add browser extension called React Developer Tools that you can add to chrome or firefox to speed up your work.

## 5. SEO
 

It is safe to believe that Reactjs won’t be favorable for SEO because of the JavaScript libraries it is based upon. But it’s not true. React does not use JavaScript libraries directly. It uses virtual DOM that make the data render like a normal webpage.

 

It come as no surprise why lot of successful companies are incline to [hire reactjs developers](https://www.cronj.com/hire-react-js-developers.html) for building websites.
[Hire react developer](https://www.cronj.com/hire-react-js-developers.html) who can develope a app who can handle large traffic on your website
#TestCulture 🦅 Episode 6 - Mine canaries to Canary Releasing
Tags: beginners, testing, agile, devops
Published: 2022-07-04 08:49:21

Canary Release reminds 𝟏𝟗𝐭𝐡 𝐚𝐧𝐝 𝟐𝟎𝐭𝐡 𝐜𝐞𝐧𝐭𝐮𝐫𝐲, when miners tested new mines to avoid being poisoned or burned by flammable pockets of gases.


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

Small animals like canaries were useful to detect 𝒑𝒐𝒊𝒔𝒐𝒏 because of their rapid breathing rate and high metabolism. When the birds began to collapse, the miners knew that 𝒑𝒐𝒊𝒔𝒐𝒏𝒐𝒖𝒔 𝒈𝒂𝒔 was nearby and that the area was dangerous.

If this practice ended 𝐢𝐧 𝟏𝟗𝟖𝟕 as new detection technology was developed, the concept has been resurrected in the DevOps context... but without canaries! 🐣

In the context of 𝘿𝙚𝙫𝙊𝙥𝙨, Canary Releasing is the act of deploying a new release to a small group of users, before releasing it to all. This method reduces the risk of problems in the new release.

It's a way to test your software without blocking the delivery process, even with slow life cycles. 🔄
Canary Releasing provides a testing environment that can be 𝙥𝙖𝙧𝙩𝙞𝙘𝙪𝙡𝙖𝙧𝙡𝙮 𝙙𝙞𝙛𝙛𝙞𝙘𝙪𝙡𝙩 with very large systems without a robust share-based architecture.

Canaries are no longer used as test subjects, but the expression persists in time in new areas...

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

Thread [on Twitter](https://twitter.com/agilitest/status/1514619541132759045?s=20&t=7O8VFOD5IJen28msTB3gfA).

------
📚 𝕊𝕠𝕦𝕣𝕔𝕖𝕤:
🎴 https://agilitest.com/cards/canary-releasing
📖 https://magazine.cim.org/en/in-search/who-brought-the-canary-into-the-coal-mine-en/
🌐 https://martinfowler.com/bliki/ImmutableServer.html
Migrating from SQLite3 to PostgreSql Database - Heroku
Published: 2022-07-04 08:48:28

##Introduction
Are you planning to deploy your SQLite3 based backend to Heroku? If you answered this question with a yes, then you are at the right place. This is because you will have to migrate your databases from SQLite3 to PostgreSql.
Most of the time we use SQLite for development purposes but when the time for deployment comes, we have to migrate our databases to PostgreSql in order to host it to Heroku.
This is the process I went through to migrate my SQLite based project to PostgreSql then deployed it on Heroku:

## Install PostgreSql 
I started by installing PostgreSql app in to my laptop. This app provides a simple user interface to manage your databases. Depending on your laptop's OS, go ahead and download this app.

## Edit Gemfile
In your Ruby project, Gemfile contains all of the gems that your project is dependent on. Locate the SQLite gem and replace it with PostgreSql gem.
`gem 'sqlite3'` to `gem 'pg'`
After editing your Gemfile, run `bundle install` command to install PostgreSql gem.

## Edit database.yml file
This file contains information about your database configurations. Since we want to migrate from SQLite3 to PostgreSql, change adapter setting as follows:
`adapter: sqlite3` to `adapter: postgresql`

Run `rake db:migrate` command to setup a PostgreSql Database and schema.

## Conclusion
At this point, your PostgreSql setup should be working. Next time I will be showing you how to host the project to Heroku.
Local Storage and Session Storage explained
Tags: webdev, javascript, react, frontend
Published: 2022-07-04 08:46:22

Difference between Local Storage and Session Storage, explained:

Local Storage: Local storage is a method that allows us to store key-value pair data in the user's browser. It is stored indefinitely in the browser and has a limit of 10MB.

Session Storage: Session storage is similar to Local storage, but the data is only stored as long as the user's session is active and can store data of up to 5MB. It is terminated as soon as the user closes the browser window.
A quick review of the Fresh web framework
Tags: webdev, typescript, programming, react
Published: 2022-07-04 08:37:29

Unless you have been living under a rock, then you probably have heard of [Fresh](https://fresh.deno.dev/), the shiny new TypeScript web framework.

Fresh boasts some impressive features, such as:

- No build step
- No config needed
- TypeScript support out of the box
- No JavaScript is shipped to the client by default

But how good is Fresh in terms of developer experience?

To answer that question, I have built a simple file-system based pastebin service, called [Petunia](https://github.com/HoangTuan110/petunia), using Fresh and Deno.

Short answer?

Fresh is pretty good if you already know React and Tailwind, though it has some quirks that you have to get used to, like handling input.

The longer answer?

Fresh relies on [Preact](https://preactjs.com/)--a lightweight version of React--to display components, so if you are a React developer, then Fresh should feel like home to you.

When initializing a new project, Fresh will also ask if you want to use [Twind](https://twind.dev/), which is a Tailwind-to-JS library. If you choose this option, then you will have the power of Tailwind without creating a config file or using PostCSS, which I thought is pretty cool.

Here are a few things to notice though:

- Fresh uses [NextJS's file-system based routing](https://nextjs.org/docs/routing/introduction), so for example `routes/link/[id].ts` becomes `/link/:id` in the web app.

- The way Fresh handles form submission is very different from React. Instead of using states like React, Fresh takes advantage of the HTML `<form>` element, by getting form data from `<form>` when the user enters the form, then using a custom handler to process that data, and return that data to the front-end.

Here's [an example](https://fresh.deno.dev/docs/getting-started/form-submissions) on the Fresh documentation, implementing a search form that filters an array of names server-side:

```ts
/** @jsx h */
import { h } from "preact";
import { Handlers, PageProps } from "$fresh/server.ts";

const NAMES = ["Alice", "Bob", "Charlie", "Dave", "Eve", "Frank"];

interface Data {
  results: string[];
  query: string;
}

export const handler: Handlers<Data> = {
  GET(req, ctx) {
    const url = new URL(req.url);
    const query = url.searchParams.get("q") || "";
    const results = NAMES.filter((name) => name.includes(query));
    return ctx.render({ results, query });
  },
};

export default function Page({ data }: PageProps<Data>) {
  const { results, query } = data;
  return (
    <div>
      <form>
        <input type="text" name="q" value={query} />
        <button type="submit">Search</button>
      </form>
      <ul>
        {results.map((name) => <li key={name}>{name}</li>)}
      </ul>
    </div>
  );
}
```

> [Discuss on HN](https://news.ycombinator.com/item?id=31974795) | [Tweet this post](https://ctt.ac/fe25i)

<hr>

You can also read this post in [my blog](https://tsk.bearblog.dev/a-quick-review-of-fresh-web-framework/).
Python Exercise 20:Find the pattern
Published: 2022-07-04 08:26:09

## Question
-   Given a dictionary containing up to six phrases, 
	- return a list containing the matching phrases according to the **given string (p)**.
-   Ignore any digit that is placed after or before the given string.
-   Whether the first letter is capitalized or not, 
	- if all letters of the word match the **given string (p)**, it is valid.
-   If it does not match the **given string (p)** then None.

### Example
- example 1

```
find_pattern({
  "Phrase1": "COVID-19 is no good",
  "Phrase2": "COVID-18 is no good",
  "Phrase3": "COVID-17 is no good"
}, "COVID-19")

➞ ["Phrase1 = COVID-19", "Phrase2 = None", "Phrase3 = None"]
```
- example 2

```
find_pattern({
  "Phrase1": "Edabit is great",
  "Phrase2": "Edabit is very great",
  "Phrase3": "Edabit is really great"
}, "really")

➞ ["Phrase1 = None", "Phrase2 = None", "Phrase3 = really"]
```

## My solution
- algorithm

```
>>get the value of each Phrase
>>separate the the value into a list by white space 
>>store each separated value into list
  the list name from phase1_list to phase6_list
>>check if the given string (p) appear in the each phrase
  for phrase1 to phrase 6:
	  if the given string (p) appear in the phrase value
	  add that phrase and value into one string
	  add that string to the final list
>>return a final list
```
- code

```python
def find_pattern(dictionary: dict, string_p: str) -> list:  
    prefix = "Phrase"  
    counter = 1  
    final_list = []  
    for sentence in dictionary.values():  
        if string_p in sentence:  
            final_list.append(f"{prefix}{counter} = {string_p}")  
        else:  
            final_list.append(f"{prefix}{counter} = None")  
        counter += 1  
    return final_list
```

# Other solution

```python
def find_pattern(dict_, p):
	phrase = {True:p,False:"None"}
	phrases = []
	for key,val in dict_.items():
		phrases.append('{} = {}'.format(key,phrase[p in val]))
	return sorted(phrases)
```
- shortest version
```python
def find_pattern(dct, p):
	return sorted("{} = {}".format(d, p if p in dct[d] else None) for d in dct)
```

## Credit
- challenge on [edabit](https://edabit.com/challenge/6FGu55pesinTfcD23)
ECE Projects
Tags: javascript, programming, python, career
Published: 2022-07-04 08:04:14

Engineering student projects for B.Tech and M.Tech final year students. Takeoff Edu Group offers a wide range of projects best for ece projects looking for magnificent final projects at low cost.

We have successfully delivered ece projects to our engineering students. Our programs are specially designed by experts for best results of ece projects for engineering students. max of the B.Tech, M.Tech, PhD and Diploma scholars.

𝗧𝗮𝗸𝗲𝗼𝗳𝗳 𝗘𝗱𝘂 𝗚𝗿𝗼𝘂𝗽 provides the most creative conceptions and ideas for that can make very effective final year projects for scholars, experimenters, and engineers. So browse through our list of ece projects. contents and choose the smart final year projects for your requirements moment.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6i9gol9cbchzclnbtv1.png)
**Electronics & Communication Projects List**

- IOT Dog Daycare Robot
- Arduino Multi Player Air Hockey Table
- Android Micro Drone With Obstacle Detector
- 360° Filmmaking Drone For 4K HD Video
- IOT Temperature & Mask Scan Entry System
- IOT Social Distancing & Monitoring Robot For Queue
- Auto Indoor Hydroponic Fodder Grow Chamber
- Autonomous Theft Proof Delivery Robot For Food & Ecommerce
- Social Distancing & Mask Monitor Drone
- DIY Oxygen Concentrator Generator For Covid 19.

In the cutting-edge scenario, the appetite for sturdy improvement in technology has brought about the call for improvements and uniqueness. This call for has, in turn, brought about the improvement of many ultra-modern thoughts and applications. Good expertise and information of the ultra-modern technology in electronics aren't best crucial for boosting one’s credibility, however additionally for developing most important projects for ECE students. This article lists the pinnacle 50+ ultra-modern electronics assignment thoughts for the scholars who're of their very last yr of engineering.
 
For more information you can visit our website Takeoff projects and you can visit our youtube channel  videos at TakeoffEduGroup thank you for your attention to our article