Thursday, May 27, 2010

mongodb command line basics

The best command line references i can find are:

A command line session for me normally starts something like this:
>show dbs
>use test
>show collections

Saturday, May 15, 2010

HTC Hero Mount USB to Mac Os X (macbook pro)

I wanted to get the media off of my htc hero and onto my macbookpro, but plugging the USB cable in does not result in a notification on android which allows me to mount sd card through the USB cable.

I found lots of promising articles, most of which pointed me to either Twisted, which didn't work for me, or to the Android developer SDK. I'm fully capable of using the SDK but this seems like overkill for such a simple issue.

My Solution: Close the lid on the macbook. Plug in the phone and then I get the notification allowing me to mount a USB. Once mounted, its the same as working with any other USB card.

Friday, April 9, 2010

Django Forms: Widgets That Could Use Examples( RadioSelect, SelectDateWidget, CheckboxSelectMultiple)

In trying to use django built-in forms, I stumbled through a few of the built-ins wishing that there had been better documentation.

Here's my attempt to help others looking into using RadioSelect, CheckboxSelectMultiple, or the SelectDateWidget.

These are all excellent features and the more I use Django, the more I like it. Chalk up Forms as another part of django that blows away any other web framework I've worked with.

from django.forms.fields import ChoiceField
from django.forms.fields import MultipleChoiceField
from django.forms.widgets import RadioSelect
from django.forms.widgets import CheckboxSelectMultiple
from django.forms.extras.widgets import SelectDateWidget

YEAR_CHOICES = ('2010','2009')
RADIO_CHOICES = [['1','Radio 1'],['2','Radio 2']]
CHECKBOX_CHOICES = (('1','The first choice'),('2','The Second Choice'))
class SimpleForm(forms.Form):
radio = forms.ChoiceField( widget=RadioSelect(), choices=RADIO_CHOICES)
date = forms.DateField(widget=SelectDateWidget(None,YEAR_CHOICES) )
checkboxes = forms.MultipleChoiceField( required=False,
widget=CheckboxSelectMultiple(), choices=CHECKBOX_CHOICES)

Monday, March 15, 2010

Mechanize vs. Scrape:

In the process of automating functional tests, I have ran across another python library, mechanize, that looks to be very promising. Perhaps, even more so than

So far it seems that the mechanize platform is more powerful, as it is able to handle complex tasks like managing a gmail inbox( see ).

My take so far is that offers some nice features for validating that a given page has the tags and elements I am looking for. I'm still new to both of these libraries so if anyone out there has experience with both and could help nudge me in the right direction, it would be much appreciated.

Sunday, March 14, 2010

Google Apps Mail Accounts: ICanHaz Themes?

I have mail accounts through google apps on a few different domains and it drives me crazy that I cannot customize the theme as I can with gmail. So a simple workaround: use a free gmail account in tandem with any google apps account that you use enough to desire a theme.

Within a free gmail account, it is easy to send all mail through a different account; in this case, send mail from the google apps account. Then on the flip side, forward all mail into the google apps domain into the mailbox of the gmail account. Voila! Use the gmail account with all the power you're used to, and nobody will know....unless they see that logo has changed ;)

Monday, March 8, 2010

Installing the PIL: Mac OS X 10.6 and Python 2.6.4

In short, learn from others:

Install python manually:

Setup PIL w/jpeg support in a virtualenv:

And now you've got a top notch django dev env running py 2.6.4.

Tuesday, March 2, 2010

Al Gore ops in on climate change

An interesting post in the nytimes today from Al Gore continues to paint the doom and gloom scenario for the US if we don't act now to stop man made global warming.

I struggle every time I read any thing that states Carbon Dioxide is a pollutant. If I remember correctly, CO2 is a byproduct of human life.

Personally, I'm tired of the whole global warming debate and I think most people agree with the need to keep the environment clean and work towards energy independence.

Can we stop the doomsday predictions already and take a positive approach to improving our position on these issues?

Monday, March 1, 2010 for functional website testing

This solution is perfect for testing your website's functional capabilities. supports sessions and cookies so hitting your authenticated resources is cake.

Here's a quick sample i wrote to test things out:
from scrape import *
s.follow("Sign in")
x = s.doc.first('form')
params = x.get_params()
print s.doc

Try it out with your google account. To verify you're logged in look for the Sign Out link or alternatively look for a GAUSR cookie in s.cookiejar.

Thanks to Ka-Ping himself for clearing up some of my confusion.

My plan is to use this to test the site as if there were no script/styles enabled. Then to layer on browser behavior ( AJAX etc...), I'll look to Selenium or something of the kind.

Saturday, February 27, 2010

Robbie Hummel Out for Season: Are my Boilers Done?

