Categories
Database Development

How to optimize selection of pairs from one column of the table (self-join)?

I have a table where one row is – user’s name, place he attended, time when he was there I need to select all pairs of places where any user was (if user was at place a and place b i need row like this: user, place a, place b, time at place a, time […]

Categories
Mastering Development

How to loop a 2D array and store objects?

Im trying to store objects into the array. I tried using the 2D array loop and im not getting the right results that i want. Can i know what is wrong and how do i fix it? Its printing 15 times instead of 5 times just like how i want the output stated below. Input: […]

Categories
Mastering Development

How to retrieve the final data using promises? [duplicate]

I know this is a duplicated question of How to return many Promises in a loop and wait for them all to do other stuff I did the same thing as thing as it did but im still getting all pending promises. Can someone help me with this? // http requests const getJSON = require(‘get-json’); […]

Categories
Development

How to search for a hash key value in an array of hashes

I have an array of hashes: array = [ {:name => “Bob” , :age => 27 , :place => “A”} , {:name => “John” , :age => 50 , :place => “B”} , {:name => “Alex” , :age => 80 , :place => “C”} ] I want to get the value of :place if :name […]