A list of awesome minimalist frameworks - <AUTHOR> https://github.com/neiesc/awesome-minimalist <comment><USER2> Very cool. Please add [https://github.com/yoshuawuyts/choo](https://github.com/yoshuawuyts/choo) and [https://github.com/tachyons-css](https://github.com/tachyons-css). (Too lazy to send a pull; sorry )

<comment><AUTHOR> Thanks, added.</comment></comment>


Show HN: Survival Thriller Game that uses Echolocation - <AUTHOR> http://lurking-game.com

<comment><USER2> I'm blind and use echolocation regularly for things like biking, increased awareness of surroundings, etc. Any chance you might add some sort of audio- only interface? Off the top of my head, you could make the user's breathing noises echo off of obstacles. Breathing could echo off of walls to indicate obstruction in specific directions, for instance.

Your trailer doesn't tell me much as a non-visual user, but I like the idea of the noises you make being audible to whomever is hunting you even while they tell you what's around. That seems like a nice strategic element.

If you're looking for additional thoughts/design advice, I'd be happy to brainstorm further. I design audio-only games (albeit typically titles like traditional games but with audio-only interfaces) so have put lots of thought into this subject.

<comment><USER3> Hi!

You should buy a Razer Tiamat, and a computer capable of running it. It's a 7.1 surround sound headset. It's different from other surroundsound headsets in that it's truly surround sound: there are a bunch of actual tiny speakers inside each ear which physically emit sound from different directions.

The experience is incredible! It's nothing like headphones with two speakers, or any of the "virtual surround sound" stuff. People think we only need two speakers because we have two ears, but it's not true at all. Two speakers work sort of okay, because everyone's used to them and our audio presently is made to work for them, but surround sound is far superior.

Unfortunately it requires a desktop computer that has 5 plugins for the audio. (Front, front-left, front-right, back-left, back-right, if I remember correctly.) Also, the headset is slightly hard to configure out of the box. If you plug it in and aren't overwhelmed, don't give up hope! You have to go into the audio settings and enable stuff like bass management or loudness management or... stuff like that, I've forgotten at this point but I could look it up if needed.

The positional audio is so good that I think you might be able to play some games. Unfortunately, there aren't very many games which take full advantage of surround sound, but it could be fun for a friend to play a scary game like Amnesia while you listen to it. It's admittedly very expensive for probably not too much takeaway for you though.