Purdue vs. Minnesota Highlight

While I love to think that E'Twaun, Jajaun and Keaton are enough to keep the Boilers as one of the most feared teams in the country, the loss of Hummel takes away one of our most consistent players and our best pure shooter.

I hope the team can step up without him, but right now I'm worried that history may be repeating itself. See 2008-2009 season and Robbie's back injury...

Thursday, February 25, 2010

Mac Newbie Tips: Screen Captures

It hasn't been too long since I exclusively started using mac at home and work so I'm still catching on to some of the great little things Apple has thrown in here.

This morning's enlightenment was around capturing screen shots, both full and partial, on my mac. I was reading a blogpost about apps to replace the Snapper add-on I used to use and the author dropped a subtle hint about shift+command+control+4.

With a little search engine power, I found a useful page from apple,

The basics:
Command+Shift+3 = Screenshot Saved To Desktop
Command+Shift+4 = CrossHairs For Snapping To Desktop
Shift+Command+Shift+3 ( or 4) = .... To Clipboard For Pasting to Photoshop/eMails etc...

Monday, February 22, 2010

Anecdotes on India's Healthcare

Both of my children got sick while we were in India this trip so I got a chance to see the healthcare system in India at work. I made the trip to the doctor twice with my daughter.

Encounter 1.
My daughter got a fever on the night train and had stopped eating. The previous day she had a couple instances of diarrhea. I told the doc that i had been alternating doses of motrin and tylenol every 4 hours and that it was keeping the fever under control.

After a brief exam with a stethoscope, I was told to only give the tylenol and to start her on an anti-biotic for her stomach. Total: 80 Rs. Medicine included.

We were extremely concerned that an anti-biotic without any tests might not be the best option, but we took the advice on tylenol only.

Encounter 2.
Next day, daughter is still not eating and still showing some symptoms of fever. This time I had done a throat exam myself and knew there were swollen tonsils with some white cold sores in the back of her mouth. The doc was able to identify the throat problem easily but I wonder if it would have been identified if not for my own inspections.

Medicines were prescribed to help start eating again and help fight the infection. Total: 150 Rs. Medicine not included.

  • Cost of care is very cheap.
  • Quality of care is suspect(anti-biotic prescription w/out any exams).
  • Waiting times were normal.
  • Payment was at time of care in cash.
  • Equipment was lacking
For me, the care i receive in the USA is hands down superior to what we received while in India. However, the cost to receive care in the Indian system is dramatically lower to the USA system.

Sunday, February 21, 2010

Back From India

I've spent the past 2+ weeks in India for a family wedding. My wife's birthplace is in Kerala, India and her sister chose to be married there so we packed the whole family up and travelled halfway across the globe.

While most of our trip was dedicated to visiting the family, we did find a little time to escape to munnar, walk the beach in nager coil, and a do a little shopping at Seemarti.

So here's some of the things i've learned after 2 trips to india:
  1. Get a Driver
    For 1350 Rs./Night, we got a driver and an SUV with 80km included. 10Rs. per additional kilometer and our total expense under $40/day. This is an absolute steal and the additional comfort of a dedicated driver is worth every penny. I'd plan for one of these to pick
  2. Use the AC Night Train
    The roads are terrible. It takes 2-4 times as long to go anywhere by road in India as it does in the USA. If you are planning to go from state to state or any trip over 200km, i advise the night train or a plane. To get tickets on the AC night train, you have to book at least a week in advance, so set your itinerary and book your ride.
  3. Take Packaged Drinks
    If you don't want to get sick, don't drink their drinks. The packaged waters there(Aquafina, Himalaya, and Kingfisher) all checked out with me. The other waters, tap water, milk, juices, sodas, and anything with ice have all given my stomach trouble at one time or another.
    Horizon Organic Milk, Apple Juice, Orange Juice, and Gatorade will all be in my bags next trip. Each piece of checked-in luggage gets 50 lbs, weigh your bags and fill in the additional weight with fluids.
Some other things i've learned about travelling to kerala with an infant and a toddler:
  1. Pack N Plays fit inside a suitcase. We took one for each kid and without them we'd had to have had both kids in our beds or on the floors. Given the general cleanliness being much lower than i'm accustomed to, the floor is not an option.
  2. February is too Hot. Go in november, december, or january.
  3. Combat the barrage of spicy foods with a steady dose of snacks from home. My favorites are trail mix, beef and cheese, granola bars, and cheese crackers.
  4. Try the Fried Fish,, it can be spicy but it's worth it.
I may write some more on some of my favorite spots, where i might go next, and any of my other thousands of opinions after travelling in india again.

Wednesday, January 20, 2010

