My Stand Up Desk Adventure

June 23rd, 2009

I am an active guy. One of those NCAA athletes that went pro in something other than sports. But after years and years of volleyball, my body has taken a beating. My back and knees in particular. So naturally, after I graduated and started working, sitting in front of a computer all day, my workout regime decreased dramatically in intensity. After about six months, I noticed an increase in lower back pain. I am not unfamiliar with lower back pain, but the pain was more intense than during college. I would rest, stretch, ice, rehab, and it would heal. Than it would happen again. Always after a hard workout or cleaning all day. But it would always go away after about a week.

After I moved out to Southern California, I started playing in some adult volleyball leagues. Three times a week. Warming up, optional. And thus I got lazy, my technique waned, and became prone to injury. The mix of playing without warming up or stretching and then sitting down for several hours the next day caused my muscles to tighten up. One day I woke up crooked. Leaning to the right. And like an idiot, I did not stop playing volleyball. I just figured it would heal like normal and I could push through it. But this time it just got worse. Rehab didn’t help anymore. I started to suspect a herniated disc. I went to a chiropractor, who suspected the same. Yep, the MRI confirmed it. L2 and L3 herniated disc with all the other lumbar discs also protruding. No surgery required to heal, thankfully. Just rest, rehab, NO VOLLEYBALL.

This really got me thinking about the ergonomics of my workspace. USC has a whole department devoted to it. I called them up for an ergonomic evaluation of my work area. Result: desk is too low, chair too small, not enough leg room, monitors too close, poor lighting, etc. Anyone over six feet and 200 pounds can relate to everything being too small. The ergonomics guy told me he uses a stand up desk and loves it. Sweet! That’s the only position that is pain free for me! Oh, they are over a grand? Grrr!

Searching the interwebs for stand up desks revealed not much under a thousand dollars. There were super sweet ones that go up and down with a push of a button, some with air compressors, or cranks. But I would be satisfied with just a desk that was 49 inches high. I’ll commit to standing all day. I did find lots of helpful DIY standing desks from Lifehacker which gave me some confidence in creating my own. Which is find for at home, but for work: you gotta go through all the proper channels, penetrate the bureaucracy, and wait.

I think I found a solution though. A single purchase, inexpensive desk that can be used as a standing desk or one of those old fashion sit-in-a-chair desks. It’s from IKEA: FREDRIK Computer Work station. Metal frame with notches every two or three inches to move the surfaces up and down. There is also a smaller one, 38 inches vs. 50 inches wide ( I just bought the smaller on for a standing workbench at home). I will post back with the result of if my work will spring for the new desk to replace my current setup as well as how my home setup works out. I also plan on making some wood boxes to put under my current desk (which is only 31 inches high, so the box needs to be 49 – 31 = 18 inches). I’ll use the new workbench to make those!

My Homebuilt HeNe Laser Lamp

June 20th, 2009

When I was in middle school, I read all about Light Amplification by Stimulated Emissions of Radiation (lasers). I saved up almost $100 for a crappy laser pointer (now they are practically giveaways). One book, the Laser Cookbook, was all about projects you could do with lasers. One, which every middle-schooler would love, is making a laser gun (a harmless one, but cool nonetheless). But it required a Helium Neon laser tube, and some fancy circuitry for a power supply and a big-ole hip holstered battery pack. But after spending all my lawn mowing money on that crappy laser pointer I couldn’t afford to build the laser gun. Thus the interest slowly faded away…

Many years later, I found a Desktop Helium Neon Laser Lamp Build tutorial on Hack N Mod, and BAM! I got so excited! I new where to get most of the parts, but not the laser. After searching the webs, I found Meredith Instruments which had good information and the parts I needed. But the everything there new, and more money than I wanted to spend. Searching the internets some more, I kept seeings “Sam’s Laser FAQ.” So I read that to learn how to actually put a laser and power supply together. Then I found his HeNe Laser Kit 2 and saw the price! It was just what I needed, and it had those brackets I could not find anywhere.

So I bought one of those kits, went to Hastings Plastics Co. and got my acrylic mirror sheets cut so I could mount the laser. I also got acyclic solvent from them to glue the pieces together. I lined up the laser on the acrylic and drilled some holes to mount the brackets. Glued the pieces together. Soldered the switch to the power supply. Connected the project box base to the mirrored stand. Done.

I made a complete parts list of all the parts I used and where I got them. I pretty much copied the Hank N Mod tutorial. Though my wall power adapter came already connected to the power supply. Finally, here is the pic of my HeNe Laser Lamp:

