teleren/devto huggingface dataset:
C++ program for checking sum of digits
Published: 2021-05-25 05:01:13

Check if sum of digits of a number exceeds the product of digits of that number
Given a positive integer N, the task is to check if the sum of the digits of N is strictly greater than the product of the digits of N 
or not. If found to be true, then print “Yes”. Otherwise, print “No”.
Examples:
Blockquote Input: N = 1234
Output: No
Explanation: The sum of the digits of N(= 1234) is = 1 + 2 + 3 + 4 = 10. The product of the digits of N(= 1234) is 123*4 = 24. As 
the sum of the digits is smaller than the product of the array. Therefore, print No.
Input: N = 1024 Output: Yes
Approach: Follow the steps below to solve the given problem:
*List Initialize two variables, say sumOfDigit as 0 and prodOfDigit as 1 that stores the sum and the product of the digits of N.
Iterate until N is greater than 0 and perform the following steps:
Find the last digit of N and store it in a variable, say rem.
Increment the value of sumOfDigit by rem.
Update the value of prodOfDigit as prodOfDigit*rem.
After completing the above steps, if the value of sumOfDigit is greater than prodOfDigit then print “Yes”. Otherwise, print “No”.
Output: No
How To Create Your First Flow In Node-RED
Tags: node, javascript, tutorial, programming
Published: 2021-05-25 04:48:37

