Who’s DNS is it anyway?

So I was asked to diagnose some DNS issues a client was having recently. Not my bag, but thought I’d have a go anyway…. Two useful commands (on OSX) I found:

scutil --dns

gives you all the info about what DNS your local machine knows about. Look at anything that says “nameserver”. This is especially useful if everything’s been assigned via DHCP – the info wouldn’t appear in your GUI network preferences…. Then:

dig whatever-domain.com @10.10.10.10

queries the nameserver at the IP after the @ for it’s records on that specific domain name. Sure I knew that last bit before, but I’ll probably forget it again, so let’s write it down eh! 🙂


Enable Root Login on Ubuntu Server

If you’re using Ubuntu as a web server, as the main admin there’s not much reason not to enable root login via SSH. Digital Ocean do it on their VMs by default for instance. So:

[bash]
sudo passwd root # Set a new password
sudo nano /etc/ssh/sshd_config
[/bash]

Comment out `PermitRootLogin without-password` and add `PermitRootLogin yes`. Save it and reload the ssh config:

[bash]
sudo service ssh reload
[/bash]

Job done! No more using sudo all the time to change your Nginx config!


Review: Logitech MX Master

Wow, this a really nice mouse!

I’ve been through a fair few different mice over the years and, suffering from pretty bad RSI on & off, I always try to get a nice one! I was an Intellimouse Explorer guy for ages – it won a Red Dot design award too, from what I remember. It was pretty comfy and used by a lot of pro gamers back in the day I think.

After that I went over to the Apple Magic Mouse for a while, but to be honest the whole touch-scroll thing it did was pretty annoying in a lot of contexts. Plenty of apps didn’t like it – sent Google Maps completely mental zooming in and out constantly for a start. Even more importantly though, it was so low profile that it didn’t support my hand enough and made my RSI quite a bit worse… Back to the Intellimouse.

Then recently my third one of them finally died and I thought I’d try something new. I thought about the Razer Mamba, which got great reviews, but it was about £150 which is absurd for a mouse. ….so I went for the Logitech MX Master and I’m pretty pleased! Wireless, great hand support, nice click weight, recharges via USB and lots of other nice things but I’m bored of writing this already and why am I even putting hardware reviews on this blog jesus christ this is a boring article right I’m off to do something useful with my life…


Time Machine vs Carbon Copy Cloner

So I recently decided to switch from Time Machine, OS X’s built in backup solution, to CCC. 

Time Machine often had trouble finding my network volume I was using for backup, due to a lack of advanced config options, and I never liked the way it wouldn’t tell you “exactly what it was doing”. I’ve successfully restored massive TM backups before, but the weird Dr. Who style interface always scared the shit out of me quite frankly. I want my backup software to look rock solid, not like it’s done acid!

Enter Carbon Copy Cloner. First thing I didn’t know: it uses Sparse Bundle backups just like Time Machine! These are disk images broken up into lots of small files, which is great for handling diffs and stuff if you want to do incremental backups (which CCC can do too) and send them off site. My NAS backs up to Amazon Glacier, so obviously if each backup changes a single 500GB file, this would be bad… 

 Big difference with CCC though: I can directly mount the resulting image! So while TM would churn through my backup just fine, I never had a decent way to verify what it had done. Just its weird Dr. Who interface… CCC lets me see the full contents of the backup directly. Another advantage: I can actually specify a username and password for the network share I want to backup to. Something TM always struggled with.

So yeah, quite happy with that! CCC: Like Time Machine but with less acid and more control. 😉


Datamoshing?

So I’ve seen a few of these things going around recently. Wait for the first cut in the above f*** awful pop song!

Basically: take a few keyframes out of a video stream and let the codec go nuts, overlaying the motion data on the wrong things. Or to be precise, discard some I-frames and keep the P-frames & B-frames. P & B frames store only the differences between their neighbouring frames, while I-frames are “whole pictures”. Delete some of those and you get that whole “pour paint over everything”, “I’ve done a digital sick”, “Im in a really budget version of the matrix” look.

Anyway, it appears this technique now has a name – DataMoshing? There’s even a whole site dedicated to it here. I remember opening JPEGs in text editors to do this kind of thing when I was but a wee slip of a lad, but I thought it was just called Being Fucking Bored 😉 Good to know how far it’s come. Right, I’m off to get AviDemux and have a play!


Libscore

Ha! This is an interesting site I didn’t know about before. Libscore.com collects usage stats on Javascript libraries from the top 1 million websites and ranks them.

Wondering what the chances are of that library you’re thinking about using being a piece of shit? Don’t want to spend a few days figuring that out for yourself? Want to have a more educated guess on the subject? Libscore!

….admittedly though, there are some god-awful and very outdated libraries still in use everywhere 😉


Local Theme Development on WordPress MultiSite

So this blog runs as part of my WP Multi Site network. Multi-site is great – one click to upgrade the WP core for all sites, one setup for caching etc.

One problem is local dev though. You don’t want to pull the whole network down to your local machine to work on a theme (it’d take ages) but you still want to develop against the posts and pages that are on the live site.

Interesting solution to this:

WP Multi-site stores DB tables with different prefixes for each site. So for instance you’d have wp_2_postswp_2_options etc. for site No. 2.

Let’s try altering a few bits in wp-config.php to make use of this:

define('WP_HOME', 'http://localsite.loc');
define('WP_SITEURL', 'http://localsite.loc');
define('DB_NAME', 'your_multisite_db');
define('DB_USER', 'your_multisite_user');
define('DB_PASSWORD', 'yourpw');
define('DB_HOST', '127.0.0.1:3307');
$table_prefix = 'wp_2_';

Finally create an SSH tunnel so you can access the DB running on your server on local port 3307 (Your local MySQL will be running on 3306). …..presuming you need to do this of course (article all about this here):

ssh -L 127.0.0.1:3307:127.0.0.1:3306 user@yourserver -N

That done, you should be good to go! One important caveat with this method: wp_users and wp_usermeta tables are global to all sites in the Multisite network (along with a few others). Therefore you won’t be able to login on your local copy and anything involving users on the front end will be screwed (like displaying post authors for instance). This really wasn’t much of a problem for my purposes on this site though. …so I thought I’d share.

Hope this helps someone!


Golden Ratio Font Sizes

Here’s a nice tool:

http://type-scale.com/

Stop tweaking your font sizes for headings etc. manually, hoping to get something that looks balanced. Use a bit of maths instead!

This is a pretty good write-up of the concept:

http://www.pearsonified.com/2011/12/golden-ratio-typography.php

The golden ratio has been used for centuries to give things balance, but gets forgotten about all too often by a lot of designers.

Now our designs have to respond to many different formats over many different devices, just moving things around on the screen until they “look right” isn’t enough. One needs to think ever more about the rules that make them look good….


AfterEffects Strobe Expression

There’s some awful information out there on how to do strobe effects in AfterEffects. Let’s save some time. Put this as an expression on your opacity property:

if( timeToFrames( time ) & 1 ) { 100 } else { 0 };

Using a simple & operator on the current frame count makes the output alternate between 100 and 0 each frame. Want a strobe every other frame? time/2

Simple. Or in fact even better, let’s just do it with a ternary operator:

timeToFrames( time ) & 1 ? 100 : 0