teleren/devto huggingface dataset:
What's the Craziest Variable or Function Name You've Encountered?
Tags: discuss
Published: 2023-06-17 07:00:00

Have you ever stumbled upon an hilarious or quirky variable and function name? A clever pun, an inside joke, or a moment of pure coding creativity -- these little anomalies, hidden amidst lines of code, never fail to bring a smile to our faces. Share your funniest finds with the community. 

Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}

[Image by pch.vector on Freepik](https://www.freepik.com/author/pch-vector)
Coding as Magic: What Would You Wish For? 🔮✨
Tags: beginners, watercooler, codenewbie, discuss
Published: 2023-06-17 07:00:00

Hey there, coding wizards! Let's indulge in a little imagination. If coding were akin to a magical spell, what incantation would you utter, and what extraordinary coding power or other wish would it grant you? 

Share your coding dreams and let your creativity run wild. Let's explore the enchanting possibilities!

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](https://dev.to/codenewbieteam) *%}*
MJGS Newsletter - Don’t Missout on Magic (Issue #119)
Tags: javascript, tech, webdev, discuss
Published: 2023-06-17 06:59:16

---
title: 'MJGS Newsletter - Don’t Missout on Magic (Issue #119)'
published: true
description: 'The sometimes haphazard nature shipping, the subtleties and nuance of expressive changes and the changing landscape of digital tools for creators.'
tags: 'javascript, tech, webdev, discuss'
---

Don’t Missout on Magic (Issue #119)

The sometimes haphazard nature shipping, the subtleties and nuance of expressive changes and the changing landscape of digital tools for creators.

https://markjgsmith.substack.com/p/mark-smiths-newsletter-17-06-2023

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Liman MYS Loadbalance
Published: 2023-06-17 06:54:56


#1. Liman Loadbalance Kurlumu

- İki adet (clone olmamak şartıyla) ubuntu 20.04 kurulumu gerçekleştirilir.
- Her ikisine de Liman MYS Core-784 versiyonu kurulur.
- limactl administrator komutu öncesi iki ubuntu makinede de şu komut çalıştırılır: 

```bash
supervisorctl restart all
```
- Ardından şu komut çalıştırılır:

```bash
sudo limactl administrator
```
- Kurulum tamamlandıktan sonra, ilk Liman sunucusuna girilir ve şu komut çalıştırılarak **/liman/server/.env** dosyasına girilir:

```bash
sudo nano /liman/server/.env
```
- Veritabanı 1. sunucuda olacak şekilde her ikisi de yapılandırlır:


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

- .env dosyaları eşitlenir ve her ikisinde de **HIGH_AVAILABILITY_MODE=true** yapılır:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oojn973vmofva1l51jms.png)
- İkinci limanda şu komut çalıştırılır:
```bash
php /liman/server/artisan register_liman
```
- İlk limanın arayüzüne girilir, bir sunucu eklenir.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xqo1baatarkjjrnyts7h.png)
- Ardından ikinci limanda kontrol edilir.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wn7jx4h221g1ycdpkr6.png)
- İlk liman üzerinden bir eklentini güncel bir versiyonu eklenir, ikinci limanda eklenti üzerinden versiyon kontrol edilir.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7tq1svo95xwdm1r5ab3.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j834b1i6f0aqe7l3imlo.png)
- ikinci limanda eklenti üzerinden arayüz kontrol edilir.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wfm9ub9vdt53gm4jw2a.png)
Cloud Monitoring API For Enabled API And IAM Resources In GCP K8S Cloud Shell Region
Tags: cloud
Published: 2023-06-17 06:30:47

Step 1:
       Initializing GCP VM Instance SSH Node For Distributed YAML Function

       

 Apache Server 1  - Metrics 1 API Cloud Monitoring

                               

## 1st Cloud Backports API In Ingress Mode Analytics


Compatibility In GCP Cloud Storage Bucket And Its API/IAM For Retrieving Metrics:
                     [Cloud Monitoring API](URL 1 Query)
                                             Workbench GUI 1:
curl -sS0 https://www.googleapis.com/GoogleCloudPlatform/(IAM/API 1).yaml

                     [Cloud Monitoring API](URL 2 Query)

                                              Workbench GUI 2:

curl -sS0 -l https://www.googleapis.com/GoogleCloudPlatform/(IAM/API2).yaml

-l indicates list of all CLI and GCP privileges that can be scaled for downward Pub/Sub topics allocated in a Cloud Shell
Step 2:
 Query :
Select cpu.utilzation,api_privileges from GCP_Project_ID1,GCP_Project_ID2 where (Backport_Nodes MIN_BY  Cloud Monitoring API) Group By GUI1,Apache Server 1
                      Group By GUI1,Apache Server 2(Depends upon frequency of GCP K8S Cloud Shell)

In the above query,We have to find out exact amount of CPU Utilization for simultaneous API that can be enabled for GUI 1 for both project_id
Spring Boot JWT authentication
Tags: springboot, springsecurity, jwtauthentication, webdev
Published: 2023-06-17 06:15:31

I implemented user authentication for 3 different user type with different user details in java spring boot with MySQL database.

Requirements
User details
- **admin** (id, username, password)
- **teacher** (id, email, password, name, status, createdBy(foreinkey admin(id))
- **student** (id, email, password, name, status) 

API details 
**Admin** -
      register - register admin with (username, password) (public api)
      login - login admin with (username, password) (public api)
**Teacher** -
      register - add teacher with (email, name, password) 
                (only admin user can register teacher)
      login - login teacher with (email, password) (public api)
**Student** -
      register - register student with (email, name, password) (public api)
      login - login student with (email, password) (public api)

Further APIs can be configured for authorized for particular type of user.

I have written article high level explanation and code snippets.
check out here [spring boot jwt authentication with spring security](https://medium.com/@golakiyachintan24/spring-boot-jwt-authentication-with-spring-security-3-0-e9fc83d2c9cc)

**Github Repository** - [https://github.com/chintan-golakiya/exam-portal-springboot-app/tree/jwt-authentication](https://github.com/chintan-golakiya/exam-portal-springboot-app/tree/jwt-authentication)
ShortNote On NextJs
Tags: webdev, nextjs, javascript, react
Published: 2023-06-17 05:56:12

In NextJs, 
SSR :
**Pre-generates page during build time** meaning all HTML code and contents are prepared in advance. 
**Once the pages are deployed they can be cached by server** meaning pages can be prepared ahead of time and can be cached by server/CDN, which serves the app
These stuffs are possible only with help of exporting `getStaticProps()` which runs on server side.
Joe Ricotta | 5 C++ Tricks You Might Not Know
Tags: career, codenewbie, webdev, beginners
Published: 2023-06-17 05:48:46

Heyy! Folks myself Joe Ricotta...  C++ is a powerful and versatile programming language, and there are many tricks and techniques that can make your code more efficient and effective. In this blog post, we'll explore five C++ tricks that you might not know.

**1. Using the Comma Operator**

The comma operator is an often-overlooked feature of C++ that can be used to perform multiple operations in a single statement. The comma operator evaluates each expression in turn, discarding the value of all but the last expression. Here's an example:

```
int x = 0, y = 1;
int z = (x++, y++, x + y); // z = 2
```

In this example, the comma operator is used to increment the values of x and y, and then add them together. The value of z is then set to the result of the addition.

**2. Using the Ternary Operator**

The ternary operator is a shorthand way of writing an if-else statement. It takes the form of condition ? true_expression : false_expression, where condition is a boolean expression, true_expression is the expression to evaluate if condition is true, and false_expression is the expression to evaluate if condition is false. Here's an example:


```
int x = 5;
std::string message = (x > 10) ? "x is greater than 10" : "x is less than or equal to 10";
```

In this example, the ternary operator is used to set the value of message based on the value of x.


**3. Using the Bitwise XOR Operator**

The bitwise XOR operator (^) can be used to toggle the value of a bit. If the bit is 0, it becomes 1; if it's 1, it becomes 0. Here's an example:

```
int x = 0b10101010; // binary literal
x ^= 0b11110000;
// x is now 0b01011010
```

In this example, the bitwise XOR operator is used to toggle the value of the bits in x that correspond to the bits in 0b11110000.

4. Using the Auto Keyword

The auto keyword can be used to automatically deduce the type of a variable based on its initializer. Here's an example:

```
auto x = 5; // x is an int
auto y = 3.14; // y is a double
auto z = "hello"; // z is a const char*
```

In this example, the auto keyword is used to automatically deduce the type of x, y, and z based on their initializers.

5. Using the Range-Based For Loop
The range-based for loop is a convenient way to iterate over the elements of a container such as an array or a vector. Here's an example:

```
std::vector<int> v = {1, 2, 3, 4, 5};
for (int x : v) {
    std::cout << x << " ";
}
// output: 1 2 3 4 5
```

In this example, the range-based for loop is used to iterate over the elements of the vector v and print them to the console.

_**Conclusion**_

These are just a few of the many tricks and techniques that can be used in C++ to make your code more efficient and effective. By using these tricks, you can write cleaner, more concise code that is easier to read and maintain.
Silent reboot of Django JET with latest jQuery and jQuery-UI along with support for Django 4
Tags: django, opensource, javascript, python
Published: 2023-06-17 05:37:16

Django JET is a open-source project of django admin started by **Denis Kildishev.** It disrupted the traditional admin theme with it's new fresh look and awesome features like Autocompletion, Bookmarks, Ajax based object edit form and many more. However, the founders announced a SaaS product [Jet Admin](https://app.jetadmin.io/demo) in 2019; and frozen the feature development in Django JET project.

Since then many developers forked and maintained their own version of Django JET. But jQuery and jQuery-UI packages remained in old versions with many vulnerabilities continue to live in it. The main reason for hesitant to upgrade these packages might be due to drastic change in jQuery-UI component structure which is going to break most of UI components of JET.

But that's not the end. I'm happy to announce that it's been rebooted with latest jQuery (v3.6.1) and jQueryUI(v1.13.2) along with support for Django 4. Feel free to install in your project, or fork it from here; [Django JET 3 Calm](https://github.com/aksharahegde/django-jet-3-calm)

#### Repository Details
Link: https://github.com/aksharahegde/django-jet-3-calm

#### Changelog

**v5.1.2**

- Upgraded to latest **jQuery (v3.6.1)** and **jQuery UI (v1.13.2)**.
- Upgraded **select2** plugin to latest version (AMD build).
- Added a **new theme**.

**v5.1.3**
- Fixed issue in admin toolbar where filter dropdowns are not rendering due to change in filter template by official django admin.

**v5.1.4**
- Removed dark mode switcher of Django 4.2 which was overlapping JET sidebar after user logging-out.
Upgraded _node-sass_ and _postcss_
Updated _caniuse-lite_
JavaScript localStorage: A Brief Guide with Examples
Tags: javascript, beginners, programming, learning
Published: 2023-06-17 05:35:31


**Introduction:**
In web development, localStorage is a valuable tool for storing and retrieving data on the client-side. This brief guide will cover the essentials of using localStorage in JavaScript, including storing and retrieving data, working with objects and arrays, handling data persistence, and considering limitations and security. We'll explore each concept with practical examples.

**1. What is localStorage?**
localStorage is a client-side web storage API that allows web applications to store key-value pairs locally in the user's browser.

**2. Storing and Retrieving Data:**
To store data in localStorage, use the `localStorage.setItem(key, value)` method. Here's an example:

```javascript
localStorage.setItem('username', 'JohnDoe');
```

To retrieve the stored data, use the `localStorage.getItem(key)` method. Example:

```javascript
const username = localStorage.getItem('username');
console.log(username); // Output: JohnDoe
```

**3. Working with Objects and Arrays:**
localStorage can only store strings. To work with objects and arrays, use `JSON.stringify()` and `JSON.parse()`. Example:

```javascript
const user = { name: 'John Doe', age: 25 };
localStorage.setItem('user', JSON.stringify(user));

const storedUser = JSON.parse(localStorage.getItem('user'));
console.log(storedUser.name); // Output: John Doe
```

**4. Handling Data Persistence:**
localStorage data remains persistent until explicitly cleared by the user or through code. Handle exceptions when working with localStorage. Example:

```javascript
try {
  localStorage.setItem('key', 'value');
} catch (error) {
  console.log('LocalStorage is not supported or the quota is exceeded.');
}
```

**5. Clearing localStorage:**
To remove an item from localStorage, use the `localStorage.removeItem(key)` method. Example:

```javascript
localStorage.removeItem('key');
```

To clear all stored data, use the `localStorage.clear()` method. Example:

```javascript
localStorage.clear();
```

**6. Limitations and Security Considerations:**
- localStorage has a maximum storage capacity, typically around 5MB, varying across browsers.
- Be cautious when storing sensitive data in localStorage, as it is accessible by any script running on the same domain.
- Encrypt sensitive data before storing it in localStorage to improve security.

**Conclusion:**
localStorage is a valuable tool for client-side data storage in web applications. It allows for storing and retrieving data, working with objects and arrays, handling data persistence, and considering limitations and security. Incorporate localStorage into your projects to enhance the user experience and improve data management.
Execute commands using your project dependencies
Tags: pnpm, node, tooling
Published: 2023-06-17 05:23:16

You have a dependency in your project and want to execute a command using it? The [pnpm exec](https://pnpm.io/cli/exec) command can help you with that.

## An example

```bash
 pnpm exec eslint . --ext .ts
```

Given that ESLint is a project dependency, this example shows how to use the `pnpm exec` command to run the ESLint tool on all TypeScript files within the project.

## Some use cases

* You need to do a specific command that is not part of your npm scripts
    
* You want to execute a tool that is a dependency of your project without having to install it globally
    
* You need to execute a CLI package command in a CI pipeline, and this package is already included in the `devDependencies` of your project.
    

## Good to know

If the command you are using does not conflict with a built-in pnpm command, there is no need to specify 'exec'. Referring to the previous example, you can simply run:

```bash
 pnpm eslint . --ext .ts
```

It's one of the small details that make using `pnpm` so pleasant.
Mastering High-Order Functions: Unlocking the Power of Functional Programming
Tags: javascript, webdev, beginners, python
Published: 2023-06-17 05:18:48


**Function Composition**
Function composition allows us to combine multiple functions into a single function, where the output of one function becomes the input of the next. 


![Function Composition](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mv2u48mzvkkahdk1z1v7.png)

In the above example, add, multiplyBy2, and subtract are high-order functions that return functions as results. The composedFunction combines these functions to perform a series of operations on the input x.

**Callbacks**
Callbacks are commonly used with high-order functions to handle asynchronous operations.

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

In this example, delayedGreeting is a high-order function that takes a name and a callback function. It uses setTimeout to simulate a delay and invokes the callback with the greeting message after the specified time.

**Filtering and Transformation**
High-order functions like map, filter, and reduce are frequently used for data manipulation and transformation. Here's an example using Python:


![Filtering and Transformation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kghvgo7xg5be54x0gan5.png)

In the above examples, the filter function filters out even numbers, the map function transforms each number to its square, and the reduce function calculates the sum of all numbers in the list.

These examples demonstrate how high-order functions provide flexibility and abstraction, allowing us to perform powerful operations with concise and reusable code.
Yo.link - A human friendly URL Shortener
Tags: sveltekit, webdev, saas, javascript
Published: 2023-06-17 05:15:37

For a while now I had the domain [yo.link](https://yo.link) sitting around, and I was wondering what to do with it.

I needed a project that is simple enough to do in couple of weekends, and would also allow me to try out some of the modern tech-stack, that is SvelteKit, Auth.js, Prisma, PostgreSQL and Redis, all running on [Vercel](https://vercel.com).

Since [yo.link](https://yo.link) is pretty short and sounds like "your link", implementing yet another URL shortening service was an obvious choice, but this time with a twist.

Instead of putting the short-code in the URL path after the `/` (like [https://bit.ly/3JkVCZ0](https://bit.ly/3JkVCZ0)), we will put it in the subdomain part of the link, and let users choose what they want to put there ([hn.yo.link](https://hn.yo.link) -> [https://news.ycombinator.com/](https://news.ycombinator.com/)).

The motivation here is to create short links that are human friendly, and do not contain cryptic short-codes. Also, subdomain is the first think visitors read in a link, so nice descriptive subdomain names will help users click.

# The Objective

The goal is to allow users to login into the system, choose a subdomain that they like and choose a destination URL.
They can share the short yo link and will collect stats, on the number of clicks, broken down by hour/day/month, geo country/city, as well as browser type and type of operating system of the user.

QR codes are also generated if you need to share those.

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


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


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

# Implementation

SvelteKit was an obvious choice for me, since it can solve all the project needs in one go.
It supports hooks (aka, middleware) which can intercept every request, and if it is a request to subdomain, we can lookup in the db if we have an associated link, and redirect to the destination if needed.

Auth.js integrates nicely with SvelteKit and that what was used for authenticating users using GitHub, Twitter, Google and email magic link login.

Prisma+Postgres was used as "master" database, to store the link associations and the users.

Redis was used for counting stats realtime, every time a click happens, we increment a bunch of counters, which is pretty fast.

Vercel was used for deployment, since they provide out of the box wildcard subdomain HTTPS certificates, can host SvelteKit project natively, and havfe offering for both PostgreSQL and Redis.

# Feedback

Any feedback you might have on this side project is very welcome. Thank you
What is Angular Ivy?
Tags: ivy, angular, typescript, javascript
Published: 2023-06-17 03:53:03

**Angular Ivy** is the new rendering engine introduced in Angular version 9. It replaces the previous View Engine and brings several improvements and benefits to the Angular framework. Here are some key points to know about Angular Ivy:

1. Improved Bundle Size: Ivy enables better tree shaking and generates smaller bundle sizes compared to the previous View Engine. This helps in reducing application load times and improving performance, especially for larger applications.

2. Faster Compilation: Ivy brings faster compilation times, making the development workflow more efficient. The incremental compilation feature allows for faster rebuilds when making changes to your codebase.

3. Enhanced Debugging and Error Messages: Ivy provides improved debugging capabilities with more accurate error messages and better stack traces. This makes it easier to locate and fix issues during development.

4. Smoother Developer Experience: Ivy introduces a more intuitive and simplified syntax for Angular templates, making it easier to understand and work with template code. It also enables better type checking and autocompletion in template files.

5. Improved Build Time: Ivy speeds up the build process by reducing the time required for compilation. This is particularly beneficial for larger projects with a significant number of components and templates.

6. Better Performance: Ivy includes various optimizations that improve runtime performance, such as faster rendering, optimized change detection, and improved memory management.

7. Angular Compatibility: Angular Ivy is designed to maintain compatibility with existing Angular applications and libraries. Most existing applications can migrate to Ivy without requiring significant changes to the codebase.

8. Incremental Adoption: Ivy allows for incremental adoption, meaning you can enable Ivy in specific parts of your application while keeping the rest of the codebase using the View Engine. This flexibility allows for a smoother migration process, especially for large applications.

It's important to note that Ivy is the default rendering engine in Angular starting from version 9. However, if you have an older Angular project, you may need to manually enable Ivy by following the migration guides provided by the Angular team.

Overall, Angular Ivy brings significant improvements in terms of performance, bundle size, and developer experience. It's recommended to stay updated with the latest Angular versions and leverage the benefits offered by Ivy in your Angular projects.