Home of the Boogie-Woogie Feng Shui

On Page Margins

Who decided 1.25″ was rea­son­able for mar­gins on paper? It’s stu­pid to waste 40% of the paper. I doubt peo­ple get con­fused when text comes to within say half an inch of the paper edge. “Gee, this para­graph would look bet­ter with a big white bor­der: like a mes­sage in a bot­tle drift­ing patiently in a vast sea wait­ing to be discovered.”

Here is the break­down of mar­gin reasonableness:

0 — Used by crazy peo­ple writ­ing screeds to hand to strangers on streetcorners

1/4″ — User clearly cares for envi­ron­ment but pushes the lim­its. Pos­si­bly goes a bit over­board about trees and mother nature.

1/2″ — The happy best size for com­mu­ni­cat­ing. LOOK — infor­ma­tion can be fit onto the page!

3/4″ — A good com­pro­mise for get­ting a lot of infor­ma­tion onto the paper with­out look­ing overcrowded.

1.25″ — Sta­tus quo. You write doc­u­ments but you don’t read them for a liv­ing or need to refer to them.

1.5″ — Gotta turn in a paper with spe­cific page count, eh? Hey, don’t for­get to use 16 pt font and make the mar­gins frac­tion­ally larger!

Greater than 1.5″ — You are liv­ing in a state of sin.

1.5″ mar­gins are barbaric.

Password-less, Key-based logins in Solaris

Found these notes in draft mode, writ­ten last sum­mer when I was doing heavy sysad­min work. These mostly call out impor­tant set­tings with­out a detailed set of steps. They may be use­ful for some­one though.


Users have to be set for no-password authentication.

bash-3.00# passwd -N jsmith
passwd: password information changed for jsmith

You can check by look­ing at /etc/shadow and ver­ify the pass­word col­umn is set to “NP”:

bash-3.00# grep jsmith /etc/shadow
jsmith:NP:15190::::::

 

Change sshd set­tings to dis­al­low Password-based logins

# Are logins to accounts with empty passwords allowed.
# If PermitEmptyPasswords is no, pass PAM_DISALLOW_NULL_AUTHTOK
# to pam_authenticate(3PAM).
PermitEmptyPasswords no

# To disable tunneled clear text passwords, change PasswordAuthentication to no.
PasswordAuthentication no

# Use PAM via keyboard interactive method for authentication.
# Depending on the setup of pam.conf(4) this may allow tunneled clear text
# passwords even when PasswordAuthentication is set to no. This is dependent
# on what the individual modules request and is out of the control of sshd
# or the protocol.
PAMAuthenticationViaKBDInt yes

# Are root logins permitted using sshd.
# Note that sshd uses pam_authenticate(3PAM) so the root (or any other) user
# maybe denied access by a PAM module regardless of this setting.
# Valid options are yes, without-password, no.
PermitRootLogin no

Short Digres­sion on spe­cial set­tings in /etc/shadow

Locked user

  • (not allowed to login)
  • All newly-created users are like this before you set a password
bash-3.00# grep jsmith /etc/shadow
jsmith:*LK*:::::::

No-Password Login: No password-based login

  • this is what you need for key-based logins
  • set with: passwd –N <user>
bash-3.00# grep jsmith /etc/shadow
jsmith:NP:15190::::::

[empty]: Dis­abled user

set with: passwd –d <user>

bash-3.00# grep jsmith /etc/shadow
jsmith::15190::::::

The Subway Experiment and Attention

I hate the con­clu­sion from this writeup of the sub­way exper­i­ment and the over­all tone. It’s an inter­est­ing exper­i­ment, but the con­clu­sion is irk­some non­sense. It assumes we should stop and eval­u­ate every­thing we see to deter­mine how great it is. Should every street musi­cian get 10 min­utes of time from every pedes­trian walk­ing by? No, of course not — who would be man­ning the bank teller or direct­ing air­plane traf­fic and the mil­lion other things that need to get done?

The rea­son tick­ets sell for $100 to see him in con­cert is our soci­ety has per­formed an effi­cient fil­ter­ing already — by pay­ing, a per­son is guar­an­teed to see some­one who is extra­or­di­nar­ily gifted and worth our lim­ited free time and money.

