Categories
Development

Show Divs & Array Object Text When Option Selected

I have an array of objects inside script tags inside my HTML file: var people = [ { name: “Bob Smith”, age: 27, hobbies:”painting” }, { name: “Sam Smith”, age: 28, hobbies:”cooking” }, name: “Sara Smith”, age: 22, hobbies:”jogging” ] function showDiv(divId, element){ document.getElementById(people).style.display; if(M.click) // I previously put male image id’s here to display […]

Categories
Development

How can I force error validation for the all elements in collection?

I have a collection of objects and their “valid” valid state depends on different properties, unrelated from the collection. So, When I change the condition and add a new item to the collection, I got the item with error, but the “valid” state of previous items in the collection do not change. How can I […]

Categories
Development

Recursively find item in array and splice out found item from the reference array

I’m trying to find item in an array of objects recursively and then rebuild the same array but without the found item in it. When the item is found I’d like to splice it out from the reference array. Below is my attempt, but unfortunately it’s not working at all. var tt = [{ age […]

Categories
Development

Codable Handle Single or Array

Our API sends single object in data when the array contains one element: { “data”:{ “name”:”ABC”, “age”:”26″ } } But when there are more elements in array then the response is in array { “data”:[{ “name”: “ABC”, “age” : “26” }, { “name”: “XYZ”, “age” : “22” }] }

Categories
Development

Add link tag to each row in table and open modal

Below is my HTML file with my markup with table populated from JSON. Trying to add an link tag (a href=”#”) on each row, the link should have onClick event to open modal with its object content. its object name, surname & age I created var link = document.createElement(“a”), but not sure how o append […]

Categories
Development Python

Return value according to desired layout in tkinter (Python 3)

I manage to return all the values but how do i put to a layout in Tkinter? I have a text file that has all the values there and would like to make the layout as per the picture click to view the desired layout. I appreciate the help. thank you. from tkinter import * […]

Categories
Development Java

Java Jersey/Jackson: return dynamic JSON properties

We use jackson to deserialize java objects (DTO’s) towards JSON for our endpoints. This works well. However, I have a bit on an odd question. Let’s say we have an object User, and we have metadata attached to this user. The metadata can really be anything the client can think of, so this is very […]

Categories
Development

Create Dictionary using List

I am trying to create a Dictionary with the following data: ListA = [‘Name’, ‘Age’, ‘Gender’] ListB = [‘Alex’, ’22’, ‘Male’] [‘Kelly’,’21’, ‘Female’] ListB comes from FileB and looks like this: Alex 22 Male,Kelly 21 Female (values tab separated, group comma separated) Expected output: {‘Name’ : ‘Alex’, ‘Age’ : ’22’, ‘Gender’ : ‘Male’, ‘Name’ : […]

Categories
Development

sort an array with react hooks

I’m doing a simple sort of an array with react hooks, but its not updating state. Can anyone point out what I’m going here? import React, { useState } from “react”; import ReactDOM from “react-dom”; import “./styles.css”; const dogs = [{ name: “fido”, age: 22 }, { name: “will”, age: 50 }]; function App() { […]