teleren/devto huggingface dataset:
How does a stateless rest server deliver user details
Tags: help, todayilearned
Published: 2022-12-04 10:18:33

So for many years I have not looked into what REST actually is, it gave me data… moving on. But today I found out that REST is a design of server based api and it has 7.. I think it’s 7 rules to be described as restful. That makes me ask, if a database holds state in most cases, and stateless rest servers get state, how do they give it to the client?

When a server goes down and load balancing kicks in your client will loose state (not stored client side) so the client connects to the another server and I suppose the server delivers un-modified state as it sees it from the database to the client, it, the server never holds anything in memory related to manipulation of state and all the manipulation takes place on the client? I’m trying to work out what is state related to business logic, and why does stateless have databases?
Build,Host and Authenticate your fullstack react app with AWS Amplify in minutes.
Tags: fullstack, hosting, react
Published: 2022-12-04 10:13:36



Building a fullstack react app now really easy, AWS amplify has enabled the building ,hosting and deploying your app.
It is a development resource that makes building fast on AWS
It creates a workflow from Git-hub using a continuous integration and deployment pipeline.
The resource builds,hosts basic and static websites with serverless backends.


The first step is to create the app by running the following commands in the command prompton in the terminal:

npx create-react-app amplifyapp
cd amplifyapp
npm start
For the commands to work, you must have nodejs on your machine then you run the scripts on your command prompt

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


Initialize github and create a new repo for the app and push application to new git repo by running this commands.
git remote add origin git@github.com:username/reponame.git
git branch -M main
git push -u origin main


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/341lf4nls8kpe6mk8x54.PNG)

Log into the management console search for Amplify

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


Under Amplify hosting, go to get started


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jy6d4vr4nza04livt3hi.PNG)
Click Github repository then continue

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p92rsko57gcij1fmpt3.PNG)


Authenticate with Github and choose the newly created repo plus main branch and click next
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3br6ls2mz3bcd9c498r4.PNG)


Configure your build settings, save and deploy
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kdyobad1oue0cvb4i8nf.PNG)
 Aws amplify goes ahead to build source code and deploys the app

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/usx2cilviawn4gm7vxij.PNG)
There sits your fullstack app in minutes once the build completes

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rx19u39inl53za5rw0nf.PNG)
To automatically deploy code changes edit src/App.js , I prefer to it in Vscode

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkx94c32tomvm6q6hekz.PNG)
Here is my [https://main.doukipuj2x592.amplifyapp.com/](url)
Learn how to create a responsive website with Bootstrap Anime Website
Tags: webdev, javascript, html, css
Published: 2022-12-04 10:12:58

{% youtube xC78UnpiWCY  %}

How TO - **Make Anime a Website with Bootstrap 4 Anime** | Create a Website with Bootstrap 4 Anime | Responsive 


HI 👋
I'm Daily Web Design
In this channel, I make videos about the Complete Responsive website.
You can check out my channel 👇


📺 My Channel : https://www.youtube.com/@dailywebdesign
🔔 Subscribe: https://www.youtube.com/@dailywebdesign


🔗 Essential links
-----------------------------
✅ How TO Learn to Code: https://youtube.com/playlist?list=PLP1xU0duo6-jA8B-UCe-Cv5Vn0H-37CLZ
✅ CSS Project : https://youtube.com/playlist?list=PLP1xU0duo6-gSt54DxihbSzvxhISEbgJd
✅ JavaScript Project : https://youtube.com/playlist?list=PLP1xU0duo6-gFYT8Cn-8nJFklS4TkM8j2
✅ Completely Responsive Web Design : https://youtube.com/playlist?list=PLP1xU0duo6-jhNWX9geGXak3I_I22PL6C


💜 Like & Subscribe
-----------------------------
   @dailywebdesign  


⚠️ Disclaimer
-----------------------------
video is for educational purpose only. Copyright Disclaimer Under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favor of fair use
The odd binary string
Tags: perl, python, theweeklychallenge
Published: 2022-12-04 10:12:02

## Weekly Challenge 193

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-193/), [My solutions](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-193/sgreen)