HeNe Laser Lamp

Now where the heck do I put it?

AIR/Flex URLRequest: Sending Authentication Headers

June 17th, 2009

If the request requires authentication and URLRequest.authenticate is set to true (the default) the operating systems login window will popup asking for credentials. These will be automatically sent in the request. To manually set the username and password there are a few ways:

URL Request Defaults:

URLRequestDefaults.setLoginCredentialsForHost("www.domain.com",username,password);

Headers:

var encAuth:Base64Encoder = new Base64Encoder();
encAuth.encode(username+":"+password);
var header:URLRequestHeader = new URLRequestHeader("Authorization","Basic "+ encAuth.toString() );
var request:URLRequest = new URLRequest(url);
request.requestHeaders.push(header);

Under both ways, once a successful login occurs the credentials are remembered while the application is open and the user is not asked for username and password again.

Tamiya Bull Dozer Kit

June 9th, 2009

So a friend sent me a link to a NY Time article about working with your hands and how sweet it is. And I totally agree.  Growing up I used to build model cars, planes, robots, X-Wings, TIE fighter’s, etc.  Lego’s too.  We had nice garage full of tools, and I would play back there.  During college I managed to rewire a 1966 Ford Mustang.  Got it running.  That was so awesome.

After I got my engineering degree, I got a job and sit in front of a computer and program all day.  Its almost, but not quite, entirely unlike working with your hands.  You type out code with your hands to create a virtual machine.  I miss making real machines.  Though, after I make the models or robot kits, I never did anything with it.  Usually just threw it away, because the process of putting real physical objects together to form another physical object was the most fun.  So over the weekend I went to Fry’s and got a Tamiya Bull Dozer kit.  Its a very easy, basic kit.  There is a wired remote control that sends power to three little motors. Moves the arm up and down and the tracks forward or backward.  Here’s a little video of it in action for my Pop.

Get the Flash Player to see this player.

Mac OS X Leopard and Windows XP File Sharing

June 6th, 2009

I have a Windows XP Media Center 2005 computer, a MacBook Pro and a few other Windows and Mac computers stroll through my network from time to time. I have my Media Center PC streaming media to the XBOX 360, file server, printer etc. I had the Media Center machine before the MacBook Pro. So when I got my MacBook Pro, and hooked it into my network I was suprised that all my file shares were automatically picked up and I could read my movies and print, all as a Guest. Which is exactly how I wanted it. Login to change, but anyone can view a movie, listen to music, and print.

Then the Media Center PC mother board failed! So I got a new AMD Athlon 64 LE (45w cool-and-quiet, and yeah, it runs very cool and very quiet) and reinstalled. I setup my shares again, but this time I turned OFF simple file sharing.

I go to my MBP and connect to the MC PC. I try as guest. But I got this message:

“The file server does not allow Guest access.”

Huh? So I enable the guest account, which I do not remember having to enable before. Reboot. Try to connect again. Same error message: “The file server does not allow Guest access.” WTF?! And the other Windows machine (Windows Vista) could not print without loging in. Gah!

So I googled around, played with my Mac samba settings. Deleted my networking settings on my Mac. Tripple checked my shared settings on my PC. So I went back to the basics. Reading one Microsoft KB how to setup Windows XP file sharing. There it was, simple file sharing. A light bulb came on. So I re-enabled simple file sharing (My Computer->Tools->Folder Options…->View->Advanced settings:->User simple file sharing (Recommended)).

And it all worked!  Reading my media shares, printing as guest! Even from the Vista machine! I know there is some security risks leaving it so open, but I keep my private data separate.

Yosemite – El Capitan Swinging Climber

May 24th, 2009

Just got back from Yosemite, and took some pictures of climbers headed up El Capitan. It has a 10 second intro, with a red circle showing how high the swinging climber is. After the intro is a zoomed sequence of 10 pictures showing the climber swinging across the face of the mountain trying to grab a ledge. The climber did make it after at least 1 hour of swinging. Click the link for the video.

El Cap Swinging Climber

Or if you prefer, the image sequence.

BreakTimer v2.0 – Update

May 13th, 2009

I made some major updates to BreakTimer. It now minimizes to the dock/system tray, with a nice icon that counts down. Also has icon menu options so BreakTimer can be started, or stopped from the dock/system tray, and well as toggle the repeat. O, I added a stop feature so you can stop the timer rather than close the application. I don’t see a point in pause, since if you pause it, you are most likely taking a break so just restart it.

