teleren/devto huggingface dataset:
Stop creating Technical Debt
Tags: digital, agile, architecture, management
Published: 2022-11-16 09:37:23

Technical debt is a great metric to measure how much pressure and bad decisions from management are affecting the team, product, and overall business.

Technical debt is completely avoidable and unnecessary. In fact, from dozens of projects my teams inherited to course correct, we could see the total investment, cost of maintenance, and cost of ownership was on average 1.8x higher when compared to projects with zero technical debt and similar complexity and size.

Common justifications to adopt technical debt:

- A temporary solution to deliver something within a fixed timeline
- Time-to-market to beat the competition
- Minimal Viable Product
- Infrastructure direct costs
- Promise to pay it later

Accepting technical debt will inevitably lead to significant reinvestment in the future. This is also true even if there is a set limit to the amount of technical debt or a process to pay it at every iteration.

Proper Digital Ops practices - modern quality, continuous delivery, and evolutionary architecture can contribute to avoiding technical debt. However, embracing Agile and improving feature prioritization practices are the real game changers for better solutions that will not require re-engineering and re-investments in the future.
Setting up Plausible Analytics for Astro with Vercel Rewrites
Tags: plausible, analytics, astro, vercel
Published: 2022-11-16 09:33:48

---
title: Setting up Plausible Analytics for Astro with Vercel Rewrites
published: true
description: This guide will show you how to set up Plausible Analtytics for an Astro site on Vercel. We will proxy the traffic through our Vercel in order to avoid getting blocked by ad blockers.
tags: plausible, analytics, astro, vercel
canonical_url: https://noahflk.com/blog/plausible-astro
---


