teleren/devto huggingface dataset:
I got hacked💥 and blew up prod!
Tags: watercooler, webdev, productivity, beginners
Published: 2024-06-26 14:37:52

I have been around the block enough times in my 15-year or so career to have broken things, and at times quite badly.

Here are some stupid mistakes I have made, and how to easily avoid them:

## Running SQL in production

Sometimes you must run destructive statements like **UPDATE** or **DELETE** in production. The problem comes in when you forget the **WHERE** 😭 clause.

Luckily, when I mistakenly did this, it was data I could get back easily from a backup or some log file.

**How to avoid:**

1. Test in a local DB first (seems obvious right!).
2. Use transactions: Transactions will not execute until you commit the statement, and worst-case scenario, you can always roll back.
3. Start your statement backward i.e. "where x = y", this way, if you accidentally press enter, the statement will fail or only apply to a subset of results and not the whole table.

## Deleting volumes when stopping containers

I once ran a container with **"docker run --rm"**! Suffice to say this was a bad idea if you have attached volumes. Docker will destroy the volume when you take down the container.

**How to avoid:** 

1. Avoid the "--rm" flag unless you are using stateless containers.
2. Create the volume using "docker volume create" and then bind the volume to the container using "-v".

## Leaving debug mode on in production

😱 This is a really stupid rookie move, but alas, it happened and this exposes API keys among other sensitive information. Lucky for me this was just a side project, I pushed up late one evening.

My DB got hacked, but it was a test project with no real sensitive data 😮‍💨

**How to avoid:** Stop pushing code at night! 😁

## Taking down production with unoptimized scripts

When running maintenance jobs that iterate over records in a large DB, using **LIMIT OFFSET** may not always be a good idea to paginate data.

I once (or maybe more than once) ran a script in production that looped through millions of rows to perform some kind of update or cleanup operation.

This worked fine until it got to a large page size, OFFSET pagination tends to slow down, this, in turn, kept too many open connections and was a memory hog.

As you can imagine this maxed out the available DB connections and locked some rows.

**How to avoid:**

1. Use primary key pagination instead. Basically, you start at 0 and keep track of the last row ID processed.
2. Implement proper connection pooling, essentially you should keep a persistent connection for as long as possible instead of spawning a new connection at every iteration.
Dom javascript
Tags: dom, javascript, aripovdev
Published: 2024-06-26 14:37:10


creat elemts:

```
const div = document.createElement("div"); //Element yaratish ya'ni shu xolatda <div></div>
const h1 = document.createElement("h1"); //Element yaratish ya'ni  shu xolatda <h1></h1>
```

addClassList:

```
div.classList.add('p-5', 'bg-success'); // class qo'shish ya'ni shu xolatda 

div.innerHTML = "<h1>Hello world!</h1>";//Htmlda chiqarish


```

AllCode:

```
const div = document.createElement("div"); //Element yaratish ya'ni shu xolatda <div></div>
const h1 = document.createElement("h1"); //Element yaratish ya'ni  shu xolatda <h1></h1>


div.classList.add('p-5', 'bg-success'); // class qo'shish ya'ni shu xolatda 
div.innerHTML = "<h1>Hello world!</h1>";//Htmlda chiqarish


console.log(h1);
console.log(div);
```

CreatElement Function:

```
function CreateElemt() {
    const div = document.createElement("div");
    div.classList.add('p-5', 'bg-success');
    div.innerHTML = "<h1>Hello world!</h1>";
    cotainer.div.append(div)

    
}

CreateElemt()   //call qilish orqali nusxalab ya'ni ko'paytirish mumkin!
```

CreatElement Function For:

```
function CreateElemt(limit) {
   for (let i = 0; i < i.limit; index++) {
    const div = document.createElement("div");
    div.classList.add('p-5', 'bg-success');
    div.innerHTML = "<h1>Hello world!</h1>";
    cotainer.div.append(div)
    
   }

    
}

CreateElemt(10)   //funksiyani call qilish va unga necha marotaba ko'paytirish keragligini yozish mumkin
```

Attribute:
getAttribute:
setAttribute
**getAttribute Metodi
**
Bu metod DOM elementining berilgan atribut qiymatini qaytaradi.

```
element.getAttribute(attribut_nomi)

```
Masalan:

```
let elem = document.getElementById('myElement');
let value = elem.getAttribute('class');
console.log(value);  // Atributning qiymati, masalan: "myClass"

```

