teleren/devto huggingface dataset:
Geek Week: Local
Tags: computerscience, coding, geeksforgeeks, firstpost
Published: 2021-03-20 10:22:23

Geek Week: Local is a week-long hackathon of creating hacks, solving problems, and building profiles both big and small. Choose between daily and week-long challenges that vary in difficulty, so whether this is your first time coding or you’re a seasoned expert, Geek Week has something for you. The more challenges you conquer, the more points you’ll earn and make your position on the leader-board.
Geek Week: Local taking place from 14/03/21 to 21/03/21.
During this time, you can expect challenges for all skill levels. These challenges can be completed on your own time, and new ones will be released each day on our website! Once the daily challenges are announced, you’ll have 24 hours to complete and submit them in order to earn those points on the leader-board.
If the daily challenges aren’t quite your speed, there will also be plenty of week-long challenges you can complete at any time. These will range from quick technical challenges to tasks you can complete with your guild-mates (guild=team), both beginner-friendly and technically advanced so there is something for everyone.
WHAT WE LEARNED ?
Power of Patience
During coding, we got many obstacles. One of the major obstacles is the error in the code. But after we practiced writing enough codes and learned to find out the errors, we developed a quality of patience to calm our minds and think sensibly because this is a critical factor in finding the fault.
Power of Perspective
Coding or solving questions helps us understand the world from a different perspective. While solving coding questions, many problems require a different perspective. With practice, you gain experience, and with experience, you gain perspective; it’s as simple as that.
Power of Logical Thinking
Coding helps strengthen your thinking capability as many difficult questions need healthy thinking to crack it. We also need logical thinking. Before solving a problem, we have to identify the logic used to solve the question and find out the different logical ways, and coding helps us put our brain in that situation.
GEEK WEEK : LOCAL
Tags: geeksforgeeks, vitbhopal, geekweeklocal
Published: 2021-03-20 10:22:05

Geek Week: Local is a week-long hackathon of creating hacks, solving problems, and building profiles both big and small. Choose between daily and week-long challenges that vary in difficulty, so whether this is your first time coding or you’re a seasoned expert, Geek Week has something for you. The more challenges you conquer, the more points you’ll earn and make your position on the leader-board.
Geek Week: Local taking place from 14/03/21 to 21/03/21.
During this time, you can expect challenges for all skill levels. These challenges can be completed on your own time, and new ones will be released each day on our website! Once the daily challenges are announced, you’ll have 24 hours to complete and submit them in order to earn those points on the leader-board.
If the daily challenges aren’t quite your speed, there will also be plenty of week-long challenges you can complete at any time. These will range from quick technical challenges to tasks you can complete with your guild-mates (guild=team), both beginner-friendly and technically advanced so there is something for everyone.
WHAT WE LEARNED ?
Power of Patience
During coding, we got many obstacles. One of the major obstacles is the error in the code. But after we practiced writing enough codes and learned to find out the errors, we developed a quality of patience to calm our minds and think sensibly because this is a critical factor in finding the fault.
Power of Perspective
Coding or solving questions helps us understand the world from a different perspective. While solving coding questions, many problems require a different perspective. With practice, you gain experience, and with experience, you gain perspective; it’s as simple as that.
Power of Logical Thinking
Coding helps strengthen your thinking capability as many difficult questions need healthy thinking to crack it. We also need logical thinking. Before solving a problem, we have to identify the logic used to solve the question and find out the different logical ways, and coding helps us put our brain in that situation.
GEEK WEEK : LOCAL
Tags: coding, programming, geeks
Published: 2021-03-20 10:22:02