This post introduces a deep dive video tutorial where I teach you the fundamentals of [Node-RED](https://nodered.org) and at the same time, show you how to build a **Weather Forecast Dashboard**. To make the dashboard work, we'll need to integrate with 3 online APIs that will provide the current weather forecast, a 5 day forecast, and information about the country connected to the town or city being searched.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hwuwuhd3okhzohqy61z.png)

This video tutorial shows you step by step, how we bring these APIs together in **Node-RED**, to produce a weather service in the form of a UI dashboard. Once you've completed this tutorial, you will have a good enough understanding of Node-RED, enough to be able to get up and running with your own flows.

**NOTE:** This is my first deep dive video and I would really appreciate honest feedback as to if this kind of content adds value and if yes, how can I better it for future videos to come.

**NOTE:** Also see below references to mentioned websites, online tools as well as GitHub resources for the **Node-RED Weather Dashboard**.

# Video Tutorial
{% youtube cVWVr_T7kQ0 %}

# References
- [Weather Dashboard GitHub Repo](https://github.com/bleedingcode/node-red-weather-dashboard)
- [Open Weather Map](https://openweathermap.org)
- [Rest Countries](https://restcountries.eu)
- [Postman API Testing Tool](https://www.postman.com)
- [MustacheJS](https://github.com/janl/mustache.js)
- [Up And Running With Node-RED Playlist - Bleeding Code](https://www.youtube.com/playlist?list=PLISqeoHsXJYBriF8VE_CrDvNGURq2c2m6)
- [Advanced Setup of Node-RED - Bleeding Code Tutorial](https://youtu.be/Xm35Xk5mnwg)
- [Node-RED Getting Started Docs](https://nodered.org/docs/getting-started/)
- [JSBin](https://jsbin.com)
- [Bootsnip](http://bootsnipp.com)
- [Bleeding Code - YouTube Channel](http://youtube.com/bleedingcode)
- [Bleeding Code - Twitter](http://twitter.com/bleedcode)
- [Bleeding Code - Facebook](https://www.facebook.com/bleedingcode)
Day 72 of 100 Days of SwiftUI
Published: 2021-05-25 04:47:53

I just completed day 72 of 100 days of SwiftUI. Today, I implemented saving of annotation pins into a document using `Codables` and the `FileManager` class. I also added face ID authentication to the BucketList app so user can only use the app after being authenticated.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92w7xb2iqcrn183j0kar.png)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/el5ltxslcpqip1kdk98s.png)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hxub1wk43dern9209lg.png)
5/24 TIL: Predicates, Quantifiers
Published: 2021-05-25 04:23:14

Predicates

- A statement is either TRUE or false. But x > 5 is not a statement until we have the value determined for x.
- A predicate is a sentence depending on variables which becomes a statement upon substituting values in the domain

Truth Set of a predicate P(x):

{ x ∈ D | P(x) }

- shows which of the elements in the domain make the predicate true

Universal Quantifier ∀

- "for all" (every)
- main use: "quantifying" predicates
- ∀x ∈ D, P(x) — for all x in the domain, P(x) is true

Existential Quantifier ∃

- "there exists" (some)
- ∃x ∈ D, P(x) — there exists x in the domain, such that P(x) is true

Universal/existential quantifiers turn predicates back into a statement

Negating a universal

- ~(∀x ∈ D, P(x)) ≡ ∃x ∈ D, ~P(x)
- meaning: if it's not the case that for all values some properties are true, there is at least one value where the property is false

Negating logical statements with multiple quantifiers

∀x ∈ D, P(x)) ≡ ∃

- Ex) "Every integer has a larger integer"
- ∀x ∈ Z, P(x) → ∀x ∈ Z, ∃y ∈ Z, y > x -negate→ ∃x ∈ Z, ∀y ∈ Z, y ≤ x
Test
Published: 2021-05-25 04:06:48

This is a test for the API.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras rutrum orci a leo pellentesque accumsan id vel elit. Nam euismod venenatis velit vitae lobortis. Sed dapibus sapien ornare commodo lacinia. Suspendisse potenti. Nam nec vestibulum tortor. Proin vel arcu non ipsum aliquet posuere at sed orci. Donec sollicitudin nisl ac leo placerat, sit amet aliquam urna posuere. Suspendisse ullamcorper sem id lorem egestas eleifend. Aliquam sit amet nulla nec lacus faucibus gravida eget at lacus. In et eleifend ligula, quis cursus libero. Quisque libero eros, varius ac sodales vel, placerat porta neque.

Nunc non felis semper, aliquet ipsum auctor, consectetur dolor. Curabitur non scelerisque lectus, in feugiat dui. Vivamus gravida metus non nibh molestie, in consequat ante suscipit. Aenean pharetra augue at ligula interdum tincidunt. Aenean eget lobortis neque. Morbi at lobortis nibh. Nam egestas magna sed quam fermentum, nec sodales sapien iaculis. Maecenas id convallis dolor. Nunc sodales posuere commodo. Vestibulum varius urna in egestas pretium. Sed iaculis mauris felis, eget sodales nulla tristique at. Donec elementum eleifend nisl in lacinia. Vestibulum sit amet mi orci. Cras ut nisi nec purus fermentum dignissim. Vivamus egestas purus quis arcu pharetra, a pretium sapien tincidunt.
Create Online Game Leaderboard on Redis
Tags: redis, database, gamedev, terraform
Published: 2021-05-25 04:01:16

You will see leaderboard everywhere if you a game player. Do you know how to realize it? 

There is a sample below which contains the Terraform scripts to provision an ECS and a Redis instance on Alibaba Cloud, and also a sample for setting up Java development environment on ECS to run a Leaderboard.

[Watch Now (9 mins)>](https://youtu.be/LMsMqYz9ik8)

【Source Code】
Please refer to the documentation on [GitHub >](https://github.com/alibabacloud-howto/solution-online-leaderboard-redis)

【About ApsaraDB for Redis】
[ApsaraDB for Redis Series >](https://www.youtube.com/watch?v=MxxaAczoTGQ)

【Bonus】
[Get up to 60 days FREE trial now >](https://www.alibabacloud.com/product/databases#J_2463051000)
Overview Of 12 Popular Programming Languages in 2021 (Beginner Friendly)
Tags: programming, beginners
Published: 2021-05-25 03:39:48

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6unsi12kqn14pjq8t83p.jpg)

So, you've heard a lot of programming languages and you're overwhelmed. You Googled for the best programming language, and a lot of them said it's Python, but deep down you're not convinced cause you don't know what the other languages are all about? If yes, this is the right article for you. I'll explain all the languages that you need to be aware of (I mean you need to know their use case not necessarily need to learn all of them) in 2021.

###[1] JavaScript
The best language for software developers. Every tech has it's competitor(s). JavaScript is the exception in terms of web development. JavaScript is the king of web. Used in frontend, backend, cross-platform mobile app development, desktop app development, and recently, machine learning. Pretty sure they'll use it in IoT, blockchain and pretty much everywhere in near future.

###[2] Python
Clean, easy-to-learn, simple. Not recommended as your first programming language unless you're planning to dive into Data Science and stay there without tasting other areas. 

###[3] Java
Millennials say it's dead but the truth is they might not be very good with Java. It's definitely not dead. In fact, 3 billion devices run Java. Primarily used in web backend and Android development. 

###[4] C-Sharp (I couldn't write the hashtag symbol because Dev Community assumes it's a markdown)
Similar to Java. Heavily related to windows development and backend development. C# is also popular for building video games mainly with Unity engine that is a leader framework in mobile video games (I stole this sentence from Gabriel Hernández from his comment below).

###[5] TypeScript
Microsoft took JavaScript and made it more "strict" like Java. The result was named TypeScript.

###[6] Dart
Used in Flutter. Probably can be used in other areas too but not popular.

###[7] Swift
Used in iOS app development.

###[8] Kotlin
Used in Android app development. Developers seem to prefer Kotlin over Java to build Android apps. Plus it's newer than Java. 

###[9] C/C++
Not used much in development, but still is popular in data structures and algorithms. It can get pretty complicated due to the concept of pointers and memory allocation compared to Java which has automatic memory management (thanks to its garbage collection feature).

###[10] PHP
Has a lot of haters, but it's a pretty good language. Used primarily in web development. 

###[11] Go
A pretty new language. Slowly replacing Java and C# as enterprise language. Used in backend development. 

###[12] Ruby
Not very new but has a great fan base. The Ruby framework, Ruby on Rails sounds pretty fancy. Used in web development.
David Vs. Goliath(Node.js/Express.js vs Ruby on Rails)
Tags: rails, node, ruby, javascript
Published: 2021-05-25 03:27:08

This particular post is more of an opinion piece just an fyi, and didn't feel like coding tonight. Over the weekend I had the chance to finally work with Node.js and Express.js...because I found it necessary for me to gain exposure ,and to be able have my own opinion of the two. As a developer its good to have these perspective to know how to integrate these backend frameworks with your frontend frameworks like React, and Vuejs. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e52i6f63qo8czd9wf5ub.png)

What do Node.js/Express.js and Rails have in common? They are both Model, View, Controller(MVC) frameworks that make it easy to develop a organized backend for a full-scale web application. I will not go into breaking down the two in depth, otherwise you all would be reading a dissertation. Express.js uses JavaScript ,and Rails uses Ruby(Wooohooo). You can integrate any database you want with these(..but never use SQLite for a production application).

Now what is the difference between the two? 

***Rails***
Rails is a very heavy framework given the amount of files it produces, but is a lot of fun to work with in my opinion when you are learning the MVC concept. Though slow at times, it comes with a lot for you to work with without needing to customize your eco-system too much. This is part of the reason you'll see a lot of startups using Ruby on Rails. Plus if Ruby is your first language outside of JavaScript, its probably very easy to understand syntax-wise with it being a high-level language(Very human readable). But the main thing to take away for this is Rails is fun ,but heavy

***Node.js/Express.js***
Express.js on the other hand is the the skinny boy out of the two frameworks, but you can build out the heck of this framework for what you need your project to be. Minimal amount of files....but robust by design. Its very fast to start up, but you will need to be more creative, because you can end up writing more lines of code versus how much you would with Rails, hence why Express.js is way more flexible in how you want to customize it. You'll see bigger companies using Express.Js/Node.Js, because they need something designed for literally everything which is fine. 


I will not provide an opinion on what type of project you should use these for because they can both be used as a reliable backend framework and it comes down to preference. Whenever you are exploring the two for a upcoming big project, just just keep the brief points I mentioned in mind.
My reaction to React
Tags: beginners, react, javascript
Published: 2021-05-25 02:48:34

Today I went reviewed some React that I was having a hard time understanding.  I saw they had a step-by-step guide for people who prefer to learn concepts from the ground up. This is what I learned so far:

1. JSX is basically what are in curly brackets {}. For example, 
   const name = 'Josh Perez'
   const element = <h1>Hello, {name} </h1>


2. React elements are descriptions of what you want to see on the screen. For example, 
   const element = {
   type: 'h1'
   props: {
      className: 'greeting'
      className:'Hello World'
}
};


3. render an element into the DOM: 
       const element = <h1>Hello World</h1>
   ReactDOM.render(element, document.getElementById('root')
The above to me means: create the variable and call it in the ReactDOM.render and specify where you are getting it from in html. 

4. React elements are unchangeable and you cannot change the children or the attributes. When you want to update the UI create a new element and pass it to the ReactDOM.render(). React DOM compares the element and its children to the previous one and only applies necessary updates.

5. an example of a valid react component : 
     function Welcome(props){
return <h1>Hello, {props.name}</h1>
} 

I understand it as "<h1> Hello, {props.name}</h1>" is the react element???? I know "Welcome" is the component. 

I reviewed some more but my notes are bit lengthly. 

Until next time !
Mario Kart Tabs UI
Tags: codepen, showdev, css, webdev
Published: 2021-05-25 01:38:50

[View Fullscreen Demo →](https://codepen.io/andrewheinke/full/abJWamM)

A fun exercise making Mario Kart tabs using [Alpine.js](https://github.com/alpinejs/alpine) 

{% codepen https://codepen.io/andrewheinke/pen/abJWamM %}
Perl Lists - a Partial Taxonomy
Tags: perl, lists, arrays, hashes
Published: 2021-05-25 00:58:54

---
title: Perl Lists - a Partial Taxonomy
published: true
description: An analysis of Perl List:: modules
tags: perl, lists, arrays, hashes
//cover_image: https://direct_url_to_image.jpg
---

[Mark Garder](https://phoenixtrap.com/) recently published the article [A list of Perl list processing modules](https://phoenixtrap.com/2021/05/18/a-list-of-perl-list-processing-modules/), a detailed and factual, unopinionated listing of eight Perl modules that manipulate lists. So, naturally, when his factual, unopinionated listing was cross posted to [Redit](https://www.reddit.com/r/perl/comments/nfbhvt/a_list_of_perl_list_processing_modules/), the first comment was the emotional, highly opinionated: [“So how do we go about fixing this mess? Because it is a mess.”](https://www.reddit.com/r/perl/comments/nfbhvt/a_list_of_perl_list_processing_modules/gylv4co?utm_source=share&utm_medium=web2x&context=3).

Yes, the comment was mine.

My intent was to see if we could create *One List:: To Rule Them All*. Not only does it confuse people who want to learn Perl to have various list functions in different modules (and to have functions that share a name across modules work differently), but it also confuses Perl veterans. 

And yes, once again, that’s me.

After some consideration, some education and a conversation with the [current maintainer](https://metacpan.org/author/PEVANS) of [List::Util](https://metacpan.org/pod/List::Util), the module of list functions that come with Perl itself, it seemed to me that the first order of operations was to detail just how much of a “mess” this was. So, on Sunday afternoon, while waiting to go to the airport to pick up my son, and while watching Phil Mickelson winning the PGA championship at a record 50 years old, I put together the following spreadsheet:

https://docs.google.com/spreadsheets/d/11gI89kOJvm5b30jEWrLaL0D77sZnPKMhMeAP5WcFnzs/

I hope that this can serve a as reference for people to see what's available and where it is available. Yes, it may not have a long shelf life,  but I learned a bit more about the state of the `List::` namespace. Hopefully, you'll learn a bit too.
Using ternaries for variable assignment in Python
Tags: python, programming, beginners
Published: 2021-05-25 00:14:23

---
title: Using ternaries for variable assignment in Python
published: true
description: 
tags:
- python
- programming
- beginners
cover_image: https://images.unsplash.com/photo-1521185496955-15097b20c5fe
---

One of my favorite "tricks" as a programmer is to condense conditional logic (i.e. `if/else` blocks) into one line when assigning variables. The [ternary operator](https://en.wikipedia.org/wiki/Ternary_operation) makes this possible.

If you come from a JavaScript background like I do, you may have seen this done before with a question mark.

```javascript
const isSuccess = data.response ? true : false
```

Essentially, this means if data.response is defined we should assign isSuccess the value of true. Otherwise, we'll set it to false.

Recently, I used a ternary operation in Python for the first time. While it, ultimately, works the same way I found the slight difference between languages interesting.

To recreate the snippet above in Python, we could write:

```python
is_success = True if data.response else False
```

In this case, the right-side of the assignment leads with the "truthy" value, as opposed to the value we're checking. It's not a big difference, but worth noting the difference in API.

The `?` operator has a special place in my heart because I've used it so much. However, Python's ternary operator syntax is probably easier to read for beginners.
Case / Switch Statement in Ruby
Tags: ruby, case, conditional
Published: 2021-05-25 00:12:18

## Why is this here?

I always forget how to write case statements and always find myself looking it up. This is my note to future self on how to write case / switch statements in Ruby.

## Syntax

Syntax for a case statement is as follows:

```rb
case argument
when condition
  # do stuff
else
  # do stuff if nothing else meets the condition
end
```

"Else" is optional and represents the "default" case.

All case statements written in this syntax are compared with the `===` operator so be aware of that! `===` has slightly different semantics from `==` which can be found here:

This same `===` feature is what allows us to compare Regexs on Strings and other cool behavior. `===` is overriden by individual modules but is _usually_ aliased to `==`



## Basic statement

```rb
arg = "blah"
case arg
when /blah/
  puts "woah, what a blah!"
else
  puts "Theres no blah here!"
end
```

## Adding multiple conditionals

```rb
def fruit_identifier(fruit)
  case fruit
  when "orange", "grapefruit"
    puts "Woah! Thats some good citrus!"
  when "apple", "banana", "pear"
    puts "Just some normal fruits. Nothing to see here."
  end
end
```

## One liners

```rb
def one_line_case
  case "only_one"
  when "only_one" then puts "Look ma! One line!"
  end
end
```

## if / else syntax

```rb
a = 2
case
when a == 1, a == 2
  puts "a is one or two"
when a == 3
  puts "a is three"
else
  puts "I don't know what a is"
end
```

## Further Reading

https://www.rubyguides.com/2015/10/ruby-case/

https://ruby-doc.org/core-2.7.3/doc/syntax/control_expressions_rdoc.html#label-case+Expression
Day 373 : Closer
Tags: hiphop, code, coding, lifelongdev
Published: 2021-05-24 23:05:18

_liner notes_:
- Saturday : So, I went out Friday and got back super late. Didn't really have a chance finish preparing for the radio show so I did it up to the start of the show. I've really been getting closer and closer to show time. haha I need to prepare the show earlier in the week. I've said that before. haha

![Radio show episode image of Paul Mooney smiling and holding microphone with the words May 22nd 2021 RIP Paul Mooney, No Verbs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7n8d3fczm53szs21q6e.jpg)

- Sunday : Did the post radio show promo work, my laundry and did a couple of tutorials and read some articles on doing push notifications. Then I watched "Fear the Walking Dead" and "Gangs of London".

- Professional : Pretty good way to start the week. Got some answers to questions and issues I was running into with a sample demo application I am making. Thought it was something I was missing, but the things I was looking for wasn't in the version I have. Had a couple of meetings. Got to help out a team member with some code that they were working on. Productive.

- Personal : So, I did 2 tutorials that walked through creating a basic frontend and backend of an application that can do push notifications. It was done in Vanilla JavaScript and Node JS. It was good to see what it takes to make it work. I'm thinking I won't even need to use a framework, just us JavaScript and Firebase.

![View into a valley with a lot of orange brown pine trees with snow covered mountains in the distance of Lake O'Hara, BC, Canada](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrx34ar63006z6r8sczr.jpg)

Going to see if I can get the push notifications working for my side project. Let's see if I can get it working with just Vanilla JavaScript and Firebase. Maybe I'll actually go through tracks for the radio show this week.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube eCghouW8dak %}
Some thoughts about productivity
Tags: productivity, linux
Published: 2021-05-24 22:25:58

For the last couple of years, I have been in the Linux space and mostly tried to find the best distro, best file manager, best terminal etc. I was caught up in the loop of finding the best programs to handle a job. This approach, unless controlled, usually leads to low productivity in the long term.

How so you might ask ? Well, this behavior is really relatable for some people. When I am talking about this subject, some of you might probably say, *"Oh yes I have been there"*. In Linux world, there is even a term for this. *Ricing*.

Ricing means tweaking the configuration of your working environment to suit your personal needs. At particular level, one might consider this useful, and it indeed is. There are some workflow approaches, shortcuts and others that helps the developer access files and folders faster, learn by muscle memory and perform some set of actions quicker. Past that particular level and you are now in the over-ricing zone. Where you are essentially tweaking every aspect of each program, work environment to your needs, but at the same time you are never satisfied so you keep tweaking and changing settings, configs and what not. It reduces your productivity and at the end of the day when you look back, you realize you have done nothing but tweaking some stuff to find the best work environment.

This is what I call the loop *(referring to the Bandersnatch here)*. You are in the *loop*. You need to get out and you need to get sh*t done. Don't worry about using the best tool out there, don't try to find the absolute efficient program. Just get it done.

This is in actuality a paradox. The paradox goes as such, *"The more choices you have, the less satisfied you are"*. Seems about right when you think for a bit.