HNHacker News
TopNewBestAskShowJobs

kcl

878 karma · joined July 8, 2007

k.concerns@gmail.com
submissionscomments
kcl··on ~/.osx updated — sensible hacker defaults for OS X Mountain Lion
I wouldn't run the whole script blindly. You will have to do more than one linear pass through the script to find and invert settings you later discover you don't like.

I recommend one close readthrough, uncommenting or commenting things you do or don't like, and then a full run. I do recommend running the script after a careful edit. It will save you time.

kcl··on Senators want to block Facebook’s Saverin from reentering the U.S
You cannot use legality as a defense for two reasons:

1. By renouncing your citizenship you put yourself in an extra-legal position.

2. The laws are perceived as underdeveloped. That's why the situation has attracted the attention of US senators.

kcl··on Can You Call a 9-Year-Old a Psychopath?
It's easy to examine the situation by flipping it around.

Suppose the research centered on people who care too much. And the implicit assumption is that people who care too much cause problems, because they make suboptimal decisions for the group. Should we begin to stigmatize these people? Was Mother Theresa psychologically defective? Is your overly caring boss causing problems in the workplace because he won't fire the underperformer nobody likes? What should be done about this endemic problem of overly caring bosses? How can we begin to classify and nullify these people?

In both cases the behavior is nightmarish. Here in stark relief for one kind of bias.

kcl··on Can You Call a 9-Year-Old a Psychopath?
I see a danger here. It isn't with this child and his problems, but with the continued progress of the media and other political groups in co-opting psychological diagnoses for their own ends. The terms "psychopath" and "sociopath" are already bywords for "doesn't share my politics or worldview". You can see this clearly in the article and the comments. The article mentions "financiers and business people", and the first comment covers explicitly naming the opposing political party. In fact, how many articles from the last few years manage to bring up the subject without casually slipping in a reference to businessmen? I am guessing not many.

The problem is made worse by the highly subjective nature of psychiatry. When practiced in good faith, it seems to be beneficial for some people. Of course, as a science, it is particularly soft. It has a long history of shifting its positions, and a long history of debunked and discredited bodies of theory. (Why do we continue to teach Freud and Jung in college English departments?) Psychology is the sort of thing that works only when you can trust the person employing it, and sometimes not even then.

I am not a psychologist, I am more of a computer scientist. Using leeway in statistics and figures, I can show you any result I want to. For instance, I could present a compelling argument that Facebook will expand extraordinarily over the next decade. I could also present an argument damning the possibility of Facebook expanding at all. Don't you think that, with a few weeks of study, I could apply any subset of mental disorders from the DSM-IV to any person I wished?

Would you trust a court-ordered psychologist to make an accurate appraisal of your psyche? I don't know that such an appraisal is even possible. And I am worried about the increasing confidence in these sorts of appraisals. It sounds like, very soon, anyone interested in furthering American business aims will be suspect for mental disorders. The pretext is already here in America's paper of record. How long before this movement grows to having real influence in our judicial system?

When Tom Cruise begins to sound more sane than the psychology he criticizes, you know something is wrong.

kcl··on Just say No to brainteaser questions at interviews
Kaspar Hauser, the now-educated feral child, answers the professor's questions:

http://www.youtube.com/watch?v=C9uqPeIYMik

kcl··on Who Killed Men's Hats? Think Of A Three Letter Word Beginning With 'I'
It does sound like a just-so story. Whether it is or not I couldn't say. Military thinking is often so complex that it can be hard to derive the rationale behind any particular practice, if indeed there is one. All military edicts are the result of conscious decisions, but the hard part is in determining why that decision was made. Was it arbitrary, was it for a conscious reason, or was it seemingly arbitrary but actually the result of far-reaching, emergent military understanding? I can think of several military practices which seem inane and even internally self-contradictory which are most likely preserved by a large-scale probabilistic understanding of their effects. Sometimes bureaucracy is smarter than individual people.

It is dubious, but I wouldn't absolutely rule out the hat edict as having a purpose. Remembering to wear something on your head is definitely an acquirable muscle memory.

> like the part where if you're walking with someone, the senior ranking person is on the right hand side--what, do you get shot at more often from the left hand side?

