HNHacker News
TopNewBestAskShowJobs

cachemoney

192 karma · joined January 26, 2011

submissionscomments
cachemoney··on Microsoft’s Augmented Reality 3D HoloDesk Lets You Play With Balls In Real Time
Who writes these titles?
cachemoney··on LtU on Dart
An alternative is an option type. In scala, you have the abstract type Option[T], which has implementations Some[T](value: T) and None[T].

Alternately, you have Either[A, B], with implementations Left[A](value: A), and Right[B](value: B).

So you can define a function that takes an Either[Int, ErrorMessage], rather than an Int or null. Getting a None[Int] is better than null, because it won't throw NullPointerExceptions if you access it sensibly.

Examples:

    def x2or0(i: Option[Int]): Int = i.getOrElse(0) * 2

    def x2(i: Option[Int]): Option[Int] = i.map(_ * 2)

    def x2danger(iOrPossiblyNull: Int) = i * 2
    // throws NullPointerException on null input
cachemoney··on Team Fortress 2 in WebGL
> That said, how can that old game be more fun that TF2?

EMP Grenades.

cachemoney··on Scala school
Actors had a memory leak when a lot of the formative Twitter Scala stuff happened. This lead to more usage of java concurrency primitives, which snowballed within the culture.

There's some people at Twitter who truly love and grok Scala and Scala idioms inside out, and there's some people who look at Scala as a more functional, less verbose Java.

cachemoney··on Scala is for drivers
"It's as expressive as Ruby, but runs much faster and is easier to refactor."
cachemoney··on Yes, Virginia, Scala is hard
This whole thing is a bit disingenuous, because the type signature argued over is an alternate signature which no one uses, because it provides custom concatenation of Traversables. All of the provided collections have reasonable implementations of concatenation, so this implies you're inventing your own collection.

Everyone uses the alternate form: flatMap [B] (f: (A) ⇒ Traversable[B]): CC[B]. Nevertheless, I'll attempt to explain the provided signature.

If you understand Java generics, you should hopefully be able to understand this response.

A, B, and That are type parameters/generics. So they can be filled in by any type. This flatMap method exists on a trait (think Java Interface) called Traversable[A]. Traversable is similar to Iterable in java.

(f: (A) ⇒ Traversable[B]) means that this function takes one argument called f. That argument is a closure or anonymous function. The closure itself takes one argument of type A (an element in the parent Traversable[A]), and returns a Traversable[B], where B is an arbitrary type.

Skipping ahead, flatMap returns an instance of That. But what's a That? It appears to be unspecified. This is where the "(implicit bf: CanBuildFrom[List[A], B, That])" makes it's appearance.

Implicit parameters are like default arguments. "def foo(i: Int = 12)" will use the i if provided, else it will default to 12. "def foo(implicit i: Int)" will take the i given, else it will grab the first available Int in the containing scope. If you, "val c = 11; def foo(implicit i: Int) = i * 2", calling foo(1) yields 2, but calling foo() yields 22.

The object bf is an object that provides an overridable custom definition of concatenation. So when you write your custom collection, you include an instance of CanBuildFrom[List[A], B, That] in the correct scope, and it gets used for the concatenation. CanBuildFrom's type parameters say that it exists in a List[A], takes a B, and returns a That.

So yeah, in your implementation of bf, you could make it a new MyCanBuildFrom[List[A], B, FunkyCollection[B]], and do funky concatenation.

Hope that helps.

cachemoney··on Now that people are considering NOSQL will more people consider no-DB
I spent about a year as a maintainer of FlockDB, Twitter's social graph store. If you don't know, it's basically a sharded MySQL setup. One of the key pain points was optimizing the row lock over the follower count. Whenever a Charlie Sheen joins, or someone tries to follow spam us, one particular row would get blasted with concurrent updates.

Doing this in-memory in java via someAtomicLong.incrementAndGet() sounds appealing.

