teleren/devto huggingface dataset:
More control over enum in Rails 7.1
Tags: rails, webdev, ruby
Published: 2024-02-29 17:02:22

`ActiveRecord::Enum` in Rails have long been a convenient tool for representing a set of symbolic values within a model. However, using `enum` can sometimes lead to unexpected behavior, especially when it comes to the automatic generation of instance methods. 
For instance, consider an `Order` model with an `enum` for status:

```ruby
class Order < ApplicationRecord
  enum status: [:pending, :processed]
end
```

Instance objects would have a convenient methods like `order.pending?`, `order.processed?`. 
One of common possible issues with generated instance methods might be naming conflicts. For example, if we need to add a new status `persisted` for our `Order` model.
```ruby 
class Order < ApplicationRecord
  enum status: [:pending, :processed, :persisted]
end
```
Simple adding it to the `enum` definition would lead to an `ArgumentError`:
```
You tried to define an enum named "status" on the model
"Order", but this will generate a instance method
"persisted?", which is already defined by Active Record.
(ArgumentError)
```
We can fix it by adding `_prefix`/`_suffix` option for the `enum`:
```ruby
class Order < ApplicationRecord
  enum status: [:pending, :processed, :persisted], _prefix: true
end
```
But then we'll have to update `#pending?`/`#processed?` usages to `#status_pending?`/`#status_processed?`.

## With Rails 7.1

In Rails 7.1, a new option `_instance_methods` is [introduced](https://github.com/rails/rails/pull/46490), allowing developers to opt-out of the automatic generation of instance methods for `enum`s. When `enum` is defined with  `_instance_methods: false`, Rails will no longer generate methods like `pending?`, `processed?`, etc.

```ruby
class Order < ApplicationRecord
  enum status: [:pending, :processed, :persisted], _instance_methods: false
end
```
Now we can define custom methods tailored to the specific needs without worrying about conflicts with automatically generated `enum` methods.

## Benefits
- **Reduced Method Clutter**: By disabling the automatic generation of `enum` methods, we can keep model interfaces cleaner and more focused.

- **Flexibility in Method Naming**: With `enum` instance methods disabled, we have the freedom to name methods the way we want to make the codebase more expressive and easier to understand.

- **Avoidance of Method Name Conflicts**: In scenarios where `enum` method names clash with existing or future method names in the model, disabling `enum` instance methods can prevent potential conflicts and bugs.

- **Improved Performance**: By reducing the number of automatically generated methods, there may be a slight improvement in application performance, especially in cases where models have numerous `enum` attributes.

---
**Dmitry Tsvetkov** *is a Software Engineer at JetThoughts. Follow him on [LinkedIn](https://www.linkedin.com/in/dmitry-tsvetkov-a374095a/) or [GitHub](https://github.com/vlaew).*

If you enjoyed this story, we recommend reading our [latest tech stories](https://jtway.co/latest) and [trending tech stories](https://jtway.co/trending).
The Dark Side of Artificial Intelligence
Published: 2024-02-29 17:02:09

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

2.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rtpkoyio5por1fhyo4d3.jpg)
3.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qfft6ll1ut8tpluchjw.jpg)
4.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4jgv3rj9qc1mq465uman.jpg)
5.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yb47aepmdgisakefnarl.jpg)
Sloan's Inbox: Am I too old to get into tech?
Tags: discuss, career
Published: 2024-02-29 17:00:00

Hey folks! Sloan, DEV Moderator and mascot. I'm back with another question submitted by a DEV community member. 🦥

For those unfamiliar with the series, this is another installment of Sloan's Inbox. You all send in your questions, I ask them on your behalf anonymously, and the community leaves comments to offer advice. Whether it's career development, office politics, industry trends, or improving technical skills, we cover all sorts of topics here. If you want to send in a question or talking point to be shared anonymously via Sloan, that'd be great; just scroll down to the bottom of the post for details on how.

Let's see what's up this week...

### Today's question is:

> I'm 54 years old and considering getting into software development as a career. I really like the flexibility of being able to work from home and set my own scheduled. In the past, I've experimented some with Python, but honestly don't have much experience. I know I have more work to do, but am I a lost cause or is it possible for someone like me to break into tech? Any advice is welcome! 
>

