HNHacker News
TopNewBestAskShowJobs

spacemanaki

2,544 karma · joined June 15, 2010

http://github.com/spacemanaki
submissionscomments
spacemanaki··on What people use their Raspberry Pi's for
Streaming TV and movies has got to be the most boring thing you can do with a Raspberry Pi, at least after letting it sit in the box in a drawer.
spacemanaki··on Let's build an entire programming environment around Brainfuck
Your comment really hit a nerve with me, probably because I'm the same age as the OP and playing around with programming language implementations is a bit of a hobby for me, so I'll apologize for my reaction ahead of time, I tried to tone down what follows from the screed I initially wrote.

Your comment comes off as a little bit condescending and presumptuous. There's this underlying judgement about the relative worth of writing a Brainfuck interpreter and environment versus drinking in some bar in Guatemala or starting a company, like the latter is obviously a better use of time and energy. Aside from the fact that doing the things you mention aren't mutually exclusive with this little project, it's really tiring to hear (older) people constantly beat the drum of "you're young! go travel! drink!" on top of the "start your own company!" startup mantra. Maybe you wish you did more of those things when you were younger, or maybe you wish you were doing more of them now, and maybe I will wish the same thing when I'm older...

But they are absolutely not for everyone. I think it's disingenuous to just throw out "take that energy and try to build a company" as an alternative. Not everyone has it in them to do all the schlep work required to succeed at their own startup, so why assume this person hasn't considered it and chosen not to follow that path? Furthermore, I would personally prefer to tinker with a Brainfuck implementation than spend any amount of time in any bar, even it's in Guatemala or Colombia. I usually find them noisy and unpleasant, and I would find "partying the night away" to be a boring waste of time. But I would never suggest someone else shouldn't spend their time that way because that would be assuming a great deal about what's important to them.

Maybe this was just a little flip remark on your behalf, not meant to be taken seriously. I'm probably projecting a little bit, and reacting to something you may not have intended to imply. For that, I apologize again.

spacemanaki··on Plain English explanation of Big O? (2009)
That's actually exactly what I was trying to point out. It may be significant practically, or might not, and definitely would be if you were really washing the dishes ;) But in terms of big Oh, they're the same.

If you assume that all of the methods (getSponge, getTowel, wash, dry) do the same amount of "work", ie take the same amount of time to execute, then the first function takes 4d units of time (continuing to use d as the number of dishes). The second takes 2d+2 units of time. We define these as (mathematical) functions in terms of d, which compute the time spent for a given input size:

    f(d) = 4d
    g(d) = 2d+2
It's possible to prove that both of these function are O(d).

The formal definition of O(n) is:

    f(x) = O(n) if and only if there exists some constant c
    and some value x0 such that, for all x > x0:
    f(x) <= c * n.
It's a way to talk about the growth rate of functions, what people usually mean when they say some algorithm is O(n) is that the function calculating the runtime based on input size is O(n).

This is pretty trivial to show with f and g above, pick c=5, x0=1.

