teleren/devto huggingface dataset:
गणपति बप्पा के आगमन के इस पवित्र मौके पर, Gomium की ओर से आपको खुशियों और प्यार से भरपूर गणेश चतुर्थी की शुभकामनाएं!
Published: 2023-09-19 11:57:41


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/drjjco2l85o1ncruzpja.png)
💡 JavaScript Hack: Conditionally Add Properties within Objects
Tags: javascript, typescript, node, react
Published: 2023-09-19 11:47:06

🚀 Attention JavaScript Enthusiasts! 🚀

Are you tired of writing lengthy code to conditionally add properties to JavaScript objects? 😫 I've got an elegant shortcut for you that will not only simplify your code but also make it more readable and maintainable! 🤓✨

**Traditional Approach:**

Let's say you're working on a finance app, and you want to create an object representing a financial transaction with properties like `transactionType`, `amount`, and `date`. However, not all properties are relevant for every transaction, and you want to add them only if they exist.

Here's the traditional way to do it:

```javascript
const transaction = {};

if (transactionType) {
  transaction.transactionType = transactionType;
}

if (amount) {
  transaction.amount = amount;
}

if (date) {
  transaction.date = date;
}
```

**The Elegant Shortcut:**

JavaScript offers a concise and elegant solution to this problem using the spread (`...`) operator and object literal shorthand:

```javascript
const transaction = {
  ...(transactionType && { transactionType }),
  ...(amount && { amount }),
  ...(date && { date }),
};
```

**Benefits of the Shortcut**

Using this elegant shortcut offers several advantages:

1. **Conciseness:** The code is much shorter and easier to read, reducing redundancy and improving maintainability.

2. **Scalability:** It scales effortlessly as you add more properties or conditions without cluttering your code.

3. **Readability:** The intent of your code is clearer, making it easier for others (and your future self) to understand.


**Conclusion**

This one-liner efficiently adds properties to your object if and only if they exist. It's shorter, more readable, and scales effortlessly as your codebase grows.

So, the next time you're working with JavaScript objects, remember this fantastic shortcut to streamline your code and impress your colleagues! 😎👨‍💼

I hope you learned something from this :-)

Follow me for more such content:
LinkedIn: https://www.linkedin.com/in/shameeluddin/
Github: https://github.com/Shameel123
Rise Above: Achieving Success Against All Odds
Tags: webdev, tutorial, react, opensource
Published: 2023-09-19 11:31:34


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

“Believe in yourself, and you will be unstoppable.”
“The only way to do great work is to love what you do.” — Steve Jobs
“Success is not final, failure is not fatal: It is the courage to continue that counts.” — Winston Churchill
“Your time is limited, don’t waste it living someone else’s life.” — Steve Jobs
“Dream big and dare to fail.” — Norman Vaughan
“The future belongs to those who believe in the beauty of their dreams.” — Eleanor Roosevelt
“You are never too old to set another goal or to dream a new dream.” — C.S. Lewis
“The harder you work for something, the greater you’ll feel when you achieve it.”
“Challenges are what make life interesting, and overcoming them is what makes life meaningful.” — Joshua J. Marine
“Success is walking from failure to failure with no loss of enthusiasm.” — Winston Churchill
Download dood video (+ js -> img)
Published: 2023-08-02 04:58:15

Example: 
https://dooood.com/e/kluhm510q8r9
https://asiajjj.com/view1/54691/

Online decoder (may not work later):
https://9xbuddy.com/

**Passing the 1st guard (no right click / F12):**

`View -> Developer`

**Passing the 2nd guard (Paused in debugger):**

Deactivate breakpoints
![Deactivate breakpoints](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yd2n2xtw640ipqtyfz8k.png)

**Passing the 3rd guard (download):**
```javascript
function saveFile(blob, filename) {
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob, filename);
} else {
const a = document.createElement('a');
document.body.appendChild(a);
const url = window.URL.createObjectURL(blob);
a.href = url;
a.download = filename;
a.click();
setTimeout(() => {
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}, 0)
}
} // copy paste from a stackoverflow
const response = await fetch(videojs.getAllPlayers()[0]["src"]());
const reader = response.body.getReader();
var length = 0;
var total = +response.headers.get("content-length");
var chunks = [];
while(true) {
const {done, value} = await reader.read();
if (done) {
break;
}
chunks.push(value);
length += value.length;
console.log((length/total*100).toFixed(2)+"%");
}
var blob = new Blob(chunks);
saveFile(blob, "video.mp4")
```

