<?xml version="1.0" encoding="UTF-8" ?>
<feed xml:lang="ja" xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0">
  <title type="text">隠居SEの備忘録</title>
  <subtitle type="html">やったことの記録
主にlinuxとかperlとか</subtitle>
  <link rel="self" type="application/atom+xml" href="https://inkyose.gjgd.net/atom"/>
  <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/"/>
  <updated>2017-05-27T17:46:06+09:00</updated>
  <author><name>隠居SE</name></author>
  <generator uri="//www.ninja.co.jp/blog/" version="0.9">忍者ブログ</generator>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" />
  <entry>
    <id>inkyose.gjgd.net://entry/23</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/selenium%20-%20headless%20chrome" />
    <published>2018-12-12T09:26:30+09:00</published> 
    <updated>2018-12-12T09:26:30+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>selenium + headless chrome でのダウンロードが失敗する</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[最近、selenium + chrome (headless) + タスクスケジューラで動かしてるプログラムがよくコケるようになった。<br />
気にはなってたけど、手動で動かすと動いていたので調査を後回しにしてたら、今日全く動かなくなった。<br />
仕方ないので重い腰を上げて調査したら、headlessでなければ動くのとエラーが出る時は以下のようなエラーが出ることが分かった。
<pre>[1212/084929.223:INFO:CONSOLE(11)] "Uncaught (in promise) NotAllowedError: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD", source: https://～～～ (11)
</pre>
どうやら動画再生回りでコケている模様。<br />
でも、取得してるページは特に動画を扱うページではないんだけど．．．<br />
広告かな？<br />
<br />
キーワードを試行錯誤しつつググって以下のページを発見。<br />
<span style="font-size: large;"><a href="https://qiita.com/nukisashineko/items/decf54efc2c8b3c201e1" title="">chrome(v66以降)でseleniumテストが動画の自動再生でハングする - Qiita</a> </span><br />
なので、書いてあるとおり、
<pre>--autoplay-policy=no-user-gesture-required
</pre>
と言うオプションを追加したら、解決しました。]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/22</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/-munin-%20-fatal-%20there%20is%20n" />
    <published>2018-09-28T08:01:21+09:00</published> 
    <updated>2018-09-28T08:01:21+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>[munin] [FATAL] There is nothing to do here, since there are no nodes with any plugins.</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[９月１２日にmuninがアップデートされてから、<br />
５分置きにエラーメールが送られてくるようになりました。<br />
<br />
送り主は&nbsp;/usr/bin/munin-cron<br />

<pre>[FATAL] There is nothing to do here, since there are no nodes with any plugins. Please refer to <a class="moz-txt-link-freetext" href="http://munin-monitoring.org/wiki/FAQ_no_graphs">http://munin-monitoring.org/wiki/FAQ_no_graphs</a> at /usr/share/munin/munin-html line 40</pre>
<br />
<br />
最初はあまり気にしてなかったのですが、<br />
あまりに沢山通知が来るし、ログは膨らむし、どうやらグラフの更新も止まってるようなので、<br />
指示されたページに書かれたことをすべてやってみるも、<br />
全く効果なし＿|￣|○ il||l<br />
<br />
ネット検索でもなかなか有益な情報が得られず、結構時間を無駄にしましたが、<br />
検索条件を１ヶ月に絞ったらあっさりヒット。<br />

<h2 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom: 1px solid #eaecef; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';"><a href="https://mgng.mugbum.info/1454" style="box-sizing: border-box; background-color: transparent; color: #0366d6; outline-width: 0px;">munin で [FATAL] There is nothing to do here, since there are no nodes with any plugins. メールが届きまくる：犬ターネット</a></h2>
<br />
/etc/munin/munin.conf<br />
のlocalhostのところのコメントを外すだけでした。<br />

<pre>#
# A simple host tree
#
[localhost]
      address 127.0.0.1
      use_node_name yes
</pre>
<br />
<br />
有益な情報をありがとうございますm(__)m]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/21</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/libsepol.print_missing_req" />
    <published>2018-09-26T11:53:19+09:00</published> 
    <updated>2018-09-26T11:53:19+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>libsepol.print_missing_requirements: munin&#039;s global requirements were not met: type/attribute munin_services_plugin_t (No such file or directory).</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[タイトルのエラー、結構悩みました。<br />
<br />
audit.logにmunin関係のエラーがたくさん出てたので、<br />
ポリシーの修正を試みたところ、タイトルのようなエラーが出ました。<br />

