Creating Links Between File Extensions and Batch Files

A couple of weeks ago I wrote a post entitled, “Adding Batch Files to the Windows Explorer New Context Menu” that describes how to create an entry on the New context menu for batch files. It’s a helpful way to create new batch files when you work with them regularly, as I do. Readers of both Administering Windows Server 2008 Server Core and Windows Command-Line Administration Instant Reference need this sort of information to work with batch files effectively. It wasn’t long afterward that a reader asked me about creating links between file extensions and batch files. For example, it might be necessary to use a batch file to launch certain applications that require more information than double clicking can provide.

This example is going to be extremely simple, but the principle that it demonstrates will work for every sort of file extension that you can think about. Fortunately, you don’t even need to use the Registry Editor (RegEdit) to make this change as you did when modifying the New menu. The example uses this simple batch file named ViewIt.BAT.

@Echo Processing %1
@Type %1 | More
@Pause

Notice that the batch file contains a %1 entry that accepts the filename and path the Windows sends to it. You only receive this single piece of information from Windows, but that should be enough for many situations. All you need to do then is create a reasonably smart batch file to perform whatever processing is necessary before interacting with the file. This batch file will interact with text (.TXT extension) files. However, the same steps work with any other file extension. In addition, this isn’t a one-time assignment—you can assign as many batch files as desired to a single file extension. Use these steps to make the assignment (I’m assuming you have already created the batch file).

  1. Right-click any text file in Windows Explorer and choose Open With from the context menu.
  2. Click Choose Default Program from the list of options. You see the Open With dialog box shown here.
    Link01
  3. Clear the Always Use the Select Program to Open this Kind of File option.
  4. Click Browse. You see the Open With dialog box.
  5. Locate and highlight the batch file you want to use to interact with the text file (or any other file for that matter) and click Open. You see the batch file added to the Open With dialog box.
  6. Click OK. You see the batch file executed on the selected file as shown here.
    Link02

At this point, you can right-click any file that has the appropriate extension and choose the batch file from the Open With menu. The batch file will receive the full path to the file as shown in this example. It can use the information as needed to configure the environment and perform other tasks, including user interaction. Let me know your thoughts on linking file extensions to batch files at John@JohnMuellerBooks.com.

 

An Update On Our Pullets

I recently wrote about our chickens first attempts at laying eggs in my Pullet Eggs post. Of course, nothing remains static. Our nine pullets are laying four eggs on average every day now. That number will increase as spring approaches because the number of daylight hours is increasing. Depending on which source you use, chickens require somewhere between 12 and 14 hours of daylight in order to lay eggs with any frequency.

There are some interesting things to consider beside the number of hours of daylight, however. For example, some chickens are winter layers—they are significantly less affected by the number of daylight hours than other breeds. Our Delaware pullets seem to lay eggs nearly every day. The Ameraucanas are less affected by the lack of daylight, but they lay only every other day. The Black Australorp is laying few eggs (about one a week) because she’s not a winter layer. The Buff Orpingtons naturally lay fewer eggs than the Delawares or Ameraucanas, so it’s hard to tell much about their laying capacity in the winter. We’ll learn more as time progresses.

The weather seems to have less to do with egg laying than the number of daylight hours does. Our chickens seem to continue producing eggs at a regular pace no matter what the outside temperature might be. This past week has seen some extreme cold, but the chickens continued laying. The coop is unheated, so we checked for eggs regularly to keep them from freezing. We also kept the chickens in the coop on days where the daytime temperature was below 20 degrees Fahrenheit.

Hen health is important for getting good eggs though, so we make sure our hens have enough of the right sorts of things to eat. Because this is winter and there are no bugs for our hens to eat, we make sure that they get plenty of high protein food sources. The hens also get greens and other kitchen scraps. Sometimes they look quite funny running around with bits of fruit in their beaks. Along with all of their other food, we do provide them with layer mash—a necessity to ensure they get enough calories to survive the cold temperatures.

