Saturday, February 24, 2018

on political divisiveness, part I

TL;DR: it makes perfect sense that we as americans aren't always going to agree on how to deal with issues that affect us and sustain our society.  but when we disagree without empathy, we lose the ability to work together, and put our energy into fighting rather than resolving.  freedom is selfish, and to some degree it should be. citizenship is unselfish and we should all make that a priority from time to time too.

 

here's a huge problem i have with many of today's social media fueled conservatives. in short, they're dishonest:

in order to boost their own snowflake self-esteem, fuel their confirmation bias, and avoid the inconvenient trappings of cognitive dissonance that we all should feel from time to time (because none of us know every goddamn thing), those in the center mass of the today's political right, find the most extreme nutcase people (socialists, mainly) and ridiculous extreme behavior of the far edge lunacy of the left, and prop those up, with spotlights and all, presenting it as the center mass majority of the left, and thus get to rest easy in your assertion that it's their own position that's the only reasonable path for this country to progress forward.

meanwhile...

here's a huge problem i have with many of today's social media fueled liberals. in short, they're dishonest:

in order to boost their own snowflake self-esteem, fuel their confirmation bias, and avoid the inconvenient trappings of cognitive dissonance that we all should feel from time to time (because none of us know every goddamn thing), those in the center mass of today's political left, find the most extreme nutcase people (fascists, mainly) and ridiculous extreme behavior of the far edge lunacy of the right, and prop those up, with spotlights and all, presenting it as the center mass majority of the right, and thus get to rest easy in your assertion that it's their own position that's the only reasonable path for this country to progress forward.

then, those with internet troll-like tendencies, spout their one-sided horseshit, chasing it quickly with declarations of great lament about how this country seems more divided than ever.

yeah, perhaps it is. and if so, then it's exactly your intellectual dishonesty that's doing it.

  • if you talk more than listen.
  • if the source of your frustration ends up with you asking yourself "why don't more people think like me; they must be idiots".
  • if you don't for a second, try to understand the position of the other person, ignoring what your chosen news media bubble tells you what they want you to know about that other person.
  • if so, then you (not "them") are the cancer that is splitting this country.

if you're confident in your position, here's a challenge:

regardless of which political "side" you're on, try this. write down 10 reasons why you think those on the "other" side believe the way they do. and none of the 10 can be reasons fed to you from your bubble, but real reasons that real people have for believing that their values are those that are best for the country. because not only should you be able to; it should be easy.

because if you cannot do this easily, then you are this country's divisiveness. then you are to some degree an enemy combatant of this nation. you are dishonest if you don't even take the time to understand your opponent before you decide that they are your opponent.

but what about hypocrisy?

a lot of dishonesty here... and don't even get me started with those who believe their highest purpose of fueling and debating their side is to expose hypocrisy from the other side. i mean, if exposing hypocrisy per se is a valuable service (and it can be argued that it does bring exposure that leads to corrective action), then why are some only interested in exposing hypocrisy from the other team? if hypocrisy is bad (and it is), and you've chosen the path to expose it (good on you), then expose it. everywhere.

but if you're only interested in exposing the other team, while ignoring your own, well, isn't that itself an example of the hypocrisy you hate so much?

if you think that maybe this shoe fits, then perhaps the rest applies...

i guess perhaps one might think, well, who am i to affect an entire country?
well, yeah, no one individually can, really.

but then, there's that saying about how no drop of rain blames itself for the flood.
well, that's part of what citizenship is. one does what's best for the country, in all ways big and small, above and beyond what's best for *my team*.

if you've chosen a team, and to change your mind later feels like an admission that maybe you've been wrong all along about some things, and that causes you to ignore those thoughts. that's cognitive dissonance.

if you stand for the flag and anthem, and have contempt for those who don't, that's fine. most of us do. but it takes more than standing for the flag, acting like a patriot, acting like a citizen. putting on a show, and being angry with those who refuse to be actors like you. no. standing for the flag is supposed to be symbolic of your actual behavior, it's not just for show. it's not so that you can act like a patriot when the anthem plays, but then turn around and live your life as an american tearing this country down.

