teleren/devto huggingface dataset:
Creating a Social Network for Bakers with the use of Generative Artificial Intelligence as an Assistant. part 2
Published: 2023-04-12 00:07:01

Let's be honest, nobody enjoys just doing CRUDs*. So why not leverage the potential of Generative AIs for this 'tedious' task?

On my second day working with ChatGPT as an AI Assistant in creating a social network for amateur bakers, I think I managed to "shift" my mindset to use the tool as an Assistant.

Using the "ChatGPT Prompt Formula" provided by DataCamp, I optimized my process and improved efficiency. I was able to create the server using Node + Express, model the database in MongoDB, and set up all the routes with their respective CRUD methods! Also, it helped me with those boring tasks of testing the running API when you need an example user. Instead of manually creating the JSON, I simply asked, "Following the model we implemented, create a JSON to represent a user" and went to grab a coffee...

I can consider ChatGPT as a good companion on this journey, facing the Dark Arts of Backend 🧙‍♂️

Having an AI helping with tasks considered tedious by many devs is a true revolution. It saves time and can allow the team to focus on more human and creative activities. 🌟

I believe that having an AI Assistant like ChatGPT by our side can make development more enjoyable and productive, helping the team focus on what really matters: creating innovative solutions that bring value to our users!

And you, Dev, have you tried working with an AI Assistant in software development? Want to take a look at how this API is shaping up? I'll leave the Github link here:

