Posts

Showing posts from September, 2018

React Native error - Cannot find module 'metro-react-native-babel-preset'

Image
I created a React native app using "react-native init <App Name> " but received below error when try to run it in Simulator: Cannot find module 'metro-react-native-babel-preset' I resolved the error by adding below line under "dependencies" in package.json.     "@babel/runtime": "^7.0.0-beta.55"  Run "npm i", and then run the app successfully. :) Further Study     I had been studied the online course " The Complete React Native and Redux Course ", it gave me the clear explanation and instruction with step by step procedures to learn the core knowledge to build React components for mobile devices. It's suitable for all levels. The course has sample code and completed projects in gitHub.com. Instructor : Stephen Grider -  Engineering Architect, Stephen Grider has been building complex Javascript front ends for top corporations in the San Francisco Bay Area.

Javascript - Equivalent of .NET DateTime.MaxValue.Ticks

According to article "Azure Storage Table Design Guide: Designing Scalable and Performant Tables" " https://docs.microsoft.com/en-us/azure/cosmos-db/table-storage-design-guide#log-tail-pattern ". The below code is used to store the entities using a RowKey that naturally sorts in reverse date/time order by using so the most recent entry is always the first one in the table. string invertedTicks = string.Format("{0:D19}", DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks); The Equivalent JavaScript code is as below: var currentTimeInMilliseconds=moment().add(-2, 'hours').valueOf() * 10000 + 621355968000000000; //MaxTime is the DateTime.MaxValue.Ticks var MaxTime = 3155378975999999999; var rowKey =(MaxTime - currentTimeInMilliseconds).toString();