We also had something interesting happen with our Black Australorp this past week. She laid the largest double yolked egg I’ve ever seen—it wouldn’t even fit in the egg carton. After I saw the egg my wife brought in, I decided to check our hen to make sure she hadn’t been damaged by laying it, but she seemed just fine. Double yolked eggs are somewhat rare, about 1 in 1000. One this size must be rarer still. I wish I had gotten a picture of it, but we ate it before we thought to get a picture. Unfortunately, it will be a long time before we get another.

Our pullets will turn into hens soon. Each day the eggs get a little larger and we’ll soon have jumbo-sized eggs. The eggs are about medium in size now. We plan to get an egg scale so that we can size the eggs correctly. In the meantime, seeing our chickens grow and develop is nothing short of amazing. Let me know about your chicken experiences at John@JohnMuellerBooks.com.

 

CodeBlocks 12.11 Update (Final, for Now)

I had promised in my CodeBlocks 12.11 Update (Reminder) post to let you know about update information for the CodeBlocks 12.11 version. Because I received only a few messages from interested readers and all but one of them have said that the 10.05 posts are working fine for them, I’ve decided not to provide a new series of posts at this time. Of course, it may be that other people using C++ All-In-One Desk Reference For Dummies will experience problems and I’ll need to provide those updates after all. Nothing is ever final here—only final until it needs to change.

My main goal is to ensure that readers have everything needed to use my book successfully. At the moment, it appears that they do, but please don’t feel your input isn’t valuable to me. Always feel free to write me about issues you have with my books. Whenever possible, I’ll provide the information you need to use my books successfully right here on this blog so you can access the information whenever you need it. You should always check my blog as your first resource for answering questions.

If there is any additional input on this particular issue, please feel free to write me at John@JohnMuellerBooks.com. If I later find that a series of 12.11 posts is necessary, I’ll be more than happy to write them. In the meantime, keep those e-mails coming! I really enjoy hearing from you .

 

JavaScript and Memory Leaks

I recently finished writing HTML5 Programming with JavaScript For Dummies. This book focuses a lot of attention on working efficiently with JavaScript to produce full-fledged browser-based applications. You’ll find everything from creating simple code to update form entries to creating interesting special effects for your user interface. In fact, I spend considerable time looking at third party libraries such as jQuery and jQuery UI—an incredibly useful set of functions that can significantly reduce coding time.

One of my goals in the book is to introduce you to techniques that produce useful applications in an incredibly short time without writing bad code. The term bad code covers a lot of ground, but one of the more serious issues is one of memory leaks. Applications that have memory leaks will cause the application and everything else on the system to slow down due to a lack of usable memory. In addition, memory leaks can actually cause the application to crash or the system to freeze when all of the available memory is used up. So, it was with great interest that I read an InfoWorld article recently entitled, “Brendan Eich tells how to prevent JavaScript memory leaks.” The article contains a lot of useful advice in writing good JavaScript code that won’t cause your users heartache. Just in case you’ve never heard of him, Brendan Eich is the creator of the JavaScript language, so I’m sure he knows quite a lot about what makes the language tick.

There are a few points of interest in the article. A big one is that the memory leak you’re seeing in your application may not be due to your code—it may be caused by the browser. The potential for browser problems is an important one to keep in mind because these issues affect every application that runs, not just yours. However, when your application performs a lot of work that requires heavy memory use, the user may see your application as the culprit. It pays to track browser issues so that you can support your users properly and recommend browser updates for running your application when appropriate. For that matter, you can simply determine whether the user has one of the poorly designed browsers and tell the user to perform an update instead of running the application.

What I found curious about the article is that it doesn’t discuss other potential sources of memory leaks. For example, using the wrong third party library could cause considerable woe when it comes to memory usage (amongst other issues). Consequently, you need to research any libraries or templates that you use carefully. The libraries, templates, and other tools discussed in my book were chosen with extreme care to ensure you get the best start possible in creating JavaScript applications.

One of the reasons I find JavaScript so compelling as a language is that it has grown to include enough features to create real applications that run in just about any browser on just about any platform. The ability to run applications anywhere at any time has been a long term goal of computer science and it finally seems to be a reality at a certain level. What are your thoughts on JavaScript? Let me know at John@JohnMuellerBooks.com.

 