Geek Week: Local is a week-long hackathon of creating hacks, solving problems, and building profiles both big and small. Choose between daily and week-long challenges that vary in difficulty, so whether this is your first time coding or you’re a seasoned expert, Geek Week has something for you. The more challenges you conquer, the more points you’ll earn and make your position on the leader-board.
Geek Week: Local taking place from 14/03/21 to 21/03/21.
During this time, you can expect challenges for all skill levels. These challenges can be completed on your own time, and new ones will be released each day on our website! Once the daily challenges are announced, you’ll have 24 hours to complete and submit them in order to earn those points on the leader-board.
If the daily challenges aren’t quite your speed, there will also be plenty of week-long challenges you can complete at any time. These will range from quick technical challenges to tasks you can complete with your guild-mates (guild=team), both beginner-friendly and technically advanced so there is something for everyone.
WHAT WE LEARNED ?
Power of Patience
During coding, we got many obstacles. One of the major obstacles is the error in the code. But after we practiced writing enough codes and learned to find out the errors, we developed a quality of patience to calm our minds and think sensibly because this is a critical factor in finding the fault.
Power of Perspective
Coding or solving questions helps us understand the world from a different perspective. While solving coding questions, many problems require a different perspective. With practice, you gain experience, and with experience, you gain perspective; it’s as simple as that.
Power of Logical Thinking
Coding helps strengthen your thinking capability as many difficult questions need healthy thinking to crack it. We also need logical thinking. Before solving a problem, we have to identify the logic used to solve the question and find out the different logical ways, and coding helps us put our brain in that situation.
Django Lifecycle Hooks
Tags: django, python, beginners
Published: 2021-03-20 10:19:35

---
title: Django Lifecycle Hooks
published: true
description: 
tags: django, python, beginners
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9kjo41eia1cekaiixzg9.jpeg
---

<h2>Django Lifecycle Hooks</h2>
The Python Django community is large and active. It is therefore not uncommon for quality tools to be created... 

This is the case with this new Django package name Lifecycle Hook.

This package provides a @hook decorator as well as a base model and mixin to add lifecycle hooks to your Django models. 

For example, we are used to doing the following with model hooks. Note how difficult to read/understand the code is:

```python
class Article(LifecycleModel):
    contents = models.TextField()
    updated_at = models.DateTimeField(null=True)
    status = models.ChoiceField(choices=['draft', 'published'])
    editor = models.ForeignKey(AuthUser)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
    	self._orig_contents = self.contents
    	self._orig_status = self.status


    def save(self, *args, **kwargs):
    	if self.pk is not None and self.contents != self._orig_contents):
            self.updated_at = timezone.now()

    	super().save(*args, **kwargs)

    	if self.status != self._orig_status:
            send_email(self.editor.email, "An article has published!")
```
With Lifecycle Hook you can now do this:
```python
from django_lifecycle import LifecycleModel, hook, BEFORE_UPDATE, AFTER_UPDATE


class Article(LifecycleModel):
    contents = models.TextField()
    updated_at = models.DateTimeField(null=True)
    status = models.ChoiceField(choices=['draft', 'published'])
    editor = models.ForeignKey(AuthUser)

    @hook(BEFORE_UPDATE, when='contents', has_changed=True)
    def on_content_change(self):
    	self.updated_at = timezone.now()

    @hook(AFTER_UPDATE, when="status", was="draft", is_now="published")
    def on_publish(self):
    	send_email(self.editor.email, "An article has published!")
```

Much much cleaner.

The package is still in beta for now but it's already working pretty well. You can learn more and try by yourself here: https://rsinger86.github.io/django-lifecycle/

<h2>Conclusion</h2>
I am convince this package will quickly become one of my favorite. It's powerfull but simple to use and make code cleaner.

I post something new almost every day so if you like post like this one you can follow-me here on dev.to

You can also follow me on Twitter: <a href="https://twitter.com/justericchapman?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="false">Follow @justericchapman</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Why Are Generative Adversarial Networks(GANs) So Famous And How Will GANs Be In The Future?
Tags: machinelearning, datascience, computerscience, python
Published: 2021-03-20 10:10:11

