teleren/devto huggingface dataset:
Building my Movie CLI App
Published: 2021-02-07 03:19:51

##First project down!

It's that time, the time to close all of my tabs I mean. I've submitted a final draft of my command line interface application that takes movie data from the [OMDb API](http://www.omdbapi.com) and outputs it to a user. Out of all the projects I've done in the past, this one stuck out to me as it's the first thing I've built that interacts with the internet. 

###So, what does it do?
On startup, the user is prompted to enter a movie title or view their bookmarks. When a movie is entered by the user, they'll receive the title, release year, director, actors, and information about the plot.

From here, a user can choose to get the ratings for that movie, add it to their bookmarks, or not add it and go back to the state in the program where they can look up movies or view all of their bookmarked movies. 

If the user chooses to view the movie ratings, a list of sources (Rotten Tomatoes, IMDb, Metacritic) as well as their associated ratings will be shown. The user will remain in this state of the program until they decide to add the current movie to their bookmarks or not.

###Why make an app about movies?
I love movies! And I thought about how streaming services don't really show a Rotten Tomatoes score on their own interfaces. The premise of the app is to allow a user to not only get information about a movie, but also see their ratings in one place (no matter the streaming service that is being used). A user could even create a list of movies using their bookmarks and then compare the ratings to decide what to watch next.

###Any takeaways after completing the project?
One positive was that I started planning before I started coding. I drew a rough flow diagram for how I imagined the program would go. I also did a good job of debugging along the way rather than coding several pieces of the program at once.

Although I had an idea of what I wanted to accomplish, I do wish that I had tried to look ahead for potential bugs/any edge cases. For example, I realized after the fact that I could bookmark a movie multiple times. If I had looked ahead at the beginning, I could have coded for that initially. Also, I need to do a better job of committing my changes more often.

One project down; on to the next one!
How to use Basic authentication with curl?
Tags: security, webdev, testing, tutorial
Published: 2021-02-06 22:53:25

# About Basic Auth
In [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication), a HTTP request contains a header `Authorization: Basic <credentials>`, where credentials is the Base64 encoding of username and password joined by a single colon `:`.

Basic Auth is considered as not safe enough, but we still use it a lot for some less sensitive stuff because it is easy to set up.


# Basic Auth with curl
You can use Basic Http Auth with curl in following two ways:

### Option 1: Pass credentials to curl
Passing Basic credentials to curl command is easy as this:
```curl -u username:password https://example.com```
If your username or password contains a special character, such as white-space, then you might want to surround credentials with single quotes:
```curl -u 'username:password' https://example.com```

### Option 2: Pass Authorization header
If you want to have a full control over your HTTP request, you might want to [Base64 encode](https://devpal.co/base64-encode/) your `username:password` and place it into `Authorization` header.
Curl command should look like this:
```curl -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' https://example.com```


# Basic Auth and colon in username
Colon `:` is not allowed to be used in an username according to [Basic Auth specification](https://tools.ietf.org/html/rfc7617). But in case you need to support it (ie your users are allowed to create such username) and you are in charge of client and server, you might want to [URL encode](https://devpal.co/url-encode/) the username and password on both sides.
How to use the github API on your personal site
Published: 2021-02-07 03:09:23

I recently came across the nice Github API that I used to create a list of my repositories on my personal site.

The API is very simple and it doesn't really need to be explained. To get the repositories of a user you would make a request to:
~~~
https://api.github.com/users/<USERNAME>/repos
~~~
And you will get an array of repositories of the specified user which you can use to create a list of your repositories. Here is a simple example:
~~~js
  // Needs to be inside an async function
  const response = await fetch('https://api.github.com/users/<USERNAME>/repos');
  const data = await response.json();
  var result = [];
  if (data.length)
  data.forEach(repo => {
    result.push({
      name: repo.name,
      description: repo.description || '',
      url: repo.html_url,
    })
  });
~~~
That gives you a simplified array of your repos.
Extensiones y Themes VsCode
Tags: vscode, beginners
Published: 2021-02-07 02:11:26

Iniciamos!

Plugins: 

Prettier ESLint - Prettier y ESLint sin conflictos

Rainbow Brackets - Facil identificación de los Brackets

TODO Highlight - Resaltar comentarios con texto "TODO"

Babel JavaScript - Actualización de los estandares javascript

Docker - Listado de contenedores docker

DotENV - Reconocer variables de Entorno

Git Graph - Ver graficamente historial del proyecto en git

GitLens - Ver los comentarios en git de un snippet de codigo del proyecto

Jest - Test Unitarios en segundo plano, mientras escribes el codigo

Live Server - Cambios aplicados en tiempo real a un servidor web temporal

Kite AutoComplete AI Code 

Themes: 

VScode icons 

Material Icon Theme

Lucy

Monokai Pro - De pago

Codey Midnight

1984

Dracula Pro - De pago

Utilidades: 

Discord Presence - Actualización del estado en discord

Polacode - Capturas de pantalla del codigo
Dynamic Containers with CSS and JavaScript
Tags: javascript, css
Published: 2021-02-07 01:45:28

There are endless ways to arrange content and create pixel-perfect designs using CSS and JavaScript. Depending on what you want to achieve aesthetically, you can often create impressive layouts using only CSS, however, there are times when JavaScript is necessary.

I typically rely on a combination of `flex`, `margin`, `padding`, and the CSS `calc` function to determine the width, height, and spacing of each element.

Below is a demonstration I created which uses this approach.

{% codepen https://codepen.io/brandonmweaver/pen/eYBZGRO %}

Something worth pointing out is the use of `vh`; this unit represents the view height percentage of the window. I use `calc(100vh - 90px)` since I want the container to fill the remaining space of the window. I subtract 90 pixel units from 100% of the view height since that is the total height of the other elements including margins and padding. You can use a similar approach to determine the width and height of elements in a container while accounting for margins and padding.
Use Tailwind CSS with React Apps in Nx
Tags: nx, monorepo, react, tailwindcss
Published: 2021-02-07 01:23:06

[Tailwind](https://tailwindcss.com) is a popular utility-based CSS framework that enables developers to rapidly implement and iterate on design. Responsive design and dark mode are easier than ever to implement, and so far I have been very happy with Tailwind and even use it on my site.

## Install Tailwind Dependencies

Nx 11 still uses PostCSS 7, so we have to install Tailwind dependencies in PostCSS 7 compatibility mode.

```
npm install tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

# or

yarn add tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
```

## Initialize Tailwind

```
npx tailwindcss init -p
```

## Purge CSS

Tailwind requires us to specify the files that we should purge the CSS from. Without purging CSS, all of the Tailwind styles are loaded into the application which is quite large. When we purge the CSS, we can remove all the unused styles.

Update `tailwind.config.js`:

```
module.exports = {
  purge: ['./apps/my-app/**/*.{js,ts,jsx,tsx}'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
}

```

Make sure to replace `my-app` with the name of your application. If additional applications are added to your workspace that will use Tailwind then you will need to add another string to the `purge` property accordingly.

## Extend Webpack Config

The default `@nrwl/react` Webpack config does not include the PostCSS loader, so we need to override it.

Create a file called `react-tailwind.webpack.config.js`:

```
const nrwlConfig = require('@nrwl/react/plugins/webpack.js');

module.exports = (config) => {
  nrwlConfig(config);
  return {
    ...config,
    module: {
      rules: [
        ...config.module.rules,
        {
          test: /\.css$|\.scss$|\.sass$|\.less$|\.styl$/,
          use: [
            {
              loader: 'postcss-loader',
            },
          ],
        },
      ],
    },
  };
};

```

Next, update your `workspace.json` and replace the `webpackConfig` for your app:

```
"webpackConfig": "react-tailwind.webpack.config.js"
```

## Import Tailwind Styles

Next, in order to use the Tailwind styles, you must import them in your root component:

```
import 'tailwindcss/tailwind.css';
```

Now you should be able to use Tailwind CSS classes within your Nx React application.
pwsh saved me from unix
Tags: hottakes
Published: 2021-02-07 00:02:08

```
PS /home/max> rm ./DuetSoftwareFramework/
/usr/bin/rm: cannot remove './DuetSoftwareFramework/': Is a directory
PS /home/max> rmdir ./DuetSoftwareFramework/
/usr/bin/rmdir: failed to remove './DuetSoftwareFramework/': Not a directory
```

Thankfully, I have a competent modern shell to save me from this archaic nonsense.

```
PS /home/max> Remove-Item ./DuetSoftwareFramework/
```

`Remove-Item` succeeded where both `rm` and `rmdir` failed.  And for reference, `ri` is an alias for `Remove-Item`.
How to get the focussed element on a webpage using JavaScript?
Tags: javascript
Published: 2021-02-07 00:00:00

---
  title: How to get the focussed element on a webpage using JavaScript?
  published: true
  tags: JavaScript
  date: Sun Feb 07 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/get-the-focussed-element-using-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-1cd26ffc96fe51612f1f5c5a672080cb.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/get-the-focussed-element-using-javascript)
  
To get the focussed element in a webpage using JavaScript, you can use the `activeElement` property in the global `document` object.

For example, Consider you have a lot of anchor tags in your webpage and needed to find out which anchor tag has the current focus. The `document.activeElement` property will return a reference to the current focussed element (not limited to anchor tags).

```js
// Get focussed element in a webpage ✨
const focussedElement = document.activeElement;

console.log(focussedElement);
```

See this example live in [JSBin](https://jsbin.com/jejajeyuna/2/edit?html,js,console,output).

### Feel free to share if you found this useful 😃.

---
Before you automate anything, use a checklist
Tags: automation, devops
Published: 2021-03-03 14:21:32

---
title: Before you automate anything, use a checklist
published: true
date: 2021-02-07 00:00:00 UTC
tags: automation, devops
canonical_url: https://jhall.io/archive/2021/02/07/before-you-automate-anything-use-a-checklist/
---

I’ve been talking about automating things lately, with the goal of reducing human error.

But not everything can be automated. Or at least not yet.

What can you do?

Use a checklist!

In his book [_The Checklist Manifest: How to Get Things Right_](https://amzn.to/2LozlyM), author Atul Gawande talks about the prodigious use of checklists in certain industries, such as commercial aviation, and medicine.

Until AI advances to the point it can do fully autonomous heart surgery, every surgeon follows a meticulous pre-op checklist, to ensure that no detail, no matter how mundane or obvious, is overlooked, potentially leading to a catastrophic outcome.

If a checklist is good enough for your doctor, or the pilot on your last flight, it’s good enough for you.

Next time you notice an error in some process you’re involved with, consider creating a checklist. Don’t let “perfect” automation be the enemy of “good enough” checklists!

Here are just a few examples where I’ve personally seen checklists help ensure against human error, when automation either isn’t possible, or just hasn’t been implemented yet.

- Manual software testing plans
- Pull request approval
- [Definition of Ready](https://www.scrum.org/resources/blog/walking-through-definition-ready) and [Definition of Done](https://www.scrum.org/resources/blog/done-understanding-definition-done)
- Software deployment guides
- Meeting or interview preparation
Azure Functions University - CosmosDB Lesson (.NET Core)
Tags: azure, serverless, programming, dotnet
Published: 2022-03-16 20:06:08

---
title: Azure Functions University - CosmosDB Lesson (.NET Core)
published: true
date: 2021-02-07 00:00:00 UTC
tags: azure, serverless, programming, dotnet
canonical_url: https://blog.marcduiker.nl/2021/02/07/azfuncuni-cosmosdb-lesson-dotnet.html
series: Azure Functions University
---

![CosmosDB Lesson .NET Core](https://blog.marcduiker.nl/assets/2021/02/07/AzureFunctionsUniversity_CosmosDB_Lesson_dotnetcore.png)

Hi serverless friends, we have a new Azure Functions University lesson for you! In this lesson we will learn how to use the CosmosDB trigger & bindings in Azure Functions written in .NET Core 3.1.

<!--more-->
## Lesson

You can find the lesson on GitHub: [CosmosDB Trigger & Bindings (.NET Core)](https://github.com/marcduiker/azure-functions-university/blob/main/lessons/dotnetcore31/cosmosdb/README.md).

And you can watch the video on YouTube:
{% youtube h_vX3LrQ4l4 %}

The lesson consists of the following exercises:

| Nr | Exercise |
| --- | --- |
| 0 | Prerequisites |
| 1 | Setup the Azure Cosmos DB Emulator |
| 2 | Using the Cosmos DB output binding |
| 3 | Using the Cosmos DB input binding |
| 4 | Creating a Cosmos DB Trigger function |
| 5 | Deploying to Azure |
| 6 | Using Azure Key Vault for storing the connection string |
| 7 | Using Dependency Injection pattern for Cosmos DB connection |
| 8 | Homework |
Generate random passwords in Python using secrets
Tags: python, security
Published: 2021-02-06 23:45:15

Read the docs:  <https://docs.python.org/3/library/secrets.html>

I copied this example from python docs and added special characters to the password.

```python
import secrets
import string


alphabet = string.ascii_letters + string.digits + '!@#$%^&*()-+[]'
while True:
    password = ''.join(secrets.choice(alphabet) for i in range(10))
    if (any(c.islower() for c in password)
            and any(c.isupper() for c in password)
            and any(c.isalnum() for c in password)
            and any(not(c.isalnum()) for c in password)
            and any(c.isdigit() for c in password)):
        break
```
Wolfram Mathmatica ML Models Whaaaaat?
Published: 2021-02-06 23:42:40

Did you know you can make machine learning models with Wolfram Mathmatica which is bundled into the full version of RaspberryOS (raspbian)?  Well you can.

To give you some background I have been implementing a security camera system using [imagenode](https://github.com/jeffbass/imagenode), [imagehub](https://github.com/jeffbass/imagehub), and [imagezmq](https://github.com/jeffbass/imagezmq) developed by [Jeff Bass](https://github.com/jeffbass) which in my humble opinion is just awesome.  Jeff has written a very good installation guide so go have a look.  

Once you have the nodes and the hub setup what you get is a detailed activity log on both the nodes and hub that is easy to parse and is rotated daily.  Another feature is that the image folders are rotated daily also. And that's it the Desktop app or Web front end is on you. I chose the web frontend and developed a quick and dirty page using [Svelte](https://svelte.dev) to show the last 25 pics along with some activity stats.

Now this setup does a wonderful job of detecting motion and responding to events.  I have one monitoring my drive way and garage door but what I needed was a way to tell if the garage door was open or closed.  I looked at pre-built models that google offers but found them lacking and would need to be retrained.

So while sifting through the mountains of Machine Learning tutorials out there I decided to take a break.  I have recently started using the RPI 4 as my primary desktop so I decided to take a break and mess with this Wolfram Mathmatica.  I have seen it bundled with the RPI for years but never messed with it.  I noticed their project page and found this [Facial recognition](https://projects.raspberrypi.org/en/projects/c3-wolfram-facial-recognition) how to.  Whaaaaaat is is really that easy.  Just so happens I already had about 500 photos of garage door opened and closed.  So I separated them into different folders and followed the tutorial.  About an hour later it spit out a model that I can put up on imagehub to classify images.  But how to do that?

Wolfram provides [python bindings](https://reference.wolfram.com/language/WolframClientForPython/docpages/install.html) to the Wolfram engine,

```
pip3 install wolframclient
```

so running your new model on your RPI is really easy.

```
from wolframclient.evaluation import WolframLanguageSession
from wolframclient.language import wl

session = WolframLanguageSession('/usr/bin/wolfram')
gdstatus = wl.Import("/path/to/model.wls)
status = ""
    for gdpic in gdpiclist:
        picimport = wl.Import("/path/to/pic/to/classify.jpg")
        status = session.evaluate(gdstatus(picimport))
session.terminate()
```

## Conclusion

As this is not the most optimal option to machine learning it is an easy, low install way of creating trivial machine learning models.  Everything you need is already installed except for one package that is pip installable.  I hope this helps someone.

Best Regards
Charlie
Solve a problem is only a start
Tags: javascript, thoughts, hackerrank
Published: 2021-02-06 22:59:45

In the lasts few weeks, I have been solving some challenges at **[HackerRank](https://www.hackerrank.com/)**, starting with the basics, in my mind I do not need to solve these challenges because there are so basic, and **I'm right for the wrongs reasons**.

It's not only about bringing the right solution and pass the tests, the way you solve the problem is important. Some of these simple challenges could have a hidden complexity depends on the solution you bring.

For example, the challenge **[Find Digits](https://www.hackerrank.com/challenges/find-digits/problem)** if you are interested to take some minutes reading, and try to solve it, I'm pretty sure not take higher than 10 minutes to solve, is basically there are free points in the platform.

If you solved the last challenge, maybe your solution was to transform the number to some type of iterable object, later iterate the object and evaluate every digit, its correct, it's a viable solution and even an optimal solution in a lot of cases.

But I'm sure is the most common solution you can find, another solution more uncommon o slightly complex is a solution with a Mathematical focus, for example:

```javascript
function findDigits(n) {
  let result = 0;
  const copyN = n;
  while(n != 0) {
    if(n%10 != 0 && (copyN%(n%10) === 0)) result++
    n = parseInt(n/10);
  }
  return result;
}
```

This code is the solution for the same problem, with some advantages like better portability between languages and performance.

This is what I was talking about at the start of the post when I said 'im right but for the wrong reasons', exist a lot of ways to solve a problem and all solutions can work, but some are better than others, and in some cases, we don't looking for because we don't know they exist.

As a software developer, I consider it very important to feel uncomfortable when things work well, I must try to improve the solution at least for a hobby.

If you have some years as a software developer and don't solve the challenge, I think you must start immediately with some easiest challenges, this is good to improve your logic and very common on job interviews, this can give you the advantage to get that role you are looking for or negotiate a better salary.
Base Conversions
Tags: numberbases, conversions, binary, foundations
Published: 2021-02-06 22:58:01

---
title: Base Conversions
published: true
description: A collection of videos on number bases
tags: numberbases, conversions, binary, foundations
//cover_image: https://images.pexels.com/photos/1314543/pexels-photo-1314543.jpeg?cs=srgb&dl=pexels-black-ice-1314543.jpg&fm=jpg
---

This is a living resource where I will post my number bases videos as I complete them. Enjoy!

# Intro to Number Bases
{% youtube WfQMJhicOjA %}


# Foundations of Number Bases
{% youtube ULyCcGwM0ro %}
Python Zero to Hero - Ep.34 - What is PEP?
Tags: python, beginners, pep, lesson
Published: 2021-02-06 22:42:55

---
title: Python Zero to Hero - Ep.34 - What is PEP?
published: true
description: For the short episode today, we will have a look at what is PEP and how many of them are there. We will answer the questions of what is PEP 8 and other PEPS.
tags: python, beginner, pep, lesson
---
For the short episode today, we will have a look at what is PEP and how many of them are there. We will answer the questions of what is PEP 8 and other PEPS. If you have any questions or any suggestions about which Python topics to cover, please leave your comment at my [Twitch channel](https://www.twitch.tv/cheukting_ho)

You can get the slide deck [here](https://slides.com/cheukting_ho) and the example code and homework form [GitHub here](https://github.com/Cheukting/python02hero). Ask questions at my [Twitch channel](https://www.twitch.tv/cheukting_ho)
Top dying Programming languages in 2021

Tags: programming, discuss, javascript, python
Published: 2021-02-06 22:22:37

You should know this because it will help you where you going to head with your career. And of course, one programming language doesn’t ultimately matter because when you are making a project, you will be using multiple programming languages.

In this article, we are going to focus on data, analysis, google trends, not my personal opinion. Let’s see what the behaviors of the world are using. That’s why we are going to use the PYPL index instead of the TIOBE index.

If you compare python with javascript, in google trends python is far more popular than javascript, but in youtube video watching comparison javascript taken far better views than python.

Let me propose a question, why there fewer people search on something even that is in high demand?
Actually I don’t have an answer. If you know, let the world know as a response.
Read full article at: https://centocode.com/top-dying-programming-languages-of-this-year/