Vinod Kurup

Hospitalist/programmer in search of the meaning of life

Nov 4, 2010 - 2 minute read - Comments - writing motivation

Advice on writing

I just found this great article on writing by Sebastian Marshall. His basic advice boils down to “just do it!”, but he makes some interesting points along the way. I had never heard of the Equal-Odds rule. Read more details at his blog, but basically, in order to do great work, you have to do a lot of “not-great” work. No one just does great work. So, let go and just write. The great stuff will float to the top.

Commit to doing it every day, no matter what. I don’t know how many times I’ve heard this, yet I still don’t do it. I guess it’s like I tell my smokers who tell me they’ve tried to quit so many times. Each quit attempt is preparation for the time that you really quit. You never know when it’s going to stick, so just keep trying.

I accepted that I’m going to be judged. I don’t love it, but I accepted it.” This is the hardest part for me. My ego is fragile, but oh well. The benefits are worth the risks.

Try to think of each visitor as an honored guest.” I like that. My site gets minimal traffic, but that’s not zero. And I actually know some of the people that read … don’t worry, I won’t embarrass them by naming names. The bottom line is that my whole purpose is to improve the lives of others, in whatever small way possible. To think that anyone is spending their precious time reading this is an honor to me.

I may never be the prolific writer that I envision myself being, but it can’t hurt to keep trying.

Nov 3, 2010 - 2 minute read - Comments - news

A sad day for this Wisconsinite

Russ Feingold lost his U.S. Senate race. I haven’t been following Wisconsin politics since I left 14 years ago, but this makes me sad. The last time that I really cared about the U.S. political landscape was 1992. I was 21 and in college at the University of Wisconsin and was voting for the first time. Bill Clinton was generating excitement, especially on college campuses, but I was more interested in Russ Feingold’s campaign. He was a no-name state senator, running against incumbent Bob Kasten. He seemed honest, funny and down-to-earth. He painted his campaign promises on his garage door so that everyone would be able to hold him to them. I remember people saying that if he won, he’d change. The amazing thing is that he didn’t. In 3 terms in the Senate, he has continued to stay humble, while also crossing the aisle at times and voting against popular, but misguided policies like the Patriot Act.

After the 1992 election, I remember thinking that real change was coming. I know that the main reason that I was so excited in 1992 was because it was my first time being a part of the political process. Of course, as we all know, not much ever changes in U.S. politics. I’ve come to realize and accept that. Russ Feingold was an exception and seeing him lose, despite having lived up to his high standards, makes me sad.

Sep 16, 2010 - 1 minute read - Comments - video linux

Rotating videos

I found out how to rotate video today. I often take video with my Canon SD870, but I mistakenly take it in portrait mode. I don’t realize this until I’m editing the video and then I have to decide if I want to subject my adoring youtube fans to the torture of having to turn their heads sideways to see how cute Kavi and Anika are.

I found this link which gives the mencoder command to rotate the video. Unfortunately, it didn’t work with the AVI files that my Canon SD870 create. I think this camera creates slightly corrupt AVI files. I say “slightly” because they’re still viewable, but mplayer always reports the total time as “0:00”, even while the elapsed time marches along correctly. Well, today, I found a way to fix the AVI files.

mencoder -ovc copy -oac copy input.avi -o output.avi

This just creates a new AVI, copying the video and audio from the original. Now, mplayer reports the correct total time. Then, to rotate the video:

mencoder -ovc lavc -lavcopts vcodec=mjpeg -vf rotate=1 \
         -oac copy output.avi -o rotated.avi

And here’s your reward for reading along:

Aug 25, 2010 - 2 minute read - Comments - html programming web book-review

HTML5 Up and Running

I preordered Mark Pilgrim’s HTML5, Up and Running from Amazon back in March. It’s available for free as Dive into HTML5. I’ve been a fan of Mark’s writing for a while, so buying the book was a way to thank him “with a buck”. Interestingly, the online book and paper book are not identical. For starters, the titles are different. In addition, the beautiful fonts and cutesy images of the online version are gone. The paper book is your run-of-the-mill O’Reilly book. I’m not sure if it’ll make much of a difference in my enjoyment, but we’ll see.

