On Caching

A flurry of new visitors from Tam’s (hi everyone, welcome!) got me thinking a bit about the performance of this site. Combined with not much going on with gun-related topics here in Switzerland, I figured I’d write a bit about tech.
This site runs WordPress on a S-sized Simple Hosting instance at Gandi‘s Baltimore facility. As a sort of hybrid of shared hosting and a VPS, it has a surprising amount of “oomph”: it has dedicated Apache, PHP, and MySQL processes, uses APC to cache PHP opcodes, and sits behind a series of load-balanced Varnish cache servers which cache static content. It’d make sense to take advantage of those resources to ensure things are speedy.
Out-of-the-box, WordPress dynamically generates each page entirely from scratch: this involves about a hundred database calls and a bunch of PHP work. Considering that content here changes relatively infrequently (yeah, I should write more), it doesn’t make sense to generate each page anew for each visitor since this takes a fair bit of resources.
That’s why I use Lite Cache to cache static content: the first time a visitor requests a page, it’s dynamically generated and sent to them as normal, but the now-generated page is saved on the server in the cache. If a second visitor requests that same page, the cached version is sent to them; since this is just a static file that doesn’t need to be generated from scratch, the server can send it right away, so it loads faster for the visitor. In addition, the static file is stored on the Varnish caches, which are specifically designed for high-performance caching. If the content ever changes (e.g. I make a new post, someone leaves a comment, etc.), the cached version is updated to reflect those changes.
Combined with the front-end Varnish caches, this can swiftly serve up content to large numbers of users — I’ve load-tested it with over 1,000x the typical daily traffic and it doesn’t break a sweat.
That’s cool and all, but why bring it up now?
Because I forgot a critical detail: I only tested it with desktop browsers, where it worked great. However, once someone hit the site with a mobile browser (perhaps on their smartphone or tablet), things went wonky: the site correctly detected that the site was using a mobile browser and generated a mobile-friendly version, which the cache dutifully stored for other visitors. Unfortunately, the cache wasn’t smart enough to tell that all the other readers were not using mobile devices, and started serving up the mobile version to desktop browsers. Whoops.
I’ll make a note to test for this sort of stuff in the future.
Since mobile users make up a tiny fraction of the already-small number of readers here, I’ve disabled the mobile-friendly theme until I can get things sorted out.
Since this is nominally a gun blog, I suppose I should try to connect this situation to guns in some way. Here goes: don’t assume everything will always work the way you think it will. Train for a variety of situations. If your training consists only of calmly standing upright in a well-lit range shooting at stationary targets with a full-sized pistol, you’re not well-prepared for a situation when, for example, a bad guy mugs you with a knife outside your office when all you have is a Beretta Jetfire and a cup of coffee. It definitely doesn’t prepare you for things that go thump in the night.Whether you’re adjusting web caches, training at the range, or sending a rocket to the moon, it’s wise to keep in mind that the universe has a perverse sense of humor.

Observing the Swiss

Since the university where I work is right next to the main train station, most of my Swiss-watching (pun very much intended) takes place in the station. The Swiss are interesting, particularly when it comes to weapons in public.
It’s common to see guys with slung SIG SG 550’s walking around the train station as they head off to military training, the range, etc. Nobody pays these guys any mind whatsoever; it’s just part of what’s normal here.
I admit to doing a double-take when I saw a guy with a slung katana picking up some groceries in the main station, but nobody else seemed to care. “Guy with a sword getting a liter of milk and some eggs. Meh.”
Even rather unusual things, like the guy wearing a full-body ghillie suit with a rifle slung on his back buying a cup of coffee from the McDonalds, go completely unremarked-upon by anyone here. It’s amusing to think of Swiss Wookie-suiters?being a thing.

Relicensing

Effective immediately, I’m changing the license of my content to make it even more free.
Previously, content was licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States license.
I’ve updated to the Creative Commons Attribution-ShareAlike 4.0 International License, which clarifies several issues (particularly for people not in the US). I’ve also removed the NonCommercial restriction.
Of course, this relicensing only affects content that I’ve created. Content created by others remains theirs, and is used either with permission or under fair use.

Rifle overboard!

What’s going on here?

Image from S.T.A. Training Group
Image from S.T.A. Training Group

