teleren/devto huggingface dataset:
Design Patterns in One Sentence
Tags: programming
Published: 2022-11-08 07:11:39

## Factory Method

The abstract class focuses on business logic, while its subclasses determine the implementation details.

## Abstract Factory

2D factory method. Create different products of the same variant.

## Builder

Create product part by part, usually in chain.

## Prototype

Provide a method to clone itself.

## Singleton

Always return the same instance.

## Adapter

Encapsulate an instance of old class, and provide new interface to the outside.

## Bridge

Different abstraction layer and different implementation layer can be mixed at will.

## Composition

A tree where all nodes provide the same interface, the leaves do the job, and non-leaves aggregate the results of their own leaves.

## Decorator

Encapsulate an instance of a class, and provide the same interface to the outside.

## Facade

Encapsulate complicated logic, and provide simple interface to the outside.

## Flyweight

Create a new class for those memory-consuming, shared attributes, for which a factory is created for caching.

## Proxy

Encapsulate an instance of a class, provide the same interface to the outside, and manage the lifecycle of the internal instance.

## Chain of Responsibility

Process an object through a chain, where each link can determine whether to continue or terminate processing.

## Command

Abstract a callback function as a class, and makes it fetch arguments - explicitly on initialization or on its own - every time the command is executed.

## Iterator

Encapsulate an instance of a class, and provide the iteration method of this instance.

## Mediator

Elements in a system send their interaction information to the mediator, and listen to its schedule, rather than directly interacting with each other.

## Memento

Create snapshots of another class.

## Observer

The object notifies all of its observers of its latest update.

## State

Divide a class with volatile states into state and context, where the state executes all state-related operations and can modify the state on its own.

## Strategy

Abstract different strategies into classes, and let the business logic pick which one to use.

## Template Method

The template parent class implements a set of standard methods, while its subclasses overload methods according to their needs.

## Visitor

The visited class redirects request to the visitor, who extends the interface of the visited class.
Adding ads to your website
Tags: website, webdev, ads, programming
Published: 2022-11-08 07:05:06

https://cyclingg.web.app

---

You can add **ads** to your websites. You just need to login to **adsterra** and then you need to add the link of your website ,you then need to choose which ads to display on your website and also the size and type of the ads. They will the take a few minutes to check your website and then provide you with the code to write in your html file where you want to display the ad and then you have to again deploy your website with the new code and that's how you can add ads to your website.

---

