HNHacker News
TopNewBestAskShowJobs

godd2

123 karma · joined March 4, 2014

submissionscomments
godd2··on A Mathematician's Secret: We're Not All Geniuses
Mathematicians aren't forced to take IQ tests. This could cause self-selection bias.
godd2··on Linux utils that you might not know
100000000000000000000000000000000000000

== 10 ^ 38

== (2 * 5) ^ 38

== 2 ^ 38 * 5 ^ 38

== 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5

Are 2 and 5 not prime?

godd2··on Linux utils that you might not know
'cd -' only saves one previous directory, which is held in $OLDPWD. pushd can store an arbitrary history in its stack. And of course, $OLDPWD will change if you hop around after a cd, but the pushd/popd stack will persist.
godd2··on The Ruby Module Builder Pattern
The drawings are reminiscent of the diagrams in Metaprogramming Ruby, which is definitely worth the read if you want to dig into it.

It's much easier to read than you might think.

godd2··on Abstract Algebra (2016) [pdf]
That's why I always call it partition sort instead of quicksort.
godd2··on What does it take to be a good programmer?
"Unit" is not well-defined. However, it usually means a function/method. Being a unit test also implies some explicit setup for when that function is used.

The easiest examples of unit tests are math functions, since they're so well-behaved.

Here is a square root function in Javascript:

    function sqrt(n) {
      guess = n/2;
      while(Math.abs(guess*guess - n) < 0.00001) {
        guess = (guess + n/guess)/2;
      }
      return n;
    }

    assert_equals(4.0, sqrt(16));
There is nothing to set up because this code doesn't depend on a database, or an HTML input field, or the phase of the moon.

The call to assert_equals there is a unit test. (Also, keep in mind that assert_equals is a glorified if statement)

"well, what isn't a unit test??"

Since we can call anything we want a unit, the answer is "whenever we say we aren't doing a unit test". But a more practical answer is: whenever you're testing the interaction between two or more units (where a unit is a function/method).

If you're making a video game, you might have enemies who can jump, and guns that can fire. It would be a unit test to check if enemies jump correctly, and it would be a unit test to see if guns fire correctly. It wouldn't be a unit test to see if guns fire correctly from a jumping enemy, since this is the combination of two pieces.

Another way to (sort of) define a unit test is to say "how does this behave assuming that the rest of the system is correct"? That is, we aim to check the behavior of our code in isolation from the rest of the system.

This is important when something is wrong, because if we know what is behaving correctly, we don't have to waste time checking if it's the cause.

godd2··on Ask HN: How much do you earn on average through software freelancing?
If there are any programming/tech meetups in your area, go to them! Ask around for any work that needs to be done. Draft a quick talk on something you've worked on recently, and give it. Networking is a very powerful tool.
godd2··on Buttery Smooth Emacs
You say "smooth cursor movement". Can you elaborate? What exactly is "slow"? When the screen is scrolling? When the cursor is moving? Spacebar will move the cursor one character forward in normal mode, and follow newlines. If it is the cursor, is it just as choppy if you hold the spacebar?
godd2··on Buttery Smooth Emacs
What plugins do you have installed?

If you run `vim -u NONE` and then open a file, is it still slow when you hold j?

godd2··on Seattle: Highest Minimum Wage, Lowest Unemployment Rate
> It will stimulate the economy to promote more jobs.

It will increase the cost of labor, and result in fewer, more expensive goods and services.

We can both claim things all day.

godd2··on Seattle: Highest Minimum Wage, Lowest Unemployment Rate
> If some job needs to be done it will be paid.

The opportunity cost of a service is the limit for which one would be expected to pay for it. If forced to pay $1,000,000 to have someone clean your bathroom, you'd end up cleaning it yourself.

godd2··on Seattle: Highest Minimum Wage, Lowest Unemployment Rate
> I'd try to reason with you, but it seems we're not in the same world anyway.

Claiming that I'm too unreasonable to debate with won't win you any points.

> Also it sounds weird to talk about people's labor as if they were potatoes

It's not weird since it's something that has a market value. People are not their labor. Someone's labor can be bought and sold, and the availability and price of labor is subject to the same economic laws as potatoes.

Some potatoes are worth $0.60 but not $0.80, and if the price of potatoes were dictated to be $0.80, the $0.60 would go in the trash.

I don't want potatoes or people's labor to go in the trash.

godd2··on Seattle: Highest Minimum Wage, Lowest Unemployment Rate
There are people whose labor is worth $8/hr but not $11/hr. Raising the minimum wage will not result in "giving them a pile of cash", it will result in them no longer having a job.
godd2··on My Mechanical Keyboard
> I broke previous one, well 'O' stopped working (vim).

If it was just the mechanical switch, you can always desolder out the old one and solder in a new one.

