Sharing and Swapping Food

One of the centerpieces of self-sufficiency is, surprisingly enough, sharing and swapping food with neighbors. Yes, it’s possible to grow everything you need yourself, but absolutely everyone has a bad year in something. In addition, your soil and gardening techniques may produce copious quantities of one item, but prove dangerous, or even fatal, to other items. Your neighbors will have similar luck with other items. Consequently, swapping items between neighbors is one of the hallmarks of a self-sufficient community. The community as a whole benefits in such a situation because everyone ends up with a greater variety of food to eat. So, while you can grow what you need, you’ll eat better when you swap with someone else.

It isn’t just the garden though. Just about everything is swapped at times. One person may have an abundance of chickens and trade a chicken or two for some beef. These swaps aren’t done on a strict accounting system. People tend not to get too caught up on the price of the food—they’re more interested in exchanging something they have in excess for something they need. Of course, no one would swap an entire cow for just one chicken either . While the swaps aren’t strictly fair, they’re reasonably sono one tries to take advantage of someone else (otherwise, the community as a whole would stop swapping with them).

There are times when people simply share food, which is where the country ethic comes into play. We’ve shared wine, soap, or cookies with other people simply because we think they’re nice people and want them to enjoy something we’ve made. There is no other motive behind the act, other than seeing the smile on the other person’s face. It makes us feel good to see how others react when we do something nice for themacts of kindness are their own reward.

People have also shared with us. One winter we were extremely low on wood and I wasn’t able to get out and cut any. Our neighbors sent three cords of wood our wayan extreme act of kindness that we’ll never forget. We recently received a nice buck from some friends for nothing more than a smile. It isn’t often that you can fill your freezer with venison because of the kindness of someone else. The 65 pounds of meat is nice, being able to use the tenderloin for Christmas dinner is even nicer. I’ll make some lovely venison medallions (with wine we’ve made no less). It will be an extremely special Christmasone we’ll never forget.

Our swapping and sharing often extends outside our local village. Other good friends recently sent us a decadent cake that we’ll share with family and friends here. We’ll send a fruitcake their way later this week. I wish that our friends could have seen the smile on our faces when we received the cakeperhaps they felt the warmth of our feelings from afar (and certainly we’ve thanked them for their fine gift).

If you choose to become self-sufficient, don’t get the idea that you’re an island. No one is separate from the entire world. The more self-sufficient you become, the more you realize that the self-sufficiency of the community in which you live is important. It doesn’t matter if you live in the country, as we do, or in the city. The need to depend on others and also experience the joy of giving to those in need is possibly the best part of being self-sufficient.

Does your community swap and share? How are you experiencing the kindness of others during this holiday season? Have you done something kind, something totally unexpected for someone else? Let me know at John@JohnMuellerBooks.com.

Choosing an Appropriate Stove

I’m not here to recommend a particular stove or brand of stove. I’ve found over the years that a stove that works for one person, doesn’t work at all for someone else. We all have different ideas of precisely what makes the perfect stove. For example, some people prefer white stoves, while others think that colors are the way to go. The selection of stoves is also limited by local availability and the size of your pocketbook. I’m sure that there are some people reading this who will merrily spend $5,000.00 or more on a stove and never think twice about it. So, I’m not here to tell you that a particular stove is the end all invention of stoves because it probably isn’t true in your case. Stoves used for self-sufficiency purposes, especially canning, do have some features in common though and that’s the point of this post.

Glass top stoves are completely out of the question if you want to can. Even the vendors will tell you that placing a heavy canner on a glass-topped stove is doomed to failure (or at least breakage of the top). That said, I know of at least one person who uses their glass topped stove for canning, quite successfully I might add. Still, it’s probably not a very good idea and forget about any warranty work if the vendor discovers that your stove top broke from canning.

We tried an electric stove that was specifically designed for canning. The vendor even talked about canning in the manual. This stove came with some high wattage burners designed to heat the water more quickly. The problem is that the electric stove doesn’t get enough air flow to cool the burners (as odd as that might sound) when a big canner is sitting on top of the elements. I ended up replacing the burners almost every year because the metal holding the elements together would sag and eventually the pot ended up resting right on top of the stove (with the resultant fire hazard). After the stove burst into flames the second time (and I was looking at rewiring it yet again), I decided that electric wasn’t going to make it for us. That said, I know of more than a few people who do successfully use electric stoves for canning. Almost every one of them has removed the vendor-supplied burners and provided heavier duty canning burners. AP Wagner is one place that sells these burners—be prepared to pay an arm and a leg for one (a burner that normally runs around $30.00 will cost nearly $80.00 in canning burner form), if you can even find one to fit your stove.

