teleren/devto huggingface dataset:
AI Chatbot Wars
Tags: ai, programming, news
Published: 2022-12-26 03:09:07

##Google Management Is On High aAlert After Recognizing The Potential Of ChatGPT
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ywfr63dsorpxglyxifl.png)

Recently, Open AI, an artificial intelligence research lab, unveiled its experimental chatbot called ChatGPT. Though it is not yet perfect, its capabilities have caused Google management to be on high alert, as they recognize the potential for AI to disrupt their business. According to Business Insider, the CEO of Alphabet (Google’s parent company) Sundar Pichai has directed multiple teams to focus on addressing this potential threat.

ChatGPT is a chatbot that is capable of providing summarized information in short and simple sentences in response to user queries. It can also provide answers to questions about vacation plans, gift ideas, and business strategies. In contrast, Google, the leading search engine, provides users with a list of internet links that they must browse through to find the information they are looking for. One reason that Google does this is that it allows the company to display ads, which generates revenue. According to an Insider report, Google’s advertising business generated $208 billion in 2021 and accounted for 81% of Google’s earnings.

##The Potential Danger Posed By Chatbots

The ready-to-use format of information provided by a chatbot poses a significant threat to Google’s business model. In the past few weeks, users have asked ChatGPT to write college essays, give coding advice, and even act as a therapist to talk to. The chatbot has been so popular that over a million people tried it out in the first five days after its launch.

The situation for Google only becomes more concerning as ChatGPT is just one of many chatbots that will challenge the way people access information on the internet, potentially ending Google’s monopoly as the primary source of information. In a series of meetings on Google’s AI strategy, Pichai directed several teams, including those working in research and the Trust and Safety Division, to focus on developing and launching new AI prototypes and products, including competing products for Open AI’s DALL-E, an AI that can generate art based on instructions and is also used by millions of people worldwide

##The ease and convenience of using ChatGPT

