teleren/devto huggingface dataset:
I had a bug with ForEach and Range in my SwiftUI code
Tags: ios, swift, swiftui
Published: 2020-04-29 18:56:29

---
title: I had a bug with ForEach and Range in my SwiftUI code
published: true
description: 
tags: ios,swift,swiftui
---

I have a side project for iOS, and since it's a side project, I thought to try [SwiftUI](https://developer.apple.com/xcode/swiftui/) for the UI. There's some complexity because the UI isn't exactly traditional, but overall, I've been happy with SwiftUI.

But when Xcode 11.4 was released, the app wouldn't work properly. Some, but not all, parts of the UI weren't updating anymore when state changed. For a while, I stayed on 11.3 so I could work on the functionality, but as time passed, it became evident that this wasn't a problem with Xcode or iOS, it was something in my code.

Mostly, I thought that I had messed up with the bindings so that the UI wasn't observing my presentation layer properly. No luck there, nothing I tried would work. After a lot of frantic Web searching, I eventually found the answer in the [comments to an unrelated blog post](https://swiftui-lab.com/frame-behaviors/).

My code looked something like this
```swift
struct MainView: View {
  @Binding var names: [[String?]]

  var body: some View {
    VStack {
      ForEach(0..<self.names.count) { nameIndex in
        NamesView(self.$names[nameIndex])
      }
    }
  }
}
```

The problem is that `ForEach` has three `init` methods,
```swift
init(Data, content: (Data.Element) -> Content)
init(Range<Int>, content: (Int) -> Content)
init(Data, id: KeyPath<Data.Element, ID>, content: (Data.Element) -> Content)
```
and using it like I did picks the second one, with the `Range` parameter. This method assumes that the range doesn't change, which is true in my case, but it also seems to assume that the content views don't change, at least from Xcode 11.4 onward. Maybe this is a bug, maybe it's intended behavior, I can't tell from the documentation.

When I had finally discovered the problem, the fix was simple enough. I changed the `ForEach` to
```swift
      ForEach(0..<self.names.count, id: \.self) { nameIndex in
        NamesView(self.$names[nameIndex])
      }
```
which picks the third `init` method of `ForEach`, and allows updates of the views.
Some known Exceptions  (python3)
Tags: python
Published: 2020-04-29 18:45:59

Exceptions

Different exceptions are raised for different reasons. 
Common exceptions:
ImportError: an import fails;
IndexError: a list is indexed with an out-of-range number;
NameError: an unknown variable is used;
SyntaxError: the code can't be parsed properly; 
TypeError: a function is called on a value of an inappropriate type;
ValueError: a function is called on a value of the correct type, but with an inappropriate value.
The Oriented Bounding Box Problem
Published: 2020-04-29 18:35:47

Recently at Wooden H Studio, we have been working on creating an entirely custom physics system for our up-and-coming game engine. Up until this point collision and resolution has been smooth sailing until we got to the dread Oriented Bounding Box, OBB for short. 

##The Problem
OBBs are similar to its other cubic brethren the AABB (Axis Aligned Bounding Box) as they are both boxes but, are different in every other way. For starters an OBB is not aligned to any axis, meaning it has 360 degrees of freedom whilst the AABB doesn’t rotate at all. So, this meant we couldn’t check for collision or resolution the same way as the AABB’s, so we had to come up with another solution.

##The Separating Axis
In-game physics there is a theory that to determine if there is a collision between 2 objects there is a plane that separates the two objects, if there is then there is no collision, otherwise, the two objects collide. This is called the Separating Axis test and we used this test numerous times throughout our development to detect a collision, and even determine the resolution needed as well.

##How does it work?
At first, I thought this same question, in fact, it took me a while to understand how to write it into code, but it is much simpler than it sounds. What we need to do is project the box onto a line that is parallel to the axis we want to test and determine the smallest and largest value per bounding box. Once we have each of the boxes projected onto this line all we need to do is check to see if either of the boxes smallest value was less than the other largest value. If these values overlap, then there is collision along this axis. But this isn’t always the case. Say two boxes are sitting flat on a plane, side by side and we wanted to check the axis perpendicular to the plane, we’ll use the vector {0,1,0}. If we project the boxes onto this axis technically there would be no gap between the 2 projects thus concluding there is a collision, even where there isn’t. The solution to this problem to continue doing this test using different axes until we find one that has a gap. Since there theoretically can be an infinite number of axes, we need to devise a plan to shrink that number to something more reasonable. 

