Wow, with this article's help, I set up git server on home NAS server.
Now, time to do some work.
It's good to be able to wander in Safari's online shelves and pick up books that I am interested in. Though not having enough time coding, I still managed to quickly take glimpse over two Android books recently. One is 50 Android Hacks, and another one is Android Developer Tools Essential. Both are good to read and gave me some new nuance for my poor Android knowledge.
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
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.
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.
Check this link
剛剛試了一下谷歌的語音輸入，覺得有些時候應該蠻實用的。所以打算幫它在Lime HD中加個快速切換的功能。在Lime HD中原本就有開啟Google語音輸入法的方式，只是我覺得有點太麻煩了。原本的方式是：
可惜的是，我不知道怎麼debug InputMethodService，所以沒有辦法短時間內看清楚在LIMEService中的長按功能，是怎麼前後串起來的。一直找不到好的interception point。
無意中卻發現了，原來Lime有針對輸入的整個面版實作swipe的key listener！！做為一個多年的Lime HD愛用者，竟然不知道有這麼一回事。看了原始碼後，它的目前對應功能是：
(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:
- Start recording a a macro in Edit - Macros - Start Macro Recording
- Press Down
- Press Ctrl + Up
- Press ⌘ + Left
- Write /**
- Press Enter
- Stop the macro recording in Edit - Macros - Stop Macro Recording
- Give it a cool name
And then you can add a keyboard shortcut for this macro in Keymapping in Preferences.
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
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...
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!
It's annoying that I have to click on torrent files every time I download them in firefox. Although I tried to check the option to open always with a certain application in SaveFile dialog, it never worked.
However, the solution seems so simple that I should have searched the internet earlier to make my life easier. In firefox official support website, it mentioned that this is configurable in Peferences:
- On the menu bar, click on the Firefox menu and select Preferences...
- Select the Applications panel.
- The Applications panel will display. Select the type of file for which you want to change the default action.
Strangely, it's not possible to get current rotation angle in android directly, except for getting the fixed 4 rotation modes: 0, 90, 180, 270. In order to get precise rotation degrees instead of rotation modes, OrientationEventListener can be used. Once it's implemented, you can get the rotation degree in onOrientationChanged(). It's a lot easier than manipulating values from all the sensors like gyroscope, accelerator, etc.
It's pain in the ass to use Android Studio now, since it's just published, which implies bugs appear every now and then, and you're not sure it's due to your misunderstanding of this IDE, or it's really an issue. In addition, it's relatively hard to find How-to answers comparing to ADT plugin with Eclipse.
While trying to set up AdMob module in my project on Android Studio, it took me some time to fix some external library import errors that should be clearly mentioned in online AdMob doc, or even better, just integrate it into "Android Studio". Isn't Android Studio meant to make Android developers' life easier?
Problem 1: Add com.google.ads.AdView element in my layout xml as doc says, but it generates compilation error.
Anser: Pay attention!! You also have to add the red line attributes to the container layout!! It's not clearly mentioned in document. What I just did in adding com.google.ads.AdView component. Obviously, it told me that it can't compile.
Question 2: Don't know how to add the AdMob library to my project in Android Studio. The AdMob doc only has flows for eclipse. I always meet "NoClassDefFoundError" during runtime. This took me most time to wandering on the internet, looking for a right answer.
Answer: it's a bit tedious. Please just check detail information in reference link below. In brief:
1. Put the jar into the libs folder
2. Right click it and hit 'Add as library'
3. Do a clean build (you can probably do this fine in Android Studio, but to make sure I navigated in a terminal to the root folder of my app and typed gradlew clean (I'm on Mac OS X, the command might be different on your system)
Question 3: sometimes, even questions above are all fixed, you still can't get the AdMob View. Why? You have to declare a specific Activity for it including configChanges. This is mentioned in Introduction, but ... I just have ignored it, since who would have thought that creating a View in my own activity needs to declare a specific Activity for it?
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
Recently I spend most of my time reviewing documents on google's android official site. It annoys me that the left side of the screen is always occupied by the content index; however, I just need to change articles once in a while by using it. It makes me feel bad that one third of the screen is wasted. In addition, it also distracts me while I was reading.
As a consequence, I searched internet to see if there's any extension, plugin, or script to help me hide the navigation panel when I want to do so. Out of luck, no. Maybe it's too tiny to have someone work on it.
Therefore, I decided to write one by myself, after reading a book about jQuery. My choice is to write a userscript for greasemonkey, which is supported on Chrome now as well. The logic is very simple and the lines of codes are few, although it still took me sometime to find right APIs to implement this feature.
Here's the screenshots:
The userscript is uploaded to following site:
While watching some video tutorials about android development, I found that the lecturer can call out the class completion helper dialog during typing class names. However, I only have the function/variable autocompletion feature after typing a . after a class name in my eclipse. Without entering the class name correctly, I can not get any help from eclipse, which is quite strange comparing to what I've seen for others.
Well, it seems that many people encountered the same problem as I did. This is being discussed on various posts. One way to make it work is to check the "Java Proposal" in Eclipse's
Preferences > Java > Editor > Content Assist > Advanced'.
But for me, it seems that something's wrong with my workspace configurations too. The answer from hoipolloi in following reference post helped me to fix this issue. Here's his suggestion:
- Quit Eclipse
- Go to workspace/.metadata/.plugins/org.eclipse.jdt.core
- Remove *.index and savedIndexNames.txt
- Restart Eclipse and search Ctrl+T for the offending type. The indexes will be rebuilt.
Mountain climbing with my good friends.
Oh, How I miss it.
Due to interview purpose, I wanna know some inside implementation details about a certain apk. In order to do further investigation, I searched how to de-compile apk files on the internet. The reference article below is so wonderful that it lists necessary tools and also the commands how to trigger them.
In brief, you need dex2jar and JD-GUI. If you want resource, or read smali files, apktool will do the trick too.
目前看上眼的有Panasonic的Cosmo ART系列產品，和我後來下單的 ATW-WP169-3 無線遙控開關。我買的這款是可以直接把牆上的開關按鍵置換掉的線路，外加一組搖控器。希望幾天後到貨就可以解決這困擾了我多年的小麻煩。
Finished reading this comic in two days. The story is so interesting and dramatic that I just couldn't help but keep reading it. It's been a long time that I didn't find good comic books; however....it seems that I should focus on other things now..instead of reading comics.
I like the bright color in this picture. Although this photo was taken almost 10 years ago, the image quality is so great that I still can't believe it's taken by a cheap camera at that time.
It's easy to play and control local mp3 files by using AVAudioPlayer. However, if someone wants to stream playing mp3 files from the internet, he should try AVPlayer instead.
Spend most of my time trying to find a remote mp3 for testing. Too bad that I just can't even find one. Eventually, I gave up searching on the internet. Instead, I use following python command to create a simple http server locally on my mac:
python -m SimpleHTTPServer
Symmetry brings harmony.
Encountered this problem for a while. It bothers me a lot although it does nothing harm. Well...the solution is quite simple, but hard to find by myself: just uninstall "Android File Transfer" app!! Don't know why this app causes the symptom. I am glad that I don't have to keep moving around on the touch panel to make sure I re-gain the control of mouse movement while pluging anything into usb port.
Haven't thought that I would be able to have a biz trip to Canada, let alone a city in the middle area of it.
Toronto is a clean city which is suitable for living, for sure.
I like the clear sky and freezing temperature in winter.
Look remotely, it's a picture of woods;
Once you get closer to it, you will find it's made up of newspaper strips.
Very creative piece.
I like the deepness of the work.
Brought ex-colleague to visit this old district in Shanghai.
It's full of exotic atmosphere while wandering around.
Sitting in the coffee shop by the street corner, you can't even tell whether you're in western countries or somewhere else.
Walking-by passengers are visitors from around the world.
Tranquille dans la ville de belle Paris.
While trying a certain app recently released by a company that I had interviewed with, it crashed every time I triggered it. I wanna get the logs for them to do further investigation. Howevever, I couldn't find the developer option in my Galaxy Nexus with android 4.2.2. Not sure why; I did some search on the internet. Seemd that google thought it's not so useful for normal users so they just hide it from settings app by default. If this feature is required by developers or someone boring enough, just like me, they can always find the solution on the internet: You can enable/disable it whenever you desire by going to “Settings” -> “Developer Options” -> “Debugging” ->” USB debugging”.
Voila, I can successfully get logs by using adb logcat now.
(Central Park.New York)若不是出差，怎會有機會來紐約呢？
之前在這一篇中介紹到svox這個在android上，提供多國語音合成資料庫的軟體，拿來搭配moon+ reader確實很不錯；可惜的是，在台灣竟然沒有辦法購買它的語言資料庫，只能下載free trial version下來試用個一陣子。雖然網路上有提供怎麼可以變成永久試用版，但這始終不是個好的方法。
- Android™標準の音声合成インタフェースに準拠 (無料ライブラリ版)
- 個別チューニングにも対応 (有料SDK版)
- 符合android標準的TTS 介面 (到Settings中可以做切換，並讓其他ap p使用)
- 可以個別調整語音 (這功能就得付費才有囉)
Read the book "Understanding Big Data" today. Half way done.
Here's some excerpts from the book:
Understanding Big Data
the term Big Data applies to information that can’t be processed or analyzed using tradi-tional processes or tools
An IBM survey found that over half of the busi-ness leaders today realize they don’t have access to the insights they need to do their jobs
Even if every bit of this data was relational (and it’s not), it is all going to be raw and have very different for-mats, which makes processing it in a traditional relational system impractical or impossible
variety combining to create the Big Data problem
Three characteristics define Big Data: vol-ume, variety, and velocity.
the opportunity exists, with the right technology platform, to ana-lyze almost all of the data (or at least more of it by identifying the data that’s useful to you) to gain a better understanding of your business, your customers, and the marketplace
a fundamental shift in analysis require-ments from traditional structured data to include raw, semis-tructured, and unstructured data as part of the decision-making and insight process
To capi-talize on the Big Data opportunity, enterprises must be able to analyze all types of data, both re-lational and nonrelational: text, sensor data,
Dealing effectively with Big Data requires that you perform analytics against the volume and variety of data while it is still in motion, not just after it is at rest
Hadoop-based platform is well suited to deal with semistructured and unstructured data, as well as when a data discovery process is needed
it is about dis-covery and making the once near-impossible possible from a scalability and analysis per-spec-t
creator Doug Cutting’s son gave to his stuffed toy elephant
duce)—more on these in a
this redundancy provides fault toler-ance and a capability for the Hadoop cluster to heal itself
Some of the more notable Hadoop-related projects include: Apache Avro (for data serializa-tion), Cassandra and HBase (databases), Chukwa (a monitoring sys-tem spe-cifically designed with large distributed systems in mind), Hive (provides ad hoc SQL-like queries for data aggregation and summariza-tion), Mahout (a machine learning library), Pig (a high-level Hadoop programming language that provides a data-flow language and execution framework for parallel computation), ZooKeeper (provides coordination services for distributed ap-plications), and more
throughout the cluster
For Hadoop deployments using a SAN or NAS, the extra network commu-nica-tion overhead can cause performance bottle
an individual file is actually stored as smaller blocks that are repli-cated across multiple servers in the entire cluster
default size of these blocks for Apache Hadoop is 64 MB
All of Hadoop’s data placement logic is managed by a special server called NameNode
All of the NameNode’s infor-mation is stored in memory, which allows it to provide quick response times
Any data loss in this metadata will result in a permanent loss of corresponding data in the cluster
devel-oper doesn’t have to deal with the concepts of the NameNode and where data is stored—Hadoop does that for you
The first is the map job, which takes a set of data and converts it into another set of data, where individual elements are broken down into tuples
reduce job takes the output from a map as input and combines those data tuples into a smaller set of tuples
All five of these output streams would be fed into the reduce tasks, which combine the in-put results and output a single value for each city, producing a final result set
MapReduce program is referred to as a job. A job is executed by subse-quently breaking it down into pieces called tasks
An application submits a job to a specific node in a Hadoop cluster, which is running a daemon called the JobTracker
In a Hadoop cluster, a set of continually running daemons, referred to as TaskTracker agents, monitor the status of each task
This direct-ing of records to reduce tasks is known as a Shuffle, which takes input from the map tasks and directs the output to a specific re-duce task
under Hadoop are written in Java, and it is the Java Archive file (jar) that’s distributed by the JobTracker to the various Hadoop cluster nodes to execute the map and reduce tasks
BigDataUniversity.com and download Info-Sphere BigInsights Basic Edi-tion (www.ibm.com/software/data/infosphere/ biginsights/basic.html
Hadoop Common Components are a set of libraries that support the var-ious Hadoop subprojects
When you delete an HDFS file, the data is not actually gone (think of your MAC or Windows-based home computers, and you’ll get the point). Deleted HDFS files can be found in the trash, which is automatically cleaned at some later point in time
we cover three of the more popular ones, which admit-tedly sound like we’re at a zoo: Pig, Hive, and Jaql
Pig was initially developed at Yahoo
you can FIL-TER out rows that are not of interest, JOIN two sets of data files, GROUP data to build aggrega-tions, ORDER results, and much more
There are three ways to run a Pig program: embedded in a script, embedded in a Java program, or from the Pig command line, called Grunt
Some folks at Face-book developed a runtime Hadoop sup-port structure that allows anyone who is already fluent with SQL (which is commonplace for rela-tional data-base developers) to leverage the Hadoop platform right out of the gate. Their cre-ation, called Hive
You can use the Hive Thrift Client within applications written in C++, Java, PHP, Python, or Ruby
Hive is read-based and therefore not appropriate for transaction processing
JSON is built on top of two types of struc-tures. The first is a collection of name/value pairs
The sec-ond JSON structure is the ability to create an or-dered list of values much like an array, list, or se-quence you might have in your existing applica-tion
The operand used to signify flow from one operand to another is an arrow: ->. Unlike SQL, where the output comes first (for example, the SELECT list)
Jaql is a flexible infras-tructure for managing and analyzing many kinds of semistructured data such as XML, CSV data, flat files, relational data, and so on
2. 根據畫面最上方的Guide button操作，把certificate先搞定
3. 按左下方的patch xcode
4. 再按右下方的patch project，選擇自己想要deploy的project
5. 替自己的iOS device裝上AppSync (前提是要先JB)
AppSync的source repo path下面有，
AppSync Installaion Source:
試圖為抓下來的圖片加上一個tag，查了flickr api dev guide，對於這種request應該要使用post method才行。可是flickr上的api explorer還是用舊的token方式，而api說明頁又說得不清不楚，只說舊版的token要deprecated，要用新版的oAuth。卻沒說清楚oAuth的signature要怎麼生出來。
結果發現用post method還是會有問題，可是我把整串request直接貼給browser竟然可以了！這是說如果用oAuth機制的話，不需要用post method也可以嗎？那我又何必大費周章的去改用NSURLConnection呢？再改回原本的[NSString URLWithString]]就好了。