teleren/devto huggingface dataset:
My 3D optimizations skill
Published: 2023-09-12 03:03:43


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

4km square map run at 120 fps on unity editor, 30 fps on android with only roundly 40 pass calls and 300 - 500 batches.
Introduction - Next Js App Directory 13.4
Tags: webdev, nextjs, react, tutorial
Published: 2023-09-12 02:56:57

Next js is The React Framework for the Web which enables you to create full-stack Web applications by extending the latest React features, and integrating powerful Rust-based JavaScript tooling for the fastest builds.

In this series I will share how to master Next Js without knowing React Js before.

## Prerequisite

1. HTML, CSS, JavaScript Fundamentals
2. ES6+ Features
3. Modern JavaScript

## Development Tool

1. Node Js
2. VS Code - Extention ES7+ React/Redux/React-Native snippets

## Installation

```bash
npx create-next-app@latest
```

It's will be quite a long series journey. Hope you enjoy it!
GOOD MORNING STATUS
Published: 2023-09-12 02:54:09

The start of each day brings with it the opportunity to set the tone for what lies ahead. And what better way to do that than with a good morning status message? It allows us to express our gratitude, positivity, and hopes for a fulfilling day. Whether it's an inspiring quote, a simple good morning wish, or a reflection on our blessings, the content we choose for our morning status can have a profound impact on ourselves and those who read it.
**[Website](https://nameboost.blogspot.com/good-morning-status)**
My Intro to coding
Published: 2023-09-12 02:46:57

I've never been a tech savvy person. In high school computers were just starting to become a big thing and my time in the military where computers were only used to do paperwork and email home. I had no idea that the endings of a web address told you the origin of the company such as a non-profit, educational or government site. The different command controls for copy and paste and all the different shortcuts would have made my life so much easier all these years. I always knew that there was so much more to computers and their functionalities and never knew where to start. I am so excited to keep learning the ins and outs of web developing.
I've created the most annoying VS Code extension ever: Crazy Monkey 🐒
Tags: vscode, extensions, github, fun
Published: 2023-09-12 02:39:36

Are you tired of productivity tools that remove all distractions? Do you need something to throw you off your comfort zone? Say hello to [Crazy Monkey, the most annoying VS Code extension ever](https://marketplace.visualstudio.com/items?itemName=thiagobarreto.crazy-monkey).

## Why Crazy Monkey?
When you call the "Start Crazy Monkey" command, a periodic process starts: every X minutes (configurable through the `interval` property) a random line will be added with a small random string (by the "crazy monkey" haha) just to test your attention. Your commit diff will show how focused you really are hahaha.

You can call "Stop Crazy Monkey" whenever you want the periodic process to stop.

## Feedback
I'd love to hear your thoughts, suggestions, and of course, your rants. Comment below or create an issue on [GitHub](https://github.com/thiagocbarreto/vscode-crazy-monkey).

PS.: I created this extension as a learning step on my **VSCode Extension Developer** journey. If you liked it, give the [Coffee Spill](https://marketplace.visualstudio.com/items?itemName=thiagobarreto.coffee-spill) extension a try as well.

Cheers!
Optimizing Prime Checks with Go (Golang)
Tags: go, programming, problemsolving
Published: 2023-09-12 02:14:08

The efficiency of the prime-checking algorithm can be improved by only checking for divisibility up to the square root of the number, as any factor larger than that would necessarily pair with a factor smaller than the square root. Here's a more efficient version of the isPrime function:

```go
package main

import (
	"fmt"
	"math"
)

func isPrime(n int) (bool, string) {
	// 0 and 1 are not prime
	if n == 0 || n == 1 {
		return false, fmt.Sprintf("%d is not prime, by definition!", n)
	}

	// negative numbers are not prime
	if n < 0 {
		return false, "Negative numbers are not prime, by definition!"
	}

	// Special case: 2 is prime
	if n == 2 {
		return true, fmt.Sprintf("%d is a prime number!", n)
	}

	// Any even number other than 2 is not prime
	if n%2 == 0 {
		return false, fmt.Sprintf("%d is not a prime number because it is divisible by 2", n)
	}

	// Check only up to the square root of n and only check odd divisors
	sqrtN := int(math.Sqrt(float64(n)))
	for i := 3; i <= sqrtN; i += 2 {
		if n%i == 0 {
			return false, fmt.Sprintf("%d is not a prime number because it is divisible by %d", n, i)
		}
	}

	return true, fmt.Sprintf("%d is a prime number!", n)
}

func main() {
	// Example usage
	num := 29
	isPrimeNum, msg := isPrime(num)
	fmt.Println(msg)
}
```

## Key Points:

- **Checking only up to square root of n**: After considering the special cases, the loop only checks divisibility for numbers up to sqrt(n).

- **Skipping even numbers**: Since we've already checked for n = 2 as a special case, and any other even number will be divisible by 2 and hence not prime, we can safely start the loop at 3 and increment by 2. This way, we only check odd numbers as potential divisors.

## FAQ: Why Checking only up to square root of `n`?
The reasoning for checking only up to the square root of `n` when determining if `n` is prime is based on the properties of factors.

Imagine if `n` is divisible by a number `x` which is greater than the square root of `n`. Then, there must also be another number y such that: `X x Y = n`

Now, since `x` is greater than the square root of `n`, `y` must be smaller than the square root of `n` for their product to be `n`. Think of it this way: if both `x` and `y` were greater than the square root of `n`, their product would exceed `n`. Similarly, if both were less than the square root of 
`n`, their product would be less than `n`.

So, if `n` has a factor greater than its square root, it will also have a factor smaller than its square root. This is why, to determine if `n` is prime, we only need to check for factors up to and including its square root. If we haven't found any factors in that range, then `n` doesn't have any factors and is therefore prime.

To illustrate, let's use a number, say n=100. The square root of 100 is 10. If `n` has a factor greater than 10 (like 20), it will necessarily have a corresponding factor smaller than 10 (like 5, since 20 x 5 = 100). By checking up to 10, we'll catch the factor of 5, so we don't need to check factors greater than 10.
SQL 📊 challenge_2⚔️
Tags: sql, beginners, devops
Published: 2023-09-12 02:13:52

## Page With No Likes Facebook SQL Interview Question

- Assume you're given two tables containing data about Facebook Pages and their respective likes (as in "Like a Facebook Page").
- Write a query to return the IDs of the Facebook pages that have zero likes. 
- The output should be sorted in ascending order based on the page IDs.


####⚠️Note:

- You have to visit the task URL to fully understand what the task needs if you want to add a solution or test your solution.

###### Task URL: [Link](https://datalemur.com/questions/sql-page-with-no-likes)


## My Solution:

```
SELECT 
    p.page_id 
FROM
    pages p 
LEFT JOIN 
    page_likes l
ON
    p.page_id = l.page_id
GROUP BY 
    p.page_id
HAVING
    COUNT(l.page_id) = 0;
```


### Code Snapshot:


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

#### My Problem 💡 Solving Repo: [Link](https://github.com/mahmoudessam820/Python-JavaScript-Programming-Exercises-)


### Learn SQL 📊


###### SQL 🔥 Get Expertise in SQL with These Top Free Courses💯🏆

🎥 {% youtube 00loCpVmozI%}


### Connect with Me 😊

#### 🔗 Links

[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)

[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/Mahmoud42275)
Solving "Move Zeroes" Leet code Question.
Tags: discuss, programming, java, beginners
Published: 2023-09-12 02:11:33

## 283. Move Zeroes
Type: Easy
Liked by 15.2K
Disliked by 380.

**Companies that asked this question**
_Companies: No of times asked_
Yandex 8
Apple 3
Amazon 3
Facebook 11
Bloomberg 6
Google 4
Adobe 3
Microsoft 2
Uber 2
Oracle 2
Splunk 2
Tesla 2
tcs 6
Expedia 4
VMware 3
Goldman Sachs 3
ByteDance 3
JPMorgan 3
TikTok 3
LinkedIn 2
Yahoo 2
IBM 2
Morgan Stanley 2
ServiceNow 2
Salesforce 2
Zoho 2
Infosys 2
Nvidia 2
Samsung 2
Wix 1

Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.

Note that you must do this in-place without making a copy of the array.

**Example 1:**
Input: nums = `[0,1,0,3,12]`
Output: `[1,3,12,0,0]`

**Example 2:**
Input: nums = `[0]`
Output: `[0]`
 

**Constraints:**

`1 <= nums.length <= 104`
`-231 <= nums[i] <= 231 - 1`


# Intuition
We want to move all the `zeros` to the end of the `array` while keeping the `non-zero` elements in their relative order.

# Approach
We maintain `two pointers: i` to iterate through the `array` and `nonZeroIndex` to keep track of the `position` where we should insert non-zero elements. When we encounter a non-zero element, we `swap` it with the element at nonZeroIndex and then increment nonZeroIndex.

# Complexity
**Time complexity:**
The code iterates through the array once, so the time complexity is   `O(n)`, where `n` is the length of the array.

**Space complexity:**
The code uses a constant amount of extra space, so the space complexity is `O(1)`.

# Code
```
class Solution {
    public void moveZeroes(int[] nums) {
        int nonZeroIndex = 0; 
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0) {
                int temp = nums[i];
                nums[i] = nums[nonZeroIndex];
                nums[nonZeroIndex] = temp;
                nonZeroIndex++; 
            }
        }
    }
}

```

Happy coding,
shiva
How to Log Locally in Python
Tags: python, beginners, learning, coding
Published: 2023-09-12 02:06:34

# How to Log Locally in Python

Logs play a pivotal role in debugging, error tracking, and monitoring code execution. Python offers a built-in logging library that simplifies log output. In this article, we'll delve into the process of logging locally in Python.

## 1. Importing the Logging Library

To kick things off, begin by importing the `logging` library, a part of Python's standard library designed to support logging functionality.

```python
import logging
```

## 2. Configuring Logging

The configuration of logging encompasses specifying where logs should be directed, setting the log level, and defining the log message format. Here's a fundamental logging configuration:

```python
logging.basicConfig(filename='app.log', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
```

- `filename`: This denotes the file where logs will be recorded. Feel free to alter this to match your preferences.
- `level`: The log level, with options such as DEBUG (the most detailed), INFO, WARNING, ERROR, and CRITICAL (the most critical). Select the appropriate level based on your application's needs.
- `format`: This dictates the log message format. In this example, it includes a timestamp, log level, and message, but it's customizable according to your requirements.

## 3. Logging Messages

To log messages, leverage the `logging` library for generating log messages.

```python
logging.debug('This is a debug message.')
logging.info('This is an info message.')
logging.warning('This is a warning message.')
logging.error('This is an error message.')
logging.critical('This is a critical error message.')
```

## 4. Logging in Action

Here's a practical illustration. Each time this program runs, it appends logs to the 'app.log' file.

```python
import logging

logging.basicConfig(filename='app.log', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')

def main():
    logging.debug('The program has started.')
    # Insert your program code here

if __name__ == '__main__':
    main()
    logging.info('The program has terminated successfully.')
```

This allows you to track your program's progress using logs and identify errors when necessary.
Japan's nuclear sewage was discharged into the sea
Published: 2023-09-12 02:04:34

Why do European and American countries respond flatly to the discharge of nuclear-contaminated water by the Fukushima nuclear power plant in Japan? The fact is that the media in European and American countries are all silent and do not broadcast it at all. Interviewed 20 people, but only the little brother from South Korea knew about it and strongly resisted it.
  #Nuclear  #NuclearWastewater
Refactoring Ruby: Extract Variable
Tags: refactoring, ruby
Published: 2023-09-12 01:49:07

---
title: Refactoring Ruby: Extract Variable
published: true
description: Extract Variable is a method to add clarity to your ruby methods.
tags: refactoring, ruby
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-05-12 19:28 +0000
---
Let’s take a look at a simple way to add clarity to your Ruby methods: _Extract Variable_ or _Introduce Explaining Variable_. It's probably one of the least invasive refactoring methods. However, don’t let the simplicity fool you; any clarity or explicitness gained is well worth the change.

When you have complex expressions grouped together in a method, it's best to describe them as clearly and verbosely as necessary using the _Extract Variable_ technique. Let's apply this approach to the `Movie#total_price` method in the code example below:

```Ruby
class Movie
  TAX_PERCENTAGE = 0.5

  def initialize(price:, discount_percentage: 0)
    @price = price
    @discount_percentage = discount_percentage
  end

  def total_price
    # BAD
    price + (price * TAX_PERCENTAGE) - (price * (discount_percentage / 100.0))
  end

  private

  attr_reader :price, :discount_percentage
end
```

```Ruby
class Movie
  TAX_PERCENTAGE = 0.5

  def initialize(price:, discount_percentage: 0)
    @price = price
    @discount_percentage = discount_percentage
  end

  def total_price
    # GOOD
    tax = price * TAX_PERCENTAGE
    discount = price * (discount_percentage / 100.0)

    price + tax - discount
  end

  private

  attr_reader :price, :discount_percentage
end
```
The bad version looks like:
```Ruby
def total_price
  # BAD
  price + (price * TAX_PERCENTAGE) - (price * (discount_percentage / 100.0))
end
```
While you can deduce that this method returns the total price of a movie, it takes too much effort to understand _how_ it does so.

To improve this method, we'll apply the _Extract Variable_ pattern:

```Ruby
def total_price
  # GOOD
  tax = price * TAX_PERCENTAGE
  discount = price * (discount_percentage / 100.0)
  
  price + tax - discount
end
```
In the improved "good" version, we introduce two explaining variables: `tax` and `discount`. 

Now, at a glance we know the total price of a movie consists of `price + tax — discount`, and we now have clear, concise descriptions of those complex expressions.

By applying the _Extract Variable_ refactoring pattern, we've made the code more readable and understandable, enhancing its overall clarity.
Bleeding-edge Project Using Everything New In Next.js 13📚
Tags: nextjs, react, webdev
Published: 2023-09-12 01:25:58

Project using bleeding-edge stack. Drizzle ORM + Neon postgres + Clerk auth + Shadcn/ui + everything new in Next.js 13 (server components, server actions, streaming ui, parallel routes, intercepting routes). Fully edge runtime deployed. I wrote a breakdown and talked about some tricky / difficult things while building this project. This will be a good reference project for people looking to learn Next.js app router. Project uses 100% server actions and include features such as ability to search show catalog, SaaS subscription service with Stripe, optimistic update, and infinite scrolling.

Repo: https://github.com/Apestein/nextflix

Live: https://nextflix-blush.vercel.app/
Gerencie várias chaves SSH para diferentes contas do GitHub
Tags: github, git, security, braziliandevs
Published: 2023-09-12 01:12:46

Se você possui várias contas do GitHub por exemplo, uma para seus projetos pessoais e outra para o seu trabalho é difícil usar o SSH para ambas. Você normalmente precisaria de máquinas separadas para autenticar em diferentes contas do GitHub.

Mas isso pode ser resolvido facilmente, configurando o arquivo de configuração do SSH.

Seguimos:

**Crie outro par de chaves SSH e adicione-o à sua outra conta do GitHub. Lembre-se do nome do arquivo ao qual você está atribuindo a nova chave.**

```bash
ssh-keygen -t ed25519 -C "trabalho@email.com"
```

**Crie o arquivo de configuração do SSH. O arquivo de configuração informa ao programa ssh como ele deve se comportar. Por padrão, o arquivo de configuração pode não existir, portanto, crie-o dentro da pasta .ssh:**

```bash
$ touch ~/.ssh/config
```
**Modifique o arquivo de configuração SSH. Abra o arquivo de configuração e cole o código abaixo:**

```
# Conta GitHub para o dia-a-dia

Host github.com
  HostName github.com
  IdentityFile ~/.ssh/nome_chave
  IdentitiesOnly yes

# Conta para trabalho
Host github-work
  HostName github.com
  IdentityFile ~/.ssh/nome_chave_trabalho
  IdentitiesOnly yes
```
Assim, quando você precisa se autenticar via SSH usando sua conta de trabalho ou secundária, você ajusta endereço SSH:

```
git@github.com:conta_github/project.git
```
para

```
git@github-work:conta_github/project.git
```
TIL: How to use the require syntax in .mjs files
Tags: javascript, node, webdev, beginners
Published: 2023-09-12 00:54:35

I'm looking for time part time work by the way! Email me at [cpe.austria.johncarlo@gmail.com](mailto:cpe.austria.johncarlo@gmail.com)

In a tweet about kentcdodds, someone tweeted out that you can use the require syntax by importing the createRequire from the `node:module` API, the snippet and the tweet below is how the function is used:

{% embed https://twitter.com/remcohaszing/status/1700525537075003779 %}

But do note that it does need "module": "NodeNext" in your tsconfig.json for it to work.
Phalcon v5.3.1 Released
Tags: phalcon, phalcon5, release
Published: 2023-09-12 13:00:24

---
title: Phalcon v5.3.1 Released
published: true
date: 2023-09-12 00:01:02 UTC
tags: phalcon,phalcon5,release
canonical_url: 
---

We are happy to announce that Phalcon v5.3.1 has been released!

This release fixes a couple of nemory leaks found in the framework, in particular when using it alongside Swoole.

A huge thanks to our community for helping out with bug fixing and more importantly bug reporting!

## Changelog

### Fixed

- Fixed infinite save loop in `Phalcon\Mvc\Model::save()` [#16395](https://github.com/phalcon/cphalcon/issues/16395)
- Fixed undefined column with columnMap and model caching [#16420](https://github.com/phalcon/cphalcon/issues/16420)
- Fixed memory leak in `Phalcon\Mvc\Router::handle()` [#16431](https://github.com/phalcon/cphalcon/pull/16431)

## Upgrade

Developers can upgrade using PECL

```
pecl install phalcon-5.3.1

```

To compile from source, follow our [installation document](https://docs.phalcon.io/5.0/en/installation)
TIL: The CSS order Property Requires Each Grid/Flex Item to be ordered
Tags: css, flex, grid
Published: 2023-09-18 09:19:40

---
title: TIL: The CSS order Property Requires Each Grid/Flex Item to be ordered
published: true
date: 2023-09-12 00:00:00 UTC
tags: css,flex,grid
canonical_url: https://techhub.iodigital.com/articles/css-order-rule
---

I was today years old when I learned something new about the CSS `order` property. I didn't learn about the existence of the property today, mind you. I just learned about a constriction which, in my opinion, makes it a little bit less usable. You see... when you want to `order` a `flex` or `grid` item, you have to `order` all of them. You can't just `order` one of them. Let me show you what I mean.

According to its [formal definition on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/order#formal_definition), `order`'s inital value is `0` (zero).

When you `order` an item, it will be visually ordered according to its value compared to its siblings's `order` value. Any item with the same `order` value will be visually ordered by its place in the DOM. Have a look at this example:

```html
<style>
  .flex-container {
    display: flex;
  }
</style>
<div class="flex-container">
  <div class="flex-item">Item 1</div>
  <!-- order: 0 // default -->
  <div class="flex-item">Item 2</div>
  <!-- order: 0 // default -->
  <div class="flex-item" style="order: 1">Item 3</div>
  <!-- order: 1 // explicitly assigned -->
</div>

<!-- Expected visual result -->
Item 1 Item 3 Item 2

<!-- Actual visual result -->
Item 1 Item 2 Item 3

```

You would expect `Item 2` and `Item 3` to be visually swapped. However, they are not swapped, despite `Item 3` having an `order: 1`. Sort of like zero-index Arrays, 1 comes after 0. If you want to actually `order` one item, you have to `order` all of them. This is true for both `flex` and `grid`.

To order any element, you have to order all of them. This is not a big problem, as you usually generate lists of items with a loop (like `v-for` in Vue or `*ngFor` in Angular or `Array.prototype.map` in JSX). You can easily retrieve the current iteration index and use that for `order`. It's just weird to me that it is necessary. I would expect `order` to have a default value of `auto`, making the visual order default to the DOM order.

So, to make sure that `Item 3` is visually ordered _before_ `Item 2`, you have to explicitly set `order: 2` on `Item 2` (or any value higher than `1`).

```html
<div class="flex-container">
  <div class="flex-item" style="order: 1">Item 1</div>
  <div class="flex-item" style="order: 2">Item 2</div>
  <div class="flex-item" style="order: 1">Item 3</div>
</div>

<!-- Visual result -->
Item 1 Item 3 Item 2

```

No big deal, but something to keep in mind when you want to use the `order` property.
El surgimiento de internet.
Tags: podcast, spanish
Published: 2023-09-11 23:40:47

Ya esta disponible el nuevo episodio de Entre Unos y Ceros en donde nos ponemos a platicar acerca de el surgimiento de Internet. Una historia bastante interesante y que seguro habrá algunos datos que desconocías de esta tan particular época.
Disponible en Spotify: https://open.spotify.com/episode/5BK7mKimR1sRcmjjgIHP1I?si=LOXCpUn4TfG9FmCGFZhHNA
CRUD in React: A Quick Overview
Published: 2023-09-11 23:32:31



CRUD stands for Create, Read, Update, and Delete. It's a set of basic operations commonly used in web development to manage data in applications. In React, a popular JavaScript library for building user interfaces, CRUD operations refer to how data is created, read, updated, and deleted within a web application.

Create (C): This operation involves adding new data or records to your application. In React, you might create a form where users can input information, submit it, and have it added to a list or database.

Read (R): Reading means fetching and displaying existing data to users. In React, you can render data on the screen, often by using components and state management to keep the interface up to date.

Update (U): Updating data allows users to modify existing information. In a React application, you can create edit forms or interactive components that allow users to change data.

Delete (D): Deleting data removes records from your application. In React, you can implement features like delete buttons or confirmation dialogs to remove items from a list or database.

CRUD operations are fundamental to building interactive web applications in React and other web development frameworks. They provide the basic functionality for managing and manipulating data, allowing users to interact with your app effectively.