teleren/devto huggingface dataset:
Unixporn on error handling.
Tags: beginners, bash, github, linux
Published: 2022-12-17 23:55:03

Hello there 👋

After a long journey of testing different Linux desktops over the last 25 year's, i finaly landen on i3wm(gaps). I3wm is an manual tiling window manager, the "gaps" is an newer edition of i3wm.

---

Normally people like me, theme the i3wm to personal usage and share this on an reddit called **unixporn** 

To not set up all things from begin, after an crash or system switch. It is common, to save so called .dotfiles on GitHub. You can than clone this on your local machine, after a fresh install and all settings are back.

---

But, what is with the Linux installation itself? Where is the backup of this? It is really annoying to install always the same packages, type the same commands, configure services. 

So I decided, to write an own Post-Install setup (bitslixOS). This setup based on debian-net-nonfree_install and will install all packages, setup all things, clone your repo and so on. 

---

In the planing/testing phase, i noticed that's not easy to handle and read the errors. So I had done an next decision -> write an own error library. 

This is an standalon library in one file, that can be used on ANY script, simply by source the file. An preview is available on [GitHub - bash_error_lib](Https://github.com/iptoux/bash_error_lib). 

Errors will be catched by an trap, after that an entry in the log file will be done, than output on console. Because of unixporn, error output and log nice formated, as bonus, a part of source file (error) will be displayed.

The library also includes an debug output option. This can activated by var or fast option on console call.

---

Many things are to do, so please be patient.

[GitHub - bash_error_lib](Https://github.com/iptoux/bash_error_lib). 

Mfg iptoux.
A recent Perl one-liner on Linux that has Really Helped me as an IT engineer
Tags: perl, linux, beginners, programming
Published: 2022-12-17 23:42:09

Recently used Perl one-liner on Linux to replace the strings in SPVM source codes.

<b>This command is dangerous because it does replacement</b>

```
find * | grep -P '\.(spvm|c|h|xs|y|pm|pod|t)$' | xargs perl -pi -e 's/descriptor/attribute/g'
```

## For Programming Beginners

`find *` searches all files except for hidden files in the current directory.

`|` is the pipe.

`grep -P '\.(spvm|c|h|xs|y|pm|pod|t)$'` extracts files of the specific extensions.

`xargs` passes each file from the pipe as an argument of the command and executes the command.

`perl -pi -e 's/descriptor/attribute/g'` replaces all `descriptor` with `attribute`.
5 Steps to Build a Huge Twitter Audience
Tags: community, devjournal, productivity
Published: 2022-12-17 22:04:28

As a developer, having an online presence on Twitter is more important than ever. It can change your life and help you achieve your goals more easily. By having a large following, you can sell your SAAS products and info products, get traffic to your website, get clients if you work as a freelancer, and do affiliate marketing. Here are 5 steps to improve your Twitter audience:

**Comment on other's posts**: At the beginning of your journey on Twitter, start by commenting on other people's posts, especially those from big accounts. Write good comments that provide value and add meaning to the post. When followers read your comment, they will visit your profile to see your timeline.

**Make a clean timeline**: Avoid re-posting other people's content because people will follow you if they see that you create and publish original content. Re-posting isn't good at the beginning. on other hand, use images, emojis, and videos in your posts to make your profile more attractive.

**Write valuable content**: Write content that provides value to people and present it as threads on Twitter. Followers like reading threads a lot because they save them and go back to them when they need them.

**Be consistent**: Being consistent is the key to building an online presence. Publish useful content every day and don't stop because the Twitter algorithm supports regularly posted content. People also love developers who post useful content every day . Being consistent is hard at first, but after you build this habit, you'll enjoy it.

**Be credible**: In addition to be consistent, credibility is the most important factor in getting a lot of followers. Provide your audience with content that is valuable, helpful, and useful. Don't spam or publish a lot of ads.

Overall, the more you create valuable and useful content, the more you will grow your online presence, which will help you get more opportunities and achieve your goals more easily.
ㄥ8Ɩ llǝɯS ǝpoƆ - spɹɐʍʞɔɐq ǝslƎ/ℲI
Tags: webdev, javascript, beginners, programming
Published: 2022-12-17 21:57:08

*The first thing we read after the if the condition is the IF*

> TL;DR: You have the important else condition on the else.

# Problems

- Readability

# Solutions

1. Swap the conditions.

# Context

It is not as straightforward as it appears to write IF clauses in an elegant manner.

There are lots of variants and choices. 

We need to pay special attention to readability.

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/7f2c51762feac4966f03df57f57db76f)
```kotlin
fun addToCart(item: Any) {
    if (!cartExists()) {
        // Condition is negated
        this.createCart();
        this.cart.addItem(Item);
        // Repeated Code
    }
    else {
        // Normal case is on the else clause
        this.cart.addItem(Item);
    }
}

```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/b804c849ea5ac33be4e27abe929837c1)
```kotlin
fun addToCart(item: Any) {
    if (cartExists()) {
        this.cart.addItem(Item);
    }
    else {      
        this.createCart();
        this.cart.addItem(Item);
    }
}   

fun addToCartShorter(item: Any) {
    if (!cartExists()) {
        this.createCart();
    }
    this.cart.addItem(Item);    
}
```