That leaves gas stoves. Even here you can make some serious mistakes. Look for a gas stove that specifically mentions canning in the manual. Check out reviews from other people who use the stove for canning purposes. The grates should be quite heavy if you plan to use the stove for canning because a canner is quite heavy (especially when working with a pressure canner). Make sure the grates aren’t so high that they actually prevent good heat transfer to your canner. It’s a good idea to obtain a gas stove that has at least one power burner (more is better). Unfortunately, the power burner will also trash any sort of sauce you try to make with it, so a simmer burner is also a good idea. The stove we finally purchased has one standard burner, two power burners, and a simmer burner. We’re finding that it works extremely well for every task.

No matter which stove type you choose, make sure it has a porcelain finish and not a painted finish. Some vendors will try to pawn a painted finish off on you and the paint is guaranteed to peel from the heat generated from canning. Unless you like the idea of repainting your stove with high temperature paint (nasty stuff) on a regular basis, porcelain is the only way to go.

Another issue to consider is the size of the back panel. Many stoves have back panels that jut out as a fashion statement. Unfortunately, the back panel design also makes it impossible to use the back burners with anything larger than a small pan. This sort of stove is unlikely to work well for canning purposes (Rebecca and I know, we’ve tried). If nothing else, take your pans to the store and test fit them on the stove before you buy. You really don’t want to discover that your pans won’t fit after the stove is already installed in your home.

If you’re using your stove for canning like we do, then you’ll find that it takes a lot of abuse. We bought one with as few gizmos as possible because gizmos tend to break easily when you use them a lot. Simpler is better when it comes to canning. To help make the stove even more reliable, make sure you read the manual that comes with it and perform all of the vendor-recommended maintenance, including the required cleaning. For example, we found out that ammonia really does work better for cleaning the stove than other cleaners. (We tried it as part of the vendor-recommended maintenance.) The ammonia fumes are quite nasty, so we run the hood on high speed during cleaning to remove them.

Our results may vary from yours, but we’re also finding that gas is less expensive to can with than electric. I’m still trying to figure out precisely how much less, but my preliminary estimate shows that you save about 17% using gas over electric. In order to come up with a precise number, I’m going to have to figure out how many BTUs are required to perform a typical canning operation on each device, and then compare the per BTU costs of each fuel source. We’ve also discovered that canning with gas takes less time because the water heats more quickly. You should know though that we’re using propane and that could change the economics of canning. Choose carefully if you value long term costs as part of your purchasing decision.

What sorts of things have you found important when choosing a stove? Let me know at John@JohnMuellerBooks.com.

 

Understanding the Relative Insecurity of SCADA Systems

It wasn’t long ago that I wrote about how Supervisory Control and Data Acquisition (SCADA) systems affect those with special needs in Security and the Special Needs Person. I then posted an update on that original message in An Update On Special Needs Device Hacking. In both cases, I decried the lack of security for SCADA systems that affect those with special needs. I realize that only a truly nasty person would turn off someone’s insulin pump in order to kill them, but our world is unfortunately filled with some pretty nasty people.

One person (who shall remain nameless) wrote to tell me that it was fine that I was worried about special needs people, but that he wasn’t worried about it because these problems don’t affect him. Well, let’s say that you truly are superhuman and will never once need to use any sort of special needs device in your entire life (statistically, you’d really need to be superhuman or die early). Let’s put the whole SCADA issue in another light. Let’s look at your car.

Your car contains SCADA systems. Those ads you see for turning your car on, opening the windows, flashing the lights, and so on using a cell phone are really telling you about the SCADA systems in your car. If you can access your car using a cell phone, someone else can do the same thing. All they need to do is break the security, which someone has already conveniently done for them. CNET News recently ran an article about how an expert hacker had broken into a car.

Imagine now that you’re on an off-ramp. There are cars crowding you on both sides. A crook uses his cell phone to turn off your car engine and unlock the doors. Bam, you’re suddenly in a world of hurt because the car manufacturer thought it would be a neat idea to let you control your car using a cell phone. I have to wonder why such control is even necessary. Does it even serve a useful purpose? If so, why can’t it be secured better?

Of course, not every drives. So, let’s look at another SCADA issue. A recent InfoWorld article states bluntly that our water system is already under attack by hackers. Sure, the hackers are only kicking the tires of their new toy for now, but how long do you think they’ll wait to do something truly terrifying to your water supply? The experts have been warning about this sort of attack for quite some time, but everyone ignored them as being sensationalists. The sad thing is that the experts probably didn’t scream loud enough this time.