**Passing the 4th guard (img src = "xxx.js"):**

Download it anyway. Then change the file extension to `jpg` or `png`

Source: https://www.reddit.com/r/DataHoarder/comments/11m8eqa/need_help_downloading_videos_from_doodstream/
TruStacks Discussion
Tags: cicd, devops, javascript, react
Published: 2023-09-19 11:26:05

Here is our discussion board that will give you a reference standard for building CI/CD solutions that can be consumed by generative tools such as TruStacks. Click the link below to join the conversation and let us know if you have any questions.

https://github.com/TruStacks/trustacks/discussions/8
Angular 9/8 NgClass Directive example
Published: 2023-09-19 10:29:20

It's very important to have a better understanding of using NgClass because there may be so much situation where we need to change the template as per the values inside the component ts file.

In this article, We will try to understand how class can be added dynamically into template as per the value inside ts file in Angular application. It is built in directive provided by angular.

 

The ngClass directive will take an expression that will be used to determine which state styles to apply at a given time to the styled element.

The expression passed on to ngClass can be:

an object
an array
a string

### Let's Get Started

### Using Simple Expression
There are two different ways by which NgClass can be used to add the class.  The first way is by passing an object literal to the directive, like below:

``````[ngClass]="{'text-success':true}"``````

In the above code, if the value is true then text-class will be added to the html element.

Second way is write the complete expression, like below:

``````[ngClass]="{'text-success':person.country === 'USA'}"``````

Let's try to understand with below detailed example:

```
<h4>NgClass detailed example</h4>
<ul *ngFor="let user of users">
<li [ngClass]="{
'text-success':user.country === 'SA',
'text-primary':user.country === 'USA',
'text-danger':user.country === 'IN'
}">{{ user.name }} ({{ user.country }})
</li>
</ul>
```

### Set Multiple Class on the same Element
There may be some cases when multiple classes need to add dynamically to the same HTML element on the base of different conditions. These cases can also be handled very easily with NgClass directive.

``````[ngClass]="{'actived':var1 !=null, 'active':var2 =='grade' }"``````

In the above code, we can see on the base of two different conditions, two different classes are being added dynamically.

### Using Ternary Operator

If there is a case where we have to set alternate class on the base of a variable value then ternary operator is used. See the code below:

``````<div [ngClass]="varA === varB ? 'css-class-1' : 'css-class-2'">``````

