okmjuhb's comments

okmjuhb | 15 years ago | on: C++0x (upcoming C++ standard, includes lambda functions)

To be more specific: the return type of the lambda can be omitted for a lambda whose body is just "return {expression}". The compiler could, if it wanted, always deduce the return type (since implementing type inference would be easy). The fact that it doesn't isn't to make it easy for compilers; it was a design decision of the language: having unspecified return types for complicated pieces of code hurts readability and maintainability.

okmjuhb | 15 years ago | on: Sharpie reinvents the pen with liquid pencil

I always do my first draft of any nontrivial large system by writing the code out longhand, after having heard it recommended by multiple people I respect. My perception is that the resulting code is cleaner and better documented, and that my error rate has dropped to almost 0.

Writing your code this way encourages a "write as you would speak" tone in the resulting code, better decomposition, and better documentation. It also means that each line gets reviewed from a fresh start at least twice before making it to the computer.

The biggest problem comes when you're working with a large API you don't know well; you're frequently forced to experiment with it in a manner that this sort of batching doesn't really handle well.

okmjuhb | 15 years ago | on: Ask HN: How would you store 5TB of data for 50 years, untouched?

Assume we encode the data on acid free paper with color-retaining ink using colored squares of size 1/64" x 1/64", using one of 64 colors in each square. There are then 4,096 of the squares in 1 square inch, so (assuming we print on 8"x10" regions) we can fit 327680 squares on a side of a sheet of paper, so that there are 655360 squares on a sheet of paper (if we use both sides). Each square encodes 6 bits of information, so we have 3932160 bits per piece of paper, or 491520 bytes, which is 480 KB.

At this rate, encoding a gigabyte requires 2,185 pages. As an aside, this is only 5 pages fewer than are contained in the "Art of Computer Programming" box set.

We can comfortably fit a gigabyte, then, on printed paper, in a 10"x12"x5" box. A terabyte will then fit comfortably in a 10'x10'x5' space. Throw a few of these together to get 5 terabytes. Let's add, say, 1 TB more of error correcting codes. In the unused margins of each page add in some information about alignment, a printing of all the colors used (to try to protect against inks changing color over time) and the page number. All together, this is certainly big, but could probably fit in, say, a tractor-trailer. Throw in some books describing the data format and the meaning of the data, and you're done.

okmjuhb | 15 years ago | on: Optimizing code for instruction cache