why don't we all derive more strength and more purpose, not by more tightly clinging to what we previously decided, but by realizing that the more we learn, the more we realize how much we still have to learn. and that changing one's mind from legitimate new information is a strength, not a weakness. it's exactly the philosophy that drives science and has advanced us as a society and as a species. it advanced us all the way from banging rocks together, to banging moon rocks together.

"my team" territorialism is best left to the reptiles and lower mammals.
let's allow the escapism of sports feed that vestigal remainder of our dna.
let's not allow it to resist our evolution as humans.

if you enjoy the benefits of being in a society, then occasionally your words and actions should reflect and support the good of society.

freedom is selfish, and to some degree it should be.
citizenship is unselfish and we should all make that a priority from time to time too.

america isn't just about freedom. it's also about citizenship. they balance. and we as a nation advance united.



Monday, February 19, 2018

on browser detection with javascript

wow. when it comes to using javascript to build custom web applications, if there was one thing i thought would be easy to do is have the app figure out what browser type is being used. nope.

many years ago when i first starting learning javascript, detecting the browser was pretty essential, because at the time browsers varied widely in how they implemented javascript. some behavior was different, some appearance was different, and on some browsers, some aspects of the language weren't supported at all. and this was long before handy libraries and frameworks like dojo and jquery.

these days? much, much better. but even still, occasionally you run into an issue, and if the limitation or bug is inside someone else's blackbox, you reverse-hack a workaround.



here's what i ran into, above.

drawing some of my own graphic labels on the map. i need the labels to sit on polygon masks that i'm also creating. the yellow masks up there always draw fine, but the labels vary.

so, come to find out that on some browsers (chrome, opera) the labels draw fine, on other browsers (msie, firefox, safari, edge) the label itself draws too low. luckily the API i'm using, i can apply an offset to juke the label to make it look better, but i need to know at runtime which browser is being used so that i can tell it how far to juke, if at all.

so i start googling around, and ran into some samples of varying age, and varying usefulness. not good enough to cover all my bases. some written for entirely different purposes, or otherwise mucked up with regex, or accounting for possibilities so exhaustively, to make the end result internationally bulletproof, but for me 90% unnecessary and tough to wean back.

then i figured javascript frameworks might help. i looked into things like jquery.browser (which its own doc says it's deprecated all over the place with no new references) and dojo/has and dojo/sniff, still issues left and right, then scope issues with wanting to have some of this code outside the AMD loader require statement, but probably my inexperience with those contributed to the problems. i need to learn how to wrestle with dojo better.

i even found this little gem on twitter:



rock solid advice no doubt, but feature detection doesn't really apply in my case since i'm not trying to call certain features or install extensions, etc. i just need to know the browser, so that i can go do my thing with the labels. i also tried an example that used ducktyping, which i suppose is a flavor of feature detection (trying to determine what something is, by testing what it can and cannot do: i.e., if it walks and quacks like a duck), and ran into more exceptions than things that actually worked. at any rate...

so i finally went brute force and found that the dom's own navigator class has a .userAgent property that contains a lot of gobbledyguk, but enough there to do some string parsing.



browsers like opera, firefox, and safari, no problem. the .userAgent returned by those browser has enough uniqueness to it.

the example above is what chrome browsers return, and while this string contains *both* the words "chrome" and "safari", the safari browser's has "safari" but not "chrome", so if i check for "safari" first, then overwrite that with "chrome" later if the browser is chrome, then i'm good. (i guess i could've used a switch condition with some fall-through), but at any rate, here's what i ended up with:


and since no workaround is so nice that microsoft internet explorer can't find a way to toss a wrench in, guess what... the javascript inside IE doesn't support the string object's .includes method!! argh. so i tried .indexOf and other similar methods, to no avail.

so i'm making my kludge a little kludgier and i'm deciding to avoid the problem for now by assuming that if i don't proactively find the other browsers, i can reactively assume "msie". i'm sure that won't hold up in the long run, but until i find a better way, i'll see how far i can get with it. oh, and don't miss the forced use of try...catch, because if you try to call .includes on an IE browser, the whole thing craps out.

i'm all ears if anyone out there has a better way to do browser detection. i'm better just about anyone reading this does. (hopefully)

end result: