2015年9月15日火曜日

findの結果をソートする

Linux
Linuxでlsコマンドのオプションに日付または時間フォーマットする機能があります。
時間をフォーマットしてから、sortを利用して予想結果ができました。

find /home/a -newer /home/a/b.txt -exec ls -l --full-time {} \; | sort -k 6,7 > /savetofile.txt

上記のコマンドはlsの--full-timeを利用しています。
時間のフォーマットは
    2015-06-16 17:53:28.416228874 +0900
というふうに表示されます。

--full-timeの場合、時間フォーマットをすきではないとなると、好きなフォーマットを指定できます。

--time-styleがあります。これを使用すると、自由な時間フォーマットを取れます。

find /home/a -newer /home/a/b.txt -exec ls -l --time-style=+%Y-%m-%d\ %H:%M:%S {} \; | sort -k 6,7 > /savetofile.txt

残念ながら、LINUX上これらのコマンドは使えるけど、AIX上、--full-time、--time-styleオプションが提供していません。

AIX

下記のコマンドを実施して、結果が出ます。

find /home/a -newer /home/a/b.txt -exec ls -ltr "{}" + >/savetofile.txt

2015年9月7日月曜日

jfreechartの試し

MAVENプロジェクトを作成する。
POMの設定は以下の通りです。

<dependency>
    <groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.19</version>
</dependency>


円チャートを作成してみる。

■
public class Sample {

    public static void main(String[] args) {
        DefaultPieDataset data = new DefaultPieDataset();
        
        data.setValue("アサヒ", 37);
        data.setValue("キリン", 36);
        data.setValue("サントリー", 13);
        data.setValue("サッポロ", 12);
        data.setValue("その他", 2);
        
        JFreeChart chart = ChartFactory.createPieChart("Sample", data, true, false, false);
                
        File file  = new File("./chart.png");
        
        try {
            ChartUtilities.saveChartAsJPEG(file, chart, 500, 500);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}

結果:
文字が正しく表示されていない。

■日本語を表示設定

public class Sample {

    public static void main(String[] args) {
        DefaultPieDataset data = new DefaultPieDataset();
        
        data.setValue("アサヒ", 37);
        data.setValue("キリン", 36);
        data.setValue("サントリー", 13);
        data.setValue("サッポロ", 12);
        data.setValue("その他", 2);
        
        //JFreeChart chart = ChartFactory.createPieChart("Sample", data, true, false, false);
        JFreeChart chart = ChartFactory.createPieChart("Sample", data, true, false, Locale.JAPAN);
        //タイトル設定
        chart.setTitle(new TextTitle("サンプル", new Font("MS Mincho", Font.PLAIN, 24)));
        
        PiePlot plot = (PiePlot)chart.getPlot();
        plot.setLabelFont(new Font("MS Mincho", Font.PLAIN, 10));
        
        //凡例設定
        LegendTitle it = chart.getLegend();
        it.setItemFont(new Font("MS Mincho", Font.PLAIN, 10));
        
        File file  = new File("./chart.png");
        
        try {
            ChartUtilities.saveChartAsJPEG(file, chart, 500, 500);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}



結果:



2015年9月4日金曜日

-Dmaven.multiModuleProjectDirectory system propery is not set

eclipse
MAVEN

ErrorMessage:

-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.

Solution:

1.add $M2_HOME

$M2_HOME=maven installation path(not bin folder)

2. add -Dmaven.multiModuleProjectDirectory=true as VM parameter


2015年2月15日日曜日

git命令

git clone https://briantmali@bitbucket.org/anyclass/aco-main-theme.git


git remote add mybranch https://briantmali@bitbucket.org/anyclass/aco-main-theme.git

git remote -v 

D:\anyclass\VedioConference>git push -u origin mymaster:master
Password for 'https://briantmali@bitbucket.org':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 1.62 MiB | 90.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://briantmali@bitbucket.org/anyclass/videoconference.git
 * [new branch]      mymaster -> master
Branch mymaster set up to track remote branch master from origin.