HNHacker News
TopNewBestAskShowJobs

chingjun

24 karma · joined February 29, 2012

submissionscomments
chingjun··on Tesla’s Autopilot found partly to blame for 2018 crash on the 405
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?
chingjun··on Mat Dan: 'I became an accidental celebrity 6,000 miles from home'
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.
chingjun··on How WeChat Came to Rule China
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 :)

chingjun··on How WeChat Came to Rule China
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.

chingjun··on How WeChat Came to Rule China
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
chingjun··on Waymo now testing its self-driving cars on public roads with no one at the wheel
Easy, have a self driving cart to follow you wherever you go!
chingjun··on How to find a remote job
> 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.

chingjun··on Ask HN: How can I get better at bash?
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.

chingjun··on BabelBox – Minimal internationalization library
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.

chingjun··on Underhanded C 2015
Yes, I'm a Chinese and to me this is just two rare Chinese characters placed together. It doesn't have any meaning.
chingjun··on Show HN: kiUi – Lightweight auto-layout stylable UI toolkit
Shouldn't it be "a UI toolkit" instead of "an UI toolkit"?
chingjun··on But – A way to pass along a callback with just a single argument
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
chingjun··on Gmail blocked in China
When PHP announced that they will skip PHP6, we joked that it is a smart move to avoid PHP version 6.4
chingjun··on Gmail blocked in China
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

chingjun··on Grab – simple but very fast grep
Because we now have [ag](https://github.com/ggreer/the_silver_searcher), which is similar to ack, but much faster
chingjun··on World’s First Connected Bike Grips
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.

chingjun··on A proposal for named arguments for C++
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/...
chingjun··on Show HN: A text adventure for developers
Yeah, a developer cannot get "design".
chingjun··on 2048
You're not alone.
chingjun··on Python Language Features and Tricks
Wow I didn't know that! I was always doing something like this

    mi = dict((v,k) for k,v in m.iteritems())
chingjun··on Building JavaScript Tools You Didn't Think Were Possible
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".
chingjun··on Regex Golf

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

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

  >  ^(?!(.)(.)\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 :)
chingjun··on Regex Golf
Order for 195

    ^[a-g]*[^a-g]*$
chingjun··on Show HN: New unix utility "when"
What is the difference between this and 'while true; do cmd1 && cmd2; sleep 1; done'