klenwell information services : CocktailNapkin2013

2013 Cocktail Napkin

Return to SpecialCocktailNapkin

Ansible Setup
Unpublished Comment
response to https://news.ycombinator.com/item?id=6571678

Here's an interesting point made about Arab Spring:

While the poor struggle to survive from day to day, disappointed middle-class people are much more likely to engage in political activism to get their way.

This dynamic was evident in the Arab Spring, where regime-changing uprisings were led by tens of thousands of relatively well-educated young people. Both Tunisia and Egypt had produced large numbers of college graduates over the past generation. But the authoritarian governments of Zine El Abidine Ben Ali and Hosni Mubarak were classic crony-capitalist regimes, in which economic opportunities depended heavily on political connections. Neither country, in any event, had grown fast enough economically to provide jobs for ever-larger cohorts of young people. The result was political revolution.

None of this is a new phenomenon. The French, Bolshevik and Chinese Revolutions were all led by discontented middle-class individuals, even if their ultimate course was later affected by peasants, workers and the poor.

I think both Occupy and Tea Party movements fit this model. College kids mired in debt who can't find decent jobs. Aging white middle class conservatives watching the financial class run away with the lion's share of economic growth (while being led to believe that's it's being siphoned off by immigrants, welfare queens, and gay married couples).

Also brings to mind the old "Revolution to Conserve" idea I was introduced to back in AP American History:


Kinetic Scaling
Parasitic Simulation with KineticJS
<!DOCTYPE html>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width">
	<link rel="stylesheet" href="basic.css">
	<div id="app-stage"></div>
	<button id="stop-button">stop</button>
	<!-- Javascript Here -->
	<script src="kinetic-v4.7.1.js"></script>
	<script src="fiddle.js"></script>

CSS: basic.css
div#app-stage .kineticjs-content {
  margin:0 auto;
  border:1px solid #DDDDDD;

HocObject Neo-Parasitic Inheritance

Javascript Parasitic Instance Inference
I'm trying to develop a simple parasitic interface for my javascript classes modelled after Crockford and I'd like to implement some basic introspective methods. Given the class hierarchy below, how can I write class_name and is_a methods that correctly identify the object class? ... This question provides some additional information about my approach.
Javascript Inheritance
Weather Data
    Get high temperatures from a given weather station
from datetime import datetime
import time
import requests
from pprint import pprint

noaa_url = 'http://www.ncdc.noaa.gov/cdo-services/services'
noaa_service_f = 'datasets/GHCND/stations/%s/datatypes/TMAX/data'
station_id = 'GHCND:USC00047888'
api_rate_limit = 1.25 # seconds

def c10_to_f(value):
    c = value / 10.0
    f = c * (9.0 / 5) + 32
    return '%.1f' % (f)

def get_tmax_data(station_id, start, stop=None):
    records = []
    start_year, start_month = start
    if stop:
        stop_year, stop_month = stop
        now = datetime.now()
        stop_year, stop_month = now.year, now.month
    months = range(1,13)
    years = range(start_year, stop_year+1)
    qstring_f = '_type=json&year=%d&month=%02d&token=%s'
    noaa_service = noaa_service_f % (station_id)
    base_url = '%s/%s' % (noaa_url, noaa_service)
    ymd_f = '%Y-%m-%d'
    min_date = datetime.strptime('%d-%02d-01' % (start_year, start_month), ymd_f)
    max_date = datetime.strptime('%d-%02d-01' % (stop_year, stop_month+1), ymd_f)
    for y in years:
        for m in months:
            # skip if date is too early
            my_date = datetime.strptime('%d-%02d-15' % (y,m), '%Y-%m-%d')
            if my_date < min_date:
            # stop if date is too late
            if my_date > max_date:
            qstring = qstring_f % (y, m, token)
            request_url = '%s?%s' % (base_url, qstring)
            print y, m, request_url
            r = requests.get(request_url)
            data = r.json()['dataCollection']['data']
            for i,datum in enumerate(data):
                dated = datum['date'].split('T')[0]
                value = datum['value']
                f = c10_to_f(value)
                record = (dated, '%.1f' % (value), f)
    return records

