teleren/devto huggingface dataset:
Get the list of classes connected to the DB
Tags: rails, rails5
Published: 2020-05-25 01:47:58

---
title: Get the list of classes connected to the DB
published: true
description: 
tags: rails, rails5
---

It was quite troublesome before Rails4, but after Rails5
You can get a list of models connected to DB in ApplicationRecord.descendants.


For example, something like this.

```
model_list = ApplicationRecord.descendants

# If you want to output a list of class names
model_list.map { |v| v.to_s }
=> ["User", "Owner", "Blogs::Comment"]
```

## Usage scenarios
* Batch processing
* If you are looking for a method that can be executed by the method xxx
Modern Software engineering is impossible to imagine without:-
Tags: productivity, linux, github, git
Published: 2020-10-28 19:15:33

1) Linux
2) Terminal
3) Git
4) Github
5) StackOverflow
6) Google
7) Wikipedia
8) Virtualization
9) Jenkins
10) MySQL
11) Redis
12) Diff
13) Tomcat
14) Slack
15) JIRA
16) Chrome
Struct in C++
Tags: cpp, cpptutorial, learncpp
Published: 2022-10-05 10:21:08

#include <iostream>
#include <string>

using namespace std;
namespace game
{
    struct game
    {
        unsigned short int score = 0;
        unsigned short int correctAnswers = 0;
        unsigned short int playedQuestions = 0;
        string playerName = "unknown";

        void yourInformation();
        void gameStart();
        void gameInfo();
    };
}; // end of namespace

void game::game::yourInformation()
{
    cout << "Welcome to Play a quiz Game which played by console " << endl;

    string userData = "unknown";

    cout << "Enter your Name : ";
    getline(cin, userData);
    this->playerName = userData;

    cout << "Ok Mr./MS. " << this->playerName << " do you want to play a Game  ? ";
    getline(cin, userData);

    if (userData == "yes" || "Yes" || "YES")
    {
        this->gameStart();
    }
}

void game::game::gameStart()
{
    string userData = "null";
    cout << "Enter the Name of Capital city of India ";
    getline(cin, userData);

    this->score += userData == "new delhi" || "New Delhi" || "delhi" || "Delhi" ? 1 : 0;
    this->gameInfo();

    cout << "Capital City of China : ";
    getline(cin, userData);
    this->score += userData == "Beijing" || "beijing" || "BEIJING" ? 1 : 0;
    this->gameInfo();

    cout << "who is the president of Russia ? :";
    getline(cin, userData);
    this->score += userData == "Valadmir Putin" || "Putin" || "putin" || "Valadmir putin" || "PUTIN" || "VALADMIR PUTIN" ? 1 : 0;
    this->gameInfo();

    cout << "Which is world's Fastet Object Oriented Programming ? ";
    getline(cin, userData);
    this->score += userData == "cpp" || "Cpp" || "c++" || "C++" || "Cplusplus" || "cplusplus" || "cplus plus programming" || "cpp language" ? 1 : 0;
    this->gameInfo();

    cout << "which Operating system mostly used at Servers and Satelite ? ";
    cout << "(a). windows, (b). Linux, (c).Mac, (d). Android" << endl;
    getline(cin, userData);
    this->score += userData == "b" || "Linux" || "linux" || "B" || "LINUX" ? 1 : 0;
    this->gameInfo();

    cout << "What is your Name ? ";
    getline(cin, userData);
    this->score += userData == this->playerName ? 1 : 0;
    this->gameInfo();

    cout << "thanks for playing Game : " << endl;
}

void game::game::gameInfo()
{
    this->correctAnswers = this->score;
    this->playedQuestions++;
    cout << "=============================" << endl;
    cout << "Score : " << this->score << endl;
    cout << "Correct Answer : " << this->correctAnswers << endl;
    cout << "Played Questions : " << this->playedQuestions << endl;
    cout << "===============================" << endl;
}

void information()
{
    game::game myGame;
    myGame.yourInformation();
}

int main()
{
    information();
    return 0;
}
Anagram solution
Tags: leetcode, anagram, beginners, interview
Published: 2023-02-19 20:02:30

 

LeetCode is a popular platform that offers various coding challenges and problems. One of the most interesting categories of 
The problem we will be solving is "Group Anagrams," which can be found on LeetCode under the ID "49." This problem requires us to group an array of strings into groups of anagrams. An anagram is a word or phrase formed by rearranging the letters of another word or phrase. For example, "listen" and "silent" are anagrams.

