Saturday, June 24, 2023
CSS border shadow for input box taken from https://stackoverflow.com/questions/14820952/change-bootstrap-input-focus-blue-glow
Monday, January 16, 2023
WORKING Promise and Then for Angular APP_INITIALIZER
//const appInitializerFn = (infoService: InfoService) => {
// return () => {
// return infoService.loadInfo().then( (promise) => {alert("tete"); return promise } ).then(_ => Promise.resolve(true)).then(_ => alert("tetete"));
// };
//};
//WORKING APPINITIALIZER FUNCTION
const appInitializerFn = (infoService: InfoService, httpClient : HttpClient) => {
return () => {
//return infoService.loadInfo()
return Promise.resolve(true)
.then( (promise) => {alert("tete"); return promise } )
.then(_ => infoService.setConfig(new AppInfo("aaaa")))
.then(_ => alert("tetete"));
};
}
Saturday, December 10, 2022
Difference between TAG hierarchies of BOOTSTRAP NAV and NAVBAR components
--NAVBAR-- --NAV--
NAVBAR ----------
NAVBAR-NAV NAV
NAV-ITEM NAV-ITEM
NAV-LINK NAV-LINK
Browser autocomplete behaviors
Found the following strange autocomplete behaviors on both Google and Edge.
Consider the following html for input :
<div class="form-group">
<label for="emailid">Email Id :</label>
<input type="email" class="form-control" placeholder="Enter User" id="emailid">
</div>
In this code, note the following "HOTSPOTS" :
<div class="form-group">
<label for="emailid">Email Id :</label>
<input type="email" class="form-control" placeholder="Enter User" id="emailid">
</div>
If you ever set these two hotspots to values like "email" , "emailaddress" , "user" , "password", the browser is likely to autofill this field. (tested with chrome and edge).
To avoid this, just change the name slightly. e.g. from "email" to "emailid" . You will have to test which name is working by trial and error. But you have to make changes in these two places mostly, plus may be in the <label for="XXXX"> place.
If you google on autocomplete behavior, most of the links will tell you to set autocomplete to "off" or some junk value "dsf" or some different value "differentname" or set name to some different value that id of the control. But practically none of these tricks work.
I also found this SO https://stackoverflow.com/questions/55591018/autocomplete-off-in-html5
which tells to include autocomplete="off" in form tag and then include a hidden input in the form with autocomplete="false". But this also did not work.
<form autocomplete="off" >
<input autocomplete="false" name="hidden" type="text" style="display:none;">
Wednesday, November 2, 2022
Surreal DB
Surreal DB does not start on alpine container,
use ubuntu container instead
1. Create an Ubuntu container
docker run -d -p 17000:8000 --name ub_surreal ubuntu tail -f /dev/null
2. Exec the container in it mode
docker exec -it -u 0 ub_surreal sh
3. Update apt ( this is required to install curl)
apt update
This will take some time may be 2-3 mins because apt coming with container is bare minimum
4. Install curl
apt install curl
Press 'Y' when prompted
5.
curl -sSf https://install.surrealdb.com | sh
This will install surreal db.
6. Start surreal db
surreal start --log debug --user root --pass root memory
This will start surreal and keep it started.
7. Open another command prompt and again open the same container with EXEC command:
docker exec -it -u 0 ub_surreal sh
8. Now you can give the command and use surrealdb.
For example you can give the following command:
curl --request POST --header "Accept: application/json" --header "NS: test" --header "DB:test" --user "root:root" --data "INFO FOR DB;" http://localhost:8000/sql
you should get a response like
[{"time" : "47.432ms" , "status" : "OK" , "result" : { "d1" : {} , "dt" : {}, "sc" : {} , "tb" : {}}}]
https://www.freecodecamp.org/news/how-to-use-surrealdb-with-fresh-framework/
========================================================================
Start Surreal using dockerfile
1. Execute the following dockerfile:
========================================================================
Dockerfile
========================================================================
FROM ubuntu
RUN apt update
RUN apt-get install -y curl
RUN curl -sSf https://install.surrealdb.com | sh
CMD surreal start --log debug --user root --pass root memory
========================================================================
NOTE the use of apt and apt-get : apt-get has more features than apt,
i.e. apt is a stripped down vesrion of apt-get
2. Build the above docker file:
docker build -t surreal-image .
NOTE : image name must be all smalls.
3. Run it:
docker run -p 17000:8000 -d --name surrealdb surreal-image
4. Execute it:
docker exec -it -u 0 surrealdb sh
5. Execute the following command on shell:
surreal sql -c http://localhost:8000
You will be presented with surreal sql prompt. ( >)
>info for db <Enter>
[{"time" : "23.728ms" , "status" : "ERR" , "detail" : "Specify a namespace to use"}]
6. Now exit sql shell by pressing ctrl + C and enter the following command:
surreal sql -c http://localhost:8000 --ns test --db test
>info for db
[{"time" : "50.292ms" , "status" : "OK" , "result" : { "d1" : {} , "dt" : {}, "sc" : {} , "tb" : {}}}]
> create account set name = 'test' , created_at = time::now()
> CREATE author:john SET name.first = 'John' , name.last = 'Adams' , name.full = string::join(' ', name.first, name.last) , age = 29, admin = true, signup_at = time::now();
> select * from author, account;
Sunday, September 25, 2022
KUBERNETES COMMANDS
minikube version
kubectl version
minikube start #starts cluster
kubectl cluster-info
kubectl get nodes
kubectl get pods
kubectl get services
kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1
kubectl proxy
kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'
$export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'
Saturday, August 20, 2022
C# Linq Min method
// Online C# Editor for free
// Write, Edit and Run your C# code using C# Online Compiler
using System;
using System.Linq;
using System.Collections.Generic;
public class HelloWorld
{
public static void Main(string[] args)
{
List<test> testlist = new List<test>();
testlist.Add(new test { id = 5});
testlist.Add(new test { id = 7});
testlist.Add(new test { id = 2});
testlist.Add(new test { id = 8});
//find the min
var min = testlist.Min(x=>x.id);
//get the object with min component
var y = testlist.Where(x=>x.id == min).FirstOrDefault();
Console.WriteLine ($"The min is {min} {y} {y.id}");
}
public class test {
public int id { get;set;}
}
}
Output:
The min is 2 HelloWorld+test 2
NOTE: {y} prints "HelloWorld+test" which is the object hierarchy of parent class and contained class.
Comparing features of LangGraph vs CrewAI
LangGraph Orchestration vs CrewAI Orchestration The following table compares LangGraph and CrewAI orchestration across their menta...
-
http://www.sommarskog.se/share_data.html How to Share Data Between Stored Procedures An SQL text by Erland Sommarskog, SQL Server MVP. M...
-
The evolution of LangChain has led to significant shifts in how agents are constructed, moving from the legacy AgentExecutor to the graph-b...
-
CrewAI's built-in retry mechanism distinguishes between logical errors (like a bad response format) and technical API failures (like ...