June 30th, 2009

What’s the deal with fruit allergies?

The whole fruit allergy thing is SO bothersome.  And I’m not talking about just having fruit allergies, which is annoying, to say the least, but I’m also talking about the mystery surrounding where they come from.  There are tons of postings all over the web, but none really point to any quality information about how to rid yourself of those darn allergies!  If you do a search for “Oral Allergy Syndrome,” you’ll end up with lots of posts and articles on the subject.  Pretty much every one of them says that fruit allergies are on the rise, in general, and that the cause isn’t known or understood.  The only suggestion they make is to stop eating the fruits that produce an allergic reaction.  Not too helpful.

I can’t make any promises to you about getting rid of your fruit allergies.  But what I can offer you is the hope of getting rid of them.  I was able to get rid of mine, and it makes me believe that there’s no reason that you can’t get rid of yours.  The hard part, of course, is figuring out how to go about doing it.

A brief background of my history with fruit allergies

Throughout junior high and high school I was one of those kids who took an apple to lunch with me every day.  I loved apples.  I liked other fruits too, but during that period of time, apples were my thing.  One day in high school I began to notice that after eating an apple my throat and mouth would get itchy, and I’d get some bumps and general swelling around and on my lips.  It got progressively worse over time, and I eventually stopped eating apples. The really sad part was that I had to stop eating pears, strawberries, cherries, peaches, nectarines, and plums too! Some people talk about pesticides as a possible cause for these allergies, but I would react equally to organic fruit, so I don’t think that had anything to do with it.  I should also note that people often tend to associate fruit allergies with people who get spring allergies, and I do deal with allergies in April and May, so that’s certainly a possible link.  However,

The tide eventually turned…

When I was in my mid-twenties I met a super-sweet vegetarian girl who’s diet soon rubbed off on me.  Admittedly I was never much of a red-meat eater.  I typically stuck mostly to chicken, turkey, pork, and fish, until I made a dramatic shift and stopped eating all animal products. After about 6 months of being vegetarian (vegan, technically), I had a piece of an apple and thought to myself that the allergic reaction it produced was much weaker than it used to be.  I didn’t think much of it at the time, but I did make a mental note for future reference.  After about a year of being vegan, the allergy was 90% gone and I was back to eating every fruit that once caused problems for me! It didn’t take too much longer before I was 100% back to normal with no allergic reactions to any fruits.  I can’t tell you how exciting this was, especially since I love fruit and wanted to eat so much more.  After all, I had become a vegan, and I needed to get my nutrition from somewhere!  These days I’m a raw foods enthusiast who eats probably about 50% of my diet as uncooked whole fruits and veggies, and I can’t tell you how much I enjoy eating fruits with no itchiness or swelling.

Why I believe my fruit allergies disappeared

First off, let me say that I’m not here to promote vegetarianism.  Really, that’s not my goal.  I can’t even say that I think animal products were necessarily the cause of my allergies.  Animal products might have caused my fruit allergies, or to be more specific, it’s possible that a particular animal product might have caused my fruit allergies.  However, I’m more inclined to think that it was something in one or more of the animal products I was eating.

When I initially shifted to being a vegetarian, the most dramatic change I made in my diet was to eliminate poultry and tuna.  Prior to making the switch, poultry was the one thing I ate virtually every day, and tuna was something that I ate quite regularly as well.  Admittedly I made other changes during that time, but none was so pronounced.  It was already the case that I barely ate any dairy (I hated dairy ever since I was a kid), so I don’t think it was related to that.  I switched to eating organic during that time period too, but that was a gradual shift, and my gut instinct is that it wasn’t related to the fruit allergies because even today I still eat plenty of non-organic foods.  I think the fruit allergies had begun to disappear before I really started focusing on the switch to organic foods anyway.

Every time I think about the possible causes, I always fall back on the poultry.  Something about the poultry had to be causing my allergies! I’ve spent a lot of time over the past 5 years pondering the possible causes of my fruit allergy.  While I admit that it’s impossible to say with absolute certainty what the cause was, I feel quite sure that it was the ground turkey in my diet (or perhaps more specifically it was the anti-biotics in the ground turkey).  When I was in high school ground turkey became a very popular as a low fat, low cholesterol alternative to ground beef.  I started making ground turkey chili, turkey burgers, and ground turkey sloppy joes ALL the time.  It was in high school that I also started having an allergic reaction to fruit.