Someone out there is probably thinking that the bad guys can overcome physical security too. You’re right, of course. Someone can remove a padlock, jimmy a car, and overcome physical security in all sorts of other ways. The point is that the bad guy has to be in physical contact with the object to overcome it when you’re using physical security. In addition, if you’re nearby, a physical security system often buys you enough time to call the police or obtain help in some other way. The remote control nature of SCADA systems makes it possible for someone to break into the system and do something nasty with it long before you’re even aware of the intruder.

SCADA systems make a modern world possible by allowing remote control of many of the devices that we need to live. I can fully understand how a utility would need to monitor and control a system from a remote location, and how such control actually makes the system safer. However, it’s time that we realize that these systems are dangerous in the wrong hands and that we need to do something about them before a major accident occurs. Here are some ways to make SCADA systems better:

 

  • The SCADA systems we do need should be secured better.
  • All SCADA systems should be restricted to wired connections only and those wired connections should be on a private, secure, network.
  • Researchers should be advised not to research break-ins for hackers to use (and then publish them for the whole world to see).
  • Our society also needs to seriously consider where SCADA systems can be removed.


Remote control is a two-edged sword and you can bet the bad guys have no compulsion about playing dirty—count on them not following the rules. If there is a way for you to access something, the bad guys will find a way to access it too. Let me know what you think about the threat of SCADA system break-ins at John@JohnMuellerBooks.com.

 

The Sublime Art of Thankfulness

As we prepare for another Thanksgiving with the usual turkey, parades, and sports, it’s time to consider the sublime art of thankfulness. For many people, please and thank you, when offered at all, are quickly proffered sentiments, rushed out at a moment’s notice. However, on this particular day, something a little more noble is required, in keeping with the holiday. After all, the very act of breathing is reason for praise for someone with emphysema. Why not for the rest of us?

It’s a privilege to discover the source and emanation of true thanksgiving at times when life has handed you something less than ideal gifts in the minds of those around you. Seeing the foot of a loved one move when the doctors have said that she’ll never walk again is a wonderment beyond measure. A joyous occasion evoking streams of tears at something so small and commonly accepted as normal. The delight of a sunrise, flowers in fall, family togetherness, and more all provide reasons for thankfulness because they can be so easily taken away, never to return.

Thankfulness is a process of the heart, not of the mind. The mind doesn’t understand it, but heart feels it to the bottom of the soul. An overflowing cup rarely consists of the material, but rather those things that can’t be purchased with any amount of money nor with any labor, no matter how monumental. So on this day of Thanksgiving, take time to consider thankfulness, the divine moment of gratitude for all that we have and not the rash expression of any lack. It’s my sincere wish that you have an amazing Thanksgiving filled with the delights of laughter and the closeness of those you love most.

Rebecca and I will be taking Thanksgiving weekend off. For this reason, you won’t see any posts from me either Thursday or Friday. We’ll continue working through the GrabAPicture program next week. Thank you for your continued support of me and the materials I write. I’m truly grateful that you’ve given me the opportunity to serve your needs.

 

Considering the New Metro Interface—Ribbon Redux?

Microsoft has made it quite plain that the new Metro interface will be the default interface for Windows 8. All one has to do is spend some time looking at the Building Windows 8 blog posts to discover this fact—Metro appears all over the place. In fact, Microsoft is adamant that you will like the Ribbon and Metro whether you want to or not. Of course, this means preparing developers to create applications for the Metro interface. However, the current emphasis is in trying to convince people that they won’t miss out on anything by using the old Start menu interface, but that they’ll really want to use the Metro interface for maximum functionality. Both interfaces use the same low level functionality and rely on the same HTML5 engine.

Something that began to worry me though is that Microsoft seems to be espousing an architecture that is more closed and propriety with Metro. For example, they tell you that the Metro-style Internet Explorer interface isn’t going to support plug-ins and that it’s a good thing it doesn’t. When has restricting third party add-ins ever made something better? One of the things that has made Windows a great platform over the years is that Microsoft has encouraged third party additions that make a stronger offering. Anything that Microsoft can’t offer is provided by third parties—users are free to pick and choose what they want as part of their application experience.

Microsoft’s decision to close their architecture actually began with the Ribbon. One of the reasons I wrote RibbonX for Dummies and updated VBA for Dummies was to help VBA developers to continue creating add-ins for Office products. (You can read my continued posts about these books in the RibbonX for Dummies and VBA for Dummies categories.) Now Microsoft is closing something else—Internet Explorer—a central part of the Windows experience.

I’m not the only one who has concerns about Metro, nor am I the only one who has noted that the Ribbon actually slows power users considerably. A recent ComputerWorld article discusses the problem of both interfaces slowing business users and the fact that Metro will require hardware updates for maximum functionality, despite Microsoft’s protestations to the contrary. I think that the Ribbon does indeed help the less skilled, non-geek, user to become more productive with less effort, but at the cost of hampering everyone else. I’ve learned though to wait to see how things work out. With the Ribbon, I think more people have won than lost, but those who have lost productivity have lost in a big way. Metro may prove to be more of the same. At least you can select the old Start menu interface if desiredOffice didn’t offer this option without a third party add-in.

