teleren/devto huggingface dataset:
Unraveling the Intricacies of Ruby on Rails: RCAV Lessons and Insights
Tags: programming, ruby, rails, webdev
Published: 2023-03-17 16:13:02

As a software developer, it's crucial to continuously learn and refine your skills. Ruby on Rails, a powerful web application framework, has proven to be a game-changer for many developers. In this post, I will share valuable insights and lessons learned from working with Rails' RCAV (Routes, Controllers, Actions, and Views) pattern. This pattern is an essential aspect of building Rails applications, providing a seamless way to navigate the flow of user requests and the application's response.

Route Configuration:
The Rails routing system is the backbone of any Rails application, as it translates user requests into actions. Learning how to create clean, RESTful routes using resources and implementing nested routes for related data was vital in creating a well-organized application.

Controllers and Actions:
Controllers are responsible for managing user requests and orchestrating the response. Through my experience with Rails, I learned the importance of writing lean controllers by adhering to the Single Responsibility Principle (SRP). This approach ensures that each controller action is responsible for a single task, making the codebase easier to maintain and understand.

Views and Templating:
Rails utilizes the ERB (Embedded Ruby) templating system, which allows for the seamless integration of Ruby code with HTML. Mastering the use of partials and layouts helped me create clean, reusable view templates that maintain a consistent look and feel throughout the application. Additionally, understanding how to use Rails' built-in form helpers, such as form_with and form_for, streamlined the process of creating and managing user input forms.

Integration of Front-end Libraries:
Integrating front-end libraries and frameworks, such as Bootstrap and jQuery, significantly enhanced the user experience in my Rails applications. Learning how to utilize the asset pipeline and Webpacker made it easy to include these libraries, while also improving the overall performance and maintainability of my applications.

Ruby on Rails' RCAV pattern is an elegant and powerful way to structure a web application. By mastering the various components of RCAV, I have become a more effective and efficient Rails developer. I hope that sharing these insights will help others on their journey to becoming proficient in Ruby on Rails.
New string manipulation functions for Common Lisp
Tags: lisp
Published: 2023-03-17 16:10:31

Hi lispers o/