Also, the idea that this guy play­ing in the sub­way is the only pos­si­ble worth­while beauty nearby and every­one should stop and enjoy it is also silly. While walk­ing by, I can imag­ine the great din­ner with friends I had last night or the date night with my wife com­ing up, or lis­ten to the 1000 hours of self-selected great music from my phone. The idea some­body play­ing vio­lin should trump every­thing else vying for my atten­tion makes me angry: who is the author to judge what is best for me to think about while get­ting on the subway?

My wife amazes me

I have started to real­ize that any pro­gram­ming or com­puter fact my wife encoun­ters, she absorbs and assim­i­lates it. Then later it gets deliv­ered to me in an unex­pected and clever way. In the past few days she has done these things that stopped me in my tracks:

  • Reminded me to enable robots.txt to pre­vent Google index­ing a task-management app I am work­ing on.
  • Asked if I was using alpha­betic ASCII char­ac­ters for a URL slug to ensure I wasn’t just using inte­gers and lim­it­ing the size of the ran­dom slug space.
  • After see­ing my frus­tra­tion find­ing a tool to crop an image with a per­fect cir­cle (they all offer a hand-drawn ellipse, not an actual cir­cle), sug­gested I use the rec­tan­gu­lar image and put a mask over it with a cir­cu­lar hole. And thus, many hours of painful devel­op­ment and man­ual image crop­ping were made com­pletely unnecessary.

Better local settings in Django

I had an idea today about improv­ing the use of local_settings.py in Django projects. I find it annoy­ing to have them required but get zero feed­back about them being cor­rectly spec­i­fied in their entirety. I got to think­ing: why not list the required para­me­ters and if they don’t get set, raise a spe­cific excep­tion at startup rather than in the mid­dle of envi­ron­ment testing.

The strat­egy here is to spec­ify by names a list of required_local_settings. Each is checked after import of local_settings.py and a sin­gle except is built list­ing the spe­cific miss­ing ones. If they all exist, no mes­sage is delivered.

If any­one has thoughts on this or bet­ter imple­men­ta­tion I’d like to hear about it. This is a rough draft from a few min­utes this morn­ing and seems to work in ini­tial testing.

try:
    from local_settings import *
except:
    pass

required_local_settings = [
    'DATABASES',
    'DEBUG',
    'GOOGLE_API_KEY',
    ]

missing_local_settings = []
for key in required_local_settings:
    if not locals().has_key(key):
        missing_local_settings.append(key)
if len(missing_local_settings) > 0:
    raise NotImplementedError(
        "local_settings.py is missing required settings. Please define: " +
        ', '.join(missing_local_settings))

Foreward to the Biography by Asa

My Lit­tle Brother, Asa, wrote a biog­ra­phy of me for his 7th grade project. Below is the fore­ward I provided:

 

They say the first biog­ra­phy is the hard­est. Or maybe they don’t. Some­body might have, and I just did, so it has been said. Real exam­i­na­tion of one’s life is hard and harder still is shar­ing it with another. The mis­takes, per­sonal flaws, and suc­cesses seems dis­tant and unwor­thy com­pared to the present. Shar­ing them openly with a biog­ra­pher brings up ques­tions of the deep­est self judgment.

The shar­ing is key, though. In shar­ing mem­o­ries, between the biog­ra­pher and sub­ject grow new mem­o­ries — a fusion of the old and the new, of the shar­ing itself. In this is con­nec­tion to another per­son who becomes a con­fi­dante and con­fes­sor. This is the sav­ing grace of open­ing one’s mem­o­ries to exam­i­na­tion through the clear lens of time: painful mem­o­ries become duller; joy­ful mem­o­ries become richer.

I have shared this process with Asa, my brother, and he worked it into its final form in the fol­low­ing pages. Start­ing from the sim­ple idea of want­ing to know me bet­ter he asked ques­tions. And asked ques­tions. And then more ques­tions. I pro­vided mem­o­ries and sto­ries: I cer­tainly had noth­ing like answers to give except to the sim­plest fac­tual ques­tions. Together we nav­i­gated through the years of my life and found some of the pieces that make me me. And we found some of the parts that con­nect myself and Asa across the years, my child­hood to his, my teenage years to those he is enter­ing. (Note to the reader: I don’t ever plan to become an adult, but if I do that would likely con­nect too).

