teleren/devto huggingface dataset:
Linked list golang and python
Tags: go, python, dsa
Published: 2022-09-05 10:13:14

```
class Node:
    def __init__(self,value):
        self.value = value
        self.adress=None
# creating a head and tail
class linkedList:
    def __init__(self):
        self.head=None
        self.tail=None
        self.size=0


    def addvalue(self,v):
        newest=Node(v)
        if self.size==0:
            self.head=newest
        else:
            self.tail.adress=newest
        self.tail=newest
        self.size+=1
    def addfirst(self, e):
        newest = Node(e)
        if self.size==0:
            self.head = newest
            self.tail = newest
        else:
            newest.adress= self.head
            self.head = newest
    def addany(self, e, position):
        newest = Node(e)
        p = self.head
        i = 1
        while i < position-1:
            p = p.adress
            i = i + 1
        newest.adress = p.adress
        p.adress = newest
        self.size += 1


    def display(self):
        print("head val:",self.head.value)
        p=self.head
        while p:
            print(p.value,end=" ")
            p=p.adress
        print()
        print("tail val: ",self.tail.value)


l=linkedList()
l.addvalue(10)
l.addvalue(20)
l.addvalue(30)
l.addvalue(40)
l.addvalue(50)
l.addvalue(60)
l.addany(70,3)
l.addfirst(80)
l.addfirst(90)
l.display()
```

```
package main

import (
	"fmt"
)

type Node struct {
	value  interface{}
	adress *Node
}

type List struct {
	head *Node
	tail *Node
	size int
}

func (l *List) Insert(d interface{}) {
	list := &Node{value: d, adress: nil}
	if l.size == 0 {
		l.head = list
	} else {
		l.tail.adress = list
	}
	l.tail = list
	l.size++
}

func (l *List) addfirst(d interface{}) {
	list := &Node{value: d, adress: nil}
	if l.size == 0 {
		l.head = list
		l.tail = list
	} else {
		list.adress = l.head
		l.head = list
	}
}

func (l *List) addany(d interface{}, position int) {
	list := &Node{value: d, adress: nil}
	p := l.head
	i := 1
	for i < position-1 {
		p = p.adress
		i = i + 1
	}
	list.adress = p.adress
	p.adress = list
	l.size += 1

}

func (l *List) display() {
	p := l.head
	fmt.Println(l.head.value)
	for p != nil {
		fmt.Print(p.value, " ")
		p = p.adress
	}
	fmt.Println()
	fmt.Print(l.tail.value)
	fmt.Println("")
	fmt.Print(l.size)
}

func main() {
	link := List{}
	link.Insert(5)
	link.Insert(9)
	link.Insert(13)
	link.Insert(22)
	link.Insert(28)
	link.Insert(36)
	link.addany(70, 3)
	link.addfirst(80)
	link.display()
}
```
API Project Template V2.0.0
Tags: node, typescript, javascript, showdev
Published: 2022-09-05 10:05:52

