teleren/devto huggingface dataset:
1929. Concatenation of Array - Java Solution Beats 94% in Runtime (EXTREMELY LOGICAL SOLUTION)
Tags: array, java, leetcode, programming
Published: 2023-05-26 17:47:51

For a more in-depth explanation, please view my GitHub repository: https://github.com/VerisimilitudeX/LeetCode

# Intuition
The problem is to create a new array that is the concatenation of the given array with itself. For example, if the given array is `[1, 2, 3]`, the new array should be `[1, 2, 3, 1, 2, 3]`.

# Approach
To create the new array, we can first allocate an array of double the length of the given array. Then, we can use a for loop to copy each element of the given array to the new array twice: once at the original index and once at the index plus the length of the given array.

# Complexity
- Time complexity: The time complexity of this code is $$O(n)$$
 where n is the length of the given array. This is because we need to iterate over each element of the given array once and copy it to the new array twice.

- Space complexity: The space complexity of this code is $$O(n)$$
 where n is the length of the given array. This is because we need to allocate a new array of double the size of the given array.

# Code
```java
class Solution {
    public int[] getConcatenation(int[] nums) {
        short len = (short) nums.length;
        int[] newNums = new int[len * 2];
        for (short i = 0; i < len; i++) {
            newNums[i] = nums[i];
            newNums[i + len] = nums[i];
        }
        return newNums;
    }
}
```

My LeetCode Solutions: https://leetcode.com/VerisimilitudeX/
100 Days Coding Challenge - Day 7: FreeCodeCamp Web Design Certification
Tags: webdev, programming, css, 100daysofcode
Published: 2023-05-26 17:43:05

## Day 7

I finish the portfolio and now I have a Responsive web certification, I guess its pretty, but I care more about the projects I do and I will improve them later.

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


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

I'm starting the JavaScript course, I will upload my progress every day :D
Promesas en JavaScript
Tags: javascript, programming, spanish, webdev
Published: 2023-05-26 17:27:00

Las promesas son un elemento importante dentro de la programación en javascript, las promesas representan la finalización o error de una proceso asincrono.


![Ejemplo de promesa](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4ksetelnu3jej8faror.png)

En lo anterior se muestra como podría quedar un función que valida un token con una promesa la estrucutra es la de una función que ejecutada la consulta a una API obtiene los datos y valida si todo esta bien si es así, se crea una promesa positiva con resolve y pasa se un objecto. Para manejar la función que devuelve la promesa se puede hacer por medio del uso de then y catch, el primero se ejecuta si la promesa fue exitosa, por el contrario si algo sucedio mal y se ejecuto reject el bloque de catch es el encargado de mostrar el error.


![Ejemplo de ejecutar función con promesa](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7m9a6wf8r4ucy09j3pq7.png)

Fetch forma parte de la API disponible en JavaScript. Esta hace uso de promesas para determinar si la petición se realizo de manera correcta y se obtuvo un resultado satisfactorio o por el contrario algo salio mal.


![Ejemplo de Fetch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvhnl7m1mgzqa85psedl.png)

Fetch realiza peticiones HTTP y se ha vuelto el estandar. La primera parte se hace una petición GET hacia una API publica, en then se obtiene la respuesta y se ejecuta response.json() que tambien es una promesa, el siguiente then obtiene el resultado y lo muestra en consola. Como ves, se pueden encadenar los then, pero si por alguna razón ocurriera un problema, al último se agrega un catch por si se lanza un error en alguno de los then por precuación.Como se muestra a continuación.


![Ejemplo de fetch con catch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdo2ebvmemop1zqwtz4j.png)

Si te gusto este articulo o aprediste al nuevo, te agradecería bastante que me siguieras y compartieras mi contenido. Gracias.
Find Customer Referee | LeetCode | MSSQL
Tags: mssql, leetcode, beginners, codenewbie
Published: 2023-05-26 17:27:00

## The Problem

The challenge involves a table, `Customer`.

