teleren/devto huggingface dataset:
Resource Generator
Published: 2023-10-09 18:53:41

Rails generators quickly scaffold a database-backed web resource. Rails generators automate the creation of several files and boilerplate code for CRUD (Create, Read, Update, Delete) operations.


#Steps to Generate a Resource
1. Running the generator command
You can create a new resource using the following command:

```
rails generate draft:resource <MODEL_NAME_SINGULAR> <COLUMN_1_NAME>:<COLUMN_1_DATATYPE> <COLUMN_2_NAME>:<COLUMN_2_DATATYPE> # etc
```
Or for short,
```
rails g
```

Example
```
rails generate draft:resource post title:string body:text expires_on:date board_id:integer
```

2. Migrating the database
After running the generator, you must migrate the database:

```
rake db:migrate
```

#What Gets Generated?
- Model and Migration: `app/models/post.rb` and `db/migrate/20200602191145_create_posts.rb`.

- Controller: `app/controllers/posts_controller.rb`.

- Views: Files within `app/views/posts`.

- Routes: RESTful routes added to `config/routes.rb`.

# How to Correct Mistakes
If you've not migrated yet
```
rails destroy draft:resource post
```

If you've migrated
```
rake db:rollback
rails destroy draft:resource post
```

#Modifying the Database Schema
Adding a Column
```
rails g migration AddImageToPosts
```

Then in the migration file:

```ruby
def change
  add_column :posts, :image, :string
end
```

```rake db:migrate```


Removing a Column
```
rails g migration RemoveExpiresOnFromPosts
```
Then in the migration file:

```ruby
def change
  remove_column :posts, :expires_on
end
```
```rake db:migrate```

If your database gets into a weird state (usually caused by deleting old migration files), your ultimate last resort is
```
rake db:drop
```
This will destroy your database and all the data within it. Next, fix migrations and re-run all from scratch with `rake db:migrate`, then `rake sample_data` to recover the sample data.
Annoyed by Microsoft Teams' new Icon? Here's the Solution
Tags: microsoft, tutorial, swift, ux
Published: 2023-10-09 22:01:44

Microsoft's recent update to the Teams app brought more than just routine enhancements. In a manner reminiscent of their approach with the Outlook redesign, they introduced a new iteration of Teams alongside the existing one. This fresh addition is named Microsoft Teams (work or school) and prominently displays a "New" badge on its icon in the lower-right corner. Meanwhile, the original version has been rebranded as Microsoft Teams classic and retains its familiar icon.

Personally, I don't find it problematic to have both versions coexisting on my system, with the hope that the older one will eventually be phased out in future updates. What truly irks me, however, is that persistent "New" label on the icon – it's enough to drive anyone a little crazy.

Fortunately, there's a simple solution to restore the classic icon to the new Teams app:

1. Open Finder and navigate to the "Applications" folder, where both Teams apps are located.

2. Right-click on both apps and select "Get Info." This action will bring up two separate windows. 
![Microsoft Teams App Info](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rxm3fu1asg8hq6z5d7r2.png)

3. In the "Get Info" windows, you'll see the app icons. To replace the new app's icon with the classic one, drag the old app's preview image (the icon) and drop it onto the small icon next to the new app's name, as demonstrated in the provided GIF.
![Update App Icon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgkghowri6ige39n81lf.gif)

4. Congratulations! You've successfully updated the app icon to match the classic version. If you find that the old icon still appears in your Dock, remove Teams from the Dock and then re-add it. This should ensure that the correct icon is displayed.

![Microsoft Teams App Info](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atcup0fr2r7utwn8mahg.png)


By following these steps, you can resolve the annoyance of the new Teams icon and enjoy a seamless Teams experience with the icon you're used to. Cheers!
Day 828 : Dirty Laundry
Tags: hiphop, code, coding, lifelongdev
Published: 2023-10-09 21:40:15

_liner notes_:
- Saturday : Normal Saturday where I just did some errands before heading to the radio show. Did the show and had a good time. The recording of this week's show is at https://kNOwBETTERHIPHOP.com

![Radio show episode image of a chart showing that OutKast has the highest selling rap album of all time with Speakerboxxx/The Love Below with the words Oct 7th 2023 United](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/77hfwcwetttdvtc7qhlo.jpg)

