How old were you when you learned that the Moon in the Southern Hemisphere is upside down? I was today years old…this is my head exploding —> %@*&!$. Ok, the Moon isn’t upside down (that’s Northern-ist) but its orientation changes depending on if you’re north or south of the equator.
“From our perspective, the Moon and the night sky is actually rotated 180 degrees compared to our Northern Hemispherical friends,” Jake Clark, an astronomer from the University of Southern Queensland in Australia, explained to ScienceAlert.
“In the south we see the Moon’s dark ‘Oceanus Procellarum’ sea in the south-east corner compared to in the north-west corner for a northern observer.”
But why does it look like this? Well, because physically, we’re actually upside down compared to someone standing in the opposite hemisphere.
That makes perfect sense & the explanation is quite simple but it’s still messing with my head. How did I not know this? Here’s how the Moon appears in the Northern Hemisphere (from Wikipedia):
And here’s a photo from Brendan Keene in Australia:
Tags: Earth Moon spaceContinuing on the extremely sporadic topic of stupid C preprocessor tricks.
It is common to have preprocessor macros that control
compile-time behavior.
C++11 has std::enable_if
to conditionally
remove functions and template specializations from consideration,
and
C++17 adds if constexpr
to allow statements
to removed conditionally.
Removing variables is a bit trickier, though.
You can probably manage it by wrapping the variable inside
a class that itself uses std::enable_if
, but that's
even more clunky than std::enable_if
already is.
Anyway, for whatever reason, you might want to use the preprocessor's
#if
directive to perform your tests.
Maybe you are preprocessing something for a purpose other than
compilation by a C or C++ compiler.
But you're also worried that somebody might misspell your symbol.
// The FEATURE_BLAH macro is defined either as 0 or 1 #if FEATURE_BLUH ... do stuff with feature Blah ... #endif
Oops, they misspelled FEATURE_
,
but the preprocessor doesn't know that,
so it happily says,
"Nope, it's not defined, skip the body of the BLAH
#if
."
How do you catch this typo?
You can use your adversary's power against him.
Since undefined symbols are treated as having the value zero, you can use an expression that blows up if the value is zero.
// The FEATURE_BLAH macro is defined either as 1 (off) or 2 (on) #define GET_NONZERO_VALUE(x) (0/(x) + (x)) #if GET_NONZERO_VALUE(FEATURE_BLAH) == 2 ... do stuff with feature Blah ... #endif
The GET_
macro
first tries to divide by its parameter.
If the parameter is not defined or is defined with the value zero,
then that results in a division by
zero and you get a compiler error.
If the parameter is defined with a nonzero value,
then the result of NONZERO_
VALUE
0/(x)
is zero, and adding that
to x
yields x
.
The last wrinkle is using the defined
preprocessor pseudo-function to distinguish between
an undefined macro and a defined macro whose value is zero.
// The FEATURE_BLAH macro is defined to 0 or 1 // The FEATURE_BLAH_OPTION macro is some value #define GET_FEATURE_VALUE(x) (0/defined(FEATURE_##x) + (FEATURE_##x)) #if GET_FEATURE_VALUE(BLAH) #if GET_FEATURE_VALUE(BLAH_OPTION) == 1 ... do stuff with feature Blah and option 1... #elif GET_FEATURE_VALUE(BLAH_OPTION) == 2 ... do stuff with feature Blah and option 2... #else #error Unknown option for FEATURE_BLAH_OPTION. #endif #endif
If FEATURE_
is not defined,
then the BLAH
defined(FEATURE_
will
evaluate to zero, and then you get a divide by zero error in the
preprocessor.
If it is defined, then BLAH)
defined(FEATURE_
evaluates to 1,
and the expression BLAH)
0/1 + FEATURE_
reduces to just
BLAH
FEATURE_
.
BLAH
This is an abuse of the preprocessor, but it may come in handy in a pinch.
Like many, I was surprised and shocked by the election of Donald Trump as president. I believe his ideas, temperament, and inexperience represent a grave threat to our country and world. Suddenly, all the things I had planned to work on seemed trivial in comparison. Although Internet security and privacy are not the most important policy areas at risk, I believe he -- and, more importantly, his cabinet, administration, and Congress -- will have devastating effects in that area, both in the US and around the world.
The election was so close that I've come to see the result as a bad roll of the dice. A few minor tweaks here and there -- a more enthusiastic Sanders endorsement, one fewer of Comey's announcements, slightly less Russian involvement -- and the country would be preparing for a Clinton presidency and discussing a very different social narrative. That alternative narrative would stress business as usual, and continue to obscure the deep social problems in our society. Those problems won't go away on their own, and in this alternative future they would continue to fester under the surface, getting steadily worse. This election exposed those problems for everyone to see.
I spent the last month both coming to terms with this reality, and thinking about the future. Here is my new agenda for the next four years:
One, fight the fights. There will be more government surveillance and more corporate surveillance. I expect legislative and judicial battles along several lines: a renewed call from the FBI for backdoors into encryption, more leeway for government hacking without a warrant, no controls on corporate surveillance, and more secret government demands for that corporate data. I expect other countries to follow our lead. (The UK is already more extreme than us.) And if there's a major terrorist attack under Trump's watch, it'll be open season on our liberties. We may lose a lot of these battles, but we need to lose as few as possible and as little of our existing liberties as possible.
Two, prepare for those fights. Much of the next four years will be reactive, but we can prepare somewhat. The more we can convince corporate America to delete their saved archives of surveillance data and to store only what they need for as long as they need it, the safer we'll all be. We need to convince Internet giants like Google and Facebook to change their business models away from surveillance capitalism. It's a hard sell, but maybe we can nibble around the edges. Similarly, we need to keep pushing the truism that privacy and security are not antagonistic, but rather are essential for each other.
Three, lay the groundwork for a better future. No matter how bad the next four years get, I don't believe that a Trump administration will permanently end privacy, freedom, and liberty in the US. I don't believe that it portends a radical change in our democracy. (Or if it does, we have bigger problems than a free and secure Internet.) It's true that some of Trump's institutional changes might take decades to undo. Even so, I am confident -- optimistic even -- that the US will eventually come around; and when that time comes, we need good ideas in place for people to come around to. This means proposals for non-surveillance-based Internet business models, research into effective law enforcement that preserves privacy, intelligent limits on how corporations can collect and exploit our data, and so on.
And four, continue to solve the actual problems. The serious security issues around cybercrime, cyber-espionage, cyberwar, the Internet of Things, algorithmic decision making, foreign interference in our elections, and so on aren't going to disappear for four years while we're busy fighting the excesses of Trump. We need to continue to work towards a more secure digital future. And to the extent that cybersecurity for our military networks and critical infrastructure allies with cybersecurity for everyone, we'll probably have an ally in Trump.
Those are my four areas. Under a Clinton administration, my list would have looked much the same. Trump's election just means the threats will be much greater, and the battles a lot harder to win. It's more than I can possibly do on my own, and I am therefore substantially increasing my annual philanthropy to support organizations like EPIC, EFF, ACLU, and Access Now in continuing their work in these areas.
My agenda is necessarily focused entirely on my particular areas of concern. The risks of a Trump presidency are far more pernicious, but this is where I have expertise and influence.
Right now, we have a defeated majority. Many are scared, and many are motivated -- and few of those are applying their motivation constructively. We need to harness that fear and energy to start fixing our society now, instead of waiting four or even eight years, at which point the problems would be worse and the solutions more extreme. I am choosing to proceed as if this were cowpox, not smallpox: fighting the more benign disease today will be much easier than subjecting ourselves to its more virulent form in the future. It's going to be hard keeping the intensity up for the next four years, but we need to get to work. Let's use Trump's victory as the wake-up call and opportunity that it is.