“In many ways, history should be regarded as a globalizing mass medium in the nineteenth century.”
Distribution of Academic Literature
Here’s how I get my academic literature these days:
- Let a teacher e-mail me a Microsoft Word file with references.
- Print the file
- Go to the library, look up the titles and wait an hour before fellow students return them.
- Copy the required pages on dead tree (single-sided).
- Go home and scan in the dead tree.
- Archive the digital article on my computer, ready to read from screen.
- Throw away the copied articles.
Now, I know insisting on reading articles from screen rather than from paper is considered overly geeky, but the solutions for tagging, zooming, searching, portability and annotations make this a no-brainer for me. Regardless, it seems to me this whole process could be a lot simpler, cheaper, quicker, less frustrating and above all consume a lot less paper.
Here’s what I propose:
- Teacher copies links to works to a course website, rather than manually adding them to a Word file.
- Through the University’s volume discount program students purchase the articles in PDF for a small fee from the publisher.
- Those that want to read stuff from paper print it themselves, saving the rest of us a lot of time and money.
It doesn’t sound ridiculous to me.
Snow Leopard Web Development Configuration
After installing Snow Leopard on my iMac I found I had to tweak some settings before I could continue my daily web development workflow. First, you should note Snow Leopard now comes with PHP 5.3 and it will overwrite your custom Apache configuration.
Here’s what I did to get up and running:
- Moved
/etc/php.ini.default to /etc/php.ini.
- Edited
php.ini (using search/replace) so that display_errors = On and mysql.default_port = /tmp/mysql.sock.
- I also set a default timezone (search
php.ini for ‘timezone’) to suppress warnings about server timezone being unreliable.
- Restored my
vhosts.conf file from a back-up to bring back my various *.dev virtual hosts.
- I replaced all my PHP short tags with their longer equivalents (
<?= to <?php echo) as these are deprecated in PHP 5.3.
After these rather simple steps I was back up and running, although they took a a little time and googling. Overall, I was surprised how little installing Snow Leopard messed up my system.
Internet Explorer, Javascript and base elements
Internet Explorer treats the base element a bit diffently from other browser. I ran into the issue when trying to change the current page’s hash through javascript:
window.location.hash = 'some_value';
Internet explorer took the entire base URL and prepended it to the hash, resulting in an URL like http://domain.tld/http://domain.tld/#some_value. That’s clearly not my intention.
The trick lies in the href attribute for links. This actually points to the faulty long url, while its actual attribute value is only the hash:
<a id="link" href="#some_value">...</a>
// IE: http://domain.tld/#some_value
// other browser: #some_value
$('#link').attr('href');
The trick is to replace anything before the pound when reading the href value, like so:
$('#link').attr('href').replace(/^.*(?=#)/, '');
And when trying to find links pointing at #some_value to not be too restrictive with your selector:
// finds 1 in other browsers, nothing in IE
$('a[href="#some_value"]')
// works like expected in all browsers; Note the *
$('a[href*="#some_value"]')
Tricky stuff!
Removing deleted files from the Git index
When working with Git it can be cumbersome to have to remove files from the index (marking them deleted rahter missing) if you did not delete them using git-rm. Here’s bash one-liner for that:
git rm $(git ls-files -d)
I’ve got that aliased to grd (Git Remove Deleted).
Argument-specific memoization
There is another way of memoizing expensive operations in JavaScript, which is also fit for argument-specific results:
base._fooCache = {};
base.foo = function(arg) {
if(base._fooCache[arg] === undefined) {
base. _fooCache[arg] = ...expensive operation...
}
return base. _fooCache[arg];
};
This just keeps a local key/value cache of the result of the expensive operation for the given argument. This only works for a single argument right now, but I guess it could be extended to multiple arguments.
Awesome JavaScript memoization
Here’s an easy way to memoize expensive Javascript functions. It introduces slightly obscure code and an extra function call, but if your operation is expensive enough to memoize, it is probably worth the extra overhead:
this.foo = function(){
var foo = expensive_operation();
return (this.foo = function() { return foo; })();
};
What this function does is redefine itself, so on subsequent calls it only returns a static value. Neat.
Science & Religion
Science and religion are not as incompatible as many seem to believe. The scientific method implies the use of logic and reason towards falsifiable theories. When you weigh pros an cons, and take into account all available evidence, there is nothing wrong with believing in a supreme being. I personally don’t believe that, bu to each his own.
I do have a problem with people who reject science as if it were anti-religious. Such people choose to only hear the story they like best, not which one they think describes reality best.
E-mail can be hard to find, no?
For my formal request for a bachelor’s in History I needed to hand in my thesis via e-mail. I asked to make sure if I needed to include anything special with that, such as a subject line prefix, so they would be able to find it later on. The friendly lady on the phone told me that was unnecessary.
Two days later when I came into their office to hand over all other paperwork I had to wait fifteen minutes before they had found my thesis from their grand central inbox. “We get a lot of e-mail every day, you know. It’s can be hard to keep track of it all.” No shit.
PDFs professional?
It is telling of Windows, Office and Adobe that using PDFs is considered ‘highly professional’ in the Windows-world, out of reach of the average Joe computer user.
Creating and using PDFs can and should be easy, and need not require a $799 license for bloated Adobe products. It is, in essence, just a file format.