teleren/devto huggingface dataset:
Associated Class Members Introduce "Dimensions" to Classes
Tags: softwaredesign, objectoriented
Published: 2024-03-10 03:47:35

Usually, in the more useful object oriented tips the focus is more on improving the inheritance relations. Which is wonderful; it is nice to not see long inheritance chains. Even better, it is nice to see composition more than inheritance.

But there is another kind of chain that is caused just by using an object within the class regardless of composition and inheritance.

If a class uses another object in any form of association-esk relation, it introduces new "dimensions" for it. You could say in a very simple sense, dimension is observed through the number of dots you enter when accessing a method within the class: `this.object_a.object_b.object_c.hello()`.
You want the number of dots to be "enough" so that the class is properly "populated" and/or "bloated." 

Too large of a dot count might be the sign of a class doing something that is too low-level given its abstraction layer.

Consider a very dimensional class on one side of the spectrum, with the other side being a flat class. The flattest class contains only "plain old data" types. This means there might be custom objects within our class, but they don't have functionality; they're merely a collection of data and perform primitive operations on them. 

It is useful to take a second to reconsider whether a new dimension would be helpful before starting the implementation. It greatly contributes to reducing overengineering. The principle/idea is to usually prefer being more flat unless it is obvious that introducing dimension helps more. E.g. when a collection of members and methods are gravitating towards a certain behavior that can become a class on its own.

Using this policy, the dimensions are grown out of necessity, not out of our _imagination_ of _arbitrary_ necessities when they _don't exist_. 

Overengineering is born because the abstractions are larger than the requirements of the current code. Moreover, in an overengineered code, you have to **_fit the feature into the structure_**. But when the class is flatter, more free-form, you can just add a piece of code and then carve out abstractions based on that, if needed.

This stands in any granularity level:
- Variable: Does this value really need to be saved in a variable and occupy memory?
- Method: Do these few lines of code really need to be a method?
- Class: Does this collection of variables and methods really need to be a class on its own? Or is it okay enough to be in the class that they are currently residing in?

Having more dimension increases complexity. This statement is against the traditional "clean code" that generally encourages more classes and methods. Complexity isn't a "bad" thing. Complexity is a property that naturally exists, like the BMI level of human body. We just need to make sure it has a "reasonable" amount.
18 Tools for Software Engineers You Must Know
Tags: softwareengineering, developertools, techlife
Published: 2024-03-10 02:41:21


1. 💻 VSCode: Versatile and most popular code editor.

2. 🌐 Git: It is a distributed version control system that streamlines the development process.

3. 🐳 Docker: For development and deployment of apps inside portable containers.

4. 🔗 Linear: Comprehensive project management for agile software development.

5. 💬 Slack: Communication platform that integrates with many development tools.

6. 📬 Postman: A powerful API client for testing, documenting, and sharing APIs.

7. 👷 Jenkins: Automates software development process like builds, testing, and deployment.

8. 🎨 Figma: For developers to understand UI designs and collaborate with designers.

9. 🖥️ Terminal: Essential for script execution, file system navigation, and server management.

10. 🧩 Stack Overflow: A vast community and resource for solving coding problems.

11. 🧠 IntelliJ IDEA: A robust integrated development environment (IDE).

12. 📓 Notion: For creating documentation, project plans, and notes.

13. 🤖 GitHub Copilot: AI-powered code completion tool that helps you write code faster.

14. 🤝 ChatGPT: AI-powered chatbot that can assist with a wide range of tasks.

15. 📊 Drawio: A free, web-based tool for creating diagrams and flowcharts.

16. ⚙️ Kubernetes: Container orchestration platform.

17. 🔄 GitHub: Web-based version control and collaboration platform for code.

18. 📘 Amigoscode Blog: Curated courses & blogs for software engineers.