Also fixed a few bugs with the break window not grabbing focus and moving to the front on a Mac. Also a little instruction slides down to let you know Escape closes the break window. Hope you enjoy!

Download: breaktimer-v2.0.air

Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.

BreakTimer – an AIR app to remind you to take a break from the computer

May 4th, 2009

My current career path has me sittign on my ass infront of a computer for most of the daylight hours. I have back issues, and sometimes I get too involved in my work and forget to move.  Combine that with years of volleyball and tight muscles I got a herniated disc.  So I made a simple AIR application that will block out the screen and tell you to take a break after a proscribed period of time (30 minutes).  This can be set from 0 to 180 minutes (no person should be sitting for 180 minutes straight though!).  If you have multiple monitores it will block all your monitors.

The source is there for you to tweak, right click on the app and view source.

Google App Engine and dynamic Django Forms

January 28th, 2009

Let me define dynamic form: a form that can have 0 to x number of entries for a field. For example a form that contains a list of items, like a grocery list. Its part of the same form but can have more than one entry. In PHP, they can be grouped by appending “[]” to their name attribute, and PHP stores them the $_POST variable as array (i.e. $_POST['list'][0]). I am working a project using Google App Engine, which uses Django forms, and I needed a dynamic form (list).  I found this can be done using the get_all() function of the self.request object (i.e. self.request.get_all(’list’)) will return a list object.

Cool! But how do I use that with the Django form model with this list?  Make a list of form models. Loop through the posted list, create a form object with that data, append it to the form list, check if its valid and repeat.  If there was an error, just send the form list to the template, and loop through the forms displaying them with error messages. Else, the entire form is valid, save it to the data object.  Here is some code:

#main.py

import wsgiref.handlers
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.db import djangoforms

class Groceries(db.Model):
	quantity = db.IntegerProperty()
	name = db.StringProperty(required=True)

class GroceryForm(djangoforms.ModelForm):
	class Meta:
		model = Groceries

class MainHandler(webapp.RequestHandler):
	def get(self):
		groceryform = GroceryForm()
		values = {'groceriesformlist': [groceryform]}
		self.response.out.write(template.render('main.html',values))
	def post(self):
		postedQuantities = self.request.get_all('quantity')
		postedNames = self.request.get_all('name')
		groceriesList = []
		allGroceriesValid = True;
		n = 0;
		for i in self.request.get_all('quantity'):
			groc = GroceryForm(data={'quantity':postedQuantities[n],'name':postedNames[n]})
			allIngredientsValid = allIngredientsValid and groc.is_valid()
			groceriesList.append(groc)
			n += 1
		if allGroceriesValid:
			for grocerydata in groceriesList:
				grocery = grocerydata.save(commit=False)
				#do something with data
				grocery.put()
			self.redirect('/')
		else:
			values = {'groceriesformlist': groceriesList}
			self.response.out.write(template.render('main.html',values))
def main():
	application = webapp.WSGIApplication([('/', MainHandler)],debug=True)
	wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
	main()

The commit=False is useful when you do not want to save the data right away, like some other variable manipulation. Then there is the template file. There are numerous ways to output the form, it even has a built in table or paragraph method. If you wanted to just use the default table method to output the form, with errors, simple use <table>{{groceryform}}</table> (the output omits the table declartions, just the rows and columns) and your are done. I like a little more control, so to output the erros: {{ groceryform.quanity.errors }} and then output the input tag: {{groceryform.quantity}. Here is the template file, main.html:

<h3 class="form_headers">Groceries</h3>
<ol id="directions_form">
	{% for groceryform in groceriesformlist %}
		<li>{{ groceryform.quanity.errors }}{{groceryform.quantity}}{{ groceryform.name.errors }}{{groceryform.name}}</li>
	{% endfor %}
</ol>
<input type="button" value="+" id="add_btn" onclick="AddLi(this.previousSibling.previousSibling)" />

You also need to toss in some javascript for adding new grocery items:

function AddDirLi(ol)
{
	var li = ol.firstChild.nextSibling.cloneNode(true);
	ol.appendChild(li);
}

There are many ways to accomplish this, with AJAX or just posting items one at a time. But my project actually had a few sections of this nature and it this method seemed to work the best. I hope that made sense. The next post will cover Using Relationships with the Google App Engine Datastore. Creating and storing multiple grocery lists. The grocery list would be the the parent to many grocery items.