**setAttribute Metodi**

Bu metod DOM elementiga yangi atribut qo'shadi yoki mavjud atributning qiymatini o'zgartiradi.

```
element.setAttribute(attribut_nomi, yangi_ qiymat)

```

```
let elem = document.getElementById('myElement');
elem.setAttribute('class', 'newClass');

```

**hasAttribute**
JavaScriptda DOM elementining atributi mavjudligini tekshirish uchun hasAttribute metodidan foydalaniladi. Bu metod berilgan atribut elementda mavjud bo'lsa, true qiymatini, aks holda false qiymatini qaytaradi.

```
element.hasAttribute(attribut_nomi)

```
hasAttribute metodi yordamida har bir atributning mavjudligi tekshiriladi va natijalar konsolga chiqariladi.

getAttribute va setAttribute metodlari DOM manipulyatsiyasi uchun juda foydali hisoblanadi.
What is GCP Interconnect?
Published: 2024-06-26 14:35:00

**What is GCP Interconnect?**

Google Cloud Interconnect is a service that provides a direct connection between your on prem or datacenter and the Google Cloud Network.

**Types of Interconnect:**

**Dedicated Interconnect:** Provides a direct physical connection from your data center to Google Cloud.

**Partner Interconnect:** Uses a supported service provider, like a third-party, to connect your network to Google Cloud.

**Methaphor to understand:**

Imagine you have a house (your on-premises network) and you frequently need to visit a store (Google Cloud) to get supplies (data and services).

**Public Internet Connection:**
**Public Roads:** Using the public roads to get to the store. It can be slow and unpredictable due to traffic, and there is always a risk of encountering hazards (security risks).

**GCP Interconnect:**
**Private Road:** Instead of using public roads, you build a private road (Interconnect) directly from your house to the store.

**Dedicated Interconnect:** You build a private road exclusively for your use, ensuring a fast, secure, and reliable journey every time.

**Partner Interconnect:** You use a private road provided by a trusted partner, which connects you to the store with similar benefits of speed, security, and reliability.
Revitalize Your Sleep with Adipoli Cleaners' Mattress Cleaning Services Australia
Published: 2024-06-26 14:32:02

