teleren/devto huggingface dataset:
Intermediate Algorithm Scripting: Steamroller FCC
Tags: replit, node
Published: 2020-04-12 04:04:00

---
title: Intermediate Algorithm Scripting: Steamroller FCC
published: true
tags: replit, nodejs
---

/*Intermediate Algorithm Scripting: Steamroller
Flatten a nested array. You must account for varying levels of nesting.*/
function steamrollArray(arr) {
var x = arr.reduce((acc, val) => Array.isArray(val) ? acc.concat(steamrollArray(val)) : acc.concat(val), []); 
 console.log(x)
return x
}
steamrollArray([1, [2], [3, [[4]]]]);
steamrollArray([[["a"]], [["b"]]]);
steamrollArray([1, [], [3, [[4]]]]);
steamrollArray([1, {}, [3, [[4]]]])
/*https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller*/
/*https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Array/flat*/

{% replit @oscarhernandez6/Intermediate-Algorithm-Scripting-Steamroller-FCC %}
Bookmark These Free Spring Boot Learning Resources
Tags: java, springboot, career
Published: 2020-04-12 03:32:37

---
title: Bookmark These Free Spring Boot Learning Resources
published: true
description: Spring Boot is the most popular Java framework today. These learning resources can help anyone build something great with Spring Boot!
tags: java, springboot, career
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/i8g2voisr9191beul148.jpg
---

If you're new to Spring Boot and looking for quality learning resources, I've found these bookmarks quite helpful when ramping up people new to this powerful framework.

# ✔️ Java Enterprise 101: Building a REST Server with Spring Boot

