teleren/devto huggingface dataset:
COVID-19 "Handy Virtual Class (HVC)"
Tags: twiliohackathon
Published: 2020-04-03 12:01:52


<h2><b>COVID-19 Communications</b></h2>
<h4>What I want to build</h4>
I will be building a web virtual classroom that allows students and teachers to schedule and have classes. The teacher sets up the classroom and invites all students to join which will be a video session.

<h5><b>Demo Link</b></h5>
https://handy-vc.herokuapp.com/

<h5><b>Link to Code</b></h5>
https://github.com/clemsedem/handy-virtual-classrom

<h5>How I built it (what's the stack? did I run into issues or discover something new along the way?)</h5>
<b>Tech Stack</b>
Twilio
Django
Materializecss
GitHub
jQuery


<h5><b>Additional Resources/Info</b></h5>
COVID-19 is a pandemic that has affected every aspect of live across the globe. 
This has affected teaching and learning especially in developing countries like mine; Ghana. Free availability of an online platform to foster teaching and learning is key.

<b>Hackathon Home Page</b>
https://dev.to/devteam/announcing-the-twilio-hackathon-on-dev-2lh8
Daily Developer Jokes - Friday, Apr 3, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-04-03 12:00:05

---
title: "Daily Developer Jokes - Friday, Apr 3, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Friday%2C%20Apr%203%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259316ab83.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*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 are the three hardest problems in computer science?

___A:___ Naming things and off-by-one errors
 -->
30-Day LeetCoding Challenge: Single Number
Tags: python, leetcode, coding, algorithms
Published: 2020-04-03 11:37:32

---
title: 30-Day LeetCoding Challenge: Single Number
published: true
description: First-day problem of 30-Day LeetCoding Challenge
tags: python,leetcode,coding,algorithms
---
##### [The Problem](https://leetcode.com/explore/challenge/card/30-day-leetcoding-challenge/528/week-1/3283/)

*******

#### Solution using [bit manipulation](https://www.interviewbit.com/courses/programming/topics/bit-manipulation/):

This problem asks you to find the single (unique) number that exists in a list within a linear time which means **O(n)** with another optional requirement which is without extra memory means space complexity **O(1)**.

We could solve it using hash-map in **O(n)** it will be good no issue, but I want to get from the first time with no extra memory this is when it came to my mind the bit manipulation idea and couldn't find better than the **XOR** operation and why is that? because if we revisit the truth table of the XOR:

| A  | B  | Q  |
| -- | -- | -- |
| 0  | 0  | 0  |
| 0  | 1  | 1  |
| 1  | 0  | 1  |
| 1  | 1  | 0  |

So you can see when you take an XOR with any bit gives **0** but when you take the XOR for two different bits it gives you **1**, and here is the trick we can use the XOR to XOR all our numbers in the list and when we are done it will return only the single number that does not rebating in the list.

**Example:**

`nums = [[2,2,1]]`

so if we do XOR:
`ans = 2 ^ 2 ^ 1 = 0 ^ 1 = 1`

As you can see that is how we made use of the **XOR ^** operation.


**Pseudocode:**
```
1. ans <- 0 # starting from 0 as (0 ^ X) will give us X.
2. for each num in nums:
3.    ans ^= num
4. return ans
```

**Complexity:**

* Time:
  * As you can see we only do one for loop through the whole numbers list so it is linear so it is **O(n)** where **n** is the size of our numbers list.

* Space:
  * We didn't use any extra space beside our **ans** variable which is **O(1)** so our overall complexity will be **O(1)**.


* **[Solution in Python](https://github.com/AhmedRaafat14/Leetcode-problems/blob/master/30-Day-LeetCoding-Challenge/single-number/Solution.py)**

I hope this helps any feedback will be appreciated :).

{% github  AhmedRaafat14/Leetcode-problems  %}
TensorFlow JS - Show and Tell
Tags: javascript
Published: 2020-04-03 11:35:42

Hosting TFUG Mysore first meetup : TensorFlow JS - Show and Tell by Jason Mayes  - Senior Developer Advocate at Google. 8 presenters showing what they have #MadeWithTFJS with epic demos lined up + more. RSVP now

http://meetu.ps/e/HTwBV/jYwqF/a
What is the caching convention for Rails API app?
Tags: rails, api, caching, json
Published: 2020-04-03 11:19:02

---
title: What is the caching convention for Rails API app?
published: true
description: Hopefully a discussion about caching in Rails
tags: rails, api, caching, json
---
I feel that there is no clear convention on caching JSON endpoints in Rails. JBuilder cache is not even mentioned on Rails Caching guide(https://guides.rubyonrails.org/caching_with_rails.html). JBuilder docs suggest a third party gem for caching collections. Quite a few guides that mention caching and rails ends up with advertising a new gem that the author wrote. Am I missing something? What is your caching strategy for JSON endpoints in Rails?
Optimize useEffect by using a condition as a dependency
Tags: react, javascript, webdev, functional
Published: 2020-04-03 11:14:10

---
title: Optimize useEffect by using a condition as a dependency
published: true
description: A micro-optimization of React hooks dependency array you may want to do.
tags: react, javascript, webdev, functional
---

The `useEffect` hook is a great way to wrap side effects since the release of React 16.8. To quickly recap, this hook allows you to create functional components with behaviour akin to React classes' `componentDidMount` and `componentDidUpdate`.

But because of the way functional components work, this would mean performing a side effect on each render. This behaviour is suboptimal; hence dependency array was introduced. This array passed as the second argument of a `useEffect` call allows React to perform only when a reference passed in the dependency array changes.

While this is great in many cases when you need to perform a specific task when one of the dependencies changes, there are times when the reference update in itself does not mean the task in hand is needed. These are the cases when you add a condition to the function passed as the first argument. For example, when you want to update the state when a query is running. You want to run the effect when the query is running, but you do not need to run it when the state is already set to the correct value.

```javascript
const { loading } = useQuery(query, { /*... */ })
const [state, setState] = useState('initial');

useEffect(() => {
  if (loading && state !== 'loading') setState('loading')
})
```

You cannot conditionally call `useEffect` or any other hook for that matter. In these cases, you add the condition in the function performing the side effect itself, while the variables checked in the condition go into the dependency array.

```javascript
useEffect(() => {
  if (loading && state !== 'loading') setState('loading')
}, [loading, state])
```

Now to optimize even further, you need to think about what React is doing in the background. When you call `useEffect`, React checks your dependencies one-by-one. It has to, to be sure that your side effect takes place when *any* of the dependencies change. After this, your function runs and evaluates the condition it needs to. If it turns out that it needs to perform what it has to it's excellent, no time wasted. On the other hand, when it turns out, it does not have to perform anything, all React's work was in vain.

In the latter scenario, you can consider passing the condition evaluated right away. This way React only needs to check the one value in your dependencies, a `boolean`, and you already have the value ready for your function to decide whether it should perform or not.

```javascript
const shouldSetStateToLoading = loading && state !== 'loading'
useEffect(() => {
  if (shouldSetStateToLoading) setState('loading')
}, [shouldSetStateToLoading])
```

The only caveat is that the condition itself needs to be cheaper then what React does. The odds are that it is.

You can check out the fiddle benchmark below:
https://jsfiddle.net/rangeoshun/j5a7qpbL/
Inspiration and Playing the Infinite Game
Tags: codenewbie, womenintech, javascript, devjournal
Published: 2020-04-03 11:08:46

Hi friends! Wow, it's crazy how inspiration can leave for a bit to take a break and then come back tenfold after you just give it a little bit of rest!

Here's where I'm at: I've finally launched my own landing page for my [Letters from Nelson](https://lettersfromnelson.com/) newsletter (I'd just thrown it up before using the landing page builder from Mailchimp with the intention of coding my own in the near future).

So after a couple of days and a few false-starts with design (you know - where you code something up, and there's just something about it that looks super *off*), I'm proud to share it [here >>](https://alexlsalt.github.io/letters-from-nelson/)

Over the past month, I've sent out four newsletters. I did a ton of nannying in previous years, and I *loved* finding super fun and unique activities for the kids I took care of - so this is definitely an extension of that in hopes of helping parents out with fun ideas for their kids during this strange time in our world.

Aside from that, I have a couple of 'life admin' items to take care of today - including hooking up a custom domain to my LFN site. I might have a weekend project of reconstructing the code from a website I saw and liked the design of. Also looking into a cool hackathon and seeing how I can get involved!

I also just started a new morning read - The Infinite Game by Simon Sinek. I'll leave you with this special nugget from the book:



_As for us, those who choose to embrace an infinite mindset, our journey is one that will lead us to feel inspired every morning, safe when we are at work and fulfilled at the end of each day. And when it is our time to leave the game, we will look back at our lives and our careers and say 'I lived a life worth living.' And more important, when imagining what the future holds, we will see how many people we've inspired to carry on the journey without us._

***

_This post was originally published on April 3, 2020 on [my blog](https://alexlsalt.github.io/blog)._
Articles that made my Week #008 & #009 - 😢
Tags: career, watercooler, todayilearned
Published: 2020-04-03 11:00:02

Hey! Getting into the week I hadn't published my weekly blog post on time and felt really sad about it.  I hate that I haven't been consistent enough with these mini updates. I don't feel like I'm the most motivated at the moment.. but really who is?

Something nice happened though! 

{% twitter 1243251471015129088 %}

Last week was err tough too! A lot of my time went into getting this article about my career up. Loving writing it. Definitely different.

{% link https://dev.to/malgamves/devrel-to-me-1l62 %}


So jumping right into it. I'm happy that I have been reading content I should be. As a conference and developer event organizer I'm really getting into running events online seeing as offline isn't possible at the moment. I love a good hackathon and this article by [Arkodyuti](https://dev.to/arkodyutisaha) is super informative for anyone in the developer events space.

{% link https://dev.to/arkodyutisaha/how-to-host-successful-online-hackathons-4ocg %}

This is a little cheeky but I really liked reading the articles I wrote. I didn't write up my mini update because I was busy writing articles, coping and healing. So sharing these was really nice, and hearing that people loved reading them was even better. So if you want it. Last weeks article is here.

{% link https://dev.to/malgamves/articles-that-made-my-week-007-sorta-2baa %}

The folks at [Orbit](https://dev.to/orbit) are great!! Their newsletter is always fun and engaging. This particular release though mentioned a tool I love - [auxparty](https://auxparty.com). It's one of the only thinks keeping sane right now and they shared how you can add the audio from an auxparty to a Zoom call and I'm here for it. There's a lot more though, check it out.

{% link https://dev.to/orbit/the-observatory-3-hot-takes-and-cool-tools-for-building-community-remotely-2917 %}

Networking in Docker can be nightmare, I'm working on some Docker content and I'm trying to get as much information as I can before putting anything out. Check out [Maxim](https://dev.to/maximization) (who has the coolest username btw) and his article to get you past those networking blues. 

{% link https://dev.to/maximization/4-reasons-why-your-docker-containers-can-t-talk-to-each-other-19bn %}

I'm slowly getting back into my rhythm so I'm happy about that. How was your week?
What I learned from interviewing Miguel Grinberg, author of the Flask Mega Tutorial
Tags: career, productivity, motivation, python
Published: 2020-04-03 10:17:56

I recently interviewed Miguel Grinberg for the Distinguished Devs podcast. 

If you’ve ever done any web development work with Python, you’ve almost certainly come across Miguel Grinberg - his [successful blog](https://blog.miguelgrinberg.com/) being one of the most useful resources on Flask, Python and many other areas. He has literally written the book on Flask Web Development published by O'Reilly, and is the author of the Flask Mega tutorial. 

He is also the creator and maintainer of a large number of popular open source projects, including [python-socketio](https://github.com/miguelgrinberg/python-socketio), [Flask-SocketIO](https://github.com/miguelgrinberg/Flask-SocketIO), [FlaskHTTPAuth](https://github.com/miguelgrinberg/Flask-HTTPAuth) and many more.

{% soundcloud https://soundcloud.com/distinguished-devs/4-miguel-grinberg %}

You can listen to the full podcast here, but I'll summarise/paraphrase some of my favourite parts below.

## On knowledge sharing
Miguel notes that sharing knowledge, in the form of blog posts, open source software, or books, has been the most important thing in his career. Though you might do it to help others, the rewards it gives you personally are immense.

Miguel says that initially, the motivation to blog and share has to come from yourself; his first tweet about the Flask Mega Tutorial only received one like, and the series did not receive much engagement for a long time before it gained traction.

## On learning
Miguel says that the best way to learn anything is to pick a project or goal and use your new skill to work towards it. Without this goal, it's hard to find the motivation to learn effectively.

The Distinguished Devs podcast is available on iTunes, Spotify etc.
I hope you enjoy this episode, please let me know what you think!

Don't forget to hit follow if you're interested in more of the series!
Why did you Decide to Learn Programming? 
Tags: discuss, webdev, beginners, codenewbie
Published: 2020-04-03 09:21:21

Take a break from scrolling down and motivate the newcomers. Why are you learning to code? are you looking for a better job? or you just like solving complex problems? or you are trying to start your own business? or you have fun just by writing code?

 **Comment down below :)** 

Here are my reasons for learning to code.

1- The dynamic process and how we think as programmers is just innovative.
2- The career opportunities are great.
3- Learning other great skills as you go on your journey as a programmer is really beneficial like analyzing, patience, determination, and sympathy for helping others.
React JS Online training
Tags: react
Published: 2020-04-03 10:11:26

Visualpath is offering Job oriented React JS Online Training by certified professionals in Hyderabad. Join this course to learn react js from basics to advanced level with real time examples and project scenarios. Contact us @ +919989971070 to schedule your free demo.
 	
https://www.visualpath.in/ReactJs-Training-in-Hyderabad.html
Need advice on what to learn in 2020
Tags: beginners, career
Published: 2020-04-03 09:33:30

Hello, I'm  an aspiring software developer, whose been confused for a while about what to learn, i am looking to change career's and make some money o support myself, honestly my main interests are gamedev, animation, etc, but its hard to make an income doing those things where i live, and its hard to pursue your passions when you are not in a good place mentally, so please i need some advice on what to learn in 2020 that gives me a chance to begin to earn a reasonable income, I'll rather work remotely or startup something, but i don't mind paid employment either.
Thanks.
Quick tip: Clone a single folder from Github
Tags: github, git, tutorial
Published: 2020-04-03 09:31:04

Sometimes you find a repository on Github and you only really need a single folder. 

How do you get it without cloning the entire repo? 

Luckily Github [just implemented](https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/) `sparse-checkout`. This is a super-quick example of how it works.

## Example repo 

Let's say I wanted to clone Supabase's [example Slack clone](https://github.com/supabase/supabase/blob/master/examples/slack-clone-basic/README.md), which lives in the following folder: 

```bash
├── connectors
├── examples
│   ├── slack-clone-basic # <-- github.com/supabase/supabase/examples/slack-clone-basic
├── libraries
├── web
└── README.md
```

## Sparse Checkout 

Here are all the steps I would need:

```bash
# 1. Copy an empty repo
git clone --no-checkout https://github.com/supabase/supabase

# 2. Move into the empty repo
cd supabase

# 3. Initialize sparse-checkout
git sparse-checkout init --cone

#4. Checkout the folder
git sparse-checkout set examples/slack-clone-basic
```

And viola! Now you have just the folder you want.


## Troubleshooting

`sparse-checkout` was introduced in Git version 2.25. If you get see an error "git: 'sparse-checkout' is not a git command" then you probably need to update. You can use `git --version` to see what version you're on.

If you're on Mac (and used homebrew to install git) you can run `brew upgrade git`.
Frontend Mentor Social Media Dashboard Challenge(HTML, CSS)
Tags: beginners, webdev, css, html
Published: 2020-04-03 09:19:27

I've been working on developerHabits - a Youtube channel for developers interested in growth mindset and tech tutorials - for about a month now.

For the past week, I've been recording solving Frontend Mentor(https://www.frontendmentor.io/) challenges. You get to see how I complete the whole challenge in one video.

{%youtube zfXb3CNBHMQ %}

This clip is about solving the Social Media Dashboard challenge.
🔴 Final solution: https://www.frontendmentor.io/solutions/social-media-dashboard-with-theme-switcher-NEqgMjOej

Also, follow me in
👉 Dev.to: https://dev.to/kethmars
👉 IG: https://www.instagram.com/developerhabits
Angular and Django integration into one project
Tags: django, angular, python, integration
Published: 2020-04-03 09:14:51

## For those times, when you ought to do things which you don't want to do.

Requirements: Django > 1.8, Angular 8, 9 or above. I've done this Angular 9.

Let's jump directly into a pool, I'm guessing, you already have a basic Django setup, which is:
```
- Vritualenv setup
- Django project
- Static files and template files setup
```
Start by installing angular cli into your local.
```
npm install -g @angular/cli
```
if you are on windows', please set the path of the ng command. Otherwise, you can use `npm run ng <your ng command>` for the rest of the article.

1. In Django, create a Landing view and URL pointing to that view. And render a template which you're going to use for Angular. Let's say `angular_index.html` which is residing into Django templates dir.
2. Now, from command-line, create a new angular project names `frontend` into a Django static directory. `ng new frontend`
3. Now your Angular apps` basic structure is done, for testing, run `ng build`. This will compile your code and produce some files into `dist` directory which will be created into a `frontend (your angular app)` directory.
4. Now go into `angular_index.html` and include these compiled files `runtime-es2015.js`, `polyfills.js`, `styles-es2015.js`, `vendor-es2015.js`, `main-es2015.js` into Django template js block.

{% gist https://gist.github.com/abheist/5f4b742030b06d47f09605c97d211d97 %}

And now you're almost done, just add 
```
    <body>
        <app-root></app-root>
    </body>
```
into `angular_index.html` and run your python server by 

```
python manage.py runserver
```

Goto your defined URL for your angular app and you'll be seeing the app.
Up until now, everything is working fine, but the problem is every time you do some code change, you have run ng build to compile the angular code and then see the changes reflect in the browser.

So you might be thinking, why not use `ng serve`, yes `ng serve` is a great option. But the sad part is, it does not provide us with the compiled files. it saves those files in the memory. So we need to use watch option in `ng build` for development purpose.

Run `ng build --watch` into a terminal and it will hot reload your project with every file change. But now, your browser will not show anything. Because at watch state, `ng build --watch` produces different filenames without postfix of es2015. So you need to change those files names in the `angular_index.html` and include the following files.

{% gist https://gist.github.com/abheist/bd7fb5199b57d7d80af54166ecd8ad46 %}

For better configuration, you can get the environment from `settings.py` and with the help of if condition, you can set the files according to the environment.
Just in case, if you add support for IE, there will extra file which will generate. You need to add that file to render everything perfectly.

🙏 - Abhishek Kumar Singh
Starting Off Slowly in April
Tags: codenewbie, womenintech, devjournal
Published: 2020-04-03 09:07:33

Hello! It's about 20 minutes after 6pm and this may be my latest-in-the-day blog post yet, but I'm happy to have shown up!

Today's been a much slower day, and it's really felt good! Last night, I'm proud to have sent off my finished application to give a talk at this year's virtual CodeLand Conference! I've never submitted a proposal for a conference CFP, and I can gladly say that I've crossed that one off my coding-journey bucketlist.

Regardless of the outcome, I'm happy to have put my foot forward, and I'm confident I'll give a talk about coding at some point in the next few months, whatever that may look like!

I think I'm going to continue taking it easy for the rest of the day and tie up any current loose ends with my projects going on right now. I haven't worked too much lately on my Letters from Nelson app, so I might settle in to that and then push out a working app to start sending visitors to (instead of the thrown-together landing page à la Mailchimp!)

Here's to the start of April and two months already of consistent blogging - yee!

_This post was originally published on April 1, 2020 on [my blog](https://alexlsalt.github.io/blog)._