Credit goes to: [Mohamed Rilwan](https://www.linkedin.com/in/ACoAACGHoRsBUsuo5b2No54qjzGHthoJzuuH2-A?lipi=urn%3Ali%3Apage%3Ad_flagship3_detail_base%3BYKYBA82%2FSzOLmhQTcX4hEg%3D%3D)
Python Terminal Tic-Tac-Toe Game
Tags: python, github
Published: 2024-03-10 00:57:10

Hi! I want to share with you my portfolio project which I completed as part of my Computer Science career path on Codecademy. The project challenged me to post my code on GitHub and write a blog post to share my project.

The goal of this project was to create a terminal program using the coding tools I have learned so far (Python based). I chose to make a two-player Tic-Tac-Toe game.

https://github.com/JmeGP/Terminal-Game---Codecademy-portfolio

I had a lot of fun doing this project!
I would apreciate sugestions and comments that would help to improve this project!
YOLO: Real-Time Object Detection
Published: 2024-03-10 02:15:21

You only look once (YOLO) is a state-of-the-art, real-time object detection system. On a Pascal Titan X it processes images at 30 FPS and has a mAP of 57.9% on COCO test-dev.

**Comparison to Other Detectors**

YOLOv3 is extremely fast and accurate. In mAP measured at .5 IOU YOLOv3 is on par with Focal Loss but about 4x faster. Moreover, you can easily tradeoff between speed and accuracy simply by changing the size of the model, no retraining required!

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

[CONTINUE REEADING](https://pjreddie.com/darknet/yolo/)
Profiling Python Code for Performance
Tags: python, performance
Published: 2024-03-10 01:43:13

[Here are a few tools that are actively maintained that can help you understand and profile the performance of your Python code](https://github.com/rudolfolah/profiling-code/tree/main/python), from Django apps to Celery workers to desktop GUI apps:

* [yappi](https://github.com/sumerc/yappi/)
* [guppy3](https://github.com/zhuyifei1999/guppy3)
* [Memray](https://bloomberg.github.io/memray/overview.html)
* [cProfile](https://docs.python.org/3/library/profile.html#module-cProfile)
* [tracemalloc](https://docs.python.org/3/library/tracemalloc.html)
* [psutil](https://psutil.readthedocs.io/en/latest/)

{% embed https://www.youtube.com/live/wn_2e33KaYQ?t=2925&si=7KzUFLKSaynSFhCk %}

cProfile and tracemalloc are included in the Python Standard Library

The others are libraries that are actively maintained and can be used to diagnose various performance issues.

[Memray](https://bloomberg.github.io/memray/overview.html) is great and it works with Python threads and it produces flame graphs for the profiling reports. There's a plugin for `pytest` that can run Memray so you can profile your test code and the code running within the tests.

[Guppy3](https://github.com/zhuyifei1999/guppy3) is a neat tool for diagnosing memory leak issues.

{% embed https://youtu.be/oh0TXpk-uJg?si=b4yqb_Z4PRXmlj-6 %}

Check out the repo for code examples: https://github.com/rudolfolah/profiling-code/tree/main/python

I've previously written about how to profile performance for React JavaScript frontend builds over here: https://rudolfolah.com/profiling-webpack-node-react/

<small>Cover image by <a href="https://unsplash.com/@maxboettinger?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Max Böttinger</a> on <a href="https://unsplash.com/photos/red-and-blue-rally-car-S9sJUJQAwb8?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Unsplash</a></small>
CS50 Week 4 - Memory
Tags: beginners, cs50, learning
Published: 2024-03-10 00:54:15

To be fairly honest, this week's lecture went a little over my head. It was about bytes, pointers (which store the address of a value), and storing/freeing memory. It is good to free up memory that you're done using. The content this week felt more archaic and even after practice with the psets, I still feel uncomfortable doing it on my own. 

The psets were interesting though and really practical! The first one was Volume and the task was to change the volume of a melody by 2x the speed. The second one was Filter and the goal was to make 4 different filters that you could use on images. The final one was Recover and I had to write a program to find and "recover" the JPEGS in a memory card. For this one, I practiced opening, reading, and writing to files. 

I'm entering my halfway point in the course and I feel good! Excited to dive into the more modern languages and see how they approach teaching it. 

Also I feel like I should start thinking what I'd want to do for my final project.
Your organization has enabled or enforced SAML SSO ... you must re-authorize the OAuth Application `GitHub for VS Code`
Tags: github, auth, vscode
Published: 2024-03-10 00:53:40

I just came across the following while trying to clone a repo:

> The "contoso" organization has enabled or enforced SAML SSO. To access this repository, you must re-authorize the OAuth Application `GitHub for VS Code`

![Terminal screenshot of the Error message](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ojv29pbin87shc6xak3.png)

I searched how to enable per folder authentication for git.

The easiest solution was to simply run 

```
gh auth login
```

![Terminal screenshot of the login steps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v883crn0g7syo972kn1f.png)

Happy cloning...
Building APIs with Django REST Framework
Tags: webdev, beginners, programming, python
Published: 2024-03-10 00:31:51

## Introduction

Building Application Programming Interfaces (APIs) can be a daunting task for developers. However, with the emergence of Django REST Framework, this process has become easier and more efficient. Django REST Framework is a powerful, open-source tool that allows developers to quickly and easily create RESTful APIs with the Django framework.

## Advantages

- **Complex Data Handling:** One of the key advantages of using Django REST Framework is its ability to handle complex data relationships and serialization. With its built-in serialization capabilities, developers can easily convert data objects into formats that can be transmitted over the web, simplifying the process of creating and maintaining APIs.

- **Strong Authentication and Authorization:** The framework provides strong authentication and authorization features, offering various options such as session-based, token-based, and OAuth2 authentication to ensure secure communication between the client and server.

- **Performance Optimization Tools:** It comes equipped with a robust set of tools like throttling, pagination, and filtering, which help in optimizing API performance and enhancing user experience.

## Disadvantages

- **Steep Learning Curve:** One major disadvantage is its steep learning curve. Due to its extensive features and customization options, it may take some time for developers to fully grasp its functionality.

## Key Features

- **Browsable API Interface:** A standout feature of Django REST Framework is its browsable API interface, allowing developers to test and debug their APIs in a user-friendly, interactive manner.

- **Support for Multiple Data Formats:** The framework supports multiple data formats, including JSON, XML, and YAML, making it flexible and adaptable to a variety of projects.

### Implementing a Simple API

```python
from rest_framework import serializers, viewsets
from .models import MyModel

# Serializer class
class MyModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = MyModel
        fields = '__all__'

# ViewSet class
class MyModelViewSet(viewsets.ModelViewSet):
    queryset = MyModel.objects.all()
    serializer_class = MyModelSerializer
```

This snippet demonstrates the simplicity of setting up a basic API using Django REST Framework, showcasing the integration of serializers and viewsets.

## Conclusion

In conclusion, Django REST Framework provides developers with a convenient and efficient way to build RESTful APIs with the Django framework. Its rich features, secure authentication, and flexibility make it a popular choice among developers for creating robust and scalable APIs. While it may have a steep learning curve, the benefits of using Django REST Framework far outweigh the disadvantages. As technology advances, the use of APIs will continue to grow, and Django REST Framework will remain a valuable tool for developers in building high-quality APIs quickly and easily.
Streamlining your Code Reviews for Maximum Impact
Tags: programming, productivity, beginners, community
Published: 2024-03-10 00:05:44

In the fast-paced environment of software development, code reviews are a fundamental element of ensuring code quality, identifying potential defects, and promoting knowledge sharing.

However, lengthy code reviews can be counterproductive, consuming valuable time and potentially hindering developer productivity. Many experienced developers advocate a "less is more" philosophy for code reviews, so I've started to implement this approach, and now I’d like to share some tips with you.

To be a good code reviewer, you should:

✅ Use code review tools to highlight specific code sections and categorize issues.
✅ Acknowledge well-written code sections and highlight positive aspects of the reviewed work.
✅ Focus on critical issues such as major bugs, security vulnerabilities, and potential performance bottlenecks.
✅ Ask for context or background information before suggesting changes.
✅ Offer clear suggestions for improvement in a professional manner.
✅ Encourage dialogue and knowledge sharing by asking questions that stimulate discussion and alternative solutions.

Similarly, avoid falling into the trap of:

❌ Getting bogged down in minor formatting or style preferences.
❌ Writing lengthy explanations in the comments section.
❌ Focusing on blaming developers for issues you find.
❌ Waiting until the last minute to review large amounts of code at once.

Remember that lengthy reviews can significantly impact turnaround times, so streamlined code reviews allow for faster feedback loops and faster development cycles. In addition, it is important to balance conciseness with clarity in code reviews to make it easier for developers to understand and resolve issues.

Have you tried the 'less is more' approach? What were the results? What are your tips for effective and efficient code reviews? Share your thoughts on code review best practices on comments!

In my next post, I'll cover some ways we, as developers, can streamline the code review process, so stay tuned 👍

---

Cover image by <a href="https://unsplash.com/es/@prateekkatyal?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Prateek Katyal</a>
Conditional Styles with CSS :has
Tags: css, tip
Published: 2024-03-14 17:29:30

---
title: Conditional Styles with CSS :has
published: true
date: 2024-03-10 00:00:00 UTC
tags: css,tip
canonical_url: https://goulet.dev/posts/conditional-styles-with-has/
---

I was setting up a simple landing page for [Fandwagon](https://fandwagon.com/) and just wanted some text to be strike-through when the user checks a checkbox. So far my landing page has no need for any JavaScript, and thankfully I can keep it that way and still get conditional styles with the `:has()` pseudo-class.

## Demo

{% codepen https://codepen.io/wes_goulet/pen/rNbMpYg %}

## Code

First, the HTML - a simple form with a checkbox.

```
<form>
  <p>
    Want to know when it's ready?
    <span
      >I'll send you one email when it's ready, then delete your email address
      forever.</span
    >
  </p>
  <div>
    <input type="checkbox" switch name="subscribe" id="subscribe" />
    <label for="subscribe">Check this box to subscribe to updates</label>
  </div>
</form>
```

And the CSS for the conditional strike-through

```
#example-form:has(input:checked) span {
  text-decoration: line-through;
}
```

## Breaking down the selector

The first part `#example-form:has(input:checked)` is basically saying "find the element with id of `example-form` that _has_ a child `input` element that is checked".

`:has` is basically a very-flexible "parent selector".

Once we've selected the parent that contains the checked `input` then we select the descendent `span` element and apply the `text-decoration: line-through` style.

💥 Done! No JavaScript needed!

> You can get pretty far in conditional styling by combining `:has` and `:checked` pseudo-classes. If you have any cool example of combining the two then send me an email, I'd love to see!
Automatiza de forma rápida y sencilla la consolidación de dependencias npm de diferentes proyectos en un nuevo proyecto.
Tags: npm
Published: 2024-03-09 23:25:08

## bundpac
### Visión general
Bundpac es una herramienta que automatiza de forma rápida y sencilla la consolidación de dependencias de diferentes proyectos en un único nuevo proyecto.

1. **Lista de todos los proyectos**: Ver fácilmente todos los proyectos (npm) dentro de un directorio especificado.

2. **Selección dinámica de proyectos**: Facilita la selección dinámica de diferentes proyectos de los listados.

3. **Consolidación de dependencias**: Crea automáticamente un nuevo directorio con un nombre proporcionado y genera un archivo package.json en su interior. Este fichero package.json consolida todas las dependencias de los proyectos seleccionados.

### Instalación

Instala bundpac de forma global con npm:

``
npm install -g bundpac
``

## Uso
1. Instala "bundpac" de forma global.

    ``
    npm install -g bundpac
    ``

2. Abre una consola (CMD).

3. Dirígete al directorio donde se encuentran los subdirectorios de los proyectos que quieres consolidar. (El script revisa todos los subdirectorios en búsqueda del archivo "package.json" de cada proyecto y extrae el nombre del proyecto y sus dependencias) 

4. Escribe el comando ```bundpac``` y presiona "Enter", se desplegara el menu.

5. Selecciona dos o mas proyectos que desees consolidar. (Para cambiar el estatus de selección de los proyectos, debes colocarte sobre el proyecto en el listado y presionar la tecla de espacio para cambiar el estatus de selección)

6. Ya seleccionados los proyectos deseados presiona la tecla "Enter."

7. Se desplegara una caja de texto donde se ingresara el nombre del proyecto consolidado.

8. Ingresado el nombre presiona la tecla "Enter" para crear el proyecto y el se creara automáticamente el directorio del proyecto con su package.json.

9. En una consola (CMD) ingresa el directorio del proyecto creado y ejecuta `npm install` para instalar todas las dependencias.

10. Para salir puede pulsa 'esc' o la combinación de "ctrl + z" o "shift + q"

## Ejemplo

### MENU
![Menu](https://raw.githubusercontent.com/joseluis18vs/bundpac/main/img/bp_menu.png)

### Selección
![Select](https://raw.githubusercontent.com/joseluis18vs/bundpac/main/img/bp_select.png)

### Nuevo Proyecto
![Select](https://raw.githubusercontent.com/joseluis18vs/bundpac/main/img/bp_type.png)

### Proyecto Creado
![Select](https://raw.githubusercontent.com/joseluis18vs/bundpac/main/img/bp_created.png)

## Contribuir
Las contribuciones son bienvenidas. No dude en enviar problemas, solicitudes de funciones o pull requests.
[Repositorio Github](https://github.com/joseluis18vs/bundpac)

## Licencia
Este proyecto está bajo la Licencia MIT.
Automates the consolidation of npm dependencies from different projects into a single new project.
Tags: npm, tooling, dependencyinversion, javascript
Published: 2024-03-09 23:19:58

## bundpac

Is a npm tool that quickly and easily automates the consolidation of dependencies from different projects into a single new project.

### Overview

1. **List All Projects**: Easily view all projects (npm) within a specified directory.

2. **Dynamic Project Selection**: Facilitates the dynamic selection of different projects from the listed ones.

3. **Dependency Consolidation**: Automatically creates a new directory with a provided name and generates a package.json file inside. This package.json file consolidates all the dependencies from the selected projects.

### Installation

Install bundpac globally using npm:

``
npm install -g bundpac
``

## Usage

1. Install "bundpac" globally.

    ``
    npm install -g bundpac
    ``

2. Open a console (CMD).

3. Go to the directory where the subdirectories of the projects you want to consolidate are located. (The script checks all subdirectories for the "package.json" file of each project and extracts the name of the project and its dependencies). 

4. Type the command ``bundpac`` and press "Enter", the menu will pop up.

5. Select two or more projects you wish to consolidate. (To change the selection status of the projects, hover over the project in the list and press the space key to change the selection status.)

6. Once the desired projects have been selected, press the "Enter" key.

7. A text box will be displayed where you will enter the name of the consolidated project.

8. Once the name is entered, press the "Enter" key to create the project and the project directory with its package.json will be automatically created.

9. In a console (CMD) enter the directory of the created project and execute ```npm install``` to install all the dependencies.

10. To exit you can press 'esc' or the combination of "ctrl + z" or "shift + q".

## Example

### Menu
![Menu](https://raw.githubusercontent.com/joseluis18vs/bundpac/main/img/bp_menu.png)

#### Select Projects
![Select](https://raw.githubusercontent.com/joseluis18vs/bundpac/main/img/bp_select.png)

#### New project name
![Select](https://raw.githubusercontent.com/joseluis18vs/bundpac/main/img/bp_type.png)

#### New project created
![Select](https://raw.githubusercontent.com/joseluis18vs/bundpac/main/img/bp_created.png)

## Contributing
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

[Github Repo](https://github.com/joseluis18vs/bundpac)

## License
This project is licensed under the MIT License.
HIGHLY RECOMMENDED RECOVERY EXPERT_TECHNOCRATE RECOVERY
Tags: cryptocurrency, bitcoin, usdt, ethereum
Published: 2024-03-09 23:01:33

The complex nature of blockchain technology and the inherent risks of the online world can sometimes lead to the loss of valuable Bitcoin. Fortunately, there are specialized services like Technocrate Recovery that offer the expertise and tools necessary to retrieve lost Bitcoin due to errors. Malware and ransomware are like dark spells cast upon unsuspecting victims' devices. Once infected, these malicious software programs can gain unauthorized access to wallets, steal private keys, or even encrypt users' data, holding it hostage until a ransom is paid. The underworld of hackers profits from the financial turmoil caused by these insidious creations. Despite a vicious counterattack, In my case study, Technocrate Recovery skill and perseverance won out. They became an unshakable beacon of hope, demonstrating that lost cryptocurrency can be found and recovered even in the most remote corners of the internet. Contacting Technocrate Recovery's specialists is the first step towards recovery if you find yourself in the regrettable position of losing your hard-earned Bitcoin as a result of a mistake or security breach. They have a staff of knowledgeable experts available to help you recover your lost Bitcoin back and get back on track. Ensure to keep track with Technocrate Recovery via email on:
Send Mail: Technocratrecove ry@contractor.net
Telegram: (@)TECHNOCRATE_RECOVERY
Homepage: wwW.technocraterecovery. site