# Tests
pprint(get_tmax_data(station_id, (2013,8)))

Wine Recommendation
jTable Factory

Wikka Tasks Interface
CSS Balls

jQuery $.when

Javascript: String Objects vs String Literals

Browser Storage Options
Jenkins Variables

Android Browser Translation App
I'm looking for one: http://android.stackexchange.com/q/46414/35024

The Locust Economy There seems to be an implicit holier-than-thou assumption among sharing economy evangelists that social sharing is primarily about virtuous behaviors like generosity, empathy, minding the planet, conserving resources, avoiding waste and so forth. Only secondarily do they see it as a zero-sum/negative-sum adaptation to recessionary conditions -- Bruce Sterling's favela chic.
Personal Breathalyzers
Was joking we need an app for this with talk of lowering legal BAC limit. Then it occurred to me to google it. Found:
Red/Blue/Mainstream Marketing
Listening to KUSC classical public radio fundraiser where they mentioned some dead commercial classical radio stations. Why have commercial classical radio stations died? Because, I'm guessing, blue (affluent, college-educated, progressive/liberalish) listeners won't listen to commercials. Unless they come in the form of discreet underwriting.

Surely upscale advertisers want to reach this blue audience as much as they ever have. It's just that blue audience will be receptive to them only under certain conditions, which exclude the sort crude advertisements listeners of mainstream and talk radio are prepared to endure.

How does underwriting revenue compare to old traditional commercial advertising revenue? Significantly less? More? Factor in difference between profit and not-for-profit station setups. Is it roughly comparable? My guess is that it is as lucrative, in terms of providing income for actual employees, as it ever was. But probably a slimmed-down operation (e.g., much smaller advertising dept that now goes under a different name) and no investors involved (so they will look elsewhere for their passive income.)

An Introduction to the Raphael JS Library

Google App Engine 1.7.6
(Un)Discarded Comments
response to HN comment

The point here is that these drugs haven't been tested for their safety, much less their efficacy. They are still at an early testing stage. The researchers seem to have a reasonable theory for why they believe they will be effective. But molecular biology is complicated and the risk for harmful effects in humans is not trivial.

Ben Goldacre's book Bad Pharma details the serious personal and social costs that come with poor drug trials. Everyone urging the abandonment of caution here seems to assume this new drug already works or, at the very least, the effects of its usage could not be worse than the grim prognosis patients already confront. But that's what proper trials are meant to establish. Snake oil can come in pill form, too. And even with the current regulations, we've ended up with a number of ineffective, expensive, and sometimes deadly drugs on the market.

