teleren/devto huggingface dataset:
Docker คืออะไร docker จำเป็นหรือไม่ docker มีประโยชน์อย่างไร
Tags: docker
Published: 2024-01-31 03:08:05

Docker เป็นเทคโนโลยีที่ช่วยให้สามารถรันแอปพลิเคชันหรือซอฟต์แวร์อื่นๆ ในคอนเทนเนอร์ (container) ซึ่งเป็นสภาพแวดล้อมการทำงานแบบแยกส่วนและอิสระจากสภาพแวดล้อมอื่นๆ บนระบบปฏิบัติการหลัก คอนเทนเนอร์จึงสามารถย้ายไปทำงานบนระบบปฏิบัติการใดๆ ก็ได้โดยไม่ต้องปรับแต่งอะไรเพิ่มเติม

Docker มีประโยชน์มากมาย เช่น

- ช่วยให้การ deploy แอปพลิเคชันทำได้ง่ายและรวดเร็วขึ้น เนื่องจากคอนเทนเนอร์สามารถย้ายไปทำงานบนระบบปฏิบัติการใดๆ ก็ได้โดยไม่ต้องปรับแต่งอะไรเพิ่มเติม
ช่วยให้การบำรุงรักษาแอปพลิเคชันทำได้ง่ายขึ้น เนื่องจากคอนเทนเนอร์สามารถแยกส่วนออกจากสภาพแวดล้อมอื่นๆ บนระบบปฏิบัติการหลัก ทำให้สามารถอัปเดตหรือแก้ไขคอนเทนเนอร์ได้โดยที่ไม่กระทบกับแอปพลิเคชันอื่นๆ

- ช่วยให้การใช้ทรัพยากรฮาร์ดแวร์มีประสิทธิภาพมากขึ้น เนื่องจากคอนเทนเนอร์สามารถแชร์ทรัพยากรฮาร์ดแวร์ร่วมกันได้
ดังนั้น Docker จึงอาจจำเป็นสำหรับองค์กรหรือบริษัทที่พัฒนาหรือใช้งานแอปพลิเคชันที่ต้อง deploy บนระบบปฏิบัติการต่างๆ บ่อยๆ หรือต้องการบำรุงรักษาแอปพลิเคชันได้ง่ายขึ้น หรือต้องการใช้ทรัพยากรฮาร์ดแวร์อย่างมีประสิทธิภาพมากขึ้น

อย่างไรก็ตาม Docker ไม่ได้จำเป็นสำหรับทุกคน องค์กรหรือบริษัทขนาดเล็กที่พัฒนาหรือใช้งานแอปพลิเคชันบนระบบปฏิบัติการเพียงระบบเดียวอาจไม่จำเป็นต้องใช้ Docker เนื่องจากสามารถ deploy แอปพลิเคชันได้โดยการปรับแต่งสภาพแวดล้อมบนระบบปฏิบัติการหลักให้เหมาะสมกับแอปพลิเคชันนั้นๆ

สรุปแล้ว Docker จำเป็นหรือไม่นั้นขึ้นอยู่กับความต้องการและความเหมาะสมของแต่ละองค์กรหรือบริษัท หากองค์กรหรือบริษัทมีความต้องการหรือข้อจำกัดดังที่กล่าวมาข้างต้น Docker อาจเป็นเทคโนโลยีที่มีประโยชน์และจำเป็นสำหรับองค์กรหรือบริษัทนั้นๆ
[20 Days of DynamoDB] Day 15 - Using the DynamoDB expression package to build Update expressions
Tags: dynamodb, serverless, database, cloud
Published: 2024-01-31 02:50:15

*Posted: 31/Jan/2024*

The DynamoDB Go SDK expression package supports programmatic creation of Update expressions. Here is an example of how you can build an expression to include execute a `SET` operation of the `UpdateItem` API and combine it with a `Condition` expression (update criteria):