Several months ago, I posted [API Project Template, Written in Typescript](https://dev.to/arifintahu/api-project-template-written-in-typescript-5dmk) about boilerplate for building API project in Typescript.

Now, I made some changes especially in code style consistency, unit test coverage, swagger docs, and types.

### What's new?
- Improve coverage unit test on repositories and services using Jest

![Unit test coverage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enp60csxwyjnnu1p744k.png)
- Refactor project structure as below

```
├── .husky/                     # Pre-commit config for lint staged
├── docs/                       # Swagger API docs
├── src/                        # All application source
├──── @types/                   # Type definition for modules
|
├──── api/
├────── controllers/            # Define all controllers
├────── middlewares/            # Define all middlewares
├────── models/                 # Define all sequelize models
├────── repositories/           # Define all repositories
├────── routes/
├──────── v1/                   # Define all v1 routes
├────── services/               # Define all services
├────── types/                  # Define all input types
|
├──── config/
├────── appConfig.ts            # Define app configuration
|
├──── constants/                # Define all constants
├──── database/                 # Define database connection and sync tables
├──── utils/                    # Define reusable libs
├──── server.ts                 # Create express config
├──── index.ts                  # ENTRYPOINT - Start server
|
└── ...
```
- Improve code style using class in repositories, services, and controllers
- Add express validator as middleware to validate API request
- and moreover...

See details of API Project Template v2.0.0 in this [repo](https://github.com/arifintahu/project-structure-api)
[![arifintahu/project-structure-api - GitHub](https://gh-card.dev/repos/arifintahu/project-structure-api.svg)](https://github.com/arifintahu/project-structure-api)
Deploying Nuxt 3 app to Vercel 🚀
Tags: nuxt, tutorial, javascript, beginners
Published: 2022-09-05 10:01:22

When I started developing websites some time ago, there was no good free hosting providers. The only options available back then were the hostings that included several ads and promotions that were basically causing your website to not be viewable at all. 

Thankfully, nowadays deploying web applications to free hosting is much better and you can choose from a variety of providers like Vercel, Netlify, Heroku, and many more!

In this article, I would like to guide you through the process of deploying your Nuxt 3 application to Vercel.

## Code

First things first, we would need a Nuxt 3 application that will be then pushed to the Github repository. I suppose you already have it as you are reading this article and you are only interested in the instructions on how to deploy it to Vercel. Also, in this article I will show how to deploy the static website (SSG).

If you are interested in the process of building a simple web application clone that could be then deployed to Vercel, I highly recommend you to check out the following video:

{% youtube _GTWki_NoPI %}

The first thing we need to do is to import GitHub repository in Vercel

![Vercel Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0106w07jxgz548mncv4.png)

Later, let's define proper build command:

![Vercel settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/18k59s5f7kpsk8jes756.png)
 
Build command should be `yarn generate` and output folder `.output/public`

If you like, below you can add some environment variables (i.e. access tokens)

![Vercel Environment Variables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtxwyfy696kg02fepkht.png)

If all went well with the configuration, you should see similar result as our demo https://nuxt-modules-clone.vercel.app/

![Demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r6bllfbsa01jq55u1taz.png)

## Summary

Nicely done! You have just deployed a static Nuxt 3 application to Vercel hosting!
Nắp hố ga GOAT khẳng định vị thế nhờ chất lượng vượt trội
Tags: naphoga, naphogagoat, bannaphoga, cafebiz
Published: 2022-09-05 09:50:00

Không phải đơn giản để có thể lên bài ở các trang báo lớn. 

Đặc biệt như Báo CafeBiz.

Cần cung cấp các thông tin xác minh từ _chứng chỉ xác nhận_, đến _chứng minh các dự án _đã tham gia cung cấp vật tư xây dựng nêu trong bài viết. 

Cùng xem chi tiết về [Nắp hố ga](https://naphoga.vn/) GOAT dưới những xác minh của CafeBiz dưới đây:👇

[https://cafebiz.vn/nap-ho-ga-goat-khang-dinh-vi-the-nho-chat-luong-vuot-troi-176220905111021421.chn](https://cafebiz.vn/nap-ho-ga-goat-khang-dinh-vi-the-nho-chat-luong-vuot-troi-176220905111021421.chn)
A Quick Introduction To GitHub for Full Stack Developers
Tags: fullstackdevelopercourse
Published: 2022-09-05 09:49:46

A website and cloud-based service called GitHub enables web or software developers to store and manage their code and track and manage changes to it. You need to be aware of two related principles to understand what GitHub is:

Version control
Git

We'll first go over those two concepts in this blog Git and Github. Then, we'll delve into GitHub and discuss how you can utilize for your projects. 

What Is Version Control?
Version control facilitates the management and tracking of coding changes in software projects. Version management is crucial when a software project expands. 

Wordpress: WordPress is currently a huge project. Directly allowing a core developer to change the "official" source code wouldn't be efficient or safe if they wanted to work on a particular area of the WordPress codebase. Instead, branching and merging are safe development methods made possible by version control.

A developer repeats some source code using branching (called the repository). The developer can then safely modify that code section without jeopardizing the project's overall success.

The developer can then integrate that code back into the primary source code to make it official after getting their particular portion of the code to perform properly. Then, all of these modifications are monitored and, if necessary, can be undone.

What is Git?
Linus Torvalds developed the open-source version control system known as Git in 2005.
Git is a distributed version control system, which implies that every developer's computer has access to the whole codebase and history, making branching and merging simple.
Over 87% of developers use Git, according to a Stack Overflow developer study.

So What Is GitHub, then?
A for-profit organization called GitHub provides a service for hosting Git repositories on the cloud. In essence, it makes it much simpler for both individuals and teams to utilize Git for collaboration and version control. Because of GitHub's user-friendly design, even newbie programmers can benefit from Git. Without GitHub, utilizing Git typically necessitates more technical know-how and command-line experience.
An online service for hosting Git repositories is provided by the for-profit company GitHub. In essence, it greatly simplifies the usage of Git for collaboration and version control by both individuals and teams. Because of GitHub's user-friendly design, even newbie programmers can benefit from Git. Without GitHub, utilizing Git typically necessitates greater command-line experience and technical know-how.

Get started on a rewarding career in full-stack web development by visiting the [full stack developer course](https://www.learnbay.co/full-stack-software-development-program) and learning how to utilize Github.
New payment solution for web3 devs
Tags: blockchain, startup
Published: 2022-09-05 09:34:32

Hey guys, boundless3.xyz has entered the chat. 

We're a tech startup buidling an easy crypto-to-fiat payment solution for developers like you. So you could spend your hard earned money IRL as soon as the money comes in. This solution is supposed to replace the SWIFT system that you might be more familiar with. The community needs a better solution and we have it. 

You could let us know your specific in more details so we could keep building Boundless to your desire: https://calendly.com/pokodaoism/poko-product-call?month=2022-09 . Let's build this solution together, WAGMI!
Multi-Language website using Django JS, facing error on Search filter error
Tags: django, python, parler, javascript
Published: 2022-09-05 09:34:32

I'm building a multi-language Django site and using 'Django-parler' for my model data translations. Now I'm wondering if there is a Django search app that works with multi-language models and I used to create the search functionality here, it works fine for single-language sites. But, I can't get it to work with multiple language filter functions.

Here is my models.py

    from django.db import models
    from parler.models import TranslatableModel, TranslatedFields
    
    
    class Category (TranslatableModel):
        translations = TranslatedFields(
            category_Title=models.CharField(max_length=500)
        )
    
        def __str__(self):
            return self.category_Title
    
    
    class Faq_QA(TranslatableModel):
        translations = TranslatedFields(
            question_Title=models.CharField(max_length=500),
            question_Description=models.TextField(),
            category_Option=models.ForeignKey(Category, on_delete=models.CASCADE),
            SEO_Keywords=models.TextField(),
        )
    
        def __str__(self):
            return self.question_Title




Here is my search View.py

    from django.shortcuts import render
    from .models import Category, Faq_QA
    from django.db.models import Q
    # Create your views here.
    
    
    def base(request):
        if 'q' in request.GET:
            q = request.GET['q']
            multiple_keywords_faq = Q(Q(question_Title__icontains=q) | Q(question_Description__icontains=q))
            search_key_faq = Faq_QA.objects.filter(multiple_keywords_faq)
    
        else:
            search_key_faq = Faq_QA.objects.all()
        context = {
            'search_data': search_key_faq,
            'category_data': Category.objects.all(),
    
        }
        return render(request, 'Base.html', context)



For references my error-throwing image is here;

  
![Multi-Language website Error on Search filter image is here - please refer to it](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v290djckn1p6lw4h0tya.png)




Can anyone please help me with this error,
Julia Programming language logo in Python
Tags: python, chiki1601, pythonturtle
Published: 2022-09-05 08:58:16

Hello friends...


I created Julia programming language logo using Python...

which is shown below:

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


If you want tutorial,
you can visit my you tube channel👇🏻👇🏻👇🏻
https://www.youtube.com/watch?v=RI6dJdvWHzQ
Scope in JavaScript (Block Scope and Function Scope)
Tags: javascript, webdev, beginners, programming
Published: 2022-09-05 08:56:50


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

####Scope... Scope determines the accessibility of variables.

In JavaScript we'll create variable with var, let, and const keyword. they will create scope, that means we can only access the variable within the scope.

 **Block Scope:**  _let_ and _const_ create Block Scope. When we create a variable with _let_ and _const_, they will create __block scope__ means they can only access the block they are declared or created in. 

So let's take a look at the example below:

```
if (true) {
	let one = "one";
	console.log(one); // "one"
}

console.log(one); // Uncaught Reference Error: one is not defined

```

From the above example... we can see that we get an error when we console.log to the variable one outside the if statement.
Because variable one is declared within the if statement... its scope is only limited to the if statement. and we cannot access the let one outside the if statement.


**Function Scope:**  Variable that are declared inside of a function will create a _function scope_. this means you can only access the value within the function there or the parent function.

Let's take a look at the example below:

```
function fun(b) {
  var a = 12;
  return a + b;
}

fun(5);// 17  fun is being called
console.log(a); // Uncaught Reference Error: a is not defined
```

From the above example...  we can see that we get an error when we were trying to access the variable a outside the function that says a is not defined as we read above. 
So remember when you put or declared a variable inside the function, then it is only local to that function.

<!-- Hope this help you - CoderPink -->
How to Control the Mouse and Shortcuts In SOLIDWORKS
Tags: solidworks, design, beginners
Published: 2022-10-21 10:07:00

---
title: How to Control the Mouse and Shortcuts In SOLIDWORKS
published: true
date: 2022-09-05 08:46:06 UTC
tags: solidworks, design, beginners,
canonical_url: https://sandramartin.hashnode.dev/how-to-control-the-mouse-and-shortcuts-in-solidworks
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52f40ze7j58bvws88yv2.jpg
series: SolidWorks
---

To create splendid designs in SOLIDWORKS, we need to know the mouse controls and the shortcuts. Today, you will learn everything you need to handle yourself in SOLIDWORKS like a pro.

## Mouse controls

In SOLIDWORKS, we use three mouse buttons; each of them has a different function.

We use the **left mouse button** when we want to select something, such as a tool, a model, etc.

We can also double-click a part, and then SOLIDWORKS will show us the dimensions we used to create that side of the model. We can also change those dimensions directly this way.

If we click the **right mouse button** , we will activate the menu with many shortcuts. Also, if we click and maintain the right mouse button, we will open the mouse tools.

We use the **middle mouse button** to move our model. If we press it along with CTRL, it will translate our model. The middle mouse button plus shift will allow us to zoom in or out. Lastly, if we only press the middle mouse button, we will rotate the model.

## Keyboard shortcuts

In SOLIDWORKS, we have a lot of keyboard shortcuts. In this post, I will summarise the most important commands:

- CTRL + N -> Create a new document (such as part, assembly or drawing)
- CTRL + S -> Save document
- CTRL + Z -> Undo
- CTRL + X -> Cut
- CTRL + C -> Copy
- CTRL + V -> Paste
- SUPR -> Delete
- CTRL + Q / CTRL + B -> Rebuild

## Conclusion

Here we have covered the most crucial controls in SOLIDWORKS. We have learned what each mouse button is for and the most used shortcuts in the keyword. Now is the time to put them into use!

## Useful links

If you want to know more about SOLIDWORKS, check [SOLIDWORKS series](https://dev.to/sandra1me/series/19517)!
Building a custom RequireJS
Tags: javascript
Published: 2022-09-05 08:42:27


![Building a custom RequireJS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60cqab38rf7imzla7bl9.jpg)

RequireJS works on the principle that we can define functions that depend on values returned by other functions. This helps us write modular code. Here, we will assume all functions are in a single file.

The ask goes like this:

```js
define('moduleName',function(){
    return 1;
})


require(['moduleName'],function(module1){
    console.log(module1) // 1;
})
```

Here, we add dependencies using `define` and `functions` using require. 
1st param to `require` is a dependency array. Dependencies can be registered using `define` function.

Sometimes we can also require beforehand and then define functions. Once all dependencies are resolved, the user defined callback will be triggered automatically.

First let us declare module level variables to hold our results, dependencies and a registry of `functions` to dependency mapping.

```js
const fnMap = {}; // mapping between a dependency function name to actual function reference
let registry = [] // list of functions and the names of their dependencies
const resultMap = {}; // mapping between dependency name and it's return value
```

Now that we have the vars, let us define `define` :)

```js
function define(name, cb){
    fnMap[name] = cb;

    const unresolvedRegistryItems = registry.filter(({ cb: userDefinedCb, dependencies }) => {
        const unresolvedDeps = dependencies.filter(dependencyName => {
            const fn = fnMap[dependencyName];
            return !fn;
        });
        
        if (unresolvedDeps.length === 0) {
            require(dependencies, userDefinedCb);
        } else {
            return true;
        }
    });
    registry = unresolvedRegistryItems;
}
```

As you can see, we are first recording the dependency in `fnMap` and then checking the `registry` for `functions` whose all dependencies are resolved. If so, we are triggering the `require` (to be implemented).
Finally, we update the `registry` list with the filtered list containing only functions with unresolved dependencies.

Let us now define `require`

```js
function require(dependencies, cb){
    const results = [];
    let isResolved = true;

    for (let i = 0; i < dependencies.length; i++) {
        const dependencyName = dependencies[i];
        const fn = fnMap[dependencyName];

        if (!fn) {
            isResolved = false;
            registry.push({
                cb,
                dependencies
            });
            return;
        } 

        const result = resultMap[dependencyName] || fn();
        results.push(result);
        resultMap[dependencyName] = result;
    }
    isResolved && cb.apply(null, results);
}
```

Finished product:

{% codesandbox https://codesandbox.io/embed/custom-require-js-f2ck7w?expanddevtools=1&fontsize=14&hidenavigation=1&module=%2Fsrc%2Findex.js&theme=dark %}
Kubernetes at Edge: Centralized Management for Edge Clouds
Tags: kubernetes, edge, containers, cloud
Published: 2022-09-05 08:27:25


There are several difficulties have emerged in relation to remote management of software deployment and updates, including latency, pre-processing of data, orchestration of various workloads, and end-to-end orchestration of computing resources. These difficulties have emerged as edge computing continues to gain momentum in order to deal with streaming data generated by numerous IoT devices. For businesses and service providers who wish to install or already have deployed edge nodes, Kubernetes has emerged as the ideal answer. Along with extensive feature sets for public cloud, private cloud, and core data centers, it delivers a cloud-native approach to edge use cases. This technical brief focuses on current Kubernetes for Edge adoption scenarios and how Coredge provides solutions for it.
[Download now](https://coredge.io/technical-brief/kubernetes-at-edge-centralized-management-for-edge-clouds/) to know how Coredge’s Kubernetes operations platform makes things simpler for your business
Using React.memo
Tags: javascript, react
Published: 2022-09-05 08:25:27


![Using React.memo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d2bsapyq2khgn8ime3sx.jpg)

PureComponent is a decent approach for performance optimisation as long as it is not prematurely opted in. It’s functional counterpart, memo is used these days with functional components.

Now there could be 2 ways to declare a component as a memoized one that I can think of:

#### Inline

```jsx
import { memo } from 'react'

export const MyAwesomeFormWithInlineMemo = memo(() => (
  <form>
    <label>
      Hey

      <input type="text" />
    </label>
  </form>
))
```

#### Not Inline (do not know what to call this approach):

```jsx
import { memo } from 'react'

const MyAwesomeForm = () => (
  <form>
    <label>
      Yo!

      <input type="text" />
    </label>
  </form>
);

export const MemoedMyAwesomeForm = memo(MyAwesomeForm);
```

Now while both will have similar behaviour, the 2nd approach provides better DX in browser devtools.

Lets look at how these look in the components tab in devtools:



![Component definition + usage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/upaqntxzbsbh3oxf33b9.jpeg)


![Devtools view](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wnccpj9dswjsr9hmineh.jpeg)

This is because memo is an HOC which does not attach a readable displayName to the returned component. This gets worse as we add on more inline memo components as children to it.

```jsx
export const MyAwesomeFormWithInlineMemoX = memo(() => (
  <div style={{ padding: 20 }}>
    <fieldset>
      <MyAwesomeFormWithInlineMemo />
    </fieldset>
  </div>
));
```


![This is how the inner memo’ed component ends up looking in devtools](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gkfpolrcuf82ni1u8nx3.jpeg)


As such, while the inline approach works, it adds friction to maintenance.

The 2nd approach however is wrapping over a component MyAwesomeForm that already has an implicit name.  React is now able to set the displayName correctly and it shows up in the devtools as expected.

 

#### Suggestion

Please use the second approach if possible. Create a component and then export it using memo. This allows us to find components in devtools and map it to their source code for easier maintainability :) 

If we must use the inline approach, please assist memo by defining a named function inside:

```jsx
import { memo } from 'react'

export const AwesomeComponent = memo(function AwesomeComponent() {
  return ...;
});
```

^ This will show up as AwesomeComponent in devtools same way