Tuesday, January 23, 2018

落書きした ウヘヘ




Railsのコンソールに入らずに(非インテラクティヴ)コマンドとかを実行する方法

普通は $rails c (--sandbox) とか使って中に入ると思いますが、
これだと自動化とか、いちいち入りたくない場合に面倒ですね。
 
その際は rails r [command] 構文を使用します。
参照系の場合、p/putsを使用して書き出さないと何が起こってるかわからないです。
 
 
$ rails r "p Person.find_by(field: 'Value').field" 

Railsのfixtureに定義されているデータをDBにブッコム方法

通常はfixtureは単体テストのときロードするためのただのDSLなのでDBには入ってごじゃりません。こいつをpostgresとかお抱えのDBに突っ込むには以下のようにやります。

$ rake db:fixtures:load FIXTURES=table1,table2,...

FIXTURESの後ろに[...].ymlの拡張子でない部分を入れます。複数形じゃないとダメです。

http://brandonhilkert.com/blog/using-rails-fixtures-to-seed-a-database/


 ないし、特定のFIXTUREではなく全てディレクトリ単位でロードしたい場合、
$ rake db:fixtures:load [フィクスチャのディレクトリ]

とやります。だから例えばフィクスチャが test/fixture配下にあれば、
 $ rake db:fixtures:load test/fixture

となります。

Monday, January 22, 2018

Gitのrebaseの重要性




rebaseというのは往々にして看過されがちなgitのコマンドである。また、中身もきちんと見ていくと頭がこんがらがるので、よくわからない、馬鹿にでもわかるようにざっくり説明してくれ、となると以下のようになる。

「mergeは基本歴史が汚れるので、そういうのをもっと綺麗にする」

gitでmergeしていくと、複数人、しかも大規模な人数での開発だとあの人がこれしました、この人がこれしましたみたいな履歴がどんどん山のように積み重なっていく。で、そいつらをまんまくっつけまくってるとぐちゃぐちゃしてごちゃごちゃしてとんでもなくなってしまうということです。

rebaseは、そういうのをどうにかしてくれるということです。

なので、Commitが1000あるようなウンコブランチでも、Commitを一個にできる。
また、過去のCommitを編集したり、Commit同士をくっつけたり、特定のCommitを消すこともrebaseだとできる。

$ git rebase -i develop

などが有名なCommitの編集方法です。弊社では基本まずdevelopブランチが権威あるものなので、こいつ中心で考えると、

$ git checkout develop
$ git pull develop
$ git checkout my_branch
$ git rebase -i develop

というとても面倒臭い事をしなきゃいけないくてとっても残念です。なので僕は以下のスクリプトを使っています

https://github.com/keitaroemotion/gco

で、

$gco pp; git rebase -i develop

なんかやると上の一連の操作をやってくれます(詳しくはソースコードを読んでね)

さらに、

/usr/local/bin/gcopp

みたいなのを作り、そこに

gco pp

みたいに書いた後

$chmod +x /usr/local/bin/gcopp

ってやり、かつ同じ要領で

/usr/local/bin/rid に
git rebase -i develop 
みたいなのを書いて、

$ gcopp; rid

ってうてば全部よしなにやってくれます。


以上

Saturday, January 20, 2018

トラックの音割れとかをなくした、後リミックスした





音楽とは

人生を何年もやってくると、そして大人になると、精神を壊してしまうくらい追い詰められてしまうことはよくある。それは人間の実存そのものがポイズンだ、ということもあるし(坂口安吾的な)その中で現実とどうやって折り合いをつけていくかというのはとっても大切なことである。

ある人はそのまんまその毒に当てられて自ら命を絶つこともあるし、ある人はそのまんま人を騙したり傷つける人になるし、ある人はモルヒネや薬物を(それは実際のものでなかったとしても)打つことによってなんとかしようとする。ある人は完全に忘れようとする。

鈍感であればそれは大した負荷にはならない。だがしかし、ある程度気づいてしまうと、絶望の深淵が待っている。それは闇であったりとかする。

多くのミュージシャンが、音楽は逃げ場だったというような自分語りをする。それは往々にして正解である。 僕はそっちに共感する。

