teleren/devto huggingface dataset:
23. Merge k Sorted Lists
Tags: leetcode, hard, linkedlist
Published: 2023-10-05 04:45:39

Problem: [23. Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/description/)

<strong>Solution</strong>

If you are able to solve the merge 2 sorted linked list, you will be able to do this

By spliting k lists into groups of a pair of linked lists, we can merge each pair, then repeat the process until there is only one big sorted list left to be returned.
Remember to handle edge case like when there is no linked list in the list at all then we should be good.

```java

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution {
    public ListNode merge2Lists(ListNode node1, ListNode node2) {
        ListNode dummy = new ListNode(-1);
        ListNode dummyCurrent = dummy;
        ListNode current1 = node1;
        ListNode current2 = node2;

        while (current1 != null && current2 != null) {
            if (current1.val <= current2.val) {
                dummyCurrent.next = current1;
                current1 = current1.next;
            } else {
                dummyCurrent.next = current2;
                current2 = current2.next;
            }
            dummyCurrent = dummyCurrent.next;
        }

        while (current1 != null) {
            dummyCurrent.next = current1;
            current1 = current1.next;
            dummyCurrent = dummyCurrent.next;
        }

        while (current2 != null) {
            dummyCurrent.next = current2;
            current2 = current2.next;
            dummyCurrent = dummyCurrent.next;
        }

        return dummy.next;
    }
    public ListNode mergeKLists(ListNode[] lists) {
        if (lists.length == 0) {
            return null;
        }

        List<ListNode> initialList = new ArrayList<>();
        for (ListNode node: lists) {
            initialList.add(node);
        }

        while (initialList.size() > 1) {
            List<ListNode> newList = new ArrayList<>();
            int idx = 0;
            while (idx < initialList.size()) {
                if (idx == initialList.size() - 1) {
                    newList.add(initialList.get(idx));
                    idx ++;
                } else {
                    newList.add(merge2Lists(initialList.get(idx), initialList.get(idx + 1)));
                    idx += 2;
                }
            }
            initialList = newList;
        }

        return initialList.get(0);
    }
}
```
Software Testing
Published: 2023-10-05 04:20:55

## 1. **What is Software Testing?**
Software testing is a process of testing a software product or a application and does what is supposed to do. The benefits of Software Testing includs finding bugs, improving performance and reducing development costs. It qualifies system on different aspects such as usability, accuracy, efficiency, etc.

## 2. **What we need to know about Software Testing?**

Software testing has traditionally been separated from the rest of development. It is often conducted later in the software development life cycle, after the product build or execution stage. Then, if defects are found, there isn't much time left for fixing or retesting. Therefore, many development teams now use a methodology known as continuous testing, which means that development and testing collaborate over the entire product life cycle. With this testing technique teams don't need to wait for the software to be built before testing starts. They can run tests much earlier in the cycle to discover defects sooner when they are easier to fix.

## 3. **What is the relevance of Software Testing?**

Software testing helps the product pass quality assurance (QA) and meet the criteria and specifications defined by the users. Increases customer trust and satisfaction.
Color Theories in Vector Iconography: Decoding the Palette
Published: 2023-10-05 03:18:16


In the age of digital aesthetics, vector icons stand out as both functional markers and design elements. Their simplicity offers clarity, but it's often their color that communicates mood, intention, and function. Diving deep into the color theories in vector iconography, we find a complex interplay of psychology, culture, and design principles.

The Psychological Palette
Colors are more than just visual elements; they evoke emotions, memories, and reactions:

Red: Often associated with urgency, excitement, or danger. In iconography, red might be used for notifications, alerts, or to draw immediate attention.

Blue: Symbolizes trust, calmness, and reliability. Common in corporate and social media icons, it promotes a sense of security and professionalism.

Green: Represents growth, freshness, and success. It's commonly used in finance-related apps or to indicate a positive action or outcome.

Yellow: Evokes feelings of happiness, caution, and curiosity. In icons, it might signal warnings or denote something that requires attention.

Black and White: These neutral tones often denote classic, timeless designs. They can be found in minimalist interfaces or to provide contrast.

