Skip to main content
Posts by:

Tim Booher

Radiant to WordPress Conversion

First I had to backup my database from Heroku — so I created the database in PostGresSQL.

heroku pgbackups:capture
curl -o latest.dump `heroku pgbackups:url`
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d booher_blog latest.dump

Armed with that and the handy Induction I then needed to get my data into a format easily imported by WordPress. There is probably a standard way to do this, but I didn’t have time to find the efficient way. The first place I did look was the wordpress import data page, which led me to the right plugins. Then I was planning on running a command like:

COPY products_273 TO '/tmp/products_199.csv' DELIMITER ',' CSV HEADER;

It turns out that Induction has a great export tool to easily get me a new CSV file, but I had to make a new join table:

CREATE TABLE for_wp2 AS SELECT pages.title, page_parts.content, page_parts.name, pages.updated_at FROM pages, page_parts WHERE page_parts.page_id = pages.id;

Then I imported this via the wordpress-importer plugin. I used radiant “type” as a category and am going for the quick and dirty solution and figured I can manually copy over assets as opposed to creating a wget script to upload them. Wish there were an automated tool for this, but a little database knowledge is all that’s required.

By 0 Comments

Review: First by Rich Froening

CrossFit is still a new and growing sport which is misunderstood by many to be a place only for the elite. Rich Froning brakes down the barriers between the most elite tier of the sport and the most casual reader as he lays out his life and worldview in an amazingly fast and engaging read. His book has three main themes constantly woven together in an interesting narrative: (1) explaining CrossFit, (2) telling us about his life and (3) sharing with us insights about his faith and philosophy.

It is rare to find such an honest and optimistic account from someone with so much fame and talent. While his readership will most strongly come from CrossFit fans, he packs some great lessons for all of us that have broad application well beyond CrossFit. Like his fitness training regimen, he doesn’t hold back or shy away from the key principles that guide his actions and frame his world. All this results in an intimate portrait of his strengths, weaknesses and casual thoughts. Part of what makes this narrative so engaging is the casual style he engages you with as he takes you through the CrossFit victories and defeats that define his nascent career. You have to keep reminding yourself that he is winning first place (consistently now) among roughly 100,000 athletes. While he takes you into the action, you are motivated by the thought that you too could compete at his level if you just were willing to work hard and get your mental house in order. Unfortunately, reality reminds you that Rich has something very rare that remains incredible from a fitness perspective. You are aware of the power of context in his life — he gives due credit to his friends and family for providing rare and outstanding counsel, love and wisdom.

Out of the roughly 30 books I’ve read this year, I have to say I’ve really enjoyed reading this one the most — both my wife and I read it in about a day as we fought for the book. Most modern biography seems to make the subject more inaccessible as details of their life unfold. Here, Rich has done the opposite, by the end of the book you know that you would be instantly comfortable around him and are inspired to make your life look a little more like his.

By 0 Comments

Review: The Unwinding by George Packer

CS Lewis said we read to know that we are not alone. I’ve always read to find out how the world works primarily so that when I’m with others, I can clarify the world’s interactions. This is probably because I know that you have to understand a system to succeed inside and, as a parent of four children, I’m also committed to making the future as good as possible for them, in addition to loving my Creator and wanting to impact and preserve the world for Him. In short, I’m more motivated than lonely, though I am a little of both at different times. Whatever the reason, I’ve got a deep fascination with finding out how the world works and building an accurate philosophy of history. This book seemed to fit that bill and it does deliver the author’s opinion, cynical and misguided as it may be.

Clearly, George Packer is a well established member of the anti-establishment and that view determines the polarization of his pen as he sketches a series of lives and their experiences with what he terms the unwinding. He defines the unwinding as the change in American society present in the last 40 years as we have transitioned from a manufacturing-based and more localized economy to our present state. The author describes this world for us as a place where the institutions of government have failed us because they have been taken over by special interests and the only guardians of hope are the iconoclast organizers, journalists and activists determined to fight the system. However, any time these activists get to work, they better not get big because they risk becoming part of the establishment, which creates a strange tension for me: while you can’t trust any private institution to act responsibly, he seems to have a blind trust in the government to regulate and level the playing field. Through a set of engaging and short biographical vignettes, he builds the case for increased regulation to protect the public from our failed institutions. He puts a name and a history on what otherwise might be another name who loses their home. He portrays hapless families used by the big banks to take away their home, and to be content there, but to take away their dignity, their health and even their sanity in an insatiable act of greed. His message is clear — a disease has taken over our country and it is in general the establishment and in particular republican party (wholly owned by big business) and the democrats of the permanent political class. But isn’t he missing something here? Aren’t we all culpable when it comes to greed? I know it is obvious, but I can’t escape the fact that no one was forced to sign any of the mortgage papers that provided the legal justification to reclaim their homes after they repeatedly failed to make payments.

