teleren/devto huggingface dataset:
man pages
Tags: beginners, programming, terminal, tutorial
Published: 2023-10-06 16:55:32

man pages or the manual pages is a documentation for commands installed on the system. Each command may or may not come with its manual page. The manual page describes the usage of the command and list all the options(operands) you can use on that command.  You can type an option followed by hyphen(s) after the command to change the behavior of that command.

Lets open the manual page for the command `ls`

`nuclearegg69@zenbook-f13:/var$ man ls`

`less` program will run and display the contents of the `ls` manual page

![Alt text](https://cdn.hashnode.com/res/hashnode/image/upload/v1696611140212/f306773c-61e1-49c5-8bc0-213e62a895fc.png)

first you will notice `(1)` afte ls at the first line. 1 indicates that this manual page is part of section 1 of the manual pages. Man pages is classified into 9 sections. You can learn more about them if you did `man man`



`nuclearegg69@zenbook-f13:/var$ man man`

As quoted from the manual page of man command


```
The table below shows the section numbers of the manual followed by the types of pages they contain.

       1   Executable programs or shell commands
       2   System calls (functions provided by the kernel)
       3   Library calls (functions within program libraries)
       4   Special files (usually found in /dev)
       5   File formats and conventions, e.g. /etc/passwd
       6   Games
       7   Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7), man-pages(7)
       8   System administration commands (usually only for root)
       9   Kernel routines [Non standard]```

```

So the first section is about executables including shell commands. `man`, `less`, `ls` are executables or shell commands.

### How to read the synopsis?

```
SYNOPSIS
SYNOPSIS
       ls [OPTION]... [FILE]...
```

`[]` brackets means that whatever is inside of them is optional. 
`OPTION` means any option -a, -h, -l so any option is optional
`FILE` means any object so a file or directory or other objects
`...` means or more so you can add 0 or more options to ls, 0 or more objects 

### How to navigate less

`q` to exit the less program of man
`up and down arrows` up and down a line
`b or ^B` back one view page
`f or ^F` forward one view page
`/` forward slash to search forward
`?` to search backward
Material Theme Builder - Beer CSS Tips #3
Tags: css, tutorial, themes, html
Published: 2023-10-06 16:46:41

Hello,

I want to share a serie of posts containing some tips of Beer CSS. Beer CSS is a new framework around, based on (not restricted to) Material Design 3. Material Design 3 is a design system created by Google. In this post, we will learn about material builder theme. To generate your material theme is very simple.

1) First, go to the colors section of homepage.

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

2) You can change the mode to light/dark, select a color or upload an image.

3) You can get all CSS variables from current theme, after click on "<>" icon.

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

Hope you enjoy this article. Thanks for read!

Beer CSS:
https://www.beercss.com

Material Design 3:
https://m3.material.io/
How to delete files in the terminal safely
Tags: cli, terminal, beginners, tutorial
Published: 2023-10-06 16:44:56

To mitigate the problem of deletion by mistake. Two options were introduced to the `rm` command

`-i` option shows an interactive prompt asking you if you want to delete that item, for several items or a folder it will ask for every file and folder if you want it to be deleted.

`-I` option is less intrusive and will ask only if you were to delete more than 3 files or a folder and it will give only one prompt for all.

Try it and tell me what you think.
Can Sealed Interfaces in Java Improve Code Security?
Tags: beginners, programming, java, tutorial
Published: 2023-10-06 16:42:11

In the field of software development, security and robustness are of utmost importance to protect against potential vulnerabilities.

Sealed interfaces in Java17 are a simple & powerful way to enhance code security.

In our previous blog post, We covered the concept of [Sealed Classes](https://dev.to/birajdar/java17-sealed-classes-4pl4). Now, it's time to turn our attention towards sealed interfaces & how they improve code security. But before that, you must have an idea about what an interface is.

In Java 17, sealed classes and sealed interfaces share similar rules and behavior.

Like sealed classes, to seal an interface, add the `sealed` keyword to it's declaration. After "extends" statement, include a `permits` clause _(If there are no "extends" statements, you can skip that part)_. `permits` clause tells which classes are allowed to implement this sealed interface and which interfaces can extend it. 

When an interface is marked as sealed, any class or interface attempting to implement or extend it must be listed in the permits clause of the sealed interface. Otherwise, it will result in a compilation error.

This way, you control who can work with your interface, ensuring everything stays well-organized and secure.

## syntax
```java
public sealed interface Interface_Name permits Subinterface1, Subinterface2, ... {
    // Interface members and methods
}
```

## example
```java
sealed interface Color permits Red, Green {
    default void display() {
        System.out.print("This is Color interface");
    }
}
```

This Java code defines a sealed interface named "Color" that permits implementation by the interface "Red" and the class "Green". It includes a default "display()" method which prints "This is Color interface" when called.

```java
non-sealed interface Red extends Color {
    default void show() {
        System.out.println("This is Red interface");
    }
}
```
This code defines a non-sealed interface named "Red" which extends the "Color" interface. It includes a default method "show()" that prints "This is Red interface" when called.

```java
final class Green implements Color {
    public void play() {
        System.out.println("This is Green class");

    }
}
```

The code defines a final class named "Green" which implements the interface "Color". It includes a method "play()" that prints "This is Green class". The use of final means that "Green" class cannot be subclassed or extended further.

## Code Execution
```java
public class Main {
    public static void main(String[] args) {
        Color obj2 = new Green();
        obj2.display();

    }
}
```

## Output

```
This is Color interface
```

Records can be used with Sealed Interfaces. In our next blog post, we'll explore what a record is and how records and sealed interfaces work together. Gear up for an exciting exploration of these Java features! Stay tuned!
Data integrity with validations
Published: 2023-10-06 16:28:15

Here I addresses the issue of data integrity and validation in a Ruby on Rails application. Prevent invalid data from getting saved into the database, and reducing the need for defensive coding.

# Invalid Records
Invalid records could can come from due user input, CSV imports, API calls, etc.

# Defensive Code
Defensive coding gets inefficient.

# Data Integrity with Validations

ActiveRecord enforces data integrity by providing validations. They prevent the `.save` method from executing if the record is invalid, returning `false` instead of `true`.

# Common Validators
- Presence: ensures a value is present before saving.
- Uniqueness: ensures that the value is unique across the table.

# Conclusion
ActiveRecord validations efficiently enforce data integrity at the model level. This reduces the need for defensive code in the views or controllers. Instead of fixing data-related issues at the view level, enforce correct data at the model level. This makes the application more robust and maintainable. [Official Rails Guide on validations](https://guides.rubyonrails.org/active_record_validations.html).
Writing a new feature
Tags: osd600
Published: 2023-10-06 16:15:26

This week, I worked on enhancing our classmates' projects. Specifically, my task was to add a -c --config option for reading TOML config files to this [project](https://github.com/Rachit1313/txtToWeb).


I began by creating an [issue](https://github.com/Rachit1313/txtToWeb/issues/11), followed by drafting a [PR](https://github.com/Rachit1313/txtToWeb/pull/12). I gradually made incremental changes to implement various features. I also asked the project owner for feedback and adjusted my PR accordingly.

I enjoyed working with Git and even learned how to cherry-pick commits from different branches. The only issue I encountered was forgetting to switch from the main branch. Consequently, I had to create a new branch, revert changes on the main branch, switch to the issue branch, and cherry-pick the changes there. 

Overall I enjoyed using git and eager to learn more about different things I can do with it.
vite:import-analysis] Failed to parse source for import analysis
Tags: vite, svelte
Published: 2023-10-06 16:14:16

I am totally new to Vite. I have been following a Svelte tutorial on Laracasts and have got the below code from that. If anybody can see why I am getting this error, I really would appreciate your help. Many thanks!!

I setting up a test app, I am getting this strange error:

```
[plugin:vite:import-analysis] Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
```

The error is pointing to this in my App.svelte:

```
<script>
  export let name;
</script>
```

My index file calls main.js

```
<script type="module" src="./js/main.js"></script>
```

I am importing from main.js:

```
// Import our custom CSS
import '../scss/styles.scss'

// Import all of Bootstrap's JS
import 'bootstrap'

import App from "../App.svelte"

const app = new App({
target:document.body,
props:{
    name:'world'
}
});

export default app;
```

My package.json:

```
{
  "name": "svelte",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "vite",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "bootstrap": "^5.3.2",
    "vite": "^4.4.11"
  }
}
```
My Adventure with Open Source and Node-TILify
Published: 2023-10-06 16:12:16


### Dive into Open Source

Ever felt the excitement of diving into something new? That's exactly how I felt when I decided to chip in and contribute to an open-source project named **Node-TILify**. This tool, built using Node.js, helps users convert text files into HTML. It already had a bunch of cool features, and I thought of adding a new one: allowing users to specify their options in a TOML configuration file.

### Coding: One Step at a Time

Diving into someone else's code is a bit like reading their diary. It's personal, and you tread carefully. I spent some time getting to know the structure of the tool, the patterns, and the existing features. Once I felt comfy, I rolled up my sleeves and began integrating the TOML feature.

Instead of doing everything at once, I took it step by step. I'd add a piece, test it out, and tweak things if needed. This piecemeal approach made the task feel manageable and fun.

### Dancing with Git

Now, if you've ever worked on a shared project, you know that it's not just about the code. It's also about managing versions, changes, and making sure everything fits together nicely. This is where git comes in.

Working on **Node-TILify** meant syncing my work with the main project. I made sure to keep my copy updated, so everything would blend well when I was ready to share my changes.

### A Few Takeaways

1. **Learning is Fun**: Every codebase has its rhythm, and understanding it feels rewarding.
2. **Communication Matters**: Touching base with the main contributors or project maintainers helps keep things smooth.
3. **Git is a Lifesaver**: Keeping track of changes and ensuring everything merges well is essential, and git makes this a breeze.

### Wrapping Up

This experience was a lot of fun and super enlightening. It's like working on a communal art project where everyone brings in their colors and strokes, and in the end, you have this beautiful painting. I'm eager to hop onto another open-source adventure soon. If you've been thinking about it, give it a shot! It's a delightful journey.
Debugging the Umbraco source code for specific version
Tags: umbraco
Published: 2023-10-06 16:11:27

Today I had to debug the Umbraco source code to pinpoint a [performance issue](https://github.com/umbraco/Umbraco-CMS/issues/14936).

I already had a backup of the umbraco database from our live environment restored on my local machine.

Normally when I contribute to the Umbraco CMS, I work on my own fork on the [contrib ](https://github.com/umbraco/Umbraco-CMS/tree/contrib) branch before creating a pull request.

Problem is that I had to debug Umbraco 10.6.1 and the contrib branch is already V12.x. There is [v10/dev](https://github.com/umbraco/Umbraco-CMS/tree/v10/dev) branch, but that is already running Umbraco 10.7.x

Luckily Umbraco tags all the releases on github so I went ahead and downloaded the source code for [v10.6.1](https://github.com/umbraco/Umbraco-CMS/releases/tag/release-10.6.1)

I followed the steps to get up and running from the [documentation](https://github.com/umbraco/Umbraco-CMS/blob/release-10.6.1/.github/BUILD.md).

From a command line I did the following to build the front end code :

```
cd src\Umbraco.Web.UI.Client
npm install
npm run dev 
```
This succeeded without issues.

Then I tried to build and run the CMS from a command line as described in the documentation :

```
dotnet watch --project .\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj
```
But here I ran into a issue.

I saw the following errors in my console :

`error MSB4044: The "GetUmbracoBuildVersion" task was not given a value for the required parameter "Git CommitIdShort".
`
When building the source code on my forked repository I don't see this error.

This is because Umbraco is using [GitVersion](https://github.com/GitTools/GitVersion) for semantic versioning.
This requires a git repository and at least one commit. When you just download the code you don't have a git repository.

This was easily fixed by running the following commands :

```
git init
git add .
git commit -m "initial"
```
After that I could run the CMS without any issues.

So I hope this helps you when you run into this issue.
Pokémouille - A modern Pokédex (part 5)
Tags: webdev, javascript, opensource, beginners
Published: 2023-10-06 15:43:38

Helloeveryone! Welcome to part 5 of the devlog for Pokémouille, an open-source Pokédex website I've been working on since April, using SvelteKit, I've worked quite a bit on Pokémouille since last time so let's get into it right away. 
As usual you can find the repo right here: https://github.com/Vaalley/pokemouille

#UI improvements
We're now using SkeletonUI with the Crimson theme for the UI and I have to say the website looks much better, and SkeletonUI comes with a very easy to setup dark/light mode switcher which we're now using.
Now we're using a custom SkeletonUI theme (will probably be replaced in the future), I also updated SkeletonUI to v2.

#Mobile Support
I finally added mobile support to Pokémouille, every page is responsive, it can definitely be improved upon, but it's a good base and as totally usable.

#Items
You can now search for items and view informations about what they do, their prices etc... (berries included)

#What's Left To Do?
A ton:
-UI/UX Improvements everywhere
-I also got the idea of having a much nicer looking Pokémon Showdown clone, I think it could be really fun to work on, but also a crazy amount of work
-Multi language support
-And probably a lot more I forgot!

#Join the Pokémouille Development!
Pokémouille is looking for contributors of any kind at any skill level, so if you're interested feel free to take a look at the Github repo (link at the top of the post), the project is open-source and under licensed under MIT which means it's all about collaboration! If you know anyone who'd be interested in working on the project I'd appreciate it if you were to share this project with them!

Thanks for reading and have a good day :)
My First Repo as a Maintainer for #Hacktoberfest 🥳
Published: 2023-10-06 15:42:00

I made my FIRST maintainer repo 🥳 [here](https://github.com/omicreativedev/hacktoberfest2023) so I can learn how to maintain a repo for #Hacktoberfest and the future.

The project is a simple free website template I made with a theme switcher. It's very basic and meant to help my friends who never coded before have a place to practice where everything is intuitive after taking a small course like freecodecamp. There are no code, low code, documentation, and gfx/ux opportunities.

Mentors and contributors welcome! Teach me the way!!!

I'm also hoping to gain 200 stars so syndication sites pick up my repository.⭐

Please consider this an opportunity to teach me along the way.

I will be posting about what I learned maintaining my first Hacktoberfest repo.
[Digest] Java, Kotlin, Spring, Cloud, and More - Episode 13
Tags: digest, java, spring, cloud
Published: 2023-10-06 15:38:50

Hey folks, here is what I found interesting this week.

🌱 [All together now: Spring Boot 3.2, GraalVM native images, Java 21, and virtual threads with Project Loom](https://spring.io/blog/2023/09/09/all-together-now-spring-boot-3-2-graalvm-native-images-java-21-and-virtual): now we can create native Spring Boot app on GraalVM! Waiting for Spring Boot 3.2.

⏱️ [More falsehoods programmers believe about time](https://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time): "Months have either 28, 29, 30, or 31 days;" "The day before Saturday is always Friday;" and more fallacies about time that may lead to errors in applications.

⏱️ [Storing UTC is not a silver bullet](https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/): another nice post about time: storing everything in UTC is not always a good solution.

💾 [State of Database Survey](https://stateofdb.com/databases): survey results about 42 databases: what people are using, preferences, and ratings.

⚙️ [Death by a thousand microservices](https://renegadeotter.com/2023/09/10/death-by-a-thousand-microservices.html): yet another post on microservices - should a good system really be that complex?

---

*Dream your code, code your dream.*
Python - Use Generators for Memory-Efficient Iteration
Tags: python, programming, tutorial, beginners
Published: 2023-10-06 15:30:00

In Python, generators are a powerful tool for creating iterators that allow you to iterate over large datasets or sequences without loading everything into memory at once. They are particularly useful when dealing with data streams, large files, or when generating an infinite sequence.

To create a generator, you define a function using the `yield` keyword instead of `return`. When the function is called, it returns a generator object that can be iterated over using a `for` loop or by using functions like `next()`.

Here's a simple example of a generator that yields squares of numbers:

```python
def generate_squares(n):
    for i in range(n):
        yield i ** 2

