path aliases – [D8/Drupal8]: Pathauto pattern for a content type depending on a reference field?

This question is already asked here, but the answer selected does not work for Drupal8.

Description: There is a content-type, which has field, referencing taxonomy term. The term is in “Content class” dictionary. This term is used in views to filter the right content for the view. When a link in the view is clicked, it opens the node. This is OK.
So, it is needed pathauto to generate /Content class term/Content_title_name when this node is opened.

What is tried: (node:field_content_class:value)/(node:title). This is not accepted, produces error: Path pattern is using the following invalid tokens: (node:field_

The accepted (by Drupal) pattern: (node:field_content_class)/(node:title) generates alias, containing only the (node:title) part. The first component is empty.

This is made to not create separate content-types for nodes with the same fields.

unity – How can I convert List To Vector3 type?

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class Waypoints : MonoBehaviour
    public GameObject objectPrefab;
    public LineRenderer lineRenderer;
    public List<Transform> pointsToMove;
    public float speed;

    private List<GameObject> objectsToMove;

    void Start()
        objectsToMove = new List<GameObject>();

        //Spawn objects and start movement
        for (int i = 0; i < 3; i++)
            objectsToMove.Add(Instantiate(objectPrefab, transform.parent));

    private IEnumerator Move(int i)
        //Wait interval
        yield return new WaitForSeconds(i * 10);

        bool stillTraveling = true;
        int pointIndex = 0;
        float threshold = 0.1f;

        while (stillTraveling)
            //Check if close to point
            if (Vector3.Distance(objectsToMove(i).transform.position, pointsToMove(pointIndex).position) < threshold)
                //Check if can move next point
                if (pointIndex + 1 > pointsToMove.Count - 1)
                    stillTraveling = false;
                //If not stop moving

            //Move towards point
            objectsToMove(i).transform.position = Vector3.MoveTowards(objectsToMove(i).transform.position, pointsToMove(pointIndex).transform.position, speed * Time.deltaTime);

            yield return null;

    List<Transform> GetLinePointsInWorldSpace()
        pointsToMove = new Vector3(lineRenderer.positionCount).ToList();
        //Get the positions which are shown in the inspector 

        //the points returned are in world space
        return pointsToMove;

When the List is type Transform and I’m adding for example 3 empty gameobjects to the list then the objectsToMove will travel on this points.

but now I want the objectstoMove to travel over a LineRenderer positions and I have two problems.

  1. The script that create the positions to the linerenderer add the positions a bit later and because this script is running first I need somehow to wait first for the line renderer to have the positions then get them with the function GetLinePointsInWorldSpace.

  2. I’m getting errors in the GetLinePointsInWorldSpace function on this line :

    pointsToMove = new Vector3(lineRenderer.positionCount).ToList();

The pointsToMove is List but it’s getting List

and the line


pointsToMove is Transform but GetPositions return array of Vector3

  1. Where to start the Coroutine ? I can’t start it in the Start because the line renderer positions is still empty.

The main goal is to move the object on Transform points or Vector3 positions.
I thought there is a way to use one List for both options.

This script start the moving of the objectsToMove in the Start() but because the line renderer don’t have yet the positions.

This script create the positions and add them to the line renderer :

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class CurvedLineRenderer : MonoBehaviour
    public float lineSegmentSize = 0.15f;
    public float lineWidth = 0.1f;
    (Tooltip("Enable this to set a custom width for the line end"))
    public bool useCustomEndWidth = false;
    (Tooltip("Custom width for the line end"))
    public float endWidth = 0.1f;
    public bool showGizmos = true;
    public float gizmoSize = 0.1f;
    public Color gizmoColor = new Color(1, 0, 0, 0.5f);
    public static bool linesSet = false;
    private CurvedLinePoint() linePoints = new CurvedLinePoint(0);
    private Vector3() linePositions = new Vector3(0);
    private Vector3() linePositionsOld = new Vector3(0);

    private void Start()

    // Update is called once per frame
    public void Update()

    public void GetPoints()
        //find curved points in children
        linePoints = this.GetComponentsInChildren<CurvedLinePoint>();

        //add positions
        linePositions = new Vector3(linePoints.Length);
        for (int i = 0; i < linePoints.Length; i++)
            linePositions(i) = linePoints(i).transform.position;

    public void SetPointsToLine()
        //create old positions if they dont match
        if (linePositionsOld.Length != linePositions.Length)
            linePositionsOld = new Vector3(linePositions.Length);

        //check if line points have moved
        bool moved = false;
        for (int i = 0; i < linePositions.Length; i++)
            if (linePositions(i) != linePositionsOld(i))
                moved = true;

        //update if moved
        if (moved == true)
            LineRenderer line = this.GetComponent<LineRenderer>();

            //get smoothed values
            Vector3() smoothedPoints = LineSmoother.SmoothLine(linePositions, lineSegmentSize);

            //set line settings
            line.positionCount = smoothedPoints.Length;
            line.startWidth = lineWidth;
            line.endWidth = useCustomEndWidth ? endWidth : lineWidth;

            linesSet = true;

    void OnDrawGizmosSelected()

    void OnDrawGizmos()
        if (linePoints.Length == 0)

        //settings for gizmos
        foreach (CurvedLinePoint linePoint in linePoints)
            linePoint.showGizmo = showGizmos;
            linePoint.gizmoSize = gizmoSize;
            linePoint.gizmoColor = gizmoColor;

It was working fine with the List before but now I want it to move over the line renderer positions and not just on TRansforms. It could be better if the objectsToMove could move between Transform’s and/or line renderer positions at the same time.

google – type ‘Color’ is not a subtype of type ‘MaterialColor’ error in Flutter?

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _TypeError was thrown building Builder:
type ‘Color’ is not a subtype of type ‘MaterialColor’

The relevant error-causing widget was:
MaterialApp file:///D:/FlutterExercise/FlutterExercise/07/spanishaudioplayer/lib/main.dart:9:12

When the exception was thrown, this was the stack:
#0 new _HomePageState (package:spanishaudioplayer/HomePage.dart:22:35)
#1 HomePage.createState (package:spanishaudioplayer/HomePage.dart:7:35)
#2 new StatefulElement (package:flutter/src/widgets/framework.dart:4584:24)
#3 StatefulWidget.createElement (package:flutter/src/widgets/framework.dart:916:38)
… Normal element mounting (166 frames)
#169 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#170 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6094:32)
… Normal element mounting (300 frames)
#470 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#471 Element.updateChild (package:flutter/src/widgets/framework.dart:3306:18)
#472 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1182:16)
#473 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1153:5)
#474 RenderObjectToWidgetAdapter.attachToRenderTree. (package:flutter/src/widgets/binding.dart:1095:18)
#475 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2647:19)
#476 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1094:13)
#477 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:934:7)
#478 WidgetsBinding.scheduleAttachRootWidget. (package:flutter/src/widgets/binding.dart:915:7)
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)