This example, on the other hand, probably is the result of conscious, practical decision making. You are better positioned with your sword arm free. It seems reasonable that the senior ranking person would insist on walking on the side that allowed them to have their sword arm (pistol arm) free in case of attack.

You can build a ramp around a tower in two ways. One direction puts your right hand on the side open to the air. The other pins it against the tower wall. Towers were built so that the direction of the ramps encircling them allowed defenders at the top to have their sword arms free to the open air. Attackers coming up with the ramp would have their sword arms inhibited by the face of the tower. You can verify this by inspecting the construction of the towers.

kcl··on Groupon Kidz Club
It's a conscious take on the Burger King Kids Club.

https://www.google.com/search?q=burger%20king%20kids%20club&...

Compare the logo and the character design.

kcl··on Microsoft apologizes over 'Smoked by Windows Phone' controversy
Yelp has a policy that bars reviews written on mobile devices. This is done to protect the quality of the reviews.

You can't submit reviews from an iPhone either. The functionality doesn't exist.

kcl··on The 17x17 problem solved
Wrote this up in response to the renewed attention to the problem:

17x17 is NP-Complete: http://hackerne.ws/item?id=3584732

kcl··on Why are column oriented databases so much faster than row oriented databases?
Column-oriented databases are faster because computers are built for arrays and not rows. It is a lot easier to pass through a simple column in memory or read a simple column from the disk. The pass through the memory benefits from all the caching functionality on the chip, and the pass through the disk benefits from the arm not having to bounce around. Essentially you move at the maximum speed allowed by the equipment. Row-based storage defeats all that.

Indexing is also improved with a column store. If you have a row-based storage mechanism, particularly one with variably sized entries, you're going to need a more complicated indexing scheme.

kcl··on Damn Cool Algorithms: Fountain Codes
It wasn't immediately clear to me the ideal soliton distribution always summed to one. There is a simple proof by induction. I wrote it up here: http://kevinlawler.com/soliton
kcl··on Ways To Go Viral
The formula is given without explanation. You can rederive it without too much trouble.

You can't use the common formula for compound interest because users are assumed to send invites only once. Compound interest would assume they were sending invites continuously over the cycles.

If you look at the number of users added each cycle (the top row) you can see that it doubles each time. It's given by c0 times K^i, where c0 is the initial number of customers, K is the virality coefficient (2 in this case), and i is the i-th cycle.

Adding each of the terms up to i to the original c0 gives the total number of customers after i cycles. So you get a sum:

  sum over i from 0 to N of (c0 * K^i)