This project — this wan­der of ours — took seri­ous turns into areas of regret and wist­ful­ness. We shared those mem­o­ries and sto­ries. There were turns of sad­ness. We shared those mem­o­ries and sto­ries. The laughs were eas­ily shared from the begin­ning but the seri­ous emo­tions took time. But we shared the time and even­tu­ally the sto­ries. We went in, we saw some things together, suf­fered some scrapes, laughed, and came out together on the other side: what more could adven­tur­ers want?

The bond I share with Asa is a project of ours. This book con­tains many steps along the way of get­ting to know each other bet­ter. One should make an effort to sit and share deeply with oth­ers. I rec­om­mend it, for the com­fort and joy it gives and the bonds built. I look for­ward to hold­ing the final fin­ished form for us to look back on in the years to come. I’m sure we will laugh at how far we have come in the years after in build­ing this bond.

Asa ini­ti­ated this project and fol­lowed it through and deserves credit for every­thing con­tained within. I pro­vided sto­ries, he pack­aged them. In cap­tur­ing a small por­tion of them, he saves them for us. This book is an index, a mnemonic, to this adven­ture of the last few months. Read it, but real­ize most of the biog­ra­phy is within us and between us, too pre­cious to com­mit to paper.

I stand with Asa after know­ing him for two years. We have gone from acquain­tances to friends to com­rades to broth­ers. Asa has deter­mi­na­tion, a curi­ous mind, and pas­sion for many things. He is des­tined for fine things in the world. One day it will be my honor to share his sto­ries as he has shared mine herein.

Enjoy, reader! Here within your hands is a book by one per­son, a bond shared between two, and mem­o­ries shared among the three of us. You are wel­come here.

A note to Asa: I am proud of you.

Weird Schedule

I am lucky to have a won­der­ful wife who sup­ports my some­times weird sleep sched­ule. After an all-nighter yes­ter­day writ­ing papers I was mostly use­less this evening and slept until now, to get up and write again. She’s so good to put up with me.

The dogs were happy to take over my job of snug­gling up to her. Darn those non-homework-having animals.

Operation Fabio

My job and EMBA class is putting me into close asso­ci­a­tion with peo­ple oper­at­ing at a higher level of cor­po­rate life. I am notic­ing now the dif­fer­ent level of per­sonal care nec­es­sary to fit into higher posi­tions in com­pa­nies. Bet­ter hair­cuts, nicer shoes, and finer clothes.

Oper­a­tion Fabio is the process of upgrad­ing my out­ward appear­ance to merge into the the higher cor­po­rate lev­els I am aim­ing for.

Fri­day I got a new hair­cut. We went to my wife’s salon and asked to see an opin­ion­ated styl­ist. She actu­ally ended up at nearly the hair­cut I already had, but did it much finer than the usual places I go. Not a big notice­able dif­fer­ence, but felt good.

Fri­day night we went through all of my clothes. We removed 60% for dona­tions imme­di­ately for rea­sons of fit or fash­ion. About 20% we kept as fash­ion­able but ill-fitting until I lose some weight. The other 20% are wear­able clothes. My closet went from 2 packed hang­ing rods to 1 rod about 3/4 loaded. My other clothes fit eas­ily into 5 draw­ers instead of over­flow­ing from 9.

Sat­ur­day we went shop­ping to get things I lacked. We bought some dressy jeans, a blue suit, 3 fine shirts and 2 ties, and a tweed blazer. The big pur­chase was shoes though. We spent over 2 hours at John­son & Mur­phy select­ing the finest of fine shoes. I got some amaz­ing brown brogues, the sharpest black dress shoes known to man, and some boat shoes for sum­mer casual wear.

Next step is some real weight loss so I can start using the clothes in the ‘hold’ pile of our cleanout.

Hack Night

Incred­i­bly pro­duc­tive night hack­ing. I spent the after­noon with Ata vis­it­ing from New Jer­sey to see me, Bren­don, and the Jay­hawks. While out eat­ing I drank way, way too much diet coke. Hence my being up at 4 AM.

