teleren/devto huggingface dataset:
What’s your alternative solution? Challenge #49
Tags: challenge, javascript, codenewbie, learntocode
Published: 2020-05-23 12:58:16

# About this series

This is series of daily JavaScript coding challenges... for both beginners and advanced users.

Each day I’m gone present you a very simple coding challenge, together with the solution. The solution is intentionally written in a didactic way using classic JavaScript syntax in order to be accessible to coders of all levels.

Solutions are designed with increase level of complexity.

## Today’s coding challenge

```
Create a function that will convert a string containing a binary number into a number

```

(scroll down for solution)

## Code newbies

If you are a code newbie, try to work on the solution on your own. After you finish it, or if you need help, please consult the provided solution.

## Advanced developers

Please provide alternative solutions in the comments below. 

You can solve it using functional concepts or solve it using a different algorithm... or just solve it using the latest ES innovations.

By providing a new solution you can show code newbies different ways to solve the same problem.

## Solution

```javascript
// Solution for challenge44

println(binaryToNumber("11111111"));

function binaryToNumber(sBinary)
{
    return parseInt(sBinary, 2);
}

```


To quickly verify this solution, copy the code above in this coding [editor](https://codeguppy.com/code.html) and press "Run".

> Note: The solution was originally designed for [codeguppy.com](https://codeguppy.com) environment, and therefore is making use of `println`. This is the almost equivalent of `console.log` in other environments. Please feel free to use your preferred coding playground / environment when implementing your solution.
The most intriguing Experience Building a very Naive Project ( Hard Flappy Bird)
Tags: pankajhazra
Published: 2020-05-23 12:53:23

Computer Science is a vast ocean of knowledge encompassing mathematics, logic, design, statistics and business. Diving deeper into these makes a better developer, coder, analyst or a whole new discipline which you would have never heard of.

In initial phase, computer science can be intriguing, but as you dive deeper and be in tune with it, you start to enjoy its bliss.

###First Encounter with coding
Back in college, we learnt to code but the one project that set my mind and help me realise what computer science can do, and what a human can achieve with code is immense.

I came across a site called [code.org](https://studio.code.org/home).
It helps you with various interactive games and teaches you to enjoy and appreciate the wonders you can do with computer science.

###Demo Link and Gameplay 
I just called it 'Hard Flappy Bird' as I made it really difficult to score good in this game.Just play it and see for yourself. Here is the link to the game. 
[Hard Flappy Bird ]
(https://studio.code.org/projects/flappy/_Q81iL4eEuCSbd6mS79xxjiUShcsWJ6TsqtYIj_1gKM)


![alt text](https://i.imgur.com/17h4iUU.png "Logo Title Text 1")
I tried playing multiple times and my score is just **3**
![alt text](https://i.imgur.com/eA8PsBT.png "Score")




### How it works!

One of the best things about a computer program is that it can be interactive.

you can have **events**
for e.g. a **Mouse click** or a **Mouse hover** and you can have 
**Event listeners** who can listen to the event and trigger another action.

![alt text](https://i.imgur.com/dDRaOgM.png)

Here **on click** is an event and the action on event is **play a random sound**.

### The code
It uses blocks for event and you can attach multiple actions based on an event.
It isn't actual code however it gives you an idea of what you can achieve with code.
![alt text](https://i.imgur.com/6O6BOmY.png)

The image is quite self explanatory and it shows how the bird behaves in different scenarios. you can really either make it too easy or too hard.
It depends on the person who codes it.

###What it teaches
It is more important to think of **ideas** before rushing to implementations. If one is confident about his idea, one should proceed to implement. 
 
### Additional Thoughts
As a beginner, computer science can really overwhelm a lot of people but however, as we understand and get to know how it works, how it is able to  communicate through bits and bytes and spread across a vast network of interconnected devices.
As a beginner computer science undergrad , this little project acted as an eye opener and even today I continue to learn things passionately and always try to keep myself updated with the latest technology. Although I miss out on a lot but I believe one should always be willing to learn new things everyday.



[Final Note]: # (CONGRATULATIONS!!! You are amazing!)
Build a decentralized friendly betting platform
Published: 2020-05-23 11:16:55

GitHub repository : https://github.com/niladridutt/bet.cy
[Won the 2nd runners up award at SF Hacks 2019 (Major League Hacking)]

Inspiration
How many times your friend has made a bet with you and never really came through?

What it does
It helps you to easily create an immutable bet between you and your friend with a wager as a Macy's Product using Amazon Alexa.

How we built it
We built a skill for amazon Alexa using their developer console and used amazon lambda services to deploy it and seamlessly connect it with the web server. We used smart contracts to create an immutable bet between two friends having Macy's products as a wager. We used Macy's catalog-services-api to achieve the same. The web-app is made with vue.js for frontend and we used node.js for backend and integrating it with the ethereum framework.

Some of the challenges we ran into were:
* Deploying it on amazon Alexa and integrating it with the frontend.
* Working with web3.js on a vue.js component.
* Bypassing cross-origin resource sharing for HTTP request via XHR.

Accomplishments that we're proud of
Ability to deploy smart contracts on an ethereum testnet just using Alexa voice commands.

What we learned
While the individual components work perfectly on their own, integrating it and bringing together the product as a whole is a huge challenge.
Printing Staircase in JavaScript
Tags: algorithms, javascript, challenge
Published: 2020-05-23 12:53:15

For today's challenge we will create a function staircase, visual stairs made of pound symbol(#). 
Let's take a look at the challenge description.

**Challenge**
```
Write a function that accepts a positive number N.
The function should console log a step shape
with N levels using the # character. Make sure the
the step has spaces on the right-hand side!
--- Examples
staircase(2)
'# '
'##'
staircase(3)
'#  '
'## '
'###'
staircase(4)
'#   '
'##  '
'### '
'####'
```
This challenge supposed to form visual stairs made of # symbol. An argument number is a number of lines we want to pass in. If we have one step, we need to add a space ('  ') after #. 
We will reflect the current row with "i" and column with "j". To start we will for loop through rows from 0 to n.
```javascript
function staircase(n) {
  for (let i = 0; i < n; i++)
}
```
For each row, we are considering we will create an empty string step
```javascript
function staircase(n) {
  for (let i = 0; i < n; i++) {
      let step = ' ';
  }
}
```
Then we will iterate from 0 to n, through columns with for loop.
```javascript
function staircase(n) {
  for (let i = 0; i < n; i++) {
      let step = ' ';

   for (let j = 0; j < n; j++) {
   }
  }
}
```
Then inside of the inner loop, we will say, if the current column that we are looking at is equal to or less than the current row we want to add a pound(#) to step, else, we will add space (' ').
```javascript
function staircase(n) {
  for (let i = 0; i < n; i++) {
      let step = ' ';

   for (let j = 0; j < n; j++) {
      if (j <= i) {
        step += '#'
     } else {
        step += ' ';
     }
   }
  }
}
```
We will console.log(step) inside of our for loop, because we want to console.log n number of times.
```javascript
function staircase(n) {
  for (let i = 0; i < n; i++) {
      let step = ' ';

   for (let j = 0; j < n; j++) {
      if (j <= i) {
        step += '#'
     } else {
        step += ' ';
     }
   }
   console.log(step)
  }
}
```
```
staircase(6)
#
##
###
####
#####
######
```
I hope you will find this helpful practicing data structure and algorithms.
Journey into Web Monetization - mixtapes
Tags: gftwhackathon, webmonetization
Published: 2020-05-23 12:43:41

I decided to explore the idea about monetizing mixtapes I mentioned in the first post. 

To make the proof of concept as simple as possible I use SoundCloud to stream the audio. It has a nice embeddable widget as well as an API with events to detect pause and play progress.

It works like this:
- A SoundCloud widget is embedded
- A tracklist is defined to keep track of which payment pointer should be used at what time
- Get track playing and update payment pointer whenever the event `PLAY_PROGRESS` is triggered.
- Coil is used to monetize the payment pointer in the meta tag

```js
// Initialize SoundCloud widget
const audio = SC.Widget(embedSoundCloud(trackId))

// Fetch tracklist
const tracklist = await fetch("tracklist.json").then(r => r.json())

// Update payment pointer in meta tag as audio is playing
audio.bind(SC.Widget.Events.PLAY_PROGRESS, ({ currentPosition }) => {
  const track = getTrack(currentPosition, tracklist);      
  setMetaTag(track.paymentPointer);
})

// Pause monetization
audio.bind(SC.Widget.Events.PAUSE, (args) => setMetaTag(""));


function setMetaTag(pointer) {
  const monetizationTag = document.querySelector('meta[name="monetization"]');
  if (monetizationTag.content === pointer) {
      return;
  }
  monetizationTag.content = pointer;
}
  
function getTrack(timestamp, tracklist) {
  const tracks = [...tracklist].reverse() // find last index
  const trackIndex = tracks.findIndex((t) => timestamp / 1000 > t.time)
  
  return tracks[trackIndex]
}
```

Some issues that would need to be managed:
- Each artist would need to set up a wallet and a payment pointer
- Tracklists need to be defined (I crawled from 1001tracklists.com)
- Each artist in tracklist need to point to a registered payment pointer
- Metatag only supports 1 (artist) payment pointer
- Nothing prevents a user to listen if they don't monetize
- Monetization stops when browser tab is in background

Future improvements could be:
- Move payments to a backend service and stream song position using WebSockets. This could enable payouts to multiple artists (collaborations) and songs playing at the same time (during crossfades and mashups).
- Let artists sign up for a wallet and payment pointer
- Periodically check if payments are sent to let the user keep listening


You can check it out here:
https://traveling-island-marscapone.glitch.me

And the code:
https://glitch.com/edit/#!/traveling-island-marscapone

Some thoughts on WebMonetization and ILP in general:
- Is a browser extension really needed? Why can't the user authorize a backend to send payments to a pointer?
- Could we have something like an OAuth2 flow where we allow a site to spend x amount from our wallet?
Antimalware for VMs
Tags: azure, azuresecurity
Published: 2020-04-05 01:29:12

---
title: Antimalware for VMs
published: true
description: Antimalware for VMs
tags: #Azure,#AzureSecurity
---
Azure Security Center monitors the status of antimalware protection and reports this on the Endpoint protection issues blade. Security Center notes issues, such as detected threats and insufficient protection, that might make your VMs and computers vulnerable to malware threats. By using the information on Endpoint protection issues, you can make a plan to address any identified issues.

Security Center reports the following endpoint protection issues:
* Endpoint protection not installed on Azure VMs. A supported antimalware solution isn't installed on these Azure VMs.
* Endpoint protection not installed on non-Azure computers. A supported antimalware solution isn't installed on these non-Azure computers.
* Endpoint protection health issues:
 - Signature out of date. An antimalware solution is installed on these VMs and computers, but the solution doesn't have the latest antimalware signatures.
No real time protection. An antimalware solution is installed on these VMs and computers, but it isn't configured for real-time protection. The service might be disabled, or Security Center might be unable to obtain the status because the solution isn't supported.
* Not reporting. An antimalware solution is installed but not reporting data.
*Unknown. An antimalware solution is installed, but either its status is unknown or it's reporting an unknown error.

**Create an Azure Virtual Machine with the Antimalware extension**
Enable and configure antimalware for VMs To enable and configure Microsoft Antimalware for Azure VMs by using the Azure portal while provisioning a VM, complete the following steps:
1. Sign in to the Azure portal at https://portal.azure.com
2. To create a new VM, navigate to Virtual machines, select Add, and then select Windows Server under the image dropdown.
3. Enter the following details for the VM:

| Option | Answer |
| ----------- | ----------- |
|Resource Group	|Create new > myResourceGroup|
|VM Name|myVM|
|Region|East US|
|Image|Windows Server 2019 Datacenter|
|Username|Admin|
|Password|Pa55w.rd|

4. Click the Management Tab and ensure all the radio buttons are set to Off.
5. Click the Advanmced Tab and click Select an extension to install.
6. Select the Microsoft Antimalware extension. You may need to click Load More at the bottom of the list to see the extension.
7. On the Microsoft Antimalware blade click Create.
8. In the Install extension section, you can configure files, locations, process exclusions, and other scan options.
9. In the Excluded file types enter .mdf;.log
10. In the Excluded processes enter SQLServr.exe
11. Select OK.
12. Back in the Settings section, select Review + create.
13. Click Create on the validation screen.
14. Once the VM has created log onto the VM via RDP and open Microsoft Antimalware > Exclusions to verify the deployment was successful.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/qzltl56pdx28r5wf8eu8.png)
🌍Image Gallery-Flex Panel (Flexbox + JS) [YouTube LIVE]!
Tags: javascript, tutorial, frontend, flexbox
Published: 2020-05-23 12:20:00

⬇️  In this video I 'll show you how to build a modern flex gallery using flexbox and transitions. The JS part is going to be super simple while the emphasis is going to be on the CSS.

video starts at: 0:07

###Useful links
- Codepen: https://codepen.io/EleftheriaBatsou
- Working project: https://codepen.io/EleftheriaBatsou/pen/LYpaxYR
- Images: [image 1](https://images.unsplash.com/photo-1540189549336-e6e99c3679fe?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80), [image 2](https://images.unsplash.com/photo-1478145046317-39f10e56b5e9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80), [image 3](https://images.unsplash.com/photo-1506084868230-bb9d95c24759?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80), [image 4](https://images.unsplash.com/photo-1532980400857-e8d9d275d858?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1534&q=80), [image 5](https://images.unsplash.com/photo-1482049016688-2d3e1b311543?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=353&q=80)
- Links: [Cubic bezier](https://cubic-bezier.com), [CSS transition on StackOverflow](https://stackoverflow.com/questions/9311116/can-css3-transition-font-size) and on [w3schools](https://www.w3schools.com/css/css3_transitions.asp), oh and don't forget to check the [CSS Selectors](https://techbrij.com/css-selector-adjacent-child-sibling)
- Inspiration: Javascript30 by Wes
- On youtube: https://youtu.be/kJVCxAUBIZE

###If you guys recreate this project send me a link to check it. 

************************************

👋Hello, I' m Eleftheria, an app developer, master student, public speaker, and chocolate lover.

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](paypal.me/eleftheriabatsou) but If you can't that's ok too!

**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/elef_in_tech/)
Daily Developer Jokes - Saturday, May 23, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-05-23 12:00:28

---
title: "Daily Developer Jokes - Saturday, May 23, 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=Saturday%2C%20May%2023%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/5e1259a37a785.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:
A new database query walks into a bar.

The server says "Sorry, cache only."
 -->
Day 21 of #100DaysOfCode: integrate JWT with Django REST Framework
Tags: 100daysofcode, python, django, jwt
Published: 2020-05-23 11:59:58

## Introduction
We have to run two servers if we want to use React App as a SPA server and use Django app as an APIs server. What if we only want to launch one server on the machine?

This topic is the third article for Build Single page application with React and Django for building JWT endpoints for authorization and suppose that we have already had a Django application on Github.

## Details
Please refer to my article. It includes four parts.
1. Migrate Database to PostgreSQL
2. Create Endpoints for JSON Wen Token(JWT) with DRF
3. Verify JWT Endpoints on Postman
4. Create Unit Tests for Endpoints


https://medium.com/a-layman/build-single-page-application-with-react-and-django-part-3-use-jwt-with-drf-and-tests-endpoints-6a6275fb09d9

## Articles
There are some of my articles. Feel free to check if you like! 
* My blog-posts for software developing: https://medium.com/a-layman
* My web resume: https://jenhsuan.github.io/ALayman/cover.html
* Facebook page: https://www.facebook.com/imalayman
Machine Learning - Fashion Mnist Dataset - Google Colab Code
Tags: machinelearning, beginners, computerscience
Published: 2020-05-23 11:49:51

---
title: Machine Learning - Fashion Mnist Dataset - Google Colab Code
published: true
description: Machine Learning studies
cover_image: https://i.ibb.co/gyDsXzP/0-hzqhs-KFIZNWJKhvq.jpg
tags: machinelearning, Beginners, Computer Science
series: Making Of Terminator
---

Hey there,
Let us start with an intersting story.

<i>During the gold rush, a man who had been mining in Colorado for several months quit his job, as he hadn’t struck gold yet and the work was becoming tiresome.  He sold his equipment to another man who resumed mining where it had been left off. The new miner was advised by his engineer that there was gold only three feet away from where the first miner stopped digging.
The engineer was right, which means the first miner was a mere three feet away from striking gold before he quit.</i>

<h1>Moral Of the story</h1>
<blockquote>When things start to get hard, try to persevere through the adversity. Many people give up on following their dreams because the work becomes too difficult, tedious, or tiresome–but often, you’re closer to the finish line than you may think, and if you push just a little harder, you will succeed.</blockquote>

<blockquote>Be a gold digger</blockquote>

So it has been 2 weeks since i have added a new post. 

Just like the last one this is also going to contain google colab code for fashion Mnist Dataset.

I have allready covered the dataset in a previous post.Read about Fashion Mnish dataset over here  
<blockquote> <a href="https://dev.to/sandeepbalachandran/machine-learning-dense-layer-k2i">Machine Learning - Fashion MNIST dataset - Prologue</a></blockquote>

![details](https://i.ibb.co/Hrqn7Yj/embedding.gif)


<blockquote><a href='https://colab.research.google.com/drive/1nPxxNXqhDCWoErpE4Du0TsAPEPoqDXMx#scrollTo=FbVhjPpzn6BM'>

Go to Google Colab</a></blockquote>
Redesigning a Login Form | Full Process
Tags: design, ui, tutorial, beginners
Published: 2020-05-23 11:32:54

We need to be able to improve on iterations of our designs. In this video, I try to improve on Thumblytics current login by re-creating. We use their new design colours to create a stronger call to action with bigger fonts and easier to use login design.

{% youtube -iEyGY4zONY %}
<center>[Youtube: Designing a Login Form](https://youtu.be/-iEyGY4zONY)</center>

Included in this video are:
* Spacing, margins, padding for elements
* Icons, Logos and their use
* Font sizes and positioning
* Call to action buttons and secondary buttons
* Use of colour for focus and attention

## Follow and support me: 
Special thanks if you subscribe to my channel :)
* [🎞️ Youtube](https://www.youtube.com/channel/UCvM5YYWwfLwpcQgbRr68JLQ?sub_confirmation=1)
* [🐦 Twitter](https://twitter.com/adrian_twarog)

## Want to see more:
I will try to post new great content every day. Here are the latest items:
* [Adobe XD to Fully Responsive WordPress Site](https://dev.to/adriantwarog/adobe-xd-to-fully-responsive-wordpress-site-16e0)
* [Adobe XD to HTML Full Process](https://dev.to/adriantwarog/adobe-xd-to-html-full-process-ao6)
* [Full Tutorial on how to use SASS to improve your CSS](https://dev.to/adriantwarog/full-tutorial-on-how-to-use-sass-to-improve-your-css-57on)
* [Creating a Mobile Design and Developing it](https://dev.to/adriantwarog/creating-a-mobile-design-and-developing-it-5c4o)