teleren/devto huggingface dataset:
Monitoring Disk Usage in PostgreSQL
Published: 2023-07-31 16:55:33

In any database management system, monitoring disk usage is a crucial task for administrators to ensure the efficient functioning of the system. In PostgreSQL, understanding the disk space occupied by tables and indexes is essential for optimizing performance and preventing potential issues. 

PostgreSQL stores data in primary heap disk files, with the possibility of a TOAST file for columns containing wide values. Each table and index resides in a separate disk file, with naming conventions described in Section 73.1 of the PostgreSQL documentation.

There are three ways to monitor disk space in PostgreSQL:

**1. Using SQL Functions:**
   PostgreSQL provides SQL functions that allow you to easily query and determine the disk usage of any table. One such function is `pg_relation_filepath(oid)`, which returns the file path of a table's disk file. For instance, to check the disk usage of a table named 'customer', you can execute the following query:
   
   ```sql
   SELECT pg_relation_filepath(oid), relpages FROM pg_class WHERE relname = 'customer';
   ```
The `relpages` column represents the number of pages allocated to the table, with each page typically being 8 kilobytes.

**2. Using oid2name Module:**
   Another approach to monitor disk space is through the oid2name module, which helps map object IDs (OIDs) to their corresponding names. While this method is useful, it is generally recommended to use the SQL functions for simplicity.

**3. Manual Inspection of System Catalogs:**
   Administrators can directly inspect the system catalogs to understand disk usage. However, this method is more complex and less recommended than the SQL functions.

When dealing with potentially wide values, PostgreSQL utilizes a TOAST table to store data that does not comfortably fit in the main table. Indexes are vital for optimizing query performance, and monitoring their sizes is equally important.Prevent disk full failures by proactively managing disk space, deleting unnecessary data, and utilizing tablespaces to move files. Timely action is crucial to avoid performance issues and disruptions in the database operations. Regular monitoring ensures a healthy and efficient PostgreSQL database.

Monitoring disk usage in PostgreSQL is an integral part of database administration. By utilizing SQL functions and inspecting system catalogs, administrators can effectively determine the disk space used by tables, indexes, and TOAST tables. Additionally, being proactive in managing disk space and preventing disk full failures is crucial to ensure smooth database operations.