While he exalts the value of the individual against the institution, even his heroes come off a bit weak. Dean Price, Tammy and Peter Theil all get their platform while some are put before us for outright scorn or tabloid entertainment: Breitbart, Gingrich, and Oprah. Yes, all the biographies are interesting, but besides their entertainment value many failed to fall into the larger narrative in any meaningful way.

Despite my overall disagreement with his diagnosis, I greatly enjoyed this read and recommend it to my friends. He also exposes you to inside the system and does give some very interesting perspectives. The way he tells it in biographical sketches made the book very compelling and did teach me a lot about the world and the way he set up his framework forced me to ask some very interesting questions related to how I think the world fits together.

In the end, was left motivated by the book to do something. Not just motivated to be part of the solution, but I was committed to not be at the mercy of legal and banking systems. Most of all I want to be full in my humanity. I want to be an individual empowered by the ability to have freedom of action and freedom to be and I want to be part of the world that empowers individuals to do the same.

By 0 Comments

Build 3d Model of Yard

I have always believed in compensating for my lack of experience through leveraging my modeling background. With the right tools, I can hone my intuition and help my lack of experience through careful planning. I also need tools to communicate to my family, friends and any contractors my exact plans. In the past I had built small 3d sections of my yard through setting up a laser level on a high point and breaking my yard into a grid and carefully measuring with a level. The results were a 3d point cloud that I wrangled into (formerly) Google SketchUp.

My latest plans call for a shed and potentially a kitchen and house expansion. This requires a full 3d model of my entire yard and I don’t have anything close to the time required to build separate grids and compile them into a patchwork. Additionally, a key principle of mine is to match the fidelity required and all I needed was a rough sandbox for my yard — for the purposes of design only. This means I could be up to 5-10 off in elevation and still get what I want.

Two years ago, I purchased the GIS data for Alexandria, and through Matlab mapping toolbox I was able to pull up the following contours of my yard.

Image

I couldn’t think of any immediate way to get these lines into dxf or some vector format readable by SketchUp, but I was able to retrace the lines easily enough (2 hours of work, but I wanted clean splines anyway) when I combined the 2′ contour data with the following survey of my house.

Image

The problem was that it produced a terrible approximation that didn’t look like my yard. I ended up trying to approximate the yard through some basic shapes, but I ended up with this mess.

first try of 3d yard

The next try was an attempt to get the fidelity right and rely on intuition. I took a hose out and tried to keep it flat. I learned that the city plot was a lot more accurate than I originally thought. Oh well, but now I had a better model to work with. I used Autodesk Sketch on the ipad and made up the contours with my finger. Than I scanned them into visio to get some good splines.

Here is the result:

contours

landscape_update_1

With some rough pulling, I have something much closer to what I’m expecting:

landscape_update_3

 

All together this gave me exactly what I wanted, a solid 3d model that enabled me to play with my yard and start planning my shed.

3d view

3d view 2

 

By 0 Comments

Defense Acquisition Certification

Here is a post that I hope is helpful to others out there who can be paralyzed from taking action to getting professional acquisition certifications. What is the official name and background of this program? The official name is the Acquisition Professional Development Program. The Acquisition Professional Development Program (APDP) promotes the development and sustainment of a professional acquisition workforce in the Air Force. It is DoD wide. You need it because certain jobs will require you to have it. Good acquisition organizations take this seriously, because it is an easy way to weed folks out from future jobs.

Where are the best places for information? Here are the links I found useful:

  • AF acquisition careers You can find an overview of the program and the useful sites here.
  • What are the requirements for each level?Follow the guidelines for your discipline here: dap.dau.mil.
  • How do I know what level I am? Go to Acquisition Career Management System but you might need to go to (afpc secure ) first. The purpose is to go to My Civilian APDP Record and
  • Where do I sign up for courses?here
  • What is the continuous learning requirement? 80 points over two years.

What is the road ahead for me? I have a level 3 certification due date of 2014-06-03. My acquistion position is “ACQUISITION POSITION NOTCRITICAL OR DEVELOPMENTAL” and my position title is that I am a “GENERAL ENGINEER”.

