2013/06/30

Get Rid of HTC Sync Manager autostart on Mac, and Android File Transfer Autostart

(Geneve.Swiss)

Tired of seeing autostart finder popups every time I plugged in my new hTc one into my mac. Here's a way to disable it:
1. Identify UUID:
   by using "diskutil info /Volumes/HTC\ Sync\ Manager
   you can get its volume UUID
2. sudo vifs
    add a line as below:
UUID=YOURVOLUMEUUID none hfs rw,noauto

= = = = =
As for disabling Android File Transfer app, you just need to rename file names of the so called Agent app:
1. /Users/user_name/Library/Application Support/Google/Android File Transfer
2. /Applications/Android File Transfer.app/Contents/Resources

REF:
http://blog.softwareispoetry.com/2013/05/disable-htc-syc-manager-autostarting.html


2013/06/18

showing relative line number in vim


Being a long time vim user, this is the first time that I heard vim supports relative line numbers, by which users can jump around the editor screen even more quickly. Just type :set rnu will do the trick.

Another good plugin that can improve navigation speed is EasyMotion. It works a bit like the "f" feature in vimperator for firefox. Too bad that it's not avaible for intellij's ideavim.

2013/06/17

How to push codes to Heroku from China

(Taipei.Taiwan)
Miss my One V.
****
Seems the IPs of Heroku are blocked, so "git push heroku" can not work normally. In order to fix this problem, add following lines to the .ssh/config file:


Oh, by the way, remember to change the user name to your own one.
REF:
Check this link

2013/06/10

在Lime HD中快速啟動語音輸入法

(富貴角.Taiwan)

剛剛試了一下谷歌的語音輸入,覺得有些時候應該蠻實用的。所以打算幫它在Lime HD中加個快速切換的功能。在Lime HD中原本就有開啟Google語音輸入法的方式,只是我覺得有點太麻煩了。原本的方式是:
1. 長按左下方的設定鈕,這時會跳出一個對話視窗,可以設定輸入簡繁中文的切換,分割鍵盤等一些選擇。畫面最下方則是切換成語音輸入法。

通常會想用語音輸入的時機,都是在手不方便慢慢點螢幕的時候,所以,操作步驟愈多,就愈麻煩。原本我是打算在長按(中/En)按鈕時,直接啟動語音輸入。目前這個按鈕的長按並沒有預設的作用,所以很適合。

可惜的是,我不知道怎麼debug InputMethodService,所以沒有辦法短時間內看清楚在LIMEService中的長按功能,是怎麼前後串起來的。一直找不到好的interception point。

無意中卻發現了,原來Lime有針對輸入的整個面版實作swipe的key listener!!做為一個多年的Lime HD愛用者,竟然不知道有這麼一回事。看了原始碼後,它的目前對應功能是:
滑上:開啟設定對話窗(跟長按設定按鈕一樣)
滑下:關閉輸入法
滑左:模擬刪除鍵
滑右:送出目前選擇的候選字

既然設定對話窗已經可以很方便地長按設定鍵來開啟,我把"滑上"給改成呼叫Google語音輸入法。程式碼很簡單,在LIMEService中的swipeUp(),把原本的code換成StartVoiceInput()就可以了。

2013/06/07

Adding macros in Android Studio (Intellij) -- take Adding Javadoc comment for example

(Geneve.Swiss) Climbing is pleasant, but it leads you to better views.

 Some shortcuts can be integrated into ideaVIM, but some are more complicated and need other tricks to make it more handy. One of the technique is to use macros. As Mac's Automator, you can ask Intellij or Android Studio to record your actions, and make it available as a keyboard shortcut.

For example, if you want to add javadoc comment to a funtion, you need to move to the first line of a certain function, and type in /**. After pressing Enter, it will generate javadoc template for that specific function. Though it's already very convenient, it still takes time if you're not quite familiar with how to move the cursor to the first line of the function.

So, to add javadoc comment from anywhere in codes, you can record a macro to move to the first line of the func, and type /** , and Enter for you. Here's the actions:
  1. Start recording a a macro in Edit - Macros - Start Macro Recording
    1. Press Down
    2. Press Ctrl + Up
    3. Press ⌘ + Left
    4. Write /**
    5. Press Enter
  2. Stop the macro recording in Edit - Macros - Stop Macro Recording
  3. Give it a cool name
And then you can add a keyboard shortcut for this macro in Keymapping in Preferences.

REF:

2013/06/06

Some hacking articles about IdeaVIM under Intellij

 (Leiden.Netherlands)

IdeaVIM is a vim-like input plugin for intellij IDE, good for text editing but not so powerful if you want to use it for other IDE tasks, for example accessing menu actions by defining keyboard shortcuts.

Fortunately, someone in Japan branched the source codes on GitHub, and wrote some tweaks to make it possible to configure all kinds of Intellij menu items to keyboard shortcuts as you wish in a config file.

Tried downloading the modified codes and built it in Intellij; installed the plugin in my Android Studio environment. Working like a charm~

my settings in _ideavim.groovy


REF:
http://d.hatena.ne.jp/masanobuimai/20120720/1342764219
http://d.hatena.ne.jp/masanobuimai/20080323#1206277040


2013/06/04

How to make testing work under Android Studio

(Geneve.Swiss)

It's such a pain to look for solutions for tasks on Android Studio. When can it be mature enough and more well documented for developers?

I would like to write some test cases for my small app, but I couldn't find a way for adding test cases into Android Studio project and have it run successfully.

After wandering around on the internet for a long time, eventually I found a link that did helped me out (see reference below). As Google I/O 2013 video said, a new android build system made of gradle is released, which will be more flexible, more powerful, more etc, etc. However, currently, it 's not well integrated into Android Studio. Some modification in Android Studio won't be directly reflected in gradle build scripts. Well... then, how do I know when I should modify build scripts my self? And to write it by myself, I have to learn groovy first, because that's the language Gradle used to write its build configuration files. How could I master these things in a short time...

Anyway, the solution for my pain point above is to modify build.gradle under the root directory of app project, and make sure all the instrument source folders are well set up. Now I can use cradle to run test cases and generate report files. However, I can't make it work in Android Studio still. orz...


REF:
http://blog.crowdint.com/2013/05/24/android-builds-on-travis-ci-with-gradle.html

2013/06/01

Gradle build error in comman line for Android Studio app projects

I saw someone met the same problem on StackOverflow. Fortunately,  I found out how to make it work. So leave some notes here:
1. upgrade Gradle version to 1.6
2. Afterward, running "gradle build --stacktrace", you will see that ANDROID_HOME environment variable is required to be set up.
3. on Mac, add following line to your ~/.bash_profile
export ANDROID_HOME="/Applications/Android Studio.app/sdk/"

Now it should work like a charm!