Oracle Maven Repository – Index now available – more to come


Should I thank for this? Anyway the wind blows.

RedStack

I am happy to announce that we now have an index available for the Oracle Maven Repository.  This is a standard Maven index, built with the Maven Core Indexer code (donated by Sonatype to Maven – thanks!) and is available at https://maven.oracle.com/.index/nexus-maven-repository-index.properties and https://maven.oracle.com/.index/nexus-maven-repository-index.gz.

The easiest way to view it is to use an IDE like NetBeans, as shown below:

repo-index

We are actively working with Maven Repository Manager and IDE teams to make this work for you across a variety of common tools you may use.

View original post

sharing dot files between computers using git


create a repository

As anyone might know, Bitbucket permits private repositories.

$ git pull git@bitbucket:<username>/dot-files.git

put dot files in it

$ cd dot-files/
$ mv ~/.shuttle.json .
$ mkdir .m2
$ cd .m2
$ mv ~/.m2/settings.xml .
$ mv ~/.m2/settings-security.xml .
$ cd ..
$ git add \*
$ git commit -m "dot files added"
$ git push

link dot files

$ cd ~
$ ln -s /path/to/the/dot-files/.shuttle.json
$ cd .m2
$ ln -s /path/to/the/dot-files/.m2/settings.xml
$ ln -s /path/to/the/dot-files/.m2/settings-security.xml

installing northwindextended mysql


download the script

~/tmp$ wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/northwindextended/Northwind.MySQL5.sql

connect to mysql

~/tmp$ mysql -u root -p
Enter password:
...
mysql >

execute the script

mysql> source Northwind.MySQL5.sql
...
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| northwind          |
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)

mysql> 

create a user and grant

mysql> create user 'northwind'@'%' identified by 'northwind';
Query OK, 0 rows affected (0.01 sec)

mysql> grant select on northwind.* to 'northwind'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> quit

list the tables

onacit@VM1451490420734:~/tmp$ mysql -u northwind -p
Enter password: 
...

mysql> use northwind;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+--------------------------------+
| Tables_in_northwind            |
+--------------------------------+
| Alphabetical list of products  |
| Categories                     |
| Category Sales for 1997        |
| Current Product List           |
| Customer and Suppliers by City |
| CustomerCustomerDemo           |
| CustomerDemographics           |
| Customers                      |
| EmployeeTerritories            |
| Employees                      |
| Invoices                       |
| Order Details                  |
| Order Details Extended         |
| Order Subtotals                |
| Orders                         |
| Orders Qry                     |
| Product Sales for 1997         |
| Products                       |
| Products Above Average Price   |
| Products by Category           |
| Quarterly Orders               |
| Region                         |
| Sales Totals by Amount         |
| Sales by Category              |
| Shippers                       |
| Summary of Sales by Quarter    |
| Summary of Sales by Year       |
| Suppliers                      |
| Territories                    |
+--------------------------------+
29 rows in set (0.00 sec)

mysql> 

Using a Colon As A Bash Null Operator


references

The title of this entry is came from the referent entry.
본 entry의 제목은 위에 언급된 페이지의 것을 사용하였음을 밝힌다.

:

shellscript를 하나 만들 던 중 if 구문에서 thenelse 사이에 아무것도 하고싶지 않을 때 : 을 사용하면 되는 것을 배웠다.

if <condition>; then
    # todo...
    :
else
    echo i'm in else
fi

lombok with maven


disclaimer

I don’t use lombok. And I won’t use it as long as I don’t have to.

references

sources

https://github.com/jinahya/lombok-with-maven-example

lombok

lombok을 provided scope 로 추가하자.

<dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <version>1.16.8</version>
  <scope>provided</scope>
</dependency>

클래스 파일 하나를 다음과 같이 추가하였다.

public class Person {

    @lombok.Getter
    @lombok.Setter
    private String name;

    @lombok.Getter
    @lombok.Setter
    private int age;
}

컴파일 후 클래스파일을 살펴보면 getter와 setter가 생성되어 있음을 확인할 수 있다.

$ mvn clean compile
...
$ javap target/classes/com/github/jinahya/example/Person.class
Compiled from “Person.java”
public class com.github.jinahya.example.Person {
  public com.github.jinahya.example.Person();
  public java.lang.String getName();
  public void setName(java.lang.String);
  public int getAge();
  public void setAge(int);
}
$

delombok

pom.xml에 다음과 같이 plugin을 추가하자.

<plugin>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok-maven-plugin</artifactId>
  <version>1.16.8.0</version>
  <executions>
    <execution>
      <phase>generate-sources</phase>
      <goals>
        <goal>delombok</goal>
      </goals>
    </execution>
  </executions>
</plugin>

src/main/lombok폴더에 다음과 같은 파일을 추가하였다.

public class Group {

    @lombok.Getter(lazy = true)
    private final List<Person> people = new ArrayList<>();
}

빌드 후 Group.class 파일을 de-compile 해 보면 다음과 같은 내용을 확인할 수 있다.

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

public class Group
{
  private final AtomicReference<Object> people = new AtomicReference();

  public List<Person> getPeople()
  {
    Object value = this.people.get();
    if (value == null) {
      synchronized (this.people)
      {
        value = this.people.get();
        if (value == null)
        {
          List<Person> actualValue = new ArrayList();
          value = actualValue == null ? this.people : actualValue;
          this.people.set(value);
        }
      }
    }
    return (List)(value == this.people ? null : value);
  }
}