`Customer` table:

| id (PK) | name   | referee_id |
|---------|--------|------------|
| int     | varchar| int        |

The goal is to write an SQL query to report the names of the customers that were not referred by the customer with id = 2.

## Explanation

Here's an example for better understanding:

Input: 

`Customer` table:

| id | name | referee_id |
|----|------|------------|
| 1  | Will | null       |
| 2  | Jane | null       |
| 3  | Alex | 2          |
| 4  | Bill | null       |
| 5  | Zack | 1          |
| 6  | Mark | 2          |

Output:

| name |
|------|
| Will |
| Jane |
| Bill |
| Zack |

Will, Jane, Bill, and Zack were not referred by the customer with id = 2.

## The Solution

We'll explore two SQL solutions that solve this problem with subtle differences. We'll discuss their differences, strengths, weaknesses, and structures.

### Source Code 1

The first solution selects customers whose referee_id is not 2 or is null.

```sql
SELECT name
FROM Customer
WHERE
  referee_id != 2
  OR
  referee_id IS NULL
```

This solution has a runtime of 740ms, outperforming 91.47% of other submissions.

![solution1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/byoimhkxked3wn44683y.png)

### Source Code 2

The second solution closely resembles the first. The only difference is the order of conditions in the WHERE clause. It first checks for null referee_ids before checking for referee_ids not equal to 2.

```sql
SELECT name
FROM Customer
WHERE
  referee_id IS NULL
  OR
  referee_id != 2
```

The runtime for this solution is 741ms, beating 91.35% of other submissions.

![solution2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gatv8ifoqokz19ryau2f.png)

## Conclusion

Both solutions yield the desired outcome, but the first solution performs marginally better. Consequently, the ranking of solutions based on overall performance, from best to worst, is as follows: Source Code 1 > Source Code 2.

Your choice should depend on your specific requirements and performance expectations.

