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 Why PHP continues to thrive in the age of the PaaS
Is it faster to write a report in notepad or Word? Depends on your level of expertise. If you have none, then notepad is the faster. However if your job requires writing reports all day then learning to use Word is better in the long run.

For a simple pages with no prior coding experience, PHP is the best tool for the job. However if you plan on building complicated web apps as a profession, then perhaps learning a better tool is worth it.

For example, you can replace Visual Studio with PHP in this image:

http://i.imgur.com/ghAccKb.jpg

wting··on Pythonium: Python 3 to JavaScript translator
There's also a quick demo of Pythonium here:

http://pythonium.github.io/

The generated JS:

http://pythonium.github.io/js/app.py.js

wting··on Ask HN: Best isolating headphones for hacking?
This is a conscious culture decision for my workplace.

We ping / discuss topics over IRC even though most of my team is within talking distance. This provides (remote employees|other teams|working from home people) a chance to provide input, logging for reference, and is more multi-tasking friendly (semi-asynchronous communication). However if it feels like a lot of back and forth, we'll discuss in person or via Google Hangouts.

You know how engineers complain about being distracted by people asking random questions throughout the day? We have an email / IRC first culture which minimizes distractions as much as possible.

wting··on Ask HN: Best isolating headphones for hacking?
I have a bunch of expensive headphones (Bose QC2, multiple inner ear), and the best solution I've found costs $28 and allows me to listen to music comfortably on a Mac at 0.5 tick!

I use a pair of earphones[0] covered by industrial ear muffs[1]. For comfort reasons, it's important that the earphones are not pressured by the surrounding ear muffs. I haven't found any inner ear headphones that meet this constraint. Sometimes I'll swap out the earphones for ear plugs for double ear protection / white noise.

I'm not a fan of open office plans, but this combo lets me tune out everything. Coworkers have gotten used to pinging me or waving to get my attention.

Edit: Drowning out distractions by turning up the volume leads to hearing damage. A better alternative is to eliminate ever hearing external noises. However to prevent incoming noise, ear muffs create a tight seal around your ears. My wife is uncomfortable with the pressure for extended periods of time. I wear them hours daily, and especially love them for sleeping on planes.

[0]: JBuds J2 affiliate link (the white color is $7):

http://www.amazon.com/gp/product/B001GS8FZC/ref=as_li_ss_tl?...

JBuds J2 non-affiliate link:

http://www.amazon.com/Premium-Noise-Isolating-Earbuds-Headph...

[1]: 3M Pelter H10A Optime 105 affiliate link:

http://www.amazon.com/gp/product/B00009LI4K/ref=as_li_ss_tl?...

3M Pelter H10A Optime 105 non-affiliate link:

http://www.amazon.com/3M-Peltor-H10A-Optime-Earmuff/dp/B0000...

wting··on Common Species Of Code
Evolution of a Python programmer:

https://gist.github.com/fmeyer/289467

wting··on The Narcissism of Small Code Differences (2008)
I made this same mistake refactoring a function to not process duplicates that the original dev caught in code review. I argue that assumptions (intentionally re-processing duplicates) should be explicitly communicated through comments, unit tests, or assertions.

In the article, author states that existing unit tests checked that two digit zip codes were invalid. The question remains how a refactor that fails unit tests was pushed to master.

wting··on Fourier Toy
This article and related commentary are relevant:

http://nautil.us/blog/the-math-trick-behind-mp3s-jpegs-and-h...

https://news.ycombinator.com/item?id=6683866

In fact, it looks like Lucas Viera may have used that blog post as inspiration.

wting··on The stupidest trend in laptop design
You can always buy a USB number pad for data entry tasks, but you can't remove a numpad from an existing keyboard. A 3rd party number pad is probably higher quality anyway.
wting··on Does life end after 35?
A similar question was asked on Quora recently:

https://www.quora.com/Silicon-Valley/What-do-people-in-Silic...

Some of the companies and founders' ages compiled from the answers:

- Zynga: 41

- LinkedIn: 36

- Salesforce: 35

- Intel: 41, 39

- Qualcomm: 52, 50

- Juniper Networks: 42

- Wikipedia: 35

- Pandora: 35

- GigaOm: 39

- Zipcar: 42

- TechCrunch: 35

- Craigslist: 42

- Netflix: 37