Functional Implications
The choice of color in [vector icons](https://icons8.com/icons/set/vector) is crucial in guiding user behavior:

Visibility and Contrast: Colors need to stand out against varying backgrounds. A high contrast ensures that the icon is noticeable and accessible.

Consistency: Using a consistent color palette throughout a digital platform can guide users, with specific colors representing specific actions or sections.

Highlighting Change: A shift in color can indicate a change in status or a completed action, such as an unread email icon turning from bold to muted once read.

Cultural Nuances
It's important to remember that [color](https://colorpalette.wiki/) interpretations can vary across cultures:

Red: While it's a color of warning or danger in many Western cultures, it represents luck and prosperity in many Eastern ones.

Green: Often associated with 'go' or positive actions in many cultures due to its association with traffic lights, but it's also linked with inexperience or immaturity in some contexts.

Trends and Adaptability
Vector icons need to be adaptable, especially when considering dark mode or themed interfaces:

Adaptive Icons: Many modern icons can shift colors based on the background, ensuring visibility and aesthetic harmony.

Trend Influence: Design trends, such as gradients or neon palettes, influence icon colors. While trends are temporary, they reflect the zeitgeist of design preferences.

Color choices in vector iconography go beyond just aesthetics; they're about communicating, guiding, and influencing users. As designers, understanding the nuanced implications of color theories is essential in crafting effective, resonant, and universally understood icons. In a world where quick decisions are often made based on icon prompts, the shade, tint, or tone can make all the difference.
Analisa emas hari ini
Tags: forex, analytics, javascript
Published: 2023-10-05 03:46:27

[Analisa emas hari ini](https://www.foreximf.com/analisa-forex/xau-usd) menyajikan berbagai referensi terlengkap tentang outlook teknikal emas, rencana trading emas, dan pergerakan emas terkini.
Ada dua analisis yang bisa Anda lakukan untuk memprediksi emas yakni, dengan cara: 
1.	Analisa Teknikal
Analisis yang menggunakan beberapa jenis char misalnya candlestick, trend line, dan lainnya. Analisis ini akan melihat pergerakan harga emas melalui chart pada platform trading dan mencoba membentuk pola-pola tertentu untuk memprediksi pasar. 
2.	Analisis Fundamental
Anda harus membaca berita atau informasi yang berkaitan dengan emas. Pergerakan harga emas ini dipengaruhi oleh fenomena perekonomian yang terjadi di suatu negara, misalnya kenaikan tingkat suku bunga, nilai tukar uang, dan kondisi perekonomian di negara – negara besar.
Content Security Policy- Basic Knowledge To Understand How It Work.
Published: 2023-10-05 01:25:12

```
<!DOCTYPE html>
<html lang="en">

        <head>
                <meta charset="UTF-8">

                <?php
                        $nonce = base64_encode(random_bytes(16));
                        header("Content-Security-Policy: default-src 'self' www.youtube.com play.google.com cdnjs.cloudflare.com;font-src 'self' cdnjs.cloudflare.com fonts.googleapis.com;script-src 'strict-dynamic' 'nonce-$nonce' cdnjs.cloudflare.com; style-src 'strict-dynamic' 'nonce-$nonce' cdnjs.cloudflare.com fonts.gstatic.com; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; frame-src 'self' www.youtube.com");
                        header("Permissions-Policy: accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()");
                        $pin1 = hash("sha256", "test");
                        $pin2 = hash("sha256", "tost");
                        header("Public-Key-Pins: pin-sha256=\"$pin1\"; pin-sha256=\"$pin2\"; max-age=31536000; includeSubDomains");
                        header("X-Frame-Options: SAMEORIGIN");
                        header("X-XSS-Protection: 1; mode=block");
                        header("X-Content-Type-Options: nosniff");
                        header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload");
                ?>
                <meta name="viewport" content="width=device-width, initial-scale=1">

              <link rel="stylesheet" nonce="<?php echo $nonce ?>" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" />
             

        <title>CSP TEST</title>

        </head>


          <h1 style="font-family:'Reem Kufi',san-serif"> چونتنت سچوريتي ڤوليچي /  داسر كسلامتن كندوڠن </h1>

          <h2>Laman ini digunakan untuk menguji Content Security Policy/ Dasar Keselematan Kandungan</h2>

          <i class="fa-brands fa-youtube"></i> <br/>

<!--
<iframe width="560" height="315" src="https://www.youtube.com/embed/m1KM_DxQXWM?si=xVSUJysB-lNmUUMe&amp;controls=0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>-->

          <br/>

          <i class="fa-solid fa-tower-cell"></i><br/>

<script nonce="<?php echo $nonce ?>"  >
   
</script>
       </body>
</html>

```

CSP can be added in code, .htaccess , on the nginx vhost. It depends on the developemnt team to determine the best method to place CSP meta in the system.
Dia 8 - #100DaysOfSwift
Tags: ios, swift
Published: 2023-10-05 01:05:12

###Diferença de Struct e Tupla
Ambas tem comportamentos semelhantes, mas a struct leva um nome e a tupla não, por isso structs são melhores pra ser usadas em casos que você precisa usar a mesma estrutura de variáveis mais de uma vez.

---

###Diferença de propriedade armazenada e computada e quando usar cada uma
**Propriedade armazenada:** Valor é armazenado na memória pra ser usado depois.

- Se for lida regularmente e o valor não depender de outras propriedades.

**Propriedade computada:** Valor é recomputado toda vez que é chamado, nada mais é do que uma chamada de função que pertence à Struct. 

- Se a propriedade é lida raramente é melhor usar esse tipo, evitando o cálculo e armazenamento de algo quase nunca utilizado.
- Se o valor da propriedade depende de valores de outras propriedades, assim você vai ter certeza de que o valor retornado sempre leva em conta o estado mais recente do programa.

> Variáveis computadas criadas dentro de uma struct não podem ter seu valor modificado manualmente, ele só pode ser acessado.

---

###Property Observers(willSet e didSet)
**willSet** é chamado _antes_ do valor ser atribuído a uma propriedade
**didSet** é chamado _depois_ de uma propriedade ter recebido um valor, toda vez que o valor for modificado a ação dentro dele será executada.


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

---

###Métodos
Structs podem ter funções, elas se chamam métodos e eles podem usar as propriedades da struct conforme necessário. Apesar da nomenclatura diferente a palavra reservada pra declaração de métodos é a mesma de uma função: _func_.

###Diferença entre método e função
Métodos pertencem à um tipo(struct, enum, class) e as funções não.
Essa associação à um tipo específico permite que os métodos façam referência a propriedades e métodos dentro do mesmo tipo e diferente das funções os nomes não ficam reservados, reduzindo conflitos de nomes por acidente.

###Métodos mutantes
Para que as propriedades sejam mutáveis é necessário usar a palavra-chave _mutating_ no início do método, mas ao fazer isso o método não poderá mais ser chamado por structs constantes(mesmo se o método nunca tiver mudado suas propriedades).
Um método que não for marcado como mutante não pode chamar uma função mutante, ambos tem que estar marcados pra se relacionar.

---

> Quase todos os tipos principais do Swift são implementados como structs(String, Inteiros, Array, Dictionary, Bool).
Latency 지연시간
Published: 2023-10-05 00:43:03

> - Redis 액세스(100 ns) vs (1 ms)Postgresql 인설트 : 만배 빠름…
> - Redis 액세스 vs SSD Read (k/v DB) : 천배 빠름…

### 1. 개요

- **L1 및 L2 캐시: 1ns, 10ns **
    
    예: 일반적으로 마이크로프로세서 칩에 내장됩니다. 하드웨어를 직접 다루지 않는 이상 하드웨어에 대해 걱정할 필요가 없습니다.
    
- **RAM 액세스: 100ns **
    
    예: 메모리에서 데이터를 읽는 데 약 100ns가 걸립니다. Redis는 메모리 내 데이터 저장소이므로 Redis에서 데이터를 읽는 데 약 100ns가 걸립니다.
    
- **1Gbps 네트워크를 통해 1K 바이트 전송: 10us Send 1K bytes over 1 Gbps network: 10 us**
    
    예: Memcached에서 네트워크를 통해 1KB의 데이터를 전송하는 데 약 10us가 소요됩니다.
    
- **SSD에서 읽기: 100us**
    
    예: RocksDB는 디스크 기반 K/V 저장소이므로 SSD에서 읽기 대기 시간은 약 100us입니다.
    
- **데이터베이스 삽입 작업: 1ms.**
    
    예: Postgresql 커밋에는 1ms가 걸릴 수 있습니다. 데이터베이스는 데이터를 저장하고, 인덱스를 생성하고, 로그를 플러시해야 합니다. 이 모든 작업에는 시간이 걸립니다.
    
- **패킷 보내기 CA->네덜란드->CA: 100ms **
    
    예: 장거리 Zoom 통화가 있는 경우 대기 시간은 약 100ms일 수 있습니다.
    
- **내부 재시도/새로 고침: 1~10초 **
    
    예: 모니터링 시스템에서 새로 고침 간격은 일반적으로 5~10초(Grafana의 기본값)로 설정됩니다.
Rails 7.1 is coming out soon. Infield will upgrade your app with minimal back and forth.
Tags: rails, ruby, react, javascript
Published: 2023-10-05 00:24:41

[Infield](https://www.infield.ai) keeps open source dependencies up to date with a combination of software and human experts. We take on the responsibility of getting you onto the latest versions of your dependencies, safely, even when there are breaking changes. Once you're up to date we'll keep you there as new versions are released. If you've ever considered outsourcing dependency upgrades to a consultant we offer a similar white glove service but with software that makes the process safer and more reliable. Right now we support Ruby and Javascript (with Python and Java coming soon).

Here's how the process works:

1. You grant access to your github or gitlab repo and let us know your priorities (e.g., large framework upgrade; no high+ CVEs)
2. Our software calculates an upgrade plan and estimates the complexity.
3. You get an ongoing series of small, incremental PRs

A little about us - we've been using Rails professionally since 2011 and React since the beta. We've seen all sorts of complicated tech debt and abandoned dependencies, upgraded apps as large as ~500K LOC, and can likely do this faster and more safely than your team.

Send a note to allison@infield.ai if you're interested!
A Realtime location sharing App built with React
Tags: location, apps
Published: 2023-10-27 06:37:58

---
title: A Realtime location sharing App built with React
published: true
date: 2023-10-05 00:04:00 UTC
tags: Location,Apps
canonical_url: https://reactjsexample.com/a-realtime-location-sharing-app-built-with-react/
---

# LocShare: Realtime Location Sharing App
 ![A Realtime location sharing App built with React](https://reactjsexample.com/content/images/2023/10/Code_2023-10_17-59-30.jpg)

![A Realtime location sharing App built with React](https://user-images.githubusercontent.com/31545725/271251815-66d550b7-a7bf-4c3c-9f57-2802097b133c.png)

Built with React.js, Socket.IO, TypeScript, React Leaflet, and Tailwind CSS.

## Key Features

- Share your location instantly and generate dynamic links.
- Real-time location tracking for users with room links.
- Receive notifications when participants join.
- Monitor the number of connected users.
- Automatic room deletion when location sharing stops.
- No authentication required for easy access.

## Demo

[Live Demo](https://locshare.netlify.app/)

## Contributing

Contributions are welcome via issues or pull requests.

## License

This project is under the MIT License.

## GitHub

[View Github](https://github.com/manish-mehra/locshare?ref=reactjsexample.com)
Your Daily Hacks for Staying Super Effective: What's Your Secret Sauce?
Tags: discuss, codenewbie, beginner
Published: 2023-10-05 00:00:00

---
published_at : 2023-10-05 00:00 +0000
---
Share your tips on the daily routines and personal habits that help you stay on top of your game and crush your goals.

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*
The Big-Name Companies Leveraging Next.js
Tags: webdev, nextjs, discuss, react
Published: 2023-10-04 23:23:17

Hey everyone,

I am Rajae, a content creator for the BlueSockets blog on Front-end Web Development. I recently wrote an interesting [article](https://bluesockets.com/next/what-big-companies-use-next-js/) highlighting major companies that have integrated Next.js into their web development arsenal. Next.js, a React-based framework by Vercel, is gaining traction for its ability to craft speedy and reliable web applications.

Here are some notable adopters:

1. **Netflix**: They utilize Next.js to bolster their user interface, optimizing performance and SEO for seamless streaming experiences.

2. **Twitch**: The gaming-centric live streaming platform employs Next.js to ensure top-notch performance for its millions of users, especially when navigating through various streams and channels.

3. **Uber**: For dynamic content delivery like real-time ride updates, Uber turns to Next.js. Its server-side rendering capability contributes to a smoother booking process.

4. **Nike**: Incorporating Next.js into their e-commerce platform, Nike benefits from server-rendered product pages, resulting in quicker load times and improved SEO.

5. **WhatsApp**: Next.js aids WhatsApp in rendering chat interfaces efficiently, crucial for a messaging app serving billions worldwide.


This is just a glimpse! Other major players like Notion, Target, TikTok, and DoorDash are also part of the Next.js user community. You can visit the [article](https://bluesockets.com/next/what-big-companies-use-next-js/) to see more details on the other major companies and don't forget to share with a friend if you found the article useful.

What are your thoughts on these industry giants choosing Next.js? Do you think this trend will continue to grow? Share your insights!

Source: [bluesockets.com/next/what-big-companies-use-next-js/](https://bluesockets.com/next/what-big-companies-use-next-js/)
Data Science For Beginners 2023/2024
Published: 2023-10-04 23:20:17

With the high rise of businesses in recent years especially embracing digitization, there is the need for organizations to leverage on statistical interpretation and data visualization for competitive advantage.

Data science is a multidisciplinary field that involves the use of different techniques, algorithms, processes, and systems to extract insights from data. It combines elements from statistics, computer science, and domain expertise to analyze and interpret data. If you're a beginner interested in learning data science, here's a step-by-step guide to get you started:

**Data Science Basics**

Basic fundamental concepts like data, information including data collection, preprocessing, analysis, and interpretation are key steps to effectively  guide through your journey as a Data Scientist.

**Programing Language You Will Need**

Start by learning Python basics as Python is the basic language for learning data science.Libraries like NumPy, pandas, and Matplotlib for data manipulation and visualization.

**Data Science Life Cycle **

Data Science life cycle involves  different repeated activities a data Scientist must follow. This include;

1. Understanding The Problem
2. Gathering Data
3. Cleaning Data
4. Exploring Data
5. Data Drift and Model  Analysis
5. Data Visualization  
6. Interpreting data 
`https://www.upgrad.com/blog/data-science-life-cycle/`

**Data Cleaning**

Preprocess, and wrangle data. Pandas is an essential library for this purpose.

**Data Visualization:**

Master data visualization tools like Matplotlib and Pandas to create meaningful plots and charts.

**Machine Learning:**

With the basics of machine learning, including supervised and unsupervised learning.
Start with scikit-learn, a popular Python library for machine learning. Also exploratory data analysis (EDA) techniques help  to gain insights from data.Use libraries like pandas,NumPy for EDA.

SQL is a valuable skill for querying relational databases.
Learning how to work with databases, as data is often stored in databases.Exploring big data technologies like Hadoop and Spark if you plan to work with large datasets is a good start.

**Data Science Libraries and Tools:
**
Common libraries and tools used in data science,as Jupyter notebooks and PyTorch for deep learning are effective tools to achieving projects in data science .

**Career Path For Data Science**

1. Data Analyst
2. Data Scientist
3. Data Engineer
4. BI Analyst
5. Machine Learning Engineer (designing Machine Learning algorithm)
6. NLP Engineer

**Conclusion**

At the end of this course, your knowledge on Data Science would have improved more on understanding a beginner's guide on Data Science, how Businesses must leverage on statistical interpretation as data science,career path in data science and the life cycle of data science.