teleren/devto huggingface dataset:
Vim -- Ubunt の vim を 8.1 から 9.0 に上げる
Tags: vim, ubuntu
Published: 2022-08-13 10:11:00


## why

沢山機能のある vim を使いたかった。

vim で yank してシステムのクリップボードに入るようにしたり
編集中にターミナルを開いてい実行したりできる
最新盤のバージョンに上げたかった。

## 現状を確認

```php
❯ vim
zsh: correct 'vim' to 'vi' [nyae]? n
zsh: command not found: vim
```

vim を打つと vim はないぞ、vi では？と言われる。
Ubuntu は最初は vim が入っていないようだ。

```php
vi --version                                                                                
VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 01 2022 09:16:32)                            
Included patches: 1-2269, 3612, 3625, 3669, 3741   
```

しかし、vi のバージョンをみると VIM 8.1 って出る。
実は vim は入っていて、vi として扱われていると解釈した。

```php
Small version without GUI.  Features included (+) or not (-):                                 
+acl               -farsi             -mouse_sysmouse    -tcl                                 
-arabic            -file_in_path      -mouse_urxvt       -termguicolors                       
+autocmd           -find_in_path      +mouse_xterm       -terminal

...

-clientserver      +jumplist          -printer           +vertsplit                           
-clipboard         -keymap            -profile           +virtualedit 
```

なお、8.2 の前なので以前好きだった clipboard と terminal
これらは入っていなかった。

---

## 仮説を立てる

VIM は既に入っている。
8.2 にリンクされているので、9 をインストールして
vi コマンドで VIM 9 が動くように慣れば解決すると考えた。
まず 9 をいれることにする。

---

## vim 9 のための PPA リポジトリを追加

https://itsfoss.com/install-latest-vim-ubuntu/

It's Foss のサイトを参考にする

最新である Vim 9 を入れるには
PPA レポジトリを jonathonof/vim から
取ってくる必要があるらしい。

https://itsfoss.com/ppa-guide/

PPA とは Personal Package Archive のこと。

https://www.youtube.com/watch?v=0E00Zuayv9Q

Pen-Pineapple-Apple-Pen ではなかった。

```php
sudo add-apt-repository ppa:jonathonf/vim

Fetched 1,197 kB in 3s (425 kB/s)                          
Reading package lists... Done
```

1GB くらいあった。
これで最新版が結びついたので
インストールがそこから入るらしい。

---

## vim をインストール

追加した PPA リポジトリから入るようだ。

```php
❯ sudo apt install vim                                                                        

The following additional packages will be installed:                                          
  vim-common vim-runtime vim-tiny   

Setting up vim-common (2:9.0.0105-0york0~20.04) ...
Setting up vim-runtime (2:9.0.0105-0york0~20.04) ...
Setting up vim (2:9.0.0105-0york0~20.04) ...
Setting up vim-tiny (2:9.0.0105-0york0~20.04) ...
```
vim, vim-common, vim-runtime, vim-tiny が入っている

---

## vim のバージョンを確認する

```php
vi --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 10 2022 08:40:37)

Huge version without GUI.  Features included (+) or not (-):

+autochdir         +folding           +multi_lang        +terminal

-clipboard         +keymap            +printer           +vertsplit
```

vi --version をみてみると
ちゃんと VIM 9.0 に上がっていた。
terminal はあるが、clipboard はなかった。廃止されたのか？

---

## vim9 の恩恵

https://news.mynavi.jp/techplus/article/20220630-2383222/

vim script が 10 ~ 100倍早くなるらしい。用途が思いつかないが

https://forest.watch.impress.co.jp/docs/news/1421103.html

vim script が書きやすくなるらしい。
- function から def になり
- 今までは改行のたびに \ が必要だったのがいらなくなり、
- `#` でコメントアウトできるようになり (.vimrc は不可)
- スクリプトを export して js っぽく分割できるらしい。
 
優先度は低いので、vim script で遊ぶのは劣後とする。
Are you react developer? Do you want to boost your productivity by "X%"?
Tags: react, svelte, solidjs, preact
Published: 2022-08-13 09:58:00

Yes You heard it right. Increased your productivity by X%. 

In recent times, I have found it challenging to get oriented in the codebase when working on projects that I am unfamiliar with. I therefore searched for a tool to address it. Then I discovered the enchanted `LocatorJS` browser addon.