What concerns me right now though is that Microsoft added a host of productivity enhancements to Windows 7 that really did make sense. I use many of them every day now and I’ve talked about them in Professional Windows 7 Development Guide. These enhancements apparently go by the wayside when you use the Metro interface, which makes me wonder why Microsoft developed them in the first place. I find that the new Windows 7 enhancements really do workI’m able to open my documents and get to work considerably fasterI feel much more informed about my work environment. It seems a shame that these enhancements will be left by the wayside if Microsoft ends up making Metro the only option a future version of Windows.

What do you feel about the new Metro interface? Is it a productivity enhancement or an impediment to getting things done quickly? I’m curious because I’ll eventually need to update my books for Windows 8. Which interface do I focus on during these updates? When you send your opinion, please let me know whether you’re speaking as a home user or as a business user. Let me know your thoughts at John@JohnMuellerBooks.com.

 

Creating Useful Comments

A major problem with most applications today is that they lack useful comments. It’s impossible for anyone to truly understand how an application works unless the developer provides comments at the time the code is written. In fact, this issue extends to the developer. A month after someone writes an application, it’s possible to forget the important details about it. In fact, for some of us, the interval between writing and forgetting is even shorter. Writing good comments is a main topic in C# Design and Development as part of Chapter 13, but I make the topic part of every application development book I write. Despite my best efforts and those of many other authors, many online examples lack any comments whatsoever, making them nearly useless to anyone who lacks time to run the application through a debugger to discover how it works.

Good application code comments help developers of all stripes in a number of ways. As a minimum, the comments you provide as part of your application code provides these benefits.

 

  • Debugging: It’s easier to debug an application that has good comments because the comments help the person performing the debugging understand how the developer envisioned the application working.
  • Updating: Anyone who has tried to update an application that lacks comments knows the pain of trying to figure out the best way to do it. Often, an update introduces new bugs because the person performing the update doesn’t understand how to interact with the original code.
  • Documentation: Modern IDEs often provide a means of automatically generating application documentation based on the developer comments. Good comments significantly reduce the work required to create documentation and sometimes eliminate it altogether.
  • Technique Description: You get a brainstorm in the middle of the night and try it in your code the next day. It works! Comments help you preserve the brainstorm that you won’t get back later no matter how hard you try. The technique you use today could also solve problems in future applications, but the technique may become unavailable unless you document it.
  • Problem Resolution: Code often takes a circuitous route to accomplish a task because the direct path will result in failure. Unless you document your reasons for using a less direct route, an update could cause problems by removing the safeguards you’ve provided.
  • Performance Tuning: Good comments help anyone tuning the application understand where performance changes could end up causing the application to run more slowly or not at all. A lot of performance improvements end up hurting the user, the data, or the application because the person tuning the application didn’t have proper comments for making the adjustments.


I had previously mentioned the need for good comments. Some developers write comments that are nearly useless. Although it’s hard to encapsulate the substance of a good comment, developers who answer these sorts of questions are well on their way to writing good comments.

 

  • Who is affected by the code?
  • What is the code supposed to do?
  • When is the code supposed to perform this task?
  • Where does the code obtain resources needed to perform the task?
  • Why did the developer use a particular technique to write the code?
  • How does the code accomplish the task without causing problems with other applications or system resources?


There are many other questions you could ask yourself, but these six questions are a good start. You won’t answer every question for every last piece of code in the application because sometimes a question isn’t pertinent. As you work through your code and gain experience, start writing down questions you find yourself asking. Good answers to aggravating questions produce superior comments. Whenever you pull your hair out trying to figure out someone’s code, especially your own, remember that a comment could have saved you time, frustration, and effort. What is your take on comments? Let me know at John@JohnMuellerBooks.com.

 

Exploring the GrabAPicture Application (Part 10)

In the previous post, Exploring the GrabAPicture Application (Part 9), I discussed the command line interface for the GrabAPicture application. This week we begin looking at the GUI controls for frmMain, which is the first form the user sees. Here’s how this form appears when you’re using it.

GrabAPicture1001

It’s important to analyze the functionality of this interface. You can divide the tasks that it performs into the following areas:

 

  • Dialog Box Management (dialog box configuration and Close button)
  • Direct Wallpaper Access (Wallpaper Location text box, radio buttons in the Style Selection group, and Set Value button)
  • Wallpaper Database Access (Random Sources button)
  • Command Line Interface Configuration (Use Random Local Sources and Use Random Remote Sources check boxes)