<pre># grep munin /var/log/audit/audit.log | audit2allow -M munin
# semodule -i munin.pp
libsepol.print_missing_requirements: munin's global requirements were not met: type/attribute munin_services_plugin_t (No such file or directory).
libsemanage.semanage_link_sandbox: Link packages failed (No such file or directory).
semodule:  Failed!
</pre>
<br />
munin_services_plugin_t が登録されて無いのか？と思って、<br />

<pre>semanage permissive -a munin_services_plugin_t
</pre>
<br />
したりもしましたが、全く効果なし。<br />
<br />
他にもいろいろやりましたが、どれもハズレ。<br />
<br />
ネット検索も色々やってみたものの、回答には結びつかず。<br />
<br />
で、半ば諦めかけた頃になって、答えにたどり着きました。<br />
<br />

<pre># grep munin /var/log/audit/audit.log | audit2allow -M munin2
# semodule -i munin2.pp
</pre>
<br />
なら通る。<br />
そう、munin.ppと言う名前が既に使われているからダメな模様。<br />
名前を変えればいいだけでしたとさ。<br />
<br />
う～ん、難しい＿|￣|○ il||l]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/19</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/%E6%AD%A3%E3%81%97%E3%81%84sql%E3%82%A4%E3%83%B3%E3%82%B8%E3%82%A7%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E5%AF%BE%E7%AD%96%E3%81%A8%E3%81%AF" />
    <published>2018-09-25T15:56:50+09:00</published> 
    <updated>2018-09-25T15:56:50+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>正しいSQLインジェクション対策とは</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p>ネットを徘徊していて、<br />
