Jim Cheung

Wednesday, January 07, 2015

start reading Filthy Rich Clients, although it's from 2007, but comments are good so I think I should read it.

its website has a netbeans plugin for all examples, cool

Friday, January 09, 2015

TIL 1:

you should use random salt, bcrypt has built-in salts in the output hash, to prevent rainbow table attach

php 5.5's password_hash default using bcrypt:

$options = [
    'cost' => 11,
    'salt' => mcrypt_create_iv(22, MCRYPT_DEV_URANDOM),
];
$hash = password_hash("rasmuslerdorf", PASSWORD_BCRYPT, $options);

when do verify, you don't need the salt

password_verify('rasmuslerdorf', $hash); // true

password_hash by default already using a random salt, then why use mcrypt_create_iv above?

the answer is here: Seven Ways To Screw Up BCrypt:

Instead, you should use strong randomness while not using CS randomness. A perfect source would be /dev/urandom. Other sources would be mcrypt_create_iv when paired with MCRYPT_DEV_URANDOM.

so just don't use a static salt.


TIL 2:

emacs-eclim already has basic PHP support, when installing eclim, just check php support.

finally i have my editor supports namespaces.


TIL 3:

using emacs's tramp mode to edit remote file or run remote script is super easy.

this is an interesting video: Alan Kay's tribute to Ted Nelson at "Intertwingled" Fest inside i think it's the demo which steve jobs saw back in 1979.

more about it, read The Early History Of Smalltalk by Alan Kay and listen Floss Weekly episode 29: Dan Ingalls

trying Apache Samza, also from Linkedin

Sunday, January 11, 2015

a script to run sopcast

if [ -z $1 ]
then
    exit
fi

sp-sc-auth sop://broker.sopcast.com:3912/$1 3344 8899 > /dev/null 2>&1

then open use vlc to open http://localhost:8899/tv.asf

Tuesday, January 13, 2015

in order to build storm, require a clojure repo too, put it to build.gradle:

repositories {
    jcenter()
    maven { url 'http://clojars.org/repo' }
}

dependencies {
    compile 'org.apache.storm:storm-core:0.9.3'
}

Friday, January 16, 2015

quick links:


TIL:

to grep lines above/below the matched pattern, use grep -A and grep -B

to grep lines until a specific character, use awk '/match/,/character/'

for example curl -s http://httpbin.org/get | python -mjson.tool | awk '/headers/,/},/' will give me only the headers section


TIL 2:

to enter the lambda symbol λ, use c-x 8 RET 03bb RET or (insert-char #x03bb)

Monday, January 19, 2015

quick links:


TIL: when looking for a way to literal create HashMap, I learned one of the Hidden Features of Java: Double Brace Initialization:

// diamond doesn't work here for anonymous class
// @see http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6894753
Map<String, String> map = new HashMap<String, String>() {{ 
    put("a", "one");
    put("b", "two");
}};

it's an instance initialization block of anonymouns class:

Map<String, String> map = new HashMap<String, String>() {
    // instance initialization block
    {
        put("a", "one");
        put("b", "two");
    }
};

double brace initialization is funny, but creating a new class just for a map seems like an overkill. the best way is using guava's ImmutableMap:

final Map<String, String> map = ImmutableMap.of("a", "one", "b", "two");

Wednesday, January 21, 2015

One thing I don't like about Java, it's massive!

I'm reading Pro Spring Batch, googling some new terms mentioned in the book. Suddenly there're Spring Integration, Spring XD, Spring Data... When I try to find out what exactly integration means, I was told that I need to read the Enterprise Integration Patterns book; check some samples. Also something metioned but not related, Neo4j, leads me to graph database.

Maybe I'll stick with my cron.


I feed sad about Groovy and Grails, I like Groovy, but it's slow IMO. After Java 8 came out, I don't see any reason to use it.

I may try JRuby as people said maturity of JRuby is one reason why Groovy's popularity ranking is dropping.

When I followed this guide, the recently good java experience is gone. BeanPropertyItemSqlParameterSourceProvider, seriously?

Thursday, January 22, 2015

I hate XML, but I hate annotations even more. Annotations should be optional, like @Override.

I want to do Java, but I don't do anything with XML and annotations.


TIL:

  1. github supports org files
  2. you can write your elisp in org mode then extract the source, or load it directly:
    (require 'org)
    (org-babel-load-file
        (expand-file-name "settings.org"
            user-emacs-directory))

here is an example

Saturday, January 24, 2015

Had a quick look on these books this afternoon. very bad, what a waste of time.

Tuesday, January 27, 2015

this week's changelog podcast is about Rocket

Thursday, January 29, 2015

playing with JRuby, very nice.

Friday, January 30, 2015

loaded rasmus' php7dev vagrant box, will try new features next week.

Blog Archive