Two relatively straight forward tasks this week, so not as much commentary as usual.

## Task 1: Binary String

### Task

You are given an integer, `$n` > 0.

Write a script to find all possible binary numbers of size `$n`.

### My solution

Thankfully both Python and Perl provide easy methods to convert a (base 10) integer into a binary number with leading zeros. For the integer `x` with `y` leading zeros, we can use `format(x, '0yb')` in Python, and `sprintf('%0yb', x)` in Perl.

With that out of the way, we know that all binary numbers can be converted from the integers between 0 and 2<sup>n</sup>-1 (inclusive).

### Examples

```bash
$ ./ch-1.py 2
00, 01, 10, 11

$ ./ch-1.py 3
000, 001, 010, 011, 100, 101, 110, 111
```

## Task 2: Odd String

### Task

You are given a list of strings of same length, `@s`.

Write a script to find the odd string in the given list. Use positional value of alphabet starting with `0`, i.e. `a = 0, b = 1, ... z = 25`.

Find the difference array for each string as shown in the example. Then pick the odd one out.

### My solution

This task can be broken into three sub tasks:

1. Create a dict (hash in Perl) called `letter_map` that maps the letters of the alphabet to integers, where `letter_map['a']` is 0, and `letter_map['z']` is 25.
1. Convert each word into a space separated values of differences. So `adc` is converted to `3 -1`. With this information I have an `occurrences` dict where the key is the converted string and the value is a list of words that match that pattern.
1. Calculate an array `unique_words` of values in `occurrences` that only have one value. If there is only one unique word, I display that. If not, I display an error.

### Examples

```bash
$ ./ch-2.py adc wzy abc
abc

$ ./ch-2.py aaa bob ccc ddd
bob
```
what is microservice architecture?
Published: 2022-12-04 10:10:11

Microservice architecture is a design approach for building software systems that are composed of small, independent, and modular components, known as microservices. 


Each microservice is designed to perform a specific function or set of related functions, and can be developed, deployed, and maintained independently of the other microservices in the system. This allows for flexibility, scalability, and resiliency, as the system can be easily adapted and evolved to meet changing requirements.

## Example of microservice:
 

let's define a simple **microservice** that exposes a single endpoint **/add** which accepts two numbers as query parameters, a and b, and returns the result of adding them.

tech stack Express

```js
const express = require('express');
const app = express();

// A simple function that adds two numbers
function add(a, b) {
  return a + b;
}

// Define an endpoint that accepts two numbers
// and returns the result of adding them
app.get('/add', (req, res) => {
  const a = parseInt(req.query.a);
  const b = parseInt(req.query.b);
  const result = add(a, b);
  res.send({result});
});

// Start the server on port 3000
app.listen(3000, () => {
  console.log('Microservice listening on port 3000!');
});
```

To run this microservice, you would need to install the required dependencies, such as Express, and then start the server by running the code. Once the server is running, you can send HTTP requests to the /add endpoint to test it out. For example, you could use the following curl command to send a request to add 2 and 3:

`curl 'http://localhost:3000/add?a=2&b=3'`

This would return the following response:

`{"result":5}`
Advent of Code 2022 - Day 4
Published: 2022-12-04 10:06:38

---
title: Advent of Code 2022 - Day 4
published: true
description: I'm trying to solve all the Advent of Code puzzles in this video series.
tags:
cover_image: https://i.ytimg.com/vi/E2FJCrbrdDc/maxresdefault.jpg
---

{% youtube E2FJCrbrdDc %}

I'm trying to solve all the Advent of Code puzzles in this video series.
Why do SQL Server views need refreshing?
Tags: sql, beginners, programming
Published: 2022-12-04 10:00:00

Views in SQL are a great way to simplify complex queries, to hide sensitive data, or to provide a different perspective on the data. But they can also be a source of confusion and frustration.

## Why do SQL Server views need refreshing?
A view, basically, is a stored query represented as a virtual table. When you create a view, you can use it just like a table which means you can query it, join it, and use it in other queries. Basically, a view is a snapshot of the schema at the time it was created. 
However, if a schema change occurs which causes the underlying object to change, the metadata of the view will not be updated automatically and the results of the view will be incorrect. Note that the need to refresh a view depends on the underlying object. For example, if the underlying object is a view, a refresh may not be needed.