#Here is a link to the article I wrote on ["Why Are Generative Adversarial Networks(GANs) So Famous And How Will GANs Be In The Future?"](https://www.analyticsvidhya.com/blog/2021/03/why-are-generative-adversarial-networksgans-so-famous-and-how-will-gans-be-in-the-future/#:~:text=There%20are%20a%20variety%20of,machine%20learning%20in%20the%20last)



###There are a variety of reasons why GANs are so exciting and one of them is because GANs were the first generative algorithms to give convincingly good results also they have opened up many new directions for research and GANs themselves is considered to be the most prominent research in machine learning in the last decade.

##{#GANs #generativedesign #gan #machineintelligence #machinelearning #artificialintelligence #datascience #generativeart #generativenetworks}
What are developers learning in the 1Q of 2021?
Tags: learn, path, ideas
Published: 2021-03-20 09:58:44

I was wondering what are the new trends or classic paths that developers like to throw themselves into. 

> Developers are curious people, they always want to learn something new, destroy something and fix it from scratch.

So I asked my lovely friends on Twitter and as always they were happy to share their thoughts.

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">What are you currently learning?</p>&mdash; Eleftheria Batsou (@BatsouElef) <a href="https://twitter.com/BatsouElef/status/1351093471008989188?ref_src=twsrc%5Etfw">January 18, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

# Programming related
- HTML/CSS/Javascript (<-- 1st most common)
- The MERN stack      (<-- 2nd most common)
- React               (<-- 3rd most common)
- Redux
- RabbitMQ
- Redis
- Ruby
- Next.js
- Node.js
- Gatsby
- Golang
- GraphQL
- SIP, IMS and REST
- Swift
- Java
- Java testing JUnit
- Typescript
- Test Automation
- Vue js
- PHP
- Python (and django)
- AI (and AI with python)
- APIs
- Android
- Azure
- Backbone.js
- Bootstrap
- C, C++, C#
- Data structures
- Deploy & start of a project on a domain/server
- Docker
- Flutter

# Design related 
- Design (both UI and system)
- UI/UX with adobe XD


# General
- Trying to figure out the suitable rhythm that preserves my work/life balance
- Sharpening the existing skills before going for something new
- History (and reading history books)
- Music (music theory, learning how to play a music instrument, music production)
- Learning a new language (French, Dutch, Spanish, German, English)
- Entrepreneurship and business essentials.
- Time management
- Stress management 
- Life

# I got VERY few (almost zero) answers about:
- Angular
- AWS
- Docker
- Kubernetes
- Kotlin

To be honest I thought more people were learning about these technologies since there is always a new conversation on the web about them.

**What are you learning?**

I'm focusing on UX research and design, video editing and some python.


**************************************

👋Hello, I'm Eleftheria, a front-end developer, master student, freelancer, public speaker, and chocolate lover.