音楽は音楽という単体のジャンルではない。音楽というか音は、そのまんま他のものと地続きに(こういう言葉を使うと猫も杓子も劣化した意味合いで使い出すので嫌なんだけど、)なっている。

例えば、美術とか映像と音楽は地続きになっている。モネとドビュッシーは地続きになっている。それは確かに繋がっている。


音楽と映像は相互に連関していて、その奥にある世界観とか(というか世界自体)を表すための別々の手段にすぎない。また、音と映像と思想や宗教も連関している。

例えば、ノイズ音楽を直接聴いたりしたことがあれば分かると思うが、ノイズは「無機物」や「悪魔」を描いている、ということがしっかりと伝わる。目の前に、大きな悪魔の顔が描かれているのを把握できる。

ニューエイジなどでは、風景の広がり、それは野原から、ただの幾何的な空間から、宇宙とか銀河系まで、表現したいものが明確に伝わる。

ニューエイジに近いのはグレゴリオ聖歌とかチベットの宗教音楽とかコーランの朗読、が挙げられる。

それぞれがそれぞれの空間や、場合によっては過去をそのまんま温存していて、それと干渉することができる。

それぞれの音楽は、音という媒体を通して他の何かと干渉している。それ自体が、音楽の持つ救いでもあるのかもしれない。


僕個人にとっては、(そして多くの似たような人にとっては)、自分の音楽を消費するというのは自分の自我をそれ自体を通して確認しており、それはとても神聖な行為に近い。
 
 よく世間では「ナルシスト」「自己顕示欲」と揶揄されるような自己の存在確認行為も、その対偶をとって仕舞えば、自分の価値を認識できず、自殺というところまで行ってしまう。

自分の価値を自分で認識した状態を保つということは生命線である。自分を鏡で認識した時に眉をひそめてしまう状態は、やはりどこかに不健康さや傷が存在する。

 音楽は、(特に作る側にとっては)、それ自体が自分の安全な世界、自分の空間、自分というエリアの再認識、自己肯定といったいろんな浄化作用を刹那的にも得る場所としてとても重要である。

(社会にさらされていると、いろんな場面で「お前はこの程度の価値だ」ということを強制的に上書きされる局面によくであう。時にそれは否定であったり、裁きであったりするわけであるが、そう言った洗脳?を解いて再び自分自身である状態にフォーマットする時にも、音楽は大きな力を持つ)

落書きしてみたよ




能、歌舞伎っぽい感じで

Thursday, January 18, 2018

助六 2



伝統芸能(能、狂言、歌舞伎)の一番の価値って、例えば室町の、その時の「時間の認識、消費」「身体の認識、使い方」「空間や音に対する考え方」「言葉に対する考え方、使い方」といったものをそのまま温存していて、(この動画だとかなり現代に寄せてしまってるけど)

明治維新から始まって戦後以降欧米化してしまった時間、音、体、空間、言葉をまんま大昔にロールバックできるので貴重だと思う


能か歌舞伎行きたいな..... 高いけど....

落合 陽一氏 1/17時点でのビットコインの動きと今後について

Sunday, January 14, 2018

漫画喫茶いった

 ごくせん 森本梢子 集英社 (1−3)

1Pあたりのコマ数が比較的少なく、縦で2-2.5の割り方。背景の描き込みも割と簡素で、1ページにつき一コマ、が多くそれ以外は白い。回想シーンも白背景。
主な焦点は「主人公の山口久美子という担任が、底辺男子校を受け持つ」というところである。
山口は、滅茶苦茶戦闘力が高い。これがカリスマポイントになっており、ある生徒が後ろからパチンコ玉を投げても見ないで躱せるくらい殺気を察知する能力に長け、16歳の頃から空手有段者の担任を伸してしまうほど強い。また、ヤクザの家に属しており、その中での人間関係のドラマ等もある。
各エピソードは、主にキャラをより詳細に描写するための回想であるか、生徒などの中で問題があったり、トラブルに巻き込まれたりすること、また、ひったくりであるとか外部からの事件が無理やり学園やその人物に関わってくる、といったものがトリガーになって進む。

対象読者: 比較的広い。難易度から青年だが、男女は問わない。
メリット: 主人公のカリスマ性を消費して面白い、と感じる。また、不良漫画独特の空気や、学校での問題(いじめ、トラブル、非行、不良の意外な内面(ギャップ))を消費することによってドラマを楽しむことができる。)男性よりがターゲットであるが、女性目線できつい表現はない。(よって守備範囲広め)