It appears that ChatGPT is returning with bigger goals and improved capabilities after experiencing a crash in 67 countries due to heavy traffic. It can now be [accessed on Google extensions ](https://chrome.google.com/webstore/detail/chatgpt-for-search-engine/feeonheemodpkdckaljcjogdncpiiban/related?hl=en-GB&authuser=0)and can be used directly on the Google interface, Bing!, or DuckDuckGo as a quick source of information for user queries.
How do I make myself learn?
Tags: tutorial, beginners, webdev, help
Published: 2022-12-26 02:53:20

Currently I do fronted web dev with HTML/CSS/JS. And I want to learn a framework for the front end. I did research and choose React mainly for its popularity, I already know some and I like the syntax. And I plan to use [30 days of React](https://github.com/Asabeneh/30-Days-Of-React) to learn it. But I don't have a lot of motivation to learn unlike the huge amount I had when I learned HTML, CSS and JS.

So how do I get myself to learn? How do I give myself the motivation to learn?
Full Stack Development with Spring Boot and React (အခန်း ၄)
Published: 2022-12-26 02:43:36

**Spring Data repositories ကို အမျိုးစုံ customize လုပ်ပုံ**

ကိုယ့်စိတ်ကြိုက် quries တွေကို Spring Data repositories တွေမှာ ရေးလို့ရပါတယ်။ findBy ဆိုတဲ့ prefix နဲ့ စရမှာဖြစ်ပါတယ်။
ဥပမာ findBy + Brand = findByBrand 

ရှေ့က prefix findBy က အသေ ဖြစ်ပြီးနောက်က ကိုယ်ရှာဖို့ ပေးလိုက်ချင်တဲ့ field နာမည်ကိုရေးရမှာပါ။
အောက်မှာ example ပြထားပါတယ်။

```java
import java.util.List;
import org.springframework.data.repository.CrudRepository;

public interface CarRepository extends CrudRepository<Car, Long> {
// Fetch cars by brand
	List<Car> findByBrand(String brand);
```
findBy ဆိုတဲ့ keyword နောက်မှာ And နဲ့ Or ဆိုတဲ့ keyword တွေသုံးလို့ရပါသေးတယ်။ 
ဥပမာ findBy + Brand + And + Model = findByBrandAndModel
findBy+ Brand + Or + Color = findByBrandOrColor 
အစရှိသည်ဖြင့်သုံးနိုင် ရေးနိုင်ပါတယ်။
အောက်မှာ example ပြထားပါတယ်။
```java
package com.packt.demo.domain;

import java.util.List;
import org.springframework.data.repository.CrudRepository;

public interface CarRepository extends CrudRepository<Car, Long> {
// Fetch cars by brand and model
	List<Car> findByBrandAndModel(String brand, String model);

// Fetch cars by brand or color
	List<Car> findByBrandOrColor(String brand, String color);
}
```

ဒီထက် advance ဖြစ်တဲ့ keyword နောက် တစ်မျိုးက OrderBy ဆိုတဲ့ keyword ပါ။ ထွက်လာတဲ့ results တွေကို ကြီးရာကနေငယ်ရာ ၊ ငယ်ရာကနေကြီးရာ စီပေးနိုင်ပါတယ်။
အဲဒါကတော့ Asc နဲ့ Desc ဆိုတဲ့ keyword တွေပေါ့။ ဥပမာ findBy+Year+OrderBy+Asc   findByYearOrderByAsc ဆိုရင် Year ကိုပေးပြီးရှာမယ်။ ထွက်လာတဲ့ results ကို
ငယ်ရာကနေကြီးရာ စီမယ်ဆိုတဲ့ method ကို create လုပ်နိုင်ပြီပေါ့။

```java
package com.packt.demo.domain;

import java.util.List;
import org.springframework.data.repository.CrudRepository;

public interface CarRepository extends CrudRepository<Car, Long> {
// Fetch cars by brand and sort by year
	List<Car> findByBrandOrderByYearAsc(String brand);
}
```
နောက်ဆုံးတစ်ခုကတော့ method name အစား ကိုယ်ရေးချင်တဲ့ query ကို SQL လိုမျိုး ဟာနဲ့ ဆွဲထုတ်ပြီးရေးတာဖြစ်ပါတယ်။​ အောက်မှာ example ကို ပြထားပါတယ်။ ?1 ဆိုတာ positional parameter ပါ။ ဒီနေရာမှာ brand ပေါ့

```java
package com.packt.demo.domain;

import java.util.List;
import org.springframework.data.repository.CrudRepository;

public interface CarRepository extends CrudRepository<Car, Long> {
// Fetch cars by brand using SQL
	@Query("select c from Car c where c.brand like %?1")
	List<Car> findByBrandEndsWith(String brand);
}
```
Pagination အတွက်ကတော့ PagingAndSortingRepository ဆိုတဲ့ feature ကို CrudRepository အပြင်သုံးနိုင်ပါတယ်။ ဆွဲထုတ်မယ့် Data တွေ အရမ်းများရင် serverside pagination ဟာ
အင်မတန်အသုံးဝင်ပါတယ်။ PagingAndSortingRepository ဟာ results တွေကို page အလိုက်ထုတ်ပေးဖို့နဲ့ sort လုပ်ပေးတဲ့နေရာမှာ အသုံးဝင်ပါတယ်။ PagingAndSortingRepository ကို 
ဆောက်တာ CrudRepository ကို ဆောက်တာနဲ့ ပုံစံတူတူပါပဲ။

ဒါဆိုရင် အောက်ပါ method တွေကို စသုံးနိုင်ပြီဖြစ်ပါတယ်။

| Method| Description |
| ----------- | ----------- |
| Iterable\<T\> findAll(Sort sort)| ပေးလိုက်တဲ့ sort option အတိုင်း item တွေကိုထုတ်ယူဖို့      |
| Page\<T\> findAll(Pageable
pageable) | ပေးလိုက်တဲ့ paging option အတိုင်း item တွေကို ထုတ်ယူဖို့       |
How to create a cartoon profile picture with javascript
Published: 2022-12-26 02:39:28

Recently I have noticed a huge amount of AI cartoon profile photo generators popping up all over the app store.  I thought this idea was cool, but would require a sophisticated backend or machine learning layer to make it happen.  Turns out, you can accomplish most of the features in javascript / react.js.

**Meet ComicFun**
[ComicFun](https://www.comicfun.app/) is a new open source project that uses JavaScript .filter and posterize functions to turn an ordinary profile picture into a cartoonified portrait.  Simply upload a photo, or open the device camera to snap a selfie (coming soon).  ComicFun is open source, so all the source code can be viewed in [this repo](https://github.com/brandonbyr4/comicfun).

**Thank You**
Thanks for checking out the repo, and Merry Christmas!  If this project interests you as well, give it a star, and consider [contributing](https://github.com/brandonbyr4/comicfun)!  There are many more updates in the pipelane, as the main photo transformer will be functional soon. (full backend source code available soon)
Perl Suggestion: Improve metacpan title in Google SEO
Tags: perl, google, seo, perlsuggestion
Published: 2022-12-26 01:49:35

I search `cpan File::Spec`. The result is the following.

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

Title is `Spec`, not `File::Spec`.

This means metacpan SEO is not enough to show `File::Spec`.

I suggest metacpan improves Google SEO.
03.09 - State & Props - Send counter data to parent component (class components)
Published: 2022-12-26 01:44:44

App preview:
![The way the app will look like](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2m3emt7dur3ym7d4alm.gif)




Project files:
![An image of project file structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t5ytbl5y7e2fsu6x8hbh.png)



<hr/>
src/App.js:
```react
import React from "react";
import './App.css';
import ParentComponent from "./components/ParentComponent";

class App extends React.Component{

  render(){
    return(
      <div className="App">
        <p><b>App.js</b> |class|</p>
        <ParentComponent/>
      </div>
    )
  }
}

export default App;
```
<hr/>
src/App.css
```css
.App{
  background-color: lightskyblue;
  padding: 10px 10px;
}

p{
  margin-top: 6px; 
  margin-bottom: 12px 
}
```
<hr/>
<hr/>
src/components/ParentComponent.jsx
```react
import React from "react"
import ChildComponent from "./ChildComponent"
import "./ParentComponent.css"

class ParentComponent extends React.Component{
    constructor(){
        super();
        this.state = {
          count: 0
        }
    }

    updateCounterList(){
        this.setState((prevState)=>({count: prevState.count+1}))
    }

    render(){
        return(
            <div className="ParentComponent">
                <p><b>ParentComponent.jsx</b> |class|</p>
                <ChildComponent updateCounterList={()=>{this.updateCounterList()}}/>
                <p>Click Counter value is {this.state.count}.</p>
            </div>
        )
    }

}

export default ParentComponent
```
<hr/>
src/components/ParentComponent.css
```css
.ParentComponent{
    background-color: lightsalmon;
    padding: 10px 10px;
    margin: 10px 10px;
}

h2{
    margin-top: 0px; 
    margin-bottom: 6px 
}
```
<hr/>
<hr/>
src/components/ChildComponent.jsx
```react
import React from "react";
import "./ChildComponent.css"


class ChildComponent extends React.Component{
    constructor(props){
        super(props);
    }

    handleClick = () => {
        this.props.updateCounterList();
    }


    render(){
        return (
            <div className="ChildComponent">
                <p><b>ChildComponent.jsx</b> |class|</p>
                <button onClick={()=>{this.handleClick()}}>Add 1</button>
            </div>
        );
    }
}

export default ChildComponent;
```
<hr/>
src/components/ChildComponent.css
```css
.ChildComponent{
    background-color: lightgreen;
    padding: 10px 10px;
    margin: 10px 10px;
}

h3{
    margin-top: 0px; 
    margin-bottom: 6px 
}
```
Places (Cities and Towns in UK) that I have visited so far 2022-12-26
Tags: blog, map
Published: 2022-12-26 01:05:05

Created via Google Maps. The following are the places in UK that I have visited or lived. 

![image.png](https://cdn.steemitimages.com/DQmTTiRBSkTJdgwRGXCrSh6MvCRsuqapHE8HCVnbC7PYsmy/image.png)

Sheffield
London
Cambridge
Luton
Swansea
Cornwall
King's Lynn
Edinburgh
Belfast
Manchester
Glasgow
Stirling
Peterborough
St Albans
Enfield
Eastbourne
Portsmouth
Saint Ives
Cambourne
St Ives
Land's End
Stonehenge
Colchester
Southend-on-Sea
Ely
Hunstanton
Loughborough
Derby
Durham
Nottingham
Oxford
Windsor
Bournemouth
York
Plymouth
Cardiff
Bedford
Papworth Everard
Bourn
Cheltenham
Isle of Wight
Royston
Stevenage
Duxford
Bicester Village
Croydon
Milton Keynes

Places visited - https://www.google.com/maps/d/viewer?mid=1A2RdVZ6JjVxDJjFBcvVt629zCmtMWLA&usp=sharing 




<hr/>

### [Steem](https://steemyy.com) to the Moon!
You can swap the STEEM/SBD to USDT (TRC-20) via [Steem2USDT](https://steemyy.com/steem2usdt.php)
What is Redux?
Tags: react, redux, javascript, beginners
Published: 2022-12-26 01:02:28

The principles of Redux are that the state of the application should be stored in a single location, or "store," and that changes to the state should be made using pure functions called "reducers."

> ***To use Redux with a React application, the store and reducers can be integrated into the application using the react-redux library.***
> 
> > ***The process of integrating Redux into a React application involves creating the store and reducers, and then using the connect function from react-redux to connect the store and reducers to specific components in the React application.***
> > 
> > > ***The tutorial covers a variety of topics related to using Redux with React, including how to avoid mutating data structures, how to use the combineReducers function to simplify the process of defining multiple reducers, and how to use the Provider component from react-redux to make the store available to all components in the application.***

## Summary

* Intro and 3 Principles of Redux
    
* The Reducer and the Store
    
* Implementing the Store from Scratch
    
* A React Counter Example
    
* Avoiding Array Mutations
    
* Avoiding Object Mutations
    
* Writing a Todo List Reducer
    
* Reducer Composition with Arrays
    
* Reducer Composition with Objects
    
* Reducer Composition with combineReducers
    
* Implementing combineReducers() from Scratch
    
* Example: Adding a Todo
    
* Example: Toggling a Todo
    
* Example: Filtering Todos
    
* Extracting Presentational Components: Todo and TodoList
    
* Extracting Presentational Components: AddTodo, Footer, and FilterLink
    
* Extracting Container Components: Filter Link
    
* Extracting Container Components: VisibleTodoList and AddTodo
    
* Passing the Redux Store Explicitly via Props
    
* Passing the Redux Store Explicitly via Context
    
* Passing the Store via Provider from react-redux
    
* Generating Containers with connect(): VisibleTodoList
    
* Generating Containers with connect(): AddTodo
    
* Generating Containers with connect(): FooterLink
    

[Take me to the Course](https://nothanii.vercel.app/projects/Advanced%20Redux)
Poll: CLI or UI?
Tags: discuss, beginners, productivity, watercooler
Published: 2022-12-26 00:57:53

I just saw a post, using CLI for **MySQL** and **PostgreSQL**, showing some quick sheet of commands (I suppose popular ones).

It is my *very own and personal opinion* that it is a waste of my brain cells to memorize so many different CLI commands, so I am a **User Interface** guy.

Want to tell your story/preference?  Hit the comments section here or head to my [Mastodon](https://dotnet.social/@webJose/109577240385319218) poll.  Yes, you can do polls in **Mastodon**.  Cool right?
My first MLH hackathon experience!
Tags: mlh, webdev, hackathon, hackin
Published: 2022-12-26 00:57:33

As an **overall second winner** in the recent **MLH Design-a-thon hackathon**, I can confidently say that it was an incredible and enriching experience.

For those who may not be familiar, a **hackathon **is essentially a marathon of coding, design, and innovation. It’s a place where developers and designers come together to collaborate on projects and create something new in a short amount of time.

The **Design-a-thon** specifically focused on design-centered projects, so it was a great opportunity for me to hone my skills in this area and learn from others.

I got to know about MLH through a friend and the amazing part of this is **MLH conducts hackathons every weekend!** So this is a great opportunity to apply your learnings and compete with others every weekend.

The opening ceremony was conducted on the evening of 23rd December, where we were briefed about the competition, rules, and prizes. MLH hackathons can be participated as a solo or a team of up to 4 members.

I worked as a team with 3 other members whom I met through the event.

There were no specific themes or areas to work on, so it was up to your imagination about what topics you choose to build your project.

We built **[RockaBuy](https://devpost.com/software/rockabuy-as6d1x?ref_content=my-projects-tab&ref_feature=my_projects)**, which is a cutting-edge platform that allows customers to send customized rockets to various regions on the Moon. Whether for scientific research, tourism, or other purposes, RockaBuy makes it easy for anyone to design and launch their own unique rocket using its advanced technology and reliable services.

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

We thought sending rockets to the moon and being part of the space community might be the new flex!

We built it using the **MERN stack**, so RockaBuy utilizes the power of JavaScript-based technologies to provide a seamless and efficient platform for launching rockets. With MongoDB as the database, Express as the backend framework, React + Vite as the frontend library, and Node.js as the runtime environment, RockaBuy offers a full-stack solution for sending customized rockets to the Moon.

Overall, the MLH Design-a-thon hackathon was a fantastic experience that I would highly recommend to anyone interested in design or technology. It was a great opportunity to learn, collaborate, and create, and I feel like I came away from it with a lot of new skills and knowledge. If you’re considering attending a hackathon in the future, I would definitely recommend it!

See more about it at :

https://devpost.com/software/rockabuy-as6d1x?ref_content=my-projects-tab&ref_feature=my_projects
It is not widely known that Perl is one of the easiest languages to read like Python.
Tags: perl, python, beginners, programming
Published: 2022-12-26 00:55:00

It is not widely known that Perl is one of the easiest languages to read like Python.

It is not widely known that Perl is one of the easiest languages to read like Python, while the information that Python is the most readable programming language is widely circulated, with no confirmation of its veracity.

To resolve this misunderstanding, let me write one code.

```
use v5.36;

while (my $line = <DATA>) {
  chomp $line;
  
  my ($id, $name, $price) = split(',', $line);
  
  my $new_line = join(' ', $id, $name, $price);
  
  say $new_line;
}

__DATA__
1,Perl,2000
2,Database,3000
3,Web,4000
```

Result:

```
1 Perl 2000
2 Database 3000
3 Web 4000
```

How readable is Perl compared to Python?
Top 10 python tips
Tags: python, webdev, programming, javascript
Published: 2022-12-26 00:32:35

[Codingan](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR44HHZQzlffpLsKRFt5-KRvlL5jVNbaMDOIY6a-lV6XI3YISvJSiI-ROWAvTpyivBjlN7V7FpWtqBMgOYB8HF6G-5UKMfGGOkOMzJtG9hcbMQxXES_UkAq0yoXKmsISmzabyxyPK2HKF4osoc7xlo0MU1gIzIAXwQI5OXLtn7oXuH759n270mEpl4/s650/Tips%20Menjadi%20Programmer%20Python.jpg)
Here are ten top tips for working with Python:

Use a good code editor or integrated development environment (IDE). Some popular options include PyCharm, Visual Studio Code, and Sublime Text.

Follow the Python style guide (PEP 8). This will help you write clean, readable code that is easy to maintain and understand.

Take advantage of Python's built-in documentation. Use the help() function to learn about a module, function, or object, and use triple-quoted strings for inline documentation.

Use version control (e.g., Git) to track changes to your code and collaborate with others.

Use virtual environments to manage project dependencies and avoid conflicts.

Write unit tests to ensure that your code is working as expected and to catch regressions.

Use debugging tools such as the pdb module or an IDE's debugger to find and fix errors in your code.

Use profiling tools to identify and optimize performance bottlenecks in your code.

Learn about and use Python's standard library and third-party libraries, which provide many useful tools and functions that can save you time and effort.

Stay up to date with the latest developments in the Python ecosystem by following blogs, joining online communities, and attending conferences and meetups.

Source: 
[https://www.kelasteknisi.com/2022/12/10-tips-teratas-python.html](https://www.kelasteknisi.com/2022/12/10-tips-teratas-python.html)
[https://www.kelasteknisi.com/2022/12/10-tips-menjadi-programmer-python.html](https://www.kelasteknisi.com/2022/12/10-tips-menjadi-programmer-python.html)
Teknisi in an Indonesia
Tags: webdev, programming, python
Published: 2022-12-26 00:25:02

"Teknisi" is an Indonesian word that means "technician." It refers to a person who is trained and skilled in the use, repair, and maintenance of technical equipment and systems. Technicians can work in a variety of fields, including electronics, computer [technology](https://www.kelasteknisi.com/2022/12/7-teknologi-yang-ditinggalkan-mengapa-mereka-tidak-dipakai-lagi.html), engineering, and healthcare, among others. They are responsible for diagnosing and troubleshooting problems with equipment, and for performing repairs and maintenance as needed. They may also be involved in the installation and setup of new equipment, and in training others on how to use it.

source: [https://www.kelasteknisi.com/](https://www.kelasteknisi.com/)
PostgreSQL notes
Tags: postgres
Published: 2022-12-26 00:01:46

---
title: PostgreSQL notes
published: true
description: 
tags: postgresql
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-12-25 23:37 +0000
---


## Quick commands

```text
# ALTER DATABASE name RENAME TO newname

# mysql: SHOW DATABASES
# pgres: \l
# mysql: SHOW TABLES
# pgres: \d
# mysql: USE mydbname
# pgres: \c  mydbname # \connect

# mysql: SHOW COLUMNS
# pgres: \d table

# mysql: DESCRIBE TABLE
# pgres: \d+ table ( \dt)

# exit: \q

SELECT version();
show data_directory;
```

## HOW TO

### export/import 

dump command

```bash
pg_dump -U USERNAME DBNAME > dbexport.pgsql
# PGPASSWORD="mypassword" pg_dump -U myusername dbname 密碼 > output.sql
pg_dump -U postgres -f /tmp/dump.sql.gz --compress=5 --no-owner dbname
```

import command

```bash
psql -f backup.sql dbname dbuser
# import specific table
pg_dump -U xxx public.TABLE_NAME DATABASE_NAME > out.sql
pg_dump -U xxx -d DB_NAME -t TABLE_NAME > out.sql
```

export csv

```bash
psql -U user -d db_name -c "Copy (Select * From foo_table LIMIT 10) To STDOUT With CSV HEADER DELIMITER ',';" > foo_data.csv
```

### Slow query log

```
# 1. find config file
psql -U postgres -c 'SHOW config_file'

# 2. edit conf
# default
#log_min_duration_statement = -1
log_min_duration_statement = 1000 # (log all queries executing more than 1 second)
```

# possible log paths:

```text
/var/lib/pgsql/PG_VERSION/data/log/
/var/log/postgresql/
/var/lib/postgresql/PG_VERSION/main/pg_log
```

restart postgres (not “service”)

```
su - postgres -c "PGDATA=$PGDATA {path/to/}pg_ctl -w restart"
```
## create user

```sql
postgres=# CREATE DATABASE mydbname ;
postgres=# CREATE DATABASE mydbname  OWNER myusername ;
postgres=# GRANT ALL PRIVILEGES ON DATABASE mydbname to myusername ;
ALTER ROLE myusername WITH superuser;
```

## Problems

### sequences

duplicate key error... (after restore data)

```sql
SELECT setval('my_sequence_name', (SELECT max(id) FROM my_table));
; my_sequence_name default is my_table_id_seq
```

truncate & auto increment

```sql
TRUNCATE table_name RESTART IDENTITY;
```