I’ve been hack­ing on my startup, which is a hobby project right now but hope­fully a real future busi­ness. I’ve never been a web devel­oper, at least not with the dynamic stuff using ajax, jquery, and other tools. So in devel­op­ing a mobile web­site appli­ca­tion I have a ton to learn.

The ini­tial mockup and basic work­ing site was built in Decem­ber then left dor­mant for 6 weeks. I finally started last week tack­ling the prob­lems, focus­ing on what I fig­ured would be the hard­est: geo-location with javascript. That was sur­pris­ingly easy to get the lat­i­tude and lon­gi­tude. Then I hooked up a python library to reverse-geocode that into an address. Then the city and state would be dis­played on the page the user sees.

In my epic hack night tonight I turned that basic geo-location into a fea­ture set:

  • Geo-location (lat­i­tude and lon­gi­tude) and time­stamp saved in cook­ies. Every user loca­tion update is saved to DB, as are “anony­mous users” for ana­lyt­ics purposes.
  • Loca­tion is only re-detected every 10 minutes.
  • Reverse geo-encodes (lat/lon to address) is saved to DB at full res­o­lu­tion and at ~100m res­o­lu­tion so lookups from the same area don’t need to be re-checked.
  • With the user’s loca­tion, nearby places and events are pulled from the DB.
  • Any object with an address com­po­nent gets geo-located on update.

I almost went to bed at this point, around 2:30 AM. But the caf­feine was still hum­ming just enough that sleep would be dif­fi­cult. So I started tack­ling what I fig­ured would be a really dif­fi­cult fea­ture: mak­ing the page con­tent dynamic based on loca­tion. So after loca­tion is detected the page retrieves the right info and rebuilds the page — no refresh needed.

That turned out to be a lot eas­ier than expected. I did not use moustache.js or other tem­plat­ing frame­work. I went with a tech­nique I had heard the Base­camp guys use, of gen­er­at­ing the full HTML on server side and send­ing that to client page to dis­play, as opposed to send­ing JSON data and build­ing HTML on the client.

In just 90 min­utes of work I made these changes:

  • stripped the HTML tem­plate to min­i­mal struc­ture and moved the con­tent sec­tions to a new file for Django to ren­der alone
  • Dis­cov­ered the ‘render_to_string’ helper which did exactly what I need — process like a nor­mal HttpRe­sponse but give me a string rather than Response object.
  • Add a sec­ond Ajax process trig­gered by loca­tion updates that retrieves fresh location-aware con­tent then rewrites the page
  • Reworked some javascript so it could be trig­gered after the page rewrite.

Over­all — it works! Not bad for being in totally new ter­ri­tory. This is a huge step for­ward to my think­ing: I’ve tack­led the two tough­est fea­tures in the way I wanted: loca­tion and one-page appli­ca­tion feel. Their is def­i­nitely cleanup to do in these fea­ture sets, par­tic­u­larly log­ging for when it fails. Fail­ure is barely han­dled at all right now.

I might write some tech­ni­cal blog posts with the details of these oper­a­tions. Per­haps some­one else will find it use­ful to see how I accom­plished the loca­tion detec­tion in HTML and javascript then add on the Ajax push to server so extra things can be done.

Right now I’m test­ing the pro­duc­tion deploy­ment to make sure it still behaves like I expect. Yep. Cool.

Prometheus? No thanks.

Watch­ing Prometheus. Def­i­nitely turn­ing into one of the stu­pid­est “sci­ence” fic­tion movies I’ve ever seen. Expected some­thing inter­est­ing, instead it’s just stu­pid alien hor­ror non­sense. Very disappointing.

Dis­trict 9 was bet­ter than this. Hon­est to god — DISTRICT 9, folks. Bat­tle­field Earth, Star­ship Trop­ers 3, Jaws: The Revenge…these are all things you should watch instead of this non­sen­si­cal claptrap.

Besides hurt­ing me, the viewer, I have to remem­ber that involve­ment with this movie is on some people’s RESUME! Just think­ing about it creeps me out. That’s a rough way to go through life.