Saturday, July 31, 2021
Tuesday, July 27, 2021
Hello, Flask from Google Colab !
Flask is really simple framework.
You can run in it google colab also using flask-ngrok.
Following is a running example in google colab. You need index.html and Welcome.html in the /content folder.
Also note that when you are referencing html files, the file names are case-sensitive! If casing does not match flask will not find the file.
Secondly, you need to tell flask the folder of html file when declaring app=Flask(__name__ , template_foler="XXXX")
#####Flask File
Welcome.html
Saturday, July 24, 2021
Cluster replication tool for EventStore
https://github.com/benfoster/Ditto
Ditto is a cluster replication tool for Event Store. It works by subscribing to specific streams from a source cluster and replicating them to a destination cluster.
It was designed to be run as a standalone application using Docker and uses Event Store Subscription Groups to subscribe to the source server/cluster.
Most of the code is part of our boilerplate Event Consumer template and automatically takes care of Event Store connection management and logging via Serilog. The application is configured to use Seq locally and Datadog in production.
JSON Generator Script for "generated.json" used in Tim Corey's EF Video
https://www.json-generator.com/
Thursday, July 22, 2021
Wednesday, July 21, 2021
.NET Core Hello World Web App and Docker
1. Create a new web app from command line using the command:
dotnet new web -o myWebApp
2. Open the myWebApp.csproj file. It will have following text:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
Change the target framework to netcoreapp3.1 and save the file.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
Official Docker Tutorial issues
Sample Docker files for a simple .net core web application
Official Docker file as given here :
Docker file generated by Visual Studio:
Docker file as seen here:
Docker
docker quickstart "C:\Program Files\Git\bin\bash.exe" --login -i "D:\Installations\Docker Toolbox\start.sh"
docker toolbox installable : Docker Toolbox-19.03.1 (231 MB) 2,36,837 kb
docker info
docker-machine ip default
docker-machine status
docker-machine status default
docker-machine env
docker-machine env default
docker-machine ls
By default, docker creates a docker-machine named "default" which you can verify using "docker-machine ls" command
You can remove this machine if not required by using "docker-machine rm machine-name" command:
docker-machine rm default <= "default" is the name of docker-machine.
docker system prune -a
docker run -d -p 5000:80 --name xxxxinsmall imagename
docker build -t mywebapp .
docker kill conainer_id or first 4-5 digits of containerid
$docker kill $(docker ps-q)
docker ps -q
docker ps -a
docker exec -it mywebapp bash
curl -I -XGET 192.168.99.100:5000 [on docker mingw64 bash prompt]
docker container ls
docker container ls -q
docker container stop $(docker container ls -q) [on mingw64 ]
docker container start $(docker container ls -a) [-aq ?]
docker container rm $(docker container ls -a)
docker images
docker images -q
docker images -a
docker images -aq
docker run --rm -it --entrypoint sh myweb app
https://www.c-sharpcorner.com/article/create-docker-image-and-hosting-for-simple-web-application-using-visual-studio/
Tuesday, July 20, 2021
Monday, July 19, 2021
TypeError : Router.user() requires a middleware function but got a undefined
This most probably indicates that your api is not being set properly. Check whether the api file ahas module.exported , you properly express.Router and returning it. In my case I forgot to return the api, and got the error.
Getting MongoDb connection string for cloud collection
Steps in creating Mongo DB database in free tier in Atlas
2. Create DB user
3. Add IP address to your access list (white list)
4. Load Sample data (optional)
5. Connect to your cluster.
Create DB user:
Express Hello World
1. npm install express body-parser morgan
2. Create an html file called index.html in public/views/index.html and simply write text "Hello World!" (no html tags required) .
Config.js:
public/views/index.html :
Start the project by using "node server.js" or "nodemon server.js"
and navigate to localhost:3000 on your browser
Sunday, July 18, 2021
React useEffect hook Sample-I
React useState Sample-III passing data from parent to child and vice versa
//React useState Sample - III
React useState Sample-II using an object with useState
How to check local and global angular versions
Use the command ng version (or ng v ) to find the version of Angular CLI in the current folder. Run it outside of the Angular project, to f...
-
Most of the google tutorials on keras do not show how to display a confusion matrix for the solution. A confusion matrix can throw a clear l...
-
This error means you have created the DbContext but not configured/added it to the project using either DI in startup.cs or by using DbCon...
-
This happens when you dont define primary key for an entity type. Define a primary key either explicitly or implicitly.