The solution for our dreaded OBB is to take the X, Y and Z axis of each bounding box and test them, after that the first box’s axes must be crossed with each axis of the second box’s axes. This results in the separating axis test being run 15 times at a minimum! While this might not seem great for computation the theory works and gives us very accurate collision detection and helped boost our thought process with the rest of the collision perils. This system works great especially for different object types like OBB to AABB and really helped boost our productivity after learning about this insane method.

By Gage Dietz
Spin up a Slack app in seconds with Dark
Tags: darklang, slackapp, api
Published: 2020-04-29 18:34:52

Seconds is a *bit* of an exaggeration, but we've made it possible to build a full Slack app in less than an hour. [You can jump right in](https://darklang.com/signup?05b46f1e-153b-4f6f-9926-b50060a994f3) (limited number of accounts available - if the link has expired, click [here](https://darklang.com/beta) to join the waitlist.)

How? Our very first package. 

We've created and released [a set of functions](https://darklang.github.io/docs/slack-apps/slack-packages) to make the best possible Slack API experience. No more writing an OAuth implementation from scratch - it's just one line, and you can see it working right away.


Here's a peek under the hood:

![https://miro.medium.com/max/1400/0*yKkenT1m4kBgd8s-](https://miro.medium.com/max/1400/0*yKkenT1m4kBgd8s-)

Everything else is just as easy:

- Trigger /commands to an API endpoint just by configuring in Slack

![https://miro.medium.com/max/1400/0*FdBNGtGfPbpeiLQp](https://miro.medium.com/max/1400/0*FdBNGtGfPbpeiLQp)

- @mention a bot and process the payload live

![https://miro.medium.com/max/1400/0*vikQRLTufMjosvJk](https://miro.medium.com/max/1400/0*vikQRLTufMjosvJk)

- Find a list of channels
- Post messages to any channel

Not sure where to start?

- Jump right in with the first slack App tutorial. You can set up a quick app in <5 minutes: [https://darklang.github.io/docs/slack-apps/slack-intro](https://darklang.github.io/docs/slack-apps/slack-intro)
- Look at code for existing Slack applications built in Dark: [https://darklang.com/a/sample-magiceightball](https://darklang.com/a/sample-magiceightball)
- Check out [snipy.io](https://snipy.io) and [Summit.Work](https://summit.work/), companies built by developers who are using Dark for the backend. We've also seen people build OKR trackers, ice breaker prompts, show their app store reviews in engineering channels, and more!
- [Come to our in person walkthrough](https://docs.google.com/forms/d/e/1FAIpQLSfphGMiOw-nm30SYuCC-EeMoUV5dB43WRcCQorfOZQ7ClpC7A/viewform?usp=sf_link) on Friday at 7am PST/10am EST/3pm BST or 10:30am PST/1:30pm EST/6:30pm BST.
- Follow a longer tutorial to build a useful Slack integration: [Trello integration](https://darklang.github.io/docs/slack-apps/tutorials/new-trello-card) and a [bot that posts when new channels are created](https://darklang.github.io/docs/slack-apps/tutorials/channel-check). We're working on more all the time, and happily invite our community to submit their own by submitting [pull requests to our documentation](https://github.com/darklang/docs).
- [Join our community](https://darklang.com/slack-invite) (yes, it's on Slack!) to connect with other Dark developers.
Azure Virtual Machine Scale Sets
Tags: azure, microsoft, vms, beginners
Published: 2020-04-29 18:17:53


Jay Gordon shows you how to set up a stateless application using Azure Virtual Machine scale sets in under five minutes.  In less than five minutes you'll see how to create a highly available application using a load balancer and autoscaling.

{% youtube V03fJupJ_PY %}

Get $200 in free Azure Credit:  http://aka.ms/scalesets200

Virtual Machine Scale Sets documentation - https://docs.microsoft.com/azure/virtual-machine-scale-sets/?WT.mc_id=ssets-twitter-jagord

react-clock-basic repo: https://github.com/jaydestro/react-clock-basic

cloud-init script: https://github.com/jaydestro/react-clock-basic/blob/master/other/vm-install.sh
OpenNMS Meridian 2019.1.6 (Europa) Released
Tags: news, activemq, meridian, minion
Published: 2020-05-04 19:20:30

---
title: OpenNMS Meridian 2019.1.6 (Europa) Released
published: true
date: 2020-04-29 18:00:15 UTC
tags: News,activemq,Meridian,minion
canonical_url: https://www.opennms.com/en/blog/2020-04-29-opennms-meridian-2019-1-6-europa-released/
cover_image: https://i.imgur.com/74fmzvG.png
---

Release 2019.1.6 is the seventh release in the Meridian 2019 series.

It is an off-schedule release to fix a vulnerability in ActiveMQ and the Minion. Thanks to Florian Hauser of Code White for catching this one.

The codename for 2019.1.6 is [Europa](https://en.wikipedia.org/wiki/Europa).

### Bug

- Authenticated RCE vulnerability via ActiveMQ Minion payload deserialization (Issue [NMS-12673](https://issues.opennms.org/browse/NMS-12673))
First attempt at making a game using Scratch
Tags: codenewbie, computerscience
Published: 2020-04-29 17:58:00

Did I tell you guys I decided to make the most of the lockdown extension by taking Harvard University's online Intro to Computer Science course?

Well, last week for problem 0 I made a little game 🙈

I was excited to finish and get to share it with you guys whilst I was making it and then felt too shy to actually share it once I was done but I'm feeling brave again so here it is 🙈

It's a bit silly but I don't think it's too bad for a first attempt. Be nice 😂

https://scratch.mit.edu/projects/386365616

P.S they have loads of other free course if anyone else is interested. Full list here https://lnkd.in/d52WJsQ 😊
Interview Questions - 1
Published: 2020-04-29 17:57:10

I do the interviews, and very often I change questions, based on the position requested. But there are a number of questions that I particularly like, and I would like to share them with you. with what I think are the best answers. 

GitHub Repository:: https://github.com/FrancescoXX/InterviewsQuestions

Question:
{% twitter 1255214431820267520%}

Best Answers: 

{% twitter 1255219562775281664%}

{% twitter 1255219951650197506%}

{% twitter 1255278258460995584%}

{% twitter 1255290508630507520%}

{% twitter 1255234052015128581%}

{% twitter 1255215196521578500%}

{% twitter 1255246555197722626%}

{% twitter 1255359598774673408%}

{% twitter 1255286398543966209%}

{% twitter 1255542142723854337%}

{% twitter 1255361124234657793%}

GitHub Repository:: https://github.com/FrancescoXX/InterviewsQuestions
Courses, Project to learn Vue, Vuex and Vue-router for newbie
Tags: vue, vuex, vuerouter
Published: 2020-04-29 17:52:00

Hey there, as mentioned in the title, I am a beginner in front-end web development and recently I have been accepted for the trainee position in a web development company. I am not a fast learner but the given time for me to learn Vue and Vuex is quite tight. With that being said, I am willing to spend as much time as possible to learn and to have a hang of Vue, Vuex and Vue-router and I am willing to pay for the course if I have to.

Any suggestions will be much appreciated. Thank you!!
OpenNMS Meridian 2018.1.18 (Wildfire) Released
Tags: news, activemq, meridian, minion
Published: 2020-05-04 19:20:16

---
title: OpenNMS Meridian 2018.1.18 (Wildfire) Released
published: true
date: 2020-04-29 17:30:57 UTC
tags: News,activemq,Meridian,minion
canonical_url: https://www.opennms.com/en/blog/2020-04-29-opennms-meridian-2018-1-18-wildfire-released/
cover_image: https://i.imgur.com/74fmzvG.png
---

Release 2018.1.18 is an off-schedule release to fix a vulnerability in ActiveMQ and the Minion. Thanks to Florian Hauser of Code White for catching this one.

The codename for 2018.1.18 is Wildfire.

### Bug

- Authenticated RCE vulnerability via ActiveMQ Minion payload deserialization (Issue [NMS-12673](http://issues.opennms.org/browse/NMS-12673))
Shiny button hover effect with CSS
Tags: css, webdev
Published: 2020-04-29 17:00:17

This one is based on a shiny button I added to the navigation on [my portfolio site](https://joeattardi.codes).

It's done by having an `::after` pseudo element, which is a rotated rectangle, quickly zoom across over the button.

{% codepen https://codepen.io/thinksInCode/pen/zYvdwVW %}
Facebook Invests $5.7 Billion in India’s Jio Platforms
Tags: javascript, html, webdev
Published: 2020-04-29 17:16:59

Reliance Jio has already made a huge splash in India - and now Facebook just invested several billion: https://about.fb.com/news/2020/04/facebook-invests-in-jio/


I imagine this will bring even more users to Reliance Jio, which means developing for Jio just got more interesting.

Has anyone developed and released any apps on Jio devices?
Build a Flask web app by running one command!
Tags: python3, pip3, flask, webdev
Published: 2020-04-29 17:12:03

## About *buildflaskapp*
*buildflaskapp* is a command-line tool whose aim is to generate a minimal Flask application by simply running a command from your CLI.

### Demo
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/616smu6linhexstcc0xu.gif)

It has been tested on Linux and Window terminal interface and it should work without any problem. If you happen to encounter any kind of issue, please feel free to [raise an issue](https://github.com/askyourkode/buildflaskapp/issues/new).

### Installation
```
$ pip3 install buildflaskapp
```

### Official website
You can check out the [official website](https://buildflaskapp.kouul.website) to learn more about how to use the tool.

### Source code
The code is freely available [on Github](https://github.com/askyourkode/buildflaskapp) with an MIT license. Feel free to create issues or even pr if you think a new feature should be added.

## Additional Resources/Info
At the time of this writing, *buildflaskapp* supports few options that you can pass in when building the app; options such as adding bootstrap cdn, jQuery cdn and font-awesome cdn automatically.

[PyPi](https://pypi.org/project/buildflaskapp/)
[Github](https://github.com/askyourkode/buildflaskapp/)
[Official Website](https://buildflaskapp.kouul.website/)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zaxmxr50prvjp51lpyml.png)
About Ruby Hash#empty? and Hash#eql?
Tags: ruby, hash, documentation
Published: 2020-04-29 17:05:15

---
title: About Ruby Hash#empty? and Hash#eql?
published: true
description: 
tags: ruby, hash, documentation
---

Get more information and more examples at my AboutRuby project:
* [AboutRuby project empty?](https://github.com/BurdetteLamar/AboutRuby/blob/master/core/Hash/api/markdown.md#empty)
* [AboutRuby project eql?](https://github.com/BurdetteLamar/AboutRuby/blob/master/core/Hash/api/markdown.md#eql)

Here's the write-up over at the Ruby project:
* [Ruby project empty?](https://ruby-doc.org/core-2.7.0/Hash.html#method-i-empty-3F)
* [Ruby project eql?](https://ruby-doc.org/core-2.7.0/Hash.html#method-i-eql-3F)
10+ CSS Digital Clock Animation
Tags: javascript, webdev, beginners, css
Published: 2020-04-29 17:03:36

---
title: 10+ CSS Digital Clock Animation
published: true
tags: #javascript #webdev #beginners #css
---

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mm05fpoyo3ww6yixf334.jpg)

<p><B>If You Like This Article then check Out more Example [gscode.in]</B></p>
<H2>50+ CSS Digital Clock Animation</H2>
https://gscode.in/css-digital-clock-animation/



<p>1.Working CSS3 analog clock, using CSS animations and shapes, without any images or JavaScript.</p>


{% codepen https://codepen.io/iliadraznin/pen/JcqbE %}


<p>2.recreating the function of <a href="http://www.dewitt.ch/en/collections/academia/1543-mathematical.html">this watch</a></p>



{% codepen https://codepen.io/jakealbaugh/pen/ZYdYRO %}

<p>3.clock <a

{% codepen https://codepen.io/mattlitzinger/pen/ysowF %}

<p>4.I need to be a dribbble player?!</p>

<p>-Can someone give me a ticket?</p>

{% codepen https://codepen.io/mselmany/pen/vBeLG %}


<p>5.clock represented by glowing words. Based on this: <a 

{% codepen https://codepen.io/chrisdothtml/pen/BQbzoQ %}

<p>6.A circular calendar and clock display, with and added weather and daily activity widget mock-ups. </p>

{% codepen https://codepen.io/mattjuggins/pen/WGRRYx %}

<p>7.Based on a wallpaper</p>

{% codepen https://codepen.io/stix/pen/dXLKRA %}


<p>8.clock</p>
{% codepen https://codepen.io/putraaryotama/pen/wgwqBB %}

<p>9.Click the CLOCK to change the style.</p>

{% codepen https://codepen.io/V17h3m/pen/XdYEjR %}

<p>10.inspired from Black [ DD ] theme</p>

{% codepen https://codepen.io/vineethtrv/pen/GvROZV %}

<p>11.CSS Clock rebound of this shot </p>

{% codepen https://codepen.io/elrumordelaluz/pen/wurfC %}

<p>12.At the top left are the customization panel. Click on each item to change the appearance. Appearance is changed by adding/removing classes.</p>

{% codepen https://codepen.io/dtinth/pen/cGxhl %}


<p><B>If You Like This Article then check Out more Example [gscode.in]</B></p>
<H2>50+ CSS Digital Clock Animation</H2>https://gscode.in/css-digital-clock-animation/
Cypress and 401 Not Authorized Errors
Tags: cypress
Published: 2020-04-29 16:42:40

**Scenario**

 You have a configured command that opens Cypress, for us it was: *npm run cypress*. You have already written the test to go to a specific port, in our case it was 8080. As the site opens and you click on back-end related buttons, you see that a 401 not authorized message shows on any attempt to reach the back-end.

**Solution**
Install and Configure this [NTLM package](https://www.npmjs.com/package/cypress-ntlm-auth).

Apparently, Windows Authentication has some special concerns. This addresses that  issue so you can test at will.

JWP2020
Interview Preparation | Data Structure And Algorithms
Tags: webdev, computerscience, javascript
Published: 2020-04-29 16:34:54

Guys, I have created a repository on [Data Structure and Algorithms](https://github.com/rajeshberwal/revisiting-dsa)
And I'm also going explain it on my [blog](https://rajeshberwal.com).
Please make a contribution to it so people can get benefit from it.
Hierarchical Queries in SQL with C# and Entity Framework Core
Tags: sql, csharp, efcore, dotnet
Published: 2020-04-29 16:30:49

Hierarchies are very common in our lives and therefore in the problems we need to solve. The most familiar cases are organizations, products built from parts and other products, file systems etc.

When an hierarchy is stored in a database table, it's usually represented by rows referencing parent rows, recursively.

Suppose we want to query all the employees (directly or indirectly) reporting to a mid-level manager. Can we do that in SQL?

Of course there is a naive solution to select employees directly reporting to that manager, take their ids, perform the query again, etc. But clearly it's not efficient. Fortunately SQL has a standard support for [hierarchical queries](https://www.sqlservertutorial.net/sql-server-basics/sql-server-recursive-cte/) in a single and efficient query.

The following example demonstrates an hierarchical query using C# and EF Core using [ELINQ](https://entitylinq.com):

```cs
int? managerId = null; //external parameter - "highest" manager id

DbContext.Staffs.Query(() => {
    var org = SubQuery((Staffs managers, Staffs employees) => {
        var r = SELECT(managers);
        FROM(managers);
        WHERE(managers.ManagerId == managerId);

        UNION_ALL();

        var manager = r.Current();

        SELECT(employees);
        FROM(employees).JOIN(manager).ON(employees.Manager == manager);

        return r;
    });

    WITH(org);

    // At this point org "table" contains the employees we need.
    // We can SELECT, JOIN, or filter it as any other table.

    var result = SELECT(org);
    FROM(org);

    return result;
});
```

You can run this example "live" [here](https://try.entitylinq.com/docs/SqlServerTutorial/RecursiveCTE.md) or [learn more](https://try.entitylinq.com/) about EF Core and SQL integration.
![Where are you?](https://dev-to-uploads.s3.amazonaws.com/i/7jdqg295hds2ff8akb9v.png)
Twilio Hackathon - Day 3 Pt 2
Tags: twiliohackathon
Published: 2020-04-29 16:27:15

[Comment]: I have now added user persistence (woo!), but in doing so, I've created a bug where after signing in, you have to hit sign in a second time to go to the main user page. Whelp

#### What I built
An Omegle type product for first and second-degree friends in order to facilitate more spontaneous conversations 

#### Category Submission: 
Covid19 Communications

#### How I built it (what's the stack? did I run into issues or discover something new along the way?)
- Firebase Auth
- Firebase DB
- Twilio Video
- React & Material UI
- Python & Flask for Video API