Archive for the ‘Javascript’ Category

 

[titanium][android] titanium.jar not found

10月 26th, 2014

ERROR: Asset package include ‘/Titanium/mobilesdk/osx/3.4.0.GA/android/titanium.jar’ not found. [ERROR] Application Installer abnormal process termination. Process exit value was 1 After update to 3.4.0 GA nothing works any more https://developer.appcelerator.com/question/178514/ android build tools が 20じゃないとダメっぽい?感じです。 build-tools/21.0.x などを他の場所へ退避しておくと大丈夫でした。 とりあえずtitaniumだけでの利用であれば一旦削除しても大丈夫そうです。

Read full article | コメントは受け付けていません。

[titanium] alloy config.json

9月 21st, 2014

alloyでコンフィグをつかう [http://docs.appcelerator.com/titanium/3.0/#!/guide/Project_Configuration_File_(config.json)] config.json { “global”: { “defaultTimeout”: 100000 }, “env:development”: {}, “env:test”: {}, “env:production”: {}, “os:android”: {}, “os:blackberry”: {}, “os:ios”: {}, “os:mobileweb”: {}, “dependencies”: {} } Alloy.CFG.defaultTimeout でアクセス。

Read full article | コメントは受け付けていません。

javascript regexp exec

4月 16th, 2013

regexp.exec 滅多に使わないけど、こんな出力だったんだなと var str = ‘[0-9]+'; var re = new RegExp( ‘[0-9]+’, ‘g’ ); // re = /[0-9]+/g var st = ‘あい876うえお全 100件全 99件'; var result = re.exec(st); console.log(result); var result = st.match(re); console.log(result); $ node test_regexp [ '876', index: 2, input: 'あい876うえお全 100件全 99件' ] [ '876', '100', '99' ] execだとindexとinputが返ってくるようです。何か必要なこともあるかもしれませんね。

Read full article | コメントは受け付けていません。

titanium httpclient getResponseHeader ?

4月 16th, 2013

http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Network.HTTPClient   var client = Ti.Network.createHTTPClient({      onload : function(e) {        // Ti.API.info(e.source.getResponseHeaders());        // Ti.API.info(e.source.getAllResponseHeaders());      }, iOSでは getResponseHeaders Androidでは getAllResponseHeaders でheaderを全部読むことが出来るようですが、getResponseHeadersがドキュメントに載っていないのが気になるところです。

Read full article | コメントは受け付けていません。

install node.js centos

4月 12th, 2013

http://nodejs.org/ http://serverfault.com/questions/299288/how-do-you-install-node-js-on-centos インストールしてrpm作成 http://nodejs.org/download/ 今日時点で v0.10.4 http://nodejs.org/dist/v0.10.4/node-v0.10.4.tar.gz node-v0.10.4]# ./configure { ‘target_defaults': { ‘cflags': [],                       ‘default_configuration': ‘Release’,                       ‘defines': [],                       ‘include_dirs': [],     […]

Read full article | コメントは受け付けていません。

node.js beginner

4月 12th, 2013

http://nodejs.jp/ http://www.nodebeginner.org/index-jp.html httpdサーバーが何してるか知らない人が読んだら良い勉強になる内容ですね http://nodeguide.com/ 書き方 なるほど、これに併せて書きます。

Read full article | コメントは受け付けていません。

titanium mobile : delete remote image cache

4月 10th, 2013

http://developer.appcelerator.com/question/144356/urgent-how-to-clearreset-titanium-remote-image-cache-android この辺。 http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Filesystem applicationCacheDirectory : StringREADONLY Path to the application’s internal cache directory. iosのほうはみんな違う書き方をしているけど昔は無かったのかな? Ti.Filesystem.applicationCacheDirectory ios : Applications/00000000-0000-0000-0000-AAAAAAAAAA/Library/Caches/ これなのでiosもあっています。 Libraryの下は Cookies Preferences Caches Private Documents があって、Private Documents/databasename.sql という名前でsqliteが保存されていました。 画像は、普通に ハッシュ値.jpgの拡張子で保存されています。.をみて消している方は、ディレクトリを消しています。 特に問題ないと思いのですが、中に Cache.dbとかあります。手で全消ししても問題ないようです。 (十分テストが必要ですが) androidはexternalのときの処理が必要。 androidの処理はbanzai mobileさんのやり方を利用させていただきます。 http://developer.appcelerator.com/question/144356/urgent-how-to-clearreset-titanium-remote-image-cache-android#answer-251819 ポイントは、/_tmp/remote-cache/ですね。 全消しはなんとなくあれなので、ファイルを消す処理(getFile以外)は、iosと共通で。 iosだけだとこんな感じ dir = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory); if( dir.exists() ){  var files = dir.getDirectoryListing();  for( var i in files […]

Read full article | コメントは受け付けていません。

titanium android swipe version 2

4月 9th, 2013

以前 touchstart , touchendで利用していたけど https://github.com/appcelerator/titanium_mobile/pull/1835/files 修正されていた。 けどswipeを入れるとscrollが止まるという欠点が発生。 どうするか ということで, androidのときは、swipeを使わないことにしました。 またtouchstart , touchendのところを少し修正。該当部分は以下になります。 iosのときは、swipeを利用しています。 Ti.API.info(‘android’) self.x_start =0; self.y_start =0; self.addEventListener(‘touchstart’, function (e) {   self.x_start = e.x;   self.y_start = e.y; }); self.addEventListener(‘touchend’, function (e) { if( Math.pow((self.x_start-e.x),2) – Math.pow((self.y_start-e.y),2) > 100 ){     if (e.x > self.x_start) {         swipe({direction: […]

Read full article | コメントは受け付けていません。

titanium mobile : splash screen portrate only

4月 3rd, 2013

http://developer.appcelerator.com/question/143160/portrait-orientation-for-splash-screen-for-android-in-appcelerator AndroidManifest.custom.xmlのactivityを替えると。 <activity android:configChanges=”keyboardHidden|orientation” android:label=”aucru” android:name=”.AucruActivity” android:screenOrientation=”portrait” android:theme=”@style/Theme.Titanium”> こんな感じのところです。 android:screenOrientation=”portrait” を追加しました。 これ、cleanすると消えちゃうから、毎回生成する何かが必要。

Read full article | コメントは受け付けていません。

titanium mobile : tableview hide show error

4月 3rd, 2013

https://jira.appcelerator.org/browse/TIMOB-3306 tableview を hide / showしても 中のtableviewrowに反映されないという話。 残念。setDataで空にしたり出来ますが、なんとなく効率が悪い。 他のやり方としては、hideではなくて、画面の外に追い出すというのをよく使います。

Read full article | コメントは受け付けていません。