[LocatorJS](https://www.locatorjs.com/) - A browser extension for React devs that allows you to click through from your app to its code.

[Download extension link](https://chrome.google.com/webstore/detail/locatorjs/npbfdllefekhdplbkdigpncggmojpefi) 

![simple demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/241yhcnlvs69nfu9g4ze.gif)

You Click on a component to go to its code

- Click on any component in the browser to open its code in your IDE.
- Supports React, Preact and SolidJS components. 
- Select your IDE, and then use option-click or alt-click on any website with supported components.
Job Announcement Website: Route to Post Page
Tags: javascript, webdev, react, opine
Published: 2022-08-13 09:18:00

{% embed https://dev.to/sokhavuth/table-of-contents-2o4e %}
GitHub: [https://github.com/Sokhavuth/opine-job](https://github.com/Sokhavuth/opine-job)
Deno Deploy: [https://khmerweb-job.deno.dev/users/post](https://khmerweb-job.deno.dev/users/post)
<br/>
<p>We can create a route to the post page in the dashboard as a sub-route of the predefined “/users” main route. Doing so, we can mount this sub-route to the “/users” route as “/users/post”. Following the MVC pattern, we can design this “/users/post” route to be linked with methods in the controllers, views, and models folders in order to display a post page in the dashboard. </p>

<p>Moreover, as the “/users/post” route is leading to a forbidden page, and only registered users are allowed to get into that area, we need to use the application session to check to see whether the user attempting to get into the dashboard is authenticated or not. If they are authenticated, their user data could be registered in Redis database.</p>

```js
// routes/users.ts
 
import { Router } from "../deps.ts";
const router = Router();
 
 
import login from "./users/login.js";
router.use("/", login);
 
import post from "./users/post.js";
router.use("/post", post);
 
 
export default router;
```

```js
// routes/users/post.js

import { Router } from "../../deps.ts";
const router = new Router();

import post from "../../controllers/users/post.js"

router.get("/", async (req, res) => {
    if(await req.mysession.get("user")){
        post.getPage(req, res);
    }else{ 
        res.redirect("/users");
    }
});


export default router;
```

```js
// controllers/users/post.js


class Post{
    async getPage(req, res){
        const config = req.mysetting();
        config.page_title = "Post Page";
        config.route = "/users/post";

        const html = "Post page";
        res.send(html);
    }
}


export default new Post();
```
Git Cheat Sheet - GITHUB.
Tags: git, github, githunt, programming
Published: 2022-08-13 09:15:05

It is useful for all developers, especially for beginners.

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

.
.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/etvvkn5o0d4olm1yflxu.jpeg)
Learn About Django `StaticFiles`.
Tags: django, python, webdev
Published: 2022-08-13 08:58:00

definition of **static_url**, **static_root**, **STATICFILES_DIRS**.


**static_url** :
- it does nothing other then prepending onto your static file url

**static_root** :

- it is the root folder path where our static file will be saved after running `collectstatic` management command. it has nothing to do in our development server because `runserver` helps us to serve our static files easily. but in Production server you wont be running `runserver`. so thats where  **static_root** comes into picture. if you are using any reverse proxy like nginx or apache then these proxy server needs some static root paths to serve static files. 

**STATICFILES_DIRS** :
- It can be a tupel or a list of **extra-static-paths** where you have placed some static-files for your project/app.
    -  **extra-static-paths** : your static file folder other then 
    folder named `static`
Logging in Python
Tags: generalprogramming, python, logging
Published: 2022-08-13 08:53:50

When an application runs, it performs a tremendous number of tasks. A simple to-do app can have tons of tasks like - user logins, creating to-dos, updating to-dos, deleting to-dos, and duplicating to-dos. These tasks can result in success or may end up with some errors. Hence, there is a need to monitor events happening and analyze them to identify bottlenecks in the performance of the application. This is where logging is useful.

In this article, you'll learn how to create logs in a Python application using the Python logging module. Logging can help Python developers of all experience levels develop and analyze an application's performance more quickly.

Read the full blog on [Honeybadger](https://www.honeybadger.io/blog/python-logging/).

Thanks for reading 💜

---

I publish a [monthly newsletter](https://www.ravsam.in/newsletter/) in which I share personal stories, things that I am working on, what is happening in the world of tech, and some interesting dev-related posts which I come across while surfing the web.

Connect with me through [Twitter](https://twitter.com/ravgeetdhillon) • [LinkedIn](https://linkedin.com/in/ravgeetdhillon) • [Github](https://github.com/ravgeetdhillon) or send me an [Email](mailto:ravgeetdhillon@gmail.com).

— [Ravgeet](https://www.ravgeet.in/), *Full Stack Developer and Technical Content Writer*
why isn't .gitignore working?🤔
Tags: gitignore, beginners, git
Published: 2022-08-13 08:48:00

> _T'was the night before bootcamp, and all through the street,_
> _not a creature was stirring (but the smoke detector beeped)_**beep**
> _A lone coder sat, by his laptop with care_
> _Put a file in `.gitignore`, but the file was still there!_**beep**

```
git rm -rf --cached .
```
I realized that I had left a file sitting in my repo that had an API key in it. Don't want that sitting around where some crawling bot
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pebrhtmzipflqoapo7ew.png)
can find it, do I?

So I added the file to my `.gitignore` file. And it didn't work.

And I spent like half an hour trying to figure out if I had the `.gitignore` in the wrong place, or if I was somehow leaving out a `/` or spelling the `/path/wrong/somehow.js`..

I wasn't. You have to run the cache-clearing command above sometimes to clear files from the cache, before you do a `git add` and `commit` and push up to GitHub. Truthfully I should explain it better but it's almost 2am and I need to go to sleep. Google it first so you don't blow anything up.

I also used this command:
```
git checkout --orphan newbranch
```
To create a brand new branch with no commit history, so I didn't push to GitHub my current branch for `main` which successfully added the errant file to `.gitignore` but still had the file as part of a long string of previous commits.

**beep** 😆
JavaScript Example
Tags: javascript, webdev, beginners, tutorial
Published: 2022-08-13 08:28:00

# JavaScript Example
Javascript example is easy to code. JavaScript provides 3 places to put the JavaScript code: within body tag, within head tag and external JavaScript file.

Let’s create the first JavaScript example.

```

<script type="text/javascript">  
document.write("JavaScript is a simple language for Educatque learners");  
</script>  

```
The script tag specifies that we are using JavaScript.

The text/javascript is the content type that provides information to the browser about the data.

The document.write() function is used to display dynamic content through JavaScript. We will learn about document object in detail later.

# 3 Places to put JavaScript code


1. Between the body tag of html
2. Between the head tag of html
3. In .js file (external javaScript)

# JavaScript Code Between Any Body Tag
In the above example, we have displayed the dynamic content using JavaScript. Let’s see the simple example of JavaScript that displays alert dialog box.

```
<script type="text/javascript">  
 alert("Hello Javatpoint");  
</script>  
```

# JavaScript Code Between The Head Tag
Let’s see the same example of displaying alert dialog box of JavaScript that is contained inside the head tag.

In this example, we are creating a function msg(). To create function in JavaScript, you need to write function with function_name as given below.

To call function, you need to work on event. Here we are using onclick event to call msg() function.

```
<html>  
<head>  
<script type="text/javascript">  
function msg(){  
 alert("Hello Javatpoint");  
}  
</script>  
</head>  
<body>  
<p>Welcome to JavaScript</p>  
<form>  
<input type="button" value="click" onclick="msg()"/>  
</form>  
</body>  
</html>  

```
[Source Code](https://github.com/kavya-rgb/JavaScript-Learning)
A Quick 10-Second Programming Joke For Today
Tags: jokes, dailydeveloperjokes
Published: 2022-08-13 08:00:06

---
title: "A Quick 10-Second Programming Joke For Today"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258c4f0d26.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ What is a computer virus?

___A:___ A terminal illness!
 -->
Motion Detection Using OpenCV for begineer.
Tags: python, machinelearning, opencv, beginners
Published: 2022-08-13 07:58:00

**A beginner guide to motion detection using OpenCV.**

For a beginner, which was when I was studying at my university. I studied about OpenCV and its application and decided to work in a computer vision related project.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/acxuwsh01avr64308so4.jpg)
Motion Detection is magic when used in a way that is required, it can be used in vehicle counting system, anomaly detection during exam hall (which is - I don't recommend,  you know what I mean). But on a serious side this sort of libraries can be used in surveillance system which can be utilized more efficiently that your neighbor's eyes.

Video is all about images that are captured continuously, also known as frames. You know FPS - its that images per second that we are talking about here.

Lets have quick look into pseudo code-
1. First we initiate our libraries (pandas, numpy, cv2 (computer vision)).
2. We declare initial state and motion track list.
3. to initialize the camera module its simple than you can ever imagine (cv2.VideoCapture(0)).
{bam, pretty cool, right?}
4. We use while loop to continuously loop through every images captured.
5. We can also use various color conversion in cv2 like, grayscale, gaussian blur etc.
6. We now store each frames in initial state to capture initial state of the video captured.
7. Now we create threshold frame using absolute difference between initial state and current scaled frame.
8. We create a contours using that threshold frame and loop through it to decide a rectangle boundary to any object in motion.
9. Jeez, you made it through all these lecture, now lets look at the code.

follow through my github, for the code - [github](https://github.com/RahulParajuli/ComputerVisionExercise/blob/main/motionDetection.py)


Happy Coding!
Why every programmer should write
Tags: writing, programming, beginners, codenewbie
Published: 2022-08-13 07:42:00

Reading this topic, you may wonder "Don't all programmers write?" Yeah, we write code but the main point of this write-up is what some call technical writing.

Technical writing is a fairly huge aspect in tech that most people don't pursue, I normally didn't see the need to until I forced myself to put a post out there, my fears?

1. **Criticism**: like most people I dislike criticism the fact that I'll spend long hours of my day working on write-ups just to put them out and get a bad review or response. Then I went with something I know, Python basics, I felt no one can go wrong with Python basics so I wrote stuff on that. But I learned some criticism can be good. They help me improve and soon enough I got over this fear.

2. **Unread posts**:this waned on me for some time, some of us are familiar with dev.to's <25 readers, up to my third post I was quite discouraged by this seeing that my posts were pointless and not even seen or read, but the truth is no one reads what they're not interested in or curious about, and I can't force interests so I did the best I could, forwarded posts to people on different social media handles.

3. **Consistency**: I didn't have a problem with consistency till last week when my health went bad and could barely think of what to write, I had written at once every 4 weeks for the past 4 months and got the 16week consistency badge.

So why should you go through all this just to write what you benefit:

1. **Researching**: when writing weekly, though lazy at first I find myself prone to research more often to understand what I'm about to put out, and researching will greatly improve everyone's understanding of a particular aspect of tech whichever you want whether you're writing on it or not.

2. **Cleaner code, Less debugging**: as I continued to write code as I learned, my knowledge of programming also greatly improved it was almost like I began to understand the language like my own and the program does almost exactly what I need it to do which makes my code more liable to run than cause an error needed to be debugged.

3. **Recognition**: I may not be the most popular technical writer in the world, but I can at least be recognized as an author by some, an author of the beginners programming with python series.

I have found so much joy in writing, Also thinking of getting a part-time job from it, so if you know of any openings feel free to hit me up. In the next few weeks, I'll be writing some data science/machine learning overviews and giving steps on building and training models, stay tuned and keep coding.
Vip Facebook Account 2023
Tags: webdev, programming, javascript, tutorial
Published: 2022-08-13 07:40:00

Friends in case you need a Facebook VIP bio?  So you need to comply with this put up until the end, right here you'll discover many Facebook VIP bio & fashionable bio symbols, from right here you could reproduce & paste with the aid of choosing VIP bio in your Facebook profile.

 Hello, Guys welcome to Newsarticleinfo.com!  Today we've added something unique for you which of them is Fb VIP bio.  Friends, in case you are contemplating developing a Facebook VIP account, you ought to have an excellent VIP bio due to the fact a VIP bio could make me extra beautiful, fashionable, and attractive.

`If you need to place a fashionable VIP bio on your Facebook profile, then right here you'll get lots of cool VIP bio symbols, out of which you could reproduce your preferred bio and position it on your Facebook bio. [See More](https://www.newsarticleinfo.com/2022/08/facebook-vip-bio-2023-vip-facebook.html)
Trip Collaborator #1: Finalising Location Made Easy (Problem Statement).
Tags: redishackathon, redis, javascript, programming
Published: 2022-08-13 07:13:00



> This is the part 1 of the 3 part series of building Trip Collaborator.

### Overview of My Submission
The project is called as Trip Collaborator.

### About the project.
Trip Collaborator is an application which will help solve the biggest problem of booking a trip amongst friends, family and relatives.

### Problem Statement.
While we are planning for our next getaway, normally we have lots of places in our mind. These suggestion we either get it from various platforms but managing them is a bit of a concern.

The thought behind Trip Collaborator is to make that hustle easier, two users should easily be able to share location. There are various features that can be implemented along with these.

I will add scope to which this project can be extended in scope section. If anyone interest can submit a pull request.

### Architecture Diagram
Following is the overall architecture diagram. The further detailed diagrams will be added in part 2 of the series.

#### Overall Architecture Diagram

![Overall Architecture Diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3czqcf34nbhhhrj5t1lm.png)

Keep Connected for further part of the series. 
---

### About The Author

Apoorv Tomar is a software developer and part of [Mindroast](https://mindroast.com/). You can connect with him on [Twitter](https://twitter.com/apoorvtomar_), [Linkedin](https://www.linkedin.com/in/apoorvtomar/), [Telegram](https://t.me/ApoorvTomar) and [Instagram](https://www.instagram.com/apoorvsinghtomar/). Subscribe to the [newsletter](https://www.mindroast.com/newsletter) for the latest curated content. Don’t hesitate to say ‘Hi’ on any platform, just stating a reference of where did you find my profile.
Sparse Arrays - HackerRank
Tags: javascript, hackerran
Published: 2022-08-13 07:08:57

Solution:
```
function matchingStrings(strings, queries) {
    // Write your code here
    const occurance =[]
 queries.forEach((query) => {
    let count = 0;
    strings.forEach((eachStr) => {
        if(query === eachStr){
            count++
        }
    })
    occurance.push(count)
  });
  return occurance
}
```
Single Number - Unique one
Tags: javascript, algorithms
Published: 2022-08-13 07:07:46



```
let singleNumber = function(nums){
    let map = {}
    for(let i=0;i<nums.length-1;i++){
        if(map[nums[i]]) map[nums[i]] = false;
        else map[nums[i]] = true;
     }
     for(let [key, value] of Object.entries(map)){
         if(value) return key;
     }
     return -1;
}
```
Array Manipulation - HackerRank
Tags: javascript, hackerrank
Published: 2022-08-13 07:03:20

```
function arrayManipulation(n, queries) {
    console.log(n, q)
 const arr = Array(n + 1);
    let maxValue = 0,
    currentNumber = 0;
    queries.forEach(([startRange, endRange, value]) => {
         arr[startRange] = arr[startRange] || { start: 0, end: 0 };
         arr[endRange] = arr[endRange] || { start: 0, end: 0 };
         arr[startRange].start += value;
         arr[endRange].end += value;
     });
    arr.forEach((cell) => {
       if (cell) {
         currentNumber += cell.start;
         if (currentNumber > maxValue) {
            maxValue = currentNumber;
         }
         currentNumber -= cell.end;
     }
   });
 return maxValue;
  
}

```
This week’s newsletter is out! (13-08-2022) - De-escalating Infiniti
Tags: javascript, tech, webdev, discuss
Published: 2022-08-13 07:02:33

---
title: This week’s newsletter is out! (13-08-2022) - De-escalating Infiniti
published: true
description: Another week of great javascript, tech and web development links.
tags: javascript, tech, webdev, discuss
---

De-escalating Infiniti

https://markjgsmith.substack.com/p/mark-smiths-newsletter-13-08-2022

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
Dynamic Array - HackerRank
Tags: javascript, hackerrank
Published: 2022-08-13 06:58:00

Solution to Dynamic Array:

```
function dynamicArray(N, queries) {
  const S = [];
  let lastAnswer = 0;
  const ans = [];
  for (let i = 0; i < N; i++) {
    S[i] = [];
  }

  queries.forEach((eachItem) => {
    const [q, x, y] = [...eachItem];
    console.log(q, x, y);
    const seq = (x ^ lastAnswer) % N;
    switch (q) {
      case 1:
        S[seq].push(y);
        break;
      case 2:
        const size = S[seq].length;
        const index = y % size;
        lastAnswer = S[seq][index];
        ans.push(lastAnswer);
        break;
      default:
        break;
    }
  });

  return ans;
}
```