teleren/devto huggingface dataset:
August leetcoding Challenge 2021 - Range Sum Query - Immutable
Published: 2021-08-16 17:20:01

Given an integer array nums, handle multiple queries of the following type:

Calculate the sum of the elements of nums between indices left and right inclusive where left <= right.
Implement the NumArray class:

NumArray(int[] nums) Initializes the object with the integer array nums.
int sumRange(int left, int right) Returns the sum of the elements of nums between indices left and right inclusive (i.e. nums[left] + nums[left + 1] + ... + nums[right]).
 

> **Example 1:**

> **Input**
> ["NumArray", "sumRange", "sumRange", "sumRange"]
> [[[-2, 0, 3, -5, 2, -1]], [0, 2], [2, 5], [0, 5]]
> Output
> [null, 1, -1, -3]

> **Explanation**
> NumArray numArray = new NumArray([-2, 0, 3, -5, 2, -1]);
> numArray.sumRange(0, 2); // return (-2) + 0 + 3 = 1
> numArray.sumRange(2, 5); // return 3 + (-5) + 2 + (-1) = -1
> numArray.sumRange(0, 5); // return (-2) + 0 + 3 + (-5) + 2 + (-1) > = -3

[Link to question on leetcode](https://leetcode.com/problems/range-sum-query-immutable/)

**Bruteforce approach**

> The bruteforce solution for this question would , when ever a sumRange query is called compute the sum from given start and end index and return the sum.

> **Time complexity** for this approach will be O(number of time function called * n) - here we are computing the sum for every query

**Optimized solution**

> Instead of calculating the sum for every query , we can have a precomputed sum array , where prefix[i] will be the sum of array from 0 to i . Using this precomputed array for every query we can return the sum in O(1) time complexity.

**Psuedo code**

> * Created a prefix array of size of the given array.
> * Compute the prefix array where prefix[i] will give the sum of array from 0 to i(inclusive)
> * Now for every query requested , do the following:
>        1. If left is 0 , directly return **prefix[right]**
>        2. else return **prefix[right] - prefix[left-1]** - because prefix of right will be sum of original array from **0 to right** , so we have to substract sum of array from **0 to left-1** from **prefix[right]**


**Code**

```python
class NumArray:
    def __init__(self, nums: List[int]):
        self.length = len(nums)
        self.prefixsum = [0]*self.length
        self.prefixsum[0] = nums[0]
        for i in range(1,self.length):
            self.prefixsum[i] = self.prefixsum[i-1]+nums[i]
        self.total = self.prefixsum[-1]
        

    def sumRange(self, left: int, right: int) -> int:
        if left == 0:
            return self.prefixsum[right]
        return self.prefixsum[right]-self.prefixsum[left-1]
```
Please like this post and share if you found this post helpful.
How to get unix epoch in milliseconds in Common Lisp
Tags: commonlisp, unixepoch, milliseconds
Published: 2021-08-16 17:18:23

---
title: How to get unix epoch in milliseconds in Common Lisp
published: true
description: 
tags: commonlisp,unixepoch,milliseconds
//cover_image: https://direct_url_to_image.jpg
---

unix epoch in milliseconds is equal to milliseconds from 00:00:00.000 on 1st of January 1970 to a point of time. Obtaining unix epoch, for now, is obvious for GNU Coreutils' date. For example:

```Bash
$ date +%s
1629132447
```

Obtaining unix epoch in milliseconds is a bit more complicated. I did this.

```Bash
$ date +%s%N | awk '{ print substr($0,0,13) }'
1629132562414
```

I had to use awk to chop the string because %N is for nanoseconds, which is too fine-grained in this case.

In Common Lisp, it is even more complex, since Common Lisp uses Universal Time, which is not unix compatible. 

First, we can obtain Universal Time in second for 00:00:00.000 on 1st of January 1970 by this command.

```Lisp
(encode-universal-time 0 0 0 1 1 1970 0)
```

In the rest of the code, I will use a Common Lisp package - [local-time](https://common-lisp.net/project/local-time/). Given I have a timestamp _tm_ from local-time, which I may obtain it like this.

```Lisp
(setq tm (local-time:now))
```

To get unix epoch, my code converts local-time's timestamp to Universal Time and subtracts Universal Time of 00:00:00.000 on 1st of January 1970 from it. 

```Lisp
(- (local-time:timestamp-to-universal tm)
   (encode-universal-time 0 0 0 1 1 1970 0))
```

Instead of using this long code, local-time has timestamp-to-unix, so we can use it instead. 

```Lisp
(local-time:timestamp-to-unix tm)
```

Since we want timestamp in milliseconds, my program multiplies timestamp above, which is in second with 1000.

```Lisp
(* 1000 (local-time:timestamp-to-unix tm))
```

local-time can provide a timestamp in microseconds, and we need to add it to the timestamp above.

```Lisp
(+ (* 1000 (local-time:timestamp-to-unix tm))
   (local-time:timestamp-millisecond tm))
```

And that is it.
My Goals For KODECAMP Internship
Published: 2021-08-16 17:03:51

Recently joined the KodeCamp internship (**FRONT-END TRACK**) because I want to improve my knowledge and skills and here are my goals for the 16 weeks internship...
   I'd love to achieve the following by the end of this internship;
1. Improve my knowledge by learning the core concepts of javascript and Reactjs.
2. collaboration and team work.
3. Improve my skills in knowledge of front-end development.
4. Time management and critical thnking.
5. Have a remote job.
HNG Journey Begins
Tags: beginners, internship, frontend, hng
Published: 2021-08-16 16:58:01

After completing the Zuri&I4G Training program in the **Frontend** stack, the next plan was to build new awesome projects and learn more about React. In the beginning, I was interested in many projects and my focus was divided. The result was that none of the projects was completed. All I can say is that my discipline was not on par with my goals then so I decided to look for a program that will open me up to a more complex project with a real-life experience that includes deadlines and a community and what better program than the HNG Internship. Just as for any intended journey, preparations and a list of what to achieve on that journey need to be made. My goals for the next six weeks of this internship are as follows:
* Reach the stage the highest stage I can without slacking off and making sure I do the required research without giving up halfway.
* Know where I stand if I find myself in a workplace in terms of my skills and how fast I can deliver.
* Leave knowing more about React and how to use it in any project.
* Grow my network and connect with people who reside or school around me.

**For more info, visit:**
[HNG/Zuri internship](https://internship.zuri.team)
[Zuri training](https://training.zuri.team/)
[Zuri Team](https://zuri.team/)

## Helpful tutorial for basics
[Git] (https://www.youtube.com/playlist?list=PLxuUHF3OiqfVlhMh2XaA7gx_NaavKM7C9)
[Figma] (https://www.youtube.com/playlist?list=PLXDU_eVOJTx7QHLShNqIXL1Cgbxj7HlN4)
[HTML] (https://www.youtube.com/watch?v=UB1O30fR-EE&t=20s)
[CSS] (https://www.youtube.com/watch?v=yfoY53QXEnI&t=0s)
[Javascript] (https://www.youtube.com/watch?v=hdI2bqOjy3c&t=30s)
[Nodejs] (https://www.youtube.com/watch?v=fBNz5xF-Kx4&t=0s)
[React] (https://www.youtube.com/watch?v=w7ejDZ8SWv8&t=56s)

## About me
* Slack username- @Etulan
* Stack- *Frontend*
* [My Zuri article] (https://dev.to/etulan/the-zuri-experience-1efh)
* If you are interested in [cars] (https://cars.ng/)
Zuri Docs #1
Published: 2021-08-16 16:56:53

Hello Guys, my name is Emmanuel. A Tech enthusiast on track to become a full stack developer. Currently, I have good knowledge of Django, HTML and CSS. I recently joined the Https://Zuri.team x HNGi8 internship. 
 The internship duration is 8 weeks and during this period, I intend to better my development skills, to gain experience by carrying out given tasks. The internship will help me connect with other developers in the workspace as team collaboration is a necessary skill in web development. Here are links to some tutorial videos i feel with be helpful for Tech newbies:
FIGMA: youtu.be/4W4LvJnNegA
GIT: youtu.be/3fUbBnN_H2c
HTML: youtu.be/UB1O30fR-EE
PYTHON:https://m.youtube.com/watch?v=_pE-jTcLXgY&list=PLxuUHF3OiqfWAITD4gPUHZ1GcYRqmyF7P&index=1
My Goals for HNGi8 Internship Program 
Published: 2021-08-16 16:56:17

My name is Goodnews Samuel and I am a backend developer(Python). I am super super excited to be a part of this year’s HNG internship program. 

For a Computer Science student and a tech enthusiast in Nigeria who do not get as much opportunity as required to practice what I am being taught in school, I was super glad when I saw the Zuri Training Program @ https://training.zuri.team opportunity. 

At the Zuri training program, I started to learn a new programming language, worked on a number of tasks, got to experience some awesome minds(our mentors) and I also made amazing friends.
The experience at the Zuri training program stirred in me more passion for tech.

And it was with this passion now, I jumped on this opportunity given to me and the other 10,000+ interns for this internship program organized by HNG; a program not entirely targeted at beginners but open to everyone to task their minds and test their ability to work under pressure.

I have outlined my goals and what I want to achieve by the end of the 8weeks of this internship.
1. To improve on my software development skills and master it well as I get the opportunity to work on tasks.
2. To improve on my tech problem solving ability.
3. To have an awesome team work ability, cause I understand this internship give us opportunities later to work in groups/teams to deliver on tasks
4. To connect with as many awesome software developers as my mind can contain
5. To understand more what really happens in the tech industry and what is expected of me as a backend developer.
Conclusion:
It’s been awesome already. I’m working on my first task now and I can sense the ride is going to be a beautiful one and I look forward to posting myself wearing the most celebrated HNG tshirt and writing an article of how I came to HNGi8 internship and conquered.


Below are links to some beginner tutorial  that would help you, if you are new in the tech world.

Figma link: https://youtu.be/FTFaQWZBqQ8
Git link: https://youtu.be/8JJ101D3knE
Html link: https://youtu.be/qz0aGYrrlhUhttps:/
Python link: https://youtu.be/kqtD5dpn9C8
go link: https://youtu.be/YS4e4q9oBaU
PHP link: https://youtu.be/YS4e4q9oBaU


Thank you.♥️
Type Dot (.) to open any Github repo on VSCode in your browser.
Tags: github, vscode, programming, productivity
Published: 2021-08-16 16:56:05

Type Dot(.) on any github repository, it will open that repo in vscode on your browser.


I will release the video soon, Be sure to subscribe my channel to get notified.


[Arjun Codes](https://youtube.com/arjuncodes?sub_confirmation=1)
#100daysofcode [Day - 06 ]
Tags: javascript, beginners, programming, webdev
Published: 2021-08-16 16:47:27

#100daysofcode [Day - 06 ]

Hello everyone, Today I'd create a Simple Bank calculation Page using Tailwind CSS & JavaScript DOM. You can deposit, withdraw and check the balance after login. I'm a beginner at JS and just learning JS DOM. and by this simple knowledge, I have made this bank calculation page and the next day I will post my Weekly Project. 

Live Preview: https://100daysofcode-day06-alsiam.netlify.app

Code Link: https://github.com/alsiamworld/100-days-of-code/tree/main/day-06
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1b5coy9i1ow6d9bwil4w.png)
#javascript #programming #beginner
Open edX Installation Guide
Tags: elearning, django, edtech, python
Published: 2021-08-16 16:46:04

By finishing this article you'll install your own production-ready learning management system.

![lms](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn2si5jtz9dsfatwtj13.gif)
 

## What is open edX?

open edX is an open source alternative to proprietary software such as Blackboard or Udemy. It provides a flexible and scalable learning platform that can be applied in schools, colleges, and universities all around the world. Open edX is being used by 55 million students, all around the world

This article will show you how to install Open edx on your Ubuntu server and start building courses. 

You can find more information about open edX [on their official website.](https://open.edx.org)

## What you are going to learn ?

Today I am going to be showing you how to install production ready open edx on your Ubuntu server and start building courses.

I'll show you what is needed for the installation, how to install it, and how your server will look once it's finished.

## Requirements
- Ubuntu 20.04 amd64
- Minimum 8GB of memory
- At least one 2.00GHz CPU
- Minimum 50GB recommended for production servers

## Installation Steps
First make sure you have SSH access to the server and then SSH to the server.
### Install wget if it's not installed already

```bash
sudo apt-get install wget
```

### Install open edx
```bash
wget https://gist.githubusercontent.com/cubiteDevops/521cbca51ef8fa778418bdeddbd14c8c/raw/1f96b6f754bd6ec80f7639fbd9dcbcd0b8441653/openedx-installer.sh -O - | sudo bash
```
The above command downloads and run following script

{% gist https://gist.github.com/cubiteDevops/521cbca51ef8fa778418bdeddbd14c8c %}

This script:
- updates and upgrades the Ubuntu packages
- Prepare ansible environment in your server to install open edx
- Create strong passwords for open edx services
- Installs open edx
- Install our theme for open edx

### How should it look like
After successful installation your open edx instance should like our demo site [here](https://lms.demo.cubite.io) 


## What is next
We are writing another article to teach you how to generate SSL certs for your instance, set Domain names and create admin users.
Check this tweet to see how we improved open edx default UI by using Nextjs and Strapi
{% twitter 1415726957786972161 %}


If you need any help contact us at hello@cubite.io
Using Nvidia drivers within a Docker container for Video
Tags: nvidia, docker, ffmpeg, nvenc
Published: 2021-08-16 16:45:18

---
title: Using Nvidia drivers within a Docker container for Video
published: true
description: This post will save you hours of your life.
tags: nvidia, docker, ffmpeg, nvenc
---

Here's a hint:

```
NVIDIA_DRIVER_CAPABILITIES=all
```

is the same as:

```
NVIDIA_DRIVER_CAPABILITIES=utility,compute
```

for video encoding/decoding, you need:

```
NVIDIA_DRIVER_CAPABILTITIES=video,utility,compute
```

`video` is not included in `all`. 🤦‍♂️
Update Berita Bola di CakapBola.
Tags: prediksi, informasi, sepakbola
Published: 2021-08-16 16:43:33

Sejarah olahraga sepakbola  di mulai sejak abad  ke-2 dan ke-3 sebelum masehi di Tiongkok (Dinasti Han). Diawali dengan masyarakat menggiring bola untuk kemudian dimasukan kedalam jaring kecil.
Sejak saat itu sepakbola terus berkembang dan berinovasi sampai menggunakan teknologi Digital sebagai alat bantu wasit dalam membuat keputusan.
Sepakbola juga merupakan olahraga yang sangat bernilai secara ekonomi, karena sangat popular banyak keuntungan yang bisa didapat oleh pemain, klub, maupun lembaga yang menaungi pergelaran liga atau kejuaraan sepakbola.
Setiap tahun nya, Miliaran Dolar dibayar oleh stasiun tv untuk membeli hak siar pertandingan sepakbola Eropa, belum lagi kucuran dana jutaa Dolar dari sponsor. Dan juga gaji pemain yang semakin gila-gilaan. Maka wajar saja jika disebutkan kalau sepakbola adalah olahraga yang paling menguntungkan di dunia.
Banyak sekali pemain bola yang berasal dari daerah miskin kemudian hidup nya berubah 180 derajat karena sepakbola. Contohnya adalah Cristiano Ronaldo, seorang bocah kurus miskin dari Portugal yang menjadi salah satu pemain sepakbola dengan gaji tertinggi di dunia.
Sepakbola adalah olahraga paling popular di dunia. Hampir semua pria pernah bermain sepakbola baik dimasa kecil atau dewasa. Olahraga asal Inggris ini memang sangat digemari di seluruh dunia.
Klub-klub sepakbola seperti Real Madrid, Barcelona, Manchester United, Chelsea, Juventus, AC Milan, Inter Milan, Bayern Munich adalah brand-brand yang bernilai tinggi secara prestasi dan financial. Dan mungkin saja anda adalah penggemar dari salah satu klub yang kami sebutkan tadi.
Seringkali kita ingin mengetahui bagaimana perkembangan dari klub yang kita dukung, ingin berdiskusi dan saling bertukar pandangan tapi tidak tahu harus bagaimana.. 
Untuk memberikan wadah bagi para penggemar sepakbola, maka cakapbola dibangun. Situs untuk berdiskusi mengenai olahraga khusus nya sepakbola di seluruh Indonesia. Juga turut memberikan informasi terupdate tentang sepakbola dunia, mengenai, hasil pertandingan, scorer, prediksi, dan transfer pemain saat jeda kompetisi. Didalam topic berita anda juga dapat memberikan komentar & pandangan mengenai berita tersebut.
Informasi yang kita sajikan akan menambah wawasan anda tentang perkembangan sepakbola dunia terkini, sehingga anda akan terus ter update.

source : https://www.cakapbola.com/
HnG Internship 8.0 (2021)
Published: 2021-08-16 16:41:29

## My journey begins
I didn't plan on enrolling for this cohort of interns in HnG 8.0 currently being run by https://zuri.team/ and till now I still don't know why I did. Something just kept coming at me that what is the worst that can happen ?
I basically just enrolled with the mindset that maybe I'll eventually be spurred to build something with the challenges I get from the program. That is what I hope to get during my stay in the program. I would also like to meet interesting minds and network, but I am not sure I know how to go about that so I'm just not going to include it.
We are expected to have an idea of the track we are currently enrolled in. A few tutorials I find helpful are the ones done by Mosh. Here is a link to his tutorials(https://www.youtube.com/channel/UCWv7vMbMWH4-V0ZXdmDpPBA), he pretty much has awesome contents that a 'beginner' could pick up and get up to speed.

Mosh has a cool Git tutorial : https://youtu.be/8JJ101D3knE

For HTML: https://youtu.be/qz0aGYrrlhU

If you don't like Mosh you could check out other guys on youtube like "netninja" and the likes.

The zuri team also has a couple of nice beginner friendly videos on their youtube page that they have made available for us at [https://www.youtube.com/c/TheZuriTeam/playlists]. Feel free to check em out.
I look forward to the higher stages of the internship if I do get there.
See you in a few.
Creating an accessible autocomplete
Published: 2021-07-29 02:29:08

---
title: Creating an accessible autocomplete
published: true
description: This post describes the aria attributes needed to create an accessible autocomplete.
tags: 
//cover_image: https://direct_url_to_image.jpg
---

I am a blind web developer who happens to work for a great company that tests websites for accessibility called Accessible 360. I thought I would attempt to write a helpful post on making your autocomplete controls accessible.
Let's get started:
1. Ensure the correct aria is present on your input and results list. These include:
1. Most important, aria-activedescendent property When an item is selected with the arrow keys, the ID of that list item should be set in the aria-activedescendent property. So this property should change with each new selection that is made as the user arrows through the suggestions.
2. aria-expanded: set this attribute to true when list items are shown.

3. aria-controls: set to the ID of the ul that contains the results. 
5. aria-haspopup=listbox and aria-autocomplete=list on the input control.

6. The ul containing the results must be set to a role of listbox. IN addition, each li within the ul must have a role of option and an ID to match to aria-activedescentent property of the input.
Optionally, an aria-describedby attribute should be present on the input pointing to the id of a div/span with instructions, such as start typing and arrow down to see results, etc.
I hope this article helps someone. I made a code sandbox with a simple accessible autocomplete in react that can be found at 
https://codesandbox.io/s/objective-chatelet-ikr7k?file=/src/App.js
Cambiar la forma de importar un archivo en React
Tags: react, javascript, spanish
Published: 2021-08-16 16:40:56

Por lo regular cuando queremos importar un archivo dentro de nuestro componente hacemos esto `import context from '../../context/ProjectContext'` pero este tipo de importación puede llegar a generar confusión. Para solucionar esto debemos crear en la raiz de nuestro proyecto el archivo `jsconfig.json` y dentro de este archivo escribir el siguiente codigo

```{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src"]
}

A partir de esto ya podras hacer la importación de esta forma `import context from 'context/ProjectContext'`
My Goals for KodeCamp 2021 Internship Program 
Published: 2021-08-16 16:34:56

Before I state my goal and things I will like to achieve from the KodeCamp 2021 internship program, you should get to know me.

About me


My name is Halima Sadiya Abubakar a BSC DEGREE HOLDER IN ACCOUNTING and also have my ICAN in-view. I recently thought about switching careers to software programming and I decided to specialize in frontend development. Before diving into it at the time, I did some quick research on what you actually need to learn to become a developer. The answer I got was pretty much learn HTML CSS and JAVASCRIPT and that is what I started with.

My Goal

What I will like to achieve by the end of the 16 weeks program

1- Improve my HTML CSS and JAVASCRIPT

2- Get better in basically everything that has to do with Frontend development and more!!!

3- Learn problem solving

4- Improve my skills and speed

5- Learn Collaboration and team spirit

6- Become a badass Frontend developer

7- And of-course land a good paying remote job

If you managed to read through and reached the end of this article… Well done!!!👍 I am glad you got here. I don’t mind getting questions in the comment box below. I will be happy to answer… So happy learning! You can do it .🤗

#Kodecamp
My Goals for HNG (8) Internship
Published: 2021-08-16 16:23:12

My name is Martha Onuh, a young graduate of computer Science from the Benue State University, Makurdi and I am a frontend developer.
Fortunately, as I love to put it, I got accepted into the HNG (8) internship from the [Zuri Team](https://zuri.team) for the Frontend development track. I must say that I am very excited to be part of these internship and I have some goals and expectations for the internship which  I intend to share in these article.

For this internship, my major goal is to improve on my existing skills. I consider this a great opportunity for me to improve on my skills as this is my greatest expectation in this program. I already have existing knowledge in HTML, CSS, JavaScript, React, Bootstrap, Git and Github. I see this program as a great place for me to improve on this skills. I also hope to achieve the following at the end of this program which will last for a period of six weeks.
 
It is my goal to be among the finalist for this internship. I have heard so much about how people drop out along the way but I am determined to get to the last stage of these program and be among the finalist.
Also, I would like to meet new people and expand my network, I really hope I can get to achieve this because I am not so much of the social type and as such I have very little friends and network, so I hope that with the help of this program I can get to meet new people and expand my network.

I have also included a link to some of my favorite beginner tutorials;
1. [Introduction to designing with Figma](https://trydesignlab.com/figma-101-course/introduction-to-figma/)
2. [Introduction to Git](https://www.freecodecamp.org/news/what-is-git-and-how-to-use-it-c341b049ae61/)
3. [Introduction to HTML](https://www.geeksforgeeks.org/html-introduction/)
4. [Introduction to JavaScript](https://careerfoundry.com/en/tutorials/web-development-for-beginners/an-introduction-to-javascript/)

Thanks for reading😊.