godd2··on Git from the inside out
I don't think it's fair to assume they didn't read the article. It's difficult to know when an explanation is succinct vs analogous, especially if you have a working model of knowledge. "A is just B" can mean more than one thing.
godd2··on Git from the inside out
No problem! :)

Once I understood this, things like merging and shallow clones made a lot more sense.

Although it makes rebasing more confusing. What's happening there is that git is creating patches on the fly, and then applying them to the new base, and creating new commits. But the resulting commits are snapshots of what the files would have been had you applied the patches yourself.

Of course, there can still be "merge conflicts" since both branches might make changes to the same place in the same file. But since everything is a snapshot, if you have no pending changes in your working directory, hopping around the commit history is a safe action, so long as you have a branch pointing to where you left off.

godd2··on Git from the inside out
A commit is not deltas. It contains a hash of a tree object, which in turn contains a list of hashes of blob and tree objects. The tree hashes are of course of tree objects which are your subdirectories, and the blob hashes are the hashes of your full files. When you make a change to a file, and then add it, git saves the new file as a full copy, and gives it its own sha1 hash.

If you go into `.git/objects` and find the file whose name is the hash of your most recent commit, you can decompress it (zlib inflate) and the first few characters of the file will be something like "commit 485\0tree 6f3eeb2952a...". This tell us that this object is a commit object of size 485 bytes, and then after the null character is the commit itself. If you then take that tree hash and do the same thing, you'll see a list of blob hashes next to filenames, and tree hashes next to directory names (in a tree object, git stores the hashes as the raw bits, instead of ascii encoded, so if you want to follow the hash list, you'll have to convert the hashes to their ascii equivalent to find the appropriate object in the object store).

You are correct that git uses deltas, but it doesn't use them for commits, it uses them when it recompresses your objects into a packfile (which happens when there are too many loose objects or when you pull and push).

Every commit can reconstruct the state of your project at the time the commit was made. Each commit can do this without the help of any other commit.

godd2··on Git from the inside out
It's not just GUI usage that leads to bad understanding. The documentation is incorrect.

man git-commit

  Record *changes* to the repository
(emphasis mine)

It's no wonder people get confused, if the docs do nothing to alleviate confusion. A commit is a snapshot of a directory, not a list of changes.

godd2··on We ask supporters to stop taking down the US internet. You proved your point
If they were in danger, perhaps we should blame those who were pointing guns.
godd2··on Cuomo signs bill prohibiting Airbnb listings in NYC
Is political self interest nobler somehow than economic self interest?

Even if it was, does it make Airbnb wrong? Should people not be able to freely make living arrangements with whom they choose for arbitrary amounts of time?

godd2··on Ask HN: How often women read HN? Participate?
How much did the male approval rate change from unknown-male to known-male?

You can't just say that women's contributions fell and then not show the comparable male change.

godd2··on Vim Anti-Patterns
It's not the same. That will only repeat the change of the number of characters of the length of those 2 words. c2w, when repeated, will change 2 words, no matter how long the words are.

For example:

    This is a string of text.
    This is a string of text.
If the cursor is at the "i" of "is" on line 2, and you type v2echello<Esc>, you will have:

    This is a string of text.
    This hello string of text.
If you move the cursor to the "s" of "string" on the first line, and press ".", you will get:

    This is a hellong of text.
    This hello string of text.
However, if you had used c2w, it would have replaced "string of" with "hello" like so:

    This is a hello text.
    This hello string of text.
Visual mode is lossy in terms of text objects. It only remembers counts of character movements, that's why it replaced 4 characters with "hello" instead of replacing 2 words with "hello".
godd2··on Ask HN: What's your favorite tech talk?
The closest thing I can think of is Clojurescript with Figwheel:

https://www.youtube.com/watch?v=KZjFVdU8VLI

godd2··on Burning Ship Fractal
Or they recorded it zooming out, and reversed the recording.
godd2··on React Game Kit
Sudoku, crossword puzzles, anything without 3D or real-time rendering.
godd2··on My time with Rails is up
> because your validation logic is disbursed

I think you want "dispersed" here.

godd2··on Simple trampoline implementation for stackless recursion in Java
It also transforms programs that use it from "cannot run with a little bit more memory" to "can run forever with a little bit less but still finite memory" which sounds more like an optimization. People are probably solving a problem that needs more, but still a finite amount, of memory, and very likely not solving a problem which needs infinite memory. So calling it an optimization is perfectly warranted.
godd2··on Alleged Mt.Gox code leaked on IRC node by Russian Hacker
That's not what he's saying. He's saying that it didn't scale well because Karpeles didn't know how to program, not that PHP didn't lend itself to said scaling.
← PreviousPage 2 of 2