As I said, I preordered the book in March, so I had no idea when it would be finished and delivered. It showed up on my doorstep this morning, on my birthday! We’re on our way to NYC tomorrow for our first trip back there since we moved to North Carolina in 2007, so I know have some light pleasure reading. Perfect Timing!

I’ve only read the first chapter so far, but I think I’m going to love it. I’ve done a lot of web programming in my life, but only maintain my own sites now. I’m reading this book like a programmer might read a book on astronomy… purely for the love of it. The first chapter goes into the details of how the IMG tag was invented. Marc Andreessen mentioned it on a mailing list back in 1993, and after some back and forth, shipped it in Mosaic, an early browser. Because it shipped and because it was popular, it got included in the HTML standards.

I still remember when Mosaic came out. I got my first email address in 1992 (vkurup@macc.wisc.edu) and somehow was on a mailing list announcing the impending release of Mosaic. I remember the text of the email basically saying that “This will change the world.” Once I saw it, I thought it was cool, but way over-hyped. Who is going to want to wait for pictures to download over a 14.4K modem? Ridiculous. This is why you should not take my advice about new trends.

Anyway, the point of the IMG example is to show that HTML standards have never been “pure”, but have always been influenced by the implementers and the users of the web. The way it should be. HTML5 is an acknowledgment of that fact.

Aug 6, 2010 - 1 minute read - Comments - medicine hospitalist

Primary Care Doctors

I used to be a primary care physician, but switched to being a hospitalist in 2007. I loved parts about being a PCP, namely the relationship that I developed with the patient over many years. I miss that. I think PCPs offer huge value in providing low cost, quality care, especially if they can stay engaged throughout the hospitalization process. Atul Gawande recently wrote a powerful article on the Hospice system. It’s worth reading to being to understand the complex issues involved in end-of-life care, not to mention for the emotional storytelling that is his strength. But, to me, the unsung hero in that story was Chuck Morris, the primary care physician, who came in at the proper moment and provided perspective to the patient that he knew so well, allowing them to make the sane, yet horribly difficult decision to pursue a palliative path. Reading that made me miss primary care medicine a little. I perform much more actual “medical” work as a hospitalist than I ever did as a PCP. But, when I think of the concept of a doctor, in my head, I’m thinking of a primary care doc.

Aug 5, 2010 - 2 minute read - Comments - programming clojure

Maps are functions, too

Braindump time. Here’s what I’ve read about clojure in the past few days. I don’t understand what this means yet, but maybe someday I will:

Clojure provides easy access to the Java frameworks, with optional type hints and type inference, to ensure that calls to Java can avoid reflection.

There are multiple languages that target the JVM (besides Java, of course). It seems that there are 2 classes of languages. Ported languages such as JRuby and Jython aim to be identical to their base languages (Ruby & Python). Native languages such as Clojure and Groovy are meant to target the JVM natively without satisfying any desire to be identical to another language. Native languages have the advantage that they only have 1 set of libraries to use, so you don’t get stuck between two languages.

I installed clojure 1.0 from the ubuntu repositories, but promptly uninstalled it once I found leiningen. Leiningen is a build tool for clojure. You can easily create a new project and specify its dependencies and leiningen will download those dependencies, including a full version of clojure for each project. You can have 1 project using leiningen 1.0 and another using version 1.2 sitting right next to it. That seems smart!

I installed clojure-mode on emacs.

Right now, I’m working my way through the labrepl project. It’s an interactive tutorial and REPL (read-eval-print-loop) where you can run the examples in the tutotial.

It’s always important to know how to find help:

  • (doc blah) gives documentation about blah.
  • (find-doc "blah") searches for documentation.
  • (javadoc blah) opens Java docs in your browser
  • (show java.util.Date) shows method signatures

Here’s something cool: Maps are associative arrays. Here’s a simple one:

(def me {:first-name "Vinod", :last-name "Kurup"})

To get the data, you use the get function, like you would in other languages:

(get me :first-name) -> "Vinod"

But, maps and keywords are functions as well, so you can do:

(me :first-name) -> "Vinod"
(:last-name me) -> "Kurup"

Aug 2, 2010 - 2 minute read - Comments - linux

Ubuntu Bluetooth Workaround