- Sunday : Got back to doing my study sessions at https://untilit.works . Turned out to be a pretty productive day. Completed the post radio show promo work. Did the mountain of dirty laundry I accumulated from my trip overseas. I signed up for my 2024 healthcare plan. Did some research for a new side project. Ended the night watching the new "Spy x Family" episode and caught up with "Zom 100". Pretty good day.

- Professional : Today I started off with a couple of meetings. Rest of the day, worked on updating some documentation and checking code snippets. Not a bad way to start off the week.

- Personal : Been thinking about ways to do my new side project. There may be another way to implement the main feature and it could work out cheaper than the original method I was going to use. We'll see when I get to that part of the project. Still got some stuff to do before then.

![A river flowing through a canyon in Zion Narrows, UT, USA with a small waterfall](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1aazf1bcwoxysq32auwl.jpg)

Going to read some documentation for a feature I want to try and implement on my side project. Going to see if I can spin up a proof of concept and if I want to include it in the project. I want to also go through some tracks for the radio show. Maybe watch some anime. Going to have dinner.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube 1okqvhq7ZaI %}
🔔 Desktop notifications in 10 lines of Python code
Tags: python, swift, tutorial, linux
Published: 2023-10-09 21:12:22

_This article was originally published at [Pythongasm](https://www.pythongasm.com/desktop-notifications-with-10-lines-of-python-code)_

## Introduction
We often use the print function to see the progress of a script, or simply for debugging purposes. Rather than constantly looking at the terminal, and waiting for an output to pop up, we can use push notifications as a way to track progress while working on something else.

Our approach to make this happen will be very simple — we will use operating system’s built-in commands for notifications, and just execute them through Python. Few lines of code, no third party modules.

## MacOS
The following terminal command executes AppleScript (Apple’s own scripting language) for notifications:

```shell
osascript -e 'display notification "Your message goes here" with title "Title"'
```
Try running this command via terminal, and you will see a notification like this:

![macos-notification](https://raw.githubusercontent.com/pythongasm/cdn/main/notification-mac.png)

Let’s break down the script to understand how this works:

![macos-notification-command-breakdown](https://raw.githubusercontent.com/pythongasm/cdn/main/osascript.png)

We can customise/parameterise and execute this command with a simple Python snippet:

```python
import os
title = "Success"
message = "File downloaded"
command = f'''
osascript -e 'display notification "{message}" with title "{title}"'
'''
os.system(command)
```

## Linux
Linux-based operating systems offer an even simpler command:

```shell
notify-send "Your message" "Title"
```

Just like we did it for macOS, we can pass this command in os.system() and that’s it.

## Making it cross-platform
By this, I just mean making sure the same Python file works on both macOS and Linux. Python has a built-in module called platform, which we will use to know the host machine's OS.

```shell
>>> import platform
>>> platform.system()
>>> 'Linux'
```

`platform.system()` returns 'Darwin' when run on macOS.

Now, all we need to do is put conditionals, check the platform and execute the command accordingly. We can put all of this together, and define a `push()` function like this:

```python
def push(title, message):
    plt = platform.system()

    if plt=='Darwin':
        command = f'''
        osascript -e 'display notification "{message}" with title "{title}"'
        '''
    if plt=='Linux':
        command = f'''
        notify-send "{title}" "{message}"
        '''
    else:
        return

    os.system(command)
```

## Conclusion
This was a quick and easy way to push desktop notifications with Python. There are many third-party libraries out there made specifically for this purpose. This tutorial only covered unix platforms, however, we have a Python way to do this on Windows as well. Check out the next section for relevant links.

Further readings
- [win10toast (Windows notifications)](https://pypi.org/project/win10toast/)
- [osascript](https://ss64.com/osx/osascript.html)
Vagrant - configurando VM's de forma performática
Tags: virtualmachine, vagrant, automation, ubuntu
Published: 2023-10-09 20:58:19

Vagrant é uma ferramenta que permite a criação e manipulação de máquinas virtuais. É uma ótima ferramenta quando precisamos manipular várias máquinas, ou para automatizar settup de máquina virtual.  No exemplo estou utilizando ela em conjunto com o VirtualBox, porém poderia ser utilizada com outras ferramentas de virtual machine. 

** Não vou comentar a instalação do VB, pois já existem centenas de tutoriais sobre o assunto.

A ferramenta utiliza o conceito de box, então cada máquina criada é uma pequena caixa com configurações e gestão independente. Utilizando a ferramenta não é necessário passar horas baixando ISO's, ou configurando a mesma máquina centenas de vezes. Basta encontrar uma configuração de box compátivel com a que eu quero e configura-la uma vez. Ou até mesmo criar minha propria box (para mim não foi necessário até o momento).



#### Instalação no Ubuntu

```bash
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
```

```bash
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
```

```bash
sudo apt update && sudo apt install vagrant
```


#### Informações úteis

Dependendo das configurações do VirtualBox, será necessário importar essa variável de ambiente antes de começar as iterações com a ferramenta, ou criar um arquivo de ambiente:

```bash
export VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
```


#### Configuração

Assim como o Ansible, Docker e afins, o Vagrant utiliza um arquivo central de configuração, o Vagrantfile, pode ser criado um arquivo por contexto:

```shell
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
	config.vm.box = "hashicorp/precise64"
	config.vm.define :db do |db_config|
		db_config.vm.network :private_network, :ip => "192.168.56.10"
	end
	config.vm.define :web do |web_config|
		web_config.vm.network :private_network, :ip => "192.168.56.12"
	end
end
```

O parâmetro `config.vm.define :db`, define um alias para a máquina que será criada, nesse caso o acrônimo será *db*.

`config.vm.box = "hashicorp/precise64"`, é a configuração de box que será utilizada para criar as máquinas. Nesses sites você pode encontrar mais informações: https://vagrantcloud.com/. Uma box para a versão recente do **ubuntu** é: `bento/ubuntu-22.04`. 


Um informação importante é o range de IP's que será utilizado para configuração de network, esteja atento as configurações rede da máquina hospedeira.


#### Comandos úteis

Para criar todas as máquinas do context (isso dentro do work directory onde está o arquivo de configurações):

```bash
vagrant up
```

Para excluir todas as máquinas de um contexto (ele abre um dialogue box e pergunta quais serão excluídas):

```bash
vagrant destroy
```

Para adicionar uma configuração de box localmente:

```bash
vagrant box add nome_da_vm
```

Para acessar uma máquina:

```bash
vagrant ssh nome_da_vm
```
Is Open Source communism?
Tags: opensource, jokes, programming, hacktoberfest
Published: 2023-10-09 20:02:25

## At least Microsoft would say so in the 1990s when competing with Linux
![image](https://github.com/webcrumbs-community/webcrumbs/assets/116091091/fee1508c-9f8a-4b36-8c1f-4c34caba666f)

PS: If you find it funny, here's a list of other "interesting" [views](https://wiki.c2.com/?OpenSourceEqualsSocialism).

## But no, mates. Open Source is not communism ;)

"Open-source software can help protect against monopolies. For example, the rise of [GNU/Linux](https://en.wikipedia.org/wiki/Linux), an open-source computer operating system, helped prevent Microsoft from being considered a monopolist.[[9]](https://en.wikipedia.org/wiki/Open-source_economics#cite_note-brookings_mono-9) Microsoft considered Linux to be their main competitor during the 1990s.[[9]](https://en.wikipedia.org/wiki/Open-source_economics#cite_note-brookings_mono-9) Many computer makers offer Linux or Windows for their users, and a large percentage of mobile phone and tablet operating systems are Android, which is a Linux variant. Not only are monopolies affected, but several other businesses with strongholds are affected. Microsoft Office has open-source competitors such as [LibreOffice](https://en.wikipedia.org/wiki/LibreOffice)." (Wikipedia, [Open-Source Economics](https://en.wikipedia.org/wiki/Open-source_economics))

Cheers!

{% embed https://github.com/webcrumbs-community/webcrumbs %}

**Follow our [Open Source project at GitHub](https://github.com/webcrumbs-community) ⭐️. It's Wordpress for React. And we're growing fast! 100+ people in 3 weeks, and counting. Open for contribution.**
poco classes in csharp
Tags: csharp, devops, beginners
Published: 2023-10-09 20:01:42

Understanding POCO Classes in C#

As a programmer, you've likely encountered the term "POCO class" in the context of C# development. POCO, which stands for Plain Old CLR Object, is a fundamental concept in the world of object-oriented programming. In this article, we'll delve into what POCO classes are, their significance, and how to use them effectively in your C# applications.

What is a POCO Class?

At its core, a POCO class is a simple, plain C# class that doesn't depend on any specific framework or technology. It's a regular class that represents an entity in your application, and it's used to store and manipulate data. POCO classes are lightweight and easy to understand, making them a cornerstone of clean and maintainable code.

Benefits of POCO Classes

Decoupling: POCO classes promote loose coupling between your application's business logic and data access layer. Since they don't rely on any particular database or ORM framework, you can easily switch between different data access technologies without affecting your core business logic.

Testability: POCO classes are highly testable because they have no dependencies on external frameworks or databases. You can create instances of POCO classes in your unit tests without the need for complex setup.

Readability and Maintainability: POCO classes are easy to read and maintain since they focus solely on representing data. This simplicity makes your codebase more understandable and less error-prone.

Creating a POCO Class

Here's an example of a POCO class that represents a simple "Person" entity:

csharp
Copy code
public class Person
{
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime BirthDate { get; set; }
}
In this example, the Person class is a POCO class with properties representing the person's ID, first name, last name, and birthdate.

Using POCO Classes in C#

You can use POCO classes in various scenarios, such as:

Entity Framework: POCO classes can be used as entities in Entity Framework for database operations.
Web API Models: POCO classes are commonly used as models for API request and response objects.
DTOs (Data Transfer Objects): POCO classes can serve as DTOs to transfer data between layers of your application.
Conclusion

POCO classes are a fundamental building block of clean, maintainable, and testable C# code. They promote a separation of concerns, enhance testability, and make your code more readable. By using POCO classes effectively, you can create robust and flexible C# applications that are easy to maintain and extend.

In your journey as a C# developer, embracing POCO classes will undoubtedly contribute to the quality and maintainability of your codebase.

Feel free to modify and expand upon this article to suit your weblog's specific requirements and audience.

written by Mohammad ghorbani 
: [irangig.com ](https://irangig.com)
Raku Blog Posts 2023.41
Tags: programming, rakulang, summary
Published: 2023-10-09 19:56:22

- [Spawnratelimiting](https://gfldex.wordpress.com/2023/10/09/spawnratelimiting/)

*Wenzel P.P. Peppmeyer* strains the Raku Programming Language to the limit. 

- [Rakudo Weekly News 2023.41](https://rakudoweekly.blog/2023/10/09/2023-41-free-in-three/)

*Elizabeth Mattijsen* reports on all recent developments around Rakudo, an implementation of the [Raku Programming Language](https://raku.org).
Creating an Animal Segmentation Model with U-Net and TensorFlow Keras
Tags: python, tensorflow, deeplearning, unet
Published: 2023-10-09 19:55:03

This tutorial provides a step-by-step guide on how to implement and train a U-Net model for animals segmentation using TensorFlow/Keras.

The tutorial is divided into four parts: 

Part 1: Data Preprocessing and Preparation In this part, you load and preprocess the persons dataset, including resizing images and masks, converting masks to binary format, and splitting the data into training, validation, and testing sets. 

Part 2: U-Net Model Architecture This part defines the U-Net model architecture using Keras. It includes building blocks for convolutional layers, constructing the encoder and decoder parts of the U-Net, and defining the final output layer. 

Part 3: Model Training Here, you load the preprocessed data and train the U-Net model. You compile the model, define training parameters like learning rate and batch size, and use callbacks for model checkpointing, learning rate reduction, and early stopping. 

Part 4: Model Evaluation and Inference The final part demonstrates how to load the trained model, perform inference on test data, and visualize the predicted segmentation masks.

If you are interested in learning modern Computer Vision course with deep dive with TensorFlow , Keras and Pytorch , you can find it here : [http://bit.ly/3HeDy1V](http://bit.ly/3HeDy1V) 

Perfect course for every computer

actually recommend this book for deep learning based on Tensorflow and Keras : https://amzn.to/3STWZ2N

Check out our tutorial here : https://youtu.be/oHc4yrV64wU


Enjoy

Eran

#Python #openCV #TensorFlow #Deeplearning #DeepLearningTutorial #Unet #ImageClassificationTutorial
Weekend project: Remote-controlled Rover over the Internet using AWS IoT Core and React.
Tags: aws, react, robotics, iot
Published: 2023-10-09 19:48:43

{% embed https://www.youtube.com/embed/m4HlvYN3ygo?si=bPi8ZVqEirZ25HlG&amp;controls=0 %}

**Source Code:**
- [Rover Hardware](https://github.com/vynci/rovy-hardware/tree/rovy-part-1) (branch -> `rovy-part-1`)
- [Mobile App](https://github.com/vynci/rovy-mobile/tree/rovy-part-1) (branch -> `rovy-part-1`)

I have a full write-up of this in my blog. You can check it out here [here](https://www.vynci.dev/posts/robot-control-using-aws-iot-core).
What can we learn from the YandereDev situation?
Tags: mentalhealth, advice, life
Published: 2023-10-09 19:06:20

I have read about the Yandere simulation from a while ago, only recently after the allegations...resurfaced, I have grasped the situation.
zooming at the development angle and professional life of the developer, away from the unsupervised and illegal -alleged till now- communication with underage girls.
I will talk about about the perfectionist trap.
how he forged a unique and beautiful idea for the game (not going to lie) but kept it in a loop for 9 years of development and Beta phase.
every once in a while he would issue a promo or merch then again in his confinement to tweak the perfect image in his game.
He quit almost all social life and did not allow any delegation or collaboration.
resulting in a massive drop in his monthly income, and deterioration in mental health.
A few years ago there was a prodigy called Terry Davis who made an OS in his basement.
claiming it was from God, I think diagnosed with schizophrenia. (RIP)
#lifeAdvice Forget perfect it`s a mirage, when you`re exhausted leave your PC, touch the grass, and accept so-so work in progress.
Enjoy Failures as success.
this is from a (developer/sysadmin/freelancer) who went 10 years on hiatus, waiting for the perfect chance. aka myself
X.Com censorship>?
Tags: tesla, berlin, gigafactory
Published: 2023-10-09 19:06:13

---
title: X.Com censorship>? 
published: true
description: inspector Cmd+Option+I or RTFM
tags: tesla, berlin, gigafactory
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-10-09 19:02 +0000
---

## Yet another

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

## Original post

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

# no censure please

# frozen giga factory in berlin

# sensible

# hidden

## welcome to my intercom studio (ICS)

no more bullshit

x is the last great idea

let us do this

make it successful

make things

manifesto and cult of done

## ref

https://www.youtube.com/@4sp1
https://malik-ben-kirane.de
https://go.with.mb.multisvc.com
https://twitter.com/4sp14f
Rovy Part 1: Control motors remotely using AWS IoT Core (MQTT)
Tags: aws, robotics, raspberrypi, iot
Published: 2023-10-09 18:55:25

This is the first part of the project which focuses on controlling the motors on a rover over the internet via MQTT. 

{% embed https://www.youtube.com/embed/WBMkEa4qkZI?si=4KB26kh3SewZz2CU&amp;controls=0 %}

If you want to dive right away into the code, you can check it out here:

- [Rover Hardware](https://github.com/vynci/rovy-hardware/tree/rovy-part-1) (branch -> `rovy-part-1`)
- [Mobile App](https://github.com/vynci/rovy-mobile/tree/rovy-part-1) (branch -> `rovy-part-1`)

> I will be pushing updates to the repositories as I add more things (i.e. video stream) into the rover as I progress in the future, so the main branch might look different by the time you are reading this. As for this article, please refer to the specified branch.

I have a full write-up of this in my blog. You can check it out here [here](https://www.vynci.dev/posts/robot-control-using-aws-iot-core).
Rolling your own CMS like there's no tomorrow
Tags: jokes, webdev, programming, react
Published: 2023-10-09 18:51:39


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

**Join the club 🤣 and star our [GitHub repo](https://github.com/webcrumbs-community/webcrumbs) 🌟 if you are one of us!**
State Farm Removes Appraisal Clause from Alabama Auto Policies Harming their Policyholders
Published: 2023-10-09 18:44:24

If you're one of State Farm's policyholders, this article will help you understand their decision and how it affects you: https://diminishedvalueofgeorgia.com/state-farm-removes-appraisal-clause-from-alabama-auto-policies-harming-their-policyholders/