It’s helpful to perform such an analysis of any interface you design. Doing so makes it possible to look for ways to make the application more efficient (by reducing the number of controls when possible) and easier to use (by placing some controls on another form). Theoretically, you could make this application more efficient by making the Command Line Interface Configuration part of the command line interface. Likewise, you could make it easier to use by placing the Direct Wallpaper Access controls on a separate form. However, the form is relatively simple as is and most people won’t have trouble using it. This post discusses all four areas in the order shown.

Dialog Box Management

Part of the dialog box management task is to configure the form when you first start the application. This application, like most applications out there, uses the Load event to perform the task. In this case, it means using the frmMain_Load() handler shown here.

' Current application settings.
Dim CurrentSettings As GrabAPictureSettings
 
Private Sub frmMain_Load(ByVal sender As Object, _
                         ByVal e As System.EventArgs) _
                         Handles MyBase.Load
 
   ' Create an instance of the WinWallpaper class to gain
   ' access to the current Windows settings.
   Dim Wallpaper As New WinWallpaper
 
   ' Get the current wallpaper URI and display it.
   txtWallpaperURI.Text = _
      Wallpaper.WallpaperURI.ToString()
 
   ' Get the current wallpaper style.
   Select Case Wallpaper.Style
      Case WinWallpaper.Styles.Stretched
         rbStretched.Checked = True
         rbCentered.Checked = False
         rbTiled.Checked = False
      Case WinWallpaper.Styles.Centered
         rbStretched.Checked = False
         rbCentered.Checked = True
         rbTiled.Checked = False
      Case WinWallpaper.Styles.Tiled
         rbStretched.Checked = False
         rbCentered.Checked = False
         rbTiled.Checked = True
   End Select
 
   ' Initialize the stored settings.
   CurrentSettings = GrabAPictureSettings.LoadSettings()
 
   ' Configure the controls.
   If Not CurrentSettings Is Nothing Then
      cbLocal.Checked = CurrentSettings.LocalChecked
      cbRemote.Checked = CurrentSettings.RemoteChecked
   Else
      ' Define default settings.
      CurrentSettings = New GrabAPictureSettings
   End If
End Sub

The code begins by creating a global GrabAPictureSettings object, CurrentSettings, that contains the content of the user’s wallpaper database. Normally, I prefer not to use global variables because they’re prone to all sorts of problems, especially when the code your working with could be multithreaded (reentrancy problems are extremely tough to debug). However, using the global variable in this case shouldn’t be a problem.

The frmMain_Load() method begins by creating creating a WinWallpaper object, Wallpaper. The reason you must create this variable every time you need it is because external applications can indeed change the wallpaper. If you didn’t create these variable every time, the user could end up using old information. Admittedly, this wouldn’t be much of a problem when it comes to wallpaper, but it’s good practice to follow in every application where an external application could affect your application’s data. The code then uses Wallpaper to set the Wallpaper Location and Style Selection settings of the application.

At this point, the code instantiates CurrentSettings. You know from the Exploring the GrabAPicture Application (Part 8) post that the LoadSettings() method returns Nothing when the user hasn’t saved any settings before, which is always the case when the user starts the application for the first time. This code checks whether CurrentSettings is Nothing after the LoadSettings() call. If so, the application creates an entirely new GrabAPictureSettings object. Otherwise, it uses the existing settings to configure the Use Random Local Sources and Use Random Remote Sources check boxes.

The configuration process is complete. The only remaining task is to provide a means of ending the application. Clicking Close, which is btnCancel, performs this task. Here is the code used to accomplish this task.

Private Sub btnCancel_Click(ByVal sender As System.Object, _
                            ByVal e As System.EventArgs) _
                         Handles btnCancel.Click
   ' Exit with the Cancel code.
   Environment.Exit(DialogResult.Cancel)
End Sub

Notice that this application doesn’t simply close the form. Instead, it calls Environment.Exit() with an ending value of DialogResult.Cancel. The purpose for this approach is that GrabAPicture is designed for use in a batch file. Any batch file you create can rely on the ErrorLevel value to detect how the application exited (see my Understanding the Connection Between Application Output and ErrorLevel post for details), so you must provide a value to detect. It’s good practice not to simply close the form anyway—you should always provide some sort of exit value.

Direct Wallpaper Access

This application provides the means for the user to simply type the full path to a piece of wallpaper, set the style, and then click Set Value to use it. In short, the user could decide not to use any of the random option at all. There is a command line interface feature to allow the user to work this way as well. Here is the code used to provide direct wallpaper access.

Private Sub rbStretched_CheckedChanged(ByVal sender As System.Object, _
                                       ByVal e As System.EventArgs) _
                                    Handles rbStretched.CheckedChanged
   Dim Wallpaper As New WinWallpaper
 
   ' Set the new style.
   Wallpaper.Style = WinWallpaper.Styles.Stretched
