teleren/devto huggingface dataset:
Today I learn Django #1
Published: 2020-12-06 15:49:14

I do have some prior knowledge in python, but only at intermediate level. And I want to go further with this knowledge. So today I starting my adventure to learn Django.

What I learn today is the basic thing about Django, like the Django feature, how to start a project, how to make an app and the function of some file in my Django project do.

Please CMIIW.
<p>&nbsp;</p>
### **Some of Django feature:**
- Object-relational mapping (ORM),
    - ORM is related to database queries and database schema.
- URL routing,
- HTML templating,
- Form handling,
- Unit testing.

<p>&nbsp;</p>
### **Project and App**
At the beginning of I got confused about the term **django project** and **django app**. 

What is the different? 
After re-learn about it I got something. So in one project can have more than one app. Like if I try to create a web project, inside that project I can have forum app and blog app that work together in single project.

For me, an easy way to understand it is like this -> django project is a building, and the app is a room inside the building. Like one building can have more than one rooms right?

That's it for now. See you again tomorrow. Bye bye~
👨‍💻 Routing in Django ( Part 9 ) - Django For Beginners
Tags: python, django, webdev, beginners
Published: 2020-12-06 15:47:27

This post was originally posted here [👨‍💻 Routing in Django ( Part 9 ) - Django For Beginners](https://www.ketaniralepatil.com/python/django/urls-in-django/).

This is part of the series [Django For Beginners](https://www.ketaniralepatil.com/series/django-for-beginners/) we are going to see about apps in app and we will see about urls in python. 

In this post we are going to learn all about urls in django,, let's get started. 

### Understanding URLS in Django 

Let us first understand where we write our urls, we write our urls in our project folder in `urls.py` file, as shown below.

```toml
 📂 myDjangoSite
	- 📂 myDjangoSite
		- 📄 __init__.py
		- 📄 asgi.py
		- 📄 settings.py
		- 📄 urls.py
		- 📄 wsgi.py
	- 📄 manage.py
```

 In `urls.py` specifically we write path for our django website in `urlpatterns` list, in a patterns as shown below,

```python
from django.urls import path
from . import views

urlpatterns = [
    path('', views.Home, name="home"),
    path('about/', views.About, name="about"),
]
```

The syntax for path is as follows,

```python
path( route, view, name )
```

Where route is a string argument and denotes the relative path we want for that view. View is a `view` it may be a class-base or a function-based view...

Sorry to interrupt you, you can read this complete post here [👨‍💻 Routing in Django ( Part 9 ) - Django For Beginners](https://www.ketaniralepatil.com/python/django/urls-in-django/).
Say no to these algorithms in practice
Tags: algorithms, sortingalgorithms, bogosort, bogobogosort
Published: 2020-12-06 15:46:00

So here we will be discussing briefly Bogosort and Bogobogosort, which are two inefficient algorithms.

> **NOTE:** These are just for educational purposes. Never use these in real-life applications. ☠☠

### Bogosort:
Bogosort first checks whether the list is already sorted. It checks over the entire list by checking if the adjacent pair is correctly ordered. If it is not in order, then it shuffles all the list in random order and again starts over. This process goes on till the list is sorted.

When we get into the time complexity of this algorithm, we get to know why it is an inefficient algorithm.

The logic of Bogsort is as follows:
```
import random
from random import shuffle
def sequence_sorted(data):
    return (data[i]<=data[i+1] for i in range (len(data)-1))

def bogosort(data):
    while not sequence_sorted(data):
        shuffle(data)
    return data
```


The best-case time complexity is achieved when the list or sequence is already sorted. Best case complexity is **O(n)**.

The average case complexity is **O(n*n!)=O((n+1)!)**.

The worst case is when the list takes forever to get sorted. We have no guarantee that this algorithm will return a sorted output as it randomly shuffles all the entries each time.
The worst-case time complexity is **O(∞)**.

### Bogobogosort:
We also have an algorithm called Bogobogosort, which checks the first 2 elements of the list and bogosorts them. In the next round, it checks the first 3 elements and bogosorts them and this process continues till it reaches the end. If it finds that the list is not in order, it starts the process again by bogosorting the first 2 elements.

The average time complexity of this algorithm is **O(N! * 1! * 2! * 3! * .... * N!)**.

**Hope you learnt some new concepts. Thank you for reading.😊**
react-scroll-restorer
Tags: react, restore, scroll, showdev
Published: 2020-12-06 15:36:35

Hey every one, I hope you are all doing great.

I have just published a `React` package `react-scroll-restorer` that helps restoring old scroll positions after component re-mounts.

Your feedback & love will be greatly appreciated. Link to the GitHub repo below.

[https://github.com/ahmednooor/react-scroll-restorer](https://github.com/ahmednooor/react-scroll-restorer)

Thank you 😊
How to build a great tech team that delivers!
Published: 2020-12-06 15:33:04

A great tech team delivers high-quality software within the stipulated timeline. They are well-co-ordinated individuals who work towards a common goal and thrive to achieve them.

### 1. Who should you hire?

I have interviewed a lot of people with a technical background and I think we can separate talents into two categories -

A. Highly academic / Experience at the highest level.
B. Dedicated to learning with the ability to deliver.

I have seen a lot of people hire the first kind and fail miserably and spend a lot of money/resources on them. I think the reason is simple, either people aren't able to convert their academic knowledge to practical ones or there are a few things different at your company that the experienced ones aren't able to adapt to and aren't willing to learn.

In my opinion, the second group that is dedicated to learning is a great choice in the long-run as they are willing to learn new things and adapt to them. They are usually people who are more passionate about their field.

### 2. Build a strong and motivated core team.

You and your co-founders can't make all the decisions/critical work. You need a strong group of people who are extremely passionate and can handle multiple responsibilities.

### 3. Provide resources to learn and grow.

![cfo-asks-ceo](https://dev-to-uploads.s3.amazonaws.com/i/icxe9uei1rlyzzzpjf57.jpg)

You have to invest in people or give them time to learn new things. Enroll people in online classes, provide free knowledge materials, pay for their tech meetups.

### 4. Build a great work environment.

![funny-relatable-work-memes-58d0dfeb53977__700](https://dev-to-uploads.s3.amazonaws.com/i/v1t5com4ng778tdfic41.jpg)

Make sure you build a fun work environment so it doesn't become boring. Keep the team motivated with fun activities and make sure that work is not the only thing team is spending all of their time on. Productive people will always give better results. 

---

And that's it!

In case you don't want to do all this, then just hire [a good software development company](https://www.inkoop.io/services/web-development/).

---

I have been building my team at [Inkoop](http://inkoop.io/) for 5 years now, we have a very strong team who delivers great tech on time.
How to check space left and what eat it on Ubuntu
Tags: personaltips
Published: 2020-12-06 15:28:09

<sub><span>Photo by <a href="https://unsplash.com/@nasa">NASA</a> on <a href="https://unsplash.com/images/nature/space">Unsplash</a></span></sub>


[Source](https://www.linux.com/training-tutorials/6how-check-disk-space-linux-command-line/)

2 commands are particularly useful:

```
df -H --output=size,used,avail

du -a /media/jack | sort -n -r | head -n 10
```

example: 

```
sudo du -a /usr | sort -n -r | head -n 10
```
Hope this helps !
Advent of Code 2020 Solution Megathread - Day 6: Custom Customs
Tags: adventofcode, challenge
Published: 2020-12-06 15:27:20

---
title: Advent of Code 2020 Solution Megathread - Day 6: Custom Customs
published: true
description: Now we're helping our fellow passengers fill out questionnaires!  Who knew vacations had so many forms?
tags: adventofcode, challenge
series: Advent of Code 2020
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/twg4dhjob0w6q8seat71.png
---

Yesterday, a lot of you finished quickly and were looking for more to keep you occupied on a Saturday.  All of the golfed one-liners were really funny to read through.

## The Puzzle

In [today’s puzzle](https://adventofcode.com/2020/day/6), we're helping our fellow passengers fill out customs forms.  26 questions represented by 'a'-'z', and the presence of a particular letter in our input means a "yes" for that question for that particular person.  We're just helping tally up the results.

## The Leaderboards

As always, this is the spot where I’ll plug any leaderboard codes shared from the community.

```
Ryan's Leaderboard: 224198-25048a19
```

If you want to generate your own leaderboard and signal boost it a little bit, send it to me either in a DEV message or in a comment on one of these posts and I'll add it to the list above.

## Yesterday’s Languages

Updated 03:07PM 12/12/2020 PST.

| Language   | Count |
|------------|-------|
| Ruby       |     3 |
| Go         |     2 |
| Python     |     2 |
| Haskell    |     2 |
| JavaScript |     2 |
| C          |     2 |
| Rust       |     2 |
| COBOL      |     1 |
| Elixir     |     1 |
| D          |     1 |
| TypeScript |     1 |


Merry Coding!
Homebrew M1 (ARM64)
Tags: m1, arm64, applesilicon, homebrew
Published: 2020-12-06 19:32:22

---
title: Homebrew M1 (ARM64)
published: true
date: 2020-12-06 15:26:53 UTC
tags: m1,arm64,applesilicon,homebrew
canonical_url: 
---

ใครสนใจทดลองเล่น package ที่ติดตั้งจาก Homebrew แบบ M1 หรือ ARM64 ตอนนี้ก็สามารถเล่นกันได้แล้ว package พื้นฐานหลายตัวได้รับการ patch ผมบันทึกไว้สั้นๆ ดังนี้

![](https://cdn-images-1.medium.com/max/838/1*id1O51pbzdnu-R-Hxy3ACg.png)<figcaption>ภาพจากเว็บ brew.sh</figcaption>

### x86_64

ณ ตอนนี้ทางทีมงาน Homebrew ยังแนะนำให้ใช้แบบ x86\_64 เพื่อความมั่นใจว่าใช้งานได้แน่นอนซึ่งการติดตั้งแบบนี้ง่ายๆ ทำได้ดังนี้

```
arch -x86_64 /bin/bash -c "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install.sh](https://raw.githubusercontent.com/Homebrew/install/master/install.sh))"

arch -x86_64 brew install htop
```

การใช้ arch -x86\_64 ยังสามารถใช้ได้กับหลายๆ สถานการเช่น compile source code ถ้าไม่ระบุอะไรเลยมันจะพยายาม compile เป็นแบบ arm64 เราก็ใส่ arch -x86\_64 ไว้ข้างหน้าแล้วทำการ configure หรือ make หรือตอนเรียกใช้งานก็ได้ เช่นในกรณีของ brew ตอนเรียกใช้สามารถใส่ arch -x86\_64ไว้หน้าคำสั่ง brew ก็ได้ แต่มันก็น่ารำคาญหลายคนแนะนำให้เปิด terminal ใน mode x86\_64 ไปเลยก็ได้

![](https://cdn-images-1.medium.com/max/540/1*d5fP6Skp42votUW61yhGUw.png)<figcaption>เปิด iTerm ใน mode x86_64</figcaption>

![](https://cdn-images-1.medium.com/max/740/1*ooy8KCmZneyutb8ItyYh_A.png)<figcaption>เปิด Terminal ใน mode x86_64</figcaption>

### M1 (ARM64)

สำหรับคนที่ชอบตื่นเต้นก็ต้องเสี่ยงและลุ้นกันหน่อย Homebrew กำลัง patch และทดสอบกันอย่างเข้มข้นทำให้ตอนนี้ package หลายๆ ตัวสามารถทำงานได้แล้ว วิธีติดตั้งก็ไม่ยากอะไรครับทำตามนี้เลย

```
mkdir /opt/homebrew
sudo chown mrchoke /opt/homebrew ## เปลี่ยนเป็นชื่อ user ของคุณ
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C /opt/homebrew
```

ถ้าไม่มีอะไรผิดพลาดก็สามารถเรียกใช้ brew ได้โดยตรงที่

```
/opt/homebrew/bin/brew update
```

#### SET PATH

```
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc

source ~/.zshrc
```

ตอนนี้ก็น่าจะเรียก brew แบบสั้นๆ ได้แล้วลองติดตั้งกันได้เลย

```
brew install htop
```

การติดตั้งใน mode arm64 จะช้าหน่อยนะครับเพราะส่วนใหญ่ อาจจะทั้งหมดต้อง compile ก้นสดๆ

สามารถทดสอบกันได้ว่า binary ที่ได้เป็นแบบไหนโดยใช้คำสั่ง

```
file /opt/homebrew/bin/htop
```

![](https://cdn-images-1.medium.com/max/1024/1*fz5PKX8uuQ2iMMzeEYD8_Q.png)<figcaption>ตรวจ arch ของ binary</figcaption>

![](https://cdn-images-1.medium.com/max/455/1*8mhL7bRtLTVHfaUIeiFuDQ.png)<figcaption>ตรวจดูว่ามัน run ใน mode ไหน</figcaption>

* * *
Continuing my learning path, I did a trello clone ;)
Tags: career, webdev, showdev, react
Published: 2020-12-06 15:19:25

Hello everyone!

To show that even if I have no prior work experience nor education in web development ( 36 years old Guitar Teacher ), I have some knowledge, I've decided to tackle the Thullo challenge ( which is a Trello clone ) from the site https://devchallenges.io/ ;)

For the **Backend**, I used Koa with Knex ( Postgresql ) with Typescript. I used TDD to do it. It's slower at first, but as soon the application begins to complexify, it worth the time spent, and most important, I am more comfortable working like this ;).

For the **Frontend**, the main goal was to get a deeper understanding of recoil ( React library for state management ). Unfortunately, I understood some concepts a little bit late in the development :D. My next project should be better ^^. I didn't write any tests for the frontend and that is something I should focus on more for my next projects.

For the css, I used tailwindcss.

I don't know if this project is enough ( for companies ) to consider me as a junior developer but I have some others on my Github account ;).
  
I will now build my portfolio to show what I am capable to do and start looking for a job ;).

If you want to test the application, here is the link: https://challenge-thullo-front.vercel.app/

For the repositories: 
- Backend: https://github.com/ips-coding-challenge/challenge_thullo
- Frontend: https://github.com/ips-coding-challenge/challenge_thullo_front

Feel free to comments, open issues, and give me advice ;)
Update Trello Card using Postman
Tags: postman, testing, tutorial, beginners
Published: 2020-12-06 15:12:33

In this post, we will be using the PUT request to update the Trello cards we created in the previous post. We will be updating the Card name as well as description using the PUT request.

#### **Postman PUT Request**
Just like the POST request, PUT request also takes in the body but instead of creating new data, it is usually used to update existing data. In the example below, we will be updating the name and description of the Trello Card we created in the previous post.

![Postman PUT Request](https://automationbro.com/wp-content/uploads/2020/12/image.png)

---

### **Check out the video below to learn more about how to work with the PUT request in Postman –**
{% youtube 8-PJ78J98s8%}

---

#### To learn about API Test Automation using JavaScript, check out my free tutorial series here –
[JavaScript API Test Automation Tutorial Series](https://www.youtube.com/watch?v=ZSVw3TyZur4&list=PL6AdzyjjD5HDR2kNRU2dA1C8ydXRAaaBV)

---

I hope this video helped you out, let me know if you have any questions in the comments below!

Happy testing! 

...

📧 Subscribe to my [mailing list](https://automationbro.com/mailing-list) to get access to more content like this 
👍 Follow @automationbro on Twitter for the latest updates
Tips to reproduce/fix bugs form software developers
Tags: webdev, programming, productivity
Published: 2020-12-06 15:11:19

Tips to reproduce/fix bugs form software developers
We all know how hard it may be to google an error, some error tend to last too long due to not knowing how to search or find solutions for the error
here are a few tips


## 1. Use the meaningful text from the error

When you are going to search for an error on google try to pick only meaningful text from the error, and avoid timestamps, line numbers, name of files, or other stuff which maybe not that useful to the browser


## 2. Include names of the technology

While googling try to include names of the technologies like if you are using javascript, try to tag it in a search query, or if you are using a framework tag it


## 3. Small search query 

Also, remember to minimize the search query as small text as possible but remember to keep it meaning full, keep in mind that the small text or phrase you write the more result you get on google so this can boost your search to more resources


## 4. First look at GitHub issues / StackOverflow posts

The reason why you need to first look at this platforms are, GitHub mostly have the solution of errors as they might have been reported early on the project so here you get a taste of solutions or alternative from the owners of the project, while StackOverflow is the world of words programmers problems


## 5. Be patient

googling errors does not mean that you have to always find a solution as you get your first search, No, sometimes you don't find a solution at the beginning and what you have to do is keep searching on other platforms not mandatory only Github or StackOverflow, give a try other platform and you may find it


## 6. Look around the community

at this step now look around your friends or elders who you may trust that they know something about the technology you are using,
they help you in one way or other so that your problem may be fixed


## 7. Refresh your mind and take a rest

programmers use their brain and butt than other things so they might be the time you are tired or anything else, first do something to refresh your mind or sleep like 1 hour then you will come back with good thinking than before
7 Habits of an Highly Effective Programmer
Published: 2020-12-06 14:55:00

1. Take care of your body, because programming is a physically demanding activity. This job demands a lot of screen time and sitting in a place static. so over time, your body will start deteriorating. and your health condition will also affect your brain which will, in turn, affect your work efficiency. So get at least 30 mins of physical workout every day (cardio is best for brain health), stay hydrated, get a little sunshine, eat healthily, and finally have a solid sleep routine.
2. Have a get it done attitude. programmers tend to nitpick in every small detail and try to debug and increase the efficiency of the code more by spending a lot of time on it. but an effective programmer should have a get it done attituded. must write code that is simple, follows the code standards set by the employer, and gets the job done. always do a Minimum Viable Solution. Do not be that guy that over romanticizes the tech or the guy that spends hours on setting up the dev environment and argues about vim over emacs. keep the emphasis on delivering product. It doesn't matter how elegant the code looks all that matters is how it does what it's created to do.
3. Keep it simple and consistent. people tend to write extremely complex code in the name of efficiency and strangely prides themselves because others couldn't understand their code. Programming is a field in which each problem can be solved in 100 different ways to it is of paramount importance to keep things simple and consistent. You must be able to read your code and understand it, others must be able to read your code and understand it without your help.
4. Have a consistent way to get into the zone. find a way to get into the zone, set up routines or practices, or specific times that no one could disturb you, and get things done. Minimize distractions. 
5. Keep Learning. Spend at least 1 hour/day for 5 days a week learning something new, something tech that excites you. because if you keep working on the tech that you are working on over time the tech would be outdated. that is inevitable. so keep learning and understand how platforms and technologies interact. have a core level understanding.
6. Collaborate. Programming is a team sport. no matter how great of a programmer you are you can do everything. you will need other programmer's help and others might need your help. develop this collaborative mindset.
7. Make peace with the fact that Programming is a lonely activity. Other careers might have a lot of people interactions but programmers could feel a bit lonely and left out. but suitable for introverts. make peace with it and keep your mental health on track.
Web Development Project Ideas for Beginners
Tags: webdev, html, css, javascript
Published: 2020-12-06 14:42:56

It is important to start building projects while learning programming because you would not be able to absorb the concepts you learn until you apply them to make various projects. Application of concepts you learn is very important. And the best part is you will really enjoy the process of building a project.

Below I will mention some project ideas for those who are learning web development.

**Notes App:**
Create a web app in which users can add and store their notes. This is an excellent project for beginners. The User should be able to Create, Read, Update and Delete the notes. This is an excellent project to learn CRUD operations.

**To-do List:**
Make a to-do list app in which the user can add daily tasks to be accomplished. User should be able to add a new item to the list. User should be able to mark a task in the list as ‘completed’. The completed tasks can appear under a separate category for more organized layout. Users should be able to edit or delete a task from a list.

**To-do List (Advanced):**
After you have made a basic app, try adding the following features to take it up to the next level. Display date and time of when a particular task item was added to the to-do list. Use local storage so that when the user closes the browser window the data is stored and when the user opens the app again the data can be retrieved.

**Build your own Portfolio Website:**
This is the project almost every web developer must have come across in their career. It is a great way to show off your skills, projects and strengths through your own portfolio website.

**Directory Service app:**
Such as maybe a movie app or tv show listing to show you can store data in an array, or object or database. Being able to sort and search and filter through this data later is just as important.

**Quiz App:**
This one is my personal favourite. Build a quiz app in which the user can choose one out of four options for a question. At the end display the result. Use JavaScript for this project. Through this project, you will learn about DOM manipulation and data management.

You can refer to YouTube for tutorials if you ever get stuck somewhere. Happy Coding!!
Netlify deployment + About Section
Tags: portfolio, netlify, resume, contentful
Published: 2020-12-06 14:32:52

Great news! At least for myself 😉.

In my previous post, my goal for this next update is to get the [Netlify](https://www.netlify.com/) deployment working. That is done, together with the About Section as shown in the cover image above.

The about section now briefly introduce myself (of course it did 🤷‍♂️), has a link to my resume PDF, and the motivations behind creating the portfolio site.

This update is the first update that I didn't push any changes to Github. All update done in this post is via the [Contentful CMS](https://www.contentful.com/), including my profile picture. There's still much more other features to explore in Contentful, including an auto deploy in Netlify if there's any content published. I believe that is achievable via webhook. Though, that's a lower priority item as of now. 

Next up, adding my existing projects in the project section! One of them is my old static site which is now live at https://wizlee.dev. 

Adding a liquid tag of my previous post because it looks cool 😎
{% link https://dev.to/wizlee/creating-portfolio-site-2-5ang %}