What classes have I completed? 2013-11-05 SYS 101 GRADUATED 2012-08-24 CON 115 GRADUATED 2012-07-25 PMT 251 GRADUATED 2012-06-28 SAM 101 GRADUATED 2003-08-01 TST 101 GRADUATED 2003-04-18 ACQ 201B GRADUATED 2003-02-21 ACQ 201A GRADUATED 2001-12-28 ACQ 101 GRADUATED Latest continuous learning points are from: 2012-08-24 34.0 CON 115. How can I get more continous learning points? (It looks like there is a whole web site on this. I’m going to focus on getting the courses done for L2 SPRDE-SYSTEMS ENGINEER, and hope that gets me more than enough CL points.)

Continuous Learning Status My status is “CURRENT”. My last suspense was 2012-07-25 (for what?) POINTS TO DATE: 34 (what does this mean?) SUSPENSE: 2014-07-25 (this requires attention — what does that mean)

Current plan? I need to take the following: * Log 103 * Sys 101 (just as a pre-req) * Sys 202 * Sys 203 * CLE 003

Welcome TIMOTHY - here is a summary of your progress toward earning 80 Continuous Learning points (CLPs) every 24 months:

The Personnel System shows that you are in an Acquisition Coded position, and you are required to earn 80 CL points within 24 months.

 Currently, your CL suspense date is:     7/25/2014
ACQNow CL points earned this period:     34
Points needed:                                    46

 If you do not have any upcoming CL events scheduled, you might consider the following methods of earning points to help you meet the goal:
- a DAU Web based course (click here)
- a DAU Continuous Learning Module (click here)
- an AFIT Module (click here)

What/where is a list of different types of certification levels you can get?

  • Contracting
  • Systems Engineering
  • Financial Management
  • Program Management
  • Information Technology
  • Logistics
  • Scientific Research and Development
  • Test and Evaluation
  • Production, Manufacturing & Quality Assurance

So I need to get certified in Systems Engineering

Level 1 (Done)

  • Acq 101 (done)
  • Sys 101 (done)
  • CLE 001
  • CLM 017

Level 2

  • ACQ 201 A/B (done)
  • LOG 103 (20 CLP) (working now)
  • SYS 202 (9 CLP) (done)
  • SYS 203 (36 CLP)
  • CLE 003

  • 2 Year Experience, BS

Level 3

  • SYS 302
  • CLE 012
  • CLE 068
  • CLL 008

  • 4 year experience

By 0 Comments

Find corrupted images

So I deleted all my pictures, and I restored them which resulted in a bunch of corrupted images; thousands of corrupted images. To fix this, I wrote the following script in MATLAB using the image processing toolbox:

// insert blog here

Using matlab I tried to determine what a corrupted image is. First when using the image processing toolbox to open an image, I noticed:

g = imread(s);
Warning: JPEG library error (8 bit), "Corrupt JPEG data: premature end of data segment"."
Warning: JPEG library error (8 bit), "Invalid JPEG file structure: two SOI markers"."

Also, a histogram of such a file looked liked this:

histogram

So, the only challenge is to find the spike, or simply a crazy high percent of 128, the mean value. Simple enough.

cd('/media/95543211-fd8f-4fc9-9b24-3a787113e4c2/+JPEG');
jpegs = dir('.');

num_files = 100;

file_count = length(jpegs);

G = zeros(1,num_files-2);

for i = 3:(num_files+2)
    name = jpegs(i).name;
    disp(['working: ' name]);
    if true
        try
         I = rgb2gray(imread(name));
         [w, l] = size(I);
         gray_percent = sum(sum(I==128))/(w*l);
         G(i-2) = gray_percent;
         if gray_percent > 0.07
           disp(['moving . . . ' name]);
           movefile(name, ['too_much_gray/' name]);
         else
           disp(['good: ' name]);
           movefile(name, ['noerr/' name]);
         end
        catch
         disp(['bad: ' name]);
        end

    end
end

Then a script to see which images might be corrupt:

And a ruby script to move the results (yeah — really inefficient, I know).

So files that might crash matlab are at least removed.

#!/bin/bash

for f in *
do
  # echo "Processing $f file..."
  # take action on each file. $f store current file name
  if ! identify "$f" &> /dev/null; then
     echo "$f"
  fi
done

and (yes, this is silly)

#!/home/bonhoeffer/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
filez = <<EOF
__003999
__026328
__029322
__032335
__035823
__035842
__036090
__038688
__039670
__048554
__048561
__048634
19991215_22_43_43_033877
19991215_22_43_43_034820
19991215_22_43_43_049844
19991215_22_43_56_038011
19991215_22_44_16_010202
20070729_14_42_57_048540
EOF

puts filez.split(' ').size