End Sub
 
Private Sub rbCentered_CheckedChanged(ByVal sender As System.Object, _
                                      ByVal e As System.EventArgs) _
                                   Handles rbCentered.CheckedChanged
   Dim Wallpaper As New WinWallpaper
 
   ' Set the new style.
   Wallpaper.Style = WinWallpaper.Styles.Centered
End Sub
 
Private Sub rbTiled_CheckedChanged(ByVal sender As System.Object, _
                                   ByVal e As System.EventArgs) _
                                Handles rbTiled.CheckedChanged
   Dim Wallpaper As New WinWallpaper
 
   ' Set the new style.
   Wallpaper.Style = WinWallpaper.Styles.Tiled
End Sub
 
Private Sub btnOK_Click(ByVal sender As System.Object, _
                        ByVal e As System.EventArgs) _
                        Handles btnOK.Click
   Dim Wallpaper As New WinWallpaper
 
   ' Set the wallpaper URI.
   Try
      Wallpaper.WallpaperURI = New Uri(txtWallpaperURI.Text)
   Catch UFE As UriFormatException
      MessageBox.Show("Provide a valid URI!" & vbCrLf & _
                      UFE.Message)
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try
 
   ' Exit with the OK code.
   'Environment.Exit(DialogResult.OK)
End Sub

Each of the check box event handlers performs essentially the same task. They set the Wallpaper.Style property to the appropriate Wallpaper.Styles value. A possible enhancement to these event handlers would be to force them to make the change automatically. The user still has to click Set Value to make the change. After testing this example out with a few willing volunteers, I found it was less confusing if the application waited for the user to click Set Value, rather than have the change occur automatically. The strategy you pursue will likely depend on your users and the complexity of the application you create.

Clicking Set Value calls the btnOK_Click() event handler. In this case, the code performs a conversion of the text the user types into Wallpaper Location to a Uri object. This is the first potential source of an exception. If the text doesn’t form a useful URI, then the application generates a UriFormatException. The assignment could possibly generate other exceptions, so the code adds a general exception handler as well. The act of making the assignment changes the Desktop wallpaper.

This example used to close the dialog box automatically after the user clicked Set Value. A few testers complained about this practice—preferring to experiment with the wallpaper. Consequently, the current version of the example has this piece of code commented out. If you choose to enable the old method of doing things, you’ll want to note that the application will exit with a value of DialogResult.OK in this case, which you can easily trap using the ErrorLevel value in a batch file.

Wallpaper Database Access

Wallpaper database configuration is performed using a combination of frmConfigure (to display the database content) and frmAddEdit (to make changes). When the user clicks Random Sources, the application calls btnConfigure_Click(). This event handler displays frmConfigure so that the user can see the list of configured wallpapers and make changes to the list. The following code shows how to perform this task.

Private Sub btnConfigure_Click(ByVal sender As System.Object, _
                               ByVal e As System.EventArgs) _
                               Handles btnConfigure.Click
   ' Create a new configuration dialog box.
   Dim Config As New frmConfigure
 
   ' Display the dialog box on screen.
   Config.ShowDialog(Me)
 
   ' Update the current configuration settings.
   CurrentSettings = GrabAPictureSettings.LoadSettings()
 
   ' Get the current wallpaper URI and display it.
   Dim Wallpaper As New WinWallpaper
   txtWallpaperURI.Text = _
      Wallpaper.WallpaperURI.ToString()
 
   ' Define default settings if necessary.
   If CurrentSettings Is Nothing Then
      CurrentSettings = New GrabAPictureSettings
   End If
End Sub

The first part of this code looks like any dialog box display code you’ve used in the past. The example creates a frmConfigure object, Config. It then calls the Config.ShowDialog() method to display the dialog box with the current dialog box as the parent. A lot of developers create subordinate dialog boxes without the proper parent, which makes the application behave incorrectly. Always assign a parent to a subordinate dialog box when the subordinate should be dismissed before going back to the parent.

On return, the user has supposedly made changes to the wallpaper database. With this in mind, the application updates CurrentSettings to match the new wallpaper list. In addition, the wallpaper itself may have changed, so the application updates the wallpaper settings as well. The last bit of code may seem confusing at first, but think about it for a minute. The user might have deleted the last wallpaper entry from the list. If this is the case, the application needs to set CurrentSettings to a new instance of GrabAPictureSettings.

Command Line Interface Configuration

The final task for frmMain is at hand. The application needs some method of configuring the command line interface to use the correct random settings. The Use Random Local Settings and Use Random Remote Settings check boxes perform the task. Here is the code for the associated event handlers.

