teleren/devto huggingface dataset:
JavaScript Array.some() or Array.every()?
Tags: javascript, react, webdev, codenewbie
Published: 2021-04-01 18:58:09

I recently started using `array.some()` and at the same time also found `array.every()` interesting. It saved time for me, might do the same to you!

We will talk about both methods here.

**Array.some()**
1. It will return `True` if any element matches the required condition.
2. You would want to use this method in case you want to check if at least one of the elements in the array matches the constraints.
3. Array.some() will always return false if the array is empty. But then we ask why so? It is because array.some() returns true if at least one element of an array passes your condition. If the array is empty, none of the elements pass the condition and hence it returns false.

##### Let's check out Array.some() examples:

* Check if there is a negative number in the array:

{% codesandbox zd03m view=editor %}

* Check if value exists in the array:

{% codesandbox lxwxb view=editor %}

* What if there is an empty array and you also need to use `array.some()`? It is possible to do that but note it will always return `False` as mentioned before:

{% codesandbox cvtvs view=editor %}

**Array.every()**
1. It returns `True` if all the elements in the array match your condition. 
2. You would want to use this method in case you want to check if all the elements in the array match your condition.
3. It returns `True` if the array is empty. Then we again ask, hey, why? It is because `array.every()` returns true if every element of an array passes the condition. If there are no items in the array, every element in the array passes the condition, hence it returns true.

##### Let's check out Array.every() examples:

* Check if every number in array is negative:

{% codesandbox 8gq66 view=editor %}

* For empty array it will always return `True`:

{% codesandbox qy2ef view=editor %}
Daily Log: 12
Tags: 100daysofcs
Published: 2021-04-01 18:54:31

This bug is turning out quite hard to squish, and I don't see an obvious place to start looking for.

Guests came over, and as usual, lots of work. New Year. New Quarter. New responsibilities. New Goals. Wish me luck!

Time crunch tomorrow as well, and I don't quite like the idea of going forward with this buggy implementation, so this might have to wait until the weekend.
Top 5 DEV Comments of the Past Week
Tags: bestofdev
Published: 2021-04-01 18:46:32

---
title: Top 5 DEV Comments of the Past Week
published: true
description: 
tags: bestofdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvjh80kv1nr41sw6wxke.png
---

_This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag._

