Posts

Showing posts from February 13, 2019

Store and query NxN matrix

Image
0 I am looking for a way to store and query a N x N matrix. The data will no change frequently. The search must be fast. I have to be able to query the distance (and any other data stored as flights, bus, trains, others) from any city to other. Example: From NY to Boston: Distance: 215 mi, Data: No trains. From Boston to NY: Empty. From Washington DC to NY: Distance: 225 mi, Data: - To represent the data I made a matrix I am working with mongoDB as a database. First option: I am thinking in representing any row of the matrix as a document. city: "NY", destinations: [ city:"Boston", distance: "215 mi", data: "no trains", city:"Washington DC", distance: "226 mi", data: "" ] Cons: Some documents have an array near 4000 destination cities. Pros: there are only 4000 documents in the collection. Second Option : Create a document with any connection of cities: Example: from: "NY", to: "Bo...

Flughafen Diyarbakır

Image
Diyarbakır Havalimanı Kenndaten ICAO-Code LTCC IATA-Code DIY Koordinaten 37° 53′ 38″  N , 40° 12′ 4″  O 37.893897222222 40.201019444444 686 Koordinaten: 37° 53′ 38″  N , 40° 12′ 4″  O 686 m (2251 ft) über MSL Verkehrsanbindung Entfernung vom Stadtzentrum 3–6 km westlich von Diyarbakır, Turkei  Türkei Basisdaten Eröffnung 1952 Betreiber DHMI Terminals 1 Passagiere 2.043.767 [1] (2018) Start- und Landebahn 16/34 3549 m × 45 m Beton i1 i3 i8 i10 i12 i14 Der Flughafen Diyarbakır , (türkisch Diyarbakır Havalimanı ) ist ein türkischer Flughafen unmittelbar südwestlich der Stadt Diyarbakır im Südosten des Landes. Er wird durch die staatliche DHMI betrieben. Der Flughafen wurde ursprünglich 1952 gebaut und ist nach etlichen Umbauten weiterhin ...

how to call async function in .on event nodejs

Image
-1 I am reading a CSV file using csv-parser npm module createReadStream. export default async function main() const readstream = fs.createReadStream('src/working_file.csv'); stream.on('data', data => const val = await fun(param1, param2, param3); ); fun(param1, param2, param3) return true; I have to call function fun with await but it is throwing me the error. await is only valid in async function . Can anyone help me how to fix this? javascript node.js events share | improve this question asked Nov 13 '18 at 13:05 m9m9m m9m9m 497 5 12 add a comment  |  -1 I am reading a CSV file using csv-parser npm module createReadStream. export default async function main() const readstream = fs.createReadStream('src/working_file.csv'); stream.on('data', data => const val = await fun(param1, param2, param3); ); fun(param1, param2, param3) return true; I have to call function fun wit...