I use bluetooth to transfer podcasts from my laptop to my Palm Centro. A Palm Centro is like an iPhone or a Droid, except less smart-like and more phone-like. This worked beautifully but broke when I upgraded to Ubuntu 10.04 (Lucid Lynx). There are 2 bugs involved. First, the bluetooth daemon (/usr/sbin/bluetoothd) never gets started. Second, there’s no easy way to start the file transfer daemon automatically (/usr/bin/dund). This used to work automatically, but now it doesn’t. I’ve tried to fiddle with udev rules, but have been unsuccessful. I’ve reported the 2 bugs, but haven’t had any response yet. (bluetoothd bug) (dund bug)

My workaround is a shell script which starts those those daemons if they are not running:

vk-bluetooth-start.sh

#!/bin/bash
    
BLUETOOTH='bluetoothd'
DUN='dund'
    
# first start bluetoothd
if ps ax | grep -v grep | grep $BLUETOOTH > /dev/null
then
    echo "$BLUETOOTH is running."
else
    echo -n "Starting $BLUETOOTH..."
    /usr/bin/sudo /usr/sbin/bluetoothd -u &> /dev/null
    echo "done."
fi
    
# then start dund
if ps ax | grep -v grep | grep $DUN > /dev/null
then
    echo "$DUN is running."
else
    echo -n "Starting $DUN..."
    /usr/bin/sudo /usr/bin/dund --listen --persist --msdun call centro
    echo "done."
fi

And here’s my script which transfers the files to my phone. It uses pilot-link, which I had to compile from source due to a bug in the way that the Ubuntu version addresses large SD cards. This should be fixed in the next version of Ubuntu.

vk-transfer-podcasts.sh

#!/bin/bash
    
output=$(pilot-xfer -p net:any -D /Kingston/AUDIO -i *.mp3 2>&1)
errors=$(echo $output | grep -c "ERROR:")
    
if [ $errors -gt 0 ] ; then
    echo "failure (count: $errors)"
    echo $output