[Github Repository ](https://github.com/narradorww/cp-backend).

*CRUD is an acronym for the four basic operations in data management systems: Create, Read, Update, and Delete. These operations allow users to manipulate and manage information stored in a database.

This post is part of the documentation of my experience applying the knowledge from the 'Generative Artificial Intelligences' course at Alura. Tomorrow we'll see how we'll deal with "Token-based authentication."
In the face of AI: What should current college students do?
Tags: college, career, advice, ai
Published: 2023-04-13 01:16:47

---
title: In the face of AI: What should current college students do?
published: true
date: 2023-04-12 00:00:00 UTC
tags: college, career, advice, ai
canonical_url: https://blog.brainstory.ai/advice-for-college-students/
---

My first technological revolution was internet as a commodity. The AOL dial-up sound, raising my Neopets, and setting angsty song lyrics as my status in chat rooms— it all feels strangely so close and far. If you’re a current college student, these early days of GPT may end up being similar memories for you. Though as one person tweeted, “This feels less like an ‘iPhone’ moment and more like ‘fire’“.

## What entry-level jobs are vulnerable?

In this paper co-written by OpenAI and University of Pennsylvania, vulnerability to AI is defined as [“driving a reduction in time it takes to complete the task by at least 50%”](https://arxiv.org/pdf/2303.10130.pdf). Here are the most exposed jobs, according to the paper:

- Mathematician
- Tax preparers
- Financial Quantitative Analysts
- Writers & Authors
- Accountants & Auditors
- News, Analysts, Reporters, and Journalists
- Legal Secretaries and Administrative Assistants
- Clinical Data Managers
- Climate Change Policy Analysts
- Web and Digital Interface Designers

The paper further breaks down skills that are most vulnerable, which correlate strongly to the above list:

- Math
- Programming
- Writing
- Listening

On the other end of the spectrum, the skills that are the _least_ vulnerable:

- Reading Comprehension
- Science
- Learning Strategies
- Monitoring
- Crticial Thinking

## So does my Computer Science degree even matter anymore?

GPT does not change my advice on this matter. You should major in something you find interesting and curious, regardless of how you _think_ it translates into a job. The paper says programming will become very efficient, but there will still always be a need for programmers. More specifically, there will be an even greater need for programmers that have reading comprehension, know how to learn new things, and can think critically about a problem space.

If you are pursuing something out of passion and intrinsic interest, it will be a lot easier for you to develop those soft skills. Soft skills is a bit of a misnomer because they are clearly the harder skills to develop than the pure technical.

As you’re going through your classes, think critically about the tools you are using and why. If you’re wondering if you should use GPT to write code, I say go for it, sure. It will clearly become an industry tool and becoming familiar with it will be like knowing `git` or `docker`. But, as you’re using GPT, remember that **you** as the human bring all of the reading comprehension and scientific process. Understanding what you’re doing is just as important as getting the task done!

**Are you doing something boring, manual, and necessary with your content? Let us know - we’d love to help.**
Episode 23/14: Signals RFC Distilled
Tags: angular, javascript, webdev, programming
Published: 2023-04-11 23:26:14

The RFC for Signals was published and it brought a big surprise in the form of a new component type. This episode provides a summary.

{% embed https://youtu.be/hIYurWPFEY0 %}

The Angular team released the RFC for Signals. Signals will be a huge shift.

It is a reactive structure that holds data, we can modify, run some side effects or create other derived signals.

{% embed https://stackblitz.com/edit/angular-zau8lt?file=src/main.ts %}

Angular templates listen to Signals and update the DOM when a Signal's value changes. Today, zone.js is doing that job. It notifies Angular after a DOM event, and then it needs to go through all the components and search for a potential change. So Signals will be way more precise and efficient.

A pure Signals-based codebase will look quite different. Almost like the switch from AngularJs to Angular but with the backwards-compatibility.

And that's not just we will function calls in templates, or we have to use the new Signal's methods to update properties in the TypeScript part. The main change will be a new type of component.

## Signal-based Component

A "Signal-based component" will replace the Input and Output decorator with a function. The output will still be an EventEmitter, but the input value will be read-only. So it works in the same as props do in React for example.

The lifecycle hooks will not be available. Exceptions will be NgOnInit and NgOnDestroy, although it is very unlikely that we need them. In addition, we will get new lifecycle hooks that work on an application-level. We will register them via function calls and not by implementing methods of an interface.

As it is already with standalone components, we will be able to use both Signal-based components and the old ones (zone.js component) within an application. We can even use Signal element/primiitve the in the zone.js-based components. The new features though, that I've just mentioned, will be exclusively available in the Signal-based components.

## The next Steps

The Signal primitive will be available as a developer preview in Angular 16. For the new Signal-based component, we have to wait.

## Further reading

Here is a list of all the relevant resources:
- Main RFC: https://github.com/angular/angular/discussions/49685
- Theory and Reasoning about Signals: https://github.com/angular/angular/discussions/49684
- API and how to use Signals: https://github.com/angular/angular/discussions/49683
- Signal-based Component: https://github.com/angular/angular/discussions/49682
- Interoperability with RxJs: https://github.com/angular/angular/discussions/49681

Last but not least the video of the Angular team discussing the RFC in detail:

{% embed https://www.youtube.com/watch?v=oTFauGIs7s0 %}
How Soul-bound Tokens Fit into the Verifiable Credential Trust Triangle
Tags: blockchain, verifiablecredentials, zeroknowledgeproof, soulboundtokens
Published: 2023-04-11 23:18:26

Have you ever wondered how [Soul-bound](https://vitalik.ca/general/2022/01/26/soulbound.html) Tokens and [Verifiable Credentials](https://www.dock.io/post/verifiable-credentials) relate to each other? These two blockchain-based solutions share some similarities but also have some significant differences.

Both technologies have an issuer who creates the credential, a holder who owns and controls it, and a verifier who validates its authenticity and ownership. However, in the case of Soul-bound Tokens, the issuer could be a DAO (Decentralized Autonomous Organization), the verifier could be anyone who can utilize zero-knowledge proof, and the holder is simply an EOA (Externally Owned Account).

Verifiable Credentials are mainly used for verifying identity and credentials, while Soul-bound Tokens use NFT (non-fungible tokens) to demonstrate uniqueness and scarcity, which can be used for credential issuance and digital identity.
When it comes to security, Verifiable Credentials use cryptographic signatures to ensure authenticity and tamper-proofing, while Soul-bound Tokens use NFTs to achieve the same result.

Although Verifiable Credentials are associated with standards like the W3C's Verifiable Credentials specification, Soul-bound Tokens are still in the process of developing a standard specification (PS: [Awesome Soulbound Tokens](https://github.com/attestate/awesome-soulbound-tokens))

As blockchain technology continues to advance, solutions like Verifiable Credentials and Soul-bound Tokens will be crucial in enabling decentralized and self-sovereign identity. Understanding how they fit into the trust triangle is a vital step toward achieving a more secure and equitable digital future.
Windows 12: ⚡ Exploring the New Features of Microsoft Windows
Tags: microsoft, windows, programming
Published: 2023-04-11 22:54:57

Microsoft is known for its consistent updates to the Windows operating system, and the release of Windows 12 is highly anticipated. While Microsoft has not yet officially announced Windows 12, there are rumors and speculation about what features the next version of Windows may bring. In this article, we explore some of the potential new features of Windows 12.

Improved Start Menu: One of the most significant changes expected in [**Windows 12**](https://itsfalconb.blogspot.com/2023/04/windows-12-exploring-new-features-of.html) is an improved Start menu. The Start menu is one of the most frequently used features of Windows, and the new version is rumored to have a more modern and streamlined design. This could include customizable tiles, improved search functionality, and better integration with Microsoft Office applications.

Virtual Desktops: Another potential new feature in Windows 12 is the ability to create virtual desktops. This would allow users to have multiple desktops, each with different applications and files, to keep their work organized and increase productivity.

Improved Security: With the increasing threat of cyber attacks, security is a top priority for Microsoft. Windows 12 is rumored to have improved security features, including biometric authentication, advanced threat protection, and enhanced encryption.

Cloud Integration: Microsoft has been heavily investing in cloud technology, and Windows 12 is expected to have better integration with cloud services such as OneDrive and Microsoft Azure. This would allow users to access their files and applications from anywhere and on any device.

Better Gaming Experience: Windows is a popular operating system for gamers, and Windows 12 is expected to have better gaming performance and features. This could include improved graphics performance, support for virtual reality, and better integration with Xbox Live. [link](https://itsfalconb.blogspot.com/2023/04/windows-12-exploring-new-features-of.html)

Improved User Experience: Finally, Windows 12 is expected to have an overall improved user experience. This could include a more intuitive interface, better touch support, and faster performance.

While these are just rumors and speculation, Microsoft has a history of listening to user feedback and incorporating new features and improvements into each new version of Windows. Whether or not Windows 12 will include these features remains to be seen, but one thing is certain - users can expect a more advanced and feature-rich operating system from Microsoft in the near future.
Entity State in JPA/ @Transactional
Tags: webdev, jpa, spring
Published: 2023-04-11 22:47:31

## JPA 객체의 상태
**1. Transient**
객체를 생성하고, 값을 주어도 JPA나 hibernate가 그 객체에 관해 아무것도 모르는 상태. 즉, 데이터베이스와 매핑된 것이 아무것도 없다.
**2. Persistent**
저장을 하고나서, JPA가 아는 상태(관리하는 상태)가 된다. 그러나 .save()를 했다고 해서, 이 순간 바로 DB에 이 객체에 대한 데이터가 들어가는 것은 아니다. JPA가 persistent 상태로 관리하고 있다가, 후에 데이터를 저장한다.(1차 캐시, Dirty Checking(변경사항 감지), Write Behind(최대한 늦게, 필요한 시점에 DB에 적용) 등의 기능을 제공한다)
**3. Detached**
JPA가 더이상 관리하지 않는 상태. JPA가 제공해주는 기능들을 사용하고 싶다면, 다시 persistent 상태로 돌아가야한다.
**4. Removed**
JPA가 관리하는 상태이긴 하지만, 실제 commit이 일어날 때, 삭제가 일어난다.
 
## @Transactional 
토큰값이 DB 에 저장되지 않아서 확인해보니, 계정 저장 후, 이메일 토큰을 생성.
Detached 상태의 객체였던 것이다.

[AS-IS]

```
private Account saveNewAccount(@Valid SignUpForm signUpForm) {
    Account account = Account.builder()
            ....
            .build();
    return accountRepository.save(account);
}

public void processNewAccount(SignUpForm signUpForm) {
    Account newAccount = saveNewAccount(signUpForm);
    newAccount.generateEmailToken();
    sendSignupConfirmEmail(newAccount);
}
```
[TO-BE]

```
private Account saveNewAccount(@Valid SignUpForm signUpForm) {
    Account account = Account.builder()
            ....
            .build();
    return accountRepository.save(account);
}

@Transactional
public void processNewAccount(SignUpForm signUpForm) {
    Account newAccount = saveNewAccount(signUpForm);
    newAccount.generateEmailToken();
    sendSignupConfirmEmail(newAccount);
}
```
이 때 @Transactional 를 사용하여 processNewAccount의 객체도 transaction 범위내에 들도록 한다. 그럼 Detached 상태가 아닌 Persistent 상태가 유지가 된다. Persisent 객체의 경우, transaction이 종료될 때 DB에 sync 된다. 따라서, 생성된 토큰 값도 저장된다.
 
 
_*참고자료
백기선 인프런 강의_
Buenas prácticas APIs
Tags: spanish
Published: 2023-04-11 22:44:44

### Usar nombres de recursos (sustantivos)
❌ GET /querycarts/123
✅ GET /carts/123

### Uso de plurales
❌ GET /cart/123
✅ GET /carts/123

### Idempotencia
❌ POST /carts
✅ POST /carts {requestId: 123}

### Uso de versionado
❌ GET /carts/v1/123
✅ GET /v1/carts/123

### Uso de paginado
❌ GET /carts
✅ GET /carts?pageSize=xx&pageToken=xx

### Ordenado
❌ GET /carts
✅ GET /carts?sort_by=id

### Filtrado
❌ GET /carts
✅ GET /carts?filter=color:blue

### Acceso Seguro
❌ X-API-KEY = xxxxx
✅ X-API-KEY = xxxxx
   X-EXPIRE = xxxxx
   X-REQUEST-SIGNATURE = (URL + QueryString + Expire + Body)

### Referencia cruzada de recursos
❌ GET /carts/123?item=321
✅ GET /carts/123/items/321

### Agregar un elemento nuevo
❌ POST /carts/123?addItem=321
✅ POST /carts/123/items:add{itemID: "items/321"}
Model Binding : WebDataBinder, @InitBinder
Tags: webdev, spring
Published: 2023-04-11 22:35:19

## Model Binding
@ModelAttribute, @RequestParam, @PathVariable 등을 지정된 파라리터를 @Controller 에 추가하면 다음과 같은 작업이 자동으로 진행된다.

**1. 파라미터 타입의 object를 만든다.**
@ModelAttribute User user라는 파라미터를 선언했다면 User 타입의 Object를 생성한다. @SessionAttributes에 의해 세션에 저장된 model object가 있다면 그걸 가져온다. 
**2. model object의 property에 웹 파라미터를 바인딩해준다.**
http를 통해 전달되는 파라미터는 기본적으로 문자열로 되어 있다. Spring의 기본 PropertyEditor를 이용해서 http 파라미터 값을 model의 property type에 맞게 전환한다. 실패시, BindingResult 오브젝트 안에 바인딩 오류를 저장하여 예외를 발생시킨다.
(PropertyEditor은 Spring이 제공하는 DataBinder 인터페이스를 통해 사용된다.)
**3. model 값을 검증한다.**
이전 단계에서 타입에 대한 검증은 끝났으나 그 외의 검증할 내용이 있다면 적절한 validator를 등록해서 검증할 수 있다. 
 


## WebDataBinder
AnnotationMethodHandlerAdapter는 @ModelAttribute 등처럼 http요청을 파라미터 변수에 바인딩해주는 작업이 필요한 애노테이션을 만나면 먼저 WebDataBinder를 만든다.
WebDataBinder는 여러 기능을 제공하는데 그 중 http요청으로부터 가져온 문자열을 파라미터 타입의 Object로 변환하는 기능이 있다. 이런 변환 작업은 위에서 언급되었던 PropertyEditor를 이용한다. 따라서 개발자가 직접 만든 커스텀된 PropertyEditor를 적용하려면 WebDataBinder에 등록해줘야 한다. 이 때 필요한게 @InitBinder이다.
 





## @InitBinder
WebDataBinder를 초기화해주는 어노테이션이다. InitBinder()는 메소드 파라미터를 바인딩하기전에 자동으로 호출된다. 커스텀한 PropertyEditor, Validator 등을 적용되게 해준다. 
아래는 validator를 @InitBinder를 통해 적용한 소스이다.

[AS-IS]
```
    private final SignUpFormValidator signUpFormValidator;
  
    @PostMapping("/signup")
    public String signUpSubmit(@Valid SignUpForm signUpForm, Errors errors) {
        if(errors.hasErrors()){
            return "account/signup";
        }
        signUpFormValidator.validate(signUpForm, errors);
        if(errors.hasErrors()){
            return "account/signup";
        }
        ....
        return "account/signupSuccess";
    }
```
[TO-BE]
```
   private final SignUpFormValidator signUpFormValidator; 

    //form 객체 이름은 변수명이 아니라 type의 camel case를 따라간다.(변수명 바뀌어도 적용된다.삽질 NO)
    @InitBinder("signUpForm")
    public void initBinder(WebDataBinder webDataBinder){
        webDataBinder.addValidators(signUpFormValidator);
    }

    @PostMapping("/signup")
    public String signUpSubmit(@Valid SignUpForm signUpForm, Errors errors) {
        if(errors.hasErrors()){
            return "account/signup";
        }
        ....
        return "account/signupSuccess";
    }
```

_* 참고자료
토비의 스프링 Vol. 2 스프링의 기술과 선택
백기선 인프런 강의.._
16000 view for 4 sentences
Tags: devjournal
Published: 2023-04-11 22:34:54

Google smiled on me and made it rain views I’m stunned that so many people saw my post and even found it useful, I wasn’t even trying, in fact some of my genuinely entertaining posts did a lot worse and that makes me wonder, how is google watching DEV posts, and feeding them for google news feeds and why did it do so well and how can it/ can it even be replicated.

I suspect short posts actually do really well and I had a lot of key words like, JavaScript, tip, console.log and slow. All stuff that gets searched a lot 🤷‍♂️

I’m just happy to be here But this is fun to figure out, is there a secret sauce?
Adam
How to copy a table from one PostgreSQL database to another?
Tags: postgres, database, programming
Published: 2023-04-11 21:55:47

Here is an example bash script that copies a table from one PostgreSQL database to another:

```
#!/bin/bash

# Source database credentials
SRC_DB_HOST="localhost"
SRC_DB_PORT="5442"
SRC_DB_NAME="postgres"
SRC_DB_USER="myuser"
SRC_DB_PASS='mypwd'

# Destination database credentials
DEST_DB_HOST="localhost"
DEST_DB_PORT="5443"
DEST_DB_NAME="postgres"
DEST_DB_USER="myuser"
DEST_DB_PASS='mypwd'

# Table name to copy
TABLE_NAME="my_table"

# Temporary file to store the SQL dump
DUMP_FILE="/tmp/${TABLE_NAME}.sql"

# Check the table exists in the Source DB.
export PGPASSWORD=$SRC_DB_PASS
RESULT=$(psql -h ${SRC_DB_HOST} -p ${SRC_DB_PORT} -U ${SRC_DB_USER} -d ${SRC_DB_NAME} -t -c "SELECT count(1) FROM information_schema.tables WHERE table_name = '${TABLE_NAME}' ")
if [[ "$RESULT" -eq "0" ]]; then
  echo "Error: The table ${TABLE_NAME} doesn't exist in the Source DB."
  exit 1
fi

# Check the table dosn't exist in the Destination DB.
export PGPASSWORD=$DEST_DB_PASS
RESULT=$(psql -h ${DEST_DB_HOST} -p ${DEST_DB_PORT} -U ${DEST_DB_USER} -d ${DEST_DB_NAME} -t -c "SELECT count(1) FROM information_schema.tables WHERE table_name = '${TABLE_NAME}' ")
if [[ "$RESULT" -ne "0" ]]; then
  echo "Error: The table ${TABLE_NAME} exists in the Destination DB."
  exit 1
fi

# Dump the table to a SQL file
export PGPASSWORD=$SRC_DB_PASS
pg_dump -h ${SRC_DB_HOST} -p ${SRC_DB_PORT} -U ${SRC_DB_USER} -t ${TABLE_NAME} -F p ${SRC_DB_NAME} > ${DUMP_FILE}

# Restore the SQL dump to the destination database
export PGPASSWORD=$DEST_DB_PASS
psql -h ${DEST_DB_HOST} -p ${DEST_DB_PORT} -U ${DEST_DB_USER} -d ${DEST_DB_NAME} -f ${DUMP_FILE} -v ON_ERROR_STOP=1

# Check if the table was successfully copied
export PGPASSWORD=$DEST_DB_PASS
RESULT=$(psql -h ${DEST_DB_HOST} -p ${DEST_DB_PORT} -U ${DEST_DB_USER} -d ${DEST_DB_NAME} -t -c "SELECT COUNT(*) FROM ${TABLE_NAME}")
if [[ "$RESULT" -eq "0" ]]; then
  echo "Error: The table ${TABLE_NAME} could not be copied."
  exit 1
fi

# Get the number of records in the source table
export PGPASSWORD=$SRC_DB_PASS
source_count=$(psql -h ${SRC_DB_HOST} -p ${SRC_DB_PORT} -U ${SRC_DB_USER} -d ${SRC_DB_NAME} -c "SELECT COUNT(*) FROM ${TABLE_NAME}" -t)

# Get the number of records in the destination table
export PGPASSWORD=$DEST_DB_PASS
dest_count=$(psql -h ${DEST_DB_HOST} -p ${DEST_DB_PORT} -U ${DEST_DB_USER} -d ${DEST_DB_NAME} -c "SELECT COUNT(*) FROM ${TABLE_NAME}" -t)

# Check that the number of records matches
if [ "$source_count" -ne "$dest_count" ]; then
    echo "Error: The number of records in the source and destination tables ${TABLE_NAME} do not match."
    exit 1
else
    echo "Success: The table ${TABLE_NAME} was copied successfully."
fi

echo "The table was ${TABLE_NAME} successfully copied to the destination database."
```

You will need to modify the script to include your specific database credentials, table name, and destination database. Make sure to also set the appropriate permissions on the script to execute it.
Day 733 : Do What I Gotta
Tags: hiphop, code, coding, lifelongdev
Published: 2023-04-11 21:46:53

_liner notes_:
- Professional : My brain is fried. haha Helped out with a community question. Looked through some docs for any changes that I would need to make. There wasn't any, so that's good. Then I went on to installing the Web Components that I made into the proof of concept project that I'm working on. Got that done and everything worked fine. Awesome. I figured, why not install the other libraries I'm using and completely remove the dependency on CDNs. That's when things took a turn. haha I don't know why Node hates me. Ran into issues to make the Web Components recognize them. Fixed that, but ran into an issue with getting reference to the files when deployed to Netlify. Did what feels like some hacky methods to get it working, but I did get it working. haha

- Personal : So last night, I made some pretty big advancement to adding the View Transitions API to my side project. Looking through the code examples really helped. I was able to modify things to work for my needs. The code is not pretty but it's working and I think I can get it to work better with some refactoring. There's only a couple of more transitions I want to try to get working. There are similar examples, so I'll take a look at them and see what I can work out.

![View from the bank of a river looking up at a mountain range partially covered by clouds.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rv5urfbe2yoiot87abp.jpg)

Going to eat dinner. Then go through tracks for the radio show and then probably work on adding the last couple of transitions I want to implement. If I get that worked out, I want to do some refactoring and then I can add it to the full project that I've been working on. I'm thinking I'll be able to get this done by next week if things go well. Just have to do what I gotta.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube yNYFgCoHUos %}