Are you tossing and turning at night, wondering if your mattress is as clean as it should be? Look no further than Adipoli Cleaners, your go-to experts for Mattress Cleaning Services Australia. We understand that a clean mattress is the foundation of a good night's sleep and overall health.
Why Mattress Cleaning Matters
Your mattress is more than just a place to rest; it's a haven for dust mites, allergens, and bacteria. Over time, these unseen invaders can affect your sleep quality and health. That's where Adipoli Cleaners comes in, offering professional **[Mattress Cleaning Services Australia](https://adipolicleaners.com.au/mattress-cleaning/)**-wide.
The Adipoli Cleaners Difference
At Adipoli Cleaners, we don't just clean – we transform. Our Mattress Cleaning Services Australia use cutting-edge technology and eco-friendly products to deep clean your mattress, ensuring a healthier sleeping environment.
Our Process:

Thorough Inspection: We assess your mattress to determine the best cleaning approach.
Deep Vacuuming: Our industrial-strength vacuums remove surface dirt and deep-seated debris.
Stain Treatment: We tackle stubborn stains with specialized, safe solutions.
Steam Cleaning: High-temperature steam sanitizes and deodorizes your mattress.
Allergen Removal: Our process eliminates dust mites and other common allergens.
Drying and Sanitizing: We ensure your mattress is thoroughly dried and sanitized before use.

Benefits of Professional Mattress Cleaning

Improved Sleep Quality: Sleep on a clean, fresh mattress for better rest.
Allergy Relief: Reduce allergens for easier breathing and fewer symptoms.
Extended Mattress Life: Regular cleaning can double your mattress's lifespan.
Odor Elimination: Say goodbye to musty smells and hello to freshness.
Stain Removal: We tackle even the toughest stains for a like-new appearance.

Why Choose Adipoli Cleaners?

Expertise: Our team is trained in the latest mattress cleaning techniques.
Convenience: We work around your schedule for minimal disruption.
Eco-Friendly: Our products are safe for you, your family, and the environment.
Comprehensive Service: From inspection to final sanitization, we cover it all.
Customer Satisfaction: We're not happy unless you're thrilled with the results.

Mattress Cleaning Services Australia: A Wise Investment
Investing in professional mattress cleaning is investing in your health and comfort. Adipoli Cleaners' Mattress Cleaning Services Australia offer a cost-effective way to maintain a hygienic sleeping environment without the expense of frequent mattress replacement.
Don't let a dirty mattress compromise your sleep and health. Experience the Adipoli Cleaners difference today. Contact us to schedule your Mattress Cleaning Services Australia and take the first step towards cleaner, healthier sleep.
Remember, a clean mattress is not just about comfort – it's about your well-being. Trust Adipoli Cleaners to deliver the best Mattress Cleaning Services Australia has to offer. Sleep well, live well with Adipoli Cleaners!
Filament: add a confirmation password field in a form
Tags: laravel, filament, php, webdev
Published: 2024-06-26 14:31:58

To add a confirmation password field in a form, you typically want to ensure that the user correctly enters their password twice to prevent typos and ensure accuracy .  

```
Forms\Components\TextInput::make('password')
                    ->password()
                    ->required()
                    ->maxLength(255),
 Forms\Components\TextInput::make('password_confirmation')
                    ->password()
                    ->required()
                    ->maxLength(255)
                    ->same('password')
                    ->label('Confirm Password'),
```
Here are your Top Free Python IDEs and Text Editors
Tags: python, pythonides, pythontexteditors, pythondev
Published: 2024-06-26 14:28:42

**I say: choosing the right Python IDEs and text editors can significantly impact your productivity.**

## Top Free Python IDEs

**1. PyCharm Community Edition** — Ideal for advanced coding, this open-source IDE offers features like code analysis and intelligent completion.
**2. Spyder** — Great for data-driven projects, it provides tools for interactive code exploration and debugging.
**3. Visual Studio Code** — A lightweight editor that supports Python and other languages, enhanced by a vast extension marketplace.

[These IDEs](https://bluebirdinternational.com/free-python-ides-and-text-editors/) offer tools that support effective Python development, helping both novices and seasoned programmers.

## Best Free Text Editors for Python

**1. Sublime Text** — Known for its user-friendly interface, it includes syntax highlighting and a powerful plugin system.
**2. Atom** — Offers extensive customization options with a built-in package manager to handle add-ons.
**3. Notepad++** — A favorite among Windows users, it’s equipped with essential features like auto-indentation and a tabbed interface.

These text editors are perfect for simpler coding tasks, providing flexibility and minimal distractions.
Java's 2024 Game Engines as far as I know
Tags: java, gamedev, javagameengines, javaframeworks
Published: 2024-06-26 14:24:54

## Java’s Capabilities in Game Design?

I advise you to select the Java game engine that aligns with your vision to bring your interactive stories to life. Let’s see…

### Java for Cross-Platform Game Development

Java game engines provide a foundation for building games that operate smoothly across a spectrum of platforms, from personal computers to handheld devices.

### Prime Picks for 2D Game Development in Java

**LWJGL:** This foundational library offers direct manipulation of graphics and user inputs, critical for intricate game development.

**Slick2D:** A game library that simplifies the crafting of 2D games, utilizing LWJGL’s capabilities.

**LibGDX:** This well-regarded framework supports a broad range of game development tasks and is backed by a strong community network.

## Forging Paths in 3D Game Development with Java

For 3D game development, Java provides engines with the necessary tools to construct vivid, engaging environments. Engines like Ardor3D and JMonkeyEngine come equipped with features needed for complex graphical projects.

## The Value of Open-Source Java Game Engines

Community-supported [Java game engines](https://bluebirdinternational.com/java-game-engines/) provide developers with cost-effective and customizable solutions. The collaborative nature of these tools means they are frequently updated with the latest advancements.

## Java’s Answer to Cross-Platform Compatibility

Engines like LibGDX facilitate the creation of games for an array of devices, ensuring your project can reach a broad audience.

## Java Development Libraries as Crucial Supplements

Using Java-based libraries can significantly refine the game development process, offering specialized tools for an array of game creation aspects.
Wednesday Links - Edition 2024-06-26
Tags: refactoring, renovate, kotlin, api
Published: 2024-06-26 14:22:29

Writing Truly Memory Safe JIT Compilers (10 min)☔
https://medium.com/graalvm/writing-truly-memory-safe-jit-compilers-f79ad44558dd

Refactoring Just Enough (2 min)⚖️
https://blog.thecodewhisperer.com/permalink/refactoring-just-enough

Power Assert now in Kotlin! (2 min)🎉
https://kt.academy/article/power-assert

Getting Started with Backstage (14 min)🪞
https://piotrminkowski.com/2024/06/13/getting-started-with-backstage/

URI design suggestions (4 min)🍥
https://www.mscharhag.com/api-design/rest-uri-design

Renovate for everything (1 min)👷
https://blog.frankel.ch/renovate-for-everything/

What's hidden behind "just implementation details" (8 min)🥷
https://ntietz.com/blog/whats-behind-just-implementation

If it never breaks, you're doing it wrong (7 min)🪅
https://ntietz.com/blog/if-it-never-breaks-youre-doing-it-wrong

I Will Fucking Piledrive You If You Mention AI Again (19 min)🤬
https://ludic.mataroa.blog/blog/i-will-fucking-piledrive-you-if-you-mention-ai-again/
گیربکس sew
Tags: sew
Published: 2024-06-26 14:18:37

گیربکس SEW یکی از محصولات برجسته در صنعت گیربکس و انتقال قدرت است که توسط شرکت SEW-Eurodrive تولید می‌شود. این شرکت که در سال 1931 در آلمان تأسیس شده است، به عنوان یکی از پیشروان در زمینه تولید سیستم‌های محرکه و گیربکس‌های صنعتی شناخته می‌شود.

گیربکس‌های SEW به دلیل کیفیت بالا، عملکرد قابل اعتماد و تنوع گسترده‌ای که ارائه می‌دهند، در بسیاری از صنایع مختلف مورد استفاده قرار می‌گیرند. از جمله این صنایع می‌توان به خودروسازی، تولیدات فولاد، صنعت غذایی و نوشیدنی، مواد شیمیایی، و صنایع معدنی اشاره کرد.

یکی از ویژگی‌های بارز گیربکس‌های SEW، طراحی ماژولار آنهاست که امکان انعطاف‌پذیری بالا و تطابق با نیازهای مختلف صنعتی را فراهم می‌کند. این طراحی ماژولار به کاربران این امکان را می‌دهد تا با ترکیب قطعات مختلف، به راحتی گیربکسی متناسب با نیاز خاص خود ایجاد کنند. همچنین، این گیربکس‌ها با استفاده از مواد با کیفیت بالا و تکنولوژی‌های پیشرفته تولید می‌شوند که موجب طول عمر بالا و کارایی بالای آنها می‌گردد.

گیربکس‌های SEW در انواع مختلفی از جمله گیربکس‌های حلزونی، هلیکال، مخروطی-مارپیچ و سیاره‌ای تولید می‌شوند. هر کدام از این انواع دارای ویژگی‌های خاص خود هستند که متناسب با نیازهای مختلف صنعتی طراحی شده‌اند. برای مثال، گیربکس‌های حلزونی به دلیل طراحی فشرده و کارایی بالا، مناسب برای فضاهای محدود و کاربردهای سبک هستند، در حالی که گیربکس‌های هلیکال برای کاربردهای سنگین و نیاز به انتقال قدرت بالا مناسب می‌باشند.

از دیگر مزایای گیربکس‌های SEW می‌توان به نگهداری آسان، کاهش نویز و لرزش، و بهره‌وری انرژی بالا اشاره کرد. این مزایا به کاربران کمک می‌کند تا با کاهش هزینه‌های نگهداری و انرژی، بهره‌وری و کارایی عملیات خود را افزایش دهند.

شما می‌توانید انواع گیربکس SEW را از مجموعه [**آرشا صنعت**](https://arshasanat.com/cat/gearbox/sew/) نمایندگی رسمی برند اس ای دبیلو در ایران با قیمت مناسب و ضمانت اصالت کالا خریداری نمایید.
HireVA Services
Tags: services, webdev, programming, beginners
Published: 2024-06-26 14:13:19

Elevate your business with our distinctive expertise. From crafting personalized designs to orchestrating seamless interactions, we translate your vision into digital reality. Discover the transformative impact of HireVA, where our VAs possess diverse skill sets in Automation, Project Management, CRM Management, GHL, SEO, and WordPress.
visit: [https://www.hireva.co/](https://www.hireva.co/)
Type issu in Nextjs app.
Tags: nextjs, typescript, reactjsdevelopment, nextjsdevelopment
Published: 2024-06-26 14:12:05

[Help please] how can i solve the issue? there is an object called diary comming from an database and passed to <DiaryEditForm diary={diary} /> component where a useState hook expecting that object. at build time it gives the following error. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vkckwr3kd9oka6a7b1um.png)


`import { db } from "@/db";
import DiaryEditForm from "@/components/diary-edit-form";
interface DiaryEditPageProps {
  params: {
    id: string;
  };
}
export default async function DiaryEditPage(props: DiaryEditPageProps) {
  const id = parseInt(props.params.id);
  const diary = await db.diary.findFirst({
    where: { id },
  });
  return (
    <div>
      <DiaryEditForm diary={diary} />
    </div>
  );
}`


`"use client";

import { Diary } from "@prisma/client";
import { useState } from "react";
import * as actions from "@/actions";

interface DiaryEditFormProps {
  diary: Diary;
}
export default function DiaryEditForm({ diary }: DiaryEditFormProps) {
  const [content, setContent] = useState(diary);
  const handleEditorChange = (event: {
    target: { name: string; value: string };
  }) => {
    const { name, value } = event.target;
    setContent((prevContent) => ({
      ...prevContent,
      [name]: value,
    }));
  };
  const editDiaryAction = actions.editDiary.bind(
    null,
    diary.id,
    content.title,
    content.description
  );
  return (
    <form action={editDiaryAction} className="space-y-4">
      <h1 className="text-center font-semibold">Edit your Diary</h1>
      <div>
        <label
          htmlFor="title"
          className="block text-gray-700 font-medium mb-2 leading-tight"
        >
          Title
        </label>
        <input
          type="text"
          name="title"
          id="title"
          value={content.title}
          onChange={handleEditorChange}
          className="w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:border-gray-500"
        />
      </div>
      <div>
        <label
          htmlFor="description"
          className="block text-gray-700 font-medium mb-2 leading-tight"
        >
          Description
        </label>
        <textarea
          name="description"
          id="description"
          value={content.description}
          onChange={handleEditorChange}
          className="min-h-32 w-full px-3 py-2 border border-gray-300 rounded focus:outline-none focus:border-gray-500"
        ></textarea>
      </div>

      <button
        type="submit"
        className="bg-gray-600 text-white px-4 py-2 rounded"
      >
        Save
      </button>
    </form>
  );
}
`
Tips for Cracking the Interviews
Tags: language, learning, education, englishspeaking
Published: 2024-06-26 13:57:08

Preparing for an interview can be a daunting task, but with the right tips, you can make a great impression. Firstly, research the company thoroughly to understand its culture and values. Practice common interview questions to build confidence and articulate your thoughts clearly. Dress appropriately for the interview, keeping in mind the company’s dress code. Arrive on time to demonstrate punctuality and respect for the interviewer’s time.

 Lastly, ask thoughtful questions at the end of the interview to show your genuine interest in the role and the company. Good preparation and a positive attitude can go a long way in securing your desired job. For **[commonly asked interview questions](https://englishfear.in/teacher-interview-questions-and-answers/)**, follow this link. Best of luck!
MGID's Generative AI
Tags: mgid, ai, generative
Published: 2024-06-26 13:53:31

MGID's Generative AI [https://www.mgid.com/blog/unleashing-creativity-exploring-mgid-s-generative-ai-features](https://www.mgid.com/blog/unleashing-creativity-exploring-mgid-s-generative-ai-features) is like having a creative assistant who never runs out of ideas. This tool helps regular folks, like us, craft engaging content effortlessly. Whether you're writing a blog post or an ad, the AI suggests relevant themes and phrases, making the process smoother and faster. It's not about replacing our creativity but enhancing it, saving time and reducing the stress of writer's block.
Abaya: A Symbol of Modesty and Tradition
Tags: javascript
Published: 2024-06-26 13:51:13

The [abaya](https://wearmumtaz.com/collections/abaya) is a long, flowing black cloak worn by Muslim women, primarily in the Middle East and North Africa. It is designed to cover the entire body except for the face, hands, and feet, symbolizing modesty and privacy. Traditionally, the abaya is made from lightweight fabrics like crepe or chiffon, making it comfortable for daily wear in hot climates. While traditionally plain, contemporary abayas often feature intricate embroidery, beadwork, and modern cuts. This garment holds cultural and religious significance, reflecting the wearer's identity and adherence to Islamic principles of modesty.