🥰If you liked this post please share.

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](https://www.paypal.com/paypalme/eleftheriabatsou) but If you can't that's ok too!


[![cofGif.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1616161452909/PAHC8Vx5U.gif)](https://www.paypal.com/paypalme/eleftheriabatsou)


**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/elef_in_tech)
Geek Week local - Experience
Tags: github, go, geekweeklocal
Published: 2021-03-20 09:38:38

It was a very great experience. All thanks to Geek For Geek Vit Bhopal and my GUILDmates. I'm so pleased to join such a wonderful GUILD as co-lead also GFG team was too wonderful.
Good luck to all guilds do your best to push your guild up.
Overall it was totally a different experience all teammates did their best let's hope for the best.
By teaching juniors about web development I brushed up my skills.
#geekweeklocal
New Python Match-Case Article
Tags: python, datascience, tutorial, programming
Published: 2021-03-20 09:33:52

{% medium https://towardsdatascience.com/switch-case-statements-are-coming-to-python-d0caf7b2bfd3 %}

[Free access link if you don't have Medium membership](https://towardsdatascience.com/switch-case-statements-are-coming-to-python-d0caf7b2bfd3?sk=363e0f7696502647e007f91910b4c817)

Python 3.10 is beginning to fill-out with plenty of fascinating new features. One of those, in particular, caught my attention — structural pattern matching — or as most of us will know it, switch/case statements.

Switch-statements have been absent from Python despite being a common feature of most languages.

Back in 2006, PEP 3103 was raised, recommending the implementation of a switch-case statement. However, after a poll at PyCon 2007 received no support for the feature, the Python devs dropped it.

Fast-forward to 2020, and Guido van Rossum, the creator of Python, committed the first documentation showing the new switch-statements, which have been named Structural Pattern Matching, as found in PEP 634.

What we have here is much more than a simple switch-case statement, however (hence match-case), as we will see soon.

Let’s take a look at how this new logic works.
My Experience in Geek Week: Local



Tags: geekweeklocal
Published: 2021-03-20 09:13:30

The GeeksforGeeks VIT Bhopal Community had arranged a marvelous week- long competition where the Community would set some daily tasks and challenges and everyone had to complete them within a time limit of 24 hours. All the students of VIT Bhopal were eligible to take part in this event. The participants had to form a guild and there would be a guild leader representing the guild. Throughout the span of a week -starting from 16th March till 21st March- a healthy competition had ensued between the guilds and a magnanimous team spirit had built between the members. I belonged to the BugBusters guild and we, as its members, had a tremendous amount of enjoyment, amusement and excitement throughout the week solving all the tasks. Starting from Day 1, we learnt how to use GitHub and exercised on competitive programming. Day 2 saw us delving deeper into the technical stuffs and examining them properly. Day 3 had us making an android app, generating a tic tac toe game and using a weather API. Day 4 was all about data visualization and exploring web development and redesigning and creating websites. Day 5 brought in tasks like automation, password encryption, building an AI project, generate a chess game and using a social media API to name a few. As the week progressed the tasks grew all the more interesting and tougher. We had week-long and weekend challenges too where we had to research more into web automation, GUI, voice assistant and probe deeper into GitHub. The best part of the event was that the tasks were a perfect blend of technical and non-technical chores. The tasks had us sharing meals with our guildmates, playing among us and skribbl and also meeting other guild members. Each day we had 3 live sessions- 1st being the one where the Committee members would explain us the tasks and guide us with the nitty-gritties; 2nd was the one where we were assigned live mini event challenges and we had to accomplish them to earn extra points and that was the best part of the entire day as it had a lot of unique and engrossing tasks which were so pleasurable to do; and the 3rd one was where the core members would update us about the tasks of the next day and update the leaderboard. This event not only gave an astounding insight into the technical world but also gave a chance to interact and build a harmonious ethos among all the participants towards their guilds.
Summarizing Namaste 🙏 JavaScript EP05 (Window object )
Tags: javascript, help, windowobject, namastejavascript
Published: 2021-03-20 09:09:46

Thank you Akshay Saini for this beautiful series. Just summarizing your lessons for whenever I need a quick recap. Same for others. Hope it helps.

###What is window object ?

window is a global object which is created alongside with Global execution context.
So, even if you don't write any code , Js automatically provides us with a global object named window which contains many methods.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xaunw1ghe4kqir5uqw24.png)

### What is global space ?
Any code which is not written inside a function lies in global space.
  
**At global level, this === window**
We will talk about this in upcoming blogs
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j8ljds1oy8wuf3d08hz6.png)

If you look at the right side, **var a** is tied to the global object that is window object. Hence, its memory is allocated in window object
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3auk6wkhebbb196t41m1.png)

If you don't put anything before **a**, Js assumes that it is in global space.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ckxnlsofjuqx068ylwc.png)
🎯Merge two sorted arrays without using any extra space🎯
Tags: tutorial, todayilearned, discuss, programming
Published: 2021-03-20 09:06:21

**Question:** 

Given two sorted arrays arr1[] of size N and arr2[] of size M. Each array is sorted in non-decreasing order. Merge the two arrays into one sorted array in non-decreasing order without using any extra space.

**Example 1:**

```
Input:
N = 4, M = 5
arr1[] = {1, 3, 5, 7}
arr2[] = {0, 2, 6, 8, 9}
Output: 0 1 2 3 5 6 7 8 9
Explanation: Since you can't use any 
extra space, modify the given arrays
to form 
arr1[] = {0, 1, 2, 3}
arr2[] = {5, 6, 7, 8, 9}
```

**Logic :**

1. Compare and swap method :
    - Take input as two sorted arrays and there sizes a[ ], b[ ], n ( length of a ), m ( length of b)
    - take two varible k = n-1 & j = 0
    - run a while loop from k = n-1 to k = 0 and j = 0 to j = m-1;
    - check if a[ i ] > b [ j ]. If yes swap them . If no k - - and j++;
    - after the while loop sort both the array and print them

```java
import java.util.*;

public class Solution{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < a.length; i++){
            a[i] = sc.nextInt();
        }
        int b[] = new int[m];
        for(int i = 0; i < b.length; i++){
            b[i] = sc.nextInt();
        }

        //This is swapping approach
        int k = n-1, j = 0;
        while(k >=0 && j <= m){
            if(a[k] > b[j]){
                int temp = a[k];
                a[k] = b[j];
                b[j] = temp;
            }
            k--;
            j++;
        }
        Arrays.sort(a);
        Arrays.sort(b);

        System.out.println("Sorted array is: ");
        for(int i = 0; i < a.length; i++){
            System.out.print(a[i]+" ");
        }
        for(int i = 0; i < b.length; i++){
            System.out.print(b[i]+" ");
        }
    }
}
```
💥Minimum jumps to reach the end of the array💥
Tags: tutorial, discuss, programming, todayilearned
Published: 2021-03-20 08:59:25

**Question :** 

Given an array of integers where each element represents the max number of steps that can be made forward from that element. Find the minimum number of jumps to reach the end of the array (starting from the first element). If an element is **0**, then you cannot move through that element.

**Example 1:**

```
Input:N=11 
arr=1 3 5 8 9 2 6 7 6 8 9 
Output: 3 
Explanation: 
First jump from 1st element to 2nd 
element with value 3. Now, from here 
we jump to 5th element with value 9, 
and from here we will jump to last. 
```

**Logic:**

1. Dynamic Programming:
    - Follow the pseudocode alongside the representation you will understand it else watch Tushar Roy's video regarding this.


```java
import java.util.*;

public class Solution{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[n];
        for(int i = 0; i < arr.length; i++){
            arr[i] = sc.nextInt();
        }

        //This is a Dynamic Programming solution
        int jump[] = new int[n];
        for(int i = 1; i < jump.length; i++){
            jump[i] = 1000000;
        }
        int path[] = new int[n];
        jump[0] = 0;

        for(int i = 0; i<arr.length-1; i++){
            for(int j = i+1; j < arr.length; j++){
                if(arr[i] >= j - i){
                    if(jump[i]+1 <= jump[j]){
                        jump[j] = jump[i]+1;
                        path[j] = i;
                    }
                }else{
                    break;
                }
            }
        }

        System.out.println();
        System.out.println("The jump array is: ");
        for(int i = 0; i < jump.length; i++){
            System.out.print(jump[i]+" ");
        }

        System.out.println();
        System.out.println("The path array is: ");

        for(int i = 0; i < path.length; i++){
            System.out.print(path[i]+" ");
        }

        boolean unreached = false;
        for(int i = 0; i < jump.length; i++){
            if(jump[i] == 1000000){
                unreached = true;
            }
        }

        if(unreached == false){
            System.out.println();
            System.out.println("The jump route is: ");
            int jumpCount = 0;
            int k = path.length-1;
            while(k != 0){
                System.out.print(k+" ");
                k = path[k];
                jumpCount++;
            }
            System.out.println();
            System.out.println("Minimum Jumps made are: "+jumpCount);
        }else{
            System.out.println("Minimum Jumps made are: -1");
        }


    }
}
```