### Conclusion
In this article, We tried to understand the different ways to add classes dynamically in the Angular template. Check other [Angular sample projects](https://jsonworld.com/blog/Angular-9-8-NgClass-directive-example) to start working on enterprise-level application

Thank

This article is originally posted over [jsonworld](jsonworld.com)
Isotope.js with rogue margin on masonry layout
Tags: javascript, masonry, webdev
Published: 2023-09-19 11:11:31

Hello,

I have made the masonry grid gallery layout using Isotope and Vanilla JS. Everything seems to work fine, but on resizing there is some kind of the right margin on the masonry element, which is getting bigger as the viewport size gets smaller.

Everything would be fine but there is no mention of any kind of margin or padding or anything in Chrome dev tools.

Here is the link to the codepen with the code: [Masonry Grid](https://codepen.io/mkozlica/pen/RwEjogB)

Please help, I am slowly going crazy :)

THX

JR
Installing Docker
Tags: webdev, beginners, programming, tutorial
Published: 2023-09-19 11:10:50


![Docker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4b0y3q0h2ya7sh84g41j.png) 
### Installing Docker
Docker is installed via package manager.

#### Arch Linux
```yaml
$ sudo pacman -S docker
```

#### Debian/Ubuntu Linux
```yaml
$ sudo apt-get install docker.io
```


#### Starting Docker Engine
Start the Docker daemon which provides the Docker Engine. This process serves the Docker API and manages Docker containers.
```yaml
$ sudo systemctl start docker.service
```


If you want Docker Engine to automatically start when you system boots issue the below command.
```yaml
$ sudo systemctl enable docker.service
```
Verify that Docker Engine is running.
```yaml
$ docker info
```
Verify that you can run containers. The below will download the latest Arch Linux image and use it to run a "Hello World" bash script in the container.
```yaml
$ docker run -it --rm archlinux bash
```
Day 1 Word Game
Tags: 12months, project
Published: 2023-08-01 14:18:58

---
title: Day 1 Word Game 
published: true
description: 
tags: 12months, project, 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-08-01 13:07 +0000
---

Hey this is not going to be a regular thing. I will be updating my progress but probably weekly in a meatier post. This post is to just to say I have started and note some of the roadblocks or hurdles I think I may have to muddle through

So first day has gone great I have started my word game called S*******le (Yes it has a name just don't want anyone to snipe it I am a slow coder). Progress went ok mostly, I have an api that I will be calling its free but its slow so if I can find a replacement (or most probably a faster way to call/get a response) I will update that. The main problem that I stumbled across and surprised me is validating the users input. Finding a way to make sure the user inputs a valid answer is a little bit harder than I thought. If I was working with ruby it would be quite a bit easier, but I chose sveltekit and JS for this project 

But other than that its been quite good and has made me think a bit. If I was a better coder than I am then I believe this could definitely be done in a weekend or 5 days max. But as it is now I think I can maybe do it in 2 weeks... providing I dont run into any problems, have the time to code every day and no unforeseen circumstances pop up. Then I can dedicate the remainder of the time to marketing (HA HA). Nah, I will probably take the whole month to get this done.

Anyways on to the obvious areas I think I will struggle or have trouble with.

###Hosting and deployment. 
With these projects I am planning on setting up my own personal server/digital ocean droplet to host them all so this is going to take a lot of reading and figuring out to do. Also since Google Domains is now dead I have no idea where I will get the domain name I want from 

###Multiplayer.
This I will just have to learn as I go. I was very close to solving and learning for myself how to implement Multiplayer matchmaking in my long gestating RoR project Ultimate tictac but in JS I have noooo idea how to implement websockets and get things running

###UI and Design 
THE BANE OF MY EXISTENCE. I like coding because it allows me to be creative but when I come up to do something that is traditionally creative I have a lot of problems.

Well thats it for my short (long) update. The next one will be in a couple days.
🚀 API Maker - Update many API [Put operation]
Published: 2023-09-19 11:08:19

## Update multiple records in a single API call.
▸ Modify record according to the condition of the request payload.

-----------------

✅ List of Feature
👉 Body  ▸ User can enter the criteria in this body section.
👉 Most of operator support 
👉 Received counter of the number of rows that were modified in the response.

-----------------------
⭐ Supported Operator ⭐
-----------------------
⚡️ $in
⚡️ $nin
⚡️ $and
⚡️ $or
⚡️ $eq
⚡️ $gt
⚡️ $gte
⚡️ $lt
⚡️ $lte


-------------------------


## Youtube video link
https://youtu.be/iRq6EumX83A


## Websites
https://apimaker.dev


## API Docs link
https://docs.apimaker.dev/v1/docs/apis-all/generated-apis/auto-generated-update-many-api.html

https://docs.apimaker.dev/v1/docs/apis-all/schema-apis/auto-generated-schema-based-update-many-api.html

## More Examples
https://docs.apimaker.dev/v1/examples/sys/db/updateMany.html

https://docs.apimaker.dev/v1/examples/sys/db/gen/updateManyGen.html

## Follow on twitter
https://twitter.com/api_maker

## Linked In
https://www.linkedin.com/company/api-maker

## More YouTube Videos
https://www.youtube.com/@api_maker/playlists
Classes Aninhadas em Java
Tags: java, beginners, programming, braziliandevs
Published: 2023-09-19 11:08:08

Classes aninhadas (ou classes internas) são classes definidas dentro de outras classes. Elas podem ser úteis para organizar o código e encapsular funcionalidades relacionadas. Existem dois tipos principais de classes aninhadas em Java: classes internas estáticas e classes internas não estáticas.

**Aqui está um exemplo de uma classe aninhada estática:**

```
public class ClasseExterna {
    private static int valorExterno;

    public ClasseExterna(int valorExterno) {
        this.valorExterno = valorExterno;
    }

    public static class ClasseAninhadaEstatica {
        private int valorInterno;

        public ClasseAninhadaEstatica(int valorInterno) {
            this.valorInterno = valorInterno;
        }

        public void exibirValores() {
            System.out.println("Valor externo: " + valorExterno);
            System.out.println("Valor interno: " + valorInterno);
        }
    }
}
```

Neste exemplo, ClasseAninhadaEstatica é uma classe estática aninhada dentro de ClasseExterna. Você pode criar uma instância de ClasseAninhadaEstatica e acessar seus membros mesmo sem criar uma instância de ClasseExterna.

Linkedin: https://www.linkedin.com/in/antonio-rodrigo-wanderley-serra/
GitHub: https://github.com/antoniorws
Objetos Imutáveis
Tags: java, beginners, programming, braziliandevs
Published: 2023-09-19 11:04:12

Objetos imutáveis são objetos cujo estado não pode ser alterado após a sua criação. Isso significa que, uma vez que você defina os valores dos atributos de um objeto imutável, esses valores não podem ser modificados. Isso é alcançado tornando os atributos privados e fornecendo métodos apenas para leitura, sem métodos para alteração.

**Aqui está um exemplo simples de uma classe de objeto imutável em Java:**

```
public final class PessoaImutavel {
    private final String nome;
    private final int idade;

    public PessoaImutavel(String nome, int idade) {
        this.nome = nome;
        this.idade = idade;
    }

    public String getNome() {
        return nome;
    }

    public int getIdade() {
        return idade;
    }
}
```

Neste exemplo, os atributos nome e idade são marcados como final e só podem ser definidos no construtor. Não há métodos para alterar esses valores depois que o objeto é criado.

Linkedin: https://www.linkedin.com/in/antonio-rodrigo-wanderley-serra/
GitHub: https://github.com/antoniorws
SAP BTP on Kyma Runtime: PAIN
Tags: sap, btp, kyma, microservices
Published: 2023-09-19 11:03:44

Recently I have been playing around with SAP BTP **on Kyma**. I have to confess, that is provided with a hell of chaotic documentation.
One reason is that is caused by **being hosted on Kyma**. I have nothing to Kyma itself as it is runtime based on rock solid Kubernetes, so what could go wrong… In fact, most fuss is caused by technical debt and lack of documentation update to include Kyma.
Initially, SAP BTP was designed to be run on Cloud Foundry, but due to well known CF downsides. If you're looking for more details about that, I do recommend reading two articles:

 * https://phoenixnap.com/kb/cloud-foundry-vs-kubernetes
 * https://medium.com/@odedia/comparing-kubernetes-to-pivotal-cloud-foundry-a-developers-perspective-6d40a911f257

So, what is the issue... Let me list you just a few.

# Kyma Deprecations

Kyma's technical stack changes a lot:

* [Minikube deprecation on local environment](https://blogs.sap.com/2020/07/22/kevins-path-to-kubernetes-world-lets-install-kyma/) (2023 - there is gardener and k3d only)
* [Jaeger deprecation](https://github.com/kyma-project/lifecycle-manager/issues/114)
* Loki deprecation
* [Grafana and Prometheus](https://blogs.sap.com/2022/12/09/deprecation-of-prometheus-grafana-based-monitoring-in-sap-btp-kyma-runtime/) removal
* removal of pre-defined roles

There is more of that on [What's New 2021](https://help.sap.com/doc/657201b2db4545a598d7b5e9d593d032/Cloud/en-US/075255e1e64145218a0d6fa3be915b20.html?sel1=Kyma%20Environment&from=2021-01-01&to=2021-12-31) and [What's New 2023](https://help.sap.com/whats-new/cf0cb2cb149647329b5d02aa96303f56?Component=Kyma%20Runtime&locale=en-US)

Looking at diagram from [December 2021](https://blogs.sap.com/2021/12/23/install-kyma-sap-btp-kyma-runtime-getting-started/) that is updated version for 2023: 

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


I do not want to judge all these changes (although missing out Grafana and all logging date is huge bummer, especially, that with e.g. AWS K8s you get basic monitoring and logging for free, just for development purposes)

Second thing is… that documentation doesn't provide sample solution which just works. I have tried one how to [migrate from ORY Hydra](https://blogs.sap.com/2023/06/06/sap-btp-kyma-runtime-ory-hydra-oauth2-client-migration/) and failed. I also asked a skilled colleague in BTP and also failed.

That way of documentation delivery isn't working.
dbForge Studio for PostgreSQL: Your Ultimate Start Page Guide
Published: 2023-09-19 10:52:34

Welcome to the comprehensive guide to the Start Page of dbForge Studio for PostgreSQL! Whether you're an experienced database developer, a data analyst, or an administrator, this video is tailored to assist you in navigating the robust features of this all-in-one integrated development environment (IDE).

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

Here's What You Will Discover:

- SQL Development: Dive into the SQL Editor and learn how to effortlessly write, edit, and execute SQL queries. Explore how Query Profiler can enhance your database's performance.
- Database Sync: Gain insights into managing database changes and ensuring consistency across multiple PostgreSQL databases. Explore tools for identifying and deploying disparities in database objects and actual data.
- Data Pump: Familiarize yourself with a suite of features designed for managing and manipulating data within your PostgreSQL database. Discover how to import and export data in various formats such as CSV, TXT, XML, XLS, and Google Sheets.
- Data Analysis: Unlock the potential of powerful tools for data visualization and reporting. Learn how to utilize functionalities like the Master-Detail Browser and Pivot Table to extract valuable insights from your data.

https://www.youtube.com/watch?v=CbIY6mZXRFI
How to set cookies in a web browser in FastAPI
Tags: python, fastapi, api, webdev
Published: 2023-09-19 10:51:31

## Hi 🙂🖐

Welcome to a new post, Today I will share with you how to set cookies in a web browser in FastAPI and Python in an easy way.


## step 1

Import modules

```python
from fastapi import FastAPI, Response, Request, Depends
from fastapi.responses import HTMLResponse
from secrets import token_hex
```

## step 2
Create HTML file for test

```html
<html>
    <head></head>
    <body>
        <h1>This is test</h1>
    </body>
</html>
```

## step 3
Create test route

```python
app = FastAPI()

@app.get('/test')
async def test(response: Response):
    response = HTMLResponse(open('test.html', 'r').read())
    response.set_cookie(key="fakesession", value=token_hex(20))

    return response

```


## run the API
```
uvicorn main:app --reload
```

it's working 😎
we have cookie

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

If you want to confirm if it really working 🙃

you can delete the cookie and reload the page 🙂

## Read the cookie from another page

```python
async def read_token(request : Request):
    token = request.cookies.get('fakesession')
    if not token:
        return False
    
    return token

@app.get('/protected')
async def protected(token : str = Depends(read_token)):
   return {'token': token}
```

## result


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






**Now we're done 🤗**

**Don't forget to like and follow 🙂**

**Support me on PayPal 🤗**
https://www.paypal.com/paypalme/amr396
How to Convert Excel to PDF in ASP.NET Core using the Excel Library
Tags: webdev, csharp, dotnet, aspnet
Published: 2023-09-19 10:41:11

Learn how to convert Excel to PDF in ASP.NET Core using the Syncfusion Excel Library. In this video, I will demonstrate how to integrate the Syncfusion Excel to PDF converter with an ASP.NET Core application using Visual Studio. I will also demonstrate how to convert an Excel document into a PDF file. 

Syncfusion Essential XlsIO is a high-performance and feature-rich .NET Excel framework. This framework has an Excel creation and editing library that allows you to create, read, and edit Microsoft Excel files in.NET applications. It also offers an Excel-inspired Spreadsheet UI control to create, edit, view, and format Excel documents. Its powerful conversion APIs make it easy to convert Excel files to PDF, images, and more. 

You can convert an Excel workbook or worksheet to PDF format. Use various customization options, like embedding fonts, ignoring empty pages or worksheets, showing or hiding headers, and footers. This Library supports import and export of data and formulas. Import and edit existing Excel files in the Spreadsheet control. Spreadsheets can be exported to XLS, XLSX, CSV, and PDF file formats. More than 400 Excel-compatible functions are supported, such as cross-sheet references, named ranges, table formulas, and formulas. Users can create and manipulate tables, Pivot Tables, Charts, and Sparklines. 

This Library is also used to fill data using Template Markers, clone and merge Excel worksheets, and encrypt and decrypt Excel documents. The Spreadsheet control provides a variety of text and number formatting options along with conditional formatting to improve the appearance and effectiveness of spreadsheet. The Spreadsheet control supports on-demand data loading when bound to data sources. It improves initial loading time by requesting only the visible data from the data source. It also allows you to perform various kinds of data processing such as data validation, sorting, and filtering. 

**Product overview:** https://www.syncfusion.com/document-processing/excel-framework/net-core

**Tutorial video:** https://www.syncfusion.com/tutorial-videos

**Download examples from GitHub:** https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Getting%20Started/ASP.NET%20Core/Convert%20Excel%20to%20PDF

{% youtube mMrGjypcSLw %}