急いでイソイテク

並盛り技術ダクダクで。

Android Device MonitorのFile Explorerで何も表示されない

解決策

参考サイト

Issue 211616 - android - [developer preview] File Explorer (in Android Device Monitor) not working on N Preview - Android Open Source Project - Issue Tracker - Google Project Hosting

  1. Android Device Monitorを終了させる。

  2. SDKインストールフォルダ>\tools\lib\monitor-x86_64\plugins\com.android.ide.eclipse.ddms_XX.X.X.XXXXXXX.jar を解凍する。

  3. 解凍フォルダ配下のlibに、参考サイトで公開されていたddmlib.jarを上書きコピーする。

  4. jarに戻す。

  5. Android Device Monitorを起動する。

ただし・・・

目的であるフォルダが見れなかった。
/storage/emulated/0 …だったかな。
root化等が必要なのだろうか。

【VBA】自作関数

文字列置換(簡易正規表現対応)

Function replaceWithRegex(target As String, pattern As String, replaceStr As String)
    Dim RE, strPattern As String, ret As String
    Set RE = CreateObject("VBScript.RegExp")
    With RE
        .pattern = pattern          ''検索パターンを設定
        .IgnoreCase = True          ''大文字と小文字を区別しない
        .Global = True              ''文字列全体を検索
    End With
    
    '正規表現による置換の実行
    ret = RE.Replace(target, replaceStr)
    
    Set RE = Nothing
    replaceWithRegex = ret
End Function

技術系つぶやき(ネタメモ)

Spring系

i18n(国際化対応)で、各ロケールごとのメッセージ定義ファイル内に存在しないキーをSpringが検索した時、デフォルトのメッセージ定義ファイルを読みに行くようだ。

ちなみにi18nが何故「国際化対応」を意味するかというと、

「国際化=internationalization の先頭の i と語尾の n の間に nternationalizatio の 18文字があることに起因する。」

との事。下記サイトより。

5.13. 国際化 — TERASOLUNA Server Framework for Java (5.x) Development Guideline 5.1.0.RELEASE documentation

Linux

CentOS7のsystemctl周り

Failed to get D-Bus connection: Operation not permitted

Dockerのコンテナ内でyum -y install tomcatってインストールして
systemctl status tomcat.serviceってやると上記メッセージが出た。
これは単純にsystemctl enable tomcat.serviceってやればいいだけかと思ったが違った。どうする?
→諦め。OSはCentOS6にしよう。

CentOS7のfirewalld周り

参考

CentOS7.1 64bit firewalldによるアクセス制御 | kakiro-web カキローウェブ

ポートをあける

firewall-cmd --permanent --add-port=80/tcp
→80番ポートを開ける。--parmanentは、OS再起動も有効なようにするための指定。

有効化

firewall-cmd --reload

Tomcat

Maven周り

Tomcat PluginでTomcatにデプロイする
  1. こんなのをpom.xml要素に書く。
<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <path>/xxxx</path>
        <server>tomcat-xxxx</server>
        <url>http://xxxxx:xxxxx/manager/text</url>
    </configuration>
</plugin>
  1. settings.xmlにこんなのを書く。
<settings>
    <servers>
      <server>
        <id>tomcat-xxxx</id>
        <username>user</username>
        <password>passwoooord<password>
      </server>
    </servers>
</settings>
  1. ${CATALINA_HOME}/conf/tomcat-users.xmlにこんなのを書く。
  <user username="user" password="passwoooord" roles="manager-script"/>
  <user username="usergui" password="passwoooord" roles="manager-gui,admin-gui"/>

※manager-scriptとmanager-guiは同時指定できないのでユーザーを分けること(ハマった)。

  1. からの、mvn package tomcat7:deploy

Androidハマった&直ったメモ

キーワード:':app:zipalignDebug', 'inputFile'

事象

Androidアプリが起動せず、エラー終了する。