Some Interesting Windows 8 Information

I constantly track information for my books because I like to keep readers informed about changes when I can. Even though Windows 8 for Dummies Quick Reference appeared in print not long ago, there have been some interesting developments about the operating system it supports. Of course, the least newsworthy development has been the relatively slow adoption of the new operating system. A number of industry pundits are saying that Windows 8 is another Vista, or possibly worse. Statistics have never impressed me very much. Windows 8 will either succeed or it won’t, but it really is too early to tell.

The most interesting piece of information is that people aren’t actually using the much touted Windows 8 touch interface. People are actually buying the least expensive laptops possible to run Windows 8—devices that lack any sort of touch capability. This bit of information has taken me by surprise because Windows 8 really does appear to need a touch interface to work correctly. That said, Windows 8 for Dummies Quick Reference does include a considerable array of keyboard and mouse techniques because I had expected desktop users who upgraded to become completely lost without this information. It may turn out that the additional information helps a lot more than current desktop users based on what the press is saying.

It also appears that you may have an interesting time downgrading your Windows 8 installation to Windows 7, even though Microsoft tells you that you’re legally able to do so. The problem seems to be one of finding the copy of Windows 7 to use for the downgrade. The vendor who supplies the copy of Windows 8 with a system is supposed to provide the copy of Windows 7 to you, but the real world reality is that the vendor often doesn’t do so. The other problem is one of licensing. Microsoft constantly changes its licensing and uses terminology that even a lawyer can’t understand (much less us mere mortals). Trying to figure out whether you’re actually able to downgrade your copy of Windows 8 to Windows 7 can prove daunting. Microsoft has recently provided a clearer set of rules as part of a downloadable whitepaper that you can use to determine your rights.

I’d love to hear about your experiences using Windows 8. In addition, it would be useful to hear from people who have downgraded their copy to Windows 7 and why they made the change. Tell me about the Windows 8 coverage in my book and whether you need additional help with Windows 8 to make the book useful at John@JohnMuellerBooks.com. Windows 8 has truly turned into a surprising update; one that may require some additional posts to my blogs to provide good book support.

 

Unexpected Drought Consequences

I’ve written a number of posts about the effects of global warming from a personal perspective. It does make a difference in how I view the whole issue of global warming. Whether global warming is a matter of cyclic world changes, human interaction, natural sources, or some combination of thereof isn’t the point—the point is that the earth is getting warmer, which is causing changes of various sorts that affect me as a person. Your best way to deal with these changes is to make a list of how they affect you and come up with effective strategies for dealing with them.

This summer saw a drought come to our area. There is more than a little evidence to say that the drought is just another effect of global warming. People focus on droughts during the summer months because crops are affected, grass dies, and the heat becomes oppressive. The television, radio, and newspaper blare pronouncements of impending doom from dawn till dusk each day. However, the winter effects of drought can become even more devastating than those in summer.

Consider the fact that snow acts as an insulating blanket for the earth. It helps retain some of the heat in the deep layers. When there is a lack of snow, frost tends to go further into the ground and cause all sorts of nasty consequences, especially during a heavy freeze. My reason for writing about heavy freezes is that we’re experiencing one here in Wisconsin and I’m concerned about the potential of damage to either my well or septic system. Nothing is quite as exciting as living almost four miles from town and not being able to use any water because your septic system is frozen. Once frozen, you need to call a professional to thaw the system so you can use it again. If your professional is especially busy, you may be waiting for a few days.

The problems of deep frost aren’t limited to the well or septic system. A deeper frost creates more heaving—water freezes and the resulting ice displaces some of the earth underground. The most conspicuous result of heaving is that any pavement on your property buckles and doesn’t last nearly as long as it could. It’s possible to assign an actual dollar amount to the lost longevity of your sidewalks and driveway. The effects can also profoundly affect your house’s foundation.

Heaving also causes myriad other problems for the self-sufficient person. For example, those posts you put in for your grape vines will become misaligned—forcing you to spend time readjusting the cables and possibly damaging the vines. A deep frost can kill tree, vine, and permanent bed plant roots. You’ll also have the pleasure of picking more rocks from the garden come spring because heaving brings them to the surface (despite the perception that they grow there during the winter). I’m also wondering how a deep frost will affect our new chicken coop (despite having put the posts as deeply as we could in the ground, heaving will still have an effect on them).

