HNHacker News
TopNewBestAskShowJobs

wting

2,962 karma · joined June 20, 2012

io at williamting.com

https://github.com/wting

[ my public key: https://keybase.io/wting; my proof: https://keybase.io/wting/sigs/yTnPQ0DZR5vV9WRhYq8SP7V56pyKc3Z8fMQQE9cADBQ ]

submissionscomments
wting··on Hangouts for iOS
If you check the URL for Google Hangouts you'll notice it's pointing to the old identifier for Google Talk (com.google.android.talk):

https://play.google.com/store/apps/details?id=com.google.and...

You'll notice this same link is used in multiple locations promoting Google Hangouts:

http://www.google.com/+/learnmore/hangouts/

It looks like they temporarily pulled the Google Talk app to transition everyone to Google Hangouts without needing users' intervention (except maybe upgrading the app).

Edit: Just installed Hangouts app, it replaces Talk. Also it asked to confirm my phone number, hinting at future SMS support?

wting··on Come here and work on hard problems – except the ones on our doorstep
The wealth disparity is probably more evident in SF.

For example, Honolulu has a huge homeless population despite the huge tourism industry. The city just pushes homeless towards parts of the island where tourists don't visit and thus aren't aware of the problem.

wting··on Https URLs posted in private Skype chats visited by Microsoft
When MS bought Skype they changed supernodes from peers to company owned Linux boxes.[0] This change gives them the ability to eavesdrop on any conversation.

My friend "Alice" (a Chinese national studying in the US), recently sent a present to her friend "Bob" in the Chinese army and talked about it on Skype.

The Chinese Army found out that Bob was receiving a gift from the US and tracked down the relevant Skype conversation. Bob was interrogated about Alice and what the gift was for.

Microsoft complies with all governments' legal requests, as it should. I have no doubt the US government has made similar requests of MS.

Skype's original protocol made eavesdropping harder, but not after the changes Microsoft made.

[0]: http://arstechnica.com/business/2012/05/skype-replaces-p2p-s...

wting··on Pentagon scrubs 3D gun plans from Internet, says designer
How does the government scrub anything from the internet once it has been distributed?

While I did not download the plans, I found them pretty easily on Pirate Bay.

wting··on You don’t have to feel guilty for oversleeping
Actually, studies from multiple sources prove that sleep debt is a real thing:

http://www.nytimes.com/2009/11/03/health/03real.html?_r=0

http://www.nytimes.com/1999/09/26/nyregion/the-high-cost-of-...

wting··on John Carmack starting port of Wolf 3D in Haskell
Carmack has been thinking about functional programming for a while and posted his thoughts on applicable lessons for C++ a year ago:

http://www.altdevblogaday.com/2012/04/26/functional-programm...

He's a great developer and has always pushed boundaries. I look forward to his postmortem after this project is finished.

wting··on Don’t buy an SLR if you’ll only use the kit lens
I second shot weddings and freelanced events, and have spent more on camera gear than my car.

Marco's advice is terrible and akin to, "Don't learn programming if you'll only use one language."

It's a chicken or egg first problem. People buying their first DSLR always ask which camera to buy, but it's hard to answer since they don't have established preferences from exploring the hobby. There are no early indicators whether a person will ever need to upgrade from a kit lens.

Marco 40mm pancake lens suggestion is projecting his own preferences onto readers. What if the person wants to shoot headshots, sports, landscape, low light, or events? What use is a 40mm pancake then?

He may be famous for Instapaper, but his unqualified gear snobbery doesn't belong on Hacker News.

wting··on Why IBM Now Views LLVM As Being Critical Software
The official reason as mentioned in Go's FAQ (http://golang.org/doc/faq):

> We also considered using LLVM for gc but we felt it was too large and slow to meet our performance goals.

Does this mean compilation speed, performance speed, or both? Or is this a hand-wavy excuse to use gcc instead due to Ian's expertise?

That being said, there is a project that builds Go on top of LLVM:

https://github.com/axw/llgo

wting··on Big-O Algorithm Complexity Cheat Sheet
You can pass some interviews by blindly memorizing, but it's unnecessary. If you understand a concept, then you can reason its big O. Memorization implies a superficial understanding that may be revealed later.

If you don't understand something, spend a few hours and implement it.

    "I hear and I forget. I see and I remember. I do and I understand."

    - Confucious
wting··on The Computer Science Mismatch
OS: Used mutexes, semaphores, implementation details, argue about pros/cons, liveness/safety properties. Implemented shell, virtual memory, interrupt handling, process tables, scheduling algorithms, and multi-processor kernel support on JOS. Inode management and journaling for a FUSE filesystem. Concurrent network proxy.

Distributed Computing: Paxos, Bayou, Byzantine Faults, 2 Phase Commit.

Network Security: Had to demonstrate SQL injection, XSS attacks, stack smashing various C programs (one exploit required taking advantage of a double free to gain control).

Programming for Performance: cache / matrix multiplication optimization, finding single source shortest path for the USA road network using a multithreaded implementation on a supercomputer 3 ways (Djikstra, Bellman-Ford, BF with chaos relaxation), and again using CUDA.

Algorithms: graph theory (cycle detection, min-max flow, bipartite detection, Kruskal's, Floyd-Warshall, A*), divide & conquer, recursion / dynamic programming, greedy algorithms.

Other courses: compilers, data structures, combinatorics, probability, linear algebra.

These are just some projects I've done over the years, and only a subset of what was taught. Oh, and I picked up boring stuff like git, unit testing, and 3NF along the way.

> Did anyone actually learn software development from their CS degree?

Yes, yes I did.

wting··on Don't be a git, use subversion
Umm... fuck no.

There is no reason that you can't use git as a master repository system--that's how most people treat GitHub anyway.

OTOH if you want to do anything besides the basic commit or update with Subversion, it's ridiculously difficult. Subversion is a SCM tool where people actually prefer to merge manually rather than deal with its conflict handler.

wting··on The //* /*/ //*/ comment toggle trick
Rather than relying on syntax tricks, I'm sure most editors allow for block commenting or comment inversion.

For example with NERD Commentor vim plugin, you can toggle block comments with `<leader>c<space>`. Inverting comments is `<leader>ci`.

https://github.com/scrooloose/nerdcommenter

wting··on The //* /*/ //*/ comment toggle trick
Some C projects still use -ansi and thus C++ comments (//) will result in a compiler error.
wting··on What Makes Code Hard to Understand?
When reading the paper's verbose versions, I have to act as a human compiler and keep track of state which leads to mental errors. Contrast this with a shorter version reducing the LOC count from 21 to 6:

    x = [..]
    y = [..]
    between = lambda ls, low, high: (n for n in ls if low < n < high)

    x_between = between(x, 2, 10)
    y_between = between(y, -2, 9)
    xy_common = set(x).intersection(y)
Experienced users made mental stakes because they skim code and make assumptions from previous sections. This can be solved by taking advantage of a language's expressiveness to clarify intent.
wting··on What Python developers need to know before migrating to Go
Well there is the "official" definition on Wikipedia.[0]

Informally, my definition of a functional programming language is one that supports functional style as the default. (Hooray for using a recursive definition. :p) The language should strive for referential transparency and the language and compiler should be optimized for functional idioms.

Let's define the sum of a list functionally[1]:

    # Python
    sum = lambda x: reduce(int.__add__, x, 0)

    # Haskell
    sum = foldl' (+) 0
You could write this same function in C using function pointers and arrays. However it's not very convenient to do so. You would need to write a reduce function, an add function, anonymous functions don't exist, and syntactically it would be very messy. On top of all this, the compiler is not optimized for reduce functions vs an imperative for loop.[2]

More generally, functional style typically refers a style of programming where most functions are pure and side effects are contained specifically. This allows for easier reasoning of a program's correctness.

John Carmack has a post about functional programming in C++:

http://www.altdevblogaday.com/2012/04/26/functional-programm...

Summed up, functional style is about containing side effects and functional programming has built-in support for common idioms.

[0]: https://en.wikipedia.org/wiki/Functional_programming

[1]: This ignores the fact that sum() is already provided in most functional languages.

[2]: Python straddles my definition of functional programming and that's why it's awesome and frustrating at the same time. It supports many staple functional idioms but is not optimized for it. Function calls are very expensive, and thus recursive performance is also hurt tremendously.

Plus Guido hates functional programming:

http://python-history.blogspot.com/2009/04/origins-of-python...

wting··on Those with $120K+ salaries... what do you do?
I don't think $120k is possible as a new grad in Austin.

New grad rates tend to be $50 - 70k, while some bigger companies offer ~$90k.

$90k in Austin is a much better standard of living than $120k in Bay Area though...

wting··on What Python developers need to know before migrating to Go
I worked on GNOME for a summer, and can see Go being a viable option for DE's. GNOME has added a lot of libraries to bring object support to C, but Haskell has proven gc language is fast enough for a WM (xmonad).

Go might need to improve its gc to prevent the occasional stutter, but it would otherwise be sufficient.

However my original statement defined systems as kernel code, since HN tends to have many opinions on the topic.

> The problem with any systems programming language is that it is only used as such, if an OS vendor makes it the only way to do OS programming. Like Microsoft does with C++ or Apple with Objective-C.

I see plenty of new C code still be written outside of systems, the problem is lack of exposure. HN community is fairly web focused but HPC, scientific computing, graphics, engines are still predominantly done in C/C++.

wting··on What Python developers need to know before migrating to Go

   if blah {
     ..
   } else {
     ..
   }
> Maybe that's popular in some obscure places, but it is weird they made that the only valid syntax.

That is valid K&R syntax[0], which is used prevalently in C (e.g. Linux kernel). FYI, Rob Pike wrote a few books with Brian Kernighan (the K in K&R).

Go is designed for consistency and optimized for the compiler (e.g. mandatory braces, no unused import statements). Declaring a single canonical format (e.g. gofmt / PEP 8) solves a lot of syntax bikeshedding.

[0]: https://en.wikipedia.org/wiki/Indent_style#K.26R_style

wting··on What Python developers need to know before migrating to Go
I know Go has been touted as a C successor since inception, but most new users seem to be coming from interpreted languages. Like this blogger, they attribute a lot static language advantages as unique to Go.

I don't see a lot of C/C++ developers switching, probably because they have sunk costs with their respective languages and Go doesn't offer very much by comparison.

I would definitely use Go where it seems appropriate, but I don't see it replacing C as a systems language.[0] Sometimes when I write something in Go, I look back and wonder why didn't I just do it in C. However, Go is great in a distributed systems / networking environment where most new code seems to be written.[1]

In the words of a friend, "You can pry raw memory access from my cold, dead fingers."

[0] systems == OS, drivers, etc.

[1] Motivations summarized in the abstract: http://talks.golang.org/2012/splash.article#TOC_1.

wting··on What Python developers need to know before migrating to Go
We have two differing definitions of functional programming. I would argue that your code represents functional style in an imperative language.

If function pointers are sufficient to qualify a language as a functional, then that would include C/C++.

In contrast, Rust has support for the standard functional language primitives.[0][1][2]

[0]: http://static.rust-lang.org/doc/core/vec.html#function-map

[1]: http://static.rust-lang.org/doc/core/vec.html#function-foldl

[2]: http://static.rust-lang.org/doc/core/vec.html#function-filte...

wting··on What Python developers need to know before migrating to Go
> The code you write with Go just seems to be correct. I can’t really put my finger on it, but somehow once the code compiled (and it compiles QUICKLY), you just get the feeling that it’ll work (not just run without error, but even logically be correct). I know, that sounds very wishy-washy, but it’s true.

This statement needs to be qualified.

Switching from an interpreted to a static language will catch a certain class of bugs upfront. I've rewritten some small programs from C to Go, and the same logic bugs are present in both.

In this sense, switching to Go is no different than switching to Java/C in terms of the bugs it will catch. There's nothing in Go that sets it apart from other static languages in this respect (unlike Haskell).

> It’s very similar to Python in terms of verbosity (or lack thereof) and it treats functions as first-class objects, so functional programming is easy to reason about.

Where is map, reduce/fold, filter, scan? Go doesn't support functional programming primitives due to lack of generics.

I may not have written enough Go programs, but I find Go marginally less verbose than C thus far (ignoring concurrency). Channels and goroutines and are its most interesting features.

wting··on How to Think About Variables in C
In Haskell:

Variables? What state? Everything is puuuuuuuuure.

In Python:

Everything is an object (numbers, true/false values, strings, etc), some are mutable and some are not. Variables are temporary labels on objects (think of them as hard links).

In Rust/C++:

There are various types of boxes / smart pointers (shared, unique, heap, etc), and unsafe / raw pointers should be avoided when possible.

In C:

Not every variable has a data type, e.g. void or function pointers.

wting··on Ruby is too slow for programming competitions
First of all, there are plenty of people who solved both large inputs with Python/Ruby (with and without pre-computing all the fair and square numbers).[0][1]

As others have stated, the contests are designed such that language shouldn't matter and problem sets are deemed solvable with Python as a baseline. For this particular question, the official contest analysis goes into detail on how to reduce the solution space:

https://code.google.com/codejam/contest/2270488/dashboard#s=...

Now the issue becomes the trade off between development speed vs runtime performance.

Is it possible that you might solve the problem with a worse solution in a better performing language? Yes.

Is it possible you might finish a solution within the time constraints in a more expressive language? Yes.

If something is CPU bound in production, then going with a better performing language is a viable consideration.[2] However, my goal in programming contests is often to become a better programmer in the process. As a result, I choose to focus more on improving algorithmic complexity which is language agnostic.

[0]: http://www.go-hero.net/jam/13/solutions/0/3/Ruby

[1]: http://www.go-hero.net/jam/13/solutions/0/3/Python

[2]: For the pedantic, I understand that language performance is different from implementation performance.

Edit: Corrected links, thanks victorhn.

wting··on Yelp extorting small businesses
I visited the site in incognito mode, and I see the review: http://i.imgur.com/v9P9cJJ.png

Yelp has publicly stated that they filter reviews[0] since many people try to game the system. I'm not sure how they filter the reviews, but this is probably a good guess: http://qr.ae/TluW1

Disclaimer: I'll be interning at Yelp over the summer.

[0]: http://qr.ae/TluOB

wting··on Reasons Why You Should Write Proper Tests
Can anyone explain the advantages of writing unit tests before vs after certain sections of code has been finished?

I use unit tests, but only after the code's finished or there's a good stopping point. Otherwise I have to do too much refactoring every time I change a function's name or signature.

Maybe TDD is forcing you to architect the program in the beginning, but I find it cumbersome because stuff changes so much throughout the course of finishing a project.

wting··on How I got robbed of 34 btc on Mt.Gox today
You have the option of enabling two-factor authentication for various actions:

http://i.imgur.com/5I31WcX.png

wting··on Bitcoin falls from $266
My reply was a lot more relevant at the time of posting and when the original title was, "Bitcoin drops from $260 to $230". :/
wting··on Bitcoin falls from $266
I'm interested in the price of Bitcoin, but we don't need these daily submissions.

If you're interested in following the price, I suggest these links:

- https://bitcoinity.org/markets

- http://bitcoincharts.com/charts/mtgoxUSD

- http://bitcoin.clarkmoody.com/

If you're interested in talking about the price, try #bitcoin-pricetalk on Freenode.

wting··on Intel wants to kill the traditional server rack with 100Gbps links
Think of the cache pyramid.[0] Latency may be higher, but if there is enough work / data then it's still efficient to do work remotely / put data farther away.

From what I understand, the article is about two things:

1. Hot swappable components.

Oversimplified, but imagine being able to add / remove CPU and RAM to your server like you can with disk space and USB thumb drives.

2. Shareable resources / load balancing.

If one server is using all its CPU and another is using all its RAM, they can now use each other's resources.

You know how AWS is on-demand, scalable computing? This is the same thing but at a hardware level with CPU, RAM, disk, and network resources.

[0]: http://static.ddmcdn.com/gif/computer-memory-pyramid.gif

wting··on Facebook Home destroys any notion of privacy
Not too long ago when iOS was released users jumped ship to Android due to the maps fiasco.

If Facebook forks Android, do you think people are willing to give up Google's ecosystem in exchange for Facebook's?

Even if you find Facebook chat / messages a viable replacement for Gtalk / Gmail, this still means no access to Google Play Store.

Amazon was willing to create a second competing marketplace and sell its devices as media players, but Facebook will not have those in place if they fork Android. Do you think Facebook has enough leverage to pull this off?

I don't think so, but since the phone is already in the works time will tell.

← PreviousPage 7 of 10Next →