which using an exponential sum formula (http://mathworld.wolfram.com/ExponentialSumFormulas.html) gives:

  c0 * ((1-K^(N+1)) / (1 - K))
Multiply by -1/-1

  c0 * ((K^(N+1) - 1) / (K - 1))
and N is the number of cycles (given by t/ct in the slides)

  c0 * ((K^(t/ct+1) - 1) / (K - 1))
kcl··on Basic theory of expander graphs
This looks like it's from a special topics course Terry is teaching at UCLA:

http://www.math.ucla.edu/~tao/254b.1.12w/

The course description says the course assumes a familiarity with graduate-level mathematics.

These notes in particular look more accessible than that to me, provided you are willing to stop and research definitions.

This is an especially good find for several reasons. Terry's explanations are excellent, he rarely writes at an introductory level, and expander graphs are quickly becoming a central topic in math and computer science.

kcl··on HTML + CSS3 is Turing complete
Our field is founded on the idea that mechanical computation is preferred to human computation.
kcl··on HTML + CSS3 is Turing complete
There are two competing definitions of Turing complete here.

1. The mathematical definition of Turing completeness: models which can simulate the computation of a hypothetical Turing machine. Idealized circuits are an example of this. Turing machines are an example of this. Programs with infinite memory are an example of this.

2. The colloquial definition of Turing completeness: this is naturally ill-defined, but it roughly means an automated, finite model that performs arbitrary computation. I would say that a robotic Lego Turing machine is Turing complete. C is certainly Turing complete in this sense. Basic HTML isn't. The set of regexes (e.g, unix wildcards) isn't.

However, if I can choose a large enough regex, I can construct a decider for a given finite language. How then are regexes less powerful than C? The answer is they are just as powerful in the finite case, unless we set reasonable limits on what we mean by 'finite' and 'automated.'

This HTML+CSS is not Turing complete. The idealized version of this HTML+CSS is not Turing complete (unless you strangely accept the idealization of a "hand pressing tab space"). This HTML+CSS is also not Turing complete in the colloquial sense: it doesn't live up to the generally accepted notion of automation. It isn't executed by the machine.

kcl··on Get your own #dickbar
In 2010 I wanted an iPhone Twitter client with a nice UI and no ads, so I paid $2.99 for Tweetie 2. This was after I bought Tweetie 1 for $2.99. Tweetie 2 wasn't a free upgrade.

In 2011, after acquiring Tweetie 2 and making it free, Twitter adds paid advertisements and wrecks the UI.

kcl··on J Source to be released under GPL
> it's a clean re-implementation ... not an open-sourced version of "real" K

Thanks, I didn't realize there was an ambiguity here. I've updated the GitHub page to be clearer on this point.

kcl··on Names and Signs for Logical Lonnectives
It's a bad idea to use mirroring and rotation when creating glyphs. The reason is that it ties the correct interpretation of a string to its position and orientation in space. Generally we want meaning to be absolute. The meaning of a string shouldn't change depending on your position relative to it: if you fire a Latin 'b' into space, it's impossible to tell whether you meant 'b','q','p', or 'd'. The problem is worse with the alphabet in the article.

In case you were wondering, the symmetry of the shapes does not allow any interesting logical operations to be performed by reorienting the string in space, except as it happens by accident.

kcl··on About the origins of the equals sign
An excellent article. Full of things I haven't seen.

I will second his recommendation to read original works. They aren't always the best, but in many instances they can teach you a lot more than just the topic at hand. If you have your grammar school science textbooks at one end of the spectrum---nth hand knowledge echoed by an author with no understanding of the subject---then original works are at the opposite end---the idea in its first appearance, recorded by someone with the power necessary to understand and discover it for the first time. The advantage isn't only in that the author takes great pains to present his new discovery, it's in the countless unrepeatable ways he presents it dictated by the climate of his time. Just like there will never be another 17th century Italy to produce those particular violins, there will never be another Victorian Era to produce On the Origin of Species, in the way it was originally written. You can rewrite and distill the idea, but you can't recapture all the implications that originally flowed from it. Reinterpretations strip an idea of its historical context, and frequently these are as important as the idea itself.

kcl··on Inspired by Popcorn
impromptu Seth Godin blog:

Business ideas are like ice cubes in a tray. You have a lot of different slots, you pour water into each one, and then you put it away in the freezer. A little while later you come back, and some of the ice cubes are frozen all the way through. Some are still full of water. You get both kinds of cubes. The real trick is telling the difference between them. On the surface they both look like fully frozen ice cubes. But the improperly frozen ones have bubbles that move, and the fully frozen ones have bubbles that stay still. You can't tell just by looking at them. The only way to tell the difference is to shake the tray.

Shake the tray. Find the fully frozen cubes.

kcl··on K as a Prototyping Language
>Why should I learn this language that I've never heard of if it can't even do math in any sensible way? Not left-to-right, not order of operations, not lisp-like prefix. Who thought that was a good idea?

Of the three choices you mention only one makes sense as an alternative: left-to-right instead of right-to-left.

Order of operations, as it turns out, has nothing at all to do with real computation (in the same way that pi really should have been defined as 2pi). Most educated people, after a moment of reflection, should agree with this statement. Getting rid of order of operations makes the parsing process simpler, both for the compiler and for your head. If order of operations wasn't so ingrained in your head there would be no reason at all to use it. K makes a lot of design decisions like these: doing what's right at the expense of what's common.

I'm not sure where order of operations came from, probably as a nicety for mathematicians dealing with complicated polynomials, but when computers came about it must've been clear that it was the wrong way to do things.

Here's a code snippet that makes order of operations look just as silly:

  a*b+c%d%e+f*g^h*i*j*k-l / ugly with order of operations, hidden levels of complexity
Lisp prefix form, from a mathematical point of view, certainly makes more sense than order of operations. The reason it isn't used in K is, for one, K is inline, and two, Lisp syntax demands a lot more written code than K, and this goes against the philosophy of K. K wants to create the shortest programs in the shortest amount of time.

For example, something that is perfectly natural in K

  2+7%3*2+5 / k, 9 characters - 1 level deep
looks ridiculous in Lisp

  (+ 2 (% 7 (* 3 (+ 2 5))))
  ;Lisp, 25 characters - 8 spaces, 8 parentheses, 4 levels deep
  ;Two parentheses and one level of nesting for each operation
for the reason that Lisp is not as rabid about brevity as K is. (And how could it be. K is a much newer language.)

This leaves left-to-right evaluation. One argument against left-to-right evaluation is the following code:

  f g
where f is any function. For instance

   g:3
   f:{1+x}
 
   f f g 
  5
and so on. But this presumes that you accept two axioms (1. you should read left-to-right as in English 2. functions should precede operands). I am currently of the opinion that left-to-right evaluation is better given a left-to-right read order

  g f f / 5, fictional example
because I've yet to discover sound reasoning why mathematicians believe the function should precede the operand. (The answer may be that there isn't a reason, and mathematicians did it that way only because they never cared enough to pay close attention to syntax. Or perhaps it's because written mathematics "executes" in English, and not in an interpreter.)

The language designer has defended right-to-left evaluation with the following statements. "Why right-to-left?"

  so that it reads left to right.
  note k executes left of right, e.g. syracuse operation: 1+3*
  the basic math notation is:
  f g h x
  executes right to left but reads
  f of g of h of x
I remain unconvinced, especially since there are benefits to left-to-right execution (presuming left-to-right read order) including on-the-fly processing. It just seems more natural to me, mathematically, though I admit it would be very unnatural for me to write in such a way.

K is a beautiful language with a lot of nice features. Anything truly innovative is going to look new and different, and in K you get the statement

  3*2+5 / yields 21
There are a lot of unusual looking things in K. There are also lots of very powerful ones. But these won't reveal themselves until you spend a time looking at the language. So my suggestion is if you are intrigued by the powerful stuff, keep looking, and don't be turned off by the strangeness of the simple stuff. In some cases you may find that your opinion changes on how things should be done. There is a lot of wisdom hidden in K.
kcl··on Python insights

  q)10+1 2 3
  11 12 13
