adamtj | 5 years ago | on: Open IP over VHF/UHF
adamtj's comments
adamtj | 5 years ago | on: Open IP over VHF/UHF
adamtj | 5 years ago | on: Extremely Large Telescope
adamtj | 6 years ago | on: Lead-Free Solder Is Better for You
adamtj | 6 years ago | on: Ending the Era of the U.S. Survey Foot
Metric is often easier and more convenient, but not always. So, in the US, we tend to use metric or customary units depending on which is more convenient for the task at hand. Actually, it's a lot like the UK and other countries where older systems still exist alongside metric. The difference with the US is that we don't have as many unnecessary laws mandating metric. You're an adult. You're working with other adults. You're perfectly capable of figuring out what to do without the input of lifelong politicians who've never measured a thing in their lives. Except for the amount of your money that they're going to spend. They like measuring that.
adamtj | 7 years ago | on: What software will you trust when you get senile?
adamtj | 7 years ago | on: Linus Torvalds apologizes for his behavior, takes time off
adamtj | 7 years ago | on: Judge says ‘literal but nonsensical’ Google translation isn’t consent for search
So, it's not ok to intentionally kill the suspect, but it can be ok to use deadly force. I'll assume you're really asking why deadly force might be acceptable. A pipe in the hand is a lethal weapon. If a police officer is duty-bound to apprehend a person who is using lethal force against him, it would be insane to use anything less than lethal force in response. If an officer attempts to use less effective non-lethal means, but fails and is killed, then he is not only dead, but also has failed in his duty to protect the public just as if he had run away.
It's important to remember that these situations can happen extremely fast, under enormous stress. A routine encounter can turn deadly serious in a fraction of a second. The whole thing can be over in under three seconds. There is no time to think or reason. To think is to hesitate, and to hesitate is to die. You must have a trained reflex: if they use deadly force, then I shoot at center-of-mass. Seeing a pipe in the hand of an approaching person might be the trigger for that reflex. It's not quite so simple, though. It's best to prime the reflex by thinking it through before-hand. Police officers must constantly maintain situational awareness, thinking through possible scenarios and priming their reflexes based on who is around and how they're acting. It's a very difficult and dangerous job.
adamtj | 7 years ago | on: Judge says ‘literal but nonsensical’ Google translation isn’t consent for search
As for how much risk a blunt weapon poses, a pipe can easily cave in a person's skull with a single blow. Successfully blocking the strike could result in a compound fracture of the forearm ... and then a caved-in skull. Broken ribs can cause punctured lungs and death from a pneumothorax. And it can all happen in a fraction of a second.
Real life violence is not a dance, like those long drawn-out fight scenes in movies. It's not about throwing punches and inflicting pain until somebody gives up. It's about breaking bodies so thoroughly that it's irrelevant whether the other person wants to give up or not. It's sudden, fast, confusing, brutal, and often horrific. The survivors of real world violence often come away knowing the smell of brains or freshly spilled bowels.
Before second guessing the police, it's important to know just what they really face. Read some books on real life violence. It's sobering. Rory Miller is a good place to start.
adamtj | 8 years ago | on: Strava heatmap can be used to locate military bases
The first time I was told about Strava, I immediately dismissed it as useless. (After all, what service could they possibly provide when I'm unwilling to tell them precisely where I go to work out?) I almost gave a quizzical look to my conversation partner, but that would have given him more insight into my thoughts than I cared to share, so I surpressed the expression.
adamtj | 10 years ago | on: Going Fast Slowly
adamtj | 10 years ago | on: A 15-year-old weightlifting prodigy
adamtj | 10 years ago | on: Change Data Capture: The Magic Wand We Forgot
http://engineering.linkedin.com/distributed-systems/log-what...
adamtj | 10 years ago | on: On rump kernels and the Rumprun unikernel
a small or inferior remnant or offshoot; especially : a group
(as a parliament) carrying on in the name of the original body
after the departure or expulsion of a large number of its
members
http://www.merriam-webster.com/dictionary/rumpadamtj | 10 years ago | on: Speed as a Habit
There are different kinds of meetings. You need know what kind one is before you agree to attend. If it's a decision meeting, then you need to do your silent reflection before it begins.
adamtj | 10 years ago | on: Python string formatting and UTF-8 problems workaround
The symptom is that the .encode() comes too early. The general principle is to .decode() as early as possible and to .encode() as late as possible. The results of .encode() should be as temporary as possible -- preferably never even assigned to a variable.
Seeing the encode in the wrong place leads me to suspect that the author is confusing byte arrays and strings. These are two distinct things, but most documentation makes that distinction clear as mud.
The key thing to realize is that strings are not bytes, and bytes are neither characters nor strings. Think of strings as abstract data structures, like hash tables or linked lists. Bytes are binary integers. On the surface, byte arrays are integer arrays, not strings nor hash tables nor lists of objects.
Programs interface with the world via bytes. Files are bytes. The ntetwork is bytes. Everything is bytes. Bytes are not strings. A byte is an 8-bit integer. When you do I/O and get bytes from the world, you must deserialize them into whatever abstract data structure they represent. Ignore the C language and it's misnamed "char" type. A string is an abstract data structure, as is a hash table, or a list. In some sense even binary integers are abstract data structures that need to be serialized. String serializations are called "encodings". Binary integers are serialized by choosing a byte order (big or little endian). There are various standard ways to serialize hash tables and lists, like json, various XML formats, python's "pickle" and "shelve", etc.
When you get bytes from the network or a file and those bytes are supposed to represent a string, you must deserialize the bytes into a string object. This is called decoding. Often you're using a web framework or other library that does this for you. Python 3's file objects do it. If it's not done automatically, then you must do it yourself. You or your framework should decode bytes into a unicode string object as soon as possible. You should do this everywhere that you do input, and then leave your strings as strings for as long as possible. Do all of your operations on strings ("unicodes"), not bytes. You parse strings, join strings, replace characters in strings, trim, find lengths and match regexes on strings ("unicodes"). Doing any of those operations on byte arrays is nonsensical and will lead to bugs. Only when you have your final string completely ready to go should you worry about serializing it for printing or to write to a file or the network. Only then, at the last possible moment, should thoughts like utf-8 or ascii enter your mind.
As written, it's unclear whether "freqs" containing byte arrays or unicode strings. Getting that mixed up can result in failing to find and item which really is in the dict, or miscounting frequencies, or it can even cause more UnicodeEncode/DecodeErrors. By decoding as early as possible and encoding as late as possible, such sneaky bugs are much less likely to occur.
In Python 2, I would have fixed the problem like this:
for e in results:
simple_author=e['author'].split('(')[1][:-1].strip()
if freqs.get(simple_author,0) < 1:
print ("%(date)s -- %(author)s -- %(title)s" % {
'date': parse(e['published']).strftime("%Y-%m-%d"),
'author': simple_author,
'title': e['title'],
}).encode('utf-8')
You might dislike my multi-line print and would prefer to .join() a list, possibly with a temporary variable. Or, maybe you'd prefer the newer .format(). Regardless, the important point is that the .encode() should happen later than it does in the article.adamtj | 10 years ago | on: Hackers Remotely Attack a Jeep on the Highway
To be a professional is to have a duty to refuse to do stupid stuff like this, even if it's legal and even if your job depends on it. But is it legal? Why would we need any new laws for this? Connecting a wireless receiver to the same network that controls a car's brakes and steering seems to me like reckless endangerment. No need to wait for innocent people to die.
If history has shown us anything, it's that we cannot rely on software to separate two systems sharing a network. Only physics can do that. If we must have wireless for entertainment, then the entertainment and vehicle control networks must be air-gapped.
This seems blindingly obvious to me. What am I missing?
adamtj | 10 years ago | on: What are Bloom filters?
This style is characterized by titles like "Catchy Phrase: The surprising tale of a subtitle that actually tells you what the book is about. Or does it?" "Catchy Phrase" tells the story of an single data point, or maybe three, with edge-of-your-seat tension provided by a jumbled chronology. It opens a generation before the main data point was born, then skips to the present day, before jumping into the middle of a tangential story. Then it's back to where we left the origin story of the data point, but this time we're in a different location looking at the second data point. Next comes some speculation about a possible rosy future and maybe a motivating example. Next we end the tangential story, which introduces the third data point, at it's funeral. The tangential story begins. As you read, you can see a complex theme slowly but deftly woven from the timelines of the several stories. It's a pattern that a knitter might call "felt". You can't help but be drawn in. It's so fascinating and intricate that you, like the author, sometimes have trouble distinguishing cause from effect, which adds an alluring air of mystery. The ideas must be Important. Despite the complexity, in the end the conclusions seem simple and obvious. You feel smart. You go to a dinner party and gush about it to your friends. They wake up the next day and, despite one-too-many cocktails, find that they remember the title of "Catchy Phrase". They look it up, and One-Click (tm) later, the life cycle is complete.
You aren't the audience, you're the vector.
adamtj | 10 years ago | on: Stephen Hawking and Yuri Milner Announce $100M Initiative to Seek ET
adamtj | 10 years ago | on: De-Obfuscating the Statistics of Mass Shootings
If you merely look back to about 1939, you would find numbers for Poland alone that dwarf any statistics for the US, even ignoring differences in population! Poland isn't the only such example. Around that time, certain groups of people suffered from numerous horrific shootings, decimating their populations, despite those groups having been recently disarmed almost entirely. Of course, I'm being sarcastic. These people suffered at the hands of their own governments because they were disarmed, not despite it. There are some still alive who remember.
An honest assesment of history, even very recent history, makes it clear that America's current level of gun violence is a mere rounding error next to the real threat: descent into tyranny. We're lucky that we live in such a relatively peaceful time, but let us not delude ourselves. No human will ever live without the threat of tyranny. No government of the people or by the people will ever, by it's own internal guidance, remain civilized indefinitely. We must never surrender the tools needed to provide the most drastic of course corrections for a government gone astray.
We are fortunate that by keeping and maintaining arms, we make it more likely that we will never have to use them. Armed violence is always the absolute last resort, but if we give up our last resort, we give up all the other ones too. Speech, for example, is of little use against a tyrant with absolute power. But speech from the mouths of well-practiced riflemen, with their weapons close at hand? Those words cannot be safely ignored by anyone.
It is for this reason that the right to keep and bear arms is not unique to just the United States. Rather, it is a fundamental and irrevokable human right. The Constitution of the United States does not and cannot grant this right -- though it does explicitly recognize it, lest we forget.
Yes, gun violence is awful, and we should work hard to reduce it. But let us not forget that is is the price we pay for a civilized society, and it is a small price compared to the alternatives. I grow tired of articles that completely miss this point.