filez.split(' ').each do |f|
	puts "mv #{f} matlab_bad/#{f}"
	`mv #{f} matlab_bad/#{f}`
end

By 0 Comments

IMA equations

Here are some of the questions I had when starting as an IMA.

How do you schedule IDTs?

You have to be on a .mil domain or else you need to use arrows-r.

utaps

Who pays?

IDTs and the 2-week annual tour are centrally funded.

What are my work requirements?

I am cat A with 48 paid IDTs and 2 week tour is required and my R/R Date is Aug-4.

This is a nice briefing AFD-120503-056.pdf.

What is the R/R date?

12 consecutive months in which an active Guard or Reserve member is required to earn a minimum of 50 points (including membership) for a satisfactory year of federal service.

This defines a “good year”.

key reference: http://www.e-publishing.af.mil/shared/media/epubs/AFI%2036-2254V1.pdf

What is form 40A?

How do OPRs work? Where do you find them?

In work.

-At the end of each training day, write bullet statements on the back of your orders or 40A describing your accomplishments. Provide your supervisor with a copy for your record. This will become input for the OPR/EPR.

-Accomplishments in your civilian profession may be used for an OPR, IF they are pertinent to military skills and leadership

Who do you ask for help and what will you get from them?

Ask the BIMMA or the senior reservist

How much civilian leave do you get?

15 days

By 0 Comments

Import Access Data into Excel (via VB and ADO)

I had a lot of data in MySql in a rails application, but I moved to Mongo on a new application and wanted to give the client a nice archive of excel files for each client. It has been a long time since I’ve worked with visual basic, but it came back quickly.

I was amazed how clunky the interface and I wrote some pretty redundant code, but this was my Saturday and I tried to get this out the door quickly. My basic workflow was to load an office trial version on a virtual machine, then install SQL server on windows and set up an ODBC connection string which I used to import all data into access. In access, I just wrote a bunch of sql strings and used access to automate excel via VBA.

https://gist.github.com/tbbooher/2386826

By 0 Comments

Your key with fingerprint … is not authorized to access heroku with Ubuntu

This error was pretty hard to solve. I emailed heroku support and they recommended:

“https://github.com/ddollar/heroku-accounts”:https://github.com/ddollar/heroku-accounts

bq. For git commands to work git needs to use the ssh key associated with that account. It’s probably choosing a key associated with a different account which is causing these permissions errors. You can use a ~/.ssh/config file to specify which key should be used. Check out this client plugin written by one of our engineers. It helps manage both Heroku credentials and ssh keys for easy switching between accounts. https://github.com/ddollar/heroku-accounts Please let me know if you have more questions.

Their comment did make my future work with multiple accounts easier — it didn’t solve my problem which was that my old fingerprint was still active, and causing trouble.

The solution for me was not to create and provide a new key to heroku. It was to go to the gnome passwords and keys folder and manually delete “My Personal Keys”.

See this comment from “launchpad”:https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/505278 for details.

bq. The culprit is gpg-keyring-daemon. It subverts the normal operation of ssh-agent, mostly just so that it can pop up a pretty box into which you can type the passphrase for an encrypted ssh key. And it paws through your .ssh directory, and automatically adds any keys it finds to your agent. And it won’t let you delete those keys. How do we hate this? Let’s not count the ways — life’s too short.

bq. The failure is compounded because newer ssh clients automatically try all the keys in your ssh-agent when connecting to a host. If there are too many, the server will reject the connection. And since gnome-keyring-daemon has decided for itself how many keys you want your ssh-agent to have, and has autoloaded them, AND WON’T LET YOU DELETE THEM, you’re toast.

bq. What you really want to do is to turn off gpg-keyring-daemon altogether. Go to System –> Preferences –> Startup Applications, and unselect the “SSH Key Agent (Gnome Keyring SSH Agent)” box — you’ll need to scroll down to find it.

bq. You’ll still get an ssh-agent, only now it will behave sanely: no keys autoloaded, you run ssh-add to add them, and if you want to delete keys, you can. Imagine that.

By 0 Comments

Radar parameter estimation

[mathjax]

Here we tackle what a Radar needs to accurately measure a target’s position, size and motion. (This is nothing new, just a placeholder for some of my notes.)

First of all, everything depends on $SNR$, and the parameter estimation happens in the main computer of a Radar. The theoretical rms error of a measurement is of the form:

<br /> \delta M = \frac{k M}{\sqrt{SNR}}<br />

where \(k\) is a constant between 0.5 and 1.

h3. Range

First, let’s tackle range. They key metric for range is bandwidth, the higher the bandwidth the better the resolution.