If I had to make one recommendation to a person suffering from fruit allergies…

… Do you eat a lot of poultry?  Do you eat a lot of turkey or ground turkey products?  Cut it all out of your diet right away.  Ideally I think you should stop eating all non-organic meat, dairy, and poultry for a period of 1 year.  However, in my case I feel pretty strongly that the cause was specifically the poultry, and most likely the turkey, so if you eat a lot of turkey you should definitely cut it out of your diet and see what happens.  You should also consider switching to all natural or organic meat and dairy products that contain no hormones, antibiotics, or other chemicals.  See if this make an impact.  I was able to notice after only about 6 months that my allergies were going away, so I think 1 year should be sufficient for most people to detect a dramatic change.

Good luck.  I know how much allergies can put a damper on your ability to enjoy nature’s BEST food.  I’d love to hear your thoughts and comments on this one, especially if you make the dietary shift.

June 26th, 2009

I got into a conversation the other day with a friend about what I’ll call “moments of clarity.” Initially we were just talking about religion and god and all that sort of stuff, which I find endlessly interesting. She’s a christian, she attends church regularly, she absolutely believes in god… you get the drift.

I asked her if at any point in her life she had an experience or set of experiences that reaffirmed her belief in god. I wanted to know if there there was an experience that she walked away from thinking to herself something along the lines of…

“No one could deny god’s existence if he/she could stand in my shoes right now, having experienced what I just experienced.”

The first example she gave me was a car accident that she survived a few years earlier. She explained to me how god had saved her and it was his will that let her live. Now, you have to understand that despite having thought long and hard about god and religion, I was still so naive and ignorant to christianity that I didn’t know that people actually believe in the devil. For some reason I thought that people believe in god, but that no one took seriously the concept of a devil. What an idiot I was to assume that.

So, after she explained to me how god had allowed her to survive the accident, the first question that came to my mind was…

“If god saved you from the accident, then who or what caused it?”

Being ignorant of the concept of the devil, I fully assumed that the answer had to be that god not only saved her from dying but also caused the accident to happen, and that his will is mysterious (or something like that). However, I was shocked when she told me that it was the devil who had caused the accident. I had to clarify to make sure I was hearing correctly.

“The devil caused your car accident– the one that almost killed you– but it was god who stepped in just in the nick of time to save you?”

I figured that the next question was obvious, but it actually seemed to catch her off guard. I asked…

“If the devil caused the accident, and god saved you from dying in it (after all, he’s all-knowing, all-powerful, and all-good), then why didn’t god just prevent the accident from occurring in the first place?”

She stared at me blankly.

June 24th, 2009

You can find the full post here: http://www.dougzuck.com/hta

Get_General_Info

June 24th, 2009

You can find the full post here: http://www.dougzuck.com/hta

get_sql_backup_history

June 14th, 2009

This is the simplest way to execute work in a separate thread and have it report back to the UI thread

When you’re creating a Windows Form Application using Visual C# 2008, there are some tricky threading issues that need to be dealt with in order to keep your application running smoothly.  Specifically, you have to be very aware of how your application does work.  If you simply create a worker function and then call it, it’s going to execute in the current thread, which is also the thread that’s handling the user interface.  The result really stinks because your UI will completely lock up until the worker thread is finished executing.  This is unacceptable in nearly all situations.

I want to show you what I believe is the absolute simplest way for executing a worker function in a separate thread while still allowing that separate thread to send information back to the main UI thread, whether it be to update a text box, a label, or a field in a datagridview.

In this example we’re going to click a button to launch our worker function, which will count from 1 to 15.  Our user interface will display each number as it counts. 

Also, please pardon the fact that I use ‘function’ and ‘method’ interchangeably in this post.  Technically, I should just be saying ‘method,’ but ‘function’ always slips out.

Download the entire Visual Studio project here: UI_Threading_Example_CSharp.zip

UI_Threading_ExampleUI_Threading_Example(2)

Let’s take a look at the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Windows.Forms;
using System.Threading;
 
namespace UI_Threading_Example
{
    //declare the delegate that we'll use to launch our worker function in a separate thread
    public delegate void workerFunctionDelegate(int totalSeconds);
 
