HNHacker News
TopNewBestAskShowJobs

jhawthorn

43 karma · joined July 27, 2011

http://www.johnhawthorn.com
submissionscomments
jhawthorn··on ARM immediate value encoding (2014)
You would use the LDR instruction to load the word from RAM. So just one instruction, but with some slower memory access.

When writing ARM assembly, the assembler (at least the ones I've seen) abstract this detail away from you.

You can use

    ldr    r0, =0xff000000
and the assembler will emit a MOV if it can, and if it can't it will put the value somewhere in RAM and use LDR to load it up.

ARM is fun.

jhawthorn··on Bill Gates: AMA on Reddit
I made a small rails app which presents reddit AMAs nicely

http://ama.hawth.ca/1xj56q

Here's the source https://github.com/jhawthorn/riama

jhawthorn··on What's New in Ruby 2.1 [pdf]
The f suffix has been removed in favour of the existing "foo".freeze (which is now recognized and optimized in the parser)

https://www.ruby-lang.org/en/news/2013/11/22/ruby-2-1-0-prev...

https://bugs.ruby-lang.org/issues/9042

jhawthorn··on New Debian Project Leader elected: Lucas Nussbaum
I would argue the opposite: you should always use rvm (or similar) in production. I've done this for many projects, it's great to have the same ruby version and patchset in development, CI, staging, and production. rvm is also well supported in capistrano and jenkins.
jhawthorn··on Updated Packages – Python 3.3
Not saying python 3 should have been compatible with 2. Just that this was not an apt comparison.
jhawthorn··on Jedi Knight 2 And 3 Source Code Released
I would guess error handing (freeing memory, closing fd's). A goto lets you avoid deeply nested if statements.
jhawthorn··on Updated Packages – Python 3.3
Difference being that new versions of java, windows, c++ compilers work with the existing software.
jhawthorn··on Daemon Showdown: Upstart vs. Runit vs. Systemd vs. Circus vs. God
I wouldn't use god. It's had issues crashing or misbehaving in the past. I've found monit very stable if a little awkward to configure correctly.

Today I would use systemd with monit for additional monitoring. systemd ensures that the same environment is used regardless of how it is invoked, and the units are extremely simple. Monit can ensure a running server is behaving (memory limits, CPU limits, testing HTTP) and rely on systemctl for restarting processes.

jhawthorn··on Postgres: The Bits You Haven't Found
These are clearly slides, meant to be fullscreen on a projector. Up/Down, Left/Right, PgUp/PgDown all work, much like they would in powerpoint. I'm a little baffled by this threads hostility towards the lack of a friendlier design.
jhawthorn··on From Python to Ruby: Taking a Step Backward
You will not run into this problem. Linux is almost always used for production servers and is popular for development as well.
jhawthorn··on Midnight project: Password manager without a password manager
Similar is https://www.pwdhash.com/
jhawthorn··on Bacon Ipsum, because Unicode is hard
I've been using fullwidth characters. Due to their simplicity to convert to and read. This page of course has the advantage of more variety in characters.

Fullwidth conversion code in ruby:

  "string".tr(' !-~', "\u3000" + (0xFF01...0xFF5f).to_a.pack('U*'))
jhawthorn··on Sqeezing performance out of CUDA
Oh, no! Missed noticing my first link from HN for a few days. Hopefully I can clarify some of this.

First, this is in no way faster than cuSPARSE or cusp. I wrote this for an originally for a school assignment (hence older cuda version) and was hoping to convey what I had learned my first time using cuda.

The size of the shared memory is so the reduction has no buffer overflow without using conditionals. However I am using more than needed, it should be set to 32+16. I don't expect this to affect performance as the kernel already reaches 100% theoretical occupancy.

Could you explain the desire for more threads/blocks per row? I can't immediately think of one, having more additions per thread sounds good so long as all are running.

Thanks very much for the read and the reply!

jhawthorn··on Functional Programming With Ruby
Other than recommending #map, #select, et al, the rest is poor advice. Consider the following recommendation

  input.inject({}) do |hash, item|
    hash.merge(item => process(item))
  end
Far, far slower, more memory intensive (big deal, given ruby's gc), and uglyer than the sane (and commonly accepted)

  Hash[input.map do |item|
    [item, process(item)]
  end]