神のみぞ知るセカイ (1)若木民喜 少年サンデー

主人公はギャルゲー厨のオタクボーイ(ただし、女性に求められるスペックは揃えている)。彼に初期段階で設定が組み込まれる。

特定の女(x)を口説いて自分に惚れさせる。これができないと強制的に付けられた首輪が当人の首をそぎ落とす。

これは押掛け女房的、サブキャラによって設定され、彼女はイベントを最後に締めるキャラ、また、 イベント(各ミッション)を補助するキャラとして立ち回る。

対象読者: 男性。(年齢は青少年)(か、男性目線にコミットする傾向の強いオタク女子)
メリット: ハーレムの消費。様々な個性を持った女の子キャラクターを攻略、ほんわかした色気やときめきを消費して、現実で満たされない恋愛欲求を満たしてくれるのでどちらかというとオタク向け。仮想現実。ギャルゲーのロールプレイ。


ヤングアニマル

ふたりエッチ 克・亜樹 

完全なエロ系。エロに特化しているため、どのように女体を赤裸々に見せるか、といったことに焦点が絞られている。メリットはエロ。(成年漫画雑誌のグラビアページとほぼ同じ機能性であり、それを漫画でフルにアプローチしている)

ギャルごはん 太陽まりい

Gペンでなく筆と細ペン。女の子かわいい。極端のエロと異なり、よりソフトに恋愛を消費する。

いけない彼女のお手伝い 中原開平
楽園のゲルニカ 武田一義 戦争サバイバル系
民法改正 あかほりさとる 

あそびあそばせ 涼川りん
美少女ギャグ 女の子の可愛さとコメディの二点が焦点。個々のキャラクターをコミカルに動かして楽しませるように作っている。英語ができない外人キャラをいじる、というイベントで1エピソードもたせている。

上野さんは不器用 tugeneko
エロ美少女マイルド系。キャラはらき☆すた的な二頭身に近い可愛い系。ただ、キャラの中身は抽象度が高くこれもらき☆すた系。


斑丸ケイオス 大野ツトム
キングダムっぽい。モンスターの大きさなど質感のプレゼンテーションが上手。戦闘シーンもそこそこ面白い。



ヤング系の雑誌は、全体の傾向として露骨なエロ(女体を見せる)、ソフトエロ(間接的)、恋愛系(ただし女性キャラは抽象度が高い)。特化しすぎていて、若干疲れる嫌いがあるが、男性読者の最大公約数に消費されるためには避けて通れない要素か。(島耕作しかり)。なのでエロ漫画にならないすれすれにどこまでいけるかが勝負のポイントだとも言える。(あくまでターゲットが青少年であれば、の話)

もしここを避けて通るとすれば、タブー系か自己啓発系か情報付加価値系の二つの焦点を多めにするといいのかもしれない。 特定の、それでいてニッチであり、(誰も手をつけていないトピック)かる需要が大きいものを探り当てるかが鍵だ。

しかしそれは付加価値なため、多くの場合はセカンダリに持って行かれることが多い。

また、これらの付加価値とエロを組み合わせるという手段は鬼に金棒かもしれない。ただし女性読者や子供をごっそり切る覚悟がないといけない。

綺麗事で成功(ここでの成功は、それを生業とできるだけの継続的な需要を獲得できる事を示す)できる人は本当に一握りなので、使える手段はなるべく全て使うべし。もちろん、対象が変われば、全てのセットを変えなければならない。

Saturday, January 13, 2018

ひと段落ついた

ひろみん大ピンチ編がとりあえずひと段落ついた。

そろそろギャグ路線に戻していい頃だ。


まあいろいろ風刺できたし良かったと思う

また次からはギャグにします Scalaビッチを進めてもいいと思うし、投稿用はネタはあるけどどうしようかな.... 忙しすぎてね....


https://www-indies.mangabox.me/episode/99913/

Friday, January 12, 2018

Kernel memo: Regular Paging

Paging is conversion of liner address into the physical address.
Linear address is composed of Directory, Table, and Offset.
cr3 (in Physical Address Extension we use cr4) is the control register to store the physical address converted to linear address.
 

 





 