It's worth mentioning that they're writing for DSP systems. More mainstream CPUs have a larger instruction cache (and smarter eviction policies), but the size of the hot code paths are (I imagine; I'm not terribly familiar with DSP) likely not much bigger, so that the problems they mention need solving less frequently for typical applications.

okmjuhb | 15 years ago | on: Bill Gates: In Five Years The Best Education Will Come From The Web

A few loosely related thoughts as to why I'm fond of the University system (in response to the negative tone of some of the comments here and at techcrunch):

- It's the only socially acceptable way to spend years simply learning as a full time job.

- The argument that "lectures will soon be online" only makes sense if you believe that physically being present in lectures is the way that people gain knowledge in school.

- University admissions maintain a level of intelligence in incoming classes that I don't think an online community ever could - so that the students who interact at a university are interacting in a productive way.

- Physical colocation is just a better way of interacting with people than communicating online is.

okmjuhb | 15 years ago | on: College Grads, Here’s How to Become Millionaires

Measuring stock performance by looking at one of the biggest bubbles in recent years and comparing it to one of the biggest crashes in recent years is a little bit dishonest. Given that this article is writing to young people interested explaining how they should invest if they're interested in their financial situation 30 years from now, a 30-year outlook is more reasonable.

okmjuhb | 15 years ago | on: Why Do Employers Use FICO Scores?

In general I don't like the idea of credit checks before employment, but there's a few obvious cases where it's useful.

If I'm hiring an employee who will be handling cash, or who will control purchasing decisions, or who will have access to information my competitors want, it's important to me to know that my employee won't ever be in desperate enough financial circumstances that they feel compelled to steal or accept a bribe.

okmjuhb | 15 years ago | on: Richard Stallman answers Reddit's top 25 questions.

I wonder how many Hacker Newsers really remember what it was like back before the GPL and the FSF. The availability of a high-quality open source unix system is pretty much the defining quality of modern computing, and it took us out of the dark ages of a half dozen mutually incompatible proprietary OSs, compilers, and commandline utility packages (sometimes broken - with fixes impossible).

Stallman's contribution is much greater than that of cheerleader or discussion framer - the ecosystem that exists in large part because of him is, I suspect, tremendously important in the day to day lives of many of the people reading this.

okmjuhb | 15 years ago | on: Will it optimize?

const only means that the function is not allowed to change memory through that reference. It says nothing about aliases to the same memory.

But the "what if another thread changes the string" issue is a red herring. The question to keep in mind when optimizing in a multi-threaded context is "does the output of the compiler generated code correspond to at least one possible interleaving of threads". Since this thread doesn't do any synchronization, it's possible that all the function executes without being interrupted by another thread, so this is a sound optimization.

okmjuhb | 15 years ago | on: a² + b² = c²

Another cute way that's more obviously correct without translations is to consider a square with sides of length a+b. You get an interior square of area c^2 and 4 right triangles with legs of size a and b.

okmjuhb | 15 years ago | on: Want speed? Pass by value.

This is totally wrong; the examples rely on compilers doing copy elision together with return value optimization so that the copy becomes unnecessary (even if a copy is expensive, it's fine - it never needs to happen). They do not use copy on write containers (indeed, they return modified versions of input variables).

okmjuhb | 15 years ago | on: The Velluvial Matrix

One such system was Pathfinder, which (I believe) used a relatively simple Bayes net to diagnose within certain categories of disease.

It was able to outperform pathologists in the area it was designed for because (or so I've been told) it didn't face the cognitive biases that human doctors have (like the inability to reason with probabilities, the accessibility bias, etc).

okmjuhb | 16 years ago | on: What do Bill Gates and Richard Stallman have in common ?

Math 55 isn't nice because of how much math it covers (you could take equivalent classes that cover the same material, just split up, at the same or higher level). It's nice because of the bonds it forges between the students, who are usually the top mathematical talent at Harvard. I'd suspect that it's these bonds that help the students throughout the rest of their mathematics education rather than their incoming ability or what the class teaches.

If you look at the problem sets, they're very hard (especially given that the students are all freshmen - a few of whom haven't ever done advanced mathematics before), but not unreasonably so (not really even beyond the top math majors of most top schools, I'd wager). Having made friends in a trial by fire like the 55 a/b series though, is a key to surviving later ones.

okmjuhb | 16 years ago | on: Three-dimensional literals in C++

I like to think that, like how the "Book of Life" is interpreted in Christian Symbology, where the list of good and bad deeds of a persons life has been recorded for a later judgment, there's a "Book of Time" where, at some point, you have to account for all the bizarre, time-consuming activities that at one point in your life, you decided were worthwhile.

This person will have a lot to answer for one day.

okmjuhb | 16 years ago | on: The Just-World Fallacy

The just world fallacy isn't bad because of how it changes your motivation or happiness or anything like that. It's bad because of how it causes you to act towards those around you.

People don't respond to homelessness when they've convinced themselves that homeless people deserve it. "the world sucking is no reason for you to change your attitude one way or the other" is of course absurd. If the world sucks, there's a reason to change it.

okmjuhb | 16 years ago | on: Ending the Era of Patronizing Language Design

This article has so much crazy that I almost don't know how to respond to it.

C++ coddles programmers and Ruby doesn't. Really? That sounds like a sensible thing to say?

C++ avoided reflection because it would be misused by programmers? Only a profound misunderstanding of the design goals of C++, or having never actually used it, could inspire such a claim.

ActiveRecord is a Rails innovation that took decades to realize? What? Why would you think this?

page 2