# Using the generator in a for loop
for square in generate_squares(5):
    print(square)
```

Generators are beneficial because they:

1. **Save Memory**: Generators produce values one at a time as needed, so they don't store the entire sequence in memory. This is particularly useful when working with large datasets.

2. **Lazy Evaluation**: Values are generated lazily, which means computation only occurs when you request the next value. This can lead to faster startup times and more efficient resource usage.

3. **Infinite Sequences**: You can use generators to create infinite sequences, like an infinite stream of numbers, without running out of memory.

4. **Easy to Implement**: Creating generators is often more straightforward than implementing custom iterable classes.

5. **Cleaner Code**: Generators can lead to cleaner and more readable code when dealing with iteration and transformation of data.

Keep in mind that once a generator is exhausted (i.e., all values have been iterated), you cannot iterate over it again. If you need to reuse the data, you should regenerate the generator.

Generators are a valuable tool in Python for managing memory efficiently and working with large or continuous data streams. They are particularly handy when dealing with data processing tasks that involve reading or generating data on the fly.
Binary Tree
Tags: webdev, beginners, programming, javascript
Published: 2023-10-06 15:17:26

Given that its spooky season, I thought it would be a good idea to write a post about the scariest thing I could think of 
                             -- 

                      **Binary Trees**

As a beginner, I've googled my little heart out trying to find what the most complex white boarding challenges consist of for job interviews. Fingers crossed, if I ever get a call back, the only type of technical assessment will be in the form of a take home project. But assuming Google calls tomorrow, I want to be prepared to not only understand what a binary tree is, but also how data structures and algorithms work together as a whole. And you should too. Hence the blog post. 

**What is a binary tree? **

'A binary tree is a hierarchical data structure used in computer science. It consists of nodes, where each node has at most two child nodes, referred to as the left child and the right child. The top node is called the root, and it branches downward into various levels, with each level containing nodes that are connected in a binary fashion. Binary trees are widely used for tasks like searching, sorting, and organizing data efficiently.'

Did your brain just go ERROR 404 on you after reading that? Mine did the first time I read a definition like that. I know what you're thinking. "I just want to change the background color on buttons and get paid $90,000 a year to do it. What does this have to do with anything?". Again, I feel you there. But here's the point, understanding How data structures and algorithms work will set you a part from the crowd. 

**Lets try an easier to understand definition.**

A binary tree is like a family tree, but with a special rule: each person (or "node") can have at most two children, typically called left and right. It starts with one person at the top, called the "root," and branches down into more people as you go lower. This tree structure is often used in computers to organize and find data efficiently, like a phone book where you can quickly look up names because they're sorted in a particular order. Each person in the tree helps organize the information, making it easy to find what you're looking for. 

Starting to make more sense? A binary tree is a data structure. How it ties in to BigO notation is probably for a different blog post, but I think I might make a series on this. 

I hope this gave you at least a basic understanding of what a binary tree is. Its not as scary as they make it sound.