{% link https://dev.to/martinhaeusler/java-enterprise-101-building-a-rest-server-with-spring-boot-m7k %}

---

# ✔️ freeCodeCamp Spring Boot Tutorial

At just two hours and with no ads, what's not to love about [freeCodeCamp's Spring Boot Tutorial](https://www.freecodecamp.org/news/spring-boot-tutorial/)?

---

# ✔️ Spring Boot - Crash course

{% link https://dev.to/thegroo/spring-boot-crash-course-21nm %}

---

# ✔️ JetBrains Reactive Spring Tutorial

The [JetBrains Reactive Spring Tutorial](https://blog.jetbrains.com/idea/2019/12/tutorial-reactive-spring-boot/) is a full-featured ten part course. An accompanying YouTube Playlist of the videos is also available alongside the Github repositories and other instructions. This is the first video:

{% youtube coM6wWKau5E %}

---

# ✔️ Spring Guides

[Spring Guides](https://spring.io/guides) are from the Spring website and cover not only Spring Boot, but also the variety of accompanying libraries  in the ecosystem such as Spring Data. They are often focused down to very narrow use cases which is handy when you're trying to figure out how to accomplish a specific task one day.

---

# ✔️ Creating a Spring Boot and Angular application for Azure

{% link https://dev.to/azure/creating-a-spring-boot-and-angular-application-for-azure-1-7-2mb8 %}

---

# ✔️ Learn Spring Boot (Baeldung.com)

[Baeldung's Learn Spring Boot](https://www.baeldung.com/spring-boot) series is great for developers from beginner to advanced and often serve as good reference material later on as well.
Flexible trait function parameter names in Rust
Tags: rust, traits
Published: 2020-04-12 03:08:47

When we define a trait we give it a function statement of the form `fn blah(foo: Bar)`. But when implementing this trait the parameter name (here it is `foo`) can be changed as you wish. So let's have an example. 

[Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d87ab50ead14e8fe1aeb96b60b80a782)
```rust
/// A very simple struct
struct Simple;
/// A struct that doesn't matter
struct Whatever;

/// A trait that does something _very_ complex
trait SuperDuperComplexThing {
    fn do_super_duper_complex_thing(some_extremely_and_needlessly_long_parameter: Whatever) -> Whatever ;
}

impl SuperDuperComplexThing for Simple {
    fn do_super_duper_complex_thing(simple_param: Whatever) -> Whatever {
        Whatever
    }
}
```

And this works perfectly. It compiles.
Working from Home, Check this in case you miss your office 💻👨‍💼👩‍💼💼🏢😊💬
Tags: coronavirus, aws, covid19, career
Published: 2020-04-12 03:03:23

<b>Hope you are doing well and your family friends and loved ones 👨‍👩‍👧‍👦 are healthy back home 🏡😊</b>

<b><h3>Why I thought of Sharing this ?</h3></b>
<i><b>Actually,as we know that most of us are working from home 💻 since past few weeks ⏳ and many of us are not used to this. I could imagine how hard it would be during this COVID-19 crises! 🦠🦠</i></b>
<b>I've thought 💭 of providing you a virtual tour for an environment like your "Office". Actually one of my colleague 🤝 have shared this with us and I found this pretty cool </b>

<h3><b>Click here :  https://imisstheoffice.eu/</h3></b>

<b>And you can "Click on the things such as Printer, Chair , Tables" to turn them on and feel like to be in office 💻👨‍💼👩‍💼💼🏢😊💬 </b>
<b><u> 🙂 Also, You may use your Headphones 🎧 for better experience 🙂</b></u>

![Do you miss office working from Home ?](https://dev-to-uploads.s3.amazonaws.com/i/hu3u97pr5co564bd0hkq.JPG)


<p><b>Stay Healthy, Stay Safe, Stay at Home and Save Lives, We will recover soon from this 💪💪💪💪💪<br></b></p>
<p><br></p>

<br>
<b>With Regards,</b>
<b>Dinesh Rathee</b>
<b><a href="https://www.linkedin.com/in/%E2%80%8Bdineshrathee12" target="_blank">Connect with me on LinkedIn</a>
<b><a href="https://dev.to/dineshrathee12" target="_blank">Connect with me on DevTo</a>
<b><a href="https://github.com/dineshrathee12" target="_blank">Connect with me on GitHub</a>
<b><a href="https://twitter.com/dinesh_rathee12" target="_blank">Connect with me on Twitter</a>
ActiveRecord Queries
Tags: ruby, beginners
Published: 2020-04-12 01:00:17

Through the last several Rails projects I've built, Active Record has been the resource that allows me to easily link objects to a database, and write queries that improve the functionality and efficiency of my code. Active Record provides query logic that closely resembles SQL (structured query language) queries, but can typically be written with fewer lines and is more intuitive, for me, because it follows Ruby syntax. 

Active Record is an Object Relational Mapping (ORM) system. This means that it handles the storing of your data to tables in a relational database management system and allows for the creation and retrieval of your data through language specific commands. 

One of my first projects using Active Record was a brewery search and bookmarking CLI (command line interface) app. The goal was to allow a user to search for any brewery in California, add a bookmark, write a review and save a favorite drink. Below, I've included an Active Record query that finds the current user's favorite drink.

```ruby
fav_drink = Bookmark.select('favorite, count(favorite) as cnt').where('user_id = ?', self.id).group('favorite').order('cnt DESC').first
```

For anyone with SQL experience, the statement above should be easy to read. I'm first declaring a variable, 'fav_drink', and setting it equal to an Active Record query on Bookmarks. The query selects the values, 'favorite' and a custom value, 'cnt' which is meant to keep the total of favorites for each drink. The query then limits results to bookmarks where the user id is equivalent to the current user's id. It then groups the results by the favorite drink that was entered, which leaves an array of objects representing each drink that the current user has favorited and its corresponding count. The query then sorts the results in descending order based on the value of each drink's count, and returns the first result (the drink with the highest count).

The ruby alternative to this statement would require more lines of code and have much worse performance when dealing with large quantities of data. 

For some more complicated projects and heavy data analysis, it is my understanding that many still prefer writing raw SQL and find that ORM systems create performance and integration issues. With that being said for small teams that do not have a SQL expert, an ORM system, like Active Record, allows for intuitive and efficient data mapping and querying. 
 




Sources:
[Active Record Basics](https://guides.rubyonrails.org/active_record_basics.html)
[Active Record Querying](https://guides.rubyonrails.org/active_record_querying.html)
Minimum Spanning Tree (Kruskal's Algorithm)
Tags: computerscience, algorithms, datastructures, csharp
Published: 2020-04-12 00:33:40

## Resources:

This post requires knowledge of graphs and union-find (covered in earlier posts).

1. [Kruskal's algorithm video explanation](https://www.youtube.com/watch?v=fAuF0EuZVCk)
1. [Another video explanation](https://www.youtube.com/watch?v=JZBQLXgSGfs&list=PLDV1Zeh2NRsBI1C-mR6ZhHTyfoEJWlxvq)
1. [OO implementation of Kruskal's](https://github.com/mission-peace/interview/blob/master/src/com/interview/graph/KruskalMST.java)
1. [Wikipedia article on Minimum Spanning Tree](https://en.wikipedia.org/wiki/Minimum_spanning_tree)

Takeaways:
* A Minimum Spanning Tree (MST) is a subset of edges of an undirected, connected, weighted graph. 
   * This means a MST connects all vertices together in a path that has the smallest total edge weight.
* One algorithm for finding the MST of a graph is **Kruskal's Algorithm**.
* Kruskal's algorithm is a **greedy algorithm** - this means it will make locally optimum choices, with an intent of finding the overall optimal solution.
* Kruskal's algorithm relies on the **union-find** data structure.
   * First the algorithm sorts the graph's edges in ascending order (by weight). 
   * Then for every edge, if it's vertices have different root vertices (determined by union-find's `Find()`), it will add the edge to a list & `Union()` it's vertices within the union-find data structure.
   * If roots are the same, it will skip the edge.
   * The final list represents the MST of the graph.
* Another common algorithm for finding the MST of a graph is [Prim's Algorithm](https://en.wikipedia.org/wiki/Prim%27s_algorithm). Commonly, Prim's uses a heap or priority queue in it's implementation.
* Time complexity for Kruskal's algorithm is `O(e log v)` where `e` is the number of edges and `v` is the number of vertices in the graph. Space is `O(e + v)`.

Below is my implementation of Kruskal's algorithm:

{% gist https://gist.github.com/jbolton209/81500599e149f79101b550d1e6a1c102 %}

As always, if you found any errors in this post please let me know!
Manage endpoint protection issues with Azure Security Center
Tags: azure, azuresecurity
Published: 2020-04-12 00:25:29

---
title: Manage endpoint protection issues with Azure Security Center
published: true
description: Manage endpoint protection issues with Azure Security Center
tags: #Azure, #AzureSecurity
---
Azure Security Center monitors the status of antimalware protection and reports this under the Endpoint protection issues blade. Security Center highlights issues, such as detected threats and insufficient protection, which can make your virtual machines (VMs) and computers vulnerable to antimalware threats. By using the information under Endpoint protection issues, you can identify a plan to address any issues identified.

Security Center reports the following endpoint protection issues:
* Endpoint protection not installed on Azure VMs - A supported antimalware solution is not installed on these Azure VMs.
* Endpoint protection not installed on non-Azure computers - A supported antimalware is not installed on these non-Azure computers.
* Endpoint protection health:
 - Signature out of date - An antimalware solution is installed on these VMs and computers, but the solution does not have the latest antimalware signatures.
 - No real time protection - An antimalware solution is installed on these VMs and computers, but it is not configured for real-time protection.
 - Not reporting - An antimalware solution is installed but not reporting data.
 - Unknown - An antimalware solution is installed but its status is unknown or reporting an unknown error.

**Implement the recommendation**
Endpoint protection issues is presented as a recommendation in Security Center. If your environment is vulnerable to antimalware threats, this recommendation will be displayed under Recommendations and under Compute. To see the Endpoint protection issues dashboard, you need to follow the Compute workflow.

In this exercise, we will use Compute. We will look at how to install antimalware on Azure VMs and on non-Azure computers.

**Install antimalware on Azure VMs**
1. Select Compute & apps under the Security Center main menu or Overview.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/snilu6clej9nysmdchw2.png)
2. Under Compute, select Install endpoint protection solution on virtual machines. The Endpoint protection issues dashboard opens.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/941kb09htxzb7x1ga1dc.png)
3. On the Endpoint Protection not installed on Azure VMs blade click Install on 1 VMs.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/z7ed1k603y1ribdkcune.png)
4. Under Select Endpoint protection, select the endpoint protection solution you want to use. In this example, select Microsoft Antimalware.
5. Additional information about the endpoint protection solution is displayed. Select OK.
A simple data oriented validation function
Tags: clojure
Published: 2020-04-12 00:23:17

# First Attempt

I'm going through Clojure for the Brave and True and one of the exercises was to write a function that validates a map against requirements.

I find this function quite beautiful because it declares the validations rules in a data oriented way.

```Clojure
; Define the requirements of each key in the record to be validated
; Name must be a key and glitter-index must be integer
(def requirements {:name string?
                   :glitter-index integer?})

; Validate a record (a map) against requirements
; Returns a list of validations results '(true false)
(defn validate
  [requirements record]
  ; map turns record {:a 1 :b 2} into a list of key-value pairs
  (map #((get requirements (key %)) (val %)) record))

; Usage:
(validate requirements {:name "Mr. Vampire" :glitter-index "42"})
; => (true false)
(validate requirements {:name "Mr. Vampire" :glitter-index 42})
; => (true true)
```

The function is essentially a one liner and may be hard to grasp on first pass but once understood it starts to show some of the beauty of Clojure.

# Second Attempt

I revisited this exercise after a couple of days and realized there was a simple but important bug.

Let say you wanted to update the requirements to check for age. You would update the requirement map but the validation function will ignore that new requirement.
```clj
(def requirements {:name string?
                   :glitter-index integer?
                   ; New requirement
                   :age integer?})

(validate requirements {:name "Edward Cullen", :glitter-index 10})
; Validate ignore the age requirement
; => (true, true)
```

The cause is that the validate function uses the record map to determine which keys to check. The fix is simple and again begins to show the power of Clojure and s-expressions.
```clj
(defn old-validate
  [requirements record]
  ; Note how record was the input to map
  (map #((get requirements (key %)) (val %)) record))

(defn validate
  [requirements record]
  ; Note how requirements is now the input to map
  (map #((val %) (get record (key %))) requirements))

(validate requirements {:name "Edward Cullen", :glitter-index 10})
; :age is missing from the record and validate now returns a false
; => (true, true, false)
```
Weekly Roundup 27
Tags: weekly, links
Published: 2020-04-15 05:23:41

---
title: Weekly Roundup 27
published: true
date: 2020-04-12 00:00:00 UTC
tags: weekly,links
canonical_url: https://www.ankursheel.com/blog/weekly-roundup-27
description: This weeks roundup contains articles/tools from Bruce Lawson, Austin Gil, Oleksii Trekhleb, Kyle Shevlin, Adam Giebl and Shawn Wang
---

Every week I come across some great articles. Here are some of the posts I feel you will enjoy reading as much as I did.

There are a lot of reasons to ensure that a website is accessible. **Bruce Lawson** shares [16 tips to improve accessibility](https://websitesetup.org/web-accessibility-checklist/). There is also a 6-minute video with Leonie Watson, of how she uses her screen reader to navigate his site.

Continuing with the theme of accessibility **Austin Gil** examines the [proper semantics to build an HTML form](https://stegosource.com/how-to-build-html-forms-right-semantics/).

If you have had difficulty understanding the SOLID principles, you need to see these [real world examples with illustrations of the SOLID principles](https://dev.to/trekhleb/s-o-l-i-d-principles-around-you-1o17) by **Oleksii Trekhleb**.

**Kyle Shevlin** has a great example of how [functional programming can help reduce the cyclomatic complexity](https://kyleshevlin.com/managing-cyclomatic-complexity) of your program.

**Adam Giebl** has made a tool to [generate Soft-UI CSS code](https://neumorphism.io/#55b9f3) to achieve Neumorphic effects.

If you are a programmer, you would have heard of the Big O notation. But, have you heard about Big L notation? **Shawn Wang** sketches out the [Big L notation which plots your learning as a function of N years of experience with P peers](https://www.swyx.io/writing/big-l-notation/).

Hope you enjoy reading these articles as much as I did.
What the COBOL?
Published: 2020-04-11 23:06:42

The **CO**mmon **B**usiness-**O**riented **L**anguage (COBOL) is a compiled programming language first introduced in 1959. COBOL is not a language you would reach for when building new software however it is still used by many systems today. These are huge systems that keep the world running. Think of systems that handle banking transactions for example. Banking itself has such complex business logic that rewriting the COBOL code to a "modern" language would be a huge undertaking.

So why learn COBOL? COBOL isn't exactly the language taught or sought after today. If you look at today's landscape, you'll find C++, Javascript, Rust, and many other "modern" languages. The number of COBOL developers is decreasing but there are systems that still need to be maintained. Being a COBOL developer could be a very lucrative job.

Let's now take a look at COBOL at a high level.

## COBOL versions

The COBOL language has 3 main versions:

1. COBOL-85
2. COBOL-2002
3. COBOL-2014

As a COBOL developer, you can expect most of your development will be done in COBOL-85.

## GnuCOBOL

GnuCOBOL is one of the more popular COBOL compilers.

### Installing on Windows

Follow the instructions on [GnuCOBOL's SourceForge page](https://sourceforge.net/p/open-cobol/wiki/Install%20Guide/).

### Installing on Ubuntu

```sh
sudo apt-install gnucobol
```

### Installing on MacOS

We will be using [Homebrew](https://brew.sh/) to install GnuCOBOL.

```sh
brew install gnu-cobol
```

## File extensions

COBOL programs can have the following file extensions:

1. `.cobc`
2. `.cbl`
3. `.cob`
4. `.cpy`

The extensions used will depend on the coding practices set by the project.

## Hello world!

Let's create a new file called `hello-world.cbl`.

```cbl
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
STOP RUN.
```

We've written our first COBOL program! Let's compile and run it now. In a terminal, do the following:

```sh
cobc -x -F hello-world.cbl # Creates an executable called hello-world
./hello-world # Runs the executable
> Hello, world
```

That's it for now. In future posts we'll take a deeper look in how to write COBOL.
The Power Of Bookmarking Websites
Tags: productivity, beginners, tips, web
Published: 2020-04-12 19:41:09

---
title: The Power Of Bookmarking Websites
published: true
date: 2020-04-11 22:40:32 UTC
tags: productivity, beginners, tips, web
canonical_url: https://www.devsurvival.com/the-power-of-bookmarking/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/ycih2ayig7gg2mbup04x.jpeg
---

### What is Bookmarking?

![bookmarking](https://www.devsurvival.com/static/d4788a0aaa9559b2e9bbfc117b99af39/459f0/bookmarking.jpg "bookmarking")

 <small style="margin-left: 15vw">Credits to: </small>[<svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-2px;fill:white" viewbox="0 0 32 32"><title>unsplash-logo</title>
<path d="M10 9V0h12v9H10zm12 5h10v18H0V14h10v9h12v-9z"></path></svg>五玄土 ORIENTO](https://unsplash.com/@oriento?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge "Download free do whatever you want high-resolution photos from 五玄土 ORIENTO")

Bookmarking is the practice of saving a website to your browser for easy access at a later time. On Google Chrome, there is usually a star at the end of the URL bar that lets you bookmark the current page. Pretty straight forward, but it is one of the most under-appreciated feature.

### Why you should start Bookmarking

Bookmarking allows you to quickly save a website, so you can look at it later like an interesting article that you want to read later. You can bookmark your most visited sites, such as Youtube or Twitter. People tend to visit these sites with high frequency throughout the day, and being able to directly go to them with a click of a button can be a time saver.

  

Please save yourself from a carpal tunnel by clicking that star to save the website. Otherwise, bookmark your frequently visit websites so you can avoid the common habit of doing a google search every time… Cmon, we have all been there. Me: trying to get to Youtube

  

1. typing “yout” in the URL bar
2. waiting for the google search algorithm to do its things
3. its done finally! (Click the first Youtube result)

### Bookmarking on Steroid

Are you convinced yet? Bookmarking in its simplest form is great, but what if you have hundreds of websites? Start grouping websites into directories! This is where the true power of bookmarking lies in. Organizing related websites into folders allows you to quickly and intuitively find a website you are looking for. For instance if I was looking for a website I bookmarked about a hackathon, I can intuitively go into my bookmark directories : code -> hackathon -> my\_hackathon.com

  

![bookmarking folders](https://www.devsurvival.com/static/50a652fc8ba27e23d84ae3347265de34/a3a36/bookmarking_folder.png "bookmarking folders")

  

It might be cumbersome or even pointless to do it this way, but at least give it a try 🙏. I had some doubts when I first started, but the investment was totally worth it now 😄
Game Object Variance: Single and Multiple
Tags: java
Published: 2020-04-11 22:20:53

I am working on updating my 2nd of 30 games: Mazer5D. I have decided to use image templates for various game objects, using two different systems: avatars, due to their 6 degrees of variability, using one, while objects use another scheme supporting only 1 degree. Objects that have 2 degrees of variability are stored as 2 images and assembled at runtime. I'm primarily supporting color variability, but the engine can also rotate images 90/180/270 degrees if needed. Doing so means I only need 260 raw input images, instead of >1000 for all the possible permutations. There is a performance penalty for doing this, but I mitigate it by precomposing all the common variants and caching them at startup.