else
    echo -n "success, removing files from laptop..."
    /bin/rm -I $HOME/*.mp3
    echo "done."
fi

If you’re wondering why I use a slow protocol like bluetooth to transfer large files to an SD card, rather than just ejecting the SD card and inserting it into the laptop, well… you haven’t tried to access the SD card on a Palm Centro. #paininthe&^@!

Jul 29, 2010 - 2 minute read - Comments - medicine hospitalist

Hospitalist Notes 1

My last night shift was a little less busy than most, so I forced myself to pick something about each patient I admitted and look it up. I tend to do this anyway, but I never keep notes or write about it. Here’s what I wrote about that night:

Does Buspar (buspirone) need to be tapered?

Answer: No. The full report on Micromedex was a little conflicting, because it stated that there may be some withdrawal symptoms from Buspar, but this quote in the same profile suggests otherwise:

Data suggest that buspirone does not cause physical dependence and as such, no withdrawal effects have been noted (Rickels et al, 1988a; Tyrer et al, 1985; Cole et al, 1982).

Staging COPD

I always forget the cutoffs for the stages of COPD. There are 2 different guidleines - GOLD and ATS/ARS, but fortunately they are almost identical:

Patients need to have an FEV1/FVC ratio < 0.70. Staging is then based on the FEV1.

  • Stage I (Mild): FEV1 > 80% predicted
  • Stage II (Moderate): FEV1 50-80% predicted
  • Stage III (Severe): FEV1 30-50% predicted
  • Stage IV: (Very Severe): FEV1 < 30% predicted, or < 50% with signs of chronic respiratory failure

Reference: Annals

How to determine calorie level of ADA diet?

We always put diabetic patients on an ADA diet and I choose the calorie level by gestalt. I figured there must be some formula to calculate the calorie level based on the patient’s weight. Looking it up, I found a different answer altogether. The ADA no longer recommends an ADA diet in the hospital. Instead, they recommend a consistent-carbohydrate diet. In long-term care facilities (i.e. nursing homes), they go a step further and recommend a ‘Regular’ diet with consistency in the amount and timing of carbohydrate. They specifically state that there is no evidence to support the classic ‘No concentrated sweets’ diet. These guidelines are from 2007, but they obviously have not been widely disseminated yet.

It is recommended that the term “ADA diet” no longer be used, since the ADA no longer endorses a single nutrition prescription or percentages of macronutrients.

Reference: Diabetes Care

Jul 27, 2010 - 2 minute read - Comments - writing clojure blog

My Anti-Writing Cycle

I blogged daily for a 6 day stretch a couple weeks ago, which is the longest continuous stretch I’ve ever done. It was stimulating and stressful at the same time. I haven’t heard from the Pulitzer committee about any of the posts yet, but it’s not the quality that matters. Writing is more about the process than the product, and I know from experience that writing helps me think. And while most of the posts were written for my own benefit, I really enjoyed the response that I got from family and friends about Playdoh. I think I’ve read that post 100 times and I still laugh out loud at the end of it. That’s the post that started the stretch off. As soon as I had put Kavi to bed, I knew that I wanted to share that story. I wrote it down quickly, so I wouldn’t forget it. That writing process stimulated me to want to write more, so I made it an internal goal to write a post daily.

Then I had two night shifts and the streak was broken. I’ve had a few days off, but I still haven’t written anything. I’m still learning clojure, but I fear writing about something that I know nothing about. Even though I’ve heard others say that this is the best time to write about a topic. I’ve also constructed a vicious cycle in my head. I want to learn clojure. I want to write about what I learn. I start doing so, but then I skip a day or so. Now, when I have free time, I think about learning clojure, but then I also think about the fact that I should write about it. And since I’m already behind, I don’t want to get further behind, so maybe I shouldn’t read that interesting tutorial until I’ve caught up on writing about what I’ve learned. Next thing I know, I’m monitoring Twitter streams second-by-second for imgur links.

I’m hoping that writing about my mental blocks will help me overcome them. I plan to write more frequently, mostly for my own benefit, but I’m not going to let it get in the way of learning cool, interesting stuff. If my writing is disjointed, so be it. I can fill in the gaps later if anyone cares.

Jul 20, 2010 - 3 minute read - Comments - kino linux video

My video editing process

I use kino to edit the videos that we take of the kids. I haven’t found a Linux program which was as nice as iMovie was on the Mac, but kino is pretty good. It’s easy to splice and reconnect video clips together. It has nice special effects, though my needs are pretty simple. It’s able to export in plenty of formats, possibly too many, for my simple mind. But, I’ve figured it out and have a stable process for getting video from camera to youtube.

I have 3 camcorders - a Flip, my Canon digital camera, and a Panasonic DVD camcorder. I can just copy the AVI files directly off the Flip and the Canon’s SD card. The Panasonic records all of the video clips into a single file with a .VRO extension. I found a great utility called dvd-vr, which reads that file and splits it into individual AVI files. Once I have a directory full of AVI files from the various camcorders, I use emacs to rename them consistently. I open up 2 buffers: an editable dired buffer (wdired-change-to-wdired-mode) of the movies directory, and a shell buffer in that same directory. I run a macro which takes the first file in the directory, plays it via an mplayer command in the shell buffer and then renames the file using the date/timestamp of the file. The macro leaves the cursor in a spot where I can enter a brief description of the video and then run the macro again to do the next video. It works pretty well. I then batch convert them to DV format, which is what Kino accepts. Finally, I launch Kino and edit the files, add titles, export them to AVI again, and then upload them to youtube.

I did this today and ran into a problem with kino. The video played at breakneck speed and there was no audio. Google helped me figure out that this was a problem between PulseAudio and kino. Kino is no longer actively developed. The lead developer considers it stable and finished and he’s moved on to other endeavors, which is perfectly understandable. He’s however, taken the time to describe a workaround. He recommends running padsp kino which routes all audio requests from kino to pulseaudio. This worked, but the audio had a lot of feedback. I found an even better workaround on the ubuntu forums. Use pasuspender kino, which suspends all PulseAudio activity, gives kino direct access to audio devices, and then resumes PulseAudio once kino has quit. This worked with perfect audio quality, though of course, audio from any other program gets muted completely.

I am still on the lookout for a better video editing solution on Linux. Eventually, I’d like to make DVDs of the hundreds of little clips that I have. They don’t need to be fancy, but I would like to have some basic menus and they need to work on standard DVD players. I’ve started doing a little research on this, so will post once I’ve tried some things out.