Based on the Facebook comments people are speculating that the man works for a marine security company and is throwing this AR-pattern rifle overboard for one of two main reasons:

  1. The rifle is full-auto and was purchased outside the US (i.e. they don’t need to comply with the NFA hoops), and they’re returning to a US port and the gun would not be legal. It’s cheaper and easier to simply discard the rifle overboard and buy another one once they leave US waters than deal with the NFA.
  2. Essentially the same situation, only they’re docking in some other port where firearms are restricted regardless of if they’re full- or semi-auto.

Thoughts? Speculation? I suspect that #2 is a bit more likely.
(Apologies if this post shows up twice in your feed reader. There were some tech issues here.)

Breaking stuff for fun and profit.

I spent a bit of the last day or two making some changes to the back-end around here, enabling SSL/TLS for the admin interface, etc.
As far as I can tell, things should be good, but if you find that some functionality has broken please let me know.
For now, I have only the admin interface accessible over HTTPS?– all other content should automatically redirect back to the HTTP version and work normally, but in some odd cases browsers seem to ignore the redirects and have formatting issues (cause: the page is loaded over HTTPS but the CSS is loaded over HTTP) and may indicate redirect loops. I’ve been unable to replicate this with testing tools, and it may just be an issue with my browsers. If you see similar issues, please let me know what page you’re visiting, the date and time of the error, and the page source (Ctrl-U) so I can see what might have caused the issue.

AZ court rules on preemption…of alcohol

Interesting news out of Arizona?in regards to state preemption, but not of?guns:

Scottsdale police are no longer permitted to cite or arrest someone solely on the basis of being incapacitated by alcohol in public.
[…]
The opinion stated that Scottsdale’s public-intoxication ordinance is pre-empted by a 1972 state law that prohibits local laws from criminalizing “being a common drunkard or being found in an intoxicated condition.”
The court maintained that it was clearly the state’s intent at the time to treat alcoholism as a disease rather than criminal behavior, unless a person under the influence was also engaging in activities, such as driving.

Makes perfect sense to me, but then I live in Switzerland where the drinking age for wine and beer is 16 (18 for spirits), drinking in public is perfectly legal, and it’s quite common to see teenagers enjoying a beer while chatting with friends in a park or on the sidewalk, businessmen having a drink on the train ride home, etc.
I’ve even seen soldiers on their way to training get onto a train, place their duffel bag and unloaded rifle on the luggage rack, then have a beer. The horror.
So long as someone is not violating other laws or being dangerously unsafe (such as driving while under the influence, being rowdy and disorderly, trespassing, threatening others, etc.) I have no problem with them?being peaceably intoxicated whether in private or public. If they start causing disruptions, then there’s a problem, but otherwise I see no issue.
No surprise, the Scottsdale police don’t seem to have an issue with the law being overturned:

Scottsdale police Sgt. Mark Clark said officers didn’t often use the ordinance when it was in effect.
Typically, those who demand the attention of law enforcement are committing another crime as well, he said.
[…]
Clark said there are other tools police can use to ensure the safety of those who are inebriated.
An officer may help someone get a ride home or cite them for another violation, such as disorderly conduct.

Because Vermont has such a crime problem

Supporters of increased controls over guns in Vermont accepted the fact that legislation was going nowhere in 2014.
When lawmakers declined to vote this year on gun-control charter changes passed by Burlington voters in March, gun control supporters opted against raising a ruckus.
Next year will be different, they said Tuesday.
“2015 will be the year,” Ann Braden, president of Gun Sense Vermont, at a Statehouse news conference. The group’s singular focus next legislative session will be to pass a law requiring criminal background checks for all gun transactions, she said.

Burlington Free Press, via Jeff Soyer.
Obviously, with its lax gun laws Vermont is a violence-infested hellhole. Oh, wait. It’s not. At all.
Considering the blowback that politicians get whenever they propose gun control and its unpopularity among?the public, it’s no surprise that this group wants to wait until after the midterm elections before pushing their extreme agenda.
Pretty much any group that says “Everyone loves us and the ideas we espouse, but we’re going to wait until after the election to push those ideas.” is a group you want to avoid. If it’s a good idea and you think you have public support, why put it off until later?

No surprise – Hillary Clinton dislikes freedom

Yesterday, Politico ran an article about Hillary Clinton commenting, in detail, on domestic policy. No surprise, she was pushing for more gun control:

?We have to rein in what has become [an] almost article of faith, that anybody can own a gun anywhere, anytime. And I don?t believe that,? [Hillary Clinton]?said.