Schema changes can be caused by a number of things, such as adding a new column to a table, changing the data type of a column, or even deleting a column. So basically if you have a view that references a table that has changed, you will need to refresh the view. 

## How to refresh a view
There are a few ways to refresh a view. The  most common way is to use the `DROP VIEW` and `CREATE VIEW` statements. This will drop the view and then recreate it. 

```sql
DROP VIEW view_name

CREATE VIEW view_name AS
SELECT column_name
FROM table_name
WHERE condition
```
This is a simple and effective solution, but it can be time-consuming if the view is complex. 

Another way is to use the stored procedure `sp_refreshview` which is a system stored procedure available in SQL Server.
  
  ```sql
EXEC sp_refreshview 'view_name'
```
This stored procedure will refresh the view and update the metadata to match the base table.

Finally, if the tables are all in the same database on the same server you can use the option `WITH SCHEMABINDING ` when creating the view. 

```sql  
CREATE VIEW view_name WITH SCHEMABINDING AS
SELECT column_name
FROM table_name
WHERE condition
```
This option binds the view to the schema of the underlying table. This means that this base table cannot be modified in a way that would affect the view definition. The view definition itself must first be modified or dropped to remove dependencies on the table that is to be modified.
Psuedocode
Tags: cpp, pseuedocode, beginners, programming
Published: 2022-12-04 09:47:10

A Pseudocode is defined as a step-by-step description of an algorithm. It's a human readable description of an algorithm. Algorithm is a sequence of steps we take to solve a particular code. The flowcharts we have drawn also represents algorithm. Pseudocode is the intermediate state between an idea and its implementation(code) in a high-level language. 

## **Example:**
**Calculating Prime numbers using Psuedocode **
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfp4n0tivwmowc0z6mp3.png)

- First Read the value of N which can be any number.
- Then choose a value for iterations for this you have to put the value of iterations i=2. It's because prime numbers are divisible by 1 and itself only.
- we will use while loop for this problem, then iterate the value while it is i<N-1. 
- If the value is divisible by i it will enter into the curly brackets and will print not prime. If it isn't it will increment the i value while it is less than N-1 and will print prime if there aren't any value which is divisible between i and N-1.
Importing Files📁 from different Folder🗃️
Tags: python, beginners, files, folders
Published: 2022-12-04 09:36:15

## Folder structure
> [`GitHub Repo`](https://github.com/Ayon-SSP/Importing-Files) Practical project

```js
Folders
├── Folder1
│   ├── subFolder1
│   │    └── File2.py 
│   ├── File1.py  
│   └── MainFile.py 
└── Folder2
    └── subFolder3
         └── File3.py
```

> Main Folder is `Folders`
> `Folders` -> contains 2 subFolder Name `Folder1` & `Folder2`
> `Folder1` -> `subFolder1` & `MainFile.py`
> `Folder2` -> `subFolder3` -> `File3.py`
> `subFolder1` -> `File1.py` & `File2.py`

## **To import File from different Folders**
### 1. File in the same directory
`MainFile.py`
```python
import File1
```
### 2. File in the sub directory
`MainFile.py`
```python
from subFolder1 import File2
```
### 3. File in the 1 step back parent directory
`File2.py`
```python
from ..MainFile import ClassName
```
### 4. File in the parent directory
`MainFile.py`
```python
# You Can use this to import file from any directory
import sys
sys.path.insert(1,'C://Repo//temptodel//Folders//Folder2//subFolder3')

import File3
print(File3.f33)
```
Build,Host and Authenticate your fullstack react app with AWS Amplify in minutes 1.
Tags: hosting, react, javascript, webdev
Published: 2022-12-04 09:12:34



Building a fullstack react app now really easy, AWS amplify has enabled the building ,hosting and deploying your app.
It is a development resource that makes building fast on AWS
It creates a workflow from Git-hub using a continuous integration and deployment pipeline.
The resource builds,hosts basic and static websites with serverless backends.


The first step is to create the app by running the following commands in the command prompton in the terminal:

npx create-react-app amplifyapp
cd amplifyapp
npm start
For the commands to work, you must have nodejs on your machine then you run the scripts on your command prompt

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


Initialize github and create a new repo for the app and push application to new git repo by running this commands.
git remote add origin git@github.com:username/reponame.git
git branch -M main
git push -u origin main


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/341lf4nls8kpe6mk8x54.PNG)

