Quitting Smoking
This post is for people who want to quit smoking, or know somebody that wants to quit. Everybody else, you can read it too, but its not for you. So there.
Lets see. I guess its about 6 years now that I haven’t smoked? Seems long, but not really. Maybe 7, actually. I remember day #1 quite well. We had a gig that night (www.dieselamerica.net). The band still exists, so I would guess it has to be closer to 6 than 7 years, but I could be wrong. I think it was 11/22, so it’ll be 7 years next month, but I digress.
We had a gig. Super late. Got done at like 3am. Went to our local bar to have a couple drinks. We know they owners, so they let us lock the door and stay late. Since it was my last night smoking ever, I stayed quite late. Sunrise-ish.
The next day I had been set up on a semi-blind date (never met, but I’d seen her. She was cute). My friend said part of the reason for the set up was that we both smoked. I mentioned I planned on quitting, but you know how that goes. I think EVERY smoker is planning on quitting.
Meet for date. I imagine I look like hot garbage, considering the night I’d had. I tell my date all about this, pretty sure my chances for date #2 are fairly low anyway. She suggests a book. Allen Carr, The Easy Way to Quit Smoking. Link to amazon. I’m thinking, “Yeah, OK. Sounds like a cheesy scam”, but I say I’ll check it out. Date ends pretty early.
Allow me to take a step back. I’d been trying to quit for a long, long time. In order of percieved painfulness and/or ineffectiveness, the methods of quitting smoking:
- Cold turkey. Even sounds horrible.
- Step down gradually. Sounds like the least “painful”, but the most difficult to actually continue. Every smoker thinks this is a reasonable plan, and (almost) every one fails.
- Hypnosis. Sounded cool, but I’m not really good at “going under”. Have tried this, although not for smoking. Never felt like I did anything except rest my eyes. Jedi tricks only work on the feeble minded (or relaxed people, which I’m kind of not).
- The patch. This always seemed weird and chemically to me.
- The gum. This was my preferred method. Also my go-to when I had to be places I couldn’t smoke.
- Locked in a room. Painful? Maybe, but it’ll work. Right?
To quit smoking, I’d tried 1, 2, and 5, and assumed 3 and 4 to be similarly poor. #6 seemed like the only thing that would “work”, although obviously not practical.
Worse, every smoker lives under certain beliefs which sort of ruin any attempt to quit. Specifically, that even if they make it, they won’t be able to keep it up. All smokers have heard that, years later, people who quit still really want a cigarette. That kind of thing. This belief, for me, was sort of in the background, but came SCREAMING out whenever I actually tried to quit. So, say I’d made it a few days cold turkey. That thought would wear me down, as would any excuse to light up again (work, family, girlfriend, etc). The mind does a great job convincing you to switch gears in a quit attempt.
The nicotine gum is really funny. Before that stuff, I’d had a really hard time being in places I couldn’t smoke, and I refused to smoke in front of my family, so any family time was difficult. When the gum came along, wow! I bought it to “quit gradually”, but in reality, it was like my scuba tank for when I had to go without smokes. Not quite as good, but it would certainly get you through.
Every few weeks, I’d get some more gum, and pick a day to give it another go. Usually a Monday. Some attempts I’d actually make it a few days, but eventually those attempts ended.
After a while, you start to think its not going to happen. I kept trying, but the energy was gone. Then my roommate quit. His personal addictions made me look like a vegan monk. He had stopped drinking the year prior, and was a “first thing in the morning/last thing at night” smoker. I was not quite that myself. I was shocked that he was able to keep it up. What did he do?
He just quit. No gum. No “step down”. He wasn’t even locked in a room somewhere.
At first I thought this was the biggest feat of willpower I’d ever seen in a human. I’d judged his urge to smoke (and drink, and anything else) had to be at least twice as bad as mine, so the fact that he just stopped seemed huge to me. He explained that quitting cold turkey was actually the easiest way to do it. I thought he was a huge idiot, but I took mental notes.
I started looking/asking around. I’d heard of a lot of people who’d “quit” smoking with the patch/gum, but if you really dig in, most of that is bullshit. I met a woman in Vegas about 6 months after I quit. By the way, if you make it 6 months, you’ll find that you talk about it with EVERYBODY, as its still the biggest thing you did in the last 6 months. I don’t much talk about it now. Anyway. I said the same thing about cold turkey being easier, and she gave me “Oh, that’s not true. They have studies backing up the replacement methods. I used gum to quit”. Oh. OK. Some people are successful on those things.
About 30 minutes later, she pulls out some nicotine gum. She says, “Oh, well, I still indulge here and there”. Ah. Right.
For the most part, but with some notable exceptions, everybody who quit AND stuck it out, had done so cold turkey. Most of the people who’d “quit” with other methods hadn’t fully quit using Nicotine. The basic concept of the patch or gum is to stop the smoking “habit”, and then step you down gradually. The reality is people rarely get off them completely. Lets explore this.
The “habit” aspect (holding, lighting, inhaling, etc) exists, but I think its a lot less than people think it is. The idea that you “break” that habit first is to me, in retrospect, ridiculous. If there was anything you could worry about second, it would be the physical act of holding something and inhaling off it. If this was REALLY a big deal, people would suck straws with paper in them and nobody would be smoking anymore (or, more fun, everybody would smoke pot to quit. In general, this doesn’t work. Just FYI). Obviously, if you believe the habit aspect is a big deal, my little observations aren’t going to change your mind, but its my humble belief that this part of quitting smoking was blown up by the replacement people.
Now, the “gradual reduction” idea. Allen Carr’s book brought this fantasy out for me. In simple terms, you can’t *reduce* your level of addiction. At least to Nicotine. Once you are a certain level of addict, you remain at that level. Two simple pieces of evidence support this:
- If “gradual reduction” worked, “cutting down” would be relatively successful. Any long time smoker, who is honest with themselves, knows that its not. If it were, there would be far fewer smokers.
- When people fall off the wagon, they don’t have the same pattern as they did when the first started. If they were a pack a day before, they’re AT LEAST a half pack within a couple days. Full pack by the end of the week. You need to damage your body enough to handle that much smoking again without coughing, etc.
I know a guy who smoked like crazy. 2 packs/day. He was a database guy. ”Lucky” for him, he worked right near the back door of the office, so getting out for his smokes was pretty easy. He shocked me once. He said he’d quit for 12 years. 12 YEARS!!! He quit when his daughter was born. When she was 12, the family was all on vacation. He was on the boardwalk. Beautiful night. He decided he wanted a cigarette. 12 years no smoking, he’d have a few and that was it. He said he was back to 2 packs/day within the week. I can’t imagine how his family reacted. I also don’t understand how his brain doesn’t remember how easy it was to be a ex-smoker. He’d done it for 12 years! He wasn’t “overcome” with a desire for a cigarette. He just thought he could do it without problems.
When I knew him, it had been several years since then. Its sad to think that he probably knocked several years off his life, and significantly reduced his quality of life, and for nothing. (I assume he’s still alive, BTW. Don’t want you think he died ;)
So, forget “cutting down”.
The nicotine replacement thing is a scam. Cold turkey gets such a bad wrap because it does suck in the short term, and there’s no money in it. There’s A LOT of money in Nicotine replacement. There wouldn’t be as much if it worked well, but that’s the trick. It works like crap. Is it safer? Probably. If you simply *couldn’t quit*, I’d say get hooked on the gum. Much MUCH better. If you’re trying to quit, would not recommend.
Why? Again, read the book. The reason why my friend went from 0 to 2 packs/day is because you can’t reduce your addition. You know what happens when you cut down? You keep *some* Nicotine in your body. This keeps that strong addicted urge alive, but feeds it less. You know what that means? That long protracted period where you “cut down” involves a long protracted withdrawal. FAR longer than you’d need if you just quit. In fact, if you wanted to design a method of quitting that would virtually guarantee failure, and teach you that quitting smoking was all but impossible, I’d bet you’d get the EXACT SAME PRODUCT. Seriously. There is no MORE painful way to quit than cutting down gradually, and the longer the time period, the worse it is.
Imagine a “pain graph”. Well, don’t. I drew them. I’m REALLY wasting some time now, so I hope you appreciate it, people!
Here’s what people think cold turkey is like. And guess what? It pretty much is.

