Saturday, July 30, 2011

Text Editors in The Lord of the Rings

Prompted by a passing thought about TextMate, I thought I’d make a comprehensive, accurate, unbiased, and irrefutable survey of text editors by way of comparison to locations in The Lord of the Rings.

TextMate: Minas Tirith


A once-great but now decaying city. Only the King has the power to renew it, but he is a long absent, indeed half-legendary figure—though there are persistent rumors that he is alive still in some distant land. In his stead, the city slowly falls in upon itself, kept in some sort of working order by its melancholy people. They can repair but not truly rebuild it, and they pray daily for the Return of the King.

Sunday, July 24, 2011

Hash passwords

http://security.stackexchange.com/questions/5586/why-do-people-think-that-this-is-bad-way-to-hash-passwords

Q:  

Well, please tell me, what's wrong with this code

$password = "hello";;
$password = md5($password);
for($i=1;$i<20;$i++){
    $password = md5($password);
}

Test-Driven Development Is Not Slower

Hello, my name is Matt Honeycutt, and I am addicted to Test Driven Development.  I’ve been “using” for about 5 years now.  It started out with a little innocent unit testing and Test Later Development, but I quickly found that the increased productivity caused by TDD to be too alluring, and I succumbed.  Now I’m using all the time.  I use at work.  I use at home.  I just can’t stop.  People don’t really understand the risks.  There’s this myth that TDD is slower, that it makes you less productive, but that’s so not true.  Read on, and I’ll help you understand why.
NOTE: This post is an extended version of a comment I left in reply to an anonymous commenter on Mike Hadlow’s “I Don’t Have Time For Unit Tests” post.  I encourage you to go read his post, because Mike has some good insights that I won’t repeat here.

Thursday, July 21, 2011

Java note

Java only supports Pass-By-Value. You can pass a reference by value, but you cannot pass by reference in Java




Which one is faster in Java ?

1for(int i = 100000; i > 0; i--) {}
2for(int i = 1; i < 100001; i++) {}
Answer: Which ever is run second with be fastest. The server JVM can detect and eliminate loops which don't do anything. A method with either loop is compiled when the loop iterates about 10,000 times. (Based on -XX:CompileThreshold=10000) The first loop will take time to detect it doesn't do anything, however the second will have been compiled.

Wednesday, July 20, 2011

Funny Source Code Comments

I recently stumbled upon an awesome Stack Overflow thread, entitled "What is the best comment in source code you have ever encountered?".

As you might have guessed, it is a collection of funny source code comments, provided by developers all over the world. Take a look at it, it could definitely make your day.

I am reposting here my personal favorites from that long long collection:

// sometimes I believe compiler ignores all my comments

Exception up = new Exception("Something is really wrong.");
throw up; //ha ha

Monday, July 18, 2011

21 Google Plus circles you can actually use.


This infographic on 21 Google Plus circles you can actually use made me chuckle.

(via David Pogue)
"

Test your vocabulary

http://testyourvocab.com/?r=105891

Your total vocabulary size is estimated to be:
5,450
words

Dạo này lười thế :D

Weekly post

Weekly, I will conclus everything I've learned to a post. To keep watching them, recall it on next week to keep my knowledge.

Last week:
Basic PHP
Normalize SQL database - 3 steps
MD5 hash, little things in cryptography.
TTD, PHP simpletest , JUnit

This week:
PHP & HTML form

MD5Hasher v1.0

My first Java simple software . It prints out MD5 Hash of the input.
http://www.mediafire.com/?lzi4t158c4z5phc
run on both Windows and Linux. You have to preinstall JRE.
Just a toy software make to use some interesting things that I've learned about cryptography and Java GUI.
Nice try ;)
(If you would like the source, plz comment) :D


Thursday, July 7, 2011

A physics joke

A physics joke: "
Newton, Pascal, and Einstein are playing hide-and-go-seek in heaven.
Einstein closes his eyes and starts counting.
Pascal goes and hides behind a cloud.
Newton stays where he is, and draws a 1mx1m square on the floor around him.
Einstein finishes counting and turns around.
'Ah ha, Newton! I found you!'
'No you haven't, you've found one Newton over 1m2 . . . You found Pascal.'
submitted by nanuq905