Share your thoughts and let's help a fellow DEV member out! Remember to keep kind and stay classy. 💚

---

*Want to submit a question for discussion or ask for advice? [Visit Sloan's Inbox](https://docs.google.com/forms/d/e/1FAIpQLSc6wgzJ1hh2OR4WsWlJN9WHUJ8jV4dFkRDF2TUP32urHSAsQg/viewform)! You can choose to remain anonymous.*
AI Runner 3.0.0 Dev preview: "real time" drawing / generation using Stable Diffusion
Tags: ai, stablediffusion, kandinsky, aiart
Published: 2024-02-29 16:59:41

---
title: AI Runner 3.0.0 Dev preview: "real time" drawing / generation using Stable Diffusion
published: true
description: 
tags: ai,stablediffusion,kandinsky,aiart
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-02-29 16:58 +0000
---

Video showcasing "real time" drawing and generation using Stable Diffusion in the upcoming AI Runner v3.0.0

{% embed https://youtu.be/uuzcacGbBK8 %}
User should understand blockchain technology?
Tags: blockchain, web3, qaengineer, cryptocurrency
Published: 2024-02-29 16:54:57

Blockchain has been around since 1991. A lot of people relate blockchain to Bitcoin and think Satoshi Nakamoto invented it. What Satoshi did was he combined several existing technologies into one masterpiece, as no one had done before.

In the 1980s at BellCore, there were two colleagues, Stuart Haber and W. Scott Stornetta, who realized that everything was going to become digital, and digital records can be easily changed. So, the idea of having a need to have immutable records was born. In 1991, they finished their work, but it showed the world and its current technology development was not yet ready for it. So, it waited for many years to get picked up.

Blockchain technology is more than crypto. Important thing to know is it can be used not only in cryptocurrencies world, but almost everywhere. Why it's not already used in all other aspects of our digital services is another pair of shoes. 

This technology is often thrown out there as buzzword in regular conversations by the business people who may not understand it, but they want to be part of the train that might acquire them some earnings. That is ok, not everyone should be a technologist.

There are two sides: `those who create it and those who use it.` 

Those who create it are engineers, and they should know how it works. But should user know how it works?

---

Today you are using internet, tv, mobile phone, but do you bother to understand the foundation technology behind the internet, TCP/IP. Do you wonder how your tv converts a digital signal into an image? A tech called DSP. Or have you ever questioned your mobile phone and how the tech behind it enables you to talk and receive messages, GSM/4G/5G, probably no, and you are still an everyday user of all of these three. It's so common and easy to use that you now take it for granted, as if you are entitled to them.

That should be the goal of engineers: To implement blockchain technology into products that are useful for you, and the only thing that should matter is that the product you are using is useful and easy to use.
  
The assumption that understanding the technical details of a technology is essential for its adoption is misleading. Lack of technical knowledge has not stopped the mass adoption of tv/computer/internet/mobile phone. People are generally indifferent to the mechanics of technologies as long as they serve their needs effectively.

Therefore, leave the details of the problematics to those who are working on finding solutions, everyone else should wait to see if there will be a useful product that they would use.
"The Arch -> NixOS Pipeline is Inevitable"
Published: 2024-02-29 16:43:38

Was back on Twitter/X for a few weeks - this post's title is a paraphrased tweet that got me to try out NixOS.

I've seen NixOS being called the "operating system for developers" and I believe it's true.

A personal and reproducible environment is something I've been dreaming about for a few years.

It feels a lot like Docker Compose.

Google "NixOS" and check the wiki to get an idea of what it's about:

{% cta https://nixos.wiki/wiki/Overview_of_the_NixOS_Linux_distribution %} nixos.wiki {% endcta %}

For those with Nvidia GPUs (like me):

{% cta 
https://www.reddit.com/r/NixOS/comments/qb96mq/comment/hh84fdz/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button %} `nomodeset` will help you boot up for the first time {% endcta %}

{% cta https://nixos.wiki/wiki/Nvidia#Modifying_NixOS_Configuration %} add this to your config to get your GPU working {% endcta %}

If you're on a laptop with a beefy GPU, first of all - why?, second - it might be a bit more tricky to set up as seen by the disclaimer in the wiki page above.

As for where I'm at, I'm adding Home Manager stuff to `configuration.nix` for those who know what that means.

Comment below if you're even more advanced and let me know what you like/don't like about the Nix package manager and NixOS.
YourGPT Launches Chatbot Studio: Key Takeaways
Tags: chatbotstudio, yourgpt, conversationalai, development
Published: 2024-02-29 16:06:17


{% embed https://www.youtube.com/watch?v=V0zIjgcG6yw&t %}

Today, YourGPT rolled out [**Chatbot Studio**](https://yourgpt.ai/chatbot/studio).



Chatbot Studio is a flow builder that allows to create advanced conversational AI agents. It includes features like detecting message intents to guide interactions, making calls to third-party APIs, responding interactively with elements such as images, carousels, and buttons, allowing human intervention through actions, and enabling customization of conversations with JavaScript code, among other capabilities.


### Key Takeaways from the Chatbot Studio Release:


- **Visual Flow Editor**: The creation of Conversational AI Agents through a visual editor by connecting nodes, making them accessible to users without coding expertise.

- **Enhanced Interaction Tools**: Offers advanced features like API calls, dynamic content (carousels, cards, buttons), and intent detection for richer user interactions.

- **Real-Time Testing and Deployment**: Integrated emulator for testing conversational flows in real-time, ensuring a polished user experience upon deployment.

- **Advanced Customisation**: Supports custom JavaScript code execution for custom functionalities, serving to specific needs.

- [**Pre-built Templates**](https://yourgpt.ai/chatbot/resources): Provides a variety of industry-specific templates (e-commerce, healthcare, real estate, travel, banking) for a quick and efficient setup.



Which features do you like the most? Share them in Comments!
Buy 5 layer Beaded Necklace with stylish hook in Noida Aakarshan
Published: 2024-02-29 16:18:25

**[Indulge in elegance with our exclusive 5-layer beaded necklace](-https://www.akarshans.com/products/5-layer-beaded-necklace-with-stylish-hook

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4gtfmgi8tqmhluwvz68d.jpeg))**, featuring a chic and stylish hook closure! Each layer is meticulously handcrafted, showcasing a mesmerizing array of beads meticulously arranged for a truly unique design. Elevate your ensemble effortlessly with this statement piece, perfect for adding a touch of sophistication to any outfit. Our artisans infuse passion and expertise into every detail, ensuring unmatched quality and craftsmanship. Whether you're attending a special occasion or looking to make a fashion statement, this necklace is sure to captivate attention. Explore our collection today and find the perfect accessory to complement your individual style. With its distinctive design and timeless allure, our 5-layer beaded necklace with a stylish hook closure is bound to become a cherished addition to your jewelry collection. Shop now from akarshans.com and get 30 % off and step into a world of refined luxury and unmatched beauty.
Material type: Beads
Metal type: No
Gem type: No Gemstone
Occasion type: Party wear, Daily wear
Item type name: Fashion Jewelry
Country of Origin: India
Keywords-5-Layer Beaded Necklace, Stylish Hook Closure Necklace, Versatile Layered Necklace

Link -https://www.akarshans.com/products/5-layer-beaded-necklace-with-stylish-hook
Phone - +91-9839397111
Email - sales@akarshans.com
Black Beads necklace in Noida Aakarshan in Bhopal Aakarshan
Published: 2024-02-29 16:16:46


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xvssemmrg0fy643va2ur.jpeg)**[Explore the allure of individuality](https://www.akarshans.com/products/black-beads-necklace
)** with our collection of unique black beads necklaces. Each piece is meticulously crafted to capture your distinctive style, offering a one-of-a-kind accessory that sets you apart from the crowd. Our selection features an array of unconventional black beads, including hand-carved obsidian, iridescent hematite, and artisan-crafted in captivating shapes and textures. Whether you gravitate towards minimalist designs or prefer bold statements, there's a black beads necklace in our collection that speaks to your individuality. Shop now from akarshans.com and get 30 % off Express yourself with confidence as you adorn yourself with a piece that reflects your unique personality and aesthetic. Stand out from the ordinary and embrace your uniqueness with a black beads necklace that exudes charm, sophistication, and unparalleled elegance.
material type: Beads
Metal type: No
Gem type: No Gemstone
Occasion type: Party wear, Daily wear
Item type name: Fashion Jewelry
Country of Origin: India

Keywords- Black Beads Necklace, Elegant Beaded Accessory, Versatile Beads Jewelry
Link -https://www.akarshans.com/products/black-beads-necklace
Phone - +91-9839397111
Email - sales@akarshans.com
Gcc on windows install
Published: 2024-02-29 16:03:44

If you have Homebrew installed on your Windows machine (via WSL - Windows Subsystem for Linux), you can use it to install GCC. Here's how:

### Install Homebrew on Windows (WSL):

1. **Install WSL**:
   - Make sure you have WSL enabled on your Windows machine. You can do this through "Turn Windows features on or off" in the Control Panel.
   - You can follow Microsoft's guide to [install WSL](https://docs.microsoft.com/en-us/windows/wsl/install).

2. **Install Ubuntu (or another Linux distribution)**:
   - Once WSL is installed, you need to install a Linux distribution from the Microsoft Store. Ubuntu is a popular choice:
     - Open Microsoft Store and search for "Ubuntu".
     - Click on "Ubuntu" and then click "Install".

3. **Set Up Ubuntu**:
   - Launch Ubuntu from the Start menu or the command line.
   - Follow the on-screen instructions to set up a new Linux user account and password.

### Install GCC with Homebrew:

Now that you have WSL and Ubuntu installed, you can use Homebrew to install GCC:

1. **Update Ubuntu**:
   - In the Ubuntu terminal, run:
     ```
     sudo apt-get update
     ```

2. **Install Homebrew**:
   - Run the following commands in the Ubuntu terminal:
     ```
     sudo apt-get install build-essential curl file git
     /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
     ```

3. **Install GCC**:
   - After Homebrew is installed, use it to install GCC:
     ```
     brew install gcc
     ```

4. **Verify Installation**:
   - After installation is complete, you can verify GCC is installed by running:
     ```
     gcc --version
     ```

### Using Homebrew for Windows (Alternative):

If you have [Homebrew for Windows](https://brew.sh/) (which installs packages in the Windows environment, not WSL), you can also use it to install GCC:

1. **Install Homebrew for Windows**:
   - Visit [brew.sh](https://brew.sh/) and follow the installation instructions to install Homebrew on Windows.

2. **Install GCC**:
   - Open Command Prompt or PowerShell as Administrator.
   - Run the following command to install GCC:
     ```
     brew install gcc
     ```

3. **Verify Installation**:
   - After installation is complete, you can verify GCC is installed by running:
     ```
     gcc --version
     ```

Homebrew for Windows works similarly to the macOS version, but it's important to note that it's a separate project from the Linux-focused Homebrew, so the available packages might differ.
Sardina Systems Announces Seamless Compatibility with New Gaudi2 Processors
Tags: opensource, cloud, linux, machinelearning
Published: 2024-02-29 16:02:53

_Sardina Systems, one of the leading providers of cloud infrastructure solutions, unveils the successful testing and integration of its software with the groundbreaking Gaudi2 processors. The compatibility of FishOS with Gaudi2 processors offers a significant leap in performance and efficiency for AI and machine learning (ML) applications._

The successful compatibility testing of [FishOS](https://www.sardinasystems.com/fishos/) with Gaudi2 processors opens up new possibilities for organizations willing to boost the performance of deep learning workloads. FishOS, known for its ability to optimize resource usage and manage server states efficiently, complements the capabilities of the Gaudi2 processor, resulting in improved efficiency and cost savings of cloud infrastructure. This proves that Gaudi2 computing resources can successfully pass through to virtual machines within the FishOS environment.

[![Banner: Contact us now for free and transform your AI journey](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ysyvdinb7p7ckn7ozu6.png)](https://www.sardinasystems.com/get-fishos/?utm_source=dev&utm_medium=website&utm_campaign=promo&utm_content=gaud-announcement)

FishOS is a turnkey infrastructure solution designed to meet the needs of both traditional enterprise workloads and next-generation applications. It leverages AI-enabled workload and monitoring engines to reduce total cost of ownership (TCO) by up to 10 times, optimize resource utilization, and provide automation with zero-click operations. The software ensures the reliability and efficiency of OpenStack and Kubernetes data centers.

Gaudi2, developed in collaboration with Habana Labs, is a cutting-edge AI processor designed to maximize training throughput and efficiency while offering optimized software and tools for various workloads and systems. The new Gaudi2 processor is built on a 7nm process technology and features 24 AI-customized Tensor Processor Cores, offering a significant boost in performance.

> _“We are thrilled to announce that FishOS is fully compatible with the Gaudi2 processors. It opens the door to more efficient deep learning training and inference workloads. Our solution, combined with the power of Gaudi2, offers a compelling opportunity for organizations to maximize their AI and machine learning capabilities while minimizing operational costs.”_
Kenneth Tan, Executive Director at Sardina Systems

The successful integration of FishOS and Gaudi2 processors provides organizations with improved price-to-performance ratios and significantly enhances their deep learning capabilities.

Find out more about how FishOS and Gaudi2 can enhance your performance and help you succeed in an evolving AI environment. [Contact our team now.](https://www.sardinasystems.com/get-fishos/?utm_source=dev&utm_medium=website&utm_campaign=promo&utm_content=gaud-announcement)
A new learning way on how to write "Hello, World!" program in Go [video]
Tags: go, programming, testing, development
Published: 2024-02-29 16:01:19

---
title: A new learning way on how to write "Hello, World!" program in Go [video]
published: true
description: 
tags: go, programming, testing, development
canonical_url: "https://www.youtube.com/watch?v=EECXgocw4N0"
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-02-29 14:29 +0000
---

Hello DEV Community!

I want to share with you my first video in the series about Go programming language. This video is a part of my upcoming course "Grokking Go Fundamentals with Tests" (GGFT) so if you are interested in learning Go with tests and TDD way subscribe to my channel to ensure you don't miss my next videos in the series.

In this video we will write a classic "Hello, World!" program but following Test-driven development way. If you don't know what is TDD you can watch this video where I introduce to this technique. 

{% youtube EECXgocw4N0 %}

[Link to the video](https://www.youtube.com/watch?v=EECXgocw4N0)
Solutions Architecture - Associate
Tags: aws, devops, cloud, architecture
Published: 2024-02-29 15:48:52

Hello community! See you tomorrow at the program launch! We are very happy to start the AWS Solutions Architect – Associate certification program together. Verify that you are registered for our initial session tomorrow, Friday, March 1, so that you do not miss the explanation of the program and can resolve any questions you may have prior to your preparation. 

Keep growing
My new project
Tags: webdev, javascript, programming, beginners
Published: 2024-02-29 15:48:01

Hello everyone, I come here to show you another project that I finished these days, the project is a website for stock management that I developed, a project proposed by OneBitCode in the ReactJS course, in the beginning I was just going to save the data in localstorage, but I I was curious and wanted to try to develop a database and try to create a back-end, I decided to look into how I could do this and I found Firebase which has many different tools for system development and its authentication system and database were perfect for what I was wanting to create and so I started developing this website.
It was the first time I dealt with and had contact with back-end and I really enjoyed working with this area of ​​web development, however it was a big challenge to do this part of the code, because it was something totally new I experienced some difficulties in development, However, with a lot of searching for documentation, tutorial videos on how to work and develop, communities, I managed to develop this part of the application, here below I will leave a sequence of videos that helped me a lot in development:
YouTube video playlist:
[youtube playlist](https://www.youtube.com/playlist?list=PLMbclvogjXZVxxN06cefN7q5nyt7u5dUq)

- For frontend development i used:
• ReactJS
• Javascript
• Sass
• Bootsrap

- For backend:
• NodeJS
• ExpressJS

- Extra services:
• Netlify -> To host the frontend
• Vercel -> To host the backend
• Github -> repositories
• Firebase auth -> For the user to create and log in to their account
• JWT -> For authentication
• Firestore database -> Database

Below are all the links, deployment and repository:
• Frontend repositorydo: [frontend](https://github.com/Jvcgoncalves/stock-manager)
• Backend repository: [backend](https://github.com/Jvcgoncalves/stock-manager-backend)
• Deployment : [stock-store](https://stock-storejvgc.netlify.app/)

- Any feedback plese contact me.