cachemoney··on Twitter Bootstrap
Many internal tools use it.
cachemoney··on 9.2% Unemployment? Blame Microsoft.
The economy could certainly find use for them, but perhaps not at a price above minimum wage.
cachemoney··on IOS Integration Testing by Square
Indeed. I have over a hundred repos, and I'm useless ;)
cachemoney··on Nevada passes law authorizing driverless cars
People are afraid of planes because if the power goes out, you die. On the ground, if the power goes out on your driverless car, you cruise to a stop.
cachemoney··on The New Heroku, Part 1 of 4: The Process Model & Procfile
You can't run a Solr server because (1) present limits are 300MB RAM hard, and (2) disk is transient. There's a solr addon though.
cachemoney··on Why All The Daily Deal Hate?
It drives pageviews?
cachemoney··on File First, Invent Later?
If two people independently invent something at about the same time, does that mean it's obvious to someone skilled in the art?

In those scenarios, I'd like to see both patents thrown out.

cachemoney··on Justin.tv launches TwitchTV: A destination site for eSports
Also, I don't know if I really want to hear about Enya from Bakersfield any more. Please do something about ad fatigue and/or inventory.
cachemoney··on Why RubyGems Needs Loren Segal
Ironically, the guys who maintain rubygems also wrote http://rubyhitsquad.com/, in which they vocally slam another mainstream Ruby project.
cachemoney··on 1 in 5 APIs Say “Bye XML” - JSON gaining ground
Quit trolling, that's a technicality.
cachemoney··on Antifuse, the opposite of a fuse
Somehow, the comment threads get flooded instead.
cachemoney··on I'm 16, and need advice
This advice is potentially terrible for many/most people.

> Skip college, you can always go back.

It's much harder to get into and succeed in college later in life. You'll also be a bad fit for the college social scene, which is where many people make lifetime friends and connections.

> If you MUST go to college, DO NOT, I repeat, DO NOT get a CS degree. Go for finance, or liberal arts, even bio or chem, or some course of study where the instructors have a clue and have actually done something in that field.

I think this reveals bias from the poster.

My opinion is that you should at least start college. If you shouldn't be there, you can drop out. Find a mentor that seems to be a good fit for you. It could be a prof, a local startup founder, whatever. Make plans ahead of time (e.g. contact profs ahead of time and/or choose the university based on faculty) to secure that mentorship.

cachemoney··on Show HN: my weekend project, Gumroad
Why be jealous? He has no traction. Copy it and do it slightly better.
cachemoney··on Announcing Heroku for Logo... powered by Heroku
Too bad it doesn't work.
cachemoney··on Logs Are Streams, Not Files
You can log to mongodb capped collections. You get a semi-structured ring buffer with fast writes. I'm not a huge mongo fanboi, but this is one situation I've seen it excel in.
cachemoney··on [dead]
http://dictionary.reference.com/browse/irony

5. an outcome of events contrary to what was, or might have been, expected.

6. the incongruity of this.

Seems fine to me.

cachemoney··on [dead]
Love the irony: http://news.ycombinator.com/item?id=2303854
cachemoney··on [dead]
Can't be a religion without a good ol'fashioned resurrection.
cachemoney··on GitHub now has view modes for image diffs.
This idea is going into OS X Lion as "Versions"

http://www.apple.com/macosx/lion/

cachemoney··on "Amazon's EBSs are a barrel of laughs in terms of performance and reliability"
I run a database cluster with dozens of nodes on EC2. Small entries, lots of small IOPS.

From http://orion.heroku.com/past/2009/7/29/io_performance_on_ebs..., "On a good day, an EBS can give you 7,000 seeks per second and on a not so good day will give you only 200."

The ephemeral store will never give you more than a hundred seeks per second. If you're seek-bound, then EBS, every time.

cachemoney··on "Amazon's EBSs are a barrel of laughs in terms of performance and reliability"
EBS-RAID0 is much faster for reads than local. Local is faster for writes.
cachemoney··on In-N-Out Secret Menu Survival Guide
Just because you put the word "Hacking" in the title, doesn't mean there's actual hacking involved. Flagged.
cachemoney··on Tuple Spaces (or, Good Ideas Don’t Always Win)
I tried it in Ruby in ~2006, and found that many operations in Rinda were O(n) in the size of the tuple space :(
Page 1 of 2Next →