29 Jul 2010

Hospitalist Notes 1 View Comments

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

medicine| hospitalist

27 Jul 2010

My Anti-Writing Cycle View Comments

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.

clojure| blogging| writing

20 Jul 2010

My video editing process View Comments

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.

kino| video| linux

19 Jul 2010

Stock Market Timing View Comments

If you asked me a few years ago, I would have said you absolutely can't time the stock market. The 2008 crash hurt enough to make me review my convictions a little. I still believe that accurate market timing is somewhere between difficult and impossible. Trying to analyze stock charts to figure out what will happen in the short term is mostly a crap shoot. The way to win in the stock market is to buy value stocks, especially when everyone else is selling.

I do, however, now believe that there is a place for market timing in deciding when to be in the stock market, in the first place. I think there are some trends that have repeatedly predicted poor stock performance. There are some super smart people that have analyzed these trends over at the Motley Fool message boards. They've come up with many indicators that supposedly tell you when to get in and out of the stock market, but my favorite is the 99 day rule 1.

The basic premise of the 99 day rule is that when the S&P 500 Index stops making new highs, investors get pessimistic and stocks fall. When it starts making new highs again, optimism takes over and bull markets start. The 99 day rule has 2 parts and coincidentally uses 99 days as the cut-off for both parts. It looks at whether a new high has been made recently. It defines "high" as a 99-day high. It defines "recently" as 99 days. So, it looks for a new 99-day high within the last 99 days. The number is arbitrary. Hop over the the Motley Fool boards to see how the dates have been tuned and pick different ones, if you like.

I like this rule, because it's simple, easy to calculate and doesn't have many "signals", so you're not constantly buying and selling. Of course, it's not perfect, but it would have gotten you out of most of the major bear markets.

Here is how the rule has done over time:

Period        S&P 500   Switching   Improvement 
---------     -------   ---------   -----------
1930-1935     -12.2%       4.3%       16.4% 
1935-1940      10.3%      16.2%        6.0% 
1940-1945       7.4%       5.6%       -1.8% 
1945-1950      10.2%       7.4%       -2.8% 
1950-1955      23.6%      22.5%       -1.1% 
1955-1960      15.2%      13.8%       -1.4% 
1960-1965      10.7%      11.7%        1.0% 
1965-1970       5.0%       7.1%        2.2% 
1970-1975      -2.4%       6.8%        9.2% 
1975-1980      14.8%      12.0%       -2.8% 
1980-1985      14.8%      20.1%        5.2% 
1985-1990      20.4%      18.8%       -1.7% 
1990-1995       8.7%       6.7%       -2.0% 
1995-2000      28.6%      27.9%       -0.7% 
2000-2005      -2.3%       4.3%        6.6% 
2005-early2008  2.0%       4.5%        2.5%

You may have gotten to this point and are now wondering why it's worth following this rule. In at least 3 of the past 5 periods, this signal would have lost money versus staying in the market. That is true. The key is to understand that there is no free lunch. Any rule that tries to get you out of major bear markets will be imperfect and will often leave you with less money than if you had chosen to act on a different date (or not act at all). The overall goal is not to increase your returns, but to decrease your risk without sacrificing your returns. This signal does that. Overall, it does actually increase your returns by about 2% annually since 1930.

The other nice feature is that it doesn't have a "slam-dunk" feel to it. My experience is that things that work in the stock market have to have a little of a "gut wrenching" feel to them. If it sounds too good to be true, it is. This rule feels correct, improves returns over the long run, is backtested well, but does so at the risk of some lower performing years. That feels a little gut-wrenching to me.

Here is the author's (mungofitch) description:

By using the rule that I described above, you would have had a total return of 11.80%, with a total risk of 6.71%. So, you would have had 2.3% per year higher returns on average, while experiencing only about 56.9% of the risk. Higher returns, lower risk. That sounds good, right?

But, is this one of those iffy timing systems that really only works because it managed to avoid the crash of 1987 of something? No, actually it has you in the market in the 1987 crash: it's not perfect. But does it really add value on average through the years? Not always, but pretty darned well. Sometimes you do a little worse, but never a lot worse. And when you do better, you do a LOT better. So, overall, it's worth it.

In order to keep track of the signal, I wrote a little python program to calculate whether we are in buy mode or sell mode. It uses the excellent ystockquote module written by Corey Goldberg.

investing| python| programming

18 Jul 2010

First Steps with Clojure View Comments

As mentioned yesterday, I'm teaching myself clojure. I started by trying to install it.

vinod@ike$ aptitude install clojure

Ubuntu has packaged version 1.0.0 of clojure. I always default to the OS-installed version of programs, just for ease of maintenance. The current stable version of clojure is 1.1 and it appears that 1.2 is in beta. I have no idea what has been changed in 1.1 or 1.2, but I'm going to try to get along using 1.0.0 and update only if I need to for a specific reason.

I then read through the tutorial for non-lisp programmers, which succinctly describes the basics of the language.1 Everything in lisp is either an atom or a list. Atoms include numbers, booleans, strings, symbols, keywords and the nil value. Lists (delimited by parentheses ()) are the basic data structure, but include representations such as vectors (delimited by square brackets []) and maps (delimited by curly brackets {}). Clojure programs are themselves simply lists, which leads to the power of lisp-like languages because code and data are interchangeable.

You use def to create variables and defn to create functions. The language includes loops and conditional statements, just like any other useful language. Only false and nil are false in clojure; zero (0), and the empty string ("") are true, unlike a lot of languages.

The interesting part is the integration with Java. To instantiate a java object, simply call new:

user=> (new java.util.Date)
#<Date Sun Jul 18 16:20:54 EDT 2010>

To call object methods or get instance/class variables, use the dot "." method.

user=> (. (new java.util.Date) (toString))
"Sun Jul 18 16:24:09 EDT 2010"

user=> (. Integer MAX_VALUE)
2147483647

The article contains this interesting quote:

Sequences are in a sense, the core of idiomatic Clojure programming. Understand sequences and the forms that work with them, and you will have cleared one of the biggest hurdles in writing significant Clojure programs.

So, add that to my to-do list. Where to go next? A StackOverflow thread has pointed to me to a few options. I'll probably read one of these next:


  1. I later read that this tutorial is out of date, so I may have to "unlearn" things later. It still comes up as the first hit on Google for "clojure tutorial"

clojure| programming

Older Posts

16 Jul 2010

inotify View Comments

15 Jul 2010

PlayDoh View Comments

23 Jul 2009

Flow View Comments

02 Aug 2008

I'm alive View Comments

01 Mar 2006

Tag Cloud View Comments

29 Nov 2005

MTA sucks View Comments

08 Aug 2005

Amabuddy View Comments

07 Aug 2005

SBGI View Comments

29 Mar 2004

Dan Bern View Comments

19 Mar 2004

Strongbad View Comments

20 Feb 2004

Telluride View Comments

17 Dec 2003

I'm back! View Comments

11 Sep 2003

SCO View Comments

17 Aug 2003

Heads up! View Comments

01 Aug 2003

ASD View Comments

23 Jun 2003

Karate? View Comments

20 Feb 2003

BorkDrip! View Comments

01 Feb 2003

Snow! View Comments

22 Sep 2002

R.I.P. View Comments

03 Aug 2002

Bork!!!! View Comments

14 Jul 2002

Pics View Comments

20 Jun 2002

Delay View Comments

02 Jan 2001

Y2K1 View Comments

23 Oct 2000

Marathon! View Comments

15 Jul 1999

Waiting View Comments

01 Mar 1998

Cruise View Comments