teleren/devto huggingface dataset:
Design Patterns 3 | Appendix
Published: 2022-09-05 08:19:12

## Pros

- They are easily updated and they enable large scale reuse.
- They make communication easy for developers.

## Cons

- They are complex in nature mostly for beginners.
- They do not allow reuse of code because they are not code based.

I would like us to refresh our memories on what we've done so far in this design patterns article series

##Recap

- Design patterns are descriptions used for solving common software design problems.
- They can not be transformed into source code or machine code
- They are often used in object oriented systems
- Types of design patterns are Creational, Structural and Behavioral.
- Creational design patterns are all about class creation and object instantiation. They are the Factory Method, Abstract Factory Method, Builder Method, Singleton, Object Pool, and Prototype.
- Structural design patterns deal with the structure of classes and objects to increase their functionality. They are; Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Private Class Data, and Proxy.
- Behavioral design patterns involve the relationships between classes and how they communicate. They are; Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Mement, Null Object, Observer, State, Strategy, Template, Method, and Visitor Method.
White space and comments? Like... White noise?
Tags: beginners, html
Published: 2022-09-05 08:16:40

...So I just found out that HTML ignores white space... (Rude...)

This concludes white space (for now at least, I'm sure there will be something I find out later...)

Anyway - COMMENTS!

This is super useful. If you need to make a note about your code, you can use the comment tags. The comments tags open with `<!--`, and then closes with `-->`. 

#####Example Time!
#####Here is the code as written:

```
<!Doc type html>
<html>
<head>
<title></title>
</head>
<body>
<p>URGENT QUESTION: Is butter a carb?</p>
<p>URGENT ANSWER: <em>YES</em></p> 
<p>Immediate application fo butter commences</p>
<!-- Oh that dear sweet summer child... -->
</body>
</html>
```

#####Here is the code as I intend the user to view it:
<html><head><title></title></head><body>
<p>URGENT QUESTION: Is butter a carb?</p>
<p>URGENT ANSWER: <em>YES</em></p> 
<p>*Immediate application fo butter commences*</p>
</body>
</html>

There wasn't much to go over in this video, so here's hoping for a more meaty subject in the next one! ;D

######Disclaimer: if you use inspect/View Page Source, you will find that the code in the section named _"Here is the code as I intend the user to view it"_ is missing parts from the section named _"Here is the code as written"_. The reason they're missing is because both the doc type tag and the comments are visible when using markdown.
Shell script recipes
Tags: bash, command, directory, linux
Published: 2022-09-05 07:47:24

---
title: Shell script recipes 
published: true
description: A simple function to execute one or more commands in all the sub directories
tags: bash, command, directory, linux
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

## How to execute a command in all the sub directories in linux?
Consider there is a need to execute a command in all the sub directories of a directory, how to do it using bash script?

```
# In this example `du -ksh` is executed to get the size of each sub directory 
##Get disk usage of all sub directories#########################
function duall(){
    for d in */; do
        if [ -d "$d" ]; then
            echo "$d"
            cd "$d"
            du -ksh # Replace this line with any command required
            cd ..
        fi
    done
}
```
Add the function to the `.bashrc` file in the home directory and below the function add an alias for the function:
```
alias duall="duall" # Disk usage of all sub directories
```
Now the function `duall` available as a command. 

---
## How to remove all the files of a given type recursively?

```
find . -name "*.bak" -type f -delete
```
> *Warning:* If the `-delete` is issued before `-name` option, find will delete all the file.

---
## How to tar all the folders and file except few?
```
tar --exclude='./folder' --exclude='./upload/folder2' -zcvf /backup/filename.tgz .
```
[Reference](https://stackoverflow.com/a/984259/1437877)

---
## How to retain the folder structure while archiving using 7z?
It helps to create a archive file with full path later to exactly recreate the same folder structure while extracting the zip file.
```
7z a -spf some.zip ./folder/subfolder/*
``` 
While extracting the some.zip file all the folder structure will be retained.
```
7z x some.zip
```
---
Typeform Navigator: My Raycast Extension
Tags: javascript, showdev, productivity, react
Published: 2022-09-05 08:10:53

I discovered [Raycast](https://raycast.com) a few months ago, at first sight I notice the power of extensions. You can create automation and handy commands for everything.

I am a Software Engineer at Typeform, so my day to day use of the platform is sightly different to a standard user or customer. I have a lot of workspaces, some shared, some private and within them I have a lot of testing forms, each for every use case I usually work with. So, I have created [Typeform Navigator](https://www.raycast.com/jdvr/typeform). 

## Typeform Navigator

Typeform Navigator allows you to easily check form main stats, navigate to workspace page or to a form results page. There are other handy commands like copy form filling url or form ID.

![Screenshot of form overview on Typeform Navigator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnq7y7hr91ti6hwpzrmc.png)


![Screenshot of workspace forms listing on Typeform Navigator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8l846zx1xcb7dsed7x8m.png)

## Create a Raycast extension

Typeform Navigator is a nice example of raycast extension because it includes, listing, detail and it requires configuration (a personal token). You can found the source code on my github: [jdvr/typeform-navigator](https://github.com/jdvr/typeform-navigator).

Developer experience is a key advantage of Raycast you can check their [Developer Documentation](https://developers.raycast.com/), starting a new extension is really easy.

The only pain point is publishing in on their storage because you need to create a pull request to their [extensions repository](https://github.com/raycast/extensions/pull/1261).

If you are a Typeform user, test the extension and let me know what do you think.


The project was part of Hive Sprint, a two weeks hackathon where Typeform employees have freedom to spend time on any initiative that might improve the platform or the product.
What does __all__ mean in Python?
Published: 2022-09-05 08:05:27

1) Stackoverflow just makes it more complicated to understand something that is complicated
2) Python docs and people working in/on/at it love to talk as if they are wizards from the lord of rings or some other obscure place. 

So WTF is __all__ and why should/would you put it in the __init__ of a package/module? 

Most people who MADE/MAKE python come from C/C++ as all human beings must, so they need and crave a way of exerting control over how objects and data are accessed, that is more pronounced because well python has literally no controls in place everything is everywhere all the time and can be accessed by everyone. 

So what do they do? __all__ is realization of that fetish for control over data. When you put __all__ at the top of a file, then you are sure excuting from module import * only and only imports those things you put in the  __all__ array at the top of the file. So in reality __all__ is a shorthand for making sure with one tiny line of code you are importing only and exactly a few line of code.

If you asked me I think it is useless and mostly cyber-erotic manner of coding which is contagious btw.


if module: a.py -->

`__all__ = ['bar', 'baz']

waz = 5
bar = 10
def baz(): return 'baz'`


then when you do
`import from a *
`
you effectively get bar and baz but not waz.

Thats all.

If you got here  because in the middle of an amazing hacking session you came across this yet an other weirdness of python and went down rabbit holes to understand its value, PLEASE STOP, go get an ice creme, chat up a girl/boy, take a deep breath and just let go......
Returning HTML Fragment from String
Tags: javascript, dom
Published: 2022-09-05 08:00:38

Here is a very nice way to perform this action.
Thanks to [Jonathan Neal](https://gist.github.com/jonathantneal/d3ce9f23edb1567cbd5d9d72298d7e0f)

```js
createFragment = (range => {
	range.selectNodeContents(range.createContextualFragment('<template>').lastChild)
	return range.createContextualFragment.bind(range)
})(new Range())

``` 

```js
[
  { name: 'Hedral', coat: 'Tuxedo', legs: 4 },
  { name: 'Pillar', coat: 'Ticked Tabby', legs: 3 },
].reduce(
  (table, { name, coat, legs }) => {
    const tr = createFragment(`<tr><td><td><td>`)
    const [ nameTd, coatTd, legsTd ] = tr.firstChild.children
    nameTd.textContent = name
    coatTd.textContent = coat
    legsTd.textContent = legs
    table.lastChild.append(tr)
    return table
  },
  createFragment(`<table><thead><th>Name<th>Coat<th>Legs<tbody>`).firstChild
)

```

Yuou can test it here [CreateFragment](https://flems.io/#0=N4IgZglgNgpgziAXAbVAOwIYFsZJAOgAsAXLKEAGhAGMB7NYmBvEAXwvW10QICsEqdBk2J5qAJxgZGAMXEYA5jgYACALwqAFPLQKY6gHwrgAHTQniOvfjgxY1YgDlaAExgBheowZxtGXTD4ElKMnsIAHsQArhhQcorKxJoA5AA8jFgADlDSMAbJAJT4OXDE7oTQLgVmFpLR4mgqVoHBuWGMkTFx8koi+ABGEGgufgHVaKwFmmgwAO4qAEr+epoFBQDcNWiwxE3wUVC7GshmKsYqmDiIKskAEjAu8lDJFCp00tfJACpR4Q+0LxUsAUcGuABYVOxTudLjBPgAFaA5cSA97ET5fCDUADWDxUXww-X6AE9AcDQSoAMyQihmAC6+EkLii1BgmmhmmIhNgr2AFy4rzRr3JkIKhmM0LOQlKKks6jekly8V6DE0AAN0uIDOkXNriLqdQY1eMzlL6DLkPycF8XILaNIbcKYCCbSo6fLLPhIOJSuVKkEKlBHkxJVaYDb8B0yl4RPLYaG0RGo+1Yxo0aHyUmYJEU6oNOTQ1z+rBihhfYGXPgMJlMkwRpYTaa6lEGrLuTBoVDGgqQjBlYl1el23rCFIDcRCAZHFx0pPPNJZwYADLOuDpfquYlGore8uVMxirYuWjUKKJAabqs1uvafaHAqUEC2ezECDmvAAJgAjIgPwAOABaAAGRAgLYDgQFhPAgjgAQaBjZgeDYOlWCAA)
Today's Daily Humor For Devs - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2022-09-05 08:00:14

---
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/5e1259bf358c4.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:___ Hey officer! How did the hackers escape?

___A:___ No idea. They just ransomware.
 -->
EFS - Elastic File System
Tags: efs, aws
Published: 2022-09-03 09:36:24



#### EFS - Elastic File System

- EFS is a managed NFS (network file system) that can be mounted on many EC2 instances
- EFS works with EC2 instances across multi AZs
- EFS is highly available, scalable, but also more expensive (3x GP2) than EBS
- EFS is pay per use
- Use cases: content management, web service, data sharing, Wordpress
- Uses NFSv4.1 protocol
- We can use security groups to control access to EFS volumes
- EFS is only compatible with Linux based AMIs (not Windows)

#### EFS Performance and Storage Classes

- EFS Scale
    - Thousands of concurrent NFS clients, 10 GB+ per second throughput
    - It can grow to petabyte scale NFS automatically
- Performance mode (can be set at EFS creation time)
    - General purpose (default): recommended for latency-sensitive use cases: web server, CMS, etc.
    - Max I/O - higher latency, throughput, highly parallel, recommended for big data, media processing
- Storage tiers: lifecycle manage feature
    - Standard: for frequently accessed files
    - Infrequent access (EFS-IA): there is a cost to retrieve files, lower price per storage

#### EBS vs EFS

- **EBS volumes**
    - Can be attached to only one instance at a time
    - Are locked at the AZ level
    - GP2: IO increases if the disk size increases
    - IO1: can increase IO independently
    - To migrate an EBS across AZ:
        - Take a snapshot
        - Restore the volume from the snapshot
    - Root EBS volumes get terminated by default in the EC2 instance is terminated (this feature can be disabled)
- **EFS**
    - Can be mounted to multiple instances across AZs via EFS mount targets
    - Available only for Linux instances
    - EFS has a higher price point than EBS
    - EFS is pay per second, we can leverage EFS-IA for cost saving
Humbly presenting the next generation configuration package
Published: 2022-09-05 07:45:59

Hello everyone!

I have been working on a flexible, configurable and extensible configuration engine for NodeJS and browser frameworks alike and today I released v2 in beta.

I have great confidence in it and therefore I wanted to introduce it to the world:  [wj-config](https://www.npmjs.com/package/wj-config).

It is inspired by .Net's Configuration mechanism as I find it, in a word, excellent.

## Summary

It works on **NodeJS** applications (CommonJS and ES Modules), including **Express**, and also can be used in browser frameworks like **React**.  The `Version_2` branch in GitHub has working examples.  I am not a front-end dev, so I cannot say for sure if or how well it works with other browser frameworks, but I'm willing to bet it works.  If you test a framework, please let me know if it works.

It has 6 different ways to obtain configuration data: Objects, fetched objects, dictionaries, environment variables, single values and raw JSON.  Each source has different configuration options.

If you need, you may create new data sources as you see fit as it is an extensible configuration framework.

Personally, what I find most useful is how URL's are defined:  One simply adds them to a sub-section called `ws` and the configuration engine converts them into functions that can replace values and add query strings, all while URL-encoding the replacement values.

I could go on and on, but I already did this in its extensive ReadMe file, so I invite you all to check it out in hopes that you like it and find it useful.

Cheers!
How can I remove a password from a PDF file for free?
Published: 2022-09-05 07:44:22

A few days back, I was seeking a manual method to **[remove PDF Password](https://www.pdfpasswordremover.pdfchamp.com/)** files, and with the manual process, I lost all my data. Then one of my friends told me about the PDF Password Remover tool, which is the safest way to remove restrictions on editing, printing, copying, etc. The PDF Password Remover utility offers the fastest scanning mode along with full data security. If you want to know more about the software, then you must try the free demo version of the free PDF Password Remover tool.
Địa chỉ bán máy phát điện 100kva Hyundai chính hãng tốt nhất
Tags: mayphatdien, hyundaigensets
Published: 2022-09-05 07:39:57

 Máy phát điện 100kva của Hyundai Model DHY110KSE với công suất liên tục 100kva, công suất dự phòng 110kva, điện áp 3 pha 380V, tần số 50Hz. Vỏ máy được thiết kế lắp ráp với tấm thép chắc chắn, mút đệm chống sốc, độ cứng và độ truyền rung thấp. Cửa ra vào rộng làm cho việc sử dụng và bảo trì rất thuận tiện, liên hệ ngay đến chúng tôi để được báo giá máy phát điện 100kva tốt nhẩt

#Thông tin kỹ thuật máy phát điện 100kva# 
ModelHyundai DHY110KSE
Công suất liên tục (KVA): 100
Công suất dự phòng (KVA): 110
Tần số (Hz): 50
Điện thế (V): 230/400
Dòng điện (A): 158.8
Cổng kết nối ATS: Có
Ắc quy2x12V-60 Ah
Bình nhiên liệu (L): 280
Dung tích nước làm mát (L): 30
Tiêu hao nhiên liệu (100% CS): 23.1 L/h
Thời gian chạy liên tục(h 100%): 12.12
Độ ồn cách 7m  (dBA): 70
Trọng lượng toàn bộ (kg): 1,875
Kích thước L×W×H (mm): 2930x1100x2000
Xem chi tiết tại: [https://thietbidienduphong.blogspot.com/2022/09/dia-chi-ban-may-phat-dien-100kva-hyundai.html]
Tư vấn mua máy phát điện 15kva tốt nhất
Tags: mayphatdien, hyundaigenset
Published: 2022-09-05 07:34:13

 Hiện nay, các dòng máy phát điện công suất 15kva của Hyundai được phân phối rộng rãi trên toàn lãnh thổ Việt Nam, bảo hành 12 tháng kể từ ngày vận hành. Bài viết sau sẽ giúp bạn tìm hiệu về các địa chỉ bán máy phát điện 15kva Hyundai chính hãng tốt nhất. 
#Thông tin kỹ thuật máy phát điện 15kva# 
Model: Hyundai DHY16KSE
Công suất liên tục: 15kva
Công suất dự phòng: 16.5kva
Tần số: 50 Hz
Điện thế : 230/400V
Dòng điện: 21.7A
Cổng kết nối ATS: Có
Ắc quy: 60 Ah
Bình nhiên liệu: 95L
Dung tích nước làm mát: 5.2L
Tiêu hao nhiên liệu (100% CS): 5.43 (L/h)
Thời gian chạy liên tục(h 100%): 17.5
Độ ồn cách 7m : 68(dBA)
Trọng lượng toàn bộ : 735(kg)
Kích thước  L×W×H: 2120x910x1300 (mm)
Mỗi thương hiệu máy phát điện đều có những đặc điểm riêng biệt, vì vậy mỗi sản phẩm được phân phối mức giá khác nhau trên thị trường, để được báo giá máy phát điện 15kva mới nhất, liên hệ ngay đến để được tư vấn.
Xem thông tin chi tiết tại: [https://thietbidienduphong.blogspot.com/2022/09/may-phat-dien-15kva.html]
Máy phát điện 2kw cho gia đình, văn phòng
Tags: mayphatdien, hyundaigensets
Published: 2022-09-05 07:29:05

Máy phát điện 2kw cho gia đình, văn phòng, động cơ chạy dầu, khởi động 2 trong 1 đề tay + giật nổ của thương hiệu Hyundai Hàn Quốc Model DHY20CLE với công suất liên tục 1,7kw, công suất dự phòng 2kw, điện áp 1 pha 220V, tần số 50Hz. Máy phát điện 2kw được thiết kế khung trần, trọng lượng gọn nhẹ giúp bạn dễ dàng sử dụng và di chuyển mọi lúc, mọi nơi.

#Thông tin kỹ thuật máy phát điện 2kw# 

Model: Hyundai DHY-20CLE
Tần số: 50Hz
Công suất liên tục: 1.7KW
Công suất dự phòng: 2.0KW
Điện áp ra: 230V
Dòng điện ra: 9A
Ổ cắm đầu ra: 2x16A
Màn hình hiển thị: LED4
Bình Nhiên Liệu: 15L
Thời gian chạy liên tục 50% tải: 10h
Độ ồn cách 7m/50% tải: 70dB
Điện áp DC (V/A): 12/8,3
Kích thước (dài x rộng x cao): 620x420x540 mm
Trọng lượng: 60 kg
Mỗi thương hiệu máy phát điện đều có những đặc điểm riêng biệt, vì vậy mỗi sản phẩm được phân phối mức giá khác nhau trên thị trường, để được báo giá máy phát điện 2kw mới nhất, liên hệ ngay đến để được tư vấn.
Xem chi tiết tại: [https://thietbidienduphong.wordpress.com/2022/09/01/may-phat-dien-2kw/]
Patterns to avoiding microlithic microservices
Tags: api, microservices, programming, architecture
Published: 2022-09-05 07:19:12

On the previous installment of this series, we discussed the pitfalls that could happen when we split a monolith into microservices. In specific, we talked about creating what are called microliths.  
![](https://www.kanekotic.com/img/microliths.jpg)

Given that you have followed the recommendations on designing your domains correctly. Today we are going to elaborate on patterns to remove that synchronous communication in between 'microservices'. This will help our services to become more resilient.

## The Patterns

### Circuit Breakers

The most simple solution we can go for is called **circuit breakers**. As it implies, is just a piece of code that upon multiple request failed to a downstream service will fail silently and allow service to resume their normal behavior.

![](https://www.kanekotic.com/img/circuitbreakerdesignpattern.png)

What are we solving and what are we letting unsolved:

* ✔️ We don’t fail continuously if some other service fails.
* ❌ We silently don’t finish the entire process requested.
* ❌ We require all chain of dependencies to be called.
* ❌ We force other services to scale to our needs.
* ❌ Data is mutable, so errors will be propagated and not solvable.

### Outbox Pattern

The next level in solving our microlithic issue is to decouple our services using Pub/Sub to exchange models in between services.  
Our service will consume and store the necessary information to run the process locally, and will broadcast the outcome models. This will mean there will always be a strong consistency in the outbox, and eventual consistency on the service database (if it exists).

![](https://www.kanekotic.com/img/reactivemicroliths.jpg)

What are we solving and what are we letting unsolved:

* ✔️ We don’t fail continuously if some other service fails.
* ✔️ We always finish our process and promise the rest will be done.
* ✔️ We just require our service to do what we promise.
* ✔️ Fast services will be fast, and slow services can go slow.
* ❌ Data is mutable, so errors will be propagated and not solvable.

### Event Sourcing

The last level is **event sourcing**. The idea is to use the events that generated a specific state and not use the calculated state that a service can provide us.

This allows a higher resilience due to the immutability of the data. In this case, calculation issues of the past can be solved, as we can reprocess the entire set of events that took us to a certain state.  
![](https://www.kanekotic.com/img/microsystems.jpg)

## Conclusion and follow-ups

These are some of the patterns that can make our services more independent and resilient. Nevertheless, each of them has a different complexity, meaning it also affects the complexity of our code. For this, we need to make sure we use the correct tool for the job.
Top Python Coding Repos
Tags: python
Published: 2022-09-05 07:12:29

[requests ](https://github.com/psf/requests)- A simple, yet elegant, HTTP library. 
[sanic ](https://github.com/sanic-org/sanic)- Next generation Python web server/framework | Build fast. Run fast.
click - Python composable command line interface toolkit
[elasticsearch-dsl-py](https://github.com/elastic/elasticsearch-dsl-py) - High level Python client for Elasticsearch
[panel ](https://github.com/holoviz/panel)- A high-level app and dashboarding solution for Python
[internetarchive ](https://github.com/jjjake/internetarchive)- A Python and Command-Line Interface to Archive.org
[coconut ](https://github.com/evhub/coconut)- Simple, elegant, Pythonic functional programming 

Find complete list [here](https://www.top-repos.best/repos/tag/855cd0aa9345b0c61f73/python-coding-tools/)..
Node.js vs django
Published: 2022-09-05 07:11:59

Even though Node.js and Django are very different tools, teams frequently discuss them when deciding which technology to utilise to create online applications.Similar to how Django makes it possible to use Python in both the front end and the back end of your web app, Node.js also makes it possible to utilise JavaScript, which is generally only used for front end development, for server-side scripting.
The best way to choose between Django and Node.js for your project is to compare their strong and weak points and find out what kinds of projects they are typically used for. This is because both Django and Node.js are simply excellent at what they do.
Django is a powerful full-stack Python web framework that comes fully loaded with features that take care of all common web development issues. That includes user authentication and content administration.
Even though it gets bundled with frameworks a lot, Node.js isn’t one – it’s actually a JavaScript runtime environment, built on Chrome’s JavaScript engine.
Made for writing server-side applications with JavaScript, Node.js is the technology of choice for a large and growing number of developers.