Paraprosdokians

A little humor to start off your Saturday (since Saturday starts about 10:30am or so) using paraprosdokians.

  • I asked God for a bike, but I know God doesn’t work that way so I stole a bike and asked for forgiveness.
  • Do not argue with an idiot. He will drag you down to his level and beat you with experience.
  • I want to die peacefully in my sleep, like my grandfather, not screaming and yelling like the passengers in his car.
  • The last thing I want to do is hurt you, but it’s still on the list.
  • If I agreed with you, we’d both be wrong.
  • We never really grow up; we only learn how to act in public.
  • War does not determine who is right — only who is left.
  • Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad.
  • The early bird might get the worm, but the second mouse gets the cheese.
  • Evening news is where they begin with ”Good evening,” and then proceed to tell you why it isn’t.
  • To steal ideas from one person is plagiarism; to steal from many is research.
  • A bus station is where a bus stops. A train station is where a train stops. My desk is a work station.
  • How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?
  • Dolphins are so smart that within a few weeks of captivity, they can train people to stand on the very edge of the pool and throw them fish.
  • I thought I wanted a career; turns out I just wanted paychecks.
  • A bank is a place that will lend you money if you can prove that you don’t need it.
  • Whenever I fill out an application, in the part that says “In an emergency, notify:” I write: “A DOCTOR.”
  • I didn’t say it was your fault, I said I was blaming you.
  • Why does someone believe you when you say there are four billion stars, but check when you say the paint is wet?
  • Behind every successful man is his woman. Behind the fall of a successful man is usually another woman.
  • A clear conscience is usually the sign of a bad memory.
  • You do not need a parachute to skydive. You only need a parachute to skydive twice.
  • The voices in my head may not be real, but they sometimes have some good ideas!
  • I discovered I scream the same way whether I’m about to be devoured by a great white shark or if a piece of seaweed touches my foot.
  • Some cause happiness wherever they go; others, whenever they go.
  • There’s a fine line between cuddling and holding someone down so they can’t get away.
  • I used to be indecisive; now I’m not sure.
  • I always take life with a grain of salt… plus a slice of lemon… and a shot of tequila.
  • You’re never too old to learn something stupid.
  • To be sure of hitting the target, shoot first and call whatever you hit the target.
  • Nostalgia isn’t what it used to be.
  • A bus is a vehicle that runs twice as fast when you are after it as when you are in it.

Chocolate Dulce de Leche Flan Cake

After a weekend of experimenting with some recipes (and failing mightily), my sister suggested that I try this Chocolate Dulce de Leche Flan Cake from David Lebovitz (his book Ready for Dessert also has some great recipes).  I have to say it turned out wonderfully and much better than my attempted Goat Cheese Cake for diabetics.  Yeah, the nutritionist and Endocrinologist would cringe at the sight of me making and eating this, but it was really, really tasty.  It tasted great after it had cooled down to room temperature, but I found it even better after letting it sit in the refrigerator for a day and serving it cold.  The cake layer stayed moist and the flan and dulce de leche seemed to taste much more vibrant (if that is a term to describe flavors) when cold.

I think I’ll have to add this recipe to the list of recipes I have on my site here in the next few days.

And now… the Diabetic Internet Meme (because every disease needs at least one)

After seeing this, I decided I’ll follow the crowd and join in on the diabetes meme.

What type of diabetes do you have: Type 1

When were you diagnosed: When I was 27 (I was fashionably late to the Type 1 Diabetes party).

What’s your current blood sugar: 100 mg/dL before breakfast

What kind of meter do you use: The Lifestyle one built into my OmniPod and the Dexcom Seven+ when I’m not completely ticked off at it.

How many times a day do you test your blood sugar: At least 7 times (pre- and post-meals, and bedtime) and sometimes up to 11 times a day depending on how I’m feeling.

What’s a “high” number for you: For resting anything over 110 mg/dL, for post meal, anything over 160mg/dL

What do you consider “low”: Anything below 75 mg/dL, I feel it

What’s your favorite low blood sugar reaction treater: Some sort of candy like Skittles or M&Ms

Describe your dream endocrinologist: Not having one :), but since that isn’t the case right now, I really like the one I have.  They allow me to have a lot of say in what I am prescribed and explain everything to me.

What’s your biggest diabetic achievement: Not getting completely down about having it, especially after knowing what it’s like to not have it.

What’s your biggest diabetes-related fear: Amputation of a body part and/or failure of a vital organ (other than the pancreas).

Who’s on your support team: Parents, family, close friends, and my dog.

Do you think there will be a cure in your lifetime: Honestly, no, there needs to be a shift in the way diabetes is viewed.  We’re controlling the symptoms and not the cause.  I know some people are working on the cause, but I believe there are going to be many reasons why the auto-immune system decides we don’t really need beta cells.

What is a “cure” to you: Having my body go back to how it was before I was diabetic.  Otherwise, I’d like to see the loop close between the CGMS and Insulin Pumps.

The most annoying thing people say to you about your diabetes is: Did you eat a lot of sugar as a kid?  (What person DIDN’T inhale massive amounts of sugar as a kid?)

What is the most common misconception about diabetes: That type 1 can be controlled through diet and exercise like type 2.  This is just a problem of both types being called “diabetes” and then when newscasters and articles talk about “diabetes” they really mean “type 2 diabetes.”