未だSQLインジェクション対策について誤解されている方が多いのかな？と感じることがあったので、<br />
ここに正しいSQLインジェクション対策とはどう言うものかを簡単に記載しておきます。<br />
<br />
<br />
そのために、まずSQLインジェクションとは何かをかいつまんで説明します。<br />
<br />
SQLインジェクションとは、SQL文に差し込まれたデータによってSQL文が改変され、<br />
意図しない結果を返してしまうことを言います。</p>
<pre>$id = "1234";
$pass = "' or pass != '";
select * from account_table where id = '$id' and pass = '$pass';
</pre>
<pre>select * from account_table where id = '<strong style="font-family: Arial, メイリオ, sans-serif;">1234</strong><span style="font-family: Arial, メイリオ, sans-serif;">' and pass = '</span><strong style="font-family: Arial, メイリオ, sans-serif;">' or pass != '</strong><span style="font-family: Arial, メイリオ, sans-serif;">';</span></pre>
<p><br />
<br />
そしてその原因は、外部から入力されたデータ（入力データ由来の保存データも含む）を用いて動的にSQL文を組み立てることにあります。<br />
（上記はデータの差し込みですが、order by句などでカラム名を差し込む場合も同じです）<br />
<br />
<br />
ですから、正しいSQLインジェクション対策とは、<br />
<strong>動的にSQL文を生成しないこと</strong>になります。<br />
<br />
そして、静的SQL文のみでアプリケーションを組み立てるには、<br />
プレースホルダを使わなければならないと言うことです。<br />
<br />
<br />
ですから、プレースホルダを使っていても、<br />
外部から入力されたデータがSQL文に混入するような動的SQL文の構築を行っていたのでは、<br />
全く意味はありません。<br />
<br />
<br />
ソート順をユーザーに選択させるようなシーンは滅多にないでしょうし、<br />
必要な場合でも結果をすべて読み込むようなケースであれば、<br />
アプリ側でソートすれば済む話です。<br />
（私は、ソートのような単純処理は、DBサーバー側ではなくAPサーバー側で行う派です。<br />
　理由は、Apサーバーの方がスケールアウトが容易だからです）<br />
<br />
もちろん、読み込むカラムも、絞り込み条件も、ソート順もユーザーが任意に指定できるようにするような、<br />
DB管理ソフトのようなものでは動的SQLの構築は避けられませんが、<br />
そのようなアプリケーションを組む人がいったいどれだけ居ると言うのでしょうか？<br />
（そのような場合でも、enumを利用するなど、入力データを用いないようにすることはできますが）<br />
<br />
そのようなレアケースを軸とした対策ではなく、<br />
プログラマのスキルによらず確実に対応できるようにすることこそが、<br />
正しい対策です。<br />
<br />
<br />
動的SQLの生成は止めましょう。<br />
プログラムの先頭でprepareしておいても正しく動くプログラムを目指しましょう。<br />
<br />
</p>]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/18</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/apache%E3%81%8B%E3%82%89postgres%E3%81%AB%E3%82%A2%E3%82%AF%E3%82%BB%E3%82%B9%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84" />
    <published>2018-09-21T14:26:21+09:00</published> 
    <updated>2018-09-21T14:26:21+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>ApacheからPostgresにアクセスできない</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[個人でサーバー内DBを使ってゴニョゴニョする程度だったら、<br />
Sqlite3が一番軽いしメンテも楽だし．．．ってことでずっとSqlite3使ってたのですが、<br />
ネットワーク越しにDB閲覧しようと思ったら、<br />
Sqlite3だと極端に重くなってしまいました。<br />
<br />
原因がSqlite3にあるのかWebDAVにあるのかは不明ですが、<br />
ちゃんとしたDBエンジンを使うタイミングかと思い、<br />
現役時代ぶりにPostgresをインストールしてみました。<br />
<br />
インストールや設定は難なく終了し、<br />
データの取り込みも行い、<br />
さて、同じサーバー上のcgiからアクセスするかと言う段になって、<br />
何故か繋がらない(- -;ｳｰﾑ<br />
同じcgiでバッチならちゃんと動くのに。<br />
<br />
と言うことでログを漁ると、<br />
<br />
httpd/error_log<br />

<pre>[Fri Sep 21 12:33:03 2018] [error] DBI connect('dbname=foo','',...) failed: could not connect to server: Permission denied\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? at /usr/share/perl5/foo/DBI.pm line 125\nCompilation failed in require at /home/foo/html/view.cgi line 9.\nBEGIN failed--compilation aborted at /home/foo/html/view.cgi line 9.\n
</pre>
と言うわけで、アクセス権がない模様。<br />
<br />
考えられる原因は３つ。<br />
ひとつはpostgresの設定。<br />
しかし、postgresのログには何も出ていないので、postgresに到達できていないと考えるべき。<br />
<br />
次に考えられるのはiptables。しかし、<br />
sysconfig/iptables
<pre>-A INPUT -i lo -j ACCEPT
</pre>
と言う具合に、iptablesの設定はローカルアクセスを制限していないので、これも違う。<br />
<br />
と言うことは、３つ目の可能性であるSELinuxのポリシー制限。<br />
と言うわけでログを確認すると、<br />
audit.log<br />

<pre>type=AVC msg=audit(1537500783.022:18112): avc:  denied  { connectto } for  pid=3214 comm="httpd" path="/var/run/postgresql/.s.PGSQL.5432" scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:system_r:initrc_t:s0 tclass=unix_stream_socket
</pre>
と言うことで、どうやらpostgresのsocketにアクセス権がないらしい。<br />
<br />
事前に、ApacheからDBにアクセスするための設定として、<br />

<pre>[root@foo foo]# setsebool -P httpd_can_network_connect_db 1
</pre>
と言うコマンドを入れておいたのですが、不十分だったようです。<br />
<br />
と言うわけで、以下のように設定を生成して追加。<br />

<pre>[root@foo foo]# cat /var/log/audit/audit.log | grep postgres | audit2allow -M postgres
[root@foo foo]# semodule -i postgres.pp
</pre>
以下のような設定が生成されたようです。
<pre>module postgres 1.0;

require {
        type postgresql_db_t;
        type httpd_t;
        type initrc_t;
        class unix_stream_socket connectto;
        class dir read;
        class file getattr;
}

#============= httpd_t ==============
allow httpd_t initrc_t:unix_stream_socket connectto;
allow httpd_t postgresql_db_t:dir read;
allow httpd_t postgresql_db_t:file getattr;
</pre>
<br />
これで一応、アクセスができるようになりました。 めでたしめでたし。<br />
]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/17</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/-android-%20parcelable%E3%82%92%E5%AE%9F%E8%A3%85%E3%81%97%E3%81%A6%E3%81%84" />
    <published>2017-10-30T20:22:26+09:00</published> 
    <updated>2017-10-30T20:22:26+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>[Android] Parcelableを実装しているのにデータが復元できない</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<span face="ＭＳ ゴシック" style="font-family: 'ＭＳ ゴシック';"><span style="font-size: 9pt;">いくつかのカスタムビューで</span><span style="font-size: 12px;">Parcelableを使ってデータを退避してる筈なのに、<br />
</span></span>何故か一部のカスタムビューだけデータが復元できませんでした。<br />
<br />
追いかけてみると、onSaveInstanceStateやonRestoreInstanceStateのイベント自体は発生しているのですが、writeToParcelが呼び出されず、データが保存されていない様子。<br />
リソースIDが割り当てられていなかったり重複していると正しく保存されないことは知っていたので、<br />
真っ先に確認するも、他では使っていない判りやすい名前を使っているので、重複は考えにくい。<br />
<br />
でも、よくよく探してみると、重複してました(￣&nabla;￣*)ゞﾃﾍｯ<br />
<br />
元々Activityに直接書いていた複雑な構造のビューを切り出してカスタムビューにしたので、<br />
カスタムビュー自体にIDがセットされていて、<br />
そのカスタムビューをActivityに載せた時に、そちらにも同じIDをセットしてしまっていました。<br />
その結果、ひとつのビューに２つのIDが振られてしまい、<br />
正しく保存できなくなっていたようです。<br />
<br />
activity.xml
<pre>  &lt;jp.foo.bar.mycustomview
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:id="@+id/myCustomView" /&gt;</pre>
<br />
custumview.xml
<pre>&lt;!--?xml version="1.0" encoding="utf-8"?--&gt;
&lt;relativelayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="match_parent"
  <strong><span style="color: #ff0000;">android:id="@+id/myCustomView"</span></strong>&gt;  &larr;これが余計

&lt;/relativelayout&gt;
</pre>
<br />
半日無駄にした(^^;<br />
<br />
<br />
<br />
<br />
<a href="/Search?search=#AndroidStudio">#AndroidStudio</a> <a href="/Search?search=#Parcelable">#Parcelable</a>]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/16</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/-android--java-%20%E9%96%A2%E6%95%B0%E3%82%92%E3%82%B9%E3%83%AC%E3%83%83%E3%83%89%E5%8C%96%E3%81%99%E3%82%8B" />
    <published>2017-10-25T13:48:11+09:00</published> 
    <updated>2017-10-25T13:48:11+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>[Android][Java] 関数をスレッド化する</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[Androidは時間のかかる処理をUIスレッド上で行うことは、<br />
端末が固まったように見えるのでご法度と言うことらしいので、<br />
スレッド化を試してみました。<br />
<br />
でも、無意味にスレッド化しても仕方ないので、<br />
関数を簡単にスレッド化したり、<br />
効果が見込めないと戻せるようにするための書き方を記載しておきます。<br />
もちろん、スレッドなので、戻り値を求めるような関数には使えません。<br />
<br />
対象となる関数は、仮に<br />

<pre>private void funcFoo( int Var ){<br />
}</pre>
とします。<br />
<br />
まずは引数をスレッドに渡すために、<br />
引数の値をすべて保持するThreadクラスを継承したワーカーを作ります。<br />
ポイントは、関数が要求する引数と同じ変数を内部に定義し、<br />
コンストラクタで渡し、run()メソッドから元の関数を呼び出します。<br />

<pre>private class funcFooThread&nbsp;extends Thread{
    //引数に使う変数
&nbsp; &nbsp; int Var;
    //コンストラクタ
&nbsp; &nbsp; public funcFooThread( int Var ) {
&nbsp; &nbsp; &nbsp; &nbsp; this.Var = Var;
&nbsp; &nbsp; }
    //スレッド処理
&nbsp; &nbsp; public void run(){
&nbsp; &nbsp; &nbsp; &nbsp; funcFoo( Var );
&nbsp; &nbsp; }
}
</pre>
<br />
あとは、今まで関数を呼び出していたところで、<br />
新しいスレッドを関数と同じ引数で作り、start();するだけです。<br />

<pre>funcFooThread&nbsp;thread = new funcFooThread( Var );
thread.start();
</pre>
これなら、スレッドが上手く機能しなかった時も、<br />
簡単に戻せます。<br />
<br />
<br />
実のところ、作ってるアプリが動作中に固まったように見えたと言うことではなく、<br />

<pre>I/Choreographer: Skipped 280 frames!&nbsp; The application may be doing too much work on its main thread.
</pre>
と言う警告が出てたので、重いビューを生成してる場所をスレッド化してみたのですが．．．<br />
今のところ効果がありません(- -;ｳｰﾑ<br />
<br />
<br />
<a href="/Search?search=#AndroidStudio">#AndroidStudio</a> <a href="/Search?search=#Java">#Java</a> <a href="/Search?search=#Thread">#Thread</a>]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/15</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/-android-%20%E3%83%AA%E3%82%BD%E3%83%BC%E3%82%B9%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%86%85%E3%81%A7%E3%81%AE%E7%A9%BA%E7%99%BD%E3%81%AE%E6%89%B1%E3%81%84" />
    <published>2017-10-18T14:56:54+09:00</published> 
    <updated>2017-10-18T14:56:54+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>[Android] リソースファイル内での空白の扱い</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[リソースファイルに空白が複数入った文字列を定義して、<br />

<pre>&lt;string name="format_summary1"&gt;Games:%1$d&nbsp; &nbsp; &nbsp;Total:%2$d&nbsp; &nbsp; &nbsp;Avg:%3$.1f&lt;/string&gt;</pre>
これをTextViewに表示したところ、htmlのように空白が詰められました。<br />

<pre>Games:0 Total:0 Avg:0</pre>
XMLにそんな仕様あったけ？などと思ったのですが、かと言って&amp;nbsp;に変えてもエラーが出るだけ。<br />
試しに文字列をダブルクォーテーションで囲ってみたら、<br />
スペースが詰められることはありませんでした。<br />

<pre>&lt;string name="format_summary1"&gt;<strong><span style="color: #ff0000;">"</span></strong>Games:%1$d&nbsp; &nbsp; &nbsp;Total:%2$d&nbsp; &nbsp; &nbsp;Avg:%3$.1f<strong><span style="color: #ff0000;">"</span></strong>&lt;/string&gt;
</pre>
<br />
<a href="/Search?search=#AndroidStudio">#AndroidStudio</a>&nbsp;<a href="/Search?search=#Resource">#Resource</a>]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/14</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/-android-%20multiple%20substit" />
    <published>2017-10-17T08:22:02+09:00</published> 
    <updated>2017-10-17T08:22:02+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>[Android] Multiple substitutions specified in non-positional format; did you mean to add the formatted=&quot;false&quot; attribute?</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<pre>&lt;string name="format_summary"&gt;Games:%d&nbsp; Total:%d&nbsp; Avg:%.1f&lt;/string&gt;
</pre>
<br />
こんな値をリソースファイルに書いたら、<br />
<br />

<pre>Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?</pre>
<br />
と言うエラーが出た。<br />
<br />
位置指定されていない複数の置換が指定されたフォーマットだよ。<br />
もしかして、非フォーマットデータだった？<br />
<br />
と言う意味らしい。<br />
<br />
つまり、位置指定するか、アトリビュートを追加しろと言うことですね。<br />
<br />
位置指定するならこう。<br />
<br />

<pre>&lt;string name="format_summary"&gt;Games:%<span style="color: #ff0000;"><strong>1$</strong></span>d&nbsp; Total:%<strong><span style="color: #ff0000;">2$</span></strong>d&nbsp; Avg:%<span style="color: #ff0000;"><strong>3$</strong></span>.1f&lt;/string&gt;</pre>
<br />
アトリビュートを追加するならこう。<br />
<br />

<pre>&lt;string name="format_summary" <strong><span style="color: #ff0000;">formatted="false"</span></strong>&gt;Games:%d&nbsp; Total:%d&nbsp; Avg:%.1f&lt;/string&gt;</pre>
<br />
<br />
<a href="/Search?search=#AndroidStudio">#AndroidStudio</a> <a href="/Search?search=#Resource">#Resource</a>]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
  <entry>
    <id>inkyose.gjgd.net://entry/13</id>
    <link rel="alternate" type="text/html" href="https://inkyose.gjgd.net/%E6%9C%AA%E9%81%B8%E6%8A%9E/-android-%20contentprovider%E3%81%A7" />
    <published>2017-10-11T17:02:44+09:00</published> 
    <updated>2017-10-11T17:02:44+09:00</updated> 
    <category term="未選択" label="未選択" />
    <title>[Android] ContentProviderでGROUP BYを最もスマートに利用する方法</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[ContentProviderのqueryにGROUP BYやHAVINGの引数がないものだから、<br />
ネット検索してみると、Where句に続けて書いてみるとか色々苦心されているのが伺えた。<br />
<br />
でも、みんなトリッキーな手法に頼り過ぎ。<br />
考えすぎ。<br />
<br />
素直にView作れば済む話ですよね？<br />
<br />
DBを作る時に、<span style="color: #4a4a4a; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', 'Hiragino Kaku Gothic ProN', メイリオ, meiryo, sans-serif; font-size: 16.1px;">BaseColumnsをimplementsして</span>テーブルの定義をしますが、<br />
View用に新たに定義を作ればOK。<br />
CREATE TABLEする時にCREATE VIEWするだけです。<br />
<br />
<br />
<a href="/Search?search=#AndroidStudio">#AndroidStudio</a> <a href="/Search?search=#ContentProvider">#ContentProvider</a> <a href="/Search?search=#GROUP&nbsp;BY">#GROUP BY</a>]]> 
    </content>
    <author>
            <name>隠居SE</name>
        </author>
  </entry>
</feed>