You can find the original problem at [LeetCode](https://leetcode.com/problems/find-customer-referee/description/).

For more insightful solutions and tech-related content, connect with me on my [Beacons page](https://beacons.ai/ranggakd).

{% embed https://beacons.ai/ranggakd %}
Advantages to Hiring the Best Harsh environment transformer
Published: 2023-05-26 17:15:57

Key Features and Considerations:
High reliability transformers possess several key features and considerations that enable their robust performance and resilience in critical applications:
1.	Design for Reliability: High reliability transformers undergo careful design processes that prioritize durability, performance, and longevity. Factors such as material selection, insulation <a href="https://www.quanticeci.com/categories/transformers">high reliability transformer</a> systems, winding techniques, and cooling mechanisms are meticulously considered to ensure the transformer can withstand environmental stresses, temperature variations, electrical surges, and mechanical vibrations.
2.	Robust Construction: High reliability transformers feature a robust construction designed to withstand mechanical stress, shock, and vibration. They are built with durable materials, reinforced structures, and protective coatings to ensure resistance to physical damage and prevent performance degradation over time.

Get More Detail On This Website >>>> https://www.quanticeci.com/categories/transformers
Build Together for Free with Sponsored Contracts on Sort
Tags: ethereum, web3, polygon, webdev
Published: 2023-05-26 17:09:25

_Sponsor a contract address on Sort for only [$9/month](https://sort.xyz/add-contract) and make it free for anyone to use data produced by that contract._

We originally focused on charging each developer that uses Sort, but something didn’t feel right. Charging per developer works very well with traditional applications, **but things are very different in crypto:**

- Protocols and contracts make revenue when they get transactions, driving transactions to a contract is very important
- The more applications built on top of a contract, the more transactions will be generated, and that means more revenue (think about all the applications built on top of the UniSwap contracts)

---

Sort works with crypto projects and protocols to help drive developers to them, via Sort [Sponsored Contracts](https://sort.xyz/contracts).

When a contract is Sponsored on Sort, it is free for anyone to use data produced by that contract: SQL, push notifications, NFT metadata, and more. **The contract author gets two large benefits:**

- **Sort is their backend-as-a-service**, no need to host servers anywhere (we’ll even give you disposable read-only API keys)
- Incentive the community, let them build applications using contract data **for free**!

---

For instance, let’s look at the currently Sponsored contracts:

An [API call to get latest transactions](https://docs.sort.xyz/reference/createabi) is free, using a demo API key:

```
const response = await fetch('https://api.sort.xyz/v1/queries/run', {
    method: 'POST',
    headers: {
      'x-api-key': "ec2fa3f2-7fdc-4342-9ebc-95f8b2bd7d21",
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      "query": "SELECT token_id as id, metadata_content FROM ethereum.nft_metadata WHERE contract_address = '0x887f3909c14dabd9e9510128ca6cbb448e932d7f'"
    }),
  })

const full_response = await response.json();
```


Or use a [Sort React Component](https://docs.sort.xyz/docs/latest-transactions) to show latest transactions for the contract, for free:

```
<LatestTransactions  
contract_address="0x887f3909c14dabd9e9510128ca6cbb448e932d7f"
  api_key="ec2fa3f2-7fdc-4342-9ebc-95f8b2bd7d21"
  theme="dark"
  blockchain="ethereum"
/>
```

Check out [Sponsored Contracts](https://sort.xyz/contracts) on Sort, or Sponsor a contract address for only $9/month and make it free for anyone to use.
I have created a json inspecting tool. What do you think?
Tags: webdev, javascript, programming, react
Published: 2023-05-26 16:38:39

As a back-end developer, when someone ask me why something doesn't work on the UI or something in particular doesn't show incorrect data on the UI. The first thing i do is to open the Developer Console on the browser and capture the response from the API. Then i inspect that JSON and find some particular field doesn't meet the requirements or the data doesn't meet some specific criteria.

The thing is, inspecting the data using the browser "Ctrl+F" shortcut or copy the whole JSON string then go to VScode or some online json formatter just to find out you have to go through each item in the array of 10 items but has lots of field is very painful. There are other cases where you want to sum a particular field of an array just to get the sum so you could tell if the Front-end guy is calculating the whole thing incorrectly or you are which i find Ctrl+f and json formatter doesn't help at all. So, i created an web app using React js to solve this problem.

Basically, this website let you input the raw json string and do quick filter, mapping, counting on the provided string in a pipeline fashion. Here's some screenshots

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

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


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

Here's the link to the page: [https://json-pipe.pages.dev/](https://json-pipe.pages.dev/)
This is just the prototype of the project, i will add more feature to make it able to perform complex operators, please tell me what you think and what i should improve 😉.
15 VS code Shortcuts
Tags: vscode, programming, webdev, javascript
Published: 2023-05-26 17:04:24

15 useful shortcuts for Visual Studio Code (VS Code) that helps me alot 🙌:

1. **Ctrl + B**: Toggle the sidebar visibility.

2. **Ctrl + `**: Toggle the integrated terminal.

3. **Ctrl + P**: Quick open a file by name.

4. **Ctrl + Shift + N**: Create a new file.

5. **Ctrl + Shift + W**: Close the current editor.

6. **Ctrl + W**: Close the current tab.

7. **Ctrl + Shift + T**: Reopen closed tab(s).

8. **Ctrl + /**: Toggle line comment/uncomment.

9. **Alt + Up/Down**: Move the current line up or down.

10. **Alt + Shift + Up/Down**: Copy the current line up or down.

11. **Ctrl + Shift + \\**: Jump to matching bracket.

12. **Ctrl + Shift + L**: Select all occurrences of the current selection.

13. **Ctrl + Shift + K**: Delete the current line.

14. **F12**: Go to the definition of a symbol.

15. **Ctrl + Shift + F**: Search for text in the entire workspace.

These shortcuts can greatly enhance your productivity when using Visual Studio Code as your code editor of choice.
Who's looking for open source contributors? (week 43)
Tags: discuss, opensource, contributorswanted
Published: 2023-05-26 17:00:00

---
title: Who's looking for open source contributors? (week 43)
published: true
description: Discover which opensource projects are actively seeking contributors. Learn how you can make a meaningful contribution to the open source community and gain valuable experience. Find out who's looking for opensource contributors now.
tags: discuss, opensource, contributorswanted
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
published_at: 2023-05-26 17:00 +0000
---
Restarting something Ben was doing for a while, and we plan on doing this every Friday! 

Open Source is about the community. Whether you have a project or you're looking to make your first PR.  

## Tell us about your project
_Promote your project by providing a link to the repo. Everyone who posted in previous weeks is welcome back this week, as always 😄_

Open Source should be a welcoming space for contributors. The README is the front door of your project. If you'd like to check out an example of a README, here's our [OpenSauced/insights README](https://github.com/open-sauced/insights).

If you submit please have the following in your repo to make it welcoming and helpful for contributors:

1. README.md
2. CONTRIBUTING.md

Feel free to drop your issues and repos in the [OpenSauced Discord](https://discord.gg/opensauced) #:eyes:-looking-for-contributors channel at any time! Finally, consider reading the [Best Practices for Maintainers](https://opensource.guide/best-practices/).

Happy coding!
Actionable Harsh environment transformer Tips That Work Like a Charm
Published: 2023-05-26 16:56:05

1.	Mechanical Durability: Harsh environments can subject components to mechanical stress, shock, and vibration. Harsh environment transformers are engineered with robust mechanical structures, vibration-resistant designs, <a href="https://www.quanticeci.com/categories/transformers">harsh environment transformer</a> and mounting methods to withstand these conditions. They are designed to resist mechanical damage, maintain electrical integrity, and prevent insulation breakdown.
2.	Corrosion Resistance: In industries such as oil and gas or chemical processing, transformers may be exposed to corrosive substances or chemicals. Harsh environment transformers employ specialized materials, coatings, and insulation systems that provide resistance to chemical exposure, preventing corrosion and degradation of performance over time.

Get More Detail On This Website >>>> https://www.quanticeci.com/categories/transformers
2667. LeetCode's Create Hello World Function - Extremely Simple One line JS Solution Beats 99% in Runtime
Tags: javascript, programming, tutorial, leetcode
Published: 2023-05-26 16:24:35

For a more in-depth explanation, please view my LeetCode solution: https://leetcode.com/problems/create-hello-world-function/solutions/3565497/create-hello-world-function-extremely-simple-one-line-js-solution-beats-99-in-runtime/

# Intuition
The problem is to create a function that returns another function that always returns “Hello World”. This is an example of a higher-order function, which is a function that can take another function as an argument or return another function as a result.

# Approach
To create a higher-order function in JavaScript, we can use the function keyword to define both the outer and inner functions. The outer function does not take any arguments and returns the inner function. The inner function takes any number of arguments using the rest parameter syntax (…args) and returns the string “Hello World”.

# Complexity
- Time complexity: $$O(1)$$

- Space complexity: $$O(1)$$

# Code
```javascript
/**
 * @return {Function}
 */
var createHelloWorld = function() {
    return function(...args) {
        return "Hello World"
    }
};

/**
 * const f = createHelloWorld();
 * f(); // "Hello World"
 */
```

My LeetCode Solutions: https://leetcode.com/VerisimilitudeX/
Best Method to create Lightweight CSS File
Tags: css, javascript, html, python
Published: 2023-05-26 11:56:23

---

Certainly! Creating a lightweight CSS framework involves focusing on essential features, optimizing performance, and keeping the codebase minimal. Here's a basic example of how you can create a lightweight CSS framework:



Normalize CSS:
Include a CSS reset or normalize.css to establish consistent default styles across different browsers.

Grid System:
Implement a lightweight grid system to handle layout and responsiveness. Here's an example of a simple grid system
`.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px;
}

.column {
  width: 100%;
  padding: 0 10px;
  
  @media (min-width: 768px) {
    width: 50%;
  }
  
  @media (min-width: 1024px) {
    width: 33.33%;
  }
}
`

Forms:
Define basic styles for form elements such as input fields, checkboxes, and radio buttons. Focus on making them visually consistent and user-friendly.

Responsive Utilities:
Include a set of responsive utility classes that can be used to modify the behavior of elements at different screen sizes. For example, you can create classes like .hide-on-mobile or .show-on-desktop to control visibility. [Ehsaas Rashan Program 8123](https://ehsaasweb.com/ehsaas-rashan-program/)
Postgres and PostGIS Installation
Tags: apacheage, programming, postgressql, tutorial
Published: 2023-05-26 15:53:50

# Install postgres 14 version

```bash

# Install dependencies 
sudo apt install build-essential libreadline-dev zlib1g-dev libssl-dev libxml2-dev libxslt-dev

# Download postgres 14
curl -OL https://ftp.postgresql.org/pub/source/v14.0/postgresql-14.0.tar.gz

# Extract the file
tar xvf postgresql-14.0.tar.gz

cd postgresql-14.0

# Configure the build
./configure --prefix=/usr/local/pgsql

# Run make
make

# Run make install
sudo make install
```

## Steps to install POSTGIS

Download: [POSTGIS LINK](https://postgis.net/source/)

You will also need to install and/or build:

- GEOS
- Proj
- GDAL
- LibXML2
- JSON-C

### GEOS

[GEOS WEBSITE](https://libgeos.org)

```bash
# Download GEOS
curl -OL https://download.osgeo.org/geos/geos-3.10.2.tar.bz2

# Extract the file
tar xvfj geos-3.11.2.tar.bz2

# Create a build directory
mkdir build-dir

# Change to the build directory
cd build-dir

# Run cmake
cmake ../geos-3.11.2 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local

# Run make
make 

# Test the build
ctest
# 100% tests passed, 0 tests failed out of 431

# Run make install
sudo make install
```

### Proj

[PROJ WEBSITE](https://proj.org)

```bash

# Download proj
curl -OL https://download.osgeo.org/proj/proj-9.1.1.tar.gz

# Extract the file
tar xvf proj-9.1.1.tar.gz

# Create a build directory
mkdir build-dir

# Change to the build directory
cd build-dir

## Need to install sqlite 
# SQLite3 >= 3.11: headers and library for target architecture, and sqlite3 executable for build architecture.
sudo apt install sqlite3 
sudo apt-get install libsqlite3-dev
sudo apt-get install libtiff-dev

sudo apt update && sudo apt upgrade && sudo apt install curl && sudo apt-get install libcurl4-openssl-dev

# Run cmake
cmake ..

# Run make
cmake --build .

# Run make install
sudo cmake --build . --target install
```

### GDAL

[GDAL WEBSITE](https://gdal.org)

```bash
# Download GDAL
curl -OL https://github.com/OSGeo/gdal/releases/download/v3.6.4/gdal-3.6.4.tar.gz

# Extract the file
tar xvf gdal-3.6.4.tar.gz

# Create a build directory
mkdir build-dir

# Change to the build directory
cd build-dir

# Run cmake
cmake ../gdal-3.6.4
```

```bash
# Run make
cmake --build .

# Run make install
sudo cmake --build . --target install
```

## POSTGIS

```bash

wget http://postgis.net/stuff/postgis-3.3.3dev.tar.gz
tar -xvzf postgis-3.3.3dev.tar.gz
cd postgis-3.3.3dev

# configure the build
./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config --without-protobuf

# Run make
make

```

## Install AGE Extension

```bash

# Install Dependencies
sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison

# Download Postgres 14
sudo apt install postgresql-14 postgresql-server-dev-14

# check the version
pg_config

# Run make
sudo make install 

# Run make install
sudo make PG_CONFIG=/path/to/postgres/bin/pg_config install

```