Setup Comodo Positive SSL Certificate for Tomcat

Today, I and my friend (mczal) try to setup SSL certificate for Apache Tomcat. We use a Comodo PositiveSSL as Certificate Authority (CA). To setup SSL in Tomcat we need to generate PKCS12 file.

These are the requirements to generate PKCS12 file.

  • OpenSSL
  • Private key – you generated from your server (*.key)
  • SSL certificate file from CA (*.crt)
  • Certificate bundle from CA (*.ca-bundle) (Might be different format for each CA)

Continue reading “Setup Comodo Positive SSL Certificate for Tomcat”

Auto Convert Keywords Arguments in HTTP Request Spec in Rails 5

DEPRECATION WARNING: Using positional arguments in functional tests has been deprecated,
in favor of keyword arguments, and will be removed in Rails 5.1.

Deprecated style:
get :show, { id: 1 }, nil, { notice: "This is a flash message" }

New keyword style:
get :show, params: { id: 1 }, flash: { notice: "This is a flash message" },
  session: nil # Can safely be omitted.

It is the rspec controller test warning I got when trying to upgrade from Rails 4.x to 5.x. In Rails 5 we need to change it, because it only accepts keyword arguments as parameter.  Continue reading “Auto Convert Keywords Arguments in HTTP Request Spec in Rails 5”

Variadic Function and Variadic Argument Golang

Let’s start the first note!

In this week, I’m exploring Golang. It is an opensource programming language. I’m interested in learning it because Go offers concurrency, compiled code and run everywhere.

The interesting one is about variadic function. Variadic function is an function with that have unlimited arguments. So it can be called with any number of trailing arguments.

package main

import "fmt"

func sum(numbers ...int) int {
    total := 0
    for _, number := range numbers {
        total += number
    }
    return total
}

func main() {
    fmt.Println(sum(1, 2, 3, 4, 5))
}

In Go you can also use variadic argument to help you pass values from an array to a variadic function parameter.

package main

import "fmt"

func sum(numbers ...int) int {
    total := 0
    for _, number := range numbers {
        total += number
    }
    return total
}

func main() {
    numbers := []int{1, 2, 3, 4, 5}
    fmt.Println(sum(numbers...))
}

This is what I get when learning Go, let’s see what I get in the next couple weeks.

Hello world!

Hello, this is my first post on this new wordpress blog. This is the 5th version of this blog. I’ve restarted this blog for 4 times. I’m gonna use this blog to write my experience when learning new technology, working, enjoying life, etc.