Advanced Search
Search Results
195 total results found
Packages vs Modules
Preliminary Forget about the packages and modules that you know from Python, it is no related, yes it is about organizing files but not in the same way. Packages A package is made up of Go files that lives under the same directory. You can think about the d...
Import packages / modules
I have a helper file that I would like to use within the same project. If say your directory layout is like below: src main.go helper.go A very simple directory, you wrote some helper function in helper.go and you would like to use it in main.go. Now...
package, install, release, deploy phases
mvn package will construct your artifactory, i.e. a jar file and then place it in the current working directory mvn install will put your packaged maven project i.e. a jar file into the local repository, so that your other local application can use it as a ...
Lifecycle, Phases, goals, and Plugins?!
Maven Lifecycle Maven is a build automation tool at heart. It has three built-in lifecycle that clearly define how the project will be build. There are three built-in build lifecycles: default: handles the actual project compilation and deployment clean: ...
Structs exported fields
Exported structs and fields Like functions if you would like to export a struct from a package for another package or module to use then the first letter of the struct name must be capitalized, otherwise it is not exported and cannot be used. type ComplexNum...
Fun Annotation Notes
@ComponentScan + @Component During Spring initialization the class that is marked with @ComponentScan will have it's package and it's subpackage scanned for any class that's marked with @Component. If any @Component class is found then it will add them to the...
Upstream vs Downstresam API
All this discussion is relative based on an API that uses another API and that API is being used by another API. Upstream API You refer to API that your API uses as upstream if it produces data that YOUR API consumes in the middle. Downstream API You ref...
Spring Injection Order
First of all don't mix and match injection for your fields If you are going to let Spring do your dependency injections for you, just stick to one method. Constructor, setter, or field injections. However, if you're curious on the order of the evaluation her...
Introduction: Hello World, values, and variables
Go code layouts A Go project is also called a module. A module is just a collection of packages. A package is just a group of related .go files. You would declare the .go files that belong in the same package with the line package <package name> For exampl...
If/else
If/else If else is very similar to C except you just take out the parenthesis. func main() { x := 10 if x > 10 { fmt.Println("It is greater than 10") } else if x < 10 { fmt.Println("It is less than 10") } else { fmt.Println("It is equal t...
Embed Modules
Embed Module This module is a super duper cool module in the sense that you are able to pack static files into your binary, rather than having your program relying on the actual file being present in your filesystem when it is ran. Normally when you do deplo...
Select Statement
The Select Statement Depending on the DBMS, the select statement can pack in it a lot of optional keywords. For example: for MySQL SELECT [ALL | DISTINCT | DISTINCTROW ] [HIGH_PRIORITY] [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] ...
Aspect Oriented Programming
What the heck is AOP? Aspect oriented programming is a programming technique just like object oriented programming where you group codes and software designs into objects rather than keeping it as separate functions and logic. AOP aim to help mitigate and so...
Compile time and runtime dependency
Problem There was bunch of dependency that older version of spring-boot includes as compile time dependency, meaning in your project without you explicitly including those as a dependency in your pom.xml you can use them in your code. However, if you upgrade...
AWS CloudWatch Metrics
Metric A metric is just a time-ordered set of data points being sent to CloudWatch so that you can get a nice graph on those time. A metric is identified under three things: A namespace A metric name And 0 or more dimensions Dimensions A dimension i...
Java Nested Class
exec form vs shell form PT.2
shell form The PID 1 is the shell, which will spawn the process that the program it is actually running. Any environment variable referenced will be resolved to it's actual value. ENTRYPOINT ./run.sh "$PATH" If the shell script run.sh just echos out the pa...
Switch Statement
Switch Statement Switch in Go is pretty nice, it function similar to the switch statement in C but better. x := 20 switch x { case 10, 20: fmt.Println("It is either 10 or 20") default: fmt.Println("It is not 10 and is not 20") } You can ...
Arry and Slices
Array An array can be declared with the following syntax: var <arr_name> [length]type For example if I want to create a list of array with length of 5: var a [5]int The array is initialized with zero value of the type. So since it is integer it will be in...