How To Stop Unwanted Solicitation of your Browsing History

I've known for awhile that the css :visited property on elements can allow me or others to detect whether or not a certain link has been visited by the user on the other end of a browser.

What I didn't realize is that the browsers have already done things to help us out. If you can forego the need for links you've already visited to change color or background, then the safest option is to turn off visited links. What The Internet Knows About You describes both the underlying issue and some of the possible preventative measures. My favorite...
Firefox 3.5 users will be happy to learn that their browser has a configuration option which disables visited links. To enable it, type in about:config in the address bar and set the layout.css.visited_links_enabled option to False.

I'd much rather remember which links i visit, than have to discard my browsing history and lose the awesome bar.

Amazon 2 Day Shipping Free

I was happy to see how easy this worked out on checkout. If you're like me and just want the free 2 day shipping, don't be scared. You can go into your amazon account immediately and choose a setting to end your free trial.

It's easy to sign up for all the free trials, but normally not so easy to quit. So if you're struggling shutting of your new Amazon Prime free trial because you don't want to fork over $79.

You can manage your Amazon Prime settings by going down the lefthand navigation into Amazon Exclusives. Then click the orange manage my membership button in the lower right. Then click the Do Not Upgrade button and turn off auto upgrade.

So now you got some free 2 day shipping even if you're not interested in Amazon Prime. Thanks Amazon :)

Friday, January 15, 2010

Stand Up for your Right to Healthcare Data

Just heard about today.

This organization is trying to help progress our ability to and rights to our data. The healthcare system needs reform and this is the most important step of them all. Give the patients their data for free or minimal cost.

Give us our data.

Thursday, January 14, 2010

Appengine + Django 1.1

So i got past my previous post with a different cell phone number. Now I know getting an appengine account is a more difficult than most online accounts. It makes sense too given free website hosting is at stake.

Anyhow, after a short time i was able to get django 1.1 up and running on appengine. For a little clarity, this provides all the glory of django templates,, middleware, forms, settings. But because of the big table db implementation of appengine, the admin tool, auth, session, and anything else built-in and dependent on django models will not work.

I found some other blogs that were close, but none of the step by steps worked for me. I followed instructions found at goole python libraries - django.

Since i learn best from code, I checked a basic project into github that i'll continue to update on git as i make updates.

Browse the code on git.

Best Chocolate Chip Cookies

Back before Christmas, i made some chocolate chip cookies off that used pudding as an ingreadient. They were unbelievable! Don't be scared by the pudding. The texture of these cookies was fantastic and they kept their moist deliciousness for two weeks.

You're probably wondering...if they're so good, why did it take two weeks to eat them? Well, my wife gave up sweets to prepare for christmas, so i saved her a few cookies. Nothing special to keep them, two weeks in a cookie jar and dropped them in a gift bag.

Enough's the recipe - Award Winning Soft Chocolate Chip Cookies

I went for chocolate pudding and a little extra vanilla. Eat up!

Sunday, January 10, 2010

HTC Hero Review

I've had the HTC Hero from Sprint for about a month now and i've had enough time to digest all the features.

1. Extremely well integrated with twitter, facebook, and flickr.
2. Very flexible customization with seven pages of personalized layout
3. No keyboard means lightweight and small (I've no problems using the touchscreen keyboard)
4. Phone, especially Speaker Phone, work better than my old LG phone.

1. Shaky software. i.e. Alarm Clock crashes instead of alarming and calendar app crashes.
2. Advanced Task Killer App is needed to control usage and save battery life ( couldn't android have a built in way to kill apps?)

All in all, I love this phone. My wife has the samsung moment and my preference is definitely for the hero over the moment.

Wednesday, January 6, 2010

Appengine Disappoints

So i got excited a couple weeks ago about appengine and how easy it could make hosting a simple domain. And i am still excited....but there are some major usability issues with the way they allow you to sign up for appengine accounts.

First thing they require is that you verify via SMS. Okay no problem. right. Unless you're me, then apparently they can't send a message to my sprint phone. Then the form confuses me by making it look like i submitted a different carrier (SouthernLink Wireless) making me try multiple times.

Then i do some web searches to find that not only are other people struggling with the same issue, but their security only allows one account to one phone. Therefore if you play around with appengine using your gmail account, you're screwed if you buy a domain name, sign up for google apps, and then want to host a site with appengine.

This is an embarrassment to google. A company who i was a real fanboy of until recently( see eric schmidt on privacy to learn when i dropped my fanboy stance).

PhoneGap Initial Thoughts

Phonegap a big success. I tried out phonegap for android this morning. Those guys at nitobi have done a great thing for web devs wanting to write mobile apps.

Check them out on Twitter @phonegap