[Reference](https://www.postgresql.org/docs/15/diskusage.html)
How to encrypt and decrypt text in javascript client side with AES CFB 256
Tags: react, reactnative, javascript, nextjs
Published: 2023-07-31 16:53:20

AES CFB 256 encrypt and decrypt text using [crypto-js](https://www.npmjs.com/package/crypto-js)

```tsx
// aes.js
import CryptoJS from 'crypto-js';

export function encryptText(keyStr, text) {
  const private_key = CryptoJS.SHA256(keyStr).toString(CryptoJS.enc.Latin1);
  const rem = text.length % 16;
  const padded = CryptoJS.enc.Latin1.parse(text.padEnd(text.length + (16 - rem), '\0'));
  const iv = CryptoJS.lib.WordArray.random(16);
  const cipher = CryptoJS.AES.encrypt(padded, CryptoJS.enc.Latin1.parse(private_key), {
    iv: iv,
    mode: CryptoJS.mode.CFB,
    padding: CryptoJS.pad.NoPadding,
    segmentSize: 128,
  });
  const ciphertext = iv.concat(cipher.ciphertext);
  return ciphertext.toString(CryptoJS.enc.Base64);
}

export const decryptText = (keyStr, text) => {
  const private_key = CryptoJS.SHA256(keyStr).toString(CryptoJS.enc.Latin1);
  const encrypted = CryptoJS.enc.Base64.parse(text);
  const iv = encrypted.clone().words.slice(0, 4);
  const ciphertext = encrypted.clone().words.slice(4);
  const cipherParams = {
    ciphertext: CryptoJS.lib.WordArray.create(ciphertext),
  };
  const decrypted = CryptoJS.AES.decrypt(cipherParams, CryptoJS.enc.Latin1.parse(private_key), {
    iv: CryptoJS.lib.WordArray.create(iv),
    mode: CryptoJS.mode.CFB,
    padding: CryptoJS.pad.ZeroPadding,
    segmentSize: 128,
  });
  const decryptedText = CryptoJS.enc.Utf8.stringify(decrypted);
  return decryptedText;
};
```
Embracing the Power of Graph Databases
Tags: apacheage, postgressql, database, graphs
Published: 2023-07-31 16:47:13

In recent years, alternative types of databases have emerged to address specific challenges. Among these, Graph Databases have gained significant attention for their ability to handle highly connected data efficiently. Today, we'll delve into the fascinating world of Graph Databases, exploring how PostgreSQL and Apache AGE together offer a powerful multi-model approach.

To address the need for versatility and to make the most of graph database capabilities, a hybrid approach emerges as an innovative solution. PostgreSQL, a reliable and high-performing open-source database, is known for its extensibility through add-ons called extensions. Among these powerful extensions, Apache AGE stands out as a bridge between relational, document, and graph databases.

In a traditional relational model, querying for all comments made by users who are friends with each other might involve multiple complex JOIN operations. However, with Apache AGE's graph database capabilities, we can achieve this with a single expressive Cypher query.

**Traditional SQL Query:**
```
SELECT comments.comment_text
FROM users
JOIN friendships ON users.id = friendships.user_id
JOIN comments ON comments.user_id = friendships.friend_id
WHERE users.username = 'JohnDoe';
```

**Cypher Query using Apache AGE:**
```
MATCH (user:User { username: 'JohnDoe' })-[:FRIENDS_WITH]-(friend:User)
MATCH (friend)-[:WROTE]->(comment:Comment)
RETURN comment.comment_text;
```

In conclusion, going multi-model with PostgreSQL and Apache AGE presents an exciting opportunity to embrace the power of graph databases while retaining the familiarity of SQL and relational databases. This hybrid approach allows developers to build applications that can effortlessly traverse complex relationships while benefiting from the stability and performance of PostgreSQL.
Posgresql Optimization Techniques
Tags: apacheage, postgressql, postgres
Published: 2023-07-31 16:43:35

# Effect of Cache Size

`effective_cache_size` is used for the query planner to determine how much memory is available for disk caching. 

It actually does not allocate any memory to the database, but
based on this number; the planner will decide whether enough RAM is available if index is used to improve the performance. 
Normally having this parameter to hold half  12 of the total RAM is a reasonable setting. 

More than ¾ of the total memory would lead the query planner to have a wrong estimation.

For the case of query optimization, `effect_cache_size` is an important parameter to tune. 

Next in the series is `work_mem`, another optimization parameter to consider.
Weekly AI News and Discussion Thread
Tags: ai, discuss, news
Published: 2023-07-31 16:23:24

Hey everyone, the past few months have been pretty electric in terms of advancements in AI and actual/imagined changes to our workflow and industry.

This is a regular open thread where everyone is encouraged to share...

* Notable news in the field of AI
* Personal experiences and insights
* Concerns and fears
* Success stories and demos
* And any other related discussions you'd like to bring to the table

This thread will go out every week.
Music Monday — What are you listening to? (Music from Your Twenties Edition)
Tags: watercooler, discuss, music
Published: 2023-07-31 16:19:56

_cover image source: [Giphy](https://giphy.com/gifs/cartoon-network-regular-show-boombox-qvx8tHCGkTD7Ib2SeQ)_

**A while back ago we had a [Teenage Days Edition](https://dev.to/music-discussions/music-monday-what-are-you-listening-to-tunes-from-your-teenage-days-edition-4mk3) where I asked you folks to share some of your favorite tunes from your teenage years. Playing off of that, I'd like to hear what music you all were into in your twenties. If you're still in your twenties, more power to ya... just go ahead and share what you're currently listening to! If you've yet to reach your twenties, don't fret... just let us know what you imagine you'll be listening to in your twenties hahaha! Really, it's all good if you want to step outside of this theme... just share whatever music ya like!**

![A clip from the Peter, Bjorn, and John music video for "Young Folks"... one of the cartoon characters in the music video has headphones and is bopping their head to the groove, there's a word bubble above their head saying "It's a hit"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqyh4upe503uzqo7i8sv.gif)

***

## How we do 

In this weekly series, folks can chime in and drop links to whatever it is they've been listening to recently + browse others suggestions. You can follow the suggested genre if you'd like, but don't feel confined to it; you're free to suggest whatever you wanna. 🙌  

If you're interested in having other discussions about music, consider following the aptly named [#music discussions](https://dev.to/music-discussions) organization.

{% embed https://dev.to/music-discussions %}  

***

Now, think back to those good old days and share us some tunes! _Note: you can embed a link to your song using the following syntax `{% embed https://... %}`. This should work for most common platforms!_

Looking forward to listening to y'all's suggestions! 🎶
Day 1 of my DevBlog
Tags: gdscript, pixelart, solodeveloper
Published: 2023-07-31 16:15:23

To whom this may concern,

After watching a video on how the game "Rain World" came about (https://youtu.be/6Ji2q3WQE78), I was inspired to start this blog.

After my success with a composer, I have tried to hire a few programmers over the past year, but they all have fallen off or weren't really interested in seeing this project through, so I became a solo developer.

As I mentioned, in my bio I am learning the GDScript language for the Godot engine since it seems to be beginner friendly. This blog is to track my progress and keep me motivated as I try and develop "Project ZERO".
Caption This! 🤔💭
Tags: watercooler
Published: 2023-07-31 16:14:55

It's time to once again showcase your captioning skills!

![Person in lounge chair wearing a full-body pink knit snuggly garment and drinking a glass of water through a straw.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0jhd3yujm861qj1sxzlk.png)

Follow the DEVteam for more online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
Laravel: vendor/bin/sail: No such file or directory
Tags: laravel, sail, composer, docker
Published: 2023-07-31 16:08:00

I got this error when clone an existing project from my own repository and tried to bring back with sail up:
```
sail up
sh: vendor/bin/sail: No such file or directory
```

And after that I realize that obviously I can't do that because I don't have composer dependencies installed.

So, if you don't want to use the local PHP or don't have it, you can use the following command to run a docker container with the right PHP version to install Composer dependencies.

**Run it inside you root project folder:**
```
docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v $(pwd):/var/www/html \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer install --ignore-platform-reqs
```

Done! Now you can use `sail up` without any problem.
QA Automation | TestNG
Tags: selenium, automation, testng, java
Published: 2023-07-31 15:52:17

Here I have to do:
1. Go to https://demoqa.com/
2. Сhoose "Elements"
3. Сhoose "CheckBox"
4. Expand home package and choose Notes
5. Check Notes are selected
I only could not do the last one, how can I do? what is my wrong here, I did not understand(
Daily Blog #2
Tags: dailyblog
Published: 2023-07-31 15:25:32

Today an exciting thing is happen which is 2nd round of my interview. I applied to this company through linked in, I applied to many companies through linked in but some company will not give reply and some of them will reply but they will be ghosted. I'm happy that they are considering me for 2nd round. I'm applied for the position Full stack intern, the first round was technical round which they give an question in React which is a form we need to print an error message if the form is empty otherwise print an success message. Hopefully I passed the first round and the second round which is culture round which they ask situational based questions like :
How will handle the major error while working in an project ?
Is the any situation that makes coding a job worse if it is how will you overcome it. 
How you come into coding ?
What are you expecting while working with the company ?
And after all of these they explained the work culture of the company. It was an great experience to attending this interview process. As an fresher this was not my first time attending the interview, By attending each of the interview I'm improving myself to present me in an better way, comparing with my past I can feel lot of changes happens to me.... "Learn from the mistakes" - as everybody says.
The Only pRoBleM W!TH FREELANCING IN 2023
Tags: cryptocurrency, web3
Published: 2023-07-31 15:35:52

> Devaluing markets at the cost of maintaining competition. 

* The corporate world is responsible for this trend; as most people are leaving their jobs heading elsewhere; in order to support themselves and ones they love financially.

* if the very platforms that are promising a safe haven for quitters, self-taught, business owners and entrepreneurs alike; are putting these individuals in a worse position than they started, aside from actually sourcing real clients and quality work...What does the future of freelancing look like? 

* What is the real value of gig work; how can these platforms offer options that don't feel like being on a plantation? How should the consensus respond to this inhuman way of doing business; what difference does this make from working in a sweat shop or worse? 

* As I write this I realise that, freelance platforms are some of the only places where I seen a software engineer evaluated the same as a street vendor. This is never to say vendors have no value or lack the respect or esteem regards as a software dev. Based on input of effort, it should match output of initial intent + input.  

* Am saying that: people should be recognised for their input within a collective society; but if they are being devalued for contributing the very skills and efforts into a pool of other relative individuals; how long before they leave and find other alternative? You are now noticing; the economy crumbling as I write this: most are starting to recognise their true value in regards to the real impact they have on their surroundings. 

### People are faced with the question(s):
- Do I remain limited to the devaluation of the digital space; is web3.0 only way from here onwards?

- How do I spare time to invest into my self so I can be better at what I do to make a living, instead of feeling like in a rat-race?

- What is my value actually worth in an absolute market; where relativity is subject to specific outcome?
Flying through Intro to Ruby until I hit a wall
Tags: beginners, ruby
Published: 2023-07-31 15:01:55

I did a significant chunk of the Codecademy Intro to Ruby course before Tech Prep started, and as such much of the Instructure Intro to Ruby course came pretty quickly to me. Until FizzBuzz.

I spent much longer on FizzBuzz than I'd care to admit, but I was very reluctant to ask questions about it because I felt like I wanted to push through and figure out the problems myself so that I understood both the problem and the solution better. Eventually, though, I caved a little bit and went to the Ask GPT for some help, strictly specifying that I wanted help about how to *figure out the solution* rather than just be given the solution itself. 
As I recall (I should've written this closer to when I actually did FizzBuzz), it turned out, happily, that my code was overcomplicated, and that I mostly just needed to rearrange my conditionals so that numbers that qualified for FizzBuzz rather than just Fizz or Buzz would actually be properly generated. I'm very interested to see if there might be an even more simple/elegant solution, but I'm happy with this:

```
x = 0

while x < 30
	x = x + 1
	if (x % 3 == 0) && (x % 5 == 0)
		pp "FizzBuzz"
	elsif x % 3 == 0
		pp "Fizz"
	elsif x % 5 == 0
		pp "Buzz"
	else
		pp x
	end
end
```



Similarly, the last exercise of that lesson, "Multiples", also gave me some trouble. It was easy enough to get the right outputs when the inputs were non-zero, but it took a while to figure out what to do with 0. My solution feels a little cheap/brute force to me, though, and I wonder if there's a better way to deal with a 0 input that makes more use of the concepts emphasized in that lesson. 

```
n = [3, 10, 15].sample
if n == 0
	10.times do
		pp n
	end
else
	n.step(n*10, n) do |n|
	pp n
	end
end
	
```
#TIL WebAPI: Intl.NumberFormat
Tags: programming, javascript, todayilearned
Published: 2023-07-31 15:20:12

---
title: #TIL WebAPI: Intl.NumberFormat
published: true
date: 2022-11-09 17:00:00 UTC
tags: Programming,JavaScript,TodayILearned
canonical_url: https://wojciech.space/til-webapi-intl-numberformat/
---

![Picture displaying formatted money value "123.456.79 €" in the center of picture and JavaScript logo in the bottom](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uait70rphcanonzeu2wn.png)

> The Intl object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting. The Intl object provides access to several constructors as well as functionality common to the internationalization constructors and other language sensitive functions.[^1]

Recently I found very handful function for formatting numbers, currency or units — `Intl.NumberFormat`, which formats values for given language and region.

Documentation: [Intl.NumberFormat on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat)

**Sources:**

- Image of JavaScript logotype used in thumbnail is licensed on [MIT license](https://github.com/voodootikigod/logo.js/blob/master/LICENSE), author: [Christopher Williams](https://github.com/voodootikigod).

[^1]: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl](MDN Web Docs)
Slides from CincyDeliver
Tags: community, conferences, softskills, tech
Published: 2024-01-25 20:25:23

---
title: Slides from CincyDeliver
published: true
date: 2023-07-31 14:59:40 UTC
tags: Community,Conferences,SoftSkills,Tech
canonical_url: https://barretblake.dev/2023/07/slides-from-cincydeliver/?utm_source=rss&utm_medium=rss&utm_campaign=slides-from-cincydeliver
---

For those who attended my talk on Soft Skills for Developers at CincyDeliver last Friday, here’s the slide deck. When I get some spare time, I plan to rework the talk a little and record it for YouTube, but that’s a few weeks off.

<object data="https://barretblake.dev/wp-content/uploads/2023/07/SoftSkills-CincyDeliver.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of SoftSkills-CincyDeliver."></object>[SoftSkills-CincyDeliver](https://barretblake.dev/wp-content/uploads/2023/07/SoftSkills-CincyDeliver.pdf)[Download](https://barretblake.dev/wp-content/uploads/2023/07/SoftSkills-CincyDeliver.pdf)

The post [Slides from CincyDeliver](https://barretblake.dev/2023/07/slides-from-cincydeliver/) first appeared on [Barret Codes](https://barretblake.dev).
Coding Education for All: Join us in supporting The Odin Project
Published: 2023-07-31 14:50:20

Today, we are delighted to announce a significant milestone in [The Odin Project's](https://www.theodinproject.com/) journey – we are becoming an independent and self sufficient entity.

Since 2018, The Odin Project has been financially supported by Chegg, and we are immensely grateful for the resources they have provided us.

Going forward, The Odin Project will be completely funded by community donations through [Open Collective](https://opencollective.com/). A platform designed for transparently collecting and managing funds for open-source projects just like ours. Open Collective will allow The Odin Project to secure vital financial resources directly from the community of developers and learners that benefit from the platform.

For over a decade, The Odin Project has been providing free and open-source web development courses to thousands of aspiring developers worldwide. Through our comprehensive curriculum, project-based learning, and inclusive community, The Odin Project has empowered countless learners to kickstart their careers in the tech industry.

We firmly believe that access to quality education should never be a barrier, and The Odin Project embodies this by offering a wealth of tools to anyone with the passion and dedication to learn. But to continue on this mission, we need your help!

By donating, you're not just giving financial support to The Odin Project; you're supporting people in their pursuit of knowledge and a fulfilling career. Your contributions will enable us to:

✅ Expand and enhance the curriculum to cover the latest technologies and industry best practices.

✅ Pay for the platform's hosting, improve user experience and accessibility, making it even more learner-friendly.

✅ Foster a vibrant and supportive community where learners can grow and collaborate with like-minded individuals.

🎁 Every Dollar Counts 🎁

No matter the amount, every dollar you contribute makes a real difference. Even the price of a cup of coffee can help us bring more valuable content to learners worldwide! Your generosity will ensure that The Odin Project remains free and accessible to all, providing a stepping stone for passionate individuals to launch rewarding careers in web development.

🌐 [Donate Now](https://opencollective.com/theodinproject/donate?interval=oneTime&amount=5&contributeAs=me)

If you can't donate at this time, you can still help spread the word! Share this post with your friends, family, and colleagues, and let them know about The Odin Project's mission and the impact they can make.

This journey wouldn't be possible without our amazing community. Let's celebrate this monumental step! Thank you for your continued support and passion for what we’re doing!
Building Your Coding Foundation: Where Does Your Expertise Lie?
Tags: codenewbie, beginners, discuss, career
Published: 2023-07-31 14:43:12

_Welcome to "Discover Your Code," guided by our official DEV moderator, Sloan the Sloth 🦥. This series is designed to help aspiring coders and students explore the coding universe, ignite their passion, and find their ideal career paths._

Today's question is:

> Do you see yourself as a front-end, back-end, or full-stack developer? Where does your coding journey headed?

Responses from newbies and experienced devs alike are encouraged in order to broaden our horizons and showcase different POVs.

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*