On the left is your smoking level. Horizontal is time in weeks. Since you stop smoking immediately, the yellow/black area represents your pain over time after you quit (I now realize my labeling is bad, but stick with me).
Here is what people think “cutting down” is like, and what the gum/patch people want you to think:

Hey! Spread that pain out (and you get to enjoy your fix for a little while longer). Boy! What a nice solution! The problem. You can’t “reduce” your level of addiction. You need to remove the substance from your body completely. The cruel fact is that, the less Nicotine you have in your system, the stronger withdrawal is. However, ANY amount of Nicotine means you’ll still be at full-blown addiction level. Net result? You prolong and gradually INCREASE your pain. See reality graph below:

Then you still get that trailing off pain you’d get after a cold turkey quit, but it drags on past the graph.
I may not have convinced you that cold turkey is best, but this is what I believe, and its what I experienced myself.
My quit.
I took a week off of work. I made sure I had to do NOTHING except not smoke. I did not worry about what I ate, etc. Just don’t smoke. It is not “easy”, but when you have the tools, in retrospect, it really wasn’t that bad.
You need to learn that you want it less than you think you do.
You need to understand that the actual pain of quitting, and the fear of that pain, are far worse than reality.
The “you’ll want to smoke forever” thing is garbage. At least for me. The concept of smoking a cigarette is completely foreign to me right now. The smell of smoke on people’s clothes actually distracts me. In a bad way. Think homeless guy in the hot subway car in August.
The “enjoyment” of smoking is actually just the relief from withdrawal. Very few people “enjoy” their first cigarette. Most cough. Some vomit.
It is one of the hardest things you’ll have to do, and once you’ve done it, you’ll realize it actually wasn’t as hard as you’d thought.
I can talk about this much better in person, especially after a few drinks, so if our paths happen to cross, lets chat.
In the meantime, get that damn book. He tells you right away, don’t quit until you read it. The reason is, if you think you need to quit first, or while you’re reading it, you won’t read it. Just buy the book and read. Think its crap? I’ll buy you the book. If you actually quit, I’ll expect that $10 back.
I could go on (and on and on). There are subtle benefits to quitting. Cognitive dissonance is a bitch. The understanding that you actually pay to ruin your health and kill yourself early had quite a damaging effect on how I viewed myself. The equation goes something like, “Well, if I’m doing this to myself, I must not be that great of a guy”. Its not a conscious thing, but it’ll eat away at you over time. Then, of course, the usual. You’ll feel better physically, you’ll never have to admit to a new girl/boyfriend that you smoke, save some money, not feel like the group outcast, etc.
Shit, just fucking do it already. Its over before you know it.
*Update!!!*
To the people who have quit with replacement. In my research, you are more the exception rather than the rule. My graph is a little misleading, but that pain curve has much more volume for the step-down than the cold turkey. You are truly the stronger of us ex-smokers, because I couldn’t handle the way you did it.
*Update 2*
http://en.wikipedia.org/wiki/Smoking_cessation
“Up to three-quarters of ex-smokers have quit without assistance (“cold turkey” or cut down then quit), and unaided cessation is by far the most common method used by most successful ex-smokers”
“In three studies, it was the quitting method used by 76%,[13] 85%,[10] or 88%[14] of long-term successful quitters”
Theme settings
Gig this Friday! Bar East, 1st Ave between 89th & 90th Streets. 9pm. You should be there.
OrmLite for Android
(Old post copied from old blog. Links may not work…)
I’ve been working on an Android project for a few months now. Its on contract, for a real company, so I can’t really “mess around” too much with crazy API’s and whatnot. My original Android work was done before there was a phone, and I haven’t really done much on the platform after the G1 came out, so I assumed there would be some form of ORM tool available by now. Well, when I looked around, there really wasn’t. This is odd. The Java community is huge, and there are plenty of ORM tools out there. Why none for Android? Well, the first issue is performance. Imagine using Hibernate on a phone. Hibernate gets a lot of grief, but I use it for server code, and its a great tool. Usually when people complain about performance its because they do stupid things. But that’s on a server or desktop. On a phone, any full-blown ORM is going to do a lot of extra garbage that you don’t need on a phone. So, even if you could use one, you wouldn’t want to. Any ORM tool for the phone has to be really basic. No JDBC (even though there is). Every tool that talks to a database in java uses JDBC, but Android doesn’t include a driver for the native Sqlite database, so you’d have to include your own (2+ megs), or use a different database (thanks. Prefer not to explain to employer why I took a huge risk on their product). But there IS a JDBC driver on the phone. You’re just not supposed to use it. You never know what’s going to change and suddenly not work. So, anybody planning on writing an ORM has to write it for a proprietary API, and has to worry that Android 3 will suddenly have a JDBC driver, and the whole thing will be kind of a waste. There’s sqldroid, which adapts jdbc calls to the sqlite api in Android. Nice idea. We tried it. Its hacky, and doesn’t actually “work”. The only “real” ORM on Android is Active Android. I applaud the effort. However, its feels like a bit too much, and isn’t practical. As far as I can tell, it tries to handle db management for you, based solely on your object definitions and changes. OK, except its foolish and doomed to failure in any real schema. I asked about thatbefore starting the ormlite effort. I can’t believe anybody would ever use a platform that wouldn’t allow you to update your database schema. Also, no offense to the AA guys, but $20/license and closed source? Open source the thing, dominate, and get some contracting gigs instead. Even the Android source is available. I hope you do this and make a really great alternative to what we built, but in the meantime… Enough bashing. I present ormlite for Android. I found Gray’s post on stackexchange, that his api, ormlite, worked with sqlite and would probably work on Android. That started a weeks long saga that saw the database calls in the API be abstracted, and both a JDBC and Android version be implemented. What you have now is a simple ORM tool that works with native Android calls, is open source, free, and includes useful app templates to help you get started. OrmLite Basics Using OrmLite is pretty simple. For each table, create an object to represent the data, and add @DatabaseTable to the class. For each field, add @DatabaseField. There are some details in the configuration of both which allow you to do most of the basics in the ORM space, but that’s the basics (find all the tasty details here). //Yada yada } You access data by creating a Dao object, and querying with some pretty standard function calls. Ehh, its a lot of blab. Look at the docs, or download and try out the “ClickCount” app. Connection Management One of the more frustrating things about Android and Sqlite is that there is little discussion about how you should use it and what to avoid. It took a lot of searching, trial and error, and actually walking through the code to suss out the details. Completing that, we’ve cooked up some prototypical classes that you can use to avoid issues when implementing your database access. All of these are in full force in the ClickCount app, which is available in download form and directly in the ormlite source on sourceforge. OrmLiteSqliteOpenHelper - This extends android’s SQLiteOpenHelper, and provides Ormlite specific onCreate and onUpgrade methods. In this situation, the lazy way to handle updates is also the only way that really makes sense. See above. Do updates manually. You can use ‘AndroidTableUtils.createTable’ to create tables from your ORM object class definitions. open_helper_classname String Property - Once you create your OpenHelper instance, add the class name under this property in the ‘strings.xml’ resource file. The app classes will use that to find which class instance to create. Check out ClickCounter app’s ‘strings.xml’ file. Don’t think too much about this. Just do it. OrmLiteBaseActivity/OrmLiteBaseTabActivity - Essentially the same thing. Base class to use instead of android’s Activity and TabActivity classes. These classes manage the db connections so you don’t have to! You should be able to call ‘getHelper()’ or ‘getConnectionSource()’ without concern for opening/closing connections, db locks, or whatever. There are two classes because somebody developing Android thought having the different base classes was a great idea. Now all the code is duped. Good use for Scala’s Traits, methinks. I still have some learning to do before I write production code in Scala, though. OrmLiteBaseService - Same thing as the Activity classes, but for Services. Boldly read/write to your db long after the user closes your app. Go nuts *. It’ll take it. AndroidTableUtils - Static helpers to create and drop tables from the class definitions. Best to use during dev and initial db creation. They will be no help updating. Again, see above about why. AndroidSqliteManager - You should rarely (as in never) call this class directly. It manages a single OpenHelper instance by way of reference counting, to prevent database locks and potentially lost updates. If you have some exotic things going on, or want to use more than one db in an app, you may need to interact with this class. * Don’t go nuts. Tips for you and yours While implementing the ormlite stuff on Android, and using android db access in general, I’ve learned some things. - When updating more than one object, use a transaction. In ormlite, see TransactionManager.callInTransaction. there are HUGE performance benefits to using sqlite transactions on the phone. - I was shocked, but even basic db ops can take a significant amount of time. This flies in the face of common knowledge in most server/desktop apps. Ideally, EVERYTHING should be in a worker thread of some type, but at least for bigger queries and updates, spawn a worker thread. I actually put big updates out into a local Service instance. I guess that’s it for tips? I’m a wealth of knowledge. Its late, though. I only write blog posts when I’m too tired to actually work. Its 12:38AM on a Friday night. Lame. K out. OH YEAH! What’s Wrong with OrmLite (or, “Yeah, we know”) When you reference associated objects, you MUST remember to refresh them manually. If you’re used to a big ORM, this will be a let down. Yeah, we know. This way, there’s no central store, no object instrumentation, etc. You’re also not getting huge object graphs that you didn’t intend to. Just the basics. A little extra work, a little extra code, but much simpler from an implementation perspective, and (arguably) better from a performance perspective. Again, short on the “what’s wrong”. Maybe I’ll add more later. Basically, you could list most of the features of a full-blown ORM here and complain about them missing, but it is a pretty simple API. Its meant to shuttle data into and out of your objects. If you want anything else, hey, there’s the source… K out, again.@DatabaseTablepublic class ClickGroup implements Serializable{ @DatabaseField(generatedId = true) private Integer clickGroupId; @DatabaseField private String groupName;
Android Sqlite Locking
(This is an old one copied from my former blog. Apologies if the links aren’t active)
Recently I’ve been doing quite a bit of work with the Android Sqlite database. Mostly with the android piece of ormlite. The Android examples cover some basic Sqlite usage, but they really don’t go into depth with regards to proper usage patters, and more importantly, improper usage patters. Most examples and documentation is slated towards using very basic database queries, and beyond that, creating a ContentProvider. What never really seems to be covered is stuff like: If you look around for information you’ll find a lot of partial or incorrect info. A great example was forwarded to me by Gray yesterday (he runs the ormlite project). It was on stackexchange… http://stackoverflow.com/questions/2493331/what-is-best-practice-with-sqlite-and-android/2493839 The first answer basically says you can connect to the sqlite database pretty much how you want, and the Android system will sort it out for you. Sqlite has file level locking, which will serialize access and prevent trouble. This is an example of a little truth and a little experience leave you open to a lot of pain. Open source is great, by the way. You can dig right into the code and see what’s going on. From that and some testing, I’ve learned the following are true: Here’s what’s missing. If you try to write to the database from actual distinct connections at the same time, one will fail. It will not wait till the first is done and then write. It will simply not write your change. Worse, if you don’t call the right version of insert/update on the SQLiteDatabase, you won’t get an exception. You’ll just get a message in your LogCat, and that will be it. This issue may be tough to notice. You have to have more than one distinct connection, and you have to write from more than one thread at the same time. In most apps that are doing light database updates, that’s a lot of stars to align at the same time. The first problem, real, distinct connections. The great thing about open source code is you can dig right in and see what’s going on. The SQLiteOpenHelper class does some funny things. Although there is a method to get a read-only database connection as well as a read-write connection, under the hood, its always the same connection. Assuming there are no file write errors, even the read-only connection is really the single, read-write connection. Pretty funny. So, if you use one helper instance in your app, even from multiple threads, you never *really* using multiple connections. Also, the SQLiteDatabase class, of which each helper has only one instance, implements java level locking on itself. So, when you’re actually executing database operations, all other db operations will be locked out. So, even if you have multiple threads doing stuff, if you’re doing it to maximize database performance, I have some bad news for you. No benefit. I wrote a test application to show how this all works. The app has 4 buttons and a checkbox. Originally the plan was to show locking exceptions and insert problems with multiple connections, but I saw some weird results, so I set up several types of tests to get an idea of how to best use the database. All buttons start 1 thread reading the db and 2 threads writing to it. When the checkbox is checked, the writing threads take a break after each write to give the reading thread some time to work. Buttons: If you run either of the “One Helper” processes, you should see no failures. If you run either of the Many Helpers, you should see failures. Very important: You have to run this on an actual phone!!! On my desktop, I can only get the transaction runs to lock up. This is due, I imagine, to significantly better disk performance on my desktop. I also imagine this contributes to the misconception that Android will just sort of “handle it” with regards to db locking. Your phone may not see this issue, but if not I assume that’s because the phone performance is significantly better than mine (Samsung Vibrant, Android 2.1). Interesting Observations If you turn off one writing thread, so only one thread is writing to the db, but another reading, and both have their own connections, the read performance shoots WAY up and I don’t see any lock issues. That’s something to pursue. I have not tried that with write batching yet. If you are going to perform more than one update of any kind, wrap it in a transaction. It seems like the 50 updates I do in the transaction take the same amount of time as the 1 update outside of the transaction. My guess is that outside of the transaction calls, each update attempts to write the db changes to disk. Inside the transaction, the writes are done in one block, and the overhead of writing dwarfs the update logic itself. Performance of database calls is all over the place at different times. Any serious db calls should probably be in an async process, just in case there’s something else going on behind the scenes.