Here's a link to a comment I wrote about the Tiamat a couple months ago when Sony announced a competing project to the Oculus Rift. They said they're shipping something with "60 virtual speakers" so that prompted my comment: [https://news.ycombinator.com/item?id=7426463](https://news.ycombinator.com/item?id=7426463)

<comment><USER2> Hmm, not sure I've ever had a computer with 5 audio plugs. Actually, I'm trying to sort through the various audio connectivity standards to find which works best for me. Because I don't need a large screen, and because the screen is the usual bottleneck for desktops/laptops, I use a small but powerful laptop as my main computer (Lenovo Helix for the curious.) Unfortunately, since this _is_ a laptop, audio connectivity is pretty limited, and I'm in the market for a quality USB audio device that'd allow at least 5.1 connectivity.

If you have any headphone/USB interface buyer's advice to offer than I'd be interested. At the moment I'm lacking enough connectors for a 5.1 interface with this setup and _certainly_ lack same for headphones. :)

<comment><USER4> Searching for "usb 7.1" on amazon.com gives these top products with decent rating:

[http://www.amazon.com/Vantec-External-Channel-Audio- Adapter/...](http://www.amazon.com/Vantec-External-Channel-Audio- Adapter/dp/B004HXGJ3S/ref=sr_1_1?ie=UTF8&qid=1399888698&sr=8-1&keywords=usb+7.1)

[http://www.amazon.com/Sabrent-USB-SND8-8-Channel-External- Su...](http://www.amazon.com/Sabrent-USB-SND8-8-Channel-External- Surround/dp/B001D1PWGM/ref=sr_1_2?ie=UTF8&qid=1399888698&sr=8-2&keywords=usb+7.1)

Here's the Razer Tiamat headphones, I'm using them and like a lot:

[http://www.amazon.com/Razer-Tiamat-Surround-Gaming- Headset/d...](http://www.amazon.com/Razer-Tiamat-Surround-Gaming- Headset/dp/B007CS9WYI/ref=sr_1_1?ie=UTF8&qid=1399888881&sr=8-1&keywords=razer+tiamat)

</comment></comment></comment></comment><comment><USER5> This is interesting, I must give it a try because I practice echolocation in real life. I have perfectly good eyesight but seeing some documentaries about blind people who echolocate prompted me to learn some myself. I'm not very good but I can improve my situational awereness in darkness.

<comment><USER6> Please tell more about how you learned and practice echolocation.

<comment><USER5> I saw a few videos about blind kids who echolocate [0], and got inspired by it. The videos only briefly showed how they practice, but it did show a teacher training a pupil by putting a pane of glass on either side of the head and then made him guess which side it is on.

Echolocation is not some kind of magic ability, where a person without vision gains superhuman abilities to measure time between echoes. This is the way it is often portrayed in the media, though.

Shaping your mouth and your lips, click with your tongue to create a _directional_ click going to your left or right hand side. Then listen to the sound of the click (the click itself, not some magical echo 10 ms later) and try to hear differences in the color or timbre of the click. It's just _like tweaking the settings of a reverb effect in an audio software_. Hard surfaces like glass or concrete sound very different from soft things like humans or trees. Distant objects sound different than close ones.

Scientifically, you are measuring the _impulse response in frequency domain_ [1] (ie. spectrogram). According to the _convolution theorem_ [2], the impulse response has all the "information" about the surroundings you can have (applies to acoustic, mechanical and electrical signals too).

I sometimes practice by trying to navigate long hallways at the office and trying find my desk without the help of eyesight (I know it is n'th door to the left, and open doors are easy to tell from hard walls). Sometimes I practice outdoors just trying to recognize trees, buildings, cars or humans from their echo.

Blind people often echolocate subconsciously by listening the echoes of their footsteps and surrounding noises. This was demonstrated by a echolocation teacher by playing white noise in a familiar room and seeing their new students who claim they don't echolocate get lost in their own living rooms.

[0] [https://www.youtube.com/watch?v=r9mvRRwu5Gw](https://www.youtube.com/watch?v=r9mvRRwu5Gw) [1] [http://en.wikipedia.org/wiki/Impulse_response](http://en.wikipedia.org/wiki/Impulse_response) [2] [http://en.wikipedia.org/wiki/Convolution_theorem](http://en.wikipedia.org/wiki/Convolution_theorem)

</comment></comment></comment><comment><USER7> In a game where sound is the only way to see you save a lot of time on making textures. : P Looks fun.

</comment><comment><USER8> Sounds cool, downloading now. I've been working on a similar idea in my spare time, using video and sound as input.

[https://www.youtube.com/watch?v=iai72LhlcZA](https://www.youtube.com/watch?v=iai72LhlcZA)

Edit: Tried playing, it didn't seem to pick up input from the microphone, I had to press 'Q' constantly to fake sound. Is the mic disabled in the Mac version?

<comment><AUTHOR> Mac version can use microphone input. Check your Sound preferences and you need to do calibration in game.

</comment></comment><comment><USER9> Looks cool, graphics could perhaps use a little improvement? I'm imagining it would be much scarier if there was a bit of base white noise instead of a pure black background. Messes with your imagination.</comment>


Destroy All Scrollbars - <AUTHOR> http://blog.gsabo.com/destroy_all_scrollbars.html

<comment><USER2> "I am more likely to start reading a longer piece if I don't know its length at the outset."

Isn't this expected though? The only reason I don't read longer pieces is because I don't have the time right now to complete them. This is, more or less, the sentiment behind TL;DR</comment>


You Can Help Save A Four-Year-Old Girl's Life Just By Sending A 'Yo'  - <AUTHOR> http://www.businessinsider.com/yotheworld-hackathon-idea-2014-7

<comment><USER2> Start using the sponsor's product to help us win a contest set up by the sponsor, or this kid dies. Well isn't that a classy way to win a marketing comp. Is a bit like collecting twitter followers by threatening to kill a kitten.</comment>


This should never happen - <AUTHOR> https://github.com/search?q=This+should+never+happen&type=Code&utf8=%E2%9C%93 <comment><USER3> My favorite example of a "this should never happen" error was when I got a call from a customer, who started the conversation by asking, "Who is Brian?".

I was caught a bit off guard, but I assumed the customer must know someone at the company, since Brian was the name of the previous electrical engineer/firmware programmer. So, I told them that Brian didn't work here any more, but was there anything that I could help them with? The customer said, "Well, the device says that I should call Brian". I was confused by this, and asked a lot of questions until I determined that the device was actually displaying "CALL BRIAN" on the LCD display.

This was quite unusual, and at first I didn't believe the customer, until he sent a picture of the device showing the message.

So, I dug into the code, and quickly found the "Call Brian" error condition. It was definitely one of those "this should never happen" cases. I presume that Brian had put that in during firmware development to catch an error case he was afraid might happen due to overwriting valid memory locations.

I got the device back, and found out that the device had a processor problem (I don't remember exactly what) that would write corrupted data to memory. So, really, it should never happen.

That particular device has now been in production for 10 years, and that is the only time that error has ever appeared.

<comment><USER4> Did you tell brian?

<comment><USER3> Of course I did. He didn't remember putting in that error condition, but he loved the story!

<comment><USER5> He doesn't remember? That's scary hah. Seems like something worth remembering. Great story, made me laugh

<comment><USER6> Do _you_ remember all the trap code you've ever written?

<comment><USER7> Traps are for the insecure. I just write to memory without checking bounds or asking questions. No one has ever tried to call me.

<comment><USER8> "Hi alttab, i tried to use your program but it closed and displayed a message saying 'segregation fault' or something...i'm not a racist, i love all people, please give me a call back"

</comment></comment></comment></comment></comment></comment></comment><comment><USER9> "This should never happen" is a design pattern of defensive programming. This is the same pattern for assert.

The usual use is to catch errors caused by misuse of a method. There is some invariant that the method assumes but is not enforced by the type signature of the interface. So if something goes wrong in outside code, or someone tries to use the method incorrectly, the invariant is not satisfied. When you catch such a problem, the current code context is FUBAR. The question is how aggressively to bail out : spew errors to a log and proceed with some GIGO calculation? Throw an exception? Exit the program?

<comment><USER10> It's a sub-pattern of "ain't got time for dat". Developer _knows_ that condition should never happen, but is not inclined to prove it (as represented by coding type checking or other handling) yet realizes it shouldn't be ignored outright (if only to document the unproven condition in code, or to shut the compiler up about incompleteness warnings).

<comment><USER11> It's also for cases when you _know_ it can't happen. For example, Java's String class has a method

        public byte[] getBytes(String charsetName) throws UnsupportedEncodingException

Since it can throw a checked exception you have to catch it, which generally is fine, but consider this case:

        someString.getBytes("UTF-8");

This call can never fail (support for UTF-8 encoding is required in Java) but in my case I have to do something with the exception in the catch statement or our static code analysis tool will start complaining (and rightfully so). So that's where I'll log a 'can't happen error'. It truly cannot happen.

<comment><USER12> getBytes is poorly designed. In a safety-oriented language like Haskell or Rust, the set of encodings would be represented as an ADT (which forms a closed set) or s Typeclass (open set). All possible type-correct encoding arguments would be safe.

<comment><USER13> Speaking to the Haskell part:

An ExceptT or Maybe monad for handling encoding errors feels a lot like throwing exceptions, although they are less disruptive than exceptions. I'd probably represent a decoder as a function with type ByteString -> ErrorT ParseError m Text, which is neither an ADT or Typeclass. It's a 3rd solution. Either that or an Attoparsec parser, which is probably equivalent. An encoder seems like it shouldn't fail at all, but if it eventually forks out to one of the C locale functions I can see it throwing errors too.

Meanwhile, in the real world, Data.Text.Encoding uses a 4th solution implementing decodeUtf8With and encodeUtf8 that ultimately represents the UTF-8 encoding as a pair of FFI functions with these signatures:

      foreign import ccall unsafe "_hs_text_decode_utf8"   c_decode_utf8
          :: MutableByteArray# s -> Ptr CSize
          -> Ptr Word8 -> Ptr Word8 -> IO (Ptr Word8)

and this one:

      foreign import ccall unsafe "_hs_text_encode_utf8" c_encode_utf8
          :: Ptr (Ptr Word8) -> ByteArray# -> CSize -> CSize -> IO ()

text-icu also ultimately represents an encoding as an opaque pointer returned by the ICU library, and works in the IO monad. So it too could fail in similar ways. Errors throw an exception of type ICUError, which the caller can catch using the 'catch' function from Control.Exception.

The encoding library does use typeclasses like you suggest, but I'm not sure anybody uses it. Sometimes people drop in #haskell and complain about that library, and the response is usually "don't use that; use the one in Data.Text.Encoding instead".

I don't use Rust, but if the language is at all practical, I imagine they shuttle their equivalent of pointers and bytestrings around and depend on foreign C libraries and locales just the same. Probably they don't want to change the core library every time the Unicode Consortium publishes a new encoding scheme, so I can't imagine them exposing only a closed type.

So, looking purely at the signature and comparing it to examples from a language you suggested, it doesn't appear to be poorly designed at all. It's exactly what I would expect and want in any language, and the library consensus seems to agree. I think you're just imagining the grass being greener on the other side.

<comment><USER14> In Rust, our main two string types are String and &str, which are both UTF-8 encoded. For interoperability with other things, we have additional types that you can convert to/from. [http://andrewbrinker.github.io/blog/2016/03/27/string- types-...](http://andrewbrinker.github.io/blog/2016/03/27/string-types-in- rust/) is a recent overview in a blog post.

</comment></comment></comment></comment></comment></comment><comment><USER15> Using github to search like this reminds me of how a CS professor of mine would show the "best commit messages of the year" (homework was submitted via git) by looking for various patterns like all caps, all symbols, etc.

[http://www.slideshare.net/bsotomay/uchicago- cmsc-23300-the-b...](http://www.slideshare.net/bsotomay/uchicago- cmsc-23300-the-best-commit-messages-of-2015)

<comment><USER16> My favorite commit message of all time:

[https://core.trac.wordpress.org/changeset/26851](https://core.trac.wordpress.org/changeset/26851)

\---

The Pinking Shears stir from their slumber, awakened by what may seem, to those innocent in the ways of The Shears, a triviality, a nothing-of- consequence. But there are consequences indeed for recklessly trailing your whitespace. Naturally, they a dire!

One, two! One, two! And through and through

The Pinking Shears went snicker-snack!

They plucked your tail and with your space

They went sniksnuking back.

Let me tell you, that can be uncomfortable, so always pre-sniksnuk your trailing whites. May The Shears be with you.

<comment><USER17> It doesn't surprise me that someone that would make a change like that would leave a comment like that.

They removed a trailing space from a comment! They have plenty of free time to write witty check-in comments.

<comment><USER18> I definitely aim to remove things like that, but I tend to sneak it in with something else (partly because the fix likely came as soon as I used an editor properly configured to strip it).

I'm not sure if that's a 'bad' practice or just not the purest. But I don't think removing trailing comment space is bad in itself. As above, it probably didn't take any time at all; done automatically by a well-configured editor.

</comment></comment></comment></comment><comment><USER19> My favorite part is the Java project that has an exception class called ThisShouldNeverHappenException [1]. Only in Java would someone create an exception class for a condition that should never happen :)

[1] [https://github.com/TheProjecter/propidle/blob/f0d5320e2a3d46...](https://github.com/TheProjecter/propidle/blob/f0d5320e2a3d46f9fe7ea3c36fc071256e023234/src/com/googlecode/propidle/util/ThisShouldNeverHappenException.java)

<comment><USER20> Not just Java. I've seen similar classes in C++ and C# to indicate things which should never occur/are clearly bad programmer mistakes/... Think InternalErrorException/DevFailedError etc. Sometimes it's just a sane thing to do, and using such names means you don't need to write the dreaded 'should never happen' comment manually anymore.

<comment><USER21> Isn't that what assertions are for?

<comment><USER22> Assertions can be disabled at runtime. If your goal is to call out the fact that something has gone fundamentally wrong with your program's state, an exception is the way to go.

</comment></comment></comment></comment><comment><USER23> GitHub's search is pretty interesting: every time I refresh the search page it shows a different number of results: 18,401,830; 17,751,631; 15,995,799.

Which is anyways quite a lot of results, but then this search finds _ThisShouldNeverHappenException_ , the string _" this should never happen"_ and stuff like

        // *This* gets run before every test.
        if (b > d) {
            fail("XX *should never happen*");
        }

With quotations it's _only_ about 500,000.

<comment><USER24> HyperLogLog[1] will do that. You can find it in Redis, Lucene; and I suspect it is also hidden behind BigQuery's count(distinct X)s.

[1] [https://en.wikipedia.org/wiki/HyperLogLog](https://en.wikipedia.org/wiki/HyperLogLog)

<comment><USER25> What part of the algorithm would cause the number to change significantly every time you run the query?

<comment><USER24> All shards compute their own, and send the result in a non deterministic order. My explanation is that the merge part of HLL depends on the order.

Line 95 of this method [1] from this implementation [2] shows a max(mask(x), mask(y)), which is not associative but is a close proxy to max()(which is associative).

[1] [https://github.com/addthis/stream- lib/blob/af045cb4199959c07...](https://github.com/addthis/stream- lib/blob/af045cb4199959c07fb4422e605573e180491191/src/main/java/com/clearspring/analytics/stream/cardinality/RegisterSet.java#L87)

[2] [https://github.com/addthis/stream- lib/blob/master/src/main/j...](https://github.com/addthis/stream- lib/blob/master/src/main/java/com/clearspring/analytics/stream/cardinality/HyperLogLog.java)

</comment></comment></comment></comment><comment><USER26> Sometimes you have to satisfy the compiler because it has less information about a situation than you do. Ideally this would be captured in the type system, but limitations (language, project, politics, time, etc) may prevent this. As another comment mentions, it's a kind of invariant check.

For example, based on external information you might know[1] that a condition inside of a loop will always be hit exactly one time. Your compiler or tools might not be able to determine that same thing. It may try to force you to do something like assign a value or whatever you did in that condition, that it can't guarantee has happened. In such a scenario, it might[2] make sense to have something like "this should never happen" after the loop, with a brief comment explaining why you've done this.

[1] I think this is the crux of the issue. We programmers often think we "know" something, but it might be an incorrect assumption. IMO part of being a good programmer is examining your assumptions at every step. The chasm is vast, between "the framework strongly guarantees X" and "the function that gets called before this one has done X already". The former is OK if you want to get work done, while the latter is much more brittle and possibly dangerous, depending on the level of coupling you're willing to accept.

[2] Nine times out of ten, a reorganization of the logic makes more sense. However, I do think there are scenarios where this pattern is the best choice given the options.

</comment><comment><USER27> In my experience, "this should never happen" cases often are a sign of very brittle design that branches into many separate but nearly-identical paths, and could be simplified to remove them. The other thing it points to is bad error handling paths (assuming that an error could "never happen".)

Also funny to see Java being the most verbose as usual, with its ThisShouldNeverHappenException.java

<comment><USER28> Mostly there is no need for "ThisShouldNeverHappenException" since java has a IllegalStateException

<comment><USER29> To be fair, someone writing a ThisShouldNeverHappenException may not be the kind of developer that knows about an IllegalStateException.

<comment><USER28> Actually they at least need to know about a RuntimeException then.

So that would've worked, too:

        throw new RuntimeException("This should never happen!");

There would've been a difference between a Exception and a RuntimeException.

Also sometimes this kind of RuntimeException happens when you convert one type into another and want to explictly call all cases something like that:

        interface A
        class AA implements A
        class AB implements A

        if (x instanceof AA) {}
        else if (x instanceof AB) {}
        else { throw new IllegalStateException; }

It's sometimes better to explicitly call all states instead of using the last else for the AB branch, since sometimes this will be extended later or the compiler would've throw an error since you have a return inside the if or else if. Btw. Kotlin and Scala won't have this problem due to pattern matching.

</comment></comment></comment></comment><comment><USER30> Apparently things-that-shouldn't-happen happen 10x more in C code than the next nearest language.

<comment><USER19> I didn't even notice that. Good observation. I wonder if that's simply because C is a lot older and may just have a lot more dead code or this type of code or something else entirely.

<comment><USER31> I am a C lover.

It is because C has no exception handling, and C coders still want to be sure.

For example once I had a game where I ended putting a couple "should never happen" in my code related to some OS stuff, and... the "should never happen" happened once, after figuring how to reproduce it, it was a driver bug (or something like that, happened years ago, I don't remember the details anymore, only remember that it went away after I switched from Alsa to OSS4 on my Linux box).

EDIT: should never happen is good against compiler bugs too, I've seen my fair share of them.

</comment></comment></comment><comment><USER32> This too: [https://github.com/search?utf8=%E2%9C%93&q=no+idea+why+this+...](https://github.com/search?utf8=%E2%9C%93&q=no+idea+why+this+works&type=Code&ref=searchresults)

:)

</comment><comment><USER33> Not trolling here. I'm curious why this is getting so much attention. Isn't saying "this should never happen" just making an assertion about the behavior of your code? As far as the apparent inconsistencies in the code seen in the results go, is it really fair to judge a random piece of code from a random person (and completely out of context)? Don't we all have scratch/experimental/incomplete code hosted on our github accounts?

</comment><comment><USER34> But what they mean is, 'This should never happen unless there's a serious problem upstream' and so these sorts of Asserts and Throws are actually very useful. Its all about 'Fail Fast'

</comment><comment><USER35> I think thats just good common practice - the amounts of times I've seen that message when obviously I never expected to :)

This one is more worrying I suppose: [https://github.com/search?utf8=&q=FIXME&type=Code&ref=search...](https://github.com/search?utf8=&q=FIXME&type=Code&ref=searchresults)

</comment><comment><USER36> I usually annotate should-never-happen asserts by the most plausible explanation how it _could_ happen, for the sake of some poor guy unlucky enough for having to debug my code.

E.g. "Should not happen — probably a bug in Apache Commons Math?"

Or "Shouldn't really happen, barring compiler bugs or cosmic rays"

As they told us, there is no such thing as probability of zero.

</comment><comment><USER37> call error("in omatch: can't happen"); \- Line from omatch routine on pg. 146 [1].

Snips from discussion in [1]: "We can expect problems, therefore, and should prepare for them. ... Garbage is bad enough, but garbage which is expected to contain a count to tell you how long it is can be much worse. ... The first time we ran this code it said 'can't happen' We got that message perhaps a hundred times in the process of adding the rest of the code... This experience speaks for itself; if you're going to walk a high-wire, use a net."

'Can't happen' is as much a pattern as 'Hello, World'... and it has the same genesis.

[1] Brian Kernighan, P.J. Plauger, 'Software Tools', Addison-Wesley 1976

</comment><comment> saint-loup Previous noteworthy Github searches, found via hn.algolia.com :

[https://github.com/search?q=ugly+hack&ref=cmdform&type=Code](https://github.com/search?q=ugly+hack&ref=cmdform&type=Code)

[https://github.com/search?utf8=%E2%9C%93&q=filename%3Aid_rsa...](https://github.com/search?utf8=%E2%9C%93&q=filename%3Aid_rsa&type=Code&ref=searchresults)

[https://github.com/search?p=3&q=extension%3Aphp+mysql_query+...](https://github.com/search?p=3&q=extension%3Aphp+mysql_query+%24_GET&ref=searchresults&type=Code)

</comment><comment><USER38> Search for "WTF", results by language

C++ 2.4M C 400K Java 150K ...

Sounds about right.

<comment><USER39> Also interesting considering there are over twice as many Java repositories (>200,000) as C++ (<90,000) [0].

[0] [http://githut.info/](http://githut.info/)

</comment></comment><comment><USER40> This is what you throw when your padLeft webservice call fails.

</comment><comment><USER41> One of the most common causes of failures are cases that the programmer never considered. Once of my favorite test coverage tools shows you missed branches and I find that invaluable.

My initial reaction was "oh no" but as I thought about it, this explicitly indicates that the programmer actually thought about a case.

And is it any different than what most of us do in our unit tests? If we're expecting an exception that isn't thrown or the wrong exception is thrown, we force a test failure.

One of the goals our team is working towards is more robust and complete metric and log collection. We specifically want to capture exceptions that make it to the application server for analysis, but this assumes that the developer has a) considered all cases and b) caught intermediate exceptions and continued processing (or abort).

</comment><comment><USER42> There are better (aka more creative) ways of inducing rage in fellow cow- orkers. [https://twitter.com/noahlz/status/709961243277332482](https://twitter.com/noahlz/status/709961243277332482)

</comment><comment><USER43> [https://github.com/search?utf8=%E2%9C%93&q=Why+does+this+hap...](https://github.com/search?utf8=%E2%9C%93&q=Why+does+this+happen&type=Code&ref=searchresults)

<comment><USER44> ^^ Above links to a "Why do this always happen" search on Github likely to express that if something that should never happens occurs, then you need to understand why it happened, which is often hard, since it never happens. Often solution is to be able to reproduce a bug by being able to playback what happened.

EDIT: Ha, turns out the link is just an attempt to prove that bugs that should never happen occur ten times more in C... Which is questionable.

</comment></comment><comment><USER45>
        void(int a, int b)
        {
            const int i = 0;
            int result = a + b;
            if (i > 0)
            {
                // This will never happen ;)
                result = result / 0;
            }
        }

</comment><comment><USER46> One product I worked on a number of years ago had a CantHappen() function with a simple implementation. It displayed this message box:

      You are not here.

Another message was in the Mac installer when there wasn't room to install:

      Your hard disk is too small.

That's the complete text of both messages, and yes, it displayed them _to the customer_. <sigh>

After seeing these, I started going through the code and found a bunch of other rude, confusing, or jargony messages. It actually turned into a fun little project cleaning these up!

</comment><comment><USER47> "wtf": [https://github.com/search?utf8=%E2%9C%93&q=%22wtf%22&type=Co...](https://github.com/search?utf8=%E2%9C%93&q=%22wtf%22&type=Code&ref=searchresults)

Anyway, if you read commits in Linux you'd find a lot of fuck in there. Quite amusing.

When I was an intern, I loved looking at MXR to find words like fuck: [http://mxr.mozilla.org/mozilla- central/search?string=fuck](http://mxr.mozilla.org/mozilla- central/search?string=fuck)

</comment><comment><USER48> There's almost twice as many "should not get here" results[1], which I think would mostly be used in the same situation, in case someone is looking for more.

1: [https://github.com/search?utf8=%E2%9C%93&q=should+not+get+he...](https://github.com/search?utf8=%E2%9C%93&q=should+not+get+here&type=Code&ref=searchresults)

</comment><comment><USER49> C#: 58355, F#: 464, Haskel: 6

<comment><USER50> I wonder if there is a way to calculate the denominator for each of those? The proportion would be a much more compelling argument.

<comment><USER51> [http://githut.info](http://githut.info)

</comment></comment></comment><comment><USER52> I remember one place I worked had an error thrown that showed as hex code "48 45 4C 4C 4E 4F". As far as I know it only occurred once in test when someone did something epically stupid as a patch to the code preceding it. We removed the patch and never saw the code again. Have no real clue who put it in there, as code control was a later addition.

</comment><comment><USER53> Cray Research had a linker named SEGLDR that was written in Fortran, whose STOP statement allows an optional string message, and so it was used for run- time assertion checking like

IF(.NOT.CHECK()) STOP 'xxx'

Anyway, somebody (not me) got into trouble when Very Serious Customers were offended by seeing the occasional STOP DAMN message at link time.

</comment><comment><USER54> A related search I like is "why does this work": [https://github.com/search?utf8=%E2%9C%93&q=%22why+does+this+...](https://github.com/search?utf8=%E2%9C%93&q=%22why+does+this+work%22&type=Code&ref=searchresults)

</comment><comment><USER55> "Testing this shit" -> We've found 129,140 code results [https://github.com/search?utf8=%E2%9C%93&q=Testing+this+shit...](https://github.com/search?utf8=%E2%9C%93&q=Testing+this+shit&type=Code&ref=searchresults)

</comment><comment><USER56> I think "should not get here" highlights this point better

[https://github.com/search?utf8=%E2%9C%93&q=should+not+get+he...](https://github.com/search?utf8=%E2%9C%93&q=should+not+get+here&type=Code&ref=searchresults)

</comment><comment><USER57> C still in the lead for: why is this happening [https://github.com/search?utf8=%E2%9C%93&q=why+is+this+happe...](https://github.com/search?utf8=%E2%9C%93&q=why+is+this+happening&type=Code&ref=searchresults)

</comment><comment><USER58> And the related Log.wtf() on Android:

[http://developer.android.com/reference/android/util/Log.html...](http://developer.android.com/reference/android/util/Log.html#wtf\(java.lang.String,%20java.lang.Throwable\))

</comment><comment><USER59> Since so many people obviously need this functionality, I've created a reusable Python version here: [https://github.com/vitaut/neverhappen](https://github.com/vitaut/neverhappen)

</comment><comment><USER60> By far not as popular as foo [https://github.com/search?utf8=%E2%9C%93&q=foo&type=Code&ref...](https://github.com/search?utf8=%E2%9C%93&q=foo&type=Code&ref=searchresults)

</comment><comment><USER61> Maybe even more interesting:

[https://github.com/search?utf8=%E2%9C%93&q=%22no+idea+why+th...](https://github.com/search?utf8=%E2%9C%93&q=%22no+idea+why+this+works%22&type=Code&ref=searchresults)

<comment><USER62> Or "How did this ever work?"

[https://github.com/search?utf8=%E2%9C%93&q=%22How+did+this+e...](https://github.com/search?utf8=%E2%9C%93&q=%22How+did+this+ever+work%22&type=Code&ref=searchresults)

</comment></comment><comment><USER63> I wish we could sort by most starred to see what popular repositories have code like this.

</comment><comment><USER64> I find this more entertaining : [https://github.com/torvalds/linux/search?utf8=%E2%9C%93&q=fu...](https://github.com/torvalds/linux/search?utf8=%E2%9C%93&q=fuck)

<comment><USER65> That jab at Sun haha!

</comment></comment><comment><USER66> [https://github.com/search?utf8=%E2%9C%93&q=%22this+is+so+bro...](https://github.com/search?utf8=%E2%9C%93&q=%22this+is+so+broken%22&type=Code&ref=searchresults)

</comment><comment><USER67> Reminds me of the "Six Stages of Debugging": [http://plasmasturm.org/log/6debug/](http://plasmasturm.org/log/6debug/)

</comment><comment><USER68> if happens: print "shit, that wasn't supposed to happen"

<comment><USER69> Never ever EVER put bad language in any unexpected error cases or logs - <USER2> as you're developing it... it WILL somehow magically make its way to production, and it WILL appear!

<comment><USER70> I remind myself frequently not to swear in code as I am quite juvenile on a normal day. If I'm struggling I'll just make up a word, so that if it ever happens that someone else sees it I can say it is an acronym but that I have conveniently forgotten for what.

<comment><USER43> You could always put a "this should never happen" right before the swear words so they know it wasn't your fault.

<comment><USER70> But there's a risk I'll become stuck in an infinite loop of writing shit! this should never happen shit! this should never happen shit! ...

and so on. Still it would be a change from writing bad code.

<comment><USER43> Wow, deja-vu, this is just what happened to me one time when I was working on a new booking system for a hotel.

I was working on site over the winter season when the hotel was closed down, a lovely old hotel high up in the Rockies. Every day I sat down and wanted to write some brilliant code but all I ever ended up writing was the same comment

All objects and no functions makes Jack a dull boy. over and over again.

Drove me quite mad actually.

Sometimes I feel like I'm still there.

</comment></comment></comment></comment></comment></comment><comment><USER71> This is awesome.

       public class ThisShouldNeverHappenException extends RuntimeException {
          public ThisShouldNeverHappenException(Exception cause) {
              super(cause);
          }
       }

</comment><comment><USER72> Could be that some of the "This should never happen" can be deduced by optimizing compilers and never exist in assembly? Not talking about the interpreted stuff.

</comment><comment><USER73> IllegalStateException already exists. Why would people make their own?

</comment><comment><USER74> Best one is

/ __* This should never happen exception. Use in situation that really shouldn 't happen...NEVER * * */ public class NeverHappenException extends RuntimeException {

</comment><comment><USER75> todo: stuff [https://github.com/search?utf8=%E2%9C%93&q=todo+stuff&type=C...](https://github.com/search?utf8=%E2%9C%93&q=todo+stuff&type=Code&ref=searchresults) todo: meh [https://github.com/search?utf8=%E2%9C%93&q=todo+meh&type=Cod...](https://github.com/search?utf8=%E2%9C%93&q=todo+meh&type=Code&ref=searchresults)

</comment><comment><USER76> The shocking part is the number of times:

"This should never happen": 823,044 This should never happen: 16,946,357 vs. "This is screwed up": 59 This is screwed up: 876,393

</comment><comment><USER77> At least make the error say WHY it should never happen.

</comment><comment><USER78> If you work for a big company, search for this string in your bug-ticketing system to see example logs from all the times these lines are triggered.

</comment><comment><USER79> I remember using the comment "Craw! Polly shouldn't be!" instead, as a homage to a specific Simpsons episode. :)

</comment><comment><USER80> The thing is, we should be applauding people for many of these assertions. At least when they're throwing errors

</comment><comment><USER81> This reminds me of the sage advice, "Never check for a condition that you don't know how to handle."

</comment><comment><USER82> The best thing is that someone made a 'ThisShouldNeverHappenException'.

+1

</comment><comment><USER83> I prefer using CANTHAPPEN in the comment - easier to grep for.

</comment><comment><USER84> I'm a big fan of 'DO NOT MERGE' in git logs

<comment><USER85> most of those probably tack on an "until..."

</comment></comment><comment><USER85> Why no Ruby results?

</comment><comment><USER86> As usual, these submissions from Github searches like this are just sad.

</comment><comment><USER87> assert(false);

<comment><USER21> __builtin_unreachable();

<comment><USER88> That's a disaster waiting to happen. See docs.

</comment></comment></comment><comment><USER89> aaand naturally javascript is right up there in the top languages where this is found.

<comment><USER90> And C is at the very top. Should we now proceed to heap scorn upon C programmers?</comment></comment>


Chrome extension to capture and replay AJAX requests - <AUTHOR> https://chrome.google.com/webstore/detail/jquery-ajax-capture/hgicjmfpmakeejdfemjhokokaijfdjng

<comment><AUTHOR> Yep, it is a true concern. But I am on of two developers behind it. We started it as a tool for ourselves to generate jQuery request code and later decided to put it for public use. I doubt it will be wildly popular to give us incentive to include something bad in it. After all, it is useful only for those who know jQuery and Javascript. Enjoy.

<comment><USER2> Thanks for sharing.

</comment></comment><comment><USER2> This tool seems useful. I'm wary of installing extensions with broad permissions like this one needs (read and modify all data in all websites I visit). Chrome extensions are known for being modified after they become popular for mischievous purposes (e.g. selling data or installing malware). I wish Chrome provided a better security model for extensions like this. I guess one choice is to install it but leave it disabled.

</comment><comment><AUTHOR> This extension generates javascript code based on the AJAX requests that modern websites make. Take a request, modify parameters and extract data from APIs that modern websites use.

Unexpected use that we found while testing this extension: it helps detect other chrome extensions which track your data. You will see some weird requests being made to obscure hosts.</comment>


Marissa Mayer's Gamble - <AUTHOR> http://www.washingtonpost.com/blogs/innovations/post/the-yahoo-memo-and-marissa-mayers-big-innovation-gamble/2013/02/28/7e28266a-81b3-11e2-a671-0307392de8de_blog.html

<comment><USER2> Pretty over-the-top. Best line: "It might just be one of the biggest 'bet-the- company' moves to create a culture of innovation that we've ever seen in Silicon Valley."</comment>


Ask HN: What are your thoughts on an opinion tracker? - <AUTHOR> This is not a startup idea, I'm just looking for a pet project to work on and I came up with an idea that sounds promising to me. I wanted some feedback on it.
The idea is basically a journal of your opinions. I'm imaginaning connecting this with various different social media and other journaling apps so there won't be too much to deal with. For the moment I'll take Twitter as an example, since people tend to post their opinions there anyway. By tweeting something like "I think Brexit is stupid", you can record an opinion on a topic, and then watch it grow and change over time. You can add sources, reasons why you think the topic is important, track your confidence in that opinion, etc.
I'll flesh this out and come up with designs a bit later, but right now I'm just looking for basic validation of this idea: Does this sound cool? Would you use it? Why or why not?
Thanks in advance! <comment><USER2> So you would do sentiment analysis on a person's tweets (and whatever else) and give them their opinion on certain topics?

Sounds cool, but more like one of those "who are your 5 best friends" kind of apps than perhaps a person tries once, something I would personally not use on a regular basis (or somewhat regularly).

The tech's out there for this - sentiment analysis is a pretty standard Naive Bayes tutorial subject and I am certain there are some learned models already out there. And to identify subjects you could maybe use something like MIT Entity Identification.</comment>


DataSpii: Data leak via browser extensions - _-_T_-_ https://securitywithsam.com/2019/07/dataspii-leak-via-browser-extensions/ <comment><AUTHOR> Discussed yesterday: [https://news.ycombinator.com/item?id=20468986](https://news.ycombinator.com/item?id=20468986)</comment>


Ask HN: What math do I need to learn for graphics programming? - <AUTHOR> This is meant to be as generic as the question sounds. I am venturing into graphics programming, coming from frontend engineering. I've been wading through linear algebra via 3D Math Primer for Graphics and Game Development [1], and I quite enjoy it.
Does anyone have a semi-comprehensive list of math concepts I should learn for low-level graphics? I'm coming from a really sparse math background, as I only took up to Calc 2 in college.
Also, any general recommendations on the best way to learn graphics would be great. I'd say I'm more interested in graphics engines and experimental graphics than I am to actually making games.
Thanks
[1] https://www.amazon.com/Math-Primer-Graphics-Game-Development/dp/1568817231/ref=sr_1_1?ie=UTF8&qid=1488396630&sr=8-1&keywords=math+for+3d+graphics <comment><USER2> I'm not a very good graphics programmer but since nobody has chimed I'll give you my 2 cents for what it is worth.

As you've probably already seen, at the basic level, graphics is just a ton of fairly straightforward linear algebra. 4x4 transforms are your friend.

Beyond that, understanding bezier surfaces and the associated tessellation algorithms is probably a good idea. The math of bezier surfaces is pretty straightforward, but you need to play with them a bit to build your intuition about how they work. Once you've picked up bezier surfaces, moving to related concepts like B-splines and Nurbs shouldn't be too bad.

Interpolation algorithms are useful as well. Bilinear interpolation is the easiest to get started with. This leads naturally into linear and nonlinear filters, as interpolation can be thought of as a specific type of filtering. This forms the basis for a lot of what goes on in various shading algorithms.

Additionally, you will want to get familiar with space partitioning data structures such as BSP trees and oct/quad/KD trees.

</comment><comment><USER3> I do a lot of 3D stuff, not just graphics and I would say bone up on Linear Algebra. It's the only kind of math I can do anymore (yep, can't multiply/add/subtract without a calculator anymore).

As a side note, a few years ago there was a sea change in graphics with a lot of stuff moving to the GPU. Learn all you can about shaders. Playing with shaders is super fun. See [https://www.shadertoy.com/](https://www.shadertoy.com/)</comment>


Using your mac without the mouse - <AUTHOR> http://smartic.us/2010/02/04/using-your-mac-without-the-mouse/

<comment><USER2> Can't access the this article, but for window management, I recommend SizeUp: <http://www.irradiatedsoftware.com/sizeup/>

Among other things, you can define a grid on your screen and move/resize windows in to a given grid slot with keyboard shortcuts.

You notice how inefficient the mouse is for moving/resizing windows after using this. The effect is somewhat like xmonad on Linux, but less strict.

</comment><comment><USER3> I didn't like gleeBox, so I used Keyboard Navigation for Chrome. However I disliked that it searches for links on the whole page (scrolling to top if needed), but when you want to "click" a link with keyboard, you only want to search inside visible links, so I modified it a bit.

You can see a little demo here: <http://www.youtube.com/watch?v=z3ZrUMzBoPI>

(note that I changed ESC to focus to Ctrl+ESC in the latest revision)

I haven't packaged it as extension yet, so you'll have to install the original one first [https://chrome.google.com/extensions/detail/jdfpnijdiejbheba...](https://chrome.google.com/extensions/detail/jdfpnijdiejbhebabijgoibmnngiblhk) then cd into the folder with this extension and pull changes from my fork: <http://github.com/dchest/keyboard-navigation-for-chrome>

</comment><comment><USER4> Site's down.</comment>


Show HN: BabyDigest - Share photos and videos of your kid - <AUTHOR>

https://www.getbabydigest.com
In the spirit of Daniel's post, I wanted to share a project I've been working on since my kid turned one during the nights and weekends.
BabyDigest is for parents who are looking for an easy way to keep their kids pictures in one place and share them with family. KidPost, recently featured on ProductHunt, does something similar but BabyDigest will actually find past baby pictures/videos on your feed and sync them down. Parents can also upload directly to the site (via the web or email) and maintain a timeline for their kids.
I also used this as an excuse to learn AngularJS and Mongo. Happy to answer any questions about how this was built.
Would love feedback from fellow parents on HN! <comment><USER3> Questions:

1\. Is this usable without a Facebook account?

2\. How much can I upload?

3\. How does privacy protection work? Is it just a secret link or is it more than than?

4\. How is this free? I reflexively distrust any site offering a non-free service for free while simultaneously promising not to use my information against me. Am I to believe you are operating this site at personal cost to yourself for my benefit with nothing but posterity as your reward?

<comment><AUTHOR> 1\. Yes, its usable without Facebook. Sign up on the site and you can upload media directly (or email them in).

2\. No limit on how much you can upload at the moment. This might bite me in the ass later but if anything changes, there'll be a grandfathering in of older accounts.

3\. You set up a password for your timeline. This is then shared automatically with "subscribers" that you add to your account. They will get notified (via email) when you post anything and can click through this email and never

4\. Great question. Currently the plan is making money on prints (a PicPlum like service - printing of photos and mailing to family members). I may also introduce a premium version with more storage.

Would love to get your thoughts on the revenue ideas. And great questions - <USER2> should spell some of this out on the landing page more.

<comment><USER3> So as for question 3... one password? So anyone who has access could log in as anyone else who has access using their email and the same password, right? Also, do they need the password when clicking from an email or is there a special link there that lets them bypass password entry? If the latter, how long do those links last?

I don't mean to pry too much into implementation details, but I am very selective about what I share, so it's important to me.

<comment><AUTHOR> Yup, one password that they need to use to login, along with the email address that you've whitelisted for them. So its possible that someone could guess the password and their email address to get unauthorized access. I've debated a lot on this one and from the many parents I spoke to, this seemed to be a good middle ground between having some security and keeping it simple for family members to use.

The links in the emails have a special link that unique to each subscribers. These links at the moment do not expire but thats something I'm changing soon. All the images in the emails expire after a week.

I wrote a blog post on how I handle security on the app: [http://blog.getbabydigest.com/post/88405261016/privacy- and-s...](http://blog.getbabydigest.com/post/88405261016/privacy-and-security- at-babydigest)

</comment></comment></comment></comment><comment><AUTHOR> Clickable link: [https://www.getbabydigest.com](https://www.getbabydigest.com)</comment>


"Rate My Startup" Post Policy - <AUTHOR> "Rate My Startup" posts have increased dramatically in the last couple months, to the point where spammers started to post links with "Rate My Startup" prepended.  Obviously we
can't just allow any newly-created account to post a link to any site, no matter how offtopic it would otherwise be, with the claim that it's their startup (or weekend project, or whatever).  And yet I would not want to ban RMS
posts entirely.  We need some way to separate legit ones, and it seems like the simplest policy is to allow them
from established accounts but not newly created ones.
I'd been planning to consider ways to embody this in the software, maybe with a new type of item that (like polls) had a karma threshold, but I've been postponing dealing with it till I was done reading YC applications.  In the meantime for the past several weeks I've been killing RMS posts that weren't from established accounts.
I really need to get back to reviewing applications, since today is the last day.  In a couple days I'll revisit the matter. <comment><USER2> Jiminy! People: he's just saying _I'm too busy to fix this the right way today, so you'll all have to make do with this band-aid_.

Can we stop with the star-crossed imaginings of startup questions lost to the ages because of karma thresholds? If you have a real product you want to rate, and you can't post it, just find someone who posts regularly and who has their contact info in their profile. Then: _send them an email and ask for help_.

If that's too much of a hurdle for you, I have some bad news for you about entrepreneurship...

<comment><USER3> If you _do_ have a startup and are new to the site you're welcome to send me an e-mail (it's in my profile). I don't mind spending a few minutes looking through your site and posting an RMS on your behalf if everything is legit.

Be aware that I'll look on archive.org to see whether your site has been up for five years :-)

<comment><USER4> emailing you now, thanks

</comment></comment></comment><comment><USER5> I don't think it is unreasonable to ask people to invest time in the community before they can request the community to invest time evaluating their product.

<comment><USER6> As a non-technical, first time entrepreneur I am finding it difficult to add value to HN. I have been lurking for ~6 months, a member for 1 month and I made my first post yesterday.

With that said, I have learned a ton here and HN is easily the best resource I have ever found on any subject.

edit:

Potential solution: require participation in other user's RMS before you can post your own RMS. Even though I am non technical and don't have much entrepreneurial experience, I can still give an opinion from the view of a customer.

<comment><USER7> Surely you have a background in something unique or interesting, that others here don't have. At the very least, you have your perspective. I don't think it's difficult to provide insightful, valuable content to HN, in both submissions and comments. I've noticed that the topics here tend to rotate over time (meaning one week is all hard core programming, and the next week is boot strapping). Also, check out the new section, where the submissions tend to be more varied (in my experience). Find a topic or two that you have something to contribute to and comment on it.

<comment><USER8> (not grandparent, but similar situation) I've been here for a while, and I think it is difficult to participate at a level that gets lots of karma. I limit by intake of HN with the "Hacker News 100" feed, so that you all can filter my content for me (I'm going to miss good articles anyways, so I might as well not miss the popular ones). This also means that most things have already been said, or the conversation is dead, and even if I asked a great question, I wouldn't get a response.

This hasn't really bothered me, until the average karma/post started getting shown, which showed me that I get upvotes on less than half the things I say. Now that pg is also pointing out the correlation between new accounts and undesirables, I'm worried about...something (not sure what).

</comment></comment></comment></comment><comment><USER9> I can definitely imagine lurkers creating accounts to show off their latest project, so auto-killing posts from newly created accounts doesn't seem like the best way.

Perhaps make it policy that all RMS submissions be text submissions explaining the idea to give it a bit of authenticity, and every RMS submission with a link in the title be auto-killed. I don't imagine spammers would go through the effort of writing out a description of their service, asking for feedback, etc. Also, adjusting the flag threshold to 5 on text submissions could help. People tend to be more accepting and less likely to flag text submissions because the chances of them being spam are less likely (due to a higher degree of effort put into them as opposed to linking to some affiliate site), so a reduced flagging threshold might get rid of those submissions more quickly.

<comment><AUTHOR> If there was an established rule about who got to submit RMS posts, lurkers would know that and create accounts.

<comment><USER10> An option might be to send RMS posts from users with low karma into a slashdot-esque crowdsourced moderation. Randomly show it to 10 users with a high enough karma on any of the list pages (frontpage, newest, classic, etc.). It's then only made public if a high percentage of such "moderators" approve of it (not necessarily counting "approval" as an upvote, just meaning "this is legit"). The percentage could be pretty high, say 80%, and it could optionally be log(karma)-weighted or similar. 100% might be risky; I have no idea.

I have to say I'm not a huge fan of the slashdot moderation system in general, but it could work within this sort of limited scope. Allow people to opt-out altogether via a setting if necessary.

Tangent: I was amazed at the first spammy RMS submission I encountered. It had actually been upvoted. Spammers self-upvoting, or people wholesale upvoting any RMS they see without looking at it first?

<comment><USER11> Rating without looking at the underlying content is horrible. Perhaps it could be mitigated by tracking if the link was followed, weighting authenticated upvotes more heavily than unauthenticated ones (where "authenticated" means a click-through to the content was observed).

You could track a link click either by setting a cookie client-side with javascript, or by linking to a trampoline page on HN that tracks the click, then redirects to the real URL.

<comment><USER12> I have, on occasion, voted up a link on HN without clicking through _iff_ I have already read the article in question on, say, reddit. (I mouseover to make sure it's the same URL, though, and not just title and domain.)

</comment></comment></comment></comment></comment><comment><USER13> What constitutes an established account? I rarely comment on posts but have had an account for 2.5+ years and regularly upvote posts and comments. Is my account "established"?

<comment><USER14> I have no first hand knowledge, but I would be surprised if a 2.5 year old account with 250 of karma (like you do) is not considered established enough for this purpose.

<comment><USER15> What about a 2.5 year old account with no karma? You'd be surprised at how many lurkers there are. I know quite a few (and was one myself up until a short while ago).

EDIT: added emphasis

<comment><USER16> I as well. I've been 'lurking' on hacker news for almost two years. It doesn't mean I don't want to participate, it's just that whenever I do have something to say it's typically been addressed already by another user (the topics I'd probably post on are the hot-topics that draw more eyes.) And I'd rather not add redundancy to comments. To me the natural game mechanics that arise from 'gunning for karma' by being first to post (relevantly) takes a lot of effort.

<comment><USER17> That's basically where I'm at (speaking of redundancy).

I'm usually afraid to say something wrong, since I know that there are always experts on the topic of the post. It makes more sense to me to let said experts explain a particular topic than to possibly disseminate wrong information, even though I might have a useful perspective to add.

<comment><USER18> People shouldn't be afraid to say something wrong. If you say something wrong, people should correct you and everyone will learn (including readers that don't know anything about the subject).

The issue is if people that see that you're wrong, instead of correcting you, just downvote you. In my opinion, a wrong statement should not be buried with downvotes, it should stay at 1 point with a reply that corrects it and that get a lot of upvotes.

</comment></comment></comment></comment></comment></comment><comment><USER19> So a hacker who has been reading HN everyday while coding his product, but does not post often; is not allowed to post RMS anymore?

<comment><USER20> I'm in your boat. I read HN pretty religiously but don't have much time to comment or follow up on comments. Every time I even think about doing that I'd almost always rather spend more time obsessing about my product. Thus I barely have any karma points. But every once in a while, I like to post my latest project.

<comment><USER21> You "barely have any karma points"?? Your profile says you have 453... that's going to be far, far, far over any threshold pg is likely to set.

</comment></comment></comment><comment><USER22> Block _any_ submissions from accounts with under 10 (or similar) karma. A tiny amount to earn through comments but enough for nearly all spammers not to bother. There are enough users on HN submitting things now without pandering to those who can't even post a few insightful comments.

</comment><comment><USER23> An effective way of dealing with spammers is letting the community moderate it. You can add a "Mark as spam" link to every post and only make it visible to users with a certain amount of karma or whatever metric. Basically giving trusted members the option to moderate.

On top of that, record the IP address of the poster, and display the post but only to the spammer. Basically hiding it from everybody else. The spammer will think the post is still active. Everybody else will not see it.

</comment><comment><USER24> i think this XKCD points out the issue rather well. <http://xkcd.com/810/>

Is there any kind of captcha on the submission for RMS? If not perhaps a direct link to the other RMS's and a requirement to post there.

<comment><USER25> Agree. Also add a moderation queue. It doesn't go live as an RMS unless you pass either captcha + moderation or karma check. A great way to gain karma would be to review the moderation queue.

<comment><USER11> How do you stop spammers from building up their karma by reviewing that moderation queue by upvoting their own spammy submissions?

<comment><USER26> Meta-moderation? But thats a lot of effort, and you'd really have to want to see feedback.

</comment></comment></comment></comment><comment><USER27> I don't have a startup but dreams of doing it dance in my head. After reading this and realizing that I could miss out on the benefits of the hn community when the time comes because I've just lurked for the past 700 days, I'm logging in now to get more involved. Not sure if that's the result @pg would like to see, but that's how this policy strikes me. Hopefully others like me can figure out when to lurk and when to speak.

</comment><comment><USER28> But how are "rate my startup" posts different from any other posts?

I mean, if you invent special treatment for RMS-posts then why wouldn't the spammers simply go back to submitting their stuff without that prefix?

<comment><AUTHOR> They're different because they can be to sites that would otherwise be offtopic.

</comment></comment><comment><USER29> I see a few things happening: we've got a separate link for "Ask HN" topics, another one was created for "offer HN" topics, and now we're talking about having one for RMS topics.

Perhaps it's time for a more generic categorizing system of some kind? You could make it so that people can't post in certain categories without meeting a certain karma threshold.

</comment><comment><USER30> I am a total HN lurker (read HN every night before bed). I think I have 2 posts total, and a whopping 3 karma. I was just about to login and make a RMS post for a weekend project I just completed.

Then I read this thread and I am going to hold back. I do not want to make a post that you would delete.

I really enjoy HN and I can see the need for me to give back to the community before I can post. However, posting/writing/articulating has never really been my strong point. Writing a public post like this is a huge process for me (rereading, spell checking, editing)... A simple post can take me 20-30 minutes to write.

Instead of posting, I find other ways to give back to HN. I actually read the new queue and upvote interesting / non spam items. This is something I enjoy. I wish those metrics could be weighed into who can post a RMS and not just karma. That might be asking for way too much.

</comment><comment><USER31> Paul, I understand that you consider Hacker News your baby and are loathe to relinquish some control over it. However, because you have other obligations that are more pressing than playing with the News.YC code, maybe it is time to start considering moving this "site" in the direction of well-established open source projects. The Python model in particular comes to mind as reasonable.

As issues arise on the site, some form of public debate on the issue ensues and someone is tasked with implementing the change to the Arc/Hacker News site code based on the final approved solution. You give the submitted patch a careful look over and once everything is satisfactory, it goes live on the site. Just something to think about.

</comment><comment><USER32> not suggesting that HN should copy other sites out there... but twitter and the like have a "report as spam" feature.

this, in conjunction with a min karma requirement, could possibly be a useful tool to enact more drastic measures towards combatting spam on the HN site. no idea what form this would take. enough "report as spam" votes by high-level users might ban the user directly, or maybe just generate an email to some administrative review process that would make the final decision.

i, too, have noticed a recent surge RMS posts and, though i'm a newcomer to the site myself, find them rather annoying as well.

of course there are probably RMS posts being generated by well-intentioned HN readers who aspire to be an active part of the community but lack a firm history of contributions at the time they make them. it seems like there are also people who try to game the system looking for a cheap, but highly visible, promotion. even if that's not the case, asking the community to review one's ideas before an individual has made any significant contributions to the community seems contrary to the notion of "karma".

for what it's worth, i'll do my part to not clog up the feed with premature/shameless RMS posts :D

</comment><comment><USER33> Is this a request for input?

I personally haven't come across any "rate my start-up" posts I'd considered spammy, but maybe that's because the measures that are currently being taking have been effective (marking as dead, lack of upvotes for spammy posts). Mostly I've only seen that kind of spam in comments.

As for RMS posts in general, I really enjoy seeing what other people have done. So I would be opposed to an outright or unnecessarily restrictive ban.

<comment><USER34> I suspect it's at least partly a heads-up in case a reasonable story was mistakenly killed.

</comment></comment><comment><USER35> I like to see others people work. Sometimes RMSes are linking to things that are just weekend small projects, but still it is nice to publish them and ask for opinions of other members.

I think that spam posts will disappear in few minutes from the frontpage, because nobody votes them up. In this case a kind of collaborative filtering by HN community will do its work.

I believe that by not allowing new users to submit links is a radical approach. There are many kinds of users, for example I crated this account recently (because I lost my old password and did not find a way to recover it). Usually I visit this page 2-3 times a week just for reading. By forbidding new users to post the community will be divided in two classes "the privileged one" (those who have time to read and write comments) and "the rest" (no write access, because probably they do not have enough time for writing comments (my case)).

I think that "classical" approaches will minimize the spam. For example CAPTCHAS will stop spam-bots. And throwaway accounts may be limited by verifying email addresses of members.

</comment><comment><USER36> As someone who posted one of those RMSs that got closed, I understand your reasoning but am not pleased with the execution.

My RMS was not spam. I'd been participating on the site and had posted feedback to multiple RMSs posted by other people. I only had 50 karma, because many of those RMS posts never made it to the front page or ever got more than a few comments.

I was already getting great and very useful feedback on my own RMS and it had spent some time on the front page with about 23 upvotes. Then it was closed with out warning. I never received an e-mail - or a comment telling me why it was closed. Only that commenting to it was suddenly shut off.

Five seconds would have shown that my RMS was not spam. Reading the comments alone would have shown that. At the very least, I think users posting with in what appears to be the current rule of things deserve the courtesy of a comment or e-mail explaining why their post was killed.

What is the karma threshold or an RMS post?

</comment><comment><USER37> As a fellow hacker in the trenches I like to see what others are doing. The rate my startup posts are a great way to see what is going on and some of the current trends. I have learned a lot from the posts, not only evaluating the site myself but the feedback that is received. Some of it has been spammy or half-baked. Maybe a karma threshold is in order. Better yet as a site of mentors maybe a RMS should be sponsored by a "senior" member. Karma of the sponsor would be on the line if it is spam as judged by his down voting peers but share the rewards of karma if it is a worthy site.

</comment><comment><USER38> Sounds fair.

I'm glad my recent 'weekend project' got through. I've implemented the majority of the feedback I've gotten and like my site a lot more now. What's more is my "I made $1" multiplied to the point where it paid for the domain and a month of hosting & a little bit more.

There's still a few weeks work before I could call my redesign 'finished' but I'm really looking forward to the point where I can post another follow up and show off all the value HN has given me. Quality advice is really just invaluable.

RMS (weekend project) posts are what gave me the inspiration to do them myself.

</comment><comment><USER39> Perhaps you could add a moderation queue for RMS posts from users below a certain karma? It would kinda suck to completely block ALL of the RMS posts from new users.

</comment><comment><USER40> I'm working on an app (www.sparkmuse.com) to handle some of these "Rate My Startup" type posts. I'm hoping it will go to beta with the November Launch Group, but it will probably be a bit later because of the irl job. Anywho, I don't want to steal pg's thunder, so if you guys have any ideas for more specific "Rate My Startup" features apart from the HN format, please let me know.

</comment><comment><USER41> Oh boy... it took me almost a minute to resolve RMS to "Rate My Startup"... I guess I've been working with FLOSS for too long already ;-)

</comment><comment><USER42> I think if a conclusion is made about the policy posting them somewhere easily noticible will really help readers like me. I was a passsive reader for this site for a while before I signed up which was also to get feedback on my site. I see the point about spammers and think its fair to ask readers to contribute but just that the policy should be clear to new users

</comment><comment><USER43> Why not create a peer review, recommendation type system? To post an RMS post, you need an "OK" vote worth 1000 karma points. If you have more than 1000, you can post. If not, you need to to show your post to other people you know or met in HN and if they "OK" vote it, their karma gets added to your post's karma tally.

People can "OK" vote your RMS post by visiting your profile.

</comment><comment><USER44> I'd rather see a fairly low karma and a few weeks or months account age thresholds, but then I'm biased, being mostly a lurker here.

<comment><USER45> Spammers would just create accounts months in advance, and then use them when they mature. They're not above that sort of thing for high-traffic sites like this.

<comment><AUTHOR> In fact they do it constantly.

</comment></comment></comment><comment><USER46> I have been collecting RMS type posts for my weekly Hacker Newsletter and I have seen exactly what PG is referring to. The numbers have been increasing and the quality of the bottom half of posts are questionable. I've done some pruning as I curate them and was planning on raising the bar more. Seems like a great idea for everyone.

</comment><comment><USER47> Many answers to this new policy proposals mention some version of the argument that _if you don't participate, you shoudn't be able to solicit the help of others_.

While this is true to some extent, it undervalues the fact that RMS posts create value for everyone, since the comments are then available for everyone (not just the poster).

</comment><comment><USER48> Maybe new accounts can submit RMS posts if established users "second" and "third" the submission, validating it.

I do think new users with real startups can really benefit from the community, and there should still be a way to submit them before their startup isn't a startup anymore while they're taking their time generating karma.

</comment><comment><USER49> So this is structured procrastination in action? [http://lesswrong.com/lw/1fe/antiakrasia_technique_structured...](http://lesswrong.com/lw/1fe/antiakrasia_technique_structured_procrastination/) :)

</comment><comment> mark-r I signed up for HN over 2 years ago, made one post, then promptly forgot my login. I've tried on a few occasions to remember, but this is the incentive I needed to finally figure it out - thanks.

</comment><comment><USER50> Wouldn't allowing downvotes on submissions (or a spam flag a la craigslist) solve this problem?

Long time lurker so I had to create an account to post this. I wonder if there has been a spike in sign ups today :)

</comment><comment><USER51> how about you just disallow all frontpage submissions until a certain karma level? make people comment before they're allowed to submit links or text content, since those are the easiest to game.

comments are easier for the community to moderate and its easier to pick out spammier ones, since they're clearly off topic or include random inappropriate links.

<comment><AUTHOR> Because then spammers would start to post comments instead, and those are harder to catch.

<comment><USER51> are they? we kind of tend to smash down comments that are even slightly off topic or non-contributory.

they might sneak in on the less popular submissions, but i kind of feel like it won't get by any more of a problem than it already is. if comments were more a effective way to spam, they'd already be a problem.

alternatives: disallow links in comments until a certain karma/age. disallow both comments and submissions (ha) until you've voted on enough statistically different things. make it a game by creating a new metric that people can be measured on based on the number of spammers they've sought out and identified via flagging, and create a new top list for it.

</comment></comment></comment><comment><USER52> Having karma as the measure of legit accounts will force spammers to make more submissions, most likely in automated mode.

</comment><comment><USER53> Perhaps in addition to the user's credentials you could analyze the url they are submitting. Has it been submitted before?

<comment><USER54> crazy idea: maybe also check to see when the domain was registered? more than a year old doesn't sound like a 'startup'. it could be another metric in the decision engine.

in fact.... i sense a new startup/weekend project. 'spam link analyzer service' which incorporates user defined metrics (e.g. HN metrics)

<comment><USER16> If this was implemented, I'd imagine the quality of names for RMS candidates would drop off a cliff!

I've got to imagine that everyone who reads these forums has at least 2-3 domains that they've owned for a while for future projects.

</comment></comment></comment><comment><USER55> What qualifies as an "established" account? I have been here for a while but don't post that often.

</comment><comment><USER56> Maybe another section like the "new" section?

But don't name it rms, that means something else on any hacker site.

<comment><USER57> Indeed I was phreaking out thinking pg was deleting Stallman's posts !! ;-)

</comment></comment><comment><USER58> If RMS is getting so popular, how about creating a special section just for that type of posts?

</comment><comment><USER59> The place for this would probably be ratemystartup.com (yes, it exists, no it's not my site)

<comment><USER60> Totally to my surprise to see this comment... ratemystartup.com is actually my site.

I can speak first hand to this issue... A massive number of submissions to ratemystartup are spam. I evaluate each of these submissions by hand and it's not always easy to do.

On ratemystartup users have editorialized content. On HN I would suggest that link posts are only permitted to users with X amount of karma. I am personally more of a HN reader than a contributor but I would gladly sacrifice the ability to post links (unless the karma threshold is reached) in exchange for maintaining a great HN reading experience.

</comment></comment><comment><USER61> I think it's better to put "rate" or "RMS" in the header/menu to distinguish from others.

</comment><comment><USER62> Would RMS post be classified differently then view my weekend hack posts?

</comment><comment><USER63> @PG What do you consider an established account on HN?

</comment><comment><USER64> Maybe it's time to have spam url filter setup.

</comment><comment><USER65> What's the point of "flag"? By killing legit RMS posts from low-point posters, you're creating a lot of ill will, particularly when they follow up with "Why was this thread killed?" posts.

</comment><comment><USER66> I'm new to HN and I wouldn't post my startup link, as I've yet to contribute enough to the community to earn the time other members would need to review my startup. That being said, I do believe that a karma threshold for RMS posts would be a valuable asset to HN.

</comment><comment><USER67> Can't we have a 'this is spam' button? I guess it's not much bother if each spam is only read by one or two people before it's trashed / moved to the 'spam' section. Perhaps there could be a karma threshold before you're allowed to mark something as spam. This would solve the problem for all types of spam rather than just for RMS spam.

</comment><comment><USER68> Welp... just registered today so that hopefully when I try to post my own startup thread, I can. I'll try to post more from now on instead of lurking but I'm pretty busy. :|

<comment> n-ion Yeah - same here... Aren't lurkers users too?! I feel separate but equal.</comment></comment>


XBoard: A Recordable, Video-Like, HTML5 Canvas Whiteboard - <AUTHOR> http://erniepark.com/xboard/index.html

<comment><USER2> The idea is neat, but the playback option doesn't show me the drawings in Firefox 12.0 on Windows XP (cube computer).

<comment><AUTHOR> Yeah there are some bugs in Firefox. I only had time to develop in Chrome and I think FF has some issues with Javascript setTimeout(), but it very well could be on my end. I'll try to pinpoint when I get a chance.

If you click play, then jump to a different spot in the video, you'll see the canvas redraw and it should work.

<comment><USER2> You might check this out: <https://developer.mozilla.org/en/DOM/window.setTimeout>

</comment></comment></comment><comment><AUTHOR> This was done for a school project. I don't know of any similar projects online. If anyone knows of any, I'd love to hear about it.</comment>


A Collection of Exercises for Learning Erlang (Or Any Other Language) - <AUTHOR> http://codyrioux.github.com/a_collection_of_exercises_for_learning_erlang/

<comment><USER2> Personally, I've always liked creating a simple web server as a nice step in learning a language/stdlib. Some concurrency, some I/O, some string parsing, etc. Obviously it's not the _first_ thing one does, but I find it a nice package to put together that actually achieves something real.

<comment><AUTHOR> Thats a fantastic idea for a decent sized project that will expose you to many aspects of the language and tools commonly used with the language. I'm going to include that one in the list.

</comment></comment><comment><USER3> The really tough part of picking a new language is learning the idioms.

If I handed you a book describing the French grammar and an English to French dictionary and told you to write some short stories, you might be able to put together something parseable by a Frenchman but you wouldn't be writing French.

I don't pretend to have a good answer except reading and modifying other people's code seems to help.

</comment><comment><USER4> This could be a long list: SPOJ, topCoder, ICFP, google and Facebook etc comps,

Language specific: 4clojure.org, blow your mind etc

<http://www.haskell.org/haskellwiki/Blow_your_mind>

<comment><USER5> You could include Project Euler in that list as well. <http://projecteuler.net/>

</comment></comment><comment><USER6> This is my favorite: [http://www.knowing.net/index.php/2006/06/16/15-exercises- to-...](http://www.knowing.net/index.php/2006/06/16/15-exercises-to-know-a- programming-language-part-1/)</comment>


Introducing RESTful JSON - <AUTHOR> https://medium.com/@Stephen_Mizell/introducing-restful-json-def4e6e52fa6 <comment><USER2> Is it too soon to ask about a GraphQL alternative to a hypermedia APIs?</comment>


What to Do When You're the Only Designer They've Got - <AUTHOR> http://firstround.com/article/What-to-Do-When-Youre-the-Only-Designer-Theyve-Got <comment><USER2> The basic takeaways are:

1\. Take input from everyone. 2\. Envision how you want the company to function, then make it so. 3\. Ship stuff.

These points are so fundamental, and repeated nearly every day on Hacker News. Yet nearly every company I've worked at misses one of these points, and even when I work on my own projects I have to _force_ myself to take feedback and to "just ship it". I don't have anything super meaningful to add other than the realization that this is all really good advice, and after having it pounded in my head over the past 2 years I _still_ have trouble putting it into action. My ego must be huge!

</comment><comment><USER3> I enjoyed the article, but I was sort-of hoping that this was an article giving practical design advice to non-designers, because that' what I gandered from the title and that's the position I'm in right now.

I'm handling the (re)(re)design of our site[1]. This is a bit tough because my main job is JS library developer. There are no designers at my very small company, and my own time is constrained as one might imagine. So instead of a real design, I try to re-look at it and pass it around for advice and update it shortly after version releases.

Since I can't give it my full attention, I'd really love to read an article on what do do when you're the only designer they've got, _and you 're not a designer by trade._

(On the plus side, its nice switching contexts to something more artistically focused from time to time.)

[1] The library has been out for a year and I think just now my designs are finally starting to look "not completely shameful". Old: [http://gojs.net/latest/](http://gojs.net/latest/) New: [http://gojs.net/beta/](http://gojs.net/beta/)

At least I can take #3 to heart. Good for now, and it will get better. (and maybe I will, too)

<comment><USER4> > So instead of a real design, I try to re-look at it and pass it around for > advice and update it shortly after version releases.

Feedback and iteration are crucial parts of a real design process.

> (On the plus side, its nice switching contexts to something more > artistically focused from time to time.)

Even visual designers spend a lot of their time doing analytical methodical development of grids, colors, and pixels. Art and aesthetics is only a small part of it.

</comment></comment><comment><USER5> I created Product Design Guild to help with this problem: [http://www.productdesignguild.com/](http://www.productdesignguild.com/)

Designers learn best by working with other designers but this is becoming increasingly rare. The PDG holds events where designers come together, everyone brings work and you work collaboratively with other designers in a studio style environment.

We're current 500+ members strong across Bay Area, New York & London. It's one of the only places in the world where you regularly get to see work-in- progress from companies that you don't work for.

</comment><comment><USER4> Two points.

First, this is a very bad situation for a junior designer since they basically get no mentorship. The studio model is very important for developing design talent. Don't take on junior talent without senior talent if possible.

Second, expecting designers to code, a common meme repeated often on hackernews, is even more disastrous in this case; they are overloaded already with design work (and even if you have a few designers already, they will still probably be your bottleneck).

<comment><USER6> As a designer who codes I've never understood this mentality. I sketch out wireframes, take them to PhotoShop, and flush out the HTML, CSS, and JS. Perhaps if the structure of your team isn't suited for this workflow it could end up hindering the design process but I find it to be quite enjoyable.

<comment><USER4> So you do design and production (is HTML/CSS and a bit of JS really coding?), great! I have a feeling most web designers are in that boat, though I've never worked in that field before. Not all designers are web designers though.

<comment><USER7> there is definitely a difference between knowing how to make a prototype and being able to code at a production level. Again, without mentorship it's difficult to learn the difference.

<comment><USER4> Most developers are clueless as well. I can imagine a junior designer getting into a lot of trouble in a small dev shop given all the misunderstandings.

</comment></comment></comment></comment></comment><comment><USER8> I totally feel for #3. Probably the best advice you can give sole designers at any growing startup: "'good for now' earns opportunities for 'great' later on"

</comment><comment><USER9> Great suggestions that should be considered fundamental for almost all roles, in any size company.</comment>


Entropy: An Introduction - <AUTHOR> https://homes.cs.washington.edu/~ewein/blog/2020/07/14/entropy/ <comment><USER2> Hi HN, I'm the author of this piece (Ethan Weinberger). I wrote this originally as a set of notes for myself when brushing up on concepts in information theory the past couple of weeks. I found the presentations I was reading of the material to be a little dry for my taste, so I tried to incorporate more visuals and really emphasize the intuition behind the concepts. Glad to see others are finding it useful/interesting! :)

<comment><USER3> Thanks, I enjoyed reading. As an electronic engineering student, I remember grappling with information theory in the abstract: it was a weather example very similar to yours that gave me the intuition I was missing.

An observation/suggestion. The intro is accessible to many people; that drops off a steep cliff when you hit the maths. Now, I'm not complaining about that: it's instructive and necessary to formalise things. Where I struggle is in reading the equations in my head when I don't know what words to use for the symbols. For example, that very first `X ~ p(x)`. I didn't know what to say for the tilde character, so couldn't verbalise the statement. I do know that $\in$ (the rounded 'E') means 'is a member of' so I could read the next statement. The problem gets even more confusing for a non-mathematician as the same symbol is used with different meaning in different branches of maths/science (e.g. $\Pi$).

I get that writing out every equation in English isn't feasible (or, at least, is asking a lot of the writer). But I wonder if there's middle way, e.g. through hyperlinking?

As I say: not a criticism and I don't have a good solution. Just an observation from a non-mathematician. Enjoyed the piece anyway.

<comment><USER4> "X ~ p(x)" means "X is a random variable drawn from the probability distribution p(x)" or maybe "X is drawn from p(x)" for short.

Are you sure it's a matter of knowing what to _say_ (in your head) vs knowing the definition of the notation in the first place? I am pretty familiar with this notation, but I rarely verbalize it mentally. I can tell because I read and understand it quickly without problem, but on the rare occasion when I have to read it aloud I realize I'm not sure how I should pronounce it.

<comment><USER3> Thanks for the explanation.

Agree it's more "say in my head" than "speak out loud". But I still need to know what to say - internally or externally. Without knowing that ~ denotes "drawn from", all I can say is "X tilde p of x". That has no semantics; no intuition. Whereas knowing that $\in$ means "is a member of", I can read "x \in X" as "x is a member of X".

> but I rarely verbalize it mentally

Neither do I when I know something well. For example, I don't explicitly verbalise "is a member of" now, even internally. There's a shortcut hard-wired in that understands it without needing to pronounce it explicitly. In fact that short cut goes beyond the syntax: it goes straight to the intuition of "x represents any member of the set X". But I had to go through the process of saying it on the way to the shortcut.

<comment><USER4> OK, but if you know the formal definition, and you're not reading it out loud, why not just make something up? I actually don't know whether "is drawn from" is the "correct" way to pronounce the tilde. I think maybe other people say "is distributed as".

</comment></comment></comment></comment></comment><comment><USER5> Might be worth clarifying in the title that this is about entropy in the context of information theory.

<comment><USER6> In which context is it a different concept?

<comment><USER7> In thermodynamics there are two other formulations of entropy: the Clausius one in terms of temperature and heat, and the Boltzmann one. The latter defines entropy as the log of the number of microstates a system could be in a particular macrostate.

The Shannon definition is equivalent to the Boltzmann def only in the case that the micro state consists of infinitely many identical subsystems. If there are only finitely many, for instance, the log of the quantity does not correspond to the same "-p log p".

The Clausius def can be derived from the Boltzmann one, but they are nevertheless also distinct formulations.

<comment><USER6> [https://en.wikipedia.org/wiki/Boltzmann%27s_entropy_formula#...](https://en.wikipedia.org/wiki/Boltzmann%27s_entropy_formula#Generalization)

According to Wikipedia, if you start with the Gibbs entropy (which is the same as Shannon entropy), and then assume all microstate probabilities are equal (which Boltzmann does), you get the Boltzmann entropy formula. It also says Boltzmann himself used a p ln(p) formulation.

So aren't they the same, perhaps up to a constant factor?

<comment><USER7> If you count the number of microstates for a given macrostate you get a hyper geometric number N!/(n_1!n_2!...) The log of this is the Boltzmann entropy. However, if you consider N to be very large or infinite, you can show using the Stirling approximation that this ends up being the Gibbs/Shannon entropy in that case. So, in general, no.

</comment></comment></comment></comment></comment><comment><USER8> I imagine the timing of this post is correlated with release of the documentary Bit Player about Claude Shannon. Haven't seen it yet but looking forward to it.

The article does a decent job at graphing and laying out some of the concepts of entropy for information theory, but I'm not sure who the target reader is, since prereqs are perhaps only slightly narrower than what one needs to read Shannon's paper[0] and the article is really illustrating only a fraction of the concept.

It can perhaps work as a primer for what shows up starting on pages 10-11 of the original document, in any case, provided you grasp the mathematical definition of entropy through thermodynamics, and the microstates-based definition through Boltzman, as well as "basic probabilities" (expected value, typical discrete distributions, terms like "i.i.d"), you should be good to go. But then you might already know all this..

And if you do, and you like what you read, then the full original thing by Shannon is a delight to explore to truly grasp what has been so foundational to a lot of things since 1948.

[0] [http://people.math.harvard.edu/~ctm/home/text/others/shannon...](http://people.math.harvard.edu/~ctm/home/text/others/shannon/entropy/entropy.pdf)

</comment><comment><USER9> Not sure if it's appropriate but here's my own take at a very terse restatement of Shannon's original paper [1]:

        https://mechaelephant.com/dev/Shannon-Entropy/

I recommend everyone that's interested to read Shannon's original paper. It's one of the few examples of an original paper that's both clear and readable.

[1] [https://homes.cs.washington.edu/~ewein/blog/2020/07/14/entro...](https://homes.cs.washington.edu/~ewein/blog/2020/07/14/entropy/)

</comment><comment><USER10> For the example of H(X) where X ~ Geom(p), shouldn't the second term be multiplied by (k-1) after breaking up the logarithm? That is, shouldn't

      pq^(k-1)log(q)

be

      (k-1)pq^(k-1)log(q)

Apologies if I'm off base here, I'm pretty rusty on infinite series.

Great piece, this is really making this concept more intuitive for me.

<comment><USER2> You're 100% right. Fixed!

</comment></comment><comment><USER11> Love the post. Just FYI, your post is not mobile-friendly. When scrolling down on iPhone it's impossible not to accidentally shift the viewport away from the left margin making the left side hard to read

</comment><comment><USER12> Neat fact: entropy and expected algorithmic information are asymptotically equivalent. Two quite different approaches to information theory converge.

</comment><comment><USER13> Possibly unrelated, but I love the simple an clean layout of the website. Does anyone know how to create something similar to this?

<comment><USER2> I (shamelessly) stole the layout from Gregory Gundersen's wonderful research blog ([https://gregorygundersen.com/blog/](https://gregorygundersen.com/blog/)). He has instructions on how to replicate it here [https://gregorygundersen.com/blog/2020/06/21/blog- theme/](https://gregorygundersen.com/blog/2020/06/21/blog-theme/)</comment></comment>


Markets are doing horribly right now, below DOW 17,000 - <AUTHOR> http://money.cnn.com/2014/07/08/investing/stocks-markets/index.html

<comment><AUTHOR> As sharp as the decline is, I am not sure if this is a buying opportunity. Most investors made big gains so more can easily afford to cut their losses.

I keep hearing realestate and low rates, so that may easily be an outlet for the money to go to. I guess we'll see.</comment>