Python Chess Icons
White icons
>>> icons = ['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> icons
['\xe2\x99\x94', '\xe2\x99\x95', '\xe2\x99\x96', '\xe2\x99\x97', '\xe2\x99\x98', '\xe2\x99\x99']
>>> print ' '.join(icons)

As html: ♔ ♕ ♖ ♗ ♘ ♙

Call For Companies that Do Developer Training
Tar with Absolute Paths
see http://klenwell.com/press/2013/03/tar-with-absolute-paths/

Discarded Comments
response to HN comment

One solution that's been proposed is the increased use of HSAs + high deductible policies. That way people are paying their expenses out of pocket (for the day-to-day things at least), and are therefore more likely to shop around.

This is a solution that's being implemented: the corporation I work for started pushing these a couple years ago and I signed up because they are much cheaper than the HMO alternatives (whose premiums significantly jumped that year). Corp also offered a sort of signing bonus ($500 in your HSA). Plus I'm single, in good health, and plan to do everything I can to avoid using the medical system.

You can't really comparison shop serious procedures and if I actually thought I needed real medical care, I would have signed up for one of the more expensive HMOs.

These HSA plans seem better designed to make consumers more conscious of the costs as a way to discourage gratuitous procedures (a big problem that was focus of recent Time article) and promote more preventative care.

response to HN comment

I help manage my grandmother's finances. Her health care is covered under Kaiser through the large corporation with which he retired.

I would guess over the last 5 years the amount that has been billed for her medical care has outstripped the amount of money I've made. Easily. The truth is: I have no idea. I don't think she's ever seen a medical bill in that time, apart from an incidental co-pay perhaps. Kaiser handles everything and I'm guessing pulls the money directly from Medicare.

I'm glad to see attention finally being given to the issue of transparency. There seems to be a media swell building around this recent Time article. And in my own experience, I signed up for a cheaper, high deductible plan at work that my company strongly pushed -- I suspect, in large part, because it made costs more tangible.

Like calorie counts posted on menus, it won't solve the issue, but I expect it will help nibble at the edges.

Online Mysql Designer

Group Overlapping Circles

center_pts = [(-2,2), (-2,2), (0,0), (4,1), (6,2), (7,1)]

overlapping_circle_pts = [
    (center_pts[0], center_pts[1]),
    (center_pts[0], center_pts[2]),
    (center_pts[1], center_pts[0]),
    (center_pts[1], center_pts[2]),
    (center_pts[2], center_pts[0]),
    (center_pts[2], center_pts[1]),
    (center_pts[2], center_pts[3]),
    (center_pts[3], center_pts[2]),
    (center_pts[4], center_pts[5]),
    (center_pts[5], center_pts[4]),

expected_clusters = [
    ((-2,2), (-2,2), (0,0), (2,1)),
    ((6,2), (7,1))

def cluster_overlaps(nodes, adjacency_list):
    connections = []
    while len(nodes):
        node = nodes[0]
        path = dfs(node, adjacency_list, nodes)
        # append path to connected_nodes
        # remove all nodes from
        for pt in path:
    return connections
def dfs(start, adjacency_list, nodes):
    path = []
    q = [start]
    while q:
        node = q.pop(0)
        # cycle detection
        if path.count(node) >= nodes.count(node):
        path = path + [node]
        # get next nodes
        next_nodes = [p2 for p1,p2 in adjacency_list if p1 == node]
        q = next_nodes + q
    return path
print cluster_overlaps(center_pts, overlapping_circle_pts)

def centroid(pts):
    fl = lambda n: float(n)
    ir = lambda n: int(round(n))
    xs = [fl(x) for x,y in pts]
    ys = [fl(y) for x,y in pts]
    x,y = (sum(xs) / len(pts), sum(ys) / len(pts))
    return (ir(x), ir(y))

Discarded Comment
In response to HN comment on article:

I'd be cautious extending this guy too much sympathy. He makes his stalker out to be something like Sean Hannity's incarnation of evil (a foul-mouthed female radical Iranian Islamo-extremist) where the truth, as others have pointed out, is probably less salacious: she's mentally ill. Moreover, I don't know about you, but most Persians I've met haunting the MFA programs of this country aren't Muslim jihadis but more like the Kardashians.

Discarded Comment
In response to this HN comment:

One of the interesting things I learned taking anthropology class as an undergraduate was the difference between sharing and gift-exchange. We studied some indigenous cultures in Papua New Guinea and where before I would have looked at their cultural practices and naively classified them as some form of communal sharing, I was taught to see them as involving elaborate forms of gift exchange. Gift exchange seemed to me much more complicated and personally taxing than more commercial forms of exchange using money.

If "disruptive online services" can filter out some of the social and emotional complexity involved in exchanging services, I think they've more than earned their fee. But I don't think the transition between loaning your couch to a friend and renting it out to him is as straight forward as suggested. I suspect the difference in the way money gets distributed among the various parties is among the least important factors that enters into such a bargain.

But then I see your point. Where before you might feel obligated to help out a friend down on his luck and needing a bit of assistance, Airbnb gives you a ready pretext for doing something more impersonal and efficient.

A Statistical Survey of Small Business Openings and Closings Correlated by Storefront Address

The Legal and Logical Implications of the Word Only in English Colloquial Usage