tag:blogger.com,1999:blog-77703703474730312862024-03-05T00:00:46.422-05:00This Week in HaxI have carved out a small slice of the great Intarwebs to share with you my goings on.Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.comBlogger92125tag:blogger.com,1999:blog-7770370347473031286.post-81245484021039376822023-03-08T19:36:00.007-05:002023-03-08T20:27:12.243-05:00The joys of C++ templates<p>
It’s been a little while, hasn’t it?
</p>
<p>
Anyway, this post is about C++ and how nothing ever goes wrong with it, ever. I
was building a map with a pair of strings as the key and a complex (and
confidential) value. For the purposes of this post, I’ll say the value is an
<code>int</code>; the exact value type is irrelevant to this post, anyway.
</p>
<a name='more'></a>
<p>
One other caveat: this is performance-sensitive code, so I don’t want to make
unnecessary copies. The underlying key pieces will outlive the map, so I want
the keys to be <code>std::string_view</code>, rather than <code>std::string</code>. So my types look
like this:
</p>
<pre><code class="language-cpp">
struct ConfigItem {
std::string first_key;
std::string second_key;
// In the real project, this is a big value.
int value;
};
// Outlives the map.
std::vector<ConfigItem> items;
absl::flat_hash_map<std::pair<std::string_view, std::string_view>, const ConfigItem*> config_map;
</code></pre>
<p>
I could make the key some named <code>struct</code>, but since I was using <a href="https://abseil.io/">Abseil’s</a>
<code>absl::flat_hash_map</code>, I would have to implement <a href="https://abseil.io/docs/cpp/guides/hash"><code>absl::Hash</code></a> for the type, and
I didn’t want to deal with all of that.
</p>
<p>
The problem arises when populating <code>config_map</code> from <code>items</code>. I thought the easy
thing to do was:
</p>
<pre><code class="language-cpp">
for (const auto& item : items) {
config_map[std::make_pair(item.first_key, item.second_key)] = &item;
}
</code></pre>
<p>
Seems simple enough, right? Loop through <code>items</code>, create a key, and the values
are pointers to the item. As long as <code>items</code> lives longer than <code>config_map</code>,
there won’t be any dangling references, right? Right?
</p>
<p>
Try to figure out what will go wrong if we iterate over the map like this:
</p>
<pre><code class="language-cpp">
for (const auto& [key, value] : config_map) {
// absl::Substitute doesn't seem to work in godbolt with Clang.
std::cout << '[' << key.first << ", " << key.second << "] = ("
<< value->first_key << ", " << value->second_key << ", "
<< value->value << ")" << std::endl;
}
</code></pre>
<p>
If you missed it, you’re not alone.
</p>
<h2>Running it</h2>
<p>
If you <a href="https://godbolt.org/z/5dYM4xTon">run this</a>, you’ll get an output like:
</p>
<pre><code class="language-plaintext">
[@�� �� 04289383, �� 46930886] = (config1_first_1804289383, config1_second_846930886, 1)
[config2_first, config2_second] = (config2_first, config2_second, 2)
</code></pre>
<p>
(the order might be different, since the iteration order of
<code>absl::flat_hash_map</code> can change).
</p>
<p>
There are a few weird things here:
</p>
<ol>
<li>If the <code>std::string</code> fields are created directly from a literal, they seem
to work just fine.</li>
<li>If the strings are allocated on the heap, then they get garbled.</li>
<li>In either case, the string values in the <code>ConfigItem</code> struct seem to be
fine.</li>
</ol>
<h2>The culprit</h2>
<p>
The issue is in the call to <code>std::make_pair</code>. If you squint really hard at the
compiler output, you can see this:
</p>
<pre><code class="language-x86asm">
...
call std::pair<std::__strip_reference_wrapper<std::decay<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type>::__type, std::__strip_reference_wrapper<std::decay<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type>::__type> std::make_pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
jmp .LBB1_13
.LBB1_13: # in Loop: Header=BB1_11 Depth=1
lea rdi, [rbp - 472]
lea rsi, [rbp - 536]
call std::pair<std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> > >::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, true>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >&&)
jmp .LBB1_14
...
</code></pre>
<p>
The important thing to notice is the two calls, one to
<code>std::make_pair<std::string, std::string>()</code>, and the other to the constructor
for <code>std::pair<std::string_view, std::string_view></code>. There’s a bunch of C++
template shenanigans clouding this up, but the gist of it is that it is
creating a <code>std::pair<std::string, std::string></code> (which creates a copy of the
strings) and then immediately makes a <code>std::pair<std::string_view,
std::string_view></code> out of that and inserts it into the map. The problem is
that the <code>std::string_view</code> elements of the pair being inserted into the map point
at the temporary <code>std::string</code> objects created by <code>std::make_pair</code>, which are
immediately destroyed. So you have <code>std::string_view</code> objects pointing at
invalid memory.
</p>
<p>
Breaking it down a bit more (and simplifying some of the compiler output as
best I can), the map-populating loop has (stripping the <code>std::</code> prefixes) a
<code>call</code> instruction:
</p>
<pre><code class="language-x86asm">
call pair<string, string> make_pair<string const&, string const&>(string const&, string const&)
</code></pre>
<p>
This is the call to <code>std::make_pair</code>. Notice that it returns a
<code>std::pair<std::string, std::string></code>. Then, there is
a <code>call</code> to
</p>
<pre><code class="language-x86asm">
call pair<string_view, string_view>::pair<string, string, true>(pair<string,string>&&)
</code></pre>
<p>
That’s the <code>std::pair</code> constructor which takes a <code>pair<string, string></code> and
makes a <code>pair<string_view, string_view></code>. Then, it calls a big pile of
template nonsense to put the key and value into the map. I’m not going to try
to simplify the template parameters for this one:
</p>
<pre><code class="language-x86asm">
call decltype (absl::container_internal::FlatHashMapPolicy<std::pair<std::basic_string_view...
</code></pre>
<p>
There’s a bunch of indecipherable template shenanigans which I assume boils
down to “call the function which puts things in the map.” There’s an
<code>operator[]</code> and an <code>absl::hash_internal::Hash</code> in there, so that’s a safe
bet.
</p>
<p>
After that, there’s the problem call:
</p>
<pre><code class="language-x86asm">
call pair<string, string>::~pair() [base object destructor]
</code></pre>
<p>
That’s where we destroy the temporary pair we created in <code>std::make_pair</code>.
Since the temporary <code>std::pair</code> contains <code>std::string</code> instances, their memory
is freed, so the <code>std::string_view</code> objects now point to invalid memory.
</p>
<h3>Why does only one <code>string_view</code> freak out?</h3>
<p>
But the keys <code>config2_first</code> and <code>config2_second</code> appear just fine. What
gives?
</p>
<p>
I believe it is due to the way they’re constructed. The strings for <code>config1</code>
care created with <a href="https://en.cppreference.com/w/cpp/string/basic_string/basic_string">constructor #7</a>, which takes a <code>const basic_string& other</code>.
<code>config2</code> strings use constructor #5, which takes <code>const CharT* s</code> (in this
case, <code>CharT</code> is just <code>char</code>). The documentation says that constructor #5
makes a copy of the data, but it seems like somehow the <code>std::string_view</code>
ends up pointing at the string literal when we get around to printing, so the
key still prints something meaningful. This is where my C++ knowledge fails
me.
</p>
<h2>Fixing it</h2>
<p>
So how do we fix it? Easy: <a href="https://godbolt.org/z/Y4dqzsYxb">force <code>std::make_pair</code> to create</a> a
<code>pair<string_view, string_view></code> in the first place:
</p>
<pre><code class="language-cpp">
for (const auto& item : items) {
config_map[std::make_pair<std::string_view, std::string_view>(
item.first_key, item.second_key)] = &item;
}
</code></pre>
<p>
That results in the assembly:
</p>
<pre><code class="language-x86asm">
call string::operator string_view() const@PLT
... asm stuff
call string::operator string_view() const@PLT
... movs and leas
call pair<string_view, basic_string_view> make_pair<string_view, string_view>(string_view&&, string_view&&)
... assembly stuff
call decltype (absl::container_internal::FlatHashMapPolicy<std::pair<std::basic_string_view<...
</code></pre>
<p>
In other words, it creates a <code>string_view</code>, then creates another
<code>string_view</code>, then calls <code>std::make_pair</code> with <code>std::string_view</code> arguments,
then puts an entry into the map.
</p>
<p>
When we run it, the keys for <code>config1</code> are no longer garbled.
</p>
<h2>Comparison to Rust</h2>
<p>
Okay, okay, “rewriting it in Rust” is a meme, but Rust is supposed to prevent
exactly this sort of thing. Here’s a quick-and-dirty attempt at rewriting it
in Rust:
</p>
<pre><code class="language-rust">
use std::collections::HashMap;
extern crate rand;
struct ConfigItem {
first_key: String,
second_key: String,
value: i32,
}
pub fn main() {
let config1_first = rand::random::<u8>();
let config1_second = rand::random::<u8>();
let items = vec![
ConfigItem {
first_key: format!("config1_first_{}", config1_first),
second_key: format!("config1_second_{}", config1_second),
value: 1,
},
ConfigItem {
first_key: "config2_first".to_string(),
second_key: "config2_second".to_string(),
value: 2,
},
];
let mut config_map: HashMap<(&str, &str), &ConfigItem> = HashMap::new();
for item in items.iter() {
// If we forget the & here, it won't compile.
config_map.insert((&item.first_key, &item.second_key), &item);
}
for ((first_key, second_key), value) in config_map {
println!(
"[{first_key}, {second_key}] = ({0}, {1}, {2})",
value.first_key, value.second_key, value.value
)
}
}
</code></pre>
<p>
If we <a href="https://www.rustexplorer.com/b#%2F*%0A%5Bdependencies%5D%0Arand%20%3D%20%220.8.5%22%0A*%2F%0A%0Ause%20std%3A%3Acollections%3A%3AHashMap%3B%0Aextern%20crate%20rand%3B%0A%0A%0Astruct%20ConfigItem%20%7B%0A%20%20%20%20first_key%3A%20String%2C%0A%20%20%20%20second_key%3A%20String%2C%0A%20%20%20%20value%3A%20i32%2C%0A%7D%0A%0Apub%20fn%20main()%20%7B%0A%20%20%20%20let%20config1_first%20%3D%20rand%3A%3Arandom%3A%3A%3Cu8%3E()%3B%0A%20%20%20%20let%20config1_second%20%3D%20rand%3A%3Arandom%3A%3A%3Cu8%3E()%3B%0A%20%20%20%20let%20items%20%3D%20vec!%5B%0A%20%20%20%20%20%20%20%20ConfigItem%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20first_key%3A%20format!(%22config1_first_%7B%7D%22%2C%20config1_first)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20second_key%3A%20format!(%22config1_second_%7B%7D%22%2C%20config1_second)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20value%3A%201%2C%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20ConfigItem%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20first_key%3A%20%22config2_first%22.to_string()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20second_key%3A%20%22config2_second%22.to_string()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20value%3A%202%2C%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%5D%3B%0A%20%20%20%20let%20mut%20config_map%3A%20HashMap%3C(%26str%2C%20%26str)%2C%20%26ConfigItem%3E%20%3D%20HashMap%3A%3Anew()%3B%0A%0A%20%20%20%20for%20item%20in%20items.iter()%20%7B%0A%20%20%20%20%20%20%20%20config_map.insert((%26item.first_key%2C%20%26item.second_key)%2C%20%26item)%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20for%20((first_key%2C%20second_key)%2C%20value)%20in%20config_map%20%7B%0A%20%20%20%20%20%20%20%20println!(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%5B%7Bfirst_key%7D%2C%20%7Bsecond_key%7D%5D%20%3D%20(%7B0%7D%2C%20%7B1%7D%2C%20%7B2%7D)%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20value.first_key%2C%20value.second_key%2C%20value.value%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%7D%0A%7D%0A">run that</a>, then we get the expected results. Rust won’t even let us make
the mistake we did in C++, since it won’t try to convert the <code>String</code> fields
into <code>&str</code> tuple elements automatically. If you try to omit the <code>&</code> when
doing <code>config_map.insert()</code>, it will yell at you:
</p>
<pre><code class="language-plaintext">
error[E0308]: mismatched types
--> src/main.rs:34:28
|
34 | config_map.insert((item.first_key, &item.second_key), &item);
| ^^^^^^^^^^^^^^
| |
| expected `&str`, found `String`
| help: consider borrowing here: `&item.first_key`
</code></pre>
<h2>Conclusion</h2>
<p>
This whole episode confirms my suspicion that while writing C++, I just have
to be nervous all the time. Seemingly-innocuous things like inserting into a
map will silently read invalid memory. What’s worse is that I might have
missed this problem entirely if that literal string optimization had taken
effect in my unit tests. With all of the linters that we have for C++, it took
running it in <a href="https://github.com/google/sanitizers/wiki/AddressSanitizer">ASAN</a> to uncover the problem and staring at template deductions
to figure out why it was failing.
</p>
<h2>ChatGPT addendum</h2>
<p>
For fun, I tried asking ChatGPT. Here’s the dialog:
</p>
<ul>
<li>
Me:
<blockquote>
If I have two <code>std::string&</code> variables, <code>k1</code> and <code>k2</code>, is it okay to insert them
into a <code>std::unordered_map<std::pair<std::string_view, std::string_view>,
int></code> using <code>m[std::make_pair(k1, k2)] = 5</code>
</blockquote></li>
<li><p>
ChatGPT:
</p>
<blockquote>
<p>
The code <code>m[std::make_pair(k1, k2)] = 5</code> will compile and run, but it may not produce the expected result.
</p>
<p>
The reason is that <code>std::unordered_map</code> uses the hash value of its keys to store and retrieve values quickly. The hash function used for <code>std::pair<std::string_view, std::string_view></code> relies on the hash functions of its components (<code>std::string_view</code> in this case).
</p>
<p>
However, <code>std::string</code> and <code>std::string_view</code> are different types. <code>std::string_view</code> is a non-owning view of a sequence of characters, while <code>std::string</code> owns the sequence and provides additional functionality.
</p>
<p>
When you call <code>std::make_pair(k1, k2)</code>, you are creating a pair of <code>std::string</code>s, not <code>std::string_view</code>s. This means that the hash function used by <code>std::unordered_map</code> will hash the entire contents of each std::string, which is inefficient and may produce collisions.
</p>
<p>
To fix this issue, you can either use <code>std::string_view</code> as the key type of your <code>std::unordered_map</code>, or create <code>std::string_view</code>s from your <code>std::string</code>s before inserting them into the map. For example:
</p>
<pre><code class="language-cpp">
std::unordered_map<std::pair<std::string_view, std::string_view>, int> m;
m.emplace(std::make_pair(std::string_view(k1), std::string_view(k2)), 5);
</code></pre>
<p>
This code creates <code>std::string_view</code>s from <code>k1</code> and <code>k2</code> and uses them to construct the key of the map. This ensures that the hash function only hashes the underlying character sequences and not the entire <code>std::string</code> objects.
</p>
</blockquote></li>
<li><p>
Me:
</p>
<blockquote>
<p>
Are there memory safety issues with my original version?
</p>
</blockquote></li>
<li><p>
ChatGPT:
</p>
<blockquote>
<p>
The original version <code>m[std::make_pair(k1, k2)] = 5</code> may not cause any memory safety issues, but it may cause performance issues and unexpected behavior.
</p>
<p>
When you create a <code>std::pair<std::string, std::string> using std::make_pair(k1, k2)</code>, it creates two new <code>std::string</code> objects, which will allocate memory on the heap to store their contents. This may be inefficient if you only need to compare the contents of the two strings and not modify them.
</p>
<p>
Additionally, if <code>k1</code> or <code>k2</code> are modified after they have been inserted into the <code>std::unordered_map</code>, it may cause the hash value of the key to change and the key to no longer match its corresponding value. This may lead to unexpected behavior and bugs in your code.
</p>
<p>
Using <code>std::string_view</code> instead of <code>std::string</code> as the key type can avoid these issues, as <code>std::string_view</code> is a lightweight non-owning view of a sequence of characters and does not allocate any memory on the heap.
</p>
</blockquote></li>
<li><p>
Me:
</p>
<blockquote>
<p>
<code>std::make_pair</code> will resolve the pair type to create as <code>std::pair<std::string, std::string></code>, which results in a temporary copy of the strings. Then, they get referenced when inserting <code>std::string_view</code>, resulting in pointers to invalid memory.
</p>
</blockquote></li>
<li><p>
ChatGPT:
</p>
<blockquote>
<p>
You are correct, I apologize for my previous response. <code>std::make_pair(k1, k2)</code> creates a temporary <code>std::pair<std::string, std::string></code> object, which contains copies of the contents of <code>k1</code> and <code>k2</code>. When <code>std::string_view</code> objects are created from the temporary <code>std::string</code> objects, they reference invalid memory after the temporary <code>std::string</code> objects are destroyed.
</p>
<p>
Therefore, using <code>std::make_pair(k1, k2)</code> to create the key of the <code>std::unordered_map</code> and then creating <code>std::string_view</code> objects from it may cause undefined behavior.
</p>
<p>
To avoid this issue, you can create <code>std::string_view</code> objects directly from the <code>std::string</code> objects and then use them to construct the key of the <code>std::unordered_map</code>. For example:
</p>
<pre><code class="language-cpp">
std::unordered_map<std::pair<std::string_view, std::string_view>, int> m;
auto k1_view = std::string_view(k1);
auto k2_view = std::string_view(k2);
m[std::make_pair(k1_view, k2_view)] = 5;
</code></pre>
<p>
This way, the <code>std::string_view</code> objects reference the valid memory of the <code>std::string</code> objects, and the key of the <code>std::unordered_map</code> is constructed directly from the <code>std::string_view</code> objects.
</p>
</blockquote></li>
</ul>
<p>
All in all, not bad. It suggested a better version, but it didn't notice the
undefined behavior until I pointed it out. My job is safe, for now.
</p>Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-21431151919234696482020-05-25T20:54:00.002-04:002023-03-08T19:42:45.645-05:00Mass Effect 2 viewing anglesI recently started replaying the Mass Effect trilogy, having not much else to do while under quarantine. It's been about 7 or 8 years since I'd played through any of the games, since the ending of ME3 really made the rest of the series feel pointless. Now, with some emotional distance and a fresh perspective, I'm going through again and noticing some things that I didn't appreciate before. This post is about viewing angles and why you miss out on some of the pretty skies that exist in the game (and still look pretty great even today).<br />
<a name='more'></a>
<br />
First things first, let's get our bearings straight. I'll take a random screenshot from a combat portion of the game (click on the images for a larger size):<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyjP5bsdu-_2oLQ6EGXACtyf7GZl6FS42IcgAGQPSPhWHq15XrTnSDZ7AqV6vvrKFHxR4KOlBE4FkVf_qeZYn2JTRq7ZAC-GOTwJKrWkxGXnCA0Ie7AoS8k7Ee1urTAnF6sDL6Sv6mxXJM/s1600/s01+butt+shot.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyjP5bsdu-_2oLQ6EGXACtyf7GZl6FS42IcgAGQPSPhWHq15XrTnSDZ7AqV6vvrKFHxR4KOlBE4FkVf_qeZYn2JTRq7ZAC-GOTwJKrWkxGXnCA0Ie7AoS8k7Ee1urTAnF6sDL6Sv6mxXJM/s400/s01+butt+shot.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Swiggity Swooty</td></tr>
</tbody></table>
Breaking out the measuring tape, we see that the aiming reticle is indeed in the middle of the screen:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMy2_pK6O7bUeLcUtojTlRp-YzWXmMXiGJWCKQgAm8baO_Lf-av6jVXsXF6hkT3G1ySipTNOU5Qyf-TMaTg_pYl3nckeJWThEOl1ov0U1m5at6mxmEtzzVHVOn2VT73eWhA3MTup8yTZMT/s1600/s02+butt+shot+guides.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMy2_pK6O7bUeLcUtojTlRp-YzWXmMXiGJWCKQgAm8baO_Lf-av6jVXsXF6hkT3G1ySipTNOU5Qyf-TMaTg_pYl3nckeJWThEOl1ov0U1m5at6mxmEtzzVHVOn2VT73eWhA3MTup8yTZMT/s400/s02+butt+shot+guides.png" width="400" /></a></div>
Yup, dead center.<br />
<br />
And there are some pretty things to see in the sky:<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTV074WwGJZAse0q7YTHhkdu0Au4ZzOGpGQOLGHq4ZwPeOsZCEwQMEAKrFhvyPxCoc4LzmVmD0O9uJSJEZV0ggEKkXrQxqd3KrfvLYXAYEuS_e-BgXYcwID769IeQNUJu6iXjxL0XtpydA/s1600/s03+Pretty+sky.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTV074WwGJZAse0q7YTHhkdu0Au4ZzOGpGQOLGHq4ZwPeOsZCEwQMEAKrFhvyPxCoc4LzmVmD0O9uJSJEZV0ggEKkXrQxqd3KrfvLYXAYEuS_e-BgXYcwID769IeQNUJu6iXjxL0XtpydA/s400/s03+Pretty+sky.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The finest skybox that 2010 has to offer</td></tr>
</tbody></table>
So why don't we look at that more? It's due to the gameplay. Let's take a look.<br />
<h2>
Gameplay demonstration</h2>
<div>
For the rest of the post, I'm going to use a different level, since I took more and better screenshots while playing through this one. Here's what it looks like when looking straight ahead, with the reticle at the horizon:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis7ri66eakRIELUpGfYaw-R9gpGhgGUDiB-Ch8cwO-lTKeFAXpULoKtfapnLB88cIhS0tCXai0csEn8QxdmUEICU07a50McGQZPVCph-_s80m6nT_jpw3XfgBcpOeD58cFOIRfYg18gahj/s1600/s04+looking+flat.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis7ri66eakRIELUpGfYaw-R9gpGhgGUDiB-Ch8cwO-lTKeFAXpULoKtfapnLB88cIhS0tCXai0csEn8QxdmUEICU07a50McGQZPVCph-_s80m6nT_jpw3XfgBcpOeD58cFOIRfYg18gahj/s400/s04+looking+flat.png" width="400" /></a></div>
<div>
Notice that we can see some of the skylights on the ceiling. Not the prettiest sky in the game, but sufficient to demonstrate the point. As expected, half of the screen is ground and half is "sky" (ceiling).</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfE76LwoFdmhVJMIv5iMSOZUhYWfHGj9KZ2BD3aHRtlID_sQ9iE1ZuqS83kINMRUYWWROmdo7czxi11DVITnkMhjNN1fSoxiast-V4YICN1y6FaNhA7fdejjkUurXv5mgfygWa_DajFmFE/s1600/s05+looking+flat+highlighted.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfE76LwoFdmhVJMIv5iMSOZUhYWfHGj9KZ2BD3aHRtlID_sQ9iE1ZuqS83kINMRUYWWROmdo7czxi11DVITnkMhjNN1fSoxiast-V4YICN1y6FaNhA7fdejjkUurXv5mgfygWa_DajFmFE/s400/s05+looking+flat+highlighted.png" width="400" /></a></div>
<div>
As an aside for those who haven't played the Mass Effect series, it is a cover-based shooter, especially in 2 and 3. You are (mostly) safe when in cover, as long as enemies don't flank you and get cut to shreds pretty quickly when standing out in the open (especially on "insanity" difficulty). This means finding cover and moving between cover locations while having a good line of sight on the enemies is the core of the gameplay. Also: play Mass Effect. It's great.</div>
<div>
<br /></div>
<div>
How does this flat angle work when we're looking for cover?</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOO9qMZshwH0YJmWp1EnaFVnkseck7hhyphenhyphenwewqhsSb6HnQbfmiUoudmai6ViIdBGlYbuQh2BlNZz8JNrXGCvK23sP9atTJl__Ef-PZPKiVD_MCfWc4h6etofOM-E7ciRLlb7hInYLqtYjiK/s1600/s06+tactical+points.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOO9qMZshwH0YJmWp1EnaFVnkseck7hhyphenhyphenwewqhsSb6HnQbfmiUoudmai6ViIdBGlYbuQh2BlNZz8JNrXGCvK23sP9atTJl__Ef-PZPKiVD_MCfWc4h6etofOM-E7ciRLlb7hInYLqtYjiK/s640/s06+tactical+points.png" width="640" /></a></div>
<div>
We can see a four possible cover locations, and from this angle, it isn't clear whether we could jump over the railing to get to location 4.<br />
<br />
What if we look slightly downwards?<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFzjuEsIbuAFqSYicXWd46fi2IeN0W54rtkxx-S6WZiDfoprlENrmby8-bZ9gc4LOGeFbrmni3h_6eDKoSiId9shUC2h4aHzPaM7jjlQGeIG7ZCCyBFk0tMBlqd2rKqmXvMnk1Ph2U-9CN/s1600/s07+looking+down.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFzjuEsIbuAFqSYicXWd46fi2IeN0W54rtkxx-S6WZiDfoprlENrmby8-bZ9gc4LOGeFbrmni3h_6eDKoSiId9shUC2h4aHzPaM7jjlQGeIG7ZCCyBFk0tMBlqd2rKqmXvMnk1Ph2U-9CN/s400/s07+looking+down.png" width="400" /></a></div>
Woah! Huge difference! Now we can see many more cover locations, and it is clear that the railing to location 4 is thin enough to jump over.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEDFineZbfEBlPDMaBvbuED5vOz7cUTCNLXqRBGUGeLdZC7o4-7TBuDikdhJXFHEAw5hTSzr0rGHfEEujXEwLYATFziu4oeDXzQ_GXqnEjwV3fhcwTa4bMwXyx9MmfJkkR5zVXCvIMc2q_/s1600/s08+looking+down+tactical.png" imageanchor="1"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEDFineZbfEBlPDMaBvbuED5vOz7cUTCNLXqRBGUGeLdZC7o4-7TBuDikdhJXFHEAw5hTSzr0rGHfEEujXEwLYATFziu4oeDXzQ_GXqnEjwV3fhcwTa4bMwXyx9MmfJkkR5zVXCvIMc2q_/s640/s08+looking+down+tactical.png" width="640" /></a></div>
Also, we can see clearly that there is a floor on the very right side of the screen, so we know that we could walk along that side or that enemies can come up the right side and flank us.<br />
<br />
But now look what happened to our view of the sky/ceiling:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUO0GLksSiqTzmc8Klo5fkBFqd9xKmCBNsHj5kp6lznnRpSFke4TCU8F70QDpWOuwn9mro0rVpsOyqVhMOhg5asShgKyY-o3-1H35_NlrxRZ_teWmm4jJej_kWA0J9GST7r_RLPTaPI-XE/s1600/s09+looking+down+split.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUO0GLksSiqTzmc8Klo5fkBFqd9xKmCBNsHj5kp6lznnRpSFke4TCU8F70QDpWOuwn9mro0rVpsOyqVhMOhg5asShgKyY-o3-1H35_NlrxRZ_teWmm4jJej_kWA0J9GST7r_RLPTaPI-XE/s400/s09+looking+down+split.png" width="400" /></a></div>
We have 1575 pixels for the ground and only 585 for the sky. That's about 73% ground. Also, compared to the "looking flat" image above, we don't see any skylights! If we spent the whole time playing like this, we might not even notice that the room has a skylight. Think of the poor skylight modeler who poured their heart and soul into that skylight, only to have it be completely off-screen.<br />
<br />
For comparison, let's see what happens if we look up:<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzn8OKkEx7uSsCIQrEVn2vowMMwkvP9zTpBaSV8k9VpTPwFcuwmDm1GHHAJLrPporBUY-qKJ5w8ETsrQOTzHc7kMfVPxIeKSmyO_vKdNELJihuzvaNC5rArRjb42Z8jWbg8k1Na1MfsuSW/s1600/s10+looking+up.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzn8OKkEx7uSsCIQrEVn2vowMMwkvP9zTpBaSV8k9VpTPwFcuwmDm1GHHAJLrPporBUY-qKJ5w8ETsrQOTzHc7kMfVPxIeKSmyO_vKdNELJihuzvaNC5rArRjb42Z8jWbg8k1Na1MfsuSW/s400/s10+looking+up.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Skylights for days!</td></tr>
</tbody></table>
Wow, very skylight. Much scenery. We get a sense that this is a room in a building with some stuff going on outside, so why not play like this all the time?<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKLEiIyzG9msFsTFxytQjjBXA_v0O3Vu2UL2o95Xy1LW5-eoFETZbuF06RmQUtKDUneWSpfOmemeE1p62lgCbWEi6m9y23nZIDgvzaMmkOVSs-twt45DBsLuoePf-jVkbAohZrv9iM55hm/s1600/s11+looking+up+cover+points.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKLEiIyzG9msFsTFxytQjjBXA_v0O3Vu2UL2o95Xy1LW5-eoFETZbuF06RmQUtKDUneWSpfOmemeE1p62lgCbWEi6m9y23nZIDgvzaMmkOVSs-twt45DBsLuoePf-jVkbAohZrv9iM55hm/s640/s11+looking+up+cover+points.png" width="640" /></a></div>
<br />
Because we can't see the gameplay-critical information. That 4th cover point is completely obscured, and we can't even determine that the railing is a railing and not a wall. We also can't see the floor on the right, so we miss another path to move down or worry about defending.<br />
<br />
Now, what happens when we add enemies?<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY8BQ5cbG19-gZJvz3IplSCEkwthVQv7_v2FempW5L_BOVT-qZDKgQaDbaCw9cvLhyPUipVY3ACFJGVQ0s0BbBZLIARx4V7-yOtshrnh95n_h4oMk-0IyDfyTu8bRXepIV-SbqkuaSsXqY/s1600/s12+enemies.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjY8BQ5cbG19-gZJvz3IplSCEkwthVQv7_v2FempW5L_BOVT-qZDKgQaDbaCw9cvLhyPUipVY3ACFJGVQ0s0BbBZLIARx4V7-yOtshrnh95n_h4oMk-0IyDfyTu8bRXepIV-SbqkuaSsXqY/s400/s12+enemies.png" width="400" /></a></div>
<br />
We need to give as much screen space to them as possible, and there's even a risk that there could be something right on the other side of our cover that a flat or upward-looking view would obscure. Also, the vast majority of enemies in the game are ground-based, so knowing where they are in relation to their cover and ours is critical.<br />
<br />
Here's a video of me playing this section.<br />
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/vh4fkR4VNL4/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/vh4fkR4VNL4?feature=player_embedded" width="320"></iframe><br />
The mouse wobble at 0:30 was due to a weird thing where zooming in with the sniper rifle sometimes causes the mouse acceleration to go wonky. It isn't just because I'm bad at the game. I beat Dark Souls, so I'm a real gamer.<br />
<h2>
Conclusion</h2>
</div>
<div>
The fundamental problem is that the split isn't really "ground (green) vs sky (purple)" as suggested above, it's "gameplay (green) vs pretty (purple)". For the record, I absolutely planned out that color alliteration. 100%. I wouldn't lie to you.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH8WWm9fZXyE-jkcwJ3dVBoaKB8byv1zM0acm2A-D2-FsGHiV3J_7YfZIJYPTX9Wd1jKDrdLBvOZSrmq3P0UpTUA99lAfIiqJy_YmUz7HKaQ2EPj-vVwRbQNedkRgo06BhI-6U355Vhh64/s1600/s13+looking+down+gameplay+vs+pretty.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH8WWm9fZXyE-jkcwJ3dVBoaKB8byv1zM0acm2A-D2-FsGHiV3J_7YfZIJYPTX9Wd1jKDrdLBvOZSrmq3P0UpTUA99lAfIiqJy_YmUz7HKaQ2EPj-vVwRbQNedkRgo06BhI-6U355Vhh64/s640/s13+looking+down+gameplay+vs+pretty.png" width="640" /></a></div>
<div>
<br /></div>
<div>
In a fast-paced action game like Mass Effect 2, you're naturally going to do things that tip the balance in your favor, even subconscious things like the default viewing angle. You need an angle looking slightly downwards to get a perspective on the battlefield and see where the cover spots and floors are so you can plan your traversal through the terrain.<br />
<br />
Additionally, the game designers are limited in how much "pretty stuff" they can put in the "gameplay" part of the screen, since if that area becomes to visually cluttered, you would have a hard time recognizing which things are cover and which are just pretty doodads. It must be a very difficult balance to make something visually interesting, but still immediately recognizable as "valid cover" when the bullets are flying and you need to relocate quickly.<br />
<br />
How would you fix this? I'm no game designer, but I have some ideas.<br />
<br />
<ol><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM5fSrQG7EXUq8kozD08qdtPMVQPyG8P9_hjKaZ171zT2Xapud1OMJd4ujESIjnzdjHQApiWuyp5D4bQX_r8FJ1mXY7q2SGrOsw_xkswdU9bVXDfFRQXi5lmdjNBDYQoqEGTbB3TMy3j2o/s1600/s14+camera+options.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiM5fSrQG7EXUq8kozD08qdtPMVQPyG8P9_hjKaZ171zT2Xapud1OMJd4ujESIjnzdjHQApiWuyp5D4bQX_r8FJ1mXY7q2SGrOsw_xkswdU9bVXDfFRQXi5lmdjNBDYQoqEGTbB3TMy3j2o/s320/s14+camera+options.png" width="320" /></a>
<li>Place the camera higher above Shepard's head with a wider field of view, so that you could still see the ground in front of obstacles, but also more of the sky. The downside of this is that you lose some view of your character, which makes it feel less like an intimate third-person action game and more like a top-down tactics game. I made a terrible, crude mockup of what this might look like:</li>
<li>Regularly place enemies at higher elevations, so the player naturally looks upwards more often. If you put more gameplay in the "pretty" section, then it becomes the "gameplay" section. But again, you run into a problem: if the background of the "pretty" section is too busy, you won't be able to see the enemies. For a military simulator game where part of the point is trying to pick out enemy soldiers camouflaged against a similar-looking background, that would work, but for a game where you want the enemies to stand out, that's a problem. The game puts a big red box around enemies, even when they're behind cover, so it isn't going for "try to spot the enemy against a background" as part of the difficulty. However, if you still need to think a lot about finding good cover and moving between cover spots, then you would have to alternate between looking down to find cover and then up to shoot at flying enemies. Not the end of the world, but it does change the feel.</li>
<li>Find some way to put pretty stuff at ground level without making it hard to spot enemies or cover. I'm sure that's easier said than done.</li>
</ol>
<div>
As I thought about it more, this seems like an unavoidable problem with cover-based 3rd person shooters, at least to some extent. If you give up on the cover-based-ness, then looking at the ground in front of you isn't as important, and you can spend more camera real estate on other things.</div>
<h2>
Conclusion conclusion</h2>
<div>
Well, I didn't really solve any problems, but at least I figured out why I spend so much time looking at the ground and not the pretty assets. As a reward for reading this far, here's a screenshot of the Objectively Correct romance option in ME2.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCc5_5-6jpdoNDbZctPUbrtGokg2WZ0kBij21OPQaO0pYXXZ_DYf1uezzeRtzxHFyqmwNsKN5szPXZgEdlxhzyYyOddy_OG6biTFHEyslbPvjgaThz3DPyDwQahKoVL2id2ID9-RI1-DH1/s1600/s15+correct+romance.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCc5_5-6jpdoNDbZctPUbrtGokg2WZ0kBij21OPQaO0pYXXZ_DYf1uezzeRtzxHFyqmwNsKN5szPXZgEdlxhzyYyOddy_OG6biTFHEyslbPvjgaThz3DPyDwQahKoVL2id2ID9-RI1-DH1/s400/s15+correct+romance.png" width="400" /></a></div>
<div>
<br /></div>
</div>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-76660850878353968052016-07-13T03:30:00.004-04:002023-03-08T19:43:19.918-05:00Controversy after OCON 2016I got back from an awesome OCON filled with <a href="https://www.facebook.com/haxney/videos/3229053285193/">guitar-cello duets</a>, <a href="https://goo.gl/photos/17KwyyyM3cXSRgpB8">talent-show selfies</a>, an <a href="https://goo.gl/photos/Jz3BG54RwMTVv4Lq8">awesome fireworks show</a>, and oh, right, some interesting talks about Objectivism as applied to art, childhood education, and foreign policy. It was my second time going (first was last year), and I had a great, but exhausting time.<br />
<br />
Obvious disclaimer is obvious: I speak only for myself. My opinions are not necessarily those of ARI, OCON, my employer, people on Facebook who attended OCON, or crab people.<br />
<a name='more'></a>
<br />
Today, I saw a <a href="https://medium.com/@sparkoffreedom/objectivist-conference-2016-ted-cruz-priased-ron-paul-denounced-war-justified-c3f8a546520a#.6nahef1ep" rel="nofollow">blog post</a> by an anarcho-capitalist ("ancap" for short) student flutter across my Facebook feed which was highly critical of multiple aspects of the conference. As a bit of background for non-Objectivists, libertarianism (of which anarcho-capitalism is a subset) and Objectivism have a complicated relationship. Objectivism is a single, complete philosophy which includes a theory of politics while libertarianism is a "big tent" of many different philosophies which are united only by a rough consensus on some matters of politics. To greatly oversimplify the situation, libertarians tend to say to Objectivists, "you like the free market, you're basically one of us," to which Objectivists say "our disagreements on the layers of philosophy below politics are too great for Objectivism to be considered a kind of libertarianism." As with all things true on the internet, the relationship can be summed up with a gif:<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-7hfrBtjGLvMQnko_Ywp5q8pU3UIviKT61is6ynvYDRtud9kAMzzOMxqtrbYvXOJZqnilCzrkcEgq-HcmMzlTfAyUd1vmGSM_QN23EjvSHPmpbz4WKD-CnWP2bv4IDXB-hqRYTQ7UJaj9/s1600/scrubs.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="167" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-7hfrBtjGLvMQnko_Ywp5q8pU3UIviKT61is6ynvYDRtud9kAMzzOMxqtrbYvXOJZqnilCzrkcEgq-HcmMzlTfAyUd1vmGSM_QN23EjvSHPmpbz4WKD-CnWP2bv4IDXB-hqRYTQ7UJaj9/s320/scrubs.gif" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">If you're interested in more, <a href="http://aynrandlexicon.com/lexicon/libertarians.html">here's what</a> Ayn Rand (the creator of Objectivism) had to say about libertarians.</td></tr>
</tbody></table>
Back on topic, many fellow conference-goers responded to the initial post with a great deal of condemnation, suggesting that the student obtained the grant under fraudulent pretenses, that his behavior was rotten, etc. Many people took issue with the beginning of the article's focus on the cost of nearby food (there were at least two grocery stores within two blocks) and technical issues with some of the presentations (which I did not notice, though I missed a number of the early-morning talks). There was not much explanation behind the more substantive criticisms of positions taken (Ted Cruz, Iran, Ron Paul), which people interpreted as further indication that the author had prejudged Objectivism and had gone to the conference only to gather material for an attack piece.<br />
<br />
My take: since the article was posted to a site by Lew Rockwell, who is apparently an anarcho-capitalist, part of the reason for the lack of substance behind the criticisms is due to the article being written for a specific audience. When writing for an ancap audience, you can simply say "they criticized Ron Paul" and rely on your readers to know why that's bad and what it implies. This applies to any group of people; when you have a shared context, you don't have to spend time explaining the basics.<br />
<br />
To my fellow Objectivists, I can appreciate the frustration over someone smearing something you like, but the vitriol doesn't help us achieve any values. At best, angry comments offer an outlet for frustration (I'll defer to the psychologists on the utility of that), and at worst, it paints us as bullies who can't handle even substance-free criticism. And seriously, be careful when throwing around accusations of "fraud." There are <a href="http://www.forbes.com/sites/alexepstein/2016/06/16/first-the-government-went-after-exxonmobil-now-theyre-going-after-me/#4421068469a1">real consequences</a> to watering down the definition of "fraud," and they are particularly bad for those who criticize the government. I don't know the details of ARI's application process for student grants, but assuming he didn't blatantly lie on whatever application he sent in, ARI knew to whom they were granting the scholarship.<br />
<br />
In response to the reaction on Facebook, the author wrote a <a href="https://medium.com/@sparkoffreedom/update-backlash-to-my-ocon-dissent-total-garbage-fraudulent-dishonest-corrupt-unforgiveable-ff4543f13528#.ug04gz73k" rel="nofollow">follow-up piece</a> which went into much more depth about specific disagreements with Objectivism and people at ARI. With or without your permission, I'm going to spend the rest of this already-too-long blog post addressing those points. To save you, dear reader, the trouble, I've bulletized the main points of the piece and provided links to the Ayn Rand Lexicon (henceforth "ARL") which address each issue. I also have my own responses below.<br />
<ol start="0">
<li>"I thought objectivism properly understood was easily reconciled with anarcho-capitalism": see <a href="http://aynrandlexicon.com/lexicon/anarchism.html">ARL on anarchism</a>. EDIT: Another, more detailed article on <a href="http://www.hblist.com/anarchy.htm">Anarchism vs Objectivism</a>.</li>
<li>Foreign policy, specifically Iran: See ARL on <a href="http://aynrandlexicon.com/lexicon/foreign_policy.html">foreign policy</a>. I'll have a little more to say below.</li>
<li>Government ‘Enforcement’ of Rights: ARL on <a href="http://aynrandlexicon.com/lexicon/government.html">government</a>.</li>
<li>The Moral Status of Government: More below.</li>
</ol>
<div>
If you're really interested in the arguments about government's role and justification, Ayn Rand articulated the points with far more clarity than I will in <i>The Virtue of Selfishness</i> and <i>Capitalism: The Unknown Ideal</i>. But if you've made it this far, I'm guessing you're interested in what I have to say, or are looking for solid proof that I'm some horrible person, in which case I'll save you the trouble by admitting that, for a brief part of my childhood, I preferred <i>Return of the Jedi</i> to <i>The Empire Strikes Back</i>.<br />
<br /></div>
<h3>
0. Objectivism as compatible with anarcho-capitalism</h3>
<div>
<br /></div>
<div>
This essentially boils down to the old "open vs closed" objectivism debate. For the precious few of you non-Objectivists who have waded through this much verbiage, the debate revolves around whether Objectivism is "the stuff Ayn Rand wrote or personally authorized," and is therefore closed to modification, or "a school of thought, with a range of disagreements about basic or high-level principles," in which case it is open to modification. Put another way, the debate is "given that Ayn Rand is dead, can Objectivism be modified?" Open Objectivism says yes; closed Objectivism says no. This relates to anarcho-capitalism because Ayn Rand was very explicit in rejecting anarchism, so if you accept closed Objectivism, then there isn't really much else to talk about.</div>
<div>
<br /></div>
<div>
Personally, I accept the closed Objectivism argument. If you want to disagree with her on philosophical issues, that's fine, but don't call the result "Objectivism." Take a bit of pride in your work and name it after yourself. If I created a philosophical system that was pretty similar to Objectivism but had four metaphysical axioms instead of three and talked about "Parrot Epistemology" instead of "Crow Epistemology," (that's a little Objectivism humor for you right there) I'd call it "Danism" and say it was inspired by or based on Objectivism. It would be wrong call it Objectivism because if it doesn't have three axioms and a crow, it isn't Objectivism.</div>
<div>
<br /></div>
<div>
To psychologize for a moment, I suspect this tendency comes from wanting to call oneself "an Objectivist" but then disagreeing about specific issues. The (false) dilemma then arises: do I give up the label "Objectivist" or change what Objectivist means? My strategy is not to take the label "Objectivist" too strictly or seriously. If I find that I disagree with Ayn Rand on something, I'll let her make her case, and come to my own conclusion or decide that I don't know enough about the subject to have a firm opinion. If I reach a conclusion different from hers, that's fine because I don't put much stock in being "an Objectivist." There is a major difference between "I agree with the philosophical principles Ayn Rand identified because and to the extent that they are true" and "I must, as a matter of duty, agree with every single word ever uttered or written by Ayn Rand."</div>
<div>
<br /></div>
<div>
Ayn Rand had an essay condemning people who try to use the prestige of a term or movement to promote incompatible ideas, but for the life of me, I can't remember what it was called. The person is metaphorically committing intellectual trademark infringement. They use the prestige of the name to promote something different or incompatible.</div>
<div>
<br /></div>
<div>
Oh jeez, this is getting long. I'm going to grab a glass of wine and forge ahead.</div>
<div>
<br /></div>
<div>
Ahh Francis Ford Coppola. I may not know what you did to become famous, but I appreciate your winery giving me a free bottle to perform a swing dance.<br />
<br /></div>
<h3>
1. Foreign policy</h3>
<div>
<br /></div>
<div>
This section will (hopefully) be shorter than the previous one, since I don't know enough about foreign policy to have strong opinions. I can identify some places where the article gets some things wrong, though. For general Objectivist principles of foreign policy, see the <a href="http://aynrandlexicon.com/lexicon/foreign_policy.html">lexicon</a> and for current thinking on what to do about Islamic totalitarianism, see <a href="https://amzn.com/0739135414">Winning the Unwinnable War</a>, which I've bought but have yet to read.<br />
<br />
So let's dive into some quotations!</div>
<blockquote class="tr_bq">
The notion that the political leaders of Iran, ostenisbly [sic] with the consent of their population (after all, governments are formed by the consent of the governed in the objectivist view), must “alter their constitution, “denounce terrorism” (which I’m sure is to be defined by morally just US officials), and “acknowledge the state of Israel” before any negotiations begin is a recipe for war.</blockquote>
The first mistake here is in "after all, governments are formed by the consent of the governed in the objectivist view." This parenthetical confuses an "is" with an "ought." Objectivism holds that for a government to be legitimate, its power must derive from the consent of the governed, but it definitely does not deny the existence of governments which rule by the fear of the governed. Now, Objectivism is not a social contract philosophy, and does not hold that actual written consent is required for a government to be legitimate. There's no "implicit social contract" floating around somewhere that we all have somehow agreed to. There is no problem in punishing someone for murder if that person did not consent to the principle that murder is bad.<br />
<blockquote class="tr_bq">
<i>It does not follow</i> [original emphasis] that since crimes occur between state and non-state individuals in another country, that a third, otherwise unassociated party has the moral authority to call for the “total destruction” of the way of life (Islam) of the conflicting parties.</blockquote>
Quite correct, but that is not the argument being made. This is where my lack of knowledge of foreign policy rears its head. The argument is not "the Iranian government hangs gay people from construction cranes, so we need to destroy them," it is "the Iranian government provides direct material and financial support to groups which have attacked and killed Americans." Destroying the government of Iran, therefore, is a matter of self-defense against someone who has already attacked us. Elan Journo's argument, as I understand it, is that we are already at war with Iran, since they have repeatedly attacked us, so fighting back would not be starting a war, it would be finishing a war that someone else started. Yes, yes, the Shah was bad and we supported him. Again, I don't know enough to have a first-handed opinion, so the most you'll get out of me is "I didn't know that. I'll have to think more about it."<br />
<blockquote class="tr_bq">
Because of the tremedous [sic] destruction wrought in war, the provocation for which you adovcate [sic], this foreign policy is an anti-human policy. As such, it is <b><i>not</i></b> [original emphasis] an element of a philosophy “for living on earth” (as we were reminded objectivism is, at least five different times by five different speakers). Rather, it is a policy for “death on earth,” and a philosophy which accepts it part and parcel is a philosophy for precisely the same.</blockquote>
Again, the argument is that they have already attacked us and continue to do so, therefore our options are to stand by and let them kill us or stop them. Force in this instance is justified in the same way as force against a serial killer is justified: to live on earth, you must stop people from killing you.<br />
<br />
<h3>
2. Government ‘Enforcement’ of Rights</h3>
<div>
<br /></div>
<div>
At this rate, I'll be done with this post just in time for the next OCON.</div>
<blockquote class="tr_bq">
One is not logically permitted to assert that individuals are entitled to “life, liberty, and the pursuit of happiness” and that therefore, ipso facto, we must form governments to protect these alleged rights.</blockquote>
This is not a primary claim, but one arrived at after a lot of build-up. Rights are first discussed in chapter 10 of 12 in <a href="https://en.wikipedia.org/wiki/Objectivism:_The_Philosophy_of_Ayn_Rand">Objectivism: The Philosophy of Ayn Rand</a>, a comprehensive description of her philosophy. Objectivism doesn't start with "individuals are entitled to certain rights," it starts with "open your eyes. Hey! There's stuff!" and then builds up slowly to reach high-level concepts of rights. Ayn Rand's essay <a href="http://aynrandlexicon.com/ayn-rand-ideas/the-objectivist-ethics.html">The Objectivist Ethics</a> walks up through this entire line of reasoning. The part about rights and governments comes up about 90% of the way through.<br />
<blockquote class="tr_bq">
Before addressing the second part of the non sequitor, let’s focus on the first. What the hell is a right to the pursuit of happiness?</blockquote>
<a href="http://aynrandlexicon.com/lexicon/pursuit_of_happiness,_right_to.html">Got you covered</a>. It is the right to take those actions necessary for a rational being to achieve values that are in fact life-enhancing. Want to know more? Read The Objectivist Ethics. It's in there.<br />
<blockquote class="tr_bq">
Suppose it makes someone rather happy to use Dallas police as target practice, or for others to use minorities as punching bags and bullet pin-cushions. Hey, they’re pursuing their right to happiness aren’t they?</blockquote>
Objectivism is not subjectivism. Rand chose the name "Objectivism" to emphasize that distinction. It isn't enough just to do whatever you feel will make you happy, you have to figure out what will actually benefit your life in a long-term way. Doing drugs might feel good in the moment, but it is actually self-destructive. The right to the pursuit of happiness is based on the ethical standard of the pursuit of life-enhancing values.<br />
<blockquote class="tr_bq">
See, what’s needed to denounce <i><b>both</b></i> [original emphasis] of these forms of behavior is a consistent theory of property — of just ownership over scarce resources (bodies included).</blockquote>
This is backwards. It isn't the right to property that justifies a right to life, it is the right to life which justifies the right to property. A right to life means the right to take those actions necessary to support one's life. <a href="http://aynrandlexicon.com/lexicon/property_rights.html#order_1">Quoting Rand</a>, "Since man has to sustain his life by his own effort, the man who has no right to the product of his effort has no means to sustain his life. The man who produces while others dispose of his product, is a slave."<br />
<blockquote class="tr_bq">
I assert, as a substantive challenge to you, my dear objectivist friends, that you have no theory of property. The absence of such a theory, and the patchwork substitution for it with banal references to what is actually a secessionary document, creates an ideological vacuum. All sorts of conflicts are thereby justified (see Point One above).</blockquote>
<a href="http://aynrandlexicon.com/lexicon/property_rights.html">Theory of property rights</a>.<br />
<br />
I'll add that given the limited time of the lectures at OCON (or any lecture given by anyone ever), a certain context of knowledge must be assumed. You can't begin every lecture by reading the entirety of <i>Objectivism: The Philosophy of Ayn Rand</i> (henceforth "OPAR"). Different lectures assume a different baseline context of knowledge, and the ones that referenced the Declaration of Independence assumed a certain level of knowledge of the Objectivist defense of rights. This is a fine balancing act that such a conference has to play. People have different levels of knowledge of the philosophy, and the organizers and speakers have to try to put together a program that is accessible to first-time attendees as well as interesting to 14-year veterans. Sometimes this means taking the Objectivist theory of rights as a given.<br />
<blockquote class="tr_bq">
But suppose we accept, arguendo, that one does have the rights so cited (this requries [sic] setting aside the objectivist admonition that rights are positive, rather than negative as is the libertarian position — but that is a discussion for another time).</blockquote>
As <a href="https://en.wikipedia.org/wiki/Negative_and_positive_rights">Wikipedia defines them</a>, Objectivism does not advocate for positive rights with the exception of police protection of person and property, if one considers that a positive right. As an aside, I find it strange to consider police protection a positive right. I mean, yes, it is "someone (the police) is obliged to do a thing for you (protect your life and property)," but then it leaves negative rights without any enforcement capability. Considering police protection as a positive right seems to say "you have the right to property, but if someone violates that right, then eh, that's a bummer." I'd have to think about it more.<br />
<blockquote class="tr_bq">
Private security firms and their employees, of which there are already three times as many as state (anti-)security agents, are perfectly capable of enforcing rights.</blockquote>
But they do so only within a context in which there is a single, ultimate arbiter. If security firm A and security firm B have a disagreement about some infraction, they can go to the government to have the dispute resolved. If A doesn't agree to the resolution and tries to force B to do things A's way, the government can resort to overwhelming force to enforce the decision of the court. This is why having a fair court system is so crucially important.<br />
<br />
Imagine instead you have A and B, but no government. They disagree, even after having their dispute mediated by C, an impartial arbiter. Now the only thing stopping them from resorting to violence is the fear of mutual destruction. We have models of this behavior, they are gangs. They are characterized by periods of relative peace punctuated by all-out violence when mutual threats break down or one gang becomes much weaker than another.<br />
<blockquote class="tr_bq">
Thus, for my critics: I challenge you to the following: prove that a right to the pursuit of happiness does not breed conflict, and prove that the state is necessary to enforce rights.</blockquote>
This gets into the nature of human beings and what counts as a rational pursuit of happiness. A core conclusion of Objectivism is that the interests and rights of rational men do not conflict. If I go out into the world and pursue my values, trading with people who are doing the same, then we can all be better off and nobody is threatened. When I go to CVS to buy some gum, I am pursuing my happiness by getting some yummy gum and the CVS workers are pursuing their happiness by working to earn a living. It is only by robbing the store, which entails treating other people not as rational equals but as victims to be plundered, that I could breed conflict. But this is <i>not</i> the pursuit of happiness of a rational individual; it is an attempt to circumvent rationality by gaining a value (the gum) while attacking what is required to create it (voluntary exchange). On this point, I highly recommend <a href="http://aynrandlexicon.com/ayn-rand-ideas/the-objectivist-ethics.html">The Objectivist Ethics</a>.<br />
<br />
Proving the state is necessary to enforce rights is a big topic, but the outline is that in order to banish force from social affairs (which itself is necessary to allow people to act on their judgment), there needs to be a single, final arbiter of what constitutes a violation of rights, and it needs to have a monopoly on the initiation of physical force. Otherwise, you end up in the bad outcome with A and B I described above.<br />
<br />
Okay, now it's really late, so I'm going to speed through the rest. Right after I get another glass of wine.<br />
<br />
Shut up, sunk cost fallacy! You have no power over me!<br />
<br />
<h3>
3. The Moral Status of Government</h3>
<div>
<br /></div>
<div>
So this is about taxation, and here, I think you disagree less with Objectivists than you think you do.</div>
<blockquote class="tr_bq">
I was told by [O]nkar Ghate that Rand would have preferred that taxation be voluntary. Well, to him and to others who hold this view, I invite you to examine reality. You might notice that <i>taxation is defined by the element of coercion</i>. A consentual [sic] transfer of funds from one party to another is not “voluntary taxation.”</blockquote>
<div>
First off, Ayn Rand <a href="http://aynrandlexicon.com/lexicon/taxation.html">advocated voluntary funding of government</a>. She wrote an essay called "Government Financing in a Free Society," in <i>The Virtue of Selfishness</i> about this very issue. Yes, taxation implies coercion, so "voluntary taxation" is a contradiction. However, it is shorter than "voluntary funding of government services," and within the context of an Objectivist conference, the meaning is understood.</div>
<blockquote class="tr_bq">
Conversely, when funds are involuntarily transferred from one party to another, it is called <i>taxation</i>, also known as <i>theft</i>.</blockquote>
Total agreement here.<br />
<br />
It should be noted that, in the transition to a free society, coercive taxation would be one of the last things to go, not the first. The legitimate functions of government still need to be funded, and pulling out the rug by outlawing taxation would be throwing the good out with the bad. There are plenty of things that can be eliminated tomorrow without any disruptions to legitimate government business such as minimum wage laws, most regulations, restrictions on free speech, and many more. There are other things which should be eliminated eventually, but not overnight. For example, the public schools should all be privatized, but it would be worse to shut down all public schools tomorrow because schooling is not a legitimate function of government. Even if the entire population was on board with privatizing all education, changes in management and funding structure take time to do well.<br />
<br />
It is also important to realize that we are nowhere near the point where we can eliminate taxation based purely on political consensus. We are so far away from having even a whole percentage point of the population interested in eliminating coercive taxation that it just isn't worth spending a lot of time thinking about exactly how that transition will take place. It is worth having a high-level answer to someone who says "okay, I'm on board with this whole government protecting rights business, but how do you pay for it?", but our efforts are better spent convincing people that we should move towards voluntary government financing before coming up with detailed plans on how much money would actually be raised.<br />
<br />
<h3>
Final Thoughts</h3>
<div>
<br /></div>
<div>
I'm so close to being done that I can see the whites of its eyes!</div>
<blockquote class="tr_bq">
Other possible challenges abound. Why praise the neo-con, war-monger, anti-lifer Ted Cruz</blockquote>
The Objective Standard <a href="https://www.theobjectivestandard.com/2016/04/ted-cruz-for-president/">outlines the argument well</a>. Basically, the case was that he is surprisingly good on some things, really bad on others, but his ability to act on his bad policies is relatively limited.<br />
<blockquote class="tr_bq">
I couldn’t let myself forget the ARI/objectivist defense of intellectual property. This is a major error.</blockquote>
Oh god I want to go to sleep and intellectual property is so complicated but I have to add a response or else something bad will happen wait why do I care about someone being wrong on the internet?<br />
<br />
Ahem.<br />
<br />
I'll just link the <a href="http://aynrandlexicon.com/lexicon/patents_and_copyrights.html">patents and copyrights</a> page of ARL and pretend that suffices.<br />
<br />
<h3>
I'm done</h3>
<div>
<br /></div>
<div>
This took way more time than I should have spent on it, but there you go. I'm sorry you didn't have a good time at OCON; in addition to the profound and good ideas, there are a lot of cool people there from all walks of life. In what seems like the unlikely event that you decide to come back again next year, come and find me. I'd be more than happy to discuss the ideas raised to the best of my knowledge and ability.</div>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-17952928314852870162016-02-27T15:13:00.004-05:002023-03-08T19:43:37.315-05:00The sad state of free speech in college<p>I just saw some videos of the shameful assault on free speech at CSULA by students, faculty, and the president of the university. A speaker named Ben Shapiro was set to give a talk called "When Diversity Becomes a Problem" and had received permission and a venue to speak. In the week before the event, students demanded that the event be shut down, citing the usual (and usually false) claims of "racism" and "hate speech." The president canceled the event, but Young Americans for Freedom and Shapiro decided to hold the event anyway. A professor, Robert Weide, threatened to assault students sponsoring the event. Shortly before the talk started, the president un-cancelled the event, but hundreds of students barricaded the doors to prevent Shapiro and the audience from getting in the room. <a href="https://www.youtube.com/watch?v=4c5YHIdoDWQ">Here</a> are <a href="https://www.youtube.com/watch?v=tKsX7AFgU98">some</a> videos <a href="https://www.youtube.com/watch?v=iEkB4QF5KWY">I found</a> of <a href="https://www.youtube.com/watch?v=cFt6E8eLsk0">the event</a>.</p>
<a name='more'></a>
<p>And here is the <a href="http://livestream.com/YAF/events/4870270/videos/113531013">video of the speech</a>.</p>
<p>Shapiro and the students had to sneak in through the back, escorted by police. Keep in mind that this is a college campus in America in 2016 and not French Resistance fighters in Nazi Germany.</p>
<p>That college students in a civilized country would resort to physical force to try to shut down free speech is appalling in itself, but there is something deeper that is wrong with it. The students, and the faculty and administration which encourages and supports them, are mounting a direct assault on the very concept of college education. Let me explain.</p>
<p>The purpose of college is to learn facts and methods for understanding and integrating facts. This assumes that people are capable of learning, otherwise attending college would be pointless, as no transmission of ideas between people would be possible. The reason that people go to a college campus rather than simply checking out books from a library is so that they can exchange ideas with other people in person. Finally, the process of learning requires each individual judge for him or herself the validity and merit of any idea before deciding whether to accept or reject it. If this were not the case, then everyone could save a lot of time and trouble by printing out a list of views and values to unquestioningly accept and we wouldn't need to waste time with asking "why."</p>
<p>The students and administration are directly attacking the process of learning through exposure to new ideas. They are saying "because some people do not like this idea, nobody is allowed to hear it." It is particularly ironic that the people demanding forced ignorance because Imagine if this principle were practiced consistently throughout a college. All it would take is one flat earther to shut down the geology department, one intelligent designer to shut down the biology department, or one person who can't speak Spanish to shut down the Spanish department. The students, faculty, and administration are attempting to make the truth subject to a tearful veto in which anyone who is offended by an idea can have that idea banned from campus.</p>
<p>If you are at college not to learn and help others learn, but to avoid new ideas and resort to violence to prevent others from learning, you have no business being at a college. The proper response from the administration would be to suspend or expel every student who blocked access to the lecture. By their actions, these students have shown that they are enemies of thought and learning. Such a person at a university is like having a Luddite who wants to smash all computers working at a tech company, a police officer who thinks that crime is superior to law, or a child-murdering babysitter. Their beliefs are in irreconcilable conflict with their occupation and the only solution is to remove them from said occupation. A student who refuses to learn or to let others learn has no business being a student.</p>
<p>Of course, the administration has shown that they are unwilling to defend their academic integrity (or legal requirements of a state school). I would be extremely surprised if any of the enemies of thought and learning received so much as a slap on the wrist. The fact that the administration tolerates and encourages this kind of behavior only serves to teach the students both at CSULA and elsewhere that violence is an acceptable and legitimate means of resolving differences of opinion. It is this point which has me worried. When people come to accept that ideas can be countered by physical force, then we are truly screwed. I hope, but do not expect, university administrations to come to their senses before too many more students are taught that censorship is good.</p>Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-2978239916531154562016-01-10T05:30:00.003-05:002023-03-08T19:43:51.383-05:00Letter to the city governmentSo I just found out that, despite promising to end the program this month, the Mountain View city government has decided to extend its stupid <a href="http://www.mountainview.gov/depts/pw/recycling/garbage/residents/carts/compost.asp">food scraps collection pilot</a> "indefinitely." This program cut garbage pickup services in half to once every other week and instead allowed residents to put food scraps in composting bins to be picked up. Upset at this pointless extension of a decrease in useful services provided by the city government, I wrote them the following email:<br />
<br />
<a name='more'></a>
I just found out that the food scraps pilot, which my household was entered into without our consent, will be extended indefinitely. This is unacceptable. We were told that this pointless waste of time and money would be ended at the beginning of this year, which was bad enough. That we are being forced to continue to foul up our environment with trash around our houses in a complete failure of the duties of the city government to honor the provision of services that are its responsibility.<br /><br />
There is not, and never will be, a shortage of landfill space in the United States, so the basic justification for the existence of the program in the first place made no sense. As an example (and only an example) of how much of a non-problem waste disposal is, consider the following. According to <a href="http://foresternetwork.com/daily/waste/landfill-management/landfill-economics-part-ii-getting-down-to-business-part-i/">this article</a>, an average modern landfill can store about 66,000 tons per acre. Death Valley is 1,920,000 acres, which means about 127 billion tons of garbage could be stored in Death Valley. In 2012 (the most recent year available), the <a href="http://www3.epa.gov/epawaste/nonhaz/municipal/pubs/2012_msw_dat_tbls.pdf">entire US produced</a> 250,890,000 tons of trash, which means that, without any recycling at all, there is enough space in Death Valley for 505 years worth of trash of the entire US. If one considers only the trash discarded to landfills in 2012, which was 164,270,000 tons, then Death Valley could store 771 years worth of trash. Obviously, it wouldn't make sense to ship all of the country's trash to one location, but the point of the example is to illustrate just how much of a non-issue garbage disposal is in the US.<br /><br />
The goal of "zero waste" is pointless, even in theory. Waste is an inescapable part of biological existence. Every living cell of every organism that has ever lived on this planet produces waste. The reason waste is harmful to humans is that it causes human health problems and can harm open spaces that humans use for recreation and enjoyment. This is why the invention of landfills is beneficial: rather than spreading waste out over places we care about, we concentrate waste in a small number of places that are not otherwise of much value to humans. This is an unmitigated good, because it allows us to have cleaner human environments. By keeping trash next to one's house for an extra week, the food scraps program is turning back the clock on human development and closer to the times when human had to live in their own filth. It is a small step, of course, but one which has no possible human justification. When given the choice between a cleaner human environment and a dirtier one, the Mountain View city government evidently decided that its citizens should live in a dirtier environment.<br /><br />
It is merely a waste of money for the city government to pay people to drive trucks to pick up empty green bins, but it is unacceptable to continue a program which <a href="http://www.mountainview.gov/depts/pw/recycling/garbage/residents/carts/compost.asp">was promised</a> to end this month. End this program now, and restore our garbage service to the previous levels.Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com3tag:blogger.com,1999:blog-7770370347473031286.post-39237622063804156462015-05-23T05:26:00.001-04:002023-03-08T19:44:17.065-05:00Response to a bunch of nonsense<p>This was originally going to be a Facebook comment in response to <a href="http://www.cracked.com/blog/5-helpful-answers-to-societys-most-uncomfortable-questions/" rel="nofollow">this article</a>, but ended up being much, much longer.</p>
<a name='more'></a>
<p>Wow, that is a hot pile of nonsense, but in a way that is illuminating. It's interesting in how it approaches some standard topics, and I was actually surprised that it didn't bemoan the higher population and life expectancy of humans as a great sin. I typically expect anti-induatrialism with modern collectivism.</p>
<p>Let's first start at the beginning. It is revealing that, in order to assign Original Sin (guilt by birth), one has to destroy the concept of individuals. This article was refreshingly honest and straightforward in its attempt to deny the existence of people. Most things I read talk around it and wouldn't be so bold as to say "you're not a person" flat out.</p>
<p>This raises the obvious question that if I'm not a person, and given that my being a person is something of which I have the most direct evidence, then how can anyone be a person? If I'm not a person, and you're not a person, then there is no basis on which to conclude that anyone is a person, so people don't exist and neither do societies. At this point, at the beginning of the article, the author firmly establishes that he's no longer talking about reality, so pretty much anything goes. As an aside, think about what his implied criteria are for declaring some entity "a person." You would have to have a virgin birth to some non-human mother on some distant planet without any contact with any other people. If us normal "non-persons" don't count as persons, what, if anything, does?</p>
<p>We then get into near-total determinism, with a collectivist bent. The determinism is important because it means that you can't take any credit for the things you have achieved. The collectivism is important because it means that you have a personal (whoops, can't use that word for us non-persons!) responsibility for things which your collective has done.</p>
<p>The problem with going the determinism route (aside from the trivial fact of it being self-evidently false), is that it also destroys one's ability to make decisions based on new information. This is obviously true and inescapable if you've bought into determinism: if all of your opinions and actions are determined, then you have no ability to change your mind based on arguments. If determinism is true, then whatever the article is pointless, because everything I'm going to do is already determined. If determinism is false, then the central argument of the article vanishes.</p>
<p>The collective-deterministic angle also undermines the later point in the article about the value of geniuses. If Einstein (who, let's remember, is not a person) discovered something great, he didn't actually do anything. It was just his genes and environment and everybody else that discovered relativity. And hey, since we all are responsible for the things other non-people did, it was actually me who discovered relativity, and wrote all of Mozart's music, and built the Saturn-V rockets, and painted the Mona Lisa! I should put all of that on my résumé!</p>
<p>It was at this point that I expected him to start getting into how nothing really exists, and was pleasantly surprised that he didn't go full Kantian.</p>
<p>The bit about individualism being the root of bigotry and discrimination based on nonessentials is just bizarre. By framing equality as something detrimental to individuals ("The big flaw in humanity is that we always cling to short-term comfort over long-term prosperity (because we see ourselves as individuals, instead of part of a whole), and certain classes of people were benefiting from doing things the old way, even if humanity as a whole was not."), he is making his job unnecessarily difficult. He is, in effect, saying "hey, all you white, straight, rich men! Diversity and equality will only come at your expense and only has misery to offer you, but you should do it anyway because you're not a person and don't matter." When presented with an argument like this, it's not hard to see why some people are less than enthusiastic about diversity. Rather than admonishing rich, straight, white men for not being willing to hobble themselves for no personal benefit, try something like "do you like eBay? Then you want more women in business (Meg Whitman). Do you like Chinese food? Then you want more immigration. Do you like iPhones? Then you want more gay CEOs. Think of all the amazing stuff you could have if more people could get into the awesome-stuff-making business, be it tech, music, food, or anything else." By presenting (say) racial integration as something one does despite its negative impact on oneself, the author is agreeing with the racist assertion that integration hurts white people, but is taking the other side and saying "do it anyway."</p>
<p>To tie it together, the author falls back on the collective guilt concept and
uses it to set up a Kafkatrap. A Kafkatrap is an incredibly useful <a href="http://esr.ibiblio.org/?p=2122">concept invented by ESR</a> and is worth a read on its own. In short, a Kafkatrap is a logical fallacy of the form "Your refusal to acknowledge that you are guilty of {sin,racism,sexism, homophobia,oppression…} confirms that you are guilty of {sin,racism,sexism, homophobia,oppression…}." There are many variants of the Kafkatrap, and the relevant one in this article is what ESR calls the "Model C Kafkatrap," in which the fact that you benefit from other people doing something bad makes you guilty by association.</p>
<p>Finally, the article relies on the idea that we are responsible for fixing things we did not cause, contribute to, or support. The money quote is "Telling those kids that, as white people, they are responsible for fixing inequality is just a statement of fact." In what way is this a fact? How do we come to know this fact (even putting aside all the epistemological problems with determinism)? About 250 years ago, Hume recognized that facts aren't going to get you to a system of morality which requires me to give up my values for the sake of someone else. You always need something supernatural or mystical, be it the Christian god, Marx's false consciousness, Rawls' original position, Plato's forms, Kant's noumenal world, and so on. So even if all of the rest of the piece weren't so problematic, it would still rest on the groundless idea that if someone, somewhere is suffering, then that is a moral strike against me.</p>
<p>All is not lost, however, and there are factual, non-ridiculous, self-interested arguments in favor of equal rights. As I mentioned above, if you judge people based on nonessential characteristics in a particular context such as race, religion, gender, and so on, you are ultimately hurting yourself. I don't care about the sexual orientation of the CEO of the companies from which I buy my electronics, and if I did, I would be greatly limiting my options. Also, I want people to judge me for the essential characteristics of mine, and so will hold myself to that same standard.</p>
<p>What a self-interested justification for equal rights does not get you is a duty to pay reparations, either in money or in spirit, for things you had no part in, control over, or support for.</p>
<p>P.S. The caveat of "nonessential" characteristics in regards to judgments is important. What is essential is context-dependent, but is still objective. There is no reason to care about someone's blood type or gender when buying a pack of gum from a clerk or working for a boss, but these characteristics are essential when getting a blood transfusion or choosing a spouse.</p>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-70927875662535565102014-02-02T23:28:00.001-05:002023-03-08T19:44:40.675-05:00Some musings on unwed parents and poverty<p>
My dad sent me
an <a href="http://johnhcochrane.blogspot.com/2014/01/two-points-on-inequality.html">article</a>
about inequality a few days ago. The two points of the article were:
</p>
<ol>
<li>that the minimum wage is not well targeted at reducing poverty</li>
<li>that a large factor in poverty is family structure</li>
</ol>
<a name='more'></a>
<p>
The article cited the figure that 72% of black kids today are born to
unmarried parents, up from 24% in 1965. Also, the poverty rate for children of
single mothers is drastically higher than for married couples. So my dad and I
were coming up with potential hypotheses for why this might be. Of interest is
a <a href="http://www.brookings.edu/research/papers/1996/08/childrenfamilies-akerlof">Brookings
Institute</a> report with some numbers and a hypothesis that some of the
change over the past half century might be because of a decrease in the number
of <a href="http://en.wikipedia.org/wiki/Shotgun_wedding">shotgun weddings</a>
(a wedding arranged to avoid embarrassment due to an unplanned pregnancy).
</p>
<p>
We were talking about getting data on shotgun marriages (indented regions are
written by my dad):
</p>
<blockquote>
I think it would be hard to get data on marriages after pregnancy. I doubt the
birth records would indicate how long the parents had been married.
</blockquote>
<p>
Well, all you would need is the ability to link up birth certificates to
marriage certificates. You would find a birth certificate, look at the mother,
and see if she has a marriage certificate older or younger than 9 months. I
don't know anything about the practical difficulties of obtaining such a
database.
</p>
<blockquote>
Even if you knew they had married after pregancy, how would you exclude
pregnancy in anticipation of marriage. "We were getting married anyway, so we
I got pregnant, we just started our family"
</blockquote>
<p>
With that data alone, you couldn't. You could make a pool of "shotgun wedding
candidates," i.e. people who got married close to or after pregnancy and then
interview a random sample about whether they considered their marriage
"shotgun" or not. You could then extrapolate to the broader population. For
fun, you could measure some other variables so that your extrapolation was
more accurate.
</p>
<p>
Just collecting that data alone would be an interesting project in and of
itself, without any accompanying policy analysis or anything.
</p>
<blockquote>
I would have thought that blacks, as more churched than whites, would have had
a higher rate of shotgun weddings, but I have no data and that would not
support the theory.
</blockquote>
<p>
It seems reasonable on its face. If so, then the decline of shotgun weddings
might have a disproportionate impact on blacks in terms of unwed births if
indeed shotgun weddings were a significant force against unwed births. Again,
without any data, it is just wild speculation.
</p>
<blockquote>
I come back to thinking about it as rational people responding rationally to
the options and incentives they face. Lecturing people about the value of
marriage, while incenting them to have out of wedlock kids is self defeating.
</blockquote>
<p>
Well, it depends on how strongly they and their peers buy into the lecturing.
Social/peer pressure is clearly a powerful force, and I don't think it is
unreasonable to expect that an increase in the stigma against unwed births
could offset monetary incentives for single motherhood.
</p>
<p>
An interesting question is whether the social stigma itself is altered by the
monetary incentives. This would probably take effect over time, as the
introduction of monetary incentives drives more people to single motherhood,
despite facing a stigma. Say you have three time periods: t=0, t=1, and t=2.
At t=0, there is no governmental reward for having a child out of wedlock.
There is a significant stigma against single motherhood and only a small
fraction of women choose to have unwed births.
</p>
<p>
At t=1, monetary benefits are introduced, but the stigma is unchanged. The
balance of monetary benefit versus social cost is tipped for some fraction of
women and they choose to become single mothers. At the end of t=1, the stigma
against single motherhood is weakened since it is difficult to maintain a
social stigma against a large fraction of a population.
</p>
<p>
At t=2, the monetary benefits are the same, but the stigma is lowered, so more
women decide to become single mothers, further reducing the stigma.
</p>
<p>
If you could somehow revive the stigma at t=3, you could potentially lower the
single motherhood rate by making the social-cost/monetary-benefit calculation
unattractive for the marginal woman. The difficulty is that it would be
extremely hard to get people to buy into the idea that single motherhood is an
unspeakable horror when 73% of the children in the community are born to unwed
mothers. It's just too normal to be taboo.
</p>
<blockquote>
I have to assume that people have out of weklock kids because it makes sense
for them to do that. It would not make sense to you and Sarah, but you guys
face different incentives and options.
</blockquote>
<p>
I haven't looked at the specifics, but depending on the level of government
subsidies and one's earning potential, it may literally pay to have additional
kids. That's a scary thought, since, if true, the government is paying mothers
to birth children into poverty.
</p>
<blockquote>
Anecdote, I know, but I read an article a while ago about a researcher at Penn
who was studying this issue. She pointed out the windw of her office and noted
that the Penn campus was filled with sexually active young women, but they
were not having babies. They had a lot to lose by interferring with their
studies and job prospects, so they availed themselves of birth control and
abortion. Impoverished high school dropouts with no further educational
expectations and terrible job prospects may not see themselves as having
anything at all to lose by starting families. They do not expect to be
financialy secure in a few years, or ever. They may have as much interest in
having children as do the Penn students. Should they put those plans on hold
forever? Until they have good jobs? They don't expect ever to have good jobs,
and they are probably right.
</blockquote>
<p>
I think that part of the issue is that having a kid when you are young reduces
your chances of getting a good job, so it is somewhat of a self-fulfilling
prophecy.
</p>
<blockquote>
Meanwhile, they see the option to live a life pretty much like the one they
lived growing up. Not great, but... life.
</blockquote>
<p>
Plus, depending on the level of government benefits, they might even come out
ahead financially. Or, at the least, not very much behind.
</p>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-30891543412235231172013-09-11T19:31:00.000-04:002013-09-11T19:41:14.297-04:00Update on "When European 'Austerity' Isn't"<p>Back in June 2012, I <a href="http://www.haxney.org/2012/06/when-european-austerity-isnt.html">wrote a post</a> about how little actual "austerity" had happened among European governments. Most governments had increased their level of spending between 2008 and 2011, and only three governments had decreased their spending from 2007 to 2011. Now that <a href="http://epp.eurostat.ec.europa.eu">Eurostat</a> has the numbers from 2012, we can see how things have changed in the past year. As before, all numbers are taken unmodified from <a href="http://s.haxney.org/KNUnMw">Eurostat</a>.</p>
<a name='more'></a>
<p>The results are interesting and kind of mixed. The region as a whole increased its spending:</p>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/a/haxney.org/spreadsheet/tq?key=0Ain9fnIYwc83dGVMVkEwdExoY1RmV0N0TS0zMW43d0E&transpose=1&headers=1&merge=ROWS&range=A1%3AL1%2CA15%3AT15%2CA18%3AT18&gid=18&pub=1","options":{"series":{"0":{"pointSize":5,"color":"#ff9900"},"1":{"pointSize":5},"2":{"pointSize":5,"color":"#0000ff"}},"curveType":"","animation":{"duration":500},"width":"100%","lineWidth":2,"hAxis":{"title":"Year","useFormatFromData":true,"minValue":null,"viewWindow":{"min":null,"max":null},"gridlines":{"count":"11"},"maxValue":null},"vAxes":[{"title":"Spending (Billion \u20ac)","useFormatFromData":false,"formatOptions":{"source":"none","scaleFactor":"1000"},"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null},{"useFormatFromData":true,"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null}],"title":"Region Economies","booleanRole":"certainty","height":"100%","legend":"right","useFirstColumnAsDomain":true,"tooltip":{}},"state":{},"view":{},"isDefaultVisualization":true,"chartType":"LineChart","chartName":"Chart 3"} </script>
<p>What about the smaller problem countries of Greece, Portugal, and Ireland? Surprisingly, they have actually decreased their spending from 2011.</p>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/a/haxney.org/spreadsheet/tq?key=0Ain9fnIYwc83dGVMVkEwdExoY1RmV0N0TS0zMW43d0E&transpose=1&headers=1&merge=ROWS&range=A1%3AL1%2CA22%3AT22%2CA34%3AT34%2CA25%3AT25&gid=18&pub=1","options":{"series":{"0":{"pointSize":5},"1":{"pointSize":5},"2":{"pointSize":5}},"curveType":"","animation":{"duration":0},"width":"100%","lineWidth":2,"hAxis":{"useFormatFromData":true,"title":"Year","minValue":null,"gridlines":{"count":"11"},"viewWindow":{"min":null,"max":null},"maxValue":null},"vAxes":[{"useFormatFromData":false,"title":"Spending (Billion EUR)","formatOptions":{"source":"none","scaleFactor":"1000"},"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null},{"useFormatFromData":true,"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null}],"booleanRole":"certainty","title":"Greece, Portugal, and Ireland","height":"100%","legend":"right","useFirstColumnAsDomain":true,"annotations":{"domain":{}},"tooltip":{}},"state":{},"view":{},"isDefaultVisualization":true,"chartType":"LineChart","chartName":"Chart 3"} </script>
<p>As for the larger economies of France, Germany, Italy, Spain, and the UK, all of them spent more in 2012 than they did in 2011. Contrary to the rhetoric, the UK increased its spending dramatically from 2011 to 2012, by 8.6%.</p>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/a/haxney.org/spreadsheet/tq?key=0Ain9fnIYwc83dGVMVkEwdExoY1RmV0N0TS0zMW43d0E&transpose=1&headers=1&merge=ROWS&range=A1%3AL1%2CA20%3AT21%2CA26%3AT26%2CA38%3AT38%2CA41%3AT41&gid=18&pub=1","options":{"series":{"0":{"pointSize":5},"1":{"pointSize":5},"2":{"pointSize":5},"3":{"pointSize":5},"4":{"pointSize":5}},"curveType":"","animation":{"duration":500},"width":"100%","lineWidth":2,"hAxis":{"useFormatFromData":true,"title":"Year","formatOptions":{"source":"data"},"minValue":null,"viewWindow":{"min":null,"max":null},"gridlines":{"count":"11"},"maxValue":null},"vAxes":[{"useFormatFromData":false,"title":"Spending (Billion \u20ac)","formatOptions":{"source":"none","scaleFactor":"1000"},"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null},{"title":"Spending (Billion \u20ac/$)","useFormatFromData":true,"formatOptions":{"scaleFactor":"1000"},"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null}],"booleanRole":"certainty","title":"Large Economies","height":"100%","legend":"right","useFirstColumnAsDomain":true,"annotations":{"domain":{}},"tooltip":{}},"state":{},"view":{},"isDefaultVisualization":true,"chartType":"LineChart","chartName":"Chart 3"} </script>
<p>As for the change in spending since the crisis began (in 2007 or 2008), the picture is less austere than last year. Only seven countries spent more in 2008 than they did in 2012: Iceland, Romania, Ireland, Greece, Latvia, Hungary, and Lithuania. Only Ireland, Iceland, and Hungary spent more in 2007 than they did in 2012. Greece spends almost exactly as much (100.08%) as it did in 2007.</p>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/a/haxney.org/spreadsheet/tq?key=0Ain9fnIYwc83dGVMVkEwdExoY1RmV0N0TS0zMW43d0E&transpose=0&headers=1&merge=COLS&range=A1%3AB66%2CC1%3AC41&gid=17&pub=1","options":{"vAxes":[{"title":"Percentage Change","useFormatFromData":true,"minorGridlines":{"count":"0"},"formatOptions":{"source":"data"},"minValue":0.6,"viewWindowMode":"explicit","gridlines":{"count":"5"},"viewWindow":{"min":0.6,"max":1.5},"logScale":false,"maxValue":1.5},{"useFormatFromData":true,"minValue":null,"viewWindow":{"min":null,"max":null},"maxValue":null}],"title":"2012 Spending as a percentage of 2007/2008","booleanRole":"certainty","height":"100%","animation":{"duration":0},"domainAxis":{"direction":1},"legend":"top","width":"100%","hAxis":{"title":"","useFormatFromData":true,"minValue":null,"viewWindowMode":null,"viewWindow":null,"maxValue":null},"tooltip":{},"isStacked":false},"state":{},"view":{},"isDefaultVisualization":true,"chartType":"ColumnChart","chartName":"Chart 4"} </script>
<p>So what to make of this? Well, it is true that the smaller problem countries have decreased their spending in the wake of the crisis, though not by a great deal. The larger countries, including, notably, Spain, have all increased their level of spending, so the claims of austerity remain false. The UK, which some have claimed to be austerity central, has increased spending drastically in the past year. Overall, "European Austerity" is largely a myth.</p>Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-39958023449989940262013-07-09T00:00:00.001-04:002023-03-08T19:45:12.944-05:00Public School Peril: a Parallel<p><a href="http://www.city-journal.org/html/13_1_how_i_joined.html">Horror story</a> of a DC public school.</p>
<p>I had a very brief experience teaching ballroom dance to middle schoolers in an after-school program at a public school, in Woonsocket, RI. Woonsocket is apparently a relatively poor town, but the school buildings were brand new, so it couldn't have been that bad.</p>
<a name='more'></a>
<p>The author's comments about most of his time going to maintaining order match my experience exactly. He also talked about how ridding the class of the 2-3 worst offenders drastically improved the experience. If I could have kicked out the worst 2-4 kids (from a class of about 20), the difference would have been transformative. Instead, the majority of my time was spent trying to undo the damage caused by these few. I spent 15 minutes one day trying to keep a student from leaving the building.</p>
<p>For a stark contrast, I also taught a ballroom after-school program to high-school students at Andover, the world's greatest educational institution. To a person, they were attentive, eager, and well-behaved. I taught more in an hour at Andover than in five at the public school.</p>
<p>I commend this guy for sticking with the job as long as he did; there's no way I could have done the program for longer than I did. As it was, I would spend the hour after the class bitching to my girlfriend about how horrible the kids were. There's no chance in hell that I'd put myself through an ordeal like that again.</p>
<p>The whole thing was a huge waste of time for nearly everyone involved; the kids weren't getting much out of it and my time could have been put to better use doing almost literally anything else. It's a sad state to be in and there doesn't seem to be a simple way out. Being able to expel or flagellate the few troublemakers would be a start.</p>Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-52233782059461712352013-02-13T15:56:00.001-05:002023-03-08T19:46:24.785-05:00Easy solution to the melting ice caps<p>People are always belly-aching about how the polar ice caps are melting. "Oh,
the sea level is going to rise and flood coastal cities!" Blah blah blah, as if
this is some unsolvable problem.</p>
<a name='more'></a>
<p>But, as we all know, human ingenuity knows no bounds, and there is a simple,
cost-effective solution to the "problem" of arctic ice melting: just re-freeze
it. A quick back-of-the-envelope calculation reveals how simple this solution
would be.</p>
<p><ul>
<li>According to
the <a href="http://psc.apl.washington.edu/wordpress/research/projects/arctic-sea-ice-volume-anomaly/">
Polar Science Center at the University of Washington</a>, the arctic pole is
losing an extra 280 km³ of ice per year beyond the seasonal
fluctuations.</li>
<li>Ice has a density of 0.9167 g/cm³, so 280 km³ (2.8e17 cm³) is 2.56676e17
grams of ice lost per year.</li>
<li>1 Watt can freeze 8 grams of water per hour, according to the
ever-trustworthy <a href="http://boards.straightdope.com/sdmb/showthread.php?t=534814">beowulff
on the Straight Dope message boards</a>.</li>
<li>The state-of-the-art nuclear reactor design is
the <a href="http://en.wikipedia.org/wiki/European_Pressurized_Reactor">European
Pressurized Reactor</a>, which, for the low-low price of $11 billion, pumps
out a hefty 1,600 MW</li>
<li>A single EPR could freeze (assuming 100% efficiency) 1.28e10 grams of
water per hour, or 1.12e14 grams per year.</li>
<li>It would therefore take 2.56676e17 / 1.12e14 = 2,291 EPRs to re-freeze
the yearly arctic ice loss. At $11 billion a pop, that's $25 trillion to
build enough power plants to stop the melting of the polar ice caps</li>
</ul></p>
<p>So all this worrying about melting ice caps just boils down to a lack of
creativity. For a mere $25 trillion, we could build 2,291 nuclear reactors in
the arctic circle and use them to run giant freezers. It's so obvious, I can't
believe nobody's thought of it before.</p>
<p>You're welcome, world.</p>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-80434993187434443212012-12-17T15:20:00.000-05:002012-12-17T15:20:27.235-05:00Using a Wiimote in Mupen64plus<p>After much head-wall-banging, I got a Wiimote to pair successfully with my
computer and work as a controller in <a
href="https://code.google.com/p/mupen64plus">Mupen64plus</a>! There was a lot of
trial and error, so I've created a guide to getting a working setup so future
generations don't have to go through what I did. The details are in <a
href="https://github.com/haxney/wiimote-mupen64">this git repo</a>, which
includes detailed instructions and config files.</p>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-48577400403422407772012-12-12T11:25:00.000-05:002012-12-12T11:26:31.447-05:00Trying an Android ROM<p>Against my better judgment, I am going to take another shot at installing a
ROM on my phone. The battery life could use some improvement, and people have
claimed that some of the 3rd-party ROMs can help with that. I know I have
promised myself not to play with ROMs on my phone again, since the result is
usually a big waste of time with nothing to show for it, but this time is
different.</p>
<p>Brace yourselves for a follow-up in which I immediately regret this
decision.</p>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com2tag:blogger.com,1999:blog-7770370347473031286.post-66315209362058120162012-12-11T21:49:00.000-05:002012-12-11T21:49:34.090-05:00Another Ubuntu update, another b0rked system<p>*sigh*</p>
<p>I updated to 12.10, and Alt+middle-click to resize windows was broken. After about an hour of circular Googling, I found the correct incantation to sprinkle. For some strange reason, the setting <code>org.gnome.desktop.wm.preferences.resize-with-right-button</code> was set to <code>true</code>. Set it back to <code>false</code> and the system returns to its former functioning state.</p>Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-66066203932328061382012-11-18T00:50:00.002-05:002023-03-08T19:46:44.499-05:00Better than "Understanding OOP"<p>I came across a <a href=" http://www.csis.pace.edu/~bergin/patterns/ppoop.html">page talking about the joys of OOP</a> via <a href="http://irreal.org/blog/?p=1393">this blog post</a>. The original page was a thing of horror. I modified the Elisp code from Irreal, adding a few additional features:</p>
<a name='more'></a>
<script src="https://gist.github.com/4103741.js"> </script>
<p>In addition to equality matches, it can match using regexps and arbitrary functions. Let's see Java do that in 20 SLOC.</p>Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-34557658159347193642012-09-29T15:00:00.002-04:002023-03-08T19:47:35.099-05:00Voting third party and government job "creation"<p>This is copy of an email I sent just now.</p>
<blockquote>My concern about the libertarian candidate, besides the fact that he
cannot win,</blockquote>
<p>That's no reason not to vote for him. A well-functioning democracy
requires a choice of more than the people who are "obviously" going to
win. Otherwise, it isn't democracy so much as a decree by the political
parties who will be the next president.</p>
<a name='more'></a>
<blockquote>My is that his economic plans are hopelessly naive. He pretends
that, given Congressional cooperation, one could dramatically cut spending in
2013.</blockquote>
<p>Again, for democracy to work, you need people who are going to
do more than what will easily pass.</p>
<blockquote>My The prospect of a much smaller cut is labeled the fiscal cliff
and would send us into recession.</blockquote>
<p>I'm not so sure it would be quite that bad. It strains credulity for a
trillion-dollar increase in federal spending to be little more than an
academic nuisance, but a symmetric decrease to bring about the
apocalypse.</p>
<blockquote>I might love to see federal spending go down to 15% of GDP, but if
that happened in one day we would have a depression that would make the 1930's
look like the good old days.</blockquote>
<p>It just seems weird that spending can shoot up by an enormous margin in
one year, but for it to drop by the exact same amount would throw the
country into ruin. As a counter-example, I would point to the
demobilization following WWII. Government spending fell through the
floor, yet the economy boomed, even as it had to absorb the mass of
people coming home from the war.</p>
<blockquote>Since Obama will carry MA by a landslide, I want the message of my
protest vote to be unambiguous. Voting for Romney says my concern is economic.
Voting for a fringe candidate could mean anything.</blockquote>
<p>Well, the fringe candidate has a much clearer message: that neither of
the two parties offer particularly attractive directions for the country
and that both parties are to blame for the mess we're in.</p>
<p>Besides, whether you vote Democrat, Republican, Libertarian, Green, Wizard,
or not at all doesn't make a measurable difference in the outcome of the
election, so you might as well vote for your highest preference. See the <a
href="https://en.wikipedia.org/wiki/Paradox_of_voting">paradox of voting</a>.</p>
<p>Since you personally are never going to be the tiebreaker, vote for
the person who most closely matches your preferences. But what if
everyone thought that way? They don't. You are not a collective. And
your choice of candidate does not effect a change in other people's
voting behavior.</p>
<blockquote>As long as the Republicans hold the House we may stave of the
Spanish food riots here. I have great sympathy for them, but they are still
thinking there is the alternative of just spending more of that free
money.</blockquote>
<p>Incidentally, this is one of the reasons I am in favor of a smaller role
for government: there's no one to whom to complain when things don't go
your way. People riot against the government in the hopes that the
bureaucrats will deign to bestow to each according to his need. Against
whom do I riot if the ending of Mass Effect 3 is a major letdown? I can
raise money for charity in protest of the botched opportunity, or send
ending-related colored cupcakes to the developer's offices (both of
which people did), but that's about it. The most impactful thing I can
do is refuse to buy their products in the future, since I possess all of
the power in that relationship. I bear the burdens and benefits of my
actions.</p>
<p>When the target of protest is the government, on the other hand, I can lobby or
attempt to vote myself a job and cash. Politicians can try to sell me a free
lunch, and since my vote is infinitesimal, which way I vote doesn't have any
personal ramifications. It is quite understandable that the Spanish and Greeks
want jobs, but when the government is seen to be the solution to unemployment,
the focus changes from job creation to job bestowment.</p>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-85409204473994309062012-09-20T12:05:00.001-04:002023-03-08T19:47:49.398-05:00Change GTK keybindings from Emacs back to default<p>Like any virtuous person, I use Emacs for everything, and so tried out using
Emacs key bindings for all GTK applications generally. After a year or so of
working like this, I have decided to go back. The main problem is that other
applications can't handle the awesome power of Emacs. Firefox, for example, uses
<kbd>C-k</kbd> to jump to the search box, but if you are in the location bar,
<kbd>C-k</kbd> will run the equivalent of <code>kill-line</code> which means
that in order to get to the search bar, you have to remove focus from the
location bar. Not convenient.</p>
<a name='more'></a>
<p>Since I do all serious typing within Emacs anyway (using the <a
href="https://addons.mozilla.org/en-US/firefox/addon/its-all-text/">It's All
Text!</a> addon to edit <code>textarea</code>s in Emacs), I figured I might as
well take full advantage of the standard key bindings of the lesser
programs.</p>
<p>A lot of the guides online talk about editing <code>.gtkrc-2.0</code> or
setting <code>/desktop/gnome/interface/gtk_key_theme</code> through Gconf, but
this has ceased to work under Gnome/GTK 3. To fix it, you need to set the value
through <code>gsettings</code> (which uses <code>dconf></code>) rather than
<code>gconf</code>:</p>
<pre>
<code>$ gsettings reset org.gnome.desktop.interface gtk-key-theme</code>
</pre>
<p>Why would they break backwards compatibility? Who knows. Also, due to the
brilliance of the Gnome 3 developers, the data for <code>dconf</code> is stored
in some opaque binary blob, rather than the straightforward XML files used by
<code>gconf</code>. This is a huge step <em>backwards</em> from the Unix
philosophy for what appears to be no change in functionality.</p>
<p>It's things like this, along with brain-dead vomit that is Gnome Shell (or
Unity), that have convinced me that all of the Linux desktop developers have
simultaneously taken crazy pills and have gone insane. Why else break perfectly
good code and interfaces in favor of less functional and less useful
crap?</p>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-9720839035146179332012-09-06T18:04:00.001-04:002023-03-08T19:48:24.599-05:00Those Dumb Pipes<p>
This is an older idea which had been floating around in my head, half-finished
for a few years.
</p>
<p>
I was inspired by <a
href="http://arstechnica.com/gadgets/news/2009/02/cellular-providers-want-nokia-to-drop-skype-from-cell-phones.ars">this
Ars Technica article</a> to think about the relationship between network
operators — both cellular and landline — and consumers. The key
quote from the article is by "one mobile operator" and is:
</p>
<a name='more'></a>
<blockquote>
Some people like 3 may be in a position where it could make sense to accept
that. But if you spend upwards of £40m per year building your brand, you don't
want to be just a dumb pipe do you?
</blockquote>
<p>
This is the fundamental tension between consumers and network operators: one
wants internet access to be a commodity, the other doesn't. Why should I care
about their brand? Electricity or water utilities don't have a brand. In most
(all?) cases, they are government-granted monopolies, so there isn't any
choice, but still, the only time I think about a water or electric company is
once a month when the bill comes due. The only thing in the world I want from
those companies is that when I plug in a lamp or turn the faucet, electricity
or water comes out, (hopefully!) respectively. I want the same to be true of
ISPs. It annoys me that the word "Verizon" is printed on back of my phone; we
would think it bizarre if refrigerators had "National Grid" printed on the
doors.
</p>
<p>
Luckily, we have been moving in this direction since the article was written.
The incredible explosion of smartphones has put huge competitive pressure on
text messaging, to the point where basically all plans have unlimited voice
time and text messages, removing that significant avenue of differentiation.
There's less and less room for the networks to do much of anything aside from
providing a pipe to the public internet. Despite the fears of Network
Neutrality advocates (of which I was formerly one) and a lack of legislative
action, no traffic discrimination has taken place. Gradually, the carriers are
being ground down into commodities, forced to compete only on quality,
coverage, and price, and having their profit margins squeezed ever tighter.
</p>
<p>
We live in glorious times.
</p>
Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-1697559430293143672012-08-02T17:50:00.002-04:002023-03-08T19:48:46.188-05:00Correctly Dispatching on Generic Methods in `*apply()` in RI've been hacking in R recently for work, and it is a bizarrely amazing<br />
language. I just ran into a situation in which I needed to apply an S3 generic<br />
function to a list (actually, a row-wise iterator on a <code>data.frame</code>)<br />
and hit an annoying rough patch<br />
<br />
For those not as well-versed in R (I've been learning it for about two weeks at<br />
this point), "method dispatch" is done in a quirky yet effective way. You define<br />
a generic function, say <code>foo</code> like this:<br />
<a name='more'></a>
<br />
<script src="https://gist.github.com/3240247.js?file=DefineGeneric.R"></script><br />
<br />
Which means "when <code>foo()</code> is called, dispatch to the function<br />
matching the class of <code>bar</code>". Setting the class and calling the<br />
generic method is simply:<br />
<br />
<script src="https://gist.github.com/3240247.js?file=SetClassAndCall.R"></script><br />
<br />
Calling <code>foo(bar)</code> causes R to look for a function named<br />
<code>foo.myClass</code> and calls that. If <code>foo.myClass</code> is not<br />
defined, it will try to call <code>foo.otherClass</code>, then<br />
<code>foo.default</code> and if none of those functions exist, it will throw an<br />
error.<br />
<br />
You might have noticed that <code>UseMethod("foo")</code> doesn't pass along the<br />
arguments to <code>foo</code>. R passes the arguments along automagically.<br />
<br />
If you want to apply a function to each element to a list, R makes it easy:<br />
<br />
<script src="https://gist.github.com/3240247.js?file=LapplyExample.R"></script><br />
<br />
<code>identity()</code> and <code>identical()</code> do what you would expect.<br />
There are a bunch of variants of <code>apply</code>; RTFM for the details.<br />
<br />
Now let's say we want to call <code>foo()</code> within <code>lapply()</code><br />
rather than <code>identity</code>. There are some complications:<br />
<br />
<script src="https://gist.github.com/3240247.js?file=LapplyOnFoo.R"></script><br />
<br />
This throws an error because <code>UseMethod()</code> tries to dispatch on the<br />
class of its <em>first</em> argument, which is a string<br />
(<code>"character"</code>, in R parlance). One way to make this work is to<br />
reverse the order of the arguments so the iteration variable comes first and<br />
force <code>UseMethod()</code> to dispatch on a different argument:<br />
<br />
<script src="https://gist.github.com/3240247.js?file=ComplicatedDispatch.R"></script><br />
<br />
Yuck! Wouldn't it be great if there was an easier way? Preferably one which<br />
doesn't involve hacking R's method dispatch system? Well luckily, there is. We<br />
take advantage of the fact that R can use named arguments:<br />
<br />
<script src="https://gist.github.com/3240247.js?file=EasyDispatch.R"></script><br />
<br />
It's a bit wonky when coming from normal languages, which wouldn't appreciate a<br />
named argument being assigned to a variable <em>earlier</em> in its argument<br />
list. Again, R is amazingly bizarre and bizarrely amazing. The explicit naming<br />
of <code>quux</code> causes it to be "used up" from the argument list, so that<br />
any remaining arguments are assigned to the "unclaimed" variables. Taking<br />
advantage of this feature of R lets you apply a generic function to a list (or<br />
other iterable R objects) without having to mess around with its<br />
method-dispatching system.<br />
<br />
Hopefully this spares a fellow hacker the pain of digging through R's<br />
documentation on method dispatch.<br />Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-11398564644867696962012-07-05T15:49:00.002-04:002023-03-08T19:49:07.576-05:00Listing available monospace fonts in EmacsAfter finding out that the <code>Monospace</code> font doesn't support italics, I set about trying to find a suitable replacement. <a href="http://www.emacswiki.org/emacs/GoodFonts">This EmacsWiki page</a> lists a way to print some example text in all of the fonts on the system, which is very helpful for comparing what's available. The problem with it is that it displays all fonts, not just the monospace fonts, which isn't useful. (For those of you not in the know, all programming is done with monospace or uniform-width fonts, meaning that <code>l</code> and <code>m</code> are the same size).<br />
<a name='more'></a>
<br />
I modified the code so that it displays only monospace fonts. There's probably a property on the font family which one could check, but I used a much more primitive method: measure the pixel width of 5 consecutive lowercase <code>L</code> characters and 5 lowercase <code>M</code> characters. If they are the same, then the font is monospaced.<br />
<br />
<script src="https://gist.github.com/3055728.js?file=gistfile1.el"></script><br />
<br />
It isn't perfect (it has a couple of false positives, such as <code>courier 10 pitch</code>), but it's close enough to be a big improvement.<br />Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-14458401738680535102012-06-19T17:09:00.000-04:002012-06-19T17:09:17.223-04:00Use FileMaker Web Publishing in ApacheI've been tasked with nice-ifying the configuration and setup of the systems at work. They store a huge amount (244 GiB) of protein analysis data in a FileMaker database and have PHP scripts accessing the data through the FileMaker XML HTTP API. The problem is that the PHP scripts are running on Apache (as is an SVN repo), but FileMaker wants to publish its API only through IIS. Having spent more than a minute wrestling with configuring IIS, I want it out of my life ASAP. But that can't be done unless scripts have a way of talking XML to FileMaker on port 80. All hope seemed lost.<br />
<a name='more'></a><br />
I thought about reverse proxying requests to FileMaker, since it exposes part of its API on a separate port (16020), but not all of the required functionality can be reverse proxied so easily. I could reverse proxy all of the FileMaker paths on IIS, but that doesn't help get rid of IIS and only makes things more complicated.<br />
<br />
The answer came from <a href="http://www.techno-obscura.com/~delgado/blog/2009/04/proxy-for-filemaker-10-iwp/">this blog post from 2009</a> about this very same issue. I couldn't quite get things to work by following his directions and dug into the FileMaker web server config files.<br />
<br />
The IIS module provided by FileMaker was nothing more than the generic <a href="https://tomcat.apache.org/connectors-doc/webserver_howto/iis.html">IIS-to-Tomcat connector</a>. There isn't anything IIS-specific about Tomcat, and the filter does nothing but point IIS towards a Jakarta config. That being the case, I read the <a href="https://tomcat.apache.org/connectors-doc/reference/apache.html">Apache httpd docs</a> and configured Apache the same way as IIS. Rather than replicating the Jakarta files, as the 2009 blog post did, I simply pointed Apache at them, leaving me with this configuration:<br />
<br />
<script src="https://gist.github.com/2956532.js"> </script><br />
<br />
This was more hours of agony than it had any right to be, so I hope I can spare you, dear reader, some of the pain I felt.<br />Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-53984945953783188432012-06-18T23:32:00.001-04:002012-07-16T11:14:50.009-04:00When European "Austerity" Isn'tI've been skeptical of the rhetoric that there has been "brutal, crushing austerity" in Europe. When these claims are made, I have seldom heard any quantification of how brutal these "brutal" changes have been. So I <a href="http://s.haxney.org/KNUnMw">looked it up</a>.<br />
<br />
Short version: there's been minimal to negative austerity since pre-meltdown 2008.<br />
<br />
Longer version:<br />
<a name='more'></a>There was a bump up in spending in the PIIGS (Portugal, Ireland, Italy, Greece, and Spain) countries now in the news and some of those countries went back to around their 2008 level of spending.<br />
<br />
I went ahead and looked at <a href="https://s.haxney.org/KNUnMw">the Eurostat data</a> on Eurozone government spending, and it certainly does not paint a picture of a draconian, totalitarian decrease in state spending. I compiled the Eurostat data into a <a href="https://docs.google.com/spreadsheet/ccc?key=0Ain9fnIYwc83dGFtTmZNb0FCVU9ldzI2NFcyR2NJa1E">spreadsheet</a> <strike>(with <a href="https://s.haxney.org/LXslj4">US data</a> included for flavor)</strike> and plotted out some charts.<br />
<br />
<strong>Update</strong>: I've removed the US data because they are for the federal government only whereas the EU data is for total spending across all levels of government. If anyone has a pointer to a source for aggregated US local, state, and federal spending, I'd be interested in that as well. The claim that US government spending cratered post-2008 seems too politically convenient to be true.<br />
<br />
First, the total government spending of the European Union, the Eurozone (those countries which use the Euro), <strike>and the US (Dollars converted to Euros)</strike> since 2002:<br />
<br />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/a/haxney.org/spreadsheet/tq?key=0Ain9fnIYwc83dGFtTmZNb0FCVU9ldzI2NFcyR2NJa1E&transpose=1&headers=1&merge=ROWS&range=A1%3AK1%2CA15%3AT15%2CA18%3AT18&gid=18&pub=1","options":{"vAxes":[{"useFormatFromData":false,"title":"Spending (Billion \u20ac)","formatOptions":{"source":"none","scaleFactor":"1000"},"viewWindowMode":"pretty","viewWindow":{}},{"useFormatFromData":true,"viewWindowMode":"pretty","viewWindow":{}}],"series":{"2":{"color":"#0000ff","pointSize":5},"1":{"pointSize":5},"0":{"color":"#ff9900","pointSize":5}},"curveType":"","booleanRole":"certainty","title":"Region Economies","animation":{"duration":0},"lineWidth":2,"useFirstColumnAsDomain":true,"hAxis":{"useFormatFromData":true,"title":"Year","gridlines":{"count":"10"}},"width":"100%","height":"100%"},"state":{},"chartType":"LineChart","chartName":"Chart 3"} </script><br />
<br />
Next, the GPI (Greece, Portugal, Ireland) countries:<br />
<br />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/a/haxney.org/spreadsheet/tq?key=0Ain9fnIYwc83dGFtTmZNb0FCVU9ldzI2NFcyR2NJa1E&transpose=1&headers=1&merge=ROWS&range=A1%3AK1%2CA22%3AT22%2CA34%3AT34%2CA25%3AT25&gid=18&pub=1","options":{"vAxes":[{"useFormatFromData":false,"title":"Spending (Billion EUR)","formatOptions":{"source":"none","scaleFactor":"1000"},"viewWindowMode":"pretty","viewWindow":{}},{"useFormatFromData":true,"viewWindowMode":"pretty","viewWindow":{}}],"series":{"0":{"pointSize":5},"1":{"pointSize":5},"2":{"pointSize":5}},"curveType":"","booleanRole":"certainty","title":"Greece, Portugal, and Ireland","height":"100%","animation":{"duration":500},"width":"100%","lineWidth":2,"useFirstColumnAsDomain":true,"annotations":{"domain":{}},"hAxis":{"useFormatFromData":true,"title":"Year","gridlines":{"count":"10"}}},"state":{},"chartType":"LineChart","chartName":"Chart 3"} </script><br />
<br />
And finally, the biggest spenders in Europe. I included them separately from the GPI (or PIG) countries because the chart ends up mostly empty with all included.<br />
<br />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/a/haxney.org/spreadsheet/tq?key=0Ain9fnIYwc83dGFtTmZNb0FCVU9ldzI2NFcyR2NJa1E&transpose=1&headers=1&merge=ROWS&range=A1%3AK1%2CA20%3AT21%2CA26%3AT26%2CA38%3AT38%2CA41%3AT41&gid=18&pub=1","options":{"vAxes":[{"title":"Spending (Billion \u20ac)","useFormatFromData":false,"formatOptions":{"source":"none","scaleFactor":"1000"},"viewWindowMode":"pretty","viewWindow":{}},{"useFormatFromData":true,"title":"Spending (Billion \u20ac/$)","formatOptions":{"scaleFactor":"1000"},"viewWindowMode":"pretty","viewWindow":{}}],"series":{"0":{"pointSize":5},"1":{"pointSize":5},"2":{"pointSize":5},"3":{"pointSize":5},"4":{"pointSize":5}},"booleanRole":"certainty","curveType":"","title":"Large Economies","animation":{"duration":500},"legend":"right","lineWidth":2,"useFirstColumnAsDomain":true,"annotations":{"domain":{}},"hAxis":{"title":"Year","useFormatFromData":true,"formatOptions":{"source":"data"},"gridlines":{"count":"10"}},"width":"100%","height":"100%"},"state":{},"chartType":"LineChart","chartName":"Chart 3"} </script><br />
<br />
As you can see, not nearly the inhumane government takeover of governmental reduction that it's sometimes claimed to be.<br />
<br />
As a final piece of analysis, I looked at 2011 spending as a percentage of 2008 (as in pre-meltdown) spending. Only 10 out of the 41 countries (Switzerland didn't have 2011 numbers) had decreased spending since 2008: Iceland, Latvia, Greece, Romania, Hungary, Estonia, Lithuania, UK, Ireland, and Bulgaria. With the exceptions of Iceland and Latvia, all of the countries spent at least 90% as much in 2011 as they did in 2008. Take a look:<br />
<br />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js"> {"dataSourceUrl":"//docs.google.com/a/haxney.org/spreadsheet/tq?key=0Ain9fnIYwc83dGFtTmZNb0FCVU9ldzI2NFcyR2NJa1E&transpose=0&headers=1&merge=COLS&range=A1%3AB66%2CC1%3AC41&gid=17&pub=1","options":{"vAxes":[{"useFormatFromData":true,"title":"","viewWindowMode":"pretty","viewWindow":{},"gridlines":{"count":"5"}},{"useFormatFromData":true,"viewWindowMode":"pretty","viewWindow":{}}],"booleanRole":"certainty","title":"2011 Spending as a percentage of 2007/2008","animation":{"duration":0},"domainAxis":{"direction":1},"legend":"top","hAxis":{"useFormatFromData":true,"title":"","viewWindowMode":"pretty","viewWindow":{}},"isStacked":false,"width":"100%","height":"100%"},"state":{},"chartType":"ColumnChart","chartName":"Chart 4"} </script><br />
<br />
<strong>Update:</strong> It was suggested that I compare 2011 spending to that of 2007 as well, since some countries peaked around then. It actually ends up being more of an argument against the existence of "austerity," with only three countries decreasing their spending over the period: Iceland, the UK, and Hungary.<br />
<br />
<strike>By the way, the US -- the pinnacle of ruthless Reganomics -- spent 120% of its 2008 level in 2011, third only to Luxembourg and Norway in governmental largess.</strike><br />
<br />
All of my raw data are available <a href="https://docs.google.com/spreadsheet/ccc?key=0Ain9fnIYwc83dGFtTmZNb0FCVU9ldzI2NFcyR2NJa1E">here</a>.Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com2tag:blogger.com,1999:blog-7770370347473031286.post-63555102992138947042012-06-08T11:33:00.002-04:002023-03-08T19:49:33.360-05:00Solving mod_dav_svn loading faliure on Apache in WindowsYesterday, I spent <i>way</i> too much time trying to get Subversion working under Apache in Windows 7. I really have a new appreciation for GNU/Linux package managers; what would have been <code>sudo aptitude install libapache2-svn</code> under Ubuntu turned into hours of staring at <code>Syntax error on line 270 of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/httpd.conf: Cannot load C:/Program Files (x86)/Apache Software Foundation/Apache2.2/modules/mod_dav_svn.so into server: The specified procedure could not be found.</code><br />
<a name='more'></a>
<br />
I tried copying all of the SVN libraries into <code>bin</code> within the server root, downloading different versions from the web, and "unblocking" the libraries (Windows blocks code downloaded from the internet. Nice idea; I only wish it would tell you about it). Finally, after <b>hours</b> of Googling, I found some post on some forum somewhere that mentioned using the <code>libapr-1.dll</code> from the Subversion distribution rather than Apache's would help. It did.<br />
<br />
This would seem to undermine somewhat the idea of the "Apache <i>Portable</i> Runtime". But whatever; I have a working system. Now onto trying to get LDAP set up for SVN and Ubuntu. Wish me luck!<br />
<br />
TL;DR: If Apache in Windows fails to start with <code>mod_dav_svn.so</code> loaded in your <code>conf/httpd.conf</code> and you get this error in your Event Viewer: <code>Syntax error on line 270 of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/httpd.conf: Cannot load C:/Program Files (x86)/Apache Software Foundation/Apache2.2/modules/mod_dav_svn.so into server: The specified procedure could not be found.</code>, you can solve it by copying <code>libapr-1.dll</code> from <code>Subversion/bin</code> to <code>Apache2.2/bin</code>, replacing the version which ships with Apache.Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com6tag:blogger.com,1999:blog-7770370347473031286.post-42661619431571268962012-06-05T01:08:00.001-04:002023-03-08T19:49:45.897-05:00Metaphor for Europe's Troubles<p>Based on my decades of experience in the sovereign debt markets, I have
come up with a perfect metaphor for what is going on in the Eurozone. It
is as if the Grace government promised 200,000 people one boat each, but
now that the boats are due, it turns out that she doesn't have 200,000
boats anywhere, there are only 100,000. Grace tries telling half of the
people not to try to use their boat; to pretend that it is sitting in a
port somewhere, waiting for them. If some people use their boat half of
the week, other people can use it for the other half of the week, so it
is "like" having 200,000 boats. Uncle Jeremy has 1.5 million boats, but
he isn't so thrilled about just handing over a bunch of his boats to
Grace, who knew she promised more than she had. Jeremy says "I'll give
you 50,000 of my boats, but only if you tell 50,000 people that they
aren't getting a boat at all." Grace is furious, shouting "you're
forcing boat austerity on me! I need to implement boat-growth policies!"
Of course, "boat-growth policies" is a euphemism for "Jeremy gives me
more boats."</p>
<a name='more'></a>
<p>Grace then proposes a consolidated "Euroboat" concept, in which all of
Grace's, Jeremy's, Ira's, Talia's, and Pete's boats are lumped together
and then given out to each of their citizens, regardless of how many
boats each person (government) has. It just so happens that Jeremy has
1.5 million boats and has promised 750k of his citizens one boat each,
but all of the other governments have promised more boats than they
have, and have even promised more than the 750k spare boats that Jeremy
has. Jeremy, understandably, doesn't want to give out all of the spare
boats he has to people who promised more than they had, but when he
tells the other people this, they get angry and call him mean names.
Jeremy tries to explain that even if he was to give out all of the extra
boats he has, and cut back on a bunch of the boats he already promised
to his citizens, there would still not be enough boats for all the
people who promised more boats than they knew they had.</p>
<p>Some people want their acquaintance Mario to print them a bunch of
boats.</p>Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-61528141127772404822012-06-01T16:00:00.000-04:002012-06-19T16:39:34.656-04:00EA support is wonderfulI contacted EA support today to get my reward for participating in last weekend's Mass Effect 3 Bounty Weekend: <a href="http://blog.bioware.com/2012/05/23/operation-shieldwall/">Operation Shieldwall</a>. I achieved the individual goal, but didn't get the priiiize, so I went to EA for help. Maybe 10 minutes later, it was done. Thank you to "Larry S" for helping me. Here is the log of my chat with him; I want to give credit where credit is due for his professionalism and speed.<br />
<br />
<a name='more'></a><br />
You are now ready to chat with Larry S. <br />
<div class="chat-row convo">
<b class="chat-by">Larry S: </b>Thanks for contacting EA Help! My name is Larry S how may I help you?</div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>I participated in the previous weekend challenge but haven't gotten my commendation pack</div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>I'm pretty sure I promoted more than 3 classes within the time window</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">No problem. I will be glad to provide you the pack.</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>I certainly promoted more than 3 within the weekend, but I'm not sure it was exactly in the window</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">May I know the name of the weekend challenge?</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>I only started promoting after the operation description popped up</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">May I know the name of the weekend challenge?</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>Shieldwall, I believe</div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>let me double check</div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>yup, shieldwall</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Okay. I can provide it. May I have the Origin email id in which you have registered the game?</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>the email I used is dan@haxney.org</div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>my origin ID is "haxney"</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Thank you.</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>Just about everything else related to me is "haxney" :)</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">May I know your first name and last name?</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>Daniel Hackney</div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>the "haxney" is a play off my last name. I'm a hacker (original meaning of the word: computer programmer)</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Would you mind holding for some time while I provide the pack in your account Daniel?</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>sure thing. Thank you very much</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">My pleasure.</span></div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Please check now in the game.</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>sure, give me a second for it to launch</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">No problem.</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>It's there! That was very quick</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Great.</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>Thank you, you have been very helpful</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">My pleasure.</span></div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b>Thank you for contacting EA. Is there anything else I can help you with today?</div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>That's it for today. I shall sing praises of your responsiveness and professionalism to the blogosphere</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Thank you Daniel.</span></div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b>If you need help with anything else, please feel free to contact us anytime!</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Have a nice day.</span></div>
<div class="chat-row convo">
<b class="chat-by self">you: </b>Have a great day!</div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Take care.</span></div>
<div class="chat-row convo">
<b class="chat-by">Larry S: </b><span dir="ltr">Bye.</span></div>
<div class="chat-row info">
<b class="disabled margin"></b>The chat session has ended. Please contact us again if you need further help.</div>
<br />
<br />Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0tag:blogger.com,1999:blog-7770370347473031286.post-86433764124887170612012-04-22T19:09:00.001-04:002023-03-08T19:50:07.654-05:00Simple recursive file traversal in Elisp<p>
Really quick: I wrote a simple bit of elisp to <code>eval</code> a body over
each of the files in a directory, recursively. Looking around for a little
bit, I found a couple of options, including <a
href="http://www.emacswiki.org/emacs/FindrPackage">Findr</a>, which has its
own queue implementation (pretty short), and whose main function is a whopping
55 lines!
</p>
<a name='more'></a>
<p>
<emph>There has to be a quicker way</emph>, I thought. I didn't need anything
terribly fancy, I just wanted something that worked cross-platform (which
ruled out <code>find</code>) and was simple. I ended up with this little guy:
</p>
<script src="https://gist.github.com/2467266.js?file=simple-recursive.el"></script>
<p>
11 lines for the main function, <code>recursive-files</code> itself, and
another 3 (including docstring) for simplifying macro. It's main weakness at
this point is that it incorrectly ignores any files with leading dots. So not
only does it (wisely) avoid <code>.</code> and <code>..</code>, it rather
foolishly avoids <code>.foo</code> as well. I couldn't easily figure out how
to exclude <code>.</code> and <code>..</code> in a single regex easily without
also excluding leading-dot files. For what I'm doing, it's not important.
</p>
<p>
Also, note that this barfs on symlinks. It thinks they're directories and
tries to call <code>directory-files-and-attributes</code> on them. Again, a
more careful implementation would deal with this.
</p>
<p>
I was surprised that Emacs didn't have a "recursively visit files" function or
macro built in, but this gets me close enough. Enjoy!
</p>Dan Hackneyhttp://www.blogger.com/profile/10358325177901149625noreply@blogger.com0