Tuesday, August 20, 2019

Convert JSON to CSV Format

This is common thing now a days we have all data in JSON and when we have to sent it as a csv file we need to convert. Following code found stackoverflow.com, and credit goes to developer. I am putting into my blog for easy access and reference to my blog reader.

//logData is the JSON object having json data, rest of the code do the job.

const items = logData
const replacer = (key, value) => value === null ? '' : value 
const header = Object.keys(items[0])
let csv = items.map(row => header.map(fieldName => JSON.stringify(row[fieldName], replacer)).join(','))
csv.unshift(header.join(','))
csv = csv.join('\r\n')

console.log(csv)


Thursday, August 8, 2019

The Fastest Way to Your Share Location from an iPhone


There are a couple ways to share your location, but this might be the quickest! Here's how to share your location from your iPhone in a text message using predictive text. For this tip, you'll have to have both Predictive Text and Location Services enabled. And if you're not connected to Wi-Fi, you'll have to enable Apple Maps too.

How to Share Directions in Apple & Google Maps

If you're meeting up with someone in a large area like a park or can't talk on the phone to give directions, sharing your location in a text message can really help! To do this:

Open a new or previously opened text chat with the person you want to share your location with.

  1. Type the phrase "I'm at" and press the spacebar after the word "at".
  2. In the predictive text area of the keyboard, tap Current Location.
  3. The other person will be sent your location via Apple Maps.
  4. Notice that only the map will show up in the text chat. You'll need to press the blue arrow to send the text message you've typed.

Reference from site : iphonelife.com