```go
	updateExpressionBuilder := expression.Set(expression.Name("category"), expression.Value("standard"))
	conditionExpressionBuilder := expression.AttributeNotExists(expression.Name("account_locked"))

	expr, _ := expression.NewBuilder().
		WithUpdate(updateExpressionBuilder).
		WithCondition(conditionExpressionBuilder).
		Build()

	resp, err := client.UpdateItem(context.Background(), &dynamodb.UpdateItemInput{
		TableName: aws.String(tableName),
		Key: map[string]types.AttributeValue{
			"email": &types.AttributeValueMemberS{Value: "c1@foo.com"},
		},
		UpdateExpression:          expr.Update(),
		ConditionExpression:       expr.Condition(),
		ExpressionAttributeNames:  expr.Names(),
		ExpressionAttributeValues: expr.Values(),
		ReturnValues:              types.ReturnValueAllOld,
	})
```

Recommended reading - [WithUpdate method](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/feature/dynamodb/expression#Builder.WithUpdate) in the package API docs
#DEVResolutions2024
Tags: devresolutions2024
Published: 2024-01-31 02:50:15

<!-- ✨ Feel free to customize this template to suit your needs—adjust the title, structure, and wording as you see fit! ✨ -->

I'm a bit late to the party but here it is my dev resolutions for 2024.

## Professional Goals:

1. **Goal:** Learn C# ASP.NET Core, SQL Server and Azure.
2. **Action Steps:** Study on Microsoft Learn and YouTube.
3. **Timeline:** I think within 3 months I'll be able to develop some cool projects.

## Personal Aspirations:

1. **Aspiration:** This year I'd like to take better care of my health.
2. **Why it Matters:** Coding all day could be a fun and cool activity but not so cool on your body.
3. **Support System:** I'm starting to play with a small ball outside at least a few minutes a day.

## DEV Community Contributions:

1. **Contribution Goal:** Although I'm not a good writer, posting on DEV seems like an awesome goal but I'm probably going to contribute to the FOREM project on GitHub.
2. **Collaboration Plans:** I'd like to help enhance the experience for other members, fix bugs and close some issues.
3. **Measuring Impact:** The amount of PR's merged seems like a good way to measure it.
Video editor in Electron js help
Published: 2024-01-31 02:34:38

This is my first post here, I need a help in creating a video editor app in electron js. I want to create video editor which can do basic functions such as split video and so on. And then I like to automate them however I can using an external js file. I just learned how to create an electron app, now i need so much to do. I dont know how to create a front page, video slider, and so on. Give me a road map on what I should do here
CSS Expert Tip: Rules of Margin Collapse
Tags: css
Published: 2024-01-31 02:30:04

In terms of spaces vertically talking about margin, only vertical space share the same space between each element.

Ex: A paragraph 1, and another paragraph 2. If you have 

```
margin-top: 20px
```
 and 

```
margin-bottom: 20px
```
this does not equal to 40px, but 20px still, they share the same margin instead. This only applies vertically.

Exemption: Margins only collapse when they're touching. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rt56nux7n33pgpkcyssb.jpg)
Flask-HTML. HTML generator for Flask applications.
Tags: flask, python, html, tutorial
Published: 2024-01-31 02:23:21


Hello everybody. Today i am going to tell you about Flask-HTML package for Flask framework. This package helps you to generate HTML/CSS/JS content for your applicationg by using classes.

Table of content:
- Install
- Usage

## Install
You can install Flask-HTML with pip package manager

```bash
pip install flask_html
```

## Usage
Simple use it in you page route

```python
from flask_html import Page, Head
from flask_html.core import Style
from flask_html.tags import Body, Div, P
from flask import request
@app.route('/')
def index():
    head = Head('Title', ['link to css'],['link to js'], [{"meta_property": "value"}])
    page = Page(head)
    body = Body(page, styles=Style(color="red", padding_top="15px"),classes=['class1', 'class2'], id='body_id',elements=[
        Div(styles=Style(margin="10px"), classes=['class1', 'class2'], id='div_id', elements=[
            P(styles=Style(color="blue"), classes=['class1', 'class2'], id='p_id', elements=[
                "Hello World"
            ])
        ])
    ])
    return page.render(body, request)
```
U can use event listeners with your DOM nodes

> Note: Jquery automatically injected

```python
opts = [Option('{}'.format(x),'Name {}'.format(x)) for x in range(10)]
sel = Select(opts).on('change', 'let val = $(this).val(); alert(val)')
page = Page(Head('Title', ['link to css'],['link to js'], [{"meta_property": "value"}]))
body = Body(page, elements=[
    sel
])
return page.render(body, request)
```
All html elements have docstring to help you to understand how to use it

```python
"""Div HTML element

Args:
    styles (Style, optional): Inline css styles. Defaults to None.
    classes (List[str], optional): List of class names. Defaults to [].
    id (str, optional): Unique ID. Defaults to None.
    elements (List[object], optional): List of child elements. Defaults to [].
    props (Dict[str, str], optional): Additional tag properties. Defaults to {}.
"""
Div(styles=None, classes=[], id=None, elements=[], props={})
```
Flask-HTML written by myself and it open to contribute.
Have an idea? Fork [package](https://github.com/Odya-LLC/flask_html), contribute and open pull request

## Links
- [Github](https://github.com/Odya-LLC/flask_html)
- [Pypi](https://pypi.org/project/Flask-HTML/)
Playable Angels or Demons in Diablo 4
Published: 2024-01-31 02:09:19


Playable Angels or Demons in Diablo 4 
Five playable Diablo instructions have been added to [ Diablo 4 gold ](https://www.mmoexp.com/Diablo-4/Gold.html) date, and they all represent takes on alternatives from earlier video games. Given each installment so far has furnished a few issue new, possibly Tyrael becomes a hand withinside the conflict, balancing the rims through manner of method of offering game enthusiasts the cappotential to address angelic or demonic powers in exchange for responsibilities to Sanctuary. This sort of mechanic must resultseasily take a look at on the multi-tree development already added for the collection.

It seems no longer likely that snow fall plans to make Angels and Demons into commands, because the franchise facilities those caught among their way. However due to the fact the mortal truely caught among Heaven and Hell, Tyrael sits in a feature now not like each different in all of Diablo lore. He's going to more likely be a balancing act withinside the tale, possibly even a voice of cause, rather than taking sides as he as soon as did. Even whilst compelled to take facets, Tyrael now could be conscious the real charge of the mortals, and this is how he'll maximum in all likelihood participate withinside the events of [buy Diablo IV gold](https://www.mmoexp.com/Diablo-4/Gold.html).


Diablo 4 launches on June 6, 2023 for pc, PS4, PS5, Xbox One, and Xbox series X/S.

More: The complete story main up to Diablo 4 defined
Don't Pick AWS us-east (if you can)
Tags: aws, devops
Published: 2024-01-31 01:56:27

After large AWS incidents, they post a post-mortem on [this list.](https://aws.amazon.com/premiumsupport/technology/pes/)

As of today, there are 16 outages that AWS considers as significant.

Of these 16 outages, 8 were from the us-east regions. Four of those eight were in us-east-1.

If you were starting today and can afford it, I'd recommend using the us-west regions.

EC2 instances and everything in costs more in general in us-west. However, in the future, you might never need to engineer your workloads for multiple regions.

```
Summary of the AWS Lambda Service Event in Northern Virginia (US-EAST-1) Region, June 13, 2023
Summary of the AWS Service Event in the Northern Virginia (US-EAST-1) Region, December 7, 2021
Summary of AWS Direct Connect Event in the Tokyo (AP-NORTHEAST-1) Region, September 2, 2021
Summary of the Amazon Kinesis Event in the Northern Virginia (US-EAST-1) Region, November 25, 2020 
Summary of the Amazon EC2 and Amazon EBS Service Event in the Tokyo (AP-NORTHEAST-1) Region, August 23, 2019
Summary of the Amazon EC2 DNS Resolution Issues in the Asia Pacific (Seoul) Region (AP-NORTHEAST-2), November 22, 2018.
Summary of the Amazon S3 Service Disruption in the Northern Virginia (US-EAST-1) Region, February 28, 2017.
Summary of the AWS Service Event in the Sydney Region, June 4, 2016.
Summary of the Amazon DynamoDB Service Disruption and Related Impacts in the US-East Region, September 20, 2015.
Summary of the Amazon EC2, Amazon EBS, and Amazon RDS Service Event in the EU West Region, August 7, 2014.
Summary of the Amazon SimpleDB Service Disruption, June 13, 2014.
Summary of the December 17th event in the South America Region (SA-EAST-1), December 17, 2013.
Summary of the December 24, 2012 Amazon ELB Service Event in the US-East Region, December 24, 2012.
Summary of the October 22, 2012 AWS Service Event in the US-East Region, October 22, 2012.
Summary of the AWS Service Event in the US East Region, June 29, 2012.
Summary of the Amazon EC2 and Amazon RDS Service Disruption in the US East Region, April 21, 2011
```

- [Sourced from AWS](https://aws.amazon.com/premiumsupport/technology/pes/)

---

**Like what you've read?**

If you're an engineering leader or developer, you should subscribe to my [80/20 DevOps Newsletter](https://cbui-dev.ck.page/e02125641c). Give me 1 minute of your day, and I'll teach you essential DevOps skills. I cover topics like Kubernetes, AWS, Infrastructure as Code, and more.
DevRel Discussions
Tags: devrel, ai, discuss
Published: 2024-01-31 00:41:05

A theme I've noticed in DevRel is the discussion about what kind of role AI will play in the practice of Developer Relations. Will it be a tool that makes our jobs easier? Or will artificial intelligence replace us?

@jesstemporal, who was featured as a [DevRel You Should Know](https://dev.to/lizzzzz/the-devrel-digest-november-2023-devrel-you-should-know-part-one-and-why-i-will-never-ever-leave-developer-relations-1elh), had the following to say about AI:

"My biggest prediction for 2024 is that AI will become a tool that no Developer Advocate can ignore anymore. With the rise of AI, more and more companies will require Developer Advocates to make use of LLMs to increase speed, personalization, and, in general terms, output of content to help developers out."

![An image with a purple gradient background and an illustration of a pug with the quote from Jessica Temporal from the text preceding the image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9hqra3r0n34oumvv1j65.png)

This got me curious: How do you currently use or plan to use AI in your DevRel practice? Where do you draw the line when it comes to using AI?

![An image with a purple gradient background and an illustration of a pug with the text: How do you currently use or plan to use AI in your DevRel practice? Where do you draw the line when it comes to using AI?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4qemw3s6xuu65wxfcq02.png)

Comment below with your thoughts! 👇
讓 pipenv 在 powershell 下開啟 shell 時顯示專案資料夾
Tags: python, pipenv
Published: 2024-01-31 01:53:54

不確定是我自己安裝的問題, 還是本來就如此, 在我的 powershell 中啟動 pipenv shell, 並不會在提示符號開頭顯示專案資料夾或是虛擬環境名稱, 像是這樣：

```sh
~/code/python/py3.10.11
# pipenv shell
Launching subshell in virtual environment...
PowerShell 7.4.1
Loading personal and system profiles took 532ms.
~/code/python/py3.10.11
#
```

但是在 cmd 下卻沒問題：

```sh
C:\Users\meebo\code\python\py3.10.11>pipenv shell
Launching subshell in virtual environment...
Microsoft Windows [版本 10.0.22621.3007]
(c) Microsoft Corporation. 著作權所有，並保留一切權利。

(py3.10.11-tuTXJP8y) C:\Users\meebo\code\python\py3.10.11> 
```

它會把專案資料夾對應的虛擬環境名稱顯示出來。

經過搜尋, 似乎大家都有[一樣的問題](https://github.com/pypa/pipenv/issues/3505), 經過善心人士提供[解決方案](https://github.com/pypa/pipenv/issues/3505#issuecomment-821885296), 只要在 powershell 的 profile 中加入以下腳本即可：

```sh
if ($env:PIPENV_ACTIVE -eq 1) {

    function _OLD_PROMPT { "" }
    Copy-Item -Path function:prompt -Destination function:_OLD_PROMPT


    $_PROMPT_PREFIX = (($env:VIRTUAL_ENV -split "\\")[-1] -split "-")[0]

    function prompt {
        Write-Host -NoNewline -ForegroundColor Green "($_PROMPT_PREFIX) " 
        _OLD_PROMPT
    
    }
}
```

這個腳本會在你的提示符號開頭插入專案資料夾, 像是這樣：

```sh
~/code/python/py3.10.11
# pipenv shell
Launching subshell in virtual environment...
PowerShell 7.4.1
Loading personal and system profiles took 1354ms.
(py3.10.11) ~/code/python/py3.10.11
#
```
Event Streaming and Event Sourcing: which one do you use?
Tags: discuss, softwareengineering, architecture
Published: 2024-01-31 01:48:55

A couple of months back, I read [this article](https://event-driven.io/en/event_streaming_is_not_event_sourcing/) explaining that event streaming != event sourcing

The understanding of these two has eluded me for years.

I first heard of it back in 2017 when my mentor was introducing DDD to me. In my head, I oversimplified it as a pub-sub pattern but with flair :laughing: 

That mental model remained useful as I worked on a few event-driven applications. Some utilized it on the application tier while some applied it as a way to orchestrate microservices.

The [“leitmotiv” article](https://chriskiehl.com/article/event-sourcing-is-hard) cited by the article above is something I’ve seen several times, and one I find myself agreeing with when I was working with architectures employing such. It is fancy. It seems elegant but it also introduces a lot of drawbacks. Add to that, it’s also a bit unintuitive versus a simple “let me handle that request, process it, write it to the database, here’s your response, and voila we’re done” -- very CRUD-y I suppose.

But it turns out, I was conflating the two terms :facepalm:
Looks like I’ve never tried event sourcing yet, and it's probably something I won’t be able to try anytime soon.
I’m a little skeptical about how replaying the events will scale. Granted, I didn’t read the additional articles the author shared (he has one for modelling event sourcing streams and keeping them short).

How about you? Have you tried event sourcing before? How was it?

And if not, will you ever try event sourcing?
Notice
Published: 2024-01-31 01:26:02

To provide one-stop shopping experience, "Polypeptide.ltd" has been changed to "Phcoker" officially. More information, please visit upgrade website "https://www.phcoker.com/ and pay attention to the news of the official social platforms.

Polypeptide.ltd (Phcoker.com) is the GMP Manufacturers of Custom Synthesis Peptide. Email: info@phcoker.com
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/btjrc5gzvrxfey9a5k9s.jpg)
Use CSS accent-color to style your inputs
Tags: css
Published: 2024-01-31 00:57:02

---
title: Use CSS accent-color to style your inputs
published: true
description: If you want a quick styling win, you can set a color for your input and progress HTML tags!
tags: css
canonical_url: https://blog.cassidoo.co/post/css-accent-color/
---


If you've ever wanted to style HTML `<input>` tags in your projects, you know it's a bit tricky to deal with the labels and making everything look custom and themed.

This won't go wildly into all the ways you can style them, BUT, if you want a quick win to change the color of those controls, use the CSS `accent-color` property!

`accent-color` works on the following HTML elements:

- `<input type="checkbox">`
- `<input type="radio">`
- `<input type="range">`
- `<progress>`

You can style all of these by just plopping it in your root:

```css
:root {
	accent-color: #ccff00;
}
```

Or, if you want different elements to have different colors, you can style them all individually!

{% codepen https://codepen.io/cassidoo/pen/OJqQQwg %}

[Here's the documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color) if you want to learn more!

Byyyyye <3
How to make GPT-4 to write a good code for you
Tags: programming, python, tutorial, beginners
Published: 2024-01-31 00:30:19


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

```
You are an expert Python and Gradio APP developer. You develop apps relentlesly. You never do a comment or ask questions and directly do what is asked from you no matter how longer it is. You directly make the code changes you are asked for and print the entire methods that you have modified without any code omitting or messages. you will give only the methods that you have modified but the entire method itself so i can copy paste

Now your task is analyizng the below code carefully and making the following changes

1 : add a new drop down menu and a input box to the user input screen

in this dropdown menu it will scan models folder and list the model names

if models folder do not exists, create it

it will scan the .safetensors files inside that models folder and list them into dropdown menu

if user select a model from this drop down menu before hittin submit button that selected model will be given as pretrained_model_name_or_path

2 : now add an input box right to the this new drop down menu

if user enters a text into this right input box, that will be used as  pretrained_model_name_or_path

add this description to the first model selection drop down menu

: select model from models folder

add this description to the right next to the drop down menu input box

hugging face model repo name or local file full path


the below is the script that you need to changes and give me modified methods as full without any code omitting

the methods that you will make changes and give me new versions are

the part that starts with with gr.Blocks
and also new function to generate models folder if not exists, scan it and list them in drop down menu
```
Building a Simple CLI with Node.js
Tags: webdev, javascript, node, cli
Published: 2024-01-31 00:29:34

## Introduction

Command Line Interface (CLI) is a powerful tool used for interacting with a computer's operating system through a text-based interface. With the rise of Node.js, building a CLI has become simpler and more accessible. In this article, we will explore the advantages, disadvantages, and features of building a simple CLI with Node.js.

## Advantages

1. **Easy to Learn and Use**: Node.js is known for its simplicity and easy-to-learn syntax, making it a great choice for building CLIs, even for beginners.
2. **Platform Independent**: Node.js is a cross-platform runtime environment, allowing the CLI built with it to run on any operating system without modifications.
3. **Customization and Flexibility**: With Node.js, you have complete control over the design and functionality of your CLI, enabling you to add custom features, colors, and commands.

## Disadvantages

1. **Limited to JavaScript**: Being an open-source, JavaScript-based platform, Node.js is limited to only one programming language.
2. **Steep Learning Curve**: Building a CLI with Node.js requires a good understanding of its core concepts, which can be challenging for some developers.

## Features

1. **Node Package Manager (npm)**: Node.js comes with a built-in package manager, npm, providing access to a vast repository of packages and modules to enhance CLI functionality.
2. **Asynchronous Programming**: Based on asynchronous programming, Node.js allows for faster execution of commands, making the CLI more efficient.

## Example Code Snippet

```javascript
#!/usr/bin/env node
const program = require('commander');

program
  .version('1.0.0')
  .description('An example CLI built with Node.js')
  .option('-n, --name <type>', 'Your name')
  .option('-o, --occupation <type>', 'Your occupation')
  .action((cmd) => {
    console.log(`Hello, ${cmd.name}! Your occupation is ${cmd.occupation}.`);
  });

program.parse(process.argv);
```

This example demonstrates how to create a basic CLI that takes a name and occupation as input and outputs a greeting. It uses the **commander** package to simplify command-line argument parsing.
## Conclusion

Building a CLI with Node.js offers numerous advantages, such as simplicity, platform independence, and flexibility. However, it also presents some limitations, like being restricted to JavaScript and having a steep learning curve. Nonetheless, with features like npm and asynchronous programming, Node.js is a potent tool for creating efficient and customized CLIs. As the demand for command-line interfaces grows, learning Node.js for CLI development can be highly beneficial for developers.