Jim Cheung

Monday, February 17, 2014

read Nine Algorithms That Changed the Future: The Ingenious Ideas That Drive Today's Computers, a good book to introduce few common algorithms.

reading Making Java Groovy, I like the syntax of groovy and the thinking is still very Java. there is a another choice, Kotlin, but I still like groovy's syntax more.

I've been learning quite a few programming languages, and kept forgetting what I'd read. maybe it's time to do something rather than wasting time on reading and forgetting.

I'll keep reading, but will probably only read those could help my projects. more coding this year.

Thursday, February 20, 2014

being devops recently, trying different system tools.

vagrant is cool, very easy to create and destroy, one command to setup a clean environment. I'm still finding a way to do the setup purely on shell script, which I don't need to mess with puppet. but I will try puppet too, and docker as well.

setup a nginx to front my node apps. still a lot of things to play with nginx, load balancing, caching, websocket proxying, etc. and will try front ruby apps with passenger (the latest episode of ruby rogues podcast) and unicorn.

trying to do some ui test with selenium webdriver (ruby), phantomjs w/ casperjs, and wraith. looking for a way to easily do integration tests.

trying vaadin (a modern gwt?). I really don't like maven, I have no idea why it keeps downloading things (there is one comment I like about maven: it makes hard things simple and simple things hard). I'm not seriously into it, but it's still fun to try few examples. (netbeans has good support for vaadin)

groovy, planning to write a version comparison tool with it, for myself(or the team). must be fun.


read a post about one php trick:

// in javascript, you can do
$foo = $a || $b || $c;

// in php (after 5.4), you can do it with
$foo = $a ?: $b ?: $c;

it's nice but I probably won't use it because it doesn't feel safe. I start to believe if you work with a team, your code should be as verbose as java.

Friday, February 21, 2014

I've changed a little bit of my reading style on programming books. now I'll read few books at the same time but focus on one topic.

I want to give myself a good understanding on java threading, I just randomly pick one from Learning Java 4ed, The Well-Grounded Java Developer, Beggining Java 7, Java Concurrency in Practice and read it. it works quite well.

on the other hand, I'm keep switching my daily tasks into to groovy. reading a directory recursively is just as easy as any interpreted languages:

import groovy.io.FileType

def dir = new File("my_folder")
dir.eachFileRecurse (FileType.FILES) { f ->
    // each one of them is a File object
    println f.class.name
    println f.path
}

I'll also start using groovy on web apps, Vert.x looks good for my tiny little apps.

Wednesday, February 26, 2014

when I picked my mind to write something, I listened two interesting podcasts - one about go, the other about dart. so I decided to check them out.

it turns out, I really like dart. it offers a bundle of tools (ide, dart2js too, a chromium with dart vm) officially, and it already pass the 1.0 version (means mature enough).

I finished the little Dart: Up and Running book very quickly.


checking some code review tools too, gerrit and phabricator both look good.

Friday, February 28, 2014

using phantomjs to take screenshots are really easy:

  1. download phantomjs, start it with --webdriver=4444
  2. add "nearsoft/php-selenium-client": "v2.0" to composer.json
  3. composer update
  4. run the php script below
    <?php
    
    require '../vendor/autoload.php';
    
    use Nearsoft\SeleniumClient\WebDriver;
    
    $driver = new WebDriver();
    $driver->setScreenShotsDirectory('.'); 
    $driver->get('http://www.jchk.net/');
    $driver->screenshot();
    $driver->close();
    
Blog Archive