Saturday, July 25, 2020

CAPTCHA vs reCAPTCHA

A CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) is a program that can tell whether its user is a human or a computer.

The process involves a computer asking a user to complete a simple test which generated by computer. Because other computers are unable to solve the CAPTCHA, any user entering a correct solution is presumed to be human. Sometimes it is described as a reverse Turing test, because it is done by a machine and targeted to a human. reCAPTCHA does exactly that by channeling the effort spent solving CAPTCHAs online into "reading" books.

reCaptcha is hosted by Google, and one of the more interesting things about it is that it is used to digitize text of old newspapers and books. That’s why there are two “sections” of a reCaptcha instead of the single series of characters for CAPTCHA - one is known text, the other is not. If you get the known one correct, it assumes you got the second one. Then the next time it offers up that same “unknown” text, it is considered possibly known.

A few more times with the same result for the “unknown” text, and it becomes “known” and the text it originated from can be correctly digitized. Clever, eh?

Also, because of frequent updates, I would expect reCAPTCHA to be slightly better at preventing bots from solving them.



references:
https://anydifferencebetween.com/difference-between-captcha-and-recaptcha/

Firebase Database rules







Firebase ID Token




- Server admin SDK can add claim.
- The claim data is limited to 1000 bytes
- getTokenIDResult, getTokenID can be used in iOS and android and decide what ui to be displayed
- On the security rules also this can be applied.

references
https://www.youtube.com/watch?v=3hj_r_N0qMs

Thursday, July 23, 2020

How to Analyse HAR file

Just open the file in the link given in below.

References:
https://toolbox.googleapps.com/apps/har_analyzer/

Monday, July 20, 2020

How do you stop Chome from always redirecting to https?



In the case of our company - it appears that it's related to a domain policy probably put in place by our IT Department.

One clue is the Network Traffic in chrome debugger: 307 Internal Redirect and the response header has: Non-Authoritative-Reason: HSTS

Try going to: chrome://net-internals/#hsts and if you have authority, deleting the policy for "localhost."

If you can't delete this, then I advice following the steps from this article which also worked for me: https://medium.com/@richardr39/using-angular-cli-to-serve-over-https-locally-70dab07417c8

references:
https://stackoverflow.com/questions/57417200/how-do-you-stop-chome-from-always-redirecting-to-https-not-desired

Tuesday, April 14, 2020

SwiftInject

Swinject is a lightweight dependency injection framework for Swift.

Dependency injection (DI) is a software design pattern that implements Inversion of Control (IoC) for resolving dependencies. In the pattern, Swinject helps your app split into loosely-coupled components, which can be developed, tested and maintained more easily. Swinject is powered by the Swift generic type system and first class functions to define dependencies of your app simply and fluently.

Why Dependency Injection?
Dependency Injection relies on a principle called Inversion of Control. The main idea is that a piece of code that requires some dependencies won’t create them for itself, rather the control over providing these dependencies is deferred to some higher abstraction. These dependencies are typically passed into an object’s initializer. This is the opposite approach — an inverted approach — to the typical cascade of object creation: Object A creating Object B, creating Object C, and so on.

From a practical perspective, the main benefit of Inversion of Control is that code changes remain isolated. A Dependency Injection Container supports the Inversion of Control principal by providing an object that knows how to provide the dependencies for an object. All you need to do is ask the container for the object you need, and voilĂ … it’s ready!

references:
https://github.com/Swinject/Swinject

Tuesday, April 7, 2020

Installing MongoDB community Editiion

After Mac OS catalina update, the mongo db stopped working. now trying to reinstall, the steps are below

This time attempting to install community edition. In machine, the Xcode, So below steps really were the ones that had to be followed

brew tap mongodb/brew
brew install mongodb-community@4.2

In addition to the binaries, the install creates:

the configuration file (/usr/local/etc/mongod.conf)
the log directory path (/usr/local/var/log/mongodb)
the data directory path (/usr/local/var/mongodb)


Run MongoDB Community Edition
Follow these steps to run MongoDB Community Edition. These instructions assume that you are using the default settings.

You can run MongoDB as a macOS service using brew, or you can run MongoDB manually as a background process. It is recommended to run MongoDB as a macOS service, as doing so sets the correct system ulimit values automatically (see ulimit settings for more information).

To run MongoDB (i.e. the mongod process) as a macOS service, issue the following:

brew services start mongodb-community@4.2
To run MongoDB manually as a background process, issue the following:

mongod --config /usr/local/etc/mongod.conf --fork
Both methods use the /usr/local/etc/mongod.conf file created during the install. You can add your own MongoDB configuration options to this file as well.

To verify that MongoDB is running, search for mongod in your running processes:

ps aux | grep -v grep | grep mongod
You can also view the log file to see the current status of your mongod process: /usr/local/var/log/mongodb/mongo.log.

Connect and Use MongoDB
To begin using MongoDB, connect a mongo shell to the running instance. From a new terminal, issue the following:

mongo


https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/