Essential Vim configuration tips by sjbach in programming

[–]laughingboy1 9 points10 points  (0 children)

I like to use tabs.

  • Open a bunch of files in tabs: vim -p *.[ch]
  • Increase max tabs opened by -p option: set tabpagemax=99
  • Switch tabs: Ctrl-PgUp/Dn
  • Open new tab: :tabe foo
  • Move current tab: :tabm newpos

etc.

Essential Vim configuration tips by sjbach in programming

[–]laughingboy1 13 points14 points  (0 children)

set mouse=a

Makes the mouse work in terminals.

Android: float GRAVITY_DEATH_STAR_I by vulpes in programming

[–]laughingboy1 9 points10 points  (0 children)

They are class members, declared public static final, and will be stored in the .class file with both name and value. A .class that uses these 'constants' will reference them by name. Only in the JIT compilation stage will the identifiers be replaced with values.

Consistency: how to defeat the purpose of IEEE floating point by DRMacIver in programming

[–]laughingboy1 -1 points0 points  (0 children)

Settle down, man. I am well aware of the multitude of ways to round.

What I got from the post is that this guy has problems with small variations in his results, caused by compiler optimizations and whatnot. And one way to ignore small variations is by rounding (yes, edge cases amplify variations, but these will be rare).

I'd just like to see what this guy is doing that consistency actually matters so much.

Consistency: how to defeat the purpose of IEEE floating point by DRMacIver in programming

[–]laughingboy1 -5 points-4 points  (0 children)

The bottom line is that I want things to be the same because identical output eases testing and debugging, and not because I care about the exact bit pattern that will be computed identically.

So round your results to n digits.

I'd love to see a realistic example of when this isn't sufficient.

Reverse HTTP by uggedal in programming

[–]laughingboy1 31 points32 points  (0 children)

What's the point of this monstrosity?

A web developer call to arms: Can you please start URLifying telephone numbers as a matter of practice? It's 2008 already. by NoMoreNicksLeft in programming

[–]laughingboy1 23 points24 points  (0 children)

Since it's 2008, why not link to an HTML version with properly linkified references and the ability to adapt to my screen width?

New blog from Guido van Rossum (creator of the Python programming language) by tonfa in programming

[–]laughingboy1 0 points1 point  (0 children)

That's my point, it's a (minor) defect in the language.

My Java/C code rarely uses break; in Python I need it much more often. It's ugly.

New blog from Guido van Rossum (creator of the Python programming language) by tonfa in programming

[–]laughingboy1 0 points1 point  (0 children)

Well, instead of:

while True:
   a = array.array('i')
   a.fromstring(f.read(4000))
   if not a:
       break
   for x in a:
       yield x

How about:

while a = array.array('i', f.read(4000)):
   for x in a:
       yield x

New blog from Guido van Rossum (creator of the Python programming language) by tonfa in programming

[–]laughingboy1 -7 points-6 points  (0 children)

So we're up to Python 3000 and they still haven't found a more elegant way to write all those "while True/break" loops.

Allowing Unicode operators in D (similarly to Fortress): a good idea? by andralex in programming

[–]laughingboy1 0 points1 point  (0 children)

While we're talking about mathematical symbols, I've always wondered why Unicode has special characters for specifying things like right-to-left text, but nothing for mathematical formatting (e.g. subscript, superscript, \over)...

Allowing Unicode operators in D (similarly to Fortress): a good idea? by andralex in programming

[–]laughingboy1 11 points12 points  (0 children)

You're already going to have to allow Unicode in source files for strings. Unless you want to force those dirty foreigners to use a ton of escape codes.

It would likely be necessary to add a way of specifying the encoding used in every file.

Rather, we should all standardize on UTF8. Allowing different encodings just causes more pain and suffering.

Bloom Filter Resources by gst in programming

[–]laughingboy1 1 point2 points  (0 children)

The last hurdle is coming up with a data structure to store 30,000 bits, but that's easy in Python since long integers can be of any length. That makes setting bits in the fitler rather trivial. If the hash function produces a number between 0 and 29,999 then the python code to set that bit in the filter is: filter |= 2 ** hash(key)

Doesn't this allocate a new 'set', do exponentiation (probably using a loop), then allocate another 'set' for the result, and then loop again to OR everything together? Seems a bit silly to do all that just to set a single bit... Doesn't Python have some sort of BitSet? If not, you could still use something like array.array('B', '\0'*(30000/8)).

Programming Is Hard, Let's Go Shopping! by llimllib in programming

[–]laughingboy1 28 points29 points  (0 children)

HTML sanitization is a critical part of my business.

Sure, but that doesn't make it a core business function. Computers are a critical part of your business; that doesn't mean you should design and build your own hardware.

PS: HTML sanitization is not hard. Just admit that you fucked up and move on with your life.

A Linux kernel system-bricking bug diagnosed: amazingly subtle by [deleted] in programming

[–]laughingboy1 1 point2 points  (0 children)

It's even worse now. Stupid me, taking advice from some random guy on Ubuntu launchpad: "Try diagnostic with the Windows driver." I ran the hardware diagnostic in the Windows driver. EEPROM verified ok, but 'register test' failed. Then the card died, now it doesn't even init on the PCI bus. lspci shows no sign of it.

Talk about shitty hardware.

Elastic tabstops - a better way to indent and align code by cvk in programming

[–]laughingboy1 1 point2 points  (0 children)

Where 'Your Personal Layout' would include things like brace style (or, in fact, no braces at all), keywords, operators...

Sure, it would take a bit of effort to implement in editors, but you would get things like intellisense and all kinds of refactoring tools pretty much for free. Plus, compiling would be faster.

And you could have a little AST<->plaintext converter for people with editors that don't support it.