Archive for 4月, 2013

 

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 | コメントは受け付けていません。

git tag –delete origin tagname

4月 7th, 2013

remote tagを削除 $ git tag -d v1.2.4 $ git push –delete origin v1.2.4 To 127.0.0.1:/path/to/git – [deleted]         v1.2.4 こんな感じ。

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

PHP5 typehinting タイプヒンティング型指定

4月 7th, 2013

http://php.net/manual/ja/language.oop5.typehinting.php function( Array $hairetsu ){ } function( AnyInterface $ahaha ){ } みたいな、関数の引数に、インターフェイス、オブジェクト、配列、( callable 関数) を型指定。

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

redis incrby

4月 6th, 2013

redis > incrby aaa 1 で 1 増やすキーが無い時は 0 + 1になる。 redis > incrby aaa -5 もできる、マイナスも増える redis > set neighbor:aaa “{‘aaa’,9}” OK redis > sort neighbor:login by nosort get neighbor:* get * 1) “{‘aaa’,9}” 2) “4” redis > incrby aaa 1 (integer) 5 redis > sort neighbor:login by nosort get neighbor:* get * 1) […]

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

php strtotime fix

4月 4th, 2013

前月や次月の計算が strtotime(‘+1 month’); strtotime(‘-1 month’); のとき、30日±されるので、2月末や3月初旬にズレます。 そこで strtotime(date(‘Y-m-1′) . ‘+1 month’); strtotime(date(‘Y-m-15′).’-1 month’); とやるのが良いそうです。

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

trac style customize : priority color

4月 4th, 2013

プライオリティーはデフォルト5種類ですが、 直近対応するべきタスクに付けるように high を入れてみた。 http://trac.edgewall.org/wiki/CookBook/SiteStyleCss http://stackoverflow.com/questions/9585931/control-over-trac-ticketquery-is-it-possible-to-change-the-ticket-color-accordi スタイルのこの辺を替えるらしい。 table.tickets tbody tr.prio1 # templates/site.html を作る style.cssを入れたいだけなのでこれだけ <html xmlns=”http://www.w3.org/1999/xhtml”      xmlns:xi=”http://www.w3.org/2001/XInclude”      xmlns:py=”http://genshi.edgewall.org/”      py:strip=””>  <!–! Add site-specific style sheet –>  <head py:match=”head” py:attrs=”select(‘@*’)”>  ${select(‘*|comment()|text()’)}  <link rel=”stylesheet” type=”text/css”  href=”${href.chrome(‘site/style.css’)}” />  </head> </html> httpdを再起動するとheadの一番下に  <link rel=”stylesheet” type=”text/css” href=”/trac/chrome/site/style.css” />  </head> こんな感じ。 あとは、上書きしたいスタイル部分を htdocs/site/style.css に書く。 # htdocs/site/style.css […]

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 | コメントは受け付けていません。

nginx + eval + memcached : check block id

4月 1st, 2013

API認証をどうしようかと memcachedにブロックidを入れて、チェックしようと思います。 1. nginx でmemcachedからデータを取得 ng => 403 ok => 2 2. アプリケーションサーバーへ idが正常 => データを返す + ログをfluentdへ流す => 3, idが不正(桁数や簡単な法則チェックのみ) => memcachedへblockidとして登録。403を返す。 ipチェックもする 3. 正常時 fluentd + redisでidカウンタ 数値が上がったらアラート →異常値→4 4. 異常値確認 異常値だったらmemachedへblockidとして登録 // 別プロセスで定期的にredisをチェック。 これでいけそうです。 /// インストール http://blog.bbtune.com/archives/2412/nginx-exchange-header 以前と同じ方法でrpmを作ります。 https://github.com/agentzh/nginx-eval-module 1.0.3を使わせていただきます。    –add-module=/tmp/nginx/headers-more-nginx-module-0.19rc1\    –add-module=/tmp/nginx/nginx-eval-module-1.0.3\ debugバージョンと2つあるので両方入れておきます。 nginx conf upstream api_server {  server 127.0.0.1:30101; […]

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