This is a [huge win](https://dev.to/devteam/what-was-your-win-this-week-438o), @drbragg ! Congratulations on the achievement!

{% devcomment 1cned %}

---

In the latest discussion on [Light v Dark Mode](https://dev.to/technoglot/light-mode-or-dark-mode-34d50), @technoglot weighs in with important factors to consider. Team Dark Mode all the way!

{% devcomment 1co96 %}

---

Trying out something new is always challenging, especially when it comes to [blogging](https://dev.to/iamfahadimran/why-all-developers-should-blog-no-excuses-1fg0). @monika_roy1 congrats on taking that first step! Cheers to big gains!

{% devcomment 1d1ch %}

---

While [Sublime isn't everyone's favorite](https://dev.to/mindninjax/why-do-you-still-use-sublime-1o7l), @darkain explains why Sublime Text remains a useful editor to them.

{% devcomment 1cnjf %}

---

@hkvongit offers their opinion on the top priority JS concepts to master in order to [grow your web development career](https://dev.to/rizwanrajput/how-to-grow-your-web-development-career-382c). Thanks for sharing your insights!

{% devcomment  1cmoh %}

---

See you next week for more great comments :v:
VkExtensionsFeaturesHelp - My New Library
Tags: vulkan, rendering, graphics, library
Published: 2021-04-06 21:49:35

---
title: VkExtensionsFeaturesHelp - My New Library
published: true
date: 2021-04-01 18:46:31 UTC
tags: vulkan,rendering,graphics,library
canonical_url: https://asawicki.info/news_1742_vkextensionsfeatureshelp_-_my_new_library
---

I had this idea for quite some time and finally I've spent last weekend coding it, so here it is: 611 lines of code (and many times more of documentation), shared for free on MIT license:

[**\*\* VkExtensionsFeaturesHelp \*\***](https://github.com/sawickiap/VkExtensionsFeaturesHelp/)

**Vulkan Extensions & Features Help**, or **VkExtensionsFeaturesHelp**, is a small, header-only, C++ library for developers who use Vulkan API. It helps to avoid boilerplate code while creating `VkInstance` and `VkDevice` object by providing a convenient way to query and then enable:

- instance layers
- instance extensions
- instance feature structures
- device features
- device extensions
- device feature structures

The library provides a domain-specific language to describe the list of required or supported extensions, features, and layers. The language is fully defined in terms of preprocessor macros, so no custom build step is needed.

Any feedback is welcome :)
My Experience at MLH
Published: 2021-04-01 18:32:52

My Experience in MLH is a good one till now. I love the fact that in this Local hack Day we don't have only coding but a mixture of all things. A perfectly balanced event it is. Till now I got the idea of how to implement things, and joined a super active, supportive community guild TechnoCrats! I met really cool, experienced people from various parts across the globe. In three days our guild is in the top 10 of the charts and this is all because of hard-working people in our guild. I'm really grateful. I'm in 2nd position among thousands of hackers now. Seems fun to be a part of this event! Major League Hacking thanks for the opportunity!
#coding #opportunity #hacking #experience #community #LocalHackDay
https://compassionate-joliot-f35c9c.netlify.app/
Intro to Web Components
Published: 2021-04-01 18:18:36

# What Is a Web Component?
In simple terms, a web component is a piece of code that allows you to create custom elements in a website. These components are reusable and can be placed anywhere in websites or apps as they're needed. Why is this important? Well, it allows for developers to spend less time coding the same things over and over again that they're going to use in a website anyway. Not only are web components great for usability, they allow for a website to have a uniform functionality and to be dynamic with all different types of data.

# Examples of Web Components
Even if you've never heard the term before, chances are you've already used some web components just through browsing the internet. YouTube, one of the world's most popular websites, uses web components all throughout the website. If you go to the homepage, you'll see a number of components. Specifically, each of the video thumbnails and the data associated with it is displayed using a web component made by youtube. It's nothing fancy, but it allows for reusability all throughout the website in addition to uniformity.

# Why Should I Use Them?
Like I mentioned above, one of the greatest strengths of using web components is for reusability. It makes life a whole heck of a lot easier for a developer to make one component and implement it all throughout their website as opposed to having to rewrite the same couple lines of code continuously. Also, in the case of YouTube, it allows for data to be displayed in a uniform way. One of the biggest strengths of web components is their open-source capability. This makes it so that anyone is able to work on a web component that has already been create and make their own version of it or make some type of improvements.

Below are some of the websites I found that are currently using web components to build their site:
[YouTube](https://www.youtube.com/)
[Wayback Machine](https://archive.org/web/)
[EA](https://www.ea.com/)


Click [here](https://youtu.be/ySZU77fxdcs) for a video explanation of web components!
Melons vs Pineapples in BLAHAJgang
Tags: majorleaguehacking, melon, blahaj, pineapple
Published: 2021-04-01 18:05:31

## Where did the Melons Originate?
The melons originated back in January with the conclusion of Local Hack Day: Build. It was an unexpected event however it has led to become part of the biggest meme of Local Hack Day: Share. It came about when Ryan never thanked BLAHAJ. Jack decided it was important to react with BLAHAJ emotes for every single message in Build chat. I took it upon myself to react with melons. From there, it was war. Every message was a battle to see who could get the most reactions.

## Where did the Pineapples Originate?
This all came around because of an April Fools Day Prank on Ryan Swift. Michael (from BLAHAJgang) came up with the idea to prank everyone by chaning from MELONsquad to 🍍PINEAPPLEparty🍍. This culminated in what can only be classed as the most iconic Twitch Stream ever. [Find it here!](https://clips.twitch.tv/StupidBashfulLampTwitchRaid-LZeWdydsHZQVj3wJ)

## Why did MELONsquad become part of BLAHAJgang?
Before Local Hack Day: Share, the two leaders decided that it would be more beneficial to have one super-guild rather than two smaller guilds. This has clearly proved to be a success as BLAHAJgang is now top of the [leaderboard](https://localhackday.mlh.io/local-hack-day-share-leaderboard)

## Where Can I Join the MELONsquad and 🍍PINEAPPLEparty🍍?
Visit us in Discord by going to https://discord.mlh.io and join the BLAHAJgang guild. Once there, ask for the link to our very own Discord server. Top secret! And that's it!
Implementation of Queue in python
Tags: python, queue, datastructures
Published: 2021-04-01 17:42:26

![queue image](https://www.guru99.com/images/1/020820_0702_PythonQueue2.png)

1. Queue is a type of data structure. Queue is based on the        principle **first in first out (FIFO)** i.e first inserted element will be deleted first. 

2. In queue **Insertion of elements is     done at one end i.e rear and deleting of elements is done at other end i.e front** .

3. Queue works similar to **queue at a ticket counter the first person in the queue is the front and the last person is the rear**. 

Now let us look at the code to implement a **queue using a LinkedList**.


### Code

```python
class node:
    def __init__(self,val):
        self.val = val
        self.next = None

class queue:
    def __init__(self):
        self.front = None
        self.rear = None

# push element on rear side
    def push(self,val):
        if (self.rear == None):
            self.front = node(val)
            self.rear = self.front
        else:
            new_node = node(val)
            self.rear.next = new_node
            self.rear = self.rear.next

# pop deletes the first inserted element in queue in front side
    def pop(self):
        if (self.front == None):
            print('No elements to pop in Queue')

        else:
            self.front = self.front.next

# To show where front is currently at
    def show_front(self):
        print('front: ',self.front.val)

# To show where rear is currently at
    def show_rear(self):
        print('rear: ', self.rear.val)

    def display_queue(self):
# To display the whole queue we have to traverse the linkedList
# Using a dummy node starting from head
        q = []
        dummy = self.front
        while(dummy):
            q.append(dummy.val)
            dummy = dummy.next
# Reverse 'q' to avoid confusion
        q.reverse()
        print('Queue data: ', q)
```

#### Input

```python
x = queue() # instantiates a queue object named 'x' 
x.push(1)
x.push(2)
x.push(3)
x.push(4)
x.push(5)
x.push(6)
x.push(7)

x.display_queue(), x.show_front(), x.show_rear()
x.pop()
# front is changed after pop operation
x.display_queue(), x.show_front(), x.show_rear()
```
#### Output

```python
Queue data:  [7, 6, 5, 4, 3, 2, 1]
front:  1
rear:  7
# after pop operation
Queue data:  [7, 6, 5, 4, 3, 2]
front:  2
rear:  7

```
How to: Sizing Cassandra or Scylla for Newts
Tags: howto, cassandra, scylladb, newts
Published: 2021-04-06 17:55:48

---
title: How to: Sizing Cassandra or Scylla for Newts
published: true
cover_image: https://pbs.twimg.com/media/Ex6Fl7FWYAIgKQe?format=jpg&name=medium
date: 2021-04-01 17:41:09 UTC
tags: HowTo,cassandra,scylladb,Newts
canonical_url: https://www.opennms.com/en/blog/2021-04-01-how-to-sizing-cassandra-or-scylla-for-newts/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-sizing-cassandra-or-scylla-for-newts
---

_NOTE: This post was originally written for the OpenNMS blog by our resident technical writer, Bonnie._

When you want to store large amounts of non-aggregated data (such as performance metrics), the round robin database (RRDtool) in OpenNMS may not be enough. OpenNMS provides a time-series data store (Newts) that works with [Apache Cassandra](https://cassandra.apache.org/ "Apache Cassandra") or [ScyllaDB](https://www.scylladb.com/ "ScyllaDB") to group metrics for more efficient storage and retrieval. It removes aggregation as a bottleneck to storage, and eliminates the wasted computation caused by unused aggregate values.

Cassandra or ScyllaDB require different implementations, configuration, and maintenance, but the process to size them for use with OpenNMS is the same. In [Sizing Cassandra for Newts](https://opennms.discourse.group/t/sizing-cassandra-for-newts/771 "Sizing Cassandra for Newts") on Discourse, Alejandro Galue, Senior Manager, Services and Support at The OpenNMS Group, describes this process, with detailed instructions and considerations on how to do the following:

- Use the evaluation layer to determine the number of metrics collected
- Configure the ring buffer and resource cache to manage memory use and heap size
- Estimate the cluster and metrics sizes
- Manage time-series data using the Time Window Compaction Strategy (TWCS)
- Set retention values for different metrics
- Configure OpenNMS and data collection
How to add Vim to Visual Studio Code to speed up your coding!
Tags: vim, vscode, tutorial, improvecodingspeed
Published: 2021-04-01 17:35:52

Nowadays, many developers use Visual studio code as their favourite because it's a lightweight IDE which is made by Microsoft for Windows, Linux and macOS that supports debugging, syntax highlighting, extensions, intelligent code completion, snippets, code refactoring, and embedded Git.

Vim is a powerful keyboard-based text editor that enables developers to code faster without lifting their hands off the keyboard.

There is a simple way to enable Vim in your favourite code editor within a few minutes.

#How to setup Vim in visual studio code

1. Open your visual studio code IDE, go to the 'extensions' tab and 
Search for Vim.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hkksnie6jcrpy46as5j7.png)

2.Double-check the version you got is similar to `vscodevim.vim` as the below image and hit install.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vi36sztwbptl80evwjfs.png)

3.Setup key-repeat to make vim extension works better.
Google search `vscode vim github` and click the first result of vs code vim git repository or click this link below.
[Link](https://github.com/VSCodeVim/Vim#-installation)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hphcw5i7v7qup4hi646.png)
 
4.Scroll down to the "installation" section and follow the installation steps according to your OS platform.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kxarr6ioiked65wcpizs.png)

* This is a handy thing to add especially when you are new to vim. because it allows you to hit the key and it repeats like in vim in terminal.
ex:- hit j to move down

5.Restart VS code


## Testing Vim on VS Code

1.Create a new file on VS Code

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gma60cps179dp6wefu6p.png)

Now you can see the cursor is a bit wider than before.

2.Press `i` to get into "insert mode" and hit enter like 4-5 times to move the cursor down.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkuc4lc3tuoc62p4611t.png)
 
3.Now press and hold `k` to see if your cursor goes up. 
If it moves smoothly, then you have enabled it successfully.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jbqoghypz4ohyzusud0n.png)

 
If it gets stuck, then try restarting the VS Code or repeat step 4 in the "How to setup visual code" section.


Using Vim inside the VS Code really improves the speed of your coding once you get familiar with Vim's shortcuts.

So, there you have the Vim editor installed successfully in VS Code.
Enjoy! :D
How to grow faster in career? (For Beginners)
Tags: beginners, codenewbie, career, computerscience
Published: 2021-04-01 17:17:32

I am engineer who has spent 5 years already in software development industry. And I want to tell you some career hacks which have helped me in beginning or in middle of my career.

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

## Hacks Hacks Hacks

There are always hacks to grow faster than someone else, or just yourself as well

-----------------------------------

#### Compete with others

Have a healthy competition with others, not only at your level but levels above you as well.
By Healthy competition, I meant -
* to learn from them and try to get better than them or at least equivalent to them
* to be good to them and not get bitchy. Healthy competition should not bring relation any effect, but on other hand relation should not come between competition always and you loosing out to get better

Why we do this?
Because you want to be valuable, and you are learning how others are valuable more than you in same industry. 
> It's not always about years, there's more to it.

-----------------------------

#### Have good connections and many connections

Apart from getting skills, your connections building ability can you take very far.
Remember that world is not fair, all of us don't have same currency value, all of us not living same life or getting same opportunities.
Humans trust connections more than strangers, so why not have connections for future jobs, opportunities, knowledge, experiences?

-------------------------

#### Put more efforts in objectives

Objectives/Goals are what we/others look for. Teams get insane targets, people get insane long targets/goals.
But you got to keep tracking them, complete them, and celebrate once they are done.

Put extra efforts in completing objective you set. Keep setting harder goals, and learn on how to accomplish things in less time.

This will help you in management of time, efforts. This will give you realization that you can work on 1 feature for 1 week, 1 month, and even 1 year. You can do everything from scratch or use 10 libraries and customize it on the top.
In the end, it's your call and results of same you have to carry.

Over a long period of time, achievements matter, efforts are just push to cover distance till achievements
Arrow syntax in Flutter
Tags: flutter, 100daysofcode, watercooler, beginners
Published: 2021-04-08 11:01:23

---
title: Arrow syntax in Flutter
published: true
date: 2021-04-01 17:16:22 UTC
tags: Flutter,100daysofcode,watercooler,beginner
canonical_url: https://bharadwaj.hashnode.dev/arrow-syntax-in-flutter
---

There are many names for this Arrow syntax, some call it "Fat Arrow" and others argue it as "Shorthand syntax", also called "Expression in the function". Keeping all these names aside the main aim of using this is, it is used to **define a single expression in a function.**

The symbol convention is this "=>". (Somewhat like = >)

The normal syntax to write the code of adding two numbers in dart is as follows

```
void main()
{
print(add(20,20));
}
int add(int a, int b)
{
  int c = a+b;
  return c;
}

```

There are two important rules to be followed when one is using Fat Arrow :

1. One needs to remove the return statement, as default it indicates return statement.

The above code can be modified like this

```
void main()
{
print(add(20,20));
}
int add(int a, int b) => a+b;

```

Two statements in the add function can be written as a single statement. On clear observation, we can see that curly braces ({}) are also removed. This leads to our second rule

1. Curly braces should also be removed when one uses Fat Arrow.

So, The code can be further modified as

```
 void main() => print(add(10,20));
 int add(int a, int b) => a+b;

```

That's it. The summary of this is simply to use this syntax only when the function can be written in single expression.
echoAR featured on Unity3D’s Solutions for Gamer Retention
Tags: unity3d, startup, news, showdev
Published: 2021-04-01 17:12:39

[Unity3D](https://unity.com/), the world’s leading game engine, recommends ideas and solutions to keep players coming back to your game.

In their latest blog post “[Retention: Ideas and solutions to keep players coming back to your game](https://blogs.unity3d.com/2021/03/29/retention-ideas-and-solutions-to-keep-players-coming-back-to-your-game/)” by Andrea Lai, Unity’s team talks about how to drive retention and player engagement with a mixture of solutions from Unity’s Verified Solutions Partners and the rest of the Unity ecosystem.

Lasting retention can have a significant upside on revenue, which is why it’s essential to keep players coming back and playing for longer.

Discover how, with a mixture of solutions from Unity’s Verified Solutions Partners, you can drive retention and player engagement by reading the full article [here](https://blogs.unity3d.com/2021/03/29/retention-ideas-and-solutions-to-keep-players-coming-back-to-your-game/).

![2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1617297107528/U5FlCUOf_.png)