But if you look at the people who are consistently achieving their goals, you start to realize that it’s not the events or the results that make them different. It’s their commitment to the process. They fall in love with the daily practice, not the individual event.
Wednesday, December 11, 2013
Github Longest Streak...60 days and counting!
Monday, November 18, 2013
WhatNext: My first android application on Google Play
The application name is WhatNext. It is a simple tool to help you do "single tasking". The idea comes the first time when I played nodejs, tried to wrap my brain around its single-threading and event-driven model. Then I started thinking about applying this idea to how I handle things before I found out that people outside technology circle calls it "single tasking". There are a couple articles about this concept as listed below
- single-tasking and productivity
- Why Single-Tasking Makes You Smarter
- Multitasking is Out, Single Tasking is In
I'm usually overwhelmed with a pile of long-standing tasks in my long todo list and my energy always get drained upfront and then I procrastinate.
I've been wanting to develop this idea into android application for a while but I procrastinated. :-/
Finally, I started developing it 2-3 weeks ago with an idea to keep it simple, focused and effective. I also want to keep iterating, gradually improving and release the application early and often. I try to ship it as soon as possible.
Another goal is to learn Android application development and its components which I think I'm really late to the area. The best way to learn new technology is learning by doing. Although I tried to ship the first version as soon as I can, my habits still keep me reading all the things upfront before coding the first line.
Now I understand why people often say that developing a good Android application is difficult and takes much time. After I have read Android documentation and guides and watched some I/O talks, I see that Android is quite big in term of platform. There are many components, concepts and design patterns. I just read about 15% of them. These patterns and concepts enable very much flexibility and extensibility and force some good practices and design but, on the other hand, it is difficult to get it right the first time for developers.
The project is really young and I open source here. If you want to try the app, get it on Google Play. The application supports only >= 4.x by intention and only tested with my Galaxy Nexus.
Enjoy! :D
Monday, November 11, 2013
My first experience maintaining a project on Github
Sunday, October 20, 2013
A week with xmonad
Thursday, September 5, 2013
First impression of Golang
Good things
- Concise and clearly expressed syntax - Its syntax smells like C and Python. It also has some small interesting improvements over typical C-family languages.
- if with a short statement. It might be just a syntactic sugar but I think it makes the code more concise.
- I like the idea of having only for loop and C's while is a version of for.
- Capitalization means it is exported. Very simple and good formatting in the same time.
- switch with break by default. Yeah. It's arguable but break by default is my choice.
- goroutine and channels - After I have been busy with thread-safe and concurrent issues using Java and Obj-c for a while, synchronized block, locks, java.util.concurrent, GCD and dispatch_async(), etc. I think this is another simple and amazing abstraction to deal with synchronization and concurrency in addition to a single thread and event-loop in nodejs.
- Easily add methods to almost any types even function
- Interface are satisfied implicitly - This is a 'wow' for me.
- Toolchain included - testing, package management, formatting and documentation. This helps Go developers to have a uniform development flow.
- Only one style and consistency - go fmt forces some styles and convention such as tab indentation. You might be annoyed if your preferred style is different from what the Go team has chosen. While I'm writing this, I found a very good explanation on why this is a good idea.
Interesting but in question
- One place for packages - Go needs every packages to be under GOPATH and wants developer to avoid local/relative import. It provides a good structure for that. It needs to specify fully qualified name in code when import a package. For example, import "github.com/teerapap/mylib". It seems to be a good idea but I wonder if the url changes. Do I have to changes every import lines in my code?
- No versioning on package management - As opposed to npm, go get just get the latest version. I'm not sure if it is a good idea. Some said that you have to snapshot your tree. Some said that you need to use versioned path /v2/mylib instead.
- Only static linking
Saturday, September 24, 2011
My experience with unit testing in software development
Sunday, August 14, 2011
VisualVM on ubuntu(lucid) failed to initialize the Profiler engine
Failed to initialize the Profiler engine: Problem with a required JFluid installation directory or file /usr/lib/jvm/java-6-openjdk/lib/visualvm/profiler3/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so Original message: File does not exist.In sprite of this error, the visualvm still can run but profiler/sampler doesn't show up.
Someone have filed this bug here. To fix this problem, recompile the missing lib manually and move to the right place.
Here are the steps
- Download visualvm source here (visualvm_1.2.2.orig.tar.gz at the right pane)
- Extract it and cd to the build directory
tar -xzvf visualvm_1.2.2.orig.tar.gz
tar -xzvf netbeans-profiler-visualvm_release68.tar.gz
cd lib.profiler/native/build - You will see build script ( buildnative-linux64.sh ) then edit it.
- Replace gcc32 with gcc
- Change 2 BuildJDK lines to below. /usr/bin/jvm/default-java/ is my jdk path; yours may differ.
BuildForJDK "/usr/lib/jvm/default-java" "jdk16" - Make directory for release
mkdir -p ../../release/lib/deployed/jdk16/linux-amd64/ - Run this build script. It will compile the source against jni headers in our jdk and output as libprofilerinterface.so
./buildnative-linux64.sh - Move libprofilerinterface.so to the right place in your jdk path
sudo cp ../../release/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so /usr/lib/jvm/default-java/lib/visualvm/profiler3/lib/deployed/jdk16/linux-amd64/ - Launch VisualVM again.
Sunday, September 5, 2010
How to reset the main menu in Ubuntu
Then I learn that there're default menu configuration somewhere. One of them is at /etc/xdg/menu which there're applications.menu and settings.menu for application menu and system setting menu respectively. And each user has its own customization of menu in ~/.config/menus which has applications.menu and settings.menu too. Those files contain some exclude configurations and they are merged with default configurations when it is used. So deleting directory ~/.config/menus should reset the main menu to default state and that's all.
rm -rf ~/.config/menus
and logout and login again.
but if it's still not be reset like in my case, it need to delete *.desktop in your home directory too.
find ~/ -name "*.desktop" -delete
Wednesday, July 28, 2010
How to forward port by ssh
- My machine
- Host A with public IP
- Target Host B with can be reached from Host A
ssh -L 123:targetB:80 userA@hostA
- We can access targetB:80 by myMachine:123 instead
- The traffic will be forward from myMachine:123 through ssh tunnel to hostA and the forward to targetB finally.
ssh -R 123:targetB:80 me@myMachine
- We can access targetB:80 by myMachine:123 instead
- It's similar to local forwarding but the ssh tunnel is created by hostA which is the forwarder
- The traffic will be forward from myMachine:123 through ssh tunnel to hostA and the forward to targetB finally.
ssh -D 123 userA@hostA
- It's similar to local forwarding but it doesn't specify the target:port because the target address and the port will be determined automatically by application protocol such as SOCKS.
- We can access targetB:80 by SOCKS proxy in browser or OS network settings.
- Currently SOCKS4 and SOCKS5 protocols are supported.
- There might have firewall issues. It might have to change some port unless the packets will be blocked.
- This method is for TCP traffic. For UDP, you may have to try other methods.
Wednesday, June 30, 2010
How to setup remote profiling session with JProfiler
JProfiler is a tool to profile a JVM in runtime locally or remotely. Its profiling features are mainly in 2 parts which are CPU and memory. In CPU part, it can shows all threads situation in JVM and its state(RUNNING,BLOCKING,WAITING,..) and also traces which part of instruction the thread currently runs. It can show object locking graph to identify a locking problem which is difficult to figure out by normal debugging.In memory part, it collects and shows memory allocation stats, object counts and also traces the methods or classes which do most of memory allocation. Furthermore, it can shows what and when java garbage collector do with current memory consumption as a time-based graph.How to setup?
- Download JProfiler and its evaluation key
- Install JProfiler in your computer.
- Copy JProfiler agent library to a target which you want to do remote profiling. JProfiler agent library is in [JProfiler path]/bin/
- Add an argument in JVM which you want to do profiling. (I use FreeBSD.)-agentpath:/usr/home/tmp/jprofiler6/bin/freebsd-x86/libjprofilerti.so=port=8849
** 8849 is a port for JProfiler client to communicate with its agent. You can change this
if you have firewall, you may need to allow the portipfw add 6000 allow tcp from any to me dst-port 8849 keep-state - Open JProfiler client. -> Start center -> New session tab -> New session button -> select remote -> configure host and port of target jvm -> Start
- Start target JVM. it will pause and wait JProfiler to attach it.
- In JProfiler client, click Attach and OK
Next time I may write about how to setup JProfiler with Eclipse to do local profiling. If you can’t wait, find it in JProfiler help.
** When the evaluation ends, the client still can open but it doesn’t work
Friday, February 5, 2010
Picasa's bugs cause my images to be deleted.
I clicked the "download album to picasa" button in the web client. The album was downloaded to the client beautifully and it was shown as a downloaded web album. Then I clicked the "sync to web" button in the client. It asked something and uploaded all images in the album. Why did they need to be uploaded again?
The problem is here. In the web client, there were 2 album now in the same name, the original and the recently uploaded. At first I thought it was not a bug, you might need to have a fresh uploaded album at the first time to keep syncing in the future and these twin albums was different album and unique.
and this idea leads to the mistaken operation.
I right-clicked at the downloaded web album in the client and chose to delete the album with "delete the online copies" checked. Then both original and recently uploaded album were gradually deleted! and they were deleted successfully.
So I don't have any copies of this album left. It's a bug of Picasa and I reported to its forum yesterday.
but good luck of me that the album has only 25 images and google still cache some of them. :P
Sunday, January 24, 2010
How to change 'open link in new tab' behavior in Firefox 3.6 back to the old style.
To change it back to an old style. Steps are below.
- Enter about:config in the location bar.
- Press "I'll be careful, I promise!" button. yes, you have to be careful about this.
- Type tab in filter box as in image.
- Find the preference name browser.tabs.insertRelatedAfterCurrent and double click it. The value of this preference will be toggled to false.
That's it.
Monday, November 16, 2009
URL Regular Expression Pattern
^(ht|f)tps?:(//)(w+(:w+)?@)?([-w]+.?)*[-w]+(:[d]{1,5})?(/([-w~!$+|.,=]|%[a-fd]{2})+)*(/)?(?([-w~!$+|.,*:]|%[a-fd{2}])+=?([-w~!$+|.,*:=]|%[a-fd]{2})*(&([-w~!$+|.,*:]|%[a-fd{2}])+=?([-w~!$+|.,*:=]|%[a-fd]{2})*)*)?(#([-w~!$+|.,*:=]|%[a-fd]{2})*)?$Some paths derive from Ivan's pattern and some I rewrite it. I note this for further use in the future. Hope it maybe useful to you too.
And I also found regexpal which is a great online regex tool.
Wednesday, October 28, 2009
GoogleSurfKey will be outdated soon.
Sunday, August 16, 2009
Google Surf Key 0.3.0 is released!!
version 0.3.0 released.(15 Aug 2009)Hope you like it!
- Updated for new Google's search result page layout.
- Fixed the 10 results limitation.(Only j,k traversing not number keys)
- Add l command to toggle show the index label.
- Change the implementation to use JQuery 1.2.6.
- Improve the link focusing.
Wednesday, June 24, 2009
Convert all column data type from VARCHAR2 to NVARCHAR2 and vice versa in Oracle 11g
select 'ALTER TABLE '||OWNER||'.'||TABLE_NAME||' MODIFY('||COLUMN_NAME||' NVARCHAR2('||DATA_LENGTH||'));' AS GEN_SQL_STATEMENTfrom SYS.DBA_tab_columnswhere owner = 'ownername' and DATA_TYPE = 'VARCHAR2';The result is the rows of ALTER statement filled with the table name, column name and new data type.
Then I copied all rows and concatenate them with some editor. and then run them as a sql script.If you want to convert from NVARCHAR2 to VARCHAR2, just switch 'VARCHAR2' and NVARCHAR2' in above sql statement. You can modify above script as well to suit your propose.Finally, you cannot convert the column which is not empty otherwise the error will occur.
Tuesday, June 2, 2009
IE6 crashes on JQuery append() function
var table = $("#contact_list");table.empty();$("group",data).each(function(){var group_name = $(this).attr("name");table.append("<tr><td>"+group_name+"</td></tr>");$("user",$(this)).each(function(){var username = $(this).text();table.append("<tr><td>"+username+"</td></tr>");});});When I saw IE6 crashed, I tried to figure out what was the problem and found it was an append function. So I tried to implement the code in many ways and I saw something.It will crashes if the html string as an argument of the function is not a properly dom object or closed tag. For example
var box = $("#contact_list");box.append('<table>');//do something.....box.append('</table>');So I solved this problem by define an variable for collecting all the html string which I want to append and append it by append() in the end. And the code works fine on IE6.
Friday, April 3, 2009
Switch input language by Caps Lock #2
Download and install AutoHotkey in your computer.- Write .ahk script like below
Capslock::Send {LAlt down}{Shift}{LAlt up}
- Save this file and try double click to run it.
- Test it by press caps lock and see.
- Create shortcut to this .ahk file and move it to Startup folder in Start menu. [Do this to run this script at startup]
Tuesday, March 10, 2009
Major Limitation of Gmail and Google Calendar in Offline Mode
Recently Google launched an offline mode of Gmail in labs and just few days ago Google Calendar offline mode had been released in beta after the news of this feature over a year.
Both of them use the capabilities of Google Gears for running in offline. So I installed Google Chrome for try out these things.
It works nicely but I found a major limitation. A few days ago ,I was disconnected and I opened the Gmail. I expected that I could browse my email easily and see my drafts but it didn’t work.
Google Chrome showed an error. It said “105 (net::ERR_NAME_NOT_RESOLVED)” that is about Chrome cannot resolve an IP address of website (gmail.com). So it cannot work offline. The same error was shown when I tried the Calendar.
But Google Document or Remember The Milk which support Gears work correctly.
Gmail and Calendar work in offline mode correctly if they have already been opened before your computer is disconnected. They will switch to offline mode and continue running correctly.
I wish this limitation will be removed soon.
Monday, March 2, 2009
Booting Process Tuning in FreeBSD 7.1
The project's objective is to tune or optimize a subsystem of FreeBSD and/or its environs (applications, utilities, etc.) to make it perform better.
I choose to tune the booting process of FreeBSD. Due to my laziness and lack of time, so I didn’t do tuning as much as I expected. but if I have time……if I have time…..
Here is my presentation.