    //declare the delegate that we'll use to call the function that displays text in our text box
    public delegate void poplateTextBoxDelegate(string text);
 
    public partial class Form1 : Form
    {
       public Form1()
       {
          InitializeComponent();
       }
 
       //this function will simply write text to our text box
       //this function will later be called from a worker thread through the use of a delegate using the Invoke method on the form
       void populateTextBox(string text)
       {
          textBox1.Text = textBox1.Text + " " + text;
       }
 
       //this function simulates "work" by simply counting from 1 to totalSeconds
       void workerFunction(int totalSeconds)
       {
          for (int count = 1; count <= totalSeconds ; count++)
          {
             //we use this.Invoke to send information back to our UI thread with a delegate
             //if we were to try to access the text box on the UI thread directly from a different thread, there would be problems
             this.Invoke(new poplateTextBoxDelegate(populateTextBox), new object[] { count.ToString() });
             Thread.Sleep(1000);
          }
       }   
 
       //this function is executed when we click the first button in the windows form
       //this is the PROPER WAY to do work in a UI situation
       //the worker function is launched in a separate thread so that our UI will remain responsive while it does work
       private void buttonNewThread_Click(object sender, EventArgs e)
       {
          workerFunctionDelegate w = workerFunction;
          w.BeginInvoke(15, null, null);
       }
 
