Hacker Newsnew | comments | show | ask | jobs | submit | morsch's commentslogin

Paying 5 bucks per CC means nothing to you or me, but it would exclude a world of people from a learning resource, which is always sad.


hyperliner 17 hours ago | link

You can make it optional or "Pay what you can" or "Pay it to the world" (somebody you see on the street)


Kind of strikes me as something the editor could do ad-hoc. Maybe the tab character could return to let programmers tell the editor to align the adjoining lines according to the tabs. Would work well at least in your example.


seanmcdirmid 1 day ago | link

Elastic tab stops: http://nickgravgaard.com/elastictabstops/

You could also pad your spaces in the editor so that they align along a global axis. This does fix your code to a particular editor, however.


robert_tweed 1 day ago | link

Yeah this is nice. All we need now is for this to be supported in all major text editors and we're set!

The only possible issue (not sure how it's handled, can't remember if/how gofmt handles it either) is when sometimes you actually want something to be misaligned because the width is so far out of the norm, e.g:

  int const1   = 10;  // There's lots of space here for a long comment
  int const2   = 5;   // Here too, unless the tabs get moved too far right
  float const3 = ( const1 * 123.45 ) / MAGIC_CONSTANT; // Not here.
Normally when this happens I try to regroup the code so that "plain" constants are together and long formulas are in another group, but sometimes the order is important for some reason or doesn't make logical sense to regroup items, so the formatting has to suffer a bit.


morsch 1 day ago | link

As long as you rely on the tab character to signal the programmer's intent on inserting an elastic tabstop, that's not an issue. In this case, insert a \t in front of the comments on the first two, but not the third line. All three lines could have \t's in front of the equals character so align on it.

The other nice thing is that it degraces quite gracefully in non-supporting editors.


morsch 1 day ago | link

Exactly what I was thinking of, brilliant!


morsch 7 days ago | link | parent | on: Unix Tricks

Any movement key will do the trick. I usually use cursor-right or the end key.

It's so ingrained I had to actually do it in a shell to know what it was I did.


danielweber 7 days ago | link

ISTR pressing one of those keys would obliterate the part of my line where I was writing, putting in ^B characters.

I can't replicate it now on my test box; it works exactly the way you say it should. It may be a terminal issue; I'm currently on Windows using cygwin to ssh to Linux.


That's begging the question. Why is it fun?


oldmanjay 8 days ago | link

Asking people why they like what they like is a pointless exercise.

And generally, in my experience, it comes from a place of arrogance on the part of the person doing the asking, because the next phase is talking down about how the "reasons" aren't valid.


saraid216 8 days ago | link

Game designers can answer the question.




Off the top of my head.


10098 8 days ago | link

It's just the way we are. We like dominating and winning. There's at least a little bit of bloodlust in everyone, without those traits we wouldn't be able to become the dominant species on our planet.


Not once have I seen this anywhere in Europe. I'm sure you're talking from experience and it's a thing, but it seems to vary from place to place. It sounds a bit inefficient.


PeterisP 8 days ago | link

The problem with busy crossings is that if both cars and pedestrians have 'green' at the same time, and the traffic is busy (i.e., someone would be walking/driving for most part of the green light), then it's very inefficient for cars needing to make the right turn, that need to cross with the pedestrians. In some street plans (e.g., interleaving one-way streets w. no left crossings) the right-turn traffic is very heavy and has a separate lane; so delaying them is bad.

There are two okay solutions - either you desync the lights, so that there's some gap where the pedestrians have a red light but cars already/still have green, so that they can make that turn; or you make a 3-phase crossing; A-cars have green in one direction; B-cars have green in the other direction; C-all cars stop and pedestrians can cross across and diagonally. It works okay.

What's not a solution - 'right turn on red' doesn't solve it; this problem matters in heavy car/foot traffic, and in such traffic there aren't any safe opportunities to do so.


vidarh 9 days ago | link

I don't think it's that common - I've only seen it a couple of places, but it happens. Most places in Europe I've been, there's car traffic going in parallel with the pedestrians.

The most "famous" example in Europe of all traffic being stopped at once, I suspect is Oxford Circus in London, where they changed to start doing this a few years ago.

