teleren/devto huggingface dataset:
Django LoginView and flash messages
Tags: django, html, css, python
Published: 2020-06-06 16:19:41

##The strory
Today I was working on an authentication system with **Django**, so I created a function based view that handles users registration, once the registration is complete it makes sense to redirect the users somewhere else typically a login page and notify them with a _flash message_ (an alert on the front-end) to tell them what is going on. This was easily achieved by combining django _flash messages_ and _bootstrap alerts_, but when I wanted to to use the same approach for the login part, I struggled because for login in the users I used the pre-built django class **LoginView**.
##The solution
The trick was to use my own **login view** that extends the django default **LoginView** and also uses the django _messages mixins_:
###views.py
```python
from django.contrib.messages.views import SuccessMessageMixin
from django.contrib.auth.views import LoginView
class MyLoginView(SuccessMessageMixin ,LoginView):
    template_name = 'users/login.html'
    success_url = 'blog-home'
    success_message = 'Welcome to your profile'
```
On the template, it is best to display the messages on the base template so we are sure they would be seen where ever the user is right now.
###templates.html
```django
<div class="col-10 ml-auto>
   {% if messages %}
       {% for message in messages %}
          <div class="row justify-content-end">
             <div class="col-4 text-center">
                 <div class="alert alert-{{message.tags}}">
                         {{ message }}
                 </div>
              </div>
           </div>
        {% endfor %}
   {% endif%}
</div>
```
Mega888
Published: 2023-05-03 03:07:43

https://mega888.win/ original ini anda tidak lagi perlu keluar dari rumah bahkan anda boleh terus berseronok bermain permainan kasino dimana... 

CONTACT:

Address: Pesiaran Perbandaran, Seksyen 14, 40000 Shah Alam, Selangor, Malaysia 
Phone: +60355105133 
Website: https://mega888.win/
Twitter: https://twitter.com/mega888win
LinkedIn: https://www.linkedin.com/in/mega888win/
Facebook: https://www.facebook.com/mega888winsocial/
Pinterest: https://www.pinterest.com/mega888win/
Top 10 Python Project Ideas for Final Year Students
Tags: javascript, python, programming
Published: 2023-05-03 13:13:40

Is Final Year Students Searching for Python Projects? Don’t Worry, Here “takeoff edu group” will help you to get good and unique Python Projects page, you will find trending and top projects list.
There are many reasons why Python Projects are an excellent choice for engineering students. Firstly, they provide a great way to apply the knowledge and learn real-world projects. By building and programming your own devices, you can gain a deeper understanding computer programming.

Top10 Python Project Ideas you will find out in “Takeoff Edu Group”: -
•	An Approach to Discover Similar Musical Pattern
•	Fake Product Identification Using Blockchain Technology- Using QR Code
•	Brain Diagnosis Disease by Using Machine Learning and Deep Learning Algorithms
•	Towards a Secure Electronic Health Record System Using Blockchain Technology
•	Securing IoT Data in the Cloud with Blockchain Technology
•	Implementation and Analysis of Blockchain Based DApp for Secure Sharing of Student's Credentials
•	Fake Media Detection Based on Natural Language Processing and Blockchain Approaches
•	Protecting Data Privacy for Permissioned Blockchains using Identity-Based Encryption
•	A Study of Blockchain Technology in Farmer's Portal
•	BSSPD: A Blockchain-Based Security Sharing Scheme for Personal Data with Fine-Grained Access Control

Here are some Python project ideas for Final Year students:

Circuit Design and Simulation: Use Python to design and simulate electronic circuits, including signal processing circuits, power supplies, and control systems.

Machine Learning for Engineering Applications: Develop machine learning models in Python to solve engineering problems, such as predicting failure modes or optimizing processes.

Image Processing: Use Python to develop an image processing program that can analyze and manipulate images, such as detecting defects in materials or identifying features in medical images.

Robotics: Develop a Python-based control system for a robot, including motion planning and control algorithms.

Data Analysis and Visualization: Use Python to analyze and visualize data from engineering experiments, such as sensor data or simulations.

Signal Processing: Use Python to develop signal processing algorithms, such as filters or digital signal processing techniques.

Internet of Things (IoT) Applications: Develop Python-based applications for IoT devices, such as sensors or controllers, to monitor and control physical systems remotely.