Private Sub cbLocal_CheckStateChanged(ByVal sender As Object, _
                                      ByVal e As System.EventArgs) _
                                   Handles cbLocal.CheckStateChanged
   ' Save the current checked state.
   CurrentSettings.LocalChecked = cbLocal.Checked
   GrabAPictureSettings.SaveSettings(CurrentSettings)
End Sub
 
Private Sub cbRemote_CheckStateChanged(ByVal sender As Object, _
                                       ByVal e As System.EventArgs) _
                                    Handles cbRemote.CheckStateChanged
   ' Save the current checked state.
   CurrentSettings.RemoteChecked = cbRemote.Checked
   GrabAPictureSettings.SaveSettings(CurrentSettings)
End Sub

As you can see, the application sets the correct CurrentSettings property, and then calls GrabAPictureSettings.SaveSettings() with the CurrentSettings object as an argument to save the settings to disk. The result is a change to the user’s disk-based XML settings. A side effect of this process is that the user’s wallpaper list is also saved to disk. The SaveSettings() method saves all of the settings at one time.

Well, that’s it for frmMain. The next post will look at frmConfigure. Until that time, please let me know if you have any questions at John@JohnMuellerBooks.com. You can find the next post in this series at Exploring the GrabAPicture Application (Part 11).

Considering the Inefficiency of a Global Economy

A lot of people have said a lot about the global economy—how it exists and is pretty much unstoppable. However, a recent article in ComputerWorld, amongst others, have highlighted problems with the global economy. In this case, flooding in Thailand has impacted the availability of hard drivesdriving up the price that everyone pays. If manufacturing were decentralized, flooding in a single country wouldn’t have much of an effect. In short, the emphasis on cost of individual products instead of emphasizing the reliability of multiple sources of hard drives at an increased cost has proven a shortsighted strategy that inevitably hurt the world supply.

Some countries are using the global economy as a source of blackmail. According to the New York Times, China has consolidated its grip on rare earth metals used for everything from compact fluorescent lights to displays used in smartphones. The blackmail started after a disagreement with Japan. As a consequence, the price of any item that requires rare earths has gone up and will continue to increase. It’s another instance where price advantages offered by a global economy have come back to haunt us. In fact, this problem is so significant that the United States government is doing everything it can to create alternative sources, no matter the cost. Unfortunately, it will require nearly 15 years to fully develop those alternatives.

These two stories, and many more, only hint at the potential problems of a global economy. The problems are actually far more severe than you might initially think. When someone ships a hard drive all the way from Thailand to your home, the carbon footprint of that drive is quite large. It takes a lot of gas to move that hard drive. What the global economy does is it trades fossil fuel for price. The cost of the oil, plus the cost of the object (whatever it might be), is less than the cost of producing the object locally. The short term monetary gain takes priority over the cost to the environment and its eventual cleanup. In the long term, that hard drive will cost everyone a great deal more than if it had been purchased locally.

This blog has contained more than a few self-sufficiency posts (60 as of this post). You’ve seen discussions of how to grow your own food and reasonably recycle products instead of dumping them in a landfill. I even told you how to obtain CFLs for free (see CFLs for Free). All of these posts are practicalI’ve worked hard to write posts that demonstrate techniques that improve the condition of your wallet, decrease your health problems, and still help everyone around you by producing a greener environment. Even with these measures, I’m well aware that my carbon footprint is huge because a global economy forces me to buy articles from overseas. These items aren’t available locally and I can’t make them myself.

In the long run, it’s unlikely that we’ll be able to sustain a global economy unless the equation changes dramatically. Fossil fuels aren’t unlimitedwe’ll eventually run out, so from a practical perspective, transportation of items from overseas must change or we won’t be able to transport them. However, long before that happens, the damage to our environment will take a dramatic toll on everyone. The question is why anyone would wait around to see it all happen? Is the world determined to wait until everyone is so sick and so without resources that we have no choice but to toe the line? Does no one think about the effect they’re having until it’s too late?

I ask these questions because the global economy is simply a bad idea. Producing goods locally is far more efficient, even when the initial price for the good is higher. Eating and using what you can produce locally is far better for everyone. You do have a choice. Even with the global economy in full swing, you can buy local goodsin fact, insist on them. Tell local stores that you’re willing to pay more for local goods that are good for the environment. Your money matters. When stores find that they can’t sell those overseas items at any price, they’ll buy locally. “Give the customer what they want” is a cliche, but it’s also a fact. Vote with your cash to bring down a global economy that is ill conceived and killing us all. Let me know your thoughts about the global economy at John@JohnMuellerBooks.com.

 

Working the Fall Schedule

