Better HN
topnewbestaskshowjobs
Log inSign up

chingjun

24 karma · joined Feb 29, 2012 (14y ago) · 26 submissions

Submissions

comment 7y ago · link · parent

How do you know that this individual driver has a one in a billion miles chance of crashing? By statistics from other human drivers I assume?

comment 7y ago · link · parent

I am from Terengganu. And yes people in Terengganu can speak standard Malay, but among themselves they speak a different dialect, which is very different. People from other parts of Malaysia often have difficulty understanding it. It’s more like Scottish to English I would say.

comment 8y ago · link · parent

Not sure if things has changed but 1 year ago my brother in law has opened an account in bank of China 中国银行 while he was on a 1 year traveling visa. You may want to try with another bank

And no, we’re not trying to spread rumors :)

comment 8y ago · link · parent

Any foreigners can open a bank account in China even on tourist visa. No special documents needed other than your passport.

Yes, being a foreigner in China does suck but not for this case.

comment 8y ago · link · parent

WhatsApp was only started to be blocked recently (last year) when WeChat was already way ahead of WhatsApp in the market. WeChat's success was not due to lack of contender

comment 9y ago · link · parent

Easy, have a self driving cart to follow you wherever you go!

comment 9y ago · link · parent

> 3. You need access to a reliable electric grid and reliable fast internet (the firewall rules out mainland China completely--1/5 of the world).

Every competent developer in China knows how to bypass the firewall.

comment 9y ago · link · parent

Just like how you learn any other programming language: use it to solve your problems.

Anyway, here's a few steps that I would recommend:

1. Go through http://tldp.org/LDP/abs/html/ and http://www.tldp.org/LDP/Bash-Beginners-Guide/html/ , or at least go through the table of contents so that you have a feeling of what bash is capable of. A few important things are: if, while, for, switch, functions, string manipulation, pipe, subshell, command substitution

2. Understand the execution model. Variables in subshell cannot be accessed from the parent shell, this is a common mistake

3. Learn to avoid common pitfalls. I always recommend my colleagues to always quote the variables in double quote, always use "$@" instead of "$*", always use double square bracket instead of single square bracket for testing, use echo to pass return value from functions instead of assigning to global variable

4. Learn awk, sed, grep. Bash can be quite limiting when it comes to data processing and these tools can be quite powerful. You can use bash to glue different filters together at a higher level.

Bash is a fantastic language and there are quite a lot of things that can be much more quickly in bash than in other "proper" languages. A lot of people says that it's too difficult to maintain a shell script beyond a "critical mass" but I believe that if you follow good practices and write modular codes, shell scripts can be very manageable.

comment 11y ago · link · parent

The problem with using the English message as the key is that, when we changed the English text, we'd have to change the keys in all other languages as well. Also, the same English text might translate to different texts in a foreign language depending on the context / location appeared.

Disclaimer: I've never used gettext before.

comment 11y ago · link · parent

Yes, I'm a Chinese and to me this is just two rare Chinese characters placed together. It doesn't have any meaning.

comment 11y ago · link · parent

Shouldn't it be "a UI toolkit" instead of "an UI toolkit"?

comment 11y ago · link · parent

Can anyone explain to me why I couldn't write

  n.forEach(console.log);

Just tested on Chrome, it gives me an error

  TypeError: Illegal invocation

comment 11y ago · link · parent

When PHP announced that they will skip PHP6, we joked that it is a smart move to avoid PHP version 6.4

comment 11y ago · link · parent

Chinese government once blocked the download page of the python website (python.org), when they released python version 2.6.4. It is widely believed that it's because the version number triggered that[1].

Python website has since added another download link written in Chinese on their website.

[1]: http://en.wikipedia.org/wiki/Tiananmen_Square_protests_of_19... , called 六四事件 in Chinese, literally means six-four incident since it happened on 4th of June

comment 11y ago · link · parent

Because we now have [ag](https://github.com/ggreer/the_silver_searcher), which is similar to ack, but much faster

comment 11y ago · link · parent

You should avoid the obstacles while cycling. You should also stay within the safe speed limit, especially in areas with obstacles.

Same rule applies for driving, walking, and basically everything.

comment 12y ago · link · parent

Swift has named arguments, and it's called "external parameter name". Here's an example taken from Apple's documentation[1].

  func join(string s1: String, toString s2: String, withJoiner joiner: String)
      -> String {
          return s1 + joiner + s2
  }
  join(string: "hello", toString: "world", withJoiner: ", ")
  // returns "hello, world"
[1]: https://developer.apple.com/library/ios/documentation/swift/...

comment 12y ago · link · parent

Yeah, a developer cannot get "design".

comment 12y ago · link · parent

You're not alone.

comment 12y ago · link · parent

Wow I didn't know that! I was always doing something like this

    mi = dict((v,k) for k,v in m.iteritems())

comment 12y ago · link · parent

I stared at the page for 10 seconds before realising that i have to use arrows. I'd suggest adding simple instructions like "Press arrow keys to navigate".

comment 12y ago · link · parent

  5.  193  ^(?!.*(.)(.)\2\1)
  11. 379  ^\*(er|[fiptv])|^([blpw]|c[hor]|do|mi|re)

comment 12y ago · link · parent

379:

  ^\*(er|[fiptv])|^([blpw]|c[hor]|do|re|mi)
and it has "do re mi" in it!

comment 12y ago · link · parent

  >  ^(?!(.)(.)\3\2)$
  >  But now it matches nothing.
Things like (?!..) are called assertions. I like to think of assertions as patterns that match the space between two characters. So (?!a) means that it matches the space, where the next character is not 'a'.

So in this case, your regex matches an empty string (since it doesn't match any character at all between ^ and $, only spaces.)

  >  ^((?!(.)(.)\3\2).)∗$
  >  1. Why are my backrefs still \3 and \2?
Well, you're referencing the second and third opening parenthesis.

  >  but it counted in my second example above
Maybe that's because your second example is wrong? I mean, I don't really know what you are trying to achieve in your second example.

By the way, my solution for abba is

  ^(?!.*(.)(.)\2\1)
I guess you'll will be able to figure out what this regex means by now :)

comment 12y ago · link · parent

Order for 195

    ^[a-g]*[^a-g]*$

comment 12y ago · link · parent

What is the difference between this and 'while true; do cmd1 && cmd2; sleep 1; done'