Roughly, you can drop additive and multiplicative constants when computing the "big Oh" of a function. I'm leaving out an awful lot of formal mathematical details here, partly because I'm rusty, but also because all of this is much better presented elsewhere, in numerous algorithms textbooks and courses. (btw it's possible I've made a mistake in the above, for which I hope you'll forgive me)

Lots of people would recommend the big white book from MIT, but I'm fond of "The Algorithm Design Manual" which is less formal and rigorous, and thus perhaps a little better suited to professional software developers who are just brushing up.

http://ocw.mit.edu/courses/electrical-engineering-and-comput...

http://www.algorist.com/

spacemanaki··on Plain English explanation of Big O? (2009)
Sorry if I've misread your example, but I think this isn't quite correct. While the "batch" method of dish-washing (washing all at once, then drying all at once) is probably more convenient and efficient for humans, if you were to formalize your "dish-washing" algorithms, I believe both of them would have running times in the same class of functions -- ie the same big Oh.

In pseudo-java-code:

    void washDishes(Dish[] dishes) {
        for(Dish d : dishes) {
            Sponge s = getSponge();
            s.wash(d);
            Towel t = getTowel();
            t.dry(d);
        }
    }
    
    void washDishes(Dish[] dishes) {
        Sponge s = getSponge();
        for(Dish d : dishes) {
            s.wash(d);
        }
        Towel t = getTowel();
        for(Dish d in dishes) {
            t.dry(d);
        }
    
    }
Maybe, in practical terms, there would be differences in efficiency, but those are exactly the kinds of constant factors big Oh is meant to abstract, and for the purpose of example, both of these are O(n) given input size (number of dishes) of n.

I hesitated to post this comment, since it's kind of a "well, actually"[0], but unless I'm mistaken this example is fundamentally flawed.

[0] http://tirania.org/blog/archive/2011/Feb-17.html

spacemanaki··on Google blimps will carry wireless signal across Africa
Yep, I think it's photoshopped: http://www.flickr.com/photos/isafmedia/4995227882/
spacemanaki··on Python's sad, unimaginative Enum
Could you elaborate on this? I would agree with "Haskell is not an ML" but I think the MLs (SML, OCaml, Mythryl, F#) are close to Haskell, and closer to Haskell than to other programming languages, certainly closer than to Scala. Haskell is lazy, pure, and has typeclasses, while MLs are strict, impure, and (sometimes, usually) have modules, ... while there might be a lot of other differences, there are a lot of similarities too, between algebraic datatypes, Hindley-Milner, pattern matching, etc...
spacemanaki··on Hacker School User's Manual
> Do they mean that people actually pretend to be surprised about someone's lack of knowledge?

Yes, I think so, or at least the common reaction is usually over-dramatized. I've observed this behavior in friends, colleagues, and in myself. When learning about someone's lack of knowledge, it's very common for the other party to react with "Really?! You don't know xyz??" I think 99% of the time the person saying this is not actually surprised, and does not actually need confirmation by asking again "You don't know xyz??" It's just a social tic ends up being kind of exclusionary and negative.

> Just tell participants that they may encounter people from a variety of backgrounds, and they should not assume that every understands what everyone else is talking about.

This is fine and well, and I'm sure the people running HS would agree with this, but tbh it is a little obvious sounding. The thing with avoiding "feigning surprise" is that some people (like myself!) might not even realize that they do this. After I read about this rule of theirs last year, I've been trying to cut down and was a bit saddened to realize how much I do it.

It's a pretty similar attitude to this comic, in the sense of adding a twist to the more general form the rule that you proposed. Recognizing that this is a positive opportunity for sharing some neat factoid instead of an opportunity to put someone down is not obvious, unfortunately.

http://xkcd.com/105/

spacemanaki··on “What part of Milner-Hindley do you not understand?”
No, I haven't, but does it add more to ML than a bunch of syntax changes? It looks like an attempt to make ML more palatable to programmers familiar with C and Java. I skimmed the docs on that site and saw that it does have ML-style modules and functors, but does it also include something like typeclasses? I thought combining the two was still almost an open research question, although tbh I haven't slogged through this paper yet: http://www.cse.unsw.edu.au/~chak/papers/modules-classes.pdf

To be completely honest, I'm a little skeptical given that the first page in the "Mythryl for SML programmers" highlights adding special-cases to the front-end to support printf: http://www.mythryl.org/my-Mythryl_printf.html I don't really miss printf in SML, although if I wanted it I think I would rather reach for this kind of type hackery instead: http://mlton.org/Printf

spacemanaki··on Hurricane on Saturn
I don't think anyone's disputing that false color could be useful to scientists or that we should put cameras on satellites that capture true color images for the benefit of blog posts targeting the general public, and I certainly was not claiming anything like that, being horribly under-qualified. But waxing poetic about "the red rose of Saturn" is a little bit silly IMHO, but it's nothing worse than that...

http://www.ciclops.org/view_event/191/The_Red_Rose_Of_Saturn

spacemanaki··on Hurricane on Saturn
But here's a "natural-color" image of the same hurricane:

http://www.nasa.gov/mission_pages/cassini/multimedia/pia1494...

"Images with red, green and blue spectral filters were combined to create this natural-color view, which is what the human eye would see if we were there at Saturn."

spacemanaki··on “What part of Milner-Hindley do you not understand?”
The first edition of PLAI has a nice introductory chapter on types that explains this notation and has a whole section on type inference. It's also freely available online, so that's nice. (chapter 10 is on types) I haven't looked at the second edition at all yet, but the chapter on types looks like it has more code than math.

Benjamin Pierce's Types and Programming Languages seems to be the gold standard of intro type theory, and definitely covers this notation and the math behind it, in a much more rigorous fashion than PLAI. It is a much deeper book though, so it doesn't get to type inference and Hindley Milner until later. I've read some of it and haven't actually gotten this far yet, but can say that it is a superb textbook, it's very well written and easy for an amateur to follow, as long as you're relatively comfortable reading and writing proofs. (but you don't need more math than your standard undergrad discrete math course)

You might also want to look at Lambda the Ultimate's Getting Started page, which has a wide range of suggestions covering more than just types, but programming languages in general.

http://lambda-the-ultimate.org/node/492

http://www.cis.upenn.edu/~bcpierce/tapl/

http://cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04...

spacemanaki··on “What part of Milner-Hindley do you not understand?”
> It always seemed to me that people are actually drawn to Haskell's syntax.

Totally anecdotal, but this is really not the case for me. I have only dabbled in Haskell, and never really used it for a project from end-to-end, but have used Standard ML quite a bit in the last few months to write a lexical analyzer generator [0] and just recently spent a weekend and a half using OCaml.

There are a number of Haskell features and general design that I think are better than the MLs. While modules and functors are quite cool, I think typeclasses end up being more practical. Standard ML gets a lot of little things right that I think OCaml gets flat out wrong (mutable strings, throwing exceptions instead of returning 'a option), but Haskell seems to take it further, with a standard library that I can only describe as very tasteful. This is just my impression after reading half of Real World Haskell and doing a lot of dabbling but not a lot of real work, so I'm sure it's incomplete.

Haskell's syntax IS nicer than Standard ML's and OCaml's, but that is the least important thing IMHO. If there were an ML (strict, impure) with typeclasses and with as taseful design as Haskell at the edges, I would probably use that over Haskell, even if the syntax was ugly(ier). As it stands, I'm inclined to eventually switch to using Haskell, and just figure out how to deal with the other bits of it (laziness, purity), just so I can use typeclasses and the well-designed bits.

[0] In case you doubt how much ML I've written, the repo is on GitHub

spacemanaki··on RTFC is the New RTFM
> you just might be using crappy libraries.

Maybe, but sometimes you're stuck with crappy libraries or even crappy frameworks. The last time I had to really dig deep into (ie spend more than 30 mins reading) 3rd party code was when I was trying to figure out if a method in Android's WebView was synchronous or not. [0] Maybe the Android framework, or the WebView specifically is a "crappy library" (the documentation in this case was definitely crappy) but "not using WebView" or "not using Android" wasn't an option.

[0] http://stackoverflow.com/questions/10962150/understanding-an...

spacemanaki··on Netflix now bigger than HBO
I believe you're mistaken; the Time Warner that owns HBO is not affiliated with TWC anymore.
spacemanaki··on Why Maybe Is Better Than Null
> they tend to crash quickly and loudly

In some scenarios, this is a serious issue all by itself. My day-to-day work is mostly on Android, and eliminating nullable references altogether would eliminate some crashes, which are highly visible to the user.

spacemanaki··on The most useful thing in bash
I've recently been using shells inside Emacs exclusively and not even starting Terminal.app any more. I've got a couple of tips for anyone doing this, based on my (limited) experience:

1) Try eshell which allows you to use Emacs Lisp for shell scripting, as well as override some common programs to use Emacs instead (grep, man, etc). I'm someone who has never really bothered to learn shell scripting and am much more comfortable using Lisp, even Emacs Lisp which is sort of the crummiest of the popular Lisps (don't get me wrong I love Emacs) Obviously YMMV and if you know shell scripting this is a non-issue, but for me it comes down to being constantly surprised by the little bit of shell scripting I've had to do, and having Emacs Lisp work basically the way I expect (dynamic scoping, Lisp-2 and all)

2) Both eshell and M-x shell are not actually terminal emulators, so anything that requires a terminal emulator, like pagers, git log (ok this is a bad example since you should just be using magit, but anyway...) or some programs that update the terminal with their status act totally goofy and sometimes just break altogether. In this case, you want term-mode, which is a proper terminal emulator. Be sure to read up on the different modes as otherwise you'll get stuck inside that buffer ;) http://www.gnu.org/software/emacs/manual/html_node/emacs/Ter...

Hope this helps another Emacs novice... most of this I learned from here:

http://www.masteringemacs.org/articles/2010/11/01/running-sh...

spacemanaki··on Gitmo Is Killing Me
You know this for a fact? Not to be too cynical here, but do you have a citation for any of your claims? Who is able to review these taped feedings in order to confirm that they're being carried out in a humane way? Could I, as a citizen do this? Could a reporter for the NYT? The absurdity of the censorship at the KSM trial makes me think your claims would be hard to verify. http://www.newyorker.com/online/blogs/comment/2013/01/secrec...

And frankly, your nationalistic sign off makes me less inclined to believe you without references. "We are still the good guys" is kind of vapid.

spacemanaki··on ASM
That's funny, I always get confused and disappointed when hearing/reading people talk about "ML" only to realize they're talking about "machine learning" and not Milner's ML ... I hadn't thought there might be yet another overloaded definition.
spacemanaki··on A non-mathematical explanation of one way functions
A similar example was highlighted on BB the other day, with an interesting twist about cognitive bind-spots leading to security holes:

http://blog.tanyakhovanova.com/?p=277

http://www.schneier.com/blog/archives/2013/04/nice_security_...

spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
Good catch! I guess you'd have to take it to a lawyer to be sure... I wish that On The Media bit did a better job with citations.
spacemanaki··on Git tips to stop you getting fired
All right, I'll bite, I think it was a little condescending. I consider myself pretty proficient with Git, with maybe above average understanding of the internals and the porcelain. I use the command line for most git operations, but have ended up using `git gui` for a lot of simple and complicated commits, which almost always end up using `add --patch`. My workflow is something like:

  work on the code
  use git gui instead of add --patch on the command line
  use git stash -k on the command line
  run tests suite
Git gui lets you pick individual lines much easier than `add --patch` does, and I find that wanting to have that available at my fingertips means I use it for non--patch adds too. Maybe this is an indication of some other "flaw" in my workflow where I'm generating a lot of changes that I don't want to commit yet, but I think it's common and inevitable when working on legacy code or in maintenance-mode. But even for new projects I use this because I'm usually cleaning up my work via --patch.

Another nice alternative to `add --patch` is magit for Emacs which lets you select a region in a diff and add that. I find both of these (git gui and magit) to be much easier and faster to use than `add --patch` on the command line, which has a pretty clever interface given the limitations, but is really far from perfect (split often doesn't work with small hunks, which means you have to open it in an editor. which means Emacs, so I might as well just use magit)

I've tried to get colleagues to use a workflow like this, so they stop committing garbage like bad comments and logging.

In my experience and humble opinion, your generalization is often enough wrong that I would avoid it. I've met plenty of people who prefer GUIs for this or that task which they could script or shell circles around me. It really all boils down to taste and what you find to work for you. Git's command-line interface is badly enough designed that you shouldn't make anyone feel bad for using something different. (I say this as someone who loves Git very dearly)

That said, I DO believe that users who NEW to Git specifically should use the command line a bit while they are learning, since it helps with the vocabulary used everywhere to talk about Git, while some GUIs bury it behind a leaky abstraction.

spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
The N Carolina law mentioned appears not to have any reference to distribution: http://www.ncleg.net/Sessions/2013/Bills/Senate/PDF/S648v1.p...

However this law in Indiana does, http://www.in.gov/legislative/bills/2013/SB/SB0373.2.html

IANAL but this appears to make distribution of such recordings illegal:

  Makes it unlawful recording of agricultural or industrial
  operations, a Class A infraction, for a person, with intent to harass,
  defame, annoy, or harm, to: (1) enter real property that is owned by
  another person and on which agricultural operations or industrial
  operations are being conducted; (2) take a photograph of or make a
  video recording or motion picture of the real property, structures
  located on the real property, or the agricultural operations or
  industrial operations being conducted on the real property; and (3)
  distribute the photograph or recording; without the written consent of
  the owner of the real property or an authorized representative of the
  owner.
spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
Actually, I think some of the laws DO ban distributing the videos:

  Many of these bills are explicit about not just targeting the people
  who do the investigation but the people who distributed it, who
  republish it. For instance, there was an investigation a couple of
  years ago that at the same time the group, Mercy for Animals, was
  conducting the investigation ABC news was following along with it,
  aired the same footage, after they verified it, and it drew national
  attention to this and criminal charges. Under these bills, in North
  Carolina, for example, both the investigator and the journalist would
  be wrapped up together.
http://www.onthemedia.org/2013/mar/01/states-consider-so-cal...

I'm looking for more references now.

spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
Sorry, you're right, by "the norm" I meant that the majority of meat etc consumed comes from factory farms.

I agree with you that setting unreasonable or unrealistic goals is problematic. Although I personally stick to a 99% vegan diet, I've never been an abolitionist and I think setting reasonable goals and working towards them within the system is probably more productive, such as Temple Grandin's work.

Pushing for legislation like this doesn't make me very sympathetic towards the industry though.

spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
A few comments up thread pyre suggested that it is not possible to meet the demands of cheap, plentiful meat while providing animals reasonable quality of life. This seems to be born out by the fact the factory farms are the norm, and smaller farms like the one you mentioned are the exception (note that I'm specifically talking about in the US, where meat consumptions is ultra high, and from what I've read factory farms are the norm).
spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
You're right, I should have used the word "trimming" since "debeaking" is a bit loaded. I didn't know that it was still necessary or recommended for raising chickens in smaller operations, thanks for enlightening me.

I still think that most consumers of eggs (and meat, and milk) who have never seen a battery cage operation (or factory farm, CAFO, slaughterhouse, etc) would be surprised, if not horrified, and I suspect that this is the real motivation behind these laws and lobbying efforts.

spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
What does "large" in this case mean? Are we talking about factory farm style CAFO? What I've read, which may admittedly be outdated, is that these kinds of farms are where the majority of meat, dairy and eggs comes from (in the US).
spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
I just pasted this quote elsewhere in this thread but I'm going to paste it here again because it's so bold-faced.

  The videos may seem troubling to someone unfamiliar with farming, said
  Kelli Ludlum, the group’s director of Congressional relations, but
  they can be like seeing open-heart surgery for the first time.
  
  “They could be performing a perfect procedure, but you would consider
  it abhorrent that they were cutting a person open,” she said.
Some of the behavior filmed is standard operating procedures, and they don't want that viewed by the otherwise ignorant public.
spacemanaki··on Taping of Farm Cruelty Is Becoming the Crime
At least one of the practices mentioned, de-beaking [0], is nowhere near out of the ordinary at factory hatcheries. One of the quoted lobbyists even makes the point that some of the behavior recorded is the norm, not the exception:

  The videos may seem troubling to someone unfamiliar with farming, said
  Kelli Ludlum, the group’s director of Congressional relations, but
  they can be like seeing open-heart surgery for the first time.
  
  “They could be performing a perfect procedure, but you would consider
  it abhorrent that they were cutting a person open,” she said.
While some of the abuses may be unusual, I suspect the truth is that they would prefer no one tape the regular day-to-day goings on at factory farms either.

[0] http://en.wikipedia.org/wiki/Debeaking

spacemanaki··on Donating my Xbox
Agree with lloeki to some extent, but with a different game in mind: the Walking Dead. All of the action sequences are done with QTEs, but they are sprinkled through the game and are pretty varied in style. I think in the context of an otherwise slow-paced adventure game it works pretty well.
← PreviousPage 2 of 26Next →