2016年1月28日木曜日

cordova-jqueryというplugin?が意外と使えない(俺が使えない)やつだったのでこいつでどうにかしてやることを諦めた。
手動でやる時はなにも変なことはしないでいい。以下の感じでやれる。
 
 <link rel="stylesheet" href="js/jquery-1.5.0.mobile.min.css" />
 <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
 <script type="text/javascript" src="js/jquery-1.5.0.mobile.min.js"></script>
参考にしたサイトはここ

2016年1月17日日曜日

cordova でCOMPASS API使う時のプラグイン

COMPASS APIは以下のコマンドを叩く必要がある。 なんでこんなこと書くのかというと俺自身が必要なのに忘れていて、かれこれ数時間を異空間に消し飛ばしてしまったためその戒めの為にこうやって書いておく
$ cordova plugin add org.apache.cordova.device-orientation
詳しくはリンクを参考 Cordova コンパス

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
使いたい。

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