json – Clickable href with the attachments

I have a list with the following columns

Job Description (Single Line of Text)
Attachments

and also i got a Column named “internLink” which contains the exakt name of the document which is attached.

Now i wanted to ask, if it is possible to just get the document name of the attachment with json an insert it into a json href?

Thanks in advance

Oliver

TYPO3 JSON variables in viewhelper

How could I use JSON variables in a fluid viewhelper? For example when I am getting the image path property from a model in the JSON form, and try to use it for the src value with template string like this, it wont work.

<f:image src="${jsondata.imagePath}" alt="alt text" />

javascript – Pretty print directory structure in a JSON recursively

I am trying to pretty print the folder structure defined in a JSON. I do have a solution using recursion but I’m looking for feedback on how this solution can be improved or if there’s any better approach.

Problem Statement

A deeply nested directory contains following information:

  1. Name
  2. Data (can be an array of sub directories or file content)

Desired output: Print the directory structure in below format:

root_dir
|__dir_a
|____file_00.txt
|____dir_b
|______dir_c
|________file_01.txt
|________file_02.txt
|________file_03.txt
|________file_04.txt
|______file_05.txt
|______file_06.txt
|____dir_d
|______file_07.txt
|______file_08.txt

Solution:

My idea is to traverse data recursively till a file is not found (because beyond it there is no further nesting) and keep pushing directories and files in an array which would then be pretty printed with help of template literals.

P.S. I don’t want to reverse the arrays twice, how can I fix that?

const indentation = 2;
const flatDirStructure = ();

const dirStructure = (
  {
    name: 'root_dir',
    data: (
      {
        name: 'dir_a',
        data: (
          { name: 'file_00.txt', data: 'file_00 content' },
          {
            name: 'dir_b',
            data: (
              {
                name: 'dir_c',
                data: (
                  { name: 'file_01.txt', data: 'file_01 content' },
                  { name: 'file_02.txt', data: 'file_02 content' },
                  { name: 'file_03.txt', data: 'file_03 content' },
                  { name: 'file_04.txt', data: 'file_04 content' }
                )
              },
              { name: 'file_05.txt', data: 'file_05 content' },
              { name: 'file_06.txt', data: 'file_06 content' }
            )
          },
          {
            name: 'dir_d',
            data: (
              { name: 'file_07.txt', data: 'file_07 content' },
              { name: 'file_08.txt', data: 'file_08 content' }
            )
          }
        )
      }
    )
  }
);

const flattenDirStructure = (data, depth) => {
  if (typeof data === 'string') {
    return true;
  } else {
    data.reverse().forEach(({ name, data }) => {
      const isFile = flattenDirStructure(data, depth + indentation);

      flatDirStructure.push({
        name,
        depth,
        isFile,
      });
    });

    return false;
  }
};

const prettyPrint = () => {
  const output = ();

  flatDirStructure.reverse().forEach(({ name, depth }) => {
    const indentation = new Array(depth).fill('_').join('');
    output.push(`${indentation ? '|' : ''}${indentation}${name}`);
  });

  console.log(output.join(`n`));
}

flattenDirStructure(dirStructure, 0);
prettyPrint();

como leer un archivo Json en android

este es el archivo json

({“user_relacion”:5,”notif”:”relacion”,”latitud”:0.490274,”longitud”:-74.563262,”fecha”:”2020-10-22″,”plac”:”123qwe”},{“user_relacion”:5,”notif”:”acorde”,”latitud”:2.490274,”longitud”:-76.563262,”fecha”:”2020-10-22″,”plac”:”123qwe”})

Así he tratado de extraer la información con la clave notif

  try {
       String myJsonString= "notif";
       JSONObject myJsonjObject = new JSONObject(myJsonString);
       String myJson = myJsonjObject.getString("text");
       Toast.makeText(getContext(), ""+myJson, Toast.LENGTH_SHORT).show();
       } catch (JSONException e) {
          e.printStackTrace();
       }

java – Como enviar um campo JSON e uma imagem na mesma requisição POST no spring boot?

Eu estou precisando criar uma entidade enviando seus dados e ao mesmo tempo fazer upload de uma imagem. Isso é pra que eu possa dizer que a imagem faz parte da entidade, e a partir do Cascade isso vai ser refletido no banco de dados.
A criação de ambos separadamente funciona tranquilamente. Consigo criar uma Entidade e fazer o upload de imagem, mas não consigo fazer isso em uma mesma requisição

Eu estou tentando fazer algo assim:

inserir a descrição da imagem aqui

Onde o primeiro campo possui os dados do Bga:
inserir a descrição da imagem aqui

E no segundo simplesmente tem a imagem que estou querendo fazer upload

