teleren/devto huggingface dataset:
Better Hardware Has Been Terrible for Development💻
Tags: discuss, programming, performance, unpopularopinion
Published: 2023-03-22 07:30:18

The rapid pace of improvement in processor speeds over the years - and of hardware performance/cost generally - has mostly been absolutely terrible for software development.

Developers get lazier and sloppier all the time, choosing to just rely on the hardware to pick up the slack from objectively terrible code (often to meet arbitrary deadlines).

The companies they work for don't care because bad developers are cheap, and hardware gets progressively cheaper.

The code eventually becomes so bad, that even faster hardware is required to do even the simplest thing.

The cycle then repeats itself.

The hardware manufacturers obviously love this, as do software companies as they all get to keep releasing 'better' stuff and making more money. The rest of us, however, just wonder why our machines are so slow.

---

Just imagine what would be possible with our current hardware if this wasn't the case? 🚀



<br /> <br /> <br />



![written by human](https://notbyai.fyi/img/written-by-human-not-by-ai-black.svg)
Viewing Objects
Tags: opengauss
Published: 2023-03-22 07:18:20

gsql provides several advanced features to facilitate user operations. The common usage is as follows:

Query the command help information.

```
\h [NAME]
```

For example, query all syntaxes of the ABORT statement.

```
openGauss=# \h ABORT
Command:     ABORT
Description: abort the current transaction
Syntax:
ABORT [ WORK | TRANSACTION ] ;

```
Switch databases.

```
\c dbname

```

For example, switch the postgres database to the dp_tpcc database.

```
openGauss=# \c db_tpcc
Non-SSL connection (SSL connection is recommended when requiring high-security)
You are now connected to database "db_tpcc" as user "omm".
db_tpcc=# 
```

Query all databases.

```
\l

```

The following is an example:

```
openGauss=# \l
                          List of databases
   Name    | Owner | Encoding  | Collate | Ctype | Access privileges
-----------+-------+-----------+---------+-------+-------------------
 mydb      | omm   | GBK       | C       | C     |
 postgres  | omm   | SQL_ASCII | C       | C     |
 template0 | omm   | SQL_ASCII | C       | C     | =c/omm           +
           |       |           |         |       | omm=CTc/omm
 template1 | omm   | SQL_ASCII | C       | C     | =c/omm           +
           |       |           |         |       | omm=CTc/omm
(4 rows)
```

Query all tables in the current database.

```
\dt
```

The following is an example:

```
openGauss=# \dt
                              List of relations
 Schema |      Name       | Type  | Owner |             Storage
--------+-----------------+-------+-------+----------------------------------
 public | customer_t1     | table | omm   | {orientation=row,compression=no}
 public | customer_t1_bak | table | omm   | {orientation=row,compression=no}
(2 rows)
```

View a table structure.

\d tablename

For example, view the structure of the customer_t1 table.


```
openGauss=# \d customer_t1
        Table "public.customer_t1"
    Column     |     Type     | Modifiers
---------------+--------------+-----------
 c_customer_sk | integer      |
 c_customer_id | character(5) |
 c_first_name  | character(6) |
 c_last_name   | character(8) |
 amount        | integer      |
```
Mastering Real-Time Analytics: How to Use ApacheAGE for High-Performance Graph Querying
Tags: apacheage, postgres, datascience, agedb
Published: 2023-03-22 07:14:41

In today's fast-paced business environment, real-time analytics has become an essential tool for decision-making. ApacheAGE is an open-source software that enables real-time analytics on large-scale graph data. This tutorial will guide you through the process of using ApacheAGE for real-time data analytics.

**What is ApacheAGE?**

[ApacheAGE](http://age.apache.org/) is a distributed query engine designed for large-scale graph data. It is built on top of Apache Arrow, a columnar in-memory data format, and supports various graph query languages such as Cypher and PGQL. ApacheAGE allows users to run complex graph queries on large-scale graph data with high performance and scalability.

**Setting up ApacheAGE**

To use [ApacheAGE](http://github.com/apache/age) for real-time analytics, you need to first set up the environment. You can install ApacheAGE using pip:


`pip install apache-age`

Once you have installed ApacheAGE, you can start the server using the following command:

 
`age-start`

This command will start the ApacheAGE server on your local machine.

**Loading Data into ApacheAGE**

To load data into ApacheAGE, you need to create a graph schema using the CREATE GRAPH statement. Here is an example of how to create a graph schema for a social network:

`CREATE GRAPH social_network (
  person VERTEX,
  knows EDGE (person, person),
  likes EDGE (person, post),
  post VERTEX
);`

This schema defines a social network with two types of vertices (person and post) and two types of edges (knows and likes). Once you have defined the graph schema, you can load data into the graph using the LOAD CSV statement. Here is an example of how to load data into the social network graph:

`LOAD CSV "person.csv" AS row
CREATE (:person {id: row[0], name: row[1]})
LOAD CSV "post.csv" AS row
CREATE (:post {id: row[0], text: row[1]})
LOAD CSV "knows.csv" AS row
MATCH (p1:person {id: row[0]}), (p2:person {id: row[1]})
CREATE (p1)-[:knows]->(p2)
LOAD CSV "likes.csv" AS row
MATCH (p:person {id: row[0]}), (post:post {id: row[1]})
CREATE (p)-[:likes]->(post)`

**Running Queries in ApacheAGE**

Once you have loaded data into ApacheAGE, you can run queries on the graph. ApacheAGE supports various query languages such as Cypher and PGQL. Here is an example of how to run a Cypher query to find all the posts that a person likes:


`MATCH (p:person {name: "John"})-[:likes]->(post:post)
RETURN post.text`

This query finds all the posts that the person named John likes and returns the text of the posts. ApacheAGE supports real-time analytics, which means that the query will be executed in real-time, and the results will be returned immediately.

**Conclusion**

ApacheAGE is an excellent tool for real-time analytics on large-scale graph data. It is easy to set up and use, and it supports various graph query languages such as Cypher and PGQL. With ApacheAGE, you can perform complex graph queries on large-scale graph data in real-time.
Continuity in DevOps
Tags: softwaredevelopment, devops, pipeline, storybytes
Published: 2023-03-22 07:03:20


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qfmfklm32hd4hvt65eff.png)
In today’s fast pacing development phase, DevOps is the glue that stabilises and eventually accelerates the work done to the user. Traditional engineering practices involved different teams’ duties throughout the software development and release cycle. Most of the process in this release pipeline was done manually, creating friction between the processes and teams. The DevOps movement has brought teams together and automated many processes. This has helped reduce the waiting time for release.

Additionally, continuous DevOps feedback helps organisations quickly innovate, fix bugs, and change functionality. The less we have manually touched the process, the better we get for automation. This demands the team’s understanding of communication, documenting, and standardising the process. In an ideal world, the code must pass all the tests to be automatically moved to production without manual intervention to achieve continuous deployment. So if a developer commit has no issues, it directly goes to production. With all the continuity promises, the goal is not to become faster but better. Better in understanding the user’s needs and, therefore, as a result, better in acceptance and quality.
Emerging Technologies I Can't Wait to Work With!
Tags: discuss, beginners, codenewbie
Published: 2023-03-22 07:00:00

Tech enthusiasts are always on the lookout for the latest and greatest innovations in the industry. Here are some of the emerging technologies that are on everyone’s minds. Which are you most excited about? Let's discuss!

1. **Artificial Intelligence (AI)** - The potential applications of AI are seemingly endless. How do you see this technology continuing to grow and evolve? And will it have a positive impact on our lives?
2. **Blockchain** - As a decentralized and secure ledger system, blockchain has the potential to revolutionize a wide range of industries. What are some of the possibilities here?
3. **Internet of Things (IoT)** - The IoT is set to transform the way we live and work. How do you anticipate leveraging this technology in your work?
4. **Augmented Reality (AR)** - AR has the potential to transform the way we interact with our environment and it’s quickly becoming more accessible. Share your thoughts.
Working as an Engineer at mPharma
Published: 2023-03-22 06:55:26

It was like the second week or so at mPharma when I joined a meeting we regularly have, called ‘Coffee Break’. During Coffee Break, we catch up, properly welcome new employees if any, and play games like 2 truths, one lie, Tetris, typing games, etc. Mind you, this is all online. After my first coffee break, I was in my room and I remember saying to myself, “Wow, this is the best place I have ever worked at. This is the best place that I could ever be.'' You know how much positive vibes have to be exuded in a virtual meeting for you to feel it in your house? I work remotely, and every time I log onto Slack or get into a meeting, I feel a positive work environment all around me.

There is an open-door culture where I could just hit up my CTO on Slack. I should even hit him up for our regular linkup after this. Anyway, as I was saying, I could just hit up my CTO on Slack and schedule a chat during the week. That is how accessible people are at the workplace. Selasie Anani is a top top guy, and it doesn’t take long for you to realize how much of the engineering culture in mPharma emanates from him. He has set a precedent in both actions and words as a leader that everyone else embodies.

You can’t help but become a team player because of the joy that comes from working with your teammates. You can’t help but assist others because of the help you have already received. Your voice is sought out, your words are acknowledged, and your proposals actually make a difference, whether you are an intern, an entry-level engineer, or a senior engineer. It doesn’t matter. You don’t have to go through a lot of red tape to get things done. Everyone is ever ready to help you drive change and help you become the best version of yourself.

This is the culture at mPharma, where there is no pressure on you to be anyone else or anything else but the best version of yourself, where titles are just formalities, and superiority is a lost word only realized when viewing organizational charts.
useState when to use?
Tags: react, hooks, usestate, javascript
Published: 2023-03-22 06:52:28

**1. Managing simple state:**

```
import React, { useState } from 'react';

function Example() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>Click me</button>
    </div>
  );
}
```
**2. Managing boolean state:**

```
import React, { useState } from 'react';

function Example() {
  const [isOn, setIsOn] = useState(false);

  return (
    <div>
      <p>The light is {isOn ? 'on' : 'off'}</p>
      <button onClick={() => setIsOn(!isOn)}>
        {isOn ? 'Turn off' : 'Turn on'}
      </button>
    </div>
  );
}
```
**3. Managing complex state:**

```
import React, { useState } from 'react';

function Example() {
  const [person, setPerson] = useState({ name: '', age: 0 });

  const handleInputChange = event => {
    const { name, value } = event.target;
    setPerson({ ...person, [name]: value });
  };

  return (
    <div>
      <p>Name: {person.name}</p>
      <p>Age: {person.age}</p>
      <input
        type="text"
        name="name"
        value={person.name}
        onChange={handleInputChange}
      />
      <input
        type="number"
        name="age"
        value={person.age}
        onChange={handleInputChange}
      />
    </div>
  );
}
```
**4. Managing array state:**

```
import React, { useState } from 'react';

function Example() {
  const [todos, setTodos] = useState([]);

  const handleAddTodo = () => {
    setTodos([...todos, { id: Date.now(), text: 'New todo' }]);
  };

  return (
    <div>
      <ul>
        {todos.map(todo => (
          <li key={todo.id}>{todo.text}</li>
        ))}
      </ul>
      <button onClick={handleAddTodo}>Add todo</button>
    </div>
  );
}
```
**5. Updating state based on previous state:**

```
import React, { useState } from 'react';

function Example() {
  const [count, setCount] = useState(0);

  const handleIncrement = () => {
    setCount(prevCount => prevCount + 1);
  };

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={handleIncrement}>Click me</button>
    </div>
  );
}
```

> These are just a few examples of the many use cases of the useState hook. The hook is very versatile and can be used to manage any kind of state within a React component.
UPDATE Statement in openGauss
Tags: opengauss
Published: 2023-03-22 06:51:27

Existing data in a database can be updated. You can update one row, all rows, or specified rows of data, or update data in a single column without affecting the data in the other columns. The UPDATE statement changes the values of the specified columns in all rows that satisfy the condition. The WHERE clause clarifies conditions. The columns to be modified need to be mentioned in the SET clause; columns not explicitly modified retain their previous values.

**Syntax**
 

```
UPDATE table_name 
SET column_name = { expression | DEFAULT } 
[WHERE condition ];
```
**Parameter Description**

table_name

Specifies the name (optionally schema-qualified) of the table to be updated. For example, myshcema.table.

Value range: an existing table name

expression

Specifies the expression or value to be assigned to a column.

column_name

Specifies the name of the column to be modified.

Value range: an existing column name

condition

Specifies an expression that returns a value of Boolean type. Only rows for which this expression returns true are updated.

**Examples**
Run the following command to change the value of c_customer_sk in the customer_t1 table from 9527 to 9876:

```
openGauss=# UPDATE customer_t1 SET c_customer_sk = 9876 WHERE c_customer_sk = 9527;
UPDATE 1
```

You can use a schema to modify the table name. If no such modifier is specified, the table is located based on the default schema path. In the statement, SET is followed by the target column and the new column value. The new column value can be a constant or an expression.

For example, run the following statement to increase all the values in the c_customer_sk column by 100:

```
openGauss=# UPDATE customer_t1 SET c_customer_sk = c_customer_sk + 100;
UPDATE 9
```
This statement does not include the WHERE clause, so all rows are updated. If the statement includes the WHERE clause, only the rows matching the clause are updated.

In the SET clause, the equal sign (=) indicates value setting. In the WHERE clause, the equal sign indicates comparison. WHERE may not represent an equation and can be replaced by other operators.

You can run an UPDATE statement to update multiple columns by specifying multiple values in the SET clause. For example:

```
openGauss=# UPDATE customer_t1 SET c_customer_id = 'Admin', c_first_name = 'Local' WHERE c_customer_sk = 4421; 
UPDATE 1
```
DELETE Statement in openGauss
Tags: opengauss
Published: 2023-03-22 06:19:48

The DELETE statement can be executed to delete rows that satisfy the WHERE clause from a specified table. If the WHERE clause does not exist, all rows in the table will be deleted and only the table structure is retained.

**Syntax**

```
DELETE FROM table_name 
       [WHERE condition];
```

Parameter Description
table_name

Specifies the name (optionally schema-qualified) of the target table.

Value range: an existing table name

condition

Specifies an expression that returns a Boolean value. Only rows for which this expression returns true will be deleted.

Examples
Create the customer_t1_bak table whose structure and data are the same as those of the customer_t1 table.

```
openGauss=# CREATE TABLE customer_t1_bak AS TABLE customer_t1;
INSERT 0 9
```

```
The customer_t1_bak table is created, and the data in the table is as follows:

openGauss=# SELECT * FROM customer_t1_bak;
 c_customer_sk | c_customer_id | c_first_name | c_last_name | amount
---------------+---------------+--------------+-------------+--------
          3869 | hello         | Grace        |             |   1000
          3869 | hello         | Grace        |             |   1000
          3869 |               | Grace        |             |
          3869 | hello         |              |             |
          3869 | hello         |              |             |
               |               |              |             |
          6985 | maps          | Joes         |             |   2200
          9976 | world         | James        |             |   5000
          4421 | Admin         | Local        |             |   3000
(9 rows)

```
Run the following statement to delete the employee whose c_customer_sk is set to 3869 from the customer_t1_bak table:

```
openGauss=# DELETE FROM customer_t1_bak WHERE c_customer_sk = 3869;
DELETE 5
```
The following information is displayed, indicating that the row where c_customer_sk is set to 3869 has been deleted.

```
openGauss=# SELECT * FROM customer_t1_bak;
 c_customer_sk | c_customer_id | c_first_name | c_last_name | amount
---------------+---------------+--------------+-------------+--------
               |               |              |             |
          6985 | maps          | Joes         |             |   2200
          9976 | world         | James        |             |   5000
          4421 | Admin         | Local        |             |   3000
(4 rows)
```
If the WHERE statement is not specified, the data of the entire table is deleted by default, and only the table structure is retained.

```
openGauss=# DELETE FROM customer_t1_bak;
DELETE 4
```

The result is as follows:

```
openGauss=# SELECT * FROM customer_t1_bak;
 c_customer_sk | c_customer_id | c_first_name | c_last_name | amount
---------------+---------------+--------------+-------------+--------
(0 rows)
```
Developers might be using useEffect wrong this whole time
Tags: react, hooks, webdev, programming
Published: 2023-03-22 05:54:37

Hi there everyone 👋, if you're a React Developer then there might be the case that you're misusing the `useEffect` hook in one way or another. I also have been misusing the react `useEffect()` hook for a very long time.

So in this blog, I am going to help developers avoid bad use cases with `useEffect` and how you can completely avoid that as a react developer whether you're a beginner or an advanced developer.

## What is wrong?

As react developers, we all worked with `useEffect` tons and tons of times but have we ever thought about what is `useEffect`, what it does and whether are we actually using the `useEffect` the right way or maybe aren't we misusing it? Maybe we are not using `useEffect` correctly in the right place, it should be used because as we all know we use it for pretty much everything as React Developers for fetching data, handling events, transforming data, large components or even implementing advanced logic.

If you go to the new [React Documentation](https://beta.reactjs.org/) which is completely a re-writing of the old react documentation and look for the `useEffect` hook, it says

"`useEffect` is a React Hook that lets you [synchronize a component with an external system](https://beta.reactjs.org/learn/synchronizing-with-effects)".

So from this perspective, it means that it is meant for synchronization and not for handling events or transforming data. It is only used for synchronization with an external component.

By synchronization, it means that `useEffects` are meant to specify side effects that are caused by rendering itself, rather than by a particular event.

## How should I avoid them?

To avoid synchronization issues, you can try to minimize your logic like calculation, checking the states, error handling, etc. outside of `useEffect` hook or you can make go with the declarative paradigm and define all the logic of calculation or transforming data or event handling into different files.

To know more about this, here is the detailed video to which you can refer

{% embed https://youtu.be/Rub-XMihzis %} 

Thank you! for reading, please leave your comments if any ✌️

Don't forget to bookmark this blog for the future 📌

Connect with the author:

* [**LinkedIn**](https://www.linkedin.com/in/sanchitbajaj02/)
    
* [**GitHub**](http://github.com/sanchitbajaj02)
    
* [**Twitter**](https://twitter.com/solitrix02)
    

## References

* [https://beta.reactjs.org/](https://beta.reactjs.org/)
    
* [https://www.thearmchaircritic.org/mansplainings/you-might-be-using-useeffect-wrong-the-whole-time](https://www.thearmchaircritic.org/mansplainings/you-might-be-using-useeffect-wrong-the-whole-time%EF%BF%BC)