Say what, Perl?

Unlike in other languages, Perl's default print function doesn't print newlines by default. This is often desirable, such as in this case:

#!/usr/bin/env perl

use strict;
use warnings;

print("Please enter your name: ");
my $name = <STDIN>;

The resulting prompt will have the user type their name on the same line.

Please enter your name: Tousaka Rin

In situations where you want a newline, you use the standard \n:

print("Zettai Ryouiki FTW\n");
print("Tousakaaaaaa!\n");

This was the subject of ridicule from my Ruby development friends in the past, so in 2010 I presented a function that did the same thing. Recent Perl versions have an even shorter function name, with the say command. The following will print the same as the above:

say("Zettai Ryouiki FTW");
say("Tousakaaaaaaa!")

You can use this in your scripts today by requiring at least Perl 5.10, or explicitly enabling the feature:

use 5.010;
use feature qw(say);

Done, and done.


That's a lot of Windows domains

For a Mac/*nix gentleman, I've been doing an awful lot of Windows stuff of late. Today was discovering why certain services don't operate with external firewalls and proxy servers.

According to this Technet article, the following domains are required for successful Windows Updates:

  • http://windowsupdate.microsoft.com
  • http://*.windowsupdate.microsoft.com
  • https://*.windowsupdate.microsoft.com
  • http://*.update.microsoft.com
  • https://*.update.microsoft.com
  • http://*.windowsupdate.com
  • http://download.windowsupdate.com
  • http://download.microsoft.com
  • http://*.download.windowsupdate.com
  • http://wustat.windows.com
  • http://ntservicepack.microsoft.com

And according to this knowledgebase article, these URLs are required to be bypassed if you're running a proxy server, otherwise Windows Activation will fail:

  • http://go.microsoft.com/
  • https://sls.microsoft.com/
  • https://sls.microsoft.com:443
  • http://crl.microsoft.com/pki/crl/products/MicrosoftRootAuthority.crl
  • http://crl.microsoft.com/pki/crl/products/MicrosoftProductSecureCommunications.crl
  • http://www.microsoft.com/pki/crl/products/MicrosoftProductSecureCommunications.crl
  • http://crl.microsoft.com/pki/crl/products/MicrosoftProductSecureServer.crl
  • http://www.microsoft.com/pki/crl/products/MicrosoftProductSecureServer.crl
  • https://activation.sls.microsoft.com

And finally, these URLs are required for your daily dose of nostalgially bad web design:

  • http://rubenerd.com/

It reminds me of all the domains I had to whitelist in NoScript to access my student email in Outlook Web Access. As much as I dislike and not trust Google thesedays, I only needed one domain for Gmail to work back then.

And as an aside, this is the second post in 2015 to start with "That's a lot of...". Make of that what you will. I wouldn't recommend overthinking it, or anything for that matter. I wonder if I can make ten? Sounds like a challenge :3.


Rubénerd Show 279 2015-06-30

Rubénerd Show 279

The four cities of Sydney episode.

Podcast: Play in new window | Download

53:45 – Topics include Fireside Brew tea by Cauldron Brews, not feeling quite with it, comma seperated values, The Geographic Names Board of New South Wales, Melbourne, Albion, Parramatta, Winterfest 2015, Scottish and German ancestry, ergonomic keyboards, outdated Wikipedia rips, cost of living in Sydney and NYC, virtual offices and real spammers, an ideal trip to North America, Israel Brown, and finding Woodland Hills.

Recorded in Sydney, Australia. Licence for this track: Creative Commons Attribution-ShareAlike 3.0. Attribution: Ruben Schade. Music by CyberSDF.

Released July 2015 on The Overnightscape Underground, an Internet talk radio channel focusing on a freeform monologue style, with diverse and fascinating hosts.

Subscribe with iTunes, Pocket Casts, Overcast or add this feed to your podcast client. For all Overnightscape Underground shows, subscribe in iTunes, Pocket Casts or add this feed to your podcast client. More clients are available on the subscribe page.


A computer on every desk and in every home

Ars Technica has an article about Microsoft's revised mission statement. Its marketing buzzwords and uninspiring verbosity lead the article's author to opine:

Both are a far cry from the Bill Gates era. "A computer on every desk and in every home" was clearer in intent and actually measurable; it was a mission statement that allowed Microsoft to more or less say "Mission accomplished."

I'm not even frustrated by this any more, I'm just curious why nobody ever quotes the second part of that statement:

[..] running Microsoft software.

It's like the journalists of the world have collective amnesia. I'd argue it significantly changes the tone of any article that quotes it.


A BitBucket easter egg

I just commited a change to a BitBucket repo, and got this:

Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 499 bytes | 0 bytes/s, done.
Total 6 (delta 4), reused 0 (delta 0)
remote:
remote: ++++                               ++++
remote:   +++++++                     +++++++
remote:      +++++++++++++++++++++++++++++
remote:          +++++++++++++++++++++
remote:                 +++++++
remote:       +++                     +++
remote:       ++++++     +++++     ++++++
remote:        ++++++    +++++    ++++++
remote:        +++++++    +++    +++++++
remote:         ++++++++   +   ++++++++
remote:          ++++++++     ++++++++
remote:            ++++++++ +++++++++
remote:             +++++++++++++++
remote:              +++++++++++++
remote:                +++++++++
remote:                  +++++++
remote:               +   +++++++
remote:              +++   +++++++
remote:             ++++++  +++++++
remote:            +++++++   +++++++
remote:           +++++++     +++++++
remote:          +++++++       +++++++
remote:          +++++++       +++++++
remote:          +++++++       +++++++
To git@bitbucket.org:[REPO]
   6fa0c16..a148044  master -> master

We've still got a long way to go, but steps in the right direction :).


Rubénerd Show 278 2015-06-28

Rubénerd Show 278

The Onsug scary house Jerry Novak episode.

Podcast: Play in new window | Download

01:20:17 – Topics include Star Trek Voyager and TNG, The Million Dollar Homepage, releasing my first episode on The Overnightscape Underground podcast network, Plateau Zilch, syncronicities, Gaul, evolving from your teenage years, a trip back to my old house (mustiness, terrifying electrical faults, rye bread, voiceover work for Discovery Channel, classic photo–books, DOS machines), musical gifts from The Official Rubénerd Patron Jerry Novak, vinyl records, and 80s electronic instruments in their own right.

Recorded in Sydney, Australia. Licence for this track: Creative Commons Attribution-ShareAlike 3.0. Attribution: Ruben Schade. Music by Who Ha.

Released June 2015 on The Overnightscape Underground, an Internet talk radio channel focusing on a freeform monologue style, with diverse and fascinating hosts.

Subscribe with iTunes, Pocket Casts, Overcast or add this feed to your podcast client. For all Overnightscape Underground shows, subscribe in iTunes, Pocket Casts or add this feed to your podcast client. More clients are available on the subscribe page.


PowerShell for the Bourne guy

As I'm sure was the case for many of you, the first scripts I wrote growing up were DOS batch files (with some nice PIFs to create icons in Program Manager, oh god I'm almost 30 and feeling every year already). Then I was introduced to the world of Linux, BSD and Mac OS X, and I left the Windows scripting world behind.

Suffice to say, a lot has changed since. I read a rumour somewhere that an internal team were so frustrated with CMD.EXE and Microsoft's insistence that it couldn't be changed, that they came up with an entirely separate interpreter. That turned into Windows PowerShell, a .NET framework interface you can script with some eerily familar UNIX shortcuts.

To help a friend out, I wrote my first PowerShell script today. The plan was to download a text file containing a URL on each line, then downloading each one individually.

In Bourne shell style on BSD or OS X, I'd fire off something like this:

#!/bin/sh 

set -e

_list = "http://SOMEWHERE/urls.txt"
_urls = `curl -OL "${_list}"`

for (_url in ${_urls}); do
    echo "Downloading ${_url} ..."
    curl -OL "${_url} 
    sleep 10
done;

PowerShell scripts use .NET framework classes to achieve similar things. If you've done any C#, these should be pretty familiar.

First, the equivilent to Bourne shell's set -e which will stop execution when an operation returns a fail. Note that this often won't work if you're relying on external DOS or Windows tools, as their return values are... inconsistent at best.

$ErrorActionPreference = "STOP"

To download our text file with URLs, we create a new web client, and use the DownloadFile() method. This silently fails when given a relative path (henefenegeneschmenem), so we have to find the current working directory and append the destination filename.

$List = "https://SOMEWHERE/urls.txt"
$URLs = [System.IO.Path]::Combine($pwd.Path, "urls.txt")

$Client = New-Object System.Net.Webclient
$Client.DownloadFile($List, $URLs)

Now we can download each line. Get-Content returns each line.

foreach ($URL in Get-Content $URLs) {
    $Filename = [System.IO.Path]::GetFileName($URL)
    $File = [System.IO.Path]::Combine($pwd.Path, $Filename)
    $Client.DownloadFile($URL, $File)

    $Start-Sleep -s 10
}

Learning new programming languages and tools massages my brain like a good brain massage. I'm by no means a PowerShell expert, and I'd still far prefer writing *nix scripts, but this was a really fun exercise.


Not Atom, Atom

This was the headline that ran on Hacker News, that bastion of online integrity:

Atom 1.0

Hold on, I thought, Atom 1.0 was released a decade ago. Atom is a syndication format designed to reign in the numerous incompatible versions of RSS, though they had enough of a sense of humour to release multiple versions themselves (WordPress exported Atom 0.3 and 1.0 feeds at the time).

Yes, this is for the Atom text editor, based on "web technologies" (oh dear).

I know familiary breeds contempt, but I'm really starting to get over this high–churn ecosystem. I'll be sticking with Vim, not just because its what I'm used to, but in protest to this flash–in–the–pan, short–attention–span, name–reusing, JavaScript–everywhere nonsense. Hey, at least their site doesn't have auto playing video or those awful long scrolling pages.

Whoa, I don't think I've ever sounded this old before. I may still be in my twenties for now, but get off my lawn!


OS X El Capitan

Below are my four initial impressions of Apple's latest desktop OS, displayed as bullet points for your convenience. I even threw in an extra one (like the black keys) for free.

  • My slightly-OCD side appreciates the tightning up of the system, rather than emphasis on new features. I wish they did this every time, ala Intel's tick-tock.

  • San Francisco as the system font is... regrettable. I'm not a typography professional, but I like to dabble. It looks childish and unrefined, and is what bugs me about the Apple Watch. At system UI font sizes, Lucida Grande was still the most legible.

  • DiscoveryD appears to be gone for good. Introduced with Yosemite, it's been responsible for the flakiest networking and sharing performance of any OS X release I've ever used since the 10.0 betas. I've got so many duplicate (3) printers it's ridiculous.

  • I no longer use nano, but it's my test to see how often they update their UNIX userland. Yosemite still shipped with 2.0.9, released in 2009. Let's see if El Capitan comes with 2.4.1.

  • Apple continues to troll pedants with their names. 10.9 Maverics got "awkward pluralisation", 10.10 Yosemite was mispronounced by everyone who'd never grown up watching Warner Brothers cartoons (really?). I'm already looking forward to seeing what they name their next one ;)


Rubénerd Show 277 2015-06-21

Rubenerd Show 277

The Northern Irish Clara episode.

Podcast: Play in new window | Download

56:31 – Topics include Mascot, electric stoves suck, Australian housing affordability, the great power rort, how the weather is too damn cold, small talk, elevators versus lifts, Data from TNG, the pronounciation of names, British convicts shipped off to the US and Australia, stupid whites treating native peoples, gender terminology, audio equipments for podcasters, Windows NT 3.51 and kernel panics, WiFi latency, perfect Singapore weather, switching between units of measurement, paying for food (Chinese food, murtabak), Northern Ireland (banknote adventures, The Giants Causeway), broasted birds, Merlin Mann and Dan Benjamin, ingrained etymological mistakes, cosplaying as Guilty Crown characters, hexagons, The Royal Australian Mint, speaking Chinese and European, Bo (Diddly, Jangles, Dudley), Johnson and the 1990s ABC beating Toy Story by 5 years, and Fatboy Slim's Weapon of Choice. Special guest appearance by Clara Tse.

Recorded in Sydney, Australia. Licence for this track: Creative Commons Attribution-ShareAlike 3.0. Attribution: Ruben Schade. Music by Chris Juergensen.

Subscribe with iTunes, Pocket Casts, Overcast or add this feed to your podcast client. More clients available on the subscribe page.