The problem statement provides us with an array of strings, and our task is to group them into anagrams. We can approach this problem by using a hash table. We will iterate through each string in the array and sort the characters in the string. We will then use the sorted string as a key to a dictionary and add the original string to the value of that key. Finally, we will return the values of the dictionary as a list.

```
def groupAnagrams(strs):
    dict = {}
    for s in strs:
        key = ''.join(sorted(s))
        if key in dict:
            dict[key].append(s)
        else:
            dict[key] = [s]
    return list(dict.values())

```
Animated Login Page Using Html & CSS + Source Code
Tags: html, css, beginners, tutorial
Published: 2023-03-25 15:43:49

{% youtube ypWpu1QVw_M %}

Support us and GET 10% OFF of your next order in my shop using the code: EARLYBIRD 🙏❤️
https://tinyurl.com/2uf6zk72

DOWNLOAD Source : https://github.com/soudemy/simpleLogin

Hi guys, today we want to show How To Create a Animated Login Form Using HTML & CSS

Please, if you love it, support us with Like & Subscribe.🙏🙏❤️❤️

Let's be friends and connect
📩 Subscribe:https://shorturl.at/BCTV8
📷 Instagram: https://www.instagram.com/soudemy/
📱 Behance: https://www.behance.net/soudemy
🐦 Twitter: https://twitter.com/SoudemyAcademy

In the comments, you can say what design you want so that we can prepare the video for you.

#html #html5 #htmlcss #csc #htmltutorial #htmlcsstutorial #htmlcssjs #tutorial
MMOexp WoW Classic SoD Gold: How many take pictures
Published: 2024-01-02 05:53:24



