Latest Added Tutorials
We should have following roles to publish GCR image:
Cloud Build Service Agent
Cloud Run Admin
Cloud Run Service Agent
Service Account User
Also, please update the cloudbuild.yaml file as follows:
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/${PROJECT_ID}/spring-hello-world', '.']
# Push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/${PROJECT_ID}/spring-hello-world']
# Deploy container image to Cloud Run
- name:...Continue Reading
20-11-2022
docker run -d -it -e DB_URL='jdbc:sqlserver://localhost;databaseName=Demo' -e DB_USERNAME='sa' -e DB_PASSWORD='12_34_TRS_398?' -p 9090:9090 -t imageName:latest...Continue Reading
20-11-2022
FROM mcr.microsoft.com/azure-sql-edge:latest
EXPOSE 1433
ENV SA_PASSWORD "12_34_TRS_398?"
ENV SQLCMDPASSWORD "12_34_TRS_398?"
ENV ACCEPT_EULA "Y"
RUN mkdir -p /opt/mssql-tools/bin && cd /opt/mssql-tools/bin && wget https://github.com/microsoft/go-sqlcmd/releases/download/v0.8.0/sqlcmd-v0.8.0-linux-arm64.tar.bz2 \
&& bzip2 -d sqlcmd-v0.8.0-linux-arm64.tar.bz2 && tar -xvf sqlcmd-v0.8.0-linux-arm64.tar && chmod 755 sqlcmd
RUN /opt/mssql/bin/sqlservr & sleep 20 && opt/mssql-tools/bin/sqlcmd -S localhost -U sa -d master
#ADD test.bak var/test.ba...Continue Reading
version: "3.2"
services:
zookeeper:
image: bitnami/zookeeper:3
ports:
- 2181:2181
environment:
ALLOW_ANONYMOUS_LOGIN: "yes"
kafka-0:
image: bitnami/kafka:2
ports:
- 9092:9092
environment:
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181
ALLOW_PLAINTEXT_LISTENER: "yes"
KAFKA_LISTENERS: >-
INTERNAL://:29092,EXTERNAL://:9092
KAFKA_ADVERTISED_LISTENERS: >-
INTERNAL://kafka-0:29092,EXTERNAL://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: >-
INTERNAL:PLA...Continue Reading
HTML form
<div class="flex flex-col flex-auto min-w-0">
<div class="flex-auto p-6 sm:p-10 ">
<p-table #dt2 [value]="users" [loading]="loading" dataKey="id" [paginator]="true"
[rows]="10" [rowsPerPageOptions]="[10,25,50]" styleClass="p-datatable-gridlines"
[globalFilterFields]="filterColumns">
<ng-template pTemplate="caption">
<div class="flex">
<span class="p-input-icon-left ml-auto">
<i class="pi pi-search"></i>...Continue Reading
07-09-2022
HTML file
<div class="flex flex-col flex-auto min-w-0">
<!-- Main -->
<div class="flex-auto p-6 sm:p-10 ">
<p-table [value]="users" [lazy]="true" (onLazyLoad)="loadCarsLazy($event)" dataKey="id" [paginator]="true"
[rows]="10" [totalRecords]="totalRecords" [loading]="loading">
<ng-template pTemplate="header">
<tr>
<th *ngFor="let col of cols">
{{col.header}}
</th>
</tr>
<...Continue Reading
01-07-2022
We can integrate JWTS token for Spring REST API by using following component:
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtParser;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.impl.DefaultClaims;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.security.Keys;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.function.Function;
@Component
public class JwtUtils {
private static final Logger logger = LoggerFactory.getLogger(J...Continue Reading
Normally Glassfish looks at the cacerts.jks certificate file stored in the GLASSFISH_SERVER\glassfish\domains\domain1\config location.You can change this configuration or replace cacerts.jks file with your cacerts file.
There are some default JVM Options which Glassfish is used:
-XX:+UnlockDiagnosticVMOptions
-XX:NewRatio=2
-XX:MaxPermSize=192m
-Xmx512m
-client
-javaagent:C:/glassfish5/glassfish/li...Continue Reading
2022-06-15
First Step: localhost:8081 when you encounter a user login screen, run this code:
- select account_status from dba_users where username = 'ANONYMOUS'; if you encounter this error: SP2-0640: Not connected, firstly run this code: sqlplus /nolog
- alter user ANONYMOUS identified by anonymous;
- alter user ANONYMOUS account unlock;
We can use above dockerfile to build gradle project. After build process, generated war file will be moved to /usr/local/tomcat/webapps/ directory.
If you need to add a custom certificate, you should copy the new certifacete to /etc/ssl/certs directory. Otherwise, Java Keytool is not importing the custom certificate from another location. (It took me 5 hours to reach this information.)
The last commands, for loop in this case, automatically imports existing certificates into cacerts.
FROM gradle:7.3.3-jdk8 AS build
ENV TIS_DATA=/home/tis-data
#W...Continue Reading
We can use following codes to run gradle build in docker image then copy generated war file to Tomcat directory
FROM gradle:7.3.3-jdk8 AS build
COPY --chown=gradle:gradle . /home/gradle/src
WORKDIR /home/gradle/src
RUN gradle build --no-daemon
FROM tomcat:8.5.73
WORKDIR /app
RUN rm -fr /usr/local/tomcat/webapps/ROOT
COPY --from=build home/gradle/src/build/libs/ktbyigm.war /usr/local/tomcat/webapps/ROOT.war
CMD ["catalina.sh", "run"]
EXPOSE 9090...Continue Reading
26-09-2021
What is Injectable decorator?
Marks a class as available to Injector for creation.
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class UserService {
}
The service itself is a class that the CLI generated and that's decorated with @Injectable().
What exactly does providedIn do?
Determines which injectors will provide the injectable, by either associating it with an @NgModule or other InjectorType, or by specifying that this injectable should be provided in the 'root' injector...Continue Reading
08-10-2020
Nodejs Stream Api
const config = require('./config.js');
const AWS = require('aws-sdk');
// Set the region
AWS.config.update(config.aws_remote_config);
// Create the DynamoDB service object
const db = new AWS.DynamoDBStreams({apiVersion: 'latest'});
exports.handler = async (event) => {
let lastEvaluatedShardId = null;
let params = {
"ExclusiveStartShardId": null,
"Limit": 100,
"StreamArn": config.aws_stream_arn
};
const describeStreamResult = await db.describeStream(params).promise();
do {
let shards = describeStreamResult....Continue Reading
Amazon Dynamodb Lambda Function for Rest Api
Firstly install aws sdk package: npm i aws-sdk
Note: AWS Lambda now supports layers, we can easily create our library. For more information: https://medium.com/@anjanava.biswas/nodejs-runtime-environment-with-aws-lambda-layers-f3914613e20e
const config = require('./config.js');
const AWS = require('aws-sdk');
// Set the region
AWS.config.update(config.aws_remote_config);
// Create the DynamoDB service object
const db = new AWS.DynamoDB({apiVersion: 'latest'});
exports.handler = async (event) => {
let ty...Continue Reading
09-08-2020
Flutter TextFormField Phone Number Formatter
Converts phone number 00000000 to (000) 000 0000
class PhoneNumberFormatter extends TextInputFormatter {
PhoneNumberFormatter();
@override
TextEditingValue formatEditUpdate(
TextEditingValue oldValue,
TextEditingValue newValue,
) {
if (!oldValue.text.contains("(") &&
oldValue.text.length >= 10 &&
newValue.text.length != oldValue.text.length) {
return TextEditingValue(
text: "",
selection: TextSelection.collapsed(offset: 0),
);
}...Continue Reading