W/InputMethodManager(14486): startInputReason = 8
W/IInputConnectionWrapper(14486): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper(14486): getTextBeforeCursor on inactive InputConnection
V/ActivityThread(14486): Finishing stop of ActivityRecord{801579c token=android.os.BinderProxy@63e470c {com.example.spanishaudioplayer/com.example.spanishaudioplayer.MainActivity}}
W/libEGL (14486): EGLNativeWindowType 0x76efee7010 disconnect failed
W/libEGL (14486): EGLNativeWindowType 0x7713667010 disconnect failed
V/ActivityThread(14486): Handle window ActivityRecord{801579c token=android.os.BinderProxy@63e470c {com.example.spanishaudioplayer/com.example.spanishaudioplayer.MainActivity}} visibility: false


import 'package:flutter/material.dart';
import 'HomePage.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Spanish Audio Numbers',
      theme: ThemeData(
        primarySwatch: Colors.teal,
      home: HomePage(),


import 'package:flutter/material.dart';
import 'package:audioplayers/audio_cache.dart';
import 'NumberAudio.dart';

class HomePage extends StatefulWidget {
  _HomePageState createState() => _HomePageState();

class _HomePageState extends State<HomePage> {
  AudioCache audioPlayer = AudioCache();
  List<NumberAudio> audioList = (
    NumberAudio("one.wav",, "one"),
    NumberAudio("two.wav",, "two"),
    NumberAudio("three.wav",, "three"),
    NumberAudio("four.wav",, "four"),
    NumberAudio("five.wav", Colors.purple, "five"),
    NumberAudio("six.wav", Colors.cyan, "six"),
    NumberAudio("seven.wav",, "seven"),
    NumberAudio("eight.wav", Colors.grey, "eight"),
    NumberAudio("nine.wav", Colors.yellow, "nine"),
    NumberAudio("ten.wav",, "ten"),
  play(String audioFile) async {;

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'Spanish Numbers',
          style: TextStyle(
            color: Colors.white,
            fontSize: 24.0,
            fontWeight: FontWeight.bold,
        //backgroundColor: Colors.teal,
      body: Center(
        child: Column(
          children: (
              image: AssetImage("images/logo.png"),
              child: GridView.builder(
                padding: EdgeInsets.all(10.0),
                gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                  childAspectRatio: 1.0,
                  crossAxisCount: 2,
                  crossAxisSpacing: 5.0,
                  mainAxisSpacing: 5.0,
                itemCount: audioList.length,
                itemBuilder: (context, index) => SizedBox(
                  height: 50.0,
                  width: 100.0,
                  child: RaisedButton(
                    child: Text(
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 24.0,
                        fontWeight: FontWeight.bold,
                    color: audioList(index).buttonColor,
                    onPressed: () {


import 'package:flutter/material.dart';

class NumberAudio {
  String audioFile;
  MaterialColor buttonColor;
  String buttonTitle;
  NumberAudio(String audioFile, MaterialColor buttonColor, String buttonTitle) {
    this.audioFile = audioFile;
    this.buttonColor = buttonColor;
    this.buttonTitle = buttonTitle;


audio files are in the assets folder and the logo is in images folder.

java – Optional int parameter ‘id’ is present but cannot be translated into a null value due to being declared as a primitive type

me encuentro con un error que no sé por donde cogerlo. Estoy realizando un api/rest de android studio (RetroFit) con SpringBoot (como servidor).
Resulta que me encuentro con este error:

 Optional int parameter 'id' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

Expongo retrofit interface:

    Call<PlayerDto> editPlayer(@Body PlayerDto player, @Path("id") int id);

Expongo llamada al servidor:

.editPlayer(editedPlayer, 53)
.enqueue(new Callback<PlayerDto>() {
   public void onResponse(Call<PlayerDto> call, Response<PlayerDto> response) {
      editedPlayer = response.body();
      typeError = 0;

   public void onFailure(Call<PlayerDto> call, Throwable t) {
      Log.e("Error: ", t.getMessage());
      typeError = 2;

Expongo servidor Controller:

    public Player editPlayer(@RequestBody Player player, @Param("id") int id) {
        return service.editPlayer(player.getUsername(), id);

Expongo servidor PlayerService:

public Player editPlayer(String username, int id) {

        repoPlayer.editUserNamePlayer(username, id);
        Optional<Player> player = repoPlayer.findById(id);

        return player.get();

Expongo IPlayerRepository, aunque solo es la “Query” :

    @Query("UPDATE Player p SET p.username= :username WHERE :id")
    public void editUserNamePlayer(@Param("username")String username, @Param("id") Integer id);

Realizo pruebas con Insomnia y no tengo ningún problema adjunto imagen:
imagen de captura test insomnia put api/rest

Pero no tengo manera de enviar la id desde android studio, parece que se le envia “null”.
Ni ingresandolo a mano ni recogiendolo por parámetro.

Necesito ayuda, muchas gracias de antemano.

postgresql – Generic data type that belongs to “something”, where the same data type/shape can belong to multiple tables

In postgres one often has one-to-many tables, where multiple entities in table B refer to one element in table A.

But can this also be used the generalize data shape, where I have a generic shape of data store in table B, but it can either belong to an entity in table A or table C? Is there a clean way to do this without DRY nor with redundant “empty” fields?

Say I have a class “time period” – which would include an id, start_date, end_date. Now I have two tables A and C where each entry in those table both have time periods, for the rest there’s little in common between those tables.

The earlier solution I would make is a time_period_a and a time_period_b table to copy the format of the time period. But this violates DRY, and I’ve experience lots of troubles with this violation (say in one table I forgot to update the dates to now include timezone).

I’ve also thought about adding both columns for a and b, and setting them to NULL if not needed. But this creates a lot of trouble where I have to add either some triggers or complexity to prevent both be NULL or both be not NULL.

What is the canonical solution for this? Is there a way to store -in the field, not in the column- that the field refers to a specific table id? Instead of just a generic number and then get from the logic of the column/foreignkeyconstraint which table it refers to?

Does the miner machine get any other type of reward except confirmation of transaction in bitcoin?

As a result of mining, miners receive income from two sources

  • The mining reward per block, which halves approximately every 4 years.
  • The transaction fees for the transactions the miner includes in the block.

Nothing else.

The miner includes as the first transaction in the block (the “coinbase” transaction) a transaction with no inputs and with outputs to one or more addresses of their choice with a total amount which is less than or equal to the sum of other included transactions fees and the current mining reward .

bitcoin core – the two miner type of reward

the definition of a block in the blockchain is
“A block records some or all of the most recent Bitcoin transactions that have not yet entered any prior blocks. Thus, a block is like a page of a ledger or record book. Each time a block is ‘completed’, it gives way to the next block in the blockchain.”
this is acceptable miners get a reward for proof of work(confirm transactions)
but what exactly do miners when say they have a process for creating a block(and get a reward for them)?
(In other words what exactly this process? Is it possible to remove it?)

data structures – Reverse An Array whats wrong with this type of code?

data structures – Reverse An Array whats wrong with this type of code? – Computer Science Stack Exchange

entities – Add new default value to existing content type

I’m currently on the latest version of Drupal 8. I have a content type called News and Articles. In this content type I have a field called Category which is a taxonomy term -> Entity reference field. When I first created this content type I added all my categories as default values.

Now 2 years later I want to add another default value to this content type. All the answers I’ve seen so far deal with making the change through the database. I wanted to see if there was a different option? Reason is because I have about 400 pages using this content type, really don’t want to make a new one.

Here a screenshot to the list I want to add to:

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive New Proxy Lists Every Day Proxies123