Rodhos Soft

備忘録を兼ねた技術的なメモです。Rofhos SoftではiOSアプリ開発を中心としてAndroid, Webサービス等の開発を承っております。まずはご相談下さい。

スクロール禁止にする

この記事に詳細は書いてある。

qiita.com

touchmoveをaddEventListenerしてpreventDefaultする。その際にpassive:falseを指定する必要がある。

function handleTouchMove(event:TouchEvent){
  console.debug("touchmove.noScroll prevent..");
  event.preventDefault();
}
          /// ひとまず一律スクロール禁止にする。
          console.debug("setup touchmove.noScroll prevent..");
          document.addEventListener('touchmove', handleTouchMove, { passive: false });
          // document.removeEventListener('touchmove', handleTouchMove, { passive: false });   

中身が空のフォルダになる

Sorcetreeでcloneしたところ、中身が入っていないフォルダができることがあった。

warning: templates not found が出ていた。以下をみると重たいかららしいが、今回は他のブランチをチェックアウトした。

sourcetreeでcloneした時に warning: templates not found /usr/local/git/share/git-core/templates というエラーが出る - Qiita

apatcheの使い方

macで初歩的な使い方を忘れていたのでメモしておく。

入っているか

httpd -v

開始

 sudo apachectl start
 sudo apachectl restart

動いているか

ps aux | grep httpd

設定、ドキュメントルートなどは

httpd.conf

ファイルにある。

BASIC認証

久しぶりにやってはまった。

.htaccess をドキュメントルート以下で制限したいところにおくのだが、 そもそも、それが効くのはhttpd.confでAllowOverride Noneではだめで、Allとかにしておく必要があった。

あと、Basic認証は通ってしまえばあとは出てこないので、.htpasswordとかのユーザー名とかを変えて出すようにしたりした。他の方法もあるかもしれない。 フルパスはcatしてみれば出てくるのでそこまではまらない。

はまったこと

iOS13ではcrossorgin設定だけではだめで、BASIC認証もかかっているときはmanifest.jsonファイルを.htaccessで許可しておかないとだめなようだ。

<files manifest.json>
Satisfy any
order allow,deny
allow from all
</files>

rxjsで購読を止める

色々やり方はあると思うが一つ聞いたのはこういうもの。

const root = new BehaviorSubject<"start"|"end">("start");
const subject = new Subject<string>();
const op = root.pipe(mergeMap((x) => {
    if (x == "end") {
        return throwError(new Error("end"));
    }
    return subject;
})).pipe()
op.subscribe((x) => {
    console.log("1:"+x);
},(e) => {
    console.log("1:"+e);
})
subject.next("a");
subject.next("b");
root.next("end");
root.next("start");
op.subscribe((x) => {
    console.log("2:"+x);
},(e) => {
    console.log("2:"+e);
})
subject.next("c");
subject.next("d");
root.next("end");
root.next("start");
subject.next("e");
subject.next("f");
/*
1:a
1:b
1:Error: end
2:c
2:d
2:Error: end
*/

サブモジュールがクローンされない。

以下を参照した。

gitでクローンと同時にサブモジュールを初期化、アップデートする – IsaB

cloneしてから

git submodule update --init --recursive

で良いようだ、 それかそもそも

--recursive

をつけてcloneしておく。