[Website](https://cyclingg.web.app)
The Python/numpy porting to Perl product
Tags: perl, spvm, python, numpy
Published: 2022-11-08 07:02:58

I'm starting the Python/numpy porting to Perl product.

The SPVM is a static typed language to provide the numeric array data structure to Perl. This is based on the object of SPVM::Numpy.
 
# What Is SPVM?

<a href="https://metacpan.org/pod/SPVM">SPVM</a> is a static typed language that can be used from Perl. <a href="https://metacpan.org/pod/SPVM">SPVM</a> is a part of the modules to create the Python/numpy porting to Perl. See also <a href="https://metacpan.org/pod/distribution/SPVM/lib/SPVM/Document/Language.pm">SPVM Language Specification</a>.
SPVM::Sys is nearing completion - The parts of the Python/numpy porting to Perl product.
Tags: perl, spvm, python, numpy
Published: 2022-11-08 07:00:58

<a href="https://metacpan.org/dist/SPVM-Sys/contribute">SPVM::Sys</a> is nearing completion.

My daily commits are seen at <a href="https://github.com/yuki-kimoto/SPVM-Sys/commits/master">Github</a>.

```
use Sys::IO;

my $file = "a.txt";
my $stream = Sys::IO->fopen($file, "r");

```

If this module is completion, I'm going to start to create <a href="https://github.com/yuki-kimoto/SPVM-IO">SPVM::IO</a>.

# What Is SPVM?

<a href="https://metacpan.org/pod/SPVM">SPVM</a> is a static typed language that can be used from Perl. <a href="https://metacpan.org/pod/SPVM">SPVM</a> is a part of the modules to create the Python/numpy porting to Perl. See also <a href="https://metacpan.org/pod/distribution/SPVM/lib/SPVM/Document/Language.pm">SPVM Language Specification</a>.
Max Area of Island
Tags: leetcode, python
Published: 2022-11-08 06:57:46

You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.

The area of an island is the number of cells with a value 1 in the island.

Return the maximum area of an island in grid. If there is no island, return 0.


```py

class Solution:
    def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
        ROWS, COLS = len(grid), len(grid[0])
        visit = set()

        def dfs(r, c):
            if (
                r < 0
                or r == ROWS
                or c < 0
                or c == COLS
                or grid[r][c] == 0
                or (r, c) in visit
            ):
                return 0
            
            visit.add((r, c))
            return 1 + dfs(r + 1, c) + dfs(r - 1, c) + dfs(r, c + 1) + dfs(r, c - 1)

        
        area = 0
        
        for r in range(ROWS):
            for c in range(COLS):
                area = max(area, dfs(r, c))
        
        return area

```
Use Verified Routes in Phoenix 1.7+
Tags: elixir, phoenix, router, webdev
Published: 2022-11-08 06:44:35


![An image showing how to use verified routes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/idmkrshx9y54749huxho.png)

Phoenix 1.7+ includes the [Verified Routes](https://hexdocs.pm/phoenix/1.7.0-rc.0/routing.html#verified-routes), which provides compile-time checks of your router paths. This is a great way to make sure that your paths are always correct! It can help you avoid potential errors in your code.

## How do I:

### Use the verified route?

```elixir
# Use it with the new sigil `~p` e.g.
~p"/"
~p"/user/profile"
~p"/posts"
```
### Add params to verified routes?

```elixir
# route get "/posts/:post", PostController, :show

# Using string interpolation
post = %{slug: "post-about-verified-routes"}
iex> ~p"/posts/#{post.slug}"
"/posts/post-about-verified-routes"

# In liveview using assings
~p"/posts/#{@post.slug}"


```

#### Using [Phoenix.Param](https://hexdocs.pm/phoenix/1.7.0-rc.0/Phoenix.Param.html) protocol

```elixir
~p"/posts/#{@post}"
```

### Add query params to verified routes?

```elixir
# route get "/posts", PostController, :index

# Hardcode the params
# Note that this doesn't url encode the params:
iex> ~p"/posts?post=1&search=verified routes"
"/posts?post=1&search=verified routes"

# String interpolation
page = 1
search = "verified routes"
iex> ~p"/posts?page=#{page}&search=#{search}"
"/posts?page=1&search=verified+routes"

# Keyword list
keyword_list = [posts: 1, search: "verified routes"]
iex> ~p"/posts?#{keyword_list}"
"/posts?posts=1&search=verified+routes"

# Map of values
map_of_values = %{"posts" => 1, "search" => "verified routes"}
iex> ~p"/posts?#{map_of_values}"
"/posts?posts=1&search=verified+routes"
```

Hope this helps, have a nice day!
[1500$] Im looking for react native developer.
Tags: reactnative
Published: 2022-11-08 06:40:21

Im looking for senior react native developer or company.

Monthly, full time developer 2 person.

Monthly sallary: 1000$ ~ 1500$

It's going to be 3 ~ 4 month project.

Im going to make learning language application through Youtube.

Please share your portfolio and curriculum vitae to my email.

Email:
tens.spanish@gmail.com

Thanks a lot.
Waiting for great React native developers.

Regards.
NextSketch 2: Working on sub-diagrams inside the IDE!
Tags: productivity, showdev, news, architecture
Published: 2022-11-08 05:37:07

Hello!

We've been working hard on NextSketch 2 over the last 2/3 weeks as we rewrite the NextSketch platform entirely to be easier to maintain and work with.

If you're unfamiliar with the original NextSketch, it's a commercial diagram creation plugin integrated into IntelliJ-based IDEs, visit www.nextsketch.ca to learn more.

This progress update shows our progress on developing NextSketch 2, the next iteration of the platform.

So far, we've re-implemented Inspections (making them live so that they update as you change them), re-implemented Node linking, and added zooming support (which should work with a mouse wheel or the two finger scroll gesture on trackpads)

{% youtube df8bIr4I6bA %}


Also, don't mind the UI right now, it's very prototype-y and hard to look at, but that will definitely change in the coming weeks. Also, OBS Studio doesn't pick up on the Inspector popup but it is there :)


In the last updates, we mentioned we were working on a secret feature, and that we'd reveal it if we were sure we could put it in. Now, it's time for the reveal!

Introducing...

Sub-diagramming!

{% youtube Rzpu2JDk3Co %}

With subdiagramming, you can now create multiple layers of depth in your sketches. Start with a high-level diagram, then select a container to see a sub diagram that explains something else in detail.

This system is loosely inspired by the C4 model of diagramming, but we wouldn't call NextSketch 2 C4-Compliant just yet. 


Let us know if  you're excited for NextSketch 2 and if you find NextSketch useful! 

Cheers! :^)
How To Validate Form In Laravel 9
Tags: laravel, laravel9, validate, form
Published: 2022-11-08 05:30:00

In this article, we will see how to validate a form in laravel 9. For any incoming data, we need to validate it before storing it in the database. Laravel provides several different approaches to validate your application's incoming data. 

It is most common to use the validate method available on all incoming HTTP requests. Laravel 9 includes a wide variety of convenient validation rules that you may apply to data for validation. 

In laravel 9 you can also add error messages in blade files, and custom validation in laravel 9.

So, let's see form validation in laravel 9 and custom form validation in laravel 9.

Here, we will use has() function in the session to check the error message in laravel 9. 

Using this example you can check simple form validation as well as you can create your own custom validation in laravel 9.
Baby's first text-based horror game
Tags: beginners, python, codenewbie
Published: 2022-11-08 05:26:50

_Gradient Descent_ is my final project for Codecademy's CS101 course; the assignment was to "build a basic terminal program of your choice", so I made a text-based horror game in the style of _[Choose Your Own Adventure](https://en.wikipedia.org/wiki/Choose_Your_Own_Adventure)_.

This game is unfinished, and I hope to keep working on it as time allows.

![Gradient Descent gameplay](https://media.giphy.com/media/VOJs5Jnlpt5ekQcfoF/giphy.gif)



The code has a lot of redundancy, especially for pacing and text effects. In hindsight, I could have created a few functions and just called those. I'd like to make that improvement. I'd also like to make the scenarios (decision_1(), decision_2()...) modular i.e. easily callable from one another, whereas right now the final-decision scenario is the only modular one. The game would ideally be a Möbius strip of flexible decision-making horror, until the player reaches a terminal state.

[Link to the code on GitHub](https://github.com/jemalyoung/terminal-game-gradient-descent)

This project taught me how easy it is to become fascinated by the siren song of low-hanging marginal improvements. I want to keep working on this damned script, there are so many problems with it and it could be so much better.
C++ Vector Global Variable
Tags: cpp, webrtc
Published: 2022-11-08 05:18:51

HI, 

I need some help about global variable or other methods that seems suitable with my case.

I have two functions. One for the bridge from javascript to webrtc. and one for sending the package to p2p. 

the problem is that i need to get the variable passed from the javascript in the first function to function 2. 

so i was thinking of creating a global variable and i declared it this way 
`std::vector<uint8_t> new_keys;`

but when i did that i get this error.

`error: declaration requires a global destructor [-Werror,-Wglobal-constructors]
std::vector<uint8_t> new_keys;`

anyone have any thought will be much appreciated, Thank you
Good News!
Tags: beginners, programming, tutorial, career
Published: 2022-11-08 05:14:00

Hey hey. It's Zada, your new neighbor. I am pleased and very much happy to announce that I will be publishing a series of articles for the benefit of members of this neighborhood.
This series would shed light on the various activities, step-by-step, involved in the entire process of working as an intern at **HNG**. Oh yes! This series promises to be insightful, motivating, and educative. It will also give readers a sense of experience.
You are hereby cordially invited to walk with me on this exciting journey. I do hope that no one misses out on this.

Link to the first episode:https://dev.to/zadazini/the-everyday-life-of-an-hng-intern-isaac-ojerumus-story-580d
Agile Leadership - 3C'S
Tags: storybytes, business, data, success
Published: 2022-11-08 05:09:35


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

Agile organisations need Agile leadership. Neuroscience has shown that humans feel less threatened when they have more autonomy. When we are not threatened, we think more constructively and be more creative. In addition to the ever-changing technical landscape, every change around us is happening far too rapid for teams to constantly refer up in the hierarchy to find out what they should be doing next. Everyone in the organisation should embrace leadership skills. A servant leadership mindset that coaches the people in the right direction requires understanding every individual’s purpose. Giving people the autonomy to make the decisions that their skills and training equip them to make is a faster way to work and a better way to work. By building up an Agile culture, we at Web and App Studio enable individuals to flourish at their own pace.
8 Online Tools for Your Images and Videos and Screen Recording
Published: 2022-11-08 05:09:09

Hi everyone, in today' post I'm going to talk about 7 online tools that help you work with videos and images like compressing images and videos. And I also introduce you'll to the browser window screen recorder. So enjoy.


# 1. [Motionbox](https://motionbox.io/)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vylwbvky34w5zs97erxj.png)

Simple Collaborative Video Editing For Creatives. 
Motionbox exists to help creators and teams make better videos, faster. Get started today, no credit card required. 
Free option provides 2gb storage, unlimited projects and a lot more

# 2. [Vidmore](https://www.vidmore.com/free-online-screen-recorder)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwbi7okf1x13tudj8iml.png)

An easy-to-use Free Screen Recorder Online to capture to capture any area of your screen as a screencast video file losslessly.

# 3. [FlexClip](https://www.flexclip.com/tools/screen-recorder/)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnj7fjmri79ekpm5thgm.png)
Record your screen, webcam, and voice with one click.

# 4. [Veed.io](https://www.veed.io/video-compressor?_)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfsv2zjvu3o4if5386aa.png)
Compress video and reduce video file size online for free without losing quality.

# 5. [Webm to Mp4](https://webmtomp4.com/)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kxjrylhn0xtfb844oq0r.png)
Convert your WebM videos to MP4 with ease and completely free.

# 6. [Webm to Gif](https://www.freeconvert.com/convert/webm-to-gif)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a195h4ld68693km3pa56.png)
Easily convert WebM files to GIF animations online.

# 7. [Image Compressor](https://imagecompressor.com/)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ybkzlfn4ygxtag8lhju3.png)

This online image optimizer uses a smart combination of the best optimization and lossy compression algorithms to shrink JPEG, GIF and PNG images to the minimum possible size while keeping the required level of quality.

# 8. [Video Enhancer](https://clideo.com/video-enhancer)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4affcdtjxujbewnokkag.png)
Adjust contrast, brightness, saturation, and other video settings with this tool
Impact Of UI and UX
Tags: storybytes, uiux, design, interactiondesign
Published: 2022-11-08 05:03:25


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


The visual impression is a crucial factor for the success or failure of a product. But why is it so difficult? If you create a good UI, you’ll be blending three main things: visual design, interaction design, and information architecture. UI design contributes significantly to the positive user experience. Additionally, UX is a lot more all-encompassing. It’s not just about the direct way that users deal with a product, but about everything else that plays a role in the user’s experience. This includes things that UI doesn’t deal with, such as the product’s “ feel “ or extensive research based on users’ experience. We at Web and App Studio emphasise the user’s point of view by validating the UI and UX direction of every product we touch upon. Finally, one of the most important aspects of a product is that first impressions or feelings do not lower the value in the user journey.
SSR vs CSR
Tags: storybytes, performance, webdev, html
Published: 2022-11-08 04:54:38


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

Every web architect is familiar with the dilemma: Should I render a site from the client-side or the server-side? Like other aspects of web development, it all depends on what you plan to do with your website. This is where we at Web and App Studio analyse and decide the next step. Since the invention of search engines, the conventional method of setting up HTML onto a screen took place through server-side rendering (SSR). Websites can become a lot more complex these days. Much of the modern web can not be called websites; they are indeed Web Applications using client-side rendering (CSR) techniques as they offer a way to create more dynamic, scalable websites. Choosing the right rendering method will depend on what works for you.
Deploy a Symfony website to multiple droplets on DigitalOcean
Tags: devops, cloud, php, symfony
Published: 2022-11-08 04:53:24

I'm a **Symfony developer** and need to deploy my website to multiple servers on DigitalOcean. The current tools and services aren't a good fit for my use case anymore, so I'm building [Clustermin ](https://www.clustermin.com/)to help me automate my deployment tasks.

**Deploying to multiple servers** is a must for high availability. When one server is down, there's another server to continuously serve my website visitors. When I want to upgrade servers, e.g. from Ubuntu 20.04 to 22.04, or resize servers, I can just create new servers and delete the old ones.

[Read the full guide here](https://blog.clustermin.com/2022/11/deploy-symfony-website-to-multiple.html).
5 Cheap Purchases That Will Make You More Productive!
Published: 2022-11-08 03:42:29

These cheap items can save you time, make you healthy, reduce mental and visual clutter, and most importantly, make you productive.



Being productive does not have to be expensive. Just by spending a few dollars you can greatly increase your productivity. I will go over some of these purchases that personally worked for me. None of these are affiliate links. I just list some products here for your convenience.

https://www.youtube.com/watch?v=St2tH4NHvbs



#1 - 3-in-1 Wireless Charging Pads (USD $39)



Most devices support some type of wireless charging. Depending on how many devices you have, you can get charging pads that can charge up to 5 devices. They come in all different shapes, sizes, and charging speeds. Pick one that works for you the best.



#2 - Physical Alarm Clock (USD $10)



If you need an alarm clock, get an actual alarm clock. There are literally thousands of alarm clocks with different sets of bells and whistles you can buy. Just get the cheapest one.



#3 - Reusable Water Bottles (USD $10)



Drinking water all the time makes you less hungry, keeps you feeling energetic, and helps you avoid brain fog. You don't have to get an expensive water bottle. On Amazon, I have seen water bottles as low as $10-$15.



#4 - AirTags (USD $30)



AirTags are Apple's answer to tracking devices, similar to Tile. You can keep these AirTags with anything you fear losing. Then, you can track them from your iPhone through the Find My app.



#5 - Desk Organizer (USD $20)



Fumble around the house looking for car keys, house keys, garage clickers, or worse, wallets, when going outside. Getting a simple, minimalist desk organizer fixed this for me, forever. Every item in my apartment has a place they can call home.
Are SVG Animations important in web Development?
Tags: html, css, javascript, webdev
Published: 2022-11-08 03:32:18

## Are [SVG](https://prhocoding.com/index.php?page=language&cat_id=1&lang_id=5) Animations important in [web Development](https://prhocoding.com/prhocoding_sitemap.php)?



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


As we know, [animations](https://prhocoding.com/index.php?page=Tutorials&cat_id=1&lang_id=2&sec_id=27&tutorial_id=108) are an important part in retaining users to a [site](https://prhocoding.com/) because it will catch user attention for sometime on the site. During this time, he/she may read something from your content and this will overall benefit both of you.



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


## Importance of [Animations](https://prhocoding.com/index.php?page=Tutorials&cat_id=1&lang_id=2&sec_id=27&tutorial_id=109):-


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


- It will keep users on [website](https://prhocoding.com/index.php?page=language&cat_id=1&lang_id=1)
- Improve overall [styling](https://prhocoding.com/index.php?page=language&cat_id=1&lang_id=2) of website
- Makes your site look [dynamic](https://prhocoding.com/index.php?page=language&cat_id=1&lang_id=3)
- Increase traffic if animations are properly maintained


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

## Some important Animations [properties](https://prhocoding.com/index.php?page=section&cat_id=1&lang_id=2&sec_id=72) are:-


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

- [animation-name](https://prhocoding.com/index.php?page=Tutorials&cat_id=1&lang_id=2&sec_id=72&tutorial_id=954) 
- [animation-duration](https://prhocoding.com/index.php?page=Tutorials&cat_id=1&lang_id=2&sec_id=72&tutorial_id=951)
- [animation-timing-function](https://prhocoding.com/index.php?page=Tutorials&cat_id=1&lang_id=2&sec_id=72&tutorial_id=956)
- [animation-iteration-count](https://prhocoding.com/index.php?page=Tutorials&cat_id=1&lang_id=2&sec_id=72&tutorial_id=953)
- [animation-direction](https://prhocoding.com/index.php?page=Tutorials&cat_id=1&lang_id=2&sec_id=72&tutorial_id=950)