There is also the direct heating costs to consider. A blanket of snow on your roof acts as additional insulation. When this blanket is removed completely, your house loses more heat. Of course, there is also a problem when there is too much snow on your roof (causing damage from the weight) and the whole issue of ice dams. However, during this time of the year, a nice insulating layer of snow can save heating dollars.

Drought causes serious problems during the winter as well as the summer. No matter where you live, you have to consider the effects of drought on your property and the structures it supports. What sorts of winter drought effects have you see in the past? Do you think the increased number of droughts is due to a natural cycle in the earth’s weather pattern or from global warming (or possibly a combination of both)? Write me about your drought observations at John@JohnMuellerBooks.com.

 

CodeBlocks 12.11 Update (Reminder)

Last week I wrote a post entitled, “CodeBlocks 12.11 Update.” So far, I’ve received only a few e-mails about the update. However, I’m still receiving e-mail on the topic and I want to be sure everyone is heard. If you haven’t had a chance to write me yet about the CodeBlocks 12.11 update and whether it affects you when working with my book, please contact me at John@JohnMuellerBooks.com.

Part of the reason I ask about these updates is that I like to track how many people are using a particular update with my books. It helps me build a picture of my readers so that I can serve their needs better. The information also helps me understand how quickly people update particular products so that I have a better idea of when to ask publishers about a book update.

Often, I’m not successful in obtaining an update from the publisher unless there is a compelling reason to write one. That’s where you come in. Readers have provided me with more good reasons to provide an update than any other source I use for determining when one is needed. Your input really does matter, so please keep those e-mails coming. I plan to provide a post that will let you know whether I’ll write update posts for CodeBlocks 12.11 for C++ All-In-One Desk Reference For Dummies next week Monday.

Sending Comments and Asking Questions

Anyone who reads my blog for very long understands that supporting my books is a big deal for me. I actively work with my readers because I realize that you have the choice of using books written by other authors. Let’s just say that my support system is one of the reasons you really do want to buy my books. My blog not only answers common questions you have, but also adds examples and other information to the information you already receive through my books, so make sure you keep you eyes peeled for additional information here as well.

The last time I discussed this topic was in 2011 in my Contact Me, Please! post. The same things apply now as they did then. I’ll answer your book-specific questions as soon as I possibly can and in as much detail as I can. However, I won’t write your school term paper for you, accept a marriage proposal, or provide free consulting (amongst other things readers have asked me to do in the past). If you’re having problems with an example or can’t find the book’s source code, please be sure to ask because I want your experience with my books to be nothing less than phenomenal.

I also encourage you to be a beta reader. You can see the posts I’ve made for several recent books. The biggest reason for me to ask readers to participate in the book building process is to ensure you get the book you want. I also want to avoid Errors in Writing. As far as I know, I’m the only technical author on the planet that invites reader comment during the writing process, but I truly feel your input is essential, so I request it in every way I can. As I get new book contracts, you’ll continue to see requests for beta readers posted on my blog.

You can always contact me at John@JohnMuellerBooks.com with any comments and questions you have. This includes both books and blog posts. Let me know about any concerns you might have and I’ll do my best to solve them. In the meantime, happy reading !

 

Pruning the Grapes (Part 1)

Previously I had written about trimming our trees. We normally perform tree trimming in March or possibly April in a really cold year. The snow is gone and the temperatures, even though they’re still quite cool, are warm enough to work in without suffering frost bite. Pruning grapes seems to be a different story. Past experience has shown us that pruning grapes in March almost assures that we won’t obtain much in the way of a harvest because the cuts don’t have time to heal properly before the grapes start pumping water into the stems. What you end up seeing is water dripping from all of the cuts if you prune grapes that late.

We’ve also tried pruning our grapes in the fall. Unfortunately, the winter air damages the cut ends, leaving more dead material than we would like. It also seems as if the wildlife takes the fresh cuts as an invitation for further pruning. We actually had several vines trimmed to unusable nubs by the local deer. Obviously, fall pruning doesn’t work for us either.

