syedsibtain
Fri Apr 26 2024
In Ruby,
Example:
In this example,
#ruby
instance variables
are variables that belong to a specific instance of a class. They are prefixed with the @
symbol and are accessible within the instance methods of that class. Instance variables allow objects to maintain state and store information unique to each instance.Example:
class Person
def initialize(name, age)
@name = name
@age = age
end
def say_intro
puts "Hello, my name is #{@name} and I am #{@age} years old"
end
end
# Create a new instance of Person
person1 = Person.new("John", 18)
# Call the say_intro method
person1.say_intro
In this example,
@name
is an instance variable of the Person
class, representing the name of each Person
object created. The initialize
method is a constructor that sets the value of @name
when a new Person
object is created. The say_intro
method uses the instance variable @name
to give the intro of the person with their name and age when called.#ruby
nisanth
Thu Apr 25 2024
The
Example Explanation
#devops #docker
docker stats
command is a powerful tool provided by Docker to monitor the resource usage of running containers. It provides a real-time stream of various metrics such as CPU usage, memory usage, network I/O, block I/O, and the number of processes (PIDs) running inside each container. This command is particularly useful for performance analysis and ensuring that containers are running within their resource limits.Example Explanation
docker stats db370fc6b784
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
db370fc6b784 minikube 43.70% 1.243GiB / 2.148GiB 57.87% 35.4MB / 414MB
#devops #docker
vaibhav.yadav
Wed Apr 24 2024
We can check the default value for a given column using postgres query like this:
Same can be used for constraints like
#database #postgres #query
SELECT column_name, column_default
FROM information_schema.columns
WHERE table_name = '<table_name_placeholder>' AND column_name = '<column_name_placeholder>';
Same can be used for constraints like
is_nullable
as following:
SELECT column_name, is_nullable
FROM information_schema.columns
WHERE table_name = '<table_name_placeholder>' AND column_name = '<column_name_placeholder>';
#database #postgres #query
sujay
Tue Apr 23 2024
active_record_doctor
performs variety of health checks to identify and rectify common database issues like missing foreign key constraints, missing NON NULL constraints, missing presence validations, incorrect presence validations on boolean columns and many more. Ref: https://github.com/gregnavis/active_record_doctor#rails #database
sagar.ghorse
Mon Apr 22 2024
while integrating
#devops #sentry#gitlab
sentry
with gitlab
ip whitelisting needs to be done on gitlab server (self-hosted)#devops #sentry#gitlab
soniya.rayabagi
Mon Apr 22 2024
The
#devops #kubernetes
kubectl cordon NODE_NAME
command is used in Kubernetes to mark a node as unschedulable
, meaning no new pods will be scheduled onto that node. Existing pods on the node will continue to run unless explicitly terminated or moved.#devops #kubernetes
nisanth
Mon Apr 22 2024
Debugging Kubernetes pod on helm
Adding
#devops #kubernetes #helm
helm upgrade unleash-app-toggle . --debug
Adding
--debug
can provide more insight if the error persists, showing exactly what values are being passed to each template.#devops #kubernetes #helm
nisanth
Fri Apr 19 2024
Avoid Using Double Quotes for Environment Variables
When configuring the PostgreSQL user and database names in a Helm values.yaml file, I initially wrapped the values in double quotes. This led to a frustrating issue where I couldn’t connect to the database, receiving errors that the role did not exist. The double quotes were being interpreted literally, causing mismatches in authentication.
Solution: I removed the double quotes around the environment variables in my Helm chart and reapplied the configuration. This corrected the problem, and I was then able to connect successfully to the database.
#devops #postgres #env
When configuring the PostgreSQL user and database names in a Helm values.yaml file, I initially wrapped the values in double quotes. This led to a frustrating issue where I couldn’t connect to the database, receiving errors that the role did not exist. The double quotes were being interpreted literally, causing mismatches in authentication.
Solution: I removed the double quotes around the environment variables in my Helm chart and reapplied the configuration. This corrected the problem, and I was then able to connect successfully to the database.
#devops #postgres #env
sagar.ghorse
Thu Apr 18 2024
create the redis cluster from existing backup we can use
#devops #redis #Terraform
snapshot_name = <name of your backyp >
#devops #redis #Terraform
nisanth
Wed Apr 17 2024
To find the number of pods that exist in the “dev” environment (env), you can use the
#devops #kubernetes
kubectl get pods --selector=env=dev
#devops #kubernetes
Showing 14 to 16 of 71 results