2016年1月17日日曜日

cordova のアプリの名前を変える

作っているアプリの名前(つまり、ランチャーの名前)を変える方法は以下のみたいな感じで変更できる。ただ正しいやり方、行儀のいいやり方ではないような気がする。
以下に示したhogeがアプリの下に表示される名前(ランチャの名前)にあたる。
 <?xml version='1.0' encoding='utf-8'?>
   <resources>
       <string name="app_name">HelloWorld</string>
       <string name="launcher_name">hoge</string>
       <string name="activity_name">@string/launcher_name</string>
   </resources>
ファイルの場所は一応示しておくと以下に置いてある(はず)。分からないときはとりあえずlocateしたらでてくると思う。
(プロジェクトのディレクトリ)/platforms/android/res/values
検索したときに日本語ではヒットせず(検索のしかたが悪い。)、英語で「cordova change app name」でもヒットしなかったのはなんか悲しかった。

cordovaでのアプリ開発のときに使うコマンドとか

以下のコマンドでプロジェクトは作成。
hello はディレクトリ名、Helloworldはアプリ(ランチャー)の名前、com.example.hello は識別子を逆に並べてヤツ。なんでこうするのかはめいめいで調べてください。おれはよく知らない。
cordova create hello com.example.hello HelloWorld

とりあえずhelloディレクトリに移動したら、
以下のコマンドでプラットフォームを追加(そのままだが、、、)
若干乱暴に言うと、ここで対応するOSをaddする。以下はandroidに対応させている。
cordova platform add android
このコマンドでプラットフォームを確認できる。
cordova platforms ls

以下のコマンドでビルド
cordova build
以下のコマンドで実機実行(もちろんandroidデバイスを接続しておかなけばならない)
cordova run android
エミュレータはこんな感じ
cordova emulate android
エミュレータは予めエミュレータのイメージを作っておく必要がある。(らしい)
でもエミュレータは遅いので俺は使っていない。実機の方がなにかと良い気がする

2016年1月14日木曜日

cordovaの罠

cordovaのAPIとかを使うには以下の一行が必要になる
 <script type="text/javascript"> charset="utf-8" src="cordova.js"<script>
リファレンス関連をちゃんと読まないで始めるから簡単なところでハマる。 皆さんはそんなことのないようお気をつけ下さい。

2016年1月11日月曜日

なんか事故った時のための俺のvimrc

なんか事故った時の為に自分のvimrcをここに置いておくことにする。
自分が最近よくつかっているのはUnite.vim
目的のファイルまですぐに行けるのが嬉しい。
if has('vim_starting')
  set nocompatible               " Be iMproved

  " Required:
  set runtimepath+=~/.vim/bundle/neobundle.vim/
endif

" Required:
call neobundle#begin(expand('~/.vim/bundle/'))

" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'

" My Bundles here:
NeoBundle 'Shougo/neosnippet.vim'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'kien/ctrlp.vim'
NeoBundle 'flazz/vim-colorschemes'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'plasticboy/vim-markdown'
NeoBundle 'kannokanno/previm'
NeoBundle 'tyru/open-browser.vim'
NeoBundle 'thinca/vim-quickrun'
NeoBundle 'Markdown'

" You can specify revision/branch/tag.
NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }

call neobundle#end()

" Required:
filetype plugin indent on


" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck


set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
 set rtp+=~/.vim/bundle/Vundle.vim
 call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
 Plugin 'VundleVim/Vundle.vim'
"
 " The following are examples of different formats supported.
 " Keep Plugin commands between vundle#begin/end.
 " plugin on GitHub repo
 Plugin 'tpope/vim-fugitive'
 " plugin from http://vim-scripts.org/vim/scripts.html
 Plugin 'L9'
 " Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
 " git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
 " The sparkup vim script is in a subdirectory of this repo called vim.
 " Pass the path to set the runtimepath properly.
 Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
 " Avoid a name conflict with L9
" Plugin 'user/L9', {'name': 'newL9'}

Plugin 'Yggdroot/indentLine'
" " All of your Plugins must be added before the following line
 call vundle#end()            " require
 filetype plugin indent on    " required
" " To ignore plugin indent changes, instead use:
" "filetype plugin on
" "
let g:indentLine_color_term = 239
"let g:indentLine_char = 'c'
" " Brief help
" " :PluginList       - lists configured plugins
" " :PluginInstall    - installs plugins; append `!` to update or just
" :PluginUpdate
" " :PluginSearch foo - searches for foo; append `!` to refresh local cache
" " :PluginClean      - confirms removal of unused plugins; append `!` to
" auto-approve removal
" "
" " see :h vundle for more details or wiki for FAQ
" " Put your non-Plugin stuff after this line
syntax on
set number
set encoding=utf-8 
set fileencodings=utf-8,sjis
set ff=unix
let g:quickrun_config = {}
set autoindent
set shiftwidth =4

google.maps.geometry.spherical.computeDistanceBetweenが使えない。(多分)

jQueryをさらっとさわったので調子にのってjQuery mobileも同じ感じと思って手を出してみた。

画面遷移の仕様がちょっとわからなかったが、今はどうにか分かった。

今ぶち当たっている壁は


google.maps.geometry.spherical.computeDistanceBetween(loc1,loc2);
が使えないこと。
とりあえず直線距離は数学的に算出できるけどさ。。。。
ちょっと面倒だからgoogle.maps.geometry.spherical.computeDistanceBetween
使いたい。

できれば教えてほしい。分かる人。。。。

2015年11月28日土曜日

Mac、外部出力VS内部出力

最近はMacbook airで作業することが多いのですが、ノートPCっていうのは使う人の姿勢をどんどん悪くしていくモノだと思っています。手元の高さを合わせれば目線がベストのところにこないし、逆に目線を合わせれば手元が次は。。。という状況になってしまいます。

僕はここでちょっと思いつきました。。。。「クラムシェルで起動すればこの状況解決できるんじゃ。。?」とね。

ただクラムシェルは排熱がうまくできないというデメリットがありますし、電源繋ぎっぱなしというのもあまり好きではありません。僕はここでまた思いつきました。思いついちゃいましたよ。

「画面は開けっ放しでディスプレイの明るさをゼロにしてディスプレイミラーリングすれば排熱もクリアできるんじゃ。。。?」

そしてこれは実現できるんですけど、懸念材料が出現しました。バッテリー問題です。「電源繋ぎっぱなしは嫌」という考えと「ディスプレイ出力は外部に出力」という考えは同時に確立し得ないのでしょうか。。。。よし。調べるぞ。結果としては以下のとおりです。

  • 10%減少するまでの時間を測定した
    • 外部出力:27分
    • 内部(Macの画面のこと)出力:41分



分かってたよ。だろうね。悲しいよ。
もうしばらく姿勢を悪くしながらMacを使うとしますよ。もう。。。

2015年7月14日火曜日

Atom pdf-vews 日本語化のバグ





setting -> Open config folder -> packages -> pdf-view ->node_modules ->pdfjs-dist -> build -> pdf.js

を編集。

//PDFJS.cMapUrl = (PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl);
PDFJS.cMapUrl ="../cmaps/";

//PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
PDFJS.cMapPacked = true;


という感じで変更。その後ATOMを再起動する。できなかったらちょっと追加。

npm install pdfjs-dist


以上です。ではでは