teleren/devto huggingface dataset:
How to Install .DEB files in Arch Based Distros (e.g Manjaro Linux)
Tags: linux, webdev, beginners, archlinux
Published: 2023-03-07 15:31:02

To install .deb files in an Arch-based Linux distribution like Manjaro, you can use a tool called debtap. debtap allows you to convert .deb files to Arch-compatible packages that can be installed with the package manager.
I have a youtube tutorial for this process. To watch, [click here](https://youtu.be/vx_qHl0oL4I)

Here are the steps to install and use debtap:

1. Install debtap using Pacman, the package manager for Arch-based distributions. Open a terminal and run the following command:
<pre>
sudo pacman -S debtap
</pre>
2. Once debtap is installed, you need to update its database with the command:
<pre>
sudo debtap -u
</pre>
3. To convert a .deb file to an Arch-compatible package, navigate to the directory where the .deb file is located in the terminal, and run the following command:
<pre>
sudo debtap -v <filename>.deb
</pre>
Replace <filename> with the name of the .deb file you want to install.

4. debtap will convert the .deb file to an Arch-compatible package and save it in the current directory. To install the package, use the Pacman command:
<pre>
sudo pacman -U <filename>.pkg.tar.zst
</pre>
Replace <filename> with the name of the package generated by debtap.

5. The package will be installed on your system, and you can use it like any other package installed through the package manager.

NOTE: that debtap does not guarantee that the converted packages will work perfectly, as they may have dependencies that are not available in the Arch repositories. You should also exercise caution when installing packages from sources other than the official repositories, as they may contain malicious code.
Predictive Analytics Tool
Tags: analytics, regression, classification
Published: 2023-03-07 15:35:46

Without any need to programming Predictive Analytics Tool let users to apply following prediction methods to their *.csv or *.xlsx data:
- Linear Regression
- Logistic Regression
- Decision Tree Classification

{% embed https://www.youtube.com/watch?v=rHEAOVlZYfs %}

[Get](https://www.microsoft.com/store/apps/9pn2gn6lfknz)
Data Analysis Tool
Tags: testdata, fft, histogram, csv
Published: 2023-03-07 15:32:20

This tool is for 2D measurement data or data prepared with 2 columns. After loading the * .xlsx file you record or prepared with 2 columns, you can examine your data graphically. You can save graphs as image file.
Data analysis can give frequency spectrum of second column by clicking “DFT” (discrete Fourier transform) or “FFT” (fast fourier transform). Sampling rate input belogs to this transforms.  By clicking “Statistics” button you can get histogram, polynomial least squares equation and other info of second column.
This tool also saves loaded data as *.csv or *.mdb file for further data processing. 

{% embed https://www.youtube.com/watch?v=_a9Z2ORHyMc %}

[Get](https://www.microsoft.com/store/apps/9nbvlm36vfn0)
Starting o11y.wiki
Tags: observability, webdev, beginners
Published: 2023-03-07 15:22:20

I have started a project for maintaining glossary of all terms and definitions related to Observability. 

It is called [o11y.wiki](https://o11y.wiki). 

The GitHub repo can be found here https://github.com/prathamesh-sonpatki/o11y-wiki

The contents are available at https://o11y.wiki/.

This is an open source project aimed at beginners like me who don’t know a lot of observability and reliability. The idea is to learn about these terms and note them down at one place, so others can benefit from it.

Here are few next set of terms that can be added --

- MTTR
- MTTD
- MTBI
- Incident
- Alert
- Metric
- Samples
- Cardinality
- Log
- Span
- Event
- Exceptions
- Serverless
- SRE
- Platform engineering
- PromQL
- Service Discovery

I am looking for help while making this project better and solid for everyone! 🏗️ ❤️
VSCode Dev Container Failing to Build
Tags: docker, vscode, wsl
Published: 2023-03-07 15:19:48

I hope this helps others who may have come across this problem. A workspace I have with a dev container that has worked in the past was unable to build suddenly. The error I was getting was:

```sh
docker: Error response from daemon: invalid mount config for type 
"bind": bind source path does not exist: 
\\wsl.localhost\Ubuntu\mnt\wslg\runtime-dir\wayland-0
```

After a while of searching I navigated to \\wsl.localhost\Ubuntu\mnt\wslg\runtime-dir\ on my Windows laptop and found that there was a **wayland-0** and a **wayland-0.lock** file in the folder. I deleted these files and to rebuild and reopen my workspace in the dev container. This time it was successful and those files were not recreated. I can't tell you why this was an issue. I can only share what worked in my case. YMMV
PGP Tool
Tags: pgp, security, encryption
Published: 2023-03-07 15:12:56

Pretty Good Privacy (PGP) is an encryption system used for encrypting sensitive files. 
Make sure to press the Reset All Keys button before using it for the first time!
PGP Tool has following features:
- Open PGP Files
- Encrypt any file as PGP file
- Create new PGP keys
- Import and export PGP keys

{% embed https://www.youtube.com/watch?v=iHHeCkQ42Sc %}

[Get](https://www.microsoft.com/store/apps/9pgcl5ph9bs4)
useRouter in TS
Published: 2023-03-07 15:11:05

Can't get dynamic route's id due to this error. Couldn't find it anywhere. I think I'm just letting something really obvious, but don't know what exactly.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/251b2xfnv6qxnklmigcg.png)
Web development...
Tags: blazor, webdev, javascript, programming
Published: 2023-03-07 15:03:54

Web development. A long history, with many ups and downs. 
Starting with simple HTML web pages, through sins of their time like jQuery and Bootstrap, to the first AJAX applications.
With the proliferation of REST APIs, separate architecture, and microservices, it finally seemed like we had found a reasonable
foundation on which clean and performant applications could be mapped to the web. 
Unfortunately, this hope did not last long. Microsoft, the company that had given us VS Code and TypeScript, decided to take an absurd step. Instead of finally declaring Project Razor a failure as a lesson learned from the countless server-side rendered problem cases out there, they did the complete opposite.
They created Blazor. And with it, probably the biggest step backwards in developer history in a long time.
Blazor, just like its predecessor, is a crutch to allow backend developers to continue to "create" inperforming and half-finished applications using cheetsheets like Bootstrap.
The big news: the groundbreaking invention of WebAssembly is being abused to bring the COMPLETE dotNet runtime to the front end.
Not only is such a thing incredibly inperformant and energy consuming, now applications can be written in which C# code and JavaScript are written and executed in parallel. An absolutely unholy hell, not to mention the absolute unmaintainability of the code.
And they had actually, with the in dotNet 6 introduced minimal APIs, broken up and simplified the already somewhat outdated API system.
This little text was written out of pure dislike for this trend, I look forward to hearing your thoughts on the subject.
Your Josun
Stellar Quest Out of Control: how I shot 100 asteroids with fewer than 300 bytes of WebAssembly
Tags: soroban, sorobanathon, rust, webassembly
Published: 2023-03-07 14:34:23

Stellar (the organization behind the Stellar Lumen cryptocurrency) organizes programming competitions, called "Stellar Quests". From February 15th to March 1st 2023, the competition revolved around a game called “Asteroids”, where you control a spaceship that moves through galaxies containing fuel pods and asteroids. To win, you need to shoot 100 asteroids without running out of fuel. The full instructions of this game are available [on the official website](https://fastcheapandoutofcontrol.com/game/asteroids/play).

This stellar quest had three categories: Fast (first submitted solution), Cheap (most efficient solution), and Out of Control (smallest solution). Read how I found a solution of fewer than 300 bytes of WebAssembly (WASM) code on [my blog](https://blog.vogelcode.com/blog/stellar-quest-wasm-optimization/)
How do I comment out (multiline) in Rails?
Published: 2023-03-07 14:16:18

Easiest way out is to use <-- -->  to comment out your code as show below. 
`<!-- %= link_to "Make default", make_default_admin_state_path(state) % --> `

Example


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



Learn more from this link. 
https://stackoverflow.com/questions/8514946/how-do-i-comment-out-erb-in-rails
UNDERSTANDING MEMOIZATION IN JS
Tags: javascript, programming, react
Published: 2023-03-07 12:50:17

Memoization is an optimization technique that can be used to reduce the runtime for calculations by saving previous input to something called cache and returning results from it.

-> Let’s make it simple,

• Suppose you have to work at a Medical dispensary for one day instead of your uncle. It’s your first day in that shop & at the very first hour a customer comes and asks you for “Paracetamol tablets”, now as it’s your first day you don’t know about the placements of medicine in that big shop(aha! uncle is rich 🤑 LOL).

• Now you will start searching shop for that medicine,
there may be a best case that the first drawer you opened is full with Paracetamol tabs
and also there may be a worst case that after searching for the whole shop you find those tabs in the last drawer.

• Let’s go with the worst case, now searching for the whole shop consumes much time, then you give that medicine to that buyer.

but now you know that Paracetamol tabs are present in that particular drawer (you memorized it, you stored it somewhere)

• Now if some other person would come and ask for Paracetamol tabs, without searching and spending more time, you can easily take the medicine from that memorized drawer and you give it to the buyer in no time.

-> Similarly,

To understand this awesome yet tricky concept, let’s dive into the code.


Here, I have written a simple function which triggers the loop and runs it ’n’ number of time, where ’n’ is the input. And every time the for loop runs it will add index to the sum, and then returns sum.


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

Now this is good code for some small inputs, but if the input is large then this will be much costly.

Suppose, I want this loop to run 1Million times, So, I have to write code

console.time();
console.log(calc(1000000));
console.timeEnd(); //this line will print runtime in 'ms'

console.time();
console.log(calc(1000000));
console.timeEnd(); //this line will print runtime in 'ms'

Running this will take what time logged in console is attached below:

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

For the same input, loop will run 1 Million times whenever we pass input 1Million, and that’s not good for software, it’s not cost effective.

So we will use MEMOIZATION technique, where we will store the output value, when input is 1Million (or anything).


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

console.time();
console.log(ans(100000000));
console.timeEnd();

console.time();
console.log(ans(100000000));
console.timeEnd();
Here we can see that time taken to calculate for 1Million first time is large in ‘ms’ but for the next time , it’s as small as negligible.


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

I hope it helps :)
Understanding mappings in Solidity
Tags: webdev, javascript, blockchain, web3
Published: 2023-03-07 14:04:32

If you're a Javascript developer and learning Solidity now, you've probably realized that mappings are weird.

I've had serious troubles wrapping my head round this way of structuring data.

If you go to solidity-by-example.org, you'll see that mappings are defined like so :

```
Maps are created with the syntax mapping(keyType => valueType).

The keyType can be any built-in value type, bytes, string, or any contract.

valueType can be any type including another mapping or an array.

Mappings are not iterable.
```

Nice, let's see them in action so that we can understand them better.

In my last Solidity project where I built a voting dApp, I wanted to keep track of all the addresses that had voted for a proposal because each address could only vote once per proposal. I created a mapping to do this :

`mapping(uint256 => mapping(address => bool)) private hasVotedForProposal;`

What the hell, bro? Let me explain.

As mappings valueTypes can be any type, including mappings, I'm creating a nested mapping. If I tried to translate it into human language, I'd probably read it as such: Create a private variable, that is a mapping, named hasVotedForProposal, it should map a uint256 type (that is a number in the simplest sense, that is linked to another mapping that links an address to a boolean value.

What?

The way I'm using it, I have a proposal struct (basically an object in JS) and that proposal has an id. I'm also saving my proposals in a proposals array.

So, when a user votes for a proposal, I'm checking if they have already voted for that proposal by checking if the address is in the mapping. If it is, I'm not allowing them to vote again. If it's not, I'm allowing them to vote.

In order to do that, I have a vote function and when a user calls that vote function, I'm passing the proposal id as an argument. => `        hasVotedForProposal[_proposalId][msg.sender] = true;`

Note that `msg.sender` is the address of the user that is calling the function.

Here, I invoke the hasVotedForProposal mapping and pass the proposal id as the first argument (that first `uin256` that is linked to the 2nd mapping) so that whenever I want to check this id in the hasVotedForProposal mapping, it'll show the 2nd mapping, which is the one that links the address (msg.sender) to the boolean value.

I hope this helps you understand mappings better. If you have any questions, feel free to ask them in the comments.
How to check if a node file is running as a script?
Tags: script, node
Published: 2023-03-07 14:02:17

## What is a Script?

A script is a code that you can run directly from your terminal.

It is a runnable code

Here is a minimal node script

```jsx
const run = async () => {
};

(async () => {
  try {
    await run();
  } catch (err) {
    // eslint-disable-next-line
    console.log(err);
    process.exit(1);
  }

  process.exit(0);
})();
```

## How we run scripts at Woovi monorepo?

We run node scripts in many ways: 

node path/to/myScript.ts

yarn es path/to/myScript.ts

yarn w path/to/myScript.ts

`yarn es` is the same as `node -r esbuild-register`, it is running node using esbuild 

`yarn w` is running the script using `webpack`

We use esbuild and webpack to be able to run any code in our monorepo, using typescript.

This causes a lot of trouble to detecting if a file is running as the entrypoint of a script or not.

## How to check if a node file is running as a script?

We use `!module.parent` for node and esbuild, but we inject WEBPACK_ENTRY when using webpack, as we run the final webpack bundled code.


```jsx
import path from 'path';

const cwd = process.cwd();

export const isMainScript = (require, module, filename: string) => {
  // webpack_entry is the real
  if (process.env.WEBPACK_ENTRY) {
    const fullEntry = path.join(cwd, process.env.WEBPACK_ENTRY);
    const fullFilename = path.join(cwd, filename);

    if (fullEntry === fullFilename) {
      return true;
    }

    return false;
  }

  if (!module.parent) {
    return true;
  }

  // eslint-disable-next-line
  console.log('not main script, check your script code');

  return false;
};
```


## In Conclusion
We need to detect if a file is running as script to avoid running the file script code if we are sharing some code.

Going deep in the rabbit hole, let us improve the DX of running scripts at Woovi


---
Woovi
[Woovi](https://www.woovi.com) is a Startup that enables shoppers to pay as they like. To make this possible, Woovi provides instant payment solutions for merchants to accept orders.

If you want to work with us, we are [hiring](https://woovi.com/jobs/)!

---
Photo by <a href="https://unsplash.com/@tma?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Tianyi Ma</a> on <a href="https://unsplash.com/photos/WiONHd_zYI4?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Popup Builder to Boost Your Sales – Claspo
Published: 2023-03-07 14:00:20



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

Claspo is a pop-up builder that offers full-fledged functionality for making creatives and gives users the freedom of customization.
It features a simple interface with drag-and-drop functionality. 

A user sets up visuals, texts, buttons, forms and other interactive elements. The latter can be created by developers and imported into [Claspo](https://claspo.io/) templates for further use. The campaigns are easy to manage and you can analyze the results right in your dashboard.
Schema stitching problem with apollo prisma graphql service
Published: 2023-03-07 13:55:24

Hi Team,
I am facing problem with existing data gateway service (graphql schema stitching). This service works fine with other graphql services which are written using spring boot but it gives error while fetching data from 'apollo prisma graphql service' where response of this service has > 100k records and this service creates schema using npx prisma generate (we don't use normal typedefs or schema.graphqls). 
Error is `graphql.schema.idl.errors.SchemaProblem: errors=[A schema MUST have a 'query' operation defined]
	at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:82) ~[graphql-java-19.2.jar:na]
	at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:58) ~[graphql-java-19.2.jar:na]
	at io.fria.lilo.LiloContext.createGraphQL(LiloContext.java:178) ~[lilo-22.11.0.jar:na]`

Can you please advise on this. Much appreciated response on this thread. 

Thank you,
Tejas
Avoiding UI Regressions With Jest
Tags: react, testing, webdev, javascript
Published: 2023-03-07 13:41:21

How can you ensure that a modification on a component won't break the responsiveness on the user device? How can you ensure that emails you send won't break when you change something in your UI?

## What is a Visual Regression Test?

A _visual regression test_ is a kind of test that will ensure that the result of any modification in the respective component won't break how the final user will see it.

Talking about UI components, design systems, colors, pages, emails and anything else the final user could see can be tested against visual regression.

This gives us, developers and designers, the guarantee we won't suffer from any unwanted change.

## Visual Regression Testing With Jest

To have this kind of test in your codebase, you will need two libraries: [jest-image-snapshot](https://www.npmjs.com/package/jest-image-snapshot) and [node-html-to-image](https://www.npmjs.com/package/node-html-to-image).

As the `jest-image-snapshot` docs says, you need to extends your `expect`. Here's an example how you can do it:

```js
// jest.setup.js
import { toMatchImageSnapshot } from 'jest-image-snapshot';

expect.extend({ toMatchImageSnapshot });
```

After that, you can use `expect().toMatchImageSnapshot()` in any test of your codebase.

How we can write some kind of test that will test those snapshots? You can follow the code below:

```js
// __tests__/Component.spec.(jsx|tsx)
import { render } from '@testing-library/react';
import htmlToImage from 'node-html-to-image';

import { Component } from '../Component';

it('match visually snapshot - or any good test message here', async () => {
  const { container } = render(<Component />);

  const image = await htmlToImage({
    html: container.innerHTML,
  });

  expect(image).toMatchImageSnapshot();
});
```

After all, how this works?

In this case, the `toMatchImageSnapshot` only accepts a JPG buffer, it's where the `node-html-to-image` library enters. From a HTML string, the library will output a JPG buffer that will be used as what we expected in the test.

Similar to other snapshot tests, when you run it for the first time, it will produce a new folder called `__image_snapshots__`, inside it will have the _"snapshotted"_ image to be compared.

In case something goes wrong, the test will breaks and will produce a new folder, inside the `__image_snapshots__`, called `__diff_output__`. This folder will contain both the new and old images, side-by-side, that you can use to visualize the changes.

---

If you want to know more about how we test our UI, we are [hiring](https://woovi.com/jobs/)!

We are a startup that enables shoppers to pay as they like. To make this possible, [Woovi](https://woovi.com) provides instant payment solutions for merchants to accept orders.
Demonstrating the usage of AWS Developer Tools with a serverless application
Tags: tutorial, programming, aws, guide
Published: 2023-03-07 13:19:09

Serverless computing is one of the most innovative and modern ways of building applications. It offers a way to run applications without the need to manage servers or infrastructure. In this blog post, we will explore how to build a serverless Bookshelf application on Amazon Web Services (AWS) using a set of powerful and flexible tools and services.

The Bookshelf application used in the demonstration is a simple application that allows authenticated users to view a list of books. We will use several AWS services to build the application, including Amazon S3, Amazon DynamoDB, AWS Lambda, Amazon API Gateway, and Amazon Cognito.

To go through the process of building the serverless application, I have created a step-by-step guide in the form of a README file available on my GitHub repository. The repository also includes all the code and configurations required to build the application. You can find the repository here: https://github.com/sazecis/aws-dev-examples.

## Architecture Diagram:

The following diagram illustrates the architecture of the Bookshelf application:


![Demo deployment and invocation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/su3bgrxp9kcf59uugw9j.png)

As you can see in the diagram, the Bookshelf application uses several AWS services, including Amazon S3, Amazon DynamoDB, AWS Lambda, Amazon API Gateway, and Amazon Cognito. The application's static content is hosted on Amazon S3, and the Bookshelf data is stored in Amazon DynamoDB. AWS Lambda is used to read the Bookshelf data from DynamoDB, and Amazon API Gateway is used to expose the Bookshelf data to the internet. Amazon Cognito is used to authenticate and authorize users accessing the Bookshelf data.

##Building the Application:

To build the Bookshelf application, we will use the AWS SDKs and Command Line Interface (CLI) tools. We will start by creating an Amazon S3 bucket and hosting the static content of the application on it. Next, we will create an Amazon DynamoDB table to store the Bookshelf data. We will then create an AWS Lambda function that reads the Bookshelf data from DynamoDB and exposes it through an Amazon API Gateway REST API. Finally, we will secure the Bookshelf API using Amazon Cognito as an authorizer.

The whole application deployment is willingly not done with full automation. Manual steps are part of the demo. The manual steps are described in the README and are dependent on each other.

Have fun and please leave your comment either here or directly at my repository.