If you could say one thing to your pancreas what would it be: It’s not your fault my auto-immune system hates you.  Then I’d need to have a sit down talk with my auto-immune system and figure out what it doesn’t like about my pancreas.

Modifying CSS in the LightWord theme for WordPress

The theme that I am currently using on my website, LightWord, is generally very nice and I love it.  However, there are a few issues with it, luckily, LightWord offers a nice way to correct some of the formatting issues without actually having to update the theme itself through the LightWord Settings page.

To access the LightWord Settings page, go to the Appearance -> LightWord Settings choice on the left side menu in the WordPress admin dashboard.

In this page, scroll down to the Custom CSS settings text box.  At this text box you can enter any additional CSS and it will be inserted into every page on your blog.  I’ve used this to fix a few issues that I have with LightWord.  First, I wanted my blog title to appear in a different color.  I changed this, with the following bit of CSS:

h1#logo,h1#logo a{color:#FF6600;}

Secondly, I wanted a different background; which was solved with this snippet:

body {background:url(‘wp-content/themes/k3290370.jpg’) repeat;}

Lastly, the drop down menu background was too small for some of the titles it was displaying so it would cause them to overflow.  I did a quick change that expanded the size of the menu drop down background, like this:

#front_menu ul {width:300px;}

Of course, you can override all the CSS you want within this text box, so if you wanted to change the color of links or whatever, you can do it right here without modifying the actual LightWord theme.  In addition to the Custom CSS, the settings page also allows you to add in additional scripts, headers, and footers.

Debugging JavaScript in a browser

Debugging is one of the most time consuming tasks one can do while programming in my opinion.  Debugging JavaScript that runs within a browser is the most time consuming and annoying tasks one has to do, period.  Which is why I’m all for finding better ways to debug JavaScript within a browser.  Here I’ll talk about some of the tips and tricks that I use to make debugging JavaScript within a browser a little less tedious and annoying (I’m not going to say fun, since debugging is rarely fun:)).

The first technique I employ is using alert statements.  The alert statement pops up the dialog box with a message, that you as the programmer have inserted into the code.  I use these to pinpoint where in the JavaScript code the script is failing so I can quickly get to the problem segment or method within the code.  This makes a great first pass since you don’t need any specialized tools or add-ons to your browser for this to work.  The problem is, you’re always rerunning your code in order to see where it fails once you make a change or in order to further pinpoint the problem section.

The second method I use is the Web Developer tool bar add-on for FireFox and Google Chrome.  The Web Developer tool bar lets you inspect each element in the HTML and see all of its properties.  This is extremely handy when scripts are changing properties of HTML elements; using it you can see if an element has changed it’s properties or not or if the property you’ve added has actually been added.  The only downside to the Web Developer toolbar is that it doesn’t seem to work in real time.  If you’ve made it display form details then run a JavaScript script that modifies the form details programmatically, the updates won’t be shown until you hide then redisplay the form details.

The third option, and the one I’ve grown most fond of recently, is using Safari and WebKit add-on.  I’ve found this to be the nicest real-time debugger for JavaScript.  With a simple selection of Develop->Start Debugging JavaScript from the menu button, a fully functional debugger is added to the bottom of the window and it allows you to set breakpoints, see the call stack and inspect all the elements being used within the JavaScript code being run.  This has been the most helpful when I’ve located the method in which a problem is occurring, but can’t figure out why exactly it is happening.  All it takes is setting a breakpoint, running the code to the breakpoint, then stepping through the code line-by-line and watching all the scope variables to see if one does not have the value I think it should.  More often than not, I find out a variable is null or undefined when I thought it should have had a value.

The fourth option, I’ve used when debugging AJAX methods within my code.  Using a tool called Fiddler, a web debugging proxy, I can intercept all messages being passed between the server and the browser and see exactly what is being passed in the AJAX commands.  I’ve found Fiddler to be the most helpful when used in conjunction with another tool, like WebKit’s JavaScript debugger.

These four options do a very good job of helping me determine where errors are within the code and fixing them.  When it comes to speeding up JavaScript, a JavaScript Profiler is what is needed.  Safari with WebKit has a nice one that can be started with the Develop->Start Profiling JavaScript menu choice and FireFox has a nice one with the YSlow plugin.  In the case of profilers, I find YSlow to be a bit nicer since it will profile the page and return hints on how to speed up the loading of the page.  However, that doesn’t mean that Safari’s JavaScript profiler is worthless — I’ve used it an awful lot too.  It does a very good job as well.  Lastly, Fiddler has a very good profiler for determining the time it takes for various elements within the HTML to be transferred from server to client.

Hopefully these four options I’ve shown will give you a better idea of tools that can be used to debug and profile JavaScript in order to have bug-free code with a swiftly loading web page.  If there are any other tools that I’ve missed, or debugging methods that you’ve found helpful, let me know in the comments section and I’ll update this page accordingly.

Programming Classes in Javascript

After mucking around in all sorts of Javascript problems, I’ve come to the realization that not many people know how to write Object-oriented code in Javascript.  Initially I had written out a fairly simple Math class in Javascript that people could see how to do all of it.  Then I saw this article on Mozilla’s web site, which pretty much made my attempt worthless. So, even though it is a few years old, it is definitely worth the time to read the article.