O intuito é fazer com que a imagem pertenca ao Bga, com o Cascade o id de Bga vai ficar como chave estrangeira na tabela de Imagem

Eu não sei se é assim a forma de se fazer isso, por isso estou aqui pedindo ajuda.

Estou utilizando o JPA para ambas as entidades

O método de salvar a imagem:

@Service
public class FileStorageService {
    
    @Autowired
    private ImagemRepository imagemRepository;

 public Imagem salvar(MultipartFile file) throws IOException {
        String fileName = StringUtils.cleanPath(file.getOriginalFilename());
        Imagem Imagem = new Imagem(fileName, file.getContentType(), file.getBytes());

        return imagemRepository.save(Imagem);
    }
}

A requisição POST onde estou tentando fazer a criação:

 @PostMapping
    public ResponseEntity<Bga> criarBga(@ModelAttribute @RequestParam("bga") Bga bga, @RequestParam("file") MultipartFile file) throws IOException {
        bgaRepository.save(bga);

        fileStorage.salvar(file);

        return ResponseEntity.status(HttpStatus.OK).body(bga);
    }

Entidade Bga:

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name="BGA")
public class Bga implements Serializable {
    
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private long id_bga;
    
    
    private String nome;
    
    private int num_bga;
    

    @OneToMany(mappedBy = "bga", cascade = CascadeType.ALL)
    private List<Imagem> imagens;
    
    public Bga() {
        
    }


    

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public int getNum_bga() {
        return num_bga;
    }

    public void setNum_bga(int num_bga) {
        this.num_bga = num_bga;
    }

    public long getId_bga() {
        return id_bga;
    }

    public void setId_bga(long id_bga) {
        this.id_bga = id_bga;
    }

    public List<Imagem> getImagens() {
        return imagens;
    }

    public void setImagens(List<Imagem> imagens) {
        this.imagens = imagens;
    }

    public Bga(String nome, int num_bga) {
        this.nome = nome;
        this.num_bga = num_bga;
    }
    
    
    
    
}

Entidade Imagem:

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;


@Entity
public class Imagem {
    
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Long id_imagem;

    private String name;

    private String type;

    @Lob
    private byte() imagem;

    @ManyToOne
    @JoinColumn(name = "id_bga", referencedColumnName = "id_bga")
    private Bga bga;


public Imagem() {

    }
    
    public Long getId_imagem() {
        return id_imagem;
    }

    public void setId_imagem(Long id_imagem) {
        this.id_imagem = id_imagem;
    }

    public byte() getImagem() {
        return imagem;
    }