wting··on Why I Stick with the Linux Desktop
You might want to look into BetterTouchTool (http://www.boastr.de/). It gives you the ability to map keys to full screen maximize, left and right split, and a plethora of other options.
wting··on My dad unexpectedly uses my Linux laptop to get real work done
My brother has become proficient at using Windows, so his switching costs are higher. He didn't want to learn the Linux equivalent of task manager, adding startup applications, updating / installing software. Also he's in finance so 99% of his work is spent in Excel.

By comparison my parents are rudimentary users of technology, and thus their switching costs are low. As long as there is Firefox / Chrome they're ok. Some Chinese sites still depend on ActiveX but they've been replaced with Flash for the most part.

wting··on My dad unexpectedly uses my Linux laptop to get real work done
Both my parents are 60+.

My mom is perfectly fine using Ubuntu on my old x61 for email, browsing, and YouTube. To be fair she could probably replace it with a tablet if it weren't for the fact that she visits a lot of flash sites (Chinese TV streaming sites).

Likewise my dad is on another Ubuntu machine at home. His work needs access to some software / printers that can't be run via Wine so he's stuck with Windows there.

I tried to convert my 25 year old brother as well, but he switched back to Windows after a month. Despite being the youngest, he hated learning a new system and preferred Windows.

wting··on Pinterest Raises $225 Million at $3.8 Billion Valuation
I think many HN readers have a hard time relating to Pinterest because we aren't the target demographic, but from what I can find they have great metrics.

The question is whether they can monetize despite lack of purchasing intent (as compared to Google, Amazon, Yelp, etc). However from some anecdotal evidence[0], it appears that growing revenue may not be as difficult for Pinterest as it is for Facebook or Twitter.

I'm pretty bullish on Pinterest, and a $3.8B valuation doesn't seem out of line compared to Twitter ($20B) and Facebook (~$80B pre-IPO), Instagram ($500M).

[0]: http://mashable.com/2012/03/28/pinterest-amazon-spam/

wting··on We don’t have time for code reviews
There's also a few benefits of code review that you missed:

1. Reduces bus factor.

2. Increase readability.

Coding in a company is a communication problem. How you solve a problem may be different than someone else. Outside of simply catching more mistakes, it's possible that you may learn something new or the other person can improve their code.

Ideally there should be a team / company coding style simply to ease communication overhead and reduce bikeshedding.

wting··on Adjusting to C
If you're creating an IO bound application (e.g. Dropbox, most web sites) then the developer time gained may be worth the performance offset.
wting··on Poll: What are your liked and disliked programming languages?
There will be obvious winners and losers, but I'm interested in the long tail results.

The poll quantifies a community's thoughts as only the vocal minority comment while the majority lurks. It provides a snapshot for comparison with other communities or even to Hacker News 18 months ago.

Language threads will provide more insightful commentary, but a general poll is useful for macro trend discussion.

wting··on Poll: What are your liked and disliked programming languages?
I can also break out Lisp into Arc, SBCL, Emacs, Chicken, Racket but I have to draw the line somewhere.

Also historically VBasic has not garnered many responses thus the catch all.

wting··on If Java Is Dying, It Sure Looks Awfully Healthy
Java is a commonly used language, but not very popular according to a Hacker News poll from 2012:

https://i.imgur.com/toGKy21.jpg

In fact, it's likability percentage is worse than PHP!

I think the issue may stem from the fact that given a choice, few people use Java in their own projects but have no choice at work.

wting··on A simple git branching model
I think it depends on how public and how many contributors you have to a feature branch. I think author has the assumption that there is typically one dev per feature branch.

Once a feature branch is being worked on by multiple devs (and hence multiple feature branches forked off), it is a public branch and should use a merge based workflow.[0]

I personally use a rebase workflow on private branches before merging since it makes for a cleaner history. I've seen devs merge a branch with 100+ merge commits and it absolutely destroys git history.

[0]: http://lwn.net/Articles/328438/

wting··on There's a coffeeshop called java.update() in GTA V
You can always use this gem for reference:

https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...

wting··on Sovereign – Ansible playbooks to build and maintain your own personal cloud
You can't even trust your server if it never goes down.

This 5-year marketing video for police demonstrates switching a computer over to another power source without powering down:

https://www.youtube.com/watch?v=erq4TO_a3z8

wting··on Processing large files, line by line
This is an excessively long blog post that basically states: do stream processing when your data set doesn't fit into memory.

    with open('in.txt') as input, open('out.txt') as out:
        for line in input.readlines():
            out.write(foo(line))
Python users are used to importing everything all at once, while in C everything is done in small chunks whenever possible.

Python 3 is also moving into this direction by replacing many default functions with their iterator equivalents (map, range, etc).

You might think that this means forcing everything into one big context manager, but that's not necessarily true. For example:

    from itertools import imap

    def read_file(filename):
        with open(filename, 'r') as f:
            reader = csv.reader(f)
            for line in reader:
                yield line

    def write_file(filename, data):
        with open(filename, 'w') as f:
            writer = csv.writer(f)
            map(writer.writerow, data)

    write_file(
        filename='out.txt',
        data=imap(foo, read_file('in.txt')))
wting··on Celery - Distributed Task Queue
Subprocesses aren't used because the cost of forking is high. It's more efficient to fork a worker once, then have that worker keep doing work.

The problem now becomes transferring data to that worker, which is where celery comes into play.

Python threads cannot be used for CPU heavy loads because they all run on a single core.[0][1]

[0]: CPython threads are kernel threads but effectively act like user threads. All threads run within a single VM and thus restricted to a single core.

[1]: Jython does not have the same limitation.

wting··on Poll: What's your favorite bug tracker?
I'm surprised GitHub is by far #1. I wonder if it's familiarity rather than preference. Github's minimal approach of using labels for everything is like Gmail's tags over folders.

I wish GitHub had a "This bug affects me" or +1 button so the comment history stays clean of "me too" responses.

wting··on Sublime Text Ctrl+P Like Fuzzy Matching In Few Lines of Python
I had to do something similar for autojump (fuzzy matching search string vs directories list).

I started hand rolling my own based on Damerau-Levenshtein, but it turns that Python already has a similar implementation in the difflib:

http://docs.python.org/2/library/difflib.html#difflib.get_cl...

wting··on Journalists Detained Attempting to Video NSA Building where Snowden Worked
I'm surprised at the nonchalant dismissal.

Everybody gets in a dizzy when some bill may or may not infringe on the 2nd amendment, but the same response is noticeably absent when it comes to photographers' rights.

Even though photographers are legally allowed to photograph a government building from public property, why the dismissal when the government is in contempt of her own laws?

The steady erosion of personal rights and laissez faire attitude towards government behavior is what lead to the PRISM situation to begin with.

More info:

http://www.aclu.org/free-speech/you-have-every-right-photogr...

wting··on A look at some of Python's useful itertools
My intention is not to be snarky, but people post all the time about discovering the itertools or collections library. I notice it's a common gap in newer Python programmers.

Save yourself time and effort down the road and read through both libraries' documentation, they're well worth the effort:

http://docs.python.org/3.3/library/itertools.html

http://docs.python.org/3.3/library/collections.html

I tend to use defaultdict, deque (thread safe), namedtuple, imap, izip, drop/takewhile. In Python 3, map and zip have been replaced with their itertools equivalents.

I blame Haskell for all the lazy evaluation influence. :P

wting··on Hexo – A fast, simple and powerful blog framework
I'm guessing you're getting downvotes because it's a trivial reply that doesn't add to the discussion.

One could make the argument that Hexo is fast because it's:

- fast to compile: probably faster or equal to industry standard Ruby/Jekyll

- fast to install: npm

- fast to deploy: single command for Heroku / GitHub Pages

- fast to write: Markdown

You're taking the one word "incredibly" and blowing it out of proportion. We're not talking about super computing here, fast is a relative construct.

wting··on Hexo – A fast, simple and powerful blog framework
There is no need for benchmarks, because presenting static files will always be faster than dynamic web apps like WordPress.

Hexo (and Jekyll, Pelican, etc) pre-compile from Markdown to HTML which then gets served up as a static resource from the web server. On the other hand with Wordpress, the server has to compile the HTML every time a user visits.[0]

For the server, HTML is just another static resource to transmit. You might as well ask to see benchmarks between displaying an image vs WordPress blog.

[0] This can be mitigated with caching, but static resources are easier to cache and the caching logic is now handled by the app rather than CDNs.

wting··on Poll: Which is your primary text editor?
I've aliased vim -> "vim -p" which opens files into multiple tabs when passed as arguments.

I've rebound the arrow keys to switch and move tabs and buffers.

* up/down: previous/next buffer

* left/right: previous/next tab

* shift left/right: move tab to left or right

    inoremap <Up> <esc>:bprev<cr>
    inoremap <Down> <esc>:bnext<cr>
    inoremap <Left> <esc>:tabprev<cr>
    inoremap <Right> <esc>:tabnext<cr>
    noremap <Up> :bprev<cr>
    noremap <Down> :bnext<cr>
    noremap <Left> :tabprev<cr>
    noremap <Right> :tabnext<cr>
    nnoremap <silent> <S-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
    nnoremap <silent> <S-Right> :execute 'silent! tabmove ' . tabpagenr()<CR>
As for working with multiple files easier when vim's already open, it's a combination of Command-T, Buffer Explorer, and NERD tree.
← PreviousPage 6 of 10Next →