teleren/devto huggingface dataset:
Windows PHP developement setup
Published: 2020-06-02 11:42:30

---
title: Windows PHP developement setup
published: true
description: 
tags: 
---

Hi, 

I've been developing PHP apps on my mac using Laravel Valet for quite some time. 

However, I recently also got a windows based pc on which I'd like to do some coding as well.  

But I'm currently struggling with the developement server setup.

Laravel Valet is dead simple and works like a charm, is there a similar alternative on Windows? 
I've tried WSL with Apache2 as well, however I'd like to avoid having to deal with vHosts configurations for each project. 

XAMMP isn't an option. 


Thanks!
Honeycomb-lx2k - Second day
Tags: aarch64, arm, Gentoo, linux
Published: 2020-06-02 11:39:15

The [Honeycomb-lx2k](https://developer.solid-run.com/knowledge-base/honeycomb-lx2k/) is a nice board with lots of potential, beside the boot/reboot quirk I mentioned in the previous post. 

> I do wonder if what I got is defective, hopefully I'll get some reply from the manufacturer later this week.

Yesterday I installed on it [Gentoo](https://gentoo.org) and it built everything as should so it seems working well at least as development board.

``` sh
$ qlop clang
2020-06-01T20:31:43 >>> sys-devel/clang: 48′54″
2020-06-02T10:28:35 >>> sys-devel/clang: 34′11″
```
The first one when build `clang` while building `gcc` in parallel, the second one building `clang` alone.

## Building a new kernel
I want to use on this machine few software that requires some kernel features:
- **portage**: It uses namespaces to sandbox the build process
- **lxd**: It uses cgroups, a number of networking features (veth, macvlan), namespaces and few netfilter modules get handy.
- **docker**: It uses more or less the same kernel features.
- **wireguard**: It needs few networking options to be really useful.

None of that is available and most of it cannot be built as module.

According to what I could see from the [image builder](https://github.com/SolidRun/lx2160a_build/blob/master/runme.sh) the kernel sources in use aren't mainline.
``` sh
$ git clone https://source.codeaurora.org/external/qoriq/qoriq-components/linux
$ git checkout -b LSDK-20.04-V5.4 refs/tags/LSDK-20.04-V5.4
```
Its default config is assembled by merging few defaults:
```
./scripts/kconfig/merge_config.sh arch/arm64/configs/defconfig arch/arm64/configs/lsdk.config $ROOTDIR/configs/linux/lx2k_additions.config
```

After this, I just issued the usual
``` sh
$ make menuconfig
$ make all -j 20
$ make modules_install
$ make install
```

And then I updated `extlinux/extlinux.conf` accordingly.
I did not change the `device tree` file so no strange dances with `u-boot-tools` were needed.

## Coming next
I'll have to complete some more configuration but it is fairly standard and not so interesting.

Soon I'll run some benchmarks to see how **rav1e** is behaving on a many-cores Aarch64 since [Vibhoothi](https://github.com/vibhoothiiaanand) is merging in some interesting [asm optimizations](https://github.com/xiph/rav1e/pull/2343) from **dav1d** and they will appear on the release 0.4.0.
Gitea 1.11 on OpenBSD: Update Failure
Tags: gitea, selfhosted, grep, openbsd
Published: 2020-06-02 11:26:58

This post is about updating [Gitea](https://gitea.io/) v1.11 in [OpenBSD](https://www.openbsd.org/) around 6.7.
Since v1.11, when making gitea with [its BSDmakefile](https://github.com/go-gitea/gitea/blob/master/BSDmakefile), I have met the error for some times like this:

```console
$ env TAGS="bindata" make -f BSDmakefile generate build
...
writing bindata.go
...
grep: repetition-operator operand invalid
Gitea requires Node.js 10.0.0 or greater and npm to build. You can get it at https://nodejs.org/en/download/
gmake: *** [Makefile:143: node-check] Error 1
*** Error 2 in /.../gitea (BSDmakefile:46 'FRC': "gmake" "--no-print-directory" generate build )
```
It happened, for example, to update 1.11.1 -> 1.11.2 and 1.11.5 -> 1.11.6.
This is because of not [Node.js](https://nodejs.org/) but grep module in OS.
It's actually because of the difference in using options between [GNU grep](https://www.gnu.org/software/grep/) and [OpenBSD's grep](https://man.openbsd.org/grep.1).

OpenBSD's default grep is like this:

```console
$ /usr/bin/grep --help
usage: grep [-abcEFGHhIiLlnoqRsUVvwxZ] [-A num] [-B num] [-C[num]] [-e pattern]
	[-f file] [-m num] [--binary-files=value] [--context[=num]]
	[--label=name] [--line-buffered] [pattern] [file ...]
```

The current solution I have found after struggling is installing `ggrep`. It is GNU grep as ports package.
To install it, run:

```console
# pkg_add ggrep
```

In the process of Gitea make, it's necessary to let running `grep` result in running /usr/local/bin/ggrep.
Therefore, I created the symbolic link and modified `$PATH` temporarily:

```console
$ ln -s /usr/local/bin/ggrep /(somewhere)/grep
$ export PATH="/(somewhere):$PATH"

$ # verify
$ # (1) $PATH begins with /(somewhere)
$ echo $PATH
/(somewhere) ... /usr/bin /bin /usr/sbin /sbin ... /usr/local/bin /usr/local/sbin
$ # (2) `grep` is GNU grep
$ grep --help
Usage: grep [OPTION]... PATTERNS [FILE]...
Search for PATTERNS in each FILE.
Example: ggrep -i 'hello world' menu.h main.c
```

Thus `ggrep` became used as `grep`.
Ready for make:

```console
$ env TAGS="bindata" make -f BSDmakefile generate build
```

It was successful 😃

To clean up temporary file and env, finally:

```console
$ rm /(somewhere)/grep

$ # reset $PATH
$ # case fish:
$ fish ~/.config/fish/config.fish
$ # else:
$ . ~/.profile
```

---

Optionally, there is a similar but more dangerous way...
This is my first solution.
Then I tried not to change /usr/bin manually and got the solution above 😅
Please be careful because there is a risk of deleting /usr/bin files by mistake in the below way:

```console
# # replace original `grep` with `ggrep`'s symbolic link
# mv /usr/bin/grep /usr/bin/grep_bk
# ln -s /usr/local/bin/ggrep /usr/bin/grep

$ env TAGS="bindata" make -f BSDmakefile generate build

# # recover original `grep`
# mv /usr/bin/grep_bk /usr/bin/grep
```
RecordDotSyntax in Haskell
Tags: functional, haskell, purescript
Published: 2020-06-02 11:20:38

You can keep reading here or [jump to my blog](https://odone.io/posts/2020-06-01-records-haskell.html) to get the full experience, including the wonderful pink, blue and white palette.

---


I started studying hardcore functional programming by fiddling with PureScript. Back then, using records felt natural since they are first-class citizens in the language:

```hs
-- PureScript

type Person = { name :: String, age :: Int }
type Company = { name :: String, owner :: Person }

display :: Company -> String
display c = c.name <> " is run by " <> c.owner.name

nameAfterOwner :: Company -> Company
nameAfterOwner c = c{name = c.owner.name <> "'s Company"}
```

When I switched to Haskell it took me ages to get used to the quirks of its record syntax:

```hs
-- Haskell

data Person = Person { personName :: String, personAge :: Int }
-- ^ Define a new type.
--            ^ Add constructor.
--                     ^ Prefix.
--                                           ^ Prefix.
-- Haskell automatically created
-- Person :: String -> Int -> Person
-- personName :: Person -> String
-- personAge :: Person -> Int

data Company = Company { companyName :: String, companyOwner :: Person }

-- Field names are prefixed, otherwise the program would not
-- compile because of the overlapping `name` getters.

display :: Company -> String
display c = companyName c <> " is run by " <> personName (companyOwner c)

nameAfterOwner :: Company -> Company
nameAfterOwner c = c {companyName = personName (companyOwner c) <> "'s Company"}
```

Of course some type system or category theory trickery would solve that but it just does not feel right for this specific use-case.

Luckily, the [RecordDotSyntax proposal](https://github.com/ghc-proposals/ghc-proposals/pull/282) has been accepted. We just need to hang tight while it gets implemented. But if you are like me and cannot wait to start using it, a [preprocessor](https://github.com/ndmitchell/record-dot-preprocessor) is available today!

In other words, using record-dot-preprocessor, the following code is valid Haskell:

```hs
-- Haskell

data Company = Company {name :: String, owner :: Person}
data Person = Person {name :: String, age :: Int}

display :: Company -> String
display c = c.name ++ " is run by " ++ c.owner.name

nameAfterOwner :: Company -> Company
nameAfterOwner c = c{name = c.owner.name ++ "'s Company"}
```

PureScript has a ton of other niceties. ["Differences from Haskell"](https://github.com/purescript/documentation/blob/master/language/Differences-from-Haskell.md) is a great read on that account.

---

What's your experience with records in Haskell? Hyped up about RecordDotSyntax? Let's talk on [Twitter](https://twitter.com/RiccardoOdone)!

---

Get the latest content via email from me personally. Reply with your thoughts. Let's learn from each other. Subscribe to my [PinkLetter](https://odone.io#newsletter)!
Xcode (SceneKit) vs. Unity
Tags: ios, unity3d, xcode
Published: 2020-06-02 10:36:35

Unity vs SceneKit: which tool you should use to build your ARKit app
Unity
- C#
- MacOS, Linux, Windows 10

Xcode
- Swift
- MacOS

Xcode is better if you are planing to make an app where AR is a feature. If you are planing to make cross-platform development, a lot of 3D content, special effects, and other game related things Unity is better.
Apple is offering 2D components like buttons that follow Apple's guidelines making sure the design is really good. Achieving the same quality with Unity requires much more work. Then in games there are not that much components you can take from Apple so it totally makes sense to use Unity as it contains things like physic calculations and better animations.
Unity is better for game development while Xcode is better for utility apps.
The Match-up: SceneKit or Unity for ARKit? | Hacker Noon
ARKit doesn't seem to have as good 3D editor as Unity allowing only do small things like rotate, position, change material, etc. but otherwise it needs to be done from the code.
Unity is better for quick prototyping but I believe it's even better to use something simpler https://www.notion.so/lankinen/AR-designing-cb85797b670e45f483422ff43886dd88 and then after that Xcode if the other reasons don't lead to Unity.


---

It seems like Unity is good for game development but Xcode wins when doing apps. The reasons seemed to be that it offers 2D components but as soon as the apple glasses are released, I believe that the platform will become better to develop only 3D content as the glasses probably don't have buttons.
React native listen position
Tags: react, reactnative, javascript, typescript
Published: 2020-06-02 11:02:11

I want to listen the position of a view I am moving with a pan responder. I am using the onLayout prop to get the width, height, x and y positions, but it only runs when the first render. Any ideas?

Here is the code:

import React, { useState, useRef } from "react";
import {
  View,
  Animated,
  PanResponder,
  Dimensions,
  StyleSheet,
} from "react-native";

const WINDOW_HEIGHT = Dimensions.get("window").height;

export default function Cropper({ photo }) {
  const [height, setHeight] = useState(WINDOW_HEIGHT / 2); // Use in future

  const pan = useRef(new Animated.ValueXY()).current;

  const panResponder = useRef(
    PanResponder.create({
      onStartShouldSetPanResponder: () => true,
      onPanResponderMove: Animated.event([null, { dy: pan.y }]),
      onPanResponderRelease: () => {
        pan.flattenOffset();
      },
    })
  ).current;

  onLayout = (event) => {
    const {
      nativeEvent: { layout },
    } = event;

    // Recalculate top and buttom views' height (setNativeProps)
  };

  const panStyle = {
    transform: pan.getTranslateTransform(),
  };

  return (
    <View style={styles.container}>
      <View style={styles.blurView} />
      <Animated.View
        onLayout={(event) => onLayout(event)}
        {...panResponder.panHandlers}
        style={[
          styles.cropper,
          panStyle,
          {
            height: height,
          },
        ]}
      />
      <View style={styles.blurView} />
      <View style={styles.bottomButtonsContainer}></View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  blurView: {
    flex: 1,
    width: "100%",
    backgroundColor: "rgba(0, 0, 0, .9)",
  },
  cropper: {
    width: "100%",
    backgroundColor: "red",
  },
  bottomButtonsContainer: {
    position: "absolute",
    bottom: 0,
    flexDirection: "row",
    justifyContent: "space-between",
    alignItems: "center",
    width: "100%",
    height: 120,
  },
});


What I am trying to do is get the middle view position when the user moves it, and then recalculate the top and buttom views' height.

https://stackoverflow.com/questions/62150096/react-native-on-layout-change-listen-view-position
Generic Interface for Binary Tree
Tags: csharp, oop
Published: 2020-06-02 10:50:38

A node in a binary tree can only have left and right child nodes. This structure can go deeper. As an effort to strongly-type this kind of data, I came up with below implementation of generic interface and class.

```csharp
public interface INode<T>
{
	T LeftNode { get; set; }
	T RightNode { get; set; }
	string Path { get; set; }
}

public class Node: INode<Node>
{
	public Node LeftNode { get; set; }
	public Node RightNode { get; set; }
	public string Path { get; set; }
}
```

`Node` class seems a little quirky because it passes its own type to `INode`.
You gave feedback and here is the result
Tags: webanalytics, privacy, opensource, webdev
Published: 2020-06-02 10:47:19

Thanks to everyone for their feedback on our first alpha test campaign. Many comments were made about the way we communicated our product. So we came up with some new material. Check out our website update:

[offen.dev](https://www.offen.dev/)

Again we are very excited to hear your feedback. 

Is our product clearly presented? What would you do differently? Will you give Offen a try?

Regards from Berlin!
JNation 2020: From Monolith to K8s
Tags: bpm, bpmn2, camunda
Published: 2020-06-02 12:40:20

---
title: JNation 2020: From Monolith to K8s
published: true
date: 2020-06-02 10:40:50 UTC
tags: basic,BPM,BPMN2,camunda
canonical_url: https://salaboy.com/2020/06/02/jnation-2020-from-monolith-to-k8s/
---

I was really happy to participate in this online edition of [JNation](http://jnation.pt). I would have preferred to be presenting in Portugal, but the quality of other speakers and the content that was presented at the conference was amazing.

During my presentation, I wanted to share pointers to tools and lessons learned while going from a big Java monolith to a more distributed approach. I touch quickly on two main concepts from DDD (Domain Driven Design) Bounded Contexts and Context Maps, without trying to define them too deeply but more to show some practical considerations derived from them while implementing real-life solutions. The presentation is heavily oriented to share insights on what to look at in certain situations, more than to dictate solutions.

The conference is still live here: [https://2020.jnation.pt/schedule/](https://2020.jnation.pt/schedule/)

## Slides & Video

<iframe src="https://www.slideshare.net/slideshow/embed_code/234858925" width="960" height="787" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>

https://www.slideshare.net/salaboy/jnation-2020-from-monolithto-k8s?ref=https://salaboy.com/

Video Link to be added when available

## Links

- Workshop Style Guide (work in progress, contributions are welcome): [https://github.com/salaboy/from-monolith-to-k8s](https://github.com/salaboy/from-monolith-to-k8s)
- Repositories: [https://github.com/salaboy?tab=repositories&q=fmtok8s](https://github.com/salaboy?tab=repositories&q=fmtok8s)
- Jenkins X: [http://jenkins-x.io](http://jenkins-x.io)
- Zeebe: [http://zeebe.io](http://zeebe.io)
- There were some questions about Saga Patterns, here are some links about what’s coming for Zeebe: 
  - [https://blog.bernd-ruecker.com/orchestrate-aws-lambda-using-camunda-cloud-8d27dc640f69](https://dev.to/berndruecker/orchestrate-aws-lambda-using-camunda-cloud-3nne-temp-slug-9350392)
  - What to expect being supported in Zeebe, already working in Camunda BPM: [https://blog.bernd-ruecker.com/saga-how-to-implement-complex-business-transactions-without-two-phase-commit-e00aa41a1b1b](https://blog.bernd-ruecker.com/saga-how-to-implement-complex-business-transactions-without-two-phase-commit-e00aa41a1b1b)

Congrats to all the organisers for such an amazing experience!

I look forward to the 2021 edition of [JNation](http://jnation.pt).
Sharing styles between apps inside Nx workspace
Tags: angular, nx, css, webdev
Published: 2020-06-02 10:11:14

In my current job we have decided to make the change into Nx workspace and with that we decided to create our very own Design System.

But I didn't want to maintain the same styles in more than one application.

## Creating a lib for styles

The best solution for my case was to create a **lib** named **ui** for the styles:

```
nx generate @nrwl/angular:library ui
```


Then I moved the sass files into the library:
![alt text](https://imgur.com/lwWAxt0.png "Files")



The problem now, is the _@import_ in all the scss files.
**How to make them recognize the correct files?**
On _angular.json_ on every project the path will have to be included.


```
"projects": {
	"ds-project": {
		"projectType": "application",
		...
		"architect": {
			"build": {
				...
				"stylePreprocessorOptions": {
					"includePaths": [ "libs/ui/src/lib/styles" ]
				},
				"extractCss": true,
				...
```


Now you can import the mixins on the scss files of your project just like if they were still part of the project:


```
@import "mixins/list_mixin";
@import "variables";

@include list_layout;
```


Even the base style, like font-family are importable.

Inside the **style.scss** of the project to became the global styles (for this case the module contains the global styles).


```
// styles.scss
/* You can add global styles to this file, and also import other style files */

@import 'module';
```


![alt text](https://memegenerator.net/img/instances/58459797/boom-problem-solved.jpg "Problem solved")

## Conclusion

This solves easily a problem that could be an issue and I was somehow afraid to tackle, that is having global scss files shared between applications and easily maintainable with only one source of truth (the library).

If you have any suggestion of how I could do this differently, please share your ideas.
Angular Single Class Binding
Tags: todayilearned, angular, css
Published: 2020-06-02 10:04:08

For today, I learned that there is a thing called "Class Binding" in Angular that allows me to have CSS override the existing Styling based on conditions.

    <div class="normal" [class.fullscreen]="isFullscreen">...</div>

My usecase is that a clicked div gets a different styling to highlight a selection!
Live coding my DEV/GftW Hackathon entry
Tags: gftwhackathon, machinelearning, coil, twitch
Published: 2020-06-02 09:43:48

I've had a great idea for a Grant for the Web / DEV hackathon entry...

There is a lot of crap in the world right now. A lot of people suffering from oppression worldwide. I love Twitter, but wouldn't it be nice to now and then just take a break (not to minimise what is going on) and just see Tweets that bring a bit of joy?

Welcome to Joyful Tweets! A filtered view of your timeline that tries to filter out some of the anger and just show the joy.

**I'm going to be live-coding my entry today** at 2pm BST / 9am EDT over on the [IBM Developer Twitch channel](http://ibm.biz/BdqKCL). I run a weekly live stream there called "[ML for Everyone](https://github.com/IBMDeveloperUK/ML-For-Everyone)" in which I live code something generally to do with machine learning, or data science. Generally it is in Python, but today will be in JS (watch me forget my braces!).

Come join me!
Build Polkadot: Network Launch Bounty Challenges in total worth of $6000
Tags: blockchain, rust, javascript, substrate
Published: 2020-06-02 09:24:47

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

Polkadot is live! This [first phase with a Proof of Authority (PoA)](https://polkadot.network/launch-poa) network opens up the floodgates for developers like you to become part of history as one of the first to build and use the Polkadot ecosystem. Ready for the challenge? To make it even sweeter, we are opening up three bounty challenges. Take your pick – create something related to:

1. **visualization**,
2. **tools**
3. or just **surprise us**!

There is a **total of $6k DAI** up for grabs. In each category, we have $2k DAI split among the top 3 submissions!

## [**-->All details, resources and ideas can be found on the Gitcoin page<--**](https://gitcoin.co/issue/Web3Foundation/build-polkadot/1/4391)

Happy hacking :)
Getting Puppet Report Metrics from PuppetDB
Tags: puppet, showdev, opensource, devops
Published: 2020-06-02 09:22:19

---
title: Getting Puppet Report Metrics from PuppetDB
published: true
description: Instead of sending metrics from the Puppetserver to Prometheus, they can be retrieved using the PuppetDB Metrics API.
tags: puppet, showdev, opensource, devops
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/jczukvqf1fs7dau9jnfp.png
series: Puppet Infrastructure Performance
---

Puppet agent run reports contain useful metrics, such as the number of resources that were modified or failed to apply, or how much time each step of the run took.

The traditional way of retrieving these metrics is using a report processor on the Puppet master.

Since Prometheus is now a *de facto* standard in metrics collection, there exists a [Prometheus reporter, maintained by the VoxPupuli community](https://github.com/voxpupuli/puppet-prometheus_reporter). However, it uses a dropzone directory of yaml files with a local node exporter, so it's not a very clean approach.

On top of this, reports and their metrics are already exported to the PuppetDB, which provides its own API to access this data.


# Prometheus PuppetDB Exporter


{% github camptocamp/prometheus-puppetdb-exporter %}


Prometheus PuppetDB Exporter is a simple go binary that can scrape the PuppetDB for report metrics for Prometheus. It runs independently of the Puppet stack, and can be tuned to collect various types of metrics:

* resources
* time
* changes
* events


The exporter provides metrics in the form `puppet_report_<type>` for each of these types.

```prometheus
# HELP puppetdb_exporter_build_info puppetdb exporter build informations
# TYPE puppetdb_exporter_build_info gauge
puppetdb_exporter_build_info{build_date="2019-02-18",commit_sha="XXXXXXXXXX",golang_version="go1.11.4",version="1.0.0"} 1
# HELP puppetdb_node_report_status_count Total count of reports status by type
# TYPE puppetdb_node_report_status_count gauge
puppetdb_node_report_status_count{status="changed"} 1
puppetdb_node_report_status_count{status="failed"} 1
puppetdb_node_report_status_count{status="unchanged"} 1
```

This makes it fully compatible with Vox Pupuli's reporter implementation.


# Deploying

The exporter is provided as a [Docker image](https://hub.docker.com/r/camptocamp/prometheus-puppetdb-exporter), and is included by default in [Camptocamp's PuppetDB Helm chart](https://github.com/camptocamp/charts/tree/master/puppetdb).



# Usage in Grafana


Coupled with (a slightly modified version of) [Julien Pivotto's Puppet Report dashboard](https://grafana.com/grafana/dashboards/700), you can make some pretty graphs from these metrics:

![Node graphs](https://dev-to-uploads.s3.amazonaws.com/i/jczukvqf1fs7dau9jnfp.png)