    public void setImagem(byte() imagem) {
        this.imagem = imagem;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Imagem(String name, String type, byte() imagem) {
        this.name = name;
        this.type = type;
        this.imagem = imagem;
    }

    public Bga getBga() {
        return bga;
    }

    public void setBga(Bga bga) {
        this.bga = bga;
    }

O erro retornado é esse:

inserir a descrição da imagem aqui

php – Json, GeoJSON, agrupar resultado de consulta postgresql

Estoy experimentando con los Clusters a partir de un fichero GeoJSON generado a partir de una consulta postgresql. Hago la consulta y escribo el fichero. Según como lo hago, cada una de los observaciones que están en la bbdd, en el Cluster genera un punto, pero hay observaciones que comparten id, pq tienen más de una imagen, por ejemplo. Mi duda es como generar el GeoJSON para que salgan agrupadas las observaciones en función del id, y una observación que tenga 2 imagenes, por ejemplo, no salga como dos puntos, si no como uno solo.
La query y el fichero lo genero de este modo:

$query = "Select a_code, name, id_observation, long_4326, lat_4326, obs_date, id_observation_font, 
id_image_observation, main_co, author, image, ST_AsGeoJSON(geom, 7) AS geojson FROM observations WHERE id_observation_font != 3 ORDER BY id_observation";

$result = pg_query($query) or die('Query failed: ' . pg_last_error());
$geojson = array(
    'type' => 'FeatureCollection',
    'features' => array()
);
$i = 0;
while ($line = pg_fetch_assoc($result)) {
    $feature = array(
        'type' => 'Feature',
        'id' => $i++,
        'properties' => $data()=$line,
        'geometry' => json_decode($line('geojson'), true),
    );
    array_push($geojson('features'), $feature);
}
$localiza = json_encode($geojson, JSON_UNESCAPED_UNICODE);
$conta = "../data/observations.json";

El JSON (GeoJSON) que obtengo sale de este modo:

{
    "type":"Feature",
    "id":22,
    "properties":{
        "a_code":"151",
        "name":"one Name",
        "id_observation":"51",
        "long_4326":"-x.xxx",
        "lat_4326":"xx.xxx",
        "obs_date":"2015-03-17",
        "id_observation_font":"1",
        "id_image_observation":"30",
        "main_co":"f",
        "author":"John",
        "image":"data/IMG1.JPG",
        "geojson":"{"type":"Point","coordinates":(-x.x,xx.xx)}"},
        "geometry":{
            "type":"Point",
            "coordinates":(-x.x,xx.xx)}
    },
    {
        "type":"Feature",
        "id":23,
        "properties":{
            "a_code":"151",
            "name":"one Name",
            "id_observation":"51",
            "long_4326":"-x.xxx",
            "lat_4326":"xx.xxx",
            "obs_date":"2015-03-17",
            "id_observation_font":"1",
            "id_image_observation":"29",
            "main_co":"f",
            "author":"John",
            "image":"data/IMG2.JPG",
            "geojson":"{"type":"Point","coordinates":(-x.x,xx.xx)}"},
            "geometry":{
                "type":"Point",
                "coordinates":(-x.x,xx.xx)}
    },
    {
        "type":"Feature",
        "id":24,
        "properties":{
            "a_code":"715",
            "name":"other name",
            "id_observation":"52",
            "long_4326":"-x.xxx",
            "lat_4326":"xx.xxx",
            "obs_date":"2015-06-01",
            "id_observation_font":"1",
            "id_image_observation":"31",
            "main_co":"t",
            "author":"Phill",
            "image":"data/IMG32.JPG",
            "geojson":"{"type":"Point","coordinates":(-x.x,xx.xx)}"},
            "geometry":{
                "type":"Point","coordinates":(-x.x,xx.xx)}
    }

Como veis, la observación 51 tiene varias imágenes, pero no lo obtengo agrupado. En realidad no se si se puede hacer, por eso lo pregunto.

Saludos

json rpc – RPC security of bitcoind node

If I have a fairly default bitcoin.conf file, let’s say:

rpcport=8332
txconfirmtarget=6

ie: notably one where I don’t specify things like rpcuser, rpcpassword – is this insecure?

As I understand, this lets the node be queried locally without an authentication. However I’m not sure this is any more dangerous than wallet.dat sitting around – local access would mean private key access.

Are default settings of bitcoin insecure?

Drupal 8, JSON API, return nodes by JWT

There are four “Book” entities, two entities belong to the author – Jon, two other entities belong to the author – Ann. I am Jon. By the user name and password, I have got a JWT (I use OAuth authentication). Then I use JSON:API and perform GET request with Header Authorization: Bearer eyJ0eXAiOiJKV1…(JWT) to receive “Book” entities. Can I select by JSON:API only TWO “Book” entities that belong to me? Not all FOUR entities? Thanks a lot )))

python – How to convert an xml with nested nested array to json newline delimited based on a predefined scheme

I have a very complex xml file that I got from an API with nested nested array. For example for an ID I have seasons and each season has cast with multiple members with firstname, lastname, and role:

<id=1>
     <seasons> 
             <season seasonNumber="1"> 
                     <cast><member =1> <firstname>xxxxx</firstname>
                                       <lastname>xxxxx</lastname> 
                                       <role>xxxxx</role></member>   
                           <member =2> <firstname>ccccc</firstname>
                                       <lastname>cccc</lastname> 
                                       <role>cccc</role></member> 
                           <member =3> <firstname>ccccfff</firstname>
                                       <lastname>ccfff</lastname></member></cast></season>
             <season seasonNumber="2"> 
                     <cast><member =1> <firstname>xxxxx2</firstname>
                                       <lastname>xxxxx2</lastname> 
                                       <role>xxxxx2</role></member>   
                           <member =2> <firstname>ccccc2</firstname>
                                       <role>cccc2</role></member> 
                           <member =3> <firstname>ccccfff2</firstname>
                                       <lastname>ccfff2</lastname></member></cast></season>
    </seasons>
</id>

tags under members are all optionals and for one member I may not get role or lastname but I know the defined scheme of xml. I want to convert the xml to a json file with newline delimited format in python in order to sent it to Bigquery.

I have tried different libraries but as the tags can be missing in one API response and be present in another API response, couldn’t figure out how to impose the defined scheme when creating the json file. Any hints?

tooltip column on hover a column in SharePoint List Using JSON- Modern List View

I need to show the description of column as a tooltip when a user hover a mouse on a column, I am doing this based on Adding custom hover text using json to a SharePoint list column

But I need to enter the description manually rather than reading the description of the column that I put there for that column.

see below:

enter image description here

enter image description here

enter image description here

If I change “txtContent”: “[$Description]”, to “txtContent”: “This is the desciption”, it works fine, is there any way to fix the previous issue and get the description rather than entering a new description here as txt
enter image description here