[Plausible.io](http://Plausible.io) is a lightweight open-source analytics service. They offer a hosted and self-hosted option. It’s a great Google Analytics alternative that I’ve been using for quite some time now.

## Setting up your application

### Proxy the analytics script

Ad blockers often block Plausibles analytics script and events. This means that we won’t receive any analytics data for users with ad block enabled.

To avoid this, we will proxy all traffic to Plausible’s domain through our server. That way, ad blockers have a much harder time blocking analytics traffic. And thus, we will receive data from all our users.

To achieve this, create a file called `vercel.json` in your project root. Then add the following content:

```json
{
  "rewrites": [
    {
      "source": "/plausible/js/script.js",
      "destination": "https://plausible.io/js/script.js"
    },
    {
      "source": "/plausible/api/event",
      "destination": "https://plausible.io/api/event"
    }
  ]
}
```

This will proxy both the loading of the Plausible embed and the API endpoint to post activity through our server.

### Add the Plausible analytics script

Before you do this, you must create a project in the Plausible dashboard for this domain.

After setting up the project, add the script below to the `<head>` of your HTML. You can find this in the `src/layouts/Layouts.astro` file. Don’t forget to add your domain to the `data-domain` attribute.

```html
<script defer data-domain="yourwebsite.com" data-api="/plausible/api/event" src="/plausible/js/script.js"></script>
```

## Wrapping up

Plausible is now configured on our Astro site. From now on traffic will be captured in the Plausible dashboard. We have maximized the data we gather by proxying the data through our server.

Without the proxy, uBlock origin blocks the Plausible script on my personal site.

![Screenshot from uBlock Origin that shows Plausible as blocked](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdp5mvt4fiundbddas7u.png)

After adding the proxy, nothing gets blocked anymore.

![Screenshot from uBlock Origin with nothing blocked on noahflk.com.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dksc852i0al7x4ii30d0.png)
Using Bicep to setup IIS into a VM
Tags: bicep, azure, iac
Published: 2022-11-16 09:00:00

In this post, I would like to show you how you can use a Bicep template to setup IIS and home page into an existing VM.
In a Bicep template, you can reference an existing resource using the `existing` keyword, as following

```
@description('Location for the deployment')
param location string = resourceGroup().location

@description('name of the VM to setup')
param vmName string

resource vm 'Microsoft.Compute/virtualMachines@2021-03-01' existing = {
  name: vmName
}
```
Using the keyword `existing`, Bicep checks if the resource exists instead of creates the resource. Of course, if the resource doesn't exist, you receive an error. More info about `existing` keyword in the [official documentation](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/existing-resource).

After the declaration, you can use the symbolic name `vm` in other resource declaration in the same template (in the same way you use a symbolic name for a resource you create).
So, you can execute a command script using `runCommands` provider as following:

```
resource vmFEIISEnabled 'Microsoft.Compute/virtualMachines/runCommands@2022-03-01' = {
  name: 'vm-EnableIIS-Script'
  location: location
  parent: vm
  properties: {
    asyncExecution: false
    source: {
      script: '''
        Install-WindowsFeature -name Web-Server -IncludeManagementTools
        Remove-Item C:\\inetpub\\wwwroot\\iisstart.htm
        Add-Content -Path "C:\\inetpub\\wwwroot\\iisstart.htm" -Value $("Hello from " + $env:computername)  
      '''
    }
  }
}
```

The `parent` property tells Bicep that the script will be runned on the virtual machine called `vm` (the existing one), and the script that will be executed is in the script property:

```powershell
Install-WindowsFeature -name Web-Server -IncludeManagementTools
Remove-Item C:\\inetpub\\wwwroot\\iisstart.htm
Add-Content -Path "C:\\inetpub\\wwwroot\\iisstart.htm" -Value $("Hello from " + $env:computername)
```

The script makes these tasks:
- installs IIS 
- removes the current home page for IIS (`iisstart.html`)
- adds a new home page that shows the name of the vm. 

You can notice that you can write a multiline script in the `script` property using the `'''` chars as delimeter.

If your script is more complex than the one shown in the example, you can create a blob in a storage with the extension `.ps1`, and reference it using the `scriptUri` property instead of the `script` property.

```
resource vmFEIISEnabled 'Microsoft.Compute/virtualMachines/runCommands@2022-03-01' = {
  name: 'vm-EnableIIS-Script'
  location: location
  parent: vm
  properties: {
    asyncExecution: false
    source: {
      scriptUri: '<script blob location>'
    }
  }
}
```

In this way it is possible to perform any operation you want inside a vm.
You can also pass parameters to the script, save the output and errors, impersonate a user, and do other things with the `runCommands`. For more info, read the [official documentation](https://learn.microsoft.com/en-us/azure/templates/microsoft.compute/virtualmachines/runcommands).
Piko Framework overview
Tags: php, mvc
Published: 2022-11-16 08:43:49

Today I would like to make a presentation on the Piko, a new one in the PHP frameworks landscape.

Piko is a lightweight, fast and flexible PHP micro framework. It is easy to learn and use, and probably making it a great choice for web development.

## Genesis

I'm the author of Piko and the project started in 2019. My primary idea was to embed a micro-framework library with a small footprint in a distributed application and working like Yii2 framework but keeping only the essential to build a Web application.

With this idea in mind, I decided to write the library and given its name "Piko", an assembly of "Pico" and "Peak" in one word. "Pico" for lightness and "Peak" for precision.

## Features

In the actual state, Piko comes with:

- A middleware interface
- A blazing fast [router](https://dev.to/ilhooq/piko-router-a-lightweight-and-blazing-fast-router-for-php-5cb9)
- A modular MVC routing
- A simple rendering engine (using PHP templates)
- An event handler
- A model helper

Additional features (in separate packages):

- A i18n component 
- An Active Record component
- A user session component

Each of these components has been well tested.

Moreover, Piko is compliant with good practices and PHP standards. It works well with third-party libraries that follow these standards too.

## Demo

To have a look on a basic application made with Piko, you can scaffold a project on the command line using composer:

```bash
composer create-project piko/project yourproject
```

Then you can launch the project using the built-in PHP web server:

```bash
cd yourproject
php -S localhost:8080 -t web
```

## Real use cases

These websites were built with Piko:

- [www.posterfortomorrow.org](https://www.posterfortomorrow.org/)
- [www.3dminfographie.com](https://www.3dminfographie.com/en/)
- [www.sphilip.com](https://www.sphilip.com/)

## More info

- [Documentation](https://piko-framework.github.io/)
- [Source repo](https://github.com/piko-framework/piko)
การใช้ itertools.groupby ใน Python
Tags: python
Published: 2022-11-16 08:28:36

---
title: การใช้ itertools.groupby ใน Python
published: true
description: 
tags: python
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vxiyarbvvmmjll8z7rq5.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-16 07:47 +0000
---

สมมติว่าเรามีข้อมูลชุดหนึ่งที่อยากจัดกลุ่มตามตัวเลขตัวแรกของสมาชิก
```python
data = [
  (10, "ten"),
  (1, "one"),
  (2, "two"),
  (5, "five"),
  (20, "twenty"),
  (3, "three"),
  (1, "one-one"),
  (7, "seven"),
  (2, "two-two"),
  (3, "three-three"),
  (1, "one-one-one"),
  (5, "five-five"),
]
```

และผลลัพธ์ที่เราต้องการคือ
```python
{1: ['one', 'one-one', 'one-one-one']}
{2: ['two', 'two-two']}
{3: ['three', 'three-three']}
{5: ['five', 'five-five']}
{7: ['seven']}
{10: ['ten']}
{20: ['twenty']}
```

หากใช้ itertools.groupby ตรงๆ จะได้ผลลัพธ์ดังนี้
```python
from itertools import groupby
from operator import itemgetter
for k, g in groupby(data, key=itemgetter(0)):
  {k: list(map(itemgetter(1), g))}

{10: ['ten']}
{1: ['one']}
{2: ['two']}
{5: ['five']}
{20: ['twenty']}
{3: ['three']}
{1: ['one-one']}
{7: ['seven']}
{2: ['two-two']}
{3: ['three-three']}
{1: ['one-one-one']}
{5: ['five-five']}

```

จากผลลัพธ์จะพบว่า จะไม่ได้ตรงตามกับที่เราต้องการ วิธีการแก้ไข้คือ เราต้อง `sort` ข้อมูลก่อนที่จะทำการ `groupby`

```python
for k, g in groupby(sorted(data), key=itemgetter(0)):
  {k: list(map(itemgetter(1), g))}

{1: ['one', 'one-one', 'one-one-one']}
{2: ['two', 'two-two']}
{3: ['three', 'three-three']}
{5: ['five', 'five-five']}
{7: ['seven']}
{10: ['ten']}
{20: ['twenty']}
```

ก็จะได้ผลลัพธ์ตามที่เราต้องการแล้ว

REF: https://stackoverflow.com/questions/3440549/how-to-use-itertools-groupby-when-the-key-value-is-in-the-elements-of-the-iterab
How can I change file Key whie sbmiting form data to server
Tags: javascript, react, api
Published: 2022-11-16 08:15:43

```
formData.append("uploaded_file_name", value.Upload_Files[0].fileDoc)

the payload like this: name="uploaded_file_name"; filename="AccouApi.pdf" Content-Type: application/pdf

I want like this: name="uploaded_file_name"; uploaded_file_name="AccouApi.pdf" Content-Type: application/pdf

I want repace "filename" with "uploaded_file_name"

                      <input
                              ref={fileInput}
                             //name="uploaded_file_name"
                              type="file"
                              style={{
                                display: "none",
                              }}
                              onChange={(event) => {
                                setFieldValue(
                                  "fileDoc",
                                  event.target.files[0]
                                );
                              }}
                            />
                            <button
                              className={classes.uploadFileBtn}
                              type="button"
                              onClick={() => fileInput?.current?.click()}
                            >
                              <AddIcon
                                style={{
                                  marginRight: "10px",
                                }}
                              />
                              Upload Document
                            </button>
                            <small className={classes.uploadFileText}>
                              {values?.Upload_Files
                                ? values?.Upload_Files[0]?.fileDoc?.name ||
                                  values?.Upload_Files[0]?.uploadDoc?.split("/").pop()
                                :  "No file chosen"}
                            </small>
                            <small className={classes.uploadFileRemovet} onClick={()=>{setFieldValue(
                                  "fileDoc",
                                  ""
                                )}}>
                            <span style={{color: "red"}}> Remove</span>
                            </small>
                          </div>
```
Integrate Jest and fast-check together
Published: 2022-10-20 18:57:47

---
title: Integrate Jest and fast-check together
published: true
description: Towards an even better integration of fast-check and Jest thanks to newly added `--seed`
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-10-20 18:32 +0000
---

A few days ago, [Jest released](https://github.com/facebook/jest/releases/tag/v29.2.0) a new feature making users able to seed their runs. While not fully leveraged within Jest itself, [@fast-check/jest](https://www.npmjs.com/package/@fast-check/jest) is already using it.

It makes @fast-check/jest, **the best option** to integrate [Jest](https://www.npmjs.com/package/jest) and [fast-check](https://www.npmjs.com/package/fast-check), as it provides an abstraction over both to ease their mutual integration.

---

Starting at version 1.3.0, here is how you would use it to start your new project:

```sh
npm install --save-dev jest @fast-check/jest
```

Then you just have not to forget to put the `--show-seed` option every time you call Jest to make sure Jest will always print the seed for you.

```diff
--  "test": "jest --verbose --coverage",
++  "test": "jest --show-seed --verbose --coverage",
```

_Options `--verbose` and `--coverage` are just examples of possible parameters you may already pass to Jest_

---

At that point everything is ready, have fun with fast-check and Jest and happy testing! 🎉

---

```ts
import { testProp, fc } from '@fast-check/jest';

// for all a, b, c strings
// b is a substring of a + b + c
testProp('should detect the substring', [fc.string(), fc.string(), fc.string()], (a, b, c) => {
  return (a + b + c).includes(b);
});
```
Today's Daily Humor For Devs - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2022-11-16 08:00:07

---
title: "Today's Daily Humor For Devs - Daily Developer Jokes"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12589ca2833.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_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:___ Why was the function sad after a successful first call?

___A:___ It didn’t get a callback.
 -->
Redis Basic Command
Tags: redis, tutorial
Published: 2022-11-16 07:54:55

Di tutorial ini kita akan belajar perintah dasar dari redis

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

## Apa itu Redis
Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. It is highly reliable, scalable, and has high availability (Dikutip dalam website redis.com)

## Perintah dasar
berikut adalah beberapa perintah dasar yang sering digunakan

1. Get All Keys
```
keys *
```
Personal vs. Natural Goals
Published: 2022-11-16 07:31:19

I have wanted to write about this for a long time. I have seen that there are two types of Goals if I can even give it that honor. In actual terms, one is a Goal, and the other is a delusion. One is natural and the other is an un-natural personal one.

When we make a goal, the reason or the intent behind it is the power behind that goal. Have the wrong intention, and the target goes nowhere, and the real purpose will perpetually power that goal making you almost unstoppable.

That’s what happened to me while building my startup Proxies API.

Let me define this as well as I can.

A Personal goal has a very psychological origin to it. There is probably nothing in real life to support it. It’s almost unnecessary. It might be motivated by fear but an absolute psychological horror like shame or resentment or jealousy. These are optional emotions powered by people simply identifying with them. When powered by them, they have a Gollum like quality to them. There is something inherently ugly, pathetic, and selfish about them.

A Natural goal might also be fear-based in its origin. For example, you have received an advisory from the government that there is a massive hurricane headed your way, and you need to take precautions when it hits 48 hours later. It should create fear, which is natural and necessary. There is nothing wrong with feeling the fear and taking measures to counter the situation. Your “Goal” then becomes the survival of you and your loved ones, and you will have to do everything in your power to achieve it. The fear will power it. You don’t need Tony Robbins pumping you up, and you don’t need affirmations. You are powered by instinct.

Building Proxies API was like that for me. I HAD to escape the hurricane coming into my life. In this case, I had around a year, and I would be homeless with my loved ones (I won’t go into details here). It’s a real fear. I embraced it and set my goals.

Doing what was necessary came easy—no need for motivation. If I NEED motivation, then what’s the motivation behind lacking that motivation? I believe that if you need to generate it or fake it, then that’s not it. You haven’t got it; you are missing the point. It is best not to do it.

The single-minded dedication came easy too. If you have a hurricane hitting, trust me, you don’t need a ‘social media blocker’ to block off distractions. There is no process to it. You do it.

Once I achieve the goal, it can hardly be called achievement. There is probably a sense of relief. But there is a matter of fact about it. It merely needed to be done, and it is done.

The author is the founder of Proxies API the rotating proxies service.
Blockchain Development Services
Tags: blockchain, developmentcompany, nft, marketplace
Published: 2022-11-16 07:23:48

Blockchain is a future-ready impactful technology that is still in its nascent stages. New age startups as well as certain traditional financial institutions are rapidly exploring the possibilities that Blockchain Technology has to offer. Prominently, the technology works across industry domains like Real Estate, Fintech, Governance and supply chain.

[ChainTechSource ](https://chaintechsource.com/)has worked on 100+ projects and MVPs across different blockchain protocols like Ethereum, Binance Smart Chain (BSC), Solana, PolkaDot (Harnessing PolkaDot's Parachain auctions), etc. Our range of offerings include DeFi development services, custom blockchain development, NFT creation and NFT marketing, ICO Marketing and more.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0sxwkt8xqfjt7l69r87.jpg)

We use our experience to build products for companies that are looking to get to market swiftly.****
Thời Trang Thái Tuấn Nền Tảng Cho Sự Thăng Hoa
Tags: thaituan, thoitrangthaituan, thaituanfashion, thaituangroup
Published: 2022-11-16 07:04:27

Thành lập từ năm 1993, xuất phát điểm là thương hiệu dệt may chúng tôi chuyên sản xuất và kinh doanh các loại vải chất lượng cao vải dệt Jacquard, vải In, vải Tờ Tằm, vải Âu phục, Vải hanmade công nghệ được chuyển giao từ  Nhật Bản và Châu Âu.Thái Tuấn phát triển trở thành thương hiệu thời trang dẫn đầu, mang đậm bản sắc văn hóa Việt.
Định hướng: Trở thành “Thương hiệu quốc tế cung cấp vải thời trang toàn cầu”
Sứ mệnh: Tôn vinh vẻ đẹp phụ nữ thông qua sản phẩm thời trang, góp phần xây dựng thương hiệu quốc gia
#thaituan #thaituanfashion #thoitrangthaituan #vaithoitrang #thaituangroup
Address: 1/148 Nguyễn Văn Quá, P. Đông Hưng Thuận, Quận 12, TP Hồ Chí Minh
Phone: 02838560427
Email:thaituaninfo@thaituan.com.vn
Website: [](https://thaituan.com)
Google CID: [](https://www.google.com/maps?cid=4461171276494001406)
Google search: [](https://www.google.com/search?q=Công+ty+cổ+phần+tập+đoàn+Thái+Tuấn&amp;amp;kponly&amp;amp;kgmid=/g/1tk4nnjf)
Wikipedia: [](https://en.wikipedia.org/wiki/Fashion)
Mạng xã hội:
[](https://voz.vn/u/thoitrangthaituan.1844461/#about
)
[](https://www.behance.net/thoitrangthaituan
)
[](https://dribbble.com/thoitrangthaituan/about
)
[](https://www.figma.com/@thaituan
)
[](https://www.figma.com/community/file/1174604045314007694)
Manage your containers with Portainer
Tags: docker, kubernetes, opensource, tutorial
Published: 2022-11-16 07:00:00

Today we are going to take a look at [Portainer](https://www.portainer.io/)!

- [❓ Quick intro to Portainer](#whats-portainer)
- [⚙️ Setup Portainer for Linux](#setup-portainer)

## ❓ Quick intro to Portainer
First off all there's one question. _What's Portainer?_.

Portainer is a web-based management tool for all of your containers. You can deploy, configure, troubleshoot and secure containers. Doesn't matter if your infrastructure is on Kubernetes, Docker, Swarm or Nomad in any cloud, data center or device.

![Portainer dashboard preview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ll93i78gm90xzd7lwszx.png)

A beautiful UI to have the overview about your running processes and containers.
It has many integrations and is easy to setup. E.g. auto deploy on git repository push (GitHub, GitLab, etc.).


## ⚙️ Setup Portainer for Linux
We are going to setup Portainer on **Linux**.
_You already need to have some knowledge about **Docker** because it doesn't get covered here._

First, create the volume that portainer server will use to store its database:
```
docker volume create portainer_data
```

After that we can already install the portainer server container (Community Edition):
```
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
```

And after it started it's ready to go! Visit it's page and start by creating your admin user and follow the instructions.
```
https://localhost:9443
```

**ℹ️ FYI:** There's also a free business edition with some additions. Read more about the [differences](https://www.portainer.io/blog/portainer-community-edition-ce-vs-portainer-business-edition-be-whats-the-difference)!


**Thanks for reading!**
<a href="https://www.buymeacoffee.com/jannisdev" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-blue.png" alt="Support me" height="20" width="80"></a>