Skip to content

2018

Trust Company Certificate In Firefox

By default, the Firefox doesn't trust the company's certificate, that may cause user will recieve certificate error, and unable to view the site. However, we can manually configure the Firefox to trust the company certificate to resolve the issue.

  • Open Firefox config page by run about:config and click "I accept the risk!" to continue
    • Changed the value of entry security.enterprise_roots.enabled to true
  • Export the company root certificate
    • Use portecle to export the certificate as PEM file
  • Open the Firefox option page
    • Navigate to Certificates section
    • Click the View Certificates button to open the Certificate Manager window
    • Import the PEM certificate exported in above step, click the OK button to take effect

Now, the Firefox will trust the company certificate.

How to Uninstall Install Java on Mac

After a new version Java released, the first thing for the Java developer is to upgrade to the latest version to have an experience of new features and improvements. Before to experience it, it needs to uninstall the previous installation first.

How to uninstall Java on Mac

First thing is that we need to find where it's installed.

  • Just run /usr/libexec/java_home -v *10*, it will show the Java install location.
    Bash
    /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
    
  • Then go to folder /Library/Java/JavaVirtualMachines, and remove jdk-10.0.1.jdk to uninstall jdk 10.
  • And remove following folders
    Bash
    sudo rm -rf "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin"
    sudo rm -rf "/Library/PreferencePanes/JavaControlPanel.prefPane"
    

Linux Find String in All Files From Current Directory

The Linux grep command can be used to search string in files or pipeline output. For example, I offen search string in a command output, command arg | grep <pattern>.

And, it's also possible to find in a file, grep -i "string" <file1> <file2>.

But how to find in all files in current directory? Or even do a recursive find.

  • Uses * to find in all files
  • Uses r to do recursive find

E.g. grep -rni "string" *. It will find in all files in current directory and its sub directories.

More information can run grep --help to get.

Using Profiles in Spring Boot

When developping a Spring Boot application, or developping any applicaions, it's offen to follow below process,

  • Develop in local environment. Mostly may be on Windows
  • Run some automation test, such as integration test on a testing environment
  • Deploy to a product environment

In each stage, a separated environment is required, such as,

  • different database
  • different server hostname
  • different Kafka server or topic name

Jenkine Pipeline Basic Usage

Jenkins pipeline is groovy based DSL, we can use groovy to access the Jenkins instance, and access its project job, or even builds.

In order to access the Jenkins instance, we need to import its class.

Java
import jenkins.model.Jenkins
import hudson.model.*
Here are some basics, * find a job

Run Kafka in Docker

For some development purpose with Kafka, it’s often required to test with a dedicated server, despite the official production and testing instance.

But the official installation needs to run the zookeeper and Kafka server separately, and also prepare the environment. So, it’s better to run it in the Docker, and have own controls.

What the Docker is

  • Run the zookeeper and Kafka in one Docker
  • Every start will totally create a new instance
  • Allow ssh into the Docker to do troubleshooting

Where is the Docker

Check in Github Kafka Docker.

Kafka Startup

Installation

Please refer to https://kafka.apache.org/quickstart.

Configurations

One important thing is to change the advertised.listeners in ${KAFKA_HOME}/config/server.properties, like,

# Hostname and port the broker will advertise to producers and consumers. If not set, # it uses the value for "listeners" if configured. Otherwise, it will use the value # returned from java.net.InetAddress.getCanonicalHostName(). advertised.listeners=PLAINTEXT://\<IP or hostname>:9092

Otherwise, any clients, like java, will not poll any messages from the server.