Log into the management console search for Amplify

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


Under Amplify hosting, go to get started


Click Github repository then continue

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p92rsko57gcij1fmpt3.PNG)


Authenticate with Github and choose the newly created repo plus main branch and click next
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3br6ls2mz3bcd9c498r4.PNG)
Then you go right ahead to configure build setting, review

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yu9hil98840vnrk4wngz.PNG)
Amplify goes ahead to build source code
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikhbr5pg1hdaiz07r5az.PNG)

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

Your app is ready

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rcekq45rw3cvbkh111k0.PNG)
You can then automatically deploy code changes from src/app.js in a text editor like Visual studio


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



Push to github and run the following command in the terminal 

git add .
git commit -m “changes for v2”
git push origin main

When the build completes view your app in the Amplify console
https://main.doukipuj2x592.amplifyapp.com/

First step is get an AWS free-tier account [here ](https://www.googleadservices.com/pagead/aclk?sa=L&ai=DChcSEwiAqpjN3N_7AhULR5EFHZ6hB6kYABAAGgJscg&ohost=www.google.com&cid=CAESbOD2VZf0VHVqbZy7np0cAjGTqXuBQfc3ovSD0bw077xUkAVFwGQn6lHJOhokVzzYbXfhTQpfx4_4OOIn8u2u0dYH3NlWmeKRlJxLuWj-x_cp3bmyMxCVuQdT4GP2LOSfd9v5_pKYZtom3eJeYQ&sig=AOD64_0hg2qXMyJBSwQtz1MdM4ACJw1kBA&q&adurl&ved=2ahUKEwjq9o_N3N_7AhUfTKQEHR3EAE4Q0Qx6BAgIEAE)
Pinball3DXMas
Published: 2022-12-04 09:04:27

Made my first version of Pinball3d (with a Christmas theme).
I had great fun making it and I learned a lot about Rust, Bevy, Rapier and Blender.
The webassembly takes some time to initiate things, but seems to work great when started.
It's not yet working on my phone (it won't even show up in the browser). Not sure why, but I'm working on it.
Using the possibility to say thanks to everyone providing the great tools I'm dependent on.

Screenshot:
![Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/259c24lepxbr0ycy0c85.png)