As with many other self-sufficiency issues, this one is a learning experience. We know that if we keep at it long enough, eventually we’ll have a good system down for our grapes. You can read all you want and ask everyone who has any idea at all about how to do things, but your plot of ground is different from any other plot of ground out there. When you’re self-sufficient, you have to be prepared to experiment. So, undaunted by previous failures, this year we’re pruning our grapes in mid-January. The timing will allow the grape ends to heal before spring takes hold, but should present less opportunity to the local wildlife for extra trimming and the weather won’t have as much of an effect either.

The approach you use for pruning your grapes depends on your weather and the method you use to train them. We use a four-cane Kniffin system. The approach yields a relatively large number of grapes, is easy to maintain, and doesn’t tend to have problems with mildew due to lack of airflow (as is the case with arbors). Picking can be more time consuming than when working with arbors and you need a source of rot resistant posts. Fortunately, we do have a native source of rot resistant posts in the form of the black locust trees that grow in our woods. Farmers actually planted them to use as fence posts.

Most of the books we have say that it takes seven years for grapes to grow to sufficient size to start producing well. Our own experience says that it’s more like ten years, especially if you have wildlife constantly nibbling at the canes. We finally ended up staking out one of our dogs to keep the wildlife at bay one year so the vines could grow unmolested.

We’ve chosen to plant a number of grape varieties: Niagra (white), Catawba (red), Concord (purple), Delaware (pinky purple), and King of the North (blue). Each cultivar has specific properties to recommend it. For example, the Delaware produces an outstanding wine grape, while the Concord is better for jelly production. The King of the North is a good juice or table grape. We prefer the Niagra for table and juice uses, but it should also make for a nice wine. The Catawba has yet to produce sufficient quantities of grapes for us to test it for various uses, but we’re assuming that we’ll use it for wine. When choosing grapes for your own vineyard, make sure you pick from a variety of cultivars. A single mature trunk can produce a significant number of grapes (upwards of 40 pounds), so you need a plan for using them.

It’s also a mistake to prune every year. I had noticed some of our local vineyards don’t trim their canes absolutely every year. When I started pruning every other year, our harvest went up significantly without reducing the vitality of the vines. It may be that some locations require yearly pruning, but this doesn’t seem to be the case here.

What are your experiences with grapes? Do you favor particular cultivars over others? Let me know your thoughts at John@JohnMuellerBooks.com.

 

CodeBlocks 12.11 Update

A number of readers have recently begun writing me about issues with CodeBlocks 12.11 with the example code for my book. I originally wrote C++ All-In-One Desk Reference For Dummies around the 8.02 release of CodeBlocks, which is still available at http://www.codeblocks.org/downloads/5. Just look halfway down the page and you’ll find the download you need. I still highly recommend that you use the 8.02 release with the book, simply because the newer product versions introduce compatibility issues that make it necessary for you to modify the example code in certain ways.

However, I also understand your desire to work with the latest version of the product. That’s why I wrote a series of posts about the 10.05 release of CodeBlocks and what you would need to do to make it work with the examples. Unfortunately, another group of readers has complained that the instructions are too hard to follow. The fix, of course, is to use the 8.02 release if you find that the 10.05 release isn’t working well for you. There isn’t much else I can do at this point to make things easier (although, I’m always open to your ideas).

What I’d like to know is how many readers are actually using the 12.11 release and whether the instructions for the 10.05 release also work in this case. My initial take is that there are at least a few readers who have found they need version 12.11-specific instructions, which would mean another series of blog posts to address changes to the examples. I’d start with the original code and wouldn’t force you to make multiple updates. As you might imagine, testing every example in the book and writing an update procedure for it (if necessary) will take time, so I want to be sure that there is interest in this series of posts.

If you have an opinion on this topic, please let me know. I’d like to determine how much interest there is in a series of posts that describe code changes needed to make my book work with the 12.11 update. Please contact me at John@JohnMuellerBooks.com with your ideas and questions.