       //this function is executed when we click the second button in the windows form
       //it's an example of WHAT NOT TO DO because if we click this button
       //the UI will become completely unresponsive for 15 seconds while the worker fucntion is executed
       private void buttonCurrentThread_Click(object sender, EventArgs e)
       {
          workerFunction(15);
       }
 }

OK, so here’s what we’ve got.  In Visual Studio (I’m using Visual C# 2008) I’ve created a new Windows Form Application and then in the designer window I added a text box (called textBox1) plus two buttons (called buttonNewThread and buttonCurrentThread).

In the code window I created two functions:

1
2
void populateTextBox(string text)
void workerFunction(int totalSeconds)

plus a delegate for each function:

1
2
public delegate void poplateTextBoxDelegate(string text);
public delegate void workerFunctionDelegate(int totalSeconds);

The first function is responsible for writing text to our text box.  The second function is responsible for doing “work,” which in this case is just counting from 1 to 15 and calling the function (using a delegate) to display the count in our text box.  Additionally there are two other functions (buttonCurrentThread_Click and buttonNewThread_Click) which handle the button clicks from our UI:

What’s the deal with delegates in this example?

In order to launch a worker function in a separate thread we have to declare a delegate for that function.  The delegate declaration must be outside the class declaration, and the delegate for each function must have the same format as the function that it’s going to be used to call.  So for example, if your worker function has 3 parameters, your delegate must also have 3 parameters.  And in this example, we not only need a delegate to handle launching our worker function in a new thread, but we also need to declare a delegate that we’ll use from within the worker thread to call a function to update the text box on the UI thread.  It is NOT ok to try to update a text box in the UI from a different thread without the use of a delegate.  If you don’t believe me then give it a shot and you’ll see for yourself that the results are funky.

The WRONG way to execute the worker function (using the UI thread)

When you click the button to execute the worker function in the current thread, which is the same thread that handles the UI, then you’ll see that for 15 seconds you can’t do anything with the UI or even move the form window to a new location.  At the end of 15 seconds the UI becomes responsive again and you see a “15″ in the text box.

1
2
3
4
5
//This is the WRONG way to do it
private void buttonCurrentThread_Click(object sender, EventArgs e)
{
   workerFunction(15);
}

The RIGHT way to execute the worker function (using a separate thread)

When you click the button to execute the worker function in a new thread, you watch the count from 1 to 15 displayed in the text box and the UI is not frozen.

Note that the null values are required by the BeginInvoke method.  If you have a function that requires more than one parameter, you would still pass all your parameters in first, followed by the two nulls.  In this example we’re effectively passing the value 15 to the worker function which will then execute for 15 seconds.

1
2
3
4
5
6
//This is the RIGHT way to do it
private void buttonNewThread_Click(object sender, EventArgs e)
{
   workerFunctionDelegate w = workerFunction;
   w.BeginInvoke(15, null, null);
}

The proper way to update the text box in the UI from the worker thread using the Invoke method of the main form

The format can definitely get a little confusing, but hopefully you can follow along and mimic it for your application.  Instead of accessing the text box directly from the worker thread, which will cause problems, we instead invoke a method (using a delegate) that accesses the text box. Note that our populateTextBox function has one parameter, which is a string.  We want to write the current count to the text box using that function, so we have to convert it to a string.  If we were passing multiple variables to the populateTextBox function, the format would still look the same, and we’d simply separate the variables inside the curly braces by a comma.

1
2
3
4
5
6
7
8
9
//update the text box by using a delegate to call a function on the UI thread that will do the update
void workerFunction(int totalSeconds)
{
   for (int count = 1; count <= totalSeconds ; count++)
      {
         this.Invoke(new poplateTextBoxDelegate(populateTextBox), new object[] { count.ToString() });
         Thread.Sleep(1000);
      }
}
June 11th, 2009

The newest version of Remote Reboot X is now available here!  There is no app that can match the remote reboot capabilities of RemoteRebootX.  It will allow you to install WSUS updates and remotely reboot a very large number of computers simultaneously, while also being able to monitor their statuses.

Remote Reboot X

rrx1.5b

June 7th, 2009

You can find the full post here: http://www.dougzuck.com/hta

get_sql_db_sizes

June 7th, 2009

You can find the full post here: http://www.dougzuck.com/hta

getdiskspace

June 7th, 2009

The MSDB database maintains a record of all SQL backup jobs that have been executed.  Specifically you can find this information if you query MSDB..backupset.  This script joins sys.databases, so that if a database exists but has not been backed up yet, it will still be displayed in the results.  If you were to query the backupset table alone without the JOIN statement, you wouldn’t see any entries for databases on the server that have not been backed up.  Also note that this particular script assumes that you’re only interested in Full and Differential backups.  You could easily modify it to include information about Log backups.

Download the script here: SQL Backup History

I’ve also posted a HTML Application (HTA) version of this script as well, which you can see here: http://dougzuck.com/hta

OK, let’s take a look at the code…

SELECT @@servername AS server_name, s.name AS database_name, backup_type =
CASE
    WHEN b.type = 'D' THEN 'Full'
    WHEN b.type = 'I' THEN 'Diff'
END,
MAX(b.backup_start_date) AS last_backup_start_time,
DATEDIFF(d, MAX(b.backup_start_date), getdate()) AS days_since_last_backup, STATUS =
CASE
    WHEN b.type = 'D' AND DATEDIFF(d, MAX(b.backup_start_date), getdate()) <= 7 THEN 'OK' /*if the most recent full backup was less than or equal to 7 days ago, we're OK*/     WHEN b.type = 'D' AND DATEDIFF(d, MAX(b.backup_start_date), getdate()) > 7 THEN 'Possible Problem' /*if the most recent full backup was more than 7 days ago, Possible Problem*/
    WHEN b.type = 'I' AND DATEDIFF(d, MAX(b.backup_start_date), getdate()) <= 2 THEN 'OK' /*if the most recent diff backup was less than or equal to 3 days ago, we're OK*/     WHEN b.type = 'I' AND DATEDIFF(d, MAX(b.backup_start_date), getdate()) > 2 THEN 'Possible Problem' /*if the most recent diff backup was more than 3 days ago, Possible Problem*/
    WHEN MAX(b.backup_start_date) IS NULL THEN 'No Backup Exists'
END
FROM sys.DATABASES s LEFT JOIN msdb..backupset b
ON s.name = b.database_name
WHERE s.name <> 'master' AND s.name <> 'model' AND s.name <> 'msdb' AND s.name <> 'tempdb'
GROUP BY s.name, b.type
ORDER BY s.name

You can see in the results screenshot below that I haven’t done backups of my local databases in a long time, which is why the status column is indicating there’s a “Possible Problem.”
backup_history_query_results

May 19th, 2009

As if anyone really gives a crap what I have to say.  What’s next?  I’ll probably be updating my Facebook status, changing my IM away message, and Twittering to round out the complete dooshbaggery.  I should have been in bed hours ago, but instead I’m doing way more important things.  Clearly.

Anyway, I’m just beginning to get this site off the ground, and while I have a very good idea of what I want to do with it, there are also tons of question marks.  Writing is not exactly my forte, so I’ll probably try to limit the philosophical rants, while maximizing the guides, tutorials, utilities etc.  We’ll see how it goes.