There is a misconception that anyone who works in a farm-like environment simply takes a vacation once the crops are in (no matter what those crops might be). It’s true that I’m slightly less frantic now than during the summer months when I need to be doing three things (or more) at once. However, the work continues throughout the fall and winter. The fall period begins after the garden is cleaned up, tilled, and planted with winter rye. Our winter rye is just showing above the ground at this point. It’ll stay that way until spring, when it’ll take a growth spurt. The winter rye roots will keep our precious soil in place and also provide “green manure” in the spring when we till it under.

A lot of people are surprised to see the two buckets of what appear to be shriveled bean pods in our basement, alongside the potatoes and squash. They actually are dried green beans, which might seem like a less than helpful use for them. However, the beans you buy for soup in the store come from this source. When we’re done canning green beans for winter, we let the remaining beans dry on the vines. We then pick them off, shell them, and use them in soups or for baked beans. In fact, anywhere you’d normally use dried beans you can use the dried green beans from your garden. Our dried beans are a beautiful shade of brown this year. We’ve had speckled beans, solid black beans, and a number of other colors, all of which contribute to a colorful soup, even if they taste mostly the same. You simply remove the pod by shelling the dried green bean and you end up with handfuls of beans you can store without much fuss at all. In short, green beans are an extremely efficient way to produce food—you can eat them green or dried and they require no special storage when dried (an airtight container is helpful).

Of course, this is also the time of year that I start getting into the woods to cut wood for winter. I’m actually bringing down wood that I cut and stacked last year (or two years ago in some cases). It won’t be quite enough for the entire winter, but it’s a good start. I’ll look for dead, dry trees to cut up to complete our wood supply for the winter, and then begin on next year’s wood. Rebecca helps by carrying wood from the cart, wood pile, or from the edge of the woods and throwing it into the basementsaving me a ton of time. Some of the wood has to be split, a good job for my maul on days when it’s too windy to cut wood.

Self-sufficiency relies on a lot of equipment as well. During the summer months there is little time to maintain it. Yes, if something breaks, you have to take time out to fix it, but that’s not the same as maintaining it. During the fall and winter months, I’ll sharpen shovels and spades, repair equipment, change the oil, and tune everything up. These maintenance actions are essential if you want to have a good summer. Nothing is worse than trying to dig with a dull spade. Anything I can do to make our hand, electric-powered, and gas-powered equipment work better is money in my pocket and time to do something else. So these winter months are an essential time for me.

This is also the time I’ll be working on new projects. For one thing, Rebecca needs a bit more storage and better lighting in the larder. I’ve been wanting some shelving for my equipment for quite some time now and I may get to it this winter. The chicks need something better than a refrigerator boxI’m planning to build a box that we can use as a combination of brooder (to keep young chicks warm) and rabbit house (during the summer months after the chicks are put outside).

Still, nothing beats sitting by the wood stove after a day of cutting wood and feeling it’s warmth hit tired muscles. I’ll break out my Knifty Knitter to make some hats, scarves, blankets, and socks (you can see some of the things I’ve made in my Knitting for the Gentleman Farmer post). I may even engage in some latch hook this winter to make a rug or wall hanging. Winter is a time of crafting too! So, how do you enjoy the fall and winter? Let me know at John@JohnMuellerBooks.com.

 

Beta Readers Required for a Java Book

I’m just starting a new book on Java. This book is meant for the beginner. I’m not assuming you’ve written one line of code in your entire life. The book content does assume that you’re at least familiar with your hardware and operating system, and that you’ve used some simple applications, such as a text editor. I’m really excited about this book because it uses some new forms of media to present the information to you. It’s not just a book, but an entire training course. This is going to part of the Dummies eLearning Kit series (see Windows 7 eLearning Kit as an example).

Naturally I want this book to be as perfect as I can make it. However, as I’ve pointed out in my Errors in Writing post, the more eyes I can get to look at my manuscript, the better. That’s where you come in. Beta readers provide the extra sets of eyes needed to turn a good book into a great book. Your input will affect everyone else who reads this book!

This isn’t just a Windows book either (although I’ll be including Windows as one of the operating systems). I’ll be working with Linux, Solaris, and Mac readers as well, so I really need a lot of eyes look at this book. As always, beta readers who send me constructive comments for at least three chapters will receive a free copy of the book. They’ll also see their name prominently displayed in the book Acknowledgments.

I’ll be turning in the first chapter soon, but there is still plenty of time to get going on this book. If you want to participate in this book project, just contact me at John@JohnMuellerBooks.com for all of the details. Anyone who has always wanted to discover the joys of programming in Java, a language with fantastic cross-platform support, will want to read this book. Get in on the ground floor and make a difference! No prior experience required! You absolutely don’t need to be a geek to get involved in this project .