Computer Vision: Use Python to develop computer vision applications, such as object recognition or tracking, for engineering applications.
Overall, Python projects offer students a unique opportunity to develop practical skills in Final year engineering. With the help of Takeoff edu group, students can get access to project ideas, guidance, and resources to ensure their success.
So, what are you waiting for? Join the growing community of “Takeoff Edu Group” who are interested in doing Python Project Ideas. For more information visit:- https://takeoffprojects.com/python-project-ideas
HelloNewbie - v3
Tags: hellonewbie, codenewbie
Published: 2023-05-03 18:36:00

---
title: HelloNewbie - v3
published: true
description: Just joined the community? Say hello!
tags: hellonewbie, codenewbie

---

## Welcome everybody to the CodeNewbie Organization on DEV!

---

![the words "hello there" in pink on a white background](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5degoss0ddufb3bojh94.gif)

---
1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Make some new friends by responding to another newbie's comment :wave: Feel free to follow one another, too!

3. We also recommend following the [#beginners](https://dev.to/t/beginners) & [#codenewbie](https://dev.to/t/codenewbie) tags. And of course, don't forgot to hop into [the DEV Welcome Thread](https://dev.to/welcome) there to introduce yourself and meet new folks. :tada:
Deploying an MSSQL + Node Js Application to Azure App Service.
Tags: cloud, azure, devops
Published: 2023-05-17 10:14:42


After this part, i felt like I deserve this shirt.

![devops](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m2y5u0q6ex4g64exkuae.jpeg)

Now i am really curious about this part, ofcourse i know how to deploy an appservice.

But this is not just a simple app with only frontend, so i  am wondering how the database connection will be made if it is deployed through the app service.

Question is if i deploy the app currently using github, will the data show?
so lets try to deploy the app using app service.
1. First i pushed my code to github.

2.Create app service.

![create app](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uka582h54o8ymafr0n91.png)

Next is  choosing a resource group and giving it a name then choosing the option to use in this case code.
![choose](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u9khzuok2hrj00h8y4yz.png)

Then we need to choose the runtime stack which in our case is nodejs, the pricing plan and region.
![choose](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1dez68sewcz56qyxmyvk.png)

Now we choose github actions,and click the **authorise** **button**  to authorise azure to access your github account.
Then select the repository, branch and organisation.
![github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwp0qbxgz42622j2t7sf.png)

leave the network as default,


![network](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6ib115x97cs91hzrcs2.png)



Skip and leave the rest as default and click create.
![create](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5n6jke8amu3mwnnpg0a.png)

We then wait a few(lots)  minutes for it to deploy and check our app link.

![deply](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/usvjzktnw08qsdqz7tke.png)

okay seriously that took alot of time. I slept on it.
Turns out we have to set a connection string and app variables.


![non](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cues8kpw6iypa357llop.png)
Adding connection strings to the app service.

Go to your sql database under the **connection string** tab and look for the one that suits your app environment.


![string](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ylcmuh3yn9pxtlufozq7.png)

Next i went to the app service under the configuration tab  and added my connection string as well as my environment variables.
Add the connection string.Be sure to replace your **password** within the string.

![connection string](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0zm6x6nppfu6y0cfyy6p.png)

Finally it should look like this.The environmental variables should match those used in your app.
e.g 
![env](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u89blsqqvyugxkncp1k2.png)


![vars](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/py20qreavbki48y8j26f.png)



After all this struggle, ladies and gettlemen, i managed to deploy rightly.And the app was app and running.

![final](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/flfs8q02ee1w5qdp4nl6.png)
Journey of a Frontend Engineer Exploring the MEARN Stack: Welcome to my Hashnode Blog!
Published: 2023-05-17 10:42:57

Introduction:

Greetings, Hashnode community! I am Prince, a frontend engineer who is eager to embark on an exciting new adventure in the world of backend development. Today, I am thrilled to introduce you to my Hashnode blog, where I will be sharing my experiences, insights, and tutorials on the MEAN or MEARN stack.

As a frontend developer, I have always been captivated by the process of bringing designs to life and creating engaging user interfaces. However, I've come to realize that a truly exceptional web application requires a robust backend infrastructure. This realization has led me to dive into the fascinating world of the MEAN or MEARN stack, which combines the power of MongoDB, Express.js, Angular (or React), and Node.js.

While I am relatively new to backend development, my passion for learning and exploration drives me to constantly push my boundaries and embrace new challenges. Through my Hashnode blog, I aim to document my journey as I navigate the intricacies of the MEAN or MEARN stack, sharing my triumphs, struggles, and lessons learned along the way.

The MEAN (MongoDB, Express.js, Angular, Node.js) or MEARN (MongoDB, Express.js, React, Node.js) stack is renowned for its versatility, efficiency, and flexibility. Each component brings its unique strengths to the table, enabling developers to build scalable, real-time, and feature-rich web applications. From designing intuitive user interfaces with Angular or React to building robust APIs with Express.js and leveraging the power of MongoDB as a NoSQL database, the MEAN or MEARN stack offers an end-to-end solution for full-stack development.

Through my blog posts, I will delve into various aspects of the MEAN or MEARN stack, offering tutorials, code snippets, best practices, and real-world examples. Whether you are a frontend developer looking to expand your skill set or a seasoned backend developer seeking insights into MEAN or MEARN, my goal is to provide valuable content that helps you unlock the true potential of these technologies.

Join me on this exciting journey as we explore the intricacies of the MEAN or MEARN stack together. Together, we will navigate the challenges, unravel the complexities, and unlock the secrets of building modern, scalable, and performant web applications.

I am genuinely excited to connect with the vibrant Hashnode community and share my knowledge and experiences. I invite you to follow my blog, engage in discussions, ask questions, and provide feedback. Let's build a supportive and collaborative space where we can learn, grow, and inspire each other as we dive into the world of MEAN or MEARN stack development.

Thank you for joining me on this adventure, and I look forward to connecting with each and every one of you!

Happy coding,

Prince, a Frontend Engineer Exploring the MEARN Stack
Router Debugging in Angular
Tags: angular, debug
Published: 2023-05-18 09:38:28

1. Enable router tracing: In `app.module.ts`

    ```typescript
    import { RouterModule, Routes } from '@angular/router';

    const routes: Routes = [
    // Define your routes here
    ];

    @NgModule({
    imports: [
        RouterModule.forRoot(routes, { enableTracing: true })
    ],
    // ...
    })
    export class AppModule { }
    ```

    if working with standalone application

    ```typescript
    const appRoutes: Routes = [];
    bootstrapApplication(AppComponent,
    {
        providers: [
        provideRouter(appRoutes, withDebugTracing())
        ]
    }
    );
    ```

2. Use console.log() to inspect

    ```typescript
    import { Component } from '@angular/core';
    import { Router } from '@angular/router';

    @Component({
    // ...
    })
    export class MyComponent {
    constructor(private router: Router) {}

    navigateToRoute() {
        console.log('Before navigation');
        this.router.navigate(['/my-route']);
        console.log('After navigation');
    }
    }
    ```

    else use below code

    ```typescript
    isLoading$ = new BehaviorSubject<boolean>(false);

    constructor(private router: Router) {
    this.router.events
        .subscribe((event) => {
        if (event instanceof NavigationStart) {
            this.isLoading$.next(true);    
        }
        else if (event instanceof NavigationEnd) {
            this.isLoading$.next(false); 
        }
        });
    }
    ```
Nutanix NCM-MCI-5.20 Questions To Complete Your Preparation [2023]
Published: 2023-05-19 09:40:16

<p>Getting ready for the Nutanix Certified Master - Multicloud Infrastructure (NCM-MCI) 5.20 Exam? Stop looking! Pass4Success is your ultimate option for Nutanix NCM-MCI-5.20 exam question preparation. Our team of experts carefully made and checked the Nutanix <strong><a href="https://www.pass4success.com/nutanix/exam/ncm-mci-5.20">NCM-MCI-5.20 Exam&nbsp;Questions</a></strong> to make sure you pass the NCM-MCI-5.20 Nutanix Certified Master exam on your first try. With Pass4Success, you can study for the NCM-MCI-5.20 Nutanix Certified Master test from the comfort of your own home.</p>

<h2><strong>Convenient PDF Format for Nutanix NCM-MCI-5.20 Exam Questions:</strong></h2>

<p>At Pass4Success, our Nutanix NCM-MCI-5.20 exam questions are available in a convenient PDF format. This enables you to download and utilize the Nutanix Certified Master - Multicloud Infrastructure (NCM-MCI) 5.20 Exam NCM-MCI-5.20 PDF questions on any device, such as PCs, laptops, Macs, tablets, and smartphones. The PDF format provides flexibility, allowing you to prepare for the NCM-MCI-5.20 Nutanix Certified Master exam at your own pace and without the need for classroom instruction.</p>

<h2><strong>Comprehensive Nutanix NCM-MCI-5.20 Online Practice Test Engine:</strong></h2>

<p>Pass4Success also offers a comprehensive online <strong><a href="https://www.pass4success.com/nutanix">Nutanix Practice Test</a></strong> engine for the Nutanix NCM-MCI-5.20 exam that incorporates the Nutanix Certified Master NCM-MCI-5.20 exam questions.&nbsp;This NCM-MCI-5.20<strong>&nbsp;</strong>practice<strong>&nbsp;</strong>test engine generates a simulated environment for practice and familiarization with the NCM-MCI-5.20 Nutanix Certified Master - Multicloud Infrastructure (NCM-MCI) 5.20 Exam&nbsp;actual format. By utilizing the Nutanix NCM-MCI-5.20 online practice test engine, you can identify your strong and weak areas, enabling you to develop and confidently approach the NCM-MCI-5.20 Nutanix Certified Master - Multicloud Infrastructure (NCM-MCI) 5.20 Exam.</p>

<p>&nbsp;</p>
Links for web dev
Published: 2023-05-19 13:18:56

[color scheme designer](https://paletton.com/#uid=1000u0kllllaFw0g0qFqFg0w0aF)

--------------

## Icons


[boxicons](https://boxicons.com/)

[iconscout](https://iconscout.com/)

--------------

[All CSS properties](https://www.web4college.com/css-play/index.php)

------------------------

[google fonts](https://fonts.google.com/)
Introducing Safe-Text API
Tags: api, webmaster
Published: 2023-05-19 21:03:44

I made an API for text cleansing, most of Python enthusiast already dealt  with text right ? Some among us have probably a web-app or other  solution based on user content.

The  thing about text, is that it is so fragile; It can break the whole  website, or at least can have rest in DB as scrambled as the user posted  it but finally ends again screwing UI and giving a bad end user  experience

For this, there are already many solutions, some rely on complex #regex, basic or advanced algorithms, or even heavy machine learning models.
I wrapped dozens of solutions of a multitude of technologies, from #Python to #Rust to #WebAssembly all in one single API !

It is only accessible through #RapidAPI but it comes with a generous free tier 📷
Please, give us a start if you are already on 
@Rapid_API

If you feel like criticizing, please keep it constructive, I will be happy to follow with your ideas.


Current models: 
-  FixHTML.
-  DOMPurify.
-  Linkify.
-  Fix mojibark.
-  Punctuate.
-  Decancer.
-  Remove bad words.
-  Remove sensitive data.
-  Strip tags.
-  Wrap text. (comming soon)
-  Detect Language.

### Examples of effective cleansing

**FixHTML**
`<p>here is a para <b>bold <i>bold italic</i></b> bold? normal?`  
turns into  
`</p><p>here is a para <b>bold <i>bold italic</i> bold?</b> normal?`
  
**DOMPurify**
`very bad html (cannot post here)`  
turns into  
`safe html`
  
**Linkify**
`Any links to github.com here? If not, contact test@example.com`  
turns into  
`'Any links to <a href="https://github.com">github.com</a> here? If not, contact <a href="mailto:test@example.com">test@example.com</a>'`  
  
**Fix mojibark**  
`The Mona Lisa doesnÃƒÂ¢Ã¢â€šÂ¬Ã¢â€žÂ¢t have eyebrows.`  
turns into  
`The Mona Lisa doesn't have eyebrows.`  
  
**Punctuate**
`hello world`  
turns into
`Hello world.`  
  
**Decancer**
`vＥⓡ𝔂 𝔽𝕌Ňℕｙ ţ乇𝕏𝓣`  
turns into
`very funny text`  
-----------
**Remove bad words**  
`you are a bad ass`  
turns into
`you are a bad ***`  
  
**Remove sensitive data**  
`My dads credit card number is: 5555555555554444`  
turns into
`My dads credit card number is: ################`  
  
**Strip tags**  
`<a href="#">  this is my cat</a>`  
turns into
`this is my cat`  
  
**Wrap text**  
(comming soon)  
  
**Detect Language**  
`Bonjour Paris`  
gives  
`french`

Note that Safe-Text API is a gigantic wrapper on top of other bright solutions; We have glued many other bright libraries to work in one single API. It is a complex solution technically as many technologies (Python, Rust, Wasm, Node ...) are all working together in one single API call.

Link to doc: https://ns514514.ip-142-4-215.net/
Link to RapidAPI: https://rapidapi.com/bacloud14/api/safe-text 

You can head to https://ns514514.ip-142-4-215.net/documentation to try the API.


Kindly
Photogram Industrial Notes
Published: 2024-03-08 21:21:34

##**notes about scaffolds for CRUD & generating a model**

- The question you have to answer now is: for each of these tables, do you want to generate a scaffold or do you just want to generate a model? How do we figure that out?

>If I will need routes and controller/actions for users to be able to CRUD records in the table, then I probably want to generate `scaffold`. (At least some of the generated routes/actions/views will go unused. I need to remember to go back and at least disable the routes, and eventually delete the entire RCAVs, at some point; or I risk introducing security holes.)

>If the model will only be used on the backend, e.g. by other models, then I probably want to generate `model`. For example, a `Month` model where I will create all twelve records once in `db/seeds.rb` does not require routes, `MonthsController`, `app/views/months/`, etc.

##**foreign keys in migrates & models**

- any times you are specifying the `forgein_key` within a migrate file, you need to also make sure to go and change it in the model as well. so here is our migrate file 
```
class CreateComments < ActiveRecord::Migration[7.0]
  def change
    create_table :comments do |t|
      t.references :author, null: false, foreign_key: { to_table: :users }
      t.references :photo, null: false, foreign_key: true
      t.text :body
 
      t.timestamps
    end
  end
end
```
- and we are specifically looking at the `foreign_key: { to_table: :users }` part of this. and you can see we specified that the users table is going to be what the author is referring to. 

- so now in our models, we can go into `comment.rb`, and in here we can add in the specific classname for the author 
```
class Comment < ApplicationRecord
  belongs_to :author, class_name: "User"
  belongs_to :photo
end
```

> Raghu: *"So basically for every `foreign_key`, there should be a `belongs_to`. For every `belongs_to`, there should be a `has_many`."*<


>rails db:drop will delete your entire database, rails db:rollback will undo your last migration<

>will need to keep all the migration files to see all the history of changes and
Perl Weekly Challenge #217 - Flattening the Matrix
Tags: perl, matrix, perlweeklychallenge
Published: 2023-05-21 13:01:57

This week we have a very simple challenge! Again due to time, I just did the first challenge this week, but I have an idea of how I'd solve the second and I'll compare with the way others implemented it.

Anyway, to the challenge. The goal is to find the 3rd smallest element of a matrix. The simplest way is simply to flatten, sort, and pick the element. There might be absolutely more performant ways to do it, such as scanning the entire matrix once and keeping a list of the lowest three as you iterate, but this is a case where I feel that it's simply not worth it. One pass to flatten and one sort isn't worth all the extra implementation complexity. I do look forward to seeing any solutions including that technique though.

Here's my code:

    my @matrix1 = ([3, 1, 2], [5, 2, 4], [0, 1, 3]);
    my @list1;

    foreach (@matrix1) {map {push @list1, $_} @{$_}}
    @list1 = sort @list1;
    say $list1[2];

Repeated for each input dataset.

So the easy simple way to do this is just to use map to flatten the array onto @list1, then sort it in place and pick the third element. That simple. Essentially 3 lines for the majority of the task.

As I said, I look forward to seeing the other solutions for these challenges, and I'll hopefully see you next week!
React Lifecycle
Tags: react, beginners, javascript, programming
Published: 2023-05-22 21:40:03

## Introduction
This would be a simple post about React lifecycle with hooks and react lifecycle with classes.

## React lifecycle with hooks.

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

## React Lifecycle with classes


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


## Difference
I was wondering just like you about unmounting which in the hooks lifecycle but in this case the unmount will be when we do the clean up with for example useEffect, where inside the useEffect doing the return we are doing the unmounting which is called clean up.

## Conclusion
We can do basically the same and in a simpler way with functional components. We just have to know how to do it.


Hope someone found it useFul.

Lautaro