はてなキーワード: VOIDとは
何番煎じだよって感じだけど、既存のブックマークレットがクエリパラメータとかも含めてURLを取得したり、
選択範囲を本文に反映したりとか、俺にとってはいらない機能が色々あったので、
俺用に最適化したブックマークレットを作った。あと、はてな記法使ったことなかったのでそのテストも兼ねて。
javascript:usrID='KokoniIDwoIreru';function enc(s){ return encodeURIComponent?encodeURIComponent(s):encodeURI(s); }void(window.open('http://anond.hatelabo.jp/'+usrID+'/edit?title='+enc(location.href.replace(/\#.*$/, '').replace(/\?.*$/, '')),'_blank',''));
俺が作ったものではないが、便利なブックマークレットを見つけたので一緒に載せる。
▼を押すことで内容が展開されるが、それを全て展開してくれる。
javascript:(function(){d=document;t=d.getElementsByTagName('ul')[1];a=t.getElementsByTagName('a');for(i=0;i<a.length;i++){if('#'==a[i].getAttributeNode('href').value)a[i].onclick();}})();
clang: warning: argument unused during compilation: '-I .'
clang: warning: argument unused during compilation: '-I proto'
clang: warning: argument unused during compilation: '-U _FORTIFY_SOURCE'
screen.c:1513:17: warning: self-comparison always evaluates to true [-Wtautological-compare]
if (curwin == curwin)
^
screen.c:5676:19: warning: self-comparison always evaluates to true [-Wtautological-compare]
&& Columns == Columns)
regexp.c:3790:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:3790:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:3790:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:4052:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:4052:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:4052:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:5276:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:5276:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:5276:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:5337:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
{ if ((rex.reg_match == ((void*)0))) *(&rex.reg_startpos[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.pos; else *(&rex.reg_startp[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.ptr; };
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:5337:24: note: remove extraneous parentheses around the comparison to silence this warning
{ if ((rex.reg_match == ((void*)0))) *(&rex.reg_startpos[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.pos; else *(&rex.reg_startp[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.ptr; };
~ ^ ~
regexp.c:5337:24: note: use '=' to turn this equality comparison into an assignment
{ if ((rex.reg_match == ((void*)0))) *(&rex.reg_startpos[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.pos; else *(&rex.reg_startp[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.ptr; };
^~
=
regexp.c:5355:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
{ if ((rex.reg_match == ((void*)0))) *(&rex.reg_endpos[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.pos; else *(&rex.reg_endp[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.ptr; };
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:5355:24: note: remove extraneous parentheses around the comparison to silence this warning
{ if ((rex.reg_match == ((void*)0))) *(&rex.reg_endpos[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.pos; else *(&rex.reg_endp[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.ptr; };
~ ^ ~
regexp.c:5355:24: note: use '=' to turn this equality comparison into an assignment
{ if ((rex.reg_match == ((void*)0))) *(&rex.reg_endpos[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.pos; else *(&rex.reg_endp[rp->rs_no]) = (&rp->rs_un.sesave)->se_u.ptr; };
^~
=
regexp.c:5516:22: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:5516:22: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:5516:22: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:6213:21: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:6213:21: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:6213:21: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:6266:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:6266:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:6266:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:6294:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:6294:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:6294:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:6325:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:6325:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:6325:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:6341:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:6341:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:6341:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:6363:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:6363:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:6363:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:7711:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:7711:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:7711:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
regexp.c:7740:23: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
regexp.c:7740:23: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
regexp.c:7740:23: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
In file included from regexp.c:8043:
./regexp_nfa.c:3995:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:3995:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:3995:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4014:21: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4014:21: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4014:21: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4036:21: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4036:21: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4036:21: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4055:21: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4055:21: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4055:21: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4086:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4086:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4086:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4227:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4227:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4227:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4609:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4609:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4609:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4670:22: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4670:22: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4670:22: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4733:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4733:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4733:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4767:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4767:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4767:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:4954:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:4954:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:4954:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:5106:21: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:5106:21: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:5106:21: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:5120:21: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:5120:21: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:5120:21: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:5144:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:5144:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:5144:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:5231:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:5231:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:5231:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:5486:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:5486:25: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:5486:25: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:5608:21: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:5608:21: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:5608:21: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:5897:23: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:5897:23: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:5897:23: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:5987:26: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:5987:26: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:5987:26: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:6873:26: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:6873:26: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:6873:26: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:6997:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:6997:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:6997:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
./regexp_nfa.c:7095:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((rex.reg_match == ((void*)0)))
~~~~~~~~~~~~~~^~~~~~~~~~~~~
./regexp_nfa.c:7095:24: note: remove extraneous parentheses around the comparison to silence this warning
if ((rex.reg_match == ((void*)0)))
~ ^ ~
./regexp_nfa.c:7095:24: note: use '=' to turn this equality comparison into an assignment
if ((rex.reg_match == ((void*)0)))
^~
=
内容によりけりだけれど、よくやるリファクタリングの例を紹介しておきます。
// したいことは英語でいい名前をつける void したいこと(){ // したいこと } if( param==0 && 判定(param2) ){ したいこと(); }else if( !param3 ){ したいこと(); }
ただし、こういう複雑で奇妙な条件分岐がここに入ってくる時点で設計面の問題があるのではないかと感じます。
paramが0の時には何か例外的な動作なのではないかとか、「したいこと」の中でさらに何度もparamたちを判定して汚いコードになっているのではないか、などです。
最近の若者はワンライナーなのか、3項演算子使わないと馬鹿にされるのか知らないけれど、
賢そうな構文は使わなくていい。
boolean check(int param, int param2, int param3) { if ( param == 0 && 判定(param2) ) { return true; } else if ( param3 == false ) { return true; } else { returnn false; } } void main() { if ( check(param, param2, param3) ) { //したいこと } }
newしてから渡せば良いと思うよ。
いちいちクラスに分ける理由は、こういう感じで、クラス内の変数にアクセスすれば、画面事の表示とかが簡単に出来る的な?
// Javaの書き方しらん、インターフェースを実装することを定義したい
public class EventHoge : View.OnClickListener {
//画面事の名称
// Javaの書き方しらん、インターフェースのメソッドを実装することを定義したい
public void View.OnClickListener.onClick(View v) {
AlertDialog.Builder dlg;
dlg = new AlertDialog.Builder(MainActivity.this);
dlg.setTitle("画面の名前:" + ViewName); // 画面名称が表示されるイメージ
dlg.setMessage("Hello, サンプル!");
dlg.show();
//<ーー
}
}
// Androidなにも知らんけど、元増田がボタンにイベントを書く処理が書いてあるクラスのことが言いたい
// そのメソッド
final Button button = new Button(this);
button.setText("ダイアログの表示");
View.OnClickListener ocl = new EventHoge();
ocl.ViewName = "画面その一";
button.setOnClickListener(ocl);
}
}
こんな感じにすれば、画面が二つあって、
その画面の名称を表示するようなボタンを、二つメソッドをコピペして作らなくていい的な?
サンプルは、出来るだけとっちらかさないよう、匿名クラスとか使って、サンプルで紹介したいところ「だけ」を書くんだよね。
だから、そのサンプルがどういう意味かをちゃんと読み取って、自分ならこう書くとか、こう書けるか? とかを考えてこそ勉強だと思うよ?
今回のレイだと「View.OnClickListener」っていうインターフェイスを実装したクラスを、setOnClickListenerすればいいってことさえわかれば、
匿名クラス?(っていうのかな? ちょっと用語はよくしらん、クラス定義を使い回さず、その場だけのクラス定義を書く書き方)とかを使わずに、
どういうふうに応用ができるか? とか頑張れ!
頑張れ!
頑張れ!
はああああああ。
おれはビールを飲む!
うーん?
いや、なんか、通じてないな。
もうちょいサンプル詳しく書くから、サンプルのどこがわからないか言ってくれ。
// Javaの書き方しらん、インターフェースを実装することを定義したい
public class EventHoge : View.OnClickListener {
// Javaの書き方しらん、インターフェースのメソッドを実装することを定義したい
public void View.OnClickListener.onClick(View v) {
AlertDialog.Builder dlg;
dlg = new AlertDialog.Builder(MainActivity.this);
dlg.setTitle("サンプル");
dlg.setMessage("Hello, サンプル!");
dlg.show();
//<ーー
}
}
// Androidなにも知らんけど、元増田がボタンにイベントを書く処理が書いてあるクラスのことが言いたい
// そのメソッド
final Button button = new Button(this);
button.setText("ダイアログの表示");
button.setOnClickListener(new EventHoge());
}
}
こうやって、クラス分けて書けば、外とか中とか、全く関係なくなるじゃん。
元増田のサンプルだと、メインの中でインターフェースを実装したクラスの実装を書いてるから、中とか外とかがあるんじゃないのか?
自分でクラスとして定義して、そっちで実装すれば、メインは紐づけるだけでよくなって、仮引数?の中で実装しなくてもすむじゃん。
よくわからん。
中が嫌なら外でかきゃいいじゃん。
// Javaの書き方しらん、インターフェースを実装することを定義したい
public class Hoge : View.OnClickListener {
// Javaの書き方しらん、インターフェースのメソッドを実装することを定義したい
public void View.OnClickListener.onClick(View v) {
AlertDialog.Builder dlg;
dlg = new AlertDialog.Builder(MainActivity.this);
dlg.setTitle("サンプル");
dlg.setMessage("Hello, サンプル!");
dlg.show();
//<ーー
}
}
// メインスレッド的なところ
final Button button = new Button(this);
button.setText("ダイアログの表示");
button.setOnClickListener(new Hoge());
こう書けば、中で書かなくて良い気がするけど、駄目なの?
なんか、インターフェースだから引数の中ってのが意味わからん。
どう関係してるの?
お疲れさまです。
まず全体的に、インデントがおかしいのと「}」が不足しています。
プログラム仕様書とはいえ「}」や「;」は書く必要がないため、もう少し日本語として通じる文章にしてください。
下記の
俺 = 彼女いない歴 = 年齢;
「もし」ではなく、繰り返しを意味する「諦めない」でしょうか?
また「彼女=フリー;」setupメソッドで「なんかモテそう」を代入していますが、フリーで上書きして問題ありませんか? その場合「なんかモテそう」の代入処理は必要なのでしょうか?
変数彼女のフォーカスが不明のため、このクラス内だけでは考慮できません。
次に「俺頑張る++」は、人間型の変数俺の頑張るプロパティをインクリメントするという意味でしょうか?
上記のループが回っているときに、このメソッドではない別のメソッドで、変数彼女と俺の友達の値が変更されるため、上記のループの中に条件式があるのでしょうか?
もし、そのためであれば、非同期処理を本当に使う必要があるのか、もう一度設計を見直してください。
そのためでないのなら、ループが始まるまえに、条件式を記載してください。
return 今夜も童貞;
voidなので、値を返すことはできません。
また、条件式の結果によっては、値を返さないケースがあります。
その場合は初期値を返すのか、エラーを投げるのか明記してください。
以上、指摘事項を受けて、修正箇所があれば修正を行い、レビュー結果ドキュメントに修正箇所を明記してください。
また、質問箇所については、レビュー結果ドキュメントに回答もセットで記載してください。
文章でわかりにくいところがありましたら、遠慮なく私のところまで聞きにきてください。
http://d.hatena.ne.jp/keyword/%EB%CC%CA%DB%A4%CE%A5%AC%A5%A4%A5%C9%A5%E9%A5%A4%A5%F3
------------------------------------------------------------------------------------------------
詭弁の特徴15条
あなたが「犬は哺乳類としての条件を満たしている」と言ったのに対して否定論者が…
「犬は子供を産むが、もし卵を生む犬がいたらどうだろうか?」
2.ごくまれな反例をとりあげる
3.自分に有利な将来像を予想する
「何年か後、犬に羽が生えないという保証は誰にもできない」
4.主観で決め付ける
5.資料を示さず持論が支持されていると思わせる
「ところで、カモノハシは卵を産むのを知っているか?」
「それは、犬を哺乳類と認めると都合の良いアメリカが画策した陰謀だ」
8.知能障害を起こす
「犬が哺乳類なんて言う奴は、社会に出てない証拠。現実をみてみろよ」
「犬が卵を産めるようになれば良いって事でしょ」
「ところで、犬がどうやったら哺乳類の条件をみたすんだ?」
13.勝利宣言をする
「犬が哺乳類だという論はすでに何年も前に論破されてる事なのだが」
「犬って言っても大型犬から小型犬までいる。もっと勉強しろよ」
参考:18条パターンの追加項目
「全ての犬が哺乳類としての条件を満たしているか検査するのは不可能だ(だから、哺乳類ではない)」
「確かに犬は哺乳類と言えるかもしれない、しかしだからといって、哺乳類としての条件を全て持っているというのは早計に過ぎないか。」
18.自分で話をずらしておいて、「話をずらすな」と相手を批難する。
「現在問題なのは犬の広義の非哺乳類性であり、哺乳類であるかどうかは問題ではない。話をそらすな」
これに付記するものとしてKusakabe(void)論法がある。
追加項目
「生物学の権威じゃないおまえには犬について議論する資格が無い。生物学者に意見を聞きたい」
------------------------------------------------------------------------------------------------
例1「犬が哺乳類だと言うのは、恐竜が哺乳類だと言うようなものだ。」
例2「では恐竜は哺乳類扱いされているだろうか?されていないだろう。犬の件もそれと同じ事である。」
また、昔2ちゃんねるで見かけたスレでも、比較対象を誤っている論者がいるなどと注意喚起されていました。
ありえない解決策を図るについては、「犬が卵を産めるようになれば良いって事でしょ」は大げさにしても、
:echo 1 / 0 :echo 0 / 0
2147483647 -2147483648
きっしょwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
他の言語もチェックしてみるか
package main import "fmt" func main() { fmt.Println(1 / 0) fmt.Println(0 / 0) }
echo 1 / 0; echo 0 / 0;
PHP Warning: Division by zero。
print 1 / 0 print 0 / 0
ZeroDivisionError: integer division or modulo by zero
print(1 / 0) print(0 / 0)
ZeroDivisionError: division by zero
nodejsだと1/0と0/0で異なるメッセージが表示された。
console.log(1 / 0);
Infinity
console.log(0 / 0);
luajitだとnodejsで表示されたメッセージの短縮形で表示された
print(1 / 0)
print(0 / 0)
main = do print(1 / 0)
Infinity
main = do print(0 / 0)
public class Test { public static void main(String[] args) { System.out.println(1 / 0); } }
public class Test { public static void main(String[] args) { System.out.println(0 / 0); } }
Exception in thread "main" java.lang.ArithmeticException: / by zero at Test.main(Test.java:3)
#!/bin/bash echo $((1 / 0)) echo $((0 / 0))
test.bash: 行 4: 1 / 0: 0 による除算です (エラーのあるトークンは "0") test.bash: 行 5: 0 / 0: 0 による除算です (エラーのあるトークンは "0")
haskellとnodejsとluajitはエラーにならないけどまあいい。
Vimはやべえよ。
最近2階が覗きたくなることが増えたので書いた。2階があればブクマ数の周りに2階のリンクを追加する。
javascript:void[].map.call(document.querySelectorAll("a.entry-info,.entry>a.entry-link,.users a"),function(e,n){n=new XMLHttpRequest,n.open("GET","/entry/jsonlite/"+e.href),n.responseType="json",n.onload=function(t,o){(t=n.response)&&e.insertAdjacentHTML("beforebegin",((o=t.count)+" upper"+(o>1?"s":"")).link(t.entry_url))},n.send()});
http://b.hatena.ne.jp/以下のページで使えるはず。
void [].map.call(document.querySelectorAll('a.entry-info,.entry>a.entry-link,.users a'),function(u,x){ x=new XMLHttpRequest(); x.open('GET','/entry/jsonlite/'+u.href); x.responseType='json'; x.onload=function(j,c){ if(!(j=x.response))return; u.insertAdjacentHTML('beforebegin',((c=j.count)+' upper'+(c>1?'s':'')).link(j.entry_url)) }; x.send(); });
こいつをブロックしたい→http://partsa.nikkei.com/parts/js/ab/rtcontrol_rcmd002_02.js
Safariの拡張はChromeのものとほぼ同等なので、Chrome拡張での方法を検索
→ Chrome拡張でページのグローバル変数にアクセスしたい https://note.mu/kkotaro0111/n/nd527d31957a7
ビンゴ。
location.href = 'javascript: document._write = document.write;' + 'document.write = function() {};' + 'void 0;';
2021/04/25用
%:include <stdio.h> %:include <stdlib.h> %:define 三つ子と五つ子の協奏曲 main %:define ☯ ; %:define 環 while %:define 異名 typedef %:define 終焉 101 %:define 伝承(詩) printf(_Generic((詩), int: "%d\n", char *: "%s\n"), 詩) %:define 純白を漆黒に漆黒を純白に(色) (色 = 終焉 - 色) %:define 終わりは、斯く示された。 return 0 異名 int 無限整数の幻想を維持せぬ整数 ☯ 異名 char 世界の言葉を扱うには不十分な箱 ☯ 異名 void 虚無 ☯ 無限整数の幻想を維持せぬ整数 破滅の刻 = 終焉 ☯ 虚無 三つ子と五つ子の協奏曲(栞, 慈悲深き終身独裁者の注文) 無限整数の幻想を維持せぬ整数 栞 ☯ 世界の言葉を扱うには不十分な箱 **慈悲深き終身独裁者の注文 ☯ { 環 (0 <-- 破滅の刻 && 純白を漆黒に漆黒を純白に(破滅の刻) && ((破滅の刻 % 3) * (破滅の刻 % 5) ? 伝承(破滅の刻) : 伝承(破滅の刻 % 15 ? 破滅の刻 % 5 ? "Fizz" : "Buzz" :"FizzBuzz")) && 純白を漆黒に漆黒を純白に(破滅の刻)) ☯ 終わりは、斯く示された。 ☯ }
http://d.hatena.ne.jp/Francis/20070210/1171124970
不要なコードを削ったんだが、まだ不要なコードが混じっている気がするんだ。
でも俺、JavaScriptが全くわからんからどこを削ればいいのかもわかっていない状況。誰か助けてけろ~(涙)
今のところ、削っても動作したのは次のコード。
javascript:YourID='YourID';w=window;function bq(s){return '';}function enc(s){return encodeURIComponent?encodeURIComponent(s):encodeURI(s);}if(w.getSelection){q=w.getSelection();}void(w.open('http://anond.hatelabo.jp/'+YourID+'/edit?title='+enc(location.href)+'&amp;body='+enc(bq(q)),'_self',''));
※javascript:YourID='YourID'の'YourID'を自分のはてなIDに変更してブックマークレットに登録することで動作
このコードは次のような感じに動作するっぽい。
・新規作成画面のタイトル部分に取得したURLを出力、本文は空白
皆さんにお聞きしたいことは次のとおり
↑現在のコードは新規ウィンドウが出ないから期待動作ではあるんだが、
これはfunction bq(s){return '';}と'&body='+enc(bq(q)),によってこうなってるって感じ。
でも、コードとしては不適切な気がして、できればこの部分を削って他のそれらしいコードにしたい。
けど、これを削除するとなんか新規ウィンドウで開いちゃう。なんかいい方法ないかしら…
・選択範囲を指定せずにクリックしてもはてな匿名に移動すること
↑元のコードは選択範囲を選択して引用するみたいなことができるんだが、
俺はそれを使わないのでそれ関連のコードは削除した。
主にd=documentやd.selectionらへん。
で、これについて、ちゃんと選択関連のコードが全部消せてるのか自信ない。
・これは欲張りだけど、トラバリンク押下後の遷移先のURLに#tbとつくのを防ぎたい
↑トラバしたい記事で、トラックバックのリンクをクリックすると、URLに/YYYYMMDDHHMMSS#tbってつくじゃないですか?
こういった時にブックマークレットを使うと、日記のタイトル部分がhttp://anond.hatelabo.jp/YYYYMMDDHHMMSS#tbになるんだ。
これを出来ればhttp://anond.hatelabo.jp/YYYYMMDDHHMMSSにしたい。
他の増田にも突っ込まれているが、君の言う「強者」は我々の所属するコミュニティで通常使用するそれと意味が異なるように思う。
君は、
と書いているが、君のその「人間社会の常識」なるものは増田では誰とも共有できていないのが現状である(そうでなければ「これはこういう意味なんだよー」と説明してくれる暇人が出てきそうなものだ)。これでは、まさかとは思いますが、あなたの言う「人間社会の常識」とは、あなたの想像上の存在にすぎないのではないでしょうかと煽りたくなった者がいても責めることはできまい。
こういう状態で
書いてないことを読み取るという低能丸出しの行為を2度繰り返すとはw
(http://anond.hatelabo.jp/20150409223903)と言われても、君の主張が意味不明だからこっちが解釈してやろうってのにそれはないよ、という感想しか持ちえない、少なくともおれは。
そしてついでに書いておくと、君のその「説明を要求されてもはぐらかす」「こういう意味かと聞かれたらそんなことは言ってないと否定する」というスタイルは、それに対する反論のコストが非常に高くなるために、かなり有効な闘争手法ではある。一時期、たぶん20年くらい前、インターネットコミュニティの一部で非常に流行したvoidの「ということにしたいのですね」もこの一例だと言っていいだろう。ただ、徹頭徹尾アンフェアなので、ふつうの人は最近これを使わない。それに、これは一種の焼畑農法である。この闘争方法に敗れた(というより愛想をつかしたと言うべきかもしれないが)人間がコミュニティを利用しなくなると、最終的には、「ということにしたいのですね」「ということにしたいのですね」と言い合う発言者しか残らないが、そんなのbotでもできることであり、意味のあるコミュニケーションとは言えない。
…とここまで書いてもうかなり飽きてきたけど、低能連呼君はvoid風オトボケにそこそこキャッチーな罵倒を混ぜてるから、あのころfj.sci.mathで認知心理学者を煽ってた大学院生にむしろ近いよね。彼今どうしてるのかなあ、と思って検索したが曽根清治みたいなことになってなかったので安心した。いや、まあネットで活動してないだけかもしれないけどw
マジレスすると、U+00a5なら使える。俺なら設計を修正させるけど。
Path.GetInvalidFileNameChars メソッド (System.IO)
using System; using System.IO; namespace TestInvalidFileName { class Program { static void Main(string[] args) { // Get a list of invalid file characters. char[] invalidFileChars = Path.GetInvalidFileNameChars(); Console.WriteLine("The following characters are invalid in a filename:"); ShowChars(invalidFileChars); Console.WriteLine(); string fileName = '\u00a5' + "108"; using (var fs = File.Create(fileName)) { if (fs != null) { Console.WriteLine("File was created:" + fileName); fs.Close(); } else { Console.WriteLine("File was not created:" + fileName); } } } public static void ShowChars(char[] charArray) { Console.WriteLine("Char\tHex Value"); // Display each invalid character to the console. Array.Sort(charArray); foreach (char someChar in charArray) { if (Char.IsWhiteSpace(someChar)) { Console.WriteLine(",\t{0:X4}", (int)someChar); } else { Console.WriteLine("{0:c},\t{1:X4}", someChar, (int)someChar); } } } } }
The following characters are invalid in a filename: Char Hex Value (中略) ", 0022 **, 002A /, 002F :, 003A >, 003C >, 003E ?, 003F \, 005C |, 007C File was created:\108
javascript:void(document.body.innerHTML=document.body.innerHTML.replace(/ISI[SL]|イスラム国/g,"イスイス団").replace(/IS/g,"イスイス団"));