エラー全文
Error:A problem was found with the configuration of task ':app:zipalignDebug'.
File 'C:\User\...\app\build\outputs\apk\app-debug-unaligned.apk' specified for property 'inputFile' does not exist.
解決

AndroidStudio メニュー -> [Build] -> [Build APK] -> Run App

キーワード:'dexopt error'

事象

Androidアプリを端末にインストールできない。

エラー全文
Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error).
解決

AndroidStudio メニュー -> [File] -> [Settings] -> [Build, execution, deploy] --> [Instant run] "Enable Instant Run..."のチェックボックスを外す

Apache POI メモ

インストール

Apache POI - Download Release Artifactsへアクセス後、
"The latest stable release is Apache POI 3.xx"
のリンクから辿って
"poi-bin-3.xx-20YYMMDD.zip"
のファイルをDLし、解凍し、とりあえず全部のjarを突っ込む。

書き始めテンプレ(成長中)

package XXXX;

import java.io.FileInputStream;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class XXXX {

    public static void main(String[] args) throws IOException {

        String excelPath = args[0];
        String sheetName = args[1];

        MondaiExporter ins = new MondaiExporter();
        ins.execute(excelPath, sheetName);
    }

    public void execute(String excelPath, String sheetName) throws IOException {
        //
        // Excelファイルを開く
        //
        HSSFWorkbook wb = readFile(excelPath);

        //
        // シートを開く
        //
        HSSFSheet sheet = wb.getSheet(sheetName);

        //
        // 行のListを取得
        //

        //
        // 行ごとのループ
        //

        //
        // ファイルに書き出す
        //

    }

    private HSSFWorkbook readFile(String filename) throws IOException {
        FileInputStream fis = new FileInputStream(filename);
        try {
            return new HSSFWorkbook(fis);
        } finally {
            fis.close();
        }
    }
}

`

compassを使うまでのRubyの設定 + compass使用方法(メモ)

Rubyのインストール

RubyInstallerをダウンロードする

http://rubyinstaller.org/downloads/
にアクセスし、最新「Ruby 2.2.3 (x64)」(※2015/11/12時点)をクリック。

DevKitをダウンロードする

同じくhttp://rubyinstaller.org/downloads/
にアクセスし、「For use with Ruby 2.0 and above (x64 - 64bits only)」の方を選んでインストーラをダウンロードする。

DevKitのインストール

DOSプロンプトを開き、DevKitの展開先フォルダに移動する。
ruby dk.rb initを実行し、下記が出るのを確認する。

[INFO] found RubyInstaller v2.2.3 at C:/Ruby/Ruby22

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

次にruby dk.rb installを実行し、下記が出るのを確認する。

[INFO] Installing 'C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/defaults/operating_system.rb'
[INFO] Installing 'C:/Ruby/Ruby22/lib/ruby/site_ruby/devkit.rb'

Compassインストール

下記をそれぞれ実行。

gem update --system

sudo gem install compass

こんなメッセージが出た。

C:\Users\isomu_000\Downloads>gem install compass
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed ffi-1.9.10
Fetching: rb-inotify-0.9.5.gem (100%)
Successfully installed rb-inotify-0.9.5
Fetching: compass-1.0.3.gem (100%)
    Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks!
Successfully installed compass-1.0.3
Parsing documentation for ffi-1.9.10
Installing ri documentation for ffi-1.9.10
Parsing documentation for rb-inotify-0.9.5
Installing ri documentation for rb-inotify-0.9.5
Parsing documentation for compass-1.0.3
Installing ri documentation for compass-1.0.3
Done installing documentation for ffi, rb-inotify, compass after 22 seconds
3 gems installed

参考

liginc.co.jp

sass --> css 自動コンパイル

  1. config.rbがおいてあるパスを調べる
    例:「/home/aaa/sasspj/ex1」だとする
  2. 下記を実行し、監視させる(終わるときはCtrl+Cらしい)
    compass watch /home/aaa/sasspj/ex1