News for hackers. Stuff that matters.

chingjun

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?
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.
Re:How WeChat Came to Rule China on Friday February 02, 2018 @10:59PM (#16296082)
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 :)

Re:How WeChat Came to Rule China on Friday February 02, 2018 @08:47PM (#16295661)
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.

Re:How WeChat Came to Rule China on Friday February 02, 2018 @08:39PM (#16295638)
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
Easy, have a self driving cart to follow you wherever you go!
Re:How to find a remote job on Wednesday August 02, 2017 @09:35PM (#14916265)
> 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.

Re:Ask HN: How can I get better at bash? on Monday June 26, 2017 @07:50AM (#14635984)
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.

Re:BabelBox – Minimal internationalization library on Wednesday November 18, 2015 @01:25PM (#10589671)
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.

Re:Underhanded C 2015 on Sunday August 23, 2015 @08:38PM (#10107343)
Yes, I'm a Chinese and to me this is just two rare Chinese characters placed together. It doesn't have any meaning.
Shouldn't it be "a UI toolkit" instead of "an UI toolkit"?
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
Re:Gmail blocked in China on Monday December 29, 2014 @01:02PM (#8810908)
When PHP announced that they will skip PHP6, we joked that it is a smart move to avoid PHP version 6.4
Re:Gmail blocked in China on Monday December 29, 2014 @10:22AM (#8810094)
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

Re:Grab – simple but very fast grep on Monday December 22, 2014 @02:27AM (#8782343)
Because we now have [ag](https://github.com/ggreer/the_silver_searcher), which is similar to ack, but much faster
Re:World’s First Connected Bike Grips on Monday December 22, 2014 @01:13AM (#8782217)
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.

Re:A proposal for named arguments for C++ on Thursday October 16, 2014 @07:38AM (#8464384)
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/...
Re:Show HN: A text adventure for developers on Thursday June 12, 2014 @04:54AM (#7882439)
Yeah, a developer cannot get "design".
Re:2048 on Tuesday March 11, 2014 @03:05AM (#7377855)
You're not alone.
Re:Python Language Features and Tricks on Sunday March 09, 2014 @01:30PM (#7369090)
Wow I didn't know that! I was always doing something like this

    mi = dict((v,k) for k,v in m.iteritems())
Re:Building JavaScript Tools You Didn't Think Were Possible on Sunday February 16, 2014 @01:42PM (#7248643)
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".
Re:Regex Golf on Friday December 20, 2013 @12:07PM (#6942439)

  5.  193  ^(?!.*(.)(.)\2\1)
  11. 379  ^\*(er|[fiptv])|^([blpw]|c[hor]|do|mi|re)
Re:Regex Golf on Friday December 20, 2013 @11:59AM (#6942383)
379:

  ^\*(er|[fiptv])|^([blpw]|c[hor]|do|re|mi)
and it has "do re mi" in it!
Re:Regex Golf on Friday December 20, 2013 @11:57AM (#6942367)

  >  ^(?!(.)(.)\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 :)
Re:Regex Golf on Friday December 20, 2013 @10:47AM (#6941923)
Order for 195

    ^[a-g]*[^a-g]*$
Re:Show HN: New unix utility "when" on Wednesday December 11, 2013 @11:46AM (#6888630)
What is the difference between this and 'while true; do cmd1 && cmd2; sleep 1; done'