Youtube:
[https://youtu.be/kZw911cLr64](https://youtu.be/kZw911cLr64)

Github:
[https://github.com/gunstein/Pinball3D
](https://github.com/gunstein/Pinball3D)

Webassembly:
[https://pinball3d.vatnar.no/](https://pinball3d.vatnar.no/)

## Remark
The code is a bit messy, but I will eventually do some housekeeping and maybe write a short piece about the development process.
Kotlin Code Smell 4 - Comment Abusers
Tags: kotlin, cleancode, codesmells, programming
Published: 2022-12-04 11:29:54

---
title: Kotlin Code Smell 4 - Comment Abusers
published: true
date: 2022-12-04 08:30:42 UTC
tags: kotlin,cleancode,codesmells,programming
canonical_url: https://yonatankarp.com/kotlin-code-smell-4-comment-abusers
---

> ***TL;DR:*** *Leave comments just for important design decisions. Don't explain the obvious!*

## Problems

* Maintainability
    
* Obsolete Documentation
    
* Readability
    
* Code and comments duplication.
    

## Solutions

* Refactor methods.
    
* Rename methods to more declarative ones.
    
* Break methods into smaller and easier for understanding methods.
    
* If a comment describes what a method does, [**name the method with this description**](https://maximilianocontieri.com/refactoring-005-replace-comment-with-function-name).
    
* comment on important design decisions only!
    

## Examples

* Libraries
    
* Class Comments
    
* Method Comments
    

## Sample Code

### Wrong

```kotlin
/**
 * ChatBotConnectionHelper is used to create connection strings to
 * Bot Platform Use this class with getString() function to get 
 * connection string to the platform.
 */
class ChatBotConnectionHelper(
    var id: String
) {
    // Get Connection String from Chatbot
    fun getString(): String = TODO()
}
```

### Right

```kotlin
class ChatBotConnectionSequenceGenerator(
    private val name: String
) {
    fun connectionSequence(): Unit = TODO()
}
```

## Conclusion

Leave comments just for important design decisions. Don't comment on a method with a bad name, rename it. Code changes over time, while documentation rarely does, which causes your code to end up with outdated documentation at best, or wrong documentation at worst.

---

Stay updated with my latest thoughts and ideas by registering for my [newsletter](https://yonatankarp.com/newsletter). Connect with me on [LinkedIn](https://www.linkedin.com/in/yonatankarp/) or [Twitter](https://twitter.com/yonatan_karp). Let's stay connected and keep the conversation going!

---

## More info

* [Refactoring Guru](https://refactoring.guru/es/smells/comments)
    
* [What is in a name](https://maximilianocontieri.com/what-exactly-is-a-name-part-i-the-quest)
    
* [Comments as a bad sign](https://dev.to/alexbunardzic/code-comments-are-a-sign-that-something-s-off-19e1)
    
* [How to comment your code](https://arter.dev/how-to-comment-your-code-like-a-boss)
    

## Credits

* [Code Smell 05 - Comment Abusers](https://maximilianocontieri.com/code-smell-05-comment-abusers) by @[Maxi Contieri⭐⭐⭐](@mcsee)
zinitからsheldonへ
Published: 2022-12-04 08:24:51

## sheldonってなに？
https://sheldon.cli.rs

sheldonとはrustで書かれているzshのプラグインマネージャです。
zinitで特に問題はなかったのですが、過去突然organizationが消えてコミュニティで復活するなどがあり、何か他にもないかな？と探していたところでした。

zinitと違うところはプラグインをtomlで管理していて、zshrcにはほぼ設定を書くことがないというところです。

zinitよりちょっと速くて軽いとのうわさ。

## 準備
現在のzshrcをバックアップしておきます。

```
$ mv .zshrc .zshrc.bk
```

homebrewかcargoでインストールします。おそらくどちらでもいい。

```
$ brew install sheldon

or

$ cargo binstall sheldon
$ cargo install sheldon
```

初期設定をします。

```
$ sheldon init --shell zsh
$ echo 'eval "$(sheldon source)"' >> .zshrc
```

設定ファイルにプラグインを追加します。

```
$ sheldon add asdf --github asdf-vm/asdf
$ cat ~/.config/sheldon/plugins.toml
```

zshrcを再読み込みしたら各種プラグインはインストールされます。

## 所感

速度感は正直なところ変わっているのかどうかわかりませんでした。
zshrcへの記述が簡素になるのはよいかなと。
Web development: expectation vs reality
Tags: webdev, programming, productivity, career
Published: 2022-12-04 08:13:24

Web development, like any other field, can have a gap between expectation and reality. Here are a few common examples:

- Expectation: I can learn web development quickly and easily.
- Reality: Web development involves a complex set of skills, and it can take time and dedication to learn and master them.
- Expectation: I can create a professional-looking website on my own.
- Reality: Creating a professional-looking website often requires a team of designers, developers, and other professionals with specialized skills.
- Expectation: I can make a lot of money as a web developer.
- Reality: While there is potential to earn a good income as a web developer, it's important to consider factors like your location, experience, and market demand when considering potential earnings.
- Expectation: I can build any type of website.
- Reality: While web developers may have a broad range of skills, there are certain types of websites that may require specialized knowledge or experience. It's important to be realistic about your abilities and seek help when necessary.

Overall, it's important to manage your expectations when it comes to web development. It's a complex and dynamic field that requires a range of skills and experience.