I started the [str](https://github.com/vindarel/cl-str) library as a n00b, to fix my first frustration with Common Lisp: string manipulation. It received great contributions and it is now used by a bunch of people, great! Special thanks to @kilianmh ([openapi-generator](https://codeberg.org/kilianmh/openapi-generator)) for his continuous style improvements, bug fixes, reviews and new features.

The `str` library (`(ql:quickload "str")`) provides short and consistent functions, such as: `concat`, `join`, `trim`, `collapse-whitespace`, `pad`, `shorten`, `words`, `unwords`, `lines`, `split`, `to-file`, `from-file`, `empty`, `blankp`, `containsp`, `starts-with-p`, `ends-with-p`, `replace-all`, `downcase[p]` and friends, `replace-using`, `remove-punctuation`…

We recently added some functions: `ensure-prefix`, `ensure-suffix`, `ensure-wrapped-in`, `ensure` and `wrapped-in-p`.

Example:

```lisp
(str:ensure-prefix "/" "abc/") => "/abc/" (a prefix was added)
```

`ensure-prefix` makes sure that the string starts with the given prefix. If it's already there, it does nothing.

`ensure-suffix` does what you guess,

`ensure-wrapped-in` is here to do both checks at once:

```lisp
(str:ensure-wrapped-in "/" "abc") ;; => "/abc/"  (added both a prefix and a suffix)
```
here it added "/" to both the start and the end of our string. And here it won't add anything:

```lisp
(str:ensure-wrapped-in "/" "/abc/") ;; => "/abc/" (does nothing)
```

`ensure` can do everything at once. Its signature is the following:

     (ensure s &key wrapped-in prefix suffix)

If `wrapped-in` is provided, it will ignore prefix and suffix if they are also provided.

Example:

```lisp
(str:ensure "abc" :wrapped-in "/")  ;; => "/abc/"
(str:ensure "/abc" :prefix "/")  ;; => "/abc"  => no change, still one "/"
(str:ensure "/abc" :suffix "/")  ;; => "/abc/" => added a "/" suffix.
```

If both `:prefix` and `:suffix` are provided, it simply calls the two necessary "ensure-" functions.

Another useful improvement: the `trim` function only accepted whitespaces. It now accepts a `:charbag` key parameter, so you can trim any character from the string.

So yeah, my examples are sort of dealing with URIs. When you need real URI handling, look at [Quri](https://github.com/fukamachi/quri).

That's all o/

*These "ensure-" functions are to appear in the next Quicklisp release of April, 2023. You can grab the library on Ultralisp or clone it into your ~/quicklisp/local-projects.*

To learn more about string manipulation in CL, look at the Cookbook: https://lispcookbook.github.io/cl-cookbook/strings.html
Explaining tech to a 5 year old
Tags: children, teaching, kids
Published: 2023-03-17 15:56:06


Hello guys,

Remember when grandma tells us stories about sharks,tortoises and the old days of life. Can you imagine they didn't have TVs back then, they didn't watch baby Sharks or SpongeBob squared pants and all the amazing cartoons we watch now. That's because there were no TVs back then.
Hmmm, imagine life without TV.

So, can you guess what happened that we suddenly have TVs today?

Life is changing. New ideas are coming up every day. We have some really smart people working day and night to bring up cool devices we now use. We call them scientists and engineers.

When these changes happen and new devices are created, it's called technology. We can call it tech for short.

In simple words, tech means providing or using tools that make life easier and gives you comfort.

Someone designed and built a car to make us avoid walking long distances.Your computers, iPads, phones and most of our devices were created so we can talk to people far away, watch movies or play games.

Now, let's talk about some areas of computer technology

There are special people called designers. Just like you use crayons to draw pictures on paper, that's how tech designers create lovely designs on a computer and give that image to an engineer so it would be built.

Next, we have programmers. The word "programmer" seems like a really difficult term, but they are interesting and smart people. They write some instructions that make your computer or iPad work! So we can say programming is the process of telling a computer what to do with computer language we may not understand now. These programmers take their time to learn and try out these computer languages (You could learn it too!😉)

There are also special people who try to make sure the cool things built by the designers and programmers get to us at home. They are called marketers. They make you see how good a product is and get your parents to buy them for you.

There are other interesting areas in tech we could go on about, but just understand that technology is a means to help people solve problems. It's not actually as difficult as it sounds😊.
Creativity and Linearity in Software
Published: 2023-03-17 15:52:11

After approximately 75 days of coding within the Ruby-on-rails ecosystem, I've had to reckon with a modified version of the classic Imposter syndrome, ie. learning to balance between creative non-linear thought versus the linear methodical thought process in Software Dev. This conundrum had spilled over not only into my our day-to-day code refactoring and debugging, but also into the design and planning of a final project for my DPI coursework. 

As we transitioned into the Rails component of the program, I've found some initial trouble with both the learning and implementation of the R-C-A-V methods. The Rails-Controller-Action-View workflow in retrospect appears to be more a feat of bookkeeping than rocket science (Even rocket science isn't conceptually difficult to grasp, just a high risk margin and design complexity). I've found that creativity is best left for the initial phases of project development, which in my case would be the final web application project for our class. Non-Linear thinking often requires first a level of competency that translated into technical fluency and lucidity of thought- thus allowing one to think of alternative pathways that lead to a phenomenal product. But this is where I've found that the linear thought needs to re-engage the psyche to help bring about order and clarity to the world outside my mind. 

I don't claim to have fully balanced between these 2 modes of thought, but rather am glad I've identified when to activate each way of thought as needed. More thoughts to come!
The Only Three Classes That Mattered From My College Degree
Tags: programming, career
Published: 2023-03-17 15:42:15

Only 3 of the 56 classes I took at UCLA matter in my daily software engineering work. Any engineer would agree that those three courses are worth their weight in gold.

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

## All You Need To Pass Any FAANG Interview

Without a doubt, the two most important UCLA CS courses are CS31 & CS32. These classes are how engineering students learn to code. You can tell from looking at each syllabus how valuable these classes are:

* CS31 Syllabus → The basics of how to code
* CS32 Syllabus → Object oriented programming and data structures

My high school didn't have any programming classes, so I didn't even know what CS was until I took CS31. Although the initial programs don't resemble industry work, CS31 lays the foundation. Building on that, CS32's object oriented programming and data structures cover most of the programming I do.

Also, these classes teach you everything you need to pass FAANG interviews. While landing these jobs requires a lot of preparation (a topic for a future post), these courses provide the basics you need to tackle any interview question.
These classes taught us how to code but didn't teach us how to be software engineers. We close that gap with one other class.

### Where Programmers Become Engineers

UCLA has a notorious class called CS35L, which is a weekly series of time-consuming labs. This class, although painful, is what creates software engineers.

In it, we learned how to use the command line (e.g. shell commands, scripting) and change management (e.g. Git), which is core to writing code in a collaborative professional environment. Lastly, we learned how to use basic software debugging tools. I've always loved using debuggers rather than putting print statements everywhere because of how convenient it is to interact with the runtime of a live program. Now, I use these skills so often at work that they've become second nature.

Even though the class was a ton of work, it had the best late policy. Assignments "N" days late would lose 2^(N-1) points. This had a nice effect of being forgiving for slight delays but brutal for anything more than a few days late.

---

There are a few other classes that don't matter nearly as much but are worth an honorable mention:

* Algorithms (CS180) - Taught me how to do Leetcode hard difficulty questions
* Operating Systems (CS111) - Taught me how computers work
* Databases (CS143) - Was a nice crash course on SQL

If there's one thing I'd change about my engineering education, it's that I would've done more practical work (open source & projects) rather than spend all my time on my theoretical coursework. Over to you: What classes do you feel mattered from your college education and why?

If you learned something helpful, [subscribe to my Substack for free](https://www.developing.dev/) to receive new posts!

Thanks for reading,
Ryan Peterman
How to do a Django cache decorator that exclude by URL parameters
Tags: django, python
Published: 2023-04-05 14:04:29

---
title: How to do a Django cache decorator that exclude by URL parameters
published: true
date: 2023-03-17 15:28:28 UTC
tags: django,Python
canonical_url: https://daniele.tech/2023/03/how-to-do-a-django-cache-decorator-that-exclude-by-url-parameters/
---

After asking on Reddit I started digging on internet looking other projects with custom cache decorator and mixing various I was able to achieve this. 
[...]

[Read More...](https://daniele.tech/2023/03/how-to-do-a-django-cache-decorator-that-exclude-by-url-parameters/)

The post [How to do a Django cache decorator that exclude by URL parameters](https://daniele.tech/2023/03/how-to-do-a-django-cache-decorator-that-exclude-by-url-parameters/) appeared first on [Daniele Mte90 Scasciafratte](https://daniele.tech/eng).
AI - это всего лишь инструмент, а не замена
Published: 2023-03-17 15:28:03

Технологии развиваются ежедневно. Мы можем заменить то, что все стремятся сделать свою жизнь и жизнь других эффективнее. Это означает, что все направлено на сокращение использования ресурсов для достижения тех же результатов.

В разработке мы всегда стремимся использовать что-то новое, потому что это новое экономит нам ресурсы (время, деньги, стресс).

Среды разработки развиваются, системы сборки конкурируют за миллисекунды, системы деплоя и хостинга пытаются сократить время доставки контента. Всё стремится быть эффективнее.

Что такое AI для разработчика?

Это такой же инструмент, который может значительно ускорить разработку. Не заменить разработчика, а ускорить (или даже свести к нулю) его рутинную работу. Google и StackOverflow - отличные примеры этого.

Задачи разработчиков будут немного смещаться к более высокоуровневым. Это здорово! Мы превращаемся в людей, принимающих решения и фокусирующихся на более структурных аспектах.

Но здесь есть один важный момент. Чтобы это работало и чтобы мы делегировали рутинные задачи AI, мы должны понимать, что он пишет.

Программисты никуда не денутся. Простые сайты и до AI можно было создавать через Тильду или no-code решения людям, которые ничего не понимают в разработке.

А вот сложные системы с персональными, специфическими характеристиками создать будет очень сложно без участия программиста.

Поэтому AI - это инструмент, который в понимающих руках станет турбоускорителем. Его однозначно нужно уметь использовать. И это плюс.

Минусом всей этой ситуации является повышение требований только для входящих в индустрию IT. К сожалению, теперь будет недостаточно просто знать язык и уметь выполнять тривиальные задачи. Думаю, это работу в скором времени сможет выполнить искусственный интеллект. Теперь Junior специалист должен уметь использовать искусственный интеллект, чтобы выполнять в два раза больше задач, чем этого ожидали от него в прошлом году.

Junior разработчики будут еще менее востребованы. Требования к среднему уровню станут базовыми, а старший уровень должен будет решать более комплексные задачи построения глобальных систем.

AI — это всего лишь инструмент, а не замена. Сейчас происходит переходный период. Кто раньше его освоит, будет намного эффективнее тех, кто не освоил его на текущем рынке. Пользуйтесь этим!

Таким образом, AI может значительно ускорить и улучшить фронтенд разработку, но полностью заменить человека пока не может. AI и веб-разработчики будут работать в тандеме, повышая скорость разработки и качество конечных продуктов.
Days4_"Print" In Color!
Published: 2023-03-17 15:11:21

To print in color using Python, you can use the ANSI escape sequences. Here's an example:

python
Copy code

```
#Days_4 "Print" in Color!
#
#17 MARCH 2023

def exercise_1():
  Text = ("Welcome to your adventure simulator. I am going to ask you a bunch of question and then create an epic story with you as the start")
  print(Text)
  print("___________________________________________\n")
  Name = input("What is your name?: ")
  Worst = input("What is your worst enemy's name : ")
  Super = input("What is your superpower: ")
  Live = input("Where do you live: ")
  Food = input("What is your favorite food: ")
  print("Hello", Name ,"!Your ability to",Super,"will make sure you never have to look at", Worst, "again. Go eat", Food, "as you walk down the streets of", Live, "and use ",Super,"for good and not evil!" )
  print("Uh, oh, you've been given a", "\033[31m", "warning", "\033[0m", "for being a bad, bad person.")

#Call 
def Call():
  exercise_1()

Call()
```

Here are some other colors you can use:

Red: \033[91m
Green: \033[92m
Yellow: \033[93m
Blue: \033[94m
Purple: \033[95m
Cyan: \033[96m
You can also use these sequences to change the background color. For example, \033[41m sets the background color to red.

Note that not all terminals support ANSI escape sequences, so your colored output may not work on all systems.





Regenerate response
75 days of learning WebDev
Published: 2023-03-17 15:01:30

I learn from full stack developer apprenticeship program soft skills and software development foundation.Soft skills I learn Email Etiquette Rules and Tips, Microsoft Word Essentials, Lookbook Profile, IBM soft skills solving problems with creative and critical thinking and software development course I learn HTML, CSS, Ruby and Data model from Tree house, codecademy and youtube videos. After learning HTML and CSS. I build my link bio profile. 

How to create GitHub, Piazza Account and how to our code push in GitHub account. Suppose we lose our code in GitHub account how to recover this code in GitHub account. I learn Route,Controller,Action and View in advanced ruby Course.
What was your win this week?
Tags: discuss, weeklyretro
Published: 2023-03-17 14:58:38

Ayo! 👋

Hope y'all have wonderful weekends. 🙌

Looking back on this past week, what was something you were proud of accomplishing?

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Fixing a tricky bug
- Sharing a [#wecoded](https://dev.to/t/wecoded) post ✍️

---

![Awkwafina standing proudly, holding still, hand on one hip with a trophy in the other hand, a bunch of confetti raining down over her.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19y9qni1bqf14xlad8wu.gif)
Jenkins in Podman
Published: 2023-03-17 14:37:34

```
podman volume create jenkins_home
```

```
podman run -u root -p 8080:8080 -p 50000:50000 -d  -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts-jdk11
```

```
podman ps
CONTAINER ID  IMAGE                                COMMAND     CREATED        STATUS            PORTS                                             NAMES
14e76c1d7f1b  docker.io/jenkins/jenkins:lts-jdk11              2 minutes ago  Up 2 minutes ago  0.0.0.0:8080->8080/tcp, 0.0.0.0:50000->50000/tcp  intelligent_gates

```

```
podman logs 14e76c1d7f1b
```

Reference: https://www.youtube.com/watch?v=qGLEuXK46gQ
Blue Ocean: https://www.youtube.com/watch?v=ekiL2AUToks
Use Gmail for SMTP
Published: 2023-03-17 14:26:00

##Login to your gmail account and Goto Account > Security


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


##Enable 2 Step verification


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


##Look for the App Password


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



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


##Select App > Other > Click Generate


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p6wu5srk0d4uvaqljqwf.png)
Node.Js 19, quais são as novidades?
Tags: javascript, node, braziliandevs, programming
Published: 2023-03-17 14:21:50

Recentemente a versão 19 do Node.js foi lançada e aqui vai uma lista de algumas coisas novas que estão por vir.

**É importante lembrar que a versão 19 não é a versão LTS, ou seja, a versão estável e de longo suporte.**

- 
Test Runner

Agora o node tem uma API nativa para rodar testes, fazendo com que nós não precisamos usar bibliotecas como o `Jest`.

A api está disponível importando direto do pacote `"node:test"` e pode ser usado da seguinte forma `node --test src/users.test.js`.

Porém é importante lembrar que ela ainda está em fase de testes então algumas coisas podem mudar. Em breve vou trazer um texto falando mais sobre ela.

- 
Fetch

O fetch já estava disponível em algumas versões anteriores do node, porém era apenas acessível usando a flag `--experimental`. Agora não é mais necessário usar a flag `--experimental` para usar o fetch.

Explicação rápida, o fetch é uma API que fornece ao JavaScript formas de manipular as requisições e respostas HTTP. Em resumo, nós podemos fazer requisições com ele assim substituindo o famoso axios por uma opção nativa.

- 
Watch

Agora o Node.js possui a flag `--watch` para basicamente identificar alterações nos arquivos e reiniciar o projeto automaticamente, assim como a lib nodemon faz.

- 
Web Crypto API

A API Web Crypto está disponível em uma versão estável, sendo possível acessa-lá usando o `globalThis.crypto` ou `require('node:crypto')`.

Falando de forma bem superficial, você pode usar para encriptar e decriptar mensagens.

## V8 Engine atualizada para versão 10.7 

Essa nova versão inclui a api `Intl.NumberFormat`. Recentemente fiz um texto falando sobre o Intl no geral, vale a pena dar uma conferida. [JavaScript: O que é Intl?
](https://dev.to/cristuker/o-que-e-intl-4ana-temp-slug-3971265?preview=09be3c070b913e95347aff0b786d5aa50c95039c2784c6041a248ea6394373df6de90da2370c355551d35df498fdbbb827d138260d6d0397a4e8be1d)
Se chegou até aqui, me segue la nas [redes vizinhas.] (https://bento.me/cmsdev)
<img src="https://media.giphy.com/media/uWlpPGquhGZNFzY90z/giphy.gif" />
Paracetamol.js💊| #207: Explica este código JavaScript
Tags: javascript, webdev, spanish, programming
Published: 2023-03-17 14:05:00

## **<center>Explica este código JavaScript</center>**
#### <center>**Dificultad:** <mark>Avanzado</mark></center>

```js
const a = () => {
  return new Promise((resolve, reject) => resolve("a"))
}

const b = () => {
  return new Promise((resolve, reject) => reject("b"))
}

const c = () => {
  return new Promise((resolve, reject) => reject("c"))
}

const x = () => {
  return new Promise((resolve, reject) => resolve("x"))
}

const y = () => {
  return new Promise((resolve, reject) => resolve("y"))
}

const z = () => {
  return new Promise((resolve, reject) => reject("z"))
}

const getPromisesRejected = () => {
  return Promise.allSettled([a(), b(), c(), x(), y(), z()])
    .then(response => {
      const errors = response
                    .filter((promise) => promise.status ==="rejected")
                    .map((promise) => promise.reason)
      console.log(errors);
    }) 
    .catch( () => console.log(e))
}

getPromisesRejected()
```

- A. `[ "a", "x", "y" ]`
- B. `[ "b", "c", "z" ]`
- C. `[]`
- D. `Promise { <pending> }`
- E. `Ninguna de las anteriores`  

Respuesta en el primer comentario.

---