Blogs

Argh, distracted again

I don't know why this happens, but I started off Monday morning pretty good and strong, and then by noon was getting distracted.

The main change in my routine was that I didn't get up early enough to play some Ingress or take a walk. The short walk seems to help me concentrate for longer periods of time.

Finding anagrams in a list

I was reading quora and came across a post about someone who was rejected from facebook for a sloppy answer. The question was to make a list of words where the anagrams were grouped at the top.

People consoled the guy.

The answer seemed like a unixy thing. It's not that hard, the trick is to create an index for each word, where the index is the word, sorted by letter. So "cat" gets an index of "act".

Then you do some unix magic and get a list of anagrams.

The code to add that index is this:

#include 
#include 
#include

Demo of rotating an element to make a "dial" or "knob" ui element

Here's a little bit of code that shows how to create a "dial" knob that you can control with the mouse. It's entirely in HTML, CSS and Javascript.

It's not hard, but there are a lot of little details to make it look reasonable and not completely goofy. I think it moves a little weird - and it should respond to both x and y axes, but doesn't.

The sum of two sines, with an offset.

In defense of crappy programming languages

I've been doing a lot of Javascript and Python lately, and they're both kind of crappy, quirky languages, but are fun. There aren't many languages that aren't quirky. C and Scheme and Lisp come to mind. Maybe Java and C#, too.

Javascript Double Exclamation

It's a way to cast any variable to a boolean.

var x = true;

!!x === true; // this is a fact

Sometimes, we do a check on an object:

if (window.foo) {
  ...
}

However, if we assign a variable like this:

var isFoo = window.foo;

isFoo will now contain a reference to window.foo. 
If you want isFoo to contain the truthyness of 
window.foo, you do this:

var isFoo = !!window.foo;

A Few Ideas for Mobile Augmented Reality Apps

I've been playing a game called Ingress and it's got a lot of interesting ideas in it, because it's like a tour guide to public artwork. Here are some ideas for more apps, specifically around LA.

LA tour of the Mexcian-American war.

LA tour of the old Chinatown and the New Chinatown.

Something that lets you record audio at a location, and when someone else goes to that location, they can hear the audio.

The same thing for historic photos and photos.

The same thing for poetry and spoken word texts and written texts.

The same thing for music.

Nesting Angular Directives

I've been learning how to write directives, and it's really tough to grok how to do it. This blog post's been rewritten three times so I don't come off as totally ignorant about the "right way" or "the Angular way" to do things.

What I'm trying to do it implement a menu display with lightweight, role-based control over what is displayed.

My first iteration was done entirely with controllers, HTML, and jQuery and plain Javascript. That was clearly not the Angular way, so I revised it a little bit - CSS animations, and let's use directives.

Angular Service and Factory

I was reading the docs, and read things that seemed to contradict what I thought. I thought that Services were singletons, and Factories were instantiating new instances. It turns out that's not quite right. It's explained well here.

Base32 Encoding and Decoding in Javascript

This is a simple implementation of base 32 encoding and decoding that conforms to RFC 4648.

NPM:CPAN as HTML5:PERL

I just had to update my JS toolchain of node on up. NPM is insane. Not just the tool, but the packages.

CSS Animations via Styles (similar to jQuery animations)

This article is a little obsolete, because the latest way to do animations is via CSS Transitions but browser support isn't all there yet. This explores how to do CSS-style based animations, where the animations are controlled via Javascript code that adds and deletes class names from the className property.

Cloud Storage Reviews Dropbox, OneDrive, Google Drive, iCloud

If you want to read some professionally written reviews, I read these:
PC Advisor
PC Mag
CNET
My review will be a lot shorter: Dropbox. Explanations below.

I Think I Got Scammed - My Battery Desulfator Experience

I just bought one of those "battery desulfator" devices on ebay. The brand was wizbangplus.com, but there are numerous different brands, and there are some that are added to battery chargers. This essay explains why I got bamboozled.

A funny RAID 1 failure factoid: you will fail more

A funny thing about RAID 1 disk mirroring, is that if you implement it on your computer, you're more likely to experience a failure. The trade off is that the failure won't be catastrophic.

Sign up for Ebates to support this site (and get cash back)

Ebates is a shopping aggregator that passes along a small portion of the sales commission to you. For example, they negotiate to get 3% commission on a sale, and pass 1% on to you. Combine that with a 1% or 2% cash back on your credit card, and some other discounts, and you can save a little more money.

If you sign up through the link below, I get a commission for your signup. This helps pay for this site, which is free for all readers.

Sign up using this referral link.

Syndicate content