Estimation of the range of a target is based upon using A/D sampled measurements of the round trip time to and the target

<br /> R = \frac{c T_R}{2}<br />

For time delay measurements , such as range, the value of the constant depends on the shape of the radar pulse’s spectrum and the pulse’s rise time and for a rectangular pulse, whose width is, (T):

<br /> \delta T = \frac{T}{2 \sqrt{SNR}}<br />

or equivalently,

<br /> \delta R = \frac{c T}{2 \sqrt{SNR}}<br />

However, pulses always move in trains or if $T_D$ is the dwell time:

<br /> \delta R = \frac{c , T}{2, \sqrt{SNR\, \text{PRF} \, T_D}}<br />

from Barton and Ward.

So Range depends on \(SNR\), pulse shape and width, effective bandwidth, number of pulses that can be coherently integrated.

This is explained well by a diagram in the lincoln presentation:

h3. Angle

Now, let’s tackle angle. Angle accuracy depends on antenna size. Simple detection provides coarse location in angle by isolating a target’s location within beamwidth of antenna (and beamwidth is just \(\lambda / D \), where \(D\) is the aperture diameter and \(\lambda \) is the wavelength. But this is very coarse, 1° beam at 100 km extends across 1,745 meters. In order to provide more accurate angle estimation, you have to measure at different beam positions to improve accuracy. You can do this through sequential lobing, conical scan tracking, or monopulse angle estimation.

h4. Conical Scanning

Conical scanning is a technique to keep the beam pointed at the target to improve angle accuracy. It is based on the principle that the radar receiver will get maximum returned signal strength when the target is in the beam centre, so if the beam is pointed directly at the target, when the target moves it will move out of the beam center and the received signal strength will fall. Circuitry designed to monitor any fall off in received signal strength controls a servo motor that steers the aerial to follow the target motion.

Wikipedia has a nice drawing that explains this technique:

!https://upload.wikimedia.org/wikipedia/commons/3/32/Conical_scan.jpg!

h4. Sequential lobing

While conical scan tracking uses the phase of modulation to get the angle error and amplitude modulation to get the beam displacement, sequential lobing uses two slightly separated antenna elements to send the beam slightly to either side of the midline of the antenna, switching between the two to find which one gave the stronger return, thereby indicating which direction the antenna should be moved in order to point directly at the target.

Here, wikipedia provides another good diagram:

!https://upload.wikimedia.org/wikipedia/commons/b/b6/Monopulseprinzip2.gif!

h4. Monopulse

Monopulse radars are similar in general construction to conical scanning systems, but add one more feature. Instead of broadcasting the signal out of the antenna “as is”, they split the beam into parts and then send the two signals out of the antenna in slightly different directions. When the reflected signals are received they are amplified separately and compared to each other, indicating which direction has a stronger return, and thus the general direction of the target relative to the boresight. While monopulse, requires a separate receiver for each channel, it improves performance over conical scan and sequential lobing whose performance degrade with time varying radar returns.

All angle errors are summed up well by the following:

and

SNR, type of measurement technique, antenna illumination distribution, antenna size, and frequency.

h3. Doppler

Lastly, let’s look at Doppler accuracy. Doppler accuracy depends on coherent integration time \(\Delta t \):

Doppler frequency is calculated as:

<br /> f_d = \frac{2 v_r}{\lambda}<br />

To accurately measure Doppler, use two closely spaced frequency filters offset from the center frequency of the Doppler filter containing the detection

<br /> \text{Doppler measurement accuracy} \propto \frac{\lambda}{\Delta t} \frac{1}{\sqrt{SNR}}<br />

Doppler accuracy depends on SNR, pulse shape, integration time.

h3. Real world limitations

h4. Receiver noise

# Adds variance to estimates

h4. Radar calibration

# Poor calibration leads to poor estimation

h4. Amplitude fluctuations

# Small effect on monopulse and array solutions

h4. Angle noise (angle scintillations, or target glint)

# Complex target return biases angle estimate

h4. Multipath (low angle tracking)

# Reflection off earth’s surface combines with direct path return

# Can cause biases in angle estimates for all technique

h4. Good References

“Parameter Estimation”:http://www.ll.mit.edu/workshops/education/videocourses/introradar/lecture9/lecture.pdf

“Basic Fundamentals”:http://faculty.nps.edu/jenn/Seminars/RadarFundamentals.pdf

“Parameter Estimation and Tracking”:http://aess.cs.unh.edu/Radar%202010%20PDFs/Radar%202009%20A_15%20Parameter%20Estimation%20and%20Tracking%20Part%201.pdf

By 0 Comments