# Detection

[X] Semi-Automatic 

We can find negated expressions on IF conditions and check for this anti-pattern.

# Tags

- IFs

# Conclusion

We need to read code like prose.

Humans read the standard case first and the exceptional one after it.

# Relations

{% post https://dev.to/mcsee/code-smell-51-double-negatives-4fh0 %}

{% post https://dev.to/mcsee/code-smell-156-implicit-else-1ko3 %}

# More Info

- [Know the Code](https://knowthecode.io/if-else-backwards-code-pattern)

# Disclaimer

Code Smells are just my [opinion](https://dev.to/mcsee/i-wrote-more-than-90-articles-on-2021-here-is-what-i-learned-1n3a).

# Credits

Photo by [Karol Kasanicky](https://unsplash.com/@karolkas) on [Unsplash](https://unsplash.com/s/photos/upside)
    
* * *

> Beauty is more important in computing than anywhere else in technology because software is so complicated. Beauty is the ultimate defense against complexity.

_D. Gelernter_
 
{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}
How to add robots.txt to Next.js Application
Tags: nextjs, javascript, webdev, programming
Published: 2022-12-17 20:12:25

## What Is A Robot.Txt File?

Webmasters build robots.txt files to instruct web robots (typically search engine robots) on how to crawl pages on their domain. The robots.txt file is part of the robots exclusion protocol (REP), which is a collection of online rules that regulate how robots navigate the web, access and index content, and serve it to humans. The REP also includes meta robots directives and page-, subdirectory-, or site-wide instructions for how search engines should understand links (such as "follow" or "nofollow").

Including a robots.txt file in your Next.js application.
Previously, you had to build a server.js file as well as a new path pointing to the robots.txt file. But not in the latest edition! You can store your robots.txt file in the public directory in the most recent version of Next.JS. The public directory is meant to take the place of the static directory.

At the root domain level, everything in the public directory will be viewable. As a result, the URL for the robots.txt file would be /robots.txt rather than /public/robots.txt.

If you want to learn more about how to add a robot.txt file in next.js  then visit our blog for a step-by-step explanation. 
 {% embed https://www.thesimplifieddev.com/how-add-robot.txt-file-in-next.js-app %}
Thank you all✨
Tags: blog, gratitude, proud, discuss
Published: 2022-12-17 20:11:51

**Wow a 100 followers already :o** 

I was hesitant to start writing blogs for about two months but after giving it a lot of thought, I realized that it was a win-win situation. Not only I’m gaining more knowledge by writing and documenting but I’m also sharing it with the community. 

I started 10 days ago and it seems to be going pretty well so far:) 
(I publish every Monday)

For those who don’t know me, I’m Kelsy, just your average 21y/o guy who’s also a self-taught front-end dev. 

Anyway, I just wanted to give a huge thanks to all of my new followers:) You are all awesome!

**Thanks for your time and Merry Christmas** ✨🎄🎅
How I stay productive and healthy during home office
Tags: workfromhome, webdev, softwaredeveloper, wfh
Published: 2022-12-17 20:09:53

Hi,

Covid19 and the lockdown hit us really hard and has made workplace more challenging than we could anticipate. While for some home office has it’s perks, for others it has some daunting effect on health and work-life-balance. By now most of us thought things would be back to where it used to be. But it seems like home office or at least hybrid work is here to stay

In this article I’ll share 6 tips of how you can stay fit even when working at home.


1. Simulate that you go to work
Dress up like you normally would. Then go out of your house. Walk around your house and then go back to your house and start working. This will trick your mind that you are going to your actual office to work. It also gets your blood flowing and you’ll be more active when you start working.

2. Take breaks
When there’s a lunch break go to lunch. Don’t work through the breaks and postpone your meals. Otherwise this will have detrimental effects on your body — especially if you are a little older like me. Also make small breaks once in a while during work. It’s important to take breaks throughout the day to recharge and refocus. This can be as simple as getting up to stretch or going for a short walk.

3. Take care of yourself
Working from home can be demanding, so it’s important to take care of yourself. Make sure to eat healthy meals, get regular exercise, and get enough sleep. You probably sit longer than usual. So, it’s important to stretch your body. This will help you stay focused and productive.

4. Create a dedicated place for you to work
Those with small rooms decorate your table. At least make it distinguishable between work and normal life. Choose a quiet, clutter-free space in your home to serve as your office. Having a dedicated workspace can help you stay focused and avoid distractions.

5. Log out
I found out I worked more when being in home office. Because there is only a short distance to my workplace. Even when work is done and dinner is ready, I would constantly think about work, because it’s so close. So, my advice is, once your daily work is done, log out. Log out also mentally. Don’t think of work, once work is done.

6. Stay connected with others
Working from home can sometimes feel isolating, so it’s important to stay connected with your colleagues. Use video conferencing tools to have regular meetings, and make sure to communicate regularly through email or instant messaging. Even if you are an introvert (like me), stay connected. Inform yourself about the latest information in your organisation. Set up an appointment at lunch to video chat. It helps you not only to keep in touch with your co workers but with your work so you won’t become detached from it. Maybe even schedule a meeting with one of them once in a while (but bear the personal distance in mind)

What has been your experince with working from home? Do you have any tips that made your life easier when working from home? Please share and comment below.
Getting Started with Tekton Pipelines: A Comprehensive Guide
Tags: kubernetes, tekton, cicd, community
Published: 2022-12-17 19:53:36

Tekton Pipelines is an open-source project that provides a cloud-native, Kubernetes-based pipeline system for continuous integration and delivery (CI/CD). In this post, we will explore what Tekton Pipelines is, why it is useful, and how to get started using it for your CI/CD workflow.

**What is Tekton Pipelines?**

Tekton Pipelines is a flexible and extensible CI/CD system that is designed to run on top of Kubernetes. It is based on the Kubernetes resource model and uses custom resource definitions (CRDs) to define pipeline tasks and workflows.

One of the key benefits of Tekton Pipelines is that it is designed to be easy to use and integrate with other tools and systems. It has a rich set of pre-built integrations and a plugin system that allows you to extend its functionality with custom components.

**Why Use Tekton Pipelines?**

There are several reasons why you might want to consider using Tekton Pipelines for your CI/CD workflow:

It is cloud-native and runs natively on Kubernetes, which makes it easy to deploy and scale.
It has a simple, declarative syntax for defining pipelines, which makes it easy to understand and maintain.
It has a rich set of built-in integrations and a plugin system that allows you to extend its functionality with custom components.
It is designed to be flexible and extensible, allowing you to customize and tailor your CI/CD workflow to your specific needs.
Getting Started with Tekton Pipelines

To get started with Tekton Pipelines, you will need to have a Kubernetes cluster set up and have the kubectl command-line tool installed on your local machine.

Install Tekton Pipelines: To install Tekton Pipelines, you can use the tkn command-line tool. You can download the tkn binary from the Tekton Pipelines releases page (https://github.com/tektoncd/pipeline/releases) and add it to your PATH, or you can install it using a package manager like homebrew (on macOS) or scoop (on Windows).

Create a pipeline resource: A pipeline resource defines a set of tasks that are executed in a specific order. To create a pipeline resource, you can use the tkn pipeline create command and specify the name of your pipeline and the tasks it should contain.

Run your pipeline: Once you have created a pipeline resource, you can run it using the tkn pipeline start command. This will trigger the execution of the tasks in your pipeline and provide real-time updates on their progress.

**Conclusion:**

Tekton Pipelines is a powerful and flexible CI/CD system that is designed to run on top of Kubernetes. By following the steps outlined in this post, you can get started using Tekton Pipelines to automate your CI/CD workflow and streamline your software delivery process.
Angular Universal with Standalone Component
Tags: angular, javascript, webdev, ssr
Published: 2022-12-17 19:52:32

With the arrival of Standalone Component with Angular 15, it is now possible to do without `@NgModules` entirely. This opens the door to new possibilities.

It is now possible to bootstrap an Angular application by providing an entry point component with a list of providers in the `main.ts` : 

```ts
bootstrapApplication(AppComponent, {
  providers: [
    provideAnimations(),
    provideRouter(routes)
  ]
})
```

However, with this new approach, it is not yet possible to simply take advantage of the server side rendering (SSR) with Angular Universal because the function `ngExpressEngine` only takes a module parameter and not a component:

```ts
import express from 'express';
import { ngExpressEngine } from '@nguniversal/express-engine';

const app = express();

// Set the engine
app.engine(
  'html',
  // Bootstrap and render NgModule with express adapter for `@angular/platform-server`
  ngExpressEngine({
    // Take a module but we would like to provide component
    bootstrap: ServerAppModule
  }),
);

app.set('view engine', 'html');

app.get('/**/*', (req: Request, res: Response) => {
  res.render('../dist/index', {
    req,
    res,
  });
});
```

On the other hand it is possible to use manually the render function provided by `@angular/platform-server`. 
This forces us to redo the work done by Angular Universal inside `ngExpressEngine` but it's the only possibility while waiting for the support of standalone component  :

```ts
import express from 'express';
import type { Request, Response } from 'express';
import * as fs from 'fs';
import { renderApplication } from '@angular/platform-server'

const app = express();

app.engine('html', async (path, options, callback) => {
    const document = fs.readFileSync(path, 'utf-8')
    const { req } = { ...options } as {req: Request, res: Response};

    // Bootstrap and render a Standalone Component 
    const html = await renderApplication(AppComponent, {
      appId: 'server-app',
      document: document,
      url: `${req.baseUrl}${req.url}`,
      providers: [
        provideRouter(routes),
      ]
    });
    callback(null, html)
});
app.set('view engine', 'html');

app.get('/**/*', (req: Request, res: Response) => {
  res.render('../dist/index', {
    req,
    res,
  });
});
```

Thanks to the function `renderApplication`, it is possible to bootstrap an Angular component and render it on the server side while waiting for the full support of Standalone Component in Angular Universal with the provided function `ngExpressEngine`.
Assembly line simulation in Python
Published: 2022-12-17 19:25:35

In simulation engineering for production and supply chain planning I encounter many commercial simulation tools and commercial software licenses. But, as I have pointed out frequently, supply chain analysts and operationan excellence managers must not rely on commercial tools. This is especially true for smaller project scopes and simple animation requirements. 

## Exemplary assembly simulation tool
Below is a screenshot from a assembly line simulation and animation that I implemented in Python using SimPy and Tkinter.

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

The upper manufacturing line operates at a higher throughput rate and shorter cycle time, operating nearly at twice the speed of the lower assembly line with integrated part manufacturing.

Machine 24 produces parts that are then inspected in-line. Parts are then automatically collected in a container that, once full, is stored on a pallet. The pallet acts as a buffer since part manufacturing on machine 24 operates at a (significantly) shorter cycle time than part manufacturing on machine 57.


Machine 57 produces base parts onto which parts produced by machine 24 are assembled. Some other smaller parts are assembled onto the base parts first, happening in line and without delaying the cycle time of machine 57. Parts used for assembly, manufactured at machine 24 are then assembled onto the base part. The assembly is then placed into the foil machine where it is foiled and subsequently packaged into boxes. These boxes are then stacked onto pallets and eventually shipped to the customer. When the buffer pallet at the end of machine line 24 is full, machine 24 is shut down and the parts buffered onto the pallet are now used for the assembly operation on the lower assembly line.

## Technology stack used for assembly line simulation
The assembly line simulator is a Python tool and developed as a Python framework that consumes existing Python frameworks for discrete-event simulation and animation. Most importantly, the framework developed consumes Tkinter and SimPy in Python. SQLite and MySQL databases can be integrated into the tool if desired by the user. For most applications this is however not necessary.

You can learn more about this tool by reading the following publication: [SCDA assembly line simulation tool](https://www.supplychaindataanalytics.com/assembly-line-simulation-and-line-balancing/)

## Related content
If you are interested in using free tools in Python and R for discrete-event simulation modeling you might want to check out my poultry supply chain simulation example: [End-to-end poultry supply chain simulation](https://www.supplychaindataanalytics.com/end-to-end-poultry-supply-chain-simulation/
)
How to create your own Laravel packages
Tags: opensource, laravel, php, laravelframework
Published: 2022-12-24 20:00:07

---
title: How to create your own Laravel packages
published: true
date: 2022-12-17 19:38:33 UTC
tags: opensource,laravel,php,laravelframework
canonical_url: https://blog.devgenius.io/how-to-create-your-own-laravel-packages-2b68da22506a
---

[![](https://cdn-images-1.medium.com/max/2600/0*Qp4mSWW9a1S6TOuG)](https://blog.devgenius.io/how-to-create-your-own-laravel-packages-2b68da22506a?source=rss-17217f29618a------2)

Laravel creates an admin panel from scratch — Part 18

[Continue reading on Dev Genius »](https://blog.devgenius.io/how-to-create-your-own-laravel-packages-2b68da22506a?source=rss-17217f29618a------2)
Data Preprocessing
Tags: datascience, beginners, machinelearning, python
Published: 2022-12-17 19:27:09

What is Data Pre-processing?
"Data Preprocessing is a process of converting your raw data into suitable form."
Data Preprocessing Steps Involves
1:Getting Dataset
2:Importing Libraries
3:Importing Datasets
4:Finding Missing Values
5:Encoding Categorical Data
6:Splitting Dataset into Training & Test Set
7:Feature Scaling
Animated Doritos Landing Page
Tags: javascript, css, showdev, webdev
Published: 2022-12-17 19:08:32

Who doesn't love Doritos? I LOVE IT! Well, except the spicy ones. As you can see, the theme of this project is an animated landing page for none other than Doritos!

We are happy to share this [project](https://github.com/blueycode/animated-doritos-landing-page), which may be good content for those looking to improve their skills in web development.

To build this landing page, we used HTML, CSS, and JavaScript. As for the animations, we used anime.js, which is a JavaScript animation library.

Likewise, keep in mind that the entire development process was recorded (a 2-hour-long video 😱) and is available on my YouTube channel. The [video](https://www.youtube.com/watch?v=wq4ZCvMiyfA) covers the project setup all the way to pushing it live on GitHub pages. Check it out!

As always, any feedback is appreciated.
How to Compare Dates in Oracle
Tags: oracle, database, datatypes
Published: 2022-12-17 18:22:48

---
title: How to Compare Dates in Oracle
published: true
description: Comparing Dates Oracle
tags: #oracle #databases #datatypes
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-12-17 18:20 +0000
---
Let's take an overview of the Oracle date data types and see how to compare dates using the TO_DATE() function, the TRUNC() function, or a date/timestamp literal. The article also describes how to change the date format using the ALTER SESSION statement - https://www.devart.com/dbforge/oracle/studio/comparing-dates-oracle.html
![Comparing Dates Oracle](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovateen1g300w5dm5vrf.png)
The Surprising Power of MongoDB's Limit(0) Method
Tags: mongodb
Published: 2022-12-17 18:19:31

The `limit()` method in MongoDB allows you to specify the maximum number of documents that should be returned in a query result. By default, the `limit()` method returns all documents in a collection.
But what if you use `limit(0)`?
Instead of returning 0 records, it will return all the records present in the collection.

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


This happens because MongoDB treats 0 in `limit()` as `infinity`.