kcl··on A fun modern way to trade: math trades
>I think calculating the optimal trade is a NP complete problem. Haven't checked this now, though

If you define the optimal trade as the trade involving as many people as possible, then the problem is NP-complete (it solves DIRECTED HAMILTONIAN CIRCUIT). There are good heuristics for solving this problem, though, so in most cases it won't matter.

kcl··on "Kulveer Taggar says he expected to wait a little longer before becoming a millionaire."
I've not been in the paper myself, but many of my friends have, and the first thing they always point out is how badly the paper misquoted them.

I always expected the things I read in quotation marks to be quotations, and it was surprising to find out that's rarely the case. A journalist's idea of quotation is actually to take the gist of what you said, put it in new words, and then put it back in your mouth.

kcl··on Ask YC: what's the best way to model a threaded comment system like YC?
It's best to keep things in-memory if you can.

Since you mention MySQL I assume that's what you're using to persist data. Storing a tree in a flat database is kind of a challenge. This page (http://www.sitepoint.com/article/hierarchical-data-database) suggests two ways: adjacency lists, and modified preorder tree traversal. MPOTT is a cute idea, but that's about it. It will make your database schema more complex, make your algorithms more complex, and require preexisting entries to be changed when new ones arrive. It's not faster than doing things in memory, and it's just asking for trouble.

Try using adjacency lists and reconstructing the tree in memory each time you serve it. This will let you get away with a single query for both reading and writing. The dev.mysql.com link you mention warns against using the adjacency list model, but that's because it's an area where MySQL itself is inadequate. It's fine when you fix things in another language.

Here's a minimal schema:

topic, id, parent, payload

ID is unique and non-zero. Parent is the ID of the parent node (0 if top-level). Topic is shared by all comments in a given topic. When you select, select by topic and then recreate your tree by going through and reestablishing "children" lists for each of your parents. You can then use traditional tree algorithms.

This method is easily modified to support caching.

kcl··on Poll: Do we need a downvote button or is that insane ?
A downarrow doesn't have to work in the exact opposite way as the uparrow. In the trivial case the downarrow would do nothing, and then site wouldn't change at all, except cosmetically. In the more generalized case you would:

-weight it versus upvotes

-weight it based on user history

-weight it based on user's propensity to downvote

-weight it based on the number of distinct "user clusters" it offends

(If one group always votes for butter-side up stories, and another always votes for butter-side down stories, and a story annoys both of them, chances improve that the story is worth voting down.)

Another interesting metric might be contentiousness. If a topic generates an outlying number of downvotes from trustworthy users, and an insignificant number of upvotes (or many upvotes from unpopular users), its participants can be labeled as positive or negative forces. Someone who posts articles that generate a lot of downvoting in the comments might not be picking the best topics. There's probably a nice linear algebra way to generalize this in the same vein as PageRank.

A closed-source, nearly-null downarrow would at least give pessimistic users the feeling that their voice was being heard. (Heuristics is one area where it makes sense to keep things closed-source. Changes should be explained, but not necessarily in exacting detail.)

kcl··on The great digital certificate ripoff?
Thanks to the author for taking the time to write this up.

We recently had to buy a digital certificate ($99), and it felt very much like a digital mugging. In a year it reverts to $499. You can get a nearly identical SSL certificate for less than $10.

The situation is an example of everything that can go wrong when ethics evaporates from business. Not to mention, the approval process is hostile to startups (corporate letterhead? fax machine?).

"Opening an unapproved browser on Windows Vista now results in multiple warning dialogs and a bright red security notice---unless the unsupported browser pays us millions to audit their program."

kcl··on (1..100).inject(&:+)
'/' in this case is the adverb 'over'. When applied to a function it causes that function to fold over a list. This is the same as inject as far as I know.

You are correct in supposing that !n generates an array of integers from 0 to n-1. It is somewhat of an unusual choice for a symbol. I've always thought of it as a factorial 'on the other side'. I don't know if that's what was intended. The k language compresses many old APL functions into symbols like this. Some make sense, some make less sense. You are after all dependent on your keyboard for the range of symbols you can type. In APL the same function was indicated by a lowercase Greek iota.

'+' is being used in two different ways. The first way shows it being used in conjunction with an adverb, so '+/' is like a one-argument function that gets applied to the list at the right, but then '+' is inserted between each of the elements of the list because of '/'.

'\' is a very similar adverb. It's called 'scan', and it's like 'over', except intermediate output is produced. It can help illustrate what's going on.

    !100
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ..
    +/!100
  4950
    +\!100
  0 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276..
In the second case, '+' is being used as an infix operator, taking two arguments, 1 and !100, so '+' adds 1 to each element in the list 0 to 99, inclusive. This is simply what happens when you add an atom to a list. Each element in the list gets incremented by the value of the atom. Most verbs in k are like this, in that they do what you want, or maybe, they do what they should do if your preference is for something to occur rather than for an error to be thrown.

    5 + 0 1 2
  5 6 7
    5 + !3
  5 6 7
    1 2 3 + 4 5 6
  5 7 9
    1 2  + 4 5 6
  'length (an error)
kcl··on (1..100).inject(&:+)
The same code in k:

    +/!100
  4950
Or if you insist on 1-indexing:

    +/1+!100
  5050
kcl··on Automatic writing
The idea is genius, the act itself, when it isn't explained to the consumer, is completely immoral.

I'm reminded of the "Your Family's Geneaology Book", where "Your Family" is replaced with your last name. For instance, "The Smith's Geneaology Book". The books, which aren't cheap, are full of generic content about cultures and countries. Inserted in the middle is perhaps a page of surname-relevant scholarship. One of my uncles with a different last name has one, and his didn't come with any surname specific material at all: just a printout in the back of people in the US sharing his name.

They've been selling these since before the internet was around, and as a kid they were my first introduction to this type of content-free marketing.

← PreviousPage 3 of 5Next →