Wednesday, December 17, 2014

SLF4J Template for Eclipse

In Preference > Java > Editor > Templates

Insert the following template:
${l:import(org.slf4j.Logger)}
${f:import(org.slf4j.LoggerFactory)}
private static final Logger LOG = LoggerFactory.getLogger(${enclosing_type}.class);

Monday, December 15, 2014

SOAPUI 5.0.0 hangs after upgrading OS X to Yosemite

After upgrading to the company's Mac OS X to Yosemite, SOAPUI 5.0.0 refuse to load properly. It will start, and the UI will come up, but it just hang with the spinning wheel right away.

I was able to resolve this issue by uncommenting the line #53 in $SOAP_HOME/bin/soapui.sh

#   JAVA_OPTS="$JAVA_OPTS -Dsoapui.browser.disabled=true"

I hope this help someone else out there who has the same problem, and also for myself to reference again if face with the same problem in the future.

Sunday, April 6, 2014

Getting edx devstack to run on Windows

1) Fix issue https://github.com/edx/edx-platform/issues/3230

2) Change Vagrant ansible-play command to

ansible-playbook -i localhost, -c local vagrant-devstack.yml --tags=deploy -e configuration_version=master -e edx_ansible_source_repo=https://github.com/lsiu/configuration.git -e edx_platform_repo=https://github.com/lsiu/edx-platform.git -e edx_platform_version=master -vvv

3) Fix symbolic link issue
See: https://github.com/edx/configuration/wiki/Vagrant-troubleshooting#dealing-with-line-endings-and-symlinks-under-windows
 # You need to run this from cygwin, not the Windows command-line (see above)
 git rm --cached -r . && git reset --hard
 git config --global alias.add-symlink '!__git_add_symlink(){ dst=$(echo "$2")/../$(echo "$1"); if [ -e "$dst" ]; then hash=$(echo "$1" | git hash-object -w --stdin); git update-index --add --cacheinfo 120000 "$hash" "$2"; git checkout -- "$2"; else echo "ERROR: Target $dst does not exist!"; echo "       Not creating invalid symlink."; fi; }; __git_add_symlink "$1" "$2"'
 git config --global alias.rm-symlink '!__git_rm_symlink(){ git checkout -- "$1"; link=$(echo "$1"); POS=$'\''/'\''; DOS=$'\''\\\\'\''; doslink=${link//$POS/$DOS}; dest=$(dirname "$link")/$(cat "$link"); dosdest=${dest//$POS/$DOS}; if [ -f "$dest" ]; then rm -f "$link"; cmd //C mklink //H "$doslink" "$dosdest"; elif [ -d "$dest" ]; then rm -f "$link"; cmd //C mklink //J "$doslink" "$dosdest"; else echo "ERROR: Something went wrong when processing $1 . . ."; echo "       $dest may not actually exist as a valid target."; fi; }; __git_rm_symlink "$1"'
 git config --global alias.rm-symlinks '!__git_rm_symlinks(){ for symlink in `git ls-files -s | grep -E "^120000" | cut -f2`; do git rm-symlink "$symlink"; git update-index --assume-unchanged "$symlink"; done; }; __git_rm_symlinks'
 git config --global alias.checkout-symlinks '!__git_checkout_symlinks(){ POS=$'\''/'\''; DOS=$'\''\\\\'\''; for symlink in `git ls-files -s | grep -E "^120000" | cut -f2`; do git update-index --no-assume-unchanged "$symlink"; if [ -d "$symlink" ]; then dossymlink=${symlink//$POS/$DOS}; cmd //C rmdir //S //Q "$dossymlink"; fi; git  checkout -- "$symlink"; echo "Restored git symlink $symlink <<===>> `cat $symlink`"; done; }; __git_checkout_symlinks'
 git rm-symlinks
4) Before running `vagrant provision`, comment out the checkout and clean resets (if left in playbook, it will resets the above fix)

/edx/app/edx_ansible/edx_ansiblplaybooks/roles/edx_ansible/tasks/deploy.yml
/edx/app/edx_ansible/edx_ansiblplaybooks/roles/edxapp/tasks/deploy.yml

Monday, January 20, 2014

Co-working spaces in Hong Kong

Boot.hk - http://boot.hk - (no longer in operation)
Cocoon - http://www.hkcocoon.org/
the Hive - http://thehive.com.hk/
The Good Lab - http://www.goodlab.hk/
WYND - http://www.wynd.hk/about/
Fill in the blank - http://www.fillintheblank.hk
PaperClip - http://www.papercliphk.com
80/80 Space - http://www.8080space.com/
The Loft - http://www.theloft.com.hk/
PLATFORM - http://www.platform.hk

Play Framework 2.2.x + Twitter Bootstrap 3 + Less


There are a variety sources of How-Tos on the internet which shows how to integrate Less version of the Twitter Bootstrap into Play Framework which involves prefixing the Bootstrap files with "_". However, this is not necessary by specifying the lessEntryPoints key.
  1. Put source of bootstrap/less under app/asset/stylesheet/bootstrap
  2. Create app/asset/stylesheet/main.less with the following entry: import bootstrap/bootstrap.less
  3. Add lessEntryPoints key to build.sbt: play.Keys.lessEntryPoints <<= baseDirectory(_ / "app" / "assets" / "stylesheets" ** "main.less")
Reference: Configuration Section in http://www.playframework.com/documentation/2.2.x/AssetsLess

To find out whether you have configured it properly type play-less-entry-points in the Play! console and you should only see one entry.