The conversion process is described as:

Let L be the Linear address. L(d,t,o) as the portions of it.

L = Ld + Lt + Lo = L(d,t,o)

We name translation tables as f, such that

fd ... page directory 
ft ... page table
fo ... page frame

Then

P = cr3 + fd(Ld) + ft(Lt) + fo(Lo) = cr3 + f(d,t,o)(L(d,t,o))

on which P stands for physical address corresponding to the L.

Such two-level paging is used in order to save the amount of RAM used in each Page Table.
Also, if we need more memories, the three or four level paging is used in which case we use additionally Paging Global Directory, Paging Upper Directory, Paging Middle Directory etc...

Kernel Segmentation Brief Memo


 Segmentation Unit is the Unit which translates from logical address to linear address. (and Paging Unit translates it into physical address).

 Segment Selector is the segment identifier of the logical address of CPU. It is totally 16bit, and composed of index, Table Indexer(TI), and RPL.

TI is the field where the address belongs to GDT(Global Descriptor Table) or LDT(Local Descriptor Table). While GDT stays unchanged and always used once, LDT often called or changed during execution and it is plural.

RPL is Request Privilege Level, which is under the concept of rings, it describes whether is has permission of Kernel-Level or User-Level.



 GDT/LDT each is assigned in gdtr/ldtr(registers). The picture above shows how the logical address (at the bottom = Index + TI + offset) is translated into linear address.


For more details about GDT/LDT:
http://chunqili.blogspot.jp/2013/06/what-is-gdtldtidttss.html

Thursday, January 11, 2018

Rails Tips: polymorphic

This article is just a memo to note how the polymorphic in Rails model works.

For instance, if we have app/model/a.rb then find the description as the following:

belongs_to: M polymorphic: true

then at the same time you did not find any table M in seeing the tables in schema.rb.
Only M you have is that of concern directory. This means the model class A inherit from multiple the other model classes such as B, C.















 B, C is defined as belonging to the concern M, which is stated in each model class.


 For more details, please refer to the link below:
http://guides.rubyonrails.org/association_basics.html#polymorphic-associations

Wednesday, January 10, 2018

Rails render, and redirect_to, head explained (just a memo)

Sometimes  dummy developers like me suffer to understand what on earth the render is, which is often described in the rails codebase, controllers and to some extent it looks obvious that it let pages redirected to another page, but not sure what in detail it is going on, since there are so many parameters. Rails is designed in the concept of convention over configuration, which I personally am not fan of, relies on hidden rules and variables which cannot been visible with a glance at the narrow class.

Here is the blief explanation of what these methods are:

render: (ActionController::Base#render)
  send back full response to the browser
redirect_to:
  send http redirect status code to the browser
head:
  send HTTP header to browser



Okay, then lets find out what these notations are about.

render

by default, render takes argument stands for its actions, such as:

def update
  ...
  render "edit" # or this can be symbol :edit
end

Then you can go to edit.html.erb

In the controler book_controller.rb, you can render the action of another controller products such as:

render "products/show"
render template: "products/show" # same as above


You also can return page with simple plain text such as:

render plain: "asshole"

or the other forms of data:
render html: "<p>aaa</p>".html_safe
render json: ...
render xml: ...
render js: ...


Options for render is as follows:

    :content_type
    :layout
    :location
    :status
    :formats


you can add MIME type declaration with the content_type option such as:

render file: filename, content_type: "application/rss"

location options sets the HTTP location header:

render xml: photo, location: photo_url(photo)


status option allows you to return the HTTPStatus:

render status: 500
render status: :forbidden


format option converts the original page, usually html to the other file format:

render formats: :xml
render formats: [:json, :xml]


Layout

layout is the kind of pre-set webpage layout template which can be reused by each view. it is by default located under app/view/layout

It is going to be called such as:

class ProductsController < ApplicationController
  layout "inventory"
  #...
end

the thing is, once you define the layout in the controller, the corresponding views under product/*.html.erb follows the layout defined there. (inventory)

You can choose layout at runtime:

class ProductsController < ApplicationController
  layout :products_layout

  def show
    @product = Product.find(params[:id])
  end

  private
    def products_layout
      @current_user.special? ? "special" : "products"
    end

end


Conditional Layout

In the example below, the views except index and rss can load the product layout.

class ProductsController < ApplicationController
  layout "product", except: [:index, :rss]
end


render_partials 

There is the way to partially borrow another view in a single view.

http://api.rubyonrails.org/classes/ActionView/PartialRenderer.html


redirect_to

it takes as argument direct target URL:

redirect_to photos_url
redirect_back(fallback_location: root_path)

use different status code for redirection

it is usually 302 by default but you can customize it:

redirect_to photos_path, status: 301


the difference between redirect_to and render is, redirect_to does not pass anything between pages, whereas render passes those shared state.


http://guides.rubyonrails.org/layouts_and_rendering.html

Saturday, January 6, 2018

仕事早すぎ❤️

まだ試作段階だけどトラック作った




音割れはまだ低音のカットが終わってないからってことで。

夜2時くらいまでやってたので眠い

Tuesday, January 2, 2018

How fake news is created: まとめサイトの有害性の考察

On the Cyberspace, we often face with the propaganda which makes people believe in the maxim, forged by the gigantic organizations. It is globally common tactics, seemingly kind of conspiracy theory but as far as the phenomena appropriately monitored and analyzed, this really looks valid theory. Say we name it as malicious group(MR), as already seen in PRISM, those groups try ardently to cancel the opinions or facts broadcasted by individuals, with the Cancellation Tactics (CCT), with deferring the credibility of the target.






MR tries bunch of approaches to disable the opinion k, which conflicts with the profit of them(k').

k ≠ k' ... (1)


If we assume the total individuals reachable on media as T, then regarding p as individual and opinions/ideology's variety expressed as from opinion a to z, then


T = Σp{a-z}   ...(2)


In order to disable the effect of 'k', first they need to do is to sample the people with criminal records or mental disorder, such as:

Σp{a-z} ≡ Σu{a-z} ... (3)

Then, the discredited individuals with the opinion (k) has been sampled, and according to (1):

Σu{k},  k ≠ k' .... (4)

Broadcasting the Σu{k}, on the media which is frequently accessed from, such as in Japan, matome site(まとめサイト), or using Twitter with fake accounts:

B(U),  Σu{k} ≡ U ... (5)


B(U) ⇒ R ... (6)

Such that R is the clients who access to the target media.


Now we concluded that how specific opinion in conflict with gigantic profit groups or entity, demolished or disabled because of their tactics to ROUTING/REDIRECTING target opinion (k) to the discredited groups with the same/similar opinion.

This problem has been used to hinder our democracy and it should be publicly known by people and they must know how to handle the broadcasted data by the media.

We once heard that Julian Assange was rapist, which is completely nonsense intentional false charge.
Another example, the women who disclosed the internal issue of Dentsu corp, such as Maturi Takahashi or Haachu, did went through the same process, they has been tried to discredited because of their past twitter(Sampling and Broadcasting).
Also, another instance, we all know how Muslims went through after 911 with this kind of harassment and they are falsely labeled as terrorists.

People need to be extremely careful.

漫画+音楽コンボの悩み

いつも惨敗の合コンにて....

女「菅野さんって休みの日とか何してるんですかぁ?」
私(うーん、最近iPad Pro端末で描いてた線画をアナログに切り替えてまた消しゴムかけが大変だったんだけどまた繊細に描くのが実現した。で、今サブ主人公の鬼頭宏美が父親に日本拳法の訓練でしごかれている回想シーン描いてるんだけど板垣先生の刃牙みたいにかっこよくかくのなかなか難しい。で、結局ギリギリ削除対象にならないようなエロシーンで男性読者の関心を引きつけることでなんとか数字を稼ごうと頑張ってる。また、クリスタ経由でのトーン処理で25%あたりがLINEではいいがトーンの種類では想定と違う出力が出たりして大変。あと楽曲は3曲作ってうち1曲はラップかなー。。。三連符フローとか実現したけどスピード的にしょぼいので改善しないと.... あとはカーネルの勉強したり、あとは故郷の土手をぶらりぶらりだなー.....) 「うーん、漫画とかですかね....」
女「へー(ツマンネぇ....)」


を1千万回くらい繰り返してるのでもっと喋りやすいアクティヴィティが欲しかった....