Twitter Feature Request: Show Video Titles and Times

August 31, 2015

Dear Twitter,

I have a feature request for video links. The current "View media" feature is nice.

The in-line, expanded card it opens is great.

But, I'd like be to see the video's name and it's length without having to click/tap anything. Please consider replacing the URL with the title and run time in the initial display. For example, instead of:

Maybe something like:

Thanks,

-a


Reading and Writing Files with SQLite

July 21, 2015

The documentation for SQLite isn't super clear on how to work with external files directly from the command line. Here's how to read and process SQL from an input file:

sqlite3 database.db < input.sql

And this captures the output to a file as well:

sqlite3 database.db < query.sql > results.txt

Super useful for automating work without having to jump into SQLite itself.


(Alternative approaches are cat input.sql | sqlite3 database.db and cat query.sql | sqlite3 database.db > results.txt, respectively, but they aren't as aesthetically pleasing.)


Fifteen (plus) Years Building This Website

July 13, 2015

Today, this site is officially fifteen years old.

Crazy as that seems, it's actually even older. I started it in the late '90s. The records database doesn't go back that far. So, I don't know exactly when. I tried using the Internet Archive's Wayback Machine to figure it out. No help there. The first snapshot wasn't until July 18, 2001.

I still get a kick out of that iteration of the home page. It refreshed every four seconds. Each time presenting a bunch of "all work and no play makes jack a dull boy." sentences in different layouts. An ode to The Shining.

That page was hand built in language from Microsoft called ASP (for Active Server Pages). Every time someone loaded it, the server would pick a random selection from the dozen or so different "all work…" layouts and display it. Nothing fancy. Just a fun little experiment.

In September 2005 I started blogging at Blogger.com. Within two months I decided I was going to keep at it and migrated everything here. The brief post I wrote about the move had this line:

I like the idea of having my stuff be mine and not under someone else's control.

Could've used some editorial help on that one but the sentiment holds. After a decade and a half working on a personal site, I can highly recommend it for everyone. And, thanks to the march of technology, it's easy for anyone to do it for free.

If you're not a tech person, go to Wordpress.com and click the "Create Website" button. You'll be up and running in a few minutes. Over time, you'll be much happier working on your own thing than something in someone else's social network.


Notes

  • Wordpress is "Open Source Software". That means you can take your site off "Wordpress.com" and put it somewhere else.
  • Wordpress is a great choice for tech folks too. It gets you up and running and is easy to migrate away from if you find another platform to use later.

Name dot Whatever Websites are Available

July 12, 2015

The last part of a website's name (e.g. the ".com", ".edu", or ".uk") is called the Top-level Domain. Each country gets their own (e.g. ".au", ".uk", ".us"). There also used to be seven other "generic" possibilities:

  1. .com (commercial)
  2. .org (organization)
  3. .net (network)
  4. .int (international organizations)
  5. .edu (U.S. education institutions)
  6. .gov (U.S. government)
  7. .mil (U.S. military)

That list has been growing in recent years. It's up to 810 at last count1. This makes it harder for cybersquatters2 to snatch up all the good ones. There are simply too many possibilities to make it cost effective. For example, here's the current list of available my name dot whatever:

Site Domain Name Price
alan.accountants $73.98
alan.adult $80.00
alan.aero $79.81
alan.alsace $39.86
alan.apartments $47.81
alan.associates $24.60
alan.auction $24.60
alan.bar $55.50
alan.bargains $24.60
alan.beer $24.37
alan.bid $19.24
alan.bingo $41.81
alan.bio $47.26
alan.black $34.85
alan.boutique $24.60
alan.brussels $31.81
alan.build $55.50
alan.builders $24.60
alan.cab $24.60
alan.camp $24.60
alan.capetown $23.09
alan.cards $24.60
alan.care $24.60
alan.careers $37.99
alan.casino $136.81
alan.chat $27.81
alan.cheap $24.60
alan.church $24.60
alan.city $17.39
alan.claims $37.99
alan.clinic $37.99
alan.coach $37.99
alan.cologne $11.54
alan.community $24.60
alan.condos $37.99
alan.contractors $24.60
alan.cool $24.60
alan.coop $119.81
alan.credit $73.98
alan.creditcard $109.97
alan.cricket $55.50
alan.cruises $37.99
alan.cymru $16.72
alan.dating $37.99
alan.deals $24.60
alan.delivery $37.99
alan.dental $37.99
alan.desi $16.36
alan.diamonds $37.99
alan.direct $24.60
alan.directory $17.39
alan.discount $24.60
alan.domains $24.60
alan.durban $23.09
alan.energy $73.98
alan.enterprises $24.60
alan.equipment $17.39
alan.estate $24.60
alan.exchange $24.60
alan.expert $37.99
alan.fail $24.60
alan.farm $24.60
alan.financial $37.99
alan.fish $24.60
alan.fitness $24.60
alan.flights $37.99
alan.football $16.81
alan.forsale $24.60
alan.foundation $24.60
alan.frl $33.68
alan.fund $37.99
alan.furniture $37.99
alan.gifts $24.60
alan.glass $24.60
alan.golf $54.81
alan.gratis $17.39
alan.green $55.50
alan.guide $24.60
alan.guitars $24.60
alan.hamburg $38.83
alan.haus $24.60
alan.healthcare $37.99
alan.holdings $37.99
alan.holiday $37.99
alan.host $70.95
alan.immo $24.60
alan.immobilien $24.60
alan.industries $24.60
alan.institute $17.39
alan.insure $37.99
alan.investments $71.98
alan.jetzt $17.39
alan.joburg $23.09
alan.juegos $13.61
alan.kaufen $24.60
alan.koeln $11.54
alan.land $24.60
alan.lease $37.99
alan.legal $37.99
alan.lgbt $34.85
alan.life $24.60
alan.lighting $17.39
alan.limited $24.60
alan.limo $37.99
alan.loans $73.98
alan.ltda $32.84
alan.luxury $480.00
alan.market $14.60
alan.marketing $24.60
alan.media $24.60
alan.memorial $37.99
alan.menu $29.75
alan.moda $19.45
alan.money $24.60
alan.nagoya $13.01
alan.ngo $64.81
alan.one $11.81
alan.partners $37.99
alan.party $24.39
alan.physio $65.80
alan.pink $14.25
alan.pizza $37.99
alan.place $24.60
alan.plumbing $24.60
alan.plus $32.81
alan.poker $34.85
alan.porn $80.00
alan.pro $14.30
alan.properties $24.60
alan.quebec $27.61
alan.recipes $37.99
alan.red $14.25
alan.reisen $17.39
alan.rentals $24.60
alan.rest $29.75
alan.restaurant $37.99
alan.reviews $19.45
alan.ruhr $33.89
alan.sale $24.60
alan.sarl $24.60
alan.school $26.81
alan.singles $24.60
alan.solar $24.60
alan.supplies $17.39
alan.supply $17.39
alan.surgery $37.99
alan.tattoo $24.60
alan.tax $37.99
alan.technology $17.39
alan.tennis $41.81
alan.tienda $37.99
alan.tires $73.98
alan.tokyo $13.01
alan.tools $24.60
alan.tours $54.81
alan.town $24.60
alan.trade $24.60
alan.training $24.60
alan.travel $110.00
alan.university $37.99
alan.vacations $24.60
alan.ventures $37.99
alan.viajes $37.99
alan.vlaanderen $31.81
alan.vote $55.50
alan.voto $55.50
alan.voyage $37.99
alan.wedding $24.60
alan.wien $31.11
alan.xxx $80.00
alan.yoga $24.60
alan.yokohama $13.01
alan.zone $24.60

Those prices are per year. For comparison, I pay $14 per for this site (alanwsmith.com).

Historically, having ".com" at the end of a website was important for marketing. My guess it will continue to be for sometime but that'll diminish to being a wash over time.


(Note: The number of top-level domains for the F-word is surprisingly high. They include: .associates, .church, .education, .expert, .golf, .guru, .management, .partners, .photography, .systems, .university.)


Footnotes

  1. The current list of Top-level domains.

  2. From the Wikipedia: Cybersquatting (also known as domain squatting), according to the United States federal law known as the Anticybersquatting Consumer Protection Act, is registering, trafficking in, or using an Internet domain name with bad faith intent to profit from the goodwill of a trademark belonging to someone else. The cybersquatter then offers to sell the domain to the person or company who owns a trademark contained within the name at an inflated price.


Don't use PVC for Fireworks Launch Tubes

July 03, 2015

Once you discover mortar fireworks, nothing else will do.

The fireworks I grew up with were self-contained little packages. You'd light a fuse on a box or stick, it would do its thing, then be tossed. Mortars are different. A basic package contains a reusable launch tube and several shells.

A basic cardboard launch tube and eight double-break shells. The "double break" part means each shell produces two colorful bursts in the sky.

Drop a shell in the tube, light fuse and get away. Then, do it again. They go way higher, look better and make a bigger bang than other fireworks. They're really just smaller scale version of the stuff the pros use.

Industrious pyros line up multiple tubes, run fuse between them and launch several shells at once. Even more industrious pyros use pipe to make their own tubes for more simultaneous launches. This is where things can go sideways.

The tubes in fireworks packages are generally dense cardboard or fiberglass. It's easy to think that if cardboard would work, PVC from your local hardware store would too. Don't make this mistake. If something goes wrong and the shell explodes in the tube, shrapnel flies. Here's what that looks like:

Instead of PVC, professionals recommend High-density polyethylene (HDPE). It's much less likely to maim or kill someone if something goes wrong. Check out the difference:

A final note, don't be fooled by "ABS" pipe at the hardware store. It looks like HDPE but it's different and also unsafe. You're best bet is search online. (The top search result that came up me was PyroBoom which looks like a great place to start.)

Be safe out there and have a happy 4th of July.


Time Stamp Snippet for TextExpander

June 30, 2015

Ask any programmer who's dealt with dates, times, and timezones to describe them. They'll start to twitch. As YouTube's Computerphile explains, setting a computer's clock for wherever you happen to be is an ugly mismash of science, culture, and international politics.

In short, it's a mess.

The International Organization for Standardization addressed some of the wibbly-wobbly aspects of time with a notation standard called ISO 8601. The template looks like this:

2015-06-30T04:03:31-0400

which corresponds to:

[year]-[month]-[day]T[hour]:[minute]:[second]-[timezone_offset]

It's the best solution we have the computers understand and humans can still read but it's a pain to type. That's where TextExpander, one of my desert island apps, comes in.

TextExpander let's you define a set of short abbreviations. They automatically expand to longer strings of text. For example, when I type sta; TextExpander sees it and instantly replaces it with St. Augustine. Nothing ground breaking. Just a nice convenience where the computer saves me a little typing.

I have snippets setup for email signatures, locations, command phrases, and my personal collection of frequent typos (e.g. auto-correcting "teh" to "the"). There's some basic Date/Time placeholders built-in but timezones aren't included. That wouldn't be a problem if Daylight Savings Time didn't exist but it does. And, because of how it works, the timezone offset has to change twice a year. I could do that manually but the likelihood of remembering makes that a non-starter.

Enter the recently released TextExpander Version 5. In addition to basic expansions, it brings ability to write expansions in the JavaScript programming language. Here's my chunk of code to solve the timezone problem and create a current date/time stamp in the ISO format:

function awsIsoDateTime(awsDate) {
  var awsYear  = awsDate.getYear() + 1900;
  var awsMonth = (awsDate.getMonth() < 9) ? ('0' + (awsDate.getMonth() + 1)) : (aws.getMonth() + 1);
  var awsDay   = (awsDate.getDate() < 9) ? ('0' + awsDate.getDate()) : awsDate.getDate();
  var awsHours = (awsDate.getHours() < 10) ? '0' + awsDate.getHours() : awsDate.getHours();
  var awsMinutes = (awsDate.getMinutes() < 10) ? '0' + awsDate.getMinutes() : awsDate.getMinutes();
  var awsSeconds = (awsDate.getSeconds() < 10) ? '0' + awsDate.getSeconds() : awsDate.getSeconds();
  var awsOffsetFlag = (awsDate.getTimezoneOffset() == 0) ? 'Z' : ((awsDate.getTimezoneOffset() > 0) ? '-' : '+');
  var awsAbsoluteOffset = Math.abs(awsDate.getTimezoneOffset());
  var awsHoursOffset = awsOffsetFlag == 'Z' ? '' : ((awsAbsoluteOffset / 60) < 10) ? ('0' + parseInt(awsAbsoluteOffset / 60)) : (parseInt(awsAbsoluteOffset / 60));
  var awsMinutesOffset = awsOffsetFlag == 'Z' ? '' : ((awsAbsoluteOffset % 60) < 10) ? ('0' + parseInt(awsAbsoluteOffset % 60)) : (parseInt(awsAbsoluteOffset % 60));
  var awsString = awsYear + '-' + awsMonth + '-' + awsDay + 'T';
  awsString += awsHours + ':' + awsMinutes + ':' + awsSeconds + awsOffsetFlag + awsHoursOffset + awsMinutesOffset;
  return awsString;
}

awsIsoDateTime(new Date());

Create a new snippet, switch it to JavaScript, drop that in and you're ready to go.

Of course, being JavaScript it works in browsers too. Here's an example generated on the fly when you loaded this page:


(For the programmers yelling that the code is hard to read, you're right. Because I want to be able to see the entire block in the TextExpander window I went for fewer lines over readability.)


Today I Learned: Quickly Copy a Directory Path

June 12, 2015

I add this to my .zshrc, .bashrc, etc… files to quickly copy directory paths from the command line:

alias pwc="pwd | tr -d '\n' | pbcopy"

It runs pwd, clips the newline off then sends it to the pasteboard (aka clipboard).

Super handy.


Side note: "pwd" stands for "print working directory". Using "cwd" would make more sense grammatically (i.e. "copy working directory") but the keystrokes are cumbersome. Hence, I use "pwc". Your mileage may vary. Season to taste.


Today I Learned: Mapping ':te' to ':tabedit' in Vim

June 02, 2015

Vim's :tabedit command seems long considering how often it's used. Applying logic from this StackOverflow answer produces this customization:

cnoreabbrev <expr> te getcmdtype() == ":" && getcmdline() == 'te' ? 'tabedit' : 'te'

It defines a :te shortcut which expands to :tabedit. Throw it in ~/.vimrc and save five characters for every tab open.


It's worth pointing out that this accepted StackOverflow answer provides a dangerous alternative. It recommends ca (aka cabbrev). For example, ca te tabedit. The gotcha hidden in this approach is that it expands across the command. Trying to run :!ls /tmp/te/ will be altered to :!ls /tmp/tabedit/. Not so good.

And, yes, I added an answer to help out there too.


Go To Index Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106


© Alan W. Smith
RSS Feed