You'd like to park and go for a walk now? I'm likely to [WoW Classic SoD Gold](https://www.mmoexp.com/Wow-classic-sod/Gold.html) wake up feeling worse than I did yesterday. Get a good night's sleep so I'll be back later in the day. I was seeking out teammates. I had to pay for phenomics Indyk pitchers to let me as I walked a dog.

Are you waiting for your heart to be? Wait How many take pictures? Simply

who's? I received one from you. I had to receive it. It was consensual, I guess. Ergonomics bro. It's a cost to pay. off the employees. Wow. Ah! Get him out of here. Take him out of here.

Get him out as fast. Take him out of this place. Get him out of here. Get him out of here. You must get him out. He's drunk. He's drunk. He's drunk.

Emma Lm GMMMN Oh my god It's dropping. Holy the fuck. My heart is fuckin drafted. I got the voice of the glyph.

That was really the worst. It was the definition of suck. What? Yikes. It's a pity that you're doing the same thing. Uh oh

LOL Just walked into my room and told me I'm fresh from the shower I'll be in the room waiting for you. I was surprised I still got in even at 43. I need to make her smile, after all she's my mother at CES Oh man, wait a minute Oh, one shot Bloodlust.

Oh my God oh my God please, I'm going to be dead I'm gonna die! Oh my god the orangey gods support me. Chad bugging dodge and Miss Holly Molly did a very excellent job pushing me away from contact.

Oh it's just known as [WoW SoD Gold](https://www.mmoexp.com/Wow-classic-sod/Gold.html) Danine or Guney pants Oh man , and get your man on the move now, my goodness!
Running a Vertex AI custom container
Tags: cloud, serverless, ai, containers
Published: 2024-01-27 00:06:00

After [creating](https://dev.to/dchaley/building-a-vertex-ai-custom-job-container-5f66) our container, it's time to run it.

Our first container didn't work (of course). After a few iterations we got it running. 🎉


![Vertex AI job list, 3 failed and 1 succeeded](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mtyhq5ftuytnp5ate7mx.png)

After a [container path whoopsie](https://github.com/dchaley/deepcell-imaging/pull/141/commits/fb2c89704bc6dc22993cf130cb9bd23f2ca20e1e), the main challenge was fetching the active machine config from within the container.

Previously, we'd copy the notebook id into the benchmark then use the notebook API to fetch the machine config. We found the API to describe the [custom job by ID](https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform_v1.services.job_service.JobServiceClient#google_cloud_aiplatform_v1_services_job_service_JobServiceClient_get_custom_job) which has the machine info … but you don't have an ID until the job is created. 🤨

This [StackOverflow answer](https://stackoverflow.com/questions/75578886/how-to-create-job-id-for-vertex-ai-manually-or-how-to-access-job-id-in-custom-co) had the key. You do get to set a display name, then you can fetch all jobs filtered on that name.

So we'll need to make sure those job names (nominally for display) are actually unique identifiers…
🌟 iPhone 15 Pro Max Giveaway 🌟
Published: 2024-01-27 11:22:06

Hey [Your Community/Followers],
🎉 Exciting News! 🎉 We're thrilled to announce our exclusive iPhone 15 Pro Max Giveaway! 📱✨
To show our appreciation for your amazing support, we're giving you the chance to win the latest and greatest [iPhone 15 Pro Max](https://docs.google.com/presentation/d/1vUkR43We5mQXRLw4-uesyIqcQPjKwkGSdcliZdMoJ80/edit#slide=id.g2b3c9bc954c_0_52)! 🚀🌈
Here's how to enter:
Follow Us: Make sure you're following us on all our social media platforms. 📲
Like & Share: Like this post and share it with your friends and family. The more, the merrier! 🤗🔄
Tag Friends: Tag friends who would love to win this incredible prize. Each tag gets you an extra entry! 🏷️🎟️
Comment: Drop a comment below telling us why you deserve to win the iPhone 15 Pro Max. Be creative! 🗨️🌟
📅 [Giveaway Ends: [25.03.2024]](https://bracecherry.com/nrzrt25b?key=ea3d1b88b0226c07a2bf34a395b71ec0)
🎁 Winner Announcement: We'll announce the lucky winner on [26.03.2024].!
🤞 Good luck to everyone! 🤞 May the odds be ever in your favor! 🍀💖
🤞 Open to [ Specify Eligibility].
#iPhone15ProMaxGiveaway #GiveawayTime #WinBig #TechLove
(Note: Ensure to follow the guidelines of the platform where you are hosting the giveaway, and adjust the details accordingly. Always be transparent and honest about the giveaway terms and conditions.)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/873boincxg41p1a2w1pg.jpg)
[Win iphone 15 pro max](https://docs.google.com/presentation/d/1vUkR43We5mQXRLw4-uesyIqcQPjKwkGSdcliZdMoJ80/edit#slide=id.g2b3c9bc954c_0_52)
Bash Better: How I Built a Tool to Organize Scripts Effectively
Tags: bash, github, opensource, linux
Published: 2024-02-26 19:50:35

## Introduction

Before I delve into discussing my script "Link-It," allow me to introduce myself briefly: My name is Patrick, and I've been working as a software developer, software architect, and project manager for over a decade.

I've been involved in various client projects (custom developments) and have always strived to automate repetitive tasks or write small scripts to accomplish specific tasks quickly and efficiently.

## The Inspiration Behind My Project

As I mentioned earlier, I have various scripts for different tasks. Some of these scripts I use daily, some weekly, and others only 1-2 times a month.

Each of these scripts resides in its own folder and is versioned in Git.

Now, it's not very user-friendly to always know where the script I currently need is located.

It would be much simpler if all my scripts were on the PATH, allowing me to execute them anywhere.

That's how I came up with the idea to create "Link-It." A small script that links the scripts to a folder that is on the PATH.

## How Link-It Works

Link-It is a simple script designed to streamline the process of managing and accessing your scripts. It automates the following tasks:

- It creates the folder `.local/bin` in your HOME directory if it doesn't already exist.
- It adds the newly created folder to your PATH if it's not already included.
- It creates a symlink to the specified file in the `.local/bin` folder.
- For user convenience, when creating the symlink, Link-It removes the file extension.
  - For example, `my-super-script.sh` would be linked as `my-super-script`.

[Link-It is an open-source project hosted on GitHub](https://github.com/ppfeiler/link-it)

Feel free to explore the repository, contribute to the project, or provide feedback.

## How Link-It Can Simplify Your Workflow

If I'm now writing a new script that simplifies a process for a client project, I no longer have to remember the path to that script. Instead, I simply execute `link-it /path/to/my/new/script.sh`, and from then on, I can use my script anywhere.

## Conclusion

That concludes the introduction to my little script, "Link-It." I would greatly appreciate your feedback on this post, my README on GitHub, and the project in general.

Perhaps this project is also of interest to others. I'm open to expanding it to cover your specific use cases as well. Your input and contributions would be invaluable in shaping the future development of Link-It.

## My Call to the Community

Do you have your own little scripts that help you in your daily life?
Do you also enjoy writing small automations?

I would be thrilled to exchange scripts and ideas with you. I'm eager to learn from other scripts and experiences. Feel free to leave a comment and let's start the conversation!

![Community](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9btm3wgzgjgnngn6enx.jpg)
Journal Entry 1
Published: 2023-02-20 06:40:06

Activity: 
- Installed Unity and Platformer microgame
- Modified the game according to tutorials
- Downloaded and imported 2D Game Kit

Notes:
I worked in Unity before so i was overconfident and paid for it in time wasted. I started doing things without realizing there was a tutorial and subsequently i had to rework few things. i sent most time on confetti bc i forgot to give box the confetti. Also i need to remember to carefully read the instruction bc i forgot to install few things at beginning. Also i procrastinated a lot whit uploading it.

Invested hours: 
Installations: 1hour + 30 min
Tutorials: 1.5 hours

Outcome:
Build (uploaded to the itch.io page as a .exe file)
Project Homelab: Kubernetes the Complex Way
Tags: projecthomelab, devops, homelab, kubernetes
Published: 2024-07-09 14:18:29

---
title: Project Homelab: Kubernetes the Complex Way
published: true
date: 2024-06-23 19:46:02 UTC
tags: projecthomelab,devops,homelab,kubernetes
canonical_url: https://burnskp.dev/2024/06/23/project-homelab-kubernetes-the-complex-way/
---

There’s a joke that Kelsey Hightower wrote Kubernetes The Hard Way because there isn’t an easy way. While this may be less true today, Kubernetes can still be incredibly complex. Kubernetes is essentially a platform for creating platforms. The core functionality doesn’t require a large amount of understanding. However, Kubernetes brings a lot of additional components. Its pods and services are compartmentalized in a microservices format. It doesn’t hide the operational aspects around deploying and maintaining network-accessible applications. These pieces, while not considered ‘core Kubernetes,’ are essential to understand in order to use it effectively.

## Project Homelab

There are many good resources available for learning the basics of Kubernetes, such as the syntax, setting up pods and networks, and tying everything together. However, there’s much more to learn. I am redoing my homelab and will be starting a series of blog posts on the setup process. This includes:

- Creating a reusable and shareable dev environment
- Automating every aspect of the cluster using tools like Ansible, ArgoCD, and Terraform
- Implementing Build pipelines using GitHub actions
- Baseline services, such as service mesh, secret store, certificate management, logging, observability
- Securing Kubernetes

I’ll be using a “bare metal” setup with VMs on top of Proxmox. There are different concerns when using Kubernetes on bare metal compared to the cloud. In the cloud, you can benefit from a managed Kubernetes cluster and offload state to cloud-based databases, allowing you to focus on stateless applications. On bare metal, you may need to run databases within the cluster.

## Hardware

I’m trying to keep my setup small. For my initial setup, I’ll be using three machines:

- A Raspberry Pi 4 8GB to run DHCP, DNS, installation images, and Authentication services
- An Intel box with 64GB of RAM that will be used as a development / workstation machine.
- An AMD box with 128GB of RAM that will run Proxmox for the Kubernetes VMs

## What’s next

The initial setup requires quite a bit of preparatory work, sometimes called “yak shaving.” I’m not looking to create a bespoke Kubernetes cluster by hand. Instead, I will be automating as much as possible and providing a good developer experience for working with the automation.

In my next post, I’ll discuss setting up a Git repository for Ansible, including devcontainers, GitHub Actions, and pre-commit hooks. This will be used to manage the configuration of the Raspberry Pi and workstation nodes.
GIT Cheatsheet
Tags: git, beginners, cheatsheet, learning
Published: 2024-07-11 04:30:25

Here's a git cheat-sheet that covers some of the most commonly used git commands:

## Configuration

```
git config --global user.name "Your Name"
```

- 
Sets your name for all git repositories on your computer

```
git config --global user.email "youremail@example.com"
```
- 
Sets your email address for all git repositories on your computer

```
git config --global color.ui auto
```
Enables colored output in the terminal

## Creating a repository

```
git init
```
: Initializes a new git repository in the current directory

```
git clone <repository_url>
```
: Clones an existing repository from a remote server to your local machine

## Staging changes

```
git add <file>
```
: Adds a file to the staging area

```
git add .
```
: Adds all changed files in the current directory to the staging area

## Committing changes

```
git commit -m "Commit message"
```
: Commits the staged changes with a message describing the changes made

## Branching
git branch: Lists all local branches
git branch <branch_name>: Creates a new branch
git checkout <branch_name>: Switches to a different branch
git merge <branch_name>: Merges changes from the specified branch into the current branch

## Remote repositories
git remote add <name> <repository_url>: Adds a new remote repository
git push <remote> <branch>: Pushes changes to the specified branch in the remote repository
git pull <remote> <branch>: Pulls changes from the specified branch in the remote repository

## Viewing information
git status: Shows the status of the current branch and any changed files
git log: Displays a log of all commits on the current branch
git diff: Shows the differences between the working directory and the staging area
git diff --staged: Shows the differences between the staging area and the last commit
Welcome Thread - v284
Tags: welcome
Published: 2024-07-10 00:00:00

---
published_at : 2024-07-10 00:00 +0000
---
![Hands waving with the text "Welcome!"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvvksc2ojztv5y3oxv33.gif)

---

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

3. Elevate your writing skills on DEV using our [Best Practices](https://dev.to/devteam/best-practices-for-writing-on-dev-creating-a-series-2bgj) series!
Stand out from an Average Developer
Tags: webdev, programming, beginners, career
Published: 2024-07-10 16:06:10

The insights mentioned are drawn from my experience working in a corporate environment and can help you excel and improve as a developer:

1. **Be Curious**: Curiosity fuels learning and innovation. Always seek to understand why things work the way they do and explore new ideas and technologies.

2. **Understand Before Fixing**: Take the time to fully understand the root cause of an issue before jumping into fixing it. Sometimes, the problem may not require a fix at all, or there might be a more efficient solution than initially apparent.

3. **Encourage Reusability**: Identify opportunities to refactor code into reusable methods, functions, or components. This reduces duplication, promotes consistency, and simplifies maintenance across the project.

4. **Optimize Code**: Minimize the number of loops and iterations in your code to improve performance and readability. Look for opportunities to use efficient data structures and algorithms to achieve the desired outcome with fewer iterations.

5. **Optimize Memory Usage**: Be mindful of memory usage in your code. Reduce the number of variables and allocate memory efficiently to optimize performance and resource utilization.

6. **Keep Code Simple**: Complex code is difficult to understand, maintain, and debug. Strive to keep your codebase simple, clear, and easy to follow, even if it means sacrificing some cleverness for readability.

7. **Continuous Learning**: Invest time in learning advanced skills and techniques relevant to the project you're working on. This enables you to deliver higher-quality solutions and stay competitive in your field.

8. **Focus on Best Practices**: Instead of settling for code that merely works, aim to write code that follows best practices and coding standards. This ensures maintainability, scalability, and reliability of your codebase over time.

9. **Consider Impact on Common Areas**: When making changes, consider how they might affect other parts of the codebase, especially common or shared components. This helps prevent unintended consequences and promotes code consistency.

10. **Review with Requirements in Mind**: When reviewing pull requests, ensure that the changes align with the project requirements and goals. This helps maintain consistency and clarity in the codebase.

By adhering to these principles, you not only become a more effective developer but also contribute to the overall quality and sustainability of the codebase.
iphone safari issue
Tags: ios, iphone, safari, webdev
Published: 2024-07-09 05:41:03

**

## _Safari iphone input zoom , bottom scroll, scroll to bottom , chatgpt textarea_
**

1. 

**When we click on textbox that moment iPhone Safari that textbox zoom hear is the solution in react we use first and second for the next js**



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

```
<meta
      name="viewport"
      content="width=device-width,initial-scale=1.0, maximum-scale=1, user-scalable=no"
    />
```



```
import { Viewport } from "next/dist/lib/metadata/types/extra-types";

export const viewport: Viewport = {
  width: "device-width",
  initialScale: 1,
  maximumScale: 1,
  userScalable: false,
  interactiveWidget: "overlays-content",
};
```
2.
**also iphone safari bottom scroll is default behaviour**

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