The reason to do it there, though, was to allow pedestrians to walk in any direction (diagonally as well) across one of the busiest crossings in the country. This BBC article refers to it as a "Japanese-styled system":



andrewaylett 8 days ago | link

Most sets of traffic lights in the UK allow diagonal crossing, as in all traffic stopped at once, it's just not that common to encourage pedestrians to cross diagonally. What you never get in the UK is the condition described above, where pedestrians and drivers are directed to use the same bit of road.

There are also plenty of junctions where some car drivers are allowed to proceed while on other bits of the road, pedestrians are allowed to cross. So (typically) each road into the junction has a central island and the pedestrian controls for each half of the road are separate. On those junctions, it's never safe to go across the middle as there will always be some traffic moving.


jgh 8 days ago | link

There are a few of those intersections in the US and Canada as well, normally called "scramble" intersections here I think.


judk 9 days ago | link

Indeed, it is less efficient when cars have to stop for pedestrians and not drive through them.


I thought it was a good collection of historic developments -- military involvement and spending, the history of the Internet, the history of (domestic) surveillance, the revolving door between government and corporations, somewhat obliquely advertising and changes in the financial system -- but it could have done a better job tying it together.

I already knew most of history and would have preferred to read a much more thorough treatment of the parallels and/or relationships between these topics and agents.


morsch 9 days ago | link | parent | on: James Hague

His corrected version

  padded_size := (size + 2047) & ~2047
may be correct or it may not be, I can't really tell quickly because it's so oblique to me. Combining decimal and binary arithmetic like that is a bit too old school for me -- of course I still use it on occasion but I try to avoid it. I guess it's second nature to game devs.

What's wrong with

  padded_size := ceil(size / 2048) * 2048
apart from the fact that it's much much slower but still really really fast in what I can only assume is a part of the source where performance doesn't matter, anyway.


innocenat 9 days ago | link

   padded_size := ceil(size / 2048) * 2048
... may be wrong if size is large that can't be store in mantissa of double/float.

Assuming C (or equivalent), I usually do this:

    padded_size = ((size + 2047) / 2048) * 2048;


toolslive 9 days ago | link

this is generic. You can also take into account that 2048 is a power of 2. So you can shift right and then left again.


innocenat 9 days ago | link

All relevant compilers do that automatically.


drv 9 days ago | link

The corrected version is more recognizable to me as "round"; I believe this is a fairly common pattern in code that needs to round or align to powers of two.

However, I'll agree that it is perhaps overly clever. I recently wrote some code that used this pattern, except I had remembered it wrong and wrote something like:

    padded_size := (size + 2047) & ~2048
(2048 instead of 2047.) Luckily it was caught in code review, but it's worth being a bit more explicit; our solution (aside from fixing the number) was to add ASSERT(padded_size % 2048 == 0) so that it was clear what the code was trying to do.


morsch 9 days ago | link | parent | on: I/O Thoughts

That certainly explains why there are so many iOS exclusives. Here I was blaming the Android platform or foolish developers, when in fact Apple's aggressive business practices were -- at least partially -- to blame.

Also serves as a reminder what we, both as devs and users, gave up when we put ourselves at the mercy of approximately 2.5 app store operators. There's no need to remind me what we gained, I'm aware. The question is rather if we can get a system that combines the best of both worlds.


Here's my weekend project: http://deja-entendu.zomg.zone

Basically it accesses your last.fm profile to get a list of songs you listened to one/two/etc years ago and assembles a corresponding Spotify playlist. I've been pretty diligent in tracking my played tracks on last.fm, and it's neat to jump back in time to see what I listened to back then. If you don't use last.fm, you can try it with my account (last.fm data is public): http://deja-entendu.zomg.zone/morsch/5y-ago

80% of the motivation is having an excuse to try out Scala's Play framework. :)


5 bucks says he's referring to Harry Potter and the Methods of Rationality. http://hpmor.com/



Guidelines | FAQ | Lists | Bookmarklet | DMCA | News News | Bugs and Feature Requests | Y Combinator | Apply | Library | Contact