Why? If people are?peaceful, non-violent people, why does it matter if they have guns or not?
Should violent criminals and the dangerously mentally ill be blocked from possessing firearms? Certainly, but considering that the vast, vast majority of people are ordinary, responsible, peaceful people it seems silly to worry about them responsibly owning and carrying?arms.

Clinton, who argued it was possible to hold her position and still support the right to gun ownership, warned that unfettered access to guns could have dangerous consequences. She called the country?s approach to guns ?way out of balance,? and referred to cases in which gun violence has erupted over minor issues.

I fail to see how overturning restrictive, unconstitutional laws and restoring liberty is somehow “way out of balance”.
I’m not sure what sort of cognitive gymnastics are needed to simultaneously think that restricting the right to keep and bear arms is somehow also supporting that?right, but such a performance would be worthy of an Olympic-level gymnast.
And yes, while violence involving firearms has arisen over minor issues, overall gun violence is way,?way down since the time her husband was in office, even though the number of guns in private hands has dramatically increased and gun laws have been liberalized.

She painted a dark picture, warning that, ?At the rate we?re going, we?re going to have so many people with guns everywhere, fully licensed, fully validated, in settings where [one] could be in a movie theater, and they don?t like someone chewing gum loudly or talking on their cell phone and decide they have the perfect right to defend themselves against the gum chewer or cell phone user by shooting.?
Clinton continued, ?That?s what happens in the countries I?ve visited where there?s no rule of law.?

So people who undergo the training and checks needed to get a carry permit — that is, they’re following the law — are somehow more apt to fits of violence? Seems unlikely to me. Certainly, such incidents have happened but they are the exception rather than the rule, and the people who committed such acts are either in jail or facing criminal charges.
It’s nonsensical to compare people who obey the law, get training, background checks, and permits with people in lawless countries.

The proliferation of guns combined with few restrictions on where they can be carried can ?give someone the means to respond in the moment in a way that he wouldn?t if a few minutes passed and there was no means to inflict harm ? We really have got to get our arms around this,? she said.

I agree with her but not in the way she intends.
I wholeheartedly agree that widespread carriage of arms by the public “give[s] someone the means to respond” that they would otherwise lack if they had?”no means to inflict harm”. I think that’s a good thing, because?honest people can defend themselves from violent criminals. Without a gun, the honest person is considerably less able to offer meaningful resistance.
While it was always obvious that Mrs. Clinton was never a friend of the Second Amendment or legal gun owners, this is pretty clear-cut evidence that she’s opposed to gun rights.

Weerd on “Ask and Tell”

Weerd has some good advice for?responding to “Are there guns in the house?” questions that the antis are pushing as a “safety” measure.
While there?is a certain aspect of safety involved in such questions, in that having unsecured, loaded firearms around young children is asking for trouble, it’s not unreasonable to suspect that the antis have some sort of ulterior motive like shaming legitimate gun owners. This?is the Brady Campaign, after all.
Weerd’s advice is good, and I’ll summarize it here:

  1. Shame. Bluntly asking people about personal, private things like gun ownership, particularly if you’ve just met, is rather forward and a little bit rude.?Being affronted by their questions is reasonable.
  2. Honesty.?Although you’re affronted, don’t lie. Don’t show them your guns or security, but don’t lie.
  3. Quid Pro Quo. If they’re bold enough to ask you private questions, turn the table: do they own guns? Do they know how to store?or handle them safely?
  4. Into The Fold! This is a good learning?opportunity: see if they’re interested in learning more about guns and gun safety.
  5. Social Stigma. If the other person responds irrationally in regards to your safe and lawful firearm ownership and denies their child a friend (in the form of your child), mention that to your friends. If they react this way about safely and lawfully owned firearms, how would they react to other situations?
  6. Remember the Children. Keep in mind that the kids are innocent bystanders here and are just interested in being friends with others.?Assuming that the other parent’s home is reasonably safe?(i.e., the pool is fenced, household chemicals and knives are secured and out of reach, etc.), there’s no reason to prevent your child from playing over there, having a good time, and socializing.

Read the whole thing.
I’m a big fan of #3 — take advantage of a situation and turn it into a learning opportunity. When I was working on my bachelors degree I’d do this frequently with other students, particularly those who had no experience with firearms. It worked out really well, and everyone had a fun time (particularly at the range).