a-bronx

TMI

"Too Much Information" actually means "My Brain Is Too Small For it".

a-bronx

Christmas song

a-bronx
a-bronx

Craaaaazy

a-bronx
I just took the 2012 election quiz and found that I side the most with Libertarian presidential candidate Gary Johnson. Who do you side with?
Zoom picture

I just took the 2012 election quiz and found that I side the most with Libertarian presidential candidate Gary Johnson. Who do you side with?

a-bronx

Code indentation and alignment

There are 4 code tabulation styles widely known (and this topic still generates flames):

1) no TABs, only SPACEs. Pros: code layout does not depend on a chosen TAB size. Cons: it is easy to screw proper indentation with a BACKSPACE; it is annoying to hit BACKSPACE 4 times instead of once (given tabsize = 4)

2) TABs are everywhere. Pros: easy and strict; you cannot screw indentation because it is always aligned to a grid Cons: changing tab size may produce weird result when TABs are used for alignment in a middle of a line

3) random mix of SPACEs and TABs. Pros: none. Cons: this approach is a pure evil.

4) TABS are for indentation level only, SPACEs are for alignment. Pros: same as in styles 1 and 2 — no dependence on tab size, easy, strict. Cons: unfortunately, code editors usually supports either style 1, or style 2, so you cannot just use TAB key everywhere and expect that your editor will be smart enought to replace TABs to SPACEs in proper places. At least, in VisualStudio it is so. May be other code editors are smarter?

I personally prefer TABS over SPACES, and, when coding alone, I just use the style 2. The “tab size problem” does not bother me because I just never use garbage editors/viewer which are not capable to configure the tab size.

In a team, I have to adapt to those members who still use the shitty Notepad and suffer from the “tab size problem”. On the other hand, I don’t want to lose all benefits of TABs, so I’d prefer to use style 4: TABs for indentation, SPACEs for mid-line alignments. Code editors are the only stoppers here.

So, what can we do at least for a VisualStudio Code Editor? Fortunately, there is a trick: you can use a combination of three commands:


>Edit.SelectAll
>Edit.ConvertTabsToSpaces
>Edit.TabifySelectedLines

So, you can use TABs for editing everywhere, and then, before committing the file, just run there 3 command in the VS Command Window. Command names are almost self-describing:

  1. Edit.SelectAll selects the whole code text
  2. Edit.ConvertTabsToSpaces converts all TABs to SPACEs
  3. Edit.TabifySelectedLines converts SPACEs back to TABs, but works only on leading SPACEs! That’s the trick.

Unfortunately, the solution is not ideal: it replaces all leading SPACEs to TABs, though there are cases when you should not do it. For example, if you break a long function parameter list into several lines, you’re actually staying on the same indentation level and want the parameter list be adjusted, not indented. Improving the algorithm will require source code parsing to find cases when a new line does not introduce a new indentation level.

Anyway, we still have a quite decent solution. But typing these commands again and again is unproductive. If you find yourself repeating — write a script. So it is better to translate these commands to a macro:


Public Module Editor
    Sub TabifyAll()
        Dim curPoint As VirtualPoint
        curPoint = DTE.ActiveDocument.Selection.ActivePoint
        DTE.ActiveDocument.Selection.SelectAll()
        DTE.ExecuteCommand("Edit.ConvertTabsToSpaces")
        DTE.ActiveDocument.Selection.Tabify()
        DTE.ActiveDocument.Selection.MoveToPoint(curPoint)
    End Sub
End Module

Now we can add the macro as a menu command, assign a keyboard shortcut for it, etc. I’ve put this command into “Edit” menu as a “&Tabify” menu item, so I can use “Alt-E,Alt-T” shortcut.

Also it is possible to write a similar macro which will “tabify” only a text selection instead of the whole file, but actually I don’t think it makes a lot of sense: you usually want to keep style consistent over the whole document (and even over a whole project/solution/workspace), not just a small selection. I’d prefer a script which performs this action automatically upon a file save. May be someone will write a VS extension for this, someday…

a-bronx

First Orbit - the movie (by firstorbit)

a-bronx
calamitiesofnature:

People have been stealing my artwork from this comic for their own purposes. To fight this I’m trying to share my original as widely as possible. In the spirit of the season, based on the number of page views I can get, I will be donating to Doctors Without Borders (see my site for more details). So please help me by sharing this comic, thanks!
Zoom picture

calamitiesofnature:

People have been stealing my artwork from this comic for their own purposes. To fight this I’m trying to share my original as widely as possible. In the spirit of the season, based on the number of page views I can get, I will be donating to Doctors Without Borders (see my site for more details). So please help me by sharing this comic, thanks!

a-bronx
iwdrm:

“Mr. President, I’m not saying we wouldn’t get our hair mussed. But I do say no more than ten to twenty million killed, tops.”

Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb (1964)

iwdrm:

“Mr. President, I’m not saying we wouldn’t get our hair mussed. But I do say no more than ten to twenty million killed, tops.”

Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb (1964)

9,808 notes Reblogged from iwdrm
a-bronx
iwdrm:

“Viddy well, little brother. Viddy well.”

A Clockwork Orange (1971)

iwdrm:

“Viddy well, little brother. Viddy well.”

A Clockwork Orange (1971)

11,749 notes Reblogged from iwdrm
a-bronx
iwdrm:

“Micro-changes in air density, my ass.”

Alien (1979)

iwdrm:

“Micro-changes in air density, my ass.”

Alien (1979)

3,500 notes Reblogged from iwdrm
a-bronx
“Tau day …! Time to eat TWICE as much Pi! :)” Top commenter on http://youtu.be/jG7vhMMXagQ
a-bronx

Happy Tau Day!

What is it?

What it sounds like?

What it tastes like?

a-bronx

Yes, but… wait!

Tumbled off one @yes-butno manifesto proudly saying “Yes, I’m a christian. Yes, I believe in evolution”, reblogged by 1000+s users. The message how I read it is “We’re open-minded enough to combine two contradictory worldviews in our heads, so nobody can blame us in dogmatism and hypocrisy”.

Disclaimer: if you’ve supported the manifesto but this is not what you’ve tried to say — you can stop reading here :)

OK, I saw this position many times, and I discussed it a lot, but I think it’s never too late and too much to repeat an old truth.

So, is it brave to be religious and believe in some contradicting scientific theory like Darwinian evolution or Big Bang theory? Is it open-minded and anti-hypocritical, now some commenters boast? Time to write my counter-manifesto, in the same “yes, but no” style :)

YES, you can believe in evolution/BigBang/etc, being christian or whoever else. After all, who’ll prevent you?

BUT

NO, this is not a bravery or open-mindness, at all. Rather blindness and big big misunderstanding, because it misses the main and crucial point of any scientific theory: YOU HAVE NOT TO BELIEVE in evolution or any other theory, even if it’s proven!

OK, let’s make it even stronger: you have to doubt any theory! Not just deny, like infamous AIDS-denialists, but DOUBT.

Doubt to be sure" — that is the hardest trick! This looks like a paradox, and only truly brave and open-minded can embrace it in its entire beauty.

Indeed, the more you doubt a theory, the more you test it. The more tests it successfully passes, the more durable and trustworthy it becomes. If at some point your favorite fails — you bite a bullet and derive a new, better theory, which passes all previous tests plus the failed one. The way of doubts and tests and elimination of inadequate and maladaptive (sounds familiar?) is what can give you 99% of trust that the theory works well in most cases — but you’ll never get 100% trust (what the word “believe in" means).

This is how critical minds work, and how it’s totally different from any belief, and why the manifesto is so freakish. Those who regularly [re]invent this “I believe in <some scientific theory>" manifesto nonsense, just habitually follow their religious mindset inherited from early childhood when we unquestioningly believe what we were said; now they try to be “tolerant / neutral / many-sided”, but imperceptibly sliding down into the comfortable “no doubts, just believe" state of mind.

So, this manifesto is not a word that I’d support and spread, because if you think more and deeper, it appears not thought-out very well. Amen :)

a-bronx

Hans Rosling: New insights on poverty and life around the world